Lectures onType Theory
Chapter 5
Chapter 5Optional

Semi-Unification and Polymorphic Recursion

Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.

Extend the pure term grammar of chapter 3 by e::=fix f.e. The constructor fix f.e binds f in e. Terms are identified up to alpha-renaming of that binder, and substitution is the capture-avoiding substitution of definition 1.58 with the new clause (fix f.e)[u/x]=fix f.(e[u/x])(fx, fFV(u)), after alpha-renaming f when the freshness condition fails. Operationally, one step unfolds one copy: fix f.ee[fix f.e/f]. The monomorphic-recursion baseline assigns one monotype τ to the binder and requires the body to have that same monotype: Γ,f:τe:τΓfix f.e:τMonoFix.

Now consider fix f.λx.f(λy.x). Choose fresh type variables α,β,γ. If the argument of the outer abstraction has type α, then λy.x has type βα. The recursive occurrence therefore needs an instance f:(βα)γ of ζη.ζη; polymorphic recursion will assign this scheme to f. Under monomorphic recursion, the whole body λx.f(λy.x) has type αγ, so Mono-Fix assigns f that same type. Equating it with the occurrence type and decomposing the outer arrows gives αγ=(βα)γα=βα, which fails the occurs check: a finite first-order type cannot equal a type containing itself as a proper subtree. The missing operation is not another equality solver: each recursive occurrence must be allowed a separate instance of the scheme assigned to the definition. Equation (5.1) also shows that the term diverges when it is applied; typability here is a static property, not a termination claim.

One outer substitution and many matchers

Fix the arrow signature with a countably infinite set V of type variables. Its first-order terms are M,N::=αMN,αV. A finite substitution S maps finitely many variables to arrow terms, fixes every other variable, and extends homomorphically, so S(MN)=S(M)S(N).

Definition 5.1 — Matching

An arrow term M matches an arrow term N, written MsuN, if and only if there is a finite substitution R such that R(M)=N. The substitution R may replace variables of M; it does not first change N.

Thus αsuββ, witnessed by R=[ββ/α]. In contrast, ααsuβγ holds exactly when β=γ: because equal arrow trees have equal left and right children, decomposition gives both R(α)=β and R(α)=γ. Conversely, if β=γ, the matcher [β/α] witnesses the relation.

Definition 5.2 — Semi-unification problem

A semi-unification problem is a finite family I={MisuNi}i=1n. A semi-unifier of I is a finite outer substitution S such that, for every i, there is a finite matching substitution Ri with Ri(S(Mi))=S(Ni). The matchers Ri may differ; the outer substitution S is shared by all inequalities. A mixed problem may also contain equations PjQj; then S(Pj)=S(Qj) is required in addition to equation 5.3. We continue to call this finite mixture a semi-unification problem.

The distinction between S and the Ri is load-bearing. The problem {αsuαα, αsuα(αα)} has the outer solution S=id. Its first matcher sends α to αα; its second matcher sends α to α(αα). Requiring one matcher for the whole family would reject equation 5.4 and would define a different problem.

Unification is recovered by forcing a matcher to give the same result in two positions.

Proposition 5.3 — Equation encoding

For arrow terms M,N and a finite substitution S, S(M)=S(N)(S(M),S(M))su(S(M),S(N)). Here (P,Q) abbreviates the arrow term PQ; longer tuples associate to the right. Thus the same binary constructor forms both the source trees and the pair used by the equation encoding. The right side of equation 5.5 is precisely the replay condition for S on the untransformed inequality because homomorphic extension gives S((M,M))=(S(M),S(M)) and S((M,N))=(S(M),S(N)). Consequently S unifies MN if and only if S semi-unifies (M,M)su(M,N).

Proof of Proposition 5.3 — Equation encoding

Proof. If S(M)=S(N), the identity matcher witnesses the right side of equation 5.5. Conversely, let R witness the right side. Decomposition gives R(S(M))=S(M),R(S(M))=S(N). Transitivity of syntactic equality gives S(M)=S(N). ◻

Exercise 5.1

★☆☆ Use proposition 5.3 to encode (αβ)(γγ) as one inequality. Give its most general unifier and a matcher witnessing the encoded inequality after that unifier is applied.

The next failure is smaller than the undecidability construction, but it shows why an occurs check is still present inside the larger problem.

Lemma 5.4 — Finite-tree obstruction

The singleton problem {ααsuα} has no semi-unifier over finite arrow terms.

Proof of Lemma 5.4 — Finite-tree obstruction

Proof. Suppose S and R satisfied R(S(α)S(α))=S(α). Homomorphic extension gives R(S(α)S(α))=R(S(α))R(S(α)). Define the node count by |α|=1 and |PQ|=1+|P|+|Q|. The assumed equality and equation 5.6 give |S(α)|=1+2|R(S(α))|. Every variable leaf of S(α) is replaced by a nonempty term, and every arrow node is retained. Hence |R(S(α))||S(α)|. Equation 5.7 would imply |S(α)|1+2|S(α)|, which is impossible in N. ◻

Exercise 5.2

★☆☆ Prove by the same node-count argument that {(αβ)αsuα} has no semi-unifier. State where the proof uses finiteness of first-order terms.

The Milner–Mycroft calculus

The complete programming language is the pure extended lambda calculus: e::=xλx.eeelet x=e in efix x.e. The binders and operational clause for fix are those stated at the chapter opening. Constants can be represented by variables in a fixed global environment. Monotypes and predicative schemes are τ::=αττ,σ::=τα.σ. Quantifiers occur only in the prefix of a scheme and range over monotypes. For a scheme σ=α¯.τ, write στ when τ=τ[ν¯/α¯] for a positionwise vector of monotypes ν¯.

Definition 5.5 — Milner–Mycroft typing

The judgment ΓMMe:σ is generated by the HM rules of definition 3.16Var, Inst, Gen, Lam, App, and Let—together with Γ,x:σMMe:σΓMMfix x.e:σMMFix. In Gen, the quantified variable is not free in Γ. In MM-Fix, the recursive occurrences and the body share a scheme, not one monotype. Replacing σ in the premise by a monotype τ gives the ordinary monomorphic-recursion rule, called Mono-Fix below.

