no solvable lambda value term left behind
play

No solvable lambda-value term left behind erez and Pablo Nogueira - PowerPoint PPT Presentation

No solvable lambda-value term left behind erez and Pablo Nogueira Alvaro Garc a P Reykjavik University IMDEA Software Institute ICE-TCS Theory Week, May 27th 2016 1 / 13 Computable functions and pure lambda calculus f N N f = {


  1. No solvable lambda-value term left behind erez and Pablo Nogueira Alvaro Garc´ ıa P´ Reykjavik University IMDEA Software Institute ICE-TCS Theory Week, May 27th 2016 1 / 13

  2. Computable functions and pure lambda calculus f ∈ N → N f = { (0 , 0) , (1 , 2) , (2 , 4) , (3 , 6) , (4 , 8) , . . . } f = { ( x , y ) | y = x + x } f ( x ) = x + x 2 / 13

  3. Computable functions and pure lambda calculus M , N ::= x | λ x . M | M N f ∈ N → N f = { (0 , 0) , (1 , 2) , (2 , 4) , (3 , 6) , (4 , 8) , . . . } f = { ( x , y ) | y = x + x } f ( x ) = x + x f ≡ λ x . ADD x x 2 / 13

  4. Computable functions and pure lambda calculus M , N ::= x | λ x . M | M N f ∈ N → N f = { (0 , 0) , (1 , 2) , (2 , 4) , (3 , 6) , (4 , 8) , . . . } f = { ( x , y ) | y = x + x } f ( x ) = x + x f ≡ λ x . ADD x x (( ADD x 1 ) ≡ g where g ( x 2 ) = x 1 + x 2 ) 2 / 13

  5. Computable functions and pure lambda calculus M , N ::= x | λ x . M | M N f ∈ N → N f = { (0 , 0) , (1 , 2) , (2 , 4) , (3 , 6) , (4 , 8) , . . . } f = { ( x , y ) | y = x + x } f ( x ) = x + x f ≡ λ x . ADD x x (( ADD x 1 ) ≡ g where g ( x 2 ) = x 1 + x 2 ) f (2) ≡ ( λ x . ADD x x ) TWO − → ADD TWO TWO − → . . . 2 / 13

  6. Computable functions and pure lambda calculus M , N ::= x | λ x . M | M N f ∈ N → N f = { (0 , 0) , (1 , 2) , (2 , 4) , (3 , 6) , (4 , 8) , . . . } f = { ( x , y ) | y = x + x } f ( x ) = x + x f ≡ λ x . ADD x x (( ADD x 1 ) ≡ g where g ( x 2 ) = x 1 + x 2 ) f ≡ λ x . MULT x TWO f ≡ λ x . SUBS ( MULT ( ADD x ONE ) TWO ) TWO f (2) ≡ ( λ x . ADD x x ) TWO − → ADD TWO TWO − → . . . 2 / 13

  7. I is λ x . x I M − → M K is λ x . λ y . x K M N − → ( λ y . M ) N − → M ∆ is λ x . x x ∆ M − → M M Ω is ∆ ∆ is ( λ x . x x )( λ x . x x ) Ω − → Ω − → Ω − → . . . 3 / 13

  8. Reduction in λ ( β ) ( λ x . B ) N − → [ N / x ] B 4 / 13

  9. Reduction in λ ( β ) ( λ x . B ) N − → [ N / x ] B → M ′ → N ′ → B ′ M − N − B − → M ′ N M N − M N − → M N ′ λ x . B − → λ x . B ′ 4 / 13

  10. Reduction in λ ( β ) ( λ x . B ) N − → [ N / x ] B → M ′ → N ′ → B ′ M − N − B − → M ′ N M N − M N − → M N ′ λ x . B − → λ x . B ′ M − → N N − → P M − → M M − → P 4 / 13

  11. Reduction in λ ( β ) ( λ x . B ) N − → [ N / x ] B → M ′ → N ′ → B ′ M − N − B − → M ′ N M N − M N − → M N ′ λ x . B − → λ x . B ′ M − → N N − → P M − → M M − → P M is a normal form : no ( λ x . B ) N subterm in M M has normal form : M − → Z and Z is a normal form 4 / 13

  12. Reduction in λ ( β ) ( λ x . B ) N − → [ N / x ] B → M ′ → N ′ → B ′ M − N − B − → M ′ N M N − M N − → M N ′ λ x . B − → λ x . B ′ M − → N N − → P M − → M M − → P M is a normal form : no ( λ x . B ) N subterm in M M has normal form : M − → Z and Z is a normal form Z unique 4 / 13

  13. Conversion in λ ( β ) ( λ x . B ) N = [ N / x ] B = M ′ = N ′ = B ′ M N B = M ′ N = M N ′ λ x . B = λ x . B ′ M N M N M = N N = P M = N M = M M = P N = M M is a normal form : no ( λ x . B ) N subterm in M M has normal form : M = Z and Z is a normal form Z unique : consistent proof theory 4 / 13

  14. Can all terms without normal form be considered equal? Ω = λ x . x Ω iff Ω ( K I ) = ( λ x . x Ω )( K I ) iff Ω ( K I ) = K I Ω iff Ω ( K I ) = I 5 / 13

  15. Can all terms without normal form be considered equal? Ω = λ x . x Ω iff Ω ( K I ) = ( λ x . x Ω )( K I ) iff Ω ( K I ) = K I Ω iff Ω ( K I ) = I Adding axioms that equate terms without normal form: inconsistent proof theory! 5 / 13

  16. Solvability Definition (Barendregt ’71) M closed is solvable iff there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = Z a normal form. 6 / 13

  17. Solvability Definition (Barendregt ’71) M closed is solvable iff there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = Z a normal form. Ω is unsolvable λ x . x Ω is solvable 6 / 13

  18. Solvability Definition (Barendregt ’71) M closed is solvable iff there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = Z a normal form. Definition (Wadsworth ’78) M closed is solvable iff for every term X there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = X . Lemma (Wadsworth ’78) If T closed has normal form then for every term X there exist X 1 , . . . , X k s.t. T X 1 · · · X k = X . 6 / 13

  19. Solvability Definition (Barendregt ’71) M closed is solvable iff there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = Z a normal form. Definition (Wadsworth ’78) M closed is solvable iff for every term X there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = X . Lemma (Wadsworth ’78) If T closed has normal form then for every term X there exist X 1 , . . . , X k s.t. T X 1 · · · X k = X . Definition (Barendregt ’84) M closed is solvable iff there exist closed operands N 1 , . . . , N n with n ≥ 0 s.t. M N 1 · · · N n = I . 6 / 13

  20. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = Z a normal form . 7 / 13

  21. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = Z a normal form . x Ω 7 / 13

  22. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = Z a normal form . ( λ x . [ x Ω ])( K I ) 7 / 13

  23. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = Z a normal form . ( λ x . [ x Ω ])( K I ) − → K I Ω − → I 7 / 13

  24. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff for all X there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = X . ( λ x . [ x Ω ])( K I ) − → K I Ω − → I 7 / 13

  25. Solvability (open terms) Definition (Wadsworth ’78) M arbitrary is solvable iff there exists ( λ x 1 . . . x m . [ ]) N 1 · · · N n with m , n ≥ 0 s.t. ( λ x 1 . . . x m . [ M ]) N 1 · · · N n = I . ( λ x . [ x Ω ])( K I ) − → K I Ω − → I 7 / 13

  26. Operational relevance and effective use Genericity Lemma (Barendregt ’84) M unsolvable then ∀C [ ] . C [ M ] = Z a normal form ⇒ ∀ X . C [ X ] = Z . 8 / 13

  27. Operational relevance and effective use Genericity Lemma (Barendregt ’84) M unsolvable iff ∀C [ ] . C [ M ] = Z a normal form ⇒ ∀ X . C [ X ] = Z . 8 / 13

  28. Operational relevance and effective use Genericity Lemma (Barendregt ’84) M is solvable iff ∃C [ ] . C [ M ] = Z a normal form ∧ ¬ ( ∀ X . C [ X ] = Z ) . 8 / 13

  29. Operational relevance and effective use Genericity Lemma (Barendregt ’84) M is solvable iff ∃C [ ] . C [ M ] = Z a normal form ∧ ¬ ( ∀ X . C [ X ] = Z ) . normal forms ⊂ solvables 8 / 13

  30. Operational relevance and effective use Genericity Lemma (Barendregt ’84) M is solvable iff ∃C [ ] . C [ M ] = Z a normal form ∧ ¬ ( ∀ X . C [ X ] = Z ) . normal forms ⊂ solvables Adding axioms that equate unsolvable terms: consistent proof theory! Full reduction and open terms: suitable for metaprogramming! 8 / 13

  31. Conversion in the lambda-value calculus ( λ V ) (Plotkin ’75) N ∈ Val ::= x | λ x . M ( β V ) ( λ x . B ) N = V [ N / x ] B M = V M ′ N = V N ′ B = V B ′ M N = V M ′ N M N = V M N ′ λ x . B = V λ x . B ′ M = V N N = V P M = V N M = V M M = V P N = V M 9 / 13

  32. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ 10 / 13

  33. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ 10 / 13

  34. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ 10 / 13

  35. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ − → V ( λ x . I ) ∆ 10 / 13

  36. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ − → V ( λ x . I ) ∆ − → V I 10 / 13

  37. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ − → V ( λ x . I ) ∆ − → V I ( λ x . ( λ y . I )( x ∆ )) ∆ 10 / 13

  38. Why values instead of normal forms? Preserving confluence by preserving potential divergence. ( λ x . ( λ y . I )( x ∆ )) ∆ − → V ( λ x . I ) ∆ − → V I ( λ x . ( λ y . I )( x ∆ )) ∆ − → V ( λ y . I )( ∆ ∆ ) 10 / 13

Recommend


More recommend