
- Automata Theory - Applications
- Automata Terminology
- Basics of String in Automata
- Set Theory for Automata
- Finite Sets and Infinite Sets
- Algebraic Operations on Sets
- Relations Sets in Automata Theory
- Graph and Tree in Automata Theory
- Transition Table in Automata
- What is Queue Automata?
- Compound Finite Automata
- Complementation Process in DFA
- Closure Properties in Automata
- Concatenation Process in DFA
- Language and Grammars
- Language and Grammar
- Grammars in Theory of Computation
- Language Generated by a Grammar
- Chomsky Classification of Grammars
- Context-Sensitive Languages
- Finite Automata
- What is Finite Automata?
- Finite Automata Types
- Applications of Finite Automata
- Limitations of Finite Automata
- Two-way Deterministic Finite Automata
- Deterministic Finite Automaton (DFA)
- Non-deterministic Finite Automaton (NFA)
- NDFA to DFA Conversion
- Equivalence of NFA and DFA
- Dead State in Finite Automata
- Minimization of DFA
- Automata Moore Machine
- Automata Mealy Machine
- Moore vs Mealy Machines
- Moore to Mealy Machine
- Mealy to Moore Machine
- Myhill–Nerode Theorem
- Mealy Machine for 1’s Complement
- Finite Automata Exercises
- Complement of DFA
- Regular Expressions
- Regular Expression in Automata
- Regular Expression Identities
- Applications of Regular Expression
- Regular Expressions vs Regular Grammar
- Kleene Closure in Automata
- Arden’s Theorem in Automata
- Convert Regular Expression to Finite Automata
- Conversion of Regular Expression to DFA
- Equivalence of Two Finite Automata
- Equivalence of Two Regular Expressions
- Convert Regular Expression to Regular Grammar
- Convert Regular Grammar to Finite Automata
- Pumping Lemma in Theory of Computation
- Pumping Lemma for Regular Grammar
- Pumping Lemma for Regular Expression
- Pumping Lemma for Regular Languages
- Applications of Pumping Lemma
- Closure Properties of Regular Set
- Closure Properties of Regular Language
- Decision Problems for Regular Languages
- Decision Problems for Automata and Grammars
- Conversion of Epsilon-NFA to DFA
- Regular Sets in Theory of Computation
- Context-Free Grammars
- Context-Free Grammars (CFG)
- Derivation Tree
- Parse Tree
- Ambiguity in Context-Free Grammar
- CFG vs Regular Grammar
- Applications of Context-Free Grammar
- Left Recursion and Left Factoring
- Closure Properties of Context Free Languages
- Simplifying Context Free Grammars
- Removal of Useless Symbols in CFG
- Removal Unit Production in CFG
- Removal of Null Productions in CFG
- Linear Grammar
- Chomsky Normal Form (CNF)
- Greibach Normal Form (GNF)
- Pumping Lemma for Context-Free Grammars
- Decision Problems of CFG
- Pushdown Automata
- Pushdown Automata (PDA)
- Pushdown Automata Acceptance
- Deterministic Pushdown Automata
- Non-deterministic Pushdown Automata
- Construction of PDA from CFG
- CFG Equivalent to PDA Conversion
- Pushdown Automata Graphical Notation
- Pushdown Automata and Parsing
- Two-stack Pushdown Automata
- Turing Machines
- Basics of Turing Machine (TM)
- Representation of Turing Machine
- Examples of Turing Machine
- Turing Machine Accepted Languages
- Variations of Turing Machine
- Multi-tape Turing Machine
- Multi-head Turing Machine
- Multitrack Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- K-dimensional Turing Machine
- Enumerator Turing Machine
- Universal Turing Machine
- Restricted Turing Machine
- Convert Regular Expression to Turing Machine
- Two-stack PDA and Turing Machine
- Turing Machine as Integer Function
- Post–Turing Machine
- Turing Machine for Addition
- Turing Machine for Copying Data
- Turing Machine as Comparator
- Turing Machine for Multiplication
- Turing Machine for Subtraction
- Modifications to Standard Turing Machine
- Linear-Bounded Automata (LBA)
- Church's Thesis for Turing Machine
- Recursively Enumerable Language
- Computability & Undecidability
- Turing Language Decidability
- Undecidable Languages
- Turing Machine and Grammar
- Kuroda Normal Form
- Converting Grammar to Kuroda Normal Form
- Decidability
- Undecidability
- Reducibility
- Halting Problem
- Turing Machine Halting Problem
- Rice's Theorem in Theory of Computation
- Post’s Correspondence Problem (PCP)
- Types of Functions
- Recursive Functions
- Injective Functions
- Surjective Function
- Bijective Function
- Partial Recursive Function
- Total Recursive Function
- Primitive Recursive Function
- μ Recursive Function
- Ackermann’s Function
- Russell’s Paradox
- Gödel Numbering
- Recursive Enumerations
- Kleene's Theorem
- Kleene's Recursion Theorem
- Advanced Concepts
- Matrix Grammars
- Probabilistic Finite Automata
- Cellular Automata
- Reduction of CFG
- Reduction Theorem
- Regular expression to ∈-NFA
- Quotient Operation
- Parikh’s Theorem
- Ladner’s Theorem
Turing Machine for Copying Data in Automata Theory
In this chapter, we will see how we can copy a block using Turing machine. The task is very simple, and we know the Turing machines can perform complex tasks that can be solved using algorithms. Let us see the block copying concept in detail with machine description and state diagrams for a better understanding the concept.
Understanding Turing Machines
In Turing Machine, the Tapes are divided into cells. Each cell can hold a single symbol, representing data. The machine has a head that can read and write symbols on the tape, moving left or right along the tape. The machine operates based on a set of rules, called a transition function. This function dictates what the machine should do depending on the current state and the symbol read from the tape.
The Block Copy Problem
One specific problem we can tackle with Turing machines is block copying. This involves copying a block of data, represented as a sequence of symbols, to a different location on the tape.
Suppose our data is a string of zeros, like "0000". We want to copy this block to the next four blank spaces on the tape.
Planning the Solution
To achieve this, we can use a clever trick. Instead of directly copying the zeros, we will mark the original zeros with a new symbol, say "X", and the blank spaces with another symbol, "Y". This way, we can keep track of which zeros have been copied and which blanks are available.
Here's how it works −
- Mark the Source − We start by marking the first zero as "X", moving to the right and marking the first blank space as "Y".
- Repeat Marking − We repeat this process, marking each zero with "X" and each blank space with "Y".
- Return and Check − Once we have marked all the zeros, we return to the last "X" we marked. If the next symbol is "Y", we know all the zeros have been copied.
- Reset and Copy − We then move to the end of the copied block, reset all "X" and "Y" symbols back to zeros, and finally move to the next blank space to mark the end of the copied data.
This approach allows us to clearly identify the source and target locations for the copy operation.
Designing the Turing Machine
Now, let's translate this plan into a Turing machine. We will define the machine's states, symbols, and transitions.
States
- Q0 − Initial state
- Q1 − Moving right after marking a zero with "X"
- Q2 − Retracing back to the last marked zero
- Q3 − Moving right after finding the last zero
- Q4 − Returning to the start of the copied block
- Qf − Final state, where the machine halts
Symbols
- 0 − The symbol representing the data to be copied
- X − Symbol used to mark the original zeros
- Y − Symbol used to mark the blank spaces
- Blank − Represents an empty cell on the tape
Transition Function
The transition function defines how the machine changes state and manipulates the tape based on the current state and the symbol read. Here's a sample transition table for our block copy Turing machine −
Current State | Symbol Read | New State | Write Symbol | Move |
---|---|---|---|---|
Q0 | 0 | Q1 | X | Right |
Q1 | 0 | Q1 | 0 | Right |
Q1 | Y | Q1 | Y | Right |
Q1 | Blank | Q2 | Y | Left |
Q2 | X | Q0 | X | Right |
Q2 | Y | Q2 | Y | Left |
Q2 | 0 | Q2 | 0 | Left |
Q0 | Y | Q3 | Y | Right |
Q3 | Y | Q3 | Y | Right |
Q3 | Blank | Q4 | Blank | Left |
Q4 | Y | Q4 | 0 | Left |
Q4 | X | Q4 | 0 | Left |
Q4 | Blank | Qf | Blank | None |

Explanation
- The machine starts in state Q0. If it encounters a "0", it changes it to "X", moves right, and transitions to state Q1.
- In Q1, the machine continues to move right, passing over any "0" or "Y" symbols.
- Upon reaching a blank space, the machine writes "Y", moves left, and enters state Q2.
- State Q2 retraces back to the left, identifying the last "X" and moving right to Q0 to continue the process.
- If Q0 encounters a "Y", it means all zeros have been marked, and it transitions to state Q3 to move to the end of the copied block.
- In Q4, the machine resets the "X" and "Y" symbols back to zeros and moves to the next blank space to signal the end of the copied data.
- The machine finally reaches the final state Qf, where it halts.
Conclusion
Block copy is one of the easy example that we can solve using Turing Machines. We take the input on the tape. Here we are taking set of 0s as input and copy them to another location. To make a copy, we are converting a symbol to X and pasting Y at the right, then after completing all, replacing Y with 0s and converted X with 0s for cleaning up.