The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf ·...

355
Outline The Grand Unified Theory of Computation (Part 2) Vahan Mkrtchyan 1 1 Lane Department of Computer Science and Electrical Engineering West Virginia University April 22, 2015 The Grand Unified Theory of Computation Computational Complexity

Transcript of The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf ·...

Page 1: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Outline

The Grand Unified Theory of Computation (Part 2)

Vahan Mkrtchyan 1

1Lane Department of Computer Science and Electrical EngineeringWest Virginia University

April 22, 2015

The Grand Unified Theory of Computation Computational Complexity

Page 2: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Outline

Outline

1 Form is a Function: the λ-Calculus

2 Turing’s Applied Philosophy

3 Computation Everywhere

The Grand Unified Theory of Computation Computational Complexity

Page 3: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Outline

Outline

1 Form is a Function: the λ-Calculus

2 Turing’s Applied Philosophy

3 Computation Everywhere

The Grand Unified Theory of Computation Computational Complexity

Page 4: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Outline

Outline

1 Form is a Function: the λ-Calculus

2 Turing’s Applied Philosophy

3 Computation Everywhere

The Grand Unified Theory of Computation Computational Complexity

Page 5: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 6: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 7: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function.

The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 8: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 9: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 10: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2,

we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 11: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 12: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 13: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function,

it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 14: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 15: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 16: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The logician Alonzo Church has come up with another definition of a computation anda computable function. The system he has invented is called λ-Calculus.

Getting used to the new format

Instead of writing f (x) = x2, we will write f = λx .x2.

In other words, λx .x2 is a function that takes a variable x and returns x2.

If we replace a number to the right of this function, it substitutes that number for thevariable x :

(λx .x2)7 = 49

So far, this is just a strange shift in notation.

The Grand Unified Theory of Computation Computational Complexity

Page 17: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 18: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 19: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 20: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function,

which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 21: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 22: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5.

Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 23: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 24: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5

