  The properties which give quantum mechanics its unique character - unitarity,
complementarity, non-commutativity, uncertainty, nonlocality - derive from the
algebraic structure of Hermitian operators acting on the wavefunction in
complex Hilbert space. Because of this, the wavefunction cannot be shown to
describe an ensemble of deterministic states where uncertainty simply reflects
a lack of knowledge about which ensemble member describes reality. This has led
to endless debates about the ontology of quantum mechanics.
  Here we derive these same quantum properties from number theoretic attributes
of trigonometric functions applied to an explicitly ensemble-based
representation of discretised complex Hilbert states. To avoid fine-tuning, the
metric on state space must be $p$-adic rather than Euclidean where $1/p$
determines the fineness of the discretisation. This hints at both the existence
of an underpinning fractal state-space geometry onto which states of the world
are constrained. In this model, violation of Bell inequalities is a
manifestation of this geometric constraint and does not imply a breakdown of
local space-time causality.
  Because the discretised wavefunction describes an ensemble of states, there
is no collapse of the wavefunction. Instead measurement describes a nonlinear
clustering of state-space trajectories on the state-space geometry. In this
model, systems with mass greater than the Planck mass will not exhibit quantum
properties and instead behave classically. The geometric constraint suggests
that the exponential increase in the size of state space with qubit number may
break down with qubit numbers as small as a few hundred. Quantum mechanics is
itself a singular limit of this number-theoretic model at $p=\infty$. A
modification of general relativity, consistent with this discretised model of
quantum physics, is proposed.
