Documentation

LeanPool.OrderMaintenance.Spec

The list specification #

The order-maintenance problem (docs/PROOF.md §1) as a pure function on lists. Theorem A states that the machine program answers every operation as Spec.run does.

Elements are named by creation time: the k-th insertion (counting from 0) creates element k. An implementation hands out its own handles; the correctness theorem relates them to these names through the client's record of which handle each insertion returned.

@[reducible, inline]

Fresh natural-number names used by the list specification.

Equations
Instances For

    External insertion, deletion and order-comparison operations.

    Instances For
      def OrderMaintenance.Spec.instDecidableEqOp.decEq (x✝ x✝¹ : Op) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Observable answers returned by specification operations.

          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The ordered live element list and its next fresh name.

              • list : List Elem

                Live element names in their current order.

              • fresh : Nat

                The name of the next inserted element.

              Instances For
                Equations
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    The empty ordered list with fresh names starting at zero.

                    Equations
                    Instances For

                      Insert y immediately after the first occurrence of x.

                      Equations
                      Instances For

                        Does x occur before y?

                        Equations
                        Instances For

                          Execute one specification operation and return its state and answer.

                          Equations
                          Instances For

                            The state after a sequence of operations.

                            Equations
                            Instances For

                              Every operation of the sequence is valid in the state where it is issued.

                              Equations
                              Instances For

                                Basic invariant: distinct elements, all named below fresh #

                                Live names are distinct and smaller than the next fresh name.

                                Equations
                                Instances For
                                  theorem OrderMaintenance.Spec.mem_insertAfterL {x y e : Elem} {l : List Elem} (hx : x ∈ l) :
                                  e ∈ insertAfterL x y l ↔ e = y ∨ e ∈ l
                                  theorem OrderMaintenance.Spec.nodup_insertAfterL {x y : Elem} {l : List Elem} (hx : x ∈ l) (hy : ¬y ∈ l) (hl : l.Nodup) :
                                  theorem OrderMaintenance.Spec.step_inv {s : State} {op : Op} (h : Inv s) (hv : Op.Valid s op) :
                                  Inv (step s op).fst
                                  theorem OrderMaintenance.Spec.final_inv {s : State} {ops : List Op} (h : Inv s) (hv : Valid s ops) :
                                  Inv (final s ops)