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 ABCM+A+BmodMCmodM=A+BCmodM

Proof

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