mem

Mem checking axiomatic SAT specifications of memory models Emina - PowerPoint PPT Presentation

Mem checking axiomatic SAT specifications of memory models Emina Torlak Mandana Vaziri Julian Dolby MIT SAT/SMT Summer School June 16, 2011 Introduction x = 0, y = 0, y = 0 memory model contract between programmer r1 = x r2


  1. Introduction On Validity of Program Transformations in the Java Memory Model 47 J. Λ‡ 46 SevΛ‡ cΒ΄ Δ±k and D. Aspinall 5. For all reads r ∈ A i βˆ’ C i βˆ’ 1 we have W i ( r ) ≀ hb i r . 6. For all reads r ∈ C i βˆ’ C i βˆ’ 1 we have W ( r ) ∈ C i βˆ’ 1 . 3. | t | > 0 implies Ο€ K (() t 0 ) = St (start action first), 7. If y ∈ C i is an external action and x ≀ hb y then x ∈ C i . 4. Ο€ K (() t i ) = Fin implies i = | t | βˆ’ 1 (finish action last). On Validity of Program Transformations in the Java Memory Model 45 5. ΞΈ = ΞΈ init implies βˆ€ i. 1 ≀ i < | t | βˆ’ 1 β†’ βˆƒ v. Ο€ K (() t i ) = Wr( v ) ∨ Ο€ K (() t i ) = The original definition of legality from [11,18] di ff ers in rules 2 and 6, and adds Wr v ( v ) and Ο€ K (() t | t | βˆ’ 1 ) = Fin (initialisation thread only contains writes). Definition 2. An execution E is a tuple E = οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ , where rule 8: A βŠ† A is a set of actions; P is a program, represented as a thread-indexed set of The well-formedness of programs should not be hard to establish for any rea- 2. ≀ hb i | C i = ≀ hb | C i . memory traces; the partial order ≀ po βŠ† A Γ— A is the program order, which is a sonable sequential language. 6. For all reads r ∈ C i βˆ’ C i βˆ’ 1 we have W ( r ) ∈ C i βˆ’ 1 and W i ( r ) ∈ C i βˆ’ 1 . union of total orders on actions of each thread; ≀ so βŠ† A Γ— A is the synchronisation The next definition places some sensible restriction on executions. 8. If x < ssw i y ≀ hb i z and z ∈ C i βˆ’ C i βˆ’ 1 , then x < sw j y for all j β‰₯ i , where order, which is a total order on all synchronisation actions in A ; V :: A β‡’ V is < ssw i is the transitive reduction of ≀ hb i without any ≀ po i edges, and the a value-written function that assigns a value to each write from A ; W :: A β‡’ A Definition 7. We say that an execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ is well-formed transitive reduction of ≀ hb i is a minimum relation such that its transitive is a write-seen function that assigns a write to each read action from A , the if closure is ≀ hb i . W ( r ) denotes the write seen by r , i.e. the value read by r is V ( W ( r )) . x = 0, y = 0, y = 0 memory model 1. A is finite. The reasons for weakening the rules are invalidity of reordering of independent Definition 3. In an execution with synchronisation order ≀ so , an action a 2. ≀ po restricted on actions of one thread is a total order, ≀ po does not relate statements, broken JMM causality tests 17–20 [21], and redundancy. For details, A JMM Definitions synchronises-with an action b (written a < sw b ) if a ≀ so b and a and b sat- actions of di ff erent threads. see [5,6]. isfy one of the following conditions: 3. ≀ so is total on synchronisation actions of A . For reasoning about validity of reordering, we define observable behaviours of The following definitions are mostly from [11,18]; however, we have weakened 4. ≀ so is consistent with ≀ po . – a is an unlock on monitor m and b is a lock on monitor m , executions and programs. Intuitively, a program P has an observable behaviour the definition of execution legality as suggested in [5]. We use letters ΞΈ for thread 5. W is properly typed: for every non-volatile read r ∈ A , W ( r ) is a non-volatile – a is a volatile write to v and b is a volatile read from v . B if B is a subset of external actions of some execution of P , and B is downward names, m for synchronisation monitor names, and v for variables (i.e., memory β€£ contract between programmer write; for every volatile read r ∈ A , W ( r ) is a volatile write. closed on happens-before order (restricted to external actions). The JMM cap- locations, in examples, x , y , v etc.). The abstract type V will denote values. r1 = x r2 = y 6. Locking is proper: for all lock actions l ∈ A on monitors m and all threads ΞΈ Definition 4. The happens-before order of an execution is the transitive closure tures non-termination as a behaviour in the definition of allowable behaviours. The starting point is the notion of action . di ff erent from the thread of l , the number of locks in ΞΈ before l in ≀ so is the of the composition of its synchronises-with order and its program order, i.e. ≀ hb = ( < sw βˆͺ ≀ po ) + . same as the number of unlocks in ΞΈ before l in ≀ so . Definition 1. An action is a memory-related operation; it is modelled by an Definition 9. An execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ with happens-before order 7. Program order is intra-thread consistent: for each thread ΞΈ , the trace of ΞΈ in abstract type A with the following properties: (1) Each action belongs to one ≀ hb has a set of observable behaviours O if for all x ∈ O we have y ≀ hb x To relate a (sequential) program to a sequence of actions performed by one thread, we will denote it by T ( a ) . (2) An action is one of the following action E is sequentially valid for P ΞΈ . and programming environment or y ≀ so x implies y ∈ O or T ( y ) = ΞΈ init . Moreover, there is no x ∈ O such that thread we must define a notion of sequential validity . We consider single-thread kinds : 8. ≀ so is consistent with W : for every volatile read r of a variable v we have T ( x ) = ΞΈ init . programs as sets of sequences of pairs of an action kind and a value, which we W ( r ) ≀ so r and for any volatile write w to v , either w ≀ so W ( r ) or r ≀ so w . y = 1 x = 1 – volatile read of v , – normal write to v , call traces . A multi-thread program is a set of single-thread programs indexed – thread start , 9. ≀ hb is consistent with W : for all reads r of v it holds that r �≀ hb W ( r ) and The allowable behaviours may contain a special external hang action if the ex- – volatile write to v , – lock on m , by thread identifiers. – thread finish , there is no intervening write w to v , i.e. if W ( r ) ≀ hb w ≀ hb r and w writes ecution does not terminate. We will use the notation Ext( A )) for all external – normal read from v , – unlock on m , – external action . to v then W ( r ) = w . actions of set A , i.e., Ext( A ) = { a | K ( a ) = Ex } . Definition 5. Given an execution E = οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ , the action trace β€£ specifies which writes can be We denote the action kind of a by K ( a ) , the action kinds will be abbreviated to 10. The initialisation thread ΞΈ init finishes before any other thread starts, i.e., of thread ΞΈ in E , denoted Tr E ( ΞΈ ) , is the list of actions of thread ΞΈ in the order Definition 10. A finite set of actions B is an allowable behaviour of a program Rd v ( v ) , Wr v ( v ) , Rd( v ) , Wr( v ) , L( m ) , U( m ) , St , Fin , Ex . An action kind also βˆ€ a, b ∈ A. K ( a ) = Fin ∧ T ( a ) = ΞΈ init ∧ K ( b ) = St ∧ T ( b ) οΏ½ = ΞΈ init β†’ a ≀ so b . ≀ po . The trace of thread ΞΈ in E , written Tr E ( ΞΈ ) is the list of action kinds and includes the associated variable or monitor. The volatile read, volatile write, lock, P if either corresponding values obtained from the action trace (i.e., V ( W ( a )) if a is a read, The following definition of legal execution constitutes the core of the Java Mem- unlock, start, finish actions are called synchronisation actions . V ( a ) otherwise). – There is a legal execution E of P with a set of observable behaviours O such ory Model. In our work, we use a weakened version of the memory model that The JMM also defines thread spawn and join action kinds. We omit these for that B = Ext( O ) , or B = Ext( O ) βˆͺ { hang } and E is hung. By writing t ≀ t οΏ½ we mean that t is a prefix of t οΏ½ , set ( t ) is the set of elements of we suggested in [5] and which permits more transformations than the original seen by a read simplicity. – There is a set O such that B = Ext( O ) βˆͺ { hang } , and for all n β‰₯ | O | there version. In Tbl. 1, we label this version by β€˜JMM-Alt’. the list t , ΞΉ ( t, a ) is an index i such that t i = a , or 0 if a / ∈ set ( t ). For an action r1==r2==1? r1==r2==1? must be a legal execution E of P with set of actions A , and a set of actions kind-value pair p = οΏ½ k, v οΏ½ we will use the notation Ο€ K ( p ) for the action kind k O οΏ½ such that (i) O and O οΏ½ are observable behaviours of E , (ii) O βŠ† O οΏ½ βŠ† A , Definition 8. A well-formed execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ with happens be- and Ο€ V ( p ) for the value v . We say that a sequence s of action kind-value pairs fore order ≀ hb is legal if there is a finite sequence of sets of actions C i and (iii) n ≀ | O οΏ½ | , and (iv) Ext( O οΏ½ ) = Ext( O ) . is sequentially valid with respect to a program P if t ∈ P . A sequentially valid well-formed executions E i = οΏ½ A i , P, ≀ po i , ≀ so i , W i , V i οΏ½ with happens-before ≀ hb i trace t is finished for P if there is no sequentially valid trace t οΏ½ > t . The operator and synchronises-with < sw i such that C 0 = βˆ… , C i βˆ’ 1 βŠ† C i for all i > 0 , οΏ½ C i = A , β€£ described (in)formally by a set of β€£ described (in)formally by a set of + + stands for trace concatenation. B Proof and for each i > 0 the following rules are satisfied: To establish reasonable properties of concurrent programs we assume reason- 1. C i βŠ† A i . able properties of the underlying sequential language: We prove validity of irrelevant read elimination, elimination of redundant write 2. For all reads r ∈ C i we have W ( r ) ≀ hb r ⇐ β‡’ W ( r ) ≀ hb i r , and r �≀ hb i before write, elimination of redundant read after write, and reordering of non- Definition 6. We say that program P is well-formed if sequential validity of W ( r ) , volatile memory accesses to di ff erent variables. trace t in P implies: axioms and litmus tests axioms and litmus tests 3. V i | C i = V | C i . 1. any trace t οΏ½ ≀ t is sequentially valid (prefix closedness), 4. W i | C i βˆ’ 1 = W | C i βˆ’ 1 . 2. if the last action of t is a read with value v , then the trace obtained from t by replacing the value in the last action by v οΏ½ is also sequentially valid in P (final read value independence), β€£ hard to design and reason about 2

  2. Introduction On Validity of Program Transformations in the Java Memory Model 47 J. Λ‡ 46 SevΛ‡ cΒ΄ Δ±k and D. Aspinall 5. For all reads r ∈ A i βˆ’ C i βˆ’ 1 we have W i ( r ) ≀ hb i r . 6. For all reads r ∈ C i βˆ’ C i βˆ’ 1 we have W ( r ) ∈ C i βˆ’ 1 . 3. | t | > 0 implies Ο€ K (() t 0 ) = St (start action first), 7. If y ∈ C i is an external action and x ≀ hb y then x ∈ C i . 4. Ο€ K (() t i ) = Fin implies i = | t | βˆ’ 1 (finish action last). On Validity of Program Transformations in the Java Memory Model 45 5. ΞΈ = ΞΈ init implies βˆ€ i. 1 ≀ i < | t | βˆ’ 1 β†’ βˆƒ v. Ο€ K (() t i ) = Wr( v ) ∨ Ο€ K (() t i ) = The original definition of legality from [11,18] di ff ers in rules 2 and 6, and adds Wr v ( v ) and Ο€ K (() t | t | βˆ’ 1 ) = Fin (initialisation thread only contains writes). Definition 2. An execution E is a tuple E = οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ , where rule 8: A βŠ† A is a set of actions; P is a program, represented as a thread-indexed set of The well-formedness of programs should not be hard to establish for any rea- 2. ≀ hb i | C i = ≀ hb | C i . memory traces; the partial order ≀ po βŠ† A Γ— A is the program order, which is a sonable sequential language. 6. For all reads r ∈ C i βˆ’ C i βˆ’ 1 we have W ( r ) ∈ C i βˆ’ 1 and W i ( r ) ∈ C i βˆ’ 1 . union of total orders on actions of each thread; ≀ so βŠ† A Γ— A is the synchronisation The next definition places some sensible restriction on executions. 8. If x < ssw i y ≀ hb i z and z ∈ C i βˆ’ C i βˆ’ 1 , then x < sw j y for all j β‰₯ i , where order, which is a total order on all synchronisation actions in A ; V :: A β‡’ V is < ssw i is the transitive reduction of ≀ hb i without any ≀ po i edges, and the a value-written function that assigns a value to each write from A ; W :: A β‡’ A Definition 7. We say that an execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ is well-formed transitive reduction of ≀ hb i is a minimum relation such that its transitive is a write-seen function that assigns a write to each read action from A , the if closure is ≀ hb i . W ( r ) denotes the write seen by r , i.e. the value read by r is V ( W ( r )) . x = 0, y = 0, y = 0 memory model 1. A is finite. The reasons for weakening the rules are invalidity of reordering of independent Definition 3. In an execution with synchronisation order ≀ so , an action a 2. ≀ po restricted on actions of one thread is a total order, ≀ po does not relate statements, broken JMM causality tests 17–20 [21], and redundancy. For details, A JMM Definitions synchronises-with an action b (written a < sw b ) if a ≀ so b and a and b sat- actions of di ff erent threads. see [5,6]. isfy one of the following conditions: 3. ≀ so is total on synchronisation actions of A . For reasoning about validity of reordering, we define observable behaviours of The following definitions are mostly from [11,18]; however, we have weakened 4. ≀ so is consistent with ≀ po . – a is an unlock on monitor m and b is a lock on monitor m , executions and programs. Intuitively, a program P has an observable behaviour the definition of execution legality as suggested in [5]. We use letters ΞΈ for thread 5. W is properly typed: for every non-volatile read r ∈ A , W ( r ) is a non-volatile – a is a volatile write to v and b is a volatile read from v . B if B is a subset of external actions of some execution of P , and B is downward names, m for synchronisation monitor names, and v for variables (i.e., memory β€£ contract between programmer write; for every volatile read r ∈ A , W ( r ) is a volatile write. closed on happens-before order (restricted to external actions). The JMM cap- locations, in examples, x , y , v etc.). The abstract type V will denote values. r1 = x r2 = y 6. Locking is proper: for all lock actions l ∈ A on monitors m and all threads ΞΈ Definition 4. The happens-before order of an execution is the transitive closure tures non-termination as a behaviour in the definition of allowable behaviours. The starting point is the notion of action . di ff erent from the thread of l , the number of locks in ΞΈ before l in ≀ so is the of the composition of its synchronises-with order and its program order, i.e. ≀ hb = ( < sw βˆͺ ≀ po ) + . same as the number of unlocks in ΞΈ before l in ≀ so . Definition 1. An action is a memory-related operation; it is modelled by an Definition 9. An execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ with happens-before order 7. Program order is intra-thread consistent: for each thread ΞΈ , the trace of ΞΈ in abstract type A with the following properties: (1) Each action belongs to one ≀ hb has a set of observable behaviours O if for all x ∈ O we have y ≀ hb x To relate a (sequential) program to a sequence of actions performed by one thread, we will denote it by T ( a ) . (2) An action is one of the following action E is sequentially valid for P ΞΈ . and programming environment or y ≀ so x implies y ∈ O or T ( y ) = ΞΈ init . Moreover, there is no x ∈ O such that thread we must define a notion of sequential validity . We consider single-thread kinds : 8. ≀ so is consistent with W : for every volatile read r of a variable v we have T ( x ) = ΞΈ init . programs as sets of sequences of pairs of an action kind and a value, which we W ( r ) ≀ so r and for any volatile write w to v , either w ≀ so W ( r ) or r ≀ so w . y = 1 x = 1 – volatile read of v , – normal write to v , call traces . A multi-thread program is a set of single-thread programs indexed – thread start , 9. ≀ hb is consistent with W : for all reads r of v it holds that r �≀ hb W ( r ) and The allowable behaviours may contain a special external hang action if the ex- – volatile write to v , – lock on m , by thread identifiers. – thread finish , there is no intervening write w to v , i.e. if W ( r ) ≀ hb w ≀ hb r and w writes ecution does not terminate. We will use the notation Ext( A )) for all external – normal read from v , – unlock on m , – external action . to v then W ( r ) = w . actions of set A , i.e., Ext( A ) = { a | K ( a ) = Ex } . Definition 5. Given an execution E = οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ , the action trace β€£ specifies which writes can be We denote the action kind of a by K ( a ) , the action kinds will be abbreviated to 10. The initialisation thread ΞΈ init finishes before any other thread starts, i.e., of thread ΞΈ in E , denoted Tr E ( ΞΈ ) , is the list of actions of thread ΞΈ in the order Definition 10. A finite set of actions B is an allowable behaviour of a program Rd v ( v ) , Wr v ( v ) , Rd( v ) , Wr( v ) , L( m ) , U( m ) , St , Fin , Ex . An action kind also βˆ€ a, b ∈ A. K ( a ) = Fin ∧ T ( a ) = ΞΈ init ∧ K ( b ) = St ∧ T ( b ) οΏ½ = ΞΈ init β†’ a ≀ so b . ≀ po . The trace of thread ΞΈ in E , written Tr E ( ΞΈ ) is the list of action kinds and includes the associated variable or monitor. The volatile read, volatile write, lock, P if either corresponding values obtained from the action trace (i.e., V ( W ( a )) if a is a read, The following definition of legal execution constitutes the core of the Java Mem- unlock, start, finish actions are called synchronisation actions . V ( a ) otherwise). – There is a legal execution E of P with a set of observable behaviours O such ory Model. In our work, we use a weakened version of the memory model that The JMM also defines thread spawn and join action kinds. We omit these for that B = Ext( O ) , or B = Ext( O ) βˆͺ { hang } and E is hung. By writing t ≀ t οΏ½ we mean that t is a prefix of t οΏ½ , set ( t ) is the set of elements of we suggested in [5] and which permits more transformations than the original seen by a read simplicity. – There is a set O such that B = Ext( O ) βˆͺ { hang } , and for all n β‰₯ | O | there version. In Tbl. 1, we label this version by β€˜JMM-Alt’. the list t , ΞΉ ( t, a ) is an index i such that t i = a , or 0 if a / ∈ set ( t ). For an action r1==r2==1? r1==r2==1? must be a legal execution E of P with set of actions A , and a set of actions kind-value pair p = οΏ½ k, v οΏ½ we will use the notation Ο€ K ( p ) for the action kind k O οΏ½ such that (i) O and O οΏ½ are observable behaviours of E , (ii) O βŠ† O οΏ½ βŠ† A , Definition 8. A well-formed execution οΏ½ A, P, ≀ po , ≀ so , W, V οΏ½ with happens be- and Ο€ V ( p ) for the value v . We say that a sequence s of action kind-value pairs fore order ≀ hb is legal if there is a finite sequence of sets of actions C i and (iii) n ≀ | O οΏ½ | , and (iv) Ext( O οΏ½ ) = Ext( O ) . is sequentially valid with respect to a program P if t ∈ P . A sequentially valid well-formed executions E i = οΏ½ A i , P, ≀ po i , ≀ so i , W i , V i οΏ½ with happens-before ≀ hb i trace t is finished for P if there is no sequentially valid trace t οΏ½ > t . The operator and synchronises-with < sw i such that C 0 = βˆ… , C i βˆ’ 1 βŠ† C i for all i > 0 , οΏ½ C i = A , β€£ described (in)formally by a set of β€£ described (in)formally by a set of + + stands for trace concatenation. B Proof and for each i > 0 the following rules are satisfied: To establish reasonable properties of concurrent programs we assume reason- 1. C i βŠ† A i . able properties of the underlying sequential language: We prove validity of irrelevant read elimination, elimination of redundant write 2. For all reads r ∈ C i we have W ( r ) ≀ hb r ⇐ β‡’ W ( r ) ≀ hb i r , and r �≀ hb i before write, elimination of redundant read after write, and reordering of non- Definition 6. We say that program P is well-formed if sequential validity of W ( r ) , volatile memory accesses to di ff erent variables. trace t in P implies: axioms and litmus tests axioms and litmus tests 3. V i | C i = V | C i . 1. any trace t οΏ½ ≀ t is sequentially valid (prefix closedness), 4. W i | C i βˆ’ 1 = W | C i βˆ’ 1 . 2. if the last action of t is a read with value v , then the trace obtained from t by replacing the value in the last action by v οΏ½ is also sequentially valid in P (final read value independence), β€£ hard to design and reason about β€£ hard to design and reason about 2

  3. MemSAT overview litmus test legality witness MemSAT Mem memory model proof of illegality finitization parameters 3

  4. MemSAT overview annotated java program with one or more assertions P legality witness MemSAT Mem memory model proof of illegality finitization parameters 3

  5. MemSAT overview annotated java program with one or more assertions P legality witness MemSAT Mem M proof of illegality set of constraints finitization in relational logic parameters 3

  6. MemSAT overview annotated java program with one β€£ translate P to relational logic or more assertions β€£ combine result with M β€£ solve combined constraints P legality witness MemSAT F(P, M) M proof of illegality set of constraints finitization in relational logic parameters 3

  7. MemSAT overview annotated java program with one β€£ translate P to relational logic or more assertions β€£ combine result with M β€£ solve combined constraints P legality witness F(P, M) M proof of illegality kodkod set of constraints finitization in relational logic parameters 3

  8. MemSAT overview annotated java model (solution) of program with one the legality formula β€£ translate P to relational logic or more assertions β€£ combine result with M β€£ solve combined constraints sat P model(F(P, M)) F(P, M) M proof of illegality kodkod set of constraints finitization in relational logic parameters 3

  9. MemSAT overview annotated java model (solution) of program with one the legality formula β€£ translate P to relational logic or more assertions β€£ combine result with M β€£ solve combined constraints sat P model(F(P, M)) F(P, M) unsat M mincore(F(P, M)) kodkod set of constraints minimal unsatisfiable finitization in relational logic core of the legality formula parameters 3

  10. Specifying a litmus test public class Test0 { static int x = 0; static int y = 0; β€£ control flow β€£ synchronize x = 0, y = 0, y = 0 β€£ method calls @thread β€£ field and array accesses public static void thread1() { r1 = x r2 = y β€£ assertions final int r1 = x; y = 1 x = 1 y = 1; assert r1==1; } r1==r2==1? r1==r2==1? @thread public static void thread2() { final int r2 = y; x = 1; assert r2==1; } } 4

  11. Specifying a memory model relational logic constants variables 5

  12. Specifying a memory model first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) bitvector arithmetic (+, -, *, /,) relational logic constants variables 5

  13. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order logic constants variables 5

  14. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order logic constants variables x = 0, y = 0, y = 0 r1 = x r2 = y y = 1 x = 1 5

  15. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order logic constants variables x = 0, y = 0, y = 0 t0 r1 = x r2 = y y = 1 x = 1 t1 t2 5

  16. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants variables x = 0, y = 0, y = 0 t0 r1 = x r2 = y y = 1 x = 1 t1 t2 5

  17. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants variables relational variables capture runtime properties of a program x = 0, y = 0, y = 0 t0 β€£ A, set of all executed actions β€£ W, maps reads to seen writes r1 = x r2 = y β€£ V, maps writes to written values y = 1 x = 1 β€£ l, maps reads/writes to locations t1 t2 β€£ m, maps locks/unlocks to monitors 5

  18. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions β€£ W, maps reads to seen writes r1 = x r2 = y β€£ V, maps writes to written values y = 1 x = 1 β€£ l, maps reads/writes to locations t1 t2 β€£ m, maps locks/unlocks to monitors 5

  19. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions a10: start β€£ W, maps reads to seen writes r1 = x r2 = y a11: read(x, 0) β€£ V, maps writes to written values a12: write(y, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations t2 a13: end β€£ m, maps locks/unlocks to monitors 5

  20. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions a10: start a20: start β€£ W, maps reads to seen writes r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations a13: end a23: end β€£ m, maps locks/unlocks to monitors 5

  21. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions A = { γ€ˆ a00 〉 , γ€ˆ a01 〉 , ..., γ€ˆ a23 〉 } a10: start a20: start β€£ W, maps reads to seen writes r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations a13: end a23: end β€£ m, maps locks/unlocks to monitors 5

  22. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions A = { γ€ˆ a00 〉 , γ€ˆ a01 〉 , ..., γ€ˆ a23 〉 } a10: start a20: start β€£ W, maps reads to seen writes W = { γ€ˆ a11, a01 〉 , γ€ˆ a21, a12 〉 } r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations a13: end a23: end β€£ m, maps locks/unlocks to monitors 5

  23. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions A = { γ€ˆ a00 〉 , γ€ˆ a01 〉 , ..., γ€ˆ a23 〉 } a10: start a20: start β€£ W, maps reads to seen writes W = { γ€ˆ a11, a01 〉 , γ€ˆ a21, a12 〉 } r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values V = { γ€ˆ a01, 0 〉 , γ€ˆ a02, 0 〉 , γ€ˆ a12, 1 〉 , γ€ˆ a22, 1 〉 } a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations a13: end a23: end β€£ m, maps locks/unlocks to monitors 5

  24. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions A = { γ€ˆ a00 〉 , γ€ˆ a01 〉 , ..., γ€ˆ a23 〉 } a10: start a20: start β€£ W, maps reads to seen writes W = { γ€ˆ a11, a01 〉 , γ€ˆ a21, a12 〉 } r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values V = { γ€ˆ a01, 0 〉 , γ€ˆ a02, 0 〉 , γ€ˆ a12, 1 〉 , γ€ˆ a22, 1 〉 } a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations l = { γ€ˆ a01, x 〉 , γ€ˆ a02, y 〉 , ..., γ€ˆ a22, x 〉 } a13: end a23: end β€£ m, maps locks/unlocks to monitors 5

  25. Specifying a memory model relational constants capture first order logic ( βˆ€ , βˆƒ , ∧ , ∨ , Β¬ ) static properties of a program relational algebra (., βˆͺ , ∩ , βˆ• , Γ— , βŠ† ) β€£ co, control flow bitvector arithmetic (+, -, *, /,) relational β€£ to, thread order to = { γ€ˆ t0, t1 〉 , γ€ˆ t0, t2 〉 } logic constants a00: start variables a01: write(x, 0) relational variables capture runtime a02: write(y, 0) properties of a program x = 0, y = 0, y = 0 a03: end β€£ A, set of all executed actions A = { γ€ˆ a00 〉 , γ€ˆ a01 〉 , ..., γ€ˆ a23 〉 } a10: start a20: start β€£ W, maps reads to seen writes W = { γ€ˆ a11, a01 〉 , γ€ˆ a21, a12 〉 } r1 = x r2 = y a11: read(x, 0) a21: read(y, 1) β€£ V, maps writes to written values V = { γ€ˆ a01, 0 〉 , γ€ˆ a02, 0 〉 , γ€ˆ a12, 1 〉 , γ€ˆ a22, 1 〉 } a12: write(y, 1) a22: write(x, 1) y = 1 x = 1 β€£ l, maps reads/writes to locations l = { γ€ˆ a01, x 〉 , γ€ˆ a02, y 〉 , ..., γ€ˆ a22, x 〉 } a13: end a23: end β€£ m, maps locks/unlocks to monitors m = { } 5

  26. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  27. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  28. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  29. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  30. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  31. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  32. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  33. Example: sequential consistency interleaved semantics all statements appear to execute in a total order that agrees with the program text 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] Execution order is total, 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] antisymmetric, and 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] transitive. 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] It respects the control flow and 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] thread order. 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] Reads cannot see out of order writes. 7. βˆ€ k: A ∩ Read, j: A ∩ Write | No write interferes between a read and the write seen by that read. Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) 6

  34. Example: Java memory model committing semantics an execution is legal if it can be derived by committing and executing actions in a sequence of speculative executions A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  35. Example: Java memory model initial execution: reads can only see writes that committing semantics happen-before them an execution is legal if it can be derived by A 1 committing and executing actions in a sequence of speculative executions A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  36. Example: Java memory model initial execution: reads can only see writes that committing semantics happen-before them an execution is legal if it can be derived by A 1 committing and executing actions in a sequence of speculative executions C 1 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  37. Example: Java memory model i th execution: committed reads can see committed writes; other reads must committing semantics see writes that happen- A 2 an execution is legal if it can be derived by before them committing and executing actions in a sequence of speculative executions C 1 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  38. Example: Java memory model i th execution: committed reads can see committed writes; other reads must committing semantics see writes that happen- A 2 an execution is legal if it can be derived by before them committing and executing actions in a sequence of speculative executions C 1 C 2 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  39. Example: Java memory model i th execution: committed reads can see committed writes; other reads must A k committing semantics see writes that happen- an execution is legal if it can be derived by before them committing and executing actions in a sequence of speculative executions C 1 C 2 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  40. Example: Java memory model i th execution: committed reads can see committed writes; other reads must A k committing semantics see writes that happen- an execution is legal if it can be derived by before them committing and executing actions in a sequence of speculative executions … C k C 1 C 2 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  41. Example: Java memory model committing semantics an execution is legal if it can be derived by committing and executing actions in a sequence of speculative executions … C k C 1 C 2 A 1. βˆ€ i: [1..k] | C i βŠ† A i 2. βˆ€ i: [1..k], r: C i ∩ Read | (hb[W[r], r] ⇔ hb i [W[r], r]) ∧ Β¬ hb i [r, W[r]] … ⇝ … ⇝ E 1 ⇝ E 2 E k E 3. βˆ€ i: [1..k] | C i ◁ V i = C i ◁ V 4. βˆ€ i: [1..k] | C i-1 ◁ W i = C i-1 ◁ W A 1 , W 1 , V 1 , A 2 , W 2 , V 2 , A k , W k , V k , A, W, V, l 1 , m 1 , l 2 , m 2 , l k , m k , l, m, 5. βˆ€ i: [1..k], r: (A i β§΅ C i ) ∩ Read | hb i [W i [r], r] po 1 , so 1 , po 2 , so 2 , po k , so k , po, so, 6. βˆ€ i: [1..k], r: (C i β§΅ C i-1 ) ∩ Read | W i [r] βŠ† C i-1 sw 1 , hb 1 sw 2 , hb 2 sw k , hb k sw, hb 7. βˆ€ i: [1..k], y: C i , x: A i | (y βŠ† Special ∧ hb[x, y]) β‡’ x βŠ† C i-1 7

  42. Witness of legality (model) E 1 E 2 E a00: start a00: start a00: start a01: write(x, 0) a01: write(x, 0) a01: write(x, 0) a02: write(y, 0) a02: write(y, 0) a02: write(y, 0) a03: end a03: end a03: end W 2 W 1 hb 2 hb 1 hb a10: start a20: start a10: start a20: start a10: start a20: start W a11: read(x, 0) a21: read(y, 0) a11: read(x, 0) a21: read(y, 0) a11: read(x, 1) a21: read(y, 1) a12: write(y, 1) a22: write(x, 1) a12: write(y, 1) C 1 a22: write(x, 1) a12: write(y, 1) a22: write(x, 1) C 2 a13: end a23: end a13: end a23: end a13: end a23: end x = 0, y = 0, y = 0 witness: an execution of the r1 = x r2 = y program that satisfies both the y = 1 x = 1 JMM assertions and the memory model constraints. r1==r2==1? r1==r2==1? 8

  43. Proof of illegality (minimal core) V[a 01 ] = 0 x = 0, y = 0, y = 0 V[a 02 ] = 0 r1 = x r2 = y V[W[a 11 ]] = 1 y = 1 x = 1 V[W[a 21 ]] = 1 r1==1 && r2==1? r1==1 && βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  44. Proof of illegality (minimal core) a ij represents the action (if V[a 01 ] = 0 x = 0, y = 0, y = 0 any) performed by the j th V[a 02 ] = 0 statement of the i th thread r1 = x r2 = y V[W[a 11 ]] = 1 y = 1 x = 1 V[W[a 21 ]] = 1 r1==1 && r1==1 && r2==1? βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  45. Proof of illegality (minimal core) V[a 01 ] = 0 x = 0, y = 0, y = 0 V[a 02 ] = 0 r1 = x r2 = y V[W[a 11 ]] = 1 y = 1 x = 1 V[W[a 21 ]] = 1 r1==1 && r2==1? r1==1 && βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  46. Proof of illegality (minimal core) V[a 01 ] = 0 x = 0, y = 0, y = 0 V[a 02 ] = 0 r1 = x r2 = y V[W[a 11 ]] = 1 y = 1 x = 1 V[W[a 21 ]] = 1 r1==1 && r2==1? r1==1 && βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  47. Proof of illegality (minimal core) βœ„ V[a 01 ] = 0 a01: write(x, 1) x = 1, x = 0, y = 0, y = 0 V[a 02 ] = 0 a02: write(y, 0) r1 = x r2 = y a11: read(x, 1) V[W[a 11 ]] = 1 y = 1 x = 1 a12: write(y, 1) V[W[a 21 ]] = 1 a21: read(y, 1) r1==1 && r1==1 && r2==1? a22: write(x, 1) βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  48. Proof of illegality (minimal core) V[a 01 ] = 0 a01: write(x, 0) a01: write(x, 1) x = 0, y = 0, y = 0 V[a 02 ] = 0 a02: write(y, 0) a02: write(y, 0) r1 = x r2 = y a11: read(x, 0) a11: read(x, 1) βœ„ V[W[a 11 ]] = 1 y = 1 x = 1 a12: write(y, 1) a12: write(y, 1) V[W[a 21 ]] = 1 a21: read(y, 1) a21: read(y, 1) r1==1 && r1==1 && r2==1? a22: write(x, 1) a22: write(x, 1) βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  49. Proof of illegality (minimal core) V[a 01 ] = 0 a01: write(x, 0) a01: write(x, 0) a01: write(x, 1) x = 0, y = 0, y = 0 V[a 02 ] = 0 a02: write(y, 0) a02: write(y, 0) a02: write(y, 0) r1 = x r2 = y a11: read(x, 0) a11: read(x, 1) a12: write(y, 1) V[W[a 11 ]] = 1 y = 1 x = 1 a12: write(y, 1) a12: write(y, 1) a21: read(y, 1) V[W[a 21 ]] = 1 a22: write(x, 1) a21: read(y, 1) a21: read(y, 1) r1==1 && r2==1? r1==1 && a22: write(x, 1) a22: write(x, 1) a11: read(x, 1) βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] SC 1. βˆ€ i, j: A | i β‰  j β‡’ ord[i, j] ∨ ord[j, i] βœ„ βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 2. βˆ€ i, j: A | ord[i, j] β‡’ Β¬ord[j, i] βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] 3. βˆ€ i, j, k: A | (ord[i, j] ∧ ord[j, k]) β‡’ ord[i, k] 4. βˆ€ i, j: A | (t[i] = t[j] ∧ co + [i, j]) β‡’ ord[i, j] 5. βˆ€ i, j: A | (t[i] β‰  t[j] ∧ to + [t[i], t[j]]) β‡’ ord[i, j] minimal core: an unsatisfiable 6. βˆ€ k: A ∩ Read | Β¬ ord[k, W[k]] subset of the program and 7. βˆ€ k: A ∩ Read, j: A ∩ Write | memory model constraints that Β¬ ( l[k] = l[j] ∧ ord[W[k], j] ∧ ord[j, k] ) becomes satisfiable if one of its members is removed 9

  50. Approach Program preprocessor translator finitization parameters Memory constraint bounds model assembler assembler solver 10

  51. Approach finitize P and convert it to an intermediate form I(P) Program preprocessor translator finitization parameters Memory constraint bounds model assembler assembler solver 10

  52. Approach finitize P and translate I(P) to convert it to an a relational intermediate form representation I(P) Program preprocessor translator R(P) finitization parameters Memory constraint bounds model assembler assembler solver 10

  53. Approach finitize P and translate I(P) to convert it to an a relational intermediate form representation I(P) Program preprocessor translator R(P) finitization parameters F(P, M) Memory constraint bounds model assembler assembler combine R(P) and M into the legality formula solver 10

  54. Approach finitize P and translate I(P) to convert it to an a relational intermediate form representation I(P) Program preprocessor translator compute a set of R(P) bounds on the finitization search space parameters F(P, M) Memory constraint bounds model assembler assembler combine R(P) B(P, M) and M into the legality formula solver 10

  55. Approach WALA MemSAT Program preprocessor translator contributions y t i r a l u d finitization o m parameters efficiency Memory constraint bounds model assembler assembler kodkod + MiniSat 10

  56. Preprocessing public class Test1 { public class Test1 { static int x = 0; static int x = 0; static int y = 0; static int y = 0; @thread @thread finitize P and public static void thread1() { public static void thread1() { convert it to an final int r1 = x; final int r1 = x; intermediate form if ( r1 != 0) if ( r1 != 0) I(P) y = r1; y = r1; else else y = 1; y = 1; assert r1==1; assert r1==1; } } @thread @thread public static void thread2() { public static void thread2() { final int r2 = y; final int r2 = y; x = 1; x = 1; assert r2==1; assert r2==1; } } } } 11

  57. Preprocessing public class Test1 { public class Test1 { 00 start static int x = 0; static int x = 0; static int y = 0; static int y = 0; 01 write(x, 0) @thread @thread 02 write(y, 0) public static void thread1() { public static void thread1() { final int r1 = x; final int r1 = x; 03 end if ( r1 != 0) if ( r1 != 0) y = r1; y = r1; else else 10 start 20 start y = 1; y = 1; assert r1==1; assert r1==1; 11 r1=read(x) 21 r2=read(y) } } 12 branch(r1!=0) T F @thread @thread 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) public static void thread2() { public static void thread2() { final int r2 = y; final int r2 = y; 15 assert(r1==1) 23 assert(r2==1) x = 1; x = 1; assert r2==1; assert r2==1; 16 end 24 end } } } } 11

  58. Preprocessing public class Test1 { public class Test1 { 00 start static int x = 0; static int x = 0; control flow static int y = 0; static int y = 0; 01 write(x, 0) @thread @thread 02 write(y, 0) public static void thread1() { public static void thread1() { final int r1 = x; final int r1 = x; 03 end thread order if ( r1 != 0) if ( r1 != 0) y = r1; y = r1; else else 10 start 20 start y = 1; y = 1; assert r1==1; assert r1==1; 11 r1=read(x) 21 r2=read(y) } } 12 branch(r1!=0) T F @thread @thread 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) public static void thread2() { public static void thread2() { final int r2 = y; final int r2 = y; 15 assert(r1==1) 23 assert(r2==1) x = 1; x = 1; assert r2==1; assert r2==1; 16 end 24 end } } } } 11

  59. Preprocessing public class Test1 { public class Test1 { s guard 00 start static int x = 0; static int x = 0; 13 r1!=0 static int y = 0; static int y = 0; 14 r1==0 01 write(x, 0) * true @thread @thread 02 write(y, 0) public static void thread1() { public static void thread1() { final int r1 = x; final int r1 = x; 03 end if ( r1 != 0) if ( r1 != 0) y = r1; y = r1; else else 10 start 20 start y = 1; y = 1; assert r1==1; assert r1==1; 11 r1=read(x) 21 r2=read(y) } } 12 branch(r1!=0) T F @thread @thread 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) public static void thread2() { public static void thread2() { final int r2 = y; final int r2 = y; 15 assert(r1==1) 23 assert(r2==1) x = 1; x = 1; assert r2==1; assert r2==1; 16 end 24 end } } } } 11

  60. Preprocessing public class Test1 { public class Test1 { s guard 00 start static int x = 0; static int x = 0; 13 r1!=0 static int y = 0; static int y = 0; 14 r1==0 01 write(x, 0) * true @thread @thread 02 write(y, 0) s maySee public static void thread1() { public static void thread1() { 11 { 01 , 22 } final int r1 = x; final int r1 = x; 03 end 21 { 02 , 13 , 14 } if ( r1 != 0) if ( r1 != 0) y = r1; y = r1; else else 10 start 20 start y = 1; y = 1; assert r1==1; assert r1==1; 11 r1=read(x) 21 r2=read(y) } } 12 branch(r1!=0) T F @thread @thread 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) public static void thread2() { public static void thread2() { final int r2 = y; final int r2 = y; 15 assert(r1==1) 23 assert(r2==1) x = 1; x = 1; assert r2==1; assert r2==1; 16 end 24 end } } } } 11

  61. Translation s guard 00 start 13 r1!=0 14 r1==0 01 write(x, 0) * true 02 write(y, 0) s maySee translate I(P) to a 11 relational { 01 , 22 } 03 end 21 { 02 , 13 , 14 } representation R(P) 10 start 20 start 11 r1=read(x) 21 r2=read(y) 12 branch(r1!=0) T F 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) 15 assert(r1==1) 23 assert(r2==1) 16 end 24 end 12

  62. Translation s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  63. Translation maps reads, writes, locks, and unlocks to relations representing locations that are accessed s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  64. Translation maps reads, writes, locks, and unlocks to relations representing locations that are accessed s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } relational constants 03 end 03 ⊀ 21 { 02 , 13 , 14 } that represent fields: 10 ⊀ x = {< x >} and y = 11 x ⊀ {< y >} 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  65. Translation maps writes and asserts to relational encodings of the values written or asserted s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  66. Translation maps writes and asserts to relational encodings of the values written or asserted s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 ⊀ relational variable 11 x ⊀ that acts as a 12 ⊀ 10 start 20 start placeholder for the 13 y r1 r1 β‰  Bits(0) value read into r1 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  67. Translation maps statements to formulas that encode their guards s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 02 write(y, 0) 01 x Bits(0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  68. Translation s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee 02 y Bits(0) ⊀ 11 { 01 , 22 } 03 03 end ⊀ 21 { 02 , 13 , 14 } 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) ⊀ 21 r2=read(y) 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 12

  69. Constraint assembly s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee construct the 02 y Bits(0) ⊀ 11 legality formula { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } for R(P) and M F(P, M) 10 ⊀ 11 x ⊀ 12 ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  70. Constraint assembly s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee 02 y Bits(0) F(R(P), E) ∧ ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  71. Constraint assembly s guard 00 start The witness execution E 13 r1!=0 respects the sequential s Loc Val Guard 14 r1==0 01 write(x, 0) semantics of P 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee 02 y Bits(0) F(R(P), E) ∧ ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  72. Constraint assembly s guard 00 start The witness execution E 13 r1!=0 respects the sequential s Loc Val Guard 14 r1==0 01 write(x, 0) semantics of P 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee E executes and 02 y Bits(0) F(R(P), E) ∧ ⊀ 11 satisfies the { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } assertions in P 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  73. Constraint assembly s guard 00 start The witness execution E 13 r1!=0 respects the sequential s Loc Val Guard 14 r1==0 01 write(x, 0) semantics of P 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee E executes and 02 y Bits(0) F(R(P), E) ∧ ⊀ 11 satisfies the { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } assertions in P 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ Each speculative ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) execution E i respects 14 y Bits(1) r1 =Bits(0) the sequential M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) semantics of P 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  74. Constraint assembly s guard 00 start The witness execution E 13 r1!=0 respects the sequential s Loc Val Guard 14 r1==0 01 write(x, 0) semantics of P 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee E executes and 02 y Bits(0) F(R(P), E) ∧ ⊀ 11 satisfies the { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } assertions in P 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ Each speculative ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) execution E i respects 14 y Bits(1) r1 =Bits(0) the sequential M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) semantics of P 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) E and all E i respect the ⊀ 22 x Bits(1) memory model constraints ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  75. Constraint assembly s guard 00 start 13 r1!=0 s Loc Val Guard 14 r1==0 01 write(x, 0) 00 * true ⊀ 01 x Bits(0) 02 write(y, 0) ⊀ s maySee 02 y Bits(0) F(R(P), E) ∧ F(R(P), E) ∧ ⊀ 11 { 01 , 22 } 03 end 03 ⊀ 21 { 02 , 13 , 14 } 10 F Ξ± (R(P), E) ∧ F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 10 start 20 start 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) M(E, E 1 , … , E k ) M(E, E 1 , … , E k ) 11 r1=read(x) 15 r1 =Bits(1) 21 r2=read(y) ⊀ 12 branch(r1!=0) 16 ⊀ 20 T F ⊀ 21 y 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 15 assert(r1==1) 23 assert(r2==1) 24 ⊀ 16 end 24 end 13

  76. Constraint assembly: F Ξ± (R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 ⊀ 01 x Bits(0) ⊀ 02 y Bits(0) F(R(P), E) ∧ ⊀ 03 ⊀ 10 F Ξ± (R(P), E) ∧ ⊀ 11 x ⊀ 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 13 y r1 r1 β‰  Bits(0) 14 y Bits(1) r1 =Bits(0) M(E, E 1 , … , E k ) 15 r1 =Bits(1) ⊀ 16 ⊀ 20 ⊀ 21 y ⊀ 22 x Bits(1) ⊀ 23 r2 =Bits(1) ⊀ 24 ⊀ 14

  77. Constraint assembly: F Ξ± (R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ ⊀ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ ⊀ 11 r1=read(x) 11 x a 11 ⊀ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 M(E, E 1 , … , E k ) relational variable a ij 15 assert(r1==1) 15 r1 =Bits(1) ⊀ represents the action 16 end 16 a 16 ⊀ performed if E executes 20 start 20 a 20 ⊀ the statement ij 21 r2=read(y) 21 y a 21 ⊀ 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ 14

  78. Constraint assembly: F Ξ± (R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ ⊀ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ ⊀ V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ ⊀ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 M(E, E 1 , … , E k ) 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 ⊀ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 14

  79. Constraint assembly: F Ξ± (R(P), E) s Loc Val Guard 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ ⊀ 03 end 03 a 03 ⊀ 10 start 10 a 10 V [ W [ a 11 ]]=Bits(1) ∧ F Ξ± (R(P), E) ∧ ⊀ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , … , E k ) 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 ⊀ M(E, E 1 , …, E k ) 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 14

  80. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  81. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  82. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ β€£ 0 or 1 action performed | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ β€£ action performed iff the A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ guard is true 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ β€£ no other statement (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 performs the same action (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ β€£ action location is valid l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  83. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ β€£ 0 or 1 action performed | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ β€£ action performed iff the A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ guard is true 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ β€£ no other statement (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 performs the same action (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ β€£ action location is valid l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  84. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 V [ W [ a 11 ]]=Bits(1) ∧ F Ξ± (R(P), E) ∧ ( | a 13 | = 1 ⇔ ⊀ β€£ action performed iff the A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ guard is true 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ β€£ no other statement (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 performs the same action (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ β€£ action location is valid l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  85. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ β€£ no other statement (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 performs the same action (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ β€£ action location is valid l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  86. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ β€£ action location is valid l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  87. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 β€£ action value is valid V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  88. Constraint assembly: F(R(P), E) A set of all executed actions W maps reads to seen writes V maps writes to written values l maps writes to written values s Loc Val Guard m maps locks/unlocks to monitors 00 start 00 a 00 ⊀ 01 write(x, 0) 01 x Bits(0) a 01 ⊀ 02 write(y, 0) 02 y Bits(0) a 02 F(R(P), E) ∧ β‹€ s ∈ P F(s, R(P), E) ∧ ⊀ | a 13 | ≀ 1 ∧ 03 end 03 a 03 ⊀ 10 start 10 a 10 F Ξ± (R(P), E) ∧ V [ W [ a 11 ]]=Bits(1) ∧ ( | a 13 | = 1 ⇔ ⊀ A = a 00 βˆͺ … βˆͺ a 24 ∧ V [ W [ a 11 ]] V [ W [ a 11 ]] 11 r1=read(x) 11 x a 11 ⊀ V[W[a 11 ]] β‰  Bits(0)) ∧ 12 branch(r1!=0) 12 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ V [ W [ a 21 ]]=Bits(1) ∧ ⊀ V [ W [ a 11 ]]=Bits(1) ∧ (a 13 ∩ a 00 ) = βˆ… ∧ … ∧ 13 write(y, r1) 13 y r1 r1 β‰  Bits(0) a 13 (a 13 ∩ a 24 ) = βˆ… ∧ 14 write(y, 1) 14 y Bits(1) r1 =Bits(0) a 14 β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ M(E, E 1 , …, E k ) V [ W [ a 21 ]]=Bits(1) ∧ l[a 13 ] = y ∧ 15 assert(r1==1) 15 r1 =Bits(1) ⊀ 16 end 16 a 16 V[a 13 ] = V[W[a 11 ]] ⊀ M(E, E 1 , …, E k ) β‹€ 1 ≀ i ≀ k F(R(P), E i ) ∧ 20 start 20 a 20 ⊀ 21 r2=read(y) 21 y a 21 ⊀ M(E, E 1 , … , E k ) 22 write(x, 1) 22 x Bits(1) a 22 ⊀ 23 assert(r2==1) 23 r2 =Bits(1) ⊀ 24 end 24 a 24 ⊀ V [ W [ a 21 ]] 15

  89. Bounds assembly s guard 00 start 13 r1!=0 14 r1==0 01 write(x, 0) * true 02 write(y, 0) s maySee compute a set of 11 bounds on the { 01 , 22 } 03 end 21 { 02 , 13 , 14 } search space B(P, M) F(P, M) 10 start 20 start 11 r1=read(x) 21 r2=read(y) 12 branch(r1!=0) T F 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) 15 assert(r1==1) 23 assert(r2==1) 16 end 24 end 16

  90. Bounds assembly s guard 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 02 write(y, 0) s maySee 11 { 01 , 22 } 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} 10 start 20 start {…} βŠ† V βŠ† {…} 11 r1=read(x) 21 r2=read(y) 12 branch(r1!=0) {…} βŠ† W βŠ† {…} T F 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} 16 end 24 end 16

  91. Bounds assembly: universe s guard 00 start finite universe of -8, 1, 2, 4, x, y, 13 r1!=0 symbolic values from a00, a01, a02, a03, 14 r1==0 01 write(x, 0) which the model, if a10, a11, a13, a16, * true any, is drawn a20, a21, a22, a24 02 write(y, 0) s maySee 11 { 01 , 22 } 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} 10 start 20 start {…} βŠ† V βŠ† {…} 11 r1=read(x) 21 r2=read(y) 12 branch(r1!=0) {…} βŠ† W βŠ† {…} T F 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} 16 end 24 end 17

  92. Bounds assembly: universe primitives fields s guard 00 start finite universe of -8, 1, 2, 4, x, y, 13 r1!=0 symbolic values from a00, a01, a02, a03, 14 r1==0 01 write(x, 0) which the model, if a10, a11, a13, a16, * true any, is drawn a20, a21, a22, a24 02 write(y, 0) s maySee 11 { 01 , 22 } 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} 10 start 20 start {…} βŠ† V βŠ† {…} 11 r1=read(x) 21 r2=read(y) 12 branch(r1!=0) {…} βŠ† W βŠ† {…} T F 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} 16 end 24 end 17

  93. Bounds assembly: universe primitives fields s guard a00 00 start finite universe of -8, 1, 2, 4, x, y, 13 r1!=0 symbolic values from a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) which the model, if a10, a11, a13, a16, * true any, is drawn a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } actions a03 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} a10 a20 10 start 20 start {…} βŠ† V βŠ† {…} a11 11 r1=read(x) a21 21 r2=read(y) 12 branch(r1!=0) {…} βŠ† W βŠ† {…} a13 T F a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 17

  94. Bounds assembly: lower/upper bounds s guard a00 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } a03 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} a10 a20 10 start 20 start {…} βŠ† V βŠ† {…} a11 11 r1=read(x) a21 21 r2=read(y) 12 branch(r1!=0) upper and lower {…} βŠ† W βŠ† {…} bound on the value a13 T F of each relation that a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) appears in F(P, M) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 18

  95. Bounds assembly: lower/upper bounds s guard a00 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } a03 03 end 21 { 02 , 13 , 14 } F(P, M) {…} βŠ† A βŠ† {…} a10 a20 10 start 20 start {…} βŠ† V βŠ† {…} a11 11 r1=read(x) a21 21 r2=read(y) 12 branch(r1!=0) upper and lower {…} βŠ† W βŠ† {…} bound on the value a13 T F of each relation that a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) appears in F(P, M) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 18

  96. Bounds assembly: lower/upper bounds s guard a00 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } a03 03 end { } 21 { 02 , 13 , 14 } < a00 >, < a01 >, < a02 >, < a03 >, < a10 >, < a11 >, F(P, M) {…} βŠ† A βŠ† {…} < a13 >, < a16 >, < a20 >, a10 a20 10 start 20 start < a21 >, < a22 >, < a24 > {…} βŠ† V βŠ† {…} a11 11 r1=read(x) a21 21 r2=read(y) 12 branch(r1!=0) upper and lower {…} βŠ† W βŠ† {…} bound on the value a13 T F of each relation that a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) appears in F(P, M) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 18

  97. Bounds assembly: lower/upper bounds s guard a00 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } a03 03 end { } { } 21 { 02 , 13 , 14 } < a00 >, < a01 >, < a02 >, < a00 >, < a01 >, < a02 >, < a03 >, < a10 >, < a11 >, < a03 >, < a10 >, < a11 >, F(P, M) {…} βŠ† A βŠ† {…} < a13 >, < a16 >, < a20 >, < a16 >, < a20 >, a10 a20 10 start 20 start < a21 >, < a22 >, < a24 > < a21 >, < a22 >, < a24 > {…} βŠ† V βŠ† {…} a11 11 r1=read(x) a21 21 r2=read(y) 12 branch(r1!=0) upper and lower {…} βŠ† W βŠ† {…} bound on the value a13 T F of each relation that a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) appears in F(P, M) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 18

  98. Bounds assembly: lower/upper bounds s guard a00 00 start -8, 1, 2, 4, x, y, 13 r1!=0 a00, a01, a02, a03, a01 14 r1==0 01 write(x, 0) a10, a11, a13, a16, * true a20, a21, a22, a24 a02 02 write(y, 0) s maySee 11 { 01 , 22 } a03 03 end { } { } 21 { 02 , 13 , 14 } < a00 >, < a01 >, < a02 >, < a00 >, < a01 >, < a02 >, < a03 >, < a10 >, < a11 >, < a03 >, < a10 >, < a11 >, F(P, M) {…} βŠ† A βŠ† {…} < a13 >, < a16 >, < a20 >, < a16 >, < a20 >, a10 a20 10 start 20 start < a21 >, < a22 >, < a24 > < a21 >, < a22 >, < a24 > {…} βŠ† V βŠ† {…} { < a21 , a13 > } a11 11 r1=read(x) < a11 , a01 >, a21 21 r2=read(y) 12 branch(r1!=0) upper and lower < a11 , a22 >, {…} βŠ† W βŠ† {…} bound on the value < a21 , a02 >, a13 T F of each relation that a22 13 write(y, r1) 14 write(y, 1) 22 write(x, 1) appears in F(P, M) {…} βŠ† l βŠ† {…} 15 assert(r1==1) 23 assert(r2==1) {…} βŠ† m βŠ† {…} a16 a24 16 end 24 end 18

Recommend


More recommend