OAI/Combinatorics/EditApproximation/Binary/BinaryMemo.lean
11 declarations, 0 contain sorry, 0 declared as axioms
A finite binary dictionary for gathered and globally memoized inputs. Each recursive step reads one key bit and touches one node. The explicit counters charge pointer/node operations; multiword key/value processing is accounted for separately by their bit lengths.
- theorem
OAI.EditApproximation.BinaryMemo.lookup_insert_sameline 30 - theorem
OAI.EditApproximation.BinaryMemo.lookup_insert_otherline 36 - theorem
OAI.EditApproximation.BinaryMemo.lookup_emptyline 53 - def
OAI.EditApproximation.BinaryMemo.nodesline 58 - theorem
OAI.EditApproximation.BinaryMemo.child_nodesline 62 - theorem
OAI.EditApproximation.BinaryMemo.insert_nodesline 66 - theorem
OAI.EditApproximation.BinaryMemo.lookupCosted_specline 87Source documentation
An instrumented lookup returns exactly the ordinary dictionary answer, charging one node visit per consumed bit and one terminal visit.
theorem lookupCosted_spec (tree : BinaryMemo α) (key : List Bool) : tree.lookupCosted key = (tree.lookup key, key.length + 1) := by …Mentions: OAI.EditApproximation.BinaryMemo
- theorem
OAI.EditApproximation.BinaryMemo.insertCosted_specline 97Source documentation
Persistent insertion allocates one new node at each visited level; the two untouched subtrees are retained by pointer.
theorem insertCosted_spec (tree : BinaryMemo α) (key : List Bool) (a : α) : tree.insertCosted key a = (tree.insert key a, key.length + 1) := by …Mentions: OAI.EditApproximation.BinaryMemo
- theorem
OAI.EditApproximation.binaryMemoKey_lengthline 109Source documentation
Fixed-width, least-significant-bit first encoding; no allocation proportional to the numerical magnitude of a key is required.
@[simp] theorem binaryMemoKey_length (d n : ℕ) : (binaryMemoKey d n).length = d := by …
Mentions: OAI.EditApproximation.binaryMemoKey
- theorem
OAI.EditApproximation.binaryMemoKey_injectiveline 114 - theorem
OAI.EditApproximation.binaryMemo_lookup_insertline 133