classical combinatory logic
play

Classical Combinatory Logic Karim Nour LAMA - Equipe de logique - PDF document

Classical Combinatory Logic Karim Nour LAMA - Equipe de logique Universit e de Savoie 73376 Le Bourget du Lac France e-mail: nour@univ-savoie.fr and some helpful discussions with Ren e David 1 Content 1. (Ordinary) Combinatory Logic


  1. Classical Combinatory Logic Karim Nour LAMA - Equipe de logique Universit´ e de Savoie 73376 Le Bourget du Lac France e-mail: nour@univ-savoie.fr and some helpful discussions with Ren´ e David 1

  2. Content 1. (Ordinary) Combinatory Logic 2. Classical Combinatory Logic (Karim Nour) 3. Strong Normalization (Ren´ e David) 2

  3. Combinatory Logic CL 3

  4. The λ -calculus • The terms t := x | λx.t | ( t t ) • The reduction rule ( λx.u v ) → u [ x := v ] • The typing rules Γ , x : A ⊢ x : A Γ , x : A ⊢ u : B Γ ⊢ λx.u : A → B Γ ⊢ u : A → B Γ ⊢ v : A Γ ⊢ ( u v ) : B 4

  5. The combinatory logic • The terms T := x | K | S | ( T T ) • The reduction rules ( K U V ) ⊲ U ( S U V W ) (( U W ) ( V W )) ⊲ • The typing rules Γ , x : A ⊢ x : A Γ ⊢ K : A → ( B → A ) Γ ⊢ S : ( A → ( B → C )) → (( A → B ) → ( A → C )) Γ ⊢ U : A → B Γ ⊢ V : A Γ ⊢ ( U V ) : B 5

  6. CL � λ -calculus The coding ψ ( x ) = x ψ ( K ) = λx.λy.x ψ ( S ) = λx.λy.λz. (( x z ) ( y z )) ψ (( U V )) = ( ψ ( U ) ψ ( V )) Theorem • If Γ ⊢ c U : A , then Γ ⊢ λ ψ ( U ) : A . • If U ⊲ V , then ψ ( U ) → + ψ ( V ). 6

  7. λ -calculus � CL The coding φ ( x ) = x φ ( λx.t ) = l x ( φ ( t )) φ (( u v )) = ( φ ( u ) φ ( v )) where l x ( x ) = I = ( S K K ) l x ( T ) = ( K T ) if x �∈ V ar ( T ) l x (( U V )) = ( S l x ( U ) l x ( V )) Theorem • If Γ ⊢ λ t : A , then Γ ⊢ c φ ( t ) : A . • ( l x ( U ) V ) ⊲ ∗ U [ x := V ]. • If u → w v , then φ ( u ) ⊲ + φ ( v ). 7

  8. Classical Combinatory Logic CCL 8

  9. Add new combinators with appropriate typing rules? • ¬¬ A → A • ( ¬ A → A ) → A and ⊥→ A • ( ¬ A → ¬ B ) → ( B → A ) and ⊥→ A Problem The reduction rule is complicated and artificial . 9

  10. Code an existing classical calculus? • The λµ -calculus (Parigot) This reduction rule is problematic since it must somehow “code” the translation. ( µa.u v ) → µa.u [ a := ∗ v ] • The λµ ˜ µ -calculus (Curien and Herbelin) Same problem with the reduction rule � λx.u, v.w � → � v, µx. � u, w �� • The λ Sym -calculus (Barbanera and Berardi) OK 10

  11. The types of λ Sym -calculus • Two sets of variables A = { a, b, ... } and A ⊥ = { a ⊥ , b ⊥ , ... } . • The set of m -types A ::= a | a ⊥ | A ∧ A | A ∨ A • The set of types C ::= A |⊥ • For an m -type A , A ⊥ is defined by: ( a ) ⊥ = a ⊥ and ( a ⊥ ) ⊥ = a ( A ∧ B ) ⊥ = A ⊥ ∨ B ⊥ and ( A ∨ B ) ⊥ = A ⊥ ∧ B ⊥ (and thus A ⊥⊥ = A ). 11

  12. The terms and the typing rules of λ Sym -calculus t := x | � t, t � | σ 1 ( t ) | σ 2 ( t ) | λx.t | t ⋆ t Γ , x : A ⊢ x : A Γ ⊢ u : A Γ ⊢ v : B Γ ⊢ � u, v � : A ∧ B Γ ⊢ t : A Γ ⊢ t : B Γ ⊢ σ 1 ( t ) : A ∨ B Γ ⊢ σ 2 ( t ) : A ∨ B Γ ⊢ u : A ⊥ Γ , x : A ⊢ t : ⊥ Γ ⊢ v : A Γ ⊢ λx.t : A ⊥ Γ ⊢ u ⋆ v : ⊥ 12

  13. The reduction rules of λ Sym -calculus ( λx.u ) ⋆ v → u [ x := v ] v ⋆ ( λx.u ) → u [ x := v ] � u, v � ⋆ σ 1 ( w ) → u ⋆ w � u, v � ⋆ σ 2 ( w ) → v ⋆ w σ 1 ( w ) ⋆ � u, v � → w ⋆ u σ 2 ( w ) ⋆ � u, v � → w ⋆ v λx. ( u ⋆ x ) (1) → u λx. ( x ⋆ u ) (1) → u u [ x := v ] (2) → v (1) x �∈ Fv ( u ) (2) If u and v with type ⊥ , x occurs only once in u and u � = x . Lemma If Γ ⊢ λ s u : A and u → ∗ v , then Γ ⊢ λ s v : A . 13

  14. The terms of CCL T := x | K | S | C | P | Q 1 | Q 2 | ( T T ) | T ⋆ T 14

  15. The typing rules of CCL Γ , x : A ⊢ x : A Γ ⊢ K : A ⊥ ∨ ( B ∨ A ) Γ ⊢ S : ( A ∧ ( B ∧ C ⊥ )) ∨ (( A ∧ B ⊥ ) ∨ ( A ⊥ ∨ C )) Γ ⊢ C : ( A ∧ B ) ∨ (( A ∧ B ⊥ ) ∨ A ⊥ ) Γ ⊢ P : A ⊥ ∨ ( B ⊥ ∨ ( A ∧ B )) Γ ⊢ Q 1 : A ⊥ ∨ ( A ∨ B ) Γ ⊢ Q 2 : B ⊥ ∨ ( A ∨ B ) Γ ⊢ U : A ⊥ ∨ B Γ ⊢ V : A Γ ⊢ ( U V ) : B Γ ⊢ U : A ⊥ Γ ⊢ V : A Γ ⊢ U ⋆ V : ⊥ 15

  16. The typing rules of CCL Γ , x : A ⊢ x : A Γ ⊢ K : A → ( B → A ) Γ ⊢ S : ( A → ( B → C )) → (( A → B ) → ( A → C )) Γ ⊢ C : ( A → B ⊥ ) → (( A → B ) → A ⊥ ) Γ ⊢ P : A → ( B → ( A ∧ B )) Γ ⊢ Q 1 : A → ( A ∨ B ) Γ ⊢ Q 2 : B → ( A ∨ B ) Γ ⊢ U : A → B Γ ⊢ V : A Γ ⊢ ( U V ) : B Γ ⊢ U : A ⊥ Γ ⊢ V : A Γ ⊢ U ⋆ V : ⊥ 16

  17. The reduction rules of CCL ( K U V ) ⊲ U ( S U V W ) (( U W ) ( V W )) ⊲ ( C U V ) ⋆ W ( U W ) ⋆ ( V W ) ⊲ W ⋆ ( C U V ) ( U W ) ⋆ ( V W ) ⊲ ( P U V ) ⋆ ( Q 1 W ) ⊲ U ⋆ W ( P U V ) ⋆ ( Q 2 W ) ⊲ V ⋆ W ( Q 1 W ) ⋆ ( P U V ) ⊲ W ⋆ U ( Q 2 W ) ⋆ ( P U V ) ⊲ W ⋆ V ( C ( K U ) I ) (1) ⊲ U ( C I ( K U )) (1) ⊲ U W [ x := ( C ( K U ) ( K V ))] U ⋆ V (2) ⊲ (1) I = ( S K K ) ( ⊢ cc I : A ⊥ ∨ A ) (2) If W has type ⊥ Lemma If Γ ⊢ cc U : A and U ⊲ ∗ V , then Γ ⊢ cc V : A . 17

  18. The coding: λ Sym � CCL φ ( x ) = x φ ( λx.t ) = l x ( φ ( t )) φ ( u ⋆ v ) = φ ( u ) ⋆ φ ( v ) φ ( � u, v � ) = ( P φ ( u ) φ ( v )) φ ( σ i ( t )) = ( Q i φ ( t )) where l x ( x ) = I l x ( T ) = ( K T ) if x �∈ V ar ( T ) and T � = T 1 ⋆ T 2 l x (( U V )) = ( S l x ( U ) l x ( V )) l x ( U ⋆ V ) = ( C l x ( U ) l x ( V )) Theorem • If Γ ⊢ λ s t : A , the Γ ⊢ cc φ ( t ) : A . • If u → w v , then φ ( u ) ⊲ + φ ( v ). 18

  19. Some definitions π i t = λx. ( t⋆σ i ( x )) and π i 1 ...i n t = π i 1 ...π i n t [ u, v ] = λx. ( u ⋆ � v, x � ) Lemma • π i � u 1 , u 2 � → ∗ u i . • If Γ ⊢ λ s t : A 1 ∧ A 2 , then Γ ⊢ λ s π i t : A i . • If Γ ⊢ λ s u : A ⊥ ∨ B and Γ ⊢ λ s v : A , then Γ ⊢ λ s [ u, v ] : B . 19

  20. Example Let K = λx. ( π 1 x ⋆ π 22 x ). • ⊢ λ c K : A ⊥ ∨ ( B ∨ A ) x : A ∧ ( B ⊥ ∧ A ⊥ ) x : A ∧ ( B ⊥ ∧ A ⊥ ) π 2 x : B ⊥ ∧ A ⊥ π 22 x : A ⊥ π 1 x : A π 1 x ⋆ π 22 x : ⊥ K : A ⊥ ∨ ( B ∨ A ) • [[ K , u ] , v ] → ∗ u [[ K , u ] , v ] [ λy. ( u ⋆ π 2 y ) , v ] → → λz.u ⋆ z → u 20

  21. The coding: CCL � λ Sym ψ ( x ) = x ψ ( K ) = λx. ( π 1 x ⋆ π 22 x ) ψ ( S ) = λx. ([[ π 1 x, π 122 x ] , [ π 12 x, π 122 x ]] ⋆ π 222 x ) ψ ( C ) = λx. ([ π 1 x, π 22 x ] ⋆ [ π 12 x, π 22 x ]) ψ ( P ) = λx. ( � π 1 x, π 12 x � ⋆ π 22 x ) ψ ( Q 1 ) = λx. ( σ 1 ( π 1 x ) ⋆ π 2 x ) ψ ( Q 2 ) = λx. ( σ 2 ( π 1 x ) ⋆ π 2 x ) ψ (( U V )) = [ ψ ( U ) , ψ ( V )] ψ ( U ⋆ V ) = ψ ( U ) ⋆ ψ ( V ) Theorem • If Γ ⊢ cc U : A , then Γ ⊢ λ s ψ ( U ) : A . • If U ⊲ V , then ψ ( U ) → + ψ ( V ). 21

  22. Strong Normalization ( SN ) ( Ren´ e David) 22

  23. Proofs of SN for λ Sym 1. The original one: using candidates of re- ducibility defined by a fix point and thus not arithmetical . 2. A proof (by P. Battyanyi) adapted from our proof for the symmetric λµ -calculus and the λµ ˜ µ -calculus. 3. A proof using CCL ? 23

  24. The problem We would like 1. SN of CCL ? SN of λ Sym )? 2. ( SN of CCL ⇒ But • If u → w v , then φ ( u ) ⊲ + φ ( v ). does not implies 2. 24

  25. The solution V SN : stronger notion of SN . 1. V SN of CCL ? 2. ( φ ( t ) ∈ V SN t ∈ SN )? ⇒ 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend