Metamath Proof Explorer


Theorem gausslemma2dlem5

Description: Lemma 5 for gausslemma2d . (Contributed by AV, 9-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
gausslemma2d.n N = H M
Assertion gausslemma2dlem5 φ k = M + 1 H R k mod P = 1 N k = M + 1 H 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 gausslemma2d.n N = H M
6 1 2 3 4 gausslemma2dlem5a φ k = M + 1 H R k mod P = k = M + 1 H -1 k 2 mod P
7 fzfi M + 1 H Fin
8 7 a1i φ M + 1 H Fin
9 neg1cn 1
10 9 a1i φ k M + 1 H 1
11 elfzelz k M + 1 H k
12 2z 2
13 12 a1i k M + 1 H 2
14 11 13 zmulcld k M + 1 H k 2
15 14 zcnd k M + 1 H k 2
16 15 adantl φ k M + 1 H k 2
17 8 10 16 fprodmul φ k = M + 1 H -1 k 2 = k = M + 1 H -1 k = M + 1 H k 2
18 7 9 pm3.2i M + 1 H Fin 1
19 fprodconst M + 1 H Fin 1 k = M + 1 H -1 = 1 M + 1 H
20 18 19 mp1i φ k = M + 1 H -1 = 1 M + 1 H
21 nnoddn2prm P 2 P ¬ 2 P
22 nnre P P
23 22 adantr P ¬ 2 P P
24 1 21 23 3syl φ P
25 4re 4
26 25 a1i φ 4
27 4ne0 4 0
28 27 a1i φ 4 0
29 24 26 28 redivcld φ P 4
30 29 flcld φ P 4
31 4 30 eqeltrid φ M
32 31 peano2zd φ M + 1
33 nnz P P
34 oddm1d2 P ¬ 2 P P 1 2
35 33 34 syl P ¬ 2 P P 1 2
36 35 biimpa P ¬ 2 P P 1 2
37 1 21 36 3syl φ P 1 2
38 2 37 eqeltrid φ H
39 1 4 2 gausslemma2dlem0f φ M + 1 H
40 eluz2 H M + 1 M + 1 H M + 1 H
41 32 38 39 40 syl3anbrc φ H M + 1
42 hashfz H M + 1 M + 1 H = H - M + 1 + 1
43 41 42 syl φ M + 1 H = H - M + 1 + 1
44 38 zcnd φ H
45 31 zcnd φ M
46 1cnd φ 1
47 44 45 46 nppcan2d φ H - M + 1 + 1 = H M
48 47 5 eqtr4di φ H - M + 1 + 1 = N
49 43 48 eqtrd φ M + 1 H = N
50 49 oveq2d φ 1 M + 1 H = 1 N
51 20 50 eqtrd φ k = M + 1 H -1 = 1 N
52 51 oveq1d φ k = M + 1 H -1 k = M + 1 H k 2 = 1 N k = M + 1 H k 2
53 17 52 eqtrd φ k = M + 1 H -1 k 2 = 1 N k = M + 1 H k 2
54 53 oveq1d φ k = M + 1 H -1 k 2 mod P = 1 N k = M + 1 H k 2 mod P
55 6 54 eqtrd φ k = M + 1 H R k mod P = 1 N k = M + 1 H k 2 mod P