Lectures onType Theory
ch:cic: ch:cic
appendix sectionsolutions

ch:cic: ch:cic

Exercise 89.1.

For the inner product AType@{v}, the domain has sort Type@{u} and the codomain term has sort Type@{v+1}, so its sort is Type@{max(u,v+1)}. The outer domain Type@{u} itself has sort Type@{u+1}. Hence the whole product has sort Type@{max(u+1,v+1)}. Equivalently, a fresh result level w needs the constraints u+1w and v+1w. If the innermost codomain is Prop, both products have propositional codomain; impredicativity makes their final sort Prop instead of taking a maximum.

Exercise 89.2.

At universe u, declare Tree@{u}(A:Type@{u}):Type@{u}, with leaf:ATree(A) and node:Tree(A)Tree(A)Tree(A). The sole parameter is A; there are no indices. Both recursive occurrences are constructor arguments in positive positions, and every conclusion uses the same parameter A. The judgment Type@{u}:Type@{u+1} is sort formation, not a nontrivial declared universe constraint. This declaration can therefore have an empty constraint set. Choose its stored ind_kelim list to be [Prop,Set,Type]; the frozen 2019 check_ind_sorts does not validate that list for a Type-valued inductive. A field Tree(A)A moves the family to the domain of an arrow inside a constructor argument, so the positivity path fails at constructor-arg/domain.

Exercise 89.3.

Environment checking uses universe-graph validity and the graph and inductive-body obligations. Weak-head normalization uses normalization, subject reduction, strengthening, and stability of fix guards under the transformations performed during reduction. Conversion additionally uses proof irrelevance and the conversion metatheory. Type inference uses validity and principality to relate inferred and expected types. Declaration checking uses the positivity/fix or configuration guards and the checked environment interfaces. Confluence says that two reductions from one term can be joined; it neither proves that reduction terminates nor constructs a total weak-head-normalization function. The strong-normalization assumption is therefore not discharged by confluence.

Exercise 89.4.

For equality, a motive may be P=:=λy.λe.A:y:AEq(A,x,y)Type@{u}. The reflexivity branch is the actual term x:P=(x,refl), so the equality case returns an element of A and is admitted by the stored singleton-elimination information. For the existential, take the equally explicit Type-valued motive Q:=λe.A:Exists(A,R)Type@{u},b:=λx.λp.x. The proposed branch has type x:Ap:R(x)Q(intro(x,p)) and would return the hidden witness. It is rejected: the constructor field x:A is an informative witness, so this propositional inductive is not in the singleton-elimination class. A Prop-valued motive remains admissible.

Exercise 89.5.

Let IV:=(kn,0) be the inductive identifier for the sole body of the vector mutual block, let u be its universe instance, and let the constructor numbers be 0 for nil and 1 for cons. The three raw references are Ind(IV,u),Construct(IV,0,u),Construct(IV,1,u). For z:Ind(IV,u)An, a dependent case predicate has type m:NInd(IV,u)AmType@{w}. The case information is exactly (IV,1): there is one uniform parameter. Its raw branch list has arities [(0,bnil),(3,bcons)]. The nil branch has type P0(Construct(IV,0,u)A). The raw cons branch quantifies only m:N,x:A,xs:Ind(IV,u)Am and returns P(sucm)(Construct(IV,1,u)Amxxs). The kernel case rule supplies no induction hypothesis. The separate generated induction constant has a cons method that additionally quantifies ih:Pmxs before returning the same displayed result. Here A is the uniform parameter, m the index, xs the recursive vector, and ih the result of the induction fixpoint’s recursive call on xs.

Exercise 89.6.

Use IV=(kn,0), case information (IV,1), and raw branches [(0,b0),(3,b1)]. The complete constructor-headed redex is Case((IV,1),P,apps(Construct(IV,1,u),[A,m,x,xs]),[(0,b0),(3,b1)]). By PCUIC-ι it reduces in one step to the literal substitution result apps(b1,skipn(1,[A,m,x,xs]))apps(b1,[m,x,xs]). No recursive call or induction hypothesis is inserted by this reduction.

For a projection p and a block with unfoldCoFix(d¯,k)=(na,f), the complete raw step is Proj(p,apps(CoFix(d¯,k),a¯))0Proj(p,apps(f,a¯)). Projection from a constructor is a separate next step. For a fixpoint, apps(Fix(e¯,j),q¯)0apps(g,q¯) requires both unfoldFix(e¯,j)=(r,g) and isConstructor(r,q¯)=true. Replacing q¯[r] by the neutral Rel(0) makes the Boolean false, so this root rule has no derivation.

The generated vector induction constant places recursion in its fix body. In its cons branch the raw body has the form λm.λx.λxs.apps(s,[m,x,xs,apps(Fix(e¯,j),[m,xs])]). Thus the explicit fix application on xs, not the kernel case branch arity, creates the induction hypothesis.

Exercise 89.7.

The frozen archive gives the following exact witnesses and gaps. Unqualified filenames below are under pcuic/theories/; other paths name their archive roots explicitly.

Confluence. PCUICConfluence.v completes red_confluence.

Subject reduction. PCUICSR.v admits sr_red1; subject_reduction is derived from that admitted environment property.

Validity, strengthening, principality, and normalization. pcuic/theories/PCUICValidity.v admits validity; pcuic/theories/PCUICSafeLemmata.v admits the declaration strengthening at line 1283 of the frozen file; pcuic/theories/PCUICPrincipality.v admits principal_typing; and pcuic/theories/PCUICSN.v declares normalisation as an axiom and admits normalisation’.

Proof irrelevance in graph equality. The comment immediately before graph_eq in template-coq/theories/common/uGraph.v marks its proof-irrelevance step; the lemma identifies canonical graph representations and is consumed by the safe checker.

Safe checker. safechecker/theories/PCUICSafeChecker.v admits check_one_ind_body, add_uctx_make_graph, gc_of_constraints_union, and no_prop_levels_union; it declares graph_eq as an axiom. Its typecheck_program definition has a dependent, squashed typing conclusion, so safe-checker soundness is conditional on this theory base. Checker completeness is separately open: pcuic/theories/PCUICCheckerCompleteness.v contains only its license header and no completeness declaration.

Erasure. erasure/theories/ErasureCorrectness.v proves erases_correct, relative to well-formed typing and weak call-by-value. Consequently canonicity and consistency remain open. The paper’s first-order erasure corollaries are explicitly nonmechanized and therefore occupy a separate status cell. No result from the living MetaRocq checkout changes any of these historical cells.

Search the book

Type to search the local edition.