Skip to main content

6.3 Decision Algorithms & Closure Property Theorems of Regular Languages

πŸ“šModule 01Topic 1.1⏱️14 min read
🎯High-Yield For:Semester Exams β€’ GATE CSE β€’ Technical Interviews

πŸ’‘ Core Intuition: The Omniscient Automaton Oracle​

In theoretical computer science, a class of formal languages is evaluated by two fundamental metrics: What questions can an algorithm answer about it? (Decidability) and What transformations can we apply without breaking out of the class? (Closure).

For general computing models like Turing Machines, Alan Turing proved in 1936 that almost all non-trivial behavioral questionsβ€”such as "Will this program ever halt?" or "Does this program accept any input?"β€”are fundamentally undecidable (unsolvable by any algorithm).

However, the world of Regular Languages is unique. Because a Finite Automaton has strictly bounded memory and zero unbounded auxiliary storage, its entire state space can be completely explored, traversed, inverted, and algebraically manipulated in finite time.

🍳 The Everyday Analogy: The Fully Mapped Mechanical Clock​

Imagine a mechanical clock with 12 distinct gear positions:

  • Can it ever reach position 6? You do not need to watch the clock run forever. You simply inspect the mechanical linkage to see if a path of meshed teeth leads from position 1 to position 6. If no mechanical path exists, it will never reach position 6. This is the Emptiness Problem.
  • Can it generate infinitely many different gear positions? Since there are only 12 physical teeth, it can only ever occupy at most 12 distinct states. This is the Finiteness Problem.
  • Do two different clock mechanisms tick through identical cycles? You can place both mechanisms side-by-side in a dual-cage housing and verify whether their dials point to the same numeral on every single tick. This is the Equivalence Problem.

Because the mechanical system has finite states, every question about its behavior is decidable.

πŸ’» Bridging to Computer Science​

In formal language theory, a decision property is a decision problem (a question with a definitive YES or NO answer) regarding an automaton or language for which an algorithm exists that terminates on every valid input:

Decision Algorithm:(Automaton M, Property P)⟢{YES,NO}\text{Decision Algorithm}: \quad (\text{Automaton } M, \text{ Property } P) \longrightarrow \{\mathbf{YES}, \mathbf{NO}\}

For Regular Languages, all standard decision questions are decidable:

  • Membership: Is string w∈L(M)w \in L(M)? (Decidable in O(∣w∣)O(|w|) time).
  • Emptiness: Is L(M)=βˆ…L(M) = \emptyset? (Decidable via graph reachability in O(∣V∣+∣E∣)O(|V| + |E|) time).
  • Finiteness: Is ∣L(M)∣<∞|L(M)| < \infty? (Decidable via cycle detection on paths from start to final states).
  • Equivalence: Is L(M1)=L(M2)L(M_1) = L(M_2)? (Decidable via product automaton or minimization).
  • Subset / Containment: Is L(M1)βŠ†L(M2)L(M_1) \subseteq L(M_2)? (Decidable via emptiness of L(M1)∩L(M2)β€ΎL(M_1) \cap \overline{L(M_2)}).
  • Disjointness: Is L(M1)∩L(M2)=βˆ…L(M_1) \cap L(M_2) = \emptyset? (Decidable via product automaton emptiness).

Furthermore, Regular Languages form a mathematically complete Boolean algebra: they are closed under union, intersection, complementation, difference, reversal, Kleene star, homomorphism, and quotient.



βš–οΈ Decision Algorithms for Regular Languages​

A decision algorithm is an effective, deterministic procedure that answers an existential or universal query about a formal language. For Regular Languages, every canonical decision problem is solvable because any regular language can be compiled into a unique, canonical Minimal DFA.

Decidability Contrast: Regular Languages vs General Computation

Why bounded memory makes regular languages an algorithmic paradise compared to Turing Machines

Regular Languages

Finite Automata (Type-3)

⚑
Dominant Architecture / DomainStrictly Bounded State Space
  • β€’All canonical decision problems (Emptiness, Finiteness, Equivalence, Subset) are DECIDABLE.
  • β€’State space is finite; state reachability maps directly to directed graph algorithms (BFS / DFS).
  • β€’Unique canonical minimal DFA exists for every regular language via Myhill-Nerode theorem.
  • β€’Total execution time is polynomial in the number of states.
"Zero unbounded memory guarantees that every behavioral question terminates in finite steps."
Turing Machines

Universal Computation (Type-0)

πŸ’»
Dominant Architecture / DomainUnbounded Tape Storage
  • β€’Almost all behavioral decision problems (Halting, Emptiness, Equivalence) are UNDECIDABLE.
  • β€’Infinite tape allows infinite configurations; loops cannot always be detected in advance.
  • β€’Rice's Theorem proves that ANY non-trivial semantic property of RE languages is undecidable.
  • β€’Algorithms may run forever without producing a YES or NO answer.
"Infinite storage opens the door to undecidability and the Turing Halting trap."

The Membership Problem (w ∈ L)​

Question: Given a regular language LL (represented by a DFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F)) and an input string wβˆˆΞ£βˆ—w \in \Sigma^*, does ww belong to LL?

Algorithm:

  1. If LL is represented as an NFA or Regular Expression, first convert it to a DFA.
  2. Initialize the current state to the initial state: q←q0q \leftarrow q_0.
  3. For each symbol aia_i in string w=a1a2β‹―amw = a_1 a_2 \cdots a_m:

q←δ(q,ai)q \leftarrow \delta(q, a_i)

  1. After reading the entire string ww, check if q∈Fq \in F.
  2. If q∈Fq \in F, output YES (w∈Lw \in L). Otherwise, output NO (wβˆ‰Lw \notin L).

Computational Complexity:

  • For a DFA, processing string ww takes exactly O(∣w∣)O(|w|) time and O(1)O(1) auxiliary space.
  • If starting from an NFA with kk states, on-the-fly subset simulation takes O(∣wβˆ£β‹…k2)O(|w| \cdot k^2) time without materializing the exponential DFA.

The Emptiness Problem (L = βˆ…)​

Question: Given a DFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F), is the language accepted by MM emptyβ€”i.e., does MM reject every possible string in Ξ£βˆ—\Sigma^*?

