Documentation

LeanPool.OrderMaintenance.Proof.Top.Sorted

M5: Lemma T1 (sorted tags) #

(O1), (O2) and (W3) imply that the tags spelled by the paths strictly increase along the chunk list (docs/PROOF.md §4.5.1). So every guarded tag write of the top structure passes its guard when the state after the write satisfies Shape.

Labels in a table #

theorem OrderMaintenance.Proof.Top.gapsGe_chain {β B : ℕ} {ls : List ℕ} (h : GapsGe β B ls) (hB : 1 ≤ B) :
List.IsChain (fun (x1 x2 : ℕ) => x1 < x2) ls ∧ ∀ l ∈ ls, l < 2 ^ β
theorem OrderMaintenance.Proof.Top.lookup_lt_of_before {t : List (ℕ × ℕ)} (hk : (List.map (fun (x : ℕ × ℕ) => x.1) t).Nodup) (hl : List.IsChain (fun (x1 x2 : ℕ) => x1 < x2) (List.map (fun (x : ℕ × ℕ) => x.2) t)) {a b : ℕ} (h : Before (List.map (fun (x : ℕ × ℕ) => x.1) t) a b) :
∃ (la : ℕ) (lb : ℕ), Model.lookup t a = some la ∧ Model.lookup t b = some lb ∧ la < lb

In a table with distinct entries and increasing labels, label order is table order.

Lemma T1 #

theorem OrderMaintenance.Proof.Top.ShapeT.pp_root {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {c : ℕ} (hc : c ∈ cl) :
pp s c s.P.H = s.P.H
theorem OrderMaintenance.Proof.Top.ShapeT.labs_ok {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {X : ℕ} (hX : isN s X) :
List.IsChain (fun (x1 x2 : ℕ) => x1 < x2) (labs s X) ∧ ∀ l ∈ labs s X, l < 2 ^ s.P.beta
theorem OrderMaintenance.Proof.Top.ShapeT.order_nodup {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {X : ℕ} (hX : isN s X) :
(order s X).Nodup
theorem OrderMaintenance.Proof.Top.ShapeT.isN_pp {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {c : ℕ} (hc : c ∈ cl) {j : ℕ} (hj1 : 1 ≤ j) (hj : j ≤ s.P.H) :
isN s (pp s c j) ∧ ht s (pp s c j) = j
theorem OrderMaintenance.Proof.Top.ShapeT.digit_lt {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {c : ℕ} (hc : c ∈ cl) {j : ℕ} (hj1 : 1 ≤ j) (hj : j ≤ s.P.H) :
digit s c j < 2 ^ s.P.beta

A digit of a tag is a label of the table on the path, so it fits in β bits.

theorem OrderMaintenance.Proof.Top.ShapeT.tagF_lt {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : ShapeT s cl ord) {c d : ℕ} (hcd : Before cl c d) :
tagF s c < tagF s d

Lemma T1. Tags strictly increase along the chunk list.