ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Theory of Automata
    COMP3148
    Progress0 / 25 topics
    Topics
    1. Finite State Models2. Language definitions preliminaries3. Regular expressions/Regular languages4. Finite automata (FAs)5. Transition graphs (TGs)6. NFAs7. Kleene's theorem8. Transducers (automata with output)9. Pumping lemma and non-regular language10. Grammars and PDA11. CFGs12. Derivations, derivation trees and ambiguity13. Simplifying CFLs14. Normal form grammars and parsing15. Decidability16. Context sensitive languages17. Grammars and linear bounded automata (LBA)18. Chomsky's hierarchy of grammars19. Turing Machines Theory20. Turing machines21. Post machine22. Variations on TM23. TM encoding24. Universal Turing Machine25. Defining Computers by TMs
    COMP3148›Turing machines
    Theory of AutomataTopic 20 of 25

    Turing machines

    10 minread
    1,658words
    Intermediatelevel

    Turing Machines

    A Turing Machine (TM) is a theoretical model of computation introduced by Alan Turing in 1936. It is one of the most important concepts in the theory of computation and serves as a formal model for what it means to compute something. Turing machines are used to understand the limits of what can be computed and are fundamental to the field of computer science. The idea of a Turing machine helps define the concept of algorithmic computation.

    A Turing machine is a mathematical abstraction that is simple yet powerful enough to capture the essence of computation. It can simulate any computation that can be described algorithmically.

    Components of a Turing Machine

    A Turing machine consists of several key components:

    1. Tape:

      • The tape is an infinitely long, one-dimensional memory that is divided into cells.
      • Each cell can hold a single symbol from a finite alphabet (often including a blank symbol, denoted by □\square□).
      • The tape is where the input is placed, and the machine performs computations by reading and writing symbols on this tape.
    2. Tape Head:

      • The tape head moves along the tape, reading the symbol under it, writing a new symbol, and moving left or right based on the rules.
      • It is the component that manipulates the tape, following the machine's transitions.
    3. Finite Set of States:

      • A Turing machine has a finite set of states, including a start state and one or more accepting states and rejecting states.
      • The state tells the machine what it should do next based on the symbol it reads.
    4. Transition Function:

      • The transition function defines the machine's behavior. It tells the machine what to do when it is in a given state and reads a given symbol.
      • The function is typically represented as δ(q,a)=(q′,b,D)\delta(q, a) = (q', b, D)δ(q,a)=(q′,b,D), where:
        • qqq is the current state.
        • aaa is the symbol being read.
        • q′q'q′ is the next state.
        • bbb is the symbol to write on the tape.
        • DDD indicates whether the tape head should move left (L) or right (R).
    5. Start State:

      • The start state is where the machine begins its operation.
    6. Accepting and Rejecting States:

      • If the machine reaches an accepting state, it halts and accepts the input.
      • If the machine reaches a rejecting state, it halts and rejects the input.

    Formal Definition of a Turing Machine

    A Turing machine is formally defined as a 7-tuple:

    M=(Q,Σ,Γ,δ,q0,qaccept,qreject)M = (Q, \Sigma, \Gamma, \delta, q_0, q_{accept}, q_{reject})M=(Q,Σ,Γ,δ,q0​,qaccept​,qreject​)

    Where:

    • QQQ is a finite set of states.
    • Σ\SigmaΣ is the input alphabet (the set of symbols the machine can read from the input).
    • Γ\GammaΓ is the tape alphabet (the set of symbols the machine can write on the tape, including a special blank symbol).
    • δ\deltaδ is the transition function, a function that maps a state-symbol pair to a new state, a symbol to write, and a direction to move (left or right).
    • q0q_0q0​ is the start state, where the machine begins.
    • qacceptq_{accept}qaccept​ is the accept state (the machine halts and accepts the input when it reaches this state).
    • qrejectq_{reject}qreject​ is the reject state (the machine halts and rejects the input when it reaches this state).

    Operation of a Turing Machine

    The operation of a Turing machine is step-by-step as follows:

    1. Initialization: The machine starts in the start state q0q_0q0​, with the tape head positioned at the beginning of the input.
    2. Read Symbol: The machine reads the symbol under the tape head.
    3. Transition: Based on the current state and the symbol being read, the transition function is applied. This tells the machine what to do next:
      • Move to a new state.
      • Write a new symbol on the tape (replacing the old symbol).
      • Move the tape head either left or right.
    4. Repeat: The machine repeats this process until it reaches a halting state (either qacceptq_{accept}qaccept​ or qrejectq_{reject}qreject​).
    5. Halting: If the machine reaches the accept state, the input is accepted. If it reaches the reject state, the input is rejected.

    Example of a Simple Turing Machine

    Let’s consider a Turing machine that recognizes the language L={anbn∣n≥0}L = \{ a^n b^n \mid n \geq 0 \}L={anbn∣n≥0}, i.e., strings with an equal number of "a"s followed by an equal number of "b"s.

    Here is an outline of the transitions:

    1. Start State (q0): The machine starts by reading the first "a" and replaces it with an "X" (marking it as processed). Then it moves to the right and enters a new state to look for a matching "b".
    2. State (q1): After finding the first unmarked "b", the machine marks it with a "Y" and returns to the left to find another unmarked "a" to process.
    3. State (q2): It continues in this way, processing pairs of "a"s and "b"s.
    4. If the machine finishes processing all "a"s and "b"s (i.e., it reaches the blank symbol without encountering any unmarked "a"s or "b"s), it enters the accept state.
    5. If there are extra "a"s or "b"s (e.g., one "a" left with no "b" to match), the machine reaches the reject state.

    Types of Turing Machines

    1. Deterministic Turing Machine (DTM):
      A deterministic Turing machine is the standard Turing machine, where for every state and symbol combination, there is exactly one transition (i.e., no ambiguity in the next action). Every step in the computation is fully determined.

    2. Non-Deterministic Turing Machine (NDTM):
      A non-deterministic Turing machine can have multiple possible transitions for a given state and symbol. In this model, the machine can "choose" between different transitions. Although NDTMs can explore multiple possibilities simultaneously, they still do not increase the computational power compared to deterministic machines in terms of the languages they can recognize.

    3. Multi-Tape Turing Machine:
      A multi-tape Turing machine has more than one tape and head. Each tape operates independently and can store information. This allows the machine to be more efficient in certain tasks, but it is still computationally equivalent to a single-tape Turing machine (i.e., anything computable by a multi-tape machine can also be computed by a single-tape machine).

    4. Universal Turing Machine (UTM):
      A universal Turing machine is a Turing machine that can simulate any other Turing machine. It takes a description of another Turing machine (including its transition function) and an input tape, then simulates the behavior of the machine with the given input. The concept of a UTM is central to the Church-Turing thesis, which posits that anything computable can be computed by a Turing machine.

    Turing Machines and Computability

    • Decidability:
      A problem is decidable if there exists a Turing machine that will halt and give a correct yes/no answer for all possible inputs. For example, the problem of whether a string belongs to the regular language {anbn∣n≥0}\{ a^n b^n \mid n \geq 0 \}{anbn∣n≥0} is decidable.

    • Recursively Enumerable Languages (RE):
      A language is recursively enumerable if there exists a Turing machine that can accept all strings in the language and either halt or run forever for strings not in the language. These languages can be recognized by a Turing machine, but the machine might not halt for strings outside the language.

    • Undecidability:
      Some problems cannot be decided by any Turing machine. A famous example is the Halting Problem, which asks whether a given Turing machine will halt on a given input. Turing proved that there is no general algorithm that can solve the Halting Problem for all possible Turing machine-input pairs.

    Church-Turing Thesis

    The Church-Turing thesis asserts that any function that can be computed by an algorithm can be computed by a Turing machine. Essentially, it states that the Turing machine is as powerful as any algorithmic computational model. This thesis is widely accepted in computer science, even though it cannot be formally proven. It provides the foundation for understanding computability in general.

    Turing Machines and Complexity Theory

    Turing machines are also central to computational complexity theory, which classifies problems based on the amount of resources (like time or memory) they require. Key complexity classes based on Turing machine behavior include:

    • P: Problems solvable in polynomial time.
    • NP: Problems for which a solution can be verified in polynomial time.
    • PSPACE: Problems solvable with polynomial space.
    • EXPTIME: Problems solvable in exponential time.

    Conclusion

    The Turing machine is a powerful and versatile model of computation that helps define the limits of what can be computed. By formalizing the notion of computation, Turing machines have become foundational to the study of algorithms, computability, and complexity theory. Whether used for recognizing languages, solving problems, or proving the limits of computation, the Turing machine remains a cornerstone of theoretical computer science.

    Previous topic 19
    Turing Machines Theory
    Next topic 21
    Post machine

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time10 min
      Word count1,658
      Code examples0
      DifficultyIntermediate