Algorithm: The language L(M)L(M) is non-empty if and only if at least one accepting state qf∈Fq_f \in F is reachable from the start state q0q_0.

  1. View the DFA transition table as a directed graph G=(V,E)G = (V, E), where vertices V=QV = Q and directed edges E={(p,q)βˆ£βˆƒa∈Σ,Ξ΄(p,a)=q}E = \{(p, q) \mid \exists a \in \Sigma, \delta(p, a) = q\}.
  2. Run Breadth-First Search (BFS) or Depth-First Search (DFS) starting from vertex q0q_0.
  3. Mark all vertices reachable from q0q_0 as the reachable set RβŠ†QR \subseteq Q.
  4. Compute the intersection R∩FR \cap F:
    • If R∩F=βˆ…R \cap F = \emptyset, output YES (L(M)L(M) is empty).
    • If R∩Fβ‰ βˆ…R \cap F \neq \emptyset, output NO (L(M)L(M) is non-empty, and the search path directly provides the shortest accepted string).

Computational Complexity:

  • Running BFS/DFS on graph GG with ∣Q∣|Q| vertices and ∣Qβˆ£β‹…βˆ£Ξ£βˆ£|Q| \cdot |\Sigma| edges takes O(∣Qβˆ£β‹…βˆ£Ξ£βˆ£)O(|Q| \cdot |\Sigma|) time, which is strictly linear in the size of the transition table.

The Finiteness & Infiniteness Problem​

Question: Given a DFA MM, is L(M)L(M) finite or infinite?

Algorithm 1: Directed Cycle Detection (Graph Theoretic) A regular language L(M)L(M) is infinite if and only if the transition graph contains a directed cycle that is both:

  1. Reachable from the initial state q0q_0, and
  2. Capable of reaching at least one final state qf∈Fq_f \in F.
q_0 ──(Path)──> [ State in Cycle β†Ί ] ──(Path)──> q_f ∈ F
  1. Eliminate all states that cannot reach any final state FF (eliminate dead / trap states via reverse BFS from FF).
  2. Eliminate all states unreachable from q0q_0.
  3. On the remaining subgraph of useful states, run a standard Cycle Detection algorithm (such as Tarjan's strongly connected components or DFS back-edge detection):
    • If a cycle exists among useful states, output INFINITE (L(M)L(M) is infinite).
    • If no cycle exists, output FINITE (L(M)L(M) is finite).

Algorithm 2: Pumping Lemma Length Window (Algebraic) Let n=∣Q∣n = |Q| be the number of states in DFA MM. By the Pumping Lemma:

  • L(M)L(M) is infinite if and only if MM accepts at least one string ww whose length satisfies:

nβ‰€βˆ£w∣<2nn \le |w| < 2n

  • Why? If a string has length β‰₯n\ge n, it must traverse at least n+1n+1 states, forcing a cycle by the Pigeonhole Principle. If no string exists in the window [n,2nβˆ’1][n, 2n-1], no pumpable cycle can connect to an accepting state.

Computational Complexity: Cycle detection takes O(∣Qβˆ£β‹…βˆ£Ξ£βˆ£)O(|Q| \cdot |\Sigma|) time.


πŸ›οΈ Advanced Relational Decision Problems​

Comparing two arbitrary programs for identical output is uncomputable in software engineering. But for regular languages, comparing two distinct automata is completely decidable via Product Automata and DFA Minimization.

The 4 Advanced Relational Decision Algorithms

Algorithmic procedures for testing equivalence, containment, totality, and disjointness

πŸ”„

Equivalence Problem

L(M₁) = L(Mβ‚‚)
  • Determines whether two independently designed DFAs accept the exact same language.
  • Method 1: Minimize both DFAs using table-filling; check graph isomorphism under state renaming.
  • Method 2: Construct symmetric difference automaton and test for emptiness.
🎯

Subset / Containment

L(M₁) βŠ† L(Mβ‚‚)
  • Verifies whether every valid string accepted by M₁ is also accepted by Mβ‚‚.
  • Fundamental to security policy checking and formal specification verification.
  • Reduced to emptiness of the set difference: L(M₁) - L(Mβ‚‚) = βˆ….
🌌

Totality / Universality

L(M) = Ξ£*
  • Determines whether an automaton accepts all possible input strings over Ξ£.
  • Invert accepting and non-accepting states of a complete DFA to construct complement Mᢜ.
  • Test whether the complemented automaton accepts the empty language.
🚫

Disjointness Problem

L(M₁) ∩ L(Mβ‚‚) = βˆ…
  • Verifies whether two automata have zero overlapping accepted strings.
  • Essential in protocol verification to guarantee mutually exclusive error states.
  • Construct cross-product intersection automaton and verify emptiness of its final states.

The Cross-Product Construction Pipeline​

To compute boolean combinations of two regular languages L1=L(M1)L_1 = L(M_1) and L2=L(M2)L_2 = L(M_2) over a common alphabet Ξ£\Sigma, we construct the Cross-Product DFA M12M_{12}:

Let M1=(Q1,Ξ£,Ξ΄1,q01,F1)M_1 = (Q_1, \Sigma, \delta_1, q_{01}, F_1) and M2=(Q2,Ξ£,Ξ΄2,q02,F2)M_2 = (Q_2, \Sigma, \delta_2, q_{02}, F_2). The product automaton is:

M12=(Q1Γ—Q2,Ξ£,Ξ΄12,(q01,q02),F12)M_{12} = (Q_1 \times Q_2, \Sigma, \delta_{12}, (q_{01}, q_{02}), F_{12})

Where the transition function operates synchronously on state pairs:

Ξ΄12((p,q),a)=(Ξ΄1(p,a),Ξ΄2(q,a))\delta_{12}((p, q), a) = (\delta_1(p, a), \delta_2(q, a))

By selectively choosing the composite final states F12F_{12}, we solve multiple decision problems on the single product machine:

Architecture Flow

The Product Automaton Decision Pipeline

How composite final state selection transforms the product graph into different decision engines

πŸ“₯Input DFAs

M₁ and Mβ‚‚ Specifications

Two complete DFAs with state sets Q₁ and Qβ‚‚.

β†’
Cartesian Product
βš™οΈSynchronous Graph

Composite State Machine

State space |Q₁| Γ— |Qβ‚‚| tracking parallel transitions on every input symbol.

β†’
Set Final States
🎯Target Property

Predicate Configuration

Intersection: F₁ Γ— Fβ‚‚ | Difference: F₁ Γ— (Qβ‚‚ - Fβ‚‚) | Symmetric Diff: (F₁ Γ— Fβ‚‚αΆœ) βˆͺ (Fβ‚αΆœ Γ— Fβ‚‚).

β†’
Graph Reachability
βœ…Decision Result

Emptiness Verification

BFS from (q₀₁, qβ‚€β‚‚) to target final states. Unreachable = YES.


πŸ›‘οΈ Algebraic Closure Properties of Regular Languages​

A family of languages L\mathcal{L} is said to be closed under an operation βŠ™\odot if applying βŠ™\odot to any language(s) in L\mathcal{L} always yields a language that also belongs to L\mathcal{L}:

βˆ€L1,L2∈LREG,(L1βŠ™L2)∈LREG\forall L_1, L_2 \in \mathcal{L}_{\text{REG}}, \quad (L_1 \odot L_2) \in \mathcal{L}_{\text{REG}}

Regular languages exhibit remarkable algebraic robustness. They are closed under almost all standard operations in formal language theory.

The Closure Hierarchy of Regular Languages

Hierarchical view of algebraic closure operations preserving finite state recognizability

Boolean Operations

Set Theoretic Closure

🧱

Union, Intersection, Complement, Set Difference, and Symmetric Difference.

L₁ βˆͺ Lβ‚‚ (Product DFA / NFA branch)L₁ ∩ Lβ‚‚ (Product DFA)Lᢜ = Ξ£* - L (State inversion)L₁ - Lβ‚‚ = L₁ ∩ Lβ‚‚αΆœ
↓String Concatenation & Kleene Operations
Regular Operators

Grammatical & Algebraic Closure

πŸ“œ

Concatenation, Kleene Star, Positive Closure, and Language Reversal.

L₁ Β· Lβ‚‚ (Epsilon bridge)L* (Epsilon loopback)L⁺ = L Β· L*Lα΄Ώ (Arrow reversal & state swap)
↓Symbolic Substitution & Morphisms
Morphological Operators

Homomorphic Transformations

πŸ”€

Standard Homomorphism, Inverse Homomorphism, and String Substitution.

h(L) (Replace symbols with strings)h⁻¹(L) (Pre-image under morphism)Finite Substitution
↓Boundary & Substring Extractions
Structural Operators

Truncation & Quotient Operations

βœ‚οΈ

Prefix, Suffix, Substring, Right Quotient, and Left Quotient.

Prefix(L) & Suffix(L)Sub(L) (Arbitrary infixes)L₁ / Lβ‚‚ (Right quotient with ANY Lβ‚‚)min(L) & max(L)

Boolean Operations: Union, Intersection, Complement​

Complement (L^c or LΜ„)​

Let LL be accepted by a complete DFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F). The complement Lβ€Ύ=Ξ£βˆ—βˆ’L\overline{L} = \Sigma^* - L is accepted by:

