Lectures onType Theory
Chapter 64
Chapter 64Optional

Dependent Nominal Type Theory

Prerequisites. Direct starred prerequisites: Chapter 62, Chapter 23. No later core chapter depends on this route.

The LF declaration lam:(expexp)exp represents a binder without choosing a numerical index. It does not make the object-language question “are these names different?” available inside the signature. The obstruction is not binding itself. It is the absence of first-class names, freshness, and a typed operation for opening an abstraction.

This chapter freezes Cheney’s dependent nominal type theory, abbreviated DNTT [Che12]. Its ordinary fragment is LF; its new ingredients are name types, fresh-name context extensions, name-abstraction types, and concretion at a literal name. Its equality algorithm erases dependencies and uses a Kripke logical relation. No hereditary-substitution argument is substituted for that proof.

Atoms, support, and abstraction

Let A be a countably infinite set of atoms. A finite permutation π is a bijection on A that moves only finitely many atoms. Transpositions (a b) generate the finite permutations. A permutation action on a set X satisfies idx=x,(π2π1)x=π2(π1x). A finite set SA supports xX when every permutation fixing S pointwise fixes x. A nominal set is a permutation set in which every element has finite support. Write afreshx when a is outside the least support of x.

Lemma 64.1 — Fresh atoms exist

For every finite family x1,,xn of elements of nominal sets, there is an atom a fresh for every xi.

Proof of Lemma 64.1 — Fresh atoms exist

Proof. The union S=isupp(xi) is finite. Since A is infinite, choose aAS. ◻

Name abstraction is not an ordered pair. On A×X, put (a,x)(b,y)for some cfresha,b,x,y, (a c)x=(b c)y. The abstraction ax is the equivalence class of (a,x), and [A]X is the set of such classes. Different fresh choices of c give the same relation: conjugating one fresh transposition to another uses a permutation that fixes the finite support of the remaining data. The same witness proves symmetry because equality is symmetric. For transitivity, choose one atom fresh for both given witnesses and the three pairs, then compose the two transposition equations. Thus is an equivariant equivalence relation [GP02]. For a fixed binder, abstraction is injective: if ax=ay, choose c fresh for a,x,y. The defining equation gives (a c)x=(a c)y, and applying the same transposition gives x=y.

Lemma 64.2 — Support of abstraction

If X is a nominal set, then supp(ax)=supp(x){a}. Consequently afreshax.

Proof of Lemma 64.2 — Support of abstraction

Proof. Let S=supp(x){a}. If π fixes S, put d=πa. If d=a, then π fixes all of supp(x). Otherwise dS, and π agrees on supp(x) with the transposition (a d). In either case, the abstraction equation gives πa(πx)=ax, so S supports the class. Conversely, if ba belongs to supp(x) but not to a support of the abstraction, choose c fresh for that support, a,b,x. The transposition (b c) would fix the class and a; fixed-binder injectivity would then make it fix x. This contradicts the fresh-transposition characterization of least support because bsupp(x) and c is fresh for x. The atom a is removed by abstraction itself. ◻

For example, aa=bb: choose c fresh for a,b, then (a c)a=c=(b c)b. But abac for distinct a,b,c, since their supports are {b} and {c}.

Exercise 64.1

★☆☆ Let a,b,c be distinct. Calculate the supports of a(a,b) and a(b,c). Decide whether either abstraction is equal to c(c,b), giving the fresh transposition calculation. (Eight lines.)

The dependent nominal signature

Fix disjoint countable sets of variables x,y, literal names a,b, object constants c, type constants p, and name-type constants α. The exact syntactic classes are K::=typeΠx:A.K,A,B::=pAMΠx:A.BαNa:α.B,M,N::=cxλx:A.MMNaa:αMM@a. The binders Na:α.B and a:αM bind a. The expression M@a, called concretion, may use only a literal name as its right argument. Name-type constants cannot depend on terms.

A signature contains closed declarations p:K, c:A, and α:name. Contexts are ordered lists Γ::=Γ,x:AΓ;fresh a:α. The last extension asserts that a is fresh for the whole prefix. Thus Γ,x:A;fresh a:α embeds into Γ;fresh a:α,x:A, but the reverse embedding need not hold: the latter context does not assert that a is fresh for A.

