Compiling two effectful traversal calls #
The same source declaration calls the existing traversal twice. Its first callee's proved frame preserves the second input in the actual intermediate heap. Realization and cost reuse the existing callee contracts; neither proof reopens the array loop or supplies a register-level adapter.
The final runner theorem retains both mapped arrays, observations outside both borrowed views, and their common represented final heap. The views may be disjoint slices of one object. Word ranges, preloaded memory and space for the three active call frames remain explicit, independently of the instruction bound.
Two nested call levels account for the pair calling a traversal which calls its increment helper. The first traversal's frame supplies the second input; all actual increment ranges are inherited from the existing callee proofs.
The inferred complete pair budget is shared by direct and imported callers, without reproducing either callee's body or manually adding call overhead.
Equations
- Complexity.Language.Examples.Traversal.boundedMapPairBodyBound leftSize rightSize = ↑(Complexity.Language.Examples.Traversal.boundedMapPairCost✝ leftSize rightSize)
Instances For
The source frame is reused only to justify the second callee's input at the actual intermediate heap. Existing traversal bounds count both effectful calls; no array-correctness or loop-cost argument is repeated.
The inferred pair budget with its actual outer-call and final-halt charges.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Both mapped arrays and the outside-both frame describe one typed actual RAM result. The launch retains the original three-frame capacity and argument ranges; the separate instruction bound includes both calls and the final halt.
The actual compiled pair invocation returns both mapped arrays and the outside-both frame in one represented final heap. Its independent instruction bound includes both calls, while stack capacity allows pair/traversal/helper.