Metamath Proof Explorer


Theorem vfermltl

Description: Variant of Fermat's little theorem if A is not a multiple of P , see theorem 5.18 in ApostolNT p. 113. (Contributed by AV, 21-Aug-2020) (Proof shortened by AV, 5-Sep-2020)

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

Proof

Step Hyp Ref Expression
1 phiprm P ϕ P = P 1
2 1 eqcomd P P 1 = ϕ P
3 2 3ad2ant1 P A ¬ P A P 1 = ϕ P
4 3 oveq2d P A ¬ P A A P 1 = A ϕ P
5 4 oveq1d P A ¬ P A A P 1 mod P = A ϕ P mod P
6 prmnn P P
7 6 3ad2ant1 P A ¬ P A P
8 simp2 P A ¬ P A A
9 prmz P P
10 9 anim1ci P A A P
11 10 3adant3 P A ¬ P A A P
12 gcdcom A P A gcd P = P gcd A
13 11 12 syl P A ¬ P A A gcd P = P gcd A
14 coprm P A ¬ P A P gcd A = 1
15 14 biimp3a P A ¬ P A P gcd A = 1
16 13 15 eqtrd P A ¬ P A A gcd P = 1
17 eulerth P A A gcd P = 1 A ϕ P mod P = 1 mod P
18 7 8 16 17 syl3anc P A ¬ P A A ϕ P mod P = 1 mod P
19 6 nnred P P
20 prmgt1 P 1 < P
21 19 20 jca P P 1 < P
22 21 3ad2ant1 P A ¬ P A P 1 < P
23 1mod P 1 < P 1 mod P = 1
24 22 23 syl P A ¬ P A 1 mod P = 1
25 5 18 24 3eqtrd P A ¬ P A A P 1 mod P = 1