x+1 - Department of Computer Science

advertisement
Equivalent Formalisms
For
Turing Machine
CS6800
By
Tiba Zaki & Abdalrahman Alsaedi
Equivalent Formalisms
Many machines that might be thought to have more computational
capability than a simple universal Turing machine ,they might compute faster, or
use less memory, or their instruction set might be smaller, but they cannot
compute more powerfully (i.e. more mathematical functions). Some of these
machines are:
* Lambda calculus.
* Tag systems
* Post production systems
* Partial recursive functions
* Conway's Game of Life.
Lambda calculus
• Lambda calculus developed by Alonzo Church.
• While Turing's solution to specific problem is a procedure
Church's solution is like a mathematical specification.
Alonzo Church
Lambda Expression : Function application written in prefix
form.
(+ 4 5)
Ex1: “Add four and five” is
Lambda abstraction :
(λ x. + x 1)
(λ
x
the function of
1
x
.
+
1)
x
that
adds
x to
Example 2
5*6+8*3 is
(+ (* 5 6) (* 8 3))  (+ 30 (*8
3))
 (+ 30 24)
 54
Another example
(λ x . λ y . +x((λx.-x3)y))5 6(λy.+5((λx.-x3)y))
+5((λx.-x3)6)
+5(-6 3)
+53
8
The set of functions that can be defined in the lambda calculus is equal
to the set of functions that can be computed by a Turing machine.
Tag Systems
• Tag systems developed by Polish logician Emil Post (some times
called Tag Machine)
• Tag system is a finite state machine that is augmented with a firstin-first-out (FIFO) queue. In other words, it's a PDA with a FIFO
queue rather than a stack.
• Example
• L = {wwR : w∈ {a, b} *} is context-free language can be accepted by PDA
but L2={ww : w ∈ {a, b} *} is not and can’t be accepted by PDA
• Simply we can build a tag system to accept L2
1. writes the first half of its input string into its queue
2. then removes characters from the head of the queue. one at a time, and
checks each of them against the characters in the second half of the input
string.
Is Tag System equivalent to
Turing machine ?
Simulating a Turing Machine using Tag system:
Let Tag system’s queue corresponds to the TM active
tape plus a blank on either side.
Let the head of the tag system’s queue contain the square that is under
the TM’s read write head.
To move both left and write in the queue, treat the queue as circular and
simulates the transitions as follows:
1. TM’s move right= adding to the tail the symbol that was scanned.
2. TM’s move left= if number of symbols on the queue =n remove n-1
from queue and put in the tail one at a time
3. TM’s moves to the blank=push to the tail two symbols one of them is
nonblank square
Goal
Minimal description of a universally
computational model.
•
Nowadays, tag systems still play a fundamental
role in the race for finding small universal systems.
many small universal systems are proven to be universal
through simulation of 2-tag systems, or some variant of
tag systems.
•
Turing machine
•
Polynomial
2 Tag System
Exponential
Universal Turing
Machine.
•
Can we produce UTM in polynomial time?
Post Production Systems
- The computation is accomplished by applying a set
of production rules.
- Left-hand sides are matched against a current
working string and whose right-hand sides are used
to rewrite the working string.
- Sometimes called Post System
Post Production Systems
Post system P to be a quintuple (V, L, X , R, S), where:
• V is the rule alphabet (nonterminal and terminal)
• ∑ (the set of terminals) is a subset of V,
•
X is a set of variables whose values are drawn from V *,
R (the set of rules) is a finite subset of (V U X)* X (V U X)*,
constraint “every variable that occurs on the right-hand
• side of a rule must also have occurred on the left-hand side.”
•
• S (the start symbol) can be any element of V -∑.
Post Production Systems
Not similar to regular and context free grammar in
1. left-hand side are two or more symbols.
2. rules may contain variables. match any element of V *.
3. A rule may be applied only if its left-hand side matches the
entire working string. So, A  B that replaced an A anywhere
in the string with a B is written as XAY  XBY.
Post Production Systems
L1={ww :w in {a,b}*}
 P=(S,a,b},{a,b},{X},R,S)where R is
1. XSXaS
2. XSXbS
3. XSXX
To generate abbabb
SaSabSabbSabbabb

