Metamath Proof Explorer


Theorem gausslemma2dlem6

Description: Lemma 6 for gausslemma2d . (Contributed by AV, 16-Jun-2021)

Ref Expression
Hypotheses gausslemma2d.p φ P 2
gausslemma2d.h H = P 1 2
gausslemma2d.r R = x 1 H if x 2 < P 2 x 2 P x 2
gausslemma2d.m M = P 4
gausslemma2d.n N = H M
Assertion gausslemma2dlem6 φ H ! mod P = 1 N 2 H H ! mod P

Proof

Step Hyp Ref Expression
1 gausslemma2d.p φ P 2
2 gausslemma2d.h H = P 1 2
3 gausslemma2d.r R = x 1 H if x 2 < P 2 x 2 P x 2
4 gausslemma2d.m M = P 4
5 gausslemma2d.n N = H M
6 1 2 3 4 gausslemma2dlem4 φ H ! = k = 1 M R k k = M + 1 H R k
7 6 oveq1d φ H ! mod P = k = 1 M R k k = M + 1 H R k mod P
8 fzfid φ 1 M Fin
9 1 2 3 4 gausslemma2dlem2 φ k 1 M R k = k 2
10 9 adantr φ k 1 M k 1 M R k = k 2
11 rspa k 1 M R k = k 2 k 1 M R k = k 2
12 11 expcom k 1 M k 1 M R k = k 2 R k = k 2
13 12 adantl φ k 1 M k 1 M R k = k 2 R k = k 2
14 elfzelz k 1 M k
15 2z 2
16 15 a1i k 1 M 2
17 14 16 zmulcld k 1 M k 2
18 17 adantl φ k 1 M k 2
19 eleq1 R k = k 2 R k k 2
20 18 19 syl5ibrcom φ k 1 M R k = k 2 R k
21 13 20 syld φ k 1 M k 1 M R k = k 2 R k
22 10 21 mpd φ k 1 M R k
23 8 22 fprodzcl φ k = 1 M R k
24 fzfid φ M + 1 H Fin
25 1 2 3 4 gausslemma2dlem3 φ k M + 1 H R k = P k 2
26 25 adantr φ k M + 1 H k M + 1 H R k = P k 2
27 rspa k M + 1 H R k = P k 2 k M + 1 H R k = P k 2
28 27 expcom k M + 1 H k M + 1 H R k = P k 2 R k = P k 2
29 28 adantl φ k M + 1 H k M + 1 H R k = P k 2 R k = P k 2
30 1 gausslemma2dlem0a φ P
31 30 nnzd φ P
32 elfzelz k M + 1 H k
33 15 a1i k M + 1 H 2
34 32 33 zmulcld k M + 1 H k 2
35 zsubcl P k 2 P k 2
36 31 34 35 syl2an φ k M + 1 H P k 2
37 eleq1 R k = P k 2 R k P k 2
38 36 37 syl5ibrcom φ k M + 1 H R k = P k 2 R k
39 29 38 syld φ k M + 1 H k M + 1 H R k = P k 2 R k
40 26 39 mpd φ k M + 1 H R k
41 24 40 fprodzcl φ k = M + 1 H R k
42 41 zred φ k = M + 1 H R k
43 nnoddn2prm P 2 P ¬ 2 P
44 nnrp P P +
45 44 adantr P ¬ 2 P P +
46 1 43 45 3syl φ P +
47 modmulmodr k = 1 M R k k = M + 1 H R k P + k = 1 M R k k = M + 1 H R k mod P mod P = k = 1 M R k k = M + 1 H R k mod P
48 47 eqcomd k = 1 M R k k = M + 1 H R k P + k = 1 M R k k = M + 1 H R k mod P = k = 1 M R k k = M + 1 H R k mod P mod P
49 23 42 46 48 syl3anc φ k = 1 M R k k = M + 1 H R k mod P = k = 1 M R k k = M + 1 H R k mod P mod P
50 1 2 3 4 5 gausslemma2dlem5 φ k = M + 1 H R k mod P = 1 N k = M + 1 H k 2 mod P
51 50 oveq2d φ k = 1 M R k k = M + 1 H R k mod P = k = 1 M R k 1 N k = M + 1 H k 2 mod P
52 51 oveq1d φ k = 1 M R k k = M + 1 H R k mod P mod P = k = 1 M R k 1 N k = M + 1 H k 2 mod P mod P
53 neg1rr 1
54 53 a1i φ 1
55 1 4 2 5 gausslemma2dlem0h φ N 0
56 54 55 reexpcld φ 1 N
57 32 adantl φ k M + 1 H k
58 15 a1i φ k M + 1 H 2
59 57 58 zmulcld φ k M + 1 H k 2
60 24 59 fprodzcl φ k = M + 1 H k 2
61 60 zred φ k = M + 1 H k 2
62 56 61 remulcld φ 1 N k = M + 1 H k 2
63 modmulmodr k = 1 M R k 1 N k = M + 1 H k 2 P + k = 1 M R k 1 N k = M + 1 H k 2 mod P mod P = k = 1 M R k 1 N k = M + 1 H k 2 mod P
64 23 62 46 63 syl3anc φ k = 1 M R k 1 N k = M + 1 H k 2 mod P mod P = k = 1 M R k 1 N k = M + 1 H k 2 mod P
65 9 prodeq2d φ k = 1 M R k = k = 1 M k 2
66 65 oveq1d φ k = 1 M R k k = M + 1 H k 2 = k = 1 M k 2 k = M + 1 H k 2
67 fzfid φ 1 H Fin
68 elfzelz k 1 H k
69 68 zcnd k 1 H k
70 69 adantl φ k 1 H k
71 2cn 2
72 71 a1i φ k 1 H 2
73 67 70 72 fprodmul φ k = 1 H k 2 = k = 1 H k k = 1 H 2
74 1 4 gausslemma2dlem0d φ M 0
75 74 nn0red φ M
76 75 ltp1d φ M < M + 1
77 fzdisj M < M + 1 1 M M + 1 H =
78 76 77 syl φ 1 M M + 1 H =
79 1zzd φ 1
80 nn0pzuz M 0 1 M + 1 1
81 74 79 80 syl2anc φ M + 1 1
82 74 nn0zd φ M
83 1 2 gausslemma2dlem0b φ H
84 83 nnzd φ H
85 1 4 2 gausslemma2dlem0g φ M H
86 eluz2 H M M H M H
87 82 84 85 86 syl3anbrc φ H M
88 fzsplit2 M + 1 1 H M 1 H = 1 M M + 1 H
89 81 87 88 syl2anc φ 1 H = 1 M M + 1 H
90 15 a1i k 1 H 2
91 68 90 zmulcld k 1 H k 2
92 91 adantl φ k 1 H k 2
93 92 zcnd φ k 1 H k 2
94 78 89 67 93 fprodsplit φ k = 1 H k 2 = k = 1 M k 2 k = M + 1 H k 2
95 nnnn0 P P 0
96 95 anim1i P ¬ 2 P P 0 ¬ 2 P
97 43 96 syl P 2 P 0 ¬ 2 P
98 nn0oddm1d2 P 0 ¬ 2 P P 1 2 0
99 98 biimpa P 0 ¬ 2 P P 1 2 0
100 2 99 eqeltrid P 0 ¬ 2 P H 0
101 1 97 100 3syl φ H 0
102 fprodfac H 0 H ! = k = 1 H k
103 101 102 syl φ H ! = k = 1 H k
104 103 eqcomd φ k = 1 H k = H !
105 fzfi 1 H Fin
106 105 71 pm3.2i 1 H Fin 2
107 fprodconst 1 H Fin 2 k = 1 H 2 = 2 1 H
108 106 107 mp1i φ k = 1 H 2 = 2 1 H
109 104 108 oveq12d φ k = 1 H k k = 1 H 2 = H ! 2 1 H
110 hashfz1 H 0 1 H = H
111 101 110 syl φ 1 H = H
112 111 oveq2d φ 2 1 H = 2 H
113 112 oveq2d φ H ! 2 1 H = H ! 2 H
114 101 faccld φ H !
115 114 nncnd φ H !
116 2nn0 2 0
117 nn0expcl 2 0 H 0 2 H 0
118 117 nn0cnd 2 0 H 0 2 H
119 116 101 118 sylancr φ 2 H
120 115 119 mulcomd φ H ! 2 H = 2 H H !
121 109 113 120 3eqtrd φ k = 1 H k k = 1 H 2 = 2 H H !
122 73 94 121 3eqtr3d φ k = 1 M k 2 k = M + 1 H k 2 = 2 H H !
123 66 122 eqtrd φ k = 1 M R k k = M + 1 H k 2 = 2 H H !
124 123 oveq2d φ 1 N k = 1 M R k k = M + 1 H k 2 = 1 N 2 H H !
125 23 zcnd φ k = 1 M R k
126 56 recnd φ 1 N
127 60 zcnd φ k = M + 1 H k 2
128 125 126 127 mul12d φ k = 1 M R k 1 N k = M + 1 H k 2 = 1 N k = 1 M R k k = M + 1 H k 2
129 126 119 115 mulassd φ 1 N 2 H H ! = 1 N 2 H H !
130 124 128 129 3eqtr4d φ k = 1 M R k 1 N k = M + 1 H k 2 = 1 N 2 H H !
131 130 oveq1d φ k = 1 M R k 1 N k = M + 1 H k 2 mod P = 1 N 2 H H ! mod P
132 52 64 131 3eqtrd φ k = 1 M R k k = M + 1 H R k mod P mod P = 1 N 2 H H ! mod P
133 7 49 132 3eqtrd φ H ! mod P = 1 N 2 H H ! mod P