Documentation

Complexity.Algorithms.WordRAM.FusionTree.LowerRank

Strict packed sketch ranks #

The zero-bit branch of arbitrary-query correction requires a strict rank. Subtracting the number of sketches at least the query from the node occupancy handles equality and zero queries directly.

Main definitions #

Main results #

References #

@[reducible, inline]

The input register layout agrees with RankProgram, except register seven is occupancy and register one contains the original sketches rather than their complements.

Instances For
    @[reducible, inline]

    Packed guarded sketches.

    Instances For
      @[reducible, inline]

      Replication multiplier.

      Instances For
        @[reducible, inline]

        Mask of field guards.

        Instances For
          @[reducible, inline]

          Payload width.

          Instances For
            @[reducible, inline]

            Middle digit divisor.

            Instances For
              @[reducible, inline]

              Field radix.

              Instances For
                @[reducible, inline]

                Number of stored sketches.

                Instances For
                  @[reducible, inline]

                  Scratch for the replicated query.

                  Instances For
                    @[reducible, inline]

                    Final strict rank.

                    Instances For

                      Count guards for q ≤ sᵢ, then subtract the count from the occupancy.

                      Instances For

                        Exact state after all eight instructions.

                        Instances For
                          theorem Cslib.Algorithms.WordRAM.FusionTree.LowerRankProgram.countGuards_complement {b n q : ℕ} (s : ℕ → ℕ) (hn : 0 < n) (hb : n < 2 ^ (b + 1)) (hs : ∀ i < n, s i < 2 ^ b) (hq : q < 2 ^ b) :
                          n - countGuards b n s q = {i ∈ Finset.range n | s i < q}.card
                          theorem Cslib.Algorithms.WordRAM.FusionTree.LowerRankProgram.exec {w b n q : ℕ} (s : ℕ → ℕ) (x : WordRAM.Data 10) (hn : 0 < n) (hb : n < 2 ^ (b + 1)) (hs : ∀ i < n, s i < 2 ^ b) (hq : q < 2 ^ b) (hw : 2 * ((b + 1) * n) ≤ w) (hxq : x.regs query = q) (hxn : x.regs node = packedNode b n s) (hxc : x.regs copies = queryMultiplier b n) (hxg : x.regs guards = guardMask b n) (hxb : x.regs bits = b) (hxm : x.regs middle = 2 ^ ((b + 1) * (n - 1))) (hxr : x.regs base = 2 ^ (b + 1)) (hxn' : x.regs count = n) :
                          WordRAM.Exec w code x (result x b n s q) 8 ∧ (result x b n s q).regs out = {i ∈ Finset.range n | s i < q}.card ∧ (result x b n s q).mem = x.mem

                          Eight checked instructions return the strict rank, including zero and equality queries. The node parameters and memory are preserved; query compression and constant loading are separate. The full guard-count product fits under the stated packed-width bound.