CS 637: Mathematics-II

Lecture 7: What is a Reachable Configuration?

Induction and Turing Machines: A Unified Problem

Problem Statement

Consider the language of unary strings:

\[ L = \{ 1^n \mid n \ge 0 \} \]

Task: Design a single-tape deterministic Turing machine \(M\) such that, on input \(1^n\), the machine erases exactly one symbol per phase and halts on the empty tape.

Example:

\[ 1111 \rightarrow 111 \rightarrow 11 \rightarrow 1 \rightarrow \epsilon \] Per phase means that the head must return to the beginning after each phase.

Learning Objectives

  1. Formal Specification: Write the complete transition function of the Turing machine \(M\)
  2. Visualization: Construct the configuration graph of \(M\) on input \(1^n\)
  3. Formal Verification: Prove using mathematical induction on \(n\) that the halting configuration is reachable from the initial configuration
Key Insight: This problem bridges computational theory and mathematical reasoning, demonstrating how induction proves properties of computational processes.

Why This Matters

Understanding configuration graphs and inductive proofs is fundamental to:

  • Analyzing algorithm correctness
  • Verifying computational complexity
  • Establishing termination properties
  • Designing provably correct systems

Machine Specification

The Turing machine \(M = (Q,\Sigma,\Gamma,\delta,q_0,\sqcup,q_h)\) is defined as follows.

Formal Definition

  • Input alphabet: \(\Sigma = \{1\}\)
  • Tape alphabet: \(\Gamma = \{1, \sqcup\}\)
  • States: \(Q = \{q_0, q_1, q_2, q_h\}\)
  • Initial state: \(q_0\)
  • Blank symbol: \(\sqcup\)
  • Halting state: \(q_h\)

Transition Function \(\delta\)

\[ \begin{aligned} \delta(q_0,1) &= (q_0,1,R) \\ \delta(q_0,\sqcup) &= (q_1,\sqcup,L) \\ \delta(q_1,1) &= (q_2,\sqcup,L) \\ \delta(q_1,\sqcup) &= (q_h,\sqcup,R) \\ \delta(q_2,1) &= (q_2,1,L) \\ \delta(q_2,\sqcup) &= (q_0,\sqcup,R) \end{aligned} \]
qโ‚€ Start State qโ‚ Delete State qโ‚‚ Return Left q_h Halt State 1/1,R โŠ”/โŠ”,L 1/โŠ”,L โŠ”/โŠ”,R 1/1,L โŠ”/โŠ”,R

Machine Behavior

State \(q_0\): Scans right across the tape until reaching the first blank symbol

State \(q_1\): Reached after scanning right; if a '1' is found, erase it and move to \(q_2\); if blank, halt

State \(q_2\): Moves left across all remaining '1' symbols until reaching a blank, then returns to \(q_0\)

State \(q_h\): Halts when no more symbols remain on the tape

Execution Pattern: The machine cycles through \(q_0 \to q_1 \to q_2 \to q_0\), erasing one symbol per cycle and repositioning the head to the leftmost position, until all symbols are removed.

Machine Configurations

Configuration Notation

A configuration is written as \(u(q)v\), where:

  • The tape contains the string \(uv\)
  • The machine is in state \(q\)
  • The read/write head scans the first symbol of \(v\)

Initial configuration on input \(1^n\): \[(q_0)1^n\]

Halting configuration: \[(q_h)\sqcup\]

One Complete Phase of Computation

For any \(k \ge 1\), the following sequence of configurations demonstrates one complete phase:

\[ \begin{aligned} &(q_0)1^k && \text{(Start: head at leftmost position)} \\ &\vdash\; 1(q_0)1^{k-1} && \text{(Move right)} \\ &\vdash\; 1^2(q_0)1^{k-2} && \text{(Continue right)} \\ &\vdash\; \cdots \\ &\vdash\; 1^{k-1}(q_0)1 && \text{(Reach last symbol)} \\ &\vdash\; 1^k(q_0)\sqcup && \text{(Reach blank, switch to } q_1 \text{)} \\ &\vdash\; 1^{k-1}(q_1)1 && \text{(Move left to } q_1 \text{)} \\ &\vdash\; 1^{k-1}(q_2)\sqcup && \text{(Erase last 1, switch to } q_2 \text{)} \\ &\vdash\; 1^{k-2}(q_2)1 && \text{(Move left in } q_2 \text{)} \\ &\vdash\; \cdots \\ &\vdash\; (q_2)1^{k-1} && \text{(Reach leftmost 1)} \\ &\vdash\; \sqcup(q_2)1^{k-1} && \text{(Move left, reach blank)} \\ &\vdash\; (q_0)1^{k-1} && \text{(Return to start position)} \end{aligned} \]

Result: One full phase reduces the input length by exactly one symbol and repositions the head at the start.

Configuration Sequence Analysis

Each phase consists of:

  1. Scanning Phase (\(q_0\)): Move right across \(k\) symbols (\(k+1\) steps to reach blank)
  2. Deletion Phase (\(q_1\)): Move left and erase rightmost '1' (1 step)
  3. Return Phase (\(q_2\)): Move left across remaining \(k-1\) symbols to leftmost blank (\(k\) steps)
  4. Reposition (\(q_2 \to q_0\)): Move right to start of remaining string (1 step)

Total steps per phase: \(k + 1 + 1 + k + 1 = 2k + 3\)

Critical Observation: The machine always returns to configuration \((q_0)1^{k-1}\) after processing \((q_0)1^k\), forming a clear recursive structure.

The Configuration Graph

