Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 23: Universal Machines

David Evans
November 22, 2016
3.1k

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
Tweet

Transcript

  1. Class  23:   Universal  Machines cs2102:  Discrete  Mathematics  |  F16

    uvacs2102.github.io   David  Evans   University  of  Virginia Halting  Problems Hockey  Team
  2. 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).
  3. 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   → ∈ .
  4. 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   → ∈ .
  5. 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: ???
  6. 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 , = (, )  
  7. 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,    
  8. 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}?  
  9. XOR  Language 10 qrs =  {  0 P … R

    + 0 P … R = 0 P … R #  |   Y ∈ 0, 1 , Y ∈ 0, 1 , Y = Y ⊕ Y  }
  10. 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  …
  11. 12

  12. 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  .
  13. 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.
  14. Deciding  XOR  Language 15 qrs =  {  0 P …

    R + 0 P … R = 0 P … R #  |   Y ∈ 0, 1 , Y ∈ 0, 1 , Y = Y ⊕ Y  }
  15. 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
  16. 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$
  17. 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
  18. 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.)
  19. 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.)
  20. 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
  21. Languages  and  Machines ∀ ∈ Σ∗, ∶=      ~

     described  by                is  valid  TM  description RejectMachine                                        ℎ                                           qreject
  22. Self-­‐Rejecting ℒ ≔ the  language  recognized  by   Self−Rejecting ≔

      ∈ Σ∗ ∉ ℒ  } ∶=  ~  described  by                is  valid  TM  description RejectMachine                                        ℎ