. . . . . . . . . . . . . . . An Efgectful Way to Eliminate Addiction to Dependence Pierre-Marie Pédrot 1 Nicolas Tabareau 2 EUTYPES / SSTT 31th January 2017 Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . 1 / 27 1 University of Ljubljana, 2 INRIA
. . . . . . . . . . . . . . The Most Important Issue of Them All Let's start this talk by a fundamental fmaw of type theory. Assume you want to show the wonders of Coq to a fellow programmer You fjre your favourite IDE ... and you're asked the dreadful question. Could you write a Hello World program please? Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . 2 / 27
. . . . . . . . . . . . . . The Most Important Issue of Them All Let's start this talk by a fundamental fmaw of type theory. Assume you want to show the wonders of Coq to a fellow programmer You fjre your favourite IDE ... and you're asked the dreadful question. Could you write a Hello World program please? Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . 2 / 27
. . . . . . . . . . . . . . The Most Important Issue of Them All Let's start this talk by a fundamental fmaw of type theory. Assume you want to show the wonders of Coq to a fellow programmer You fjre your favourite IDE ... and you're asked the dreadful question. Could you write a Hello World program please? Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . 2 / 27
. . . . . . . . . . . . A Well-known Limitation . This is pretty much standard. By proof-as-program correspondence, which means no efgects in TT, amongst which: no exceptions no state no non-termination no printing ... and thus no Hello World! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 / 27 Intuitionistic Logic ⇔ Functional Programming
. . . . . . . . . . . . A Well-known Limitation . This is pretty much standard. By proof-as-program correspondence, which means no efgects in TT, amongst which: no exceptions no state no non-termination no printing ... and thus no Hello World! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 / 27 Intuitionistic Logic ⇔ Functional Programming
. . . . . . . . . . . . A Well-known Limitation . This is pretty much standard. By proof-as-program correspondence, which means no efgects in TT, amongst which: no exceptions no state no non-termination no printing ... and thus no Hello World! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 / 27 Intuitionistic Logic ⇔ Functional Programming
. . . . . . . . . . . . . . On Burritos In less expressive settings, a few workarounds are known. Typically, on the programming side, use the monadic style. A few equations Interpret mechanically efgectful programs using this (see Moggi). This is pervasive in e.g. Haskell. Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . 4 / 27 A type T : □ → □ A combinator return : α → T α A combinator bind : T α → ( α → T β ) → T β
. . . . . . . . . . . . . . On Burritos In less expressive settings, a few workarounds are known. Typically, on the programming side, use the monadic style. A few equations Interpret mechanically efgectful programs using this (see Moggi). This is pervasive in e.g. Haskell. Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . 4 / 27 A type T : □ → □ A combinator return : α → T α A combinator bind : T α → ( α → T β ) → T β
. Efgects are known to implement non-intuitionistic axioms! . . . . . . . . . Less is More On the logic side, take the issue the other way around. callcc . classical logic (Griffjn '90) exceptions Markov's rule (Friedman's trick) global monotonous cell CH (forcing) delimited continuations double negation shift … Achieve this using logical translations, e.g. double-negation. Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 / 27
. . . . . . . . . . . . . . . Less is More On the logic side, take the issue the other way around. Efgects are known to implement non-intuitionistic axioms! … Achieve this using logical translations, e.g. double-negation. Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . 5 / 27 callcc ∼ classical logic (Griffjn '90) exceptions ∼ Markov's rule (Friedman's trick) global monotonous cell ∼ ¬ CH (forcing) delimited continuations ∼ double negation shift
3 To write Hello World. . . . . . . . . . . . . . . . . Alternative Facts We want a type theory with efgects! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . 6 / 27 1 To program more (exceptions, non-termination...) 2 To prove more (classical logic, univalence...)
. . . . . . . . . . . . . . . . Alternative Facts We want a type theory with efgects! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . 6 / 27 1 To program more (exceptions, non-termination...) 2 To prove more (classical logic, univalence...) 3 To write Hello World.
. T . . . . . . The Expressivity Wall Problem is: Programming and logical techniques do not scale to type theory. Monads do not aknowledge dependence bind T T dbind . x T x T x T They don't aknowledge types-as-terms either And they don't preserve the computational rules of TT On the other hand: Herbelin showed that CIC + callcc is unsound! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 / 27
. . . . . . . . . . . . The Expressivity Wall . Problem is: Programming and logical techniques do not scale to type theory. Monads do not aknowledge dependence They don't aknowledge types-as-terms either And they don't preserve the computational rules of TT On the other hand: Herbelin showed that CIC + callcc is unsound! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 / 27 bind : T α → ( α → T β ) → T β dbind : Πˆ x : T α. (Π x : α. T ( β x )) → T ( β ?)
. . . . . . . . . . . . The Expressivity Wall . Problem is: Programming and logical techniques do not scale to type theory. Monads do not aknowledge dependence They don't aknowledge types-as-terms either And they don't preserve the computational rules of TT On the other hand: Herbelin showed that CIC + callcc is unsound! Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 / 27 bind : T α → ( α → T β ) → T β dbind : Πˆ x : T α. (Π x : α. T ( β x )) → T ( β ?)
2 Implementing them thanks to program translations 3 Introducing a generic notion of efgectful dependent type theory . In This Talk . . . . . . . . . . writer, exceptions, non-termination, non-determinism... reader (already done previously with the forcing translation ) . All with the new weaning translation ! No crazy category theory models! So-called syntactic models . Compile them on-the-fmy into vanilla type theory! A simple, sensible restriction of dependent elimination Seemingly compatible with all known efgects Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 / 27 1 Adding a vast range of efgects to (almost) full TT
3 Introducing a generic notion of efgectful dependent type theory . In This Talk . . . . . . . . . . reader (already done previously with the forcing translation ) . writer, exceptions, non-termination, non-determinism... All with the new weaning translation ! No crazy category theory models! So-called syntactic models . Compile them on-the-fmy into vanilla type theory! A simple, sensible restriction of dependent elimination Seemingly compatible with all known efgects Pédrot & al. (U. Ljubljana & INRIA) An Efgectful Way 31/01/2017 . . . . . . . . . . . . . . . 8 / 27 . . . . . . . . . . . . . 1 Adding a vast range of efgects to (almost) full TT 2 Implementing them thanks to program translations
Recommend
More recommend