The opening term has a complete finite derivation. Put σ=ζη.ζη and Γf=f:σ and Δ=Γf,x:α. The quantified variables ζ,η are distinct from the free variables α,β,γ. Substituting βα for ζ and γ for η witnesses the instance used below. Its application subderivation is Dapp=(f:σ)ΔΔMMf:σVarσ(βα)γΔMMf:(βα)γInst(x:α)(Δ,y:β)Δ,y:βMMx:αVarΔMMλy.x:βαLamΔMMf(λy.x):γApp. Recall that ftv(Γf) is the set of type variables free in the schemes of Γf. Since σ is closed, ftv(Γf)=, so both generalization side conditions below hold. The second Gen conclusion is α.γ.αγ, which is σ up to alpha-equivalence. Using the application subtree, the complete outer derivation is DappΓfMMλx.f(λy.x):αγLamγftv(Γf)ΓfMMλx.f(λy.x):γ.αγGenαftv(Γf)ΓfMMλx.f(λy.x):σGenMMfix f.λx.f(λy.x):σMMFix. The derivation is finite even though the unannotated program diverges when called.

Exercise 5.3

★★☆ Replace MM-Fix by monomorphic recursion and derive the equation α=βα from the two uses of f. Show the occurs-check failure.

Removing schemes from the constraint judgment

A constraint generator needs to remember which type variables may be instantiated. A simple environment A maps term variables to monotypes. The corresponding MM environment Γ maps the same term variables to schemes; A is obtained by erasing each scheme’s quantifier prefix. The formerly bound variables thereby become free in A and remain available to matchers. The nongeneric variables of Γ are the members of ftv(Γ). Initially, the finite sequence ρ¯ contains each such variable α as the variable monotype α, in any fixed order. While the derivation enters a lambda body, it appends that binder’s monotype; leaving the body removes it. The protected set is ρρ¯ftv(ρ). Every other variable of a let- or fix-bound type may be changed by a matcher. Omitting the ambient nongeneric variables would incorrectly permit a monomorphic assumption x:α to be used at the unrelated type ββ.

If ρ¯=(ρ1,,ρk), then (τ,ρ¯) denotes the right-associated arrow tuple (τ,ρ1,,ρk); when k=0, it denotes τ itself. The notation (ρ¯,τ) appends τ to that sequence.

The protected side condition can be calculated before stating the rules. Take Γf=f:δ.δγ. Erasing its prefix gives A(f)=δγ, while its free variable gives the initial protected sequence ρ¯=(γ). Using f at the opening’s occurrence type (βα)γ requires (δγ,γ)su((βα)γ,γ). The matcher [βα/δ] changes the first component and fixes the protected component γ. Distinct variables δ and α permit this inequality. Rule Mono-Fix would identify δ, the domain of the recursive function’s assumed type, with α, the domain of the outer abstraction, and would impose the occurs-check equation α=βα.

Definition 5.6 — First-order Milner–Mycroft templates

The judgment A;ρ¯FOe:τ is generated by the following rules. Each displayed equality or inequality is a side condition on the rule instance.

A(x)=τ(τ,ρ¯)su(τ,ρ¯)
A;ρ¯FOx:τ
FO-Var
A,x:τ1;(ρ¯,τ1)FOe:τ2τ=τ1τ2
A;ρ¯FOλx.e:τ
FO-Abs
A;ρ¯FOe1:τ1A;ρ¯FOe2:τ2τ1=τ2τ
A;ρ¯FOe1e2:τ
FO-App
A;ρ¯FOe1:τ1A,x:τ1;ρ¯FOe2:τ2
A;ρ¯FOlet x=e1 in e2:τ2
FO-Let
A,x:τx;ρ¯FOe:τb(τx,ρ¯)su(τb,ρ¯)(τb,ρ¯)su(τx,ρ¯)(τb,ρ¯)su(τ,ρ¯)
A;ρ¯FOfix x.e:τ
FO-Fix

As in equation 5.5, tuples use right-associated arrows. A matcher witnessing a side condition must fix every component of ρ¯ because the same component occurs on both sides. In FO-Let, occurrence typing through FO-Var may change exactly the variables of τ1 absent from ρ¯; that is where let-generalization is represented. In FO-Fix, the first two side conditions mutually match the assumed type τx and body type τb, so they represent one scheme up to renaming of unprotected variables. The third side condition instantiates that body scheme to the conclusion type τ.

Here is one complete use of the new variable rule. With A=(f:δγ) and protected sequence (γ), the calculated matcher above supplies the only nonlookup premise: A(f)=δγ(δγ,γ)su((βα)γ,γ)A;(γ)FOf:(βα)γFOVar.

Definition 5.7 — Syntax-directed MM presentation

For a monotype τ, let GenΓ(τ)=α¯.τ,{α¯}=ftv(τ)ftv(Γ), where the prefix is standardized apart before use. The syntax-directed Milner–Mycroft judgment ΓSDe:τ has the five rules

Γ(x)τ
ΓSDx:τ
SD-Var
Γ,x:τ1SDe:τ2
ΓSDλx.e:τ1τ2
SD-Abs
ΓSDe1:τ2τΓSDe2:τ2
ΓSDe1e2:τ
SD-App
ΓSDe1:τ1Γ,x:GenΓ(τ1)SDe2:τ2
ΓSDlet x=e1 in e2:τ2
SD-Let
σ=αGenΓ(τb)Γ,x:σSDe:τbστ
ΓSDfix x.e:τ
SD-Fix

Thus instantiation is explicit only at a variable leaf and at the result of a recursive definition; let and fix generalize exactly the variables absent from the ambient environment.

The identity function gives a complete derivation in the syntax-directed judgment: (x:α)αx:αSDx:αSDVarSDλx.x:ααSDAbs.

Theorem 5.8 — Local syntax-directed normalization

For every scheme environment Γ and term e, the following are equivalent:

  1. ΓMMe:σ for some scheme σ;

  2. ΓSDe:τ for some monotype τ.

If an MM derivation ends in a monotype τ, the syntax-directed derivation can be chosen with conclusion τ.

Proof of Theorem 5.8 — Local syntax-directed normalization

Proof. Two transformations are used in the induction. If a type substitution U fixes ftv(Γ), applying U to every displayed monotype in a derivation preserves each rule and its freshness premise. The proof is rule induction; at Gen, rename the quantified variable away from dom(U)ftv(rng(U)) before applying the induction hypothesis. Also, replacing an assumption by a scheme with at least the same monotype instances preserves derivability. This is rule induction again; only Var changes, and its old instance remains available.

For the forward direction, strengthen the induction statement by fixing a requested monotype instance of the concluding scheme. Standardize every prefix and the range of the requested instantiation apart. In Var, the requested monotype is an instance of Γ(x), so SD-Var applies. In Inst, compose the displayed instantiation with the requested one. In Gen, substitute the requested monotype for the freshly bound variable; the side condition ensures that this substitution fixes Γ.

