incremental = batch
Invariance
Change whether records are folded in parts or all at once, and the state stays.
Proved for Count and LatestBy. Sum, Min and Max are step folds, for which it holds by construction; folds over heads inherit it from LatestBy's state (heads.late).
laws.md folding xs then ys is folding xs ++ ys
- proved by
Count.batch
Laws.Fold
∀ (n : Nat) (xs ys : List Record), Count.fold (Count.fold n xs) ys = Count.fold n (xs ++ ys)
LatestBy.batch
Laws.Fold
∀ (s : LatestBy) (xs ys : List Record), (s.fold xs).fold ys = s.fold (xs ++ ys)
- pinned by
- every fold vector
- carries
heads.late latest-by.converge
In its question
count.perm
Invariance
Change the arrival order, and the count stays.
laws.md arrival order doesn't change a count
- proved by
Count.perm
Laws.Fold
∀ {xs ys : List Record}, xs.Perm ys → ∀ (n : Nat), Count.fold n xs = Count.fold n ys
- pinned by
fold/count/01-empty (current main; may differ from this page's build) fold/count/02-three (current main; may differ from this page's build)also naming it: fold/count/04-utc-emitted (current main; may differ from this page's build) fold/count/gap15-multi-thing-once (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its questionTry to break it
count.repeats
Limit
Deliver the whole set twice and each record is counted again: the count doubles. Any record delivered again is counted again. That is why the read path hands each id over once (input.distinct).
laws.md a repeated delivery is counted again, which is why the read path hands each id over once
- proved by
Count.repeats
Laws.Fold
∀ (xs : List Record), Count.fold 0 (xs ++ xs) = 2 * Count.fold 0 xs
- pinned by
fold/count/03-repeats-counted (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its questionTry to break it
latest-by.set
Invariance
Change how the records arrive, the set kept, and every thing's state (its heads and winner) stays.
Within one store an id names one record.
laws.md the state depends only on the set of records folded
- proved by
LatestBy.set_decides
Laws.Fold
∀ {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → LatestBy.empty.fold xs = LatestBy.empty.fold ys
- pinned by
18 files
fold/latest-by/01-one (current main; may differ from this page's build) fold/latest-by/02-fork (current main; may differ from this page's build) fold/latest-by/03-chain (current main; may differ from this page's build) fold/latest-by/04-chain-late (current main; may differ from this page's build) fold/latest-by/05-emitted-breaks-tie (current main; may differ from this page's build) fold/latest-by/06-id-breaks-tie (current main; may differ from this page's build) fold/latest-by/07-merge (current main; may differ from this page's build) fold/latest-by/08-repeats (current main; may differ from this page's build) fold/latest-by/09-converge (current main; may differ from this page's build) fold/latest-by/10-two-things (current main; may differ from this page's build) fold/latest-by/11-dangling-prev (current main; may differ from this page's build) fold/latest-by/12-emitted-without-occurred (current main; may differ from this page's build) fold/latest-by/13-span-order (current main; may differ from this page's build) fold/latest-by/14-about-makes-no-head (current main; may differ from this page's build) fold/latest-by/15-of-read-as-written (current main; may differ from this page's build) fold/latest-by/gap15-memberships-and-anchor (current main; may differ from this page's build) fold/latest-by/phase2-self-prev (current main; may differ from this page's build) fold/latest-by/phase2-self-prev-anchor (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order
- carries
by.set heads.set keyed.spec-slice latest-by.converge latest-by.repeats spec.set spec.slice thing.local
In its questionTry to break itWithout its premise
latest-by.order
Order
The winner is a head: nothing about its thing names it in prev. It is newer than every other head by content order: span, then emitted, then id.
laws.md The winner is a head, newer than every other head. Head membership follows prev; content order compares span, emitted, then id.
- proved by
LatestBy.winner_newer
Laws.Families
∀ {xs : List Record}, Addressed xs → ∀ {w : Record}, (LatestBy.empty.fold xs).winner = some w → (w ∈ xs ∧ ¬∃ r, r ∈ xs ∧ w.id ∈ r.prev) ∧ ∀ (o : Record), o ∈ (LatestBy.empty.fold xs).others → Newer w o
- pinned by
fold/latest-by/02-fork (current main; may differ from this page's build) fold/latest-by/05-emitted-breaks-tie (current main; may differ from this page's build) fold/latest-by/06-id-breaks-tie (current main; may differ from this page's build) fold/latest-by/12-emitted-without-occurred (current main; may differ from this page's build) fold/latest-by/13-span-order (current main; may differ from this page's build)also naming it: scenario/01-decision (current main; may differ from this page's build) scenario/phase2-thing-state (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order
In its question
latest-by.repeats
Invariance
Change how many times a record is delivered, and the state stays.
Within one store an id names one record.
laws.md re-delivering records changes nothing
- proved by
LatestBy.repeats
Laws.Fold
∀ {xs : List Record}, Addressed xs → LatestBy.empty.fold (xs ++ xs) = LatestBy.empty.fold xs
- pinned by
fold/latest-by/08-repeats (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
latest-by.set
In its question
latest-by.converge
Invariance
Change which way two places sync, and the state both reach stays.
laws.md two places syncing in either direction reach the same state
- proved by
LatestBy.converge
Laws.Fold
∀ {xs ys : List Record}, Addressed (xs ++ ys) → (LatestBy.empty.fold xs).fold ys = (LatestBy.empty.fold ys).fold xs
- pinned by
fold/latest-by/09-converge (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
incremental = batch latest-by.set
In its question
latest.set, latest.repeats
Invariance
Change arrival order and repeats, and Latest's whole-reader heads and winner stay.
laws.md the input set decides Latest's whole-reader heads and winner
- proved by
Latest.set_decides
Laws.Things
∀ {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → Latest.fold xs = Latest.fold ysLatest.perm
Laws.Things
∀ {xs ys : List Record}, Addressed xs → xs.Perm ys → Latest.fold xs = Latest.fold ysLatest.repeats
Laws.Things
∀ {xs : List Record}, Addressed xs → Latest.fold (xs ++ xs) = Latest.fold xs
- pinned by
fold/latest/01-chain (current main; may differ from this page's build) fold/latest/02-fork (current main; may differ from this page's build) fold/latest/03-merge (current main; may differ from this page's build) fold/latest/04-repeats (current main; may differ from this page's build) fold/latest/gap16-newest-union-head (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
thing.local
In its question
heads.whole-view
Exactness
Whole-reader heads combine every thing's heads, once per id, in content order.
laws.md every head belongs to some thing; heads occur once per id in content order
- proved by
mem_wholeHeads
Laws.Things
∀ {xs : List Record}, Addressed xs → ∀ {r : Record}, r ∈ wholeHeads xs ↔ ∃ t, t ∈ thingsOf xs ∧ r ∈ (stateIn t xs).headswholeHeads_sorted
Laws.Things
∀ {xs : List Record}, Addressed xs → List.Pairwise Newer (wholeHeads xs)wholeHeads_distinct
Laws.Things
∀ {xs : List Record}, Addressed xs → Distinct (wholeHeads xs)
- pinned by
fold/heads/gap15-partial-and-anchor (current main; may differ from this page's build) fold/latest/gap16-newest-union-head (current main; may differ from this page's build) fold/view/gap15-partial-and-anchor (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order input.distinct
- carries
by.set keyed.whole-read latest.newest latest.one-thing result.unread spec.follow spec.slice
In its question
latest.newest
Order
Latest chooses the newest whole-reader head. Its other heads stay in content order.
laws.md Latest chooses the newest whole-reader head; its other heads stay in content order
- proved by
Latest.winner_newest
Laws.Things
∀ {xs : List Record}, Addressed xs → ∀ {w : Record}, Latest.winner (Latest.fold xs) = some w → (∃ t, t ∈ thingsOf xs ∧ w ∈ (stateIn t xs).heads) ∧ ∀ (o : Record), o ∈ wholeHeads xs → o = w ∨ Newer w oLatest.others_ordered
Laws.Things
∀ {xs : List Record}, Addressed xs → List.Pairwise Newer (Latest.others (Latest.fold xs))
- pinned by
fold/latest/01-chain (current main; may differ from this page's build) fold/latest/gap16-newest-union-head (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
heads.whole-view
In its question
latest.one-thing
Exactness
Latest equals the previous global LatestBy state on one-thing input.
Holds when every record is of the same thing.
laws.md Latest equals global LatestBy when every record is of the same thing
- proved by
Latest.oneThing
Laws.Things
∀ {t : String} {xs : List Record}, Addressed xs → OneThing t xs → Latest.fold xs = LatestBy.empty.fold xs
- pinned by
fold/latest/01-chain (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order content order heads.whole-view
In its question
payload.read
Exactness
A stored opening supplies the top-level fields of its payload. Reading depends only on that payload. A held non-object supplies no fields.
Lookup in an object reads the value written under that name. Every member retained from a list can be named by an equality argument. An erased opening gives the erased view.
laws.md An opening gives the fields of its payload alone. Each object member supplies the reading of its value. Every member retained from a list can be named by an equality argument. A held non-object gives no fields. An erased opening gives the erased view.
- proved by
Stored.read_opening
Laws.Payload
∀ (env : Env) (salt : List UInt8) (p : Json) (r : Record), (make env salt p).readInto r = { id := r.id, kind := r.kind, observer := r.observer, about := r.about, of := r.of, prev := r.prev, under := r.under, occurred := r.occurred, emitted := r.emitted, erases := r.erases, sets := r.sets, fields := payloadFields p }Stored.fields_payload_only
Laws.Payload
∀ (e e' : Env) (s s' : List UInt8) (p : Json) (r r' : Record), ((make e s p).readInto r).fields = ((make e' s' p).readInto r').fields
Stored.read_erased
Laws.Payload
∀ (e : Env) (commit : String) (r : Record), { env := e, body := Body.erased commit }.readInto r = r.erasepayloadFields_nonobject
Laws.Payload
∀ (p : Json), (∀ (kvs : List (String × Json)), p ≠ Json.obj kvs) → payloadFields p = []
payloadFields_lookup
Laws.Payload
∀ (kvs : List (String × Json)) (f : String), List.lookup f (payloadFields (Json.obj kvs)) = Option.map readHeld (List.lookup f kvs)
readHeld_members_nameable
Laws.Payload
∀ (xs : List Json) (vs : List Val), readHeld (Json.arr xs) = HeldField.many vs → ∀ (v : Val), v ∈ vs → v.nameable = true
- pinned by
18 files
payload/01-empty-object (current main; may differ from this page's build) payload/02-top-null (current main; may differ from this page's build) payload/03-top-boolean (current main; may differ from this page's build) payload/04-top-text (current main; may differ from this page's build) payload/05-top-whole (current main; may differ from this page's build) payload/06-top-fraction (current main; may differ from this page's build) payload/07-top-list (current main; may differ from this page's build) payload/08-scalars (current main; may differ from this page's build) payload/09-number-spellings (current main; may differ from this page's build) payload/10-safe-bounds (current main; may differ from this page's build) payload/11-written-other (current main; may differ from this page's build) payload/12-list-members (current main; may differ from this page's build) payload/13-no-readable-members (current main; may differ from this page's build) payload/14-repeats-and-collisions (current main; may differ from this page's build) payload/15-routes-a (current main; may differ from this page's build) payload/16-routes-b (current main; may differ from this page's build) payload/17-routes-ab (current main; may differ from this page's build) payload/18-envelope-names (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
numeric.safe-whole
Exactness
Numeric slots read written safe-whole values only when the payload is here. Missing fields, lists and other values without a safe whole count as unread.
An unreadable field leaves a sum as it was. Min and Max read a record exactly when its n is a held safe whole number.
laws.md Numeric slots read written safe-whole values only when the payload is here. Missing fields, lists and other values without a safe whole count as unread. An unreadable field leaves Sum.on's sum as it was. Max.acc and Min.acc read a record exactly when its n is a held safe whole number.
- proved by
Record.num_safe
Laws.Numeric
∀ {r : Record} {field : String} {i : Int}, r.num field = some i → -(2 ^ 53 - 1) ≤ i ∧ i ≤ 2 ^ 53 - 1Record.num_number
Laws.Numeric
∀ {r : Record} {field : String} {n : Number}, r.get field = some (HeldField.one (Val.number n)) → r.num field = noneRecord.num_hidden
Laws.Numeric
∀ {r : Record} (field : String), r.shown ≠ Shown.here → r.num field = noneRecord.num_many
Laws.Payload
∀ (r : Record) (f : String) (vs : List Val), r.get f = some (HeldField.many vs) → r.num f = none
Sum.on_step_missing
Laws.Families
∀ {field : String} {r : Record} (s : Int), r.num field = none → (Sum.on field).step s r = sMax.acc_readable
Laws.Families
∀ (r : Record), Max.acc.readable r = (r.num "n").isSome
Min.acc_readable
Laws.Families
∀ (r : Record), Min.acc.readable r = (r.num "n").isSome
- pinned by
spec/run/gap14-field-types (current main; may differ from this page's build) spec/run/pv7-list-numeric (current main; may differ from this page's build)also naming it: realm/phase2-exact-output (current main; may differ from this page's build) scenario/phase2-exact-output (current main; may differ from this page's build) spec/run/phase2-exact-output (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
sum.perm
Invariance
Change the arrival order, and the sum stays.
The model, JS and Rust use unbounded integer sums. A future bounded port must refuse overflow with sum-overflow, never wrap.
laws.md arrival order doesn't change a sum
- proved by
Sum.perm
Laws.Numeric
∀ (p : Record → Option Int) {xs ys : List Record}, xs.Perm ys → ∀ (s : Int), Sum.fold p s xs = Sum.fold p s ys
- pinned by
fold/sum/01-empty (current main; may differ from this page's build) fold/sum/02-mixed-signs (current main; may differ from this page's build)also naming it: fold/select/phase2-exact-output (current main; may differ from this page's build) fold/sum/gap15-multi-thing-once (current main; may differ from this page's build) fold/sum/phase2-exact-output (current main; may differ from this page's build) realm/phase2-exact-output (current main; may differ from this page's build) scenario/phase2-exact-output (current main; may differ from this page's build) spec/run/phase2-exact-output (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
sum.repeats
Limit
For every numeric projection, delivering the list twice doubles the sum. Each readable value is added once per delivery. That is why the read path hands each id over once (input.distinct).
laws.md for every numeric projection, delivering the list twice doubles the sum of the readable values, which is why the read path hands each id over once
- proved by
Sum.repeats
Laws.Numeric
∀ (p : Record → Option Int) (xs : List Record), Sum.fold p 0 (xs ++ xs) = 2 * Sum.fold p 0 xs
- pinned by
fold/sum/03-repeats-counted (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
extrema.set
Invariance
Change arrival order and repeats, and the min or the max stays.
laws.md Min and Max depend only on the set of records
- proved by
Max.set_decides
Laws.Numeric
∀ (p : Record → Option Int) {xs ys : List Record}, (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → Max.fold p none xs = Max.fold p none ysMin.set_decides
Laws.Numeric
∀ (p : Record → Option Int) {xs ys : List Record}, (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → Min.fold p none xs = Min.fold p none ys
- pinned by
fold/extrema/01-empty (current main; may differ from this page's build) fold/extrema/02-mixed-signs (current main; may differ from this page's build) fold/extrema/03-ties (current main; may differ from this page's build) fold/extrema/04-repeats (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
acc.set
Invariance
Change the order, for any step that commutes, and the state stays.
laws.md any step that commutes gives the same state for the same set
- proved by
Acc.set_decides
Laws.Families
∀ {σ : Type} (f : Acc σ) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → f.fold xs = f.fold ys
- pinned by
- every count, sum, extrema vector
- carries
acc.late
In its question
acc.late
Invariance
Change whether a late record, not yet folded, is folded onto the cached state or the whole set refolded, and the new state stays.
laws.md a late record folds onto the cached state
- proved by
Acc.late
Laws.Families
∀ {σ : Type} (f : Acc σ) {xs ys : List Record} (r : Record), Distinct (xs ++ [r]) → Distinct ys → (∀ (q : Record), q ∈ ys ↔ q ∈ xs ∨ q = r) → f.step (f.fold xs) r = f.fold ys
- pinned by
- (follows from
acc.set)
- rests on
acc.set
In its question
heads.set
Invariance
Change how the records arrive, the set kept, and any answer worked out from the heads stays.
laws.md any answer worked out from the heads depends only on the set
- proved by
OverHeads.set_decides
Laws.Families
∀ {σ : Sort u_1} (answer : LatestBy → σ) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → OverHeads.fold answer xs = OverHeads.fold answer ys
- pinned by
fold/heads/01-max-follows-prev (current main; may differ from this page's build) fold/heads/02-superseded-max-leaves (current main; may differ from this page's build) fold/heads/03-limit-newest-first (current main; may differ from this page's build) fold/heads/gap15-partial-and-anchor (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
latest-by.set
- carries
heads.late spec.follow
In its question
heads.late
Invariance
Change whether a late record is folded onto the cached heads or the whole set refolded, and any answer worked out from the new heads stays.
laws.md a late record folds onto the cached heads of the records folded; a reader folds admitted records, and admission can retract (admit.late)
- proved by
OverHeads.late
Laws.Families
∀ {σ : Sort u_1} (answer : LatestBy → σ) {xs ys : List Record} (r : Record), Addressed (xs ++ [r]) → Addressed ys → (∀ (q : Record), q ∈ ys ↔ q ∈ xs ∨ q = r) → answer ((LatestBy.empty.fold xs).step r) = OverHeads.fold answer ys
- pinned by
- (follows from
heads.set)
- rests on
heads.set incremental = batch
In its question
heads.why
Limit
Max's scalar state cannot maintain the maximum over changing heads. Folds over heads therefore keep LatestBy's state.
laws.md Max's scalar state cannot maintain the maximum over changing heads
- proved by
Max.cannot_follow_prev
Laws.Families
¬∃ g, ∀ (xs : List Record) (r : Record), Distinct (xs ++ [r]) → g (Max.fold (fun x => x.num "n") none xs) r = (OverHeads.fold LatestBy.maxHeads (xs ++ [r])).value
- pinned by
fold/heads/01-max-follows-prev (current main; may differ from this page's build) fold/heads/02-superseded-max-leaves (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
result.unread
Refinement
A fold does not guess. It counts the records whose test is unknown and the selected records it cannot read.
Count can read every selected record. Latest-by counts each head once when its payload tests are unknown, after the source and envelope tests select it. Collect counts each unknown record once, before its limit. It counts heads when it follows replacements, and all records otherwise. Count, sum, min and max that follow replacements count each unknown chosen head once, as latest-by does. Max over heads counts each head whose n field lacks a readable safe whole value. Numeric folds count hidden, missing, nonnumeric, nonwhole and unsafe whole values as unread.
laws.md A fold does not guess. It counts the records whose test is unknown and the selected records it cannot read.
- proved by
LatestBy.maxHeads_view
Laws.Families
∀ {f : Record → Record}, View f → ∀ {xs : List Record}, Addressed xs → (OverHeads.fold LatestBy.maxHeads (List.map f xs)).unread = (List.filter (fun h => ((f h).num "n").isNone) (LatestBy.empty.fold xs).heads).lengthAcc.select_unread
Laws.Families
∀ {σ : Type} (f : Acc σ) (ev : Record → Tri) (xs : List Record), (f.select ev xs).unread = (List.filter (fun r => ev r == Tri.unknown || ev r == Tri.yes && !f.readable r) xs).lengthCount.select_unread
Laws.Families
∀ (ev : Record → Tri) (xs : List Record), (Count.acc.select ev xs).unread = (List.filter (fun x => ev x == Tri.unknown) xs).length
latestOf_unread
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) (xs : List Record) {ts : List (String × List (RecordId × Shown))} {u : Nat}, latestOf sel cs xs = SlotValue.things ts u → u = (idsOf (List.filter (fun r => chosen sel cs r && payTest cs r == Tri.unknown) (List.flatMap (fun x => x.snd.heads) (perThing xs)))).lengthcollectOf_unread
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) (follow : Bool) (limit : Option Nat) {xs : List Record}, Addressed xs → ∀ {hs : List (RecordId × Shown)} {u : Nat}, collectOf sel cs follow limit xs = SlotValue.heads hs u → u = (idsOf (List.filter (fun r => chosen sel cs r && payTest cs r == Tri.unknown) (if follow = true then List.flatMap (fun x => x.snd.heads) (perThing xs) else xs))).lengthCount.followed_unread
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) {xs : List Record}, Addressed xs → (Count.acc.select (fun r => if sel r = true then Cond.all cs r else Tri.no) (accPool (some Follow.prev) xs)).unread = (idsOf (List.filter (fun r => chosen sel cs r && payTest cs r == Tri.unknown) (wholeHeads xs))).length
- pinned by
7 files
fold/select/01-payload-test-on-withheld (current main; may differ from this page's build) fold/select/02-envelope-test-on-withheld (current main; may differ from this page's build) fold/select/03-all-here (current main; may differ from this page's build) fold/select/phase2-exact-output (current main; may differ from this page's build) fold/view/04-max-counts-unread-heads (current main; may differ from this page's build) spec/run/02-withheld-payload (current main; may differ from this page's build) spec/run/03-withheld-successor (current main; may differ from this page's build) also naming it: scenario/by-01-erased-in-another-group (current main; may differ from this page's build) scenario/keys-01-settled-setter (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build) spec/run/11-hidden-numbers (current main; may differ from this page's build) spec/run/12-readable-extrema (current main; may differ from this page's build) spec/run/16-follow-current (current main; may differ from this page's build) spec/run/18-follow-erased-head (current main; may differ from this page's build) spec/run/19-follow-payload-test (current main; may differ from this page's build) spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build) spec/run/29-by-collect-limit (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/40-keys-payload-tests (current main; may differ from this page's build) spec/run/44-keys-numbers (current main; may differ from this page's build) spec/run/45-keys-by-payload (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/51-keys-collect-limit (current main; may differ from this page's build) spec/run/gap04-unread-multi-thing (current main; may differ from this page's build) spec/run/gap05-unread-before-limit (current main; may differ from this page's build) spec/run/gap12-no-unknown (current main; may differ from this page's build) spec/run/gap13-missing-and-withheld (current main; may differ from this page's build) spec/run/gap14-field-types (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order heads.whole-view spec.follow view.no-resurrection
- carries
by.partition spec.follow
In its question
result.full
Refinement
When every test answers and every covered record is readable to the fold, unread is zero. The result equals the selected fold.
A payload that is here but lacks the field, or holds it as text, isn't readable to a numeric fold.
laws.md when every test answers and every record is readable to the fold, nothing is unread and the result is the plain fold
- proved by
Acc.select_full
Laws.Families
∀ {σ : Type} (f : Acc σ) (ev : Record → Tri) {xs : List Record}, (∀ (r : Record), r ∈ xs → ev r ≠ Tri.unknown) → (∀ (r : Record), r ∈ xs → f.readable r = true) → f.select ev xs = { value := f.fold (List.filter (fun x => ev x == Tri.yes) xs), unread := 0 }
- pinned by
fold/select/03-all-here (current main; may differ from this page's build)also naming it: fold/select/phase2-exact-output (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its questionWithout its premise
select.set
Invariance
Change the order the records arrive in, and the split into read and unread stays.
Each id is handed over once (input.distinct).
laws.md what is read and what is unread depend only on the set
- proved by
Acc.select_set_decides
Laws.Families
∀ {σ : Type} (f : Acc σ) (ev : Record → Tri) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → f.select ev xs = f.select ev ys
- pinned by
fold/select/01-payload-test-on-withheld (current main; may differ from this page's build) fold/select/02-envelope-test-on-withheld (current main; may differ from this page's build) fold/select/03-all-here (current main; may differ from this page's build) fold/select/phase2-exact-output (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
by.set keyed.spec-slice keyed.whole-read spec.slice
In its question
thing.one
Exactness
A record is of exactly one thing: what its of names, read as written, or without of its own id. A thing's heads are records of it, so a record heads at most one thing.
of is never resolved through another record, so a record's thing is a fact of its own envelope.
laws.md A record is of exactly one thing, what of names or else its own id. A thing's heads are records of it, so a record heads at most one thing.
- proved by
isOf_iff
Laws.Things
∀ {r : Record} {t : String}, r.isOf t = true ↔ r.thing = tisOf_unique
Laws.Things
∀ {r : Record} {t u : String}, r.isOf t = true → r.isOf u = true → t = ustateIn_heads_thing
Laws.Things
∀ {xs : List Record}, Addressed xs → ∀ {t : String} {r : Record}, r ∈ (stateIn t xs).heads → r.thing = theads_one_thing
Laws.Things
∀ {xs : List Record}, Addressed xs → ∀ {t u : String} {r : Record}, r ∈ (stateIn t xs).heads → r ∈ (stateIn u xs).heads → t = u
- pinned by
fold/latest-by/15-of-read-as-written (current main; may differ from this page's build) realm/06-root-names-its-thing (current main; may differ from this page's build) realm/11-of-read-as-written (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order
- carries
keyed.slots keyed.spec-slice keyed.whole-read spec.slice
In its question
thing.local
Invariance
Change the records not of this thing, once records are settled and admitted, and this thing's state stays.
Admission and erasure can read records not of this thing, so this starts after them.
laws.md For a fixed admitted set, a thing's state depends only on its records. The set decides per thing.
- proved by
stateIn_local
Laws.Things
∀ {t : String} {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ∧ r.isOf t = true ↔ r ∈ ys ∧ r.isOf t = true) → stateIn t xs = stateIn t ysperThing_set_decides
Laws.Things
∀ {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → perThing xs = perThing ys
- pinned by
23 files
fold/latest-by/01-one (current main; may differ from this page's build) fold/latest-by/02-fork (current main; may differ from this page's build) fold/latest-by/03-chain (current main; may differ from this page's build) fold/latest-by/04-chain-late (current main; may differ from this page's build) fold/latest-by/05-emitted-breaks-tie (current main; may differ from this page's build) fold/latest-by/06-id-breaks-tie (current main; may differ from this page's build) fold/latest-by/07-merge (current main; may differ from this page's build) fold/latest-by/08-repeats (current main; may differ from this page's build) fold/latest-by/09-converge (current main; may differ from this page's build) fold/latest-by/10-two-things (current main; may differ from this page's build) fold/latest-by/11-dangling-prev (current main; may differ from this page's build) fold/latest-by/12-emitted-without-occurred (current main; may differ from this page's build) fold/latest-by/13-span-order (current main; may differ from this page's build) fold/latest-by/14-about-makes-no-head (current main; may differ from this page's build) fold/latest-by/15-of-read-as-written (current main; may differ from this page's build) fold/latest-by/gap15-memberships-and-anchor (current main; may differ from this page's build) fold/latest-by/phase2-self-prev (current main; may differ from this page's build) fold/latest-by/phase2-self-prev-anchor (current main; may differ from this page's build) realm/04-cross-thing-prev-refused (current main; may differ from this page's build) realm/05-about-makes-no-head (current main; may differ from this page's build) realm/06-root-names-its-thing (current main; may differ from this page's build) realm/07-kind-change-supersedes (current main; may differ from this page's build) realm/08-prev-without-of-unrelated (current main; may differ from this page's build) also naming it: realm/10-successor-mentions-another-thing (current main; may differ from this page's build) realm/11-of-read-as-written (current main; may differ from this page's build) scenario/phase2-thing-state (current main; may differ from this page's build) spec/run/05-about-makes-no-head (current main; may differ from this page's build) spec/run/15-about-makes-no-head (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
latest-by.set record.sets
- carries
by.set keyed.fold latest.set, latest.repeats spec.set thing.slice
In its question
thing.mentions
Invariance
Change what records mention in about, and the things and each thing's heads stay.
Each head comes back with its new about. where and collect still read about, so their answers can change.
laws.md Changing only what records mention leaves the things and each thing's state: the same prev bookkeeping and the same heads, each with its new about.
- proved by
stateIn_about
Laws.Things
∀ (m : Record → List String) (t : String) {xs : List Record}, Addressed xs → stateIn t (List.map (mentioning m) xs) = { named := (stateIn t xs).named, heads := List.map (mentioning m) (stateIn t xs).heads }thingsOf_about
Laws.Things
∀ (m : Record → List String) (xs : List Record), thingsOf (List.map (mentioning m) xs) = thingsOf xs
- pinned by
fold/latest-by/14-about-makes-no-head (current main; may differ from this page's build) realm/05-about-makes-no-head (current main; may differ from this page's build) realm/10-successor-mentions-another-thing (current main; may differ from this page's build) spec/run/05-about-makes-no-head (current main; may differ from this page's build) spec/run/15-about-makes-no-head (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
view.no-resurrection
In its question
thing.slice
Invariance
Change whether a reader holds everything, or only a slice for this thing, and this thing's state, after settling and admission stays.
Holds when the store's rule for who may replace whom reads only envelopes; the forms of one id agree: the same envelope, and the same payload wherever it is held. This carries thing.local back across settling and admission, which read one hop out: the erases of other records, and the thing of each held prev target. The proof reads only the envelopes of the erasing and the named records, so a sender may withhold their payloads. Neither addition can be dropped: without the erasing record a slice reads a payload the whole has erased, and without the named record it admits a revision the whole refuses. A slot or spec that reads several things needs a slice for each.
laws.md A reader holding part of the set gets a thing's state exactly when its part is a slice. A slice holds every form of the records of the thing, every record that erases one of them, and every record one of them names in prev. Only the envelopes of the last two are read. Neither addition can be dropped.
- proved by
stateIn_slice
Laws.Slice
∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {t : String} {S W : List Record}, Forms W → Slice t S W → stateIn t (realm may S) = stateIn t (realm may W)slice_needs_erasers
Laws.Slice
stateIn "k1" (realm (fun x x_1 => true) [sl.x]) ≠ stateIn "k1" (realm (fun x x_1 => true) [sl.x, sl.e])
slice_needs_targets
Laws.Slice
stateIn "k1" (realm (fun x x_1 => true) [sl.s]) ≠ stateIn "k1" (realm (fun x x_1 => true) [sl.s, sl.p])
- pinned by
- (a part of a set: none yet)
- rests on
input.distinct settle.set thing.local
In its question
keyed.witnessed
Exactness
A reader holding part of a thing's records reads each record it holds as live for a key, or not, as a reader of all of them does, exactly when the part is witnessed for the key: every held setter the whole reads as dead has a setter of the key above it, through held records.
The envelope is one of the keys, so the same holds of heads. A part that is witnessed for every key and holds the thing's live records gives its whole keyed state (keyed.fold). The law has no premise: it says exactly which parts read rightly, and the laws after it give ways to be such a part. Holding less never makes a live record read as dead; what a part can get wrong is to read a replaced record as live, because the record that replaced it, or the path up to that record, is not held. This is about a part read alone: added to an older holding, a part that was witnessed need not stay so.
laws.md A reader holding part of a thing's records reads each record it holds as live for a key, or not, as a reader of all of them does, exactly when the part is witnessed for the key: every held setter the whole reads as dead has a setter of the key above it through held records. The envelope is one of the keys. A part that is witnessed for every key and holds the thing's live records gives its whole keyed state. Holding less never makes a live record read as dead.
- proved by
witnessed_iff
Laws.LiveSlice
∀ {U W : List Record}, (∀ (q : Record), q ∈ U → q ∈ W) → ∀ (o : Option String), Witnessed U W o ↔ ∀ (a : Record), a ∈ U → liveK U o a = liveK W o akeyedIn_part
Laws.LiveSlice
∀ {t : String} {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ recordsOf t ys → r ∈ recordsOf t xs) → (∀ (r : Record), r ∈ recordsOf t xs → live (recordsOf t xs) r = true → r ∈ recordsOf t ys) → (∀ (o : Option String), Witnessed (recordsOf t ys) (recordsOf t xs) o) → keyedIn t ys = keyedIn t xsliveK_part
Laws.LiveSlice
∀ {U W : List Record}, (∀ (q : Record), q ∈ U → q ∈ W) → ∀ {o : Option String} {r : Record}, liveK W o r = true → liveK U o r = true
- pinned by
- (a part of a set: none yet)
- rests on
content order input.distinct keyed.live record.sets
- carries
keyed.anchored keyed.base keyed.convex keyed.slice keyed.spec-slice
In its question
keyed.convex
Invariance
Change whether a reader holds every record of a thing, or a part that holds its live records and every record between two records of the part, and the thing's keyed state stays.
Holds when no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. Such a part is witnessed (keyed.witnessed): a dead setter has a live setter above it, and the part holds the path between them. It is one way to be witnessed and not the least: a part can be witnessed and not convex, when a later setter names the dead one directly. On an ordinary history the convex part is nearly every record since the oldest live one.
laws.md A part that holds every record between two of its own, and the thing's live records, is witnessed, so it gives the keyed state. It holds more than is needed: a part can be witnessed and not convex.
- proved by
witnessed_of_convex
Laws.LiveSlice
∀ {U W : List Record}, NoCycle W → Convex U W → ∀ (o : Option String), (∀ (a : Record), a ∈ W → liveK W o a = true → a ∈ U) → Witnessed U W okeyedIn_convex
Laws.LiveSlice
∀ {t : String} {xs ys : List Record}, Addressed xs → Addressed ys → NoCycle (recordsOf t xs) → (∀ (r : Record), r ∈ recordsOf t ys → r ∈ recordsOf t xs) → (∀ (r : Record), r ∈ recordsOf t xs → live (recordsOf t xs) r = true → r ∈ recordsOf t ys) → Convex (recordsOf t ys) (recordsOf t xs) → keyedIn t ys = keyedIn t xsconvex_not_needed
Laws.LiveSlice
Witnessed [lv.a, lv.c] [lv.a, lv.b, lv.c] (some "status") ∧ Witnessed [lv.a, lv.c] [lv.a, lv.b, lv.c] none ∧ ¬Convex [lv.a, lv.c] [lv.a, lv.b, lv.c]
- pinned by
- (a part of a set: none yet)
- rests on
keyed.live keyed.witnessed
In its question
keyed.anchored
Invariance
Change whether a reader holds every record of a thing, or only its live records, when every record names every live record under it, and the thing's keyed state: each key's live setters, the live records read whole, and the heads stays.
Holds when no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. The names are what the D8c writer's rule leaves behind: an emit names in prev, beside what it builds on, every live record of the thing its writer holds. Every record sets the envelope, so every two records share a key. Then each dead setter is named by the live setter above it, and the live records are witnessed with nothing between them (keyed.witnessed). The rule gives such names only to a holding that is closed, one that holds what the writers of its records held; a holder missing a record keeps as live a record it cannot see replaced, and reads wrongly from its own live records. The rule over payload keys alone gives the payload keys, and not the heads (keyed.heads).
laws.md When every record names every live record under it, the live records of a thing, read alone, give every key's live setters and the thing's whole keyed state. Writers that name every live record they hold leave such names in a holding that is closed: one that holds what the writers of its records held. A holder missing a record can read wrongly from its own live records. The rule over payload keys alone gives the payload keys.
- proved by
anchored_slice
Laws.LiveSlice
∀ {W : List Record}, NoCycle W → Anchored W → ∀ (o : Option String) {a : Record}, a ∈ W → (live W a = true ∧ liveK (liveOf W) o a = true ↔ liveK W o a = true)anchoredKeys_slice
Laws.LiveSlice
∀ {W : List Record}, NoCycle W → AnchoredKeys W → ∀ (k : String) {a : Record}, a ∈ W → (live W a = true ∧ liveFor (liveOf W) k a = true ↔ liveFor W k a = true)keyedIn_live
Laws.LiveSlice
∀ {t : String} {xs : List Record}, Addressed xs → NoCycle (recordsOf t xs) → Anchored (recordsOf t xs) → keyedIn t (liveOf (recordsOf t xs)) = keyedIn t xsanchored_of_written
Laws.LiveSlice
∀ {saw : Record → List Record} {W : List Record}, Addressed W → Anchoring saw W → ClosedOver saw W → Anchored Wclosed_needed
Laws.LiveSlice
Anchoring cl.saw [cl.x, cl.y, cl.y2] ∧ ¬ClosedOver cl.saw [cl.x, cl.y, cl.y2] ∧ liveFor (liveOf [cl.x, cl.y, cl.y2]) "a" cl.x = true ∧ liveFor [cl.x, cl.y, cl.y2] "a" cl.x = false
- pinned by
- (a part of a set: none yet)
- rests on
keyed.live keyed.witnessed
- carries
keyed.base keyed.cut keyed.heads
In its question
keyed.heads
Exactness
With anchored names, the live records of a thing read alone give its heads, and every live record is a head or is named by one.
Holds when no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. A head is live for the envelope, which every record sets (keyed.live), so this is keyed.anchored at that key. The heads list the slice: a reader that holds a thing's heads knows every other live record by name. With the rule over payload keys alone it fails: a record that sets title under two that set status is named by neither, and the live records read alone take it for a head.
laws.md A head is live for the envelope, which every record sets. So with anchored names the live records read alone give the thing's heads, and every live record is a head or is named by one: the heads list the slice. With the rule over payload keys alone, the live records can take a superseded record for a head.
- proved by
heads_slice
Laws.LiveSlice
∀ {W : List Record}, NoCycle W → Anchored W → ∀ {a : Record}, a ∈ W → (live W a = true ∧ liveEnv (liveOf W) a = true ↔ liveEnv W a = true)live_named_by_head
Laws.LiveSlice
∀ {W : List Record}, NoCycle W → Anchored W → ∀ {a : Record}, a ∈ W → live W a = true → liveEnv W a = true ∨ ∃ b, b ∈ W ∧ liveEnv W b = true ∧ a.id ∈ b.prevheads_need_env
Laws.LiveSlice
AnchoredKeys [hd.t, hd.s1, hd.s2] ∧ liveOf [hd.t, hd.s1, hd.s2] = [hd.t, hd.s2] ∧ liveEnv [hd.t, hd.s2] hd.t = true ∧ liveEnv [hd.t, hd.s1, hd.s2] hd.t = false
- pinned by
- (a part of a set: none yet)
- rests on
keyed.anchored keyed.live
In its question
keyed.cut
Invariance
Change whether a reader holds a part closed downward of a closed holding whose writers followed the rule, or only that part's live records, and what the part reads: each key's live setters, and the heads stays.
Holds when the store's rule for who may replace whom reads only envelopes; the forms of one id agree: the same envelope, and the same payload wherever it is held; no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. A part is closed downward when it holds every held record one of its records names in prev. Such a part is a state the holding could have been in: it reads a record as live for a key exactly when no setter of the key in the part is above it in the whole, with nothing missing between them. It also holds what the writers of its records held, because a writer names every record it holds that is live there and every other record it holds is under one of those. So the writer's rule carries to it and keyed.anchored applies. The premise is the rule, over what each writer held. Anchored names in the whole would not do: they are about what is live now, and a holding can have them while a past of it does not. Behind settling and admission, such a part holds what each of its records names in prev, so it holds the target a record is refused for and refuses what the whole refuses: with every form of the records of a thing it holds, and what erases them, keyed.slice and keyed.spec-slice apply to it with nothing asked about admission. A cut is such a part, or a slice of one.
laws.md A part closed downward, one that holds every held record its records name in prev, reads a record as live for a key exactly when no setter of the key in the part is above it in the whole. Where the writers followed the rule in a closed holding, such a part is closed too, so its live records, read alone, read every key as it does. It holds the target a record is refused for, so it refuses what the whole refuses.
- proved by
down_reads
Laws.LiveSlice
∀ {S W : List Record}, Down S W → ∀ (o : Option String) (r : Record), liveK S o r = true ↔ setsK o r = true ∧ ∀ (q : Record), q ∈ S → q ∈ above W r → setsK o q = falseclosedOver_of_down
Laws.LiveSlice
∀ {saw : Record → List Record} {S W : List Record}, NoCycle W → Anchoring saw W → ClosedOver saw W → Down S W → ClosedOver saw Sanchored_of_down
Laws.LiveSlice
∀ {saw : Record → List Record} {S W : List Record}, Addressed W → NoCycle W → Anchoring saw W → ClosedOver saw W → Down S W → Anchored SKeyedPart.of_down
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record}, EnvOnly may → ∀ {t : String}, Forms W → Down S W → (∀ (a : Record), a ∈ S → a.isOf t = true → ∀ (b : Record), b ∈ W → b.id = a.id → b ∈ S) → (∀ (a : Record), a ∈ S → a.isOf t = true → ∀ (e : Record), e ∈ W → e.erases.contains a.id = true → e ∈ S) → KeyedPart may t S W
- pinned by
- (a part of a set: none yet)
- rests on
keyed.anchored keyed.live keyed.spec-slice
- carries
keyed.base
In its question
keyed.base
Invariance
Change whether a writer writes from everything its store holds, or against a base: a part of it that holds what the writers of its records held, and that the store's names are anchored, so its live records read alone read every key as it does stays.
Holds when no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. An emit against a base names the records of the base that are live in the base. That is the emit a holder of exactly the base would have written, whatever the base is. The writer's rule has three parts: a writer names only what it holds, it names every record it holds that is live there, and it holds what the writers of its records held. The first two are the emit's. The third is the base's: it is a holding. A part closed downward of a closed holding is one (keyed.cut), and for that case the premise is that prev has no cycle. Then the store with the emit is closed and its writers followed the rule, so keyed.anchored applies to it. The base need not be closed downward itself: a part of a part closed downward that holds every record live in it will do, because it names what a holder of the closed part would name and nothing outside it. A thing's live records at a cut, alone, are such a base. A record live in the base and replaced in the store is named all the same: the emit then stands beside what replaced it as a second head, and a key both set shows as a conflict, which is what happened. An emit can name more than the base's live records: when what it adds is already under one of its names, the same records are above every record of the store, so the whole store reads every key as it would without the added names. Naming the live records of the base's closure in the store, and not of the bare base, is that, and the closure is a part closed downward. A base that is not closed breaks it: with a record that sets two keys, a second that sets one of them over it, and a base of the second alone, an emit of that key names the second and not the first, which is still live for its other key and is now under the emit unnamed; the live records read alone read the first as a live setter of the emit's key.
laws.md A writer can write against a base, a part of what its store holds: its emit names the records of the base that are live in the base, which is the emit a holder of exactly the base would have written. When the base holds what the writers of its records held, as a part closed downward does, or when it is a part of one and holds every record live in it, the store with the emit is still one whose writers followed the rule, so its names are anchored and its live records, read alone, read every key as it does. A base that is not closed can leave a live record under the emit unnamed, and the live records then show a conflict the whole does not have. An emit that names, besides, records already under it leaves every reading of the whole as it was.
- proved by
Anchoring.emit
Laws.LiveSlice
∀ {saw : Record → List Record} {W B : List Record} {y : Record}, Anchoring saw W → ClosedOver saw W → ¬y ∈ W → (∀ (x : Record), x ∈ B → x ∈ W) → ClosedOver saw B → (∀ (p : RecordId), p ∈ y.prev → ∃ x, x ∈ B ∧ x.id = p) → (∀ (x : Record), x ∈ B → live B x = true → x.id ∈ y.prev) → Anchoring (sawWith saw y B) (y :: W)anchored_emit
Laws.LiveSlice
∀ {saw : Record → List Record} {W B : List Record} {y : Record}, Addressed (y :: W) → Anchoring saw W → ClosedOver saw W → ¬y ∈ W → (∀ (x : Record), x ∈ B → x ∈ W) → ClosedOver saw B → (∀ (p : RecordId), p ∈ y.prev → ∃ x, x ∈ B ∧ x.id = p) → (∀ (x : Record), x ∈ B → live B x = true → x.id ∈ y.prev) → Anchored (y :: W)anchored_emit_down
Laws.LiveSlice
∀ {saw : Record → List Record} {W B : List Record} {y : Record}, Addressed (y :: W) → NoCycle W → Anchoring saw W → ClosedOver saw W → ¬y ∈ W → Down B W → (∀ (p : RecordId), p ∈ y.prev → ∃ x, x ∈ B ∧ x.id = p) → (∀ (x : Record), x ∈ B → live B x = true → x.id ∈ y.prev) → Anchored (y :: W)anchored_emit_live
Laws.LiveSlice
∀ {saw : Record → List Record} {W B D : List Record} {y : Record}, Addressed (y :: W) → NoCycle W → Anchoring saw W → ClosedOver saw W → ¬y ∈ W → Down D W → (∀ (x : Record), x ∈ B → x ∈ D) → (∀ (x : Record), x ∈ D → live D x = true → x ∈ B) → (∀ (p : RecordId), p ∈ y.prev → ∃ x, x ∈ B ∧ x.id = p) → (∀ (x : Record), x ∈ B → live B x = true → x.id ∈ y.prev) → Anchored (y :: W)liveK_emit_more
Laws.LiveSlice
∀ {W : List Record} {y y' : Record}, Fresh y W → Fresh y' W → (∀ (p : RecordId), p ∈ y.prev → p ∈ y'.prev) → (∀ (p' : RecordId), p' ∈ y'.prev → ∃ p, p ∈ y.prev ∧ ∃ x, x.id = p' ∧ Reach W [x.id] p) → ∀ (o : Option String), setsK o y = setsK o y' → ∀ {r : Record}, liveK (y :: W) o r = liveK (y' :: W) o rbase_closed_needed
Laws.LiveSlice
Anchoring cl.saw [cl.x, cl.y] ∧ ClosedOver cl.saw [cl.x, cl.y] ∧ ¬ClosedOver cl.saw [cl.y] ∧ bs.w.prev = List.map (fun x => x.id) (liveOf [cl.y]) ∧ ¬Anchored [bs.w, cl.x, cl.y] ∧ liveFor (liveOf [bs.w, cl.x, cl.y]) "a" cl.x = true ∧ liveFor [bs.w, cl.x, cl.y] "a" cl.x = false
- pinned by
- (a part of a set: none yet)
- rests on
keyed.anchored keyed.cut keyed.live keyed.witnessed
In its question
cut.prefix
Exactness
Every prefix, the records emitted before a time, is closed downward exactly when no record names a record with a later emitted.
A time names a prefix, and a cut is a part closed downward (keyed.cut). Clocks disagree, so a record can name one emitted later by its writer's clock, and then some prefix holds a record without what it names. Two parts closed downward stand beside any part. Down is the part with every held record under it: the least part closed downward that holds it. Held back is the records of the part with every held record under them in it: the greatest part closed downward inside it. At a time, a record is held back exactly when it and everything held under it were emitted before it, so held back is the prefix of another clock, a record's own emitted or the latest under it, which is what a writer that never emits earlier than what it names would have written. A prefix that is not closed downward reads wrongly: of three records in a line, the middle one emitted by a clock five seconds fast, the prefix at two seconds holds the last, which replaced the first, and reads the first as live, because the path between them goes through the record it lacks. Down at that time holds all three. As of a time is down (ruled 2026-11-20).
laws.md Every prefix, the records emitted before a time, is closed downward exactly when no record names a record with a later emitted. A part with everything held under it is the least part closed downward that holds it; the records of a part with everything held under them in it are the greatest inside it, and at a time those are the records that, with everything under them, were emitted before it. A prefix that is not closed downward can hold the record that replaced another and read the other as live.
- proved by
prefix_down_iff
Laws.Cut
∀ {W : List Record}, (∀ (T : Moment), Down (upTo W T) W) ↔ NamesEarlier WdownOf_down
Laws.Cut
∀ (W P : List Record), Down (downOf W P) W
downOf_least
Laws.Cut
∀ {W P U : List Record}, Down U W → (∀ (r : Record), r ∈ P → r ∈ U) → ∀ (r : Record), r ∈ downOf W P → r ∈ UheldOf_down
Laws.Cut
∀ {W P : List Record}, (∀ (r : Record), r ∈ P → r ∈ W) → Down (heldOf W P) WheldOf_greatest
Laws.Cut
∀ {W P U : List Record}, Down U W → (∀ (r : Record), r ∈ U → r ∈ P) → ∀ (r : Record), r ∈ U → r ∈ heldOf W PheldOf_prefix
Laws.Cut
∀ {W : List Record} {T : Moment} {a : Record}, a ∈ heldOf W (upTo W T) ↔ a ∈ W ∧ a.emitted.moment < T ∧ ∀ (c : Record), c ∈ W → a ∈ above W c → c.emitted.moment < Tprefix_reads_wrongly
Laws.Cut
upTo sk.all [2] = [sk.a, sk.c] ∧ ¬Down (upTo sk.all [2]) sk.all ∧ liveFor (upTo sk.all [2]) "status" sk.a = true ∧ liveFor sk.all "status" sk.a = false ∧ downOf sk.all (upTo sk.all [2]) = sk.all
- pinned by
- (a part of a set: none yet)
- rests on
keyed.live
In its question
keyed.slice
Invariance
Change whether a reader holds everything, or a witnessed part that holds every form of the thing's live records and what erases them, and the thing's keyed state, after settling and admission stays.
Holds when the store's rule for who may replace whom reads only envelopes; the forms of one id agree: the same envelope, and the same payload wherever it is held; no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. This carries keyed.witnessed back across settling and admission. For each record of the thing the part holds at all, it holds every form and every record that erases it, and it refuses the record when the whole does. With anchored names (keyed.anchored) the forms of the live records and what erases them are enough; that case is the one that needs prev to have no cycle. Nothing is owed for the prev targets of a record the whole admits: admission asks only about the targets held, so any part admits it. A record the whole refuses is admitted by a part that lacks the target it is refused for. Here it differs from thing.slice, which sends the targets. Under keys a target's envelope still sets its keys, so a target held without its witness can read as a live setter; a whole slice of the thing, which holds every record of it, gives the keyed state too. Without the eraser a part shows a payload the whole has erased.
laws.md After settling and admission, a part of the forms held gives a thing's keyed state when it holds a form of every live record of the thing, its records of the thing are witnessed, and for each record of the thing it holds at all it holds every form and every record that erases it, and it refuses the record when the whole does. With anchored names that is the forms of the live records and what erases them. Nothing is owed for the prev targets of a record the whole admits: any part admits it. A record the whole refuses is admitted by a part that lacks the target it is refused for. A target held without its witness still sets its keys and can read as live, so thing.slice's targets are not added bare; a whole thing.slice gives the keyed state too. Without the eraser a part shows a payload the whole has erased.
- proved by
keyedIn_slice
Laws.LiveSlice
∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {t : String} {S W : List Record}, Forms W → KeyedPart may t S W → (∀ (r : Record), r ∈ recordsOf t (realm may W) → live (recordsOf t (realm may W)) r = true → ∃ a, a ∈ S ∧ a.id = r.id) → (∀ (o : Option String), Witnessed (recordsOf t (realm may S)) (recordsOf t (realm may W)) o) → keyedIn t (realm may S) = keyedIn t (realm may W)keyedIn_live_slice
Laws.LiveSlice
∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {t : String} {S W : List Record}, Forms W → KeyedPart may t S W → NoCycle (recordsOf t (realm may W)) → Anchored (recordsOf t (realm may W)) → (∀ (r : Record), r ∈ recordsOf t (realm may W) → live (recordsOf t (realm may W)) r = true → ∃ a, a ∈ S ∧ a.id = r.id) → (∀ (r : Record), r ∈ recordsOf t (realm may W) → (∃ a, a ∈ S ∧ a.id = r.id) → live (recordsOf t (realm may W)) r = true) → keyedIn t (realm may S) = keyedIn t (realm may W)entitled_fewer
Laws.LiveSlice
∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {S W : List Record}, Forms W → (∀ (r : Record), r ∈ S → r ∈ W) → ∀ {r : Record}, entitled may (settle W) r = true → entitled may (settle S) r = truekeyedIn_thing_slice
Laws.LiveSlice
∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {t : String} {S W : List Record}, Forms W → Slice t S W → keyedIn t (realm may S) = keyedIn t (realm may W)target_needs_witness
Laws.LiveSlice
Anchored tg.all ∧ liveOf tg.all = [tg.x, tg.y3] ∧ keyedIn "k1" [tg.x, tg.y3] = keyedIn "k1" tg.all ∧ keyedIn "k1" [tg.d, tg.x, tg.y2, tg.y3] ≠ keyedIn "k1" tg.all
keyed_slice_needs_erasers
Laws.LiveSlice
keyedIn "k1" (realm (fun x x_1 => true) [er.x]) ≠ keyedIn "k1" (realm (fun x x_1 => true) [er.x, er.e])
- pinned by
- (a part of a set: none yet)
- rests on
input.distinct keyed.live keyed.witnessed settle.set
- carries
keyed.spec-slice
In its question
where.complements
Order
Where a test answers, not complements is; absent complements present. With a held safe whole value and a numeric bound, exactly one of at-least and below holds. Present times obey the corresponding time law.
On a payload the reader doesn't hold, a payload test answers unknown, and so does its complement.
laws.md not complements is; absent complements present. With a held safe whole value and a numeric bound, exactly one of at-least and below holds. Present times obey the corresponding time law.
- proved by
Op.not_is
Laws.Spec
∀ (a : Arg) (xs : List Item), (Op.not a).test xs = !(Op.is a).test xs
Op.absent_present
Laws.Spec
∀ (xs : List Item), Op.absent.test xs = !Op.present.test xs
Op.atLeast_below
Laws.Spec
∀ (i j : Int), (Op.atLeast (Arg.val (Val.int i))).test [Item.val (Val.int j)] = !(Op.below (Arg.val (Val.int i))).test [Item.val (Val.int j)]
Op.atLeast_below_time
Laws.Spec
∀ (c : Claim) (s : Span), (Op.atLeast (Arg.time c)).test [Item.time s] = !(Op.below (Arg.time c)).test [Item.time s]
- pinned by
spec/run/06-times (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build)also naming it: spec/run/pv2-settings (current main; may differ from this page's build) spec/run/pv2-written-empty (current main; may differ from this page's build) spec/run/pv4-members (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its questionWithout its premise
where.typed
Exactness
A test is accepted exactly when its operator and argument fit its field, and renders back as it was written.
Numeric arguments and bounds are safe-whole. Lists satisfy neither bound. Integral decimals and exponents normalize to integers before parsing.
laws.md at-least and below compare like numeric or time values only. Lists satisfy neither bound. A test parses exactly when its argument fits its field (Op.Fits). Rendering preserves the written test.
- proved by
HeldField.list_bounds
Laws.Payload
∀ (vs : List Val) (a : Arg), (Op.atLeast a).test [(HeldField.many vs).item] = false ∧ (Op.below a).test [(HeldField.many vs).item] = false
Op.ordered_like_only
Laws.Spec
∀ (a : Arg) {xs : List Item}, (∀ (x : Item), x ∈ xs → Item.like a x = false) → (Op.atLeast a).test xs = false ∧ (Op.below a).test xs = falseparseOp_ok_iff
Laws.Parse
∀ (ty : FieldType) (path : String) (kv : String × Json) (op : Op), parseOp ty path kv = Except.ok op ↔ Op.Fits ty op ∧ op.toJson = kv
parseArg_ok_iff
Laws.Parse
∀ (ty : FieldType) (path : String) (j : Json) (a : Arg), parseArg ty path j = Except.ok a ↔ Arg.Fits ty a ∧ a.toJson = j
parseBound_ok_iff
Laws.Parse
∀ (ty : FieldType) (path : String) (j : Json) (a : Arg), parseBound ty path j = Except.ok a ↔ Arg.Bounds ty a ∧ a.toJson = j
- pinned by
18 files
spec/parse/22-env-unknown-field (current main; may differ from this page's build) spec/parse/23-env-text-ordered (current main; may differ from this page's build) spec/parse/24-env-time-not-span (current main; may differ from this page's build) spec/parse/25-env-time-as-number (current main; may differ from this page's build) spec/parse/26-env-id-not-record-id (current main; may differ from this page's build) spec/parse/27-env-text-as-number (current main; may differ from this page's build) spec/parse/28-payload-bound-not-number (current main; may differ from this page's build) spec/parse/29-env-time-is-not-span (current main; may differ from this page's build) spec/parse/30-env-id-ordered (current main; may differ from this page's build) spec/parse/31-present-false (current main; may differ from this page's build) spec/parse/32-env-text-as-bool (current main; may differ from this page's build) spec/parse/33-env-id-as-number (current main; may differ from this page's build) spec/parse/34-env-observer-not-typed (current main; may differ from this page's build) spec/parse/35-env-kind-empty (current main; may differ from this page's build) spec/parse/36-env-about-not-typed (current main; may differ from this page's build) spec/parse/37-payload-is-null (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build) spec/run/pv5-list-bounds (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
spec.parse
In its question
where.fields
Exactness
kind and observer read as their text; about, of, prev, under and erases as their members, of as written and absent on a root; emitted as its instant.
A held payload field is present exactly when written. Lists test typed membership, including when they have no nameable members. occurred reads as its span (where.time).
laws.md A held payload field tests present exactly when written. Lists test membership, including when the list holds no nameable member. kind and observer read as text. about, of, prev, under and erases test members (is) and nonemptiness (present); of as written, absent on a root. emitted reads as its own instant. occurred is where.time's
- proved by
Cond.payload_present
Laws.Payload
∀ (r : Record) (f : String), r.shown = Shown.here → { field := Field.payload f, op := Op.present }.eval r = Tri.ofBool (r.get f).isSomeHeldField.list_is
Laws.Payload
∀ (vs : List Val) (a : Val), (Op.is (Arg.val a)).test [(HeldField.many vs).item] = vs.contains a
HeldField.empty_item
Laws.Payload
(HeldField.many []).item = Item.other
Cond.text_is
Laws.Spec
∀ (t : String) (r : Record), { field := Field.env EnvField.kind, op := Op.is (Arg.val (Val.str t)) }.eval r = Tri.ofBool (t == r.kind) ∧ { field := Field.env EnvField.observer, op := Op.is (Arg.val (Val.str t)) }.eval r = Tri.ofBool (t == r.observer)Cond.about_is
Laws.Spec
∀ (t : String) (r : Record), { field := Field.env EnvField.about, op := Op.is (Arg.val (Val.str t)) }.eval r = Tri.ofBool (r.about.contains t)Cond.of_is
Laws.Spec
∀ (t : String) (r : Record), { field := Field.env EnvField.of, op := Op.is (Arg.val (Val.str t)) }.eval r = Tri.ofBool (r.of.toList.contains t) ∧ { field := Field.env EnvField.of, op := Op.present }.eval r = Tri.ofBool r.of.isSomeCond.id_is
Laws.Spec
∀ (i : String) (r : Record), { field := Field.env EnvField.prev, op := Op.is (Arg.val (Val.str i)) }.eval r = Tri.ofBool ((List.map idText r.prev).contains i) ∧ { field := Field.env EnvField.under, op := Op.is (Arg.val (Val.str i)) }.eval r = Tri.ofBool ((List.map idText r.under.toList).contains i) ∧ { field := Field.env EnvField.erases, op := Op.is (Arg.val (Val.str i)) }.eval r = Tri.ofBool ((List.map idText r.erases).contains i)Cond.set_present
Laws.Spec
∀ (r : Record), { field := Field.env EnvField.about, op := Op.present }.eval r = Tri.ofBool !r.about.isEmpty ∧ { field := Field.env EnvField.prev, op := Op.present }.eval r = Tri.ofBool !r.prev.isEmpty ∧ { field := Field.env EnvField.under, op := Op.present }.eval r = Tri.ofBool r.under.isSome ∧ { field := Field.env EnvField.erases, op := Op.present }.eval r = Tri.ofBool !r.erases.isEmptyCond.emitted_is
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.emitted, op := Op.is (Arg.time c) }.eval r = Tri.ofBool (c.span == Span.point r.emitted.moment)Cond.emitted_atLeast
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.emitted, op := Op.atLeast (Arg.time c) }.eval r = Tri.ofBool (decide (c.span.start ≤ r.emitted.moment))Cond.emitted_below
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.emitted, op := Op.below (Arg.time c) }.eval r = Tri.ofBool (decide (r.emitted.moment < c.span.start))
- pinned by
spec/run/08-envelope-fields (current main; may differ from this page's build) spec/run/09-from-of-root (current main; may differ from this page's build) spec/run/pv3-written (current main; may differ from this page's build) spec/run/pv4-members (current main; may differ from this page's build) spec/run/pv4-text-80 (current main; may differ from this page's build)also naming it: spec/run/14-from-about-mentions (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
where.time
Invariance
Change an accepted envelope time or test time, while keeping its parsed span, and the answer stays.
An instant has one accepted spelling. Date claims can retain the same span with different qualifiers. A time in a payload remains text.
laws.md Envelope-time tests read meaning, not record or argument spelling. is compares spans. at-least and below compare starts. A record without occurred passes neither bound.
- proved by
Cond.occurred_is
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.occurred, op := Op.is (Arg.time c) }.eval r = Tri.yes ↔ ∃ k, r.occurred = some k ∧ k.span = c.spanCond.occurred_atLeast
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.occurred, op := Op.atLeast (Arg.time c) }.eval r = Tri.yes ↔ ∃ k, r.occurred = some k ∧ c.span.start ≤ k.span.startCond.occurred_below
Laws.Spec
∀ (c : Claim) (r : Record), { field := Field.env EnvField.occurred, op := Op.below (Arg.time c) }.eval r = Tri.yes ↔ ∃ k, r.occurred = some k ∧ k.span.start < c.span.startCond.occurred_missing
Laws.Spec
∀ (a : Arg) {r : Record}, r.occurred = none → { field := Field.env EnvField.occurred, op := Op.atLeast a }.eval r = Tri.no ∧ { field := Field.env EnvField.occurred, op := Op.below a }.eval r = Tri.noCond.time_meaning
Laws.Spec
∀ {f : EnvField}, f.type = FieldType.time → ∀ (op : Op) {r r' : Record}, Option.map (fun x => x.span) r.occurred = Option.map (fun x => x.span) r'.occurred → r.emitted.moment = r'.emitted.moment → { field := Field.env f, op := op }.eval r = { field := Field.env f, op := op }.eval r'Op.time_arg_meaning
Laws.Spec
∀ {c₁ c₂ : Claim}, c₁.span = c₂.span → ∀ (xs : List Item), (Op.is (Arg.time c₁)).test xs = (Op.is (Arg.time c₂)).test xs ∧ (Op.not (Arg.time c₁)).test xs = (Op.not (Arg.time c₂)).test xs ∧ (Op.atLeast (Arg.time c₁)).test xs = (Op.atLeast (Arg.time c₂)).test xs ∧ (Op.below (Arg.time c₁)).test xs = (Op.below (Arg.time c₂)).test xs
- pinned by
spec/run/06-times (current main; may differ from this page's build) spec/run/08-envelope-fields (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
where.total
Exactness
A test answers for every record whose payload is here, and an envelope test for every record at all.
laws.md a test answers for every record whose payload is here, and an envelope test for every record, withheld or not
- proved by
Cond.eval_here
Laws.Spec
∀ (c : Cond) {r : Record}, r.shown = Shown.here → c.eval r ≠ Tri.unknownCond.eval_envelope
Laws.Spec
∀ (c : Cond), c.field.onEnvelope = true → ∀ (r : Record), c.eval r ≠ Tri.unknown
- pinned by
- every
spec/run vector73 files
spec/run/01-tasks (current main; may differ from this page's build) spec/run/02-withheld-payload (current main; may differ from this page's build) spec/run/03-withheld-successor (current main; may differ from this page's build) spec/run/04-kind-change (current main; may differ from this page's build) spec/run/05-about-makes-no-head (current main; may differ from this page's build) spec/run/06-times (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build) spec/run/08-envelope-fields (current main; may differ from this page's build) spec/run/09-from-of-root (current main; may differ from this page's build) spec/run/11-hidden-numbers (current main; may differ from this page's build) spec/run/12-readable-extrema (current main; may differ from this page's build) spec/run/13-source-union (current main; may differ from this page's build) spec/run/14-from-about-mentions (current main; may differ from this page's build) spec/run/15-about-makes-no-head (current main; may differ from this page's build) spec/run/16-follow-current (current main; may differ from this page's build) spec/run/17-follow-fork (current main; may differ from this page's build) spec/run/18-follow-erased-head (current main; may differ from this page's build) spec/run/19-follow-payload-test (current main; may differ from this page's build) spec/run/20-follow-envelope-after-supersession (current main; may differ from this page's build) spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build) spec/run/26-by-key-order (current main; may differ from this page's build) spec/run/27-by-number-keys (current main; may differ from this page's build) spec/run/28-by-mentions (current main; may differ from this page's build) spec/run/29-by-collect-limit (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/31-keys-example (current main; may differ from this page's build) spec/run/32-keys-whole-read (current main; may differ from this page's build) spec/run/33-keys-chain (current main; may differ from this page's build) spec/run/34-keys-concurrent (current main; may differ from this page's build) spec/run/35-keys-pure-join (current main; may differ from this page's build) spec/run/36-keys-whole-replaces (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/38-keys-undeclared (current main; may differ from this page's build) spec/run/39-keys-select-heads (current main; may differ from this page's build) spec/run/40-keys-payload-tests (current main; may differ from this page's build) spec/run/41-keys-admitted-only (current main; may differ from this page's build) spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/43-keys-fork-once (current main; may differ from this page's build) spec/run/44-keys-numbers (current main; may differ from this page's build) spec/run/45-keys-by-payload (current main; may differ from this page's build) spec/run/46-keys-by-about (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/49-keys-whole-read (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/51-keys-collect-limit (current main; may differ from this page's build) spec/run/gap04-unread-multi-thing (current main; may differ from this page's build) spec/run/gap05-unread-before-limit (current main; may differ from this page's build) spec/run/gap06-direct-admission (current main; may differ from this page's build) spec/run/gap07-store-other (current main; may differ from this page's build) spec/run/gap07-store-team (current main; may differ from this page's build) spec/run/gap12-no-unknown (current main; may differ from this page's build) spec/run/gap13-missing-and-withheld (current main; may differ from this page's build) spec/run/gap14-field-types (current main; may differ from this page's build) spec/run/phase2-exact-output (current main; may differ from this page's build) spec/run/pv-keys-disjoint (current main; may differ from this page's build) spec/run/pv-keys-overlap (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-settings (current main; may differ from this page's build) spec/run/pv2-written-empty (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build) spec/run/pv3-written (current main; may differ from this page's build) spec/run/pv4-members (current main; may differ from this page's build) spec/run/pv4-text-80 (current main; may differ from this page's build) spec/run/pv5-list-bounds (current main; may differ from this page's build) spec/run/pv6-key-80 (current main; may differ from this page's build) spec/run/pv6-list-groups (current main; may differ from this page's build) spec/run/pv7-list-numeric (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
keyed.whole-read spec.follow
In its question
where.set
Invariance
Change the order of a where map's tests, and its answer stays.
laws.md the tests of a where map can come in any order
- proved by
Cond.all_perm
Laws.Spec
∀ {cs ds : List Cond}, cs.Perm ds → ∀ (r : Record), Cond.all cs r = Cond.all ds r
- pinned by
- (by construction)also naming it:
spec/run/gap12-no-unknown (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
keyed.whole-read spec.follow spec.hash
In its question
spec.select
Invariance
Change which payloads a reader holds, and the set of records a spec's from takes stays.
The selection holds exactly the input records the spec takes. Each comes back in the view's form. A where test on a payload can still answer unknown under a view (view.refines).
laws.md selection reads only envelopes, so a view selects the same records. Spec.select holds exactly the input records the spec takes; Spec.run does not call it.
- proved by
Spec.select_view
Laws.Spec
∀ {f : Record → Record}, View f → ∀ (sp : Spec) (xs : List Record), sp.select (List.map f xs) = List.map f (sp.select xs)Source.takes_view
Laws.Spec
∀ {f : Record → Record}, View f → ∀ (s : Source) (r : Record), s.takes (f r) = s.takes rSpec.mem_select
Laws.Spec
∀ (sp : Spec) (xs : List Record) (r : Record), r ∈ sp.select xs ↔ r ∈ xs ∧ sp.takes r = true
- pinned by
73 files
spec/run/01-tasks (current main; may differ from this page's build) spec/run/02-withheld-payload (current main; may differ from this page's build) spec/run/03-withheld-successor (current main; may differ from this page's build) spec/run/04-kind-change (current main; may differ from this page's build) spec/run/05-about-makes-no-head (current main; may differ from this page's build) spec/run/06-times (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build) spec/run/08-envelope-fields (current main; may differ from this page's build) spec/run/09-from-of-root (current main; may differ from this page's build) spec/run/11-hidden-numbers (current main; may differ from this page's build) spec/run/12-readable-extrema (current main; may differ from this page's build) spec/run/13-source-union (current main; may differ from this page's build) spec/run/14-from-about-mentions (current main; may differ from this page's build) spec/run/15-about-makes-no-head (current main; may differ from this page's build) spec/run/16-follow-current (current main; may differ from this page's build) spec/run/17-follow-fork (current main; may differ from this page's build) spec/run/18-follow-erased-head (current main; may differ from this page's build) spec/run/19-follow-payload-test (current main; may differ from this page's build) spec/run/20-follow-envelope-after-supersession (current main; may differ from this page's build) spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build) spec/run/26-by-key-order (current main; may differ from this page's build) spec/run/27-by-number-keys (current main; may differ from this page's build) spec/run/28-by-mentions (current main; may differ from this page's build) spec/run/29-by-collect-limit (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/31-keys-example (current main; may differ from this page's build) spec/run/32-keys-whole-read (current main; may differ from this page's build) spec/run/33-keys-chain (current main; may differ from this page's build) spec/run/34-keys-concurrent (current main; may differ from this page's build) spec/run/35-keys-pure-join (current main; may differ from this page's build) spec/run/36-keys-whole-replaces (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/38-keys-undeclared (current main; may differ from this page's build) spec/run/39-keys-select-heads (current main; may differ from this page's build) spec/run/40-keys-payload-tests (current main; may differ from this page's build) spec/run/41-keys-admitted-only (current main; may differ from this page's build) spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/43-keys-fork-once (current main; may differ from this page's build) spec/run/44-keys-numbers (current main; may differ from this page's build) spec/run/45-keys-by-payload (current main; may differ from this page's build) spec/run/46-keys-by-about (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/49-keys-whole-read (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/51-keys-collect-limit (current main; may differ from this page's build) spec/run/gap04-unread-multi-thing (current main; may differ from this page's build) spec/run/gap05-unread-before-limit (current main; may differ from this page's build) spec/run/gap06-direct-admission (current main; may differ from this page's build) spec/run/gap07-store-other (current main; may differ from this page's build) spec/run/gap07-store-team (current main; may differ from this page's build) spec/run/gap12-no-unknown (current main; may differ from this page's build) spec/run/gap13-missing-and-withheld (current main; may differ from this page's build) spec/run/gap14-field-types (current main; may differ from this page's build) spec/run/phase2-exact-output (current main; may differ from this page's build) spec/run/pv-keys-disjoint (current main; may differ from this page's build) spec/run/pv-keys-overlap (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-settings (current main; may differ from this page's build) spec/run/pv2-written-empty (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build) spec/run/pv3-written (current main; may differ from this page's build) spec/run/pv4-members (current main; may differ from this page's build) spec/run/pv4-text-80 (current main; may differ from this page's build) spec/run/pv5-list-bounds (current main; may differ from this page's build) spec/run/pv6-key-80 (current main; may differ from this page's build) spec/run/pv6-list-groups (current main; may differ from this page's build) spec/run/pv7-list-numeric (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
spec.from-thing
Exactness
from's of takes exactly the records of the thing, a root by its own id. from's about takes exactly the records that mention it, as written.
laws.md from's of takes exactly the records of the thing, a root by its own id. from's about is a mention test: it takes exactly the records whose about names the thing, as written.
- proved by
Source.takes_of
Laws.Spec
∀ (store t : String) (r : Record), { store := store, of := some t }.takes r = (r.thing == t)Source.takes_about
Laws.Spec
∀ (store t : String) (r : Record), { store := store, about := some t }.takes r = r.about.contains t
- pinned by
spec/run/09-from-of-root (current main; may differ from this page's build) spec/run/14-from-about-mentions (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
In its question
spec.set
Invariance
Change the order the records arrive in, and every slot of every spec stays.
Each id is handed over once (input.distinct).
laws.md Every slot of every spec gives the same value for the same distinct-id set, with each id consumed once, the slots that follow keys among them (keyed.fold, keyed.slots).
- proved by
Slot.set_decides
Laws.Spec
∀ (s : Slot) (sel : Record → Bool) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → s.run sel xs = s.run sel ysSpec.set_decides
Laws.Spec
∀ (sp : Spec) (may : Record → Record → Bool) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → sp.run xs may = sp.run ys maykeyedValue_set_decides
Laws.Spec
∀ (ty : FoldType) (ev : String → Tri) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → keyedValue ty xs ev = keyedValue ty ys evSlot.keyedGrouped_set_decides
Laws.Spec
∀ (s : Slot) (b : By) (sel : Record → Bool) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → s.keyedGrouped b sel xs = s.keyedGrouped b sel ys
- pinned by
73 files
spec/run/01-tasks (current main; may differ from this page's build) spec/run/02-withheld-payload (current main; may differ from this page's build) spec/run/03-withheld-successor (current main; may differ from this page's build) spec/run/04-kind-change (current main; may differ from this page's build) spec/run/05-about-makes-no-head (current main; may differ from this page's build) spec/run/06-times (current main; may differ from this page's build) spec/run/07-numeric-bounds (current main; may differ from this page's build) spec/run/08-envelope-fields (current main; may differ from this page's build) spec/run/09-from-of-root (current main; may differ from this page's build) spec/run/11-hidden-numbers (current main; may differ from this page's build) spec/run/12-readable-extrema (current main; may differ from this page's build) spec/run/13-source-union (current main; may differ from this page's build) spec/run/14-from-about-mentions (current main; may differ from this page's build) spec/run/15-about-makes-no-head (current main; may differ from this page's build) spec/run/16-follow-current (current main; may differ from this page's build) spec/run/17-follow-fork (current main; may differ from this page's build) spec/run/18-follow-erased-head (current main; may differ from this page's build) spec/run/19-follow-payload-test (current main; may differ from this page's build) spec/run/20-follow-envelope-after-supersession (current main; may differ from this page's build) spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build) spec/run/26-by-key-order (current main; may differ from this page's build) spec/run/27-by-number-keys (current main; may differ from this page's build) spec/run/28-by-mentions (current main; may differ from this page's build) spec/run/29-by-collect-limit (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/31-keys-example (current main; may differ from this page's build) spec/run/32-keys-whole-read (current main; may differ from this page's build) spec/run/33-keys-chain (current main; may differ from this page's build) spec/run/34-keys-concurrent (current main; may differ from this page's build) spec/run/35-keys-pure-join (current main; may differ from this page's build) spec/run/36-keys-whole-replaces (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/38-keys-undeclared (current main; may differ from this page's build) spec/run/39-keys-select-heads (current main; may differ from this page's build) spec/run/40-keys-payload-tests (current main; may differ from this page's build) spec/run/41-keys-admitted-only (current main; may differ from this page's build) spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/43-keys-fork-once (current main; may differ from this page's build) spec/run/44-keys-numbers (current main; may differ from this page's build) spec/run/45-keys-by-payload (current main; may differ from this page's build) spec/run/46-keys-by-about (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/49-keys-whole-read (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/51-keys-collect-limit (current main; may differ from this page's build) spec/run/gap04-unread-multi-thing (current main; may differ from this page's build) spec/run/gap05-unread-before-limit (current main; may differ from this page's build) spec/run/gap06-direct-admission (current main; may differ from this page's build) spec/run/gap07-store-other (current main; may differ from this page's build) spec/run/gap07-store-team (current main; may differ from this page's build) spec/run/gap12-no-unknown (current main; may differ from this page's build) spec/run/gap13-missing-and-withheld (current main; may differ from this page's build) spec/run/gap14-field-types (current main; may differ from this page's build) spec/run/phase2-exact-output (current main; may differ from this page's build) spec/run/pv-keys-disjoint (current main; may differ from this page's build) spec/run/pv-keys-overlap (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-settings (current main; may differ from this page's build) spec/run/pv2-written-empty (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build) spec/run/pv3-written (current main; may differ from this page's build) spec/run/pv4-members (current main; may differ from this page's build) spec/run/pv4-text-80 (current main; may differ from this page's build) spec/run/pv5-list-bounds (current main; may differ from this page's build) spec/run/pv6-key-80 (current main; may differ from this page's build) spec/run/pv6-list-groups (current main; may differ from this page's build) spec/run/pv7-list-numeric (current main; may differ from this page's build) also naming it: scenario/01-decision (current main; may differ from this page's build) scenario/by-01-erased-in-another-group (current main; may differ from this page's build) scenario/keys-01-settled-setter (current main; may differ from this page's build) scenario/phase2-exact-output (current main; may differ from this page's build) scenario/phase2-thing-state (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
admit.set by.set content order input.distinct keyed.fold keyed.live latest-by.set record.sets thing.local
- carries
by.set
In its question
spec.follow
Exactness
Count, sum, min and max that follow prev fold every current record and nothing else: the whole-reader heads, each id once. They choose heads as latest-by does: from and the envelope tests choose, the payload tests filter.
The answer depends only on the set held, through each thing's heads (heads.set), never through the commuting step. Every head of a forked thing counts. Count counts an erased or withheld head by its envelope; sum, min and max count it unread.
laws.md Count, sum, min and max that follow prev fold the whole-reader heads: every head of every thing, each id once, and no superseded record. The heads are each thing's LatestBy heads (heads.set), so any answer worked out from them depends only on the set held, and the accumulating form needs no commuting step (acc.set). They choose heads as latest-by does, and count each chosen head whose payload tests are unknown once.
- proved by
wholeHeads_overHeads
Laws.Spec
∀ (xs : List Record), wholeHeads xs = orderHeads (List.flatMap (fun t => OverHeads.fold LatestBy.heads (List.filter (fun x => x.isOf t) xs)) (thingsOf xs))
wholeHeads_set_decides
Laws.Spec
∀ {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → wholeHeads xs = wholeHeads yswholeHeads_answer_set_decides
Laws.Spec
∀ {α : Sort u_1} (answer : List Record → α) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → answer (wholeHeads xs) = answer (wholeHeads ys)Acc.followed_set_decides
Laws.Spec
∀ {σ : Type} (f : Acc σ) (ev : Record → Tri) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → f.select ev (wholeHeads xs) = f.select ev (wholeHeads ys)mem_accPool_follow
Laws.Spec
∀ {xs : List Record}, Addressed xs → ∀ {r : Record}, r ∈ accPool (some Follow.prev) xs → ∃ t, HeadOf xs t raccPool_follow_heads
Laws.Spec
∀ {xs : List Record}, Addressed xs → Distinct (accPool (some Follow.prev) xs) ∧ ∀ (t : String), t ∈ thingsOf xs → ∀ (r : Record), r ∈ (stateIn t xs).heads → r ∈ accPool (some Follow.prev) xsselect_as_latest
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) (r : Record), ((if sel r = true then Cond.all cs r else Tri.no) = Tri.yes ↔ chosen sel cs r = true ∧ payTest cs r = Tri.yes) ∧ ((if sel r = true then Cond.all cs r else Tri.no) = Tri.unknown ↔ chosen sel cs r = true ∧ payTest cs r = Tri.unknown)
Count.followed_unread
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) {xs : List Record}, Addressed xs → (Count.acc.select (fun r => if sel r = true then Cond.all cs r else Tri.no) (accPool (some Follow.prev) xs)).unread = (idsOf (List.filter (fun r => chosen sel cs r && payTest cs r == Tri.unknown) (wholeHeads xs))).length
- pinned by
spec/run/16-follow-current (current main; may differ from this page's build) spec/run/17-follow-fork (current main; may differ from this page's build) spec/run/18-follow-erased-head (current main; may differ from this page's build) spec/run/19-follow-payload-test (current main; may differ from this page's build) spec/run/20-follow-envelope-after-supersession (current main; may differ from this page's build)also naming it: spec/run/24-by-follow (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/43-keys-fork-once (current main; may differ from this page's build) spec/run/49-keys-whole-read (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order heads.set heads.whole-view record.sets result.unread where.set where.total
- carries
by.set result.unread
In its question
keyed.live
Exactness
A setter of a key is live for it when no record above it over prev sets the key. Every record sets the envelope, so live for the envelope is a head. A record is live exactly when it is live for some key, the envelope among them.
Above is reached through the records held and admitted; a prev naming a record not held reaches nothing, and only which records are held decides it. A record with no sets is read whole and sets every key; "sets": [] sets none. So every head is live, a pure join too, and a record read whole is live until a record read whole is above it. An erased or withheld record keeps its envelope and still sets its keys.
laws.md A record is above another when its prev names it, or names a record above it, through the records held: exactly what upward reaches, and only which records are held decides it. A setter of a key is live for it when nothing above it sets the key. Live for the envelope, which every record sets, is a head: nothing held names it, so a thing's heads are exactly its records live for the envelope, and every head is live. A record is live exactly when it is a head or live for some key, a key it does not declare among them when it is read whole.
- proved by
mem_upward
Laws.Live
∀ {rs : List Record} {ids : List RecordId} {i : RecordId}, i ∈ upward rs ids ↔ Reach rs ids imem_above
Laws.Live
∀ {rs : List Record} {r q : Record}, q ∈ above rs r ↔ q ∈ rs ∧ ∃ p, p ∈ q.prev ∧ Reach rs [r.id] pabove_congr
Laws.Live
∀ {rs rs' : List Record}, (∀ (q : Record), q ∈ rs ↔ q ∈ rs') → ∀ (r q : Record), q ∈ above rs r ↔ q ∈ above rs' rliveFor_iff
Laws.Live
∀ {rs : List Record} {k : String} {r : Record}, liveFor rs k r = true ↔ r.setsKey k = true ∧ ∀ (q : Record), q ∈ above rs r → q.setsKey k = falseliveEnv_iff
Laws.Live
∀ {rs : List Record} {r : Record}, liveEnv rs r = true ↔ ¬∃ q, q ∈ rs ∧ r.id ∈ q.prevlive_iff
Laws.Live
∀ {rs : List Record} {r : Record}, live rs r = true ↔ liveEnv rs r = true ∨ ∃ k, liveFor rs k r = truemem_stateIn_heads_iff
Laws.Live
∀ {xs : List Record}, Addressed xs → ∀ {t : String} {r : Record}, r ∈ (stateIn t xs).heads ↔ r ∈ recordsOf t xs ∧ liveEnv (recordsOf t xs) r = truehead_live
Laws.Live
∀ {xs : List Record}, Addressed xs → ∀ {t : String} {r : Record}, r ∈ (keyedIn t xs).heads → live (recordsOf t xs) r = true
- pinned by
9 files
scenario/keys-01-settled-setter (current main; may differ from this page's build) spec/run/31-keys-example (current main; may differ from this page's build) spec/run/32-keys-whole-read (current main; may differ from this page's build) spec/run/33-keys-chain (current main; may differ from this page's build) spec/run/34-keys-concurrent (current main; may differ from this page's build) spec/run/35-keys-pure-join (current main; may differ from this page's build) spec/run/36-keys-whole-replaces (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/41-keys-admitted-only (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order
- carries
by.set cut.prefix keyed.anchored keyed.base keyed.convex keyed.cut keyed.fold keyed.heads keyed.slice keyed.spec-slice keyed.whole-read keyed.witnessed spec.set
In its question
keyed.fold
Exactness
A latest-by that follows keys gives each thing an entry for every key some live record declares and no other, each holding exactly that key's live setters, records read whole among them; its live records read whole; and its heads.
A pure join is listed only among the heads. For a thing whose records are all read whole there is no key, and the records read whole are the heads "follow": "prev" gives. The answer depends only on the set held. It lists ids and shown states, not values, and declares no conflict between two setters of one key.
laws.md A latest-by that follows keys gives each thing an entry for every key some live record declares and no other, each holding exactly that key's live setters; its live records read whole; and its heads. A pure join is in neither of the first two. For a thing whose records are all read whole there is no key, and the records read whole are its heads. The keyed state and the slot depend only on the set held.
- proved by
keyedIn_keys
Laws.Live
∀ {t : String} {xs : List Record} {k : String}, k ∈ List.map (fun x => x.fst) (keyedIn t xs).keys ↔ ∃ r, r ∈ recordsOf t xs ∧ live (recordsOf t xs) r = true ∧ k ∈ r.declareskeyedIn_setters
Laws.Live
∀ {t : String} {xs : List Record}, Addressed xs → ∀ {k : String} {ss : List Record}, (k, ss) ∈ (keyedIn t xs).keys → ∀ {r : Record}, r ∈ ss ↔ r ∈ recordsOf t xs ∧ liveFor (recordsOf t xs) k r = truekeyedIn_whole
Laws.Live
∀ {t : String} {xs : List Record}, Addressed xs → ∀ {r : Record}, r ∈ (keyedIn t xs).whole ↔ r ∈ recordsOf t xs ∧ r.whole = true ∧ live (recordsOf t xs) r = truekeyedIn_heads
Laws.Live
∀ (t : String) (xs : List Record), (keyedIn t xs).heads = (stateIn t xs).heads
pureJoin_only_heads
Laws.Live
∀ {t : String} {xs : List Record}, Addressed xs → ∀ {r : Record}, r.sets = some [] → (∀ (e : String × List Record), e ∈ (keyedIn t xs).keys → ¬r ∈ e.snd) ∧ ¬r ∈ (keyedIn t xs).wholekeyedIn_whole_read
Laws.Live
∀ {t : String} {xs : List Record}, Addressed xs → (∀ (r : Record), r ∈ recordsOf t xs → r.sets = none) → (keyedIn t xs).keys = [] ∧ (keyedIn t xs).whole = (stateIn t xs).heads ∧ (keyedIn t xs).heads = (stateIn t xs).headskeyedIn_set_decides
Laws.Live
∀ {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → ∀ (t : String), keyedIn t xs = keyedIn t yskeyedOf_set_decides
Laws.Live
∀ (sel : Record → Bool) (cs : List Cond) {xs ys : List Record}, Addressed xs → Addressed ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → keyedOf sel cs xs = keyedOf sel cs ys
- pinned by
9 files
spec/run/31-keys-example (current main; may differ from this page's build) spec/run/32-keys-whole-read (current main; may differ from this page's build) spec/run/33-keys-chain (current main; may differ from this page's build) spec/run/34-keys-concurrent (current main; may differ from this page's build) spec/run/35-keys-pure-join (current main; may differ from this page's build) spec/run/36-keys-whole-replaces (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/38-keys-undeclared (current main; may differ from this page's build) spec/run/41-keys-admitted-only (current main; may differ from this page's build) also naming it: scenario/keys-01-settled-setter (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order content order input.distinct keyed.live record.sets thing.local
- carries
by.set keyed.spec-slice spec.set
In its question
keyed.slots
Exactness
Count, sum, min, max and collect that follow keys read things. Count counts each selected thing once, however many of its heads are chosen. Sum, min and max read the field from its one live setter. Collect lists exactly the selected things' live records, a pure-join head among them; its limit counts things, each listed whole.
A thing is selected as keyed.select selects one. With no live setter of the field, or two or more, also holding the same number, or one whose payload is not held or holds no safe whole number there, the thing is unread to sum, min and max: the core compares no values. A thing whose tests are unknown is unread, and each thing at most once in a slot. A thing forked across records read whole counts once, where "follow": "prev" counts each head. A collect with a limit lists every live record of at most that many things, those whose newest live records are newest, and no record of the rest.
laws.md Count, sum, min, max and collect that follow keys read things, selected as keyed.select selects them. Count counts each selected thing once, however many of its heads are chosen. Sum, min and max read the field from its one live setter: with none, or two or more (the same number or not), or one the fold cannot read, the thing is unread. Collect lists exactly the selected things' live records. With a limit of k it lists exactly the live records of at most k selected things, every live record of each, and leaves out a selected thing with a live record only when it lists k things; the things are the first k of the newest-first list, by each one's newest live record. Over records of distinct things the limit is the limit over records. A thing whose tests are unknown is unread, and each thing at most once.
- proved by
thingEv_yes
Laws.KeyedSlots
∀ {sel : Record → Bool} {cs : List Cond} {xs : List Record} {t : String}, thingEv sel cs xs t = Tri.yes ↔ (∃ h, h ∈ (stateIn t xs).heads ∧ chosen sel cs h = true) ∧ thingTest cs (recordsOf t xs) = Tri.yesthingEv_unchosen
Laws.KeyedSlots
∀ {sel : Record → Bool} {cs : List Cond} {xs : List Record} {t : String}, (∀ (hd : Record), hd ∈ (stateIn t xs).heads → chosen sel cs hd = false) → thingEv sel cs xs t = Tri.nokeyedValue_count
Laws.KeyedSlots
∀ (f : Option Follow) (xs : List Record) (ev : String → Tri), keyedValue (FoldType.count f) xs ev = SlotValue.nat { value := (List.filter (fun x => ev x == Tri.yes) (thingsOf xs)).length, unread := (List.filter (fun x => ev x == Tri.unknown) (thingsOf xs)).length }Slot.keys_count
Laws.KeyedSlots
∀ {s : Slot}, s.type = FoldType.count (some Follow.keys) → s.group = none → ∀ (sel : Record → Bool) (xs : List Record), s.run sel xs = SlotValue.nat { value := (List.filter (fun x => thingEv sel s.tests.conds xs x == Tri.yes) (thingsOf xs)).length, unread := (List.filter (fun x => thingEv sel s.tests.conds xs x == Tri.unknown) (thingsOf xs)).length } ∧ (thingsOf xs).NodupsoleSetter_eq
Laws.KeyedSlots
∀ {xs : List Record} {f t : String} {r : Record}, soleSetter xs f t = some r ↔ setters (recordsOf t xs) f = [r]soleSetter_two
Laws.KeyedSlots
∀ {xs : List Record} {f t : String}, 2 ≤ (setters (recordsOf t xs) f).length → soleSetter xs f t = nonesoleSetter_unset
Laws.KeyedSlots
∀ {xs : List Record} {f t : String}, setters (recordsOf t xs) f = [] → soleSetter xs f t = noneAcc.overThings_value
Laws.KeyedSlots
∀ {σ : Type} (f : Acc σ) (pick : String → Option Record) (ev : String → Tri) (ts : List String), (f.overThings pick ev ts).value = f.fold (List.filter f.readable (List.filterMap pick (List.filter (fun x => ev x == Tri.yes) ts)))Acc.overThings_unread
Laws.KeyedSlots
∀ {σ : Type} (f : Acc σ) (pick : String → Option Record) (ev : String → Tri) (ts : List String), (f.overThings pick ev ts).unread = (List.filter (fun t => ev t == Tri.unknown || ev t == Tri.yes && !Option.any f.readable (pick t)) ts).lengthkeyedValue_collect
Laws.KeyedSlots
∀ {xs : List Record}, Addressed xs → ∀ (f : Option Follow) (ev : String → Tri) {hs : List (RecordId × Shown)} {u : Nat}, keyedValue (FoldType.collect f none) xs ev = SlotValue.heads hs u → ∀ {p : RecordId × Shown}, p ∈ hs ↔ ∃ t, t ∈ thingsOf xs ∧ ev t = Tri.yes ∧ ∃ r, r ∈ liveIn xs t ∧ (r.id, r.shown) = pkeyedValue_collect_unread
Laws.KeyedSlots
∀ (f : Option Follow) (limit : Option Nat) (xs : List Record) (ev : String → Tri), ∃ hs, keyedValue (FoldType.collect f limit) xs ev = SlotValue.heads hs (List.filter (fun x => ev x == Tri.unknown) (thingsOf xs)).length
keyedValue_collect_limit
Laws.KeyedSlots
∀ {xs : List Record}, Addressed xs → ∀ (f : Option Follow) (ev : String → Tri) (k : Nat) {hs : List (RecordId × Shown)} {u : Nat}, keyedValue (FoldType.collect f (some k)) xs ev = SlotValue.heads hs u → ∃ T, T.Nodup ∧ T.length ≤ k ∧ (∀ (t : String), t ∈ T → t ∈ thingsOf xs ∧ ev t = Tri.yes) ∧ (∀ (t : String), t ∈ thingsOf xs → ev t = Tri.yes → liveIn xs t ≠ [] → ¬t ∈ T → T.length = k) ∧ ∀ (p : RecordId × Shown), p ∈ hs ↔ ∃ t, t ∈ T ∧ ∃ r, r ∈ liveIn xs t ∧ (r.id, r.shown) = pkeyedValue_collect_newest
Laws.KeyedSlots
∀ {xs : List Record}, Addressed xs → ∀ (f : Option Follow) (ev : String → Tri) (k : Nat) {hs : List (RecordId × Shown)} {u : Nat}, keyedValue (FoldType.collect f (some k)) xs ev = SlotValue.heads hs u → ∀ {t t' : String} {r q : Record}, r ∈ liveIn xs t → (r.id, r.shown) ∈ hs → t' ∈ thingsOf xs → ev t' = Tri.yes → q ∈ liveIn xs t' → ¬(q.id, q.shown) ∈ hs → ∃ p, p ∈ liveIn xs t ∧ Newer p qwholeThings_whole
Laws.KeyedSlots
∀ {l : Option Nat} {rs : List Record} {r q : Record}, r ∈ wholeThings l rs → q ∈ rs → q.thing = r.thing → q ∈ wholeThings l rswholeThings_newest
Laws.KeyedSlots
∀ {k : Nat} {rs : List Record}, List.Pairwise Newer rs → ∀ {r q : Record}, r ∈ wholeThings (some k) rs → q ∈ rs → ¬q ∈ wholeThings (some k) rs → ∃ p, p ∈ rs ∧ p.thing = r.thing ∧ Newer p qwholeThings_distinct
Laws.KeyedSlots
∀ {l : Option Nat} {rs : List Record}, (List.map Record.thing rs).Nodup → wholeThings l rs = limitTo l rs
- pinned by
7 files
spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/43-keys-fork-once (current main; may differ from this page's build) spec/run/44-keys-numbers (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/51-keys-collect-limit (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order content order thing.one
- carries
keyed.whole-read
In its question
keyed.by
Exactness
A slot with by that follows keys groups things. A payload key is read from each live setter of the field; an envelope key from each chosen head. Every selected thing, or one whose tests are unknown, is exactly one of grouped, ungrouped or unread.
Each distinct member key across those lists gives one group. A live setter whose payload is not held makes a payload key unread; with no setter the thing is ungrouped. An envelope key is never unread: the envelope is read from the heads, so a later head moves a thing between groups, a forked thing is in the group of each chosen head once, and a pure-join head settles them. Each group is the slot without by over its things.
laws.md A slot with by that follows keys groups things. Distinct payload keys are collected across the live setters of the field, and one that is not held makes it unread; with no setter the thing is ungrouped. An envelope key is read from each chosen head and is never unread, so a later head moves a thing between groups and a forked thing is in the group of each of its chosen heads, once. Every selected thing, or one whose tests are unknown, is exactly one of grouped, ungrouped or unread.
- proved by
By.thingKeys_payload
Laws.KeyedSlots
∀ {f : String} (sel : Record → Bool) (cs : List Cond) (xs : List Record) (t : String), (By.payload f).thingKeys sel cs xs t = if ((setters (recordsOf t xs) f).all fun x => ((By.payload f).keys x).isSome) = true then some (canonSet (List.flatMap (fun r => ((By.payload f).keys r).getD []) (setters (recordsOf t xs) f))) else noneBy.thingKeys_envelope
Laws.KeyedSlots
∀ {b : By}, (∀ (f : String), b ≠ By.payload f) → ∀ (sel : Record → Bool) (cs : List Cond) (xs : List Record) (t : String), b.thingKeys sel cs xs t = some (canonSet (List.flatMap (fun h => (b.keys h).getD []) (List.filter (chosen sel cs) (stateIn t xs).heads)))By.thingKeys_unheld
Laws.KeyedSlots
∀ {f : String} {sel : Record → Bool} {cs : List Cond} {xs : List Record} {t : String} {r : Record}, r ∈ setters (recordsOf t xs) f → r.shown ≠ Shown.here → (By.payload f).thingKeys sel cs xs t = noneBy.thingKeys_unset
Laws.KeyedSlots
∀ {f : String} {sel : Record → Bool} {cs : List Cond} {xs : List Record} {t : String}, setters (recordsOf t xs) f = [] → (By.payload f).thingKeys sel cs xs t = some []Slot.keyedGrouped_eq
Laws.KeyedSlots
∀ (s : Slot) (b : By) (sel : Record → Bool) (xs : List Record), s.keyedGrouped b sel xs = SlotValue.groups (List.map (fun g => (g, (keyedValue s.type xs fun t => if (thingEv sel s.tests.conds xs t == Tri.yes && ((b.thingKeys sel s.tests.conds xs t).getD []).contains g) = true then Tri.yes else Tri.no).group)) (canonSet (List.flatMap (fun t => (b.thingKeys sel s.tests.conds xs t).getD []) (List.filter (fun x => thingEv sel s.tests.conds xs x == Tri.yes) (thingsOf xs))))) ((List.filter (fun x => thingEv sel s.tests.conds xs x == Tri.unknown) (thingsOf xs)).length + (List.filter (fun t => thingEv sel s.tests.conds xs t == Tri.yes && (b.thingKeys sel s.tests.conds xs t).isNone) (thingsOf xs)).length) (List.filter (fun t => thingEv sel s.tests.conds xs t == Tri.yes && b.thingKeys sel s.tests.conds xs t == some []) (thingsOf xs)).length
Slot.keyedGrouped_envelope_unread
Laws.KeyedSlots
∀ {b : By}, (∀ (f : String), b ≠ By.payload f) → ∀ (s : Slot) (sel : Record → Bool) (xs : List Record), ∃ gs m, s.keyedGrouped b sel xs = SlotValue.groups gs (List.filter (fun x => thingEv sel s.tests.conds xs x == Tri.unknown) (thingsOf xs)).length mBy.keyedAccounting
Laws.KeyedSlots
∀ (keys : String → Option (List String)) (ev : String → Tri) (ts : List String), (List.filter (fun x => ev x != Tri.no) ts).length = (List.filter (fun t => ev t == Tri.yes && (keys t).getD [] != []) ts).length + (List.filter (fun t => ev t == Tri.yes && keys t == some []) ts).length + ((List.filter (fun x => ev x == Tri.unknown) ts).length + (List.filter (fun t => ev t == Tri.yes && (keys t).isNone) ts).length)
- pinned by
7 files
spec/run/45-keys-by-payload (current main; may differ from this page's build) spec/run/46-keys-by-about (current main; may differ from this page's build) spec/run/47-keys-collect (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build) spec/run/50-keys-one-setter-unheld (current main; may differ from this page's build) spec/run/pv-keys-disjoint (current main; may differ from this page's build) spec/run/pv-keys-overlap (current main; may differ from this page's build) also naming it: spec/run/51-keys-collect-limit (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
keyed.whole-read
In its question
keyed.whole-read
Exactness
When every record is read whole and every thing has one head, a count, sum, min, max or collect that follows keys gives what the same slot following prev gives, grouped or not.
A thing's live records are then its one head, each field's live setter is that head, and its envelope is that head's. Latest-by is outside: following keys it gives each thing's keyed state.
laws.md When every record is read whole and every thing has one head, a count, sum, min, max or collect that follows keys gives what the same slot following prev gives, grouped or not: a thing's live records are its one head, each field's live setter is that head, and its envelope is that head's.
- proved by
Slot.keys_as_prev
Laws.KeyedSlots
∀ {xs : List Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → ∃ h, (stateIn t xs).heads = [h]) → ∀ (s : Slot), (∀ (f : Follow), s.type ≠ FoldType.latestBy f) → ∀ (sel : Record → Bool), { name := s.name, type := FoldType.following Follow.keys s.type, tests := s.tests, group := s.group }.run sel xs = { name := s.name, type := FoldType.following Follow.prev s.type, tests := s.tests, group := s.group }.run sel xskeyedValue_as_prev
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ (s : Slot), (∀ (f : Follow), s.type ≠ FoldType.latestBy f) → ∀ (sel : Record → Bool) (e : String → Tri), (∀ (t : String), t ∈ thingsOf xs → e t = if chosen sel s.tests.conds (hd t) = true then payTest s.tests.conds (hd t) else Tri.no) → keyedValue (FoldType.following Follow.keys s.type) xs e = { name := s.name, type := FoldType.following Follow.prev s.type, tests := s.tests, group := s.group }.plain sel xsAcc.select_as_things
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record} {σ : Type} (f : Acc σ) (ev : Record → Tri), Addressed xs → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ (pick : String → Option Record) (e : String → Tri), (∀ (t : String), t ∈ thingsOf xs → pick t = some (hd t)) → (∀ (t : String), t ∈ thingsOf xs → ev (hd t) = e t) → f.select ev (wholeHeads xs) = f.overThings pick e (thingsOf xs)collectOf_as_things
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ (sel : Record → Bool) (cs : List Cond) (limit : Option Nat) (fl : Option Follow) (e : String → Tri), (∀ (t : String), t ∈ thingsOf xs → e t = if chosen sel cs (hd t) = true then payTest cs (hd t) else Tri.no) → collectOf sel cs true limit xs = keyedValue (FoldType.collect fl limit) xs ewhole_liveFor_iff
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ {r : Record}, r ∈ recordsOf t xs → ∀ (k : String), liveFor (recordsOf t xs) k r = true ↔ r = hd twhole_live_iff
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ {r : Record}, r ∈ recordsOf t xs → (live (recordsOf t xs) r = true ↔ r = hd t)whole_setters
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ (k : String), setters (recordsOf t xs) k = [hd t]whole_thingTest
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ (cs : List Cond), thingTest cs (recordsOf t xs) = payTest cs (hd t)whole_thingEv
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ (sel : Record → Bool) (cs : List Cond), thingEv sel cs xs t = if chosen sel cs (hd t) = true then payTest cs (hd t) else Tri.nowhole_thingKeys
Laws.KeyedSlots
∀ {xs : List Record} {hd : String → Record}, Addressed xs → (∀ (r : Record), r ∈ xs → r.sets = none) → (∀ (t : String), t ∈ thingsOf xs → (stateIn t xs).heads = [hd t]) → ∀ {t : String}, t ∈ thingsOf xs → ∀ (b : By) (sel : Record → Bool) (cs : List Cond), chosen sel cs (hd t) = true → b.thingKeys sel cs xs t = Option.map canonSet (b.keys (hd t))
- pinned by
spec/run/49-keys-whole-read (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order by.after-admission content order heads.whole-view input.distinct keyed.by keyed.live keyed.select keyed.slots record.sets select.set thing.one where.set where.total
In its question
keyed.select
Exactness
Heads choose, each alone: a thing is kept when from and the envelope tests choose one of its heads and its payload tests hold of the thing, with its whole keyed state. A payload test is asked of every live setter of its field; one answer from all of them is the answer.
Two setters that answer differently, or one whose payload is not held, make the test unknown, and the thing is unread once. With no setter the field is absent, as a missing field in a held payload is. A record with sets is never asked about a key it does not declare. A declared null is present and an omitted field is absent. Each list is tested at its setter. The core compares test answers, never payload values.
laws.md Heads choose, each alone: a thing is kept when from and the envelope tests choose one of its heads and its payload tests hold of the thing, and it is kept with its whole keyed state. A payload test is asked of every live setter of its field: one answer from all of them is the answer; two that differ, or one whose payload is not held, make it unknown; with no setter the field is absent. Each list is tested at its setter. A declared, omitted key tests absent there, and a declared null tests present. A record with sets is no setter of a key it does not declare. A chosen thing whose tests are unknown is unread once.
- proved by
keyedOf_things
Laws.Live
∀ {sel : Record → Bool} {cs : List Cond} {xs : List Record} {ts : List (String × KeyedView)} {u : Nat}, keyedOf sel cs xs = SlotValue.keyed ts u → ∀ {t : String} {v : KeyedView}, (t, v) ∈ ts ↔ t ∈ thingsOf xs ∧ (∃ hd, hd ∈ (keyedIn t xs).heads ∧ chosen sel cs hd = true) ∧ thingTest cs (recordsOf t xs) = Tri.yes ∧ v = (keyedIn t xs).viewkeyedOf_unread
Laws.Live
∀ {sel : Record → Bool} {cs : List Cond} {xs : List Record} {ts : List (String × KeyedView)} {u : Nat}, keyedOf sel cs xs = SlotValue.keyed ts u → u = (List.filter (fun t => (keyedIn t xs).heads.any (chosen sel cs) && thingTest cs (recordsOf t xs) == Tri.unknown) (thingsOf xs)).lengthCond.onThing_agree
Laws.Live
∀ {c : Cond} {f : String}, c.field = Field.payload f → ∀ {rs : List Record} {r : Record}, r ∈ rs → liveFor rs f r = true → ∀ {a : Tri}, (∀ (q : Record), q ∈ rs → liveFor rs f q = true → c.eval q = a) → c.onThing rs = aCond.onThing_differ
Laws.Live
∀ {c : Cond} {f : String}, c.field = Field.payload f → ∀ {rs : List Record} {q r : Record}, q ∈ rs → liveFor rs f q = true → r ∈ rs → liveFor rs f r = true → c.eval q ≠ c.eval r → c.onThing rs = Tri.unknownCond.onThing_unheld
Laws.Live
∀ {c : Cond} {f : String}, c.field = Field.payload f → ∀ {rs : List Record} {r : Record}, r ∈ rs → liveFor rs f r = true → r.shown ≠ Shown.here → c.onThing rs = Tri.unknownCond.onThing_unset
Laws.Live
∀ {c : Cond} {f : String}, c.field = Field.payload f → ∀ {rs : List Record}, (∀ (r : Record), r ∈ rs → liveFor rs f r = false) → c.onThing rs = Tri.ofBool (c.op.test [])liveFor_undeclared
Laws.Live
∀ {rs : List Record} {r : Record} {ks : List String} {f : String}, r.sets = some ks → ¬f ∈ ks → liveFor rs f r = false
- pinned by
7 files
scenario/keys-01-settled-setter (current main; may differ from this page's build) spec/run/37-keys-unheld-setters (current main; may differ from this page's build) spec/run/38-keys-undeclared (current main; may differ from this page's build) spec/run/39-keys-select-heads (current main; may differ from this page's build) spec/run/40-keys-payload-tests (current main; may differ from this page's build) spec/run/pv-keys-disjoint (current main; may differ from this page's build) spec/run/pv-keys-overlap (current main; may differ from this page's build) also naming it: spec/run/42-keys-count-open (current main; may differ from this page's build) spec/run/46-keys-by-about (current main; may differ from this page's build) spec/run/48-keys-where (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
keyed.whole-read
In its question
by.set
Invariance
Change the order the records arrive in, and every group of a slot with by, its keys, its unread and its ungrouped stays.
The set of groups a record joins is a function of that record alone. Each group is the slot without by run over the whole held set, so it rests on acc.set without follow and on heads.set with it.
laws.md The set of groups a record joins is a function of that record alone, and each group is the slot without by run over the whole held set, choosing only its own records. So each group's answer depends only on the set: through acc.set without follow and heads.set with it. The keys, the unread and the ungrouped are counts of the same set.
- proved by
Slot.grouped_set_decides
Laws.Spec
∀ (s : Slot) (b : By) (sel : Record → Bool) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → s.grouped b sel xs = s.grouped b sel ysSlot.plain_set_decides
Laws.Spec
∀ (s : Slot) (sel : Record → Bool) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → s.plain sel xs = s.plain sel ysgroupKeys_same
Laws.Spec
∀ (b : By) (ev : Record → Tri) {xs ys : List Record}, (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → groupKeys b ev xs = groupKeys b ev ysSlot.pool_set_decides
Laws.Spec
∀ (s : Slot) {xs ys : List Record}, Distinct xs → Distinct ys → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → ∀ (r : Record), r ∈ s.pool xs ↔ r ∈ s.pool ys
- pinned by
spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build)also naming it: spec/run/26-by-key-order (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
heads.whole-view input.distinct keyed.fold keyed.live latest-by.set record.sets select.set spec.follow spec.set thing.local
- carries
spec.set
In its question
by.after-admission
Exactness
Settling, admission and the whole-reader heads are worked out once, over everything held, before any group. Each group is the unmodified slot over all of it, with its selection narrowed to the group.
A group never settles, admits or finds heads on its own: an eraser or a successor in another group still counts, and a prev across things is refused whichever group the refused record would join.
laws.md Settling, admission and the whole-reader heads are worked out once, over everything held, before any group; a group never settles, admits or finds heads on its own. Each group is the unmodified slot over all of it with its selection narrowed to the group.
- proved by
Slot.grouped_eq
Laws.By
∀ (s : Slot) (b : By) (sel : Record → Bool) (xs : List Record), s.grouped b sel xs = SlotValue.groups (List.map (fun g => (g, ({ name := s.name, type := s.type }.plain (inGroup b (s.ev sel) g) xs).group)) (groupKeys b (s.ev sel) (s.pool xs))) ((List.filter (fun x => s.ev sel x == Tri.unknown) (s.pool xs)).length + (List.filter (fun r => s.ev sel r == Tri.yes && (b.keys r).isNone) (s.pool xs)).length) (List.filter (fun r => s.ev sel r == Tri.yes && b.keys r == some []) (s.pool xs)).length
- pinned by
scenario/by-01-erased-in-another-group (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build)also naming it: spec/run/30-by-follow-collect (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
by.partition keyed.whole-read
In its question
by.accounting
Exactness
Every record a slot with by selects, or whose where is unknown, is exactly one of grouped, ungrouped or unread. The groups hold each grouped record once per key.
The group sizes add up to memberships, not records: a record mentioning two projects is in both. When every selected record has at most one key they add up to records: always for kind and observer, and for a payload field with at most one distinct key per record. A group exists only where something was selected into it.
laws.md Every record the slot selects, or whose where is unknown, is exactly one of grouped (it has a key), ungrouped (its key is readably absent) or unread (its where is unknown, or its key can't be read). The groups hold each grouped record once per key, so the group sizes add up to keys of selected records: memberships, not records. When every selected record has at most one key they add up to the grouped records: always for kind and observer, and for a payload field when each record has at most one distinct readable key. A group exists only where something was selected into it.
- proved by
By.accounting
Laws.By
∀ (b : By) (ev : Record → Tri) (pool : List Record), (List.filter (fun x => ev x != Tri.no) pool).length = (List.filter (fun r => ev r == Tri.yes && (b.keys r).getD [] != []) pool).length + (List.filter (fun r => ev r == Tri.yes && b.keys r == some []) pool).length + ((List.filter (fun x => ev x == Tri.unknown) pool).length + (List.filter (fun r => ev r == Tri.yes && (b.keys r).isNone) pool).length)
By.memberships
Laws.By
∀ (b : By) (ev : Record → Tri) (pool : List Record), (List.map (fun g => (List.filter (inGroup b ev g) pool).length) (groupKeys b ev pool)).sum = (List.map (fun r => ((b.keys r).getD []).length) (List.filter (fun x => ev x == Tri.yes) pool)).sum
By.accounting_single
Laws.By
∀ {b : By} {ev : Record → Tri} {pool : List Record}, b.OneKey ev pool → (List.map (fun g => (List.filter (inGroup b ev g) pool).length) (groupKeys b ev pool)).sum + (List.filter (fun r => ev r == Tri.yes && b.keys r == some []) pool).length + ((List.filter (fun x => ev x == Tri.unknown) pool).length + (List.filter (fun r => ev r == Tri.yes && (b.keys r).isNone) pool).length) = (List.filter (fun x => ev x != Tri.no) pool).lengthBy.accounting_single_form
Laws.By
∀ {b : By}, b.Single → ∀ (ev : Record → Tri) (pool : List Record), (List.map (fun g => (List.filter (inGroup b ev g) pool).length) (groupKeys b ev pool)).sum + (List.filter (fun r => ev r == Tri.yes && b.keys r == some []) pool).length + ((List.filter (fun x => ev x == Tri.unknown) pool).length + (List.filter (fun r => ev r == Tri.yes && (b.keys r).isNone) pool).length) = (List.filter (fun x => ev x != Tri.no) pool).lengthBy.keys_single
Laws.By
∀ {b : By}, b.Single → ∀ (r : Record), ((b.keys r).getD []).length ≤ 1By.OneKey.of_single
Laws.By
∀ {b : By}, b.Single → ∀ (ev : Record → Tri) (pool : List Record), b.OneKey ev poolgroupKeys_nonempty
Laws.By
∀ {b : By} {ev : Record → Tri} {pool : List Record} {g : String}, g ∈ groupKeys b ev pool → ∃ r, r ∈ pool ∧ inGroup b ev g r = trueHeldField.list_key
Laws.Payload
∀ (vs : List Val) (k : String), k ∈ (HeldField.many vs).keys ↔ ∃ v, v ∈ vs ∧ v.key = some k
By.keys_single_nonlist
Laws.By
∀ (r : Record) (f : String), (∀ (vs : List Val), r.get f ≠ some (HeldField.many vs)) → (((By.payload f).keys r).getD []).length ≤ 1
- pinned by
spec/run/21-by-keys (current main; may differ from this page's build) spec/run/22-by-about (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/25-by-collect (current main; may differ from this page's build) spec/run/pv-lists-mixed (current main; may differ from this page's build) spec/run/pv6-key-80 (current main; may differ from this page's build)also naming it: scenario/by-01-erased-in-another-group (current main; may differ from this page's build) spec/run/27-by-number-keys (current main; may differ from this page's build) spec/run/28-by-mentions (current main; may differ from this page's build) spec/run/29-by-collect-limit (current main; may differ from this page's build) spec/run/30-by-follow-collect (current main; may differ from this page's build) spec/run/pv2-backups (current main; may differ from this page's build) spec/run/pv2-settings (current main; may differ from this page's build) spec/run/pv2-written-empty (current main; may differ from this page's build) spec/run/pv2-written-zero (current main; may differ from this page's build) spec/run/pv6-list-groups (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order
- carries
by.partition
In its question
by.partition
Exactness
A grouped count's groups, ungrouped and unread add up to the value and unread of the same count without by, when every selected record has at most one key.
Kind and observer always give one key. A list field or a prefixed about can give several. Otherwise the group values add up to the keys of the selected records.
laws.md A grouped count's group values add up to the keys of the records it selects. When every selected record has at most one key (always for kind and observer), its groups, ungrouped and unread add up to the value and unread of the same count without by.
- proved by
By.count_partition
Laws.By
∀ {f : Option Follow}, f ≠ some Follow.keys → ∀ {s : Slot} {b : By} {sel : Record → Bool} {xs : List Record}, b.OneKey (s.ev sel) (s.pool xs) → s.type = FoldType.count f → ∃ gs u m r, s.grouped b sel xs = SlotValue.groups gs u m ∧ { name := s.name, type := s.type, tests := s.tests }.run sel xs = SlotValue.nat r ∧ (List.map (fun x => x.snd.count) gs).sum + m + u = r.value + r.unreadBy.count_partition_form
Laws.By
∀ {f : Option Follow}, f ≠ some Follow.keys → ∀ {s : Slot} {b : By}, b.Single → ∀ (sel : Record → Bool) (xs : List Record), s.type = FoldType.count f → ∃ gs u m r, s.grouped b sel xs = SlotValue.groups gs u m ∧ { name := s.name, type := s.type, tests := s.tests }.run sel xs = SlotValue.nat r ∧ (List.map (fun x => x.snd.count) gs).sum + m + u = r.value + r.unreadBy.count_memberships
Laws.By
∀ {f : Option Follow}, f ≠ some Follow.keys → ∀ {s : Slot} {b : By} (sel : Record → Bool) (xs : List Record), s.type = FoldType.count f → ∃ gs u m, s.grouped b sel xs = SlotValue.groups gs u m ∧ (List.map (fun x => x.snd.count) gs).sum = (List.map (fun r => ((b.keys r).getD []).length) (List.filter (fun x => s.ev sel x == Tri.yes) (s.pool xs))).sum
- pinned by
spec/run/21-by-keys (current main; may differ from this page's build) spec/run/23-by-after-admission (current main; may differ from this page's build) spec/run/24-by-follow (current main; may differ from this page's build) spec/run/pv6-list-groups (current main; may differ from this page's build)also naming it: spec/run/27-by-number-keys (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
by.accounting by.after-admission result.unread
In its questionWithout its premise
spec.after-supersession
Exactness
A slot over heads returns only records that remain heads of at least one thing. Each returned record passes from and every test.
Holds when the store's rule for who may replace whom reads only envelopes. A record heads at most one thing. Under a view, each thing keeps the same heads, and each head shows only what the view shows.
laws.md A slot over heads returns only heads retained in at least one thing, selected by its source, and passing every test. If the store's replacement rule reads only envelopes, a view keeps each thing's heads. Each head then shows only what the view shows.
- proved by
latestOf_heads
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) {xs : List Record}, Addressed xs → ∀ {ts : List (String × List (RecordId × Shown))} {u : Nat}, latestOf sel cs xs = SlotValue.things ts u → ∀ {t : String} {ps : List (RecordId × Shown)}, (t, ps) ∈ ts → ∀ {p : RecordId × Shown}, p ∈ ps → ∃ r, HeadOf xs t r ∧ sel r = true ∧ Cond.all cs r = Tri.yes ∧ (r.id, r.shown) = pcollectOf_heads
Laws.Spec
∀ (sel : Record → Bool) (cs : List Cond) (limit : Option Nat) {xs : List Record}, Addressed xs → ∀ {hs : List (RecordId × Shown)} {u : Nat}, collectOf sel cs true limit xs = SlotValue.heads hs u → ∀ {p : RecordId × Shown}, p ∈ hs → ∃ t r, HeadOf xs t r ∧ sel r = true ∧ Cond.all cs r = Tri.yes ∧ (r.id, r.shown) = pSpec.view_state
Laws.Spec
∀ {f : Record → Record}, View f → ∀ {may : Record → Record → Bool}, EnvOnly may → ∀ {xs : List Record}, Distinct xs → perThing (admit may (List.map f xs)) = List.map (fun p => (p.fst, { named := p.snd.named, heads := List.map f p.snd.heads })) (perThing (admit may xs))
- pinned by
spec/run/03-withheld-successor (current main; may differ from this page's build) spec/run/04-kind-change (current main; may differ from this page's build) spec/run/08-envelope-fields (current main; may differ from this page's build)also naming it: spec/run/20-follow-envelope-after-supersession (current main; may differ from this page's build) spec/run/39-keys-select-heads (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
content order input.distinct record.sets view.no-resurrection (things)
In its question
spec.slice
Invariance
Change whether a reader holds everything, or only a slice for this spec, and every slot of the spec: its values, its current records with what is shown of each, and its unread counts stays.
Holds when the store's rule for who may replace whom reads only envelopes; the forms of one id agree: the same envelope, and the same payload wherever it is held. thing.slice answers for one thing. A spec takes records by kind, by mention and by thing, so the records it takes need not be whole things, and two more kinds of record matter. A taken record is current only when no admitted record of its thing replaces it, and the replacing record may be one the spec does not take. That record replaces only when it is admitted, and admission reads the thing of each of its held prev targets. Admission reads what is held, not what is admitted, so nothing further out is read. The proof reads only the envelopes of everything but the taken records. Neither new kind can be dropped: without the successor a slice shows a record the whole has replaced, and without the successor's other target it admits a successor the whole refuses. So the records a spec takes are not by themselves enough to answer it. A slot that follows keys, of any fold type, is outside this law: it reads live setters the spec does not take. The slice for one keyed thing is keyed.slice, and keyed.spec-slice answers a spec with such a slot.
laws.md A reader holding part of the set gets a spec's whole answer when its part is a slice for the spec. A spec slice holds every form of the records the spec takes, every record that erases one of them, every record one of them names in prev, every record that names one of them in prev, and every record such a successor names in prev. Only the taken records are read whole; the envelopes of the rest are enough. A slot with by needs nothing more: a group's key reads only a taken record. Neither of the last two can be dropped. A slot that follows keys, of any fold type, is outside this law: it reads live setters the spec does not take. The slice for one keyed thing is keyed.slice, and keyed.spec-slice answers a spec with such a slot.
- proved by
Spec.run_slice
Laws.SpecSlice
∀ {sp : Spec} {S W : List Record} {may : Record → Record → Bool}, EnvOnly may → Forms W → SpecSlice sp S W → (∀ (s : Slot), s ∈ sp.slots → s.type.follow ≠ some Follow.keys) → sp.run (settle S) may = sp.run (settle W) mayfollowed_slice
Laws.SpecSlice
∀ {sp : Spec} {S W : List Record} {may : Record → Record → Bool}, EnvOnly may → Forms W → SpecSlice sp S W → ∀ {sel : Record → Bool}, (∀ (r : Record), sel r = true → sp.takes r = true) → ∀ {σ : Type} (f : Acc σ) (cs : List Cond), f.select (fun r => if sel r = true then Cond.all cs r else Tri.no) (wholeHeads (realm may S)) = f.select (fun r => if sel r = true then Cond.all cs r else Tri.no) (wholeHeads (realm may W))Slot.grouped_slice
Laws.SpecSlice
∀ {sp : Spec} {S W : List Record} {may : Record → Record → Bool}, EnvOnly may → Forms W → SpecSlice sp S W → ∀ (s : Slot), s.type.follow ≠ some Follow.keys → ∀ (b : By), s.grouped b sp.takes (realm may S) = s.grouped b sp.takes (realm may W)spec_slice_needs_successors
Laws.SpecSlice
ss.spec.run (settle [ss.a]) ≠ ss.spec.run (settle [ss.a, ss.d])
spec_slice_needs_their_targets
Laws.SpecSlice
ss.spec.run (settle [ss.a, ss.c]) ≠ ss.spec.run (settle [ss.a, ss.b, ss.c])
- pinned by
- (a part of a set: none yet)
- rests on
UTF-16 order content order heads.whole-view input.distinct latest-by.set record.sets select.set settle.set thing.one
- carries
keyed.spec-slice
In its question
keyed.spec-slice
Invariance
Change whether a reader holds everything, or a spec slice with a cover of every thing the spec could select, and every slot of the spec, the slots that follow keys among them stays.
Holds when the store's rule for who may replace whom reads only envelopes; the forms of one id agree: the same envelope, and the same payload wherever it is held; no record held is above itself over prev; real ids give this, since an id is a hash of an envelope that holds its prev, and the model's records do not. A slot that follows keys reads each thing it selects by its live setters, records the spec need not take, so spec.slice is not enough for it. A part covers a thing when its folded records of the thing are the whole's, hold the thing's live records, and are witnessed for every key (keyed.witnessed); it then reads the thing's heads, payload tests, setters, live records and group keys as the whole does. A thing need not be covered when neither reader can select it: the part folds no record of it the spec takes, and the whole has no head of it the spec takes. The cover alone answers a spec whose slots all follow keys. A part of the forms covers a thing as keyed.slice says, and with anchored names by the forms of its live records and what erases them; that case is the one that needs prev to have no cycle. A spec slice can bring, as a target, a record of a covered thing that the whole refuses; the part then holds what that record names in prev and so refuses it too, or it admits the record and reads the keys it sets. The law asks for what erases any record the part holds of a covered thing, a little more than a keyed slot reads.
laws.md A reader holding part of the set gets the answer of every slot that follows keys, of any fold type, grouped or not, when its folded records cover each thing either reader could select. They cover a thing when its records there are the whole's, hold the thing's live records, and are witnessed for every key. A thing need not be covered when the part folds no record of it the spec takes and the whole has no head of it the spec takes. With a spec slice beside the cover, every slot of the spec is answered. A part of the forms covers a thing as keyed.slice says; with anchored names the forms of its live records and what erases them are enough. A spec slice alone is not enough: it need not hold a live setter the spec does not take. It can also bring, as a target, a record of a covered thing that the whole refuses; the part then holds what that record names in prev and so refuses it too, or it admits the record and reads the keys it sets.
- proved by
Spec.run_slice_keyed
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record} {sp : Spec}, EnvOnly may → Forms W → SpecSlice sp S W → KeyedCover sp.takes (realm may S) (realm may W) → sp.run (settle S) may = sp.run (settle W) maySpec.run_keyed
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record} (sp : Spec), (∀ (s : Slot), s ∈ sp.slots → s.type.follow = some Follow.keys) → KeyedCover sp.takes (realm may S) (realm may W) → sp.run (settle S) may = sp.run (settle W) maySlot.keyed_cover
Laws.KeyedSpecSlice
∀ {ys xs : List Record} {sel : Record → Bool}, Addressed xs → Addressed ys → KeyedCover sel ys xs → ∀ (s : Slot), s.type.follow = some Follow.keys → s.run sel ys = s.run sel xskeyedValue_part
Laws.KeyedSpecSlice
∀ {ys xs : List Record} {evy evx : String → Tri}, Addressed xs → Addressed ys → ∀ (ty : FoldType), (∀ (t : String), Covers t ys xs ∨ evy t = Tri.no ∧ evx t = Tri.no) → (∀ (t : String), Covers t ys xs → evy t = evx t) → (∀ (t : String), Covers t ys xs → evx t ≠ Tri.no → t ∈ thingsOf ys) → keyedValue ty ys evy = keyedValue ty xs evxCovers.thingEv
Laws.KeyedSpecSlice
∀ {t : String} {ys xs : List Record}, Covers t ys xs → Addressed xs → Addressed ys → ∀ (sel : Record → Bool) (cs : List Cond), thingEv sel cs ys t = thingEv sel cs xs tcovers_of_keyedPart
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record}, EnvOnly may → ∀ {t : String}, Forms W → KeyedPart may t S W → (∀ (r : Record), r ∈ recordsOf t (realm may W) → live (recordsOf t (realm may W)) r = true → ∃ a, a ∈ S ∧ a.id = r.id) → (∀ (o : Option String), Witnessed (recordsOf t (realm may S)) (recordsOf t (realm may W)) o) → Covers t (realm may S) (realm may W)covers_of_live
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record}, EnvOnly may → ∀ {t : String}, Forms W → KeyedPart may t S W → NoCycle (recordsOf t (realm may W)) → Anchored (recordsOf t (realm may W)) → (∀ (r : Record), r ∈ recordsOf t (realm may W) → live (recordsOf t (realm may W)) r = true → ∃ a, a ∈ S ∧ a.id = r.id) → (∀ (r : Record), r ∈ recordsOf t (realm may W) → (∃ a, a ∈ S ∧ a.id = r.id) → live (recordsOf t (realm may W)) r = true) → Covers t (realm may S) (realm may W)KeyedPart.of_targets
Laws.KeyedSpecSlice
∀ {may : Record → Record → Bool} {S W : List Record}, EnvOnly may → ∀ {t : String}, Forms W → (∀ (r : Record), r ∈ S → r ∈ W) → (∀ (a : Record), a ∈ S → a.isOf t = true → ∀ (b : Record), b ∈ W → b.id = a.id → b ∈ S) → (∀ (a : Record), a ∈ S → a.isOf t = true → ∀ (e : Record), e ∈ W → e.erases.contains a.id = true → e ∈ S) → (∀ (r : Record), r ∈ settle W → r.isOf t = true → (∃ a, a ∈ S ∧ a.id = r.id) → entitled may (settle W) r = true ∨ ∀ (q : Record), q ∈ W → q.id ∈ r.prev → q ∈ S) → KeyedPart may t S Wkeyed_slot_needs_live
Laws.KeyedSpecSlice
SpecSlice ks.spec [ks.n, ks.h] [ks.m, ks.n, ks.h] ∧ ks.spec.run (settle [ks.n, ks.h]) ≠ ks.spec.run (settle [ks.m, ks.n, ks.h])
refused_needs_targets
Laws.KeyedSpecSlice
SpecSlice ks.spec [rf.f, rf.g] [rf.y, rf.f, rf.g] ∧ ks.spec.run (settle [rf.f, rf.g]) ≠ ks.spec.run (settle [rf.y, rf.f, rf.g])
- pinned by
- (a part of a set: none yet)
- rests on
UTF-16 order content order input.distinct keyed.fold keyed.live keyed.slice keyed.witnessed latest-by.set select.set settle.set spec.slice thing.one
- carries
keyed.cut
In its question
spec.parse
Round trip
An accepted spec's parsed form parses back to itself, and the parser gives exactly the specs that fit.
laws.md The parser gives exactly fitting specs, each with a source. Parsed forms parse back to themselves. Repeated keys are refused at Json.repeatAt's path. Specs without repeats never receive that refusal. An array's elements are searched in order, so when two of them repeat a key the refusal is at the first one's repeat.
- proved by
Spec.ofJson_fits
Laws.Parse
∀ {j : Json} {sp : Spec}, Spec.ofJson j = Except.ok sp → sp.FitsSpec.ofJson_toJson
Laws.Parse
∀ {sp : Spec}, sp.Fits → Spec.ofJson sp.toJson = Except.ok spSpec.reparse
Laws.Parse
∀ {j : Json} {sp : Spec}, Spec.ofJson j = Except.ok sp → Spec.ofJson sp.toJson = Except.ok spSpec.parsed_iff
Laws.Parse
∀ (sp : Spec), (∃ j, Spec.ofJson j = Except.ok sp) ↔ sp.Fits
Spec.ofJson_repeat
Laws.Parse
∀ {j : Json}, j.keysDistinct = false → ∃ p, Json.repeatAt none j = some p ∧ Spec.ofJson j = refuse "member-duplicate" pJson.repeatAt_none
Laws.Parse
∀ (path : Option String) (j : Json), Json.repeatAt path j = none ↔ j.keysDistinct = true
Json.repeatIn_first
Laws.Parse
∀ (path : Option String) {pre : List Json} {x : Json} (rest : List Json) {p : String}, (∀ (y : Json), y ∈ pre → Json.repeatAt path y = none) → Json.repeatAt path x = some p → Json.repeatIn path (pre ++ x :: rest) = some p
- pinned by
147 files
spec/parse/01-latest-by (current main; may differ from this page's build) spec/parse/02-where-and-limit (current main; may differ from this page's build) spec/parse/03-numeric (current main; may differ from this page's build) spec/parse/04-envelope-fields (current main; may differ from this page's build) spec/parse/05-no-fold (current main; may differ from this page's build) spec/parse/06-from-about-anchor (current main; may differ from this page's build) spec/parse/10-not-object (current main; may differ from this page's build) spec/parse/100-follow-keys-on-min (current main; may differ from this page's build) spec/parse/101-follow-keys-on-max (current main; may differ from this page's build) spec/parse/102-follow-keys-on-collect (current main; may differ from this page's build) spec/parse/103-follow-key-on-latest-by (current main; may differ from this page's build) spec/parse/104-follow-keys-upper-on-latest-by (current main; may differ from this page's build) spec/parse/105-follow-keys-array-on-latest-by (current main; may differ from this page's build) spec/parse/106-argument-after-follow-keys-on-sum (current main; may differ from this page's build) spec/parse/107-limit-after-follow-keys-on-count (current main; may differ from this page's build) spec/parse/108-limit-on-keyed-latest-by (current main; may differ from this page's build) spec/parse/109-by-on-keyed-latest-by (current main; may differ from this page's build) spec/parse/11-unknown-key (current main; may differ from this page's build) spec/parse/110-argument-after-follow-keys (current main; may differ from this page's build) spec/parse/111-follow-keys-every-fold (current main; may differ from this page's build) spec/parse/112-limit-on-keyed-sum (current main; may differ from this page's build) spec/parse/113-limit-zero-on-keyed-collect (current main; may differ from this page's build) spec/parse/114-by-invalid-on-keyed-count (current main; may differ from this page's build) spec/parse/115-follow-keys-upper-on-count (current main; may differ from this page's build) spec/parse/116-where-tests-empty (current main; may differ from this page's build) spec/parse/117-where-tests-not-object (current main; may differ from this page's build) spec/parse/118-where-tests-array (current main; may differ from this page's build) spec/parse/119-repeat-first-element (current main; may differ from this page's build) spec/parse/12-vertex-missing (current main; may differ from this page's build) spec/parse/120-repeat-first-element-swapped (current main; may differ from this page's build) spec/parse/13-two-fold-types (current main; may differ from this page's build) spec/parse/14-no-fold-type (current main; may differ from this page's build) spec/parse/15-regex-refused (current main; may differ from this page's build) spec/parse/16-limit-on-count (current main; may differ from this page's build) spec/parse/17-follow-on-sum (current main; may differ from this page's build) spec/parse/18-from-not-array (current main; may differ from this page's build) spec/parse/19-sum-of-nothing (current main; may differ from this page's build) spec/parse/20-from-missing (current main; may differ from this page's build) spec/parse/21-from-empty (current main; may differ from this page's build) spec/parse/22-env-unknown-field (current main; may differ from this page's build) spec/parse/23-env-text-ordered (current main; may differ from this page's build) spec/parse/24-env-time-not-span (current main; may differ from this page's build) spec/parse/25-env-time-as-number (current main; may differ from this page's build) spec/parse/26-env-id-not-record-id (current main; may differ from this page's build) spec/parse/27-env-text-as-number (current main; may differ from this page's build) spec/parse/28-payload-bound-not-number (current main; may differ from this page's build) spec/parse/29-env-time-is-not-span (current main; may differ from this page's build) spec/parse/30-env-id-ordered (current main; may differ from this page's build) spec/parse/31-present-false (current main; may differ from this page's build) spec/parse/32-env-text-as-bool (current main; may differ from this page's build) spec/parse/33-env-id-as-number (current main; may differ from this page's build) spec/parse/34-env-observer-not-typed (current main; may differ from this page's build) spec/parse/35-env-kind-empty (current main; may differ from this page's build) spec/parse/36-env-about-not-typed (current main; may differ from this page's build) spec/parse/37-payload-is-null (current main; may differ from this page's build) spec/parse/38-where-empty (current main; may differ from this page's build) spec/parse/39-latest-by-without-follow (current main; may differ from this page's build) spec/parse/40-repeated-operator (current main; may differ from this page's build) spec/parse/41-repeated-key (current main; may differ from this page's build) spec/parse/42-slot-errors-in-order (current main; may differ from this page's build) spec/parse/43-where-errors-in-order (current main; may differ from this page's build) spec/parse/44-from-kind-empty (current main; may differ from this page's build) spec/parse/45-from-about-not-typed (current main; may differ from this page's build) spec/parse/46-from-kind-none (current main; may differ from this page's build) spec/parse/47-vertex-empty (current main; may differ from this page's build) spec/parse/48-vertex-not-text (current main; may differ from this page's build) spec/parse/49-store-empty (current main; may differ from this page's build) spec/parse/50-slot-name-empty (current main; may differ from this page's build) spec/parse/51-sum-field-empty (current main; may differ from this page's build) spec/parse/52-where-field-empty (current main; may differ from this page's build) spec/parse/53-repeat-depth-first (current main; may differ from this page's build) spec/parse/54-repeat-in-from (current main; may differ from this page's build) spec/parse/55-slot-limit-before-argument (current main; may differ from this page's build) spec/parse/56-from-errors-in-order (current main; may differ from this page's build) spec/parse/57-from-store-first (current main; may differ from this page's build) spec/parse/58-slot-not-object (current main; may differ from this page's build) spec/parse/59-slot-unknown-key (current main; may differ from this page's build) spec/parse/60-from-unknown-key (current main; may differ from this page's build) spec/parse/61-min-field-empty (current main; may differ from this page's build) spec/parse/62-max-field-empty (current main; may differ from this page's build) spec/parse/63-repeat-under-empty-key (current main; may differ from this page's build) spec/parse/64-slot-argument-before-where (current main; may differ from this page's build) spec/parse/65-latest-by-about (current main; may differ from this page's build) spec/parse/66-from-of (current main; may differ from this page's build) spec/parse/67-from-of-not-typed (current main; may differ from this page's build) spec/parse/68-from-about-before-of (current main; may differ from this page's build) spec/parse/69-env-of (current main; may differ from this page's build) spec/parse/70-env-of-not-typed (current main; may differ from this page's build) spec/parse/71-env-of-ordered (current main; may differ from this page's build) spec/parse/72-follow-on-count (current main; may differ from this page's build) spec/parse/73-follow-on-extrema (current main; may differ from this page's build) spec/parse/74-follow-not-prev-on-count (current main; may differ from this page's build) spec/parse/75-follow-not-text-on-max (current main; may differ from this page's build) spec/parse/76-follow-before-argument (current main; may differ from this page's build) spec/parse/77-argument-after-follow (current main; may differ from this page's build) spec/parse/78-limit-on-followed-count (current main; may differ from this page's build) spec/parse/79-by-forms (current main; may differ from this page's build) spec/parse/80-by-payload-named-about (current main; may differ from this page's build) spec/parse/81-by-not-text (current main; may differ from this page's build) spec/parse/82-by-empty (current main; may differ from this page's build) spec/parse/83-by-env-other (current main; may differ from this page's build) spec/parse/84-by-env-about-alone (current main; may differ from this page's build) spec/parse/85-by-env-alone (current main; may differ from this page's build) spec/parse/86-by-empty-prefix (current main; may differ from this page's build) spec/parse/87-by-prefix-upper (current main; may differ from this page's build) spec/parse/88-by-prefix-digit-first (current main; may differ from this page's build) spec/parse/89-by-prefix-colon (current main; may differ from this page's build) spec/parse/90-by-on-latest-by (current main; may differ from this page's build) spec/parse/91-by-on-followed-collect (current main; may differ from this page's build) spec/parse/92-limit-before-by (current main; may differ from this page's build) spec/parse/93-by-before-argument (current main; may differ from this page's build) spec/parse/94-argument-after-by (current main; may differ from this page's build) spec/parse/95-by-before-where (current main; may differ from this page's build) spec/parse/96-follow-before-by (current main; may differ from this page's build) spec/parse/97-follow-keys (current main; may differ from this page's build) spec/parse/98-follow-keys-on-count (current main; may differ from this page's build) spec/parse/99-follow-keys-on-sum (current main; may differ from this page's build) spec/parse/d3-overflow-argument (current main; may differ from this page's build) spec/parse/d3-overflow-bound (current main; may differ from this page's build) spec/parse/d3-overflow-limit (current main; may differ from this page's build) spec/parse/gap03-repeat-key-before-value (current main; may differ from this page's build) spec/parse/gap05-limit-zero (current main; may differ from this page's build) spec/parse/gap08-at-least--9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-at-least--9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-at-least-9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-at-least-9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-below--9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-below--9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-below-9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-below-9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-fractional-bound (current main; may differ from this page's build) spec/parse/gap08-is--9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-is--9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-is-9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-is-9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-not--9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-not--9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-not-9007199254740991 (current main; may differ from this page's build) spec/parse/gap08-not-9007199254740992 (current main; may differ from this page's build) spec/parse/gap08-whole-bound (current main; may differ from this page's build) spec/parse/gap09-absent (current main; may differ from this page's build) spec/parse/gap09-empty-array (current main; may differ from this page's build) spec/parse/gap09-empty-object (current main; may differ from this page's build) spec/parse/gap09-empty-text (current main; may differ from this page's build) spec/parse/gap09-null (current main; may differ from this page's build) spec/parse/phase2-null-fold (current main; may differ from this page's build) spec/parse/phase2-unsafe-limit (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
where.typed
- carries
result.canonical spec.hash tick.canonical tick.made
In its question
window.span
Exactness
The window field reads the stated occurrence span, or the point at the emitted instant when occurred is absent.
laws.md On any record, env.when reads the stated occurrence span or, if absent, a point at the emitted instant.
- proved by
Field.when_occurred
Laws.Spec
∀ {r : Record} {c : Claim}, r.occurred = some c → (Field.env EnvField.when).read r = some [Item.time c.span]Field.when_emitted
Laws.Spec
∀ {r : Record}, r.occurred = none → (Field.env EnvField.when).read r = some [Item.time (Span.point r.emitted.moment)]
- pinned by
tick/when-backfill (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
In its question
window.heads
Exactness
An envelope window filters each thing’s existing heads. A count following prev applies its window and other tests to the heads of the entire supplied pool.
laws.md An envelope window filters each thing’s heads computed over the full input. For a count following prev, with a window and any additional tests, the count applies the selection and tests to the heads of the entire supplied pool. A successor outside the window still displaces its predecessor.
- proved by
window_filter_heads
Laws.Spec
∀ (t : String) (xs : List Record) (sel : Record → Bool) (op : Op) (cs : List Cond), List.filter (chosen sel ({ field := Field.env EnvField.when, op := op } :: cs)) (stateIn t xs).heads = List.filter (fun r => op.test [Item.time r.span] && chosen sel cs r) (stateIn t xs).headswindow_count_heads
Laws.Spec
∀ (name : String) (ops : List Op) (other : Tests) (sel : Record → Bool) (xs : List Record), { name := name, type := FoldType.count (some Follow.prev), tests := (Field.env EnvField.when, ops) :: other }.run sel xs = SlotValue.nat (Count.acc.select (fun r => if sel r = true then Cond.all (Tests.conds ((Field.env EnvField.when, ops) :: other)) r else Tri.no) (wholeHeads xs))
- pinned by
tick/when-after-heads (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
In its question
spec.hash
Exactness
Two fitting parsed specs have equal preimages exactly when their versions agree and they differ only in the order of slots, fields within a where, and operators within a field. Such specs have equal hashes and give equal result bytes on every input.
Holds when the spec names each slot once, as every spec the parser accepts does. For arbitrary JSON members the preimage determines the version and JCS text. The result equality holds for every common admission rule. The proofs assume no property of the hash function.
laws.md The version reader accepts precisely each positive version’s decimal text. For an arbitrary member, equal preimages are exactly equal versions and equal JCS texts. For fitting parsed specs, preimages agree exactly when the versions agree and the specs differ only in slot order, field order within a where, or operator order within a field. Such specs give the same hash for any hash function. With unique slot names, member-equivalent specs give equal result bytes on every input and admission rule.
- proved by
Rules.ofJson?_eq_some_iff
Laws.SpecHash
∀ {j : Json} {v : Rules}, Rules.ofJson? j = some v ↔ j = Json.str v.textspecPreimageOf_eq_iff
Laws.SpecHash
∀ {v w : Rules} {j k : Json}, specPreimageOf v j = specPreimageOf w k ↔ v = w ∧ j.canon = k.canonSpec.preimage_eq_iff
Laws.SpecHash
∀ {a b : Spec}, a.Fits → b.Fits → ∀ {v w : Rules}, specPreimageOf v a.toJson = specPreimageOf w b.toJson ↔ v = w ∧ a.MemberEq bSpec.memberEq_preimage
Laws.SpecHash
∀ {a b : Spec}, a.Fits → b.Fits → a.MemberEq b → ∀ (v : Rules), specPreimageOf v a.toJson = specPreimageOf v b.toJsonSpec.memberEq_hash
Laws.SpecHash
∀ {a b : Spec}, a.Fits → b.Fits → a.MemberEq b → ∀ (H : Hash) (v : Rules), Spec.hash H v a = Spec.hash H v bSpec.memberEq_resultBytes
Laws.SpecHash
∀ {a b : Spec}, a.MemberEq b → (List.map (fun x => x.name) a.slots).Nodup → (List.map (fun x => x.name) b.slots).Nodup → ∀ (xs : List Record) (may : Record → Record → Bool), resultBytes (a.run xs may) = resultBytes (b.run xs may)
- pinned by
8 files
tick/backups-hash (current main; may differ from this page's build) tick/carried-note (current main; may differ from this page's build) tick/kind-order (current main; may differ from this page's build) tick/member-order (current main; may differ from this page's build) tick/renamed-store (current main; may differ from this page's build) tick/renamed-vertex (current main; may differ from this page's build) tick/rules-version (current main; may differ from this page's build) tick/source-order (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- rests on
UTF-16 order record.member-order result.canonical result.no-commit spec.parse where.set
- carries
tick.canonical
In its question
spec.no-commit
Exactness
Byte 17 of the spec preimage is v. A record commitment hashes a 16-byte salt followed by JSON, whose first byte cannot be v.
laws.md For every version and JSON member, byte 17 of the preimage is v. A record commitment has exactly 16 bytes of salt followed by JCS, which cannot start with v.
- proved by
specPreimage_ne_commit
Laws.SpecHash
∀ (v : Rules) (j p : Json) {salt : List UInt8}, salt.length = 16 → specPreimageOf v j ≠ salt ++ utf8 p.canon
- pinned by
tick/preimage-domains (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- rests on
result.canonical result.no-commit
In its question
spec.no-result
Exactness
Spec and result preimages differ at byte seven for every version, spec member and result.
laws.md Byte seven of every spec preimage is s and byte seven of every result preimage is r. The two inputs to the hash are disjoint.
- proved by
specPreimage_ne_result
Laws.SpecHash
∀ (v : Rules) (j : Json) (r : List (String × SlotValue)), specPreimageOf v j ≠ resultPreimage r
- pinned by
tick/preimage-domains (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
In its question
tick.canonical
Round trip
A fitting written payload reads back under its own rules in spec slot order, with listed ids shown here. Every successful common read excludes repeated names throughout. Equal JCS texts of finite accepted inputs have equal wire values, including array positions and scalar tokens.
Holds when the JSON values have finite numbers throughout, as JCS requires; the spec names each slot once, as every spec the parser accepts does. The writer requires two 32-byte digests, strictly increasing id lists, every withheld id covered and distinct names in the spec and result. Typed payload reads preserve the input text. Reconstructing it from raw members also requires a known result label: the stated version is at most the reader's.
laws.md The raw writer reads back for every reader version given distinct names throughout the spec and result, both 32-byte digests, strictly increasing id lists and every withheld id covered. Under its own version a fitting spec and one matching value per slot in spec order read back with listed ids' visibility set to here. Every successful common read has distinct names at every depth. Two such inputs with finite numbers and equal JCS text have equal wire values: object members are sorted recursively, array positions are preserved and scalars keep their JCS tokens. For two checked record payloads equal JCS text alone suffices. Common-member reconstruction preserves the input text when the stated version is at most the reader's. Every successful typed payload read preserves the input text. A successful standalone result read preserves text given distinct slot names.
- proved by
TickPayload.read_members
Laws.Tick
∀ (p : TickPayload) (H : Hash) (current : Rules), p.spec.toJson.keysDistinct = true → (resultJson p.result).keysDistinct = true → (H (specPreimageOf p.rules p.spec.toJson)).length = 32 → (H (resultPreimage p.result)).length = 32 → List.Pairwise (fun x1 x2 => x1 < x2) p.covers → List.Pairwise (fun x1 x2 => x1 < x2) p.withheld → (∀ (i : RecordId), i ∈ p.withheld → i ∈ p.covers) → readTickMembers H current (p.toJson H) = Except.ok { rules := p.rules, spec := p.spec.toJson, covers := p.covers, withheld := p.withheld, result := resultJson p.result }TickPayload.read_written
Laws.Tick
∀ (H : Hash) (v : Rules) (s : Spec), s.Fits → ∀ (covers withheld : List RecordId), List.Pairwise (fun x1 x2 => x1 < x2) covers → List.Pairwise (fun x1 x2 => x1 < x2) withheld → (∀ (i : RecordId), i ∈ withheld → i ∈ covers) → ∀ (values : Slot → SlotValue), (∀ (a : Slot), a ∈ s.slots → (values a).FitsSlot a) → (H (specPreimageOf v s.toJson)).length = 32 → (H (resultPreimage (List.map (fun a => (a.name, values a)) s.slots))).length = 32 → have r := List.map (fun a => (a.name, values a)) s.slots; have p := { rules := v, spec := s, covers := covers, withheld := withheld, result := r }; readTickPayload H v (p.toJson H) = Except.ok { rules := p.rules, spec := p.spec, covers := p.covers, withheld := p.withheld, result := unshownResult r }readTickMembers_distinct
Laws.TickRead
∀ {H : Hash} {current : Rules} {j : Json} {m : TickMembers}, readTickMembers H current j = Except.ok m → j.keysDistinct = truereadTickMembers_same_value
Laws.TickRead
∀ {H : Hash} {current : Rules} {a b : Json} {ma mb : TickMembers}, readTickMembers H current a = Except.ok ma → readTickMembers H current b = Except.ok mb → a.Finite → b.Finite → a.canon = b.canon → a.wireValue = b.wireValueWritten.payload_wireValue
Laws.JsonValue
∀ (a b : Written), a.payload.canon = b.payload.canon → a.payload.wireValue = b.payload.wireValue
readTickMembers_text
Laws.TickRead
∀ {H : Hash} {current : Rules} {j : Json} {m : TickMembers}, readTickMembers H current j = Except.ok m → m.rules.number ≤ current.number → j.canon = (m.toJson H).canonreadTickPayload_text
Laws.TickRead
∀ {H : Hash} {current : Rules} {j : Json} {p : TickPayload}, readTickPayload H current j = Except.ok p → j.canon = (p.toJson H).canonreadResult_written
Laws.Tick
∀ (s : Spec) (values : Slot → SlotValue), (List.map Slot.name s.slots).Nodup → (∀ (a : Slot), a ∈ s.slots → (values a).FitsSlot a) → have r := List.map (fun a => (a.name, values a)) s.slots; readResult s (resultJson r) = Except.ok (unshownResult r)
readResult_text
Laws.TickRead
∀ {s : Spec} {j : Json} {r : List (String × SlotValue)}, (List.map Slot.name s.slots).Nodup → readResult s j = Except.ok r → j.canon = resultText r
- pinned by
8 files
tick/current-wrong-result-label (current main; may differ from this page's build) tick/newer-result-label (current main; may differ from this page's build) tick/reordered-payload (current main; may differ from this page's build) tick/result-negative-zero-unread (current main; may differ from this page's build) tick/result-repeated-group-value (current main; may differ from this page's build) tick/result-repeated-slot (current main; may differ from this page's build) tick/six-backups (current main; may differ from this page's build) tick/spec-repeated-source (current main; may differ from this page's build) also naming it: tick/check-padded-count (current main; may differ from this page's build) tick/covers-duplicate-id (current main; may differ from this page's build) tick/covers-invalid-id (current main; may differ from this page's build) tick/covers-not-array (current main; may differ from this page's build) tick/covers-unsorted (current main; may differ from this page's build) tick/duplicate-member (current main; may differ from this page's build) tick/empty-cover (current main; may differ from this page's build) tick/empty-fold (current main; may differ from this page's build) tick/invalid-rules (current main; may differ from this page's build) tick/kept-note (current main; may differ from this page's build) tick/missing-covers (current main; may differ from this page's build) tick/missing-result-hash (current main; may differ from this page's build) tick/missing-result (current main; may differ from this page's build) tick/missing-rules (current main; may differ from this page's build) tick/missing-spec-hash (current main; may differ from this page's build) tick/missing-spec (current main; may differ from this page's build) tick/newer-result-label-members (current main; may differ from this page's build) tick/newer-rules-deferred (current main; may differ from this page's build) tick/newer-rules-members (current main; may differ from this page's build) tick/not-object (current main; may differ from this page's build) tick/omitted-fold (current main; may differ from this page's build) tick/result-decimal-spelling (current main; may differ from this page's build) tick/result-disallowed-null (current main; may differ from this page's build) tick/result-extra-field (current main; may differ from this page's build) tick/result-extra-slot (current main; may differ from this page's build) tick/result-groups-not-object (current main; may differ from this page's build) tick/result-hash-mismatch (current main; may differ from this page's build) tick/result-hash-spelling (current main; may differ from this page's build) tick/result-id-spelling (current main; may differ from this page's build) tick/result-id-with-shown (current main; may differ from this page's build) tick/result-integer-number (current main; may differ from this page's build) tick/result-key-ids-not-array (current main; may differ from this page's build) tick/result-missing-field (current main; may differ from this page's build) tick/result-missing-slot (current main; may differ from this page's build) tick/result-negative-count (current main; may differ from this page's build) tick/result-negative-ungrouped (current main; may differ from this page's build) tick/result-negative-unread (current main; may differ from this page's build) tick/result-not-object (current main; may differ from this page's build) tick/rules-label-drift (current main; may differ from this page's build) tick/shape-31-keys-example (current main; may differ from this page's build) tick/shape-45-keys-by-payload (current main; may differ from this page's build) tick/shape-grouped-min (current main; may differ from this page's build) tick/shape-r01-negative-past-2-53 (current main; may differ from this page's build) tick/shape-r03-nothing-read (current main; may differ from this page's build) tick/shape-r04-grouped-ungrouped-unread (current main; may differ from this page's build) tick/shape-r06-shown-withheld (current main; may differ from this page's build) tick/spec-hash-spelling (current main; may differ from this page's build) tick/spec-not-object (current main; may differ from this page's build) tick/unknown-member (current main; may differ from this page's build) tick/unreadable-spec-fitting-hash (current main; may differ from this page's build) tick/unreadable-spec-wrong-hash (current main; may differ from this page's build) tick/unreconciled-result (current main; may differ from this page's build) tick/withheld-duplicate-id (current main; may differ from this page's build) tick/withheld-empty (current main; may differ from this page's build) tick/withheld-invalid-id (current main; may differ from this page's build) tick/withheld-not-array (current main; may differ from this page's build) tick/withheld-outside (current main; may differ from this page's build) tick/withheld-unsorted (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- rests on
UTF-16 order base32.canonical id.digest record.member-order result.canonical result.exact result.no-commit spec.hash spec.parse write.overflow
- carries
tick.made
In its question
tick.record
Exactness
A held tick opening gives the rules version and both hashes as text, each id list as a field with text members, and the spec and result as present fields without a scalar value.
The writer omits an empty withheld list. The ordinary payload projection gives these fields for any envelope, salt and hash function.
laws.md Reading a held tick opening gives text for rules and the two hashes, the listed id texts for covers and a nonempty withheld, and a present field with no scalar value for spec and result. Empty withheld is absent. The projection holds for every envelope and salt.
- proved by
TickPayload.record_fields
Laws.Tick
∀ (p : TickPayload) (H : Hash) (env : Env) (salt : List UInt8) (r : Record), ((make env salt (p.toJson H)).readInto r).fields = [("rules", HeldField.one (Val.str p.rules.text)), ("spec", HeldField.other), ("spec-hash", HeldField.one (Val.str (Spec.hash H p.rules p.spec))), ("covers", HeldField.many (List.map (Val.str ∘ idText) p.covers)), ("result", HeldField.other), ("result-hash", HeldField.one (Val.str (resultHash H p.result)))] ++ if p.withheld.isEmpty = true then [] else [("withheld", HeldField.many (List.map (Val.str ∘ idText) p.withheld))]
- pinned by
tick/spec-reads-ticks (current main; may differ from this page's build) tick/tick-field-reading (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
In its question
tick.inputs
Invariance
Change which holder replays the claim, and the canonical result bytes stays.
Holds when the forms of one id agree: the same envelope, and the same payload wherever it is held. Forms are jointly consistent. Both holders have a form for every covered id and local access to each required opening.
laws.md For one spec and two id lists, jointly consistent holders with zero missing records and zero missing openings on each side get equal canonical result bytes.
- proved by
tick_inputs
Laws.TickCheck
∀ (sp : Spec) (C W : List RecordId) (xs ys : List Record), Forms (xs ++ ys) → tickMissing C W xs = { records := 0, openings := 0 } → tickMissing C W ys = { records := 0, openings := 0 } → resultBytes (tickRun sp C W xs) = resultBytes (tickRun sp C W ys)
- pinned by
tick/admit-inside (current main; may differ from this page's build) tick/missing-both (current main; may differ from this page's build) tick/six-reordered (current main; may differ from this page's build)also naming it: tick/check-hash-before-version (current main; may differ from this page's build) tick/check-invalid-result (current main; may differ from this page's build) tick/check-newer-hash-spelling (current main; may differ from this page's build) tick/check-newer-result-label (current main; may differ from this page's build) tick/check-noncanonical-spec (current main; may differ from this page's build) tick/check-older-result-mismatch (current main; may differ from this page's build) tick/closure-unknown (current main; may differ from this page's build) tick/count-open-required (current main; may differ from this page's build) tick/different-result (current main; may differ from this page's build) tick/different-unreconciled (current main; may differ from this page's build) tick/eraser-outside-no-opening (current main; may differ from this page's build) tick/eraser-outside-retained (current main; may differ from this page's build) tick/missing-opening (current main; may differ from this page's build) tick/missing-records (current main; may differ from this page's build) tick/newer-rules (current main; may differ from this page's build) tick/newer-ten-under-two (current main; may differ from this page's build) tick/older-different-today (current main; may differ from this page's build) tick/older-foreign-result (current main; may differ from this page's build) tick/older-ignored-erasure (current main; may differ from this page's build) tick/older-missing-today (current main; may differ from this page's build) tick/older-noncanonical-today (current main; may differ from this page's build) tick/older-same-today (current main; may differ from this page's build) tick/older-unreadable-today (current main; may differ from this page's build) tick/open-prev-partial (current main; may differ from this page's build) tick/unreadable-spec (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
In its question
tick.withheld
Invariance
Change which form a holder reads for a withheld id, and every slot of the claim stays.
Holds when the two forms have the same envelope; the forms of one id agree: the same envelope, and the same payload wherever it is held. An exchange needs only the shared envelope and membership in withheld. Adding a further copy also uses consistency of the original holding and the presence of the original form.
laws.md Exchanging a withheld id's form for another form of its envelope preserves all slots. A consistent holding that already has such a form may also add another copy.
- proved by
tick_withheld
Laws.TickCheck
∀ (sp : Spec) (C W : List RecordId) (before after : List Record) {a b : Record}, SameEnvelope a b → a.id ∈ W → tickRun sp C W (before ++ a :: after) = tickRun sp C W (before ++ b :: after)tick_withheld_copy
Laws.TickCheck
∀ (sp : Spec) (C W : List RecordId) (xs : List Record) (a b : Record), Forms xs → a ∈ xs → SameEnvelope a b → a.id ∈ W → tickRun sp C W xs = tickRun sp C W (b :: xs)
- pinned by
tick/covered-erasure (current main; may differ from this page's build) tick/withheld-open-at-checker (current main; may differ from this page's build)also naming it: tick/covered-eraser-omitted-partial (current main; may differ from this page's build) tick/covered-eraser-omitted (current main; may differ from this page's build) tick/eraser-outside (current main; may differ from this page's build) tick/make-erased (current main; may differ from this page's build) tick/withheld-backup (current main; may differ from this page's build) tick/write-erased (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- rests on
settle.set
In its question
tick.made
Exactness
A tick made with a fitting spec checks same on the writer's holding, including after appending outside forms that erase no covered id.
The check reads the serialized current-version payload under any hash giving 32 bytes on its two preimages. The reference SHA-256 supplies both widths by proof.
laws.md For a fitting spec and any holding, the current-version check of its made payload under SHA-256 answers same. Appending forms whose ids are outside the cover and that erase no covered id preserves that verdict. The proof works for any hash giving 32 bytes on the two preimages of this payload.
- proved by
checkTick_made
Laws.TickCheck
∀ (sp : Spec), sp.Fits → ∀ (xs : List Record), (checkTick Gen.sha256 Rules.current { kind := "tick", payload := some ((makeTick sp xs).toJson Gen.sha256) } xs).answer = TickAnswer.samecheckTick_made_late
Laws.TickCheck
∀ (sp : Spec), sp.Fits → ∀ (xs extra : List Record), (∀ (r : Record), r ∈ extra → ¬r.id ∈ idsOf xs) → (∀ (r : Record), r ∈ extra → ∀ (i : RecordId), i ∈ idsOf xs → ¬i ∈ r.erases) → (checkTick Gen.sha256 Rules.current { kind := "tick", payload := some ((makeTick sp xs).toJson Gen.sha256) } (xs ++ extra)).answer = TickAnswer.samecheckTick_made_of_width
Laws.TickCheck
∀ (H : Hash) (sp : Spec), sp.Fits → ∀ (xs extra : List Record), (H (specPreimageOf Rules.current sp.toJson)).length = 32 → (H (resultPreimage (makeTick sp xs).result)).length = 32 → (∀ (r : Record), r ∈ extra → ¬r.id ∈ idsOf xs) → (∀ (r : Record), r ∈ extra → ∀ (i : RecordId), i ∈ idsOf xs → ¬i ∈ r.erases) → (checkTick H Rules.current { kind := "tick", payload := some ((makeTick sp xs).toJson H) } (xs ++ extra)).answer = TickAnswer.same
- pinned by
tick/late-backup (current main; may differ from this page's build) tick/late-retired (current main; may differ from this page's build) tick/six-made (current main; may differ from this page's build)also naming it: tick/closed-cover (current main; may differ from this page's build) tick/covered-erasure (current main; may differ from this page's build) tick/make-nontaken (current main; may differ from this page's build) tick/open-prev (current main; may differ from this page's build) tick/open-under (current main; may differ from this page's build) tick/outside-erased-taken (current main; may differ from this page's build) tick/own-payload-unheld (current main; may differ from this page's build) tick/retired-successor (current main; may differ from this page's build) tick/six-reordered (current main; may differ from this page's build) tick/taken-after-admit (current main; may differ from this page's build) tick/write-nontaken (current main; may differ from this page's build) tick/wrong-kind-unheld (current main; may differ from this page's build) tick/wrong-kind (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- rests on
UTF-16 order id.digest result.canonical spec.parse tick.canonical tick.level
In its question
tick.level
Invariance
Change the forms outside the cover, and the claim when the ordered list of covered forms is unchanged stays.
A covered tick contributes one record. Appending any forms outside the cover preserves every result slot.
laws.md Equal lists of covered forms give equal slots. Appending forms with ids outside the cover leaves the claim unchanged, including when a covered tick names those ids.
- proved by
tick_level
Laws.TickCheck
∀ (sp : Spec) (C W : List RecordId) (xs ys : List Record), coveredForms C xs = coveredForms C ys → tickRun sp C W xs = tickRun sp C W ys
tick_level_append
Laws.TickCheck
∀ (sp : Spec) (C W : List RecordId) (xs extra : List Record), (∀ (r : Record), r ∈ extra → ¬r.id ∈ C) → tickRun sp C W (xs ++ extra) = tickRun sp C W xs
- pinned by
tick/weekly-one-level (current main; may differ from this page's build)also naming it: tick/weekly-inner-records-held (current main; may differ from this page's build)
- run by
- the model, the Rust implementation
- carries
tick.made
In its question
result.exact
Round trip
An integer of any size is written as its decimal digits, with - before a negative one, and is never rounded or capped. The codec's reader accepts a text exactly when it is the text of an integer, and reads it as that integer.
No integer in a canonical result is a JSON number, so binary64 never touches it: a sum past 253 keeps every digit. The reader takes no other spelling of an integer: not -0, not a leading zero, not +. An integer stands only at value, unread and ungrouped, so the position tells it from text.
laws.md An integer of any size is written as its decimal digits, with - before a negative one, and nothing is rounded or capped. The codec's reader accepts a text exactly when it is the text of an integer, and reads it as that integer: no other spelling is read, -0, a leading zero and + among them.
- proved by
intOf?_eq_some_iff
Laws.Result
∀ {s : String} {i : Int}, intOf? s = some i ↔ s = intText iintOf?_intText
Laws.Result
∀ (i : Int), intOf? (intText i) = some i
intText_injective
Laws.Result
∀ {a b : Int}, intText a = intText b → a = b
- pinned by
result/27-by-number-keys (current main; may differ from this page's build) result/gap14-field-types (current main; may differ from this page's build) result/phase2-exact-output (current main; may differ from this page's build) result/r01-negative-past-2-53 (current main; may differ from this page's build) result/r02-zero-sum (current main; may differ from this page's build) result/r03-nothing-read (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
result.canonical tick.canonical
In its question
result.shown
Invariance
Change what is shown of each record a result lists: its payload held, withheld or erased, and the canonical result's text, bytes, preimage and hash, for any hash stay.
The canonical result lists each record by its id alone. A reading still says what its reader holds of each. A value read from a payload, such as a payload test or a sum, can still differ between readers; that is a different result, not a different spelling of one.
laws.md Setting aside what is shown of every listed record leaves a result's canonical text as it was, in every slot. Two results that differ only in what is shown have the same text, bytes, preimage and hash, for any hash.
- proved by
SlotValue.result_unshown
Laws.Result
∀ (v : SlotValue), v.unshown.result = v.result
resultText_unshown
Laws.Result
∀ (r : List (String × SlotValue)), resultText (unshownResult r) = resultText r
resultHash_of_unshown
Laws.Result
∀ (H : Hash) {r q : List (String × SlotValue)}, unshownResult r = unshownResult q → resultText r = resultText q ∧ resultBytes r = resultBytes q ∧ resultPreimage r = resultPreimage q ∧ resultHash H r = resultHash H q
- pinned by
result/02-withheld-payload (current main; may differ from this page's build) result/31-keys-example (current main; may differ from this page's build) result/37-keys-unheld-setters (current main; may differ from this page's build) result/r05-shown-held (current main; may differ from this page's build) result/r06-shown-withheld (current main; may differ from this page's build) result/r07-shown-erased (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- carries
result.canonical
In its question
result.canonical
Exactness
Two runs of one spec, over any records and under any rule for who may replace whom, have the same canonical text, bytes and preimage of the hash exactly when their results agree once what is shown is set aside.
Holds when the object's member names are distinct; the spec names each slot once, as every spec the parser accepts does. So the bytes lose shown and nothing else: every slot, a list's order, every count, id, thing, key and group key are in them. This result proof uses injectivity on the JSON the result codec writes: null, text, arrays, and objects whose members are in UTF-16 order, each named once. A count and a sum that hold the same number write the same JSON, so the bytes say which fold only together with the spec. The hash is a parameter: that different preimages hash apart is SHA-256's to give.
laws.md Two runs of one spec, over any records and under any rule for who may replace whom, have the same canonical text, the same bytes and the same preimage of the hash exactly when their results agree once what is shown is set aside. So the bytes lose shown and nothing else: a list's order, every count, every id and every key are in them. It holds for every spec that names each slot once, and every spec the parser accepts does.
- proved by
Spec.resultText_run_iff
Laws.Result
∀ {sp : Spec}, (List.map (fun x => x.name) sp.slots).Nodup → ∀ (xs ys : List Record) (may may' : Record → Record → Bool), resultText (sp.run xs may) = resultText (sp.run ys may') ↔ unshownResult (sp.run xs may) = unshownResult (sp.run ys may')Spec.resultBytes_run_iff
Laws.Result
∀ {sp : Spec}, (List.map (fun x => x.name) sp.slots).Nodup → ∀ (xs ys : List Record) (may may' : Record → Record → Bool), resultBytes (sp.run xs may) = resultBytes (sp.run ys may') ↔ unshownResult (sp.run xs may) = unshownResult (sp.run ys may')Spec.resultPreimage_run_iff
Laws.Result
∀ {sp : Spec}, (List.map (fun x => x.name) sp.slots).Nodup → ∀ (xs ys : List Record) (may may' : Record → Record → Bool), resultPreimage (sp.run xs may) = resultPreimage (sp.run ys may') ↔ unshownResult (sp.run xs may) = unshownResult (sp.run ys may')Spec.resultPreimage_parsed_iff
Laws.Result
∀ {j : Json} {sp : Spec}, Spec.ofJson j = Except.ok sp → ∀ (xs ys : List Record) (may may' : Record → Record → Bool), resultPreimage (sp.run xs may) = resultPreimage (sp.run ys may') ↔ unshownResult (sp.run xs may) = unshownResult (sp.run ys may')resultText_eq_iff
Laws.Result
∀ {r q : List (String × SlotValue)}, (List.map (fun x => x.fst) r).Nodup → (List.map (fun x => x.fst) q).Nodup → (∀ (p : String × SlotValue), p ∈ r → p.snd.Ordered) → (∀ (p : String × SlotValue), p ∈ q → p.snd.Ordered) → (resultText r = resultText q ↔ ∀ (m : String × Json), m ∈ resultMembers r ↔ m ∈ resultMembers q)SlotValue.result_inj
Laws.Result
∀ {v w : SlotValue}, v.Like w → v.result = w.result → v.unshown = w.unshownSlot.run_ordered
Laws.Result
∀ (s : Slot) (sel : Record → Bool) (xs : List Record), (s.run sel xs).Ordered
Slot.run_like
Laws.Result
∀ (s : Slot) (sel sel' : Record → Bool) (xs ys : List Record), (s.run sel xs).Like (s.run sel' ys)
Json.canon_injective
Laws.Result
∀ {a b : Json}, a.Plain → b.Plain → a.canon = b.canon → a = bJson.canon_prefix
Laws.Result
∀ (a b : Json), a.Plain → b.Plain → ∀ {X Y : List Char}, a.canon.toList ++ X = b.canon.toList ++ Y → a = b ∧ X = Yutf8_injective
Laws.Result
∀ {a b : String}, utf8 a = utf8 b → a = b
- pinned by
23 files
result/01-tasks (current main; may differ from this page's build) result/02-withheld-payload (current main; may differ from this page's build) result/11-hidden-numbers (current main; may differ from this page's build) result/12-readable-extrema (current main; may differ from this page's build) result/17-follow-fork (current main; may differ from this page's build) result/21-by-keys (current main; may differ from this page's build) result/25-by-collect (current main; may differ from this page's build) result/26-by-key-order (current main; may differ from this page's build) result/27-by-number-keys (current main; may differ from this page's build) result/31-keys-example (current main; may differ from this page's build) result/37-keys-unheld-setters (current main; may differ from this page's build) result/45-keys-by-payload (current main; may differ from this page's build) result/47-keys-collect (current main; may differ from this page's build) result/51-keys-collect-limit (current main; may differ from this page's build) result/gap14-field-types (current main; may differ from this page's build) result/phase2-exact-output (current main; may differ from this page's build) result/r01-negative-past-2-53 (current main; may differ from this page's build) result/r02-zero-sum (current main; may differ from this page's build) result/r03-nothing-read (current main; may differ from this page's build) result/r04-grouped-ungrouped-unread (current main; may differ from this page's build) result/r05-shown-held (current main; may differ from this page's build) result/r06-shown-withheld (current main; may differ from this page's build) result/r07-shown-erased (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
UTF-16 order id.digest record.member-order result.exact result.shown spec.parse
- carries
result.no-commit spec.hash spec.no-commit tick.canonical tick.made
In its question
result.no-commit
Exactness
A result hash's preimage is never a 16-byte salt followed by the canonical bytes of a JSON value, which is what a record's commitment hashes. So no record commits to a result hash's preimage, whatever its salt and payload.
The label loops/result-hash/v1: is 21 bytes, so the preimage's 17th byte is h, and no canonical JSON text starts with h. The text prefixes also differ (res: for results, h: for commitments), and the label keeps the preimages apart. A 16-byte label would not keep them apart.
laws.md A result hash's preimage is never a 16-byte salt followed by the canonical bytes of a JSON value, which is what a record's commitment hashes. Its label is 21 bytes, so its 17th byte is h, and no canonical JSON text starts with h. So no record commits to the preimage of a result hash, whatever its salt and payload.
- proved by
resultPreimage_ne_commit
Laws.Result
∀ (r : List (String × SlotValue)) {salt : List UInt8}, salt.length = 16 → ∀ (payload : Json), resultPreimage r ≠ salt ++ utf8 payload.canonJson.canon_head
Laws.Result
∀ (j : Json), ∃ c cs, j.canon.toList = c :: cs ∧ jsonHead c
Number.canon_head
Laws.Result
∀ (n : Number), ∃ c cs, n.canon.toList = c :: cs ∧ jsonHead c
- pinned by
23 files
result/01-tasks (current main; may differ from this page's build) result/02-withheld-payload (current main; may differ from this page's build) result/11-hidden-numbers (current main; may differ from this page's build) result/12-readable-extrema (current main; may differ from this page's build) result/17-follow-fork (current main; may differ from this page's build) result/21-by-keys (current main; may differ from this page's build) result/25-by-collect (current main; may differ from this page's build) result/26-by-key-order (current main; may differ from this page's build) result/27-by-number-keys (current main; may differ from this page's build) result/31-keys-example (current main; may differ from this page's build) result/37-keys-unheld-setters (current main; may differ from this page's build) result/45-keys-by-payload (current main; may differ from this page's build) result/47-keys-collect (current main; may differ from this page's build) result/51-keys-collect-limit (current main; may differ from this page's build) result/gap14-field-types (current main; may differ from this page's build) result/phase2-exact-output (current main; may differ from this page's build) result/r01-negative-past-2-53 (current main; may differ from this page's build) result/r02-zero-sum (current main; may differ from this page's build) result/r03-nothing-read (current main; may differ from this page's build) result/r04-grouped-ungrouped-unread (current main; may differ from this page's build) result/r05-shown-held (current main; may differ from this page's build) result/r06-shown-withheld (current main; may differ from this page's build) result/r07-shown-erased (current main; may differ from this page's build)
- run by
- the model, the JS implementation, the Rust implementation
- rests on
result.canonical
- carries
spec.hash spec.no-commit tick.canonical
In its question