Combined memory and local-work currency #
combinedCost p work s adds the actual memory-history charge to an explicit local-work grading.
The grading is supplied by the client and matched by its Realizes certificate; the extensional
Memory.Prog term does not determine a canonical local-work cost. In particular, monad laws may
erase pure binds, whereas a chosen native realization must still pay for its control and glue.
The bind law uses the actual interpreted reply and memory state and includes one control-work
unit. The loop law reuses iterationSum_eq, retaining one control-work unit even on iterations
that issue no memory query. These are currency identities, not native instruction certificates.
A memory-only upper estimate requires a separate uniform bound on the supplied local work.
Main definitions #
combinedCost: memory-history charge plus the explicitly supplied local-work grading.
Main results #
combinedCost_pure: semantic return retains its local-work charge.combinedCost_bind: combined charges split at the actual returned value and state.combinedCost_iterate: a bounded loop sums body charges and adds its iteration count.combinedCost_le_of_work_le: a uniform local-work envelope gives a memory-only estimate.scaled_potential_pay: explicit clock, local-work and memory-potential bounds imply a scaled potential payment inequality.
References #
This grading API is original infrastructure for the existing memory-client realization rules.
The actual memory-history charge plus an explicit realization grading. This definition
alone does not certify that work pays for any native implementation.
Returning without a memory query still retains the supplied local-work grading.
Sequential local work includes one control unit and evaluates the continuation grading at the reply and state actually reached by the first computation.
Combined body charges are summed along the actual joint value/memory transition. The
additional n pays control work on every iteration, including query-free iterations.
A memory-only estimate is available under an explicit uniform local-work envelope. The constants precede every state. This arithmetic estimate supplies no native execution claim.
Transfer a certified combined clock through an explicit local-work envelope and a memory amortization inequality. Scale the memory potential by the same fixed exchange factor; the result is pure arithmetic and does not supply an execution certificate. All constants and charges are explicit, so a consumer must discharge the three premises for its own operation.