Exercise 11.1.
With empty local evidence, the only instance path is 𝗉𝗂𝖼𝗄C0(𝖤𝗊𝖨𝗇𝗍)=(∅,𝜋1𝗈𝗋𝖽𝖨𝗇𝗍)𝗋𝖾𝗌𝗈𝗅𝗏𝖾C0,∅(𝖤𝗊𝖨𝗇𝗍)=𝜋1𝗈𝗋𝖽𝖨𝗇𝗍E−Instance𝗋𝖾𝗌𝗈𝗅𝗏𝖾C0,∅(𝖤𝗊(𝖫𝗂𝗌𝗍𝖨𝗇𝗍))=𝖾𝗊𝖫𝗂𝗌𝗍(𝜋1𝗈𝗋𝖽𝖨𝗇𝗍)E−Instance𝗋𝖾𝗌𝗈𝗅𝗏𝖾C0,∅(𝖤𝗊(𝖫𝗂𝗌𝗍(𝖫𝗂𝗌𝗍𝖨𝗇𝗍)))=𝖾𝗊𝖫𝗂𝗌𝗍(𝖾𝗊𝖫𝗂𝗌𝗍(𝜋1𝗈𝗋𝖽𝖨𝗇𝗍))E−Instance. If a second effective declaration has a head unifiable with 𝖤𝗊(𝖫𝗂𝗌𝗍 𝛼), both freshened heads can match a common instance of the outer request. The effective-head admission check therefore rejects the table rather than choosing between distinct builders. The same check rejects a primitive 𝖤𝗊 𝖨𝗇𝗍 clause in the presence of 𝖮𝗋𝖽 𝖨𝗇𝗍: superclass closure already derives an effective 𝖤𝗊 𝖨𝗇𝗍 clause whose builder is 𝜋1𝗈𝗋𝖽𝖨𝗇𝗍. Keeping both would destroy the unique selected evidence needed by functionality and coherence.
Exercise 13.7.
Without superclass closure, 𝗇𝖿{𝖮𝗋𝖽(𝖫𝗂𝗌𝗍𝛼),𝖤𝗊𝛽}={𝖮𝗋𝖽𝛼,𝖤𝗊𝛽}. Under 𝜃=[𝖨𝗇𝗍/𝛼,𝖫𝗂𝗌𝗍𝖨𝗇𝗍/𝛽], the raw set succeeds: construct 𝖮𝗋𝖽𝖫𝗂𝗌𝗍(𝖮𝗋𝖽𝖨𝗇𝗍), install it, and obtain the required list equality dictionary as 𝖤𝗊𝖥𝗋𝗈𝗆𝖮𝗋𝖽(𝖮𝗋𝖽𝖫𝗂𝗌𝗍(𝖮𝗋𝖽𝖨𝗇𝗍)). The canonical set fails because after constructing 𝖮𝗋𝖽𝖨𝗇𝗍 it has no instance for 𝖤𝗊(𝖫𝗂𝗌𝗍 𝖨𝗇𝗍). With I↑, the derived clause 𝖮𝗋𝖽 𝑎 ⇒𝖤𝗊(𝖫𝗂𝗌𝗍 𝑎) resolves the latter request from 𝖮𝗋𝖽𝖨𝗇𝗍, so both sets succeed.
For action composition, put 𝑅={𝖮𝗋𝖽𝛾,𝖤𝗊𝛽},𝑆=[𝖫𝗂𝗌𝗍𝛼/𝛾],𝑇=[𝖫𝗂𝗌𝗍𝛼/𝛽]. Without closure, 𝗇𝖿(𝑆𝑅) ={𝖮𝗋𝖽 𝛼,𝖤𝗊 𝛽}, so the second action rejects at 𝖤𝗊(𝖫𝗂𝗌𝗍 𝛼). Direct normalization of (𝑇 ∘𝑆)𝑅 first constructs 𝖮𝗋𝖽(𝖫𝗂𝗌𝗍 𝛼), installs it, projects the required equality dictionary, and returns {𝖮𝗋𝖽 𝛼}. With closure, the sequential second action uses the derived clause and returns that same set. Both routes transport the same evidence: 𝖤𝗊𝖥𝗋𝗈𝗆𝖮𝗋𝖽(𝖮𝗋𝖽𝖫𝗂𝗌𝗍(𝑑𝖮𝗋𝖽)).
Exercise 11.2.
Explicit type application can select 𝐴 =𝖨𝗇𝗍 and then receive an explicit dictionary. For example, 𝑓[𝖨𝗇𝗍]{𝗌𝗁𝗈𝗐𝖣𝖾𝖼𝗂𝗆𝖺𝗅}and𝑓[𝖨𝗇𝗍]{𝗌𝗁𝗈𝗐𝖧𝖾𝗑𝖺𝖽𝖾𝖼𝗂𝗆𝖺𝗅} may return "10" and "0xa" on the value 10. At an implicit use, the visible result type is only 𝖲𝗍𝗋𝗂𝗇𝗀; it contains no occurrence of 𝐴. The type therefore determines neither the instantiation nor the dictionary. This is exactly the failure of 𝖿𝗍𝗏(𝑄) ⊆𝖿𝗍𝗏(𝜏).
Exercise 11.3.
Give 𝑥 the fresh type 𝑎. Fresh instantiations of 𝗇𝗂𝗅 :∀𝑏.𝖫𝗂𝗌𝗍 𝑏 and 𝖼𝗈𝗇𝗌 :∀𝑏.𝑏 →𝖫𝗂𝗌𝗍 𝑏 →𝖫𝗂𝗌𝗍 𝑏 make both singleton lists have type 𝖫𝗂𝗌𝗍 𝑎. Instantiating 𝖾𝗊 at that type contributes 𝖤𝗊(𝖫𝗂𝗌𝗍𝑎)⇒𝖫𝗂𝗌𝗍𝑎→𝖫𝗂𝗌𝗍𝑎→𝖡𝗈𝗈𝗅. The application MGUs identify no further type variables. The normalizer one-way-matches the list instance and records 𝖾𝗊𝖫𝗂𝗌𝗍:𝖤𝗊𝐷(𝑎)→𝖤𝗊𝐷(𝖫𝗂𝗌𝗍𝑎), so the residual predicate is 𝖤𝗊 𝑎. Abstraction and top-level generalization therefore give ∀𝑎.𝖤𝗊𝑎⇒𝑎→𝖡𝗈𝗈𝗅.
For a rejected right-hand side, place 𝗌𝗁𝗈𝗐 :∀𝑏.𝖲𝗁𝗈𝗐 𝑏 ⇒𝑏 →𝖲𝗍𝗋𝗂𝗇𝗀 in the environment and use 𝗌𝗁𝗈𝗐 𝖿𝖺𝗅𝗌𝖾. W generates the ground request 𝖲𝗁𝗈𝗐 𝖡𝗈𝗈𝗅. The selected environment contains only 𝖲𝗁𝗈𝗐 𝖨𝗇𝗍, so normalization returns 𝗋𝖾𝗃𝖾𝖼𝗍(𝖲𝗁𝗈𝗐 𝖡𝗈𝗈𝗅) before generalization.
Exercise 13.4.
In the constructor context 𝐴 ::𝖳𝗒 and term context 𝑑:𝖤𝗊𝐷(𝐴),𝑥:𝐴,𝑦:𝐴,𝑧:𝐴, the application rules give 𝑑𝑥:𝐴→𝖡𝗈𝗈𝗅𝐹𝑇−𝐴𝑝𝑝,𝑑𝑥𝑦:𝖡𝗈𝗈𝗅𝐹𝑇−𝐴𝑝𝑝,𝑑𝑦𝑧:𝖡𝗈𝗈𝗅𝐹𝑇−𝐴𝑝𝑝,𝖺𝗇𝖽𝐹(𝑑𝑥𝑦)(𝑑𝑦𝑧):𝖡𝗈𝗈𝗅𝐹𝑇−𝐴𝑝𝑝 twice. Discharging 𝑧,𝑦,𝑥,𝑑 by four uses of T-Lam, and then 𝐴 by T-TLam, derives 𝖺𝗅𝗅𝖲𝖺𝗆𝖾𝟥♯:∀𝐴::𝖳𝗒.𝖤𝗊𝐷(𝐴)→𝐴→𝐴→𝐴→𝖡𝗈𝗈𝗅𝐹.
For the displayed run, the outer contractions give 𝖺𝗅𝗅𝖲𝖺𝗆𝖾𝟥♯[𝖡𝗈𝗈𝗅𝐹]𝖾𝗊𝖡𝗈𝗈𝗅𝗍𝗋𝗎𝖾𝐹𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶∗𝛽𝖺𝗇𝖽𝐹(𝖾𝗊𝖡𝗈𝗈𝗅𝗍𝗋𝗎𝖾𝐹𝗍𝗋𝗎𝖾𝐹)(𝖾𝗊𝖡𝗈𝗈𝗅𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹). Put 𝑒𝑇 =𝗍𝗋𝗎𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝖿𝖺𝗅𝗌𝖾𝐹𝗍𝗋𝗎𝖾𝐹. The first comparison reduces completely as follows: 𝖾𝗊𝖡𝗈𝗈𝗅𝗍𝗋𝗎𝖾𝐹𝗍𝗋𝗎𝖾𝐹⟶∗𝛽𝗍𝗋𝗎𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝗍𝗋𝗎𝖾𝐹𝑒𝑇⟶𝛽(𝜆𝑡:𝖡𝗈𝗈𝗅𝐹.𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝑡)𝗍𝗋𝗎𝖾𝐹𝑒𝑇⟶𝛽(𝜆𝑓:𝖡𝗈𝗈𝗅𝐹.𝗍𝗋𝗎𝖾𝐹)𝑒𝑇⟶𝛽𝗍𝗋𝗎𝖾𝐹. The second comparison follows the same selected true branch: 𝖾𝗊𝖡𝗈𝗈𝗅𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶∗𝛽𝗍𝗋𝗎𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝖿𝖺𝗅𝗌𝖾𝐹(𝖿𝖺𝗅𝗌𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝖿𝖺𝗅𝗌𝖾𝐹𝗍𝗋𝗎𝖾𝐹)⟶∗𝛽𝖿𝖺𝗅𝗌𝖾𝐹. The final conjunction is 𝖺𝗇𝖽𝐹𝗍𝗋𝗎𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶∗𝛽𝗍𝗋𝗎𝖾𝐹[𝖡𝗈𝗈𝗅𝐹]𝖿𝖺𝗅𝗌𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶𝛽(𝜆𝑝:𝖡𝗈𝗈𝗅𝐹.𝜆𝑞:𝖡𝗈𝗈𝗅𝐹.𝑝)𝖿𝖺𝗅𝗌𝖾𝐹𝖿𝖺𝗅𝗌𝖾𝐹⟶∗𝛽𝖿𝖺𝗅𝗌𝖾𝐹. The displayed Church false is itself beta-normal, so no redex remains.
For the three failures, take:
the overlapping table {(𝖤𝗊,𝖡𝗈𝗈𝗅𝐹,𝖾𝗊𝖡𝗈𝗈𝗅),(𝖤𝗊,𝖡𝗈𝗈𝗅𝐹,𝜆𝑝:𝖡𝗈𝗈𝗅𝐹.𝜆𝑞:𝖡𝗈𝗈𝗅𝐹.𝗍𝗋𝗎𝖾𝐹)}; it violates hypothesis 1 of proposition 13.21;
the nested declaration 𝖤𝗊𝐴⇒(𝖤𝗊𝐴⇒𝑠), which creates two dictionaries at the same normalized key and violates hypothesis 3;
the two ground entries (𝖳𝖺𝗀,𝖡𝗈𝗈𝗅𝐹,𝟢),(𝖳𝖺𝗀,ℕ,𝗌𝗎𝖼(𝟢)), with 𝖳𝖺𝗀𝖣(𝐴) =ℕ. In the scheme ∀𝐴.𝖳𝖺𝗀 𝐴 ⇒ℕ, the constrained variable 𝐴 does not occur in the normalized visible monotype ℕ. This violates the separate ambiguity/admission check that every constraint variable be determined by that visible monotype, not one of the four numbered coherence hypotheses.
Exercise 13.5.
Pair decomposition produces 𝖨𝗇𝗍 =𝖤𝗅𝖾𝗆 𝑐 and 𝑎 =𝖡𝗈𝗈𝗅. The latter has most-general substitution [𝖡𝗈𝗈𝗅/𝑎]; the former cannot reduce while 𝑐 is unknown, so 𝑇=[𝖡𝗈𝗈𝗅/𝑎],𝑈={𝖨𝗇𝗍=𝖤𝗅𝖾𝗆𝑐}.
With 𝑐 =𝖫𝗂𝗌𝗍 𝖨𝗇𝗍, the instance equation reduces the right side to 𝖨𝗇𝗍, and reflexivity discharges 𝑈. In the chapter’s local target sketch, the method use is 𝗂𝗇𝗌𝖾𝗋𝗍♯[𝖫𝗂𝗌𝗍𝖨𝗇𝗍][𝖨𝗇𝗍](𝖼𝗈𝗅𝗅𝖾𝖼𝗍𝗌𝖫𝗂𝗌𝗍[𝖨𝗇𝗍]𝖾𝗊𝖨𝗇𝗍). The dictionary has type 𝖢𝗈𝗅𝗅𝖾𝖼𝗍𝗌𝐷(𝖫𝗂𝗌𝗍 𝖨𝗇𝗍,𝖨𝗇𝗍).
With 𝑐 =𝖫𝗂𝗌𝗍 𝖡𝗈𝗈𝗅, normalization instead produces 𝖨𝗇𝗍 =𝖡𝗈𝗈𝗅. Distinct rigid constructors do not unify, so the inference branch fails. The independently well-typed Boolean method would have target form 𝗂𝗇𝗌𝖾𝗋𝗍♯[𝖫𝗂𝗌𝗍𝖡𝗈𝗈𝗅][𝖡𝗈𝗈𝗅](𝖼𝗈𝗅𝗅𝖾𝖼𝗍𝗌𝖫𝗂𝗌𝗍[𝖡𝗈𝗈𝗅]𝖾𝗊𝖡𝗈𝗈𝗅), but it cannot elaborate the source equality constraint demanding element type 𝖨𝗇𝗍. A valid dictionary term cannot repair a failed static equality.
Exercise 11.5.
In Δ =?𝖨𝗇𝗍 :𝑥,𝛼,?𝛼 :𝑦, the query ?𝖨𝗇𝗍 initially skips the nonmatching ?𝛼 and selects 𝑥. After substituting 𝖨𝗇𝗍 for 𝛼, nearest-first lookup selects 𝑦. The evidence terms are therefore exactly 𝑥 and 𝑦.
Remove the final assumption ?𝛼 :𝑦. Lookup then reaches ?𝖨𝗇𝗍 :𝑥 directly: no implicit candidate lies between the query and that entry. Consequently the no-match rule is never used, the stability side condition is not invoked, and no valid-substitution premise has become trivial.
Exercise 11.6.
The variable 𝛽 is free in the inferred type and not fixed by the environment; 𝛼 is fixed by the environment. Therefore the maximal split of lemma 11.3 is 𝑃𝗀1={𝖲𝗁𝗈𝗐𝛽},𝑃𝗋1={𝖤𝗊𝛼},𝜎=∀𝛽.𝖲𝗁𝗈𝗐𝛽⇒𝛽→𝖡𝗈𝗈𝗅. If the body call returns substitution 𝑆2, its factor 𝑇 is extended on the variables quantified by 𝜎, while the inherited coordinates obey 𝑇⋆𝑆1;𝑆2⋆Γ=𝑅⋆Γ. This equation fixes the meaning of 𝛼 in the body exactly as it was fixed in the outer environment. The residual requirement becomes 𝖤𝗊 𝛼[𝑆2] and is combined with the body’s requirements; by lemma 13.8, final normalization cannot discard an obligation needed by the declarative derivation.
If 𝖤𝗊 𝛼 were generalized, the let-bound term could be instantiated at a type unrelated to the outer 𝛼. That instance would request a dictionary not justified by the outer evidence context, while the residual set would no longer contain 𝖤𝗊 𝛼. The displayed environment equation would then fix 𝛼 on the left but the alleged scheme instance could change it on the right, so the factorization required by theorem 11.5 would fail.
Exercise 11.7.
Choose overlap. Add two premise-free declarations 𝑑1:𝖤𝗊(𝖫𝗂𝗌𝗍𝖨𝗇𝗍),𝑑2:𝖤𝗊(𝖫𝗂𝗌𝗍𝖨𝗇𝗍) whose Boolean functions disagree on one pair of lists. The closed program 𝖾𝗊 [0] [1] can then elaborate with either dictionary and has two observable results. The precise failed proof step is the unique-instance case of lemma 11.1; canonical evidence and theorem 11.8 consequently fail as well. A repair would need a displayed deterministic priority in both the declarative and algorithmic systems together with a proof that substitution preserves it. Selecting whichever declaration happens to be encountered first supplies no such invariant.