Metamath Proof Explorer


Theorem addmodid

Description: The sum of a positive integer and a nonnegative integer less than the positive integer is equal to the nonnegative integer modulo the positive integer. (Contributed by Alexander van der Vekens, 30-Oct-2018) (Proof shortened by AV, 5-Jul-2020)

Ref Expression
Assertion addmodid A0MA<MM+AmodM=A

Proof

Step Hyp Ref Expression
1 nncn MM
2 1 mullidd M1 M=M
3 2 3ad2ant2 A0MA<M1 M=M
4 3 eqcomd A0MA<MM=1 M
5 4 oveq1d A0MA<MM+A=1 M+A
6 5 oveq1d A0MA<MM+AmodM=1 M+AmodM
7 1zzd A0MA<M1
8 nnrp MM+
9 8 3ad2ant2 A0MA<MM+
10 nn0re A0A
11 10 rexrd A0A*
12 11 3ad2ant1 A0MA<MA*
13 nn0ge0 A00A
14 13 3ad2ant1 A0MA<M0A
15 simp3 A0MA<MA<M
16 0xr 0*
17 nnre MM
18 17 rexrd MM*
19 18 3ad2ant2 A0MA<MM*
20 elico1 0*M*A0MA*0AA<M
21 16 19 20 sylancr A0MA<MA0MA*0AA<M
22 12 14 15 21 mpbir3and A0MA<MA0M
23 muladdmodid 1M+A0M1 M+AmodM=A
24 7 9 22 23 syl3anc A0MA<M1 M+AmodM=A
25 6 24 eqtrd A0MA<MM+AmodM=A