Lectures onType Theory
ch:universes: ch:universes
appendix sectionsolutions

ch:universes: ch:universes

exercise 29.3.

The exercise states the claim for universe-element derivations in an arbitrary well-formed context; this supplies the induction hypothesis beneath binders. For a base universe element 0,1,2,N, replay the same rule at level i+1 and take A=A. The U-Hier case is the same, since j<i implies j<i+1.

For illustration, suppose the last rule is U-Pi. Applying the induction hypotheses to its premises, with context conversion where needed, gives ΓA:Ui+1,ΓAA type,Γ,x:AB:Ui+1,Γ,x:ABB type. In the last judgment, B denotes the original body transported from Γ,x:A to Γ,x:A along the symmetric domain equality. Rule U-Pi at level i+1 constructs x:AB:Ui+1, and dependent-product congruence gives Γx:ABx:AB type. For Σ and W, instantiate the same argument with U-Sig/Lift-Sig and U-W/Lift-W, respectively; the dependent context conversion is unchanged (four lines each). For a coproduct, use the two component induction hypotheses followed by U-Sum and Lift-Sum (two lines). These are all constructors allowed by the exercise, so the induction is complete.

exercise 29.9.

Define externally LiftiiA:=A,Lifti(j+1)A:=Liftj(LiftijA). Induction on ji first gives LiftijA:Uj. Using Lift-El at each successor step and transitivity then gives LiftijAA as types. The same induction proves the universe equality for products. Whenever LiftijB occurs in the lifted binder context, it denotes the universe element first formed in Γ,x:A and then transported to Γ,x:LiftijA along the accumulated type equality. With that convention, the successor step is Lifti(j+1)(x:AB)Liftj(x:LiftijALiftijB)x:Lifti(j+1)ALifti(j+1)B, where the first line uses the induction hypothesis under Lift-Cong and the second uses Lift-Pi. Both sides of this successor step inhabit Uj+1. Renaming the successor target j+1 to the exercise’s target level proves the displayed judgment; the base target i is reflexivity.

exercise 74.16.

For x:a:AiBj(a)c:Ck(x)Dl(x,c) the cumulative rule U-Cumul raises every smaller premise to the chosen classifier. The two products therefore live at max(i,j) and max(k,l), and the outer sum at m=max(i,j,k,l). Thus the least solution is obtained by assigning each fresh result variable the indicated maximum; a strict lift from level r adds the constraint r+1s. Adding Ui:Ui adds the strict formation edge i+1i. Summing edge weights around this one-edge cycle gives 10, so no level assignment exists.

Exercise 29.1.

The final rule is U-Pi at level 1. Its domain and codomain are both the lower universe viewed as an element of U1: X ctxCtxEmp0<1U0:U1UHier0<1X:U0 ctx0<1X:U0U0:U1UHier0<1X:U0U0:U1UPi1. For completeness, the context in the second premise is formed by  ctx ctxU0 typeUForm0X:U0 ctxCtxExt. Equivalently, U-El applied to the first U-Hier premise also recovers U0 type. Thus the universe-specific rules are U-Form at level 0, U-Hier from level 0 to level 1 twice, and U-Pi at level 1.

Exercise 29.2.

Take comp:=λX.λY.λZ.λg.λf.λx.g(f(x)). After introducing X,Y,Z:U0, rule U-El turns each of those universe elements into a type. In the further context g:YZ,f:XY,x:X, two uses of Π-elim give f(x):Y and then g(f(x)):Z. Three inner uses of Π-intro abstract x,f,g; three outer uses abstract Z,Y,X. The formation premises for ordinary arrows use Π-form; the domains X,Y,Z are available as types by U-El, and U0 itself is a type by U-Form. Consequently comp:X:U0Y:U0Z:U0(YZ)(XY)(XZ). No universe eliminator is used; universes have none. Only U-El is needed to let the quantified universe elements serve as ordinary types.

Exercise 29.4.

Assume the first premise of U-Pi, ΓA:Ui. Its own presuppositions include Γ ctx and ΓUi type; the latter is also an instance of U-Form. Applying U-El gives the missing domain formation judgment: ΓA:UiΓA typeUEl. Context extension then gives Γ ctxΓA typeΓ,x:A ctxCtxExt. This is exactly the context required to state the second premise Γ,x:AB:Ui. From that premise, U-El also supplies Γ,x:AB type, so the raw product in the conclusion is well-formed by ordinary Π-formation. Nothing beyond the two displayed universe-element premises and their standard presuppositions is needed.

Exercise 29.8.

Assume ΓA:Ui,Γ,x:AB:Ui. For the left side, U-Pi at level i gives x:AB:Ui, and Lift-U then gives Lifti(x:AB):Ui+1. For the right side, Lift-U first gives LiftiA:Ui+1in Γ,LiftiB:Ui+1in Γ,x:A. Rule Lift-El yields LiftiAA type. Symmetry followed by context conversion transports the second judgment to Γ,x:LiftiALiftiB:Ui+1. Now U-Pi at level i+1 gives x:LiftiALiftiB:Ui+1. Thus both terms compared by Lift-Pi inhabit the stated classifier in the same context. The context conversion justified by Lift-El is the only nonliteral bookkeeping step.

