forked from Starydark/PaxosStore-tla
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Consensus.tla
27 lines (25 loc) · 1.03 KB
/
Consensus.tla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
----------------------------- MODULE Consensus ------------------------------
EXTENDS Integers, FiniteSets, Sets, TLAPS
-----------------------------------------------------------------------------
CONSTANT Value \* the set of values that can be chosen
VARIABLE chosen \* the set of values that have been chosen
-----------------------------------------------------------------------------
Init == chosen = {}
Next ==
/\ chosen = {}
/\ \E v \in Value : chosen' = {v}
Spec == Init /\ [][Next]_chosen
-----------------------------------------------------------------------------
Inv ==
/\ chosen \subseteq Value
/\ IsFiniteSet(chosen)
/\ Cardinality(chosen) \leq 1
-----------------------------------------------------------------------------
THEOREM Invariance == Spec => []Inv
<1>1. Init => Inv
BY CardinalityZero, SMT DEF Init, Inv
<1>2. Inv /\ [Next]_chosen => Inv'
BY CardinalityOne, SMT DEF Next, Inv
<1>3. QED
BY <1>1, <1>2, PTL DEF Spec
=============================================================================