= (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 25: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5

= 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 26: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 27: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation.

We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 28: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y .

In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 29: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y ,

which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 30: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

The way, the λ-Calculus treats the process of computation is different.

Consider the addition function, which we write

λxy .x + y .

We will apply this to 3 and 5. Rather than writing

(λxy .x + y)(3, 5)

we write((λxy .x + y)3)5 = (λy .3 + y)5 = 8.

This is already a computation. We have the object λy .3 + y . In other words, havingfixed x = 3, we have a function on the other variable y , which adds 3 to it.

The Grand Unified Theory of Computation Computational Complexity

Page 31: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 32: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 33: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 34: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions,

we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 35: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down,

modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 36: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 37: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 38: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 39: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x ,

which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 40: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Alonzo Church and the λ-Calculus

The λ-Calculus

This is a powerful shift in how we think about performing a computation.

Rather than modifying variables and passing their values up to functions, we evaluatefunctions from the top down, modifying what they will do with the rest of their datawhen they get it.

The notation λxy is really a shorthand, which works like this:

λxy .x + y = λx .(λy .x + y).

Thus addition is a function on one variable x , which, when given x , returns the functionthat adds that x to its input y .

The Grand Unified Theory of Computation Computational Complexity

Page 41: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 42: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 43: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations,

or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 44: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 45: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators,

which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 46: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 47: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings,

then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 48: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 49: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 50: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

The purest form of the λ-calculus does not have arithmetic operations, or even theconcept of integers.

The basic objects in the λ-calculus are strings, or combinators, which take the nextstring to their right and substitute it for each appearance of the first variable markedwith λ.

In other words, if x is a variable, and U and V are strings, then

(λx .U)V = U[x → V ],

where U[x → V ] denotes the string we get from U by replacing each appearance of xwith V .

Each such step is called a reduction.

The Grand Unified Theory of Computation Computational Complexity

Page 51: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 52: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 53: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 54: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab

= (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 55: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b

= bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 56: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 57: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 58: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative,

meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 59: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 60: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab)

= λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 61: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Strings or Combinators

A computation then consists of a chain of reductions, such as

(λxy .yxy)ab = (λy .yay)b = bab.

We evaluate strings from left to right, and that in the absence of parentheses, weinterpret the string zab as (za)b.

The operation of reduction is non-associative, meaning that z(ab) 6= (za)b in general.

For example, grouping a and b together in this example gives

(λxy .yxy)(ab) = λy .y(ab)y .

The Grand Unified Theory of Computation Computational Complexity

Page 62: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 63: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 64: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 65: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 66: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 67: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 68: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 69: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 70: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 71: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Assume that T = λxy .x , F = λxy .y , and I = λx .x .

The combinators T and F take two inputs and return the first or second one.

Since I is the identity, IT = T and IF = F .

Now, we have

TI = (λxy .x)(λx .x)

= (λxy .x)(λz.z)

= λy .(λz.z)

= λyz.z

= F .

The Grand Unified Theory of Computation Computational Complexity

Page 72: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 73: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 74: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 75: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 76: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 77: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 78: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 79: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 80: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 81: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 82: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 83: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Some products, such as TI, reach a final state, or normal form, in which no morereductions are possible.

Either there are no λs left, or there are no strings to the right of the first combinator toplug into it.

However, this is not true for all expressions.

Consider Q = λx .xx , which takes x as input and returns xx .

If we feed Q to itself, we get

QQ = (λx .xx)(λx .xx) = (λx .xx)(λx .xx)

= (λx .xx)(λx .xx)

= ...

The chain of the reductions never halts.

The Grand Unified Theory of Computation Computational Complexity

Page 84: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 85: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 86: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 87: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 88: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 89: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 90: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 91: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 92: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another

Even worse is the following expression, which grows without bounds as we try toreduce it:

(λx .xx)(λy .yyy) = (λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)

= (λy .yyy)(λy .yyy)(λy .yyy)(λy .yyy)

= ...

These are examples of infinite loops in the λ-calculus.

Like partial recursive functions, λ-expressions may never return an answer, and thefunctions they compute may be undefined for some values of their input.

The Grand Unified Theory of Computation Computational Complexity

Page 93: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 94: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 95: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 96: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 97: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 98: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 99: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 100: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 101: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

Feeding one combinator to another: Boolean expressions

Consider the combinators T and F defined above.

We will interpret them as true and false, respectively.

Show that we can represent the well-known Boolean functions as follows:

not = λpxy .pyx ,

and = λpq.pqp,

or = λpq.ppq.

One can also show thatandTF = (andT )F = IF = F .

The Grand Unified Theory of Computation Computational Complexity

Page 102: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 103: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 104: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 105: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 106: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 107: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 108: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 109: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 110: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can represent the natural numbers 0, 1, 2, 3, ... in λ-calculus.

We will use the Church numerals, defined as follows:

0̄ = λfx .x ,

1̄ = λfx .fx ,

2̄ = λfx .f (fx),

3̄ = λfx .f (f (fx)).

Given a function f , the Church numeral n̄ returns the function f n, that is, f iterated ntimes:

n̄f = λx .f nx .

The Grand Unified Theory of Computation Computational Complexity

Page 111: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 112: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 113: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 114: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 115: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would.

Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 116: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 117: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 118: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 119: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 120: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 121: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 122: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic?

One can define combinators that carry out arithmetic operations on these numerals.

succ = λmfx .f (mfx)

If m̄ is a numeral, succm̄ applies f one more time than m̄ would. Thus succ acts as thesuccessor function.

Let’s check this, reducing one step at a time:

succn̄ = (λmfx .f (mfx))(λgy .gny)

= λfx .f ((λgy .gny)fx)

= λfx .f ((λy .f ny)x)

= λfx .f (f nx)

= λfx .f n+1x

= n + 1.

The Grand Unified Theory of Computation Computational Complexity

Page 123: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 124: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 125: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 126: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.

One way to do this is:add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 127: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 128: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 129: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 130: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times.

Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 131: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 132: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? The addition

Combinators allow us to write inductive definitions of functions very compactly.

For instance, suppose we want a combinator add that adds two numerals together.One way to do this is:

add = λnmfx .nf (mfx).

Since f m(f n(x)) = f m+n(x), we have

addm̄n̄ = m + n.

Alternatively, we can describe adding n as iterating the successor function n times. Wecould have written:

add ′ = λn.nsucc.

One can show that add and add ′ are equivalent, when applied to Church numerals.

The Grand Unified Theory of Computation Computational Complexity

Page 133: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 134: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 135: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.

Thus ifmult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 136: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 137: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 138: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 139: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Combinators

How about arithmetic? More arithmetic combinators

For multiplication, we use the fact that if we iterate f n m times, we get (f n)m = f n·m.Thus if

mult = λnmf .n(mf ),

we havemultm̄n̄ = m · n.

One can show that ifexp = λnm.mn,

thenexpn̄m̄ = mn.

The Grand Unified Theory of Computation Computational Complexity

Page 140: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 141: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 142: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable,

if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 143: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 144: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 145: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 146: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 147: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 148: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

A function f : N → N is λ-definable, if there is a combinator Φ, such that

Φn̄ = f (n),

for any Church numeral n̄, as long as f (n) is defined.

Can we characterize the class of λ-definable functions?

How expressive is the λ-calculus compared to the recursive functions?

Are all partial recursive functions λ-definable, or vice versa?

How one can prove that the two classes coincide?

The Grand Unified Theory of Computation Computational Complexity

Page 149: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 150: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 151: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 152: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 153: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 154: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 155: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

λ-definable functions

Recall that the partial recursive functions are defined inductively from zero and thesuccessor function using composition, primitive recursion and µ-recursion.

We already have zero and the successor.

We can compose two functions with the following combinator,

comp = λfgx .f (gx),

which takes two functions f , g as input and returns f ◦ g.

Similarly, one can handle primitive recursion by treating it as a for loop.

The Grand Unified Theory of Computation Computational Complexity

Page 156: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Checking conditions

One can show that ifiszero = λn.n(λx .F )T ,

where F and T are defined above, then

iszeron̄xy =

(x , if n = 0y , if n > 0.

The Grand Unified Theory of Computation Computational Complexity

Page 157: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Checking conditions

One can show that ifiszero = λn.n(λx .F )T ,

where F and T are defined above, then

iszeron̄xy =

(x , if n = 0y , if n > 0.

The Grand Unified Theory of Computation Computational Complexity

Page 158: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Checking conditions

One can show that ifiszero = λn.n(λx .F )T ,

where F and T are defined above, then

iszeron̄xy =

(x , if n = 0y , if n > 0.

The Grand Unified Theory of Computation Computational Complexity

Page 159: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Checking conditions

One can show that ifiszero = λn.n(λx .F )T ,

where F and T are defined above,

then

iszeron̄xy =

(x , if n = 0y , if n > 0.

The Grand Unified Theory of Computation Computational Complexity

Page 160: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Checking conditions

One can show that ifiszero = λn.n(λx .F )T ,

where F and T are defined above, then

iszeron̄xy =

(x , if n = 0y , if n > 0.

The Grand Unified Theory of Computation Computational Complexity

Page 161: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 162: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 163: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function,

we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 164: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 165: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y)

= min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 166: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 167: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 168: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input.

It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 169: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 170: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 171: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

Recall that if f (x , y) is a partial recursive function, we can define a function h(x) as thesmallest y such that f (x , y) = 0:

h(x) = µy f (x , y) = min{y : f (x , y) = 0},

assuming that f (x , y) is defined for all y ≤ h(x).

First let Φ be a function which takes a pair (x , y) as input. It explores larger and largervalues of y until it finds one such that f (x , y) = 0, which is its return:

Φ(x , y) =

(y , if f (x , y) = 0Φ(x , y + 1), otherwise.

Then we can write h(x) = Φ(x , 0).

The Grand Unified Theory of Computation Computational Complexity

Page 172: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 173: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 174: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 175: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),

H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 176: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 177: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 178: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 179: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The power of λ

Modeling the µ-recursion

It can be checked thath = λx .Φx 0̄, where Φ = YH,

andY = λR.(λx .R(xx))(λx .R(xx)),H = λΦxy .iszero(fxy)y(Φx(succy)).

This shows that all partial recursive functions are λ-definable.

One can also show that the converse is also true.

Thus the class of partial recursive functions coincides with that of λ-definable functions.

The Grand Unified Theory of Computation Computational Complexity

Page 180: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 181: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 182: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states,

and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 183: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 184: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 185: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 186: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 187: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 188: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

A Turing machine has a ”head”, which can be in finite number of internal states, and a”tape”, where each square contains a symbol drawn from a finite alphabet.

In each step of computation, it observes the symbol at its current location on the tape.

Based on this symbol and its internal state, it then

updates the symbol at its current location on the tape,

updates its internal state, and

moves one step left or right on the tape.

The Grand Unified Theory of Computation Computational Complexity

Page 189: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 190: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 191: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape,

and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 192: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates,

we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 193: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 194: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s,

then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 195: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′,

changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 196: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′,

and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 197: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 198: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 199: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 200: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 201: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

If A is the set of symbols that can appear on the tape, and S is the set of internalstates, we can write the machine’s behavior as a transition function:

F : A× S → A× S × {±1}.

For instance, F (a, s) = (a′, s′,+1) would mean that if the machine sees the symbol aon the tape when it is in state s, then it changes the tape symbol to a′, changes itsstate to s′, and moves to the right.

We start the machine by writing the input string x on the tape, with a special blanksymbol Λ written on the rest of the tape stretching left and right to infinity.

We place the head at one end of the input, and start it in some specific initial state.

The machine uses the tape as its workspace, reading and writing symbols representingits intermediate results until the output is all that remains.

At that point, it enters a special HALT state to announce that it’s done.

The Grand Unified Theory of Computation Computational Complexity

Page 202: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 203: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 204: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 205: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 206: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 207: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s.

Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 208: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1.

Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 209: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 210: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 211: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}.

Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 212: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise.

Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 213: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Definition of a Turing machine

We can think of a Turing machine’s transition function as its ”source code”.

We can write out a table of its values as a finite string of symbols.

Example: The Successor Function

Let A = {Λ, 1}, and let n be represented with (n + 1) 1s. Design a Turing machine thatcomputes the successor function, that is, S(x) = x + 1. Repeat the same withdiagrams.

Example: The parity function

Let A = {Λ, 0, 1}. Design a Turing machine that halts in the state SYES , if in the inputstring the number of 1s is even, and halts in the state SNO-otherwise. Repeat the samewith diagrams.

The Grand Unified Theory of Computation Computational Complexity

Page 214: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 215: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 216: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable,

if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 217: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,

and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 218: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 219: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 220: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Turing machines

Turing-computable functions

We say that a partial function f : N → N is Turing-computable, if there is aTuring-machine that, given input x , halts with f (x) on its input tape if f (x) is defined,and runs forever if f (x) is undefined.

The Grand Unification

It can be shown that the class of Turing-computable functions coincides with that ofpartial recursive functions.

The Grand Unified Theory of Computation Computational Complexity

Page 221: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Church-Turing thesis

The thesis

Any two definitions of computability will result to the same class of computablefunctions.

The Grand Unified Theory of Computation Computational Complexity

Page 222: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Church-Turing thesis

The thesis

Any two definitions of computability will result to the same class of computablefunctions.

The Grand Unified Theory of Computation Computational Complexity

Page 223: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Church-Turing thesis

The thesis

Any two definitions of computability will result to the same class of computablefunctions.

The Grand Unified Theory of Computation Computational Complexity

Page 224: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 225: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 226: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 227: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 228: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure,

and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 229: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window

- namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 230: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 231: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

If a machine has only a finite number of states, with no access to anything but its ownthoughts, then it is doomed to halt or fall into a periodic loop after a finite number ofstates.

However, if we give it access to a memory with an infinite number of possible states,then it is capable of universal computation.

Turing showed that this is the case even if this memory has a simple structure, and themachine can only observe and modify it through a very narrow window - namely thesymbol and its current location on the tape.

Can we make the memory even simpler, and this window even narrower?

The Grand Unified Theory of Computation Computational Complexity

Page 232: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

A counter machine has a finite number of internal states, and access to a finite numberof integer counters.

The only thing it can do to these counters is increment, or decrement them, and theonly question it can ask about them is whether they are zero.

The machine receives its input through the initial state of one of these counters, andlike the Turing machine, it enters a HALT state when it is done.

The Grand Unified Theory of Computation Computational Complexity

Page 233: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

A counter machine has a finite number of internal states, and access to a finite numberof integer counters.

The only thing it can do to these counters is increment, or decrement them, and theonly question it can ask about them is whether they are zero.

The machine receives its input through the initial state of one of these counters, andlike the Turing machine, it enters a HALT state when it is done.

The Grand Unified Theory of Computation Computational Complexity

Page 234: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

A counter machine has a finite number of internal states, and access to a finite numberof integer counters.

The only thing it can do to these counters is increment, or decrement them, and theonly question it can ask about them is whether they are zero.

The machine receives its input through the initial state of one of these counters, andlike the Turing machine, it enters a HALT state when it is done.

The Grand Unified Theory of Computation Computational Complexity

Page 235: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

A counter machine has a finite number of internal states, and access to a finite numberof integer counters.

The only thing it can do to these counters is increment, or decrement them, and theonly question it can ask about them is whether they are zero.

The machine receives its input through the initial state of one of these counters, andlike the Turing machine, it enters a HALT state when it is done.

The Grand Unified Theory of Computation Computational Complexity

Page 236: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

A counter machine has a finite number of internal states, and access to a finite numberof integer counters.

The only thing it can do to these counters is increment, or decrement them, and theonly question it can ask about them is whether they are zero.

The machine receives its input through the initial state of one of these counters, andlike the Turing machine, it enters a HALT state when it is done.

The Grand Unified Theory of Computation Computational Complexity

Page 237: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 238: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 239: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 240: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program,

andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 241: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment),

dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 242: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement),

and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 243: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 244: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 245: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 246: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 247: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

A counter machine

Restricting the memory and the window

We can think of a counter machine as a flowchart or a program in a miniatureprogramming language.

Each internal state corresponds to a node in the flowchart or a line of the program, andthe only allowed instructions are inc (increment), dec (decrement), and conditionalslike if x = 0.

One can show that there is a way of simulating a Turing machine arithmetically.

Specifically, we can transform any Turing machine into a counter machine with justthree counters.

Thus the Halting Problem for three-counter machines is undecidable.

Moreover, three-counter machines can compute any partial recursive function f , bystarting with x in one counter and ending with f (x) in that counter when they halt.

The Grand Unified Theory of Computation Computational Complexity

Page 248: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 249: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 250: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 251: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant,

or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 252: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 253: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices.

This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 254: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 255: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 256: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3.

Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 257: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

We can reduce the number of counters even further.

Consider multiplicative counter machines, where each step can multiply or divide acounter by a constant, or check to see whether a counter is a multiple of someconstant.

Now even a single counter suffices. This is because we can encode three additivecounters as a single multiplicative one:

w = 2x · 3y · 5z .

We can increment or decrement y , say by multiplying or dividing w by 3. Similarly, wecan test whether y 6= 0 by asking whether w is a multiple of 3.

The Grand Unified Theory of Computation Computational Complexity

Page 258: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 259: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 260: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 261: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 262: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u.

If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 263: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 264: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation.

Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 265: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f ,

there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 266: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x ,

ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 267: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x),

or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 268: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Multiplicative counter machines

Reducing the number of counters

But a one-counter multiplicative machine, in turn, can be simulated by a two-counteradditive one.

If we have an additional counter u, we can multiply or divide w by 2, 3 or 5, or check tosee whether w is a multiple of any of these using loops.

For instance, in order to divide w by 3, we decrement w three times for each time weincrement u. If w becomes zero partway though a group of three decrements, we knowthat w is not a multiple of 3.

Thus even two counters suffice for universal computation. Specifically, for any partialrecursive function f , there is a two-counter-machine which, given the initial valuew = 2x , ends with w = 3f (x), or runs forever if f (x) is undefined.

The Grand Unified Theory of Computation Computational Complexity

Page 269: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 270: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 271: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 272: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 273: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 274: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer

(that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 275: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 276: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list.

If there is no suchpq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 277: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 278: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts,

If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 279: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

Here is a program written in a rather odd programming language called FRACTARAN,consisting of a list of fractions:

1791,

7885,

1951,

2338,

2933,

7729,

9523,

7719,

117,

1113,

1311,

1514,

152,

551.

The state of the computer consists of an integer n.

At each step, we run through the list until we find the first fraction pq , such that p

q · n isan integer (that is, the first one whose denominator q divides n).

Then we multiply n by pq , and start again at the beginning of the list. If there is no such

pq in the list, the program halts.

The program mentioned above never halts, If we start it with n = 2, this programproduces the prime numbers x , in increasing order, in the form 2x .

The Grand Unified Theory of Computation Computational Complexity

Page 280: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 281: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 282: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine.

In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 283: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 284: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 285: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 286: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 .

So if both d and f are nonzero, wedecrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 287: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

The program mentioned above is kind of a multiplicative counter machine. In this case,we can write the state in the form

n = 2a · 3b · 5c · 7d · 11e · 13f · 17g · 19h · 23i · 29j

since these are the primes appearing in the fractions’ denominators.

Thus we have 10 counters, which we can increment and decrement by multiplying n byfractions.

For instance, the first fraction in the program is 1791 . So if both d and f are nonzero, we

decrement them and increment g.

The Grand Unified Theory of Computation Computational Complexity

Page 288: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 289: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 290: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 291: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.

Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 292: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 293: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions

Programs as fractions

We already know that additive counters can simulate Turing machines.

With a bit more work, one can covert such a machine into a FRACTARAN program.Thus FRACTARAN is computationally universal.

For any computable function f (x) there is a program that, if given 2x as input, returns3f (x) as output whenever f (x) is well-defined.

The Grand Unified Theory of Computation Computational Complexity

Page 294: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 295: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 296: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 297: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 298: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n,

there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 299: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 300: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it.

However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 301: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

FRACTARAN is related to a deep problem in number theory.

Consider the function

g(x) =

(x2 , if x is even3 · x + 1, if x is odd.

The Collatz Conjecture states that for each n, there is a k , such that gk (n) = 1.

This conjecture has been verified for all n up to 1018, and there are convincing heuristicarguments for it. However, there is still no proof, and resolving it seems quite difficult.

The Grand Unified Theory of Computation Computational Complexity

Page 302: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 303: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 304: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 305: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 306: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 307: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 308: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 309: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz.

Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 310: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

Fantastic Fractions and Collatz Conjecture

The Collatz Conjecture

The 3 · x + 1 function belongs to a family of functions whose behavior depends on xmod q for some q:

g(x) =ai

q· (x − i) + bi , where x = i mod q.

Here ai and bi are integer coefficients for 0 ≤ i < q.

For any function of this form, we can ask whether a given initial x will reach some yafter certain number of iterations:

Problem

Collatz: Given x, y and q, and integer coefficients ai , bi for 0 ≤ i < q. Check whetherthere is an integer t such that gt (x) = y?

Remark

It can be shown that HALTING ≤ Collatz. Thus Collatz is undecidable.

The Grand Unified Theory of Computation Computational Complexity

Page 311: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 312: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 313: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring,

and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 314: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 315: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 316: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 317: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 318: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms,

using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 319: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 320: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 321: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

Emil Post showed that the axioms of the Principia can be reduced to a single initialstring, and that its rules of inference can be replaced with the rules of the followingnormal form:

gs ⇒ sh,

where g and h are fixed strings and s is arbitrary.

In other words, for any string that begins with g, we can remove g from its head andappend h to its tail.

Post was hoping to solve the Entscheidungsproblem by finding an algorithm todetermine whether a given string can be produced from an initial string, representingsystem’s axioms, using a given set of rules {(gi , hi )} in normal form.

In general, the result of such a computation might be non-deterministic, since we mighthave a choice of which rule to apply to a given string.

For instance with the rules {(a, b), (ab, c)}, we could change abc to either bcb or cc.

The Grand Unified Theory of Computation Computational Complexity

Page 322: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 323: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 324: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν,

and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 325: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 326: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a,

and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 327: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 328: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence.

If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 329: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

As a start, Post considered the case where all the gi have the same length ν for someconstant ν, and where each hi is determined by gi ’s first symbol a.

Thus, at each step, if a string begins with the symbol a, we remove its first ν symbolsincluding a, and append the string h(a).

This process is deterministic, so each initial string leads to a fixed sequence. If thissequence reaches a string whose length is less than ν, it halts.

The Grand Unified Theory of Computation Computational Complexity

Page 330: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 331: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 332: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 333: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 334: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 335: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 336: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting:

Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 337: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν,

a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 338: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A,

a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 339: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A,

and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 340: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x,

the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 341: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 342: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting:

Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 343: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x,

thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 344: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh,

it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 345: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied,

that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 346: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Game of Tag

Tag Systems

These are called tag systems.

Post initially expected them to be an easy special case.

Later, he was able to prove that Collatz can be reduced to this problem, hence it isundecidable.

This negative result can be applied in order to derive the undecidability of the followingtwo problems:

Problem

Tag System Halting: Given an integer ν, a finite alphabet A, a string h(a) for eacha ∈ A, and an initial string x, the goal is to check whether x leads to a string of lengthless than ν.

Problem

Normal Form Halting: Given a list of string pairs {(g, h)} and an initial string x, thegoal is to check whether starting from x and applying the rules gs ⇒ sh, it is possibleto derive a string y to which no rule can be applied, that is, which does not begin withany g in the list.

The Grand Unified Theory of Computation Computational Complexity

Page 347: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence: Given a list of pairs of strings (s1, t1), ..., (sk , tk ), the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 348: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence: Given a list of pairs of strings (s1, t1), ..., (sk , tk ), the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 349: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence: Given a list of pairs of strings (s1, t1), ..., (sk , tk ), the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 350: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence:

Given a list of pairs of strings (s1, t1), ..., (sk , tk ), the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 351: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence: Given a list of pairs of strings (s1, t1), ..., (sk , tk ),

the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 352: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

The Correspondence Problem

Post’s Correspondence Problem

Finally, Post was able to prove that the following problem is also undecidable:

Problem

Correspondence: Given a list of pairs of strings (s1, t1), ..., (sk , tk ), the goal is to checkwhether there is a finite sequence i1, i2, ..., il with l ≥ 1, such that si1 si2 ...sil = ti1 ti2 ...til .

The Grand Unified Theory of Computation Computational Complexity

Page 353: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

References

Books

Ch. Moore, S. Mertens, The Nature of Computation, Oxford University Press (2011).

The Grand Unified Theory of Computation Computational Complexity

Page 354: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

References

Books

Ch. Moore, S. Mertens, The Nature of Computation, Oxford University Press (2011).

The Grand Unified Theory of Computation Computational Complexity

Page 355: The Grand Unified Theory of Computation (Part 2)community.wvu.edu/.../lecnotes/GrandTheory2.pdf · The Grand Unified Theory of Computation Computational Complexity. Form is a Function:

Form is a Function: the λ-CalculusTuring’s Applied Philosophy

Computation Everywhere

References

Books

Ch. Moore, S. Mertens, The Nature of Computation, Oxford University Press (2011).

The Grand Unified Theory of Computation Computational Complexity