Documentation

LeanPool.OrderMaintenance.Impl.Fields

M6: reading back what was written #

A write to field f of record i changes exactly that value (Fld.get_set), keeps every table size and the parameters, and a push changes no value at all (a pushed record is a default record, which reads like a record past the end).

theorem OrderMaintenance.Impl.b2n_not_beq {v : Nat} (h : v ≤ 1) :
(b2n !v == 0) = v
theorem OrderMaintenance.Impl.b2n_bne {v : Nat} (h : v ≤ 1) :
b2n (v != 0) = v
theorem OrderMaintenance.Impl.EF.get_set (x : Model.Elem) (v : Nat) (k k' : EF) (h : ok v k = true) :
get (set x v k) k' = if k' = k then v else get x k'
theorem OrderMaintenance.Impl.GF.get_set (x : Model.Group) (v : Nat) (k k' : GF) (h : ok v k = true) :
get (set x v k) k' = if k' = k then v else get x k'
theorem OrderMaintenance.Impl.CF.get_set (x : Model.Chunk) (v : Nat) (k k' : CF) (h : ok v k = true) :
get (set x v k) k' = if k' = k then v else get x k'
theorem OrderMaintenance.Impl.NF.get_set (x : Model.Node) (v : Nat) (k k' : NF) (h : ok v k = true) :
get (set x v k) k' = if k' = k then v else get x k'
theorem OrderMaintenance.Impl.AF.get_set (s : Model.Core) (a : Array Nat) (k k' : AF) :
get (set s a k) k' = if k' = k then a else get s k'
theorem OrderMaintenance.Impl.SF.get_set (s : Model.Core) (v : Nat) (k k' : SF) (h : ok v k = true) :
get (set s v k) k' = if k' = k then v else get s k'
theorem OrderMaintenance.Impl.AF.set_keep (s : Model.Core) (a : Array Nat) (k : AF) :
(set s a k).E = s.E ∧ (set s a k).Gs = s.Gs ∧ (set s a k).C = s.C ∧ (set s a k).nodes = s.nodes ∧ (set s a k).P = s.P ∧ ∀ (k' : SF), SF.get (set s a k) k' = SF.get s k'

What an AF write keeps.

theorem OrderMaintenance.Impl.SF.set_keep (s : Model.Core) (v : Nat) (k : SF) :
(set s v k).E = s.E ∧ (set s v k).Gs = s.Gs ∧ (set s v k).C = s.C ∧ (set s v k).nodes = s.nodes ∧ (set s v k).P = s.P ∧ ∀ (k' : AF), AF.get (set s v k) k' = AF.get s k'

What a scalar write keeps.

theorem OrderMaintenance.Impl.Fld.cap_scalar {κ : Caps} {k : SF} {j : Nat} (h : j < cap κ (s k)) :
j = 0
theorem OrderMaintenance.Impl.Fld.get_set {κ : Caps} {s s' : Model.Core} {i v : Nat} {f : Fld} (h : set κ s i v f = some s') (g : Fld) {j : Nat} (hj : j < cap κ g) :
get s' j g = if g = f ∧ j = i then v else get s j g

A write changes exactly the written value.

theorem OrderMaintenance.Impl.Fld.set_keep {κ : Caps} {s s' : Model.Core} {i v : Nat} {f : Fld} (h : set κ s i v f = some s') :
(∀ (t : Tbl), Tbl.size s' t = Tbl.size s t) ∧ s'.P = s.P

A write keeps the table sizes and the parameters.

theorem OrderMaintenance.Impl.Tbl.push_get (s : Model.Core) (t : Tbl) (f : Fld) (i : Nat) :
Fld.get (push s t) i f = Fld.get s i f

A push changes no value, and adds one to its table's size.

theorem OrderMaintenance.Impl.Tbl.push_size (s : Model.Core) (t t' : Tbl) :
size (push s t) t' = if t' = t then size s t + 1 else size s t'

Lists, paths and optional records under field writes and pushes #

theorem OrderMaintenance.Impl.NF.set_lists (x : Model.Node) (v : Nat) (k : NF) :
(set x v k).children = x.children ∧ (set x v k).table = x.table ∧ (set x v k).inTables = x.inTables ∧ (set x v k).side = x.side
theorem OrderMaintenance.Impl.Fld.set_rest {κ : Caps} {s s' : Model.Core} {i v : Nat} {f : Fld} (h : set κ s i v f = some s') :
(∀ (k : LK) (j : Nat), LK.view s' j k = LK.view s j k) ∧ (∀ (c : Nat), rowOf s' c = rowOf s c) ∧ ∀ (o : OF), OF.get s' o = OF.get s o

A field write keeps every list, path row and optional record.

theorem OrderMaintenance.Impl.Tbl.push_rest (s : Model.Core) (t : Tbl) :
(∀ (k : LK) (j : Nat), LK.view (push s t) j k = LK.view s j k) ∧ (∀ (c : Nat), rowOf (push s t) c = rowOf s c) ∧ ∀ (o : OF), OF.get (push s t) o = OF.get s o

Lists under list writes #

@[simp]
theorem OrderMaintenance.Impl.NF.get_children (x : Model.Node) (k : NF) (values : List Nat) :
get { height := x.height, livePar := x.livePar, children := values, weight := x.weight, table := x.table, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k

Numeric node fields are unchanged when its children list is replaced.

@[simp]
theorem OrderMaintenance.Impl.NF.get_table (x : Model.Node) (k : NF) (values : List (Nat × Nat)) :
get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := values, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k

Numeric node fields are unchanged when its table list is replaced.

@[simp]
theorem OrderMaintenance.Impl.NF.get_inTables (x : Model.Node) (k : NF) (values : List Nat) :
get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := x.table, inTables := values, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k

Numeric node fields are unchanged when its inTables list is replaced.

@[simp]
theorem OrderMaintenance.Impl.NF.get_side (x : Model.Node) (k : NF) (values : List (Nat × Model.Side)) :
get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := x.table, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := values, overflowOf := x.overflowOf, alive := x.alive } k = get x k

Numeric node fields are unchanged when its side list is replaced.

theorem OrderMaintenance.Impl.NF.get_lists (x : Model.Node) (k : NF) (a : List Nat) (b : List (Nat × Nat)) (c : List Nat) (d : List (Nat × Model.Side)) :
get { height := x.height, livePar := x.livePar, children := a, weight := x.weight, table := x.table, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k ∧ get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := b, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k ∧ get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := x.table, inTables := c, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := x.side, overflowOf := x.overflowOf, alive := x.alive } k = get x k ∧ get { height := x.height, livePar := x.livePar, children := x.children, weight := x.weight, table := x.table, inTables := x.inTables, first := x.first, last := x.last, draining := x.draining, t1 := x.t1, t2 := x.t2, side := d, overflowOf := x.overflowOf, alive := x.alive } k = get x k
theorem OrderMaintenance.Impl.LK.put_keep (s : Model.Core) (i : Nat) (l : List (Nat × Nat)) (k : LK) :
(∀ (f : Fld) (j : Nat), Fld.get (put s i l k) j f = Fld.get s j f) ∧ (∀ (t : Tbl), Tbl.size (put s i l k) t = Tbl.size s t) ∧ (put s i l k).P = s.P ∧ (∀ (c : Nat), rowOf (put s i l k) c = rowOf s c) ∧ ∀ (o : OF), OF.get (put s i l k) o = OF.get s o

What a list replacement keeps.

theorem OrderMaintenance.Impl.map_pair0 {l : List (Nat × Nat)} (h : (l.all fun (q : Nat × Nat) => q.snd == 0) = true) :
List.map (fun (e : Nat) => (e, 0)) (List.map (fun (x : Nat × Nat) => x.fst) l) = l
theorem OrderMaintenance.Impl.map_side {l : List (Nat × Nat)} (h : (l.all fun (q : Nat × Nat) => decide (q.snd ≤ 1)) = true) :
List.map (fun (q : Nat × Model.Side) => (q.fst, sideN q.snd)) (List.map (fun (q : Nat × Nat) => (q.fst, sideOfN q.snd)) l) = l
theorem OrderMaintenance.Impl.map_pair0' {l : List (Nat × Nat)} (h : (l.all fun (q : Nat × Nat) => q.snd == 0) = true) :
List.map (fun (q : Nat × Nat) => (q.fst, 0)) l = l
theorem OrderMaintenance.Impl.map_side' {l : List (Nat × Nat)} (h : (l.all fun (q : Nat × Nat) => decide (q.snd ≤ 1)) = true) :
List.map (fun (q : Nat × Nat) => (q.fst, sideN (sideOfN q.snd))) l = l
theorem OrderMaintenance.Impl.map_pair0_mem {l : List (Nat × Nat)} (h : ∀ (q : Nat × Nat), q ∈ l → q.snd = 0) :
List.map (fun (q : Nat × Nat) => (q.fst, 0)) l = l
theorem OrderMaintenance.Impl.map_side_mem {l : List (Nat × Nat)} (h : ∀ (q : Nat × Nat), q ∈ l → q.snd ≤ 1) :
List.map (fun (q : Nat × Nat) => (q.fst, sideN (sideOfN q.snd))) l = l
theorem OrderMaintenance.Impl.LK.view_put {s : Model.Core} {i : Nat} {l : List (Nat × Nat)} {k : LK} (hr : recOk s i k = true) (hv : valid l k = true) (k' : LK) (j : Nat) :
view (put s i l k) j k' = if k' = k ∧ j = i then l else view s j k'

A list replacement reads back, and touches no other list.