Is there a fuctional theory where functions and their arguments are at the same level?
Example
f(x)=x2f:R→R
It looks like functions are somewhat larger than its arguments…
λ calculus to CS is like algebra to mathematics
It inspired funcional pragramming: LISP, ML, Haskell…
At the core of λ calculus is a way to define annonymous functions.
Example
f(x)=x2 is represented as λx.x×x. x is the argument, and x×x is the function. Note that here it is just an example. There is actually no notation like × in λ cal.
In Python, we can write λ cal as:
lambda x: x*x
Proof theory notation
(name)C∈SP1∈S,…,Pn∈S(side conditions)
Things above the line are premises (what you know or assume)
Thing below the line is conclusion (what you are now allowed to claim)
Every rule has a name
When there is no side condition, it is called an axiom.
Term
λ cal is basically studying terms. The set of terms Λ is defined by:
A sequence of applications associates to the left. So xyz means ((xy)z)
The body of a lambda abstraction (the part after the dot) extends as far to the right as possible. So λx.st means λx.(st) not (λx.s)t
Nested abstractions associate to the right and can be collected under a single λ sign. So λxy.z means λx.λy.z
It can be seen as a function that receive multiple inputs
Free and Bound Variable
Free Variable FV(s)
FV(x)={x}FV(st)=FV(s)∪FV(t)FV(λx.s)=FV(s)∖{x}
A variable x is free in a term s if x∈FV(s)
A variable x is bound if it is in a subterm λx.u of s
A term s is closed if it has no free variable. They are also called as combinators
A term can simutaneously be free and bound
What does "bound" means?
Basically, that a variable that is bound means it is “captured” by a λ, so it will be replaced when you provide an input. Think of it as a local variable in coding, which only has meaning inside the specific block.
Alpha Conversion
Alpha convertible
s and t are α converible if one can derive the other by simply renaming bound variables, written as s≡t.
Bound variables’ name is meaningless, since it will be replaced when given an input.
Beta Conversion
Application in λ cal means substitution, which is basically the β conversion.
(λx.s)t→βs[t/x]
Here s[t/x] is not a term, but it represent a term that is obtained by the substitution.
x[t/x]y[t/x](su)[t/x](λy.s)[t/x]≡t,≡y,≡(s[t/x])(u[t/x]),≡λy.(s[t/x]) assuming y≡x and y∈FV(t)
Substitution should only be applied to free occurences of x in s
Avoid unintended capture of free variables! It can be avoided by simply rename the bound variables.
Example
s≡λx.yx,t≡λz.xz. What is the result of s[y/t]?
λx.(λz.xz)x is not correct.
Rename x into x′ first, and we got λx′.(λz.xz)x′