waxwing

O24: Waxwing’s row model against EMLTI’s model conditions

Written 2026-10-22 at the author’s request, after the forwarded external review (issue 1: “O24 must address partial record composition”). It covers one matrix row, O24, of docs/plans/2026-10-22-inference-foundations-assessment.md §11, with the companion docs/plans/2026-10-22-inference-foundations-extension.md §1.2 and §1.4. It changes no compiler code, adds no Lean proof and runs no prototype. Every lemma statement below is proposed. §3 was revised after one statement review (§8), which found the first GI-Open false as stated. The author answered the revision’s questions (§3.4; dossier §18.70; recorded in §9), and §3 now proposes a refined model X_W(B, i) for statement review. The revised statements are unproved. The model-condition checks in §1 and §2 are argued.

The question: can Waxwing’s row model be presented as a model X of Pottier and Rémy’s The Essence of ML Type Inference (EMLTI, ATTAPL ch. 10), so that EMLTI’s HM(X) results apply? And does EMLTI’s ground-instance inclusion coincide with ValidOpen?

Statuses are the matrix’s: proved (a Lean-checked Waxwing theorem, under its premises), argued, experimentally checked, proposed, unresolved. A published result is cited and never makes a Waxwing claim proved. Page numbers are EMLTI’s printed pages (PDF page + 388). Lean paths are under research/composition-proofs/Composition/.

1. What EMLTI requires of a model, and what Waxwing’s model meets

Definition 10.2.5 (printed p. 411), transcribed. “For every kind κ, let 𝓜κ be a nonempty set, whose elements are called the ground types of kind κ. […] For every type constructor F of signature K ⇒ κ, let F denote a total function from 𝓜K into 𝓜κ […]. For every predicate symbol P of signature κ1 ⊗ … ⊗ κn ⇒ ·, let P denote a predicate on 𝓜κ1 × … × 𝓜κn. For every kind κ, we require the predicate =κ to be equality on 𝓜κ and the predicate ≤κ to be a partial order on 𝓜κ.”

Other conditions the chapter places on X:

The row section’s own answer to duplicate labels. In Rémy’s approach “every row denotes an infinite (in fact, cofinite) mapping from labels to types”; abs and pre encode domains in field types, and a duplicate label “is ruled out by the kind system” (p. 487). Row kinds Row(L) record the labels a row does not define, and row extension ℓ^{κ,L} needs ℓ ∉ L (Definition 10.8.3, p. 467). Each row constructor then denotes a total function (Definition 10.8.10, p. 472). EMLTI’s rows have no concatenation. For predicate-based alternatives it cites Berthomieu’s =L (row equality outside L), Gaster and Jones’s lacks, Ohori’s has, Sulzmann’s “new, ad hoc constraint forms” for extension and concatenation (p. 488-489), and Pottier (2003), whose rows exist only in constraints, as ≤L (p. 489). Of these, only EMLTI’s descriptions were read.

Waxwing’s model (Syntax.lean, Rows.lean, Compose.lean, Sig/Finite.lean, Typed/Bridge/Valid.lean). Ground types G are bases, arrows and records over rows Label → Option G. compose r s is some (union r s) only when Disjoint r s. A record type { l: t, ...r, ...s } denotes composeAll of its fields and tails. An eq atom needs both sides defined (Holds); lacks and disjoint read the row directly. ValidFin quantifies over finite rigid values and finite flexible witnesses. ValidOpen is ValidFin at every injective base extension i : B → B₁; labels are a fixed type, never extended.

Requirement Waxwing model, identified directly Status
Nonempty carriers per kind (★, row) emptyG, Row.empty argued
Constructors denote total functions base, arrow and record over a row are total; compose, and evalF on written fields with a repeated label, are partial. ⊎ cannot be a type constructor fails (argued)
Finite arity in type syntax TExpr.record has finitely many fields and tails argued
= is equality, ≤ a partial order no subtyping: an equality model (Example 10.2.8, p. 412) argued
C-Arrow, → isolated G.arrow is an injective constructor distinct from base and record argued
One fixed model ValidOpen ranges over all injective base extensions needs encoding (§3)
Infinite labels rows over a fixed Label; ValidFin uses finite rows only, unlike Rémy’s cofinite rows needs a carrier choice
Field types any G; no pre/abs argued (none ↔ abs, §2c)
Rigid vs flexible no such distinction in EMLTI: rigid = free on the left of ⊩, flexible = ∃ on the right argued (§3, V)
lacks, disjoint predicates of arity 1 and 2; Definition 10.2.5 allows any relation argued

