Discrete Math. and Logic II. Turing Machines SFWR ENG 2FA3

Discrete Math. and Logic II. Turing Machines SFWR ENG 2FA3

Discrete Math. and Logic II. Turing Machines SFWR ENG 2FA3 Ryszard Janicki Winter 2014 Acknowledgments: Material based on Automata and Computability by Dexter C. Kozen (Chapters 27 and 28). Ryszard Janicki Discrete Math. and Logic II. Turing Machines 1 / 19 Introduction In this lecture we introduce the most powerful of the automata: Turing machines (TMs), It is named after Alan Turing, who invented them in 1936 Turing machines can compute any function normally considered computable TMs were invented long before real computers appeared They came at a time when mathematicians were trying to come to grips with the notion of eective computation Several alternative formalisms evolved in the attempt to nail down eectively computable Ryszard Janicki Discrete Math. and Logic II. Turing Machines 2 / 19 Introduction These several alternative formalisms are: Turing machines (Alan Turing) handle strings over Σ Post systems (Emil Post) µ-recursive functions (Kurt Gödel) handle the natural numbers A-calculus (Alonzo Church, Stephan C. Kleene) handles terms built from combinator symbols Combinatory logic (Moses Schönnkel, Haskell B. Curry) handles terms built from combinator symbols Ryszard Janicki Discrete Math. and Logic II. Turing Machines 3 / 19 Introduction The one that most closely resembles a modern computer is the Turing machine Besides the most know model, there are also many variations nondeterministic multitape multidimensional tape two-way innite tapes They can all simulate one another Ryszard Janicki Discrete Math. and Logic II. Turing Machines 4 / 19 Introduction All these mathematicians were looking at the same thing from dierent angles (Not a coincidence) They soon came to the realization that the commonality among all these systems must be the notion of eective computability Alonzo Church gave voice to this thought, and it has since become known as Church's thesis (or the Church-Turing thesis) Ryszard Janicki Discrete Math. and Logic II. Turing Machines 5 / 19 Introduction It is not a theorem, but rather a declaration All these formalisms capture precisely our intuition about what it means to be eectively computable in principle, no more and no less Very likely that the most compelling development leading to the acceptance of Church's thesis was the Turing machine (model considered readily programmable) Ryszard Janicki Discrete Math. and Logic II. Turing Machines 6 / 19 Informal Description of Turing Machines We will be considering a deterministic, one-tape Turing machine This is the standard model There are many variations, apparently more powerful or less powerful but in reality not (for more details on this point see textbook Lecture 30) TM has a nite set of states Q a semi-innite tape that is delimited on the left end by an endmarker ` and is innite to the right a head that can move left and right over the tape, reading and writing symbols Ryszard Janicki Discrete Math. and Logic II. Turing Machines 7 / 19 Informal Description of Turing Machines a b ba b a . Two−way, read/write Q Ryszard Janicki Discrete Math. and Logic II. Turing Machines 8 / 19 Formal Description of Turing Machines Denition A deterministic one-tape Turing machine is a 9-tuple s t r , where M = (Q; Σ; Γ; `; [ ; δ; ; ; ) Q is a nite set (the states); Σ is a nite set (the input alphabet); Γ is a nite set (the tape alphabet) containing Σ as a subset; , the blank symbol; [ 2 Γ − Σ `, the left endmarker; δ : Q × Γ −! Q × Γ × fL; Rg, the transition function; s 2 Q, the start state; t 2 Q, the accept state; and r 2 Q, the reject state, r 6= t. Ryszard Janicki Discrete Math. and Logic II. Turing Machines 9 / 19 Formal Description of Turing Machines Intuitively, δ (p; a) = (q; b; d) means, "When in state p scanning symbol a, write b on that tape cell, move the head in direction d, and enter state q. The symbols L and R stand for left and right, respectively We restrict TMs so that 8(p j p 2 Q : 9(q j q 2 Q : δ (p; `) = (q; `; R))) We also require that 8(b j b 2 Γ: 9(c; c0 j c; c0 2 Γ: δ (t; b) = (t; c; d) ^ δ (r; b) = (r; c0; d 0))) We refer to the state set and transition function collectively as the nite control Ryszard Janicki Discrete Math. and Logic II. Turing Machines 10 / 19 Formal Description of Turing Machines Example We are considering a TM that accepts the non-context-free set fanbncn j n ≥ 0g Q = fs; q1; ··· ; q10; t; rg Σ = fa; b; cg S Γ = Σ f`; [ ; ag a is just an extra useful symbol in the tape alphabet (NOT a special symbol) Ryszard Janicki Discrete Math. and Logic II. Turing Machines 11 / 19 Formal Description of Turing Machines Ryszard Janicki Discrete Math. and Logic II. Turing Machines 12 / 19 Congurations and Acceptance We dene a conguration to be an element of ! y ∗ IN Q × fy [ j 2 Γ g × A conguration is a global state giving a snapshot of all relevant information about a TM computation at some instant in time The conguration (p; z; n) species a current state p of the nite control, current tape contents z, and current position of the read/write head n ≥ 0 We usually denote congurations by α; β; γ The start conguration on input x 2 Σ∗ is the conguration s x ! 0 ( ; ` [ ; ) The last component 0 means that the machine is initially scanning the left endmarker ` Ryszard Janicki Discrete Math. and Logic II. Turing Machines 13 / 19 Congurations and Acceptance Denition A Turing Machine is said to halt on input x if it either accepts x or rejects x (the machine doesn't really grind to a halt in the literal sense) It is possible that it neither accepts nor rejects, in which case it is said to loop on input x A Turing machine is said to be total if it halts on all inputs Ryszard Janicki Discrete Math. and Logic II. Turing Machines 14 / 19 Congurations and Acceptance Denition We call a set of strings recursively enumerable (r.e.) if it is L(M) for some Turing machine M co-r.e. if its complement is r.e. recursive if it is L(M) for some total Turing machine M Ryszard Janicki Discrete Math. and Logic II. Turing Machines 15 / 19 Congurations and Acceptance Example Consider the non-CFL fww j w 2 fa; bg∗g It is a recursive set, because we can construct a Turing machine that accepts all its strings The TM scans out to the rst blank symbol [ , counting the number of symbols mod 2 to make sure x is of even length and rejecting immediately if not It lays down a right endmarker a, then repeatedly scans back and forth over the input In each pass from right to left, it marks the rst unmarked a or b it sees with ' (prime to the left) In each pass from left to right, it marks the rst unmarked a or b it sees with ` (prime to the right) It continues this until all symbols are marked Ryszard Janicki Discrete Math. and Logic II. Turing Machines 16 / 19 Congurations and Acceptance Example On input aabbaaabba the initial tape contents are ` aabbaaabba [ [ [ ··· 1 ` aabbaaabb´a a [ [ [ ··· 2 ` `aabbaaabb´a a [ [ [ ··· 3 ´ ` `aabbaaabb´a a [ [ [ ··· 4 ´ ` `a`abbaaabb´a a [ [ [ ··· 5 ´´ ` `a`abbaaabb´a a [ [ [ ··· 6 ` ´´ ` `a`abbaaabb´a a [ [ [ ··· 7 ` ´´ ` `a`abbaa´abb´a a [ [ [ ··· 8 `` ´´ bbaaabba [ aa [ ` `` ´ ´ a [ ··· Ryszard Janicki Discrete Math. and Logic II. Turing Machines 17 / 19 Congurations and Acceptance Example ((Continued)) 1 `` ´´ ` `a`abba´a´abb´a a [ [ [ ··· 2 `` ´´ ` `a`abb`a´a´abb´a a [ [ [ ··· 3 `` ´´ abba [ abba [ [ [ ` [ ` ` ´ ´ a ··· 4 `` ´´ bba [ [ bba [ [ [ ` [ [ ` ´ a ··· 5 ` ´ ` [ [ [ b`a [ [ [ b´a a [ [ [ ··· 6 a [ [ [ [ a [ [ [ ` [ [ [ [ ` ´ a ··· 7 It accepts ` [ [ [ [ [ [ [ [ [ [ a [ [ [ ··· Ryszard Janicki Discrete Math. and Logic II. Turing Machines 18 / 19 Decidability and Semidecidability Denition (Decidable) A property P of strings is said to be decidable if the set of all strings having property P is a recursive set. A property P of strings is said to be decidable if there is a total Turing machine that accepts input strings that have property P and rejects those that do not. Denition (Semidecidable) A property P of strings is said to be semidecidable if the set of strings having property P is an r.e. set. A property P is said to be semidecidable if there is a Turing machine that on input x accepts if x has property P and rejects or loops if not. Ryszard Janicki Discrete Math. and Logic II. Turing Machines 19 / 19.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    19 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us