Documentation

Complexity.Algorithms.WordRAM.FusionTree.Parameters

Concrete fusion-node preprocessing parameters #

Static preprocessing chooses collision-free shifts and three half-word multiplier digits. All other stored constants are explicit arithmetic expressions in these witnesses and the stored keys. The choices have no preprocessing-time certificate. Arithmetic compression agrees with perfect-sketch comparisons on all inputs; full-key query correction and the complete fusion-tree query remain separate.

Main definitions #

Main results #

References #

Number of selected source positions.

Instances For

    Source positions enumerated in increasing significance order.

    Instances For
      theorem Cslib.Algorithms.WordRAM.FusionTree.sourcePositions_list {n : ℕ} (w : ℕ) (keys : Fin n → ℕ) :
      List.ofFn ⇑(sourcePositions w keys) = (Lean.FusionTree.relevantBits w keys).sort fun (x1 x2 : ℕ) => x1 ≤ x2

      The source-position list is exactly the list defining the perfect sketch.

      Explicit compression witnesses. Correctness and word bounds below are derived from the collision, ordering and span properties supplied by the constructive shift theorem.

      Instances For
        @[reducible, inline]

        Selected-bit count, at most one per adjacent pair.

        Instances For

          Compressed payload width.

          Instances For

            Input position mask.

            Instances For

              Full multiplier, represented in storage by three digits.

              Instances For

                Retained output mask.

                Instances For

                  Arithmetic compressed sketch, for any natural input.

                  Instances For

                    Stored sketches, extended by the sketch of zero outside the node.

                    Instances For

                      Query replication multiplier.

                      Instances For

                        Guarded original sketches.

                        Instances For

                          Guarded complemented sketches.

                          Instances For

                            Guard mask for packed comparisons.

                            Instances For

                              Divisor selecting the middle count digit.

                              Instances For

                                Packed-field radix, distinct from the half-word multiplication radix.

                                Instances For

                                  Largest compressed payload.

                                  Instances For
                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.D_lt {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) :
                                    p.D < 2 ^ p.b
                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.M_lt {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) :
                                    p.M < 2 ^ (w + p.b)

                                    The entire multiplier may exceed one word but fits in w + b bits.

                                    The arithmetic sketch and the perfect sketch compare identically for all inputs, including inputs outside the stored key set and outside the physical word range.

                                    Weak comparisons agree too, including equality queries.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.strictMono_compressed {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) :
                                    StrictMono fun (i : Fin n) => p.compressed (keys i)

                                    The concrete stored arithmetic sketches remain strictly increasing.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.packed_width {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) :
                                    2 * ((p.b + 1) * n) ≤ w

                                    Capacity supplies the full packed-count multiplication bound.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.window {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hn : 0 < n) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) :
                                    p.b + (w - 2 * (w / 2)) ≤ w / 2

                                    Capacity also supplies the odd-width-aware half-word extraction bound.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.C_fit {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) :
                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.count_lt_radix {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) :
                                    n < 2 ^ (p.b + 1)

                                    Distinct perfect sketches give a numerical bound on the number of stored keys.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.count_fit {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hn : 0 < n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) :

                                    In particular the separately stored occupancy is a physical word.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.upperRank_eq {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hn : 0 < n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (q : ℕ) :

                                    The inclusive arithmetic rank counts perfect sketches at or below every query. This is a sketch rank, not the predecessor rank of the original keys.

                                    theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.lowerRank_eq {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hn : 0 < n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (q : ℕ) :
                                    n - countGuards p.b n p.sketches (p.compressed q) = {i ∈ Finset.range n | BitString.sketch (Lean.FusionTree.relevantBits w keys) (if hi : i < n then keys ⟨i, hi⟩ else 0) < BitString.sketch (Lean.FusionTree.relevantBits w keys) q}.card

                                    Strict arithmetic rank agrees with the perfect-sketch strict rank for every query, including zero and queries with the same sketch as a stored key.

                                    Slot order: input mask, three multiplier digits, retained mask, copies, complemented packed sketches, original packed sketches, guards, payload width, middle divisor, field radix, maximum payload, odd-width offset, selected-bit count. The node tag, occupancy and minimum belong to the separate three-word header.

                                    Instances For
                                      theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.words_fit {w n : ℕ} {keys : Fin n → ℕ} (p : NodeParameters w keys) (hn : 2 ≤ n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) (i : Fin 15) :

                                      Every actual stored parameter is a physical word. The full multiplier is stored only as three digits, because its unbounded numeric value may exceed a physical word.

                                      theorem Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.exists_parameters {w n : ℕ} {keys : Fin n → ℕ} (hn : 2 ≤ n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) :

                                      Real preprocessing witnesses exist; no correctness or timing oracle is assumed.

                                      noncomputable def Cslib.Algorithms.WordRAM.FusionTree.NodeParameters.choose {w n : ℕ} {keys : Fin n → ℕ} (hn : 2 ≤ n) (hsorted : StrictMono keys) (hbound : ∀ (i : Fin n), keys i < 2 ^ w) (hnB : n ≤ Lean.FusionTree.branching w) (hw : 9 ≤ Nat.log 2 w) :

                                      Static preprocessing explicitly uses classical choice; no preprocessing-time bound.

                                      Instances For