Equational Programming

Table of Contents

Lambda terms

abstraction

πœ†.M is function mapping of x to M πœ†x.square x is function mapping of x to square x

application

F M is application of function F to argument M

terms as trees

screenshot.png screenshot.png

parentheses

application is associative to the left (M N P) β€”> ((M N) P)

outermost parentheses are omitted M N P β€”> (M N P)

lambda extends to the right as far as possible πœ†x.M N β€”> πœ†x.(M N)

combining lambdas is possible πœ†xy.M β€”> πœ†x.πœ†y.M

start with most nested lambda (πœ†x.πœ†y.M) β€”> πœ†x.(πœ†y.M))

currying

reduces function with several arguments to functions with single arguments

f: x => x+x β€”> πœ†x.x+x g: (x,y) => x+y β€”> πœ†x.πœ†y.x+y

free/bound variables

x is bound by the first πœ†x above it in the term tree (underlined)

variables that aren’t bound are free (such as y in the last example)

substitution

M[x := N] means: result of replacing all free xΒ in M by N

alpha conversion

renaming bound variables (in case of possible name clashes)

P = Ξ±Q only if Q can be obtained from P by finitely many changes of bound variables in context

beta-reduction (dynamic):

(πœ†x.x)y β€”> By (πœ†x.x)y β€”> By (πœ†x.xz)y β€”> Byz (πœ†x.z)y β€”> Bz

In general: (πœ†x.M)N β€”> BM[x := N]