How to run a spec through some set of models

23 views
Skip to first unread message

Nam Nguyen

unread,
Dec 24, 2020, 12:28:43 AM12/24/20
to tlaplus
Hello list,

In https://lamport.azurewebsites.net/pubs/pluscal.pdf, it was mentioned that "TLC will check partial correctness and termination of the usual recursive version of quicksort for all 4-element arrays A with values in a set of 4 numbers in about 100 seconds."

My question: How would I be able to perform similar run with a specification I wrote in TLA+? My spec is pretty standard:

CONSTANT A0
VARIABLES A, i, j
vars == ...
Init == ...
Next == ...
Spec == Init /\ [][Next]_vars

where A0 is a sequence provided by a model to be sorted.

What I like to achieve is to run my spec through all sequences of length <= 4 of numbers from the set 1..4 (repeats are okay).

Thanks!

Stephan Merz

unread,
Dec 24, 2020, 2:35:35 AM12/24/20
to tla...@googlegroups.com
Hello,

I presume that your initial condition includes "A = A0" so that the algorithm is run on the fixed value provided by A0. Instead, make A0 an additional variable that is never changed by the algorithm (but you will refer to it in your correctness condition) and write an initial condition that allows A0 to take any sequence in the set you are interested in. Something like

TestData == {-5, 0, 27, 42}
TestSequences == UNION { [1..n -> TestData] : n \in 0 .. 4 }

Init == A0 \in TestSequences /\ A = A0 /\ ...

Don't forget to add A0 to the UNCHANGED clauses in your actions.

Stephan

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/01abfbb5-1a19-488d-aa95-be43ac15c26an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages