The Halting Problem and Decidability - PowerPoint PPT Presentation

About This Presentation
Title:

The Halting Problem and Decidability

Description:

difficult task, but nevertheless can be carried out by an. algorithm (e.g. a compiler) ... e(M)*x UTM outputs fM(x) iff M computes fM(x) i.e. it halts. input ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 12
Provided by: Muf7
Category:

less

Transcript and Presenter's Notes

Title: The Halting Problem and Decidability


1
The Halting Problem and Decidability
  • How powerful is a TM?
  • Any program in a high level language can be
    simulated by a
  • TM.
  • Any algorithmic procedure carried out by a human
    or a
  • computer can be carried out by a TM.
  • Algorithm is an informal notion but we have
    identified it with
  • a TM.
  • Questions
  • Are there problems that cannot be solved by an
    algorithm?
  • (existence)
  • What are some example problems?
  • (witness)
  • The plan

2
Universal Turing Machines
  • Interpreting and running programs is algorithmic.
    It is is a
  • difficult task, but nevertheless can be carried
    out by an
  • algorithm (e.g. a compiler).
  • SO
  • We can design a (universal) TM which compiles
    or runs
  • other TMs. This is the universal TM it takes
    as input a TM
  • and its input tape, and runs the TM on that
    input.
  • e(M)x UTM
    outputs fM(x)

  • iff M computes fM(x)

  • i.e. it halts

  • input
    loops

  • iff M loops on x
  • If M is a TM, then encode it by e(M). x is the
    input for M, is a separator symbol.

3
Encoding a Turing Machine
  • Consider a TM M with states Q and alphabet S (the
    input alphabet).
  • Let A a1,a2, both infinite sets
  • St q1,q2,
  • Such that Q C St and S C A.
  • Encode every symbol ai in A by e(ai) ai, where i
    is the binary
  • representation of i. For example, a5 is encoded
    by a101. Similarly, qi
  • encodes qi.
  • Assume a1 is the marker lt, a2 is a blank, and q1
    is the start state.
  • Represent every halting state by a blank. So the
    transition (q,a),( ,a)
  • is a transition into a halting state (trust me).
  • The TM is represented by a sequence of
    transitions of form
  • ((qi,aj),(qk,t)) where t is either ar (a
    symbol), or -gt or lt-. Note, qk
  • might be blank.

4
Encoding a Turing Machine
  • Now, to simulate M, assume a 3-tape version for
    the UTM U.
  • Tape 1 has e(M)e(x)
  • Copy e(M) on to tape 2
  • Shift e(x) to leftmost position of tape 1.
  • Tape 1 will be used to simulate the I/O of M.
    Note that tape 1head
  • does not look at a symbol from x, but an encoding
    of it, e.g. a101
  • instead of a5. So, before any simulation step
    assume head is a first
  • symbol of encoding. E.g. a101.
  • 4. Tape 3 is used to hold qi the encoding of
    the current state qi in M.
  • To simulate a step in M, assume U is in the state
    (corresponding to )
  • qj in M (qj on tape 3), and tape 1 head points at
    ai (tape 1). Look up
  • transition for (qj,ai) on tape 2 and simulate
    that transition, leaving new
  • state on tape 3 and move tape 1 head accordingly.
  • This concludes simulation of M by U.

5
Undecidability/unsolvability
  • Undecidability/unsolvability shades of the same
    thing.
  • A problem is unsovable if there exists no Turing
    machine to compute
  • it
  • Question1 . Are there problems that cannot be
    solved by an
  • algorithm? (existence)
  • Yes. Proof
  • Show all TMs can be enumerated
  • Show all partial functions cannot be enumerated.
    (Diagonalisation)
  • Encode every TM M by a unique number n(M) (Godel
  • numbering)
  • Encode M by e, as for UTMs. ie consider e(M).
    Convert every
  • transition to binary, then concat all together,
    with inputs. Result is one
  • long string which can be interpreted as a number.
  • ii) Enumerate all the TMs as follows

6
Undecidability/unsolvability
  • 2. There exists a (partial) function fN-gtN that
    is not (partial) Turing
  • computable, i.e. there is a function without a
    corresponding machine.
  • Proof Diagonalisation.
  • For every k, let fk be the function computed by
    Tk.
  • Now construct a diagonal function f
  • f(x) f(x) 1 if x is in
    dom(f(x))
  • 0
    otherwise
  • e.g. if f(3) 6, then f(3) 7.
  • 0 1
    2 3
  • f(0) f(0)ltgt f(0)
  • f(1) f(1)ltgt f(1)
  • f(2)
    f(2)ltgt f(2)
  • .
  • .

7
The Halting Problem
  • Problem Design a machine H such that

  • outputs 1
  • e(M)e(x) H
    iff M halts given input x


  • outputs 0
  • Input
    iff M does not halt given
    input x
  • Theorem The Halting problem is unsolvable
  • Proof By contradiction. Assume H exists and
    then derive a contradiction.
  • Construct the following machine H
  • e(M) copier e(M)e(M)
    modified loops iff

  • H M halts given
    input (e(M))

  • outputs 0 iff

  • M does not halt
  • H
    given input e(M))

8
Implications
  • There is no algorithm which can take an arbitrary
    program and arbitrary input, and tell you whether
    or not the program will halt.
  • You may be able to show this for a particular
    program, or even a sub-class of programs, but
    there is no general strategy for all programs.
  • E.g.
  • While b do .
  • For i1 to x do .
  • The world of computing is littered with
    (interesting!) unsolvable problems!

9
Decision problems
  • Unsolvable problems yes/no solutions
  • Examples
  • Does z xy, (for integers x,y,z)
  • Does TM M halt given x as input.
  • Does TM M halt for very input x in S.
  • Does TM M halt for given input e.
  • Are two TMs equivalent.
  • Does a diaphantine equation have a solution.
    (Hilberts 10th problem)
  • A DE has form p(x1,xn) 0
  • e.g. x2y2 z2
  • x2-2 0
  • 7. Is a predicate calculus statement valid.
    (1936, Church)

10
Reduction
  • Arguments by reduction
  • Defn A decision problem P reduces to P, P-gtP,
    if an algorithm to solve P can be used directly
    to solve P.
  • P-gtP iff
  • e(I) TM e(I)
  • I is instance of P, I is instance of P.
  • --------------------------------------------------
    --------------------------------------------------
  • Theorem If P-gtP and P is solvable, then so
    is P .
  • Corollary If P-gtP and P is unsolvable then so
    is P.
  • e(I) TM e(I) P
    1 iff I in Y(P) iff 1 in Y(P)
  • P-gtP TM
    0 iff I in N(P) iff 1 in N(P)

11
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com