2. Three candidate encodings

(a) Composition as a predicate; constructors stay total

The model X_W(B) has the following components.

disjoint r s becomes ∃t. U(t, r, s), and r lacks {ℓ} becomes ∃X t. U(t, r, single_ℓ X); the second uses 𝓜★ ≠ ∅. A record type { ℓ1: t1, ..., ...r1, ... } is flattened to Π ρ under ∃ρ̄ and a chain of U atoms over the singles and tails. ⊎ never appears in a type term.

(b) Totalize with an error element and a definedness predicate

Add junk to the carriers and make ⊎ a total constructor. The two variants fail in different ways.

(c) Rémy’s rows (EMLTI §10.8) as the carrier presentation

Present a Waxwing row as a complete Rémy row over field types {abs, pre T}, with none ↔ abs. On finitely supported rows this is a bijection (argued). r lacks {ℓ} becomes the ordinary row equation ∃R. r = (ℓ : abs ; R), so no new predicate is needed, and EMLTI’s row laws (Lemmas 10.8.16 and 10.8.18, with C-Row-LL and C-Row-DL; read in a text extraction only) become citable for the composition-free fragment.

3. Ground inclusion against ValidOpen

All statements here are proposed: statements only, none proved, none in Lean. They were revised on 2026-10-22 after a statement review (§8). §3.1 records why the first GI-Open and GI-Atoms were false as stated; §3.2 gives the revised statements; §3.3 proposes a proof tranche, which is not authorized; §3.4 lists the questions the revision left for the author, with the author’s answers (§18.70). Fix X_W(B) from (a); §3.2 refines it to X_W(B, i). ⟦·⟧ translates TExpr, atoms and problems, with fresh ∃-bound auxiliary variables for intermediate rows.

3.1 Counterexamples to the first statements

