Level F: the full structure (prototype/wrapper.py) #
Deletion by tombstones and growth by incremental global rebuilding on top of the insert-only
core. cur answers all queries. When cur is half full, or too few of its elements are live,
a fresh core nxt is prepared and then filled in the background, K_B steps per operation.
Handles are the insertion counter, so the k-th insertion returns handle k, exactly the
element names of OrderMaintenance.Spec.
The parameters of a new core are given by a function mk : Nat → Params of the capacity.
The minimum initial core capacity, equal to 64.
Equations
Instances For
The external handle interface with incremental copying into a replacement core.
- cur : Core
Current core answering external operations.
Handle → element index in
cur(0: absent).Replacement core being prepared and filled, if rebuilding.
External handle to element index in the replacement core.
- cursor : Nat
Next current-core element to copy during rebuilding.
- cursorSet : Bool
Copying starts only once
nxtis fully prepared. - live : Nat
Number of live external handles.
- nextHandle : Nat
Next fresh external handle.
- rebuilds : Nat
Number of completed wrapper rebuilds.
- KB : Nat
Copying budget per external operation.
Instances For
Wrapper computations that report an error instead of returning a partially updated wrapper.
Instances For
Run a core computation and return its result and state on success.
Equations
- OrderMaintenance.Model.runCore c act = match EStateM.run act c with | EStateM.Result.ok a s => Except.ok (a, s) | EStateM.Result.error e a => Except.error e
Instances For
Run a core action on cur. The core is moved out of om first, so that its arrays stay
unshared and are updated in place by compiled code.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a core with the supplied parameters, optionally deferring top-tree preparation.
Equations
- OrderMaintenance.Model.newCore P lazy = Prod.snd <$> OrderMaintenance.Model.runCore { P := P } (OrderMaintenance.Model.initCore lazy)
Instances For
Construct the empty external interface with a prepared initial core.
Equations
- OrderMaintenance.Model.OrderMaintenance.init mk KB = do let __do_lift ← OrderMaintenance.Model.newCore (mk OrderMaintenance.Model.minimumCapacity) false pure { cur := __do_lift, KB := KB }
Instances For
Copy one element of cur at the cursor into nxt, if it is live.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
The rebuild loop, with budget steps left: each iteration spends one unit, except the one
that sets the cursor (fuel bounds the iterations).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The rebuild's share of one operation: exactly K_B steps (wrapper.py _rebuild_step).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Mirror an insertion into nxt, if its anchor is already copied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Mirror a deletion into nxt, if the element is already copied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Allocate a fresh handle and insert it at the front or after a live handle.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Delete a live handle and mirror the deletion into a replacement core.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compare two live external handles using the current core’s order labels.
Equations
Instances For
One operation of the specification's interface. The k-th insertion returns handle k,
which is the specification's name for the new element.
Equations
- One or more equations did not get rendered due to their size.
- OrderMaintenance.Model.OrderMaintenance.apply mk om (OrderMaintenance.Spec.Op.order x_1 y) = do let b ← om.order x_1 y pure (OrderMaintenance.Spec.Ans.bool b, om)
Instances For
The answers to a sequence of operations.