Lectures onType Theory
Chapter 93
Chapter 93Optional

Dependent Intersections and Same-Subject Refinement

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

A dependent pair can store a program and a proof about that program, but its erasure still contains two components. Suppose a function r already supports two interfaces. Packaging r with a second copy or a certificate changes its runtime representation even though both interfaces describe the same untyped subject. The required type former must attach the second view without adding a runtime component.

The binder in x:AB(x) ranges over the subject inhabiting both A and B(x). It is not a path from x to itself, a dependent pair, an object-oriented Self type, or a recursive DOT binder.

Erasure comes first

Convention 93.1 — The same-subject calculus DI

The base of DI is a Curry-style dependent type assignment system. Typed expressions erase to untyped lambda terms by erase(). Type annotations, implicit arguments, and proof annotations are erased; ordinary lambda abstraction and application remain. Untyped beta-eta convertibility is written =βη. The chapter adds only Kopylov’s dependent intersection and an annotated elaboration of its one-subject introduction rule. Its extensional semantics is the PER semantics of the selected Nuprl system; decidable type checking and global normalization are not assumptions.

Two differently typed annotated terms can already denote one untyped term. For instance, if implicit abstraction is written Λ0A.t, then erase(Λ0A.λx.x)=λx.x=erase(λx.x). The first term may have type 0A:U0.AA and the second an ordinary instance NN. Equality of erasures is weaker than judgmental equality of typed expressions; it forgets annotations and implicit binders.

Definition 93.2 — Erased dependent intersection

The type x:AB binds x in B. The introduction form both(a,b) records two typing derivations but erases to their common subject. Its projections are annotation-level views. The rules occur in formation, introduction, elimination, computation, and uniqueness order:

ΓA typeΓ,x:AB type
Γx:AB type
DI-F
Γa:AΓb:B[a/x]erase(a)=βηerase(b)
Γboth(a,b):x:AB
DI-I
Γd:x:AB
Γleft(d):A
DI-E_1
Γd:x:AB
Γright(d):B[left(d)/x]
DI-E_2
Γboth(a,b):x:AB
left(both(a,b))a
DI-β_1
Γboth(a,b):x:AB
right(both(a,b))b
DI-β_2
Γd:x:AB
both(left(d),right(d))d
DI-η

The erasure equations are erase(both(a,b)):=erase(a),erase(left(d)):=erase(d),erase(right(d)):=erase(d). The premise of DI-I makes the first equation independent of the chosen view. The second elimination type substitutes the first view because B is formed for subjects of A.

Let u:0A:U0.AA and v:NN be the two identity annotations above. If B(f) is the constant type NN, then

Γu:0A:U0.AAΓv:NNerase(u)=βηλx.x=βηerase(v)
Γboth(u,v):f:(0A:U0.AA)(NN)
DI-I

is the required first derivation. Both projections erase to λx.x.

The stuck case is equally important. If z:x:AB is a variable, neither left(z) nor right(z) contracts; the projections are neutral annotations. Their erasures are nevertheless the same variable z.

Exercise 93.1

★☆☆ Let d:x:AB and let C be a type independent of x. Derive both(left(d),right(d)):x:AB and calculate its two projections. State where the same-erasure premise is discharged.

Why three neighboring formers fail

An ordinary intersection AC can express two views, but C cannot mention the subject through a binder. A dependent sum x:AB can express the dependency, but erase((a,b))=(erase(a),erase(b)) contains two runtime components. A refinement {x:AP(x)} is same-representation only when P is an erased logical predicate; it cannot in general attach a computational interface B(x). Dependent intersection is determined by the conjunction of the two missing requirements: dependent second view and one erased subject.

Removing the last premise of DI-I admits both(λx.x,λx.0). Its first projection would erase to λx.x and its second to λx.0, while the intersection itself has only one erasure. At least one projection equation would then be false.

Exercise 93.2

★★☆ For each of ordinary intersection, dependent sum, refinement, and dependent intersection, answer two questions: may the second component mention the first subject, and does elimination return the same erased program? Give a term showing each negative answer.

Substitution preserves the shared subject

The binder in B makes substitution the first nonformal metatheoretic case.

Lemma 93.3 — Erasure commutes with substitution

For every annotated expression e and term u, erase(e[u/x])=erase(e)[erase(u)/x].

Proof of Lemma 93.3 — Erasure commutes with substitution

Proof. Proceed by structural induction on e. The variable and ordinary binder cases are the capture-avoiding substitution calculation. For the new introduction form, erase(both(a,b)[u/x])=definitionerase(a[u/x])=IHerase(a)[erase(u)/x]=definitionerase(both(a,b))[erase(u)/x]. For either projection, apply the induction hypothesis to its argument. No other constructor changes erasure. ◻

Lemma 93.4 — Substitution

If Γ,x:C,Δe:E and Γu:C, then Γ,Δ[u/x]e[u/x]:E[u/x].

Proof of Lemma 93.4 — Substitution

Proof. Induct on the typing derivation. In the DI-I case the induction hypotheses give Γ,Δ[u/x]a[u/x]:A[u/x],Γ,Δ[u/x]b[u/x]:B[a/x][u/x]. Choose bound names outside FV(u)FV(A)FV(B) before commuting the two substitutions. The old side condition and lemma 93.3 give erase(a[u/x])=erase(a)[erase(u)/x]=βηerase(b)[erase(u)/x]=erase(b[u/x]). Rule DI-I then reconstructs the conclusion. In the DI-E2 case, the induction hypothesis gives the substituted intersection premise, and capture avoidance gives B[left(d)/y][u/x]=B[u/x][left(d[u/x])/y]. The remaining cases are instances of the base substitution proof with the same substitution. ◻

