Strange LoopsGrammarLawsEvidenceDecisions

Evidence

Evidence for the listed laws on the laws page: the theorems Lean checked, the vectors that pin it and who runs them. The page also shows the laws each proof uses. For an implementer, what to pass; for a maintainer, which laws have less evidence than others.

Coverage

What evidence each law has: theorems Lean checked, vectors laws.md cites, vectors that name the law themselves, whether those two agree, whether the JS implementation runs any of them, a demo, and how many laws it rests on and carries.

A filled cell says the evidence exists, not that it is complete: a law cited by one vector is pinned at one point.

121 laws are theorems and 3 hold by construction. For 62, the cited vectors and the vectors naming the law differ. Hover the cell to see which.

lawshapeprovedcitednamed byagreeJSdemorests / carries
Record
id.digestRound trip12–––––1 / 4
base32.canonicalRound trip455✓✓–– / 2
id.text-orderOrder11–−1✓–1 / –
instant.uniqueExactness151−4✓–1 / –
instant.round-tripRound trip211✓✓–– / 1
content orderOrder54–−4✓–1 / 18
batch.meaningExactness11113+2✓–– / –
batch.refuseExactnessc2470+46✓–– / –
batch.refuse-orderInvariance44456−2 +14✓–1 / 1
record.erasureInvariance211✓✓✓– / –
record.commitExactness1–1+1✓–– / –
record.setsInvariance345+1✓✓1 / 9
record.keysExactness6206−14✓–1 / –
record.ofExactness141−3✓–– / –
record.shapeExactness104595−2 +52✓–1 / 2
record.member-orderInvariance111✓✓–1 / 4
UTF-16 orderOrder3–––––– / 13
record.unicodeExactness5614+8✓–– / –
record.refuseExactnessc27175+148✓–– / –
write.checkedExactness11994−197 +2✓–– / –
write.member-orderInvariance11–−1✓–1 / –
write.overflowExactness31112−2 +3✓–– / 1
occurred.spanExactness466✓✓–– / –
occurred.qualifierInvariance322✓✓✓– / –
occurred.momentExactness311✓✓–– / –
occurred.orderOrder311✓✓–– / 1
occurred.refuseExactnessc22−1 +1✓–– / –
Store
input.distinctExactness3–––––– / 12
input.unionInvariance1–––––1 / –
View
view.no-resurrectionInvariance45–−5✓✓1 / 3
view.refinesRefinement11–−1✓–– / –
settle.setInvariance236+3✓–– / 5
settle.keepsExactness123+1✓–– / –
settle.erasedExactness126+4✓–– / –
admit.setExactness21–−1✓–– / 1
admit.no-crossExactness246+2✓–– / –
admit.lateLimit1–––––– / –
admit.growsInvariance2–––––– / –
view.no-resurrection (things)Invariance367+1✓–2 / 1
view.refines (where)Refinement311✓✓–– / –
State
incremental = batchInvariance2–––––– / 2
count.permInvariance124+2✓✓– / –
count.repeatsLimit111✓✓✓– / –
latest-by.setInvariance11812−6✓✓1 / 8
latest-by.orderOrder157+2✓–1 / –
latest-by.repeatsInvariance111✓✓–1 / –
latest-by.convergeInvariance111✓✓–2 / –
latest.set, latest.repeatsInvariance355✓✓–1 / –
heads.whole-viewExactness333✓✓–2 / 7
latest.newestOrder222✓✓–1 / –
latest.one-thingExactness111✓✓–3 / –
payload.readExactness61818✓✓–– / –
numeric.safe-wholeExactness728+6✓–– / –
sum.permInvariance128+6✓–– / –
sum.repeatsLimit111✓✓–– / –
extrema.setInvariance244✓✓–– / –
acc.setInvariance1–––––– / 1
acc.lateInvariance1–––––1 / –
heads.setInvariance144✓✓–1 / 2
heads.lateInvariance1–––––2 / –
heads.whyLimit12–−2✓–– / –
result.unreadRefinement6734−2 +29✓–4 / 2
result.fullRefinement112+1✓–– / –
select.setInvariance144✓✓–– / 4
thing.oneExactness43–−3✓–1 / 4
thing.localInvariance22314−14 +5✓–2 / 5
thing.mentionsInvariance25–−5✓–1 / –
thing.sliceInvariance3–––––3 / –
keyed.witnessedExactness3–––––4 / 5
keyed.convexInvariance3–––––2 / –
keyed.anchoredInvariance5–––––2 / 3
keyed.headsExactness3–––––2 / –
keyed.cutInvariance4–––––3 / 1
keyed.baseInvariance6–––––4 / –
cut.prefixExactness7–––––1 / –
keyed.sliceInvariance6–––––4 / 1
where.complementsOrder425+3✓–– / –
where.typedExactness5182−16✓–– / 1
where.fieldsExactness1157+2✓–– / –
where.timeInvariance622✓✓–– / –
where.totalExactness2733−70✓–– / 2
where.setInvariance1–1+1✓–– / 3
spec.selectInvariance3732−71✓–– / –
spec.from-thingExactness222✓✓–– / –
spec.setInvariance47359−19 +5✓–9 / 1
spec.followExactness8510+5✓–7 / 2
keyed.liveExactness899✓✓–1 / 13
keyed.foldExactness8910+1✓–6 / 3
keyed.slotsExactness1677✓✓–3 / 1
keyed.byExactness778+1✓–– / 1
keyed.whole-readExactness1011✓✓–14 / –
keyed.selectExactness7710+3✓–– / 1
by.setInvariance456−1 +2✓–10 / 1
by.after-admissionExactness134+1✓–– / 2
by.accountingExactness9616+10✓–1 / 1
by.partitionExactness345+1✓–3 / –
spec.after-supersessionExactness334−1 +2✓–4 / –
spec.sliceInvariance5–––––9 / 1
keyed.spec-sliceInvariance10–––––12 / 1
spec.parseRound trip7147147✓✓–1 / 4
window.spanExactness211✓––– / –
window.headsExactness211✓––– / –
spec.hashExactness688✓––6 / 1
spec.no-commitExactness111✓––2 / –
spec.no-resultExactness111✓––– / –
tick.canonicalRound trip9866+58––10 / 1
tick.recordExactness122✓––– / –
tick.inputsInvariance1328+25––– / –
tick.withheldInvariance228+6––1 / –
tick.madeExactness3316+13––6 / –
tick.levelInvariance212+1––– / 1
result.exactRound trip366✓✓–– / 2
result.shownInvariance366✓✓–– / 1
result.canonicalExactness112323✓✓–6 / 5
result.no-commitExactness32323✓✓–1 / 3
Text
lens.escapingRound trip224+2✓–1 / –
lens.round-tripRound trip212+1✓✓1 / 3
lens.no-opRound trip111✓✓–1 / –
lens.put-getRound trip224+2✓–– / 1
lens.nothing-droppedExactness223+1✓–– / –
lens.absence-not-editInvariance111✓✓✓– / –
normal formInvariance1–––––2 / –
lens.refuseExactness136+3✓–– / 2
lens.base-distinctExactness455✓✓–1 / –

What rests on what

A line from one law down to another says a proof of the first uses a theorem of the second, directly or through lemmas no law names. Lean recorded every one of them; lake exe proofs reads them out of the checked proofs.

The stack only rests downward: the build fails if a proof ever leans on a layer above its own. A law's layer is declared, not derived; that check is all the proofs say about it.

A proof by computation (decide) evaluates definitions and uses no theorem, so it draws no line.

Point at or tap a law to follow it, or a line to see the theorems that make it. Enter, or a second tap, opens the law's card.

The map is laid out when the page is built: the same laws and proofs always draw the same map.

TextStateViewStoreRecord acc.lateacc.late acc.setacc.set admit.setadmit.set base32.canonicalbase32.canonical batch.refuse-orderbatch.refuse-order by.accountingby.accounting by.after-admissionby.after-admission by.partitionby.partition by.setby.set content ordercontent order cut.prefixcut.prefix heads.lateheads.late heads.setheads.set heads.whole-viewheads.whole-view id.digestid.digest id.text-orderid.text-order incremental = batchincremental = batch input.distinctinput.distinct input.unioninput.union instant.round-tripinstant.round-trip instant.uniqueinstant.unique keyed.anchoredkeyed.anchored keyed.basekeyed.base keyed.bykeyed.by keyed.convexkeyed.convex keyed.cutkeyed.cut keyed.foldkeyed.fold keyed.headskeyed.heads keyed.livekeyed.live keyed.selectkeyed.select keyed.slicekeyed.slice keyed.slotskeyed.slots keyed.spec-slicekeyed.spec-slice keyed.whole-readkeyed.whole-read keyed.witnessedkeyed.witnessed latest-by.convergelatest-by.converge latest-by.orderlatest-by.order latest-by.repeatslatest-by.repeats latest-by.setlatest-by.set latest.newestlatest.newest latest.one-thinglatest.one-thing latest.set …latest.set … lens.base-distinctlens.base-distinct lens.escapinglens.escaping lens.no-oplens.no-op lens.put-getlens.put-get lens.refuselens.refuse lens.round-triplens.round-trip normal formnormal form occurred.orderoccurred.order record.keysrecord.keys record.member-orderrecord.member-order record.setsrecord.sets record.shaperecord.shape result.canonicalresult.canonical result.exactresult.exact result.no-commitresult.no-commit result.shownresult.shown result.unreadresult.unread select.setselect.set settle.setsettle.set spec.after-supersessionspec.after-supersession spec.followspec.follow spec.hashspec.hash spec.no-commitspec.no-commit spec.parsespec.parse spec.setspec.set spec.slicespec.slice thing.localthing.local thing.mentionsthing.mentions thing.onething.one thing.slicething.slice tick.canonicaltick.canonical tick.leveltick.level tick.madetick.made tick.withheldtick.withheld UTF-16 orderUTF-16 order view.no-resurrectionview.no-resurrection view.no-resurrection (things)view.no-resurrection (things) where.setwhere.set where.totalwhere.total where.typedwhere.typed write.member-orderwrite.member-order write.overflowwrite.overflow

40 laws stand alone: their proofs use no other law's theorem. count.perm count.repeats payload.read numeric.safe-whole sum.perm sum.repeats extrema.set heads.why view.refines result.full settle.keeps settle.erased admit.no-cross admit.late admit.grows where.complements where.fields where.time view.refines (where) spec.select spec.from-thing window.span window.heads spec.no-result tick.record tick.inputs batch.meaning batch.refuse lens.nothing-dropped lens.absence-not-edit record.erasure record.commit record.of record.unicode record.refuse write.checked occurred.span occurred.qualifier occurred.moment occurred.refuse

From claim to code

A law is a sentence on the laws page, a row in protocol/laws.md, a theorem Lean checks, and vectors every implementation must pass. The build joins all four and fails when one doesn't meet the next.

A sentence says no more than its theorems: where a premise or a proof's reach needs saying, it follows the sentence. Open a theorem to read exactly what Lean checked.

Laws are grouped by the layer they govern, from the ground up.

124

laws

rows of protocol/laws.md, each a sentence on the laws page

409

theorems

the declarations they name, found in the proofs Lean checked

656

vectors

the files they cite, every one found on disk

3

implementations

the model and the JS implementation and the Rust implementation

Record 27 laws

id.digest

Round trip

An id's digest has exactly 32 bytes. Reading these bytes gives the same id. Two ids have the same text only when they are equal.

The model keeps every record id and reference below 2256. Reading any 32 bytes gives an id below 2256. Writing that id back gives the same 32 bytes. The model's SHA-256 returns 32 bytes. With the model's SHA-256, an id written from bytes equals the id written from the number. The model does not derive fold records from these hashes.

laws.md An id's digest has exactly 32 bytes. Reading these bytes gives the same id. Two ids have the same text only when they are equal. Reading any 32 bytes gives an id below 2^256. Writing that id back gives the same 32 bytes.

proved by
idDigest_length

Laws.Id

∀ (n : RecordId), (idDigest n).length = 32
idDigest_byte

Laws.Id

∀ (n : RecordId) (d : Nat), d ∈ idDigest n → d < 256
idDigest_roundtrip

Laws.Id

∀ (n : RecordId), List.foldl (fun a d => 256 * a + d) 0 (idDigest n) = ↑n
idDigest_bytes_roundtrip

Laws.Id

∀ (n : RecordId), List.foldl (fun a b => 256 * a + b.toNat) 0 (List.map Nat.toUInt8 (idDigest n)) = ↑n
idText_injective

Laws.IdText

∀ {a b : RecordId}, idText a = idText b → a = b
bytes_bounded

Loops.Id

∀ (bs : List UInt8), bs.length = 32 → List.foldl (fun a b => 256 * a + b.toNat) 0 bs < 256 ^ 32
bytes_idDigest

Laws.Id

∀ (bs : List UInt8) (h : bs.length = 32), List.map Nat.toUInt8 (idDigest ⟨List.foldl (fun a b => 256 * a + b.toNat) 0 bs, ⋯⟩) = bs
idOf_eq_idText

Laws.IdText

∀ (H : Hash) (env : Env) (commit : String) (h : (H (utf8 (idPreimage env commit))).length = 32), idOf H env commit = idText ⟨List.foldl (fun a b => 256 * a + b.toNat) 0 (H (utf8 (idPreimage env commit))), ⋯⟩
Gen.sha256_length

Laws.IdSource

∀ (msg : List UInt8), (Gen.sha256 msg).length = 32
Gen.sha256_bounded

Laws.IdSource

∀ (msg : List UInt8), List.foldl (fun a b => 256 * a + b.toNat) 0 (Gen.sha256 msg) < 256 ^ 32
Gen.sha256_idOf_eq_idText

Laws.IdSource

