
Minimal Classical Logic and Control Operators Zena M. Ariola Hugo Herbelin University of Oregon INRIA-Futurs USA France ICALP - 3 July 2003 Outline Introduction • { Minimal, Intuitionistic and Classical Logic { λ-calculus control operators Minimal Classical Logic • Computational interpretation of A • ?! A new variant of Felleisen λ calculus • C Minimal Logic and λ-calculus A ::= X A A j ! t; u ::= x λx.t tu j j Γ; x : A x : A ` Γ; x : A t : B Γ t : A B Γ u : A ` Γ λx.t : A B ` Γ ! tu : B ` ` ! ` Control Operators (callcc): λx. (λk:1 + (if x = 0 then k2 else 3)) + 8 • K K Name k is bound to the continuation which adds 8: acc := 1 + if x=0 then {acc:=2;goto k} else 3 label k : acc := acc+8 return acc returns 2 + 8 if x = 0 and (1 + 3) + 8 otherwise : λx. (λk:1 + (if x = 0 then k2 else 3)) + 8 • C C Additional \ bort" to \toplevel" in case of non exceptional result A acc := 1 + if x=0 then {acc:=2;goto k} else 3 goto top label k : acc := acc+8 label top: return acc returns 2 + 8 if x = 0 and 1 + 3 otherwise Intuitionistic - Classical Logic and Control Operators (Griffin '90) Intuitionistic: Minimal Logic + Ex Falso Quodlibet ( A) • ?! Γ t : Γ ` bort? (t) : A ` A Classical: Intuitionistic + Double Negation ( A A) • :: ! Γ t : A Γ ` (t::) : A ` C Logic and Computation Equivalent formulations of Classical Logic in Intuitionistic Logic • Excluded Middle A A _: Pierce law ((A B) A) A ! ! ! Double negation A A :: ! Felleisen: is more expressive than ( can't be defined from • C K C ) K (λk:M) = (λk:kM) K C (λk:M) = (λk: bort(M)) C K A Are those axioms really equivalent? = We study them in the context of Minimal Logic ) A A :: ! + 6* ((A B) A) A ! ! ! + 6* A A _: = Minimal Classical Logic ) Minimal Classical Logic Minimal Classical Logic: • Minimal Logic + Pierce law λ-calculus + (callcc) K Classical Logic: • = A A Minimal Logic + Peircez law:: +}| ! ( A){ ?! λ-calculus + + bort K| A{z } = C Minimal Classical Natural Deduction and Parigot λµ-calculus 8 > > Γ A; ∆ t; u ::= x λx.t tu µα.c (terms) > Sequents: <> ` j j j > > Γ ; ∆ c ::= [α]t (commands) > :> ` Γ; x : A x : A; ∆ `MC Γ; x : A t : B; ∆ Γ t : A B; ∆ Γ u : A; ∆ `MC `MC ! `MC Γ λx.t : A B; ∆ Γ tu : B; ∆ `MC ! `MC c : (Γ ; Aα; ∆) Γ t : A; Aα; ∆ `MC Activate `MC Passivate Γ µα.c : A; ∆ [α]t : (Γ ; A; ∆) `MC `MC Properties of Minimal Classical Natural Deduction Prop: Γ A iff Γ;PL A `MC ` Prop: there is no t of type A A :: ! But we can derive λy.µα.[γ](y λx.µδ:[α]x) : A A; γ `MC :: ! ? where a free continuation variable γ of type is needed. ? Possible solution (Parigot, de Groote, Ong) : hide the variables of type in the typing system. ? Our interpretation: this free variable denotes abortion to the \toplevel". Classical Natural Deduction and Parigot λµ-top-calculus Γ; x : A x : A; ∆ `C Γ; x : A t : B; ∆ Γ t : A B; ∆ Γ u : A; ∆ `C `C ! `C Γ λx.t : A B; ∆ Γ tu : B; ∆ `C ! `C c : (Γ ; Aα; ∆) Γ t : A; Aα; ∆ `C Activate `C Passivate Γ µα.c : A; ∆ [α]t : (Γ ; A; ∆) `C `C Γ t : ; ∆ `C ? [top]t : (Γ ; ∆) `MC bort, , and the toplevel A ? Our analysis puts in the light the existence of an implicit continuation variable of type ? its logical interpretation is the false formula • its computational interpretation is the type of the toplevel • It allows to precisely decompose Felleisen's bort operator as a \throw" to the toplevel: A bort = λx.µd.[top]x : A for d fresh A ?! It pushes also to identify the logical formula with the toplevel type of a program (as done by Griffin). This conforms with the standard A-translation? trick where is precisely replaced by the top statement of a proof. ? From λµ-calculus to a variant of λ -calculus C Parigot λµ-calculus: not needed to express minimal classical logic • ? interpreted as an abstract type (which may be empty like in the standard logical interpreta- • tion,? or inhabited as is the toplevel type in the standard computational interpretation). One-conclusion classical logic needs another kind of to mimic the role of multiple conclusions. Let's call it c. This leads to a refinement of classical? logic obtained by constraining the axiom ? scheme A A to be of the form c cA A. :: ! : : ! The formal formula c is naturally interpreted as an empty type. ? Prawitz Natural Deduction revisited (an introduction to λ- -top calculus) C− Γ; x : A x : A `RAA Γ; x : A RAA t : B Γ t : A B Γ u : A ` `RAA ! `RAA Γ λx.t : A B Γ tu : B `RAA ! `RAA c c Γ; k : cA RAA c : Γ RAA t : : ` ? RAAc ` ? RAAc0 Γ (λk:c) : A Γ (λd.c) : A `RAA C− `RAA C− Γ t : ` RAA ? Γ top t : c ` RAA ? The λ- -top calculus C− t; u ::= x λx.t tu (λk:c) j j j C− c ::= kt top t j Felleisen's operators in λ- -top calculus C− = λx. (λk:k(xk)) K C− = λx. (λk:top (xk)) C C− bort = λx. (λk:top x) A C− Call-by-value reduction in λ- and λ- -top calculi C− C− (v ::= x λx.t) j β : (λx.t)v t[x := v] ! : (λk:kt) t k FV (t) Celim− C− ! 62 : (λk:t)u (λk:t[k (wu)=k w]) CL− C− ! C− : v (λk:t) (λk:t[k (vw)=k w]) CR− C− ! C− : (λk:k (λq:u)) (λk:u[k =q]) Cidem− C− 0C− ! C− 0 Prop: The reduction rules are typable and enjoy subject reduction. They are confluent. Similarly for call-by-name..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-