The Lam case applies the induction hypothesis to the body and then SD-Abs. The App case freshens the private variables of its two premises, invokes both induction hypotheses at the common argument monotype, and uses SD-App. For Let, normalize the bound expression to τ1. The scheme GenΓ(τ1) contains every instance supplied by the old bound scheme. Replace the old assumption by this standardized-apart maximal scheme, normalize the body, and apply SD-Let.

For MM-Fix, expose the body monotype τb immediately below the final generalizations and instantiations. Standardize its recursive prefix apart, replace the recursive assumption by GenΓ(τb), and apply the induction hypothesis to the body. The requested result monotype is an instance of that same scheme, so SD-Fix closes the case. This treats Var, Inst, Gen, Lam, App, Let, and MM-Fix; no rule family is delegated.

For the reverse direction, induct on the syntax-directed derivation. SD-Var expands to Var followed by Inst. The abstraction and application cases use the corresponding MM rules. In SD-Let, apply Gen once for each variable in the displayed maximal prefix before Let. In SD-Fix, generalize the body to σ, use MM-Fix, and instantiate its result to τ. Alpha-equivalent prefixes are identified by the binding convention. The construction preserves a specified monotype conclusion. ◻

Lemma 5.9 — Mutual protected matching is renaming

Let P be a finite tuple of arrow terms. If (M,P)su(N,P)and(N,P)su(M,P), then the variables of M outside ftv(P) are carried to the variables of N outside ftv(P) by a bijective renaming that fixes every variable occurring in P. Conversely, every such renaming supplies the two matchers. Thus generalizing exactly the variables absent from P gives alpha-equivalent schemes.

Proof of Lemma 5.9 — Mutual protected matching is renaming

Proof. Let R(M,P)=(N,P) and Q(N,P)=(M,P). A substitution on finite arrow trees never decreases node count: it retains every arrow node and replaces a variable leaf by a nonempty tree. Hence |M||N||M|. Both inequalities are equalities. Every variable leaf changed by either matcher is therefore replaced by one variable leaf, never by an arrow. If two distinct leaf classes of M were identified by R, the corresponding leaves of N would be identical and Q could not recover their distinct occurrence classes. The same argument with M,N interchanged proves that the leaf-class map is surjective. The resulting bijection preserves the complete occurrence pattern. The tuple equations R(P)=P=Q(P) force it to fix the variables of P. A renaming and its inverse prove the converse, and quantifying the variables outside P turns that renaming into alpha-equivalence. ◻

Lemma 5.10 — Scheme representation

Let Γ be a scheme environment. Choose bound variables in its schemes disjoint from one another and from ftv(Γ). Let A erase the quantifier prefixes, and let ρ¯ contain one variable monotype for every member of ftv(Γ). During the induction on e, append the monotype of each lambda binder when entering its body and remove it when leaving that body. Then ΓSDe:τ exists if and only if A;ρ¯FOe:τ exists, up to consistent renaming of variables absent from ρ¯.

Proof of Lemma 5.10 — Scheme representation

Proof. Rule induction on the syntax-directed derivation proves the forward implication.

In the variable case, write Γ(x)=α¯.τx. The MM instance replaces only α¯ and fixes every nongeneric variable. The latter variables are exactly those occurring in ρ¯. The same replacement therefore witnesses (τx,ρ¯)su(τ,ρ¯) and derives FO-Var. The ambient free variables already occur in ρ¯, and the abstraction case adds its domain type, so subsequent matchers fix every nongeneric variable. The application case turns the final App premise into the equality τ1=τ2τ. At a let, variables free in the inferred type of e1 but absent from ρ¯ are precisely the variables generalized by SD-Let. At a fix, standardize the recursive prefix apart from the body monotype. Their erased monotypes are variants outside ρ¯, so lemma 5.9 supplies both protected matchings. The result instance supplies the third protected matching.

For the reverse implication, induct on the first-order derivation. In FO-Var, a witnessing matcher changes no variable of ρ¯; quantify the other variables of A(x), apply Inst, and obtain the conclusion type. In FO-Abs, extend the MM environment by the monomorphic domain and apply the induction hypothesis to the body. The equality side condition then permits Lam. The FO-App case applies the two induction hypotheses and App. In FO-Let, generalize exactly the variables of τ1 absent from ρ¯ before applying the induction hypothesis to e2. In FO-Fix, mutual protected matching makes the recursive template and body variants by lemma 5.9. Quantify their variables absent from ρ¯, identify the resulting schemes up to alpha-renaming, and use SD-Fix; the remaining inequality supplies its result instance. These five cases exhaust the term grammar. ◻

Constraint generation and the forward reduction

Let V0 be the finite set of type-variable names already used in the destination problem. For each syntax-node occurrence p in a term, choose a root type variable ap; for each lambda or fix binder at p, choose a binder variable bp. The entire family {ap}{bp} is pairwise distinct and disjoint from ftv(A)ftv(ρ¯) and from every member of V0. Write ep when p is the root occurrence of e.

Before giving the general recursion, run it on λx.x. Let q be the lambda root and p its variable child. The binder has variable bq; the two root variables are aq,ap. The variable occurrence contributes (bq,bq)binder type andprotected bindersu(ap,bq)occurrence root andsame protected binder, and the lambda contributes aqbqap. Thus the generator must remember both the root q and the binder selected by the occurrence at p. The procedure SEI(A,ρ¯,ep) traverses the syntax once and returns ap with a finite mixed problem.

Definition 5.11 — Generated constraint problem

If the immediate subterms below have roots q and r, the clauses of SEI are: SEI(A,ρ¯,xp)=(ap,{(A(x),ρ¯)su(ap,ρ¯)}),SEI(A,ρ¯,(λx.eq)p)=(ap,E{apbpaq}),SEI(A,ρ¯,(e1qe2r)p)=(ap,E1E2{aqarap}),SEI(A,ρ¯,(let x=e1q in e2r)p)=(ap,E1E2{apar}),SEI(A,ρ¯,(fix x.eq)p)=(ap,E{(bp,ρ¯)su(aq,ρ¯),(aq,ρ¯)su(bp,ρ¯),(aq,ρ¯)su(ap,ρ¯)}). For the abstraction clause, compute (aq,E)=SEI(A[xbp],(ρ¯,bp),eq). For application, compute the two subproblems under A,ρ¯. For let, compute e1 under A,ρ¯ and e2 under A[xaq],ρ¯. For fix, compute the body under A[xbp],ρ¯. Thus two occurrences of the same source variable have different roots, while every occurrence governed by one binder reads the same binder monotype from A.