Exercise 29.10.

In context X:U0, the variable judgment X:U0, used twice with U-Pi at level 0, gives x:XX:U0. Rule Lift-U therefore gives X:U0Lift0(x:XX):U1. The outer domain satisfies U0:U1 by U-Hier, so U-Pi at level 1 yields X:U0Lift0(x:XX):U1. In context X:U0, Lift-El gives Lift0(x:XX)x:XX type. Dependent-product congruence with the reflexive equality on the outer domain therefore gives X:U0Lift0(x:XX)X:U0x:XX type. The left-hand type is an element of U1 and is judgmentally equal as a type to the polymorphic-identity type. By convention 29.3, the latter is therefore U1-small.

Exercise 29.11.

To avoid capture, call the predecessor k and the recursively computed universe element R. Define Casesi(Az,x.As,n):=recN(Az,λk.λR.As[k/x],n):Ui. In the step context k:N,R:Ui, the term As[k/x]:Ui is obtained by substitution from the supplied successor branch and then weakened by R. The recursive result is deliberately discarded. Natural-number computation gives equalities at type Ui: Casesi(Az,x.As,0)Az,Casesi(Az,x.As,suc(m))(λk.λR.As[k/x])(m,Casesi(Az,x.As,m))As[m/x]. Applying U-El-Eq to these two term equalities gives exactly Casesi(Az,x.As,0)Az type,Casesi(Az,x.As,suc(m))As[m/x] type. This is case analysis rather than recursive large elimination because the step branch does not use R.

Exercise 29.12.

Define a universe-valued discriminator P:=[λx:A.1,λy:B.0]:A+BU0, using U-Unit and U-Void for the two branch terms. Its constructor computations are P(inl(a))1,P(inr(b))0:U0. Suppose h:inl(a)inr(b):A+B is a derivable judgmental equality. Application congruence gives P(inl(a))P(inr(b)):U0. Composing with the two constructor computations yields 10:U0. Rule U-El-Eq turns this into 10 type. Since :1, conversion gives the closed term :0. Thus a judgmental equality between opposite coproduct injections entails syntactic inconsistency, exactly as Boolean disjointness does.

Exercise 29.13.

Use recursion into U0, with the recursive result itself serving as the tail universe element: Vec:=λA.λn.recN(1,λk.λR.A×R,n):U0NU0. In the step context A:U0,k:N,R:U0, the nondependent product A×R is an element of U0 by U-Sig at level 0. The two natural-number computation rules and Pi-beta give Vec(A,0)1:U0,Vec(A,suc(n))(λk.λR.A×R)(n,Vec(A,n))A×Vec(A,n):U0. By U-El-Eq, the same equations hold as equalities of types.

Exercise 29.14.

Use the dependent motive C(n):=EqN(n,n). At zero, the characteristic equation C(0)1 allows :1 to be converted to a term c0:C(0). For the step, in context k:N,e:C(k), the equation C(suc(k))=EqN(suc(k),suc(k))EqN(k,k)=C(k) allows the unchanged raw term e to be converted to type C(suc(k)). Let e¯k denote that converted occurrence and set r:=λn.indN(k.C(k);c0,λk.λe.e¯k;n):n:NEqN(n,n). At zero, Pi-beta and natural-number computation give r(0)c0:C(0). Converting the classifier along C(0)1 yields the requested judgment r(0):1. At successors the same construction also gives r(suc(k))r(k), with the right-hand term silently converted from C(k) to C(suc(k)).

Exercise 29.15.

Assume h:suc(m)suc(n):N. By the preceding exercise, r(m):EqN(m,m). The successor computation for EqN, used symmetrically, gives EqN(m,m)EqN(suc(m),suc(m))type. Apply congruence to the type-valued function λz.EqN(suc(m),z) and the equality h. This gives EqN(suc(m),suc(m))EqN(suc(m),suc(n))type. A final characteristic computation gives EqN(suc(m),suc(n))EqN(m,n)type. By transitivity, EqN(m,m)EqN(m,n) as types. Converting the closed term r(m) along this equality produces e:=r(m):EqN(m,n), where the displayed definition keeps the raw term and changes only its typing derivation.

Exercise 74.13.

Define G:=λn.recN(N,λk.λR.RN,n):NU0. The step is well-typed because R:U0 and N:U0, so U-Pi at level 0 gives RN:U0. Computation gives G(0)N,G(suc(n))(λk.λR.RN)(n,G(n))G(n)N. Now N:U0, and in context n:N application gives G(n):U0. Hence U-Sig at level 0 yields n:NG(n):U0. Thus the dependent sum is not merely equal to a small type; it is itself a element of U0, and so is U0-small by reflexivity.

Exercise 74.14.

The constraint vu+1 belongs to P: it restricts the external parameters but does not add a lower bound on the unknown m. Splitting the other maximum gives v+2m and um; the latter is dominated by u+1m. Hence the least symbolic choice is m=max(u+1,v+2). For every parameter assignment satisfying P, any solution must dominate both surviving lower bounds, so this solution is principal. The hypothesis of proposition 74.10 used here is precisely the separation between parameter-only constraints in P and constraints with the unknown on their right-hand side.

Search the book

Type to search the local edition.