Amortized resource certificates over native executions #
Potential credit can depend on both the mathematical state and the hidden concrete state. This layer attaches a potential inequality to an existing semantic implementation; it does not modify execution or assign a machine cost to pure Lean computation. Endpoint credit is retained on the left of the bound, avoiding truncated subtraction.
Main definitions #
Amortized: an angelic native-resource potential certificate over aStateTransitionImpl.Amortized.ofFn: constructor for deterministic specifications ([D.HasStepFn f]).
Main results #
Amortized.demonic,Amortized.exists_demonic: every demonically admissible adaptive execution satisfies the telescoping potential bound along itsClientRuntranscript.Amortized.client,Amortized.exists_executes: deterministic specializations for[D.HasStepFn f].Amortized.client_const,Amortized.exists_executes_const: specialization to uniform constant amortized charges.Amortized.of_bound,Amortized.of_worstCase: derive potential certificates from independent worst-case bounds.
References #
Angelic potential certificate over a StateTransitionImpl: every native operation execution
from a represented state on an admissible operation realizes some permitted abstract post-state s'
with D.step s o s' a ∧ R.rep s' c' and
weight trace + potential s' c' ≤ charge s o + potential s c.
- step {s : D.State} {c : C} {o : D.Op} {a : D.signature.B o} {c' : C} {trace : Trace} : R.rep s c → D.valid s o → exec c o a c' trace → ∃ (s' : D.State), D.step s o s' a ∧ R.rep s' c' ∧ weight trace + potential s' c' ≤ charge s o + potential s c
Angelic step correctness coupled with the potential inequality.
Instances For
Construct an Amortized certificate on a deterministic specification ([D.HasStepFn f]) from
a single-step potential inequality at (D.stepFn s o).1.
Amortized telescoping along demonically admissible adaptive clients (demonic).
For any demonically admissible client p and native execution Executes exec p c a c' traces,
there exist a final abstract state s' and transcript tr such that D.ClientRun s p a s' tr,
R.rep s' c', and
total weight traces + potential s' c' ≤ D.totalCostTranscript charge s tr + potential s c.
Existence, correctness, and amortized bound (exists_demonic).
From related initial states, every demonically admissible client p admits a native execution
satisfying D.ClientRun, R.rep, and the telescoping potential bound.
Adaptive clients retain both initial and final representation credit on deterministic specifications.
Existence and semantic correctness are inherited independently from the implementation.
Adaptive client potential bound for a uniform constant per-operation amortized charge.
Existence, correctness, and potential bound for a uniform constant amortized charge.
Worst-case certificates on deterministic specifications give potential certificates whenever their charges satisfy the abstract potential inequality.
Worst-case certificates give potential certificates whenever their charges satisfy the relational abstract potential inequality across all permitted outcomes.
A worst-case bound is a zero-potential certificate.