Metamath Proof Explorer


Theorem modaddmulmod

Description: The sum of a real number and the product of a second real number modulo a positive real number and an integer equals the sum of the real number and the product of the other real number and the integer modulo the positive real number. (Contributed by Alexander van der Vekens, 17-May-2018)

Ref Expression
Assertion modaddmulmod A B C M + A + B mod M C mod M = A + B C mod M

Proof

Step Hyp Ref Expression
1 recn A A
2 1 3ad2ant1 A B C A
3 2 adantr A B C M + A
4 simpl2 A B C M + B
5 simpr A B C M + M +
6 4 5 modcld A B C M + B mod M
7 6 recnd A B C M + B mod M
8 zcn C C
9 8 3ad2ant3 A B C C
10 9 adantr A B C M + C
11 7 10 mulcld A B C M + B mod M C
12 3 11 addcomd A B C M + A + B mod M C = B mod M C + A
13 12 oveq1d A B C M + A + B mod M C mod M = B mod M C + A mod M
14 zre C C
15 14 3ad2ant3 A B C C
16 15 adantr A B C M + C
17 6 16 remulcld A B C M + B mod M C
18 simpl B C B
19 14 adantl B C C
20 18 19 remulcld B C B C
21 20 3adant1 A B C B C
22 21 adantr A B C M + B C
23 22 5 modcld A B C M + B C mod M
24 simp1 A B C A
25 24 anim1i A B C M + A M +
26 simpl3 A B C M + C
27 modmulmod B C M + B mod M C mod M = B C mod M
28 4 26 5 27 syl3anc A B C M + B mod M C mod M = B C mod M
29 remulcl B C B C
30 14 29 sylan2 B C B C
31 30 3adant1 A B C B C
32 modabs2 B C M + B C mod M mod M = B C mod M
33 31 32 sylan A B C M + B C mod M mod M = B C mod M
34 28 33 eqtr4d A B C M + B mod M C mod M = B C mod M mod M
35 modadd1 B mod M C B C mod M A M + B mod M C mod M = B C mod M mod M B mod M C + A mod M = B C mod M + A mod M
36 17 23 25 34 35 syl211anc A B C M + B mod M C + A mod M = B C mod M + A mod M
37 31 adantr A B C M + B C
38 24 adantr A B C M + A
39 modaddmod B C A M + B C mod M + A mod M = B C + A mod M
40 37 38 5 39 syl3anc A B C M + B C mod M + A mod M = B C + A mod M
41 recn B B
42 mulcl B C B C
43 41 8 42 syl2an B C B C
44 43 3adant1 A B C B C
45 44 2 addcomd A B C B C + A = A + B C
46 45 adantr A B C M + B C + A = A + B C
47 46 oveq1d A B C M + B C + A mod M = A + B C mod M
48 40 47 eqtrd A B C M + B C mod M + A mod M = A + B C mod M
49 13 36 48 3eqtrd A B C M + A + B mod M C mod M = A + B C mod M