1 / 15

Towards a General Theory of Local Actions

Towards a General Theory of Local Actions. Hongseok Yang Seoul National University Peter O’Hearn Queen Mary, University of London. Programming Language Semantics.

gail
Télécharger la présentation

Towards a General Theory of Local Actions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Towards a General Theory of Local Actions Hongseok Yang Seoul National University Peter O’Hearn Queen Mary, University of London

  2. Programming Language Semantics “Semantics is a strange kind of applied mathematics; it seeks profound definitions rather than difficult theorems. The mathematical concepts which are relevant are immediately relevant. Without any long chains of reasoning, the application of such concepts directly reveals regularity in linguistic behavior, and strengthens and objectifies our intuitions of simplicity and uniformity.” John C. Reynolds (1980)

  3. Modeling Locality • Two extreme views on commands: • Comm = States !p States • Comm = language-definable fns on States • Both definitions are bad; they do not reveal any regularity of programs. • In this talk, we define a semantics of Comm that models how commands use memory resources. • The execution of a command depends on what it accesses. • For each execution of a command, we can identify which locations are accessed. • The goal of this talk is to experience what it is like to do a research on semantics.

  4. Overview • Partial Commutative Monoid • Safety Monotonicity • Frame Property • Miminum Resource Property • Finite Resource Property • Conclusion

  5. Partial Commutative Monoid (PCM) • (M, *, e) is a PCM iff * is a partial binary operator on M such that • * is commutative: m*n = n*m; • * is associative: m*(n*p) = (m*n)*p; • e is the unit of *: m*e = e*m = m. • Intuition: • Each m in M denotes a resource. • * combines two compatible resources. • e means the empty resource. • States = (Nat!pNat,],{}) is a PCM.

  6. Deterministic Action • A deterministic action t on (M,*,e) is a partial function from M to M. • The undefinedness of t indicates the “resource-shortage” error. • t(m) is not defined iff t(m) needs an unavailable resource during the execution. • (m,t) is called safe iff t(m) is defined. • Examples: • set10at2 = m. if (22dom(m)) (m[2!10]) undef • only2 = lm. if ({2}=dom(m)) m undef • have2or3 = lm. if (22dom(m) or 32dom(m)) m undef • reset = m. l. if (l2dom(m)) 0 undefNat • haveAllOdd = lm. if (OddNum µ dom(m)) m undef

  7. Feasibility Question • Which of the following cannot be implemented? Why not? • set10at2 = m. if (22dom(m)) (m[2!10]) undef • only2 = lm. if ({2}=dom(m)) m undef • check2or3 = lm. if (22dom(m) or 32dom(m)) m undef • reset = m. l. if (l2dom(m)) 0 undefNat • haveAllOdd = lm. if (oddNumµdom(m)) m undef

  8. Safety Monotonicity • Safety monotonicity: if (m,t) is safe and m#n, then (m*n,t) is also safe. • Intuition: If m has already all the resources that t accesses, the so does m*n. • Quiz: Which of the following violates this condition? (1) set10at2 (2) only2 (3) have2or3 (4) reset (5) haveAllOdd

  9. Frame Property • Frame property: if (m,t) is safe and m#n, then t(m)*n = t(m*n). • Intuition: The behavior of t is determined by what t accesses. • Quiz: Which of the following does not satisfy frame property? (1) set10at2 (2)check2or3 (3)reset (4)haveAllOdd

  10. Minimum Resource Property • Resource order: m v n iff there is some m’ such that m*m’ = n. • Minimum resource property: if (m,t) is safe, then there exists m0 such that • (m0,t) is safe, and m0vm; and • if (m1,t) is safe, and m1vm, then m0vm1. • Quiz: What does MRP mean? • Quiz: Which of the following violates the minimum resource property? (1) set2at10 (2) check2or3 (3) haveAllOdd

  11. Finite Element • A resource m is finite iff for all chains {mi}i in M with resource order, if t{mi}i exists and t{mi}iwm, then there exists some mi such that miwm. • Quiz: Which elements in States are finite?

  12. Finite Resource Property • Finite resource property: if (m,t) is safe, then there exists m0 such that • m0 is finite; • (m0,t) is safe; and • m0vm. • Quiz: What violates the finite resource property? (1) set2at10 (2) haveAllOdd

  13. Semantics of Comm Comm = {t:States!pStates | t satisfies safety monotonicity, frame property, minimum resource property, finite resource property } • THEOREM: All the language-definable commands satisfy all four locality conditions, so that they are in Comm.

  14. Frame Rule • THEOREM: A deterministic action t satisfies the frame rule iff it satisfies the frame property and the safety monotonicity. • The frame rule is not sound for reset and only2. {11}reset{10} {(11)*(21)}reset{(10)*(21)} {2 -}only2{true} {(2-)*(3-)}only2{true*(3-)}

  15. Conclusion • We defined locality conditions that describe how language-definable functions use resources. • This new resource-oriented view on functions is crucial to have the frame rule, and its higher-order extensions. • Current research issues: • How to handle higher-order functions? • Can we explain locality conditions with existing notions in the domain theory? • Can we solve recursive “domain” equations that involve the “local” function space?

More Related