Documentation

Complexitylib.Classes.Randomized.Hashing.Defs

Pairwise-independent hashing -- definitions #

This module gives the exact finite interface used by Stockmeyer-style approximate counting. A seed selects a fixed-width hash function. Each input is uniformly distributed over the range, and the outputs on two distinct inputs are jointly uniform.

structure Complexity.PairwiseIndependentHash (domainWidth rangeWidth seedWidth : ) :

A fixed-width family of exactly pairwise-independent hash functions, represented by a uniformly random bit-string seed.

  • eval : BitString seedWidthBitString domainWidthBitString rangeWidth

    Evaluate the seeded hash function on one domain element.

  • uniform (input : BitString domainWidth) (output : BitString rangeWidth) : eventProb {seed : Fin seedWidthBool | self.eval seed input = output} = 1 / 2 ^ rangeWidth

    Every fixed input hashes uniformly to every fixed range element.

  • pairwise {first second : BitString domainWidth} : first second∀ (firstOutput secondOutput : BitString rangeWidth), eventProb {seed : Fin seedWidthBool | self.eval seed first = firstOutput self.eval seed second = secondOutput} = 1 / 2 ^ (2 * rangeWidth)

    Two distinct inputs have jointly uniform hash outputs.

Instances For
    def Complexity.PairwiseIndependentHash.cell {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) (seed : BitString seedWidth) :
    Finset (BitString domainWidth)

    Members of set that a seeded hash maps to one target cell.

    Equations
    • hash.cell set target seed = {inputset | hash.eval seed input = target}
    Instances For
      def Complexity.PairwiseIndependentHash.cellSize {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) (seed : BitString seedWidth) :

      Number of set members in one seeded target cell.

      Equations
      Instances For
        def Complexity.PairwiseIndependentHash.averageCellSize {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :

        Uniform rational average of the target-cell size over every seed.

        Equations
        Instances For
          def Complexity.PairwiseIndependentHash.orderedPairCellSize {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) (seed : BitString seedWidth) :

          Number of ordered pairs of distinct set members that land in the same seeded target cell.

          Equations
          Instances For
            def Complexity.PairwiseIndependentHash.averageOrderedPairCellSize {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :

            Uniform rational average of the ordered distinct-pair count in one target cell.

            Equations
            Instances For
              def Complexity.PairwiseIndependentHash.averageCellSizeSquare {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :

              Uniform rational average of the squared target-cell size.

              Equations
              Instances For
                def Complexity.PairwiseIndependentHash.cellSizeVariance {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :

                Variance of the target-cell size over a uniform hash seed.

                Equations
                Instances For
                  def Complexity.PairwiseIndependentHash.deviationEvent {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) (radius : ) :
                  Finset (BitString seedWidth)

                  Seeds whose target-cell size deviates from its mean by at least radius.

                  Equations
                  Instances For
                    def Complexity.PairwiseIndependentHash.nonemptyCellEvent {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :
                    Finset (BitString seedWidth)

                    Seeds whose target hash cell is nonempty. This is the event tested by the NP oracle in Stockmeyer counting.

                    Equations
                    Instances For
                      def Complexity.PairwiseIndependentHash.emptyCellEvent {domainWidth rangeWidth seedWidth : } (hash : PairwiseIndependentHash domainWidth rangeWidth seedWidth) (set : Finset (BitString domainWidth)) (target : BitString rangeWidth) :
                      Finset (BitString seedWidth)

                      Seeds whose target hash cell is empty.

                      Equations
                      Instances For