index.md (1698B)
1 +++ 2 title = "Lambda terms" 3 +++ 4 5 # Lambda terms 6 ## abstraction 7 π.M is function mapping of x to M 8 πx.square x is function mapping of x to square x 9 10 ## application 11 F M is application of function F to argument M 12 13 ## terms as trees 14 ![screenshot.png](6b229883cf977b73b10c370d2cf2bca9.png) 15 ![screenshot.png](b06d6359ad899d2f43b675ff8530866d.png) 16 17 ## parentheses 18 application is associative to the left 19 `(M N P) β> ((M N) P)` 20 21 outermost parentheses are omitted 22 `M N P β> (M N P)` 23 24 lambda extends to the right as far as possible 25 `πx.M N β> πx.(M N)` 26 27 combining lambdas is possible 28 `πxy.M β> πx.πy.M` 29 30 start with most nested lambda 31 `(πx.πy.M) β> πx.(πy.M))` 32 33 ## currying 34 reduces function with several arguments to functions with single arguments 35 36 f: x => x+x β> πx.x+x 37 g: (x,y) => x+y β> πx.πy.x+y 38 39 ## free/bound variables 40 x is bound by the first πx above it in the term tree (underlined) 41 42 - πx.<u>x</u> 43 - πx.<u>x x</u> 44 - (πx.<u>x</u>)x 45 - πx.yΒ <u>x</u> 46 47 variables that arenβt bound are free (such as y in the last example) 48 49 ## substitution 50 M[x := N] means: result of replacing all free *x*Β in M by N 51 52 - x[x := N] = N 53 - a[x := N] = a 54 - (P Q)[x := N] = (P[x := N]) (Q[x := N]) 55 - (πx.P)[x := N] = πx.P 56 - (πy.P)[x := N] = πy.(P[y := N]) if x β y 57 58 ## alpha conversion 59 renaming bound variables (in case of possible name clashes) 60 - πx.x =Β πy.y 61 - (πx.y)[y := x] =Β πz.x 62 63 P = Ξ±Q only if Q can be obtained from P by finitely many changes of bound variables in context 64 65 ## beta-reduction (dynamic): 66 (πx.x)y β> By 67 (πx.x)y β> By 68 (πx.xz)y β> Byz 69 (πx.z)y β> Bz 70 71 In general: (πx.M)N β> BM[x := N]