Lectures onType Theory
ch:type-operators: ch:type-operators
appendix sectionsolutions

ch:type-operators: ch:type-operators

exercise 7.1.

In the context c::TyTy,d::TyTy,a::Ty, write this context as Δ. Every leaf and rule instance is Δc::TyTyKVar,Δd::TyTyKVar,Δa::TyKVar,Δda::TyKApp,Δc(da)::TyKApp. Now apply K-Abs three times. The complete judgment ladder is c,dλa::Ty.c(da)::TyTyKAbs,cλd::TyTy.λa::Ty.c(da)::(TyTy)TyTyKAbs,Comp::(TyTy)(TyTy)TyTyKAbs. The last line discharges the binders in the same order in which they occur in the definition of Comp.

exercise 7.2.

Compatible constructor reduction gives CompPPNβ(λd::TyTy.λa::Ty.P(da))PNβ(λa::Ty.P(Pa))NβP(PN)β(PN)×(PN)β(N×N)×(PN)β(N×N)×(N×N). The last constructor contains no constructor application whose head is a lambda, so it is normal.

exercise 11.3.

Choose vu fresh; it is also fresh for B=N×N. Before substitution, the relevant premise is u::Ty,v::Tyuv::Ty. After applying lemma 7.8, the complete rebuilt tree is Xv::TyN::TyKNatXv::TyN::TyKNatv::TyN×N::TyKProdv::Tyv::Tyv::Tyv::TyKVarv::Ty(N×N)v::TyKArrv::Ty.(N×N)v::TyKAll. The subject is exactly (v::Ty.uv)[(N×N)/u]; freshness prevents capture at the quantifier.

exercise 11.4.

Let A be neutral with every reduct in Redκ1κ2, and let BRedκ1. By (CR1) at κ1, BSN; induct on its reduction height ν(B). Every step from the neutral application AB has one of two forms: ABβABorABβAB. In the first case the hypothesis on A gives ARedκ1κ2, hence ABRedκ2. In the second, (CR2) gives BRedκ1 and ν(B)<ν(B), so the side induction gives the result. A root beta step would require A to be an abstraction, contradicting neutrality. Thus (CR3) at κ2 yields ABRedκ2.

exercise 11.5.

The root contraction and the argument contraction are (λu::κ.A0)B0βA0[B0/u],(λu::κ.A0)B0β(λu::κ.A0)B0. Take A0[B0/u] as the common reduct. The right branch reaches it by one TR-Beta step. The left branch reaches it by lemma 7.17(3), which transports B0βB0 through every occurrence of u in A0, using zero or more compatible steps.

exercise 11.6.

Write paths from the root with L for the left child of an application and ϵ for the root. The deterministic run is ((λc.λa.ca)P)NβatL(λa.Pa)NβatϵPNβatϵN×N. Kind annotations on the two constructor binders are those in the exercise and are unchanged by the calculation. The comparison constructor N×N has no redex, so both inputs normalize to alpha-identical forms. By corollary 7.26, their constructor equality holds.

Exercise 7.3.

In the unannotated rule, the kind assigned to the bound constructor is a choice made by the derivation rather than syntax. Choosing u::Ty gives u::Tyu::Tyu::Tyu::TyKVarλu.u::TyTyKAbs. Choosing instead u::TyTy gives the distinct tree u::TyTyu::TyTyu::TyTyu::TyTyKVarλu.u::(TyTy)(TyTy)KAbs. The subjects of the two conclusions are literally the same unannotated constructor. Their kinds differ, so the Church-style uniqueness proof fails exactly where it formerly read the domain kind from the abstraction annotation.

Exercise 7.4.

The failure occurs immediately in candidate condition CR1. If the base candidate at Ty contains raw constructors having merely one terminating reduction sequence, membership no longer implies strong normalization. Thus the first reducibility-candidate obligation already fails; the fundamental lemma has no valid base candidate to use.

The arrow candidate also exposes the defect through CR3. Its neutral expansion argument reasons about every one-step reduct and uses a subsidiary induction whose measure is supplied by strong normalization. Existence of one terminating branch gives neither the universal premise nor a bound on the other compatible branches.

Let Ω=(λu::Ty.uu)(λu::Ty.uu). The displayed raw constructor is (λx::Ty.N)Ω. Reducing the outer redex first yields N, so it has a terminating path. Compatible reduction may instead reduce inside the argument: ΩΩ. Repeating that step produces an infinite path beneath the unchanged outer application. Weak normalization therefore does not control all compatible-reduction paths.

The example is deliberately ill-kinded: the self-application in Ω cannot be assigned a kind in Fω. This does not make the diagnostic circular. Reducibility is first defined as a predicate on raw constructors; the fundamental lemma later proves that well-kinded constructors inhabit the appropriate candidates. A proposed base predicate must satisfy the candidate conditions on the raw terms to which its definition applies, before kinding selects the terms used by the theorem.

exercise 7.5.

Normalize beneath the two universal binders. The left side becomes a::Ty.b::Ty.(ab)((a×a)×(a×a))((b×b)×(b×b)), whereas the right side becomes a::Ty.b::Ty.(ab)(a×a)(b×b). Both are normal. Their next domains after (ab) have distinct product trees, so they are not alpha-equal. By the common-normal-form decision theorem, the proposed constructor equality does not hold.

Practical route.

The Fω checker of exercise 11.9 is built in appendix F; its normalization oracle and kind-boundary mutation are recorded in appendix E.

Search the book

Type to search the local edition.