Lectures onType Theory
Chapter 62
Chapter 62Optional

Nominal Syntax, Support, and Binding

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

The raw substitution clause (λ(b:A).t)[u/a]=?λ(b:A).t[u/a] fails when b occurs free in u. For example, it sends (λ(b:A).a)[b/a] to λ(b:A).b and captures the free b. Renaming the binder first to an atom c{a,b} gives λ(c:A).b. Nominal syntax must make this choice independent of c while retaining atoms as data.

Atoms and name abstraction

HOAS makes alpha-renaming an LF conversion, but it does not provide an object-level atom that a program may compare or choose fresh. Nominal syntax keeps atoms as data while quotienting the choice of a bound atom.

Definition 62.1 — Atoms and finite permutations

Let A be a countably infinite set of atoms, which are names that may be permuted. A finite permutation π:AA is a bijection that moves only finitely many atoms. Composition and inverse make these permutations a group. The transposition (a b) exchanges a and b and fixes every other atom.

Definition 62.2 — Support, freshness, and equivariance

Let the group of finite permutations of A act on a set X. A finite set SA supports xX when every permutation that fixes each atom of S also fixes x. A set in which every element has finite support is a nominal set. The least finite support of x is written supp(x). Write a#x, read a is fresh for x, if and only if asupp(x).

A map f:XY of nominal sets is equivariant if and only if f(πx)=πf(x) for every finite permutation π. A predicate is equivariant when its truth value is invariant under the simultaneous permutation of all nominal parameters.

Proposition 62.3 — Least finite support

Every finitely supported element has a unique least finite support. If S supports x, then supp(x)S. In particular, a#x if and only if some finite support of x omits a. Moreover, if c#x and bc, then bsupp(x)(b c)xx.

Proof of Proposition 62.3 — Least finite support

Proof. Gabbay and Pitts prove the claim for the finite-permutation action of definition 62.1 [GP02]. They construct the least support from the transpositions that move x and prove that it is contained in every finite support; this construction also gives the displayed transposition criterion. The freshness equivalence is the definition in terms of that least support. ◻

For atoms, πa:=π(a) and {a} supports a. For pairs and syntax trees, permutations act componentwise, so the union of component supports is a support. The support condition is stronger than saying that one particular transposition fixes x: it quantifies over every permutation that fixes the chosen finite set.

Definition 62.4 — Name abstraction

For a nominal set X, a name abstraction [a]x is the equivalence class of (a,x)A×X under the least equivalence relation containing (a,x)(b,(a b)x)whenever b#x. The permutation action is π[a]x:=[π(a)](πx).

The freshness premise is necessary. Without b#x, renaming a binder to a name already used freely in x would identify λa.b with λb.a.

Lemma 62.5 — Fresh comparison of abstractions

Let X be a nominal set, let a,b,dA, and let x,yX. If d#(a,x,b,y), then [a]x=[b]y(a d)x=(b d)y.

Proof of Lemma 62.5 — Fresh comparison of abstractions

Proof. First observe that the comparison atom is immaterial. If both d and e are fresh for (a,x,b,y), then applying (d e) to (a d)x=(b d)y gives (a e)x=(b e)y: the two permutation composites agree on supports of x and y. Applying (d e) again proves the converse.

For the forward direction, represent equality in the least equivalence of definition 62.4 by a finite chain and choose an auxiliary e fresh for every body and binder in that chain. It suffices to check one generating step (a,x)(b,(a b)x),b#x. On a support of x, both (a e) and the composite (b e)(a b) send a to e and fix every other supported atom, because b,e#x. Hence their actions on x agree. Equality is preserved by reversing or composing chain steps, which proves the implication. The first observation replaces the auxiliary e by the d in the statement.

Conversely, freshness gives the two generating equalities [a]x=[d]((a d)x),[b]y=[d]((b d)y). If the displayed bodies are equal, transitivity proves [a]x=[b]y. ◻

