Metamath Proof Explorer


Theorem mod2xnegi

Description: Version of mod2xi with a negative mod value. (Contributed by Mario Carneiro, 21-Feb-2014)

Ref Expression
Hypotheses mod2xnegi.1 A
mod2xnegi.2 B 0
mod2xnegi.3 D
mod2xnegi.4 K
mod2xnegi.5 M 0
mod2xnegi.6 L 0
mod2xnegi.10 A B mod N = L mod N
mod2xnegi.7 2 B = E
mod2xnegi.8 L + K = N
mod2xnegi.9 D N + M = K K
Assertion mod2xnegi A E mod N = M mod N

Proof

Step Hyp Ref Expression
1 mod2xnegi.1 A
2 mod2xnegi.2 B 0
3 mod2xnegi.3 D
4 mod2xnegi.4 K
5 mod2xnegi.5 M 0
6 mod2xnegi.6 L 0
7 mod2xnegi.10 A B mod N = L mod N
8 mod2xnegi.7 2 B = E
9 mod2xnegi.8 L + K = N
10 mod2xnegi.9 D N + M = K K
11 nn0nnaddcl L 0 K L + K
12 6 4 11 mp2an L + K
13 9 12 eqeltrri N
14 13 nnzi N
15 zaddcl N D N + D
16 14 3 15 mp2an N + D
17 4 nnnn0i K 0
18 17 17 nn0addcli K + K 0
19 18 nn0zi K + K
20 zsubcl N + D K + K N + D - K + K
21 16 19 20 mp2an N + D - K + K
22 13 nncni N
23 zcn D D
24 3 23 ax-mp D
25 22 24 addcli N + D
26 4 nncni K
27 26 26 addcli K + K
28 25 27 22 subdiri N + D - K + K N = N + D N K + K N
29 28 oveq1i N + D - K + K N + M = N + D N - K + K N + M
30 25 22 mulcli N + D N
31 5 nn0cni M
32 27 22 mulcli K + K N
33 30 31 32 addsubi N + D N + M - K + K N = N + D N - K + K N + M
34 10 oveq2i N N + D N + M = N N + K K
35 22 26 26 adddii N K + K = N K + N K
36 34 35 oveq12i N N + D N + M - N K + K = N N + K K - N K + N K
37 22 24 22 adddiri N + D N = N N + D N
38 37 oveq1i N + D N + M = N N + D N + M
39 22 22 mulcli N N
40 24 22 mulcli D N
41 39 40 31 addassi N N + D N + M = N N + D N + M
42 38 41 eqtr2i N N + D N + M = N + D N + M
43 22 27 mulcomi N K + K = K + K N
44 42 43 oveq12i N N + D N + M - N K + K = N + D N + M - K + K N
45 36 44 eqtr3i N N + K K - N K + N K = N + D N + M - K + K N
46 mulsub N K N K N K N K = N N + K K - N K + N K
47 22 26 22 26 46 mp4an N K N K = N N + K K - N K + N K
48 6 nn0cni L
49 22 26 48 subadd2i N K = L L + K = N
50 9 49 mpbir N K = L
51 50 50 oveq12i N K N K = L L
52 47 51 eqtr3i N N + K K - N K + N K = L L
53 45 52 eqtr3i N + D N + M - K + K N = L L
54 29 33 53 3eqtr2i N + D - K + K N + M = L L
55 13 1 2 21 6 5 7 8 54 mod2xi A E mod N = M mod N