Metamath Proof Explorer


Theorem gausslemma2dlem7

Description: Lemma 7 for gausslemma2d . (Contributed by AV, 13-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 gausslemma2dlem7 φ 1 N 2 H mod P = 1

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 5 gausslemma2dlem6 φ H ! mod P = 1 N 2 H H ! mod P
7 1 2 gausslemma2dlem0b φ H
8 7 nnnn0d φ H 0
9 8 faccld φ H !
10 9 nncnd φ H !
11 10 mulid2d φ 1 H ! = H !
12 11 eqcomd φ H ! = 1 H !
13 12 oveq1d φ H ! mod P = 1 H ! mod P
14 13 eqeq1d φ H ! mod P = 1 N 2 H H ! mod P 1 H ! mod P = 1 N 2 H H ! mod P
15 1zzd φ 1
16 neg1z 1
17 1 4 2 5 gausslemma2dlem0h φ N 0
18 zexpcl 1 N 0 1 N
19 16 17 18 sylancr φ 1 N
20 2z 2
21 zexpcl 2 H 0 2 H
22 20 8 21 sylancr φ 2 H
23 19 22 zmulcld φ 1 N 2 H
24 9 nnzd φ H !
25 eldifi P 2 P
26 prmnn P P
27 1 25 26 3syl φ P
28 1 2 gausslemma2dlem0c φ H ! gcd P = 1
29 cncongrcoprm 1 1 N 2 H H ! P H ! gcd P = 1 1 H ! mod P = 1 N 2 H H ! mod P 1 mod P = 1 N 2 H mod P
30 15 23 24 27 28 29 syl32anc φ 1 H ! mod P = 1 N 2 H H ! mod P 1 mod P = 1 N 2 H mod P
31 14 30 bitrd φ H ! mod P = 1 N 2 H H ! mod P 1 mod P = 1 N 2 H mod P
32 simpr φ 1 mod P = 1 N 2 H mod P 1 mod P = 1 N 2 H mod P
33 26 nnred P P
34 prmgt1 P 1 < P
35 33 34 jca P P 1 < P
36 25 35 syl P 2 P 1 < P
37 1mod P 1 < P 1 mod P = 1
38 1 36 37 3syl φ 1 mod P = 1
39 38 adantr φ 1 mod P = 1 N 2 H mod P 1 mod P = 1
40 32 39 eqtr3d φ 1 mod P = 1 N 2 H mod P 1 N 2 H mod P = 1
41 40 ex φ 1 mod P = 1 N 2 H mod P 1 N 2 H mod P = 1
42 31 41 sylbid φ H ! mod P = 1 N 2 H H ! mod P 1 N 2 H mod P = 1
43 6 42 mpd φ 1 N 2 H mod P = 1