The judgment Γrestricta:αΓ removes a and everything declared after it: XΓ;fresh a:αrestricta:αΓRHere Γrestricta:αΓΓ;fresh b:βrestricta:αΓ;fresh b:βRName Γrestricta:αΓΓ,x:Arestricta:αΓRVar. The asymmetry matters: R-Name retains a later fresh name, whereas R-Var discards a later variable because its type may mention a.

The ordinary LF formation, variable, product, abstraction, application, and conversion rules are those of chapter 23. The nominal rules are the following; all judgments are relative to a well-formed signature. α:nameΣΓα:typeNameType α:nameΣΓ;fresh a:αB:typeΓNa:α.B:typeNewType a:αΓΓa:αNameΓ;fresh a:αM:BΓa:αM:Na:α.BNameAbs Γrestrictb:αΓΓM:Na:α.BΓM@b:B[b/a]Concretion. The restriction premise prevents a term constructed with information declared after b from being opened at b.

Lemma 64.3 — Restriction is deterministic

If restriction of Γ at a:α produces both Γ1 and Γ2, then Γ1=Γ2.

Proof of Lemma 64.3 — Restriction is deterministic

Proof. Induct on the first derivation and invert the second. A final R-Here forces the same last name declaration. A final R-Name or R-Var forces the same outer context constructor; the induction hypothesis identifies the prefixes. These are all rules. ◻

Exercise 64.2

★☆☆ For Γ=x:X;fresh a:α,y:P(a);fresh b:β,z:Q(b), calculate restriction at a and at b. Explain why y is discarded at a, while the later name b is retained. (Ten lines.)

Substitution and the name beta–eta laws

A simultaneous substitution may assign objects to variables and literal names to names: θ::=θ,M/xθ,b/a. It is well formed, written Δθ:Γ, when it maps every declaration of Γ to legal data in Δ, and the name case respects restriction: Δrestrictb:αΔΔθ:ΓΔ(θ,b/a):Γ;fresh a:αSubName. The operation θa deletes the image of a and all later variable assignments. It mirrors context restriction.

Lemma 64.4 — Substitution restriction

If Δθ:Γ and restriction of Γ at a:α produces Γ0, then for some Δ0, Δrestrictθ(a):αΔ0,Δ0θa:Γ0.

Proof of Lemma 64.4 — Substitution restriction

Proof. Induct on the restriction derivation. The R-Here case inverts the final Sub-Name rule. The R-Name case applies the induction hypothesis and rebuilds Sub-Name; the R-Var case discards the corresponding object assignment. Restriction determinacy identifies the intermediate contexts. ◻

Theorem 64.5 — General substitution

If ΓJ and Δθ:Γ, then ΔJ[θ]. The assertion J may be a kind, type, object, or definitional-equality judgment.

Proof of Theorem 64.5 — General substitution

Proof. Proceed by rule induction. The LF cases use ordinary capture-avoiding substitution. The name-formation and abstraction cases rename their bound atom fresh for θ. For concretion, use lemma 64.4 to restrict Δ at θ(b), then apply the induction hypothesis to the abstraction in that restricted context. Rule Concretion rebuilds the result. Declarations discarded by restriction cannot occur freely in its term or type, so M[θb]=M[θ],B[θb][θ(b)/a]=B[b/a][θ]. This is the only new critical case. ◻

Definitional equality contains ordinary LF beta–eta equality and (a:αM)@bM[b/a] when restriction at b is defined. Its name-eta rule is Γ;fresh a:αM@a=N@a:BΓM=N:Na:α.BNameEta. Beta is type preserving by the name-renaming instance of theorem 64.5; eta is type preserving because the fresh extension restricts back to Γ.

Exercise 64.3

★★☆ Give the complete typing derivation for (a:αM)@b, including the restricted context, and derive the type of M[b/a] using theorem 64.5. State the freshness failure if a variable declared after b appeared free in M.

Algorithmic beta–eta equivalence

Dependency is erased only for the equality algorithm: τ::=pαττ[α]τ,(Πx:A.B)=AB,(Na:α.B)=[α]B. Erasure supplies a well-founded index for comparison; it does not assert that dependent types are simply typed. Write ΔMN:τ for extensional algorithmic equivalence and ΔMN:τ for structural comparison of neutral heads. Both relations weak-head reduce before inspecting a head. The new clauses are a:αΔΔaa:αAlgName Δrestricta:αΔΔMN:[α]τΔM@aN@a:τAlgConc Δ;fresh a:αM@aN@a:τΔMN:[α]τAlgNewExt. At a function type the extensional clause compares Mx and Nx at a fresh variable; at an atomic type it invokes structural comparison. Structural application compares heads structurally and arguments extensionally. Kind and type comparison use the same erasure, with congruence for Π and N.

