Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
One variable needs an upper and a lower face
Subsumption breaks the equality equations used by Algorithm W. For 𝖺𝗉𝗉𝗅𝗒:=𝜆𝑓.𝜆𝑥.𝑓𝑥 equality-based inference identifies the type expected by 𝑓 with the type produced by 𝑥. Subtyping needs only a directed constraint 𝛼𝑥≤𝖺𝛼𝑓. Replacing that constraint by equality forgets valid programs; retaining an external constraint set loses the compact principal type promised by ML inference.
Suppose first that 𝛼≤𝖺𝖨𝗇𝗍 occurs in 𝛼→𝛼. Replacing both occurrences by 𝛼∧𝖨𝗇𝗍 gives (𝛼∧𝖨𝗇𝗍)→(𝛼∧𝖨𝗇𝗍). The result is needlessly restricted. The upper bound constrains values accepted by the function, not values returned by it. The compact solution is (𝛼∧𝖨𝗇𝗍)→𝛼. The two occurrences of 𝛼 therefore require different substitutions.
Let 𝑏 range over the rigid base atoms 𝖴𝗇𝗂𝗍,𝖡𝗈𝗈𝗅,𝖨𝗇𝗍,𝖲𝗍𝗋𝗂𝗇𝗀. The exact term and type grammars are 𝑒::=𝑥∣̂𝑥∣()∣𝗍𝗋𝗎𝖾∣𝖿𝖺𝗅𝗌𝖾∣𝜆𝑥.𝑒∣𝑒𝑒∣𝗅𝖾𝗍̂𝑥=𝑒𝗂𝗇𝑒∣𝗂𝖿𝑒𝗍𝗁𝖾𝗇𝑒𝖾𝗅𝗌𝖾𝑒,𝑇::=𝑏∣𝛼∣⊥∣⊤∣𝑇∨𝑇∣𝑇∧𝑇∣𝑇→𝑇∣𝜇𝛼.𝑇,𝑃::=⊥∣𝑏+∣𝛼+∣𝑃∨𝑃∣𝑁→𝑃∣𝜇𝛼.𝑃,𝑁::=⊤∣𝑏−∣𝛼−∣𝑁∧𝑁∣𝑃→𝑁∣𝜇𝛼.𝑁. In a recursive type, 𝛼 is covariant and every occurrence of it is guarded by an arrow. The 𝑃,𝑁 grammars are the polar sublanguages of the ambient local algebra 𝑇. A polar type records whether each variable occurrence is in an output position (+) or an input position (−). Crossing an arrow reverses polarity in its domain and preserves polarity in its codomain. A polar scheme has the form [Δ−]𝑃+, where every entry Δ(𝑥) is a negative type. When an atom’s polarity is determined by its grammar position, its superscript is omitted. Distinct atoms are distinct rigid heads. The variable 𝑥 is lambda-bound; ̂𝑥 is let-bound. Bound variables are renamed apart before inference.
The superscripts are sorts, not variance assertions about arbitrary type expressions. In particular, this grammar is not a complemented Boolean type algebra.
Let 𝐴,𝐵,𝐶 range over ambient types 𝑇. The relation ≤𝖺 is the least preorder on those types, compatible with arrows and the lattice laws ⊥≤𝖺𝐴,𝐴≤𝖺⊤,𝐴𝑖≤𝖺𝐴1∨𝐴2,(𝐴1≤𝖺𝐶∧𝐴2≤𝖺𝐶)⟹𝐴1∨𝐴2≤𝖺𝐶,𝐴1∧𝐴2≤𝖺𝐴𝑖,(𝐶≤𝖺𝐴1∧𝐶≤𝖺𝐴2)⟹𝐶≤𝖺𝐴1∧𝐴2,𝐴2≤𝖺𝐴1∧𝐵1≤𝖺𝐵2⟹(𝐴1→𝐵1)≤𝖺(𝐴2→𝐵2). Guarded 𝜇-types are identified with their unfoldings. For every base atom 𝑏, reflexivity gives 𝑏≤𝖺𝑏; there is no primitive comparison between two distinct base atoms. Head inversion gives 𝑏1≤𝖺𝑏2 only when 𝑏1=𝑏2. The four atoms form a free finite set of nullary heads, rather than an encoding by record labels.
The record encoding is tempting and wrong. In full MLsub, the join of two records retains only their common labels. Hence {𝗎𝗇𝗂𝗍:𝖻𝗈𝗈𝗅}∨{𝗂𝗇𝗍:𝖻𝗈𝗈𝗅}={}, whereas 𝖴𝗇𝗂𝗍∨𝖨𝗇𝗍 is not ⊤ in 𝖬𝖫𝗌𝗎𝖻0. The local calculus therefore receives its own declarative and algorithmic proof below; no record embedding transports the MLsub theorem.
A scheme is [Δ]𝑇, where Δ is a finite map from lambda-bound term variables to ambient types. All type variables in a scheme are implicitly generalized. Let 𝜌 range over type substitutions. Define scheme subsumption by [Δ]𝑇≤∀[Δ′]𝑇′⟺⎧{
{⎨{
{⎩dom(Δ)⊆dom(Δ′),Δ′(𝑥)≤𝖺𝜌(Δ(𝑥))forevery𝑥∈dom(Δ),𝜌(𝑇)≤𝖺𝑇′ for some 𝜌. Write Δ1∧Δ2 for the finite map on the union of their domains that takes the meet where both maps are defined and the sole entry otherwise. Write Δ𝑥 for deletion of 𝑥, and set Δ(𝑥)=⊤ when 𝑥∉dom(Δ).
Let Π map let-bound variables to schemes. The judgment Π⊢0𝑒:[Δ]𝑇 is generated by
Π(̂𝑥)=𝑆
Π⊢0̂𝑥:𝑆
Var-Let
𝛼∉𝖥𝖵(Π)
Π⊢0𝑥:[𝑥:𝛼]𝛼
Var-Lam
Π⊢0𝑒:[Δ]𝑇
Π⊢0𝜆𝑥.𝑒:[Δ𝑥](Δ(𝑥)→𝑇)
Abs
Π⊢0𝑒1:[Δ](𝑇1→𝑇2)Π⊢0𝑒2:[Δ]𝑇1
Π⊢0𝑒1𝑒2:[Δ]𝑇2
App
Π⊢0𝑒1:[Δ1]𝑇1Π,̂𝑥:[Δ1]𝑇1⊢0𝑒2:[Δ2]𝑇2
Π⊢0𝗅𝖾𝗍̂𝑥=𝑒1𝗂𝗇𝑒2:[Δ1∧Δ2]𝑇2
Let
Π⊢0():[]𝖴𝗇𝗂𝗍
Unit
𝑞∈{𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾}
Π⊢0𝑞:[]𝖡𝗈𝗈𝗅
Bool
Π⊢0𝑒0:[Δ]𝖡𝗈𝗈𝗅Π⊢0𝑒1:[Δ]𝑇Π⊢0𝑒2:[Δ]𝑇
Π⊢0𝗂𝖿𝑒0𝗍𝗁𝖾𝗇𝑒1𝖾𝗅𝗌𝖾𝑒2:[Δ]𝑇
If
Π⊢0𝑒:𝑆𝑆≤∀𝑆′
Π⊢0𝑒:𝑆′
Sub
A polar scheme is a derivable scheme [Δ−]𝑃+ whose environment entries are negative and whose result is positive.
For 𝖺𝗉𝗉𝗅𝗒, let the two faces of the argument variable be 𝛼−,𝛼+, and let the result faces be 𝛽−,𝛽+. Application compares the positive type supplied by 𝑥 with the negative domain demanded by 𝑓. After eliminating that constraint, the closed polar scheme is [](𝛼+→𝛽−)→(𝛼−→𝛽+). The outer domain 𝛼+→𝛽− is a negative arrow, while the result 𝛼−→𝛽+ is a positive arrow. The shared names record the two faces connected by biunification; an environment entry, when present during the derivation, is always negative.
A bisubstitution𝜉 assigns a positive image 𝜉+(𝛼) and a negative image 𝜉−(𝛼) to each type variable. Its action on rigid heads, joins, meets, and guarded binders is homomorphic; its action on an arrow exchanges the actions in the domain: 𝜉+(𝑁→𝑃)=𝜉−(𝑁)→𝜉+(𝑃),𝜉−(𝑃→𝑁)=𝜉+(𝑃)→𝜉−(𝑁). It acts pointwise on a constraint set or sequence: 𝜉𝐶={𝜉+(𝑃)≤𝖺𝜉−(𝑁)∣(𝑃≤𝖺𝑁)∈𝐶}, and the same convention defines 𝜉𝐻. The identity has 𝗂𝖽±(𝛼)=𝛼, and composition is defined on variable faces by (𝜁∘𝜉)+(𝛼)=𝜁+(𝜉+(𝛼)),(𝜁∘𝜉)−(𝛼)=𝜁−(𝜉−(𝛼)). It is stable when 𝜉−(𝛼)≤𝖺𝜉+(𝛼) for every 𝛼 and 𝜉∘𝜉=𝜉.
The ordering in stability says that the negative requirement is below the positive offer after the action, while idempotence makes reapplication inert.
If 𝛼∉𝖥𝖵(𝑁), eliminate an upper bound 𝛼+≤𝖺𝑁− with 𝜃𝛼≤𝖺𝑁:=[𝑁∧𝛼/𝛼−,𝛼/𝛼+]. If 𝑃+≤𝖺𝛼− and 𝛼∉𝖥𝖵(𝑃), use 𝜃𝑃≤𝖺𝛼:=[𝛼/𝛼−,𝑃∨𝛼/𝛼+]. When the variable occurs in its bound, the exact guarded actions are 𝜃𝛼≤𝖺𝑁=[𝜇𝛽.(𝛼∧𝑁[𝛽/𝛼−])/𝛼−,𝛼/𝛼+],𝜃𝑃≤𝖺𝛼=[𝛼/𝛼−,𝜇𝛽.(𝛼∨𝑃[𝛽/𝛼+])/𝛼+], where 𝛽 is fresh. Substitution across an arrow domain exchanges the positive and negative actions as in definition 19.4; the input guardedness condition ensures that the new recursive occurrence is guarded.
For a finite constraint set 𝐶, define Inst(𝑆∣𝐶):=↑{𝜌(𝑆)∣𝜌(𝑃)≤𝖺𝜌(𝑁)forevery(𝑃≤𝖺𝑁)∈𝐶}, where upward closure uses ≤∀. Let 𝛼∉𝖥𝖵(𝑁) and 𝛼∉𝖥𝖵(𝑃). For every polar scheme 𝑆, Inst(𝑆∣{𝛼≤𝖺𝑁})=Inst(𝜃𝛼≤𝖺𝑁(𝑆)∣∅),Inst(𝑆∣{𝑃≤𝖺𝛼})=Inst(𝜃𝑃≤𝖺𝛼(𝑆)∣∅).
Proof of Lemma 19.6 — Nonrecursive atomic elimination preserves instances
Proof. Fix a substitution 𝜌. Suppose first that 𝜌(𝛼)≤𝖺𝜌(𝑁). Meet introduction and elimination give 𝜌(𝛼)≤𝖺𝜌(𝑁)∧𝜌(𝛼)≤𝖺𝜌(𝛼). Replacing a negative occurrence of 𝛼 by 𝑁∧𝛼 therefore preserves the scheme up to mutual subtyping. Structural induction on 𝑆, with the comparison reversed in every arrow domain, puts the constrained instance in the right-hand upward closure. At a guarded 𝜇-binder, unfold once and close the same comparison by guarded coinduction; the recurrence has crossed an arrow.
Conversely, let 𝑇=𝜌(𝛼) be the image used for an arbitrary instance of the eliminated scheme. Define 𝜌′(𝛼)=𝑇∧𝜌(𝑁), and let 𝜌′ agree with 𝜌 on every other variable. Since 𝛼∉𝖥𝖵(𝑁), 𝜌′(𝛼)≤𝖺𝜌′(𝑁). At each negative occurrence the two instances contain the same meet. At each positive occurrence, meet elimination gives 𝜌′(𝛼)≤𝖺𝑇. Induction on the polar scheme gives 𝜌′(𝑆)≤∀𝜌(𝜃𝛼≤𝖺𝑁(𝑆)). Upward closure therefore gives the reverse inclusion in (19.4).
The lower-bound equality is dual. Under a satisfying instance 𝜌(𝑃)≤𝖺𝜌(𝛼), join introduction and elimination make 𝜌(𝑃)∨𝜌(𝛼) mutually subtype 𝜌(𝛼). Conversely, for an arbitrary eliminated image 𝑇, set 𝜌′(𝛼)=𝜌(𝑃)∨𝑇. The freshness assumption makes 𝜌′(𝑃)=𝜌(𝑃), so the lower bound holds. Structural induction, reversed in arrow domains and closed by guarded coinduction at a 𝜇-back edge, gives the second equality. ◻
Suppose every occurrence of 𝛼 in 𝑁−, respectively in 𝑃+, is guarded by an arrow. For every polar scheme 𝑆, the recursive upper action, respectively lower action, of (19.3) satisfies Inst(𝑆∣{𝛼≤𝖺𝑁})=Inst(𝜃𝛼≤𝖺𝑁(𝑆)∣∅),Inst(𝑆∣{𝑃≤𝖺𝛼})=Inst(𝜃𝑃≤𝖺𝛼(𝑆)∣∅).
Proof. Represent the guarded types by their finite polar automata. For the upper action, merge the negative face of 𝛼 with a meet state containing the old face and the root of 𝑁; for the lower action, merge the positive face with the corresponding join state for 𝑃. These are exactly the two finite graphs denoted by (19.3).
For each finite head-and-edge path, induction on its length gives the same two inclusions as the nonrecursive proof: meet introduction and elimination handle an upper return, while join introduction and elimination handle a lower return. A path that returns to the merged face has crossed an arrow by guardedness, so the induction hypothesis applies after that constructor. Equality on all finite paths yields mutual subtyping of the regular unfoldings by guarded coinduction. Applying the argument at every occurrence in 𝑆, and reversing it in arrow domains, gives both displayed equalities after upward closure. ◻
★★☆ Reconstruct the lower-bound half of lemma 19.6 without citing order duality. State the two instantiations explicitly and identify where 𝑃∨𝑇 is used.
Constraints have the one sorted form 𝑐=𝑃+≤𝖺𝑁−. The partial decomposer 𝗌𝗎𝖻𝖡0 is 𝗌𝗎𝖻𝖡0((𝑁1→𝑃1)≤𝖺(𝑃2→𝑁2))={𝑃2≤𝖺𝑁1,𝑃1≤𝖺𝑁2},𝗌𝗎𝖻𝖡0(𝑏+≤𝖺𝑏−)=∅,𝗌𝗎𝖻𝖡0((𝑃1∨𝑃2)≤𝖺𝑁)={𝑃1≤𝖺𝑁,𝑃2≤𝖺𝑁},𝗌𝗎𝖻𝖡0(𝑃≤𝖺(𝑁1∧𝑁2))={𝑃≤𝖺𝑁1,𝑃≤𝖺𝑁2},𝗌𝗎𝖻𝖡0(⊥≤𝖺𝑁)=∅,𝗌𝗎𝖻𝖡0(𝑃≤𝖺⊤)=∅,𝗌𝗎𝖻𝖡0((𝜇𝛼.𝑃)≤𝖺𝑁)={𝑃[𝜇𝛼.𝑃/𝛼]≤𝖺𝑁},𝗌𝗎𝖻𝖡0(𝑃≤𝖺𝜇𝛼.𝑁)={𝑃≤𝖺𝑁[𝜇𝛼.𝑁/𝛼]}. It is undefined for unequal rigid atoms and for every other head mismatch. In particular, arrow decomposition compares the positive domain 𝑃2 with the negative domain 𝑁1, and the positive codomain 𝑃1 with the negative codomain 𝑁2.
Let 𝐶 be a finite work sequence and 𝐻 a finite set of visited constraints; commas concatenate work sequences. The syntactic algorithm 𝖡0 is the following partial recursive function, where an omitted side condition falls through to the next equation: 𝖡0(𝐻;∅)=𝗂𝖽,𝖡0(𝐻;𝑐,𝐶)=𝖡0(𝐻;𝐶)𝑐∈𝐻,𝖡0(𝐻;𝛼+≤𝖺𝛼−,𝐶)=𝖡0(𝐻;𝐶),𝖡0(𝐻;𝛼+≤𝖺𝑁,𝐶)=𝖡0(𝜃𝐻;𝜃𝐶)∘𝜃𝜃=𝜃𝛼≤𝖺𝑁,𝖡0(𝐻;𝑃≤𝖺𝛼−,𝐶)=𝖡0(𝜃𝐻;𝜃𝐶)∘𝜃𝜃=𝜃𝑃≤𝖺𝛼,𝖡0(𝐻;𝑐,𝐶)=𝖡0(𝐻∪{𝑐};𝗌𝗎𝖻𝖡0(𝑐),𝐶)𝗌𝗎𝖻𝖡0(𝑐)isdefined. If no equation applies, 𝖡0 fails. This syntax-tree presentation is partial: visited pairs stop direct recursive unfolding, but substitutions can still grow syntax. The terminating implementation below runs the same transitions on finite type automata.
For example, the work list {(𝛼−→𝛽+)≤𝖺(𝖨𝗇𝗍+→𝖡𝗈𝗈𝗅−)} first becomes {𝖨𝗇𝗍+≤𝖺𝛼−,𝛽+≤𝖺𝖡𝗈𝗈𝗅−}. Lower-bound elimination changes only positive uses of 𝛼; upper-bound elimination changes only negative uses of 𝛽.
Every successful decomposition step preserves the solution set. Every atomic-elimination step preserves the upward-closed instance set of every attached polar scheme.
Proof of Lemma 19.9 — One work-list step is equisatisfiable
Proof. Arrow inversion gives (𝑁1→𝑃1)≤𝖺(𝑃2→𝑁2)⟺𝑃2≤𝖺𝑁1∧𝑃1≤𝖺𝑁2. The lattice universal properties give the join-left and meet-right cases. Top and bottom cases follow from their bounds. Equal rigid heads discharge; unequal rigid heads have no solution in this frozen grammar. Nonrecursive atomic cases are lemma 19.6. Guarded recursive atomic cases are lemma 19.7. ◻
A local polar type automaton is a finite directed graph with a positive or negative polarity on each state, a finite head set at each state, and domain and range edges. The head alphabet is H0={𝖴𝗇𝗂𝗍,𝖡𝗈𝗈𝗅,𝖨𝗇𝗍,𝖲𝗍𝗋𝗂𝗇𝗀,𝖺𝗋𝗋}. An arrow state has one domain edge, which reverses polarity, and one range edge, which preserves it. A positive join and a negative meet take the union of the corresponding head sets and transitions. A guarded 𝜇-binder adds a back edge; guardedness ensures that every cycle crosses an arrow edge. Variables are distinguished states until an atomic elimination merges a variable face with a bound graph.
The procedure ̂𝖡0 starts from the automata for a finite constraint set and keeps a table of visited positive–negative state pairs. On an unvisited pair it performs exactly the transitions of (19.5)–(19.6): it follows reversed domain edges and aligned range edges, distributes a positive join or negative meet, discharges equal rigid heads, fails on unequal rigid heads, and realizes an atomic action by graph merging. A graph merge changes edges but creates no state. The returned quotient graph determines an idempotent bisubstitution. This finite graph procedure, not the partial syntax-tree recursion, is the total local solver.
Proof. First compare a type with its graph. Induction on an acyclic unfolding shows that equal head languages give mutual subtyping: equal rigid letters use reflexivity; arrow letters use contravariance on domain edges and covariance on range edges; union at a positive state and union at a negative state use the join and meet universal properties, respectively. For a back edge, apply the same argument to one guarded unfolding. Every recurrence crosses an arrow, so guarded coinduction closes the comparison. Conversely, head inversion shows that mutual subtyping cannot change a rigid letter or exchange an arrow head with a rigid head. Thus two same-polarity local types mutually subtype exactly when their automata accept the same head-and-edge language.
Maintain the invariant that the unvisited state pairs are precisely the remaining positive-to-negative constraints. Arrow, join, meet, top, bottom, and rigid-head transitions preserve their solution set by lemma 19.9. An atomic graph merge applies (19.3). Thus lemma 19.6, lemma 19.7 preserve the instance set. Composition preserves (19.7); quotienting merged variable states makes the final action idempotent, and the merge orientation gives 𝜉−(𝛼)≤𝖺𝜉+(𝛼).
A failed transition exposes two unequal rigid heads or an arrow/rigid head mismatch. Head inversion makes either constraint unsatisfiable under every substitution. If no failure is exposed, the quotient action satisfies every visited pair by the invariant, so it is a solution. This proves both directions of clause 3. Finally, a merge creates no state and each recursive call marks a fresh pair. There are at most 𝑛2 pairs; iterating over their incident transitions gives the stated quadratic bound. This is the finite-head instance of the automaton argument in [DM17]; the rigid-letter cases above are local and require no record encoding. ◻
Before combining subterms, rename their generalized type variables apart. A use of ̂𝑥 takes a fresh copy of Π(̂𝑥). The local partial algorithm 𝖯0(Π;𝑒) has the following equations: 𝖯0(Π;̂𝑥)=𝖿𝗋𝖾𝗌𝗁(Π(̂𝑥)),𝖯0(Π;𝑥)=[𝑥:𝛼−]𝛼+,𝛼∉𝖥𝖵(Π),𝖯0(Π;())=[]𝖴𝗇𝗂𝗍+,𝖯0(Π;𝑞)=[]𝖡𝗈𝗈𝗅+,𝑞∈{𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾}. If 𝖯0(Π;𝑒)=[Δ−]𝑃+, then 𝖯0(Π;𝜆𝑥.𝑒)=[Δ−𝑥](Δ(𝑥)→𝑃)+. where Δ(𝑥)=⊤ when 𝑥 is absent. Let inference is 𝖯0(Π;𝑒1)=𝑆1=[Δ−1]𝑃+1,𝖯0(Π,̂𝑥:𝑆1;𝑒2)=[Δ−2]𝑃+2,𝖯0(Π;𝗅𝖾𝗍̂𝑥=𝑒1𝗂𝗇𝑒2)=[Δ−1∧Δ−2]𝑃+2. For application, choose 𝛽 fresh for both subterm schemes and compute 𝖯0(Π;𝑒𝑖)=[Δ−𝑖]𝑃+𝑖(𝑖=1,2),𝜉=̂𝖡0({𝑃+1≤𝖺(𝑃+2→𝛽−)}),𝖯0(Π;𝑒1𝑒2)=𝜉([Δ−1∧Δ−2]𝛽+). For a conditional, infer [Δ−𝑖]𝑃+𝑖 for the condition and two branches, with index 𝑖=0,1,2, and compute 𝜉=̂𝖡0({𝑃+0≤𝖺𝖡𝗈𝗈𝗅−}),𝖯0(Π;𝗂𝖿𝑒0𝗍𝗁𝖾𝗇𝑒1𝖾𝗅𝗌𝖾𝑒2)=𝜉([Δ−0∧Δ−1∧Δ−2](𝑃+1∨𝑃+2)). If a solver call fails, the corresponding inference equation is undefined. Language-preserving automaton minimization may follow a successful call.
The lambda-bound dependency matters. In 𝜆𝑓.𝜆𝑢.𝜆𝑣.𝗅𝖾𝗍̂𝑔=𝜆𝑥.𝗂𝖿𝑓𝑥𝗍𝗁𝖾𝗇𝑥𝖾𝗅𝗌𝖾𝑥𝗂𝗇𝗂𝖿𝗍𝗋𝗎𝖾𝗍𝗁𝖾𝗇̂𝑔𝑢𝖾𝗅𝗌𝖾̂𝑔𝑣, the type of ̂𝑔 depends on the type assigned to 𝑓. Generalizing that dependency would allow the two uses of ̂𝑔 to assume unrelated domains and would invalidate the enclosing typing.
For every finite Π and term 𝑒, 𝖯0(Π;𝑒) terminates. It fails exactly when no scheme 𝑆 satisfies Π⊢0𝑒:𝑆. If it returns 𝑆0, then Π⊢0𝑒:𝑆⟺𝑆0≤∀𝑆. Thus 𝑆0 is sound, complete, and principal up to mutual scheme subsumption, not literal equality of type syntax.
Proof of Theorem 19.13 — Principal inference for MLsub_0
Proof. Proceed by structural induction on 𝑒. A lambda-bound variable introduces one fresh pair of faces, and a let-bound variable takes a renamed copy of its stored scheme, so (19.13) is exactly Var-Lam or Var-Let followed by Sub. Unit and Boolean constants use their corresponding rules.
For abstraction, the induction hypothesis factors every body typing through [Δ−]𝑃+. Deleting 𝑥 and placing Δ(𝑥) in the arrow domain turns the environment comparison in (19.1) into arrow contravariance. This is exactly the premise and conclusion of Abs; the convention Δ(𝑥)=⊤ handles an unused parameter.
For application, the two induction hypotheses factor the function and argument typings through their inferred schemes. Such instances form an App premise exactly when they satisfy 𝑃+1≤𝖺(𝑃+2→𝛽−) for some result face 𝛽−. By theorem 19.11, applying 𝜉 in (19.11) replaces that constrained instance set by the equal unconstrained instance set. The pointwise meet records both lambda-bound environments. Hence the result is sound and every declarative application factors through it.
For a conditional, the same solver argument converts the condition constraint to an unconstrained scheme. Join is the least common result supertype, and the three-way environment meet records all dependencies, proving both directions of (19.13). For let, the induction hypothesis for 𝑒1 gives the scheme stored for ̂𝑥; the hypothesis for 𝑒2 then factors every use of that fresh scheme. Rule Let combines exactly the two negative environments. These cases cover the term grammar. Each recursive inference call is on a proper subterm, and every solver call terminates by theorem 19.11, so 𝖯0 terminates. Solver failure is unsatisfiability, which proves the failure clause. ◻
For the MLsub calculus, polar schemes, guarded equi-recursive types, and biunification algorithm of Dolan–Mycroft:
a returned bisubstitution is stable and solves the input constraints (Theorem 8), while failure implies unsatisfiability (Theorem 9);
the automaton implementation terminates; for 𝑛 states and 𝑚 transitions its worst-case work is 𝑂((𝑛+𝑚)2);
polar inference is sound, complete, and principal for that MLsub signature; and
equality of same-polarity types is equality of the languages accepted by their type automata (Theorem 10), so language-preserving minimization retains the inferred scheme’s instances.
Proof. Items 1, 2, and 4 are imported from [DM17]. The principality construction is the paper’s Section 4 inference development, with the complete principality statement and preorder equivalence given in [Dol17]. Its mechanism uses stable atomic actions on the two polar faces. The full source proof, not the local one-step lemma, establishes their most-generality and the induction that factors a declarative typing through the returned polar scheme. The let case retains the negative-environment dependencies named in definition 19.12. Termination is proved only after types are finite automata: every recursive call marks a previously unvisited pair of states, and there are at most 𝑛2 pairs. ◻
Guardedness is substantive. Without it, a recursive type can contain an unguarded self-loop that contributes no constructor transition, so the finite-state descent used by both the semantic interpretation and the algorithm is not the stated one. Polarity is also substantive: replacing a variable on both faces reproduces the over-restricted type at the chapter’s opening.
★★☆ Infer a polar scheme for 𝜆𝑏.𝜆𝑥.𝜆𝑦.𝗂𝖿𝑏𝗍𝗁𝖾𝗇𝑥𝖾𝗅𝗌𝖾𝑦. Show where the join occurs, and give two incomparable ordinary ML arrow types that are instances of the result.
Adding complement changes the semantic problem. A complement is not a negative face of an MLsub variable: it denotes the values outside a type. The 2022 MLstruct calculus has its own structural records, class tags, unions, intersections, complement, and inference judgment. Its soundness, completeness, and principality claims belong only to that frozen signature [PC22]; they are not instances of theorem 19.14.
The comparison calculus 𝖡𝖠𝖲0 has 𝑇::=0∣1∣𝛼∣𝑇∨𝑇∣𝑇∧𝑇∣¬𝑇∣𝑇→𝑇∣𝜇𝛼.𝑇. Subtyping is semantic inclusion in the paper’s tagged-value model, and equi-recursive types satisfy the paper’s contractiveness condition. This is the MLstruct+ signature of Chau–Parreaux, not 𝖬𝖫𝗌𝗎𝖻0, the 2022 MLstruct calculus, or Simple-sub.
In 𝖡𝖠𝖲0, 𝑇∧¬𝑇 denotes 0 and 𝑇∨¬𝑇 denotes 1. Neither equation exists in 𝖬𝖫𝗌𝗎𝖻0, whose meets and joins are polarity-indexed constructors rather than a single complemented Boolean algebra.
For the contractive MLstruct+ signature of definition 19.15, characteristic Boolean homomorphisms give the paper’s semantic-soundness characterization and terminating subtyping decision procedure. The theorem makes no claim about MLsub, the 2022 MLstruct calculus, or Simple-sub.
Proof of Theorem 19.16 — Boolean comparison boundary; exact import
Proof. Import the characterization, soundness theorem, and decision procedure from [CP26]. Their domain, recursive-type contractiveness, and characteristic homomorphisms are hypotheses of this statement. No translation from MLsub polar schemes to that model has been given, so there is no premise by which theorem 19.14 could be transported. ◻
Simple-sub gives a shorter graph propagation algorithm and valuable implementation examples. Its randomized agreement tests are evidence about its implementation, not a proof that its calculus and MLsub have identical principal schemes [Par20].
★☆☆ Classify each phrase as belonging to 𝖬𝖫𝗌𝗎𝖻0, 𝖡𝖠𝖲0, both, or neither: polar bisubstitution; Boolean complement; guarded equi-recursion; principal polar scheme; characteristic Boolean homomorphism. For every “both” answer, state the different role in each signature.
★★☆ Trace 𝖡0 on (𝛼−→𝛽+)≤𝖺((𝖨𝗇𝗍∨𝖡𝗈𝗈𝗅)+→(𝖲𝗍𝗋𝗂𝗇𝗀∧𝛾)−). List the work set after arrow decomposition and give the positive and negative images of each variable after atomic elimination.
★★☆ Give one satisfying assignment of the directed constraints from exercise 19.5 that ordinary equality unification rejects. Then give one equality solution and show that it is a special instance of the biunification result.
★★★Practical project.polar-biunification Implement the nonrecursive finite polar constraint fragment in Kappa: variables, top, bottom, arrows, joins, meets, constraint decomposition, and occurs-checking atomic elimination. Preserve the invariant that every queued constraint has positive left and negative right polarity. The finished program must solve an upper bound, solve a lower bound, decompose an arrow, reject a rigid mismatch, and reject a self-occurrence that this nonrecursive executable fragment does not solve with a guarded 𝜇-action. Its decidable acceptance test also rejects a constraint between distinct variables instead of silently discarding it. The exact five-case output is in appendix E; Kappa audit must return an empty list.
★★★ Assume a translation 𝗍 sends MLsub joins and meets to Boolean joins and meets. Prove that extending it by the equation 𝗍(¬𝑇)=¬𝗍(𝑇) is not yet a translation of typing schemes: identify the missing operation on negative environments and the missing preservation theorem for instantiation. Give a concrete Boolean equation whose source counterpart is not formed in 𝖬𝖫𝗌𝗎𝖻0.