Mcomp=(Q,Ξ£,Ξ΄,q0,Qβˆ’F)M_{\text{comp}} = (Q, \Sigma, \delta, q_0, Q - F)

We simply invert the status of every state: all non-final states become final, and all final states become non-final. The transitions and state count remain identical.

Critical Requirement for Complement

Complement state inversion ONLY works on a complete DFA. If applied to an NFA or an incomplete DFA with missing transitions, the resulting automaton will NOT accept the complement! You must convert the machine to a complete DFA before swapping final states.

Union (L₁ βˆͺ Lβ‚‚) and Intersection (L₁ ∩ Lβ‚‚)​

  • Union: If R1R_1 and R2R_2 are regular expressions for L1L_1 and L2L_2, then (R1+R2)(R_1 + R_2) is a regular expression for L1βˆͺL2L_1 \cup L_2.
  • Intersection: By De Morgan's Laws:

L1∩L2=L1β€ΎβˆͺL2β€Ύβ€ΎL_1 \cap L_2 = \overline{\overline{L_1} \cup \overline{L_2}}

Since regular languages are closed under complement and union, they are automatically closed under intersection. Alternatively, the Cross-Product DFA accepts L1∩L2L_1 \cap L_2 by setting F12=F1Γ—F2F_{12} = F_1 \times F_2.

Set Difference (L_1 - L_2)​

Set difference is defined as all strings in L1L_1 that are not in L2L_2:

L1βˆ’L2=L1∩L2β€ΎL_1 - L_2 = L_1 \cap \overline{L_2}

Because regular languages are closed under complement and intersection, regular languages are strictly closed under set difference.


Concatenation, Kleene Star & Reversal​

Reversal (L^R)​

The reversal of a language LL is LR={wR∣w∈L}L^R = \{w^R \mid w \in L\}, where wRw^R is the string ww written backwards.

  • Construction:
    1. Start with an NFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F) accepting LL.
    2. Reverse the direction of every transition arrow in the transition graph: if Ξ΄(p,a)=q\delta(p, a) = q, then make Ξ΄β€²(q,a)=p\delta'(q, a) = p.
    3. Create a new initial state q0β€²q_0' and connect it with Ο΅\epsilon-transitions to all states in FF.
    4. Make the original initial state q0q_0 the single new final state Fβ€²={q0}F' = \{q_0\}.
    5. The resulting NFA accepts LRL^R. Hence, regular languages are closed under reversal.

Homomorphism & Inverse Homomorphism​

A homomorphism is a function h:Ξ£β†’Ξ“βˆ—h: \Sigma \to \Gamma^* that maps each symbol of an alphabet Ξ£\Sigma to a string over an alphabet Ξ“\Gamma. We extend hh to strings and languages:

h(a1a2β‹―ak)=h(a1)h(a2)β‹―h(ak),h(Ο΅)=Ο΅h(a_1 a_2 \cdots a_k) = h(a_1) h(a_2) \cdots h(a_k), \quad h(\epsilon) = \epsilon

h(L)={h(w)∣w∈L}h(L) = \{h(w) \mid w \in L\}

Closure Under Homomorphism​

