Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.CuckooHashing.HashFamily

Regime-switched Word-RAM cuckoo hash family #

This module realizes a cuckoo hash pair by two Word-RAM hash blocks. Below doubleTabThreshold c_exp, each block uses (2 * maxEvictions n_max + 2)-wise independent trinomial polynomial hashing. At or above the threshold it uses Mikkel Thorup's double tabulation [Tho13]. The pure table and replay semantics and generic IsCuckooHashPair contract are imported from CslibFrontier.DataStructure.Dictionary.CuckooHashing.HashFamily.

The bridge CslibFrontier.DataStructure.Dictionary.WordRAM.CuckooHashing.Analysis proves isCuckooHashPair_provableFamily: the resulting family satisfies that contract with C_walk = 3 and C_reh = 4 for every n_max : ℕ, whenever U ≤ max n_max 4 ^ c_exp and 32 * max n_max 4 ≤ 2 ^ M. The oblivious dictionary sequence model and constants are unchanged.

Main definitions #

Main results #

References #

Regime-switched seed space and evaluation #

Regime-indexed seed space for a single regime-switched hash block (h₁ or h₂):

  • When reg = true (n_max < doubleTabThreshold c_exp), a (2 * maxEvictions n_max + 2)-wise independent trinomial polynomial seed Fin (cuckooK n_max) → Fin (2 ^ trinomialDeg U M).
  • When reg = false (doubleTabThreshold c_exp ≤ n_max), a double-tabulation seed pair DoubleTabTopSeed c d b × DoubleTabBotSeed d b M with c = DoubleTabulation.provableC c_exp, d = DoubleTabulation.provableD c_exp, and b = DoubleTabulation.provableB n_max.