The configuration graph visualizes the execution path from start to halt. Each arrow represents a complete phase (multiple TM steps).

(qโ‚€)1โฟ phase 1 (qโ‚€)1โฟโปยน phase 2 โ‹ฏ (qโ‚€)1 phase n (qโ‚€)โŠ” Halt

Reachability Relation

The configuration graph for input \(1^n\) contains the following directed path:

\[ (q_0)1^n \;\vdash^*\; (q_0)1^{n-1} \;\vdash^*\; (q_0)1^{n-2} \;\vdash^*\; \cdots \;\vdash^*\; (q_0)1 \;\vdash^*\; (q_0)\sqcup \;\vdash^*\; (q_h)\sqcup \]

Where \(\vdash^*\) denotes the reflexive transitive closure of the single-step relation \(\vdash\).

Graph Properties

  • Path Length: \(n + 1\) nodes (including halt state)
  • Path Type: Linear (no branching for deterministic TM)
  • Transitivity: If \(C_1 \vdash^* C_2\) and \(C_2 \vdash^* C_3\), then \(C_1 \vdash^* C_3\)
  • Irreversibility: No backward edges (computation is forward-only)
Reachability Definition: Configuration \(C_2\) is reachable from \(C_1\) if there exists a sequence of transitions from \(C_1\) to \(C_2\).

Inductive Reachability Proof

Theorem

Claim: For all \(n \ge 0\), the halting configuration \((q_h)\sqcup\) is reachable from the initial configuration \((q_0)1^n\).

Formal Statement: \(\forall n \ge 0: (q_0)1^n \vdash^* (q_h)\sqcup\)

๐Ÿ“Œ Base Case (\(n=0\))

Given: Input is the empty string, so the initial configuration is \((q_0)\sqcup\)

Computation:

\[ \begin{aligned} (q_0)\sqcup &\vdash (q_1)\sqcup && \text{by } \delta(q_0,\sqcup) = (q_1,\sqcup,L) \\ &\vdash (q_h)\sqcup && \text{by } \delta(q_1,\sqcup) = (q_h,\sqcup,R) \end{aligned} \]

Conclusion: \((q_0)\sqcup \vdash^* (q_h)\sqcup\) โœ“

๐Ÿ”„ Inductive Hypothesis

Assume: For some arbitrary \(k \ge 0\), the configuration \((q_h)\sqcup\) is reachable from \((q_0)1^k\)

Symbolic Form:

\[ P(k): (q_0)1^k \vdash^* (q_h)\sqcup \]

We assume this is true and use it to prove \(P(k+1)\).

โšก Inductive Step (\(n = k+1\))

Goal: Show that \((q_0)1^{k+1} \vdash^* (q_h)\sqcup\)

Step 1: One Phase of Computation

From the configuration analysis, we know that one complete phase transforms:

\[ (q_0)1^{k+1} \vdash^* (q_0)1^k \]

This phase consists of:

  • \(q_0\) scans right across \(k+1\) symbols to reach the blank
  • \(q_1\) erases the rightmost '1' and moves to \(q_2\)
  • \(q_2\) moves left across the remaining \(k\) symbols
  • \(q_2\) transitions to \(q_0\) at the leftmost position
In detail, the configuration changes from \((q_0)1^{k+1}\) to \((q_0)1^k\) in \(2(k+1)+1\) steps. It goes through the following configurations: \((q_0)1^{k+1} \vdash 1^{k+1}(q_0)\sqcup \vdash 1^k(q_1)\sqcup \sqcup \vdash 1^{k-1}(q_2)1\sqcup \sqcup \vdash 1^{k-2}(q_2)11\sqcup \sqcup \vdash \dots \vdash 1(q_2)1^k\sqcup \sqcup \vdash (q_2)1^k\sqcup \sqcup \vdash (q_0)1^k\sqcup \sqcup \)

Step 2: Apply Inductive Hypothesis

By our inductive hypothesis \(P(k)\), we have:

\[ (q_0)1^k \vdash^* (q_h)\sqcup \]

Step 3: Transitivity

By the transitivity property of the reachability relation \(\vdash^*\):

\[ \begin{aligned} (q_0)1^{k+1} &\vdash^* (q_0)1^k && \text{(Step 1)} \\ (q_0)1^k &\vdash^* (q_h)\sqcup && \text{(Step 2)} \\ \hline \therefore\; (q_0)1^{k+1} &\vdash^* (q_h)\sqcup && \text{(Transitivity)} \end{aligned} \]

Thus, \(P(k+1)\) is true, completing the inductive step. โœ“

โœ… Conclusion

By the principle of mathematical induction, we have proven that:

\[ \forall n \ge 0: (q_0)1^n \vdash^* (q_h)\sqcup \]

The halting configuration \((q_h)\sqcup\) is reachable from the initial configuration \((q_0)1^n\) for all non-negative integers \(n\).

This completes the correctness proof for the Turing machine \(M\). โ–ก

Proof Technique: This proof demonstrates structural induction on the input length, showing how mathematical reasoning verifies computational processes.

Interactive Turing Machine Simulator

Visualize the Execution

State: qโ‚€ | Position: 0 | Step: 0

Execution Log

How to Use the Simulator

  1. Set Input Length: Choose a value for \(n\) (0-10)
  2. Step Through: Click "Step Forward" to execute one transition at a time
  3. Run Automatically: Click "Run to End" to see the complete execution
  4. Reset: Start over with a new configuration

Watch how the machine systematically erases symbols one by one, always returning to the leftmost position!

๐Ÿ