1 / 45

Logical Properties of CPS Transforms

Logical Properties of CPS Transforms. Deepak Garg Fall, 2004. Introduction. CPS = Continuation Passing Style Studied to simulate cbv with cbn We look at CPS transforms as proof-transformations CPS transforms embed classical logic into intuitionistic logic. Simply Typed  -calculus.

milt
Download Presentation

Logical Properties of CPS Transforms

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. Logical Properties of CPS Transforms Deepak Garg Fall, 2004

  2. Introduction • CPS = Continuation Passing Style • Studied to simulate cbv with cbn • We look at CPS transforms as proof-transformations • CPS transforms embed classical logic into intuitionistic logic

  3. Simply Typed -calculus • Terms: • Types (Logical Propositions):

  4. Evaluation and Typing Rules • Standard Typing Rules • Small step, call by value evaluation

  5. Abort (A) Operator

  6. What we have so far … • We have INTUITIONISTIC logic with ?

  7. Control (C) Operator

  8. What we have now … • We have CLASSICAL logic! • Why? Rule of double negation elimination.

  9. -calculus + A + C $ Classical logic Summary -calculus + A $ Intuitionistic logic with ?

  10. CPS Transforms

  11. CPS Transform: History • [1975] Plotkin. CPS studied formally. • [1986] Felleisen et al. Extended to control operators (call/cc, C and A). • [1993] Griffin. Typed CPS transforms. • [2003] Wadler. Duality with CPS transforms.

  12. CPS Transform: Properties • Translate terms, types and proofs • On terms: • No control (C) operator in transformed terms • On types: • No double negation elimination in transformed proofs • Translates classical into intuitionistic logic!

  13. CPS: Term Translation • -calculus • CPS translation • Each translated term expects a continuation

  14. CPS: Operational Interpretation • Explicitly formalize evaluation in terms of continuations To evaluate (M N) in the continuation k, evaluate M in the continuation that binds its input to m and evaluates N in the continuation that binds its input to n and evaluates (m n) in the continuation k.

  15. CPS: Type Translation • Translation for types: • Types:

  16. CPS: Logical Interpretation

  17. CPS: A-Operator • k is thrown away like E[ ]

  18. Soundness: A-Operator

  19. CPS: C-Operator • d is thrown away like E’[ ].

  20. Soundness: C-Operator

  21. CPS: Logical Interpretation

  22. Summary of CPS

  23. CPS as an Embedding

  24. CPS as an Embedding

  25. CPS as an Embedding

  26. CPS as an Embedding Two more theorems (unrelated to proof-terms):

  27. Doing it all in Twelf

  28. Representing Terms • Use HOAS

  29. Classical and Intuitionistic Terms • The previous definition is not enough. • We have to distinguish classical and intuitionistic logic • Introduce two types of terms: • Classical: termc • Intuitionistic: termi

  30. Classical and Intuitionistic Terms

  31. Representing the CPS Transform • Terms represented with HOAS • No direct representation for variables • How do we represent the following? • Create a judgment:

  32. More Trouble …

  33. The solution • We make the translation a hypothetical judgment • Recall: • We get:

  34. The solution

  35. Soundness Theorem

  36. Input Coverage Problem: Problems: Soundness Theorem

  37. Problem: Soundness Theorem Output External From worlds (soundnessblock) Make this an output? Can’t be changed (Needed for Induction)

  38. Soundness Theorem Solution • New Theorem:

  39. Soundness Theorem? • What have we shown? • What we need …

  40. Soundness Theorem? • Are these theorems the same? • To us they are • Why? • We know that given A, there is exactly one A’ such that A* = A’. • We never told Twelf this fact • So, in Twelf these are different theorems!

  41. Telling Twelf about Uniqueness • Can we tell Twelf that A* is unique? • Not directly! There is no uniqueness check • We can make an equality judgment

  42. Telling Twelf about Uniqueness • Now we prove a theorem

  43. A Typing-soundness Theorem • We also need the following theorem

  44. True Soundness • Using all our previous theorems, we can now prove the soundness with correct modes.

  45. Extensions • Can be extended to include conjunction and disjunction. • We can also use a call-by-name transform • Gives a translation from classical to minimal logic • Very similar to Kolmogrov’s double negation translation

More Related