Alexander J Summers Department of Computing Imperial College London Natural Delimited Control A Curry-Howard Correspondence for a Canonical Classical Natural Deduction Alexander J Summers Department of Computing Imperial College London Set context of work/intro
Overview Interested in the extension of the Curry-Howard Correspondence to Classical Logics Talk roughly in three parts... 1. Brief introduction to Control Operators 2. Definition of a programming calculus based on classical natural deduction 3. How are the two related? Talk is semi-informal: focus on intuition/explanation Feel free to ask questions..
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> n*(f rest))
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l (Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) ? 3 4 1 7 9
Contexts and Continuations Control operators give control over the context in which an execution takes place term context
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole”
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●)))
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4)))
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4))) A continuation is a term representation of a context A term with a ‘hole’ for another term
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4))) A continuation is a term representation of a context A term with a ‘hole’ for another term We represent this with a binder ν over the ‘hole’
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4))) A continuation is a term representation of a context A term with a ‘hole’ for another term We represent this with a binder ν over the ‘hole’ νx.print (1 * (2 * (●)))
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4))) A continuation is a term representation of a context A term with a ‘hole’ for another term We represent this with a binder ν over the ‘hole’ νx.print (1 * (2 * (x)))
Contexts and Continuations Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context We write contexts as E{●} where ● is the “hole” E{●} = print (1 * (2 * (●))) E{3 * 4} = print (1 * (2 * (3 * 4))) A continuation is a term representation of a context A term with a ‘hole’ for another term We represent this with a binder ν over the ‘hole’ νx.print (1 * (2 * (x)))
Control Operators Programming constructs for functional languages Allow the expression of “non-functional” behaviour e.g., jumps, exceptions, loops, ... Simplest example: A (“abort”) Defined by: E{A M} → M Completely discards the surrounding context print (1 * (2 * (A (3 * 4))))
Control Operators Programming constructs for functional languages Allow the expression of “non-functional” behaviour e.g., jumps, exceptions, loops, ... Simplest example: A (“abort”) Defined by: E{A M} → M Completely discards the surrounding context print (1 * (2 * (A (3 * 4)))) → print (1 * (2 * (A 12)))
Control Operators Programming constructs for functional languages Allow the expression of “non-functional” behaviour e.g., jumps, exceptions, loops, ... Simplest example: A (“abort”) Defined by: E{A M} → M Completely discards the surrounding context print (1 * (2 * (A (3 * 4)))) → print (1 * (2 * (A 12)))
Control Operators More interesting example: C (“control”) C M gives M explicit control over the context Stores the context in an “escape procedure” E{C M} → M λx.(A E{x}) The escape procedure is passed to M If M calls procedure with argument N, resulting term A E{N} aborts current execution and restores the context E{N} In this way, M can “throw” values back to the context
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) ? 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) ? 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) ? 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then 0 else n*(f rest)) ? 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then k 0 else n*(f rest)) ? 3 4 1 7 9
Multiplying lists of numbers.. Exercise: write a recursive function / functional program to calculate the product of a list of numbers Lists are defined by: l ::= [] | n:l C λk.k(Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then k 0 else n*(f rest)) 3 4 1 7 9
Types for Control Operators What about types for these operators? e.g., abort Consider the reduction rule: E{A M} → M (A M) should have the type of the “hole” in E M can have any type? But, for the rule to be sound, M must have the type of E{A M} Griffin (‘90): introduce special type for “top-level” The type of “finished computation” - M must have it Γ ⊢ M : B (A) Γ ⊢ (A M) : C
Types for Control Operators What about types for these operators? e.g., abort Consider the reduction rule: E{A M} → M (A M) should have the type of the “hole” in E M can have any type? But, for the rule to be sound, M must have the type of E{A M} Griffin (‘90): introduce special type for “top-level” The type of “finished computation” - M must have it Now A makes logical sense in terms of types too corresponds with -elimination from intuitionistic logic Γ ⊢ M : (A) Γ ⊢ (A M) : C
Types for Control Operators What about types for these operators? e.g., abort Consider the reduction rule: E{A M} → M (A M) should have the type of the “hole” in E M can have any type? But, for the rule to be sound, M must have the type of E{A M} Griffin (‘90): introduce special type for “top-level” The type of “finished computation” - M must have it Now A makes logical sense in terms of types too corresponds with -elimination from intuitionistic logic Γ ⊢ M : (A) Γ ⊢ (A M) : C
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x})
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x})
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B A→B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B A→B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B (A→B)→ A→B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A B (A→B)→ A→B
Control Operators - types What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) Observation (Griffin): if we set B= then C can be typed as double-negation-elimination: ((A→)→)→A ≡ ¬ ¬ A→A Led to research into computational interpretations of classical logics.. including this talk! A B ((A→B)→)→A (A→B)→ A→B
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours:
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M}
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M}
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M}
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M} E{# E'{C M}} → E{# (M λx.(A E'{x}))}
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M} E{# E'{C M}} → E{# (M λx.(A E'{x}))}
Delimited Control Operators So far, control operators capture entire context A refinement to the previous ideas: delimited control “markers” # can be placed around any subterm: # M Only capture the context up to the enclosing # Refines reduction behaviours: E{# E'{A M}} → E{# M} E{# E'{C M}} → E{# (M λx.(A E'{x}))} Can express more complex/interesting behaviour Nicer semantics – compositional with E{}
Ok... now, for the logic bit. What we’re going to talk about the effect of different connectives on term calculi Write this at the end, when all other slides are done.#
Curry-Howard Correspondence Historically relates minimal logic and λ-calculus Formulas relate to types Proofs relate to terms Proof reductions relate to β reductions Logic and calculus were invented independently We can borrow the idea of the correspondence.. Existing calculus ⇒ logic-based type system Existing logic ⇒ new programming calculus Extract the ‘computational content’ of the logic What we’re going to talk about the effect of different connectives on term calculi Write this at the end, when all other slides are done.#
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it)
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it)
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) (Ax) Γ, x:A ⊢ x : A
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction Reductions? Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction A notion of proof reduction exists (Gentzen/Prawitz) Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction A notion of proof reduction exists (Gentzen/Prawitz) It gives rise to the standard rule λx.M N → M< N \ x > Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction We can regard λ-calculus as computational content of minimal natural deduction.. Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
Curry-Howard Correspondence Minimal Natural Deduction We can regard λ-calculus as computational content of minimal natural deduction.. what about classical logic? Γ, x:A ⊢ M : B (Ax) (→I) Γ, x:A ⊢ x : A Γ ⊢ λx.M : A→B Γ ⊢ M : A→B Γ ⊢ N : A (→E) Γ ⊢ (M N) : B
The λμ-calculus on one slide (almost) Presented by Parigot (1992) to tackle classical logic Many variants since - we present slight refinement Syntax extends λ-calculus: new class of (Greek) variables α... M, N ::= x | λx.M | (M N)
The λμ-calculus on one slide (almost) Presented by Parigot (1992) to tackle classical logic Many variants since - we present slight refinement Syntax extends λ-calculus: new class of (Greek) variables α... M, N ::= x | λx.M | (M N) | μα.M | [α]N
The λμ-calculus on one slide (almost) Presented by Parigot (1992) to tackle classical logic Many variants since - we present slight refinement Syntax extends λ-calculus: new class of (Greek) variables α... M, N ::= x | λx.M | (M N) | μα.M | [α]N
The λμ-calculus on one slide (almost) Presented by Parigot (1992) to tackle classical logic Many variants since - we present slight refinement Syntax extends λ-calculus: new class of (Greek) variables α... M, N ::= x | λx.M | (M N) | μα.M | [α]N Types for the calculus are expressed using judgements of the form: Γ ⊢ M : A | Δ Δ provides type assumptions for Greek variables The underlying logic doesn’t look much like classical natural deduction...
Extending λμ-calculus Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have multiple conclusions Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have multiple conclusions Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have multiple conclusions Parigot: derivations can be transformed Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have multiple conclusions Parigot: derivations can be transformed Γ, x:A ⊢ x : A | Δ Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have single conclusions Parigot: derivations can be transformed Γ, ¬Δ, x:A ⊢ x : A Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Judgements have single conclusions Γ, ¬Δ, x:A ⊢ x : A Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Γ, ¬Δ, x:A ⊢ x : A Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Γ, ¬Δ, x:A ⊢ x : A Γ, x:A ⊢ M : B | Δ Γ ⊢ N : A | Δ Γ ⊢ λx.M : A→B | Δ Γ ⊢ [α]N : | α:A, Δ Γ ⊢ M : A→B | Δ Γ ⊢ N : A | Δ Γ ⊢ M : | α:A, Δ Γ ⊢ (M N) : B | Δ Γ ⊢ μα.M : A | Δ
Extending λμ-calculus Γ, ¬Δ, x:A ⊢ x : A Γ, ¬Δ, x:A ⊢ M : B Γ, ¬Δ ⊢ N : A Γ, ¬Δ ⊢ λx.M : A→B Γ, ¬Δ, α: ¬A ⊢ [α]N : Γ, ¬Δ ⊢ M : A→B Γ, ¬Δ ⊢ N : A Γ, ¬Δ, α: ¬A ⊢ M : Γ, ¬Δ ⊢ (M N) : B Γ, ¬Δ ⊢ μα.M : A
Extending λμ-calculus Γ, ¬Δ, x:A ⊢ x : A Γ, ¬Δ, x:A ⊢ M : B Γ, ¬Δ ⊢ N : A Γ, ¬Δ ⊢ λx.M : A→B Γ, ¬Δ, α: ¬A ⊢ [α]N : Γ, ¬Δ ⊢ M : A→B Γ, ¬Δ ⊢ N : A Γ, ¬Δ, α: ¬A ⊢ M : Γ, ¬Δ ⊢ (M N) : B Γ, ¬Δ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Γ, ¬Δ, x:A ⊢ x : A Γ, ¬Δ, x:A ⊢ M : B Γ, ¬Δ ⊢ N : A Γ, ¬Δ ⊢ λx.M : A→B Γ, ¬Δ, α: ¬A ⊢ [α]N : Γ, ¬Δ ⊢ M : A→B Γ, ¬Δ ⊢ N : A Γ, ¬Δ, α: ¬A ⊢ M : Γ, ¬Δ ⊢ (M N) : B Γ, ¬Δ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, ¬Δ, x:A ⊢ x : A Γ, ¬Δ, x:A ⊢ M : B Γ, ¬Δ ⊢ N : A Γ, ¬Δ ⊢ λx.M : A→B Γ, ¬Δ, α: ¬A ⊢ [α]N : Γ, ¬Δ ⊢ M : A→B Γ, ¬Δ ⊢ N : A Γ, ¬Δ, α: ¬A ⊢ M : Γ, ¬Δ ⊢ (M N) : B Γ, ¬Δ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, ¬Δ, x:A ⊢ x : A Γ, ¬Δ, x:A ⊢ M : B Γ, ¬Δ ⊢ N : A Γ, ¬Δ ⊢ λx.M : A→B Γ, ¬Δ, α: ¬A ⊢ [α]N : Γ, ¬Δ ⊢ M : A→B Γ, ¬Δ ⊢ N : A Γ, ¬Δ, α: ¬A ⊢ M : Γ, ¬Δ ⊢ (M N) : B Γ, ¬Δ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, α: ¬A ⊢ [α]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, α: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, α: ¬A ⊢ [α]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, α: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, α: ¬A ⊢ [α]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, α: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μα.M : A
Extending λμ-calculus Greek ‘special’ assumptions are restricted Idea: merge the two alphabets Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus All assumptions have equal status Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A (→I) Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A (→I) ? Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ N : A (→I) Γ ⊢ λx.M : A→B Γ, x: ¬A ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ x : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) First premise must be an axiom (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ x : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) First premise must be an axiom (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ x : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [x]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) First premise must be an axiom (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ x : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [ x ]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) First premise must be an axiom (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ x : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [ x ]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Special case of (¬E) First premise can be any proof (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus The rule (¬I) is entirely missing (Ax) Γ, x:A ⊢ x : A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Classical Natural Deduction Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Classical Natural Deduction Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Extending λμ-calculus Classical Natural Deduction Γ, x:A ⊢ M : (Ax) (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
The νλμ-calculus Γ, x:A ⊢ M : Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
The νλμ-calculus The νλμ-calculus Γ, x:A ⊢ M : Γ, x:A ⊢ x : A (¬I) Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Important features The νλμ-calculus Γ, x:A ⊢ M : Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Important features The νλμ-calculus Γ, x:A ⊢ M : Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Important features The νλμ-calculus Γ, x:A ⊢ M : Γ, x:A ⊢ x : A Γ ⊢ νx.M : ¬A Γ, x:A ⊢ M : B Γ ⊢ M : ¬A Γ ⊢ N : A (→I) (¬E) Γ ⊢ λx.M : A→B Γ ⊢ [M]N : Γ ⊢ M : A→B Γ ⊢ N : A Γ, x: ¬A ⊢ M : (→E) (PC) Γ ⊢ (M N) : B Γ ⊢ μx.M : A
Important features νx.M ¬A [M]N μx.M
Important features νx.M ¬A [M]N μx.M
Important features νx.M ¬A [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features ¬A νx.M [M]N μx.M
Important features - type of “finished programs” – essentially no output value ¬A - negated type for continuation with input of type A νx.M - terms to explicitly represent continuations terms which consume an input and produce -type [M]N - continuation application Pass the argument N to the continuation M μx.M - control operator Capture the surrounding ‘context’ and bind it to x What about reductions? Many alternative ideas exist, particularly for the μ-bound terms Identify a common theme, and generalise the existing work ¬A νx.M [M]N μx.M
Reductions… λx.M N → M< N \ x > [νx.M]N → M< N \ x > Two “non-classical” reduction rules arise naturally: λx.M N → M< N \ x > [νx.M]N → M< N \ x > These are the same rules one would use if basing a calculus on minimal logic So far, nothing to distinguish functions and continuations - “might as well” define ¬A as A→ ? However, once we add reductions related to terms μx.M then we can see a difference..
μ-reductions As with any binder, consider how μ can be eliminated
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC)
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC)
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC)
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC)
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) on μx.M : A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A μx.M
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A μx.M : A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A z : A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
μ-reductions As with any binder, consider how μ can be eliminated Recall the typing rule: Find a continuation of type ¬A Substitute the term for x Term of type ¬A is a continuation with a ‘hole’ of type A Any context around μx.M must have a ‘hole’ of type A Γ, x: ¬A ⊢ M : (PC) Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
μ-reductions Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
μ-reductions Γ, x: ¬A ⊢ M : (PC) νz. E{ } Γ ⊢ μx.M : A z : A : ¬A
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term Γ, x: ¬A ⊢ M : (PC) νz. E{ } : ¬A Γ ⊢ μx.M : A z : A
μ-reductions Γ, z:A ⊢ E{z} : Γ ⊢ νz.E{z} : ¬A Consider typing the term Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
μ-reductions Γ, z:A ⊢ E{z} : Γ ⊢ νz.E{z} : ¬A Consider typing the term This only “works” if E{z} has type What if we have a context with a different type? What if we want a compatible reduction rule? i.e., can enlarge the context, preserving reductions consuming the “whole” context at once is not wise! Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
μ-reductions We tackle these problems by defining local rules for gradually moving μ-bindings outwards e.g., Γ ⊢ (μx.M N) : B
μ-reductions We tackle these problems by defining local rules for gradually moving μ-bindings outwards e.g., Γ ⊢ (μx.M N) : B
μ-reductions Γ ⊢ (μx.M N) : B
μ-reductions Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
μ-reductions N Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
μ-reductions N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B Γ ⊢ ? : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M has the right type.. Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M has the right type.. Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B M requires x:¬(A→B)
M requires x:¬(A→B) .. we have y: ¬B and N : A available μ-reductions M N Γ, x: ¬(A→B) ⊢ M : (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M has the right type.. Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B M requires x:¬(A→B) .. we have y: ¬B and N : A available
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M has the right type.. Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B M requires x:¬(A→B) .. we have y: ¬B and N : A available From ¬B and A we can prove ¬(A→B)
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M has the right type.. Substitute the corresponding term for x in M Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B M requires x:¬(A→B) .. we have y: ¬B and N : A available From ¬B and A we can prove ¬(A→B)
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B Substitute the corresponding term for x in M M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : Γ, y: ¬B ⊢ ? : (PC) Γ ⊢ μy.? : B
Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : μ-reductions M N Γ, x: ¬(A→B) ⊢ M : (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : (PC) Γ ⊢ μy.? : B
Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : μ-reductions M N Γ, x: ¬(A→B) ⊢ M : (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : (PC) Γ ⊢ μy.? : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : (PC) Γ ⊢ μy.M< νz.[y](z N) / x > : B
μ-reductions M N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : (PC) Γ ⊢ μy.M< νz.[y](z N) / x > : B
μ-reductions M Reduction rule: μx.M N → μy.M< νz.[y](z N) / x > Γ, x: ¬(A→B) ⊢ M : (PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B M* Γ, y: ¬B ⊢ M< νz.[y](z N) / x > : (PC) Γ ⊢ μy.M< νz.[y](z N) / x > : B
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x >
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x > μ-binders work outwards through function applications
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x > μ-binders work outwards through function applications When a continuation application is reached, they stop
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x > μ-binders work outwards through function applications When a continuation application is reached, they stop Let Ec be a context consisting of any number of function applications, enclosed by a continuation application
μ-reduction rules By this process, we derive the following rules μx.M N → μy.M< νz.[y](z N) / x > N μx.M → μy.M< νz.[y](N z) / x > [μx.M]N → M< νz.[z]N / x > [N]μx.M → M< νz.[N]z / x > μ-binders work outwards through function applications When a continuation application is reached, they stop Let Ec be a context consisting of any number of function applications, enclosed by a continuation application Then Ec{μx.M} → M< νz.Ec{z} / x >
μ-reduction rules The n: Ec{μx.M} → M< νz.Ec{z} / x > Furthermore, if enclosed in further context E E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} The μ-binding captures the surrounding context up to the nearest enclosing continuation application That is, it behaves like a delimited control operator! The special kind of application [M]N provides an implicit delimiter for the control behaviour Now, we can explain the advantage of explicit negation Replacing ¬A with A→ amounts to replacing [M]N with (M N), i.e., removing the delimiter in the term
Back to the control operators… E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} How can we represent existing control operators? Recall ‘abort’ A was typed as: i.e., -elimination Logically, we express -elimination by (PC) Equivalent if x doesn’t occur in M Now consider the computational behaviour: if x doesn’t occur in M, E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} Γ ⊢ M : (A) Γ ⊢ (A M) : C Γ, x: ¬C ⊢ M : (PC) Γ ⊢ μx.M : C
Back to the control operators… E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} How can we represent existing control operators? Recall ‘abort’ A was typed as: i.e., -elimination Logically, we express -elimination by (PC) Equivalent if x doesn’t occur in M Now consider the computational behaviour: if x doesn’t occur in M, E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} = E{M} Γ ⊢ M : (A) Γ ⊢ (A M) : C Γ, x: ¬C ⊢ M : (PC) Γ ⊢ μx.M : C
Back to the control operators… E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} How can we represent existing control operators? Recall ‘abort’ A was typed as: i.e., -elimination Logically, we express -elimination by (PC) Equivalent if x doesn’t occur in M Now consider the computational behaviour: if x doesn’t occur in M, E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} = E{M} This is exactly the behaviour of (delimited) ‘abort’! Γ ⊢ M : (A) Γ ⊢ (A M) : C Γ, x: ¬C ⊢ M : (PC) Γ ⊢ μx.M : C
Back to the control operators… E{Ec{μx.M}} → E{M< νz.Ec{z} / x >} ‘control’ C was typed with ((A→B)→)→A This is a classically-valid formula : write the simplest possible proof of it in classical natural deduction Extract the corresponding νλμ-term: λx.μy.(x λz.μw.[y]z) : ((A→B)→)→A Now consider the computational behaviour: E{Ec{λx.μy.(x λz.μw.[y]z) M}} → E{Ec{μy.(M λz.μw.[y]z)}} → E{(M λz.μw.Ec{z})} This is the behaviour of the delimited version of C
Summary - things we can do νλμ-calculus has Curry-Howard-style correspondence with classical natural deduction Naturally expresses delimited control operators First Curry-Howard calculus to do so It can also simulate many similar calculi λ-calculus, λμ (and variants), symmetric λ-calculus, etc.. Reductions expressive from logical perspective Can encode sequent proofs as natural deduction proofs and simulate cut elimination with our proof reductions First encoding of classical cut elimination in natural deduction paradigm (?)
Future Work - things I can’t do (yet) Strong Normalisation Property: Typeable terms only have terminating reductions Existing techniques seem not to apply Reducibility candidates? Generalised by Barbanera&Berardi Generalised further by Urban Do not seem to work with as a proper type Encodings into other strongly normalising calculi? General reductions in νλμ make this hard No known encoding into another calculus Any ideas?
Future Work - things I can’t do (yet) Strong Normalisation Property: Typeable terms only have terminating reductions Existing techniques seem not to apply Reducibility candidates? Generalised by Barbanera&Berardi Generalised further by Urban Do not seem to work with as a proper type Encodings into other strongly normalising calculi? General reductions in νλμ make this hard No known encoding into another calculus Any ideas?
In conclusion.. λx.μk.[k]((Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then μj.[k]0 else n*(f rest)) x)
In conclusion.. λx.μk.[k]((Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then μj.[k]0 else n*(f rest)) x)
Thank you for listening! In conclusion.. λx.μk.[k]((Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then μj.[k]0 else n*(f rest)) x) Thank you for listening!
Thank you for listening! In conclusion.. λx.μk.[k]((Fix f. λy.match y with [] --> 1 n:rest --> if n=0 then μj.[k]0 else n*(f rest)) x) For more details (and proper references), please see my PhD thesis (Ch. 5 & 6) Available from http://www.doc.ic.ac.uk/~ajs300 or Google for “Alex Summers” Thank you for listening!