Theory LastVotingDefs
theory LastVotingDefs
imports "../HOModel"
begin
section ‹Verification of the \emph{LastVoting} Consensus Algorithm›
text ‹
The \emph{LastVoting} algorithm can be considered as a representation of
Lamport's Paxos consensus algorithm~\<^cite>‹"lamport:part-time"›
in the Heard-Of model. It is a coordinated algorithm designed to
tolerate benign failures. Following~\<^cite>‹"charron:heardof"›, we formalize
its proof of correctness in Isabelle, using the framework of theory ‹HOModel›.
›
subsection ‹Model of the Algorithm›
text ‹
We begin by introducing an anonymous type of processes of finite
cardinality that will instantiate the type variable ‹'proc›
of the generic CHO model.
›
typedecl Proc
axiomatization where Proc_finite: "OFCLASS(Proc, finite_class)"
instance Proc :: finite by (rule Proc_finite)
abbreviation
"N ≡ card (UNIV::Proc set)"
text ‹
The algorithm proceeds in \emph{phases} of $4$ rounds each (we call
\emph{steps} the individual rounds that constitute a phase).
The following utility functions compute the phase and step of a round,
given the round number.
›
definition phase where "phase (r::nat) ≡ r div 4"
definition step where "step (r::nat) ≡ r mod 4"
lemma phase_zero [simp]: "phase 0 = 0"
by (simp add: phase_def)
lemma step_zero [simp]: "step 0 = 0"
by (simp add: step_def)
lemma phase_step: "(phase r * 4) + step r = r"
by (auto simp add: phase_def step_def)
text ‹
The following record models the local state of a process.
›