Metamath Proof Explorer


Theorem lgslem4

Description: Lemma for lgsfcl2 . (Contributed by Mario Carneiro, 4-Feb-2015) (Proof shortened by AV, 19-Mar-2022)

Ref Expression
Hypothesis lgslem2.z Z = x | x 1
Assertion lgslem4 A P 2 A P 1 2 + 1 mod P 1 Z

Proof

Step Hyp Ref Expression
1 lgslem2.z Z = x | x 1
2 eldifi P 2 P
3 2 adantl A P 2 P
4 simpl A P 2 A
5 oddprm P 2 P 1 2
6 5 adantl A P 2 P 1 2
7 prmdvdsexp P A P 1 2 P A P 1 2 P A
8 3 4 6 7 syl3anc A P 2 P A P 1 2 P A
9 8 biimpar A P 2 P A P A P 1 2
10 prmgt1 P 1 < P
11 2 10 syl P 2 1 < P
12 11 ad2antlr A P 2 P A 1 < P
13 p1modz1 P A P 1 2 1 < P A P 1 2 + 1 mod P = 1
14 9 12 13 syl2anc A P 2 P A A P 1 2 + 1 mod P = 1
15 14 oveq1d A P 2 P A A P 1 2 + 1 mod P 1 = 1 1
16 1m1e0 1 1 = 0
17 1 lgslem2 1 Z 0 Z 1 Z
18 17 simp2i 0 Z
19 16 18 eqeltri 1 1 Z
20 15 19 eqeltrdi A P 2 P A A P 1 2 + 1 mod P 1 Z
21 lgslem1 A P 2 ¬ P A A P 1 2 + 1 mod P 0 2
22 elpri A P 1 2 + 1 mod P 0 2 A P 1 2 + 1 mod P = 0 A P 1 2 + 1 mod P = 2
23 oveq1 A P 1 2 + 1 mod P = 0 A P 1 2 + 1 mod P 1 = 0 1
24 df-neg 1 = 0 1
25 17 simp1i 1 Z
26 24 25 eqeltrri 0 1 Z
27 23 26 eqeltrdi A P 1 2 + 1 mod P = 0 A P 1 2 + 1 mod P 1 Z
28 oveq1 A P 1 2 + 1 mod P = 2 A P 1 2 + 1 mod P 1 = 2 1
29 2m1e1 2 1 = 1
30 17 simp3i 1 Z
31 29 30 eqeltri 2 1 Z
32 28 31 eqeltrdi A P 1 2 + 1 mod P = 2 A P 1 2 + 1 mod P 1 Z
33 27 32 jaoi A P 1 2 + 1 mod P = 0 A P 1 2 + 1 mod P = 2 A P 1 2 + 1 mod P 1 Z
34 21 22 33 3syl A P 2 ¬ P A A P 1 2 + 1 mod P 1 Z
35 34 3expa A P 2 ¬ P A A P 1 2 + 1 mod P 1 Z
36 20 35 pm2.61dan A P 2 A P 1 2 + 1 mod P 1 Z