Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
rank
int64
0
2.4k
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.Finsupp.Order #align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Finset variable {Ξ± Ξ² ΞΉ : Type*} namespace Finsupp def toMultiset : (Ξ± β†’β‚€ β„•) β†’+ Multiset Ξ± where toFun f := Finsupp.sum f...
Mathlib/Data/Finsupp/Multiset.lean
94
101
theorem toFinset_toMultiset [DecidableEq Ξ±] (f : Ξ± β†’β‚€ β„•) : f.toMultiset.toFinset = f.support := by
refine f.induction ?_ ?_ Β· rw [toMultiset_zero, Multiset.toFinset_zero, support_zero] Β· intro a n f ha hn ih rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq, support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton] refine Disjoint.mo...
1,536
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.Finsupp.Order #align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Finset variable {Ξ± Ξ² ΞΉ : Type*} namespace Finsupp def toMultiset : (Ξ± β†’β‚€ β„•) β†’+ Multiset Ξ± where toFun f := Finsupp.sum f...
Mathlib/Data/Finsupp/Multiset.lean
105
114
theorem count_toMultiset [DecidableEq Ξ±] (f : Ξ± β†’β‚€ β„•) (a : Ξ±) : (toMultiset f).count a = f a := calc (toMultiset f).count a = Finsupp.sum f (fun x n => (n β€’ {x} : Multiset Ξ±).count a) := by
rw [toMultiset_apply]; exact map_sum (Multiset.countAddMonoidHom a) _ f.support _ = f.sum fun x n => n * ({x} : Multiset Ξ±).count a := by simp only [Multiset.count_nsmul] _ = f a * ({a} : Multiset Ξ±).count a := sum_eq_single _ (fun a' _ H => by simp only [Multiset.count_singleton, if_false,...
1,536
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.Finsupp.Order #align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Finset variable {Ξ± Ξ² ΞΉ : Type*} namespace Finsupp def toMultiset : (Ξ± β†’β‚€ β„•) β†’+ Multiset Ξ± where toFun f := Finsupp.sum f...
Mathlib/Data/Finsupp/Multiset.lean
117
120
theorem toMultiset_sup [DecidableEq Ξ±] (f g : Ξ± β†’β‚€ β„•) : toMultiset (f βŠ” g) = toMultiset f βˆͺ toMultiset g := by
ext simp_rw [Multiset.count_union, Finsupp.count_toMultiset, Finsupp.sup_apply, sup_eq_max]
1,536
import Mathlib.Data.Finsupp.Basic import Mathlib.Data.Finsupp.Order #align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Finset variable {Ξ± Ξ² ΞΉ : Type*} namespace Finsupp def toMultiset : (Ξ± β†’β‚€ β„•) β†’+ Multiset Ξ± where toFun f := Finsupp.sum f...
Mathlib/Data/Finsupp/Multiset.lean
122
125
theorem toMultiset_inf [DecidableEq Ξ±] (f g : Ξ± β†’β‚€ β„•) : toMultiset (f βŠ“ g) = toMultiset f ∩ toMultiset g := by
ext simp_rw [Multiset.count_inter, Finsupp.count_toMultiset, Finsupp.inf_apply, inf_eq_min]
1,536
import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Multiset.Antidiagonal #align_import data.finsupp.antidiagonal from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" namespace Finsupp open Finset universe u variable {Ξ± : Type u} [Decidab...
Mathlib/Data/Finsupp/Antidiagonal.lean
61
79
theorem antidiagonal_single (a : Ξ±) (n : β„•) : antidiagonal (single a n) = (antidiagonal n).map (Function.Embedding.prodMap ⟨_, single_injective a⟩ ⟨_, single_injective a⟩) := by
ext ⟨x, y⟩ simp only [mem_antidiagonal, mem_map, mem_antidiagonal, Function.Embedding.coe_prodMap, Function.Embedding.coeFn_mk, Prod.map_apply, Prod.mk.injEq, Prod.exists] constructor Β· intro h refine ⟨x a, y a, DFunLike.congr_fun h a |>.trans single_eq_same, ?_⟩ simp_rw [DFunLike.ext_iff, ← forall...
1,537
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
60
61
theorem factorization_def (n : β„•) {p : β„•} (pp : p.Prime) : n.factorization p = padicValNat p n := by
simpa [factorization] using absurd pp
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
67
81
theorem factors_count_eq {n p : β„•} : n.factors.count p = n.factorization p := by
rcases n.eq_zero_or_pos with (rfl | hn0) Β· simp [factorization, count] if pp : p.Prime then ?_ else rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)] simp [factorization, pp] simp only [factorization_def _ pp] apply _root_.le_antisymm Β· rw [le_padicValNat_iff_replicate_subperm_factors pp h...
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
84
87
theorem factorization_eq_factors_multiset (n : β„•) : n.factorization = Multiset.toFinsupp (n.factors : Multiset β„•) := by
ext p simp
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
90
92
theorem multiplicity_eq_factorization {n p : β„•} (pp : p.Prime) (hn : n β‰  0) : multiplicity p n = n.factorization p := by
simp [factorization, pp, padicValNat_def' pp.ne_one hn.bot_lt]
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
99
102
theorem factorization_prod_pow_eq_self {n : β„•} (hn : n β‰  0) : n.factorization.prod (Β· ^ Β·) = n := by
rw [factorization_eq_factors_multiset n] simp only [← prod_toMultiset, factorization, Multiset.prod_coe, Multiset.toFinsupp_toMultiset] exact prod_factors hn
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
116
116
theorem factorization_zero : factorization 0 = 0 := by
ext; simp [factorization]
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
120
120
theorem factorization_one : factorization 1 = 0 := by
ext; simp [factorization]
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
133
135
theorem factorization_eq_zero_iff (n p : β„•) : n.factorization p = 0 ↔ Β¬p.Prime ∨ Β¬p ∣ n ∨ n = 0 := by
simp_rw [← not_mem_support_iff, support_factorization, mem_primeFactors, not_and_or, not_ne_iff]
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
139
140
theorem factorization_eq_zero_of_non_prime (n : β„•) {p : β„•} (hp : Β¬p.Prime) : n.factorization p = 0 := by
simp [factorization_eq_zero_iff, hp]
1,538
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" ...
Mathlib/Data/Nat/Factorization/Basic.lean
143
144
theorem factorization_eq_zero_of_not_dvd {n p : β„•} (h : Β¬p ∣ n) : n.factorization p = 0 := by
simp [factorization_eq_zero_iff, h]
1,538
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat ...
Mathlib/Data/Nat/Totient.lean
51
57
theorem totient_eq_card_lt_and_coprime (n : β„•) : Ο† n = Nat.card { m | m < n ∧ n.Coprime m } := by
let e : { m | m < n ∧ n.Coprime m } ≃ Finset.filter n.Coprime (Finset.range n) := { toFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ invFun := fun m => ⟨m, by simpa only [Finset.mem_filter, Finset.mem_range] using m.property⟩ left_inv := fun m => by simp onl...
1,539
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat ...
Mathlib/Data/Nat/Totient.lean
78
81
theorem filter_coprime_Ico_eq_totient (a n : β„•) : ((Ico n (n + a)).filter (Coprime a)).card = totient a := by
rw [totient, filter_Ico_card_eq_of_periodic, count_eq_card_filter_range] exact periodic_coprime a
1,539
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat ...
Mathlib/Data/Nat/Totient.lean
84
109
theorem Ico_filter_coprime_le {a : β„•} (k n : β„•) (a_pos : 0 < a) : ((Ico k (k + n)).filter (Coprime a)).card ≀ totient a * (n / a + 1) := by
conv_lhs => rw [← Nat.mod_add_div n a] induction' n / a with i ih Β· rw [← filter_coprime_Ico_eq_totient a k] simp only [add_zero, mul_one, mul_zero, le_of_lt (mod_lt n a_pos), Nat.zero_eq, zero_add] -- Porting note: below line was `mono` refine Finset.card_mono ?_ refine monotone_filter_lef...
1,539
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat ...
Mathlib/Data/Nat/Totient.lean
117
126
theorem _root_.ZMod.card_units_eq_totient (n : β„•) [NeZero n] [Fintype (ZMod n)Λ£] : Fintype.card (ZMod n)Λ£ = Ο† n := calc Fintype.card (ZMod n)Λ£ = Fintype.card { x : ZMod n // x.val.Coprime n } := Fintype.card_congr ZMod.unitsEquivCoprime _ = Ο† n := by
obtain ⟨m, rfl⟩ : βˆƒ m, n = m + 1 := exists_eq_succ_of_ne_zero NeZero.out simp only [totient, Finset.card_eq_sum_ones, Fintype.card_subtype, Finset.sum_filter, ← Fin.sum_univ_eq_sum_range, @Nat.coprime_comm (m + 1)] rfl
1,539
import Mathlib.Algebra.CharP.Two import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Periodic import Mathlib.Data.ZMod.Basic import Mathlib.Tactic.Monotonicity #align_import data.nat.totient from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8" open Finset namespace Nat ...
Mathlib/Data/Nat/Totient.lean
129
135
theorem totient_even {n : β„•} (hn : 2 < n) : Even n.totient := by
haveI : Fact (1 < n) := ⟨one_lt_two.trans hn⟩ haveI : NeZero n := NeZero.of_gt hn suffices 2 = orderOf (-1 : (ZMod n)Λ£) by rw [← ZMod.card_units_eq_totient, even_iff_two_dvd, this] exact orderOf_dvd_card rw [← orderOf_units, Units.coe_neg_one, orderOf_neg_one, ringChar.eq (ZMod n) n, if_neg hn.ne']
1,539
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.OrderOfElement import Mathlib.Tactic.Zify import Mathlib.Data.Nat.Totient #align_import number_theory.lucas_primality from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
Mathlib/NumberTheory/LucasPrimality.lean
42
63
theorem 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 h0 : p β‰  0 := by rintro ⟨⟩ exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _) have h1 : p β‰  1 := by rintro ⟨⟩ exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _) have hp1 : 1 < p := lt_of_le_of_ne h0.bot_lt h1.symm have order_of_a : orderOf a = p - 1 := by apply orderOf_eq_of_pow_and_po...
1,540
import Mathlib.Data.Nat.Totient import Mathlib.Data.Nat.Nth import Mathlib.NumberTheory.SmoothNumbers #align_import number_theory.prime_counting from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0" namespace Nat open Finset def primeCounting' : β„• β†’ β„• := Nat.count Prime #align nat.pr...
Mathlib/NumberTheory/PrimeCounting.lean
83
102
theorem primeCounting'_add_le {a k : β„•} (h0 : 0 < a) (h1 : a < k) (n : β„•) : Ο€' (k + n) ≀ Ο€' k + Nat.totient a * (n / a + 1) := calc Ο€' (k + n) ≀ ((range k).filter Prime).card + ((Ico k (k + n)).filter Prime).card := by
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ← Ico_union_Ico_eq_Ico (zero_le k) le_self_add, filter_union] apply card_union_le _ ≀ Ο€' k + ((Ico k (k + n)).filter Prime).card := by rw [primeCounting', count_eq_card_filter_range] _ ≀ Ο€' k + ((Ico k (k + n)).filter (Copr...
1,541
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
64
79
theorem continuous_right_toIcoMod : ContinuousWithinAt (toIcoMod hp a) (Ici x) x := by
intro s h rw [Filter.mem_map, mem_nhdsWithin_iff_exists_mem_nhds_inter] haveI : Nontrivial π•œ := ⟨⟨0, p, hp.ne⟩⟩ simp_rw [mem_nhds_iff_exists_Ioo_subset] at h ⊒ obtain ⟨l, u, hxI, hIs⟩ := h let d := toIcoDiv hp a x β€’ p have hd := toIcoMod_mem_Ico hp a x simp_rw [subset_def, mem_inter_iff] refine ⟨_, ...
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
82
89
theorem continuous_left_toIocMod : ContinuousWithinAt (toIocMod hp a) (Iic x) x := by
rw [(funext fun y => Eq.trans (by rw [neg_neg]) <| toIocMod_neg _ _ _ : toIocMod hp a = (fun x => p - x) ∘ toIcoMod hp (-a) ∘ Neg.neg)] -- Porting note: added have : ContinuousNeg π•œ := TopologicalAddGroup.toContinuousNeg exact (continuous_sub_left _).continuousAt.comp_continuousWithinAt <| (co...
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
152
153
theorem coe_eq_zero_iff {x : π•œ} : (x : AddCircle p) = 0 ↔ βˆƒ n : β„€, n β€’ p = x := by
simp [AddSubgroup.mem_zmultiples_iff]
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
156
164
theorem coe_eq_zero_of_pos_iff (hp : 0 < p) {x : π•œ} (hx : 0 < x) : (x : AddCircle p) = 0 ↔ βˆƒ n : β„•, n β€’ p = x := by
rw [coe_eq_zero_iff] constructor <;> rintro ⟨n, rfl⟩ Β· replace hx : 0 < n := by contrapose! hx simpa only [← neg_nonneg, ← zsmul_neg, zsmul_neg'] using zsmul_nonneg hp.le (neg_nonneg.2 hx) exact ⟨n.toNat, by rw [← natCast_zsmul, Int.toNat_of_nonneg hx.le]⟩ Β· exact ⟨(n : β„€), by simp⟩
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
175
176
theorem coe_add_period (x : π•œ) : ((x + p : π•œ) : AddCircle p) = x := by
rw [coe_add, ← eq_sub_iff_add_eq', sub_self, coe_period]
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
213
219
theorem coe_eq_coe_iff_of_mem_Ico {x y : π•œ} (hx : x ∈ Ico a (a + p)) (hy : y ∈ Ico a (a + p)) : (x : AddCircle p) = y ↔ x = y := by
refine ⟨fun h => ?_, by tauto⟩ suffices (⟨x, hx⟩ : Ico a (a + p)) = ⟨y, hy⟩ by exact Subtype.mk.inj this apply_fun equivIco p a at h rw [← (equivIco p a).right_inv ⟨x, hx⟩, ← (equivIco p a).right_inv ⟨y, hy⟩] exact h
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
222
228
theorem liftIco_coe_apply {f : π•œ β†’ B} {x : π•œ} (hx : x ∈ Ico a (a + p)) : liftIco p a f ↑x = f x := by
have : (equivIco p a) x = ⟨x, hx⟩ := by rw [Equiv.apply_eq_iff_eq_symm_apply] rfl rw [liftIco, comp_apply, this] rfl
1,542
import Mathlib.Algebra.Order.ToIntervalMod import Mathlib.Algebra.Ring.AddAut import Mathlib.Data.Nat.Totient import Mathlib.GroupTheory.Divisible import Mathlib.Topology.Connected.PathConnected import Mathlib.Topology.IsLocalHomeomorph #align_import topology.instances.add_circle from "leanprover-community/mathlib"@"...
Mathlib/Topology/Instances/AddCircle.lean
231
237
theorem liftIoc_coe_apply {f : π•œ β†’ B} {x : π•œ} (hx : x ∈ Ioc a (a + p)) : liftIoc p a f ↑x = f x := by
have : (equivIoc p a) x = ⟨x, hx⟩ := by rw [Equiv.apply_eq_iff_eq_symm_apply] rfl rw [liftIoc, comp_apply, this] rfl
1,542
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace A...
Mathlib/Analysis/Normed/Group/AddCircle.lean
44
68
theorem norm_coe_mul (x : ℝ) (t : ℝ) : β€–(↑(t * x) : AddCircle (t * p))β€– = |t| * β€–(x : AddCircle p)β€– := by
have aux : βˆ€ {a b c : ℝ}, a ∈ zmultiples b β†’ c * a ∈ zmultiples (c * b) := fun {a b c} h => by simp only [mem_zmultiples_iff] at h ⊒ obtain ⟨n, rfl⟩ := h exact ⟨n, (mul_smul_comm n c b).symm⟩ rcases eq_or_ne t 0 with (rfl | ht); Β· simp have ht' : |t| β‰  0 := (not_congr abs_eq_zero).mpr ht simp only ...
1,543
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace A...
Mathlib/Analysis/Normed/Group/AddCircle.lean
71
75
theorem norm_neg_period (x : ℝ) : β€–(x : AddCircle (-p))β€– = β€–(x : AddCircle p)β€– := by
suffices β€–(↑(-1 * x) : AddCircle (-1 * p))β€– = β€–(x : AddCircle p)β€– by rw [← this, neg_one_mul] simp simp only [norm_coe_mul, abs_neg, abs_one, one_mul]
1,543
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace A...
Mathlib/Analysis/Normed/Group/AddCircle.lean
79
83
theorem norm_eq_of_zero {x : ℝ} : β€–(x : AddCircle (0 : ℝ))β€– = |x| := by
suffices { y : ℝ | (y : AddCircle (0 : ℝ)) = (x : AddCircle (0 : ℝ)) } = {x} by rw [quotient_norm_eq, this, image_singleton, Real.norm_eq_abs, csInf_singleton] ext y simp [QuotientAddGroup.eq_iff_sub_mem, mem_zmultiples_iff, sub_eq_zero]
1,543
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace A...
Mathlib/Analysis/Normed/Group/AddCircle.lean
86
117
theorem norm_eq {x : ℝ} : β€–(x : AddCircle p)β€– = |x - round (p⁻¹ * x) * p| := by
suffices βˆ€ x : ℝ, β€–(x : AddCircle (1 : ℝ))β€– = |x - round x| by rcases eq_or_ne p 0 with (rfl | hp) Β· simp have hx := norm_coe_mul p x p⁻¹ rw [abs_inv, eq_inv_mul_iff_mul_eqβ‚€ ((not_congr abs_eq_zero).mpr hp)] at hx rw [← hx, inv_mul_cancel hp, this, ← abs_mul, mul_sub, mul_inv_cancel_leftβ‚€ hp, mul...
1,543
import Mathlib.Analysis.Normed.Group.Quotient import Mathlib.Topology.Instances.AddCircle #align_import analysis.normed.group.add_circle from "leanprover-community/mathlib"@"084f76e20c88eae536222583331abd9468b08e1c" noncomputable section open Set open Int hiding mem_zmultiples_iff open AddSubgroup namespace A...
Mathlib/Analysis/Normed/Group/AddCircle.lean
120
124
theorem norm_eq' (hp : 0 < p) {x : ℝ} : β€–(x : AddCircle p)β€– = p * |p⁻¹ * x - round (p⁻¹ * x)| := by
conv_rhs => congr rw [← abs_eq_self.mpr hp.le] rw [← abs_mul, mul_sub, mul_inv_cancel_leftβ‚€ hp.ne.symm, norm_eq, mul_comm p]
1,543
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
107
108
theorem natCast_mul_eq_nsmul (x : ℝ) (n : β„•) : ↑((n : ℝ) * x) = n β€’ (↑x : Angle) := by
simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
112
113
theorem intCast_mul_eq_zsmul (x : ℝ) (n : β„€) : ↑((n : ℝ) * x : ℝ) = n β€’ (↑x : Angle) := by
simpa only [zsmul_eq_mul] using coeHom.map_zsmul x n
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
119
125
theorem angle_eq_iff_two_pi_dvd_sub {ψ ΞΈ : ℝ} : (ΞΈ : Angle) = ψ ↔ βˆƒ k : β„€, ΞΈ - ψ = 2 * Ο€ * k := by
simp only [QuotientAddGroup.eq, AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] -- Porting note: added `rw`, `simp [Angle.coe, QuotientAddGroup.eq]` doesn't fire otherwise rw [Angle.coe, Angle.coe, QuotientAddGroup.eq] simp only [AddS...
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
134
137
theorem neg_coe_pi : -(Ο€ : Angle) = Ο€ := by
rw [← coe_neg, angle_eq_iff_two_pi_dvd_sub] use -1 simp [two_mul, sub_eq_add_neg]
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
141
142
theorem two_nsmul_coe_div_two (ΞΈ : ℝ) : (2 : β„•) β€’ (↑(ΞΈ / 2) : Angle) = ΞΈ := by
rw [← coe_nsmul, two_nsmul, add_halves]
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829...
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
146
147
theorem two_zsmul_coe_div_two (ΞΈ : ℝ) : (2 : β„€) β€’ (↑(ΞΈ / 2) : Angle) = ΞΈ := by
rw [← coe_zsmul, two_zsmul, add_halves]
1,544
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
33
37
theorem sin_arg (x : β„‚) : Real.sin (arg x) = x.im / abs x := by
unfold arg; split_ifs <;> simp [sub_eq_add_neg, arg, Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg]
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
40
50
theorem cos_arg {x : β„‚} (hx : x β‰  0) : Real.cos (arg x) = x.re / abs x := by
rw [arg] split_ifs with h₁ hβ‚‚ Β· rw [Real.cos_arcsin] field_simp [Real.sqrt_sq, (abs.pos hx).le, *] Β· rw [Real.cos_add_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] Β· rw [Real.cos_sub_pi, Real.cos_arcsin] field_simp [Re...
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
54
58
theorem abs_mul_exp_arg_mul_I (x : β„‚) : ↑(abs x) * exp (arg x * I) = x := by
rcases eq_or_ne x 0 with (rfl | hx) Β· simp Β· have : abs x β‰  0 := abs.ne_zero hx apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
63
64
theorem abs_mul_cos_add_sin_mul_I (x : β„‚) : (abs x * (cos (arg x) + sin (arg x) * I) : β„‚) = x := by
rw [← exp_mul_I, abs_mul_exp_arg_mul_I]
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
76
83
theorem abs_eq_one_iff (z : β„‚) : abs z = 1 ↔ βˆƒ ΞΈ : ℝ, exp (ΞΈ * I) = z := by
refine ⟨fun hz => ⟨arg z, ?_⟩, ?_⟩ · calc exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul] _ = z := abs_mul_exp_arg_mul_I z · rintro ⟨θ, rfl⟩ exact Complex.abs_exp_ofReal_mul_I θ
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
87
89
theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by
ext x simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range]
1,545
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real To...
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
93
114
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {ΞΈ : ℝ} (hΞΈ : ΞΈ ∈ Set.Ioc (-Ο€) Ο€) : arg (r * (cos ΞΈ + sin ΞΈ * I)) = ΞΈ := by
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one] simp only [re_ofReal_mul, im_ofReal_mul, neg_im, ← ofReal_cos, ← ofReal_sin, ← mk_eq_add_mul_I, neg_div, mul_div_cancel_leftβ‚€ _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr] by_cases h₁ : ΞΈ ∈ Set.Icc (-(Ο€ / 2)) (Ο€ / 2) Β· rw [if_...
1,545
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•}
Mathlib/Data/Nat/Choose/Factorization.lean
36
45
theorem factorization_choose_le_log : (choose n k).factorization p ≀ log p n := by
by_cases h : (choose n k).factorization p = 0 Β· simp [h] have hp : p.Prime := Not.imp_symm (choose n k).factorization_eq_zero_of_non_prime h have hkn : k ≀ n := by refine le_of_not_lt fun hnk => h ?_ simp [choose_eq_zero_of_lt hnk] rw [factorization_def _ hp, @padicValNat_def _ ⟨hp⟩ _ (choose_pos hkn...
1,546
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•} theorem factorization_choose_le_l...
Mathlib/Data/Nat/Choose/Factorization.lean
55
58
theorem factorization_choose_le_one (p_large : n < p ^ 2) : (choose n k).factorization p ≀ 1 := by
apply factorization_choose_le_log.trans rcases eq_or_ne n 0 with (rfl | hn0); Β· simp exact Nat.lt_succ_iff.1 (log_lt_of_lt_pow hn0 p_large)
1,546
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•} theorem factorization_choose_le_l...
Mathlib/Data/Nat/Choose/Factorization.lean
61
88
theorem factorization_choose_of_lt_three_mul (hp' : p β‰  2) (hk : p ≀ k) (hk' : p ≀ n - k) (hn : n < 3 * p) : (choose n k).factorization p = 0 := by
cases' em' p.Prime with hp hp · exact factorization_eq_zero_of_non_prime (choose n k) hp cases' lt_or_le n k with hnk hkn · simp [choose_eq_zero_of_lt hnk] rw [factorization_def _ hp, @padicValNat_def _ ⟨hp⟩ _ (choose_pos hkn)] simp only [hp.multiplicity_choose hkn (lt_add_one _), PartENat.get_natCast, Fin...
1,546
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•} theorem factorization_choose_le_l...
Mathlib/Data/Nat/Choose/Factorization.lean
93
97
theorem factorization_centralBinom_of_two_mul_self_lt_three_mul (n_big : 2 < n) (p_le_n : p ≀ n) (big : 2 * n < 3 * p) : (centralBinom n).factorization p = 0 := by
refine factorization_choose_of_lt_three_mul ?_ p_le_n (p_le_n.trans ?_) big Β· omega Β· rw [two_mul, add_tsub_cancel_left]
1,546
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•} theorem factorization_choose_le_l...
Mathlib/Data/Nat/Choose/Factorization.lean
100
103
theorem factorization_factorial_eq_zero_of_lt (h : n < p) : (factorial n).factorization p = 0 := by
induction' n with n hn; Β· simp rw [factorial_succ, factorization_mul n.succ_ne_zero n.factorial_ne_zero, Finsupp.coe_add, Pi.add_apply, hn (lt_of_succ_lt h), add_zero, factorization_eq_zero_of_lt h]
1,546
import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.Nat.Multiplicity #align_import data.nat.choose.factorization from "leanprover-community/mathlib"@"dc9db541168768af03fe228703e758e649afdbfc" namespace Nat variable {p n k : β„•} theorem factorization_choose_le_l...
Mathlib/Data/Nat/Choose/Factorization.lean
106
110
theorem factorization_choose_eq_zero_of_lt (h : n < p) : (choose n k).factorization p = 0 := by
by_cases hnk : n < k; Β· simp [choose_eq_zero_of_lt hnk] rw [choose_eq_factorial_div_factorial (le_of_not_lt hnk), factorization_div (factorial_mul_factorial_dvd_factorial (le_of_not_lt hnk)), Finsupp.coe_tsub, Pi.sub_apply, factorization_factorial_eq_zero_of_lt h, zero_tsub]
1,546
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•)
Mathlib/Data/Nat/Factorization/PrimePow.lean
20
24
theorem IsPrimePow.minFac_pow_factorization_eq {n : β„•} (hn : IsPrimePow n) : n.minFac ^ n.factorization n.minFac = n := by
obtain ⟨p, k, hp, hk, rfl⟩ := hn rw [← Nat.prime_iff] at hp rw [hp.pow_minFac hk.ne', hp.factorization_pow, Finsupp.single_eq_same]
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
27
33
theorem isPrimePow_of_minFac_pow_factorization_eq {n : β„•} (h : n.minFac ^ n.factorization n.minFac = n) (hn : n β‰  1) : IsPrimePow n := by
rcases eq_or_ne n 0 with (rfl | hn') Β· simp_all refine ⟨_, _, (Nat.minFac_prime hn).prime, ?_, h⟩ simp [pos_iff_ne_zero, ← Finsupp.mem_support_iff, Nat.support_factorization, hn', Nat.minFac_prime hn, Nat.minFac_dvd]
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
41
54
theorem isPrimePow_iff_factorization_eq_single {n : β„•} : IsPrimePow n ↔ βˆƒ p k : β„•, 0 < k ∧ n.factorization = Finsupp.single p k := by
rw [isPrimePow_nat_iff] refine existsβ‚‚_congr fun p k => ?_ constructor Β· rintro ⟨hp, hk, hn⟩ exact ⟨hk, by rw [← hn, Nat.Prime.factorization_pow hp]⟩ Β· rintro ⟨hk, hn⟩ have hn0 : n β‰  0 := by rintro rfl simp_all only [Finsupp.single_eq_zero, eq_comm, Nat.factorization_zero, hk.ne'] rw ...
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
57
60
theorem isPrimePow_iff_card_primeFactors_eq_one {n : β„•} : IsPrimePow n ↔ n.primeFactors.card = 1 := by
simp_rw [isPrimePow_iff_factorization_eq_single, ← Nat.support_factorization, Finsupp.card_support_eq_one', pos_iff_ne_zero]
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
63
73
theorem IsPrimePow.exists_ord_compl_eq_one {n : β„•} (h : IsPrimePow n) : βˆƒ p : β„•, p.Prime ∧ ord_compl[p] n = 1 := by
rcases eq_or_ne n 0 with (rfl | hn0); Β· cases not_isPrimePow_zero h rcases isPrimePow_iff_factorization_eq_single.mp h with ⟨p, k, hk0, h1⟩ rcases em' p.Prime with (pp | pp) Β· refine absurd ?_ hk0.ne' simp [← Nat.factorization_eq_zero_of_non_prime n pp, h1] refine ⟨p, pp, ?_⟩ refine Nat.eq_of_factoriza...
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
76
84
theorem exists_ord_compl_eq_one_iff_isPrimePow {n : β„•} (hn : n β‰  1) : IsPrimePow n ↔ βˆƒ p : β„•, p.Prime ∧ ord_compl[p] n = 1 := by
refine ⟨fun h => IsPrimePow.exists_ord_compl_eq_one h, fun h => ?_⟩ rcases h with ⟨p, pp, h⟩ rw [isPrimePow_nat_iff] rw [← Nat.eq_of_dvd_of_div_eq_one (Nat.ord_proj_dvd n p) h] at hn ⊒ refine ⟨p, n.factorization p, pp, ?_, by simp⟩ contrapose! hn simp [Nat.le_zero.1 hn]
1,547
import Mathlib.Algebra.IsPrimePow import Mathlib.Data.Nat.Factorization.Basic #align_import data.nat.factorization.prime_pow from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β„•) theorem IsPrimePow.minFac_pow_factorization_eq ...
Mathlib/Data/Nat/Factorization/PrimePow.lean
89
108
theorem isPrimePow_iff_unique_prime_dvd {n : β„•} : IsPrimePow n ↔ βˆƒ! p : β„•, p.Prime ∧ p ∣ n := by
rw [isPrimePow_nat_iff] constructor Β· rintro ⟨p, k, hp, hk, rfl⟩ refine ⟨p, ⟨hp, dvd_pow_self _ hk.ne'⟩, ?_⟩ rintro q ⟨hq, hq'⟩ exact (Nat.prime_dvd_prime_iff_eq hq hp).1 (hq.dvd_of_dvd_pow hq') rintro ⟨p, ⟨hp, hn⟩, hq⟩ rcases eq_or_ne n 0 with (rfl | hnβ‚€) Β· cases (hq 2 ⟨Nat.prime_two, dvd_zero...
1,547
import Mathlib.Algebra.Squarefree.Basic import Mathlib.Data.Nat.Factorization.PrimePow #align_import data.nat.squarefree from "leanprover-community/mathlib"@"3c1368cac4abd5a5cbe44317ba7e87379d51ed88" open Finset namespace Nat
Mathlib/Data/Nat/Squarefree.lean
28
30
theorem squarefree_iff_nodup_factors {n : β„•} (h0 : n β‰  0) : Squarefree n ↔ n.factors.Nodup := by
rw [UniqueFactorizationMonoid.squarefree_iff_nodup_normalizedFactors h0, Nat.factors_eq] simp
1,548
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section Fermat open GaussianInt
Mathlib/NumberTheory/SumTwoSquares.lean
33
36
theorem Nat.Prime.sq_add_sq {p : β„•} [Fact p.Prime] (hp : p % 4 β‰  3) : βˆƒ a b : β„•, a ^ 2 + b ^ 2 = p := by
apply sq_add_sq_of_nat_prime_of_not_irreducible p rwa [_root_.irreducible_iff_prime, prime_iff_mod_four_eq_three_of_nat_prime p]
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section General theorem sq_add_sq_mul {R} [CommRing R] ...
Mathlib/NumberTheory/SumTwoSquares.lean
56
61
theorem Nat.sq_add_sq_mul {a b x y u v : β„•} (ha : a = x ^ 2 + y ^ 2) (hb : b = u ^ 2 + v ^ 2) : βˆƒ r s : β„•, a * b = r ^ 2 + s ^ 2 := by
zify at ha hb ⊒ obtain ⟨r, s, h⟩ := _root_.sq_add_sq_mul ha hb refine ⟨r.natAbs, s.natAbs, ?_⟩ simpa only [Int.natCast_natAbs, sq_abs]
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for ...
Mathlib/NumberTheory/SumTwoSquares.lean
77
81
theorem ZMod.isSquare_neg_one_of_dvd {m n : β„•} (hd : m ∣ n) (hs : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod m) := by
let f : ZMod n β†’+* ZMod m := ZMod.castHom hd _ rw [← RingHom.map_one f, ← RingHom.map_neg] exact hs.map f
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for ...
Mathlib/NumberTheory/SumTwoSquares.lean
86
94
theorem ZMod.isSquare_neg_one_mul {m n : β„•} (hc : m.Coprime n) (hm : IsSquare (-1 : ZMod m)) (hn : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod (m * n)) := by
have : IsSquare (-1 : ZMod m Γ— ZMod n) := by rw [show (-1 : ZMod m Γ— ZMod n) = ((-1 : ZMod m), (-1 : ZMod n)) from rfl] obtain ⟨x, hx⟩ := hm obtain ⟨y, hy⟩ := hn rw [hx, hy] exact ⟨(x, y), rfl⟩ simpa only [RingEquiv.map_neg_one] using this.map (ZMod.chineseRemainder hc).symm
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for ...
Mathlib/NumberTheory/SumTwoSquares.lean
98
103
theorem Nat.Prime.mod_four_ne_three_of_dvd_isSquare_neg_one {p n : β„•} (hpp : p.Prime) (hp : p ∣ n) (hs : IsSquare (-1 : ZMod n)) : p % 4 β‰  3 := by
obtain ⟨y, h⟩ := ZMod.isSquare_neg_one_of_dvd hp hs rw [← sq, eq_comm, show (-1 : ZMod p) = -1 ^ 2 by ring] at h haveI : Fact p.Prime := ⟨hpp⟩ exact ZMod.mod_four_ne_three_of_sq_eq_neg_sq' one_ne_zero h
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for ...
Mathlib/NumberTheory/SumTwoSquares.lean
108
120
theorem ZMod.isSquare_neg_one_iff {n : β„•} (hn : Squarefree n) : IsSquare (-1 : ZMod n) ↔ βˆ€ {q : β„•}, q.Prime β†’ q ∣ n β†’ q % 4 β‰  3 := by
refine ⟨fun H q hqp hqd => hqp.mod_four_ne_three_of_dvd_isSquare_neg_one hqd H, fun H => ?_⟩ induction' n using induction_on_primes with p n hpp ih · exact False.elim (hn.ne_zero rfl) · exact ⟨0, by simp only [mul_zero, eq_iff_true_of_subsingleton]⟩ · haveI : Fact p.Prime := ⟨hpp⟩ have hcp : p.Coprime n ...
1,549
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for ...
Mathlib/NumberTheory/SumTwoSquares.lean
125
138
theorem ZMod.isSquare_neg_one_iff' {n : β„•} (hn : Squarefree n) : IsSquare (-1 : ZMod n) ↔ βˆ€ {q : β„•}, q ∣ n β†’ q % 4 β‰  3 := by
have help : βˆ€ a b : ZMod 4, a β‰  3 β†’ b β‰  3 β†’ a * b β‰  3 := by decide rw [ZMod.isSquare_neg_one_iff hn] refine ⟨?_, fun H q _ => H⟩ intro H refine @induction_on_primes _ ?_ ?_ (fun p q hp hq hpq => ?_) Β· exact fun _ => by norm_num Β· exact fun _ => by norm_num Β· replace hp := H hp (dvd_of_mul_right_dvd hpq...
1,549
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
94
97
theorem _root_.MulOpposite.exponent : exponent (MulOpposite G) = exponent G := by
simp only [Monoid.exponent, ExponentExists] congr! all_goals exact ⟨(op_injective <| · <| op ·), (unop_injective <| · <| unop ·)⟩
1,550
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
108
113
theorem exponent_ne_zero : exponent G β‰  0 ↔ ExponentExists G := by
rw [exponent] split_ifs with h Β· simp [h, @not_lt_zero' β„•] --if this isn't done this way, `to_additive` freaks Β· tauto
1,550
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
145
148
theorem exponent_eq_zero_iff_forall : exponent G = 0 ↔ βˆ€ n > 0, βˆƒ g : G, g ^ n β‰  1 := by
rw [exponent_eq_zero_iff, ExponentExists] push_neg rfl
1,550
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
151
155
theorem pow_exponent_eq_one (g : G) : g ^ exponent G = 1 := by
by_cases h : ExponentExists G Β· simp_rw [exponent, dif_pos h] exact (Nat.find_spec h).2 g Β· simp_rw [exponent, dif_neg h, pow_zero]
1,550
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
160
163
theorem pow_eq_mod_exponent {n : β„•} (g : G) : g ^ n = g ^ (n % exponent G) := calc g ^ n = g ^ (n % exponent G + exponent G * (n / exponent G)) := by
rw [Nat.mod_add_div] _ = g ^ (n % exponent G) := by simp [pow_add, pow_mul, pow_exponent_eq_one]
1,550
import Mathlib.Data.ZMod.Quotient import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.GCDMonoid.Nat import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Tactic.ByContra import Mathlib.Tactic.Peel #align_import group_...
Mathlib/GroupTheory/Exponent.lean
176
180
theorem exponent_min' (n : β„•) (hpos : 0 < n) (hG : βˆ€ g : G, g ^ n = 1) : exponent G ≀ n := by
rw [exponent, dif_pos] · apply Nat.find_min' exact ⟨hpos, hG⟩ · exact ⟨n, hpos, hG⟩
1,550
import Mathlib.Dynamics.PeriodicPts import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.GroupAction.Basic namespace MulAction universe u v variable {Ξ± : Type v} variable {G : Type u} [Group G] [MulAction G Ξ±] variable {M : Type u} [Monoid M] [MulAction M Ξ±] @[to_additive "If the action is periodic, t...
Mathlib/GroupTheory/GroupAction/Period.lean
71
75
theorem period_inv (g : G) (a : α) : period g⁻¹ a = period g a := by
simp only [period_eq_minimalPeriod, Function.minimalPeriod_eq_minimalPeriod_iff, isPeriodicPt_smul_iff] intro n rw [smul_eq_iff_eq_inv_smul, eq_comm, ← zpow_natCast, inv_zpow, inv_inv, zpow_natCast]
1,551
import Mathlib.Dynamics.PeriodicPts import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.GroupAction.Basic namespace MulAction universe u v variable {Ξ± : Type v} variable {G : Type u} [Group G] [MulAction G Ξ±] variable {M : Type u} [Monoid M] [MulAction M Ξ±] @[to_additive "If the action is periodic, t...
Mathlib/GroupTheory/GroupAction/Period.lean
87
88
theorem period_dvd_orderOf (m : M) (a : α) : period m a ∣ orderOf m := by
rw [← pow_smul_eq_iff_period_dvd, pow_orderOf_eq_one, one_smul]
1,551
import Mathlib.Dynamics.PeriodicPts import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.GroupAction.Basic namespace MulAction universe u v variable {Ξ± : Type v} variable {G : Type u} [Group G] [MulAction G Ξ±] variable {M : Type u} [Monoid M] [MulAction M Ξ±] @[to_additive "If the action is periodic, t...
Mathlib/GroupTheory/GroupAction/Period.lean
101
102
theorem period_dvd_exponent (m : M) (a : α) : period m a ∣ Monoid.exponent M := by
rw [← pow_smul_eq_iff_period_dvd, Monoid.pow_exponent_eq_one, one_smul]
1,551
import Mathlib.Dynamics.PeriodicPts import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.GroupAction.Basic namespace MulAction universe u v variable {Ξ± : Type v} variable {G : Type u} [Group G] [MulAction G Ξ±] variable {M : Type u} [Monoid M] [MulAction M Ξ±] @[to_additive "If the action is periodic, t...
Mathlib/GroupTheory/GroupAction/Period.lean
117
120
theorem period_bounded_of_exponent_pos (exp_pos : 0 < Monoid.exponent M) (m : M) : BddAbove (Set.range (fun a : Ξ± => period m a)) := by
use Monoid.exponent M simpa [upperBounds] using period_le_exponent exp_pos _
1,551
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
125
126
theorem card [NeZero n] : Fintype.card (DihedralGroup n) = 2 * n := by
rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul]
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
129
132
theorem nat_card : Nat.card (DihedralGroup n) = 2 * n := by
cases n Β· rw [Nat.card_eq_zero_of_infinite] Β· rw [Nat.card_eq_fintype_card, card]
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
135
142
theorem r_one_pow (k : β„•) : (r 1 : DihedralGroup n) ^ k = r k := by
induction' k with k IH Β· rw [Nat.cast_zero] rfl Β· rw [pow_succ', IH, r_mul_r] congr 1 norm_cast rw [Nat.one_add]
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
146
149
theorem r_one_pow_n : r (1 : ZMod n) ^ n = 1 := by
rw [r_one_pow, one_def] congr 1 exact ZMod.natCast_self _
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
153
153
theorem sr_mul_self (i : ZMod n) : sr i * sr i = 1 := by
rw [sr_mul_sr, sub_self, one_def]
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
159
164
theorem orderOf_sr (i : ZMod n) : orderOf (sr i) = 2 := by
apply orderOf_eq_prime Β· rw [sq, sr_mul_self] Β· -- Porting note: Previous proof was `decide` revert n simp_rw [one_def, ne_eq, forall_const, not_false_eq_true]
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
170
184
theorem orderOf_r_one : orderOf (r 1 : DihedralGroup n) = n := by
rcases eq_zero_or_neZero n with (rfl | hn) Β· rw [orderOf_eq_zero_iff'] intro n hn rw [r_one_pow, one_def] apply mt r.inj simpa using hn.ne' Β· apply (Nat.le_of_dvd (NeZero.pos n) <| orderOf_dvd_of_pow_eq_one <| @r_one_pow_n n).lt_or_eq.resolve_left intro h have h1 : (r 1 : DihedralGr...
1,552
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Exponent #align_import group_theory.specific_groups.dihedral from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" inductive DihedralGroup (n : β„•) : Type | r : ZMod n β†’ DihedralGroup n | sr : ZMod n β†’ DihedralGroup n derivin...
Mathlib/GroupTheory/SpecificGroups/Dihedral.lean
189
191
theorem orderOf_r [NeZero n] (i : ZMod n) : orderOf (r i) = n / Nat.gcd n i.val := by
conv_lhs => rw [← ZMod.natCast_zmod_val i] rw [← r_one_pow, orderOf_pow, orderOf_r_one]
1,552
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
47
52
theorem commProb_prod (M' : Type*) [Mul M'] : commProb (M Γ— M') = commProb M * commProb M' := by
simp_rw [commProb_def, div_mul_div_comm, Nat.card_prod, Nat.cast_mul, mul_pow, ← Nat.cast_mul, ← Nat.card_prod, Commute, SemiconjBy, Prod.ext_iff] congr 2 exact Nat.card_congr ⟨fun x => ⟨⟨⟨x.1.1.1, x.1.2.1⟩, x.2.1⟩, ⟨⟨x.1.1.2, x.1.2.2⟩, x.2.2⟩⟩, fun x => ⟨⟨⟨x.1.1.1, x.2.1.1⟩, ⟨x.1.1.2, x.2.1.2⟩⟩, ⟨x.1.2,...
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
54
60
theorem commProb_pi {Ξ± : Type*} (i : Ξ± β†’ Type*) [Fintype Ξ±] [βˆ€ a, Mul (i a)] : commProb (βˆ€ a, i a) = ∏ a, commProb (i a) := by
simp_rw [commProb_def, Finset.prod_div_distrib, Finset.prod_pow, ← Nat.cast_prod, ← Nat.card_pi, Commute, SemiconjBy, Function.funext_iff] congr 2 exact Nat.card_congr ⟨fun x a => ⟨⟨x.1.1 a, x.1.2 a⟩, x.2 a⟩, fun x => ⟨⟨fun a => (x a).1.1, fun a => (x a).1.2⟩, fun a => (x a).2⟩, fun x => rfl, fun x => rf...
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
62
64
theorem commProb_function {Ξ± Ξ² : Type*} [Fintype Ξ±] [Mul Ξ²] : commProb (Ξ± β†’ Ξ²) = (commProb Ξ²) ^ Fintype.card Ξ± := by
rw [commProb_pi, Finset.prod_const, Finset.card_univ]
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
78
81
theorem commProb_le_one : commProb M ≀ 1 := by
refine div_le_one_of_le ?_ (sq_nonneg (Nat.card M : β„š)) rw [← Nat.cast_pow, Nat.cast_le, sq, ← Nat.card_prod] apply Finite.card_subtype_le
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
86
93
theorem commProb_eq_one_iff [h : Nonempty M] : commProb M = 1 ↔ Commutative ((Β· * Β·) : M β†’ M β†’ M) := by
haveI := Fintype.ofFinite M rw [commProb, ← Set.coe_setOf, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] rw [div_eq_one_iff_eq, ← Nat.cast_pow, Nat.cast_inj, sq, ← card_prod, set_fintype_card_eq_univ_iff, Set.eq_univ_iff_forall] Β· exact ⟨fun h x y ↦ h (x, y), fun h x ↦ h x.1 x.2⟩ Β· exact pow_ne_zer...
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
98
102
theorem commProb_def' : commProb G = Nat.card (ConjClasses G) / Nat.card G := by
rw [commProb, card_comm_eq_card_conjClasses_mul_card, Nat.cast_mul, sq] by_cases h : (Nat.card G : β„š) = 0 Β· rw [h, zero_mul, div_zero, div_zero] Β· exact mul_div_mul_right _ _ h
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
108
116
theorem Subgroup.commProb_subgroup_le : commProb H ≀ commProb G * (H.index : β„š) ^ 2 := by
/- After rewriting with `commProb_def`, we reduce to showing that `G` has at least as many commuting pairs as `H`. -/ rw [commProb_def, commProb_def, div_le_iff, mul_assoc, ← mul_pow, ← Nat.cast_mul, mul_comm H.index, H.card_mul_index, div_mul_cancelβ‚€, Nat.cast_le] Β· refine Finite.card_le_of_injective ...
1,553
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Line...
Mathlib/GroupTheory/CommutingProbability.lean
119
128
theorem Subgroup.commProb_quotient_le [H.Normal] : commProb (G β§Έ H) ≀ commProb G * Nat.card H := by
/- After rewriting with `commProb_def'`, we reduce to showing that `G` has at least as many conjugacy classes as `G β§Έ H`. -/ rw [commProb_def', commProb_def', div_le_iff, mul_assoc, ← Nat.cast_mul, ← Subgroup.index, H.card_mul_index, div_mul_cancelβ‚€, Nat.cast_le] Β· apply Finite.card_le_of_surjective ...
1,553
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : T...
Mathlib/GroupTheory/Schreier.lean
37
58
theorem closure_mul_image_mul_eq_top (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊀) : (closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹)) * R = ⊀ := by
let f : G β†’ R := fun g => toFun hR g let U : Set G := (R * S).image fun g => g * (f g : G)⁻¹ change (closure U : Set G) * R = ⊀ refine top_le_iff.mp fun g _ => ?_ refine closure_induction_right ?_ ?_ ?_ (eq_top_iff.mp hS (mem_top g)) Β· exact ⟨1, (closure U).one_mem, 1, hR1, one_mul 1⟩ Β· rintro - - s hs ⟨...
1,554
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : T...
Mathlib/GroupTheory/Schreier.lean
64
79
theorem closure_mul_image_eq (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊀) : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) = H := by
have hU : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) ≀ H := by rw [closure_le] rintro - ⟨g, -, rfl⟩ exact mul_inv_toFun_mem hR g refine le_antisymm hU fun h hh => ?_ obtain ⟨g, hg, r, hr, rfl⟩ := show h ∈ _ from eq_top_iff.mp (closure_mul_image_mul_eq_top hR hR1 hS) (mem_top h) suf...
1,554
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : T...
Mathlib/GroupTheory/Schreier.lean
85
89
theorem closure_mul_image_eq_top (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊀) : closure ((R * S).image fun g => ⟨g * (toFun hR g : G)⁻¹, mul_inv_toFun_mem hR g⟩ : Set H) = ⊀ := by
rw [eq_top_iff, ← map_subtype_le_map_subtype, MonoidHom.map_closure, Set.image_image] exact (map_subtype_le ⊀).trans (ge_of_eq (closure_mul_image_eq hR hR1 hS))
1,554
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : T...
Mathlib/GroupTheory/Schreier.lean
95
100
theorem closure_mul_image_eq_top' [DecidableEq G] {R S : Finset G} (hR : (R : Set G) ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure (S : Set G) = ⊀) : closure (((R * S).image fun g => ⟨_, mul_inv_toFun_mem hR g⟩ : Finset H) : Set H) = ⊀ := by
rw [Finset.coe_image, Finset.coe_mul] exact closure_mul_image_eq_top hR hR1 hS
1,554
import Mathlib.GroupTheory.Abelianization import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.Transfer #align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6" open scoped Pointwise namespace Subgroup open MemRightTransversals variable {G : T...
Mathlib/GroupTheory/Schreier.lean
105
124
theorem exists_finset_card_le_mul [FiniteIndex H] {S : Finset G} (hS : closure (S : Set G) = ⊀) : βˆƒ T : Finset H, T.card ≀ H.index * S.card ∧ closure (T : Set H) = ⊀ := by
letI := H.fintypeQuotientOfFiniteIndex haveI : DecidableEq G := Classical.decEq G obtain ⟨Rβ‚€, hR, hR1⟩ := H.exists_right_transversal 1 haveI : Fintype Rβ‚€ := Fintype.ofEquiv _ (toEquiv hR) let R : Finset G := Set.toFinset Rβ‚€ replace hR : (R : Set G) ∈ rightTransversals (H : Set G) := by rwa [Set.coe_toFinse...
1,554