100% FREE Updated: Mar 2026 Formal Languages and Automata Theory Computability Theory

Turing Machines and Decidability

Comprehensive study notes on Turing Machines and Decidability for CMI M.Sc. and Ph.D. Computer Science preparation. This chapter covers key concepts, formulas, and examples needed for your exam.

Turing Machines and Decidability

This chapter rigorously introduces Turing Machines as the universal model of computation, laying the theoretical groundwork for understanding algorithmic limits. It systematically distinguishes between computable and noncomputable functions and establishes the fundamental concepts of decidability and undecidability. Mastery of these principles is critical for advanced examinations in theoretical computer science, forming a cornerstone of the M.Sc./Ph.D. curriculum.

---

Chapter Contents

|

| Topic |

|---|-------| | 1 | Computable and Noncomputable Functions | | 2 | Basics of Decidability |

---

We begin with Computable and Noncomputable Functions.

Part 1: Computable and Noncomputable Functions

This unit explores the theoretical limits of computation, identifying problems that cannot be solved by any algorithm and classifying functions based on their computability. Understanding these boundaries is crucial for advanced computer science.

---

Core Concepts

1. Turing Machines and Computable Functions

A Turing Machine (TM) is a mathematical model of computation that defines an abstract machine manipulating symbols on a strip of tape according to a table of rules. A function f:ΣΓf: \Sigma^ \to \Gamma^ is computable (or recursive) if there exists a Turing Machine that, for every input ww in the domain of ff, halts with f(w)f(w) on its tape.

📖 Computable Function

A function ff is computable if there exists a Turing Machine MM such that for every ww in the domain of ff, MM halts on input ww with f(w)f(w) on its tape. If ww is not in the domain of ff, MM either halts with an error or does not halt.

Worked Example:

Consider the function f(n)=n+1f(n) = n+1 for a non-negative integer nn, represented in unary. We demonstrate a conceptual Turing Machine that computes this function.

Step 1: Initial configuration

The input tape contains nn '1's, followed by a blank symbol, e.g., `_111_` for n=3n=3.

>

q0_111_q_0 \_111\_

Step 2: Move to the rightmost '1'

The TM moves its head to the right, skipping all '1's, until it finds the first blank symbol.

>

q0111_q1_111_q_0 111\_ \to \cdots \to q_1 \_111\_

Step 3: Overwrite the blank with '1'

The TM replaces the blank symbol with a '1'.

>

q1_111_q2_1111q_1 \_111\_ \to q_2 \_1111

Step 4: Move left and halt

The TM moves its head one position to the left, then halts in an accepting state.

>

q2_1111qf_1111q_2 \_1111 \to q_f \_1111

Answer: The TM successfully computes n+1n+1 by adding an additional '1' to the unary representation of nn.

:::question type="MCQ" question="Which of the following best describes a computable function?" options=["A function whose output can be described by a finite set of rules.","A function for which there exists a Turing Machine that halts on all inputs with the correct output.","A function that can be computed by any physical computer.","A function that can be expressed using only basic arithmetic operations."] answer="A function for which there exists a Turing Machine that halts on all inputs with the correct output." hint="Recall the formal definition of a computable function in the context of Turing Machines." solution="A computable function is formally defined as one for which a Turing Machine exists that can compute its output for all inputs in its domain. The option 'halts on all inputs with the correct output' aligns with a total computable function, which is a common interpretation when not specified as partial. The other options are either too vague or incorrect in the formal sense of computability theory. For a partial computable function, the TM may not halt if the input is outside its domain."
:::

---

2. Church-Turing Thesis

The Church-Turing Thesis states that any function that can be computed by an algorithm can be computed by a Turing Machine. It asserts the equivalence of all "reasonable" models of computation with the Turing Machine model. This is a thesis, not a theorem, as it relates a formal concept (Turing Machine) to an informal one (algorithm).

📖 Church-Turing Thesis

Any function that can be computed by an effective procedure (an algorithm) can be computed by a Turing Machine. Conversely, any function computable by a Turing Machine is considered computable by an algorithm.

Worked Example:

Consider a problem of finding the shortest path in a graph using Dijkstra's algorithm.

Step 1: Algorithm definition

Dijkstra's algorithm is a well-defined sequence of steps to find the shortest path. It involves graph traversal, distance updates, and priority queue operations.

>

Dijkstra(G,s,t)\text{Dijkstra}(G, s, t)

Step 2: Implication of Church-Turing Thesis

Since Dijkstra's algorithm is a precise, step-by-step procedure that can be executed mechanically, the Church-Turing Thesis implies that a Turing Machine exists that can simulate this algorithm.

>

Algorithm    Turing Machine simulation\text{Algorithm} \implies \text{Turing Machine simulation}

Answer: The Church-Turing Thesis implies that if an algorithm exists for a problem, a Turing Machine can solve it. Therefore, a Turing Machine can compute the shortest path in a graph using Dijkstra's algorithm.

:::question type="MCQ" question="What is the primary implication of the Church-Turing Thesis?" options=["All functions can be computed by a Turing Machine.","Turing Machines are the most powerful computational model known.","Any problem solvable by an algorithm can be solved by a Turing Machine.","Computers will eventually be able to solve all mathematical problems."] answer="Any problem solvable by an algorithm can be solved by a Turing Machine." hint="The thesis connects the informal notion of an 'algorithm' to the formal model of a 'Turing Machine'." solution="The Church-Turing Thesis posits that the class of functions computable by any 'effective method' (i.e., algorithm) is exactly the class of functions computable by a Turing Machine. This means that if we can describe an algorithm for a problem, a Turing Machine can solve it. It does not claim that all functions are computable, nor does it make predictions about future computer capabilities."
:::

---

3. Universal Turing Machine

A Universal Turing Machine (UTM) is a special Turing Machine that can simulate the behavior of any other arbitrary Turing Machine on any arbitrary input. It takes as input a description of another Turing Machine MM and an input ww for MM, and then simulates MM's behavior on ww.

📖 Universal Turing Machine (UTM)

A Turing Machine UU is universal if, given an encoding M\langle M \rangle of any Turing Machine MM and an input ww, UU halts on input M,w\langle M, w \rangle with the same output as MM would produce on ww.

Worked Example:

Consider a UTM UU operating on an input tape that contains the encoded description of a Turing Machine MM and its input ww.

Step 1: Input tape configuration

The tape is divided into sections: one for MM's description, one for MM's current tape content, and one for MM's current state.

>

\langle M \rangle \

w \

q_i

Step 2: Simulation cycle

The UTM UU reads MM's current state qiq_i and the symbol under MM's simulated head. It then consults MM's encoded transition function δM\delta_M.

>

Read (qi,symbol)    Look up δM(qi,symbol)\text{Read } (q_i, \text{symbol}) \implies \text{Look up } \delta_M(q_i, \text{symbol})

Step 3: Update MM's simulated configuration

Based on δM\delta_M, UU updates MM's simulated tape content, moves MM's simulated head, and changes MM's simulated state. This cycle repeats.

>

δM(qi,symbol)=(qj,new_symbol,direction)    Update tape, head, state\delta_M(q_i, \text{symbol}) = (q_j, \text{new\_symbol}, \text{direction}) \implies \text{Update tape, head, state}

Answer: The UTM UU effectively simulates MM on ww by interpreting MM's rules and applying them to MM's simulated tape, demonstrating its role as a general-purpose computer.

:::question type="MCQ" question="What is the primary function of a Universal Turing Machine?" options=["To solve the Halting Problem for any Turing Machine.","To compile high-level programming languages into machine code.","To simulate any arbitrary Turing Machine on any given input.","To prove the undecidability of certain computational problems."] answer="To simulate any arbitrary Turing Machine on any given input." hint="The 'universal' aspect implies it can act like any other TM." solution="A Universal Turing Machine (UTM) is designed to take the description of any other Turing Machine MM and an input ww for MM, and then simulate MM's computation on ww. This makes it a general-purpose computer, capable of performing any computation that any other TM can perform."
:::

---

4. Undecidability and Noncomputable Functions

A problem is undecidable if no algorithm (Turing Machine) exists that can solve it for all possible inputs. A function is noncomputable if no Turing Machine can compute it. These concepts define the limits of what computers can do.

📖 Undecidable Problem

A decision problem is undecidable if its language is not a recursive language. That is, no Turing Machine exists that halts on all inputs and correctly determines membership in the language.

Worked Example:

Consider the problem of determining if a given C++ program will ever output the string "Hello World!".

Step 1: Formulate as a decision problem

We want to know if for a given program PP, does PP output "Hello World!"? This is a yes/no question.

>

Does P output "Hello World!"?\text{Does } P \text{ output "Hello World!"?}

Step 2: Consider the nature of the problem

To solve this, a hypothetical algorithm would need to analyze the program's execution path, including loops, conditional statements, and function calls, for all possible inputs to PP. This involves predicting the program's behavior over potentially infinite execution paths.

>

Predicting arbitrary program behavior\text{Predicting arbitrary program behavior}

Answer: This problem is undecidable. An algorithm cannot, in general, determine if an arbitrary program will ever print a specific string because it would require solving a variant of the Halting Problem or a related undecidable property (like a non-trivial semantic property of programs, as per Rice's Theorem).

:::question type="MCQ" question="Which of the following is an example of an undecidable problem?" options=["Determining if a given string is a palindrome.","Determining if a given context-free grammar is ambiguous.","Determining if a given regular expression generates an infinite language.","Determining if a given finite automaton accepts a particular string."] answer="Determining if a given context-free grammar is ambiguous." hint="Undecidable problems often involve infinite state spaces or properties that require simulating arbitrary computation." solution="Determining if a given context-free grammar is ambiguous is a known undecidable problem. The other options are decidable: palindromes can be checked by a simple algorithm, regularity of infinite languages is decidable, and FA acceptance is decidable (e.g., by simulating the FA or constructing a product automaton)."
:::

---

5. The Halting Problem

The Halting Problem asks whether, given a description of an arbitrary Turing Machine MM and an input ww, MM will halt (finish its computation) or run forever when started on ww. This problem is famously undecidable.

📐 Halting Problem (HP)

The language HALT={M,wM is a TM and M halts on input w}HALT = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \} is undecidable.

Worked Example: Proof by contradiction for the Halting Problem.

Step 1: Assume HH is a decider for HALTHALT

Suppose there exists a Turing Machine HH that decides the Halting Problem. HH takes M,w\langle M, w \rangle as input and halts, accepting if MM halts on ww, and rejecting if MM does not halt on ww.

>

