Computational Complexity I: From finite automata to Turing machines

Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computational Complexity I:
From finite automata to Turing machines
Maria-Eirini Pegia
Seminar on Theoretical Computer Science and Discrete Mathematics
Aristotle University of Thessaloniki
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Context
1
Section 1: Decision and Optimization Problems
2
Section 2: Finite Automata - Recognizable Languages
3
Section 3: Context-free Grammars - Context-free Languages
4
Section 4: Turing Machines
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
What is a decision problem?
Definition
In computability theory and
computational complexity theory,
a decision problem is a question
in some formal system with a
yes-or-no answer, depending on
the values of some input
parameters.
Figure: A decision problem has only
two possible outputs, yes or no
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computational Theory
Decision problems typically appear in mathematical questions
of decidability, that is, the question of the existence of an
effective method to determine the existence of some object or
its membership in a set.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computational Theory
Decision problems typically appear in mathematical questions
of decidability, that is, the question of the existence of an
effective method to determine the existence of some object or
its membership in a set.
Can we solve all the problems?
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computational Theory
Decision problems typically appear in mathematical questions
of decidability, that is, the question of the existence of an
effective method to determine the existence of some object or
its membership in a set.
Can we solve all the problems?
† NO!!!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computational Theory
Decision problems typically appear in mathematical questions
of decidability, that is, the question of the existence of an
effective method to determine the existence of some object or
its membership in a set.
Can we solve all the problems?
† NO!!!
Why some problems are not
solving by computers?
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Hilbert (1900): Completeness and automation of mathematics
10th Problem: Algorithm for diophantine equation
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Hilbert (1900): Completeness and automation of mathematics
10th Problem: Algorithm for diophantine equation
Algorithm: Expression and Proof of correctness
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Hilbert (1900): Completeness and automation of mathematics
10th Problem: Algorithm for diophantine equation
Algorithm: Expression and Proof of correctness
Does an algorithm exist?
Definition of ”algorithm” with a computational model and the
proof that the existence of an algorithm leads to
contradictions.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Gödel: Mathematics are not complete!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Gödel: Mathematics are not complete!
Turing: Mathematics are not automating!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Gödel: Mathematics are not complete!
Turing: Mathematics are not automating!
There are problems that are not computable.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Gödel: Mathematics are not complete!
Turing: Mathematics are not automating!
There are problems that are not computable.
Some of the most important
problems in mathematics are
undecidable!!!
,,,
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Why some problems aren’t solving by computers?
Gödel: Mathematics are not complete!
Turing: Mathematics are not automating!
There are problems that are not computable.
Some of the most important
problems in mathematics are
undecidable!!!
,,,
Matijasevic (1970): There is no algorithm for the solution of
every diophantine equation. For every algorithm A there is an
equation that A answers false!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Snapshot: object that corresponds to entry data.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Snapshot: object that corresponds to entry data.
We set a question and we wait the answer.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Snapshot: object that corresponds to entry data.
We set a question and we wait the answer.
Infinity set of snapshots.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Snapshot: object that corresponds to entry data.
We set a question and we wait the answer.
Infinity set of snapshots.
Algorithm: clearly defined process for the solution of a
problem in finite time by a computational machine (Turing).
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Computable Problem and algorithm
(Computable) problem: defines a mapping from input data to
export data.
Intuitively: is defined by a question for entry snapshots
Snapshot: object that corresponds to entry data.
We set a question and we wait the answer.
Infinity set of snapshots.
Algorithm: clearly defined process for the solution of a
problem in finite time by a computational machine (Turing).
Ô
We see TM below!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example: travelling salesman problem (TSP)
Decision Problem
Given a list of cities and the distances between each pair of cities,
is there a possible route that visits each city exactly once and
returns to the origin city?
Optimization Problem
Given a list of cities and the distances between each pair of cities,
find the shortest (minimum cost) possible route that visits each
city exactly once and returns to the origin city.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Problems and Formal Languages
Optimization Problem
Ðreduction
ÐÐÐÐ
Maria-Eirini Pegia
Decision Problem with bound B
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Problems and Formal Languages
Optimization Problem
Ðreduction
ÐÐÐÐ
Decision Problem with bound B
Ì Minimization: § optimal solution with cost B B?
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Problems and Formal Languages
Optimization Problem
Ðreduction
ÐÐÐÐ
Decision Problem with bound B
Ì Minimization: § optimal solution with cost B B?
Ì Maximization: § optimal solution with gain C B?
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Problems and Formal Languages
Optimization Problem
Ðreduction
ÐÐÐÐ
Decision Problem with bound B
Ì Minimization: § optimal solution with cost B B?
Ì Maximization: § optimal solution with gain C B?
Ì Optimization Problem is solved (in polynomial time)
iff
the corresponding Decision Problem is solved (in polynomial time).
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Finite Automata - Recognizable Languages
Examples:
Í L= ab 8 aab
ˆ
Í L= ( ab
ˆ
Í L=
ˆˆ

‡

‡
8 bc
ˆ

‡ )ab
ab 8 aba‡ a‡
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not recognizable?
L=˜ an b n S nC0

