Series

Appendix: Proofs and Lemmas

Scope of the appendix

This appendix isolates the mathematical proof obligations of the extended learner. The main theorem is conditional on explicit terminal invariants: closed representation, right compatibility, separability and the finite Monoid Consistency Check.

This distinction matters. An exact EQ proves equality of recognized languages, but it does not alone prove that the hypothesis quotient is the syntactic monoid. The missing step is to establish that the learned equivalence is compatible with concatenation on both sides and contains no unnecessary split.

Notation

Let L⊆Σ∗L\subseteq\Sigma^* be regular and let

χL(w)={1,w∈L,0,w∉L.\chi_L(w)= \begin{cases} 1,&w\in L,\\ 0,&w\notin L. \end{cases}

At a fixed stage, let I,P,S⊆Σ∗I,P,S\subseteq\Sigma^* be finite and contain ϵ\epsilon. Define

row⁡(w)=(χL(pws))(p,s)∈P×S.\operatorname{row}(w) = \bigl(\chi_L(pws)\bigr)_{(p,s)\in P\times S}.

The current observational equivalence is

x≡Ty⟺row⁡(x)=row⁡(y).x\equiv_T y \quad\Longleftrightarrow\quad \operatorname{row}(x)=\operatorname{row}(y).

Right-consistency refinement uses the suffix row

srow⁡(w)=(χL(ws))s∈S.\operatorname{srow}(w) = \bigl(\chi_L(ws)\bigr)_{s\in S}.

The target syntactic congruence is

x∼Ly⟺∀u,v∈Σ∗,  uxv∈L  ⟺  uyv∈L.x\sim_L y \quad\Longleftrightarrow\quad \forall u,v\in\Sigma^*,\; uxv\in L\iff uyv\in L.

Terminal invariants

The proof uses the following conditions.

  1. Separability. Distinct representatives in II have distinct rows.
  2. Closedness. For every i∈Ii\in I and a∈Σa\in\Sigma, there is a j∈Ij\in I such that ia≡Tjia\equiv_Tj.
  3. Exact language equivalence. The constructed hypothesis H\mathcal H has one chosen representative from II for every state and has passed the exact EQ: L(H)=LL(\mathcal H)=L.
  4. Finite right consistency. For all i,j∈Ii,j\in I and a∈Σa\in\Sigma,
srow⁡(i)=srow⁡(j)⟹srow⁡(ia)=srow⁡(ja).\operatorname{srow}(i)=\operatorname{srow}(j) \quad\Longrightarrow\quad \operatorname{srow}(ia)=\operatorname{srow}(ja).
  1. Boundary left compatibility. For r∈Ir\in I and a∈Σa\in\Sigma, put t=rat=ra and let v∈Iv\in I be its unique representative. Then, for every i∈Ii\in I and s∈Ss\in S,
χL(its)=χL(ivs).\chi_L(its)=\chi_L(ivs).

The Monoid Consistency Check is precisely the finite test in Condition 5.

Lemma 0A: Finite right consistency implies right compatibility

Lemma. Under Conditions 3 and 4,

x≡Ty⟹xa≡Tyax\equiv_Ty \quad\Longrightarrow\quad xa\equiv_Tya

for every a∈Σa\in\Sigma.

Proof. Fix p∈Pp\in P. Equality of the full rows of xx and yy implies

srow⁡(px)=srow⁡(py).\operatorname{srow}(px)=\operatorname{srow}(py).

Let i,j∈Ii,j\in I be the chosen representatives of the states reached in H\mathcal H by pxpx and pypy. Because pxpx and ii reach the same hypothesis state, they have the same continuation behavior in H\mathcal H. Since L(H)=LL(\mathcal H)=L, for every z∈Σ∗z\in\Sigma^*,

χL(pxz)=χL(iz).\chi_L(pxz)=\chi_L(iz).

Similarly, χL(pyz)=χL(jz)\chi_L(pyz)=\chi_L(jz). In particular,

srow⁡(i)=srow⁡(px)=srow⁡(py)=srow⁡(j).\operatorname{srow}(i)=\operatorname{srow}(px) =\operatorname{srow}(py)=\operatorname{srow}(j).

Finite right consistency gives

srow⁡(ia)=srow⁡(ja).\operatorname{srow}(ia)=\operatorname{srow}(ja).

For every s∈Ss\in S, exact language equivalence and equality of hypothesis states yield

χL(pxas)=χL(ias)=χL(jas)=χL(pyas).\chi_L(pxas)=\chi_L(ias) =\chi_L(jas)=\chi_L(pyas).

This holds for every p∈Pp\in P and s∈Ss\in S, so row⁡(xa)=row⁡(ya)\operatorname{row}(xa)=\operatorname{row}(ya). Hence xa≡Tyaxa\equiv_Tya. □\square

Lemma 0B: Existence of path representatives

Define ρ:Σ∗→I\rho:\Sigma^*\to I recursively. Let ρ(ϵ)=ϵ\rho(\epsilon)=\epsilon. If w=uaw=ua, choose ρ(w)\rho(w) to be the unique representative supplied by closedness for the boundary word ρ(u)a\rho(u)a.

Lemma. Every word has a unique path representative satisfying

w≡Tρ(w).w\equiv_T\rho(w).

Proof. We use induction on ∣w∣|w|. The claim is immediate for w=ϵw=\epsilon.

Suppose u≡Tρ(u)u\equiv_T\rho(u) and let a∈Σa\in\Sigma. Lemma 0A gives

ua≡Tρ(u)a.ua\equiv_T\rho(u)a.

Closedness supplies some j∈Ij\in I with

ρ(u)a≡Tj.\rho(u)a\equiv_Tj.

By transitivity, ua≡Tjua\equiv_Tj, so set ρ(ua)=j\rho(ua)=j. If two representatives j1,j2∈Ij_1,j_2\in I satisfied this condition, then j1≡Tj2j_1\equiv_Tj_2; separability would force j1=j2j_1=j_2. Thus the representative exists and is unique. □\square

Lemma 1: Unique representatives

Lemma. Under the terminal invariants,

x≡Ty⟺ρ(x)=ρ(y).x\equiv_Ty \quad\Longleftrightarrow\quad \rho(x)=\rho(y).

Proof. Suppose x≡Tyx\equiv_Ty. By Lemma 0B,

x≡Tρ(x)andy≡Tρ(y).x\equiv_T\rho(x) \qquad\text{and}\qquad y\equiv_T\rho(y).

Transitivity gives ρ(x)≡Tρ(y)\rho(x)\equiv_T\rho(y). Both words belong to II, so separability implies ρ(x)=ρ(y)\rho(x)=\rho(y).

Conversely, if ρ(x)=ρ(y)\rho(x)=\rho(y), Lemma 0B and transitivity give

x≡Tρ(x)=ρ(y)≡Ty.x\equiv_T\rho(x)=\rho(y)\equiv_Ty.

Therefore the two conditions are equivalent. □\square

Lemma 2: Extension from letters to words

Lemma. Right compatibility for letters implies

x≡Ty⟹xw≡Tywx\equiv_Ty \quad\Longrightarrow\quad xw\equiv_Tyw

for every w∈Σ∗w\in\Sigma^*.

Proof. Use induction on ∣w∣|w|. For w=ϵw=\epsilon, the claim is immediate. Suppose it holds for ww and let a∈Σa\in\Sigma. Then

xw≡Tyw.xw\equiv_Tyw.

Applying right compatibility once gives

xwa≡Tywa.xwa\equiv_Tywa.

Thus the property holds for every finite word. □\square

Lemma 3: The finite Monoid Check controls full rows

The implemented check compares only contexts from I×SI\times S. The next lemma explains why this is enough to recover every coordinate in P×SP\times S.

Lemma. Let t=rat=ra with r∈Ir\in I, a∈Σa\in\Sigma, and let v=ρ(t)v=\rho(t). If the boundary left-compatibility check passes, then for every i∈Ii\in I,

it≡Tiv.it\equiv_Tiv.

Proof. Fix i∈Ii\in I. To prove equality of full rows, choose arbitrary p∈Pp\in P and s∈Ss\in S. Let

j=ρ(pi)∈I.j=\rho(pi)\in I.

By Lemma 0B, pi≡Tjpi\equiv_Tj. Lemma 2 allows us to append tt and vv:

pit≡Tjt,piv≡Tjv.pit\equiv_Tjt, \qquad piv\equiv_Tjv.

Since (ϵ,s)(\epsilon,s) is a row coordinate, these equivalences imply

χL(pits)=χL(jts),χL(pivs)=χL(jvs).\chi_L(pits)=\chi_L(jts), \qquad \chi_L(pivs)=\chi_L(jvs).

The finite Monoid Check applies to j∈Ij\in I, so

χL(jts)=χL(jvs).\chi_L(jts)=\chi_L(jvs).

Combining the three equalities gives

χL(pits)=χL(pivs).\chi_L(pits)=\chi_L(pivs).

Because pp and ss were arbitrary, every coordinate of row⁡(it)\operatorname{row}(it) and row⁡(iv)\operatorname{row}(iv) agrees. Hence it≡Tivit\equiv_Tiv. □\square

Lemma 4: Normal-form multiplication

Lemma. For every representative i∈Ii\in I and word w∈Σ∗w\in\Sigma^*,

iw≡Tiρ(w).iw\equiv_Ti\rho(w).

Proof. We use induction on ∣w∣|w|.

For w=ϵw=\epsilon, choose ρ(ϵ)=ϵ\rho(\epsilon)=\epsilon. Then iϵ=i=iρ(ϵ)i\epsilon=i=i\rho(\epsilon).

For the induction step, write w=uaw=ua with a∈Σa\in\Sigma and assume

iu≡Tiρ(u).iu\equiv_Ti\rho(u).

By right compatibility,

iua≡Tiρ(u)a.iua\equiv_Ti\rho(u)a.

The word t=ρ(u)at=\rho(u)a is a boundary word in IΣI\Sigma. Its representative is

v=ρ(t)=ρ(ua)=ρ(w),v=\rho(t)=\rho(ua)=\rho(w),

where the middle equality follows from Lemma 1 and the definition of the path representative. Lemma 3 gives

iρ(u)a≡Tiv=iρ(w).i\rho(u)a\equiv_Tiv=i\rho(w).

By transitivity, iw≡Tiρ(w)iw\equiv_Ti\rho(w). □\square

Lemma 5: Arbitrary products reduce to representatives

Lemma. For all x,y∈Σ∗x,y\in\Sigma^*,

xy≡Tρ(x)ρ(y).xy\equiv_T\rho(x)\rho(y).

Proof. Lemma 0B gives x≡Tρ(x)x\equiv_T\rho(x). By Lemma 2,

xy≡Tρ(x)y.xy\equiv_T\rho(x)y.

Applying Lemma 4 with the representative ρ(x)\rho(x) gives

ρ(x)y≡Tρ(x)ρ(y).\rho(x)y\equiv_T\rho(x)\rho(y).

Transitivity completes the proof. □\square

Lemma 6: Observational equivalence is a congruence

Lemma. At termination, ≡T\equiv_T is compatible with concatenation on both sides.

Proof. Right compatibility with arbitrary suffixes is Lemma 2.

For left compatibility, suppose x≡Tyx\equiv_Ty and choose any z∈Σ∗z\in\Sigma^*. Lemma 1 gives

ρ(x)=ρ(y).\rho(x)=\rho(y).

Using Lemma 5 twice,

zx≡Tρ(z)ρ(x)=ρ(z)ρ(y)≡Tzy.zx\equiv_T\rho(z)\rho(x) =\rho(z)\rho(y) \equiv_Tzy.

Therefore zx≡Tzyzx\equiv_Tzy. Since zz was arbitrary, ≡T\equiv_T is both a left and right congruence. □\square

Lemma 7: The quotient saturates the language

Lemma. If x≡Tyx\equiv_Ty, then

x∈L  ⟺  y∈L.x\in L\iff y\in L.

Proof. Because ϵ∈P∩S\epsilon\in P\cap S, the coordinate (ϵ,ϵ)(\epsilon,\epsilon) belongs to every full row. Equality of rows therefore implies

χL(x)=χL(y).\chi_L(x)=\chi_L(y).

Hence every ≡T\equiv_T class lies entirely inside LL or entirely outside LL. □\square

Theorem: Correctness of the learned quotient

Theorem. If the terminal invariants hold and the finite Monoid Consistency Check passes, then

≡T=∼L.\equiv_T=\sim_L.

Consequently,

Σ∗/≡T≅Σ∗/∼L=M(L).\Sigma^*/{\equiv_T} \cong \Sigma^*/{\sim_L}=M(L).

Proof. We prove both inclusions.

First inclusion

Assume x≡Tyx\equiv_Ty. By Lemma 6, for all u,v∈Σ∗u,v\in\Sigma^*,

uxv≡Tuyv.uxv\equiv_Tuyv.

Lemma 7 then gives

uxv∈L  ⟺  uyv∈L.uxv\in L\iff uyv\in L.

Therefore x∼Lyx\sim_Ly, and so

≡T  ⊆  ∼L.\equiv_T\;\subseteq\;\sim_L.

Reverse inclusion

Assume x∼Lyx\sim_Ly but x̸≡Tyx\not\equiv_Ty. By Lemma 1,

ρ(x)≠ρ(y).\rho(x)\ne\rho(y).

Separability says their rows differ. Hence there exist p∈Pp\in P and s∈Ss\in S such that

χL(pρ(x)s)≠χL(pρ(y)s).\chi_L\bigl(p\rho(x)s\bigr) \ne \chi_L\bigl(p\rho(y)s\bigr).

Lemma 0B gives x≡Tρ(x)x\equiv_T\rho(x) and y≡Tρ(y)y\equiv_T\rho(y). Lemmas 6 and 7 therefore imply

χL(pxs)=χL(pρ(x)s)\chi_L(pxs)=\chi_L\bigl(p\rho(x)s\bigr)

and

χL(pys)=χL(pρ(y)s).\chi_L(pys)=\chi_L\bigl(p\rho(y)s\bigr).

Thus χL(pxs)≠χL(pys)\chi_L(pxs)\ne\chi_L(pys), contradicting x∼Lyx\sim_Ly. Therefore

∼L  ⊆  ≡T.\sim_L\;\subseteq\;\equiv_T.

The equivalences coincide, and their quotient is the syntactic monoid. □\square

Corollary: Why Promote can skip the post-check

Corollary. Suppose every representative is promoted into the prefix set, so that

I⊆P.I\subseteq P.

If a boundary word t∈IΣt\in I\Sigma and its representative v∈Iv\in I have equal full rows, then the finite Monoid Consistency condition already holds.

Proof. Equality of full rows means

∀p∈P,∀s∈S,χL(pts)=χL(pvs).\forall p\in P,\forall s\in S, \qquad \chi_L(pts)=\chi_L(pvs).

Since every i∈Ii\in I also belongs to PP, choose p=ip=i. Then

∀i∈I,∀s∈S,χL(its)=χL(ivs).\forall i\in I,\forall s\in S, \qquad \chi_L(its)=\chi_L(ivs).

This is exactly boundary left compatibility. The post-EQ Monoid Check would therefore repeat information already encoded in the rows. □\square

Termination under strict refinement

Let M=∣M(L)∣M=|M(L)|. Every new representative added to II has a row different from all existing representatives. That difference is witnessed by actual contexts p∈Pp\in P and s∈Ss\in S, so the new representative belongs to a previously unrepresented syntactic class. Therefore

∣I∣≤M.|I|\le M.

Similarly, every accepted refinement of PP or SS must split at least one current observational class. Under the progress condition that the learner never inserts a context that leaves the current partition unchanged, only finitely many such splits are possible because syntactic congruence has MM classes.

With an exact equivalence teacher, the loop must therefore reach a hypothesis that recognizes LL. Once the terminal invariants and boundary left compatibility also hold, the main theorem applies and the returned quotient is M(L)M(L).

Proof obligations for the implementation

The theorem separates mathematical correctness from engineering details. A concrete implementation should test the following properties independently:

  1. stable row coordinates and unique representatives;
  2. closedness after every representative insertion;
  3. right-compatibility refinement after changes to SS;
  4. exact language equivalence of the final hypothesis in Oracle experiments;
  5. the boundary left-compatibility condition for Post;
  6. the invariant I⊆PI\subseteq P and zero Monoid Check calls for Promote;
  7. language, MQ and EQ trajectory preservation after cache or table refactors.

These tests do not replace the proof. They establish that the running program satisfies the hypotheses under which the proof is valid.