Κατέβασμα παρουσίασης
Η παρουσίαση φορτώνεται. Παρακαλείστε να περιμένετε
ΔημοσίευσεGwendoline Johnston Τροποποιήθηκε πριν 6 χρόνια
1
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
2
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..
3
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))
4
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
5
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
6
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
7
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
8
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
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
10
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
11
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
12
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
13
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
14
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
15
Contexts and Continuations
Control operators give control over the context in which an execution takes place term context
16
Contexts and Continuations
Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
17
Contexts and Continuations
Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
18
Contexts and Continuations
Control operators give control over the context in which an execution takes place print (1 * (2 * (3 * 4))) term context
19
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”
20
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 * (●)))
21
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)))
22
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
23
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’
24
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 * (●)))
25
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)))
26
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)))
27
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))))
28
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)))
29
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)))
30
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
31
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
32
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
33
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
34
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
35
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
36
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
37
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
38
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
39
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
40
Control Operators - types
What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x})
41
Control Operators - types
What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x})
42
Control Operators - types
What about the more powerful C control operator? Recall the reduction rule: E{C M} → M λx.(A E{x}) A
43
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
44
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
45
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
46
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
47
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
48
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
49
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
50
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:
51
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}
52
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}
53
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}
54
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}))}
55
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}))}
56
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{}
57
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.#
58
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.#
59
Curry-Howard Correspondence
Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it)
60
Curry-Howard Correspondence
Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it)
61
Curry-Howard Correspondence
Minimal Natural Deduction (If Lambda Calculus did not exist, it would be necessary to invent it) (Ax) Γ, x:A ⊢ x : A
62
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
63
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
64
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
65
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
66
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
67
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
68
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
69
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
70
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
71
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
72
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
73
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
74
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
75
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
76
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
77
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
78
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
79
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
80
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
81
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
82
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
83
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
84
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
85
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
86
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
87
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
88
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
89
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
90
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
91
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
92
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
93
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
94
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
95
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
96
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
97
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
98
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
99
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
100
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
101
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
102
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
103
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
104
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
105
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
106
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
107
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
108
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
109
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
110
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
111
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
112
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
113
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
114
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
115
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
116
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
117
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
118
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
119
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
120
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
121
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
122
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
123
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
124
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
125
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)
126
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
127
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
128
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...
129
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 | Δ
130
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 | Δ
131
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 | Δ
132
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 | Δ
133
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 | Δ
134
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 | Δ
135
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 | Δ
136
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 | Δ
137
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 | Δ
138
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 | Δ
139
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
140
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
141
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
142
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
143
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
144
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
145
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
146
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
147
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
148
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
149
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
150
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
151
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
152
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
153
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
154
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
155
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
156
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
157
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
158
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
159
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
160
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
161
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
162
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
163
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
164
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
165
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
166
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
167
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
168
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
169
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
170
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
171
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
172
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
173
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
174
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
175
Important features νx.M ¬A [M]N μx.M
176
Important features νx.M ¬A [M]N μx.M
177
Important features νx.M ¬A [M]N μx.M
178
Important features ¬A νx.M [M]N μx.M
179
Important features ¬A νx.M [M]N μx.M
180
Important features ¬A νx.M [M]N μx.M
181
Important features ¬A νx.M [M]N μx.M
182
Important features ¬A νx.M [M]N μx.M
183
Important features ¬A νx.M [M]N μx.M
184
Important features ¬A νx.M [M]N μx.M
185
Important features ¬A νx.M [M]N μx.M
186
Important features ¬A νx.M [M]N μx.M
187
Important features ¬A νx.M [M]N μx.M
188
Important features ¬A νx.M [M]N μx.M
189
Important features ¬A νx.M [M]N μx.M
190
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
191
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..
192
μ-reductions As with any binder, consider how μ can be eliminated
193
μ-reductions As with any binder, consider how μ can be eliminated
Recall the typing rule: Γ ⊢ μx.M : A Γ, x: ¬A ⊢ M : (PC)
194
μ-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)
195
μ-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)
196
μ-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)
197
μ-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
198
μ-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
199
μ-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
200
μ-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
201
μ-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
202
μ-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
203
μ-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
204
μ-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
205
μ-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
206
μ-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
207
μ-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
208
μ-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
209
μ-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
210
μ-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
211
μ-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
212
μ-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
213
μ-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
214
μ-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
215
μ-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
216
μ-reductions Γ, x: ¬A ⊢ M : (PC) νz. Γ ⊢ μx.M : A z : A : ¬A
217
μ-reductions Γ, x: ¬A ⊢ M : (PC) νz. E{ } Γ ⊢ μx.M : A z : A : ¬A
218
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term
Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
219
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term
Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
220
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term
Γ, x: ¬A ⊢ M : (PC) νz. E{ } z : A : ¬A Γ ⊢ μx.M : A
221
μ-reductions Γ ⊢ νz.E{z} : ¬A Consider typing the term
Γ, x: ¬A ⊢ M : (PC) νz. E{ } : ¬A Γ ⊢ μx.M : A z : A
222
μ-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
223
μ-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
224
μ-reductions We tackle these problems by defining local rules for gradually moving μ-bindings outwards e.g., Γ ⊢ (μx.M N) : B
225
μ-reductions We tackle these problems by defining local rules for gradually moving μ-bindings outwards e.g., Γ ⊢ (μx.M N) : B
226
μ-reductions Γ ⊢ (μx.M N) : B
227
μ-reductions Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
228
μ-reductions N Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
229
μ-reductions N Γ, x: ¬(A→B) ⊢ M : Γ ⊢ μx.M : A→B Γ ⊢ N : A
(PC) Γ ⊢ μx.M : A→B Γ ⊢ N : A (→E) Γ ⊢ (μx.M N) : B
230
μ-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
231
μ-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
232
μ-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
233
μ-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
234
μ-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)
235
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
236
μ-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)
237
μ-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)
238
μ-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
239
Γ, 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
240
Γ, 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
241
μ-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
242
μ-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
243
μ-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
244
μ-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 >
245
μ-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 >
246
μ-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 >
247
μ-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 >
248
μ-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 >
249
μ-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 >
250
μ-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 >
251
μ-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 >
252
μ-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
253
μ-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
254
μ-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
255
μ-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 >
256
μ-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
257
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
258
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
259
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
260
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
261
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 (?)
262
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?
263
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?
264
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)
265
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)
266
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!
267
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 or Google for “Alex Summers” Thank you for listening!
Παρόμοιες παρουσιάσεις
© 2024 SlidePlayer.gr Inc.
All rights reserved.