Documentation

LeanPool.OrderMaintenance.Proof.Word.Pres

Theorem W, stage B1: the framework #

Values that need more than WB (labels: the guards and LabRoom; sizes: the cost invariants; fresh indices: the record counts) appear as hypotheses of the lemmas that write them.

Arrays whose entries satisfy a predicate #

theorem OrderMaintenance.Proof.Word.allX_modify {α : Type} [Inhabited α] {p : α → Prop} {a : Array α} (h : ∀ (j : ℕ), p (a.getX j)) {f : α → α} (hf : ∀ (X : α), p X → p (f X)) (i j : ℕ) :
p ((a.modify i f).getX j)
theorem OrderMaintenance.Proof.Word.allX_modify_at {α : Type} [Inhabited α] {p : α → Prop} {a : Array α} (h : ∀ (j : ℕ), p (a.getX j)) {f : α → α} {i : ℕ} (hf : p (f (a.getX i))) (j : ℕ) :
p ((a.modify i f).getX j)

modify where the update is only known to be good at the modified index.

theorem OrderMaintenance.Proof.Word.allX_push {α : Type} [Inhabited α] {p : α → Prop} {a : Array α} (h : ∀ (j : ℕ), p (a.getX j)) {v : α} (hv : p v) (j : ℕ) :
p ((a.push v).getX j)
theorem OrderMaintenance.Proof.Word.allX_set! {α : Type} [Inhabited α] {p : α → Prop} {a : Array α} (h : ∀ (j : ℕ), p (a.getX j)) {v : α} (hv : p v) (i j : ℕ) :
p ((a.set! i v).getX j)
theorem OrderMaintenance.Proof.Word.allX_setX {α : Type} [Inhabited α] {p : α → Prop} {a : Array α} (h : ∀ (j : ℕ), p (a.getX j)) {v : α} (hv : p v) (i j : ℕ) :
p ((a.setX i v).getX j)
theorem OrderMaintenance.Proof.Word.allX_ite {α : Type} [Inhabited α] {p : α → Prop} {c : Prop} [Decidable c] {a b : Array α} (ha : ∀ (j : ℕ), p (a.getX j)) (hb : ∀ (j : ℕ), p (b.getX j)) (j : ℕ) :
p ((if c then a else b).getX j)
theorem OrderMaintenance.Proof.Word.arrB_setX {K : ℕ} {a : Array ℕ} (h : ArrB K a) {v : ℕ} (hv : v < 2 ^ K) (i : ℕ) :
ArrB K (a.setX i v)

Single-field updates #

