Exercise 5.1.
We prove the equation simultaneously with the corresponding equation for types, since the annotation of a term abstraction invokes the type case. The type grammar has three constructor cases. In the variable case, a variable distinct from 𝑋 and 𝑌 is unchanged; at 𝑋, both sides are 𝐵[𝐶/𝑌]; and at 𝑌, both sides are 𝐶, using 𝑋 ∉ftv(𝐶). Arrow types follow componentwise. For a universal type ∀𝑍.𝐴, alpha-rename 𝑍 fresh for 𝐵,𝐶,𝑋,𝑌; the type induction hypothesis gives (∀𝑍.𝐴)[𝐵/𝑋][𝐶/𝑌]𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛=∀𝑍.(𝐴[𝐵/𝑋][𝐶/𝑌])𝑖𝑛𝑑𝑢𝑐𝑡𝑖𝑜𝑛ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠=∀𝑍.(𝐴[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋])𝑑𝑒𝑓𝑖𝑛𝑖𝑡𝑖𝑜𝑛=(∀𝑍.𝐴)[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋].
The term-variable case is immediate. The term-abstraction and application cases are the componentwise calculations (𝜆𝑥:𝐴.𝑠)[𝐵/𝑋][𝐶/𝑌]=𝜆𝑥:𝐴[𝐵/𝑋][𝐶/𝑌].𝑠[𝐵/𝑋][𝐶/𝑌]=𝜆𝑥:𝐴[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋].𝑠[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋],(𝑠1𝑠2)[𝐵/𝑋][𝐶/𝑌]=𝑠1[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]𝑠2[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]. The first line uses the type and term induction hypotheses; the second uses the two term induction hypotheses. Term binders have first been chosen fresh for the terms under discussion.
For a type abstraction whose displayed binder is already suitable, say 𝑡 =Λ𝑍.𝑠 with 𝑍 ≠𝑋,𝑌 and 𝑍 ∉ftv(𝐵,𝐶), the calculation is (Λ𝑍.𝑠)[𝐵/𝑋][𝐶/𝑌]=Λ𝑍.𝑠[𝐵/𝑋][𝐶/𝑌]=Λ𝑍.𝑠[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]=(Λ𝑍.𝑠)[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]. If the displayed 𝑍 occurs in 𝐵 or 𝐶, choose one variable 𝑊 fresh for 𝑠,𝐵,𝐶,𝑋,𝑌 and first use alpha-equivalence Λ𝑍.𝑠=𝛼Λ𝑊.𝑠[𝑊/𝑍]. Both sides are then calculated with this same display: (Λ𝑊.𝑠[𝑊/𝑍])[𝐵/𝑋][𝐶/𝑌]=Λ𝑊.𝑠[𝑊/𝑍][𝐵/𝑋][𝐶/𝑌]=Λ𝑊.𝑠[𝑊/𝑍][𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]=(Λ𝑊.𝑠[𝑊/𝑍])[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]. This is the freshening step that would be lost by silently changing the binder on only one side.
Finally, type application changes both of its components: (𝑠[𝐷])[𝐵/𝑋][𝐶/𝑌]=𝑠[𝐵/𝑋][𝐶/𝑌][𝐷[𝐵/𝑋][𝐶/𝑌]]=𝑠[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋][𝐷[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]]=(𝑠[𝐷])[𝐶/𝑌][𝐵[𝐶/𝑌]/𝑋]. The type-abstraction calculation and this last calculation exhaust the two System F term forms not already present in the simply typed calculus, so the induction proves the equation for every 𝑡.
Exercise 5.2.
Write 𝐼 =∀𝑋.𝑋 →𝑋. The closed formation tree needed by the type application is 𝑋∈𝑋𝑋⊢𝑋 𝗍𝗒𝗉𝖾F−Ty−Var𝑋∈𝑋𝑋⊢𝑋 𝗍𝗒𝗉𝖾F−Ty−Var𝑋⊢𝑋→𝑋 𝗍𝗒𝗉𝖾F−Ty−Arr⋅⊢𝐼 𝗍𝗒𝗉𝖾F−Ty−All. With the subscripts serving only to mark the two occurrences of the same variable, the complete term tree is 𝑓:𝐼∈𝑓:𝐼⋅;𝑓:𝐼⊢𝑓op:𝐼F−Var𝑋∈𝑋𝑋⊢𝑋 𝗍𝗒𝗉𝖾F−Ty−Var𝑋∈𝑋𝑋⊢𝑋 𝗍𝗒𝗉𝖾F−Ty−Var𝑋⊢𝑋→𝑋 𝗍𝗒𝗉𝖾F−Ty−Arr⋅⊢𝐼 𝗍𝗒𝗉𝖾F−Ty−All⋅;𝑓:𝐼⊢𝑓op[𝐼]:𝐼→𝐼F−All−E𝑓:𝐼∈𝑓:𝐼⋅;𝑓:𝐼⊢𝑓arg:𝐼F−Var⋅;𝑓:𝐼⊢𝑓op[𝐼]𝑓arg:𝐼F−Arr−E⋅;⋅⊢𝜆𝑓:𝐼.𝑓[𝐼]𝑓:𝐼→𝐼F−Arr−I𝑥:𝑋∈𝑥:𝑋𝑋;𝑥:𝑋⊢𝑥:𝑋F−Var𝑋;⋅⊢𝜆𝑥:𝑋.𝑥:𝑋→𝑋F−Arr−I⋅;⋅⊢Λ𝑋.𝜆𝑥:𝑋.𝑥:𝐼F−All−I⋅;⋅⊢𝑑𝗂𝖽:𝐼F−Arr−E. Thus the operator occurrence of 𝑓 first synthesizes 𝐼 and, after F-All-E, synthesizes 𝐼 →𝐼; the argument occurrence synthesizes 𝐼 without instantiation.
exercise 5.3.
Put 𝐼 =∀𝑌.𝑌 →𝑌. Its closed formation derivation is 𝑌∈𝑌𝑌⊢𝑌 𝗍𝗒𝗉𝖾F−Ty−Var𝑌∈𝑌𝑌⊢𝑌 𝗍𝗒𝗉𝖾F−Ty−Var𝑌⊢𝑌→𝑌 𝗍𝗒𝗉𝖾F−Ty−Arr⋅⊢𝐼 𝗍𝗒𝗉𝖾F−Ty−All. Substitution [𝐼/𝑋] sends the context 𝑓 :𝑋 →𝑋,𝑥 :𝑋 to 𝑓 :𝐼 →𝐼,𝑥 :𝐼. The transformed term derivation is 𝑓:𝐼→𝐼∈𝑓:𝐼→𝐼,𝑥:𝐼⋅;𝑓:𝐼→𝐼,𝑥:𝐼⊢𝑓:𝐼→𝐼F−Var𝑥:𝐼∈𝑓:𝐼→𝐼,𝑥:𝐼⋅;𝑓:𝐼→𝐼,𝑥:𝐼⊢𝑥:𝐼F−Var⋅;𝑓:𝐼→𝐼,𝑥:𝐼⊢𝑓𝑥:𝐼F−Arr−E. Term substitution cannot produce this tree: it replaces a term variable by a term and leaves every annotation and declaration type unchanged. Here the operation replaces the type variable in both declarations and in the result classifier.
Exercise 5.4.
Inverting the final application gives a type 𝐴 and premises Δ;Γ⊢(Λ𝑋.𝑡)[𝐶]:𝐴→𝐷,Δ;Γ⊢𝑢:𝐴. Inverting the type application supplies a body type 𝐵 such that Δ;Γ⊢Λ𝑋.𝑡:∀𝑋.𝐵,Δ⊢𝐶 𝗍𝗒𝗉𝖾,𝐵[𝐶/𝑋]=𝐴→𝐷. Inverting the type abstraction finally gives Δ,𝑋;Γ⊢𝑡:𝐵. Context formation for the abstraction ensures that 𝑋 is absent from the types in Γ. Type substitution therefore yields Δ;Γ⊢𝑡[𝐶/𝑋]:𝐵[𝐶/𝑋]=𝐴→𝐷. The reduct of the left subterm is exactly 𝑡[𝐶/𝑋]. Reusing the unchanged argument premise rebuilds the final rule: Δ;Γ⊢𝑡[𝐶/𝑋]:𝐴→𝐷Δ;Γ⊢𝑢:𝐴Δ;Γ⊢𝑡[𝐶/𝑋]𝑢:𝐷F−Arr−E. This is preservation for the congruence step induced by the type-beta contraction.
exercise 5.5.
Use the boolean itself as its eliminator: 𝗇𝗈𝗍𝐹:=𝜆𝑏:𝖡𝗈𝗈𝗅𝐹.Λ𝑋.𝜆𝑡:𝑋.𝜆𝑓:𝑋.𝑏[𝑋]𝑓𝑡,𝖺𝗇𝖽𝐹:=𝜆𝑏1:𝖡𝗈𝗈𝗅𝐹.𝜆𝑏2:𝖡𝗈𝗈𝗅𝐹.𝑏1[𝖡𝗈𝗈𝗅𝐹]𝑏2𝖿𝖺𝗅𝗌𝖾𝐹. Inside the first term, 𝑏[𝑋] :𝑋 →𝑋 →𝑋, so the reversed arguments give an 𝑋; the three introductions produce the required boolean. Inside the second, instantiation at 𝖡𝗈𝗈𝗅𝐹 makes the two branch arguments have the required common type.
The reductions are 𝗇𝗈𝗍𝐹𝗍𝗋𝗎𝖾𝐹⟶𝛽Λ𝑋.𝜆𝑡:𝑋.𝜆𝑓:𝑋.𝗍𝗋𝗎𝖾𝐹[𝑋]𝑓𝑡⟶𝛽Λ𝑋.𝜆𝑡:𝑋.𝜆𝑓:𝑋.(𝜆𝑡′:𝑋.𝜆𝑓′:𝑋.𝑡′)𝑓𝑡⟶𝛽Λ𝑋.𝜆𝑡:𝑋.𝜆𝑓:𝑋.(𝜆𝑓′:𝑋.𝑓)𝑡⟶𝛽𝖿𝖺𝗅𝗌𝖾𝐹,𝖺𝗇𝖽𝐹𝖿𝖺𝗅𝗌𝖾𝐹𝗍𝗋𝗎𝖾𝐹⟶𝛽(𝜆𝑏2:𝖡𝗈𝗈𝗅𝐹.𝖿𝖺𝗅𝗌𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝑏2𝖿𝖺𝗅𝗌𝖾𝐹)𝗍𝗋𝗎𝖾𝐹⟶𝛽𝖿𝖺𝗅𝗌𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑡:𝖡𝗈𝗈𝗅𝐹.𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝑓)𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝑓)𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽𝖿𝖺𝗅𝗌𝖾𝐹,𝖺𝗇𝖽𝐹𝖿𝖺𝗅𝗌𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑏2:𝖡𝗈𝗈𝗅𝐹.𝖿𝖺𝗅𝗌𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝑏2𝖿𝖺𝗅𝗌𝖾𝐹)𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽𝖿𝖺𝗅𝗌𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝖿𝖺𝗅𝗌𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑡:𝖡𝗈𝗈𝗅𝐹.𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝑓)𝖿𝖺𝗅𝗌𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝑓)𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽𝖿𝖺𝗅𝗌𝖾𝐹. The second step of the first trace and the third step of each conjunction trace are type beta; all remaining contractions are term beta.
Exercise 5.6.
Define 𝗆𝖺𝗉+:=𝜆𝑠:𝐴+𝐹𝐵.Λ𝑋.𝜆ℎ:𝐴′→𝑋.𝜆𝑘:𝐵′→𝑋.𝑠[𝑋](𝜆𝑎:𝐴.ℎ(𝑓𝑎))(𝜆𝑏:𝐵.𝑘(𝑔𝑏)). Under 𝑠 :𝐴 +𝐹𝐵 we have 𝑠[𝑋] :(𝐴 →𝑋) →(𝐵 →𝑋) →𝑋. The two displayed lambdas have types 𝐴 →𝑋 and 𝐵 →𝑋, since 𝑓 :𝐴 →𝐴′ and 𝑔 :𝐵 →𝐵′. The body consequently has type 𝑋; the three introductions give 𝗆𝖺𝗉+:𝐴+𝐹𝐵→𝐴′+𝐹𝐵′. For the two constructors, compatible beta reduction gives 𝗆𝖺𝗉+(𝗂𝗇𝗅𝐹(𝑎))⟶∗𝛽Λ𝑋.𝜆ℎ:𝐴′→𝑋.𝜆𝑘:𝐵′→𝑋.ℎ(𝑓𝑎)=𝗂𝗇𝗅𝐹(𝑓𝑎),𝗆𝖺𝗉+(𝗂𝗇𝗋𝐹(𝑏))⟶∗𝛽Λ𝑋.𝜆ℎ:𝐴′→𝑋.𝜆𝑘:𝐵′→𝑋.𝑘(𝑔𝑏)=𝗂𝗇𝗋𝐹(𝑔𝑏). If 𝑠, 𝑓, and 𝑔 are variables, applying the mapper has instead the variable-headed beta-normal form Λ𝑋.𝜆ℎ:𝐴′→𝑋.𝜆𝑘:𝐵′→𝑋.𝑠[𝑋](𝜆𝑎:𝐴.ℎ(𝑓𝑎))(𝜆𝑏:𝐵.𝑘(𝑔𝑏)). There is no root redex at 𝑠[𝑋], so no constructor case can be selected.
Exercise 5.7.
Iterate addition of the second argument once for every successor in the first: 𝗆𝗎𝗅𝗍𝐹:=𝜆𝑚:𝖭𝖺𝗍𝐹.𝜆𝑛:𝖭𝖺𝗍𝐹.𝑚[𝖭𝖺𝗍𝐹]𝗓𝖾𝗋𝗈𝐹(𝖺𝖽𝖽𝐹𝑛). The iterator typing gives the required result type. Its calculation at two and three is 𝗆𝗎𝗅𝗍𝐹――2――3⟶∗𝛽(𝖺𝖽𝖽𝐹――3)((𝖺𝖽𝖽𝐹――3)𝗓𝖾𝗋𝗈𝐹)⟶∗𝛽𝖺𝖽𝖽𝐹――3――3⟶∗𝛽――6.
Put 𝑃 =𝖭𝖺𝗍𝐹 ×𝐹𝖭𝖺𝗍𝐹 and define 𝑝0:=⟨𝗓𝖾𝗋𝗈𝐹,𝗓𝖾𝗋𝗈𝐹⟩𝐹,𝗌𝗍𝖾𝗉:=𝜆𝑝:𝑃.⟨𝗌𝗇𝖽𝐹(𝑝),𝗌𝗎𝖼𝖼𝐹(𝗌𝗇𝖽𝐹(𝑝))⟩𝐹,𝗉𝗋𝖾𝖽𝐹:=𝜆𝑛:𝖭𝖺𝗍𝐹.𝖿𝗌𝗍𝐹(𝑛[𝑃]𝑝0𝗌𝗍𝖾𝗉). Both projections in 𝗌𝗍𝖾𝗉 have type 𝖭𝖺𝗍𝐹, so 𝗌𝗍𝖾𝗉 :𝑃 →𝑃 and the iterator produces a 𝑃. At zero, 𝗉𝗋𝖾𝖽𝐹𝗓𝖾𝗋𝗈𝐹⟶∗𝛽𝖿𝗌𝗍𝐹(𝑝0)⟶∗𝛽𝗓𝖾𝗋𝗈𝐹. Writing 𝑝𝑗 =⟨――――𝑗−1,――𝑗⟩𝐹 for 𝑗 ≥1, the projection laws give 𝑝0𝗌𝗍𝖾𝗉←←←←←←←←→⟨――0,――1⟩𝐹𝗌𝗍𝖾𝗉←←←←←←←←→⟨――1,――2⟩𝐹𝗌𝗍𝖾𝗉←←←←←←←←→⟨――2,――3⟩𝐹. Consequently 𝗉𝗋𝖾𝖽𝐹――3⟶∗𝛽𝖿𝗌𝗍𝐹⟨――2,――3⟩𝐹⟶∗𝛽――2. All arrows in the displayed state trace abbreviate the beta contractions of the Church projections followed by the successor contraction.
Exercise 5.8.
Two closed decorations of the Curry identity are 𝜆𝑥:𝐼.𝑥:𝐼→𝐼,Λ𝑋.𝜆𝑥:𝑋.𝑥:𝐼. Both erase to 𝜆𝑥.𝑥, but their types differ. Their Curry derivations are respectively 𝑥:𝐼∈𝑥:𝐼⋅;𝑥:𝐼⊢𝐶𝑥:𝐼C−Var⋅;⋅⊢𝐶𝜆𝑥.𝑥:𝐼→𝐼C−Arr−I and 𝑥:𝑋∈𝑥:𝑋𝑋;𝑥:𝑋⊢𝐶𝑥:𝑋C−Var𝑋;⋅⊢𝐶𝜆𝑥.𝑥:𝑋→𝑋C−Arr−I⋅;⋅⊢𝐶𝜆𝑥.𝑥:𝐼C−All−I.
For a Curry term containing an application, take 𝑚 =𝜆𝑓.(𝜆𝑥.𝑥)𝑓. It has the following two Church decorations at the same type: 𝑡1=𝜆𝑓:𝐼.(𝜆𝑥:𝐼.𝑥)𝑓:𝐼→𝐼,𝑡2=𝜆𝑓:𝐼.(Λ𝑋.𝜆𝑥:𝑋.𝑥)[𝐼]𝑓:𝐼→𝐼. The first Curry tree uses the direct 𝐼 →𝐼 typing of the inner identity: 𝑥:𝐼∈𝑓:𝐼,𝑥:𝐼⋅;𝑓:𝐼,𝑥:𝐼⊢𝐶𝑥:𝐼C−Var⋅;𝑓:𝐼⊢𝐶𝜆𝑥.𝑥:𝐼→𝐼C−Arr−I𝑓:𝐼∈𝑓:𝐼⋅;𝑓:𝐼⊢𝐶𝑓:𝐼C−Var⋅;𝑓:𝐼⊢𝐶(𝜆𝑥.𝑥)𝑓:𝐼C−Arr−E⋅;⋅⊢𝐶𝑚:𝐼→𝐼C−Arr−I. In the second tree, replace the left premise of that C-Arr-E by 𝑥:𝑋∈𝑓:𝐼,𝑥:𝑋𝑋;𝑓:𝐼,𝑥:𝑋⊢𝐶𝑥:𝑋C−Var𝑋;𝑓:𝐼⊢𝐶𝜆𝑥.𝑥:𝑋→𝑋C−Arr−I⋅;𝑓:𝐼⊢𝐶𝜆𝑥.𝑥:𝐼C−All−I⋅⊢𝐼 𝗍𝗒𝗉𝖾⋅;𝑓:𝐼⊢𝐶𝜆𝑥.𝑥:𝐼→𝐼C−All−E. Decoration of the first tree inserts no universal constructors at the inner identity; decoration of the replacement inserts Λ𝑋 and then the type application [𝐼]. Erasure makes the two resulting Church terms equal to the same 𝑚.
exercise 5.9.
Erasure gives (𝜆𝑓.𝑓𝑓)(𝜆𝑥.𝑥). Algorithm W assigns the lambda-bound 𝑓 one fresh monotype 𝛼. Typing the body application treats the left occurrence as a function with fresh result 𝛽 and the right occurrence as its argument, producing 𝛼≐𝛼→𝛽. The occurs check rejects this equation.
The Curry derivation instead assigns 𝑓 :𝐼. Universal elimination is inserted at the function occurrence, decorating it as 𝑓[𝐼] :𝐼 →𝐼; the argument occurrence remains 𝑓 :𝐼. The body therefore decorates to 𝑓[𝐼]𝑓 :𝐼, and the whole term becomes the Church term of equation 5.1. No first-order unifier can repair the HM equation, because a finite monotype cannot equal a proper arrow tree containing itself. The successful derivation changes the typing discipline: it instantiates the polymorphic type of a lambda-bound variable.
Exercise 5.10.
Let Δ ⊢𝐴 𝗍𝗒𝗉𝖾. Define 𝖺𝖻𝗈𝗋𝗍𝐴:=𝜆𝑧:𝖵𝗈𝗂𝖽𝐹.𝑧[𝐴]. Under 𝑧 :𝖵𝗈𝗂𝖽𝐹 =∀𝑋.𝑋, universal elimination gives the open judgment Δ;𝑧:𝖵𝗈𝗂𝖽𝐹⊢𝑧[𝐴]:𝐴. Arrow introduction therefore derives Δ;⋅⊢𝖺𝖻𝗈𝗋𝗍𝐴:𝖵𝗈𝗂𝖽𝐹→𝐴.
The construction is an eliminator, not an inhabitant of its domain. The consistency corollary says that no closed term can be supplied as its 𝖵𝗈𝗂𝖽𝐹 argument. Applying the eliminator would require exactly the closed inhabitant excluded by that corollary.
exercise 5.11.
For item 1, let 𝑛 be a neutral beta-normal form with no free type variables. It has no one-step reducts. The premise of (CR3) is therefore vacuous, so 𝑛 belongs to every candidate.
For item 2, define 𝑅⇒′𝑆={𝑡∣𝑡 has no free type variables and ∀𝑢∈𝑅, 𝑡𝑢∈𝑆}. Choose distinct variables 𝑥,𝑧 fresh for 𝑡. Item 1 gives 𝑧 ∈𝑅, so 𝑡𝑧 ∈𝑆 ⊆𝖲𝖭. Put 𝑠:=𝑡𝑥. Then 𝑠[𝑧/𝑥] =𝑡𝑧, and reflection through the fresh substitution gives 𝑡𝑥 ∈𝖲𝖭. An infinite reduction from 𝑡 would lift through the left application context to an infinite reduction from 𝑡𝑥; hence 𝑡 ∈𝖲𝖭0. This proves (CR1) for every member of 𝑅 ⇒′𝑆.
For (CR2), suppose 𝑡 ∈𝑅 ⇒′𝑆 and 𝑡 ⟶𝛽𝑡′. For every 𝑢 ∈𝑅, compatibility gives 𝑡𝑢 ⟶𝛽𝑡′𝑢, and (CR2) for 𝑆 gives 𝑡′𝑢 ∈𝑆. Type-closedness is preserved by reduction, so 𝑡′ ∈𝑅 ⇒′𝑆.
For (CR3), let 𝑡 be neutral and type-closed, and suppose every 𝑡 ⟶𝛽𝑡′ lies in 𝑅 ⇒′𝑆. Fix 𝑢 ∈𝑅. The application 𝑡𝑢 is neutral. Induct on 𝑛 =𝜈(𝑢), with induction hypothesis 𝑡𝑣 ∈𝑆 for every 𝑣 ∈𝑅 satisfying 𝜈(𝑣) <𝑛. This measure is finite by (CR1) for 𝑅. An immediate reduct 𝑡′𝑢 lies in 𝑆 by the premise on 𝑡′. An immediate reduct 𝑡𝑢′ has 𝑢′ ∈𝑅 by (CR2), and 𝜈(𝑢′) <𝑛; the induction hypothesis therefore puts 𝑡𝑢′ in 𝑆. There is no root contraction because 𝑡 is neutral. Thus (CR3) for 𝑆 gives 𝑡𝑢 ∈𝑆, and consequently 𝑡 ∈𝑅 ⇒′𝑆. The three clauses prove that 𝑅 ⇒′𝑆 is exactly the arrow candidate used in the chapter.
For item 3, take 𝑡 =𝑞[𝐷]. The term 𝑡[𝐶] =(𝑞[𝐷])[𝐶] is a type application whose operator is itself a type application, not a type abstraction, so it has no outer root contraction. Its immediate reducts are: (𝑞′[𝐷])[𝐶]when 𝑞⟶𝛽𝑞′,𝑠[𝐷/𝑌][𝐶]when 𝑞=Λ𝑌.𝑠. Types do not reduce, so neither 𝐷 nor 𝐶 contributes another case. Both displayed forms are 𝑡′[𝐶] for an immediate reduct 𝑡′ of 𝑡. The universal-candidate premise puts every such 𝑡′ in the universal candidate; its defining clause then puts 𝑡′[𝐶] in 𝐹(𝐶,𝑅). Applying (CR3) in 𝐹(𝐶,𝑅) proves 𝑡[𝐶] ∈𝐹(𝐶,𝑅).
Exercise 5.13.
For 𝑝 :𝐴 ×𝐹𝐵, expansion of every abbreviation turns the reconstructed pair into Λ𝑋.𝜆𝑘:𝐴→𝐵→𝑋.𝑘(𝑝[𝐴](𝜆𝑎:𝐴.𝜆𝑏:𝐵.𝑎))(𝑝[𝐵](𝜆𝑎:𝐴.𝜆𝑏:𝐵.𝑏)). The comparison term is the neutral variable 𝑝. It is beta-normal. The expanded term is also beta-normal: both occurrences of 𝑝 are neutral, the two projection continuations contain no redex, and the final applications are headed by the variable 𝑘. Its outer constructor is Λ, whereas the outer shape of 𝑝 is neutral, so the two normal forms are not alpha-equal and hence are not beta-convertible.
Likewise, with 𝖡𝗈𝗈𝗅𝐹=∀𝑋.𝑋→𝑋→𝑋, the two boolean candidates are 𝑏andΛ𝑋.𝜆𝑡:𝑋.𝜆𝑓:𝑋.𝑏[𝑋]𝑡𝑓. For neutral 𝑏, the operator 𝑏[𝑋] is not a type abstraction, and its two term applications are not lambda-headed. Both candidates are therefore beta-normal, but again one is neutral and the other begins with Λ.
The first absent equation is the primitive product uniqueness rule ⟨𝖿𝗌𝗍(𝑝),𝗌𝗇𝖽(𝑝)⟩ =𝑝. The second is the corresponding Boolean uniqueness, or eta, rule saying that a Boolean is uniquely reconstructed by eliminating it into its two branches. The Church encodings validate their constructor–eliminator beta laws, not these primitive eta laws under beta conversion alone.
Exercise 5.12.
Normalize a closed inhabitant and invert its typing. Its initial form is forced to be Λ𝑋.𝜆𝑓:𝑋→𝑋.𝑟,𝑓:𝑋→𝑋⊢𝑟:𝑋→𝑋. If 𝑟 is neutral, its head must be the only term variable in the context, namely 𝑓. Since 𝑓 already has the required arrow type, no application may follow it. This gives the eta-short normal form Λ𝑋.𝜆𝑓:𝑋→𝑋.𝑓. Otherwise inversion makes 𝑟 =𝜆𝑥 :𝑋.𝑢, where 𝑓 :𝑋 →𝑋,𝑥 :𝑋 ⊢𝑢 :𝑋. A normal term at the atomic type 𝑋 is neutral. Its head is 𝑥, giving 𝑢 =𝑥, or it is headed by 𝑓 and has the form 𝑓𝑢′. Repeating the same argument on the strictly smaller 𝑢′ gives a unique 𝑛 ≥0 with 𝑢 =𝑓𝑛𝑥. Thus all remaining forms are exactly Λ𝑋.𝜆𝑓:𝑋→𝑋.𝜆𝑥:𝑋.𝑓𝑛𝑥. The normal/neutral shape lemma proves that no third case exists, and Church–Rosser makes the member of the list unique under beta conversion. Function eta would add 𝜆𝑥:𝑋.𝑓𝑥=𝜂𝑓(𝑥∉fv(𝑓)), which identifies the long member with 𝑛 =1 and the eta-short member. Beta conversion alone does not identify them.
Exercise 9.14.
Fix a closed type 𝐶 and a candidate 𝑅, and put 𝜂′:=𝜂[𝑋↦(𝐶,𝑅)]. For every declaration 𝑥 :𝐵 in Γ, the side condition 𝑋 ∉ftv(Γ) gives 𝑋 ∉ftv(𝐵). Interpretation irrelevance therefore gives [[𝐵]]𝜂′=[[𝐵]]𝜂. Each image 𝜎(𝑥) belongs to the right side, so the same substitution 𝜎 is 𝜂′-reducible for Γ.
Apply the induction hypothesis to the premise under 𝜂′. It gives 𝑡[̂𝜂′][𝜎]∈[[𝐴]]𝜂′. The valuation ̂𝜂′ first performs ̂𝜂 and then [𝐶/𝑋]. Every image of 𝜎 has no free type variables, so the term–type substitution equation yields 𝑡[̂𝜂′][𝜎]=𝛼𝑡[̂𝜂][𝜎][𝐶/𝑋]=𝑠[𝐶/𝑋]. Since 𝐶 and 𝑅 were arbitrary, this proves 𝑠[𝐶/𝑋] ∈[[𝐴]]𝜂′ for every pair required by the universal candidate.
The type-abstraction expansion lemma also requires normalization of 𝑠. Choose 𝐶=𝐼:=∀𝑌.𝑌→𝑌,𝑅=𝖲𝖭0. The membership just proved and (CR1) give 𝑠[𝐼/𝑋] ∈𝖲𝖭. Reflection through the closed type substitution gives 𝑠 ∈𝖲𝖭. Type-abstraction expansion now yields Λ𝑋.𝑠∈[[∀𝑋.𝐴]]𝜂, which is exactly the transformed conclusion of F-All-I.
Exercise 5.14.
The replacement abandons item 3 of definition 9.47: an arrow is no longer interpreted as the full set 𝑉𝑈. The selected family F(𝑈,𝑉) still supplies the functions needed to interpret abstraction and application, and at least one of these sets is a proper subset of 𝑉𝑈. The cardinality step |𝑇(𝑋)| =|𝐵𝐵𝑋| in theorem 5.40 is no longer available.
This semantic restriction changes none of the chapter’s syntactic results. Preservation remains true because its proof uses typing inversion and the two substitution lemmas, not a set interpretation. Strong normalization remains true because its proof uses reducibility candidates over syntax. Syntactic consistency remains true because it follows from normalization, subject reduction, and the normal-form shape lemma. Hence the exact answers are: preservation holds, normalization holds, and there is still no closed term of ∀𝑋.𝑋. Reynolds’ theorem rules out one simultaneous package of set-theoretic clauses; it does not refute any of these local theorems.
Practical route.
The explicit System F checker of exercise 9.15 is built in appendix F; its context-formation guard, evidence replay, compatible reduction checks, and preserved mutation are recorded in appendix E.