Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
A polynomial-time characterization says how expensive every representable program can be. It does not say how many cells one invocation of pairs allocates as a function of its input length. For that problem the bound must mention the input, and the proof must follow the program.
Consider 𝖺𝗍𝗍𝖺𝖼𝗁(𝑥,𝑙)=𝗆𝖺𝗍𝖼𝗁 𝑙 𝗐𝗂𝗍𝗁 []↦[]∣𝑦::𝑦𝑠↦(𝑥,𝑦)::𝖺𝗍𝗍𝖺𝖼𝗁(𝑥,𝑦𝑠),𝗉𝖺𝗂𝗋𝗌(𝑙)=𝗆𝖺𝗍𝖼𝗁 𝑙 𝗐𝗂𝗍𝗁 []↦[]∣𝑥::𝑥𝑠↦𝖺𝗉𝗉𝖾𝗇𝖽(𝖺𝗍𝗍𝖺𝖼𝗁(𝑥,𝑥𝑠),𝗉𝖺𝗂𝗋𝗌(𝑥𝑠)). If a pair cell and a cons cell each cost one unit, then 𝖺𝗍𝗍𝖺𝖼𝗁(𝑥,𝑙) consumes two units per element. The call 𝗉𝖺𝗂𝗋𝗌(𝑥 ::𝑥𝑠) also copies the list returned by 𝖺𝗍𝗍𝖺𝖼𝗁(𝑥,𝑥𝑠). A linear annotation on the original list cannot pay this linear cost once for every suffix. The missing quantity is potential: stored credit indexed by suffix length.
The fixed RAML calculus
The chapter uses the first-order call-by-value language of Hoffmann and Hofmann [HH10]. Expressions are in let normal form: 𝑒::=()∣𝑏∣𝑛∣𝑥∣𝑥1𝗈𝗉𝑥2∣𝑓(𝑥1,…,𝑥𝑘)∣𝗅𝖾𝗍 𝑥=𝑒1 𝗂𝗇 𝑒2∣𝗂𝖿 𝑥 𝗍𝗁𝖾𝗇 𝑒𝑡 𝖾𝗅𝗌𝖾 𝑒𝑓∣(𝑥1,𝑥2)∣𝗆𝖺𝗍𝖼𝗁 𝑥 𝗐𝗂𝗍𝗁 (𝑥1,𝑥2)↦𝑒∣[]∣𝖼𝗈𝗇𝗌(𝑥ℎ,𝑥𝑡)∣𝗆𝖺𝗍𝖼𝗁 𝑥 𝗐𝗂𝗍𝗁 []↦𝑒0∣𝑥ℎ::𝑥𝑡↦𝑒1. Here 𝑏 ∈{𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾}, 𝑛 ∈ℤ, and every ground operation has constant cost. Zero-order types and first-order signatures have the forms 𝐴::=𝗎𝗇𝗂𝗍∣𝖻𝗈𝗈𝗅∣𝗂𝗇𝗍∣𝐿(𝐴)∣(𝐴,𝐴),𝐹::=(𝐴1,…,𝐴𝑘)→𝐴. A finite context is affine. Its disjoint union Γ1,Γ2 is defined only when the domains are disjoint. Contraction is therefore an explicit sharing rule rather than an implicit property of contexts.
Let 𝐻 be a finite heap from locations to values and let 𝑉 be a finite stack from variables to values. The resource judgment 𝑉,𝐻⊢𝑞𝑞′𝑒⇓𝑣,𝐻′ means that evaluation starts with 𝑞 ∈ℚ≥0, never makes the counter negative, returns 𝑣,𝐻′, and leaves 𝑞′ ∈ℚ≥0. Its consumption is 𝑞 −𝑞′. The relation is terminating big-step evaluation: divergence has no derivation.
The rules are parameterized by constants 𝐾𝖼𝑖. The superscript names a construct and the subscript separates the before- and after-costs of a compound rule. This chapter fixes the heap-cell metric 𝐾𝗉𝖺𝗂𝗋=𝐾𝖼𝗈𝗇𝗌=1,𝐾𝖼𝑖=0for every other construct and index. Thus allocation, not evaluation steps or reclaimed space, is counted. The pair and cons rules are 𝑉(𝑥1)=𝑣1𝑉(𝑥2)=𝑣2𝑙∉dom(𝐻)𝑉,𝐻⊢𝑞+𝐾𝗉𝖺𝗂𝗋𝑞(𝑥1,𝑥2)⇓𝑙,𝐻[𝑙↦(𝑣1,𝑣2)]E−Pair 𝑉(𝑥ℎ)=𝑣ℎ𝑉(𝑥𝑡)=𝑣𝑡𝑙∉dom(𝐻)𝑉,𝐻⊢𝑞+𝐾𝖼𝗈𝗇𝗌𝑞𝖼𝗈𝗇𝗌(𝑥ℎ,𝑥𝑡)⇓𝑙,𝐻[𝑙↦(𝑣ℎ,𝑣𝑡)]E−Cons The two compound rules used below are 𝑉,𝐻⊢𝑞1−𝐾𝗅𝖾𝗍1𝑞2𝑒1⇓𝑣1,𝐻1𝑉[𝑥↦𝑣1],𝐻1⊢𝑞2−𝐾𝗅𝖾𝗍2𝑞3+𝐾𝗅𝖾𝗍3𝑒2⇓𝑣2,𝐻2𝑉,𝐻⊢𝑞1𝑞3𝗅𝖾𝗍 𝑥=𝑒1 𝗂𝗇 𝑒2⇓𝑣2,𝐻2E−Let and, when Σ(𝑓) =(𝐴1,…,𝐴𝑘)𝑞/𝑞′←←←←←←←→𝐴, the function body is 𝑒𝑓 with formal parameters 𝑦𝑓1,…,𝑦𝑓𝑘, and 𝑉(𝑥𝑖) =𝑣𝑖, [𝑦𝑓1↦𝑣1,…,𝑦𝑓𝑘↦𝑣𝑘],𝐻⊢𝑢−𝐾𝖺𝗉𝗉1𝑢′+𝐾𝖺𝗉𝗉2𝑒𝑓⇓𝑣,𝐻′𝑉,𝐻⊢𝑢𝑢′𝑓(𝑥1,…,𝑥𝑘)⇓𝑣,𝐻′E−FunApp. Every rule is invariant under adding the same 𝑎 ≥0 to its two counters. This counter-shift property is needed in the let and function-call cases of soundness.
★☆☆ Prove counter shift for the two allocation rules and a two-premise let rule. State where the inequality 𝑎 ≥0 is used.
Referenced from 3 locations
Binomial potential
A list annotation is a nonempty vector ⃗𝑝 =(𝑝1,…,𝑝𝑑) ∈ℚ𝑑≥0. Define 𝜑(𝑛,⃗𝑝):=𝑑∑𝑖=1𝑝𝑖(𝑛𝑖),𝖢(𝑝1,…,𝑝𝑑):=(𝑝1+𝑝2,…,𝑝𝑑−1+𝑝𝑑,𝑝𝑑). The degree 𝑑 is fixed while constraints are generated. The coefficients are nonnegative in this basis; their expansion in the monomial basis may have negative coefficients.
For every 𝑛 ∈ℕ and annotation ⃗𝑝, 𝜑(𝑛+1,⃗𝑝)=𝑝1+𝜑(𝑛,𝖢(⃗𝑝)).
Referenced from 4 locations
Proof of Lemma 57.1 — Head–tail identity
Proof. Pascal’s identity places its reason on the decisive equality: 𝜑(𝑛+1,⃗𝑝)=𝑑∑𝑖=1𝑝𝑖(𝑛+1𝑖)Pascal=𝑑∑𝑖=1𝑝𝑖(𝑛𝑖)+𝑑∑𝑖=1𝑝𝑖(𝑛𝑖−1)=𝑝1+𝑑−1∑𝑖=1(𝑝𝑖+𝑝𝑖+1)(𝑛𝑖)+𝑝𝑑(𝑛𝑑)(57.2)=𝑝1+𝜑(𝑛,𝖢(⃗𝑝)). ◻
The resource-annotated types are 𝐴::=𝗎𝗇𝗂𝗍∣𝖻𝗈𝗈𝗅∣𝗂𝗇𝗍∣𝐿⃗𝑝(𝐴)∣(𝐴1,𝐴2). If a heap value 𝑣 matches 𝐴, its potential Φ𝐻(𝑣 :𝐴) is defined by Φ𝐻(𝑣:𝐶)=0(𝐶∈{𝗎𝗇𝗂𝗍,𝖻𝗈𝗈𝗅,𝗂𝗇𝗍}),Φ𝐻((𝑣1,𝑣2):(𝐴1,𝐴2))=Φ𝐻(𝑣1:𝐴1)+Φ𝐻(𝑣2:𝐴2),Φ𝐻(𝖭𝗎𝗅𝗅:𝐿⃗𝑝(𝐴))=0,Φ𝐻(𝑙:𝐿⃗𝑝(𝐴))=𝑝1+Φ𝐻(𝑣:𝐴)+Φ𝐻(𝑙′:𝐿𝖢(⃗𝑝)(𝐴)) when 𝐻(𝑙) =(𝑣,𝑙′). Repeated use of lemma 57.1 gives 𝐻(𝑙)=[𝑣1,…,𝑣𝑛]⟹Φ𝐻(𝑙:𝐿⃗𝑝(𝐴))=𝜑(𝑛,⃗𝑝)+𝑛∑𝑖=1Φ𝐻(𝑣𝑖:𝐴). For a context, Φ𝑉,𝐻(Γ):=∑𝑥∈dom(Γ)Φ𝐻(𝑉(𝑥) :Γ(𝑥)).
The source also extends the same mechanism to fixed-arity trees. The empty tree has zero potential. For a 𝑘-ary node 𝑙 with payload 𝑣 and children 𝑙1,…,𝑙𝑘, Φ𝐻(𝖭𝗎𝗅𝗅:𝑇⃗𝑝(𝐴))=0,Φ𝐻(𝑙:𝑇⃗𝑝(𝐴))=𝑝1+Φ𝐻(𝑣:𝐴)+𝑘∑𝑖=1Φ𝐻(𝑙𝑖:𝑇𝖢(⃗𝑝)(𝐴)). This clause defines annotated-tree potential; no theorem in this chapter assumes that tree size is determined solely by height.
★☆☆ Convert −3𝑛 +3𝑛2 and 14𝑛 +14𝑛2 to nonnegative linear combinations of (𝑛1) and (𝑛2).
Referenced from 3 locations
Sharing, weakening, and the typing invariant
Write 𝐴 <:𝐵 when the two types have the same shape and 𝐴 carries at least the potential of 𝐵. The list clause is 𝐿⃗𝑝(𝐴)<:𝐿⃗𝑞(𝐵)⟺𝐴<:𝐵 and ⃗𝑝≥⃗𝑞. The sharing relation 𝗌𝗁𝖺𝗋𝖾(𝐴;𝐴1,𝐴2) splits one value’s potential between two occurrences: 𝗌𝗁𝖺𝗋𝖾(𝐶;𝐶,𝐶)(𝐶∈{𝗎𝗇𝗂𝗍,𝖻𝗈𝗈𝗅,𝗂𝗇𝗍}),𝗌𝗁𝖺𝗋𝖾(𝐴;𝐴1,𝐴2)⃗𝑝=⃗𝑞+⃗𝑟𝗌𝗁𝖺𝗋𝖾(𝐿⃗𝑝(𝐴);𝐿⃗𝑞(𝐴1),𝐿⃗𝑟(𝐴2)),𝗌𝗁𝖺𝗋𝖾(𝐴;𝐴1,𝐴2)𝗌𝗁𝖺𝗋𝖾(𝐵;𝐵1,𝐵2)𝗌𝗁𝖺𝗋𝖾((𝐴,𝐵);(𝐴1,𝐵1),(𝐴2,𝐵2)).
If 𝗌𝗁𝖺𝗋𝖾(𝐴;𝐴1,𝐴2), then every matching 𝑣,𝐻 satisfies Φ𝐻(𝑣:𝐴)=Φ𝐻(𝑣:𝐴1)+Φ𝐻(𝑣:𝐴2). If 𝐴 <:𝐵, then Φ𝐻(𝑣 :𝐴) ≥Φ𝐻(𝑣 :𝐵).
Referenced from 4 locations
Proof of Lemma 57.2 — Potential splits and weakens
Proof. Proceed by induction on the displayed sharing or subtype derivation. In the list-sharing case, the payload equality comes from the induction hypothesis, the head coefficient splits because ⃗𝑝 =⃗𝑞 +⃗𝑟, and the tail coefficients split because 𝖢 is linear. Equation (57.3) then gives the required equality. In the list-subtype case, coefficientwise order implies 𝜑(𝑛,⃗𝑝) ≥𝜑(𝑛,⃗𝑞); the element-type induction hypothesis gives the remaining summands in (57.4). Ground and product cases follow directly from (57.3). ◻
The annotated signature assigns (𝐴1,…,𝐴𝑘)𝑞/𝑞′←←←←←←←→𝐴 to each function. The judgment Σ;Γ⊢𝑞𝑞′𝑒:𝐴 means that input potential plus 𝑞 pays evaluation while output potential plus 𝑞′ remains. Four rules show where the invariant performs work: ⃗𝑝=(𝑝1,…,𝑝𝑑)Σ;𝑥ℎ:𝐴,𝑥𝑡:𝐿𝖢(⃗𝑝)(𝐴)⊢𝑝1+𝐾𝖼𝗈𝗇𝗌0𝖼𝗈𝗇𝗌(𝑥ℎ,𝑥𝑡):𝐿⃗𝑝(𝐴)T−Cons Σ;Γ1⊢𝑞−𝐾𝗅𝖾𝗍1𝑝𝑒1:𝐴Σ;Γ2,𝑥:𝐴⊢𝑝−𝐾𝗅𝖾𝗍2𝑞′+𝐾𝗅𝖾𝗍3𝑒2:𝐵Σ;Γ1,Γ2⊢𝑞𝑞′𝗅𝖾𝗍 𝑥=𝑒1 𝗂𝗇 𝑒2:𝐵T−Let Σ;Γ,𝑥:𝐴1,𝑦:𝐴2⊢𝑞𝑞′𝑒:𝐵𝗌𝗁𝖺𝗋𝖾(𝐴;𝐴1,𝐴2)Σ;Γ,𝑧:𝐴⊢𝑞𝑞′𝑒[𝑧/𝑥,𝑧/𝑦]:𝐵T−Share Σ;Γ⊢𝑞𝑞′𝑒:𝐵𝑥∉dom(Γ)Σ;Γ,𝑥:𝐴⊢𝑞𝑞′𝑒:𝐵T−Weak The paper calls the last rule T-Augment; it is the affine weakening rule. The remaining rules used by name below are Σ(𝑓)=(𝐴1,…,𝐴𝑘)𝑞/𝑞′←←←←←←←→𝐴Σ;𝑥1:𝐴1,…,𝑥𝑘:𝐴𝑘⊢𝑞+𝐾𝖺𝗉𝗉1𝑞′−𝐾𝖺𝗉𝗉2𝑓(𝑥1,…,𝑥𝑘):𝐴T−FunApp 𝐴 𝗍𝗒𝗉𝖾Σ;∅⊢𝐾𝗇𝗂𝗅0[]:𝐿⃗0(𝐴)T−Nil Σ;Γ,𝑥:𝐴⊢𝑞𝑞′𝑒:𝐵𝐴0<:𝐴Σ;Γ,𝑥:𝐴0⊢𝑞𝑞′𝑒:𝐵T−Supertype Σ;Γ⊢𝑞𝑞′𝑒:𝐵𝐵<:𝐵0Σ;Γ⊢𝑞𝑞′𝑒:𝐵0T−Subtype Σ;Γ⊢𝑝𝑝′𝑒:𝐵𝑞≥𝑝𝑞−𝑝≥𝑞′−𝑝′Σ;Γ⊢𝑞𝑞′𝑒:𝐵T−Relax. The list match has two premises. The nil branch receives no list potential. The cons branch binds 𝑥ℎ :𝐴 and 𝑥𝑡 :𝐿𝖢(⃗𝑝)(𝐴), and its available constant increases by 𝑝1. This is the inverse use of T-Cons forced by lemma 57.1.
★★☆ Let 𝑝2 ≥0 denote the coefficient carried by each output-list cell. In the cons branch of 𝗉𝖺𝗂𝗋𝗌, show the split 𝗌𝗁𝖺𝗋𝖾(𝐿(𝑝2+3,𝑝2+3)(𝗂𝗇𝗍);𝐿(𝑝2+3,0)(𝗂𝗇𝗍),𝐿(0,𝑝2+3)(𝗂𝗇𝗍)). Identify which occurrence pays 𝖺𝗍𝗍𝖺𝖼𝗁 and which pays the recursive call.
Referenced from 3 locations
Resource soundness
Write 𝐻 ⊧𝑉 :Γ when 𝑉(𝑥) is a value matching Γ(𝑥) in 𝐻 for every 𝑥 ∈dom(Γ).
Let Σ be the annotated signature of a RAML program, and let 𝑒 be an expression. Suppose 𝐻 ⊧𝑉 :Γ and some 𝑢,𝑢′ ∈ℚ≥0 satisfy 𝑉,𝐻⊢𝑢𝑢′𝑒⇓𝑣,𝐻′. If Σ;Γ⊢𝑝𝑝′𝑒:𝐴,𝑟∈ℚ≥0,𝑞≥Φ𝑉,𝐻(Γ)+𝑝+𝑟, then some 𝑞′ ∈ℚ≥0 satisfies 𝑉,𝐻⊢𝑞𝑞′𝑒⇓𝑣,𝐻′,𝑞′≥Φ𝐻′(𝑣:𝐴)+𝑝′+𝑟.
Referenced from 5 locations
Proof of Theorem 57.3 — Hoffmann–Hofmann soundness
Proof. The proof is simultaneous induction on the typing derivation and its fixed terminating evaluation. Strengthen the induction statement by retaining the arbitrary slack 𝑟; without this strengthening, the intermediate resource left by a let cannot be passed to its second premise.
Constructors. For T-Cons, the input potential is Φ𝐻(𝑉(𝑥ℎ) :𝐴) +Φ𝐻(𝑉(𝑥𝑡) :𝐿𝖢(⃗𝑝)(𝐴)). After paying 𝐾𝖼𝗈𝗇𝗌 and 𝑝1, equation (57.3) gives exactly the output potential. The pair case uses additivity of product potential and pays 𝐾𝗉𝖺𝗂𝗋.
List elimination. If the scrutinee is null, the nil premise has the required resource because its potential is zero. If the scrutinee is a cons location, opening (57.3) yields 𝑝1, the head potential, and the shifted tail potential. These are precisely the constant and context required by the cons premise. Applying the induction hypothesis to that premise gives the claimed postcondition.
Let. The first evaluation premise and first typing premise give an intermediate counter at least Φ𝐻1(𝑣1 :𝐴) +𝑝 +Φ𝑉,𝐻(Γ2) +𝑟; disjointness of Γ1 and Γ2 justifies the context split. Use that amount as the precondition for the second induction hypothesis. Its conclusion is the required bound for 𝑣,𝐻′. Counter shift aligns the concrete intermediate counters without changing consumption.
Function application. Let Σ(𝑓) =(𝐴1,…,𝐴𝑘)𝑝/𝑝′←←←←←←←←→𝐴, and let 𝑉(𝑥𝑖) =𝑣𝑖. Program well-formedness supplies the body derivation Σ;𝑦𝑓1 :𝐴1,…,𝑦𝑓𝑘 :𝐴𝑘 ⊢𝑝𝑝′𝑒𝑓 :𝐴. From the caller precondition and T-FunApp, remove 𝐾𝖺𝗉𝗉1; the remainder is at least the formal environment’s potential plus 𝑝 +𝑟. Apply the induction hypothesis to the premise of E-FunApp. It leaves at least output potential plus 𝑝′ +𝑟; restoring 𝐾𝖺𝗉𝗉2 gives the caller’s residual annotation 𝑝′ −𝐾𝖺𝗉𝗉2. Counter shift supplies the exact concrete counters if either inequality is strict. Thus this case uses both signature well-formedness and the sign reversal between T-FunApp and E-FunApp.
Sharing and weakening. For T-Share, lemma 57.2 replaces the single potential of 𝑧 :𝐴 by the sum needed for 𝑥 :𝐴1,𝑦 :𝐴2; substitution in the stack and expression preserves the evaluation. For T-Weak, the extra nonnegative potential is added to slack because 𝑥 is absent from the expression.
Order rules. Input supertype uses the inequality half of lemma 57.2; output subtype uses it in the opposite position. T-Relax uses its two numerical premises 𝑞 ≥𝑝 and 𝑞 −𝑝 ≥𝑞′ −𝑝′ to increase the initial allowance without reducing the promised remainder.
Remaining syntax. Constants, variables, and ground operations apply their corresponding evaluation rule and its fixed 𝐾-constants. A conditional selects the typing premise matching 𝑉(𝑥). Product elimination opens the two summands in product potential. T-Nil uses zero output potential. These cases exhaust the expression grammar and preserve the same slack 𝑟. ◻
The termination premise is substantive: the theorem bounds every terminating evaluation but does not prove that one exists. Nonnegative slack is also substantive; allowing 𝑟 <0 would weaken the initial premise while retaining the same postcondition. Well-formedness is structural data required to define every potential in the statement.
★★☆ Give a divergent recursive RAML definition for which the theorem has no applicable evaluation premise. Then show that deleting 𝐻 ⊧𝑉 :Γ can make Φ𝑉,𝐻(Γ) undefined.
Referenced from 3 locations
From a derivation to linear constraints
Assign a fresh nonnegative rational variable to every coefficient and every constant annotation in a syntax-directed derivation. T-Cons generates 𝑞 =𝑝1 +1 under (57.1); list matching generates the shift equations; sharing generates coefficientwise addition; subtyping and relaxation generate inequalities. Every constraint is linear because 𝖢 and sharing are linear in the coefficients.
For 𝗉𝖺𝗂𝗋𝗌, choose output annotation (1) and zero constant annotations 𝑝 =𝑝′ =0. At a cons branch, introduce fresh input coefficients 𝑎1,𝑎2, split the shifted tail, and impose 𝑎1=0,𝑎2=4,𝖢(𝑎1,𝑎2)=(4,4)=(4,0)+(0,4). The first component pays the three allocations per attached element plus the one unit retained in the output; the second is the recursive input. Nil, sharing, and output subtyping add only nonnegativity and coefficientwise-order constraints. Thus the source derivation admits input annotation (0,4). Instantiating theorem 57.3 with 𝑟 =0 bounds consumption by input potential minus result potential: 𝖺𝗅𝗅𝗈𝖼𝗉𝖺𝗂𝗋𝗌(𝑛)≤4(𝑛2)−(𝑛2)=3(𝑛2). The RAML prototype table prints the safe monomial bound −3𝑛 +3𝑛2 =6(𝑛2). It is a distinct, looser analyzer output; it does not replace the local bound in (57.7).
The extended report prints a bound for 𝗌𝗍𝖺𝗋𝗍𝖡𝗋𝖾𝖺𝖽𝗍𝗁, but not its source program: it says that implementation was available on the then-current RAML website. The companion therefore checks a stated reconstruction, not that unavailable implementation. A compact node (𝑎,𝑏,𝑙1,𝑙2) represents one pair of suffix positions: 𝑎,𝑏 are their heads and 𝑙1,𝑙2 their remaining suffixes. Its two child clauses advance the left suffix, or advance both suffixes. Starting from a list of length 𝑛, this yields 𝑁(𝑛) =1 +2 +⋯ +𝑛 =𝑛(𝑛 +1)/2 visited nodes. A two-list queue stores those nodes; dequeue reverses its input list only when the output list is empty.
The explicit chapter reconstruction charges twelve named constructor sites per visited node, two per reversal, and two at initialization. For 𝑛 >0 its selected input has 𝑅(𝑛) =𝑛 reversals, so 𝐵(0)=0,𝐵(𝑛)=12𝑁(𝑛)+2𝑅(𝑛)+2=6𝑛2+8𝑛+2. The artifact emits one event carrying one of those site names; this equation counts that trace and is not an inferred RAML typing. The paper’s displayed heap bound is 14𝑛+14𝑛2=28(𝑛1)+28(𝑛2), which dominates 𝐵(𝑛) for every 𝑛 ≥0. This comparison is only between the report’s bound and the reconstruction’s trace; it does not establish that the two programs coincide. The evaluation-step bounds 3 +7𝑛 +9𝑛2 and 17 +45𝑛 +45𝑛2 use a different cost assignment and are not oracles for the heap-cell artifact.
RAML 1.5 is an implementation and experiment source, not the theorem proved in theorem 57.3. In particular, the declarative rules do not prove inference completeness, asymptotic tightness, or machine independence.
Chapter seminar
None of these problems is a prerequisite for a later chapter.
Suggested first pass.
Do exercise 57.5 before the implementation problem exercise 57.7.
★★☆ Derive the recurrence for the exact heap allocation of 𝗉𝖺𝗂𝗋𝗌, solve it as 3(𝑛2), and compare it with both bounds in section 57.5.
Referenced from 4 locations
★★☆ Use height zero for the empty tree and height one for a single node. For a full binary tree of height ℎ, with zero-potential payloads, unfold (57.5) through height two. State the recurrence for general ℎ without claiming that it applies to non-full trees.
Referenced from 3 locations
★★★ Practical project.aara-heap-trace-checker Implement the fixed heap-cell trace checker in Kappa. For 𝗉𝖺𝗂𝗋𝗌, maintain the invariant that every recorded unit is emitted by one pair or cons constructor in the reconstruction. For 𝗌𝗍𝖺𝗋𝗍𝖡𝗋𝖾𝖺𝖽𝗍𝗁, maintain the narrower invariant that every event names one site in the explicit accounting schedule preceding (57.8); do not claim correspondence with the unavailable RAML source. For every 0 ≤𝑛 ≤7, compute the exact traces, verify equivalence of the paper’s monomial bounds with the nonnegative binomial annotations, and check that each trace does not exceed its bound. The fixed call is startBreadth [1;2;3;4;5;6;7]. Acceptance requires 𝑛01234567𝗉𝖺𝗂𝗋𝗌003918304563𝗌𝗍𝖺𝗋𝗍𝖡𝗋𝖾𝖺𝖽𝗍𝗁0164280130192266352. Mutate the breadth bound by dropping the linear contribution to 14𝑛 +14𝑛2; the 𝑛 =1 oracle must fail. The checker illustrates the finite trace calculation and inequality in theorem 57.3; it does not prove that theorem or validate a RAML implementation.
Referenced from 5 locations