(is recognizable?)
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not recognizable?
L=˜ an b n S nC0

(is recognizable?)
(NO!!!)
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not recognizable?
L=˜ an b n S nC0

(is recognizable?)
(NO!!!)
Can we do something better with another computational model???
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not recognizable?
L=˜ an b n S nC0

(is recognizable?)
(NO!!!)
Can we do something better with another computational model???
YES!!!
We will see it in the next section
Maria-Eirini Pegia
,,,
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Context-free Grammars - Context-free Languages
Definition
G=(X,V,S,R): context-free grammar
X: terminals,
V: variables,
S: axiom,
R b V x ˆV
8X

‡ rules
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Examples
Í L = an bn nC0 is context-free???
˜
S

Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Examples
Í L = an bn nC0 is context-free??? YES!!!
˜
S

Maria-Eirini Pegia
ƒˆ
Y Y /

Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Examples
Í L = an bn nC0 is context-free??? YES!!!
˜
S

Í L = ww R w > a, b
˜
S
Í L = w > a, b
˜
˜
˜

‡
S

‡
ƒˆ
Y Y /


w = wR
Maria-Eirini Pegia

Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not context-free?
L=
˜
ww S w > ˜a, b ‡

(is context-free?)
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not context-free?
L=
˜
ww S w > ˜a, b ‡

(is context-free?) (NO!!!)
Can we do something better with another computational model???
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
How I can show that a language is not context-free?
L=
˜
ww S w > ˜a, b ‡

(is context-free?) (NO!!!)
Can we do something better with another computational model???
YES!!! We will see it in the next section
Maria-Eirini Pegia
,,,
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
δ: Q x Γ
Ð
Q x Γ x ˜L, R 
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
Ð
δ: Q x Γ
Q x Γ x ˜L, R 
- L, R standing for ’left’ and ’right’ direction, respectively
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
Ð
δ: Q x Γ
Q x Γ x ˜L, R 
- L, R standing for ’left’ and ’right’ direction, respectively
q0 > Q: initial state
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
Ð
δ: Q x Γ
Q x Γ x ˜L, R 
- L, R standing for ’left’ and ’right’ direction, respectively
q0 > Q: initial state
B > Γ: blank symbol
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Definition
M = (Q, Σ, Γ, δ, q0 , B, F): Turing Machine (TM)
Q: set of states,
Σ: finite set of inputs,
Γ: complete set of tape symbols, Σ ` Γ,
Ð
δ: Q x Γ
Q x Γ x ˜L, R 
- L, R standing for ’left’ and ’right’ direction, respectively
q0 > Q: initial state
B > Γ: blank symbol
F ` Q: final states
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 1: printing 110
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 1: printing 110
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 1: printing 110
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 1: printing 110
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 1: printing 110
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 2: bit inversion of 110
Maria-Eirini Pegia
, !!!
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 2: bit inversion of 110
Maria-Eirini Pegia
, !!!
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 2: bit inversion of 110
Maria-Eirini Pegia
, !!!
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 2: bit inversion of 110
Maria-Eirini Pegia
, !!!
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 3: bit inversion of 001
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 3: bit inversion of 001
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 3: bit inversion of 001
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 3: bit inversion of 001
Figure: Example 1 and 2 ’together’
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 4
M = (Q, Σ, Γ, δ, q0 , B, F)
Q = ˜q0 , q1 , q2 , q3 , q4 , Σ = ˜0, 1, Γ = ˜0, 1, X , Y , B , F = ˜q4 ,
δ: Q x Γ
Ð
Q x Γ x ˜L, R 
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 4
Figure: L =˜ 0n 1n S n C 1
Maria-Eirini Pegia

Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 4
Í q0 0011 ؇ Xq1 011 ؇ X0q1 11 ؇ Xq2 0Y1 ؇ q2 X0Y1 ؇
Ø
Ø
Ø
Ø
Ø
Ø
Ø
Xq0 0Y1 ‡ XXq1 Y1 ‡ XXYq1 1 ‡ XXq2 YY ‡ Xq2 XYY ‡
XXq0 YY ‡ XXYq3 Y ‡ XXYYq3 B ‡ XXYYBq4 B
Maria-Eirini Pegia
Ø
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example 4
Í q0 0011 ؇ Xq1 011 ؇ X0q1 11 ؇ Xq2 0Y1 ؇ q2 X0Y1 ؇
Ø
Ø
Ø
Ø
Ø
Ø
Ø
Ø
Í q0 0010 ؇ Xq1 010 ؇ X0q1 10 ؇ Xq2 0Y0 ؇ Xq0 0Y0 ؇
XXq1 Y0 ؇ XXYq1 0 ؇ XXY0q1 B
Xq0 0Y1 ‡ XXq1 Y1 ‡ XXYq1 1 ‡ XXq2 YY ‡ Xq2 XYY ‡
XXq0 YY ‡ XXYq3 Y ‡ XXYYq3 B ‡ XXYYBq4 B
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
L(M) =
˜
Ø
w > Σ‡ S q0 w ‡ upv for some p > F and any u,v > Γ

