Revisiting Auxiliary Variables
Stephan Merz joint work with Leslie Lamport
Inria & LORIA, Nancy, France
IFIP Working Group 2.2
Bordeaux, September 2017
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 1 / 24
Revisiting Auxiliary Variables Stephan Merz joint work with Leslie - - PowerPoint PPT Presentation
Revisiting Auxiliary Variables Stephan Merz joint work with Leslie Lamport Inria & LORIA, Nancy, France IFIP Working Group 2.2 Bordeaux, September 2017 Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 1 / 24 Specifications
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 1 / 24
◮ initial condition, next-state relation express what may happen ◮ fairness / liveness conditions assert what must happen
◮ do not expose implementation details ◮ delimit observable behavior that should be implemented
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 2 / 24
◮ executions of lower-level state machine coherent with specification ◮ formally: inclusion of set of (observable) state sequences
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 3 / 24
◮ executions of lower-level state machine coherent with specification ◮ formally: inclusion of set of (observable) state sequences
◮ reconstruct high-level internal state from low-level state
◮ pointwise computation of internal state components Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 3 / 24
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 4 / 24
∆
∆
∆
∆
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 4 / 24
∆
∆
∆
∆
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 4 / 24
◮ they generate same externally visible behaviors (variable max) Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 5 / 24
◮ they generate same externally visible behaviors (variable max)
1
2
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 5 / 24
◮ they generate same externally visible behaviors (variable max)
1
2
◮ holds semantically, but no refinement mapping ◮ cannot compute set of inputs given the maximum value Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 5 / 24
◮ they generate same externally visible behaviors (variable max)
1
2
◮ holds semantically, but no refinement mapping ◮ cannot compute set of inputs given the maximum value
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 5 / 24
1
2
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 6 / 24
1
2
◮ history variables: record information about previous states ◮ prophecy variables: predict information about future states Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 6 / 24
1
2
◮ history variables: record information about previous states ◮ prophecy variables: predict information about future states
◮ introduces history and prophecy variables ◮ proves completeness under certain conditions ◮ closely related: forward / backward simulations Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 6 / 24
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 7 / 24
◮ variable h does not occur in Spec, vars or h0 ◮ term f(h) does not contain h′ ◮ h0 is the initial value of the history variable ◮ f represents the update function applied at every observable step Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 8 / 24
◮ variable h does not occur in Spec, vars or h0 ◮ term f(h) does not contain h′ ◮ h0 is the initial value of the history variable ◮ f represents the update function applied at every observable step
◮ similar: record the input values during executions of Spec2 Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 8 / 24
1
2
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 9 / 24
1
2
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 9 / 24
1
2
∆
∆
1
2
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 9 / 24
1
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 10 / 24
1
2
∆
◮ β : sequence of states that “predicts” actual execution ◮
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 10 / 24
1
2
∆
◮ β : sequence of states that “predicts” actual execution ◮
3
◮ fix β ∈ [N → St] such that PImpl(β) holds ◮ because of refinement, there exists γβ ∈ [N → X] satisfying Spec Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 10 / 24
1
2
∆
◮ β : sequence of states that “predicts” actual execution ◮
3
◮ fix β ∈ [N → St] such that PImpl(β) holds ◮ because of refinement, there exists γβ ∈ [N → X] satisfying Spec ◮ conclude
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 10 / 24
1
2
∆
◮ β : sequence of states that “predicts” actual execution ◮
3
◮ fix β ∈ [N → St] such that PImpl(β) holds ◮ because of refinement, there exists γβ ∈ [N → X] satisfying Spec ◮ conclude
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 10 / 24
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 11 / 24
◮ variable p does not occur in Spec, vars or S ◮ f(y) does not contain p Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 12 / 24
◮ variable p does not occur in Spec, vars or S ◮ f(y) does not contain p
◮ invariant “type condition” replaces initialization ◮ finiteness of S required for soundness (K¨
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 12 / 24
◮ variable p does not occur in Spec, vars or S ◮ f(y) does not contain p
◮ invariant “type condition” replaces initialization ◮ finiteness of S required for soundness (K¨
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 12 / 24
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 13 / 24
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 13 / 24
∆
∆
∆
◮ prophecy variables are used in proofs ◮ the augmented specification need not be implementable Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 13 / 24
◮ A(x) an action without occurrences of p ◮ p predicts for which value A will occur next ◮ other actions leave p unchanged ◮ variant: predict which action will be performed next Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 14 / 24
◮ A(x) an action without occurrences of p ◮ p predicts for which value A will occur next ◮ other actions leave p unchanged ◮ variant: predict which action will be performed next
◮ suitable value for p determined at next occurrence of A ◮ if A doesn’t occur anymore, the value of p doesn’t matter Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 14 / 24
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 15 / 24
◮ y, f do not occur in v ◮ similar to introducing a Skolem function in predicate logic ◮ premise will be established by previous rules Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 16 / 24
◮ y, f do not occur in v ◮ similar to introducing a Skolem function in predicate logic ◮ premise will be established by previous rules
◮ natural application: parameterized verification problems ◮ can be used to justify original rule for prophecy variables Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 16 / 24
∆
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 17 / 24
∆
∆
∆
∆
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 17 / 24
∆
∆
∆
∆
∆
∆
∆
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 17 / 24
∆
∆
∆
∆
∆
∆
◮ use simple prophecy rule to prove ∀k ∈ N : SpecU ≡ ∃
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 18 / 24
∆
∆
∆
∆
∆
∆
◮ use simple prophecy rule to prove ∀k ∈ N : SpecU ≡ ∃
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 18 / 24
∆
∆
∆
∆
∆
∆
◮ use simple prophecy rule to prove ∀k ∈ N : SpecU ≡ ∃
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 18 / 24
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 19 / 24
◮ typically, refinement introduces lower-level detail ◮ low-level transitions are invisible at higher level ◮ TLA+ bakes stuttering invariance into the language Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 20 / 24
◮ typically, refinement introduces lower-level detail ◮ low-level transitions are invisible at higher level ◮ TLA+ bakes stuttering invariance into the language
◮ toy example: clock specified with invisible seconds display ◮ more realistic: thread completes operation on behalf of another
◮ Abadi-Lamport: stuttering combined with prophecy variables ◮ here: separate category of stuttering variables Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 20 / 24
i∈I As i
◮ original specification
◮ initial stuttering
∆
◮ stuttering after transition
∆
◮ decrement variable s
∆
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 21 / 24
i∈I As i
◮ original specification
◮ initial stuttering
∆
◮ stuttering after transition
∆
◮ decrement variable s
∆
◮ allow for jumps instead of just counting down ◮ variable taking values in set with well-founded ordering Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 21 / 24
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 22 / 24
1
◮ add a step counter to low-level specification ◮ use simple prophecy variables to predict n-th state ◮ combine these into function predicting low-level behavior ◮ choose high-level behavior and define refinement mapping 2
◮ use history variable to record finite prefixes of low-level behavior ◮ predict prefixes of high-level behavior compatible with all
◮ second approach: reasoning about finite prefixes suffices . . . ◮ . . . but “internal continuity” is necessary ◮ cf. AL’91: no machine closure or finite internal non-determinism Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 23 / 24
◮ refinement mappings are very successful, but incomplete ◮ generalization to parameterized refinement mappings ◮ auxiliary variables can yield completeness results ◮ simple prophecy variables + arrays easier to apply ?
◮ catalogue of directly applicable TLA+ rules ◮ applied to toy examples and linearizability proofs ◮ formalization in Isabelle/HOL ongoing
Stephan Merz Revisiting Auxiliary Variables WG 2.2, 2017-09 24 / 24