Regular languages

Left quotients of regular expressions

Finite partial derivatives turn the quotienting expression into a relation on residuals. The reachable residuals form an ordinary regular expression for the left quotient.

The quotient problem

For languages K,L⊆Σ∗K,L\subseteq\Sigma^*, their left quotient is

K−1L={v∈Σ∗:some u∈K satisfies uv∈L}.K^{-1}L=\{v\in\Sigma^*:\text{some }u\in K\text{ satisfies }uv\in L\}.

Given regular expressions AA and BB, the goal is to construct another regular expression whose language is L(A)−1L(B)L(A)^{-1}L(B).

FPRD-RE-D01 · finite construction

The partial-derivative carrier

Let QBQ_B be the finite set of Antimirov partial derivatives reachable from BB, including BB itself. For a letter cc, put an edge from PP to QQ when Q∈∂c(P)Q\in\partial_c(P).

Antimirov's partial-derivative theorem makes this carrier finite, even though it represents the effect of arbitrarily long words.

FPRD-RE-L01 · lemma

Interpret the first expression as a relation

Define a relation ⟦A⟧B⊆QB×QB\llbracket A\rrbracket_B\subseteq Q_B\times Q_B by following the syntax of AA:

  • 00 is the empty relation.
  • 11 is the identity relation.
  • A letter is its partial-derivative edge relation.
  • Union is relational union.
  • Concatenation is relational composition.
  • Star is reflexive-transitive closure.

Lemma. (P,Q)∈⟦A⟧B(P,Q)\in\llbracket A\rrbracket_B exactly when there is a word u∈L(A)u\in L(A) with Q∈∂u(P)Q\in\partial_u(P).

Proof. Structural induction handles the empty, identity, letter, union, and concatenation cases directly. Star corresponds to concatenating finitely many words from L(A)L(A). Because the carrier has NN states, every reachable pair has a simple witnessing state path of length at most N−1N-1; repeated cycles may be deleted. ∎

FPRD-RE-T01 · theorem

The quotient expression

Let R(A,B)R(A,B) be the states Q∈QBQ\in Q_B for which (B,Q)∈⟦A⟧B(B,Q)\in\llbracket A\rrbracket_B, and define the ordinary regular expression

f(A,B)=∑Q∈R(A,B)Q.f(A,B)=\sum_{Q\in R(A,B)}Q.

Theorem. L(f(A,B))=L(A)−1L(B)L(f(A,B))=L(A)^{-1}L(B).

Proof. A word vv belongs to the displayed union exactly when it belongs to some residual QQ reached from BB by a word u∈L(A)u\in L(A). By the partial-derivative membership theorem, this holds exactly when uv∈L(B)uv\in L(B). This is the definition of the left quotient. ∎

The structural proof establishes the theorem. The finite audit below checks the implemented construction against a separately implemented product-automaton oracle.

FPRD-RE-D02 · formulation attempt

An informal carrier-free discipline

One proposed strengthening of “purely inductive” calls a quotient compiler carrier-free constructor-only when its clauses recurse on the regular-expression constructors and return ordinary regular expressions, but do not enumerate a residual carrier, saturate a finite relation, or add an explicit least-fixed-point constructor.

This is an FPRD presentation discipline, not a restriction stated by the problem author. It is also not yet a formal compiler model. Phrases such as “enumerate a carrier” can be hidden inside another data representation unless the admissible recursion schemes, auxiliary values, equality tests, and cost model are specified. Consequently, the discipline can classify named proposals, but it cannot yet support a theorem quantifying over every admissible compiler.

FPRD-RE-T02 · exact structural theorem

The star clause is a least fixed point

Write Q(K,L)=K−1LQ(K,L)=K^{-1}L. The non-star constructors satisfy

Q(0,L)=∅,Q(1,L)=L, Q(0,L)=\varnothing,\qquad Q(1,L)=L, Q(K∪H,L)=Q(K,L)∪Q(H,L),Q(KH,L)=Q(H,Q(K,L)). Q(K\cup H,L)=Q(K,L)\cup Q(H,L),\qquad Q(KH,L)=Q(H,Q(K,L)).

For star, define the monotone language transformer

ΦK,L(X)=L∪Q(K,X). \Phi_{K,L}(X)=L\cup Q(K,X).

Theorem. Q(K∗,L)Q(K^*,L) is the least fixed point of ΦK,L\Phi_{K,L}, and

Q(K∗,L)=⋃n≥0Q(Kn,L). Q(K^*,L)=\bigcup_{n\ge 0}Q(K^n,L).

Proof. Starting from the empty language, the successive approximants areLL,L∪K−1LL\cup K^{-1}L, and in general ⋃i=0n(Ki)−1L\bigcup_{i=0}^{n} (K^i)^{-1}L. Their union is (K∗)−1L(K^*)^{-1}L. Every pre-fixed point contains each approximant, proving leastness. ∎

