Consider a closed term ℎ:∀𝑋.𝑋→𝑋. At a closed type 𝐴, the specialization ℎ[𝐴] is an endomap of 𝐴. Nothing in its arrow type alone prevents a constant endomap. The universal quantifier is the obstruction: ℎ must be the same program when 𝐴 is replaced by any other type. Relational preservation makes “the same program” a calculation.
A unary property of terms at one type cannot compare a numeral with a state represented by a pair. Such a comparison needs a relation whose endpoints may be different types. It must be a relation rather than only the graph of a function: empty, singleton, and partial correspondences will all be used.
Here “type”, “term”, and “beta” refer to the Church-style System F of chapter 5; the language has no additional term former or reduction rule.
Relations between programs
The set-theoretic obstruction of theorem 5.40 concerned a denotational model in which types range over arbitrary sets and arrows denote all set-theoretic functions. The relational model instead relates typed syntax to typed syntax.
Assign to each type a binary relation between terms of its two endpoint instances. At 𝐴 →𝐵, relate functions that send 𝐴-related arguments to 𝐵-related results; at ∀𝑋.𝐴, quantify over every relation used for 𝑋. These clauses define the logical relation, a family of binary relations indexed by types, whose preservation is the central induction of the chapter.
For every closed formed System F type 𝐴, taken modulo alpha-equivalence, put 𝖳𝗆(𝐴):={𝑡∣⋅;⋅⊢𝑡:𝐴}/=𝛽. We write [𝑡]𝐴, or simply [𝑡], for the beta-class of 𝑡. A relation from 𝐴 to 𝐵 is a subset 𝑅:𝐴↔𝐵meaning𝑅⊆𝖳𝗆(𝐴)×𝖳𝗆(𝐵). Write [𝑎]𝑅[𝑏] for ([𝑎],[𝑏]) ∈𝑅 and 𝖤𝗊𝐴:={([𝑎],[𝑎])∣[𝑎]∈𝖳𝗆(𝐴)}.
Referenced from 4 locations
Here =𝛽 is restricted to pairs of terms already typed at 𝐴; it is therefore an equivalence relation on the displayed set. Subject reduction, proposition 5.14, additionally says that every forward reduct of such a term remains in that set. Syntax is a set—indeed it is countable—so the family, indexed by closed type pairs (𝐴,𝐵), of all subsets of 𝖳𝗆(𝐴) ×𝖳𝗆(𝐵) is one fixed set in the classical ZF metatheory fixed in chapter 5. This is the meta-level, as opposed to a construction expressed inside System F. Every relation used here is a subset of this fixed syntactic set, so Reynolds’ obstruction to full set-theoretic impredicativity does not apply.
Given 𝑅 :𝐴 ↔𝐵 and 𝑆 :𝐶 ↔𝐷, define [𝑓](𝑅⇒𝑆)[𝑔]⟺for every [𝑎]𝑅[𝑏], one has [𝑓𝑎]𝑆[𝑔𝑏]. Thus 𝑅 ⇒𝑆 relates terms of types 𝐴 →𝐶 and 𝐵 →𝐷. For a closed 𝑘 :𝐴 →𝐵, its graph relation is [𝑎]𝖦𝗋(𝑘)[𝑏]⟺𝑘𝑎=𝛽𝑏.
Referenced from 2 locations
Relations need not have equal endpoint types. For example, {([𝗍𝗋𝗎𝖾𝐹],[――0]),([𝖿𝖺𝗅𝗌𝖾𝐹],[――1])}:𝖡𝗈𝗈𝗅𝐹↔𝖭𝖺𝗍𝐹 is a heterogeneous relation. It pairs observations across two encodings; it is neither an equality relation nor the graph of an endofunction.
Arrow lifting is the binary analogue of chapter 5’s candidate-arrow construction: both require an operation to send admissible inputs to admissible outputs. Here both inputs and outputs come in related pairs. Like the underlying type arrow, ⇒ associates to the right.
These definitions use beta-classes, not chosen representatives. For example, if 𝑓 =𝛽𝑓′, 𝑎 =𝛽𝑎′, and [𝑓 𝑎]𝑆[𝑔 𝑏], compatible reduction gives 𝑓′ 𝑎′ =𝛽𝑓 𝑎; changing 𝑔,𝑏 gives 𝑔′ 𝑏′ =𝛽𝑔 𝑏 in the same way. Thus the same relation statement holds after changing any representative. Graph relations satisfy the following calculation.
Let 𝑘 :𝐴 →𝐵, 𝑓 :𝐴 →𝐴, and 𝑔 :𝐵 →𝐵 be closed. Then [𝑓](𝖦𝗋(𝑘)⇒𝖦𝗋(𝑘))[𝑔] if and only if, for every closed 𝑎 :𝐴, 𝑘(𝑓𝑎)=𝛽𝑔(𝑘𝑎).
Referenced from 3 locations
Proof of Lemma 6.3 — Graph calculation
Proof. Suppose first that the lifted relation holds. Since [𝑎] 𝖦𝗋(𝑘) [𝑘𝑎], its defining implication gives [𝑓𝑎] 𝖦𝗋(𝑘) [𝑔(𝑘𝑎)], which is the displayed equation.
Conversely, let [𝑎] 𝖦𝗋(𝑘) [𝑏], so 𝑘𝑎 =𝛽𝑏. The assumed equation and compatible beta conversion give 𝑘(𝑓𝑎)=𝛽𝑔(𝑘𝑎)=𝛽𝑔𝑏. This says precisely that [𝑓𝑎] 𝖦𝗋(𝑘) [𝑔𝑏]. ◻
★★☆ Prove directly that arrow lifting and graph relations are independent of all chosen beta-class representatives. Then show that 𝖤𝗊𝐴⇒𝖤𝗊𝐵 contains the beta-class of every closed 𝑓 :𝐴 →𝐵 paired with itself. Do not claim that this lifted relation is equal to 𝖤𝗊𝐴→𝐵: membership is all that the assertion asks you to prove.
Referenced from 3 locations
Reading a type as a relation
A free type variable must now carry three pieces of data: a left type, a right type, and a relation between them.
Let Δ =𝑋1,…,𝑋𝑛 be a formed type-variable context. A relation environment 𝜚 over Δ assigns to every 𝑋 ∈Δ a triple 𝜚(𝑋)=(𝐴𝑋,𝐵𝑋,𝑅𝑋),𝑅𝑋:𝐴𝑋↔𝐵𝑋, where 𝐴𝑋 and 𝐵𝑋 are closed formed types. Its two endpoint substitutions are 𝜚0(𝑋)=𝐴𝑋,𝜚1(𝑋)=𝐵𝑋. We write “𝜚 relates 𝜚0 and 𝜚1 over Δ”, abbreviated 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ. The symbol 𝜚 is reserved here for relation environments; the row metavariable 𝜌 of chapter 4 retains its earlier role.
Referenced from 3 locations
Write 𝜖 for the unique relation environment over the empty type context. This symbol will not be used for the empty relation.
The endpoint substitutions are simultaneous, capture-avoiding type substitutions in the sense of convention 5.2. Bound type variables are first synchronized away from their finite ranges.
If Δ ⊢𝐴 𝗍𝗒𝗉𝖾 and 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ, choose a raw representative of 𝐴 whose binders avoid dom(Δ) and the finite ranges of 𝜚0,𝜚1. On that representative define a relation [[𝐴]]𝜚:𝐴[𝜚0]↔𝐴[𝜚1] by structural recursion on 𝐴: [[𝑋]]𝜚:=𝑅𝑋when 𝜚(𝑋)=(𝐴𝑋,𝐵𝑋,𝑅𝑋),[[𝐴→𝐵]]𝜚:=[[𝐴]]𝜚⇒[[𝐵]]𝜚. [𝑝][[∀𝑋.𝐴]]𝜚[𝑞]⟺for all closed formed 𝐶,𝐷 and all 𝑆:𝐶↔𝐷,[𝑝[𝐶]][[𝐴]]𝜚[𝑋↦(𝐶,𝐷,𝑆)][𝑞[𝐷]]. In the last clause, first alpha-rename 𝑋 away from dom(Δ) and the finite ranges of the displayed endpoint substitutions. The double brackets carry a binary relation here, where in chapter 5 the same brackets carried a unary candidate set.
Referenced from 6 locations
Suppose Δ,𝑋 ⊢𝐴 𝗍𝗒𝗉𝖾 and 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ. Let 𝑌 ∉dom(Δ) and suppose 𝑌 does not occur in the chosen raw representative of 𝐴. Let 𝐶,𝐷 be closed formed types with 𝑆 :𝐶 ↔𝐷. Then [[𝐴[𝑌/𝑋]]]𝜚[𝑌↦(𝐶,𝐷,𝑆)]=[[𝐴]]𝜚[𝑋↦(𝐶,𝐷,𝑆)]. Consequently definition 6.5 is independent of the chosen alpha-equivalent representative of 𝐴.
Referenced from 3 locations
Proof of Lemma 10.6 — Relational alpha-equivariance
Proof. Induct on the displayed representative of 𝐴. If 𝐴 =𝑋, both sides are 𝑆. The variable case 𝐴 =𝑍 ≠𝑋 uses the unchanged 𝑍-entry of 𝜚; the freshness hypothesis excludes 𝑍 =𝑌. The arrow case applies the two induction hypotheses and then the arrow-lifting clause.
For 𝐴 =∀𝑍.𝐵, first alpha-rename 𝑍 away from {𝑋,𝑌} ∪dom(Δ) and the finite ranges of 𝜚0,𝜚1. Take arbitrary closed formed 𝐸,𝐹 and a relation 𝑇 :𝐸 ↔𝐹. The two universal clauses compare the body relations under, respectively, 𝜚[𝑌↦(𝐶,𝐷,𝑆)][𝑍↦(𝐸,𝐹,𝑇)],𝜚[𝑋↦(𝐶,𝐷,𝑆)][𝑍↦(𝐸,𝐹,𝑇)]. The 𝑍-extension commutes with the 𝑋- and 𝑌-extensions. Apply the induction hypothesis to 𝐵 under 𝜚[𝑍 ↦(𝐸,𝐹,𝑇)]; it equates these body relations. Since 𝐸,𝐹,𝑇 were arbitrary, the universal clauses are equal.
One alpha-conversion ∀𝑋.𝐴 =𝛼∀𝑌.𝐴[𝑌/𝑋] is therefore interpreted equally. The variable and arrow congruence cases preserve equality of interpretations, and the universal congruence case is the calculation just proved. Reflexivity, symmetry, and transitivity are inherited from equality of relations. Induction on the generation of alpha-equivalence gives independence from every representative. ◻
The family 𝐴 ↦[[𝐴]]𝜚 just constructed from the variable, arrow, and universal clauses is the chapter’s logical relation. The phrase names the entire type-indexed family, not one chosen endpoint relation.
Referenced from 2 locations
The tempting clause [𝑝][[∀𝑋.𝐴]]𝜚[𝑞]⟺∀𝐶,𝐷,𝑆.[𝑝[𝐶]][[𝐴[𝐶/𝑋]]]𝜚[𝑞[𝐷]] is not structurally recursive: 𝐴[𝐶/𝑋] need not be a subexpression of ∀𝑋.𝐴. The actual universal clause recurses at the proper syntactic subexpression 𝐴, under a larger environment. Its quantifiers range over the fixed meta-set described after definition 6.1. The result of the universal clause is itself one of the relations over which such clauses quantify. This impredicative use is Separation over that fixed set of term pairs; it does not construct a new universe of relations.
The arrow and universal clauses in definition 6.5 are independent of every chosen term representative. In particular, 𝑝=𝛽𝑝′⟹𝑝[𝐶]=𝛽𝑝′[𝐶] for every closed formed 𝐶.
Referenced from 2 locations
Proof of Lemma 6.6 — Compatibility with beta-classes
Proof. Compatible beta reduction is closed under both term application and type application. Hence 𝑓=𝛽𝑓′, 𝑎=𝛽𝑎′⟹𝑓𝑎=𝛽𝑓′𝑎′,𝑝=𝛽𝑝′⟹𝑝[𝐶]=𝛽𝑝′[𝐶]. For the arrow clause, changing representatives therefore changes neither the premise class nor the conclusion class of its defining implication. For the universal clause, the second equation shows that, for every 𝐶,𝐷,𝑆, the two type applications determine the same beta-classes in the recursively defined body relation. Thus both clauses define relations on the quotient sets 𝖳𝗆( −). ◻
Here is a complete expansion. Suppose 𝜚(𝑌) =(𝐸0,𝐸1,𝑇) and put 𝑃:=∀𝑋.(𝑋→𝑌)→𝑋→𝑌. Then [𝑝][[𝑃]]𝜚[𝑞] means that for every 𝑆 :𝐶 ↔𝐷, every [𝑓](𝑆⇒𝑇)[𝑔],[𝑎]𝑆[𝑏], one has [𝑝[𝐶]𝑓𝑎]𝑇[𝑞[𝐷]𝑔𝑏]. The left endpoint of 𝑃 is ∀𝑋.(𝑋 →𝐸0) →𝑋 →𝐸0; the right endpoint replaces 𝐸0 by 𝐸1. Every symbol in the expanded assertion is therefore typed.
★☆☆ Expand [[∀𝑋.(𝑌→𝑋)→𝑌→𝑋]]𝜚 in the same fashion. Display the left and right endpoint types, then state the relation on the two function arguments and on the two 𝑌-arguments.
Referenced from 3 locations
The endpoint calculation and irrelevant-variable property are:
Let Δ ⊢𝐴 𝗍𝗒𝗉𝖾.
For every 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ, [[𝐴]]𝜚 is a relation from 𝖳𝗆(𝐴[𝜚0]) to 𝖳𝗆(𝐴[𝜚1]).
If 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ and 𝜚′ :𝜚′0 ↔𝜚′1 𝗈𝗏𝖾𝗋 Δ, and 𝜚(𝑋) =𝜚′(𝑋) as endpoint-and-relation triples for every 𝑋 ∈ftv(𝐴), then [[𝐴]]𝜚 =[[𝐴]]𝜚′.
Referenced from 3 locations
Proof of Lemma 6.7 — Endpoints and irrelevant variables
Proof. For item 1, induct on 𝐴. Variables use the corresponding environment entry, and arrows use the induction hypotheses at domain and codomain. For ∀𝑋.𝐵, choose 𝑋 fresh for both environments. Its endpoint is (∀𝑋.𝐵)[𝜚𝑖] =∀𝑋.𝐵[𝜚𝑖]. If 𝐶 is closed, type application has endpoint ((∀𝑋.𝐵)[𝜚𝑖])[𝐶]:𝐵[𝜚𝑖][𝐶/𝑋]=𝐵[𝜚𝑖,𝑋↦𝐶], where the equality is the simultaneous/single type-substitution composition equation of equation 5.2. The induction hypothesis types the body relation at these two endpoints.
For item 2, run a second structural induction on 𝐴. The variable case uses agreement on that variable; the arrow case applies the two induction hypotheses. At ∀𝑋.𝐵, freshen 𝑋 for both environments and extend each by the same arbitrary triple (𝐶0,𝐶1,𝑆). The extended environments agree on ftv(𝐵), so the induction hypothesis equates the body relations for every such triple. The universal clauses are therefore equal. ◻
Suppose Δ0,𝑋,Δ1 ⊢𝐴 𝗍𝗒𝗉𝖾, Δ0 ⊢𝐵 𝗍𝗒𝗉𝖾, and 𝜚 :𝜚0 ↔𝜚1 𝗈𝗏𝖾𝗋 Δ0,Δ1. Put 𝜚+:=𝜚[𝑋↦(𝐵[𝜚0],𝐵[𝜚1],[[𝐵]]𝜚)]. Then [[𝐴[𝐵/𝑋]]]𝜚=[[𝐴]]𝜚+. The two relations have endpoints 𝐴[𝐵/𝑋][𝜚𝑖] =𝐴[𝜚𝑖,𝑋 ↦𝐵[𝜚𝑖]].
Referenced from 7 locations
Proof of Lemma 6.8 — Relational type substitution
Proof. Induct on 𝐴. For 𝐴 =𝑋, both sides are [[𝐵]]𝜚. For a variable 𝑌 ≠𝑋, both sides are 𝑅𝑌. For an arrow 𝐶 →𝐷, the induction hypotheses give [[𝐶[𝐵/𝑋]]]𝜚 =[[𝐶]]𝜚+ and [[𝐷[𝐵/𝑋]]]𝜚 =[[𝐷]]𝜚+; substituting these equalities into the arrow clause equates the two arrow liftings.
The induction assertion is the displayed split-context statement, with an arbitrary suffix Δ1. Thus it remains available when a binder is added to that suffix. If we had proved only the case Δ1 = ⋅, the universal case would require the unavailable instance Δ1 =𝑌. For that case, write 𝐴 =∀𝑌.𝐶 after choosing 𝑌 distinct from 𝑋 and fresh for 𝐵, both endpoint substitutions, and the domains of the split context Δ0,Δ1. For arbitrary closed 𝐷0,𝐷1 and 𝑆 :𝐷0 ↔𝐷1, the extended judgment 𝜚[𝑌↦(𝐷0,𝐷1,𝑆)]:𝜚0[𝑌↦𝐷0]↔𝜚1[𝑌↦𝐷1] 𝗈𝗏𝖾𝗋 Δ0,Δ1,𝑌 is formed without overwriting an existing entry. The left-hand universal clause invokes [[𝐶[𝐵/𝑋]]]𝜚[𝑌↦(𝐷0,𝐷1,𝑆)]. The induction hypothesis turns this into [[𝐶]]𝜚[𝑌↦(𝐷0,𝐷1,𝑆)][𝑋↦(𝐵[𝜚0],𝐵[𝜚1],[[𝐵]]𝜚)]. Because 𝑌 ∉ftv(𝐵), extending at 𝑌 does not change 𝐵[𝜚𝑖] or [[𝐵]]𝜚. The two extensions commute, so this is exactly the body relation under 𝜚+[𝑌↦(𝐷0,𝐷1,𝑆)]:𝜚+0[𝑌↦𝐷0]↔𝜚+1[𝑌↦𝐷1] 𝗈𝗏𝖾𝗋 Δ0,Δ1,𝑌, which is the right-hand universal clause. The endpoint equation is the type-substitution composition equation of equation 5.2. ◻
★★☆ Repeat the universal case when the original displayed binder occurs in the range of 𝜚0, 𝜚1, or in 𝐵. Choose a single fresh replacement, write both environment extensions after freshening, and identify the exact line at which 𝑌 ∉ftv(𝐵) is used.
Referenced from 3 locations
The abstraction theorem
An open term must be closed twice, once at each endpoint. The two closing substitutions are not assumed equal; their corresponding entries are assumed related.
Thus 𝛾0 [[Γ]]𝜚 𝛾1 is not an application of the type-relation notation to a context: it denotes the pointwise lifting of the already defined type relations to a pair of closing substitutions.
The theorem’s notation is now all defined: 𝜚(𝑋)=(𝐴𝑋,𝐵𝑋,𝑅𝑋)relation environment entry𝜚0,𝜚1left and right endpoint substitutions[[𝐴]]𝜚relation interpreting type 𝐴𝛾0[[Γ]]𝜚𝛾1related closing substitutions𝛾0,𝛾1closing term substitutions at the endpoints[𝑡], 𝖳𝗆(𝐴)beta class of 𝑡 and classes at 𝐴𝖤𝗊𝐴, 𝖦𝗋(𝑘), 𝑅⇒𝑆beta identity, graph, and arrow lifting The suffix “over Δ” distinguishes a relation environment from a single relation 𝑅 :𝐴 ↔𝐵.
For example, if Γ =𝑥 :𝑋,𝑓 :𝑋 →𝑌, then related closing substitutions provide [𝛾0(𝑥)]𝑅𝑋[𝛾1(𝑥)],[𝛾0(𝑓)](𝑅𝑋⇒𝑅𝑌)[𝛾1(𝑓)]. The second hypothesis can be applied to the first, yielding related interpretations of 𝑓𝑥. The abstraction theorem says that every typing derivation is built from this same operation.
Suppose Δ;Γ⊢𝑡:𝐴,𝜚:𝜚0↔𝜚1 𝗈𝗏𝖾𝗋 Δ,𝛾0[[Γ]]𝜚𝛾1. Put 𝑡𝑖:=𝑡[𝜚𝑖][𝛾𝑖] for 𝑖 =0,1. Then [𝑡0][[𝐴]]𝜚[𝑡1]. Here the bracketed substitutions are simultaneous, capture-avoiding substitutions of the two sorts defined in convention 5.2.
Referenced from 5 locations
Proof of Theorem 6.10 — Abstraction theorem
Proof. Induct on the Church-style typing derivation. There are five final-rule cases. The two rules for the universal type use lemma 6.8; the other three unfold the variable or arrow clause directly.
Variable. If the last rule reads 𝑥 :𝐵 ∈Γ, the conclusion is exactly the 𝑥 :𝐵 component of 𝛾0 [[Γ]]𝜚 𝛾1.
Arrow introduction. Suppose the last premise is Δ;Γ,𝑥 :𝐵 ⊢𝑢 :𝐶. Choose the binder 𝑥 fresh for the finite ranges of 𝛾0 and 𝛾1. To prove the arrow relation, take arbitrary closed 𝑎,𝑏 with [𝑎][[𝐵]]𝜚[𝑏]. The extended substitutions 𝛾0[𝑥↦𝑎],𝛾1[𝑥↦𝑏] are related at Γ,𝑥 :𝐵. The induction hypothesis gives related bodies at [[𝐶]]𝜚. Term beta gives, at each endpoint, (𝜆𝑥:𝐵[𝜚𝑖].𝑢[𝜚𝑖][𝛾𝑖])𝑎𝑖=𝛽𝑢[𝜚𝑖][𝛾𝑖[𝑥↦𝑎𝑖]], where 𝑎0 =𝑎 and 𝑎1 =𝑏. This is the required arrow clause. The equality on the right uses the term/term substitution-composition equation of equation 5.2, after the displayed binder has been freshened.
Arrow elimination. The operator induction hypothesis gives a pair in [[𝐵]]𝜚 ⇒[[𝐶]]𝜚; the argument induction hypothesis gives a pair in [[𝐵]]𝜚. Applying the definition of arrow lifting gives the conclusion at [[𝐶]]𝜚.
Universal introduction. Suppose the premise is Δ,𝑋;Γ ⊢𝑢 :𝐵, with 𝑋 fresh for Δ. Let closed 𝐶0,𝐶1 and a relation 𝑆 :𝐶0 ↔𝐶1 be arbitrary. Extend 𝜚 to 𝜚′:=𝜚[𝑋↦(𝐶0,𝐶1,𝑆)]. Every declaration type in Γ was formed under Δ, so it contains no free 𝑋. By lemma 6.7, the original 𝛾0,𝛾1 remain related at Γ under 𝜚′. Apply the induction hypothesis to the premise. On endpoint 𝑖, the resulting body is beta-convertible to the type application of the substituted abstraction: ((Λ𝑋.𝑢)[𝜚𝑖][𝛾𝑖])[𝐶𝑖]=𝛽𝑢[𝜚𝑖,𝑋↦𝐶𝑖][𝛾𝑖]. Type and term substitution commute because every 𝛾𝑖(𝑥) is closed; this is the last equation of equation 5.2. Since 𝐶0,𝐶1,𝑆 were arbitrary, the universal relation holds.
Universal elimination. Suppose the premise has type ∀𝑋.𝐵 and the supplied type is 𝐶. The operator induction hypothesis is a pair in [[∀𝑋.𝐵]]𝜚. Instantiate its defining universal quantifier with 𝐶[𝜚0],𝐶[𝜚1],[[𝐶]]𝜚. The resulting relation is [[𝐵]]𝜚[𝑋↦(𝐶[𝜚0],𝐶[𝜚1],[[𝐶]]𝜚)]. By lemma 6.8, it is exactly [[𝐵[𝐶/𝑋]]]𝜚, the relation required by the conclusion. For 𝑖 =0,1, the endpoint term printed by the conclusion is the same alpha-class as the endpoint term just obtained: (𝑢[𝐶])[𝜚𝑖][𝛾𝑖]=𝛼(𝑢[𝜚𝑖])[𝐶[𝜚𝑖]][𝛾𝑖](type-application substitution),=𝛼(𝑢[𝜚𝑖][𝛾𝑖])[𝐶[𝜚𝑖]](closed-image composition). The two annotations invoke, respectively, the type-application substitution clause and the term/type substitution-composition equation of equation 5.2; the latter applies because every 𝛾𝑖(𝑥) is closed. The variable, arrow-introduction, arrow-elimination, universal-introduction, and universal-elimination cases exhaust the Church typing derivation. ◻
The universal-elimination case is short only because its substitution equation was proved first. Without that lemma one obtains related terms at a relation with the right ingredients but no established connection to the result type printed by F-All-E.
★★☆ Let 𝑌 ≠𝑍 and suppose 𝑌,𝑍;⋅⊢𝑞:∀𝑋.(𝑋→𝑌)→𝑋→𝑌. Reconstruct the universal-elimination case for 𝑞[𝑍], showing the two endpoint types of 𝑍, the relation chosen for 𝑍, and the final use of lemma 6.8.
Referenced from 3 locations
If ⋅; ⋅ ⊢𝑡 :𝐴, then [𝑡][[𝐴]]𝜖[𝑡]. More generally, beta-equal closed terms may replace either occurrence.
Referenced from 4 locations
Proof of Corollary 6.11 — Self-parametricity
Proof. Use theorem 6.10 with empty type and term environments. Replacement is legitimate because every relation was defined on beta-classes. ◻
Self-parametricity gives the relation needed to prove the opening equation without normalizing ℎ.
If ⋅; ⋅ ⊢ℎ :∀𝑋.𝑋 →𝑋, then for every closed ⋅; ⋅ ⊢𝑎 :𝐴, ℎ[𝐴]𝑎=𝛽𝑎.
Referenced from 3 locations
Proof of Proposition 6.12 — The polymorphic endomap is pointwise the identity
Proof. Apply self-parametricity and instantiate the universal clause with the singleton relation 𝑆:={([𝑎],[𝑎])},𝑆:𝐴↔𝐴. The arrow clause sends the unique input pair to an output pair in 𝑆. Membership in this singleton says ℎ[𝐴]𝑎=𝛽𝑎. ◻
If ⋅; ⋅ ⊢ℎ :∀𝑋.𝑋 →𝑋, let 𝑃 be any collection of beta-equivalence classes of closed terms of a closed type 𝐴. If [𝑎] ∈𝑃, then [ℎ[𝐴]𝑎] ∈𝑃.
Referenced from 2 locations
Proof of Corollary 10.15 — Unary preservation
Proof. By proposition 6.12, ℎ[𝐴]𝑎 =𝛽𝑎, so the two terms determine the same beta class. Equivalently, instantiate self-parametricity with the diagonal relation on the classes in 𝑃. ◻
Thus unary preservation is obtained as a corollary of the binary theorem. A unary logical relation could prove it directly, but would not compare two different representations.
The empty relation is equally useful.
The Church type 𝖵𝗈𝗂𝖽𝐹:=∀𝑋.𝑋 has no closed inhabitant.
Referenced from 4 locations
Proof of Corollary 6.13 — Parametric emptiness
Proof. If 𝑣 :∀𝑋.𝑋 were closed, self-parametricity would allow the universal clause to be instantiated with the empty relation ∅ :𝖡𝗈𝗈𝗅𝐹 ↔𝖡𝗈𝗈𝗅𝐹. It would then assert [𝑣[𝖡𝗈𝗈𝗅𝐹]]∅[𝑣[𝖡𝗈𝗈𝗅𝐹]], which is impossible. ◻
This is a second relative-consistency proof for pure Church-style System F in the classical ZF metatheory fixed in chapter 5. Unlike corollary 5.36, it does not use strong normalization: the contradiction follows from the syntactic abstraction theorem and the empty external relation alone.
The failure of unrestricted identity extension
It is tempting to expect [[𝐴]]𝜖=𝖤𝗊𝐴 for every closed 𝐴. Equation (6.3) is called identity extension at 𝐴. Self-parametricity proves the inclusion from right to left. The reverse inclusion is false for beta equality. Before constructing the counterexample, proposition 6.14 proves the two observation instances used in proposition 6.15.
For the closed encodings of definition 5.15, definition 5.18, [[𝖡𝗈𝗈𝗅𝐹]]𝜖=𝖤𝗊𝖡𝗈𝗈𝗅𝐹,[[𝖭𝖺𝗍𝐹]]𝜖=𝖤𝗊𝖭𝖺𝗍𝐹.
Referenced from 8 locations
Proof of Proposition 6.14 — Identity extension at Church observations
Proof. The inclusions from right to left are corollary 6.11. For the converse, first suppose [𝑢][[𝖡𝗈𝗈𝗅𝐹]]𝜖[𝑣]. Normalize 𝑢 and 𝑣. By proposition 5.39, each normal form is 𝗍𝗋𝗎𝖾𝐹 or 𝖿𝖺𝗅𝗌𝖾𝐹. Unfolding the encoded Boolean gives [𝑢][[𝖡𝗈𝗈𝗅𝐹]]𝜖[𝑣]⟺for every 𝑆:𝐶↔𝐷,[𝑢[𝐶]](𝑆⇒(𝑆⇒𝑆))[𝑣[𝐷]]. Take 𝐶 =𝐷 =𝖡𝗈𝗈𝗅𝐹 and in the universal clause choose 𝖤𝗊𝖡𝗈𝗈𝗅𝐹:𝖡𝗈𝗈𝗅𝐹↔𝖡𝗈𝗈𝗅𝐹 and then choose the related branch pairs (𝗍𝗋𝗎𝖾𝐹,𝗍𝗋𝗎𝖾𝐹) and (𝖿𝖺𝗅𝗌𝖾𝐹,𝖿𝖺𝗅𝗌𝖾𝐹). The two resulting eliminations must be beta-equal. They reduce to the chosen normal forms of 𝑢 and 𝑣, so those normal forms are the same boolean. Concretely, for either Boolean normal form 𝑏, 𝑏[𝖡𝗈𝗈𝗅𝐹]𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹=𝛽𝑏; the two eliminations therefore expose the normal forms being compared.
For naturals, normalize and use the same proposition to write the normal forms as ――𝑚 and ――𝑛. In the universal clause choose 𝖤𝗊𝖭𝖺𝗍𝐹, the related zero pair, and the pair (𝗌𝗎𝖼𝖼𝐹,𝗌𝗎𝖼𝖼𝐹). The latter lies in 𝖤𝗊𝖭𝖺𝗍𝐹 ⇒𝖤𝗊𝖭𝖺𝗍𝐹 by compatible beta conversion. The two iterator results are therefore beta-equal, but they reduce to ――𝑚 and ――𝑛. For an endomap 𝑓, write 𝑓0𝑎 =𝑎 and 𝑓𝑘+1𝑎 =𝑓(𝑓𝑘𝑎). The required iterator computation follows by induction on the numeral spine: ――𝑘[𝖭𝖺𝗍𝐹]――0𝗌𝗎𝖼𝖼𝐹⟶∗𝛽𝗌𝗎𝖼𝖼𝑘𝐹――0⟶∗𝛽――𝑘. The base case contracts the three encoding binders to ――0; the successor case exposes one additional application of 𝗌𝗎𝖼𝖼𝐹 and uses the induction hypothesis on the remaining spine. Uniqueness of normal forms gives 𝑚 =𝑛. ◻
Equation (6.3) fails. In particular, 𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝗍𝗋𝗎𝖾𝐹and𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝖿𝖺𝗅𝗌𝖾𝐹 are related by [[𝖵𝗈𝗂𝖽𝐹 →𝖡𝗈𝗈𝗅𝐹]]𝜖 but are not beta-equal.
Referenced from 7 locations
Proof of Proposition 6.15 — Failure of unrestricted beta identity extension
Proof. By corollary 6.13, 𝖳𝗆(𝖵𝗈𝗂𝖽𝐹) is empty. Hence the domain relation [[𝖵𝗈𝗂𝖽𝐹]]𝜖 has no pairs. The implication in the arrow lifting is therefore vacuous, so it relates the two displayed functions. They are distinct beta-normal forms, and theorem 5.38 shows that they are not beta-convertible. ◻
The missing principle is extensionality. For simple types alone, a first-order set interpretation may take arrows to be full function sets and prove 𝖤𝗊𝑆⇒𝖤𝗊𝑇=𝖤𝗊𝑆→𝑇 using function extensionality: two set-theoretic functions are equal when they agree at every argument. Reynolds’ obstruction says that this simple model cannot be extended with System F’s impredicative universal type. A parametric semantic model may validate its own identity-extension lemma. The syntactic beta-quotient used here does not validate the general equation.
★★☆ Verify every typing judgment in proposition 6.15. Then replace 𝖡𝗈𝗈𝗅𝐹 by 𝖭𝖺𝗍𝐹 and construct two further distinct related beta-normal functions. Which single premise of the arrow relation is never tested?
Referenced from 3 locations
Free theorems by choosing a relation
Consequences obtained by choosing a relation are called free theorems because the type alone yields them through the abstraction theorem; the polymorphic program’s text is never inspected.
The abstraction theorem is fixed; its applications differ mainly in the relation one chooses. We give two calculations in full.
If ⋅;⋅⊢𝑞:∀𝑋.∀𝑌.(𝑋→𝑌)→𝑋→𝑌, then for every closed 𝑓 :𝐴 →𝐵 and 𝑎 :𝐴, 𝑞[𝐴][𝐵]𝑓𝑎=𝛽𝑓𝑎.
Referenced from 3 locations
Proof of Proposition 6.16 — Polymorphic application
Proof. Self-parametricity permits two relation choices. At 𝑋, choose 𝑅:={([𝑎],[𝑎])},𝑅:𝐴↔𝐴; at 𝑌, choose 𝑆:={([𝑓𝑎],[𝑓𝑎])},𝑆:𝐵↔𝐵. Thus the two universal clauses use equal endpoint types (𝐴,𝐴) and then (𝐵,𝐵); heterogeneous endpoints are available but not needed here. The sole premise in the definition of 𝑅 ⇒𝑆 shows [𝑓](𝑅 ⇒𝑆)[𝑓]. Applying the resulting arrow relation first to 𝑓 and then to the unique 𝑅-pair puts ([𝑞[𝐴][𝐵]𝑓𝑎],[𝑞[𝐴][𝐵]𝑓𝑎]) in 𝑆. Membership in 𝑆 is the claimed beta equation. ◻
The abstraction theorem also implies iterator naturality (theorem 6.17) without classifying the normal form of ℎ.
Let ℎ:∀𝑋.(𝑋→𝑋)→𝑋→𝑋,𝑘:𝐴→𝐵,𝑓:𝐴→𝐴,𝑔:𝐵→𝐵 be closed. If 𝑘(𝑓𝑎)=𝛽𝑔(𝑘𝑎)for every closed 𝑎:𝐴, then every closed 𝑎 :𝐴 satisfies 𝑘(ℎ[𝐴]𝑓𝑎)=𝛽ℎ[𝐵]𝑔(𝑘𝑎).
Referenced from 4 locations
Proof of Theorem 6.17 — Iterator naturality
Proof. By lemma 6.3, the hypothesis is exactly [𝑓](𝖦𝗋(𝑘)⇒𝖦𝗋(𝑘))[𝑔]. Also [𝑎]𝖦𝗋(𝑘)[𝑘𝑎]. Self-parametricity of ℎ, instantiated at the heterogeneous relation 𝖦𝗋(𝑘) :𝐴 ↔𝐵, may therefore be read explicitly as [ℎ[𝐴]]((𝖦𝗋(𝑘)⇒𝖦𝗋(𝑘))⇒(𝖦𝗋(𝑘)⇒𝖦𝗋(𝑘)))[ℎ[𝐵]]. Apply this relation first to 𝑓,𝑔 and then to 𝑎,𝑘𝑎. It yields [ℎ[𝐴]𝑓𝑎]𝖦𝗋(𝑘)[ℎ[𝐵]𝑔(𝑘𝑎)], which unfolds to the desired equation. ◻
The normal-form argument proves this iterator equation by classifying every beta-normal inhabitant of the particular type, separating an eta-short case, and then inducting on an exponent. The abstraction theorem instead follows by one induction on the typing of an arbitrary System F term. Instantiating its relation variable with the graph relation records, in the relation itself, the invariant used by the normal-form proof.
When the chosen relation is 𝖦𝗋(𝑘), the last calculation says that the operations commute with change of representation along 𝑘: it is the commuting-square property called naturality. No categorical definition is needed for the proof here; the two uses of arrow lifting are the square written elementwise.
★★☆ Let 𝑏 :𝖡𝗈𝗈𝗅𝐹 and 𝑘 :𝐴 →𝐵 be closed. Use 𝖦𝗋(𝑘) to derive 𝑘(𝑏[𝐴]𝑎0𝑎1)=𝛽𝑏[𝐵](𝑘𝑎0)(𝑘𝑎1) for closed 𝑎0,𝑎1 :𝐴. Write the two uses of arrow lifting rather than appealing to a slogan about naturality.
Referenced from 3 locations
★★★ Fix a closed type 𝐴 and let 𝑟:∀𝑋.(𝐴→𝑋)→𝑋 be closed. Assuming identity extension at 𝐴, prove for every closed 𝑓 :𝐴 →𝐵 that 𝑟[𝐵]𝑓=𝛽𝑓(𝑟[𝐴](𝜆𝑥:𝐴.𝑥)). Use the graph of 𝑓 and state exactly where the identity-extension hypothesis at 𝐴 is needed. Explain why omitting that hypothesis would repeat the error exposed in proposition 6.15. You may first take 𝐴 =𝖭𝖺𝗍𝐹, for which proposition 6.14 proves the assumption, and then repeat the proof under the stated general hypothesis.
Referenced from 3 locations
Representation independence
An abstract counter supplies an initial state, a step operation, and an observer. A client that works for every representation type has the Church type 𝖢𝗅𝗂𝖾𝗇𝗍:=∀𝑂.∀𝑋.𝑋→(𝑋→𝑋)→(𝑋→𝑂)→𝑂. The result type 𝑂 is also quantified. This lets an application choose the exact observation relation it needs, without invoking general identity extension.
Let 𝐴,𝐵,𝑂0,𝑂1 be closed types and let 𝑅:𝐴↔𝐵,𝑆:𝑂0↔𝑂1. Suppose the following closed operations are related: [𝑖𝐴]𝑅[𝑖𝐵],[𝑠𝐴](𝑅⇒𝑅)[𝑠𝐵],[𝑟𝐴](𝑅⇒𝑆)[𝑟𝐵]. Then every closed 𝑐 :𝖢𝗅𝗂𝖾𝗇𝗍 satisfies [𝑐[𝑂0][𝐴]𝑖𝐴𝑠𝐴𝑟𝐴]𝑆[𝑐[𝑂1][𝐵]𝑖𝐵𝑠𝐵𝑟𝐵]. If 𝑂0 =𝑂1 =𝑂 and 𝑆 =𝖤𝗊𝑂, the two client results are beta-equal.
Referenced from 6 locations
Proof of Theorem 6.18 — Counter representation independence
Proof. Apply self-parametricity of 𝑐. Instantiate its outer universal clause at 𝑂0,𝑂1 with the relation 𝑆, and its inner universal clause at 𝐴,𝐵 with 𝑅. The remaining type is a chain of three arrows. Apply its relation successively as follows: [𝑐[𝑂0][𝐴]](𝑅⇒(𝑅⇒𝑅)⇒(𝑅⇒𝑆)⇒𝑆)[𝑐[𝑂1][𝐵]],⟹[𝑐[𝑂0][𝐴]𝑖𝐴]((𝑅⇒𝑅)⇒(𝑅⇒𝑆)⇒𝑆)[𝑐[𝑂1][𝐵]𝑖𝐵],⟹[𝑐[𝑂0][𝐴]𝑖𝐴𝑠𝐴]((𝑅⇒𝑆)⇒𝑆)[𝑐[𝑂1][𝐵]𝑖𝐵𝑠𝐵],⟹[𝑐[𝑂0][𝐴]𝑖𝐴𝑠𝐴𝑟𝐴]𝑆[𝑐[𝑂1][𝐵]𝑖𝐵𝑠𝐵𝑟𝐵]. The result is the asserted 𝑆-pair. When 𝑆 is beta identity, membership is beta equality by definition. ◻
Now compare two concrete implementations. Put 𝐴:=𝖭𝖺𝗍𝐹,𝐵:=𝖭𝖺𝗍𝐹×𝐹𝖡𝗈𝗈𝗅𝐹. These are the hidden state types. Define their operations by 𝑖𝐴:=𝗓𝖾𝗋𝗈𝐹,𝑖𝐵:=⟨𝗓𝖾𝗋𝗈𝐹,𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹,𝑠𝐴:=𝗌𝗎𝖼𝖼𝐹,𝑠𝐵:=𝜆𝑝:𝐵.⟨𝗌𝗎𝖼𝖼𝐹(𝖿𝗌𝗍𝐹(𝑝)),𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹,𝑟𝐴:=𝜆𝑛:𝖭𝖺𝗍𝐹.𝑛,𝑟𝐵:=𝜆𝑝:𝐵.𝖿𝗌𝗍𝐹(𝑝). The second representation stores a redundant boolean. Relate the states by [𝑛]𝑅[𝑝]⟺𝑝=𝛽⟨𝑛,𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹. Then [𝑖𝐴]𝑅[𝑖𝐵] by definition. If [𝑛]𝑅[𝑝], the product beta laws give 𝑠𝐵𝑝=𝛽⟨𝗌𝗎𝖼𝖼𝐹𝑛,𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹, so [𝑠𝐴𝑛]𝑅[𝑠𝐵𝑝]. The same hypothesis and the first projection beta law give 𝑟𝐴𝑛𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛𝑜𝑓𝑟𝐴=𝑛(6.5)𝑎𝑛𝑑×𝐹−𝛽=𝖿𝗌𝗍𝐹(𝑝)𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛𝑜𝑓𝑟𝐵=𝑟𝐵𝑝. Thus [𝑠𝐴](𝑅⇒𝑅)[𝑠𝐵],[𝑟𝐴](𝑅⇒𝖤𝗊𝖭𝖺𝗍𝐹)[𝑟𝐵]. The theorem applies with 𝑂 =𝖭𝖺𝗍𝐹 and 𝑆 =𝖤𝗊𝖭𝖺𝗍𝐹.
For a visible client, take 𝑐2:=Λ𝑂.Λ𝑋.𝜆𝑖:𝑋.𝜆𝑠:𝑋→𝑋.𝜆𝑟:𝑋→𝑂.𝑟(𝑠(𝑠𝑖)). With the first implementation, 𝑐2[𝖭𝖺𝗍𝐹][𝐴]𝑖𝐴𝑠𝐴𝑟𝐴⟶∗𝛽――2. With the second, two applications of 𝑠𝐵 produce ⟨――2,𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹, and the observer projects its first component: 𝑐2[𝖭𝖺𝗍𝐹][𝐵]𝑖𝐵𝑠𝐵𝑟𝐵⟶∗𝛽𝖿𝗌𝗍𝐹(⟨――2,𝖿𝖺𝗅𝗌𝖾𝐹⟩𝐹)⟶∗𝛽――2. Representation independence says the same for every closed, well-typed client of (6.4), not merely for this example.
Where the proof stops
The interpretation is structural because types are finite syntax trees, and the relation-preservation induction is uncluttered because the language is pure and has no exceptional constants. Strong normalization entered in proposition 6.14, where canonical forms turned related Church observations into beta equality. Four nearby extensions break four different lines of this account.
A hypothetical primitive typecase, with syntax such as 𝗍𝗒𝗉𝖾𝖼𝖺𝗌𝖾 𝑋 𝗈𝖿 {𝐶↦𝗍𝗋𝗎𝖾𝐹,_↦𝖿𝖺𝗅𝗌𝖾𝐹, where _ is a wildcard matching every type other than the preceding case, could define 𝑑 :∀𝑋.𝖡𝗈𝗈𝗅𝐹 whose operational observations at two distinct closed types 𝐶,𝐷 choose different branches. Keep, however, the beta quotient used by definition 6.5; do not silently enlarge beta equality with a typecase computation equation. Then 𝑑[𝐶] and 𝑑[𝐷] are distinct typecase-headed beta-normal forms. If one nevertheless tried to validate the same relational clauses, the universal clause could be instantiated with any 𝑅 :𝐶 ↔𝐷—the empty relation always exists. Because the result type 𝖡𝗈𝗈𝗅𝐹 ignores 𝑋, it would require [𝑑[𝐶]][[𝖡𝗈𝗈𝗅𝐹]]𝜖[𝑑[𝐷]]. Unfold the encoded-Boolean relation, choose 𝖤𝗊𝖡𝗈𝗈𝗅𝐹, and supply the related branch pairs (𝗍𝗋𝗎𝖾𝐹,𝗍𝗋𝗎𝖾𝐹) and (𝖿𝖺𝗅𝗌𝖾𝐹,𝖿𝖺𝗅𝗌𝖾𝐹). The resulting eliminations remain distinct typecase-headed beta-normal forms, so they are not related by beta identity. This is a direct beta-class counterexample; it neither infers a beta equation from the proposed operational observations nor invokes proposition 6.14. Thus a primitive typecase rule fails the universal case required by the abstraction theorem.
Suppose a polymorphic constant 𝖿𝗂𝗑 :∀𝑋.(𝑋 →𝑋) →𝑋 is added, with specializations 𝖿𝗂𝗑[𝐴] and the unfolding root 𝖿𝗂𝗑[𝐴]𝑓 ⟶𝑓(𝖿𝗂𝗑[𝐴]𝑓). For the empty relation 𝑅 :𝐴 ↔𝐴, the two identity functions are vacuously related by 𝑅 ⇒𝑅, but their fixed points cannot be related by 𝑅. Relations for partial languages therefore require additional order-theoretic conditions; the present relations on terminating beta-classes contain no information about divergence or finite approximation.
Mutable state makes the meaning of “related arguments” depend on related heaps before and after evaluation. A world records the heap locations and invariants currently assumed, and the relation must be indexed by that world; the present arrow clause contains no such index.
For a recursive type 𝜇𝑋.𝐴, defining its relation by immediately recursing to 𝐴[𝜇𝑋.𝐴/𝑋] is not structural recursion on a smaller type. This is the same failure of a decreasing structural call that impredicativity caused in section 5.7. Recursive-type semantics replace the simple induction with a construction that controls each recursive unfolding.
These are not four counterexamples to parametricity. They identify the data a stronger logical relation must remember.
The fixed-point obstruction determines the missing closure conditions.
A pointed 𝜔-cpo is a partial order 𝐴 with a least element ⊥𝐴 and a least upper bound ⨆𝑛𝑎𝑛 for every sequence with 𝑎𝑛 ≤𝐴𝑎𝑛+1. A function 𝑓 :𝐴 →𝐴 is continuous when it is monotone and 𝑓(⨆𝑛𝑎𝑛)=⨆𝑛𝑓(𝑎𝑛) for every increasing 𝜔-chain. For pointed 𝜔-cpos 𝐴,𝐵, a relation 𝑅 ⊆𝐴 ×𝐵 is strict when ⊥𝐴 𝑅 ⊥𝐵. It is admissible when, for all increasing chains (𝑎𝑛)𝑛 in 𝐴 and (𝑏𝑛)𝑛 in 𝐵, (∀𝑛. 𝑎𝑛𝑅𝑏𝑛)⟹(⨆𝑛𝑎𝑛)𝑅(⨆𝑛𝑏𝑛).
Referenced from 3 locations
Let 𝐴,𝐵 be pointed 𝜔-cpos, let 𝑓 :𝐴 →𝐴 and 𝑔 :𝐵 →𝐵 be continuous, and let 𝑅 ⊆𝐴 ×𝐵 be strict and admissible. If ∀𝑎∈𝐴. ∀𝑏∈𝐵.𝑎𝑅𝑏⟹𝑓(𝑎)𝑅𝑔(𝑏), then, with 𝜇𝑓:=⨆𝑛≥0𝑓𝑛(⊥𝐴),𝜇𝑔:=⨆𝑛≥0𝑔𝑛(⊥𝐵), one has (𝜇𝑓) 𝑅 (𝜇𝑔). Each displayed supremum is the least fixed point of its function.
Referenced from 3 locations
Proof of Proposition 10.23 — Least fixed points preserve strict admissible relations
Proof. Monotonicity and leastness of the bottoms make both approximation sequences increasing. Strictness supplies the base pair ⊥𝐴 𝑅 ⊥𝐵. The preservation hypothesis supplies the induction step, so 𝑓𝑛(⊥𝐴) 𝑅 𝑔𝑛(⊥𝐵) for every 𝑛. Admissibility now gives (𝜇𝑓) 𝑅 (𝜇𝑔).
Continuity calculates 𝑓(𝜇𝑓)=𝑓(⨆𝑛𝑓𝑛(⊥𝐴))=⨆𝑛𝑓𝑛+1(⊥𝐴)=𝜇𝑓; the last equality holds because deleting the least first approximation does not change the supremum. If 𝑓(𝑎) ≤𝐴𝑎, induction gives 𝑓𝑛(⊥𝐴) ≤𝐴𝑎 for every 𝑛, hence 𝜇𝑓 ≤𝐴𝑎. Thus 𝜇𝑓 is the least fixed point. The same argument with 𝐵,𝑔 proves the claim for 𝜇𝑔. ◻
The orders, least elements, and chain limits in definition 10.22 belong to a domain semantics for partial computation; none is a hidden premise of the strongly normalizing calculus studied here.
Two established parametricity developments use richer formal interfaces. The following definitions delimit the comparison; no theorem from either interface is used in the abstraction proof above.
The comparison logic extends typed System F terms with formulas generated by typed equality 𝑡 =𝐴𝑢, relation atoms 𝑅(𝑡,𝑢), implication, and universal quantification over terms 𝑥 :𝐴, types 𝑋, and relations 𝑅 ⊆𝐴 ×𝐵. A formula 𝜙 with distinguished variables 𝑥 :𝐴,𝑦 :𝐵 presents the definable relation (𝑥 :𝐴,𝑦 :𝐵).𝜙.
For a parameter-free type expression 𝐹(𝑋) and a closed 𝑢 :∀𝑋.𝐹(𝑋), its parametricity schema is the internal formula ∀𝑌.∀𝑍.∀𝑅⊆𝑌×𝑍.𝑢[𝑌]𝐹[𝑅]𝑢[𝑍], where 𝐹[𝑅] is the structural relation lifting. Its identity-extension principle is the internal equivalence 𝑝𝐹[𝖤𝗊𝑌]𝑞⟺𝑝=𝐹(𝑌)𝑞. The schema is an axiom of that logic, and its equality includes the logic’s beta–eta equality. Neither assertion is a theorem about the external beta-quotient of definition 6.5.
Referenced from 4 locations
The PE calculus separates value types 𝐵,𝐶 from computation types 𝐴――,𝐵――. With 𝑋 a value-type variable and 𝑋―― a computation-type variable, its two mutually defined grammars are 𝐵::=𝑋∣𝐵→𝐶∣∀𝑋.𝐵∣𝑋――∣∀𝑋――.𝐵∣𝐴――⊸𝐵――,𝐴――::=𝐵→𝐴――∣∀𝑋.𝐴――∣𝑋――∣∀𝑋――.𝐴――. Thus computation types form a subcollection of value types, while ⊸ classifies computation homomorphisms. Terms are typed by Γ ∣Δ ⊢𝑡 :𝐵, where Δ is empty or consists of one computation variable; a nonempty Δ requires 𝐵 to be a computation type.
Its categorical models are constructed in IZF. The value category C is a full subcategory of sets closed under set-indexed products and equalizers; it has a set of objects representing every object up to isomorphism and is replete under set isomorphism. A functor 𝑈 :A →C weakly creates limits and reflects isomorphisms; every hom-set A(𝐴,𝐵) is an object of C, and a set of objects of A represents every object up to isomorphism. Admissible relation classes RC and RA contain diagonals and are closed under reindexing and set-indexed intersections, with RA(𝐴,𝐵) ⊆RC(𝑈𝐴,𝑈𝐵). For any monad 𝑇 on C, its Eilenberg–Moore category with the forgetful functor and all categorical subobjects as the two relation classes supplies the standard example. Only under this syntax and model signature is its effectful relational interpretation claimed; it supplies no additional case of the pure theorem proved in theorem 6.10.
Referenced from 4 locations
Finally distinguish three results that are often given the same name.
The syntactic abstraction theorem proved here says that every derivable Church-style System F term preserves every external relation on closed typed beta-classes.
A semantic parametric model equips every semantic element with a relational action. It may validate a genuine identity-extension lemma, but that requires the model’s extensional and coherence structure.
An internal parametric theory places relations inside a richer type theory rather than keeping them solely in the metatheory. It validates internal terms and equations unavailable in bare System F.
The first result is enough for the free theorems and representation theorem above; the latter two describe strictly richer settings.
Bibliographic notes
Reynolds introduced the relational abstraction method and used it to prove independence of representations in [Rey83]; those pages also expose the identity-extension difficulty. The theorem above is the syntactic version for definition 5.4.
Wadler derives program equations from polymorphic types in [Wad89], states the relational theorem in [Wad89], and discusses fixpoints in [Wad89].
The formula grammar, relation quantifiers, definable relations, parametricity schema, and identity-extension principle isolated in definition 10.24 are the bounded interface of Plotkin and Abadi’s logic [PA93]. Their equality and axioms belong to that internal logic; the chapter does not import their identity-extension result into its beta-quotient.
The value/computation syntax, categorical hypotheses, admissible-relation closures, and Eilenberg–Moore example in definition 10.25 are recorded from Møgelberg and Simpson [MS09]. Their theorem concerns the PE model signature stated there, not bare Church-style System F.
Suggested first pass.
None of these problems is a prerequisite for later chapters. Begin with exercise 6.8, exercise 6.9; the calculator in exercise 10.10 is an optional experimental check.
★★★ Replace 𝐵 by 𝖭𝖺𝗍𝐹 ×𝐹𝖭𝖺𝗍𝐹 and relate 𝑛 to 𝑝 when 𝑝=𝛽⟨𝑛,𝑛⟩𝐹. Construct the initial state, step, and observer for the paired representation. Verify all three hypotheses of theorem 6.18, then calculate 𝑐2 under both implementations.
Referenced from 4 locations
★★★ Write the failed abstraction-theorem case for 𝖿𝗂𝗑[𝐴] using the empty relation. Explain why requiring a nonempty relation blocks only that instance. Then take a closed 𝑎 :𝐴 and the singleton 𝑅 ={([𝑎],[𝑎])}: show that the two identity functions are related by 𝑅 ⇒𝑅, whereas parametricity of 𝖿𝗂𝗑 would force 𝖿𝗂𝗑[𝐴] (𝜆𝑥 :𝐴.𝑥) =𝛽𝑎. Conclude that strictness, not mere nonemptiness, is the additional condition needed before admissibility can handle limits.
Referenced from 5 locations
★★★ Practical project.parametricity-calculator Implement finite beta-class relations together with identity, graph, and arrow lifting. Check the three obligations in the concrete counter calculation of theorem 6.18, and print the related output pair after each client application. The acceptance test must validate both counter representations through 𝑐2, validate the graph-lemma calculation for a supplied closed function, and reject the attempted fixed-point relation from exercise 6.9. Record explicitly which finite relation witnesses every successful check.
Referenced from 7 locations