∀ (env : Env) (commit : String), idOf Gen.sha256 env commit = idText ⟨List.foldl (fun a b => 256 * a + b.toNat) 0 (Gen.sha256 (utf8 (idPreimage env commit))), ⋯⟩
Gen.Read.recordId_bounded

Laws.IdSource

∀ {path : String} {j : Json} {n : RecordId}, Gen.Read.recordId path j = Except.ok n → ↑n < 256 ^ 32
pinned by
(proved)
rests on
base32.canonical
carries
id.text-order result.canonical tick.canonical tick.made

In its question

base32.canonical

Round trip

The base32hex decoder accepts exactly the encoder image. Decoding encoded bytes recovers those bytes. Equal encoded texts have equal bytes.

The encoder uses lowercase base32hex without padding characters. The decoder rejects nonzero unused bits. The fixed-width reader also requires the stated byte count. These results hold for every finite byte list and text, without a hash assumption.

laws.md The decoder accepts exactly the encoder image and recovers its bytes. The fixed-width reader also requires the stated byte count. No hash premise is needed.

proved by
base32_injective

Laws.Base32

∀ (a b : List UInt8), base32 a = base32 b → a = b
unbase32_base32

Laws.Base32

∀ (bs : List UInt8), unbase32 (base32 bs) = some bs
unbase32_eq_some_iff

Laws.Base32

∀ (s : String) (bs : List UInt8), unbase32 s = some bs ↔ base32 bs = s
byteText_eq_true_iff

Laws.Base32

