Metamath Proof Explorer


Theorem moddi

Description: Distribute multiplication over a modulo operation. (Contributed by NM, 11-Nov-2008)

Ref Expression
Assertion moddi A+BC+ABmodC=ABmodAC

Proof

Step Hyp Ref Expression
1 rpcn A+A
2 1 3ad2ant1 A+BC+A
3 recn BB
4 3 3ad2ant2 A+BC+B
5 rpre C+C
6 5 adantl BC+C
7 refldivcl BC+BC
8 6 7 remulcld BC+CBC
9 8 recnd BC+CBC
10 9 3adant1 A+BC+CBC
11 2 4 10 subdid A+BC+ABCBC=ABACBC
12 rpcnne0 C+CC0
13 12 3ad2ant3 A+BC+CC0
14 rpcnne0 A+AA0
15 14 3ad2ant1 A+BC+AA0
16 divcan5 BCC0AA0ABAC=BC
17 4 13 15 16 syl3anc A+BC+ABAC=BC
18 17 fveq2d A+BC+ABAC=BC
19 18 oveq2d A+BC+ACABAC=ACBC
20 rpcn C+C
21 20 3ad2ant3 A+BC+C
22 rerpdivcl BC+BC
23 reflcl BCBC
24 23 recnd BCBC
25 22 24 syl BC+BC
26 25 3adant1 A+BC+BC
27 2 21 26 mulassd A+BC+ACBC=ACBC
28 19 27 eqtr2d A+BC+ACBC=ACABAC
29 28 oveq2d A+BC+ABACBC=ABACABAC
30 11 29 eqtrd A+BC+ABCBC=ABACABAC
31 modval BC+BmodC=BCBC
32 31 3adant1 A+BC+BmodC=BCBC
33 32 oveq2d A+BC+ABmodC=ABCBC
34 rpre A+A
35 remulcl ABAB
36 34 35 sylan A+BAB
37 36 3adant3 A+BC+AB
38 rpmulcl A+C+AC+
39 modval ABAC+ABmodAC=ABACABAC
40 37 38 39 3imp3i2an A+BC+ABmodAC=ABACABAC
41 30 33 40 3eqtr4d A+BC+ABmodC=ABmodAC