8/13/2019 MELJUN CORTES Automata Theory 15
1/36
(MSCS) Theory of Automata & Formal
Turing Machines
Fall 2008
MELJUN P. CORTES MBA MPA BSCS ACS
MELJUN CORTES
8/13/2019 MELJUN CORTES Automata Theory 15
2/36
8/13/2019 MELJUN CORTES Automata Theory 15
3/36
Are DFAs and PDAscomputers?
0, e / a
#, e / e e, Z0 / e
1, a / e 0
1
0, 1
A computer is a machine that manipulates dataaccording to a list of instructions .
yes
no!
8/13/2019 MELJUN CORTES Automata Theory 15
4/36
A short history of computingdevices
Leibniz calculator (1670s)
slide rule (1600s)
abacus(Babylon 500BC, China 1300)
Babbagesmechanicalengine
(1820s)
8/13/2019 MELJUN CORTES Automata Theory 15
5/36
A brief history of computingdevices
Z3 (Germany, 1941) ENIAC (Pennsylvania, 1945)
PC (1980) MacBook Air (2008)
8/13/2019 MELJUN CORTES Automata Theory 15
6/36
Which of these are realcomputers?
not programmable
programmable
8/13/2019 MELJUN CORTES Automata Theory 15
7/36
Computation is universal
In principle, all these computershave the same problem-solving ability
C++ java python LISP
8/13/2019 MELJUN CORTES Automata Theory 15
8/36
The Turing Machine
C++ java python LISP
Turing Machine
8/13/2019 MELJUN CORTES Automata Theory 15
9/36
The Turing Machine
The Turing Machine is an abstractautomaton that ismeant to model any physically realizablecomputer
Using any technology (mechanical, electrical,nano, bio)
Under any physical laws (gravity, quantum,E&M)
At any scale (human, quantum, cosmological)
8/13/2019 MELJUN CORTES Automata Theory 15
10/36
Computation and mathematicalproofs
Prove that...2 is irrational.
The equationx n + y n = z n , n 2
has no integer solutions.
G = ( L , R ) has a perfect matchingiff | G( S )| | S | for every L S .
L {1}* is regular iffL = L 0 L q 1,r ... L qk,r
The language 0n 1n is not regular.
Math is hard, lets go shopping!
(Archimedes Theorem)
(Fermat-Wiles Theorem)
(Halls Theorem)
8/13/2019 MELJUN CORTES Automata Theory 15
11/36
Hilberts list of 23 problems Leading mathematician in the1900s
At the 1900 InternationalCongressof Mathematicians, proposeda list of23 problems for the 20 th century
David Hilbert(1862-1943)
Find a method for telling if an equation likexyz 3xy + 6 xz + 2 = 0 has integer solutions
8/13/2019 MELJUN CORTES Automata Theory 15
12/36
Automated theorem-proving
computer
input data
instructions
output
The equationx n + y n = z n , n 2
has no integer solutions.
check ifthey are true! true / false
8/13/2019 MELJUN CORTES Automata Theory 15
13/36
Automated theorem proving
How could automated theorem provingwork?
Lets look at a typical proof: 2 is irrational. Assume not.Then 2 = m / n .Then m 2 = 2 n 2 But m 2 has an even number of prime factors
and 2n 2 has an odd number of prime factors.Contradiction.
Theorem:
Proof:
8/13/2019 MELJUN CORTES Automata Theory 15
14/36
First idea of automated theoremproving
Checking that a proof is correct is mucheasier thancoming up with the proof
Assume not. Then 2 = m / n .Then m 2 = 2 n 2 But m 2 has an even ...
and 2n 2 has an odd ...Contradiction.
Proof:
... if we write out the proof in sufficient detail
2 = m / n both sides n
( 2)n = m square ( 2)2n 2 = m 2 def of sqrt 2n 2 = m 2
8/13/2019 MELJUN CORTES Automata Theory 15
15/36
First idea of automated theoremproving
Checking that a proof is correct is mucheasier thancoming up with the proof
In principle this is uncontroversialIn practice, it is hard to do because writingproofs indetail sometimes requires a lot of work
A proof, if written out in sufficient detail,canbe checked mechanically
8/13/2019 MELJUN CORTES Automata Theory 15
16/36
Second idea of automatedtheorem proving
To find if statement is true, why dont wetry allpossible proofs
After all, a proof is just a sequence ofsymbols (over
alphabet {0, 1, 2, m , n , , 2, etc.})
If statement is true, it has a proof of
finite length, say k
2 = m / n ( 2)n = m ( 2)2n 2 = m 2 2n 2 = m 2
...
8/13/2019 MELJUN CORTES Automata Theory 15
17/36
Knigsberg, 1930
David Hilbert(1862-1943)
Kurt Gdel(1906-1978)
September 8: Hilbert gives a famous lectureLogic and the understanding of nature
8/13/2019 MELJUN CORTES Automata Theory 15
18/36
Knigsberg, 1930
David Hilbert(1862-1943)
Kurt Gdel(1906-1978)
John von Neumann(1903-1957)
I reached the conclusion that in any reasonable formalsystem in which provability in it can be expressed as aproperty of certain sentences, there must be propositions
which are undecidable in it.
It is all over!
8/13/2019 MELJUN CORTES Automata Theory 15
19/36
What did Gdel say?
To find if statement is true, why dont wetry allpossible proofs
After all, a proof is just a sequence ofsymbols (over
alphabet {0, 1, 2, m , n , , 2, etc.})
If statement is true, it has a proof of
finite length, say k
NO!
8/13/2019 MELJUN CORTES Automata Theory 15
20/36
Gdels incompletenesstheorem
Some mathematicalstatementsare true but not provable .
What are they?
8/13/2019 MELJUN CORTES Automata Theory 15
21/36
Example of incompleteness
Recall Hilberts 10th problem:
Matyashievich showed in 1970 that there
exists apolynomial p such that
Find a method for telling if an equation likexyz 3xy + 6 xz + 2 = 0 has integer solutions
p( x 1 , ..., x k ) = 0 has no integer solutions, butthis cannot be proved
8/13/2019 MELJUN CORTES Automata Theory 15
22/36
Another example ofincompleteness
Recall ambiguous context free grammars
We did exercises of the type
Show thatG is ambiguous
However there exists a CFG G such thatG is unambiguous, but this cannot beproved
8/13/2019 MELJUN CORTES Automata Theory 15
23/36
Gdels incompletenesstheorem
Some mathematicalstatementsare true but not provable .
What does this have to do with computer science?
8/13/2019 MELJUN CORTES Automata Theory 15
24/36
The father of modern computerscienceInvented the Turing Test totellhumans and computersapartBroke German encryptioncodesduring World War IIThe Turing Award is theNobel prize of Computer
Alan Turing(1912-1954)
On Computable Numbers, with an Application to the
Entscheidungsproblem
1936:
8/13/2019 MELJUN CORTES Automata Theory 15
25/36
Turings angle onincompleteness
computerinput data
instructionsoutput
check if true! true / false
mathematical statement
Gdels theorem says that a computer cannotdetermine the truth of mathematical statements
But there are many other things!
8/13/2019 MELJUN CORTES Automata Theory 15
26/36
Computer program analysispublic static void main(String args[]) {
System.out.println("Hello World!");}
What does this program do?
How about this one?
public static void main(String args[]) {int i = 0;for (j = 1; j < 10; j++) {
i += j;if (i == 28) {
System.out.println("Hello World!");}
}}
8/13/2019 MELJUN CORTES Automata Theory 15
27/36
Computers cannot analyzeprograms!
computerinput data
instructions
output
does it print Hello, world!
javaprogram
The essence of Gdels theorem is that computers cannot analyze computer programs
8/13/2019 MELJUN CORTES Automata Theory 15
28/36
How do you argue things likethat?
To argue what computers cannot do,we need to have a precise definitionof what a computer is.
On Computable Numbers, with an Application to the Entscheidungsproblem
1936:
Section 1. Computing Machines
8/13/2019 MELJUN CORTES Automata Theory 15
29/36
Turing Machines
state control
A Turing Machine is a finite automaton with atwo-way access to an infinite tape
Initially, the first few cells contain the input, andtheother cells are blank
infinite tape0 1 0
input
8/13/2019 MELJUN CORTES Automata Theory 15
30/36
Turing Machines
state control
At each point in the computation, the machineseesits current state and the symbol at the head
It can replace the symbol on the tape, changestate ,and move the head left or right
0 1 a 0
head
8/13/2019 MELJUN CORTES Automata Theory 15
31/36
Example
0 1 a 0q 1 q 2
a/bL
Replace a with b, and move head left
current state
0 1 b 0q 1 q 2
a/bL
current state
8/13/2019 MELJUN CORTES Automata Theory 15
32/36
Formal Definition
A Turing Machine is (Q, , G, , q 0, q acc, q rej ):Q is a finite set of states ;
is the input alphabet ;G is the tape alphabet ( G) including theblank symbol q 0 in Q is the initial state ;
q acc, q rej in Q are the accepting and rejectingstate ;
is the transition function
: (Q {q acc, q rej}) G Q G {L, R}
Turing Machines are deterministic
8/13/2019 MELJUN CORTES Automata Theory 15
33/36
Language of a Turing Machine
The language recognized by a TM is theset of allinputs that make it reach q acc
Something strange can happen in a TuringMachine:q 0
q acc
q rej
= {0, 1}input: e
/ R
This machinenever halts
8/13/2019 MELJUN CORTES Automata Theory 15
34/36
Looping behavior
Inputs can be divided into three types:1. Reach the state q acc and halt2. Reach the state q rej and halt3. Loop forever
The language recognized by a TM = type1 inputs
8/13/2019 MELJUN CORTES Automata Theory 15
35/36
The Church-Turing Thesis
Turing Machinequantum computing
DNA computing
cosmic computing
8/13/2019 MELJUN CORTES Automata Theory 15
36/36
The Church-Turing Thesis
On Computable Numbers, with an Application to the Entscheidungsproblem
1936:
Section 9. The extent of the computable numbers
All arguments [for the CT Thesis] which can be given arebound to be, fundamentally, appeals to intuition, and for thisreason rather unsatisfactory mathematically. The arguments which I shall use are of three kinds:
1. A direct appeal to intuition2. A proof of the equivalence of two definitions
(In case the new definition has greater intuitive appeal)3. Giving examples of large classes of numbers which are
computable.