The construction records equations separately from inequalities. Applying proposition 5.3 converts the result to inequalities only, with a linear increase in size.

The opening term is the smallest useful complete run. Give its fix, abstraction, application, variable, inner abstraction, and inner variable roots the names p,q,r,s,t,u, respectively. The generator returns (bp,bq)su(as,bq),(bq,bq,bt)su(au,bq,bt),atbtau,asatar,aqbqar,bpsuaq,aqsubp,aqsuap.

Mathematical diagramDiagram

node generated clause
p bpsuaq, aqsubp, aqsuap
q aqbqar
r asatar
s (bp,bq)su(as,bq)
t atbtau
u (bq,bq,bt)su(au,bq,bt)

Figure . One complete generator run. Solid edges are syntax edges; dashed edges point from a variable occurrence to its binder. Each node label pairs a root-variable subscript with its source constructor. Each dashed edge is labelled by the binder variable that the occurrence retrieves from A. The table partitions equation 5.10 by the node that emits each clause.

The following outer substitution solves the equations: S(bp)=δγ(chosen recursive template),S(bq)=α(chosen outer-lambda domain),S(bt)=β(chosen inner-lambda domain),S(au)=α(identity witness for the occurrence of x),S(at)=βα(inner abstraction equation),S(ar)=γ(chosen application result),S(as)=(βα)γ(application equation),S(aq)=αγ(outer abstraction equation),S(ap)=αγ(identity result matcher). The first inequality uses Rs=[βα/δ]; the second uses the identity; the two recursive variant inequalities use Rxb=[α/δ] and Rbx=[δ/α]; the result inequality uses the identity. Each matcher fixes its displayed protected components. For example, Rs(S(bp),S(bq))=((βα)γ,α)=(S(as),S(bq)). The independent variables δ and α are essential: the two opposite matchers identify their generalized schemes without forcing the recursive template to equal the monomorphic outer-lambda domain.

The same witness gives the complete first-order derivation. With A(f)=δγ, let Dapp be the following complete application subderivation: (δγ,α)su((βα)γ,α)f:δγ,x:α;(α)FOf:(βα)γFOVar(α,α,β)su(α,α,β)f:δγ,x:α,y:β;(α,β)FOx:αFOVarf:δγ,x:α;(α)FOλy.x:βαFOAbsf:δγ,x:α;(α)FOf(λy.x):γFOApp. The remaining two rule instances are Dappf:δγ;()FOλx.f(λy.x):αγFOAbsδγsuαγαγsuδγαγsuαγ;()FOfix f.λx.f(λy.x):αγFOFix. Here the three final matchers are Rxb, Rbx, and the identity.

Theorem 5.12 — Constraint characterization

Let (ap,E)=SEI(A,ρ¯,ep), and let S be any finite substitution. Then S semi-unifies ES(A);S(ρ¯)FOe:S(ap). The matcher attached to each generated inequality is used as the matcher of the corresponding first-order rule premise. Consequently a closed term is Milner–Mycroft typable exactly when its generated mixed problem is semi-unifiable.

Proof of Theorem 5.12 — Constraint characterization

Proof. Proceed by structural induction on e while keeping the same outer substitution S throughout. This formulation avoids combining independently chosen substitutions from sibling subterms.

Variable. The only generated constraint is (A(x),ρ¯)su(ap,ρ¯). A first-order variable derivation has exactly that side condition after applying S. The generated matcher is therefore equivalent to the premise of FO-Var.

Abstraction. The induction hypothesis identifies the body constraints with S(A)[xS(bp)];(S(ρ¯),S(bp))FOe:S(aq). The remaining generated equation says S(ap)=S(bp)S(aq), exactly the conclusion type of FO-Abs.

Application. The two induction hypotheses use the restrictions of the same S to E1 and E2. The final equation is S(aq)=S(ar)S(ap), which is precisely the arrow premise of FO-App. Reading this argument backward proves the converse.

Let. The first induction hypothesis derives e1:S(aq). The second derives e2:S(ar) under x:S(aq). Rule FO-Let gives the body type, and S(ap)=S(ar) is the remaining generated equation. Conversely, inversion of FO-Let and that equality recovers both subproblem solutions.

Fix. The body induction hypothesis derives S(A)[xS(bp)];S(ρ¯)FOe:S(aq). The three remaining generated inequalities are, in order, the two mutual protected matchings between S(bp) and S(aq) and the protected matching from S(aq) to S(ap). They are exactly the three side conditions of FO-Fix. Inverting that rule reads the same argument backward.

These five constructor cases establish both directions. For empty A and ρ¯, combine this result with lemma 5.10, theorem 5.8 to obtain the final closed-term claim. ◻

Definition 5.13 — Encodings and log-space reduction

A closed source term is serialized in prefix form by vjlamEappEEletEEfixE, where a de Bruijn index names a binder by distance: index 0 names the nearest enclosing binder and indices increase outwards. Number syntax nodes in prefix-tree order: visit the root first and then visit children from left to right. Assign each constructor a fixed binary payload and frame every payload w by fr(w)=1|w|0w. Binary numerals use the same frame. Fix the constructor payloads v=00, lam=01, app=10, let=110, and fix=111. The exact token stream for λx.x is fr(01)fr(00)fr(0). Well-formedness requires every variable index to be smaller than the number of enclosing binders.

For output records, fix payloads x=000, arr=001, eq=010, and leq=011. Encode ai by numeral 2i and bi by numeral 2i+1. Thus arrow terms are framed prefix records, and a mixed problem begins with framed binary counts of its equations and inequalities, followed by that many framed records. These choices define the decision problems below; malformed strings are negative instances.

A log-space many-one reduction from a language P to a language Q is a deterministic transducer with read-only two-way input, write-only output, and O(logn) work bits that emits a string F(w) satisfying wP if and only if F(w)Q. The output head is not readable, so a transducer may rescan its input but may not use its output as storage.

The two-node input λx.x gives an exact emission trace. A preliminary scan validates the stream, counts two nodes, one equation, and one inequality, and emits the equation and inequality counts fr(1)fr(1). Prefix-tree nodes 0 and 1 are the lambda and variable. In the remaining output, each underbrace decodes the framed field above it: eq:fr(010)equation tagfr(000)fr(0)a0fr(001)fr(000)fr(1)fr(000)fr(2)b0a1,leq:fr(011)inequality tagfr(001)fr(000)fr(1)fr(000)fr(1)(b0,b0)fr(001)fr(000)fr(2)fr(000)fr(1)(a1,b0). The row labels are the decoded clauses a0b0a1 and (b0,b0)su(a1,b0). Resolving index 0 at node 1 selects the binder at node 0; no path is stored between the two scans.

