The safety invariant INV-S (docs/PROOF.md §3.1) #
A core satisfies INV-S with respect to an abstract nesting A (the chunk list, and for each
chunk its run of groups, for each group its run of elements) when:
- the element, group and chunk lists are doubly linked lists, given by
A; - the runs'
first/lastpointers and thegrp/chkfields agree withA; - labels increase along each run, and tags along the chunk list.
Plus the facts that make the guards meaningful: a group or chunk outside the lists has NIL
links (so an adjacency guard next(a) = b proves a is in the list), a group is alive iff it
is in the list, and the free list holds only unused groups.
Lemma 3.1 (keys_sorted): keys strictly increase along the element list.
Linked lists #
The element after x in l (NIL if x is last or absent).
Equations
- OrderMaintenance.Proof.succOf (a :: b :: t) x✝ = if a = x✝ then b else OrderMaintenance.Proof.succOf (b :: t) x✝
- OrderMaintenance.Proof.succOf x✝¹ x✝ = OrderMaintenance.Model.NIL
Instances For
first/last pointers of a run r (NIL for an empty run).
Equations
- OrderMaintenance.Proof.Ends first last r = (first = r.headD OrderMaintenance.Model.NIL ∧ last = r.getLastD OrderMaintenance.Model.NIL)
Instances For
Field accessors #
Next element index.
Equations
- OrderMaintenance.Proof.eN s e = (s.E.getX e).next
Instances For
Previous element index.
Equations
- OrderMaintenance.Proof.eP s e = (s.E.getX e).prev
Instances For
Containing group of an element.
Equations
- OrderMaintenance.Proof.eG s e = (s.E.getX e).grp
Instances For
Element order label.
Equations
- OrderMaintenance.Proof.eL s e = (s.E.getX e).lab
Instances For
Next group index.
Equations
- OrderMaintenance.Proof.gN s g = (s.Gs.getX g).next
Instances For
Previous group index.
Equations
- OrderMaintenance.Proof.gP s g = (s.Gs.getX g).prev
Instances For
First element of a group.
Equations
- OrderMaintenance.Proof.gF s g = (s.Gs.getX g).first
Instances For
Last element of a group.
Equations
- OrderMaintenance.Proof.gLs s g = (s.Gs.getX g).last
Instances For
Containing chunk of a group.
Equations
- OrderMaintenance.Proof.gC s g = (s.Gs.getX g).chk
Instances For
Group order label.
Equations
- OrderMaintenance.Proof.gL s g = (s.Gs.getX g).lab
Instances For
Liveness flag of a group.
Equations
- OrderMaintenance.Proof.gA s g = (s.Gs.getX g).alive
Instances For
Next chunk index.
Equations
- OrderMaintenance.Proof.cN s c = (s.C.getX c).next
Instances For
Previous chunk index.
Equations
- OrderMaintenance.Proof.cP s c = (s.C.getX c).prev
Instances For
First group of a chunk.
Equations
- OrderMaintenance.Proof.cF s c = (s.C.getX c).first
Instances For
Last group of a chunk.
Equations
- OrderMaintenance.Proof.cLs s c = (s.C.getX c).last
Instances For
Chunk order tag.
Equations
- OrderMaintenance.Proof.cT s c = (s.C.getX c).tag
Instances For
The abstract nesting #
Concatenate the chunk-local group lists in global order.
Equations
- A.glist = List.flatMap A.grps A.chunks
Instances For
Concatenate the group-local element lists in global order.
Equations
- A.elist = List.flatMap A.elts A.glist
Instances For
INV-S #
Structural, allocation, label and membership invariants of a core’s abstract nesting.
- gList : LList (gN s) (gP s) s.firstGroup A.glist
- cList : LList (cN s) (cP s) s.firstChunk A.chunks
Instances For
Transfer: INV depends only on the fields it mentions #
The fields INV-S reads (except the chunk tags), and the element records, are equal.
Instances For
Lemma 3.1: keys increase along the element list #
The key of an element: (chunk tag, group label, element label).
Equations
- One or more equations did not get rendered due to their size.