Theorem 93.5 — Erasure preservation

If Γe:E, then every annotation-level reduction ee satisfies erase(e)=βηerase(e). In particular, both dependent-intersection beta rules preserve the untyped subject.

Proof of Theorem 93.5 — Erasure preservation

Proof. Induct on the reduction context. Ordinary beta reduction maps to untyped beta reduction by lemma 93.3. At the first new redex, erase(left(both(a,b)))=erase(a)=erase(a). At the second, erase(right(both(a,b)))=erase(a)=βηerase(b), where the final step is precisely the premise of DI-I. Compatible contexts preserve beta-eta convertibility. ◻

The PER validates one subject

Let RA be the PER interpreting A. For each RA-related pair a,a, let RBa,a interpret B and be invariant under the RA equivalence class. The dependent-intersection PER is Rx:AB(t,t)RA(t,t)  RBt,t(t,t). The same programs t,t occur in both conjuncts. A Sigma interpretation would instead relate two pairs and project different components.

Theorem 93.6 — Kopylov semantic validation

Assume the selected Nuprl candidate type system validates the base type formers and functional PER families. Extending it by equation 93.1 validates DI-F, DI-I, both elimination rules, the two computation rules, and extensional equality of dependent-intersection types.

Proof of Theorem 93.6 — Kopylov semantic validation

Proof. Formation follows because RA is a PER and the functional-family premise makes the second conjunct independent of representatives. Symmetry of equation 93.1 uses symmetry of RA and RBt,t; transitivity uses their transitivity after replacing the middle representative by functionality. Introduction supplies both conjuncts for the same erased subject. The first elimination selects the RA conjunct. The second selects RBt,t after the first view fixes the subject substituted for x. The computation rules do not change the subject, and extensional type equality follows by logical equivalence of both conjuncts under equal domain PERs and equal functional families. ◻

This theorem is the semantic Theorem 10 singled out by Kopylov. The paper reports MetaPRL checks for the remaining formal results, not for this semantic argument. The surrounding Nuprl calculus admits partial computations, so the theorem is not a normalization proof.

No annotation-normalization theorem follows merely by choosing a strongly normalizing erased target. A source step may contract an implicit binder, ascription, proof annotation, or a redex inside an erased view while inducing no target step. A normalization argument would therefore need the complete source reduction relation and a measure for every zero-erasure constructor; the frozen Kopylov signature supplies neither. Adding an untyped fixed point also leaves theorem 93.6 meaningful for partial terms. The chapter consequently makes no source- or annotation-normalization claim.

A dependent record with no wrapper

Fix labels car and mul. A single-field record type is {:A}:={}A, and a record is a function on labels. Define SemigroupSig:=r:{car:U0}{mul:r.carr.carr.car}. Let s be the untyped label function whose car branch returns N and whose mul branch returns addition. Give it two annotations: sc:{car:U0},sm:{mul:sc.carsc.carsc.car}. Both erase to s, so both(sc,sm) inhabits SemigroupSig. The second field type computes after the first view: sc.carN,sm.mul:NNN. Both record projections erase to the same label function s; field selection chooses a branch, but dependent intersection itself inserts no pair or wrapper.

Associativity can be attached by one more dependent intersection whose second view is the set of the same record functions satisfying the associativity proposition. The runtime program remains s. A Sigma encoding would instead store (s,p).

Exercise 93.3

★★☆ Extend SemigroupSig by a unit field and two unit equations. Give the nested dependent-intersection type, the annotation of a natural-number instance, and the erasure of every projection. Verify that reassociating the three views preserves the conjunction RA(t,t)RB(t,t)RC(t,t) in the PER model.

The terminology firewall

Former binder denotes runtime condition new capability
x:AB(x) one existing subject both views share erasure dependent view
x:AB(x) first component pair erasure stored witness
ιx.T in System S term being typed self instantiation type mentions subject
very-dependent function function under construction predecessor restriction range mentions function
DOT {zT} recursive object term object allocation path selection
identity loop endpoint and path proof term equality elimination

No row licenses a rule from another. In particular, dependent intersection does not permit B to mention the function whose type is being formed unless that function is already the subject supplied by the left view.

Suggested first pass.

Begin with exercise 93.4, then complete exercise 93.6.

Exercise 93.4

★★☆ Prove, from equation 93.1, the extensional equality x:A(y:B(x)C(x,y))=z:(x:AB(x))C(z,z). Expand membership on both sides until each is the conjunction of three PER relations on the same subject. Check the functionality premise used when a representative changes.

Exercise 93.5

★★★ Reconstruct the DI-I and DI-E2 cases of semantic validation and the corresponding substitution cases. Then remove functionality of the PER family and give related representatives for which the second conjunct changes.

Exercise 93.6

★★★ Practical project.dependent-intersection-erasure-checker Implement in Kappa a finite checker whose erasure grammar distinguishes identity, constant, and record shapes and whose annotations include both/left/right. Maintain the invariant that each accepted both(a,b) has identical erased shape. It must accept two annotations of identity and two record views, reject an identity/constant pair, and confirm that both projections of each accepted pair erase to one shape. Removing the same-erasure conjunct must make the test fail.

Sources. The dependent-intersection rules, PER validation, associativity calculation, and record construction are Kopylov’s. The source’s Table 1 and semantic Theorem 10 occur on the third printed page; the derived eliminations and associativity theorem continue on the fourth; the record rules are on pages 7–8. The annotated same-erasure presentation makes the Curry-style one-subject condition checkable without claiming that the historical Nuprl system had decidable typing. Later realizability and Cedille calculi motivate the executable erasure checker but do not strengthen Kopylov’s theorem [Kop03].

Search the book

Type to search the local edition.