Corollary 5.14 — Forward reduction

Closed-term Milner–Mycroft typability in the calculus of definition 5.5 is log-space many-one reducible to semi-unifiability over the arrow signature.

Proof of Corollary 5.14 — Forward reduction

Proof. By theorem 5.8, lemma 5.10, theorem 5.12, a closed term is typable exactly when its generated problem has a semi-unifier.

First make one validation pass. Framing lets the transducer advance from one record to the next with an input-position and payload-length counter. It checks constructor arities and binder-index bounds while maintaining the current binder depth. The same pass computes the exact syntax-node count N and the numbers of generated equation and inequality clauses: a variable contributes one inequality clause, a lambda or application one equation clause, a let one equation clause, and a fix three inequality clauses. It emits the latter two counts before the records. Put I={ααsuα}. If the input is malformed or open, the transducer emits I and stops.

For each number i=0,,N1, the record-emission pass rescans the input with a node counter and a prefix-tree depth counter until it reaches node i, then emits the clause determined by that constructor. Root and binder variables are the binary node numbers tagged by a or b. To find the binder of a variable occurrence, enumerate earlier binder nodes. For each candidate, a rescan computes the interval of node positions occupied by its body and tests whether the occurrence lies in that interval; counting the containing candidates from inside outwards resolves the de Bruijn index. The same enumeration, restricted to lambda candidates, emits the protected sequence from the outermost enclosing lambda to the innermost. Returning from a child requires no stored path: another rescan finds the child’s interval of prefix-tree positions and its parent’s constructor.

Every live value is an input position, node number, depth, binder count, or output-length counter, hence uses O(logn) bits. There are O(n) constraints and each protected tuple contains at most n tagged variables, so the mixed output has O(n2) tokens. Converting an equation to the pair inequality of proposition 5.3 adds a fixed wrapper around two copies addressed by rescans and keeps the same polynomial bound. The transducer therefore satisfies definition 5.13. ◻

The converse reduction and the exact negative boundary

The converse construction must preserve one outer substitution while allowing a different matcher for each inequality. A plain lambda binding preserves one type for repeated occurrences and therefore encodes equations. A polymorphic recursive binding permits its occurrences to instantiate the definition type and therefore encodes inequalities. Moving all ordinary bindings under one outer recursive binder leaves only one occurrence of fix; pairing collects the finitely many checks without changing their individual matching substitutions.

It is useful first to separate an auxiliary product calculation from its pure-lambda implementation. In the auxiliary calculation, products have types τ×ρ, introduction P,Q:τ×ρ, and the two projections. These are derived bookkeeping rules, not constructors of the target language.

The implementation uses the following pure lambda terms: P,Qλk.kPQ,P.1P(λu.λv.u),P.2P(λu.λv.v), with right-nested tuples and their projections defined recursively. Even a one-component tuple is P,K and its component is the first projection; this convention makes the singleton calculation below exercise the same eliminator as a longer family. Write PλQ for λz.zP,zQ, and put Kλu.λv.u. For the expansion, use the result-indexed abbreviation (τ,ρ)δ:=(τρδ)δ. Then P,Q:(τ,ρ)δ whenever P:τ and Q:ρ. The result type δ is an index, not a uniquely determined type: the same pair introduction has this type for every δ. A first projection fixes δ=τ and a second projection fixes δ=ρ. Applying both projections to one monomorphic pair could therefore force τ=ρ. The encoder below projects each instantiated recursive occurrence once, so every elimination determines only its own result index. The equality gadget is typable exactly when P and Q receive the same monotype.

Rename the arrow constructor of a source problem to the formal product constructor; this signature isomorphism preserves semi-unifiers in both directions. For a vector z=(zα) indexed by the source variables, define Mz by replacing a variable α with zα and a binary node with the auxiliary pair. A simple type environment A on those term variables extends homomorphically through the formal product constructor; write the resulting product type as A(M). In particular, A(M) does not mistake a source binary node for a function type.

Lemma 5.15 — Representation and substitution correctness

Let A be a simple type environment. Let M,N be source trees whose variables belong to dom(A), and let {MisuNi}i=1m be a finite family whose variables also belong to dom(A).

  1. AMMMz:τ holds in the derived pair rules exactly when τ=A(M).

  2. If A(M)=A(N), then M and N have a first-order unifier.

  3. If A(Mi)suA(Ni) for every member of a finite family, then that family has a semi-unifier obtained by quotienting the auxiliary types back to source trees.

Proof of Lemma 5.15 — Representation and substitution correctness

Proof. For item 1, induct on M. A variable uses its unique assumption in A. At a binary node, the two induction hypotheses and the derived pair rule give the homomorphic pair type; inversion of that rule gives the converse.

For items 2 and 3, the auxiliary signature must first be returned to the one-constructor source signature. Serialize each non-product-rooted auxiliary monotype T, and let ι(T) be the source variable whose index is that serialization. Thus ι is injective. Define the quotient q by q(T1×T2)=q(T1)q(T2),q(T)=ι(T)when T is not product-rooted. Although ι is defined on every finite auxiliary monotype, evaluating q on the present finite family queries only finitely many of its values. Define the source substitution SA(α)=q(A(α)). Structural induction on M gives the commuting equation SA(M)=q(A(M)). If A(M)=A(N), applying q and equation 5.11 shows that SA unifies M and N.

For item 3, let Ri(A(Mi))=A(Ni). A maximal nonproduct component of A(Mi) is a non-product-rooted subtree whose parent, if it has one, is a product. Define a finite source matcher ri by ri(ι(T))=q(Ri(T)) for every such component T, and let ri fix all other variables. A second structural induction, now on the product skeleton of A(Mi), gives ri(q(A(Mi)))=q(Ri(A(Mi))). Combining the two commuting equations with the witness equality gives the annotated calculation ri(SA(Mi))=ri(q(A(Mi)))by equation 5.11=q(Ri(A(Mi)))by equation 5.12=q(A(Ni))because Ri(A(Mi))=A(Ni)=SA(Ni)by equation 5.11. Thus SA is one shared outer substitution and the ri are the required source matchers. ◻

Lemma 5.16 — Result-indexed Church formation and inversion

