A Tutorial Introduction to TLAPS
Jael Kriener 1 Tom Rodeheffer 2 Tomer Libal 1
1 2
TLA+ Community Event, ABZ 2014 Toulouse, June 3, 2014
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 1 / 52
Outline TLAPS Basics 1 2 Tips and Best Practices for Using TLAPS 3 - - PowerPoint PPT Presentation
A Tutorial Introduction to TLAPS Jael Kriener 1 Tom Rodeheffer 2 Tomer Libal 1 1 2 TLA + Community Event, ABZ 2014 Toulouse, June 3, 2014 Jael K., Tom R. and Tomer L. TLAPS Tutorial Toulouse, June 2014 1 / 52 Outline TLAPS Basics 1 2 Tips
1 2
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 1 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 2 / 52
TLAPS: proof manager
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 3 / 52
TLAPS: proof manager
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 4 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 5 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 6 / 52
OBVIOUS BY .. DEF .. ASSUME ... PROVE ... CASE PICK WITNESS SUFFICES USE HIDE QED
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 7 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 8 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 9 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 10 / 52
1
2
3
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 11 / 52
1
1
2
2
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 12 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 13 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 14 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 15 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 16 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 17 / 52
1
2
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 18 / 52
1
2
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 19 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 20 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 21 / 52
◮ Simple, but not trivial. Multiplication, for example, does not have
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 22 / 52
◮ Simple, but not trivial. Multiplication, for example, does not have
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 22 / 52
◮ Simple, but not trivial. Multiplication, for example, does not have
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 22 / 52
◮ Simple, but not trivial. Multiplication, for example, does not have
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 22 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 23 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 24 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 25 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 26 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 27 / 52
◮ For two functions to be equal, you must show ⋆ they have the same domain ⋆ they have the same value at each point in the domain ◮ It seems this is relatively difficult for TLAPS to conclude Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 27 / 52
◮ For two functions to be equal, you must show ⋆ they have the same domain ⋆ they have the same value at each point in the domain ◮ It seems this is relatively difficult for TLAPS to conclude
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 27 / 52
◮ For two functions to be equal, you must show ⋆ they have the same domain ⋆ they have the same value at each point in the domain ◮ It seems this is relatively difficult for TLAPS to conclude
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 27 / 52
◮ For two functions to be equal, you must show ⋆ they have the same domain ⋆ they have the same value at each point in the domain ◮ It seems this is relatively difficult for TLAPS to conclude
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 27 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 28 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 29 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 30 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 31 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 32 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
◮ Humans are really good at utilizing these properties Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
◮ Humans are really good at utilizing these properties ◮ Even though TLAPS considered the properties obvious, it was
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
◮ Humans are really good at utilizing these properties ◮ Even though TLAPS considered the properties obvious, it was
◮ In my experience, TLAPS has a really difficult time applying
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
◮ Humans are really good at utilizing these properties ◮ Even though TLAPS considered the properties obvious, it was
◮ In my experience, TLAPS has a really difficult time applying
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 33 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 34 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 34 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 34 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 35 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 35 / 52
∆
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 35 / 52
THEOREM FiniteNatInduction
∆
ASSUME NEW P( ), predicate NEW m ∈ Nat, start NEW n ∈ Nat, limit
base case
finite ind hyp PROVE ∀ i ∈ m . . n : P(i) PROOF
∆
base case
inductive step
hide defn of induction predicate
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 36 / 52
THEOREM FiniteNatInduction
∆
ASSUME NEW P( ), predicate NEW m ∈ Nat, start NEW n ∈ Nat, limit
base case
finite ind hyp PROVE ∀ i ∈ m . . n : P(i) PROOF
∆
base case
inductive step
PROVE Q(i + 1) OBVIOUS
hide defn of induction predicate
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 37 / 52
THEOREM FiniteNatInduction
∆
ASSUME NEW P( ), predicate NEW m ∈ Nat, start NEW n ∈ Nat, limit
base case
finite ind hyp PROVE ∀ i ∈ m . . n : P(i) PROOF
∆
base case
inductive step
hide defn of induction predicate
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 38 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
◮ More generally, when applying a proof rule containing a NEW Q( )
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
◮ More generally, when applying a proof rule containing a NEW Q( )
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
◮ More generally, when applying a proof rule containing a NEW Q( )
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
◮ More generally, when applying a proof rule containing a NEW Q( )
◮ TLAPS will have to be convinced that all cases are covered ◮ Often it can figure this out on its own, but sometimes you need to
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
◮ More generally, when applying a proof rule containing a NEW Q( )
◮ TLAPS will have to be convinced that all cases are covered ◮ Often it can figure this out on its own, but sometimes you need to
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 39 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 40 / 52
◮ validation of a temporal formula ◮ mostly action reasoning ◮ temporal reasoning for validating
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 41 / 52
◮ validation of a temporal formula ◮ mostly action reasoning ◮ temporal reasoning for validating
◮ Why quantified temporal formulas can be proved using first-order and propositional temporal backends Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 41 / 52
◮ validation of a temporal formula ◮ mostly action reasoning ◮ temporal reasoning for validating
◮ Why quantified temporal formulas can be proved using first-order and propositional temporal backends ◮ How to write the proofs correctly Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 41 / 52
◮ validation of a temporal formula ◮ mostly action reasoning ◮ temporal reasoning for validating
◮ Why quantified temporal formulas can be proved using first-order and propositional temporal backends ◮ How to write the proofs correctly ◮ Which formulas can be proved using that ⋆ Note: TLA+ is not complete for
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 41 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions ◮ Action expressions Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions ◮ Action expressions ◮ Temporal expressions Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions ◮ Action expressions ◮ Temporal expressions
◮ First-order [1] [1] Coalescing: Syntactic Abstraction for Reasoning in First-Order Modal Logics Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions ◮ Action expressions ◮ Temporal expressions
◮ First-order [1] ◮ Temporal [1] Coalescing: Syntactic Abstraction for Reasoning in First-Order Modal Logics Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
◮ Program Executions ◮ States ◮ Behaviors and suffixes
◮ Constant expressions ◮ State expressions ◮ Action expressions ◮ Temporal expressions
◮ First-order [1] ◮ Temporal ⋆ PTL [1] Coalescing: Syntactic Abstraction for Reasoning in First-Order Modal Logics Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 42 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 43 / 52
◮ find a temporal rule Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 43 / 52
◮ find a temporal rule ◮ verify the rule Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 43 / 52
◮ find a temporal rule ◮ verify the rule ◮ understand failures Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 43 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 44 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 44 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 44 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 44 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 44 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 45 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 45 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 45 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 46 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 46 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 46 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 47 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 47 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 47 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 47 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 48 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 48 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 48 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 48 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 48 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 49 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 49 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 49 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 49 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 50 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 50 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 50 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 50 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 51 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 51 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 51 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52
◮ for all safety properties Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52
◮ for all safety properties ◮ for liveness properties - still require: Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52
◮ for all safety properties ◮ for liveness properties - still require: ⋆ reasoning about ENABLED Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52
◮ for all safety properties ◮ for liveness properties - still require: ⋆ reasoning about ENABLED ⋆ some proofs require full quantified temporal reasoning - Ex:
Jael K., Tom R. and Tomer L.
TLAPS Tutorial
Toulouse, June 2014 52 / 52