Van Emde Boas initializer program and Phase 1–2 lookup-table construction #
This module defines the fixed 32-register structured initializer program initProgram for
recursive van Emde Boas trees and certifies its first two phases:
- Computing
(universeSize d, span d)byditerations of the layout recurrences (sizeLoop). - Populating the
(splitSize k, childSpan k)lookup table of2 * (d + 1)words at[base + span d, base + span d + 2 * (d + 1))(tableLoop).
Main definitions #
initSetup,sizeBody,sizeLoop: Phase 1 constant setup and(universeSize, span)recurrence loop.tableSetup,tableBody,tableLoop: Phase 2 setup and(splitSize, childSpan)lookup-table loop.dfsSetup,dfsEnterBody,dfsExitBody,dfsBody,dfsLoop: Phase 3 setup and iterative depth-first header initialization loop.initProgram: the fixed 32-register structured initializer program.TableInv: the lookup-table invariant for(splitSize j, childSpan j).
Main results #
sizeLoop_spec: Phase 1 recurrence loop specification.tableLoop_spec: Phase 2 lookup-table loop specification.
References #
Structured initializer program #
Constant and recurrence-seed setup for Phase 1.
One step of the (universeSize, span) recurrence loop.
Phase 1 loop computing (universeSize d, span d).
Setup for the Phase 2 (splitSize, childSpan) table construction.
One step of the Phase 2 table-population loop.
Phase 2 loop writing (splitSize (k + 1), childSpan (k + 1)) for k < d.
Setup for the Phase 3 depth-first header initialization.
Downward step of the DFS initializer: write the current node's empty header and either turn around at a leaf or initialize the cluster counter and descend into the summary.
Upward/sibling step of the DFS initializer: ascend to the parent level and either finish
when above depth, continue ascending when all clusters are done, or decrement the remaining
cluster counter and descend into the next cluster.
Full body of the Phase 3 DFS loop.
Phase 3 DFS traversal loop.
Fixed 32-register structured program initializing an empty van Emde Boas tree of depth
depth at root and placing stackBase at root + span depth.
The structured initializer program initProgram does not read the word width.
The compiled flat initializer program does not read the word width.
Phase 1: computing (universeSize d, span d) #
sizeLoop advances (q, t, high) from (universeSize k, span k, k) to
(universeSize d, span d, d) in 8 * (d - k) + 2 instructions without modifying memory.
Phase 2: populating the (splitSize, childSpan) table #
tableLoop populates the lookup table from depth k up to d in 12 * (d - k) + 2
instructions, advancing sp to base + span d + 2 * (d + 1) and preserving all memory outside
[base + span d + 2 * (k + 1), base + span d + 2 * (d + 1)).