Documentation

LeanPool.OrderMaintenance.Proof.Cost.Runs

Runs as functions of the state #

Under INV-S, the run of a group is determined by the element list and the elements' grp fields: it is the sublist of the elements in that group. Likewise for the groups of a chunk. So the cost invariants can be stated in terms of the element list L and the state alone, and transported along the M2 lemmas, which keep L but give the new nesting only existentially.

The run of group g: the elements of L in g, in list order.

Equations
Instances For

    The groups of chunk c, in list order.

    Equations
    Instances For
      theorem OrderMaintenance.Proof.flatten_map_ite {L : List ℕ} (hnd : L.Nodup) {g : ℕ} (hg : g ∈ L) (X : List ℕ) :
      (List.map (fun (b : ℕ) => if b = g then X else []) L).flatten = X
      theorem OrderMaintenance.Proof.INV.elts_eq {s : Model.Core} {A : Abs} (h : INV s A) {g : ℕ} (hg : g ∈ A.glist) :
      A.elts g = runOf s A.elist g
      theorem OrderMaintenance.Proof.INV.grps_eq {s : Model.Core} {A : Abs} (h : INV s A) {c : ℕ} (hc : c ∈ A.chunks) :
      A.grps c = grpsOf s A.glist c
      theorem OrderMaintenance.Proof.INV.first_nil_iff {s : Model.Core} {A : Abs} (h : INV s A) {g : ℕ} (hg : g ∈ A.glist) :

      A group's run is empty iff its first is NIL.

      theorem OrderMaintenance.Proof.INV.mem_glist_iff {s : Model.Core} {A : Abs} (h : INV s A) {g : ℕ} :

      The groups of the list are the live (alive, allocated, non-NIL) groups.

      theorem OrderMaintenance.Proof.mem_runOf {s : Model.Core} {L : List ℕ} {g e : ℕ} :
      e ∈ runOf s L g ↔ e ∈ L ∧ eG s e = g

      Elements of the list in a group of the list.

      theorem OrderMaintenance.Proof.INV.eG_mem {s : Model.Core} {A : Abs} (h : INV s A) {e : ℕ} (he : e ∈ A.elist) :
      eG s e ∈ A.glist

      Every element of the list lies in a group of the list.

      The element list is the concatenation of the runs, in group-list order.

      Lists #

      theorem OrderMaintenance.Proof.isChain_insert' {R : ℕ → ℕ → Prop} {l1 l2 : List ℕ} {x y : ℕ} {f f' : ℕ → ℕ} (hs : List.IsChain R (List.map f (l1 ++ x :: l2))) (hagree : ∀ z ∈ l1 ++ x :: l2, f' z = f z) (hxy : R (f x) (f' y)) (hy2 : ∀ w ∈ l2.head?, R (f' y) (f w)) :
      List.IsChain R (List.map f' (l1 ++ x :: y :: l2))

      IsChain survives inserting y right after x, for any relation.

      theorem OrderMaintenance.Proof.isChain_mid {R : ℕ → ℕ → Prop} {l1 l2 : List ℕ} {x y : ℕ} {f : ℕ → ℕ} (hs : List.IsChain R (List.map f (l1 ++ x :: y :: l2))) :
      R (f x) (f y)

      In a chain of a reflexive-free gap relation, consecutive members are related.