Metamath Proof Explorer


Theorem modaddabs

Description: Absorption law for modulo. (Contributed by Paul Chapman, 22-Jun-2011)

Ref Expression
Assertion modaddabs A B C + A mod C + B mod C mod C = A + B mod C

Proof

Step Hyp Ref Expression
1 modcl A C + A mod C
2 1 recnd A C + A mod C
3 2 3adant2 A B C + A mod C
4 modcl B C + B mod C
5 4 recnd B C + B mod C
6 5 3adant1 A B C + B mod C
7 3 6 addcomd A B C + A mod C + B mod C = B mod C + A mod C
8 7 oveq1d A B C + A mod C + B mod C mod C = B mod C + A mod C mod C
9 simpl B C + B
10 4 9 jca B C + B mod C B
11 10 3adant1 A B C + B mod C B
12 simpr A C + C +
13 1 12 jca A C + A mod C C +
14 13 3adant2 A B C + A mod C C +
15 modabs2 B C + B mod C mod C = B mod C
16 15 3adant1 A B C + B mod C mod C = B mod C
17 modadd1 B mod C B A mod C C + B mod C mod C = B mod C B mod C + A mod C mod C = B + A mod C mod C
18 11 14 16 17 syl3anc A B C + B mod C + A mod C mod C = B + A mod C mod C
19 recn B B
20 19 3ad2ant2 A B C + B
21 3 20 addcomd A B C + A mod C + B = B + A mod C
22 21 oveq1d A B C + A mod C + B mod C = B + A mod C mod C
23 18 22 eqtr4d A B C + B mod C + A mod C mod C = A mod C + B mod C
24 simpl A C + A
25 1 24 jca A C + A mod C A
26 25 3adant2 A B C + A mod C A
27 3simpc A B C + B C +
28 modabs2 A C + A mod C mod C = A mod C
29 28 3adant2 A B C + A mod C mod C = A mod C
30 modadd1 A mod C A B C + A mod C mod C = A mod C A mod C + B mod C = A + B mod C
31 26 27 29 30 syl3anc A B C + A mod C + B mod C = A + B mod C
32 8 23 31 3eqtrd A B C + A mod C + B mod C mod C = A + B mod C