Register Wiring and Per-Operation Native Dispatch for the Succinct Dictionary #
This module wires the five parameter-free Realizes .exact certificates from SuccinctHash.lean
(realizes_extractQuotGen, realizes_queryWithHashGen, realizes_insertWithHashGen,
realizes_deletePrepWithHashGen, realizes_deleteFinishWithHashGen) together with
loadParamsCode, ReducedKWise.evalCode, ReducedKWise.initTableCode, and
ReducedKWise.resampleCode into a single SubroutineCode (subroutineCode U V w n_max) on a
parameter-free constant number of registers rSuccinct, and proves the unified per-operation
deterministic execution theorem (exec_opCode) with a parameter-free O(1) amortized instruction
charge chargeVal.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.rSuccinct,Cslib.DataStructure.Dictionary.WordRAM.Succinct.opFactor,Cslib.DataStructure.Dictionary.WordRAM.Succinct.chargeVal,Cslib.DataStructure.Dictionary.WordRAM.Succinct.charge: parameter-free register budget, exchange factor dominating the fiveRealizescertificates, and per-operation amortized instruction charge.Cslib.DataStructure.Dictionary.WordRAM.Succinct.opCode,Cslib.DataStructure.Dictionary.WordRAM.Succinct.subroutineCode: native Word-RAM operation dispatch code andSubroutineCoderecord.Cslib.DataStructure.Dictionary.WordRAM.Succinct.Rep,Cslib.DataStructure.Dictionary.WordRAM.Succinct.potential,Cslib.DataStructure.Dictionary.WordRAM.Succinct.encode,Cslib.DataStructure.Dictionary.WordRAM.Succinct.argMatch,Cslib.DataStructure.Dictionary.WordRAM.Succinct.decode: concrete Word-RAM representation invariant, scaled potential, and ABI register conventions.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.Succinct.le_rSuccinct,Cslib.DataStructure.Dictionary.WordRAM.Succinct.one_le_opFactor: basic bounds onrSuccinct(292 ≤ rSuccinct) andopFactor(1 ≤ opFactor).Cslib.DataStructure.Dictionary.WordRAM.Succinct.fits_mkDictParams: every entry ofmkDictParams U V w n_max (hashSpace U w n_max)fits in aw-bit word.Cslib.DataStructure.Dictionary.WordRAM.Succinct.exec_opCode: unified per-operation deterministic execution ofopCodefor anyo : Dynamic.Op U.
Section 1: Parameter-free register layout, scratch bank, and exchange factor #
Combined parameter-free scratch register bank size for the five Realizes certificates used in
operation dispatch.
Parameter-free total register count 292 + scratchSuccinct for the succinct dictionary
subroutine (0..239 for ReducedKWise, 240..255 for fixed control/input/output registers,
256..291 for the 36 runtime DictParams registers paramReg, and 292.. for scratch).
Combined parameter-free exchange factor ≥ 1 dominating the five Realizes.factor
constants.
Persistent base-address register 0 (sReg 0).
Hash input register 1 (sReg 1).
Hash output register 2 (sReg 2).
Bump-pointer frontier register 240 (sReg 240).
Scratch pointer register 241 for zeroFillCode and allocSpan.
Constant-0 scratch register 242 for zeroFillCode and operation dispatch.
Constant-1 scratch register 243 for zeroFillCode and operation dispatch.
Input operation-tag register 244 (0 = query, 1 = insert, 2 = delete).
Input key register 245 (u.val).
Input value register 246 (v for insert, 0 otherwise).
Nominal output register 247 for SubroutineCode.output.
Register 248 saving the first hash evaluation h_q across the second hash call in
delete.
Register 249 storing found from deletePrepWithHashGenProg.
Register 250 storing j_del from deletePrepWithHashGenProg.
Register 251 storing phys_del from deletePrepWithHashGenProg.
Register 252 storing the Option ℕ presence tag (0 = none, 1 = some) from
queryWithHashGenProg.
Register 253 storing the Option ℕ payload value v from queryWithHashGenProg.
Register block 256..291 holding the 36 words of DictParams.
Section 2: Register wirings (src*, tmp*), loadParamsCode, and emitted native code #
Load entries 0 .. k (k < 36) of dp : DictParams into paramReg 0 .. paramReg k in
k + 1 instructions.
Load all 36 words of mkDictParams U V w n_max (hashSpace U w n_max) into paramReg 0 .. 35
in 36 instructions.
Payload source register wiring ![argUReg] for extractQuotGenProg.
Full source register wiring Fin.append paramReg srcExtD for extractQuotGenProg.
Scratch/output register wiring for extractQuotGenProg, placing output 0 directly in
hashKeyReg (1) and remaining scratch registers at 292 + j.val.
Emitted native code for extractQuotGenProg.
Payload source register wiring ![baseReg, argUReg, hashOutReg] for queryWithHashGenProg.
Full source register wiring Fin.append paramReg srcQryD for queryWithHashGenProg.
Scratch/output register wiring for queryWithHashGenProg, placing outputs 0, 1 in
resTagReg (252) and resValReg (253).
Emitted native code for queryWithHashGenProg.
Payload source register wiring ![baseReg, argUReg, argVReg, hashOutReg] for
insertWithHashGenProg.
Full source register wiring Fin.append paramReg srcInsD for insertWithHashGenProg.
Scratch register wiring for insertWithHashGenProg at 292 + j.val.
Emitted native code for insertWithHashGenProg.
Payload source register wiring ![baseReg, argUReg, hqReg] for deletePrepWithHashGenProg.
Full source register wiring Fin.append paramReg srcDelPrepD for
deletePrepWithHashGenProg.
Scratch/output register wiring for deletePrepWithHashGenProg, placing outputs 0..3 in
foundReg (249), jDelReg (250), physDelReg (251), and hashKeyReg (1).
Emitted native code for deletePrepWithHashGenProg.
Payload source register wiring
![baseReg, argUReg, hqReg, foundReg, jDelReg, physDelReg, hashOutReg] for
deleteFinishWithHashGenProg.
Full source register wiring Fin.append paramReg srcDelFinD for
deleteFinishWithHashGenProg.
Scratch register wiring for deleteFinishWithHashGenProg at 292 + j.val.
Emitted native code for deleteFinishWithHashGenProg.
Native quotient hash evaluation code (ReducedKWise.evalCode ...).rename coreReg.
Complete delete branch code: saves h_q into hqReg, runs delPrepCode (which puts q_last
into hashKeyReg), evaluates h_q_last via hashEvalCode, and runs delFinCode.
Complete operation dispatch code for subroutineCode: loads DictParams into paramReg,
extracts q, evaluates h_q, and branches on tagReg between qryCode, insCode, and
delCode.
Canonical SubroutineCode for the fixed-capacity succinct dynamic dictionary on rSuccinct
registers. Note that subroutineCode U V w n_max depends on the static parameters
(U, V, w, n_max) (through space, loadParamsCode, and ReducedKWise bit-width constants) and
is independent of base.
Section 3: Generic register-wiring disjointness and encoding helpers #
Generic disjointness between Fin.append paramReg srcD and tmp whenever tmp maps every
index outside [256, 292) and is disjoint from srcD.
Generic disjointness between Fin.append paramReg srcD and frontierReg (240).
Composing x.regs with Fin.append paramReg srcD yields WordEncoding.encode (dp, d).
Section 4: Representation invariant, potential, charge, and ABI encoding #
Concrete Word-RAM representation invariant at base coupling θ : QuotHashSeed U n_max,
abstract dictionary state s_abs : Dictionary.State U, and machine state x.
Scaled concrete potential (66 * opFactor) * slotPotential.
Parameter-free O(1) per-operation amortized instruction charge 313 * opFactor + 284725
(independent of U, V, w, n_max, base, and operation-sequence length).
Per-operation amortized instruction charge (chargeVal for every operation).
Standalone register encoding for Dynamic.Op U:
Partial argument-matching predicate for inline callers.
Output decoder reading Option ℕ from (resTagReg, resValReg) for .query and () for
.insert/.delete.
Section 5: Memory footprint congruence lemmas for TableRep, SeedRep, DictStateInv #
Section 6: loadParamsCode and common prefix execution helpers #
Every entry of mkDictParams U V w n_max (hashSpace U w n_max) fits in a w-bit word under
DictParamsWf U V w n_max, Fits w V, and Fits w (base + space U V w n_max).
Extract the target key u : Fin U of a dynamic dictionary operation o : Dynamic.Op U.
Unified per-operation deterministic execution of opCode for any o : Dynamic.Op U.