Documentation

Complexity.Algorithms.WordRAM.VanEmdeBoas.Program

Fixed native word-RAM van Emde Boas code #

The same thirty-two-register structured program dispatches insertion, membership and strict successor. It uses only standard unsigned integer operations, comparisons, loads and stores. The split size and child span are read from the represented memory; no code is generated from the depth, key or word width.

The minimum is stored outside recursive clusters, following Demaine's exposition. The lecture notes credit Michael Bender. The five-word contiguous records and explicit four-word successor return stack are engineering choices, distinguished from the original stratified representation of van Emde Boas, Kaas and Zijlstra.

These definitions alone establish no operation's correctness, execution bound, initialization or space use. Each certified operation must supply actual execution and representation proofs. In particular, a fitting query word may exceed the tree universe; membership rejects queries above the cached maximum before computing a descendant address.

Main definitions #

Main results #

References #

@[reducible, inline]

Caller-supplied operation tag: insertion = 0, membership = 1, successor = 2.

Instances For
    @[reducible, inline]

    Caller-supplied key or query word.

    Instances For
      @[reducible, inline]

      Returned key or Boolean membership word.

      Instances For
        @[reducible, inline]

        Presence flag distinguishing a successor from absence.

        Instances For
          @[reducible, inline]

          Persistent base address of the represented tree.

          Instances For
            @[reducible, inline]

            Persistent base address of the reserved return stack.

            Instances For
              @[reducible, inline]

              Reserved register for initialization depth; the dispatch program does not read it.

              Instances For
                @[reducible, inline]

                Reserved register for initialization metadata; the dispatch program does not read it.

                Instances For
                  @[reducible, inline]

                  Register holding zero after setup.

                  Instances For
                    @[reducible, inline]

                    Register holding one after setup.

                    Instances For
                      @[reducible, inline]

                      Register holding two after setup.

                      Instances For
                        @[reducible, inline]

                        Register holding three after setup.

                        Instances For
                          @[reducible, inline]

                          Register holding four after setup.

                          Instances For
                            @[reducible, inline]

                            Register holding the five-word header size after setup.

                            Instances For
                              @[reducible, inline]

                              Current subtree address.

                              Instances For
                                @[reducible, inline]

                                Current local query or inserted key.

                                Instances For
                                  @[reducible, inline]

                                  Current node's stored split size.

                                  Instances For
                                    @[reducible, inline]

                                    Current node's stored child span.

                                    Instances For
                                      @[reducible, inline]

                                      High part of the current key.

                                      Instances For
                                        @[reducible, inline]

                                        Low part of the current key.

                                        Instances For
                                          @[reducible, inline]

                                          Computed child address.

                                          Instances For
                                            @[reducible, inline]

                                            Scratch address for indexed memory operations.

                                            Instances For
                                              @[reducible, inline]

                                              Cached presence flag read from the current record.

                                              Instances For
                                                @[reducible, inline]

                                                Cached minimum read from a record.

                                                Instances For
                                                  @[reducible, inline]

                                                  Cached maximum read from a record.

                                                  Instances For
                                                    @[reducible, inline]

                                                    Scratch arithmetic register.

                                                    Instances For
                                                      @[reducible, inline]

                                                      Return-stack cursor.

                                                      Instances For
                                                        @[reducible, inline]

                                                        Whether the descent loop continues.

                                                        Instances For
                                                          @[reducible, inline]

                                                          Return-frame tag: cluster = 0, summary = 1.

                                                          Instances For
                                                            @[reducible, inline]

                                                            Return-frame payload: cluster offset or parent address.

                                                            Instances For
                                                              @[reducible, inline]

                                                              Split size loaded from a return frame.

                                                              Instances For
                                                                @[reducible, inline]

                                                                Child span loaded from a return frame.

                                                                Instances For

                                                                  Initialize constants, traversal, result and stack registers in twelve instructions.

                                                                  Instances For

                                                                    Split the key and compute its cluster address using six arithmetic instructions.

                                                                    Instances For

                                                                      Return the cached minimum and stop descent.

                                                                      Instances For

                                                                        Return the cached maximum and stop descent.

                                                                        Instances For

                                                                          One native insertion iteration. Empty records and empty destination clusters install their first key directly in the three-word bounds area.

                                                                          Instances For

                                                                            One native membership iteration. The maximum check rejects large queries before descent.

                                                                            Instances For

                                                                              Native membership descent, with one depth decrease for each continuing iteration.

                                                                              Instances For

                                                                                Push four words: continuation kind, payload, split and child span.

                                                                                Instances For

                                                                                  Save a cluster-return continuation and descend into the selected cluster.

                                                                                  Instances For

                                                                                    Save a summary-return continuation and descend into the summary.

                                                                                    Instances For

                                                                                      One native successor-descent iteration. The cached maximum chooses between early termination, cluster descent and summary descent.

                                                                                      Instances For

                                                                                        Reconstruct the answer through cluster and summary return frames.

                                                                                        Instances For

                                                                                          One fixed dispatch program, independent of the universe, query, state and word width.

                                                                                          Instances For

                                                                                            The fixed dispatch has 212 instructions before the final compiled halt.

                                                                                            The dispatch never reads the selected word width.