Lecture Note 4

CSCI 2670 Introduction to Theory of Computing
Lecture Note 4
Computability Theory: Chapter 3 and Chapter 4
April 27, 2015
Part Two: Computability Theory
Part Two: Computability Theory
We will answer questions:
Part Two: Computability Theory
We will answer questions:
• How to recognize languages like {an bn cn : n ≥ 0} ?
Part Two: Computability Theory
We will answer questions:
• How to recognize languages like {an bn cn : n ≥ 0} ?
• More difficult languages and models that can compute them ?
Part Two: Computability Theory
We will answer questions:
• How to recognize languages like {an bn cn : n ≥ 0} ?
• More difficult languages and models that can compute them ?
• Are there “not computable” languages ?
Chapter 3. Church-Turing Thesis
Chapter 3. Church-Turing Thesis
I
3.1 Turing Machines (TMs)
Formal definition of the most basic TM model, examples;
Chapter 3. Church-Turing Thesis
I
3.1 Turing Machines (TMs)
Formal definition of the most basic TM model, examples;
I
3.2 Variant of TMs
Extended models but all equivalent to the basic TM
Chapter 3. Church-Turing Thesis
I
3.1 Turing Machines (TMs)
Formal definition of the most basic TM model, examples;
I
3.2 Variant of TMs
Extended models but all equivalent to the basic TM
I
3.3 Definition of Algorithms
Church-Turing thesis (basic TM mode is the most powerful
computing machine)
Chapter 3. Church-Turing Thesis
I
3.1 Turing Machines (TMs)
Formal definition of the most basic TM model, examples;
I
3.2 Variant of TMs
Extended models but all equivalent to the basic TM
I
3.3 Definition of Algorithms
Church-Turing thesis (basic TM mode is the most powerful
computing machine)
The first problem that does not have algorithm to solve
(Hilbert’s 10th problem)
Chapter 4. Decidability
Chapter 4. Decidability
I
4.1 Decidable Languages
Various decidable languages concerning computation models;
Chapter 4. Decidability
I
4.1 Decidable Languages
Various decidable languages concerning computation models;
I
4.2 The Halting problem
The halting problem is not decidable, proof
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
(2) a read head moving left and right on input and beyond,
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
(2) a read head moving left and right on input and beyond,
and can read and write on the input tape,
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
(2) a read head moving left and right on input and beyond,
and can read and write on the input tape,
(3) a set of states and transitions, and
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
(2) a read head moving left and right on input and beyond,
and can read and write on the input tape,
(3) a set of states and transitions, and
(4) accept and reject states, for the machine to halt.
Chapter 3. The Church-Turing Thesis
3.1 Turing Machines
A Turing machine (TM) consists of
(1) an infinite input tape, where the input is placed,
(2) a read head moving left and right on input and beyond,
and can read and write on the input tape,
(3) a set of states and transitions, and
(4) accept and reject states, for the machine to halt.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Notes:
• A TM has “random access memory”, more powerful than a PDA.
Chapter 3. The Church-Turing Thesis
Notes:
• A TM has “random access memory”, more powerful than a PDA.
e.g., recognizing L = {w#w : w ∈ {0, 1}∗ }
Chapter 3. The Church-Turing Thesis
Notes:
• A TM has “random access memory”, more powerful than a PDA.
e.g., recognizing L = {w#w : w ∈ {0, 1}∗ }
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
• A TM may not halt,
Chapter 3. The Church-Turing Thesis
• A TM may not halt,
e.g., keep moving to the right on the infinite tape.
Chapter 3. The Church-Turing Thesis
• A TM may not halt,
e.g., keep moving to the right on the infinite tape.
There are 3 possible outcomes of the TM computation:
Chapter 3. The Church-Turing Thesis
• A TM may not halt,
e.g., keep moving to the right on the infinite tape.
There are 3 possible outcomes of the TM computation:
(1) accept and halt; (2) reject and halt; (3) not halt;
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1. Q is the set of states,
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1. Q is the set of states,
2. Σ is the input alphabet, not including the blank symbol t,
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1. Q is the set of states,
2. Σ is the input alphabet, not including the blank symbol t,
3. Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
5.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
q0 ∈ Q is the start state,
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
5.
6.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
q0 ∈ Q is the start state,
qaccept ∈ Q is the accept state, and
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
5.
6.
7.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
q0 ∈ Q is the start state,
qaccept ∈ Q is the accept state, and
qreject ∈ Q is the reject state, where qaccept 6= qreject .
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
5.
6.
7.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
q0 ∈ Q is the start state,
qaccept ∈ Q is the accept state, and
qreject ∈ Q is the reject state, where qaccept 6= qreject .
- about input tape:
when it starts, the input tape has content x1 x2 . . . xn , and
the rest of the tape consists of blank symbols t’s
Chapter 3. The Church-Turing Thesis
Formal definition of a Turing machine
Definition 3.3
A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0 , qaccept , qreject ), where Q, Σ, Γ
are all finite sets, and
1.
2.
3.
4.
5.
6.
7.
Q is the set of states,
Σ is the input alphabet, not including the blank symbol t,
Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ,
δ : Q × Γ −→ Q × Γ × {L, R} is the transition function,
q0 ∈ Q is the start state,
qaccept ∈ Q is the accept state, and
qreject ∈ Q is the reject state, where qaccept 6= qreject .
- about input tape:
when it starts, the input tape has content x1 x2 . . . xn , and
the rest of the tape consists of blank symbols t’s
- about transition function δ:
δ : Q × Γ −→ Q × Γ × {L, R}
cannot move off the leftmost position, even if L is used.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
A simple example of transition function for a Turing machine
Chapter 3. The Church-Turing Thesis
A simple example of transition function for a Turing machine
δ(q0 , 0) = (q0 , 0, R)
δ(q0 , 1) = (qaccept , 0, R)
δ(q0 , t) = (qreject , 0, R)
Chapter 3. The Church-Turing Thesis
A simple example of transition function for a Turing machine
δ(q0 , 0) = (q0 , 0, R)
δ(q0 , 1) = (qaccept , 0, R)
δ(q0 , t) = (qreject , 0, R)
What does it do?
Chapter 3. The Church-Turing Thesis
A simple example of transition function for a Turing machine
δ(q0 , 0) = (q0 , 0, R)
δ(q0 , 1) = (qaccept , 0, R)
δ(q0 , t) = (qreject , 0, R)
What does it do?
Will it halt eventually?
Chapter 3. The Church-Turing Thesis
A simple example of transition function for a Turing machine
δ(q0 , 0) = (q0 , 0, R)
δ(q0 , 1) = (qaccept , 0, R)
δ(q0 , t) = (qreject , 0, R)
What does it do?
Will it halt eventually?
Can you modify the transition function for a more complicated task?
e.g., checking if the numbers of 0s and 1s are the same.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
The notion of configuration
Chapter 3. The Church-Turing Thesis
The notion of configuration
to define the machine status at any moment
(1) current state,
(2) current read head position,
(3) current tape content,
Chapter 3. The Church-Turing Thesis
The notion of configuration
to define the machine status at any moment
(1) current state,
(2) current read head position,
(3) current tape content,
e.g., configuration
1 0 1 1q7 0 1 1 1 1, assume Σ = {0, 1},
Chapter 3. The Church-Turing Thesis
The notion of configuration
to define the machine status at any moment
(1) current state,
(2) current read head position,
(3) current tape content,
e.g., configuration
1 0 1 1q7 0 1 1 1 1, assume Σ = {0, 1},
e.g., initial configuration, assume Σ = {a, b, c}, Γ = Σ ∪ {#, $, &, t}
q0 a a a a b b b b c c c c
Chapter 3. The Church-Turing Thesis
The notion of configuration
to define the machine status at any moment
(1) current state,
(2) current read head position,
(3) current tape content,
e.g., configuration
1 0 1 1q7 0 1 1 1 1, assume Σ = {0, 1},
e.g., initial configuration, assume Σ = {a, b, c}, Γ = Σ ∪ {#, $, &, t}
q0 a a a a b b b b c c c c
a few steps later:
# #q4 a a $ $ b b & & c c
Note that the read head points to the symbol to the right of the state
symbol.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Configuration C1 yields configuration C2
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Configuration C1 yields configuration C2
if the machine can go from C1 to C2 in a single step.
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Configuration C1 yields configuration C2
if the machine can go from C1 to C2 in a single step.
Formally, let a, b, c ∈ Γ, u, v ∈ Γ∗ , and qi , qj ∈ Q. We say
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Configuration C1 yields configuration C2
if the machine can go from C1 to C2 in a single step.
Formally, let a, b, c ∈ Γ, u, v ∈ Γ∗ , and qi , qj ∈ Q. We say
uaqi bv yields uqj acv
if δ(qi , b) = (qj , c, L), and
Chapter 3. The Church-Turing Thesis
Formalizing Turing machine computation:
Configuration C1 yields configuration C2
if the machine can go from C1 to C2 in a single step.
Formally, let a, b, c ∈ Γ, u, v ∈ Γ∗ , and qi , qj ∈ Q. We say
uaqi bv yields uqj acv
if δ(qi , b) = (qj , c, L), and
uaqi bv yields uacqj v
if δ(qi , b) = (qj , c, R).
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
• The start configuration is q0 w
where w is the input.
Chapter 3. The Church-Turing Thesis
• The start configuration is q0 w
where w is the input.
• A configuration is accepting configuration
if its state is the accepting state.
Chapter 3. The Church-Turing Thesis
• The start configuration is q0 w
where w is the input.
• A configuration is accepting configuration
if its state is the accepting state.
• A configuration is rejecting configuration
if its state is the rejecting state.
Chapter 3. The Church-Turing Thesis
• The start configuration is q0 w
where w is the input.
• A configuration is accepting configuration
if its state is the accepting state.
• A configuration is rejecting configuration
if its state is the rejecting state.
• Both accepting and rejecting configurations are halting configurations.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
• the language recognized by M .
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
• the language recognized by M .
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
• the language recognized by M .
It is denoted with L(M ).
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
• the language recognized by M .
It is denoted with L(M ).
Note:
for x ∈ L(M ), M always halts;
Chapter 3. The Church-Turing Thesis
Definition. A Turing machine M accepts an input w if a sequence of
configurations C1 , C2 , . . . , Ck , for some k ≥ 1 exists, such that
1. C1 is the start configuration of M on input w,
2. Ci yields Ci+1 , for i = 1, 2, . . . , k − 1, and
3. Ck is an accepting configuration.
The collection of strings accepted by M is called
• the language of M , or
• the language recognized by M .
It is denoted with L(M ).
Note:
for x ∈ L(M ), M always halts;
but for x 6∈ L(M ), M may or may not halt.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Definition 3.5 A language A is Turing recognizable if A can be
recognized by some Turing machine.
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Definition 3.5 A language A is Turing recognizable if A can be
recognized by some Turing machine.
A Turing machine decides if it halts. It is called a decider.
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Definition 3.5 A language A is Turing recognizable if A can be
recognized by some Turing machine.
A Turing machine decides if it halts. It is called a decider.
Definition 3.6 A language A is Turing decidable or simply decidable if
some Turing machine decides A.
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Definition 3.5 A language A is Turing recognizable if A can be
recognized by some Turing machine.
A Turing machine decides if it halts. It is called a decider.
Definition 3.6 A language A is Turing decidable or simply decidable if
some Turing machine decides A.
Other terms used:
• Turing recognizable = recursively enumerable
Chapter 3. The Church-Turing Thesis
Two classes of languages:
Definition 3.5 A language A is Turing recognizable if A can be
recognized by some Turing machine.
A Turing machine decides if it halts. It is called a decider.
Definition 3.6 A language A is Turing decidable or simply decidable if
some Turing machine decides A.
Other terms used:
• Turing recognizable = recursively enumerable
• Turing decidable = recursive
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
consists of strings: 0, 00, 0000, 00000000.
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
consists of strings: 0, 00, 0000, 00000000.
idea: 2n can be repeatedly divided by 2.
if at any iteration of division, the number of 0s is odd
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
consists of strings: 0, 00, 0000, 00000000.
idea: 2n can be repeatedly divided by 2.
if at any iteration of division, the number of 0s is odd
• accept if the number is 1,
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
consists of strings: 0, 00, 0000, 00000000.
idea: 2n can be repeatedly divided by 2.
if at any iteration of division, the number of 0s is odd
• accept if the number is 1,
• reject otherwise.
Chapter 3. The Church-Turing Thesis
Examples of Turing machines
n
Example 3.7, recognize language {02 | n ≥ 0}
consists of strings: 0, 00, 0000, 00000000.
idea: 2n can be repeatedly divided by 2.
if at any iteration of division, the number of 0s is odd
• accept if the number is 1,
• reject otherwise.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
1. Scan left to right the tape, cross off every other 0 symbol,
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
1. Scan left to right the tape, cross off every other 0 symbol,
2. If in step 1, the tape contains a single 0, accept.
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
1. Scan left to right the tape, cross off every other 0 symbol,
2. If in step 1, the tape contains a single 0, accept.
3. If in step 1, the tape contains k 0s, for odd k ≥ 3, reject.
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
1.
2.
3.
4.
Scan left to right the tape, cross off every other 0 symbol,
If in step 1, the tape contains a single 0, accept.
If in step 1, the tape contains k 0s, for odd k ≥ 3, reject.
Return the head to the leftmost position,
Chapter 3. The Church-Turing Thesis
n
More detailed steps for recognition of {02 | n ≥ 0}
On the input string w:
1.
2.
3.
4.
5.
Scan left to right the tape, cross off every other 0 symbol,
If in step 1, the tape contains a single 0, accept.
If in step 1, the tape contains k 0s, for odd k ≥ 3, reject.
Return the head to the leftmost position,
Goto step 1.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Implementation-level description:
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Σ = {0},
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Σ = {0},
Γ = {0, ×, t},
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Σ = {0},
Γ = {0, ×, t},
Start state is q1 ,
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Σ = {0},
Γ = {0, ×, t},
Start state is q1 ,
Accept state is qaccept ; reject state is qreject , and
Chapter 3. The Church-Turing Thesis
Implementation-level description:
M2 = (Q, Σ, Γ, δ, q1 , qaccept , qreject )
Q = {q1 , q2 , q3 , q4 , q5 , qaccept , qreject },
Σ = {0},
Γ = {0, ×, t},
Start state is q1 ,
Accept state is qaccept ; reject state is qreject , and
δ is described with a state diagram (Figure 3.8, page 172).
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
- from q1 mark the first 0 as t to indicate the leftmost, go to q2
- if no first 0, go to qreject
• at q2 move right, skips all ×’s, if no more 0, go to qaccept , or
- cross the first encountered 0, go to q3
- q3 together with q4 skip all ×’s, cross every other 0
- if not even number of 0, from q4 go to qreject
- at q3 reach the rightmost, move left, go to q5
- move left, q5 skips all ×’s and 0’s
- reach the leftmost, go to q2 , then the whole process repeats from •
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Trace the execution of the TM on input 0000 using configuration changes.
Chapter 3. The Church-Turing Thesis
Trace the execution of the TM on input 0000 using configuration changes.
Note: the input is accepted if only one 0 left (representing value 1).
So one that 0 is first replaced with t at q1 .
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Example 3.9 TM M1 = (Q, Σ, Γ, δ, q1 , qaccept , qreject ) to recognize
language {w#w | w ∈ {0, 1}∗ }.
Explanation on the next page
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
- from q1 , go to q2 if read 0; go to q3 if read 1, cross current symbol
• from q2 , move right, skip all 0’s and 1’s, until reach #, go to q4 ,
- from q4 , move right, skip all ×’s until 0, go to q6 , move left
- from q6 , move left, skip all 0’s, 1’s, ×’s, until #, go to q7 , move left
- from q7 , move left, skip all 0’s, 1’s until ×, go to q1 , move right
• from q3 , symmetrically similar to from q2 .
- from q1 , if # (no more 0’s or 1’s on its left), go to q8 , move right
- from q8 , if no more 0’s or 1’s, go to qaccept
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Turing machines can accomplish complicated tasks:
Chapter 3. The Church-Turing Thesis
Turing machines can accomplish complicated tasks:
e.g., addition of two integers
Chapter 3. The Church-Turing Thesis
Turing machines can accomplish complicated tasks:
e.g., addition of two integers
• represent integers, 1x (unary) represents x
input 1x + 1y = 1z , accept iff x + y = z.
e.g., 111+11=11111, how would a TM do it?
Chapter 3. The Church-Turing Thesis
Turing machines can accomplish complicated tasks:
e.g., addition of two integers
• represent integers, 1x (unary) represents x
input 1x + 1y = 1z , accept iff x + y = z.
e.g., 111+11=11111, how would a TM do it?
• binary representation, x, y, z ∈ {0, 1}∗
input x + y = z, accept iff x + y = z.
e.g., 011+10=101, how would a TM do it?
Chapter 3. The Church-Turing Thesis
Turing machines can accomplish complicated tasks:
e.g., addition of two integers
• represent integers, 1x (unary) represents x
input 1x + 1y = 1z , accept iff x + y = z.
e.g., 111+11=11111, how would a TM do it?
• binary representation, x, y, z ∈ {0, 1}∗
input x + y = z, accept iff x + y = z.
e.g., 011+10=101, how would a TM do it?
Turing machines can have output,
i.e., compute functions, not just predicates.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
• read head may not move after reading a symbol; {L, R, S}
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
• read head may not move after reading a symbol; {L, R, S}
• multiple tapes;
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
• read head may not move after reading a symbol; {L, R, S}
• multiple tapes;
• two-way infinite input tape;
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
• read head may not move after reading a symbol; {L, R, S}
• multiple tapes;
• two-way infinite input tape;
• random access input tape (with an address tape)
Chapter 3. The Church-Turing Thesis
3.2 Variants of Turing Machines
• read head may not move after reading a symbol; {L, R, S}
• multiple tapes;
• two-way infinite input tape;
• random access input tape (with an address tape)
• with output tape;
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Multitape Turing machines
Chapter 3. The Church-Turing Thesis
Multitape Turing machines
• Have k tapes, each with a head to read and write
• k − 1 tapes start out blank
• Transition function δ : Q × Γk −→ Q × Γk × {L, R, S}k
Chapter 3. The Church-Turing Thesis
Multitape Turing machines
• Have k tapes, each with a head to read and write
• k − 1 tapes start out blank
• Transition function δ : Q × Γk −→ Q × Γk × {L, R, S}k
Theorem 3.13 Every multi-tape Turing machine has an equivalent
single-tape Turing machine.
Chapter 3. The Church-Turing Thesis
Multitape Turing machines
• Have k tapes, each with a head to read and write
• k − 1 tapes start out blank
• Transition function δ : Q × Γk −→ Q × Γk × {L, R, S}k
Theorem 3.13 Every multi-tape Turing machine has an equivalent
single-tape Turing machine.
Proof idea:
- assigning space for k tapes using delimiter, e.g., #
- shift right to get more space
- how about read head positions?
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Nondeterministic Turing machines
• δ : Q × Γ −→ P(Q × Γ × {L, R})
Chapter 3. The Church-Turing Thesis
Nondeterministic Turing machines
• δ : Q × Γ −→ P(Q × Γ × {L, R})
e.g., design a TM to recognize language L = {ww : w ∈ {0, 1}∗ }
Chapter 3. The Church-Turing Thesis
Nondeterministic Turing machines
• δ : Q × Γ −→ P(Q × Γ × {L, R})
e.g., design a TM to recognize language L = {ww : w ∈ {0, 1}∗ }
we have seen a deterministic TM for {w#w : w ∈ {0, 1}∗ }:
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
To recognize language L = {ww : w ∈ {0, 1}∗ }, we may
nondeterministically guess the mid position.
Chapter 3. The Church-Turing Thesis
To recognize language L = {ww : w ∈ {0, 1}∗ }, we may
nondeterministically guess the mid position.
How may we modify the TM for our need?
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
The following portion of a TM transforms input
Chapter 3. The Church-Turing Thesis
The following portion of a TM transforms input
x1 x2 . . . xn
Chapter 3. The Church-Turing Thesis
The following portion of a TM transforms input
x1 x2 . . . xn
to
x1 x2 . . . xk−1 #xk . . . xn
where k is chosen nondeterministically.
Chapter 3. The Church-Turing Thesis
The following portion of a TM transforms input
x1 x2 . . . xn
to
x1 x2 . . . xk−1 #xk . . . xn
where k is chosen nondeterministically.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
• P1 marks the leftmost position by replacing 0 with Z and 1 with W ;
Chapter 3. The Church-Turing Thesis
• P1 marks the leftmost position by replacing 0 with Z and 1 with W ;
• P2 moves read-head to the rightmost;
Chapter 3. The Church-Turing Thesis
• P1 marks the leftmost position by replacing 0 with Z and 1 with W ;
• P2 moves read-head to the rightmost;
• P3 , P4 , P5 , P6 shifts symbols one position down to the right, iteratively;
Chapter 3. The Church-Turing Thesis
•
•
•
•
P1 marks the leftmost position by replacing 0 with Z and 1 with W ;
P2 moves read-head to the rightmost;
P3 , P4 , P5 , P6 shifts symbols one position down to the right, iteratively;
at the end of each iteration, P6 nondeterministically decides to
to keep shifting OR
Chapter 3. The Church-Turing Thesis
•
•
•
•
P1 marks the leftmost position by replacing 0 with Z and 1 with W ;
P2 moves read-head to the rightmost;
P3 , P4 , P5 , P6 shifts symbols one position down to the right, iteratively;
at the end of each iteration, P6 nondeterministically decides to
to keep shifting OR
• inserting # and moves to the leftmost (and recovering the leftmost symbol)
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
To recognize language L = {u#w : u is a substring of w}.
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
To recognize language L = {u#w : u is a substring of w}.
Construct a TM M for L as follows
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
To recognize language L = {u#w : u is a substring of w}.
Construct a TM M for L as follows
• on input u#w,
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
To recognize language L = {u#w : u is a substring of w}.
Construct a TM M for L as follows
• on input u#w,
• M nondeterministically chooses a position k in w, and
compare u with the substring beginning at position k;
Chapter 3. The Church-Turing Thesis
Another example of nondeterministic TM.
To recognize language L = {u#w : u is a substring of w}.
Construct a TM M for L as follows
• on input u#w,
• M nondeterministically chooses a position k in w, and
compare u with the substring beginning at position k;
• M accepts u#w iff u and the substring match.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Theorem 3.16 Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
Proof idea:
- computation of NTM is a tree (possibly infinite)
Chapter 3. The Church-Turing Thesis
Theorem 3.16 Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
Proof idea:
- computation of NTM is a tree (possibly infinite)
(what does a DTM computation look like)
Chapter 3. The Church-Turing Thesis
Theorem 3.16 Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
Proof idea:
- computation of NTM is a tree (possibly infinite)
(what does a DTM computation look like)
- each node is a configuration, the root is the start configuration
Chapter 3. The Church-Turing Thesis
Theorem 3.16 Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
Proof idea:
- computation of NTM is a tree (possibly infinite)
(what does a DTM computation look like)
- each node is a configuration, the root is the start configuration
- from a parent, there can be m children configurations
Chapter 3. The Church-Turing Thesis
Theorem 3.16 Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
Proof idea:
- computation of NTM is a tree (possibly infinite)
(what does a DTM computation look like)
- each node is a configuration, the root is the start configuration
- from a parent, there can be m children configurations
- breadth-first-search (why depth-first-search may not work?)
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Note that given a configuration, all children configurations are known
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Note that given a configuration, all children configurations are known
- Use two tapes:
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Note that given a configuration, all children configurations are known
- Use two tapes:
• on path tape: the path from root to current configuration is stored
e.g., in the form of 1 2 1 3 2 3 at level 6.
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Note that given a configuration, all children configurations are known
- Use two tapes:
• on path tape: the path from root to current configuration is stored
e.g., in the form of 1 2 1 3 2 3 at level 6.
• on simulation tape: given the path, computation is
deterministically simulated.
Chapter 3. The Church-Turing Thesis
Technical details for the proof:
- A DTM simulates the computation of a given NTM on input
by searching through the computation/configuration tree
Note that given a configuration, all children configurations are known
- Use two tapes:
• on path tape: the path from root to current configuration is stored
e.g., in the form of 1 2 1 3 2 3 at level 6.
• on simulation tape: given the path, computation is
deterministically simulated.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Turing Enumerators
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
• It starts from an empty input tape.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
• It starts from an empty input tape.
• The set of all strings printed is the language enumerated by the TM.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
• It starts from an empty input tape.
• The set of all strings printed is the language enumerated by the TM.
• The strings printed out can be in any order.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
•
•
•
•
It starts from an empty input tape.
The set of all strings printed is the language enumerated by the TM.
The strings printed out can be in any order.
The collection can be infinite.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
•
•
•
•
It starts from an empty input tape.
The set of all strings printed is the language enumerated by the TM.
The strings printed out can be in any order.
The collection can be infinite.
Theorem 3.21 A language is Turing recognizable if and only if there is
an Turing enumerator that enumerates it.
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
•
•
•
•
It starts from an empty input tape.
The set of all strings printed is the language enumerated by the TM.
The strings printed out can be in any order.
The collection can be infinite.
Theorem 3.21 A language is Turing recognizable if and only if there is
an Turing enumerator that enumerates it.
There are two implications to prove:
Chapter 3. The Church-Turing Thesis
Turing Enumerators
A Turing machine that prints strings on the output tape,
separated by a special symbol, say #, is called an enumerator.
•
•
•
•
It starts from an empty input tape.
The set of all strings printed is the language enumerated by the TM.
The strings printed out can be in any order.
The collection can be infinite.
Theorem 3.21 A language is Turing recognizable if and only if there is
an Turing enumerator that enumerates it.
There are two implications to prove:
(1) Turing enumerable =⇒ Turing recognizable.
(2) Turing recognizable =⇒ Turing enumerable.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(1) Turing enumerable =⇒ Turing recognizable.
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(1) Turing enumerable =⇒ Turing recognizable.
• assume E an enumerator for language L,
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(1) Turing enumerable =⇒ Turing recognizable.
• assume E an enumerator for language L,
• construct M to recognize any given input w so
- M follows the work of E and compares w with strings outputted by E
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(1) Turing enumerable =⇒ Turing recognizable.
• assume E an enumerator for language L,
• construct M to recognize any given input w so
- M follows the work of E and compares w with strings outputted by E
- if w ever appears in the output of E, M accepts w
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(1) Turing enumerable =⇒ Turing recognizable.
• assume E an enumerator for language L,
• construct M to recognize any given input w so
- M follows the work of E and compares w with strings outputted by E
- if w ever appears in the output of E, M accepts w
• Note: if w is in L(E), it will get printed on the tape eventually,
so will be accepted by M .
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO!
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
how to fix?
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
how to fix?
- Let s1 = , s2 = 0, s3 , s4 = 00, . . .
- for i = 1, 2, . . . ,
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
how to fix?
- Let s1 = , s2 = 0, s3 , s4 = 00, . . .
- for i = 1, 2, . . . ,
E follows M i steps on each of s1 , s2 , . . . , si
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
how to fix?
- Let s1 = , s2 = 0, s3 , s4 = 00, . . .
- for i = 1, 2, . . . ,
E follows M i steps on each of s1 , s2 , . . . , si
if M accepts sj , E prints sj .
Chapter 3. The Church-Turing Thesis
Proof ideas for:
(2) Turing recognizable =⇒ Turing enumerable.
• assume M a Turing machine that recognizes language L.
• construct enumerator E to enumerate L(M ):
- for each string w = , 0, 1, 00, 01, 10, 11, 000, 001, . . . ,
E follows the work of M on w,
if M accepts w, E prints w on the output tape.
but would this work?
NO! because on some strings, M may never halt!
how to fix?
- Let s1 = , s2 = 0, s3 , s4 = 00, . . .
- for i = 1, 2, . . . ,
E follows M i steps on each of s1 , s2 , . . . , si
if M accepts sj , E prints sj .
This ensures that for any x ∈ L, x gets tested on M , and
thus gets printed by E
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
(1) TMs that always halt on all inputs;
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
(1) TMs that always halt on all inputs;
• the instruction set built in such a machine
is called an algorithm.
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
(1) TMs that always halt on all inputs;
• the instruction set built in such a machine
is called an algorithm.
(2) those may not halt on some inputs;
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
(1) TMs that always halt on all inputs;
• the instruction set built in such a machine
is called an algorithm.
(2) those may not halt on some inputs;
Church-Turing Thesis:
Intuitive notation of algorithms equals Turing machine algorithms.
Chapter 3. The Church-Turing Thesis
3.3 Definition of Algorithm
Recalled there are two kinds of Turing machines
(1) TMs that always halt on all inputs;
• the instruction set built in such a machine
is called an algorithm.
(2) those may not halt on some inputs;
Church-Turing Thesis:
Intuitive notation of algorithms equals Turing machine algorithms.
Also Turing decidable functions equal recursive functions
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
More on Church-Turing Thesis:
Chapter 3. The Church-Turing Thesis
More on Church-Turing Thesis:
Three formal systems:
logic and recursive functions [Godel 1933]
λ-calculus [Church 1936] and
Turing machines [Turing 1936]
Chapter 3. The Church-Turing Thesis
More on Church-Turing Thesis:
Three formal systems:
logic and recursive functions [Godel 1933]
λ-calculus [Church 1936] and
Turing machines [Turing 1936]
Three programming (language) paradigms:
logic programming languages: prolog
functional programming languages: LISP
procedural programming languages: C, Java, etc
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
• What problems cannot be solved by algorithms?
Chapter 3. The Church-Turing Thesis
• What problems cannot be solved by algorithms?
What problems may not be formulated into
Turing decidable (i.e., recursive) languages?
Chapter 3. The Church-Turing Thesis
• What problems cannot be solved by algorithms?
What problems may not be formulated into
Turing decidable (i.e., recursive) languages?
• What problems cannot be solved by Turing machines
that may not halt on all inputs?
Chapter 3. The Church-Turing Thesis
• What problems cannot be solved by algorithms?
What problems may not be formulated into
Turing decidable (i.e., recursive) languages?
• What problems cannot be solved by Turing machines
that may not halt on all inputs?
What problems may not be formulated into
Turing recognizable (i.e., recursively enumerable) languages?
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1:
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
There is a finite process to decide the question, given such a polynomial.
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
There is a finite process to decide the question, given such a polynomial.
• enumerate all integers to try,
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
There is a finite process to decide the question, given such a polynomial.
• enumerate all integers to try, but how?
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
There is a finite process to decide the question, given such a polynomial.
• enumerate all integers to try, but how?
• enumerate all integers 0, -1, 1, -2, 2, . . . ,
Chapter 3. The Church-Turing Thesis
Examples of problems that have Algorithms
Problem 1: Test if a single-variable polynomial,
e.g., 6x3 − 3x2 + 24x − 17, has an integral root
I.e., to test if equation 6x3 − 3x2 + 24x − 17 = 0 has integral solutions
There is a finite process to decide the question, given such a polynomial.
• enumerate all integers to try, but how?
• enumerate all integers 0, -1, 1, -2, 2, . . . ,
• the process is not infinite because
cmax
the root should be within the range [−k cmax
c1 , +k c1 ]
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
1. select the first node and mark it
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
1. select the first node and mark it
2. repeat the following until no new nodes are marked
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
1. select the first node and mark it
2. repeat the following until no new nodes are marked
3. for each node in G, mark it if it shares an edge
with a marked node
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
1. select the first node and mark it
2. repeat the following until no new nodes are marked
3. for each node in G, mark it if it shares an edge
with a marked node
4. if all nodes are mark, accept, otherwise reject
Chapter 3. The Church-Turing Thesis
Problems 2: Testing if a given graph is connected
(Example 3.23, pages 185-186)
A = {hGi | G is connected }
A is decidable, i.e., there is an algorithm (TM that halts) for it.
On input hGi, encoding of G,
1. select the first node and mark it
2. repeat the following until no new nodes are marked
3. for each node in G, mark it if it shares an edge
with a marked node
4. if all nodes are mark, accept, otherwise reject
Figure 3.24 (page 186)
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
• an enumerating process similar to the algorithm for Problem 1
may not halt
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
• an enumerating process similar to the algorithm for Problem 1
may not halt
• Hilbert10 is not decidable
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
• an enumerating process similar to the algorithm for Problem 1
may not halt
• Hilbert10 is not decidable
But it is solvable by a TM (which may not stop)
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
• an enumerating process similar to the algorithm for Problem 1
may not halt
• Hilbert10 is not decidable
But it is solvable by a TM (which may not stop)
• enumerate all combinations of integers for x, y, z;
Chapter 3. The Church-Turing Thesis
Examples of problems that do not have Algorithms
Problem 3. (Hilbert10) Testing if a polynomial has an integral root
e.g., 6x3 yz 2 + 3xy 2 − x3 − 10
• the polynomial may contain multiple variables (e.g., x, y, z)
• it is not possible to get bounds for these variables
• an enumerating process similar to the algorithm for Problem 1
may not halt
• Hilbert10 is not decidable
But it is solvable by a TM (which may not stop)
• enumerate all combinations of integers for x, y, z;
• So Hilbert10 is Turing recognizable (recursively enumerable).
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Let M1 and M2 are deciders for L1 and L2 .
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Let M1 and M2 are deciders for L1 and L2 .
We construct a Turing decider M for L1 ∩ L2 as follows
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Let M1 and M2 are deciders for L1 and L2 .
We construct a Turing decider M for L1 ∩ L2 as follows
• on input w, M follows the work of M1 on w,
then M follows the work of M2 on w,
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Let M1 and M2 are deciders for L1 and L2 .
We construct a Turing decider M for L1 ∩ L2 as follows
• on input w, M follows the work of M1 on w,
then M follows the work of M2 on w,
• M accepts w if both M1 and M2 accepts w;
M rejects w if either M1 or M2 rejects w.
Chapter 3. The Church-Turing Thesis
Set operations on decidable, Turing recognizable languages
The class of decidable languages closed under union, intersection,
complementation, concatenation, and star.
How to prove these?
e.g., Prove that if L1 , L2 are decidable, so is L1 ∩ L2 .
Let M1 and M2 are deciders for L1 and L2 .
We construct a Turing decider M for L1 ∩ L2 as follows
• on input w, M follows the work of M1 on w,
then M follows the work of M2 on w,
• M accepts w if both M1 and M2 accepts w;
M rejects w if either M1 or M2 rejects w.
M halts on all inputs since M1 and M2 halts on all inputs.
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk )
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
• N follows M on wi for all i;
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
• N follows M on wi for all i;
• N accepts w if M accepts all wi (N rejects w if M rejects some wi )
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
• N follows M on wi for all i;
• N accepts w if M accepts all wi (N rejects w if M rejects some wi )
But will N halts?
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
• N follows M on wi for all i;
• N accepts w if M accepts all wi (N rejects w if M rejects some wi )
But will N halts? Yes, if k is finite.
Chapter 3. The Church-Turing Thesis
E.g., Prove that if L is decidable, so is L∗ .
(L∗ = {} ∪ L ∪ LL ∪ LLL ∪ . . . )
w ∈ L∗ ⇐⇒ ∃k, w1 , w2 , . . . , wk such that (w = w1 w2 . . . wk ) ∧ (∀ i wi ∈ L)
How to test the RHS?
Let M be a decider for L. Construct a decider N for L∗ as follows:
• on input w,
• N nondeterministically chooses k;
• N nondeterministically partitions w into k pieces:
w = w1 w2 . . . wk (e.g., insert #s into k − 1 positions);
• N follows M on wi for all i;
• N accepts w if M accepts all wi (N rejects w if M rejects some wi )
But will N halts? Yes, if k is finite. Actually 1 ≤ k ≤ |w|.
!
Chapter 3. The Church-Turing Thesis
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Proof?
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Proof?
Claim 2. There are languages that are NOT even Turing recognizable.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Proof?
Claim 2. There are languages that are NOT even Turing recognizable.
Proof: Hilbert10 is not Turing recognizable.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Proof?
Claim 2. There are languages that are NOT even Turing recognizable.
Proof: Hilbert10 is not Turing recognizable.
Otherwise, because Hilbert10 is Turing recognizable, by Claim 1,
Hilbert10 is decidable.
Chapter 3. The Church-Turing Thesis
The class of Turing recognizable languages closed under union,
intersection, concatenation, and star.
Why not closed under complementation?
- reversing answers no longer work if a TM may not halt.
Claim 1. If both L and L are Turing recognizable, then L is decidable.
Proof?
Claim 2. There are languages that are NOT even Turing recognizable.
Proof: Hilbert10 is not Turing recognizable.
Otherwise, because Hilbert10 is Turing recognizable, by Claim 1,
Hilbert10 is decidable.
But we know it is not decidable (contradiction).
Chapter 4. Decidability
Chapter 4. Decidability
Figure: 4.1 The Chomsky Hierarchy
Chapter 4. Decidability
Chapter 4. Decidability
4.1 Decidable Languages
Chapter 4. Decidability
4.1 Decidable Languages
• We will discuss problems (i.e., languages) concerning computational
systems that we have learned so far.
Chapter 4. Decidability
4.1 Decidable Languages
• We will discuss problems (i.e., languages) concerning computational
systems that we have learned so far.
• We will use a lot of “simulation techniques”.
Chapter 4. Decidability
Chapter 4. Decidability
Decidable problems concerning regular languages
Chapter 4. Decidability
Decidable problems concerning regular languages
Accepting problem for DFAs: testing if a given DFA accepts a given string
ADF A = {hB, wi | B is a DFA that accepts string w}
Chapter 4. Decidability
Decidable problems concerning regular languages
Accepting problem for DFAs: testing if a given DFA accepts a given string
ADF A = {hB, wi | B is a DFA that accepts string w}
Theorem 4.1 ADF A is a decidable language.
Chapter 4. Decidability
Decidable problems concerning regular languages
Accepting problem for DFAs: testing if a given DFA accepts a given string
ADF A = {hB, wi | B is a DFA that accepts string w}
Theorem 4.1 ADF A is a decidable language.
Note: To prove a language is decidable, it suffices to construct a TM
(that halts on all inputs) to recognize the language.
Chapter 4. Decidability
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
• M1 accepts hB, wi iff B accepts w
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
• M1 accepts hB, wi iff B accepts w
Some details:
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
• M1 accepts hB, wi iff B accepts w
Some details:
• how is B encoded?
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
• M1 accepts hB, wi iff B accepts w
Some details:
• how is B encoded?
• how to keep track of B states?
Chapter 4. Decidability
Theorem 4.1 ADF A is a decidable language.
proof idea:
Construct TM M1 , on input hB, wi, to follow the work of B on w.
• keep track of B’s current state and position on w.
• M1 accepts hB, wi iff B accepts w
Some details:
• how is B encoded?
• how to keep track of B states?
• how to keep track of positions on w?
Chapter 4. Decidability
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
1. Use an NTM N to simulate NFA B on w,
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
1. Use an NTM N to simulate NFA B on w,
• N accepts hB, wi iff B accepts w.
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
1. Use an NTM N to simulate NFA B on w,
• N accepts hB, wi iff B accepts w.
2. Alternatively, N converts B an equivalent DFA B 0 ,
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
1. Use an NTM N to simulate NFA B on w,
• N accepts hB, wi iff B accepts w.
2. Alternatively, N converts B an equivalent DFA B 0 ,
• then N follows TM M1 (constructed in Theorem 4.1) on hB 0 , wi,
Chapter 4. Decidability
Similarly
AN F A = {hB, wi | B is an NFA that accepts string w}
Theorem 4.2 AN F A is a decidable language.
proof ideas
1. Use an NTM N to simulate NFA B on w,
• N accepts hB, wi iff B accepts w.
2. Alternatively, N converts B an equivalent DFA B 0 ,
• then N follows TM M1 (constructed in Theorem 4.1) on hB 0 , wi,
• N accepts hB, wi iff M1 accepts hB 0 , wi.
Chapter 4. Decidability
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Construct a TM P to decide AREX :
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Construct a TM P to decide AREX :
On input hR, wi;
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Construct a TM P to decide AREX :
On input hR, wi;
• P convert R to an equivalent NFA B using
the finite steps provided in theorem 1.54
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Construct a TM P to decide AREX :
On input hR, wi;
• P convert R to an equivalent NFA B using
the finite steps provided in theorem 1.54
• P runs N (theorem 4.2) on input hB, wi
Chapter 4. Decidability
AREX = {hR, wi | regular expression R generates string w}
Theorem 4.3 AREX is a decidable language.
proof idea?
Construct a TM P to decide AREX :
On input hR, wi;
• P convert R to an equivalent NFA B using
the finite steps provided in theorem 1.54
• P runs N (theorem 4.2) on input hB, wi
• P accepts hR, wi iff N accepts hB, wi
Chapter 4. Decidability
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
On the input hAi;
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
On the input hAi;
1. Mark the start state of A.
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
On the input hAi;
1. Mark the start state of A.
2. Repeat until no new states get marked:
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
On the input hAi;
1. Mark the start state of A.
2. Repeat until no new states get marked:
3. Mark any state that has a transition coming to it from
a state that has been marked;
Chapter 4. Decidability
Testing if a DFA accepts the empty language (rejects all strings)
EDF A = {hAi | A is a DFA and L(A) = ∅}
Theorem 4.4 EDF A is a decidable language.
proof idea ?
To determine if there is path from the initial state to a accept state.
Design a TM T for this purpose
On the input hAi;
1. Mark the start state of A.
2. Repeat until no new states get marked:
3. Mark any state that has a transition coming to it from
a state that has been marked;
4. If no accept state is marked, T accept, otherwise rejects.
Chapter 4. Decidability
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Construct a TM M to decide for language EQDF A as follows:
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Construct a TM M to decide for language EQDF A as follows:
1. On input hA, Bi,
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Construct a TM M to decide for language EQDF A as follows:
1. On input hA, Bi,
2. produces a DFA C for language (L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Construct a TM M to decide for language EQDF A as follows:
1. On input hA, Bi,
2. produces a DFA C for language (L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))
3. follows TM T (of theorem 4.4) on hCi;
Chapter 4. Decidability
Testing if two DFAs are equivalent
EQDF A = {hA, Bi | A, B are DFAs and L(A) = L(B)}
Theorem 4.5 EQDF A is a decidable language.
proof idea:
To relate testing L(A) = L(B) to a empty language testing. How?
L(A) = L(B)⇐⇒(L(A) − L(B)) ∪ (L(B) − L(A)) = ∅
⇐⇒(L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))= ∅
All the operations: union, intersection, and complementation can be done in finite
steps and still result in regular languages.
Construct a TM M to decide for language EQDF A as follows:
1. On input hA, Bi,
2. produces a DFA C for language (L(A) ∩ L(B)) ∪ (L(B) ∩ L(A))
3. follows TM T (of theorem 4.4) on hCi;
4. accepts iff T accepts.
Chapter 4. Decidability
Chapter 4. Decidability
Decidable problems concerning context-free languages
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = (2) let length |w| = l, assume there is a derivation,
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = (2) let length |w| = l, assume there is a derivation,
• how many steps needed to derive w?
• each step use of rule X → Y Z generates at least one symbol
• like X ⇒ Y Z ⇒ aZ, two steps
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = (2) let length |w| = l, assume there is a derivation,
• how many steps needed to derive w?
• each step use of rule X → Y Z generates at least one symbol
• like X ⇒ Y Z ⇒ aZ, two steps
Derivation of one additional symbol needs two steps except the last one.
So totally 2l − 1 steps
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = (2) let length |w| = l, assume there is a derivation,
• how many steps needed to derive w?
• each step use of rule X → Y Z generates at least one symbol
• like X ⇒ Y Z ⇒ aZ, two steps
Derivation of one additional symbol needs two steps except the last one.
So totally 2l − 1 steps
Try all derivations of 2l − 1 steps.
how many of them?
Chapter 4. Decidability
Decidable problems concerning context-free languages
ACF G = {hG, wi | G is a CFG that generates string w}
Theorem 4.7 ACF G is a decidable language.
Proof idea:
Use Chomsky normal form (S0 → , X → Y Z, X → a)
(1) can check if w = (2) let length |w| = l, assume there is a derivation,
• how many steps needed to derive w?
• each step use of rule X → Y Z generates at least one symbol
• like X ⇒ Y Z ⇒ aZ, two steps
Derivation of one additional symbol needs two steps except the last one.
So totally 2l − 1 steps
Try all derivations of 2l − 1 steps.
how many of them? |R|2l−1 , finite!
Chapter 4. Decidability
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Design a TM as follows such that
On input hGi, encoding of G,
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Design a TM as follows such that
On input hGi, encoding of G,
• mark all terminal symbols in G,
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Design a TM as follows such that
On input hGi, encoding of G,
• mark all terminal symbols in G,
• repeat until no new variables get marked:
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Design a TM as follows such that
On input hGi, encoding of G,
• mark all terminal symbols in G,
• repeat until no new variables get marked:
mark any variable A if A → α is a rule
and all symbols in α has been marked.
Chapter 4. Decidability
Also we have the problem of testing if a CFG generates the empty
language.
ECF G = {hGi | G is a CFG and L(G) = φ}
Theorem 4.8 ECF G is a decidable language.
Proof idea:
Design a TM as follows such that
On input hGi, encoding of G,
• mark all terminal symbols in G,
• repeat until no new variables get marked:
mark any variable A if A → α is a rule
and all symbols in α has been marked.
• if the start variable is not marked, accept; otherwise reject.
Chapter 4. Decidability
Chapter 4. Decidability
We would hope the following language is also decidable, but it is not.
EQCF G = {hG, Hi | G, H are CFGs and L(G) = L(H)}
Chapter 4. Decidability
We would hope the following language is also decidable, but it is not.
EQCF G = {hG, Hi | G, H are CFGs and L(G) = L(H)}
The technique used to prove Theorem 4.5 is not applicable to testing if
two CFLs are equal.
Chapter 4. Decidability
We would hope the following language is also decidable, but it is not.
EQCF G = {hG, Hi | G, H are CFGs and L(G) = L(H)}
The technique used to prove Theorem 4.5 is not applicable to testing if
two CFLs are equal.
The class of CFLs are not closed under intersection or complement.
Chapter 4. Decidability
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Proof idea:
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Proof idea:
Let G be the CFG for the language under consideration.
Construct a TM to simulate the work of G as follows:
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Proof idea:
Let G be the CFG for the language under consideration.
Construct a TM to simulate the work of G as follows:
On input w,
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Proof idea:
Let G be the CFG for the language under consideration.
Construct a TM to simulate the work of G as follows:
On input w,
• simulates the TM of Theorem 4.7 on hG, wi
Chapter 4. Decidability
Theorem 4.9 Every CFL is decidable.
Proof idea:
Let G be the CFG for the language under consideration.
Construct a TM to simulate the work of G as follows:
On input w,
• simulates the TM of Theorem 4.7 on hG, wi
• accepts iff the TM of Theorem 4.7 accepts.
Chapter 4. Decidability
Chapter 4. Decidability
The relationship among classes of languages
Chapter 4. Decidability
The relationship among classes of languages
regular ⊂ context-free ⊂ decidable ⊂ Turing-recognizable
Chapter 4. Decidability
The relationship among classes of languages
regular ⊂ context-free ⊂ decidable ⊂ Turing-recognizable
• the containments are all proper;
Chapter 4. Decidability
The relationship among classes of languages
regular ⊂ context-free ⊂ decidable ⊂ Turing-recognizable
• the containments are all proper;
• we know some specific languages that made each containment proper.
Chapter 4. Decidability
The relationship among classes of languages
regular ⊂ context-free ⊂ decidable ⊂ Turing-recognizable
• the containments are all proper;
• we know some specific languages that made each containment proper.
• but we have not proved Hilber10 is undecidable.
Chapter 4. Decidability
The relationship among classes of languages
regular ⊂ context-free ⊂ decidable ⊂ Turing-recognizable
• the containments are all proper;
• we know some specific languages that made each containment proper.
• but we have not proved Hilber10 is undecidable.
• the first undecidable problem proved was HALTT M , historically.
Chapter 4. Decidability
Chapter 4. Decidability
4.2 Undecidable languages
Chapter 4. Decidability
4.2 Undecidable languages
We will discuss the following:
Chapter 4. Decidability
4.2 Undecidable languages
We will discuss the following:
1. Cantor’s Diagonalization method
(first used to prove real numbers are not countable)
Chapter 4. Decidability
4.2 Undecidable languages
We will discuss the following:
1. Cantor’s Diagonalization method
(first used to prove real numbers are not countable)
2. Show the following language is not decidable
AT M = {hM, wi : Turing machine M accepts w}
using the diagonalization method.
Chapter 4. Decidability
4.2 Undecidable languages
We will discuss the following:
1. Cantor’s Diagonalization method
(first used to prove real numbers are not countable)
2. Show the following language is not decidable
AT M = {hM, wi : Turing machine M accepts w}
using the diagonalization method.
3. Show the HALTT M is not decidable, where
HALTT M = {hM, wi : Turing machine M halts on w}
using the result of 2.
Chapter 4. Decidability
Chapter 4. Decidability
Diagonalization method (Cantor)
Chapter 4. Decidability
Diagonalization method (Cantor)
A set S is countable if either
(1) S is finite, or
(2) there is a correspondence mapping φ : S −→ N
where N is the natural number set.
Chapter 4. Decidability
Diagonalization method (Cantor)
A set S is countable if either
(1) S is finite, or
(2) there is a correspondence mapping φ : S −→ N
where N is the natural number set.
e.g., Z = {. . . , −2, −1, 0, 1, 2, . . . }, the set of all integers, is countable.
Chapter 4. Decidability
Diagonalization method (Cantor)
A set S is countable if either
(1) S is finite, or
(2) there is a correspondence mapping φ : S −→ N
where N is the natural number set.
e.g., Z = {. . . , −2, −1, 0, 1, 2, . . . }, the set of all integers, is countable.
e.g., Σ0 , the set of all binary strings, is countable
Chapter 4. Decidability
Diagonalization method (Cantor)
A set S is countable if either
(1) S is finite, or
(2) there is a correspondence mapping φ : S −→ N
where N is the natural number set.
e.g., Z = {. . . , −2, −1, 0, 1, 2, . . . }, the set of all integers, is countable.
e.g., Σ0 , the set of all binary strings, is countable
e.g., Q = { m
n : m, n ∈ N }, the set of all rational numbers, is countable.
Chapter 4. Decidability
Chapter 4. Decidability
One-to-one correspondence between Q and N
N:
Q:
1, 2, 3, 4, 5, 6, . . .
1, 2, 12 , 13 , 3, 4, . . .
Chapter 4. Decidability
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction.
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction. Assume that R is countable.
Then there is a one-to-one correspondence between N and R
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction. Assume that R is countable.
Then there is a one-to-one correspondence between N and R
Let real number x = 0.x1 x2 x3 . . . xi . . .
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction. Assume that R is countable.
Then there is a one-to-one correspondence between N and R
Let real number x = 0.x1 x2 x3 . . . xi . . . such that xi is different from
the ith digit (after the decimal point) in the ith real number.
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction. Assume that R is countable.
Then there is a one-to-one correspondence between N and R
Let real number x = 0.x1 x2 x3 . . . xi . . . such that xi is different from
the ith digit (after the decimal point) in the ith real number.
x is NOT in R. (Why?)
Chapter 4. Decidability
The set R of real numbers is NOT countable.
Proof by contradiction. Assume that R is countable.
Then there is a one-to-one correspondence between N and R
Let real number x = 0.x1 x2 x3 . . . xi . . . such that xi is different from
the ith digit (after the decimal point) in the ith real number.
x is NOT in R. (Why?)
Contradict!
Chapter 4. Decidability
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
0
1
00
01
10
11
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
T
0
T
1
F
00
T
01
T
10
F
11
F
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
T
T
0
T
F
1
F
F
00
T
F
01
T
F
10
F
F
11
F
T
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
T
T
F
0
T
F
F
1
F
F
T
00
T
F
F
01
T
F
T
10
F
F
F
11
F
T
F
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
T
T
F
F
0
T
F
F
F
1
F
F
T
F
00
T
F
F
T
01
T
F
T
F
10
F
F
F
F
11
F
T
F
F
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
T
T
F
F
T
0
T
F
F
F
T
1
F
F
T
F
T
00
T
F
F
T
T
01
T
F
T
F
F
10
F
F
F
F
T
11
F
T
F
F
T
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
M10
T
T
F
F
T
T
0
T
F
F
F
T
F
1
F
F
T
F
T
T
00
T
F
F
T
T
F
01
T
F
T
F
F
T
10
F
F
F
F
T
T
11
F
T
F
F
T
T
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
M10
M11
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... w ...
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
Mw
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... w ...
T
Chapter 4. Decidability
Recall Σ∗ is countable; therefore,
• the set of all binary strings can be encoded by natural numbers;
• the set of all TMs can be encoded by natural numbers;
There is a table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
Mw
...
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
...
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... w ...
T
where entry T (Mi , wj ) tells TM Mi accepts/rejects input wj .
e.g., T (M00 , 10) = F indicates M00 rejects string 10.
Chapter 4. Decidability
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D,
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D, then U rejects hMD , Di,
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D, then U rejects hMD , Di, MD rejects D;
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D, then U rejects hMD , Di, MD rejects D;
If MD rejects string D,
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D, then U rejects hMD , Di, MD rejects D;
If MD rejects string D, then U accepts hMD , Di,
Chapter 4. Decidability
Consider language
AT M = {hM, wi : Turing machine M accepts w}
Theorem 4.11 AT M is not decidable.
Proof idea:
Assume otherwise there is a decider H for language AT M .
• We can construct a decider MD that
On input w, MD calls U to decides on hMw , wi
and accepts w iff U rejects hMw , wi
i.e., MD does the exact opposite of H.
• Now question: does MD accepts input string D ?
If MD accepts string D, then U rejects hMD , Di, MD rejects D;
If MD rejects string D, then U accepts hMD , Di, MD accepts D;
Paradox!
Chapter 4. Decidability
Chapter 4. Decidability
We explain this proof from diagonalization of table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
MD
...
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
...
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
But MD does not exist in the table because:
... D ...
?
Chapter 4. Decidability
We explain this proof from diagonalization of table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
MD
...
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
...
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... D ...
?
But MD does not exist in the table because:
• If U accepts hMD , Di, it means MD accepts D,
but MD rejects D;
Chapter 4. Decidability
We explain this proof from diagonalization of table ALLT M :
M
M0
M1
M00
M01
M10
M11
...
MD
...
T
T
F
F
T
T
T
0
T
F
F
F
T
F
F
1
F
F
T
F
T
T
F
...
...
...
00
T
F
F
T
T
F
F
01
T
F
T
F
F
T
F
10
F
F
F
F
T
T
F
11
F
T
F
F
T
T
T
... D ...
?
But MD does not exist in the table because:
• If U accepts hMD , Di, it means MD accepts D,
but MD rejects D;
• If U rejects hMD , Di, it means MD rejects D,
but MD accepts D.
Chapter 4. Decidability
Chapter 4. Decidability
Showing other undecidable languages (using Theorem 4.11)
HALTT M = {hM, wi : Turing machine M halts on input w}
Chapter 4. Decidability
Showing other undecidable languages (using Theorem 4.11)
HALTT M = {hM, wi : Turing machine M halts on input w}
Theorem 5.1 HALTT M is undecidable. (from section
Chapter 4. Decidability
Showing other undecidable languages (using Theorem 4.11)
HALTT M = {hM, wi : Turing machine M halts on input w}
Theorem 5.1 HALTT M is undecidable. (from section
Proof idea:
• Transforming recognition of AT M to recognition of HALTT M , such that
Chapter 4. Decidability
Showing other undecidable languages (using Theorem 4.11)
HALTT M = {hM, wi : Turing machine M halts on input w}
Theorem 5.1 HALTT M is undecidable. (from section
Proof idea:
• Transforming recognition of AT M to recognition of HALTT M , such that
if HALTT M is decidable, so would AT M be.
Chapter 4. Decidability
Showing other undecidable languages (using Theorem 4.11)
HALTT M = {hM, wi : Turing machine M halts on input w}
Theorem 5.1 HALTT M is undecidable. (from section
Proof idea:
• Transforming recognition of AT M to recognition of HALTT M , such that
if HALTT M is decidable, so would AT M be.
• such a method is called reduction.
Chapter 4. Decidability
Chapter 4. Decidability
Assume that decider R for HALTT M .
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
On input hM, wi,
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
On input hM, wi,
• run R on hM, wi,
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
On input hM, wi,
• run R on hM, wi,
rejects if R rejects (meaning M does not halts on w);
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
On input hM, wi,
• run R on hM, wi,
rejects if R rejects (meaning M does not halts on w);
• if R accepts (meaning M halts on w),
Chapter 4. Decidability
Assume that decider R for HALTT M .
We construct a decide S for AT M as follows:
On input hM, wi,
• run R on hM, wi,
rejects if R rejects (meaning M does not halts on w);
• if R accepts (meaning M halts on w),
simulates M on w, accepts if M accepts; rejects if M rejects.
Chapter 4. Decidability
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
if ET M is decidable, so would AT M be.
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
if ET M is decidable, so would AT M be.
i.e., information deciding an instance for ET M can be used
to decide the instance hM, wi for AT M .
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
if ET M is decidable, so would AT M be.
i.e., information deciding an instance for ET M can be used
to decide the instance hM, wi for AT M .
Given hM, wi, construct TM M1 of following behavior:
on input x,
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
if ET M is decidable, so would AT M be.
i.e., information deciding an instance for ET M can be used
to decide the instance hM, wi for AT M .
Given hM, wi, construct TM M1 of following behavior:
on input x,
if x 6= w, rejects;
Chapter 4. Decidability
Another undecidable language:
ET M = {hM i : M is Turing machine and L(M ) = ∅}
Theorem 5.2 ET M is undecidable.
Proof idea:
Transforming recognition of AT M to recognition of ET M , such that
if ET M is decidable, so would AT M be.
i.e., information deciding an instance for ET M can be used
to decide the instance hM, wi for AT M .
Given hM, wi, construct TM M1 of following behavior:
on input x,
if x 6= w, rejects;
if x = w, then simulates M on w, accepts if M does.
Chapter 4. Decidability
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
On input hM, wi;
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
On input hM, wi;
• produces M1 as previously described;
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
On input hM, wi;
• produces M1 as previously described;
• runs R on hM1 i;
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
On input hM, wi;
• produces M1 as previously described;
• runs R on hM1 i;
rejects if R accepts (meaning L(M1 ) = ∅, M does not accept w),
Chapter 4. Decidability
Proof:
Assume that ET M is decidable. Then there is a decider R for ET M .
Construct decider S as follows for AT M :
On input hM, wi;
• produces M1 as previously described;
• runs R on hM1 i;
rejects if R accepts (meaning L(M1 ) = ∅, M does not accept w),
accepts if R rejects (meaning L(M1 ) 6= ∅, M accepts w)
Chapter 4. Decidability
Chapter 4. Decidability
Corollary: The following languages are not Turing recognizable:
AT M , HALTT M , ET M
About the Rest of the Textbook
About the Rest of the Textbook
Chapter 5. Reducibility
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
• positive instances of A are mapped to positive instances of B
• positive instances of A are mapped to positive instances of B
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
• positive instances of A are mapped to positive instances of B
• positive instances of A are mapped to positive instances of B
So the answers to language B can be used for answers to language A.
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
• positive instances of A are mapped to positive instances of B
• positive instances of A are mapped to positive instances of B
So the answers to language B can be used for answers to language A.
The consequence of reduction A ≤ B is that
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
• positive instances of A are mapped to positive instances of B
• positive instances of A are mapped to positive instances of B
So the answers to language B can be used for answers to language A.
The consequence of reduction A ≤ B is that
(1) If B is decidable, so is A;
About the Rest of the Textbook
Chapter 5. Reducibility
Reduction: A technique to transform one language A to another
language B, denoted as A ≤ B. It is a mapping from Σ∗ to Σ∗ such that
• positive instances of A are mapped to positive instances of B
• positive instances of A are mapped to positive instances of B
So the answers to language B can be used for answers to language A.
The consequence of reduction A ≤ B is that
(1) If B is decidable, so is A;
(2) If A is not decidable, neither is B.
About the Rest of the Textbook
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
Study languages that whose recognition may not need the full strength of
a Turing machine
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
Study languages that whose recognition may not need the full strength of
a Turing machine (called resource-bounded).
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
Study languages that whose recognition may not need the full strength of
a Turing machine (called resource-bounded).
For example,
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
Study languages that whose recognition may not need the full strength of
a Turing machine (called resource-bounded).
For example,
• the number of steps is limited - time complexity (CPU)
About the Rest of the Textbook
Part III. Computational Complexity Theory (Chapters 7, 8, 9, 10)
Study languages that whose recognition may not need the full strength of
a Turing machine (called resource-bounded).
For example,
• the number of steps is limited - time complexity (CPU)
• the amount of tape (space) is limited - space complexity (Memory)
Topics for the Final Exam
Topics for the Final Exam
1. Languages and models
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
- why containments are proper
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
- why containments are proper
- similarity and difference between regular and CF Pumping lemmas
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
- why containments are proper
- similarity and difference between regular and CF Pumping lemmas
- using regular language Pumping lemma to prove a non-regular language.
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
- why containments are proper
- similarity and difference between regular and CF Pumping lemmas
- using regular language Pumping lemma to prove a non-regular language.
Topics for the Final Exam
1. Languages and models
• DFA, NFA, RE, PDA, CFG, Turing-decider, Turing machine
- equivalence between some of these models
- model definitions, definition of accepting a string
(and definition of recognizing a language)
• Chomsky hierarchy:
regular ⊂ context − free ⊂ decidable ⊂ recognizable ⊂ any
- why containments are proper
- similarity and difference between regular and CF Pumping lemmas
- using regular language Pumping lemma to prove a non-regular language.
• Operations on regular, context-free, Turing decidable, and
Turing recognizable languages: union, intersection, complementary,
concatenation, star
Topics for the Final Exam
Topics for the Final Exam
2. Turing machines
Topics for the Final Exam
2. Turing machines
• basics of a TM, definition of TM computation, TM diagram,
Topics for the Final Exam
2. Turing machines
• basics of a TM, definition of TM computation, TM diagram,
• trace a TM on a given input
Topics for the Final Exam
2. Turing machines
• basics of a TM, definition of TM computation, TM diagram,
• trace a TM on a given input
• design simple TMs (diagrams)
Topics for the Final Exam
2. Turing machines
• basics of a TM, definition of TM computation, TM diagram,
• trace a TM on a given input
• design simple TMs (diagrams)
• equivalent models of TMs
Topics for the Final Exam
2. Turing machines
• basics of a TM, definition of TM computation, TM diagram,
• trace a TM on a given input
• design simple TMs (diagrams)
• equivalent models of TMs
Topics for the Final Exam
Topics for the Final Exam
3. Decidability and undecidability proofs
Topics for the Final Exam
3. Decidability and undecidability proofs
• decidable languages defined with learned computation models
such as ADF A , EQDF A , ECF G , etc.
Topics for the Final Exam
3. Decidability and undecidability proofs
• decidable languages defined with learned computation models
such as ADF A , EQDF A , ECF G , etc.
• simulation techniques used for decidability proofs
Topics for the Final Exam
3. Decidability and undecidability proofs
• decidable languages defined with learned computation models
such as ADF A , EQDF A , ECF G , etc.
• simulation techniques used for decidability proofs
• undecidability proofs
- understand the logic of existing proofs