Scaling Probabilistic Programming Using Arithmetic Structure