Metamath Proof Explorer


Theorem modadd1

Description: Addition property of the modulo operation. (Contributed by NM, 12-Nov-2008)

Ref Expression
Assertion modadd1 A B C D + A mod D = B mod D A + C mod D = B + C mod D

Proof

Step Hyp Ref Expression
1 modval A D + A mod D = A D A D
2 modval B D + B mod D = B D B D
3 1 2 eqeqan12d A D + B D + A mod D = B mod D A D A D = B D B D
4 3 anandirs A B D + A mod D = B mod D A D A D = B D B D
5 4 adantrl A B C D + A mod D = B mod D A D A D = B D B D
6 oveq1 A D A D = B D B D A - D A D + C = B - D B D + C
7 5 6 syl6bi A B C D + A mod D = B mod D A - D A D + C = B - D B D + C
8 recn A A
9 8 adantr A C D + A
10 recn C C
11 10 ad2antrl A C D + C
12 rpcn D + D
13 12 adantl A D + D
14 rerpdivcl A D + A D
15 reflcl A D A D
16 15 recnd A D A D
17 14 16 syl A D + A D
18 13 17 mulcld A D + D A D
19 18 adantrl A C D + D A D
20 9 11 19 addsubd A C D + A + C - D A D = A - D A D + C
21 20 adantlr A B C D + A + C - D A D = A - D A D + C
22 recn B B
23 22 adantr B C D + B
24 10 ad2antrl B C D + C
25 12 adantl B D + D
26 rerpdivcl B D + B D
27 reflcl B D B D
28 27 recnd B D B D
29 26 28 syl B D + B D
30 25 29 mulcld B D + D B D
31 30 adantrl B C D + D B D
32 23 24 31 addsubd B C D + B + C - D B D = B - D B D + C
33 32 adantll A B C D + B + C - D B D = B - D B D + C
34 21 33 eqeq12d A B C D + A + C - D A D = B + C - D B D A - D A D + C = B - D B D + C
35 7 34 sylibrd A B C D + A mod D = B mod D A + C - D A D = B + C - D B D
36 oveq1 A + C - D A D = B + C - D B D A + C - D A D mod D = B + C - D B D mod D
37 readdcl A C A + C
38 37 adantrr A C D + A + C
39 simprr A C D + D +
40 14 flcld A D + A D
41 40 adantrl A C D + A D
42 modcyc2 A + C D + A D A + C - D A D mod D = A + C mod D
43 38 39 41 42 syl3anc A C D + A + C - D A D mod D = A + C mod D
44 43 adantlr A B C D + A + C - D A D mod D = A + C mod D
45 readdcl B C B + C
46 45 adantrr B C D + B + C
47 simprr B C D + D +
48 26 flcld B D + B D
49 48 adantrl B C D + B D
50 modcyc2 B + C D + B D B + C - D B D mod D = B + C mod D
51 46 47 49 50 syl3anc B C D + B + C - D B D mod D = B + C mod D
52 51 adantll A B C D + B + C - D B D mod D = B + C mod D
53 44 52 eqeq12d A B C D + A + C - D A D mod D = B + C - D B D mod D A + C mod D = B + C mod D
54 36 53 syl5ib A B C D + A + C - D A D = B + C - D B D A + C mod D = B + C mod D
55 35 54 syld A B C D + A mod D = B mod D A + C mod D = B + C mod D
56 55 3impia A B C D + A mod D = B mod D A + C mod D = B + C mod D