If LL is regular, it has a regular expression EE. Replacing each terminal symbol aa in EE with the string h(a)h(a) yields a new regular expression h(E)h(E) that generates h(L)h(L). Since h(E)h(E) is a valid regular expression, h(L)h(L) is regular.

Inverse Homomorphism (h^-1(L))​

The inverse homomorphism is defined as:

hβˆ’1(L)={wβˆˆΞ£βˆ—βˆ£h(w)∈L}h^{-1}(L) = \{w \in \Sigma^* \mid h(w) \in L\}

Theorem: If LβŠ†Ξ“βˆ—L \subseteq \Gamma^* is regular, then hβˆ’1(L)βŠ†Ξ£βˆ—h^{-1}(L) \subseteq \Sigma^* is also regular.

Proof by Automaton Construction: Let M=(Q,Ξ“,Ξ΄,q0,F)M = (Q, \Gamma, \delta, q_0, F) be a DFA accepting LL. We construct a new DFA Mβ€²=(Q,Ξ£,Ξ΄β€²,q0,F)M' = (Q, \Sigma, \delta', q_0, F) for hβˆ’1(L)h^{-1}(L):

  • The state set QQ, start state q0q_0, and final states FF remain identical.
  • The new transition function Ξ΄β€²\delta' on symbol a∈Σa \in \Sigma is defined by simulating the original DFA on the string h(a)h(a):

Ξ΄β€²(q,a)=Ξ΄^(q,h(a))\delta'(q, a) = \hat{\delta}(q, h(a))

When Mβ€²M' reads symbol aa, it transitions to the exact state that MM would reach after consuming the entire string h(a)βˆˆΞ“βˆ—h(a) \in \Gamma^*. Since w∈hβˆ’1(L)β€…β€ŠβŸΊβ€…β€Šh(w)∈Lw \in h^{-1}(L) \iff h(w) \in L, Mβ€²M' accepts ww if and only if MM accepts h(w)h(w). Thus, Mβ€²M' is a valid finite automaton, proving closure under inverse homomorphism.


uotient Operations: Right & Left uotient​

The Right Quotient of language L1L_1 with respect to language L2L_2 (denoted L1/L2L_1 / L_2) is the set of all prefixes xx such that appending some string y∈L2y \in L_2 produces a valid string xy∈L1xy \in L_1:

L1/L2={xβˆˆΞ£βˆ—βˆ£βˆƒy∈L2Β suchΒ thatΒ xy∈L1}L_1 / L_2 = \{x \in \Sigma^* \mid \exists y \in L_2 \text{ such that } xy \in L_1\}

The Amazing Right Quotient Theorem

Why L₁ / Lβ‚‚ remains regular even when Lβ‚‚ is non-regular or completely undecidable

Standard Intuition

Typical Binary Operations

⚠️
Dominant Architecture / DomainRequires Both Inputs to Be Regular
  • β€’In operations like L₁ ∩ Lβ‚‚ or L₁ βˆͺ Lβ‚‚, if Lβ‚‚ is non-regular, the result may not be regular.
  • β€’Students assume that if Lβ‚‚ is context-free or undecidable, L₁ / Lβ‚‚ must also become non-regular.
"Non-regular inputs usually pollute the output language."
The Theorem

Right Quotient with ANY Language

✨
Dominant Architecture / DomainL₁ is Regular; Lβ‚‚ is ARBITRARY
  • β€’If L₁ is regular, L₁ / Lβ‚‚ is GUARANTEED to be regular for ANY language Lβ‚‚!
  • β€’Lβ‚‚ does not need to be regular; it can be context-free, context-sensitive, or undecidable.
  • β€’The DFA for L₁ / Lβ‚‚ uses the EXACT same states and transitions as M₁; only the final state set F' is modified.
"F' = {q ∈ Q₁ | βˆƒ y ∈ Lβ‚‚, Ξ΄Μ‚(q, y) ∈ F₁}. Since Q₁ is finite, F' is a finite subset of Q₁!"

Constructing the DFA for L_1 / L_2​

Let M1=(Q1,Ξ£,Ξ΄1,q0,F1)M_1 = (Q_1, \Sigma, \delta_1, q_0, F_1) be a DFA accepting L1L_1.

  1. Keep the states Q1Q_1, transitions Ξ΄1\delta_1, and start state q0q_0 unchanged.
  2. Define the new set of accepting states Fβ€²F':

Fβ€²={q∈Q1∣thereΒ existsΒ someΒ stringΒ y∈L2Β suchΒ thatΒ Ξ΄^1(q,y)∈F1}F' = \{q \in Q_1 \mid \text{there exists some string } y \in L_2 \text{ such that } \hat{\delta}_1(q, y) \in F_1\}

In other words, a state qq becomes accepting in Mβ€²M' if you can walk from qq to an original accepting state using some string from L2L_2. 3. Since Fβ€²F' is simply a subset of the existing finite state set Q1Q_1, the resulting machine Mβ€²=(Q1,Ξ£,Ξ΄1,q0,Fβ€²)M' = (Q_1, \Sigma, \delta_1, q_0, F') is a legitimate DFA with at most ∣Q1∣|Q_1| states! 4. Therefore, L1/L2L_1 / L_2 is always regular, regardless of the complexity of L2L_2.


🚫 Non-Closure Under Infinite Operations​

While regular languages are closed under finite unions and finite intersections, they are NOT closed under infinite union or infinite intersection.

The Infinite Union Counter-Example​

Let Ln={anbn}L_n = \{a^n b^n\} for each integer nβ‰₯1n \ge 1.

  • For each fixed nn, LnL_n consists of a single string (e.g., L1={ab}L_1 = \{ab\}, L2={aabb}L_2 = \{aabb\}).
  • Every finite set is regular. Thus, each individual LnL_n is a regular language.
  • Now consider the countable infinite union of all LnL_n:

L=⋃n=1∞Ln={anbn∣nβ‰₯1}L = \bigcup_{n=1}^{\infty} L_n = \{a^n b^n \mid n \ge 1\}

As proved via the Pumping Lemma, L={anbn∣nβ‰₯1}L = \{a^n b^n \mid n \ge 1\} is a classic Non-Regular (Context-Free) language!

  • In fact, every language over an alphabet Ξ£\Sigma is an infinite union of single-element languages:

L=⋃w∈L{w}L = \bigcup_{w \in L} \{w\}

