Realization rules with absorbed local work #
Realizes bounds native instructions by C * (memory charge + local work + 1) with one
existential exchange factor C. Local work within a constant multiple of the memory charge plus
another grading can therefore be traded for a larger factor (Realizes.mono_mul). In particular,
a composition of glue, binds and branches has the same certificate with local work 0: its native
cost is O(memory charge + 1). So does a runtime-bounded loop whose body begins with a query,
because that query's charge pays each iteration's control unit; a query-free loop keeps its
graded charge.
The rules below are the C2 rules bind, branch, glueVector and iterateRuntime with that
absorption applied. They are the target shapes of the realize tactic. Glue takes
GlueComputable certificates, whose instruction budgets stay hidden.
Main definitions #
WordEncoding: the word encodingrealizeuses for an intermediate answer type.blockWords: a block as its base address and length.
Main results #
Realizes.mono_mul: absorb local work dominated by a constant multiple of the memory charge plus another grading.Realizes.congr: transport a certificate along pointwise equal programs.Realizes.consequence_valid: strengthen the domain under the client's valid history.Realizes.bind₀,Realizes.branch₀: sequencing and branching with absorbed control work.Realizes.bind₀_of_runstates the continuation's domain at a closed form of the first client's reply and next memory.Realizes.pure₀: finite-result glue fromGlueComputablecoordinates, with a visible domain and an explicit word-fit obligation.Realizes.iterate₀: loops whose body begins with a query.
These are derived rules over the existing realization kernel; no execution semantics or
certificate is added. Environment, domain and work transport laws are publicly imported from
the LoopCongr module.
The faithful word encoding realize uses when a bind passes an answer of type α to its
continuation. Instances cover words, unit, optional words, Booleans, blocks and pairs.
- width : ℕ
The number of words.
The faithful encoding.
Instances
Optional values use a presence tag followed by their unshifted payload words. The scalar instance retains its legacy vector normal form.
A pair is encoded by its two encodings, first component first.
Local work within a constant multiple of the memory charge plus another grading is absorbed
by the exchange factor. The new factor is C * (K + 1); the emitter and scratch are unchanged.
Pointwise equal programs have the same certificates.
Strengthen the visible domain using, besides the input fits and memory well-formedness, the validity of the client's own history from the entry memory, which every execution supplies.
Sequencing with the bind's control unit absorbed.
Sequencing with the first client's reply and next memory given in closed form, so that the continuation's domain is stated at them rather than at the interpreter's run.
Branching with the test and jump absorbed. Only the selected alternative's domain is required.
Return a computed finite result. Each coordinate has a GlueComputable certificate over the
live words with a common domain P and value envelope bound; need is any condition that,
together with the live words' fit and P, makes the envelope fit. Native glue cost is absorbed.
Loops whose body issues a query #
A client that begins with a query has memory charge at least one.
When every body issues a query, the loop's control work is at most its memory charge.
With trivial body domains, every iteration's domain holds.
A runtime-bounded loop whose body begins with a query has local work 0: each iteration's
control unit is paid by that query's memory charge.