Discrete Neural Computation: A Theoretical Foundation