rett a reasonably exceptional type theory

RETT, a Reasonably Exceptional Type Theory Pierre-Marie Pdrot 1 , - PowerPoint PPT Presentation

RETT, a Reasonably Exceptional Type Theory Pierre-Marie Pdrot 1 , Nicolas Tabareau 1 , Hans Fehrmann 2 , ric Tanter 1, 2 ICFP 2019 Pdrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 1 / 19 1 INRIA, 2


  1. RETT, a Reasonably Exceptional Type Theory Pierre-Marie Pédrot 1 , Nicolas Tabareau 1 , Hans Fehrmann 2 , Éric Tanter 1, 2 ICFP 2019 Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 1 / 19 1 INRIA, 2 University of Chile

  2. CIC, a very fancy intuitionistic logical system . CIC, a very powerful functional programming language . It’s time to CIC ass and chew bubble-gum CIC, the Calculus of Inductive Constructions. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types Finest types to describe your programs No clear phase separation between runtime and compile time The Pinnacle of the Curry-Howard correspondence Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 2 / 19

  3. CIC, a very powerful functional programming language . It’s time to CIC ass and chew bubble-gum CIC, the Calculus of Inductive Constructions. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types Finest types to describe your programs No clear phase separation between runtime and compile time The Pinnacle of the Curry-Howard correspondence Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 2 / 19 CIC, a very fancy intuitionistic logical system .

  4. It’s time to CIC ass and chew bubble-gum CIC, the Calculus of Inductive Constructions. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types Finest types to describe your programs No clear phase separation between runtime and compile time The Pinnacle of the Curry-Howard correspondence Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 2 / 19 CIC, a very fancy intuitionistic logical system . CIC, a very powerful functional programming language .

  5. It’s time to CIC ass and chew bubble-gum CIC, the Calculus of Inductive Constructions. Not just higher-order logic, not just fjrst-order logic First class notion of computation and crazy inductive types Finest types to describe your programs No clear phase separation between runtime and compile time The Pinnacle of the Curry-Howard correspondence Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 2 / 19 CIC, a very fancy intuitionistic logical system . CIC, a very powerful functional programming language .

  6. CIC, a not so great efgectful programming language ☹ The Cake is Not Not a Lie ¿ CIC, a very powerful functional programming language ? ... as long as you can live in purely functional fantasyland No native efgects (not even non-termination!) Haskell monadic style awkward with dependent types What is even the point of using Coq then? Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 3 / 19

  7. CIC, a not so great efgectful programming language ☹ The Cake is Not Not a Lie ¿ CIC, a very powerful functional programming language ? ... as long as you can live in purely functional fantasyland No native efgects (not even non-termination!) Haskell monadic style awkward with dependent types What is even the point of using Coq then? Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 3 / 19

  8. The Cake is Not Not a Lie ¿ CIC, a very powerful functional programming language ? ... as long as you can live in purely functional fantasyland No native efgects (not even non-termination!) Haskell monadic style awkward with dependent types What is even the point of using Coq then? Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 3 / 19 CIC, a not so great efgectful programming language ☹

  9. EXCEPTIONS! Tainting CIC with Impurities We have been working on extending CIC with side-efgects . To program more, but also to prove more Justifjcation via compilation (more on that soon) A lot of interesting stufg to say but time is pressing Efgect du jour We will concentrate today on only one particular, simple efgect. Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 4 / 19

  10. EXCEPTIONS! Tainting CIC with Impurities We have been working on extending CIC with side-efgects . To program more, but also to prove more Justifjcation via compilation (more on that soon) A lot of interesting stufg to say but time is pressing Efgect du jour We will concentrate today on only one particular, simple efgect. Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 4 / 19

  11. EXCEPTIONS! Tainting CIC with Impurities We have been working on extending CIC with side-efgects . To program more, but also to prove more Justifjcation via compilation (more on that soon) A lot of interesting stufg to say but time is pressing Efgect du jour We will concentrate today on only one particular, simple efgect. Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 4 / 19

  12. Tainting CIC with Impurities We have been working on extending CIC with side-efgects . To program more, but also to prove more Justifjcation via compilation (more on that soon) A lot of interesting stufg to say but time is pressing Efgect du jour We will concentrate today on only one particular, simple efgect. Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 4 / 19 EXCEPTIONS!

  13. Summary of the Previous Episodes Pédrot & Tabareau, ESOP 2018 ExTT, an extension of CIC with exceptions . Let’s have a look at ExTT! Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 5 / 19 ▷ Add a failure mechanism to CIC ▷ Fully computational call-by-name exceptions ▷ Contains the whole of CIC (including krazy dependent stufg) ▷ Compiled away to vanilla CIC (so-called syntactic model)

  14. Summary of the Previous Episodes Pédrot & Tabareau, ESOP 2018 ExTT, an extension of CIC with exceptions . Let’s have a look at ExTT! Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 5 / 19 ▷ Add a failure mechanism to CIC ▷ Fully computational call-by-name exceptions ▷ Contains the whole of CIC (including krazy dependent stufg) ▷ Compiled away to vanilla CIC (so-called syntactic model)

  15. P true P p t p f p e true P p t p f p e false P p t p f p e raise A Reasonably Exceptional Type Theory Pédrot, Tabareau, Fehrmann & Tanter p e catch p f P catch p t 21/08/2019 catch P b b P raise P false The Exceptional Type Theory: Overview catch ExTT extends CIC with an exception-raising primitive (ITT: no payload) . They can be caught on inductive types via a generalization of eliminators. raise p P b 6 / 19 rec P P true P false b : Π A : □ . A raise (Π x : A . B ) ≡ λ x : A . raise B match ( raise I ) ret P with ⃗ ≡ raise ( P ( raise I ))

  16. The Exceptional Type Theory: Overview They can be caught on inductive types via a generalization of eliminators. 21/08/2019 A Reasonably Exceptional Type Theory Pédrot, Tabareau, Fehrmann & Tanter p e p f p t ExTT extends CIC with an exception-raising primitive (ITT: no payload) . 6 / 19 p raise : Π A : □ . A raise (Π x : A . B ) ≡ λ x : A . raise B match ( raise I ) ret P with ⃗ ≡ raise ( P ( raise I )) catch B : Π P : B → □ . B rec : Π P : B → □ . P true → P true → P false → ⇝ P false → P ( raise B ) → Π b : B . P b Π b : B . P b ≡ catch B P p t p f p e true ≡ catch B P p t p f p e false catch B P p t p f p e ( raise B ) ≡

  17. Exception is the Rule While a fairly simple efgect, exceptions are already super useful! Dead code stays so. « Come on Coq, I know this branch cannot occur! » Use raise . Post-hoc reasoning. « Why do I need to thread decidable hypotheses everywhere? » Use raise . Failure as a default. « Why on earth do I have to return an option? » Use raise . Typical problems from the wild: mathcomp, hs-to-coq... Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 7 / 19

  18. Exception is the Rule While a fairly simple efgect, exceptions are already super useful! Dead code stays so. « Come on Coq, I know this branch cannot occur! » Use raise . Post-hoc reasoning. « Why do I need to thread decidable hypotheses everywhere? » Use raise . Failure as a default. « Why on earth do I have to return an option? » Use raise . Typical problems from the wild: mathcomp, hs-to-coq... Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 7 / 19

  19. Exception is the Rule While a fairly simple efgect, exceptions are already super useful! Dead code stays so. « Come on Coq, I know this branch cannot occur! » Use raise . Post-hoc reasoning. « Why do I need to thread decidable hypotheses everywhere? » Use raise . Failure as a default. « Why on earth do I have to return an option? » Use raise . Typical problems from the wild: mathcomp, hs-to-coq... Pédrot, Tabareau, Fehrmann & Tanter A Reasonably Exceptional Type Theory 21/08/2019 7 / 19

Recommend


More recommend