Theoretical Computer Science I
Jian Liu
Institute for Theoretical Computer Science
Graz University of Technology
2017.03.17
Today
Algorithm
Turing machine (TM)
TM: Formal definition
TM: Detailed explanation
Algorithm
Hilbert’s tenth problem
Given a Diophantine equation with any
number of unknown quantities and with
rational integral numerical coefficients:
David Hilbert
David Hilbert presented 23 problems at the Paris conference of the International Congress of
Mathematicians in 1900.
Algorithm
Hilbert’s tenth problem
A Diophantine equation is a polynomial equation,
usually in two or more unknowns, such that only
the integer solutions are sought or studied
Fermat's last theorem, when n>2
Algorithm
Hilbert’s tenth problem
Given a Diophantine equation with any
number of unknown quantities and with
rational integral numerical coefficients:
To devise a process according to which it
can be determined in a finite number of
operations whether the equation is
solvable in rational integers.
David Hilbert
David Hilbert presented 23 problems at the Paris conference of the International Congress of
Mathematicians in 1900.
Algorithm
Hilbert’s problem is not concerned with finding the
solutions. It only asks whether one or more solutions
exist. (Yes/No)
Hilbert thus asked explicitly and in a defined abstract
form for a decision algorithm.
He remarked: “occasionally it happens that we seek
the solution under insufficient hypotheses or in an
incorrect sense, and for this reason do not succeed.
The problem then arises: to show the impossibility of
the solution under the given hypotheses or in the
sense contemplated."
It was proved with a negative answer until 1970. In
modern terms, it is an undecidable problem.
Algorithm: model-based approach
Making statement about unknown future event
A physical model (for example, a model of the
sun) allows us to make statements about events
that can not be directly observed.
Algorithm
Turing machine
In 1936, Alan Turing proposed a
general machine model for
calculations:
Turing machine
He proposed that any intuitive
function can be represented as a
Turing machine
(Church-Turing Thesis).
Alan Turing
Turing machine
Scheme of a sequential computer:
• Input
• Processor
• Output
• Program
• Memory
Easiest way: input, output, memory on a single tape.
Turing machine
Turing machine
Turing Machine
A TM consists of an infinite length tape, on which input is
provided as a finite sequence of symbols.
A head reads the input tape.
The TM starts at start state s0.
On reading an input symbol it optionally
1. replaces it with another symbol
2. changes its internal state
3. moves one cell to the right or left
Formal Definition for Turing Machine
Start configuration
Start: the input is on tape, and the head is on the
first input character.
For example: Σ = {0, 1},
Configuration
E.g.
Configuration
Turing Machine:
Input
alphabet
States
Tape
alphabet
M= ( Q, Σ, Γ, δ, q 0 ,
Transition
function
, F)
Final
states
Initial
state
blank
A Turing Machine
Tape
......
No boundaries -- infinite length
......
Control Unit
Read-Write head
The head moves Left or Right
......
......
Read-Write head
The head at each time step:
1. Reads a symbol
2. Writes a symbol
3. Moves Left or Right
Example:
Time 0
......
a b a c
Time 1
......
1. Reads
a
a
2. Writes k
3. Moves Left
b k
c
......
......
Time 1
......
k
c
Time 2
......
1. Reads
b
a
a
b
2. Writes f
3. Moves Right
f
k
c
......
......
Input string
......
a
b
a
c
Blank symbol
......
head
Remark: Head starts at the leftmost position
of the input string
Input string
......
a
b
a
c
Blank symbol
......
head
Remark: the input string is never empty
States & Transitions
Read
Write
q1
a →b,L
Move Left
q2
Move Right
q1
a →b,R
q2
Example:
Time 1
......
b
a
a
c
q1
current state
q1
a →b,R
q2
......
Time 1
......
a
b
a
c
......
q1
Time 2
......
a
b
b
c
q2
q1
a →b,R
q2
......
Example:
......
Time 1
a
b
a
c
......
q1
Time 2
......
a
b
b
q2
q1
a →b,L
q2
c
......
Example:
Time 1
......
a
b
a
......
c
q1
Time 2
......
a
b
b
c
......
g
q2
q1
→g,R
q2
Determinism
Deterministic Turing Machines
Not Allowed
Allowed
a →b,R
q2
a →b,R
q2
a →d,L
q3
q1
q1
q3
b →d,L
Halting
The machine halts if there are
no possible transitions to follow
Final States
q1
q2
Allowed
q1
q2
Not Allowed
• Final states have no outgoing transitions
• In a final state the machine halts
Acceptance
Accept Input
If machine halts
in a final state
Reject Input
If machine halts
in a non-final state
or
If machine enters
an infinite loop
Turing Machine Example
A Turing machine that accepts the language
a →a,R
q0
→ ,L
q1
Time 0
a
a
a
q0
a →a,R
q0
→ ,L
q1
Time 1
a
a
a
q0
a →a,R
q0
→ ,L
q1
Time 2
a
a
a
q0
a →a,R
q0
→ ,L
q1
Time 3
a
a
a
q0
a →a,R
q0
→ ,L
q1
Time 4
a
a
a
q1
a →a,R
q0
Halt & Accept
→ ,L
q1
Rejection Example
Time 0
a
b
a
q0
a →a,R
q0
→ ,L
q1
Time 1
a
b
a
q0
No possible Transition
a →a,R
q0
Halt & Reject
→ ,L
q1
Infinite Loop Example
A Turing machine example
b →b,L
a →a,R
q0
→ ,L
q1
Time 0
a
b
a
q0
b →b,L
a →a,R
q0
→ ,L
q1
Time 1
a
b
a
q0
b →b,L
a →a,R
q0
→ ,L
q1
Time 2
a
b
a
q0
b →b,L
a →a,R
q0
→ ,L
q1
Time 2
a
b
a
b
a
q0
a
q0
Time 4
a
b
a
q0
Time 5
a
b
q0
a
Infinite loop
Time 3
Because of the infinite loop:
•The final state cannot be reached
•The machine never halts
•The input is not accepted
Another Turing Machine Example
{a
Turing machine for the language
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
n
b
n
}
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 0
a
a
b
b
q0
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 1
x
a
b
b
q1
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 2
x
a
b
b
q1
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 3
x
a
y
b
q2
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 4
x
a
y
b
q2
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 5
x
a
y
b
q0
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 6
x
x
y
b
q1
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 7
x
x
y
b
q1
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 8
x
x
y
y
q2
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 9
x
x
y
y
q2
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 10
x
x
y
y
q0
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 11
x
x
y
y
q3
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 12
x
x
y
y
q3
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Time 13
x
x
y
y
q4
Halt & Accept
q4
y →y,R
q3
y →y,R
→ ,L
q0
a →x,R
y →y,R
y →y,L
a →a,R
a →a,L
q1
b →y,L
x →x,R
q2
Observation:
If we modify the
machine for the language
we can easily construct
a machine for the language
{a
n
b
{a
n
n
}
n
b c
n
}
Remind: Turing Machine:
States
Input
alphabet
Tape
alphabet
M= ( Q, Σ, Γ, δ, q 0 ,
Transition
function
, F)
Final
states
Initial
state
blank
Transition Function
q1
a →b,R
q2
δ ( q 1 ,a )= ( q 2 ,b,R )
Transition Function
q1
c →d,L
q2
δ ( q 1 ,c )= ( q 2 ,d,L )
Configuration
c
a
b
a
q1
Instantaneous description:
ca q1 ba
Time 4
x
a
y
Time 5
b
x
q2
A Move:
a
q0
q 2 xayb
x q 0 ayb
y
b
Time 4
x
Time 5
y
a
b
x
q2
b
y
b
q0
Time 6
x
y
a
x
y
Time 7
b
x
x
q1
q1
q 2 xayb
x q 0 ayb
xx q1 yb
xxy q1 b
q0 w
Initial configuration:
Input string
w
a
q0
a
b
b
Standard Turing Machine
The machine we described is:
• Deterministic
• Infinite tape in both directions
•Tape is the input/output file
Today
Algorithm
Turing machine (TM)
TM: Formal definition
TM: Detailed explanation
© Copyright 2026 Paperzz