Proposition 62.6 — Support of name abstraction

For every atom a and finitely supported element x, supp([a]x)=supp(x){a}.

Proof of Proposition 62.6 — Support of name abstraction

Proof. This is the support calculation for the abstraction set in Gabbay and Pitts’s construction [GP02]. For the forward inclusion, a permutation fixing supp(x){a} may change a, but name abstraction identifies the correspondingly renamed representative. For the reverse inclusion, let ba lie in supp(x) and choose an atom c fresh for x, a, and b. The transposition criterion of proposition 62.3 gives (b c)xx. If (b c) fixed [a]x, apply lemma 62.5 with a comparison atom fresh for both bodies; because (b c) fixes a, the resulting body equality would imply (b c)x=x, a contradiction. Hence every support of [a]x contains b. Leastness gives the reverse inclusion. ◻

Lemma 62.7 — Fresh representative

Let [a]x be a name abstraction and let CA be finite. There are bC and yX such that [a]x=[b]y. More generally, if z is a finite tuple of external nominal parameters and C contains a support of z, then b may be chosen with b#z.

Proof of Lemma 62.7 — Fresh representative

Proof. Choose bCSxSz, where Sx supports x and Sz supports the external tuple z; omit Sz in the first claim. Such a b exists because A is infinite. Put y:=(a b)x. Since b#x, definition 62.4 gives [a]x=[b]y. The set Sz witnesses b#z. ◻

Definition 62.8 — Nominal STLC syntax

For the types of definition 61.11, nominal terms are generated by t::=var(a)app(t,u)lamA([a]t). Permutations act on variables, applications componentwise, and abstractions as in definition 62.4. The quotient built into [a]t is the alpha-equivalence of nominal abstractions.

The typing judgment is generated by a:AΓΓnomvar(a):ANomVar Γnomt:ABΓnomu:AΓnomapp(t,u):BNomApp Γ,a:Anomt:Badom(Γ)ΓnomlamA([a]t):ABNomLam. Contexts are finite lists of distinctly named atoms. The abstraction rule may use any representative fresh for the context; the fresh-comparison lemma and equivariance below show that its conclusion is independent of that choice.

Lemma 62.9 — Typing equivariance

For every finite permutation π, Γnomt:A if and only if πΓnomπt:A. Here permutation of a context acts only on its atom labels.

Proof of Lemma 62.9 — Typing equivariance

Proof. The typing claim is rule induction. A variable declaration a:AΓ maps to π(a):AπΓ; application is componentwise. An abstraction premise under Γ,a:A maps by the induction hypothesis to a premise under πΓ,π(a):A. Bijection of π preserves the freshness side condition, so Nom-Lam reconstructs the permuted abstraction. Applying π1 proves the reverse implication. ◻

Theorem 62.10 — Freshness induction

Let P be a predicate on nominal terms such that P(πt)P(t) for every finite permutation π and nominal term t. Let CA be finite. To prove P(t) for every nominal term, it suffices to prove:

  1. P(var(a)) for every atom a;

  2. for all nominal terms t,u, P(t) and P(u) imply P(app(t,u));

  3. for every object type A, atom a, and nominal term t, if aC and P(t), then P(lamA([a]t)).

Proof of Theorem 62.10 — Freshness induction

Proof. Induct on the quotient syntax. Variable and application use the first two clauses. For an abstraction [b]u, use lemma 62.7 to choose [b]u=[a]t with aC,t=(b a)u. The induction hypothesis gives P(u); the displayed equivalence for the transposition (b a) gives P(t). The third clause gives P(lamA([a]t)), which is the required property because [a]t=[b]u. ◻

Theorem 62.11 — Freshness recursion

