MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  fermltl Structured version   Visualization version   GIF version

Theorem fermltl 15954
Description: Fermat's little theorem. When 𝑃 is prime, 𝐴𝑃𝐴 (mod 𝑃) for any 𝐴, see theorem 5.19 in [ApostolNT] p. 114. (Contributed by Mario Carneiro, 28-Feb-2014.) (Proof shortened by AV, 19-Mar-2022.)
Assertion
Ref Expression
fermltl ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃))

Proof of Theorem fermltl
StepHypRef Expression
1 prmnn 15851 . . . 4 (𝑃 ∈ ℙ → 𝑃 ∈ ℕ)
2 dvdsmodexp 15452 . . . . 5 ((𝑃 ∈ ℕ ∧ 𝑃 ∈ ℕ ∧ 𝑃𝐴) → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃))
323exp 1112 . . . 4 (𝑃 ∈ ℕ → (𝑃 ∈ ℕ → (𝑃𝐴 → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃))))
41, 1, 3sylc 65 . . 3 (𝑃 ∈ ℙ → (𝑃𝐴 → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃)))
54adantr 481 . 2 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → (𝑃𝐴 → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃)))
6 coprm 15888 . . . 4 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → (¬ 𝑃𝐴 ↔ (𝑃 gcd 𝐴) = 1))
7 prmz 15852 . . . . . 6 (𝑃 ∈ ℙ → 𝑃 ∈ ℤ)
8 gcdcom 15699 . . . . . 6 ((𝑃 ∈ ℤ ∧ 𝐴 ∈ ℤ) → (𝑃 gcd 𝐴) = (𝐴 gcd 𝑃))
97, 8sylan 580 . . . . 5 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → (𝑃 gcd 𝐴) = (𝐴 gcd 𝑃))
109eqeq1d 2799 . . . 4 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → ((𝑃 gcd 𝐴) = 1 ↔ (𝐴 gcd 𝑃) = 1))
116, 10bitrd 280 . . 3 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → (¬ 𝑃𝐴 ↔ (𝐴 gcd 𝑃) = 1))
12 simp2 1130 . . . . . . . 8 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → 𝐴 ∈ ℤ)
1313ad2ant1 1126 . . . . . . . . . 10 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → 𝑃 ∈ ℕ)
1413phicld 15942 . . . . . . . . 9 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (ϕ‘𝑃) ∈ ℕ)
1514nnnn0d 11809 . . . . . . . 8 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (ϕ‘𝑃) ∈ ℕ0)
16 zexpcl 13298 . . . . . . . 8 ((𝐴 ∈ ℤ ∧ (ϕ‘𝑃) ∈ ℕ0) → (𝐴↑(ϕ‘𝑃)) ∈ ℤ)
1712, 15, 16syl2anc 584 . . . . . . 7 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (𝐴↑(ϕ‘𝑃)) ∈ ℤ)
1817zred 11941 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (𝐴↑(ϕ‘𝑃)) ∈ ℝ)
19 1red 10495 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → 1 ∈ ℝ)
2013nnrpd 12283 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → 𝑃 ∈ ℝ+)
21 eulerth 15953 . . . . . . 7 ((𝑃 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((𝐴↑(ϕ‘𝑃)) mod 𝑃) = (1 mod 𝑃))
221, 21syl3an1 1156 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((𝐴↑(ϕ‘𝑃)) mod 𝑃) = (1 mod 𝑃))
23 modmul1 13146 . . . . . 6 ((((𝐴↑(ϕ‘𝑃)) ∈ ℝ ∧ 1 ∈ ℝ) ∧ (𝐴 ∈ ℤ ∧ 𝑃 ∈ ℝ+) ∧ ((𝐴↑(ϕ‘𝑃)) mod 𝑃) = (1 mod 𝑃)) → (((𝐴↑(ϕ‘𝑃)) · 𝐴) mod 𝑃) = ((1 · 𝐴) mod 𝑃))
2418, 19, 12, 20, 22, 23syl221anc 1374 . . . . 5 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (((𝐴↑(ϕ‘𝑃)) · 𝐴) mod 𝑃) = ((1 · 𝐴) mod 𝑃))
25 phiprm 15947 . . . . . . . . . 10 (𝑃 ∈ ℙ → (ϕ‘𝑃) = (𝑃 − 1))
26253ad2ant1 1126 . . . . . . . . 9 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (ϕ‘𝑃) = (𝑃 − 1))
2726oveq2d 7039 . . . . . . . 8 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (𝐴↑(ϕ‘𝑃)) = (𝐴↑(𝑃 − 1)))
2827oveq1d 7038 . . . . . . 7 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((𝐴↑(ϕ‘𝑃)) · 𝐴) = ((𝐴↑(𝑃 − 1)) · 𝐴))
2912zcnd 11942 . . . . . . . 8 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → 𝐴 ∈ ℂ)
30 expm1t 13311 . . . . . . . 8 ((𝐴 ∈ ℂ ∧ 𝑃 ∈ ℕ) → (𝐴𝑃) = ((𝐴↑(𝑃 − 1)) · 𝐴))
3129, 13, 30syl2anc 584 . . . . . . 7 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (𝐴𝑃) = ((𝐴↑(𝑃 − 1)) · 𝐴))
3228, 31eqtr4d 2836 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((𝐴↑(ϕ‘𝑃)) · 𝐴) = (𝐴𝑃))
3332oveq1d 7038 . . . . 5 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (((𝐴↑(ϕ‘𝑃)) · 𝐴) mod 𝑃) = ((𝐴𝑃) mod 𝑃))
3429mulid2d 10512 . . . . . 6 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → (1 · 𝐴) = 𝐴)
3534oveq1d 7038 . . . . 5 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((1 · 𝐴) mod 𝑃) = (𝐴 mod 𝑃))
3624, 33, 353eqtr3d 2841 . . . 4 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑃) = 1) → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃))
37363expia 1114 . . 3 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → ((𝐴 gcd 𝑃) = 1 → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃)))
3811, 37sylbid 241 . 2 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → (¬ 𝑃𝐴 → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃)))
395, 38pm2.61d 180 1 ((𝑃 ∈ ℙ ∧ 𝐴 ∈ ℤ) → ((𝐴𝑃) mod 𝑃) = (𝐴 mod 𝑃))
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wa 396  w3a 1080   = wceq 1525  wcel 2083   class class class wbr 4968  cfv 6232  (class class class)co 7023  cc 10388  cr 10389  1c1 10391   · cmul 10395  cmin 10723  cn 11492  0cn0 11751  cz 11835  +crp 12243   mod cmo 13091  cexp 13283  cdvds 15444   gcd cgcd 15680  cprime 15848  ϕcphi 15934
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1781  ax-4 1795  ax-5 1892  ax-6 1951  ax-7 1996  ax-8 2085  ax-9 2093  ax-10 2114  ax-11 2128  ax-12 2143  ax-13 2346  ax-ext 2771  ax-rep 5088  ax-sep 5101  ax-nul 5108  ax-pow 5164  ax-pr 5228  ax-un 7326  ax-cnex 10446  ax-resscn 10447  ax-1cn 10448  ax-icn 10449  ax-addcl 10450  ax-addrcl 10451  ax-mulcl 10452  ax-mulrcl 10453  ax-mulcom 10454  ax-addass 10455  ax-mulass 10456  ax-distr 10457  ax-i2m1 10458  ax-1ne0 10459  ax-1rid 10460  ax-rnegex 10461  ax-rrecex 10462  ax-cnre 10463  ax-pre-lttri 10464  ax-pre-lttrn 10465  ax-pre-ltadd 10466  ax-pre-mulgt0 10467  ax-pre-sup 10468
This theorem depends on definitions:  df-bi 208  df-an 397  df-or 843  df-3or 1081  df-3an 1082  df-tru 1528  df-ex 1766  df-nf 1770  df-sb 2045  df-mo 2578  df-eu 2614  df-clab 2778  df-cleq 2790  df-clel 2865  df-nfc 2937  df-ne 2987  df-nel 3093  df-ral 3112  df-rex 3113  df-reu 3114  df-rmo 3115  df-rab 3116  df-v 3442  df-sbc 3712  df-csb 3818  df-dif 3868  df-un 3870  df-in 3872  df-ss 3880  df-pss 3882  df-nul 4218  df-if 4388  df-pw 4461  df-sn 4479  df-pr 4481  df-tp 4483  df-op 4485  df-uni 4752  df-int 4789  df-iun 4833  df-br 4969  df-opab 5031  df-mpt 5048  df-tr 5071  df-id 5355  df-eprel 5360  df-po 5369  df-so 5370  df-fr 5409  df-we 5411  df-xp 5456  df-rel 5457  df-cnv 5458  df-co 5459  df-dm 5460  df-rn 5461  df-res 5462  df-ima 5463  df-pred 6030  df-ord 6076  df-on 6077  df-lim 6078  df-suc 6079  df-iota 6196  df-fun 6234  df-fn 6235  df-f 6236  df-f1 6237  df-fo 6238  df-f1o 6239  df-fv 6240  df-riota 6984  df-ov 7026  df-oprab 7027  df-mpo 7028  df-om 7444  df-1st 7552  df-2nd 7553  df-wrecs 7805  df-recs 7867  df-rdg 7905  df-1o 7960  df-2o 7961  df-oadd 7964  df-er 8146  df-map 8265  df-en 8365  df-dom 8366  df-sdom 8367  df-fin 8368  df-sup 8759  df-inf 8760  df-dju 9183  df-card 9221  df-pnf 10530  df-mnf 10531  df-xr 10532  df-ltxr 10533  df-le 10534  df-sub 10725  df-neg 10726  df-div 11152  df-nn 11493  df-2 11554  df-3 11555  df-n0 11752  df-xnn0 11822  df-z 11836  df-uz 12098  df-rp 12244  df-fz 12747  df-fzo 12888  df-fl 13016  df-mod 13092  df-seq 13224  df-exp 13284  df-hash 13545  df-cj 14296  df-re 14297  df-im 14298  df-sqrt 14432  df-abs 14433  df-dvds 15445  df-gcd 15681  df-prm 15849  df-phi 15936
This theorem is referenced by: (None)
  Copyright terms: Public domain W3C validator