Metamath Proof Explorer


Theorem gausslemma2dlem5a

Description: Lemma for gausslemma2dlem5 . (Contributed by AV, 8-Jul-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
Assertion gausslemma2dlem5a φ k = M + 1 H R k mod P = k = M + 1 H -1 k 2 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 1 2 3 4 gausslemma2dlem3 φ k M + 1 H R k = P k 2
6 prodeq2 k M + 1 H R k = P k 2 k = M + 1 H R k = k = M + 1 H P k 2
7 6 oveq1d k M + 1 H R k = P k 2 k = M + 1 H R k mod P = k = M + 1 H P k 2 mod P
8 5 7 syl φ k = M + 1 H R k mod P = k = M + 1 H P k 2 mod P
9 eldifi P 2 P
10 fzfid P M + 1 H Fin
11 prmz P P
12 11 adantr P k M + 1 H P
13 elfzelz k M + 1 H k
14 2z 2
15 14 a1i k M + 1 H 2
16 13 15 zmulcld k M + 1 H k 2
17 16 adantl P k M + 1 H k 2
18 12 17 zsubcld P k M + 1 H P k 2
19 neg1z 1
20 19 a1i k M + 1 H 1
21 20 16 zmulcld k M + 1 H -1 k 2
22 21 adantl P k M + 1 H -1 k 2
23 prmnn P P
24 16 zcnd k M + 1 H k 2
25 24 mulm1d k M + 1 H -1 k 2 = k 2
26 25 adantl P k M + 1 H -1 k 2 = k 2
27 26 oveq1d P k M + 1 H -1 k 2 mod P = k 2 mod P
28 16 zred k M + 1 H k 2
29 23 nnrpd P P +
30 negmod k 2 P + k 2 mod P = P k 2 mod P
31 28 29 30 syl2anr P k M + 1 H k 2 mod P = P k 2 mod P
32 27 31 eqtr2d P k M + 1 H P k 2 mod P = -1 k 2 mod P
33 10 18 22 23 32 fprodmodd P k = M + 1 H P k 2 mod P = k = M + 1 H -1 k 2 mod P
34 1 9 33 3syl φ k = M + 1 H P k 2 mod P = k = M + 1 H -1 k 2 mod P
35 8 34 eqtrd φ k = M + 1 H R k mod P = k = M + 1 H -1 k 2 mod P