Lectures onType Theory
ch:ott: ch:ott
appendix sectionsolutions

ch:ott: ch:ott

exercise 79.1.

The unique introduction of gives () by the identity function on an assumed contradiction, and any function maps to the unique proof of . For f,g:, function eta reduces equality to equality of f(x) and g(x) under x:; Irr identifies these proofs judgmentally. Thus has the same introduction, elimination, and irrelevance rules as .

exercise 79.2.

Given z:(x:P).Q(x) and a motive C(z):SProp, with branch d:Πx:PΠy:Q(x)C(x,y), define the eliminator by first using Ex-E1 to obtain a witness x and then Ex-E2 to obtain the corresponding y. The produced proof has type C(x,y); Irr converts it to C(z) because all inhabitants of the existential proposition, and hence their motive fibers, are proof irrelevant. The constructor computation follows by both elimination computations and Irr.

exercise 79.3.

A closed derivation of already makes the theory inconsistent, so a metarule using only such a derivation to produce a closed inhabitant adds no new behavior in a consistent theory. By contrast, a variable h:0 is a neutral relevant term; large elimination turns it into a neutral term of every data type. Declaring those proofs irrelevant can identify eliminations that compute through different relevant structures, so compatibility with reduction and confluence—hence decidable conversion and kernel rechecking—must be proved. The at-risk demand is normalization/ decidable judgmental equality, not merely logical consistency.

exercise 79.4.

Reflexivity has motive λx.xAx in SProp. Symmetry transports a proof along the swapped endpoint family, and transitivity transports along the second equality; all proof-dependent choices are repaired by Irr. For dependent f, take e:A(t,u) to obtain the type equality apB(e):B(t)=B(u). Cast ft along it, then use observational congruence of application and the transport rule for f to produce cast(B(t),B(u),apB(e),ft)B(u)fu. The motive is proposition-valued, so proof irrelevance closes the coherence.

exercise 79.5.

For n+0=n, eliminate n with motive C(n)=n+0Nn. The zero branch is reflexivity; the successor branch maps the induction proof through the successor clause of observational equality. For 0+n=n, recurse in the argument on which addition is defined: the zero case is reflexivity and the successor case is again successor congruence. With the recursion orientation m+0=m and m+sucn=suc(m+n), the second construction is immediate by induction on n, whereas the first uses induction on n to expose the left argument.

exercise 79.6.

Universe equality of W-types consists of eA:AUA and, after contravariantly casting an a:A back to A, equality of arities B(a)UB(a). Equality of sup(a,f) and sup(a,f) consists of a root equality r:aa and pointwise equality of child functions after casting indices and subtree types along the arity equality. In the numeral encoding, distinct raw child functions have empty domains at zero and propositionally corresponding domains at successors; function observational equality therefore identifies them whenever they encode the same recursive children.

exercise 79.7.

In the full rule the motive may mention the equality proof e. Replace it by the nondependent family obtained by fixing one proof e0. For any other e, Irr gives ee0, and context conversion changes the fixed-family result to the desired fiber at e. Thus nondependent transport followed by proof-irrelevance conversion derives the proof-dependent rule.

exercise 79.8.

For e:Πx:AB(x)UΠx:AB(x), pr1e equates A with A. Given a:A, cast it contravariantly to a:A. The second component supplies B(a)UB(a) at this pair of related arguments. Hence f(a):B(a) may be cast along that equality to B(a). Abstracting over a gives a term of Πa:AB(a), as required.

exercise 79.9.

If a neutral n:N were reduced by a general same-type cast rule, later substitution n:=0 would overlap Cast-Nat-Z, while n:=sucm would overlap Cast-Nat-S; without knowing the equality proof is reflexive, the two reduct schemes need not join. For a type variable X there is no head constructor selecting a structural cast clause at all. Thus only Cast-Refl removes the cast when its equality evidence computes to reflexivity; otherwise the cast must remain neutral.

exercise 79.10.

By definition substB(e,p) is cast from B(t) to B(u) along apB(e). For e=refl(t), the groupoid computation gives apB(e)=refl(B(t)). Cast-Refl reduces the cast to p, and observational reflexivity yields substB(refl(t),p)B(t)p.

exercise 79.11.

Reflexivity of R is commutativity of addition; symmetry swaps the two sides; transitivity cancels the common middle summands after associating and commuting. These equalities are observational proofs in N. For the displayed representatives the quotient rule reduces their equality to suc0+suc0Nsuc(suc0)+0, then addition computation reduces both sides to suc(suc0). The natural observational-equality clause reduces this through two successor steps and the zero clause to .

exercise 79.12.

Precomposition sends g:A/RC to f=gπ; congruence of g applied to the quotient path constructor supplies preservation of R. Conversely the quotient eliminator extends an R-respecting f to f¯ with f¯(πa)f(a). One composite is the computation rule. Quotient induction proves the other pointwise on πa, and function observational equality promotes it to equality of maps. Thus the two constructions are a bijection up to .

exercise 79.13.

For heterogeneous evidence (e,q), coercion is cast(S,T,e,s) and coherence is q; symmetry uses inverse type equality and inverse cast coherence, while transitivity composes the type equalities and uses cast composition. When ST, map ordinary observational equality q:st to (reflS,q), where Cast-Refl identifies cast(S,S,refl,s) with s. Conversely eliminate the existential and use proof irrelevance to replace e by reflexivity before applying q. Without Cast-Refl, the forward pair would relate a stuck cast rather than s itself.

exercise 79.14.

In context h:, use proof elimination to form abortN(h):N. Its scrutinee is a neutral variable, so the term is a weak-head normal form, but its head is neither 0 nor suc. Consistency excludes such a closed h and is therefore necessary for closed numeral canonicity. In the intensional base, normalization first gives canonical closed forms and then implies consistency by observing that 0 has none; here the metatheorem uses consistency to rule out neutral proof eliminations.

exercise 79.15.

Irr makes any two proofs of 2U2 judgmentally equal, and reflexivity inhabits the type. In the univalent base, encode–decode identifies universe loops at 2 with Boolean automorphisms, of which identity and swap are the two possibilities. Observational universe equality records only a proof-irrelevant structural comparison; its eliminator cannot recover the chosen automorphism, so the decode map distinguishing identity from swap is unavailable.

exercise 79.16.

If p,q:tAu, Irr directly gives pq; no case split on the existence of equality is involved. For P:SProp, Obs-Prop identifies PSProp with logical equivalence P, hence with P. A uniform decision procedure for that observational equality would therefore decide every proposition P. Proof irrelevance supplies uniqueness of evidence, not existence or decidability of evidence.

exercise 215.17.

For p:AA and q:Πx:A.B(x)B(cast(p,x)), casting f:Πx:A.B(x) forward is castΠ(p,q,f):=λx:A.cast(q(cast(p1,x)))(f(cast(p1,x))). The domain coercion is contravariant because f consumes an A, while the result coercion is indexed by that coerced argument. For constant B,B the formula becomes λx.cast(q,f(cast(p1,x))). If both equality codes are reflexive, both casts compute away and Π-eta returns f; if only the codomain code is reflexive, the remaining operation is precomposition by the inverse domain cast.

Search the book

Type to search the local edition.