# Metamath Proof Explorer

## Theorem modsubmod

Description: The difference of a real number modulo a positive real number and another real number equals the difference of the two real numbers modulo the positive real number. (Contributed by Alexander van der Vekens, 17-May-2018)

Ref Expression
Assertion modsubmod ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left(\left({A}\mathrm{mod}{M}\right)-{B}\right)\mathrm{mod}{M}=\left({A}-{B}\right)\mathrm{mod}{M}$

### Proof

Step Hyp Ref Expression
1 modcl ${⊢}\left({A}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {A}\mathrm{mod}{M}\in ℝ$
2 1 3adant2 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {A}\mathrm{mod}{M}\in ℝ$
3 simp1 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {A}\in ℝ$
4 simp2 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {B}\in ℝ$
5 simp3 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {M}\in {ℝ}^{+}$
6 modabs2 ${⊢}\left({A}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left({A}\mathrm{mod}{M}\right)\mathrm{mod}{M}={A}\mathrm{mod}{M}$
7 6 3adant2 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left({A}\mathrm{mod}{M}\right)\mathrm{mod}{M}={A}\mathrm{mod}{M}$
8 eqidd ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {B}\mathrm{mod}{M}={B}\mathrm{mod}{M}$
9 2 3 4 4 5 7 8 modsub12d ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left(\left({A}\mathrm{mod}{M}\right)-{B}\right)\mathrm{mod}{M}=\left({A}-{B}\right)\mathrm{mod}{M}$