H(M,w)={acceptif M halts on wrejectif M does not halt on wH(\langle M, w \rangle) = \begin{cases} \text{accept} & \text{if } M \text{ halts on } w \\ \text{reject} & \text{if } M \text{ does not halt on } w \end{cases}

Step 2: Construct a new TM, DD

Using HH, construct a new Turing Machine DD that takes an encoding of a TM M\langle M \rangle as input. DD does the following:

  • Calls HH on input M,M\langle M, \langle M \rangle \rangle.

  • If HH accepts (meaning MM halts on M\langle M \rangle), then DD loops forever.

  • If HH rejects (meaning MM does not halt on M\langle M \rangle), then DD halts.
  • >

    D(M)={loops foreverif H(M,M) accepts (i.e., M halts on M)haltsif H(M,M) rejects (i.e., M does not halt on M)D(\langle M \rangle) = \begin{cases} \text{loops forever} & \text{if } H(\langle M, \langle M \rangle \rangle) \text{ accepts (i.e., } M \text{ halts on } \langle M \rangle \text{)} \\ \text{halts} & \text{if } H(\langle M, \langle M \rangle \rangle) \text{ rejects (i.e., } M \text{ does not halt on } \langle M \rangle \text{)} \end{cases}

    Step 3: Run DD on its own description D\langle D \rangle

    Now, consider what happens when DD is run with its own description D\langle D \rangle as input.

    >

    D(D)D(\langle D \rangle)

    Step 4: Analyze the outcome

  • If D(D)D(\langle D \rangle) halts: By definition of DD, this means H(D,D)H(\langle D, \langle D \rangle \rangle) rejected. By definition of HH, this means DD does not halt on D\langle D \rangle. This is a contradiction.

  • If D(D)D(\langle D \rangle) loops forever: By definition of DD, this means H(D,D)H(\langle D, \langle D \rangle \rangle) accepted. By definition of HH, this means DD halts on D\langle D \rangle. This is also a contradiction.
  • >

    D(D) halts     D does not halt on DD(D) loops     D halts on D\begin{aligned} D(\langle D \rangle) \text{ halts } & \implies D \text{ does not halt on } \langle D \rangle \\ D(\langle D \rangle) \text{ loops } & \implies D \text{ halts on } \langle D \rangle \end{aligned}

    Answer: Both possible outcomes lead to a contradiction. Therefore, our initial assumption that HH exists must be false. The Halting Problem is undecidable.

    :::question type="MCQ" question="The Halting Problem asks whether a given Turing Machine MM will halt on a given input ww. Why is this problem considered undecidable?" options=["Because it requires an infinite amount of memory.","Because no algorithm can exist that determines for all MM and ww if MM halts on ww.","Because the input ww can be arbitrarily long.","Because it is impossible to write a program that simulates another program."] answer="Because no algorithm can exist that determines for all MM and ww if MM halts on ww." hint="Recall the proof by contradiction, which demonstrates the impossibility of such an algorithm." solution="The Halting Problem is undecidable because it has been proven, typically through a diagonalization argument (as shown in the worked example), that no Turing Machine (and by the Church-Turing Thesis, no algorithm) can exist that can correctly determine for all possible pairs of Turing Machine MM and input ww whether MM will halt or loop indefinitely on ww. The other options are incorrect; memory is not the core issue, input length is handled by TMs, and program simulation is possible (Universal TM)."
    :::

    ---

    6. Reducibility

    Reducibility is a technique used to prove the undecidability of problems. If problem AA can be reduced to problem BB (denoted AmBA \le_m B), and AA is known to be undecidable, then BB must also be undecidable. This means an algorithm for BB could be used to solve AA, which is a contradiction.

    📖 Many-one Reducibility (AmBA \le_m B)

    Language AA is many-one reducible to language BB if there is a computable function ff such that for every string ww, wAw \in A if and only if f(w)Bf(w) \in B.

    Worked Example: Proving that L¬HALT={M,wM does not halt on w}L_{\neg HALT} = \{ \langle M, w \rangle \mid M \text{ does not halt on } w \} is undecidable.

    Step 1: Assume L¬HALTL_{\neg HALT} is decidable

    Suppose there exists a decider TM RR for L¬HALTL_{\neg HALT}. This means RR halts on all inputs and accepts M,w\langle M, w \rangle if MM does not halt on ww, and rejects otherwise.

    >

    R(M,w)={acceptif M does not halt on wrejectif M halts on wR(\langle M, w \rangle) = \begin{cases} \text{accept} & \text{if } M \text{ does not halt on } w \\ \text{reject} & \text{if } M \text{ halts on } w \end{cases}

    Step 2: Construct a decider for HALTHALT using RR

    We know HALT={M,wM halts on w}HALT = \{ \langle M, w \rangle \mid M \text{ halts on } w \} is the complement of L¬HALTL_{\neg HALT}. If RR decides L¬HALTL_{\neg HALT}, we can construct a decider for HALTHALT as follows:

  • On input M,w\langle M, w \rangle, simulate RR on M,w\langle M, w \rangle.

  • If RR accepts, reject. (Because MM does not halt on ww).

  • If RR rejects, accept. (Because MM halts on ww).
  • >

    Decider for HALT(M,w)={acceptif R(M,w) rejectsrejectif R(M,w) accepts\text{Decider for } HALT(\langle M, w \rangle) = \begin{cases} \text{accept} & \text{if } R(\langle M, w \rangle) \text{ rejects} \\ \text{reject} & \text{if } R(\langle M, w \rangle) \text{ accepts} \end{cases}

    Step 3: Contradiction

    The constructed TM is a decider for HALTHALT. However, we know from the Halting Problem that HALTHALT is undecidable. This is a contradiction.

    >

    Decider for HALT exists     HALT is decidable\text{Decider for } HALT \text{ exists } \implies HALT \text{ is decidable}

    >
    But HALT is undecidable     Contradiction\text{But } HALT \text{ is undecidable } \implies \text{Contradiction}

    Answer: Since our assumption leads to a contradiction, L¬HALTL_{\neg HALT} must be undecidable. This demonstrates a reduction from HALTHALT to L¬HALTL_{\neg HALT}'s complement, showing that if L¬HALTL_{\neg HALT} were decidable, HALTHALT would also be, which is false. (More formally, HALTmL¬HALTHALT \le_m \overline{L_{\neg HALT}}).

    :::question type="MCQ" question="Given that problem AA is undecidable and there is a computable function ff that transforms any instance of AA into an instance of problem BB such that xA    f(x)Bx \in A \iff f(x) \in B. What can be concluded about problem BB?" options=["Problem BB is decidable.","Problem BB is also undecidable.","Problem BB is finite.","Problem BB is always easier to solve than problem AA."] answer="Problem BB is also undecidable." hint="If a solution for BB existed, it could be used to solve AA, contradicting AA's undecidability." solution="If problem AA is undecidable and AmBA \le_m B (meaning AA is many-one reducible to BB), then BB must also be undecidable. If BB were decidable, we could use its decider to decide AA by first applying the reduction function ff and then feeding the result to BB's decider. This would mean AA is decidable, which contradicts our premise that AA is undecidable. Therefore, BB must be undecidable."
    :::

    ---

    7. Rice's Theorem

    Rice's Theorem is a powerful result in computability theory that states that any non-trivial property of the language recognized by a Turing Machine is undecidable. A property is non-trivial if it is true for some recursively enumerable languages but false for others. It is a property of the language, not of the TM's implementation.

    📐 Rice's Theorem

    Any non-trivial property of the language recognized by a Turing Machine is undecidable.

    Worked Example: Proving that the property of a TM recognizing a regular language is undecidable.

    Step 1: Define the property PP

    Let PP be the property: "The language recognized by TM MM, L(M)L(M), is a regular language."

    >

    P(M)    L(M) is regularP(M) \iff L(M) \text{ is regular}

    Step 2: Check if PP is a property of the language

    The property "being regular" depends only on the language L(M)L(M), not on the specific Turing Machine MM that recognizes it. If two different TMs recognize the same language, they either both have this property or both don't.

    >

    L(M1)=L(M2)    (P(M1)    P(M2))L(M_1) = L(M_2) \implies (P(M_1) \iff P(M_2))

    Step 3: Check if PP is non-trivial

  • Is it true for some RE languages? Yes, for example, the language L={anbnn0}L = \{a^n b^n \mid n \ge 0\} is not regular, but it is context-free and thus recursive (and RE). So, a TM recognizing a non-regular language exists.

  • Consider L(M1)=ΣL(M_1) = \Sigma^*. This is a regular language. So, P(M1)P(M_1) is true for some TM M1M_1.
  • Is it false for some RE languages? Yes, consider L(M2)={anbnn0}L(M_2) = \{a^n b^n \mid n \ge 0\}. This language is not regular. So, P(M2)P(M_2) is false for some TM M2M_2.
  • >

    P is true for Σ (regular)P \text{ is true for } \Sigma^* \text{ (regular)}

    >
    P is false for {anbnn0} (not regular)P \text{ is false for } \{a^n b^n \mid n \ge 0\} \text{ (not regular)}

    Answer: Since PP is a non-trivial property of the language recognized by a Turing Machine, by Rice's Theorem, the problem of determining if L(M)L(M) is regular is undecidable.

    :::question type="MCQ" question="According to Rice's Theorem, which of the following properties of a Turing Machine's language is undecidable?" options=["Is L(M)L(M) finite?","Does MM halt on the empty string?","Is L(M)L(M) empty?","Does MM have exactly 5 states?"] answer="Is L(M)L(M) empty?" hint="Rice's Theorem applies to properties of the language recognized by the TM, not properties of the TM itself. Also, the property must be non-trivial." solution="Rice's Theorem states that any non-trivial property of the language recognized by a Turing Machine is undecidable.

  • 'Is L(M)L(M) finite?' is a non-trivial property of the language (some RE languages are finite, some are infinite). Thus, it is undecidable.

  • 'Does MM halt on the empty string?' is a property of the TM itself, not solely its language, and is related to the Halting Problem, hence undecidable but not directly by Rice's Theorem.

  • 'Is L(M)L(M) empty?' is a non-trivial property of the language (some RE languages are empty, some are not). Thus, it is undecidable.

  • 'Does MM have exactly 5 states?' is a property of the TM's description, not its language. It is decidable simply by inspecting the TM's description.
  • The question asks for an undecidable property according to Rice's Theorem. Both 'Is L(M)L(M) finite?' and 'Is L(M)L(M) empty?' fit this. Let's re-evaluate the options. Usually, Rice's theorem is used to show properties like emptiness, finiteness, regularity, context-freeness, etc., are undecidable.

    Given the common examples, 'Is L(M)L(M) empty?' (also known as ETME_{TM}) is a classic example of an undecidable problem proven by reduction from HALTHALT, and also directly falls under Rice's Theorem as a non-trivial property of the language. It is true for \emptyset and false for any non-empty language.

    So, 'Is L(M)L(M) empty?' is a correct answer according to Rice's Theorem. (Note: 'Is L(M)L(M) finite?' is also undecidable by Rice's Theorem, but often one typical example is expected.)"
    :::

    ---

    8. Post Correspondence Problem (PCP)

    The Post Correspondence Problem (PCP) is an undecidable decision problem that asks whether a given list of pairs of non-empty strings has a "match." A match is a sequence of indices such that concatenating the strings from the first component of the pairs in that sequence results in the same string as concatenating the strings from the second component.

    📖 Post Correspondence Problem (PCP)

    Given a list of kk pairs of non-empty strings P={(u1,v1),(u2,v2),,(uk,vk)}P = \{ (u_1, v_1), (u_2, v_2), \ldots, (u_k, v_k) \}, a match is a non-empty sequence of indices i1,i2,,imi_1, i_2, \ldots, i_m such that ui1ui2uim=vi1vi2vimu_{i_1} u_{i_2} \cdots u_{i_m} = v_{i_1} v_{i_2} \cdots v_{i_m}. The problem is to determine if such a match exists.

    Worked Example: Determine if a match exists for the following instance of PCP.

    Let P={(ab,abb),(b,ba),(bba,aa)}P = \{ (ab, abb), (b, ba), (bba, aa) \}.

    Step 1: Try combinations of indices

    We need to find a sequence of indices i1,i2,,imi_1, i_2, \ldots, i_m such that ui1uim=vi1vimu_{i_1} \cdots u_{i_m} = v_{i_1} \cdots v_{i_m}.

    >

    u1=ab,v1=abbu_1 = ab, v_1 = abb

    >
    u2=b,v2=bau_2 = b, v_2 = ba

    >
    u3=bba,v3=aau_3 = bba, v_3 = aa

    Step 2: Start with a single pair

    * If we start with index 1: u1=abu_1 = ab, v1=abbv_1 = abb. v1v_1 is longer. We need to add more strings to uu to catch up.
    * If we start with index 2: u2=bu_2 = b, v2=bav_2 = ba. v2v_2 is longer.
    * If we start with index 3: u3=bbau_3 = bba, v3=aav_3 = aa. u3u_3 is longer.

    Step 3: Try a sequence of indices

    Let's try sequence (1, 2):
    u1u2=(ab)(b)=abbu_1 u_2 = (ab)(b) = abb
    v1v2=(abb)(ba)=abbbav_1 v_2 = (abb)(ba) = abbba
    No match.

    Let's try sequence (3, 1):
    u3u1=(bba)(ab)=bbaabu_3 u_1 = (bba)(ab) = bbaab
    v3v1=(aa)(abb)=aaabbv_3 v_1 = (aa)(abb) = aaabb
    No match.

    Let's try sequence (1, 3):
    u1u3=(ab)(bba)=abbbau_1 u_3 = (ab)(bba) = abbba
    v1v3=(abb)(aa)=abbaav_1 v_3 = (abb)(aa) = abbaa
    No match.

    Consider sequence (1, 2, 1):
    u1u2u1=(ab)(b)(ab)=abbabu_1 u_2 u_1 = (ab)(b)(ab) = abbab
    v1v2v1=(abb)(ba)(abb)=abbbabbv_1 v_2 v_1 = (abb)(ba)(abb) = abbbabb
    No match.

    Consider sequence (2, 1):
    u2u1=(b)(ab)=babu_2 u_1 = (b)(ab) = bab
    v2v1=(ba)(abb)=baabbv_2 v_1 = (ba)(abb) = baabb
    No match.

    Consider sequence (3, 2):
    u3u2=(bba)(b)=bbabu_3 u_2 = (bba)(b) = bbab
    v3v2=(aa)(ba)=aabav_3 v_2 = (aa)(ba) = aaba
    No match.

    Step 4: A systematic search (often required for actual solutions)

    Let's try to build a match:
    Start with (1): u=ab,v=abbu=ab, v=abb. Need to add to uu.
    Next, choose a pair where uiu_i starts with 'b' to match vv's next char. Pair 2: (b,ba)(b, ba).
    Sequence (1, 2): u=abbu = abb, v=abbbav = abbba. Need to add to uu.
    Next, choose a pair where uiu_i starts with 'b'. Pair 2 again: (b,ba)(b, ba).
    Sequence (1, 2, 2): u=abbbu = abbb, v=abbbabav = abbbaba. Need to add to uu.
    This is getting longer for vv side.

    Let's rethink. We want to balance lengths.
    If uiu_i is shorter than viv_i, we pick it to make uu longer.
    If uiu_i is longer than viv_i, we pick it to make vv longer.

    Consider P={(1:ab,abb),(2:b,ba)}P = \{ (1: ab, abb), (2: b, ba) \}.
    Try (1): u=ab,v=abbu=ab, v=abb. vv is longer.
    Need to add to uu. The current string on vv is `abb`. The suffix `b` needs to be matched.
    If we append (2):
    unew=u1u2=abb=abbu_{new} = u_1 u_2 = ab \cdot b = abb
    vnew=v1v2=abbba=abbbav_{new} = v_1 v_2 = abb \cdot ba = abbba
    Now vv is much longer.

    Let's try sequence (2, 1):
    u2u1=bab=babu_2 u_1 = b \cdot ab = bab
    v2v1=baabb=baabbv_2 v_1 = ba \cdot abb = baabb
    No match.

    Let's try sequence (1, 3):
    u1u3=abbba=abbbau_1 u_3 = ab \cdot bba = abbba
    v1v3=abbaa=abbaav_1 v_3 = abb \cdot aa = abbaa
    No match.

    The given example P={(ab,abb),(b,ba),(bba,aa)}P = \{ (ab, abb), (b, ba), (bba, aa) \} actually does not have a match. This is a common situation for undecidable problems: finding a match can be hard, and proving no match exists is even harder (and generally undecidable). For a worked example, it's better to show one with a match or clearly state it's undecidable.

    Let's use a simpler example that does have a match.
    Let P={(0,00),(10,0),(011,11)}P = \{ (0, 00), (10, 0), (011, 11) \}.

    Step 1: Try combinations

    * (1): u=0,v=00u=0, v=00. vv is longer.
    * (2): u=10,v=0u=10, v=0. uu is longer.
    * (3): u=011,v=11u=011, v=11. uu is longer.

    Step 2: Try to balance lengths

    If we start with (1): u=0,v=00u=0, v=00. We need to make uu longer.
    Current vv ends with '0'. Next uiu_i needs to start with '0'.
    Try (1, 3):
    u1u3=0011=0011u_1 u_3 = 0 \cdot 011 = 0011
    v1v3=0011=0011v_1 v_3 = 00 \cdot 11 = 0011
    We found a match! The sequence is (1, 3).

    Answer: A match exists for P={(0,00),(10,0),(011,11)}P = \{ (0, 00), (10, 0), (011, 11) \} with the sequence of indices (1, 3).

    :::question type="MCQ" question="Which of the following statements about the Post Correspondence Problem (PCP) is true?" options=["PCP is decidable for instances with only two pairs of strings.","PCP is undecidable in its general form.","PCP can always be solved by a finite automaton.","PCP is decidable if all strings are of equal length."] answer="PCP is undecidable in its general form." hint="PCP is a classic example of an undecidable problem, often used in reductions." solution="The Post Correspondence Problem (PCP) is famously undecidable in its general form. This means there is no algorithm that can determine for all possible instances of PCP whether a match exists or not. While specific restricted versions of PCP might be decidable, the general problem is not."
    :::

    ---

    9. Recursive and Recursively Enumerable Languages

    Languages can be classified based on the capabilities of Turing Machines. A language is recursively enumerable (RE) if there exists a Turing Machine that accepts all strings in the language and either rejects or loops forever for strings not in the language. A language is recursive (or decidable) if there exists a Turing Machine that halts on all inputs, accepting strings in the language and rejecting strings not in the language.

    📖 Recursive Language

    A language LL is recursive if there exists a Turing Machine MM that decides LL. That is, for every wΣw \in \Sigma^*, MM halts and accepts ww if wLw \in L, and MM halts and rejects ww if wLw \notin L.

    📖 Recursively Enumerable (RE) Language

    A language LL is recursively enumerable if there exists a Turing Machine MM that recognizes LL. That is, for every wΣw \in \Sigma^*, MM halts and accepts ww if wLw \in L. If wLw \notin L, MM either halts and rejects or loops forever.

    Worked Example: Distinguishing between recursive and RE languages.

    Consider the language L1={anbnn0}L_1 = \{ a^n b^n \mid n \ge 0 \} and L2=HALT={M,wM halts on input w}L_2 = HALT = \{ \langle M, w \rangle \mid M \text{ halts on input } w \}.

    Step 1: Analyze L1={anbnn0}L_1 = \{ a^n b^n \mid n \ge 0 \}

    For any string xx, we can construct a TM that checks if xx is of the form anbna^n b^n.

  • Scan the string, checking if all 'a's come before all 'b's. If not, reject.

  • Count 'a's and 'b's. If counts are equal, accept. Otherwise, reject.

  • This TM will always halt, either accepting or rejecting.

    >

    TM for L1 always halts\text{TM for } L_1 \text{ always halts}

    Step 2: Analyze L2=HALTL_2 = HALT

    For HALTHALT, we know from the Halting Problem that no Turing Machine can decide it (i.e., halt on all inputs and give a correct yes/no answer). However, we can construct a TM that recognizes HALTHALT:

  • On input M,w\langle M, w \rangle, simulate MM on ww.

  • If MM halts, accept.

  • If MM does not halt, our simulating TM will also not halt.
  • >

    TM for HALT accepts if M halts, loops if M loops\text{TM for } HALT \text{ accepts if } M \text{ halts, loops if } M \text{ loops}

    Answer: L1L_1 is a recursive language because a TM can always decide its membership. L2L_2 (HALT) is a recursively enumerable language because a TM can recognize it (accept if in HALTHALT, but loop if not in HALTHALT), but it is not recursive because no TM can decide it.

    :::question type="MCQ" question="Which of the following statements correctly characterizes the relationship between recursive and recursively enumerable languages?" options=["All recursively enumerable languages are also recursive.","All recursive languages are also recursively enumerable.","Recursive languages are a proper superset of recursively enumerable languages.","Recursively enumerable languages are always context-free."] answer="All recursive languages are also recursively enumerable." hint="Consider the definitions: a decider TM is also a recognizer TM." solution="By definition, a recursive language has a Turing Machine that halts on all inputs, accepting if the string is in the language and rejecting otherwise. Such a TM is also a recognizer (it accepts strings in the language). Therefore, all recursive languages are also recursively enumerable. However, not all recursively enumerable languages are recursive (e.g., the Halting Problem language is RE but not recursive)."
    :::

    ---

    10. Properties of Recursive and RE Languages

    Recursive and Recursively Enumerable languages have specific closure properties under set operations like union, intersection, concatenation, Kleene star, and complementation. These properties are important for constructing new languages from existing ones and understanding their classification.

    📐 Closure Properties Summary

    | Operation | Recursive Languages | Recursively Enumerable Languages |
    | :--------------- | :------------------ | :------------------------------- |
    | Union | Closed | Closed |
    | Intersection | Closed | Closed |
    | Concatenation | Closed | Closed |
    | Kleene Star | Closed | Closed |
    | Complementation | Closed | NOT Closed |

    Worked Example: Proving that the union of two RE languages is also RE.

    Step 1: Define two RE languages and their recognizers

    Let L1L_1 and L2L_2 be two recursively enumerable languages. By definition, there exist Turing Machines M1M_1 that recognizes L1L_1 and M2M_2 that recognizes L2L_2.

    >

    L1=L(M1),L2=L(M2)L_1 = L(M_1), L_2 = L(M_2)

    Step 2: Construct a TM MunionM_{union} for L1L2L_1 \cup L_2

    We want to build a TM MunionM_{union} that recognizes L1L2L_1 \cup L_2. For an input ww:

  • MunionM_{union} simulates M1M_1 on ww.

  • If M1M_1 accepts ww, then MunionM_{union} accepts ww and halts.

  • If M1M_1 does not accept ww (either rejects or loops), MunionM_{union} cannot simply wait for M1M_1 to finish because M1M_1 might loop. Instead, we need to run M1M_1 and M2M_2 in parallel or interleave their steps.
  • >

    On input w:\text{On input } w:

    >
    Simulate M1 on w for one step.\text{Simulate } M_1 \text{ on } w \text{ for one step.}

    >
    Simulate M2 on w for one step.\text{Simulate } M_2 \text{ on } w \text{ for one step.}

    >
    Repeat.\text{Repeat.}

    Step 3: Analyze MunionM_{union}'s behavior

    If wL1w \in L_1, M1M_1 will eventually accept. Since M1M_1 is simulated in an interleaved fashion, MunionM_{union} will eventually detect M1M_1's acceptance and accept ww.
    If wL2w \in L_2, M2M_2 will eventually accept. MunionM_{union} will detect M2M_2's acceptance and accept ww.
    If wL1L2w \in L_1 \cup L_2, then ww is in at least one of L1L_1 or L2L_2, so MunionM_{union} will eventually accept.
    If wL1L2w \notin L_1 \cup L_2, then neither M1M_1 nor M2M_2 will accept ww. Both might loop or reject. In this case, MunionM_{union} will also loop or reject.

    >

    wL1L2    Munion acceptsw \in L_1 \cup L_2 \implies M_{union} \text{ accepts}

    >
    wL1L2    Munion does not accept (loops or rejects)w \notin L_1 \cup L_2 \implies M_{union} \text{ does not accept (loops or rejects)}

    Answer: Since MunionM_{union} recognizes L1L2L_1 \cup L_2, the union of two RE languages is recursively enumerable.

    :::question type="MCQ" question="Which of the following operations is NOT closed for recursively enumerable languages?" options=["Union","Intersection","Concatenation","Complementation"] answer="Complementation" hint="Consider the relationship between RE languages and recursive languages, especially regarding decidability." solution="Recursively enumerable (RE) languages are closed under union, intersection, and concatenation. However, they are NOT closed under complementation. The complement of an RE language is not necessarily RE. For example, HALTHALT is RE, but its complement L¬HALTL_{\neg HALT} (the set of M,w\langle M, w \rangle where MM does not halt on ww) is not RE. If both an RE language and its complement were RE, then the language would be recursive (decidable)."
    :::

    ---

    Advanced Applications

    Worked Example: Using reduction and Rice's Theorem to prove undecidability.

    Prove that the language LFINITE={ML(M) is a finite language}L_{FINITE} = \{ \langle M \rangle \mid L(M) \text{ is a finite language} \} is undecidable.

    Step 1: Apply Rice's Theorem

    We need to check if LFINITEL_{FINITE} represents a non-trivial property of the language recognized by a Turing Machine.

  • Property of the language: The property "being a finite language" depends only on L(M)L(M), not on the specific TM MM.

  • Non-triviality:

  • * Is it true for some RE languages? Yes, for example, L(M1)={a}L(M_1) = \{a\} is a finite language. So M1LFINITEM_1 \in L_{FINITE}.
    Is it false for some RE languages? Yes, for example, L(M2)=ΣL(M_2) = \Sigma^ is an infinite language. So M2LFINITEM_2 \notin L_{FINITE}.

    >

    Property is non-trivial\text{Property is non-trivial}

    Step 2: Conclusion from Rice's Theorem

    Since LFINITEL_{FINITE} represents a non-trivial property of RE languages, by Rice's Theorem, LFINITEL_{FINITE} is undecidable.

    Answer: The language LFINITEL_{FINITE} is undecidable because it corresponds to a non-trivial property of recursively enumerable languages, making it directly subject to Rice's Theorem.

    :::question type="NAT" question="Consider the language LEMPTY={ML(M)=}L_{EMPTY} = \{ \langle M \rangle \mid L(M) = \emptyset \}. If LEMPTYL_{EMPTY} is undecidable, what is the minimum number of distinct, non-trivial properties of RE languages that are known to be undecidable, including LEMPTYL_{EMPTY} itself, that can be directly derived from Rice's Theorem?" answer="1" hint="Rice's Theorem itself guarantees the undecidability of any non-trivial property. The question asks for the minimum number of distinct properties. If LEMPTYL_{EMPTY} is one such property, that counts as one." solution="Rice's Theorem states that any non-trivial property of the language recognized by a Turing Machine is undecidable. LEMPTYL_{EMPTY} is one such non-trivial property (it's true for the TM that accepts no strings, false for the TM that accepts at least one string). Therefore, at least one such property (namely, LEMPTYL_{EMPTY} itself) is known to be undecidable. The question asks for the minimum number of distinct properties, and LEMPTYL_{EMPTY} is one distinct property. The answer is 1."
    :::

    ---

    Problem-Solving Strategies

    💡 Undecidability Proofs

    When asked to prove a problem is undecidable, the most common strategies are:

    • Diagonalization: Directly construct a contradiction, similar to the Halting Problem proof. This is usually for foundational undecidable problems.

    • Reduction: Reduce a known undecidable problem (like HALTHALT or LuL_u) to the problem in question. If you can show that if you could solve the new problem, you could also solve the known undecidable problem, then the new problem must also be undecidable.

    • Rice's Theorem: If the problem asks about a property of the language recognized by a Turing Machine, check if that property is non-trivial. If it is, Rice's Theorem directly implies undecidability.

    ---

    Common Mistakes

    ⚠️ RE vs. Recursive

    ❌ Confusing recursively enumerable (RE) languages with recursive (decidable) languages.
    ✅ All recursive languages are RE, but not all RE languages are recursive. Recursive languages have decider TMs that always halt. RE languages have recognizer TMs that halt and accept for strings in the language but may loop forever for strings not in the language.

    ⚠️ Properties of TM vs. Properties of Language

    ❌ Applying Rice's Theorem to properties of the Turing Machine itself (e.g., "Does MM have an even number of states?").
    ✅ Rice's Theorem applies ONLY to properties of the language recognized by the Turing Machine (e.g., "Is L(M)L(M) regular?", "Is L(M)L(M) empty?"). Properties of the TM's description are often decidable.

    ---

    Practice Questions

    :::question type="MCQ" question="Which of the following problems is decidable?" options=["Determining if L(M)L(M) contains at least 5 strings, for a given TM MM.","Determining if a given Turing Machine MM halts on all inputs.","Determining if a given regular expression RR generates a finite language.","Determining if L(M1)L(M2)=L(M_1) \cap L(M_2) = \emptyset for two TMs M1,M2M_1, M_2."] answer="Determining if a given regular expression RR generates a finite language." hint="Decidable problems have algorithms that always halt and give a correct answer. Consider the properties of different language classes." solution="1. 'Determining if L(M)L(M) contains at least 5 strings' is a non-trivial property of the language, hence undecidable by Rice's Theorem.

  • 'Determining if a given Turing Machine MM halts on all inputs' is the Totality Problem, which is undecidable (a variant of the Halting Problem).

  • 'Determining if a given regular expression RR generates a finite language' is decidable. Regular expressions can be converted to finite automata, and finiteness of a regular language is decidable (e.g., by checking for cycles reachable from the start state and leading to a final state in its state graph).

  • 'Determining if L(M1)L(M2)=L(M_1) \cap L(M_2) = \emptyset for two TMs M1,M2M_1, M_2' is undecidable. This is a variant of the language emptiness problem for TMs, which is undecidable."

  • :::

    :::question type="NAT" question="Consider a language L={MM accepts ϵ}L = \{ \langle M \rangle \mid M \text{ accepts } \epsilon \}. Is LL decidable or undecidable? If undecidable, how many distinct, known undecidable problems (including LL itself, if applicable) can be cited as direct evidence, assuming it is proven via reduction from HALTHALT or LuL_u?" answer="1" hint="The problem asks about the acceptance of a specific string by a TM. This is a property of the TM's behavior, not just its language, but it can still be undecidable." solution="The language L={MM accepts ϵ}L = \{ \langle M \rangle \mid M \text{ accepts } \epsilon \} is undecidable. This is a specific instance of the acceptance problem for Turing Machines, ATM={M,wM accepts w}A_{TM} = \{ \langle M, w \rangle \mid M \text{ accepts } w \}, which is known to be undecidable. LL is a special case of ATMA_{TM} where w=ϵw = \epsilon.
    To prove ATMA_{TM} (and thus LL) is undecidable, we typically reduce the Halting Problem (HALTHALT) to it. This means HALTmATMHALT \le_m A_{TM}. The problem asks for the number of distinct, known undecidable problems that can be cited as direct evidence if proven via reduction from HALTHALT or LuL_u. In this case, HALTHALT (or LuL_u) is the single direct known undecidable problem used for the reduction. So the answer is 1."
    :::

    :::question type="MSQ" question="Select ALL true statements regarding noncomputable functions." options=["A noncomputable function cannot be computed by any Turing Machine.","The domain of a noncomputable function is always infinite.","The Halting Problem is an example of a noncomputable function (when formulated as a decision problem).","Noncomputable functions are those that require infinite time to compute for any input."] answer="A noncomputable function cannot be computed by any Turing Machine.,The Halting Problem is an example of a noncomputable function (when formulated as a decision problem)." hint="Recall the definition of a noncomputable function and the nature of the Halting Problem." solution="1. A noncomputable function cannot be computed by any Turing Machine. This is the definition of a noncomputable function. (Correct)

  • The domain of a noncomputable function is always infinite. Not necessarily. A function could have a finite domain but still be noncomputable if its values cannot be effectively determined. However, the typical undecidable problems involve infinite domains. (Incorrect)

  • The Halting Problem is an example of a noncomputable function (when formulated as a decision problem). When formulated as a function that returns true/false for halting/non-halting, this function is noncomputable because no TM can compute it for all inputs. (Correct)

  • Noncomputable functions are those that require infinite time to compute for any input. This is not entirely accurate. A noncomputable function means no algorithm exists to compute it. It's not about infinite time for any input, but rather the inability to construct a finite algorithm that always terminates with the correct answer for all inputs in its domain. For some inputs, a TM might halt correctly, but not for all. (Incorrect)"

  • :::

    :::question type="MCQ" question="Given an instance of the Post Correspondence Problem (PCP) P={(0,01),(1,01),(10,0)}P = \{ (0, 01), (1, 01), (10, 0) \}. Does a match exist?" options=["Yes, using sequence (1, 2)","Yes, using sequence (3, 1)","No, a match does not exist.","Yes, using sequence (1, 3)"] answer="Yes, using sequence (1, 3)" hint="Try concatenating sequences of uiu_i and viv_i to find a match." solution="Let the pairs be:

  • (u1,v1)=(0,01)(u_1, v_1) = (0, 01)

  • (u2,v2)=(1,01)(u_2, v_2) = (1, 01)

  • (u3,v3)=(10,0)(u_3, v_3) = (10, 0)
  • Let's test the options:

    • (1, 2):

    u1u2=01=01u_1 u_2 = 0 \cdot 1 = 01
    v1v2=0101=0101v_1 v_2 = 01 \cdot 01 = 0101
    No match.

    • (3, 1):
    u3u1=100=100u_3 u_1 = 10 \cdot 0 = 100 v3v1=001=001v_3 v_1 = 0 \cdot 01 = 001 No match.
    • (1, 3):
    u1u3=010=010u_1 u_3 = 0 \cdot 10 = 010 v1v3=010=010v_1 v_3 = 01 \cdot 0 = 010 Match found!

    Therefore, a match exists using sequence (1, 3)."
    :::

    :::question type="MCQ" question="Which of the following is an example of a partial computable function that is not total computable?" options=["The function f(n)=n+1f(n) = n+1 for nNn \in \mathbb{N}.","The function that returns the nn-th prime number.","The function f(M,w)f(\langle M, w \rangle) that returns 1 if TM MM halts on ww, and is undefined otherwise.","The function f(x)=sin(x)f(x) = \sin(x) for xRx \in \mathbb{R}. "] answer="The function f(M,w)f(\langle M, w \rangle) that returns 1 if TM MM halts on ww, and is undefined otherwise." hint="A partial computable function may not be defined for all inputs in its theoretical domain, meaning the TM may not halt for those inputs." solution="1. f(n)=n+1f(n) = n+1 is a total computable function, defined for all natural numbers.

  • The function returning the nn-th prime number is a total computable function.

  • The function f(M,w)f(\langle M, w \rangle) that returns 1 if TM MM halts on ww, and is undefined otherwise, is a classic example of a partial computable function that is not total. A TM can be built to simulate MM on ww and halt with 1 if MM halts, but if MM does not halt on ww, the TM for ff will also not halt, making ff undefined for those inputs. Since the Halting Problem is undecidable, this function cannot be made total.

  • f(x)=sin(x)f(x) = \sin(x) is a mathematical function over real numbers, which are not directly handled by TMs in the same way as discrete inputs. Even if restricted to computable real numbers, it would be a total computable function."

  • :::

    ---

    Summary

    Key Formulas & Takeaways

    |

    | Formula/Concept | Expression |

    |---|----------------|------------| | 1 | Computable Function | A function for which a Turing Machine halts with the correct output for all inputs in its domain. | | 2 | Church-Turing Thesis | Any algorithm can be simulated by a Turing Machine. | | 3 | Universal Turing Machine | A TM that can simulate any other TM on any input. | | 4 | Undecidable Problem | A problem for which no Turing Machine exists that halts on all inputs and correctly decides membership. | | 5 | Halting Problem | HALT={M,wM halts on w}HALT = \{ \langle M, w \rangle \mid M \text{ halts on } w \}, which is undecidable. | | 6 | Many-one Reducibility | AmBA \le_m B if wA    f(w)Bw \in A \iff f(w) \in B for a computable ff. Used to prove undecidability. | | 7 | Rice's Theorem | Any non-trivial property of the language recognized by a TM is undecidable. | | 8 | Post Correspondence Problem | An undecidable problem concerning finding a match in a list of string pairs. | | 9 | Recursive Language | Decidable by a TM that always halts. | | 10 | Recursively Enumerable (RE) Language | Recognizable by a TM that halts and accepts if in language, may loop otherwise. | | 11 | Closure Properties | Recursive languages are closed under complementation; RE languages are not. Both are closed under union, intersection, concatenation, Kleene star. |

    ---

    What's Next?

    💡 Continue Learning

    This topic connects to:

      • Complexity Theory: Computability defines what can be computed; complexity theory investigates what can be computed efficiently.

      • Formal Languages: Understanding the hierarchy of languages (regular, context-free, recursive, RE) is built upon the concept of computability.

      • Logic and Foundations of Mathematics: Computability theory has deep connections to Gödel's incompleteness theorems and the limits of formal systems.

    ---

    💡 Next Up

    Proceeding to Basics of Decidability.

    ---

    Part 2: Basics of Decidability

    This section covers fundamental concepts of decidability, undecidability, and reducibility, crucial for understanding the limits of computation in CMI exams.

    ---

    Core Concepts

    1. Decidable Languages

    A language is decidable if some Turing machine (TM) decides it. A TM decides a language if it halts on all inputs and accepts all strings in the language while rejecting all strings not in the language.

    📖 Decidable Language

    A language LL is decidable if there exists a Turing Machine MM such that L=L(M)L = L(M) and MM halts on all inputs. Such a TM is called a decider.

    Worked Example: Demonstrating ADFAA_{\text{DFA}} is Decidable.

    The language ADFA={B,wB is a DFA that accepts w}A_{\text{DFA}} = \{ \langle B, w \rangle \mid B \text{ is a DFA that accepts } w \} is decidable. We construct a TM MM that decides ADFAA_{\text{DFA}}.

    Step 1: Input validation

    > MM receives input B,w\langle B, w \rangle. It first checks if BB is a valid encoding of a DFA and ww is a valid string over the alphabet of BB. If not, MM rejects.

    Step 2: Simulate the DFA

    > MM simulates BB on input ww. MM keeps track of BB's current state and current position in ww.

    Step 3: Process transitions

    > For each symbol in ww, MM updates BB's current state according to BB's transition function.

    Step 4: Determine acceptance

    > After processing all symbols in ww, if BB's current state is an accept state, MM accepts. Otherwise, MM rejects.

    Answer: MM always halts because a DFA processes each symbol in ww exactly once and has a finite number of states. Thus, ADFAA_{\text{DFA}} is decidable.

    :::question type="MCQ" question="Which of the following languages is decidable?" options=["HALTTM={M,wM is a TM and M halts on input w}HALT_{\text{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}","EQTM={M1,M2M1 and M2 are TMs and L(M1)=L(M2)}EQ_{\text{TM}} = \{ \langle M_1, M_2 \rangle \mid M_1 \text{ and } M_2 \text{ are TMs and } L(M_1) = L(M_2) \}","ACFG={G,wG is a CFG that generates w}A_{\text{CFG}} = \{ \langle G, w \rangle \mid G \text{ is a CFG that generates } w \}","ALLCFG={GG is a CFG and L(G)=Σ}ALL_{\text{CFG}} = \{ \langle G \rangle \mid G \text{ is a CFG and } L(G) = \Sigma^* \}"] answer="ACFG={G,wG is a CFG that generates w}A_{\text{CFG}} = \{ \langle G, w \rangle \mid G \text{ is a CFG that generates } w \}" hint="Consider the properties of Turing machines that can simulate the given formalisms." solution="Step 1: Analyze HALTTMHALT_{\text{TM}} and EQTMEQ_{\text{TM}}.
    > These are known to be undecidable problems concerning the behavior of Turing machines.

    Step 2: Analyze ALLCFGALL_{\text{CFG}}.
    > ALLCFGALL_{\text{CFG}} is undecidable. There is no algorithm to check if a CFG generates all possible strings.

    Step 3: Analyze ACFGA_{\text{CFG}}.
    > For ACFGA_{\text{CFG}}, we can construct a TM that decides it. The TM takes G,w\langle G, w \rangle as input. It converts GG into Chomsky Normal Form. Then, it uses the CYK algorithm (or a similar dynamic programming approach) to determine if ww can be derived from GG. The CYK algorithm takes O(n3)\mathcal{O}(n^3) time, where nn is the length of ww, and always halts.

    Answer: ACFGA_{\text{CFG}} is decidable. The other options represent known undecidable languages."
    :::

    ---

    2. Undecidable Languages

    A language is undecidable if no Turing machine decides it. The concept of undecidability establishes fundamental limits on what problems can be solved algorithmically.

    📖 Undecidable Language

    A language LL is undecidable if no Turing Machine MM exists such that L=L(M)L = L(M) and MM halts on all inputs.

    The canonical example of an undecidable language is ATMA_{\text{TM}}, which represents the Halting Problem.

    📐 Acceptance Problem for Turing Machines
    ATM={M,wM is a TM and M accepts w}A_{\text{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ accepts } w \}
    Where: MM is a Turing Machine, ww is an input string. When to use: To refer to the fundamental undecidable problem of determining if a TM accepts an input.

    Worked Example: Proof that ATMA_{\text{TM}} is Undecidable (by Diagonalization).

    We prove ATMA_{\text{TM}} is undecidable by contradiction. Assume ATMA_{\text{TM}} is decidable, and let HH be a decider for ATMA_{\text{TM}}.

    Step 1: Define the assumed decider HH.

    > H(M,w)={acceptif M accepts wrejectif M does not accept wH(\langle M, w \rangle) = \begin{cases} \text{accept} & \text{if } M \text{ accepts } w \\ \text{reject} & \text{if } M \text{ does not accept } w \end{cases}

    Step 2: Construct a new TM, DD, using HH.

    > DD takes an encoding of a TM, M\langle M \rangle, as input.
    > DD calls HH on input M,M\langle M, \langle M \rangle \rangle.
    > DD does the opposite of what HH says:
    >
    >

    D(M)=acceptif H(M,M) rejects (i.e., M does not accept M)D(M)=rejectif H(M,M) accepts (i.e., M accepts M)\begin{aligned} D(\langle M \rangle) & = \text{accept} & \text{if } H(\langle M, \langle M \rangle \rangle) \text{ rejects (i.e., } M \text{ does not accept } \langle M \rangle) \\ D(\langle M \rangle) & = \text{reject} & \text{if } H(\langle M, \langle M \rangle \rangle) \text{ accepts (i.e., } M \text{ accepts } \langle M \rangle) \end{aligned}

    Step 3: Run DD on its own encoding D\langle D \rangle.

    > Consider the behavior of DD when its input is D\langle D \rangle:
    >
    >

    D(D)=acceptif H(D,D) rejectsD(D)=rejectif H(D,D) accepts\begin{aligned} D(\langle D \rangle) & = \text{accept} & \text{if } H(\langle D, \langle D \rangle \rangle) \text{ rejects} \\ D(\langle D \rangle) & = \text{reject} & \text{if } H(\langle D, \langle D \rangle \rangle) \text{ accepts} \end{aligned}

    Step 4: Analyze the contradiction.

    > By the definition of HH, H(D,D)H(\langle D, \langle D \rangle \rangle) accepts if DD accepts D\langle D \rangle, and rejects if DD does not accept D\langle D \rangle.
    >
    > If DD accepts D\langle D \rangle, then H(D,D)H(\langle D, \langle D \rangle \rangle) accepts. But by the definition of DD, if H(D,D)H(\langle D, \langle D \rangle \rangle) accepts, then DD rejects D\langle D \rangle. This is a contradiction.
    >
    > If DD rejects D\langle D \rangle, then H(D,D)H(\langle D, \langle D \rangle \rangle) rejects. But by the definition of DD, if H(D,D)H(\langle D, \langle D \rangle \rangle) rejects, then DD accepts D\langle D \rangle. This is also a contradiction.

    Answer: Both possibilities lead to a contradiction. Therefore, our initial assumption that ATMA_{\text{TM}} is decidable must be false. ATMA_{\text{TM}} is undecidable.

    :::question type="MCQ" question="Which of the following problems is undecidable?" options=["Given a context-free grammar GG and a string ww, is wL(G)w \in L(G)?","Given two DFAs D1D_1 and D2D_2, is L(D1)=L(D2)L(D_1) = L(D_2)?","Given a Turing machine MM, does MM halt on the empty string ϵ\epsilon?" ,"Given a regular expression RR and a string ww, does wL(R)w \in L(R)?"] answer="Given a Turing machine MM, does MM halt on the empty string ϵ\epsilon?" hint="Recall the fundamental undecidable problems related to Turing machines." solution="Step 1: Evaluate the first option.
    > The problem 'Given a context-free grammar GG and a string ww, is wL(G)w \in L(G)?' is decidable, as shown by the CYK algorithm.

    Step 2: Evaluate the second option.
    > The problem 'Given two DFAs D1D_1 and D2D_2, is L(D1)=L(D2)L(D_1) = L(D_2)?' is decidable. We can construct a DFA for the symmetric difference L(D1)ΔL(D2)=(L(D1)L(D2))(L(D1)L(D2))L(D_1) \Delta L(D_2) = (L(D_1) \cap \overline{L(D_2)}) \cup (\overline{L(D_1)} \cap L(D_2)) and check if this DFA accepts the empty language.

    Step 3: Evaluate the fourth option.
    > The problem 'Given a regular expression RR and a string ww, does wL(R)w \in L(R)?' is decidable. We can convert RR to an NFA, then to a DFA, and simulate the DFA on ww.

    Step 4: Evaluate the third option.
    > The problem 'Given a Turing machine MM, does MM halt on the empty string ϵ\epsilon?' is a variant of the Halting Problem, which is known to be undecidable. It can be reduced from ATMA_{\text{TM}}.

    Answer: Given a Turing machine MM, does MM halt on the empty string ϵ\epsilon?"
    :::

    ---

    3. Reducibility

    Reducibility is a powerful tool to prove decidability or undecidability of languages. If problem AA can be "reduced" to problem BB, it means that a solution for BB can be used to solve AA.

    📖 Many-One Reducibility

    A language AA is many-one reducible to language BB, denoted AmBA \le_m B, if there exists a computable function f:ΣΣf: \Sigma^ \to \Sigma^ such that for every wΣw \in \Sigma^, wA    f(w)Bw \in A \iff f(w) \in B. The function ff is called a reduction*.

    Implications of Many-One Reducibility:

  • If AmBA \le_m B and BB is decidable, then AA is decidable.

  • If AmBA \le_m B and AA is undecidable, then BB is undecidable.
  • Worked Example: Proving HALTTMHALT_{\text{TM}} is undecidable using ATMA_{\text{TM}}.

    The language HALTTM={M,wM is a TM and M halts on input w}HALT_{\text{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \} is undecidable. We prove this by showing ATMmHALTTMA_{\text{TM}} \le_m HALT_{\text{TM}}.

    Step 1: Assume HALTTMHALT_{\text{TM}} is decidable.

    > Let RR be a decider for HALTTMHALT_{\text{TM}}.

    Step 2: Construct a TM SS that decides ATMA_{\text{TM}} using RR.

    > S(M,w)S(\langle M, w \rangle):
    >
    > 1. Run RR on M,w\langle M, w \rangle.
    > 2. If RR rejects (meaning MM does not halt on ww), then SS rejects. (Since MM doesn't halt, it definitely doesn't accept).
    > 3. If RR accepts (meaning MM halts on ww), then SS simulates MM on ww.
    > 4. If MM accepts ww, then SS accepts.
    > 5. If MM rejects ww, then SS rejects.

    Step 3: Analyze SS's behavior.

    > Since RR is a decider, it always halts. If RR indicates MM halts, then SS simulates MM. Since MM is guaranteed to halt in this branch, the simulation will eventually finish, and SS will either accept or reject based on MM's behavior. Thus, SS always halts.
    >
    > SS accepts M,w\langle M, w \rangle if and only if MM halts on ww AND MM accepts ww. This is equivalent to MM accepts ww.
    > Therefore, SS decides ATMA_{\text{TM}}.

    Step 4: Conclude the contradiction.

    > We know ATMA_{\text{TM}} is undecidable. But if HALTTMHALT_{\text{TM}} were decidable, we could construct a decider SS for ATMA_{\text{TM}}, which is a contradiction.
    > Thus, HALTTMHALT_{\text{TM}} must be undecidable.

    Answer: The reduction f(M,w)=M,wf(\langle M, w \rangle) = \langle M, w \rangle (where MM' is a modified TM) demonstrates ATMmHALTTMA_{\text{TM}} \le_m HALT_{\text{TM}}, proving HALTTMHALT_{\text{TM}} is undecidable. The construction above is a direct decider for ATMA_{\text{TM}} given a decider for HALTTMHALT_{\text{TM}}, which is a proof by contradiction using the implication of reducibility.

    :::question type="MCQ" question="Let L1L_1 be an undecidable language and L2L_2 be a decidable language. If L1mL3L_1 \le_m L_3 and L3mL2L_3 \le_m L_2, what can be inferred about L3L_3?" options=["L3L_3 must be decidable.","L3L_3 must be undecidable.","L3L_3 could be decidable or undecidable.","L3L_3 is recursively enumerable but not decidable."] answer="L3L_3 must be undecidable." hint="Apply the properties of many-one reducibility sequentially." solution="Step 1: Analyze the first reduction: L1mL3L_1 \le_m L_3.
    > We are given that L1L_1 is undecidable. By the property of many-one reducibility, if AmBA \le_m B and AA is undecidable, then BB must be undecidable.
    > Therefore, from L1mL3L_1 \le_m L_3 and L1L_1 being undecidable, we conclude that L3L_3 must be undecidable.

    Step 2: Analyze the second reduction: L3mL2L_3 \le_m L_2.
    > We are given that L2L_2 is decidable. If AmBA \le_m B and BB is decidable, then AA is decidable.
    > Here, A=L3A=L_3 and B=L2B=L_2. So, if L3mL2L_3 \le_m L_2 and L2L_2 is decidable, it implies L3L_3 should be decidable.

    Step 3: Reconcile the inferences.
    > From Step 1, L3L_3 must be undecidable.
    > From Step 2, L3L_3 must be decidable.
    > These are contradictory. This means the initial premise (L1mL3L_1 \le_m L_3 and L3mL2L_3 \le_m L_2 where L1L_1 is undecidable and L2L_2 is decidable) cannot hold simultaneously.
    > However, the question asks what can be inferred about L3L_3 given these conditions. The strong inference from L1mL3L_1 \le_m L_3 is that L3L_3 is undecidable. If L3L_3 were decidable, then L1L_1 would also be decidable, which contradicts the given information. Thus, the only consistent inference is that L3L_3 must be undecidable. The second reduction L3mL2L_3 \le_m L_2 implies that L3L_3 cannot be reduced to L2L_2 if L3L_3 is undecidable and L2L_2 is decidable. But the question states that such a reduction has been constructed. This implies that the entire premise is consistent only if L3L_3 is undecidable.

    Answer: L3L_3 must be undecidable."
    :::

    ---

    4. Polynomial-Time Reducibility

    Polynomial-time reducibility (PP-time reducibility) is a restricted form of many-one reducibility where the reduction function ff must be computable in polynomial time. This concept is central to complexity theory, especially in defining NP-completeness.

    📖 Polynomial-Time Reducibility

    A language AA is polynomial-time reducible to language BB, denoted ApBA \le_p B, if there exists a polynomial-time computable function f:ΣΣf: \Sigma^ \to \Sigma^ such that for every wΣw \in \Sigma^*, wA    f(w)Bw \in A \iff f(w) \in B.

    Implications of Polynomial-Time Reducibility:

  • If ApBA \le_p B and BPB \in P, then APA \in P. (If BB is solvable in polynomial time, then AA is also solvable in polynomial time).

  • If ApBA \le_p B and APA \notin P, then BPB \notin P. (If AA is not solvable in polynomial time, then BB is also not solvable in polynomial time). This is the contrapositive of the first statement and is frequently used in proving NP-completeness.
  • Worked Example: Understanding implications of ApBA \le_p B.

    Suppose we have a polynomial-time reduction from problem SATSAT (Boolean Satisfiability) to problem 3SAT3-SAT. This means SATp3SATSAT \le_p 3-SAT.

    Step 1: State the known complexity of SATSAT.

    > SATSAT is NP-complete. It is widely believed that SATPSAT \notin P.

    Step 2: Apply the implication of PP-time reducibility.

    > Since SATp3SATSAT \le_p 3-SAT and it is believed that SATPSAT \notin P, then by the second implication, 3SATP3-SAT \notin P.

    Step 3: Consider the converse.

    > If 3SATP3-SAT \in P, then by the first implication, SATPSAT \in P. This would imply P=NPP=NP, which is a major open problem in computer science.

    Answer: The polynomial-time reduction SATp3SATSAT \le_p 3-SAT implies that if SATSAT is not in PP, then 3SAT3-SAT is also not in PP. Conversely, if 3SAT3-SAT were in PP, then SATSAT would also be in PP.

    :::question type="MSQ" question="We have constructed a polynomial time reduction from problem XX to problem YY (XpYX \le_p Y). Which of the following are valid inferences?" options=["If YY can be solved in polynomial time, then XX can also be solved in polynomial time.","If XX cannot be solved in polynomial time, then YY cannot be solved in polynomial time.","If XX can be solved in exponential time, then YY can also be solved in exponential time.","If YY cannot be solved in polynomial time, then XX cannot be solved in polynomial time."] answer="If YY can be solved in polynomial time, then XX can also be solved in polynomial time.,If XX cannot be solved in polynomial time, then YY cannot be solved in polynomial time." hint="Focus on the direct implications and contrapositives of PP-time reducibility for complexity classes." solution="Step 1: Analyze the definition of XpYX \le_p Y.
    > This means there's a polynomial-time function ff that transforms instances of XX into instances of YY such that xX    f(x)Yx \in X \iff f(x) \in Y.

    Step 2: Evaluate 'If YY can be solved in polynomial time, then XX can also be solved in polynomial time.'
    > If YPY \in P, we can solve an instance xx of XX by first computing f(x)f(x) (which takes polynomial time) and then running the polynomial-time algorithm for YY on f(x)f(x). The total time will be polynomial. This statement is correct.

    Step 3: Evaluate 'If XX cannot be solved in polynomial time, then YY cannot be solved in polynomial time.'
    > This is the contrapositive of the previous statement. If YY could be solved in polynomial time, then XX could also be solved in polynomial time (as per Step 2). Since we assume XX cannot be solved in polynomial time, YY must also not be solvable in polynomial time. This statement is correct.

    Step 4: Evaluate 'If XX can be solved in exponential time, then YY can also be solved in exponential time.'
    > This is not necessarily true. If XX can be solved in exponential time, it means XPX \notin P. From XpYX \le_p Y and XPX \notin P, we know YPY \notin P. However, YY could be much harder than exponential time (e.g., doubly exponential, or not computable at all). The reduction only gives an upper bound for XX relative to YY, not a lower bound for YY relative to XX beyond PP. This statement is incorrect.

    Step 5: Evaluate 'If YY cannot be solved in polynomial time, then XX cannot be solved in polynomial time.'
    > This is incorrect. If YPY \notin P, it only implies that XX might be in PP or might not be. For example, if XX is a trivially easy problem in PP (e.g., checking if a string is 'a') and YY is an NP-complete problem, we can still have XpYX \le_p Y. The fact that YY is hard doesn't make XX hard. This statement is incorrect.

    Answer: If YY can be solved in polynomial time, then XX can also be solved in polynomial time.,If XX cannot be solved in polynomial time, then YY cannot be solved in polynomial time."
    :::

    ---

    Advanced Applications

    This section explores more complex scenarios involving decidability and reducibility, often requiring multiple steps or a deeper understanding of TM behavior.

    Worked Example: Proving EQTMEQ_{\text{TM}} is undecidable.

    The language EQTM={M1,M2M1 and M2 are TMs and L(M1)=L(M2)}EQ_{\text{TM}} = \{ \langle M_1, M_2 \rangle \mid M_1 \text{ and } M_2 \text{ are TMs and } L(M_1) = L(M_2) \} is undecidable. We prove this by showing ETMmEQTME_{\text{TM}} \le_m EQ_{\text{TM}}, where ETM={ML(M)=}E_{\text{TM}} = \{ \langle M \rangle \mid L(M) = \emptyset \} is known to be undecidable.

    Step 1: Assume EQTMEQ_{\text{TM}} is decidable.

    > Let RR be a decider for EQTMEQ_{\text{TM}}.

    Step 2: Construct a TM SS that decides ETME_{\text{TM}} using RR.

    > S(M)S(\langle M \rangle):
    >
    > 1. Construct a TM MM_{\emptyset} that accepts no strings (i.e., L(M)=L(M_{\emptyset}) = \emptyset). A simple MM_{\emptyset} can immediately reject all inputs.
    > 2. Run RR on input M,M\langle M, M_{\emptyset} \rangle.
    > 3. If RR accepts, then SS accepts. (This means L(M)=L(M)=L(M) = L(M_{\emptyset}) = \emptyset).
    > 4. If RR rejects, then SS rejects. (This means L(M)L(M)L(M) \neq L(M_{\emptyset}), so L(M)L(M) \neq \emptyset).

    Step 3: Analyze SS's behavior.

    > Since RR is a decider, it always halts. The construction of MM_{\emptyset} is trivial and takes constant time. Thus, SS always halts.
    > SS accepts M\langle M \rangle if and only if L(M)=L(M) = \emptyset.
    > Therefore, SS decides ETME_{\text{TM}}.

    Step 4: Conclude the contradiction.

    > We know ETME_{\text{TM}} is undecidable. But if EQTMEQ_{\text{TM}} were decidable, we could construct a decider SS for ETME_{\text{TM}}, which is a contradiction.
    > Thus, EQTMEQ_{\text{TM}} must be undecidable.

    Answer: The reduction f(M)=M,Mf(\langle M \rangle) = \langle M, M_{\emptyset} \rangle (where MM_{\emptyset} is a TM that accepts nothing) shows ETMmEQTME_{\text{TM}} \le_m EQ_{\text{TM}}, proving EQTMEQ_{\text{TM}} is undecidable.

    :::question type="NAT" question="Consider the problem A={MM is a TM and L(M) contains exactly one string}A = \{ \langle M \rangle \mid M \text{ is a TM and } L(M) \text{ contains exactly one string} \}. We want to prove AA is undecidable. We can reduce ETME_{\text{TM}} to AA. If ff is the reduction function, f(M)=Mf(\langle M \rangle) = \langle M' \rangle. How many strings does MM' accept if L(M)=L(M) = \emptyset?" answer="1" hint="The reduction should map instances of ETME_{\text{TM}} to instances of AA. If L(M)=L(M) = \emptyset, then METM\langle M \rangle \in E_{\text{TM}}, so f(M)=Mf(\langle M \rangle) = \langle M' \rangle must be in AA. This means L(M)L(M') must contain exactly one string." solution="Step 1: Understand the goal of the reduction.
    > We want to show ETMmAE_{\text{TM}} \le_m A. This means we need a computable function ff such that METM    f(M)A\langle M \rangle \in E_{\text{TM}} \iff f(\langle M \rangle) \in A.
    > In other words, L(M)=    L(M)L(M) = \emptyset \iff L(M') contains exactly one string.

    Step 2: Define the construction of MM'.
    > Given MM, we construct MM' as follows:
    > MM' takes an input string xx.
    > 1. MM' ignores its input xx.
    > 2. MM' simulates MM on some fixed string, say w0w_0. (The choice of w0w_0 doesn't matter, as long as it's a specific string.)
    > 3. If MM accepts w0w_0, then MM' accepts xx. (This means MM' accepts all strings xx).
    > 4. If MM does not accept w0w_0, then MM' rejects xx. (This means MM' accepts no strings).
    > This construction is not quite right for AA. We need L(M)L(M') to have exactly one string if L(M)=L(M) = \emptyset.

    Step 3: Refine the construction of MM'.
    > Let's choose a specific string, say s0=’test’s_0 = \text{'test'}.
    > MM' takes an input string xx.
    > 1. MM' simulates MM on input xx. (This is a common pattern for reductions from ATMA_{\text{TM}} or ETME_{\text{TM}}).
    > 2. If MM accepts xx, then MM' accepts s0s_0 (if x=s0x=s_0) and rejects all other xx. This is getting complicated.

    Step 4: A simpler and more common reduction for ETME_{\text{TM}} to 'single string' properties.
    > Let s0s_0 be a fixed, arbitrary string (e.g., s0=’a’s_0 = \text{'a'}).
    > Construct MM' from MM as follows:
    > MM' on input ww:
    > 1. If ws0w \neq s_0, MM' immediately rejects.
    > 2. If w=s0w = s_0, MM' simulates MM on ww.
    > 3. If MM accepts ww, MM' accepts ww.
    > 4. If MM rejects ww or loops on ww, MM' rejects ww or loops on ww.
    >
    > This construction means L(M)L(M') can only contain s0s_0.
    >
    > If L(M)=L(M) = \emptyset: Then MM does not accept any ww. In particular, MM does not accept s0s_0. So, MM' on input s0s_0 will not accept s0s_0. Thus, L(M)=L(M') = \emptyset. This doesn't map to AA.

    Step 5: Re-attempt reduction: ETMmAE_{\text{TM}} \le_m A.
    > We need L(M)=    L(M)L(M) = \emptyset \iff L(M') contains exactly one string.
    > Let s0s_0 be a fixed string (e.g., 'dummy').
    > Construct MM' from MM as follows:
    > MM' on input xx:
    > 1. If xs0x \neq s_0, MM' rejects xx.
    > 2. If x=s0x = s_0:
    > a. Simulate MM on s0s_0.
    > b. If MM accepts s0s_0, then MM' rejects s0s_0.
    > c. If MM does not accept s0s_0 (i.e., it rejects or loops), then MM' accepts s0s_0.
    >
    > Let's test this:
    > Case 1: L(M)=L(M) = \emptyset. This means MM does not accept s0s_0.
    > Then, when MM' receives s0s_0, step 2c is executed, and MM' accepts s0s_0.
    > For any xs0x \neq s_0, MM' rejects.
    > So, if L(M)=L(M) = \emptyset, then L(M)={s0}L(M') = \{s_0\}, which contains exactly one string. This works!
    >
    > Case 2: L(M)L(M) \neq \emptyset. This means MM accepts at least one string.
    > If MM accepts s0s_0: Then MM' on input s0s_0 executes step 2b and rejects s0s_0. So L(M)=L(M') = \emptyset.
    > If MM does not accept s0s_0 (but accepts some other string w1s0w_1 \neq s_0): Then MM' on input s0s_0 executes step 2c and accepts s0s_0. So L(M)={s0}L(M') = \{s_0\}.
    >
    > This reduction doesn't work for both directions. If L(M)L(M) \neq \emptyset but s0L(M)s_0 \notin L(M), then L(M)={s0}L(M') = \{s_0\}, and MA\langle M' \rangle \in A, but METM\langle M \rangle \notin E_{\text{TM}}.

    Step 6: A correct reduction for ETMmAE_{\text{TM}} \le_m A.
    > We need L(M)=    L(M)L(M) = \emptyset \iff L(M') contains exactly one string.
    > Let s0s_0 be a fixed string (e.g., 'a').
    > Construct MM' from MM as follows:
    > MM' on input xx:
    > 1. Run MM on input xx.
    > 2. If MM accepts xx, then MM' accepts s0s_0 (and only s0s_0).
    > 3. If MM rejects or loops on xx, then MM' rejects everything. This is still problematic.

    Step 7: A standard reduction trick for ETME_{\text{TM}}.
    > Let s0s_0 be a fixed string, e.g., 'single'.
    > Construct MM' from MM as follows:
    > MM' on input xx:
    > 1. If xs0x \neq s_0, MM' immediately rejects.
    > 2. If x=s0x = s_0:
    > a. Simulate MM on all possible strings in lexicographic order for a fixed number of steps (say, kk steps for each string). This is a trick to make MM' accept s0s_0 only if MM accepts any string.
    > b. This approach is more suited for ALLTMALL_{\text{TM}} or similar.

    Step 8: Let's simplify. If L(M)=L(M) = \emptyset, MM' accepts one specific string. If L(M)L(M) \neq \emptyset, MM' accepts zero or many strings.
    > Construct MM' from MM as follows:
    > MM' on input ww:
    > 1. Simulate MM on input ww.
    > 2. If MM accepts ww, MM' accepts ww.
    > 3. If MM rejects ww, MM' loops. (This is for ATMmLA_{\text{TM}} \le_m L for some LL).

    Step 9: Focus on the question: "How many strings does MM' accept if L(M)=L(M) = \emptyset?"
    > The question implies a specific reduction is constructed.
    > We are given ETMmAE_{\text{TM}} \le_m A. This means METM    f(M)=MA\langle M \rangle \in E_{\text{TM}} \iff f(\langle M \rangle) = \langle M' \rangle \in A.
    >
    > If L(M)=L(M) = \emptyset, then METM\langle M \rangle \in E_{\text{TM}}.
    > For the reduction to be valid, f(M)=Mf(\langle M \rangle) = \langle M' \rangle must be in AA.
    >
    > By definition of AA, if MA\langle M' \rangle \in A, then L(M)L(M') must contain exactly one string.

    Answer: 1"
    :::

    ---

    Problem-Solving Strategies

    💡 Undecidability Proof by Reduction

    To prove language BB is undecidable, find a known undecidable language AA. Construct a reduction ff such that AmBA \le_m B. This means:

    • Design a TM (or algorithm) that takes an instance of AA (e.g., M,w\langle M, w \rangle) and transforms it into an instance of BB (e.g., M,x\langle M', x \rangle).

    • The transformation ff must be computable.

    • Crucially, ensure that the transformation preserves membership: wA    f(w)Bw \in A \iff f(w) \in B.

    • Assume BB is decidable by some decider RR.

    • Show how to construct a decider for AA using RR and ff. This leads to a contradiction, proving BB is undecidable.

    💡 Complexity Inference from P-Time Reductions

    For ApBA \le_p B:

      • To show AA is in PP: Find a PP-time algorithm for BB.

      • To show BB is not in PP: Find a problem AA that is known not to be in PP and reduce AA to BB in polynomial time. This is the primary method for proving NP-completeness (reducing a known NP-complete problem to BB).

    ---

    Common Mistakes

    ⚠️ Direction of Reduction

    ❌ Confusing AmBA \le_m B with BmAB \le_m A. If AmBA \le_m B and AA is undecidable, BB is undecidable. This implies that if BB were decidable, AA would also be decidable. The reduction is from the harder problem to the easier (or unknown) problem.
    ✅ Always reduce the known undecidable (or harder) problem (AA) to the problem you want to prove undecidable (or hard) (BB). AmBA \le_m B.

    ⚠️ Polynomial vs. Computable Reductions

    ❌ Using a non-polynomial time reduction to draw conclusions about complexity classes like PP. A reduction must be polynomial-time to infer properties about PP.
    ✅ For decidability/undecidability, any computable reduction is sufficient. For complexity class PP, the reduction must be polynomial-time computable.

    ---

    Practice Questions

    :::question type="MCQ" question="Which of the following statements about decidability and reducibility is FALSE?" options=["If AmBA \le_m B and AA is undecidable, then BB is undecidable.","If AmBA \le_m B and BB is decidable, then AA is decidable.","If AmBA \le_m B and BB is undecidable, then AA is undecidable.","The language ATMA_{\text{TM}} is undecidable."] answer="If AmBA \le_m B and BB is undecidable, then AA is undecidable." hint="Carefully consider the implications of many-one reducibility." solution="Step 1: Analyze the first statement.
    > 'If AmBA \le_m B and AA is undecidable, then BB is undecidable.' This is a fundamental property of many-one reducibility and is TRUE. If BB were decidable, then AA would also be decidable, which contradicts the premise.

    Step 2: Analyze the second statement.
    > 'If AmBA \le_m B and BB is decidable, then AA is decidable.' This is also a fundamental property of many-one reducibility and is TRUE. If we have a decider for BB and a reduction from AA to BB, we can construct a decider for AA.

    Step 3: Analyze the fourth statement.
    > 'The language ATMA_{\text{TM}} is undecidable.' This is the definition of the Halting Problem, which is famously undecidable. This statement is TRUE.

    Step 4: Analyze the third statement.
    > 'If AmBA \le_m B and BB is undecidable, then AA is undecidable.' This statement is FALSE. A reduction AmBA \le_m B means AA is 'no harder than' BB. If BB is undecidable, AA could still be decidable. For example, let A=A = \emptyset (the empty language, which is decidable) and B=ATMB = A_{\text{TM}} (undecidable). We can construct a reduction ff from AA to BB: f(w)=Mrej,anyf(w) = \langle M_{\text{rej}}, \text{any} \rangle, where MrejM_{\text{rej}} is a TM that immediately rejects all inputs. Then w    f(w)ATMw \in \emptyset \iff f(w) \in A_{\text{TM}} is vacuously true as ww \notin \emptyset and f(w)ATMf(w) \notin A_{\text{TM}} (since MrejM_{\text{rej}} doesn't accept anything). Thus, AmBA \le_m B holds, BB is undecidable, but AA is decidable.

    Answer: If AmBA \le_m B and BB is undecidable, then AA is undecidable."
    :::

    :::question type="NAT" question="Let L1L_1 be a language for which no Turing machine halts on all inputs. Let L2L_2 be a language for which there exists a Turing machine that halts on all inputs. If L1pL2L_1 \le_p L_2, what is the minimum number of steps (0 or 1) required to conclude that this reduction cannot exist?" answer="0" hint="Consider the definition of L1L_1 and L2L_2 in terms of decidability." solution="Step 1: Interpret the properties of L1L_1 and L2L_2.
    > 'No Turing machine halts on all inputs' for L1L_1 means L1L_1 is undecidable.
    > 'There exists a Turing machine that halts on all inputs' for L2L_2 means L2L_2 is decidable.

    Step 2: Apply the implications of PP-time reducibility (L1pL2L_1 \le_p L_2).
    > If L1pL2L_1 \le_p L_2 and L2L_2 is decidable, then L1L_1 must also be decidable.

    Step 3: Identify the contradiction.
    > We are given that L1L_1 is undecidable, but the reduction L1pL2L_1 \le_p L_2 implies L1L_1 is decidable. This is a direct contradiction.

    Step 4: Determine the number of steps to conclude non-existence.
    > The contradiction is immediate from the definitions and the property of reduction. No additional steps or constructions are needed beyond stating the properties. Therefore, the reduction cannot exist under these conditions.

    Answer: 0"
    :::

    :::question type="MSQ" question="Consider the language LNE={MM is a TM and L(M)}L_{\text{NE}} = \{ \langle M \rangle \mid M \text{ is a TM and } L(M) \neq \emptyset \}. Which of the following statements are true?" options=["LNEL_{\text{NE}} is undecidable.","LNEL_{\text{NE}} is decidable.","ATMmLNEA_{\text{TM}} \le_m L_{\text{NE}}.","LNEL_{\text{NE}} is recursively enumerable."] answer="LNEL_{\text{NE}} is undecidable.,LNEL_{\text{NE}} is recursively enumerable." hint="Recall the relationship between LNEL_{\text{NE}} and ETME_{\text{TM}}, and the definition of recursively enumerable languages." solution="Step 1: Analyze LNEL_{\text{NE}}'s decidability.
    > LNEL_{\text{NE}} is the complement of ETM={ML(M)=}E_{\text{TM}} = \{ \langle M \rangle \mid L(M) = \emptyset \}. We know ETME_{\text{TM}} is undecidable.
    > If LNEL_{\text{NE}} were decidable, then its complement, ETME_{\text{TM}}, would also be decidable (by simply flipping the accept/reject states of the decider for LNEL_{\text{NE}}). This contradicts the fact that ETME_{\text{TM}} is undecidable.
    > Therefore, LNEL_{\text{NE}} is undecidable. (Option 1 is true, Option 2 is false).

    Step 2: Analyze ATMmLNEA_{\text{TM}} \le_m L_{\text{NE}}.
    > To show ATMmLNEA_{\text{TM}} \le_m L_{\text{NE}}, we need a computable function ff such that M,wATM    f(M,w)=MLNE\langle M, w \rangle \in A_{\text{TM}} \iff f(\langle M, w \rangle) = \langle M' \rangle \in L_{\text{NE}}.
    > This means MM accepts w    L(M)w \iff L(M') \neq \emptyset.
    > Construct MM' from M,wM, w as follows:
    > MM' on input xx:
    > 1. Simulate MM on ww.
    > 2. If MM accepts ww, then MM' accepts xx.
    > 3. If MM rejects or loops on ww, then MM' loops on xx.
    >
    > If MM accepts ww: MM' accepts all inputs xx. So L(M)=ΣL(M') = \Sigma^* \neq \emptyset.
    > If MM does not accept ww (rejects or loops): MM' loops on all inputs xx. So L(M)=L(M') = \emptyset.
    >
    > Thus, M,wATM    L(M)    MLNE\langle M, w \rangle \in A_{\text{TM}} \iff L(M') \neq \emptyset \iff \langle M' \rangle \in L_{\text{NE}}.
    > This reduction works. So, ATMmLNEA_{\text{TM}} \le_m L_{\text{NE}} is true. (Option 3 is true).

    Step 3: Analyze LNEL_{\text{NE}}'s recursive enumerability.
    > A language is recursively enumerable if there exists a TM that accepts it (but may not halt on all inputs).
    > We can construct a TM NN that accepts LNEL_{\text{NE}}:
    > N(M)N(\langle M \rangle):
    > 1. For s=1,2,3,s = 1, 2, 3, \ldots (number of steps)
    > 2. For w=ϵ,0,1,00,01,w = \epsilon, 0, 1, 00, 01, \ldots (all possible input strings in lexicographic order)
    > 3. Simulate MM on ww for ss steps.
    > 4. If MM accepts ww within ss steps, then NN accepts M\langle M \rangle and halts.
    >
    > If L(M)L(M) \neq \emptyset, then there exists some string w0w_0 that MM accepts in some finite number of steps s0s_0. The TM NN will eventually reach the stage where it simulates MM on w0w_0 for s0s_0 steps, find that MM accepts, and then NN accepts M\langle M \rangle.
    > If L(M)=L(M) = \emptyset, then MM never accepts any string. NN will continue to simulate forever without accepting.
    > Therefore, NN accepts exactly LNEL_{\text{NE}}. So LNEL_{\text{NE}} is recursively enumerable. (Option 4 is true).

    Answer: LNEL_{\text{NE}} is undecidable.,ATMmLNEA_{\text{TM}} \le_m L_{\text{NE}}.,LNEL_{\text{NE}} is recursively enumerable."
    :::

    :::question type="MCQ" question="Given that LHALT={M,wM halts on w}L_{HALT} = \{ \langle M, w \rangle \mid M \text{ halts on } w \} is undecidable, consider a new language LFINITE={ML(M) is a finite language}L_{FINITE} = \{ \langle M \rangle \mid L(M) \text{ is a finite language} \}. Which of the following is true?" options=["LFINITEL_{FINITE} is decidable.","LFINITEL_{FINITE} is undecidable, and LHALTmLFINITEL_{HALT} \le_m L_{FINITE}.","LFINITEL_{FINITE} is undecidable, and ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE}.","LFINITEL_{FINITE} is undecidable, but not recursively enumerable."] answer="LFINITEL_{FINITE} is undecidable, and ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE}." hint="This is a classic application of Rice's Theorem. If you don't use Rice's Theorem, consider reducing ATMA_{\text{TM}} or ATMcA_{\text{TM}}^c (complement) to LFINITEL_{FINITE} or its complement." solution="Step 1: Analyze LFINITEL_{FINITE} using Rice's Theorem.
    > Rice's Theorem states that any non-trivial property of the language recognized by a Turing machine is undecidable. A property is trivial if it holds for all TMs or for no TMs. A property is non-trivial if it holds for some TMs and not for others.
    > The property 'L(M)L(M) is a finite language' is non-trivial:
    > - It holds for some TMs (e.g., a TM that accepts only 'a').
    > - It does not hold for other TMs (e.g., a TM that accepts Σ\Sigma^*).
    > Therefore, by Rice's Theorem, LFINITEL_{FINITE} is undecidable. This eliminates Option 1.

    Step 2: Consider recursive enumerability.
    > A language being undecidable does not automatically mean it's not recursively enumerable. Many undecidable languages (like ATMA_{\text{TM}}) are recursively enumerable. Option 4 (not recursively enumerable) is usually harder to prove and is often the case for complements of recursively enumerable but undecidable languages. LFINITEL_{FINITE} is not recursively enumerable. We can sketch why: if LFINITEL_{FINITE} were RE, we could enumerate TMs with finite languages. But this is impossible, as we can't tell if a TM will eventually accept an infinite number of strings or not. So Option 4 is likely true, but the prompt asks for a 'true' option among choices, and there's a more direct reduction.

    Step 3: Attempt a reduction to prove LFINITEL_{FINITE} is undecidable.
    > We need to reduce a known undecidable language to LFINITEL_{FINITE} or its complement. Let's try to reduce ATMA_{\text{TM}} to LFINITEL_{FINITE}.
    > We need ff such that M,wATM    f(M,w)=MLFINITE\langle M, w \rangle \in A_{\text{TM}} \iff f(\langle M, w \rangle) = \langle M' \rangle \in L_{FINITE}.
    > This means: MM accepts w    L(M)w \iff L(M') is finite.
    >
    > Construct MM' from M,w\langle M, w \rangle as follows:
    > MM' on input xx:
    > 1. Simulate MM on ww.
    > 2. If MM accepts ww: MM' accepts xx. (So L(M)=ΣL(M') = \Sigma^*, which is infinite).
    > 3. If MM rejects or loops on ww: MM' rejects xx. (So L(M)=L(M') = \emptyset, which is finite).
    >
    > This reduction gives: MM accepts w    L(M)w \iff L(M') is infinite.
    > This means M,wATM    MLFINITE\langle M, w \rangle \in A_{\text{TM}} \iff \langle M' \rangle \notin L_{FINITE}.
    > This proves ATMmLFINITEA_{\text{TM}} \le_m \overline{L_{FINITE}}. Since ATMA_{\text{TM}} is undecidable, LFINITE\overline{L_{FINITE}} is undecidable. And if LFINITE\overline{L_{FINITE}} is undecidable, then LFINITEL_{FINITE} is also undecidable.
    >
    > So, LFINITEL_{FINITE} is undecidable. Now we need to check if ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE} is true.
    > The reduction above shows ATMmLFINITEA_{\text{TM}} \le_m \overline{L_{FINITE}}.
    >
    > To show ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE} directly, we need MM accepts w    L(M)w \iff L(M') is finite.
    > Construct MM' from M,w\langle M, w \rangle as follows:
    > MM' on input xx:
    > 1. Simulate MM on ww.
    > 2. If MM accepts ww: MM' rejects xx. (So L(M)=L(M') = \emptyset, which is finite).
    > 3. If MM rejects or loops on ww: MM' accepts xx. (So L(M)=ΣL(M') = \Sigma^*, which is infinite).
    >
    > This reduction gives: MM accepts w    L(M)w \iff L(M') is finite. This is the correct reduction for ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE}.

    Step 4: Evaluate the options.
    > Option 1: LFINITEL_{FINITE} is decidable. False.
    > Option 2: LFINITEL_{FINITE} is undecidable, and LHALTmLFINITEL_{HALT} \le_m L_{FINITE}. While LFINITEL_{FINITE} is undecidable, it's generally easier to reduce ATMA_{\text{TM}} or ETME_{\text{TM}} (or their complements) to properties of languages. LHALTL_{HALT} is also undecidable, but ATMA_{\text{TM}} is more fundamental.
    > Option 3: LFINITEL_{FINITE} is undecidable, and ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE}. This aligns with our findings.
    > Option 4: LFINITEL_{FINITE} is undecidable, but not recursively enumerable. This is true, but Option 3 provides a more direct proof of undecidability via reduction. The question asks for 'true' statements, and Option 3 is demonstrably true. In multiple choice, we pick the most direct and accurate option.

    Answer: LFINITEL_{FINITE} is undecidable, and ATMmLFINITEA_{\text{TM}} \le_m L_{FINITE}."
    :::

    ---

    Summary

    Key Formulas & Takeaways

    | No. | Formula/Concept | Expression |
    |---|----------------|------------|
    | 1 | Decidable Language | A language LL is decidable if a TM decides it (halts on all inputs). |
    | 2 | Undecidable Language | A language LL is undecidable if no TM decides it. |
    | 3 | Acceptance Problem | ATM={M,wM accepts w}A_{\text{TM}} = \{ \langle M, w \rangle \mid M \text{ accepts } w \} (undecidable) |
    | 4 | Halting Problem | HALTTM={M,wM halts on w}HALT_{\text{TM}} = \{ \langle M, w \rangle \mid M \text{ halts on } w \} (undecidable) |
    | 5 | Many-One Reduction | AmB    computable f:wA    f(w)BA \le_m B \iff \exists \text{computable } f: w \in A \iff f(w) \in B |
    | 6 | Reducibility for Decidability | If AmBA \le_m B and BB is decidable, then AA is decidable. |
    | 7 | Reducibility for Undecidability | If AmBA \le_m B and AA is undecidable, then BB is undecidable. |
    | 8 | Polynomial-Time Reduction | ApB    polynomial-time computable f:wA    f(w)BA \le_p B \iff \exists \text{polynomial-time computable } f: w \in A \iff f(w) \in B |
    | 9 | P-Time Reduction Implication | If ApBA \le_p B and BPB \in P, then APA \in P. (Contrapositive: If APA \notin P, then BPB \notin P). |

    ---

    What's Next?

    💡 Continue Learning

    This topic connects to:

      • Complexity Theory: Understanding PP-time reductions is fundamental for classifying problems into complexity classes like PP, NPNP, NPNP-complete, and NPNP-hard.

      • Rice's Theorem: A powerful generalization that states all non-trivial semantic properties of Turing machines are undecidable. This provides a shortcut for many undecidability proofs.

      • Hierarchy Theorems: These theorems show that there are problems that can be solved with more resources (time/space) but not with less, building hierarchies of decidable languages.

    Chapter Summary

    Turing Machines and Decidability — Key Points

    Turing Machine (TM): A theoretical model of computation, consisting of a finite control, an infinite tape, and a read/write head. It is widely accepted as the most powerful general-purpose computational model.
    Church-Turing Thesis: This fundamental thesis posits that any function computable by an effective procedure (an algorithm) can be computed by a Turing machine. It establishes the TM as the definitive model for algorithmic computation.
    Computable/Recursive Functions: Functions for which a Turing machine exists that halts on all inputs in the function's domain. A language is decidable (recursive) if there is a TM that always halts and correctly accepts strings in the language and rejects strings not in it.
    Recursively Enumerable (RE) Languages: Languages for which a Turing machine exists that accepts all strings belonging to the language, but may loop indefinitely on strings not in the language. Every decidable language is RE, but not vice-versa.
    Undecidable Problems: Problems for which no Turing machine can be constructed that always halts and provides a correct 'yes' or 'no' answer for all possible inputs.
    The Halting Problem (ATMA_{TM}): The canonical example of an undecidable problem. It asks whether an arbitrary Turing machine MM will halt on a given input string ww. Its undecidability is proven using a diagonalization argument.
    * Reducibility: A crucial technique for proving the undecidability of new problems. If a known undecidable problem AA can be reduced to a new problem BB (meaning a solution to BB would imply a solution to AA), then BB must also be undecidable.

    Chapter Review Questions

    :::question type="MCQ" question="Which of the following statements regarding decidable and recursively enumerable languages is false?" options=["Every decidable language is recursively enumerable.","The complement of a decidable language is always decidable.","The set of all Turing machines is countable.","There exist recursively enumerable languages LL such that their complements Lˉ\bar{L} are also recursively enumerable, but LL is undecidable."] answer="There exist recursively enumerable languages LL such that their complements Lˉ\bar{L} are also recursively enumerable, but LL is undecidable." hint="Consider the fundamental relationship between recursive (decidable) languages and the class of recursively enumerable languages and their complements." solution="If a language LL and its complement Lˉ\bar{L} are both recursively enumerable, then LL must be decidable (recursive). This is a foundational result in computability theory. Therefore, the statement claiming LL can still be undecidable under these conditions is false."
    :::

    :::question type="NAT" question="Consider the following statements about a language LL:

  • LL is accepted by some Turing machine.

  • LL is decided by some Turing machine.

  • The complement of LL, Lˉ\bar{L}, is accepted by some Turing machine.

  • LL is recursive.

  • If LL is a decidable language, how many of these statements must be true?" answer="4" hint="Recall the precise definitions of decidable, recursive, and recursively enumerable languages, and their properties concerning complements." solution="If LL is a decidable language, it implies the following:
  • LL is accepted by some Turing machine: True. A decider for LL also accepts LL.

  • LL is decided by some Turing machine: True. This is the definition of a decidable language.

  • The complement of LL, Lˉ\bar{L}, is accepted by some Turing machine: True. If LL is decidable, then Lˉ\bar{L} is also decidable (by swapping the accept and reject states of the decider for LL). Since Lˉ\bar{L} is decidable, it is also accepted by a TM.

  • LL is recursive: True. 'Decidable' and 'recursive' are synonymous terms for languages.

  • Therefore, all 4 statements must be true."
    :::

    :::question type="MCQ" question="Which of the following problems is undecidable?" options=["Given a Turing machine MM and a string ww, does MM halt on ww?","Given a finite automaton FAFA and a string ww, does FAFA accept ww?","Given a context-free grammar GG, is L(G)L(G) empty?","Given a regular expression RR, is L(R)L(R) infinite?"] answer="Given a Turing machine MM and a string ww, does MM halt on ww?" hint="Distinguish between problems concerning Turing machines and those concerning less powerful models of computation like finite automata, context-free grammars, and regular expressions." solution="The problem 'Given a Turing machine MM and a string ww, does MM halt on ww?' is the classic Halting Problem, which is proven to be undecidable. The other options represent problems for simpler computational models (Finite Automata, Context-Free Grammars, Regular Expressions) which are all known to be decidable."
    :::

    :::question type="MCQ" question="What is the primary implication of the Church-Turing Thesis?" options=["All problems are decidable by a Turing machine.","Any algorithm can be implemented by a Turing machine.","Turing machines are the most efficient model of computation.","The Halting Problem is undecidable."] answer="Any algorithm can be implemented by a Turing machine." hint="The Church-Turing Thesis connects the intuitive notion of 'algorithm' with a formal computational model." solution="The Church-Turing Thesis posits that the class of functions computable by a Turing machine is exactly the class of functions that can be computed by any effective method (i.e., an algorithm). It establishes Turing machines as a universal model for computation, meaning any algorithm can be formalized and executed by a TM. It does not imply that all problems are decidable, nor does it make claims about computational efficiency."
    :::

    What's Next?

    💡 Continue Your CMI Journey

    With a solid understanding of Turing machines, the limits of computability, and the distinction between decidable and undecidable problems, your CMI preparation is perfectly poised to delve into Computational Complexity Theory. This subsequent area of study builds directly upon computability by investigating the resources (primarily time and space) required to solve computable problems. You will explore fundamental questions about efficiency, classify problems into complexity classes like P and NP, and confront the famous P vs. NP problem, deepening your appreciation for the practical implications of theoretical computation.

    🎯 Key Points to Remember

    • Master the core concepts in Turing Machines and Decidability before moving to advanced topics
    • Practice with previous year questions to understand exam patterns
    • Review short notes regularly for quick revision before exams

    Related Topics in Formal Languages and Automata Theory

    More Resources

    Why Choose MastersUp?

    🎯

    AI-Powered Plans

    Personalized study schedules based on your exam date and learning pace

    📚

    15,000+ Questions

    Verified questions with detailed solutions from past papers

    📊

    Smart Analytics

    Track your progress with subject-wise performance insights

    🔖

    Bookmark & Revise

    Save important questions for quick revision before exams

    Start Your Free Preparation →

    No credit card required • Free forever for basic features