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

Theorem eulerth 16581
Description: Euler's theorem, a generalization of Fermat's little theorem. If 𝐴 and 𝑁 are coprime, then 𝐴↑ϕ(𝑁)≡1 (mod 𝑁). This is Metamath 100 proof #10. Also called Euler-Fermat theorem, see theorem 5.17 in [ApostolNT] p. 113. (Contributed by Mario Carneiro, 28-Feb-2014.)
Assertion
Ref Expression
eulerth ((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) → ((𝐴↑(ϕ‘𝑁)) mod 𝑁) = (1 mod 𝑁))

Proof of Theorem eulerth
Dummy variables 𝑓 𝑘 𝑥 𝑦 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 phicl 16567 . . . . . . . 8 (𝑁 ∈ ℕ → (ϕ‘𝑁) ∈ ℕ)
21nnnn0d 12394 . . . . . . 7 (𝑁 ∈ ℕ → (ϕ‘𝑁) ∈ ℕ0)
3 hashfz1 14161 . . . . . . 7 ((ϕ‘𝑁) ∈ ℕ0 → (♯‘(1...(ϕ‘𝑁))) = (ϕ‘𝑁))
42, 3syl 17 . . . . . 6 (𝑁 ∈ ℕ → (♯‘(1...(ϕ‘𝑁))) = (ϕ‘𝑁))
5 dfphi2 16572 . . . . . 6 (𝑁 ∈ ℕ → (ϕ‘𝑁) = (♯‘{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}))
64, 5eqtrd 2776 . . . . 5 (𝑁 ∈ ℕ → (♯‘(1...(ϕ‘𝑁))) = (♯‘{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}))
763ad2ant1 1132 . . . 4 ((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) → (♯‘(1...(ϕ‘𝑁))) = (♯‘{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}))
8 fzfi 13793 . . . . 5 (1...(ϕ‘𝑁)) ∈ Fin
9 fzofi 13795 . . . . . 6 (0..^𝑁) ∈ Fin
10 ssrab2 4025 . . . . . 6 {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ⊆ (0..^𝑁)
11 ssfi 9038 . . . . . 6 (((0..^𝑁) ∈ Fin ∧ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ⊆ (0..^𝑁)) → {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ∈ Fin)
129, 10, 11mp2an 689 . . . . 5 {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ∈ Fin
13 hashen 14162 . . . . 5 (((1...(ϕ‘𝑁)) ∈ Fin ∧ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ∈ Fin) → ((♯‘(1...(ϕ‘𝑁))) = (♯‘{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}) ↔ (1...(ϕ‘𝑁)) ≈ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}))
148, 12, 13mp2an 689 . . . 4 ((♯‘(1...(ϕ‘𝑁))) = (♯‘{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}) ↔ (1...(ϕ‘𝑁)) ≈ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1})
157, 14sylib 217 . . 3 ((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) → (1...(ϕ‘𝑁)) ≈ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1})
16 bren 8814 . . 3 ((1...(ϕ‘𝑁)) ≈ {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} ↔ ∃𝑓 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1})
1715, 16sylib 217 . 2 ((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) → ∃𝑓 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1})
18 simpl 483 . . 3 (((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) ∧ 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}) → (𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1))
19 oveq1 7344 . . . . 5 (𝑘 = 𝑦 → (𝑘 gcd 𝑁) = (𝑦 gcd 𝑁))
2019eqeq1d 2738 . . . 4 (𝑘 = 𝑦 → ((𝑘 gcd 𝑁) = 1 ↔ (𝑦 gcd 𝑁) = 1))
2120cbvrabv 3413 . . 3 {𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1} = {𝑦 ∈ (0..^𝑁) ∣ (𝑦 gcd 𝑁) = 1}
22 eqid 2736 . . 3 (1...(ϕ‘𝑁)) = (1...(ϕ‘𝑁))
23 simpr 485 . . 3 (((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) ∧ 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}) → 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1})
24 fveq2 6825 . . . . . 6 (𝑘 = 𝑥 → (𝑓𝑘) = (𝑓𝑥))
2524oveq2d 7353 . . . . 5 (𝑘 = 𝑥 → (𝐴 · (𝑓𝑘)) = (𝐴 · (𝑓𝑥)))
2625oveq1d 7352 . . . 4 (𝑘 = 𝑥 → ((𝐴 · (𝑓𝑘)) mod 𝑁) = ((𝐴 · (𝑓𝑥)) mod 𝑁))
2726cbvmptv 5205 . . 3 (𝑘 ∈ (1...(ϕ‘𝑁)) ↦ ((𝐴 · (𝑓𝑘)) mod 𝑁)) = (𝑥 ∈ (1...(ϕ‘𝑁)) ↦ ((𝐴 · (𝑓𝑥)) mod 𝑁))
2818, 21, 22, 23, 27eulerthlem2 16580 . 2 (((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) ∧ 𝑓:(1...(ϕ‘𝑁))–1-1-onto→{𝑘 ∈ (0..^𝑁) ∣ (𝑘 gcd 𝑁) = 1}) → ((𝐴↑(ϕ‘𝑁)) mod 𝑁) = (1 mod 𝑁))
2917, 28exlimddv 1937 1 ((𝑁 ∈ ℕ ∧ 𝐴 ∈ ℤ ∧ (𝐴 gcd 𝑁) = 1) → ((𝐴↑(ϕ‘𝑁)) mod 𝑁) = (1 mod 𝑁))
Colors of variables: wff setvar class
Syntax hints:  wi 4  wb 205  wa 396  w3a 1086   = wceq 1540  wex 1780  wcel 2105  {crab 3403  wss 3898   class class class wbr 5092  cmpt 5175  1-1-ontowf1o 6478  cfv 6479  (class class class)co 7337  cen 8801  Fincfn 8804  0cc0 10972  1c1 10973   · cmul 10977  cn 12074  0cn0 12334  cz 12420  ...cfz 13340  ..^cfzo 13483   mod cmo 13690  cexp 13883  chash 14145   gcd cgcd 16300  ϕcphi 16562
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1796  ax-4 1810  ax-5 1912  ax-6 1970  ax-7 2010  ax-8 2107  ax-9 2115  ax-10 2136  ax-11 2153  ax-12 2170  ax-ext 2707  ax-rep 5229  ax-sep 5243  ax-nul 5250  ax-pow 5308  ax-pr 5372  ax-un 7650  ax-cnex 11028  ax-resscn 11029  ax-1cn 11030  ax-icn 11031  ax-addcl 11032  ax-addrcl 11033  ax-mulcl 11034  ax-mulrcl 11035  ax-mulcom 11036  ax-addass 11037  ax-mulass 11038  ax-distr 11039  ax-i2m1 11040  ax-1ne0 11041  ax-1rid 11042  ax-rnegex 11043  ax-rrecex 11044  ax-cnre 11045  ax-pre-lttri 11046  ax-pre-lttrn 11047  ax-pre-ltadd 11048  ax-pre-mulgt0 11049  ax-pre-sup 11050
This theorem depends on definitions:  df-bi 206  df-an 397  df-or 845  df-3or 1087  df-3an 1088  df-tru 1543  df-fal 1553  df-ex 1781  df-nf 1785  df-sb 2067  df-mo 2538  df-eu 2567  df-clab 2714  df-cleq 2728  df-clel 2814  df-nfc 2886  df-ne 2941  df-nel 3047  df-ral 3062  df-rex 3071  df-rmo 3349  df-reu 3350  df-rab 3404  df-v 3443  df-sbc 3728  df-csb 3844  df-dif 3901  df-un 3903  df-in 3905  df-ss 3915  df-pss 3917  df-nul 4270  df-if 4474  df-pw 4549  df-sn 4574  df-pr 4576  df-op 4580  df-uni 4853  df-int 4895  df-iun 4943  df-br 5093  df-opab 5155  df-mpt 5176  df-tr 5210  df-id 5518  df-eprel 5524  df-po 5532  df-so 5533  df-fr 5575  df-we 5577  df-xp 5626  df-rel 5627  df-cnv 5628  df-co 5629  df-dm 5630  df-rn 5631  df-res 5632  df-ima 5633  df-pred 6238  df-ord 6305  df-on 6306  df-lim 6307  df-suc 6308  df-iota 6431  df-fun 6481  df-fn 6482  df-f 6483  df-f1 6484  df-fo 6485  df-f1o 6486  df-fv 6487  df-riota 7293  df-ov 7340  df-oprab 7341  df-mpo 7342  df-om 7781  df-1st 7899  df-2nd 7900  df-frecs 8167  df-wrecs 8198  df-recs 8272  df-rdg 8311  df-1o 8367  df-oadd 8371  df-er 8569  df-en 8805  df-dom 8806  df-sdom 8807  df-fin 8808  df-sup 9299  df-inf 9300  df-card 9796  df-pnf 11112  df-mnf 11113  df-xr 11114  df-ltxr 11115  df-le 11116  df-sub 11308  df-neg 11309  df-div 11734  df-nn 12075  df-2 12137  df-3 12138  df-n0 12335  df-xnn0 12407  df-z 12421  df-uz 12684  df-rp 12832  df-fz 13341  df-fzo 13484  df-fl 13613  df-mod 13691  df-seq 13823  df-exp 13884  df-hash 14146  df-cj 14909  df-re 14910  df-im 14911  df-sqrt 15045  df-abs 15046  df-dvds 16063  df-gcd 16301  df-phi 16564
This theorem is referenced by:  fermltl  16582  prmdiv  16583  odzcllem  16590  odzphi  16594  vfermltl  16599  lgslem1  26551  lgsqrlem2  26601
  Copyright terms: Public domain W3C validator