Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Próximos SlideShares
Carregando em…5
×

# Lambda Calculus

471 visualizações

Short overview of the Church's lambda calculus, with a focus on the on the operational semantics of the calculus. No previous mathematical background is required.

• Full Name
Comment goes here.

Are you sure you want to Yes No

### Lambda Calculus

1. 1. rafael de f. ferreira (@rafaeldﬀ) lambda calculus
2. 2. David Hilbert 2 “Wir müssen wissen. Wir werden wissen.” We must know. We will know.
3. 3. 3 Alonzo Church
4. 4. Syntax 4 t ::= x λx. t t t terms: variable abstraction application
5. 5. Example expressions 5 x x y λx. x λx. y (λx. x) y (λx. x x) z (λx. x x) (λx. x x) (λf. (λx. f (λy. x x y))  (λx. f (λy. x x y)))
6. 6. Example expressions 6 (λx. x) y variable abstraction variable application
7. 7. Substitution 7 [y↦z](λx. (λx. y x)) y  =  (λx. (λx. z x)) z
8. 8. Semantics 8 (λx. t1) t2 ⟶ [x↦t2]t1  beta reduction redex
9. 9. Semantics - examples 9 (λx. x) y ⟶ y
10. 10. Semantics - examples 10 (λx. x) (λy. y y) ⟶ (λy. y y)
11. 11. Semantics - examples 11 (λx.(λz.x z)) y ⟶ (λz.y z)
12. 12. 12 Church Booleans
13. 13. booleans 13 (λt. (λf. t)) (λt. (λf. f)) (λb. (λt. (λf. b t f)) true false if
14. 14. booleans - example 14 if false (λx. x) (λz. z) (λb. (λt. (λf. b t f)) false (λx. x) (λz. z) (λt. (λf. false t f)) (λx. x) (λz. z) (λf. false (λx. x) f) (λz. z) false (λx. x) (λz. z) = ⟶ ⟶ ⟶
15. 15. booleans - example 15 false (λx. x) (λz. z) (λt. (λf. f)) (λx. x) (λz. z) (λf. f) (λz. z) (λz. z) = ⟶ ⟶ ⟶
16. 16. booleans - example 16 if false (λx. x) (λz. z) ⟶* (λz. z)
17. 17. 17 Church Numerals
18. 18. numerals 18 λs. λz. z λs. λz. s z λs. λz. s (s z) λs. λz. s (s (s z)) … c0 c1 c2 c3 …
19. 19. numerals 19 succ = λn. λs. λz. s (n s z)
20. 20. numerals 20 succ c1 (λn. λs. λz. s (n s z)) c1 λs. λz. s ((λs. λz. s z) s z) λs. λz. s ((λz. s z) z) λs. λz. s (s z) = c2 … = = ⟶ ⟶ ⟶
21. 21. numerals 21 plus = λm. λn. λs. λz. m s (n s z)
22. 22. booleans - example 22 plus c0 c1 ⟶* c1 plus c1 c1 ⟶* c2 plus c2 c2 ⟶* c4
23. 23. 23 Recursion
24. 24. recursion 24 ω = (λx. x x) (λx. x x)
25. 25. recursion 25 ω = (λx. x x) (λx. x x) (λx. x x) (λx. x x) (λx. x x) (λx. x x) (λx. x x) (λx. x x) … ⟶ ⟶ ⟶ ⟶ ⟶
26. 26. recursion 26 Y = λf. (λx. f (λy. x x y)) (λx. f (λy. x x y))
27. 27. recursion 27 Y = λf. (λx. f (λy. x x y)) (λx. f (λy. x x y)) Y f = f (Y f) for all f
28. 28. recursion 28 g = λfct. λn if (eq n c0) c1 (times n (fct (pred n))) factorial = Y g Y f = f (Y f) for all f
29. 29. Propositions as Types PhilipWadler Introduction to Lambda Calculus Barendregt, Barendsen