Mathematical refinement of persistent source sessions #
A single-step refinement relates ordinary mathematical state to an actual source
value and heap. Replies use the existing heap-indexed Representation, at their
own return-time heaps. The state relation may retain ghost invariants and does
not choose, encode or reload a runtime state.
Finite mathematical histories reuse Lean's List.mapM in StateM. They are
proof models, not source callbacks or a second implementation. The fixed request
encoding describes the arguments already supplied at each call; it is not a
runtime loader. Reference-bearing external inputs still need a loading protocol.
Admissibility may depend on the mathematical state, so a completed protocol need
not accept another request. ValidInputs checks only the legal history in a proof.
The total refinement constructs successful source traces, and also describes any actual trace of the same entries, including the source projection of a RAM run. Neither statement requires a machine width or a time budget.
Ordinary left-to-right stateful list traversal, used only as a proof model.
Equations
- Complexity.Language.Session.modelRun step inputs state = List.mapM (fun (input : ι) (state : σ) => step state input) inputs state
Instances For
Each request is admissible at its own mathematical state. This proof-side history condition does not pass a future sequence to either source entry.
Equations
- Complexity.Language.Session.ValidInputs admissible step x✝ [] = True
- Complexity.Language.Session.ValidInputs admissible step x✝ (input :: inputs) = (admissible x✝ input ∧ Complexity.Language.Session.ValidInputs admissible step (step x✝ input).2 inputs)
Instances For
Total correspondence of one actual source step to an ordinary mathematical transition. The state relation observes the actual heap, without a chosen encoder, unique runtime representation or disjoint-ownership assumption.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A total single-step refinement constructs a finite trace with exactly the model's replies and final state observation. Requests remain environment data.
The same refinement describes an already supplied actual trace, not only a separately selected successful witness. This is the entry for RAM source erasure.
A successful initializer has one actual state and heap.
Any two successful traces from the same actual state and heap have the same replies, including their return-time heaps, and the same final observation.
Initialization and all subsequent actual steps have unique observations. This aligns an independently proved source postcondition with a costed run.
Attach a proved initialization to the same finite source refinement. The supplied start includes its actual heap, not a reconstructed model state.
Transfer ordinary mathematical observations to any initialized actual source trace, so a separate cost proof cannot silently choose a different computation.