Theorem 64.6 — Soundness of algorithmic equivalence

If ΓM:A, ΓN:A, and ΓMN:A, then ΓM=N:A. Structural comparison implies equality of neutrals; type and kind comparison imply their corresponding declarative equalities.

Proof of Theorem 64.6 — Soundness of algorithmic equivalence

Proof. Use simultaneous induction on the algorithmic and structural derivations. The function case reconstructs declarative function eta, and each LF neutral head reconstructs its matching congruence rule. Rule Alg-Name reconstructs name reflexivity. For Alg-Conc, typing inversion and soundness of erased restriction recover the same unique restricted context for both terms; the induction hypothesis gives equality there, and concretion congruence rebuilds the conclusion. Rule Alg-New-Ext uses declarative name eta. Subject reduction justifies the preliminary weak-head steps. These cases exhaust the nominal additions. ◻

Completeness requires the direction syntax induction cannot supply. A Kripke relation is defined by induction on erased types. At atomic types it is algorithmic equivalence. At arrows and name abstractions it is ΔM=N:τυfor every ΔΔ and ΔP=Q:τ,ΔMP=NQ:υ;ΔM=N:[α]τfor every ΔΔ and fresh a,Δ;fresh a:αM@a=N@a:τ. Logical substitutions relate pointwise, with the name clause mediated by restriction.

Lemma 64.7 — Fundamental logical-relation lemma

If ΓM=N:A and Δθ=ρ:Γ, then ΔM[θ]=N[ρ]:A.

Proof of Lemma 64.7 — Fundamental logical-relation lemma

Proof. Induct on declarative equality. Lambda beta and eta use the arrow clause. In the name-beta case, logical substitution restriction yields a common context restricted at θ(b)=ρ(b); the induction hypothesis compares the bodies there, and closure under weak-head reduction relates the redex to its contractum. In the name-eta case, extend the substitutions by the same fresh name and invoke the abstraction clause. Concretion congruence again uses logical substitution restriction. The remaining cases are the LF clauses. ◻

Lemma 64.8 — Logical implies algorithmic

If ΔM=N:τ, then ΔMN:τ.

Proof of Lemma 64.8 — Logical implies algorithmic

Proof. Induct on τ. The atomic case is the definition. At an arrow, weaken by a fresh variable, apply the relation to that variable, use the induction hypothesis, and finish by algorithmic function extensionality. At [α]τ, extend by a fresh name, apply the name-abstraction clause, use the induction hypothesis on the concretions, and finish with Alg-New-Ext. ◻

Theorem 64.9 — Completeness and decidability

For well-formed terms, ΓM=N:AΓMN:A. All formation, typing, restriction, and definitional-equality judgments of DNTT are decidable.

Proof of Theorem 64.9 — Completeness and decidability

Proof. Soundness is theorem 64.6. For completeness, use the identity logical substitution in lemma 64.7. Then apply lemma 64.8. Syntax directs the equality algorithm: weak-head reduction is invoked only on well-formed terms, and the logical relation proof supplies termination at the erased type. Restriction is a deterministic finite-context traversal. Bidirectional LF typing invokes the decidable equality algorithm at conversion points; the nominal constructors add only the displayed finite checks. Mutual induction yields a decision procedure. ◻

This is exactly the source’s beta–eta equality boundary. It is not a normalization theorem for a language with nominal recursion. Cheney’s earlier simply typed system has a separate strong-normalization proof; it does not silently strengthen this dependent calculus.

Canonical forms and adequacy

A canonical object is eta-long at its type and beta-normal: C::=λx:A.Ca:αCH,H::=cxaHCH@a. Typing, not this grammar alone, decides whether a neutral is saturated.

Theorem 64.10 — Canonicalization and conservativity

If Σ,Γ,A are canonical, every ΓM:A has a unique canonical C with ΓM=C:A. Canonicalizing the signature, context, and type removes the canonical-input premise. Every name-free LF judgment over an LF signature that is derivable in DNTT is derivable in LF.

