fact stringlengths 6 3.84k | type stringclasses 11
values | library stringclasses 32
values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
one_add_α_pow_q_succ [Fact q.Prime] (odd : Odd q) (leg3 : legendreSym q 3 = -1) :
(1 + α : X q) ^ (q + 1) = -2 := by
rw [pow_succ, one_add_α_pow_q odd leg3, mul_comm, ← _root_.sq_sub_sq, α_sq]
norm_num | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | one_add_α_pow_q_succ | If `3` is not a square then `(1 + α) ^ (q + 1) = -2`. |
two_mul_ω_pow [Fact q.Prime] (odd : Odd q) (leg3 : legendreSym q 3 = -1) :
(2 * ω : X q) ^ ((q + 1) / 2) = -2 := by
rw [← one_add_α_sq, ← pow_mul]
have : 2 * ((q + 1) / 2) = q + 1 := by
apply Nat.mul_div_cancel'
rw [← even_iff_two_dvd]
exact Odd.add_one odd
rw [this, one_add_α_pow_q_succ odd leg3] | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | two_mul_ω_pow | If `3` is not a square then `(2 * ω) ^ ((q + 1) / 2) = -2`. |
pow_ω [Fact q.Prime] (odd : Odd q)
(leg3 : legendreSym q 3 = -1)
(leg2 : legendreSym q 2 = 1) :
(ω : X q) ^ ((q + 1) / 2) = -1 := by
have pow2 : (2 : ZMod q) ^ ((q + 1) / 2) = 2 := by
obtain ⟨_, _⟩ := odd
rw [(by cutsat : (q + 1) / 2 = q / 2 + 1), pow_succ]
have leg := legendreSym.eq_pow q 2
... | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | pow_ω | If 3 is not a square and 2 is square then $\omega^{(q+1)/2}=-1$. |
ω_pow_trace [Fact q.Prime] (odd : Odd q)
(leg3 : legendreSym q 3 = -1)
(leg2 : legendreSym q 2 = 1)
(hq4 : 4 ∣ q + 1) :
(ω : X q) ^ ((q + 1) / 4) + ωb ^ ((q + 1) / 4) = 0 := by
have : (ω : X q) ^ ((q + 1) / 2) * ωb ^ ((q + 1) / 4) = -ωb ^ ((q + 1) / 4) := by
rw [pow_ω odd leg3 leg2]
ring
hav... | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ω_pow_trace | The final evaluation needed to establish the Lucas-Lehmer necessity. |
card_eq : Fintype.card (X q) = q ^ 2 := by
dsimp [X]
rw [Fintype.card_prod, ZMod.card q, sq] | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | card_eq | The cardinality of `X` is `q^2`. |
two_lt_q (p' : ℕ) : 2 < q (p' + 2) := by
refine (minFac_prime (one_lt_mersenne.2 ?_).ne').two_le.lt_of_ne' ?_
· exact le_add_left _ _
· rw [Ne, minFac_eq_two_iff, mersenne, Nat.pow_succ']
exact Nat.two_not_dvd_two_mul_sub_one Nat.one_le_two_pow | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | two_lt_q | There are strictly fewer than `q^2` units, since `0` is not a unit. -/
nonrec theorem card_units_lt (w : 1 < q) : Fintype.card (X q)ˣ < q ^ 2 := by
have : Fact (1 < (q : ℕ)) := ⟨w⟩
convert card_units_lt (X q)
rw [card_eq]
end X
open X
/-!
Here and below, we introduce `p' = p - 2`, in order to avoid using subtr... |
ω_pow_formula (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
∃ k : ℤ,
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) =
k * mersenne (p' + 2) * (ω : X (q (p' + 2))) ^ 2 ^ p' - 1 := by
dsimp [lucasLehmerResidue] at h
rw [sZMod_eq_s p'] at h
replace h : 2 ^ (p' + 2) - 1 ∣ s p' := by simpa [ZMod.intCast_zmod... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ω_pow_formula | null |
mersenne_coe_X (p : ℕ) : (mersenne p : X (q p)) = 0 := by
ext <;> simp [mersenne, q, ZMod.natCast_eq_zero_iff, -pow_pos]
apply Nat.minFac_dvd | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | mersenne_coe_X | `q` is the minimum factor of `mersenne p`, so `M p = 0` in `X q`. |
ω_pow_eq_neg_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 1) = -1 := by
obtain ⟨k, w⟩ := ω_pow_formula p' h
rw [mersenne_coe_X] at w
simpa using w | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ω_pow_eq_neg_one | null |
ω_pow_eq_one (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = 1 :=
calc
(ω : X (q (p' + 2))) ^ 2 ^ (p' + 2) = (ω ^ 2 ^ (p' + 1)) ^ 2 := by
rw [← pow_mul, ← Nat.pow_succ]
_ = (-1) ^ 2 := by rw [ω_pow_eq_neg_one p' h]
_ = 1 := by simp | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ω_pow_eq_one | null |
ωUnit (p : ℕ) : Units (X (q p)) where
val := ω
inv := ωb
val_inv := ω_mul_ωb
inv_val := ωb_mul_ω
@[simp] | def | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ωUnit | `ω` as an element of the group of units. |
ωUnit_coe (p : ℕ) : (ωUnit p : X (q p)) = ω :=
rfl | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | ωUnit_coe | null |
order_ω (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
orderOf (ωUnit (p' + 2)) = 2 ^ (p' + 2) := by
apply Nat.eq_prime_pow_of_dvd_least_prime_pow
· exact Nat.prime_two
· intro o
have ω_pow :=
congr_arg (Units.coeHom (X (q (p' + 2))) : Units (X (q (p' + 2))) → X (q (p' + 2))) <|
orderOf_dv... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | order_ω | The order of `ω` in the unit group is exactly `2^p`. |
order_ineq (p' : ℕ) (h : lucasLehmerResidue (p' + 2) = 0) :
2 ^ (p' + 2) < (q (p' + 2) : ℕ) ^ 2 :=
calc
2 ^ (p' + 2) = orderOf (ωUnit (p' + 2)) := (order_ω p' h).symm
_ ≤ Fintype.card (X (q (p' + 2)))ˣ := orderOf_le_card_univ
_ < q (p' + 2) ^ 2 := card_units_lt (Nat.lt_of_succ_lt (two_lt_q _)) | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | order_ineq | null |
lucas_lehmer_sufficiency (p : ℕ) (w : 1 < p) : LucasLehmerTest p → (mersenne p).Prime := by
set p' := p - 2 with hp'
clear_value p'
obtain rfl : p = p' + 2 := by cutsat
have w : 1 < p' + 2 := Nat.lt_of_sub_eq_succ rfl
contrapose
intro a t
have h₁ := order_ineq p' t
have h₂ := Nat.minFac_sq_le_self (mers... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | lucas_lehmer_sufficiency | null |
lucas_lehmer_necessity (p : ℕ) (w : 3 ≤ p) (hp : (mersenne p).Prime) :
LucasLehmerTest p := by
have : Fact (mersenne p).Prime := ⟨‹_›⟩
set p' := p - 2 with hp'
clear_value p'
obtain rfl : p = p' + 2 := by cutsat
dsimp [LucasLehmerTest, lucasLehmerResidue]
rw [sZMod_eq_s p', ← X.fst_intCast, X.closed_for... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | lucas_lehmer_necessity | If `2^p-1` is prime then the Lucas-Lehmer test holds, `s(p-2) % (2^p-1) = 0. |
sModNat (q : ℕ) : ℕ → ℕ
| 0 => 4 % q
| i + 1 => (sModNat q i ^ 2 + (q - 2)) % q | def | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNat | Version of `sMod` that is `ℕ`-valued. One should have `q = 2 ^ p - 1`.
This can be reduced by the kernel. |
sModNat_eq_sMod (p k : ℕ) (hp : 2 ≤ p) : (sModNat (2 ^ p - 1) k : ℤ) = sMod p k := by
have h1 := calc
4 = 2 ^ 2 := by simp
_ ≤ 2 ^ p := Nat.pow_le_pow_right (by simp) hp
have h2 : 1 ≤ 2 ^ p := by omega
induction k with
| zero =>
rw [sModNat, sMod, Int.natCast_emod]
simp [h2]
| succ k ih =>
... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNat_eq_sMod | null |
sModNatTR (q k : ℕ) : ℕ :=
go k (4 % q)
where
/-- Helper function for `sMod''`. -/
go : ℕ → ℕ → ℕ
| 0, acc => acc
| n + 1, acc => go n ((acc ^ 2 + (q - 2)) % q) | def | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNatTR | Tail-recursive version of `sModNat`. |
sModNat_aux (b q : ℕ) : ℕ → ℕ
| 0 => b
| i + 1 => (sModNat_aux b q i ^ 2 + (q - 2)) % q | def | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNat_aux | Generalization of `sModNat` with arbitrary base case,
useful for proving `sModNatTR` and `sModNat` agree. |
sModNat_aux_eq (q k : ℕ) : sModNat_aux (4 % q) q k = sModNat q k := by
induction k with
| zero => rfl
| succ k ih => rw [sModNat_aux, ih, sModNat, ← ih] | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNat_aux_eq | null |
sModNatTR_eq_sModNat (q i : ℕ) : sModNatTR q i = sModNat q i := by
rw [sModNatTR, helper, sModNat_aux_eq]
where
helper b q k : sModNatTR.go q k b = sModNat_aux b q k := by
induction k generalizing b with
| zero => rfl
| succ k ih =>
rw [sModNatTR.go, ih, sModNat_aux]
clear ih
induction... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | sModNatTR_eq_sModNat | null |
testTrueHelper (p : ℕ) (hp : Nat.blt 1 p = true) (h : sModNatTR (2 ^ p - 1) (p - 2) = 0) :
LucasLehmerTest p := by
rw [Nat.blt_eq] at hp
rw [LucasLehmerTest, LucasLehmer.residue_eq_zero_iff_sMod_eq_zero p hp, ← sModNat_eq_sMod p _ hp,
← sModNatTR_eq_sModNat, h]
rfl | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | testTrueHelper | null |
testFalseHelper (p : ℕ) (hp : Nat.blt 1 p = true)
(h : Nat.ble 1 (sModNatTR (2 ^ p - 1) (p - 2))) : ¬ LucasLehmerTest p := by
rw [Nat.blt_eq] at hp
rw [Nat.ble_eq, Nat.succ_le, Nat.pos_iff_ne_zero] at h
rw [LucasLehmerTest, LucasLehmer.residue_eq_zero_iff_sMod_eq_zero p hp, ← sModNat_eq_sMod p _ hp,
← sMo... | lemma | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | testFalseHelper | null |
isNat_lucasLehmerTest : {p np : ℕ} →
IsNat p np → LucasLehmerTest np → LucasLehmerTest p
| _, _, ⟨rfl⟩, h => h | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | isNat_lucasLehmerTest | null |
isNat_not_lucasLehmerTest : {p np : ℕ} →
IsNat p np → ¬ LucasLehmerTest np → ¬ LucasLehmerTest p
| _, _, ⟨rfl⟩, h => h | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | isNat_not_lucasLehmerTest | null |
@[norm_num LucasLehmer.LucasLehmerTest (_ : ℕ)]
evalLucasLehmerTest : NormNumExt where eval {_ _} e := do
let .app _ (p : Q(ℕ)) ← Meta.whnfR e | failure
let ⟨ep, hp⟩ ← deriveNat p _
let np := ep.natLit!
unless 1 < np do
failure
haveI' h1ltp : Nat.blt 1 $ep =Q true := ⟨⟩
if sModNatTR (2 ^ np - 1) (np - 2... | def | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | evalLucasLehmerTest | Calculate `LucasLehmer.LucasLehmerTest p` for `2 ≤ p` by using kernel reduction for the
`sMod'` function. |
modEq_mersenne (n k : ℕ) : k ≡ k / 2 ^ n + k % 2 ^ n [MOD 2 ^ n - 1] :=
calc
k = 2 ^ n * (k / 2 ^ n) + k % 2 ^ n := (Nat.div_add_mod k (2 ^ n)).symm
_ ≡ 1 * (k / 2 ^ n) + k % 2 ^ n [MOD 2 ^ n - 1] :=
((Nat.modEq_sub <| Nat.succ_le_of_lt <| pow_pos zero_lt_two _).mul_right _).add_right _
_ = k / 2 ^ ... | theorem | NumberTheory | [
"Mathlib.NumberTheory.Fermat",
"Mathlib.RingTheory.Fintype"
] | Mathlib/NumberTheory/LucasLehmer.lean | modEq_mersenne | null |
lucas_primality (p : ℕ) (a : ZMod p) (ha : a ^ (p - 1) = 1)
(hd : ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1) : p.Prime := by
have h : p ≠ 0 ∧ p ≠ 1 := by
constructor <;> rintro rfl <;> exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have hp1 : 1 < p := Nat.one_lt_iff_ne_zero_and_ne_one.2 h
h... | theorem | NumberTheory | [
"Mathlib.Algebra.Field.ZMod",
"Mathlib.RingTheory.IntegralDomain"
] | Mathlib/NumberTheory/LucasPrimality.lean | lucas_primality | If `a^(p-1) = 1 mod p`, but `a^((p-1)/q) ≠ 1 mod p` for all prime factors `q` of `p-1`, then `p`
is prime. This is true because `a` has order `p-1` in the multiplicative group mod `p`, so this
group must itself have order `p-1`, which only happens when `p` is prime. |
reverse_lucas_primality (p : ℕ) (hP : p.Prime) :
∃ a : ZMod p, a ^ (p - 1) = 1 ∧ ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1 := by
have : Fact p.Prime := ⟨hP⟩
obtain ⟨g, hg⟩ := IsCyclic.exists_generator (α := (ZMod p)ˣ)
have h1 : orderOf g = p - 1 := by
rwa [orderOf_eq_card_of_forall_mem_zpowers ... | theorem | NumberTheory | [
"Mathlib.Algebra.Field.ZMod",
"Mathlib.RingTheory.IntegralDomain"
] | Mathlib/NumberTheory/LucasPrimality.lean | reverse_lucas_primality | If `p` is prime, then there exists an `a` such that `a^(p-1) = 1 mod p`
and `a^((p-1)/q) ≠ 1 mod p` for all prime factors `q` of `p-1`.
The multiplicative group mod `p` is cyclic, so `a` can be any generator of the group
(which must have order `p-1`). |
lucas_primality_iff (p : ℕ) : p.Prime ↔
∃ a : ZMod p, a ^ (p - 1) = 1 ∧ ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1 :=
⟨reverse_lucas_primality p, fun ⟨a, ⟨ha, hb⟩⟩ ↦ lucas_primality p a ha hb⟩ | theorem | NumberTheory | [
"Mathlib.Algebra.Field.ZMod",
"Mathlib.RingTheory.IntegralDomain"
] | Mathlib/NumberTheory/LucasPrimality.lean | lucas_primality_iff | A number `p` is prime if and only if there exists an `a` such that
`a^(p-1) = 1 mod p` and `a^((p-1)/q) ≠ 1 mod p` for all prime factors `q` of `p-1`. |
GrahamConjecture (n : ℕ) (f : ℕ → ℕ) : Prop :=
n ≠ 0 → StrictMonoOn f (Set.Iio n) → ∃ i < n, ∃ j < n, (f i).gcd (f j) * n ≤ f i | def | NumberTheory | [
"Mathlib.Combinatorics.SetFamily.FourFunctions",
"Mathlib.Data.Nat.Squarefree"
] | Mathlib/NumberTheory/MaricaSchoenheim.lean | GrahamConjecture | Statement of Graham's conjecture (which is now a theorem in the literature).
Graham's conjecture states that if $0 < a_1 < \dots a_n$ are integers, then
$\max_{i, j} \frac{a_i}{\gcd(a_i, a_j)} \ge n$. |
grahamConjecture_of_squarefree {n : ℕ} (f : ℕ → ℕ) (hf' : ∀ k < n, Squarefree (f k)) :
GrahamConjecture n f := by
rintro hn hf
by_contra!
set 𝒜 := (Iio n).image fun n ↦ primeFactors (f n)
have hf'' : ∀ i < n, ∀ j, Squarefree (f i / (f i).gcd (f j)) :=
fun i hi j ↦ (hf' _ hi).squarefree_of_dvd <| div_dv... | lemma | NumberTheory | [
"Mathlib.Combinatorics.SetFamily.FourFunctions",
"Mathlib.Data.Nat.Squarefree"
] | Mathlib/NumberTheory/MaricaSchoenheim.lean | grahamConjecture_of_squarefree | The special case of Graham's conjecture where all numbers are squarefree. |
bottom_row_coprime {R : Type*} [CommRing R] (g : SL(2, R)) :
IsCoprime ((↑g : Matrix (Fin 2) (Fin 2) R) 1 0) ((↑g : Matrix (Fin 2) (Fin 2) R) 1 1) :=
isCoprime_row g 1 | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | bottom_row_coprime | The two numbers `c`, `d` in the "bottom_row" of `g=[[*,*],[c,d]]` in `SL(2, ℤ)` are coprime. |
bottom_row_surj {R : Type*} [CommRing R] :
Set.SurjOn (fun g : SL(2, R) => (↑g : Matrix (Fin 2) (Fin 2) R) 1) Set.univ
{cd | IsCoprime (cd 0) (cd 1)} := by
rintro cd ⟨b₀, a, gcd_eqn⟩
let A := of ![![a, -b₀], cd]
have det_A_1 : det A = 1 := by
convert gcd_eqn
rw [det_fin_two]
simp [A, (by rin... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | bottom_row_surj | Every pair `![c, d]` of coprime integers is the "bottom_row" of some element `g=[[*,*],[c,d]]`
of `SL(2,ℤ)`. |
tendsto_normSq_coprime_pair :
Filter.Tendsto (fun p : Fin 2 → ℤ => normSq ((p 0 : ℂ) * z + p 1)) cofinite atTop := by
letI : Module ℝ (Fin 2 → ℝ) := NormedSpace.toModule
let π₀ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 0
let π₁ : (Fin 2 → ℝ) →ₗ[ℝ] ℝ := LinearMap.proj 1
let f : (Fin 2 → ℝ) →ₗ[ℝ] ℂ := π₀.smulRi... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | tendsto_normSq_coprime_pair | The function `(c,d) → |cz+d|^2` is proper, that is, preimages of bounded-above sets are finite. |
lcRow0 (p : Fin 2 → ℤ) : Matrix (Fin 2) (Fin 2) ℝ →ₗ[ℝ] ℝ :=
((p 0 : ℝ) • LinearMap.proj (0 : Fin 2) +
(p 1 : ℝ) • LinearMap.proj (1 : Fin 2) : (Fin 2 → ℝ) →ₗ[ℝ] ℝ).comp
(LinearMap.proj 0)
@[simp] | def | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | lcRow0 | Given `coprime_pair` `p=(c,d)`, the matrix `[[a,b],[*,*]]` is sent to `a*c+b*d`.
This is the linear map version of this operation. |
lcRow0_apply (p : Fin 2 → ℤ) (g : Matrix (Fin 2) (Fin 2) ℝ) :
lcRow0 p g = p 0 * g 0 0 + p 1 * g 0 1 :=
rfl | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | lcRow0_apply | null |
@[simps!]
lcRow0Extend {cd : Fin 2 → ℤ} (hcd : IsCoprime (cd 0) (cd 1)) :
Matrix (Fin 2) (Fin 2) ℝ ≃ₗ[ℝ] Matrix (Fin 2) (Fin 2) ℝ :=
LinearEquiv.piCongrRight
![by
refine
LinearMap.GeneralLinearGroup.generalLinearEquiv ℝ (Fin 2 → ℝ)
(GeneralLinearGroup.toLin (planeConformalMatrix (cd 0 ... | def | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | lcRow0Extend | Linear map sending the matrix [a, b; c, d] to the matrix [ac₀ + bd₀, - ad₀ + bc₀; c, d], for
some fixed `(c₀, d₀)`. |
tendsto_lcRow0 {cd : Fin 2 → ℤ} (hcd : IsCoprime (cd 0) (cd 1)) :
Tendsto (fun g : { g : SL(2, ℤ) // g 1 = cd } => lcRow0 cd ↑(↑g : SL(2, ℝ))) cofinite
(cocompact ℝ) := by
let mB : ℝ → Matrix (Fin 2) (Fin 2) ℝ := fun t => of ![![t, (-(1 : ℤ) : ℝ)], (↑) ∘ cd]
have hmB : Continuous mB := by
refine conti... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | tendsto_lcRow0 | The map `lcRow0` is proper, that is, preimages of cocompact sets are finite in
`[[* , *], [c, d]]`. |
smul_eq_lcRow0_add {p : Fin 2 → ℤ} (hp : IsCoprime (p 0) (p 1)) (hg : g 1 = p) :
↑(g • z) =
(lcRow0 p ↑(g : SL(2, ℝ)) : ℂ) / ((p 0 : ℂ) ^ 2 + (p 1 : ℂ) ^ 2) +
((p 1 : ℂ) * z - p 0) / (((p 0 : ℂ) ^ 2 + (p 1 : ℂ) ^ 2) * (p 0 * z + p 1)) := by
have nonZ1 : (p 0 : ℂ) ^ 2 + (p 1 : ℂ) ^ 2 ≠ 0 := mod_cast ... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | smul_eq_lcRow0_add | This replaces `(g•z).re = a/c + *` in the standard theory with the following novel identity:
`g • z = (a c + b d) / (c^2 + d^2) + (d z - c) / ((c^2 + d^2) (c z + d))`
which does not need to be decomposed depending on whether `c = 0`. |
tendsto_abs_re_smul {p : Fin 2 → ℤ} (hp : IsCoprime (p 0) (p 1)) :
Tendsto
(fun g : { g : SL(2, ℤ) // g 1 = p } => |((g : SL(2, ℤ)) • z).re|) cofinite atTop := by
suffices
Tendsto (fun g : (fun g : SL(2, ℤ) => g 1) ⁻¹' {p} => ((g : SL(2, ℤ)) • z).re) cofinite
(cocompact ℝ)
by exact tendsto_nor... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | tendsto_abs_re_smul | null |
exists_max_im : ∃ g : SL(2, ℤ), ∀ g' : SL(2, ℤ), (g' • z).im ≤ (g • z).im := by
classical
let s : Set (Fin 2 → ℤ) := {cd | IsCoprime (cd 0) (cd 1)}
have hs : s.Nonempty := ⟨![1, 1], isCoprime_one_left⟩
obtain ⟨p, hp_coprime, hp⟩ :=
Filter.Tendsto.exists_within_forall_le hs (tendsto_normSq_coprime_pair z)
... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_max_im | For `z : ℍ`, there is a `g : SL(2,ℤ)` maximizing `(g•z).im` |
exists_row_one_eq_and_min_re {cd : Fin 2 → ℤ} (hcd : IsCoprime (cd 0) (cd 1)) :
∃ g : SL(2, ℤ), g 1 = cd ∧ ∀ g' : SL(2, ℤ), g 1 = g' 1 →
|(g • z).re| ≤ |(g' • z).re| := by
haveI : Nonempty { g : SL(2, ℤ) // g 1 = cd } :=
let ⟨x, hx⟩ := bottom_row_surj hcd
⟨⟨x, hx.2⟩⟩
obtain ⟨g, hg⟩ := Filter.Tends... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_row_one_eq_and_min_re | Given `z : ℍ` and a bottom row `(c,d)`, among the `g : SL(2,ℤ)` with this bottom row, minimize
`|(g•z).re|`. |
coe_T_zpow_smul_eq {n : ℤ} : (↑(T ^ n • z) : ℂ) = z + n := by
rw [UpperHalfPlane.coe_specialLinearGroup_apply]
simp [coe_T_zpow, -map_zpow] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | coe_T_zpow_smul_eq | null |
re_T_zpow_smul (n : ℤ) : (T ^ n • z).re = z.re + n := by
rw [← coe_re, coe_T_zpow_smul_eq, add_re, intCast_re, coe_re] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | re_T_zpow_smul | null |
im_T_zpow_smul (n : ℤ) : (T ^ n • z).im = z.im := by
rw [← coe_im, coe_T_zpow_smul_eq, add_im, intCast_im, add_zero, coe_im] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | im_T_zpow_smul | null |
re_T_smul : (T • z).re = z.re + 1 := by simpa using re_T_zpow_smul z 1 | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | re_T_smul | null |
im_T_smul : (T • z).im = z.im := by simpa using im_T_zpow_smul z 1 | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | im_T_smul | null |
re_T_inv_smul : (T⁻¹ • z).re = z.re - 1 := by simpa using re_T_zpow_smul z (-1) | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | re_T_inv_smul | null |
im_T_inv_smul : (T⁻¹ • z).im = z.im := by simpa using im_T_zpow_smul z (-1)
variable {z} | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | im_T_inv_smul | null |
exists_eq_T_zpow_of_c_eq_zero (hc : g 1 0 = 0) :
∃ n : ℤ, ∀ z : ℍ, g • z = T ^ n • z := by
have had := g.det_coe
replace had : g 0 0 * g 1 1 = 1 := by rw [det_fin_two, hc] at had; omega
rcases Int.eq_one_or_neg_one_of_mul_eq_one' had with (⟨ha, hd⟩ | ⟨ha, hd⟩)
· use g 0 1
suffices g = T ^ g 0 1 by intro... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_eq_T_zpow_of_c_eq_zero | null |
g_eq_of_c_eq_one (hc : g 1 0 = 1) : g = T ^ g 0 0 * S * T ^ g 1 1 := by
have hg := g.det_coe.symm
replace hg : g 0 1 = g 0 0 * g 1 1 - 1 := by rw [det_fin_two, hc] at hg; omega
refine Subtype.ext ?_
conv_lhs => rw [(g : Matrix _ _ ℤ).eta_fin_two]
simp only [hg, sub_eq_add_neg, hc, coe_mul, coe_T_zpow, coe_S, ... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | g_eq_of_c_eq_one | null |
normSq_S_smul_lt_one (h : 1 < normSq z) : normSq ↑(S • z) < 1 := by
rw [UpperHalfPlane.coe_specialLinearGroup_apply]
simpa [coe_S, num, denom] using (inv_lt_inv₀ z.normSq_pos zero_lt_one).mpr h | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | normSq_S_smul_lt_one | If `1 < |z|`, then `|S • z| < 1`. |
im_lt_im_S_smul (h : normSq z < 1) : z.im < (S • z).im := by
rw [ModularGroup.im_smul_eq_div_normSq]
have : z.im < z.im / normSq (z : ℂ) := by
have imz : 0 < z.im := im_pos z
apply (lt_div_iff₀ z.normSq_pos).mpr
nlinarith
simpa [denom, coe_S, SpecialLinearGroup.toGL] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | im_lt_im_S_smul | If `|z| < 1`, then applying `S` strictly decreases `im`. |
fd : Set ℍ :=
{z | 1 ≤ normSq (z : ℂ) ∧ |z.re| ≤ (1 : ℝ) / 2} | def | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | fd | The standard (closed) fundamental domain of the action of `SL(2,ℤ)` on `ℍ`. |
fdo : Set ℍ :=
{z | 1 < normSq (z : ℂ) ∧ |z.re| < (1 : ℝ) / 2}
@[inherit_doc ModularGroup.fd]
scoped[Modular] notation "𝒟" => ModularGroup.fd
@[inherit_doc ModularGroup.fdo]
scoped[Modular] notation "𝒟ᵒ" => ModularGroup.fdo
open scoped Modular | def | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | fdo | The standard open fundamental domain of the action of `SL(2,ℤ)` on `ℍ`. |
abs_two_mul_re_lt_one_of_mem_fdo (h : z ∈ 𝒟ᵒ) : |2 * z.re| < 1 := by
rw [abs_mul, abs_two, ← lt_div_iff₀' (zero_lt_two' ℝ)]
exact h.2 | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | abs_two_mul_re_lt_one_of_mem_fdo | null |
three_lt_four_mul_im_sq_of_mem_fdo (h : z ∈ 𝒟ᵒ) : 3 < 4 * z.im ^ 2 := by
have : 1 < z.re * z.re + z.im * z.im := by simpa [Complex.normSq_apply] using h.1
have := h.2
cases abs_cases z.re <;> nlinarith | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | three_lt_four_mul_im_sq_of_mem_fdo | null |
three_le_four_mul_im_sq_of_mem_fd {τ : ℍ} (h : τ ∈ 𝒟) : 3 ≤ 4 * τ.im ^ 2 := by
have : 1 ≤ τ.re * τ.re + τ.im * τ.im := by simpa [Complex.normSq_apply] using h.1
cases abs_cases τ.re <;> nlinarith [h.2] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | three_le_four_mul_im_sq_of_mem_fd | non-strict variant of `ModularGroup.three_le_four_mul_im_sq_of_mem_fdo` |
one_lt_normSq_T_zpow_smul (hz : z ∈ 𝒟ᵒ) (n : ℤ) : 1 < normSq (T ^ n • z : ℍ) := by
rw [coe_T_zpow_smul_eq]
have hz₁ : 1 < z.re * z.re + z.im * z.im := hz.1
have hzn := Int.nneg_mul_add_sq_of_abs_le_one n (abs_two_mul_re_lt_one_of_mem_fdo hz).le
have : 1 < (z.re + ↑n) * (z.re + ↑n) + z.im * z.im := by linarith
... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | one_lt_normSq_T_zpow_smul | If `z ∈ 𝒟ᵒ`, and `n : ℤ`, then `|z + n| > 1`. |
eq_zero_of_mem_fdo_of_T_zpow_mem_fdo {n : ℤ} (hz : z ∈ 𝒟ᵒ) (hg : T ^ n • z ∈ 𝒟ᵒ) :
n = 0 := by
suffices |(n : ℝ)| < 1 by
rwa [← Int.cast_abs, ← Int.cast_one, Int.cast_lt, Int.abs_lt_one_iff] at this
have h₁ := hz.2
have h₂ := hg.2
rw [re_T_zpow_smul] at h₂
calc
|(n : ℝ)| ≤ |z.re| + |z.re + (n : ... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | eq_zero_of_mem_fdo_of_T_zpow_mem_fdo | null |
exists_smul_mem_fd (z : ℍ) : ∃ g : SL(2, ℤ), g • z ∈ 𝒟 := by
obtain ⟨g₀, hg₀⟩ := exists_max_im z
obtain ⟨g, hg, hg'⟩ := exists_row_one_eq_and_min_re z (bottom_row_coprime g₀)
refine ⟨g, ?_⟩
have hg₀' : ∀ g' : SL(2, ℤ), (g' • z).im ≤ (g • z).im := by
have hg'' : (g • z).im = (g₀ • z).im := by
rw [Modu... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_smul_mem_fd | First Fundamental Domain Lemma: Any `z : ℍ` can be moved to `𝒟` by an element of
`SL(2,ℤ)` |
abs_c_le_one (hz : z ∈ 𝒟ᵒ) (hg : g • z ∈ 𝒟ᵒ) : |g 1 0| ≤ 1 := by
let c' : ℤ := g 1 0
let c := (c' : ℝ)
suffices 3 * c ^ 2 < 4 by
rw [← Int.cast_pow, ← Int.cast_three, ← Int.cast_four, ← Int.cast_mul, Int.cast_lt] at this
replace this : c' ^ 2 ≤ 1 ^ 2 := by omega
rwa [sq_le_sq, abs_one] at this
suf... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | abs_c_le_one | An auxiliary result en route to `ModularGroup.c_eq_zero`. |
c_eq_zero (hz : z ∈ 𝒟ᵒ) (hg : g • z ∈ 𝒟ᵒ) : g 1 0 = 0 := by
have hp : ∀ {g' : SL(2, ℤ)}, g' • z ∈ 𝒟ᵒ → g' 1 0 ≠ 1 := by
intro g' hg'
by_contra hc
let a := g' 0 0
let d := g' 1 1
have had : T ^ (-a) * g' = S * T ^ d := by
rw [g_eq_of_c_eq_one hc]
dsimp [a, d]
group
let w :=... | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | c_eq_zero | An auxiliary result en route to `ModularGroup.eq_smul_self_of_mem_fdo_mem_fdo`. |
eq_smul_self_of_mem_fdo_mem_fdo (hz : z ∈ 𝒟ᵒ) (hg : g • z ∈ 𝒟ᵒ) : z = g • z := by
obtain ⟨n, hn⟩ := exists_eq_T_zpow_of_c_eq_zero (c_eq_zero hz hg)
rw [hn] at hg ⊢
simp [eq_zero_of_mem_fdo_of_T_zpow_mem_fdo hz hg, one_smul] | theorem | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | eq_smul_self_of_mem_fdo_mem_fdo | Second Fundamental Domain Lemma: if both `z` and `g • z` are in the open domain `𝒟ᵒ`,
where `z : ℍ` and `g : SL(2,ℤ)`, then `z = g • z`. |
exists_one_half_le_im_smul (τ : ℍ) : ∃ γ : SL(2, ℤ), 1 / 2 ≤ im (γ • τ) := by
obtain ⟨γ, hγ⟩ := exists_smul_mem_fd τ
use γ
nlinarith [three_le_four_mul_im_sq_of_mem_fd hγ, im_pos (γ • τ)] | lemma | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_one_half_le_im_smul | null |
exists_one_half_le_im_smul_and_norm_denom_le (τ : ℍ) :
∃ γ : SL(2, ℤ), 1 / 2 ≤ im (γ • τ) ∧ ‖denom γ τ‖ ≤ 1 := by
rcases le_total (1 / 2) τ.im with h | h
· exact ⟨1, (one_smul SL(2, ℤ) τ).symm ▸ h, by
simp only [map_one, denom_one, norm_one, le_refl]⟩
· refine (exists_one_half_le_im_smul τ).imp (fun γ h... | lemma | NumberTheory | [
"Mathlib.Analysis.Complex.UpperHalfPlane.MoebiusAction",
"Mathlib.LinearAlgebra.GeneralLinearGroup",
"Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic",
"Mathlib.Topology.Instances.Matrix",
"Mathlib.Topology.Algebra.Module.FiniteDimension",
"Mathlib.Topology.Instances.ZMultiples"
] | Mathlib/NumberTheory/Modular.lean | exists_one_half_le_im_smul_and_norm_denom_le | For every `τ : ℍ` there is some `γ ∈ SL(2, ℤ)` that sends it to an element whose
imaginary part is at least `1/2` and such that `denom γ τ` has norm at most 1. |
dvd_geom_sum₂_iff_of_dvd_sub {x y p : R} (h : p ∣ x - y) :
(p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * y ^ (n - 1) := by
rw [← mem_span_singleton, ← Ideal.Quotient.eq] at h
simp only [← mem_span_singleton, ← eq_zero_iff_mem, RingHom.map_geom_sum₂, h, geom_sum₂_self,
map_mul, map_pow, map_natCast] | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | dvd_geom_sum₂_iff_of_dvd_sub | null |
dvd_geom_sum₂_iff_of_dvd_sub' {x y p : R} (h : p ∣ x - y) :
(p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i)) ↔ p ∣ n * x ^ (n - 1) := by
rw [geom_sum₂_comm, dvd_geom_sum₂_iff_of_dvd_sub]; simpa using h.neg_right | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | dvd_geom_sum₂_iff_of_dvd_sub' | null |
dvd_geom_sum₂_self {x y : R} (h : ↑n ∣ x - y) :
↑n ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) :=
(dvd_geom_sum₂_iff_of_dvd_sub h).mpr (dvd_mul_right _ _) | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | dvd_geom_sum₂_self | null |
sq_dvd_add_pow_sub_sub (p x : R) (n : ℕ) :
p ^ 2 ∣ (x + p) ^ n - x ^ (n - 1) * p * n - x ^ n := by
rcases n with - | n
· simp only [pow_zero, Nat.cast_zero, sub_zero, sub_self, dvd_zero, mul_zero]
· simp only [Nat.succ_sub_succ_eq_sub, tsub_zero, Nat.cast_succ, add_pow, Finset.sum_range_succ,
Nat.choose... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | sq_dvd_add_pow_sub_sub | null |
not_dvd_geom_sum₂ {p : R} (hp : Prime p) (hxy : p ∣ x - y) (hx : ¬p ∣ x) (hn : ¬p ∣ n) :
¬p ∣ ∑ i ∈ range n, x ^ i * y ^ (n - 1 - i) := fun h =>
hx <|
hp.dvd_of_dvd_pow <| (hp.dvd_or_dvd <| (dvd_geom_sum₂_iff_of_dvd_sub' hxy).mp h).resolve_left hn
variable {p : ℕ} (a b) | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | not_dvd_geom_sum₂ | null |
odd_sq_dvd_geom_sum₂_sub (hp : Odd p) :
(p : R) ^ 2 ∣ (∑ i ∈ range p, (a + p * b) ^ i * a ^ (p - 1 - i)) - p * a ^ (p - 1) := by
have h1 : ∀ (i : ℕ),
(p : R) ^ 2 ∣ (a + ↑p * b) ^ i - (a ^ (i - 1) * (↑p * b) * i + a ^ i) := by
intro i
calc
↑p ^ 2 ∣ (↑p * b) ^ 2 := by simp only [mul_pow, dvd_mul... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | odd_sq_dvd_geom_sum₂_sub | null |
emultiplicity_pow_sub_pow_of_prime {p : R} (hp : Prime p) {x y : R}
(hxy : p ∣ x - y) (hx : ¬p ∣ x) {n : ℕ} (hn : ¬p ∣ n) :
emultiplicity p (x ^ n - y ^ n) = emultiplicity p (x - y) := by
rw [← geom_sum₂_mul, emultiplicity_mul hp,
emultiplicity_eq_zero.2 (not_dvd_geom_sum₂ hp hxy hx hn), zero_add]
variabl... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | emultiplicity_pow_sub_pow_of_prime | null |
emultiplicity_geom_sum₂_eq_one :
emultiplicity (↑p) (∑ i ∈ range p, x ^ i * y ^ (p - 1 - i)) = 1 := by
rw [← Nat.cast_one]
refine emultiplicity_eq_coe.2 ⟨?_, ?_⟩
· rw [pow_one]
exact dvd_geom_sum₂_self hxy
rw [dvd_iff_dvd_of_dvd_sub hxy] at hx
obtain ⟨k, hk⟩ := hxy
rw [one_add_one_eq_two, eq_add_of_... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | emultiplicity_geom_sum₂_eq_one | null |
emultiplicity_pow_prime_sub_pow_prime :
emultiplicity (↑p) (x ^ p - y ^ p) = emultiplicity (↑p) (x - y) + 1 := by
rw [← geom_sum₂_mul, emultiplicity_mul hp, emultiplicity_geom_sum₂_eq_one hp hp1 hxy hx, add_comm] | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | emultiplicity_pow_prime_sub_pow_prime | null |
emultiplicity_pow_prime_pow_sub_pow_prime_pow (a : ℕ) :
emultiplicity (↑p) (x ^ p ^ a - y ^ p ^ a) = emultiplicity (↑p) (x - y) + a := by
induction a with
| zero => rw [Nat.cast_zero, add_zero, pow_zero, pow_one, pow_one]
| succ a h_ind =>
rw [Nat.cast_add, Nat.cast_one, ← add_assoc, ← h_ind, pow_succ, po... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | emultiplicity_pow_prime_pow_sub_pow_prime_pow | null |
Int.emultiplicity_pow_sub_pow {x y : ℤ} (hxy : ↑p ∣ x - y) (hx : ¬↑p ∣ x) (n : ℕ) :
emultiplicity (↑p) (x ^ n - y ^ n) = emultiplicity (↑p) (x - y) + emultiplicity p n := by
rcases n with - | n
· simp only [emultiplicity_zero, add_top, pow_zero, sub_self]
have h : FiniteMultiplicity _ _ := Nat.finiteMultiplic... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.emultiplicity_pow_sub_pow | **Lifting the exponent lemma** for odd primes. |
Int.emultiplicity_pow_add_pow {x y : ℤ} (hxy : ↑p ∣ x + y) (hx : ¬↑p ∣ x)
{n : ℕ} (hn : Odd n) :
emultiplicity (↑p) (x ^ n + y ^ n) = emultiplicity (↑p) (x + y) + emultiplicity p n := by
rw [← sub_neg_eq_add] at hxy
rw [← sub_neg_eq_add, ← sub_neg_eq_add, ← Odd.neg_pow hn]
exact Int.emultiplicity_pow_sub_... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.emultiplicity_pow_add_pow | null |
Nat.emultiplicity_pow_sub_pow {x y : ℕ} (hxy : p ∣ x - y) (hx : ¬p ∣ x) (n : ℕ) :
emultiplicity p (x ^ n - y ^ n) = emultiplicity p (x - y) + emultiplicity p n := by
obtain hyx | hyx := le_total y x
· iterate 2 rw [← Int.natCast_emultiplicity]
rw [Int.ofNat_sub (Nat.pow_le_pow_left hyx n)]
rw [← Int.nat... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Nat.emultiplicity_pow_sub_pow | null |
Nat.emultiplicity_pow_add_pow {x y : ℕ} (hxy : p ∣ x + y) (hx : ¬p ∣ x)
{n : ℕ} (hn : Odd n) :
emultiplicity p (x ^ n + y ^ n) = emultiplicity p (x + y) + emultiplicity p n := by
iterate 2 rw [← Int.natCast_emultiplicity]
rw [← Int.natCast_dvd_natCast] at hxy hx
push_cast at *
exact Int.emultiplicity_po... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Nat.emultiplicity_pow_add_pow | null |
pow_two_pow_sub_pow_two_pow [CommRing R] {x y : R} (n : ℕ) :
x ^ 2 ^ n - y ^ 2 ^ n = (∏ i ∈ Finset.range n, (x ^ 2 ^ i + y ^ 2 ^ i)) * (x - y) := by
induction n with
| zero => simp only [pow_zero, pow_one, range_zero, prod_empty, one_mul]
| succ d hd =>
suffices x ^ 2 ^ d.succ - y ^ 2 ^ d.succ = (x ^ 2 ^ ... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | pow_two_pow_sub_pow_two_pow | null |
Int.sq_mod_four_eq_one_of_odd {x : ℤ} : Odd x → x ^ 2 % 4 = 1 := by
intro hx
unfold Odd at hx
rcases hx with ⟨_, rfl⟩
ring_nf
rw [add_assoc, ← add_mul, Int.add_mul_emod_self_right]
decide | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.sq_mod_four_eq_one_of_odd | null |
Int.eight_dvd_sq_sub_one_of_odd {k : ℤ} (hk : Odd k) : 8 ∣ k ^ 2 - 1 := by
rcases hk with ⟨m, rfl⟩
have eq : (2 * m + 1) ^ 2 - 1 = 4 * (m * (m + 1)) := by ring
simpa [eq] using (mul_dvd_mul_iff_left four_ne_zero).mpr (two_dvd_mul_add_one m) | lemma | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.eight_dvd_sq_sub_one_of_odd | null |
Nat.eight_dvd_sq_sub_one_of_odd {k : ℕ} (hk : Odd k) : 8 ∣ k ^ 2 - 1 := by
rcases hk with ⟨m, rfl⟩
have eq : (2 * m + 1) ^ 2 - 1 = 4 * (m * (m + 1)) := by ring_nf; grind
simpa [eq] using (mul_dvd_mul_iff_left four_ne_zero).mpr (two_dvd_mul_add_one m) | lemma | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Nat.eight_dvd_sq_sub_one_of_odd | null |
Int.two_pow_two_pow_add_two_pow_two_pow {x y : ℤ} (hx : ¬2 ∣ x) (hxy : 4 ∣ x - y) (i : ℕ) :
emultiplicity 2 (x ^ 2 ^ i + y ^ 2 ^ i) = ↑(1 : ℕ) := by
have hx_odd : Odd x := by rwa [← Int.not_even_iff_odd, even_iff_two_dvd]
have hxy_even : Even (x - y) := even_iff_two_dvd.mpr (dvd_trans (by decide) hxy)
have hy... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.two_pow_two_pow_add_two_pow_two_pow | null |
Int.two_pow_two_pow_sub_pow_two_pow {x y : ℤ} (n : ℕ) (hxy : 4 ∣ x - y) (hx : ¬2 ∣ x) :
emultiplicity 2 (x ^ 2 ^ n - y ^ 2 ^ n) = emultiplicity 2 (x - y) + n := by
simp only [pow_two_pow_sub_pow_two_pow n, emultiplicity_mul Int.prime_two,
Finset.emultiplicity_prod Int.prime_two, add_comm, Nat.cast_one, Finset... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.two_pow_two_pow_sub_pow_two_pow | null |
Int.two_pow_sub_pow' {x y : ℤ} (n : ℕ) (hxy : 4 ∣ x - y) (hx : ¬2 ∣ x) :
emultiplicity 2 (x ^ n - y ^ n) = emultiplicity 2 (x - y) + emultiplicity (2 : ℤ) n := by
have hx_odd : Odd x := by rwa [← Int.not_even_iff_odd, even_iff_two_dvd]
have hxy_even : Even (x - y) := even_iff_two_dvd.mpr (dvd_trans (by decide) ... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.two_pow_sub_pow' | null |
Int.two_pow_sub_pow {x y : ℤ} {n : ℕ} (hxy : 2 ∣ x - y) (hx : ¬2 ∣ x) (hn : Even n) :
emultiplicity 2 (x ^ n - y ^ n) + 1 =
emultiplicity 2 (x + y) + emultiplicity 2 (x - y) + emultiplicity (2 : ℤ) n := by
have hy : Odd y := by
rw [← even_iff_two_dvd, Int.not_even_iff_odd] at hx
replace hxy := (@eve... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Int.two_pow_sub_pow | **Lifting the exponent lemma** for `p = 2` |
Nat.two_pow_sub_pow {x y : ℕ} (hxy : 2 ∣ x - y) (hx : ¬2 ∣ x) {n : ℕ} (hn : Even n) :
emultiplicity 2 (x ^ n - y ^ n) + 1 =
emultiplicity 2 (x + y) + emultiplicity 2 (x - y) + emultiplicity 2 n := by
obtain hyx | hyx := le_total y x
· iterate 3 rw [← Int.natCast_emultiplicity]
simp only [Int.ofNat_sub... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | Nat.two_pow_sub_pow | null |
pow_two_sub_pow (hyx : y < x) (hxy : 2 ∣ x - y) (hx : ¬2 ∣ x) {n : ℕ} (hn : n ≠ 0)
(hneven : Even n) :
padicValNat 2 (x ^ n - y ^ n) + 1 =
padicValNat 2 (x + y) + padicValNat 2 (x - y) + padicValNat 2 n := by
simp only [← Nat.cast_inj (R := ℕ∞), Nat.cast_add]
iterate 4 rw [padicValNat_eq_emultiplicity... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | pow_two_sub_pow | null |
pow_sub_pow (hyx : y < x) (hxy : p ∣ x - y) (hx : ¬p ∣ x) {n : ℕ} (hn : n ≠ 0) :
padicValNat p (x ^ n - y ^ n) = padicValNat p (x - y) + padicValNat p n := by
rw [← Nat.cast_inj (R := ℕ∞), Nat.cast_add]
iterate 3 rw [padicValNat_eq_emultiplicity]
· exact Nat.emultiplicity_pow_sub_pow hp.out hp1 hxy hx n
· e... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | pow_sub_pow | null |
pow_add_pow (hxy : p ∣ x + y) (hx : ¬p ∣ x) {n : ℕ} (hn : Odd n) :
padicValNat p (x ^ n + y ^ n) = padicValNat p (x + y) + padicValNat p n := by
rcases y with - | y
· contradiction
rw [← Nat.cast_inj (R := ℕ∞), Nat.cast_add]
iterate 3 rw [padicValNat_eq_emultiplicity]
· exact Nat.emultiplicity_pow_add_pow... | theorem | NumberTheory | [
"Mathlib.Algebra.Order.Ring.Basic",
"Mathlib.Algebra.Ring.GeomSum",
"Mathlib.Algebra.Ring.Int.Parity",
"Mathlib.Data.Nat.Choose.Sum",
"Mathlib.Data.Nat.Prime.Int",
"Mathlib.NumberTheory.Padics.PadicVal.Defs",
"Mathlib.RingTheory.Ideal.Quotient.Defs",
"Mathlib.RingTheory.Ideal.Span"
] | Mathlib/NumberTheory/Multiplicity.lean | pow_add_pow | null |
@[simp]
ratCast_iff : IsIntegral ℤ (q : α) ↔ IsIntegral ℤ q :=
isIntegral_algebraMap_iff (FaithfulSMul.algebraMap_injective ℚ α) | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | ratCast_iff | null |
exists_int_iff_exists_rat (h₁ : IsIntegral ℤ x) : (∃ q : ℚ, x = q) ↔ ∃ k : ℤ, x = k := by
refine ⟨?_, fun ⟨w, h⟩ ↦ ⟨w, by simp [h]⟩⟩
rintro ⟨q, rfl⟩
rw [ratCast_iff] at h₁
peel IsIntegrallyClosed.algebraMap_eq_of_integral h₁ with h
simp [← h] | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | exists_int_iff_exists_rat | null |
isIntegral_two_mul_cos_rat_mul_pi (r : ℚ) :
IsIntegral ℤ (2 * cos (r * π)) := by
let z : ℂ := .exp (.I * r * π)
obtain ⟨p, q, hq_pos, rfl⟩ : ∃ (p : ℤ) (q : ℕ), q ≠ 0 ∧ r = p / q :=
⟨r.num, r.den, r.den_ne_zero, r.num_div_den.symm⟩
have hz_root : z ^ (2 * q) = 1 := by
rw [← Complex.exp_nat_mul, Complex... | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | isIntegral_two_mul_cos_rat_mul_pi | null |
niven (hθ : ∃ r : ℚ, θ = r * π) (hcos : ∃ q : ℚ, cos θ = q) :
cos θ ∈ ({-1, -1 / 2, 0, 1 / 2, 1} : Set ℝ) := by
obtain ⟨r, rfl⟩ := hθ
obtain ⟨k, hk⟩ : ∃ k : ℤ, 2 * cos (r * π) = k := by
rw [← (isIntegral_two_mul_cos_rat_mul_pi r).exists_int_iff_exists_rat]
exact ⟨2 * hcos.choose, by push_cast; linarith ... | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | niven | **Niven's theorem**: The only rational values of `cos` that occur at rational multiples of π
are `{-1, -1/2, 0, 1/2, 1}`. |
niven_sin (hθ : ∃ r : ℚ, θ = r * π) (hcos : ∃ q : ℚ, sin θ = q) :
sin θ ∈ ({-1, -1 / 2, 0, 1 / 2, 1} : Set ℝ) := by
convert ← niven (θ := θ - π/2) ?_ ?_ using 1
· exact cos_sub_pi_div_two θ
· exact hθ.imp' (· - 1 / 2) (by intros; push_cast; linarith)
· simpa [cos_sub_pi_div_two] | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | niven_sin | Niven's theorem, but stated for `sin` instead of `cos`. |
niven_angle_eq (hθ : ∃ r : ℚ, θ = r * π) (hcos : ∃ q : ℚ, cos θ = q)
(h_bnd : θ ∈ Set.Icc 0 π) : θ ∈ ({0, π / 3, π / 2, π * (2 / 3), π} : Set ℝ) := by
rcases niven hθ hcos with h | h | h | h | h <;>
[ have h₂ := cos_pi;
have h₂ : cos (π * (2 / 3)) = -1 / 2 := by
have := cos_pi_sub (π / 3)
have :... | theorem | NumberTheory | [
"Mathlib.Analysis.SpecialFunctions.Complex.Log",
"Mathlib.RingTheory.Polynomial.RationalRoot",
"Mathlib.Tactic.Peel",
"Mathlib.Tactic.Rify"
] | Mathlib/NumberTheory/Niven.lean | niven_angle_eq | Niven's theorem, giving the possible angles for `θ` in the range `0 .. π`. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.