# Today I Learned

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

## Category Archives: computation

## 98: Top Type, Bottom Type

January 21, 2017

Posted by on Given a type system, the **top type** is the type which contains every possible value in that type system, making every other type a subtype of .

By contrast, the **bottom type** is the type which contains no values, making every other type a supertype of .

## 94: The Liskov Substitution Principle

January 18, 2017

Posted by on The **Liskov Substitution Principle** makes the intuitive generalization that if are types and ( is a subtype of ), then in a program with this type system, objects from can be substituted with objects from without certain properties of the program being affected.

## 67: Confluence (Rewriting Systems)

December 18, 2016

Posted by on A term within a rewriting system (such as one in the lambda calculus) is **confluent** if, for any pair of terms such that and (where means is a reduct of under 0 or more reductions), there exists a term such that and . If every term in a system is confluent, the system itself is said to be confluent.

Systems which are both confluent and terminating are especially nice, because any sequence of reductions can be applied to a given term with the resulting irreducible reduct being the same.

## 62: Homoiconicity

December 12, 2016

Posted by on In programming, **homoiconicity **a property of languages in which programs are represented as instances of a data structure of a primitive type of the language. This takes advantage of the fact that the information of programs and data can be carried through the same medium by storing a program’s code in a form that the language knows how to access and manipulate.

This can make metaprogramming much easier than it otherwise would be. A good example of a language exhibiting homoiconicity is LISP, where everything is represented as a list (S-expression). Since both programs and data are stored as lists, a LISP program can manipulate another program as easily as it would any data.

## 54: Newman’s Lemma

December 3, 2016

Posted by on **Newman’s Lemma**, also known as the Diamond Lemma, states that if a rewriting system is terminating (is strongly normalizing), then that system is locally confluent if and only if it is confluent.

## 51: Undecidability of Equality of Lambda Expressions

November 30, 2016

Posted by on 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)

November 29, 2016

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

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

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

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

.

Under -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

.

Under -reduction, this term reduces to just the variable , 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.

## Recent Comments