Verdict: the first GI-Open and the first GI-Atoms biconditional are false as stated, the latter whether or not B1b holds. In both, the direction “inclusion → ValidOpen P(σ2 ≤ σ1)” fails, where P(σ2 ≤ σ1) had rigid = X̄2, D = C2 and body C1 ∧ eq(T1, T2). Counterexamples 1 and 2 refute it; neither refutes the other direction. Counterexample 3 refutes M0 as stated for uncountable B or Label. Each was checked by hand here against the Lean definitions (evalT, evalF, Holds, Sat in Syntax.lean; SigProblem, combine, Scoped in Sig/Validity.lean; FinG, FinAssign, ValidFin in Sig/Finite.lean; ValidOpen in Typed/Bridge/Valid.lean) and, for 3, against the rendered p. 400. None is in Lean. Variable indices are Nats.

  1. Shared variable names. σ1 = ∀[ty 0].tvar 0 and σ2 = ∀[ty 0].Int, with Int some b ∈ B. P(σ2 ≤ σ1) = ⟨[0], [], [], [eq (tvar 0) Int]⟩ is Scoped, since D is empty. Take θR.ty 0 = emptyG, which is finite. combine reads type variable 0 from θR, so the eq atom needs emptyG = Int and fails for every θF. ValidFin fails at i = id, so ValidOpen fails. Ground inclusion holds at every X_W(B₁): σ2’s only instance is Int, and σ1’s instances are all of 𝓜★. Cause: GI needs X̄1 # X̄2, but neither P(·) nor GI-Open renamed the schemes apart.
  2. σ2’s type undefined; definedness in the body. σ2 = ∀ rows 0, 1. {…0, …1} (TExpr.record .nil [0, 1], no constraint), and σ1 the same over rows 2, 3. P = ⟨[], [0, 1], [], [eq {…2, …3} {…0, …1}]⟩ is Scoped. Take θR.row 0 = θR.row 1 = single ℓ emptyG for some label ℓ: both finite. composeAll meets overlapping rows, so the right side’s evalT is none whatever θF is, and Holds eq fails. ValidFin and ValidOpen fail, even though σ1 is σ2 renamed. Read through F, both schemes have the instances {Π(r ∪ s) | r # s, both finite}, so inclusion holds. Cause: P put T2’s definedness in the body, inside eq(T1, T2), while F’s instance set takes it from the scheme’s own constraint.
    • Waxwing can write this σ2’s type: a parameter or result type that writes two tails into one record joins them, with no disjoint clause (language.md, the Tranche B paragraph after the empty record). W3 (WFRow, Sig/Generic.lean:59: two rigid rows’ rests in one row are declared disjoint in D) does not hold for the raw scheme, so results assuming W3 do not cover it.
    • Qualification (author, §18.70). The raw scheme is a valid model-level counterexample: Scheme admits it, and ind must handle it. Source Waxwing, though, does not produce it. Sig7 (research/division-campaign/r0/recorder-rules.md §3.1, stream T-R0b; recorder-spec row A4) puts disjoint r s (origin types) into D for each pair in f.joined. f.joined (joinedPairs, Features/Resolve/Apart.purs:176) lists every pair of the declaration’s own record row variables that its parameter, result or effect-row types write as tails of one record, at any depth, including pairs that a named type’s record arguments write into one record; a tail written twice is refused earlier (RepeatedTail). So a signature { ...r, ...s } with no where clause still has disjoint r s in its recorded D. Omitting the clause does not omit the generated assumption, and the recorded problem meets W3 (argued from the rules table and the code cited; not checked against a recorded problem).
    • σ2 = ∀[].{a: Int, a: Int} fails the same way. evalF is undefined on the repeated label, so σ2 has no instances and inclusion holds vacuously, yet the body’s eq never holds. TExpr admits this type; the surface rejects it.
    • Case A is unaffected: each of σ_w’s records has one tail and no fields, so its type is always defined.
  3. Countability. Definition 10.1.14 (p. 400, rendered page read): “Let F range over a finite or denumerable set of type constructors”. X_W(B) has one base b per b ∈ B and one single_ℓ per ℓ ∈ Label, so it is an EMLTI model only when B and Label are countable. ValidOpen ranges over every B₁ : Type, uncountable ones included, so the first GI-Open’s “X_W(B₁) is an ordinary fixed model” fails for those B₁. §3.2’s X_W(B, i) is the proposed repair: its constructors are indexed by B, not B₁.

The reviewer also searched for counterexamples to T1, T2, V and GI and found none: duplicate labels and tails, empty rows, disjoint r r, lacks (which needs 𝓜★ ≠ ∅), empty B, finite and infinite Label, rigid variables absent from D or B, record-valued fields and nested spreads. That search was not repeated here.

3.2 Revised statements

Shared definitions.

Statements.

Under (b) GI must read (φ)σ2 ∩ Def ⊆ (φ)σ1, and GI-Open also needs J. Without guards, inclusion fails on junk instances, as in §2(b2). Under (c) the statements are (a)’s, transported along the abs/none bijection. They hold only on the finite carrier, where ∂ is restricted.

3.3 Proposed proof tranche (not authorized)

This is the reviewer’s plan, recorded as a proposal and revised for the author’s answers (§18.70). D2 (§18.69) sent the statements to review for a focused tranche; the tranche itself is not authorized, and nothing here starts it. §18.70 scopes proof work separately from the first execution tranche, which does not authorize it. One owner holds the statements; workers prove in parallel worktrees, and the results are integrated, then reviewed.

The answers drop the downward-countability lemma (Q2) and a generic GI (Q3). Rough sizes (reviewer’s estimates, made before the refinement): M0 about 80 lines, T1 and T2 250-300, GI about 100, GI-Fin-Iff about 120, F about 100, V about 150, GI-Open about 60; roughly 1,100-1,200 lines with the interface. The tranche now excludes V and adds M0-i, the reindexing fact and Rename, which are not estimated. Reused: evalT_congr, fieldRows_congr, holds_congr and sat_congr (Closed.lean); compose_eq_some, composeAll_append and composeAll_perm (Compose.lean); finG_emptyG and FinRow (Sig/Finite.lean); tyVarsOf_map, rowVarsOf_map, mapBaseSyntax and mapBaseId (ProofExtension.lean); openToFin. New small lemmas: finRow_union; a general finG_single (the one in TypedAttack/ShapeSplit.lean is for Label = Nat only); evalT_fin.

3.4 Questions for the author, with the author’s answers

The questions and proposed defaults are kept as asked; each answer is the author’s (dossier §18.70).

  1. How does the definedness of σ2’s type enter? (A) eq T2 T2 in D, as in ind; or (B) D = C2 with a premise that σ2’s type is defined whenever C2 holds on finite values. Default: (A). Open with it: which option matches how R0 and the recorder build signature problems when a parameter type joins two tails without a disjoint clause (counterexample 2). That was not checked here. Answer: (A). Declaration well-formedness and satisfiability are checked separately, so vacuous inclusion cannot make an invalid declaration acceptable (§3.2, “Vacuous inclusion”: WF-Sig is an obligation on R0 and the recorder). Sig7 settles the open point (§3.1, counterexample 2’s qualification).
  2. Countability. Default: M0 assumes [Countable Label] [Countable B]; GI-Open quantifies over every B₁ : Type, and “X_W(B₁) is an EMLTI model” is claimed only for countable B₁. The alternative restricts GI-Open to countable B₁ and adds a downward lemma (a counterexample at B₁ gives one at a countable sub-extension, via E2 and E3; unproved). Answer: ValidOpen unchanged; first investigate a model refinement with constructor names indexed by B and carriers over B₁. §3.2 states it as X_W(B, i) (M0-i, T1-i, T2-i, F-i and the refined GI-Open), for statement review, proposed and not proved. Under it the downward lemma is not needed.
  3. GI’s formal target. Default: yes, weaken GI from “any equality model” to the concrete fragment of X_W(B) for formalization; the generic version stays argued. Answer: the concrete fragment, with no generic many-sorted framework built only to generalize this lemma.
  4. Apart. Default: a premise of GI-Fin-Iff, GI-Open and GI-Atoms. The alternative has ind rename σ1’s variables apart itself. Answer: a premise. Clients get a capture-avoiding rename, with invariance under renaming checked (§3.2, Rename, proposed).
  5. V. Default: keep it in the tranche as a side result, in a later stage (stage 2), since GI-Open no longer depends on it. Answer: a later side result, off GI-Open’s critical path; §3.3 moves it out of the tranche.
  6. Case A’s tuple types, which TExpr lacks. Default: curried arrows. Waxwing has no tuple type in this position: (A, B) -> C is exactly A -> B -> C (language.md:76), so σ_w and σ_inf lower to curried arrows, which TExpr.arrow already expresses. Answer: curried arrows, Waxwing’s existing meaning.

4. Recommendation

Decided (D2, dossier §18.69, 2026-10-22). The author adopted encoding (a). M0, T1, T2, V, GI, F and GI-Open go to statement review for a focused proof tranche; the tranche itself is not yet authorized. GI-Atoms stays conditional on B1b. GI-Fin is not named in the decision and stays proposed. Current exported syntax is kept for now, but L0 is not frozen as sufficient for future principal inference. Every statement below is still proposed and unproved; the decision chooses the encoding and adds no evidence. The recommendation that follows is kept as written. The statement review (§8) then revised §3: GI-Open now takes Closed, Apart and the induced problem ind, M0 assumes countable Label and B, and GI-Fin-Iff is new. The author’s answers (§18.70, §9) then added the refined model X_W(B, i), rename and WF-Sig, all proposed.

State (a) next: M0, T1, T2, V, GI and GI-Open, with F. It is the smallest encoding. It adds one predicate and no junk, and its ground types are exactly Waxwing’s finite values. Waxwing’s Holds already reads eq strictly (both sides defined), which is what (a) encodes. Keep GI-Atoms as a corollary conditional on B1b. Keep (c) only as a presentation for the composition-free fragment. Do not pursue (b): (b1) breaks C-Arrow, and (b2) needs an invented predicate and guards on every scheme.

Once these statements are proved, the assessment could claim the following.

The assessment could not claim:

O24 matrix status. Move it from unresolved to proposed, and restate its interpretation: “Waxwing’s row model, with composition encoded as the predicate U (this note §2a), is an EMLTI model; ground inclusion at every injective base extension coincides with ValidOpen (GI-Open); in X_W^atoms(B) it does so given B1b.” The model-condition check is argued here, and the correspondence lemmas are stated but unreviewed and unproved. Direct identification fails (argued) by the partiality of ⊎ against Definition 10.2.5’s totality, as the external review said. Row O20 (concatenation) gains a candidate account but stays unresolved.

ADR 014 new combinations (flagged for the author).

  1. EMLTI’s HM(X) with a disjoint-composition model (already flagged in companion §1.4).
  2. A ternary disjoint-union predicate U as the only row primitive. The precedents cited by EMLTI (Berthomieu’s =L, lacks, Sulzmann’s forms, Pottier’s ≤L) are predicate-based, but none is this predicate, and none was read.
  3. A fixed model with anonymous atoms (X_W^atoms(B)) standing in for the open-world family of models of Odersky et al. GI-Atoms uses it. The refined X_W(B, i) of §3.2 uses the same vocabulary/carrier split for every extension, and X_W^atoms(B) is X_W(B, inl).
  4. (b)’s Def guard, which is invented and not recommended.
  5. EMLTI’s per-model order quantified over Waxwing’s family of injective base extensions (GI-Open). That reading is not EMLTI’s order, which is over one fixed model; the closest precedent, Odersky et al. 1999’s open world, was not read.

5. Reading status

EMLTI rendered pages read: printed 407-419 (§10.2 syntax, Definition 10.2.5, model examples, Definition 10.2.10, Fig. 10-5, Definition 10.2.11, C-Arrow, isolation, Definition 10.2.14, Fig. 10-6, Example 10.2.16), 422-424 (Fig. 10-7 and the open-world remark), 433-434 (Theorems 10.4.4 and 10.4.8), 472-473 and 488; in the statement review pass, 400-401 (Definitions 10.1.14-10.1.16), 414 and 416; in the answers pass (§9), 400-401 and 411-413 again. Read from a text extraction only: 465-468 (row kinds, Definition 10.8.3), 471, 487 and 489. Not read: 420-421 (solved forms), Lemma 10.3.1, §10.5 beyond p. 434, §10.6, Example 10.8.8 itself, and the papers EMLTI cites (Odersky et al. 1999, Sulzmann 2000, Berthomieu, Gaster and Jones, Pottier 2003). Waxwing sources read: Syntax.lean, Compose.lean, Rows.lean (definitions), Sig/Validity.lean, Sig/Finite.lean, Typed/Bridge/{Valid, Extension, Fresh, ProofInstantiateSound}.lean, Typed/Refute/Statements.lean (Denotes), statements.md (B0-B1, BS), ADR 013 (2026-10-16 merge decision: “overlap is an error everywhere”), ADR 014, and language.md (the disjoint clause); in the answers pass, recorder-rules.md §3.1 (Sig4-Sig10), recorder-spec row A4, Features/Resolve/Apart.purs (heldTails, joinedPairs), Features/Resolve/ArgumentPairs.purs (pairsOf) and Sig/SourceCampaign.lean (ClauseOnly, clauseOnly_satisfiable).

6. Review of the correction pass, 2026-10-22

A read-only review (model output, kept outside the repository) checked this note against the rendered EMLTI pages and the Lean sources and found nothing blocking. Its findings 4-10 bear on this note; all were applied.

No status changes. The assessment’s O24 row and IF4 are updated to the X_W^atoms(B) name and the family reading.

7. Author’s decisions (§18.69), 2026-10-22

The author decided D2 (dossier §18.69): encoding (a); M0, T1, T2, V, GI, F and GI-Open to statement review for a focused proof tranche; GI-Atoms conditional on B1b; current exported syntax kept, with L0 not frozen as sufficient for future principal inference. §4 records the decision. No status changes: the model-condition checks stay argued and every lemma statement stays proposed.

8. Statement review, 2026-10-22

A read-only statement review of §3 (model output, kept outside the repository) for the D2 proof tranche (dossier §18.69) found the first GI-Open false as stated. Its counterexamples were checked here against the Lean definitions and the rendered p. 400 before use (§3.1); none is in Lean. Changes:

No status changes: every statement stays proposed and unproved, GI-Fin-Iff’s “proved on paper” is the reviewer’s claim (argued), and the model-condition checks stay argued. The assessment’s O24 row and IF4 and the companion’s D2 now name GI-Fin-Iff and the revision.

9. Author’s answers (§18.70), 2026-10-22

The author answered §3.4’s six questions (dossier §18.70) and qualified counterexample 2. Applied:

No status changes: every statement, X_W(B, i) and Rename included, stays proposed and unproved, and the model-condition checks stay argued.