costas busch - rpi1 turing machines. costas busch - rpi2 the language hierarchy regular languages...

Download Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?

Post on 21-Dec-2015

216 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

  • Slide 1
  • Costas Busch - RPI1 Turing Machines
  • Slide 2
  • Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
  • Slide 3
  • Costas Busch - RPI3 Regular Languages Context-Free Languages Languages accepted by Turing Machines
  • Slide 4
  • Costas Busch - RPI4 A Turing Machine...... Tape Read-Write head Control Unit
  • Slide 5
  • Costas Busch - RPI5 The Tape...... Read-Write head No boundaries -- infinite length The head moves Left or Right
  • Slide 6
  • Costas Busch - RPI6...... Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right
  • Slide 7
  • Costas Busch - RPI7...... Example: Time 0...... Time 1 1. Reads 2. Writes 3. Moves Left
  • Slide 8
  • Costas Busch - RPI8...... Time 1...... Time 2 1. Reads 2. Writes 3. Moves Right
  • Slide 9
  • Costas Busch - RPI9 The Input String...... Blank symbol head Head starts at the leftmost position of the input string Input string
  • Slide 10
  • Costas Busch - RPI10...... Blank symbol head Input string Remark: the input string is never empty
  • Slide 11
  • Costas Busch - RPI11 States & Transitions Read Write Move Left Move Right
  • Slide 12
  • Costas Busch - RPI12 Example:...... Time 1 current state
  • Slide 13
  • Costas Busch - RPI13...... Time 1...... Time 2
  • Slide 14
  • Costas Busch - RPI14...... Time 1...... Time 2 Example:
  • Slide 15
  • Costas Busch - RPI15...... Time 1...... Time 2 Example:
  • Slide 16
  • Costas Busch - RPI16 Determinism Allowed Not Allowed No lambda transitions allowed Turing Machines are deterministic
  • Slide 17
  • Costas Busch - RPI17 Partial Transition Function...... Example: No transition for input symbol Allowed:
  • Slide 18
  • Costas Busch - RPI18 Halting The machine halts if there are no possible transitions to follow
  • Slide 19
  • Costas Busch - RPI19 Example:...... No possible transition HALT!!!
  • Slide 20
  • Costas Busch - RPI20 Final States Allowed Not Allowed Final states have no outgoing transitions In a final state the machine halts
  • Slide 21
  • Costas Busch - RPI21 Acceptance Accept Input If machine halts in a final state Reject Input If machine halts in a non-final state or If machine enters an infinite loop
  • Slide 22
  • Costas Busch - RPI22 Turing Machine Example A Turing machine that accepts the language:
  • Slide 23
  • Costas Busch - RPI23 Time 0
  • Slide 24
  • Costas Busch - RPI24 Time 1
  • Slide 25
  • Costas Busch - RPI25 Time 2
  • Slide 26
  • Costas Busch - RPI26 Time 3
  • Slide 27
  • Costas Busch - RPI27 Time 4 Halt & Accept
  • Slide 28
  • Costas Busch - RPI28 Rejection Example Time 0
  • Slide 29
  • Costas Busch - RPI29 Time 1 No possible Transition Halt & Reject
  • Slide 30
  • Costas Busch - RPI30 Infinite Loop Example A Turing machine for language
  • Slide 31
  • Costas Busch - RPI31 Time 0
  • Slide 32
  • Costas Busch - RPI32 Time 1
  • Slide 33
  • Costas Busch - RPI33 Time 2
  • Slide 34
  • Costas Busch - RPI34 Time 2 Time 3 Time 4 Time 5 Infinite loop
  • Slide 35
  • Costas Busch - RPI35 Because of the infinite loop: The final state cannot be reached The machine never halts The input is not accepted
  • Slide 36
  • Costas Busch - RPI36 Another Turing Machine Example Turing machine for the language
  • Slide 37
  • Costas Busch - RPI37 Time 0
  • Slide 38
  • Costas Busch - RPI38 Time 1
  • Slide 39
  • Costas Busch - RPI39 Time 2
  • Slide 40
  • Costas Busch - RPI40 Time 3
  • Slide 41
  • Costas Busch - RPI41 Time 4
  • Slide 42
  • Costas Busch - RPI42 Time 5
  • Slide 43
  • Costas Busch - RPI43 Time 6
  • Slide 44
  • Costas Busch - RPI44 Time 7
  • Slide 45
  • Costas Busch - RPI45 Time 8
  • Slide 46
  • Costas Busch - RPI46 Time 9
  • Slide 47
  • Costas Busch - RPI47 Time 10
  • Slide 48
  • Costas Busch - RPI48 Time 11
  • Slide 49
  • Costas Busch - RPI49 Time 12
  • Slide 50
  • Costas Busch - RPI50 Halt & Accept Time 13
  • Slide 51
  • Costas Busch - RPI51 If we modify the machine for the language we can easily construct a machine for the language Observation:
  • Slide 52
  • Costas Busch - RPI52 Formal Definitions for Turing Machines
  • Slide 53
  • Costas Busch - RPI53 Transition Function
  • Slide 54
  • Costas Busch - RPI54 Transition Function
  • Slide 55
  • Costas Busch - RPI55 Turing Machine: States Input alphabet Tape alphabet Transition function Initial state blank Final states
  • Slide 56
  • Costas Busch - RPI56 Configuration Instantaneous description:
  • Slide 57
  • Costas Busch - RPI57 Time 4Time 5 A Move:
  • Slide 58
  • Costas Busch - RPI58 Time 4Time 5 Time 6Time 7
  • Slide 59
  • Costas Busch - RPI59 Equivalent notation:
  • Slide 60
  • Costas Busch - RPI60 Initial configuration: Input string
  • Slide 61
  • Costas Busch - RPI61 The Accepted Language For any Turing Machine Initial stateFinal state
  • Slide 62
  • Costas Busch - RPI62 Standard Turing Machine Deterministic Infinite tape in both directions Tape is the input/output file The machine we described is the standard:
  • Slide 63
  • Costas Busch - RPI63 Computing Functions with Turing Machines
  • Slide 64
  • Costas Busch - RPI64 A function Domain: Result Region: has:
  • Slide 65
  • Costas Busch - RPI65 A function may have many parameters: Example: Addition function
  • Slide 66
  • Costas Busch - RPI66 Integer Domain Unary: Binary: Decimal: 11111 101 5 We prefer unary representation: easier to manipulate with Turing machines
  • Slide 67
  • Costas Busch - RPI67 Definition: A function is computable if there is a Turing Machine such that: Initial configurationFinal configuration Domain final stateinitial state For all
  • Slide 68
  • Costas Busch - RPI68 Initial Configuration Final Configuration A function is computable if there is a Turing Machine such that: In other words: Domain For all
  • Slide 69
  • Costas Busch - RPI69 Example The function is computable Turing Machine: Input string: unary Output string: unary are integers
  • Slide 70
  • Costas Busch - RPI70 Start initial state The 0 is the delimiter that separates the two numbers
  • Slide 71
  • Costas Busch - RPI71 Start Finish final state initial state
  • Slide 72
  • Costas Busch - RPI72 Finish final state The 0 helps when we use the result for other operations
  • Slide 73
  • Costas Busch - RPI73 Turing machine for function
  • Slide 74
  • Costas Busch - RPI74 Execution Example: Time 0 Final Result (2)
  • Slide 75
  • Costas Busch - RPI75 Time 0
  • Slide 76
  • Costas Busch - RPI76 Time 1
  • Slide 77
  • Costas Busch - RPI77 Time 2
  • Slide 78
  • Costas Busch - RPI78 Time 3
  • Slide 79
  • Costas Busch - RPI79 Time 4
  • Slide 80
  • Costas Busch - RPI80 Time 5
  • Slide 81
  • Costas Busch - RPI81 Time 6
  • Slide 82
  • Costas Busch - RPI82 Time 7
  • Slide 83
  • Costas Busch - RPI83 Time 8
  • Slide 84
  • Costas Busch - RPI84 Time 9
  • Slide 85
  • Costas Busch - RPI85 Time 10
  • Slide 86
  • Costas Busch - RPI86 Time 11
  • Slide 87
  • Costas Busch - RPI87 HALT & accept Time 12
  • Slide 88
  • Costas Busch - RPI88 Another Example The function is computable Turing Machine: Input string: unary Output string:unary is integer
  • Slide 89
  • Costas Busch - RPI89 Start Finish final state initial state
  • Slide 90
  • Costas Busch - RPI90 Turing Machine Pseudocode for Replace every 1 with $ Repeat: Find rightmost $, replace it with 1 Go to right end, insert 1 Until no more $ remain
  • Slide 91
  • Costas Busch - RPI91 Turing Machine for
  • Sl

Recommended

View more >