# Today I Learned

Some of the things I've learned every day since Oct 10, 2016

## 69: The Deduction Theorem

In logic, the deduction theorem states that where $A, B$ are formulas and $\Delta$ is a set of assumptions or axioms, the implication $A \rightarrow B$ is deducible from $\Delta$ if and only if $B$ is deducible from $\Delta \bigcup \{A\}$. The statement is intuitive, but wasn’t formally proven until 1930.

## 51: Undecidability of Equality of Lambda Expressions

In general, there is no algorithm which determines whether two lambda expressions are equivalent under the reduction rules of the lambda calculus. This is the problem for which the first proof of undecidability was given.

## 50: Normalization Property (Lambda Calculus)

In a rewrite system, such as $\beta$-reduction in the lambda calculus, a term may or may not satisfy either the  weak normalization or the strong normalization property.

A term $T$ satisfies the weak normalization property if there exists a sequence of rewrites on $T$ that eventually results in a normal form of $T$: a term which is irreducible.

A term $T$ satisfies the strong normalization property if every sequence of rewrites on $T$ eventually results in a normal form of $T$.

If every term in a rewrite system satisfies the [weak | strong] normalization property, then the system itself is said to satisfy the same property.

Examples:

An example of a system which satisfies neither of the normalization properties is the pure untyped lambda calculus. An example of a non-normal term within this system is

$(\lambda y . y y) (\lambda y . y y)$.

Under $\beta$-reduction, this term reduces to itself, and so it never terminates in an irreducible form.

Conversely, a term within this system which is weakly normal is

$(\lambda x . x) x$.

Under $\beta$-reduction, this term reduces to just the variable $x$, an irreducible term.

There are other forms of the lambda calculus, as well as other similar systems, which are normal. These can be viewed as programming languages in which every program eventually will (or can) terminate. A significant drawback to such a system, however, is that if a system is normal it cannot be Turing complete.

Additionally, in the lambda calculus every normalizing term has a unique normal form.

## 49: Church Numerals

In Church encoding, an encoding system using lambda calculus, the Church numerals are the representation of the natural numbers. The distinguishing feature of the Church numerals is that the natural numbers are not treated as a primitive type, as they would typically be, but are simply represented by higher-order functions. Each higher-order function $\boldsymbol{n}$ representing the number $n$ takes two arguments — a function $f$ and a second argument to be passed to $f$ — and returns the $n$-fold composition of $f$.

Examples:

0 is represented as $\boldsymbol{0} = \lambda f . \lambda x . x$, which given any function $f$ returns a function which simply returns $x$ without applying $f$ at all.

1 is represented as $\boldsymbol{1} = \lambda f . \lambda x . f x$, which given any function $f$ returns a function which applies $f$ once to $x$.

2 is represented as $\boldsymbol{2} = \lambda f . \lambda x . f (f x)$, which given any function $f$ returns a function which applies $f$ twice to $x$.

3 is represented as $\boldsymbol{3} = \lambda f . \lambda x . f (f (f x))$, which given any function $f$ returns a function which applies $f$ three times to $x$.