Give every syntactic pair occurrence o in Mz a result index δo. Define CΔ(A,xα)=A(α),CΔ(A,(P,Q)o)=(CΔ(A,P)CΔ(A,Q)δo)δo. The Church expansion of Mz has type CΔ(A,M) for every index assignment Δ. Conversely, every typing of that expansion is CΔ(A,M) for a uniquely determined type at each leaf and some, generally nonunique, result-index assignment Δ.

Proof of Lemma 5.16 — Result-indexed Church formation and inversion

Proof. Induct on M. At a variable leaf, Var gives the type selected by A. At a binary node o, the induction hypotheses type the two expanded children. Assign k the arrow type CΔ(A,P)CΔ(A,Q)δo; two applications followed by one abstraction give the displayed type.

For inversion, a typing of λk.kPQ ends, after theorem 5.8, with abstraction and two applications. Their arrow equations force types τP,τQ,δo and the result (τPτQδo)δo. Apply the induction hypotheses to P and Q. No rule equates δo with another index unless the surrounding term eliminates this occurrence, which is why the assignment is not claimed unique. ◻

For I={MisuNi}i=1m, let x list its source variables. For each i, use a fresh vector yi of the same length. The subscript on states which vector represents source variables. Define eIfix f.λx.KM1x,,Mmxλy1.((fy1).1λN1x),,λym.((fym).mλNmx). The first argument of K fixes the result type of the recursive definition to the tuple of the A(Mi). The second argument is checked but hidden from that result. The local vector yi supplies an independent instance of the recursive scheme, whereas the right side uses the outer vector x. The equality gadget therefore imposes Ri(A(Mi))=A(Ni) rather than comparing two locally instantiated trees.

For the singleton problem {αsuβα}, the source-variable order (α,β) gives the auxiliary term fix f.λxαxβ.Kxα,Kλyαyβ.((fyαyβ).1λxβ,xα),K. Its pure expansion replaces xα,K by λk.kxαK and (fyαyβ).1 by (fyαyβ)(λu.λv.u); expanding the equality gadget gives λz.λk.k(z((fy)(λu.λv.u)))(z(λh.hxβxα)). With outer substitution S=id, the local matcher R=[βα/α] types the recursive occurrence at the required component: its projected type becomes βα, the type of the source tree on the right. In the auxiliary calculation, the outer pair xβ,xα has the renamed product type β×α. This one inequality exercises the tuple, first projection, equality gadget, K, and the independent recursive instance.

Lemma 5.17 — Whole-encoder Church adequacy

Expand every auxiliary pair and projection in equation 5.13 by the displayed pure lambda terms. The expanded term is MM typable if and only if the auxiliary-product term is typable.

Proof of Lemma 5.17 — Whole-encoder Church adequacy

Proof. For the forward construction, process each pair occurrence from its enclosing elimination inward. A first projection assigns its pair index the first component type; an ith projection down a right-nested tuple assigns the successive indices to the right-tail types and the final selected index to the ith component type. Pair occurrences used only for formation receive fresh indices. The two applications in every projection and the formation calculation of lemma 5.16 then expand the auxiliary derivation. Different recursive occurrences first instantiate the scheme of f, so their index assignments are independent.

Conversely, normalize a typing of the pure expansion. Invert each λk.kPQ by lemma 5.16. Invert P(λu.λv.u): the application equation forces the result index of P to equal the first component type. The second projection forces the analogous second-component equation. Replace these introduction and elimination subderivations by the corresponding auxiliary product rules. The equality gadget has body zP,zQ; its two applications force P and Q to have the same domain type. The remaining cases are variables, abstraction, application, K, and the single fix; their rules are unchanged. Structural induction over the fixed encoder syntax therefore reconstructs the complete auxiliary derivation. ◻

Theorem 5.18 — Converse reduction

Let I be a finite semi-unification problem over arrow terms. In logarithmic work space, the construction above computes a pure term of the form eI=fix f.e, obtained by expanding equation 5.13, such that e contains neither fix nor let and I is semi-unifiableeI is Milner--Mycroft typable. The target is the exact pure calculus of definition 5.5; in particular, the construction does not add products as source primitives.

Proof of Theorem 5.18 — Converse reduction

Proof. Work first in the auxiliary product calculation. Suppose that S and Ri semi-unify I. Let J(T) replace every source arrow in T by the auxiliary product. For a source substitution U, define the auxiliary substitution JU by (JU)(α)=J(U(α)). Structural induction on T gives (JU)(J(T))=J(U(T)). Assign each source term variable xα the type (JS)(α). By lemma 5.15(1), the first tuple in equation 5.13 has component types J(S(Mi)). Generalize the type of f at MM-Fix. At its ith occurrence, instantiate that scheme with JRi; the ith projection therefore has type (JRi)(J(S(Mi)))=J(Ri(S(Mi)))=J(S(Ni)). The equality gadget, tuple formation, the lambda binders, and K give a typing of the auxiliary term. Apply lemma 5.17 to obtain a pure typing.

Conversely, use lemma 5.17 to reconstruct an auxiliary typing, and normalize it by theorem 5.8. Invert the outer fix, lambdas, and the first tuple. The types of the bound xα determine a simple environment A, and lemma 5.15(1) makes the ith result component A(Mi). Each recursive occurrence is an independent instance of the generalized type of f. Inverting its projection and equality gadget therefore supplies a matcher with A(Mi)suA(Ni). Item 3 of the lemma gives one shared outer substitution and one matcher per source inequality. Hence I is semi-unifiable.

For the space bound, first validate the framed counts and every tree record. Put e:=fix f.λx.xx,e+:=fix f.λx.x. A malformed string is sent to the fixed untypable restricted term e. A valid empty family is sent to the fixed typable restricted term e+. For a nonempty valid family, use the serializations of definition 5.13. Enumerate distinct source variables by their first input occurrence: for each candidate, rescan the earlier prefix to test whether the same length-delimited name has appeared. To emit the ith tuple component or projection, store only the binary counters i,m and rescan to the corresponding inequality. A source tree is emitted by its node number in prefix-tree order; returning from a child is reconstructed by rescanning with node and depth counters, not by storing its path. Right-nested tuples and Church templates add O(m) wrappers, and copied trees give at most quadratic output size. All live counters use O(logn) bits, so the encoder meets definition 5.13. ◻

Deleting polymorphic recursion collapses the separate occurrences of f to one monotype and destroys equation 5.15.

Corollary 5.19 — Log-space equivalence

