Documentation

LeanPool.OrderMaintenance.Model.Wrapper

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.

    • curIdx : Array Nat

      Handle → element index in cur (0: absent).

    • nxt : Option Core

      Replacement core being prepared and filled, if rebuilding.

    • nxtIdx : Array Nat

      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 nxt is 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
      @[reducible, inline]
      abbrev OrderMaintenance.Model.WM (α : Type u_1) :
      Type u_1

      Wrapper computations that report an error instead of returning a partially updated wrapper.

      Equations
      Instances For
        def OrderMaintenance.Model.runCore {α : Type} (c : Core) (act : CM α) :
        WM (α × Core)

        Run a core computation and return its result and state on success.

        Equations
        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
            Instances For

              Construct the empty external interface with a prepared initial core.

              Equations
              Instances For

                Capacity of the next core (docs/PROOF.md §2.7, Lemma W).

                Equations
                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

                    nxt replaces cur.

                    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
                                    Instances For

                                      The answers to a sequence of operations.

                                      Equations
                                      Instances For