Proof of Theorem 64.10 — Canonicalization and conservativity

Proof. Existence runs the complete equality algorithm against the eta-expansion dictated by A. At [α]τ, introduce a fresh name, canonicalize the concretion, and reabstract. Soundness follows from theorem 64.6; determinism follows by induction, using deterministic restriction for concretion. Hence two canonical forms are equal. For conservativity, a canonical LF judgment can contain no nominal head because its signature and result type contain none. Reading its derivation with the LF rules gives the result. ◻

Fix the signature vr:name,exp:type,var:vrexp,app:expexpexp,lam:[vr]expexp. Encode untyped lambda terms by a=var a,tu=app t u,λa.t=lam(a:vrt).

Theorem 64.11 — Adequacy of the nominal encoding

For free names among a1,,an, encoding is a bijection between untyped lambda terms modulo alpha-equivalence and canonical terms of type exp in the corresponding fresh-name context. It commutes with renaming: t[b/a]=t[b/a].

Proof of Theorem 64.11 — Adequacy of the nominal encoding

Proof. The forward map is structural; abstraction is independent of the chosen bound name by name-abstraction equality. For surjectivity, invert canonical forms at exp. The only fully applied heads are var, app, and lam. Their arguments recursively decode to a name, two terms, or a name abstraction. In the last case choose a fresh representative and decode its body. The same inversion proves injectivity; for two lambdas, open both at one fresh name and use the induction hypothesis. Renaming commutation is another structural induction. ◻

Add neq:expexptype. Its constructor schemes are neqvv:Na:vr.Nb:vr.neq (var a) (var b), neqa1:neq M1 N1neq (app M1 M2)(app N1 N2),neqa2:neq M2 N2neq (app M1 M2)(app N1 N2),neq:Na:vr.neq (M@a) (N@a)neq (lam M) (lam N). There are also constructors for each pair of unlike heads var/app, var/lam, and app/lam, in both orders. The two nested freshness binders in neqvv force different literal names; the binder in neq opens both bodies at one name [Che12].

Theorem 64.12 — Adequacy of explicit alpha-inequality

For object terms t,u, tαuΓD:neq t u for some canonical proof term D.

Proof of Theorem 64.12 — Adequacy of explicit alpha-inequality

Proof. Forward, induct on the first unequal constructor position. Different variables use the two-fresh-name constructor; application and unlike-head cases use their corresponding constructors. For lambdas, rename both binders to one fresh atom and use the induction hypothesis on the bodies. Conversely, induct on the canonical proof term. Inversion identifies its inequality constructor. The variable constructor can be concreted only at distinct names; the application and unlike-head constructors carry exactly the required smaller inequalities. In the lambda case, concreting at one fresh name produces a smaller inequality proof for the opened bodies. ◻

Adding a name-case operator, fresh-name generation, or recursion over abstractions changes the canonical heads and requires new adequacy and normalization arguments.

Suggested first pass.

Begin with exercise 64.4; then implement exercise 64.6.

Exercise 64.4

★★☆ Encode λa.λb.a twice using disjoint binder names. Open both outer abstractions at one fresh name, calculate the two beta steps, and derive algorithmic equality at [vr][vr]exp. Mark the use of restriction. (One page.)

Exercise 64.5

★★☆ The nominal-set function [A]AOption(A) returns none on aa and some(b) on ab for ab. Explain why frozen DNTT cannot define it. Name an eliminator that would make it expressible and the two metatheorems then requiring new proofs.

Exercise 64.6

★★★ Practical project.nominal-restriction-checker Implement in Agda or Kappa a finite checker for fresh-name contexts. It must calculate restriction, reject concretion when an abstraction depends on a later variable, accept alpha-renamed abstractions, and distinguish aa from ab. Print retained and discarded declarations. State that the run checks a finite representation invariant, not DNTT decidability or adequacy.

Sources. Atoms, finite permutations, support, and abstraction follow Gabbay and Pitts [GP02]. The frozen dependent syntax, restriction judgment, substitution theorem, beta–eta equality algorithm, Kripke completeness proof, decidability, canonicalization, conservativity, and adequacy results are Cheney’s [Che12]. The simply typed nominal calculus has its own normalization theorem [Che09]; the dependent theory of abstractable names has a different elimination discipline [PMD15]. Neither theorem is transferred here.

Search the book

Type to search the local edition.