∀ (n : Nat) (s : String), byteText n s = true ↔ ∃ bs, bs.length = n ∧ base32 bs = s
pinned by
byte-text/commit-32 (current main; may differ from this page's build) byte-text/id-32 (current main; may differ from this page's build) byte-text/key-32 (current main; may differ from this page's build) byte-text/salt-16 (current main; may differ from this page's build) byte-text/signature-64 (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
id.digest tick.canonical

In its question

id.text-order

Order

Actual String lexical order on id text equals numeric digest order.

Both inputs have type RecordId. This type bounds each id below 2^256 and gives each digest exactly 32 bytes. The theorem uses Lean's existing String order, not a separate text-order relation. JS UTF-16 order and Rust byte order agree with Lean String order on ASCII; canonical id text is ASCII by construction.

laws.md Actual String lexical order on id text equals numeric order. Both inputs have type RecordId, which bounds them below 2^256.

proved by
idText_order

Laws.IdText

∀ (a b : RecordId), idText a < idText b ↔ a < b
pinned by
byte-text/id-32, runtime id-order pinsbyte-text/id-32 (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
id.digest

In its question

instant.unique

Exactness

Two accepted instant texts with the same moment are equal.

Holds when the actual instant reader accepts the text and returns the stated moment. The premises use the actual instant? parser on each String. The proof derives calendar and clock bounds from successful parsing. It assumes no parser injectivity.

laws.md If the actual instant reader accepts both Strings with the same moment, those Strings are equal.

proved by
instant_moment_unique

Laws.Instant

∀ {a b : String} {m : Moment}, instant? a.toList = some m → instant? b.toList = some m → a = b
pinned by
occurred/04-instants (current main; may differ from this page's build) record/r4-emitted-0 (current main; may differ from this page's build) record/r4-emitted-2 (current main; may differ from this page's build) record/r4-emitted-5 (current main; may differ from this page's build) record/r4-offset-0 (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
instant.round-trip

In its question

instant.round-trip

Round trip

Parse then render recovers the original accepted instant text, character for character.

Holds when the actual instant parser accepts the text and returns these numeric fields. The premise uses the actual instantParts? parser. The renderer writes its numeric calendar and clock fields and its fraction. It does not retain the input text.

laws.md If the actual instant parser returns numeric fields, rendering those fields recovers the original text.

proved by
instantParts_render

Laws.Instant

∀ {cs : List Char} {t : Instant}, instantParts? cs = some t → t.text.toList = cs
instant_parse_render

Laws.Instant

∀ {s : String} {t : Instant}, instantParts? s.toList = some t → t.text = s
pinned by
occurred/04, runtime parse/render pinsoccurred/04-instants (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
instant.unique

In its question

content order

Order

Any two records with different ids order one way: by span, then emitted, then id. Never by how a time is spelled.

laws.md Records order by span, then emitted, then id digest bytes. Without occurred, the span is an instant at emitted. Distinct ids have strict total order. Time spelling does not affect this order.

proved by
Newer.irrefl

Laws.Order

∀ (a : Record), ¬Newer a a
Newer.trans

Laws.Order

∀ {a b c : Record}, Newer a b → Newer b c → Newer a c
Newer.total

Laws.Order

∀ (a b : Record), Newer a b ∨ Newer b a ∨ a.id = b.id
Newer.congr

Laws.Order

∀ {a a' b b' : Record}, a.span = a'.span → a.emitted.moment = a'.emitted.moment → a.id = a'.id → b.span = b'.span → b.emitted.moment = b'.emitted.moment → b.id = b'.id → (Newer a b ↔ Newer a' b')
id_order

Laws.Order

∀ (a b : RecordId), idDigest a < idDigest b ↔ a < b
pinned by
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)
run by
the model, the JS implementation, the Rust implementation
rests on
occurred.order
carries
heads.whole-view keyed.fold keyed.live keyed.slots keyed.spec-slice keyed.whole-read keyed.witnessed latest-by.order latest-by.set latest.one-thing result.unread spec.after-supersession spec.follow spec.set spec.slice thing.one view.no-resurrection view.no-resurrection (things)

In its question

batch.meaning

Exactness

An acyclic batch has at most one meaning. Any two satisfying assignments of ids to its labels agree.

Holds when the batch is acyclic: its labels can be ranked so that a draft uses only labels ranked below its own. A label may stand in about, of, prev or under, and each counts toward acyclicity. Vectors check resolver answers across draft rotations. The uniqueness theorem does not prove resolver correctness.

laws.md An acyclic batch has at most one meaning. A label may stand in about, of, prev or under, and every one of them counts toward acyclicity. This does not prove resolver correctness.

proved by
Meaning.unique

Laws.Batch

∀ {H : Hash} {ds : List Draft} {rank : String → Nat}, Acyclic ds rank → ∀ {σ τ : String → Option String}, Meaning H ds σ → Meaning H ds τ → ∀ (l : String), σ l = τ l
pinned by
11 filesbatch/01-two-labels (current main; may differ from this page's build) batch/02-chain-and-real-ids (current main; may differ from this page's build) batch/03-revise-and-erase (current main; may differ from this page's build) batch/26-label-in-of (current main; may differ from this page's build) batch/32-chain-of-root (current main; may differ from this page's build) batch/33-label-in-under (current main; may differ from this page's build) batch/65-chain-under (current main; may differ from this page's build) batch/66-chain-under-then-about (current main; may differ from this page's build) batch/68-under-held (current main; may differ from this page's build) batch/69-under-batch-id (current main; may differ from this page's build) batch/70-under-erased-in-batch (current main; may differ from this page's build)
also naming it: batch/04-held-self-anchor (current main; may differ from this page's build) batch/76-sets-in-batch (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

batch.refuse

Exactness

Duplicate labels, missing labels and cycles are refused, a label in under among them. Drafts must pass write checks. Each prev target must be held, and so must each under target. An of naming a held record must name a root. Each held prev target must be of the record's thing.

laws.md Duplicate, unknown and cyclic labels are refused, a label in under among them. So are drafts refused by write, unheld prev targets, unheld under targets, an of naming a held record that is not a root, and prev targets of another thing.

proved by
by construction: no theorem, pinned by vectors
pinned by
24 filesbatch/10-unknown-label (current main; may differ from this page's build) batch/11-duplicate-label (current main; may differ from this page's build) batch/12-cycle (current main; may differ from this page's build) batch/13-prev-unknown (current main; may differ from this page's build) batch/14-prev-unrelated (current main; may differ from this page's build) batch/15-write-refused (current main; may differ from this page's build) batch/16-refusal-order (current main; may differ from this page's build) batch/17-label-in-erases (current main; may differ from this page's build) batch/27-of-missing (current main; may differ from this page's build) batch/28-of-not-root-held (current main; may differ from this page's build) batch/29-of-not-root-label (current main; may differ from this page's build) batch/30-prev-unknown-before-of-not-root (current main; may differ from this page's build) batch/31-of-not-root-before-prev-unrelated (current main; may differ from this page's build) batch/34-under-label-unknown (current main; may differ from this page's build) batch/35-under-cycle (current main; may differ from this page's build) batch/36-under-self (current main; may differ from this page's build) batch/37-cycle-through-under-and-prev (current main; may differ from this page's build) batch/38-under-label-before-write (current main; may differ from this page's build) batch/67-under-unknown (current main; may differ from this page's build) batch/71-prev-unknown-before-under-unknown (current main; may differ from this page's build) batch/72-prev-unknown-before-under-unknown-one-draft (current main; may differ from this page's build) batch/73-under-unknown-before-of-not-root (current main; may differ from this page's build) batch/74-under-unknown-before-prev-unrelated (current main; may differ from this page's build) batch/75-write-before-under-unknown (current main; may differ from this page's build)
also naming it: batch/05-large-number-out-of-range (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-0 (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-1 (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-2 (current main; may differ from this page's build) batch/19-shape-before-values-0 (current main; may differ from this page's build) batch/19-shape-before-values-1 (current main; may differ from this page's build) batch/20-shape-before-label-values-0 (current main; may differ from this page's build) batch/20-shape-before-label-values-1 (current main; may differ from this page's build) batch/21-shape-before-salt-0 (current main; may differ from this page's build) batch/21-shape-before-salt-1 (current main; may differ from this page's build) batch/22-shape-before-kind-0 (current main; may differ from this page's build) batch/22-shape-before-kind-1 (current main; may differ from this page's build) batch/23-overflow-out-of-range (current main; may differ from this page's build) batch/24-overflow-after-envelope (current main; may differ from this page's build) batch/25-overflow-before-prev (current main; may differ from this page's build) batch/40-env-not-object (current main; may differ from this page's build) batch/41-env-missing (current main; may differ from this page's build) batch/42-not-object-before-labels (current main; may differ from this page's build) batch/43-kind-missing (current main; may differ from this page's build) batch/44-about-text (current main; may differ from this page's build) batch/45-under-number (current main; may differ from this page's build) batch/46-of-null (current main; may differ from this page's build) batch/47-labels-before-mistyped (current main; may differ from this page's build) batch/48-label-beside-number (current main; may differ from this page's build) batch/49-number-beside-label (current main; may differ from this page's build) batch/50-salt-missing (current main; may differ from this page's build) batch/51-salt-number (current main; may differ from this page's build) batch/52-kind-before-salt (current main; may differ from this page's build) batch/53-salt-before-prev-unknown (current main; may differ from this page's build) batch/54-not-object-before-label-value (current main; may differ from this page's build) batch/55-env-missing-before-label-value (current main; may differ from this page's build) batch/56-nested-label-not-found (current main; may differ from this page's build) batch/57-label-beside-null-unknown (current main; may differ from this page's build) batch/58-label-beside-null-known (current main; may differ from this page's build) batch/59-cycle-beside-unreadable (current main; may differ from this page's build) batch/60-erases-label-beside-null (current main; may differ from this page's build) batch/61-about-null (current main; may differ from this page's build) batch/62-prev-null (current main; may differ from this page's build) batch/63-under-null (current main; may differ from this page's build) batch/64-salt-null (current main; may differ from this page's build) batch/77-sets-text (current main; may differ from this page's build) batch/78-sets-empty-name (current main; may differ from this page's build) batch/79-erases-before-sets (current main; may differ from this page's build) batch/80-sets-before-of-missing (current main; may differ from this page's build) batch/81-labels-before-sets (current main; may differ from this page's build) batch/82-sets-before-prev-unknown (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

batch.refuse-order

Invariance

Change the draft order and the order each stage finds its refusals in, and the refusal reported stays.

Across the batch: shape, then labels, then writing, then prev-unknown, then under-unknown, then of-not-root, then prev-unrelated. Raw shape checks all envelope keys, then that every envelope is an object, before any draft value, label or salt decode. The shape theorems permit arbitrary values, member reorderings and draft orders. Writing's priority is proved from the refusal set. Stage order is by construction, pinned by raw-input rotations.

laws.md Across the batch: shape, then labels, then writing, then prev-unknown, then under-unknown, then of-not-root, then prev-unrelated. Raw shape checks every envelope's keys, then that every envelope is an object, before any draft value, label or salt is decoded. Shape depends only on which envelopes there are, and writing's priority only on the refusal set; stage order is by construction, pinned by raw-input rotations.

proved by
envelopeKeysProblem_set

Laws.Write

∀ {xs ys : List (String × Json)}, (∀ (k : String), k ∈ List.map Prod.fst xs ↔ k ∈ List.map Prod.fst ys) → envelopeKeysProblem xs = envelopeKeysProblem ys
draftsShapeProblem_perm

Laws.Write

∀ {xs ys : List Json}, xs.Perm ys → draftsShapeProblem xs = draftsShapeProblem ys
firstRefusal_set

Laws.Write

∀ {cs ds : List String}, (∀ (c : String), c ∈ cs ↔ c ∈ ds) → (∀ (c : String), c ∈ cs → c ∈ writeCodes) → firstRefusal cs = firstRefusal ds
writeProblem_codes

Laws.Write

∀ {env : Env} {salt : List UInt8} {payload : Json} {c : String}, writeProblem env salt payload = some c → c ∈ writeCodes
pinned by
44 filesbatch/15-write-refused (current main; may differ from this page's build) batch/16-refusal-order (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-0 (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-1 (current main; may differ from this page's build) batch/18-shape-before-duplicate-labels-2 (current main; may differ from this page's build) batch/19-shape-before-values-0 (current main; may differ from this page's build) batch/19-shape-before-values-1 (current main; may differ from this page's build) batch/20-shape-before-label-values-0 (current main; may differ from this page's build) batch/20-shape-before-label-values-1 (current main; may differ from this page's build) batch/21-shape-before-salt-0 (current main; may differ from this page's build) batch/21-shape-before-salt-1 (current main; may differ from this page's build) batch/22-shape-before-kind-0 (current main; may differ from this page's build) batch/22-shape-before-kind-1 (current main; may differ from this page's build) batch/38-under-label-before-write (current main; may differ from this page's build) batch/40-env-not-object (current main; may differ from this page's build) batch/41-env-missing (current main; may differ from this page's build) batch/42-not-object-before-labels (current main; may differ from this page's build) batch/43-kind-missing (current main; may differ from this page's build) batch/44-about-text (current main; may differ from this page's build) batch/45-under-number (current main; may differ from this page's build) batch/46-of-null (current main; may differ from this page's build) batch/47-labels-before-mistyped (current main; may differ from this page's build) batch/48-label-beside-number (current main; may differ from this page's build) batch/49-number-beside-label (current main; may differ from this page's build) batch/50-salt-missing (current main; may differ from this page's build) batch/51-salt-number (current main; may differ from this page's build) batch/52-kind-before-salt (current main; may differ from this page's build) batch/53-salt-before-prev-unknown (current main; may differ from this page's build) batch/54-not-object-before-label-value (current main; may differ from this page's build) batch/55-env-missing-before-label-value (current main; may differ from this page's build) batch/56-nested-label-not-found (current main; may differ from this page's build) batch/57-label-beside-null-unknown (current main; may differ from this page's build) batch/58-label-beside-null-known (current main; may differ from this page's build) batch/59-cycle-beside-unreadable (current main; may differ from this page's build) batch/60-erases-label-beside-null (current main; may differ from this page's build) batch/61-about-null (current main; may differ from this page's build) batch/62-prev-null (current main; may differ from this page's build) batch/63-under-null (current main; may differ from this page's build) batch/64-salt-null (current main; may differ from this page's build) batch/71-prev-unknown-before-under-unknown (current main; may differ from this page's build) batch/72-prev-unknown-before-under-unknown-one-draft (current main; may differ from this page's build) batch/73-under-unknown-before-of-not-root (current main; may differ from this page's build) batch/74-under-unknown-before-prev-unrelated (current main; may differ from this page's build) batch/75-write-before-under-unknown (current main; may differ from this page's build)
also naming it: batch/77-sets-text (current main; may differ from this page's build) batch/78-sets-empty-name (current main; may differ from this page's build) batch/79-erases-before-sets (current main; may differ from this page's build) batch/80-sets-before-of-missing (current main; may differ from this page's build) batch/81-labels-before-sets (current main; may differ from this page's build) batch/82-sets-before-prev-unknown (current main; may differ from this page's build) record/r6-kind-number-unknown-first (current main; may differ from this page's build) record/r6-kind-number-unknown-last (current main; may differ from this page's build) record/r6-nonobject-unknown-first (current main; may differ from this page's build) record/r6-nonobject-unknown-last (current main; may differ from this page's build) record/r6-single-unknown-kind-number (current main; may differ from this page's build) record/r6-single-unknown-missing-kind (current main; may differ from this page's build) record/r6-two-envs-unknown-first (current main; may differ from this page's build) record/r6-two-envs-unknown-last (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
record.shape
carries
record.shape

In its question

record.erasure

Invariance

Change whether the payload's opening is kept, and the id stays.

laws.md forgetting the opening never changes the id

proved by
erase_keeps_id

Laws.Record

∀ (H : Hash) (r : Stored), Stored.id H (erase H r) = Stored.id H r
erase_idem

Laws.Record

∀ (H : Hash) (r : Stored), erase H (erase H r) = erase H r
pinned by
record/08, every erased_linerecord/08-erasure (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

record.commit

Exactness

A record's own salt and payload open its commitment.

laws.md a record's own salt and payload open its commitment

proved by
opening_checks

Laws.Record

∀ (H : Hash) (env : Env) (salt : List UInt8) (payload : Json), opens H (Stored.commit H (make env salt payload)) salt payload = true
pinned by
every stored record vector; checks runs opens on a written record, and on another payload, salt and commitmentalso naming it: record/01-minimal (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

record.sets

Invariance

Change the order of, and repeats in, about, prev, erases or sets, and the id stays.

laws.md reordering or repeating about, prev, erases or sets never changes the id

proved by
id_sets

Laws.Record

∀ (H : Hash) {e e' : Env} (commit : String), e.kind = e'.kind → e.observer = e'.observer → e.emitted = e'.emitted → e.occurred = e'.occurred → e.under = e'.under → e.of = e'.of → (∀ (s : String), s ∈ e.about ↔ s ∈ e'.about) → (∀ (s : String), s ∈ e.prev ↔ s ∈ e'.prev) → (∀ (s : String), s ∈ e.erases ↔ s ∈ e'.erases) → (e.sets.isSome = e'.sets.isSome ∧ ∀ (s : String), s ∈ e.sets.getD [] ↔ s ∈ e'.sets.getD []) → idOf H e commit = idOf H e' commit
canonSet_eq

Laws.Record

∀ {xs ys : List String}, (∀ (s : String), s ∈ xs ↔ s ∈ ys) → canonSet xs = canonSet ys
setsJson_eq

Laws.Record

∀ {a b : Option (List String)}, (a.isSome = b.isSome ∧ ∀ (s : String), s ∈ a.getD [] ↔ s ∈ b.getD []) → Env.setsJson a = Env.setsJson b
pinned by
record/02-full-envelope (current main; may differ from this page's build) record/03-sets-are-sets (current main; may differ from this page's build) record/11-erases (current main; may differ from this page's build) record/15-sets-are-sets (current main; may differ from this page's build)also naming it: record/shape-empty-sets (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.set keyed.fold keyed.whole-read keyed.witnessed spec.after-supersession spec.follow spec.set spec.slice thing.local

In its questionTry to break it

record.keys

Exactness

sets holds key names, and absent and empty differ: the canonical envelope writes an empty sets as [], so it is not the envelope without one. An envelope the writer accepts declares only non-empty key names, or it is refused with sets-not-keys, after erases-not-record-id and before of-missing.

sets names top-level payload keys. Nothing compares it with the payload, so a declared key the payload lacks is written, and the envelope stays checkable without its payload. A latest-by that follows keys reads it (keyed.live); no other fold, spec or lens does.

laws.md sets holds key names, and absent and empty differ. The canonical envelope holds sets only as stated: left out when absent, written when stated, "sets": [] included, so an envelope with an empty sets is not the envelope without it. Every key an accepted envelope declares is non-empty text; sets-not-keys speaks only when every member of erases is a record id, and of-missing only when every declared key is a key name. A sets that is not an array, or has a member that is not text, reads as an unreadable member and is refused. Pinned by the vectors, not proved: the bytes and ids, that nothing compares sets with the payload, and that a batch ranks sets-not-keys after erases-not-record-id and before of-missing and replaces no label in it.

proved by
Env.problem_sets

Laws.Write

∀ {e : Env}, e.problem = none → e.keysNamed = true
Env.problem_sets_not_keys

Laws.Write

∀ {e : Env}, e.problem = some "sets-not-keys" → e.erases.all recordId = true ∧ e.keysNamed = false
Env.problem_of_missing_sets

Laws.Write

∀ {e : Env}, e.problem = some "of-missing" → e.keysNamed = true
toJson_sets

Laws.Record

∀ (e : Env) (s : Option (List String)), { kind := e.kind, observer := e.observer, emitted := e.emitted, occurred := e.occurred, about := e.about, of := e.of, prev := e.prev, under := e.under, erases := e.erases, sets := s }.toJson = Json.obj (e.baseJson ++ Env.setsJson s)
sets_empty_ne_absent

Laws.Record

∀ (e : Env), { kind := e.kind, observer := e.observer, emitted := e.emitted, occurred := e.occurred, about := e.about, of := e.of, prev := e.prev, under := e.under, erases := e.erases, sets := some [] }.toJson ≠ { kind := e.kind, observer := e.observer, emitted := e.emitted, occurred := e.occurred, about := e.about, of := e.of, prev := e.prev, under := e.under, erases := e.erases }.toJson
Read.envOf_sets_mistyped

Laws.Read

∀ {kvs : List (String × Json)} {j : Json}, List.lookup "sets" kvs = some j → ((∀ (xs : List Json), j ≠ Json.arr xs) ∨ ∃ xs x, j = Json.arr xs ∧ x ∈ xs ∧ ∀ (s : String), x ≠ Json.str s) → (Read.envOf kvs).problem ≠ none
pinned by
20 filesbatch/76-sets-in-batch (current main; may differ from this page's build) batch/77-sets-text (current main; may differ from this page's build) batch/78-sets-empty-name (current main; may differ from this page's build) batch/79-erases-before-sets (current main; may differ from this page's build) batch/80-sets-before-of-missing (current main; may differ from this page's build) batch/81-labels-before-sets (current main; may differ from this page's build) batch/82-sets-before-prev-unknown (current main; may differ from this page's build) record/15-sets-are-sets (current main; may differ from this page's build) record/16-sets-empty (current main; may differ from this page's build) record/17-sets-absent (current main; may differ from this page's build) record/18-sets-key-not-in-payload (current main; may differ from this page's build) record/19-sets-payload-not-object (current main; may differ from this page's build) record/45-sets-empty-name (current main; may differ from this page's build) record/46-erases-before-sets (current main; may differ from this page's build) record/47-sets-before-of-missing (current main; may differ from this page's build) record/shape-erases-before-sets (current main; may differ from this page's build) record/shape-sets-before-of-missing (current main; may differ from this page's build) record/shape-sets-empty-name (current main; may differ from this page's build) record/shape-sets-member-number (current main; may differ from this page's build) record/shape-sets-text (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
record.shape

In its question

record.of

Exactness

Only a root leaves of out: an envelope the writer accepts with prev states of, or it is refused with of-missing.

of holds one typed reference, a record id or a natural key, and is left out when absent, so a record without it keeps its bytes and id.

laws.md of holds at most one typed reference and is left out when absent, so a record without it keeps its bytes and id. Only a root leaves it out: an envelope the writer accepts with prev states of.

proved by
Env.problem_of

Laws.Write

∀ {e : Env}, e.problem = none → e.prev ≠ [] → e.of.isSome = true
pinned by
batch/27-of-missing (current main; may differ from this page's build) record/14-of-natural-key (current main; may differ from this page's build) record/41-of-missing (current main; may differ from this page's build) record/44-erases-before-of-missing (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

record.shape

Exactness

Every envelope shape has a named refusal. An envelope that is not an object is refused with envelope-not-object, after any unknown key and before every value. A required field left out, or a field of the wrong JSON type, is refused with that field's own code, in its place. A salt that is not base32hex text is refused with salt-not-16-bytes.

Proved: the reader reads such a field as empty text, an envelope holding it is refused, and no accepted or stored record holds it, though it can be hashed on the way to a refusal. Pinned by the vectors: which code it gets and its place in the order, and the order of the shape stage. A repeated envelope member name is malformed input, with no code.

laws.md Every envelope shape has a named refusal. Proved: the reader reads a required field left out, or a field of the wrong JSON type, as empty text, and an envelope holding it is refused, so no accepted or stored record holds it (it can be hashed on the way to a refusal); a salt that is not base32hex text of 16 bytes is not 16 bytes, which a good envelope's writer refuses; raw shape depends only on which envelopes there are. Pinned by the vectors, not proved: an envelope that is not an object refuses with envelope-not-object, after any unknown key and before every value; which code a missing or mistyped field gets, and its place in the order; that the reader's decoder is Read.envOf over the object's members. A repeated envelope member name is malformed input.

proved by
unreadable_refused

Laws.Write

unreadable.isEmpty = true ∧ typedRef unreadable = false ∧ validEmitted unreadable = false ∧ occurredSpan? unreadable = none ∧ recordId unreadable = false ∧ keyName unreadable = false
Env.problem_unreadable

Laws.Read

∀ {e : Env}, (e.kind = unreadable ∨ e.observer = unreadable ∨ e.emitted = unreadable ∨ e.occurred = some unreadable ∨ unreadable ∈ e.about ∨ e.of = some unreadable ∨ unreadable ∈ e.prev ∨ e.under = some unreadable ∨ unreadable ∈ e.erases ∨ ∃ xs, e.sets = some xs ∧ unreadable ∈ xs) → e.problem ≠ none
Written.no_unreadable

Laws.Read

∀ (w : Written), ¬(w.env.kind = unreadable ∨ w.env.observer = unreadable ∨ w.env.emitted = unreadable ∨ w.env.occurred = some unreadable ∨ unreadable ∈ w.env.about ∨ w.env.of = some unreadable ∨ unreadable ∈ w.env.prev ∨ w.env.under = some unreadable ∨ unreadable ∈ w.env.erases ∨ ∃ xs, w.env.sets = some xs ∧ unreadable ∈ xs)
Read.envOf_missing

Laws.Read

∀ {kvs : List (String × Json)}, List.lookup "kind" kvs = none ∨ List.lookup "observer" kvs = none ∨ List.lookup "emitted" kvs = none → (Read.envOf kvs).problem ≠ none
Read.envOf_mistyped

Laws.Read

∀ {kvs : List (String × Json)} {k : String} {j : Json}, k ∈ ["kind", "observer", "emitted", "occurred", "of", "under"] → List.lookup k kvs = some j → (∀ (s : String), j ≠ Json.str s) → (Read.envOf kvs).problem ≠ none
Read.envOf_set_mistyped

Laws.Read

∀ {kvs : List (String × Json)} {k : String} {j : Json}, k ∈ ["about", "prev", "erases"] → List.lookup k kvs = some j → ((∀ (xs : List Json), j ≠ Json.arr xs) ∨ ∃ xs x, j = Json.arr xs ∧ x ∈ xs ∧ ∀ (s : String), x ≠ Json.str s) → (Read.envOf kvs).problem ≠ none
Read.envOf_sets_mistyped

Laws.Read

∀ {kvs : List (String × Json)} {j : Json}, List.lookup "sets" kvs = some j → ((∀ (xs : List Json), j ≠ Json.arr xs) ∨ ∃ xs x, j = Json.arr xs ∧ x ∈ xs ∧ ∀ (s : String), x ≠ Json.str s) → (Read.envOf kvs).problem ≠ none
Read.salt_length

Laws.Read

∀ {j : Option Json}, (Read.salt j).length = 16 → ∃ s bs, j = some (Json.str s) ∧ unbase32 s = some bs ∧ bs.length = 16
writeProblem_salt

Laws.Read

∀ {env : Env} {salt : List UInt8} {payload : Json}, env.problem = none → salt.length ≠ 16 → writeProblem env salt payload = some "salt-not-16-bytes"
envelopesShapeProblem_perm

Laws.Write

∀ {xs ys : List Json}, xs.Perm ys → envelopesShapeProblem xs = envelopesShapeProblem ys
pinned by
45 filesbatch/40-env-not-object (current main; may differ from this page's build) batch/41-env-missing (current main; may differ from this page's build) batch/42-not-object-before-labels (current main; may differ from this page's build) batch/43-kind-missing (current main; may differ from this page's build) batch/44-about-text (current main; may differ from this page's build) batch/45-under-number (current main; may differ from this page's build) batch/46-of-null (current main; may differ from this page's build) batch/47-labels-before-mistyped (current main; may differ from this page's build) batch/48-label-beside-number (current main; may differ from this page's build) batch/49-number-beside-label (current main; may differ from this page's build) batch/50-salt-missing (current main; may differ from this page's build) batch/51-salt-number (current main; may differ from this page's build) batch/52-kind-before-salt (current main; may differ from this page's build) batch/53-salt-before-prev-unknown (current main; may differ from this page's build) batch/54-not-object-before-label-value (current main; may differ from this page's build) batch/55-env-missing-before-label-value (current main; may differ from this page's build) batch/56-nested-label-not-found (current main; may differ from this page's build) batch/57-label-beside-null-unknown (current main; may differ from this page's build) batch/58-label-beside-null-known (current main; may differ from this page's build) batch/59-cycle-beside-unreadable (current main; may differ from this page's build) batch/60-erases-label-beside-null (current main; may differ from this page's build) batch/61-about-null (current main; may differ from this page's build) batch/62-prev-null (current main; may differ from this page's build) batch/63-under-null (current main; may differ from this page's build) batch/64-salt-null (current main; may differ from this page's build) batch/77-sets-text (current main; may differ from this page's build) batch/78-sets-empty-name (current main; may differ from this page's build) batch/79-erases-before-sets (current main; may differ from this page's build) batch/80-sets-before-of-missing (current main; may differ from this page's build) batch/81-labels-before-sets (current main; may differ from this page's build) batch/82-sets-before-prev-unknown (current main; may differ from this page's build) record/r6-nonobject-unknown-first (current main; may differ from this page's build) record/r6-nonobject-unknown-last (current main; may differ from this page's build) record/shape-about-null (current main; may differ from this page's build) record/shape-empty-sets (current main; may differ from this page's build) record/shape-kind-number (current main; may differ from this page's build) record/shape-missing-kind (current main; may differ from this page's build) record/shape-not-object-after-written (current main; may differ from this page's build) record/shape-not-object-before-text (current main; may differ from this page's build) record/shape-not-object-number (current main; may differ from this page's build) record/shape-observer-before-emitted (current main; may differ from this page's build) record/shape-of-not-missing (current main; may differ from this page's build) record/shape-salt-null (current main; may differ from this page's build) record/shape-salt-number (current main; may differ from this page's build) record/shape-sets-null (current main; may differ from this page's build)
also naming it: record/shape-about-before-of (current main; may differ from this page's build) record/shape-about-member-number (current main; may differ from this page's build) record/shape-about-nested (current main; may differ from this page's build) record/shape-about-object (current main; may differ from this page's build) record/shape-about-text (current main; may differ from this page's build) record/shape-emitted-before-occurred (current main; may differ from this page's build) record/shape-emitted-number (current main; may differ from this page's build) record/shape-empty-object (current main; may differ from this page's build) record/shape-envelope-before-salt (current main; may differ from this page's build) record/shape-erases-before-of-missing (current main; may differ from this page's build) record/shape-erases-before-sets (current main; may differ from this page's build) record/shape-erases-member-number (current main; may differ from this page's build) record/shape-erases-null (current main; may differ from this page's build) record/shape-erases-text (current main; may differ from this page's build) record/shape-first-variant-decides (current main; may differ from this page's build) record/shape-kind-before-observer-number (current main; may differ from this page's build) record/shape-kind-null (current main; may differ from this page's build) record/shape-missing-emitted (current main; may differ from this page's build) record/shape-missing-kind-before-observer (current main; may differ from this page's build) record/shape-missing-observer (current main; may differ from this page's build) record/shape-not-object-array (current main; may differ from this page's build) record/shape-not-object-before-kind (current main; may differ from this page's build) record/shape-not-object-null (current main; may differ from this page's build) record/shape-not-object-text (current main; may differ from this page's build) record/shape-observer-array (current main; may differ from this page's build) record/shape-observer-number (current main; may differ from this page's build) record/shape-occurred-null (current main; may differ from this page's build) record/shape-occurred-number (current main; may differ from this page's build) record/shape-of-array (current main; may differ from this page's build) record/shape-of-before-prev (current main; may differ from this page's build) record/shape-of-null (current main; may differ from this page's build) record/shape-of-number (current main; may differ from this page's build) record/shape-prev-before-of-missing (current main; may differ from this page's build) record/shape-prev-member-null (current main; may differ from this page's build) record/shape-prev-null (current main; may differ from this page's build) record/shape-prev-text (current main; may differ from this page's build) record/shape-salt-before-member-duplicate (current main; may differ from this page's build) record/shape-salt-before-number (current main; may differ from this page's build) record/shape-salt-missing (current main; may differ from this page's build) record/shape-salt-not-base32 (current main; may differ from this page's build) record/shape-sets-before-of-missing (current main; may differ from this page's build) record/shape-sets-empty-name (current main; may differ from this page's build) record/shape-sets-member-null (current main; may differ from this page's build) record/shape-sets-member-number (current main; may differ from this page's build) record/shape-sets-nested (current main; may differ from this page's build) record/shape-sets-object (current main; may differ from this page's build) record/shape-sets-text (current main; may differ from this page's build) record/shape-text-before-missing-kind (current main; may differ from this page's build) record/shape-under-array (current main; may differ from this page's build) record/shape-under-before-erases (current main; may differ from this page's build) record/shape-under-null (current main; may differ from this page's build) record/shape-under-number (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
batch.refuse-order
carries
batch.refuse-order record.keys

In its question

record.member-order

Invariance

Change the order of an object's members, and its canonical bytes stay.

Holds when the object's member names are distinct.

laws.md reordering an object's members never changes its canonical bytes

proved by
canon_member_order

Laws.Record

∀ {kvs kvs' : List (String × Json)}, kvs.Perm kvs' → (List.map (fun x => x.fst) kvs).Nodup → (Json.obj kvs).canon = (Json.obj kvs').canon
pinned by
record/04-member-order (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
result.canonical spec.hash tick.canonical write.member-order

In its questionWithout its premise

UTF-16 order

Order

Any two distinct strings order one way, by UTF-16 code units.

laws.md member and set order is a strict total order on distinct strings

proved by
lexLt_trans

Laws.Record

∀ {a b c : List Nat}, lexLt a b = true → lexLt b c = true → lexLt a c = true
lexLt_total

Laws.Record

∀ {a b : List Nat}, a ≠ b → lexLt a b = true ∨ lexLt b a = true
utf16_inj

Laws.Record

∀ {a b : String}, utf16 a = utf16 b → a = b
pinned by
every record vector
carries
by.accounting keyed.fold keyed.slots keyed.spec-slice keyed.whole-read latest.one-thing record.member-order record.sets result.canonical spec.hash spec.slice tick.canonical tick.made

In its question

record.unicode

Exactness

Text is Unicode scalar values. UTF-16 code units read as text exactly when their surrogates pair; a lone surrogate is no text, and nothing is put in its place.

No string the model canonicalizes or hashes holds a lone surrogate. A payload text that is JSON but holds one, in a string or a member name, is refused with string-not-unicode: after raw shape, before every value check. Text that is not JSON has no refusal code.

laws.md UTF-16 code units read as text exactly when some text writes them. A string's own code units read back as that string, so no string the model canonicalizes or hashes holds a lone surrogate. A high surrogate without a low one after it, and a low one without a high one before it, are no text.

proved by
ofUtf16?_eq_some_iff

Laws.Record

∀ {us : List Nat} {cs : List Char}, ofUtf16? us = some cs ↔ List.flatMap utf16Char cs = us
ofUtf16?_utf16

Laws.Record

∀ (s : String), ofUtf16? (utf16 s) = some s.toList
ofUtf16?_lone_high

Laws.Record

∀ {u l : Nat} (us : List Nat), highSurrogate u = true → lowSurrogate l = false → ofUtf16? (u :: l :: us) = none
ofUtf16?_lone_high_end

Laws.Record

∀ {u : Nat}, highSurrogate u = true → ofUtf16? [u] = none
ofUtf16?_lone_low

Laws.Record

∀ {u : Nat} (us : List Nat), lowSurrogate u = true → ofUtf16? (u :: us) = none
pinned by
record/d2-high-then-escape (current main; may differ from this page's build) record/d2-lone-high (current main; may differ from this page's build) record/d2-lone-low (current main; may differ from this page's build) record/d2-low-then-high (current main; may differ from this page's build) record/d2-member-name (current main; may differ from this page's build) record/d2-paired-escape (current main; may differ from this page's build)also naming it: record/d2-before-kind (current main; may differ from this page's build) record/d2-before-member-duplicate (current main; may differ from this page's build) record/d2-before-number (current main; may differ from this page's build) record/d2-before-salt (current main; may differ from this page's build) record/d2-high-then-pair (current main; may differ from this page's build) record/d2-high-then-text (current main; may differ from this page's build) record/d2-nested (current main; may differ from this page's build) record/d2-shape-first (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

record.refuse

Exactness

Writing refuses a bad envelope, an invalid salt length, a repeated member name, or a nonfinite or out-of-range number. Every number's magnitude must be at most 253 − 1, whole or not.

Raw unknown envelope keys refuse first, then an envelope that is not an object (record.shape), then a lone surrogate in a text payload (record.unicode), then these in order. A record input that lists several envelopes or payloads is answered by its first of each.

laws.md Bad envelopes, salt lengths, repeated members, nonfinite and out-of-range numbers receive named refusals. Raw unknown envelope keys refuse before kind-empty, and an envelope that is not an object after them (record.shape). A payload text that is JSON but holds a lone surrogate refuses with string-not-unicode, after raw shape and before every value check. A record input's first envelope and first payload decide its refusal.

proved by
by construction: no theorem, pinned by vectors
pinned by
27 filesrecord/20-kind-empty (current main; may differ from this page's build) record/21-observer-untyped (current main; may differ from this page's build) record/22-emitted-no-zone (current main; may differ from this page's build) record/23-emitted-lowercase (current main; may differ from this page's build) record/24-emitted-no-such-day (current main; may differ from this page's build) record/25-emitted-refused-offset (current main; may differ from this page's build) record/26-about-untyped (current main; may differ from this page's build) record/27-prev-not-record (current main; may differ from this page's build) record/28-under-not-record (current main; may differ from this page's build) record/29-number-out-of-range (current main; may differ from this page's build) record/30-salt-short (current main; may differ from this page's build) record/31-member-duplicate (current main; may differ from this page's build) record/32-proto-out-of-range (current main; may differ from this page's build) record/33-erases-not-record (current main; may differ from this page's build) record/34-occurred-duration (current main; may differ from this page's build) record/45-sets-empty-name (current main; may differ from this page's build) record/46-erases-before-sets (current main; may differ from this page's build) record/47-sets-before-of-missing (current main; may differ from this page's build) record/d2-before-kind (current main; may differ from this page's build) record/d2-before-member-duplicate (current main; may differ from this page's build) record/d2-shape-first (current main; may differ from this page's build) record/d5-differently-refused-0 (current main; may differ from this page's build) record/d5-differently-refused-1 (current main; may differ from this page's build) record/d5-first-pair (current main; may differ from this page's build) record/d5-refused-then-written (current main; may differ from this page's build) record/r6-unknown-before-kind (current main; may differ from this page's build) record/r6-unknown-field (current main; may differ from this page's build)
also naming it: record/35-observer-prefix-start (current main; may differ from this page's build) record/36-observer-prefix-tail (current main; may differ from this page's build) record/37-empty-salt-envelope-first (current main; may differ from this page's build) record/39-huge-out-of-range (current main; may differ from this page's build) record/40-of-untyped (current main; may differ from this page's build) record/41-of-missing (current main; may differ from this page's build) record/42-about-before-of (current main; may differ from this page's build) record/43-of-before-prev (current main; may differ from this page's build) record/44-erases-before-of-missing (current main; may differ from this page's build) record/d2-before-number (current main; may differ from this page's build) record/d2-before-salt (current main; may differ from this page's build) record/d2-high-then-escape (current main; may differ from this page's build) record/d2-high-then-pair (current main; may differ from this page's build) record/d2-high-then-text (current main; may differ from this page's build) record/d2-lone-high (current main; may differ from this page's build) record/d2-lone-low (current main; may differ from this page's build) record/d2-low-then-high (current main; may differ from this page's build) record/d2-member-name (current main; may differ from this page's build) record/d2-nested (current main; may differ from this page's build) record/d3-kind-first (current main; may differ from this page's build) record/d3-member-duplicate-first (current main; may differ from this page's build) record/d3-overflow-exponent (current main; may differ from this page's build) record/d3-overflow-negative (current main; may differ from this page's build) record/d3-overflow-value-negative (current main; may differ from this page's build) record/d3-overflow-value (current main; may differ from this page's build) record/d3-overflow (current main; may differ from this page's build) record/d3-salt-first (current main; may differ from this page's build) record/d3-shape-first (current main; may differ from this page's build) record/d5-envelope-before-payload (current main; may differ from this page's build) record/d5-payload-refused-then-written (current main; may differ from this page's build) record/r1-erases-0 (current main; may differ from this page's build) record/r1-erases-1 (current main; may differ from this page's build) record/r1-erases-2 (current main; may differ from this page's build) record/r1-erases-3 (current main; may differ from this page's build) record/r1-erases-4 (current main; may differ from this page's build) record/r1-erases-5 (current main; may differ from this page's build) record/r1-id-long (current main; may differ from this page's build) record/r1-id-short (current main; may differ from this page's build) record/r1-prev-0 (current main; may differ from this page's build) record/r1-prev-1 (current main; may differ from this page's build) record/r1-prev-2 (current main; may differ from this page's build) record/r1-prev-3 (current main; may differ from this page's build) record/r1-prev-4 (current main; may differ from this page's build) record/r1-prev-5 (current main; may differ from this page's build) record/r1-under-0 (current main; may differ from this page's build) record/r1-under-1 (current main; may differ from this page's build) record/r1-under-2 (current main; may differ from this page's build) record/r1-under-3 (current main; may differ from this page's build) record/r1-under-4 (current main; may differ from this page's build) record/r1-under-5 (current main; may differ from this page's build) record/r4-emitted-0 (current main; may differ from this page's build) record/r4-emitted-1 (current main; may differ from this page's build) record/r4-emitted-2 (current main; may differ from this page's build) record/r4-emitted-3 (current main; may differ from this page's build) record/r4-emitted-4 (current main; may differ from this page's build) record/r4-emitted-5 (current main; may differ from this page's build) record/r4-emitted-6 (current main; may differ from this page's build) record/r4-occurred-open-0 (current main; may differ from this page's build) record/r4-occurred-open-1 (current main; may differ from this page's build) record/r4-occurred-open-2 (current main; may differ from this page's build) record/r4-occurred-open-3 (current main; may differ from this page's build) record/r4-occurred-single-0 (current main; may differ from this page's build) record/r4-occurred-single-1 (current main; may differ from this page's build) record/r4-occurred-single-2 (current main; may differ from this page's build) record/r4-occurred-single-3 (current main; may differ from this page's build) record/r4-occurred-start-0 (current main; may differ from this page's build) record/r4-occurred-start-1 (current main; may differ from this page's build) record/r4-occurred-start-2 (current main; may differ from this page's build) record/r4-occurred-start-3 (current main; may differ from this page's build) record/r4-occurred-stop-0 (current main; may differ from this page's build) record/r4-occurred-stop-1 (current main; may differ from this page's build) record/r4-occurred-stop-2 (current main; may differ from this page's build) record/r4-occurred-stop-3 (current main; may differ from this page's build) record/r4-offset-0 (current main; may differ from this page's build) record/r4-offset-1 (current main; may differ from this page's build) record/r4-offset-2 (current main; may differ from this page's build) record/r4-offset-3 (current main; may differ from this page's build) record/r6-kind-number-unknown-first (current main; may differ from this page's build) record/r6-kind-number-unknown-last (current main; may differ from this page's build) record/r6-nonobject-unknown-first (current main; may differ from this page's build) record/r6-nonobject-unknown-last (current main; may differ from this page's build) record/r6-single-unknown-kind-number (current main; may differ from this page's build) record/r6-single-unknown-missing-kind (current main; may differ from this page's build) record/r6-two-envs-unknown-first (current main; may differ from this page's build) record/r6-two-envs-unknown-last (current main; may differ from this page's build) record/shape-about-before-of (current main; may differ from this page's build) record/shape-about-member-number (current main; may differ from this page's build) record/shape-about-nested (current main; may differ from this page's build) record/shape-about-null (current main; may differ from this page's build) record/shape-about-object (current main; may differ from this page's build) record/shape-about-text (current main; may differ from this page's build) record/shape-emitted-before-occurred (current main; may differ from this page's build) record/shape-emitted-number (current main; may differ from this page's build) record/shape-empty-object (current main; may differ from this page's build) record/shape-envelope-before-salt (current main; may differ from this page's build) record/shape-erases-before-of-missing (current main; may differ from this page's build) record/shape-erases-before-sets (current main; may differ from this page's build) record/shape-erases-member-number (current main; may differ from this page's build) record/shape-erases-null (current main; may differ from this page's build) record/shape-erases-text (current main; may differ from this page's build) record/shape-first-variant-decides (current main; may differ from this page's build) record/shape-kind-before-observer-number (current main; may differ from this page's build) record/shape-kind-null (current main; may differ from this page's build) record/shape-kind-number (current main; may differ from this page's build) record/shape-missing-emitted (current main; may differ from this page's build) record/shape-missing-kind-before-observer (current main; may differ from this page's build) record/shape-missing-kind (current main; may differ from this page's build) record/shape-missing-observer (current main; may differ from this page's build) record/shape-not-object-after-written (current main; may differ from this page's build) record/shape-not-object-array (current main; may differ from this page's build) record/shape-not-object-before-kind (current main; may differ from this page's build) record/shape-not-object-before-text (current main; may differ from this page's build) record/shape-not-object-null (current main; may differ from this page's build) record/shape-not-object-number (current main; may differ from this page's build) record/shape-not-object-text (current main; may differ from this page's build) record/shape-observer-array (current main; may differ from this page's build) record/shape-observer-before-emitted (current main; may differ from this page's build) record/shape-observer-number (current main; may differ from this page's build) record/shape-occurred-null (current main; may differ from this page's build) record/shape-occurred-number (current main; may differ from this page's build) record/shape-of-array (current main; may differ from this page's build) record/shape-of-before-prev (current main; may differ from this page's build) record/shape-of-not-missing (current main; may differ from this page's build) record/shape-of-null (current main; may differ from this page's build) record/shape-of-number (current main; may differ from this page's build) record/shape-prev-before-of-missing (current main; may differ from this page's build) record/shape-prev-member-null (current main; may differ from this page's build) record/shape-prev-null (current main; may differ from this page's build) record/shape-prev-text (current main; may differ from this page's build) record/shape-salt-before-member-duplicate (current main; may differ from this page's build) record/shape-salt-before-number (current main; may differ from this page's build) record/shape-salt-missing (current main; may differ from this page's build) record/shape-salt-not-base32 (current main; may differ from this page's build) record/shape-salt-null (current main; may differ from this page's build) record/shape-salt-number (current main; may differ from this page's build) record/shape-sets-before-of-missing (current main; may differ from this page's build) record/shape-sets-empty-name (current main; may differ from this page's build) record/shape-sets-member-null (current main; may differ from this page's build) record/shape-sets-member-number (current main; may differ from this page's build) record/shape-sets-nested (current main; may differ from this page's build) record/shape-sets-null (current main; may differ from this page's build) record/shape-sets-object (current main; may differ from this page's build) record/shape-sets-text (current main; may differ from this page's build) record/shape-text-before-missing-kind (current main; may differ from this page's build) record/shape-under-array (current main; may differ from this page's build) record/shape-under-before-erases (current main; may differ from this page's build) record/shape-under-null (current main; may differ from this page's build) record/shape-under-number (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

write.checked

Exactness

write succeeds exactly when every check passes, and what it returns carries the proof.

laws.md write succeeds exactly when every check passes, and what it returns carries the proof; a batch writes through it

proved by
writeProblem_none

Loops.Stored

∀ {env : Env} {salt : List UInt8} {payload : Json}, writeProblem env salt payload = none ↔ Writable env salt payload
Written
pinned by
199 filesbatch/15-write-refused (current main; may differ from this page's build) batch/17-label-in-erases (current main; may differ from this page's build) record/01-minimal (current main; may differ from this page's build) record/02-full-envelope (current main; may differ from this page's build) record/03-sets-are-sets (current main; may differ from this page's build) record/04-member-order (current main; may differ from this page's build) record/05-unicode (current main; may differ from this page's build) record/06-values (current main; may differ from this page's build) record/07-payload-not-object (current main; may differ from this page's build) record/08-erasure (current main; may differ from this page's build) record/09-last-second (current main; may differ from this page's build) record/10-proto-member (current main; may differ from this page's build) record/11-erases (current main; may differ from this page's build) record/12-negative-exact-boundary (current main; may differ from this page's build) record/13-nine-digit-fraction (current main; may differ from this page's build) record/14-of-natural-key (current main; may differ from this page's build) record/15-sets-are-sets (current main; may differ from this page's build) record/16-sets-empty (current main; may differ from this page's build) record/17-sets-absent (current main; may differ from this page's build) record/18-sets-key-not-in-payload (current main; may differ from this page's build) record/19-sets-payload-not-object (current main; may differ from this page's build) record/20-kind-empty (current main; may differ from this page's build) record/21-observer-untyped (current main; may differ from this page's build) record/22-emitted-no-zone (current main; may differ from this page's build) record/23-emitted-lowercase (current main; may differ from this page's build) record/24-emitted-no-such-day (current main; may differ from this page's build) record/25-emitted-refused-offset (current main; may differ from this page's build) record/26-about-untyped (current main; may differ from this page's build) record/27-prev-not-record (current main; may differ from this page's build) record/28-under-not-record (current main; may differ from this page's build) record/29-number-out-of-range (current main; may differ from this page's build) record/30-salt-short (current main; may differ from this page's build) record/31-member-duplicate (current main; may differ from this page's build) record/32-proto-out-of-range (current main; may differ from this page's build) record/33-erases-not-record (current main; may differ from this page's build) record/34-occurred-duration (current main; may differ from this page's build) record/35-observer-prefix-start (current main; may differ from this page's build) record/36-observer-prefix-tail (current main; may differ from this page's build) record/37-empty-salt-envelope-first (current main; may differ from this page's build) record/38-native-shortest-tie (current main; may differ from this page's build) record/39-huge-out-of-range (current main; may differ from this page's build) record/40-of-untyped (current main; may differ from this page's build) record/41-of-missing (current main; may differ from this page's build) record/42-about-before-of (current main; may differ from this page's build) record/43-of-before-prev (current main; may differ from this page's build) record/44-erases-before-of-missing (current main; may differ from this page's build) record/45-sets-empty-name (current main; may differ from this page's build) record/46-erases-before-sets (current main; may differ from this page's build) record/47-sets-before-of-missing (current main; may differ from this page's build) record/d2-before-kind (current main; may differ from this page's build) record/d2-before-member-duplicate (current main; may differ from this page's build) record/d2-before-number (current main; may differ from this page's build) record/d2-before-salt (current main; may differ from this page's build) record/d2-high-then-escape (current main; may differ from this page's build) record/d2-high-then-pair (current main; may differ from this page's build) record/d2-high-then-text (current main; may differ from this page's build) record/d2-lone-high (current main; may differ from this page's build) record/d2-lone-low (current main; may differ from this page's build) record/d2-low-then-high (current main; may differ from this page's build) record/d2-member-name (current main; may differ from this page's build) record/d2-nested (current main; may differ from this page's build) record/d2-paired-escape (current main; may differ from this page's build) record/d2-shape-first (current main; may differ from this page's build) record/d3-kind-first (current main; may differ from this page's build) record/d3-member-duplicate-first (current main; may differ from this page's build) record/d3-overflow (current main; may differ from this page's build) record/d3-overflow-exponent (current main; may differ from this page's build) record/d3-overflow-negative (current main; may differ from this page's build) record/d3-overflow-value (current main; may differ from this page's build) record/d3-overflow-value-negative (current main; may differ from this page's build) record/d3-salt-first (current main; may differ from this page's build) record/d3-shape-first (current main; may differ from this page's build) record/d5-differently-refused-0 (current main; may differ from this page's build) record/d5-differently-refused-1 (current main; may differ from this page's build) record/d5-envelope-before-payload (current main; may differ from this page's build) record/d5-first-pair (current main; may differ from this page's build) record/d5-payload-refused-then-written (current main; may differ from this page's build) record/d5-refused-then-written (current main; may differ from this page's build) record/r1-erases-0 (current main; may differ from this page's build) record/r1-erases-1 (current main; may differ from this page's build) record/r1-erases-2 (current main; may differ from this page's build) record/r1-erases-3 (current main; may differ from this page's build) record/r1-erases-4 (current main; may differ from this page's build) record/r1-erases-5 (current main; may differ from this page's build) record/r1-id-long (current main; may differ from this page's build) record/r1-id-short (current main; may differ from this page's build) record/r1-prev-0 (current main; may differ from this page's build) record/r1-prev-1 (current main; may differ from this page's build) record/r1-prev-2 (current main; may differ from this page's build) record/r1-prev-3 (current main; may differ from this page's build) record/r1-prev-4 (current main; may differ from this page's build) record/r1-prev-5 (current main; may differ from this page's build) record/r1-under-0 (current main; may differ from this page's build) record/r1-under-1 (current main; may differ from this page's build) record/r1-under-2 (current main; may differ from this page's build) record/r1-under-3 (current main; may differ from this page's build) record/r1-under-4 (current main; may differ from this page's build) record/r1-under-5 (current main; may differ from this page's build) record/r4-emitted-0 (current main; may differ from this page's build) record/r4-emitted-1 (current main; may differ from this page's build) record/r4-emitted-2 (current main; may differ from this page's build) record/r4-emitted-3 (current main; may differ from this page's build) record/r4-emitted-4 (current main; may differ from this page's build) record/r4-emitted-5 (current main; may differ from this page's build) record/r4-emitted-6 (current main; may differ from this page's build) record/r4-occurred-open-0 (current main; may differ from this page's build) record/r4-occurred-open-1 (current main; may differ from this page's build) record/r4-occurred-open-2 (current main; may differ from this page's build) record/r4-occurred-open-3 (current main; may differ from this page's build) record/r4-occurred-single-0 (current main; may differ from this page's build) record/r4-occurred-single-1 (current main; may differ from this page's build) record/r4-occurred-single-2 (current main; may differ from this page's build) record/r4-occurred-single-3 (current main; may differ from this page's build) record/r4-occurred-start-0 (current main; may differ from this page's build) record/r4-occurred-start-1 (current main; may differ from this page's build) record/r4-occurred-start-2 (current main; may differ from this page's build) record/r4-occurred-start-3 (current main; may differ from this page's build) record/r4-occurred-stop-0 (current main; may differ from this page's build) record/r4-occurred-stop-1 (current main; may differ from this page's build) record/r4-occurred-stop-2 (current main; may differ from this page's build) record/r4-occurred-stop-3 (current main; may differ from this page's build) record/r4-offset-0 (current main; may differ from this page's build) record/r4-offset-1 (current main; may differ from this page's build) record/r4-offset-2 (current main; may differ from this page's build) record/r4-offset-3 (current main; may differ from this page's build) record/r6-kind-number-unknown-first (current main; may differ from this page's build) record/r6-kind-number-unknown-last (current main; may differ from this page's build) record/r6-nonobject-unknown-first (current main; may differ from this page's build) record/r6-nonobject-unknown-last (current main; may differ from this page's build) record/r6-single-unknown-kind-number (current main; may differ from this page's build) record/r6-single-unknown-missing-kind (current main; may differ from this page's build) record/r6-two-envs-unknown-first (current main; may differ from this page's build) record/r6-two-envs-unknown-last (current main; may differ from this page's build) record/r6-unknown-before-kind (current main; may differ from this page's build) record/r6-unknown-field (current main; may differ from this page's build) record/shape-about-before-of (current main; may differ from this page's build) record/shape-about-member-number (current main; may differ from this page's build) record/shape-about-nested (current main; may differ from this page's build) record/shape-about-null (current main; may differ from this page's build) record/shape-about-object (current main; may differ from this page's build) record/shape-about-text (current main; may differ from this page's build) record/shape-emitted-before-occurred (current main; may differ from this page's build) record/shape-emitted-number (current main; may differ from this page's build) record/shape-empty-object (current main; may differ from this page's build) record/shape-empty-sets (current main; may differ from this page's build) record/shape-envelope-before-salt (current main; may differ from this page's build) record/shape-erases-before-of-missing (current main; may differ from this page's build) record/shape-erases-before-sets (current main; may differ from this page's build) record/shape-erases-member-number (current main; may differ from this page's build) record/shape-erases-null (current main; may differ from this page's build) record/shape-erases-text (current main; may differ from this page's build) record/shape-first-variant-decides (current main; may differ from this page's build) record/shape-kind-before-observer-number (current main; may differ from this page's build) record/shape-kind-null (current main; may differ from this page's build) record/shape-kind-number (current main; may differ from this page's build) record/shape-missing-emitted (current main; may differ from this page's build) record/shape-missing-kind (current main; may differ from this page's build) record/shape-missing-kind-before-observer (current main; may differ from this page's build) record/shape-missing-observer (current main; may differ from this page's build) record/shape-not-object-after-written (current main; may differ from this page's build) record/shape-not-object-array (current main; may differ from this page's build) record/shape-not-object-before-kind (current main; may differ from this page's build) record/shape-not-object-before-text (current main; may differ from this page's build) record/shape-not-object-null (current main; may differ from this page's build) record/shape-not-object-number (current main; may differ from this page's build) record/shape-not-object-text (current main; may differ from this page's build) record/shape-observer-array (current main; may differ from this page's build) record/shape-observer-before-emitted (current main; may differ from this page's build) record/shape-observer-number (current main; may differ from this page's build) record/shape-occurred-null (current main; may differ from this page's build) record/shape-occurred-number (current main; may differ from this page's build) record/shape-of-array (current main; may differ from this page's build) record/shape-of-before-prev (current main; may differ from this page's build) record/shape-of-not-missing (current main; may differ from this page's build) record/shape-of-null (current main; may differ from this page's build) record/shape-of-number (current main; may differ from this page's build) record/shape-prev-before-of-missing (current main; may differ from this page's build) record/shape-prev-member-null (current main; may differ from this page's build) record/shape-prev-null (current main; may differ from this page's build) record/shape-prev-text (current main; may differ from this page's build) record/shape-salt-before-member-duplicate (current main; may differ from this page's build) record/shape-salt-before-number (current main; may differ from this page's build) record/shape-salt-missing (current main; may differ from this page's build) record/shape-salt-not-base32 (current main; may differ from this page's build) record/shape-salt-null (current main; may differ from this page's build) record/shape-salt-number (current main; may differ from this page's build) record/shape-sets-before-of-missing (current main; may differ from this page's build) record/shape-sets-empty-name (current main; may differ from this page's build) record/shape-sets-member-null (current main; may differ from this page's build) record/shape-sets-member-number (current main; may differ from this page's build) record/shape-sets-nested (current main; may differ from this page's build) record/shape-sets-null (current main; may differ from this page's build) record/shape-sets-object (current main; may differ from this page's build) record/shape-sets-text (current main; may differ from this page's build) record/shape-text-before-missing-kind (current main; may differ from this page's build) record/shape-under-array (current main; may differ from this page's build) record/shape-under-before-erases (current main; may differ from this page's build) record/shape-under-null (current main; may differ from this page's build) record/shape-under-number (current main; may differ from this page's build)
also naming it: batch/05-large-number-out-of-range (current main; may differ from this page's build) batch/27-of-missing (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

write.member-order

Invariance

Change the order of a written payload's members, and its commitment stays.

laws.md a written payload's commitment doesn't depend on the order of its members: write established the distinct names record.member-order needs

proved by
Written.commit_member_order

Laws.Write

∀ (H : Hash) (w : Written) {kvs kvs' : List (String × Json)}, w.payload = Json.obj kvs → kvs.Perm kvs' → commitOf H w.salt (Json.obj kvs') = Stored.commit H w.stored
pinned by
record/04-member-order (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
record.member-order

In its question

write.overflow

Exactness

A number past binary64's range is refused by the writer's number check as number-out-of-range, and that check speaks last: only when the envelope, the salt and the member names pass.

The number stays a number until that check; no reader refuses it earlier under another name. A spec refuses it where it refuses any number out of range. A reader's own records must hold finite numbers.

laws.md A number past binary64's range is nonfinite, and no nonfinite number is in the writer's range. Under a good envelope and salt the writer refuses it with number-out-of-range. That refusal is the last: it speaks only when the envelope, the salt and the member names pass.

proved by
Number.finite_of_inRange

Laws.Write

∀ {n : Number}, n.inRange = true → n.finite = true
writeProblem_nonfinite

Laws.Write

∀ {env : Env} {salt : List UInt8} {n : Number}, env.problem = none → salt.length = 16 → n.finite = false → writeProblem env salt (Json.number n) = some "number-out-of-range"
writeProblem_range_last

Laws.Write

∀ {env : Env} {salt : List UInt8} {payload : Json}, writeProblem env salt payload = some "number-out-of-range" → env.problem = none ∧ salt.length = 16 ∧ payload.keysDistinct = true ∧ payload.inRange = false
pinned by
11 filesbatch/23-overflow-out-of-range (current main; may differ from this page's build) batch/24-overflow-after-envelope (current main; may differ from this page's build) batch/25-overflow-before-prev (current main; may differ from this page's build) record/d3-kind-first (current main; may differ from this page's build) record/d3-member-duplicate-first (current main; may differ from this page's build) record/d3-overflow (current main; may differ from this page's build) record/d3-overflow-value (current main; may differ from this page's build) record/d3-salt-first (current main; may differ from this page's build) record/d3-shape-first (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)
also naming it: record/d3-overflow-exponent (current main; may differ from this page's build) record/d3-overflow-negative (current main; may differ from this page's build) record/d3-overflow-value-negative (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
tick.canonical

In its question

occurred.span

Exactness

Each accepted point gives its grammar-defined span, alone or open-ended. Two points form an interval when the second starts no earlier. Spans never end before their start.

Which texts are points is the grammar itself, pinned by vectors, not proved.

laws.md Each accepted point gives its grammar-defined span, alone, with .., or paired with a point starting no earlier. A span never ends before its start.

proved by
occurred_point

Laws.Time

∀ {cs : List Char} {a b : Moment}, ¬'/' ∈ cs → point? cs = some (a, b) → ∃ sp, occurredSpanOf cs = some sp ∧ sp.start = a ∧ sp.stop = some b
occurred_open

Laws.Time

∀ {p : List Char} {a a' : Moment}, ¬'/' ∈ p → point? p = some (a, a') → ∃ sp, occurredSpanOf (p ++ ['/', '.', '.']) = some sp ∧ sp.start = a ∧ sp.stop = none
occurred_interval

Laws.Time

∀ {p q : List Char} {a a' b e : Moment}, ¬'/' ∈ p → ¬'/' ∈ q → q ≠ ['.', '.'] → point? p = some (a, a') → point? q = some (b, e) → a ≤ b → ∃ sp, occurredSpanOf (p ++ '/' :: q) = some sp ∧ sp.start = a ∧ sp.stop = some e
point_le

Laws.Time

∀ {cs : List Char} {a b : Moment}, point? cs = some (a, b) → a ≤ b
pinned by
occurred/01-dates (current main; may differ from this page's build) occurred/02-unspecified (current main; may differ from this page's build) occurred/03-qualifiers (current main; may differ from this page's build) occurred/04-instants (current main; may differ from this page's build) occurred/05-intervals (current main; may differ from this page's build) occurred/06-open-end (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

occurred.qualifier

Invariance

Change a qualifier on a date, ?, ~ or %, and the span stays.

Instants take no qualifier.

laws.md a qualifier never changes a span, on a date alone or on either end of an interval

proved by
occurred_qualified

Laws.Time

∀ {cs : List Char} {q : Char}, isQualifier q = true → ¬'/' ∈ cs → ¬'T' ∈ cs → (∀ (c : Char), cs.getLast? = some c → isQualifier c = false) → occurredSpanOf (cs ++ [q]) = occurredSpanOf cs
occurred_qualified_start

Laws.Time

∀ {p r : List Char} {q : Char}, isQualifier q = true → ¬'/' ∈ p → ¬'T' ∈ p → (∀ (c : Char), p.getLast? = some c → isQualifier c = false) → occurredSpanOf (p ++ [q] ++ '/' :: r) = occurredSpanOf (p ++ '/' :: r)
occurred_qualified_end

Laws.Time

∀ {p r : List Char} {q : Char}, isQualifier q = true → ¬'/' ∈ p → r ≠ ['.', '.'] → ¬'T' ∈ r → (∀ (c : Char), r.getLast? = some c → isQualifier c = false) → occurredSpanOf (p ++ '/' :: (r ++ [q])) = occurredSpanOf (p ++ '/' :: r)
pinned by
occurred/03-qualifiers (current main; may differ from this page's build) occurred/05-intervals (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

occurred.moment

Exactness

A parsed moment contains whole seconds and a fraction without trailing zeros. List comparison equals exact decimal comparison.

Holds when the actual instant reader accepts the text and returns the stated moment. The comparison theorem takes two stripped fractions and a scale at least as long as both. Accepted instant fractions already have canonical spelling.

laws.md A parsed moment has whole seconds and digits without trailing zeros. For stripped fractions and a scale covering both, list comparison equals exact decimal comparison.

proved by
instant_canonical

Laws.Time

∀ {cs : List Char} {m : Moment}, instant? cs = some m → m.Canonical
point_canonical

Laws.Time

∀ {cs : List Char} {a b : Moment}, point? cs = some (a, b) → a.Canonical ∧ b.Canonical
moment_lt_iff_scaled

Laws.Time

∀ {n : Nat} {s1 s2 : Int} {f1 f2 : List Int}, Stripped f1 → Stripped f2 → f1.length ≤ n → f2.length ≤ n → (s1 :: f1 < s2 :: f2 ↔ momentScaled n s1 f1 < momentScaled n s2 f2)
pinned by
occurred/04-instants (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

occurred.order

Order

Spans order by start, then end, an open end last, with no ties: any two stores that order by it agree.

laws.md Spans have strict total order by start, then end, with an open end last. Stores using that order agree.

proved by
Span.before_irrefl

Laws.Time

∀ (a : Span), ¬a.Before a
Span.before_trans

Laws.Time

∀ {a b c : Span}, a.Before b → b.Before c → a.Before c
Span.before_total

Laws.Time

∀ (a b : Span), a.Before b ∨ a = b ∨ b.Before a
pinned by
occurred/08-order (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
content order

In its question

occurred.refuse

Exactness

A text the reader doesn't accept is refused with occurred-not-span, never guessed at.

laws.md a text the reader doesn't accept is refused with occurred-not-span, never guessed at

proved by
by construction: no theorem, pinned by vectors
pinned by
occurred/07-refused (current main; may differ from this page's build) record/34-occurred-duration (current main; may differ from this page's build)also naming it: occurred/r4-canonical-refusals (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

Store 2 laws

input.distinct

Exactness

The read path hands each id over once. dedup leaves each id once. Where an id names one record, deduplication keeps the same records.

Only dedup is proved; a fold called directly on a list with repeats counts them.

laws.md The read path hands each id over once. dedup leaves each id once. Where an id names one record, it keeps the same records.

proved by
Distinct.addressed

Laws.Families

∀ {xs : List Record}, Distinct xs → Addressed xs
distinct_dedup

Laws.Families

∀ (xs : List Record), Distinct (dedup xs)
mem_dedup

Laws.Families

∀ {xs : List Record}, Addressed xs → ∀ {r : Record}, r ∈ dedup xs ↔ r ∈ xs
pinned by
(the read path)
carries
by.set heads.whole-view input.union keyed.fold keyed.slice keyed.spec-slice keyed.whole-read keyed.witnessed spec.after-supersession spec.set spec.slice thing.slice

In its question

input.union

Invariance

Change which place is read first, and the union stays.

laws.md the union doesn't depend on which place is read first

proved by
dedup_union

Laws.Families

∀ {xs ys : List Record}, Addressed (xs ++ ys) → (dedup (xs ++ ys)).Perm (dedup (ys ++ xs))
pinned by
(the read path)
rests on
input.distinct

In its question

View 11 laws

view.no-resurrection

Invariance

Change which payloads a reader holds, and the set of heads, by id stays.

Each head comes back in the view's form. A record superseded within a thing is never current there.

laws.md A view keeps each thing's head ids. A record superseded within a thing is never current there. Any map that keeps each record's id, prev and place in content order keeps the heads, each mapped.

proved by
LatestBy.view

Laws.Families

∀ {f : Record → Record}, View f → ∀ {xs : List Record}, Addressed xs → LatestBy.empty.fold (List.map f xs) = { named := (LatestBy.empty.fold xs).named, heads := List.map f (LatestBy.empty.fold xs).heads }
LatestBy.map_fold

Laws.Families

∀ {f : Record → Record}, (∀ (r : Record), (f r).id = r.id) → (∀ (r : Record), (f r).prev = r.prev) → (∀ (a b : Record), Newer (f a) (f b) ↔ Newer a b) → ∀ {xs : List Record}, Addressed xs → LatestBy.empty.fold (List.map f xs) = { named := (LatestBy.empty.fold xs).named, heads := List.map f (LatestBy.empty.fold xs).heads }
LatestBy.view_head_ids

Laws.Families

∀ {f : Record → Record}, View f → ∀ {xs : List Record}, Addressed xs → List.map (fun x => x.id) (LatestBy.empty.fold (List.map f xs)).heads = List.map (fun x => x.id) (LatestBy.empty.fold xs).heads
LatestBy.no_false_resurrection

Laws.Families

∀ {f : Record → Record}, View f → ∀ {xs : List Record}, Addressed xs → ∀ {r q : Record}, q ∈ xs → r.id ∈ q.prev → ∀ (h : Record), h ∈ (LatestBy.empty.fold (List.map f xs)).heads → h.id ≠ r.id
pinned by
fold/view/01-withheld-head-still-supersedes (current main; may differ from this page's build) fold/view/02-erased-head-still-supersedes (current main; may differ from this page's build) fold/view/03-withheld-ancestor (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) 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
carries
result.unread thing.mentions view.no-resurrection (things)

In its questionTry to break it

view.refines

Refinement

Hide payloads and a where answer stays, or becomes unknown.

laws.md a view only loses information: a where answer stays or becomes unknown

proved by
Where.eval_view

Laws.Families

∀ {f : Record → Record}, View f → ∀ (w : Where) (r : Record), (w.eval (f r)).Refines (w.eval r)
pinned by
fold/select/01-payload-test-on-withheld (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

settle.set

Invariance

Change which place holds which form, and what the reader keeps (one record per id) stays.

Holds when the forms of one id agree: the same envelope, and the same payload wherever it is held.

laws.md what a reader keeps depends only on which forms its places hold, one record per id

proved by
settle_eq

Laws.Things

∀ {xs ys : List Record}, Forms xs → (∀ (r : Record), r ∈ xs ↔ r ∈ ys) → settle xs = settle ys
settle_distinct

Laws.Things

∀ (xs : List Record), Distinct (settle xs)
pinned by
realm/01-erased-without-record-is-withheld (current main; may differ from this page's build) realm/02-here-beats-withheld (current main; may differ from this page's build) realm/03-erase-record-sticks (current main; may differ from this page's build)also naming it: realm/09-revision-erases (current main; may differ from this page's build) realm/gap01-id-order (current main; may differ from this page's build) realm/phase2-exact-output (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
keyed.slice keyed.spec-slice spec.slice thing.slice tick.withheld

In its question

settle.keeps

Exactness

A payload any place holds is kept, unless it is erased.

laws.md a payload any place holds is kept unless erased

proved by
settle_keeps

Laws.Things

∀ {xs : List Record} {a : Record}, a ∈ xs → a.shown = Shown.here → erasedIn xs a.id = false → ∃ r, r ∈ settle xs ∧ r.id = a.id ∧ r.shown = Shown.here
pinned by
realm/01-erased-without-record-is-withheld (current main; may differ from this page's build) realm/02-here-beats-withheld (current main; may differ from this page's build)also naming it: realm/gap02-lone-erased (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

settle.erased

Exactness

Once a record naming it in erases is held, every form of its target is erased.

laws.md once a record naming it in erases is held, every form of its target is erased

proved by
settle_erased

Laws.Things

∀ {xs : List Record} {i : RecordId}, erasedIn xs i = true → ∀ {r : Record}, r ∈ settle xs → r.id = i → r.shown = Shown.erased
pinned by
realm/03-erase-record-sticks (current main; may differ from this page's build) realm/09-revision-erases (current main; may differ from this page's build)also naming it: realm/gap10-refused-eraser (current main; may differ from this page's build) realm/gap10-withheld-eraser (current main; may differ from this page's build) scenario/01-decision (current main; may differ from this page's build) scenario/keys-01-settled-setter (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

admit.set

Exactness

A record is refused exactly when it isn't entitled to its prev, and that depends only on the set.

laws.md admission depends only on the set; a record is refused exactly when it isn't entitled to its prev

proved by
admit_same

Laws.Things

∀ (may : Record → Record → Bool) {xs ys : List Record}, (∀ (q : Record), q ∈ xs ↔ q ∈ ys) → ∀ (r : Record), r ∈ admit may xs ↔ r ∈ admit may ys
refusalOf_none

Laws.Things

∀ (may : Record → Record → Bool) (xs : List Record) (r : Record), refusalOf may xs r = none ↔ entitled may xs r = true
pinned by
realm/04-cross-thing-prev-refused (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
spec.set

In its question

admit.no-cross

Exactness

Every held record an admitted record's prev names is of the same thing, and may be replaced by it: prev never crosses things.

A prev naming a record the reader doesn't hold is admitted: the reader can't judge it. A reader checks neither of-missing nor roots: a record with prev and no of is of its own id, so a held target is of another thing. A writer refuses a prev naming a record it doesn't hold (prev-unknown); a reader that lacks it admits the record.

laws.md Each held prev target is of its admitted successor's thing and permits replacement, so prev never crosses things. Readers admit unknown targets because they cannot judge them.

proved by
admit_no_cross

Laws.Things

∀ {may : Record → Record → Bool} {xs : List Record} {r q : Record}, r ∈ admit may xs → q ∈ xs → q.id ∈ r.prev → shares r q = true ∧ may r q = true
admit_same_thing

Laws.Things

∀ {may : Record → Record → Bool} {xs : List Record} {r q : Record}, r ∈ admit may xs → q ∈ xs → q.id ∈ r.prev → q.thing = r.thing
pinned by
realm/04-cross-thing-prev-refused (current main; may differ from this page's build) realm/08-prev-without-of-unrelated (current main; may differ from this page's build) 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)also naming it: realm/gap01-id-order (current main; may differ from this page's build) realm/gap10-refused-eraser (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

admit.late

Limit

Admission isn't monotone in arrival: a record admitted while its prev target is unknown is refused when the target arrives of another thing, and what it superseded is current again. No step from the admitted records' per-thing state can follow that.

A conformant writer never emits such a record (prev-unknown, prev-unrelated). A reader that caches state across arrivals keeps the records such a revision supersedes, not only the heads (heads.late).

laws.md Admission isn't monotone in arrival. A record admitted while its prev target is unknown is refused when the target arrives of another thing, and the records it superseded are current again. No step from the admitted records' per-thing state follows that, so a caching reader keeps what such a revision supersedes.

proved by
perThing_cannot_follow_admit

Laws.Things

¬∃ g, ∀ (xs : List Record) (r : Record), Distinct (xs ++ [r]) → g (perThing (admit (fun x x_1 => true) xs)) r = perThing (admit (fun x x_1 => true) (xs ++ [r]))
pinned by
(arrival, not a set: none)

In its question

admit.grows

Invariance

Change whether a record no held record names in prev is admitted onto the cached state or the whole set readmitted, and every earlier admission, and each thing's state, stepped by the arrival when it is admitted and of that thing stays.

This is the condition admit.late needs: only the arrival of a record some held prev already names can retract an admission.

laws.md When no held record names the arriving record in prev, every earlier admission stands, and each thing's state is the cached one, stepped by the arrival if it is admitted and of that thing.

proved by
admit_append_unnamed

Laws.Things

∀ (may : Record → Record → Bool) {xs : List Record} {r : Record}, (∀ (q : Record), q ∈ xs → ¬r.id ∈ q.prev) → admit may (xs ++ [r]) = admit may xs ++ if entitled may (xs ++ [r]) r = true then [r] else []
stateIn_late_unnamed

Laws.Things

∀ (may : Record → Record → Bool) {xs : List Record} {r : Record} (t : String), (∀ (q : Record), q ∈ xs → ¬r.id ∈ q.prev) → stateIn t (admit may (xs ++ [r])) = if (entitled may (xs ++ [r]) r && r.isOf t) = true then (stateIn t (admit may xs)).step r else stateIn t (admit may xs)
pinned by
(arrival, not a set: none)

In its question

view.no-resurrection

Invariance

Change which payloads a reader holds, and the admitted records and each thing's heads by id stay.

Holds when the store's rule for who may replace whom reads only envelopes. Every record comes back in the view's form; a record superseded in a thing is never current there.

laws.md With an envelope-only admission rule, a view admits the same records and keeps each thing's heads in view form. A superseded record never becomes current within that thing.

proved by
admit_view

Laws.Things

∀ {f : Record → Record}, View f → ∀ {may : Record → Record → Bool}, EnvOnly may → ∀ (xs : List Record), admit may (List.map f xs) = List.map f (admit may xs)
stateIn_view

Laws.Things

∀ {f : Record → Record}, View f → ∀ (t : String) {xs : List Record}, Addressed xs → stateIn t (List.map f xs) = { named := (stateIn t xs).named, heads := List.map f (stateIn t xs).heads }
stateIn_no_false_resurrection

Laws.Things

∀ {f : Record → Record}, View f → ∀ {t : String} {xs : List Record}, Addressed xs → ∀ {r q : Record}, q ∈ xs → q.isOf t = true → r.id ∈ q.prev → ∀ (h : Record), h ∈ (stateIn t (List.map f xs)).heads → h.id ≠ r.id
pinned by
fold/view/01-withheld-head-still-supersedes (current main; may differ from this page's build) fold/view/02-erased-head-still-supersedes (current main; may differ from this page's build) fold/view/03-withheld-ancestor (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) fold/view/gap15-partial-and-anchor (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/01-decision (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
content order view.no-resurrection
carries
spec.after-supersession

In its question

view.refines

Refinement

Under a view, a test and a where map keep their answer, or it becomes unknown.

laws.md under a view a test, and a where map, keeps its answer or becomes unknown

proved by
Cond.eval_view

Laws.Spec

∀ {f : Record → Record}, View f → ∀ (c : Cond) (r : Record), (c.eval (f r)).Refines (c.eval r)
Cond.all_view

Laws.Spec

∀ {f : Record → Record}, View f → ∀ (cs : List Cond) (r : Record), (Cond.all cs (f r)).Refines (Cond.all cs r)
Tri.and_refines

Laws.Spec

∀ {a a' b b' : Tri}, a.Refines a' → b.Refines b' → (a.and b).Refines (a'.and b')
pinned by
spec/run/02-withheld-payload (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

State 75 laws

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 filesfold/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 ys
Latest.perm

Laws.Things

∀ {xs ys : List Record}, Addressed xs → xs.Perm ys → Latest.fold xs = Latest.fold ys
Latest.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).heads
wholeHeads_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 o
Latest.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.erase
payloadFields_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 filespayload/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 - 1
Record.num_number

Laws.Numeric

∀ {r : Record} {field : String} {n : Number}, r.get field = some (HeldField.one (Val.number n)) → r.num field = none
Record.num_hidden

Laws.Numeric

∀ {r : Record} (field : String), r.shown ≠ Shown.here → r.num field = none
Record.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 = s
Max.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 ys
Min.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).length
Acc.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).length
Count.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)))).length
collectOf_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))).length
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
7 filesfold/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 = t
isOf_unique

Laws.Things

∀ {r : Record} {t u : String}, r.isOf t = true → r.isOf u = true → t = u
stateIn_heads_thing

Laws.Things

∀ {xs : List Record}, Addressed xs → ∀ {t : String} {r : Record}, r ∈ (stateIn t xs).heads → r.thing = t
heads_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 ys
perThing_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 filesfold/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 a
keyedIn_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 xs
liveK_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 o
keyedIn_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 xs
convex_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 xs
anchored_of_written

Laws.LiveSlice

∀ {saw : Record → List Record} {W : List Record}, Addressed W → Anchoring saw W → ClosedOver saw W → Anchored W
closed_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.prev
heads_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 = false
closedOver_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 S
anchored_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 S
KeyedPart.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 r
base_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 W
downOf_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 ∈ U
heldOf_down

Laws.Cut

∀ {W P : List Record}, (∀ (r : Record), r ∈ P → r ∈ W) → Down (heldOf W P) W
heldOf_greatest

Laws.Cut

∀ {W P U : List Record}, Down U W → (∀ (r : Record), r ∈ U → r ∈ P) → ∀ (r : Record), r ∈ U → r ∈ heldOf W P
heldOf_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 < T
prefix_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 = true
keyedIn_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 = false
parseOp_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 filesspec/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).isSome
HeldField.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.isSome
Cond.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.isEmpty
Cond.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.span
Cond.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.start
Cond.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.start
Cond.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.no
Cond.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.unknown
Cond.eval_envelope

Laws.Spec

∀ (c : Cond), c.field.onEnvelope = true → ∀ (r : Record), c.eval r ≠ Tri.unknown
pinned by
every spec/run vector
73 filesspec/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 r
Spec.mem_select

Laws.Spec

∀ (sp : Spec) (xs : List Record) (r : Record), r ∈ sp.select xs ↔ r ∈ xs ∧ sp.takes r = true
pinned by
73 filesspec/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 ys
Spec.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 may
keyedValue_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 ev
Slot.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 filesspec/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 ys
wholeHeads_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 r
accPool_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) xs
select_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 i
mem_above

Laws.Live

∀ {rs : List Record} {r q : Record}, q ∈ above rs r ↔ q ∈ rs ∧ ∃ p, p ∈ q.prev ∧ Reach rs [r.id] p
above_congr

Laws.Live

∀ {rs rs' : List Record}, (∀ (q : Record), q ∈ rs ↔ q ∈ rs') → ∀ (r q : Record), q ∈ above rs r ↔ q ∈ above rs' r
liveFor_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 = false
liveEnv_iff

Laws.Live

∀ {rs : List Record} {r : Record}, liveEnv rs r = true ↔ ¬∃ q, q ∈ rs ∧ r.id ∈ q.prev
live_iff

Laws.Live

∀ {rs : List Record} {r : Record}, live rs r = true ↔ liveEnv rs r = true ∨ ∃ k, liveFor rs k r = true
mem_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 = true
head_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 filesscenario/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.declares
keyedIn_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 = true
keyedIn_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 = true
keyedIn_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).whole
keyedIn_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).heads
keyedIn_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 ys
keyedOf_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 filesspec/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.yes
thingEv_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.no
keyedValue_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).Nodup
soleSetter_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 = none
soleSetter_unset

Laws.KeyedSlots

∀ {xs : List Record} {f t : String}, setters (recordsOf t xs) f = [] → soleSetter xs f t = none
Acc.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).length
keyedValue_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) = p
keyedValue_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) = p
keyedValue_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 q
wholeThings_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 rs
wholeThings_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 q
wholeThings_distinct

Laws.KeyedSlots

∀ {l : Option Nat} {rs : List Record}, (List.map Record.thing rs).Nodup → wholeThings l rs = limitTo l rs
pinned by
7 filesspec/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 none
By.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 = none
By.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 m
By.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 filesspec/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 xs
keyedValue_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 xs
Acc.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 e
whole_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 t
whole_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.no
whole_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).view
keyedOf_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)).length
Cond.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 = a
Cond.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.unknown
Cond.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.unknown
Cond.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 filesscenario/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 ys
Slot.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 ys
groupKeys_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 ys
Slot.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).length
By.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).length
By.keys_single

Laws.By

∀ {b : By}, b.Single → ∀ (r : Record), ((b.keys r).getD []).length ≤ 1
By.OneKey.of_single

Laws.By

∀ {b : By}, b.Single → ∀ (ev : Record → Tri) (pool : List Record), b.OneKey ev pool
groupKeys_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 = true
HeldField.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.unread
By.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.unread
By.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) = p
collectOf_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) = p
Spec.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) may
followed_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) may
Spec.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) may
Slot.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 xs
keyedValue_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 evx
Covers.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 t
covers_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 W
keyed_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.Fits
Spec.ofJson_toJson

Laws.Parse

∀ {sp : Spec}, sp.Fits → Spec.ofJson sp.toJson = Except.ok sp
Spec.reparse

Laws.Parse

∀ {j : Json} {sp : Spec}, Spec.ofJson j = Except.ok sp → Spec.ofJson sp.toJson = Except.ok sp
Spec.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" p
Json.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 filesspec/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).heads
window_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.text
specPreimageOf_eq_iff

Laws.SpecHash

∀ {v w : Rules} {j k : Json}, specPreimageOf v j = specPreimageOf w k ↔ v = w ∧ j.canon = k.canon
Spec.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 b
Spec.memberEq_preimage

Laws.SpecHash

∀ {a b : Spec}, a.Fits → b.Fits → a.MemberEq b → ∀ (v : Rules), specPreimageOf v a.toJson = specPreimageOf v b.toJson
Spec.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 b
Spec.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 filestick/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 = true
readTickMembers_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.wireValue
Written.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).canon
readTickPayload_text

Laws.TickRead

∀ {H : Hash} {current : Rules} {j : Json} {p : TickPayload}, readTickPayload H current j = Except.ok p → j.canon = (p.toJson H).canon
readResult_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 filestick/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.same
checkTick_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.same
checkTick_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 i
intOf?_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.unshown
Slot.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 = b
Json.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 = Y
utf8_injective

Laws.Result

∀ {a b : String}, utf8 a = utf8 b → a = b
pinned by
23 filesresult/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.canon
Json.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 filesresult/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

Tick no laws yet

Nothing is built here yet, so nothing is proved.

Text 9 laws

lens.escaping

Round trip

Any body survives rendering and parsing, backslashes and all.

Holds when the section id is nonempty.

laws.md any body survives when its section id is nonempty; reading removes only an escape backslash

proved by
Lens.escaping

Laws.Lens

∀ (id : Lens.Line) (body : List Lens.Line), id ≠ [] → Lens.parse (Lens.render [{ id := id, body := body }]) = some [{ id := id, body := body }]
Lens.unescape_keeps

Laws.Lens

∀ (l : Lens.Line), Lens.unescape l = l ∨ l = '\\' :: Lens.unescape l ∧ Lens.reserved (Lens.unescape l) = true
pinned by
lens/section/02-escaping (current main; may differ from this page's build) lens/section/10-backslash-kept (current main; may differ from this page's build)also naming it: lens/section/gap17-escaping (current main; may differ from this page's build) lens/section/gap17-raw-backslash (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
lens.round-trip

In its question

lens.round-trip

Round trip

Render, then parse, and you get back what you rendered.

Holds when section ids are nonempty and distinct.

laws.md rendering roundtrips exactly when section ids are nonempty and distinct

proved by
Lens.parse_render

Laws.Lens

∀ (d : List Lens.Section), Lens.Valid d → Lens.parse (Lens.render d) = some d
Lens.parse_render_iff

Laws.Lens

∀ (d : List Lens.Section), Lens.parse (Lens.render d) = some d ↔ Lens.Valid d
pinned by
lens/section/01-round-trip (current main; may differ from this page's build)also naming it: lens/section/gap11-embedded-newline (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
lens.refuse
carries
lens.escaping lens.no-op normal form

In its questionTry to break it

lens.no-op

Round trip

Parse an unedited render and there is nothing to apply.

Holds when section ids are nonempty and distinct.

laws.md the unedited render gives no outcomes when section ids are nonempty and distinct

proved by
Lens.no_op

Laws.Lens

∀ {base : List Lens.Section}, Lens.Valid base → Lens.edit base (Lens.render base) = some []
pinned by
lens/section/03-no-op (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
lens.round-trip

In its questionWithout its premise

lens.put-get

Round trip

An edit that keeps exactly the base's sections, in the same order, applies exactly.

Holds when the base's section ids are distinct.

laws.md With distinct base ids, an edit keeping exactly the base's sections in the same order applies exactly, up to normal form.

proved by
Lens.put_get

Laws.Lens

∀ {base edited : List Lens.Section}, (Lens.ids base).Nodup → Lens.ids edited = Lens.ids base → Lens.apply base (Lens.diff base edited) = edited
Lens.put_get_text

Laws.Lens

∀ {base edited : List Lens.Section} {text : List Lens.Line}, (Lens.ids base).Nodup → Lens.parse text = some edited → Lens.ids edited = Lens.ids base → Option.map (fun os => Lens.render (Lens.apply base os)) (Lens.edit base text) = Lens.normalize text
pinned by
lens/section/04-edit-body (current main; may differ from this page's build) lens/section/10-backslash-kept (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
carries
lens.base-distinct

In its questionWithout its premise

lens.nothing-dropped

Exactness

Every section is unchanged, accepted or reported; every dropped one is reported.

laws.md every section is unchanged, accepted or reported; every dropped one is reported

proved by
Lens.nothing_dropped

Laws.Lens

∀ {base edited : List Lens.Section} {e : Lens.Section}, e ∈ edited → Lens.lookup e.id base = some e.body ∨ Lens.Outcome.accepted e.id e.body ∈ Lens.diff base edited ∨ Lens.Outcome.unknown e.id ∈ Lens.diff base edited
Lens.absence_reported

Laws.Lens

∀ {base edited : List Lens.Section} {s : Lens.Section}, s ∈ base → ¬s.id ∈ Lens.ids edited → Lens.Outcome.absent s.id ∈ Lens.diff base edited
pinned by
lens/section/05-unknown-section (current main; may differ from this page's build) lens/section/06-dropped-section (current main; may differ from this page's build)also naming it: lens/section/gap18-reorder-unknown-absent (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation

In its question

lens.absence-not-edit

Invariance

Change the text by dropping a section, and that section of the state stays.

Absence is never an edit; the other sections' accepted edits still apply.

laws.md a dropped section leaves that section in the state as it was; the other sections' accepted edits still apply

proved by
Lens.absence_not_edit

Laws.Lens

∀ (base : List Lens.Section) (id : Lens.Line), Lens.apply base [Lens.Outcome.absent id] = base
pinned by
lens/section/06-dropped-section (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

normal form

Invariance

Change whether text that is already normal is normalized again, and the text stays.

laws.md normalizing twice is normalizing once

proved by
Lens.normalize_idem

Laws.Lens

∀ {text out : List Lens.Line}, Lens.normalize text = some out → Lens.normalize out = some out
pinned by
every lens vector
rests on
lens.refuse lens.round-trip

In its question

lens.refuse

Exactness

Malformed text, empty section ids and repeated section ids are refused.

laws.md malformed text, empty section ids and repeated section ids are refused

proved by
Lens.parse_valid

Laws.Lens

∀ {text : List Lens.Line} {d : List Lens.Section}, Lens.parse text = some d → Lens.Valid d
pinned by
lens/section/07-unclosed (current main; may differ from this page's build) lens/section/08-fence-in-body (current main; may differ from this page's build) lens/section/09-text-outside (current main; may differ from this page's build)also naming it: lens/section/d1-duplicate-base-before-text (current main; may differ from this page's build) lens/section/gap17-duplicate-id (current main; may differ from this page's build) lens/section/gap17-empty-id (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
carries
lens.round-trip normal form

In its question

lens.base-distinct

Exactness

A base that repeats a section id is refused with base-id-duplicate, before the text is read and whatever the text says.

This is the public reader, read. What it accepts is the raw edit over distinct base ids, so lens.put-get then needs no promise about the base from the caller. The raw lookup still takes the first section with an id, unchecked.

laws.md The public reader refuses a base that repeats an id with base-id-duplicate, before it reads the text and whatever the text says. What it accepts is the raw edit over distinct base ids, so put-get needs no promise about the base from the caller.

proved by
Lens.baseProblem_none

Laws.Lens

∀ (base : List Lens.Section), Lens.baseProblem base = none ↔ (Lens.ids base).Nodup
Lens.read_base_first

Laws.Lens

∀ {base : List Lens.Section}, ¬(Lens.ids base).Nodup → ∀ (text : List Lens.Line), Lens.read base text = Except.error "base-id-duplicate"
Lens.read_ok

Laws.Lens

∀ {base : List Lens.Section} {text : List Lens.Line} {r : Option (List Lens.Outcome)}, Lens.read base text = Except.ok r → (Lens.ids base).Nodup ∧ r = Lens.edit base text
Lens.read_put_get

Laws.Lens

∀ {base edited : List Lens.Section} {text : List Lens.Line} {r : Option (List Lens.Outcome)}, Lens.read base text = Except.ok r → Lens.parse text = some edited → Lens.ids edited = Lens.ids base → Option.map (fun os => Lens.render (Lens.apply base os)) r = Lens.normalize text
pinned by
lens/section/d1-duplicate-base-apart (current main; may differ from this page's build) lens/section/d1-duplicate-base-before-text (current main; may differ from this page's build) lens/section/d1-duplicate-base-empty-text (current main; may differ from this page's build) lens/section/d1-duplicate-base-id (current main; may differ from this page's build) lens/section/d1-duplicate-base-unedited (current main; may differ from this page's build)
run by
the model, the JS implementation, the Rust implementation
rests on
lens.put-get

In its question