Documentation

Complexity.Algorithms.WordRAM.ElementDistinctnessRAM

Element distinctness on a logarithmic-cost RAM #

The bounded-universe direct-addressing algorithm Cormen et al., Section 11.1 uses only the additive-memory fragment of the word RAM. Compiling its fixed twelve-register program with Cslib.WordRAM.ToRAM.paddedProgram gives a natural-number RAM decider with logarithmic cost O((n + 1) (log(n + 1) + 1)).

The prepared program starts from five supplied zero scratch words, a length header and the input. It charges every relocation, clearing, compiler-initialization, simulation and output instruction. Installing this external convention remains uncharged. A second theorem starts directly from the larger padded workspace. The entries must be below the input length; unrestricted element distinctness is outside the statements. The target is the library's natural-number adaptation of Cook and Reckhow, not a Turing-machine theorem. The source word RAM adapts MIT–ULB CompGeom Group.

Main definitions #

Main results #

References #

Every instruction of the compiled source decider is in the additive-memory fragment, because decider is the image of deciderAdditive under Basis.additiveHomStandard.

The fixed twelve-register source decider compiled to the natural-number RAM. Its input convention is ToRAM.paddedInput 12, whose supplied zero prefix has length seventeen.

Instances For

    The fixed compiled decider preceded by charged input relocation and workspace clearing. Its external input convention is RAM.Input.encode 5.

    Instances For

      Bounded-universe element distinctness has logarithmic RAM cost 2448 (n + 1) (log₂(n + 1) + 1) from the supplied padded-input convention. The constant is not optimized. All source and compiler instructions are charged, but constructing the initial padded list is not included.

      Bounded-universe element distinctness has logarithmic RAM cost 2735 (n + 1) (log₂(n + 1) + 1) including input relocation and workspace clearing. The same fixed program handles every input, whose entries must be below its length. Installing the external five-zero prefix, length header and words is uncharged; all instructions are charged.