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
goals
listlengths
0
224
goals_before
listlengths
0
220
import Mathlib.Algebra.MonoidAlgebra.Degree import Mathlib.Algebra.MvPolynomial.Rename import Mathlib.Algebra.Order.BigOperators.Ring.Finset #align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finsupp AddMonoidAlgebra universe u v w variable {R : Type u} {S : Type v} namespace MvPolynomial variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ} section CommSemiring variable [CommSemiring R] {p q : MvPolynomial σ R} section Degrees def degrees (p : MvPolynomial σ R) : Multiset σ := letI := Classical.decEq σ p.support.sup fun s : σ →₀ ℕ => toMultiset s #align mv_polynomial.degrees MvPolynomial.degrees theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) : p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl #align mv_polynomial.degrees_def MvPolynomial.degrees_def theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by classical refine (supDegree_single s a).trans_le ?_ split_ifs exacts [bot_le, le_rfl] #align mv_polynomial.degrees_monomial MvPolynomial.degrees_monomial theorem degrees_monomial_eq (s : σ →₀ ℕ) (a : R) (ha : a ≠ 0) : degrees (monomial s a) = toMultiset s := by classical exact (supDegree_single s a).trans (if_neg ha) #align mv_polynomial.degrees_monomial_eq MvPolynomial.degrees_monomial_eq theorem degrees_C (a : R) : degrees (C a : MvPolynomial σ R) = 0 := Multiset.le_zero.1 <| degrees_monomial _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_C MvPolynomial.degrees_C theorem degrees_X' (n : σ) : degrees (X n : MvPolynomial σ R) ≤ {n} := le_trans (degrees_monomial _ _) <| le_of_eq <| toMultiset_single _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X' MvPolynomial.degrees_X' @[simp] theorem degrees_X [Nontrivial R] (n : σ) : degrees (X n : MvPolynomial σ R) = {n} := (degrees_monomial_eq _ (1 : R) one_ne_zero).trans (toMultiset_single _ _) set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X MvPolynomial.degrees_X @[simp] theorem degrees_zero : degrees (0 : MvPolynomial σ R) = 0 := by rw [← C_0] exact degrees_C 0 #align mv_polynomial.degrees_zero MvPolynomial.degrees_zero @[simp] theorem degrees_one : degrees (1 : MvPolynomial σ R) = 0 := degrees_C 1 #align mv_polynomial.degrees_one MvPolynomial.degrees_one theorem degrees_add [DecidableEq σ] (p q : MvPolynomial σ R) : (p + q).degrees ≤ p.degrees ⊔ q.degrees := by simp_rw [degrees_def]; exact supDegree_add_le #align mv_polynomial.degrees_add MvPolynomial.degrees_add theorem degrees_sum {ι : Type*} [DecidableEq σ] (s : Finset ι) (f : ι → MvPolynomial σ R) : (∑ i ∈ s, f i).degrees ≤ s.sup fun i => (f i).degrees := by simp_rw [degrees_def]; exact supDegree_sum_le #align mv_polynomial.degrees_sum MvPolynomial.degrees_sum theorem degrees_mul (p q : MvPolynomial σ R) : (p * q).degrees ≤ p.degrees + q.degrees := by classical simp_rw [degrees_def] exact supDegree_mul_le (map_add _) #align mv_polynomial.degrees_mul MvPolynomial.degrees_mul theorem degrees_prod {ι : Type*} (s : Finset ι) (f : ι → MvPolynomial σ R) : (∏ i ∈ s, f i).degrees ≤ ∑ i ∈ s, (f i).degrees := by classical exact supDegree_prod_le (map_zero _) (map_add _) #align mv_polynomial.degrees_prod MvPolynomial.degrees_prod theorem degrees_pow (p : MvPolynomial σ R) (n : ℕ) : (p ^ n).degrees ≤ n • p.degrees := by simpa using degrees_prod (Finset.range n) fun _ ↦ p #align mv_polynomial.degrees_pow MvPolynomial.degrees_pow
Mathlib/Algebra/MvPolynomial/Degrees.lean
153
156
theorem mem_degrees {p : MvPolynomial σ R} {i : σ} : i ∈ p.degrees ↔ ∃ d, p.coeff d ≠ 0 ∧ i ∈ d.support := by
classical simp only [degrees_def, Multiset.mem_sup, ← mem_support_iff, Finsupp.mem_toMultiset, exists_prop]
[ " p.degrees = p.support.sup fun s => toMultiset s", " (p.support.sup fun s => toMultiset s) = p.support.sup fun s => toMultiset s", " ((monomial s) a).degrees ≤ toMultiset s", " (if a = 0 then ⊥ else toMultiset s) ≤ toMultiset s", " toMultiset s ≤ toMultiset s", " ((monomial s) a).degrees = toMultiset s",...
[ " p.degrees = p.support.sup fun s => toMultiset s", " (p.support.sup fun s => toMultiset s) = p.support.sup fun s => toMultiset s", " ((monomial s) a).degrees ≤ toMultiset s", " (if a = 0 then ⊥ else toMultiset s) ≤ toMultiset s", " toMultiset s ≤ toMultiset s", " ((monomial s) a).degrees = toMultiset s",...
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp] #align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} : (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m = (∏ i, m i) • iteratedDerivWithin n f s x := by rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ] simp #align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin : ‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map] #align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin @[simp]
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
113
115
theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by
ext x simp [iteratedDerivWithin]
[ " iteratedDerivWithin n f univ = iteratedDeriv n f", " iteratedDerivWithin n f univ x = iteratedDeriv n f x", " iteratedDerivWithin n f s = ⇑(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s", " iteratedDerivWithin n f s x =\n (⇑(ContinuousMultilinearMap.piFieldEquiv...
[ " iteratedDerivWithin n f univ = iteratedDeriv n f", " iteratedDerivWithin n f univ x = iteratedDeriv n f x", " iteratedDerivWithin n f s = ⇑(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s", " iteratedDerivWithin n f s x =\n (⇑(ContinuousMultilinearMap.piFieldEquiv...
import Mathlib.CategoryTheory.Filtered.Basic import Mathlib.Data.Set.Finite import Mathlib.Data.Set.Subsingleton import Mathlib.Topology.Category.TopCat.Limits.Konig import Mathlib.Tactic.AdaptationNote #align_import category_theory.cofiltered_system from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" universe u v w open CategoryTheory CategoryTheory.IsCofiltered Set CategoryTheory.FunctorToTypes section FiniteKonig theorem nonempty_sections_of_finite_cofiltered_system.init {J : Type u} [SmallCategory J] [IsCofilteredOrEmpty J] (F : J ⥤ Type u) [hf : ∀ j, Finite (F.obj j)] [hne : ∀ j, Nonempty (F.obj j)] : F.sections.Nonempty := by let F' : J ⥤ TopCat := F ⋙ TopCat.discrete haveI : ∀ j, DiscreteTopology (F'.obj j) := fun _ => ⟨rfl⟩ haveI : ∀ j, Finite (F'.obj j) := hf haveI : ∀ j, Nonempty (F'.obj j) := hne obtain ⟨⟨u, hu⟩⟩ := TopCat.nonempty_limitCone_of_compact_t2_cofiltered_system.{u} F' exact ⟨u, hu⟩ #align nonempty_sections_of_finite_cofiltered_system.init nonempty_sections_of_finite_cofiltered_system.init
Mathlib/CategoryTheory/CofilteredSystem.lean
82
101
theorem nonempty_sections_of_finite_cofiltered_system {J : Type u} [Category.{w} J] [IsCofilteredOrEmpty J] (F : J ⥤ Type v) [∀ j : J, Finite (F.obj j)] [∀ j : J, Nonempty (F.obj j)] : F.sections.Nonempty := by
-- Step 1: lift everything to the `max u v w` universe. let J' : Type max w v u := AsSmall.{max w v} J let down : J' ⥤ J := AsSmall.down let F' : J' ⥤ Type max u v w := down ⋙ F ⋙ uliftFunctor.{max u w, v} haveI : ∀ i, Nonempty (F'.obj i) := fun i => ⟨⟨Classical.arbitrary (F.obj (down.obj i))⟩⟩ haveI : ∀ i, Finite (F'.obj i) := fun i => Finite.of_equiv (F.obj (down.obj i)) Equiv.ulift.symm -- Step 2: apply the bootstrap theorem cases isEmpty_or_nonempty J · fconstructor <;> apply isEmptyElim haveI : IsCofiltered J := ⟨⟩ obtain ⟨u, hu⟩ := nonempty_sections_of_finite_cofiltered_system.init F' -- Step 3: interpret the results use fun j => (u ⟨j⟩).down intro j j' f have h := @hu (⟨j⟩ : J') (⟨j'⟩ : J') (ULift.up f) simp only [F', down, AsSmall.down, Functor.comp_map, uliftFunctor_map, Functor.op_map] at h simp_rw [← h]
[ " F.sections.Nonempty", " (j : J) → F.obj j", " isEmptyElim ∈ F.sections", " (fun j => (u { down := j }).down) ∈ F.sections", " F.map f ((fun j => (u { down := j }).down) j) = (fun j => (u { down := j }).down) j'" ]
[ " F.sections.Nonempty" ]
import Mathlib.Combinatorics.SimpleGraph.Basic import Mathlib.Combinatorics.SimpleGraph.Connectivity import Mathlib.LinearAlgebra.Matrix.Trace import Mathlib.LinearAlgebra.Matrix.Symmetric #align_import combinatorics.simple_graph.adj_matrix from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" open Matrix open Finset Matrix SimpleGraph variable {V α β : Type*} namespace Matrix structure IsAdjMatrix [Zero α] [One α] (A : Matrix V V α) : Prop where zero_or_one : ∀ i j, A i j = 0 ∨ A i j = 1 := by aesop symm : A.IsSymm := by aesop apply_diag : ∀ i, A i i = 0 := by aesop #align matrix.is_adj_matrix Matrix.IsAdjMatrix def compl [Zero α] [One α] [DecidableEq α] [DecidableEq V] (A : Matrix V V α) : Matrix V V α := fun i j => ite (i = j) 0 (ite (A i j = 0) 1 0) #align matrix.compl Matrix.compl section Compl variable [DecidableEq α] [DecidableEq V] (A : Matrix V V α) @[simp]
Mathlib/Combinatorics/SimpleGraph/AdjMatrix.lean
105
105
theorem compl_apply_diag [Zero α] [One α] (i : V) : A.compl i i = 0 := by
simp [compl]
[ " A.compl i i = 0" ]
[]
import Mathlib.Data.Finset.Image #align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" assert_not_exists MonoidWithZero -- TODO: After a lot more work, -- assert_not_exists OrderedCommMonoid open Function Multiset Nat variable {α β R : Type*} namespace Finset variable {s t : Finset α} {a b : α} def card (s : Finset α) : ℕ := Multiset.card s.1 #align finset.card Finset.card theorem card_def (s : Finset α) : s.card = Multiset.card s.1 := rfl #align finset.card_def Finset.card_def @[simp] lemma card_val (s : Finset α) : Multiset.card s.1 = s.card := rfl #align finset.card_val Finset.card_val @[simp] theorem card_mk {m nodup} : (⟨m, nodup⟩ : Finset α).card = Multiset.card m := rfl #align finset.card_mk Finset.card_mk @[simp] theorem card_empty : card (∅ : Finset α) = 0 := rfl #align finset.card_empty Finset.card_empty @[gcongr] theorem card_le_card : s ⊆ t → s.card ≤ t.card := Multiset.card_le_card ∘ val_le_iff.mpr #align finset.card_le_of_subset Finset.card_le_card @[mono] theorem card_mono : Monotone (@card α) := by apply card_le_card #align finset.card_mono Finset.card_mono @[simp] lemma card_eq_zero : s.card = 0 ↔ s = ∅ := card_eq_zero.trans val_eq_zero lemma card_ne_zero : s.card ≠ 0 ↔ s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm lemma card_pos : 0 < s.card ↔ s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero #align finset.card_eq_zero Finset.card_eq_zero #align finset.card_pos Finset.card_pos alias ⟨_, Nonempty.card_pos⟩ := card_pos alias ⟨_, Nonempty.card_ne_zero⟩ := card_ne_zero #align finset.nonempty.card_pos Finset.Nonempty.card_pos theorem card_ne_zero_of_mem (h : a ∈ s) : s.card ≠ 0 := (not_congr card_eq_zero).2 <| ne_empty_of_mem h #align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem @[simp] theorem card_singleton (a : α) : card ({a} : Finset α) = 1 := Multiset.card_singleton _ #align finset.card_singleton Finset.card_singleton theorem card_singleton_inter [DecidableEq α] : ({a} ∩ s).card ≤ 1 := by cases' Finset.decidableMem a s with h h · simp [Finset.singleton_inter_of_not_mem h] · simp [Finset.singleton_inter_of_mem h] #align finset.card_singleton_inter Finset.card_singleton_inter @[simp] theorem card_cons (h : a ∉ s) : (s.cons a h).card = s.card + 1 := Multiset.card_cons _ _ #align finset.card_cons Finset.card_cons section InsertErase variable [DecidableEq α] @[simp] theorem card_insert_of_not_mem (h : a ∉ s) : (insert a s).card = s.card + 1 := by rw [← cons_eq_insert _ _ h, card_cons] #align finset.card_insert_of_not_mem Finset.card_insert_of_not_mem theorem card_insert_of_mem (h : a ∈ s) : card (insert a s) = s.card := by rw [insert_eq_of_mem h] #align finset.card_insert_of_mem Finset.card_insert_of_mem theorem card_insert_le (a : α) (s : Finset α) : card (insert a s) ≤ s.card + 1 := by by_cases h : a ∈ s · rw [insert_eq_of_mem h] exact Nat.le_succ _ · rw [card_insert_of_not_mem h] #align finset.card_insert_le Finset.card_insert_le section variable {a b c d e f : α} theorem card_le_two : card {a, b} ≤ 2 := card_insert_le _ _ theorem card_le_three : card {a, b, c} ≤ 3 := (card_insert_le _ _).trans (Nat.succ_le_succ card_le_two) theorem card_le_four : card {a, b, c, d} ≤ 4 := (card_insert_le _ _).trans (Nat.succ_le_succ card_le_three) theorem card_le_five : card {a, b, c, d, e} ≤ 5 := (card_insert_le _ _).trans (Nat.succ_le_succ card_le_four) theorem card_le_six : card {a, b, c, d, e, f} ≤ 6 := (card_insert_le _ _).trans (Nat.succ_le_succ card_le_five) end theorem card_insert_eq_ite : card (insert a s) = if a ∈ s then s.card else s.card + 1 := by by_cases h : a ∈ s · rw [card_insert_of_mem h, if_pos h] · rw [card_insert_of_not_mem h, if_neg h] #align finset.card_insert_eq_ite Finset.card_insert_eq_ite @[simp] theorem card_pair_eq_one_or_two : ({a,b} : Finset α).card = 1 ∨ ({a,b} : Finset α).card = 2 := by simp [card_insert_eq_ite] tauto @[simp] theorem card_pair (h : a ≠ b) : ({a, b} : Finset α).card = 2 := by rw [card_insert_of_not_mem (not_mem_singleton.2 h), card_singleton] #align finset.card_doubleton Finset.card_pair @[deprecated (since := "2024-01-04")] alias card_doubleton := Finset.card_pair @[simp] theorem card_erase_of_mem : a ∈ s → (s.erase a).card = s.card - 1 := Multiset.card_erase_of_mem #align finset.card_erase_of_mem Finset.card_erase_of_mem @[simp]
Mathlib/Data/Finset/Card.lean
171
175
theorem cast_card_erase_of_mem {R} [AddGroupWithOne R] {s : Finset α} (hs : a ∈ s) : ((s.erase a).card : R) = s.card - 1 := by
rw [card_erase_of_mem hs, Nat.cast_sub, Nat.cast_one] rw [Nat.add_one_le_iff, Finset.card_pos] exact ⟨a, hs⟩
[ " Monotone card", " ({a} ∩ s).card ≤ 1", " (insert a s).card = s.card + 1", " (insert a s).card = s.card", " (insert a s).card ≤ s.card + 1", " s.card ≤ s.card + 1", " (insert a s).card = if a ∈ s then s.card else s.card + 1", " {a, b}.card = 1 ∨ {a, b}.card = 2", " a = b ∨ ¬a = b", " {a, b}.card ...
[ " Monotone card", " ({a} ∩ s).card ≤ 1", " (insert a s).card = s.card + 1", " (insert a s).card = s.card", " (insert a s).card ≤ s.card + 1", " s.card ≤ s.card + 1", " (insert a s).card = if a ∈ s then s.card else s.card + 1", " {a, b}.card = 1 ∨ {a, b}.card = 2", " a = b ∨ ¬a = b", " {a, b}.card ...
import Mathlib.CategoryTheory.Sites.Sieves import Mathlib.CategoryTheory.EffectiveEpi.Basic namespace CategoryTheory open Limits variable {C : Type*} [Category C] def Sieve.EffectiveEpimorphic {X : C} (S : Sieve X) : Prop := Nonempty (IsColimit (S : Presieve X).cocone) abbrev Presieve.EffectiveEpimorphic {X : C} (S : Presieve X) : Prop := (Sieve.generate S).EffectiveEpimorphic def Sieve.generateSingleton {X Y : C} (f : Y ⟶ X) : Sieve X where arrows Z := { g | ∃ (e : Z ⟶ Y), e ≫ f = g } downward_closed := by rintro W Z g ⟨e,rfl⟩ q exact ⟨q ≫ e, by simp⟩ lemma Sieve.generateSingleton_eq {X Y : C} (f : Y ⟶ X) : Sieve.generate (Presieve.singleton f) = Sieve.generateSingleton f := by ext Z g constructor · rintro ⟨W,i,p,⟨⟩,rfl⟩ exact ⟨i,rfl⟩ · rintro ⟨g,h⟩ exact ⟨Y,g,f,⟨⟩,h⟩ def isColimitOfEffectiveEpiStruct {X Y : C} (f : Y ⟶ X) (Hf : EffectiveEpiStruct f) : IsColimit (Sieve.generateSingleton f : Presieve X).cocone := letI D := FullSubcategory fun T : Over X => Sieve.generateSingleton f T.hom letI F : D ⥤ _ := (Sieve.generateSingleton f).arrows.diagram { desc := fun S => Hf.desc (S.ι.app ⟨Over.mk f, ⟨𝟙 _, by simp⟩⟩) <| by intro Z g₁ g₂ h let Y' : D := ⟨Over.mk f, 𝟙 _, by simp⟩ let Z' : D := ⟨Over.mk (g₁ ≫ f), g₁, rfl⟩ let g₁' : Z' ⟶ Y' := Over.homMk g₁ let g₂' : Z' ⟶ Y' := Over.homMk g₂ (by simp [h]) change F.map g₁' ≫ _ = F.map g₂' ≫ _ simp only [S.w] fac := by rintro S ⟨T,g,hT⟩ dsimp nth_rewrite 1 [← hT, Category.assoc, Hf.fac] let y : D := ⟨Over.mk f, 𝟙 _, by simp⟩ let x : D := ⟨Over.mk T.hom, g, hT⟩ let g' : x ⟶ y := Over.homMk g change F.map g' ≫ _ = _ rw [S.w] rfl uniq := by intro S m hm dsimp generalize_proofs h1 h2 apply Hf.uniq _ h2 exact hm ⟨Over.mk f, 𝟙 _, by simp⟩ } noncomputable def effectiveEpiStructOfIsColimit {X Y : C} (f : Y ⟶ X) (Hf : IsColimit (Sieve.generateSingleton f : Presieve X).cocone) : EffectiveEpiStruct f := let aux {W : C} (e : Y ⟶ W) (h : ∀ {Z : C} (g₁ g₂ : Z ⟶ Y), g₁ ≫ f = g₂ ≫ f → g₁ ≫ e = g₂ ≫ e) : Cocone (Sieve.generateSingleton f).arrows.diagram := { pt := W ι := { app := fun ⟨T,hT⟩ => hT.choose ≫ e naturality := by rintro ⟨A,hA⟩ ⟨B,hB⟩ (q : A ⟶ B) dsimp; simp only [← Category.assoc, Category.comp_id] apply h rw [Category.assoc, hB.choose_spec, hA.choose_spec, Over.w] } } { desc := fun {W} e h => Hf.desc (aux e h) fac := by intro W e h dsimp have := Hf.fac (aux e h) ⟨Over.mk f, 𝟙 _, by simp⟩ dsimp at this; rw [this]; clear this nth_rewrite 2 [← Category.id_comp e] apply h generalize_proofs hh rw [hh.choose_spec, Category.id_comp] uniq := by intro W e h m hm dsimp apply Hf.uniq (aux e h) rintro ⟨A,g,hA⟩ dsimp nth_rewrite 1 [← hA, Category.assoc, hm] apply h generalize_proofs hh rwa [hh.choose_spec] }
Mathlib/CategoryTheory/Sites/EffectiveEpimorphic.lean
132
142
theorem Sieve.effectiveEpimorphic_singleton {X Y : C} (f : Y ⟶ X) : (Presieve.singleton f).EffectiveEpimorphic ↔ (EffectiveEpi f) := by
constructor · intro (h : Nonempty _) rw [Sieve.generateSingleton_eq] at h constructor apply Nonempty.map (effectiveEpiStructOfIsColimit _) h · rintro ⟨h⟩ show Nonempty _ rw [Sieve.generateSingleton_eq] apply Nonempty.map (isColimitOfEffectiveEpiStruct _) h
[ " ∀ {Y_1 Z : C} {f_1 : Y_1 ⟶ X},\n (fun Z => {g | ∃ e, e ≫ f = g}) Y_1 f_1 → ∀ (g : Z ⟶ Y_1), (fun Z => {g | ∃ e, e ≫ f = g}) Z (g ≫ f_1)", " {g | ∃ e, e ≫ f = g} (q ≫ e ≫ f)", " (q ≫ e) ≫ f = q ≫ e ≫ f", " generate (Presieve.singleton f) = generateSingleton f", " (generate (Presieve.singleton f)).arrows...
[ " ∀ {Y_1 Z : C} {f_1 : Y_1 ⟶ X},\n (fun Z => {g | ∃ e, e ≫ f = g}) Y_1 f_1 → ∀ (g : Z ⟶ Y_1), (fun Z => {g | ∃ e, e ≫ f = g}) Z (g ≫ f_1)", " {g | ∃ e, e ≫ f = g} (q ≫ e ≫ f)", " (q ≫ e) ≫ f = q ≫ e ≫ f", " generate (Presieve.singleton f) = generateSingleton f", " (generate (Presieve.singleton f)).arrows...
import Mathlib.Topology.MetricSpace.Antilipschitz #align_import topology.metric_space.isometry from "leanprover-community/mathlib"@"b1859b6d4636fdbb78c5d5cefd24530653cfd3eb" noncomputable section universe u v w variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w} open Function Set open scoped Topology ENNReal def Isometry [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop := ∀ x1 x2 : α, edist (f x1) (f x2) = edist x1 x2 #align isometry Isometry theorem isometry_iff_nndist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} : Isometry f ↔ ∀ x y, nndist (f x) (f y) = nndist x y := by simp only [Isometry, edist_nndist, ENNReal.coe_inj] #align isometry_iff_nndist_eq isometry_iff_nndist_eq
Mathlib/Topology/MetricSpace/Isometry.lean
46
48
theorem isometry_iff_dist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} : Isometry f ↔ ∀ x y, dist (f x) (f y) = dist x y := by
simp only [isometry_iff_nndist_eq, ← coe_nndist, NNReal.coe_inj]
[ " Isometry f ↔ ∀ (x y : α), nndist (f x) (f y) = nndist x y", " Isometry f ↔ ∀ (x y : α), dist (f x) (f y) = dist x y" ]
[ " Isometry f ↔ ∀ (x y : α), nndist (f x) (f y) = nndist x y" ]
import Mathlib.Algebra.Order.Ring.Cast import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.PSub import Mathlib.Data.Nat.Size import Mathlib.Data.Num.Bitwise #align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" set_option linter.deprecated false -- Porting note: Required for the notation `-[n+1]`. open Int Function attribute [local simp] add_assoc namespace PosNum variable {α : Type*} @[simp, norm_cast] theorem cast_one [One α] [Add α] : ((1 : PosNum) : α) = 1 := rfl #align pos_num.cast_one PosNum.cast_one @[simp] theorem cast_one' [One α] [Add α] : (PosNum.one : α) = 1 := rfl #align pos_num.cast_one' PosNum.cast_one' @[simp, norm_cast] theorem cast_bit0 [One α] [Add α] (n : PosNum) : (n.bit0 : α) = _root_.bit0 (n : α) := rfl #align pos_num.cast_bit0 PosNum.cast_bit0 @[simp, norm_cast] theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = _root_.bit1 (n : α) := rfl #align pos_num.cast_bit1 PosNum.cast_bit1 @[simp, norm_cast] theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n | 1 => Nat.cast_one | bit0 p => (Nat.cast_bit0 _).trans <| congr_arg _root_.bit0 p.cast_to_nat | bit1 p => (Nat.cast_bit1 _).trans <| congr_arg _root_.bit1 p.cast_to_nat #align pos_num.cast_to_nat PosNum.cast_to_nat @[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n := cast_to_nat _ #align pos_num.to_nat_to_int PosNum.to_nat_to_int @[simp, norm_cast]
Mathlib/Data/Num/Lemmas.lean
69
70
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
[ " ↑↑n = ↑n" ]
[]
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.GroupTheory.Submonoid.Center #align_import group_theory.subgroup.basic from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" open Function open Int variable {G : Type*} [Group G] namespace Subgroup variable (G) @[to_additive "The center of an additive group `G` is the set of elements that commute with everything in `G`"] def center : Subgroup G := { Submonoid.center G with carrier := Set.center G inv_mem' := Set.inv_mem_center } #align subgroup.center Subgroup.center #align add_subgroup.center AddSubgroup.center @[to_additive] theorem coe_center : ↑(center G) = Set.center G := rfl #align subgroup.coe_center Subgroup.coe_center #align add_subgroup.coe_center AddSubgroup.coe_center @[to_additive (attr := simp)] theorem center_toSubmonoid : (center G).toSubmonoid = Submonoid.center G := rfl #align subgroup.center_to_submonoid Subgroup.center_toSubmonoid #align add_subgroup.center_to_add_submonoid AddSubgroup.center_toAddSubmonoid instance center.isCommutative : (center G).IsCommutative := ⟨⟨fun a b => Subtype.ext (b.2.comm a).symm⟩⟩ #align subgroup.center.is_commutative Subgroup.center.isCommutative @[simps! apply_val_coe symm_apply_coe_val] def centerUnitsEquivUnitsCenter (G₀ : Type*) [GroupWithZero G₀] : Subgroup.center (G₀ˣ) ≃* (Submonoid.center G₀)ˣ where toFun := MonoidHom.toHomUnits <| { toFun := fun u ↦ ⟨(u : G₀ˣ), (Submonoid.mem_center_iff.mpr (fun r ↦ by rcases eq_or_ne r 0 with (rfl | hr) · rw [mul_zero, zero_mul] exact congrArg Units.val <| (u.2.comm <| Units.mk0 r hr).symm))⟩ map_one' := rfl map_mul' := fun _ _ ↦ rfl } invFun u := unitsCenterToCenterUnits G₀ u left_inv _ := by ext; rfl right_inv _ := by ext; rfl map_mul' := map_mul _ variable {G} @[to_additive] theorem mem_center_iff {z : G} : z ∈ center G ↔ ∀ g, g * z = z * g := by rw [← Semigroup.mem_center_iff] exact Iff.rfl #align subgroup.mem_center_iff Subgroup.mem_center_iff #align add_subgroup.mem_center_iff AddSubgroup.mem_center_iff instance decidableMemCenter (z : G) [Decidable (∀ g, g * z = z * g)] : Decidable (z ∈ center G) := decidable_of_iff' _ mem_center_iff #align subgroup.decidable_mem_center Subgroup.decidableMemCenter @[to_additive] instance centerCharacteristic : (center G).Characteristic := by refine characteristic_iff_comap_le.mpr fun ϕ g hg => ?_ rw [mem_center_iff] intro h rw [← ϕ.injective.eq_iff, ϕ.map_mul, ϕ.map_mul] exact (hg.comm (ϕ h)).symm #align subgroup.center_characteristic Subgroup.centerCharacteristic #align add_subgroup.center_characteristic AddSubgroup.centerCharacteristic theorem _root_.CommGroup.center_eq_top {G : Type*} [CommGroup G] : center G = ⊤ := by rw [eq_top_iff'] intro x rw [Subgroup.mem_center_iff] intro y exact mul_comm y x #align comm_group.center_eq_top CommGroup.center_eq_top def _root_.Group.commGroupOfCenterEqTop (h : center G = ⊤) : CommGroup G := { (_ : Group G) with mul_comm := by rw [eq_top_iff'] at h intro x y apply Subgroup.mem_center_iff.mp _ x exact h y } #align group.comm_group_of_center_eq_top Group.commGroupOfCenterEqTop variable {H : Subgroup G} namespace IsConj variable {M : Type*} [Monoid M]
Mathlib/GroupTheory/Subgroup/Center.lean
130
131
theorem eq_of_left_mem_center {g h : M} (H : IsConj g h) (Hg : g ∈ Set.center M) : g = h := by
rcases H with ⟨u, hu⟩; rwa [← u.mul_left_inj, Hg.comm u]
[ " r * ↑↑u = ↑↑u * r", " 0 * ↑↑u = ↑↑u * 0", " (fun u => (unitsCenterToCenterUnits G₀) u)\n ({ toFun := fun u => ⟨↑↑u, ⋯⟩, map_one' := ?m.1734, map_mul' := ⋯ }.toHomUnits x✝) =\n x✝", " ↑↑((fun u => (unitsCenterToCenterUnits G₀) u)\n ({ toFun := fun u => ⟨↑↑u, ⋯⟩, map_one' := ?m.1734, map_mul'...
[ " r * ↑↑u = ↑↑u * r", " 0 * ↑↑u = ↑↑u * 0", " (fun u => (unitsCenterToCenterUnits G₀) u)\n ({ toFun := fun u => ⟨↑↑u, ⋯⟩, map_one' := ?m.1734, map_mul' := ⋯ }.toHomUnits x✝) =\n x✝", " ↑↑((fun u => (unitsCenterToCenterUnits G₀) u)\n ({ toFun := fun u => ⟨↑↑u, ⋯⟩, map_one' := ?m.1734, map_mul'...
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Num.Lemmas import Mathlib.Data.Option.Basic import Mathlib.SetTheory.Cardinal.Basic #align_import computability.encoding from "leanprover-community/mathlib"@"b6395b3a5acd655b16385fa0cdbf1961d6c34b3e" universe u v open Cardinal namespace Computability structure Encoding (α : Type u) where Γ : Type v encode : α → List Γ decode : List Γ → Option α decode_encode : ∀ x, decode (encode x) = some x #align computability.encoding Computability.Encoding theorem Encoding.encode_injective {α : Type u} (e : Encoding α) : Function.Injective e.encode := by refine fun _ _ h => Option.some_injective _ ?_ rw [← e.decode_encode, ← e.decode_encode, h] #align computability.encoding.encode_injective Computability.Encoding.encode_injective structure FinEncoding (α : Type u) extends Encoding.{u, 0} α where ΓFin : Fintype Γ #align computability.fin_encoding Computability.FinEncoding instance Γ.fintype {α : Type u} (e : FinEncoding α) : Fintype e.toEncoding.Γ := e.ΓFin #align computability.Γ.fintype Computability.Γ.fintype inductive Γ' | blank | bit (b : Bool) | bra | ket | comma deriving DecidableEq #align computability.Γ' Computability.Γ' -- Porting note: A handler for `Fintype` had not been implemented yet. instance Γ'.fintype : Fintype Γ' := ⟨⟨{.blank, .bit true, .bit false, .bra, .ket, .comma}, by decide⟩, by intro; cases_type* Γ' Bool <;> decide⟩ #align computability.Γ'.fintype Computability.Γ'.fintype instance inhabitedΓ' : Inhabited Γ' := ⟨Γ'.blank⟩ #align computability.inhabited_Γ' Computability.inhabitedΓ' def inclusionBoolΓ' : Bool → Γ' := Γ'.bit #align computability.inclusion_bool_Γ' Computability.inclusionBoolΓ' def sectionΓ'Bool : Γ' → Bool | Γ'.bit b => b | _ => Inhabited.default #align computability.section_Γ'_bool Computability.sectionΓ'Bool theorem leftInverse_section_inclusion : Function.LeftInverse sectionΓ'Bool inclusionBoolΓ' := fun x => Bool.casesOn x rfl rfl #align computability.left_inverse_section_inclusion Computability.leftInverse_section_inclusion theorem inclusionBoolΓ'_injective : Function.Injective inclusionBoolΓ' := Function.HasLeftInverse.injective (Exists.intro sectionΓ'Bool leftInverse_section_inclusion) #align computability.inclusion_bool_Γ'_injective Computability.inclusionBoolΓ'_injective def encodePosNum : PosNum → List Bool | PosNum.one => [true] | PosNum.bit0 n => false :: encodePosNum n | PosNum.bit1 n => true :: encodePosNum n #align computability.encode_pos_num Computability.encodePosNum def encodeNum : Num → List Bool | Num.zero => [] | Num.pos n => encodePosNum n #align computability.encode_num Computability.encodeNum def encodeNat (n : ℕ) : List Bool := encodeNum n #align computability.encode_nat Computability.encodeNat def decodePosNum : List Bool → PosNum | false :: l => PosNum.bit0 (decodePosNum l) | true :: l => ite (l = []) PosNum.one (PosNum.bit1 (decodePosNum l)) | _ => PosNum.one #align computability.decode_pos_num Computability.decodePosNum def decodeNum : List Bool → Num := fun l => ite (l = []) Num.zero <| decodePosNum l #align computability.decode_num Computability.decodeNum def decodeNat : List Bool → Nat := fun l => decodeNum l #align computability.decode_nat Computability.decodeNat theorem encodePosNum_nonempty (n : PosNum) : encodePosNum n ≠ [] := PosNum.casesOn n (List.cons_ne_nil _ _) (fun _m => List.cons_ne_nil _ _) fun _m => List.cons_ne_nil _ _ #align computability.encode_pos_num_nonempty Computability.encodePosNum_nonempty theorem decode_encodePosNum : ∀ n, decodePosNum (encodePosNum n) = n := by intro n induction' n with m hm m hm <;> unfold encodePosNum decodePosNum · rfl · rw [hm] exact if_neg (encodePosNum_nonempty m) · exact congr_arg PosNum.bit0 hm #align computability.decode_encode_pos_num Computability.decode_encodePosNum
Mathlib/Computability/Encoding.lean
143
149
theorem decode_encodeNum : ∀ n, decodeNum (encodeNum n) = n := by
intro n cases' n with n <;> unfold encodeNum decodeNum · rfl rw [decode_encodePosNum n] rw [PosNum.cast_to_num] exact if_neg (encodePosNum_nonempty n)
[ " Function.Injective e.encode", " some x✝¹ = some x✝", " {blank, bit true, bit false, bra, ket, comma}.Nodup", " ∀ (x : Γ'), x ∈ { val := {blank, bit true, bit false, bra, ket, comma}, nodup := ⋯ }", " x✝ ∈ { val := {blank, bit true, bit false, bra, ket, comma}, nodup := ⋯ }", " blank ∈ { val := {blank, b...
[ " Function.Injective e.encode", " some x✝¹ = some x✝", " {blank, bit true, bit false, bra, ket, comma}.Nodup", " ∀ (x : Γ'), x ∈ { val := {blank, bit true, bit false, bra, ket, comma}, nodup := ⋯ }", " x✝ ∈ { val := {blank, bit true, bit false, bra, ket, comma}, nodup := ⋯ }", " blank ∈ { val := {blank, b...
import Mathlib.CategoryTheory.Sites.Canonical #align_import category_theory.sites.types from "leanprover-community/mathlib"@"9f9015c645d85695581237cc761981036be8bd37" universe u namespace CategoryTheory --open scoped CategoryTheory.Type -- Porting note: unknown namespace def typesGrothendieckTopology : GrothendieckTopology (Type u) where sieves α S := ∀ x : α, S fun _ : PUnit => x top_mem' _ _ := trivial pullback_stable' _ _ _ f hs x := hs (f x) transitive' _ _ hs _ hr x := hr (hs x) PUnit.unit #align category_theory.types_grothendieck_topology CategoryTheory.typesGrothendieckTopology @[simps] def discreteSieve (α : Type u) : Sieve α where arrows _ f := ∃ x, ∀ y, f y = x downward_closed := fun ⟨x, hx⟩ g => ⟨x, fun y => hx <| g y⟩ #align category_theory.discrete_sieve CategoryTheory.discreteSieve theorem discreteSieve_mem (α : Type u) : discreteSieve α ∈ typesGrothendieckTopology α := fun x => ⟨x, fun _ => rfl⟩ #align category_theory.discrete_sieve_mem CategoryTheory.discreteSieve_mem def discretePresieve (α : Type u) : Presieve α := fun β _ => ∃ x : β, ∀ y : β, y = x #align category_theory.discrete_presieve CategoryTheory.discretePresieve theorem generate_discretePresieve_mem (α : Type u) : Sieve.generate (discretePresieve α) ∈ typesGrothendieckTopology α := fun x => ⟨PUnit, id, fun _ => x, ⟨PUnit.unit, fun _ => Subsingleton.elim _ _⟩, rfl⟩ #align category_theory.generate_discrete_presieve_mem CategoryTheory.generate_discretePresieve_mem open Presieve theorem isSheaf_yoneda' {α : Type u} : IsSheaf typesGrothendieckTopology (yoneda.obj α) := fun β S hs x hx => ⟨fun y => x _ (hs y) PUnit.unit, fun γ f h => funext fun z => by convert congr_fun (hx (𝟙 _) (fun _ => z) (hs <| f z) h rfl) PUnit.unit using 1, fun f hf => funext fun y => by convert congr_fun (hf _ (hs y)) PUnit.unit⟩ #align category_theory.is_sheaf_yoneda' CategoryTheory.isSheaf_yoneda' @[simps] def yoneda' : Type u ⥤ SheafOfTypes typesGrothendieckTopology where obj α := ⟨yoneda.obj α, isSheaf_yoneda'⟩ map f := ⟨yoneda.map f⟩ #align category_theory.yoneda' CategoryTheory.yoneda' @[simp] theorem yoneda'_comp : yoneda'.{u} ⋙ sheafOfTypesToPresheaf _ = yoneda := rfl #align category_theory.yoneda'_comp CategoryTheory.yoneda'_comp open Opposite def eval (P : Type uᵒᵖ ⥤ Type u) (α : Type u) (s : P.obj (op α)) (x : α) : P.obj (op PUnit) := P.map (↾fun _ => x).op s #align category_theory.eval CategoryTheory.eval noncomputable def typesGlue (S : Type uᵒᵖ ⥤ Type u) (hs : IsSheaf typesGrothendieckTopology S) (α : Type u) (f : α → S.obj (op PUnit)) : S.obj (op α) := (hs.isSheafFor _ _ (generate_discretePresieve_mem α)).amalgamate (fun β g hg => S.map (↾fun _ => PUnit.unit).op <| f <| g <| Classical.choose hg) fun β γ δ g₁ g₂ f₁ f₂ hf₁ hf₂ h => (hs.isSheafFor _ _ (generate_discretePresieve_mem δ)).isSeparatedFor.ext fun ε g ⟨x, _⟩ => by have : f₁ (Classical.choose hf₁) = f₂ (Classical.choose hf₂) := Classical.choose_spec hf₁ (g₁ <| g x) ▸ Classical.choose_spec hf₂ (g₂ <| g x) ▸ congr_fun h _ simp_rw [← FunctorToTypes.map_comp_apply, this, ← op_comp] rfl #align category_theory.types_glue CategoryTheory.typesGlue theorem eval_typesGlue {S hs α} (f) : eval.{u} S α (typesGlue S hs α f) = f := by funext x apply (IsSheafFor.valid_glue _ _ _ <| ⟨PUnit.unit, fun _ => Subsingleton.elim _ _⟩).trans convert FunctorToTypes.map_id_apply S _ #align category_theory.eval_types_glue CategoryTheory.eval_typesGlue theorem typesGlue_eval {S hs α} (s) : typesGlue.{u} S hs α (eval S α s) = s := by apply (hs.isSheafFor _ _ (generate_discretePresieve_mem α)).isSeparatedFor.ext intro β f hf apply (IsSheafFor.valid_glue _ _ _ hf).trans apply (FunctorToTypes.map_comp_apply _ _ _ _).symm.trans rw [← op_comp] --congr 2 -- Porting note: This tactic didn't work. Find an alternative. suffices ((↾fun _ ↦ PUnit.unit) ≫ ↾fun _ ↦ f (Classical.choose hf)) = f by rw [this] funext x exact congr_arg f (Classical.choose_spec hf x).symm #align category_theory.types_glue_eval CategoryTheory.typesGlue_eval @[simps] noncomputable def evalEquiv (S : Type uᵒᵖ ⥤ Type u) (hs : IsSheaf typesGrothendieckTopology S) (α : Type u) : S.obj (op α) ≃ (α → S.obj (op PUnit)) where toFun := eval S α invFun := typesGlue S hs α left_inv := typesGlue_eval right_inv := eval_typesGlue #align category_theory.eval_equiv CategoryTheory.evalEquiv
Mathlib/CategoryTheory/Sites/Types.lean
130
132
theorem eval_map (S : Type uᵒᵖ ⥤ Type u) (α β) (f : β ⟶ α) (s x) : eval S β (S.map f.op s) x = eval S α s (f x) := by
simp_rw [eval, ← FunctorToTypes.map_comp_apply, ← op_comp]; rfl
[ " (yoneda.obj α).map f.op (fun y => x (fun x => y) ⋯ PUnit.unit) z = x f h z", " f y = x (fun x => y) ⋯ PUnit.unit", " S.map g.op (S.map g₁.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op (f (g (Classical.choose hg)))) β f₁ hf₁)) =\n S.map g.op (S.map g₂.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op ...
[ " (yoneda.obj α).map f.op (fun y => x (fun x => y) ⋯ PUnit.unit) z = x f h z", " f y = x (fun x => y) ⋯ PUnit.unit", " S.map g.op (S.map g₁.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op (f (g (Classical.choose hg)))) β f₁ hf₁)) =\n S.map g.op (S.map g₂.op ((fun β g hg => S.map (↾fun x => PUnit.unit).op ...
import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open FiniteDimensional MeasureTheory MeasureTheory.Measure Set variable {ι E F : Type*} variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F] section variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)] theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n)) (b : OrthonormalBasis ι ℝ F) : o.volumeForm.measure (parallelepiped b) = 1 := by have e : ι ≃ Fin n := by refine Fintype.equivFinOfCardEq ?_ rw [← _i.out, finrank_eq_card_basis b.toBasis] have A : ⇑b = b.reindex e ∘ e := by ext x simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply] rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped, o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one] #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis
Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean
48
54
theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) : o.volumeForm.measure = volume := by
have A : o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = 1 := Orientation.measure_orthonormalBasis o (stdOrthonormalBasis ℝ F) rw [addHaarMeasure_unique o.volumeForm.measure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped, A, one_smul] simp only [volume, Basis.addHaar]
[ " o.volumeForm.measure (parallelepiped ⇑b) = 1", " ι ≃ Fin n", " Fintype.card ι = n", " ⇑b = ⇑(b.reindex e) ∘ ⇑e", " b x = (⇑(b.reindex e) ∘ ⇑e) x", " o.volumeForm.measure = volume", " addHaarMeasure (stdOrthonormalBasis ℝ F).toBasis.parallelepiped = volume" ]
[ " o.volumeForm.measure (parallelepiped ⇑b) = 1", " ι ≃ Fin n", " Fintype.card ι = n", " ⇑b = ⇑(b.reindex e) ∘ ⇑e", " b x = (⇑(b.reindex e) ∘ ⇑e) x" ]
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Unique #align_import measure_theory.measure.lebesgue.integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace section regionBetween variable {α : Type*} variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean
22
31
theorem volume_regionBetween_eq_integral' [SigmaFinite μ] (f_int : IntegrableOn f s μ) (g_int : IntegrableOn g s μ) (hs : MeasurableSet s) (hfg : f ≤ᵐ[μ.restrict s] g) : μ.prod volume (regionBetween f g s) = ENNReal.ofReal (∫ y in s, (g - f) y ∂μ) := by
have h : g - f =ᵐ[μ.restrict s] fun x => Real.toNNReal (g x - f x) := hfg.mono fun x hx => (Real.coe_toNNReal _ <| sub_nonneg.2 hx).symm rw [volume_regionBetween_eq_lintegral f_int.aemeasurable g_int.aemeasurable hs, integral_congr_ae h, lintegral_congr_ae, lintegral_coe_eq_integral _ ((integrable_congr h).mp (g_int.sub f_int))] dsimp only rfl
[ " (μ.prod volume) (regionBetween f g s) = ENNReal.ofReal (∫ (y : α) in s, (g - f) y ∂μ)", " (fun y => ENNReal.ofReal ((g - f) y)) =ᶠ[ae (μ.restrict s)] fun a => ↑(g a - f a).toNNReal" ]
[]
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R] theorem IsLeftRegular.pow (n : ℕ) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n] #align is_left_regular.pow IsLeftRegular.pow theorem IsRightRegular.pow (n : ℕ) (rra : IsRightRegular a) : IsRightRegular (a ^ n) := by rw [IsRightRegular, ← mul_right_iterate] exact rra.iterate n #align is_right_regular.pow IsRightRegular.pow theorem IsRegular.pow (n : ℕ) (ra : IsRegular a) : IsRegular (a ^ n) := ⟨IsLeftRegular.pow n ra.left, IsRightRegular.pow n ra.right⟩ #align is_regular.pow IsRegular.pow
Mathlib/Algebra/Regular/Pow.lean
47
50
theorem IsLeftRegular.pow_iff {n : ℕ} (n0 : 0 < n) : IsLeftRegular (a ^ n) ↔ IsLeftRegular a := by
refine ⟨?_, IsLeftRegular.pow n⟩ rw [← Nat.succ_pred_eq_of_pos n0, pow_succ] exact IsLeftRegular.of_mul
[ " IsLeftRegular (a ^ n)", " IsRightRegular (a ^ n)", " Function.Injective (fun x => x * a)^[n]", " IsLeftRegular (a ^ n) ↔ IsLeftRegular a", " IsLeftRegular (a ^ n) → IsLeftRegular a", " IsLeftRegular (a ^ n.pred * a) → IsLeftRegular a" ]
[ " IsLeftRegular (a ^ n)", " IsRightRegular (a ^ n)", " Function.Injective (fun x => x * a)^[n]" ]
import Mathlib.Data.List.Range import Mathlib.Data.List.Perm #align_import data.list.sigma from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb" universe u v namespace List variable {α : Type u} {β : α → Type v} {l l₁ l₂ : List (Sigma β)} def keys : List (Sigma β) → List α := map Sigma.fst #align list.keys List.keys @[simp] theorem keys_nil : @keys α β [] = [] := rfl #align list.keys_nil List.keys_nil @[simp] theorem keys_cons {s} {l : List (Sigma β)} : (s :: l).keys = s.1 :: l.keys := rfl #align list.keys_cons List.keys_cons theorem mem_keys_of_mem {s : Sigma β} {l : List (Sigma β)} : s ∈ l → s.1 ∈ l.keys := mem_map_of_mem Sigma.fst #align list.mem_keys_of_mem List.mem_keys_of_mem theorem exists_of_mem_keys {a} {l : List (Sigma β)} (h : a ∈ l.keys) : ∃ b : β a, Sigma.mk a b ∈ l := let ⟨⟨_, b'⟩, m, e⟩ := exists_of_mem_map h Eq.recOn e (Exists.intro b' m) #align list.exists_of_mem_keys List.exists_of_mem_keys theorem mem_keys {a} {l : List (Sigma β)} : a ∈ l.keys ↔ ∃ b : β a, Sigma.mk a b ∈ l := ⟨exists_of_mem_keys, fun ⟨_, h⟩ => mem_keys_of_mem h⟩ #align list.mem_keys List.mem_keys theorem not_mem_keys {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ b : β a, Sigma.mk a b ∉ l := (not_congr mem_keys).trans not_exists #align list.not_mem_keys List.not_mem_keys theorem not_eq_key {a} {l : List (Sigma β)} : a ∉ l.keys ↔ ∀ s : Sigma β, s ∈ l → a ≠ s.1 := Iff.intro (fun h₁ s h₂ e => absurd (mem_keys_of_mem h₂) (by rwa [e] at h₁)) fun f h₁ => let ⟨b, h₂⟩ := exists_of_mem_keys h₁ f _ h₂ rfl #align list.not_eq_key List.not_eq_key def NodupKeys (l : List (Sigma β)) : Prop := l.keys.Nodup #align list.nodupkeys List.NodupKeys theorem nodupKeys_iff_pairwise {l} : NodupKeys l ↔ Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l := pairwise_map #align list.nodupkeys_iff_pairwise List.nodupKeys_iff_pairwise theorem NodupKeys.pairwise_ne {l} (h : NodupKeys l) : Pairwise (fun s s' : Sigma β => s.1 ≠ s'.1) l := nodupKeys_iff_pairwise.1 h #align list.nodupkeys.pairwise_ne List.NodupKeys.pairwise_ne @[simp] theorem nodupKeys_nil : @NodupKeys α β [] := Pairwise.nil #align list.nodupkeys_nil List.nodupKeys_nil @[simp] theorem nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} : NodupKeys (s :: l) ↔ s.1 ∉ l.keys ∧ NodupKeys l := by simp [keys, NodupKeys] #align list.nodupkeys_cons List.nodupKeys_cons theorem not_mem_keys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) : s.1 ∉ l.keys := (nodupKeys_cons.1 h).1 #align list.not_mem_keys_of_nodupkeys_cons List.not_mem_keys_of_nodupKeys_cons theorem nodupKeys_of_nodupKeys_cons {s : Sigma β} {l : List (Sigma β)} (h : NodupKeys (s :: l)) : NodupKeys l := (nodupKeys_cons.1 h).2 #align list.nodupkeys_of_nodupkeys_cons List.nodupKeys_of_nodupKeys_cons theorem NodupKeys.eq_of_fst_eq {l : List (Sigma β)} (nd : NodupKeys l) {s s' : Sigma β} (h : s ∈ l) (h' : s' ∈ l) : s.1 = s'.1 → s = s' := @Pairwise.forall_of_forall _ (fun s s' : Sigma β => s.1 = s'.1 → s = s') _ (fun _ _ H h => (H h.symm).symm) (fun _ _ _ => rfl) ((nodupKeys_iff_pairwise.1 nd).imp fun h h' => (h h').elim) _ h _ h' #align list.nodupkeys.eq_of_fst_eq List.NodupKeys.eq_of_fst_eq
Mathlib/Data/List/Sigma.lean
123
125
theorem NodupKeys.eq_of_mk_mem {a : α} {b b' : β a} {l : List (Sigma β)} (nd : NodupKeys l) (h : Sigma.mk a b ∈ l) (h' : Sigma.mk a b' ∈ l) : b = b' := by
cases nd.eq_of_fst_eq h h' rfl; rfl
[ " s.fst ∉ l.keys", " (s :: l).NodupKeys ↔ s.fst ∉ l.keys ∧ l.NodupKeys", " b = b'", " b = b" ]
[ " s.fst ∉ l.keys", " (s :: l).NodupKeys ↔ s.fst ∉ l.keys ∧ l.NodupKeys" ]
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Equiv.Fin #align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" namespace List.Nat def antidiagonalTuple : ∀ k, ℕ → List (Fin k → ℕ) | 0, 0 => [![]] | 0, _ + 1 => [] | k + 1, n => (List.Nat.antidiagonal n).bind fun ni => (antidiagonalTuple k ni.2).map fun x => Fin.cons ni.1 x #align list.nat.antidiagonal_tuple List.Nat.antidiagonalTuple @[simp] theorem antidiagonalTuple_zero_zero : antidiagonalTuple 0 0 = [![]] := rfl #align list.nat.antidiagonal_tuple_zero_zero List.Nat.antidiagonalTuple_zero_zero @[simp] theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 (n + 1) = [] := rfl #align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} : x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by induction x using Fin.consInduction generalizing n with | h0 => cases n · decide · simp [eq_comm] | h x₀ x ih => simp_rw [Fin.sum_cons] rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly simp_rw [List.mem_bind, List.mem_map, List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih, @eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _), ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right] #align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple
Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean
96
119
theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n) := by
induction' k with k ih generalizing n · cases n · simp · simp [eq_comm] simp_rw [antidiagonalTuple, List.nodup_bind] constructor · intro i _ exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst) induction' n with n n_ih · exact List.pairwise_singleton _ _ · rw [List.Nat.antidiagonal_succ] refine List.Pairwise.cons (fun a ha x hx₁ hx₂ => ?_) (n_ih.map _ fun a b h x hx₁ hx₂ => ?_) · rw [List.mem_map] at hx₁ hx₂ ha obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂ rw [Fin.cons_eq_cons] at h injection h.1 · rw [List.mem_map] at hx₁ hx₂ obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂ dsimp at h₁₂ rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂ obtain ⟨h₁₂, rfl⟩ := h₁₂ rw [h₁₂] at h exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
[ " x ∈ antidiagonalTuple k n ↔ ∑ i : Fin k, x i = n", " Fin.elim0 ∈ antidiagonalTuple 0 n ↔ ∑ i : Fin 0, i.elim0 = n", " Fin.elim0 ∈ antidiagonalTuple 0 0 ↔ ∑ i : Fin 0, i.elim0 = 0", " Fin.elim0 ∈ antidiagonalTuple 0 (n✝ + 1) ↔ ∑ i : Fin 0, i.elim0 = n✝ + 1", " Fin.cons x₀ x ∈ antidiagonalTuple (n✝ + 1) n ↔...
[ " x ∈ antidiagonalTuple k n ↔ ∑ i : Fin k, x i = n", " Fin.elim0 ∈ antidiagonalTuple 0 n ↔ ∑ i : Fin 0, i.elim0 = n", " Fin.elim0 ∈ antidiagonalTuple 0 0 ↔ ∑ i : Fin 0, i.elim0 = 0", " Fin.elim0 ∈ antidiagonalTuple 0 (n✝ + 1) ↔ ∑ i : Fin 0, i.elim0 = n✝ + 1", " Fin.cons x₀ x ∈ antidiagonalTuple (n✝ + 1) n ↔...
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.Combinatorics.Additive.AP.Three.Defs import Mathlib.Combinatorics.Pigeonhole import Mathlib.Data.Complex.ExponentialBounds #align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" open Nat hiding log open Finset Metric Real open scoped Pointwise lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E] [AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) : ThreeAPFree (frontier s) := by intro a ha b hb c hc habc obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul] have := hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos (add_halves _) hb.2 simp [this, ← add_smul] ring_nf simp #align add_salem_spencer_frontier threeAPFree_frontier lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by obtain rfl | hr := eq_or_ne r 0 · rw [sphere_zero] exact threeAPFree_singleton _ · convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r) exact (frontier_closedBall _ hr).symm #align add_salem_spencer_sphere threeAPFree_sphere namespace Behrend variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ} def box (n d : ℕ) : Finset (Fin n → ℕ) := Fintype.piFinset fun _ => range d #align behrend.box Behrend.box theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by simp only [box, Fintype.mem_piFinset, mem_range] #align behrend.mem_box Behrend.mem_box @[simp] theorem card_box : (box n d).card = d ^ n := by simp [box] #align behrend.card_box Behrend.card_box @[simp]
Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean
105
105
theorem box_zero : box (n + 1) 0 = ∅ := by
simp [box]
[ " ThreeAPFree (frontier s)", " a = b", " (1 / 2) • a + (1 / 2) • c = b", " 2 ≠ 0", " a = (1 / 2) • a + (1 / 2) • c", " c = (2⁻¹ + 2⁻¹) • c", " c = 1 • c", " ThreeAPFree (sphere x r)", " ThreeAPFree (sphere x 0)", " ThreeAPFree {x}", " sphere x r = frontier (closedBall x r)", " x ∈ box n d ↔ ∀ ...
[ " ThreeAPFree (frontier s)", " a = b", " (1 / 2) • a + (1 / 2) • c = b", " 2 ≠ 0", " a = (1 / 2) • a + (1 / 2) • c", " c = (2⁻¹ + 2⁻¹) • c", " c = 1 • c", " ThreeAPFree (sphere x r)", " ThreeAPFree (sphere x 0)", " ThreeAPFree {x}", " sphere x r = frontier (closedBall x r)", " x ∈ box n d ↔ ∀ ...
import Mathlib.Analysis.Convex.Hull #align_import analysis.convex.extreme from "leanprover-community/mathlib"@"c5773405394e073885e2a144c9ca14637e8eb963" open Function Set open scoped Classical open Affine variable {𝕜 E F ι : Type*} {π : ι → Type*} section SMul variable (𝕜) [OrderedSemiring 𝕜] [AddCommMonoid E] [SMul 𝕜 E] def IsExtreme (A B : Set E) : Prop := B ⊆ A ∧ ∀ ⦃x₁⦄, x₁ ∈ A → ∀ ⦃x₂⦄, x₂ ∈ A → ∀ ⦃x⦄, x ∈ B → x ∈ openSegment 𝕜 x₁ x₂ → x₁ ∈ B ∧ x₂ ∈ B #align is_extreme IsExtreme def Set.extremePoints (A : Set E) : Set E := { x ∈ A | ∀ ⦃x₁⦄, x₁ ∈ A → ∀ ⦃x₂⦄, x₂ ∈ A → x ∈ openSegment 𝕜 x₁ x₂ → x₁ = x ∧ x₂ = x } #align set.extreme_points Set.extremePoints @[refl] protected theorem IsExtreme.refl (A : Set E) : IsExtreme 𝕜 A A := ⟨Subset.rfl, fun _ hx₁A _ hx₂A _ _ _ ↦ ⟨hx₁A, hx₂A⟩⟩ #align is_extreme.refl IsExtreme.refl variable {𝕜} {A B C : Set E} {x : E} protected theorem IsExtreme.rfl : IsExtreme 𝕜 A A := IsExtreme.refl 𝕜 A #align is_extreme.rfl IsExtreme.rfl @[trans] protected theorem IsExtreme.trans (hAB : IsExtreme 𝕜 A B) (hBC : IsExtreme 𝕜 B C) : IsExtreme 𝕜 A C := by refine ⟨Subset.trans hBC.1 hAB.1, fun x₁ hx₁A x₂ hx₂A x hxC hx ↦ ?_⟩ obtain ⟨hx₁B, hx₂B⟩ := hAB.2 hx₁A hx₂A (hBC.1 hxC) hx exact hBC.2 hx₁B hx₂B hxC hx #align is_extreme.trans IsExtreme.trans protected theorem IsExtreme.antisymm : AntiSymmetric (IsExtreme 𝕜 : Set E → Set E → Prop) := fun _ _ hAB hBA ↦ Subset.antisymm hBA.1 hAB.1 #align is_extreme.antisymm IsExtreme.antisymm instance : IsPartialOrder (Set E) (IsExtreme 𝕜) where refl := IsExtreme.refl 𝕜 trans _ _ _ := IsExtreme.trans antisymm := IsExtreme.antisymm theorem IsExtreme.inter (hAB : IsExtreme 𝕜 A B) (hAC : IsExtreme 𝕜 A C) : IsExtreme 𝕜 A (B ∩ C) := by use Subset.trans inter_subset_left hAB.1 rintro x₁ hx₁A x₂ hx₂A x ⟨hxB, hxC⟩ hx obtain ⟨hx₁B, hx₂B⟩ := hAB.2 hx₁A hx₂A hxB hx obtain ⟨hx₁C, hx₂C⟩ := hAC.2 hx₁A hx₂A hxC hx exact ⟨⟨hx₁B, hx₁C⟩, hx₂B, hx₂C⟩ #align is_extreme.inter IsExtreme.inter protected theorem IsExtreme.mono (hAC : IsExtreme 𝕜 A C) (hBA : B ⊆ A) (hCB : C ⊆ B) : IsExtreme 𝕜 B C := ⟨hCB, fun _ hx₁B _ hx₂B _ hxC hx ↦ hAC.2 (hBA hx₁B) (hBA hx₂B) hxC hx⟩ #align is_extreme.mono IsExtreme.mono theorem isExtreme_iInter {ι : Sort*} [Nonempty ι] {F : ι → Set E} (hAF : ∀ i : ι, IsExtreme 𝕜 A (F i)) : IsExtreme 𝕜 A (⋂ i : ι, F i) := by obtain i := Classical.arbitrary ι refine ⟨iInter_subset_of_subset i (hAF i).1, fun x₁ hx₁A x₂ hx₂A x hxF hx ↦ ?_⟩ simp_rw [mem_iInter] at hxF ⊢ have h := fun i ↦ (hAF i).2 hx₁A hx₂A (hxF i) hx exact ⟨fun i ↦ (h i).1, fun i ↦ (h i).2⟩ #align is_extreme_Inter isExtreme_iInter theorem isExtreme_biInter {F : Set (Set E)} (hF : F.Nonempty) (hA : ∀ B ∈ F, IsExtreme 𝕜 A B) : IsExtreme 𝕜 A (⋂ B ∈ F, B) := by haveI := hF.to_subtype simpa only [iInter_subtype] using isExtreme_iInter fun i : F ↦ hA _ i.2 #align is_extreme_bInter isExtreme_biInter
Mathlib/Analysis/Convex/Extreme.lean
126
127
theorem isExtreme_sInter {F : Set (Set E)} (hF : F.Nonempty) (hAF : ∀ B ∈ F, IsExtreme 𝕜 A B) : IsExtreme 𝕜 A (⋂₀ F) := by
simpa [sInter_eq_biInter] using isExtreme_biInter hF hAF
[ " IsExtreme 𝕜 A C", " x₁ ∈ C ∧ x₂ ∈ C", " IsExtreme 𝕜 A (B ∩ C)", " ∀ ⦃x₁ : E⦄, x₁ ∈ A → ∀ ⦃x₂ : E⦄, x₂ ∈ A → ∀ ⦃x : E⦄, x ∈ B ∩ C → x ∈ openSegment 𝕜 x₁ x₂ → x₁ ∈ B ∩ C ∧ x₂ ∈ B ∩ C", " x₁ ∈ B ∩ C ∧ x₂ ∈ B ∩ C", " IsExtreme 𝕜 A (⋂ i, F i)", " x₁ ∈ ⋂ i, F i ∧ x₂ ∈ ⋂ i, F i", " (∀ (i : ι), x₁ ∈ F i...
[ " IsExtreme 𝕜 A C", " x₁ ∈ C ∧ x₂ ∈ C", " IsExtreme 𝕜 A (B ∩ C)", " ∀ ⦃x₁ : E⦄, x₁ ∈ A → ∀ ⦃x₂ : E⦄, x₂ ∈ A → ∀ ⦃x : E⦄, x ∈ B ∩ C → x ∈ openSegment 𝕜 x₁ x₂ → x₁ ∈ B ∩ C ∧ x₂ ∈ B ∩ C", " x₁ ∈ B ∩ C ∧ x₂ ∈ B ∩ C", " IsExtreme 𝕜 A (⋂ i, F i)", " x₁ ∈ ⋂ i, F i ∧ x₂ ∈ ⋂ i, F i", " (∀ (i : ι), x₁ ∈ F i...
import Mathlib.Analysis.Calculus.FDeriv.Linear import Mathlib.Analysis.Calculus.FDeriv.Comp #align_import analysis.calculus.fderiv.prod from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section CartesianProduct section Pi variable {ι : Type*} [Fintype ι] {F' : ι → Type*} [∀ i, NormedAddCommGroup (F' i)] [∀ i, NormedSpace 𝕜 (F' i)] {φ : ∀ i, E → F' i} {φ' : ∀ i, E →L[𝕜] F' i} {Φ : E → ∀ i, F' i} {Φ' : E →L[𝕜] ∀ i, F' i} @[simp] theorem hasStrictFDerivAt_pi' : HasStrictFDerivAt Φ Φ' x ↔ ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x := by simp only [HasStrictFDerivAt, ContinuousLinearMap.coe_pi] exact isLittleO_pi #align has_strict_fderiv_at_pi' hasStrictFDerivAt_pi' @[fun_prop] theorem hasStrictFDerivAt_pi'' (hφ : ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x) : HasStrictFDerivAt Φ Φ' x := hasStrictFDerivAt_pi'.2 hφ @[fun_prop]
Mathlib/Analysis/Calculus/FDeriv/Prod.lean
411
417
theorem hasStrictFDerivAt_apply (i : ι) (f : ∀ i, F' i) : HasStrictFDerivAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) f := by
let id' := ContinuousLinearMap.id 𝕜 (∀ i, F' i) have h := ((hasStrictFDerivAt_pi' (Φ := fun (f : ∀ i, F' i) (i' : ι) => f i') (Φ':=id') (x:=f))).1 have h' : comp (proj i) id' = proj i := by rfl rw [← h']; apply h; apply hasStrictFDerivAt_id
[ " HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x", " ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2", " HasStrictFDerivAt ...
[ " HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x", " ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2" ]
import Mathlib.Algebra.Polynomial.Cardinal import Mathlib.Algebra.MvPolynomial.Cardinal import Mathlib.Data.ZMod.Algebra import Mathlib.FieldTheory.IsAlgClosed.Basic import Mathlib.RingTheory.AlgebraicIndependent #align_import field_theory.is_alg_closed.classification from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" universe u open scoped Cardinal Polynomial open Cardinal section AlgebraicClosure namespace IsAlgClosed section Classification noncomputable section variable {R L K : Type*} [CommRing R] variable [Field K] [Algebra R K] variable [Field L] [Algebra R L] variable {ι : Type*} (v : ι → K) variable {κ : Type*} (w : κ → L) variable (hv : AlgebraicIndependent R v)
Mathlib/FieldTheory/IsAlgClosed/Classification.lean
96
100
theorem isAlgClosure_of_transcendence_basis [IsAlgClosed K] (hv : IsTranscendenceBasis R v) : IsAlgClosure (Algebra.adjoin R (Set.range v)) K := letI := RingHom.domain_nontrivial (algebraMap R K) { alg_closed := by
infer_instance algebraic := hv.isAlgebraic }
[ " IsAlgClosed K" ]
[]
import Mathlib.Topology.Defs.Sequences import Mathlib.Topology.UniformSpace.Cauchy #align_import topology.sequences from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Function Filter TopologicalSpace Bornology open scoped Topology Uniformity variable {X Y : Type*} section TopologicalSpace variable [TopologicalSpace X] [TopologicalSpace Y] theorem subset_seqClosure {s : Set X} : s ⊆ seqClosure s := fun p hp => ⟨const ℕ p, fun _ => hp, tendsto_const_nhds⟩ #align subset_seq_closure subset_seqClosure theorem seqClosure_subset_closure {s : Set X} : seqClosure s ⊆ closure s := fun _p ⟨_x, xM, xp⟩ => mem_closure_of_tendsto xp (univ_mem' xM) #align seq_closure_subset_closure seqClosure_subset_closure theorem IsSeqClosed.seqClosure_eq {s : Set X} (hs : IsSeqClosed s) : seqClosure s = s := Subset.antisymm (fun _p ⟨_x, hx, hp⟩ => hs hx hp) subset_seqClosure #align is_seq_closed.seq_closure_eq IsSeqClosed.seqClosure_eq theorem isSeqClosed_of_seqClosure_eq {s : Set X} (hs : seqClosure s = s) : IsSeqClosed s := fun x _p hxs hxp => hs ▸ ⟨x, hxs, hxp⟩ #align is_seq_closed_of_seq_closure_eq isSeqClosed_of_seqClosure_eq theorem isSeqClosed_iff {s : Set X} : IsSeqClosed s ↔ seqClosure s = s := ⟨IsSeqClosed.seqClosure_eq, isSeqClosed_of_seqClosure_eq⟩ #align is_seq_closed_iff isSeqClosed_iff protected theorem IsClosed.isSeqClosed {s : Set X} (hc : IsClosed s) : IsSeqClosed s := fun _u _x hu hx => hc.mem_of_tendsto hx (eventually_of_forall hu) #align is_closed.is_seq_closed IsClosed.isSeqClosed theorem seqClosure_eq_closure [FrechetUrysohnSpace X] (s : Set X) : seqClosure s = closure s := seqClosure_subset_closure.antisymm <| FrechetUrysohnSpace.closure_subset_seqClosure s #align seq_closure_eq_closure seqClosure_eq_closure
Mathlib/Topology/Sequences.lean
113
116
theorem mem_closure_iff_seq_limit [FrechetUrysohnSpace X] {s : Set X} {a : X} : a ∈ closure s ↔ ∃ x : ℕ → X, (∀ n : ℕ, x n ∈ s) ∧ Tendsto x atTop (𝓝 a) := by
rw [← seqClosure_eq_closure] rfl
[ " a ∈ closure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)", " a ∈ seqClosure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)" ]
[]
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order import Mathlib.Topology.Order.LeftRightLim #align_import measure_theory.measure.stieltjes from "leanprover-community/mathlib"@"20d5763051978e9bc6428578ed070445df6a18b3" noncomputable section open scoped Classical open Set Filter Function ENNReal NNReal Topology MeasureTheory open ENNReal (ofReal) structure StieltjesFunction where toFun : ℝ → ℝ mono' : Monotone toFun right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x #align stieltjes_function StieltjesFunction #align stieltjes_function.to_fun StieltjesFunction.toFun #align stieltjes_function.mono' StieltjesFunction.mono' #align stieltjes_function.right_continuous' StieltjesFunction.right_continuous' namespace StieltjesFunction attribute [coe] toFun instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ := ⟨toFun⟩ #align stieltjes_function.has_coe_to_fun StieltjesFunction.instCoeFun initialize_simps_projections StieltjesFunction (toFun → apply) @[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by exact (StieltjesFunction.mk.injEq ..).mpr (funext (by exact h)) variable (f : StieltjesFunction) theorem mono : Monotone f := f.mono' #align stieltjes_function.mono StieltjesFunction.mono theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x := f.right_continuous' x #align stieltjes_function.right_continuous StieltjesFunction.right_continuous
Mathlib/MeasureTheory/Measure/Stieltjes.lean
71
73
theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by
rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici] exact f.right_continuous' x
[ " f = g", " ∀ (x : ℝ), ↑f x = ↑g x", " rightLim (↑f) x = ↑f x", " ContinuousWithinAt (↑f) (Ici x) x" ]
[ " f = g", " ∀ (x : ℝ), ↑f x = ↑g x" ]
import Mathlib.Topology.Algebra.Algebra import Mathlib.Topology.ContinuousFunction.Compact import Mathlib.Topology.UrysohnsLemma import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.Units import Mathlib.Topology.Algebra.Module.CharacterSpace #align_import topology.continuous_function.ideals from "leanprover-community/mathlib"@"c2258f7bf086b17eac0929d635403780c39e239f" open scoped NNReal namespace ContinuousMap open TopologicalSpace section TopologicalRing variable {X R : Type*} [TopologicalSpace X] [Semiring R] variable [TopologicalSpace R] [TopologicalSemiring R] variable (R) def idealOfSet (s : Set X) : Ideal C(X, R) where carrier := {f : C(X, R) | ∀ x ∈ sᶜ, f x = 0} add_mem' {f g} hf hg x hx := by simp [hf x hx, hg x hx, coe_add, Pi.add_apply, add_zero] zero_mem' _ _ := rfl smul_mem' c f hf x hx := mul_zero (c x) ▸ congr_arg (fun y => c x * y) (hf x hx) #align continuous_map.ideal_of_set ContinuousMap.idealOfSet theorem idealOfSet_closed [T2Space R] (s : Set X) : IsClosed (idealOfSet R s : Set C(X, R)) := by simp only [idealOfSet, Submodule.coe_set_mk, Set.setOf_forall] exact isClosed_iInter fun x => isClosed_iInter fun _ => isClosed_eq (continuous_eval_const x) continuous_const #align continuous_map.ideal_of_set_closed ContinuousMap.idealOfSet_closed variable {R} theorem mem_idealOfSet {s : Set X} {f : C(X, R)} : f ∈ idealOfSet R s ↔ ∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0 := by convert Iff.rfl #align continuous_map.mem_ideal_of_set ContinuousMap.mem_idealOfSet
Mathlib/Topology/ContinuousFunction/Ideals.lean
108
109
theorem not_mem_idealOfSet {s : Set X} {f : C(X, R)} : f ∉ idealOfSet R s ↔ ∃ x ∈ sᶜ, f x ≠ 0 := by
simp_rw [mem_idealOfSet]; push_neg; rfl
[ " (f + g) x = 0", " IsClosed ↑(idealOfSet R s)", " IsClosed ↑{ carrier := ⋂ i ∈ sᶜ, {x | x i = 0}, add_mem' := ⋯, zero_mem' := ⋯ }", " f ∈ idealOfSet R s ↔ ∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0", " f ∉ idealOfSet R s ↔ ∃ x ∈ sᶜ, f x ≠ 0", " (¬∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0) ↔ ∃ x ∈ sᶜ, f x ≠ 0", " (∃ x ∈ sᶜ, f x ≠ 0...
[ " (f + g) x = 0", " IsClosed ↑(idealOfSet R s)", " IsClosed ↑{ carrier := ⋂ i ∈ sᶜ, {x | x i = 0}, add_mem' := ⋯, zero_mem' := ⋯ }", " f ∈ idealOfSet R s ↔ ∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0" ]
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset import Mathlib.Data.Finite.Card import Mathlib.GroupTheory.Finiteness import Mathlib.GroupTheory.GroupAction.Quotient #align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" namespace Subgroup open Cardinal variable {G : Type*} [Group G] (H K L : Subgroup G) @[to_additive "The index of a subgroup as a natural number, and returns 0 if the index is infinite."] noncomputable def index : ℕ := Nat.card (G ⧸ H) #align subgroup.index Subgroup.index #align add_subgroup.index AddSubgroup.index @[to_additive "The relative index of a subgroup as a natural number, and returns 0 if the relative index is infinite."] noncomputable def relindex : ℕ := (H.subgroupOf K).index #align subgroup.relindex Subgroup.relindex #align add_subgroup.relindex AddSubgroup.relindex @[to_additive] theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' →* G} (hf : Function.Surjective f) : (H.comap f).index = H.index := by letI := QuotientGroup.leftRel H letI := QuotientGroup.leftRel (H.comap f) have key : ∀ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by simp only [QuotientGroup.leftRel_apply] exact fun x y => iff_of_eq (congr_arg (· ∈ H) (by rw [f.map_mul, f.map_inv])) refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩) · simp_rw [← Quotient.eq''] at key refine Quotient.ind' fun x => ?_ refine Quotient.ind' fun y => ?_ exact (key x y).mpr · refine Quotient.ind' fun x => ?_ obtain ⟨y, hy⟩ := hf x exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩ #align subgroup.index_comap_of_surjective Subgroup.index_comap_of_surjective #align add_subgroup.index_comap_of_surjective AddSubgroup.index_comap_of_surjective @[to_additive] theorem index_comap {G' : Type*} [Group G'] (f : G' →* G) : (H.comap f).index = H.relindex f.range := Eq.trans (congr_arg index (by rfl)) ((H.subgroupOf f.range).index_comap_of_surjective f.rangeRestrict_surjective) #align subgroup.index_comap Subgroup.index_comap #align add_subgroup.index_comap AddSubgroup.index_comap @[to_additive]
Mathlib/GroupTheory/Index.lean
89
91
theorem relindex_comap {G' : Type*} [Group G'] (f : G' →* G) (K : Subgroup G') : relindex (comap f H) K = relindex H (map f K) := by
rw [relindex, subgroupOf, comap_comap, index_comap, ← f.map_range, K.subtype_range]
[ " (comap f H).index = H.index", " ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (f x) (f y)", " ∀ (x y : G'), x⁻¹ * y ∈ comap f H ↔ (f x)⁻¹ * f y ∈ H", " f (x⁻¹ * y) = (f x)⁻¹ * f y", " Function.Injective (Quotient.map' ⇑f ⋯)", " ∀ ⦃a₂ : G' ⧸ comap f H⦄, Quotient.map' ⇑f ⋯ (Quotient.mk'' x) = Quotient.map' ⇑f ⋯ a...
[ " (comap f H).index = H.index", " ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (f x) (f y)", " ∀ (x y : G'), x⁻¹ * y ∈ comap f H ↔ (f x)⁻¹ * f y ∈ H", " f (x⁻¹ * y) = (f x)⁻¹ * f y", " Function.Injective (Quotient.map' ⇑f ⋯)", " ∀ ⦃a₂ : G' ⧸ comap f H⦄, Quotient.map' ⇑f ⋯ (Quotient.mk'' x) = Quotient.map' ⇑f ⋯ a...
import Mathlib.Algebra.Module.LinearMap.Basic import Mathlib.LinearAlgebra.Basic import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.BilinearMap #align_import linear_algebra.sesquilinear_form from "leanprover-community/mathlib"@"87c54600fe3cdc7d32ff5b50873ac724d86aef8d" variable {R R₁ R₂ R₃ M M₁ M₂ M₃ Mₗ₁ Mₗ₁' Mₗ₂ Mₗ₂' K K₁ K₂ V V₁ V₂ n : Type*} namespace LinearMap section CommRing -- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps variable [CommSemiring R] [CommSemiring R₁] [AddCommMonoid M₁] [Module R₁ M₁] [CommSemiring R₂] [AddCommMonoid M₂] [Module R₂ M₂] [AddCommMonoid M] [Module R M] {I₁ : R₁ →+* R} {I₂ : R₂ →+* R} {I₁' : R₁ →+* R} def IsOrtho (B : M₁ →ₛₗ[I₁] M₂ →ₛₗ[I₂] M) (x : M₁) (y : M₂) : Prop := B x y = 0 #align linear_map.is_ortho LinearMap.IsOrtho theorem isOrtho_def {B : M₁ →ₛₗ[I₁] M₂ →ₛₗ[I₂] M} {x y} : B.IsOrtho x y ↔ B x y = 0 := Iff.rfl #align linear_map.is_ortho_def LinearMap.isOrtho_def theorem isOrtho_zero_left (B : M₁ →ₛₗ[I₁] M₂ →ₛₗ[I₂] M) (x) : IsOrtho B (0 : M₁) x := by dsimp only [IsOrtho] rw [map_zero B, zero_apply] #align linear_map.is_ortho_zero_left LinearMap.isOrtho_zero_left theorem isOrtho_zero_right (B : M₁ →ₛₗ[I₁] M₂ →ₛₗ[I₂] M) (x) : IsOrtho B x (0 : M₂) := map_zero (B x) #align linear_map.is_ortho_zero_right LinearMap.isOrtho_zero_right
Mathlib/LinearAlgebra/SesquilinearForm.lean
73
74
theorem isOrtho_flip {B : M₁ →ₛₗ[I₁] M₁ →ₛₗ[I₁'] M} {x y} : B.IsOrtho x y ↔ B.flip.IsOrtho y x := by
simp_rw [isOrtho_def, flip_apply]
[ " B.IsOrtho 0 x", " (B 0) x = 0", " B.IsOrtho x y ↔ B.flip.IsOrtho y x" ]
[ " B.IsOrtho 0 x", " (B 0) x = 0" ]
import Mathlib.RepresentationTheory.Action.Limits import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.CategoryTheory.Monoidal.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Transport import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Linear import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Types.Basic universe u v open CategoryTheory Limits variable {V : Type (u + 1)} [LargeCategory V] {G : MonCat.{u}} namespace Action section Monoidal open MonoidalCategory variable [MonoidalCategory V] instance instMonoidalCategory : MonoidalCategory (Action V G) := Monoidal.transport (Action.functorCategoryEquivalence _ _).symm @[simp] theorem tensorUnit_v : (𝟙_ (Action V G)).V = 𝟙_ V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_V Action.tensorUnit_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensorUnit_rho {g : G} : (𝟙_ (Action V G)).ρ g = 𝟙 (𝟙_ V) := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_rho Action.tensorUnit_rho @[simp] theorem tensor_v {X Y : Action V G} : (X ⊗ Y).V = X.V ⊗ Y.V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_V Action.tensor_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensor_rho {X Y : Action V G} {g : G} : (X ⊗ Y).ρ g = X.ρ g ⊗ Y.ρ g := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_rho Action.tensor_rho @[simp] theorem tensor_hom {W X Y Z : Action V G} (f : W ⟶ X) (g : Y ⟶ Z) : (f ⊗ g).hom = f.hom ⊗ g.hom := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_hom Action.tensor_hom @[simp] theorem whiskerLeft_hom (X : Action V G) {Y Z : Action V G} (f : Y ⟶ Z) : (X ◁ f).hom = X.V ◁ f.hom := rfl @[simp] theorem whiskerRight_hom {X Y : Action V G} (f : X ⟶ Y) (Z : Action V G) : (f ▷ Z).hom = f.hom ▷ Z.V := rfl -- Porting note: removed @[simp] as the simpNF linter complains theorem associator_hom_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).hom = (α_ X.V Y.V Z.V).hom := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.associator_hom_hom Action.associator_hom_hom -- Porting note: removed @[simp] as the simpNF linter complains
Mathlib/RepresentationTheory/Action/Monoidal.lean
90
93
theorem associator_inv_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).inv = (α_ X.V Y.V Z.V).inv := by
dsimp simp
[ " (α_ X Y Z).hom.hom = (α_ X.V Y.V Z.V).hom", " (𝟙 (X.V ⊗ Y.V) ⊗ 𝟙 Z.V) ≫ (α_ X.V Y.V Z.V).hom ≫ (𝟙 X.V ⊗ 𝟙 (Y.V ⊗ Z.V)) = (α_ X.V Y.V Z.V).hom", " (α_ X Y Z).inv.hom = (α_ X.V Y.V Z.V).inv", " ((𝟙 X.V ⊗ 𝟙 (Y.V ⊗ Z.V)) ≫ (α_ X.V Y.V Z.V).inv) ≫ (𝟙 (X.V ⊗ Y.V) ⊗ 𝟙 Z.V) = (α_ X.V Y.V Z.V).inv" ]
[ " (α_ X Y Z).hom.hom = (α_ X.V Y.V Z.V).hom", " (𝟙 (X.V ⊗ Y.V) ⊗ 𝟙 Z.V) ≫ (α_ X.V Y.V Z.V).hom ≫ (𝟙 X.V ⊗ 𝟙 (Y.V ⊗ Z.V)) = (α_ X.V Y.V Z.V).hom" ]
import Mathlib.Geometry.Manifold.MFDeriv.Defs #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Topology Manifold open Set Bundle section DerivativesProperties variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {f f₀ f₁ : M → M'} {x : M} {s t : Set M} {g : M' → M''} {u : Set M'}
Mathlib/Geometry/Manifold/MFDeriv/Basic.lean
46
49
theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x := by
unfold UniqueMDiffWithinAt simp only [preimage_univ, univ_inter] exact I.unique_diff _ (mem_range_self _)
[ " UniqueMDiffWithinAt I univ x", " UniqueDiffWithinAt 𝕜 (↑(extChartAt I x).symm ⁻¹' univ ∩ range ↑I) (↑(extChartAt I x) x)", " UniqueDiffWithinAt 𝕜 (range ↑I) (↑(extChartAt I x) x)" ]
[]
import Mathlib.LinearAlgebra.Matrix.Spectrum import Mathlib.LinearAlgebra.QuadraticForm.Basic #align_import linear_algebra.matrix.pos_def from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566" open scoped ComplexOrder namespace Matrix variable {m n R 𝕜 : Type*} variable [Fintype m] [Fintype n] variable [CommRing R] [PartialOrder R] [StarRing R] [StarOrderedRing R] variable [RCLike 𝕜] open scoped Matrix def PosSemidef (M : Matrix n n R) := M.IsHermitian ∧ ∀ x : n → R, 0 ≤ dotProduct (star x) (M *ᵥ x) #align matrix.pos_semidef Matrix.PosSemidef lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} : PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by refine ⟨fun ⟨_, hP⟩ i ↦ by simpa using hP (Pi.single i 1), ?_⟩ refine fun hd ↦ ⟨isHermitian_diagonal_iff.2 fun i ↦ IsSelfAdjoint.of_nonneg (hd i), ?_⟩ refine fun x ↦ Finset.sum_nonneg fun i _ ↦ ?_ simpa only [mulVec_diagonal, mul_assoc] using conjugate_nonneg (hd i) _ namespace PosSemidef theorem isHermitian {M : Matrix n n R} (hM : M.PosSemidef) : M.IsHermitian := hM.1 theorem re_dotProduct_nonneg {M : Matrix n n 𝕜} (hM : M.PosSemidef) (x : n → 𝕜) : 0 ≤ RCLike.re (dotProduct (star x) (M *ᵥ x)) := RCLike.nonneg_iff.mp (hM.2 _) |>.1 lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A) {m : Type*} [Fintype m] (B : Matrix n m R) : PosSemidef (Bᴴ * A * B) := by constructor · exact isHermitian_conjTranspose_mul_mul B hA.1 · intro x simpa only [star_mulVec, dotProduct_mulVec, vecMul_vecMul] using hA.2 (B *ᵥ x) lemma mul_mul_conjTranspose_same {A : Matrix n n R} (hA : PosSemidef A) {m : Type*} [Fintype m] (B : Matrix m n R): PosSemidef (B * A * Bᴴ) := by simpa only [conjTranspose_conjTranspose] using hA.conjTranspose_mul_mul_same Bᴴ theorem submatrix {M : Matrix n n R} (hM : M.PosSemidef) (e : m → n) : (M.submatrix e e).PosSemidef := by classical rw [(by simp : M = 1 * M * 1), submatrix_mul (he₂ := Function.bijective_id), submatrix_mul (he₂ := Function.bijective_id), submatrix_id_id] simpa only [conjTranspose_submatrix, conjTranspose_one] using conjTranspose_mul_mul_same hM (Matrix.submatrix 1 id e) #align matrix.pos_semidef.submatrix Matrix.PosSemidef.submatrix
Mathlib/LinearAlgebra/Matrix/PosDef.lean
90
93
theorem transpose {M : Matrix n n R} (hM : M.PosSemidef) : Mᵀ.PosSemidef := by
refine ⟨IsHermitian.transpose hM.1, fun x => ?_⟩ convert hM.2 (star x) using 1 rw [mulVec_transpose, Matrix.dotProduct_mulVec, star_star, dotProduct_comm]
[ " (diagonal d).PosSemidef ↔ ∀ (i : n), 0 ≤ d i", " 0 ≤ d i", " (∀ (i : n), 0 ≤ d i) → (diagonal d).PosSemidef", " ∀ (x : n → R), 0 ≤ star x ⬝ᵥ diagonal d *ᵥ x", " 0 ≤ star x i * (diagonal d *ᵥ x) i", " (Bᴴ * A * B).PosSemidef", " (Bᴴ * A * B).IsHermitian", " ∀ (x : m → R), 0 ≤ star x ⬝ᵥ (Bᴴ * A * B) *...
[ " (diagonal d).PosSemidef ↔ ∀ (i : n), 0 ≤ d i", " 0 ≤ d i", " (∀ (i : n), 0 ≤ d i) → (diagonal d).PosSemidef", " ∀ (x : n → R), 0 ≤ star x ⬝ᵥ diagonal d *ᵥ x", " 0 ≤ star x i * (diagonal d *ᵥ x) i", " (Bᴴ * A * B).PosSemidef", " (Bᴴ * A * B).IsHermitian", " ∀ (x : m → R), 0 ≤ star x ⬝ᵥ (Bᴴ * A * B) *...
import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.SimpleGraph.Density import Mathlib.Data.Rat.BigOperators #align_import combinatorics.simple_graph.regularity.energy from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d" open Finset variable {α : Type*} [DecidableEq α] {s : Finset α} (P : Finpartition s) (G : SimpleGraph α) [DecidableRel G.Adj] namespace Finpartition def energy : ℚ := ((∑ uv ∈ P.parts.offDiag, G.edgeDensity uv.1 uv.2 ^ 2) : ℚ) / (P.parts.card : ℚ) ^ 2 #align finpartition.energy Finpartition.energy theorem energy_nonneg : 0 ≤ P.energy G := by exact div_nonneg (Finset.sum_nonneg fun _ _ => sq_nonneg _) <| sq_nonneg _ #align finpartition.energy_nonneg Finpartition.energy_nonneg
Mathlib/Combinatorics/SimpleGraph/Regularity/Energy.lean
46
57
theorem energy_le_one : P.energy G ≤ 1 := div_le_of_nonneg_of_le_mul (sq_nonneg _) zero_le_one <| calc ∑ uv ∈ P.parts.offDiag, G.edgeDensity uv.1 uv.2 ^ 2 ≤ P.parts.offDiag.card • (1 : ℚ) := sum_le_card_nsmul _ _ 1 fun uv _ => (sq_le_one_iff <| G.edgeDensity_nonneg _ _).2 <| G.edgeDensity_le_one _ _ _ = P.parts.offDiag.card := Nat.smul_one_eq_cast _ _ ≤ _ := by
rw [offDiag_card, one_mul] norm_cast rw [sq] exact tsub_le_self
[ " 0 ≤ P.energy G", " ↑P.parts.offDiag.card ≤ 1 * ↑P.parts.card ^ 2", " ↑(P.parts.card * P.parts.card - P.parts.card) ≤ ↑P.parts.card ^ 2", " P.parts.card * P.parts.card - P.parts.card ≤ P.parts.card ^ 2", " P.parts.card * P.parts.card - P.parts.card ≤ P.parts.card * P.parts.card" ]
[ " 0 ≤ P.energy G" ]
import Mathlib.MeasureTheory.Measure.NullMeasurable import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import measure_theory.measure.measure_space from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set open Filter hiding map open Function MeasurableSpace open scoped Classical symmDiff open Topology Filter ENNReal NNReal Interval MeasureTheory variable {α β γ δ ι R R' : Type*} namespace MeasureTheory section variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α} instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) := ⟨fun _s hs => let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs ⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩ #align measure_theory.ae_is_measurably_generated MeasureTheory.ae_isMeasurablyGenerated theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} : (∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by simp only [uIoc_eq_union, mem_union, or_imp, eventually_and] #align measure_theory.ae_uIoc_iff MeasureTheory.ae_uIoc_iff theorem measure_union (hd : Disjoint s₁ s₂) (h : MeasurableSet s₂) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ := measure_union₀ h.nullMeasurableSet hd.aedisjoint #align measure_theory.measure_union MeasureTheory.measure_union theorem measure_union' (hd : Disjoint s₁ s₂) (h : MeasurableSet s₁) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ := measure_union₀' h.nullMeasurableSet hd.aedisjoint #align measure_theory.measure_union' MeasureTheory.measure_union' theorem measure_inter_add_diff (s : Set α) (ht : MeasurableSet t) : μ (s ∩ t) + μ (s \ t) = μ s := measure_inter_add_diff₀ _ ht.nullMeasurableSet #align measure_theory.measure_inter_add_diff MeasureTheory.measure_inter_add_diff theorem measure_diff_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s \ t) + μ (s ∩ t) = μ s := (add_comm _ _).trans (measure_inter_add_diff s ht) #align measure_theory.measure_diff_add_inter MeasureTheory.measure_diff_add_inter theorem measure_union_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by rw [← measure_inter_add_diff (s ∪ t) ht, Set.union_inter_cancel_right, union_diff_right, ← measure_inter_add_diff s ht] ac_rfl #align measure_theory.measure_union_add_inter MeasureTheory.measure_union_add_inter theorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set α) : μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by rw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm] #align measure_theory.measure_union_add_inter' MeasureTheory.measure_union_add_inter' lemma measure_symmDiff_eq (hs : MeasurableSet s) (ht : MeasurableSet t) : μ (s ∆ t) = μ (s \ t) + μ (t \ s) := by simpa only [symmDiff_def, sup_eq_union] using measure_union disjoint_sdiff_sdiff (ht.diff hs) lemma measure_symmDiff_le (s t u : Set α) : μ (s ∆ u) ≤ μ (s ∆ t) + μ (t ∆ u) := le_trans (μ.mono <| symmDiff_triangle s t u) (measure_union_le (s ∆ t) (t ∆ u)) theorem measure_add_measure_compl (h : MeasurableSet s) : μ s + μ sᶜ = μ univ := measure_add_measure_compl₀ h.nullMeasurableSet #align measure_theory.measure_add_measure_compl MeasureTheory.measure_add_measure_compl theorem measure_biUnion₀ {s : Set β} {f : β → Set α} (hs : s.Countable) (hd : s.Pairwise (AEDisjoint μ on f)) (h : ∀ b ∈ s, NullMeasurableSet (f b) μ) : μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) := by haveI := hs.toEncodable rw [biUnion_eq_iUnion] exact measure_iUnion₀ (hd.on_injective Subtype.coe_injective fun x => x.2) fun x => h x x.2 #align measure_theory.measure_bUnion₀ MeasureTheory.measure_biUnion₀ theorem measure_biUnion {s : Set β} {f : β → Set α} (hs : s.Countable) (hd : s.PairwiseDisjoint f) (h : ∀ b ∈ s, MeasurableSet (f b)) : μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) := measure_biUnion₀ hs hd.aedisjoint fun b hb => (h b hb).nullMeasurableSet #align measure_theory.measure_bUnion MeasureTheory.measure_biUnion theorem measure_sUnion₀ {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise (AEDisjoint μ)) (h : ∀ s ∈ S, NullMeasurableSet s μ) : μ (⋃₀ S) = ∑' s : S, μ s := by rw [sUnion_eq_biUnion, measure_biUnion₀ hs hd h] #align measure_theory.measure_sUnion₀ MeasureTheory.measure_sUnion₀
Mathlib/MeasureTheory/Measure/MeasureSpace.lean
170
172
theorem measure_sUnion {S : Set (Set α)} (hs : S.Countable) (hd : S.Pairwise Disjoint) (h : ∀ s ∈ S, MeasurableSet s) : μ (⋃₀ S) = ∑' s : S, μ s := by
rw [sUnion_eq_biUnion, measure_biUnion hs hd h]
[ " (∀ᵐ (x : α) ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ (x : α) ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ (x : α) ∂μ, x ∈ Ioc b a → P x", " μ (s ∪ t) + μ (s ∩ t) = μ s + μ t", " μ t + μ (s \\ t) + μ (s ∩ t) = μ (s ∩ t) + μ (s \\ t) + μ t", " μ (s ∆ t) = μ (s \\ t) + μ (t \\ s)", " μ (⋃ b ∈ s, f b) = ∑' (p : ↑s), μ (f ↑p)", " μ (⋃ x, ...
[ " (∀ᵐ (x : α) ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ (x : α) ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ (x : α) ∂μ, x ∈ Ioc b a → P x", " μ (s ∪ t) + μ (s ∩ t) = μ s + μ t", " μ t + μ (s \\ t) + μ (s ∩ t) = μ (s ∩ t) + μ (s \\ t) + μ t", " μ (s ∆ t) = μ (s \\ t) + μ (t \\ s)", " μ (⋃ b ∈ s, f b) = ∑' (p : ↑s), μ (f ↑p)", " μ (⋃ x, ...
import Mathlib.Algebra.Polynomial.Degree.CardPowDegree import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue import Mathlib.RingTheory.Ideal.LocalRing #align_import number_theory.class_number.admissible_card_pow_degree from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" namespace Polynomial open Polynomial open AbsoluteValue Real variable {Fq : Type*} [Fintype Fq] theorem exists_eq_polynomial [Semiring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (hb : natDegree b ≤ d) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀ := by -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `0`, ... `degree b - 1` ≤ `d - 1`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff j have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne ext j -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · rw [coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj), coeff_eq_zero_of_degree_lt (lt_of_lt_of_le (hA _) hbj)] -- So we only need to look for the coefficients between `0` and `deg b`. rw [not_le] at hbj apply congr_fun i_eq.symm ⟨j, _⟩ exact lt_of_lt_of_le (coe_lt_degree.mp hbj) hb #align polynomial.exists_eq_polynomial Polynomial.exists_eq_polynomial theorem exists_approx_polynomial_aux [Ring Fq] {d : ℕ} {m : ℕ} (hm : Fintype.card Fq ^ d ≤ m) (b : Fq[X]) (A : Fin m.succ → Fq[X]) (hA : ∀ i, degree (A i) < degree b) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ degree (A i₁ - A i₀) < ↑(natDegree b - d) := by have hb : b ≠ 0 := by rintro rfl specialize hA 0 rw [degree_zero] at hA exact not_lt_of_le bot_le hA -- Since there are > q^d elements of A, and only q^d choices for the highest `d` coefficients, -- there must be two elements of A with the same coefficients at -- `degree b - 1`, ... `degree b - d`. -- In other words, the following map is not injective: set f : Fin m.succ → Fin d → Fq := fun i j => (A i).coeff (natDegree b - j.succ) have : Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ) := by simpa using lt_of_le_of_lt hm (Nat.lt_succ_self m) -- Therefore, the differences have all coefficients higher than `deg b - d` equal. obtain ⟨i₀, i₁, i_ne, i_eq⟩ := Fintype.exists_ne_map_eq_of_card_lt f this use i₀, i₁, i_ne refine (degree_lt_iff_coeff_zero _ _).mpr fun j hj => ?_ -- The coefficients higher than `deg b` are the same because they are equal to 0. by_cases hbj : degree b ≤ j · refine coeff_eq_zero_of_degree_lt (lt_of_lt_of_le ?_ hbj) exact lt_of_le_of_lt (degree_sub_le _ _) (max_lt (hA _) (hA _)) -- So we only need to look for the coefficients between `deg b - d` and `deg b`. rw [coeff_sub, sub_eq_zero] rw [not_le, degree_eq_natDegree hb] at hbj have hbj : j < natDegree b := (@WithBot.coe_lt_coe _ _ _).mp hbj have hj : natDegree b - j.succ < d := by by_cases hd : natDegree b < d · exact lt_of_le_of_lt tsub_le_self hd · rw [not_lt] at hd have := lt_of_le_of_lt hj (Nat.lt_succ_self j) rwa [tsub_lt_iff_tsub_lt hd hbj] at this have : j = b.natDegree - (natDegree b - j.succ).succ := by rw [← Nat.succ_sub hbj, Nat.succ_sub_succ, tsub_tsub_cancel_of_le hbj.le] convert congr_fun i_eq.symm ⟨natDegree b - j.succ, hj⟩ #align polynomial.exists_approx_polynomial_aux Polynomial.exists_approx_polynomial_aux variable [Field Fq]
Mathlib/NumberTheory/ClassNumber/AdmissibleCardPowDegree.lean
106
149
theorem exists_approx_polynomial {b : Fq[X]} (hb : b ≠ 0) {ε : ℝ} (hε : 0 < ε) (A : Fin (Fintype.card Fq ^ ⌈-log ε / log (Fintype.card Fq)⌉₊).succ → Fq[X]) : ∃ i₀ i₁, i₀ ≠ i₁ ∧ (cardPowDegree (A i₁ % b - A i₀ % b) : ℝ) < cardPowDegree b • ε := by
have hbε : 0 < cardPowDegree b • ε := by rw [Algebra.smul_def, eq_intCast] exact mul_pos (Int.cast_pos.mpr (AbsoluteValue.pos _ hb)) hε have one_lt_q : 1 < Fintype.card Fq := Fintype.one_lt_card have one_lt_q' : (1 : ℝ) < Fintype.card Fq := by assumption_mod_cast have q_pos : 0 < Fintype.card Fq := by omega have q_pos' : (0 : ℝ) < Fintype.card Fq := by assumption_mod_cast -- If `b` is already small enough, then the remainders are equal and we are done. by_cases le_b : b.natDegree ≤ ⌈-log ε / log (Fintype.card Fq)⌉₊ · obtain ⟨i₀, i₁, i_ne, mod_eq⟩ := exists_eq_polynomial le_rfl b le_b (fun i => A i % b) fun i => EuclideanDomain.mod_lt (A i) hb refine ⟨i₀, i₁, i_ne, ?_⟩ rwa [mod_eq, sub_self, map_zero, Int.cast_zero] -- Otherwise, it suffices to choose two elements whose difference is of small enough degree. rw [not_le] at le_b obtain ⟨i₀, i₁, i_ne, deg_lt⟩ := exists_approx_polynomial_aux le_rfl b (fun i => A i % b) fun i => EuclideanDomain.mod_lt (A i) hb use i₀, i₁, i_ne -- Again, if the remainders are equal we are done. by_cases h : A i₁ % b = A i₀ % b · rwa [h, sub_self, map_zero, Int.cast_zero] have h' : A i₁ % b - A i₀ % b ≠ 0 := mt sub_eq_zero.mp h -- If the remainders are not equal, we'll show their difference is of small degree. -- In particular, we'll show the degree is less than the following: suffices (natDegree (A i₁ % b - A i₀ % b) : ℝ) < b.natDegree + log ε / log (Fintype.card Fq) by rwa [← Real.log_lt_log_iff (Int.cast_pos.mpr (cardPowDegree.pos h')) hbε, cardPowDegree_nonzero _ h', cardPowDegree_nonzero _ hb, Algebra.smul_def, eq_intCast, Int.cast_pow, Int.cast_natCast, Int.cast_pow, Int.cast_natCast, log_mul (pow_ne_zero _ q_pos'.ne') hε.ne', ← rpow_natCast, ← rpow_natCast, log_rpow q_pos', log_rpow q_pos', ← lt_div_iff (log_pos one_lt_q'), add_div, mul_div_cancel_right₀ _ (log_pos one_lt_q').ne'] -- And that result follows from manipulating the result from `exists_approx_polynomial_aux` -- to turn the `-⌈-stuff⌉₊` into `+ stuff`. apply lt_of_lt_of_le (Nat.cast_lt.mpr (WithBot.coe_lt_coe.mp _)) _ swap · convert deg_lt rw [degree_eq_natDegree h']; rfl rw [← sub_neg_eq_add, neg_div] refine le_trans ?_ (sub_le_sub_left (Nat.le_ceil _) (b.natDegree : ℝ)) rw [← neg_div] exact le_of_eq (Nat.cast_sub le_b.le)
[ " ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀", " Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ)", " A i₁ = A i₀", " (A i₁).coeff j = (A i₀).coeff j", " j < d", " ∃ i₀ i₁, i₀ ≠ i₁ ∧ (A i₁ - A i₀).degree < ↑(b.natDegree - d)", " b ≠ 0", " False", " (A i₁ - A i₀).degree < ↑(b.natDegree - d)", " (A i₁ - A ...
[ " ∃ i₀ i₁, i₀ ≠ i₁ ∧ A i₁ = A i₀", " Fintype.card (Fin d → Fq) < Fintype.card (Fin m.succ)", " A i₁ = A i₀", " (A i₁).coeff j = (A i₀).coeff j", " j < d", " ∃ i₀ i₁, i₀ ≠ i₁ ∧ (A i₁ - A i₀).degree < ↑(b.natDegree - d)", " b ≠ 0", " False", " (A i₁ - A i₀).degree < ↑(b.natDegree - d)", " (A i₁ - A ...
import Mathlib.Topology.Order.Basic import Mathlib.Data.Set.Pointwise.Basic open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section LinearOrder variable [TopologicalSpace α] [LinearOrder α] section OrderTopology variable [OrderTopology α] open List in theorem TFAE_mem_nhdsWithin_Ioi {a b : α} (hab : a < b) (s : Set α) : TFAE [s ∈ 𝓝[>] a, s ∈ 𝓝[Ioc a b] a, s ∈ 𝓝[Ioo a b] a, ∃ u ∈ Ioc a b, Ioo a u ⊆ s, ∃ u ∈ Ioi a, Ioo a u ⊆ s] := by tfae_have 1 ↔ 2 · rw [nhdsWithin_Ioc_eq_nhdsWithin_Ioi hab] tfae_have 1 ↔ 3 · rw [nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab] tfae_have 4 → 5 · exact fun ⟨u, umem, hu⟩ => ⟨u, umem.1, hu⟩ tfae_have 5 → 1 · rintro ⟨u, hau, hu⟩ exact mem_of_superset (Ioo_mem_nhdsWithin_Ioi ⟨le_refl a, hau⟩) hu tfae_have 1 → 4 · intro h rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 h with ⟨v, va, hv⟩ rcases exists_Ico_subset_of_mem_nhds' va hab with ⟨u, au, hu⟩ exact ⟨u, au, fun x hx => hv ⟨hu ⟨le_of_lt hx.1, hx.2⟩, hx.1⟩⟩ tfae_finish #align tfae_mem_nhds_within_Ioi TFAE_mem_nhdsWithin_Ioi theorem mem_nhdsWithin_Ioi_iff_exists_mem_Ioc_Ioo_subset {a u' : α} {s : Set α} (hu' : a < u') : s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioc a u', Ioo a u ⊆ s := (TFAE_mem_nhdsWithin_Ioi hu' s).out 0 3 #align mem_nhds_within_Ioi_iff_exists_mem_Ioc_Ioo_subset mem_nhdsWithin_Ioi_iff_exists_mem_Ioc_Ioo_subset theorem mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' {a u' : α} {s : Set α} (hu' : a < u') : s ∈ 𝓝[>] a ↔ ∃ u ∈ Ioi a, Ioo a u ⊆ s := (TFAE_mem_nhdsWithin_Ioi hu' s).out 0 4 #align mem_nhds_within_Ioi_iff_exists_Ioo_subset' mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' theorem nhdsWithin_Ioi_basis' {a : α} (h : ∃ b, a < b) : (𝓝[>] a).HasBasis (a < ·) (Ioo a) := let ⟨_, h⟩ := h ⟨fun _ => mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' h⟩ lemma nhdsWithin_Ioi_basis [NoMaxOrder α] (a : α) : (𝓝[>] a).HasBasis (a < ·) (Ioo a) := nhdsWithin_Ioi_basis' <| exists_gt a
Mathlib/Topology/Order/LeftRightNhds.lean
82
87
theorem nhdsWithin_Ioi_eq_bot_iff {a : α} : 𝓝[>] a = ⊥ ↔ IsTop a ∨ ∃ b, a ⋖ b := by
by_cases ha : IsTop a · simp [ha, ha.isMax.Ioi_eq] · simp only [ha, false_or] rw [isTop_iff_isMax, not_isMax_iff] at ha simp only [(nhdsWithin_Ioi_basis' ha).eq_bot_iff, covBy_iff_Ioo_eq]
[ " [s ∈ 𝓝[>] a, s ∈ 𝓝[Ioc a b] a, s ∈ 𝓝[Ioo a b] a, ∃ u ∈ Ioc a b, Ioo a u ⊆ s, ∃ u ∈ Ioi a, Ioo a u ⊆ s].TFAE", " s ∈ 𝓝[>] a ↔ s ∈ 𝓝[Ioc a b] a", " s ∈ 𝓝[>] a ↔ s ∈ 𝓝[Ioo a b] a", " (∃ u ∈ Ioc a b, Ioo a u ⊆ s) → ∃ u ∈ Ioi a, Ioo a u ⊆ s", " (∃ u ∈ Ioi a, Ioo a u ⊆ s) → s ∈ 𝓝[>] a", " s ∈ 𝓝[>] a"...
[ " [s ∈ 𝓝[>] a, s ∈ 𝓝[Ioc a b] a, s ∈ 𝓝[Ioo a b] a, ∃ u ∈ Ioc a b, Ioo a u ⊆ s, ∃ u ∈ Ioi a, Ioo a u ⊆ s].TFAE", " s ∈ 𝓝[>] a ↔ s ∈ 𝓝[Ioc a b] a", " s ∈ 𝓝[>] a ↔ s ∈ 𝓝[Ioo a b] a", " (∃ u ∈ Ioc a b, Ioo a u ⊆ s) → ∃ u ∈ Ioi a, Ioo a u ⊆ s", " (∃ u ∈ Ioi a, Ioo a u ⊆ s) → s ∈ 𝓝[>] a", " s ∈ 𝓝[>] a"...
import Mathlib.NumberTheory.Divisors import Mathlib.Data.Nat.Digits import Mathlib.Data.Nat.MaxPowDiv import Mathlib.Data.Nat.Multiplicity import Mathlib.Tactic.IntervalCases #align_import number_theory.padics.padic_val from "leanprover-community/mathlib"@"60fa54e778c9e85d930efae172435f42fb0d71f7" universe u open Nat open Rat open multiplicity def padicValNat (p : ℕ) (n : ℕ) : ℕ := if h : p ≠ 1 ∧ 0 < n then (multiplicity p n).get (multiplicity.finite_nat_iff.2 h) else 0 #align padic_val_nat padicValNat namespace padicValNat open multiplicity variable {p : ℕ} @[simp] protected theorem zero : padicValNat p 0 = 0 := by simp [padicValNat] #align padic_val_nat.zero padicValNat.zero @[simp] protected theorem one : padicValNat p 1 = 0 := by unfold padicValNat split_ifs · simp · rfl #align padic_val_nat.one padicValNat.one @[simp] theorem self (hp : 1 < p) : padicValNat p p = 1 := by have neq_one : ¬p = 1 ↔ True := iff_of_true hp.ne' trivial have eq_zero_false : p = 0 ↔ False := iff_false_intro (zero_lt_one.trans hp).ne' simp [padicValNat, neq_one, eq_zero_false] #align padic_val_nat.self padicValNat.self @[simp]
Mathlib/NumberTheory/Padics/PadicVal.lean
108
110
theorem eq_zero_iff {n : ℕ} : padicValNat p n = 0 ↔ p = 1 ∨ n = 0 ∨ ¬p ∣ n := by
simp only [padicValNat, dite_eq_right_iff, PartENat.get_eq_iff_eq_coe, Nat.cast_zero, multiplicity_eq_zero, and_imp, pos_iff_ne_zero, Ne, ← or_iff_not_imp_left]
[ " padicValNat p 0 = 0", " padicValNat p 1 = 0", " (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0", " (multiplicity p 1).get ⋯ = 0", " 0 = 0", " padicValNat p p = 1", " padicValNat p n = 0 ↔ p = 1 ∨ n = 0 ∨ ¬p ∣ n" ]
[ " padicValNat p 0 = 0", " padicValNat p 1 = 0", " (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0", " (multiplicity p 1).get ⋯ = 0", " 0 = 0", " padicValNat p p = 1" ]
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.CategoryTheory.Preadditive.FunctorCategory import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.CategoryTheory.Sites.EqualizerSheafCondition #align_import category_theory.sites.sheaf from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presheaf variable {C : Type u₁} [Category.{v₁} C] variable {A : Type u₂} [Category.{v₂} A] variable (J : GrothendieckTopology C) -- We follow https://stacks.math.columbia.edu/tag/00VL definition 00VR def IsSheaf (P : Cᵒᵖ ⥤ A) : Prop := ∀ E : A, Presieve.IsSheaf J (P ⋙ coyoneda.obj (op E)) #align category_theory.presheaf.is_sheaf CategoryTheory.Presheaf.IsSheaf attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike in def IsSeparated (P : Cᵒᵖ ⥤ A) [ConcreteCategory A] : Prop := ∀ (X : C) (S : Sieve X) (_ : S ∈ J X) (x y : P.obj (op X)), (∀ (Y : C) (f : Y ⟶ X) (_ : S f), P.map f.op x = P.map f.op y) → x = y variable {J} def IsSheaf.amalgamate {A : Type u₂} [Category.{v₂} A] {E : A} {X : C} {P : Cᵒᵖ ⥤ A} (hP : Presheaf.IsSheaf J P) (S : J.Cover X) (x : ∀ I : S.Arrow, E ⟶ P.obj (op I.Y)) (hx : ∀ I : S.Relation, x I.fst ≫ P.map I.g₁.op = x I.snd ≫ P.map I.g₂.op) : E ⟶ P.obj (op X) := (hP _ _ S.condition).amalgamate (fun Y f hf => x ⟨Y, f, hf⟩) fun Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ w => hx ⟨Y₁, Y₂, Z, g₁, g₂, f₁, f₂, h₁, h₂, w⟩ #align category_theory.presheaf.is_sheaf.amalgamate CategoryTheory.Presheaf.IsSheaf.amalgamate @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Sites/Sheaf.lean
248
255
theorem IsSheaf.amalgamate_map {A : Type u₂} [Category.{v₂} A] {E : A} {X : C} {P : Cᵒᵖ ⥤ A} (hP : Presheaf.IsSheaf J P) (S : J.Cover X) (x : ∀ I : S.Arrow, E ⟶ P.obj (op I.Y)) (hx : ∀ I : S.Relation, x I.fst ≫ P.map I.g₁.op = x I.snd ≫ P.map I.g₂.op) (I : S.Arrow) : hP.amalgamate S x hx ≫ P.map I.f.op = x _ := by
rcases I with ⟨Y, f, hf⟩ apply @Presieve.IsSheafFor.valid_glue _ _ _ _ _ _ (hP _ _ S.condition) (fun Y f hf => x ⟨Y, f, hf⟩) (fun Y₁ Y₂ Z g₁ g₂ f₁ f₂ h₁ h₂ w => hx ⟨Y₁, Y₂, Z, g₁, g₂, f₁, f₂, h₁, h₂, w⟩) f hf
[ " hP.amalgamate S x hx ≫ P.map I.f.op = x I", " hP.amalgamate S x hx ≫ P.map { Y := Y, f := f, hf := hf }.f.op = x { Y := Y, f := f, hf := hf }" ]
[]
import Mathlib.SetTheory.Game.Short #align_import set_theory.game.state from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225" universe u namespace SetTheory namespace PGame class State (S : Type u) where turnBound : S → ℕ l : S → Finset S r : S → Finset S left_bound : ∀ {s t : S}, t ∈ l s → turnBound t < turnBound s right_bound : ∀ {s t : S}, t ∈ r s → turnBound t < turnBound s #align pgame.state SetTheory.PGame.State open State variable {S : Type u} [State S]
Mathlib/SetTheory/Game/State.lean
50
54
theorem turnBound_ne_zero_of_left_move {s t : S} (m : t ∈ l s) : turnBound s ≠ 0 := by
intro h have t := left_bound m rw [h] at t exact Nat.not_succ_le_zero _ t
[ " turnBound s ≠ 0", " False" ]
[]
import Mathlib.Analysis.RCLike.Lemmas import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad" set_option linter.uppercaseLean3 false noncomputable section open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter open scoped NNReal ENNReal MeasureTheory namespace MeasureTheory section variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F] theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top #align measure_theory.mem_ℒp.integrable_sq MeasureTheory.Memℒp.integrable_sq
Mathlib/MeasureTheory/Function/L2Space.lean
46
51
theorem memℒp_two_iff_integrable_sq_norm {f : α → F} (hf : AEStronglyMeasurable f μ) : Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ := by
rw [← memℒp_one_iff_integrable] convert (memℒp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm · simp · rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top]
[ " Integrable (fun x => f x ^ 2) μ", " Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ", " Memℒp f 2 μ ↔ Memℒp (fun x => ‖f x‖ ^ 2) 1 μ", " ‖f x✝‖ ^ 2 = ‖f x✝‖ ^ ENNReal.toReal 2", " 1 = 2 / 2" ]
[ " Integrable (fun x => f x ^ 2) μ" ]
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Set.Sigma #align_import data.finset.sigma from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Multiset variable {ι : Type*} namespace Finset section SigmaLift variable {α β γ : ι → Type*} [DecidableEq ι] def sigmaLift (f : ∀ ⦃i⦄, α i → β i → Finset (γ i)) (a : Sigma α) (b : Sigma β) : Finset (Sigma γ) := dite (a.1 = b.1) (fun h => (f (h ▸ a.2) b.2).map <| Embedding.sigmaMk _) fun _ => ∅ #align finset.sigma_lift Finset.sigmaLift theorem mem_sigmaLift (f : ∀ ⦃i⦄, α i → β i → Finset (γ i)) (a : Sigma α) (b : Sigma β) (x : Sigma γ) : x ∈ sigmaLift f a b ↔ ∃ (ha : a.1 = x.1) (hb : b.1 = x.1), x.2 ∈ f (ha ▸ a.2) (hb ▸ b.2) := by obtain ⟨⟨i, a⟩, j, b⟩ := a, b obtain rfl | h := Decidable.eq_or_ne i j · constructor · simp_rw [sigmaLift] simp only [dite_eq_ite, ite_true, mem_map, Embedding.sigmaMk_apply, forall_exists_index, and_imp] rintro x hx rfl exact ⟨rfl, rfl, hx⟩ · rintro ⟨⟨⟩, ⟨⟩, hx⟩ rw [sigmaLift, dif_pos rfl, mem_map] exact ⟨_, hx, by simp [Sigma.ext_iff]⟩ · rw [sigmaLift, dif_neg h] refine iff_of_false (not_mem_empty _) ?_ rintro ⟨⟨⟩, ⟨⟩, _⟩ exact h rfl #align finset.mem_sigma_lift Finset.mem_sigmaLift
Mathlib/Data/Finset/Sigma.lean
176
181
theorem mk_mem_sigmaLift (f : ∀ ⦃i⦄, α i → β i → Finset (γ i)) (i : ι) (a : α i) (b : β i) (x : γ i) : (⟨i, x⟩ : Sigma γ) ∈ sigmaLift f ⟨i, a⟩ ⟨i, b⟩ ↔ x ∈ f a b := by
rw [sigmaLift, dif_pos rfl, mem_map] refine ⟨?_, fun hx => ⟨_, hx, rfl⟩⟩ rintro ⟨x, hx, _, rfl⟩ exact hx
[ " x ∈ sigmaLift f a b ↔ ∃ (ha : a.fst = x.fst) (hb : b.fst = x.fst), x.snd ∈ f (ha ▸ a.snd) (hb ▸ b.snd)", " x ∈ sigmaLift f ⟨i, a⟩ ⟨j, b⟩ ↔\n ∃ (ha : ⟨i, a⟩.fst = x.fst) (hb : ⟨j, b⟩.fst = x.fst), x.snd ∈ f (ha ▸ ⟨i, a⟩.snd) (hb ▸ ⟨j, b⟩.snd)", " x ∈ sigmaLift f ⟨i, a⟩ ⟨i, b⟩ ↔\n ∃ (ha : ⟨i, a⟩.fst = x.f...
[ " x ∈ sigmaLift f a b ↔ ∃ (ha : a.fst = x.fst) (hb : b.fst = x.fst), x.snd ∈ f (ha ▸ a.snd) (hb ▸ b.snd)", " x ∈ sigmaLift f ⟨i, a⟩ ⟨j, b⟩ ↔\n ∃ (ha : ⟨i, a⟩.fst = x.fst) (hb : ⟨j, b⟩.fst = x.fst), x.snd ∈ f (ha ▸ ⟨i, a⟩.snd) (hb ▸ ⟨j, b⟩.snd)", " x ∈ sigmaLift f ⟨i, a⟩ ⟨i, b⟩ ↔\n ∃ (ha : ⟨i, a⟩.fst = x.f...
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Induction #align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" set_option linter.uppercaseLean3 false noncomputable section open Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v w y variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} section variable [Semiring S] variable (f : R →+* S) (x : S) irreducible_def eval₂ (p : R[X]) : S := p.sum fun e a => f a * x ^ e #align polynomial.eval₂ Polynomial.eval₂ theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by rw [eval₂_def] #align polynomial.eval₂_eq_sum Polynomial.eval₂_eq_sum theorem eval₂_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R →+* S} {s t : S} {φ ψ : R[X]} : f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ := by rintro rfl rfl rfl; rfl #align polynomial.eval₂_congr Polynomial.eval₂_congr @[simp] theorem eval₂_at_zero : p.eval₂ f 0 = f (coeff p 0) := by simp (config := { contextual := true }) only [eval₂_eq_sum, zero_pow_eq, mul_ite, mul_zero, mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff, RingHom.map_zero, imp_true_iff, eq_self_iff_true] #align polynomial.eval₂_at_zero Polynomial.eval₂_at_zero @[simp] theorem eval₂_zero : (0 : R[X]).eval₂ f x = 0 := by simp [eval₂_eq_sum] #align polynomial.eval₂_zero Polynomial.eval₂_zero @[simp] theorem eval₂_C : (C a).eval₂ f x = f a := by simp [eval₂_eq_sum] #align polynomial.eval₂_C Polynomial.eval₂_C @[simp] theorem eval₂_X : X.eval₂ f x = x := by simp [eval₂_eq_sum] #align polynomial.eval₂_X Polynomial.eval₂_X @[simp] theorem eval₂_monomial {n : ℕ} {r : R} : (monomial n r).eval₂ f x = f r * x ^ n := by simp [eval₂_eq_sum] #align polynomial.eval₂_monomial Polynomial.eval₂_monomial @[simp] theorem eval₂_X_pow {n : ℕ} : (X ^ n).eval₂ f x = x ^ n := by rw [X_pow_eq_monomial] convert eval₂_monomial f x (n := n) (r := 1) simp #align polynomial.eval₂_X_pow Polynomial.eval₂_X_pow @[simp] theorem eval₂_add : (p + q).eval₂ f x = p.eval₂ f x + q.eval₂ f x := by simp only [eval₂_eq_sum] apply sum_add_index <;> simp [add_mul] #align polynomial.eval₂_add Polynomial.eval₂_add @[simp] theorem eval₂_one : (1 : R[X]).eval₂ f x = 1 := by rw [← C_1, eval₂_C, f.map_one] #align polynomial.eval₂_one Polynomial.eval₂_one set_option linter.deprecated false in @[simp] theorem eval₂_bit0 : (bit0 p).eval₂ f x = bit0 (p.eval₂ f x) := by rw [bit0, eval₂_add, bit0] #align polynomial.eval₂_bit0 Polynomial.eval₂_bit0 set_option linter.deprecated false in @[simp] theorem eval₂_bit1 : (bit1 p).eval₂ f x = bit1 (p.eval₂ f x) := by rw [bit1, eval₂_add, eval₂_bit0, eval₂_one, bit1] #align polynomial.eval₂_bit1 Polynomial.eval₂_bit1 @[simp] theorem eval₂_smul (g : R →+* S) (p : R[X]) (x : S) {s : R} : eval₂ g x (s • p) = g s * eval₂ g x p := by have A : p.natDegree < p.natDegree.succ := Nat.lt_succ_self _ have B : (s • p).natDegree < p.natDegree.succ := (natDegree_smul_le _ _).trans_lt A rw [eval₂_eq_sum, eval₂_eq_sum, sum_over_range' _ _ _ A, sum_over_range' _ _ _ B] <;> simp [mul_sum, mul_assoc] #align polynomial.eval₂_smul Polynomial.eval₂_smul @[simp] theorem eval₂_C_X : eval₂ C X p = p := Polynomial.induction_on' p (fun p q hp hq => by simp [hp, hq]) fun n x => by rw [eval₂_monomial, ← smul_X_eq_monomial, C_mul'] #align polynomial.eval₂_C_X Polynomial.eval₂_C_X @[simps] def eval₂AddMonoidHom : R[X] →+ S where toFun := eval₂ f x map_zero' := eval₂_zero _ _ map_add' _ _ := eval₂_add _ _ #align polynomial.eval₂_add_monoid_hom Polynomial.eval₂AddMonoidHom #align polynomial.eval₂_add_monoid_hom_apply Polynomial.eval₂AddMonoidHom_apply @[simp]
Mathlib/Algebra/Polynomial/Eval.lean
135
139
theorem eval₂_natCast (n : ℕ) : (n : R[X]).eval₂ f x = n := by
induction' n with n ih -- Porting note: `Nat.zero_eq` is required. · simp only [eval₂_zero, Nat.cast_zero, Nat.zero_eq] · rw [n.cast_succ, eval₂_add, ih, eval₂_one, n.cast_succ]
[ " eval₂ f x p = p.sum fun e a => f a * x ^ e", " f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ", " eval₂ f s φ = eval₂ f s φ", " eval₂ f 0 p = f (p.coeff 0)", " eval₂ f x 0 = 0", " eval₂ f x (C a) = f a", " eval₂ f x X = x", " eval₂ f x ((monomial n) r) = f r * x ^ n", " eval₂ f x (X ^ n) = x ^ ...
[ " eval₂ f x p = p.sum fun e a => f a * x ^ e", " f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ", " eval₂ f s φ = eval₂ f s φ", " eval₂ f 0 p = f (p.coeff 0)", " eval₂ f x 0 = 0", " eval₂ f x (C a) = f a", " eval₂ f x X = x", " eval₂ f x ((monomial n) r) = f r * x ^ n", " eval₂ f x (X ^ n) = x ^ ...
import Mathlib.CategoryTheory.Comma.Basic #align_import category_theory.arrow from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" namespace CategoryTheory universe v u -- morphism levels before object levels. See note [CategoryTheory universes]. variable {T : Type u} [Category.{v} T] section variable (T) def Arrow := Comma.{v, v, v} (𝟭 T) (𝟭 T) #align category_theory.arrow CategoryTheory.Arrow instance : Category (Arrow T) := commaCategory -- Satisfying the inhabited linter instance Arrow.inhabited [Inhabited T] : Inhabited (Arrow T) where default := show Comma (𝟭 T) (𝟭 T) from default #align category_theory.arrow.inhabited CategoryTheory.Arrow.inhabited end namespace Arrow @[ext] lemma hom_ext {X Y : Arrow T} (f g : X ⟶ Y) (h₁ : f.left = g.left) (h₂ : f.right = g.right) : f = g := CommaMorphism.ext _ _ h₁ h₂ @[simp] theorem id_left (f : Arrow T) : CommaMorphism.left (𝟙 f) = 𝟙 f.left := rfl #align category_theory.arrow.id_left CategoryTheory.Arrow.id_left @[simp] theorem id_right (f : Arrow T) : CommaMorphism.right (𝟙 f) = 𝟙 f.right := rfl #align category_theory.arrow.id_right CategoryTheory.Arrow.id_right -- Porting note (#10688): added to ease automation @[simp, reassoc] theorem comp_left {X Y Z : Arrow T} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).left = f.left ≫ g.left := rfl -- Porting note (#10688): added to ease automation @[simp, reassoc] theorem comp_right {X Y Z : Arrow T} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).right = f.right ≫ g.right := rfl @[simps] def mk {X Y : T} (f : X ⟶ Y) : Arrow T where left := X right := Y hom := f #align category_theory.arrow.mk CategoryTheory.Arrow.mk @[simp] theorem mk_eq (f : Arrow T) : Arrow.mk f.hom = f := by cases f rfl #align category_theory.arrow.mk_eq CategoryTheory.Arrow.mk_eq theorem mk_injective (A B : T) : Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T) := fun f g h => by cases h rfl #align category_theory.arrow.mk_injective CategoryTheory.Arrow.mk_injective theorem mk_inj (A B : T) {f g : A ⟶ B} : Arrow.mk f = Arrow.mk g ↔ f = g := (mk_injective A B).eq_iff #align category_theory.arrow.mk_inj CategoryTheory.Arrow.mk_inj instance {X Y : T} : CoeOut (X ⟶ Y) (Arrow T) where coe := mk @[simps] def homMk {f g : Arrow T} {u : f.left ⟶ g.left} {v : f.right ⟶ g.right} (w : u ≫ g.hom = f.hom ≫ v) : f ⟶ g where left := u right := v w := w #align category_theory.arrow.hom_mk CategoryTheory.Arrow.homMk @[simps] def homMk' {X Y : T} {f : X ⟶ Y} {P Q : T} {g : P ⟶ Q} {u : X ⟶ P} {v : Y ⟶ Q} (w : u ≫ g = f ≫ v) : Arrow.mk f ⟶ Arrow.mk g where left := u right := v w := w #align category_theory.arrow.hom_mk' CategoryTheory.Arrow.homMk' @[reassoc (attr := simp, nolint simpNF)] theorem w {f g : Arrow T} (sq : f ⟶ g) : sq.left ≫ g.hom = f.hom ≫ sq.right := sq.w #align category_theory.arrow.w CategoryTheory.Arrow.w -- `w_mk_left` is not needed, as it is a consequence of `w` and `mk_hom`. @[reassoc (attr := simp)] theorem w_mk_right {f : Arrow T} {X Y : T} {g : X ⟶ Y} (sq : f ⟶ mk g) : sq.left ≫ g = f.hom ≫ sq.right := sq.w #align category_theory.arrow.w_mk_right CategoryTheory.Arrow.w_mk_right theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left] [IsIso ff.right] : IsIso ff where out := by let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by simp)⟩ apply Exists.intro inverse aesop_cat #align category_theory.arrow.is_iso_of_iso_left_of_is_iso_right CategoryTheory.Arrow.isIso_of_isIso_left_of_isIso_right @[simps!] def isoMk {f g : Arrow T} (l : f.left ≅ g.left) (r : f.right ≅ g.right) (h : l.hom ≫ g.hom = f.hom ≫ r.hom := by aesop_cat) : f ≅ g := Comma.isoMk l r h #align category_theory.arrow.iso_mk CategoryTheory.Arrow.isoMk abbrev isoMk' {W X Y Z : T} (f : W ⟶ X) (g : Y ⟶ Z) (e₁ : W ≅ Y) (e₂ : X ≅ Z) (h : e₁.hom ≫ g = f ≫ e₂.hom := by aesop_cat) : Arrow.mk f ≅ Arrow.mk g := Arrow.isoMk e₁ e₂ h #align category_theory.arrow.iso_mk' CategoryTheory.Arrow.isoMk' theorem hom.congr_left {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.left = φ₂.left := by rw [h] #align category_theory.arrow.hom.congr_left CategoryTheory.Arrow.hom.congr_left @[simp]
Mathlib/CategoryTheory/Comma/Arrow.lean
167
168
theorem hom.congr_right {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.right = φ₂.right := by
rw [h]
[ " mk f.hom = f", " mk { left := left✝, right := right✝, hom := hom✝ }.hom = { left := left✝, right := right✝, hom := hom✝ }", " f = g", " f = f", " ∃ inv, ff ≫ inv = 𝟙 f ∧ inv ≫ ff = 𝟙 g", " (𝟭 T).map (inv ff.left) ≫ f.hom = g.hom ≫ (𝟭 T).map (inv ff.right)", " ff ≫ inverse = 𝟙 f ∧ inverse ≫ ff = �...
[ " mk f.hom = f", " mk { left := left✝, right := right✝, hom := hom✝ }.hom = { left := left✝, right := right✝, hom := hom✝ }", " f = g", " f = f", " ∃ inv, ff ≫ inv = 𝟙 f ∧ inv ≫ ff = 𝟙 g", " (𝟭 T).map (inv ff.left) ≫ f.hom = g.hom ≫ (𝟭 T).map (inv ff.right)", " ff ≫ inverse = 𝟙 f ∧ inverse ≫ ff = �...
import Mathlib.Algebra.BigOperators.Finsupp import Mathlib.Algebra.BigOperators.Finprod import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.LinearIndependent import Mathlib.SetTheory.Cardinal.Cofinality #align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395" noncomputable section universe u open Function Set Submodule variable {ι : Type*} {ι' : Type*} {R : Type*} {R₂ : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable [Semiring R] variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M'] section variable (ι R M) structure Basis where ofRepr :: repr : M ≃ₗ[R] ι →₀ R #align basis Basis #align basis.repr Basis.repr #align basis.of_repr Basis.ofRepr end instance uniqueBasis [Subsingleton R] : Unique (Basis ι R M) := ⟨⟨⟨default⟩⟩, fun ⟨b⟩ => by rw [Subsingleton.elim b]⟩ #align unique_basis uniqueBasis namespace Basis instance : Inhabited (Basis ι R (ι →₀ R)) := ⟨.ofRepr (LinearEquiv.refl _ _)⟩ variable (b b₁ : Basis ι R M) (i : ι) (c : R) (x : M) section Coord @[simps!] def coord : M →ₗ[R] R := Finsupp.lapply i ∘ₗ ↑b.repr #align basis.coord Basis.coord theorem forall_coord_eq_zero_iff {x : M} : (∀ i, b.coord i x = 0) ↔ x = 0 := Iff.trans (by simp only [b.coord_apply, DFunLike.ext_iff, Finsupp.zero_apply]) b.repr.map_eq_zero_iff #align basis.forall_coord_eq_zero_iff Basis.forall_coord_eq_zero_iff noncomputable def sumCoords : M →ₗ[R] R := (Finsupp.lsum ℕ fun _ => LinearMap.id) ∘ₗ (b.repr : M →ₗ[R] ι →₀ R) #align basis.sum_coords Basis.sumCoords @[simp] theorem coe_sumCoords : (b.sumCoords : M → R) = fun m => (b.repr m).sum fun _ => id := rfl #align basis.coe_sum_coords Basis.coe_sumCoords
Mathlib/LinearAlgebra/Basis.lean
231
236
theorem coe_sumCoords_eq_finsum : (b.sumCoords : M → R) = fun m => ∑ᶠ i, b.coord i m := by
ext m simp only [Basis.sumCoords, Basis.coord, Finsupp.lapply_apply, LinearMap.id_coe, LinearEquiv.coe_coe, Function.comp_apply, Finsupp.coe_lsum, LinearMap.coe_comp, finsum_eq_sum _ (b.repr m).finite_support, Finsupp.sum, Finset.finite_toSet_toFinset, id, Finsupp.fun_support_eq]
[ " { repr := b } = default", " (∀ (i : ι), (b.coord i) x = 0) ↔ b.repr x = 0", " ⇑b.sumCoords = fun m => ∑ᶠ (i : ι), (b.coord i) m", " b.sumCoords m = ∑ᶠ (i : ι), (b.coord i) m" ]
[ " { repr := b } = default", " (∀ (i : ι), (b.coord i) x = 0) ↔ b.repr x = 0" ]
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank
Mathlib/RingTheory/PowerBasis.lean
89
102
theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by
have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl
[ " FiniteDimensional.finrank R S = pb.dim", " y ∈ Submodule.span R (Set.range fun i => x ^ ↑i) ↔ ∃ f, f.degree < ↑d ∧ y = (aeval x) f", " (Set.range fun i => x ^ ↑i) = (fun i => x ^ i) '' ↑(Finset.range d)", " (n ∈ Set.range fun i => x ^ ↑i) ↔ n ∈ (fun i => x ^ i) '' ↑(Finset.range d)", " (∃ y, x ^ ↑y = n) ↔...
[ " FiniteDimensional.finrank R S = pb.dim" ]
import Mathlib.Algebra.CharZero.Lemmas import Mathlib.Algebra.GroupWithZero.Commute import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Ring.Pow import Mathlib.Algebra.Ring.Int #align_import algebra.order.field.power from "leanprover-community/mathlib"@"acb3d204d4ee883eb686f45d486a2a6811a01329" variable {α : Type*} open Function Int section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[gcongr] theorem zpow_le_of_le (ha : 1 ≤ a) (h : m ≤ n) : a ^ m ≤ a ^ n := by have ha₀ : 0 < a := one_pos.trans_le ha lift n - m to ℕ using sub_nonneg.2 h with k hk calc a ^ m = a ^ m * 1 := (mul_one _).symm _ ≤ a ^ m * a ^ k := mul_le_mul_of_nonneg_left (one_le_pow_of_one_le ha _) (zpow_nonneg ha₀.le _) _ = a ^ n := by rw [← zpow_natCast, ← zpow_add₀ ha₀.ne', hk, add_sub_cancel] #align zpow_le_of_le zpow_le_of_le theorem zpow_le_one_of_nonpos (ha : 1 ≤ a) (hn : n ≤ 0) : a ^ n ≤ 1 := (zpow_le_of_le ha hn).trans_eq <| zpow_zero _ #align zpow_le_one_of_nonpos zpow_le_one_of_nonpos theorem one_le_zpow_of_nonneg (ha : 1 ≤ a) (hn : 0 ≤ n) : 1 ≤ a ^ n := (zpow_zero _).symm.trans_le <| zpow_le_of_le ha hn #align one_le_zpow_of_nonneg one_le_zpow_of_nonneg protected theorem Nat.zpow_pos_of_pos {a : ℕ} (h : 0 < a) (n : ℤ) : 0 < (a : α) ^ n := by apply zpow_pos_of_pos exact mod_cast h #align nat.zpow_pos_of_pos Nat.zpow_pos_of_pos theorem Nat.zpow_ne_zero_of_pos {a : ℕ} (h : 0 < a) (n : ℤ) : (a : α) ^ n ≠ 0 := (Nat.zpow_pos_of_pos h n).ne' #align nat.zpow_ne_zero_of_pos Nat.zpow_ne_zero_of_pos theorem one_lt_zpow (ha : 1 < a) : ∀ n : ℤ, 0 < n → 1 < a ^ n | (n : ℕ), h => (zpow_natCast _ _).symm.subst (one_lt_pow ha <| Int.natCast_ne_zero.mp h.ne') | -[_+1], h => ((Int.negSucc_not_pos _).mp h).elim #align one_lt_zpow one_lt_zpow theorem zpow_strictMono (hx : 1 < a) : StrictMono (a ^ · : ℤ → α) := strictMono_int_of_lt_succ fun n => have xpos : 0 < a := zero_lt_one.trans hx calc a ^ n < a ^ n * a := lt_mul_of_one_lt_right (zpow_pos_of_pos xpos _) hx _ = a ^ (n + 1) := (zpow_add_one₀ xpos.ne' _).symm #align zpow_strict_mono zpow_strictMono theorem zpow_strictAnti (h₀ : 0 < a) (h₁ : a < 1) : StrictAnti (a ^ · : ℤ → α) := strictAnti_int_of_succ_lt fun n => calc a ^ (n + 1) = a ^ n * a := zpow_add_one₀ h₀.ne' _ _ < a ^ n * 1 := (mul_lt_mul_left <| zpow_pos_of_pos h₀ _).2 h₁ _ = a ^ n := mul_one _ #align zpow_strict_anti zpow_strictAnti @[simp] theorem zpow_lt_iff_lt (hx : 1 < a) : a ^ m < a ^ n ↔ m < n := (zpow_strictMono hx).lt_iff_lt #align zpow_lt_iff_lt zpow_lt_iff_lt @[gcongr] alias ⟨_, GCongr.zpow_lt_of_lt⟩ := zpow_lt_iff_lt @[deprecated (since := "2024-02-10")] alias zpow_lt_of_lt := GCongr.zpow_lt_of_lt @[simp] theorem zpow_le_iff_le (hx : 1 < a) : a ^ m ≤ a ^ n ↔ m ≤ n := (zpow_strictMono hx).le_iff_le #align zpow_le_iff_le zpow_le_iff_le @[simp] theorem div_pow_le (ha : 0 ≤ a) (hb : 1 ≤ b) (k : ℕ) : a / b ^ k ≤ a := div_le_self ha <| one_le_pow_of_one_le hb _ #align div_pow_le div_pow_le theorem zpow_injective (h₀ : 0 < a) (h₁ : a ≠ 1) : Injective (a ^ · : ℤ → α) := by rcases h₁.lt_or_lt with (H | H) · exact (zpow_strictAnti h₀ H).injective · exact (zpow_strictMono H).injective #align zpow_injective zpow_injective @[simp] theorem zpow_inj (h₀ : 0 < a) (h₁ : a ≠ 1) : a ^ m = a ^ n ↔ m = n := (zpow_injective h₀ h₁).eq_iff #align zpow_inj zpow_inj theorem zpow_le_max_of_min_le {x : α} (hx : 1 ≤ x) {a b c : ℤ} (h : min a b ≤ c) : x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) := have : Antitone fun n : ℤ => x ^ (-n) := fun _ _ h => zpow_le_of_le hx (neg_le_neg h) (this h).trans_eq this.map_min #align zpow_le_max_of_min_le zpow_le_max_of_min_le
Mathlib/Algebra/Order/Field/Power.lean
114
116
theorem zpow_le_max_iff_min_le {x : α} (hx : 1 < x) {a b c : ℤ} : x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) ↔ min a b ≤ c := by
simp_rw [le_max_iff, min_le_iff, zpow_le_iff_le hx, neg_le_neg_iff]
[ " a ^ m ≤ a ^ n", " a ^ m * a ^ k = a ^ n", " 0 < ↑a ^ n", " 0 < ↑a", " Injective fun x => a ^ x", " x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) ↔ min a b ≤ c" ]
[ " a ^ m ≤ a ^ n", " a ^ m * a ^ k = a ^ n", " 0 < ↑a ^ n", " 0 < ↑a", " Injective fun x => a ^ x" ]
import Batteries.Classes.SatisfiesM namespace Array theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m] {as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β} (hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) : SatisfiesM (motive as.size) (as.foldlM f init) := by let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) : SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by unfold foldlM.loop; split · next hj => split · cases Nat.not_le_of_gt (by simp [hj]) h₂ · exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂) · next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0 theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (motive : Nat → Prop) (h0 : motive 0) (p : Fin as.size → β → Prop) (hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) : SatisfiesM (fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := by rw [mapM_eq_foldlM] refine SatisfiesM_foldlM (m := m) (β := Array β) (motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s |>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩ · case z => exact ⟨h0, rfl, nofun⟩ · case s => intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩ refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩ simp [get_push] at hj ⊢; split; {apply ih₂} cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁ theorem SatisfiesM_mapM' [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β) (p : Fin as.size → β → Prop) (hs : ∀ i, SatisfiesM (p i) (f as[i])) : SatisfiesM (fun arr => ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i]) (Array.mapM f as) := (SatisfiesM_mapM _ _ (fun _ => True) trivial _ (fun _ h => (hs _).imp (⟨·, h⟩))).imp (·.2) theorem size_mapM [Monad m] [LawfulMonad m] (f : α → m β) (as : Array α) : SatisfiesM (fun arr => arr.size = as.size) (Array.mapM f as) := (SatisfiesM_mapM' _ _ (fun _ _ => True) (fun _ => .trivial)).imp (·.1) theorem SatisfiesM_anyM [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop) (hstart : start ≤ min stop as.size) (tru : Prop) (fal : Nat → Prop) (h0 : fal start) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal (min stop as.size)) (anyM p as start stop) := by let rec go {stop j} (hj' : j ≤ stop) (hstop : stop ≤ as.size) (h0 : fal j) (hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 → SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) : SatisfiesM (fun res => bif res then tru else fal stop) (anyM.loop p as stop hstop j) := by unfold anyM.loop; split · next hj => exact (hp ⟨j, Nat.lt_of_lt_of_le hj hstop⟩ hj h0).bind fun | true, h => .pure h | false, h => go hj hstop h hp · next hj => exact .pure <| Nat.le_antisymm hj' (Nat.ge_of_not_lt hj) ▸ h0 termination_by stop - j simp only [Array.anyM_eq_anyM_loop] exact go hstart _ h0 fun i hi => hp i <| Nat.lt_of_lt_of_le hi <| Nat.min_le_left ..
.lake/packages/batteries/Batteries/Data/Array/Monadic.lean
85
110
theorem SatisfiesM_anyM_iff_exists [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop) (q : Fin as.size → Prop) (hp : ∀ i : Fin as.size, start ≤ i.1 → i.1 < stop → SatisfiesM (· = true ↔ q i) (p as[i])) : SatisfiesM (fun res => res = true ↔ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i) (anyM p as start stop) := by
cases Nat.le_total start (min stop as.size) with | inl hstart => refine (SatisfiesM_anyM _ _ _ _ hstart (fal := fun j => start ≤ j ∧ ¬ ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < j ∧ q i) (tru := ∃ i : Fin as.size, start ≤ i.1 ∧ i.1 < stop ∧ q i) ?_ ?_).imp ?_ · exact ⟨Nat.le_refl _, fun ⟨i, h₁, h₂, _⟩ => (Nat.not_le_of_gt h₂ h₁).elim⟩ · refine fun i h₂ ⟨h₁, h₃⟩ => (hp _ h₁ h₂).imp fun hq => ?_ unfold cond; split <;> simp at hq · exact ⟨_, h₁, h₂, hq⟩ · refine ⟨Nat.le_succ_of_le h₁, h₃.imp fun ⟨j, h₃, h₄, h₅⟩ => ⟨j, h₃, ?_, h₅⟩⟩ refine Nat.lt_of_le_of_ne (Nat.le_of_lt_succ h₄) fun e => hq (Fin.eq_of_val_eq e ▸ h₅) · intro | true, h => simp only [true_iff]; exact h | false, h => simp only [false_iff] exact h.2.imp fun ⟨j, h₁, h₂, hq⟩ => ⟨j, h₁, Nat.lt_min.2 ⟨h₂, j.2⟩, hq⟩ | inr hstart => rw [anyM_stop_le_start (h := hstart)] refine .pure ?_; simp; intro j h₁ h₂ cases Nat.not_lt.2 (Nat.le_trans hstart h₁) (Nat.lt_min.2 ⟨h₂, j.2⟩)
[ " SatisfiesM (motive as.size) (foldlM f init as 0)", " SatisfiesM (motive as.size) (foldlM.loop f as as.size ⋯ i j b)", " SatisfiesM (motive as.size)\n (if hlt : j < as.size then\n match i with\n | 0 => pure b\n | i'.succ =>\n let_fun this := ⋯;\n do\n let __do_lift ← f b ...
[ " SatisfiesM (motive as.size) (foldlM f init as 0)", " SatisfiesM (motive as.size) (foldlM.loop f as as.size ⋯ i j b)", " SatisfiesM (motive as.size)\n (if hlt : j < as.size then\n match i with\n | 0 => pure b\n | i'.succ =>\n let_fun this := ⋯;\n do\n let __do_lift ← f b ...
import Mathlib.RingTheory.SimpleModule import Mathlib.Topology.Algebra.Module.Basic #align_import topology.algebra.module.simple from "leanprover-community/mathlib"@"f430769b562e0cedef59ee1ed968d67e0e0c86ba" universe u v w variable {R : Type u} {M : Type v} {N : Type w} [Ring R] [TopologicalSpace R] [TopologicalSpace M] [AddCommGroup M] [AddCommGroup N] [Module R M] [ContinuousSMul R M] [Module R N] [ContinuousAdd M] [IsSimpleModule R N]
Mathlib/Topology/Algebra/Module/Simple.lean
28
34
theorem LinearMap.isClosed_or_dense_ker (l : M →ₗ[R] N) : IsClosed (LinearMap.ker l : Set M) ∨ Dense (LinearMap.ker l : Set M) := by
rcases l.surjective_or_eq_zero with (hl | rfl) · exact l.ker.isClosed_or_dense_of_isCoatom (LinearMap.isCoatom_ker_of_surjective hl) · rw [LinearMap.ker_zero] left exact isClosed_univ
[ " IsClosed ↑(ker l) ∨ Dense ↑(ker l)", " IsClosed ↑(ker 0) ∨ Dense ↑(ker 0)", " IsClosed ↑⊤ ∨ Dense ↑⊤", " IsClosed ↑⊤" ]
[]
import Mathlib.Init.Control.Combinators import Mathlib.Data.Option.Defs import Mathlib.Logic.IsEmpty import Mathlib.Logic.Relator import Mathlib.Util.CompileInductive import Aesop #align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a" universe u namespace Option variable {α β γ δ : Type*} theorem coe_def : (fun a ↦ ↑a : α → Option α) = some := rfl #align option.coe_def Option.coe_def theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp #align option.mem_map Option.mem_map -- The simpNF linter says that the LHS can be simplified via `Option.mem_def`. -- However this is a higher priority lemma. -- https://github.com/leanprover/std4/issues/207 @[simp 1100, nolint simpNF] theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} : f a ∈ o.map f ↔ a ∈ o := by aesop theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp #align option.forall_mem_map Option.forall_mem_map theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by simp #align option.exists_mem_map Option.exists_mem_map theorem coe_get {o : Option α} (h : o.isSome) : ((Option.get _ h : α) : Option α) = o := Option.some_get h #align option.coe_get Option.coe_get theorem eq_of_mem_of_mem {a : α} {o1 o2 : Option α} (h1 : a ∈ o1) (h2 : a ∈ o2) : o1 = o2 := h1.trans h2.symm #align option.eq_of_mem_of_mem Option.eq_of_mem_of_mem theorem Mem.leftUnique : Relator.LeftUnique ((· ∈ ·) : α → Option α → Prop) := fun _ _ _=> mem_unique #align option.mem.left_unique Option.Mem.leftUnique theorem some_injective (α : Type*) : Function.Injective (@some α) := fun _ _ ↦ some_inj.mp #align option.some_injective Option.some_injective theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f) | none, none, _ => rfl | some a₁, some a₂, H => by rw [Hf (Option.some.inj H)] #align option.map_injective Option.map_injective @[simp] theorem map_comp_some (f : α → β) : Option.map f ∘ some = some ∘ f := rfl #align option.map_comp_some Option.map_comp_some @[simp] theorem none_bind' (f : α → Option β) : none.bind f = none := rfl #align option.none_bind' Option.none_bind' @[simp] theorem some_bind' (a : α) (f : α → Option β) : (some a).bind f = f a := rfl #align option.some_bind' Option.some_bind'
Mathlib/Data/Option/Basic.lean
101
103
theorem bind_eq_some' {x : Option α} {f : α → Option β} {b : β} : x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b := by
cases x <;> simp
[ " y ∈ Option.map f o ↔ ∃ x, x ∈ o ∧ f x = y", " f a ∈ Option.map f o ↔ a ∈ o", " (∀ (y : β), y ∈ Option.map f o → p y) ↔ ∀ (x : α), x ∈ o → p (f x)", " (∃ y, y ∈ Option.map f o ∧ p y) ↔ ∃ x, x ∈ o ∧ p (f x)", " some a₁ = some a₂", " x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b", " none.bind f = so...
[ " y ∈ Option.map f o ↔ ∃ x, x ∈ o ∧ f x = y", " f a ∈ Option.map f o ↔ a ∈ o", " (∀ (y : β), y ∈ Option.map f o → p y) ↔ ∀ (x : α), x ∈ o → p (f x)", " (∃ y, y ∈ Option.map f o ∧ p y) ↔ ∃ x, x ∈ o ∧ p (f x)", " some a₁ = some a₂" ]
import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.Topology.MetricSpace.ThickenedIndicator open MeasureTheory Topology Metric Filter Set ENNReal NNReal open scoped Topology ENNReal NNReal BoundedContinuousFunction section auxiliary namespace MeasureTheory variable {Ω : Type*} [TopologicalSpace Ω] [MeasurableSpace Ω] [OpensMeasurableSpace Ω] theorem tendsto_lintegral_nn_filter_of_le_const {ι : Type*} {L : Filter ι} [L.IsCountablyGenerated] (μ : Measure Ω) [IsFiniteMeasure μ] {fs : ι → Ω →ᵇ ℝ≥0} {c : ℝ≥0} (fs_le_const : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c) {f : Ω → ℝ≥0} (fs_lim : ∀ᵐ ω : Ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (f ω))) : Tendsto (fun i ↦ ∫⁻ ω, fs i ω ∂μ) L (𝓝 (∫⁻ ω, f ω ∂μ)) := by refine tendsto_lintegral_filter_of_dominated_convergence (fun _ ↦ c) (eventually_of_forall fun i ↦ (ENNReal.continuous_coe.comp (fs i).continuous).measurable) ?_ (@lintegral_const_lt_top _ _ μ _ _ (@ENNReal.coe_ne_top c)).ne ?_ · simpa only [Function.comp_apply, ENNReal.coe_le_coe] using fs_le_const · simpa only [Function.comp_apply, ENNReal.tendsto_coe] using fs_lim #align measure_theory.finite_measure.tendsto_lintegral_nn_filter_of_le_const MeasureTheory.tendsto_lintegral_nn_filter_of_le_const
Mathlib/MeasureTheory/Measure/HasOuterApproxClosed.lean
75
85
theorem measure_of_cont_bdd_of_tendsto_filter_indicator {ι : Type*} {L : Filter ι} [L.IsCountablyGenerated] [TopologicalSpace Ω] [OpensMeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] {c : ℝ≥0} {E : Set Ω} (E_mble : MeasurableSet E) (fs : ι → Ω →ᵇ ℝ≥0) (fs_bdd : ∀ᶠ i in L, ∀ᵐ ω : Ω ∂μ, fs i ω ≤ c) (fs_lim : ∀ᵐ ω ∂μ, Tendsto (fun i ↦ fs i ω) L (𝓝 (indicator E (fun _ ↦ (1 : ℝ≥0)) ω))) : Tendsto (fun n ↦ lintegral μ fun ω ↦ fs n ω) L (𝓝 (μ E)) := by
convert tendsto_lintegral_nn_filter_of_le_const μ fs_bdd fs_lim have aux : ∀ ω, indicator E (fun _ ↦ (1 : ℝ≥0∞)) ω = ↑(indicator E (fun _ ↦ (1 : ℝ≥0)) ω) := fun ω ↦ by simp only [ENNReal.coe_indicator, ENNReal.coe_one] simp_rw [← aux, lintegral_indicator _ E_mble] simp only [lintegral_one, Measure.restrict_apply, MeasurableSet.univ, univ_inter]
[ " Tendsto (fun i => ∫⁻ (ω : Ω), ↑((fs i) ω) ∂μ) L (𝓝 (∫⁻ (ω : Ω), ↑(f ω) ∂μ))", " ∀ᶠ (n : ι) in L, ∀ᵐ (a : Ω) ∂μ, ↑((fs n) a) ≤ (fun x => ↑c) a", " ∀ᵐ (a : Ω) ∂μ, Tendsto (fun n => ↑((fs n) a)) L (𝓝 ↑(f a))", " Tendsto (fun n => ∫⁻ (ω : Ω), ↑((fs n) ω) ∂μ) L (𝓝 (μ E))", " μ E = ∫⁻ (ω : Ω), ↑(E.indicator ...
[ " Tendsto (fun i => ∫⁻ (ω : Ω), ↑((fs i) ω) ∂μ) L (𝓝 (∫⁻ (ω : Ω), ↑(f ω) ∂μ))", " ∀ᶠ (n : ι) in L, ∀ᵐ (a : Ω) ∂μ, ↑((fs n) a) ≤ (fun x => ↑c) a", " ∀ᵐ (a : Ω) ∂μ, Tendsto (fun n => ↑((fs n) a)) L (𝓝 ↑(f a))" ]
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.GroupTheory.FreeAbelianGroup import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.LinearAlgebra.Dimension.StrongRankCondition #align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" noncomputable section variable {X : Type*} def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ := FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ) #align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X := Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x) #align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup open Finsupp FreeAbelianGroup @[simp] theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) : Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by ext simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, toFreeAbelianGroup, Finsupp.liftAddHom_apply_single] #align finsupp.to_free_abelian_group_comp_single_add_hom Finsupp.toFreeAbelianGroup_comp_singleAddHom @[simp] theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup : toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by ext x y; simp only [AddMonoidHom.id_comp] rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom] simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply] #align free_abelian_group.to_finsupp_comp_to_free_abelian_group FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup @[simp] theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp : toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by ext rw [toFreeAbelianGroup, toFinsupp, AddMonoidHom.comp_apply, lift.of, liftAddHom_apply_single, AddMonoidHom.flip_apply, smulAddHom_apply, one_smul, AddMonoidHom.id_apply] #align finsupp.to_free_abelian_group_comp_to_finsupp Finsupp.toFreeAbelianGroup_comp_toFinsupp @[simp] theorem Finsupp.toFreeAbelianGroup_toFinsupp {X} (x : FreeAbelianGroup X) : Finsupp.toFreeAbelianGroup (FreeAbelianGroup.toFinsupp x) = x := by rw [← AddMonoidHom.comp_apply, Finsupp.toFreeAbelianGroup_comp_toFinsupp, AddMonoidHom.id_apply] #align finsupp.to_free_abelian_group_to_finsupp Finsupp.toFreeAbelianGroup_toFinsupp namespace FreeAbelianGroup open Finsupp @[simp] theorem toFinsupp_of (x : X) : toFinsupp (of x) = Finsupp.single x 1 := by simp only [toFinsupp, lift.of] #align free_abelian_group.to_finsupp_of FreeAbelianGroup.toFinsupp_of @[simp] theorem toFinsupp_toFreeAbelianGroup (f : X →₀ ℤ) : FreeAbelianGroup.toFinsupp (Finsupp.toFreeAbelianGroup f) = f := by rw [← AddMonoidHom.comp_apply, toFinsupp_comp_toFreeAbelianGroup, AddMonoidHom.id_apply] #align free_abelian_group.to_finsupp_to_free_abelian_group FreeAbelianGroup.toFinsupp_toFreeAbelianGroup variable (X) @[simps!] def equivFinsupp : FreeAbelianGroup X ≃+ (X →₀ ℤ) where toFun := toFinsupp invFun := toFreeAbelianGroup left_inv := toFreeAbelianGroup_toFinsupp right_inv := toFinsupp_toFreeAbelianGroup map_add' := toFinsupp.map_add #align free_abelian_group.equiv_finsupp FreeAbelianGroup.equivFinsupp noncomputable def basis (α : Type*) : Basis α ℤ (FreeAbelianGroup α) := ⟨(FreeAbelianGroup.equivFinsupp α).toIntLinearEquiv⟩ #align free_abelian_group.basis FreeAbelianGroup.basis def Equiv.ofFreeAbelianGroupLinearEquiv {α β : Type*} (e : FreeAbelianGroup α ≃ₗ[ℤ] FreeAbelianGroup β) : α ≃ β := let t : Basis α ℤ (FreeAbelianGroup β) := (FreeAbelianGroup.basis α).map e t.indexEquiv <| FreeAbelianGroup.basis _ #align free_abelian_group.equiv.of_free_abelian_group_linear_equiv FreeAbelianGroup.Equiv.ofFreeAbelianGroupLinearEquiv def Equiv.ofFreeAbelianGroupEquiv {α β : Type*} (e : FreeAbelianGroup α ≃+ FreeAbelianGroup β) : α ≃ β := Equiv.ofFreeAbelianGroupLinearEquiv e.toIntLinearEquiv #align free_abelian_group.equiv.of_free_abelian_group_equiv FreeAbelianGroup.Equiv.ofFreeAbelianGroupEquiv def Equiv.ofFreeGroupEquiv {α β : Type*} (e : FreeGroup α ≃* FreeGroup β) : α ≃ β := Equiv.ofFreeAbelianGroupEquiv (MulEquiv.toAdditive e.abelianizationCongr) #align free_abelian_group.equiv.of_free_group_equiv FreeAbelianGroup.Equiv.ofFreeGroupEquiv open IsFreeGroup def Equiv.ofIsFreeGroupEquiv {G H : Type*} [Group G] [Group H] [IsFreeGroup G] [IsFreeGroup H] (e : G ≃* H) : Generators G ≃ Generators H := Equiv.ofFreeGroupEquiv <| MulEquiv.trans (toFreeGroup G).symm <| MulEquiv.trans e <| toFreeGroup H #align free_abelian_group.equiv.of_is_free_group_equiv FreeAbelianGroup.Equiv.ofIsFreeGroupEquiv variable {X} def coeff (x : X) : FreeAbelianGroup X →+ ℤ := (Finsupp.applyAddHom x).comp toFinsupp #align free_abelian_group.coeff FreeAbelianGroup.coeff def support (a : FreeAbelianGroup X) : Finset X := a.toFinsupp.support #align free_abelian_group.support FreeAbelianGroup.support
Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean
149
151
theorem mem_support_iff (x : X) (a : FreeAbelianGroup X) : x ∈ a.support ↔ coeff x a ≠ 0 := by
rw [support, Finsupp.mem_support_iff] exact Iff.rfl
[ " toFreeAbelianGroup.comp (singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)", " (toFreeAbelianGroup.comp (singleAddHom x)) 1 = ((smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)) 1", " toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ)", " (((toFinsupp.comp toFreeAbelianGroup).comp (s...
[ " toFreeAbelianGroup.comp (singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)", " (toFreeAbelianGroup.comp (singleAddHom x)) 1 = ((smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)) 1", " toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ)", " (((toFinsupp.comp toFreeAbelianGroup).comp (s...
import Mathlib.CategoryTheory.Subobject.Lattice #align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d" universe v u noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace CategoryTheory namespace Limits section Kernel variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f] abbrev kernelSubobject : Subobject X := Subobject.mk (kernel.ι f) #align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f := Subobject.underlyingIso (kernel.ι f) #align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow : (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by simp [kernelSubobjectIso] #align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow' : (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f := by simp [kernelSubobjectIso] #align category_theory.limits.kernel_subobject_arrow' CategoryTheory.Limits.kernelSubobject_arrow' @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobject_arrow_comp : (kernelSubobject f).arrow ≫ f = 0 := by rw [← kernelSubobject_arrow] simp only [Category.assoc, kernel.condition, comp_zero] #align category_theory.limits.kernel_subobject_arrow_comp CategoryTheory.Limits.kernelSubobject_arrow_comp theorem kernelSubobject_factors {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : (kernelSubobject f).Factors h := ⟨kernel.lift _ h w, by simp⟩ #align category_theory.limits.kernel_subobject_factors CategoryTheory.Limits.kernelSubobject_factors theorem kernelSubobject_factors_iff {W : C} (h : W ⟶ X) : (kernelSubobject f).Factors h ↔ h ≫ f = 0 := ⟨fun w => by rw [← Subobject.factorThru_arrow _ _ w, Category.assoc, kernelSubobject_arrow_comp, comp_zero], kernelSubobject_factors f h⟩ #align category_theory.limits.kernel_subobject_factors_iff CategoryTheory.Limits.kernelSubobject_factors_iff def factorThruKernelSubobject {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : W ⟶ kernelSubobject f := (kernelSubobject f).factorThru h (kernelSubobject_factors f h w) #align category_theory.limits.factor_thru_kernel_subobject CategoryTheory.Limits.factorThruKernelSubobject @[simp] theorem factorThruKernelSubobject_comp_arrow {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : factorThruKernelSubobject f h w ≫ (kernelSubobject f).arrow = h := by dsimp [factorThruKernelSubobject] simp #align category_theory.limits.factor_thru_kernel_subobject_comp_arrow CategoryTheory.Limits.factorThruKernelSubobject_comp_arrow @[simp] theorem factorThruKernelSubobject_comp_kernelSubobjectIso {W : C} (h : W ⟶ X) (w : h ≫ f = 0) : factorThruKernelSubobject f h w ≫ (kernelSubobjectIso f).hom = kernel.lift f h w := (cancel_mono (kernel.ι f)).1 <| by simp #align category_theory.limits.factor_thru_kernel_subobject_comp_kernel_subobject_iso CategoryTheory.Limits.factorThruKernelSubobject_comp_kernelSubobjectIso section variable {f} {X' Y' : C} {f' : X' ⟶ Y'} [HasKernel f'] def kernelSubobjectMap (sq : Arrow.mk f ⟶ Arrow.mk f') : (kernelSubobject f : C) ⟶ (kernelSubobject f' : C) := Subobject.factorThru _ ((kernelSubobject f).arrow ≫ sq.left) (kernelSubobject_factors _ _ (by simp [sq.w])) #align category_theory.limits.kernel_subobject_map CategoryTheory.Limits.kernelSubobjectMap @[reassoc (attr := simp), elementwise (attr := simp)] theorem kernelSubobjectMap_arrow (sq : Arrow.mk f ⟶ Arrow.mk f') : kernelSubobjectMap sq ≫ (kernelSubobject f').arrow = (kernelSubobject f).arrow ≫ sq.left := by simp [kernelSubobjectMap] #align category_theory.limits.kernel_subobject_map_arrow CategoryTheory.Limits.kernelSubobjectMap_arrow @[simp] theorem kernelSubobjectMap_id : kernelSubobjectMap (𝟙 (Arrow.mk f)) = 𝟙 _ := by aesop_cat #align category_theory.limits.kernel_subobject_map_id CategoryTheory.Limits.kernelSubobjectMap_id @[simp] theorem kernelSubobjectMap_comp {X'' Y'' : C} {f'' : X'' ⟶ Y''} [HasKernel f''] (sq : Arrow.mk f ⟶ Arrow.mk f') (sq' : Arrow.mk f' ⟶ Arrow.mk f'') : kernelSubobjectMap (sq ≫ sq') = kernelSubobjectMap sq ≫ kernelSubobjectMap sq' := by aesop_cat #align category_theory.limits.kernel_subobject_map_comp CategoryTheory.Limits.kernelSubobjectMap_comp @[reassoc]
Mathlib/CategoryTheory/Subobject/Limits.lean
175
177
theorem kernel_map_comp_kernelSubobjectIso_inv (sq : Arrow.mk f ⟶ Arrow.mk f') : kernel.map f f' sq.1 sq.2 sq.3.symm ≫ (kernelSubobjectIso _).inv = (kernelSubobjectIso _).inv ≫ kernelSubobjectMap sq := by
aesop_cat
[ " (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow", " (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f", " (kernelSubobject f).arrow ≫ f = 0", " ((kernelSubobjectIso f).hom ≫ kernel.ι f) ≫ f = 0", " kernel.lift f h w ≫ (MonoOver.mk' (kernel.ι f)).arrow = h", " h ≫ f ...
[ " (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow", " (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f", " (kernelSubobject f).arrow ≫ f = 0", " ((kernelSubobjectIso f).hom ≫ kernel.ι f) ≫ f = 0", " kernel.lift f h w ≫ (MonoOver.mk' (kernel.ι f)).arrow = h", " h ≫ f ...
import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Topology.Algebra.Star noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section ProdCodomain variable [CommMonoid α] [TopologicalSpace α] [CommMonoid γ] [TopologicalSpace γ] @[to_additive HasSum.prod_mk]
Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean
68
70
theorem HasProd.prod_mk {f : β → α} {g : β → γ} {a : α} {b : γ} (hf : HasProd f a) (hg : HasProd g b) : HasProd (fun x ↦ (⟨f x, g x⟩ : α × γ)) ⟨a, b⟩ := by
simp [HasProd, ← prod_mk_prod, Filter.Tendsto.prod_mk_nhds hf hg]
[ " HasProd (fun x => (f x, g x)) (a, b)" ]
[]
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Induction #align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" set_option linter.uppercaseLean3 false noncomputable section open Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v w y variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} section variable [Semiring S] variable (f : R →+* S) (x : S) irreducible_def eval₂ (p : R[X]) : S := p.sum fun e a => f a * x ^ e #align polynomial.eval₂ Polynomial.eval₂
Mathlib/Algebra/Polynomial/Eval.lean
48
49
theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by
rw [eval₂_def]
[ " eval₂ f x p = p.sum fun e a => f a * x ^ e" ]
[]
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Algebra.Lie.Quotient #align_import algebra.lie.normalizer from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" variable {R L M M' : Type*} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M'] [Module R M'] [LieRingModule L M'] [LieModule R L M'] namespace LieSubmodule variable (N : LieSubmodule R L M) {N₁ N₂ : LieSubmodule R L M} def normalizer : LieSubmodule R L M where carrier := {m | ∀ x : L, ⁅x, m⁆ ∈ N} add_mem' hm₁ hm₂ x := by rw [lie_add]; exact N.add_mem' (hm₁ x) (hm₂ x) zero_mem' x := by simp smul_mem' t m hm x := by rw [lie_smul]; exact N.smul_mem' t (hm x) lie_mem {x m} hm y := by rw [leibniz_lie]; exact N.add_mem' (hm ⁅y, x⁆) (N.lie_mem (hm y)) #align lie_submodule.normalizer LieSubmodule.normalizer @[simp] theorem mem_normalizer (m : M) : m ∈ N.normalizer ↔ ∀ x : L, ⁅x, m⁆ ∈ N := Iff.rfl #align lie_submodule.mem_normalizer LieSubmodule.mem_normalizer @[simp]
Mathlib/Algebra/Lie/Normalizer.lean
64
67
theorem le_normalizer : N ≤ N.normalizer := by
intro m hm rw [mem_normalizer] exact fun x => N.lie_mem hm
[ " ⁅x, a✝ + b✝⁆ ∈ N", " ⁅x, a✝⁆ + ⁅x, b✝⁆ ∈ N", " ⁅x, 0⁆ ∈ N", " ⁅x, t • m⁆ ∈ N", " t • ⁅x, m⁆ ∈ N", " ⁅y, ⁅x, m⁆⁆ ∈ N", " ⁅⁅y, x⁆, m⁆ + ⁅x, ⁅y, m⁆⁆ ∈ N", " N ≤ N.normalizer", " m ∈ N.normalizer", " ∀ (x : L), ⁅x, m⁆ ∈ N" ]
[ " ⁅x, a✝ + b✝⁆ ∈ N", " ⁅x, a✝⁆ + ⁅x, b✝⁆ ∈ N", " ⁅x, 0⁆ ∈ N", " ⁅x, t • m⁆ ∈ N", " t • ⁅x, m⁆ ∈ N", " ⁅y, ⁅x, m⁆⁆ ∈ N", " ⁅⁅y, x⁆, m⁆ + ⁅x, ⁅y, m⁆⁆ ∈ N" ]
import Mathlib.Order.Interval.Finset.Nat import Mathlib.Data.PNat.Defs #align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset Function PNat namespace PNat variable (a b : ℕ+) instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ+ := Subtype.instLocallyFiniteOrder _ theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl #align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b := Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b := Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b := Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b := Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx #align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b := map_subtype_embedding_Icc _ _ #align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc @[simp]
Mathlib/Data/PNat/Interval.lean
67
72
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc] -- Porting note: I had to change this to `erw` *and* provide the proof, yuck. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)] rw [card_map]
[ " (Icc a b).card = ↑b + 1 - ↑a", " (Icc a b).card = (Icc ↑a ↑b).card", " (Icc a b).card = (map (Embedding.subtype fun n => 0 < n) (Icc a b)).card" ]
[]
import Mathlib.CategoryTheory.Adjunction.FullyFaithful import Mathlib.CategoryTheory.Conj import Mathlib.CategoryTheory.Functor.ReflectsIso #align_import category_theory.adjunction.reflective from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a" universe v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Category Adjunction variable {C : Type u₁} {D : Type u₂} {E : Type u₃} variable [Category.{v₁} C] [Category.{v₂} D] [Category.{v₃} E] class Reflective (R : D ⥤ C) extends R.Full, R.Faithful where L : C ⥤ D adj : L ⊣ R #align category_theory.reflective CategoryTheory.Reflective variable (i : D ⥤ C) def reflector [Reflective i] : C ⥤ D := Reflective.L (R := i) def reflectorAdjunction [Reflective i] : reflector i ⊣ i := Reflective.adj instance [Reflective i] : i.IsRightAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ instance [Reflective i] : (reflector i).IsLeftAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ def Functor.fullyFaithfulOfReflective [Reflective i] : i.FullyFaithful := (reflectorAdjunction i).fullyFaithfulROfIsIsoCounit -- TODO: This holds more generally for idempotent adjunctions, not just reflective adjunctions. theorem unit_obj_eq_map_unit [Reflective i] (X : C) : (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) = i.map ((reflector i).map ((reflectorAdjunction i).unit.app X)) := by rw [← cancel_mono (i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X))), ← i.map_comp] simp #align category_theory.unit_obj_eq_map_unit CategoryTheory.unit_obj_eq_map_unit example [Reflective i] {B : D} : IsIso ((reflectorAdjunction i).unit.app (i.obj B)) := inferInstance variable {i} theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) : IsIso ((reflectorAdjunction i).unit.app A) := by rwa [isIso_unit_app_iff_mem_essImage] #align category_theory.functor.ess_image.unit_is_iso CategoryTheory.Functor.essImage.unit_isIso theorem mem_essImage_of_unit_isIso {L : C ⥤ D} (adj : L ⊣ i) (A : C) [IsIso (adj.unit.app A)] : A ∈ i.essImage := ⟨L.obj A, ⟨(asIso (adj.unit.app A)).symm⟩⟩ #align category_theory.mem_ess_image_of_unit_is_iso CategoryTheory.mem_essImage_of_unit_isIso theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C} [IsSplitMono ((reflectorAdjunction i).unit.app A)] : A ∈ i.essImage := by let η : 𝟭 C ⟶ reflector i ⋙ i := (reflectorAdjunction i).unit haveI : IsIso (η.app (i.obj ((reflector i).obj A))) := Functor.essImage.unit_isIso ((i.obj_mem_essImage _)) have : Epi (η.app A) := by refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_ rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))] apply epi_comp (η.app (i.obj ((reflector i).obj A))) haveI := isIso_of_epi_of_isSplitMono (η.app A) exact mem_essImage_of_unit_isIso (reflectorAdjunction i) A #align category_theory.mem_ess_image_of_unit_is_split_mono CategoryTheory.mem_essImage_of_unit_isSplitMono instance Reflective.comp (F : C ⥤ D) (G : D ⥤ E) [Reflective F] [Reflective G] : Reflective (F ⋙ G) where L := reflector G ⋙ reflector F adj := (reflectorAdjunction G).comp (reflectorAdjunction F) #align category_theory.reflective.comp CategoryTheory.Reflective.comp def unitCompPartialBijectiveAux [Reflective i] (A : C) (B : D) : (A ⟶ i.obj B) ≃ (i.obj ((reflector i).obj A) ⟶ i.obj B) := ((reflectorAdjunction i).homEquiv _ _).symm.trans (Functor.FullyFaithful.ofFullyFaithful i).homEquiv #align category_theory.unit_comp_partial_bijective_aux CategoryTheory.unitCompPartialBijectiveAux
Mathlib/CategoryTheory/Adjunction/Reflective.lean
127
130
theorem unitCompPartialBijectiveAux_symm_apply [Reflective i] {A : C} {B : D} (f : i.obj ((reflector i).obj A) ⟶ i.obj B) : (unitCompPartialBijectiveAux _ _).symm f = (reflectorAdjunction i).unit.app A ≫ f := by
simp [unitCompPartialBijectiveAux]
[ " (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) =\n i.map ((reflector i).map ((reflectorAdjunction i).unit.app X))", " (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) ≫\n i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X)) =\n i.map\n ((reflector i).map...
[ " (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) =\n i.map ((reflector i).map ((reflectorAdjunction i).unit.app X))", " (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) ≫\n i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X)) =\n i.map\n ((reflector i).map...
import Mathlib.Order.Interval.Set.OrdConnectedComponent import Mathlib.Topology.Order.Basic #align_import topology.algebra.order.t5 from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter Set Function OrderDual Topology Interval variable {X : Type*} [LinearOrder X] [TopologicalSpace X] [OrderTopology X] {a b c : X} {s t : Set X} namespace Set @[simp] theorem ordConnectedComponent_mem_nhds : ordConnectedComponent s a ∈ 𝓝 a ↔ s ∈ 𝓝 a := by refine ⟨fun h => mem_of_superset h ordConnectedComponent_subset, fun h => ?_⟩ rcases exists_Icc_mem_subset_of_mem_nhds h with ⟨b, c, ha, ha', hs⟩ exact mem_of_superset ha' (subset_ordConnectedComponent ha hs) #align set.ord_connected_component_mem_nhds Set.ordConnectedComponent_mem_nhds
Mathlib/Topology/Order/T5.lean
33
63
theorem compl_section_ordSeparatingSet_mem_nhdsWithin_Ici (hd : Disjoint s (closure t)) (ha : a ∈ s) : (ordConnectedSection (ordSeparatingSet s t))ᶜ ∈ 𝓝[≥] a := by
have hmem : tᶜ ∈ 𝓝[≥] a := by refine mem_nhdsWithin_of_mem_nhds ?_ rw [← mem_interior_iff_mem_nhds, interior_compl] exact disjoint_left.1 hd ha rcases exists_Icc_mem_subset_of_mem_nhdsWithin_Ici hmem with ⟨b, hab, hmem', hsub⟩ by_cases H : Disjoint (Icc a b) (ordConnectedSection <| ordSeparatingSet s t) · exact mem_of_superset hmem' (disjoint_left.1 H) · simp only [Set.disjoint_left, not_forall, Classical.not_not] at H rcases H with ⟨c, ⟨hac, hcb⟩, hc⟩ have hsub' : Icc a b ⊆ ordConnectedComponent tᶜ a := subset_ordConnectedComponent (left_mem_Icc.2 hab) hsub have hd : Disjoint s (ordConnectedSection (ordSeparatingSet s t)) := disjoint_left_ordSeparatingSet.mono_right ordConnectedSection_subset replace hac : a < c := hac.lt_of_ne <| Ne.symm <| ne_of_mem_of_not_mem hc <| disjoint_left.1 hd ha refine mem_of_superset (Ico_mem_nhdsWithin_Ici (left_mem_Ico.2 hac)) fun x hx hx' => ?_ refine hx.2.ne (eq_of_mem_ordConnectedSection_of_uIcc_subset hx' hc ?_) refine subset_inter (subset_iUnion₂_of_subset a ha ?_) ?_ · exact OrdConnected.uIcc_subset inferInstance (hsub' ⟨hx.1, hx.2.le.trans hcb⟩) (hsub' ⟨hac.le, hcb⟩) · rcases mem_iUnion₂.1 (ordConnectedSection_subset hx').2 with ⟨y, hyt, hxy⟩ refine subset_iUnion₂_of_subset y hyt (OrdConnected.uIcc_subset inferInstance hxy ?_) refine subset_ordConnectedComponent left_mem_uIcc hxy ?_ suffices c < y by rw [uIcc_of_ge (hx.2.trans this).le] exact ⟨hx.2.le, this.le⟩ refine lt_of_not_le fun hyc => ?_ have hya : y < a := not_le.1 fun hay => hsub ⟨hay, hyc.trans hcb⟩ hyt exact hxy (Icc_subset_uIcc ⟨hya.le, hx.1⟩) ha
[ " s.ordConnectedComponent a ∈ 𝓝 a ↔ s ∈ 𝓝 a", " s.ordConnectedComponent a ∈ 𝓝 a", " (s.ordSeparatingSet t).ordConnectedSectionᶜ ∈ 𝓝[≥] a", " tᶜ ∈ 𝓝[≥] a", " tᶜ ∈ 𝓝 a", " a ∈ (closure t)ᶜ", " False", " [[x, c]] ⊆ s.ordSeparatingSet t", " [[x, c]] ⊆ tᶜ.ordConnectedComponent a", " [[x, c]] ⊆ ⋃ ...
[ " s.ordConnectedComponent a ∈ 𝓝 a ↔ s ∈ 𝓝 a", " s.ordConnectedComponent a ∈ 𝓝 a" ]
import Mathlib.MeasureTheory.Function.LpOrder #align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f" noncomputable section open scoped Classical open Topology ENNReal MeasureTheory NNReal open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory variable {α β γ δ : Type*} {m : MeasurableSpace α} {μ ν : Measure α} [MeasurableSpace δ] variable [NormedAddCommGroup β] variable [NormedAddCommGroup γ] namespace MeasureTheory theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [edist_eq_coe_nnnorm] #align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist theorem lintegral_norm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm] #align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist theorem lintegral_edist_triangle {f g h : α → β} (hf : AEStronglyMeasurable f μ) (hh : AEStronglyMeasurable h μ) : (∫⁻ a, edist (f a) (g a) ∂μ) ≤ (∫⁻ a, edist (f a) (h a) ∂μ) + ∫⁻ a, edist (g a) (h a) ∂μ := by rw [← lintegral_add_left' (hf.edist hh)] refine lintegral_mono fun a => ?_ apply edist_triangle_right #align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle theorem lintegral_nnnorm_zero : (∫⁻ _ : α, ‖(0 : β)‖₊ ∂μ) = 0 := by simp #align measure_theory.lintegral_nnnorm_zero MeasureTheory.lintegral_nnnorm_zero theorem lintegral_nnnorm_add_left {f : α → β} (hf : AEStronglyMeasurable f μ) (g : α → γ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_left' hf.ennnorm _ #align measure_theory.lintegral_nnnorm_add_left MeasureTheory.lintegral_nnnorm_add_left theorem lintegral_nnnorm_add_right (f : α → β) {g : α → γ} (hg : AEStronglyMeasurable g μ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_right' _ hg.ennnorm #align measure_theory.lintegral_nnnorm_add_right MeasureTheory.lintegral_nnnorm_add_right
Mathlib/MeasureTheory/Function/L1Space.lean
96
97
theorem lintegral_nnnorm_neg {f : α → β} : (∫⁻ a, ‖(-f) a‖₊ ∂μ) = ∫⁻ a, ‖f a‖₊ ∂μ := by
simp only [Pi.neg_apply, nnnorm_neg]
[ " ∫⁻ (a : α), ↑‖f a‖₊ ∂μ = ∫⁻ (a : α), edist (f a) 0 ∂μ", " ∫⁻ (a : α), ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ (a : α), edist (f a) 0 ∂μ", " ∫⁻ (a : α), edist (f a) (g a) ∂μ ≤ ∫⁻ (a : α), edist (f a) (h a) ∂μ + ∫⁻ (a : α), edist (g a) (h a) ∂μ", " ∫⁻ (a : α), edist (f a) (g a) ∂μ ≤ ∫⁻ (a : α), edist (f a) (h a) + edist...
[ " ∫⁻ (a : α), ↑‖f a‖₊ ∂μ = ∫⁻ (a : α), edist (f a) 0 ∂μ", " ∫⁻ (a : α), ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ (a : α), edist (f a) 0 ∂μ", " ∫⁻ (a : α), edist (f a) (g a) ∂μ ≤ ∫⁻ (a : α), edist (f a) (h a) ∂μ + ∫⁻ (a : α), edist (g a) (h a) ∂μ", " ∫⁻ (a : α), edist (f a) (g a) ∂μ ≤ ∫⁻ (a : α), edist (f a) (h a) + edist...
import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.Tactic.FieldSimp #align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" universe u₁ u₂ namespace Matrix open Matrix variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜] variable [DecidableEq n] [DecidableEq p] variable [CommRing R] section Transvection variable {R n} (i j : n) def transvection (c : R) : Matrix n n R := 1 + Matrix.stdBasisMatrix i j c #align matrix.transvection Matrix.transvection @[simp] theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection] #align matrix.transvection_zero Matrix.transvection_zero section theorem updateRow_eq_transvection [Finite n] (c : R) : updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) = transvection i j c := by cases nonempty_fintype n ext a b by_cases ha : i = a · by_cases hb : j = b · simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same, one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply] · simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply, Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul, mul_zero, add_apply] · simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero, Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply, mul_zero, false_and_iff, add_apply] #align matrix.update_row_eq_transvection Matrix.updateRow_eq_transvection variable [Fintype n] theorem transvection_mul_transvection_same (h : i ≠ j) (c d : R) : transvection i j c * transvection i j d = transvection i j (c + d) := by simp [transvection, Matrix.add_mul, Matrix.mul_add, h, h.symm, add_smul, add_assoc, stdBasisMatrix_add] #align matrix.transvection_mul_transvection_same Matrix.transvection_mul_transvection_same @[simp] theorem transvection_mul_apply_same (b : n) (c : R) (M : Matrix n n R) : (transvection i j c * M) i b = M i b + c * M j b := by simp [transvection, Matrix.add_mul] #align matrix.transvection_mul_apply_same Matrix.transvection_mul_apply_same @[simp] theorem mul_transvection_apply_same (a : n) (c : R) (M : Matrix n n R) : (M * transvection i j c) a j = M a j + c * M a i := by simp [transvection, Matrix.mul_add, mul_comm] #align matrix.mul_transvection_apply_same Matrix.mul_transvection_apply_same @[simp]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
131
132
theorem transvection_mul_apply_of_ne (a b : n) (ha : a ≠ i) (c : R) (M : Matrix n n R) : (transvection i j c * M) a b = M a b := by
simp [transvection, Matrix.add_mul, ha]
[ " transvection i j 0 = 1", " updateRow 1 i (1 i + c • 1 j) = transvection i j c", " updateRow 1 i (1 i + c • 1 j) a b = transvection i j c a b", " transvection i j c * transvection i j d = transvection i j (c + d)", " (transvection i j c * M) i b = M i b + c * M j b", " (M * transvection i j c) a j = M a ...
[ " transvection i j 0 = 1", " updateRow 1 i (1 i + c • 1 j) = transvection i j c", " updateRow 1 i (1 i + c • 1 j) a b = transvection i j c a b", " transvection i j c * transvection i j d = transvection i j (c + d)", " (transvection i j c * M) i b = M i b + c * M j b", " (M * transvection i j c) a j = M a ...
import Mathlib.Data.Set.Lattice import Mathlib.Order.Directed #align_import data.set.Union_lift from "leanprover-community/mathlib"@"5a4ea8453f128345f73cc656e80a49de2a54f481" variable {α : Type*} {ι β : Sort _} namespace Set section UnionLift @[nolint unusedArguments] noncomputable def iUnionLift (S : ι → Set α) (f : ∀ i, S i → β) (_ : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩) (T : Set α) (hT : T ⊆ iUnion S) (x : T) : β := let i := Classical.indefiniteDescription _ (mem_iUnion.1 (hT x.prop)) f i ⟨x, i.prop⟩ #align set.Union_lift Set.iUnionLift variable {S : ι → Set α} {f : ∀ i, S i → β} {hf : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩} {T : Set α} {hT : T ⊆ iUnion S} (hT' : T = iUnion S) @[simp] theorem iUnionLift_mk {i : ι} (x : S i) (hx : (x : α) ∈ T) : iUnionLift S f hf T hT ⟨x, hx⟩ = f i x := hf _ i x _ _ #align set.Union_lift_mk Set.iUnionLift_mk @[simp] theorem iUnionLift_inclusion {i : ι} (x : S i) (h : S i ⊆ T) : iUnionLift S f hf T hT (Set.inclusion h x) = f i x := iUnionLift_mk x _ #align set.Union_lift_inclusion Set.iUnionLift_inclusion theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) : iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by cases' x with x hx; exact hf _ _ _ _ _ #align set.Union_lift_of_mem Set.iUnionLift_of_mem theorem preimage_iUnionLift (t : Set β) : iUnionLift S f hf T hT ⁻¹' t = inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by ext x simp only [mem_preimage, mem_iUnion, mem_image] constructor · rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩ refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩ rwa [iUnionLift_of_mem x hi] at h · rintro ⟨i, ⟨y, hi⟩, h, hxy⟩ obtain rfl : y = x := congr_arg Subtype.val hxy rwa [iUnionLift_of_mem x hi] theorem iUnionLift_const (c : T) (ci : ∀ i, S i) (hci : ∀ i, (ci i : α) = c) (cβ : β) (h : ∀ i, f i (ci i) = cβ) : iUnionLift S f hf T hT c = cβ := by let ⟨i, hi⟩ := Set.mem_iUnion.1 (hT c.prop) have : ci i = ⟨c, hi⟩ := Subtype.ext (hci i) rw [iUnionLift_of_mem _ hi, ← this, h] #align set.Union_lift_const Set.iUnionLift_const theorem iUnionLift_unary (u : T → T) (ui : ∀ i, S i → S i) (hui : ∀ (i) (x : S i), u (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) x) = Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) (ui i x)) (uβ : β → β) (h : ∀ (i) (x : S i), f i (ui i x) = uβ (f i x)) (x : T) : iUnionLift S f hf T (le_of_eq hT') (u x) = uβ (iUnionLift S f hf T (le_of_eq hT') x) := by subst hT' cases' Set.mem_iUnion.1 x.prop with i hi rw [iUnionLift_of_mem x hi, ← h i] have : x = Set.inclusion (Set.subset_iUnion S i) ⟨x, hi⟩ := by cases x rfl conv_lhs => rw [this, hui, iUnionLift_inclusion] #align set.Union_lift_unary Set.iUnionLift_unary
Mathlib/Data/Set/UnionLift.lean
127
150
theorem iUnionLift_binary (dir : Directed (· ≤ ·) S) (op : T → T → T) (opi : ∀ i, S i → S i → S i) (hopi : ∀ i x y, Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) (opi i x y) = op (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) x) (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) y)) (opβ : β → β → β) (h : ∀ (i) (x y : S i), f i (opi i x y) = opβ (f i x) (f i y)) (x y : T) : iUnionLift S f hf T (le_of_eq hT') (op x y) = opβ (iUnionLift S f hf T (le_of_eq hT') x) (iUnionLift S f hf T (le_of_eq hT') y) := by
subst hT' cases' Set.mem_iUnion.1 x.prop with i hi cases' Set.mem_iUnion.1 y.prop with j hj rcases dir i j with ⟨k, hik, hjk⟩ rw [iUnionLift_of_mem x (hik hi), iUnionLift_of_mem y (hjk hj), ← h k] have hx : x = Set.inclusion (Set.subset_iUnion S k) ⟨x, hik hi⟩ := by cases x rfl have hy : y = Set.inclusion (Set.subset_iUnion S k) ⟨y, hjk hj⟩ := by cases y rfl have hxy : (Set.inclusion (Set.subset_iUnion S k) (opi k ⟨x, hik hi⟩ ⟨y, hjk hj⟩) : α) ∈ S k := (opi k ⟨x, hik hi⟩ ⟨y, hjk hj⟩).prop conv_lhs => rw [hx, hy, ← hopi, iUnionLift_of_mem _ hxy] rfl
[ " iUnionLift S f hf T hT x = f i ⟨↑x, hx⟩", " iUnionLift S f hf T hT ⟨x, hx✝⟩ = f i ⟨↑⟨x, hx✝⟩, hx⟩", " iUnionLift S f hf T hT ⁻¹' t = inclusion hT ⁻¹' ⋃ i, inclusion ⋯ '' (f i ⁻¹' t)", " x ∈ iUnionLift S f hf T hT ⁻¹' t ↔ x ∈ inclusion hT ⁻¹' ⋃ i, inclusion ⋯ '' (f i ⁻¹' t)", " iUnionLift S f hf T hT x ∈ t...
[ " iUnionLift S f hf T hT x = f i ⟨↑x, hx⟩", " iUnionLift S f hf T hT ⟨x, hx✝⟩ = f i ⟨↑⟨x, hx✝⟩, hx⟩", " iUnionLift S f hf T hT ⁻¹' t = inclusion hT ⁻¹' ⋃ i, inclusion ⋯ '' (f i ⁻¹' t)", " x ∈ iUnionLift S f hf T hT ⁻¹' t ↔ x ∈ inclusion hT ⁻¹' ⋃ i, inclusion ⋯ '' (f i ⁻¹' t)", " iUnionLift S f hf T hT x ∈ t...
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.Compactness.Paracompact import Mathlib.Topology.ShrinkingLemma import Mathlib.Topology.UrysohnsLemma #align_import topology.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v open Function Set Filter open scoped Classical open Topology noncomputable section structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align partition_of_unity PartitionOfUnity structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun le_one' : toFun ≤ 1 eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align bump_covering BumpCovering variable {ι : Type u} {X : Type v} [TopologicalSpace X] namespace PartitionOfUnity variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E] {s : Set X} (f : PartitionOfUnity ι X s) instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where coe := toFun coe_injective' := fun f g h ↦ by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align partition_of_unity.locally_finite PartitionOfUnity.locallyFinite theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) := f.locallyFinite.closure #align partition_of_unity.locally_finite_tsupport PartitionOfUnity.locallyFinite_tsupport theorem nonneg (i : ι) (x : X) : 0 ≤ f i x := f.nonneg' i x #align partition_of_unity.nonneg PartitionOfUnity.nonneg theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align partition_of_unity.sum_eq_one PartitionOfUnity.sum_eq_one theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by have H := f.sum_eq_one hx contrapose! H simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one #align partition_of_unity.exists_pos PartitionOfUnity.exists_pos theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 := f.sum_le_one' x #align partition_of_unity.sum_le_one PartitionOfUnity.sum_le_one theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x := finsum_nonneg fun i => f.nonneg i x #align partition_of_unity.sum_nonneg PartitionOfUnity.sum_nonneg theorem le_one (i : ι) (x : X) : f i x ≤ 1 := (single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x) #align partition_of_unity.le_one PartitionOfUnity.le_one section fintsupport -- partitions of unity have locally finite `tsupport` variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X) theorem finite_tsupport : {i | x₀ ∈ tsupport (ρ i)}.Finite := by rcases ρ.locallyFinite x₀ with ⟨t, t_in, ht⟩ apply ht.subset rintro i hi simp only [inter_comm] exact mem_closure_iff_nhds.mp hi t t_in def fintsupport (x₀ : X) : Finset ι := (ρ.finite_tsupport x₀).toFinset theorem mem_fintsupport_iff (i : ι) : i ∈ ρ.fintsupport x₀ ↔ x₀ ∈ tsupport (ρ i) := Finite.mem_toFinset _
Mathlib/Topology/PartitionOfUnity.lean
244
249
theorem eventually_fintsupport_subset : ∀ᶠ y in 𝓝 x₀, ρ.fintsupport y ⊆ ρ.fintsupport x₀ := by
apply (ρ.locallyFinite.closure.eventually_subset (fun _ ↦ isClosed_closure) x₀).mono intro y hy z hz rw [PartitionOfUnity.mem_fintsupport_iff] at * exact hy hz
[ " f = g", " { toFun := toFun✝, locallyFinite' := locallyFinite'✝, nonneg' := nonneg'✝, sum_eq_one' := sum_eq_one'✝,\n sum_le_one' := sum_le_one'✝ } =\n g", " { toFun := toFun✝¹, locallyFinite' := locallyFinite'✝¹, nonneg' := nonneg'✝¹, sum_eq_one' := sum_eq_one'✝¹,\n sum_le_one' := sum_le_one'✝¹ } ...
[ " f = g", " { toFun := toFun✝, locallyFinite' := locallyFinite'✝, nonneg' := nonneg'✝, sum_eq_one' := sum_eq_one'✝,\n sum_le_one' := sum_le_one'✝ } =\n g", " { toFun := toFun✝¹, locallyFinite' := locallyFinite'✝¹, nonneg' := nonneg'✝¹, sum_eq_one' := sum_eq_one'✝¹,\n sum_le_one' := sum_le_one'✝¹ } ...
import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.Tactic.PPWithUniv import Mathlib.Data.Set.Defs #align_import category_theory.types from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded" namespace CategoryTheory -- morphism levels before object levels. See note [CategoryTheory universes]. universe v v' w u u' @[to_additive existing CategoryTheory.types] instance types : LargeCategory (Type u) where Hom a b := a → b id a := id comp f g := g ∘ f #align category_theory.types CategoryTheory.types theorem types_hom {α β : Type u} : (α ⟶ β) = (α → β) := rfl #align category_theory.types_hom CategoryTheory.types_hom -- porting note (#10688): this lemma was not here in Lean 3. Lean 3 `ext` would solve this goal -- because of its "if all else fails, apply all `ext` lemmas" policy, -- which apparently we want to move away from. @[ext] theorem types_ext {α β : Type u} (f g : α ⟶ β) (h : ∀ a : α, f a = g a) : f = g := by funext x exact h x theorem types_id (X : Type u) : 𝟙 X = id := rfl #align category_theory.types_id CategoryTheory.types_id theorem types_comp {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) : f ≫ g = g ∘ f := rfl #align category_theory.types_comp CategoryTheory.types_comp @[simp] theorem types_id_apply (X : Type u) (x : X) : (𝟙 X : X → X) x = x := rfl #align category_theory.types_id_apply CategoryTheory.types_id_apply @[simp] theorem types_comp_apply {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) : (f ≫ g) x = g (f x) := rfl #align category_theory.types_comp_apply CategoryTheory.types_comp_apply @[simp] theorem hom_inv_id_apply {X Y : Type u} (f : X ≅ Y) (x : X) : f.inv (f.hom x) = x := congr_fun f.hom_inv_id x #align category_theory.hom_inv_id_apply CategoryTheory.hom_inv_id_apply @[simp] theorem inv_hom_id_apply {X Y : Type u} (f : X ≅ Y) (y : Y) : f.hom (f.inv y) = y := congr_fun f.inv_hom_id y #align category_theory.inv_hom_id_apply CategoryTheory.inv_hom_id_apply -- Unfortunately without this wrapper we can't use `CategoryTheory` idioms, such as `IsIso f`. abbrev asHom {α β : Type u} (f : α → β) : α ⟶ β := f #align category_theory.as_hom CategoryTheory.asHom @[inherit_doc] scoped notation "↾" f:200 => CategoryTheory.asHom f section -- We verify the expected type checking behaviour of `asHom` variable (α β γ : Type u) (f : α → β) (g : β → γ) example : α → γ := ↾f ≫ ↾g example [IsIso (↾f)] : Mono (↾f) := by infer_instance example [IsIso (↾f)] : ↾f ≫ inv (↾f) = 𝟙 α := by simp end namespace FunctorToTypes variable {C : Type u} [Category.{v} C] (F G H : C ⥤ Type w) {X Y Z : C} variable (σ : F ⟶ G) (τ : G ⟶ H) @[simp]
Mathlib/CategoryTheory/Types.lean
152
153
theorem map_comp_apply (f : X ⟶ Y) (g : Y ⟶ Z) (a : F.obj X) : (F.map (f ≫ g)) a = (F.map g) ((F.map f) a) := by
simp [types_comp]
[ " f = g", " f x = g x", " Mono (↾f)", " ↾f ≫ inv (↾f) = 𝟙 α", " F.map (f ≫ g) a = F.map g (F.map f a)" ]
[ " f = g", " f x = g x", " Mono (↾f)", " ↾f ≫ inv (↾f) = 𝟙 α" ]
import Mathlib.Data.Finset.Lattice #align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α} open Finset -- The namespace is here to distinguish from other compressions. namespace Down def compression (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) := (𝒜.filter fun s => erase s a ∈ 𝒜).disjUnion ((𝒜.image fun s => erase s a).filter fun s => s ∉ 𝒜) <| disjoint_left.2 fun s h₁ h₂ => by have := (mem_filter.1 h₂).2 exact this (mem_filter.1 h₁).1 #align down.compression Down.compression @[inherit_doc] scoped[FinsetFamily] notation "𝓓 " => Down.compression -- Porting note: had to open this open FinsetFamily
Mathlib/Combinatorics/SetFamily/Compression/Down.lean
241
248
theorem mem_compression : s ∈ 𝓓 a 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ s ∉ 𝒜 ∧ insert a s ∈ 𝒜 := by
simp_rw [compression, mem_disjUnion, mem_filter, mem_image, and_comm (a := (¬ s ∈ 𝒜))] refine or_congr_right (and_congr_left fun hs => ⟨?_, fun h => ⟨_, h, erase_insert <| insert_ne_self.1 <| ne_of_mem_of_not_mem h hs⟩⟩) rintro ⟨t, ht, rfl⟩ rwa [insert_erase (erase_ne_self.1 (ne_of_mem_of_not_mem ht hs).symm)]
[ " False", " s ∈ 𝓓 a 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ s ∉ 𝒜 ∧ insert a s ∈ 𝒜", " s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ (∃ a_1 ∈ 𝒜, a_1.erase a = s) ∧ s ∉ 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ insert a s ∈ 𝒜 ∧ s ∉ 𝒜", " (∃ a_1 ∈ 𝒜, a_1.erase a = s) → insert a s ∈ 𝒜", " insert a (t.erase a) ∈ 𝒜" ]
[ " False" ]
import Mathlib.Data.List.Chain #align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213" variable {α : Type*} (l : List α) (R : α → α → Prop) [DecidableRel R] {a b : α} namespace List @[simp] theorem destutter'_nil : destutter' R a [] = [a] := rfl #align list.destutter'_nil List.destutter'_nil theorem destutter'_cons : (b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l := rfl #align list.destutter'_cons List.destutter'_cons variable {R} @[simp] theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by rw [destutter', if_pos h] #align list.destutter'_cons_pos List.destutter'_cons_pos @[simp] theorem destutter'_cons_neg (h : ¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by rw [destutter', if_neg h] #align list.destutter'_cons_neg List.destutter'_cons_neg variable (R) @[simp] theorem destutter'_singleton : [b].destutter' R a = if R a b then [a, b] else [a] := by split_ifs with h <;> simp! [h] #align list.destutter'_singleton List.destutter'_singleton theorem destutter'_sublist (a) : l.destutter' R a <+ a :: l := by induction' l with b l hl generalizing a · simp rw [destutter'] split_ifs · exact Sublist.cons₂ a (hl b) · exact (hl a).trans ((l.sublist_cons b).cons_cons a) #align list.destutter'_sublist List.destutter'_sublist theorem mem_destutter' (a) : a ∈ l.destutter' R a := by induction' l with b l hl · simp rw [destutter'] split_ifs · simp · assumption #align list.mem_destutter' List.mem_destutter' theorem destutter'_is_chain : ∀ l : List α, ∀ {a b}, R a b → (l.destutter' R b).Chain R a | [], a, b, h => chain_singleton.mpr h | c :: l, a, b, h => by rw [destutter'] split_ifs with hbc · rw [chain_cons] exact ⟨h, destutter'_is_chain l hbc⟩ · exact destutter'_is_chain l h #align list.destutter'_is_chain List.destutter'_is_chain theorem destutter'_is_chain' (a) : (l.destutter' R a).Chain' R := by induction' l with b l hl generalizing a · simp rw [destutter'] split_ifs with h · exact destutter'_is_chain R l h · exact hl a #align list.destutter'_is_chain' List.destutter'_is_chain'
Mathlib/Data/List/Destutter.lean
101
105
theorem destutter'_of_chain (h : l.Chain R a) : l.destutter' R a = a :: l := by
induction' l with b l hb generalizing a · simp obtain ⟨h, hc⟩ := chain_cons.mp h rw [l.destutter'_cons_pos h, hb hc]
[ " destutter' R b (a :: l) = b :: destutter' R a l", " destutter' R b (a :: l) = destutter' R b l", " destutter' R a [b] = if R a b then [a, b] else [a]", " destutter' R a [b] = [a, b]", " destutter' R a [b] = [a]", " destutter' R a l <+ a :: l", " destutter' R a [] <+ [a]", " destutter' R a (b :: l) <...
[ " destutter' R b (a :: l) = b :: destutter' R a l", " destutter' R b (a :: l) = destutter' R b l", " destutter' R a [b] = if R a b then [a, b] else [a]", " destutter' R a [b] = [a, b]", " destutter' R a [b] = [a]", " destutter' R a l <+ a :: l", " destutter' R a [] <+ [a]", " destutter' R a (b :: l) <...
import Mathlib.Data.List.Basic #align_import data.list.join from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" -- Make sure we don't import algebra assert_not_exists Monoid variable {α β : Type*} namespace List attribute [simp] join -- Porting note (#10618): simp can prove this -- @[simp] theorem join_singleton (l : List α) : [l].join = l := by rw [join, join, append_nil] #align list.join_singleton List.join_singleton @[simp] theorem join_eq_nil : ∀ {L : List (List α)}, join L = [] ↔ ∀ l ∈ L, l = [] | [] => iff_of_true rfl (forall_mem_nil _) | l :: L => by simp only [join, append_eq_nil, join_eq_nil, forall_mem_cons] #align list.join_eq_nil List.join_eq_nil @[simp] theorem join_append (L₁ L₂ : List (List α)) : join (L₁ ++ L₂) = join L₁ ++ join L₂ := by induction L₁ · rfl · simp [*] #align list.join_append List.join_append
Mathlib/Data/List/Join.lean
44
44
theorem join_concat (L : List (List α)) (l : List α) : join (L.concat l) = join L ++ l := by
simp
[ " [l].join = l", " (l :: L).join = [] ↔ ∀ (l_1 : List α), l_1 ∈ l :: L → l_1 = []", " (L₁ ++ L₂).join = L₁.join ++ L₂.join", " ([] ++ L₂).join = [].join ++ L₂.join", " (head✝ :: tail✝ ++ L₂).join = (head✝ :: tail✝).join ++ L₂.join", " (L.concat l).join = L.join ++ l" ]
[ " [l].join = l", " (l :: L).join = [] ↔ ∀ (l_1 : List α), l_1 ∈ l :: L → l_1 = []", " (L₁ ++ L₂).join = L₁.join ++ L₂.join", " ([] ++ L₂).join = [].join ++ L₂.join", " (head✝ :: tail✝ ++ L₂).join = (head✝ :: tail✝).join ++ L₂.join" ]
set_option autoImplicit true namespace Array @[simp] theorem extract_eq_nil_of_start_eq_end {a : Array α} : a.extract i i = #[] := by refine extract_empty_of_stop_le_start a ?h exact Nat.le_refl i theorem extract_append_left {a b : Array α} {i j : Nat} (h : j ≤ a.size) : (a ++ b).extract i j = a.extract i j := by apply ext · simp only [size_extract, size_append] omega · intro h1 h2 h3 rw [get_extract, get_append_left, get_extract] theorem extract_append_right {a b : Array α} {i j : Nat} (h : a.size ≤ i) : (a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by apply ext · rw [size_extract, size_extract, size_append] omega · intro k hi h2 rw [get_extract, get_extract, get_append_right (show size a ≤ i + k by omega)] congr omega theorem extract_eq_of_size_le_end {a : Array α} (h : a.size ≤ l) : a.extract p l = a.extract p a.size := by simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
Mathlib/Data/Array/ExtractLemmas.lean
44
50
theorem extract_extract {a : Array α} (h : s1 + e2 ≤ e1) : (a.extract s1 e1).extract s2 e2 = a.extract (s1 + s2) (s1 + e2) := by
apply ext · simp only [size_extract] omega · intro i h1 h2 simp only [get_extract, Nat.add_assoc]
[ " a.extract i i = #[]", " i ≤ i", " (a ++ b).extract i j = a.extract i j", " ((a ++ b).extract i j).size = (a.extract i j).size", " min j (a.size + b.size) - i = min j a.size - i", " ∀ (i_1 : Nat) (hi₁ : i_1 < ((a ++ b).extract i j).size) (hi₂ : i_1 < (a.extract i j).size),\n ((a ++ b).extract i j)[i_1...
[ " a.extract i i = #[]", " i ≤ i", " (a ++ b).extract i j = a.extract i j", " ((a ++ b).extract i j).size = (a.extract i j).size", " min j (a.size + b.size) - i = min j a.size - i", " ∀ (i_1 : Nat) (hi₁ : i_1 < ((a ++ b).extract i j).size) (hi₂ : i_1 < (a.extract i j).size),\n ((a ++ b).extract i j)[i_1...
import Mathlib.Algebra.Module.Card import Mathlib.SetTheory.Cardinal.CountableCover import Mathlib.SetTheory.Cardinal.Continuum import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Topology.MetricSpace.Perfect universe u v open Filter Pointwise Set Function Cardinal open scoped Cardinal Topology theorem continuum_le_cardinal_of_nontriviallyNormedField (𝕜 : Type*) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] : 𝔠 ≤ #𝕜 := by suffices ∃ f : (ℕ → Bool) → 𝕜, range f ⊆ univ ∧ Continuous f ∧ Injective f by rcases this with ⟨f, -, -, f_inj⟩ simpa using lift_mk_le_lift_mk_of_injective f_inj apply Perfect.exists_nat_bool_injection _ univ_nonempty refine ⟨isClosed_univ, preperfect_iff_nhds.2 (fun x _ U hU ↦ ?_)⟩ rcases NormedField.exists_norm_lt_one 𝕜 with ⟨c, c_pos, hc⟩ have A : Tendsto (fun n ↦ x + c^n) atTop (𝓝 (x + 0)) := tendsto_const_nhds.add (tendsto_pow_atTop_nhds_zero_of_norm_lt_one hc) rw [add_zero] at A have B : ∀ᶠ n in atTop, x + c^n ∈ U := tendsto_def.1 A U hU rcases B.exists with ⟨n, hn⟩ refine ⟨x + c^n, by simpa using hn, ?_⟩ simp only [ne_eq, add_right_eq_self] apply pow_ne_zero simpa using c_pos theorem continuum_le_cardinal_of_module (𝕜 : Type u) (E : Type v) [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜] [AddCommGroup E] [Module 𝕜 E] [Nontrivial E] : 𝔠 ≤ #E := by have A : lift.{v} (𝔠 : Cardinal.{u}) ≤ lift.{v} (#𝕜) := by simpa using continuum_le_cardinal_of_nontriviallyNormedField 𝕜 simpa using A.trans (Cardinal.mk_le_of_module 𝕜 E) lemma cardinal_eq_of_mem_nhds_zero {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousSMul 𝕜 E] {s : Set E} (hs : s ∈ 𝓝 (0 : E)) : #s = #E := by obtain ⟨c, hc⟩ : ∃ x : 𝕜 , 1 < ‖x‖ := NormedField.exists_lt_norm 𝕜 1 have cn_ne : ∀ n, c^n ≠ 0 := by intro n apply pow_ne_zero rintro rfl simp only [norm_zero] at hc exact lt_irrefl _ (hc.trans zero_lt_one) have A : ∀ (x : E), ∀ᶠ n in (atTop : Filter ℕ), x ∈ c^n • s := by intro x have : Tendsto (fun n ↦ (c^n) ⁻¹ • x) atTop (𝓝 ((0 : 𝕜) • x)) := by have : Tendsto (fun n ↦ (c^n)⁻¹) atTop (𝓝 0) := by simp_rw [← inv_pow] apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one rw [norm_inv] exact inv_lt_one hc exact Tendsto.smul_const this x rw [zero_smul] at this filter_upwards [this hs] with n (hn : (c ^ n)⁻¹ • x ∈ s) exact (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).2 hn have B : ∀ n, #(c^n • s :) = #s := by intro n have : (c^n • s :) ≃ s := { toFun := fun x ↦ ⟨(c^n)⁻¹ • x.1, (mem_smul_set_iff_inv_smul_mem₀ (cn_ne n) _ _).1 x.2⟩ invFun := fun x ↦ ⟨(c^n) • x.1, smul_mem_smul_set x.2⟩ left_inv := fun x ↦ by simp [smul_smul, mul_inv_cancel (cn_ne n)] right_inv := fun x ↦ by simp [smul_smul, inv_mul_cancel (cn_ne n)] } exact Cardinal.mk_congr this apply (Cardinal.mk_of_countable_eventually_mem A B).symm
Mathlib/Topology/Algebra/Module/Cardinality.lean
97
106
theorem cardinal_eq_of_mem_nhds {E : Type*} (𝕜 : Type*) [NontriviallyNormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousSMul 𝕜 E] {s : Set E} {x : E} (hs : s ∈ 𝓝 x) : #s = #E := by
let g := Homeomorph.addLeft x let t := g ⁻¹' s have : t ∈ 𝓝 0 := g.continuous.continuousAt.preimage_mem_nhds (by simpa [g] using hs) have A : #t = #E := cardinal_eq_of_mem_nhds_zero 𝕜 this have B : #t = #s := Cardinal.mk_subtype_of_equiv s g.toEquiv rwa [B] at A
[ " 𝔠 ≤ #𝕜", " ∃ f, range f ⊆ Set.univ ∧ Continuous f ∧ Injective f", " Perfect Set.univ", " ∃ y ∈ U ∩ Set.univ, y ≠ x", " x + c ^ n ∈ U ∩ Set.univ", " x + c ^ n ≠ x", " ¬c ^ n = 0", " c ≠ 0", " 𝔠 ≤ #E", " lift.{v, u} 𝔠 ≤ lift.{v, u} #𝕜", " #↑s = #E", " ∀ (n : ℕ), c ^ n ≠ 0", " c ^ n ≠ 0"...
[ " 𝔠 ≤ #𝕜", " ∃ f, range f ⊆ Set.univ ∧ Continuous f ∧ Injective f", " Perfect Set.univ", " ∃ y ∈ U ∩ Set.univ, y ≠ x", " x + c ^ n ∈ U ∩ Set.univ", " x + c ^ n ≠ x", " ¬c ^ n = 0", " c ≠ 0", " 𝔠 ≤ #E", " lift.{v, u} 𝔠 ≤ lift.{v, u} #𝕜", " #↑s = #E", " ∀ (n : ℕ), c ^ n ≠ 0", " c ^ n ≠ 0"...
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Data.Nat.Fib.Basic import Mathlib.Tactic.Monotonicity #align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction open GeneralizedContinuedFraction (of) open Int variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K] namespace IntFractPair theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by cases n with | zero => have : IntFractPair.of v = ifp_n := by injection nth_stream_eq rw [← this, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ | succ => rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩ rw [← ifp_of_eq_ifp_n, IntFractPair.of] exact ⟨fract_nonneg _, fract_lt_one _⟩ #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg_lt_one theorem nth_stream_fr_nonneg {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr := (nth_stream_fr_nonneg_lt_one nth_stream_eq).left #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_nonneg GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_nonneg theorem nth_stream_fr_lt_one {ifp_n : IntFractPair K} (nth_stream_eq : IntFractPair.stream v n = some ifp_n) : ifp_n.fr < 1 := (nth_stream_fr_nonneg_lt_one nth_stream_eq).right #align generalized_continued_fraction.int_fract_pair.nth_stream_fr_lt_one GeneralizedContinuedFraction.IntFractPair.nth_stream_fr_lt_one
Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean
96
107
theorem one_le_succ_nth_stream_b {ifp_succ_n : IntFractPair K} (succ_nth_stream_eq : IntFractPair.stream v (n + 1) = some ifp_succ_n) : 1 ≤ ifp_succ_n.b := by
obtain ⟨ifp_n, nth_stream_eq, stream_nth_fr_ne_zero, ⟨-⟩⟩ : ∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr ≠ 0 ∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n := succ_nth_stream_eq_some_iff.1 succ_nth_stream_eq suffices 1 ≤ ifp_n.fr⁻¹ by rwa [IntFractPair.of, le_floor, cast_one] suffices ifp_n.fr ≤ 1 by have h : 0 < ifp_n.fr := lt_of_le_of_ne (nth_stream_fr_nonneg nth_stream_eq) stream_nth_fr_ne_zero.symm apply one_le_inv h this simp only [le_of_lt (nth_stream_fr_lt_one nth_stream_eq)]
[ " 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1", " IntFractPair.of v = ifp_n", " 0 ≤ { b := ⌊v⌋, fr := fract v }.fr ∧ { b := ⌊v⌋, fr := fract v }.fr < 1", " 0 ≤ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr ∧ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr < 1", " 1 ≤ ifp_succ_n.b", " 1 ≤ (IntFractPair.of ifp_n.fr⁻¹).b", " 1 ≤ ...
[ " 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1", " IntFractPair.of v = ifp_n", " 0 ≤ { b := ⌊v⌋, fr := fract v }.fr ∧ { b := ⌊v⌋, fr := fract v }.fr < 1", " 0 ≤ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr ∧ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr < 1" ]
import Mathlib.Algebra.Group.Equiv.TypeTags import Mathlib.GroupTheory.FreeAbelianGroup import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.LinearAlgebra.Dimension.StrongRankCondition #align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" noncomputable section variable {X : Type*} def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ := FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ) #align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X := Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x) #align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup open Finsupp FreeAbelianGroup @[simp]
Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean
45
50
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) : Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
ext simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul, toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
[ " toFreeAbelianGroup.comp (singleAddHom x) = (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)", " (toFreeAbelianGroup.comp (singleAddHom x)) 1 = ((smulAddHom ℤ (FreeAbelianGroup X)).flip (of x)) 1" ]
[]
import Mathlib.Analysis.SpecialFunctions.Complex.Arg import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section namespace Complex open Set Filter Bornology open scoped Real Topology ComplexConjugate -- Porting note: @[pp_nodot] does not exist in mathlib4 noncomputable def log (x : ℂ) : ℂ := x.abs.log + arg x * I #align complex.log Complex.log theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log] #align complex.log_re Complex.log_re theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log] #align complex.log_im Complex.log_im theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by simp only [log_im, neg_pi_lt_arg] #align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by simp only [log_im, arg_le_pi] #align complex.log_im_le_pi Complex.log_im_le_pi theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp, Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div, mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc, mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im] #align complex.exp_log Complex.exp_log @[simp] theorem range_exp : Set.range exp = {0}ᶜ := Set.ext fun x => ⟨by rintro ⟨x, rfl⟩ exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩ #align complex.range_exp Complex.range_exp theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp, arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im] #align complex.log_exp Complex.log_exp theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im) (hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy] #align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x := Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx]) (by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx]) #align complex.of_real_log Complex.ofReal_log @[simp, norm_cast] lemma natCast_log {n : ℕ} : Real.log n = log n := ofReal_natCast n ▸ ofReal_log n.cast_nonneg @[simp] lemma ofNat_log {n : ℕ} [n.AtLeastTwo] : Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) := natCast_log theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by simp [log_re] #align complex.log_of_real_re Complex.log_ofReal_re theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) : log (r * x) = Real.log r + log x := by replace hx := Complex.abs.ne_zero_iff.mpr hx simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx, ofReal_add, add_assoc] #align complex.log_of_real_mul Complex.log_ofReal_mul
Mathlib/Analysis/SpecialFunctions/Complex/Log.lean
93
94
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) : log (x * r) = Real.log r + log x := by
rw [mul_comm, log_ofReal_mul hr hx]
[ " x.log.re = (abs x).log", " x.log.im = x.arg", " -π < x.log.im", " x.log.im ≤ π", " cexp x.log = x", " x ∈ Set.range cexp → x ∈ {0}ᶜ", " cexp x ∈ {0}ᶜ", " (cexp x).log = x", " x = y", " (↑x.log).re = (↑x).log.re", " (↑x.log).im = (↑x).log.im", " (↑x).log.re = x.log", " (↑r * x).log = ↑r.log...
[ " x.log.re = (abs x).log", " x.log.im = x.arg", " -π < x.log.im", " x.log.im ≤ π", " cexp x.log = x", " x ∈ Set.range cexp → x ∈ {0}ᶜ", " cexp x ∈ {0}ᶜ", " (cexp x).log = x", " x = y", " (↑x.log).re = (↑x).log.re", " (↑x.log).im = (↑x).log.im", " (↑x).log.re = x.log", " (↑r * x).log = ↑r.log...
import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.Tactic.ComputeDegree #align_import linear_algebra.matrix.polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false open Matrix Polynomial variable {n α : Type*} [DecidableEq n] [Fintype n] [CommRing α] open Polynomial Matrix Equiv.Perm namespace Polynomial theorem natDegree_det_X_add_C_le (A B : Matrix n n α) : natDegree (det ((X : α[X]) • A.map C + B.map C : Matrix n n α[X])) ≤ Fintype.card n := by rw [det_apply] refine (natDegree_sum_le _ _).trans ?_ refine Multiset.max_le_of_forall_le _ _ ?_ simp only [forall_apply_eq_imp_iff, true_and_iff, Function.comp_apply, Multiset.map_map, Multiset.mem_map, exists_imp, Finset.mem_univ_val] intro g calc natDegree (sign g • ∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) ≤ natDegree (∏ i : n, (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) := by cases' Int.units_eq_one_or (sign g) with sg sg · rw [sg, one_smul] · rw [sg, Units.neg_smul, one_smul, natDegree_neg] _ ≤ ∑ i : n, natDegree (((X : α[X]) • A.map C + B.map C : Matrix n n α[X]) (g i) i) := (natDegree_prod_le (Finset.univ : Finset n) fun i : n => (X • A.map C + B.map C : Matrix n n α[X]) (g i) i) _ ≤ Finset.univ.card • 1 := (Finset.sum_le_card_nsmul _ _ 1 fun (i : n) _ => ?_) _ ≤ Fintype.card n := by simp [mul_one, Algebra.id.smul_eq_mul, Finset.card_univ] dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul] compute_degree #align polynomial.nat_degree_det_X_add_C_le Polynomial.natDegree_det_X_add_C_le
Mathlib/LinearAlgebra/Matrix/Polynomial.lean
62
70
theorem coeff_det_X_add_C_zero (A B : Matrix n n α) : coeff (det ((X : α[X]) • A.map C + B.map C)) 0 = det B := by
rw [det_apply, finset_sum_coeff, det_apply] refine Finset.sum_congr rfl ?_ rintro g - convert coeff_smul (R := α) (sign g) _ 0 rw [coeff_zero_prod] refine Finset.prod_congr rfl ?_ simp
[ " (X • A.map ⇑C + B.map ⇑C).det.natDegree ≤ Fintype.card n", " (∑ σ : Equiv.Perm n, sign σ • ∏ i : n, (X • A.map ⇑C + B.map ⇑C) (σ i) i).natDegree ≤ Fintype.card n", " Finset.fold max 0 (natDegree ∘ fun σ => sign σ • ∏ i : n, (X • A.map ⇑C + B.map ⇑C) (σ i) i) Finset.univ ≤\n Fintype.card n", " ∀ x ∈ Multi...
[ " (X • A.map ⇑C + B.map ⇑C).det.natDegree ≤ Fintype.card n", " (∑ σ : Equiv.Perm n, sign σ • ∏ i : n, (X • A.map ⇑C + B.map ⇑C) (σ i) i).natDegree ≤ Fintype.card n", " Finset.fold max 0 (natDegree ∘ fun σ => sign σ • ∏ i : n, (X • A.map ⇑C + B.map ⇑C) (σ i) i) Finset.univ ≤\n Fintype.card n", " ∀ x ∈ Multi...
import Mathlib.CategoryTheory.Abelian.Basic import Mathlib.CategoryTheory.Preadditive.Opposite import Mathlib.CategoryTheory.Limits.Opposites #align_import category_theory.abelian.opposite from "leanprover-community/mathlib"@"a5ff45a1c92c278b03b52459a620cfd9c49ebc80" noncomputable section namespace CategoryTheory open CategoryTheory.Limits variable (C : Type*) [Category C] [Abelian C] -- Porting note: these local instances do not seem to be necessary --attribute [local instance] -- hasFiniteLimits_of_hasEqualizers_and_finite_products -- hasFiniteColimits_of_hasCoequalizers_and_finite_coproducts -- Abelian.hasFiniteBiproducts instance : Abelian Cᵒᵖ := by -- Porting note: priorities of `Abelian.has_kernels` and `Abelian.has_cokernels` have -- been set to 90 in `Abelian.Basic` in order to prevent a timeout here exact { normalMonoOfMono := fun f => normalMonoOfNormalEpiUnop _ (normalEpiOfEpi f.unop) normalEpiOfEpi := fun f => normalEpiOfNormalMonoUnop _ (normalMonoOfMono f.unop) } section variable {C} variable {X Y : C} (f : X ⟶ Y) {A B : Cᵒᵖ} (g : A ⟶ B) -- TODO: Generalize (this will work whenever f has a cokernel) -- (The abelian case is probably sufficient for most applications.) @[simps] def kernelOpUnop : (kernel f.op).unop ≅ cokernel f where hom := (kernel.lift f.op (cokernel.π f).op <| by simp [← op_comp]).unop inv := cokernel.desc f (kernel.ι f.op).unop <| by rw [← f.unop_op, ← unop_comp, f.unop_op] simp hom_inv_id := by rw [← unop_id, ← (cokernel.desc f _ _).unop_op, ← unop_comp] congr 1 ext simp [← op_comp] inv_hom_id := by ext simp [← unop_comp] #align category_theory.kernel_op_unop CategoryTheory.kernelOpUnop -- TODO: Generalize (this will work whenever f has a kernel) -- (The abelian case is probably sufficient for most applications.) @[simps] def cokernelOpUnop : (cokernel f.op).unop ≅ kernel f where hom := kernel.lift f (cokernel.π f.op).unop <| by rw [← f.unop_op, ← unop_comp, f.unop_op] simp inv := (cokernel.desc f.op (kernel.ι f).op <| by simp [← op_comp]).unop hom_inv_id := by rw [← unop_id, ← (kernel.lift f _ _).unop_op, ← unop_comp] congr 1 ext simp [← op_comp] inv_hom_id := by ext simp [← unop_comp] #align category_theory.cokernel_op_unop CategoryTheory.cokernelOpUnop @[simps!] def kernelUnopOp : Opposite.op (kernel g.unop) ≅ cokernel g := (cokernelOpUnop g.unop).op #align category_theory.kernel_unop_op CategoryTheory.kernelUnopOp @[simps!] def cokernelUnopOp : Opposite.op (cokernel g.unop) ≅ kernel g := (kernelOpUnop g.unop).op #align category_theory.cokernel_unop_op CategoryTheory.cokernelUnopOp theorem cokernel.π_op : (cokernel.π f.op).unop = (cokernelOpUnop f).hom ≫ kernel.ι f ≫ eqToHom (Opposite.unop_op _).symm := by simp [cokernelOpUnop] #align category_theory.cokernel.π_op CategoryTheory.cokernel.π_op
Mathlib/CategoryTheory/Abelian/Opposite.lean
101
103
theorem kernel.ι_op : (kernel.ι f.op).unop = eqToHom (Opposite.unop_op _) ≫ cokernel.π f ≫ (kernelOpUnop f).inv := by
simp [kernelOpUnop]
[ " Abelian Cᵒᵖ", " (cokernel.π f).op ≫ f.op = 0", " f ≫ (kernel.ι f.op).unop = 0", " (kernel.ι f.op ≫ f.op).unop = 0", " (kernel.lift f.op (cokernel.π f).op ⋯).unop ≫ cokernel.desc f (kernel.ι f.op).unop ⋯ = 𝟙 (kernel f.op).unop", " ((cokernel.desc f (kernel.ι f.op).unop ⋯).op ≫ kernel.lift f.op (cokernel...
[ " Abelian Cᵒᵖ", " (cokernel.π f).op ≫ f.op = 0", " f ≫ (kernel.ι f.op).unop = 0", " (kernel.ι f.op ≫ f.op).unop = 0", " (kernel.lift f.op (cokernel.π f).op ⋯).unop ≫ cokernel.desc f (kernel.ι f.op).unop ⋯ = 𝟙 (kernel f.op).unop", " ((cokernel.desc f (kernel.ι f.op).unop ⋯).op ≫ kernel.lift f.op (cokernel...
import Mathlib.Analysis.Calculus.FormalMultilinearSeries import Mathlib.Analysis.SpecificLimits.Normed import Mathlib.Logic.Equiv.Fin import Mathlib.Topology.Algebra.InfiniteSum.Module #align_import analysis.analytic.basic from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" noncomputable section variable {𝕜 E F G : Type*} open scoped Classical open Topology NNReal Filter ENNReal open Set Filter Asymptotics variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] [NormedAddCommGroup G] [NormedSpace 𝕜 G] namespace FormalMultilinearSeries variable (p : FormalMultilinearSeries 𝕜 E F) {r : ℝ≥0} def radius (p : FormalMultilinearSeries 𝕜 E F) : ℝ≥0∞ := ⨆ (r : ℝ≥0) (C : ℝ) (_ : ∀ n, ‖p n‖ * (r : ℝ) ^ n ≤ C), (r : ℝ≥0∞) #align formal_multilinear_series.radius FormalMultilinearSeries.radius theorem le_radius_of_bound (C : ℝ) {r : ℝ≥0} (h : ∀ n : ℕ, ‖p n‖ * (r : ℝ) ^ n ≤ C) : (r : ℝ≥0∞) ≤ p.radius := le_iSup_of_le r <| le_iSup_of_le C <| le_iSup (fun _ => (r : ℝ≥0∞)) h #align formal_multilinear_series.le_radius_of_bound FormalMultilinearSeries.le_radius_of_bound theorem le_radius_of_bound_nnreal (C : ℝ≥0) {r : ℝ≥0} (h : ∀ n : ℕ, ‖p n‖₊ * r ^ n ≤ C) : (r : ℝ≥0∞) ≤ p.radius := p.le_radius_of_bound C fun n => mod_cast h n #align formal_multilinear_series.le_radius_of_bound_nnreal FormalMultilinearSeries.le_radius_of_bound_nnreal theorem le_radius_of_isBigO (h : (fun n => ‖p n‖ * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) : ↑r ≤ p.radius := Exists.elim (isBigO_one_nat_atTop_iff.1 h) fun C hC => p.le_radius_of_bound C fun n => (le_abs_self _).trans (hC n) set_option linter.uppercaseLean3 false in #align formal_multilinear_series.le_radius_of_is_O FormalMultilinearSeries.le_radius_of_isBigO theorem le_radius_of_eventually_le (C) (h : ∀ᶠ n in atTop, ‖p n‖ * (r : ℝ) ^ n ≤ C) : ↑r ≤ p.radius := p.le_radius_of_isBigO <| IsBigO.of_bound C <| h.mono fun n hn => by simpa #align formal_multilinear_series.le_radius_of_eventually_le FormalMultilinearSeries.le_radius_of_eventually_le theorem le_radius_of_summable_nnnorm (h : Summable fun n => ‖p n‖₊ * r ^ n) : ↑r ≤ p.radius := p.le_radius_of_bound_nnreal (∑' n, ‖p n‖₊ * r ^ n) fun _ => le_tsum' h _ #align formal_multilinear_series.le_radius_of_summable_nnnorm FormalMultilinearSeries.le_radius_of_summable_nnnorm theorem le_radius_of_summable (h : Summable fun n => ‖p n‖ * (r : ℝ) ^ n) : ↑r ≤ p.radius := p.le_radius_of_summable_nnnorm <| by simp only [← coe_nnnorm] at h exact mod_cast h #align formal_multilinear_series.le_radius_of_summable FormalMultilinearSeries.le_radius_of_summable theorem radius_eq_top_of_forall_nnreal_isBigO (h : ∀ r : ℝ≥0, (fun n => ‖p n‖ * (r : ℝ) ^ n) =O[atTop] fun _ => (1 : ℝ)) : p.radius = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => p.le_radius_of_isBigO (h r) set_option linter.uppercaseLean3 false in #align formal_multilinear_series.radius_eq_top_of_forall_nnreal_is_O FormalMultilinearSeries.radius_eq_top_of_forall_nnreal_isBigO theorem radius_eq_top_of_eventually_eq_zero (h : ∀ᶠ n in atTop, p n = 0) : p.radius = ∞ := p.radius_eq_top_of_forall_nnreal_isBigO fun r => (isBigO_zero _ _).congr' (h.mono fun n hn => by simp [hn]) EventuallyEq.rfl #align formal_multilinear_series.radius_eq_top_of_eventually_eq_zero FormalMultilinearSeries.radius_eq_top_of_eventually_eq_zero theorem radius_eq_top_of_forall_image_add_eq_zero (n : ℕ) (hn : ∀ m, p (m + n) = 0) : p.radius = ∞ := p.radius_eq_top_of_eventually_eq_zero <| mem_atTop_sets.2 ⟨n, fun _ hk => tsub_add_cancel_of_le hk ▸ hn _⟩ #align formal_multilinear_series.radius_eq_top_of_forall_image_add_eq_zero FormalMultilinearSeries.radius_eq_top_of_forall_image_add_eq_zero @[simp] theorem constFormalMultilinearSeries_radius {v : F} : (constFormalMultilinearSeries 𝕜 E v).radius = ⊤ := (constFormalMultilinearSeries 𝕜 E v).radius_eq_top_of_forall_image_add_eq_zero 1 (by simp [constFormalMultilinearSeries]) #align formal_multilinear_series.const_formal_multilinear_series_radius FormalMultilinearSeries.constFormalMultilinearSeries_radius
Mathlib/Analysis/Analytic/Basic.lean
187
202
theorem isLittleO_of_lt_radius (h : ↑r < p.radius) : ∃ a ∈ Ioo (0 : ℝ) 1, (fun n => ‖p n‖ * (r : ℝ) ^ n) =o[atTop] (a ^ ·) := by
have := (TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 1 4 rw [this] -- Porting note: was -- rw [(TFAE_exists_lt_isLittleO_pow (fun n => ‖p n‖ * (r : ℝ) ^ n) 1).out 1 4] simp only [radius, lt_iSup_iff] at h rcases h with ⟨t, C, hC, rt⟩ rw [ENNReal.coe_lt_coe, ← NNReal.coe_lt_coe] at rt have : 0 < (t : ℝ) := r.coe_nonneg.trans_lt rt rw [← div_lt_one this] at rt refine ⟨_, rt, C, Or.inr zero_lt_one, fun n => ?_⟩ calc |‖p n‖ * (r : ℝ) ^ n| = ‖p n‖ * (t : ℝ) ^ n * (r / t : ℝ) ^ n := by field_simp [mul_right_comm, abs_mul] _ ≤ C * (r / t : ℝ) ^ n := by gcongr; apply hC
[ " ‖‖p n‖ * ↑r ^ n‖ ≤ C * ‖1‖", " Summable fun n => ‖p n‖₊ * r ^ n", " (fun _x => 0) n = (fun n => ‖p n‖ * ↑r ^ n) n", " ∀ (m : ℕ), constFormalMultilinearSeries 𝕜 E v (m + 1) = 0", " ∃ a ∈ Ioo 0 1, (fun n => ‖p n‖ * ↑r ^ n) =o[atTop] fun x => a ^ x", " ∃ a < 1, ∃ C, (0 < C ∨ 0 < 1) ∧ ∀ (n : ℕ), |‖p n‖ * ↑...
[ " ‖‖p n‖ * ↑r ^ n‖ ≤ C * ‖1‖", " Summable fun n => ‖p n‖₊ * r ^ n", " (fun _x => 0) n = (fun n => ‖p n‖ * ↑r ^ n) n", " ∀ (m : ℕ), constFormalMultilinearSeries 𝕜 E v (m + 1) = 0" ]
import Mathlib.Algebra.MvPolynomial.Basic import Mathlib.Data.Finset.PiAntidiagonal import Mathlib.LinearAlgebra.StdBasis import Mathlib.Tactic.Linarith #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def MvPowerSeries (σ : Type*) (R : Type*) := (σ →₀ ℕ) → R #align mv_power_series MvPowerSeries namespace MvPowerSeries open Finsupp variable {σ R : Type*} instance [Inhabited R] : Inhabited (MvPowerSeries σ R) := ⟨fun _ => default⟩ instance [Zero R] : Zero (MvPowerSeries σ R) := Pi.instZero instance [AddMonoid R] : AddMonoid (MvPowerSeries σ R) := Pi.addMonoid instance [AddGroup R] : AddGroup (MvPowerSeries σ R) := Pi.addGroup instance [AddCommMonoid R] : AddCommMonoid (MvPowerSeries σ R) := Pi.addCommMonoid instance [AddCommGroup R] : AddCommGroup (MvPowerSeries σ R) := Pi.addCommGroup instance [Nontrivial R] : Nontrivial (MvPowerSeries σ R) := Function.nontrivial instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R (MvPowerSeries σ A) := Pi.module _ _ _ instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S (MvPowerSeries σ A) := Pi.isScalarTower section Semiring variable (R) [Semiring R] def monomial (n : σ →₀ ℕ) : R →ₗ[R] MvPowerSeries σ R := letI := Classical.decEq σ LinearMap.stdBasis R (fun _ ↦ R) n #align mv_power_series.monomial MvPowerSeries.monomial def coeff (n : σ →₀ ℕ) : MvPowerSeries σ R →ₗ[R] R := LinearMap.proj n #align mv_power_series.coeff MvPowerSeries.coeff variable {R} @[ext] theorem ext {φ ψ} (h : ∀ n : σ →₀ ℕ, coeff R n φ = coeff R n ψ) : φ = ψ := funext h #align mv_power_series.ext MvPowerSeries.ext theorem ext_iff {φ ψ : MvPowerSeries σ R} : φ = ψ ↔ ∀ n : σ →₀ ℕ, coeff R n φ = coeff R n ψ := Function.funext_iff #align mv_power_series.ext_iff MvPowerSeries.ext_iff
Mathlib/RingTheory/MvPowerSeries/Basic.lean
127
131
theorem monomial_def [DecidableEq σ] (n : σ →₀ ℕ) : (monomial R n) = LinearMap.stdBasis R (fun _ ↦ R) n := by
rw [monomial] -- unify the `Decidable` arguments convert rfl
[ " monomial R n = LinearMap.stdBasis R (fun x => R) n", " LinearMap.stdBasis R (fun x => R) n = LinearMap.stdBasis R (fun x => R) n" ]
[]
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.MvPolynomial.Basic #align_import ring_theory.mv_polynomial.tower from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" variable (R A B : Type*) {σ : Type*} namespace MvPolynomial section CommSemiring variable [CommSemiring R] [CommSemiring A] [CommSemiring B] variable [Algebra R A] [Algebra A B] [Algebra R B] [IsScalarTower R A B] variable {R A} theorem aeval_algebraMap_apply (x : σ → A) (p : MvPolynomial σ R) : aeval (algebraMap A B ∘ x) p = algebraMap A B (MvPolynomial.aeval x p) := by rw [aeval_def, aeval_def, ← coe_eval₂Hom, ← coe_eval₂Hom, map_eval₂Hom, ← IsScalarTower.algebraMap_eq] -- Porting note: added simp only [Function.comp] #align mv_polynomial.aeval_algebra_map_apply MvPolynomial.aeval_algebraMap_apply theorem aeval_algebraMap_eq_zero_iff [NoZeroSMulDivisors A B] [Nontrivial B] (x : σ → A) (p : MvPolynomial σ R) : aeval (algebraMap A B ∘ x) p = 0 ↔ aeval x p = 0 := by rw [aeval_algebraMap_apply, Algebra.algebraMap_eq_smul_one, smul_eq_zero, iff_false_intro (one_ne_zero' B), or_false_iff] #align mv_polynomial.aeval_algebra_map_eq_zero_iff MvPolynomial.aeval_algebraMap_eq_zero_iff
Mathlib/RingTheory/MvPolynomial/Tower.lean
62
65
theorem aeval_algebraMap_eq_zero_iff_of_injective {x : σ → A} {p : MvPolynomial σ R} (h : Function.Injective (algebraMap A B)) : aeval (algebraMap A B ∘ x) p = 0 ↔ aeval x p = 0 := by
rw [aeval_algebraMap_apply, ← (algebraMap A B).map_zero, h.eq_iff]
[ " (aeval (⇑(algebraMap A B) ∘ x)) p = (algebraMap A B) ((aeval x) p)", " (eval₂Hom (algebraMap R B) (⇑(algebraMap A B) ∘ x)) p = (eval₂Hom (algebraMap R B) fun i => (algebraMap A B) (x i)) p", " (aeval (⇑(algebraMap A B) ∘ x)) p = 0 ↔ (aeval x) p = 0" ]
[ " (aeval (⇑(algebraMap A B) ∘ x)) p = (algebraMap A B) ((aeval x) p)", " (eval₂Hom (algebraMap R B) (⇑(algebraMap A B) ∘ x)) p = (eval₂Hom (algebraMap R B) fun i => (algebraMap A B) (x i)) p", " (aeval (⇑(algebraMap A B) ∘ x)) p = 0 ↔ (aeval x) p = 0" ]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.integral_normalization from "leanprover-community/mathlib"@"6f401acf4faec3ab9ab13a42789c4f68064a61cd" open Polynomial namespace Polynomial universe u v y variable {R : Type u} {S : Type v} {a b : R} {m n : ℕ} {ι : Type y} section IntegralNormalization section Semiring variable [Semiring R] noncomputable def integralNormalization (f : R[X]) : R[X] := ∑ i ∈ f.support, monomial i (if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i)) #align polynomial.integral_normalization Polynomial.integralNormalization @[simp] theorem integralNormalization_zero : integralNormalization (0 : R[X]) = 0 := by simp [integralNormalization] #align polynomial.integral_normalization_zero Polynomial.integralNormalization_zero theorem integralNormalization_coeff {f : R[X]} {i : ℕ} : (integralNormalization f).coeff i = if f.degree = i then 1 else coeff f i * f.leadingCoeff ^ (f.natDegree - 1 - i) := by have : f.coeff i = 0 → f.degree ≠ i := fun hc hd => coeff_ne_zero_of_eq_degree hd hc simp (config := { contextual := true }) [integralNormalization, coeff_monomial, this, mem_support_iff] #align polynomial.integral_normalization_coeff Polynomial.integralNormalization_coeff
Mathlib/RingTheory/Polynomial/IntegralNormalization.lean
56
59
theorem integralNormalization_support {f : R[X]} : (integralNormalization f).support ⊆ f.support := by
intro simp (config := { contextual := true }) [integralNormalization, coeff_monomial, mem_support_iff]
[ " integralNormalization 0 = 0", " f.integralNormalization.coeff i = if f.degree = ↑i then 1 else f.coeff i * f.leadingCoeff ^ (f.natDegree - 1 - i)", " f.integralNormalization.support ⊆ f.support", " a✝ ∈ f.integralNormalization.support → a✝ ∈ f.support" ]
[ " integralNormalization 0 = 0", " f.integralNormalization.coeff i = if f.degree = ↑i then 1 else f.coeff i * f.leadingCoeff ^ (f.natDegree - 1 - i)" ]
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' @[simp] theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n := by cases' n with n · simp suffices ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) = ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right] ring simp_rw [mul_sum, ← mul_assoc] refine sum_congr rfl fun k hk => ?_ congr have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast field_simp [← cast_sub (mem_range.1 hk).le, mul_comm] rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq] #align sum_bernoulli' sum_bernoulli' def bernoulli'PowerSeries := mk fun n => algebraMap ℚ A (bernoulli' n / n !) #align bernoulli'_power_series bernoulli'PowerSeries theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by ext n -- constant coefficient is a special case cases' n with n · simp rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ'] suffices (∑ p ∈ antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : ℚ)⁻¹) = (n ! : ℚ)⁻¹ by simpa [map_sum, Nat.factorial] using congr_arg (algebraMap ℚ A) this apply eq_inv_of_mul_eq_one_left rw [sum_mul] convert bernoulli'_spec' n using 1 apply sum_congr rfl simp_rw [mem_antidiagonal] rintro ⟨i, j⟩ rfl have := factorial_mul_factorial_dvd_factorial_add i j field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose] norm_cast simp [mul_comm (j + 1)] #align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
Mathlib/NumberTheory/Bernoulli.lean
181
196
theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 := by
let B := mk fun n => bernoulli' n / (n ! : ℚ) suffices (B - evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1) by cases' mul_eq_mul_right_iff.mp this with h h <;> simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h · apply eq_zero_of_neg_eq specialize h n split_ifs at h <;> simp_all [B, h_odd.neg_one_pow, factorial_ne_zero] · simpa (config := {decide := true}) [Nat.factorial] using h 1 have h : B * (exp ℚ - 1) = X * exp ℚ := by simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg] suffices evalNegHom (B * (exp ℚ - 1)) * exp ℚ = evalNegHom (X * exp ℚ) * exp ℚ by rw [map_mul, map_mul] at this -- Porting note: Why doesn't simp do this? simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp ℚ)), exp_mul_exp_neg_eq_one] congr
[ " bernoulli' n = 1 - ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k", " ∑ k ∈ range n.succ, ↑(n.choose (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1", " ∑ x ∈ range n, (↑(n.choose x) / (↑n - ↑x + 1) * bernoulli' x - ↑(n.choose (n - x)) / (↑n - ↑x + 1) * bernoulli' x) = 0", " ↑(n.choose x) / (↑n - ↑...
[ " bernoulli' n = 1 - ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k", " ∑ k ∈ range n.succ, ↑(n.choose (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1", " ∑ x ∈ range n, (↑(n.choose x) / (↑n - ↑x + 1) * bernoulli' x - ↑(n.choose (n - x)) / (↑n - ↑x + 1) * bernoulli' x) = 0", " ↑(n.choose x) / (↑n - ↑...
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Combinatorics.Quiver.Path #align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" universe v v₁ v₂ u u₁ u₂ variable {U : Type*} [Quiver.{u + 1} U] namespace Quiver def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : u' ⟶ v' := Eq.ndrec (motive := (· ⟶ v')) (Eq.ndrec e hv) hu #align quiver.hom.cast Quiver.Hom.cast theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by subst_vars rfl #align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast @[simp] theorem Hom.cast_rfl_rfl {u v : U} (e : u ⟶ v) : e.cast rfl rfl = e := rfl #align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl @[simp] theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u ⟶ v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align quiver.hom.cast_cast Quiver.Hom.cast_cast theorem Hom.cast_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : HEq (e.cast hu hv) e := by subst_vars rfl #align quiver.hom.cast_heq Quiver.Hom.cast_heq theorem Hom.cast_eq_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) (e' : u' ⟶ v') : e.cast hu hv = e' ↔ HEq e e' := by rw [Hom.cast_eq_cast] exact _root_.cast_eq_iff_heq #align quiver.hom.cast_eq_iff_heq Quiver.Hom.cast_eq_iff_heq theorem Hom.eq_cast_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) (e' : u' ⟶ v') : e' = e.cast hu hv ↔ HEq e' e := by rw [eq_comm, Hom.cast_eq_iff_heq] exact ⟨HEq.symm, HEq.symm⟩ #align quiver.hom.eq_cast_iff_heq Quiver.Hom.eq_cast_iff_heq open Path def Path.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) : Path u' v' := Eq.ndrec (motive := (Path · v')) (Eq.ndrec p hv) hu #align quiver.path.cast Quiver.Path.cast theorem Path.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (p : Path u v) : p.cast hu hv = _root_.cast (by rw [hu, hv]) p := by subst_vars rfl #align quiver.path.cast_eq_cast Quiver.Path.cast_eq_cast @[simp] theorem Path.cast_rfl_rfl {u v : U} (p : Path u v) : p.cast rfl rfl = p := rfl #align quiver.path.cast_rfl_rfl Quiver.Path.cast_rfl_rfl @[simp]
Mathlib/Combinatorics/Quiver/Cast.lean
99
103
theorem Path.cast_cast {u v u' v' u'' v'' : U} (p : Path u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.cast hu hv).cast hu' hv' = p.cast (hu.trans hu') (hv.trans hv') := by
subst_vars rfl
[ " (u ⟶ v) = (u' ⟶ v')", " cast hu hv e = _root_.cast ⋯ e", " cast ⋯ ⋯ e = _root_.cast ⋯ e", " cast hu' hv' (cast hu hv e) = cast ⋯ ⋯ e", " cast ⋯ ⋯ (cast ⋯ ⋯ e) = cast ⋯ ⋯ e", " HEq (cast hu hv e) e", " HEq (cast ⋯ ⋯ e) e", " cast hu hv e = e' ↔ HEq e e'", " _root_.cast ⋯ e = e' ↔ HEq e e'", " e' ...
[ " (u ⟶ v) = (u' ⟶ v')", " cast hu hv e = _root_.cast ⋯ e", " cast ⋯ ⋯ e = _root_.cast ⋯ e", " cast hu' hv' (cast hu hv e) = cast ⋯ ⋯ e", " cast ⋯ ⋯ (cast ⋯ ⋯ e) = cast ⋯ ⋯ e", " HEq (cast hu hv e) e", " HEq (cast ⋯ ⋯ e) e", " cast hu hv e = e' ↔ HEq e e'", " _root_.cast ⋯ e = e' ↔ HEq e e'", " e' ...
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing import Mathlib.AlgebraicGeometry.OpenImmersion #align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false noncomputable section universe u open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace open CategoryTheory.GlueData namespace AlgebraicGeometry namespace Scheme -- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet structure GlueData extends CategoryTheory.GlueData Scheme where f_open : ∀ i j, IsOpenImmersion (f i j) #align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData attribute [instance] GlueData.f_open namespace OpenCover variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X) def gluedCoverT' (x y z : 𝒰.J) : pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟶ _) (pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟶ _) ⟶ pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟶ _) (pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟶ _) := by refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · simp [pullback.condition] · simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT' @[simp, reassoc] theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) : 𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst @[simp, reassoc] theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_snd @[simp, reassoc] theorem gluedCoverT'_snd_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_fst @[simp, reassoc] theorem gluedCoverT'_snd_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.snd = pullback.fst ≫ pullback.fst := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_snd_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_snd_snd
Mathlib/AlgebraicGeometry/Gluing.lean
319
322
theorem glued_cover_cocycle_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ gluedCoverT' 𝒰 y z x ≫ gluedCoverT' 𝒰 z x y ≫ pullback.fst = pullback.fst := by
apply pullback.hom_ext <;> simp
[ " pullback pullback.fst pullback.fst ⟶ pullback pullback.fst pullback.fst", " pullback (pullback.fst ≫ 𝒰.map x) (𝒰.map z) ⟶ pullback pullback.fst pullback.fst", " pullback (pullback.fst ≫ 𝒰.map x) (𝒰.map z) ⟶ pullback (pullback.fst ≫ 𝒰.map y) (𝒰.map z)", " (pullback.fst ≫ 𝒰.map x) ≫ 𝟙 X = (pullbackSym...
[ " pullback pullback.fst pullback.fst ⟶ pullback pullback.fst pullback.fst", " pullback (pullback.fst ≫ 𝒰.map x) (𝒰.map z) ⟶ pullback pullback.fst pullback.fst", " pullback (pullback.fst ≫ 𝒰.map x) (𝒰.map z) ⟶ pullback (pullback.fst ≫ 𝒰.map y) (𝒰.map z)", " (pullback.fst ≫ 𝒰.map x) ≫ 𝟙 X = (pullbackSym...
import Mathlib.RingTheory.AdjoinRoot import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.Polynomial.GaussLemma #align_import field_theory.minpoly.is_integrally_closed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Classical Polynomial open Polynomial Set Function minpoly namespace minpoly variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain R] [Algebra R S] section variable (K L : Type*) [Field K] [Algebra R K] [IsFractionRing R K] [CommRing L] [Nontrivial L] [Algebra R L] [Algebra S L] [Algebra K L] [IsScalarTower R K L] [IsScalarTower R S L] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_eq_field_fractions [IsDomain S] {s : S} (hs : IsIntegral R s) : minpoly K (algebraMap S L s) = (minpoly R s).map (algebraMap R K) := by refine (eq_of_irreducible_of_monic ?_ ?_ ?_).symm · exact ((monic hs).irreducible_iff_irreducible_map_fraction_map).1 (irreducible hs) · rw [aeval_map_algebraMap, aeval_algebraMap_apply, aeval, map_zero] · exact (monic hs).map _ #align minpoly.is_integrally_closed_eq_field_fractions minpoly.isIntegrallyClosed_eq_field_fractions theorem isIntegrallyClosed_eq_field_fractions' [IsDomain S] [Algebra K S] [IsScalarTower R K S] {s : S} (hs : IsIntegral R s) : minpoly K s = (minpoly R s).map (algebraMap R K) := by let L := FractionRing S rw [← isIntegrallyClosed_eq_field_fractions K L hs, algebraMap_eq (IsFractionRing.injective S L)] #align minpoly.is_integrally_closed_eq_field_fractions' minpoly.isIntegrallyClosed_eq_field_fractions' end variable [IsDomain S] [NoZeroSMulDivisors R S] variable [IsIntegrallyClosed R] theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]} (hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by let K := FractionRing R let L := FractionRing S let _ : Algebra K L := FractionRing.liftAlgebra R L have := FractionRing.isScalarTower_liftAlgebra R L have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div] · refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_ · rw [← map_aeval_eq_aeval_map, hp, map_zero] rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq] apply dvd_mul_of_dvd_left rw [isIntegrallyClosed_eq_field_fractions K L hs] exact Monic.map _ (minpoly.monic hs) rw [isIntegrallyClosed_eq_field_fractions _ _ hs, map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)] exact Polynomial.eq_zero_of_dvd_of_degree_lt this (degree_modByMonic_lt p <| minpoly.monic hs) #align minpoly.is_integrally_closed_dvd minpoly.isIntegrallyClosed_dvd theorem isIntegrallyClosed_dvd_iff {s : S} (hs : IsIntegral R s) (p : R[X]) : Polynomial.aeval s p = 0 ↔ minpoly R s ∣ p := ⟨fun hp => isIntegrallyClosed_dvd hs hp, fun hp => by simpa only [RingHom.mem_ker, RingHom.coe_comp, coe_evalRingHom, coe_mapRingHom, Function.comp_apply, eval_map, ← aeval_def] using aeval_eq_zero_of_dvd_aeval_eq_zero hp (minpoly.aeval R s)⟩ #align minpoly.is_integrally_closed_dvd_iff minpoly.isIntegrallyClosed_dvd_iff theorem ker_eval {s : S} (hs : IsIntegral R s) : RingHom.ker ((Polynomial.aeval s).toRingHom : R[X] →+* S) = Ideal.span ({minpoly R s} : Set R[X]) := by ext p simp_rw [RingHom.mem_ker, AlgHom.toRingHom_eq_coe, AlgHom.coe_toRingHom, isIntegrallyClosed_dvd_iff hs, ← Ideal.mem_span_singleton] #align minpoly.ker_eval minpoly.ker_eval
Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
114
118
theorem IsIntegrallyClosed.degree_le_of_ne_zero {s : S} (hs : IsIntegral R s) {p : R[X]} (hp0 : p ≠ 0) (hp : Polynomial.aeval s p = 0) : degree (minpoly R s) ≤ degree p := by
rw [degree_eq_natDegree (minpoly.ne_zero hs), degree_eq_natDegree hp0] norm_cast exact natDegree_le_of_dvd ((isIntegrallyClosed_dvd_iff hs _).mp hp) hp0
[ " minpoly K ((algebraMap S L) s) = map (algebraMap R K) (minpoly R s)", " Irreducible (map (algebraMap R K) (minpoly R s))", " (Polynomial.aeval ((algebraMap S L) s)) (map (algebraMap R K) (minpoly R s)) = 0", " (map (algebraMap R K) (minpoly R s)).Monic", " minpoly K s = map (algebraMap R K) (minpoly R s)"...
[ " minpoly K ((algebraMap S L) s) = map (algebraMap R K) (minpoly R s)", " Irreducible (map (algebraMap R K) (minpoly R s))", " (Polynomial.aeval ((algebraMap S L) s)) (map (algebraMap R K) (minpoly R s)) = 0", " (map (algebraMap R K) (minpoly R s)).Monic", " minpoly K s = map (algebraMap R K) (minpoly R s)"...
import Mathlib.LinearAlgebra.LinearPMap import Mathlib.Topology.Algebra.Module.Basic #align_import topology.algebra.module.linear_pmap from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology variable {R E F : Type*} variable [CommRing R] [AddCommGroup E] [AddCommGroup F] variable [Module R E] [Module R F] variable [TopologicalSpace E] [TopologicalSpace F] namespace LinearPMap def IsClosed (f : E →ₗ.[R] F) : Prop := _root_.IsClosed (f.graph : Set (E × F)) #align linear_pmap.is_closed LinearPMap.IsClosed variable [ContinuousAdd E] [ContinuousAdd F] variable [TopologicalSpace R] [ContinuousSMul R E] [ContinuousSMul R F] def IsClosable (f : E →ₗ.[R] F) : Prop := ∃ f' : LinearPMap R E F, f.graph.topologicalClosure = f'.graph #align linear_pmap.is_closable LinearPMap.IsClosable theorem IsClosed.isClosable {f : E →ₗ.[R] F} (hf : f.IsClosed) : f.IsClosable := ⟨f, hf.submodule_topologicalClosure_eq⟩ #align linear_pmap.is_closed.is_closable LinearPMap.IsClosed.isClosable theorem IsClosable.leIsClosable {f g : E →ₗ.[R] F} (hf : f.IsClosable) (hfg : g ≤ f) : g.IsClosable := by cases' hf with f' hf have : g.graph.topologicalClosure ≤ f'.graph := by rw [← hf] exact Submodule.topologicalClosure_mono (le_graph_of_le hfg) use g.graph.topologicalClosure.toLinearPMap rw [Submodule.toLinearPMap_graph_eq] exact fun _ hx hx' => f'.graph_fst_eq_zero_snd (this hx) hx' #align linear_pmap.is_closable.le_is_closable LinearPMap.IsClosable.leIsClosable theorem IsClosable.existsUnique {f : E →ₗ.[R] F} (hf : f.IsClosable) : ∃! f' : E →ₗ.[R] F, f.graph.topologicalClosure = f'.graph := by refine exists_unique_of_exists_of_unique hf fun _ _ hy₁ hy₂ => eq_of_eq_graph ?_ rw [← hy₁, ← hy₂] #align linear_pmap.is_closable.exists_unique LinearPMap.IsClosable.existsUnique open scoped Classical noncomputable def closure (f : E →ₗ.[R] F) : E →ₗ.[R] F := if hf : f.IsClosable then hf.choose else f #align linear_pmap.closure LinearPMap.closure theorem closure_def {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.closure = hf.choose := by simp [closure, hf] #align linear_pmap.closure_def LinearPMap.closure_def theorem closure_def' {f : E →ₗ.[R] F} (hf : ¬f.IsClosable) : f.closure = f := by simp [closure, hf] #align linear_pmap.closure_def' LinearPMap.closure_def' theorem IsClosable.graph_closure_eq_closure_graph {f : E →ₗ.[R] F} (hf : f.IsClosable) : f.graph.topologicalClosure = f.closure.graph := by rw [closure_def hf] exact hf.choose_spec #align linear_pmap.is_closable.graph_closure_eq_closure_graph LinearPMap.IsClosable.graph_closure_eq_closure_graph
Mathlib/Topology/Algebra/Module/LinearPMap.lean
119
124
theorem le_closure (f : E →ₗ.[R] F) : f ≤ f.closure := by
by_cases hf : f.IsClosable · refine le_of_le_graph ?_ rw [← hf.graph_closure_eq_closure_graph] exact (graph f).le_topologicalClosure rw [closure_def' hf]
[ " g.IsClosable", " g.graph.topologicalClosure ≤ f'.graph", " g.graph.topologicalClosure ≤ f.graph.topologicalClosure", " g.graph.topologicalClosure = g.graph.topologicalClosure.toLinearPMap.graph", " ∀ x ∈ g.graph.topologicalClosure, x.1 = 0 → x.2 = 0", " ∃! f', f.graph.topologicalClosure = f'.graph", "...
[ " g.IsClosable", " g.graph.topologicalClosure ≤ f'.graph", " g.graph.topologicalClosure ≤ f.graph.topologicalClosure", " g.graph.topologicalClosure = g.graph.topologicalClosure.toLinearPMap.graph", " ∀ x ∈ g.graph.topologicalClosure, x.1 = 0 → x.2 = 0", " ∃! f', f.graph.topologicalClosure = f'.graph", "...
import Mathlib.Algebra.CharZero.Defs import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Monoid.OrderDual import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Defs import Mathlib.Order.WithBot #align_import algebra.order.monoid.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" universe u v variable {α : Type u} {β : Type v} open Function namespace WithTop section Add variable [Add α] {a b c d : WithTop α} {x y : α} instance add : Add (WithTop α) := ⟨Option.map₂ (· + ·)⟩ #align with_top.has_add WithTop.add @[simp, norm_cast] lemma coe_add (a b : α) : ↑(a + b) = (a + b : WithTop α) := rfl #align with_top.coe_add WithTop.coe_add #noalign with_top.coe_bit0 #noalign with_top.coe_bit1 @[simp] theorem top_add (a : WithTop α) : ⊤ + a = ⊤ := rfl #align with_top.top_add WithTop.top_add @[simp] theorem add_top (a : WithTop α) : a + ⊤ = ⊤ := by cases a <;> rfl #align with_top.add_top WithTop.add_top @[simp] theorem add_eq_top : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by match a, b with | ⊤, _ => simp | _, ⊤ => simp | (a : α), (b : α) => simp only [← coe_add, coe_ne_top, or_false] #align with_top.add_eq_top WithTop.add_eq_top theorem add_ne_top : a + b ≠ ⊤ ↔ a ≠ ⊤ ∧ b ≠ ⊤ := add_eq_top.not.trans not_or #align with_top.add_ne_top WithTop.add_ne_top
Mathlib/Algebra/Order/Monoid/WithTop.lean
143
144
theorem add_lt_top [LT α] {a b : WithTop α} : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ := by
simp_rw [WithTop.lt_top_iff_ne_top, add_ne_top]
[ " a + ⊤ = ⊤", " ⊤ + ⊤ = ⊤", " ↑a✝ + ⊤ = ⊤", " a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤", " ⊤ + x✝ = ⊤ ↔ ⊤ = ⊤ ∨ x✝ = ⊤", " x✝ + ⊤ = ⊤ ↔ x✝ = ⊤ ∨ ⊤ = ⊤", " ↑a + ↑b = ⊤ ↔ ↑a = ⊤ ∨ ↑b = ⊤", " a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤" ]
[ " a + ⊤ = ⊤", " ⊤ + ⊤ = ⊤", " ↑a✝ + ⊤ = ⊤", " a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤", " ⊤ + x✝ = ⊤ ↔ ⊤ = ⊤ ∨ x✝ = ⊤", " x✝ + ⊤ = ⊤ ↔ x✝ = ⊤ ∨ ⊤ = ⊤", " ↑a + ↑b = ⊤ ↔ ↑a = ⊤ ∨ ↑b = ⊤" ]
import Mathlib.MeasureTheory.PiSystem import Mathlib.Order.OmegaCompletePartialOrder import Mathlib.Topology.Constructions import Mathlib.MeasureTheory.MeasurableSpace.Basic open Set namespace MeasureTheory variable {ι : Type _} {α : ι → Type _} section squareCylinders def squareCylinders (C : ∀ i, Set (Set (α i))) : Set (Set (∀ i, α i)) := {S | ∃ s : Finset ι, ∃ t ∈ univ.pi C, S = (s : Set ι).pi t} theorem squareCylinders_eq_iUnion_image (C : ∀ i, Set (Set (α i))) : squareCylinders C = ⋃ s : Finset ι, (fun t ↦ (s : Set ι).pi t) '' univ.pi C := by ext1 f simp only [squareCylinders, mem_iUnion, mem_image, mem_univ_pi, exists_prop, mem_setOf_eq, eq_comm (a := f)] theorem isPiSystem_squareCylinders {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) (hC_univ : ∀ i, univ ∈ C i) : IsPiSystem (squareCylinders C) := by rintro S₁ ⟨s₁, t₁, h₁, rfl⟩ S₂ ⟨s₂, t₂, h₂, rfl⟩ hst_nonempty classical let t₁' := s₁.piecewise t₁ (fun i ↦ univ) let t₂' := s₂.piecewise t₂ (fun i ↦ univ) have h1 : ∀ i ∈ (s₁ : Set ι), t₁ i = t₁' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h1' : ∀ i ∉ (s₁ : Set ι), t₁' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi have h2 : ∀ i ∈ (s₂ : Set ι), t₂ i = t₂' i := fun i hi ↦ (Finset.piecewise_eq_of_mem _ _ _ hi).symm have h2' : ∀ i ∉ (s₂ : Set ι), t₂' i = univ := fun i hi ↦ Finset.piecewise_eq_of_not_mem _ _ _ hi rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, ← union_pi_inter h1' h2'] refine ⟨s₁ ∪ s₂, fun i ↦ t₁' i ∩ t₂' i, ?_, ?_⟩ · rw [mem_univ_pi] intro i have : (t₁' i ∩ t₂' i).Nonempty := by obtain ⟨f, hf⟩ := hst_nonempty rw [Set.pi_congr rfl h1, Set.pi_congr rfl h2, mem_inter_iff, mem_pi, mem_pi] at hf refine ⟨f i, ⟨?_, ?_⟩⟩ · by_cases hi₁ : i ∈ s₁ · exact hf.1 i hi₁ · rw [h1' i hi₁] exact mem_univ _ · by_cases hi₂ : i ∈ s₂ · exact hf.2 i hi₂ · rw [h2' i hi₂] exact mem_univ _ refine hC i _ ?_ _ ?_ this · by_cases hi₁ : i ∈ s₁ · rw [← h1 i hi₁] exact h₁ i (mem_univ _) · rw [h1' i hi₁] exact hC_univ i · by_cases hi₂ : i ∈ s₂ · rw [← h2 i hi₂] exact h₂ i (mem_univ _) · rw [h2' i hi₂] exact hC_univ i · rw [Finset.coe_union] theorem comap_eval_le_generateFrom_squareCylinders_singleton (α : ι → Type*) [m : ∀ i, MeasurableSpace (α i)] (i : ι) : MeasurableSpace.comap (Function.eval i) (m i) ≤ MeasurableSpace.generateFrom ((fun t ↦ ({i} : Set ι).pi t) '' univ.pi fun i ↦ {s : Set (α i) | MeasurableSet s}) := by simp only [Function.eval, singleton_pi, ge_iff_le] rw [MeasurableSpace.comap_eq_generateFrom] refine MeasurableSpace.generateFrom_mono fun S ↦ ?_ simp only [mem_setOf_eq, mem_image, mem_univ_pi, forall_exists_index, and_imp] intro t ht h classical refine ⟨fun j ↦ if hji : j = i then by convert t else univ, fun j ↦ ?_, ?_⟩ · by_cases hji : j = i · simp only [hji, eq_self_iff_true, eq_mpr_eq_cast, dif_pos] convert ht simp only [id_eq, cast_heq] · simp only [hji, not_false_iff, dif_neg, MeasurableSet.univ] · simp only [id_eq, eq_mpr_eq_cast, ← h] ext1 x simp only [singleton_pi, Function.eval, cast_eq, dite_eq_ite, ite_true, mem_preimage]
Mathlib/MeasureTheory/Constructions/Cylinders.lean
129
144
theorem generateFrom_squareCylinders [∀ i, MeasurableSpace (α i)] : MeasurableSpace.generateFrom (squareCylinders fun i ↦ {s : Set (α i) | MeasurableSet s}) = MeasurableSpace.pi := by
apply le_antisymm · rw [MeasurableSpace.generateFrom_le_iff] rintro S ⟨s, t, h, rfl⟩ simp only [mem_univ_pi, mem_setOf_eq] at h exact MeasurableSet.pi (Finset.countable_toSet _) (fun i _ ↦ h i) · refine iSup_le fun i ↦ ?_ refine (comap_eval_le_generateFrom_squareCylinders_singleton α i).trans ?_ refine MeasurableSpace.generateFrom_mono ?_ rw [← Finset.coe_singleton, squareCylinders_eq_iUnion_image] exact subset_iUnion (fun (s : Finset ι) ↦ (fun t : ∀ i, Set (α i) ↦ (s : Set ι).pi t) '' univ.pi (fun i ↦ setOf MeasurableSet)) ({i} : Finset ι)
[ " squareCylinders C = ⋃ s, (fun t => (↑s).pi t) '' univ.pi C", " f ∈ squareCylinders C ↔ f ∈ ⋃ s, (fun t => (↑s).pi t) '' univ.pi C", " IsPiSystem (squareCylinders C)", " (↑s₁).pi t₁ ∩ (↑s₂).pi t₂ ∈ squareCylinders C", " ((↑s₁ ∪ ↑s₂).pi fun i => t₁' i ∩ t₂' i) ∈ squareCylinders C", " (fun i => t₁' i ∩ t₂'...
[ " squareCylinders C = ⋃ s, (fun t => (↑s).pi t) '' univ.pi C", " f ∈ squareCylinders C ↔ f ∈ ⋃ s, (fun t => (↑s).pi t) '' univ.pi C", " IsPiSystem (squareCylinders C)", " (↑s₁).pi t₁ ∩ (↑s₂).pi t₂ ∈ squareCylinders C", " ((↑s₁ ∪ ↑s₂).pi fun i => t₁' i ∩ t₂' i) ∈ squareCylinders C", " (fun i => t₁' i ∩ t₂'...
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} section Prod section HasDeriv variable {ι : Type*} [DecidableEq ι] {𝔸' : Type*} [NormedCommRing 𝔸'] [NormedAlgebra 𝕜 𝔸'] {u : Finset ι} {f : ι → 𝕜 → 𝔸'} {f' : ι → 𝔸'} theorem HasDerivAt.finset_prod (hf : ∀ i ∈ u, HasDerivAt (f i) (f' i) x) : HasDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivAt)).hasDerivAt theorem HasDerivWithinAt.finset_prod (hf : ∀ i ∈ u, HasDerivWithinAt (f i) (f' i) s x) : HasDerivWithinAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x := by simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasFDerivWithinAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivWithinAt)).hasDerivWithinAt
Mathlib/Analysis/Calculus/Deriv/Mul.lean
346
349
theorem HasStrictDerivAt.finset_prod (hf : ∀ i ∈ u, HasStrictDerivAt (f i) (f' i) x) : HasStrictDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using (HasStrictFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasStrictFDerivAt)).hasStrictDerivAt
[ " HasDerivAt (fun x => ∏ i ∈ u, f i x) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x", " HasDerivWithinAt (fun x => ∏ i ∈ u, f i x) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x", " HasStrictDerivAt (fun x => ∏ i ∈ u, f i x) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x" ]
[ " HasDerivAt (fun x => ∏ i ∈ u, f i x) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x", " HasDerivWithinAt (fun x => ∏ i ∈ u, f i x) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x" ]
import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Algebra.Order.Monoid.WithTop #align_import algebra.order.sub.with_top from "leanprover-community/mathlib"@"afdb4fa3b32d41106a4a09b371ce549ad7958abd" variable {α β : Type*} namespace WithTop section variable [Sub α] [Bot α] protected def sub : ∀ _ _ : WithTop α, WithTop α | _, ⊤ => (⊥ : α) | ⊤, (x : α) => ⊤ | (x : α), (y : α) => (x - y : α) #align with_top.sub WithTop.sub instance : Sub (WithTop α) := ⟨WithTop.sub⟩ @[simp, norm_cast] theorem coe_sub {a b : α} : (↑(a - b) : WithTop α) = ↑a - ↑b := rfl #align with_top.coe_sub WithTop.coe_sub @[simp] theorem top_sub_coe {a : α} : (⊤ : WithTop α) - a = ⊤ := rfl #align with_top.top_sub_coe WithTop.top_sub_coe @[simp]
Mathlib/Algebra/Order/Sub/WithTop.lean
55
55
theorem sub_top {a : WithTop α} : a - ⊤ = (⊥ : α) := by
cases a <;> rfl
[ " a - ⊤ = ↑⊥", " ⊤ - ⊤ = ↑⊥", " ↑a✝ - ⊤ = ↑⊥" ]
[]
import Mathlib.Computability.Halting import Mathlib.Computability.TuringMachine import Mathlib.Data.Num.Lemmas import Mathlib.Tactic.DeriveFintype #align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" open Function (update) open Relation namespace Turing namespace ToPartrec inductive Code | zero' | succ | tail | cons : Code → Code → Code | comp : Code → Code → Code | case : Code → Code → Code | fix : Code → Code deriving DecidableEq, Inhabited #align turing.to_partrec.code Turing.ToPartrec.Code #align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero' #align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ #align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail #align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons #align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp #align turing.to_partrec.code.case Turing.ToPartrec.Code.case #align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix def Code.eval : Code → List ℕ →. List ℕ | Code.zero' => fun v => pure (0 :: v) | Code.succ => fun v => pure [v.headI.succ] | Code.tail => fun v => pure v.tail | Code.cons f fs => fun v => do let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) | Code.comp f g => fun v => g.eval v >>= f.eval | Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) | Code.fix f => PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail #align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval namespace Code @[simp] theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval] @[simp] theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval] @[simp] theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval] @[simp] theorem cons_eval (f fs) : (cons f fs).eval = fun v => do { let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) } := by simp [eval] @[simp] theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval] @[simp] theorem case_eval (f g) : (case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by simp [eval] @[simp] theorem fix_eval (f) : (fix f).eval = PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by simp [eval] def nil : Code := tail.comp succ #align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil @[simp] theorem nil_eval (v) : nil.eval v = pure [] := by simp [nil] #align turing.to_partrec.code.nil_eval Turing.ToPartrec.Code.nil_eval def id : Code := tail.comp zero' #align turing.to_partrec.code.id Turing.ToPartrec.Code.id @[simp] theorem id_eval (v) : id.eval v = pure v := by simp [id] #align turing.to_partrec.code.id_eval Turing.ToPartrec.Code.id_eval def head : Code := cons id nil #align turing.to_partrec.code.head Turing.ToPartrec.Code.head @[simp] theorem head_eval (v) : head.eval v = pure [v.headI] := by simp [head] #align turing.to_partrec.code.head_eval Turing.ToPartrec.Code.head_eval def zero : Code := cons zero' nil #align turing.to_partrec.code.zero Turing.ToPartrec.Code.zero @[simp] theorem zero_eval (v) : zero.eval v = pure [0] := by simp [zero] #align turing.to_partrec.code.zero_eval Turing.ToPartrec.Code.zero_eval def pred : Code := case zero head #align turing.to_partrec.code.pred Turing.ToPartrec.Code.pred @[simp] theorem pred_eval (v) : pred.eval v = pure [v.headI.pred] := by simp [pred]; cases v.headI <;> simp #align turing.to_partrec.code.pred_eval Turing.ToPartrec.Code.pred_eval def rfind (f : Code) : Code := comp pred <| comp (fix <| cons f <| cons succ tail) zero' #align turing.to_partrec.code.rfind Turing.ToPartrec.Code.rfind def prec (f g : Code) : Code := let G := cons tail <| cons succ <| cons (comp pred tail) <| cons (comp g <| cons id <| comp tail tail) <| comp tail <| comp tail tail let F := case id <| comp (comp (comp tail tail) (fix G)) zero' cons (comp F (cons head <| cons (comp f tail) tail)) nil #align turing.to_partrec.code.prec Turing.ToPartrec.Code.prec attribute [-simp] Part.bind_eq_bind Part.map_eq_map Part.pure_eq_some
Mathlib/Computability/TMToPartrec.lean
264
282
theorem exists_code.comp {m n} {f : Vector ℕ n →. ℕ} {g : Fin n → Vector ℕ m →. ℕ} (hf : ∃ c : Code, ∀ v : Vector ℕ n, c.eval v.1 = pure <$> f v) (hg : ∀ i, ∃ c : Code, ∀ v : Vector ℕ m, c.eval v.1 = pure <$> g i v) : ∃ c : Code, ∀ v : Vector ℕ m, c.eval v.1 = pure <$> ((Vector.mOfFn fun i => g i v) >>= f) := by
rsuffices ⟨cg, hg⟩ : ∃ c : Code, ∀ v : Vector ℕ m, c.eval v.1 = Subtype.val <$> Vector.mOfFn fun i => g i v · obtain ⟨cf, hf⟩ := hf exact ⟨cf.comp cg, fun v => by simp [hg, hf, map_bind, seq_bind_eq, Function.comp] rfl⟩ clear hf f; induction' n with n IH · exact ⟨nil, fun v => by simp [Vector.mOfFn, Bind.bind]; rfl⟩ · obtain ⟨cg, hg₁⟩ := hg 0 obtain ⟨cl, hl⟩ := IH fun i => hg i.succ exact ⟨cons cg cl, fun v => by simp [Vector.mOfFn, hg₁, map_bind, seq_bind_eq, bind_assoc, (· ∘ ·), hl] rfl⟩
[ " zero'.eval = fun v => pure (0 :: v)", " succ.eval = fun v => pure [v.headI.succ]", " tail.eval = fun v => pure v.tail", " (f.cons fs).eval = fun v => do\n let n ← f.eval v\n let ns ← fs.eval v\n pure (n.headI :: ns)", " (f.comp g).eval = fun v => g.eval v >>= f.eval", " (f.case g).eval = fun v ...
[ " zero'.eval = fun v => pure (0 :: v)", " succ.eval = fun v => pure [v.headI.succ]", " tail.eval = fun v => pure v.tail", " (f.cons fs).eval = fun v => do\n let n ← f.eval v\n let ns ← fs.eval v\n pure (n.headI :: ns)", " (f.comp g).eval = fun v => g.eval v >>= f.eval", " (f.case g).eval = fun v ...
import Mathlib.Data.DFinsupp.Basic import Mathlib.Data.Finset.Pointwise import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import algebra.group.unique_prods from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" @[to_additive "Let `G` be a Type with addition, let `A B : Finset G` be finite subsets and let `a0 b0 : G` be two elements. `UniqueAdd A B a0 b0` asserts `a0 + b0` can be written in at most one way as a sum of an element from `A` and an element from `B`."] def UniqueMul {G} [Mul G] (A B : Finset G) (a0 b0 : G) : Prop := ∀ ⦃a b⦄, a ∈ A → b ∈ B → a * b = a0 * b0 → a = a0 ∧ b = b0 #align unique_mul UniqueMul #align unique_add UniqueAdd namespace UniqueMul variable {G H : Type*} [Mul G] [Mul H] {A B : Finset G} {a0 b0 : G} @[to_additive (attr := nontriviality, simp)] theorem of_subsingleton [Subsingleton G] : UniqueMul A B a0 b0 := by simp [UniqueMul, eq_iff_true_of_subsingleton] @[to_additive] theorem of_card_le_one (hA : A.Nonempty) (hB : B.Nonempty) (hA1 : A.card ≤ 1) (hB1 : B.card ≤ 1) : ∃ a ∈ A, ∃ b ∈ B, UniqueMul A B a b := by rw [Finset.card_le_one_iff] at hA1 hB1 obtain ⟨a, ha⟩ := hA; obtain ⟨b, hb⟩ := hB exact ⟨a, ha, b, hb, fun _ _ ha' hb' _ ↦ ⟨hA1 ha' ha, hB1 hb' hb⟩⟩ @[to_additive] theorem mt (h : UniqueMul A B a0 b0) : ∀ ⦃a b⦄, a ∈ A → b ∈ B → a ≠ a0 ∨ b ≠ b0 → a * b ≠ a0 * b0 := fun _ _ ha hb k ↦ by contrapose! k exact h ha hb k #align unique_mul.mt UniqueMul.mt @[to_additive] theorem subsingleton (h : UniqueMul A B a0 b0) : Subsingleton { ab : G × G // ab.1 ∈ A ∧ ab.2 ∈ B ∧ ab.1 * ab.2 = a0 * b0 } := ⟨fun ⟨⟨_a, _b⟩, ha, hb, ab⟩ ⟨⟨_a', _b'⟩, ha', hb', ab'⟩ ↦ Subtype.ext <| Prod.ext ((h ha hb ab).1.trans (h ha' hb' ab').1.symm) <| (h ha hb ab).2.trans (h ha' hb' ab').2.symm⟩ #align unique_mul.subsingleton UniqueMul.subsingleton #align unique_add.subsingleton UniqueAdd.subsingleton @[to_additive]
Mathlib/Algebra/Group/UniqueProds.lean
95
101
theorem set_subsingleton (h : UniqueMul A B a0 b0) : Set.Subsingleton { ab : G × G | ab.1 ∈ A ∧ ab.2 ∈ B ∧ ab.1 * ab.2 = a0 * b0 } := by
rintro ⟨x1, y1⟩ (hx : x1 ∈ A ∧ y1 ∈ B ∧ x1 * y1 = a0 * b0) ⟨x2, y2⟩ (hy : x2 ∈ A ∧ y2 ∈ B ∧ x2 * y2 = a0 * b0) rcases h hx.1 hx.2.1 hx.2.2 with ⟨rfl, rfl⟩ rcases h hy.1 hy.2.1 hy.2.2 with ⟨rfl, rfl⟩ rfl
[ " UniqueMul A B a0 b0", " ∃ a ∈ A, ∃ b ∈ B, UniqueMul A B a b", " x✝¹ * x✝ ≠ a0 * b0", " x✝¹ = a0 ∧ x✝ = b0", " {ab | ab.1 ∈ A ∧ ab.2 ∈ B ∧ ab.1 * ab.2 = a0 * b0}.Subsingleton", " (x1, y1) = (x2, y2)", " (x2, y2) = (x2, y2)" ]
[ " UniqueMul A B a0 b0", " ∃ a ∈ A, ∃ b ∈ B, UniqueMul A B a b", " x✝¹ * x✝ ≠ a0 * b0", " x✝¹ = a0 ∧ x✝ = b0" ]
import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Group.Units import Mathlib.Algebra.Regular.Basic import Mathlib.GroupTheory.Congruence.Basic import Mathlib.Init.Data.Prod import Mathlib.RingTheory.OreLocalization.Basic #align_import group_theory.monoid_localization from "leanprover-community/mathlib"@"10ee941346c27bdb5e87bb3535100c0b1f08ac41" open Function section CommMonoid variable {M : Type*} [CommMonoid M] (S : Submonoid M) (N : Type*) [CommMonoid N] {P : Type*} [CommMonoid P] namespace Localization -- Porting note: this does not work so it is done explicitly instead -- run_cmd to_additive.map_namespace `Localization `AddLocalization -- run_cmd Elab.Command.liftCoreM <| ToAdditive.insertTranslation `Localization `AddLocalization @[to_additive AddLocalization.r "The congruence relation on `M × S`, `M` an `AddCommMonoid` and `S` an `AddSubmonoid` of `M`, whose quotient is the localization of `M` at `S`, defined as the unique congruence relation on `M × S` such that for any other congruence relation `s` on `M × S` where for all `y ∈ S`, `(0, 0) ∼ (y, y)` under `s`, we have that `(x₁, y₁) ∼ (x₂, y₂)` by `r` implies `(x₁, y₁) ∼ (x₂, y₂)` by `s`."] def r (S : Submonoid M) : Con (M × S) := sInf { c | ∀ y : S, c 1 (y, y) } #align localization.r Localization.r #align add_localization.r AddLocalization.r @[to_additive AddLocalization.r' "An alternate form of the congruence relation on `M × S`, `M` a `CommMonoid` and `S` a submonoid of `M`, whose quotient is the localization of `M` at `S`."] def r' : Con (M × S) := by -- note we multiply by `c` on the left so that we can later generalize to `•` refine { r := fun a b : M × S ↦ ∃ c : S, ↑c * (↑b.2 * a.1) = c * (a.2 * b.1) iseqv := ⟨fun a ↦ ⟨1, rfl⟩, fun ⟨c, hc⟩ ↦ ⟨c, hc.symm⟩, ?_⟩ mul' := ?_ } · rintro a b c ⟨t₁, ht₁⟩ ⟨t₂, ht₂⟩ use t₂ * t₁ * b.2 simp only [Submonoid.coe_mul] calc (t₂ * t₁ * b.2 : M) * (c.2 * a.1) = t₂ * c.2 * (t₁ * (b.2 * a.1)) := by ac_rfl _ = t₁ * a.2 * (t₂ * (c.2 * b.1)) := by rw [ht₁]; ac_rfl _ = t₂ * t₁ * b.2 * (a.2 * c.1) := by rw [ht₂]; ac_rfl · rintro a b c d ⟨t₁, ht₁⟩ ⟨t₂, ht₂⟩ use t₂ * t₁ calc (t₂ * t₁ : M) * (b.2 * d.2 * (a.1 * c.1)) = t₂ * (d.2 * c.1) * (t₁ * (b.2 * a.1)) := by ac_rfl _ = (t₂ * t₁ : M) * (a.2 * c.2 * (b.1 * d.1)) := by rw [ht₁, ht₂]; ac_rfl #align localization.r' Localization.r' #align add_localization.r' AddLocalization.r' @[to_additive AddLocalization.r_eq_r' "The additive congruence relation used to localize an `AddCommMonoid` at a submonoid can be expressed equivalently as an infimum (see `AddLocalization.r`) or explicitly (see `AddLocalization.r'`)."] theorem r_eq_r' : r S = r' S := le_antisymm (sInf_le fun _ ↦ ⟨1, by simp⟩) <| le_sInf fun b H ⟨p, q⟩ ⟨x, y⟩ ⟨t, ht⟩ ↦ by rw [← one_mul (p, q), ← one_mul (x, y)] refine b.trans (b.mul (H (t * y)) (b.refl _)) ?_ convert b.symm (b.mul (H (t * q)) (b.refl (x, y))) using 1 dsimp only [Prod.mk_mul_mk, Submonoid.coe_mul] at ht ⊢ simp_rw [mul_assoc, ht, mul_comm y q] #align localization.r_eq_r' Localization.r_eq_r' #align add_localization.r_eq_r' AddLocalization.r_eq_r' variable {S} @[to_additive AddLocalization.r_iff_exists]
Mathlib/GroupTheory/MonoidLocalization.lean
206
207
theorem r_iff_exists {x y : M × S} : r S x y ↔ ∃ c : S, ↑c * (↑y.2 * x.1) = c * (x.2 * y.1) := by
rw [r_eq_r' S]; rfl
[ " Con (M × ↥S)", " ∀ {x y z : M × ↥S},\n (∃ c, ↑c * (↑y.2 * x.1) = ↑c * (↑x.2 * y.1)) →\n (∃ c, ↑c * (↑z.2 * y.1) = ↑c * (↑y.2 * z.1)) → ∃ c, ↑c * (↑z.2 * x.1) = ↑c * (↑x.2 * z.1)", " ∃ c_1, ↑c_1 * (↑c.2 * a.1) = ↑c_1 * (↑a.2 * c.1)", " ↑(t₂ * t₁ * b.2) * (↑c.2 * a.1) = ↑(t₂ * t₁ * b.2) * (↑a.2 * c.1)...
[ " Con (M × ↥S)", " ∀ {x y z : M × ↥S},\n (∃ c, ↑c * (↑y.2 * x.1) = ↑c * (↑x.2 * y.1)) →\n (∃ c, ↑c * (↑z.2 * y.1) = ↑c * (↑y.2 * z.1)) → ∃ c, ↑c * (↑z.2 * x.1) = ↑c * (↑x.2 * z.1)", " ∃ c_1, ↑c_1 * (↑c.2 * a.1) = ↑c_1 * (↑a.2 * c.1)", " ↑(t₂ * t₁ * b.2) * (↑c.2 * a.1) = ↑(t₂ * t₁ * b.2) * (↑a.2 * c.1)...
import Mathlib.SetTheory.Ordinal.Arithmetic namespace OrdinalApprox universe u variable {α : Type u} variable [CompleteLattice α] (f : α →o α) (x : α) open Function fixedPoints Cardinal Order OrderHom set_option linter.unusedVariables false in def lfpApprox (a : Ordinal.{u}) : α := sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x}) termination_by a decreasing_by exact h theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by unfold Monotone; intros a b h; unfold lfpApprox refine sSup_le_sSup ?h apply sup_le_sup_right simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intros a' h' use a' exact ⟨lt_of_lt_of_le h' h, rfl⟩ theorem le_lfpApprox {a : Ordinal} : x ≤ lfpApprox f x a := by unfold lfpApprox apply le_sSup simp only [exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, true_or]
Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean
92
112
theorem lfpApprox_add_one (h : x ≤ f x) (a : Ordinal) : lfpApprox f x (a+1) = f (lfpApprox f x a) := by
apply le_antisymm · conv => left; unfold lfpApprox apply sSup_le simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop, Set.union_singleton, Set.mem_insert_iff, Set.mem_setOf_eq, forall_eq_or_imp, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] apply And.intro · apply le_trans h apply Monotone.imp f.monotone exact le_lfpApprox f x · intros a' h apply f.2; apply lfpApprox_monotone; exact h · conv => right; unfold lfpApprox apply le_sSup simp only [Ordinal.add_one_eq_succ, lt_succ_iff, exists_prop] rw [Set.mem_union] apply Or.inl simp only [Set.mem_setOf_eq] use a
[ " (invImage (fun x => x) Ordinal.wellFoundedRelation).1 b a", " Monotone (lfpApprox f x)", " ∀ ⦃a b : Ordinal.{u}⦄, a ≤ b → lfpApprox f x a ≤ lfpApprox f x b", " lfpApprox f x a ≤ lfpApprox f x b", " sSup ({x_1 | ∃ b, ∃ (_ : b < a), f (lfpApprox f x b) = x_1} ∪ {x}) ≤\n sSup ({x_1 | ∃ b_1, ∃ (_ : b_1 < b...
[ " (invImage (fun x => x) Ordinal.wellFoundedRelation).1 b a", " Monotone (lfpApprox f x)", " ∀ ⦃a b : Ordinal.{u}⦄, a ≤ b → lfpApprox f x a ≤ lfpApprox f x b", " lfpApprox f x a ≤ lfpApprox f x b", " sSup ({x_1 | ∃ b, ∃ (_ : b < a), f (lfpApprox f x b) = x_1} ∪ {x}) ≤\n sSup ({x_1 | ∃ b_1, ∃ (_ : b_1 < b...
import Mathlib.Data.TypeMax import Mathlib.Logic.UnivLE import Mathlib.CategoryTheory.Limits.Shapes.Images #align_import category_theory.limits.types from "leanprover-community/mathlib"@"4aa2a2e17940311e47007f087c9df229e7f12942" open CategoryTheory CategoryTheory.Limits universe v u w namespace CategoryTheory.Limits namespace Types section limit_characterization variable {J : Type v} [Category.{w} J] {F : J ⥤ Type u} def coneOfSection {s} (hs : s ∈ F.sections) : Cone F where pt := PUnit π := { app := fun j _ ↦ s j, naturality := fun i j f ↦ by ext; exact (hs f).symm } def sectionOfCone (c : Cone F) (x : c.pt) : F.sections := ⟨fun j ↦ c.π.app j x, fun f ↦ congr_fun (c.π.naturality f).symm x⟩ theorem isLimit_iff (c : Cone F) : Nonempty (IsLimit c) ↔ ∀ s ∈ F.sections, ∃! x : c.pt, ∀ j, c.π.app j x = s j := by refine ⟨fun ⟨t⟩ s hs ↦ ?_, fun h ↦ ⟨?_⟩⟩ · let cs := coneOfSection hs exact ⟨t.lift cs ⟨⟩, fun j ↦ congr_fun (t.fac cs j) ⟨⟩, fun x hx ↦ congr_fun (t.uniq cs (fun _ ↦ x) fun j ↦ funext fun _ ↦ hx j) ⟨⟩⟩ · choose x hx using fun c y ↦ h _ (sectionOfCone c y).2 exact ⟨x, fun c j ↦ funext fun y ↦ (hx c y).1 j, fun c f hf ↦ funext fun y ↦ (hx c y).2 (f y) (fun j ↦ congr_fun (hf j) y)⟩ theorem isLimit_iff_bijective_sectionOfCone (c : Cone F) : Nonempty (IsLimit c) ↔ (Types.sectionOfCone c).Bijective := by simp_rw [isLimit_iff, Function.bijective_iff_existsUnique, Subtype.forall, F.sections_ext_iff, sectionOfCone] noncomputable def isLimitEquivSections {c : Cone F} (t : IsLimit c) : c.pt ≃ F.sections where toFun := sectionOfCone c invFun s := t.lift (coneOfSection s.2) ⟨⟩ left_inv x := (congr_fun (t.uniq (coneOfSection _) (fun _ ↦ x) fun _ ↦ rfl) ⟨⟩).symm right_inv s := Subtype.ext (funext fun j ↦ congr_fun (t.fac (coneOfSection s.2) j) ⟨⟩) #align category_theory.limits.types.is_limit_equiv_sections CategoryTheory.Limits.Types.isLimitEquivSections @[simp] theorem isLimitEquivSections_apply {c : Cone F} (t : IsLimit c) (j : J) (x : c.pt) : (isLimitEquivSections t x : ∀ j, F.obj j) j = c.π.app j x := rfl #align category_theory.limits.types.is_limit_equiv_sections_apply CategoryTheory.Limits.Types.isLimitEquivSections_apply @[simp]
Mathlib/CategoryTheory/Limits/Types.lean
83
87
theorem isLimitEquivSections_symm_apply {c : Cone F} (t : IsLimit c) (x : F.sections) (j : J) : c.π.app j ((isLimitEquivSections t).symm x) = (x : ∀ j, F.obj j) j := by
conv_rhs => rw [← (isLimitEquivSections t).right_inv x] rfl
[ " ((Functor.const J).obj PUnit.{u + 1}).map f ≫ (fun j x => s j) j = (fun j x => s j) i ≫ F.map f", " (((Functor.const J).obj PUnit.{u + 1}).map f ≫ (fun j x => s j) j) a✝ = ((fun j x => s j) i ≫ F.map f) a✝", " Nonempty (IsLimit c) ↔ ∀ s ∈ F.sections, ∃! x, ∀ (j : J), c.π.app j x = s j", " ∃! x, ∀ (j : J), c...
[ " ((Functor.const J).obj PUnit.{u + 1}).map f ≫ (fun j x => s j) j = (fun j x => s j) i ≫ F.map f", " (((Functor.const J).obj PUnit.{u + 1}).map f ≫ (fun j x => s j) j) a✝ = ((fun j x => s j) i ≫ F.map f) a✝", " Nonempty (IsLimit c) ↔ ∀ s ∈ F.sections, ∃! x, ∀ (j : J), c.π.app j x = s j", " ∃! x, ∀ (j : J), c...
import Mathlib.Topology.Category.Profinite.Basic universe u namespace Profinite variable {ι : Type u} {X : ι → Type} [∀ i, TopologicalSpace (X i)] (C : Set ((i : ι) → X i)) (J K : ι → Prop) namespace IndexFunctor open ContinuousMap def obj : Set ((i : {i : ι // J i}) → X i) := ContinuousMap.precomp (Subtype.val (p := J)) '' C def π_app : C(C, obj C J) := ⟨Set.MapsTo.restrict (precomp (Subtype.val (p := J))) _ _ (Set.mapsTo_image _ _), Continuous.restrict _ (Pi.continuous_precomp' _)⟩ variable {J K} def map (h : ∀ i, J i → K i) : C(obj C K, obj C J) := ⟨Set.MapsTo.restrict (precomp (Set.inclusion h)) _ _ (fun _ hx ↦ by obtain ⟨y, hy⟩ := hx rw [← hy.2] exact ⟨y, hy.1, rfl⟩), Continuous.restrict _ (Pi.continuous_precomp' _)⟩
Mathlib/Topology/Category/Profinite/Product.lean
58
62
theorem surjective_π_app : Function.Surjective (π_app C J) := by
intro x obtain ⟨y, hy⟩ := x.prop exact ⟨⟨y, hy.1⟩, Subtype.ext hy.2⟩
[ " (precomp (Set.inclusion h)) x✝ ∈ obj C J", " (precomp (Set.inclusion h)) ((precomp Subtype.val) y) ∈ obj C J", " Function.Surjective ⇑(π_app C J)", " ∃ a, (π_app C J) a = x" ]
[ " (precomp (Set.inclusion h)) x✝ ∈ obj C J", " (precomp (Set.inclusion h)) ((precomp Subtype.val) y) ∈ obj C J" ]
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {𝕜 E : Type*} variable [NormedField 𝕜] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀] #align smul_ball smul_ball theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall
Mathlib/Analysis/NormedSpace/Pointwise.lean
95
101
theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • sphere x r = sphere (c • x) (‖c‖ * r) := by
ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r]
[ " c • ball x r = ball (c • x) (‖c‖ * r)", " y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)", " c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)", "𝕜 : Type u_1\nE : Type u_2\ninst✝² : NormedField 𝕜\ninst✝¹ : SeminormedAddCommGroup E\ninst✝ : NormedSpace 𝕜 E\nc : 𝕜\nhc : c ≠ 0\nx : E\nr : ℝ\ny : E\n| c⁻¹ • y...
[ " c • ball x r = ball (c • x) (‖c‖ * r)", " y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)", " c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)", "𝕜 : Type u_1\nE : Type u_2\ninst✝² : NormedField 𝕜\ninst✝¹ : SeminormedAddCommGroup E\ninst✝ : NormedSpace 𝕜 E\nc : 𝕜\nhc : c ≠ 0\nx : E\nr : ℝ\ny : E\n| c⁻¹ • y...
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic suppress_compilation open Bornology open Filter hiding map_smul open scoped Classical NNReal Topology Uniformity -- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*} section SemiNormed open Metric ContinuousLinearMap variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eₗ] [SeminormedAddCommGroup F] [SeminormedAddCommGroup Fₗ] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gₗ] variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃] [NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Gₗ] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [FunLike 𝓕 E F] namespace ContinuousLinearMap section OpNorm open Set Real section variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E →SL[σ₁₂] F) (h : F →SL[σ₂₃] G) (x : E)
Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean
49
53
theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by
ext rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image] simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk, exists_prop]
[ " ‖f‖₊ = sInf {c | ∀ (x : E), ‖f x‖₊ ≤ c * ‖x‖₊}", " ↑‖f‖₊ = ↑(sInf {c | ∀ (x : E), ‖f x‖₊ ≤ c * ‖x‖₊})", " sInf {c | 0 ≤ c ∧ ∀ (x : E), ‖f x‖ ≤ c * ‖x‖} = sInf {x | ∃ (h : 0 ≤ x), ⟨x, h⟩ ∈ {c | ∀ (x : E), ‖f x‖₊ ≤ c * ‖x‖₊}}" ]
[]
import Mathlib.Analysis.Calculus.BumpFunction.Basic import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Function Filter Set Metric MeasureTheory FiniteDimensional Measure open scoped Topology namespace ContDiffBump variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E] [MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} {μ : Measure E} protected def normed (μ : Measure E) : E → ℝ := fun x => f x / ∫ x, f x ∂μ #align cont_diff_bump.normed ContDiffBump.normed theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ := rfl #align cont_diff_bump.normed_def ContDiffBump.normed_def theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x := div_nonneg f.nonneg <| integral_nonneg f.nonneg' #align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ) := f.contDiff.div_const _ #align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed theorem continuous_normed : Continuous (f.normed μ) := f.continuous.div_const _ #align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed
Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
49
50
theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by
simp_rw [f.normed_def, f.sub]
[ " f.normed μ (c - x) = f.normed μ (c + x)" ]
[]
import Mathlib.Algebra.Order.Floor import Mathlib.Algebra.Order.Field.Power import Mathlib.Data.Nat.Log #align_import data.int.log from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" variable {R : Type*} [LinearOrderedSemifield R] [FloorSemiring R] namespace Int def log (b : ℕ) (r : R) : ℤ := if 1 ≤ r then Nat.log b ⌊r⌋₊ else -Nat.clog b ⌈r⁻¹⌉₊ #align int.log Int.log theorem log_of_one_le_right (b : ℕ) {r : R} (hr : 1 ≤ r) : log b r = Nat.log b ⌊r⌋₊ := if_pos hr #align int.log_of_one_le_right Int.log_of_one_le_right theorem log_of_right_le_one (b : ℕ) {r : R} (hr : r ≤ 1) : log b r = -Nat.clog b ⌈r⁻¹⌉₊ := by obtain rfl | hr := hr.eq_or_lt · rw [log, if_pos hr, inv_one, Nat.ceil_one, Nat.floor_one, Nat.log_one_right, Nat.clog_one_right, Int.ofNat_zero, neg_zero] · exact if_neg hr.not_le #align int.log_of_right_le_one Int.log_of_right_le_one @[simp, norm_cast] theorem log_natCast (b : ℕ) (n : ℕ) : log b (n : R) = Nat.log b n := by cases n · simp [log_of_right_le_one] · rw [log_of_one_le_right, Nat.floor_natCast] simp #align int.log_nat_cast Int.log_natCast -- See note [no_index around OfNat.ofNat] @[simp] theorem log_ofNat (b : ℕ) (n : ℕ) [n.AtLeastTwo] : log b (no_index (OfNat.ofNat n : R)) = Nat.log b (OfNat.ofNat n) := log_natCast b n
Mathlib/Data/Int/Log.lean
87
90
theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (r : R) : log b r = 0 := by
rcases le_total 1 r with h | h · rw [log_of_one_le_right _ h, Nat.log_of_left_le_one hb, Int.ofNat_zero] · rw [log_of_right_le_one _ h, Nat.clog_of_left_le_one hb, Int.ofNat_zero, neg_zero]
[ " log b r = -↑(b.clog ⌈r⁻¹⌉₊)", " log b 1 = -↑(b.clog ⌈1⁻¹⌉₊)", " log b ↑n = ↑(b.log n)", " log b ↑0 = ↑(b.log 0)", " log b ↑(n✝ + 1) = ↑(b.log (n✝ + 1))", " 1 ≤ ↑(n✝ + 1)", " log b r = 0" ]
[ " log b r = -↑(b.clog ⌈r⁻¹⌉₊)", " log b 1 = -↑(b.clog ⌈1⁻¹⌉₊)", " log b ↑n = ↑(b.log n)", " log b ↑0 = ↑(b.log 0)", " log b ↑(n✝ + 1) = ↑(b.log (n✝ + 1))", " 1 ≤ ↑(n✝ + 1)" ]
import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.CategoryTheory.Limits.Preserves.Basic import Mathlib.CategoryTheory.Limits.TypesFiltered import Mathlib.CategoryTheory.Limits.Yoneda import Mathlib.Tactic.ApplyFun #align_import category_theory.limits.concrete_category from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" universe t w v u r open CategoryTheory namespace CategoryTheory.Limits attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort section Colimits section variable {C : Type u} [Category.{v} C] [ConcreteCategory.{t} C] {J : Type w} [Category.{r} J] (F : J ⥤ C) [PreservesColimit F (forget C)] theorem Concrete.from_union_surjective_of_isColimit {D : Cocone F} (hD : IsColimit D) : let ff : (Σj : J, F.obj j) → D.pt := fun a => D.ι.app a.1 a.2 Function.Surjective ff := by intro ff x let E : Cocone (F ⋙ forget C) := (forget C).mapCocone D let hE : IsColimit E := isColimitOfPreserves (forget C) hD obtain ⟨j, y, hy⟩ := Types.jointly_surjective_of_isColimit hE x exact ⟨⟨j, y⟩, hy⟩ #align category_theory.limits.concrete.from_union_surjective_of_is_colimit CategoryTheory.Limits.Concrete.from_union_surjective_of_isColimit theorem Concrete.isColimit_exists_rep {D : Cocone F} (hD : IsColimit D) (x : D.pt) : ∃ (j : J) (y : F.obj j), D.ι.app j y = x := by obtain ⟨a, rfl⟩ := Concrete.from_union_surjective_of_isColimit F hD x exact ⟨a.1, a.2, rfl⟩ #align category_theory.limits.concrete.is_colimit_exists_rep CategoryTheory.Limits.Concrete.isColimit_exists_rep theorem Concrete.colimit_exists_rep [HasColimit F] (x : ↑(colimit F)) : ∃ (j : J) (y : F.obj j), colimit.ι F j y = x := Concrete.isColimit_exists_rep F (colimit.isColimit _) x #align category_theory.limits.concrete.colimit_exists_rep CategoryTheory.Limits.Concrete.colimit_exists_rep theorem Concrete.isColimit_rep_eq_of_exists {D : Cocone F} {i j : J} (x : F.obj i) (y : F.obj j) (h : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f x = F.map g y) : D.ι.app i x = D.ι.app j y := by let E := (forget C).mapCocone D obtain ⟨k, f, g, (hfg : (F ⋙ forget C).map f x = F.map g y)⟩ := h let h1 : (F ⋙ forget C).map f ≫ E.ι.app k = E.ι.app i := E.ι.naturality f let h2 : (F ⋙ forget C).map g ≫ E.ι.app k = E.ι.app j := E.ι.naturality g show E.ι.app i x = E.ι.app j y rw [← h1, types_comp_apply, hfg] exact congrFun h2 y #align category_theory.limits.concrete.is_colimit_rep_eq_of_exists CategoryTheory.Limits.Concrete.isColimit_rep_eq_of_exists theorem Concrete.colimit_rep_eq_of_exists [HasColimit F] {i j : J} (x : F.obj i) (y : F.obj j) (h : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f x = F.map g y) : colimit.ι F i x = colimit.ι F j y := Concrete.isColimit_rep_eq_of_exists F x y h #align category_theory.limits.concrete.colimit_rep_eq_of_exists CategoryTheory.Limits.Concrete.colimit_rep_eq_of_exists end section FilteredColimits variable {C : Type u} [Category.{v} C] [ConcreteCategory.{max t w} C] {J : Type w} [Category.{r} J] (F : J ⥤ C) [PreservesColimit F (forget C)] [IsFiltered J]
Mathlib/CategoryTheory/Limits/ConcreteCategory.lean
122
127
theorem Concrete.isColimit_exists_of_rep_eq {D : Cocone F} {i j : J} (hD : IsColimit D) (x : F.obj i) (y : F.obj j) (h : D.ι.app _ x = D.ι.app _ y) : ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f x = F.map g y := by
let E := (forget C).mapCocone D let hE : IsColimit E := isColimitOfPreserves _ hD exact (Types.FilteredColimit.isColimit_eq_iff (F ⋙ forget C) hE).mp h
[ " let ff := fun a => (D.ι.app a.fst) a.snd;\n Function.Surjective ff", " ∃ a, ff a = x", " ∃ j y, (D.ι.app j) y = x", " ∃ j y, (D.ι.app j) y = (fun a => (D.ι.app a.fst) a.snd) a", " (D.ι.app i) x = (D.ι.app j) y", " E.ι.app i x = E.ι.app j y", " E.ι.app k ((F.map g) y) = E.ι.app j y", " ∃ k f g, (F.m...
[ " let ff := fun a => (D.ι.app a.fst) a.snd;\n Function.Surjective ff", " ∃ a, ff a = x", " ∃ j y, (D.ι.app j) y = x", " ∃ j y, (D.ι.app j) y = (fun a => (D.ι.app a.fst) a.snd) a", " (D.ι.app i) x = (D.ι.app j) y", " E.ι.app i x = E.ι.app j y", " E.ι.app k ((F.map g) y) = E.ι.app j y" ]
import Mathlib.Algebra.Ring.Int import Mathlib.Data.Nat.Bitwise import Mathlib.Data.Nat.Size #align_import data.int.bitwise from "leanprover-community/mathlib"@"0743cc5d9d86bcd1bba10f480e948a257d65056f" #align_import init.data.int.bitwise from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd" namespace Int def div2 : ℤ → ℤ | (n : ℕ) => n.div2 | -[n +1] => negSucc n.div2 #align int.div2 Int.div2 def bodd : ℤ → Bool | (n : ℕ) => n.bodd | -[n +1] => not (n.bodd) #align int.bodd Int.bodd -- Porting note: `bit0, bit1` deprecated, do we need to adapt `bit`? set_option linter.deprecated false in def bit (b : Bool) : ℤ → ℤ := cond b bit1 bit0 #align int.bit Int.bit def testBit : ℤ → ℕ → Bool | (m : ℕ), n => Nat.testBit m n | -[m +1], n => !(Nat.testBit m n) #align int.test_bit Int.testBit def natBitwise (f : Bool → Bool → Bool) (m n : ℕ) : ℤ := cond (f false false) -[ Nat.bitwise (fun x y => not (f x y)) m n +1] (Nat.bitwise f m n) #align int.nat_bitwise Int.natBitwise def bitwise (f : Bool → Bool → Bool) : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => natBitwise f m n | (m : ℕ), -[n +1] => natBitwise (fun x y => f x (not y)) m n | -[m +1], (n : ℕ) => natBitwise (fun x y => f (not x) y) m n | -[m +1], -[n +1] => natBitwise (fun x y => f (not x) (not y)) m n #align int.bitwise Int.bitwise def lnot : ℤ → ℤ | (m : ℕ) => -[m +1] | -[m +1] => m #align int.lnot Int.lnot def lor : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => m ||| n | (m : ℕ), -[n +1] => -[Nat.ldiff n m +1] | -[m +1], (n : ℕ) => -[Nat.ldiff m n +1] | -[m +1], -[n +1] => -[m &&& n +1] #align int.lor Int.lor def land : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => m &&& n | (m : ℕ), -[n +1] => Nat.ldiff m n | -[m +1], (n : ℕ) => Nat.ldiff n m | -[m +1], -[n +1] => -[m ||| n +1] #align int.land Int.land -- Porting note: I don't know why `Nat.ldiff` got the prime, but I'm matching this change here def ldiff : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => Nat.ldiff m n | (m : ℕ), -[n +1] => m &&& n | -[m +1], (n : ℕ) => -[m ||| n +1] | -[m +1], -[n +1] => Nat.ldiff n m #align int.ldiff Int.ldiff -- Porting note: I don't know why `Nat.xor'` got the prime, but I'm matching this change here protected def xor : ℤ → ℤ → ℤ | (m : ℕ), (n : ℕ) => (m ^^^ n) | (m : ℕ), -[n +1] => -[(m ^^^ n) +1] | -[m +1], (n : ℕ) => -[(m ^^^ n) +1] | -[m +1], -[n +1] => (m ^^^ n) #align int.lxor Int.xor instance : ShiftLeft ℤ where shiftLeft | (m : ℕ), (n : ℕ) => Nat.shiftLeft' false m n | (m : ℕ), -[n +1] => m >>> (Nat.succ n) | -[m +1], (n : ℕ) => -[Nat.shiftLeft' true m n +1] | -[m +1], -[n +1] => -[m >>> (Nat.succ n) +1] #align int.shiftl ShiftLeft.shiftLeft instance : ShiftRight ℤ where shiftRight m n := m <<< (-n) #align int.shiftr ShiftRight.shiftRight @[simp] theorem bodd_zero : bodd 0 = false := rfl #align int.bodd_zero Int.bodd_zero @[simp] theorem bodd_one : bodd 1 = true := rfl #align int.bodd_one Int.bodd_one theorem bodd_two : bodd 2 = false := rfl #align int.bodd_two Int.bodd_two @[simp, norm_cast] theorem bodd_coe (n : ℕ) : Int.bodd n = Nat.bodd n := rfl #align int.bodd_coe Int.bodd_coe @[simp]
Mathlib/Data/Int/Bitwise.lean
145
149
theorem bodd_subNatNat (m n : ℕ) : bodd (subNatNat m n) = xor m.bodd n.bodd := by
apply subNatNat_elim m n fun m n i => bodd i = xor m.bodd n.bodd <;> intros i j <;> simp only [Int.bodd, Int.bodd_coe, Nat.bodd_add] <;> cases Nat.bodd i <;> simp
[ " (subNatNat m n).bodd = xor m.bodd n.bodd", " ∀ (i n : ℕ), (↑i).bodd = xor (n + i).bodd n.bodd", " ∀ (i m : ℕ), -[i+1].bodd = xor m.bodd (m + i + 1).bodd", " (↑i).bodd = xor (j + i).bodd j.bodd", " -[i+1].bodd = xor j.bodd (j + i + 1).bodd", " i.bodd = xor (xor j.bodd i.bodd) j.bodd", " (!i.bodd) = xor...
[]
import Mathlib.Algebra.BigOperators.Fin import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.Prod import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Tactic.FinCases import Mathlib.Tactic.LinearCombination import Mathlib.Lean.Expr.ExtraRecognizers import Mathlib.Data.Set.Subsingleton #align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" noncomputable section open Function Set Submodule open Cardinal universe u' u variable {ι : Type u'} {ι' : Type*} {R : Type*} {K : Type*} variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*} section Module variable {v : ι → M} variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M''] variable [Module R M] [Module R M'] [Module R M''] variable {a b : R} {x y : M} variable (R) (v) def LinearIndependent : Prop := LinearMap.ker (Finsupp.total ι M R v) = ⊥ #align linear_independent LinearIndependent open Lean PrettyPrinter.Delaborator SubExpr in @[delab app.LinearIndependent] def delabLinearIndependent : Delab := whenPPOption getPPNotation <| whenNotPPOption getPPAnalysisSkip <| withOptionAtCurrPos `pp.analysis.skip true do let e ← getExpr guard <| e.isAppOfArity ``LinearIndependent 7 let some _ := (e.getArg! 0).coeTypeSet? | failure let optionsPerPos ← if (e.getArg! 3).isLambda then withNaryArg 3 do return (← read).optionsPerPos.setBool (← getPos) pp.funBinderTypes.name true else withNaryArg 0 do return (← read).optionsPerPos.setBool (← getPos) `pp.analysis.namedArg true withTheReader Context ({· with optionsPerPos}) delab variable {R} {v} theorem linearIndependent_iff : LinearIndependent R v ↔ ∀ l, Finsupp.total ι M R v l = 0 → l = 0 := by simp [LinearIndependent, LinearMap.ker_eq_bot'] #align linear_independent_iff linearIndependent_iff theorem linearIndependent_iff' : LinearIndependent R v ↔ ∀ s : Finset ι, ∀ g : ι → R, ∑ i ∈ s, g i • v i = 0 → ∀ i ∈ s, g i = 0 := linearIndependent_iff.trans ⟨fun hf s g hg i his => have h := hf (∑ i ∈ s, Finsupp.single i (g i)) <| by simpa only [map_sum, Finsupp.total_single] using hg calc g i = (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single i (g i)) := by { rw [Finsupp.lapply_apply, Finsupp.single_eq_same] } _ = ∑ j ∈ s, (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single j (g j)) := Eq.symm <| Finset.sum_eq_single i (fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji]) fun hnis => hnis.elim his _ = (∑ j ∈ s, Finsupp.single j (g j)) i := (map_sum ..).symm _ = 0 := DFunLike.ext_iff.1 h i, fun hf l hl => Finsupp.ext fun i => _root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩ #align linear_independent_iff' linearIndependent_iff' theorem linearIndependent_iff'' : LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R), (∀ i ∉ s, g i = 0) → ∑ i ∈ s, g i • v i = 0 → ∀ i, g i = 0 := by classical exact linearIndependent_iff'.trans ⟨fun H s g hg hv i => if his : i ∈ s then H s g hv i his else hg i his, fun H s g hg i hi => by convert H s (fun j => if j ∈ s then g j else 0) (fun j hj => if_neg hj) (by simp_rw [ite_smul, zero_smul, Finset.sum_extend_by_zero, hg]) i exact (if_pos hi).symm⟩ #align linear_independent_iff'' linearIndependent_iff'' theorem not_linearIndependent_iff : ¬LinearIndependent R v ↔ ∃ s : Finset ι, ∃ g : ι → R, ∑ i ∈ s, g i • v i = 0 ∧ ∃ i ∈ s, g i ≠ 0 := by rw [linearIndependent_iff'] simp only [exists_prop, not_forall] #align not_linear_independent_iff not_linearIndependent_iff theorem Fintype.linearIndependent_iff [Fintype ι] : LinearIndependent R v ↔ ∀ g : ι → R, ∑ i, g i • v i = 0 → ∀ i, g i = 0 := by refine ⟨fun H g => by simpa using linearIndependent_iff'.1 H Finset.univ g, fun H => linearIndependent_iff''.2 fun s g hg hs i => H _ ?_ _⟩ rw [← hs] refine (Finset.sum_subset (Finset.subset_univ _) fun i _ hi => ?_).symm rw [hg i hi, zero_smul] #align fintype.linear_independent_iff Fintype.linearIndependent_iff
Mathlib/LinearAlgebra/LinearIndependent.lean
186
189
theorem Fintype.linearIndependent_iff' [Fintype ι] [DecidableEq ι] : LinearIndependent R v ↔ LinearMap.ker (LinearMap.lsum R (fun _ ↦ R) ℕ fun i ↦ LinearMap.id.smulRight (v i)) = ⊥ := by
simp [Fintype.linearIndependent_iff, LinearMap.ker_eq_bot', funext_iff]
[ " LinearIndependent R v ↔ ∀ (l : ι →₀ R), (Finsupp.total ι M R v) l = 0 → l = 0", " (Finsupp.total ι M R v) (∑ i ∈ s, Finsupp.single i (g i)) = 0", " g i = (Finsupp.lapply i) (Finsupp.single i (g i))", " (Finsupp.lapply i) (Finsupp.single j (g j)) = 0", " LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R)...
[ " LinearIndependent R v ↔ ∀ (l : ι →₀ R), (Finsupp.total ι M R v) l = 0 → l = 0", " (Finsupp.total ι M R v) (∑ i ∈ s, Finsupp.single i (g i)) = 0", " g i = (Finsupp.lapply i) (Finsupp.single i (g i))", " (Finsupp.lapply i) (Finsupp.single j (g j)) = 0", " LinearIndependent R v ↔ ∀ (s : Finset ι) (g : ι → R)...
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)
[ " τ = swap i j * σ", " σ = υ ∨ σ = swap i j * υ", " υ = υ ∨ υ = swap i j * υ", " [].prod x = f x", " 1 x = f x", " ∀ g ∈ [], g.IsSwap", " False", " (swap x (f x) :: ↑m).prod = f", " P 1 → (∀ (f : Perm α) (x y : α), x ≠ y → P f → P (swap x y * f)) → P f", " P f", " g ∈ g :: l", " P (swap x y * ...
[ " τ = swap i j * σ", " σ = υ ∨ σ = swap i j * υ", " υ = υ ∨ υ = swap i j * υ", " [].prod x = f x", " 1 x = f x", " ∀ g ∈ [], g.IsSwap", " False", " (swap x (f x) :: ↑m).prod = f" ]
def SatisfiesM {m : Type u → Type v} [Functor m] (p : α → Prop) (x : m α) : Prop := ∃ x' : m {a // p a}, Subtype.val <$> x' = x @[simp] theorem SatisfiesM_Id_eq : SatisfiesM (m := Id) p x ↔ p x := ⟨fun ⟨y, eq⟩ => eq ▸ y.2, fun h => ⟨⟨_, h⟩, rfl⟩⟩ @[simp] theorem SatisfiesM_Option_eq : SatisfiesM (m := Option) p x ↔ ∀ a, x = some a → p a := ⟨by revert x; intro | some _, ⟨some ⟨_, h⟩, rfl⟩, _, rfl => exact h, fun h => match x with | some a => ⟨some ⟨a, h _ rfl⟩, rfl⟩ | none => ⟨none, rfl⟩⟩ @[simp] theorem SatisfiesM_Except_eq : SatisfiesM (m := Except ε) p x ↔ ∀ a, x = .ok a → p a := ⟨by revert x; intro | .ok _, ⟨.ok ⟨_, h⟩, rfl⟩, _, rfl => exact h, fun h => match x with | .ok a => ⟨.ok ⟨a, h _ rfl⟩, rfl⟩ | .error e => ⟨.error e, rfl⟩⟩ @[simp] theorem SatisfiesM_ReaderT_eq [Monad m] : SatisfiesM (m := ReaderT ρ m) p x ↔ ∀ s, SatisfiesM p (x s) := (exists_congr fun a => by exact ⟨fun eq _ => eq ▸ rfl, funext⟩).trans Classical.skolem.symm
.lake/packages/batteries/Batteries/Classes/SatisfiesM.lean
165
166
theorem SatisfiesM_StateRefT_eq [Monad m] : SatisfiesM (m := StateRefT' ω σ m) p x ↔ ∀ s, SatisfiesM p (x s) := by
simp
[ " SatisfiesM p x → ∀ (a : α✝), x = some a → p a", " ∀ {x : Option α✝}, SatisfiesM p x → ∀ (a : α✝), x = some a → p a", " p ⟨val✝, h⟩.val", " SatisfiesM p x → ∀ (a : α✝), x = Except.ok a → p a", " ∀ {x : Except ε α✝}, SatisfiesM p x → ∀ (a : α✝), x = Except.ok a → p a", " Subtype.val <$> a = x ↔ ∀ (x_1 : ρ...
[ " SatisfiesM p x → ∀ (a : α✝), x = some a → p a", " ∀ {x : Option α✝}, SatisfiesM p x → ∀ (a : α✝), x = some a → p a", " p ⟨val✝, h⟩.val", " SatisfiesM p x → ∀ (a : α✝), x = Except.ok a → p a", " ∀ {x : Except ε α✝}, SatisfiesM p x → ∀ (a : α✝), x = Except.ok a → p a", " Subtype.val <$> a = x ↔ ∀ (x_1 : ρ...
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" namespace MeasureTheory open Filter open scoped ENNReal variable {α E : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ : Measure α} [NormedAddCommGroup E] theorem snorm'_trim (hm : m ≤ m0) {f : α → E} (hf : StronglyMeasurable[m] f) : snorm' f q (μ.trim hm) = snorm' f q μ := by simp_rw [snorm'] congr 1 refine lintegral_trim hm ?_ refine @Measurable.pow_const _ _ _ _ _ _ _ m _ (@Measurable.coe_nnreal_ennreal _ m _ ?_) q apply @StronglyMeasurable.measurable exact @StronglyMeasurable.nnnorm α m _ _ _ hf #align measure_theory.snorm'_trim MeasureTheory.snorm'_trim theorem limsup_trim (hm : m ≤ m0) {f : α → ℝ≥0∞} (hf : Measurable[m] f) : limsup f (ae (μ.trim hm)) = limsup f (ae μ) := by simp_rw [limsup_eq] suffices h_set_eq : { a : ℝ≥0∞ | ∀ᵐ n ∂μ.trim hm, f n ≤ a } = { a : ℝ≥0∞ | ∀ᵐ n ∂μ, f n ≤ a } by rw [h_set_eq] ext1 a suffices h_meas_eq : μ { x | ¬f x ≤ a } = μ.trim hm { x | ¬f x ≤ a } by simp_rw [Set.mem_setOf_eq, ae_iff, h_meas_eq] refine (trim_measurableSet_eq hm ?_).symm refine @MeasurableSet.compl _ _ m (@measurableSet_le ℝ≥0∞ _ _ _ _ m _ _ _ _ _ hf ?_) exact @measurable_const _ _ _ m _ #align measure_theory.limsup_trim MeasureTheory.limsup_trim
Mathlib/MeasureTheory/Function/LpSeminorm/Trim.lean
48
51
theorem essSup_trim (hm : m ≤ m0) {f : α → ℝ≥0∞} (hf : Measurable[m] f) : essSup f (μ.trim hm) = essSup f μ := by
simp_rw [essSup] exact limsup_trim hm hf
[ " snorm' f q (μ.trim hm) = snorm' f q μ", " (∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ.trim hm) ^ (1 / q) = (∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q)", " ∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ.trim hm = ∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ", " Measurable fun a => ↑‖f a‖₊ ^ q", " Measurable fun a => ‖f a‖₊", " StronglyMeasurable fun a => ‖f a‖₊"...
[ " snorm' f q (μ.trim hm) = snorm' f q μ", " (∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ.trim hm) ^ (1 / q) = (∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q)", " ∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ.trim hm = ∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ", " Measurable fun a => ↑‖f a‖₊ ^ q", " Measurable fun a => ‖f a‖₊", " StronglyMeasurable fun a => ‖f a‖₊"...
import Mathlib.Data.Int.Bitwise import Mathlib.Data.Int.Order.Lemmas import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.int.lemmas from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f" open Nat namespace Int theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by by_cases h : m ≥ n · exact le_of_eq (Int.ofNat_sub h).symm · simp [le_of_not_ge h, ofNat_le] #align int.le_coe_nat_sub Int.le_natCast_sub -- Porting note (#10618): simp can prove this @[simp] theorem succ_natCast_pos (n : ℕ) : 0 < (n : ℤ) + 1 := lt_add_one_iff.mpr (by simp) #align int.succ_coe_nat_pos Int.succ_natCast_pos variable {a b : ℤ} {n : ℕ} theorem natAbs_eq_iff_sq_eq {a b : ℤ} : a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2 := by rw [sq, sq] exact natAbs_eq_iff_mul_self_eq #align int.nat_abs_eq_iff_sq_eq Int.natAbs_eq_iff_sq_eq theorem natAbs_lt_iff_sq_lt {a b : ℤ} : a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2 := by rw [sq, sq] exact natAbs_lt_iff_mul_self_lt #align int.nat_abs_lt_iff_sq_lt Int.natAbs_lt_iff_sq_lt theorem natAbs_le_iff_sq_le {a b : ℤ} : a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2 := by rw [sq, sq] exact natAbs_le_iff_mul_self_le #align int.nat_abs_le_iff_sq_le Int.natAbs_le_iff_sq_le theorem natAbs_inj_of_nonneg_of_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) : natAbs a = natAbs b ↔ a = b := by rw [← sq_eq_sq ha hb, ← natAbs_eq_iff_sq_eq] #align int.nat_abs_inj_of_nonneg_of_nonneg Int.natAbs_inj_of_nonneg_of_nonneg theorem natAbs_inj_of_nonpos_of_nonpos {a b : ℤ} (ha : a ≤ 0) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = b := by simpa only [Int.natAbs_neg, neg_inj] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonpos_of_nonpos Int.natAbs_inj_of_nonpos_of_nonpos theorem natAbs_inj_of_nonneg_of_nonpos {a b : ℤ} (ha : 0 ≤ a) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = -b := by simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg ha (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonneg_of_nonpos Int.natAbs_inj_of_nonneg_of_nonpos
Mathlib/Data/Int/Lemmas.lean
75
77
theorem natAbs_inj_of_nonpos_of_nonneg {a b : ℤ} (ha : a ≤ 0) (hb : 0 ≤ b) : natAbs a = natAbs b ↔ -a = b := by
simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) hb
[ " ↑m - ↑n ≤ ↑(m - n)", " 0 ≤ ↑n", " a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2", " a.natAbs = b.natAbs ↔ a * a = b * b", " a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2", " a.natAbs < b.natAbs ↔ a * a < b * b", " a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2", " a.natAbs ≤ b.natAbs ↔ a * a ≤ b * b", " a.natAbs = b.natAbs ↔ a ...
[ " ↑m - ↑n ≤ ↑(m - n)", " 0 ≤ ↑n", " a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2", " a.natAbs = b.natAbs ↔ a * a = b * b", " a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2", " a.natAbs < b.natAbs ↔ a * a < b * b", " a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2", " a.natAbs ≤ b.natAbs ↔ a * a ≤ b * b", " a.natAbs = b.natAbs ↔ a ...
import Mathlib.Data.Nat.Totient import Mathlib.Data.Nat.Nth import Mathlib.NumberTheory.SmoothNumbers #align_import number_theory.prime_counting from "leanprover-community/mathlib"@"7fdd4f3746cb059edfdb5d52cba98f66fce418c0" namespace Nat open Finset def primeCounting' : ℕ → ℕ := Nat.count Prime #align nat.prime_counting' Nat.primeCounting' def primeCounting (n : ℕ) : ℕ := primeCounting' (n + 1) #align nat.prime_counting Nat.primeCounting @[inherit_doc] scoped notation "π" => Nat.primeCounting @[inherit_doc] scoped notation "π'" => Nat.primeCounting' theorem monotone_primeCounting' : Monotone primeCounting' := count_monotone Prime #align nat.monotone_prime_counting' Nat.monotone_primeCounting' theorem monotone_primeCounting : Monotone primeCounting := monotone_primeCounting'.comp (monotone_id.add_const _) #align nat.monotone_prime_counting Nat.monotone_primeCounting @[simp] theorem primeCounting'_nth_eq (n : ℕ) : π' (nth Prime n) = n := count_nth_of_infinite infinite_setOf_prime _ #align nat.prime_counting'_nth_eq Nat.primeCounting'_nth_eq @[simp] theorem prime_nth_prime (n : ℕ) : Prime (nth Prime n) := nth_mem_of_infinite infinite_setOf_prime _ #align nat.prime_nth_prime Nat.prime_nth_prime lemma primesBelow_card_eq_primeCounting' (n : ℕ) : n.primesBelow.card = primeCounting' n := by simp only [primesBelow, primeCounting'] exact (count_eq_card_filter_range Prime n).symm
Mathlib/NumberTheory/PrimeCounting.lean
83
102
theorem primeCounting'_add_le {a k : ℕ} (h0 : 0 < a) (h1 : a < k) (n : ℕ) : π' (k + n) ≤ π' k + Nat.totient a * (n / a + 1) := calc π' (k + n) ≤ ((range k).filter Prime).card + ((Ico k (k + n)).filter Prime).card := by
rw [primeCounting', count_eq_card_filter_range, range_eq_Ico, ← Ico_union_Ico_eq_Ico (zero_le k) le_self_add, filter_union] apply card_union_le _ ≤ π' k + ((Ico k (k + n)).filter Prime).card := by rw [primeCounting', count_eq_card_filter_range] _ ≤ π' k + ((Ico k (k + n)).filter (Coprime a)).card := by refine add_le_add_left (card_le_card ?_) k.primeCounting' simp only [subset_iff, and_imp, mem_filter, mem_Ico] intro p succ_k_le_p p_lt_n p_prime constructor · exact ⟨succ_k_le_p, p_lt_n⟩ · rw [coprime_comm] exact coprime_of_lt_prime h0 (gt_of_ge_of_gt succ_k_le_p h1) p_prime _ ≤ π' k + totient a * (n / a + 1) := by rw [add_le_add_iff_left] exact Ico_filter_coprime_le k n h0
[ " n.primesBelow.card = π' n", " (filter (fun p => p.Prime) (range n)).card = count Prime n", " π' (k + n) ≤ (filter Prime (range k)).card + (filter Prime (Ico k (k + n))).card", " (filter Prime (Ico 0 k) ∪ filter Prime (Ico k (k + n))).card ≤\n (filter Prime (Ico 0 k)).card + (filter Prime (Ico k (k + n)))...
[ " n.primesBelow.card = π' n", " (filter (fun p => p.Prime) (range n)).card = count Prime n" ]