Let X be a nominal set and let z be a finite tuple of external nominal parameters. Suppose the following data are equivariant jointly in z and their displayed arguments: Vz(a)X,Az(r1,r2)X,LA,z(a,t,r)X(a#z). Assume the binder data satisfy the fresh-renaming equation LA,z(a,t,r)=LA,z(b,(a b)t,(a b)r) whenever a#z, b#z, and b#(t,r). Then there is a unique function Fz from nominal terms to X, equivariant jointly in z and its term argument, such that Fz(var(a))=Vz(a),Fz(app(t,u))=Az(Fz(t),Fz(u)),Fz(lamA([a]t))=LA,z(a,t,Fz(t))(a#z). The final equation may use any representative whose binder is fresh for z.

Proof of Theorem 62.11 — Freshness recursion

Proof. For an abstraction, lemma 62.7 chooses a representative [a]t with a#z. Recurse on t and apply LA,z. If [b]u is another representative with b#z, choose d#(z,a,t,b,u,Fz(t),Fz(u)). The fresh-comparison equation transports both representatives to binder d; equivariance of the recursive calls and the fresh-renaming hypothesis for L make the two results equal. Thus the definition is independent of representatives.

Structural induction proves joint equivariance for variables and applications. In the abstraction case, choose a binder fresh for both z and its permuted image and use equivariance of L. Freshness induction proves uniqueness: choose the abstraction representative fresh for z and apply the third defining equation after the induction hypothesis for its body. ◻

Definition 62.12 — Nominal substitution

Apply theorem 62.11 with external parameters (a,u) and codomain the nominal terms. The variable and application data are the first three clauses below, and LA,(a,u)(b,t,r):=lamA([b]r). Name abstraction gives the required fresh-renaming equation. The resulting capture-avoiding substitution is var(a)[u/a]:=u,var(b)[u/a]:=var(b)(ba),app(t1,t2)[u/a]:=app(t1[u/a],t2[u/a]),lamA([b]t)[u/a]:=lamA([b](t[u/a])), where the final clause first chooses a representative satisfying b#(a,u) by lemma 62.7. If b=a, choose a different representative before applying the clause.

Lemma 62.13 — Nominal substitution and typing

The operation in definition 62.12 is independent of the chosen fresh representative and satisfies π(t[u/a])=(πt)[(πu)/π(a)]. If Γ,a:A,Δnomt:BandΓnomu:A, then Γ,Δnomt[u/a]:B.

Proof of Lemma 62.13 — Nominal substitution and typing

Proof. Theorem 62.11 gives independence of the representative. Its joint equivariance equation, instantiated at the parameter tuple (a,u), is exactly π(t[u/a])=(πt)[(πu)/π(a)].

For typing, perform rule induction on the given typing derivation, generalized over the context split and substituting derivation. Variables and application use the defining clauses and induction hypotheses. In an abstraction case, choose a finite support Su of u and use lemma 62.7 to select a representative with bdom(Γ,a:A,Δ)Su. Typing equivariance transports the original abstraction premise to that representative, because the required transposition fixes the external context. The transported premise is Γ,a:A,Δ,b:C0nomt0:D. The induction hypothesis gives Γ,Δ,b:C0nomt0[u/a]:D; the abstraction rule closes the result. The fresh choice prevents capture. ◻

Theorem 62.14 — Nominal adequacy for STLC

Let Γ be an STLC context with pairwise distinct atom labels. Define the untyped carriers Named(Γ):={tFV(t)dom(Γ)}/=α,Nom(Γ):={nb#n for every bAdom(Γ)}. Encoding and decoding are inverse bijections Named(Γ)Nom(Γ) that commute with renaming and capture-avoiding substitution. For every object type A, they also satisfy the separate typing equivalence Γstt:AΓnomencode(t):A.

Proof of Theorem 62.14 — Nominal adequacy for STLC

Proof. Decode var(a) and app componentwise. Decode lamA([a]t) by choosing any representative and returning λ(a:A).decode(t). Name abstraction makes this independent of the representative modulo object alpha-equivalence. Encode variables and applications componentwise and encode λ(a:A).t as lamA([a]encode(t)).

Structural induction gives both inverse equations; the abstraction equation uses exactly the alpha quotient in definition 62.4. Equivariance gives the renaming equation, and induction using the fresh representative in the abstraction case gives the substitution equation. Typing preservation and reflection are rule inductions because the nominal and named rules have the same premises after choosing a representative. ◻

Proposition 62.15 — Nominal and de Bruijn comparison

Given an ordered nominal context a0:A0,,an1:An1, replacing ai by its context position defines a translation to typed de Bruijn syntax. It is invariant under simultaneous permutation of the context and term, and it commutes with typed substitution.

Proof of Proposition 62.15 — Nominal and de Bruijn comparison

Proof. Translate variables by lookup, application componentwise, and abstraction by choosing a representative whose binder is outside the context and extending the context at the left. Lemma 62.7 supplies the choice. Simultaneously permuting context and term preserves every lookup position, so induction on terms proves invariance. The same induction proves the substitution square; under a binder it is the lifted-substitution equation of lemma 61.19. ◻

Remark 62.16 — Fresh atoms require a larger signature

To state fresh-atom generation as an LF relation, a signature needs an atom family and a judgment family relating an input term to a fresh result atom. The signature Σst declares neither: it contains only object types, intrinsically typed terms, application, and abstraction. Hence no LF judgment over this signature can even state that an output atom is fresh for an input. Adding an atom family, atom equality, and a freshness relation defines a different framework signature and requires a new adequacy proof.

Exercise 62.1

★★☆ Compute lamB([b]var(a))[var(b)/a]. Choose an atom c with c{a,b}, display the transposition used to change representatives, and show that the result decodes to an alpha-variant of λ(c:B).b, not λ(b:B).b. (Half a page.)

The substitution support bound

The substitution theorem preserves typing, but it also controls which atoms may remain free. The bound is stated using least support, so it is independent of the particular fresh representative selected under a binder.

Lemma 62.17 — Support of nominal substitution

For nominal terms t,u and an atom a, supp(t[u/a])(supp(t){a})supp(u).

Proof of Lemma 62.17 — Support of nominal substitution

Proof. Use freshness induction with the finite set C={a}supp(u). The variable case is the defining split of substitution. Application uses the two induction hypotheses and the fact that the support of a pair is the union of its component supports.

For an abstraction, choose bC and a representative lamA([b]t0). The defining substitution clause gives lamA([b](t0[u/a])). By the induction hypothesis, supp(t0[u/a])(supp(t0){a})supp(u). Name abstraction removes the bound atom b from support. Since b{a}supp(u), removing b from the right-hand side yields exactly the required bound for the abstraction by proposition 62.6. ◻

Exercise 62.2

★☆☆ Let t=lamA([a]app(var(a),var(b))). Compute supp(t) and the support of (a c)t for pairwise distinct atoms a,b,c. Then exhibit one permutation fixing the empty set but changing t. (Six lines.)

One obligation across four representations

The comparison in theorem 61.26 fixes one STLC renaming and substitution obligation. Nominal syntax satisfies that obligation by lemma 62.9, lemma 62.13; it does not inherit the proof invariant of any of the other representations. The binder case is the point of separation: representationbinder operationde Bruijnlift the substitution and weaken old componentslocally namelessopen outside a finite exclusion setPHOASextend the relation family by the bound pairnominalchoose a representative fresh for the substitution data. Each row proves the same typing implication. No row provides the side condition named in another row.

Definition 62.18 — Typed simultaneous nominal substitution

A typed substitution σ:ΓΔ assigns to each declaration a:AΓ a nominal term satisfying Δnomσ(a):A. Its finite support is supp(σ):=adom(Γ)supp(σ(a)). The simultaneous action on variables and applications is componentwise. At an abstraction, choose a representative lamA([b]t0) with bdom(Γ)dom(Δ)supp(σ) and put lamA([b]t0)[σ]:=lamA([b](t0[σ+b])). Here σ+b:Γ,b:AΔ,b:A maps b to var(b) and maps every old atom a to σ(a). Freshness recursion makes the action independent of the chosen representative; rule induction gives Γnomt:CΔnomt[σ]:C. The one-variable operation of definition 62.12 is the instance that is the identity away from its target.

Proposition 62.19 — Nominal substitution square

Let Γ be an ordered nominal context, let σ:ΓΔ be a typed nominal substitution, and let dbΓ be the translation of proposition 62.15. If Γnomt:C, then dbΔ(t[σ])=dbΓ(t)[db(σ)]. Here db(σ) maps the de Bruijn position of each a in Γ to dbΔ(σ(a)). Changing every atom label by one simultaneous permutation changes neither side.

Proof of Proposition 62.19 — Nominal substitution square

Proof. Induct on t. Variables are lookup in σ and applications use the two induction hypotheses. For an abstraction, choose a representative [a]t0 with adom(Γ)dom(Δ)supp(σ). The nominal substitution enters t0 with the fresh representative. The de Bruijn translation extends both ordered contexts by their newest declaration and therefore uses the lifted substitution db(σ). The body equation is the induction hypothesis under those extensions; lemma 61.19 identifies the lifted right-hand side. If another fresh representative is selected, typing equivariance transports the nominal premise while simultaneous permutation preserves every de Bruijn lookup position. Hence the equation is independent of the representative. ◻

Remark 62.20 — The boundary of the comparison

The square compares one typed STLC substitution. It proves no equivalence between nominal support and locally nameless local closure, and no parametricity theorem for PHOAS. Nominal unification and dependent nominal typing require calculi and metatheorems beyond this chapter.

Suggested first pass.

None of these problems is a prerequisite for a later chapter. Begin with exercise 62.3, then complete exercise 62.6.

Exercise 62.3

★☆☆ For pairwise distinct a,b,c, compute least supports of var(a), app(var(a),var(b)), and lamA([a]app(var(a),var(b))). For each atom in a computed support, give a transposition that fixes the other computed atoms but changes the term. (Half a page.)

Exercise 62.4

★★☆ Prove that the inclusion in lemma 62.17 can be strict. Give one example because a does not occur in t, and one because an occurrence of a lies under a binder. Compute both sides of the inclusion in each example.

Exercise 62.5

★★★ Let Γ=(p:C), let Δ=, let u be a closed term of type C, and define σ:ΓΔ by σ(p)=u. For t=λ(a:A).λ(b:B).p, prove the nominal–de Bruijn substitution square. Name the representative chosen fresh for u, the two lifted de Bruijn substitutions, and the equivariance equation used after changing the outer representative. (Two pages.)

Exercise 62.6

★★★ Practical project.nominal-substitution-checker Implement in Agda or Kappa finite permutations, finite-support probes, and capture-avoiding substitution for the untyped nominal lambda fragment. Reserve every atom occurring in the body or substitution argument before choosing a replacement binder. Check that the support of λa.ab is {b}, that transposing b and d transports that support to {d}, that (λb.a)[b/a] becomes the fresh representative λc.b, and that substitution stops beneath a binder equal to its target. A version that descends beneath that shadowing binder must fail the fourth oracle.

Sources. Finite support and its least-support property are Definition 3.3 and Proposition 3.4 of Gabbay and Pitts [GP02]. Their abstraction-set construction and local-freshness eliminator appear on pp. 15–16; structural iteration, recursion, and induction are Theorem 6.5, Corollary 6.7, and Theorem 6.8 on pp. 17–18; capture-avoiding substitution is Example 6.9 on p. 18. Pitts motivates equivariant predicates and swapping on pp. 2–3; those nominal-logic axioms do not strengthen the nominal-set theorem boundary [Pit03].

Search the book

Type to search the local edition.