Partial recursive functions
Recursion is the process of repeating items in
a self-similar way
A child couldn't sleep, so her mother told a story about a little frog,
who couldn't sleep, so the frog's mother told a story about a little bear,
who couldn't sleep, so bear's mother told a story about a little weasel
...who fell asleep.
...and the little bear fell asleep;
...and the little frog fell asleep;
...and the child fell asleep.
Sierpinski Triangle
Fractals are self-similar, recursive structures
Koch Snowflake
Any function whose value may be obtained using a finite number of
operations using a precisely specified algorithm (computation) Or Any
function that uses recursion and can call itself until a certain condition
is met.
Ex: Write the first four terms of the sequence
a1=-4
n=1
n=2 :
a2 = a2-1+ 5 = 1
n=3 :
a2 = a3-1+ 5 = 6
n=4 :
a4 = a4-1+ 5 = 11
a1=-4
an=an-1+5
Recursive function (algorithms)break down a problem into smaller pieces which
you either already know the answer to, or can solve by applying the same
algorithm to each piece, and then combining the results.
void myMethod( int counter)
{
if(counter == 0)
return;
else
{
System.out.println(""+counter);
myMethod(--counter);
return;
}
}
JAVA
parent(David, john).
parent(Jim, David).
parent(Steve, Jim).
parent(Nathan, Steve).
grandparent(A, B) :- parent(A, X), parent(X, B).
PROLOG
Recursion theory originated in the 1930s, with work of
Kut Gödel, Alonzo Church, Alan Turing, Stephen Kleene,
and Emil Post
• A recursive (or countable ) function is one that can be
computed by a Turing Machine that Halts on all inputs
• A partial recursive function is one can be computed by
some Turing Machine (But one can loop if there are
any inputs on which the function is undefined)
The difference between a circular definition and a
recursive definition is that a recursive definition must always
have base cases, cases that satisfy the definition without
being defined in terms of the definition itself, and all other
cases comprising the definition must be "smaller" (closer to
those base cases that terminate the recursion) in some
sense. In contrast, a circular definition may have no base
case, and define the value of a function in terms of that
value itself, rather than on other values of the function.
Kleene (1952) defines a "partial recursive function“(f) as noncontradictory
system of equations whose left and right sides are composed from
(1) function symbols (f,g,h,…)
(2) variables for nonnegative integers (x,y,z,….)
(3) the constant (0)
(4) the successor function S(x)=x+1 .
The set of functions that can be defined recursively in this manner is
known to be equivalent to the set of functions computed by Turing
Machine and by the Lambda Calculus
In Pascal terms, the primitive recursive functions are the FOR loop
computable functions, while the general recursive functions the
terminating WHILE and REPEAT loop computable functions.
Partial Recursive Function
general Recursive Function
Primitive Recursive Function
Algorithms ⇔ Turing Machines ⇔ Recursive Functions
⇔ Tag System ⇔ Post System
⇔
λ-Calculus
Conway's Game of Life
Cellular Automaton (CA)
A Cellular Automaton (CA), first invented by John
von Neumann, is an infinite, regular grid (lattice)
of simple finite state (cells) machines that change
their states synchronously, according to a local
update rule that specifies the new state of each
cell based on the old states of its neighbors.
J. Neumann
The local update rule asks each cell to check the present states of the
eight surrounding cells.
• If the cell is alive then it stays alive (survives) if and only if it has two
or three live neighbors. Otherwise it dies of loneliness or
overcrowding.
• If the cell is dead then it becomes alive if and only if it has exactly
three living neighbors.
All cells apply this rule simultaneously. As the process is repeated
over and over again, a dynamical system is obtained that exhibits
surprisingly complex behavior.
Conway's Game of Life
CA invented by John Horton Conway's 1970 in Cambridge
The Game of Life, also known simply as Life. The
"game" is a zero-player game, meaning that its
evolution is determined by its initial state,
requiring no further input.
J. Conway
Conway's laws are simple. The rules are:
1
2
3
4
x
5
6
7
8
• Any alive cell that is touching less than two alive neighbors
dies.
• Any alive cell touching four or more alive neighbors dies.
• Any alive cell touching two or three alive neighbors does
nothing.
• Any dead cell touching exactly three alive neighbors
becomes alive.
1
1
1
2
1
2
1
2
3
2
1
3
2
3
1
1
2
1
1
2
1
2
1
2
3
2
1
1
1
1
1
1
1
2
1
2
3
2
3
2
1
2
1
1
1
We write a rule as
E1,E2, . . . /F1,F2, . . .
Where:
Ei : the number of live neighbors required to keep a living cell alive,
Fi : give the number required to bring a nonliving cell to life.
Thus the rule for the CA given above is 2,3/3.
Here we see a few of the small gliders that exist for 2,3/2.
It was soon discovered that Game-of-Life is a universal
computer: for any given Turing machine M and input word
w one can effectively construct a start configuration C to
the Game-of-Life such that all cells eventually die if and
only if M accepts w.
Some of application
Cryptography : generate long unpredictable key.
Networking : Optimizing problem
References
E. Rich (2008). “Automata, Computability and Complexity THEORY AND
Application's”, Person.
A. Adamatzky (2010). “Game of Life Cellular Automata”. Springer
Zenil, H. (2008, March 25). “Some notes on the foundations of universal
computation and the decidability”. universality frontier. Retrieved from
http://www.mathrix.org/experimentalAIT/universality.pdf
Woods, D. (2006, December).”On the time complexity of 2-tag systems and
small universal Turing machines”. Retrieved from http://www.cs.nuim.ie/~
tneary.
M. Gymrek (May, 2010). “Conway’s Game of Life”. Retrieved from
https://www.google.com/#q=Conway%E2%80%99s+Game+of+Life+Melissa
+Gymrek+May+2010
http://mathworld.wolfram.com/GeneralRecursiveFunction.html
http://legacy.earlham.edu/~peters/courses/logsys/recursiv.htm
http://legacy.earlham.edu/~peters/courses/logsys/recursiv.htm
Download