Share
Embed
Class 23: Universal Machines
cs2102: Discrete Mathematics
University of Virginia, Fall 2016
See course site for notes:
https://uvacs2102.github.io
David Evans
November 22, 2016
Transcript
31 slides
-
Class 23: Universal Machines cs2102: Discrete Mathematics | F16
uvacs2102.github.io David Evans University of Virginia Halting Problems Hockey Team -
Plan Recap: Turing Machine Execution Model Universal Machines Happy Thanksgiving!
1 PS9 due next Wednesday -
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). -
Execution Model for Turing Machines = (, ⊆ × Γ
→ × Γ × , 0 ∈ , 233456 ⊆ ) is a finite set, Γ is finite set of symbols, = {L, R, Halt} The execution of a state machine, = (, ⊆ ×, 0 ∈ ) is a (possibly infinite) sequence of states, (0 , P , … , R ) that: 1. 0 = 0 (it begins with the start state) 2. ∀ ∈ 0, 1, … , − 1 . Y → YZP ∈ (if and are consecutive states in the sequence, there is an edge → ∈ . -
Execution Model for Turing Machines = (, ⊆ × Γ
→ × Γ × , 0 ∈ , 233456 ⊆ ) is a finite set, Γ is finite set of symbols, = {L, R, Halt} The execution of a state machine, = (, ⊆ ×, 0 ∈ ) is a (possibly infinite) sequence of states, (0 , P , … , R ) that: 1. 0 = 0 (it begins with the start state) 2. ∀ ∈ 0, 1, … , − 1 . Y → YZP ∈ (if and are consecutive states in the sequence, there is an edge → ∈ . -
Execution Model for Turing Machines = (, ⊆ × Γ
→ × Γ × , 0 ∈ , 233456 ⊆ ) is a finite set, Γ is finite set of symbols, = {L, R, Halt} The execution of a state machine, = (, ⊆ ×, 0 ∈ ) is a (possibly infinite) sequence of states, (0 , P , … , R ) that: 1. 0 = 0 (it begins with the start state) 2. ∀ ∈ 0, 1, … , − 1 . Y → YZP ∈ (if and are consecutive states in the sequence, there is an edge → ∈ . The execution of a Turing Machine, = (, ⊆ × Γ → × Γ × , 0 ∈ , 233456 ⊆ ) is a (possibly infinite) sequence of configurations, (0 , P , … ) where ∈ Tsil × × List, such that: 1. 0 = (0 = , 0 , 0 = ) 2. ∀ ∈ 0, 1, … , − 1 . Y = Y , Y , Y → YZP = (YZP , YZP , YZP ) ∈ where transitions are defined as: ??? -
The execution of a Turing Machine, = (, ⊆ ×
Γ → × Γ × , 0 ∈ , 233456 ⊆ ) is a (possibly infinite) sequence of configurations, 0 , P , … , where ∈ Tsil × × List, such that: 1. 0 = (0 = , 0 , 0 = ) 2. ∀ ∈ 0, 1, … , − 1 . Y = Y , Y , Y → YZP = (YZP , YZP , YZP ) ∈ where transitions are defined as: Case 1 (of many, others not shown): d , ) → (e , , Left) ∈ : , , d , = (, ) -
The execution of a Turing Machine, = (, ⊆ ×
Γ → × Γ × , 0 ∈ , 233456 ⊆ ) is a (possibly infinite) sequence of configurations, 0 , P , … , R where ∈ Tsil × × List, such that: 1. 0 = (0 = , 0 , 0 = ) 2. ∀ ∈ 0, 1, … , − 1 . Y = Y , Y , Y → YZP = (YZP , YZP , YZP ) ∈ where transitions are defined as: Case 1 (of many, others not shown): d , ) → (e , , Left) ∈ : , , d , = (, ) → , e , (, ) Need cases for dir = Left, dir = Right, dir = Halt, -
TM Computation Definition. A language (in most Computer Science uses)
is a (possibly infinite) set of finite strings. Σ = alphabet, a finite set of symbols ⊆ Σ∗ How many languages are there for Σ = {0, 1}? -
XOR Language 10 qrs = { 0 P … R
+ 0 P … R = 0 P … R # | Y ∈ 0, 1 , Y ∈ 0, 1 , Y = Y ⊕ Y } -
TM Computation 11 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, (, z , ), where z ∈ 233456. The execution of a Turing Machine, = (, ⊆ × Γ → × Γ × , 0 ∈ , 233456 ⊆ ) is a (possibly infinite) sequence of configurations, 0 , P , … , R where ∈ Tsil × × List, such that: 1. 0 = (0 = , 0 , 0 = ) 2. ∀ ∈ 0, 1, … , − 1 . Y = Y , Y , Y → YZP = (YZP , YZP , YZP ) ∈ where transitions are defined … -
Recognizing a Language 13 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, (, z , ), where z ∈ 233456. A Turing Machine, = (, , 0 , 233456 ), recognizes a language , if for all string ∈ , accepts , and there is no string ∉ such that accepts . -
Deciding a Language 14 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 strings ∈ , accepts , and there is no string ∉ such that accepts and for all strings terminates. Note: this is the “standard” definition. Definition in book 8.2 is a bit different. -
Deciding XOR Language 15 qrs = { 0 P …
R + 0 P … R = 0 P … R # | Y ∈ 0, 1 , Y ∈ 0, 1 , Y = Y ⊕ Y } -
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 Accept $ → $, 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 Accept $ → $, Halt How many steps on: 00+10=10$ -
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 -
Church-‐Turing Thesis A Turing Machine (or Lambda Calculus) can
simulate any “mechanical computer”. Alonzo Church, 1903-‐1995 Alan Turing, 1912-‐1954 21 All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.) -
Church-‐Turing Thesis Is this a statement that can be
proved true or false? Alonzo Church, 1903-‐1995 Alan Turing, 1912-‐1954 22 All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.) -
An Any TM Simulator Input: < Description of some TM
M, w > Output: result of running M on w Universal Turing Machine M w Output Tape for running TM-‐M starting on tape w -
Languages and Machines ∀ ∈ Σ∗, ∶= ~
described by is valid TM description RejectMachine ℎ qreject -
Self-‐Rejecting ℒ ≔ the language recognized by Self−Rejecting ≔
∈ Σ∗ ∉ ℒ } ∶= ~ described by is valid TM description RejectMachine ℎ