If regular languages were closed under infinite union, every possible language (including undecidable languages like the Halting Problem) would be regularβ€”a mathematical impossibility.


πŸ“Š Master Decision & Closure Properties Matrix​

The following comprehensive matrix summarizes the decision algorithms and closure properties of Regular Languages.

Operation / PropertyStatus for Regular LanguagesAlgorithmic Mechanism / Proof FoundationTime Complexity
Membership (w∈Lw \in L)DECIDABLEDFA string simulation tracking active stateO(βˆ₯wβˆ₯)O(\|w\|)
Emptiness (L=βˆ…L = \emptyset)DECIDABLEGraph reachability (BFS/DFS) from q0q_0 to FFO(βˆ₯Qβˆ₯β‹…βˆ₯Ξ£βˆ₯)O(\|Q\| \cdot \|\Sigma\|)
Finiteness (LL is finite)DECIDABLECycle detection on reachable, non-dead statesO(βˆ₯Qβˆ₯β‹…βˆ₯Ξ£βˆ₯)O(\|Q\| \cdot \|\Sigma\|)
Equivalence (L1=L2L_1 = L_2)DECIDABLEEmptiness of symmetric difference / Minimized DFA isomorphismO(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Subset (L1βŠ†L2L_1 \subseteq L_2)DECIDABLEEmptiness test of L1∩L2β€Ύ=βˆ…L_1 \cap \overline{L_2} = \emptysetO(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Disjointness (L1∩L2=βˆ…L_1 \cap L_2 = \emptyset)DECIDABLEEmptiness test of product automaton with F=F1Γ—F2F = F_1 \times F_2O(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Totality (L=Ξ£βˆ—L = \Sigma^*)DECIDABLEEmptiness test of complemented DFA Mβ€Ύ\overline{M}O(βˆ₯Qβˆ₯β‹…βˆ₯Ξ£βˆ₯)O(\|Q\| \cdot \|\Sigma\|)
Union (L1βˆͺL2L_1 \cup L_2)CLOSEDNFA branching with Ο΅\epsilon-transitions / Product DFAO(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Intersection (L1∩L2L_1 \cap L_2)CLOSEDCross-Product DFA with F=F1Γ—F2F = F_1 \times F_2O(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Complement (Lβ€Ύ\overline{L})CLOSEDComplete DFA state inversion (Fnew=Qβˆ’FoldF_{\text{new}} = Q - F_{\text{old}})O(βˆ₯Qβˆ₯)O(\|Q\|)
Difference (L1βˆ’L2L_1 - L_2)CLOSEDL1∩L2β€ΎL_1 \cap \overline{L_2} via Product DFAO(βˆ₯Q1βˆ₯β‹…βˆ₯Q2βˆ₯)O(\|Q_1\| \cdot \|Q_2\|)
Reversal (LRL^R)CLOSEDArrow inversion on transition graph with new start stateO(βˆ₯Qβˆ₯β‹…βˆ₯Ξ£βˆ₯)O(\|Q\| \cdot \|\Sigma\|)
Concatenation (L1β‹…L2L_1 \cdot L_2)CLOSEDΟ΅\epsilon-transitions connecting F1F_1 to start state q02q_{02}O(βˆ₯Q1βˆ₯+βˆ₯Q2βˆ₯)O(\|Q_1\| + \|Q_2\|)
Kleene Star (Lβˆ—L^*)CLOSEDΟ΅\epsilon-loop from FF back to q0q_0 plus new start/final stateO(βˆ₯Qβˆ₯)O(\|Q\|)
Homomorphism (h(L)h(L))CLOSEDSymbol substitution in regular expressionSyntactic rewrite
Inverse Homomorphism (hβˆ’1(L)h^{-1}(L))CLOSEDSimulating string h(a)h(a) on original DFA transitionsO(βˆ₯Qβˆ₯β‹…βˆ₯Ξ£βˆ₯β‹…max⁑βˆ₯h(a)βˆ₯)O(\|Q\| \cdot \|\Sigma\| \cdot \max \|h(a)\|)
Right Quotient (L1/L2L_1 / L_2)CLOSEDModifying final states Fβ€²F' in M1M_1 (Holds for ANY L2L_2)Finite state subset
Infinite Union / IntersectionNOT CLOSEDProduces non-regular languages (e.g. ⋃{anbn}\bigcup \{a^n b^n\})N/A

🏭 Real-World Production Context: Static Analysis & Schema Validation​

In production software engineering, the decidability and closure guarantees of regular languages power mission-critical static analysis engines, firewall rule reconcilers, and database schema checkers.

Architecture Flow

Production Pipeline: Cloud IAM Access Policy Reconciler

How AWS IAM and Google Cloud IAM verify policy equivalence and privilege escalation via regular language decision algorithms

πŸ“œPolicy Extraction

IAM Policy Statements

Extract Resource ARNs and Action regexes (e.g. s3:Get* vs s3:GetObject).

β†’
Regex Compilation
βš™οΈDFA Construction

Minimal Permission DFAs

Compile Action and Resource string patterns into canonical minimal DFAs.

β†’
Product Difference
πŸ›‘οΈContainment Check

L(New) βŠ† L(Baseline)

Compute L_leak = L(New_Policy) ∩ L(Baseline_Policy)ᢜ to test privilege escalation.

β†’
Emptiness Verification
πŸš€Release Pipeline

Automated PR Approval

If L_leak is empty, zero extra permissions were leaked. PR passes automated security checks.

Production Applications of Decision & Closure​

  1. Cloud Security Policy Equivalence (Z3 & Zelkova): Amazon Web Services developed Zelkova, an automated formal verification engine that uses decision algorithms on regular languages to check if an S3 bucket policy allows public access. Zelkova converts IAM policy wildcard patterns into finite automata. Checking whether an IAM policy is a subset of safe permissions (LpolicyβŠ†LsafeL_{\text{policy}} \subseteq L_{\text{safe}}) is solved by constructing Lpolicy∩Lsafeβ€ΎL_{\text{policy}} \cap \overline{L_{\text{safe}}} and verifying emptiness in milliseconds.
  2. Firewall Rule Deduplication & Conflict Detection: Enterprise firewalls (e.g., Palo Alto Networks, Cisco ASA) store thousands of packet filtering rules with IP subnet wildcards and port ranges. A new rule is redundant if its matched traffic language is a subset of existing rules (LnewβŠ†LexistingL_{\text{new}} \subseteq L_{\text{existing}}). If Lnew∩Lexistingβ‰ βˆ…L_{\text{new}} \cap L_{\text{existing}} \neq \emptyset, the rules overlap.
  3. XML & JSON Schema Subtyping: XML Schema Definition (XSD) and JSON Schema validate document structural grammar using regular expressions. Verifying that a newer schema version is backward-compatible with an older version requires testing that L(Schemav1)βŠ†L(Schemav2)L(\text{Schema}_{\text{v1}}) \subseteq L(\text{Schema}_{\text{v2}}). Because regular expressions are closed under containment and equivalence, schema compatibility can be verified statically at compile time.

πŸ“ Numerical Applications & Worked Examples​

Problem 1: Emptiness & Shortest String Detection via BFS​

Problem Statement:
Consider the DFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F) over Ξ£={0,1}\Sigma = \{0, 1\} defined by:

  • Q={q0,q1,q2,q3}Q = \{q_0, q_1, q_2, q_3\}
  • Initial state: q0q_0
  • Final state set: F={q3}F = \{q_3\}
  • Transition table:
StateInput 0Input 1
β†’q0\to q_0q1q_1q2q_2
q1q_1q1q_1q2q_2
q2q_2q1q_1q2q_2
βˆ—q3*q_3q3q_3q3q_3

Determine algorithmically whether L(M)L(M) is empty. If non-empty, provide the shortest accepted string.

Step-by-Step Solution:

Step 1: Initialize the Graph Reachability ueue​

We execute Breadth-First Search (BFS) starting from q0q_0.

  • Queue: [q0][q_0]
  • Visited set: {q0}\{q_0\}

Step 2: Explore Level 1 Transitions​

  • Dequeue q0q_0:
    • On input 0: Ξ΄(q0,0)=q1\delta(q_0, 0) = q_1. q1βˆ‰Visitedq_1 \notin \text{Visited}. Add q1q_1 to queue, set path (q0β†’0q1)(q_0 \xrightarrow{0} q_1).
    • On input 1: Ξ΄(q0,1)=q2\delta(q_0, 1) = q_2. q2βˆ‰Visitedq_2 \notin \text{Visited}. Add q2q_2 to queue, set path (q0β†’1q2)(q_0 \xrightarrow{1} q_2).
  • Queue: [q1,q2][q_1, q_2]
  • Visited set: {q0,q1,q2}\{q_0, q_1, q_2\}

Step 3: Explore Level 2 Transitions​

  • Dequeue q1q_1:
    • On 0: Ξ΄(q1,0)=q1\delta(q_1, 0) = q_1 (already visited).
    • On 1: Ξ΄(q1,1)=q2\delta(q_1, 1) = q_2 (already visited).
  • Dequeue q2q_2:
    • On 0: Ξ΄(q2,0)=q1\delta(q_2, 0) = q_1 (already visited).
    • On 1: Ξ΄(q2,1)=q2\delta(q_2, 1) = q_2 (already visited).
  • Queue is now empty: [][].

Step 4: Evaluate Reachability of Final States​

  • Reachable set R={q0,q1,q2}R = \{q_0, q_1, q_2\}.
  • Final state set F={q3}F = \{q_3\}.
  • Compute intersection:

R∩F={q0,q1,q2}∩{q3}=βˆ…R \cap F = \{q_0, q_1, q_2\} \cap \{q_3\} = \emptyset

Because no final state is reachable from q0q_0, the decision algorithm outputs YES, L(M)=βˆ…L(M) = \emptyset (The language is empty).


Problem 2: Finiteness Test via Directed Cycle Analysis​

Problem Statement:
A DFA M=(Q,Ξ£,Ξ΄,q0,F)M = (Q, \Sigma, \delta, q_0, F) over Ξ£={a,b}\Sigma = \{a, b\} has states Q={A,B,C,D}Q = \{A, B, C, D\}, initial state AA, final state DD, and the following transitions:

  • Ξ΄(A,a)=B,Ξ΄(A,b)=C\delta(A, a) = B, \quad \delta(A, b) = C
  • Ξ΄(B,a)=B,Ξ΄(B,b)=D\delta(B, a) = B, \quad \delta(B, b) = D
  • Ξ΄(C,a)=C,Ξ΄(C,b)=C\delta(C, a) = C, \quad \delta(C, b) = C
  • Ξ΄(D,a)=D,Ξ΄(D,b)=D\delta(D, a) = D, \quad \delta(D, b) = D

Determine whether the language L(M)L(M) is finite or infinite.

Step-by-Step Solution:

Step 1: Reachability from Start State A​

  • From AA:
    • Aβ†’aBβ†’bDA \xrightarrow{a} B \xrightarrow{b} D
    • Aβ†’bCA \xrightarrow{b} C
  • All states {A,B,C,D}\{A, B, C, D\} are reachable from AA.

Step 2: Ability to Reach Final State D (Live State Analysis)​

We run reverse reachability from DD:

  • D∈FD \in F reaches DD (path of length 0).
  • Can CC reach DD?
    • From CC, transitions on both aa and bb loop back to CC: Ξ΄(C,a)=C,Ξ΄(C,b)=C\delta(C, a) = C, \delta(C, b) = C.
    • State CC has no path to DD. Thus, CC is a dead / trap state.
  • Can BB reach DD?
    • Yes, Ξ΄(B,b)=D\delta(B, b) = D.
  • Can AA reach DD?
    • Yes, Aβ†’aBβ†’bDA \xrightarrow{a} B \xrightarrow{b} D.
  • Useful / live states: {A,B,D}\{A, B, D\}.

Step 3: Identify Cycles in the Useful Subgraph​

We inspect the subgraph induced by useful states {A,B,D}\{A, B, D\}:

  1. At state BB: there is a self-loop on input aa: Ξ΄(B,a)=B\delta(B, a) = B.
    • Path from start: Aβ†’aBA \xrightarrow{a} B.
    • Cycle: Bβ†’aBB \xrightarrow{a} B.
    • Path to final state: Bβ†’bDB \xrightarrow{b} D.
  2. At state DD: there are self-loops on inputs aa and bb: Ξ΄(D,a)=D,Ξ΄(D,b)=D\delta(D, a) = D, \delta(D, b) = D.
    • Since DD is already a final state, any cycle on DD is pumpable.

Step 4: Conclusion​

Because there exists a directed cycle (Bβ†’aBB \xrightarrow{a} B) that is both reachable from initial state AA and can reach final state DD, strings of the form aβ‹…akβ‹…b=ak+1ba \cdot a^k \cdot b = a^{k+1} b are accepted for all kβ‰₯0k \ge 0.

Therefore, the decision algorithm outputs L(M)L(M) is INFINITE.


Problem 3: Proving Regularity via Algebraic Closure Properties​

Problem Statement:
Let LL be a known regular language over Ξ£={0,1}\Sigma = \{0, 1\}. Prove whether the following derived language LaltL_{\text{alt}} is regular:

Lalt={w∈{0,1}βˆ—βˆ£theΒ stringΒ obtainedΒ byΒ removingΒ everyΒ secondΒ symbolΒ ofΒ wΒ belongsΒ toΒ L}L_{\text{alt}} = \{w \in \{0, 1\}^* \mid \text{the string obtained by removing every second symbol of } w \text{ belongs to } L\}

Formally, if w=a1a2a3a4β‹―a2kw = a_1 a_2 a_3 a_4 \cdots a_{2k}, then drop_even(w)=a1a3β‹―a2kβˆ’1∈L\text{drop\_even}(w) = a_1 a_3 \cdots a_{2k-1} \in L.

Step-by-Step Solution:

Step 1: Define an Expanded Alphabet​

To track odd and even positions separately using homomorphisms, we create a marked alphabet:

Ξ“={0odd,1odd,0even,1even}\Gamma = \{0_{\text{odd}}, 1_{\text{odd}}, 0_{\text{even}}, 1_{\text{even}}\}

Step 2: Define the Filtering Regular Language Over Γ​

Valid strings over Ξ“\Gamma must strictly alternate between odd-positioned symbols and even-positioned symbols:

Lvalid=((0odd+1odd)(0even+1even))βˆ—β‹…(Ο΅+0odd+1odd)L_{\text{valid}} = \left( (0_{\text{odd}} + 1_{\text{odd}}) (0_{\text{even}} + 1_{\text{even}}) \right)^* \cdot (\epsilon + 0_{\text{odd}} + 1_{\text{odd}})

Since LvalidL_{\text{valid}} is defined by a regular expression, it is a regular language.

Step 3: Define Homomorphism h₁ from Ξ“ to 1 (Extraction)​

Define homomorphism h1:Ξ“βˆ—β†’{0,1}βˆ—h_1: \Gamma^* \to \{0, 1\}^* by:

  • h1(0odd)=0h_1(0_{\text{odd}}) = 0
  • h1(1odd)=1h_1(1_{\text{odd}}) = 1
  • h1(0even)=Ο΅h_1(0_{\text{even}}) = \epsilon
  • h1(1even)=Ο΅h_1(1_{\text{even}}) = \epsilon

Notice what the inverse homomorphism h1βˆ’1(L)h_1^{-1}(L) does:

  • h1βˆ’1(L)h_1^{-1}(L) takes all strings over Ξ“\Gamma where the sequence of odd symbols forms a string in LL (regardless of what even symbols appear).
  • Since LL is regular, by closure under inverse homomorphism, h1βˆ’1(L)h_1^{-1}(L) is regular.

Step 4: Intersect with the Structural Constraint​

Now we restrict these strings so they strictly alternate between odd and even positions:

Lmarked=h1βˆ’1(L)∩LvalidL_{\text{marked}} = h_1^{-1}(L) \cap L_{\text{valid}}

Because regular languages are closed under intersection, LmarkedL_{\text{marked}} is regular.

Step 5: Define Homomorphism hβ‚‚ from Ξ“ to 1 (Symbol Restoration)​

Define homomorphism h2:Ξ“βˆ—β†’{0,1}βˆ—h_2: \Gamma^* \to \{0, 1\}^* by stripping the position subscripts:

  • h2(0odd)=0,h2(0even)=0h_2(0_{\text{odd}}) = 0, \quad h_2(0_{\text{even}}) = 0
  • h2(1odd)=1,h2(1even)=1h_2(1_{\text{odd}}) = 1, \quad h_2(1_{\text{even}}) = 1

Applying h2h_2 to LmarkedL_{\text{marked}} restores the original strings w∈{0,1}βˆ—w \in \{0, 1\}^*:

Lalt=h2(Lmarked)=h2(h1βˆ’1(L)∩Lvalid)L_{\text{alt}} = h_2(L_{\text{marked}}) = h_2\left( h_1^{-1}(L) \cap L_{\text{valid}} \right)

Step 6: Conclusion​

Since regular languages are closed under:

  1. Inverse homomorphism (h1βˆ’1h_1^{-1})
  2. Intersection (∩\cap)
  3. Standard homomorphism (h2h_2)

The resulting language LaltL_{\text{alt}} is expressed purely as a finite composition of closure-preserving operations on regular languages.

Therefore, LaltL_{\text{alt}} is REGULAR.


Problem 4: Cross-Product Construction for Set Difference​

Problem Statement:
Let L1L_1 be the language of strings over {a,b}\{a, b\} containing an odd number of aa's.
Let L2L_2 be the language of strings over {a,b}\{a, b\} ending with bb.
Construct the minimal cross-product state machine to compute Ldiff=L1βˆ’L2L_{\text{diff}} = L_1 - L_2.

Step-by-Step Solution:

Step 1: Formalize DFA M₁ for L₁ (Odd a's)​

  • States: Q1={E,O}Q_1 = \{E, O\} (Even aa's, Odd aa's)
  • Start state: EE
  • Final state: F1={O}F_1 = \{O\}
  • Transitions:
    • Ξ΄1(E,a)=O,Ξ΄1(E,b)=E\delta_1(E, a) = O, \quad \delta_1(E, b) = E
    • Ξ΄1(O,a)=E,Ξ΄1(O,b)=O\delta_1(O, a) = E, \quad \delta_1(O, b) = O

Step 2: Formalize DFA Mβ‚‚ for Lβ‚‚ (Ends with b)​

  • States: Q2={S0,Sb}Q_2 = \{S_0, S_b\}
  • Start state: S0S_0
  • Final state: F2={Sb}F_2 = \{S_b\}
  • Transitions:
    • Ξ΄2(S0,a)=S0,Ξ΄2(S0,b)=Sb\delta_2(S_0, a) = S_0, \quad \delta_2(S_0, b) = S_b
    • Ξ΄2(Sb,a)=S0,Ξ΄2(Sb,b)=Sb\delta_2(S_b, a) = S_0, \quad \delta_2(S_b, b) = S_b

Step 3: Construct the Product State Set ₁ Γ— ₂​

The product state pairs are:

Q12={(E,S0),(E,Sb),(O,S0),(O,Sb)}Q_{12} = \{(E, S_0), (E, S_b), (O, S_0), (O, S_b)\}

  • Initial state: (E,S0)(E, S_0)
  • Final state criteria for set difference L1βˆ’L2=L1∩L2β€ΎL_1 - L_2 = L_1 \cap \overline{L_2}:
    • Must be accepting in M1M_1: First component ∈F1={O}\in F_1 = \{O\}.
    • Must be non-accepting in M2M_2: Second component ∈(Q2βˆ’F2)={S0}\in (Q_2 - F_2) = \{S_0\}.
    • Therefore:

F12=F1Γ—(Q2βˆ’F2)={O}Γ—{S0}={(O,S0)}F_{12} = F_1 \times (Q_2 - F_2) = \{O\} \times \{S_0\} = \{(O, S_0)\}

Step 4: Compute Synchronous Transitions​

Product State (p,q)(p, q)Input aa: (Ξ΄1(p,a),Ξ΄2(q,a))(\delta_1(p, a), \delta_2(q, a))Input bb: (Ξ΄1(p,b),Ξ΄2(q,b))(\delta_1(p, b), \delta_2(q, b))Is Accepting?
β†’(E,S0)\to (E, S_0)(O,S0)(O, S_0)(E,Sb)(E, S_b)No
(E,Sb)(E, S_b)(O,S0)(O, S_0)(E,Sb)(E, S_b)No
βˆ—(O,S0)*(O, S_0)(E,S0)(E, S_0)(O,Sb)(O, S_b)YES
(O,Sb)(O, S_b)(E,S0)(E, S_0)(O,Sb)(O, S_b)No

Step 5: Verification​

  • String "a": β†’(E,S0)β†’a(O,S0)\to (E, S_0) \xrightarrow{a} (O, S_0) (Accepting).
    Check: Has odd number of aa's (1) and does not end in bb. Correct!
  • String "ab": β†’(E,S0)β†’a(O,S0)β†’b(O,Sb)\to (E, S_0) \xrightarrow{a} (O, S_0) \xrightarrow{b} (O, S_b) (Rejected).
    Check: Ends with bb, so belongs to L2L_2. Correctly excluded from L1βˆ’L2L_1 - L_2!

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  • Why does testing equivalence of two regular languages require checking L1∩L2β€Ύ=βˆ…L_1 \cap \overline{L_2} = \emptyset and L1β€Ύβˆ©L2=βˆ…\overline{L_1} \cap L_2 = \emptyset?
    Checking only L1∩L2β€Ύ=βˆ…L_1 \cap \overline{L_2} = \emptyset merely proves that L1βŠ†L2L_1 \subseteq L_2. It does not guarantee that L2βŠ†L1L_2 \subseteq L_1 (e.g., {a}βŠ†{a,b}\{a\} \subseteq \{a, b\}, but they are not equivalent). To prove full equality L1=L2L_1 = L_2, both symmetric containment conditions must hold simultaneously, which is equivalent to testing that the symmetric difference (L1βˆ’L2)βˆͺ(L2βˆ’L1)(L_1 - L_2) \cup (L_2 - L_1) is empty.
  • Is the complement of an NFA formed by swapping its accepting and non-accepting states?
    Absolutely NOT! In an NFA, an input string is accepted if at least one computational path terminates in an accepting state. Inverting the final states does not prevent another path on the same string from reaching an original non-final state that is now final. To complement an NFA, you MUST first convert it into a complete DFA using subset construction, and then swap final and non-final states.
  • If L1β‹…L2L_1 \cdot L_2 is regular, does it imply that both L1L_1 and L2L_2 are regular?
    No! Closure is a one-way implication: RegularΓ—Regularβ€…β€ŠβŸΉβ€…β€ŠRegular\text{Regular} \times \text{Regular} \implies \text{Regular}. The converse does not hold. For example, let L1={anbn∣nβ‰₯1}L_1 = \{a^n b^n \mid n \ge 1\} (non-regular) and L2=βˆ…L_2 = \emptyset (regular). Their concatenation is L1β‹…βˆ…=βˆ…L_1 \cdot \emptyset = \emptyset, which is regular! Similarly, if L1={anbn∣nβ‰₯1}L_1 = \{a^n b^n \mid n \ge 1\} and L2=(a+b)βˆ—L_2 = (a+b)^*, then L1β‹…L2L_1 \cdot L_2 may equal a regular language.
Common Interview Traps
  • Trap: Forgetting Complete DFA Status Before Complementation:
    When finding Lβ€Ύ\overline{L}, if a DFA has missing transitions (i.e. dead transitions are implicitly omitted), swapping final and non-final states will miss strings that should transition to the dead state. You must explicitly add the dead state with self-loops on all alphabet symbols before inverting final states.
  • Trap: Assuming Regular Languages are Closed Under Infinite Union:
    Finite union preserves regularity; infinite union does NOT. Every language is an infinite union of its individual string singletons: L=⋃w∈L{w}L = \bigcup_{w \in L} \{w\}. Since singletons are regular, infinite union closure would falsely imply that all languages are regular.
  • Trap: Believing Right Quotient L1/L2L_1 / L_2 Requires L2L_2 to be Regular:
    As proven above, L1/L2L_1 / L_2 is strictly regular for ANY arbitrary language L2L_2 (even if L2L_2 is context-free or undecidable), as long as L1L_1 is regular. This is one of the most common trick questions in technical interviews.

πŸ’¬

Discussion & Doubts