The following decision problems are log-space equivalent:

  1. Milner–Mycroft typability for closed terms;

  2. semi-unifiability over arrow terms;

  3. Milner–Mycroft typability for closed terms with one top-level fix and no let.

Proof of Corollary 5.19 — Log-space equivalence

Proof. The first reduction is corollary 5.14. The second is theorem 5.18. For the remaining reduction, parse the input as the item-3 fragment. A well-formed fragment term is copied unchanged. A malformed string or a well-formed term outside the fragment is sent to the fixed untypable unrestricted term u:=λx.xx. The parser uses counters for framing, binder depth, and the number and position of fix tokens, hence logarithmic work space. This guarded copy preserves both positive and negative instances on the whole string language. ◻

The source of undecidability can be stated at an even smaller signature.

Definition 5.20 — Computability interface

A deterministic one-tape Turing machine consists of finite state and tape alphabets, a start state, a halting state, a blank symbol, and a partial transition function Q×ΣQ×Σ×{L,R}. Its input word occupies consecutive cells of an otherwise blank two-way infinite tape. Let code(T) be the prefix structural serialization of the finite transition table, and put join(u,v)=fr(u)fr(v) using the framing function of definition 5.13. Let HaltTM1 be the language of strings join(code(T),w) for which this machine reaches its halting state. Malformed pairs are outside the language.

A total function on strings is computable when a one-tape machine halts on every input and writes its output. A language P many-one reduces to Q when a total computable function F satisfies wP if and only if F(w)Q. A language is A machine decides P when it halts on every string and returns 1 exactly on members of P and 0 on nonmembers. A language is undecidable when no one-tape machine decides it. A language is recursively enumerable when some one-tape machine halts exactly on its members. It is r.e.-hard when every recursively enumerable language many-one reduces to it, and r.e.-complete when it is both recursively enumerable and r.e.-hard.

Lemma 5.21 — The one-tape source is r.e.-complete

The language HaltTM1 of definition 5.20 is r.e.-complete.

Proof of Lemma 5.21 — The one-tape source is r.e.-complete

Proof. A one-tape universal simulator recognizes HaltTM1: it stores the simulated finite nonblank tape interval with a marked head, scans to the encoded transition table, rewrites the marked cell, and repeats. It halts exactly when the simulated machine halts, so the source is recursively enumerable.

Let P be recursively enumerable, witnessed by a fixed one-tape machine TP. The function wjoin(code(TP),w) is total computable and its output belongs to HaltTM1 exactly when wP. Hence every recursively enumerable language reduces to the source. ◻

Lemma 5.22 — The one-tape source is undecidable

No total one-tape machine decides HaltTM1.

Proof of Lemma 5.22 — The one-tape source is undecidable

Proof. Suppose a total machine H returned yes exactly on the halting pairs. Build a one-tape machine D which, on input x, runs H on the framed pair join(x,x), loops when H returns 1, and halts when H returns 0. The finite transition table of D has the structural serialization d=code(D). On input d, D(d) haltsH(join(d,d)) returns 0D(d) does not halt, a contradiction. ◻

Lemma 5.23 — Finite support for semi-unification

The total valuations used in the imported semi-unification problem and the finite substitutions of definition 5.2 have the same solutions on a finite input. An outer valuation need only be retained on ftv(I); after it is chosen, matcher i need only be retained on ftv(S(Mi)).

Proof of Lemma 5.23 — Finite support for semi-unification

Proof. Every replay inspects the outer valuation only at variables in the input trees. Its matched left side then inspects Ri only at variable leaves of S(Mi). Restricting the valuations to those finite domains therefore preserves every replay equation. Conversely, extend each finite map by the identity on variables outside its domain. Homomorphic extension on the finite input trees gives the same replay, so the extensions are total solutions. ◻

Dudenhefner’s one-tape library model packages a finite state type, a total transition on a state and one optional tape symbol, a Boolean halting test, and an initial tape. The value None denotes a blank cell and Some(a) denotes a cell containing a; the move component is left, right, or stationary. Write HaltTM1lib for its halting language.

Lemma 5.24 — Machine-model bridge

From a local string join(code(T),w) one can compute a machine T^ and initial tape tw in Dudenhefner’s library model such that T halts on w(T^,tw)HaltTM1lib. The conversion and both structural serializers are total computable.

Proof of Lemma 5.24 — Machine-model bridge

Proof. Use the local tape alphabet as the library alphabet and represent a blank cell by None and a written symbol by Some(a). The library state type is the finite local state set plus one fresh sink. On a defined local transition, T^ writes the corresponding optional symbol, moves left or right, and enters the corresponding state. On an undefined nonhalting transition, it enters the sink; the sink writes the same symbol, does not move, and loops. The library Boolean halting test is true exactly at the image of the designated local halting state. Place the letters of w in consecutive optional cells to obtain tw.

