File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Apalache configuration for DieHardest (Section 4, interleaved composition).
2+
3+ $ apalache-mc check \
4+ --cinit=ConstInit --next=NextInterleaved \
5+ --inv=NotSolved --length=13 \
6+ APADieHardest.tla
7+
8+ Apalache finds the expected 12-state counterexample in about four hours
9+ on a 2021 MacBook Pro (Apalache 0.52.2).
10+
11+ ----------------------------- MODULE APADieHardest ------------------------------
12+ (* **************************************************************************)
13+ (* Apalache-compatible model-checking wrapper for DieHardest. *)
14+ (* *)
15+ (* DieHardest's Sections 1-3 use TLC-specific operators (TLCGet, TLCSet) *)
16+ (* that Apalache does not support. This module checks only Section 4 *)
17+ (* (interleaved composition) by selecting NextInterleaved via --next. *)
18+ (* *)
19+ (* Adaptations for Apalache: *)
20+ (* - Constants are initialized via ConstInit (--cinit) rather than a *)
21+ (* TLC .cfg file. *)
22+ (* - Capacity functions use [s \in S |-> ...] instead of the TLC-module *)
23+ (* operators :> and @@. *)
24+ (************************************************************************** *)
25+
26+ CONSTANT
27+ \* @type: Seq(Str -> Int);
28+ Capacities ,
29+ \* @type: Int;
30+ Goal
31+
32+ VARIABLE
33+ \* @type: Str -> Int;
34+ c1 ,
35+ \* @type: Str -> Int;
36+ c2 ,
37+ \* @type: Int;
38+ s1 ,
39+ \* @type: Int;
40+ s2
41+
42+ INSTANCE DieHardest
43+
44+ MCGoal == 4
45+
46+ MCCapacity1 ==
47+ [ s \in { "j1" , "j2" } |-> IF s = "j1" THEN 5 ELSE 3 ]
48+
49+ MCCapacity2 ==
50+ [ s \in { "j1" , "j2" , "j3" } |-> IF s = "j1" THEN 5 ELSE 3 ]
51+
52+ ConstInit ==
53+ /\ Capacities = << MCCapacity1 , MCCapacity2 >>
54+ /\ Goal = MCGoal
55+
56+ =============================================================================
Original file line number Diff line number Diff line change @@ -160,6 +160,10 @@ NextParallelFreeze ==
160160ASSUME TLCSet ( 2 , 999 ) /\ TLCSet ( 3 , 999 )
161161
162162NextParallelGlobalFreeze ==
163+ \* TLCGet is called with both Str and Int arguments (TLCGet("level")
164+ \* vs. TLCGet(2)), so Apalache's type checker cannot assign a single
165+ \* type to its parameter. This operator is therefore incompatible
166+ \* with Apalache. See APADieHardest.tla, which checks Section 4 only.
163167 /\ IF TLCGet ( "level" ) >= TLCGet ( 2 ) THEN UNCHANGED c1 ELSE D1 ! Next
164168 /\ IF TLCGet ( "level" ) >= TLCGet ( 3 ) THEN UNCHANGED c2 ELSE D2 ! Next
165169 /\ Goal \in Range ( c1 ' ) /\ TLCGet ( 2 ) = 999 => TLCSet ( 2 , TLCGet ( "level" ) + 1 )
Original file line number Diff line number Diff line change 2424 "features" : [],
2525 "models" : []
2626 },
27+ {
28+ "path" : " specifications/DieHard/APADieHardest.tla" ,
29+ "features" : [],
30+ "models" : []
31+ },
2732 {
2833 "path" : " specifications/DieHard/MCDieHarder.tla" ,
2934 "features" : [],
You can’t perform that action at this time.
0 commit comments