# Metamath Proof Explorer

## Theorem modsubmodmod

Description: The difference of a real number modulo a positive real number and another real number modulo this positive 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 modsubmodmod ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left(\left({A}\mathrm{mod}{M}\right)-\left({B}\mathrm{mod}{M}\right)\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 modcl ${⊢}\left({B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {B}\mathrm{mod}{M}\in ℝ$
5 4 3adant1 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {B}\mathrm{mod}{M}\in ℝ$
6 simp2 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {B}\in ℝ$
7 simp3 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to {M}\in {ℝ}^{+}$
8 modabs2 ${⊢}\left({A}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left({A}\mathrm{mod}{M}\right)\mathrm{mod}{M}={A}\mathrm{mod}{M}$
9 8 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}$
10 modabs2 ${⊢}\left({B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left({B}\mathrm{mod}{M}\right)\mathrm{mod}{M}={B}\mathrm{mod}{M}$
11 10 3adant1 ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left({B}\mathrm{mod}{M}\right)\mathrm{mod}{M}={B}\mathrm{mod}{M}$
12 2 3 5 6 7 9 11 modsub12d ${⊢}\left({A}\in ℝ\wedge {B}\in ℝ\wedge {M}\in {ℝ}^{+}\right)\to \left(\left({A}\mathrm{mod}{M}\right)-\left({B}\mathrm{mod}{M}\right)\right)\mathrm{mod}{M}=\left({A}-{B}\right)\mathrm{mod}{M}$