-Calculus is formal system for express computation, based in type theory.
- A variable is a character or string representing a parameter
For and are terms:
- A lambda abstraction is a function definition which takes a bound variable as an input and returning the body
- An application, applying a function to an argument
Reduction Operations
- -conversion, which renames the bound variables in an expression
- -reduction, replaces the bound variable w/ the argument expression in the body of the abstraction
Lambda calculus is Turing compete, meaning it can be used to simulate any Turing machine.
E.g., mapping of an input to an output is denoted as follows: , in lambda-calculus this may be denoted as , where the '' symbol separates the input from the output. Equivalently, this describes a function .
E.g., of -reduction
Note: For , such a function is higher-order (i.e., functions themselves can be inputs to other functions, more precisely, a function of order can be an input for a function of order order where . Similarly, functions can also be returned as outputs of higher-order functions).
Lambda calculus can achieve two inputs (or more) functions via the following: Consider the function i.e., We have a function which takes an input and outputs a function w/ input , this outputted function in turn returns . Substituting in , we derive General form: w/ variables Note: denotes ’ substituted into ’ This process is known as ‘Currying’ w/ functions returning functions to sequentially apply to multiple inputs (see Type Theory).
Booleans & Conditionals:
-
(i.e., take two inputs and returns the first).
-
(i.e., takes two inputs and returns the second).
-
If then = E.g., ; and
i.e., consider , plugging in ‘True’ for b we derive: plugging in for Substituting for (or equivalently, ) Substitute for Substitute for
- Not if then else ; or
Note: We are working in bivalent logic, so “not ” = "" and “not ” = ""
For the not-function, there does not need to be a Boolean value as it would result in nonsensical statements as '' is not a Boolean value i.e., if then else
This can be avoided by incorporating types from type theory
- Bool (for Boolean values)
- Num (for numeric values) E.g., of notation: reads ” is of type Bool”
(or equivalently we can specify the type of the variable, ) where and
The not function then can rewritten as if then else
Encoding: Encoding Numbers: …
Encoding Recursion:
Encoding Pairs: Pair
References
Type Theory Turing Machines & Computability Theory [Programming with Math](Programming with Math | The Lambda Calculus)