Let ιQ be the inclusion of the local state set into the enlarged library state set. For a local configuration c=(q,h,t), define E(c)=(ιQ(q),h,t^),t^(n)={None,t(n) is blank,Some(t(n)),t(n) is written. For every defined nonhalting local step cTc, direct inspection of the transition table gives E(c)T^E(c). Induction on the number of local steps gives the forward simulation. Conversely, a library run that reaches a Boolean-halting state never entered the sink, so inversion of each preceding transition reconstructs the local run. The construction traverses finite transition tables, state lists, and the word w, so a one-tape transducer computes its framed serialization by repeated scans and copying. ◻

Theorem 5.25 — Exact constructive reduction import

For the source language HaltTM1 above and the arrow-only semi-unification problem of definition 5.2, there is a total computable function F such that join(code(T),w)HaltTM1F(join(code(T),w)) is semi-unifiable.

Proof of Theorem 5.25 — Exact constructive reduction import

Proof. The imported theorem has the library source HaltTM1lib, not the local partial-transition source. Dudenhefner’s Theorem 5.23 and its mechanized Section 6 endpoint prove HaltTM1libmSemiU [Dud23]. The imported construction is the composition through binary Post correspondence, binary stack-machine halting, two-counter halting, one-counter halting, deterministic and confluent stack-machine uniform boundedness, simple semi-unification, and right-uniform two-inequality semi-unification. The source proves every component reduction and their composition; reconstructing that development would require more than ten pages. The paper’s variables are natural numbers, its terms are generated only by variables and one binary arrow, and its solutions are total valuations.

Let G denote the imported Coq reducer. It is a terminating structural program on finite inductive encodings. A one-tape evaluator stores the current framed constructor record beside an explicit stack of pending subterms, scans the finite program table to select the next clause, and writes the resulting framed constructor record at the right end of its work tape. Induction on the finite recursive call tree shows that, on input x, this evaluator writes the structural serialization of G(x). Termination of G(x) therefore gives termination of the evaluator. The input and output serializers consequently realize a total computable string function.

Compose that function with lemma 5.24. A malformed local source string is sent to the named negative problem I from the forward reduction. Lemma 5.23 supplies exactly the finite-substitution consequence used in this chapter. ◻

Theorem 5.26 — Constructive semi-unification boundary

Let arrow terms be generated by variables and one binary constructor (). The many-one problem of definition 5.2 is recursively enumerable complete. More precisely, one-tape Turing-machine halting constructively many-one reduces to this problem.

Proof of Theorem 5.26 — Constructive semi-unification boundary

Proof. By lemma 5.21, theorem 5.25, semi-unification is r.e.-hard.

For recursive enumerability, code variables as α0,α1,. At stage n, enumerate every outer substitution on ftv(I) whose range trees have total size at most n and use only α0,,αn. For each candidate S and each inequality MisuNi, compute the finite domain Di=ftv(S(Mi)); enumerate all matchers on Di with the same size and variable bound. Test the equations and all structural replays. Every loop at stage n is finite. Every finite witness is alpha-renamable into some stage, and lemma 5.23 shows that no total valuation witness is missed. Dovetailing the stages therefore halts exactly on the semi-unifiable inputs. Thus the problem is recursively enumerable as well as r.e.-hard. ◻

Corollary 5.27 — Undecidability

Milner–Mycroft typability is undecidable, even for pure terms containing one top-level fix and no let.

Proof of Corollary 5.27 — Undecidability

Proof. If the restricted typability problem were decidable, compose its decider with theorem 5.18. This would decide the recursively enumerable complete problem of theorem 5.26, contradicting lemma 5.22. ◻

Remark 5.28 — Boundary of the negative result

The corollary concerns inference of whether an unannotated term has any Milner–Mycroft typing. It does not concern ordinary HM inference, whose principal algorithm was proved in chapter 3. The local Mono-Fix rule is this chapter’s monomorphic-recursion comparison baseline; the HM theorem in chapter 3 made no claim about recursive bindings. The corollary also does not make checking a supplied finite typing derivation undecidable. The 2023 construction imported above is the load-bearing reduction.

Definition 5.29 — Fixed-annotation checking

To check a supplied recursive annotation σ=α¯.τ, replace α¯ by fresh rigid constants κ¯. A rigid constant is a type name that unification may compare but may not replace. The ambient variables ftv(Γ) are rigid for the same run. All unknown types introduced while checking lambdas and applications are flexible variables; unification may replace only these variables. Each occurrence of the recursive name receives a fresh flexible instance of the written scheme.

Assign every rigid constant κ and flexible variable μ the binder depth (κ) or (μ) at which it was created, with depth increasing under a binder. A substitution θ is well scoped when κftv(θ(μ))(κ)(μ). A rigid escape is a pair (μ,κ) that violates this inequality. The checker accepts exactly when the body checks against τ[κ¯/α¯], rigid constants remain unchanged, the occurs check succeeds, and no rigid escape occurs.

For example, the annotation α.αα accepts the body λx.x: replacing α by κ gives target κκ, so the lambda binds x:κ and its variable body checks at κ. The annotation α.α rejects the same body. The lambda would require the equation κ=ββ for a flexible β, but solving it would replace the rigid constant κ.

Suggested first pass.

None of these problems is a prerequisite for later chapters. Use the two board problems exercise 5.4, exercise 5.5; leave the fragment checker in exercise 5.6 and the three-star project in exercise 5.7 for an extended pass.

Exercise 5.4

★★☆ For I={ααsuβγ, βγ}, give an outer substitution S and the matching substitution for the inequality. Prove that every semi-unifier of I makes β and γ equal, and explain why this restriction belongs to S, not to the per-inequality matcher.

Exercise 5.5

★★☆ For a problem containing only equations, use proposition 5.3 to prove that semi-unifiability coincides with first-order unifiability. Then identify the exact FO-Fix side condition that introduces a genuine inequality. State why deleting let does not delete that condition.

Exercise 5.6

★★☆ Replace MM-Fix by a rule requiring the recursive scheme α.αγ to be written as a source annotation. Implement the checker of definition 5.29 for one annotated rule instance. Prove soundness and completeness for a fixed annotation. Explain why this does not decide whether an annotation exists.

Exercise 5.7

★★★ Practical project.semi-unification-reduction-checker Implement a checker for finite arrow terms, outer substitutions, and one matcher per inequality. Maintain the invariant that a reported SOLVED result is accompanied by substitutions whose structural replay verifies every instance of equation 5.3. Print the generated or supplied constraints and each replay result. For this executable corpus only, extend the arrow signature by the rigid nullary constructor Bool. It is a test constant, not a type variable and not part of the arrow-only undecidability statements. The acceptance test must:

  1. solve the ordinary unification equation αBool;

  2. solve both inequalities in equation 5.4 using distinct matchers;

  3. reject ααsuα with the finite-tree certificate of lemma 5.4, derived from that exact input rather than supplied independently; and

  4. solve (δγ,γ)su((βα)γ,γ), the protected polymorphic-recursion constraint of equation 5.9.

A bounded search may also print UNKNOWN; fuel exhaustion is never reported as rejection.

The rejection certificate is a quadruple (cL,kL,cR,kR) representing cL+kLn>cR+kRn(nN). Accept this symbolic certificate only when cL>cR and kLkR. For lemma 5.4, use (1,2,0,1) after substitution monotonicity has reduced the replay to 1+2n>n. This check is independent of a supplied candidate substitution.

Construct every printed constraint, substitution, replay, status, and final summary from computed data. Each inequality trace must show its outer substitution, including outer=[], and its local matcher. As a mutation test, omit application of every local matcher. The two matcher-dependent families contain three inequality traces, all of which must change to FAILED. The two aggregate status lines must change to FAIL, and the aggregate must report failure.

Bibliographic notes.

The Milner–Mycroft calculus, syntax-directed normalization, and the two reduction architectures originate in Henglein’s development [Hen93]; the recursive typing discipline was introduced by Mycroft [Myc84]. The constructive arrow-only boundary and exact import used here are due to Dudenhefner [Dud23]; the earlier proof route and a compact mechanized middle reduction are recorded in [Dud20].

Search the book

Type to search the local edition.