theorem OrderMaintenance.Proof.Word.WB.withE {K : ℕ} {s : Model.Core} (h : WB K s) {E' : Array Model.Elem} (hE : ∀ (i : ℕ), ElemB K (E'.getX i)) :
WB K { P := s.P, E := E', Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withGs {K : ℕ} {s : Model.Core} (h : WB K s) {G' : Array Model.Group} (hG : ∀ (i : ℕ), GroupB K (G'.getX i)) :
WB K { P := s.P, E := s.E, Gs := G', C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withC {K : ℕ} {s : Model.Core} (h : WB K s) {C' : Array Model.Chunk} (hC : ∀ (i : ℕ), ChunkB K (C'.getX i)) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := C', freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withNodes {K : ℕ} {s : Model.Core} (h : WB K s) {N' : Array Model.Node} (hN : ∀ (i : ℕ), NodeB K (N'.getX i)) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := N', path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withFreeG {K : ℕ} {s : Model.Core} (h : WB K s) {l : List ℕ} (hl : ∀ g ∈ l, g < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := l, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqHead {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := a, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqNext {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := a, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqPrev {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := a, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqWhere {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := a, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withNbNext {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := a, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withNbPrev {K : ℕ} {s : Model.Core} (h : WB K s) {a : Array ℕ} (ha : ArrB K a) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := a, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqHi {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := v, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withPqLo {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := v, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withCount {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := v, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withTail {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := v, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withFirstGroup {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := v, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withFirstChunk {K : ℕ} {s : Model.Core} (h : WB K s) {v : ℕ} (hv : v < 2 ^ K) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := v, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withResJob {K : ℕ} {s : Model.Core} (h : WB K s) {j : Option Model.Job} (hj : ∀ (x : Model.Job), j = some x → JobB K x) :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := j, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }
theorem OrderMaintenance.Proof.Word.WB.withReady {K : ℕ} {s : Model.Core} (h : WB K s) {b : Bool} :
WB K { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := b, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes, path := s.path, cin := s.cin, lpar := s.lpar }

Reading the bound back.

theorem OrderMaintenance.Proof.Word.WB.getE {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
ElemB K (s.E.getX i)
theorem OrderMaintenance.Proof.Word.WB.getG {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
GroupB K (s.Gs.getX i)
theorem OrderMaintenance.Proof.Word.WB.getC {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
ChunkB K (s.C.getX i)
theorem OrderMaintenance.Proof.Word.WB.count {K : ℕ} {s : Model.Core} (h : WB K s) :
s.count < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.head {K : ℕ} {s : Model.Core} (h : WB K s) :
s.head < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.tail {K : ℕ} {s : Model.Core} (h : WB K s) :
s.tail < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqHi {K : ℕ} {s : Model.Core} (h : WB K s) :
s.pqHi < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqLo {K : ℕ} {s : Model.Core} (h : WB K s) :
s.pqLo < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqHead {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.pqHead.getX i < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqNext {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.pqNext.getX i < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqPrev {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.pqPrev.getX i < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.pqWhere {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.pqWhere.getX i < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.nbNext {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.nbNext.getX i < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.nbPrev {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
s.nbPrev.getX i < 2 ^ K

Reads, in apply form (for the tactic vb) #

theorem OrderMaintenance.Proof.Word.WB.eNext {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.E.getX i).next < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.ePrev {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.E.getX i).prev < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.eGrp {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.E.getX i).grp < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.eLab {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.E.getX i).lab < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gNext {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).next < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gPrev {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).prev < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gFirst {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).first < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gLast {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).last < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gChk {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).chk < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gLab {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).lab < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gSize {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).size < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gSrc {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).src < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gL {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).l < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.gR {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.Gs.getX i).r < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cNext {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).next < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cPrev {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).prev < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cFirst {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).first < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cLast {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).last < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cSize {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).size < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cSrc {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).src < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cL {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).l < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cR {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).r < 2 ^ K
theorem OrderMaintenance.Proof.Word.WB.cTag {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
(s.C.getX i).tag < 2 ^ K

Close v < 2 ^ K for a value read from a good state, a bounded argument, or 0.

Equations
Instances For
    theorem OrderMaintenance.Proof.Word.WB.allE {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
    ElemB K (s.E.getX i)
    theorem OrderMaintenance.Proof.Word.WB.allG {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
    GroupB K (s.Gs.getX i)
    theorem OrderMaintenance.Proof.Word.WB.allC {K : ℕ} {s : Model.Core} (h : WB K s) (i : ℕ) :
    ChunkB K (s.C.getX i)
    theorem OrderMaintenance.Proof.Word.WB.allFree {K : ℕ} {s : Model.Core} (h : WB K s) (g : ℕ) :
    g ∈ s.freeG → g < 2 ^ K

    A record bound after an update with bounded values: unfold, split, and close each field.

    Equations
    Instances For

      Close the changed components left by wbx: arrays written with setX, modify, push or set!, records updated with bounded values, and values.

      Equations
      Instances For

        Records #

        Unfold the record bounds into plain inequalities (for omega).

        Equations
        Instances For
          theorem OrderMaintenance.Proof.Word.groupB_mk {K c : ℕ} (hc : c < 2 ^ K) :
          GroupB K { chk := c }

          The Hoare triple #

          def OrderMaintenance.Proof.Word.HT {α : Type} (K : ℕ) (P0 : Model.Params) (m : Model.CM α) (Q : α → Prop) :

          The stored-value bound across a computation, at fixed parameters P0: from a state with WB K and parameters P0, every run of m ends (normally or by an error) in such a state, and a normal result satisfies Q.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem OrderMaintenance.Proof.Word.HT.pure {K : ℕ} {P0 : Model.Params} {α : Type} {a : α} {Q : α → Prop} (h : Q a) :
            HT K P0 (Pure.pure a) Q
            theorem OrderMaintenance.Proof.Word.HT.pure_eq {K : ℕ} {P0 : Model.Params} {α : Type} {a : α} :
            HT K P0 (Pure.pure a) fun (x : α) => x = a

            pure, remembering the value.

            theorem OrderMaintenance.Proof.Word.HT.throw {K : ℕ} {P0 : Model.Params} {α : Type} {e : Model.Err} {Q : α → Prop} :
            theorem OrderMaintenance.Proof.Word.HT.guard {K : ℕ} {P0 : Model.Params} {α : Type} {msg : String} {Q : α → Prop} :
            HT K P0 (Model.guard msg) Q
            theorem OrderMaintenance.Proof.Word.HT.guard_false {K : ℕ} {P0 : Model.Params} {α : Type} {msg : String} :
            HT K P0 (Model.guard msg) fun (x : α) => False

            A failed guard has no normal result.

            theorem OrderMaintenance.Proof.Word.HT.modify {K : ℕ} {P0 : Model.Params} {f : Model.Core → Model.Core} (h : ∀ (s : Model.Core), WB K s → s.P = P0 → WB K (f s) ∧ (f s).P = P0) :
            HT K P0 (_root_.modify f) fun (x : PUnit.{1}) => True
            theorem OrderMaintenance.Proof.Word.HT.modifyGet {K : ℕ} {P0 : Model.Params} {α : Type} {f : Model.Core → α × Model.Core} {Q : α → Prop} (h : ∀ (s : Model.Core), WB K s → s.P = P0 → (WB K (f s).2 ∧ (f s).2.P = P0) ∧ Q (f s).1) :
            theorem OrderMaintenance.Proof.Word.HT.bind {K : ℕ} {P0 : Model.Params} {α β : Type} {m : Model.CM α} {f : α → Model.CM β} {Q : α → Prop} {Q' : β → Prop} (hm : HT K P0 m Q) (hf : ∀ (a : α), Q a → HT K P0 (f a) Q') :
            HT K P0 (m >>= f) Q'
            theorem OrderMaintenance.Proof.Word.HT.ite {K : ℕ} {P0 : Model.Params} {α : Type} {c : Prop} [Decidable c] {a b : Model.CM α} {Q : α → Prop} (ha : c → HT K P0 a Q) (hb : ¬c → HT K P0 b Q) :
            HT K P0 (if c then a else b) Q
            theorem OrderMaintenance.Proof.Word.HT.mono {K : ℕ} {P0 : Model.Params} {α : Type} {m : Model.CM α} {Q Q' : α → Prop} (h : HT K P0 m Q) (hQ : ∀ (a : α), Q a → Q' a) :
            HT K P0 m Q'
            theorem OrderMaintenance.Proof.Word.HT.forIn_list {K : ℕ} {P0 : Model.Params} {β γ : Type} (l : List γ) (b : β) {f : γ → β → Model.CM (ForInStep β)} {I : β → Prop} (hb : I b) (hf : ∀ (x : γ) (b : β), I b → HT K P0 (f x b) fun (r : ForInStep β) => I r.value) :
            HT K P0 (forIn l b f) I
            theorem OrderMaintenance.Proof.Word.HT.forIn_mem {K : ℕ} {P0 : Model.Params} {β γ : Type} {f : γ → β → Model.CM (ForInStep β)} {I : β → Prop} (l : List γ) (b : β) :
            I b → (∀ x ∈ l, ∀ (b : β), I b → HT K P0 (f x b) fun (r : ForInStep β) => I r.value) → HT K P0 (forIn l b f) I

            A loop over a list, each iteration knowing its element is in the list.

            theorem OrderMaintenance.Proof.Word.HT.forM_list {K : ℕ} {P0 : Model.Params} {γ : Type} (l : List γ) {f : γ → Model.CM PUnit.{1}} (hf : ∀ x ∈ l, HT K P0 (f x) fun (x : PUnit.{1}) => True) :
            HT K P0 (l.forM f) fun (x : PUnit.{1}) => True
            theorem OrderMaintenance.Proof.Word.HT.mapM_list {K : ℕ} {P0 : Model.Params} {γ δ : Type} (l : List γ) {f : γ → Model.CM δ} {Q : δ → Prop} (hf : ∀ x ∈ l, HT K P0 (f x) Q) :
            HT K P0 (List.mapM f l) fun (r : List δ) => ∀ y ∈ r, Q y
            theorem OrderMaintenance.Proof.Word.HT.ok {K : ℕ} {P0 : Model.Params} {α : Type} {m : Model.CM α} {Q : α → Prop} (h : HT K P0 m Q) {s s' : Model.Core} {a : α} (hs : WB K s) (hP : s.P = P0) (hr : EStateM.run m s = EStateM.Result.ok a s') :
            (WB K s' ∧ s'.P = P0) ∧ Q a

            A normal run from a good state ends in a good state.

            theorem OrderMaintenance.Proof.Word.HT.state {K : ℕ} {P0 : Model.Params} {α : Type} {m : Model.CM α} {Q : α → Prop} (h : HT K P0 m Q) {s : Model.Core} (hs : WB K s) (hP : s.P = P0) :

            Any run from a good state ends in a good state.

            Reads.

            theorem OrderMaintenance.Proof.Word.HT.getP_bind {K : ℕ} {P0 : Model.Params} {β : Type} {f : Model.Params → Model.CM β} {Q : β → Prop} (h : HT K P0 (f P0) Q) :
            HT K P0 (Model.getP >>= f) Q

            Reading the parameters gives P0.

            theorem OrderMaintenance.Proof.Word.HT.require {K : ℕ} {P0 : Model.Params} {b : Bool} {msg : String} :
            HT K P0 (Model.require b msg) fun (x : Unit) => True

            Decompose a computation into primitive state updates, using the given lemmas for calls. The results of binds become anonymous hypotheses. Leaves goals of the form ∀ s, WB K s → s.P = P0 → WB K (f s) ∧ (f s).P = P0 for the updates, and the result predicates of pure.

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

              Applies the stored-value Hoare rules, splitting the core computation into primitive steps.

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

                Split WB K s' into its components and close those that s' shares with a state t of which h : WB K t. The remaining goals are the components that changed.

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

                  Close the goals ht leaves: an update goal, by wbx and wbv; a result goal, by vb.

                  Equations
                  Instances For