Share
Embed
Class 24: Halting Problems
cs2102: Discrete Mathematics
University of Virginia, Fall 2016
See course site for notes:
https://uvacs2102.github.io
David Evans
November 29, 2016
Transcript
34 slides
-
Class 24: Halting Problems cs2102: Discrete Mathematics | F16
uvacs2102.github.io David Evans University of Virginia Albert Mayo -
Plan Today: Undecidable Problems Decidability in Theory and Practice Thursday:
Number Theory and Cryptography 1 Final Preparation Notes PSΩ due Sunday/Tuesday -
Turing Machines Recap 2 = (, ⊆ × Γ →
× Γ × , 0 ∈ , 233456 ⊆ ) is a finite set, Γ is finite set of symbols, = {L, R, Halt} S R0 R1 X0 X1 Y0 Y1 Z0 Z1 B C 0*→*X,*R 1 →*1,*R 0*→*0,*R 1 →*1,*R +*→*+,*R 0*→*0,*R 1 →*1,*R 0*→*0,*R 1 →*1,*R =*+=,*R X →*X,*R X →*X,*R 0*→*X,*R 1 →*X,*R X →*X,*R X →*X,*R 0*→*X,*L 1*→*X,*L 0*→*0,*L 1 →*1,*L + →*+,*L =*→*=,*L X*→*X,*R =*→*=,*R Accep t $*→*$,*Halt -
3 A Turing Machine, = (, , 0 ,
233456 ), accepts a string, , if there is an execution of that starts in configuration, (null, 0 , ), and terminates in a configuration, (, D , ), where D ∈ 233456. An execution of a Turing Machine, = (, ⊆ × Γ → × Γ × , 0 ∈ , 233456 ⊆ ) is a (possibly infinite) sequence of configurations, 0 , E , … , G where ∈ Tsil × × List, such that (1) 0 = (, 0 , ) and (2) all Q → QRE steps are valid following . A Turing Machine, = (, , 0 , 233456 ), recognizes a language , if for all string ∈ , accepts , and there is no string ∉ such that accepts . -
Recap: Cardinality of TM = (, ⊆ × Γ →
× Γ × , 0 ∈ , 233456 ⊆ ) is a finite set, Γ is finite set of symbols, = {L, R, Halt} computable numbers ≤ = ℕ < ℝ Hence, there are real numbers that are not computable. Today: let’s find one (and understand what it means). -
Proving Recognizability How can we prove a language is Turing-‐recognizable?
5 A Turing Machine, = (, , 0 , 233456 ), recognizes a language , if for all string ∈ , accepts , and there is no string ∉ such that accepts . -
Proving Un-‐Recognizability How can we prove a language is not
Turing-‐recognizable? 6 A Turing Machine, = (, , 0 , 233456 ), recognizes a language , if for all string ∈ , accepts , and there is no string ∉ such that accepts . -
Decidability and Recognizability 7 A Turing Machine, = (,
, 0 , 233456 ), recognizes a language , if for all string ∈ , accepts , and there is no string ∉ such that accepts . A Turing Machine, = (, , 0 , 233456 ), decides a language , if for all string ∈ , accepts , and for all strings ∉, terminates in a non-‐accepting state. -
Decidability and Computability 8 A Turing Machine, = (,
, 0 , 233456 ), decides a language , if for all string ∈ , accepts , and for all strings ∉, terminates in a non-‐accepting state. “computability” is decidability for functions – essentially the same meaning -
Languages and Machines ∀ ∈ Σ∗, ∶= h
described by is valid TM description RejectMachine ℎ qreject -
Self-‐Rejecting Language ℒ ≔ the language recognized by SelfRejecting
≔ ∈ Σ∗ ∉ ℒ } ∶= h described by is valid TM description RejectMachine ℎ -
Self-‐Rejection is Self-‐Defeating! SelfRejecting ≔ ∈ Σ∗ ∉ ℒ
} Is there a xy = (xy ) that recognizes SelfRejecting? -
Diagonalization Proof e 0 1 00 01 10 11 000
001 010 … M(e) ü ü ü ü … M(0) ü ü ü ü ü ü … M(1) ü ü ü M(00) M(01) ü ü ü M(10) ü M(11) M(000) ü ü ü ü ü ü ü ü ü ü ü … M(w) ü ü … Input Machine SelfRejecting ≔ ∈ Σ∗ ∉ ℒ } Which of the machines are in SelfRejecting? -
Diagonalization Proof e 0 1 00 01 10 11 000
001 010 … M(e) ü ü ü ü … M(0) ü ü ü ü ü ü … M(1) ü ü ü M(00) M(01) ü ü ü M(10) ü M(11) M(000) ü ü ü ü ü ü ü ü ü ü ü … M(w) ü ü … Input Machine SelfRejecting ≔ ∈ Σ∗ ∉ ℒ } Where is z{|}~{•{€•‚ƒ„? -
An Any TM Simulator Universal Turing Machine w x Result
of running M(w) on input x Recall from Class 23: -
Accepting Language 19 Is †‡Turing-‐recognizable? Sure, the Universal TM
recognizes it! Proof sketch: ‰Š < , > = (< , >) †‡ = , accepts } -
Accepting Language 20 Is †‡Turing-‐decidable? Does the recognizability proof work?
Proof sketch: ‰Š < , > = (< , >) †‡ = , accepts } -
Accepting Language 21 Is †‡Turing-‐decidable? No! Proof by contradiction: Assume
= 2 decides †‡ . †‡ = , accepts } -
22 No! Proof by contradiction: Assume = 2 decides
†‡ . We can construct = (Ž ) that takes input and simulates , and do opposite: 233456 • = − 233456 . †‡ = , accepts } -
23 No! Proof by contradiction: Assume = 2 decides
†‡ . We can construct = (Ž ) that takes input and simulates , and do opposite: 233456 • = − 233456 . †‡ = , accepts } What should Ž do? -
†‡ is Undecidable So, D must not exist. But, if
H exists, we can make D. So, H must not exist! But, if ATM is decidable, H must exist. Thus, ATM must not be decidable. †‡ = , accepts } < , > ≔ if () accepts , accept; otherwise reject. < > ≔ if accepts (, ), reject; otherwise, accept. = Ž Ž = ? -
Halting Problem 25 †‡ = , accepts
} †‡ = , terminates on } -
def paradox(): if halts('paradox()'): while True: pass Halting Problems
Hockey Team Pythonic Version -
Other Undecidable Languages 27 †‡ = , accepts
} †‡ = , terminates on } 3†‡ = , enters state q• on } Virus†‡ = is a virus } Rice’s Theorem: basically, any interesting “dynamic” property is undecidable -
Ali G Problem 30 ℒAliG ≔ × =
, ∈ 9 ∗, = }} Is there a Turing Machine AliG that decides ℒAliG? -
Computability ≠ Practical Solvability What does computability of Ali G
problem mean in practice? -
Charge Undecidable languages: no ideal computer can always decide real
computers often can: approximate, only solve some inputs Decidable languages: for ideal computers, always decides for real computers, real inputs matter