number_theory.primes_congruent_oneMathlib.NumberTheory.PrimesCongruentOne

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -48,7 +48,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
     by
     rw [is_root.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_cast_ring_hom, ←
       Int.cast_natCast, ← Int.coe_castRingHom, eval₂_hom, Int.coe_castRingHom,
-      ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
+      ZMod.intCast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
     exact_mod_cast min_fac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=
Diff
@@ -46,8 +46,9 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   haveI hprime : Fact p.prime := ⟨min_fac_prime (ne_of_lt hgt).symm⟩
   have hroot : is_root (cyclotomic k (ZMod p)) (cast_ring_hom (ZMod p) b) :=
     by
-    rw [is_root.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_cast_ring_hom, ← Int.cast_ofNat,
-      ← Int.coe_castRingHom, eval₂_hom, Int.coe_castRingHom, ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
+    rw [is_root.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_cast_ring_hom, ←
+      Int.cast_natCast, ← Int.coe_castRingHom, eval₂_hom, Int.coe_castRingHom,
+      ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
     exact_mod_cast min_fac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=
Diff
@@ -59,7 +59,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
     haveI : NeZero (k : ZMod p) :=
       NeZero.of_not_dvd (ZMod p) fun hpk => hpb (dvd_mul_of_dvd_left hpk _)
     have : k = orderOf (b : ZMod p) := (is_root_cyclotomic_iff.mp hroot).eq_orderOf
-    rw [← this] at hdiv 
+    rw [← this] at hdiv
     exact ((modeq_iff_dvd' hprime.1.Pos).2 hdiv).symm
 #align nat.exists_prime_gt_modeq_one Nat.exists_prime_gt_modEq_one
 -/
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2020 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 -/
-import Mathbin.RingTheory.Polynomial.Cyclotomic.Eval
+import RingTheory.Polynomial.Cyclotomic.Eval
 
 #align_import number_theory.primes_congruent_one from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2020 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
-
-! This file was ported from Lean 3 source module number_theory.primes_congruent_one
-! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.Polynomial.Cyclotomic.Eval
 
+#align_import number_theory.primes_congruent_one from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
+
 /-!
 # Primes congruent to one
 
Diff
@@ -27,6 +27,7 @@ open Polynomial Nat Filter
 
 open scoped Nat
 
+#print Nat.exists_prime_gt_modEq_one /-
 /-- For any positive `k : ℕ` there exists an arbitrarily large prime `p` such that
 `p ≡ 1 [MOD k]`. -/
 theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
@@ -64,7 +65,9 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
     rw [← this] at hdiv 
     exact ((modeq_iff_dvd' hprime.1.Pos).2 hdiv).symm
 #align nat.exists_prime_gt_modeq_one Nat.exists_prime_gt_modEq_one
+-/
 
+#print Nat.frequently_atTop_modEq_one /-
 theorem frequently_atTop_modEq_one {k : ℕ} (hk0 : k ≠ 0) :
     ∃ᶠ p in atTop, Nat.Prime p ∧ p ≡ 1 [MOD k] :=
   by
@@ -72,12 +75,15 @@ theorem frequently_atTop_modEq_one {k : ℕ} (hk0 : k ≠ 0) :
   obtain ⟨p, hp⟩ := exists_prime_gt_modeq_one n hk0
   exact ⟨p, ⟨hp.2.1.le, hp.1, hp.2.2⟩⟩
 #align nat.frequently_at_top_modeq_one Nat.frequently_atTop_modEq_one
+-/
 
+#print Nat.infinite_setOf_prime_modEq_one /-
 /-- For any positive `k : ℕ` there are infinitely many primes `p` such that `p ≡ 1 [MOD k]`. -/
 theorem infinite_setOf_prime_modEq_one {k : ℕ} (hk0 : k ≠ 0) :
     Set.Infinite {p : ℕ | Nat.Prime p ∧ p ≡ 1 [MOD k]} :=
   frequently_atTop_iff_infinite.1 (frequently_atTop_modEq_one hk0)
 #align nat.infinite_set_of_prime_modeq_one Nat.infinite_setOf_prime_modEq_one
+-/
 
 end Nat
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 
 ! This file was ported from Lean 3 source module number_theory.primes_congruent_one
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.RingTheory.Polynomial.Cyclotomic.Eval
 /-!
 # Primes congruent to one
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We prove that, for any positive `k : ℕ`, there are infinitely many primes `p` such that
 `p ≡ 1 [MOD k]`.
 -/
Diff
@@ -41,7 +41,6 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
       1 ≤ b - 1 := le_tsub_of_add_le_left hb
       _ < (eval (b : ℤ) (cyclotomic (k + 1) ℤ)).natAbs :=
         sub_one_lt_nat_abs_cyclotomic_eval hk1 (succ_le_iff.1 hb).ne'
-      
   let p := min_fac (eval (↑b) (cyclotomic k ℤ)).natAbs
   haveI hprime : Fact p.prime := ⟨min_fac_prime (ne_of_lt hgt).symm⟩
   have hroot : is_root (cyclotomic k (ZMod p)) (cast_ring_hom (ZMod p) b) :=
Diff
@@ -73,7 +73,7 @@ theorem frequently_atTop_modEq_one {k : ℕ} (hk0 : k ≠ 0) :
 
 /-- For any positive `k : ℕ` there are infinitely many primes `p` such that `p ≡ 1 [MOD k]`. -/
 theorem infinite_setOf_prime_modEq_one {k : ℕ} (hk0 : k ≠ 0) :
-    Set.Infinite { p : ℕ | Nat.Prime p ∧ p ≡ 1 [MOD k] } :=
+    Set.Infinite {p : ℕ | Nat.Prime p ∧ p ≡ 1 [MOD k]} :=
   frequently_atTop_iff_infinite.1 (frequently_atTop_modEq_one hk0)
 #align nat.infinite_set_of_prime_modeq_one Nat.infinite_setOf_prime_modEq_one
 
Diff
@@ -59,7 +59,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
     haveI : NeZero (k : ZMod p) :=
       NeZero.of_not_dvd (ZMod p) fun hpk => hpb (dvd_mul_of_dvd_left hpk _)
     have : k = orderOf (b : ZMod p) := (is_root_cyclotomic_iff.mp hroot).eq_orderOf
-    rw [← this] at hdiv
+    rw [← this] at hdiv 
     exact ((modeq_iff_dvd' hprime.1.Pos).2 hdiv).symm
 #align nat.exists_prime_gt_modeq_one Nat.exists_prime_gt_modEq_one
 
Diff
@@ -22,7 +22,7 @@ namespace Nat
 
 open Polynomial Nat Filter
 
-open Nat
+open scoped Nat
 
 /-- For any positive `k : ℕ` there exists an arbitrarily large prime `p` such that
 `p ≡ 1 [MOD k]`. -/
Diff
@@ -4,11 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 
 ! This file was ported from Lean 3 source module number_theory.primes_congruent_one
-! leanprover-community/mathlib commit 55d224c38461be1e8e4363247dd110137c24a4ff
+! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Data.Nat.PrimeFin
 import Mathbin.RingTheory.Polynomial.Cyclotomic.Eval
 
 /-!
Diff
@@ -48,7 +48,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   have hroot : is_root (cyclotomic k (ZMod p)) (cast_ring_hom (ZMod p) b) :=
     by
     rw [is_root.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_cast_ring_hom, ← Int.cast_ofNat,
-      ← Int.coe_castRingHom, eval₂_hom, Int.coe_castRingHom, ZMod.int_coe_zMod_eq_zero_iff_dvd _ _]
+      ← Int.coe_castRingHom, eval₂_hom, Int.coe_castRingHom, ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
     exact_mod_cast min_fac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=

Changes in mathlib4

mathlib3
mathlib4
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -41,8 +41,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   have hroot : IsRoot (cyclotomic k (ZMod p)) (castRingHom (ZMod p) b) := by
     have : ((b : ℤ) : ZMod p) = ↑(Int.castRingHom (ZMod p) b) := by simp
     rw [IsRoot.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom,
-      ← Int.cast_natCast, this, eval₂_hom, Int.coe_castRingHom,
-      ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
+      ← Int.cast_natCast, this, eval₂_hom, Int.coe_castRingHom, ZMod.intCast_zmod_eq_zero_iff_dvd]
     apply Int.dvd_natAbs.1
     exact mod_cast minFac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=
chore: rename IsRoot.definition back to IsRoot.def (#11999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -40,7 +40,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   haveI hprime : Fact p.Prime := ⟨minFac_prime (ne_of_lt hgt).symm⟩
   have hroot : IsRoot (cyclotomic k (ZMod p)) (castRingHom (ZMod p) b) := by
     have : ((b : ℤ) : ZMod p) = ↑(Int.castRingHom (ZMod p) b) := by simp
-    rw [IsRoot.definition, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom,
+    rw [IsRoot.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom,
       ← Int.cast_natCast, this, eval₂_hom, Int.coe_castRingHom,
       ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -41,7 +41,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   have hroot : IsRoot (cyclotomic k (ZMod p)) (castRingHom (ZMod p) b) := by
     have : ((b : ℤ) : ZMod p) = ↑(Int.castRingHom (ZMod p) b) := by simp
     rw [IsRoot.definition, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom,
-      ← Int.cast_ofNat, this, eval₂_hom, Int.coe_castRingHom,
+      ← Int.cast_natCast, this, eval₂_hom, Int.coe_castRingHom,
       ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
     exact mod_cast minFac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
chore: rename away from 'def' (#11548)

This will become an error in 2024-03-16 nightly, possibly not permanently.

Co-authored-by: Scott Morrison <scott@tqft.net>

Diff
@@ -40,8 +40,9 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
   haveI hprime : Fact p.Prime := ⟨minFac_prime (ne_of_lt hgt).symm⟩
   have hroot : IsRoot (cyclotomic k (ZMod p)) (castRingHom (ZMod p) b) := by
     have : ((b : ℤ) : ZMod p) = ↑(Int.castRingHom (ZMod p) b) := by simp
-    rw [IsRoot.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom, ← Int.cast_ofNat,
-      this, eval₂_hom, Int.coe_castRingHom, ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
+    rw [IsRoot.definition, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom,
+      ← Int.cast_ofNat, this, eval₂_hom, Int.coe_castRingHom,
+      ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
     exact mod_cast minFac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=
chore: replace exact_mod_cast tactic with mod_cast elaborator where possible (#8404)

We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -43,7 +43,7 @@ theorem exists_prime_gt_modEq_one {k : ℕ} (n : ℕ) (hk0 : k ≠ 0) :
     rw [IsRoot.def, ← map_cyclotomic_int k (ZMod p), eval_map, coe_castRingHom, ← Int.cast_ofNat,
       this, eval₂_hom, Int.coe_castRingHom, ZMod.int_cast_zmod_eq_zero_iff_dvd _ _]
     apply Int.dvd_natAbs.1
-    exact_mod_cast minFac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
+    exact mod_cast minFac_dvd (eval (↑b) (cyclotomic k ℤ)).natAbs
   have hpb : ¬p ∣ b :=
     hprime.1.coprime_iff_not_dvd.1 (coprime_of_root_cyclotomic hk0.bot_lt hroot).symm
   refine' ⟨p, hprime.1, not_le.1 fun habs => _, _⟩
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2020 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
-
-! This file was ported from Lean 3 source module number_theory.primes_congruent_one
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval
 
+#align_import number_theory.primes_congruent_one from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
+
 /-!
 # Primes congruent to one
 
feat: port NumberTheory.PrimesCongruentOne (#5146)

Dependencies 12 + 956

957 files ported (98.8%)
418648 lines ported (98.7%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file