exercise 57.1.
In E-Pair, replace the premise counter pair (𝑞 +𝐾𝗉𝖺𝗂𝗋,𝑞) by (𝑞 +𝑎 +𝐾𝗉𝖺𝗂𝗋,𝑞 +𝑎); the heap and freshness premises are unchanged. The cons case is identical. For let, shift the first premise by 𝑎, so its residual counter and the second premise’s initial counter both increase by 𝑎; then shift the second premise by the same amount and rebuild the let rule. The inequality 𝑎 ≥0 keeps every shifted intermediate counter in ℚ≥0.
exercise 57.2.
Since 𝑛2 =𝑛 +2(𝑛2), −3𝑛+3𝑛2=6(𝑛2),14𝑛+14𝑛2=28(𝑛1)+28(𝑛2). All binomial-basis coefficients are nonnegative even though the first monomial expansion has a negative linear coefficient.
exercise 57.3.
Coefficientwise addition gives (𝑝2 +3,0) +(0,𝑝2 +3) =(𝑝2 +3,𝑝2 +3), so the list-sharing rule applies after sharing the element type with itself. The first occurrence carries linear potential and pays the traversal by 𝖺𝗍𝗍𝖺𝖼𝗁 and the copied spine in 𝖺𝗉𝗉𝖾𝗇𝖽. The second retains the degree-two coefficient needed by the recursive call on the tail.
exercise 57.4.
Let 𝑓(𝑥) =𝑓(𝑥). The call 𝑓(0) has no terminating big-step derivation, so the theorem’s evaluation premise cannot be supplied even if a cyclic typing annotation were written. For the heap premise, put Γ =𝑥 :𝐿(1)(𝗂𝗇𝗍),𝑉(𝑥) =ℓ, and leave ℓ outside the domain of 𝐻. Following the list clause of Φ𝑉,𝐻 then requires 𝐻(ℓ), which is undefined.
exercise 57.5.
On an input of length 𝑛 +1, 𝖺𝗍𝗍𝖺𝖼𝗁 allocates 𝑛 pairs and 𝑛 result cons cells, and 𝖺𝗉𝗉𝖾𝗇𝖽 copies 𝑛 cons cells. Thus 𝑃(0) =0 and 𝑃(𝑛 +1) =𝑃(𝑛) +3𝑛. Summing gives 𝑃(𝑛) =3∑𝑖<𝑛𝑖 =3(𝑛2). The local type bound is exact. The printed analyzer output is 6(𝑛2), twice as large, and is still safe.
exercise 57.6.
For zero-potential payloads, a root with two leaf children has potential 𝑝1+2(𝖢⃗𝑝)1=𝑝1+2(𝑝1+𝑝2). A full tree of height ℎ satisfies 𝑇(0,⃗𝑝) =0 and 𝑇(ℎ +1,⃗𝑝) =𝑝1 +2𝑇(ℎ,𝖢⃗𝑝). The recurrence depends on every node having exactly two children and therefore does not reduce an arbitrary tree to height alone.
exercise 58.1.
Treat a natural number as a channel protocol 𝖭𝖺𝗍. The provider type is 𝖭𝖺𝗍⊸((𝖭𝖺𝗍⊗𝟏)⊕𝟏). The provider receives the request, selects quote or refusal, and in the quote branch sends the result channel before becoming inactive; the client sends, branches on the provider’s label, receives in the quote branch, and likewise becomes inactive. Type 𝟏 adds no close/wait communication in the selected pi calculus.
exercise 58.2.
Create sessions 𝑥 and 𝑦. Let the left process receive first on 𝑥 and then send on 𝑦, while the right process receives first on 𝑦 and then sends on 𝑥. Each endpoint can follow its local protocol, but both leading actions are inputs. Preservation has no premise that creates a redex. Such an independently composed cycle is not a closed proof term ⋅; ⋅ ⊢𝑃 ::𝑧 :𝟏 of the selected single-conclusion calculus, so it cannot instantiate the closed-progress theorem.
exercise 58.3.
One server protocol is 𝑆=𝜇𝑡.((𝖭𝖺𝗍⊸(𝖭𝖺𝗍⊗𝑡))&𝟏). The client dual exchanges & with ⊕ and ⊸ with ⊗, while 𝟏 remains 𝟏. Unfolding once substitutes 𝑆 for 𝑡; unfolding the dual substitutes ――𝑆 for its recursive variable. Both expose matching opposite choice and communication constructors, so the coinductive duality clause continues beneath the same guard. The only transmitted session type is the closed 𝖭𝖺𝗍, so this example satisfies the chapter’s tail-recursion restriction.
exercise 58.4.
For SingleAction, use a promoted body with two visible session actions; duplicating it makes the shared endpoint’s one-action interface ambiguous. For ReceivePrefix, put a send before the repeated receive; clients wait for the replicated input while the body waits on an unallocated output. For Sends, use a multicast body whose leading action is receive; the advertised recipient buffers have no messages. Each counterexample removes only the syntactic premise that connects allocation to the next operational action.
exercise 58.5.
Invert the provider’s ⊗R premise into Γ;Δ1 ⊢𝑃 ::𝑦 :𝐴 and Γ;Δ2 ⊢𝑄 ::𝑥 :𝐵. Invert the client’s ⊗L premise into Γ;Δ3,𝑦 :𝐴,𝑥 :𝐵 ⊢𝑅 ::𝑧 :𝐶. Cut first at the strict subformula 𝑦 :𝐴, obtaining Γ;Δ1,Δ3,𝑥 :𝐵 ⊢(𝜈𝑦)(𝑃 ∣𝑅) ::𝑧 :𝐶. Cut that result against 𝑄 at the strict subformula 𝑥 :𝐵. The union Δ1,Δ2,Δ3 is the original external linear context, and the resulting process is the displayed tensor reduct up to reassociation.
exercise 58.6.
Take 𝜋.𝑄 =𝑥.𝗂𝗇𝗅;𝑃. This is a nonreplicated guarded selection, so the restricted parallel process has the required (𝜈̃𝑛)(𝜋.𝑄 ∣𝑅) form. The matching branch guard is likewise nonreplicated. Neither is an input/output prefix. An input/output-only definition would therefore declare the state non-live immediately before its principal choice contraction, preventing the closed-progress theorem from supplying that contraction.
exercise 58.7.
Unfolding gives 𝑆 ≃𝟏 ⊸𝑆, so T-Rec-Conv exposes a receive before the finite ⊸R or ⊸L rule is inverted. The auxiliary endpoint view is ――𝑆 =𝜇𝑡.(𝟏 ⊗𝑡), whose unfolding is 𝟏 ⊗――𝑆. The carried type 𝟏 is closed and the recursive occurrence lies in the continuation; hence the tail-recursion condition holds.
exercise 59.1.
For projectability, let 𝑝 choose whether 𝑟 sends a Boolean or an integer to 𝑠 without informing 𝑟; the projections at 𝑟 disagree. For linearity, let independent 𝑝 and 𝑟 send differently typed values to 𝑞 on the same address; either value may reach the head first. For unstuckness, use 𝑝→𝑞:𝑘1{ℓ1:𝑞→𝑟:𝑘2⟨𝖡𝗈𝗈𝗅⟩.𝖾𝗇𝖽,ℓ2:𝑝→𝑟:𝑘2⟨𝖡𝗈𝗈𝗅⟩.𝖾𝗇𝖽}. The relaxed barb relation sees the 𝑝-to-𝑟 action in the second branch, but the true rule cannot move it beneath the choice because the first branch has no action with that label. The first example fails full projection, the second has no dependency chain ordering the sends, and the third has a relaxed barb without a matching global transition. A wrong sender at a concrete queue head is instead rejected by queue typing and coherent decomposition.
exercise 59.2.
Choose a fresh address 𝑘5. In both bank continuations, append 𝐵 →𝐾 :𝑘5⟨𝖠𝖽𝖽𝗋𝖾𝗌𝗌⟩.𝖾𝗇𝖽 after the 𝖽𝗈𝗇𝖾 notification. The projection at 𝐵 continues with !𝑘5⟨𝖠𝖽𝖽𝗋𝖾𝗌𝗌⟩.𝖾𝗇𝖽, and the projection at 𝐾 receives the address in either branch. The projection at 𝑆 skips the receipt action. After the final 𝑘3-receive, the trace appends (𝖺𝖽𝖽𝗋𝖾𝗌𝗌𝐵)𝑘5 and consumes it. Extending only the 𝗈𝗄 branch would give 𝐵 unequal branch projections, so (Plain-Branch) would be undefined.
exercise 59.3.
Let 𝐴 evaluate a Boolean and select yes/no to 𝐵. In the first branch 𝐵 sends 1 to 𝐶; in the second it sends 0. Projection gives 𝐴 the conditional and the selection, 𝐵 an offer whose continuations send the two distinct expressions, and 𝐶 a receive in both branches. Deleting the selection leaves 𝐵 uninformed. Its two branch projections contain sends with unequal local expressions, so their partial merge is undefined; the two receive projections at 𝐶 retain the same control shape and merge.
exercise 59.4.
At 𝐵 →𝑆 :𝑘1, projection gives output to 𝐵, input to 𝑆, and the continuation to 𝐾. The 𝑆 →𝐾 :𝑘2 action is analogous. At the bank choice on 𝑘4, 𝐾 selects and 𝑆 offers. Role 𝐵 is uninvolved, and both continuations project to the literal same local type 𝑘3&{𝖽𝗈𝗇𝖾 :𝖾𝗇𝖽}; hence Plain-Branch applies. The resulting types are exactly (𝑇𝐵,𝑇𝑆,𝑇𝐾) printed in the chapter. Every address occurs in one global action, so there is no pair of same-address actions to which the linearity implication applies; that condition is independently true, vacuously.
exercise 59.5.
The initial queues are empty. A send row appends the item named by the sender’s outer local action to its unique empty address and advances only that sender. The following receive row checks the same sender, payload or label, and address at the head, removes it, and advances only the receiver. Thus the invariant alternates between one prescribed singleton queue and four empty queues through all four interaction pairs. If 𝑘2 =𝑘4, the debit and bank label share a queue; the proof can no longer infer from the address alone that the current singleton is the item prescribed by the receiver’s outer action. The separate dependency proof required by linearity would then be needed.
exercise 59.6.
MPST assumes a coherent runtime witness—projectability, linearity, and unstuckness—and concludes preservation of a process/session/queue typing with either an unchanged or globally advanced witness. Pirouette instead assumes a location-coverage condition and defined endpoint projection, and concludes existence of a choreography step whose re-projection is below the stepped control system in ≤𝗇𝖽. MPST has asynchronous typed queues but no choreography term; Pirouette has a synchronous source program and partial merge but no MPST coherence witness. Their premises and reducts therefore inhabit different judgments, so neither theorem instantiates the other.