M6: a list library for the core language #
Procedures on list k of record i, each with its agreement lemma:
findP k: the position of the first element with keyx(List.findIdx), or the length.assocSetP k:assocSetwith keyxand valuey.lookupP k:lookupof keyx(found flagf, valuev).insertIdxP k: insert(a, b)at positionp(List.insertIdx).copyS k: append listkof recordato listkof recordw.
Procedure finding the first index of a key in a stored list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
List replacement #
The list can be put back without change.
Equations
- OrderMaintenance.Impl.LK.idOk s i OrderMaintenance.Impl.LK.cin = (i < s.cin.size)
- OrderMaintenance.Impl.LK.idOk s i x✝ = (OrderMaintenance.Impl.LK.recOk s i x✝ = true)
Instances For
assocSet #
Procedure replacing an association-list value or appending a fresh key.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Impl.assocSetP_agree
(κ : Caps)
(k : LK)
(s : Model.Core)
(L : Loc)
{i x y : ℕ}
(hi : L "i" = i)
(hx : L "x" = x)
(hy : L "y" = y)
(hid : LK.idOk s i k)
(hr : LK.recOk s i k = true)
(hir : i < κ.lrec k)
(hyv : ∀ (a : ℕ), LK.valid [(a, y)] k = true)
(hcap : (Model.assocSet (LK.view s i k) x y).length ≤ κ.lcap k)
:
assocSetP computes assocSet.
lookup #
Procedure returning whether an association key exists and its stored value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
insertIdx #
Exchange the working pair with one stored list entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Procedure inserting a pair at a specified list index.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Impl.lwr_put_ok
{κ : Caps}
{k : LK}
{s : Model.Core}
{Lc : Loc}
{i y w : ℕ}
{L0 : List (ℕ × ℕ)}
(snd : Bool)
{jx ex : Exp}
(hLi : Lc "i" = i)
(hj : Exp.ev κ (LK.put s i L0 k) Lc jx = some y)
(he : Exp.ev κ (LK.put s i L0 k) Lc ex = some w)
(hy : y < L0.length)
(hr : LK.recOk s i k = true)
(hir : i < κ.lrec k)
(hv0 : LK.valid L0 k = true)
(hvn : LK.valid [if snd = true then ((L0.getD y (0, 0)).1, w) else (w, (L0.getD y (0, 0)).2)] k = true)
(hlen : L0.length ≤ κ.lcap k)
:
A component write to a list that has been put.
theorem
OrderMaintenance.Impl.swapS_ok
{κ : Caps}
{k : LK}
{s : Model.Core}
{L : Loc}
{i : ℕ}
{l : List (ℕ × ℕ)}
{x : ℕ × ℕ}
{m t : ℕ}
(hLi : L "i" = i)
(hLn : L "n" = l.length)
(hLt : L "t" = t)
(hm : m + t = l.length)
(h1 : 1 ≤ m)
(hr : LK.recOk s i k = true)
(hir : i < κ.lrec k)
(hvl : LK.valid l k = true)
(hvx : LK.valid [x] k = true)
(hcap : l.length + 1 ≤ κ.lcap k)
:
theorem
OrderMaintenance.Impl.insertIdxP_agree
(κ : Caps)
(k : LK)
(s : Model.Core)
(L : Loc)
{i p a b : ℕ}
(hi : L "i" = i)
(hp : L "p" = p)
(ha : L "a" = a)
(hb : L "b" = b)
(hr : LK.recOk s i k = true)
(hir : i < κ.lrec k)
(hab : LK.valid [(a, b)] k = true)
(hpl : p ≤ (LK.view s i k).length)
(hcap : (LK.view s i k).length + 1 ≤ κ.lcap k)
:
insertIdxP computes insertIdx.
Copying a list #
Append one entry of the source list to the destination list.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Append the source list to the destination list in list order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Impl.copyS_ok
{κ : Caps}
{k : LK}
{s : Model.Core}
{L : Loc}
{a w : ℕ}
(ha : L "a" = a)
(hw : L "w" = w)
(hne : w ≠ a)
(hid : LK.idOk s w k)
(hr : LK.recOk s w k = true)
(hra : a < κ.lrec k)
(hrw : w < κ.lrec k)
(hcap : (LK.view s w k).length + (LK.view s a k).length ≤ κ.lcap k)
:
copyS appends list k of record a to that of record w (w ≠ a).