Exercise 12.1.
Write the order package as 𝑂:=𝗉𝖺𝖼𝗄[𝑡,𝗅𝖾]:∃𝑡:𝖳𝗒.𝑡→𝑡→𝟐. If a set implementation is represented by 𝗉𝖺𝖼𝗄[𝑢,⟨𝖾𝗆𝗉𝗍𝗒,𝗂𝗇𝗌𝖾𝗋𝗍⟩], the desired insert field has type 𝑡 →𝑢 →𝑢. That occurrence of 𝑡 is legal only inside 𝗎𝗇𝗉𝖺𝖼𝗄[𝑡,𝑜]=𝑂 𝗂𝗇 𝗉𝖺𝖼𝗄[𝑢,⟨𝖾𝗆𝗉𝗍𝗒,𝗂𝗇𝗌𝖾𝗋𝗍⟩]. Returning this package would put the locally fresh 𝑡 in the result type, contradicting existential elimination’s no-escape premise. Giving the set an independent element witness loses the required equation. Replacing both witnesses by ℕ restores the equation by revealing the representation, so it no longer implements the abstract interface.
Exercise 12.2.
Let 𝗅𝖾𝖡𝗈𝗈𝗅:=𝜆𝑏1:𝟐.𝜆𝑏2:𝟐.¬𝑏1∨𝑏2,𝑝𝐵:=⟨𝟐;𝗅𝖾𝖡𝗈𝗈𝗅⟩. Rule Basic derives 𝑝𝐵:𝖡(𝑠::𝖲𝗂𝗇𝗀(𝟐);𝑠→𝑠→𝟐)=𝖮𝖱𝖣𝖤𝖱𝖤𝖣[𝟐]. Transparent matching retains the singleton 𝑠 ::𝖲𝗂𝗇𝗀(𝟐), so a client may pass 𝗍𝗋𝗎𝖾 to the comparison field. Opaque sealing instead derives 𝑝𝐵↾𝖮𝖱𝖣𝖤𝖱𝖤𝖣:𝖡(𝑠::𝖳𝗒;𝑠→𝑠→𝟐). The exported 𝑠 is abstract, and no judgment 𝑠 ≡𝟐 ::𝖳𝗒 is available. The same client application is therefore rejected.
Exercise 12.3.
The first component supplies the singleton equation 𝑋.𝑠≡ℕ::𝖳𝗒. The second component of 𝖮𝖱𝖣𝖲𝖤𝖳 consequently specializes to 𝖲𝖤𝖳[ℕ]. Matching 𝑝𝐵 :𝖲𝖤𝖳[𝟐] against it also requires 𝑋.𝑠≡𝟐::𝖳𝗒. The two equations would imply ℕ ≡𝟐 ::𝖳𝗒, which constructor equivalence cannot derive. Thus Sigma-Match fails at its second premise; the ordinary dynamic operations of the two components are irrelevant.
Exercise 12.4.
Bind two separately sealed applications 𝑆𝑖 =𝖲𝖾𝗍𝖥𝗇(𝑝𝑂). Both applications are specialized at 𝑝𝑂 :𝖮𝖱𝖣𝖤𝖱𝖤𝖣[ℕ], so both interface element parameters are ℕ. Opaque sealing nevertheless allocates distinct representation identities: no judgment 𝑆1.𝑠 ≡𝑆2.𝑠 is derivable even though both bodies use lists. A hierarchy sharing exactly the element type is 𝖲𝗂𝗀𝗆𝖺(𝑋:𝖮𝖱𝖣𝖤𝖱𝖤𝖣[ℕ]).𝖲𝗂𝗀𝗆𝖺(𝑆1:𝖲𝖤𝖳[𝑋.𝑠]).𝖲𝖤𝖳[𝑋.𝑠]. The two set components mention the same path 𝑋.𝑠, but each basic set signature binds its own abstract representation constructor.
Exercise 12.5.
At the manifest argument, Pi-Match compares the domain contravariantly and then specializes the result to 𝖲𝖤𝖳[ℕ]; Sub applies the match. The source calculation is 𝖲𝖾𝗍𝖥𝗇(𝑝𝑂)(12.5)⟶𝖫𝗂𝗌𝗍𝖲𝖾𝗍𝑝𝑂↾𝖲𝖤𝖳[ℕ](12.1)⟶𝖫𝗂𝗌𝗍𝖲𝖾𝗍𝑝𝑂. Substituting that value in the annotated let gives 𝐿(12.4)⟶⟨𝟐;𝜋2(𝜋2(𝖫𝗂𝗌𝗍𝖲𝖾𝗍𝑝𝑂.𝑑))0(𝜋1(𝖫𝗂𝗌𝗍𝖲𝖾𝗍𝑝𝑂.𝑑))⟩(12.2)⟶⟨𝟐;𝜋2(𝜋2⟨𝗇𝗂𝗅,𝖼𝗈𝗇𝗌,𝗆𝖾𝗆𝖻𝖾𝗋𝑝𝑂⟩)0𝜋1⟨𝗇𝗂𝗅,𝖼𝗈𝗇𝗌,𝗆𝖾𝗆𝖻𝖾𝗋𝑝𝑂⟩⟩𝐸−𝑆𝑛𝑑−𝑃𝑎𝑖𝑟𝑡𝑤𝑖𝑐𝑒,𝑡ℎ𝑒𝑛𝐸−𝐹𝑠𝑡−𝑃𝑎𝑖𝑟⟶∗⟨𝟐;𝗆𝖾𝗆𝖻𝖾𝗋𝑝𝑂0𝗇𝗂𝗅⟩. The target application binds the translated argument once and opens it before translating the body: (𝜆𝑧.𝖮𝗉𝖾𝗇𝖮𝖱𝖣𝖤𝖱𝖤𝖣[ℕ](𝑧,𝑋;𝑃𝑆(𝑋)))T𝜌→E𝑂(𝑝𝑂)𝛽⟶𝖮𝗉𝖾𝗇𝖮𝖱𝖣𝖤𝖱𝖤𝖣[ℕ](T𝜌→E𝑂(𝑝𝑂),𝑋;𝑃𝑆(𝑋))∃−𝛽⟶∗𝗉𝖺𝖼𝗄[𝖫𝗂𝗌𝗍ℕ;⟨𝗇𝗂𝗅,𝖼𝗈𝗇𝗌,𝗆𝖾𝗆𝖻𝖾𝗋𝑝𝑂⟩]. The translated let opens this package. Its dynamic projection is 𝗎𝗇𝗉𝖺𝖼𝗄[𝑟,𝑥]=𝗉𝖺𝖼𝗄[𝖫𝗂𝗌𝗍ℕ;𝑞] 𝗂𝗇 𝑥∃−𝛽⟶𝑞, after which the same product projections select 𝗇𝗂𝗅 and 𝗆𝖾𝗆𝖻𝖾𝗋𝑝𝑂. If the annotated result type mentioned 𝑆.𝑠, the witness 𝑟 opened for 𝑆 would occur free in that result type. The existential-elimination no-escape premise would then fail, which is why the supported translation requires the displayed closed result.
Exercise 12.6.
Take 𝐾(𝑧,𝗌𝗍𝖾𝗉,𝗋𝖾𝖺𝖽):=𝗋𝖾𝖺𝖽(𝗌𝗍𝖾𝗉(𝗌𝗍𝖾𝗉(𝗌𝗍𝖾𝗉𝑧))). For 𝐶𝑁, the successive states are 0,1,2,3, so the result is 3. For 𝐶𝑃, they are ⟨0,⋆⟩,⟨1,⋆⟩,⟨2,⋆⟩,⟨3,⋆⟩, and the observer again returns 3. If abstract equality were exported, the logical relation would additionally have to satisfy 𝑅(𝑛,𝑝)∧𝑅(𝑛′,𝑝′)⟹𝖾𝗊𝑁(𝑛,𝑛′)=𝖾𝗊𝑃(𝑝,𝑝′). Without this operation clause the fundamental-relation induction has no case for the new constant.
Exercise 12.7.
The basic clause gives 𝗉𝗌𝗂𝗀(𝖭𝖺𝗍𝖮𝗋𝖽𝖾𝗋0)=𝖡(𝑠::𝖲𝗂𝗇𝗀(ℕ);ℕ→ℕ→𝟐). If 𝑝𝑆 =⟨𝖫𝗂𝗌𝗍 ℕ;𝑣𝑆⟩, the hierarchy clause and singleton propagation give 𝖲𝗂𝗀𝗆𝖺(:𝗉𝗌𝗂𝗀(𝖭𝖺𝗍𝖮𝗋𝖽𝖾𝗋0)).𝖡(𝑟::𝖲𝗂𝗇𝗀(𝖫𝗂𝗌𝗍ℕ);𝗉𝗍𝗒(𝑣𝑆)). An opaque seal is excluded from the grammar of projectible paths because it forgets static identity. The generative application 𝖲𝖾𝗍𝖥𝗇(𝖭𝖺𝗍𝖮𝗋𝖽𝖾𝗋0) is also nonprojectible. Neither has a clause in definition 12.12; inspecting either body would manufacture precisely the identity that the boundary hides or generates. If another signature is proposed as least for either projectible example, leastness yields matches in both directions between it and the displayed 𝗉𝗌𝗂𝗀; the selected calculus supplies no antisymmetry rule that would turn those two matches into judgmental equality.
Exercise 14.8.
Within the selected 𝛼-small relation fibers, the functorial action is pointwise, so the two witnesses become 𝑤𝗋𝗈𝗎𝗇𝖽(𝑟𝑗)=𝑤𝗉𝖺𝖼𝗄(𝑤𝗎𝗇𝗉𝖺𝖼𝗄(𝑟𝑗))(𝑗∈{1,2}). The output witnesses need not be equal: proof relevance records the chosen input witness and the two maps applied to it. Under 𝖻𝗌𝗍, the dynamic round-trip functions are identified; the output still has the input static type components 𝑋0,𝑋1 and the tracked family ̃𝑋 between them. If relation fibers are truncated to propositions, both 𝑟1 and 𝑟2 become the same mere fact of relatedness, and the distinction between the two displayed outputs is erased.
The counter theorem’s proposition is 𝑅(𝑛,⟨𝑚, ⋆⟩). It is defined externally inside a simply typed logical relation. That calculus has no internal 𝖻𝗌𝗍, no static-extent signature, no family of witness sets, and no model of phase-separated parametricity. Therefore its proof has the same broad shape as representation independence, but does not instantiate the hypotheses of the imported ModTT theorem.
Exercise 12.8.
In Crary’s comparison calculus, two ordinary avoiding answers may retain the four visible fields while choosing respectively 𝐷:𝗂𝗇𝗍𝑢→𝑣and𝐷:𝖻𝗈𝗈𝗅𝑢→𝑣. The first types 𝐷 𝑥 but not 𝐷 𝑦; the second types 𝐷 𝑦 but not 𝐷 𝑥. Each therefore exposes a fact unavailable from the other, so neither subsigns the other.
The least answer in the extended signature language is ∃𝑡.𝗌𝗂𝗀 {𝗍𝗒𝗉𝖾 ′𝑎𝑢=𝑡; 𝖽𝖺𝗍𝖺𝗍𝗒𝗉𝖾 𝑣=𝐷 𝗈𝖿 𝑡; 𝑥:𝗂𝗇𝗍𝑢; 𝑦:𝖻𝗈𝗈𝗅𝑢}. The leading ∃𝑡 binds the generated name throughout the four-field signature and prevents it from escaping. This answer belongs to Crary’s existential-signature extension, not to definition 12.1.
Exercise 12.9.
Let 𝖬𝖠𝖯[𝑎] bind a private representation and operations on keys of type 𝑎. Use the hierarchy 𝖲𝗂𝗀𝗆𝖺(𝑂:𝖮𝖱𝖣𝖤𝖱𝖤𝖣).𝖲𝗂𝗀𝗆𝖺(𝑆:𝖲𝖤𝖳[𝑂.𝑠]).𝖬𝖠𝖯[𝑂.𝑠]. A natural-number implementation matches with 𝑂.𝑠 ≡ℕ, a set representation 𝖫𝗂𝗌𝗍 ℕ, and an independent map representation such as 𝖫𝗂𝗌𝗍(ℕ ×𝖲𝗍𝗋𝗂𝗇𝗀). The two representation paths are unrelated. Replacing the map by 𝖬𝖠𝖯[𝟐] requires both 𝑂.𝑠 ≡ℕ and 𝑂.𝑠 ≡𝟐, so matching fails at ℕ ≢𝟐 ::𝖳𝗒.
Exercise 12.10.
After matching both counter components to a closed result, use the hierarchy signature 𝖲𝗂𝗀𝗆𝖺(:𝖢𝖮𝖴𝖭𝖳𝖤𝖱).𝖢𝖮𝖴𝖭𝖳𝖤𝖱. Its target is 𝖯𝖺𝖼𝗄(𝖢𝖮𝖴𝖭𝖳𝖤𝖱) ×𝖯𝖺𝖼𝗄(𝖢𝖮𝖴𝖭𝖳𝖤𝖱), and the hierarchy translates to ⟨𝑃1,𝑃2⟩. The second dynamic projection reduces by 𝗎𝗇𝗉𝖺𝖼𝗄[𝑡,𝑥]=𝜋2⟨𝑃1,𝑃2⟩ 𝗂𝗇 𝑥𝑃𝑟𝑜𝑑−𝛽⟶𝗎𝗇𝗉𝖺𝖼𝗄[𝑡,𝑥]=𝑃2 𝗂𝗇 𝑥∃−𝛽⟶𝑣2, where 𝑃2 =𝗉𝖺𝖼𝗄[𝑡2,𝑣2]. If the source second component was written using the first path, matching must first replace that path by its manifest constructor. Otherwise 𝑃2’s type contains the witness opened for 𝑃1, so returning the pair violates no-escape and lies outside theorem 12.7.
Exercise 12.12.
With the temporary App-P and Seal-P rules, an applicative result can be recognized only from stable syntax. The corresponding principal clause is 𝗉𝗌𝗂𝗀(𝐹(𝐴))=𝜎2[𝐴/𝑋] when 𝗉𝗌𝗂𝗀(𝐹)=𝖯𝗂(𝑋:𝜎1).𝜎2,𝗉𝗌𝗂𝗀(𝐴)⪯𝗌𝜎1, and equality of two such result paths requires equality of both the functor paths and the argument values. That information is absent from the four structural clauses of definition 12.12.
For the extended phrase 𝗂𝖿 𝑏 𝗍𝗁𝖾𝗇 𝑀1 𝖾𝗅𝗌𝖾 𝑀2, the runtime Boolean 𝑏 is not a projectible functor path or a module value. Neither App-P nor Seal-P derives projectibility for the conditional, even when both branches have the same signature. Thus it has no stable applicative identity without an additional, unsound inspection of runtime control flow.