Skip to content

Commit 48ea628

Browse files
lemmyclaude
andcommitted
EWD840_proof: do not rely on instantiation distributing over WF.
Instantiation does not distribute over ENABLED, and hence not over WF. The proof of Spec => TD!Spec relied on WF_TD!vars(TD!DetectTermination) matching the fairness conjunct of TD!Spec, which tlapm#321 no longer allows. SyncTerminationDetection now names its fairness condition Fair, and the proof derives TD!Fair from the new lemma SyncTerminationDetection_proof!Fairness, as suggested by Stephan Merz. tlaplus/tlapm#69 tlaplus/tlapm#321 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>
1 parent ab4979e commit 48ea628

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎specifications/ewd840/EWD840_proof.tla‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ BY Live, TypeCorrect, Invariant, PTL DEF Spec
281281
(* Note that the parameters of the module SyncTerminationDetection are *)
282282
(* instantiated by the symbols of the same name in the present module. *)
283283
(***************************************************************************)
284+
TDP == INSTANCE SyncTerminationDetection_proof
285+
284286
THEOREM Spec => TD!Spec
285-
<1>. USE DEF Node, TD!Node
287+
<1>. USE DEF Node, TD!Node, TDP!Node
286288
<1>1. Init => TD!Init
287289
BY DEF Init, TD!Init, terminationDetected
288290
<1>2. TypeOK /\ Inv /\ [Next]_vars => [TD!Next]_TD!vars
@@ -299,18 +301,19 @@ THEOREM Spec => TD!Spec
299301
BY <2>4 DEF Deactivate, TD!Next, TD!Terminate, TD!terminated
300302
<2>. QED BY <2>1, <2>2, <2>3, <2>4 DEF Next, System, Environment
301303
<1>3. []TypeOK /\ []Inv /\ [][Next]_vars /\ WF_vars(System)
302-
=> WF_TD!vars(TD!DetectTermination)
304+
=> TDP!Fair
303305
<2>. SUFFICES /\ []TypeOK /\ []Inv /\ [][Next]_vars /\ WF_vars(System)
304-
/\ []ENABLED <<TD!DetectTermination>>_TD!vars
306+
/\ <>[](TDP!terminated /\ ~terminationDetected)
305307
=> FALSE
306-
BY PTL
307-
<2>1. TypeOK /\ ENABLED <<TD!DetectTermination>>_TD!vars
308-
=> terminated /\ ~terminationDetected
309-
BY ExpandENABLED
310-
DEF TypeOK, TD!DetectTermination, TD!vars, terminated, TD!terminated, terminationDetected
308+
<3>. TypeOK => TDP!TypeOK
309+
BY DEF TypeOK, TDP!TypeOK, terminationDetected
310+
<3>. QED BY TDP!Fairness, PTL
311+
<2>1. TDP!terminated => terminated
312+
BY DEF TDP!terminated, terminated
311313
<2>. QED BY <2>1, Live, PTL DEF Liveness
312314
<1>. QED
313-
BY <1>1, <1>2, <1>3, TypeCorrect, Invariant, PTL DEF Spec, TD!Spec
315+
BY <1>1, <1>2, <1>3, TypeCorrect, Invariant, PTL DEF Spec, TD!Spec, TD!Fair, TDP!Fair,
316+
TD!vars, TDP!vars, TD!DetectTermination, TDP!DetectTermination, TD!terminated, TDP!terminated
314317
=============================================================================
315318
\* Modification History
316319
\* Created Mon Sep 09 11:33:10 CEST 2013 by merz

‎specifications/ewd840/SyncTerminationDetection.tla‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Next ==
5050
\/ DetectTermination
5151

5252
vars == <<active, terminationDetected>>
53-
Spec == Init /\ [][Next]_vars /\ WF_vars(DetectTermination)
53+
Fair == WF_vars(DetectTermination)
54+
Spec == Init /\ [][Next]_vars /\ Fair
5455

5556
------------------------------------------------------------------------------
5657
(* Correctness properties *)

‎specifications/ewd840/SyncTerminationDetection_proof.tla‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ LEMMA Enabled_ST ==
3939
PROVE (ENABLED <<DetectTermination>>_vars) <=> terminated /\ ~terminationDetected
4040
BY ExpandENABLED DEF TypeOK, DetectTermination, terminated, vars
4141

42+
LEMMA Fairness ==
43+
ASSUME []TypeOK
44+
PROVE Fair <=> (<>[](terminated /\ ~terminationDetected) => []<><<DetectTermination>>_vars)
45+
BY Enabled_ST, PTL DEF Fair
46+
4247
(****************************************************************************)
4348
(* Proving liveness is easy since a single occurrence of the helpful action *)
4449
(* DetectTermination leads to the desired state. *)
@@ -52,6 +57,6 @@ THEOREM Live == Spec => Liveness
5257
BY DEF TypeOK, DetectTermination
5358
<1>3. TypeOK /\ P => ENABLED <<DetectTermination>>_vars
5459
BY Enabled_ST
55-
<1>. QED BY <1>1, <1>2, <1>3, TypeCorrect, PTL DEF Spec, Liveness
60+
<1>. QED BY <1>1, <1>2, <1>3, TypeCorrect, PTL DEF Spec, Fair, Liveness
5661

5762
=============================================================================

0 commit comments

Comments
 (0)