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.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum
Mathlib/Algebra/Tropical/BigOperators.lean
85
89
theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by
induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH]
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf
Mathlib/Algebra/Tropical/BigOperators.lean
92
96
theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by
convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf
Mathlib/Algebra/Tropical/BigOperators.lean
99
103
theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by
rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf]
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image
Mathlib/Algebra/Tropical/BigOperators.lean
106
108
theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by
rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image]
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image] #align trop_infi trop_iInf
Mathlib/Algebra/Tropical/BigOperators.lean
111
116
theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) : untrop s.sum = Multiset.inf (s.map untrop) := by
induction' s using Multiset.induction with s x IH Β· simp Β· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH] rfl
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image] #align trop_infi trop_iInf theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) : untrop s.sum = Multiset.inf (s.map untrop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH] rfl #align multiset.untrop_sum Multiset.untrop_sum
Mathlib/Algebra/Tropical/BigOperators.lean
119
123
theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ Tropical R) : untrop (βˆ‘ i ∈ s, f i) = s.inf (untrop ∘ f) := by
convert Multiset.untrop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image] #align trop_infi trop_iInf theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) : untrop s.sum = Multiset.inf (s.map untrop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH] rfl #align multiset.untrop_sum Multiset.untrop_sum theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ Tropical R) : untrop (βˆ‘ i ∈ s, f i) = s.inf (untrop ∘ f) := by convert Multiset.untrop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.untrop_sum' Finset.untrop_sum'
Mathlib/Algebra/Tropical/BigOperators.lean
126
130
theorem untrop_sum_eq_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i ∈ s, f i) = sInf (untrop ∘ f '' s) := by
rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, untrop_zero] Β· rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, Finset.untrop_sum']
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image] #align trop_infi trop_iInf theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) : untrop s.sum = Multiset.inf (s.map untrop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH] rfl #align multiset.untrop_sum Multiset.untrop_sum theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ Tropical R) : untrop (βˆ‘ i ∈ s, f i) = s.inf (untrop ∘ f) := by convert Multiset.untrop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.untrop_sum' Finset.untrop_sum' theorem untrop_sum_eq_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i ∈ s, f i) = sInf (untrop ∘ f '' s) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, untrop_zero] Β· rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, Finset.untrop_sum'] #align untrop_sum_eq_Inf_image untrop_sum_eq_sInf_image
Mathlib/Algebra/Tropical/BigOperators.lean
133
136
theorem untrop_sum [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i : S, f i) = β¨… i : S, untrop (f i) := by
rw [iInf,← Set.image_univ,← coe_univ, untrop_sum_eq_sInf_image] rfl
1,221
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S β†’ R) : trop (βˆ‘ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH Β· simp Β· simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S β†’ Tropical R) : untrop (∏ i ∈ s, f i) = βˆ‘ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH Β· simp Β· simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp [← IH] #align multiset.trop_inf Multiset.trop_inf theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ R) : trop (s.inf f) = βˆ‘ i ∈ s, trop (f i) := by convert Multiset.trop_inf (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.trop_inf Finset.trop_inf theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ WithTop R) : trop (sInf (f '' s)) = βˆ‘ i ∈ s, trop (f i) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top] rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf] #align trop_Inf_image trop_sInf_image theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ WithTop R) : trop (β¨… i : S, f i) = βˆ‘ i : S, trop (f i) := by rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image] #align trop_infi trop_iInf theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) : untrop s.sum = Multiset.inf (s.map untrop) := by induction' s using Multiset.induction with s x IH Β· simp Β· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH] rfl #align multiset.untrop_sum Multiset.untrop_sum theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S β†’ Tropical R) : untrop (βˆ‘ i ∈ s, f i) = s.inf (untrop ∘ f) := by convert Multiset.untrop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align finset.untrop_sum' Finset.untrop_sum' theorem untrop_sum_eq_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i ∈ s, f i) = sInf (untrop ∘ f '' s) := by rcases s.eq_empty_or_nonempty with (rfl | h) Β· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, untrop_zero] Β· rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, Finset.untrop_sum'] #align untrop_sum_eq_Inf_image untrop_sum_eq_sInf_image theorem untrop_sum [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i : S, f i) = β¨… i : S, untrop (f i) := by rw [iInf,← Set.image_univ,← coe_univ, untrop_sum_eq_sInf_image] rfl #align untrop_sum untrop_sum
Mathlib/Algebra/Tropical/BigOperators.lean
141
143
theorem Finset.untrop_sum [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S β†’ Tropical (WithTop R)) : untrop (βˆ‘ i ∈ s, f i) = β¨… i : s, untrop (f i) := by
simpa [← _root_.untrop_sum] using (sum_attach _ _).symm
1,221
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp]
Mathlib/Data/Int/GCD.lean
48
48
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by
simp [xgcdAux]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left
Mathlib/Data/Int/GCD.lean
51
54
theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp]
Mathlib/Data/Int/GCD.lean
74
76
theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by
unfold gcdA rw [xgcd, xgcd_zero_left]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp]
Mathlib/Data/Int/GCD.lean
80
82
theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by
unfold gcdB rw [xgcd, xgcd_zero_left]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp]
Mathlib/Data/Int/GCD.lean
86
90
theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by
unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp]
Mathlib/Data/Int/GCD.lean
94
98
theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by
unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : βˆ€ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst
Mathlib/Data/Int/GCD.lean
108
109
theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by
rw [xgcd, ← xgcdAux_fst x y 1 0 0 1]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : βˆ€ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by rw [xgcd, ← xgcdAux_fst x y 1 0 0 1] #align nat.xgcd_aux_val Nat.xgcdAux_val
Mathlib/Data/Int/GCD.lean
112
113
theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by
unfold gcdA gcdB; cases xgcd x y; rfl
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : βˆ€ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by rw [xgcd, ← xgcdAux_fst x y 1 0 0 1] #align nat.xgcd_aux_val Nat.xgcdAux_val theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by unfold gcdA gcdB; cases xgcd x y; rfl #align nat.xgcd_val Nat.xgcd_val section variable (x y : β„•) private def P : β„• Γ— β„€ Γ— β„€ β†’ Prop | (r, s, t) => (r : β„€) = x * s + y * t
Mathlib/Data/Int/GCD.lean
123
132
theorem xgcdAux_P {r r'} : βˆ€ {s t s' t'}, P x y (r, s, t) β†’ P x y (r', s', t') β†’ P x y (xgcdAux r s t r' s' t') := by
induction r, r' using gcd.induction with | H0 => simp | H1 a b h IH => intro s t s' t' p p' rw [xgcdAux_rec h]; refine IH ?_ p; dsimp [P] at * rw [Int.emod_def]; generalize (b / a : β„€) = k rw [p, p', Int.mul_sub, sub_add_eq_add_sub, Int.mul_sub, Int.add_mul, mul_comm k t, mul_comm k s, ← mul_assoc, ← mul_assoc, add_comm (x * s * k), ← add_sub_assoc, sub_sub]
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : βˆ€ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by rw [xgcd, ← xgcdAux_fst x y 1 0 0 1] #align nat.xgcd_aux_val Nat.xgcdAux_val theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by unfold gcdA gcdB; cases xgcd x y; rfl #align nat.xgcd_val Nat.xgcd_val section variable (x y : β„•) private def P : β„• Γ— β„€ Γ— β„€ β†’ Prop | (r, s, t) => (r : β„€) = x * s + y * t theorem xgcdAux_P {r r'} : βˆ€ {s t s' t'}, P x y (r, s, t) β†’ P x y (r', s', t') β†’ P x y (xgcdAux r s t r' s' t') := by induction r, r' using gcd.induction with | H0 => simp | H1 a b h IH => intro s t s' t' p p' rw [xgcdAux_rec h]; refine IH ?_ p; dsimp [P] at * rw [Int.emod_def]; generalize (b / a : β„€) = k rw [p, p', Int.mul_sub, sub_add_eq_add_sub, Int.mul_sub, Int.add_mul, mul_comm k t, mul_comm k s, ← mul_assoc, ← mul_assoc, add_comm (x * s * k), ← add_sub_assoc, sub_sub] set_option linter.uppercaseLean3 false in #align nat.xgcd_aux_P Nat.xgcdAux_P
Mathlib/Data/Int/GCD.lean
139
141
theorem gcd_eq_gcd_ab : (gcd x y : β„€) = x * gcdA x y + y * gcdB x y := by
have := @xgcdAux_P x y x y 1 0 0 1 (by simp [P]) (by simp [P]) rwa [xgcdAux_val, xgcd_val] at this
1,222
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : β„• β†’ β„€ β†’ β„€ β†’ β„• β†’ β„€ β†’ β„€ β†’ β„• Γ— β„€ Γ— β„€ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp] theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux] #align nat.xgcd_zero_left Nat.xgcd_zero_left theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) : xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne' simp [xgcdAux] #align nat.xgcd_aux_rec Nat.xgcdAux_rec def xgcd (x y : β„•) : β„€ Γ— β„€ := (xgcdAux x 1 0 y 0 1).2 #align nat.xgcd Nat.xgcd def gcdA (x y : β„•) : β„€ := (xgcd x y).1 #align nat.gcd_a Nat.gcdA def gcdB (x y : β„•) : β„€ := (xgcd x y).2 #align nat.gcd_b Nat.gcdB @[simp] theorem gcdA_zero_left {s : β„•} : gcdA 0 s = 0 := by unfold gcdA rw [xgcd, xgcd_zero_left] #align nat.gcd_a_zero_left Nat.gcdA_zero_left @[simp] theorem gcdB_zero_left {s : β„•} : gcdB 0 s = 1 := by unfold gcdB rw [xgcd, xgcd_zero_left] #align nat.gcd_b_zero_left Nat.gcdB_zero_left @[simp] theorem gcdA_zero_right {s : β„•} (h : s β‰  0) : gcdA s 0 = 1 := by unfold gcdA xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_a_zero_right Nat.gcdA_zero_right @[simp] theorem gcdB_zero_right {s : β„•} (h : s β‰  0) : gcdB s 0 = 0 := by unfold gcdB xgcd obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h rw [xgcdAux] simp #align nat.gcd_b_zero_right Nat.gcdB_zero_right @[simp] theorem xgcdAux_fst (x y) : βˆ€ s t s' t', (xgcdAux x s t y s' t').1 = gcd x y := gcd.induction x y (by simp) fun x y h IH s t s' t' => by simp only [h, xgcdAux_rec, IH] rw [← gcd_rec] #align nat.xgcd_aux_fst Nat.xgcdAux_fst theorem xgcdAux_val (x y) : xgcdAux x 1 0 y 0 1 = (gcd x y, xgcd x y) := by rw [xgcd, ← xgcdAux_fst x y 1 0 0 1] #align nat.xgcd_aux_val Nat.xgcdAux_val theorem xgcd_val (x y) : xgcd x y = (gcdA x y, gcdB x y) := by unfold gcdA gcdB; cases xgcd x y; rfl #align nat.xgcd_val Nat.xgcd_val section variable (x y : β„•) private def P : β„• Γ— β„€ Γ— β„€ β†’ Prop | (r, s, t) => (r : β„€) = x * s + y * t theorem xgcdAux_P {r r'} : βˆ€ {s t s' t'}, P x y (r, s, t) β†’ P x y (r', s', t') β†’ P x y (xgcdAux r s t r' s' t') := by induction r, r' using gcd.induction with | H0 => simp | H1 a b h IH => intro s t s' t' p p' rw [xgcdAux_rec h]; refine IH ?_ p; dsimp [P] at * rw [Int.emod_def]; generalize (b / a : β„€) = k rw [p, p', Int.mul_sub, sub_add_eq_add_sub, Int.mul_sub, Int.add_mul, mul_comm k t, mul_comm k s, ← mul_assoc, ← mul_assoc, add_comm (x * s * k), ← add_sub_assoc, sub_sub] set_option linter.uppercaseLean3 false in #align nat.xgcd_aux_P Nat.xgcdAux_P theorem gcd_eq_gcd_ab : (gcd x y : β„€) = x * gcdA x y + y * gcdB x y := by have := @xgcdAux_P x y x y 1 0 0 1 (by simp [P]) (by simp [P]) rwa [xgcdAux_val, xgcd_val] at this #align nat.gcd_eq_gcd_ab Nat.gcd_eq_gcd_ab end
Mathlib/Data/Int/GCD.lean
146
154
theorem exists_mul_emod_eq_gcd {k n : β„•} (hk : gcd n k < k) : βˆƒ m, n * m % k = gcd n k := by
have hk' := Int.ofNat_ne_zero.2 (ne_of_gt (lt_of_le_of_lt (zero_le (gcd n k)) hk)) have key := congr_arg (fun (m : β„€) => (m % k).toNat) (gcd_eq_gcd_ab n k) simp only at key rw [Int.add_mul_emod_self_left, ← Int.natCast_mod, Int.toNat_natCast, mod_eq_of_lt hk] at key refine ⟨(n.gcdA k % k).toNat, Eq.trans (Int.ofNat.inj ?_) key.symm⟩ rw [Int.ofNat_eq_coe, Int.natCast_mod, Int.ofNat_mul, Int.toNat_of_nonneg (Int.emod_nonneg _ hk'), Int.ofNat_eq_coe, Int.toNat_of_nonneg (Int.emod_nonneg _ hk'), Int.mul_emod, Int.emod_emod, ← Int.mul_emod]
1,222
import Mathlib.Algebra.Ring.Regular import Mathlib.Data.Int.GCD import Mathlib.Data.Int.Order.Lemmas import Mathlib.Tactic.NormNum.Basic #align_import data.nat.modeq from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" assert_not_exists Function.support namespace Nat def ModEq (n a b : β„•) := a % n = b % n #align nat.modeq Nat.ModEq @[inherit_doc] notation:50 a " ≑ " b " [MOD " n "]" => ModEq n a b variable {m n a b c d : β„•} -- Porting note: This instance should be derivable automatically instance : Decidable (ModEq n a b) := decEq (a % n) (b % n)
Mathlib/Data/Nat/ModEq.lean
78
78
theorem modEq_zero_iff_dvd : a ≑ 0 [MOD n] ↔ n ∣ a := by
rw [ModEq, zero_mod, dvd_iff_mod_eq_zero]
1,223
import Mathlib.Algebra.Ring.Regular import Mathlib.Data.Int.GCD import Mathlib.Data.Int.Order.Lemmas import Mathlib.Tactic.NormNum.Basic #align_import data.nat.modeq from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" assert_not_exists Function.support namespace Nat def ModEq (n a b : β„•) := a % n = b % n #align nat.modeq Nat.ModEq @[inherit_doc] notation:50 a " ≑ " b " [MOD " n "]" => ModEq n a b variable {m n a b c d : β„•} -- Porting note: This instance should be derivable automatically instance : Decidable (ModEq n a b) := decEq (a % n) (b % n) theorem modEq_zero_iff_dvd : a ≑ 0 [MOD n] ↔ n ∣ a := by rw [ModEq, zero_mod, dvd_iff_mod_eq_zero] #align nat.modeq_zero_iff_dvd Nat.modEq_zero_iff_dvd theorem _root_.Dvd.dvd.modEq_zero_nat (h : n ∣ a) : a ≑ 0 [MOD n] := modEq_zero_iff_dvd.2 h #align has_dvd.dvd.modeq_zero_nat Dvd.dvd.modEq_zero_nat theorem _root_.Dvd.dvd.zero_modEq_nat (h : n ∣ a) : 0 ≑ a [MOD n] := h.modEq_zero_nat.symm #align has_dvd.dvd.zero_modeq_nat Dvd.dvd.zero_modEq_nat
Mathlib/Data/Nat/ModEq.lean
89
91
theorem modEq_iff_dvd : a ≑ b [MOD n] ↔ (n : β„€) ∣ b - a := by
rw [ModEq, eq_comm, ← Int.natCast_inj, Int.natCast_mod, Int.natCast_mod, Int.emod_eq_emod_iff_emod_sub_eq_zero, Int.dvd_iff_emod_eq_zero]
1,223
import Mathlib.Algebra.Ring.Regular import Mathlib.Data.Int.GCD import Mathlib.Data.Int.Order.Lemmas import Mathlib.Tactic.NormNum.Basic #align_import data.nat.modeq from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" assert_not_exists Function.support namespace Nat def ModEq (n a b : β„•) := a % n = b % n #align nat.modeq Nat.ModEq @[inherit_doc] notation:50 a " ≑ " b " [MOD " n "]" => ModEq n a b variable {m n a b c d : β„•} -- Porting note: This instance should be derivable automatically instance : Decidable (ModEq n a b) := decEq (a % n) (b % n) theorem modEq_zero_iff_dvd : a ≑ 0 [MOD n] ↔ n ∣ a := by rw [ModEq, zero_mod, dvd_iff_mod_eq_zero] #align nat.modeq_zero_iff_dvd Nat.modEq_zero_iff_dvd theorem _root_.Dvd.dvd.modEq_zero_nat (h : n ∣ a) : a ≑ 0 [MOD n] := modEq_zero_iff_dvd.2 h #align has_dvd.dvd.modeq_zero_nat Dvd.dvd.modEq_zero_nat theorem _root_.Dvd.dvd.zero_modEq_nat (h : n ∣ a) : 0 ≑ a [MOD n] := h.modEq_zero_nat.symm #align has_dvd.dvd.zero_modeq_nat Dvd.dvd.zero_modEq_nat theorem modEq_iff_dvd : a ≑ b [MOD n] ↔ (n : β„€) ∣ b - a := by rw [ModEq, eq_comm, ← Int.natCast_inj, Int.natCast_mod, Int.natCast_mod, Int.emod_eq_emod_iff_emod_sub_eq_zero, Int.dvd_iff_emod_eq_zero] #align nat.modeq_iff_dvd Nat.modEq_iff_dvd alias ⟨ModEq.dvd, modEq_of_dvd⟩ := modEq_iff_dvd #align nat.modeq.dvd Nat.ModEq.dvd #align nat.modeq_of_dvd Nat.modEq_of_dvd
Mathlib/Data/Nat/ModEq.lean
99
100
theorem modEq_iff_dvd' (h : a ≀ b) : a ≑ b [MOD n] ↔ n ∣ b - a := by
rw [modEq_iff_dvd, ← Int.natCast_dvd_natCast, Int.ofNat_sub h]
1,223
import Mathlib.Algebra.Group.Fin import Mathlib.Algebra.NeZero import Mathlib.Data.Nat.ModEq import Mathlib.Data.Fintype.Card #align_import data.zmod.defs from "leanprover-community/mathlib"@"3a2b5524a138b5d0b818b858b516d4ac8a484b03" def ZMod : β„• β†’ Type | 0 => β„€ | n + 1 => Fin (n + 1) #align zmod ZMod instance ZMod.decidableEq : βˆ€ n : β„•, DecidableEq (ZMod n) | 0 => inferInstanceAs (DecidableEq β„€) | n + 1 => inferInstanceAs (DecidableEq (Fin (n + 1))) #align zmod.decidable_eq ZMod.decidableEq instance ZMod.repr : βˆ€ n : β„•, Repr (ZMod n) | 0 => by dsimp [ZMod]; infer_instance | n + 1 => by dsimp [ZMod]; infer_instance #align zmod.has_repr ZMod.repr namespace ZMod instance instUnique : Unique (ZMod 1) := Fin.uniqueFinOne instance fintype : βˆ€ (n : β„•) [NeZero n], Fintype (ZMod n) | 0, h => (h.ne rfl).elim | n + 1, _ => Fin.fintype (n + 1) #align zmod.fintype ZMod.fintype instance infinite : Infinite (ZMod 0) := Int.infinite #align zmod.infinite ZMod.infinite @[simp]
Mathlib/Data/ZMod/Defs.lean
124
127
theorem card (n : β„•) [Fintype (ZMod n)] : Fintype.card (ZMod n) = n := by
cases n with | zero => exact (not_finite (ZMod 0)).elim | succ n => convert Fintype.card_fin (n + 1) using 2
1,224
import Mathlib.Data.ULift import Mathlib.Data.ZMod.Defs import Mathlib.SetTheory.Cardinal.PartENat #align_import set_theory.cardinal.finite from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" set_option autoImplicit true open Cardinal Function noncomputable section variable {Ξ± Ξ² : Type*} namespace Nat protected def card (Ξ± : Type*) : β„• := toNat (mk Ξ±) #align nat.card Nat.card @[simp] theorem card_eq_fintype_card [Fintype Ξ±] : Nat.card Ξ± = Fintype.card Ξ± := mk_toNat_eq_card #align nat.card_eq_fintype_card Nat.card_eq_fintype_card theorem _root_.Fintype.card_eq_nat_card {_ : Fintype Ξ±} : Fintype.card Ξ± = Nat.card Ξ± := mk_toNat_eq_card.symm lemma card_eq_finsetCard (s : Finset Ξ±) : Nat.card s = s.card := by simp only [Nat.card_eq_fintype_card, Fintype.card_coe] lemma card_eq_card_toFinset (s : Set Ξ±) [Fintype s] : Nat.card s = s.toFinset.card := by simp only [← Nat.card_eq_finsetCard, s.mem_toFinset] lemma card_eq_card_finite_toFinset {s : Set Ξ±} (hs : s.Finite) : Nat.card s = hs.toFinset.card := by simp only [← Nat.card_eq_finsetCard, hs.mem_toFinset] @[simp] theorem card_of_isEmpty [IsEmpty Ξ±] : Nat.card Ξ± = 0 := by simp [Nat.card] #align nat.card_of_is_empty Nat.card_of_isEmpty @[simp] lemma card_eq_zero_of_infinite [Infinite Ξ±] : Nat.card Ξ± = 0 := mk_toNat_of_infinite #align nat.card_eq_zero_of_infinite Nat.card_eq_zero_of_infinite lemma _root_.Set.Infinite.card_eq_zero {s : Set Ξ±} (hs : s.Infinite) : Nat.card s = 0 := @card_eq_zero_of_infinite _ hs.to_subtype lemma card_eq_zero : Nat.card Ξ± = 0 ↔ IsEmpty Ξ± ∨ Infinite Ξ± := by simp [Nat.card, mk_eq_zero_iff, aleph0_le_mk_iff] lemma card_ne_zero : Nat.card Ξ± β‰  0 ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [card_eq_zero, not_or] lemma card_pos_iff : 0 < Nat.card Ξ± ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [Nat.card, mk_eq_zero_iff, mk_lt_aleph0_iff] @[simp] lemma card_pos [Nonempty Ξ±] [Finite Ξ±] : 0 < Nat.card Ξ± := card_pos_iff.2 βŸ¨β€Ή_β€Ί, β€Ή_β€ΊβŸ© theorem finite_of_card_ne_zero (h : Nat.card Ξ± β‰  0) : Finite Ξ± := (card_ne_zero.1 h).2 #align nat.finite_of_card_ne_zero Nat.finite_of_card_ne_zero theorem card_congr (f : Ξ± ≃ Ξ²) : Nat.card Ξ± = Nat.card Ξ² := Cardinal.toNat_congr f #align nat.card_congr Nat.card_congr lemma card_le_card_of_injective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by simpa using toNat_le_toNat (lift_mk_le_lift_mk_of_injective hf) (by simp [lt_aleph0_of_finite]) lemma card_le_card_of_surjective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by have : lift.{u} #Ξ² ≀ lift.{v} #Ξ± := mk_le_of_surjective (ULift.map_surjective.2 hf) simpa using toNat_le_toNat this (by simp [lt_aleph0_of_finite]) theorem card_eq_of_bijective (f : Ξ± β†’ Ξ²) (hf : Function.Bijective f) : Nat.card Ξ± = Nat.card Ξ² := card_congr (Equiv.ofBijective f hf) #align nat.card_eq_of_bijective Nat.card_eq_of_bijective
Mathlib/SetTheory/Cardinal/Finite.lean
97
98
theorem card_eq_of_equiv_fin {Ξ± : Type*} {n : β„•} (f : Ξ± ≃ Fin n) : Nat.card Ξ± = n := by
simpa only [card_eq_fintype_card, Fintype.card_fin] using card_congr f
1,225
import Mathlib.Data.ULift import Mathlib.Data.ZMod.Defs import Mathlib.SetTheory.Cardinal.PartENat #align_import set_theory.cardinal.finite from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" set_option autoImplicit true open Cardinal Function noncomputable section variable {Ξ± Ξ² : Type*} namespace Nat protected def card (Ξ± : Type*) : β„• := toNat (mk Ξ±) #align nat.card Nat.card @[simp] theorem card_eq_fintype_card [Fintype Ξ±] : Nat.card Ξ± = Fintype.card Ξ± := mk_toNat_eq_card #align nat.card_eq_fintype_card Nat.card_eq_fintype_card theorem _root_.Fintype.card_eq_nat_card {_ : Fintype Ξ±} : Fintype.card Ξ± = Nat.card Ξ± := mk_toNat_eq_card.symm lemma card_eq_finsetCard (s : Finset Ξ±) : Nat.card s = s.card := by simp only [Nat.card_eq_fintype_card, Fintype.card_coe] lemma card_eq_card_toFinset (s : Set Ξ±) [Fintype s] : Nat.card s = s.toFinset.card := by simp only [← Nat.card_eq_finsetCard, s.mem_toFinset] lemma card_eq_card_finite_toFinset {s : Set Ξ±} (hs : s.Finite) : Nat.card s = hs.toFinset.card := by simp only [← Nat.card_eq_finsetCard, hs.mem_toFinset] @[simp] theorem card_of_isEmpty [IsEmpty Ξ±] : Nat.card Ξ± = 0 := by simp [Nat.card] #align nat.card_of_is_empty Nat.card_of_isEmpty @[simp] lemma card_eq_zero_of_infinite [Infinite Ξ±] : Nat.card Ξ± = 0 := mk_toNat_of_infinite #align nat.card_eq_zero_of_infinite Nat.card_eq_zero_of_infinite lemma _root_.Set.Infinite.card_eq_zero {s : Set Ξ±} (hs : s.Infinite) : Nat.card s = 0 := @card_eq_zero_of_infinite _ hs.to_subtype lemma card_eq_zero : Nat.card Ξ± = 0 ↔ IsEmpty Ξ± ∨ Infinite Ξ± := by simp [Nat.card, mk_eq_zero_iff, aleph0_le_mk_iff] lemma card_ne_zero : Nat.card Ξ± β‰  0 ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [card_eq_zero, not_or] lemma card_pos_iff : 0 < Nat.card Ξ± ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [Nat.card, mk_eq_zero_iff, mk_lt_aleph0_iff] @[simp] lemma card_pos [Nonempty Ξ±] [Finite Ξ±] : 0 < Nat.card Ξ± := card_pos_iff.2 βŸ¨β€Ή_β€Ί, β€Ή_β€ΊβŸ© theorem finite_of_card_ne_zero (h : Nat.card Ξ± β‰  0) : Finite Ξ± := (card_ne_zero.1 h).2 #align nat.finite_of_card_ne_zero Nat.finite_of_card_ne_zero theorem card_congr (f : Ξ± ≃ Ξ²) : Nat.card Ξ± = Nat.card Ξ² := Cardinal.toNat_congr f #align nat.card_congr Nat.card_congr lemma card_le_card_of_injective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by simpa using toNat_le_toNat (lift_mk_le_lift_mk_of_injective hf) (by simp [lt_aleph0_of_finite]) lemma card_le_card_of_surjective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by have : lift.{u} #Ξ² ≀ lift.{v} #Ξ± := mk_le_of_surjective (ULift.map_surjective.2 hf) simpa using toNat_le_toNat this (by simp [lt_aleph0_of_finite]) theorem card_eq_of_bijective (f : Ξ± β†’ Ξ²) (hf : Function.Bijective f) : Nat.card Ξ± = Nat.card Ξ² := card_congr (Equiv.ofBijective f hf) #align nat.card_eq_of_bijective Nat.card_eq_of_bijective theorem card_eq_of_equiv_fin {Ξ± : Type*} {n : β„•} (f : Ξ± ≃ Fin n) : Nat.card Ξ± = n := by simpa only [card_eq_fintype_card, Fintype.card_fin] using card_congr f #align nat.card_eq_of_equiv_fin Nat.card_eq_of_equiv_fin def equivFinOfCardPos {Ξ± : Type*} (h : Nat.card Ξ± β‰  0) : Ξ± ≃ Fin (Nat.card Ξ±) := by cases fintypeOrInfinite Ξ± Β· simpa only [card_eq_fintype_card] using Fintype.equivFin Ξ± Β· simp only [card_eq_zero_of_infinite, ne_eq, not_true_eq_false] at h #align nat.equiv_fin_of_card_pos Nat.equivFinOfCardPos
Mathlib/SetTheory/Cardinal/Finite.lean
144
146
theorem card_of_subsingleton (a : Ξ±) [Subsingleton Ξ±] : Nat.card Ξ± = 1 := by
letI := Fintype.ofSubsingleton a rw [card_eq_fintype_card, Fintype.card_ofSubsingleton a]
1,225
import Mathlib.Data.ULift import Mathlib.Data.ZMod.Defs import Mathlib.SetTheory.Cardinal.PartENat #align_import set_theory.cardinal.finite from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" set_option autoImplicit true open Cardinal Function noncomputable section variable {Ξ± Ξ² : Type*} namespace Nat protected def card (Ξ± : Type*) : β„• := toNat (mk Ξ±) #align nat.card Nat.card @[simp] theorem card_eq_fintype_card [Fintype Ξ±] : Nat.card Ξ± = Fintype.card Ξ± := mk_toNat_eq_card #align nat.card_eq_fintype_card Nat.card_eq_fintype_card theorem _root_.Fintype.card_eq_nat_card {_ : Fintype Ξ±} : Fintype.card Ξ± = Nat.card Ξ± := mk_toNat_eq_card.symm lemma card_eq_finsetCard (s : Finset Ξ±) : Nat.card s = s.card := by simp only [Nat.card_eq_fintype_card, Fintype.card_coe] lemma card_eq_card_toFinset (s : Set Ξ±) [Fintype s] : Nat.card s = s.toFinset.card := by simp only [← Nat.card_eq_finsetCard, s.mem_toFinset] lemma card_eq_card_finite_toFinset {s : Set Ξ±} (hs : s.Finite) : Nat.card s = hs.toFinset.card := by simp only [← Nat.card_eq_finsetCard, hs.mem_toFinset] @[simp] theorem card_of_isEmpty [IsEmpty Ξ±] : Nat.card Ξ± = 0 := by simp [Nat.card] #align nat.card_of_is_empty Nat.card_of_isEmpty @[simp] lemma card_eq_zero_of_infinite [Infinite Ξ±] : Nat.card Ξ± = 0 := mk_toNat_of_infinite #align nat.card_eq_zero_of_infinite Nat.card_eq_zero_of_infinite lemma _root_.Set.Infinite.card_eq_zero {s : Set Ξ±} (hs : s.Infinite) : Nat.card s = 0 := @card_eq_zero_of_infinite _ hs.to_subtype lemma card_eq_zero : Nat.card Ξ± = 0 ↔ IsEmpty Ξ± ∨ Infinite Ξ± := by simp [Nat.card, mk_eq_zero_iff, aleph0_le_mk_iff] lemma card_ne_zero : Nat.card Ξ± β‰  0 ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [card_eq_zero, not_or] lemma card_pos_iff : 0 < Nat.card Ξ± ↔ Nonempty Ξ± ∧ Finite Ξ± := by simp [Nat.card, mk_eq_zero_iff, mk_lt_aleph0_iff] @[simp] lemma card_pos [Nonempty Ξ±] [Finite Ξ±] : 0 < Nat.card Ξ± := card_pos_iff.2 βŸ¨β€Ή_β€Ί, β€Ή_β€ΊβŸ© theorem finite_of_card_ne_zero (h : Nat.card Ξ± β‰  0) : Finite Ξ± := (card_ne_zero.1 h).2 #align nat.finite_of_card_ne_zero Nat.finite_of_card_ne_zero theorem card_congr (f : Ξ± ≃ Ξ²) : Nat.card Ξ± = Nat.card Ξ² := Cardinal.toNat_congr f #align nat.card_congr Nat.card_congr lemma card_le_card_of_injective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by simpa using toNat_le_toNat (lift_mk_le_lift_mk_of_injective hf) (by simp [lt_aleph0_of_finite]) lemma card_le_card_of_surjective {Ξ± : Type u} {Ξ² : Type v} [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by have : lift.{u} #Ξ² ≀ lift.{v} #Ξ± := mk_le_of_surjective (ULift.map_surjective.2 hf) simpa using toNat_le_toNat this (by simp [lt_aleph0_of_finite]) theorem card_eq_of_bijective (f : Ξ± β†’ Ξ²) (hf : Function.Bijective f) : Nat.card Ξ± = Nat.card Ξ² := card_congr (Equiv.ofBijective f hf) #align nat.card_eq_of_bijective Nat.card_eq_of_bijective theorem card_eq_of_equiv_fin {Ξ± : Type*} {n : β„•} (f : Ξ± ≃ Fin n) : Nat.card Ξ± = n := by simpa only [card_eq_fintype_card, Fintype.card_fin] using card_congr f #align nat.card_eq_of_equiv_fin Nat.card_eq_of_equiv_fin def equivFinOfCardPos {Ξ± : Type*} (h : Nat.card Ξ± β‰  0) : Ξ± ≃ Fin (Nat.card Ξ±) := by cases fintypeOrInfinite Ξ± Β· simpa only [card_eq_fintype_card] using Fintype.equivFin Ξ± Β· simp only [card_eq_zero_of_infinite, ne_eq, not_true_eq_false] at h #align nat.equiv_fin_of_card_pos Nat.equivFinOfCardPos theorem card_of_subsingleton (a : Ξ±) [Subsingleton Ξ±] : Nat.card Ξ± = 1 := by letI := Fintype.ofSubsingleton a rw [card_eq_fintype_card, Fintype.card_ofSubsingleton a] #align nat.card_of_subsingleton Nat.card_of_subsingleton -- @[simp] -- Porting note (#10618): simp can prove this theorem card_unique [Unique Ξ±] : Nat.card Ξ± = 1 := card_of_subsingleton default #align nat.card_unique Nat.card_unique theorem card_eq_one_iff_unique : Nat.card Ξ± = 1 ↔ Subsingleton Ξ± ∧ Nonempty Ξ± := Cardinal.toNat_eq_one_iff_unique #align nat.card_eq_one_iff_unique Nat.card_eq_one_iff_unique theorem card_eq_two_iff : Nat.card Ξ± = 2 ↔ βˆƒ x y : Ξ±, x β‰  y ∧ {x, y} = @Set.univ Ξ± := toNat_eq_ofNat.trans mk_eq_two_iff #align nat.card_eq_two_iff Nat.card_eq_two_iff theorem card_eq_two_iff' (x : Ξ±) : Nat.card Ξ± = 2 ↔ βˆƒ! y, y β‰  x := toNat_eq_ofNat.trans (mk_eq_two_iff' x) #align nat.card_eq_two_iff' Nat.card_eq_two_iff' @[simp]
Mathlib/SetTheory/Cardinal/Finite.lean
167
170
theorem card_sum [Finite Ξ±] [Finite Ξ²] : Nat.card (Ξ± βŠ• Ξ²) = Nat.card Ξ± + Nat.card Ξ² := by
have := Fintype.ofFinite Ξ± have := Fintype.ofFinite Ξ² simp_rw [Nat.card_eq_fintype_card, Fintype.card_sum]
1,225
import Mathlib.Data.Finset.Pointwise import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.additive.ruzsa_covering from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" open Pointwise namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] [CommGroup Ξ±] (s : Finset Ξ±) {t : Finset Ξ±} @[to_additive "**Ruzsa's covering lemma**"]
Mathlib/Combinatorics/Additive/RuzsaCovering.lean
31
53
theorem exists_subset_mul_div (ht : t.Nonempty) : βˆƒ u : Finset Ξ±, u.card * t.card ≀ (s * t).card ∧ s βŠ† u * t / t := by
haveI : βˆ€ u, Decidable ((u : Set Ξ±).PairwiseDisjoint (Β· β€’ t)) := fun u ↦ Classical.dec _ set C := s.powerset.filter fun u ↦ u.toSet.PairwiseDisjoint (Β· β€’ t) obtain ⟨u, hu, hCmax⟩ := C.exists_maximal (filter_nonempty_iff.2 βŸ¨βˆ…, empty_mem_powerset _, by rw [coe_empty]; exact Set.pairwiseDisjoint_empty⟩) rw [mem_filter, mem_powerset] at hu refine ⟨u, (card_mul_iff.2 <| pairwiseDisjoint_smul_iff.1 hu.2).ge.trans (card_le_card <| mul_subset_mul_right hu.1), fun a ha ↦ ?_⟩ rw [mul_div_assoc] by_cases hau : a ∈ u Β· exact subset_mul_left _ ht.one_mem_div hau by_cases H : βˆ€ b ∈ u, Disjoint (a β€’ t) (b β€’ t) Β· refine (hCmax _ ?_ <| ssubset_insert hau).elim rw [mem_filter, mem_powerset, insert_subset_iff, coe_insert] exact ⟨⟨ha, hu.1⟩, hu.2.insert fun _ hb _ ↦ H _ hb⟩ push_neg at H simp_rw [not_disjoint_iff, ← inv_smul_mem_iff] at H obtain ⟨b, hb, c, hc₁, hcβ‚‚βŸ© := H refine mem_mul.2 ⟨b, hb, a / b, ?_, by simp⟩ exact mem_div.2 ⟨_, hcβ‚‚, _, hc₁, by simp [inv_mul_eq_div]⟩
1,226
import Mathlib.Data.Fintype.Prod import Mathlib.Data.Fintype.Sum import Mathlib.SetTheory.Cardinal.Finite #align_import data.fintype.units from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {Ξ± : Type*} instance UnitsInt.fintype : Fintype β„€Λ£ := ⟨{1, -1}, fun x ↦ by cases Int.units_eq_one_or x <;> simp [*]⟩ #align units_int.fintype UnitsInt.fintype @[simp] theorem UnitsInt.univ : (Finset.univ : Finset β„€Λ£) = {1, -1} := rfl #align units_int.univ UnitsInt.univ @[simp] theorem Fintype.card_units_int : Fintype.card β„€Λ£ = 2 := rfl #align fintype.card_units_int Fintype.card_units_int instance [Monoid Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype Ξ±Λ£ := Fintype.ofEquiv _ (unitsEquivProdSubtype Ξ±).symm instance [Monoid Ξ±] [Finite Ξ±] : Finite Ξ±Λ£ := Finite.of_injective _ Units.ext
Mathlib/Data/Fintype/Units.lean
36
40
theorem Fintype.card_eq_card_units_add_one [GroupWithZero Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype.card Ξ± = Fintype.card Ξ±Λ£ + 1 := by
rw [eq_comm, Fintype.card_congr unitsEquivNeZero] have := Fintype.card_congr (Equiv.sumCompl (Β· = (0 : Ξ±))) rwa [Fintype.card_sum, add_comm, Fintype.card_subtype_eq] at this
1,227
import Mathlib.Data.Fintype.Prod import Mathlib.Data.Fintype.Sum import Mathlib.SetTheory.Cardinal.Finite #align_import data.fintype.units from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {Ξ± : Type*} instance UnitsInt.fintype : Fintype β„€Λ£ := ⟨{1, -1}, fun x ↦ by cases Int.units_eq_one_or x <;> simp [*]⟩ #align units_int.fintype UnitsInt.fintype @[simp] theorem UnitsInt.univ : (Finset.univ : Finset β„€Λ£) = {1, -1} := rfl #align units_int.univ UnitsInt.univ @[simp] theorem Fintype.card_units_int : Fintype.card β„€Λ£ = 2 := rfl #align fintype.card_units_int Fintype.card_units_int instance [Monoid Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype Ξ±Λ£ := Fintype.ofEquiv _ (unitsEquivProdSubtype Ξ±).symm instance [Monoid Ξ±] [Finite Ξ±] : Finite Ξ±Λ£ := Finite.of_injective _ Units.ext theorem Fintype.card_eq_card_units_add_one [GroupWithZero Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype.card Ξ± = Fintype.card Ξ±Λ£ + 1 := by rw [eq_comm, Fintype.card_congr unitsEquivNeZero] have := Fintype.card_congr (Equiv.sumCompl (Β· = (0 : Ξ±))) rwa [Fintype.card_sum, add_comm, Fintype.card_subtype_eq] at this
Mathlib/Data/Fintype/Units.lean
42
46
theorem Nat.card_eq_card_units_add_one [GroupWithZero Ξ±] [Finite Ξ±] : Nat.card Ξ± = Nat.card Ξ±Λ£ + 1 := by
have : Fintype Ξ± := Fintype.ofFinite Ξ± classical rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Fintype.card_eq_card_units_add_one]
1,227
import Mathlib.Data.Fintype.Prod import Mathlib.Data.Fintype.Sum import Mathlib.SetTheory.Cardinal.Finite #align_import data.fintype.units from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {Ξ± : Type*} instance UnitsInt.fintype : Fintype β„€Λ£ := ⟨{1, -1}, fun x ↦ by cases Int.units_eq_one_or x <;> simp [*]⟩ #align units_int.fintype UnitsInt.fintype @[simp] theorem UnitsInt.univ : (Finset.univ : Finset β„€Λ£) = {1, -1} := rfl #align units_int.univ UnitsInt.univ @[simp] theorem Fintype.card_units_int : Fintype.card β„€Λ£ = 2 := rfl #align fintype.card_units_int Fintype.card_units_int instance [Monoid Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype Ξ±Λ£ := Fintype.ofEquiv _ (unitsEquivProdSubtype Ξ±).symm instance [Monoid Ξ±] [Finite Ξ±] : Finite Ξ±Λ£ := Finite.of_injective _ Units.ext theorem Fintype.card_eq_card_units_add_one [GroupWithZero Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype.card Ξ± = Fintype.card Ξ±Λ£ + 1 := by rw [eq_comm, Fintype.card_congr unitsEquivNeZero] have := Fintype.card_congr (Equiv.sumCompl (Β· = (0 : Ξ±))) rwa [Fintype.card_sum, add_comm, Fintype.card_subtype_eq] at this theorem Nat.card_eq_card_units_add_one [GroupWithZero Ξ±] [Finite Ξ±] : Nat.card Ξ± = Nat.card Ξ±Λ£ + 1 := by have : Fintype Ξ± := Fintype.ofFinite Ξ± classical rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Fintype.card_eq_card_units_add_one]
Mathlib/Data/Fintype/Units.lean
48
50
theorem Fintype.card_units [GroupWithZero Ξ±] [Fintype Ξ±] [DecidableEq Ξ±] : Fintype.card Ξ±Λ£ = Fintype.card Ξ± - 1 := by
rw [@Fintype.card_eq_card_units_add_one Ξ±, Nat.add_sub_cancel]
1,227
import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Combinatorics.Hall.Basic import Mathlib.Data.Fintype.BigOperators import Mathlib.SetTheory.Cardinal.Finite #align_import combinatorics.configuration from "leanprover-community/mathlib"@"d2d8742b0c21426362a9dacebc6005db895ca963" open Finset namespace Configuration variable (P L : Type*) [Membership P L] def Dual := P #align configuration.dual Configuration.Dual -- Porting note: was `this` instead of `h` instance [h : Inhabited P] : Inhabited (Dual P) := h instance [Finite P] : Finite (Dual P) := β€ΉFinite Pβ€Ί -- Porting note: was `this` instead of `h` instance [h : Fintype P] : Fintype (Dual P) := h -- Porting note (#11215): TODO: figure out if this is needed. set_option synthInstance.checkSynthOrder false in instance : Membership (Dual L) (Dual P) := ⟨Function.swap (Membership.mem : P β†’ L β†’ Prop)⟩ class Nondegenerate : Prop where exists_point : βˆ€ l : L, βˆƒ p, p βˆ‰ l exists_line : βˆ€ p, βˆƒ l : L, p βˆ‰ l eq_or_eq : βˆ€ {p₁ pβ‚‚ : P} {l₁ lβ‚‚ : L}, p₁ ∈ l₁ β†’ pβ‚‚ ∈ l₁ β†’ p₁ ∈ lβ‚‚ β†’ pβ‚‚ ∈ lβ‚‚ β†’ p₁ = pβ‚‚ ∨ l₁ = lβ‚‚ #align configuration.nondegenerate Configuration.Nondegenerate class HasPoints extends Nondegenerate P L where mkPoint : βˆ€ {l₁ lβ‚‚ : L}, l₁ β‰  lβ‚‚ β†’ P mkPoint_ax : βˆ€ {l₁ lβ‚‚ : L} (h : l₁ β‰  lβ‚‚), mkPoint h ∈ l₁ ∧ mkPoint h ∈ lβ‚‚ #align configuration.has_points Configuration.HasPoints class HasLines extends Nondegenerate P L where mkLine : βˆ€ {p₁ pβ‚‚ : P}, p₁ β‰  pβ‚‚ β†’ L mkLine_ax : βˆ€ {p₁ pβ‚‚ : P} (h : p₁ β‰  pβ‚‚), p₁ ∈ mkLine h ∧ pβ‚‚ ∈ mkLine h #align configuration.has_lines Configuration.HasLines open Nondegenerate open HasPoints (mkPoint mkPoint_ax) open HasLines (mkLine mkLine_ax) instance Dual.Nondegenerate [Nondegenerate P L] : Nondegenerate (Dual L) (Dual P) where exists_point := @exists_line P L _ _ exists_line := @exists_point P L _ _ eq_or_eq := @fun l₁ lβ‚‚ p₁ pβ‚‚ h₁ hβ‚‚ h₃ hβ‚„ => (@eq_or_eq P L _ _ p₁ pβ‚‚ l₁ lβ‚‚ h₁ h₃ hβ‚‚ hβ‚„).symm instance Dual.hasLines [HasPoints P L] : HasLines (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkLine := @mkPoint P L _ _ mkLine_ax := @mkPoint_ax P L _ _ } instance Dual.hasPoints [HasLines P L] : HasPoints (Dual L) (Dual P) := { Dual.Nondegenerate _ _ with mkPoint := @mkLine P L _ _ mkPoint_ax := @mkLine_ax P L _ _ } theorem HasPoints.existsUnique_point [HasPoints P L] (l₁ lβ‚‚ : L) (hl : l₁ β‰  lβ‚‚) : βˆƒ! p, p ∈ l₁ ∧ p ∈ lβ‚‚ := ⟨mkPoint hl, mkPoint_ax hl, fun _ hp => (eq_or_eq hp.1 (mkPoint_ax hl).1 hp.2 (mkPoint_ax hl).2).resolve_right hl⟩ #align configuration.has_points.exists_unique_point Configuration.HasPoints.existsUnique_point theorem HasLines.existsUnique_line [HasLines P L] (p₁ pβ‚‚ : P) (hp : p₁ β‰  pβ‚‚) : βˆƒ! l : L, p₁ ∈ l ∧ pβ‚‚ ∈ l := HasPoints.existsUnique_point (Dual L) (Dual P) p₁ pβ‚‚ hp #align configuration.has_lines.exists_unique_line Configuration.HasLines.existsUnique_line variable {P L}
Mathlib/Combinatorics/Configuration.lean
125
166
theorem Nondegenerate.exists_injective_of_card_le [Nondegenerate P L] [Fintype P] [Fintype L] (h : Fintype.card L ≀ Fintype.card P) : βˆƒ f : L β†’ P, Function.Injective f ∧ βˆ€ l, f l βˆ‰ l := by
classical let t : L β†’ Finset P := fun l => Set.toFinset { p | p βˆ‰ l } suffices βˆ€ s : Finset L, s.card ≀ (s.biUnion t).card by -- Hall's marriage theorem obtain ⟨f, hf1, hf2⟩ := (Finset.all_card_le_biUnion_card_iff_exists_injective t).mp this exact ⟨f, hf1, fun l => Set.mem_toFinset.mp (hf2 l)⟩ intro s by_cases hsβ‚€ : s.card = 0 -- If `s = βˆ…`, then `s.card = 0 ≀ (s.bUnion t).card` Β· simp_rw [hsβ‚€, zero_le] by_cases hs₁ : s.card = 1 -- If `s = {l}`, then pick a point `p βˆ‰ l` Β· obtain ⟨l, rfl⟩ := Finset.card_eq_one.mp hs₁ obtain ⟨p, hl⟩ := exists_point l rw [Finset.card_singleton, Finset.singleton_biUnion, Nat.one_le_iff_ne_zero] exact Finset.card_ne_zero_of_mem (Set.mem_toFinset.mpr hl) suffices (s.biUnion t)ᢜ.card ≀ sᢜ.card by -- Rephrase in terms of complements (uses `h`) rw [Finset.card_compl, Finset.card_compl, tsub_le_iff_left] at this replace := h.trans this rwa [← add_tsub_assoc_of_le s.card_le_univ, le_tsub_iff_left (le_add_left s.card_le_univ), add_le_add_iff_right] at this have hsβ‚‚ : (s.biUnion t)ᢜ.card ≀ 1 := by -- At most one line through two points of `s` refine Finset.card_le_one_iff.mpr @fun p₁ pβ‚‚ hp₁ hpβ‚‚ => ?_ simp_rw [t, Finset.mem_compl, Finset.mem_biUnion, not_exists, not_and, Set.mem_toFinset, Set.mem_setOf_eq, Classical.not_not] at hp₁ hpβ‚‚ obtain ⟨l₁, lβ‚‚, hl₁, hlβ‚‚, hlβ‚ƒβŸ© := Finset.one_lt_card_iff.mp (Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hsβ‚€, hsβ‚βŸ©) exact (eq_or_eq (hp₁ l₁ hl₁) (hpβ‚‚ l₁ hl₁) (hp₁ lβ‚‚ hlβ‚‚) (hpβ‚‚ lβ‚‚ hlβ‚‚)).resolve_right hl₃ by_cases hs₃ : sᢜ.card = 0 Β· rw [hs₃, Nat.le_zero] rw [Finset.card_compl, tsub_eq_zero_iff_le, LE.le.le_iff_eq (Finset.card_le_univ _), eq_comm, Finset.card_eq_iff_eq_univ] at hs₃ ⊒ rw [hs₃] rw [Finset.eq_univ_iff_forall] at hs₃ ⊒ exact fun p => Exists.elim (exists_line p)-- If `s = univ`, then show `s.bUnion t = univ` fun l hl => Finset.mem_biUnion.mpr ⟨l, Finset.mem_univ l, Set.mem_toFinset.mpr hl⟩ Β· exact hsβ‚‚.trans (Nat.one_le_iff_ne_zero.mpr hs₃)
1,228
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {Ξ± : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset section CosetSemigroup variable [Semigroup Ξ±] @[to_additive leftAddCoset_assoc]
Mathlib/GroupTheory/Coset.lean
105
106
theorem leftCoset_assoc (s : Set Ξ±) (a b : Ξ±) : a β€’ (b β€’ s) = (a * b) β€’ s := by
simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc]
1,229
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {Ξ± : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset section CosetSemigroup variable [Semigroup Ξ±] @[to_additive leftAddCoset_assoc] theorem leftCoset_assoc (s : Set Ξ±) (a b : Ξ±) : a β€’ (b β€’ s) = (a * b) β€’ s := by simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc] #align left_coset_assoc leftCoset_assoc #align left_add_coset_assoc leftAddCoset_assoc @[to_additive rightAddCoset_assoc]
Mathlib/GroupTheory/Coset.lean
111
112
theorem rightCoset_assoc (s : Set Ξ±) (a b : Ξ±) : op b β€’ op a β€’ s = op (a * b) β€’ s := by
simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc]
1,229
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {Ξ± : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset section CosetSemigroup variable [Semigroup Ξ±] @[to_additive leftAddCoset_assoc] theorem leftCoset_assoc (s : Set Ξ±) (a b : Ξ±) : a β€’ (b β€’ s) = (a * b) β€’ s := by simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc] #align left_coset_assoc leftCoset_assoc #align left_add_coset_assoc leftAddCoset_assoc @[to_additive rightAddCoset_assoc] theorem rightCoset_assoc (s : Set Ξ±) (a b : Ξ±) : op b β€’ op a β€’ s = op (a * b) β€’ s := by simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc] #align right_coset_assoc rightCoset_assoc #align right_add_coset_assoc rightAddCoset_assoc @[to_additive leftAddCoset_rightAddCoset]
Mathlib/GroupTheory/Coset.lean
117
118
theorem leftCoset_rightCoset (s : Set Ξ±) (a b : Ξ±) : op b β€’ a β€’ s = a β€’ (op b β€’ s) := by
simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc]
1,229
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {Ξ± : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset -- Porting note: see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.E2.9C.94.20to_additive.2Emap_namespace run_cmd Lean.Elab.Command.liftCoreM <| ToAdditive.insertTranslation `QuotientGroup `QuotientAddGroup namespace QuotientGroup variable [Group Ξ±] (s : Subgroup Ξ±) @[to_additive "The equivalence relation corresponding to the partition of a group by left cosets of a subgroup."] def leftRel : Setoid Ξ± := MulAction.orbitRel s.op Ξ± #align quotient_group.left_rel QuotientGroup.leftRel #align quotient_add_group.left_rel QuotientAddGroup.leftRel variable {s} @[to_additive]
Mathlib/GroupTheory/Coset.lean
302
308
theorem leftRel_apply {x y : Ξ±} : @Setoid.r _ (leftRel s) x y ↔ x⁻¹ * y ∈ s := calc (βˆƒ a : s.op, y * MulOpposite.unop a = x) ↔ βˆƒ a : s, y * a = x := s.equivOp.symm.exists_congr_left _ ↔ βˆƒ a : s, x⁻¹ * y = a⁻¹ := by
simp only [inv_mul_eq_iff_eq_mul, Subgroup.coe_inv, eq_mul_inv_iff_mul_eq] _ ↔ x⁻¹ * y ∈ s := by simp [exists_inv_mem_iff_exists_mem]
1,229
import Mathlib.Algebra.Field.Opposite import Mathlib.Algebra.Group.Subgroup.ZPowers import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Ring.NegOnePow import Mathlib.Algebra.Order.Archimedean import Mathlib.GroupTheory.Coset #align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e" variable {Ξ± Ξ² Ξ³ : Type*} {f g : Ξ± β†’ Ξ²} {c c₁ cβ‚‚ x : Ξ±} open Set namespace Function @[simp] def Periodic [Add Ξ±] (f : Ξ± β†’ Ξ²) (c : Ξ±) : Prop := βˆ€ x : Ξ±, f (x + c) = f x #align function.periodic Function.Periodic protected theorem Periodic.funext [Add Ξ±] (h : Periodic f c) : (fun x => f (x + c)) = f := funext h #align function.periodic.funext Function.Periodic.funext protected theorem Periodic.comp [Add Ξ±] (h : Periodic f c) (g : Ξ² β†’ Ξ³) : Periodic (g ∘ f) c := by simp_all #align function.periodic.comp Function.Periodic.comp theorem Periodic.comp_addHom [Add Ξ±] [Add Ξ³] (h : Periodic f c) (g : AddHom Ξ³ Ξ±) (g_inv : Ξ± β†’ Ξ³) (hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by simp only [hg c, h (g x), map_add, comp_apply] #align function.periodic.comp_add_hom Function.Periodic.comp_addHom @[to_additive] protected theorem Periodic.mul [Add Ξ±] [Mul Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f * g) c := by simp_all #align function.periodic.mul Function.Periodic.mul #align function.periodic.add Function.Periodic.add @[to_additive] protected theorem Periodic.div [Add Ξ±] [Div Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f / g) c := by simp_all #align function.periodic.div Function.Periodic.div #align function.periodic.sub Function.Periodic.sub @[to_additive]
Mathlib/Algebra/Periodic.lean
77
82
theorem _root_.List.periodic_prod [Add Ξ±] [Monoid Ξ²] (l : List (Ξ± β†’ Ξ²)) (hl : βˆ€ f ∈ l, Periodic f c) : Periodic l.prod c := by
induction' l with g l ih hl Β· simp Β· rw [List.forall_mem_cons] at hl simpa only [List.prod_cons] using hl.1.mul (ih hl.2)
1,230
import Mathlib.Algebra.Field.Opposite import Mathlib.Algebra.Group.Subgroup.ZPowers import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Ring.NegOnePow import Mathlib.Algebra.Order.Archimedean import Mathlib.GroupTheory.Coset #align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e" variable {Ξ± Ξ² Ξ³ : Type*} {f g : Ξ± β†’ Ξ²} {c c₁ cβ‚‚ x : Ξ±} open Set namespace Function @[simp] def Periodic [Add Ξ±] (f : Ξ± β†’ Ξ²) (c : Ξ±) : Prop := βˆ€ x : Ξ±, f (x + c) = f x #align function.periodic Function.Periodic protected theorem Periodic.funext [Add Ξ±] (h : Periodic f c) : (fun x => f (x + c)) = f := funext h #align function.periodic.funext Function.Periodic.funext protected theorem Periodic.comp [Add Ξ±] (h : Periodic f c) (g : Ξ² β†’ Ξ³) : Periodic (g ∘ f) c := by simp_all #align function.periodic.comp Function.Periodic.comp theorem Periodic.comp_addHom [Add Ξ±] [Add Ξ³] (h : Periodic f c) (g : AddHom Ξ³ Ξ±) (g_inv : Ξ± β†’ Ξ³) (hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by simp only [hg c, h (g x), map_add, comp_apply] #align function.periodic.comp_add_hom Function.Periodic.comp_addHom @[to_additive] protected theorem Periodic.mul [Add Ξ±] [Mul Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f * g) c := by simp_all #align function.periodic.mul Function.Periodic.mul #align function.periodic.add Function.Periodic.add @[to_additive] protected theorem Periodic.div [Add Ξ±] [Div Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f / g) c := by simp_all #align function.periodic.div Function.Periodic.div #align function.periodic.sub Function.Periodic.sub @[to_additive] theorem _root_.List.periodic_prod [Add Ξ±] [Monoid Ξ²] (l : List (Ξ± β†’ Ξ²)) (hl : βˆ€ f ∈ l, Periodic f c) : Periodic l.prod c := by induction' l with g l ih hl Β· simp Β· rw [List.forall_mem_cons] at hl simpa only [List.prod_cons] using hl.1.mul (ih hl.2) #align list.periodic_prod List.periodic_prod #align list.periodic_sum List.periodic_sum @[to_additive] theorem _root_.Multiset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] (s : Multiset (Ξ± β†’ Ξ²)) (hs : βˆ€ f ∈ s, Periodic f c) : Periodic s.prod c := (s.prod_toList β–Έ s.toList.periodic_prod) fun f hf => hs f <| Multiset.mem_toList.mp hf #align multiset.periodic_prod Multiset.periodic_prod #align multiset.periodic_sum Multiset.periodic_sum @[to_additive] theorem _root_.Finset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] {ΞΉ : Type*} {f : ΞΉ β†’ Ξ± β†’ Ξ²} (s : Finset ΞΉ) (hs : βˆ€ i ∈ s, Periodic (f i) c) : Periodic (∏ i ∈ s, f i) c := s.prod_to_list f β–Έ (s.toList.map f).periodic_prod (by simpa [-Periodic] ) #align finset.periodic_prod Finset.periodic_prod #align finset.periodic_sum Finset.periodic_sum @[to_additive] protected theorem Periodic.smul [Add Ξ±] [SMul Ξ³ Ξ²] (h : Periodic f c) (a : Ξ³) : Periodic (a β€’ f) c := by simp_all #align function.periodic.smul Function.Periodic.smul #align function.periodic.vadd Function.Periodic.vadd protected theorem Periodic.const_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by simpa only [smul_add, smul_inv_smul] using h (a β€’ x) #align function.periodic.const_smul Function.Periodic.const_smul protected theorem Periodic.const_smulβ‚€ [AddCommMonoid Ξ±] [DivisionSemiring Ξ³] [Module Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by by_cases ha : a = 0 Β· simp only [ha, zero_smul] Β· simpa only [smul_add, smul_inv_smulβ‚€ ha] using h (a β€’ x) #align function.periodic.const_smulβ‚€ Function.Periodic.const_smulβ‚€ protected theorem Periodic.const_mul [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (a * x)) (a⁻¹ * c) := Periodic.const_smulβ‚€ h a #align function.periodic.const_mul Function.Periodic.const_mul
Mathlib/Algebra/Periodic.lean
123
125
theorem Periodic.const_inv_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a⁻¹ β€’ x)) (a β€’ c) := by
simpa only [inv_inv] using h.const_smul a⁻¹
1,230
import Mathlib.Algebra.Field.Opposite import Mathlib.Algebra.Group.Subgroup.ZPowers import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Ring.NegOnePow import Mathlib.Algebra.Order.Archimedean import Mathlib.GroupTheory.Coset #align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e" variable {Ξ± Ξ² Ξ³ : Type*} {f g : Ξ± β†’ Ξ²} {c c₁ cβ‚‚ x : Ξ±} open Set namespace Function @[simp] def Periodic [Add Ξ±] (f : Ξ± β†’ Ξ²) (c : Ξ±) : Prop := βˆ€ x : Ξ±, f (x + c) = f x #align function.periodic Function.Periodic protected theorem Periodic.funext [Add Ξ±] (h : Periodic f c) : (fun x => f (x + c)) = f := funext h #align function.periodic.funext Function.Periodic.funext protected theorem Periodic.comp [Add Ξ±] (h : Periodic f c) (g : Ξ² β†’ Ξ³) : Periodic (g ∘ f) c := by simp_all #align function.periodic.comp Function.Periodic.comp theorem Periodic.comp_addHom [Add Ξ±] [Add Ξ³] (h : Periodic f c) (g : AddHom Ξ³ Ξ±) (g_inv : Ξ± β†’ Ξ³) (hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by simp only [hg c, h (g x), map_add, comp_apply] #align function.periodic.comp_add_hom Function.Periodic.comp_addHom @[to_additive] protected theorem Periodic.mul [Add Ξ±] [Mul Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f * g) c := by simp_all #align function.periodic.mul Function.Periodic.mul #align function.periodic.add Function.Periodic.add @[to_additive] protected theorem Periodic.div [Add Ξ±] [Div Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f / g) c := by simp_all #align function.periodic.div Function.Periodic.div #align function.periodic.sub Function.Periodic.sub @[to_additive] theorem _root_.List.periodic_prod [Add Ξ±] [Monoid Ξ²] (l : List (Ξ± β†’ Ξ²)) (hl : βˆ€ f ∈ l, Periodic f c) : Periodic l.prod c := by induction' l with g l ih hl Β· simp Β· rw [List.forall_mem_cons] at hl simpa only [List.prod_cons] using hl.1.mul (ih hl.2) #align list.periodic_prod List.periodic_prod #align list.periodic_sum List.periodic_sum @[to_additive] theorem _root_.Multiset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] (s : Multiset (Ξ± β†’ Ξ²)) (hs : βˆ€ f ∈ s, Periodic f c) : Periodic s.prod c := (s.prod_toList β–Έ s.toList.periodic_prod) fun f hf => hs f <| Multiset.mem_toList.mp hf #align multiset.periodic_prod Multiset.periodic_prod #align multiset.periodic_sum Multiset.periodic_sum @[to_additive] theorem _root_.Finset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] {ΞΉ : Type*} {f : ΞΉ β†’ Ξ± β†’ Ξ²} (s : Finset ΞΉ) (hs : βˆ€ i ∈ s, Periodic (f i) c) : Periodic (∏ i ∈ s, f i) c := s.prod_to_list f β–Έ (s.toList.map f).periodic_prod (by simpa [-Periodic] ) #align finset.periodic_prod Finset.periodic_prod #align finset.periodic_sum Finset.periodic_sum @[to_additive] protected theorem Periodic.smul [Add Ξ±] [SMul Ξ³ Ξ²] (h : Periodic f c) (a : Ξ³) : Periodic (a β€’ f) c := by simp_all #align function.periodic.smul Function.Periodic.smul #align function.periodic.vadd Function.Periodic.vadd protected theorem Periodic.const_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by simpa only [smul_add, smul_inv_smul] using h (a β€’ x) #align function.periodic.const_smul Function.Periodic.const_smul protected theorem Periodic.const_smulβ‚€ [AddCommMonoid Ξ±] [DivisionSemiring Ξ³] [Module Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by by_cases ha : a = 0 Β· simp only [ha, zero_smul] Β· simpa only [smul_add, smul_inv_smulβ‚€ ha] using h (a β€’ x) #align function.periodic.const_smulβ‚€ Function.Periodic.const_smulβ‚€ protected theorem Periodic.const_mul [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (a * x)) (a⁻¹ * c) := Periodic.const_smulβ‚€ h a #align function.periodic.const_mul Function.Periodic.const_mul theorem Periodic.const_inv_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a⁻¹ β€’ x)) (a β€’ c) := by simpa only [inv_inv] using h.const_smul a⁻¹ #align function.periodic.const_inv_smul Function.Periodic.const_inv_smul
Mathlib/Algebra/Periodic.lean
128
130
theorem Periodic.const_inv_smulβ‚€ [AddCommMonoid Ξ±] [DivisionSemiring Ξ³] [Module Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a⁻¹ β€’ x)) (a β€’ c) := by
simpa only [inv_inv] using h.const_smulβ‚€ a⁻¹
1,230
import Mathlib.Algebra.Field.Opposite import Mathlib.Algebra.Group.Subgroup.ZPowers import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Ring.NegOnePow import Mathlib.Algebra.Order.Archimedean import Mathlib.GroupTheory.Coset #align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e" variable {Ξ± Ξ² Ξ³ : Type*} {f g : Ξ± β†’ Ξ²} {c c₁ cβ‚‚ x : Ξ±} open Set namespace Function @[simp] def Periodic [Add Ξ±] (f : Ξ± β†’ Ξ²) (c : Ξ±) : Prop := βˆ€ x : Ξ±, f (x + c) = f x #align function.periodic Function.Periodic protected theorem Periodic.funext [Add Ξ±] (h : Periodic f c) : (fun x => f (x + c)) = f := funext h #align function.periodic.funext Function.Periodic.funext protected theorem Periodic.comp [Add Ξ±] (h : Periodic f c) (g : Ξ² β†’ Ξ³) : Periodic (g ∘ f) c := by simp_all #align function.periodic.comp Function.Periodic.comp theorem Periodic.comp_addHom [Add Ξ±] [Add Ξ³] (h : Periodic f c) (g : AddHom Ξ³ Ξ±) (g_inv : Ξ± β†’ Ξ³) (hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by simp only [hg c, h (g x), map_add, comp_apply] #align function.periodic.comp_add_hom Function.Periodic.comp_addHom @[to_additive] protected theorem Periodic.mul [Add Ξ±] [Mul Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f * g) c := by simp_all #align function.periodic.mul Function.Periodic.mul #align function.periodic.add Function.Periodic.add @[to_additive] protected theorem Periodic.div [Add Ξ±] [Div Ξ²] (hf : Periodic f c) (hg : Periodic g c) : Periodic (f / g) c := by simp_all #align function.periodic.div Function.Periodic.div #align function.periodic.sub Function.Periodic.sub @[to_additive] theorem _root_.List.periodic_prod [Add Ξ±] [Monoid Ξ²] (l : List (Ξ± β†’ Ξ²)) (hl : βˆ€ f ∈ l, Periodic f c) : Periodic l.prod c := by induction' l with g l ih hl Β· simp Β· rw [List.forall_mem_cons] at hl simpa only [List.prod_cons] using hl.1.mul (ih hl.2) #align list.periodic_prod List.periodic_prod #align list.periodic_sum List.periodic_sum @[to_additive] theorem _root_.Multiset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] (s : Multiset (Ξ± β†’ Ξ²)) (hs : βˆ€ f ∈ s, Periodic f c) : Periodic s.prod c := (s.prod_toList β–Έ s.toList.periodic_prod) fun f hf => hs f <| Multiset.mem_toList.mp hf #align multiset.periodic_prod Multiset.periodic_prod #align multiset.periodic_sum Multiset.periodic_sum @[to_additive] theorem _root_.Finset.periodic_prod [Add Ξ±] [CommMonoid Ξ²] {ΞΉ : Type*} {f : ΞΉ β†’ Ξ± β†’ Ξ²} (s : Finset ΞΉ) (hs : βˆ€ i ∈ s, Periodic (f i) c) : Periodic (∏ i ∈ s, f i) c := s.prod_to_list f β–Έ (s.toList.map f).periodic_prod (by simpa [-Periodic] ) #align finset.periodic_prod Finset.periodic_prod #align finset.periodic_sum Finset.periodic_sum @[to_additive] protected theorem Periodic.smul [Add Ξ±] [SMul Ξ³ Ξ²] (h : Periodic f c) (a : Ξ³) : Periodic (a β€’ f) c := by simp_all #align function.periodic.smul Function.Periodic.smul #align function.periodic.vadd Function.Periodic.vadd protected theorem Periodic.const_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by simpa only [smul_add, smul_inv_smul] using h (a β€’ x) #align function.periodic.const_smul Function.Periodic.const_smul protected theorem Periodic.const_smulβ‚€ [AddCommMonoid Ξ±] [DivisionSemiring Ξ³] [Module Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a β€’ x)) (a⁻¹ β€’ c) := fun x => by by_cases ha : a = 0 Β· simp only [ha, zero_smul] Β· simpa only [smul_add, smul_inv_smulβ‚€ ha] using h (a β€’ x) #align function.periodic.const_smulβ‚€ Function.Periodic.const_smulβ‚€ protected theorem Periodic.const_mul [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (a * x)) (a⁻¹ * c) := Periodic.const_smulβ‚€ h a #align function.periodic.const_mul Function.Periodic.const_mul theorem Periodic.const_inv_smul [AddMonoid Ξ±] [Group Ξ³] [DistribMulAction Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a⁻¹ β€’ x)) (a β€’ c) := by simpa only [inv_inv] using h.const_smul a⁻¹ #align function.periodic.const_inv_smul Function.Periodic.const_inv_smul theorem Periodic.const_inv_smulβ‚€ [AddCommMonoid Ξ±] [DivisionSemiring Ξ³] [Module Ξ³ Ξ±] (h : Periodic f c) (a : Ξ³) : Periodic (fun x => f (a⁻¹ β€’ x)) (a β€’ c) := by simpa only [inv_inv] using h.const_smulβ‚€ a⁻¹ #align function.periodic.const_inv_smulβ‚€ Function.Periodic.const_inv_smulβ‚€ theorem Periodic.const_inv_mul [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (a⁻¹ * x)) (a * c) := h.const_inv_smulβ‚€ a #align function.periodic.const_inv_mul Function.Periodic.const_inv_mul theorem Periodic.mul_const [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (x * a)) (c * a⁻¹) := h.const_smulβ‚€ (MulOpposite.op a) #align function.periodic.mul_const Function.Periodic.mul_const
Mathlib/Algebra/Periodic.lean
143
144
theorem Periodic.mul_const' [DivisionSemiring Ξ±] (h : Periodic f c) (a : Ξ±) : Periodic (fun x => f (x * a)) (c / a) := by
simpa only [div_eq_mul_inv] using h.mul_const a
1,230
import Mathlib.Algebra.Periodic import Mathlib.Data.Nat.Count import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Nat open Nat Function
Mathlib/Data/Nat/Periodic.lean
25
26
theorem periodic_gcd (a : β„•) : Periodic (gcd a) a := by
simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic]
1,231
import Mathlib.Algebra.Periodic import Mathlib.Data.Nat.Count import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Nat open Nat Function theorem periodic_gcd (a : β„•) : Periodic (gcd a) a := by simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic] #align nat.periodic_gcd Nat.periodic_gcd
Mathlib/Data/Nat/Periodic.lean
29
30
theorem periodic_coprime (a : β„•) : Periodic (Coprime a) a := by
simp only [coprime_add_self_right, forall_const, iff_self_iff, eq_iff_iff, Periodic]
1,231
import Mathlib.Algebra.Periodic import Mathlib.Data.Nat.Count import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Nat open Nat Function theorem periodic_gcd (a : β„•) : Periodic (gcd a) a := by simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic] #align nat.periodic_gcd Nat.periodic_gcd theorem periodic_coprime (a : β„•) : Periodic (Coprime a) a := by simp only [coprime_add_self_right, forall_const, iff_self_iff, eq_iff_iff, Periodic] #align nat.periodic_coprime Nat.periodic_coprime
Mathlib/Data/Nat/Periodic.lean
33
34
theorem periodic_mod (a : β„•) : Periodic (fun n => n % a) a := by
simp only [forall_const, eq_self_iff_true, add_mod_right, Periodic]
1,231
import Mathlib.Algebra.Periodic import Mathlib.Data.Nat.Count import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Nat open Nat Function theorem periodic_gcd (a : β„•) : Periodic (gcd a) a := by simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic] #align nat.periodic_gcd Nat.periodic_gcd theorem periodic_coprime (a : β„•) : Periodic (Coprime a) a := by simp only [coprime_add_self_right, forall_const, iff_self_iff, eq_iff_iff, Periodic] #align nat.periodic_coprime Nat.periodic_coprime theorem periodic_mod (a : β„•) : Periodic (fun n => n % a) a := by simp only [forall_const, eq_self_iff_true, add_mod_right, Periodic] #align nat.periodic_mod Nat.periodic_mod theorem _root_.Function.Periodic.map_mod_nat {Ξ± : Type*} {f : β„• β†’ Ξ±} {a : β„•} (hf : Periodic f a) : βˆ€ n, f (n % a) = f n := fun n => by conv_rhs => rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul] #align function.periodic.map_mod_nat Function.Periodic.map_mod_nat section Multiset open Multiset
Mathlib/Data/Nat/Periodic.lean
48
54
theorem filter_multiset_Ico_card_eq_of_periodic (n a : β„•) (p : β„• β†’ Prop) [DecidablePred p] (pp : Periodic p a) : card (filter p (Ico n (n + a))) = a.count p := by
rw [count_eq_card_filter_range, Finset.card, Finset.filter_val, Finset.range_val, ← multiset_Ico_map_mod n, ← map_count_True_eq_filter_card, ← map_count_True_eq_filter_card, map_map] congr; funext n exact (Function.Periodic.map_mod_nat pp n).symm
1,231
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq
Mathlib/Data/Finite/Card.lean
49
54
theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by
cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq
Mathlib/Data/Finite/Card.lean
57
59
theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by
haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk
Mathlib/Data/Finite/Card.lean
72
75
theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by
haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq
Mathlib/Data/Finite/Card.lean
78
80
theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by
haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton
Mathlib/Data/Finite/Card.lean
83
85
theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by
haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial] #align finite.one_lt_card_iff_nontrivial Finite.one_lt_card_iff_nontrivial theorem one_lt_card [Finite Ξ±] [h : Nontrivial Ξ±] : 1 < Nat.card Ξ± := one_lt_card_iff_nontrivial.mpr h #align finite.one_lt_card Finite.one_lt_card @[simp]
Mathlib/Data/Finite/Card.lean
93
95
theorem card_option [Finite Ξ±] : Nat.card (Option Ξ±) = Nat.card Ξ± + 1 := by
haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_option]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial] #align finite.one_lt_card_iff_nontrivial Finite.one_lt_card_iff_nontrivial theorem one_lt_card [Finite Ξ±] [h : Nontrivial Ξ±] : 1 < Nat.card Ξ± := one_lt_card_iff_nontrivial.mpr h #align finite.one_lt_card Finite.one_lt_card @[simp] theorem card_option [Finite Ξ±] : Nat.card (Option Ξ±) = Nat.card Ξ± + 1 := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_option] #align finite.card_option Finite.card_option
Mathlib/Data/Finite/Card.lean
98
102
theorem card_le_of_injective [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Function.Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by
haveI := Fintype.ofFinite Ξ² haveI := Fintype.ofInjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_injective f hf
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial] #align finite.one_lt_card_iff_nontrivial Finite.one_lt_card_iff_nontrivial theorem one_lt_card [Finite Ξ±] [h : Nontrivial Ξ±] : 1 < Nat.card Ξ± := one_lt_card_iff_nontrivial.mpr h #align finite.one_lt_card Finite.one_lt_card @[simp] theorem card_option [Finite Ξ±] : Nat.card (Option Ξ±) = Nat.card Ξ± + 1 := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_option] #align finite.card_option Finite.card_option theorem card_le_of_injective [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Function.Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by haveI := Fintype.ofFinite Ξ² haveI := Fintype.ofInjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_injective f hf #align finite.card_le_of_injective Finite.card_le_of_injective theorem card_le_of_embedding [Finite Ξ²] (f : Ξ± β†ͺ Ξ²) : Nat.card Ξ± ≀ Nat.card Ξ² := card_le_of_injective _ f.injective #align finite.card_le_of_embedding Finite.card_le_of_embedding
Mathlib/Data/Finite/Card.lean
109
113
theorem card_le_of_surjective [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Function.Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by
haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofSurjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_surjective f hf
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial] #align finite.one_lt_card_iff_nontrivial Finite.one_lt_card_iff_nontrivial theorem one_lt_card [Finite Ξ±] [h : Nontrivial Ξ±] : 1 < Nat.card Ξ± := one_lt_card_iff_nontrivial.mpr h #align finite.one_lt_card Finite.one_lt_card @[simp] theorem card_option [Finite Ξ±] : Nat.card (Option Ξ±) = Nat.card Ξ± + 1 := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_option] #align finite.card_option Finite.card_option theorem card_le_of_injective [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Function.Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by haveI := Fintype.ofFinite Ξ² haveI := Fintype.ofInjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_injective f hf #align finite.card_le_of_injective Finite.card_le_of_injective theorem card_le_of_embedding [Finite Ξ²] (f : Ξ± β†ͺ Ξ²) : Nat.card Ξ± ≀ Nat.card Ξ² := card_le_of_injective _ f.injective #align finite.card_le_of_embedding Finite.card_le_of_embedding theorem card_le_of_surjective [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Function.Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofSurjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_surjective f hf #align finite.card_le_of_surjective Finite.card_le_of_surjective
Mathlib/Data/Finite/Card.lean
116
118
theorem card_eq_zero_iff [Finite Ξ±] : Nat.card Ξ± = 0 ↔ IsEmpty Ξ± := by
haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_eq_zero_iff]
1,232
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {Ξ± Ξ² Ξ³ : Type*} def Finite.equivFin (Ξ± : Type*) [Finite Ξ±] : Ξ± ≃ Fin (Nat.card Ξ±) := by have := (Finite.exists_equiv_fin Ξ±).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite Ξ±] {n : β„•} (h : Nat.card Ξ± = n) : Ξ± ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (Ξ± : Type*) : Nat.card Ξ± = if h : Finite Ξ± then @Fintype.card Ξ± (Fintype.ofFinite Ξ±) else 0 := by cases finite_or_infinite Ξ± Β· letI := Fintype.ofFinite Ξ± simp only [*, Nat.card_eq_fintype_card, dif_pos] Β· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite Ξ±] : 0 < Nat.card Ξ± ↔ Nonempty Ξ± := by haveI := Fintype.ofFinite Ξ± rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite Ξ±] [h : Nonempty Ξ±] : 0 < Nat.card Ξ± := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {Ξ± : Type*} [Finite Ξ±] : ↑(Nat.card Ξ±) = Cardinal.mk Ξ± := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite Ξ±) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite Ξ±] [Finite Ξ²] : Nat.card Ξ± = Nat.card Ξ² ↔ Nonempty (Ξ± ≃ Ξ²) := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofFinite Ξ² simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite Ξ±] : Nat.card Ξ± ≀ 1 ↔ Subsingleton Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton theorem one_lt_card_iff_nontrivial [Finite Ξ±] : 1 < Nat.card Ξ± ↔ Nontrivial Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial] #align finite.one_lt_card_iff_nontrivial Finite.one_lt_card_iff_nontrivial theorem one_lt_card [Finite Ξ±] [h : Nontrivial Ξ±] : 1 < Nat.card Ξ± := one_lt_card_iff_nontrivial.mpr h #align finite.one_lt_card Finite.one_lt_card @[simp] theorem card_option [Finite Ξ±] : Nat.card (Option Ξ±) = Nat.card Ξ± + 1 := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_option] #align finite.card_option Finite.card_option theorem card_le_of_injective [Finite Ξ²] (f : Ξ± β†’ Ξ²) (hf : Function.Injective f) : Nat.card Ξ± ≀ Nat.card Ξ² := by haveI := Fintype.ofFinite Ξ² haveI := Fintype.ofInjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_injective f hf #align finite.card_le_of_injective Finite.card_le_of_injective theorem card_le_of_embedding [Finite Ξ²] (f : Ξ± β†ͺ Ξ²) : Nat.card Ξ± ≀ Nat.card Ξ² := card_le_of_injective _ f.injective #align finite.card_le_of_embedding Finite.card_le_of_embedding theorem card_le_of_surjective [Finite Ξ±] (f : Ξ± β†’ Ξ²) (hf : Function.Surjective f) : Nat.card Ξ² ≀ Nat.card Ξ± := by haveI := Fintype.ofFinite Ξ± haveI := Fintype.ofSurjective f hf simpa only [Nat.card_eq_fintype_card, ge_iff_le] using Fintype.card_le_of_surjective f hf #align finite.card_le_of_surjective Finite.card_le_of_surjective theorem card_eq_zero_iff [Finite Ξ±] : Nat.card Ξ± = 0 ↔ IsEmpty Ξ± := by haveI := Fintype.ofFinite Ξ± simp only [Nat.card_eq_fintype_card, Fintype.card_eq_zero_iff] #align finite.card_eq_zero_iff Finite.card_eq_zero_iff theorem card_le_of_injective' {f : Ξ± β†’ Ξ²} (hf : Function.Injective f) (h : Nat.card Ξ² = 0 β†’ Nat.card Ξ± = 0) : Nat.card Ξ± ≀ Nat.card Ξ² := (or_not_of_imp h).casesOn (fun h => le_of_eq_of_le h zero_le') fun h => @card_le_of_injective Ξ± Ξ² (Nat.finite_of_card_ne_zero h) f hf #align finite.card_le_of_injective' Finite.card_le_of_injective' theorem card_le_of_embedding' (f : Ξ± β†ͺ Ξ²) (h : Nat.card Ξ² = 0 β†’ Nat.card Ξ± = 0) : Nat.card Ξ± ≀ Nat.card Ξ² := card_le_of_injective' f.2 h #align finite.card_le_of_embedding' Finite.card_le_of_embedding' theorem card_le_of_surjective' {f : Ξ± β†’ Ξ²} (hf : Function.Surjective f) (h : Nat.card Ξ± = 0 β†’ Nat.card Ξ² = 0) : Nat.card Ξ² ≀ Nat.card Ξ± := (or_not_of_imp h).casesOn (fun h => le_of_eq_of_le h zero_le') fun h => @card_le_of_surjective Ξ± Ξ² (Nat.finite_of_card_ne_zero h) f hf #align finite.card_le_of_surjective' Finite.card_le_of_surjective'
Mathlib/Data/Finite/Card.lean
145
152
theorem card_eq_zero_of_surjective {f : Ξ± β†’ Ξ²} (hf : Function.Surjective f) (h : Nat.card Ξ² = 0) : Nat.card Ξ± = 0 := by
cases finite_or_infinite Ξ² Β· haveI := card_eq_zero_iff.mp h haveI := Function.isEmpty f exact Nat.card_of_isEmpty Β· haveI := Infinite.of_surjective f hf exact Nat.card_eq_zero_of_infinite
1,232
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Data.Finite.Card #align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" variable {G : Type*} [Group G] variable {A : Type*} [AddGroup A] namespace Subgroup variable (H K : Subgroup G) @[to_additive "Sum of a list of elements in an `AddSubgroup` is in the `AddSubgroup`."] protected theorem list_prod_mem {l : List G} : (βˆ€ x ∈ l, x ∈ K) β†’ l.prod ∈ K := list_prod_mem #align subgroup.list_prod_mem Subgroup.list_prod_mem #align add_subgroup.list_sum_mem AddSubgroup.list_sum_mem @[to_additive "Sum of a multiset of elements in an `AddSubgroup` of an `AddCommGroup` is in the `AddSubgroup`."] protected theorem multiset_prod_mem {G} [CommGroup G] (K : Subgroup G) (g : Multiset G) : (βˆ€ a ∈ g, a ∈ K) β†’ g.prod ∈ K := multiset_prod_mem g #align subgroup.multiset_prod_mem Subgroup.multiset_prod_mem #align add_subgroup.multiset_sum_mem AddSubgroup.multiset_sum_mem @[to_additive] theorem multiset_noncommProd_mem (K : Subgroup G) (g : Multiset G) (comm) : (βˆ€ a ∈ g, a ∈ K) β†’ g.noncommProd comm ∈ K := K.toSubmonoid.multiset_noncommProd_mem g comm #align subgroup.multiset_noncomm_prod_mem Subgroup.multiset_noncommProd_mem #align add_subgroup.multiset_noncomm_sum_mem AddSubgroup.multiset_noncommSum_mem @[to_additive "Sum of elements in an `AddSubgroup` of an `AddCommGroup` indexed by a `Finset` is in the `AddSubgroup`."] protected theorem prod_mem {G : Type*} [CommGroup G] (K : Subgroup G) {ΞΉ : Type*} {t : Finset ΞΉ} {f : ΞΉ β†’ G} (h : βˆ€ c ∈ t, f c ∈ K) : (∏ c ∈ t, f c) ∈ K := prod_mem h #align subgroup.prod_mem Subgroup.prod_mem #align add_subgroup.sum_mem AddSubgroup.sum_mem @[to_additive] theorem noncommProd_mem (K : Subgroup G) {ΞΉ : Type*} {t : Finset ΞΉ} {f : ΞΉ β†’ G} (comm) : (βˆ€ c ∈ t, f c ∈ K) β†’ t.noncommProd f comm ∈ K := K.toSubmonoid.noncommProd_mem t f comm #align subgroup.noncomm_prod_mem Subgroup.noncommProd_mem #align add_subgroup.noncomm_sum_mem AddSubgroup.noncommSum_mem -- Porting note: increased priority to appease `simpNF`, otherwise left-hand side reduces @[to_additive (attr := simp 1100, norm_cast)] theorem val_list_prod (l : List H) : (l.prod : G) = (l.map Subtype.val).prod := SubmonoidClass.coe_list_prod l #align subgroup.coe_list_prod Subgroup.val_list_prod #align add_subgroup.coe_list_sum AddSubgroup.val_list_sum -- Porting note: increased priority to appease `simpNF`, otherwise left-hand side reduces @[to_additive (attr := simp 1100, norm_cast)] theorem val_multiset_prod {G} [CommGroup G] (H : Subgroup G) (m : Multiset H) : (m.prod : G) = (m.map Subtype.val).prod := SubmonoidClass.coe_multiset_prod m #align subgroup.coe_multiset_prod Subgroup.val_multiset_prod #align add_subgroup.coe_multiset_sum AddSubgroup.val_multiset_sum -- Porting note: increased priority to appease `simpNF`, otherwise `simp` can prove it. @[to_additive (attr := simp 1100, norm_cast)] theorem val_finset_prod {ΞΉ G} [CommGroup G] (H : Subgroup G) (f : ΞΉ β†’ H) (s : Finset ΞΉ) : ↑(∏ i ∈ s, f i) = (∏ i ∈ s, f i : G) := SubmonoidClass.coe_finset_prod f s #align subgroup.coe_finset_prod Subgroup.val_finset_prod #align add_subgroup.coe_finset_sum AddSubgroup.val_finset_sum @[to_additive] instance fintypeBot : Fintype (βŠ₯ : Subgroup G) := ⟨{1}, by rintro ⟨x, ⟨hx⟩⟩ exact Finset.mem_singleton_self _⟩ #align subgroup.fintype_bot Subgroup.fintypeBot #align add_subgroup.fintype_bot AddSubgroup.fintypeBot @[to_additive] -- Porting note: removed `simp` because `simpNF` says it can prove it. theorem card_bot : Nat.card (βŠ₯ : Subgroup G) = 1 := Nat.card_unique #align subgroup.card_bot Subgroup.card_bot #align add_subgroup.card_bot AddSubgroup.card_bot @[to_additive] theorem card_top : Nat.card (⊀ : Subgroup G) = Nat.card G := Nat.card_congr Subgroup.topEquiv.toEquiv @[to_additive]
Mathlib/Algebra/Group/Subgroup/Finite.lean
127
137
theorem eq_top_of_card_eq [Finite H] (h : Nat.card H = Nat.card G) : H = ⊀ := by
have : Nonempty H := ⟨1, one_mem H⟩ have h' : Nat.card H β‰  0 := Nat.card_pos.ne' have : Finite G := (Nat.finite_of_card_ne_zero (h β–Έ h')) have : Fintype G := Fintype.ofFinite G have : Fintype H := Fintype.ofFinite H rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] at h rw [SetLike.ext'_iff, coe_top, ← Finset.coe_univ, ← (H : Set G).coe_toFinset, Finset.coe_inj, ← Finset.card_eq_iff_eq_univ, ← h, Set.toFinset_card] congr
1,233
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Data.Finite.Card #align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" variable {G : Type*} [Group G] variable {A : Type*} [AddGroup A] namespace Subgroup section Pi open Set variable {Ξ· : Type*} {f : Ξ· β†’ Type*} [βˆ€ i, Group (f i)] @[to_additive]
Mathlib/Algebra/Group/Subgroup/Finite.lean
195
226
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq Ξ·] (I : Finset Ξ·) {H : Subgroup (βˆ€ i, f i)} (x : βˆ€ i, f i) (h1 : βˆ€ i, i βˆ‰ I β†’ x i = 1) (h2 : βˆ€ i, i ∈ I β†’ Pi.mulSingle i (x i) ∈ H) : x ∈ H := by
induction' I using Finset.induction_on with i I hnmem ih generalizing x Β· convert one_mem H ext i exact h1 i (Finset.not_mem_empty i) Β· have : x = Function.update x i 1 * Pi.mulSingle i (x i) := by ext j by_cases heq : j = i Β· subst heq simp Β· simp [heq] rw [this] clear this apply mul_mem Β· apply ih <;> clear ih Β· intro j hj by_cases heq : j = i Β· subst heq simp Β· simp [heq] apply h1 j simpa [heq] using hj Β· intro j hj have : j β‰  i := by rintro rfl contradiction simp only [ne_eq, this, not_false_eq_true, Function.update_noteq] exact h2 _ (Finset.mem_insert_of_mem hj) Β· apply h2 simp
1,233
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Data.Finite.Card #align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" variable {G : Type*} [Group G] variable {A : Type*} [AddGroup A] namespace Subgroup section Pi open Set variable {Ξ· : Type*} {f : Ξ· β†’ Type*} [βˆ€ i, Group (f i)] @[to_additive] theorem pi_mem_of_mulSingle_mem_aux [DecidableEq Ξ·] (I : Finset Ξ·) {H : Subgroup (βˆ€ i, f i)} (x : βˆ€ i, f i) (h1 : βˆ€ i, i βˆ‰ I β†’ x i = 1) (h2 : βˆ€ i, i ∈ I β†’ Pi.mulSingle i (x i) ∈ H) : x ∈ H := by induction' I using Finset.induction_on with i I hnmem ih generalizing x Β· convert one_mem H ext i exact h1 i (Finset.not_mem_empty i) Β· have : x = Function.update x i 1 * Pi.mulSingle i (x i) := by ext j by_cases heq : j = i Β· subst heq simp Β· simp [heq] rw [this] clear this apply mul_mem Β· apply ih <;> clear ih Β· intro j hj by_cases heq : j = i Β· subst heq simp Β· simp [heq] apply h1 j simpa [heq] using hj Β· intro j hj have : j β‰  i := by rintro rfl contradiction simp only [ne_eq, this, not_false_eq_true, Function.update_noteq] exact h2 _ (Finset.mem_insert_of_mem hj) Β· apply h2 simp #align subgroup.pi_mem_of_mul_single_mem_aux Subgroup.pi_mem_of_mulSingle_mem_aux #align add_subgroup.pi_mem_of_single_mem_aux AddSubgroup.pi_mem_of_single_mem_aux @[to_additive]
Mathlib/Algebra/Group/Subgroup/Finite.lean
231
234
theorem pi_mem_of_mulSingle_mem [Finite Ξ·] [DecidableEq Ξ·] {H : Subgroup (βˆ€ i, f i)} (x : βˆ€ i, f i) (h : βˆ€ i, Pi.mulSingle i (x i) ∈ H) : x ∈ H := by
cases nonempty_fintype Ξ· exact pi_mem_of_mulSingle_mem_aux Finset.univ x (by simp) fun i _ => h i
1,233
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Data.Finite.Card #align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" variable {G : Type*} [Group G] variable {A : Type*} [AddGroup A] namespace Subgroup section Pi open Set variable {Ξ· : Type*} {f : Ξ· β†’ Type*} [βˆ€ i, Group (f i)] @[to_additive] theorem pi_mem_of_mulSingle_mem_aux [DecidableEq Ξ·] (I : Finset Ξ·) {H : Subgroup (βˆ€ i, f i)} (x : βˆ€ i, f i) (h1 : βˆ€ i, i βˆ‰ I β†’ x i = 1) (h2 : βˆ€ i, i ∈ I β†’ Pi.mulSingle i (x i) ∈ H) : x ∈ H := by induction' I using Finset.induction_on with i I hnmem ih generalizing x Β· convert one_mem H ext i exact h1 i (Finset.not_mem_empty i) Β· have : x = Function.update x i 1 * Pi.mulSingle i (x i) := by ext j by_cases heq : j = i Β· subst heq simp Β· simp [heq] rw [this] clear this apply mul_mem Β· apply ih <;> clear ih Β· intro j hj by_cases heq : j = i Β· subst heq simp Β· simp [heq] apply h1 j simpa [heq] using hj Β· intro j hj have : j β‰  i := by rintro rfl contradiction simp only [ne_eq, this, not_false_eq_true, Function.update_noteq] exact h2 _ (Finset.mem_insert_of_mem hj) Β· apply h2 simp #align subgroup.pi_mem_of_mul_single_mem_aux Subgroup.pi_mem_of_mulSingle_mem_aux #align add_subgroup.pi_mem_of_single_mem_aux AddSubgroup.pi_mem_of_single_mem_aux @[to_additive] theorem pi_mem_of_mulSingle_mem [Finite Ξ·] [DecidableEq Ξ·] {H : Subgroup (βˆ€ i, f i)} (x : βˆ€ i, f i) (h : βˆ€ i, Pi.mulSingle i (x i) ∈ H) : x ∈ H := by cases nonempty_fintype Ξ· exact pi_mem_of_mulSingle_mem_aux Finset.univ x (by simp) fun i _ => h i #align subgroup.pi_mem_of_mul_single_mem Subgroup.pi_mem_of_mulSingle_mem #align add_subgroup.pi_mem_of_single_mem AddSubgroup.pi_mem_of_single_mem @[to_additive "For finite index types, the `Subgroup.pi` is generated by the embeddings of the additive groups."]
Mathlib/Algebra/Group/Subgroup/Finite.lean
241
247
theorem pi_le_iff [DecidableEq Ξ·] [Finite Ξ·] {H : βˆ€ i, Subgroup (f i)} {J : Subgroup (βˆ€ i, f i)} : pi univ H ≀ J ↔ βˆ€ i : Ξ·, map (MonoidHom.mulSingle f i) (H i) ≀ J := by
constructor · rintro h i _ ⟨x, hx, rfl⟩ apply h simpa using hx · exact fun h x hx => pi_mem_of_mulSingle_mem x fun i => h i (mem_map_of_mem _ (hx i trivial))
1,233
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Data.Finite.Card #align_import group_theory.subgroup.finite from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" variable {G : Type*} [Group G] variable {A : Type*} [AddGroup A] namespace Subgroup namespace Subgroup section Normalizer
Mathlib/Algebra/Group/Subgroup/Finite.lean
259
270
theorem mem_normalizer_fintype {S : Set G} [Finite S] {x : G} (h : βˆ€ n, n ∈ S β†’ x * n * x⁻¹ ∈ S) : x ∈ Subgroup.setNormalizer S := by
haveI := Classical.propDecidable; cases nonempty_fintype S; haveI := Set.fintypeImage S fun n => x * n * x⁻¹; exact fun n => ⟨h n, fun h₁ => have heq : (fun n => x * n * x⁻¹) '' S = S := Set.eq_of_subset_of_card_le (fun n ⟨y, hy⟩ => hy.2 β–Έ h y hy.1) (by rw [Set.card_image_of_injective S conj_injective]) have : x * n * x⁻¹ ∈ (fun n => x * n * x⁻¹) '' S := heq.symm β–Έ h₁ let ⟨y, hy⟩ := this conj_injective hy.2 β–Έ hy.1⟩
1,233
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Finset.Fin import Mathlib.Data.Finset.Sort import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fin import Mathlib.Tactic.NormNum.Ineq #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} [DecidableEq Ξ±] {Ξ² : Type v} namespace Equiv.Perm def modSwap (i j : Ξ±) : Setoid (Perm Ξ±) := ⟨fun Οƒ Ο„ => Οƒ = Ο„ ∨ Οƒ = swap i j * Ο„, fun Οƒ => Or.inl (refl Οƒ), fun {Οƒ Ο„} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), fun {Οƒ Ο„ Ο…} hστ hτυ => by cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;> simp [hστ, hτυ] -- Porting note: should close goals, but doesn't Β· simp [hστ, hτυ] Β· simp [hστ, hτυ] Β· simp [hστ, hτυ]⟩ #align equiv.perm.mod_swap Equiv.Perm.modSwap noncomputable instance {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] (i j : Ξ±) : DecidableRel (modSwap i j).r := fun _ _ => Or.decidable def swapFactorsAux : βˆ€ (l : List Ξ±) (f : Perm Ξ±), (βˆ€ {x}, f x β‰  x β†’ x ∈ l) β†’ { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } | [] => fun f h => ⟨[], Equiv.ext fun x => by rw [List.prod_nil] exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm, by simp⟩ | x::l => fun f h => if hfx : x = f x then swapFactorsAux l f fun {y} hy => List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy) else let m := swapFactorsAux l (swap x (f x) * f) fun {y} hy => have : f y β‰  y ∧ y β‰  x := ne_and_ne_of_swap_mul_apply_ne_self hy List.mem_of_ne_of_mem this.2 (h this.1) ⟨swap x (f x)::m.1, by rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def, one_mul], fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩ #align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux def swapFactors [Fintype Ξ±] [LinearOrder Ξ±] (f : Perm Ξ±) : { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := swapFactorsAux ((@univ Ξ± _).sort (Β· ≀ Β·)) f fun {_ _} => (mem_sort _).2 (mem_univ _) #align equiv.perm.swap_factors Equiv.Perm.swapFactors def truncSwapFactors [Fintype Ξ±] (f : Perm Ξ±) : Trunc { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := Quotient.recOnSubsingleton (@univ Ξ± _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _))) (show βˆ€ x, f x β‰  x β†’ x ∈ (@univ Ξ± _).1 from fun _ _ => mem_univ _) #align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors @[elab_as_elim]
Mathlib/GroupTheory/Perm/Sign.lean
99
110
theorem swap_induction_on [Finite Ξ±] {P : Perm Ξ± β†’ Prop} (f : Perm Ξ±) : P 1 β†’ (βˆ€ f x y, x β‰  y β†’ P f β†’ P (swap x y * f)) β†’ P f := by
cases nonempty_fintype Ξ± cases' (truncSwapFactors f).out with l hl induction' l with g l ih generalizing f Β· simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff] Β· intro h1 hmul_swap rcases hl.2 g (by simp) with ⟨x, y, hxy⟩ rw [← hl.1, List.prod_cons, hxy.2] exact hmul_swap _ _ _ hxy.1 (ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap)
1,234
import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Finset.Fin import Mathlib.Data.Finset.Sort import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fin import Mathlib.Tactic.NormNum.Ineq #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} [DecidableEq Ξ±] {Ξ² : Type v} namespace Equiv.Perm def modSwap (i j : Ξ±) : Setoid (Perm Ξ±) := ⟨fun Οƒ Ο„ => Οƒ = Ο„ ∨ Οƒ = swap i j * Ο„, fun Οƒ => Or.inl (refl Οƒ), fun {Οƒ Ο„} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), fun {Οƒ Ο„ Ο…} hστ hτυ => by cases' hστ with hστ hστ <;> cases' hτυ with hτυ hτυ <;> try rw [hστ, hτυ, swap_mul_self_mul] <;> simp [hστ, hτυ] -- Porting note: should close goals, but doesn't Β· simp [hστ, hτυ] Β· simp [hστ, hτυ] Β· simp [hστ, hτυ]⟩ #align equiv.perm.mod_swap Equiv.Perm.modSwap noncomputable instance {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] (i j : Ξ±) : DecidableRel (modSwap i j).r := fun _ _ => Or.decidable def swapFactorsAux : βˆ€ (l : List Ξ±) (f : Perm Ξ±), (βˆ€ {x}, f x β‰  x β†’ x ∈ l) β†’ { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } | [] => fun f h => ⟨[], Equiv.ext fun x => by rw [List.prod_nil] exact (Classical.not_not.1 (mt h (List.not_mem_nil _))).symm, by simp⟩ | x::l => fun f h => if hfx : x = f x then swapFactorsAux l f fun {y} hy => List.mem_of_ne_of_mem (fun h : y = x => by simp [h, hfx.symm] at hy) (h hy) else let m := swapFactorsAux l (swap x (f x) * f) fun {y} hy => have : f y β‰  y ∧ y β‰  x := ne_and_ne_of_swap_mul_apply_ne_self hy List.mem_of_ne_of_mem this.2 (h this.1) ⟨swap x (f x)::m.1, by rw [List.prod_cons, m.2.1, ← mul_assoc, mul_def (swap x (f x)), swap_swap, ← one_def, one_mul], fun {g} hg => ((List.mem_cons).1 hg).elim (fun h => ⟨x, f x, hfx, h⟩) (m.2.2 _)⟩ #align equiv.perm.swap_factors_aux Equiv.Perm.swapFactorsAux def swapFactors [Fintype Ξ±] [LinearOrder Ξ±] (f : Perm Ξ±) : { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := swapFactorsAux ((@univ Ξ± _).sort (Β· ≀ Β·)) f fun {_ _} => (mem_sort _).2 (mem_univ _) #align equiv.perm.swap_factors Equiv.Perm.swapFactors def truncSwapFactors [Fintype Ξ±] (f : Perm Ξ±) : Trunc { l : List (Perm Ξ±) // l.prod = f ∧ βˆ€ g ∈ l, IsSwap g } := Quotient.recOnSubsingleton (@univ Ξ± _).1 (fun l h => Trunc.mk (swapFactorsAux l f (h _))) (show βˆ€ x, f x β‰  x β†’ x ∈ (@univ Ξ± _).1 from fun _ _ => mem_univ _) #align equiv.perm.trunc_swap_factors Equiv.Perm.truncSwapFactors @[elab_as_elim] theorem swap_induction_on [Finite Ξ±] {P : Perm Ξ± β†’ Prop} (f : Perm Ξ±) : P 1 β†’ (βˆ€ f x y, x β‰  y β†’ P f β†’ P (swap x y * f)) β†’ P f := by cases nonempty_fintype Ξ± cases' (truncSwapFactors f).out with l hl induction' l with g l ih generalizing f Β· simp (config := { contextual := true }) only [hl.left.symm, List.prod_nil, forall_true_iff] Β· intro h1 hmul_swap rcases hl.2 g (by simp) with ⟨x, y, hxy⟩ rw [← hl.1, List.prod_cons, hxy.2] exact hmul_swap _ _ _ hxy.1 (ih _ ⟨rfl, fun v hv => hl.2 _ (List.mem_cons_of_mem _ hv)⟩ h1 hmul_swap) #align equiv.perm.swap_induction_on Equiv.Perm.swap_induction_on
Mathlib/GroupTheory/Perm/Sign.lean
113
118
theorem closure_isSwap [Finite Ξ±] : Subgroup.closure { Οƒ : Perm Ξ± | IsSwap Οƒ } = ⊀ := by
cases nonempty_fintype Ξ± refine eq_top_iff.mpr fun x _ => ?_ obtain ⟨h1, h2⟩ := Subtype.mem (truncSwapFactors x).out rw [← h1] exact Subgroup.list_prod_mem _ fun y hy => Subgroup.subset_closure (h2 y hy)
1,234
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp]
Mathlib/Logic/Equiv/Fintype.lean
50
51
theorem Function.Embedding.toEquivRange_symm_apply_self (a : α) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by
simp [Equiv.symm_apply_eq]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : Ξ±) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self
Mathlib/Logic/Equiv/Fintype.lean
54
57
theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by
ext simp
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : Ξ±) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by ext simp #align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm Ξ² := e.extendDomain f.toEquivRange #align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding @[simp]
Mathlib/Logic/Equiv/Fintype.lean
72
75
theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : Ξ±) : e.viaFintypeEmbedding f (f a) = f (e a) := by
rw [Equiv.Perm.viaFintypeEmbedding] convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : Ξ±) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by ext simp #align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm Ξ² := e.extendDomain f.toEquivRange #align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding @[simp] theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : Ξ±) : e.viaFintypeEmbedding f (f a) = f (e a) := by rw [Equiv.Perm.viaFintypeEmbedding] convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a #align equiv.perm.via_fintype_embedding_apply_image Equiv.Perm.viaFintypeEmbedding_apply_image
Mathlib/Logic/Equiv/Fintype.lean
78
82
theorem Equiv.Perm.viaFintypeEmbedding_apply_mem_range {b : β} (h : b ∈ Set.range f) : e.viaFintypeEmbedding f b = f (e (f.invOfMemRange ⟨b, h⟩)) := by
simp only [viaFintypeEmbedding, Function.Embedding.invOfMemRange] rw [Equiv.Perm.extendDomain_apply_subtype] congr
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : Ξ±) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by ext simp #align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm Ξ² := e.extendDomain f.toEquivRange #align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding @[simp] theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : Ξ±) : e.viaFintypeEmbedding f (f a) = f (e a) := by rw [Equiv.Perm.viaFintypeEmbedding] convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a #align equiv.perm.via_fintype_embedding_apply_image Equiv.Perm.viaFintypeEmbedding_apply_image theorem Equiv.Perm.viaFintypeEmbedding_apply_mem_range {b : Ξ²} (h : b ∈ Set.range f) : e.viaFintypeEmbedding f b = f (e (f.invOfMemRange ⟨b, h⟩)) := by simp only [viaFintypeEmbedding, Function.Embedding.invOfMemRange] rw [Equiv.Perm.extendDomain_apply_subtype] congr #align equiv.perm.via_fintype_embedding_apply_mem_range Equiv.Perm.viaFintypeEmbedding_apply_mem_range
Mathlib/Logic/Equiv/Fintype.lean
85
87
theorem Equiv.Perm.viaFintypeEmbedding_apply_not_mem_range {b : Ξ²} (h : b βˆ‰ Set.range f) : e.viaFintypeEmbedding f b = b := by
rwa [Equiv.Perm.viaFintypeEmbedding, Equiv.Perm.extendDomain_apply_not_subtype]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {Ξ± Ξ² : Type*} [Fintype Ξ±] [DecidableEq Ξ²] (e : Equiv.Perm Ξ±) (f : Ξ± β†ͺ Ξ²) def Function.Embedding.toEquivRange : Ξ± ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : Ξ±) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : Ξ±) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by ext simp #align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm Ξ² := e.extendDomain f.toEquivRange #align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding @[simp] theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : Ξ±) : e.viaFintypeEmbedding f (f a) = f (e a) := by rw [Equiv.Perm.viaFintypeEmbedding] convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a #align equiv.perm.via_fintype_embedding_apply_image Equiv.Perm.viaFintypeEmbedding_apply_image theorem Equiv.Perm.viaFintypeEmbedding_apply_mem_range {b : Ξ²} (h : b ∈ Set.range f) : e.viaFintypeEmbedding f b = f (e (f.invOfMemRange ⟨b, h⟩)) := by simp only [viaFintypeEmbedding, Function.Embedding.invOfMemRange] rw [Equiv.Perm.extendDomain_apply_subtype] congr #align equiv.perm.via_fintype_embedding_apply_mem_range Equiv.Perm.viaFintypeEmbedding_apply_mem_range theorem Equiv.Perm.viaFintypeEmbedding_apply_not_mem_range {b : Ξ²} (h : b βˆ‰ Set.range f) : e.viaFintypeEmbedding f b = b := by rwa [Equiv.Perm.viaFintypeEmbedding, Equiv.Perm.extendDomain_apply_not_subtype] #align equiv.perm.via_fintype_embedding_apply_not_mem_range Equiv.Perm.viaFintypeEmbedding_apply_not_mem_range @[simp]
Mathlib/Logic/Equiv/Fintype.lean
91
93
theorem Equiv.Perm.viaFintypeEmbedding_sign [DecidableEq Ξ±] [Fintype Ξ²] : Equiv.Perm.sign (e.viaFintypeEmbedding f) = Equiv.Perm.sign e := by
simp [Equiv.Perm.viaFintypeEmbedding]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" namespace Equiv variable {Ξ± Ξ² : Type*} [Finite Ξ±] noncomputable def toCompl {p q : Ξ± β†’ Prop} (e : { x // p x } ≃ { x // q x }) : { x // Β¬p x } ≃ { x // Β¬q x } := by apply Classical.choice cases nonempty_fintype Ξ± classical exact Fintype.card_eq.mp <| Fintype.card_compl_eq_card_compl _ _ <| Fintype.card_congr e #align equiv.to_compl Equiv.toCompl variable {p q : Ξ± β†’ Prop} [DecidablePred p] [DecidablePred q] noncomputable abbrev extendSubtype (e : { x // p x } ≃ { x // q x }) : Perm Ξ± := subtypeCongr e e.toCompl #align equiv.extend_subtype Equiv.extendSubtype
Mathlib/Logic/Equiv/Fintype.lean
125
129
theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : e.extendSubtype x = e ⟨x, hx⟩ := by
dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" namespace Equiv variable {Ξ± Ξ² : Type*} [Finite Ξ±] noncomputable def toCompl {p q : Ξ± β†’ Prop} (e : { x // p x } ≃ { x // q x }) : { x // Β¬p x } ≃ { x // Β¬q x } := by apply Classical.choice cases nonempty_fintype Ξ± classical exact Fintype.card_eq.mp <| Fintype.card_compl_eq_card_compl _ _ <| Fintype.card_congr e #align equiv.to_compl Equiv.toCompl variable {p q : Ξ± β†’ Prop} [DecidablePred p] [DecidablePred q] noncomputable abbrev extendSubtype (e : { x // p x } ≃ { x // q x }) : Perm Ξ± := subtypeCongr e e.toCompl #align equiv.extend_subtype Equiv.extendSubtype theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : e.extendSubtype x = e ⟨x, hx⟩ := by dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl] #align equiv.extend_subtype_apply_of_mem Equiv.extendSubtype_apply_of_mem
Mathlib/Logic/Equiv/Fintype.lean
132
135
theorem extendSubtype_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : q (e.extendSubtype x) := by
convert (e ⟨x, hx⟩).2 rw [e.extendSubtype_apply_of_mem _ hx]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" namespace Equiv variable {Ξ± Ξ² : Type*} [Finite Ξ±] noncomputable def toCompl {p q : Ξ± β†’ Prop} (e : { x // p x } ≃ { x // q x }) : { x // Β¬p x } ≃ { x // Β¬q x } := by apply Classical.choice cases nonempty_fintype Ξ± classical exact Fintype.card_eq.mp <| Fintype.card_compl_eq_card_compl _ _ <| Fintype.card_congr e #align equiv.to_compl Equiv.toCompl variable {p q : Ξ± β†’ Prop} [DecidablePred p] [DecidablePred q] noncomputable abbrev extendSubtype (e : { x // p x } ≃ { x // q x }) : Perm Ξ± := subtypeCongr e e.toCompl #align equiv.extend_subtype Equiv.extendSubtype theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : e.extendSubtype x = e ⟨x, hx⟩ := by dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl] #align equiv.extend_subtype_apply_of_mem Equiv.extendSubtype_apply_of_mem theorem extendSubtype_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : q (e.extendSubtype x) := by convert (e ⟨x, hx⟩).2 rw [e.extendSubtype_apply_of_mem _ hx] #align equiv.extend_subtype_mem Equiv.extendSubtype_mem
Mathlib/Logic/Equiv/Fintype.lean
138
142
theorem extendSubtype_apply_of_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : Β¬p x) : e.extendSubtype x = e.toCompl ⟨x, hx⟩ := by
dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_neg _ _ hx, Sum.map_inr, sumCompl_apply_inr]
1,235
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" namespace Equiv variable {Ξ± Ξ² : Type*} [Finite Ξ±] noncomputable def toCompl {p q : Ξ± β†’ Prop} (e : { x // p x } ≃ { x // q x }) : { x // Β¬p x } ≃ { x // Β¬q x } := by apply Classical.choice cases nonempty_fintype Ξ± classical exact Fintype.card_eq.mp <| Fintype.card_compl_eq_card_compl _ _ <| Fintype.card_congr e #align equiv.to_compl Equiv.toCompl variable {p q : Ξ± β†’ Prop} [DecidablePred p] [DecidablePred q] noncomputable abbrev extendSubtype (e : { x // p x } ≃ { x // q x }) : Perm Ξ± := subtypeCongr e e.toCompl #align equiv.extend_subtype Equiv.extendSubtype theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : e.extendSubtype x = e ⟨x, hx⟩ := by dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl] #align equiv.extend_subtype_apply_of_mem Equiv.extendSubtype_apply_of_mem theorem extendSubtype_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : q (e.extendSubtype x) := by convert (e ⟨x, hx⟩).2 rw [e.extendSubtype_apply_of_mem _ hx] #align equiv.extend_subtype_mem Equiv.extendSubtype_mem theorem extendSubtype_apply_of_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : Β¬p x) : e.extendSubtype x = e.toCompl ⟨x, hx⟩ := by dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_neg _ _ hx, Sum.map_inr, sumCompl_apply_inr] #align equiv.extend_subtype_apply_of_not_mem Equiv.extendSubtype_apply_of_not_mem
Mathlib/Logic/Equiv/Fintype.lean
145
148
theorem extendSubtype_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : Β¬p x) : Β¬q (e.extendSubtype x) := by
convert (e.toCompl ⟨x, hx⟩).2 rw [e.extendSubtype_apply_of_not_mem _ hx]
1,235
import Mathlib.Algebra.Algebra.Defs import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Fintype.Sort import Mathlib.Data.List.FinRange import Mathlib.LinearAlgebra.Pi import Mathlib.Logic.Equiv.Fintype #align_import linear_algebra.multilinear.basic from "leanprover-community/mathlib"@"78fdf68dcd2fdb3fe64c0dd6f88926a49418a6ea" open Function Fin Set universe uR uS uΞΉ v v' v₁ vβ‚‚ v₃ variable {R : Type uR} {S : Type uS} {ΞΉ : Type uΞΉ} {n : β„•} {M : Fin n.succ β†’ Type v} {M₁ : ΞΉ β†’ Type v₁} {Mβ‚‚ : Type vβ‚‚} {M₃ : Type v₃} {M' : Type v'} structure MultilinearMap (R : Type uR) {ΞΉ : Type uΞΉ} (M₁ : ΞΉ β†’ Type v₁) (Mβ‚‚ : Type vβ‚‚) [Semiring R] [βˆ€ i, AddCommMonoid (M₁ i)] [AddCommMonoid Mβ‚‚] [βˆ€ i, Module R (M₁ i)] [Module R Mβ‚‚] where toFun : (βˆ€ i, M₁ i) β†’ Mβ‚‚ map_add' : βˆ€ [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (x y : M₁ i), toFun (update m i (x + y)) = toFun (update m i x) + toFun (update m i y) map_smul' : βˆ€ [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (c : R) (x : M₁ i), toFun (update m i (c β€’ x)) = c β€’ toFun (update m i x) #align multilinear_map MultilinearMap -- Porting note: added to avoid a linter timeout. attribute [nolint simpNF] MultilinearMap.mk.injEq namespace MultilinearMap section Semiring variable [Semiring R] [βˆ€ i, AddCommMonoid (M i)] [βˆ€ i, AddCommMonoid (M₁ i)] [AddCommMonoid Mβ‚‚] [AddCommMonoid M₃] [AddCommMonoid M'] [βˆ€ i, Module R (M i)] [βˆ€ i, Module R (M₁ i)] [Module R Mβ‚‚] [Module R M₃] [Module R M'] (f f' : MultilinearMap R M₁ Mβ‚‚) -- Porting note: Replaced CoeFun with FunLike instance instance : FunLike (MultilinearMap R M₁ Mβ‚‚) (βˆ€ i, M₁ i) Mβ‚‚ where coe f := f.toFun coe_injective' := fun f g h ↦ by cases f; cases g; cases h; rfl initialize_simps_projections MultilinearMap (toFun β†’ apply) @[simp] theorem toFun_eq_coe : f.toFun = ⇑f := rfl #align multilinear_map.to_fun_eq_coe MultilinearMap.toFun_eq_coe @[simp] theorem coe_mk (f : (βˆ€ i, M₁ i) β†’ Mβ‚‚) (h₁ hβ‚‚) : ⇑(⟨f, h₁, hβ‚‚βŸ© : MultilinearMap R M₁ Mβ‚‚) = f := rfl #align multilinear_map.coe_mk MultilinearMap.coe_mk theorem congr_fun {f g : MultilinearMap R M₁ Mβ‚‚} (h : f = g) (x : βˆ€ i, M₁ i) : f x = g x := DFunLike.congr_fun h x #align multilinear_map.congr_fun MultilinearMap.congr_fun nonrec theorem congr_arg (f : MultilinearMap R M₁ Mβ‚‚) {x y : βˆ€ i, M₁ i} (h : x = y) : f x = f y := DFunLike.congr_arg f h #align multilinear_map.congr_arg MultilinearMap.congr_arg theorem coe_injective : Injective ((↑) : MultilinearMap R M₁ Mβ‚‚ β†’ (βˆ€ i, M₁ i) β†’ Mβ‚‚) := DFunLike.coe_injective #align multilinear_map.coe_injective MultilinearMap.coe_injective @[norm_cast] -- Porting note (#10618): Removed simp attribute, simp can prove this theorem coe_inj {f g : MultilinearMap R M₁ Mβ‚‚} : (f : (βˆ€ i, M₁ i) β†’ Mβ‚‚) = g ↔ f = g := DFunLike.coe_fn_eq #align multilinear_map.coe_inj MultilinearMap.coe_inj @[ext] theorem ext {f f' : MultilinearMap R M₁ Mβ‚‚} (H : βˆ€ x, f x = f' x) : f = f' := DFunLike.ext _ _ H #align multilinear_map.ext MultilinearMap.ext theorem ext_iff {f g : MultilinearMap R M₁ Mβ‚‚} : f = g ↔ βˆ€ x, f x = g x := DFunLike.ext_iff #align multilinear_map.ext_iff MultilinearMap.ext_iff @[simp] theorem mk_coe (f : MultilinearMap R M₁ Mβ‚‚) (h₁ hβ‚‚) : (⟨f, h₁, hβ‚‚βŸ© : MultilinearMap R M₁ Mβ‚‚) = f := rfl #align multilinear_map.mk_coe MultilinearMap.mk_coe @[simp] protected theorem map_add [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (x y : M₁ i) : f (update m i (x + y)) = f (update m i x) + f (update m i y) := f.map_add' m i x y #align multilinear_map.map_add MultilinearMap.map_add @[simp] protected theorem map_smul [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (c : R) (x : M₁ i) : f (update m i (c β€’ x)) = c β€’ f (update m i x) := f.map_smul' m i c x #align multilinear_map.map_smul MultilinearMap.map_smul
Mathlib/LinearAlgebra/Multilinear/Basic.lean
171
174
theorem map_coord_zero {m : βˆ€ i, M₁ i} (i : ΞΉ) (h : m i = 0) : f m = 0 := by
classical have : (0 : R) β€’ (0 : M₁ i) = 0 := by simp rw [← update_eq_self i m, h, ← this, f.map_smul, zero_smul R (M := Mβ‚‚)]
1,236
import Mathlib.Algebra.Algebra.Defs import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Fintype.Sort import Mathlib.Data.List.FinRange import Mathlib.LinearAlgebra.Pi import Mathlib.Logic.Equiv.Fintype #align_import linear_algebra.multilinear.basic from "leanprover-community/mathlib"@"78fdf68dcd2fdb3fe64c0dd6f88926a49418a6ea" open Function Fin Set universe uR uS uΞΉ v v' v₁ vβ‚‚ v₃ variable {R : Type uR} {S : Type uS} {ΞΉ : Type uΞΉ} {n : β„•} {M : Fin n.succ β†’ Type v} {M₁ : ΞΉ β†’ Type v₁} {Mβ‚‚ : Type vβ‚‚} {M₃ : Type v₃} {M' : Type v'} structure MultilinearMap (R : Type uR) {ΞΉ : Type uΞΉ} (M₁ : ΞΉ β†’ Type v₁) (Mβ‚‚ : Type vβ‚‚) [Semiring R] [βˆ€ i, AddCommMonoid (M₁ i)] [AddCommMonoid Mβ‚‚] [βˆ€ i, Module R (M₁ i)] [Module R Mβ‚‚] where toFun : (βˆ€ i, M₁ i) β†’ Mβ‚‚ map_add' : βˆ€ [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (x y : M₁ i), toFun (update m i (x + y)) = toFun (update m i x) + toFun (update m i y) map_smul' : βˆ€ [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (c : R) (x : M₁ i), toFun (update m i (c β€’ x)) = c β€’ toFun (update m i x) #align multilinear_map MultilinearMap -- Porting note: added to avoid a linter timeout. attribute [nolint simpNF] MultilinearMap.mk.injEq namespace MultilinearMap section Semiring variable [Semiring R] [βˆ€ i, AddCommMonoid (M i)] [βˆ€ i, AddCommMonoid (M₁ i)] [AddCommMonoid Mβ‚‚] [AddCommMonoid M₃] [AddCommMonoid M'] [βˆ€ i, Module R (M i)] [βˆ€ i, Module R (M₁ i)] [Module R Mβ‚‚] [Module R M₃] [Module R M'] (f f' : MultilinearMap R M₁ Mβ‚‚) -- Porting note: Replaced CoeFun with FunLike instance instance : FunLike (MultilinearMap R M₁ Mβ‚‚) (βˆ€ i, M₁ i) Mβ‚‚ where coe f := f.toFun coe_injective' := fun f g h ↦ by cases f; cases g; cases h; rfl initialize_simps_projections MultilinearMap (toFun β†’ apply) @[simp] theorem toFun_eq_coe : f.toFun = ⇑f := rfl #align multilinear_map.to_fun_eq_coe MultilinearMap.toFun_eq_coe @[simp] theorem coe_mk (f : (βˆ€ i, M₁ i) β†’ Mβ‚‚) (h₁ hβ‚‚) : ⇑(⟨f, h₁, hβ‚‚βŸ© : MultilinearMap R M₁ Mβ‚‚) = f := rfl #align multilinear_map.coe_mk MultilinearMap.coe_mk theorem congr_fun {f g : MultilinearMap R M₁ Mβ‚‚} (h : f = g) (x : βˆ€ i, M₁ i) : f x = g x := DFunLike.congr_fun h x #align multilinear_map.congr_fun MultilinearMap.congr_fun nonrec theorem congr_arg (f : MultilinearMap R M₁ Mβ‚‚) {x y : βˆ€ i, M₁ i} (h : x = y) : f x = f y := DFunLike.congr_arg f h #align multilinear_map.congr_arg MultilinearMap.congr_arg theorem coe_injective : Injective ((↑) : MultilinearMap R M₁ Mβ‚‚ β†’ (βˆ€ i, M₁ i) β†’ Mβ‚‚) := DFunLike.coe_injective #align multilinear_map.coe_injective MultilinearMap.coe_injective @[norm_cast] -- Porting note (#10618): Removed simp attribute, simp can prove this theorem coe_inj {f g : MultilinearMap R M₁ Mβ‚‚} : (f : (βˆ€ i, M₁ i) β†’ Mβ‚‚) = g ↔ f = g := DFunLike.coe_fn_eq #align multilinear_map.coe_inj MultilinearMap.coe_inj @[ext] theorem ext {f f' : MultilinearMap R M₁ Mβ‚‚} (H : βˆ€ x, f x = f' x) : f = f' := DFunLike.ext _ _ H #align multilinear_map.ext MultilinearMap.ext theorem ext_iff {f g : MultilinearMap R M₁ Mβ‚‚} : f = g ↔ βˆ€ x, f x = g x := DFunLike.ext_iff #align multilinear_map.ext_iff MultilinearMap.ext_iff @[simp] theorem mk_coe (f : MultilinearMap R M₁ Mβ‚‚) (h₁ hβ‚‚) : (⟨f, h₁, hβ‚‚βŸ© : MultilinearMap R M₁ Mβ‚‚) = f := rfl #align multilinear_map.mk_coe MultilinearMap.mk_coe @[simp] protected theorem map_add [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (x y : M₁ i) : f (update m i (x + y)) = f (update m i x) + f (update m i y) := f.map_add' m i x y #align multilinear_map.map_add MultilinearMap.map_add @[simp] protected theorem map_smul [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) (c : R) (x : M₁ i) : f (update m i (c β€’ x)) = c β€’ f (update m i x) := f.map_smul' m i c x #align multilinear_map.map_smul MultilinearMap.map_smul theorem map_coord_zero {m : βˆ€ i, M₁ i} (i : ΞΉ) (h : m i = 0) : f m = 0 := by classical have : (0 : R) β€’ (0 : M₁ i) = 0 := by simp rw [← update_eq_self i m, h, ← this, f.map_smul, zero_smul R (M := Mβ‚‚)] #align multilinear_map.map_coord_zero MultilinearMap.map_coord_zero @[simp] theorem map_update_zero [DecidableEq ΞΉ] (m : βˆ€ i, M₁ i) (i : ΞΉ) : f (update m i 0) = 0 := f.map_coord_zero i (update_same i 0 m) #align multilinear_map.map_update_zero MultilinearMap.map_update_zero @[simp]
Mathlib/LinearAlgebra/Multilinear/Basic.lean
183
185
theorem map_zero [Nonempty ΞΉ] : f 0 = 0 := by
obtain ⟨i, _⟩ : βˆƒ i : ΞΉ, i ∈ Set.univ := Set.exists_mem_of_nonempty ΞΉ exact map_coord_zero f i rfl
1,236
import Mathlib.Topology.Algebra.Module.Basic import Mathlib.LinearAlgebra.Multilinear.Basic #align_import topology.algebra.module.multilinear from "leanprover-community/mathlib"@"f40476639bac089693a489c9e354ebd75dc0f886" open Function Fin Set universe u v w w₁ w₁' wβ‚‚ w₃ wβ‚„ variable {R : Type u} {ΞΉ : Type v} {n : β„•} {M : Fin n.succ β†’ Type w} {M₁ : ΞΉ β†’ Type w₁} {M₁' : ΞΉ β†’ Type w₁'} {Mβ‚‚ : Type wβ‚‚} {M₃ : Type w₃} {Mβ‚„ : Type wβ‚„} structure ContinuousMultilinearMap (R : Type u) {ΞΉ : Type v} (M₁ : ΞΉ β†’ Type w₁) (Mβ‚‚ : Type wβ‚‚) [Semiring R] [βˆ€ i, AddCommMonoid (M₁ i)] [AddCommMonoid Mβ‚‚] [βˆ€ i, Module R (M₁ i)] [Module R Mβ‚‚] [βˆ€ i, TopologicalSpace (M₁ i)] [TopologicalSpace Mβ‚‚] extends MultilinearMap R M₁ Mβ‚‚ where cont : Continuous toFun #align continuous_multilinear_map ContinuousMultilinearMap attribute [inherit_doc ContinuousMultilinearMap] ContinuousMultilinearMap.cont @[inherit_doc] notation:25 M "[Γ—" n "]β†’L[" R "] " M' => ContinuousMultilinearMap R (fun i : Fin n => M) M' namespace ContinuousMultilinearMap section Semiring variable [Semiring R] [βˆ€ i, AddCommMonoid (M i)] [βˆ€ i, AddCommMonoid (M₁ i)] [βˆ€ i, AddCommMonoid (M₁' i)] [AddCommMonoid Mβ‚‚] [AddCommMonoid M₃] [AddCommMonoid Mβ‚„] [βˆ€ i, Module R (M i)] [βˆ€ i, Module R (M₁ i)] [βˆ€ i, Module R (M₁' i)] [Module R Mβ‚‚] [Module R M₃] [Module R Mβ‚„] [βˆ€ i, TopologicalSpace (M i)] [βˆ€ i, TopologicalSpace (M₁ i)] [βˆ€ i, TopologicalSpace (M₁' i)] [TopologicalSpace Mβ‚‚] [TopologicalSpace M₃] [TopologicalSpace Mβ‚„] (f f' : ContinuousMultilinearMap R M₁ Mβ‚‚) theorem toMultilinearMap_injective : Function.Injective (ContinuousMultilinearMap.toMultilinearMap : ContinuousMultilinearMap R M₁ Mβ‚‚ β†’ MultilinearMap R M₁ Mβ‚‚) | ⟨f, hf⟩, ⟨g, hg⟩, h => by subst h; rfl #align continuous_multilinear_map.to_multilinear_map_injective ContinuousMultilinearMap.toMultilinearMap_injective instance funLike : FunLike (ContinuousMultilinearMap R M₁ Mβ‚‚) (βˆ€ i, M₁ i) Mβ‚‚ where coe f := f.toFun coe_injective' _ _ h := toMultilinearMap_injective <| MultilinearMap.coe_injective h instance continuousMapClass : ContinuousMapClass (ContinuousMultilinearMap R M₁ Mβ‚‚) (βˆ€ i, M₁ i) Mβ‚‚ where map_continuous := ContinuousMultilinearMap.cont #align continuous_multilinear_map.continuous_map_class ContinuousMultilinearMap.continuousMapClass instance : CoeFun (ContinuousMultilinearMap R M₁ Mβ‚‚) fun _ => (βˆ€ i, M₁ i) β†’ Mβ‚‚ := ⟨fun f => f⟩ def Simps.apply (L₁ : ContinuousMultilinearMap R M₁ Mβ‚‚) (v : βˆ€ i, M₁ i) : Mβ‚‚ := L₁ v #align continuous_multilinear_map.simps.apply ContinuousMultilinearMap.Simps.apply initialize_simps_projections ContinuousMultilinearMap (-toMultilinearMap, toMultilinearMap_toFun β†’ apply) @[continuity] theorem coe_continuous : Continuous (f : (βˆ€ i, M₁ i) β†’ Mβ‚‚) := f.cont #align continuous_multilinear_map.coe_continuous ContinuousMultilinearMap.coe_continuous @[simp] theorem coe_coe : (f.toMultilinearMap : (βˆ€ i, M₁ i) β†’ Mβ‚‚) = f := rfl #align continuous_multilinear_map.coe_coe ContinuousMultilinearMap.coe_coe @[ext] theorem ext {f f' : ContinuousMultilinearMap R M₁ Mβ‚‚} (H : βˆ€ x, f x = f' x) : f = f' := DFunLike.ext _ _ H #align continuous_multilinear_map.ext ContinuousMultilinearMap.ext
Mathlib/Topology/Algebra/Module/Multilinear/Basic.lean
113
114
theorem ext_iff {f f' : ContinuousMultilinearMap R M₁ Mβ‚‚} : f = f' ↔ βˆ€ x, f x = f' x := by
rw [← toMultilinearMap_injective.eq_iff, MultilinearMap.ext_iff]; rfl
1,237
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm section Conjugation variable [DecidableEq Ξ±] [Fintype Ξ±] {Οƒ Ο„ : Perm Ξ±}
Mathlib/GroupTheory/Perm/Finite.lean
37
50
theorem isConj_of_support_equiv (f : { x // x ∈ (Οƒ.support : Set Ξ±) } ≃ { x // x ∈ (Ο„.support : Set Ξ±) }) (hf : βˆ€ (x : Ξ±) (hx : x ∈ (Οƒ.support : Set Ξ±)), (f βŸ¨Οƒ x, apply_mem_support.2 hx⟩ : Ξ±) = Ο„ ↑(f ⟨x, hx⟩)) : IsConj Οƒ Ο„ := by
refine isConj_iff.2 ⟨Equiv.extendSubtype f, ?_⟩ rw [mul_inv_eq_iff_eq_mul] ext x simp only [Perm.mul_apply] by_cases hx : x ∈ Οƒ.support Β· rw [Equiv.extendSubtype_apply_of_mem, Equiv.extendSubtype_apply_of_mem] Β· exact hf x (Finset.mem_coe.2 hx) Β· rwa [Classical.not_not.1 ((not_congr mem_support).1 (Equiv.extendSubtype_not_mem f _ _)), Classical.not_not.1 ((not_congr mem_support).mp hx)]
1,238
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm
Mathlib/GroupTheory/Perm/Finite.lean
57
65
theorem perm_inv_on_of_perm_on_finset {s : Finset Ξ±} {f : Perm Ξ±} (h : βˆ€ x ∈ s, f x ∈ s) {y : Ξ±} (hy : y ∈ s) : f⁻¹ y ∈ s := by
have h0 : βˆ€ y ∈ s, βˆƒ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ aβ‚‚ ha₁ haβ‚‚ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self]
1,238
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset Ξ±} {f : Perm Ξ±} (h : βˆ€ x ∈ s, f x ∈ s) {y : Ξ±} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : βˆ€ y ∈ s, βˆƒ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ aβ‚‚ ha₁ haβ‚‚ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset
Mathlib/GroupTheory/Perm/Finite.lean
68
75
theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by
cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx)
1,238
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset Ξ±} {f : Perm Ξ±} (h : βˆ€ x ∈ s, f x ∈ s) {y : Ξ±} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : βˆ€ y ∈ s, βˆƒ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ aβ‚‚ ha₁ haβ‚‚ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset theorem perm_inv_mapsTo_of_mapsTo (f : Perm Ξ±) {s : Set Ξ±} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx) #align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo @[simp] theorem perm_inv_mapsTo_iff_mapsTo {f : Perm Ξ±} {s : Set Ξ±} [Finite s] : Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s := ⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩ #align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo theorem perm_inv_on_of_perm_on_finite {f : Perm Ξ±} {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) {x : Ξ±} (hx : p x) : p (f⁻¹ x) := -- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their -- underlying predicate. have : Finite { x | p x } := β€Ή_β€Ί perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx #align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite abbrev subtypePermOfFintype (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) : Perm { x // p x } := f.subtypePerm fun x => ⟨h x, fun hβ‚‚ => f.inv_apply_self x β–Έ perm_inv_on_of_perm_on_finite h hβ‚‚βŸ© #align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype @[simp] theorem subtypePermOfFintype_apply (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ := rfl #align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply theorem subtypePermOfFintype_one (p : Ξ± β†’ Prop) [Finite { x // p x }] (h : βˆ€ x, p x β†’ p ((1 : Perm Ξ±) x)) : @subtypePermOfFintype Ξ± 1 p _ h = 1 := rfl #align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one
Mathlib/GroupTheory/Perm/Finite.lean
111
129
theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (Οƒ : Perm (Sum m n)) : Set.MapsTo Οƒ (Set.range Sum.inl) (Set.range Sum.inl) ↔ Set.MapsTo Οƒ (Set.range Sum.inr) (Set.range Sum.inr) := by
constructor <;> ( intro h classical rw [← perm_inv_mapsTo_iff_mapsTo] at h intro x cases' hx : Οƒ x with l r) Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨l, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inl_ne_inr Β· rintro _; exact ⟨r, rfl⟩ Β· rintro _; exact ⟨l, rfl⟩ Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨r, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inr_ne_inl
1,238
import Mathlib.Data.Finset.Fin import Mathlib.Data.Int.Order.Units import Mathlib.GroupTheory.OrderOfElement import Mathlib.GroupTheory.Perm.Support import Mathlib.Logic.Equiv.Fintype #align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u v open Equiv Function Fintype Finset variable {Ξ± : Type u} {Ξ² : Type v} -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : β„€Λ£) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) namespace Equiv.Perm theorem perm_inv_on_of_perm_on_finset {s : Finset Ξ±} {f : Perm Ξ±} (h : βˆ€ x ∈ s, f x ∈ s) {y : Ξ±} (hy : y ∈ s) : f⁻¹ y ∈ s := by have h0 : βˆ€ y ∈ s, βˆƒ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx := Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha) (fun a₁ aβ‚‚ ha₁ haβ‚‚ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge obtain ⟨y2, hy2, heq⟩ := h0 y hy convert hy2 rw [heq] simp only [inv_apply_self] #align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset theorem perm_inv_mapsTo_of_mapsTo (f : Perm Ξ±) {s : Set Ξ±} [Finite s] (h : Set.MapsTo f s s) : Set.MapsTo (f⁻¹ : _) s s := by cases nonempty_fintype s exact fun x hx => Set.mem_toFinset.mp <| perm_inv_on_of_perm_on_finset (fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha))) (Set.mem_toFinset.mpr hx) #align equiv.perm.perm_inv_maps_to_of_maps_to Equiv.Perm.perm_inv_mapsTo_of_mapsTo @[simp] theorem perm_inv_mapsTo_iff_mapsTo {f : Perm Ξ±} {s : Set Ξ±} [Finite s] : Set.MapsTo (f⁻¹ : _) s s ↔ Set.MapsTo f s s := ⟨perm_inv_mapsTo_of_mapsTo f⁻¹, perm_inv_mapsTo_of_mapsTo f⟩ #align equiv.perm.perm_inv_maps_to_iff_maps_to Equiv.Perm.perm_inv_mapsTo_iff_mapsTo theorem perm_inv_on_of_perm_on_finite {f : Perm Ξ±} {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) {x : Ξ±} (hx : p x) : p (f⁻¹ x) := -- Porting note: relies heavily on the definitions of `Subtype` and `setOf` unfolding to their -- underlying predicate. have : Finite { x | p x } := β€Ή_β€Ί perm_inv_mapsTo_of_mapsTo (s := {x | p x}) f h hx #align equiv.perm.perm_inv_on_of_perm_on_finite Equiv.Perm.perm_inv_on_of_perm_on_finite abbrev subtypePermOfFintype (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) : Perm { x // p x } := f.subtypePerm fun x => ⟨h x, fun hβ‚‚ => f.inv_apply_self x β–Έ perm_inv_on_of_perm_on_finite h hβ‚‚βŸ© #align equiv.perm.subtype_perm_of_fintype Equiv.Perm.subtypePermOfFintype @[simp] theorem subtypePermOfFintype_apply (f : Perm Ξ±) {p : Ξ± β†’ Prop} [Finite { x // p x }] (h : βˆ€ x, p x β†’ p (f x)) (x : { x // p x }) : subtypePermOfFintype f h x = ⟨f x, h x x.2⟩ := rfl #align equiv.perm.subtype_perm_of_fintype_apply Equiv.Perm.subtypePermOfFintype_apply theorem subtypePermOfFintype_one (p : Ξ± β†’ Prop) [Finite { x // p x }] (h : βˆ€ x, p x β†’ p ((1 : Perm Ξ±) x)) : @subtypePermOfFintype Ξ± 1 p _ h = 1 := rfl #align equiv.perm.subtype_perm_of_fintype_one Equiv.Perm.subtypePermOfFintype_one theorem perm_mapsTo_inl_iff_mapsTo_inr {m n : Type*} [Finite m] [Finite n] (Οƒ : Perm (Sum m n)) : Set.MapsTo Οƒ (Set.range Sum.inl) (Set.range Sum.inl) ↔ Set.MapsTo Οƒ (Set.range Sum.inr) (Set.range Sum.inr) := by constructor <;> ( intro h classical rw [← perm_inv_mapsTo_iff_mapsTo] at h intro x cases' hx : Οƒ x with l r) Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨l, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inl_ne_inr Β· rintro _; exact ⟨r, rfl⟩ Β· rintro _; exact ⟨l, rfl⟩ Β· rintro ⟨a, rfl⟩ obtain ⟨y, hy⟩ := h ⟨r, rfl⟩ rw [← hx, Οƒ.inv_apply_self] at hy exact absurd hy Sum.inr_ne_inl #align equiv.perm.perm_maps_to_inl_iff_maps_to_inr Equiv.Perm.perm_mapsTo_inl_iff_mapsTo_inr
Mathlib/GroupTheory/Perm/Finite.lean
132
163
theorem mem_sumCongrHom_range_of_perm_mapsTo_inl {m n : Type*} [Finite m] [Finite n] {Οƒ : Perm (Sum m n)} (h : Set.MapsTo Οƒ (Set.range Sum.inl) (Set.range Sum.inl)) : Οƒ ∈ (sumCongrHom m n).range := by
classical have h1 : βˆ€ x : Sum m n, (βˆƒ a : m, Sum.inl a = x) β†’ βˆƒ a : m, Sum.inl a = Οƒ x := by rintro x ⟨a, ha⟩ apply h rw [← ha] exact ⟨a, rfl⟩ have h3 : βˆ€ x : Sum m n, (βˆƒ b : n, Sum.inr b = x) β†’ βˆƒ b : n, Sum.inr b = Οƒ x := by rintro x ⟨b, hb⟩ apply (perm_mapsTo_inl_iff_mapsTo_inr Οƒ).mp h rw [← hb] exact ⟨b, rfl⟩ let σ₁' := subtypePermOfFintype Οƒ h1 let Οƒβ‚‚' := subtypePermOfFintype Οƒ h3 let σ₁ := permCongr (Equiv.ofInjective _ Sum.inl_injective).symm σ₁' let Οƒβ‚‚ := permCongr (Equiv.ofInjective _ Sum.inr_injective).symm Οƒβ‚‚' rw [MonoidHom.mem_range, Prod.exists] use σ₁, Οƒβ‚‚ rw [Perm.sumCongrHom_apply] ext x cases' x with a b Β· rw [Equiv.sumCongr_apply, Sum.map_inl, permCongr_apply, Equiv.symm_symm, apply_ofInjective_symm Sum.inl_injective] rw [ofInjective_apply, Subtype.coe_mk, Subtype.coe_mk] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [subtypePerm_apply] Β· rw [Equiv.sumCongr_apply, Sum.map_inr, permCongr_apply, Equiv.symm_symm, apply_ofInjective_symm Sum.inr_injective] erw [subtypePerm_apply] rw [ofInjective_apply, Subtype.coe_mk, Subtype.coe_mk]
1,238
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
90
90
theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by
simp [SameCycle]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
107
108
theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by
simp [sameCycle_conj]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y β†’ (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
132
133
theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by
rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y β†’ (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp] theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm] #align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
137
138
theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by
rw [← sameCycle_apply_left, apply_inv_self]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y β†’ (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp] theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm] #align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right @[simp] theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by rw [← sameCycle_apply_left, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_left Equiv.Perm.sameCycle_inv_apply_left @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
142
143
theorem sameCycle_inv_apply_right : SameCycle f x (f⁻¹ y) ↔ SameCycle f x y := by
rw [← sameCycle_apply_right, apply_inv_self]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y β†’ (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp] theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm] #align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right @[simp] theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by rw [← sameCycle_apply_left, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_left Equiv.Perm.sameCycle_inv_apply_left @[simp] theorem sameCycle_inv_apply_right : SameCycle f x (f⁻¹ y) ↔ SameCycle f x y := by rw [← sameCycle_apply_right, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_right Equiv.Perm.sameCycle_inv_apply_right @[simp] theorem sameCycle_zpow_left {n : β„€} : SameCycle f ((f ^ n) x) y ↔ SameCycle f x y := (Equiv.addRight (n : β„€)).exists_congr_left.trans <| by simp [SameCycle, zpow_add] #align equiv.perm.same_cycle_zpow_left Equiv.Perm.sameCycle_zpow_left @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
152
153
theorem sameCycle_zpow_right {n : β„€} : SameCycle f x ((f ^ n) y) ↔ SameCycle f x y := by
rw [sameCycle_comm, sameCycle_zpow_left, sameCycle_comm]
1,239
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm Ξ±} {p : Ξ± β†’ Prop} {x y z : Ξ±} def SameCycle (f : Perm Ξ±) (x y : Ξ±) : Prop := βˆƒ i : β„€, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm Ξ±) (x : Ξ±) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm Ξ±) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y β†’ SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y β†’ SameCycle f y z β†’ SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm Ξ±) : Setoid Ξ± where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y β†’ SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y β†’ (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp] theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm] #align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right @[simp] theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by rw [← sameCycle_apply_left, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_left Equiv.Perm.sameCycle_inv_apply_left @[simp] theorem sameCycle_inv_apply_right : SameCycle f x (f⁻¹ y) ↔ SameCycle f x y := by rw [← sameCycle_apply_right, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_right Equiv.Perm.sameCycle_inv_apply_right @[simp] theorem sameCycle_zpow_left {n : β„€} : SameCycle f ((f ^ n) x) y ↔ SameCycle f x y := (Equiv.addRight (n : β„€)).exists_congr_left.trans <| by simp [SameCycle, zpow_add] #align equiv.perm.same_cycle_zpow_left Equiv.Perm.sameCycle_zpow_left @[simp] theorem sameCycle_zpow_right {n : β„€} : SameCycle f x ((f ^ n) y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_zpow_left, sameCycle_comm] #align equiv.perm.same_cycle_zpow_right Equiv.Perm.sameCycle_zpow_right @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
157
158
theorem sameCycle_pow_left {n : β„•} : SameCycle f ((f ^ n) x) y ↔ SameCycle f x y := by
rw [← zpow_natCast, sameCycle_zpow_left]
1,239
import Mathlib.GroupTheory.Perm.Cycle.Basic #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section Generation variable [Finite Ξ²] open Subgroup
Mathlib/GroupTheory/Perm/Closure.lean
37
41
theorem closure_isCycle : closure { Οƒ : Perm Ξ² | IsCycle Οƒ } = ⊀ := by
classical cases nonempty_fintype Ξ² exact top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle))
1,240
import Mathlib.GroupTheory.Perm.Cycle.Basic #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section Generation variable [Finite Ξ²] open Subgroup theorem closure_isCycle : closure { Οƒ : Perm Ξ² | IsCycle Οƒ } = ⊀ := by classical cases nonempty_fintype Ξ² exact top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle)) #align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle variable [DecidableEq Ξ±] [Fintype Ξ±]
Mathlib/GroupTheory/Perm/Closure.lean
46
93
theorem closure_cycle_adjacent_swap {Οƒ : Perm Ξ±} (h1 : IsCycle Οƒ) (h2 : Οƒ.support = ⊀) (x : Ξ±) : closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) = ⊀ := by
let H := closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) have h3 : Οƒ ∈ H := subset_closure (Set.mem_insert Οƒ _) have h4 : swap x (Οƒ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) have step1 : βˆ€ n : β„•, swap ((Οƒ ^ n) x) ((Οƒ ^ (n + 1) : Perm Ξ±) x) ∈ H := by intro n induction' n with n ih Β· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) Β· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3) simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ'] rfl have step2 : βˆ€ n : β„•, swap x ((Οƒ ^ n) x) ∈ H := by intro n induction' n with n ih Β· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff] convert H.one_mem Β· by_cases h5 : x = (Οƒ ^ n) x Β· rw [pow_succ', mul_apply, ← h5] exact h4 by_cases h6 : x = (Οƒ ^ (n + 1) : Perm Ξ±) x Β· rw [← h6, swap_self] exact H.one_mem rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6] exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n) have step3 : βˆ€ y : Ξ±, swap x y ∈ H := by intro y have hx : x ∈ (⊀ : Finset Ξ±) := Finset.mem_univ x rw [← h2, mem_support] at hx have hy : y ∈ (⊀ : Finset Ξ±) := Finset.mem_univ y rw [← h2, mem_support] at hy cases' IsCycle.exists_pow_eq h1 hx hy with n hn rw [← hn] exact step2 n have step4 : βˆ€ y z : Ξ±, swap y z ∈ H := by intro y z by_cases h5 : z = x Β· rw [h5, swap_comm] exact step3 y by_cases h6 : z = y Β· rw [h6, swap_self] exact H.one_mem rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x] exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y) rw [eq_top_iff, ← closure_isSwap, closure_le] rintro Ο„ ⟨y, z, _, h6⟩ rw [h6] exact step4 y z
1,240
import Mathlib.GroupTheory.Perm.Cycle.Basic #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section Generation variable [Finite Ξ²] open Subgroup theorem closure_isCycle : closure { Οƒ : Perm Ξ² | IsCycle Οƒ } = ⊀ := by classical cases nonempty_fintype Ξ² exact top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle)) #align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle variable [DecidableEq Ξ±] [Fintype Ξ±] theorem closure_cycle_adjacent_swap {Οƒ : Perm Ξ±} (h1 : IsCycle Οƒ) (h2 : Οƒ.support = ⊀) (x : Ξ±) : closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) = ⊀ := by let H := closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) have h3 : Οƒ ∈ H := subset_closure (Set.mem_insert Οƒ _) have h4 : swap x (Οƒ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) have step1 : βˆ€ n : β„•, swap ((Οƒ ^ n) x) ((Οƒ ^ (n + 1) : Perm Ξ±) x) ∈ H := by intro n induction' n with n ih Β· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) Β· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3) simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ'] rfl have step2 : βˆ€ n : β„•, swap x ((Οƒ ^ n) x) ∈ H := by intro n induction' n with n ih Β· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff] convert H.one_mem Β· by_cases h5 : x = (Οƒ ^ n) x Β· rw [pow_succ', mul_apply, ← h5] exact h4 by_cases h6 : x = (Οƒ ^ (n + 1) : Perm Ξ±) x Β· rw [← h6, swap_self] exact H.one_mem rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6] exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n) have step3 : βˆ€ y : Ξ±, swap x y ∈ H := by intro y have hx : x ∈ (⊀ : Finset Ξ±) := Finset.mem_univ x rw [← h2, mem_support] at hx have hy : y ∈ (⊀ : Finset Ξ±) := Finset.mem_univ y rw [← h2, mem_support] at hy cases' IsCycle.exists_pow_eq h1 hx hy with n hn rw [← hn] exact step2 n have step4 : βˆ€ y z : Ξ±, swap y z ∈ H := by intro y z by_cases h5 : z = x Β· rw [h5, swap_comm] exact step3 y by_cases h6 : z = y Β· rw [h6, swap_self] exact H.one_mem rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x] exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y) rw [eq_top_iff, ← closure_isSwap, closure_le] rintro Ο„ ⟨y, z, _, h6⟩ rw [h6] exact step4 y z #align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap
Mathlib/GroupTheory/Perm/Closure.lean
96
108
theorem closure_cycle_coprime_swap {n : β„•} {Οƒ : Perm Ξ±} (h0 : Nat.Coprime n (Fintype.card Ξ±)) (h1 : IsCycle Οƒ) (h2 : Οƒ.support = Finset.univ) (x : Ξ±) : closure ({Οƒ, swap x ((Οƒ ^ n) x)} : Set (Perm Ξ±)) = ⊀ := by
rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0 cases' exists_pow_eq_self_of_coprime h0 with m hm have h2' : (Οƒ ^ n).support = ⊀ := Eq.trans (support_pow_coprime h0) h2 have h1' : IsCycle ((Οƒ ^ n) ^ (m : β„€)) := by rwa [← hm] at h1 replace h1' : IsCycle (Οƒ ^ n) := h1'.of_pow (le_trans (support_pow_le Οƒ n) (ge_of_eq (congr_arg support hm))) rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff] exact ⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert Οƒ _)) n, Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩
1,240
import Mathlib.GroupTheory.Perm.Cycle.Basic #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ΞΉ Ξ± Ξ² : Type*} namespace Equiv.Perm section Generation variable [Finite Ξ²] open Subgroup theorem closure_isCycle : closure { Οƒ : Perm Ξ² | IsCycle Οƒ } = ⊀ := by classical cases nonempty_fintype Ξ² exact top_le_iff.mp (le_trans (ge_of_eq closure_isSwap) (closure_mono fun _ => IsSwap.isCycle)) #align equiv.perm.closure_is_cycle Equiv.Perm.closure_isCycle variable [DecidableEq Ξ±] [Fintype Ξ±] theorem closure_cycle_adjacent_swap {Οƒ : Perm Ξ±} (h1 : IsCycle Οƒ) (h2 : Οƒ.support = ⊀) (x : Ξ±) : closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) = ⊀ := by let H := closure ({Οƒ, swap x (Οƒ x)} : Set (Perm Ξ±)) have h3 : Οƒ ∈ H := subset_closure (Set.mem_insert Οƒ _) have h4 : swap x (Οƒ x) ∈ H := subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) have step1 : βˆ€ n : β„•, swap ((Οƒ ^ n) x) ((Οƒ ^ (n + 1) : Perm Ξ±) x) ∈ H := by intro n induction' n with n ih Β· exact subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)) Β· convert H.mul_mem (H.mul_mem h3 ih) (H.inv_mem h3) simp_rw [mul_swap_eq_swap_mul, mul_inv_cancel_right, pow_succ'] rfl have step2 : βˆ€ n : β„•, swap x ((Οƒ ^ n) x) ∈ H := by intro n induction' n with n ih Β· simp only [Nat.zero_eq, pow_zero, coe_one, id_eq, swap_self, Set.mem_singleton_iff] convert H.one_mem Β· by_cases h5 : x = (Οƒ ^ n) x Β· rw [pow_succ', mul_apply, ← h5] exact h4 by_cases h6 : x = (Οƒ ^ (n + 1) : Perm Ξ±) x Β· rw [← h6, swap_self] exact H.one_mem rw [swap_comm, ← swap_mul_swap_mul_swap h5 h6] exact H.mul_mem (H.mul_mem (step1 n) ih) (step1 n) have step3 : βˆ€ y : Ξ±, swap x y ∈ H := by intro y have hx : x ∈ (⊀ : Finset Ξ±) := Finset.mem_univ x rw [← h2, mem_support] at hx have hy : y ∈ (⊀ : Finset Ξ±) := Finset.mem_univ y rw [← h2, mem_support] at hy cases' IsCycle.exists_pow_eq h1 hx hy with n hn rw [← hn] exact step2 n have step4 : βˆ€ y z : Ξ±, swap y z ∈ H := by intro y z by_cases h5 : z = x Β· rw [h5, swap_comm] exact step3 y by_cases h6 : z = y Β· rw [h6, swap_self] exact H.one_mem rw [← swap_mul_swap_mul_swap h5 h6, swap_comm z x] exact H.mul_mem (H.mul_mem (step3 y) (step3 z)) (step3 y) rw [eq_top_iff, ← closure_isSwap, closure_le] rintro Ο„ ⟨y, z, _, h6⟩ rw [h6] exact step4 y z #align equiv.perm.closure_cycle_adjacent_swap Equiv.Perm.closure_cycle_adjacent_swap theorem closure_cycle_coprime_swap {n : β„•} {Οƒ : Perm Ξ±} (h0 : Nat.Coprime n (Fintype.card Ξ±)) (h1 : IsCycle Οƒ) (h2 : Οƒ.support = Finset.univ) (x : Ξ±) : closure ({Οƒ, swap x ((Οƒ ^ n) x)} : Set (Perm Ξ±)) = ⊀ := by rw [← Finset.card_univ, ← h2, ← h1.orderOf] at h0 cases' exists_pow_eq_self_of_coprime h0 with m hm have h2' : (Οƒ ^ n).support = ⊀ := Eq.trans (support_pow_coprime h0) h2 have h1' : IsCycle ((Οƒ ^ n) ^ (m : β„€)) := by rwa [← hm] at h1 replace h1' : IsCycle (Οƒ ^ n) := h1'.of_pow (le_trans (support_pow_le Οƒ n) (ge_of_eq (congr_arg support hm))) rw [eq_top_iff, ← closure_cycle_adjacent_swap h1' h2' x, closure_le, Set.insert_subset_iff] exact ⟨Subgroup.pow_mem (closure _) (subset_closure (Set.mem_insert Οƒ _)) n, Set.singleton_subset_iff.mpr (subset_closure (Set.mem_insert_of_mem _ (Set.mem_singleton _)))⟩ #align equiv.perm.closure_cycle_coprime_swap Equiv.Perm.closure_cycle_coprime_swap
Mathlib/GroupTheory/Perm/Closure.lean
111
122
theorem closure_prime_cycle_swap {Οƒ Ο„ : Perm Ξ±} (h0 : (Fintype.card Ξ±).Prime) (h1 : IsCycle Οƒ) (h2 : Οƒ.support = Finset.univ) (h3 : IsSwap Ο„) : closure ({Οƒ, Ο„} : Set (Perm Ξ±)) = ⊀ := by
obtain ⟨x, y, h4, h5⟩ := h3 obtain ⟨i, hi⟩ := h1.exists_pow_eq (mem_support.mp ((Finset.ext_iff.mp h2 x).mpr (Finset.mem_univ x))) (mem_support.mp ((Finset.ext_iff.mp h2 y).mpr (Finset.mem_univ y))) rw [h5, ← hi] refine closure_cycle_coprime_swap (Nat.Coprime.symm (h0.coprime_iff_not_dvd.mpr fun h => h4 ?_)) h1 h2 x cases' h with m hm rwa [hm, pow_mul, ← Finset.card_univ, ← h2, ← h1.orderOf, pow_orderOf_eq_one, one_pow, one_apply] at hi
1,240
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp]
Mathlib/GroupTheory/Perm/Option.lean
27
34
theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by
ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne]
1,241
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp]
Mathlib/GroupTheory/Perm/Option.lean
38
43
theorem Equiv.optionCongr_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign e.optionCongr = Perm.sign e := by
refine Perm.swap_induction_on e ?_ ?_ Β· simp [Perm.one_def] Β· intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans]
1,241
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp] theorem Equiv.optionCongr_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign e.optionCongr = Perm.sign e := by refine Perm.swap_induction_on e ?_ ?_ Β· simp [Perm.one_def] Β· intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans] #align equiv.option_congr_sign Equiv.optionCongr_sign @[simp]
Mathlib/GroupTheory/Perm/Option.lean
47
58
theorem map_equiv_removeNone {Ξ± : Type*} [DecidableEq Ξ±] (Οƒ : Perm (Option Ξ±)) : (removeNone Οƒ).optionCongr = swap none (Οƒ none) * Οƒ := by
ext1 x have : Option.map (⇑(removeNone Οƒ)) x = (swap none (Οƒ none)) (Οƒ x) := by cases' x with x Β· simp Β· cases h : Οƒ (some _) Β· simp [removeNone_none _ h] Β· have hn : Οƒ (some x) β‰  none := by simp [h] have hΟƒn : Οƒ (some x) β‰  Οƒ none := Οƒ.injective.ne (by simp) simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hΟƒn] simpa using this
1,241
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp] theorem Equiv.optionCongr_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign e.optionCongr = Perm.sign e := by refine Perm.swap_induction_on e ?_ ?_ Β· simp [Perm.one_def] Β· intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans] #align equiv.option_congr_sign Equiv.optionCongr_sign @[simp] theorem map_equiv_removeNone {Ξ± : Type*} [DecidableEq Ξ±] (Οƒ : Perm (Option Ξ±)) : (removeNone Οƒ).optionCongr = swap none (Οƒ none) * Οƒ := by ext1 x have : Option.map (⇑(removeNone Οƒ)) x = (swap none (Οƒ none)) (Οƒ x) := by cases' x with x Β· simp Β· cases h : Οƒ (some _) Β· simp [removeNone_none _ h] Β· have hn : Οƒ (some x) β‰  none := by simp [h] have hΟƒn : Οƒ (some x) β‰  Οƒ none := Οƒ.injective.ne (by simp) simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hΟƒn] simpa using this #align map_equiv_remove_none map_equiv_removeNone @[simps] def Equiv.Perm.decomposeOption {Ξ± : Type*} [DecidableEq Ξ±] : Perm (Option Ξ±) ≃ Option Ξ± Γ— Perm Ξ± where toFun Οƒ := (Οƒ none, removeNone Οƒ) invFun i := swap none i.1 * i.2.optionCongr left_inv Οƒ := by simp right_inv := fun ⟨x, ΟƒβŸ© => by have : removeNone (swap none x * Οƒ.optionCongr) = Οƒ := Equiv.optionCongr_injective (by simp [← mul_assoc]) simp [← Perm.eq_inv_iff_eq, this] #align equiv.perm.decompose_option Equiv.Perm.decomposeOption
Mathlib/GroupTheory/Perm/Option.lean
76
77
theorem Equiv.Perm.decomposeOption_symm_of_none_apply {Ξ± : Type*} [DecidableEq Ξ±] (e : Perm Ξ±) (i : Option Ξ±) : Equiv.Perm.decomposeOption.symm (none, e) i = i.map e := by
simp
1,241
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Perm import Mathlib.Data.Fintype.Prod import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Option #align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open Equiv @[simp] theorem Equiv.optionCongr_one {Ξ± : Type*} : (1 : Perm Ξ±).optionCongr = 1 := Equiv.optionCongr_refl #align equiv.option_congr_one Equiv.optionCongr_one @[simp] theorem Equiv.optionCongr_swap {Ξ± : Type*} [DecidableEq Ξ±] (x y : Ξ±) : optionCongr (swap x y) = swap (some x) (some y) := by ext (_ | i) Β· simp [swap_apply_of_ne_of_ne] Β· by_cases hx : i = x Β· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def, Option.some.injEq] by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne] #align equiv.option_congr_swap Equiv.optionCongr_swap @[simp] theorem Equiv.optionCongr_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign e.optionCongr = Perm.sign e := by refine Perm.swap_induction_on e ?_ ?_ Β· simp [Perm.one_def] Β· intro f x y hne h simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans] #align equiv.option_congr_sign Equiv.optionCongr_sign @[simp] theorem map_equiv_removeNone {Ξ± : Type*} [DecidableEq Ξ±] (Οƒ : Perm (Option Ξ±)) : (removeNone Οƒ).optionCongr = swap none (Οƒ none) * Οƒ := by ext1 x have : Option.map (⇑(removeNone Οƒ)) x = (swap none (Οƒ none)) (Οƒ x) := by cases' x with x Β· simp Β· cases h : Οƒ (some _) Β· simp [removeNone_none _ h] Β· have hn : Οƒ (some x) β‰  none := by simp [h] have hΟƒn : Οƒ (some x) β‰  Οƒ none := Οƒ.injective.ne (by simp) simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hΟƒn] simpa using this #align map_equiv_remove_none map_equiv_removeNone @[simps] def Equiv.Perm.decomposeOption {Ξ± : Type*} [DecidableEq Ξ±] : Perm (Option Ξ±) ≃ Option Ξ± Γ— Perm Ξ± where toFun Οƒ := (Οƒ none, removeNone Οƒ) invFun i := swap none i.1 * i.2.optionCongr left_inv Οƒ := by simp right_inv := fun ⟨x, ΟƒβŸ© => by have : removeNone (swap none x * Οƒ.optionCongr) = Οƒ := Equiv.optionCongr_injective (by simp [← mul_assoc]) simp [← Perm.eq_inv_iff_eq, this] #align equiv.perm.decompose_option Equiv.Perm.decomposeOption theorem Equiv.Perm.decomposeOption_symm_of_none_apply {Ξ± : Type*} [DecidableEq Ξ±] (e : Perm Ξ±) (i : Option Ξ±) : Equiv.Perm.decomposeOption.symm (none, e) i = i.map e := by simp #align equiv.perm.decompose_option_symm_of_none_apply Equiv.Perm.decomposeOption_symm_of_none_apply
Mathlib/GroupTheory/Perm/Option.lean
80
81
theorem Equiv.Perm.decomposeOption_symm_sign {Ξ± : Type*} [DecidableEq Ξ±] [Fintype Ξ±] (e : Perm Ξ±) : Perm.sign (Equiv.Perm.decomposeOption.symm (none, e)) = Perm.sign e := by
simp
1,241
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ gβ‚‚ g₃ g : G}
Mathlib/GroupTheory/Commutator.lean
31
32
theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * gβ‚‚ = gβ‚‚ * g₁ := by
rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul]
1,242
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ gβ‚‚ g₃ g : G} theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * gβ‚‚ = gβ‚‚ * g₁ := by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul] #align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ gβ‚‚ := commutatorElement_eq_one_iff_mul_comm #align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute theorem Commute.commutator_eq (h : Commute g₁ gβ‚‚) : ⁅g₁, g₂⁆ = 1 := commutatorElement_eq_one_iff_commute.mpr h #align commute.commutator_eq Commute.commutator_eq variable (g₁ gβ‚‚ g₃ g) @[simp] theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 := (Commute.one_right g).commutator_eq #align commutator_element_one_right commutatorElement_one_right @[simp] theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 := (Commute.one_left g).commutator_eq #align commutator_element_one_left commutatorElement_one_left @[simp] theorem commutatorElement_self : ⁅g, g⁆ = 1 := (Commute.refl g).commutator_eq #align commutator_element_self commutatorElement_self @[simp]
Mathlib/GroupTheory/Commutator.lean
61
62
theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅gβ‚‚, g₁⁆ := by
simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc]
1,242
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ gβ‚‚ g₃ g : G} theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * gβ‚‚ = gβ‚‚ * g₁ := by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul] #align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ gβ‚‚ := commutatorElement_eq_one_iff_mul_comm #align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute theorem Commute.commutator_eq (h : Commute g₁ gβ‚‚) : ⁅g₁, g₂⁆ = 1 := commutatorElement_eq_one_iff_commute.mpr h #align commute.commutator_eq Commute.commutator_eq variable (g₁ gβ‚‚ g₃ g) @[simp] theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 := (Commute.one_right g).commutator_eq #align commutator_element_one_right commutatorElement_one_right @[simp] theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 := (Commute.one_left g).commutator_eq #align commutator_element_one_left commutatorElement_one_left @[simp] theorem commutatorElement_self : ⁅g, g⁆ = 1 := (Commute.refl g).commutator_eq #align commutator_element_self commutatorElement_self @[simp] theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅gβ‚‚, g₁⁆ := by simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc] #align commutator_element_inv commutatorElement_inv
Mathlib/GroupTheory/Commutator.lean
65
66
theorem map_commutatorElement : (f ⁅g₁, g₂⁆ : G') = ⁅f g₁, f g₂⁆ := by
simp_rw [commutatorElement_def, map_mul f, map_inv f]
1,242
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ gβ‚‚ g₃ g : G} theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * gβ‚‚ = gβ‚‚ * g₁ := by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul] #align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ gβ‚‚ := commutatorElement_eq_one_iff_mul_comm #align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute theorem Commute.commutator_eq (h : Commute g₁ gβ‚‚) : ⁅g₁, g₂⁆ = 1 := commutatorElement_eq_one_iff_commute.mpr h #align commute.commutator_eq Commute.commutator_eq variable (g₁ gβ‚‚ g₃ g) @[simp] theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 := (Commute.one_right g).commutator_eq #align commutator_element_one_right commutatorElement_one_right @[simp] theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 := (Commute.one_left g).commutator_eq #align commutator_element_one_left commutatorElement_one_left @[simp] theorem commutatorElement_self : ⁅g, g⁆ = 1 := (Commute.refl g).commutator_eq #align commutator_element_self commutatorElement_self @[simp] theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅gβ‚‚, g₁⁆ := by simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc] #align commutator_element_inv commutatorElement_inv theorem map_commutatorElement : (f ⁅g₁, g₂⁆ : G') = ⁅f g₁, f g₂⁆ := by simp_rw [commutatorElement_def, map_mul f, map_inv f] #align map_commutator_element map_commutatorElement theorem conjugate_commutatorElement : g₃ * ⁅g₁, g₂⁆ * g₃⁻¹ = ⁅g₃ * g₁ * g₃⁻¹, g₃ * gβ‚‚ * g₃⁻¹⁆ := map_commutatorElement (MulAut.conj g₃).toMonoidHom g₁ gβ‚‚ #align conjugate_commutator_element conjugate_commutatorElement namespace Subgroup instance commutator : Bracket (Subgroup G) (Subgroup G) := ⟨fun H₁ Hβ‚‚ => closure { g | βˆƒ g₁ ∈ H₁, βˆƒ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ = g }⟩ #align subgroup.commutator Subgroup.commutator theorem commutator_def (H₁ Hβ‚‚ : Subgroup G) : ⁅H₁, H₂⁆ = closure { g | βˆƒ g₁ ∈ H₁, βˆƒ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ = g } := rfl #align subgroup.commutator_def Subgroup.commutator_def variable {g₁ gβ‚‚ g₃} {H₁ Hβ‚‚ H₃ K₁ Kβ‚‚ : Subgroup G} theorem commutator_mem_commutator (h₁ : g₁ ∈ H₁) (hβ‚‚ : gβ‚‚ ∈ Hβ‚‚) : ⁅g₁, g₂⁆ ∈ ⁅H₁, H₂⁆ := subset_closure ⟨g₁, h₁, gβ‚‚, hβ‚‚, rfl⟩ #align subgroup.commutator_mem_commutator Subgroup.commutator_mem_commutator theorem commutator_le : ⁅H₁, H₂⁆ ≀ H₃ ↔ βˆ€ g₁ ∈ H₁, βˆ€ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ ∈ H₃ := H₃.closure_le.trans ⟨fun h a b c d => h ⟨a, b, c, d, rfl⟩, fun h _g ⟨a, b, c, d, h_eq⟩ => h_eq β–Έ h a b c d⟩ #align subgroup.commutator_le Subgroup.commutator_le theorem commutator_mono (h₁ : H₁ ≀ K₁) (hβ‚‚ : Hβ‚‚ ≀ Kβ‚‚) : ⁅H₁, H₂⁆ ≀ ⁅K₁, K₂⁆ := commutator_le.mpr fun _g₁ hg₁ _gβ‚‚ hgβ‚‚ => commutator_mem_commutator (h₁ hg₁) (hβ‚‚ hgβ‚‚) #align subgroup.commutator_mono Subgroup.commutator_mono
Mathlib/GroupTheory/Commutator.lean
100
104
theorem commutator_eq_bot_iff_le_centralizer : ⁅H₁, H₂⁆ = βŠ₯ ↔ H₁ ≀ centralizer Hβ‚‚ := by
rw [eq_bot_iff, commutator_le] refine forall_congr' fun p => forall_congr' fun _hp => forall_congr' fun q => forall_congr' fun hq => ?_ rw [mem_bot, commutatorElement_eq_one_iff_mul_comm, eq_comm]
1,242
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ gβ‚‚ g₃ g : G} theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * gβ‚‚ = gβ‚‚ * g₁ := by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul] #align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ gβ‚‚ := commutatorElement_eq_one_iff_mul_comm #align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute theorem Commute.commutator_eq (h : Commute g₁ gβ‚‚) : ⁅g₁, g₂⁆ = 1 := commutatorElement_eq_one_iff_commute.mpr h #align commute.commutator_eq Commute.commutator_eq variable (g₁ gβ‚‚ g₃ g) @[simp] theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 := (Commute.one_right g).commutator_eq #align commutator_element_one_right commutatorElement_one_right @[simp] theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 := (Commute.one_left g).commutator_eq #align commutator_element_one_left commutatorElement_one_left @[simp] theorem commutatorElement_self : ⁅g, g⁆ = 1 := (Commute.refl g).commutator_eq #align commutator_element_self commutatorElement_self @[simp] theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅gβ‚‚, g₁⁆ := by simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc] #align commutator_element_inv commutatorElement_inv theorem map_commutatorElement : (f ⁅g₁, g₂⁆ : G') = ⁅f g₁, f g₂⁆ := by simp_rw [commutatorElement_def, map_mul f, map_inv f] #align map_commutator_element map_commutatorElement theorem conjugate_commutatorElement : g₃ * ⁅g₁, g₂⁆ * g₃⁻¹ = ⁅g₃ * g₁ * g₃⁻¹, g₃ * gβ‚‚ * g₃⁻¹⁆ := map_commutatorElement (MulAut.conj g₃).toMonoidHom g₁ gβ‚‚ #align conjugate_commutator_element conjugate_commutatorElement namespace Subgroup instance commutator : Bracket (Subgroup G) (Subgroup G) := ⟨fun H₁ Hβ‚‚ => closure { g | βˆƒ g₁ ∈ H₁, βˆƒ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ = g }⟩ #align subgroup.commutator Subgroup.commutator theorem commutator_def (H₁ Hβ‚‚ : Subgroup G) : ⁅H₁, H₂⁆ = closure { g | βˆƒ g₁ ∈ H₁, βˆƒ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ = g } := rfl #align subgroup.commutator_def Subgroup.commutator_def variable {g₁ gβ‚‚ g₃} {H₁ Hβ‚‚ H₃ K₁ Kβ‚‚ : Subgroup G} theorem commutator_mem_commutator (h₁ : g₁ ∈ H₁) (hβ‚‚ : gβ‚‚ ∈ Hβ‚‚) : ⁅g₁, g₂⁆ ∈ ⁅H₁, H₂⁆ := subset_closure ⟨g₁, h₁, gβ‚‚, hβ‚‚, rfl⟩ #align subgroup.commutator_mem_commutator Subgroup.commutator_mem_commutator theorem commutator_le : ⁅H₁, H₂⁆ ≀ H₃ ↔ βˆ€ g₁ ∈ H₁, βˆ€ gβ‚‚ ∈ Hβ‚‚, ⁅g₁, g₂⁆ ∈ H₃ := H₃.closure_le.trans ⟨fun h a b c d => h ⟨a, b, c, d, rfl⟩, fun h _g ⟨a, b, c, d, h_eq⟩ => h_eq β–Έ h a b c d⟩ #align subgroup.commutator_le Subgroup.commutator_le theorem commutator_mono (h₁ : H₁ ≀ K₁) (hβ‚‚ : Hβ‚‚ ≀ Kβ‚‚) : ⁅H₁, H₂⁆ ≀ ⁅K₁, K₂⁆ := commutator_le.mpr fun _g₁ hg₁ _gβ‚‚ hgβ‚‚ => commutator_mem_commutator (h₁ hg₁) (hβ‚‚ hgβ‚‚) #align subgroup.commutator_mono Subgroup.commutator_mono theorem commutator_eq_bot_iff_le_centralizer : ⁅H₁, H₂⁆ = βŠ₯ ↔ H₁ ≀ centralizer Hβ‚‚ := by rw [eq_bot_iff, commutator_le] refine forall_congr' fun p => forall_congr' fun _hp => forall_congr' fun q => forall_congr' fun hq => ?_ rw [mem_bot, commutatorElement_eq_one_iff_mul_comm, eq_comm] #align subgroup.commutator_eq_bot_iff_le_centralizer Subgroup.commutator_eq_bot_iff_le_centralizer
Mathlib/GroupTheory/Commutator.lean
108
116
theorem commutator_commutator_eq_bot_of_rotate (h1 : ⁅⁅Hβ‚‚, H₃⁆, H₁⁆ = βŠ₯) (h2 : ⁅⁅H₃, H₁⁆, H₂⁆ = βŠ₯) : ⁅⁅H₁, H₂⁆, H₃⁆ = βŠ₯ := by
simp_rw [commutator_eq_bot_iff_le_centralizer, commutator_le, mem_centralizer_iff_commutator_eq_one, ← commutatorElement_def] at h1 h2 ⊒ intro x hx y hy z hz trans x * z * ⁅y, ⁅z⁻¹, x⁻¹⁆⁆⁻¹ * z⁻¹ * y * ⁅x⁻¹, ⁅y⁻¹, z⁆⁆⁻¹ * y⁻¹ * x⁻¹ Β· group Β· rw [h1 _ (Hβ‚‚.inv_mem hy) _ hz _ (H₁.inv_mem hx), h2 _ (H₃.inv_mem hz) _ (H₁.inv_mem hx) _ hy] group
1,242