Shared arguments and bounds for linked-list folding #
Callback domains, actual source arguments and accumulated envelopes are shared by readiness and cost proofs. These definitions do not choose a traversal or require a proposed instruction bound to establish successful execution. The guard's measured primitive proof retains its existing branch counts.
Mathematical charge accumulated along the ordinary fold trajectory. This is an envelope on supplied bounds, not a source execution or cost model.
Equations
- Ram.LanguageCompiler.List.Fold.accumulated step charge x✝ [] = 0
- Ram.LanguageCompiler.List.Fold.accumulated step charge x✝ (head :: tail) = charge x✝ head + Ram.LanguageCompiler.List.Fold.accumulated step charge (step x✝ head) tail
Instances For
A fixed per-element overhead separates from the accumulator-dependent callback charges without changing which accumulator supplies each bound.
Each index keeps the mathematical accumulator and its actual source value; heap representations need not choose a unique runtime encoding.
Equations
- Ram.LanguageCompiler.List.Fold.calleeArgs input = Complexity.Language.Env.cons input.2.1 (Complexity.Language.Env.cons (kind.toValue input.2.2) Complexity.Language.Env.empty)
Instances For
The callback domain and accumulator observation are checked at the actual entry heap, rather than turning the representation into a host-side decoder.
Equations
- Ram.LanguageCompiler.List.Fold.calleePre representation domain input heap = (domain input.1 input.2.2 ∧ representation.Rel input.1 input.2.1 heap)
Instances For
Fold specializes the shared resource interface to the selected callback; the reservation depends on the mathematical accumulator and current head.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Callback bounds retain the shared convention: actual core steps plus the two function-initialization instructions, before the caller adds its frame work.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The emitted call overhead and one round of actual linked traversal are added to the callback's independently supplied bound at each accumulator.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Callback charges along the ordinary fold trajectory separate from the compiler's linear traversal and actual calling-convention overhead.
Every represented list head already has its scalar range in the actual initial memory. Later callbacks retain these immutable stored heads.
The actual guard tests only the optional root and preserves both locals and heap. Its two branches have their existing, distinct emitted counts.
The source invocation receives the original represented accumulator and linked root. These are existing source arguments, not a host-side list loader.
Equations
- Ram.LanguageCompiler.List.Fold.foldArgs accumulator root = Complexity.Language.Env.cons accumulator (Complexity.Language.Env.cons root Complexity.Language.Env.empty)
Instances For
The complete invocation envelope includes the actual relocated callback frames, source-body initialization, outer invocation and final halt.
Equations
- One or more equations did not get rendered due to their size.