sequent calculus and extensions of lambda calculus
play

Sequent calculus and extensions of lambda-calculus s Pinto a Lu - PowerPoint PPT Presentation

Sequent calculus and extensions of lambda-calculus s Pinto a Lu Dep. Matem atica, Univ. Minho, Portugal Seminar at IoC, Tallinn 2nd August 2007 a Joint work with J. Esp rito Santo, M.J. Frade and R. Matthes 1 Plan 1. PART I: The


  1. Sequent calculus and extensions of lambda-calculus ıs Pinto a Lu´ Dep. Matem´ atica, Univ. Minho, Portugal Seminar at IoC, Tallinn 2nd August 2007 a Joint work with J. Esp´ ırito Santo, M.J. Frade and R. Matthes 1

  2. Plan 1. PART I: The system λ Jm of generalised and multiary applications 2. PART II: Combined normal forms 3. PART III: Continuation (and garbage)-passing style translations 2

  3. The Curry-Howard correspondence: one example natural deduction s-t λ -calculus y a [ a y ] ( λy a .y ) a → a abs a ⊃ a ⊃ y z b [ b z ] I ( λx b → b .λy a .y ) ( b → b ) → ( a → a ) abs ( λz b .z ) b → b abs ( b ⊃ b ) ⊃ ( a ⊃ a ) ⊃ x b ⊃ b ⊃ z I I app ⊃ E (( λx b → b .λy a .y )( λz b .z )) a → a a ⊃ a 1. (( λx b → b .λy a .y )( λz b .z )) a → a is a compact notation for the deduction. 2. This idea defines a bijection between s-t λ -terms and deductions for intuitionistic implication (making β -reduction isomorphic to normalisation). 3

  4. PART I The system λ Jm of generalised and multiary applications (with J. Esp´ ırito Santo) 4

  5. Multiarity • Intuitionistic sequent calculus left rule is: Γ ⊢ A Γ , x : C ⊢ D Left . Γ , y : A ⊃ C ⊢ D Schwichtenberg considers a family of left rules: Γ ⊢ A Γ ⊢ B 1 Γ ⊢ B k Γ , x : C ⊢ D . . . Left k , Γ , y : A ⊃ B 1 ⊃ . . . ⊃ B k ⊃ C ⊢ D where Left is the case k = 0 • Herbelin uses only one rule to implement multiarity: Γ ⊢ A Γ; B ⊢ C : Γ , x : C ⊢ D m − Left ; Γ , y : A ⊃ B ⊢ D makes use of a ”stoup” (distinguished position on sequent’s LHS); derivability of Γ; B ⊢ C : imposes B = B 1 ⊃ . . . ⊃ B k ⊃ C for some k and B ”main and linear”. 5

  6. Generality • The generalised elimination rule of von Plato is: [ x : B ] . . . A ⊃ B A C g − Elim C • The Λ J system of Joachimski & Matthes extends s-t. λ -calculus with generalised applications: Γ ⊢ t : A ⊃ B Γ ⊢ u : A x : B, Γ ⊢ v : C g − Elim Γ ⊢ t ( u · ( x ) v ): C 6

  7. λ Jm : the generalised multiary λ -calculus Expressions ::= x | λx.t | t ( u, l, ( x ) v ) t, u, v � �� � gm-application ::= [] | u :: l l Sequents Γ ⊢ t : A Γ; B ⊢ l : C Γ ⊢ u : A Γ; B ⊢ l : C Typing rules Lft Γ; C ⊢ []: C Ax Γ; A ⊃ B ⊢ u :: l : C x : A, Γ ⊢ t : B Γ ⊢ λx.t : A ⊃ B Right x : A, Γ ⊢ x : A Axiom Γ ⊢ t : A ⊃ B Γ ⊢ u : A Γ; B ⊢ l : C x : C, Γ ⊢ v : D gm − Elim Γ ⊢ t ( u, l, ( x ) v ): D 7

  8. gm − Elim and sequent calculus 1. gm − Elim capturing sequent calculus rules: y : A ⊃ B, Γ ⊢ y : A ⊃ B Ax. y, Γ ⊢ u : A y, Γ; B ⊢ l : C x : C, y, Γ ⊢ v : D m-Left y : A ⊃ B, Γ ⊢ y ( u, l, ( x ) v ): D y, Γ; B ⊢ []: B Ax y : A ⊃ B, Γ ⊢ y : A ⊃ B Ax. y, Γ ⊢ u : A x : B, y, Γ ⊢ v : D Left y : A ⊃ B, Γ ⊢ y ( u, [] , ( x ) v ): D 2. Sequent calculus view of gm − Elim : Γ ⊢ A Γ; B ⊢ C Γ , x : C ⊢ D linear-m-Left Γ ⊢ A ⊃ B Γ; A ⊃ B ⊢ D cut Γ ⊢ D 8

  9. Reduction rules ( λx.t )( u, [] , ( y ) v ) → β 1 s ( s ( u, x, t ) , y, v ) ( λx.t )( u, v :: l, ( y ) v ) → β 2 s ( u, x, t )( v, l, ( y ) v ) t ( u, l, ( x ) v )( u ′ , l ′ , ( y ) v ′ ) t ( u, l, ( x ) v ( u ′ , l ′ , ( y ) v ′ )) → π ( s stands for gm-substitution ; β = β 1 ∪ β 2 ) βπ -nfs: t, u, v ::= x | λx.t | x ( u, l, ( y ) v ) l ::= u :: l | [] t ( u, l, ( x ) x ( u ′ , l ′ , ( y ) v ′ )) → µ t ( u, @ ( l, u ′ :: l ′ ) , ( y ) v ′ ) Rule µ : x �∈ u ′ , l ′ , v ′ ie v = x ( u ′ , l ′ , ( y ) v ′ ) introduces x in if a linear fashion. ( @ stands for list appending) Results: (i) Each combination of β , π and µ is confluent. (ii) → βπµ is SN for typable terms. 9

  10. gm − Elim and subsystems of λ Jm Γ ⊢ t : A ⊃ B Γ ⊢ u : A Γ; B ⊢ l : C x : C, Γ ⊢ v : D gm-Elim ( λ Jm ) Γ ⊢ t ( u, l, ( x ) v ): D Γ; B ⊢ []: B Ax Γ ⊢ t : A ⊃ B Γ ⊢ u : A x : B, Γ ⊢ v : D g-Elim ( λ J ) Γ ⊢ t ( u, [] , ( x ) v ): D x : C, Γ ⊢ x : C Ax. Γ ⊢ t : A ⊃ B Γ ⊢ u : A Γ; B ⊢ l : C m-Elim ( λ m ) Γ ⊢ t ( u, l, ( x ) x ): C Γ; B ⊢ []: B Ax x : B, Γ ⊢ x : B Ax. Γ ⊢ t : A ⊃ B Γ ⊢ u : A Elim ( λ ) Γ ⊢ t ( u, [] , ( x ) x ): B 10

  11. Subsystems of λ Jm λ Jm λ J ≃ Λ J (Joach.&Mat.) q ✲ gm-application generalised application t ( u, l, ( x ) v ) t ( u, [] , ( x ) v ) = t ( u · ( x ) v ) φ p p ✲ ❄ ❄ λ m (= λ P h) λ ≃ s-t. λ -calculus ✲ multiary application (simple) application q t ( u, l, ( x ) x ) = t ( u · l ) t ( u, [] , ( x ) x ) = t ( u ) φ ( t ( u 0 , [ u 1 , ..., u k ] , ( x ) v )) = s ( φ ( t )( φ ( u 0 ))( φ ( u 1 )) ... ( φ ( u k )) , x, φ ( v )) 11

  12. Permutative conversions of λ Jm p = p 1 ∪ p 2 ∪ p 3 eliminates generality: ( p 1 ) t ( u, l, ( x ) y ) → y, x � = y ( p 2 ) t ( u, l, ( x ) λy.v ) → λy.t ( u, l, ( x ) v ) x : C, y : D 1 , Γ ⊢ v : D 2 x : C, y : D 1 , Γ ⊢ v : D 2 . . . gm x : C, Γ ⊢ λy.v : D 1 ⊃ D 2 R . . . y : D 1 , Γ ⊢ t ( u, l, ( x ) v ): D 2 → gm Γ ⊢ λy.t ( u, l, ( x ) v ): D 1 ⊃ D 2 R Γ ⊢ t ( u, l, ( x ) λy.v ): D 1 ⊃ D 2 ( p 3 ) t 1 ( u 1 , l 1 , ( x ) t 2 ( u 2 , l 2 , ( y ) v )) → t 1 ( u 1 , l 1 , ( x ) t 2 )( t 1 ( u 1 , l 1 , ( x ) u 2 ) , t 1 ( u 1 , l 1 , ( x ) l 2 ) , ( y ) v ) if x �∈ v, q eliminates multiarity: t ( u, v :: l, ( x ) v ′ ) t ( u )( v, l, ( x ) v ′ ) ( q ) → 12

  13. Results on permutations 1. The rewriting system induced by pq is confluent and SN. 2. The pq -normal form of a term is its φ -image. 3. Permutability Thm: φ ( t 1 ) = φ ( t 2 ) iff t 1 = pq t 2 . 4. Analogous results hold for p (resp. q ) alone wrt λ J (resp. λ m ) and the appropriate restriction of φ . 13

  14. PART II Combined normal forms (with J. Esp´ ırito Santo and M.J. Frade) 14

  15. λ Jm and other works on nfs for sequent calculus λ Jm p q βπ ❄ ✲ ✛ ✲ ✛ ❄ Cm=Cut-free multiary λ m Cm λ J sequent terms . . . . . . . . q p . βπ . . . . . ❄ . ✛ . ✲ ❄ . ✲ ✛ Schw. . . . . . C=Cut-free (ordinary) βh λ C . . . . sequent terms . . . . . . . . . . . . . . . . β . . . Dyc. & P in. . . . . . . . . ✛ . . ✛ ❄ ❄ ❄ h ? ❄ ❄ ✛ ❄ ✛ ✛ ✛ Herbelin-nfs β -nfs Mints-nfs ✲ ✲ ✲ ✲ ? q 15

  16. Overlaps and permutations Three ways of expressing multiple application: (1) multiary application. (2) normal generality. (3) iterated application. µ t ( u, @ ( l, u ′ :: l ′ ) , ( y ) v ) ✛ ✲ t ( u, l, ( x ) x ( u ′ , l ′ , ( y ) v )) ν q r proviso: ∈ u ′ , l ′ , v x / ✲ ✛ t ( u, l, ( x ) x )( u ′ , l ′ , ( y ) v ) Other rules: t ( u, l, ( x ) x )( u ′ , l ′ , ( y ) v ) → h t ( u, @ ( l, u ′ :: l ′ ) , ( y ) v ) ( h ) ( s ) t ( u, l, ( x ) v ) → s s ( t ( u · l ) , x, v ) if v � = x ( r ) t ( u, l, ( x ) v ) → r s ( t ( u · l ) , x, v ) if v is x -normal application ie v = x ( u ′ , l ′ , ( y ) v ′ ) and x / ∈ u ′ , l ′ , v ( r ′ ) t ( u, l, ( x ) v ) → r ′ s ( t ( u · l ) , x, v ) if v � = x & is not x -normal app. r ∪ r ′ = s ; q ⊆ h − 1 ; r ⊆ π − 1 ; Remarks: 16

  17. Combined normal forms t 0 t 0 = V ( u 1 ,l 1 , ( y 1 ) v 1 ) ... ( u n ,l n , ( y n ) v n ) V = x or V = λx.t βr ′ ❄ ❄ t 1 = x ( u ′ A 1 1 ,l ′ 1 , ( y 1 ) v ′ 1 ) ... ( u ′ m ,l ′ m , ( y m ) v ′ m ) v ′ i is y i -normal r q ✲ ✛ ✛ ✲ t 2 = x ( u ′′ t 3 = x ( u ′′′ A 2 A 3 1 ,l ′′ 1 ) ... ( u ′′ k ,l ′′ 1 , ( z 1 ) v ′′ 1 ) ... ( u ′′′ j , ( z j ) v ′′ k ) j ) v ′′ is z i -normal i π ′ h ❄ ❄ ❄ ❄ µ q r ✛ t 4 = x ( u ′′ k )) H-nfs ✲ M-nfs t 5 = x ( u ′′ 1 , @( l ′′ 1 ,...,u ′′ k ,l ′′ 1 , ( z 1 ) “@” ( z 1 ,v ′′ 1 ,...,u ′′′ j ,v ′′ j )) ν v ′′ is z i -normal q r i ✲ ✛ ✲ ✛ ✲ ✛ ✲ ✛ β -nfs x ( u ′′ 1 )( u 11 ) ... ( u 1 n 1 ) ... ( u ′′ k )( u k 1 ) ... ( u knk ) 17

  18. Results on combined normal forms (1) → βrr ′ , → βrr ′ q , → βrr ′ h are confluent (2) → βrr ′ , → βrr ′ q , → βrr ′ h are SN for typable terms q and h postpone over β and s = rr ′ and thus reduction to βrr ′ q -nf (3) and βrr ′ h -nf can always be split into two stages t βrr ′ ❄ ❄ t 1 ✛ h q ✲ ✲ ✛ H-nfs ∋ t 2 t 3 ∈ β -nfs Remark: The study is not systematic yet. 18

  19. PART III Continuation (and garbage)-passing style translations (with J. Esp´ ırito Santo and R. Matthes) 19

  20. Continuation-passing style translations for λ J and λ Jm ¬¬ A ∗ translation of types: A = X ∗ = X (for type variables, including ⊥ ) ( A ⊃ B ) ∗ = A ⊃ ¬¬ B translation of terms (Plotkin’s colon notation): λk. ( t A : k ¬ A ∗ ) ⊥ t = ( x : K ) = xK ( λx.t : K ) = K ( λxn.n t ) ( λ J ) ( t ( u · ( z ) v ) : K ) = ( t : λm.m u ( λz. ( v : K ))) ( λ Jm ) ( t ( u, l, ( z ) v ) : K ) = ( t : λm.m u ( l, z, v : K )) ([] , z, v : K ) = λz. ( v : K ) ( u :: l, z, v : K ) = λn.n ( λm.m u ( l, z, v : K )) 20

Recommend


More recommend