Metamath Proof Explorer


Theorem 2lgsoddprmlem2

Description: Lemma 2 for 2lgsoddprm . (Contributed by AV, 19-Jul-2021)

Ref Expression
Assertion 2lgsoddprmlem2 N ¬ 2 N R = N mod 8 2 N 2 1 8 2 R 2 1 8

Proof

Step Hyp Ref Expression
1 8nn 8
2 nnrp 8 8 +
3 1 2 ax-mp 8 +
4 eqcom R = N mod 8 N mod 8 = R
5 modmuladdim N 8 + N mod 8 = R k N = k 8 + R
6 4 5 syl5bi N 8 + R = N mod 8 k N = k 8 + R
7 3 6 mpan2 N R = N mod 8 k N = k 8 + R
8 7 imp N R = N mod 8 k N = k 8 + R
9 8 3adant2 N ¬ 2 N R = N mod 8 k N = k 8 + R
10 zcn k k
11 8cn 8
12 11 a1i k 8
13 10 12 mulcomd k k 8 = 8 k
14 13 adantl N ¬ 2 N R = N mod 8 k k 8 = 8 k
15 14 oveq1d N ¬ 2 N R = N mod 8 k k 8 + R = 8 k + R
16 15 eqeq2d N ¬ 2 N R = N mod 8 k N = k 8 + R N = 8 k + R
17 simpr N ¬ 2 N R = N mod 8 k k
18 17 adantr N ¬ 2 N R = N mod 8 k N = 8 k + R k
19 id N N
20 1 a1i N 8
21 19 20 zmodcld N N mod 8 0
22 21 nn0zd N N mod 8
23 22 3ad2ant1 N ¬ 2 N R = N mod 8 N mod 8
24 eleq1 R = N mod 8 R N mod 8
25 24 3ad2ant3 N ¬ 2 N R = N mod 8 R N mod 8
26 23 25 mpbird N ¬ 2 N R = N mod 8 R
27 26 adantr N ¬ 2 N R = N mod 8 k R
28 27 adantr N ¬ 2 N R = N mod 8 k N = 8 k + R R
29 simpr N ¬ 2 N R = N mod 8 k N = 8 k + R N = 8 k + R
30 2lgsoddprmlem1 k R N = 8 k + R N 2 1 8 = 8 k 2 + 2 k R + R 2 1 8
31 18 28 29 30 syl3anc N ¬ 2 N R = N mod 8 k N = 8 k + R N 2 1 8 = 8 k 2 + 2 k R + R 2 1 8
32 31 breq2d N ¬ 2 N R = N mod 8 k N = 8 k + R 2 N 2 1 8 2 8 k 2 + 2 k R + R 2 1 8
33 2z 2
34 simp1 N ¬ 2 N R = N mod 8 N
35 1 a1i N ¬ 2 N R = N mod 8 8
36 34 35 zmodcld N ¬ 2 N R = N mod 8 N mod 8 0
37 36 nn0red N ¬ 2 N R = N mod 8 N mod 8
38 eleq1 R = N mod 8 R N mod 8
39 38 3ad2ant3 N ¬ 2 N R = N mod 8 R N mod 8
40 37 39 mpbird N ¬ 2 N R = N mod 8 R
41 resqcl R R 2
42 peano2rem R 2 R 2 1
43 41 42 syl R R 2 1
44 8re 8
45 44 a1i R 8
46 8pos 0 < 8
47 44 46 gt0ne0ii 8 0
48 47 a1i R 8 0
49 43 45 48 redivcld R R 2 1 8
50 40 49 syl N ¬ 2 N R = N mod 8 R 2 1 8
51 50 adantr N ¬ 2 N R = N mod 8 k R 2 1 8
52 eleq1 R = N mod 8 R 0 N mod 8 0
53 52 3ad2ant3 N ¬ 2 N R = N mod 8 R 0 N mod 8 0
54 36 53 mpbird N ¬ 2 N R = N mod 8 R 0
55 nn0z R 0 R
56 1 nnzi 8
57 56 a1i R k 8
58 zsqcl k k 2
59 58 adantl R k k 2
60 57 59 zmulcld R k 8 k 2
61 33 a1i R k 2
62 zmulcl k R k R
63 62 ancoms R k k R
64 61 63 zmulcld R k 2 k R
65 60 64 zaddcld R k 8 k 2 + 2 k R
66 4z 4
67 66 a1i R k 4
68 67 59 zmulcld R k 4 k 2
69 68 63 zaddcld R k 4 k 2 + k R
70 61 69 jca R k 2 4 k 2 + k R
71 dvdsmul1 2 4 k 2 + k R 2 2 4 k 2 + k R
72 70 71 syl R k 2 2 4 k 2 + k R
73 4t2e8 4 2 = 8
74 4cn 4
75 2cn 2
76 74 75 mulcomi 4 2 = 2 4
77 73 76 eqtr3i 8 = 2 4
78 77 a1i R k 8 = 2 4
79 78 oveq1d R k 8 k 2 = 2 4 k 2
80 75 a1i R k 2
81 74 a1i R k 4
82 58 zcnd k k 2
83 82 adantl R k k 2
84 80 81 83 mulassd R k 2 4 k 2 = 2 4 k 2
85 79 84 eqtrd R k 8 k 2 = 2 4 k 2
86 85 oveq1d R k 8 k 2 + 2 k R = 2 4 k 2 + 2 k R
87 68 zcnd R k 4 k 2
88 62 zcnd k R k R
89 88 ancoms R k k R
90 80 87 89 adddid R k 2 4 k 2 + k R = 2 4 k 2 + 2 k R
91 86 90 eqtr4d R k 8 k 2 + 2 k R = 2 4 k 2 + k R
92 72 91 breqtrrd R k 2 8 k 2 + 2 k R
93 65 92 jca R k 8 k 2 + 2 k R 2 8 k 2 + 2 k R
94 93 ex R k 8 k 2 + 2 k R 2 8 k 2 + 2 k R
95 55 94 syl R 0 k 8 k 2 + 2 k R 2 8 k 2 + 2 k R
96 54 95 syl N ¬ 2 N R = N mod 8 k 8 k 2 + 2 k R 2 8 k 2 + 2 k R
97 96 imp N ¬ 2 N R = N mod 8 k 8 k 2 + 2 k R 2 8 k 2 + 2 k R
98 97 adantr N ¬ 2 N R = N mod 8 k N = 8 k + R 8 k 2 + 2 k R 2 8 k 2 + 2 k R
99 dvdsaddre2b 2 R 2 1 8 8 k 2 + 2 k R 2 8 k 2 + 2 k R 2 R 2 1 8 2 8 k 2 + 2 k R + R 2 1 8
100 33 51 98 99 mp3an2ani N ¬ 2 N R = N mod 8 k N = 8 k + R 2 R 2 1 8 2 8 k 2 + 2 k R + R 2 1 8
101 32 100 bitr4d N ¬ 2 N R = N mod 8 k N = 8 k + R 2 N 2 1 8 2 R 2 1 8
102 101 ex N ¬ 2 N R = N mod 8 k N = 8 k + R 2 N 2 1 8 2 R 2 1 8
103 16 102 sylbid N ¬ 2 N R = N mod 8 k N = k 8 + R 2 N 2 1 8 2 R 2 1 8
104 103 rexlimdva N ¬ 2 N R = N mod 8 k N = k 8 + R 2 N 2 1 8 2 R 2 1 8
105 9 104 mpd N ¬ 2 N R = N mod 8 2 N 2 1 8 2 R 2 1 8