Theory DiskPaxos_Model
section "Disk Paxos Algorithm Specification"
theory DiskPaxos_Model imports Main begin
text‹This is the specification of the Disk Synod algorithm.›
typedecl InputsOrNi
typedecl Disk
typedecl Proc
axiomatization
Inputs :: "InputsOrNi set" and
NotAnInput :: "InputsOrNi" and
Ballot :: "Proc ⇒ nat set" and
IsMajority :: "Disk set ⇒ bool"
where
NotAnInput: "NotAnInput ∉ Inputs" and
InputsOrNi: "(UNIV :: InputsOrNi set) = Inputs ∪ {NotAnInput}" and
Ballot_nzero: "∀p. 0 ∉ Ballot p" and
Ballot_disj: "∀p q. p ≠ q ⟶ (Ballot p) ∩ (Ballot q) = {}" and
Disk_isMajority: "IsMajority(UNIV)" and
majorities_intersect:
"∀S T. IsMajority(S) ∧ IsMajority(T) ⟶ S ∩ T ≠ {}"
lemma ballots_not_zero [simp]:
"b ∈ Ballot p ⟹ 0 < b"
proof (rule ccontr)
assume b: "b ∈ Ballot p"
and contr: "¬ (0 < b)"
from Ballot_nzero
have "0 ∉ Ballot p" ..
with b contr
show "False"
by auto
qed
lemma majority_nonempty [simp]: "IsMajority(S) ⟹ S ≠ {}"
proof(auto)
from majorities_intersect
have "IsMajority({}) ∧ IsMajority({}) ⟶ {} ∩ {} ≠ {}"
by auto
thus "IsMajority {} ⟹ False"
by auto
qed
definition AllBallots :: "nat set"
where "AllBallots = (UN p. Ballot p)"
record
DiskBlock =
mbal:: nat
bal :: nat
inp :: InputsOrNi
definition InitDB :: DiskBlock
where "InitDB = ⦇ mbal = 0, bal = 0, inp = NotAnInput ⦈"
record
BlockProc =
block :: DiskBlock
proc :: Proc