Complete native van Emde Boas calls and adaptive dynamic realization #
All three operations — insert (tag = 0), member (tag = 1), and strict successor
(tag = 2) — execute on the same fixed 32-register dispatcher program, charging constant
setup, dispatch branches, every loop instruction, and the final halt.
In addition, this module connects program to the shared Stateful.Spec / DynamicProgram /
DynamicCertificate interface on finite sets (Finset ℕ) and combines the uniform native
initializer initProgram with arbitrary adaptive client histories (run_initialized).
Main definitions #
setupData: mathematical description of the twelve charged setup instructions.Operation,spec,dynamicProgram,SetRep,certificate: the stateful finite-set specification and its fixed-program Word-RAM realization.
Main results #
insert_dispatch_spec,insert_call,insert_executes,insert_executes_generic,insert_executes_log: complete native insertion calls in39 * (d + 1) + 16instructions.member_dispatch_spec,member_call,member_executes,member_executes_generic,member_executes_log: complete native membership calls in28 * (d + 1) + 18instructions.successor_dispatch_spec,successor_call,successor_executes,successor_executes_generic,successor_executes_log: complete native strict-successor calls in65 * (d + 1) + 22instructions.instruction_bound,instruction_bound_log,client_spec,run_initialized: adaptive history execution and combined initialization-plus-client execution certificates.
References #
The state after the twelve actual setup instructions.
Instances For
Constant and traversal setup has exactly twelve native instructions.
Setup establishes insertion's entry registers from the caller's root and argument.
Setup establishes membership's entry registers from the caller's root and argument.
Setup establishes strict successor's entry registers from the caller's root, stack base, and argument.
The single compiled program contains 212 ordinary instructions and a final halt.
Compiling the fixed dispatcher introduces no word-width instruction.
The supported double-exponential universe has exactly d iterated binary logarithms.
Complete native insertion calls #
A complete insertion dispatch (tag = 0), including setup and all control flow but not final
halt, executes in at most 39 * (d + 1) + 15 instructions, updates the represented tree to
tree.insert key, leaves out = 0, and preserves all memory outside [base, base + span d).
A bounded caller invoking insertion (tag = 0) obtains a bounded state representing
tree.insert key, with unchanged persistent root and stackBase registers and all memory
outside [base, base + span d) preserved.
Actual flat bounded-word insertion execution, including its final halt, in
39 * (d + 1) + 16 instructions.
Exact transfer of the flat insertion call into the shared generic RAM model.
The charged native insertion bound written directly in terms of the universe size.
Complete native membership calls #
A complete membership dispatch, including setup and all control flow but not final halt. No query-universe restriction and no zero-filled outside-memory assumption are imposed.
A bounded caller obtains a bounded result, identical represented memory and an unchanged persistent root. Its query fits the machine word because every caller register does.
Actual flat bounded-word execution, including its final halt, in 28 (d+1) + 18
instructions. The selected fixed program has no depth or word-width parameter.
Exact transfer of the actual flat call into the shared generic RAM model; this adds no semantic operation or uncharged oracle instruction.
The charged native membership bound written directly in terms of the universe size.
Complete native strict-successor calls #
A complete strict-successor dispatch (tag = 2), including setup, descent, and stack unwind
but not final halt, executes in at most 65 * (d + 1) + 21 instructions, preserves the
represented tree at base, restores sp = stackBase₀, and modifies no memory outside the
4 * d-word stack region [stackBase₀, stackBase₀ + 4 * d).
A bounded caller invoking strict successor (tag = 2) obtains a bounded state with the
exact optional successor encoded by (found, out), unchanged persistent root and stackBase
registers, preserved tree representation, and unchanged memory outside
[stackBase₀, stackBase₀ + 4 * d).
Actual flat bounded-word strict-successor execution, including its final halt, in
65 * (d + 1) + 22 instructions.
Exact transfer of the flat strict-successor call into the shared generic RAM model.
The charged native strict-successor bound written directly in terms of the universe size.
Finite-set Stateful.Spec and DynamicCertificate realization #
Tree.successor on a valid tree computes the mathematical OrderedSet.least of the stored
elements strictly greater than the query.
Dynamic ordered-set operations supported by the van Emde Boas dispatcher.
- insert (key : ℕ) : Operation
Insert a bounded universe key into the set.
- member (query : ℕ) : Operation
Query whether a fitting word belongs to the set.
- successor (query : ℕ) : Operation
Return the least stored key strictly greater than a fitting query, if any.
Instances For
Instances For
Instances For
Typed observation returned by each van Emde Boas operation.
Instances For
Abstract finite-set specification on the universe [0, universeSize d).
Instances For
The single fixed dispatcher program packaged as a DynamicProgram with a register-only
calling convention (tag and arg).
Instances For
Persistent machine representation of an abstract finite set s : Finset ℕ by a valid tree
at base and scratch stack pointer at stackBase₀.
- bounded : WordRAM.Data.Bounded w x
Instances For
Unified per-operation dispatch theorem for (dynamicProgram d w): every admissible operation
executes in at most 65 * (d + 1) + 21 structured instructions, produces the decoded abstract
observation, preserves SetRep, and modifies no memory outside
[base, base + span d) ∪ [stackBase₀, stackBase₀ + 4 * d).
Semantic correctness and totality certificate for the fixed bounded-word van Emde Boas implementation.
Instances For
Separate worst-case per-operation instruction certificate, counting the final halt:
every admissible insert, member, or successor call executes in at most 65 * (d + 1) + 22
instructions.
The per-operation instruction certificate written in terms of the universe size.
Every actual call preserves memory outside the tree region [base, base + span d) and
the scratch stack [stackBase₀, stackBase₀ + 4 * d).
Every admissible adaptive client execution preserves memory outside the tree and stack regions across the entire interaction history.
Every admissible adaptive client has a concrete execution with the specified answers and
final finite set, at most 65 * (d + 1) + 22 instructions per operation, and unchanged memory
outside the tree and stack regions.
Combined native initialization and adaptive client execution: starting from any bounded
machine state s₀ with s₀.regs root = base, s₀.regs depth = d, and
Fits w (base + span d + 4 * (d + 1)) (with arbitrary initial memory), initProgram executes
in at most 8 * span d + 20 * d + 25 instructions to produce an empty represented set x₀,
from which any admissible adaptive client p executes to y with at most 65 * (d + 1) + 22
instructions per operation and no memory modified outside [base, base + span d + 4 * (d + 1)).