A mathematical theory for deterministic quantum mechanics