simplifications of modular arith expressions, with some Gauss theorem baked in