On the finite derivative carrier of the target expression, this language fixed point becomes ordinary reachability saturation and stabilizes after at most ∣QB∣|Q_B| rounds. Thus the carrier in the proved construction is not an unrelated detour: it is a finite presentation of the star orbit.

FPRD-RE-X01 · negative theorem

No fixed number of star unfoldings is enough

The fixed point cannot be replaced by a uniform finite number of unfoldings. For any k≥0k\ge 0, take K={a}K=\{a\} andL={ak+1}L=\{a^{k+1}\}. After quotient depth kk, the shortest residual still contains one aa, so the empty word is absent. The next step adds it, becauseak+1∈K∗a^{k+1}\in K^*.

ε∈(a∗)−1{ak+1},ε∉⋃i=0k{ai}−1{ak+1}. \varepsilon\in (a^*)^{-1}\{a^{k+1}\}, \qquad \varepsilon\notin\bigcup_{i=0}^{k}\{a^i\}^{-1}\{a^{k+1}\}.

This rules out every uniformly bounded-unfolding star clause. It does not rule out a different algebraic compression. A broader lower-bound question must wait until the compiler class is formally defined.

FPRD-RE-C01 · reproducible finite audit

Three automata formulations agree

A new checker uses 27 quotienting expressions, 15 target expressions, and all 31 binary suffixes of length at most four. It therefore compares

27⋅15⋅31=12,555 27\cdot 15\cdot 31=12{,}555

membership decisions. The construction interprets the first expression as a finite relation on derivatives of the second. The first oracle instead explores the synchronized derivative product and asks whether some reachable prefix state accepts the quotienting expression while the target state accepts the tested suffix. The two procedures produced zero mismatches.

Agreement alone can be vacuous if the corpus cannot detect likely faults. Four construction-side mutations therefore reverse concatenation order, truncate star closure after one step, reverse letter edges, or forget the distinguished start residual. The same corpus rejects all four, producing respectively 130, 2, 366, and 132 mismatches. The certificate preserves the first witness for each injected fault.

A second checker removes the first audit's largest common-mode dependency. It independently parses the fixed infix corpus, uses Antimirov partial derivatives on an unsimplified binary syntax tree for the construction, and compares that result with Thompson epsilon-NFAs and subset-product reachability. It does not share normalization, nullability, derivative code, or acceptance logic with the first checker. It also produced zero mismatches, and its complete semantic transcript has exactly the same digest.

The review audit keeps the Antimirov construction but replaces the oracle with epsilon-free Glushkov position automata. It again agrees on all 12,55512{,}555 decisions and reproduces the same transcript digest. Separately, it checks the hostile unary family for every0≤k≤640\le k\le64. This third check shares a parser and corpus with its construction side, so it is a cross-formulation audit rather than a fully independent experiment.

This is a replacement audit, not a reconstruction of the earlier unavailable checker. The matching comparison total does not imply that the two checks used the same expression corpus. Finite evidence also does not replace the all-expression proof. These four negative controls test named proof obligations, not every possible bug. The second audit still shares the fixed expression strings, alphabet, and case ordering with the first.

Checker · Certificate · Independent checker · Independent certificate · Review checker · Review certificate · Review method · Method note

FPRD-RE-B01 · formalization boundary

The remaining task is to define the compiler class

The bounded-unfolding family proves that simple truncation cannot work, while the derivative construction proves that finite residual saturation can. It is tempting to ask whether saturation can always be eliminated, but the current exclusion-based discipline does not determine which encodings or auxiliary computations count as an elimination. The next obligation is therefore a grammar or machine model for admissible compilers. Only then is there a well-posed existence or impossibility question.

Sources

Problem source. Left quotient operator on regular expressions, contributed by Ekaterina Zhuchko to Automata Exchange on July 1, 2025.

  • Valentin M. Antimirov, “Partial derivatives of regular expressions and finite automaton constructions,” Theoretical Computer Science 155(2), 1996, 291–319. DOI. This supplies the finite partial-derivative carrier and its language semantics.
  • Janusz A. Brzozowski, “Derivatives of Regular Expressions,” Journal of the ACM 11(4), 1964, 481–494. DOI. The first finite checker uses normalized deterministic derivatives as an implementation-level corroboration.
  • Ken Thompson, “Regular Expression Search Algorithm,” Communications of the ACM 11(6), 1968, 419–422. DOI. The second checker uses Thompson epsilon-NFAs for its oracle.
  • Cyril Allauzen and Mehryar Mohri, “A Unified Construction of the Glushkov, Follow, and Antimirov Automata,” in MFCS 2006, LNCS 4162, 110–121. DOI. This is the source used to position the epsilon-free Glushkov review oracle relative to Antimirov automata.
  • Peter Thiemann, “Derivatives for Enhanced Regular Expressions,” in CIAA 2016, LNCS 9705, 285–297. DOI · arXiv:1605.00817. This is modern background on derivative-based constructions; it is not the source of the quotient theorem above.