Metamath Proof Explorer


Theorem vfermltlALT

Description: Alternate proof of vfermltl , not using Euler's theorem. (Contributed by AV, 21-Aug-2020) (New usage is discouraged.) (Proof modification is discouraged.)

Ref Expression
Assertion vfermltlALT P A ¬ P A A P 1 mod P = 1

Proof

Step Hyp Ref Expression
1 2m1e1 2 1 = 1
2 1 a1i P 2 1 = 1
3 2 eqcomd P 1 = 2 1
4 3 oveq2d P P 1 = P 2 1
5 prmz P P
6 5 zcnd P P
7 2cnd P 2
8 1cnd P 1
9 6 7 8 subsubd P P 2 1 = P - 2 + 1
10 4 9 eqtrd P P 1 = P - 2 + 1
11 10 3ad2ant1 P A ¬ P A P 1 = P - 2 + 1
12 11 oveq2d P A ¬ P A A P 1 = A P - 2 + 1
13 zcn A A
14 13 3ad2ant2 P A ¬ P A A
15 prmm2nn0 P P 2 0
16 15 3ad2ant1 P A ¬ P A P 2 0
17 14 16 expp1d P A ¬ P A A P - 2 + 1 = A P 2 A
18 12 17 eqtrd P A ¬ P A A P 1 = A P 2 A
19 18 oveq1d P A ¬ P A A P 1 mod P = A P 2 A mod P
20 15 anim1i P A P 2 0 A
21 20 ancomd P A A P 2 0
22 zexpcl A P 2 0 A P 2
23 21 22 syl P A A P 2
24 23 zred P A A P 2
25 24 3adant3 P A ¬ P A A P 2
26 simp2 P A ¬ P A A
27 prmnn P P
28 27 nnrpd P P +
29 28 3ad2ant1 P A ¬ P A P +
30 modmulmod A P 2 A P + A P 2 mod P A mod P = A P 2 A mod P
31 25 26 29 30 syl3anc P A ¬ P A A P 2 mod P A mod P = A P 2 A mod P
32 zre A A
33 32 adantl P A A
34 15 adantr P A P 2 0
35 33 34 reexpcld P A A P 2
36 28 adantr P A P +
37 35 36 modcld P A A P 2 mod P
38 37 recnd P A A P 2 mod P
39 13 adantl P A A
40 38 39 mulcomd P A A P 2 mod P A = A A P 2 mod P
41 40 3adant3 P A ¬ P A A P 2 mod P A = A A P 2 mod P
42 41 oveq1d P A ¬ P A A P 2 mod P A mod P = A A P 2 mod P mod P
43 19 31 42 3eqtr2d P A ¬ P A A P 1 mod P = A A P 2 mod P mod P
44 eqid A P 2 mod P = A P 2 mod P
45 44 modprminv P A ¬ P A A P 2 mod P 1 P 1 A A P 2 mod P mod P = 1
46 45 simprd P A ¬ P A A A P 2 mod P mod P = 1
47 43 46 eqtrd P A ¬ P A A P 1 mod P = 1