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

TM_Universal

Tiffany
October 06, 2022

 TM_Universal

Tiffany

October 06, 2022
Tweet

More Decks by Tiffany

Other Decks in Science

Transcript

  1. Turing Machines and Regular Languages
    We’ll do this on a 4 tape TM. Our TM’s first task is to move
    things onto the right tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    5 / 40

    View Slide

  2. Turing Machines and Regular Languages
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    We search tape 0 for the current state (as recorded on tape 2)
    Here, we already found it.
    6 / 40

    View Slide

  3. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Then we search tape 0 for the input symbol (as found on tape 3)
    We use the TM’s state to keep track of whether we are after a ,
    or an =.
    7 / 40

    View Slide

  4. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Then we move across the = on tape 0, find the state number
    and update Tape 2
    (no change on tape 2: already in state 0)
    8 / 40

    View Slide

  5. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Then we scan back to the start of Tape 0, and advance Tape 3
    by one position
    Tape 3’s movement is the DFA going to the next character of
    input.
    9 / 40

    View Slide

  6. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Already at state 0’s description, so find 1
    10 / 40

    View Slide

  7. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Go after the =, and update state number (tape 2)
    11 / 40

    View Slide

  8. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Scan to left of Tape 0, advance on Tape 3.
    12 / 40

    View Slide

  9. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Now, we search for state 1’s description on Tape 0
    Use TM state to remember if we just crossed a ;
    13 / 40

    View Slide

  10. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Find input symbol (1 from Tape 3)
    14 / 40

    View Slide

  11. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Find destination state (0) and update tape 2.
    15 / 40

    View Slide

  12. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    Scan to left on Tape 0 and move right one on Tape 3.
    We’ll skip to the end now...
    16 / 40

    View Slide

  13. Turing Machines and Regular Languages
    Tapes:
    Tape 0: Transition function
    Tape 1: Accepting states
    Tape 2: Current state (starts at 0)
    Tape 3: Input to DFA
    t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 1 t t t t t t t t t t t t t t t t t t t
    t 0 1 1 0 1 t t t t t t t t t t t t t t t
    When Tape 3 sees t, we have reached the end of the DFAs
    input
    We need to see if the current state (recorded on Tape 2) is
    accepting (listed on tape 1)
    If we find it, we accept, if not, we reject (here we accept)
    17 / 40

    View Slide