Instances For
    @[reducible, inline]

    Seed type for a single regime-switched hash block (h₁ or h₂).

    @[instance_reducible]
    @[instance_reducible]
    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalSingleAux (reg : Bool) (c_exp n_max U M : ℕ) :
    SingleSeedAux reg c_exp n_max U M → Fin U → Fin (2 ^ M)

    Regime-indexed deterministic evaluation of a single hash block (h₁ or h₂).

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalSingle (c_exp n_max U M : ℕ) :
    SingleSeed c_exp n_max U M → Fin U → Fin (2 ^ M)

    Deterministic evaluation of a single regime-switched hash block (h₁ or h₂).

    @[reducible, inline]

    Regime-indexed seed space for the unconditional cuckoo hash pair (h₁, h₂).

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash1Aux (reg : Bool) (c_exp n_max U M : ℕ) :
    SeedAux reg c_exp n_max U M → Fin U → Fin (2 ^ M)

    Regime-indexed first cuckoo hash function.

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash2Aux (reg : Bool) (c_exp n_max U M : ℕ) :
    SeedAux reg c_exp n_max U M → Fin U → Fin (2 ^ M)

    Regime-indexed second cuckoo hash function.

    @[reducible, inline]

    Seed space for the regime-switched cuckoo hash pair (trinomialPolyHash below doubleTabThreshold c_exp, doubleTabHash at or above doubleTabThreshold c_exp).

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.seedLaw (c_exp n_max U M : ℕ) :
    PMF (Seed c_exp n_max U M)

    Uniform seed distribution over Seed c_exp n_max U M.

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash1 {c_exp n_max U M : ℕ} :
    Seed c_exp n_max U M → Fin U → Fin (2 ^ M)

    First cuckoo hash function h₁(u) of the regime-switched cuckoo hash pair.

    noncomputable def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash2 {c_exp n_max U M : ℕ} :
    Seed c_exp n_max U M → Fin U → Fin (2 ^ M)

    Second cuckoo hash function h₂(u) of the regime-switched cuckoo hash pair.

    @[reducible, inline]

    Specialization of IsCuckooHashPair to the regime-switched cuckoo hash pair (evalHash1, evalHash2) over seedLaw c_exp n_max U M. Proved unconditionally for every n_max : ℕ (C_walk = 3, C_reh = 4) whenever U ≤ max n_max 4 ^ c_exp and 32 * max n_max 4 ≤ 2 ^ M via Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.isCuckooHashPair_provableFamily.

    Two-block Word-RAM hash pair representation and programs #

    Word-RAM memory footprint of a single regime-switched hash instance (h₁ or h₂).

    Word-RAM memory footprint of the two-block hash pair (h₁, h₂) at hashBase: singleHashSpace c_exp n_max words at hashBase for h₁ followed by singleHashSpace c_exp n_max words at hash2Base hashBase c_exp n_max for h₂.

    Base address of the second hash instance h₂.

    Constant upper bound 24 * doubleTabMinB c_exp + 26 on cuckooK n_max throughout the small regime n_max < doubleTabThreshold c_exp.

    Explicit O_{c_exp}(1) linear-space factor for hashPairSpace c_exp n_max.

    All-n_max linear space bound for hashPairSpace (O_{c_exp}(n_max + 1)).

    Regime-indexed deterministic table representation for a single hash block at base.

    Deterministic table representation for a single hash block at base.

    Deterministic table representation invariant for the two-block hash pair at hashBase.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.SingleSeedRepAux (reg : Bool) (base c_exp n_max U M : ℕ) :
    SingleSeedAux reg c_exp n_max U M → (ℕ → ℕ) → Prop

    Regime-indexed seed representation for a single hash block at base.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.SingleSeedRep (base c_exp n_max U M : ℕ) (θ : SingleSeed c_exp n_max U M) (mem : ℕ → ℕ) :

    Seed representation for a single regime-switched hash block at base.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSingleSeedAux (reg : Bool) (base c_exp n_max U M : ℕ) (mem : ℕ → ℕ) :
    SingleSeedAux reg c_exp n_max U M

    Regime-indexed seed extraction for a single hash block at base.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSingleSeed (base c_exp n_max U M : ℕ) (mem : ℕ → ℕ) :
    SingleSeed c_exp n_max U M

    Extract the seed of a single regime-switched hash block at base.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairSeedRepAux (reg : Bool) (hashBase c_exp n_max U M : ℕ) (θ : SeedAux reg c_exp n_max U M) (mem : ℕ → ℕ) :

    Regime-indexed seed representation for the two-block hash pair at hashBase.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairSeedRep (hashBase c_exp n_max U M : ℕ) (θ : Seed c_exp n_max U M) (mem : ℕ → ℕ) :

    Seed representation invariant for θ : Seed c_exp n_max U M at hashBase.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairRep (hashBase c_exp n_max U M : ℕ) (θ : Seed c_exp n_max U M) (mem : ℕ → ℕ) :

    Full representation invariant for the hash pair (h₁, h₂) at hashBase.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSeedAux (reg : Bool) (hashBase c_exp n_max U M : ℕ) (mem : ℕ → ℕ) :
    SeedAux reg c_exp n_max U M

    Regime-indexed seed extraction from memory at hashBase.

    def Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSeed (hashBase c_exp n_max U M : ℕ) (mem : ℕ → ℕ) :
    Seed c_exp n_max U M

    Extract the full cuckoo hash seed Seed c_exp n_max U M from memory at hashBase.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSingleSeed_eq_of_SingleSeedRep {base c_exp n_max U M : ℕ} {θ : SingleSeed c_exp n_max U M} {mem : ℕ → ℕ} (hseed : SingleSeedRep base c_exp n_max U M θ mem) :
    extractSingleSeed base c_exp n_max U M mem = θ
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSeed_eq_of_HashPairSeedRep {hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} {mem : ℕ → ℕ} (hseed : HashPairSeedRep hashBase c_exp n_max U M θ mem) :
    extractSeed hashBase c_exp n_max U M mem = θ
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.SingleTableRep.congr_of_footprint {base c_exp n_max U M : ℕ} {mem mem' : ℕ → ℕ} (htab : SingleTableRep base c_exp n_max U M mem) (hm : ∀ (a : ℕ), base ≤ a → a < base + singleHashSpace c_exp n_max → mem' a = mem a) :
    SingleTableRep base c_exp n_max U M mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.SingleTableRep.of_copy_from_hashBase {hashBase c_exp n_max U M : ℕ} {mem : ℕ → ℕ} (htab : SingleTableRep hashBase c_exp n_max U M mem) (hcopy : ∀ j < singleHashSpace c_exp n_max, mem (hash2Base hashBase c_exp n_max + j) = mem (hashBase + j)) :
    SingleTableRep (hash2Base hashBase c_exp n_max) c_exp n_max U M mem
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairTableRep.congr_of_footprint {hashBase c_exp n_max U M : ℕ} {mem mem' : ℕ → ℕ} (htab : HashPairTableRep hashBase c_exp n_max U M mem) (hm : ∀ (a : ℕ), hashBase ≤ a → a < hashBase + hashPairSpace c_exp n_max → mem' a = mem a) :
    HashPairTableRep hashBase c_exp n_max U M mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.SingleSeedRep.congr_of_footprint {base c_exp n_max U M : ℕ} {θ : SingleSeed c_exp n_max U M} {mem mem' : ℕ → ℕ} (hseed : SingleSeedRep base c_exp n_max U M θ mem) (hm : ∀ (a : ℕ), base ≤ a → a < base + singleHashSpace c_exp n_max → mem' a = mem a) :
    SingleSeedRep base c_exp n_max U M θ mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairSeedRep.congr_of_footprint {hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} {mem mem' : ℕ → ℕ} (hseed : HashPairSeedRep hashBase c_exp n_max U M θ mem) (hm : ∀ (a : ℕ), hashBase ≤ a → a < hashBase + hashPairSpace c_exp n_max → mem' a = mem a) :
    HashPairSeedRep hashBase c_exp n_max U M θ mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairRep.congr_of_footprint {hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} {mem mem' : ℕ → ℕ} (hrep : HashPairRep hashBase c_exp n_max U M θ mem) (hm : ∀ (a : ℕ), hashBase ≤ a → a < hashBase + hashPairSpace c_exp n_max → mem' a = mem a) :
    HashPairRep hashBase c_exp n_max U M θ mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.HashPairRep.congr_of_ge_hashBase {hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} {mem mem' : ℕ → ℕ} (hrep : HashPairRep hashBase c_exp n_max U M θ mem) (hm : ∀ (a : ℕ), hashBase ≤ a → mem' a = mem a) :
    HashPairRep hashBase c_exp n_max U M θ mem'
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSingleSeed_congr_of_footprint {base c_exp n_max U M : ℕ} {mem mem' : ℕ → ℕ} (hm : ∀ (a : ℕ), base ≤ a → a < base + singleHashSpace c_exp n_max → mem' a = mem a) :
    extractSingleSeed base c_exp n_max U M mem' = extractSingleSeed base c_exp n_max U M mem
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSeed_congr_of_footprint {hashBase c_exp n_max U M : ℕ} {mem mem' : ℕ → ℕ} (hm : ∀ (a : ℕ), hashBase ≤ a → a < hashBase + hashPairSpace c_exp n_max → mem' a = mem a) :
    extractSeed hashBase c_exp n_max U M mem' = extractSeed hashBase c_exp n_max U M mem
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.extractSeed_congr_of_ge_hashBase {hashBase c_exp n_max U M : ℕ} {mem mem' : ℕ → ℕ} (hm : ∀ (a : ℕ), hashBase ≤ a → mem' a = mem a) :
    extractSeed hashBase c_exp n_max U M mem' = extractSeed hashBase c_exp n_max U M mem

    Injective register map embedding Data 18 into Data 19.

    Injective register map embedding Data 12 into Data 19.

    Body of copyWordsLoop: copies one word from [reg 3] to [reg 4] and increments both pointers by reg 6 = 1.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.copyWordsLoop_exec {w : ℕ} (len src dst : ℕ) {x : WordRAM.Data 19} (hsrc : x.regs 3 = src) (hdst : x.regs 4 = dst) (hend : x.regs 5 = dst + len) (hone : x.regs 6 = 1) (hdisj : src + len ≤ dst) (hfit_end : WordRAM.Fits w (dst + len)) :
    ∃ (y : WordRAM.Data 19), WordRAM.Exec w copyWordsLoop x y (6 * len + 2) ∧ (∀ (r : Fin 19), r ≠ 3 ∧ r ≠ 4 ∧ r ≠ 7 → y.regs r = x.regs r) ∧ (∀ j < len, y.mem (dst + j) = x.mem (src + j)) ∧ ∀ (a : ℕ), a < dst ∨ dst + len ≤ a → y.mem a = x.mem a

    Setup block preparing copyWordsLoop to duplicate [hashBase, hashBase + singleHashSpace c_exp n_max) into [hash2Base hashBase c_exp n_max, hash2Base hashBase c_exp n_max + singleHashSpace c_exp n_max).

    Deterministic table-initialization program for the two-block hash pair at hashBase: in the small-n_max regime n_max < doubleTabThreshold c_exp, initializes the KWise lookup table at hashBase and copies it to hash2Base hashBase c_exp n_max; in the large-n_max regime, executes a 1-instruction no-op (SingleTableRep is True).

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.initTableHashPairCode_execWithin {w hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} (h0 : x.regs 0 = hashBase) (h1 : x.regs 1 = n_max) (h2 : x.regs 2 = U) (h3 : x.regs 3 = M) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) (hfit_n : WordRAM.Fits w (max n_max 2)) (hfit_U : WordRAM.Fits w (max U 2 + 1)) (hfit_q : WordRAM.Fits w (2 ^ Probability.trinomialDeg U M)) :
    ∃ (y : WordRAM.Data 19), WordRAM.ExecWithin w (initTableHashPairCode c_exp n_max) x y (initTableHashPairSteps c_exp n_max U M) ∧ HashPairTableRep hashBase c_exp n_max U M y.mem ∧ y.regs 0 = hashBase ∧ ∀ (a : ℕ), a < hashBase ∨ hashBase + hashPairSpace c_exp n_max ≤ a → y.mem a = x.mem a

    Shifts reg 0 (base) forward by singleHashSpace c_exp n_max (hashBase → hash2Base) using scratch register 15.

    Closed-form machine state after shiftToHash2BaseCode c_exp n_max.

    Shifts reg 0 (base) back by singleHashSpace c_exp n_max (hash2Base → hashBase) using scratch register 15.

    Closed-form machine state after unshiftFromHash2BaseCode c_exp n_max.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.shiftToHash2BaseCode_exec {w hashBase c_exp n_max : ℕ} {x : WordRAM.Data 19} (h0 : x.regs 0 = hashBase) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) :
    WordRAM.Exec w (shiftToHash2BaseCode c_exp n_max) x (shiftToHash2BaseData hashBase c_exp n_max x) 2
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.unshiftFromHash2BaseCode_exec {w hashBase c_exp n_max : ℕ} {x : WordRAM.Data 19} (h0 : x.regs 0 = hash2Base hashBase c_exp n_max) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) :
    WordRAM.Exec w (unshiftFromHash2BaseCode c_exp n_max) x (unshiftFromHash2BaseData hashBase c_exp n_max x) 2

    Program resampling a single regime-switched hash block at reg 0 = base.

    Program shifting reg 0 to hash2Base, resampling the second hash block, and restoring reg 0 = hashBase.

    Complete seed-resampling program resampleHashPairCode: resamples both regime-switched hash blocks at hashBase and hash2Base hashBase c_exp n_max while preserving reg 0 = hashBase and HashPairTableRep.

    Explicit ProbComp (Data 19 × ℕ) induced by resampleSingleCode c_exp n_max M at base.

    Explicit ProbComp (Data 19 × ℕ) induced by resampleSecondBlockCode c_exp n_max M.

    Exact ProbComp semantics of resampleHashPairCode c_exp n_max M.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.resampleSingleCode_execRand {w base c_exp n_max U M : ℕ} {x : WordRAM.Data 19} (htab : SingleTableRep base c_exp n_max U M x.mem) (hbase : x.regs 0 = base) (hfit_space : WordRAM.Fits w (base + singleHashSpace c_exp n_max)) (hfit_q : WordRAM.Fits w (2 ^ Probability.trinomialDeg U M)) :
    WordRAM.ExecRand w (resampleSingleCode c_exp n_max M) x (resampleSingleComp base c_exp n_max U M x)
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.mem_support_resampleSingleComp {base c_exp n_max U M : ℕ} {x : WordRAM.Data 19} {z : WordRAM.Data 19 × ℕ} (htab : SingleTableRep base c_exp n_max U M x.mem) (hbase : x.regs 0 = base) (hz : z ∈ OracleComp.support (resampleSingleComp base c_exp n_max U M x)) :
    z.2 ≤ resampleSingleSteps c_exp n_max ∧ z.1.regs 0 = base ∧ SingleTableRep base c_exp n_max U M z.1.mem ∧ SingleSeedRep base c_exp n_max U M (extractSingleSeed base c_exp n_max U M z.1.mem) z.1.mem ∧ ∀ (a : ℕ), a < base ∨ base + singleHashSpace c_exp n_max ≤ a → z.1.mem a = x.mem a
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.resampleSecondBlockCode_execRand {w hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} (htab2 : SingleTableRep (hash2Base hashBase c_exp n_max) c_exp n_max U M x.mem) (h0 : x.regs 0 = hashBase) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) (hfit_q : WordRAM.Fits w (2 ^ Probability.trinomialDeg U M)) :
    WordRAM.ExecRand w (resampleSecondBlockCode c_exp n_max M) x (resampleSecondBlockComp hashBase c_exp n_max U M x)
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.mem_support_resampleSecondBlockComp {hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} {z : WordRAM.Data 19 × ℕ} (htab2 : SingleTableRep (hash2Base hashBase c_exp n_max) c_exp n_max U M x.mem) (hz : z ∈ OracleComp.support (resampleSecondBlockComp hashBase c_exp n_max U M x)) :
    z.2 ≤ resampleSingleSteps c_exp n_max + 4 ∧ z.1.regs 0 = hashBase ∧ SingleTableRep (hash2Base hashBase c_exp n_max) c_exp n_max U M z.1.mem ∧ SingleSeedRep (hash2Base hashBase c_exp n_max) c_exp n_max U M (extractSingleSeed (hash2Base hashBase c_exp n_max) c_exp n_max U M z.1.mem) z.1.mem ∧ ∀ (a : ℕ), a < hash2Base hashBase c_exp n_max ∨ hash2Base hashBase c_exp n_max + singleHashSpace c_exp n_max ≤ a → z.1.mem a = x.mem a
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.resampleHashPairCode_execRand {w hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} (htab : HashPairTableRep hashBase c_exp n_max U M x.mem) (h0 : x.regs 0 = hashBase) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) (hfit_q : WordRAM.Fits w (2 ^ Probability.trinomialDeg U M)) :
    WordRAM.ExecRand w (resampleHashPairCode c_exp n_max M) x (resampleHashPairComp hashBase c_exp n_max U M x)

    resampleHashPairCode randomized execution: resamples both regime-switched hash blocks at hashBase and hash2Base hashBase c_exp n_max.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.mem_support_resampleHashPairComp {hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} {z : WordRAM.Data 19 × ℕ} (htab : HashPairTableRep hashBase c_exp n_max U M x.mem) (h0 : x.regs 0 = hashBase) (hz : z ∈ OracleComp.support (resampleHashPairComp hashBase c_exp n_max U M x)) :
    z.2 ≤ resampleHashPairSteps c_exp n_max ∧ z.1.regs 0 = hashBase ∧ HashPairRep hashBase c_exp n_max U M (extractSeed hashBase c_exp n_max U M z.1.mem) z.1.mem ∧ ∀ (a : ℕ), a < hashBase ∨ hashBase + hashPairSpace c_exp n_max ≤ a → z.1.mem a = x.mem a
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.map_extractSeed_eval_resampleHashPairComp {hashBase c_exp n_max U M : ℕ} {x : WordRAM.Data 19} (htab : HashPairTableRep hashBase c_exp n_max U M x.mem) (h0 : x.regs 0 = hashBase) :
    PMF.map (fun (z : WordRAM.Data 19 × ℕ) => extractSeed hashBase c_exp n_max U M z.1.mem) (resampleHashPairComp hashBase c_exp n_max U M x).eval = seedLaw c_exp n_max U M

    Exact uniformity of resampleHashPairComp: the extracted seed extractSeed hashBase c_exp n_max U M z.1.mem is distributed according to seedLaw c_exp n_max U M.

    Word-RAM program evaluating a single regime-switched hash block at reg 0 = base and reg 1 = u.val into reg 2 (regOut) without modifying memory.

    Word-RAM program evaluating h₁(u) into reg 2 (regOut) while preserving reg 0 = hashBase, reg 1 = u.val, and all of memory (y.mem = x.mem).

    Word-RAM program evaluating h₂(u) into reg 2 (regOut) while preserving reg 0 = hashBase, reg 1 = u.val, and all of memory (y.mem = x.mem).

    Step bound for evalHash1Code c_exp n_max and evalHash2Code c_exp n_max.

    Instruction bound on evalHashSteps c_exp n_max U M depending only on c_exp. It holds for all n_max : ℕ whenever U ≤ max n_max 4 ^ c_exp and M ≤ max c_exp 1 * Nat.clog 2 (max n_max 4) + 5 (evalHashSteps_le); below doubleTabThreshold c_exp it uses cuckooK n_max ≤ cuckooKBound c_exp (cuckooK_le_cuckooKBound_of_lt).

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHashSteps_le {c_exp n_max U M : ℕ} (hU : U ≤ max n_max 4 ^ c_exp) (hM : M ≤ max c_exp 1 * Nat.clog 2 (max n_max 4) + 5) :
    evalHashSteps c_exp n_max U M ≤ evalHashBound c_exp

    All-n_max constant instruction bound for evalHashSteps (O_{c_exp}(1)): whenever U ≤ max n_max 4 ^ c_exp and M ≤ max c_exp 1 * Nat.clog 2 (max n_max 4) + 5, evalHashSteps c_exp n_max U M ≤ evalHashBound c_exp.

    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalSingleCode_execWithin {w base c_exp n_max U M : ℕ} {θ₀ : SingleSeed c_exp n_max U M} (u : Fin U) {x : WordRAM.Data 19} (htab : SingleTableRep base c_exp n_max U M x.mem) (hseed : SingleSeedRep base c_exp n_max U M θ₀ x.mem) (h0 : x.regs 0 = base) (h1 : x.regs 1 = ↑u) (hw : 2 * Probability.trinomialDeg U M ≤ w) (hfit_space : WordRAM.Fits w (base + singleHashSpace c_exp n_max)) :
    ∃ (y : WordRAM.Data 19), WordRAM.ExecWithin w (evalSingleCode c_exp n_max) x y (evalSingleSteps c_exp n_max U M) ∧ y.regs 0 = base ∧ y.regs 1 = ↑u ∧ y.regs 2 = ↑(evalSingle c_exp n_max U M θ₀ u) ∧ y.mem = x.mem
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash1Code_execWithin {w hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} (u : Fin U) {x : WordRAM.Data 19} (hrep : HashPairRep hashBase c_exp n_max U M θ x.mem) (h0 : x.regs 0 = hashBase) (h1 : x.regs 1 = ↑u) (hw : 2 * Probability.trinomialDeg U M ≤ w) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) :
    ∃ (y : WordRAM.Data 19), WordRAM.ExecWithin w (evalHash1Code c_exp n_max) x y (evalHashSteps c_exp n_max U M) ∧ y.regs 0 = hashBase ∧ y.regs 1 = ↑u ∧ y.regs 2 = ↑(evalHash1 θ u) ∧ HashPairRep hashBase c_exp n_max U M θ y.mem ∧ y.mem = x.mem
    theorem Cslib.DataStructure.Dictionary.WordRAM.CuckooHashing.evalHash2Code_execWithin {w hashBase c_exp n_max U M : ℕ} {θ : Seed c_exp n_max U M} (u : Fin U) {x : WordRAM.Data 19} (hrep : HashPairRep hashBase c_exp n_max U M θ x.mem) (h0 : x.regs 0 = hashBase) (h1 : x.regs 1 = ↑u) (hw : 2 * Probability.trinomialDeg U M ≤ w) (hfit_space : WordRAM.Fits w (hashBase + hashPairSpace c_exp n_max)) :
    ∃ (y : WordRAM.Data 19), WordRAM.ExecWithin w (evalHash2Code c_exp n_max) x y (evalHashSteps c_exp n_max U M) ∧ y.regs 0 = hashBase ∧ y.regs 1 = ↑u ∧ y.regs 2 = ↑(evalHash2 θ u) ∧ HashPairRep hashBase c_exp n_max U M θ y.mem ∧ y.mem = x.mem