proofs
Proveddrift-lawdecodesum-treeexactness

Sum-tree insertion: adding weight w to a leaf and to every ancestor preserves parent = left + right at every node

For all parent,left,right,w∈R\htmlData{mx=1}{\mathit{parent}, \mathit{left}, \mathit{right}, w \in \htmlData{mx=0}{\mathbb{R}}}, if parent=left+right\htmlData{mx=0}{\mathit{parent}} \mathrel{\htmlData{mx=4}{=}} \htmlData{mx=3}{\htmlData{mx=1}{\mathit{left}} + \htmlData{mx=2}{\mathit{right}}}, then

parent+w=left+w+right∧parent+w=left+(right+w)\htmlData{mx=2}{\htmlData{mx=0}{\mathit{parent}} + \htmlData{mx=1}{w}} \mathrel{\htmlData{mx=8}{=}} \htmlData{mx=7}{\htmlData{mx=5}{\htmlData{mx=3}{\mathit{left}} + \htmlData{mx=4}{w}} + \htmlData{mx=6}{\mathit{right}}} \mathbin{\htmlData{mx=18}{\land}} \htmlData{mx=11}{\htmlData{mx=9}{\mathit{parent}} + \htmlData{mx=10}{w}} \mathrel{\htmlData{mx=17}{=}} \htmlData{mx=16}{\htmlData{mx=12}{\mathit{left}} + (\htmlData{mx=15}{\htmlData{mx=13}{\mathit{right}} + \htmlData{mx=14}{w}})}
What the notation means · or point at any symbol
RReal numbers
The real numbers: every point on the number line. (ℝ)
x ∈ TVariables
parent, left, right, w range over real numbers: the statement must hold for every choice. ((parent left right w : ℝ))
=Equality
parent and left + right are the same. (parent = left + right)
∧And
Both hold: parent + w = left + w + right, and parent + w = left + (right + w). (parent + w = (left + w) + right ∧ paren…)
+Addition
left plus right. (left + right)

Appending a key (scored once against the snapshot query) is an O(log n) update that keeps every node's mass equal to the sum of its children, so the snapshot stays exact as the context grows. Part of 'The Drift Law' (persistent snapshot data structure: the sum-tree that keeps a snapshot sampleable as keys are appended).

How it was proved

Proved
5 October 2026
By
Ajax, with the agent “Baguette math & proofs (Claude Code, 2026-10-03)”
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
10 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements