Lectures onType Theory
ch:interaction-trees: ch:interaction-trees
appendix sectionsolutions

ch:interaction-trees: ch:interaction-trees

Exercise 86.1.

Two uses of (Bind-Tau) give bind(Tau(Tau(Ret(3))),k)(BindTau)Tau(bind(Tau(Ret(3)),k))(BindTau)Tau(Tau(bind(Ret(3),k)))(BindRet)Tau(Tau(k(3))). All three steps are judgmental bind computations. Two finite applications of Eutt-TauL then give eutt(Tau(Tau(k(3))),k(3)); that last relation is weak equivalence, not judgmental equality.

Exercise 86.2.

Let B(t,u) relate only the pair (bind(spin,k),spin). Unfolding both components once gives bind(spin,k)bind(Tau(spin),k)(BindTau)Tau(bind(spin,k)),spinTau(spin). The two continuations are again in B, so matched-silent coinduction proves strong bisimilarity.

Suppose eutt(spin,Ret(b)). A finite number of Eutt-TauL uses leaves the left observation equal to Tau(spin) again. The right observation is a return. Neither Eutt-Ret, Eutt-Vis, nor Eutt-Tau aligns these forms, and Eutt-TauR cannot apply to a return. Hence no one-layer witness exists. Termination sensitivity is exactly the requirement that asymmetric silent stripping occurs in a finite inductive derivation.

Exercise 86.3.

Let G carry state and output events. Define H(Read):=Vis(Get,Ret),J(Write(n)):=Vis(Emit(n),λu.Ret(u)). Their copair sends inl(Read) to H and inr(Write(n)) to J. For the program that reads and writes its answer, interp([H,J],Vis(inl(Read),λx.Vis(inr(Write(x)),Ret)))Vis(Get,λx.Vis(Emit(x),Ret)). The outer inl selects H before the read continuation receives x; the inner inr selects J after that substitution. Removing the tags would leave no branch-selection datum.

Exercise 86.4.

Use the coinductive relation containing, for each t, (map(g,map(f,t)),map(gf,t)). At t=Ret(a), both sides compute to Ret(g(f(a))). At t=Vis(e,k), the two sides compute to visible nodes with the same e; their continuations are the displayed pair at k(x), so Eutt-Vis applies. At t=Tau(u), both sides compute to one Tau around the displayed pair at u, so Eutt-Tau applies. If the given weak witness first strips a silent node on only one side, restore it with Eutt-TauL or Eutt-TauR. These cases form a post-fixed point, and coinduction proves the fusion equation.

Exercise 86.5.

Use S2(t,v):=u.eutt(t,u)eutt(u,v). Suppose the left witness strips two silent nodes and the right witness strips one before exposing aligned nodes t0,u0,v0. Apply the matching return, visible, or paired-silent generator to t0 and v0; in a visible case, use the coinduction hypothesis pointwise on their continuations. Restore the left constructors by two applications of Eutt-TauL. Restore the right constructor by one application of Eutt-TauR. Thus the outer result lies in EuttF(S2,,). Finiteness of the three restorations is the side condition needed by the nested fixed-point definition.

Exercise 86.6.

Define the write handler D(Write(n)):=Vis(Write(n),λu.Vis(Write(n),Ret)), and let it preserve reads. A source prefix Read;Write(3);Read;Write(5) becomes Read;Write(3);Write(3);Read;Write(5);Write(5). Each doubled pair follows from (Interp-Vis) and two bind computations.

The host equation p:=p has no enclosing Tau and no visible continuation. It therefore supplies no outer observation and violates the guard condition of definition 86.1. The frozen interpreter does not admit it as an interaction tree.

Search the book

Type to search the local edition.