Lectures onType Theory
ch:coeffects: ch:coeffects
appendix sectionsolutions

ch:coeffects: ch:coeffects

exercise 53.1.

The two accesses require {(?width,int)} and {(?height,int)}; the constant requires empty. The inner addition takes the union of height with empty, and the outer addition unions width with that result. Since RcS=RS=RcS, condition F is reflexivity of subset inclusion.

exercise 53.2.

Take the discrete preorder on {a,u,b} and set use=u. Neither au nor ua holds, so use is neither greatest nor least. Consequently the first step of both pointed substitution proofs is unavailable. This only blocks those proofs; it is not a counterexample to preservation.

exercise 53.3.

The body x+x contracts 1 and 1 to the latent scalar 2. The argument y+y has vector 2. Application scales it to 2×2=4. The two additions occur inside the separate body and argument derivations; multiplication occurs only at application.

exercise 53.4.

Flat call-by-value substitutes an argument at use and retains the receiving scalar. Top-pointed call-by-name first uses suse and has the same conclusion. Bottom-pointed call-by-name concludes at rs and needs equality, commutativity, and idempotence of the three flat operations. Structural substitution replaces the bound variable’s vector cell r by rS; its unique position removes the need for pointedness.

exercise 53.5.

Let ρ(?w)=4, ρ(?h)=7, and take (ρ,(4,7))DRS(int×int). The split image is (ρ|R,4)DR(int) and (ρ|S,7)DS(int). For the separate forgetting square, resR(resRRS(ρ,(4,7)))=((ρ|R)|,(4,7))=(ρ|,(4,7)), because restriction composes by intersection. The path through S is resS(resSRS(ρ,(4,7)))=((ρ|S)|,(4,7))=(ρ|,(4,7)). Hence the square commutes in D(int×int).

exercise 53.6.

The least vector is 3,1: the maximum offsets for x and y are 3 and 1. At time 3, the three reads are ρ(x)1, ρ(y)2, and ρ(x)0, in syntax order.

Search the book

Type to search the local edition.