recursively enumerable languages: the recognizable languages in
TM
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
An equivalent model: Unrestricted Grammars
Definition
G=(X,V,S,R): unrestricted grammar
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
An equivalent model: Unrestricted Grammars
Definition
G=(X,V,S,R): unrestricted grammar
X: terminals
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
An equivalent model: Unrestricted Grammars
Definition
G=(X,V,S,R): unrestricted grammar
X: terminals
V: set of nonterminal symbols, X
Maria-Eirini Pegia
9V=g
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
An equivalent model: Unrestricted Grammars
Definition
G=(X,V,S,R): unrestricted grammar
X: terminals
V: set of nonterminal symbols, X
9V=g
S > V: axiom
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
An equivalent model: Unrestricted Grammars
Definition
G=(X,V,S,R): unrestricted grammar
X: terminals
V: set of nonterminal symbols, X
9V=g
S > V: axiom
R: rules of the form u
Ô
w,
Maria-Eirini Pegia
u, w > ˆV
8 X ‡, w x 
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example
L=
˜
ww S w > ˜a, b ‡

is recursively enumerable???
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example
L=
˜
YES!!!
ww S w > ˜a, b ‡
ƒˆ

is recursively enumerable???
Y Y /

Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example
L=
˜
YES!!!
ww S w > ˜a, b ‡
ƒˆ

is recursively enumerable???
Y Y /

G = (˜S, F , M, A, B , ˜a, b , S, R): unrestricted grammar
Ð FM, F Ð FaA, F Ð FbB, Aa Ð aA, Ab Ð bA,
Ð aB, Bb Ð bB, AM Ð Ma, BM Ð Mb, F Ð ε,
Ð ε
S
Ba
M
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Example
ÍS
ÍS
Ô
Ô
=a
ÍS
εM
Ô
(FaA)M
2
Ô
εε = ε
Ô
Fa(Ma)
Ô
Ô
εaMa
Ô
aεa
Ô
aa
Ô (FbB)(aAM) Ô
Ô FbaB(AM) Ô
Ô Fba(bM)a Ô
(FaA)M
F(aAM)
Fb(Ba)AM
Fb(aB)BAM
FbaB(Ma)
Fba(BM)a
baba = ˆba2
Ô
Ô
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Thesis Church - Turing
Thesis Church - Turing
If a problem can be solved with an algorithm, then there is a
TM which solves the problem.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Thesis Church - Turing
Thesis Church - Turing
If a problem can be solved with an algorithm, then there is a
TM which solves the problem.
extended models of TM
- DTM
- Nondeterministic TM
- Restricted TM
- Multitape TM
.
.
.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Halting Problem is undecidable
)
"
_
_
\_( )_/
Í In computability theory, the halting problem is the problem of
determining, from a description of an arbitrary computer program
and an input, whether the program will finish running or continue
to run forever.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Halting Problem is undecidable
)
"
_
_
\_( )_/
Í In computability theory, the halting problem is the problem of
determining, from a description of an arbitrary computer program
and an input, whether the program will finish running or continue
to run forever.
Í Alan Turing (1936) proved that a general algorithm to solve the
halting problem for all possible program-input pairs cannot exist.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
References
J. E. Hopcroft and J. D. Ullman. Introduction to Automata
Theory, Languages, and Computation. Boston:
Addison-Wesley, c2001.
C. H. Papadimitriou. Computational Complexity. Reading,
Mass.: Addison-Wesley, 1994.
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Next
_
_
) )
" "
)
"
_\_( )_/ _
_\_( )_/ _
) )
" " "
_\_( )_/ _ Asymptotic Notation!!!
_\_( )_/ _
_\_( )_/ _
\_( )_/
_
\_( )_/
"
_ Classification Algorithms!!!
\_( )_/
" "
)
_
)
_
)
_
_
\_( )_/
)
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac
Section 1: Decision and Optimization Problems
Section 2: Finite Automata - Recognizable Languages
Section 3: Context-free Grammars - Context-free Languages
Section 4: Turing Machines
Thank you!!!
Maria-Eirini Pegia
Computational Complexity I: From finite automata to Turing mac