refinement proofs and

Refinement Proofs and Techniques Suha Orhun Mutluergil Koc - PowerPoint PPT Presentation

Refinement Proofs and Techniques Suha Orhun Mutluergil Koc University, Istanbul, Turkey Refinement In general: A concrete and complex system 1 refines the abstract system 2 iff 2 completely captures the behaviors of 1 .


  1. Refinement Proofs and Techniques Suha Orhun Mutluergil Koc University, Istanbul, Turkey

  2. Refinement ο‚΄ In general: A concrete and complex system 𝑇 1 refines the abstract system 𝑇 2 iff 𝑇 2 completely captures the behaviors of 𝑇 1 . ο‚΄ For automata/state machines/transition systems ο‚΄ Refinement is based on observable actions alphabet Ξ£ . ο‚΄ Formally: A Labeled Transition System (LTS) 𝑀 1 Ξ£ βˆ’ refines the LTS 𝑀 2 iff for every trace 𝜐 of 𝑀 1 , there exists a trace πœβ€² of 𝑀 2 such that 𝜐 Ξ£ = 𝜐 β€² Ξ£ . ο‚΄ Example: L 1 = βŒ©π‘‡ 1 = 𝑑 0 , 𝑑 1 , … , Ξ£ 1 = 𝛽, 𝛾, 𝛿 , πœ€ 1 βŒͺ s.t. πœ€ 1 βŠ† 𝑇 1 Γ— Ξ£ 1 Γ— S 1 𝑀 2 = βŒ©π‘‡ 2 = π‘Ÿ 0 , π‘Ÿ 1 , … , Ξ£ 2 = 𝛽, 𝛾, πœ„ , πœ€ 2 βŒͺ s.t. πœ€ 2 βŠ† 𝑇 2 Γ— Ξ£ 2 Γ— 𝑇 2 Ξ£ = {𝛽, 𝛾} 𝛽 𝛿 𝛾 𝛾 𝑑 0 𝑑 1 𝑑 3 𝑑 4 𝑑 2 𝛽 𝛾 𝛾 πœ„ π‘Ÿ 0 π‘Ÿ 3 π‘Ÿ 4 π‘Ÿ 1 π‘Ÿ 2

  3. Refinement ο‚΄ In general: A concrete and complex system 𝑇 1 refines the abstract system 𝑇 2 iff 𝑇 2 completely captures the behaviors of 𝑇 1 . ο‚΄ For automata/state machines/transition systems ο‚΄ Refinement is based on observable actions alphabet Ξ£ . ο‚΄ Formally: A Labeled Transition System (LTS) 𝑀 1 Ξ£ βˆ’ refines the LTS 𝑀 2 iff for every trace 𝜐 of 𝑀 1 , there exists a trace πœβ€² of 𝑀 2 such that 𝜐 Ξ£ = 𝜐 β€² Ξ£ . ο‚΄ Example: L 1 = βŒ©π‘‡ 1 = 𝑑 0 , 𝑑 1 , … , Ξ£ 1 = 𝛽, 𝛾, 𝛿 , πœ€ 1 βŒͺ s.t. πœ€ 1 βŠ† 𝑇 1 Γ— Ξ£ 1 Γ— S 1 𝑀 2 = βŒ©π‘‡ 2 = π‘Ÿ 0 , π‘Ÿ 1 , … , Ξ£ 2 = 𝛽, 𝛾, πœ„ , πœ€ 2 βŒͺ s.t. πœ€ 2 βŠ† 𝑇 2 Γ— Ξ£ 2 Γ— 𝑇 2 Ξ£ = {𝛽, 𝛾} 𝜷 𝛿 𝜸 𝜸 𝑑 0 𝑑 1 𝑑 3 𝑑 4 𝑑 2 𝜷 𝜸 𝜸 πœ„ π‘Ÿ 0 π‘Ÿ 3 π‘Ÿ 4 π‘Ÿ 1 π‘Ÿ 2

  4. How to Prove Refinement ο‚΄ In general, proofs depend on finding a particular kind of relations/functions that relates states of 𝑀 1 to states of 𝑀 2 . ο‚΄ Refinement mappings, forward simulation relations, backward simulation relations ο‚΄ Completeness issues: None of these relations/functions are complete. ο‚΄ Refinement Mappings ο‚΄ Complete if 𝑀 1 is a forest and 𝑀 2 is deterministic. 2 ο‚΄ Otherwise, history and/or prophecy variables may need to be added. 1 ο‚΄ Forward Simulations ο‚΄ Complete if 𝑀 2 is deterministic. 2 ο‚΄ Otherwise, prophecy variables may need to be added. 2 ο‚΄ Backward Simulations ο‚΄ Complete if 𝑀 1 is a forest. 2 ο‚΄ Otherwise, history variables may need to be added. 2 1. Abadi, M., & Lamport, L. (1991). The existence of refinement mappings. Theoretical Computer Science, 82(2), 253-284. 2. Lynch, N. A., & Vaandrager, F. W. (1995). Forward and backward simulations. Part I: Untimed systems. Information and Computation , 121 (2), 214-233.

  5. Proving Linearizability using Forward Simulations Η‚ Joint work with Ahmed Bouajjani 1 , Constantin Enea 1 and Michael Emmi 2 1 :IRIF, University of Paris Diderot 2 :Nokia Bell Labs Η‚: To Appear in CAV'17

  6. A Brief Overview ο‚΄ Scope: Proving correctness of concurrent stack and queue implementations (which eventually boils down to a refinement proof). ο‚΄ Contributions: A new stack and queue LTS specifications that are more useful than the standard specifications for the proofs ο‚΄ Shown the equivalence to the standard specifications ο‚΄ Existence of forward simulations is guaranteed if some properties are known for the dequeue/pop methods of the implementations. ο‚΄ Experiments/Applications ο‚΄ Shown the correctness of Herlihy-Wing Queue 1 by finding a forward simulation relation to the new queue implementation. ο‚΄ Shown correctness of Time-Stamped Stack 2 finding a forward simulation relation to the new stack implementation. 1. Herlihy, Maurice P., and Jeannette M. Wing. "Linearizability: A correctness condition for concurrent objects." ACM Transactions on Programming Languages and Systems (TOPLAS) 12.3 (1990): 463-492. 2. Dodds, Mike, Andreas Haas, and Christoph M. Kirsch. "A scalable, correct time-stamped stack." ACM SIGPLAN Notices. Vol. 50. No. 1. ACM, 2015.

  7. Linearizability ο‚΄ The standard correctness condition for concurrent data structures/libraries. ο‚΄ Call and return actions mark the beginning and end of methods. ο‚΄ History: Projection of a trace over call and return actions ( 𝐷 βˆͺ 𝑆 ). ο‚΄ 𝑀 1 is linearizable with respect to the specification 𝑀 2 iff there exists a linearization point of every operation in the history β„Ž 1 btw its call and return points such that the same operation of 𝑀 2 takes place atomically at that point. inv(enq,3) ret(enq) inv(enq,5) ret(enq) inv(deq) ret(deq,3) enq(3) deq(3) enq(5)

  8. How to Prove Linearizability of Queues ο‚΄ Standard abstract specification 𝐡𝑐𝑑𝑅 0 : ο‚΄ State: π‘Ÿ: β„• πœ• ο‚΄ Actions: π‘—π‘œπ‘€(π‘“π‘œπ‘Ÿ, 𝑒) , π‘šπ‘—π‘œ π‘“π‘œπ‘Ÿ, 𝑒 , 𝑠𝑓𝑒(π‘“π‘œπ‘Ÿ) , π‘—π‘œπ‘€(π‘’π‘“π‘Ÿ) , π‘šπ‘—π‘œ(π‘’π‘“π‘Ÿ, 𝑒) , 𝑠𝑓𝑒(π‘’π‘“π‘Ÿ, 𝑒) ≔ π‘Ÿ β€² = π‘Ÿ ∘ βŒ©π‘’βŒͺ ο‚΄ π‘šπ‘—π‘œ π‘“π‘œπ‘Ÿ, 𝑒 β‡’ q β€² = q ο‚΄ π‘šπ‘—π‘œ π‘’π‘“π‘Ÿ, EMPTY ≔ π‘Ÿ = ο‚΄ π‘šπ‘—π‘œ π‘’π‘“π‘Ÿ, 𝑒 ≔ π‘Ÿ = 𝑒 ∘ 𝑑 ∧ 𝑒 β‰  EMPTY β‡’ π‘Ÿ β€² = 𝑑 ο‚΄ Showing that the implementation 𝑀 1 𝐷 βˆͺ 𝑆 βˆ’ refines 𝐡𝑐𝑑𝑅 0 is sufficient. ο‚΄ If we know the linearization points of enqueue or dequeue methods, finding 𝐷 βˆͺ 𝑆 βˆͺ π‘šπ‘—π‘œ βˆ’ refinements are easier.

  9. Observations about Implementations ο‚΄ Linearization points of enqueues are usually not fixed (depends on the execution). ο‚΄ Linearization points of dequeues are usually fixed and easy to determine. ο‚΄ 𝐡𝑐𝑑𝑅 0 is not deterministic in terms of 𝐷 βˆͺ 𝑆 and 𝐷 βˆͺ 𝑆 βˆͺ π‘šπ‘—π‘œ π‘’π‘“π‘Ÿ . ret(enq) inv(enq,3) lin(enq,3) π‘Ÿ = 〈3,5 βŒͺ inv(enq,5) lin(enq,5) ret(enq)

  10. Observations about Implementations ο‚΄ Linearization points of enqueues are usually not fixed (depends on the execution). ο‚΄ Linearization points of dequeues are usually fixed and easy to determine. ο‚΄ 𝐡𝑐𝑑𝑅 0 is not deterministic in terms of 𝐷 βˆͺ 𝑆 and 𝐷 βˆͺ 𝑆 βˆͺ π‘šπ‘—π‘œ π‘’π‘“π‘Ÿ . inv(enq,3) lin(enq,3) ret(enq) π‘Ÿ = 〈5,3 βŒͺ inv(enq,5) lin(enq,5) ret(enq)

  11. New Abstract Queue 𝐡𝑐𝑑𝑅 ο‚΄ States: Strict partial order of enqueue 𝑓 6 operations based on happens-before relation. They can be pending or completed 𝑓 5 ο‚΄ Actions: 𝐷 βˆͺ 𝑆 βˆͺ π‘šπ‘—π‘œ(π‘’π‘“π‘Ÿ) 𝑓 4 ο‚΄ 𝐡𝑐𝑑𝑅 is deterministic in terms of 𝐷 βˆͺ 𝑆 βˆͺ π‘šπ‘—π‘œ(π‘’π‘“π‘Ÿ) 𝑓 3 ο‚΄ 𝐡𝑐𝑑𝑅 produces same histories with 𝐡𝑐𝑑𝑅 0 . ο‚΄ Example Application: Showing linearizability of Herlihy & Wing Queue 1 by finding a forward 𝑓 1 𝑓 2 simulation to 𝐡𝑐𝑑𝑅 . dequable minimal nodes :COMPLETED :PENDING 1. Herlihy, Maurice P., and Jeannette M. Wing. "Linearizability: A correctness condition for concurrent objects." ACM Transactions on Programming Languages and Systems (TOPLAS) 12.3 (1990): 463-492.

  12. The Stack Case ο‚΄ A natural conversion of 𝐡𝑐𝑑𝑅 to 𝐡𝑐𝑑𝑇 exists. Pops remove maximal elements instead of minimal elements. ο‚΄ Similar observations on implementations: linearization points of pushes are not fixed. For complicated examples, linearization points of pops are not fixed neither. But, we can determine commit points (that fixes the return value) of pops. ο‚΄ 𝐡𝑐𝑑𝑇 0 is not deterministic in terms of 𝐷 βˆͺ 𝑆 or 𝐷 βˆͺ 𝑆 βˆͺ 𝑑𝑝𝑛(π‘žπ‘π‘ž) . ο‚΄ We introduce a new 𝐡𝑐𝑑𝑇 that produces different from the dual of 𝐡𝑐𝑑𝑅 , equivalent executions with 𝐡𝑐𝑑𝑇 0 and deterministic in terms of 𝐷 βˆͺ 𝑆 βˆͺ 𝑑𝑝𝑛 π‘žπ‘π‘ž . ο‚΄ We have shown its applicability by finding a forward simulation from the complicated Time-Stamped Stack 1 implementation to 𝐡𝑐𝑑𝑇 . 1. Dodds, Mike, Andreas Haas, and Christoph M. Kirsch. "A scalable, correct time-stamped stack." ACM SIGPLAN Notices. Vol. 50. No. 1. ACM, 2015.

  13. Conclusions & Other Interests ο‚΄ Future work: Extending the idea to other data structures like sets. ο‚΄ Future work: Mechanizing the proofs on Boogie/CIVL proof system developed by Microsoft Research and Koc University. ο‚΄ Other interests: ο‚΄ Refinement proofs for weak memory models. ο‚΄ Particularly, extending the CIVL proof system for TSO memory model. ο‚΄ New proof rules for TSO. ο‚΄ Extending the concept of linearizability for WMM.

  14. Thank You ο‚΄ Any Questions?

  15. How to Prove Linearizability inv(enq,3) ret(enq) inv(enq,5) ret(enq) inv(deq) ret(deq,3) inv(enq,3) lin(enq,3) ret(enq) inv(enq,5) ret lin lin inv(deq) ret(deq,3) inv lin ret inv lin ret inv lin ret

Recommend


More recommend