Lectures onType Theory
ch:pure-type-systems: ch:pure-type-systems
appendix sectionsolutions

ch:pure-type-systems: ch:pure-type-systems

Exercise 60.1.

The outer product has domain : and codomain x:XX: under X:. Its decisive premise is therefore (,,)R. After deleting that triple, generation rules out the outer product and hence the outer Lam. The inner derivation remains: X:X:X:,x:Xx:XVarX:X:X:,x:XX:(,,)RX:x:XX:ProdX:λ(x:X).x:x:XXLam. Thus monomorphic identity needs only (,,).

Exercise 60.2.

The first product needs r2=(,,): its domain is : and its body XX has sort . Its least vertex is λ2.

For the second product, forming the domain kind uses rω=(,,). Under F:, the product over X: and the outer product over F both use r2. Hence its least vertex is λ2ω. Deleting rω leaves the annotation illegal; deleting r2 blocks the product over X.

For the third, the final product over n:Nat uses r, but a legal declaration Vec:n:Nat uses rP=(,,). Accounting for that required declaration, the least vertex is λP. Deleting rP leaves the family declaration illegal, so Vecn cannot be formed. This distinction is why merely postulating an unverified constant type would conceal the decisive axis. In every case, lemma 60.6 transports the displayed derivation to any vertex with a larger product-triple set, proving all upward inclusions without rebuilding its rule tree.

Exercise 60.3.

Assume F:y:ADΓ and ΓN:A. The source application is ΓF:y:ADΓA:sΓ,x:AF:y:ADWeakΓA:sΓ,x:Ax:AVarΓ,x:AFx:D[x/y]App. Substitution with ΓN:A gives Γ(Fx)[N/x]:D[x/y][N/x]. By lemma 60.11, xFV(D): the product type of F is well formed in Γ, while xdom(Γ). Together with xy and the chosen freshness of y, the substitution-composition lemma reduces the two sides to FN and D[N/y]. Equivalently, the target derivation is one App from ΓF:y:AD and ΓN:A.

Exercise 60.4.

Generation gives ΓF:x:AB and ΓN:A. The induction hypothesis for NβN gives ΓN:A, so ΓF:x:ABΓN:AΓFN:B[N/x]App. Compatibility gives B[N/x]βB[N/x], hence B[N/x]=βB[N/x]. The original application derivation contains a typing of F:x:AB. Since that product is not a sort, correctness of types and generation give Γ,x:AB:sB; substitution with ΓN:A gives ΓB[N/x]:sB. With this explicit classifier, Conv derives ΓFN:B[N/x].

Exercise 60.5.

Take constants a,b and S={s0,s1,s2,s3},A={a:s0,b:s1},R={(s0,s1,s2),(s0,s1,s3)}. From a:s0 and b:s1, weakening gives x:ab:s1. The two Prod instances derive x:ab:s2,x:ab:s3. No axiom has the form s:s. In the uniqueness proof, the product case tries to infer equality of result sorts from the fixed pair (s0,s1). Functionality is exactly the premise that would force s2=s3; here it fails, and no beta-step converts the distinct constants.

Exercise 60.6.

Use these three products as axis witnesses: P2=X:X,Pω=X:,PP=x:A(A:). For P2, Ax gives :, Var gives X:X:, and Prod with (,,) gives P2:. For Pω, the two premises have sorts and , so Prod with (,,) gives Pω:. For PP, the premises are A: and x:A:, so Prod with (,,) gives PP:. In each case, generation applied after deleting the named triple recovers premise sorts convertible to the displayed pair. Since every cube vertex is functional, lemma 60.26 forces those premise sorts to be the same pair. No remaining product triple has that pair, so the witness is no longer typable.

Exercise 60.7.

For the redex (λ(x:A0).M0)N, generation yields Γ,x:A0M0:B,Γλ(x:A0).M0:x:CD,ΓN:C, and the generated abstraction product gives x:A0B=βx:CD. Product compatibility yields A0=βC and B=βD. Generation of Γx:A0B:s gives ΓA0:s0, so conversion changes the argument derivation to ΓN:A0; substitution gives ΓM0[N/x]:B[N/x]; compatibility gives B[N/x]=βD[N/x]. Correctness of types for the function premise, followed by generation and substitution with ΓN:C, gives ΓD[N/x]:sD; a final conversion using that classifier restores the application’s generated result type.

If Conv omits its premise ΓB:s, it can replace a legal type by an arbitrary beta-equal raw expression without exhibiting a classifier for the target. The induction above then lacks the sort premise needed by its final conversion and by context extension. The failed presupposition is that every right-hand side of a typing judgment is itself classified.

Exercise 60.8.

Both systems contain the sort and the ordinary-product triple (,,). The one-sort system has the circular axiom :; λC instead has two sorts, the axiom :, and the four cube triples. Substitution is proved by rule induction for every PTS schema, so it applies to both. Strong normalization is the imported instance theorem for the eight cube systems and its reducibility interpretation uses the acyclic sort structure. Membership in the general PTS schema provides no such interpretation for :.

Practical route.

The checker for exercise 60.9 is developed in appendix F; its exact finite run is recorded in appendix E.

Search the book

Type to search the local edition.