curry howard isomorphism for sequent calculus at last
play

Curry-Howard isomorphism for sequent calculus at last Jos e Carlos - PowerPoint PPT Presentation

Introduction Sequent calculus Natural deduction Results Curry-Howard isomorphism for sequent calculus at last Jos e Carlos Esp rito Santo Centro de Matem atica Universidade do Minho Portugal jes@math.uminho.pt Estonian-Finnish


  1. Introduction Sequent calculus Natural deduction Results Preliminaries Vector notation Recall M , N ::= λ x . M (1st form) x � | (2nd form) N ( λ x . M ) N � | N (3rd form) Relaxed vector notation: 3rd form becomes M � N This introduces the need for vector bookkeeping M [] = M ( x � Q ) N � x ( � QN � N = N ) ( P � Q ) N � P ( � QN � N = N )

  2. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus...

  3. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus... ... called λµ -calculus

  4. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus... ... called λµ -calculus ... whose management of sequents’ RHS we want to “dualize”

  5. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus... ... called λµ -calculus ... whose management of sequents’ RHS we want to “dualize” Control points M ˆ a , where a , b , · · · are co-variables Control operator µ a . M

  6. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus... ... called λµ -calculus ... whose management of sequents’ RHS we want to “dualize” Control points M ˆ a , where a , b , · · · are co-variables Control operator µ a . M Control operation: if C = ([ · ] N 1 · · · N m )ˆ b C [ µ a . M ] → [ C / a ] M

  7. Introduction Sequent calculus Natural deduction Results Preliminaries A variant of Parigot’s λµ -calculus... ... called λµ -calculus ... whose management of sequents’ RHS we want to “dualize” Control points M ˆ a , where a , b , · · · are co-variables Control operator µ a . M Control operation: if C = ([ · ] N 1 · · · N m )ˆ b C [ µ a . M ] → [ C / a ] M Context substitution (rather than “structural substitution”) a ) = C [ M ′ ] where M ′ = [ C / a ] M [ C / a ]( M ˆ

  8. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Syntax of proof expressions

  9. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Syntax of proof expressions (Terms) t , u , v ::= λ x . t (1st form) | x ˆ k (2nd form, co-control point) | tk (3rd form) (Generalized vectors) ::= [] (empty vector) k | µ x . v ˜ (co-control operator) | u :: k (vector constructor)

  10. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Typing Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k

  11. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Typing Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k Sequents Γ ⊢ t : A and Γ | A ⊢ k : A

  12. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Typing Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k Sequents Γ ⊢ t : A and Γ | A ⊢ k : A Typing/inference rules Cut Γ ⊢ t : A Γ | A ⊢ k : B Ax Γ | A ⊢ [] : A Γ ⊢ tk : B Pass Γ , x : A | A ⊢ k : B Act Γ , x : A ⊢ v : B Γ , x : A ⊢ x ˆ k : B Γ | A ⊢ ˜ µ x . v : B ⊃ L Γ ⊢ u : A Γ | B ⊢ k : C Γ , x : A ⊢ t : B ⊃ R Γ ⊢ λ x . t : A ⊃ B Γ | A ⊃ B ⊢ u :: k : C

  13. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax

  14. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax Concatenation of two generalized vectors k @ k ′ []@ k ′ = k ′ ( u :: k )@ k ′ = u :: ( k @ k ′ ) (˜ µ x . t )@ k ′ = µ x . tk ′ ˜

  15. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax: co-continuations

  16. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax: co-continuations Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k

  17. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax: co-continuations Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k Co-continuations H ::= x ˆ[ · ] | t ([ · ]) | H [ u :: [ · ]] Hence co-continuations have the forms x ˆ( u 1 :: · · · :: u m :: [ · ]) or t ( u 1 :: · · · :: u m :: [ · ]) ( m ≥ 0) that is, a non-abstraction with a hole at the right end hole expects a vector

  18. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Derived syntax: co-continuations Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) ::= [] | ˜ µ x . t | u :: k k Co-continuations H ::= x ˆ[ · ] | t ([ · ]) | H [ u :: [ · ]] Hence co-continuations have the forms x ˆ( u 1 :: · · · :: u m :: [ · ]) or t ( u 1 :: · · · :: u m :: [ · ]) ( m ≥ 0) that is, a non-abstraction with a hole at the right end hole expects a vector Co-continuation substitution [ H / x ] t and [ H / x ] k [ H / x ]( x ˆ k ) = H [ k ′ ] with k ′ = [ H / x ] k

  19. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) k ::= [] | ˜ µ x . t | u :: k

  20. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) k ::= [] | ˜ µ x . t | u :: k Reduction rules ( β ) ( λ x . t )( u :: k ) → ( u (˜ µ x . t )) k (˜ µ ) H [˜ µ x . t ] → [ H / x ] t ( ǫ ) t [] → t ( π 1 ) ( x ˆ k ) k ′ → x ˆ( k @ k ′ ) ( π 2 ) ( tk ) k ′ → t ( k @ k ′ )

  21. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall (terms) t , u , v ::= λ x . t | x ˆ k | tk (gen. vectors) k ::= [] | ˜ µ x . t | u :: k Reduction rules ( β ) ( λ x . t )( u :: k ) → ( u (˜ µ x . t )) k (˜ µ ) H [˜ µ x . t ] → [ H / x ] t ( ǫ ) t [] → t ( π 1 ) ( x ˆ k ) k ′ → x ˆ( k @ k ′ ) ( π 2 ) ( tk ) k ′ → t ( k @ k ′ ) Interp: formal vector notation with first-class co-control β : function call µ : co-control operation ˜ ǫ and π i : vector bookkeeping in relaxed vector notation

  22. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall the ˜ µ -rule: H [˜ µ x . t ] → [ H / x ] t

  23. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall the ˜ µ -rule: H [˜ µ x . t ] → [ H / x ] t Partition of ˜ µ ( ρ ) y ˆ(˜ µ x . t ) → [ y ˆ([ · ]) / x ] t ( σ ) t (˜ µ x . t ) → [ t ([ · ]) / x ] t ( τ ) H [ u :: ˜ µ x . t ] → [ H [ u :: [ · ]] / x ] t

  24. Introduction Sequent calculus Natural deduction Results The λ ˜ µ -calculus Reduction Recall the ˜ µ -rule: H [˜ µ x . t ] → [ H / x ] t Partition of ˜ µ ( ρ ) y ˆ(˜ µ x . t ) → [ y ˆ([ · ]) / x ] t ( σ ) t (˜ µ x . t ) → [ t ([ · ]) / x ] t ( τ ) H [ u :: ˜ µ x . t ] → [ H [ u :: [ · ]] / x ] t Logical procedures cut-elimination β, σ, ǫ, π µ -elimination = co-control ˜ ρ, τ, σ permutation τ, σ, ǫ, π focalization ρ, τ

  25. Introduction Sequent calculus Natural deduction Results NATURAL DEDUCTION

  26. Introduction Sequent calculus Natural deduction Results Preliminaries Developing natural deduction

  27. Introduction Sequent calculus Natural deduction Results Preliminaries Developing natural deduction Bidirectional syntax

  28. Introduction Sequent calculus Natural deduction Results Preliminaries Developing natural deduction Bidirectional syntax Let-expressions (“Lets” vs cuts) Lets vs explicit substitutions

  29. Introduction Sequent calculus Natural deduction Results Preliminaries Developing natural deduction Bidirectional syntax Let-expressions (“Lets” vs cuts) Lets vs explicit substitutions Isomorphic to sequent calculus

  30. Introduction Sequent calculus Natural deduction Results The system Syntax of proof terms of λ let

  31. Introduction Sequent calculus Natural deduction Results The system Syntax of proof terms of λ let (Terms) M , N , P ::= λ x . M (abstraction) | app( H ) (applicative term) | let x := H in P (let-expression) (Heads) ::= (variable) H x | hd( M ) (head term) | HN (application)

  32. Introduction Sequent calculus Natural deduction Results The system Typing in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H

  33. Introduction Sequent calculus Natural deduction Results The system Typing in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H Sequents Γ ⊢ M : A and Γ ⊲ H : A

  34. Introduction Sequent calculus Natural deduction Results The system Typing in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H Sequents Γ ⊢ M : A and Γ ⊲ H : A Rules Γ ⊲ H : A Γ , x : A ⊢ P : B Γ , x : A ⊲ x : A Hyp Let Γ ⊢ let x := H in P : B Γ ⊲ H : A Γ ⊢ M : A Γ ⊢ app( H ) : A WCoercion Γ ⊲ hd( M ) : A SCoercion Γ , x : A ⊢ M : B Γ ⊲ H : A ⊃ B Γ ⊢ N : A Γ ⊢ λ x . M : A ⊃ B Intro Elim Γ ⊲ HN : B

  35. Introduction Sequent calculus Natural deduction Results The system Derived syntax Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) H ::= x | hd( M ) | HN

  36. Introduction Sequent calculus Natural deduction Results The system Derived syntax Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) H ::= x | hd( M ) | HN Continuations K ::= app([ · ]) | let x := [ · ] in P | K [[ · ] N ] Hence co-continuations have the forms app([ · ] N 1 · · · N m ) or let x := [ · ] N 1 · · · N m in P ( m ≥ 0) that is, a non-abstraction with a hole at the left end hole expects a head

  37. Introduction Sequent calculus Natural deduction Results The system Reduction in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H

  38. Introduction Sequent calculus Natural deduction Results The system Reduction in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H Rules (beta) hd( λ x . M ) N → hd(let x := hd( N ) in M ) (let) let x := H in P → [ H / x ] P (triv) app(hd( M )) → M (head 1 ) hd(app( H )) → H (head 2 ) K [hd(let x := H in P )] → let x := H in K [hd( P )]

  39. Introduction Sequent calculus Natural deduction Results The system Reduction in λ let Recall (Terms) M , N , P ::= λ x . M | app( H ) | let x := H in P (Heads) ::= x | hd( M ) | HN H Rules (beta) hd( λ x . M ) N → hd(let x := hd( N ) in M ) (let) let x := H in P → [ H / x ] P (triv) app(hd( M )) → M (head 1 ) hd(app( H )) → H (head 2 ) K [hd(let x := H in P )] → let x := H in K [hd( P )] Comments: bidirectional, agnostic, computational λ -calculus

  40. Introduction Sequent calculus Natural deduction Results Mapping sequent calculus

  41. Introduction Sequent calculus Natural deduction Results Mapping sequent calculus Map Θ : λ ˜ µ → λ let x ˆ( u 1 :: · · · u m :: []) �→ app( xN 1 · · · N m ) x ˆ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := ( xN 1 · · · N m ) in P t ( u 1 :: · · · u m :: []) �→ app(hd( M ) N 1 · · · N m ) t ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := (hd( M ) N 1 · · · N m ) in P Replace each left-introduction by an elimination

  42. Introduction Sequent calculus Natural deduction Results Mapping sequent calculus Map Θ : λ ˜ µ → λ let x ˆ( u 1 :: · · · u m :: []) �→ app( xN 1 · · · N m ) x ˆ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := ( xN 1 · · · N m ) in P t ( u 1 :: · · · u m :: []) �→ app(hd( M ) N 1 · · · N m ) t ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := (hd( M ) N 1 · · · N m ) in P Replace each left-introduction by an elimination Inversion of the associativity of non-abstractions

  43. Introduction Sequent calculus Natural deduction Results Mapping sequent calculus Map Θ : λ ˜ µ → λ let x ˆ( u 1 :: · · · u m :: []) �→ app( xN 1 · · · N m ) x ˆ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := ( xN 1 · · · N m ) in P t ( u 1 :: · · · u m :: []) �→ app(hd( M ) N 1 · · · N m ) t ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := (hd( M ) N 1 · · · N m ) in P

  44. Introduction Sequent calculus Natural deduction Results Mapping sequent calculus Map Θ : λ ˜ µ → λ let x ˆ( u 1 :: · · · u m :: []) �→ app( xN 1 · · · N m ) x ˆ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := ( xN 1 · · · N m ) in P t ( u 1 :: · · · u m :: []) �→ app(hd( M ) N 1 · · · N m ) t ( u 1 :: · · · u m :: ˜ µ y . v ) �→ let y := (hd( M ) N 1 · · · N m ) in P Proof expressions of λ ˜ µ as instructions to build λ let proofs �→ K [hd( M )] where t �→ M and k �→ K tk x ˆ k �→ K [ x ] where k �→ K u :: k �→ K [[ · ] N ] where u �→ N and k �→ K µ x . v ˜ �→ let x := [ · ] in P where v �→ P [] �→ app([ · ])

  45. Introduction Sequent calculus Natural deduction Results RESULTS

  46. Introduction Sequent calculus Natural deduction Results Results Isomorphism

  47. Introduction Sequent calculus Natural deduction Results Results Isomorphism µ ∼ Isomorphism Θ : λ ˜ = λ let

  48. Introduction Sequent calculus Natural deduction Results Results Isomorphism µ ∼ Isomorphism Θ : λ ˜ = λ let Bijections of syntactic classes terms terms t M gen. vectors k K continuations co-continuations H heads H

  49. Introduction Sequent calculus Natural deduction Results Results Isomorphism µ ∼ Isomorphism Θ : λ ˜ = λ let Bijections of syntactic classes terms terms t M gen. vectors k K continuations co-continuations H heads H Remark: exchange of primitive/derived concepts

  50. Introduction Sequent calculus Natural deduction Results Results Isomorphism µ ∼ Isomorphism Θ : λ ˜ = λ let Bijections of syntactic classes terms terms t M gen. vectors k K continuations co-continuations H heads H Remark: exchange of primitive/derived concepts Isomorphism of reduction relations β beta µ ˜ let ǫ triv π head

  51. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last

  52. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last The two faces of the coin: Internal interpretation: formal vector notation with first-class co-control External interpretation: bidirectional, agnostic, computational λ -calculus

  53. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last The two faces of the coin: Internal interpretation: formal vector notation with first-class co-control External interpretation: bidirectional, agnostic, computational λ -calculus Example: expression x ˆ k Internal interpretation: co-control point, fill k in the hole of the co-continuation H that will substitute x

  54. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last The two faces of the coin: Internal interpretation: formal vector notation with first-class co-control External interpretation: bidirectional, agnostic, computational λ -calculus Example: expression x ˆ k Internal interpretation: co-control point, fill k in the hole of the co-continuation H that will substitute x External interpretation: fill head x in the hole of continuation K , where K = Θ k - an instruction for the construction of a λ let derivation ( fill x in k better notation for this reading)

  55. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last The two faces of the coin: Internal interpretation: formal vector notation with first-class co-control External interpretation: bidirectional, agnostic, computational λ -calculus Example: expression x ˆ k Internal interpretation: co-control point, fill k in the hole of the co-continuation H that will substitute x External interpretation: fill head x in the hole of continuation K , where K = Θ k - an instruction for the construction of a λ let derivation ( fill x in k better notation for this reading) Example: β -rule ( λ x . t )( u :: k ) → ( u (˜ µ x . t )) k Internal interpretation: β -rule of a relaxed vector notation

  56. Introduction Sequent calculus Natural deduction Results Results Curry Howard at last The two faces of the coin: Internal interpretation: formal vector notation with first-class co-control External interpretation: bidirectional, agnostic, computational λ -calculus Example: expression x ˆ k Internal interpretation: co-control point, fill k in the hole of the co-continuation H that will substitute x External interpretation: fill head x in the hole of continuation K , where K = Θ k - an instruction for the construction of a λ let derivation ( fill x in k better notation for this reading) Example: β -rule ( λ x . t )( u :: k ) → ( u (˜ µ x . t )) k Internal interpretation: β -rule of a relaxed vector notation External interpretation: rule beta of λ let written in the notation of instructions that λ ˜ µ is

  57. Introduction Sequent calculus Natural deduction Results Results More Results

  58. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ

  59. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ

  60. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜

  61. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem

  62. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem take the s.c. characterization of CBN and CBV...

  63. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem take the s.c. characterization of CBN and CBV... obtain the isomorphic characterization in n.d...

  64. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem take the s.c. characterization of CBN and CBV... obtain the isomorphic characterization in n.d... and see how CBN and CBV are superimposed in λ let

  65. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem take the s.c. characterization of CBN and CBV... obtain the isomorphic characterization in n.d... and see how CBN and CBV are superimposed in λ let “Co-control theorem” given that the let rule is isomorphic to the ˜ µ rule...

  66. Introduction Sequent calculus Natural deduction Results Results More Results Studying forgetful/desugaring maps λ let → λ one gets strong normalization of λ let, hence of λ ˜ µ termination of the let rule, hence of ˜ µ rule of λ ˜ µ the latter gives a focalization result: every t ∈ λ ˜ µ has a unique µ -nf (which is a LJT proof, if t is typable) ˜ Agnosticism theorem take the s.c. characterization of CBN and CBV... obtain the isomorphic characterization in n.d... and see how CBN and CBV are superimposed in λ let “Co-control theorem” given that the let rule is isomorphic to the ˜ µ rule... one understands why co-control is almost invisible in n.d.

  67. Introduction Sequent calculus Natural deduction Results Results Duality

  68. Introduction Sequent calculus Natural deduction Results Results Duality Are control and co-control related by classical duality?

  69. Introduction Sequent calculus Natural deduction Results Results Duality Are control and co-control related by classical duality? Not within classical sequent calculus!

Recommend


More recommend