Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finitizing monotonic systems Take2 #155

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

lemmy
Copy link
Member

@lemmy lemmy commented Feb 12, 2025

Related to #97

Supersedes #153

@lemmy lemmy mentioned this pull request Feb 12, 2025
@lemmy lemmy force-pushed the mku-FiniteMonotonic branch 5 times, most recently from 373f037 to c20756d Compare February 13, 2025 04:41
@lemmy
Copy link
Member Author

lemmy commented Feb 13, 2025

TLAPS, unlike SANY, doesn’t mind the duplicate FairSpec symbol:

-> % opam exec -- tlapm CRDT_proof.tla       
(* loading fingerprints in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
(* created new ".tlacache/CRDT_proof.tlaps/CRDT_proof.thy" *)
(* fingerprints written in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
File "./CRDT_proof.tla", line 1, character 1 to line 354, character 77:
[INFO]: All 210 obligations proved.
Semantic processing of module CRDT_proof
Semantic errors:

*** Errors: 1

line 44, col 1 to line 46, col 13 of module CRDT_proof

Operator FairSpec already defined or declared.


*** Warnings: 1

line 44, col 1 to line 46, col 13 of module CRDT_proof

Multiple declarations or definitions for symbol FairSpec.  
This duplicates the one at line 44, col 1 to line 52, col 49 of module CRDT.

@lemmy lemmy force-pushed the mku-FiniteMonotonic branch from c20756d to b551d53 Compare February 13, 2025 04:57
@ahelwer
Copy link
Collaborator

ahelwer commented Feb 13, 2025

I'll take a look to see whether we can combine some of the validation checks to all run one after the other to dump as much info as possible instead of needing multiple reversions.

The multiple declarations thing seems like a bug in TLAPM.

It seems like the CI is failing due to a false assumption:

INFO:root:specifications\FiniteMonotonic\MCCRDT.cfg
INFO:root:specifications\FiniteMonotonic\MCCRDT.cfg in 1.2s vs. 5s expected
ERROR:root:Model specifications\FiniteMonotonic\MCCRDT.cfg expected result success but got assumption failure
ERROR:root:java -enableassertions -Dtlc2.TLC.ide=Github -Dutil.ExecutionStatisticsCollector.id=abcdef60f238424fa70d124d0c77ffff -XX:+UseParallelGC -cp deps\tools\tla2tools.jar;deps\apalache\bin\apalache-mc\lib\apalache.jar;deps\community\modules.jar;deps\tlapm\library tlc2.TLC specifications\FiniteMonotonic\MCCRDT.tla -config specifications\FiniteMonotonic\MCCRDT.cfg -workers auto -lncheck final -cleanup
TLC2 Version 2.20 of Day Month 20?? (rev: 5e1673e)
Running breadth-first search Model-Checking with fp 113 and seed -8506375968434451154 with 4 workers on 4 cores with 3641MB heap and 64MB offheap memory [pid: 7568] (Windows Server 2022 10.0 amd64, Eclipse Adoptium 17.0.14 x86_64, MSBDiskFPSet, DiskStateQueue).
Parsing file D:\a\Examples\Examples\specifications\FiniteMonotonic\MCCRDT.tla
Parsing file D:\a\Examples\Examples\specifications\FiniteMonotonic\CRDT.tla
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\FiniteSetsExt.tla (jar:file:/D:/a/Examples/Examples/deps/community/modules.jar!/FiniteSetsExt.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\TLC.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/TLC.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\_TLCTrace.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/_TLCTrace.tla)
Parsing file D:\a\Examples\Examples\specifications\FiniteMonotonic\Naturals_UnicodeShim.tla
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\Naturals.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/Naturals.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\Folds.tla (jar:file:/D:/a/Examples/Examples/deps/community/modules.jar!/Folds.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\Functions.tla (jar:file:/D:/a/Examples/Examples/deps/community/modules.jar!/Functions.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\FiniteSets.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/FiniteSets.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\Sequences.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/Sequences.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\TLCExt.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/TLCExt.tla)
Parsing file C:\Users\runneradmin\AppData\Local\Temp\tlc-12797422335019391011\Integers.tla (jar:file:/D:/a/Examples/Examples/deps/tools/tla2tools.jar!/tla2sany/StandardModules/Integers.tla)
Semantic processing of module Naturals
Semantic processing of module Naturals_UnicodeShim
Semantic processing of module CRDT
Semantic processing of module Folds
Semantic processing of module Functions
Semantic processing of module Sequences
Semantic processing of module FiniteSets
Semantic processing of module FiniteSetsExt
Semantic processing of module TLC
Semantic processing of module Integers
Semantic processing of module TLCExt
Semantic processing of module _TLCTrace
Semantic processing of module MCCRDT
Starting... (2025-02-13 05:02:30)
Implied-temporal checking--satisfiability problem has 1 branches.
Error: Assumption line 6, col 8 to line 6, col 52 of module MCCRDT is false.
Finished in 00s at (2025-02-13 05:02:31)

It's hard to see since there is so much debug output, search the logs for ERROR:root.

@lemmy
Copy link
Member Author

lemmy commented Feb 13, 2025

@ahelwer How can we pass JVM properties and additional command-line parameters to TLC in the manifest.json?

@ahelwer
Copy link
Collaborator

ahelwer commented Feb 13, 2025

Ideally we would not, or rather they would be encoded in a way that is divorced from a specific backend implementation - like how the expected result option is exposed (there is a second finite model-checker now, spectacle/tla-web implements one). This has been manageable for all the specs so far but of course all abstractions will reach their limit somewhere. What do you have in mind?

@lemmy
Copy link
Member Author

lemmy commented Feb 13, 2025

The assumptions fail because '-Dtlc2.tool.impl.Tool.cdot=true' is not passed to TLC.

@ahelwer
Copy link
Collaborator

ahelwer commented Feb 13, 2025

Ah! Should we perhaps enable that by default for all models?

lemmy and others added 4 commits February 13, 2025 07:12
Signed-off-by: Markus Alexander Kuppe <[email protected]>
```shell
-> % opam exec -- tlapm --version
41d03d4

-> % opam exec -- tlapm CRDT_proof.tla
(* loading fingerprints in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
(* created new ".tlacache/CRDT_proof.tlaps/CRDT_proof.thy" *)
(* fingerprints written in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
File "./CRDT_proof.tla", line 182, characters 5-6:
[ERROR]: Could not prove or check:
           ASSUME NEW CONSTANT Node,
                  NEW VARIABLE counter,
                  TypeOK == counter \in [Node -> [Node -> Nat]],
                  Safety == \A n, o \in Node : counter[n][n] >= counter[o][n],
                  Gossip(n, o) ==
                    LET Max(a, b) == IF a > b THEN a ELSE b
                    IN  counter'
                        = [counter EXCEPT
                             ![o] = [nodeView \in Node |->
                                   Max
                                   (counter[n][nodeView],
                                   counter[o][nodeView])]],
                  NodeAssumption == IsFiniteSet(Node),
                  DistFun(o) ==
                    [n \in Node |-> counter[n][n] - counter[o][n]],
                  TypeOK ,
                  TypeOK' ,
                  Safety ,
                  Safety' ,
                  [\E n, o \in Node : Gossip(n, o)]_vars ,
                  NEW CONSTANT v \in Node,
                  NEW CONSTANT w \in Node,
                  <1>1
           PROVE  (DistFun(v)')[w] =< DistFun(v)[w]
File "./CRDT_proof.tla", line 1, character 1 to line 354, character 77:
[ERROR]: 1/210 obligations failed.
There were backend errors processing module `"CRDT_proof"`.
 tlapm ending abnormally with Failure("backend errors: there are unproved obligations")
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Tlapm_lib.process_module in file "src/tlapm_lib.ml", line 446, characters 12-77
Called from Tlapm_lib.main.f in file "src/tlapm_lib.ml", line 575, characters 23-43
Called from Stdlib__List.fold_left in file "list.ml", line 123, characters 24-34
Called from Tlapm_lib.main in file "src/tlapm_lib.ml", line 578, characters 13-40
Called from Tlapm_lib.init in file "src/tlapm_lib.ml", line 590, characters 8-33

-> % opam exec -- tlapm CRDT_proof.tla
(* loading fingerprints in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
(* created new ".tlacache/CRDT_proof.tlaps/CRDT_proof.thy" *)
(* fingerprints written in ".tlacache/CRDT_proof.tlaps/fingerprints" *)
File "./CRDT_proof.tla", line 1, character 1 to line 354, character 77:
[INFO]: All 210 obligations proved.
```

Signed-off-by: Markus Alexander Kuppe <[email protected]>
The property `IsSync` in `DistributedReplicatedLog.tla` does not hold; the node
with the longest log may forever append a value before the other nodes can catch
up.  TLC finds the following (valid) counterexample (for three nodes):

```tla
Error: Temporal properties were violated.

Error: The following behavior constitutes a counter-example:

State 1: <Initial predicate>
cLogs = (n1 :> <<>> @@ n2 :> <<>> @@ n3 :> <<>>)

State 2: <Extend(n2) line 35, col 5 to line 38, col 49 of module DistributedReplicatedLog>
cLogs = (n1 :> <<>> @@ n2 :> <<v>> @@ n3 :> <<>>)

State 3: <Extend(n2) line 35, col 5 to line 38, col 49 of module DistributedReplicatedLog>
cLogs = (n1 :> <<>> @@ n2 :> <<v, v>> @@ n3 :> <<>>)

State 4: <Copy(n3) line 26, col 9 to line 32, col 96 of module DistributedReplicatedLog>
cLogs = (n1 :> <<>> @@ n2 :> <<v, v>> @@ n3 :> <<v>>)

Back to state 2: <Copy(n1) line 26, col 9 to line 32, col 96 of module DistributedReplicatedLog>
```

Signed-off-by: Markus Alexander Kuppe <[email protected]>
@lemmy lemmy force-pushed the mku-FiniteMonotonic branch from b551d53 to d97b414 Compare February 13, 2025 15:12
@lemmy
Copy link
Member Author

lemmy commented Feb 13, 2025

Ah! Should we perhaps enable that by default for all models?

It’s better not to enable it globally, considering its known limitations.

@ahelwer
Copy link
Collaborator

ahelwer commented Feb 13, 2025

All right. If we want to stick with the current way of doing things I would probably add "action composition" as another possible feature of each .tla file in the manifest.json, along with "pluscal" and "proof"; it is a pretty neat feature worth highlighting, after all. This could be enforced with a tree-sitter query to find usage of the \cdot operator in the file. Then when the python script is preparing to run TLC it will look for the "action composition" feature, and add the feature flag to the TLC command line parameters if it is present.

The real drawback here is that it won't handle transitivity - like if a non-top-level module for the TLC run uses \cdot the flag won't be detected - but it should work for this case at least.

@ahelwer
Copy link
Collaborator

ahelwer commented Feb 13, 2025

This should now work if you put 'action composition' as a feature under the .tla spec (the spec, not the .cfg model) that has it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants