exercise 6.1.
Suppose 𝑓 =𝛽𝑓′, 𝑔 =𝛽𝑔′, 𝑎 =𝛽𝑎′, and 𝑏 =𝛽𝑏′. Compatible beta conversion gives 𝑓𝑎=𝛽𝑓′𝑎′,𝑔𝑏=𝛽𝑔′𝑏′. Since 𝑅 and 𝑆 are relations on beta-classes, replacing either endpoint by these equal terms changes no membership assertion. Thus the implication defining 𝑅 ⇒𝑆 is independent of the four representatives. For a graph, also let 𝑘 =𝛽𝑘′. Compatible conversion in both the function and argument positions gives 𝑘𝑎=𝛽𝑏⟺𝑘′𝑎′=𝛽𝑏′, so the represented graph is unchanged by replacing (𝑘,𝑎,𝑏) with beta-equivalent representatives (𝑘′,𝑎′,𝑏′). Thus 𝖦𝗋(𝑘) is well defined on the quotient in all three arguments.
Now let 𝑓 :𝐴 →𝐵 be closed and suppose [𝑎]𝖤𝗊𝐴[𝑏]. By definition, 𝑎 =𝛽𝑏; compatible conversion then gives 𝑓𝑎 =𝛽𝑓𝑏. Hence [𝑓](𝖤𝗊𝐴⇒𝖤𝗊𝐵)[𝑓]. This proves membership, not equality of the lifted relation with 𝖤𝗊𝐴→𝐵. An arrow relation may be vacuous when its domain has no closed terms.
Exercise 6.2.
Write 𝜚(𝑌) =(𝐸0,𝐸1,𝑇). The two endpoint types are ∀𝑋.(𝐸0→𝑋)→𝐸0→𝑋,∀𝑋.(𝐸1→𝑋)→𝐸1→𝑋. For terms 𝑝 and 𝑞 at these endpoints, [𝑝][[∀𝑋.(𝑌→𝑋)→𝑌→𝑋]]𝜚[𝑞] means the following. For every pair of closed formed types 𝐶,𝐷, every relation 𝑆 :𝐶 ↔𝐷, every pair [𝑓](𝑇⇒𝑆)[𝑔], and every pair [𝑎]𝑇[𝑏], one has [𝑝[𝐶]𝑓𝑎]𝑆[𝑞[𝐷]𝑔𝑏]. Thus the two function arguments are related by 𝑇 ⇒𝑆, while the two 𝑌-arguments are related directly by 𝑇; applying the related functions turns the latter pair into an 𝑆-related result pair.
Exercise 6.3.
Let the universal subexpression originally be displayed as ∀𝑌.𝐶. Choose one name 𝑊 fresh for 𝑋, 𝐵, 𝐶, the finite ranges of both 𝜚0 and 𝜚1, and the domain of the ambient split context. Replace the binder by the alpha-equal display ∀𝑊.𝐶′,𝐶′:=𝐶[𝑊/𝑌]. This single replacement handles at once an occurrence of the old name 𝑌 in 𝐵 or in either endpoint substitution: none of those occurrences is captured, because the new binder is 𝑊.
For an arbitrary relational object 𝑄 =(𝐷0,𝐷1,𝑆) at 𝑊, the extension is formed without overwriting an ambient entry and satisfies 𝜚𝑊:(𝜚𝑊)0↔(𝜚𝑊)1 𝗈𝗏𝖾𝗋 Δ0,Δ1,𝑊,𝜚𝑊:=𝜚[𝑊↦𝑄]. The body relation on the left of the substitution equation is [[𝐶′[𝐵/𝑋]]]𝜚𝑊. The induction hypothesis changes it to [[𝐶′]]𝜚𝑊[𝑋↦(𝐵[(𝜚𝑊)0],𝐵[(𝜚𝑊)1],[[𝐵]]𝜚𝑊)].(1) Freshness gives 𝑊 ∉ftv(𝐵). Exactly here we use that fact: 𝐵[(𝜚𝑊)𝑖]=𝐵[𝜚𝑖](𝑖=0,1),[[𝐵]]𝜚𝑊=[[𝐵]]𝜚.(2) The second equality is irrelevance applied to the same freshness fact. Substituting (2) into (1) makes its environment 𝜚[𝑊↦𝑄][𝑋↦(𝐵[𝜚0],𝐵[𝜚1],[[𝐵]]𝜚)]. Since 𝑊 ≠𝑋 and the 𝑋-entry is independent of 𝑊, the extensions commute. It is therefore 𝜚[𝑋↦(𝐵[𝜚0],𝐵[𝜚1],[[𝐵]]𝜚)][𝑊↦𝑄], which is precisely the environment used by the body of the right-hand universal clause. The endpoint substitutions commute by the same capture-avoiding freshening. Quantifying over all 𝑄 completes the universal case.
exercise 6.4.
Write 𝜚(𝑌)=(𝑌0,𝑌1,𝑅𝑌),𝜚(𝑍)=(𝑍0,𝑍1,𝑅𝑍). The premise induction hypothesis for 𝑞 says [𝑞[𝜚0]][[∀𝑋.(𝑋→𝑌)→𝑋→𝑌]]𝜚[𝑞[𝜚1]]. In its universal clause choose endpoint types 𝑍0,𝑍1 and the relation 𝑅𝑍 =[[𝑍]]𝜚. It gives [𝑞[𝜚0][𝑍0]][[(𝑋→𝑌)→𝑋→𝑌]]𝜚[𝑋↦(𝑍0,𝑍1,𝑅𝑍)][𝑞[𝜚1][𝑍1]]. For 𝑖 =0,1, this is the endpoint term printed by the type-application conclusion because (𝑞[𝑍])[𝜚𝑖]=𝛼(𝑞[𝜚𝑖])[𝑍[𝜚𝑖]]=𝛼(𝑞[𝜚𝑖])[𝑍𝑖]. The first equality is the type-substitution clause for type application; the second is the definition of the endpoint substitution. The endpoint types are (𝑍0→𝑌0)→𝑍0→𝑌0,(𝑍1→𝑌1)→𝑍1→𝑌1. Finally, lemma 6.8 identifies the displayed middle relation with [[((𝑋→𝑌)→𝑋→𝑌)[𝑍/𝑋]]]𝜚, which is exactly the relation at the result type assigned to 𝑞[𝑍] by F-All-E.
exercise 6.5.
Formation gives ⋅ ⊢𝖵𝗈𝗂𝖽𝐹 𝗍𝗒𝗉𝖾 and ⋅ ⊢𝖡𝗈𝗈𝗅𝐹 𝗍𝗒𝗉𝖾. Weakening the two closed boolean typings under 𝑧 :𝖵𝗈𝗂𝖽𝐹 and applying F-Arr-I yields 𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝗍𝗋𝗎𝖾𝐹,𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝖿𝖺𝗅𝗌𝖾𝐹:𝖵𝗈𝗂𝖽𝐹→𝖡𝗈𝗈𝗅𝐹. The domain relation has no pairs because 𝖳𝗆(𝖵𝗈𝗂𝖽𝐹) =∅. Consequently the universal condition in the lifted arrow relation has no instance to check. This is the single premise that is never tested. The codomain values need not be related at all.
Replacing the codomain gives, for example, 𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝗓𝖾𝗋𝗈𝐹,𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.Λ𝑋.𝜆𝑥:𝑋.𝜆𝑠:𝑋→𝑋.𝑠𝑥. They are again related vacuously at [[𝖵𝗈𝗂𝖽𝐹 →𝖭𝖺𝗍𝐹]]𝜖. Both displayed functions are beta-normal: the first returns the zero Church numeral, while the second returns the one Church numeral written out in normal form. Their bodies are distinct beta-normal terms, so Church–Rosser separates their beta classes.
Exercise 6.6.
Let 𝐺 =𝖦𝗋(𝑘) with 𝐺 :𝐴 ↔𝐵. Self-parametricity of 𝑏, instantiated at 𝐺, gives [𝑏[𝐴]](𝐺⇒𝐺⇒𝐺)[𝑏[𝐵]]. By definition of a graph, [𝑎0]𝐺[𝑘𝑎0],[𝑎1]𝐺[𝑘𝑎1]. The first use of arrow lifting applies the related Boolean eliminators to the first related branch pair and gives [𝑏[𝐴]𝑎0](𝐺⇒𝐺)[𝑏[𝐵](𝑘𝑎0)]. The second use applies these related functions to the second branch pair: [𝑏[𝐴]𝑎0𝑎1]𝐺[𝑏[𝐵](𝑘𝑎0)(𝑘𝑎1)]. Unfolding 𝐺 in the last line is exactly 𝑘(𝑏[𝐴]𝑎0𝑎1)=𝛽𝑏[𝐵](𝑘𝑎0)(𝑘𝑎1). No classification of 𝑏 as true or false was used.
Exercise 6.7.
Put 𝐺 =𝖦𝗋(𝑓) with 𝐺 :𝐴 ↔𝐵, and put 𝗂𝖽𝐴 =𝜆𝑥 :𝐴.𝑥. Self-parametricity of 𝑟, instantiated at 𝐺, gives [𝑟[𝐴]](([[𝐴]]𝜖⇒𝐺)⇒𝐺)[𝑟[𝐵]].(1) We claim [𝗂𝖽𝐴]([[𝐴]]𝜖⇒𝐺)[𝑓].(2) Indeed, suppose [𝑎][[𝐴]]𝜖[𝑎′]. Identity extension at 𝐴 is used at this exact point to conclude 𝑎 =𝛽𝑎′. Compatible beta conversion then gives 𝑓(𝗂𝖽𝐴𝑎)=𝛽𝑓𝑎=𝛽𝑓𝑎′, which says [𝗂𝖽𝐴𝑎]𝐺[𝑓𝑎′]. This proves (2).
Applying the arrow relation in (1) to (2) yields [𝑟[𝐴]𝗂𝖽𝐴]𝐺[𝑟[𝐵]𝑓]. The graph definition now reads 𝑓(𝑟[𝐴](𝜆𝑥:𝐴.𝑥))=𝛽𝑟[𝐵]𝑓, and symmetry gives the equation in the question. For 𝐴 =𝖭𝖺𝗍𝐹, the required identity extension is proposition 6.14.
Without identity extension, an input pair in [[𝐴]]𝜖 need not consist of beta-equal terms, so the implication needed for (2) need not hold. Replacing that missing step by an assertion of beta equality would repeat exactly the false unrestricted identity-extension claim refuted by proposition 6.15.
exercise 6.8.
Put 𝐵′:=𝖭𝖺𝗍𝐹×𝐹𝖭𝖺𝗍𝐹 and define 𝑖′:=⟨𝗓𝖾𝗋𝗈𝐹,𝗓𝖾𝗋𝗈𝐹⟩𝐹,𝑠′:=𝜆𝑝:𝐵′.⟨𝗌𝗎𝖼𝖼𝐹(𝖿𝗌𝗍𝐹(𝑝)),𝗌𝗎𝖼𝖼𝐹(𝗌𝗇𝖽𝐹(𝑝))⟩𝐹,𝑟′:=𝜆𝑝:𝐵′.𝖿𝗌𝗍𝐹(𝑝). Let [𝑛]𝑅′[𝑝] mean 𝑝 =𝛽⟨𝑛,𝑛⟩𝐹. The initial states are related directly. If [𝑛]𝑅′[𝑝], the two projection beta laws give 𝑠′𝑝=𝛽⟨𝗌𝗎𝖼𝖼𝐹𝑛,𝗌𝗎𝖼𝖼𝐹𝑛⟩𝐹, so [𝗌𝗎𝖼𝖼𝐹𝑛]𝑅′[𝑠′𝑝]. The first projection also gives 𝑛 =𝛽𝑟′𝑝, hence [𝗌𝗎𝖼𝖼𝐹](𝑅′⇒𝑅′)[𝑠′],[𝜆𝑛:𝖭𝖺𝗍𝐹.𝑛](𝑅′⇒𝖤𝗊𝖭𝖺𝗍𝐹)[𝑟′].
For 𝑐2, the first implementation reduces to ――2. In the paired implementation, two steps reduce the state to ⟨――2,――2⟩𝐹, and the observer projects the first component. Thus its result also reduces to ――2, as predicted by theorem 6.18.
Exercise 6.9.
For the empty relation 𝑅 =∅ with 𝑅 :𝐴 ↔𝐴, the implication defining 𝑅 ⇒𝑅 has no input pair to test. Hence [𝗂𝖽𝐴](𝑅⇒𝑅)[𝗂𝖽𝐴]. The abstraction-theorem case for a proposed 𝖿𝗂𝗑𝐴 :(𝐴 →𝐴) →𝐴 would have to conclude [𝖿𝗂𝗑𝐴𝗂𝖽𝐴]𝑅[𝖿𝗂𝗑𝐴𝗂𝖽𝐴], which is impossible because 𝑅 has no pairs.
Requiring relations to be nonempty removes this particular choice but not the problem. Fix a closed 𝑎 :𝐴 and take 𝑅={([𝑎],[𝑎])}. If the sole input pair [𝑎]𝑅[𝑎] is supplied to the two identity functions, their outputs are again [𝑎]𝑅[𝑎]. Therefore [𝗂𝖽𝐴](𝑅⇒𝑅)[𝗂𝖽𝐴]. Parametricity of 𝖿𝗂𝗑𝐴 would force the pair of fixed-point results to lie in the singleton 𝑅, hence 𝖿𝗂𝗑𝐴𝗂𝖽𝐴=𝛽𝑎. But the least fixed point of the identity in a partial language is the designated divergent, or least, computation, not an arbitrary closed 𝑎. Thus nonemptiness alone admits relations that omit the least computations. One must at least require strictness, relating the two least computations; admissibility can then address closure under limits of finite approximations.
Practical route.
The finite relation calculator of exercise 10.10 is built in appendix F; its concrete witnesses and failed fixed-point mutation are recorded in appendix E.