Context
stringlengths
57
85k
file_name
stringlengths
21
79
start
int64
14
2.42k
end
int64
18
2.43k
theorem
stringlengths
25
2.71k
proof
stringlengths
5
10.6k
import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.Algebra.Module.ULift #align_import ring_theory.is_tensor_product from "leanprover-community/mathlib"@"c4926d76bb9c5a4a62ed2f03d998081786132105" universe u v₁ vβ‚‚ v₃ vβ‚„ open TensorProduct section IsTensorProduct variable {R : Type*} [CommSemiring R] variable {M₁ Mβ‚‚ M M' : Type*} variable [AddCommMonoid M₁] [AddCommMonoid Mβ‚‚] [AddCommMonoid M] [AddCommMonoid M'] variable [Module R M₁] [Module R Mβ‚‚] [Module R M] [Module R M'] variable (f : M₁ β†’β‚—[R] Mβ‚‚ β†’β‚—[R] M) variable {N₁ Nβ‚‚ N : Type*} [AddCommMonoid N₁] [AddCommMonoid Nβ‚‚] [AddCommMonoid N] variable [Module R N₁] [Module R Nβ‚‚] [Module R N] variable {g : N₁ β†’β‚—[R] Nβ‚‚ β†’β‚—[R] N} def IsTensorProduct : Prop := Function.Bijective (TensorProduct.lift f) #align is_tensor_product IsTensorProduct variable (R M N) {f} theorem TensorProduct.isTensorProduct : IsTensorProduct (TensorProduct.mk R M N) := by delta IsTensorProduct convert_to Function.Bijective (LinearMap.id : M βŠ—[R] N β†’β‚—[R] M βŠ—[R] N) using 2 Β· apply TensorProduct.ext' simp Β· exact Function.bijective_id #align tensor_product.is_tensor_product TensorProduct.isTensorProduct variable {R M N} @[simps! apply] noncomputable def IsTensorProduct.equiv (h : IsTensorProduct f) : M₁ βŠ—[R] Mβ‚‚ ≃ₗ[R] M := LinearEquiv.ofBijective _ h #align is_tensor_product.equiv IsTensorProduct.equiv @[simp] theorem IsTensorProduct.equiv_toLinearMap (h : IsTensorProduct f) : h.equiv.toLinearMap = TensorProduct.lift f := rfl #align is_tensor_product.equiv_to_linear_map IsTensorProduct.equiv_toLinearMap @[simp] theorem IsTensorProduct.equiv_symm_apply (h : IsTensorProduct f) (x₁ : M₁) (xβ‚‚ : Mβ‚‚) : h.equiv.symm (f x₁ xβ‚‚) = x₁ βŠ—β‚œ xβ‚‚ := by apply h.equiv.injective refine (h.equiv.apply_symm_apply _).trans ?_ simp #align is_tensor_product.equiv_symm_apply IsTensorProduct.equiv_symm_apply noncomputable def IsTensorProduct.lift (h : IsTensorProduct f) (f' : M₁ β†’β‚—[R] Mβ‚‚ β†’β‚—[R] M') : M β†’β‚—[R] M' := (TensorProduct.lift f').comp h.equiv.symm.toLinearMap #align is_tensor_product.lift IsTensorProduct.lift
Mathlib/RingTheory/IsTensorProduct.lean
97
100
theorem IsTensorProduct.lift_eq (h : IsTensorProduct f) (f' : M₁ β†’β‚—[R] Mβ‚‚ β†’β‚—[R] M') (x₁ : M₁) (xβ‚‚ : Mβ‚‚) : h.lift f' (f x₁ xβ‚‚) = f' x₁ xβ‚‚ := by
delta IsTensorProduct.lift simp
import Mathlib.Data.Sigma.Lex import Mathlib.Order.BoundedOrder import Mathlib.Mathport.Notation import Mathlib.Data.Sigma.Basic #align_import data.sigma.order from "leanprover-community/mathlib"@"1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a" namespace Sigma variable {ΞΉ : Type*} {Ξ± : ΞΉ β†’ Type*} -- Porting note: I made this `le` instead of `LE` because the output type is `Prop` protected inductive le [βˆ€ i, LE (Ξ± i)] : βˆ€ _a _b : Ξ£ i, Ξ± i, Prop | fiber (i : ΞΉ) (a b : Ξ± i) : a ≀ b β†’ Sigma.le ⟨i, a⟩ ⟨i, b⟩ #align sigma.le Sigma.le protected inductive lt [βˆ€ i, LT (Ξ± i)] : βˆ€ _a _b : Ξ£i, Ξ± i, Prop | fiber (i : ΞΉ) (a b : Ξ± i) : a < b β†’ Sigma.lt ⟨i, a⟩ ⟨i, b⟩ #align sigma.lt Sigma.lt protected instance LE [βˆ€ i, LE (Ξ± i)] : LE (Ξ£i, Ξ± i) where le := Sigma.le protected instance LT [βˆ€ i, LT (Ξ± i)] : LT (Ξ£i, Ξ± i) where lt := Sigma.lt @[simp] theorem mk_le_mk_iff [βˆ€ i, LE (Ξ± i)] {i : ΞΉ} {a b : Ξ± i} : (⟨i, a⟩ : Sigma Ξ±) ≀ ⟨i, b⟩ ↔ a ≀ b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.le.fiber _ _ _⟩ #align sigma.mk_le_mk_iff Sigma.mk_le_mk_iff @[simp] theorem mk_lt_mk_iff [βˆ€ i, LT (Ξ± i)] {i : ΞΉ} {a b : Ξ± i} : (⟨i, a⟩ : Sigma Ξ±) < ⟨i, b⟩ ↔ a < b := ⟨fun ⟨_, _, _, h⟩ => h, Sigma.lt.fiber _ _ _⟩ #align sigma.mk_lt_mk_iff Sigma.mk_lt_mk_iff
Mathlib/Data/Sigma/Order.lean
79
86
theorem le_def [βˆ€ i, LE (Ξ± i)] {a b : Ξ£i, Ξ± i} : a ≀ b ↔ βˆƒ h : a.1 = b.1, h.rec a.2 ≀ b.2 := by
constructor · rintro ⟨i, a, b, h⟩ exact ⟨rfl, h⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b rintro ⟨rfl : i = j, h⟩ exact le.fiber _ _ _ h
import Mathlib.Algebra.Group.Pi.Basic import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Limits.Shapes.Images import Mathlib.CategoryTheory.IsomorphismClasses import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects #align_import category_theory.limits.shapes.zero_morphisms from "leanprover-community/mathlib"@"f7707875544ef1f81b32cb68c79e0e24e45a0e76" noncomputable section universe v u universe v' u' open CategoryTheory open CategoryTheory.Category open scoped Classical namespace CategoryTheory.Limits variable (C : Type u) [Category.{v} C] variable (D : Type u') [Category.{v'} D] class HasZeroMorphisms where [zero : βˆ€ X Y : C, Zero (X ⟢ Y)] comp_zero : βˆ€ {X Y : C} (f : X ⟢ Y) (Z : C), f ≫ (0 : Y ⟢ Z) = (0 : X ⟢ Z) := by aesop_cat zero_comp : βˆ€ (X : C) {Y Z : C} (f : Y ⟢ Z), (0 : X ⟢ Y) ≫ f = (0 : X ⟢ Z) := by aesop_cat #align category_theory.limits.has_zero_morphisms CategoryTheory.Limits.HasZeroMorphisms #align category_theory.limits.has_zero_morphisms.comp_zero' CategoryTheory.Limits.HasZeroMorphisms.comp_zero #align category_theory.limits.has_zero_morphisms.zero_comp' CategoryTheory.Limits.HasZeroMorphisms.zero_comp attribute [instance] HasZeroMorphisms.zero variable {C} @[simp] theorem comp_zero [HasZeroMorphisms C] {X Y : C} {f : X ⟢ Y} {Z : C} : f ≫ (0 : Y ⟢ Z) = (0 : X ⟢ Z) := HasZeroMorphisms.comp_zero f Z #align category_theory.limits.comp_zero CategoryTheory.Limits.comp_zero @[simp] theorem zero_comp [HasZeroMorphisms C] {X : C} {Y Z : C} {f : Y ⟢ Z} : (0 : X ⟢ Y) ≫ f = (0 : X ⟢ Z) := HasZeroMorphisms.zero_comp X f #align category_theory.limits.zero_comp CategoryTheory.Limits.zero_comp instance hasZeroMorphismsPEmpty : HasZeroMorphisms (Discrete PEmpty) where zero := by aesop_cat #align category_theory.limits.has_zero_morphisms_pempty CategoryTheory.Limits.hasZeroMorphismsPEmpty instance hasZeroMorphismsPUnit : HasZeroMorphisms (Discrete PUnit) where zero X Y := by repeat (constructor) #align category_theory.limits.has_zero_morphisms_punit CategoryTheory.Limits.hasZeroMorphismsPUnit open Opposite HasZeroMorphisms instance hasZeroMorphismsOpposite [HasZeroMorphisms C] : HasZeroMorphisms Cα΅’α΅– where zero X Y := ⟨(0 : unop Y ⟢ unop X).op⟩ comp_zero f Z := congr_arg Quiver.Hom.op (HasZeroMorphisms.zero_comp (unop Z) f.unop) zero_comp X {Y Z} (f : Y ⟢ Z) := congrArg Quiver.Hom.op (HasZeroMorphisms.comp_zero f.unop (unop X)) #align category_theory.limits.has_zero_morphisms_opposite CategoryTheory.Limits.hasZeroMorphismsOpposite section variable [HasZeroMorphisms C] @[simp] lemma op_zero (X Y : C) : (0 : X ⟢ Y).op = 0 := rfl #align category_theory.op_zero CategoryTheory.Limits.op_zero @[simp] lemma unop_zero (X Y : Cα΅’α΅–) : (0 : X ⟢ Y).unop = 0 := rfl #align category_theory.unop_zero CategoryTheory.Limits.unop_zero theorem zero_of_comp_mono {X Y Z : C} {f : X ⟢ Y} (g : Y ⟢ Z) [Mono g] (h : f ≫ g = 0) : f = 0 := by rw [← zero_comp, cancel_mono] at h exact h #align category_theory.limits.zero_of_comp_mono CategoryTheory.Limits.zero_of_comp_mono
Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean
145
147
theorem zero_of_epi_comp {X Y Z : C} (f : X ⟢ Y) {g : Y ⟢ Z} [Epi f] (h : f ≫ g = 0) : g = 0 := by
rw [← comp_zero, cancel_epi] at h exact h
import Mathlib.Analysis.Calculus.FDeriv.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace #align_import analysis.calculus.deriv.basic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal NNReal 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] def HasDerivAtFilter (f : π•œ β†’ F) (f' : F) (x : π•œ) (L : Filter π•œ) := HasFDerivAtFilter f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') x L #align has_deriv_at_filter HasDerivAtFilter def HasDerivWithinAt (f : π•œ β†’ F) (f' : F) (s : Set π•œ) (x : π•œ) := HasDerivAtFilter f f' x (𝓝[s] x) #align has_deriv_within_at HasDerivWithinAt def HasDerivAt (f : π•œ β†’ F) (f' : F) (x : π•œ) := HasDerivAtFilter f f' x (𝓝 x) #align has_deriv_at HasDerivAt def HasStrictDerivAt (f : π•œ β†’ F) (f' : F) (x : π•œ) := HasStrictFDerivAt f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') x #align has_strict_deriv_at HasStrictDerivAt def derivWithin (f : π•œ β†’ F) (s : Set π•œ) (x : π•œ) := fderivWithin π•œ f s x 1 #align deriv_within derivWithin def deriv (f : π•œ β†’ F) (x : π•œ) := fderiv π•œ f x 1 #align deriv deriv variable {f fβ‚€ f₁ g : π•œ β†’ F} variable {f' fβ‚€' f₁' g' : F} variable {x : π•œ} variable {s t : Set π•œ} variable {L L₁ Lβ‚‚ : Filter π•œ} theorem hasFDerivAtFilter_iff_hasDerivAtFilter {f' : π•œ β†’L[π•œ] F} : HasFDerivAtFilter f f' x L ↔ HasDerivAtFilter f (f' 1) x L := by simp [HasDerivAtFilter] #align has_fderiv_at_filter_iff_has_deriv_at_filter hasFDerivAtFilter_iff_hasDerivAtFilter theorem HasFDerivAtFilter.hasDerivAtFilter {f' : π•œ β†’L[π•œ] F} : HasFDerivAtFilter f f' x L β†’ HasDerivAtFilter f (f' 1) x L := hasFDerivAtFilter_iff_hasDerivAtFilter.mp #align has_fderiv_at_filter.has_deriv_at_filter HasFDerivAtFilter.hasDerivAtFilter theorem hasFDerivWithinAt_iff_hasDerivWithinAt {f' : π•œ β†’L[π•œ] F} : HasFDerivWithinAt f f' s x ↔ HasDerivWithinAt f (f' 1) s x := hasFDerivAtFilter_iff_hasDerivAtFilter #align has_fderiv_within_at_iff_has_deriv_within_at hasFDerivWithinAt_iff_hasDerivWithinAt theorem hasDerivWithinAt_iff_hasFDerivWithinAt {f' : F} : HasDerivWithinAt f f' s x ↔ HasFDerivWithinAt f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') s x := Iff.rfl #align has_deriv_within_at_iff_has_fderiv_within_at hasDerivWithinAt_iff_hasFDerivWithinAt theorem HasFDerivWithinAt.hasDerivWithinAt {f' : π•œ β†’L[π•œ] F} : HasFDerivWithinAt f f' s x β†’ HasDerivWithinAt f (f' 1) s x := hasFDerivWithinAt_iff_hasDerivWithinAt.mp #align has_fderiv_within_at.has_deriv_within_at HasFDerivWithinAt.hasDerivWithinAt theorem HasDerivWithinAt.hasFDerivWithinAt {f' : F} : HasDerivWithinAt f f' s x β†’ HasFDerivWithinAt f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') s x := hasDerivWithinAt_iff_hasFDerivWithinAt.mp #align has_deriv_within_at.has_fderiv_within_at HasDerivWithinAt.hasFDerivWithinAt theorem hasFDerivAt_iff_hasDerivAt {f' : π•œ β†’L[π•œ] F} : HasFDerivAt f f' x ↔ HasDerivAt f (f' 1) x := hasFDerivAtFilter_iff_hasDerivAtFilter #align has_fderiv_at_iff_has_deriv_at hasFDerivAt_iff_hasDerivAt theorem HasFDerivAt.hasDerivAt {f' : π•œ β†’L[π•œ] F} : HasFDerivAt f f' x β†’ HasDerivAt f (f' 1) x := hasFDerivAt_iff_hasDerivAt.mp #align has_fderiv_at.has_deriv_at HasFDerivAt.hasDerivAt theorem hasStrictFDerivAt_iff_hasStrictDerivAt {f' : π•œ β†’L[π•œ] F} : HasStrictFDerivAt f f' x ↔ HasStrictDerivAt f (f' 1) x := by simp [HasStrictDerivAt, HasStrictFDerivAt] #align has_strict_fderiv_at_iff_has_strict_deriv_at hasStrictFDerivAt_iff_hasStrictDerivAt protected theorem HasStrictFDerivAt.hasStrictDerivAt {f' : π•œ β†’L[π•œ] F} : HasStrictFDerivAt f f' x β†’ HasStrictDerivAt f (f' 1) x := hasStrictFDerivAt_iff_hasStrictDerivAt.mp #align has_strict_fderiv_at.has_strict_deriv_at HasStrictFDerivAt.hasStrictDerivAt theorem hasStrictDerivAt_iff_hasStrictFDerivAt : HasStrictDerivAt f f' x ↔ HasStrictFDerivAt f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') x := Iff.rfl #align has_strict_deriv_at_iff_has_strict_fderiv_at hasStrictDerivAt_iff_hasStrictFDerivAt alias ⟨HasStrictDerivAt.hasStrictFDerivAt, _⟩ := hasStrictDerivAt_iff_hasStrictFDerivAt #align has_strict_deriv_at.has_strict_fderiv_at HasStrictDerivAt.hasStrictFDerivAt theorem hasDerivAt_iff_hasFDerivAt {f' : F} : HasDerivAt f f' x ↔ HasFDerivAt f (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') x := Iff.rfl #align has_deriv_at_iff_has_fderiv_at hasDerivAt_iff_hasFDerivAt alias ⟨HasDerivAt.hasFDerivAt, _⟩ := hasDerivAt_iff_hasFDerivAt #align has_deriv_at.has_fderiv_at HasDerivAt.hasFDerivAt theorem derivWithin_zero_of_not_differentiableWithinAt (h : Β¬DifferentiableWithinAt π•œ f s x) : derivWithin f s x = 0 := by unfold derivWithin rw [fderivWithin_zero_of_not_differentiableWithinAt h] simp #align deriv_within_zero_of_not_differentiable_within_at derivWithin_zero_of_not_differentiableWithinAt theorem derivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = βŠ₯) : derivWithin f s x = 0 := by rw [derivWithin, fderivWithin_zero_of_isolated h, ContinuousLinearMap.zero_apply] theorem derivWithin_zero_of_nmem_closure (h : x βˆ‰ closure s) : derivWithin f s x = 0 := by rw [derivWithin, fderivWithin_zero_of_nmem_closure h, ContinuousLinearMap.zero_apply] theorem differentiableWithinAt_of_derivWithin_ne_zero (h : derivWithin f s x β‰  0) : DifferentiableWithinAt π•œ f s x := not_imp_comm.1 derivWithin_zero_of_not_differentiableWithinAt h #align differentiable_within_at_of_deriv_within_ne_zero differentiableWithinAt_of_derivWithin_ne_zero theorem deriv_zero_of_not_differentiableAt (h : Β¬DifferentiableAt π•œ f x) : deriv f x = 0 := by unfold deriv rw [fderiv_zero_of_not_differentiableAt h] simp #align deriv_zero_of_not_differentiable_at deriv_zero_of_not_differentiableAt theorem differentiableAt_of_deriv_ne_zero (h : deriv f x β‰  0) : DifferentiableAt π•œ f x := not_imp_comm.1 deriv_zero_of_not_differentiableAt h #align differentiable_at_of_deriv_ne_zero differentiableAt_of_deriv_ne_zero theorem UniqueDiffWithinAt.eq_deriv (s : Set π•œ) (H : UniqueDiffWithinAt π•œ s x) (h : HasDerivWithinAt f f' s x) (h₁ : HasDerivWithinAt f f₁' s x) : f' = f₁' := smulRight_one_eq_iff.mp <| UniqueDiffWithinAt.eq H h h₁ #align unique_diff_within_at.eq_deriv UniqueDiffWithinAt.eq_deriv theorem hasDerivAtFilter_iff_isLittleO : HasDerivAtFilter f f' x L ↔ (fun x' : π•œ => f x' - f x - (x' - x) β€’ f') =o[L] fun x' => x' - x := hasFDerivAtFilter_iff_isLittleO .. #align has_deriv_at_filter_iff_is_o hasDerivAtFilter_iff_isLittleO theorem hasDerivAtFilter_iff_tendsto : HasDerivAtFilter f f' x L ↔ Tendsto (fun x' : π•œ => β€–x' - x‖⁻¹ * β€–f x' - f x - (x' - x) β€’ f'β€–) L (𝓝 0) := hasFDerivAtFilter_iff_tendsto #align has_deriv_at_filter_iff_tendsto hasDerivAtFilter_iff_tendsto theorem hasDerivWithinAt_iff_isLittleO : HasDerivWithinAt f f' s x ↔ (fun x' : π•œ => f x' - f x - (x' - x) β€’ f') =o[𝓝[s] x] fun x' => x' - x := hasFDerivAtFilter_iff_isLittleO .. #align has_deriv_within_at_iff_is_o hasDerivWithinAt_iff_isLittleO theorem hasDerivWithinAt_iff_tendsto : HasDerivWithinAt f f' s x ↔ Tendsto (fun x' => β€–x' - x‖⁻¹ * β€–f x' - f x - (x' - x) β€’ f'β€–) (𝓝[s] x) (𝓝 0) := hasFDerivAtFilter_iff_tendsto #align has_deriv_within_at_iff_tendsto hasDerivWithinAt_iff_tendsto theorem hasDerivAt_iff_isLittleO : HasDerivAt f f' x ↔ (fun x' : π•œ => f x' - f x - (x' - x) β€’ f') =o[𝓝 x] fun x' => x' - x := hasFDerivAtFilter_iff_isLittleO .. #align has_deriv_at_iff_is_o hasDerivAt_iff_isLittleO theorem hasDerivAt_iff_tendsto : HasDerivAt f f' x ↔ Tendsto (fun x' => β€–x' - x‖⁻¹ * β€–f x' - f x - (x' - x) β€’ f'β€–) (𝓝 x) (𝓝 0) := hasFDerivAtFilter_iff_tendsto #align has_deriv_at_iff_tendsto hasDerivAt_iff_tendsto theorem HasDerivAtFilter.isBigO_sub (h : HasDerivAtFilter f f' x L) : (fun x' => f x' - f x) =O[L] fun x' => x' - x := HasFDerivAtFilter.isBigO_sub h set_option linter.uppercaseLean3 false in #align has_deriv_at_filter.is_O_sub HasDerivAtFilter.isBigO_sub nonrec theorem HasDerivAtFilter.isBigO_sub_rev (hf : HasDerivAtFilter f f' x L) (hf' : f' β‰  0) : (fun x' => x' - x) =O[L] fun x' => f x' - f x := suffices AntilipschitzWith β€–f'β€–β‚Šβ»ΒΉ (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') from hf.isBigO_sub_rev this AddMonoidHomClass.antilipschitz_of_bound (smulRight (1 : π•œ β†’L[π•œ] π•œ) f') fun x => by simp [norm_smul, ← div_eq_inv_mul, mul_div_cancel_rightβ‚€ _ (mt norm_eq_zero.1 hf')] set_option linter.uppercaseLean3 false in #align has_deriv_at_filter.is_O_sub_rev HasDerivAtFilter.isBigO_sub_rev theorem HasStrictDerivAt.hasDerivAt (h : HasStrictDerivAt f f' x) : HasDerivAt f f' x := h.hasFDerivAt #align has_strict_deriv_at.has_deriv_at HasStrictDerivAt.hasDerivAt theorem hasDerivWithinAt_congr_set' {s t : Set π•œ} (y : π•œ) (h : s =αΆ [𝓝[{y}ᢜ] x] t) : HasDerivWithinAt f f' s x ↔ HasDerivWithinAt f f' t x := hasFDerivWithinAt_congr_set' y h #align has_deriv_within_at_congr_set' hasDerivWithinAt_congr_set' theorem hasDerivWithinAt_congr_set {s t : Set π•œ} (h : s =αΆ [𝓝 x] t) : HasDerivWithinAt f f' s x ↔ HasDerivWithinAt f f' t x := hasFDerivWithinAt_congr_set h #align has_deriv_within_at_congr_set hasDerivWithinAt_congr_set alias ⟨HasDerivWithinAt.congr_set, _⟩ := hasDerivWithinAt_congr_set #align has_deriv_within_at.congr_set HasDerivWithinAt.congr_set @[simp] theorem hasDerivWithinAt_diff_singleton : HasDerivWithinAt f f' (s \ {x}) x ↔ HasDerivWithinAt f f' s x := hasFDerivWithinAt_diff_singleton _ #align has_deriv_within_at_diff_singleton hasDerivWithinAt_diff_singleton @[simp] theorem hasDerivWithinAt_Ioi_iff_Ici [PartialOrder π•œ] : HasDerivWithinAt f f' (Ioi x) x ↔ HasDerivWithinAt f f' (Ici x) x := by rw [← Ici_diff_left, hasDerivWithinAt_diff_singleton] #align has_deriv_within_at_Ioi_iff_Ici hasDerivWithinAt_Ioi_iff_Ici alias ⟨HasDerivWithinAt.Ici_of_Ioi, HasDerivWithinAt.Ioi_of_Ici⟩ := hasDerivWithinAt_Ioi_iff_Ici #align has_deriv_within_at.Ici_of_Ioi HasDerivWithinAt.Ici_of_Ioi #align has_deriv_within_at.Ioi_of_Ici HasDerivWithinAt.Ioi_of_Ici @[simp] theorem hasDerivWithinAt_Iio_iff_Iic [PartialOrder π•œ] : HasDerivWithinAt f f' (Iio x) x ↔ HasDerivWithinAt f f' (Iic x) x := by rw [← Iic_diff_right, hasDerivWithinAt_diff_singleton] #align has_deriv_within_at_Iio_iff_Iic hasDerivWithinAt_Iio_iff_Iic alias ⟨HasDerivWithinAt.Iic_of_Iio, HasDerivWithinAt.Iio_of_Iic⟩ := hasDerivWithinAt_Iio_iff_Iic #align has_deriv_within_at.Iic_of_Iio HasDerivWithinAt.Iic_of_Iio #align has_deriv_within_at.Iio_of_Iic HasDerivWithinAt.Iio_of_Iic theorem HasDerivWithinAt.Ioi_iff_Ioo [LinearOrder π•œ] [OrderClosedTopology π•œ] {x y : π•œ} (h : x < y) : HasDerivWithinAt f f' (Ioo x y) x ↔ HasDerivWithinAt f f' (Ioi x) x := hasFDerivWithinAt_inter <| Iio_mem_nhds h #align has_deriv_within_at.Ioi_iff_Ioo HasDerivWithinAt.Ioi_iff_Ioo alias ⟨HasDerivWithinAt.Ioi_of_Ioo, HasDerivWithinAt.Ioo_of_Ioi⟩ := HasDerivWithinAt.Ioi_iff_Ioo #align has_deriv_within_at.Ioi_of_Ioo HasDerivWithinAt.Ioi_of_Ioo #align has_deriv_within_at.Ioo_of_Ioi HasDerivWithinAt.Ioo_of_Ioi theorem hasDerivAt_iff_isLittleO_nhds_zero : HasDerivAt f f' x ↔ (fun h => f (x + h) - f x - h β€’ f') =o[𝓝 0] fun h => h := hasFDerivAt_iff_isLittleO_nhds_zero #align has_deriv_at_iff_is_o_nhds_zero hasDerivAt_iff_isLittleO_nhds_zero theorem HasDerivAtFilter.mono (h : HasDerivAtFilter f f' x Lβ‚‚) (hst : L₁ ≀ Lβ‚‚) : HasDerivAtFilter f f' x L₁ := HasFDerivAtFilter.mono h hst #align has_deriv_at_filter.mono HasDerivAtFilter.mono theorem HasDerivWithinAt.mono (h : HasDerivWithinAt f f' t x) (hst : s βŠ† t) : HasDerivWithinAt f f' s x := HasFDerivWithinAt.mono h hst #align has_deriv_within_at.mono HasDerivWithinAt.mono theorem HasDerivWithinAt.mono_of_mem (h : HasDerivWithinAt f f' t x) (hst : t ∈ 𝓝[s] x) : HasDerivWithinAt f f' s x := HasFDerivWithinAt.mono_of_mem h hst #align has_deriv_within_at.mono_of_mem HasDerivWithinAt.mono_of_mem #align has_deriv_within_at.nhds_within HasDerivWithinAt.mono_of_mem theorem HasDerivAt.hasDerivAtFilter (h : HasDerivAt f f' x) (hL : L ≀ 𝓝 x) : HasDerivAtFilter f f' x L := HasFDerivAt.hasFDerivAtFilter h hL #align has_deriv_at.has_deriv_at_filter HasDerivAt.hasDerivAtFilter theorem HasDerivAt.hasDerivWithinAt (h : HasDerivAt f f' x) : HasDerivWithinAt f f' s x := HasFDerivAt.hasFDerivWithinAt h #align has_deriv_at.has_deriv_within_at HasDerivAt.hasDerivWithinAt theorem HasDerivWithinAt.differentiableWithinAt (h : HasDerivWithinAt f f' s x) : DifferentiableWithinAt π•œ f s x := HasFDerivWithinAt.differentiableWithinAt h #align has_deriv_within_at.differentiable_within_at HasDerivWithinAt.differentiableWithinAt theorem HasDerivAt.differentiableAt (h : HasDerivAt f f' x) : DifferentiableAt π•œ f x := HasFDerivAt.differentiableAt h #align has_deriv_at.differentiable_at HasDerivAt.differentiableAt @[simp] theorem hasDerivWithinAt_univ : HasDerivWithinAt f f' univ x ↔ HasDerivAt f f' x := hasFDerivWithinAt_univ #align has_deriv_within_at_univ hasDerivWithinAt_univ theorem HasDerivAt.unique (hβ‚€ : HasDerivAt f fβ‚€' x) (h₁ : HasDerivAt f f₁' x) : fβ‚€' = f₁' := smulRight_one_eq_iff.mp <| hβ‚€.hasFDerivAt.unique h₁ #align has_deriv_at.unique HasDerivAt.unique theorem hasDerivWithinAt_inter' (h : t ∈ 𝓝[s] x) : HasDerivWithinAt f f' (s ∩ t) x ↔ HasDerivWithinAt f f' s x := hasFDerivWithinAt_inter' h #align has_deriv_within_at_inter' hasDerivWithinAt_inter' theorem hasDerivWithinAt_inter (h : t ∈ 𝓝 x) : HasDerivWithinAt f f' (s ∩ t) x ↔ HasDerivWithinAt f f' s x := hasFDerivWithinAt_inter h #align has_deriv_within_at_inter hasDerivWithinAt_inter theorem HasDerivWithinAt.union (hs : HasDerivWithinAt f f' s x) (ht : HasDerivWithinAt f f' t x) : HasDerivWithinAt f f' (s βˆͺ t) x := hs.hasFDerivWithinAt.union ht.hasFDerivWithinAt #align has_deriv_within_at.union HasDerivWithinAt.union theorem HasDerivWithinAt.hasDerivAt (h : HasDerivWithinAt f f' s x) (hs : s ∈ 𝓝 x) : HasDerivAt f f' x := HasFDerivWithinAt.hasFDerivAt h hs #align has_deriv_within_at.has_deriv_at HasDerivWithinAt.hasDerivAt theorem DifferentiableWithinAt.hasDerivWithinAt (h : DifferentiableWithinAt π•œ f s x) : HasDerivWithinAt f (derivWithin f s x) s x := h.hasFDerivWithinAt.hasDerivWithinAt #align differentiable_within_at.has_deriv_within_at DifferentiableWithinAt.hasDerivWithinAt theorem DifferentiableAt.hasDerivAt (h : DifferentiableAt π•œ f x) : HasDerivAt f (deriv f x) x := h.hasFDerivAt.hasDerivAt #align differentiable_at.has_deriv_at DifferentiableAt.hasDerivAt @[simp] theorem hasDerivAt_deriv_iff : HasDerivAt f (deriv f x) x ↔ DifferentiableAt π•œ f x := ⟨fun h => h.differentiableAt, fun h => h.hasDerivAt⟩ #align has_deriv_at_deriv_iff hasDerivAt_deriv_iff @[simp] theorem hasDerivWithinAt_derivWithin_iff : HasDerivWithinAt f (derivWithin f s x) s x ↔ DifferentiableWithinAt π•œ f s x := ⟨fun h => h.differentiableWithinAt, fun h => h.hasDerivWithinAt⟩ #align has_deriv_within_at_deriv_within_iff hasDerivWithinAt_derivWithin_iff theorem DifferentiableOn.hasDerivAt (h : DifferentiableOn π•œ f s) (hs : s ∈ 𝓝 x) : HasDerivAt f (deriv f x) x := (h.hasFDerivAt hs).hasDerivAt #align differentiable_on.has_deriv_at DifferentiableOn.hasDerivAt theorem HasDerivAt.deriv (h : HasDerivAt f f' x) : deriv f x = f' := h.differentiableAt.hasDerivAt.unique h #align has_deriv_at.deriv HasDerivAt.deriv theorem deriv_eq {f' : π•œ β†’ F} (h : βˆ€ x, HasDerivAt f (f' x) x) : deriv f = f' := funext fun x => (h x).deriv #align deriv_eq deriv_eq theorem HasDerivWithinAt.derivWithin (h : HasDerivWithinAt f f' s x) (hxs : UniqueDiffWithinAt π•œ s x) : derivWithin f s x = f' := hxs.eq_deriv _ h.differentiableWithinAt.hasDerivWithinAt h #align has_deriv_within_at.deriv_within HasDerivWithinAt.derivWithin theorem fderivWithin_derivWithin : (fderivWithin π•œ f s x : π•œ β†’ F) 1 = derivWithin f s x := rfl #align fderiv_within_deriv_within fderivWithin_derivWithin theorem derivWithin_fderivWithin : smulRight (1 : π•œ β†’L[π•œ] π•œ) (derivWithin f s x) = fderivWithin π•œ f s x := by simp [derivWithin] #align deriv_within_fderiv_within derivWithin_fderivWithin theorem norm_derivWithin_eq_norm_fderivWithin : β€–derivWithin f s xβ€– = β€–fderivWithin π•œ f s xβ€– := by simp [← derivWithin_fderivWithin] theorem fderiv_deriv : (fderiv π•œ f x : π•œ β†’ F) 1 = deriv f x := rfl #align fderiv_deriv fderiv_deriv theorem deriv_fderiv : smulRight (1 : π•œ β†’L[π•œ] π•œ) (deriv f x) = fderiv π•œ f x := by simp [deriv] #align deriv_fderiv deriv_fderiv theorem norm_deriv_eq_norm_fderiv : β€–deriv f xβ€– = β€–fderiv π•œ f xβ€– := by simp [← deriv_fderiv] theorem DifferentiableAt.derivWithin (h : DifferentiableAt π•œ f x) (hxs : UniqueDiffWithinAt π•œ s x) : derivWithin f s x = deriv f x := by unfold derivWithin deriv rw [h.fderivWithin hxs] #align differentiable_at.deriv_within DifferentiableAt.derivWithin theorem HasDerivWithinAt.deriv_eq_zero (hd : HasDerivWithinAt f 0 s x) (H : UniqueDiffWithinAt π•œ s x) : deriv f x = 0 := (em' (DifferentiableAt π•œ f x)).elim deriv_zero_of_not_differentiableAt fun h => H.eq_deriv _ h.hasDerivAt.hasDerivWithinAt hd #align has_deriv_within_at.deriv_eq_zero HasDerivWithinAt.deriv_eq_zero theorem derivWithin_of_mem (st : t ∈ 𝓝[s] x) (ht : UniqueDiffWithinAt π•œ s x) (h : DifferentiableWithinAt π•œ f t x) : derivWithin f s x = derivWithin f t x := ((DifferentiableWithinAt.hasDerivWithinAt h).mono_of_mem st).derivWithin ht #align deriv_within_of_mem derivWithin_of_mem theorem derivWithin_subset (st : s βŠ† t) (ht : UniqueDiffWithinAt π•œ s x) (h : DifferentiableWithinAt π•œ f t x) : derivWithin f s x = derivWithin f t x := ((DifferentiableWithinAt.hasDerivWithinAt h).mono st).derivWithin ht #align deriv_within_subset derivWithin_subset theorem derivWithin_congr_set' (y : π•œ) (h : s =αΆ [𝓝[{y}ᢜ] x] t) : derivWithin f s x = derivWithin f t x := by simp only [derivWithin, fderivWithin_congr_set' y h] #align deriv_within_congr_set' derivWithin_congr_set' theorem derivWithin_congr_set (h : s =αΆ [𝓝 x] t) : derivWithin f s x = derivWithin f t x := by simp only [derivWithin, fderivWithin_congr_set h] #align deriv_within_congr_set derivWithin_congr_set @[simp] theorem derivWithin_univ : derivWithin f univ = deriv f := by ext unfold derivWithin deriv rw [fderivWithin_univ] #align deriv_within_univ derivWithin_univ theorem derivWithin_inter (ht : t ∈ 𝓝 x) : derivWithin f (s ∩ t) x = derivWithin f s x := by unfold derivWithin rw [fderivWithin_inter ht] #align deriv_within_inter derivWithin_inter theorem derivWithin_of_mem_nhds (h : s ∈ 𝓝 x) : derivWithin f s x = deriv f x := by simp only [derivWithin, deriv, fderivWithin_of_mem_nhds h] theorem derivWithin_of_isOpen (hs : IsOpen s) (hx : x ∈ s) : derivWithin f s x = deriv f x := derivWithin_of_mem_nhds (hs.mem_nhds hx) #align deriv_within_of_open derivWithin_of_isOpen lemma deriv_eqOn {f' : π•œ β†’ F} (hs : IsOpen s) (hf' : βˆ€ x ∈ s, HasDerivWithinAt f (f' x) s x) : s.EqOn (deriv f) f' := fun x hx ↦ by rw [← derivWithin_of_isOpen hs hx, (hf' _ hx).derivWithin <| hs.uniqueDiffWithinAt hx] theorem deriv_mem_iff {f : π•œ β†’ F} {s : Set F} {x : π•œ} : deriv f x ∈ s ↔ DifferentiableAt π•œ f x ∧ deriv f x ∈ s ∨ Β¬DifferentiableAt π•œ f x ∧ (0 : F) ∈ s := by by_cases hx : DifferentiableAt π•œ f x <;> simp [deriv_zero_of_not_differentiableAt, *] #align deriv_mem_iff deriv_mem_iff
Mathlib/Analysis/Calculus/Deriv/Basic.lean
546
551
theorem derivWithin_mem_iff {f : π•œ β†’ F} {t : Set π•œ} {s : Set F} {x : π•œ} : derivWithin f t x ∈ s ↔ DifferentiableWithinAt π•œ f t x ∧ derivWithin f t x ∈ s ∨ Β¬DifferentiableWithinAt π•œ f t x ∧ (0 : F) ∈ s := by
by_cases hx : DifferentiableWithinAt π•œ f t x <;> simp [derivWithin_zero_of_not_differentiableWithinAt, *]
import Mathlib.Analysis.MeanInequalities import Mathlib.Analysis.MeanInequalitiesPow import Mathlib.Analysis.SpecialFunctions.Pow.Continuity import Mathlib.Data.Set.Image import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import analysis.normed_space.lp_space from "leanprover-community/mathlib"@"de83b43717abe353f425855fcf0cedf9ea0fe8a4" noncomputable section open scoped NNReal ENNReal Function variable {Ξ± : Type*} {E : Ξ± β†’ Type*} {p q : ℝβ‰₯0∞} [βˆ€ i, NormedAddCommGroup (E i)] def Memβ„“p (f : βˆ€ i, E i) (p : ℝβ‰₯0∞) : Prop := if p = 0 then Set.Finite { i | f i β‰  0 } else if p = ∞ then BddAbove (Set.range fun i => β€–f iβ€–) else Summable fun i => β€–f iβ€– ^ p.toReal #align mem_β„“p Memβ„“p theorem memβ„“p_zero_iff {f : βˆ€ i, E i} : Memβ„“p f 0 ↔ Set.Finite { i | f i β‰  0 } := by dsimp [Memβ„“p] rw [if_pos rfl] #align mem_β„“p_zero_iff memβ„“p_zero_iff theorem memβ„“p_zero {f : βˆ€ i, E i} (hf : Set.Finite { i | f i β‰  0 }) : Memβ„“p f 0 := memβ„“p_zero_iff.2 hf #align mem_β„“p_zero memβ„“p_zero theorem memβ„“p_infty_iff {f : βˆ€ i, E i} : Memβ„“p f ∞ ↔ BddAbove (Set.range fun i => β€–f iβ€–) := by dsimp [Memβ„“p] rw [if_neg ENNReal.top_ne_zero, if_pos rfl] #align mem_β„“p_infty_iff memβ„“p_infty_iff theorem memβ„“p_infty {f : βˆ€ i, E i} (hf : BddAbove (Set.range fun i => β€–f iβ€–)) : Memβ„“p f ∞ := memβ„“p_infty_iff.2 hf #align mem_β„“p_infty memβ„“p_infty theorem memβ„“p_gen_iff (hp : 0 < p.toReal) {f : βˆ€ i, E i} : Memβ„“p f p ↔ Summable fun i => β€–f iβ€– ^ p.toReal := by rw [ENNReal.toReal_pos_iff] at hp dsimp [Memβ„“p] rw [if_neg hp.1.ne', if_neg hp.2.ne] #align mem_β„“p_gen_iff memβ„“p_gen_iff
Mathlib/Analysis/NormedSpace/lpSpace.lean
106
114
theorem memβ„“p_gen {f : βˆ€ i, E i} (hf : Summable fun i => β€–f iβ€– ^ p.toReal) : Memβ„“p f p := by
rcases p.trichotomy with (rfl | rfl | hp) Β· apply memβ„“p_zero have H : Summable fun _ : Ξ± => (1 : ℝ) := by simpa using hf exact (Set.Finite.of_summable_const (by norm_num) H).subset (Set.subset_univ _) Β· apply memβ„“p_infty have H : Summable fun _ : Ξ± => (1 : ℝ) := by simpa using hf simpa using ((Set.Finite.of_summable_const (by norm_num) H).image fun i => β€–f iβ€–).bddAbove exact (memβ„“p_gen_iff hp).2 hf
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance 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 A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : β„•) : R⟦X⟧ β†’β‚—[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : β„•) : R β†’β‚—[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R} theorem coeff_def {s : Unit β†’β‚€ β„•} {n : β„•} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by erw [coeff, ← h, ← Finsupp.unique_single s] #align power_series.coeff_def PowerSeries.coeff_def @[ext] theorem ext {Ο† ψ : R⟦X⟧} (h : βˆ€ n, coeff R n Ο† = coeff R n ψ) : Ο† = ψ := MvPowerSeries.ext fun n => by rw [← coeff_def] Β· apply h rfl #align power_series.ext PowerSeries.ext theorem ext_iff {Ο† ψ : R⟦X⟧} : Ο† = ψ ↔ βˆ€ n, coeff R n Ο† = coeff R n ψ := ⟨fun h n => congr_arg (coeff R n) h, ext⟩ #align power_series.ext_iff PowerSeries.ext_iff instance [Subsingleton R] : Subsingleton R⟦X⟧ := by simp only [subsingleton_iff, ext_iff] exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _ def mk {R} (f : β„• β†’ R) : R⟦X⟧ := fun s => f (s ()) #align power_series.mk PowerSeries.mk @[simp] theorem coeff_mk (n : β„•) (f : β„• β†’ R) : coeff R n (mk f) = f n := congr_arg f Finsupp.single_eq_same #align power_series.coeff_mk PowerSeries.coeff_mk theorem coeff_monomial (m n : β„•) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 := calc coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _ _ = if m = n then a else 0 := by simp only [Finsupp.unique_single_eq_iff] #align power_series.coeff_monomial PowerSeries.coeff_monomial theorem monomial_eq_mk (n : β„•) (a : R) : monomial R n a = mk fun m => if m = n then a else 0 := ext fun m => by rw [coeff_monomial, coeff_mk] #align power_series.monomial_eq_mk PowerSeries.monomial_eq_mk @[simp] theorem coeff_monomial_same (n : β„•) (a : R) : coeff R n (monomial R n a) = a := MvPowerSeries.coeff_monomial_same _ _ #align power_series.coeff_monomial_same PowerSeries.coeff_monomial_same @[simp] theorem coeff_comp_monomial (n : β„•) : (coeff R n).comp (monomial R n) = LinearMap.id := LinearMap.ext <| coeff_monomial_same n #align power_series.coeff_comp_monomial PowerSeries.coeff_comp_monomial variable (R) def constantCoeff : R⟦X⟧ β†’+* R := MvPowerSeries.constantCoeff Unit R #align power_series.constant_coeff PowerSeries.constantCoeff def C : R β†’+* R⟦X⟧ := MvPowerSeries.C Unit R set_option linter.uppercaseLean3 false in #align power_series.C PowerSeries.C variable {R} def X : R⟦X⟧ := MvPowerSeries.X () set_option linter.uppercaseLean3 false in #align power_series.X PowerSeries.X theorem commute_X (Ο† : R⟦X⟧) : Commute Ο† X := MvPowerSeries.commute_X _ _ set_option linter.uppercaseLean3 false in #align power_series.commute_X PowerSeries.commute_X @[simp] theorem coeff_zero_eq_constantCoeff : ⇑(coeff R 0) = constantCoeff R := by rw [coeff, Finsupp.single_zero] rfl #align power_series.coeff_zero_eq_constant_coeff PowerSeries.coeff_zero_eq_constantCoeff theorem coeff_zero_eq_constantCoeff_apply (Ο† : R⟦X⟧) : coeff R 0 Ο† = constantCoeff R Ο† := by rw [coeff_zero_eq_constantCoeff] #align power_series.coeff_zero_eq_constant_coeff_apply PowerSeries.coeff_zero_eq_constantCoeff_apply @[simp] theorem monomial_zero_eq_C : ⇑(monomial R 0) = C R := by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [monomial, Finsupp.single_zero, MvPowerSeries.monomial_zero_eq_C] set_option linter.uppercaseLean3 false in #align power_series.monomial_zero_eq_C PowerSeries.monomial_zero_eq_C theorem monomial_zero_eq_C_apply (a : R) : monomial R 0 a = C R a := by simp set_option linter.uppercaseLean3 false in #align power_series.monomial_zero_eq_C_apply PowerSeries.monomial_zero_eq_C_apply theorem coeff_C (n : β„•) (a : R) : coeff R n (C R a : R⟦X⟧) = if n = 0 then a else 0 := by rw [← monomial_zero_eq_C_apply, coeff_monomial] set_option linter.uppercaseLean3 false in #align power_series.coeff_C PowerSeries.coeff_C @[simp] theorem coeff_zero_C (a : R) : coeff R 0 (C R a) = a := by rw [coeff_C, if_pos rfl] set_option linter.uppercaseLean3 false in #align power_series.coeff_zero_C PowerSeries.coeff_zero_C theorem coeff_ne_zero_C {a : R} {n : β„•} (h : n β‰  0) : coeff R n (C R a) = 0 := by rw [coeff_C, if_neg h] @[simp] theorem coeff_succ_C {a : R} {n : β„•} : coeff R (n + 1) (C R a) = 0 := coeff_ne_zero_C n.succ_ne_zero theorem C_injective : Function.Injective (C R) := by intro a b H have := (ext_iff (Ο† := C R a) (ψ := C R b)).mp H 0 rwa [coeff_zero_C, coeff_zero_C] at this protected theorem subsingleton_iff : Subsingleton R⟦X⟧ ↔ Subsingleton R := by refine ⟨fun h ↦ ?_, fun _ ↦ inferInstance⟩ rw [subsingleton_iff] at h ⊒ exact fun a b ↦ C_injective (h (C R a) (C R b)) theorem X_eq : (X : R⟦X⟧) = monomial R 1 1 := rfl set_option linter.uppercaseLean3 false in #align power_series.X_eq PowerSeries.X_eq theorem coeff_X (n : β„•) : coeff R n (X : R⟦X⟧) = if n = 1 then 1 else 0 := by rw [X_eq, coeff_monomial] set_option linter.uppercaseLean3 false in #align power_series.coeff_X PowerSeries.coeff_X @[simp] theorem coeff_zero_X : coeff R 0 (X : R⟦X⟧) = 0 := by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [coeff, Finsupp.single_zero, X, MvPowerSeries.coeff_zero_X] set_option linter.uppercaseLean3 false in #align power_series.coeff_zero_X PowerSeries.coeff_zero_X @[simp] theorem coeff_one_X : coeff R 1 (X : R⟦X⟧) = 1 := by rw [coeff_X, if_pos rfl] set_option linter.uppercaseLean3 false in #align power_series.coeff_one_X PowerSeries.coeff_one_X @[simp] theorem X_ne_zero [Nontrivial R] : (X : R⟦X⟧) β‰  0 := fun H => by simpa only [coeff_one_X, one_ne_zero, map_zero] using congr_arg (coeff R 1) H set_option linter.uppercaseLean3 false in #align power_series.X_ne_zero PowerSeries.X_ne_zero theorem X_pow_eq (n : β„•) : (X : R⟦X⟧) ^ n = monomial R n 1 := MvPowerSeries.X_pow_eq _ n set_option linter.uppercaseLean3 false in #align power_series.X_pow_eq PowerSeries.X_pow_eq theorem coeff_X_pow (m n : β„•) : coeff R m ((X : R⟦X⟧) ^ n) = if m = n then 1 else 0 := by rw [X_pow_eq, coeff_monomial] set_option linter.uppercaseLean3 false in #align power_series.coeff_X_pow PowerSeries.coeff_X_pow @[simp] theorem coeff_X_pow_self (n : β„•) : coeff R n ((X : R⟦X⟧) ^ n) = 1 := by rw [coeff_X_pow, if_pos rfl] set_option linter.uppercaseLean3 false in #align power_series.coeff_X_pow_self PowerSeries.coeff_X_pow_self @[simp] theorem coeff_one (n : β„•) : coeff R n (1 : R⟦X⟧) = if n = 0 then 1 else 0 := coeff_C n 1 #align power_series.coeff_one PowerSeries.coeff_one theorem coeff_zero_one : coeff R 0 (1 : R⟦X⟧) = 1 := coeff_zero_C 1 #align power_series.coeff_zero_one PowerSeries.coeff_zero_one theorem coeff_mul (n : β„•) (Ο† ψ : R⟦X⟧) : coeff R n (Ο† * ψ) = βˆ‘ p ∈ antidiagonal n, coeff R p.1 Ο† * coeff R p.2 ψ := by -- `rw` can't see that `PowerSeries = MvPowerSeries Unit`, so use `.trans` refine (MvPowerSeries.coeff_mul _ Ο† ψ).trans ?_ rw [Finsupp.antidiagonal_single, Finset.sum_map] rfl #align power_series.coeff_mul PowerSeries.coeff_mul @[simp] theorem coeff_mul_C (n : β„•) (Ο† : R⟦X⟧) (a : R) : coeff R n (Ο† * C R a) = coeff R n Ο† * a := MvPowerSeries.coeff_mul_C _ Ο† a set_option linter.uppercaseLean3 false in #align power_series.coeff_mul_C PowerSeries.coeff_mul_C @[simp] theorem coeff_C_mul (n : β„•) (Ο† : R⟦X⟧) (a : R) : coeff R n (C R a * Ο†) = a * coeff R n Ο† := MvPowerSeries.coeff_C_mul _ Ο† a set_option linter.uppercaseLean3 false in #align power_series.coeff_C_mul PowerSeries.coeff_C_mul @[simp] theorem coeff_smul {S : Type*} [Semiring S] [Module R S] (n : β„•) (Ο† : PowerSeries S) (a : R) : coeff S n (a β€’ Ο†) = a β€’ coeff S n Ο† := rfl #align power_series.coeff_smul PowerSeries.coeff_smul @[simp] theorem constantCoeff_smul {S : Type*} [Semiring S] [Module R S] (Ο† : PowerSeries S) (a : R) : constantCoeff S (a β€’ Ο†) = a β€’ constantCoeff S Ο† := rfl theorem smul_eq_C_mul (f : R⟦X⟧) (a : R) : a β€’ f = C R a * f := by ext simp set_option linter.uppercaseLean3 false in #align power_series.smul_eq_C_mul PowerSeries.smul_eq_C_mul @[simp] theorem coeff_succ_mul_X (n : β„•) (Ο† : R⟦X⟧) : coeff R (n + 1) (Ο† * X) = coeff R n Ο† := by simp only [coeff, Finsupp.single_add] convert Ο†.coeff_add_mul_monomial (single () n) (single () 1) _ rw [mul_one]; rfl set_option linter.uppercaseLean3 false in #align power_series.coeff_succ_mul_X PowerSeries.coeff_succ_mul_X @[simp] theorem coeff_succ_X_mul (n : β„•) (Ο† : R⟦X⟧) : coeff R (n + 1) (X * Ο†) = coeff R n Ο† := by simp only [coeff, Finsupp.single_add, add_comm n 1] convert Ο†.coeff_add_monomial_mul (single () 1) (single () n) _ rw [one_mul]; rfl set_option linter.uppercaseLean3 false in #align power_series.coeff_succ_X_mul PowerSeries.coeff_succ_X_mul @[simp] theorem constantCoeff_C (a : R) : constantCoeff R (C R a) = a := rfl set_option linter.uppercaseLean3 false in #align power_series.constant_coeff_C PowerSeries.constantCoeff_C @[simp] theorem constantCoeff_comp_C : (constantCoeff R).comp (C R) = RingHom.id R := rfl set_option linter.uppercaseLean3 false in #align power_series.constant_coeff_comp_C PowerSeries.constantCoeff_comp_C -- Porting note (#10618): simp can prove this. -- @[simp] theorem constantCoeff_zero : constantCoeff R 0 = 0 := rfl #align power_series.constant_coeff_zero PowerSeries.constantCoeff_zero -- Porting note (#10618): simp can prove this. -- @[simp] theorem constantCoeff_one : constantCoeff R 1 = 1 := rfl #align power_series.constant_coeff_one PowerSeries.constantCoeff_one @[simp] theorem constantCoeff_X : constantCoeff R X = 0 := MvPowerSeries.coeff_zero_X _ set_option linter.uppercaseLean3 false in #align power_series.constant_coeff_X PowerSeries.constantCoeff_X @[simp] theorem constantCoeff_mk {f : β„• β†’ R} : constantCoeff R (mk f) = f 0 := rfl theorem coeff_zero_mul_X (Ο† : R⟦X⟧) : coeff R 0 (Ο† * X) = 0 := by simp set_option linter.uppercaseLean3 false in #align power_series.coeff_zero_mul_X PowerSeries.coeff_zero_mul_X theorem coeff_zero_X_mul (Ο† : R⟦X⟧) : coeff R 0 (X * Ο†) = 0 := by simp set_option linter.uppercaseLean3 false in #align power_series.coeff_zero_X_mul PowerSeries.coeff_zero_X_mul theorem constantCoeff_surj : Function.Surjective (constantCoeff R) := fun r => ⟨(C R) r, constantCoeff_C r⟩ -- The following section duplicates the API of `Data.Polynomial.Coeff` and should attempt to keep -- up to date with that section theorem coeff_C_mul_X_pow (x : R) (k n : β„•) : coeff R n (C R x * X ^ k : R⟦X⟧) = if n = k then x else 0 := by simp [X_pow_eq, coeff_monomial] set_option linter.uppercaseLean3 false in #align power_series.coeff_C_mul_X_pow PowerSeries.coeff_C_mul_X_pow @[simp]
Mathlib/RingTheory/PowerSeries/Basic.lean
438
448
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : β„•) : coeff R (d + n) (p * X ^ n) = coeff R d p := by
rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one] · rintro ⟨i, j⟩ h1 h2 rw [coeff_X_pow, if_neg, mul_zero] rintro rfl apply h2 rw [mem_antidiagonal, add_right_cancel_iff] at h1 subst h1 rfl · exact fun h1 => (h1 (mem_antidiagonal.2 rfl)).elim
import Aesop.Nanos import Aesop.Util.UnionFind import Aesop.Util.UnorderedArraySet import Batteries.Data.String import Batteries.Lean.Expr import Batteries.Lean.Meta.DiscrTree import Batteries.Lean.PersistentHashSet import Lean.Meta.Tactic.TryThis open Lean open Lean.Meta Lean.Elab.Tactic namespace Aesop.Array
.lake/packages/aesop/Aesop/Util/Basic.lean
21
24
theorem size_modify (a : Array Ξ±) (i : Nat) (f : Ξ± β†’ Ξ±) : (a.modify i f).size = a.size := by
simp only [Array.modify, Id.run, Array.modifyM] split <;> simp
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle #align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped EuclideanGeometry open scoped Real open scoped RealInnerProductSpace namespace Orientation open FiniteDimensional variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] variable [hd2 : Fact (finrank ℝ V = 2)] (o : Orientation ℝ V (Fin 2)) theorem oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle x (x + y) = Real.arccos (β€–xβ€– / β€–x + yβ€–) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x + y) y = Real.arccos (β€–yβ€– / β€–x + yβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle x (x + y) = Real.arcsin (β€–yβ€– / β€–x + yβ€–) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x + y) y = Real.arcsin (β€–xβ€– / β€–x + yβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle x (x + y) = Real.arctan (β€–yβ€– / β€–xβ€–) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arctan_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (o.left_ne_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x + y) y = Real.arctan (β€–xβ€– / β€–yβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two theorem cos_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle x (x + y)) = β€–xβ€– / β€–x + yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, InnerProductGeometry.cos_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.cos_oangle_add_right_of_oangle_eq_pi_div_two Orientation.cos_oangle_add_right_of_oangle_eq_pi_div_two theorem cos_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle (x + y) y) = β€–yβ€– / β€–x + yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).cos_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.cos_oangle_add_left_of_oangle_eq_pi_div_two Orientation.cos_oangle_add_left_of_oangle_eq_pi_div_two theorem sin_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.sin (o.oangle x (x + y)) = β€–yβ€– / β€–x + yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, InnerProductGeometry.sin_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.sin_oangle_add_right_of_oangle_eq_pi_div_two Orientation.sin_oangle_add_right_of_oangle_eq_pi_div_two theorem sin_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.sin (o.oangle (x + y) y) = β€–xβ€– / β€–x + yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).sin_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.sin_oangle_add_left_of_oangle_eq_pi_div_two Orientation.sin_oangle_add_left_of_oangle_eq_pi_div_two theorem tan_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.tan (o.oangle x (x + y)) = β€–yβ€– / β€–xβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe, InnerProductGeometry.tan_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.tan_oangle_add_right_of_oangle_eq_pi_div_two Orientation.tan_oangle_add_right_of_oangle_eq_pi_div_two theorem tan_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.tan (o.oangle (x + y) y) = β€–xβ€– / β€–yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).tan_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.tan_oangle_add_left_of_oangle_eq_pi_div_two Orientation.tan_oangle_add_left_of_oangle_eq_pi_div_two theorem cos_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle x (x + y)) * β€–x + yβ€– = β€–xβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, InnerProductGeometry.cos_angle_add_mul_norm_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.cos_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two Orientation.cos_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two theorem cos_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle (x + y) y) * β€–x + yβ€– = β€–yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).cos_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two h #align orientation.cos_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two Orientation.cos_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two theorem sin_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.sin (o.oangle x (x + y)) * β€–x + yβ€– = β€–yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, InnerProductGeometry.sin_angle_add_mul_norm_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.sin_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two Orientation.sin_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two theorem sin_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.sin (o.oangle (x + y) y) * β€–x + yβ€– = β€–xβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).sin_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two h #align orientation.sin_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two Orientation.sin_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two theorem tan_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.tan (o.oangle x (x + y)) * β€–xβ€– = β€–yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe, InnerProductGeometry.tan_angle_add_mul_norm_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.tan_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two Orientation.tan_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two theorem tan_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.tan (o.oangle (x + y) y) * β€–yβ€– = β€–xβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).tan_oangle_add_right_mul_norm_of_oangle_eq_pi_div_two h #align orientation.tan_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two Orientation.tan_oangle_add_left_mul_norm_of_oangle_eq_pi_div_two theorem norm_div_cos_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–xβ€– / Real.Angle.cos (o.oangle x (x + y)) = β€–x + yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, InnerProductGeometry.norm_div_cos_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.norm_div_cos_oangle_add_right_of_oangle_eq_pi_div_two Orientation.norm_div_cos_oangle_add_right_of_oangle_eq_pi_div_two theorem norm_div_cos_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–yβ€– / Real.Angle.cos (o.oangle (x + y) y) = β€–x + yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).norm_div_cos_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.norm_div_cos_oangle_add_left_of_oangle_eq_pi_div_two Orientation.norm_div_cos_oangle_add_left_of_oangle_eq_pi_div_two theorem norm_div_sin_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–yβ€– / Real.Angle.sin (o.oangle x (x + y)) = β€–x + yβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.sin_coe, InnerProductGeometry.norm_div_sin_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inr (o.right_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.norm_div_sin_oangle_add_right_of_oangle_eq_pi_div_two Orientation.norm_div_sin_oangle_add_right_of_oangle_eq_pi_div_two theorem norm_div_sin_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–xβ€– / Real.Angle.sin (o.oangle (x + y) y) = β€–x + yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).norm_div_sin_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.norm_div_sin_oangle_add_left_of_oangle_eq_pi_div_two Orientation.norm_div_sin_oangle_add_left_of_oangle_eq_pi_div_two theorem norm_div_tan_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–yβ€– / Real.Angle.tan (o.oangle x (x + y)) = β€–xβ€– := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.tan_coe, InnerProductGeometry.norm_div_tan_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inr (o.right_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.norm_div_tan_oangle_add_right_of_oangle_eq_pi_div_two Orientation.norm_div_tan_oangle_add_right_of_oangle_eq_pi_div_two theorem norm_div_tan_oangle_add_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : β€–xβ€– / Real.Angle.tan (o.oangle (x + y) y) = β€–yβ€– := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ rw [add_comm] exact (-o).norm_div_tan_oangle_add_right_of_oangle_eq_pi_div_two h #align orientation.norm_div_tan_oangle_add_left_of_oangle_eq_pi_div_two Orientation.norm_div_tan_oangle_add_left_of_oangle_eq_pi_div_two theorem oangle_sub_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle y (y - x) = Real.arccos (β€–yβ€– / β€–y - xβ€–) := by have hs : (o.oangle y (y - x)).sign = 1 := by rw [oangle_sign_sub_right_swap, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_sub_eq_arccos_of_inner_eq_zero (o.inner_rev_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_sub_right_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_sub_right_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_sub_left_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x - y) x = Real.arccos (β€–xβ€– / β€–x - yβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ exact (-o).oangle_sub_right_eq_arccos_of_oangle_eq_pi_div_two h #align orientation.oangle_sub_left_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_sub_left_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_sub_right_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle y (y - x) = Real.arcsin (β€–xβ€– / β€–y - xβ€–) := by have hs : (o.oangle y (y - x)).sign = 1 := by rw [oangle_sign_sub_right_swap, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_sub_eq_arcsin_of_inner_eq_zero (o.inner_rev_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.right_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.oangle_sub_right_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_sub_right_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_sub_left_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x - y) x = Real.arcsin (β€–yβ€– / β€–x - yβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ exact (-o).oangle_sub_right_eq_arcsin_of_oangle_eq_pi_div_two h #align orientation.oangle_sub_left_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_sub_left_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_sub_right_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle y (y - x) = Real.arctan (β€–xβ€– / β€–yβ€–) := by have hs : (o.oangle y (y - x)).sign = 1 := by rw [oangle_sign_sub_right_swap, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_sub_eq_arctan_of_inner_eq_zero (o.inner_rev_eq_zero_of_oangle_eq_pi_div_two h) (o.right_ne_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_sub_right_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_sub_right_eq_arctan_of_oangle_eq_pi_div_two theorem oangle_sub_left_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : o.oangle (x - y) x = Real.arctan (β€–yβ€– / β€–xβ€–) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ exact (-o).oangle_sub_right_eq_arctan_of_oangle_eq_pi_div_two h #align orientation.oangle_sub_left_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_sub_left_eq_arctan_of_oangle_eq_pi_div_two theorem cos_oangle_sub_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle y (y - x)) = β€–yβ€– / β€–y - xβ€– := by have hs : (o.oangle y (y - x)).sign = 1 := by rw [oangle_sign_sub_right_swap, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, InnerProductGeometry.cos_angle_sub_of_inner_eq_zero (o.inner_rev_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.cos_oangle_sub_right_of_oangle_eq_pi_div_two Orientation.cos_oangle_sub_right_of_oangle_eq_pi_div_two
Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean
331
334
theorem cos_oangle_sub_left_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(Ο€ / 2)) : Real.Angle.cos (o.oangle (x - y) x) = β€–xβ€– / β€–x - yβ€– := by
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊒ exact (-o).cos_oangle_sub_right_of_oangle_eq_pi_div_two h
import Mathlib.MeasureTheory.Integral.Lebesgue open Set hiding restrict restrict_apply open Filter ENNReal NNReal MeasureTheory.Measure namespace MeasureTheory variable {Ξ± : Type*} {m0 : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} noncomputable def Measure.withDensity {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : Measure Ξ± := Measure.ofMeasurable (fun s _ => ∫⁻ a in s, f a βˆ‚ΞΌ) (by simp) fun s hs hd => lintegral_iUnion hs hd _ #align measure_theory.measure.with_density MeasureTheory.Measure.withDensity @[simp] theorem withDensity_apply (f : Ξ± β†’ ℝβ‰₯0∞) {s : Set Ξ±} (hs : MeasurableSet s) : ΞΌ.withDensity f s = ∫⁻ a in s, f a βˆ‚ΞΌ := Measure.ofMeasurable_apply s hs #align measure_theory.with_density_apply MeasureTheory.withDensity_apply theorem withDensity_apply_le (f : Ξ± β†’ ℝβ‰₯0∞) (s : Set Ξ±) : ∫⁻ a in s, f a βˆ‚ΞΌ ≀ ΞΌ.withDensity f s := by let t := toMeasurable (ΞΌ.withDensity f) s calc ∫⁻ a in s, f a βˆ‚ΞΌ ≀ ∫⁻ a in t, f a βˆ‚ΞΌ := lintegral_mono_set (subset_toMeasurable (withDensity ΞΌ f) s) _ = ΞΌ.withDensity f t := (withDensity_apply f (measurableSet_toMeasurable (withDensity ΞΌ f) s)).symm _ = ΞΌ.withDensity f s := measure_toMeasurable s theorem withDensity_apply' [SFinite ΞΌ] (f : Ξ± β†’ ℝβ‰₯0∞) (s : Set Ξ±) : ΞΌ.withDensity f s = ∫⁻ a in s, f a βˆ‚ΞΌ := by apply le_antisymm ?_ (withDensity_apply_le f s) let t := toMeasurable ΞΌ s calc ΞΌ.withDensity f s ≀ ΞΌ.withDensity f t := measure_mono (subset_toMeasurable ΞΌ s) _ = ∫⁻ a in t, f a βˆ‚ΞΌ := withDensity_apply f (measurableSet_toMeasurable ΞΌ s) _ = ∫⁻ a in s, f a βˆ‚ΞΌ := by congr 1; exact restrict_toMeasurable_of_sFinite s @[simp] lemma withDensity_zero_left (f : Ξ± β†’ ℝβ‰₯0∞) : (0 : Measure Ξ±).withDensity f = 0 := by ext s hs rw [withDensity_apply _ hs] simp theorem withDensity_congr_ae {f g : Ξ± β†’ ℝβ‰₯0∞} (h : f =ᡐ[ΞΌ] g) : ΞΌ.withDensity f = ΞΌ.withDensity g := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] exact lintegral_congr_ae (ae_restrict_of_ae h) #align measure_theory.with_density_congr_ae MeasureTheory.withDensity_congr_ae lemma withDensity_mono {f g : Ξ± β†’ ℝβ‰₯0∞} (hfg : f ≀ᡐ[ΞΌ] g) : ΞΌ.withDensity f ≀ ΞΌ.withDensity g := by refine le_iff.2 fun s hs ↦ ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] refine set_lintegral_mono_ae' hs ?_ filter_upwards [hfg] with x h_le using fun _ ↦ h_le theorem withDensity_add_left {f : Ξ± β†’ ℝβ‰₯0∞} (hf : Measurable f) (g : Ξ± β†’ ℝβ‰₯0∞) : ΞΌ.withDensity (f + g) = ΞΌ.withDensity f + ΞΌ.withDensity g := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs, ← lintegral_add_left hf] simp only [Pi.add_apply] #align measure_theory.with_density_add_left MeasureTheory.withDensity_add_left theorem withDensity_add_right (f : Ξ± β†’ ℝβ‰₯0∞) {g : Ξ± β†’ ℝβ‰₯0∞} (hg : Measurable g) : ΞΌ.withDensity (f + g) = ΞΌ.withDensity f + ΞΌ.withDensity g := by simpa only [add_comm] using withDensity_add_left hg f #align measure_theory.with_density_add_right MeasureTheory.withDensity_add_right theorem withDensity_add_measure {m : MeasurableSpace Ξ±} (ΞΌ Ξ½ : Measure Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : (ΞΌ + Ξ½).withDensity f = ΞΌ.withDensity f + Ξ½.withDensity f := by ext1 s hs simp only [withDensity_apply f hs, restrict_add, lintegral_add_measure, Measure.add_apply] #align measure_theory.with_density_add_measure MeasureTheory.withDensity_add_measure theorem withDensity_sum {ΞΉ : Type*} {m : MeasurableSpace Ξ±} (ΞΌ : ΞΉ β†’ Measure Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : (sum ΞΌ).withDensity f = sum fun n => (ΞΌ n).withDensity f := by ext1 s hs simp_rw [sum_apply _ hs, withDensity_apply f hs, restrict_sum ΞΌ hs, lintegral_sum_measure] #align measure_theory.with_density_sum MeasureTheory.withDensity_sum theorem withDensity_smul (r : ℝβ‰₯0∞) {f : Ξ± β†’ ℝβ‰₯0∞} (hf : Measurable f) : ΞΌ.withDensity (r β€’ f) = r β€’ ΞΌ.withDensity f := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, ← lintegral_const_mul r hf] simp only [Pi.smul_apply, smul_eq_mul] #align measure_theory.with_density_smul MeasureTheory.withDensity_smul theorem withDensity_smul' (r : ℝβ‰₯0∞) (f : Ξ± β†’ ℝβ‰₯0∞) (hr : r β‰  ∞) : ΞΌ.withDensity (r β€’ f) = r β€’ ΞΌ.withDensity f := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, ← lintegral_const_mul' r f hr] simp only [Pi.smul_apply, smul_eq_mul] #align measure_theory.with_density_smul' MeasureTheory.withDensity_smul' theorem withDensity_smul_measure (r : ℝβ‰₯0∞) (f : Ξ± β†’ ℝβ‰₯0∞) : (r β€’ ΞΌ).withDensity f = r β€’ ΞΌ.withDensity f := by ext s hs rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, set_lintegral_smul_measure] theorem isFiniteMeasure_withDensity {f : Ξ± β†’ ℝβ‰₯0∞} (hf : ∫⁻ a, f a βˆ‚ΞΌ β‰  ∞) : IsFiniteMeasure (ΞΌ.withDensity f) := { measure_univ_lt_top := by rwa [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ, lt_top_iff_ne_top] } #align measure_theory.is_finite_measure_with_density MeasureTheory.isFiniteMeasure_withDensity theorem withDensity_absolutelyContinuous {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : ΞΌ.withDensity f β‰ͺ ΞΌ := by refine AbsolutelyContinuous.mk fun s hs₁ hsβ‚‚ => ?_ rw [withDensity_apply _ hs₁] exact set_lintegral_measure_zero _ _ hsβ‚‚ #align measure_theory.with_density_absolutely_continuous MeasureTheory.withDensity_absolutelyContinuous @[simp] theorem withDensity_zero : ΞΌ.withDensity 0 = 0 := by ext1 s hs simp [withDensity_apply _ hs] #align measure_theory.with_density_zero MeasureTheory.withDensity_zero @[simp] theorem withDensity_one : ΞΌ.withDensity 1 = ΞΌ := by ext1 s hs simp [withDensity_apply _ hs] #align measure_theory.with_density_one MeasureTheory.withDensity_one @[simp] theorem withDensity_const (c : ℝβ‰₯0∞) : ΞΌ.withDensity (fun _ ↦ c) = c β€’ ΞΌ := by ext1 s hs simp [withDensity_apply _ hs] theorem withDensity_tsum {f : β„• β†’ Ξ± β†’ ℝβ‰₯0∞} (h : βˆ€ i, Measurable (f i)) : ΞΌ.withDensity (βˆ‘' n, f n) = sum fun n => ΞΌ.withDensity (f n) := by ext1 s hs simp_rw [sum_apply _ hs, withDensity_apply _ hs] change ∫⁻ x in s, (βˆ‘' n, f n) x βˆ‚ΞΌ = βˆ‘' i : β„•, ∫⁻ x, f i x βˆ‚ΞΌ.restrict s rw [← lintegral_tsum fun i => (h i).aemeasurable] exact lintegral_congr fun x => tsum_apply (Pi.summable.2 fun _ => ENNReal.summable) #align measure_theory.with_density_tsum MeasureTheory.withDensity_tsum theorem withDensity_indicator {s : Set Ξ±} (hs : MeasurableSet s) (f : Ξ± β†’ ℝβ‰₯0∞) : ΞΌ.withDensity (s.indicator f) = (ΞΌ.restrict s).withDensity f := by ext1 t ht rw [withDensity_apply _ ht, lintegral_indicator _ hs, restrict_comm hs, ← withDensity_apply _ ht] #align measure_theory.with_density_indicator MeasureTheory.withDensity_indicator theorem withDensity_indicator_one {s : Set Ξ±} (hs : MeasurableSet s) : ΞΌ.withDensity (s.indicator 1) = ΞΌ.restrict s := by rw [withDensity_indicator hs, withDensity_one] #align measure_theory.with_density_indicator_one MeasureTheory.withDensity_indicator_one theorem withDensity_ofReal_mutuallySingular {f : Ξ± β†’ ℝ} (hf : Measurable f) : (ΞΌ.withDensity fun x => ENNReal.ofReal <| f x) βŸ‚β‚˜ ΞΌ.withDensity fun x => ENNReal.ofReal <| -f x := by set S : Set Ξ± := { x | f x < 0 } have hS : MeasurableSet S := measurableSet_lt hf measurable_const refine ⟨S, hS, ?_, ?_⟩ Β· rw [withDensity_apply _ hS, lintegral_eq_zero_iff hf.ennreal_ofReal, EventuallyEq] exact (ae_restrict_mem hS).mono fun x hx => ENNReal.ofReal_eq_zero.2 (le_of_lt hx) Β· rw [withDensity_apply _ hS.compl, lintegral_eq_zero_iff hf.neg.ennreal_ofReal, EventuallyEq] exact (ae_restrict_mem hS.compl).mono fun x hx => ENNReal.ofReal_eq_zero.2 (not_lt.1 <| mt neg_pos.1 hx) #align measure_theory.with_density_of_real_mutually_singular MeasureTheory.withDensity_ofReal_mutuallySingular theorem restrict_withDensity {s : Set Ξ±} (hs : MeasurableSet s) (f : Ξ± β†’ ℝβ‰₯0∞) : (ΞΌ.withDensity f).restrict s = (ΞΌ.restrict s).withDensity f := by ext1 t ht rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply _ (ht.inter hs), restrict_restrict ht] #align measure_theory.restrict_with_density MeasureTheory.restrict_withDensity
Mathlib/MeasureTheory/Measure/WithDensity.lean
216
220
theorem restrict_withDensity' [SFinite ΞΌ] (s : Set Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : (ΞΌ.withDensity f).restrict s = (ΞΌ.restrict s).withDensity f := by
ext1 t ht rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply' _ (t ∩ s), restrict_restrict ht]
import Mathlib.Data.Set.Subsingleton import Mathlib.Logic.Equiv.Defs import Mathlib.Algebra.Group.Defs #align_import data.part from "leanprover-community/mathlib"@"80c43012d26f63026d362c3aba28f3c3bafb07e6" open Function structure Part.{u} (Ξ± : Type u) : Type u where Dom : Prop get : Dom β†’ Ξ± #align part Part namespace Part variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} def toOption (o : Part Ξ±) [Decidable o.Dom] : Option Ξ± := if h : Dom o then some (o.get h) else none #align part.to_option Part.toOption @[simp] lemma toOption_isSome (o : Part Ξ±) [Decidable o.Dom] : o.toOption.isSome ↔ o.Dom := by by_cases h : o.Dom <;> simp [h, toOption] #align part.to_option_is_some Part.toOption_isSome @[simp] lemma toOption_isNone (o : Part Ξ±) [Decidable o.Dom] : o.toOption.isNone ↔ Β¬o.Dom := by by_cases h : o.Dom <;> simp [h, toOption] #align part.to_option_is_none Part.toOption_isNone theorem ext' : βˆ€ {o p : Part Ξ±}, (o.Dom ↔ p.Dom) β†’ (βˆ€ h₁ hβ‚‚, o.get h₁ = p.get hβ‚‚) β†’ o = p | ⟨od, o⟩, ⟨pd, p⟩, H1, H2 => by have t : od = pd := propext H1 cases t; rw [show o = p from funext fun p => H2 p p] #align part.ext' Part.ext' @[simp] theorem eta : βˆ€ o : Part Ξ±, (⟨o.Dom, fun h => o.get h⟩ : Part Ξ±) = o | ⟨_, _⟩ => rfl #align part.eta Part.eta protected def Mem (a : Ξ±) (o : Part Ξ±) : Prop := βˆƒ h, o.get h = a #align part.mem Part.Mem instance : Membership Ξ± (Part Ξ±) := ⟨Part.Mem⟩ theorem mem_eq (a : Ξ±) (o : Part Ξ±) : (a ∈ o) = βˆƒ h, o.get h = a := rfl #align part.mem_eq Part.mem_eq theorem dom_iff_mem : βˆ€ {o : Part Ξ±}, o.Dom ↔ βˆƒ y, y ∈ o | ⟨_, f⟩ => ⟨fun h => ⟨f h, h, rfl⟩, fun ⟨_, h, rfl⟩ => h⟩ #align part.dom_iff_mem Part.dom_iff_mem theorem get_mem {o : Part Ξ±} (h) : get o h ∈ o := ⟨_, rfl⟩ #align part.get_mem Part.get_mem @[simp] theorem mem_mk_iff {p : Prop} {o : p β†’ Ξ±} {a : Ξ±} : a ∈ Part.mk p o ↔ βˆƒ h, o h = a := Iff.rfl #align part.mem_mk_iff Part.mem_mk_iff @[ext] theorem ext {o p : Part Ξ±} (H : βˆ€ a, a ∈ o ↔ a ∈ p) : o = p := (ext' ⟨fun h => ((H _).1 ⟨h, rfl⟩).fst, fun h => ((H _).2 ⟨h, rfl⟩).fst⟩) fun _ _ => ((H _).2 ⟨_, rfl⟩).snd #align part.ext Part.ext def none : Part Ξ± := ⟨False, False.rec⟩ #align part.none Part.none instance : Inhabited (Part Ξ±) := ⟨none⟩ @[simp] theorem not_mem_none (a : Ξ±) : a βˆ‰ @none Ξ± := fun h => h.fst #align part.not_mem_none Part.not_mem_none def some (a : Ξ±) : Part Ξ± := ⟨True, fun _ => a⟩ #align part.some Part.some @[simp] theorem some_dom (a : Ξ±) : (some a).Dom := trivial #align part.some_dom Part.some_dom theorem mem_unique : βˆ€ {a b : Ξ±} {o : Part Ξ±}, a ∈ o β†’ b ∈ o β†’ a = b | _, _, ⟨_, _⟩, ⟨_, rfl⟩, ⟨_, rfl⟩ => rfl #align part.mem_unique Part.mem_unique theorem Mem.left_unique : Relator.LeftUnique ((Β· ∈ Β·) : Ξ± β†’ Part Ξ± β†’ Prop) := fun _ _ _ => mem_unique #align part.mem.left_unique Part.Mem.left_unique theorem get_eq_of_mem {o : Part Ξ±} {a} (h : a ∈ o) (h') : get o h' = a := mem_unique ⟨_, rfl⟩ h #align part.get_eq_of_mem Part.get_eq_of_mem protected theorem subsingleton (o : Part Ξ±) : Set.Subsingleton { a | a ∈ o } := fun _ ha _ hb => mem_unique ha hb #align part.subsingleton Part.subsingleton @[simp] theorem get_some {a : Ξ±} (ha : (some a).Dom) : get (some a) ha = a := rfl #align part.get_some Part.get_some theorem mem_some (a : Ξ±) : a ∈ some a := ⟨trivial, rfl⟩ #align part.mem_some Part.mem_some @[simp] theorem mem_some_iff {a b} : b ∈ (some a : Part Ξ±) ↔ b = a := ⟨fun ⟨_, e⟩ => e.symm, fun e => ⟨trivial, e.symm⟩⟩ #align part.mem_some_iff Part.mem_some_iff theorem eq_some_iff {a : Ξ±} {o : Part Ξ±} : o = some a ↔ a ∈ o := ⟨fun e => e.symm β–Έ mem_some _, fun ⟨h, e⟩ => e β–Έ ext' (iff_true_intro h) fun _ _ => rfl⟩ #align part.eq_some_iff Part.eq_some_iff theorem eq_none_iff {o : Part Ξ±} : o = none ↔ βˆ€ a, a βˆ‰ o := ⟨fun e => e.symm β–Έ not_mem_none, fun h => ext (by simpa)⟩ #align part.eq_none_iff Part.eq_none_iff theorem eq_none_iff' {o : Part Ξ±} : o = none ↔ Β¬o.Dom := ⟨fun e => e.symm β–Έ id, fun h => eq_none_iff.2 fun _ h' => h h'.fst⟩ #align part.eq_none_iff' Part.eq_none_iff' @[simp] theorem not_none_dom : Β¬(none : Part Ξ±).Dom := id #align part.not_none_dom Part.not_none_dom @[simp]
Mathlib/Data/Part.lean
192
194
theorem some_ne_none (x : Ξ±) : some x β‰  none := by
intro h exact true_ne_false (congr_arg Dom h)
import Mathlib.AlgebraicTopology.SimplexCategory import Mathlib.CategoryTheory.Comma.Arrow import Mathlib.CategoryTheory.Limits.FunctorCategory import Mathlib.CategoryTheory.Opposites #align_import algebraic_topology.simplicial_object from "leanprover-community/mathlib"@"5ed51dc37c6b891b79314ee11a50adc2b1df6fd6" open Opposite open CategoryTheory open CategoryTheory.Limits universe v u v' u' namespace CategoryTheory variable (C : Type u) [Category.{v} C] -- porting note (#5171): removed @[nolint has_nonempty_instance] def SimplicialObject := SimplexCategoryα΅’α΅– β₯€ C #align category_theory.simplicial_object CategoryTheory.SimplicialObject @[simps!] instance : Category (SimplicialObject C) := by dsimp only [SimplicialObject] infer_instance namespace SimplicialObject set_option quotPrecheck false in scoped[Simplicial] notation3:1000 X " _[" n "]" => (X : CategoryTheory.SimplicialObject _).obj (Opposite.op (SimplexCategory.mk n)) open Simplicial instance {J : Type v} [SmallCategory J] [HasLimitsOfShape J C] : HasLimitsOfShape J (SimplicialObject C) := by dsimp [SimplicialObject] infer_instance instance [HasLimits C] : HasLimits (SimplicialObject C) := ⟨inferInstance⟩ instance {J : Type v} [SmallCategory J] [HasColimitsOfShape J C] : HasColimitsOfShape J (SimplicialObject C) := by dsimp [SimplicialObject] infer_instance instance [HasColimits C] : HasColimits (SimplicialObject C) := ⟨inferInstance⟩ variable {C} -- Porting note (#10688): added to ease automation @[ext] lemma hom_ext {X Y : SimplicialObject C} (f g : X ⟢ Y) (h : βˆ€ (n : SimplexCategoryα΅’α΅–), f.app n = g.app n) : f = g := NatTrans.ext _ _ (by ext; apply h) variable (X : SimplicialObject C) def Ξ΄ {n} (i : Fin (n + 2)) : X _[n + 1] ⟢ X _[n] := X.map (SimplexCategory.Ξ΄ i).op #align category_theory.simplicial_object.Ξ΄ CategoryTheory.SimplicialObject.Ξ΄ def Οƒ {n} (i : Fin (n + 1)) : X _[n] ⟢ X _[n + 1] := X.map (SimplexCategory.Οƒ i).op #align category_theory.simplicial_object.Οƒ CategoryTheory.SimplicialObject.Οƒ def eqToIso {n m : β„•} (h : n = m) : X _[n] β‰… X _[m] := X.mapIso (CategoryTheory.eqToIso (by congr)) #align category_theory.simplicial_object.eq_to_iso CategoryTheory.SimplicialObject.eqToIso @[simp]
Mathlib/AlgebraicTopology/SimplicialObject.lean
100
102
theorem eqToIso_refl {n : β„•} (h : n = n) : X.eqToIso h = Iso.refl _ := by
ext simp [eqToIso]
import Mathlib.CategoryTheory.Sites.Sheaf #align_import category_theory.sites.plus from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace CategoryTheory.GrothendieckTopology open CategoryTheory open CategoryTheory.Limits open Opposite universe w v u variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) variable {D : Type w} [Category.{max v u} D] noncomputable section variable [βˆ€ (P : Cα΅’α΅– β₯€ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)] variable (P : Cα΅’α΅– β₯€ D) @[simps] def diagram (X : C) : (J.Cover X)α΅’α΅– β₯€ D where obj S := multiequalizer (S.unop.index P) map {S _} f := Multiequalizer.lift _ _ (fun I => Multiequalizer.ΞΉ (S.unop.index P) (I.map f.unop)) fun I => Multiequalizer.condition (S.unop.index P) (I.map f.unop) #align category_theory.grothendieck_topology.diagram CategoryTheory.GrothendieckTopology.diagram @[simps] def diagramPullback {X Y : C} (f : X ⟢ Y) : J.diagram P Y ⟢ (J.pullback f).op β‹™ J.diagram P X where app S := Multiequalizer.lift _ _ (fun I => Multiequalizer.ΞΉ (S.unop.index P) I.base) fun I => Multiequalizer.condition (S.unop.index P) I.base naturality S T f := Multiequalizer.hom_ext _ _ _ (fun I => by dsimp; simp; rfl) #align category_theory.grothendieck_topology.diagram_pullback CategoryTheory.GrothendieckTopology.diagramPullback @[simps] def diagramNatTrans {P Q : Cα΅’α΅– β₯€ D} (Ξ· : P ⟢ Q) (X : C) : J.diagram P X ⟢ J.diagram Q X where app W := Multiequalizer.lift _ _ (fun i => Multiequalizer.ΞΉ _ _ ≫ Ξ·.app _) (fun i => by dsimp only erw [Category.assoc, Category.assoc, ← Ξ·.naturality, ← Ξ·.naturality, Multiequalizer.condition_assoc] rfl) #align category_theory.grothendieck_topology.diagram_nat_trans CategoryTheory.GrothendieckTopology.diagramNatTrans @[simp] theorem diagramNatTrans_id (X : C) (P : Cα΅’α΅– β₯€ D) : J.diagramNatTrans (πŸ™ P) X = πŸ™ (J.diagram P X) := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp simp only [limit.lift_Ο€, Multifork.ofΞΉ_pt, Multifork.ofΞΉ_Ο€_app, Category.id_comp] erw [Category.comp_id] #align category_theory.grothendieck_topology.diagram_nat_trans_id CategoryTheory.GrothendieckTopology.diagramNatTrans_id @[simp] theorem diagramNatTrans_zero [Preadditive D] (X : C) (P Q : Cα΅’α΅– β₯€ D) : J.diagramNatTrans (0 : P ⟢ Q) X = 0 := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp rw [zero_comp, Multiequalizer.lift_ΞΉ, comp_zero] #align category_theory.grothendieck_topology.diagram_nat_trans_zero CategoryTheory.GrothendieckTopology.diagramNatTrans_zero @[simp] theorem diagramNatTrans_comp {P Q R : Cα΅’α΅– β₯€ D} (Ξ· : P ⟢ Q) (Ξ³ : Q ⟢ R) (X : C) : J.diagramNatTrans (Ξ· ≫ Ξ³) X = J.diagramNatTrans Ξ· X ≫ J.diagramNatTrans Ξ³ X := by ext : 2 refine Multiequalizer.hom_ext _ _ _ (fun i => ?_) dsimp simp #align category_theory.grothendieck_topology.diagram_nat_trans_comp CategoryTheory.GrothendieckTopology.diagramNatTrans_comp variable (D) @[simps] def diagramFunctor (X : C) : (Cα΅’α΅– β₯€ D) β₯€ (J.Cover X)α΅’α΅– β₯€ D where obj P := J.diagram P X map Ξ· := J.diagramNatTrans Ξ· X #align category_theory.grothendieck_topology.diagram_functor CategoryTheory.GrothendieckTopology.diagramFunctor variable {D} variable [βˆ€ X : C, HasColimitsOfShape (J.Cover X)α΅’α΅– D] def plusObj : Cα΅’α΅– β₯€ D where obj X := colimit (J.diagram P X.unop) map f := colimMap (J.diagramPullback P f.unop) ≫ colimit.pre _ _ map_id := by intro X refine colimit.hom_ext (fun S => ?_) dsimp simp only [diagramPullback_app, colimit.ΞΉ_pre, ΞΉ_colimMap_assoc, Category.comp_id] let e := S.unop.pullbackId dsimp only [Functor.op, pullback_obj] erw [← colimit.w _ e.inv.op, ← Category.assoc] convert Category.id_comp (colimit.ΞΉ (diagram J P (unop X)) S) refine Multiequalizer.hom_ext _ _ _ (fun I => ?_) dsimp simp only [Multiequalizer.lift_ΞΉ, Category.id_comp, Category.assoc] dsimp [Cover.Arrow.map, Cover.Arrow.base] cases I congr simp map_comp := by intro X Y Z f g refine colimit.hom_ext (fun S => ?_) dsimp simp only [diagramPullback_app, colimit.ΞΉ_pre_assoc, colimit.ΞΉ_pre, ΞΉ_colimMap_assoc, Category.assoc] let e := S.unop.pullbackComp g.unop f.unop dsimp only [Functor.op, pullback_obj] erw [← colimit.w _ e.inv.op, ← Category.assoc, ← Category.assoc] congr 1 refine Multiequalizer.hom_ext _ _ _ (fun I => ?_) dsimp simp only [Multiequalizer.lift_ΞΉ, Category.assoc] cases I dsimp only [Cover.Arrow.base, Cover.Arrow.map] congr 2 simp #align category_theory.grothendieck_topology.plus_obj CategoryTheory.GrothendieckTopology.plusObj def plusMap {P Q : Cα΅’α΅– β₯€ D} (Ξ· : P ⟢ Q) : J.plusObj P ⟢ J.plusObj Q where app X := colimMap (J.diagramNatTrans Ξ· X.unop) naturality := by intro X Y f dsimp [plusObj] ext simp only [diagramPullback_app, ΞΉ_colimMap, colimit.ΞΉ_pre_assoc, colimit.ΞΉ_pre, ΞΉ_colimMap_assoc, Category.assoc] simp_rw [← Category.assoc] congr 1 exact Multiequalizer.hom_ext _ _ _ (fun I => by dsimp; simp) #align category_theory.grothendieck_topology.plus_map CategoryTheory.GrothendieckTopology.plusMap @[simp] theorem plusMap_id (P : Cα΅’α΅– β₯€ D) : J.plusMap (πŸ™ P) = πŸ™ _ := by ext : 2 dsimp only [plusMap, plusObj] rw [J.diagramNatTrans_id, NatTrans.id_app] ext dsimp simp #align category_theory.grothendieck_topology.plus_map_id CategoryTheory.GrothendieckTopology.plusMap_id @[simp] theorem plusMap_zero [Preadditive D] (P Q : Cα΅’α΅– β₯€ D) : J.plusMap (0 : P ⟢ Q) = 0 := by ext : 2 refine colimit.hom_ext (fun S => ?_) erw [comp_zero, colimit.ΞΉ_map, J.diagramNatTrans_zero, zero_comp] #align category_theory.grothendieck_topology.plus_map_zero CategoryTheory.GrothendieckTopology.plusMap_zero @[simp, reassoc]
Mathlib/CategoryTheory/Sites/Plus.lean
182
186
theorem plusMap_comp {P Q R : Cα΅’α΅– β₯€ D} (Ξ· : P ⟢ Q) (Ξ³ : Q ⟢ R) : J.plusMap (Ξ· ≫ Ξ³) = J.plusMap Ξ· ≫ J.plusMap Ξ³ := by
ext : 2 refine colimit.hom_ext (fun S => ?_) simp [plusMap, J.diagramNatTrans_comp]
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix #align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology NNReal Metric section CompleteField variable {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type v} [NormedAddCommGroup E] [NormedSpace π•œ E] {F : Type w} [NormedAddCommGroup F] [NormedSpace π•œ F] {F' : Type x} [AddCommGroup F'] [Module π•œ F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul π•œ F'] [CompleteSpace π•œ] theorem ContinuousLinearMap.continuous_det : Continuous fun f : E β†’L[π•œ] E => f.det := by change Continuous fun f : E β†’L[π•œ] E => LinearMap.det (f : E β†’β‚—[π•œ] E) -- Porting note: this could be easier with `det_cases` by_cases h : βˆƒ s : Finset E, Nonempty (Basis (β†₯s) π•œ E) Β· rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional π•œ E := FiniteDimensional.of_fintype_basis b simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM π•œ)).continuous_of_finiteDimensional Β· -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const #align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : ℝβ‰₯0 := let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv max (β€–A.symm.toContinuousLinearMapβ€–β‚Š * β€–A.toContinuousLinearMapβ€–β‚Š) 1 #align lipschitz_extension_constant lipschitzExtensionConstant theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by rw [lipschitzExtensionConstant] exact zero_lt_one.trans_le (le_max_right _ _) #align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos theorem LipschitzOnWith.extend_finite_dimension {Ξ± : Type*} [PseudoMetricSpace Ξ±] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set Ξ±} {f : Ξ± β†’ E'} {K : ℝβ‰₯0} (hf : LipschitzOnWith K f s) : βˆƒ g : Ξ± β†’ E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by let ΞΉ : Type _ := Basis.ofVectorSpaceIndex ℝ E' let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv have LA : LipschitzWith β€–A.toContinuousLinearMapβ€–β‚Š A := by apply A.lipschitz have L : LipschitzOnWith (β€–A.toContinuousLinearMapβ€–β‚Š * K) (A ∘ f) s := LA.comp_lipschitzOnWith hf obtain ⟨g, hg, gs⟩ : βˆƒ g : Ξ± β†’ ΞΉ β†’ ℝ, LipschitzWith (β€–A.toContinuousLinearMapβ€–β‚Š * K) g ∧ EqOn (A ∘ f) g s := L.extend_pi refine ⟨A.symm ∘ g, ?_, ?_⟩ Β· have LAsymm : LipschitzWith β€–A.symm.toContinuousLinearMapβ€–β‚Š A.symm := by apply A.symm.lipschitz apply (LAsymm.comp hg).weaken rw [lipschitzExtensionConstant, ← mul_assoc] exact mul_le_mul' (le_max_left _ _) le_rfl Β· intro x hx have : A (f x) = g x := gs hx simp only [(Β· ∘ Β·), ← this, A.symm_apply_apply] #align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension theorem LinearMap.exists_antilipschitzWith [FiniteDimensional π•œ E] (f : E β†’β‚—[π•œ] F) (hf : LinearMap.ker f = βŠ₯) : βˆƒ K > 0, AntilipschitzWith K f := by cases subsingleton_or_nontrivial E Β· exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩ Β· rw [LinearMap.ker_eq_bot] at hf let e : E ≃L[π•œ] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩ #align linear_map.exists_antilipschitz_with LinearMap.exists_antilipschitzWith open Function in theorem LinearMap.injective_iff_antilipschitz [FiniteDimensional π•œ E] (f : E β†’β‚—[π•œ] F) : Injective f ↔ βˆƒ K > 0, AntilipschitzWith K f := by constructor Β· rw [← LinearMap.ker_eq_bot] exact f.exists_antilipschitzWith Β· rintro ⟨K, -, H⟩ exact H.injective open Function in theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional π•œ E] : IsOpen { L : E β†’L[π•œ] F | Injective L } := by rw [isOpen_iff_eventually] rintro Ο†β‚€ hΟ†β‚€ rcases Ο†β‚€.injective_iff_antilipschitz.mp hΟ†β‚€ with ⟨K, K_pos, H⟩ have : βˆ€αΆ  Ο† in 𝓝 Ο†β‚€, β€–Ο† - Ο†β‚€β€–β‚Š < K⁻¹ := eventually_nnnorm_sub_lt _ <| inv_pos_of_pos K_pos filter_upwards [this] with Ο† hΟ† apply Ο†.injective_iff_antilipschitz.mpr exact ⟨(K⁻¹ - β€–Ο† - Ο†β‚€β€–β‚Š)⁻¹, inv_pos_of_pos (tsub_pos_of_lt hΟ†), H.add_sub_lipschitzWith (Ο† - Ο†β‚€).lipschitz hΟ†βŸ© protected theorem LinearIndependent.eventually {ΞΉ} [Finite ΞΉ] {f : ΞΉ β†’ E} (hf : LinearIndependent π•œ f) : βˆ€αΆ  g in 𝓝 f, LinearIndependent π•œ g := by cases nonempty_fintype ΞΉ simp only [Fintype.linearIndependent_iff'] at hf ⊒ rcases LinearMap.exists_antilipschitzWith _ hf with ⟨K, K0, hK⟩ have : Tendsto (fun g : ΞΉ β†’ E => βˆ‘ i, β€–g i - f iβ€–) (𝓝 f) (𝓝 <| βˆ‘ i, β€–f i - f iβ€–) := tendsto_finset_sum _ fun i _ => Tendsto.norm <| ((continuous_apply i).tendsto _).sub tendsto_const_nhds simp only [sub_self, norm_zero, Finset.sum_const_zero] at this refine (this.eventually (gt_mem_nhds <| inv_pos.2 K0)).mono fun g hg => ?_ replace hg : βˆ‘ i, β€–g i - f iβ€–β‚Š < K⁻¹ := by rw [← NNReal.coe_lt_coe] push_cast exact hg rw [LinearMap.ker_eq_bot] refine (hK.add_sub_lipschitzWith (LipschitzWith.of_dist_le_mul fun v u => ?_) hg).injective simp only [dist_eq_norm, LinearMap.lsum_apply, Pi.sub_apply, LinearMap.sum_apply, LinearMap.comp_apply, LinearMap.proj_apply, LinearMap.smulRight_apply, LinearMap.id_apply, ← Finset.sum_sub_distrib, ← smul_sub, ← sub_smul, NNReal.coe_sum, coe_nnnorm, Finset.sum_mul] refine norm_sum_le_of_le _ fun i _ => ?_ rw [norm_smul, mul_comm] gcongr exact norm_le_pi_norm (v - u) i #align linear_independent.eventually LinearIndependent.eventually theorem isOpen_setOf_linearIndependent {ΞΉ : Type*} [Finite ΞΉ] : IsOpen { f : ΞΉ β†’ E | LinearIndependent π•œ f } := isOpen_iff_mem_nhds.2 fun _ => LinearIndependent.eventually #align is_open_set_of_linear_independent isOpen_setOf_linearIndependent theorem isOpen_setOf_nat_le_rank (n : β„•) : IsOpen { f : E β†’L[π•œ] F | ↑n ≀ (f : E β†’β‚—[π•œ] F).rank } := by simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, setOf_exists, ← exists_prop] refine isOpen_biUnion fun t _ => ?_ have : Continuous fun f : E β†’L[π•œ] F => fun x : (t : Set E) => f x := continuous_pi fun x => (ContinuousLinearMap.apply π•œ F (x : E)).continuous exact isOpen_setOf_linearIndependent.preimage this #align is_open_set_of_nat_le_rank isOpen_setOf_nat_le_rank theorem Basis.opNNNorm_le {ΞΉ : Type*} [Fintype ΞΉ] (v : Basis ΞΉ π•œ E) {u : E β†’L[π•œ] F} (M : ℝβ‰₯0) (hu : βˆ€ i, β€–u (v i)β€–β‚Š ≀ M) : β€–uβ€–β‚Š ≀ Fintype.card ΞΉ β€’ β€–v.equivFunL.toContinuousLinearMapβ€–β‚Š * M := u.opNNNorm_le_bound _ fun e => by set Ο† := v.equivFunL.toContinuousLinearMap calc β€–u eβ€–β‚Š = β€–u (βˆ‘ i, v.equivFun e i β€’ v i)β€–β‚Š := by rw [v.sum_equivFun] _ = β€–βˆ‘ i, v.equivFun e i β€’ (u <| v i)β€–β‚Š := by simp [map_sum, LinearMap.map_smul] _ ≀ βˆ‘ i, β€–v.equivFun e i β€’ (u <| v i)β€–β‚Š := nnnorm_sum_le _ _ _ = βˆ‘ i, β€–v.equivFun e iβ€–β‚Š * β€–u (v i)β€–β‚Š := by simp only [nnnorm_smul] _ ≀ βˆ‘ i, β€–v.equivFun e iβ€–β‚Š * M := by gcongr; apply hu _ = (βˆ‘ i, β€–v.equivFun e iβ€–β‚Š) * M := by rw [Finset.sum_mul] _ ≀ Fintype.card ΞΉ β€’ (β€–Ο†β€–β‚Š * β€–eβ€–β‚Š) * M := by gcongr calc βˆ‘ i, β€–v.equivFun e iβ€–β‚Š ≀ Fintype.card ΞΉ β€’ β€–Ο† eβ€–β‚Š := Pi.sum_nnnorm_apply_le_nnnorm _ _ ≀ Fintype.card ΞΉ β€’ (β€–Ο†β€–β‚Š * β€–eβ€–β‚Š) := nsmul_le_nsmul_right (Ο†.le_opNNNorm e) _ _ = Fintype.card ΞΉ β€’ β€–Ο†β€–β‚Š * M * β€–eβ€–β‚Š := by simp only [smul_mul_assoc, mul_right_comm] #align basis.op_nnnorm_le Basis.opNNNorm_le @[deprecated (since := "2024-02-02")] alias Basis.op_nnnorm_le := Basis.opNNNorm_le theorem Basis.opNorm_le {ΞΉ : Type*} [Fintype ΞΉ] (v : Basis ΞΉ π•œ E) {u : E β†’L[π•œ] F} {M : ℝ} (hM : 0 ≀ M) (hu : βˆ€ i, β€–u (v i)β€– ≀ M) : β€–uβ€– ≀ Fintype.card ΞΉ β€’ β€–v.equivFunL.toContinuousLinearMapβ€– * M := by simpa using NNReal.coe_le_coe.mpr (v.opNNNorm_le ⟨M, hM⟩ hu) #align basis.op_norm_le Basis.opNorm_le @[deprecated (since := "2024-02-02")] alias Basis.op_norm_le := Basis.opNorm_le
Mathlib/Analysis/NormedSpace/FiniteDimension.lean
326
332
theorem Basis.exists_opNNNorm_le {ΞΉ : Type*} [Finite ΞΉ] (v : Basis ΞΉ π•œ E) : βˆƒ C > (0 : ℝβ‰₯0), βˆ€ {u : E β†’L[π•œ] F} (M : ℝβ‰₯0), (βˆ€ i, β€–u (v i)β€–β‚Š ≀ M) β†’ β€–uβ€–β‚Š ≀ C * M := by
cases nonempty_fintype ΞΉ exact ⟨max (Fintype.card ΞΉ β€’ β€–v.equivFunL.toContinuousLinearMapβ€–β‚Š) 1, zero_lt_one.trans_le (le_max_right _ _), fun {u} M hu => (v.opNNNorm_le M hu).trans <| mul_le_mul_of_nonneg_right (le_max_left _ _) (zero_le M)⟩
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Index import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.GroupAction.Quotient import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.Tactic.IntervalCases #align_import group_theory.p_group from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" open Fintype MulAction variable (p : β„•) (G : Type*) [Group G] def IsPGroup : Prop := βˆ€ g : G, βˆƒ k : β„•, g ^ p ^ k = 1 #align is_p_group IsPGroup variable {p} {G} namespace IsPGroup theorem iff_orderOf [hp : Fact p.Prime] : IsPGroup p G ↔ βˆ€ g : G, βˆƒ k : β„•, orderOf g = p ^ k := forall_congr' fun g => ⟨fun ⟨k, hk⟩ => Exists.imp (fun _ h => h.right) ((Nat.dvd_prime_pow hp.out).mp (orderOf_dvd_of_pow_eq_one hk)), Exists.imp fun k hk => by rw [← hk, pow_orderOf_eq_one]⟩ #align is_p_group.iff_order_of IsPGroup.iff_orderOf theorem of_card [Fintype G] {n : β„•} (hG : card G = p ^ n) : IsPGroup p G := fun g => ⟨n, by rw [← hG, pow_card_eq_one]⟩ #align is_p_group.of_card IsPGroup.of_card theorem of_bot : IsPGroup p (βŠ₯ : Subgroup G) := of_card (by rw [← Nat.card_eq_fintype_card, Subgroup.card_bot, pow_zero]) #align is_p_group.of_bot IsPGroup.of_bot theorem iff_card [Fact p.Prime] [Fintype G] : IsPGroup p G ↔ βˆƒ n : β„•, card G = p ^ n := by have hG : card G β‰  0 := card_ne_zero refine ⟨fun h => ?_, fun ⟨n, hn⟩ => of_card hn⟩ suffices βˆ€ q ∈ Nat.factors (card G), q = p by use (card G).factors.length rw [← List.prod_replicate, ← List.eq_replicate_of_mem this, Nat.prod_factors hG] intro q hq obtain ⟨hq1, hq2⟩ := (Nat.mem_factors hG).mp hq haveI : Fact q.Prime := ⟨hq1⟩ obtain ⟨g, hg⟩ := exists_prime_orderOf_dvd_card q hq2 obtain ⟨k, hk⟩ := (iff_orderOf.mp h) g exact (hq1.pow_eq_iff.mp (hg.symm.trans hk).symm).1.symm #align is_p_group.iff_card IsPGroup.iff_card alias ⟨exists_card_eq, _⟩ := iff_card section GIsPGroup variable (hG : IsPGroup p G) theorem of_injective {H : Type*} [Group H] (Ο• : H β†’* G) (hΟ• : Function.Injective Ο•) : IsPGroup p H := by simp_rw [IsPGroup, ← hΟ•.eq_iff, Ο•.map_pow, Ο•.map_one] exact fun h => hG (Ο• h) #align is_p_group.of_injective IsPGroup.of_injective theorem to_subgroup (H : Subgroup G) : IsPGroup p H := hG.of_injective H.subtype Subtype.coe_injective #align is_p_group.to_subgroup IsPGroup.to_subgroup
Mathlib/GroupTheory/PGroup.lean
84
87
theorem of_surjective {H : Type*} [Group H] (Ο• : G β†’* H) (hΟ• : Function.Surjective Ο•) : IsPGroup p H := by
refine fun h => Exists.elim (hΟ• h) fun g hg => Exists.imp (fun k hk => ?_) (hG g) rw [← hg, ← Ο•.map_pow, hk, Ο•.map_one]
import Mathlib.Analysis.Convex.Topology import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.Seminorm import Mathlib.Analysis.LocallyConvex.Bounded import Mathlib.Analysis.RCLike.Basic #align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d" open NormedField Set open scoped Pointwise Topology NNReal noncomputable section variable {π•œ E F : Type*} section AddCommGroup variable [AddCommGroup E] [Module ℝ E] def gauge (s : Set E) (x : E) : ℝ := sInf { r : ℝ | 0 < r ∧ x ∈ r β€’ s } #align gauge gauge variable {s t : Set E} {x : E} {a : ℝ} theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r β€’ s }) := rfl #align gauge_def gauge_def theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ β€’ x ∈ s} := by congrm sInf {r | ?_} exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_memβ‚€ hr.ne' _ _ #align gauge_def' gauge_def' private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r β€’ s } := ⟨0, fun _ hr => hr.1.le⟩ theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) : { r : ℝ | 0 < r ∧ x ∈ r β€’ s }.Nonempty := let ⟨r, hr₁, hrβ‚‚βŸ© := (absorbs x).exists_pos ⟨r, hr₁, hrβ‚‚ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩ #align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty theorem gauge_mono (hs : Absorbent ℝ s) (h : s βŠ† t) : gauge t ≀ gauge s := fun _ => csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩ #align gauge_mono gauge_mono theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) : βˆƒ b, 0 < b ∧ b < a ∧ x ∈ b β€’ s := by obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h exact ⟨b, hb, hba, hx⟩ #align exists_lt_of_gauge_lt exists_lt_of_gauge_lt @[simp] theorem gauge_zero : gauge s 0 = 0 := by rw [gauge_def'] by_cases h : (0 : E) ∈ s Β· simp only [smul_zero, sep_true, h, csInf_Ioi] Β· simp only [smul_zero, sep_false, h, Real.sInf_empty] #align gauge_zero gauge_zero @[simp] theorem gauge_zero' : gauge (0 : Set E) = 0 := by ext x rw [gauge_def'] obtain rfl | hx := eq_or_ne x 0 Β· simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero] Β· simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero] convert Real.sInf_empty exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx #align gauge_zero' gauge_zero' @[simp] theorem gauge_empty : gauge (βˆ… : Set E) = 0 := by ext simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false] #align gauge_empty gauge_empty theorem gauge_of_subset_zero (h : s βŠ† 0) : gauge s = 0 := by obtain rfl | rfl := subset_singleton_iff_eq.1 h exacts [gauge_empty, gauge_zero'] #align gauge_of_subset_zero gauge_of_subset_zero theorem gauge_nonneg (x : E) : 0 ≀ gauge s x := Real.sInf_nonneg _ fun _ hx => hx.1.le #align gauge_nonneg gauge_nonneg theorem gauge_neg (symmetric : βˆ€ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by have : βˆ€ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩ simp_rw [gauge_def', smul_neg, this] #align gauge_neg gauge_neg theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by simp_rw [gauge_def', smul_neg, neg_mem_neg] #align gauge_neg_set_neg gauge_neg_set_neg
Mathlib/Analysis/Convex/Gauge.lean
138
139
theorem gauge_neg_set_eq_gauge_neg (x : E) : gauge (-s) x = gauge s (-x) := by
rw [← gauge_neg_set_neg, neg_neg]
import Mathlib.Logic.Pairwise import Mathlib.Order.CompleteBooleanAlgebra import Mathlib.Order.Directed import Mathlib.Order.GaloisConnection #align_import data.set.lattice from "leanprover-community/mathlib"@"b86832321b586c6ac23ef8cdef6a7a27e42b13bd" open Function Set universe u variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ ΞΉ' ΞΉβ‚‚ : Sort*} {ΞΊ κ₁ ΞΊβ‚‚ : ΞΉ β†’ Sort*} {ΞΊ' : ΞΉ' β†’ Sort*} namespace Set theorem mem_iUnionβ‚‚ {x : Ξ³} {s : βˆ€ i, ΞΊ i β†’ Set Ξ³} : (x ∈ ⋃ (i) (j), s i j) ↔ βˆƒ i j, x ∈ s i j := by simp_rw [mem_iUnion] #align set.mem_Unionβ‚‚ Set.mem_iUnionβ‚‚ theorem mem_iInterβ‚‚ {x : Ξ³} {s : βˆ€ i, ΞΊ i β†’ Set Ξ³} : (x ∈ β‹‚ (i) (j), s i j) ↔ βˆ€ i j, x ∈ s i j := by simp_rw [mem_iInter] #align set.mem_Interβ‚‚ Set.mem_iInterβ‚‚ theorem mem_iUnion_of_mem {s : ΞΉ β†’ Set Ξ±} {a : Ξ±} (i : ΞΉ) (ha : a ∈ s i) : a ∈ ⋃ i, s i := mem_iUnion.2 ⟨i, ha⟩ #align set.mem_Union_of_mem Set.mem_iUnion_of_mem theorem mem_iUnionβ‚‚_of_mem {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {a : Ξ±} {i : ΞΉ} (j : ΞΊ i) (ha : a ∈ s i j) : a ∈ ⋃ (i) (j), s i j := mem_iUnionβ‚‚.2 ⟨i, j, ha⟩ #align set.mem_Unionβ‚‚_of_mem Set.mem_iUnionβ‚‚_of_mem theorem mem_iInter_of_mem {s : ΞΉ β†’ Set Ξ±} {a : Ξ±} (h : βˆ€ i, a ∈ s i) : a ∈ β‹‚ i, s i := mem_iInter.2 h #align set.mem_Inter_of_mem Set.mem_iInter_of_mem theorem mem_iInterβ‚‚_of_mem {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {a : Ξ±} (h : βˆ€ i j, a ∈ s i j) : a ∈ β‹‚ (i) (j), s i j := mem_iInterβ‚‚.2 h #align set.mem_Interβ‚‚_of_mem Set.mem_iInterβ‚‚_of_mem instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (Set Ξ±) := { instBooleanAlgebraSet with le_sSup := fun s t t_in a a_in => ⟨t, t_in, a_in⟩ sSup_le := fun s t h a ⟨t', ⟨t'_in, a_in⟩⟩ => h t' t'_in a_in le_sInf := fun s t h a a_in t' t'_in => h t' t'_in a_in sInf_le := fun s t t_in a h => h _ t_in iInf_iSup_eq := by intros; ext; simp [Classical.skolem] } instance : OrderTop (Set Ξ±) where top := univ le_top := by simp @[congr] theorem iUnion_congr_Prop {p q : Prop} {f₁ : p β†’ Set Ξ±} {fβ‚‚ : q β†’ Set Ξ±} (pq : p ↔ q) (f : βˆ€ x, f₁ (pq.mpr x) = fβ‚‚ x) : iUnion f₁ = iUnion fβ‚‚ := iSup_congr_Prop pq f #align set.Union_congr_Prop Set.iUnion_congr_Prop @[congr] theorem iInter_congr_Prop {p q : Prop} {f₁ : p β†’ Set Ξ±} {fβ‚‚ : q β†’ Set Ξ±} (pq : p ↔ q) (f : βˆ€ x, f₁ (pq.mpr x) = fβ‚‚ x) : iInter f₁ = iInter fβ‚‚ := iInf_congr_Prop pq f #align set.Inter_congr_Prop Set.iInter_congr_Prop theorem iUnion_plift_up (f : PLift ΞΉ β†’ Set Ξ±) : ⋃ i, f (PLift.up i) = ⋃ i, f i := iSup_plift_up _ #align set.Union_plift_up Set.iUnion_plift_up theorem iUnion_plift_down (f : ΞΉ β†’ Set Ξ±) : ⋃ i, f (PLift.down i) = ⋃ i, f i := iSup_plift_down _ #align set.Union_plift_down Set.iUnion_plift_down theorem iInter_plift_up (f : PLift ΞΉ β†’ Set Ξ±) : β‹‚ i, f (PLift.up i) = β‹‚ i, f i := iInf_plift_up _ #align set.Inter_plift_up Set.iInter_plift_up theorem iInter_plift_down (f : ΞΉ β†’ Set Ξ±) : β‹‚ i, f (PLift.down i) = β‹‚ i, f i := iInf_plift_down _ #align set.Inter_plift_down Set.iInter_plift_down theorem iUnion_eq_if {p : Prop} [Decidable p] (s : Set Ξ±) : ⋃ _ : p, s = if p then s else βˆ… := iSup_eq_if _ #align set.Union_eq_if Set.iUnion_eq_if theorem iUnion_eq_dif {p : Prop} [Decidable p] (s : p β†’ Set Ξ±) : ⋃ h : p, s h = if h : p then s h else βˆ… := iSup_eq_dif _ #align set.Union_eq_dif Set.iUnion_eq_dif theorem iInter_eq_if {p : Prop} [Decidable p] (s : Set Ξ±) : β‹‚ _ : p, s = if p then s else univ := iInf_eq_if _ #align set.Inter_eq_if Set.iInter_eq_if theorem iInf_eq_dif {p : Prop} [Decidable p] (s : p β†’ Set Ξ±) : β‹‚ h : p, s h = if h : p then s h else univ := _root_.iInf_eq_dif _ #align set.Infi_eq_dif Set.iInf_eq_dif theorem exists_set_mem_of_union_eq_top {ΞΉ : Type*} (t : Set ΞΉ) (s : ΞΉ β†’ Set Ξ²) (w : ⋃ i ∈ t, s i = ⊀) (x : Ξ²) : βˆƒ i ∈ t, x ∈ s i := by have p : x ∈ ⊀ := Set.mem_univ x rw [← w, Set.mem_iUnion] at p simpa using p #align set.exists_set_mem_of_union_eq_top Set.exists_set_mem_of_union_eq_top theorem nonempty_of_union_eq_top_of_nonempty {ΞΉ : Type*} (t : Set ΞΉ) (s : ΞΉ β†’ Set Ξ±) (H : Nonempty Ξ±) (w : ⋃ i ∈ t, s i = ⊀) : t.Nonempty := by obtain ⟨x, m, -⟩ := exists_set_mem_of_union_eq_top t s w H.some exact ⟨x, m⟩ #align set.nonempty_of_union_eq_top_of_nonempty Set.nonempty_of_union_eq_top_of_nonempty theorem nonempty_of_nonempty_iUnion {s : ΞΉ β†’ Set Ξ±} (h_Union : (⋃ i, s i).Nonempty) : Nonempty ΞΉ := by obtain ⟨x, hx⟩ := h_Union exact ⟨Classical.choose <| mem_iUnion.mp hx⟩ theorem nonempty_of_nonempty_iUnion_eq_univ {s : ΞΉ β†’ Set Ξ±} [Nonempty Ξ±] (h_Union : ⋃ i, s i = univ) : Nonempty ΞΉ := nonempty_of_nonempty_iUnion (s := s) (by simpa only [h_Union] using univ_nonempty) theorem setOf_exists (p : ΞΉ β†’ Ξ² β†’ Prop) : { x | βˆƒ i, p i x } = ⋃ i, { x | p i x } := ext fun _ => mem_iUnion.symm #align set.set_of_exists Set.setOf_exists theorem setOf_forall (p : ΞΉ β†’ Ξ² β†’ Prop) : { x | βˆ€ i, p i x } = β‹‚ i, { x | p i x } := ext fun _ => mem_iInter.symm #align set.set_of_forall Set.setOf_forall theorem iUnion_subset {s : ΞΉ β†’ Set Ξ±} {t : Set Ξ±} (h : βˆ€ i, s i βŠ† t) : ⋃ i, s i βŠ† t := iSup_le h #align set.Union_subset Set.iUnion_subset theorem iUnionβ‚‚_subset {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : Set Ξ±} (h : βˆ€ i j, s i j βŠ† t) : ⋃ (i) (j), s i j βŠ† t := iUnion_subset fun x => iUnion_subset (h x) #align set.Unionβ‚‚_subset Set.iUnionβ‚‚_subset theorem subset_iInter {t : Set Ξ²} {s : ΞΉ β†’ Set Ξ²} (h : βˆ€ i, t βŠ† s i) : t βŠ† β‹‚ i, s i := le_iInf h #align set.subset_Inter Set.subset_iInter theorem subset_iInterβ‚‚ {s : Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (h : βˆ€ i j, s βŠ† t i j) : s βŠ† β‹‚ (i) (j), t i j := subset_iInter fun x => subset_iInter <| h x #align set.subset_Interβ‚‚ Set.subset_iInterβ‚‚ @[simp] theorem iUnion_subset_iff {s : ΞΉ β†’ Set Ξ±} {t : Set Ξ±} : ⋃ i, s i βŠ† t ↔ βˆ€ i, s i βŠ† t := ⟨fun h _ => Subset.trans (le_iSup s _) h, iUnion_subset⟩ #align set.Union_subset_iff Set.iUnion_subset_iff theorem iUnionβ‚‚_subset_iff {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : Set Ξ±} : ⋃ (i) (j), s i j βŠ† t ↔ βˆ€ i j, s i j βŠ† t := by simp_rw [iUnion_subset_iff] #align set.Unionβ‚‚_subset_iff Set.iUnionβ‚‚_subset_iff @[simp] theorem subset_iInter_iff {s : Set Ξ±} {t : ΞΉ β†’ Set Ξ±} : (s βŠ† β‹‚ i, t i) ↔ βˆ€ i, s βŠ† t i := le_iInf_iff #align set.subset_Inter_iff Set.subset_iInter_iff -- Porting note (#10618): removing `simp`. `simp` can prove it theorem subset_iInterβ‚‚_iff {s : Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ±} : (s βŠ† β‹‚ (i) (j), t i j) ↔ βˆ€ i j, s βŠ† t i j := by simp_rw [subset_iInter_iff] #align set.subset_Interβ‚‚_iff Set.subset_iInterβ‚‚_iff theorem subset_iUnion : βˆ€ (s : ΞΉ β†’ Set Ξ²) (i : ΞΉ), s i βŠ† ⋃ i, s i := le_iSup #align set.subset_Union Set.subset_iUnion theorem iInter_subset : βˆ€ (s : ΞΉ β†’ Set Ξ²) (i : ΞΉ), β‹‚ i, s i βŠ† s i := iInf_le #align set.Inter_subset Set.iInter_subset theorem subset_iUnionβ‚‚ {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} (i : ΞΉ) (j : ΞΊ i) : s i j βŠ† ⋃ (i') (j'), s i' j' := le_iSupβ‚‚ i j #align set.subset_Unionβ‚‚ Set.subset_iUnionβ‚‚ theorem iInterβ‚‚_subset {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} (i : ΞΉ) (j : ΞΊ i) : β‹‚ (i) (j), s i j βŠ† s i j := iInfβ‚‚_le i j #align set.Interβ‚‚_subset Set.iInterβ‚‚_subset theorem subset_iUnion_of_subset {s : Set Ξ±} {t : ΞΉ β†’ Set Ξ±} (i : ΞΉ) (h : s βŠ† t i) : s βŠ† ⋃ i, t i := le_iSup_of_le i h #align set.subset_Union_of_subset Set.subset_iUnion_of_subset theorem iInter_subset_of_subset {s : ΞΉ β†’ Set Ξ±} {t : Set Ξ±} (i : ΞΉ) (h : s i βŠ† t) : β‹‚ i, s i βŠ† t := iInf_le_of_le i h #align set.Inter_subset_of_subset Set.iInter_subset_of_subset theorem subset_iUnionβ‚‚_of_subset {s : Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (i : ΞΉ) (j : ΞΊ i) (h : s βŠ† t i j) : s βŠ† ⋃ (i) (j), t i j := le_iSupβ‚‚_of_le i j h #align set.subset_Unionβ‚‚_of_subset Set.subset_iUnionβ‚‚_of_subset theorem iInterβ‚‚_subset_of_subset {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : Set Ξ±} (i : ΞΉ) (j : ΞΊ i) (h : s i j βŠ† t) : β‹‚ (i) (j), s i j βŠ† t := iInfβ‚‚_le_of_le i j h #align set.Interβ‚‚_subset_of_subset Set.iInterβ‚‚_subset_of_subset theorem iUnion_mono {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i βŠ† t i) : ⋃ i, s i βŠ† ⋃ i, t i := iSup_mono h #align set.Union_mono Set.iUnion_mono @[gcongr] theorem iUnion_mono'' {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i βŠ† t i) : iUnion s βŠ† iUnion t := iSup_mono h theorem iUnionβ‚‚_mono {s t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (h : βˆ€ i j, s i j βŠ† t i j) : ⋃ (i) (j), s i j βŠ† ⋃ (i) (j), t i j := iSupβ‚‚_mono h #align set.Unionβ‚‚_mono Set.iUnionβ‚‚_mono theorem iInter_mono {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i βŠ† t i) : β‹‚ i, s i βŠ† β‹‚ i, t i := iInf_mono h #align set.Inter_mono Set.iInter_mono @[gcongr] theorem iInter_mono'' {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i βŠ† t i) : iInter s βŠ† iInter t := iInf_mono h theorem iInterβ‚‚_mono {s t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (h : βˆ€ i j, s i j βŠ† t i j) : β‹‚ (i) (j), s i j βŠ† β‹‚ (i) (j), t i j := iInfβ‚‚_mono h #align set.Interβ‚‚_mono Set.iInterβ‚‚_mono theorem iUnion_mono' {s : ΞΉ β†’ Set Ξ±} {t : ΞΉβ‚‚ β†’ Set Ξ±} (h : βˆ€ i, βˆƒ j, s i βŠ† t j) : ⋃ i, s i βŠ† ⋃ i, t i := iSup_mono' h #align set.Union_mono' Set.iUnion_mono' theorem iUnionβ‚‚_mono' {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : βˆ€ i', ΞΊ' i' β†’ Set Ξ±} (h : βˆ€ i j, βˆƒ i' j', s i j βŠ† t i' j') : ⋃ (i) (j), s i j βŠ† ⋃ (i') (j'), t i' j' := iSupβ‚‚_mono' h #align set.Unionβ‚‚_mono' Set.iUnionβ‚‚_mono' theorem iInter_mono' {s : ΞΉ β†’ Set Ξ±} {t : ΞΉ' β†’ Set Ξ±} (h : βˆ€ j, βˆƒ i, s i βŠ† t j) : β‹‚ i, s i βŠ† β‹‚ j, t j := Set.subset_iInter fun j => let ⟨i, hi⟩ := h j iInter_subset_of_subset i hi #align set.Inter_mono' Set.iInter_mono' theorem iInterβ‚‚_mono' {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : βˆ€ i', ΞΊ' i' β†’ Set Ξ±} (h : βˆ€ i' j', βˆƒ i j, s i j βŠ† t i' j') : β‹‚ (i) (j), s i j βŠ† β‹‚ (i') (j'), t i' j' := subset_iInterβ‚‚_iff.2 fun i' j' => let ⟨_, _, hst⟩ := h i' j' (iInterβ‚‚_subset _ _).trans hst #align set.Interβ‚‚_mono' Set.iInterβ‚‚_mono' theorem iUnionβ‚‚_subset_iUnion (ΞΊ : ΞΉ β†’ Sort*) (s : ΞΉ β†’ Set Ξ±) : ⋃ (i) (_ : ΞΊ i), s i βŠ† ⋃ i, s i := iUnion_mono fun _ => iUnion_subset fun _ => Subset.rfl #align set.Unionβ‚‚_subset_Union Set.iUnionβ‚‚_subset_iUnion theorem iInter_subset_iInterβ‚‚ (ΞΊ : ΞΉ β†’ Sort*) (s : ΞΉ β†’ Set Ξ±) : β‹‚ i, s i βŠ† β‹‚ (i) (_ : ΞΊ i), s i := iInter_mono fun _ => subset_iInter fun _ => Subset.rfl #align set.Inter_subset_Interβ‚‚ Set.iInter_subset_iInterβ‚‚ theorem iUnion_setOf (P : ΞΉ β†’ Ξ± β†’ Prop) : ⋃ i, { x : Ξ± | P i x } = { x : Ξ± | βˆƒ i, P i x } := by ext exact mem_iUnion #align set.Union_set_of Set.iUnion_setOf theorem iInter_setOf (P : ΞΉ β†’ Ξ± β†’ Prop) : β‹‚ i, { x : Ξ± | P i x } = { x : Ξ± | βˆ€ i, P i x } := by ext exact mem_iInter #align set.Inter_set_of Set.iInter_setOf theorem iUnion_congr_of_surjective {f : ΞΉ β†’ Set Ξ±} {g : ΞΉβ‚‚ β†’ Set Ξ±} (h : ΞΉ β†’ ΞΉβ‚‚) (h1 : Surjective h) (h2 : βˆ€ x, g (h x) = f x) : ⋃ x, f x = ⋃ y, g y := h1.iSup_congr h h2 #align set.Union_congr_of_surjective Set.iUnion_congr_of_surjective theorem iInter_congr_of_surjective {f : ΞΉ β†’ Set Ξ±} {g : ΞΉβ‚‚ β†’ Set Ξ±} (h : ΞΉ β†’ ΞΉβ‚‚) (h1 : Surjective h) (h2 : βˆ€ x, g (h x) = f x) : β‹‚ x, f x = β‹‚ y, g y := h1.iInf_congr h h2 #align set.Inter_congr_of_surjective Set.iInter_congr_of_surjective lemma iUnion_congr {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i = t i) : ⋃ i, s i = ⋃ i, t i := iSup_congr h #align set.Union_congr Set.iUnion_congr lemma iInter_congr {s t : ΞΉ β†’ Set Ξ±} (h : βˆ€ i, s i = t i) : β‹‚ i, s i = β‹‚ i, t i := iInf_congr h #align set.Inter_congr Set.iInter_congr lemma iUnionβ‚‚_congr {s t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (h : βˆ€ i j, s i j = t i j) : ⋃ (i) (j), s i j = ⋃ (i) (j), t i j := iUnion_congr fun i => iUnion_congr <| h i #align set.Unionβ‚‚_congr Set.iUnionβ‚‚_congr lemma iInterβ‚‚_congr {s t : βˆ€ i, ΞΊ i β†’ Set Ξ±} (h : βˆ€ i j, s i j = t i j) : β‹‚ (i) (j), s i j = β‹‚ (i) (j), t i j := iInter_congr fun i => iInter_congr <| h i #align set.Interβ‚‚_congr Set.iInterβ‚‚_congr @[simp] theorem compl_iUnion (s : ΞΉ β†’ Set Ξ²) : (⋃ i, s i)ᢜ = β‹‚ i, (s i)ᢜ := compl_iSup #align set.compl_Union Set.compl_iUnion theorem compl_iUnionβ‚‚ (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) : (⋃ (i) (j), s i j)ᢜ = β‹‚ (i) (j), (s i j)ᢜ := by simp_rw [compl_iUnion] #align set.compl_Unionβ‚‚ Set.compl_iUnionβ‚‚ @[simp] theorem compl_iInter (s : ΞΉ β†’ Set Ξ²) : (β‹‚ i, s i)ᢜ = ⋃ i, (s i)ᢜ := compl_iInf #align set.compl_Inter Set.compl_iInter theorem compl_iInterβ‚‚ (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) : (β‹‚ (i) (j), s i j)ᢜ = ⋃ (i) (j), (s i j)ᢜ := by simp_rw [compl_iInter] #align set.compl_Interβ‚‚ Set.compl_iInterβ‚‚ -- classical -- complete_boolean_algebra theorem iUnion_eq_compl_iInter_compl (s : ΞΉ β†’ Set Ξ²) : ⋃ i, s i = (β‹‚ i, (s i)ᢜ)ᢜ := by simp only [compl_iInter, compl_compl] #align set.Union_eq_compl_Inter_compl Set.iUnion_eq_compl_iInter_compl -- classical -- complete_boolean_algebra theorem iInter_eq_compl_iUnion_compl (s : ΞΉ β†’ Set Ξ²) : β‹‚ i, s i = (⋃ i, (s i)ᢜ)ᢜ := by simp only [compl_iUnion, compl_compl] #align set.Inter_eq_compl_Union_compl Set.iInter_eq_compl_iUnion_compl theorem inter_iUnion (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s ∩ ⋃ i, t i) = ⋃ i, s ∩ t i := inf_iSup_eq _ _ #align set.inter_Union Set.inter_iUnion theorem iUnion_inter (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (⋃ i, t i) ∩ s = ⋃ i, t i ∩ s := iSup_inf_eq _ _ #align set.Union_inter Set.iUnion_inter theorem iUnion_union_distrib (s : ΞΉ β†’ Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : ⋃ i, s i βˆͺ t i = (⋃ i, s i) βˆͺ ⋃ i, t i := iSup_sup_eq #align set.Union_union_distrib Set.iUnion_union_distrib theorem iInter_inter_distrib (s : ΞΉ β†’ Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : β‹‚ i, s i ∩ t i = (β‹‚ i, s i) ∩ β‹‚ i, t i := iInf_inf_eq #align set.Inter_inter_distrib Set.iInter_inter_distrib theorem union_iUnion [Nonempty ΞΉ] (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s βˆͺ ⋃ i, t i) = ⋃ i, s βˆͺ t i := sup_iSup #align set.union_Union Set.union_iUnion theorem iUnion_union [Nonempty ΞΉ] (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (⋃ i, t i) βˆͺ s = ⋃ i, t i βˆͺ s := iSup_sup #align set.Union_union Set.iUnion_union theorem inter_iInter [Nonempty ΞΉ] (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s ∩ β‹‚ i, t i) = β‹‚ i, s ∩ t i := inf_iInf #align set.inter_Inter Set.inter_iInter theorem iInter_inter [Nonempty ΞΉ] (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (β‹‚ i, t i) ∩ s = β‹‚ i, t i ∩ s := iInf_inf #align set.Inter_inter Set.iInter_inter -- classical theorem union_iInter (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s βˆͺ β‹‚ i, t i) = β‹‚ i, s βˆͺ t i := sup_iInf_eq _ _ #align set.union_Inter Set.union_iInter theorem iInter_union (s : ΞΉ β†’ Set Ξ²) (t : Set Ξ²) : (β‹‚ i, s i) βˆͺ t = β‹‚ i, s i βˆͺ t := iInf_sup_eq _ _ #align set.Inter_union Set.iInter_union theorem iUnion_diff (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (⋃ i, t i) \ s = ⋃ i, t i \ s := iUnion_inter _ _ #align set.Union_diff Set.iUnion_diff theorem diff_iUnion [Nonempty ΞΉ] (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s \ ⋃ i, t i) = β‹‚ i, s \ t i := by rw [diff_eq, compl_iUnion, inter_iInter]; rfl #align set.diff_Union Set.diff_iUnion theorem diff_iInter (s : Set Ξ²) (t : ΞΉ β†’ Set Ξ²) : (s \ β‹‚ i, t i) = ⋃ i, s \ t i := by rw [diff_eq, compl_iInter, inter_iUnion]; rfl #align set.diff_Inter Set.diff_iInter theorem iUnion_inter_subset {ΞΉ Ξ±} {s t : ΞΉ β†’ Set Ξ±} : ⋃ i, s i ∩ t i βŠ† (⋃ i, s i) ∩ ⋃ i, t i := le_iSup_inf_iSup s t #align set.Union_inter_subset Set.iUnion_inter_subset theorem iUnion_inter_of_monotone {ΞΉ Ξ±} [Preorder ΞΉ] [IsDirected ΞΉ (Β· ≀ Β·)] {s t : ΞΉ β†’ Set Ξ±} (hs : Monotone s) (ht : Monotone t) : ⋃ i, s i ∩ t i = (⋃ i, s i) ∩ ⋃ i, t i := iSup_inf_of_monotone hs ht #align set.Union_inter_of_monotone Set.iUnion_inter_of_monotone theorem iUnion_inter_of_antitone {ΞΉ Ξ±} [Preorder ΞΉ] [IsDirected ΞΉ (swap (Β· ≀ Β·))] {s t : ΞΉ β†’ Set Ξ±} (hs : Antitone s) (ht : Antitone t) : ⋃ i, s i ∩ t i = (⋃ i, s i) ∩ ⋃ i, t i := iSup_inf_of_antitone hs ht #align set.Union_inter_of_antitone Set.iUnion_inter_of_antitone theorem iInter_union_of_monotone {ΞΉ Ξ±} [Preorder ΞΉ] [IsDirected ΞΉ (swap (Β· ≀ Β·))] {s t : ΞΉ β†’ Set Ξ±} (hs : Monotone s) (ht : Monotone t) : β‹‚ i, s i βˆͺ t i = (β‹‚ i, s i) βˆͺ β‹‚ i, t i := iInf_sup_of_monotone hs ht #align set.Inter_union_of_monotone Set.iInter_union_of_monotone theorem iInter_union_of_antitone {ΞΉ Ξ±} [Preorder ΞΉ] [IsDirected ΞΉ (Β· ≀ Β·)] {s t : ΞΉ β†’ Set Ξ±} (hs : Antitone s) (ht : Antitone t) : β‹‚ i, s i βˆͺ t i = (β‹‚ i, s i) βˆͺ β‹‚ i, t i := iInf_sup_of_antitone hs ht #align set.Inter_union_of_antitone Set.iInter_union_of_antitone theorem iUnion_iInter_subset {s : ΞΉ β†’ ΞΉ' β†’ Set Ξ±} : (⋃ j, β‹‚ i, s i j) βŠ† β‹‚ i, ⋃ j, s i j := iSup_iInf_le_iInf_iSup (flip s) #align set.Union_Inter_subset Set.iUnion_iInter_subset theorem iUnion_option {ΞΉ} (s : Option ΞΉ β†’ Set Ξ±) : ⋃ o, s o = s none βˆͺ ⋃ i, s (some i) := iSup_option s #align set.Union_option Set.iUnion_option theorem iInter_option {ΞΉ} (s : Option ΞΉ β†’ Set Ξ±) : β‹‚ o, s o = s none ∩ β‹‚ i, s (some i) := iInf_option s #align set.Inter_option Set.iInter_option section variable (p : ΞΉ β†’ Prop) [DecidablePred p] theorem iUnion_dite (f : βˆ€ i, p i β†’ Set Ξ±) (g : βˆ€ i, Β¬p i β†’ Set Ξ±) : ⋃ i, (if h : p i then f i h else g i h) = (⋃ (i) (h : p i), f i h) βˆͺ ⋃ (i) (h : Β¬p i), g i h := iSup_dite _ _ _ #align set.Union_dite Set.iUnion_dite theorem iUnion_ite (f g : ΞΉ β†’ Set Ξ±) : ⋃ i, (if p i then f i else g i) = (⋃ (i) (_ : p i), f i) βˆͺ ⋃ (i) (_ : Β¬p i), g i := iUnion_dite _ _ _ #align set.Union_ite Set.iUnion_ite theorem iInter_dite (f : βˆ€ i, p i β†’ Set Ξ±) (g : βˆ€ i, Β¬p i β†’ Set Ξ±) : β‹‚ i, (if h : p i then f i h else g i h) = (β‹‚ (i) (h : p i), f i h) ∩ β‹‚ (i) (h : Β¬p i), g i h := iInf_dite _ _ _ #align set.Inter_dite Set.iInter_dite theorem iInter_ite (f g : ΞΉ β†’ Set Ξ±) : β‹‚ i, (if p i then f i else g i) = (β‹‚ (i) (_ : p i), f i) ∩ β‹‚ (i) (_ : Β¬p i), g i := iInter_dite _ _ _ #align set.Inter_ite Set.iInter_ite end theorem image_projection_prod {ΞΉ : Type*} {Ξ± : ΞΉ β†’ Type*} {v : βˆ€ i : ΞΉ, Set (Ξ± i)} (hv : (pi univ v).Nonempty) (i : ΞΉ) : ((fun x : βˆ€ i : ΞΉ, Ξ± i => x i) '' β‹‚ k, (fun x : βˆ€ j : ΞΉ, Ξ± j => x k) ⁻¹' v k) = v i := by classical apply Subset.antisymm Β· simp [iInter_subset] Β· intro y y_in simp only [mem_image, mem_iInter, mem_preimage] rcases hv with ⟨z, hz⟩ refine ⟨Function.update z i y, ?_, update_same i y z⟩ rw [@forall_update_iff ΞΉ Ξ± _ z i y fun i t => t ∈ v i] exact ⟨y_in, fun j _ => by simpa using hz j⟩ #align set.image_projection_prod Set.image_projection_prod theorem iInter_false {s : False β†’ Set Ξ±} : iInter s = univ := iInf_false #align set.Inter_false Set.iInter_false theorem iUnion_false {s : False β†’ Set Ξ±} : iUnion s = βˆ… := iSup_false #align set.Union_false Set.iUnion_false @[simp] theorem iInter_true {s : True β†’ Set Ξ±} : iInter s = s trivial := iInf_true #align set.Inter_true Set.iInter_true @[simp] theorem iUnion_true {s : True β†’ Set Ξ±} : iUnion s = s trivial := iSup_true #align set.Union_true Set.iUnion_true @[simp] theorem iInter_exists {p : ΞΉ β†’ Prop} {f : Exists p β†’ Set Ξ±} : β‹‚ x, f x = β‹‚ (i) (h : p i), f ⟨i, h⟩ := iInf_exists #align set.Inter_exists Set.iInter_exists @[simp] theorem iUnion_exists {p : ΞΉ β†’ Prop} {f : Exists p β†’ Set Ξ±} : ⋃ x, f x = ⋃ (i) (h : p i), f ⟨i, h⟩ := iSup_exists #align set.Union_exists Set.iUnion_exists @[simp] theorem iUnion_empty : (⋃ _ : ΞΉ, βˆ… : Set Ξ±) = βˆ… := iSup_bot #align set.Union_empty Set.iUnion_empty @[simp] theorem iInter_univ : (β‹‚ _ : ΞΉ, univ : Set Ξ±) = univ := iInf_top #align set.Inter_univ Set.iInter_univ section variable {s : ΞΉ β†’ Set Ξ±} @[simp] theorem iUnion_eq_empty : ⋃ i, s i = βˆ… ↔ βˆ€ i, s i = βˆ… := iSup_eq_bot #align set.Union_eq_empty Set.iUnion_eq_empty @[simp] theorem iInter_eq_univ : β‹‚ i, s i = univ ↔ βˆ€ i, s i = univ := iInf_eq_top #align set.Inter_eq_univ Set.iInter_eq_univ @[simp] theorem nonempty_iUnion : (⋃ i, s i).Nonempty ↔ βˆƒ i, (s i).Nonempty := by simp [nonempty_iff_ne_empty] #align set.nonempty_Union Set.nonempty_iUnion -- Porting note (#10618): removing `simp`. `simp` can prove it theorem nonempty_biUnion {t : Set Ξ±} {s : Ξ± β†’ Set Ξ²} : (⋃ i ∈ t, s i).Nonempty ↔ βˆƒ i ∈ t, (s i).Nonempty := by simp #align set.nonempty_bUnion Set.nonempty_biUnion theorem iUnion_nonempty_index (s : Set Ξ±) (t : s.Nonempty β†’ Set Ξ²) : ⋃ h, t h = ⋃ x ∈ s, t ⟨x, β€Ή_β€ΊβŸ© := iSup_exists #align set.Union_nonempty_index Set.iUnion_nonempty_index end @[simp] theorem iInter_iInter_eq_left {b : Ξ²} {s : βˆ€ x : Ξ², x = b β†’ Set Ξ±} : β‹‚ (x) (h : x = b), s x h = s b rfl := iInf_iInf_eq_left #align set.Inter_Inter_eq_left Set.iInter_iInter_eq_left @[simp] theorem iInter_iInter_eq_right {b : Ξ²} {s : βˆ€ x : Ξ², b = x β†’ Set Ξ±} : β‹‚ (x) (h : b = x), s x h = s b rfl := iInf_iInf_eq_right #align set.Inter_Inter_eq_right Set.iInter_iInter_eq_right @[simp] theorem iUnion_iUnion_eq_left {b : Ξ²} {s : βˆ€ x : Ξ², x = b β†’ Set Ξ±} : ⋃ (x) (h : x = b), s x h = s b rfl := iSup_iSup_eq_left #align set.Union_Union_eq_left Set.iUnion_iUnion_eq_left @[simp] theorem iUnion_iUnion_eq_right {b : Ξ²} {s : βˆ€ x : Ξ², b = x β†’ Set Ξ±} : ⋃ (x) (h : b = x), s x h = s b rfl := iSup_iSup_eq_right #align set.Union_Union_eq_right Set.iUnion_iUnion_eq_right theorem iInter_or {p q : Prop} (s : p ∨ q β†’ Set Ξ±) : β‹‚ h, s h = (β‹‚ h : p, s (Or.inl h)) ∩ β‹‚ h : q, s (Or.inr h) := iInf_or #align set.Inter_or Set.iInter_or theorem iUnion_or {p q : Prop} (s : p ∨ q β†’ Set Ξ±) : ⋃ h, s h = (⋃ i, s (Or.inl i)) βˆͺ ⋃ j, s (Or.inr j) := iSup_or #align set.Union_or Set.iUnion_or theorem iUnion_and {p q : Prop} (s : p ∧ q β†’ Set Ξ±) : ⋃ h, s h = ⋃ (hp) (hq), s ⟨hp, hq⟩ := iSup_and #align set.Union_and Set.iUnion_and theorem iInter_and {p q : Prop} (s : p ∧ q β†’ Set Ξ±) : β‹‚ h, s h = β‹‚ (hp) (hq), s ⟨hp, hq⟩ := iInf_and #align set.Inter_and Set.iInter_and theorem iUnion_comm (s : ΞΉ β†’ ΞΉ' β†’ Set Ξ±) : ⋃ (i) (i'), s i i' = ⋃ (i') (i), s i i' := iSup_comm #align set.Union_comm Set.iUnion_comm theorem iInter_comm (s : ΞΉ β†’ ΞΉ' β†’ Set Ξ±) : β‹‚ (i) (i'), s i i' = β‹‚ (i') (i), s i i' := iInf_comm #align set.Inter_comm Set.iInter_comm theorem iUnion_sigma {Ξ³ : Ξ± β†’ Type*} (s : Sigma Ξ³ β†’ Set Ξ²) : ⋃ ia, s ia = ⋃ i, ⋃ a, s ⟨i, a⟩ := iSup_sigma theorem iUnion_sigma' {Ξ³ : Ξ± β†’ Type*} (s : βˆ€ i, Ξ³ i β†’ Set Ξ²) : ⋃ i, ⋃ a, s i a = ⋃ ia : Sigma Ξ³, s ia.1 ia.2 := iSup_sigma' _ theorem iInter_sigma {Ξ³ : Ξ± β†’ Type*} (s : Sigma Ξ³ β†’ Set Ξ²) : β‹‚ ia, s ia = β‹‚ i, β‹‚ a, s ⟨i, a⟩ := iInf_sigma theorem iInter_sigma' {Ξ³ : Ξ± β†’ Type*} (s : βˆ€ i, Ξ³ i β†’ Set Ξ²) : β‹‚ i, β‹‚ a, s i a = β‹‚ ia : Sigma Ξ³, s ia.1 ia.2 := iInf_sigma' _ theorem iUnionβ‚‚_comm (s : βˆ€ i₁, κ₁ i₁ β†’ βˆ€ iβ‚‚, ΞΊβ‚‚ iβ‚‚ β†’ Set Ξ±) : ⋃ (i₁) (j₁) (iβ‚‚) (jβ‚‚), s i₁ j₁ iβ‚‚ jβ‚‚ = ⋃ (iβ‚‚) (jβ‚‚) (i₁) (j₁), s i₁ j₁ iβ‚‚ jβ‚‚ := iSupβ‚‚_comm _ #align set.Unionβ‚‚_comm Set.iUnionβ‚‚_comm theorem iInterβ‚‚_comm (s : βˆ€ i₁, κ₁ i₁ β†’ βˆ€ iβ‚‚, ΞΊβ‚‚ iβ‚‚ β†’ Set Ξ±) : β‹‚ (i₁) (j₁) (iβ‚‚) (jβ‚‚), s i₁ j₁ iβ‚‚ jβ‚‚ = β‹‚ (iβ‚‚) (jβ‚‚) (i₁) (j₁), s i₁ j₁ iβ‚‚ jβ‚‚ := iInfβ‚‚_comm _ #align set.Interβ‚‚_comm Set.iInterβ‚‚_comm @[simp] theorem biUnion_and (p : ΞΉ β†’ Prop) (q : ΞΉ β†’ ΞΉ' β†’ Prop) (s : βˆ€ x y, p x ∧ q x y β†’ Set Ξ±) : ⋃ (x : ΞΉ) (y : ΞΉ') (h : p x ∧ q x y), s x y h = ⋃ (x : ΞΉ) (hx : p x) (y : ΞΉ') (hy : q x y), s x y ⟨hx, hy⟩ := by simp only [iUnion_and, @iUnion_comm _ ΞΉ'] #align set.bUnion_and Set.biUnion_and @[simp] theorem biUnion_and' (p : ΞΉ' β†’ Prop) (q : ΞΉ β†’ ΞΉ' β†’ Prop) (s : βˆ€ x y, p y ∧ q x y β†’ Set Ξ±) : ⋃ (x : ΞΉ) (y : ΞΉ') (h : p y ∧ q x y), s x y h = ⋃ (y : ΞΉ') (hy : p y) (x : ΞΉ) (hx : q x y), s x y ⟨hy, hx⟩ := by simp only [iUnion_and, @iUnion_comm _ ΞΉ] #align set.bUnion_and' Set.biUnion_and' @[simp] theorem biInter_and (p : ΞΉ β†’ Prop) (q : ΞΉ β†’ ΞΉ' β†’ Prop) (s : βˆ€ x y, p x ∧ q x y β†’ Set Ξ±) : β‹‚ (x : ΞΉ) (y : ΞΉ') (h : p x ∧ q x y), s x y h = β‹‚ (x : ΞΉ) (hx : p x) (y : ΞΉ') (hy : q x y), s x y ⟨hx, hy⟩ := by simp only [iInter_and, @iInter_comm _ ΞΉ'] #align set.bInter_and Set.biInter_and @[simp] theorem biInter_and' (p : ΞΉ' β†’ Prop) (q : ΞΉ β†’ ΞΉ' β†’ Prop) (s : βˆ€ x y, p y ∧ q x y β†’ Set Ξ±) : β‹‚ (x : ΞΉ) (y : ΞΉ') (h : p y ∧ q x y), s x y h = β‹‚ (y : ΞΉ') (hy : p y) (x : ΞΉ) (hx : q x y), s x y ⟨hy, hx⟩ := by simp only [iInter_and, @iInter_comm _ ΞΉ] #align set.bInter_and' Set.biInter_and' @[simp] theorem iUnion_iUnion_eq_or_left {b : Ξ²} {p : Ξ² β†’ Prop} {s : βˆ€ x : Ξ², x = b ∨ p x β†’ Set Ξ±} : ⋃ (x) (h), s x h = s b (Or.inl rfl) βˆͺ ⋃ (x) (h : p x), s x (Or.inr h) := by simp only [iUnion_or, iUnion_union_distrib, iUnion_iUnion_eq_left] #align set.Union_Union_eq_or_left Set.iUnion_iUnion_eq_or_left @[simp] theorem iInter_iInter_eq_or_left {b : Ξ²} {p : Ξ² β†’ Prop} {s : βˆ€ x : Ξ², x = b ∨ p x β†’ Set Ξ±} : β‹‚ (x) (h), s x h = s b (Or.inl rfl) ∩ β‹‚ (x) (h : p x), s x (Or.inr h) := by simp only [iInter_or, iInter_inter_distrib, iInter_iInter_eq_left] #align set.Inter_Inter_eq_or_left Set.iInter_iInter_eq_or_left theorem mem_biUnion {s : Set Ξ±} {t : Ξ± β†’ Set Ξ²} {x : Ξ±} {y : Ξ²} (xs : x ∈ s) (ytx : y ∈ t x) : y ∈ ⋃ x ∈ s, t x := mem_iUnionβ‚‚_of_mem xs ytx #align set.mem_bUnion Set.mem_biUnion theorem mem_biInter {s : Set Ξ±} {t : Ξ± β†’ Set Ξ²} {y : Ξ²} (h : βˆ€ x ∈ s, y ∈ t x) : y ∈ β‹‚ x ∈ s, t x := mem_iInterβ‚‚_of_mem h #align set.mem_bInter Set.mem_biInter theorem subset_biUnion_of_mem {s : Set Ξ±} {u : Ξ± β†’ Set Ξ²} {x : Ξ±} (xs : x ∈ s) : u x βŠ† ⋃ x ∈ s, u x := -- Porting note: Why is this not just `subset_iUnionβ‚‚ x xs`? @subset_iUnionβ‚‚ Ξ² Ξ± (Β· ∈ s) (fun i _ => u i) x xs #align set.subset_bUnion_of_mem Set.subset_biUnion_of_mem theorem biInter_subset_of_mem {s : Set Ξ±} {t : Ξ± β†’ Set Ξ²} {x : Ξ±} (xs : x ∈ s) : β‹‚ x ∈ s, t x βŠ† t x := iInterβ‚‚_subset x xs #align set.bInter_subset_of_mem Set.biInter_subset_of_mem theorem biUnion_subset_biUnion_left {s s' : Set Ξ±} {t : Ξ± β†’ Set Ξ²} (h : s βŠ† s') : ⋃ x ∈ s, t x βŠ† ⋃ x ∈ s', t x := iUnionβ‚‚_subset fun _ hx => subset_biUnion_of_mem <| h hx #align set.bUnion_subset_bUnion_left Set.biUnion_subset_biUnion_left theorem biInter_subset_biInter_left {s s' : Set Ξ±} {t : Ξ± β†’ Set Ξ²} (h : s' βŠ† s) : β‹‚ x ∈ s, t x βŠ† β‹‚ x ∈ s', t x := subset_iInterβ‚‚ fun _ hx => biInter_subset_of_mem <| h hx #align set.bInter_subset_bInter_left Set.biInter_subset_biInter_left theorem biUnion_mono {s s' : Set Ξ±} {t t' : Ξ± β†’ Set Ξ²} (hs : s' βŠ† s) (h : βˆ€ x ∈ s, t x βŠ† t' x) : ⋃ x ∈ s', t x βŠ† ⋃ x ∈ s, t' x := (biUnion_subset_biUnion_left hs).trans <| iUnionβ‚‚_mono h #align set.bUnion_mono Set.biUnion_mono theorem biInter_mono {s s' : Set Ξ±} {t t' : Ξ± β†’ Set Ξ²} (hs : s βŠ† s') (h : βˆ€ x ∈ s, t x βŠ† t' x) : β‹‚ x ∈ s', t x βŠ† β‹‚ x ∈ s, t' x := (biInter_subset_biInter_left hs).trans <| iInterβ‚‚_mono h #align set.bInter_mono Set.biInter_mono theorem biUnion_eq_iUnion (s : Set Ξ±) (t : βˆ€ x ∈ s, Set Ξ²) : ⋃ x ∈ s, t x β€Ή_β€Ί = ⋃ x : s, t x x.2 := iSup_subtype' #align set.bUnion_eq_Union Set.biUnion_eq_iUnion theorem biInter_eq_iInter (s : Set Ξ±) (t : βˆ€ x ∈ s, Set Ξ²) : β‹‚ x ∈ s, t x β€Ή_β€Ί = β‹‚ x : s, t x x.2 := iInf_subtype' #align set.bInter_eq_Inter Set.biInter_eq_iInter theorem iUnion_subtype (p : Ξ± β†’ Prop) (s : { x // p x } β†’ Set Ξ²) : ⋃ x : { x // p x }, s x = ⋃ (x) (hx : p x), s ⟨x, hx⟩ := iSup_subtype #align set.Union_subtype Set.iUnion_subtype theorem iInter_subtype (p : Ξ± β†’ Prop) (s : { x // p x } β†’ Set Ξ²) : β‹‚ x : { x // p x }, s x = β‹‚ (x) (hx : p x), s ⟨x, hx⟩ := iInf_subtype #align set.Inter_subtype Set.iInter_subtype theorem biInter_empty (u : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ (βˆ… : Set Ξ±), u x = univ := iInf_emptyset #align set.bInter_empty Set.biInter_empty theorem biInter_univ (u : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ @univ Ξ±, u x = β‹‚ x, u x := iInf_univ #align set.bInter_univ Set.biInter_univ @[simp] theorem biUnion_self (s : Set Ξ±) : ⋃ x ∈ s, s = s := Subset.antisymm (iUnionβ‚‚_subset fun _ _ => Subset.refl s) fun _ hx => mem_biUnion hx hx #align set.bUnion_self Set.biUnion_self @[simp] theorem iUnion_nonempty_self (s : Set Ξ±) : ⋃ _ : s.Nonempty, s = s := by rw [iUnion_nonempty_index, biUnion_self] #align set.Union_nonempty_self Set.iUnion_nonempty_self theorem biInter_singleton (a : Ξ±) (s : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ ({a} : Set Ξ±), s x = s a := iInf_singleton #align set.bInter_singleton Set.biInter_singleton theorem biInter_union (s t : Set Ξ±) (u : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ s βˆͺ t, u x = (β‹‚ x ∈ s, u x) ∩ β‹‚ x ∈ t, u x := iInf_union #align set.bInter_union Set.biInter_union theorem biInter_insert (a : Ξ±) (s : Set Ξ±) (t : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ insert a s, t x = t a ∩ β‹‚ x ∈ s, t x := by simp #align set.bInter_insert Set.biInter_insert theorem biInter_pair (a b : Ξ±) (s : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ ({a, b} : Set Ξ±), s x = s a ∩ s b := by rw [biInter_insert, biInter_singleton] #align set.bInter_pair Set.biInter_pair theorem biInter_inter {ΞΉ Ξ± : Type*} {s : Set ΞΉ} (hs : s.Nonempty) (f : ΞΉ β†’ Set Ξ±) (t : Set Ξ±) : β‹‚ i ∈ s, f i ∩ t = (β‹‚ i ∈ s, f i) ∩ t := by haveI : Nonempty s := hs.to_subtype simp [biInter_eq_iInter, ← iInter_inter] #align set.bInter_inter Set.biInter_inter theorem inter_biInter {ΞΉ Ξ± : Type*} {s : Set ΞΉ} (hs : s.Nonempty) (f : ΞΉ β†’ Set Ξ±) (t : Set Ξ±) : β‹‚ i ∈ s, t ∩ f i = t ∩ β‹‚ i ∈ s, f i := by rw [inter_comm, ← biInter_inter hs] simp [inter_comm] #align set.inter_bInter Set.inter_biInter theorem biUnion_empty (s : Ξ± β†’ Set Ξ²) : ⋃ x ∈ (βˆ… : Set Ξ±), s x = βˆ… := iSup_emptyset #align set.bUnion_empty Set.biUnion_empty theorem biUnion_univ (s : Ξ± β†’ Set Ξ²) : ⋃ x ∈ @univ Ξ±, s x = ⋃ x, s x := iSup_univ #align set.bUnion_univ Set.biUnion_univ theorem biUnion_singleton (a : Ξ±) (s : Ξ± β†’ Set Ξ²) : ⋃ x ∈ ({a} : Set Ξ±), s x = s a := iSup_singleton #align set.bUnion_singleton Set.biUnion_singleton @[simp] theorem biUnion_of_singleton (s : Set Ξ±) : ⋃ x ∈ s, {x} = s := ext <| by simp #align set.bUnion_of_singleton Set.biUnion_of_singleton theorem biUnion_union (s t : Set Ξ±) (u : Ξ± β†’ Set Ξ²) : ⋃ x ∈ s βˆͺ t, u x = (⋃ x ∈ s, u x) βˆͺ ⋃ x ∈ t, u x := iSup_union #align set.bUnion_union Set.biUnion_union @[simp] theorem iUnion_coe_set {Ξ± Ξ² : Type*} (s : Set Ξ±) (f : s β†’ Set Ξ²) : ⋃ i, f i = ⋃ i ∈ s, f ⟨i, β€Ήi ∈ sβ€ΊβŸ© := iUnion_subtype _ _ #align set.Union_coe_set Set.iUnion_coe_set @[simp] theorem iInter_coe_set {Ξ± Ξ² : Type*} (s : Set Ξ±) (f : s β†’ Set Ξ²) : β‹‚ i, f i = β‹‚ i ∈ s, f ⟨i, β€Ήi ∈ sβ€ΊβŸ© := iInter_subtype _ _ #align set.Inter_coe_set Set.iInter_coe_set theorem biUnion_insert (a : Ξ±) (s : Set Ξ±) (t : Ξ± β†’ Set Ξ²) : ⋃ x ∈ insert a s, t x = t a βˆͺ ⋃ x ∈ s, t x := by simp #align set.bUnion_insert Set.biUnion_insert theorem biUnion_pair (a b : Ξ±) (s : Ξ± β†’ Set Ξ²) : ⋃ x ∈ ({a, b} : Set Ξ±), s x = s a βˆͺ s b := by simp #align set.bUnion_pair Set.biUnion_pair theorem inter_iUnionβ‚‚ (s : Set Ξ±) (t : βˆ€ i, ΞΊ i β†’ Set Ξ±) : (s ∩ ⋃ (i) (j), t i j) = ⋃ (i) (j), s ∩ t i j := by simp only [inter_iUnion] #align set.inter_Unionβ‚‚ Set.inter_iUnionβ‚‚ theorem iUnionβ‚‚_inter (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) (t : Set Ξ±) : (⋃ (i) (j), s i j) ∩ t = ⋃ (i) (j), s i j ∩ t := by simp_rw [iUnion_inter] #align set.Unionβ‚‚_inter Set.iUnionβ‚‚_inter theorem union_iInterβ‚‚ (s : Set Ξ±) (t : βˆ€ i, ΞΊ i β†’ Set Ξ±) : (s βˆͺ β‹‚ (i) (j), t i j) = β‹‚ (i) (j), s βˆͺ t i j := by simp_rw [union_iInter] #align set.union_Interβ‚‚ Set.union_iInterβ‚‚ theorem iInterβ‚‚_union (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) (t : Set Ξ±) : (β‹‚ (i) (j), s i j) βˆͺ t = β‹‚ (i) (j), s i j βˆͺ t := by simp_rw [iInter_union] #align set.Interβ‚‚_union Set.iInterβ‚‚_union theorem mem_sUnion_of_mem {x : Ξ±} {t : Set Ξ±} {S : Set (Set Ξ±)} (hx : x ∈ t) (ht : t ∈ S) : x ∈ ⋃₀S := ⟨t, ht, hx⟩ #align set.mem_sUnion_of_mem Set.mem_sUnion_of_mem -- is this theorem really necessary? theorem not_mem_of_not_mem_sUnion {x : Ξ±} {t : Set Ξ±} {S : Set (Set Ξ±)} (hx : x βˆ‰ ⋃₀S) (ht : t ∈ S) : x βˆ‰ t := fun h => hx ⟨t, ht, h⟩ #align set.not_mem_of_not_mem_sUnion Set.not_mem_of_not_mem_sUnion theorem sInter_subset_of_mem {S : Set (Set Ξ±)} {t : Set Ξ±} (tS : t ∈ S) : β‹‚β‚€ S βŠ† t := sInf_le tS #align set.sInter_subset_of_mem Set.sInter_subset_of_mem theorem subset_sUnion_of_mem {S : Set (Set Ξ±)} {t : Set Ξ±} (tS : t ∈ S) : t βŠ† ⋃₀S := le_sSup tS #align set.subset_sUnion_of_mem Set.subset_sUnion_of_mem theorem subset_sUnion_of_subset {s : Set Ξ±} (t : Set (Set Ξ±)) (u : Set Ξ±) (h₁ : s βŠ† u) (hβ‚‚ : u ∈ t) : s βŠ† ⋃₀t := Subset.trans h₁ (subset_sUnion_of_mem hβ‚‚) #align set.subset_sUnion_of_subset Set.subset_sUnion_of_subset theorem sUnion_subset {S : Set (Set Ξ±)} {t : Set Ξ±} (h : βˆ€ t' ∈ S, t' βŠ† t) : ⋃₀S βŠ† t := sSup_le h #align set.sUnion_subset Set.sUnion_subset @[simp] theorem sUnion_subset_iff {s : Set (Set Ξ±)} {t : Set Ξ±} : ⋃₀s βŠ† t ↔ βˆ€ t' ∈ s, t' βŠ† t := sSup_le_iff #align set.sUnion_subset_iff Set.sUnion_subset_iff lemma sUnion_mono_subsets {s : Set (Set Ξ±)} {f : Set Ξ± β†’ Set Ξ±} (hf : βˆ€ t : Set Ξ±, t βŠ† f t) : ⋃₀ s βŠ† ⋃₀ (f '' s) := fun _ ⟨t, htx, hxt⟩ ↦ ⟨f t, mem_image_of_mem f htx, hf t hxt⟩ lemma sUnion_mono_supsets {s : Set (Set Ξ±)} {f : Set Ξ± β†’ Set Ξ±} (hf : βˆ€ t : Set Ξ±, f t βŠ† t) : ⋃₀ (f '' s) βŠ† ⋃₀ s := -- If t ∈ f '' s is arbitrary; t = f u for some u : Set Ξ±. fun _ ⟨_, ⟨u, hus, hut⟩, hxt⟩ ↦ ⟨u, hus, (hut β–Έ hf u) hxt⟩ theorem subset_sInter {S : Set (Set Ξ±)} {t : Set Ξ±} (h : βˆ€ t' ∈ S, t βŠ† t') : t βŠ† β‹‚β‚€ S := le_sInf h #align set.subset_sInter Set.subset_sInter @[simp] theorem subset_sInter_iff {S : Set (Set Ξ±)} {t : Set Ξ±} : t βŠ† β‹‚β‚€ S ↔ βˆ€ t' ∈ S, t βŠ† t' := le_sInf_iff #align set.subset_sInter_iff Set.subset_sInter_iff @[gcongr] theorem sUnion_subset_sUnion {S T : Set (Set Ξ±)} (h : S βŠ† T) : ⋃₀S βŠ† ⋃₀T := sUnion_subset fun _ hs => subset_sUnion_of_mem (h hs) #align set.sUnion_subset_sUnion Set.sUnion_subset_sUnion @[gcongr] theorem sInter_subset_sInter {S T : Set (Set Ξ±)} (h : S βŠ† T) : β‹‚β‚€ T βŠ† β‹‚β‚€ S := subset_sInter fun _ hs => sInter_subset_of_mem (h hs) #align set.sInter_subset_sInter Set.sInter_subset_sInter @[simp] theorem sUnion_empty : β‹ƒβ‚€βˆ… = (βˆ… : Set Ξ±) := sSup_empty #align set.sUnion_empty Set.sUnion_empty @[simp] theorem sInter_empty : β‹‚β‚€ βˆ… = (univ : Set Ξ±) := sInf_empty #align set.sInter_empty Set.sInter_empty @[simp] theorem sUnion_singleton (s : Set Ξ±) : ⋃₀{s} = s := sSup_singleton #align set.sUnion_singleton Set.sUnion_singleton @[simp] theorem sInter_singleton (s : Set Ξ±) : β‹‚β‚€ {s} = s := sInf_singleton #align set.sInter_singleton Set.sInter_singleton @[simp] theorem sUnion_eq_empty {S : Set (Set Ξ±)} : ⋃₀S = βˆ… ↔ βˆ€ s ∈ S, s = βˆ… := sSup_eq_bot #align set.sUnion_eq_empty Set.sUnion_eq_empty @[simp] theorem sInter_eq_univ {S : Set (Set Ξ±)} : β‹‚β‚€ S = univ ↔ βˆ€ s ∈ S, s = univ := sInf_eq_top #align set.sInter_eq_univ Set.sInter_eq_univ theorem subset_powerset_iff {s : Set (Set Ξ±)} {t : Set Ξ±} : s βŠ† 𝒫 t ↔ ⋃₀ s βŠ† t := sUnion_subset_iff.symm theorem sUnion_powerset_gc : GaloisConnection (⋃₀ Β· : Set (Set Ξ±) β†’ Set Ξ±) (𝒫 Β· : Set Ξ± β†’ Set (Set Ξ±)) := gc_sSup_Iic def sUnion_powerset_gi : GaloisInsertion (⋃₀ Β· : Set (Set Ξ±) β†’ Set Ξ±) (𝒫 Β· : Set Ξ± β†’ Set (Set Ξ±)) := gi_sSup_Iic theorem sUnion_mem_empty_univ {S : Set (Set Ξ±)} (h : S βŠ† {βˆ…, univ}) : ⋃₀ S ∈ ({βˆ…, univ} : Set (Set Ξ±)) := by simp only [mem_insert_iff, mem_singleton_iff, or_iff_not_imp_left, sUnion_eq_empty, not_forall] rintro ⟨s, hs, hne⟩ obtain rfl : s = univ := (h hs).resolve_left hne exact univ_subset_iff.1 <| subset_sUnion_of_mem hs @[simp] theorem nonempty_sUnion {S : Set (Set Ξ±)} : (⋃₀S).Nonempty ↔ βˆƒ s ∈ S, Set.Nonempty s := by simp [nonempty_iff_ne_empty] #align set.nonempty_sUnion Set.nonempty_sUnion theorem Nonempty.of_sUnion {s : Set (Set Ξ±)} (h : (⋃₀s).Nonempty) : s.Nonempty := let ⟨s, hs, _⟩ := nonempty_sUnion.1 h ⟨s, hs⟩ #align set.nonempty.of_sUnion Set.Nonempty.of_sUnion theorem Nonempty.of_sUnion_eq_univ [Nonempty Ξ±] {s : Set (Set Ξ±)} (h : ⋃₀s = univ) : s.Nonempty := Nonempty.of_sUnion <| h.symm β–Έ univ_nonempty #align set.nonempty.of_sUnion_eq_univ Set.Nonempty.of_sUnion_eq_univ theorem sUnion_union (S T : Set (Set Ξ±)) : ⋃₀(S βˆͺ T) = ⋃₀S βˆͺ ⋃₀T := sSup_union #align set.sUnion_union Set.sUnion_union theorem sInter_union (S T : Set (Set Ξ±)) : β‹‚β‚€ (S βˆͺ T) = β‹‚β‚€ S ∩ β‹‚β‚€ T := sInf_union #align set.sInter_union Set.sInter_union @[simp] theorem sUnion_insert (s : Set Ξ±) (T : Set (Set Ξ±)) : ⋃₀insert s T = s βˆͺ ⋃₀T := sSup_insert #align set.sUnion_insert Set.sUnion_insert @[simp] theorem sInter_insert (s : Set Ξ±) (T : Set (Set Ξ±)) : β‹‚β‚€ insert s T = s ∩ β‹‚β‚€ T := sInf_insert #align set.sInter_insert Set.sInter_insert @[simp] theorem sUnion_diff_singleton_empty (s : Set (Set Ξ±)) : ⋃₀(s \ {βˆ…}) = ⋃₀s := sSup_diff_singleton_bot s #align set.sUnion_diff_singleton_empty Set.sUnion_diff_singleton_empty @[simp] theorem sInter_diff_singleton_univ (s : Set (Set Ξ±)) : β‹‚β‚€ (s \ {univ}) = β‹‚β‚€ s := sInf_diff_singleton_top s #align set.sInter_diff_singleton_univ Set.sInter_diff_singleton_univ theorem sUnion_pair (s t : Set Ξ±) : ⋃₀{s, t} = s βˆͺ t := sSup_pair #align set.sUnion_pair Set.sUnion_pair theorem sInter_pair (s t : Set Ξ±) : β‹‚β‚€ {s, t} = s ∩ t := sInf_pair #align set.sInter_pair Set.sInter_pair @[simp] theorem sUnion_image (f : Ξ± β†’ Set Ξ²) (s : Set Ξ±) : ⋃₀(f '' s) = ⋃ x ∈ s, f x := sSup_image #align set.sUnion_image Set.sUnion_image @[simp] theorem sInter_image (f : Ξ± β†’ Set Ξ²) (s : Set Ξ±) : β‹‚β‚€ (f '' s) = β‹‚ x ∈ s, f x := sInf_image #align set.sInter_image Set.sInter_image @[simp] theorem sUnion_range (f : ΞΉ β†’ Set Ξ²) : ⋃₀range f = ⋃ x, f x := rfl #align set.sUnion_range Set.sUnion_range @[simp] theorem sInter_range (f : ΞΉ β†’ Set Ξ²) : β‹‚β‚€ range f = β‹‚ x, f x := rfl #align set.sInter_range Set.sInter_range theorem iUnion_eq_univ_iff {f : ΞΉ β†’ Set Ξ±} : ⋃ i, f i = univ ↔ βˆ€ x, βˆƒ i, x ∈ f i := by simp only [eq_univ_iff_forall, mem_iUnion] #align set.Union_eq_univ_iff Set.iUnion_eq_univ_iff theorem iUnionβ‚‚_eq_univ_iff {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} : ⋃ (i) (j), s i j = univ ↔ βˆ€ a, βˆƒ i j, a ∈ s i j := by simp only [iUnion_eq_univ_iff, mem_iUnion] #align set.Unionβ‚‚_eq_univ_iff Set.iUnionβ‚‚_eq_univ_iff theorem sUnion_eq_univ_iff {c : Set (Set Ξ±)} : ⋃₀c = univ ↔ βˆ€ a, βˆƒ b ∈ c, a ∈ b := by simp only [eq_univ_iff_forall, mem_sUnion] #align set.sUnion_eq_univ_iff Set.sUnion_eq_univ_iff -- classical theorem iInter_eq_empty_iff {f : ΞΉ β†’ Set Ξ±} : β‹‚ i, f i = βˆ… ↔ βˆ€ x, βˆƒ i, x βˆ‰ f i := by simp [Set.eq_empty_iff_forall_not_mem] #align set.Inter_eq_empty_iff Set.iInter_eq_empty_iff -- classical theorem iInterβ‚‚_eq_empty_iff {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} : β‹‚ (i) (j), s i j = βˆ… ↔ βˆ€ a, βˆƒ i j, a βˆ‰ s i j := by simp only [eq_empty_iff_forall_not_mem, mem_iInter, not_forall] #align set.Interβ‚‚_eq_empty_iff Set.iInterβ‚‚_eq_empty_iff -- classical theorem sInter_eq_empty_iff {c : Set (Set Ξ±)} : β‹‚β‚€ c = βˆ… ↔ βˆ€ a, βˆƒ b ∈ c, a βˆ‰ b := by simp [Set.eq_empty_iff_forall_not_mem] #align set.sInter_eq_empty_iff Set.sInter_eq_empty_iff -- classical @[simp] theorem nonempty_iInter {f : ΞΉ β†’ Set Ξ±} : (β‹‚ i, f i).Nonempty ↔ βˆƒ x, βˆ€ i, x ∈ f i := by simp [nonempty_iff_ne_empty, iInter_eq_empty_iff] #align set.nonempty_Inter Set.nonempty_iInter -- classical -- Porting note (#10618): removing `simp`. `simp` can prove it theorem nonempty_iInterβ‚‚ {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} : (β‹‚ (i) (j), s i j).Nonempty ↔ βˆƒ a, βˆ€ i j, a ∈ s i j := by simp #align set.nonempty_Interβ‚‚ Set.nonempty_iInterβ‚‚ -- classical @[simp] theorem nonempty_sInter {c : Set (Set Ξ±)} : (β‹‚β‚€ c).Nonempty ↔ βˆƒ a, βˆ€ b ∈ c, a ∈ b := by simp [nonempty_iff_ne_empty, sInter_eq_empty_iff] #align set.nonempty_sInter Set.nonempty_sInter -- classical theorem compl_sUnion (S : Set (Set Ξ±)) : (⋃₀S)ᢜ = β‹‚β‚€ (compl '' S) := ext fun x => by simp #align set.compl_sUnion Set.compl_sUnion -- classical theorem sUnion_eq_compl_sInter_compl (S : Set (Set Ξ±)) : ⋃₀S = (β‹‚β‚€ (compl '' S))ᢜ := by rw [← compl_compl (⋃₀S), compl_sUnion] #align set.sUnion_eq_compl_sInter_compl Set.sUnion_eq_compl_sInter_compl -- classical theorem compl_sInter (S : Set (Set Ξ±)) : (β‹‚β‚€ S)ᢜ = ⋃₀(compl '' S) := by rw [sUnion_eq_compl_sInter_compl, compl_compl_image] #align set.compl_sInter Set.compl_sInter -- classical theorem sInter_eq_compl_sUnion_compl (S : Set (Set Ξ±)) : β‹‚β‚€ S = (⋃₀(compl '' S))ᢜ := by rw [← compl_compl (β‹‚β‚€ S), compl_sInter] #align set.sInter_eq_compl_sUnion_compl Set.sInter_eq_compl_sUnion_compl theorem inter_empty_of_inter_sUnion_empty {s t : Set Ξ±} {S : Set (Set Ξ±)} (hs : t ∈ S) (h : s ∩ ⋃₀S = βˆ…) : s ∩ t = βˆ… := eq_empty_of_subset_empty <| by rw [← h]; exact inter_subset_inter_right _ (subset_sUnion_of_mem hs) #align set.inter_empty_of_inter_sUnion_empty Set.inter_empty_of_inter_sUnion_empty theorem range_sigma_eq_iUnion_range {Ξ³ : Ξ± β†’ Type*} (f : Sigma Ξ³ β†’ Ξ²) : range f = ⋃ a, range fun b => f ⟨a, b⟩ := Set.ext <| by simp #align set.range_sigma_eq_Union_range Set.range_sigma_eq_iUnion_range theorem iUnion_eq_range_sigma (s : Ξ± β†’ Set Ξ²) : ⋃ i, s i = range fun a : Ξ£i, s i => a.2 := by simp [Set.ext_iff] #align set.Union_eq_range_sigma Set.iUnion_eq_range_sigma theorem iUnion_eq_range_psigma (s : ΞΉ β†’ Set Ξ²) : ⋃ i, s i = range fun a : Ξ£'i, s i => a.2 := by simp [Set.ext_iff] #align set.Union_eq_range_psigma Set.iUnion_eq_range_psigma theorem iUnion_image_preimage_sigma_mk_eq_self {ΞΉ : Type*} {Οƒ : ΞΉ β†’ Type*} (s : Set (Sigma Οƒ)) : ⋃ i, Sigma.mk i '' (Sigma.mk i ⁻¹' s) = s := by ext x simp only [mem_iUnion, mem_image, mem_preimage] constructor Β· rintro ⟨i, a, h, rfl⟩ exact h Β· intro h cases' x with i a exact ⟨i, a, h, rfl⟩ #align set.Union_image_preimage_sigma_mk_eq_self Set.iUnion_image_preimage_sigma_mk_eq_self theorem Sigma.univ (X : Ξ± β†’ Type*) : (Set.univ : Set (Ξ£a, X a)) = ⋃ a, range (Sigma.mk a) := Set.ext fun x => iff_of_true trivial ⟨range (Sigma.mk x.1), Set.mem_range_self _, x.2, Sigma.eta x⟩ #align set.sigma.univ Set.Sigma.univ alias sUnion_mono := sUnion_subset_sUnion #align set.sUnion_mono Set.sUnion_mono theorem iUnion_subset_iUnion_const {s : Set Ξ±} (h : ΞΉ β†’ ΞΉβ‚‚) : ⋃ _ : ΞΉ, s βŠ† ⋃ _ : ΞΉβ‚‚, s := iSup_const_mono (Ξ± := Set Ξ±) h #align set.Union_subset_Union_const Set.iUnion_subset_iUnion_const @[simp] theorem iUnion_singleton_eq_range {Ξ± Ξ² : Type*} (f : Ξ± β†’ Ξ²) : ⋃ x : Ξ±, {f x} = range f := by ext x simp [@eq_comm _ x] #align set.Union_singleton_eq_range Set.iUnion_singleton_eq_range theorem iUnion_of_singleton (Ξ± : Type*) : (⋃ x, {x} : Set Ξ±) = univ := by simp [Set.ext_iff] #align set.Union_of_singleton Set.iUnion_of_singleton theorem iUnion_of_singleton_coe (s : Set Ξ±) : ⋃ i : s, ({(i : Ξ±)} : Set Ξ±) = s := by simp #align set.Union_of_singleton_coe Set.iUnion_of_singleton_coe theorem sUnion_eq_biUnion {s : Set (Set Ξ±)} : ⋃₀s = ⋃ (i : Set Ξ±) (_ : i ∈ s), i := by rw [← sUnion_image, image_id'] #align set.sUnion_eq_bUnion Set.sUnion_eq_biUnion theorem sInter_eq_biInter {s : Set (Set Ξ±)} : β‹‚β‚€ s = β‹‚ (i : Set Ξ±) (_ : i ∈ s), i := by rw [← sInter_image, image_id'] #align set.sInter_eq_bInter Set.sInter_eq_biInter theorem sUnion_eq_iUnion {s : Set (Set Ξ±)} : ⋃₀s = ⋃ i : s, i := by simp only [← sUnion_range, Subtype.range_coe] #align set.sUnion_eq_Union Set.sUnion_eq_iUnion theorem sInter_eq_iInter {s : Set (Set Ξ±)} : β‹‚β‚€ s = β‹‚ i : s, i := by simp only [← sInter_range, Subtype.range_coe] #align set.sInter_eq_Inter Set.sInter_eq_iInter @[simp] theorem iUnion_of_empty [IsEmpty ΞΉ] (s : ΞΉ β†’ Set Ξ±) : ⋃ i, s i = βˆ… := iSup_of_empty _ #align set.Union_of_empty Set.iUnion_of_empty @[simp] theorem iInter_of_empty [IsEmpty ΞΉ] (s : ΞΉ β†’ Set Ξ±) : β‹‚ i, s i = univ := iInf_of_empty _ #align set.Inter_of_empty Set.iInter_of_empty theorem union_eq_iUnion {s₁ sβ‚‚ : Set Ξ±} : s₁ βˆͺ sβ‚‚ = ⋃ b : Bool, cond b s₁ sβ‚‚ := sup_eq_iSup s₁ sβ‚‚ #align set.union_eq_Union Set.union_eq_iUnion theorem inter_eq_iInter {s₁ sβ‚‚ : Set Ξ±} : s₁ ∩ sβ‚‚ = β‹‚ b : Bool, cond b s₁ sβ‚‚ := inf_eq_iInf s₁ sβ‚‚ #align set.inter_eq_Inter Set.inter_eq_iInter theorem sInter_union_sInter {S T : Set (Set Ξ±)} : β‹‚β‚€ S βˆͺ β‹‚β‚€ T = β‹‚ p ∈ S Γ—Λ’ T, (p : Set Ξ± Γ— Set Ξ±).1 βˆͺ p.2 := sInf_sup_sInf #align set.sInter_union_sInter Set.sInter_union_sInter theorem sUnion_inter_sUnion {s t : Set (Set Ξ±)} : ⋃₀s ∩ ⋃₀t = ⋃ p ∈ s Γ—Λ’ t, (p : Set Ξ± Γ— Set Ξ±).1 ∩ p.2 := sSup_inf_sSup #align set.sUnion_inter_sUnion Set.sUnion_inter_sUnion theorem biUnion_iUnion (s : ΞΉ β†’ Set Ξ±) (t : Ξ± β†’ Set Ξ²) : ⋃ x ∈ ⋃ i, s i, t x = ⋃ (i) (x ∈ s i), t x := by simp [@iUnion_comm _ ΞΉ] #align set.bUnion_Union Set.biUnion_iUnion theorem biInter_iUnion (s : ΞΉ β†’ Set Ξ±) (t : Ξ± β†’ Set Ξ²) : β‹‚ x ∈ ⋃ i, s i, t x = β‹‚ (i) (x ∈ s i), t x := by simp [@iInter_comm _ ΞΉ] #align set.bInter_Union Set.biInter_iUnion theorem sUnion_iUnion (s : ΞΉ β†’ Set (Set Ξ±)) : ⋃₀⋃ i, s i = ⋃ i, ⋃₀s i := by simp only [sUnion_eq_biUnion, biUnion_iUnion] #align set.sUnion_Union Set.sUnion_iUnion theorem sInter_iUnion (s : ΞΉ β†’ Set (Set Ξ±)) : β‹‚β‚€ ⋃ i, s i = β‹‚ i, β‹‚β‚€ s i := by simp only [sInter_eq_biInter, biInter_iUnion] #align set.sInter_Union Set.sInter_iUnion theorem iUnion_range_eq_sUnion {Ξ± Ξ² : Type*} (C : Set (Set Ξ±)) {f : βˆ€ s : C, Ξ² β†’ (s : Type _)} (hf : βˆ€ s : C, Surjective (f s)) : ⋃ y : Ξ², range (fun s : C => (f s y).val) = ⋃₀C := by ext x; constructor Β· rintro ⟨s, ⟨y, rfl⟩, ⟨s, hs⟩, rfl⟩ refine ⟨_, hs, ?_⟩ exact (f ⟨s, hs⟩ y).2 Β· rintro ⟨s, hs, hx⟩ cases' hf ⟨s, hs⟩ ⟨x, hx⟩ with y hy refine ⟨_, ⟨y, rfl⟩, ⟨s, hs⟩, ?_⟩ exact congr_arg Subtype.val hy #align set.Union_range_eq_sUnion Set.iUnion_range_eq_sUnion theorem iUnion_range_eq_iUnion (C : ΞΉ β†’ Set Ξ±) {f : βˆ€ x : ΞΉ, Ξ² β†’ C x} (hf : βˆ€ x : ΞΉ, Surjective (f x)) : ⋃ y : Ξ², range (fun x : ΞΉ => (f x y).val) = ⋃ x, C x := by ext x; rw [mem_iUnion, mem_iUnion]; constructor Β· rintro ⟨y, i, rfl⟩ exact ⟨i, (f i y).2⟩ Β· rintro ⟨i, hx⟩ cases' hf i ⟨x, hx⟩ with y hy exact ⟨y, i, congr_arg Subtype.val hy⟩ #align set.Union_range_eq_Union Set.iUnion_range_eq_iUnion theorem union_distrib_iInter_left (s : ΞΉ β†’ Set Ξ±) (t : Set Ξ±) : (t βˆͺ β‹‚ i, s i) = β‹‚ i, t βˆͺ s i := sup_iInf_eq _ _ #align set.union_distrib_Inter_left Set.union_distrib_iInter_left theorem union_distrib_iInterβ‚‚_left (s : Set Ξ±) (t : βˆ€ i, ΞΊ i β†’ Set Ξ±) : (s βˆͺ β‹‚ (i) (j), t i j) = β‹‚ (i) (j), s βˆͺ t i j := by simp_rw [union_distrib_iInter_left] #align set.union_distrib_Interβ‚‚_left Set.union_distrib_iInterβ‚‚_left theorem union_distrib_iInter_right (s : ΞΉ β†’ Set Ξ±) (t : Set Ξ±) : (β‹‚ i, s i) βˆͺ t = β‹‚ i, s i βˆͺ t := iInf_sup_eq _ _ #align set.union_distrib_Inter_right Set.union_distrib_iInter_right theorem union_distrib_iInterβ‚‚_right (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) (t : Set Ξ±) : (β‹‚ (i) (j), s i j) βˆͺ t = β‹‚ (i) (j), s i j βˆͺ t := by simp_rw [union_distrib_iInter_right] #align set.union_distrib_Interβ‚‚_right Set.union_distrib_iInterβ‚‚_right section Function @[simp] theorem mapsTo_sUnion {S : Set (Set Ξ±)} {t : Set Ξ²} {f : Ξ± β†’ Ξ²} : MapsTo f (⋃₀ S) t ↔ βˆ€ s ∈ S, MapsTo f s t := sUnion_subset_iff #align set.maps_to_sUnion Set.mapsTo_sUnion @[simp] theorem mapsTo_iUnion {s : ΞΉ β†’ Set Ξ±} {t : Set Ξ²} {f : Ξ± β†’ Ξ²} : MapsTo f (⋃ i, s i) t ↔ βˆ€ i, MapsTo f (s i) t := iUnion_subset_iff #align set.maps_to_Union Set.mapsTo_iUnion theorem mapsTo_iUnionβ‚‚ {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : Set Ξ²} {f : Ξ± β†’ Ξ²} : MapsTo f (⋃ (i) (j), s i j) t ↔ βˆ€ i j, MapsTo f (s i j) t := iUnionβ‚‚_subset_iff #align set.maps_to_Unionβ‚‚ Set.mapsTo_iUnionβ‚‚ theorem mapsTo_iUnion_iUnion {s : ΞΉ β†’ Set Ξ±} {t : ΞΉ β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} (H : βˆ€ i, MapsTo f (s i) (t i)) : MapsTo f (⋃ i, s i) (⋃ i, t i) := mapsTo_iUnion.2 fun i ↦ (H i).mono_right (subset_iUnion t i) #align set.maps_to_Union_Union Set.mapsTo_iUnion_iUnion theorem mapsTo_iUnionβ‚‚_iUnionβ‚‚ {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} (H : βˆ€ i j, MapsTo f (s i j) (t i j)) : MapsTo f (⋃ (i) (j), s i j) (⋃ (i) (j), t i j) := mapsTo_iUnion_iUnion fun i => mapsTo_iUnion_iUnion (H i) #align set.maps_to_Unionβ‚‚_Unionβ‚‚ Set.mapsTo_iUnionβ‚‚_iUnionβ‚‚ @[simp] theorem mapsTo_sInter {s : Set Ξ±} {T : Set (Set Ξ²)} {f : Ξ± β†’ Ξ²} : MapsTo f s (β‹‚β‚€ T) ↔ βˆ€ t ∈ T, MapsTo f s t := forallβ‚‚_swap #align set.maps_to_sInter Set.mapsTo_sInter @[simp] theorem mapsTo_iInter {s : Set Ξ±} {t : ΞΉ β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} : MapsTo f s (β‹‚ i, t i) ↔ βˆ€ i, MapsTo f s (t i) := mapsTo_sInter.trans forall_mem_range #align set.maps_to_Inter Set.mapsTo_iInter theorem mapsTo_iInterβ‚‚ {s : Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} : MapsTo f s (β‹‚ (i) (j), t i j) ↔ βˆ€ i j, MapsTo f s (t i j) := by simp only [mapsTo_iInter] #align set.maps_to_Interβ‚‚ Set.mapsTo_iInterβ‚‚ theorem mapsTo_iInter_iInter {s : ΞΉ β†’ Set Ξ±} {t : ΞΉ β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} (H : βˆ€ i, MapsTo f (s i) (t i)) : MapsTo f (β‹‚ i, s i) (β‹‚ i, t i) := mapsTo_iInter.2 fun i => (H i).mono_left (iInter_subset s i) #align set.maps_to_Inter_Inter Set.mapsTo_iInter_iInter theorem mapsTo_iInterβ‚‚_iInterβ‚‚ {s : βˆ€ i, ΞΊ i β†’ Set Ξ±} {t : βˆ€ i, ΞΊ i β†’ Set Ξ²} {f : Ξ± β†’ Ξ²} (H : βˆ€ i j, MapsTo f (s i j) (t i j)) : MapsTo f (β‹‚ (i) (j), s i j) (β‹‚ (i) (j), t i j) := mapsTo_iInter_iInter fun i => mapsTo_iInter_iInter (H i) #align set.maps_to_Interβ‚‚_Interβ‚‚ Set.mapsTo_iInterβ‚‚_iInterβ‚‚ theorem image_iInter_subset (s : ΞΉ β†’ Set Ξ±) (f : Ξ± β†’ Ξ²) : (f '' β‹‚ i, s i) βŠ† β‹‚ i, f '' s i := (mapsTo_iInter_iInter fun i => mapsTo_image f (s i)).image_subset #align set.image_Inter_subset Set.image_iInter_subset theorem image_iInterβ‚‚_subset (s : βˆ€ i, ΞΊ i β†’ Set Ξ±) (f : Ξ± β†’ Ξ²) : (f '' β‹‚ (i) (j), s i j) βŠ† β‹‚ (i) (j), f '' s i j := (mapsTo_iInterβ‚‚_iInterβ‚‚ fun i hi => mapsTo_image f (s i hi)).image_subset #align set.image_Interβ‚‚_subset Set.image_iInterβ‚‚_subset theorem image_sInter_subset (S : Set (Set Ξ±)) (f : Ξ± β†’ Ξ²) : f '' β‹‚β‚€ S βŠ† β‹‚ s ∈ S, f '' s := by rw [sInter_eq_biInter] apply image_iInterβ‚‚_subset #align set.image_sInter_subset Set.image_sInter_subset section open Function variable (s : Set Ξ²) {f : Ξ± β†’ Ξ²} {U : ΞΉ β†’ Set Ξ²} (hU : iUnion U = univ)
Mathlib/Data/Set/Lattice.lean
1,498
1,503
theorem injective_iff_injective_of_iUnion_eq_univ : Injective f ↔ βˆ€ i, Injective ((U i).restrictPreimage f) := by
refine ⟨fun H i => (U i).restrictPreimage_injective H, fun H x y e => ?_⟩ obtain ⟨i, hi⟩ := Set.mem_iUnion.mp (show f x ∈ Set.iUnion U by rw [hU]; trivial) injection @H i ⟨x, hi⟩ ⟨y, show f y ∈ U i from e β–Έ hi⟩ (Subtype.ext e)
import Mathlib.MeasureTheory.Function.SimpleFunc import Mathlib.MeasureTheory.Constructions.BorelSpace.Metrizable #align_import measure_theory.function.simple_func_dense from "leanprover-community/mathlib"@"7317149f12f55affbc900fc873d0d422485122b9" open Set Function Filter TopologicalSpace ENNReal EMetric Finset open scoped Classical open Topology ENNReal MeasureTheory variable {Ξ± Ξ² ΞΉ E F π•œ : Type*} noncomputable section namespace MeasureTheory local infixr:25 " β†’β‚› " => SimpleFunc namespace SimpleFunc variable [MeasurableSpace Ξ±] [PseudoEMetricSpace Ξ±] [OpensMeasurableSpace Ξ±] noncomputable def nearestPtInd (e : β„• β†’ Ξ±) : β„• β†’ Ξ± β†’β‚› β„• | 0 => const Ξ± 0 | N + 1 => piecewise (β‹‚ k ≀ N, { x | edist (e (N + 1)) x < edist (e k) x }) (MeasurableSet.iInter fun _ => MeasurableSet.iInter fun _ => measurableSet_lt measurable_edist_right measurable_edist_right) (const Ξ± <| N + 1) (nearestPtInd e N) #align measure_theory.simple_func.nearest_pt_ind MeasureTheory.SimpleFunc.nearestPtInd noncomputable def nearestPt (e : β„• β†’ Ξ±) (N : β„•) : Ξ± β†’β‚› Ξ± := (nearestPtInd e N).map e #align measure_theory.simple_func.nearest_pt MeasureTheory.SimpleFunc.nearestPt @[simp] theorem nearestPtInd_zero (e : β„• β†’ Ξ±) : nearestPtInd e 0 = const Ξ± 0 := rfl #align measure_theory.simple_func.nearest_pt_ind_zero MeasureTheory.SimpleFunc.nearestPtInd_zero @[simp] theorem nearestPt_zero (e : β„• β†’ Ξ±) : nearestPt e 0 = const Ξ± (e 0) := rfl #align measure_theory.simple_func.nearest_pt_zero MeasureTheory.SimpleFunc.nearestPt_zero theorem nearestPtInd_succ (e : β„• β†’ Ξ±) (N : β„•) (x : Ξ±) : nearestPtInd e (N + 1) x = if βˆ€ k ≀ N, edist (e (N + 1)) x < edist (e k) x then N + 1 else nearestPtInd e N x := by simp only [nearestPtInd, coe_piecewise, Set.piecewise] congr simp #align measure_theory.simple_func.nearest_pt_ind_succ MeasureTheory.SimpleFunc.nearestPtInd_succ theorem nearestPtInd_le (e : β„• β†’ Ξ±) (N : β„•) (x : Ξ±) : nearestPtInd e N x ≀ N := by induction' N with N ihN; Β· simp simp only [nearestPtInd_succ] split_ifs exacts [le_rfl, ihN.trans N.le_succ] #align measure_theory.simple_func.nearest_pt_ind_le MeasureTheory.SimpleFunc.nearestPtInd_le theorem edist_nearestPt_le (e : β„• β†’ Ξ±) (x : Ξ±) {k N : β„•} (hk : k ≀ N) : edist (nearestPt e N x) x ≀ edist (e k) x := by induction' N with N ihN generalizing k Β· simp [nonpos_iff_eq_zero.1 hk, le_refl] Β· simp only [nearestPt, nearestPtInd_succ, map_apply] split_ifs with h Β· rcases hk.eq_or_lt with (rfl | hk) exacts [le_rfl, (h k (Nat.lt_succ_iff.1 hk)).le] Β· push_neg at h rcases h with ⟨l, hlN, hxl⟩ rcases hk.eq_or_lt with (rfl | hk) exacts [(ihN hlN).trans hxl, ihN (Nat.lt_succ_iff.1 hk)] #align measure_theory.simple_func.edist_nearest_pt_le MeasureTheory.SimpleFunc.edist_nearestPt_le theorem tendsto_nearestPt {e : β„• β†’ Ξ±} {x : Ξ±} (hx : x ∈ closure (range e)) : Tendsto (fun N => nearestPt e N x) atTop (𝓝 x) := by refine (atTop_basis.tendsto_iff nhds_basis_eball).2 fun Ξ΅ hΞ΅ => ?_ rcases EMetric.mem_closure_iff.1 hx Ξ΅ hΞ΅ with ⟨_, ⟨N, rfl⟩, hN⟩ rw [edist_comm] at hN exact ⟨N, trivial, fun n hn => (edist_nearestPt_le e x hn).trans_lt hN⟩ #align measure_theory.simple_func.tendsto_nearest_pt MeasureTheory.SimpleFunc.tendsto_nearestPt variable [MeasurableSpace Ξ²] {f : Ξ² β†’ Ξ±} noncomputable def approxOn (f : Ξ² β†’ Ξ±) (hf : Measurable f) (s : Set Ξ±) (yβ‚€ : Ξ±) (hβ‚€ : yβ‚€ ∈ s) [SeparableSpace s] (n : β„•) : Ξ² β†’β‚› Ξ± := haveI : Nonempty s := ⟨⟨yβ‚€, hβ‚€βŸ©βŸ© comp (nearestPt (fun k => Nat.casesOn k yβ‚€ ((↑) ∘ denseSeq s) : β„• β†’ Ξ±) n) f hf #align measure_theory.simple_func.approx_on MeasureTheory.SimpleFunc.approxOn @[simp] theorem approxOn_zero {f : Ξ² β†’ Ξ±} (hf : Measurable f) {s : Set Ξ±} {yβ‚€ : Ξ±} (hβ‚€ : yβ‚€ ∈ s) [SeparableSpace s] (x : Ξ²) : approxOn f hf s yβ‚€ hβ‚€ 0 x = yβ‚€ := rfl #align measure_theory.simple_func.approx_on_zero MeasureTheory.SimpleFunc.approxOn_zero
Mathlib/MeasureTheory/Function/SimpleFuncDense.lean
140
145
theorem approxOn_mem {f : Ξ² β†’ Ξ±} (hf : Measurable f) {s : Set Ξ±} {yβ‚€ : Ξ±} (hβ‚€ : yβ‚€ ∈ s) [SeparableSpace s] (n : β„•) (x : Ξ²) : approxOn f hf s yβ‚€ hβ‚€ n x ∈ s := by
haveI : Nonempty s := ⟨⟨yβ‚€, hβ‚€βŸ©βŸ© suffices βˆ€ n, (Nat.casesOn n yβ‚€ ((↑) ∘ denseSeq s) : Ξ±) ∈ s by apply this rintro (_ | n) exacts [hβ‚€, Subtype.mem _]
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section iInf variable {ΞΉ : Sort*} {f g : ΞΉ β†’ ℝβ‰₯0∞} variable {a b c d : ℝβ‰₯0∞} {r p q : ℝβ‰₯0} theorem toNNReal_iInf (hf : βˆ€ i, f i β‰  ∞) : (iInf f).toNNReal = β¨… i, (f i).toNNReal := by cases isEmpty_or_nonempty ΞΉ Β· rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty] Β· lift f to ΞΉ β†’ ℝβ‰₯0 using hf simp_rw [← coe_iInf, toNNReal_coe] #align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf theorem toNNReal_sInf (s : Set ℝβ‰₯0∞) (hs : βˆ€ r ∈ s, r β‰  ∞) : (sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by have hf : βˆ€ i, ((↑) : s β†’ ℝβ‰₯0∞) i β‰  ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf) #align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf theorem toNNReal_iSup (hf : βˆ€ i, f i β‰  ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by lift f to ΞΉ β†’ ℝβ‰₯0 using hf simp_rw [toNNReal_coe] by_cases h : BddAbove (range f) Β· rw [← coe_iSup h, toNNReal_coe] Β· rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal] #align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup theorem toNNReal_sSup (s : Set ℝβ‰₯0∞) (hs : βˆ€ r ∈ s, r β‰  ∞) : (sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by have hf : βˆ€ i, ((↑) : s β†’ ℝβ‰₯0∞) i β‰  ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf) #align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup theorem toReal_iInf (hf : βˆ€ i, f i β‰  ∞) : (iInf f).toReal = β¨… i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf] #align ennreal.to_real_infi ENNReal.toReal_iInf theorem toReal_sInf (s : Set ℝβ‰₯0∞) (hf : βˆ€ r ∈ s, r β‰  ∞) : (sInf s).toReal = sInf (ENNReal.toReal '' s) := by simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image] #align ennreal.to_real_Inf ENNReal.toReal_sInf theorem toReal_iSup (hf : βˆ€ i, f i β‰  ∞) : (iSup f).toReal = ⨆ i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iSup hf, NNReal.coe_iSup] #align ennreal.to_real_supr ENNReal.toReal_iSup theorem toReal_sSup (s : Set ℝβ‰₯0∞) (hf : βˆ€ r ∈ s, r β‰  ∞) : (sSup s).toReal = sSup (ENNReal.toReal '' s) := by simp only [ENNReal.toReal, toNNReal_sSup s hf, NNReal.coe_sSup, Set.image_image] #align ennreal.to_real_Sup ENNReal.toReal_sSup theorem iInf_add : iInf f + a = β¨… i, f i + a := le_antisymm (le_iInf fun _ => add_le_add (iInf_le _ _) <| le_rfl) (tsub_le_iff_right.1 <| le_iInf fun _ => tsub_le_iff_right.2 <| iInf_le _ _) #align ennreal.infi_add ENNReal.iInf_add theorem iSup_sub : (⨆ i, f i) - a = ⨆ i, f i - a := le_antisymm (tsub_le_iff_right.2 <| iSup_le fun i => tsub_le_iff_right.1 <| le_iSup (f Β· - a) i) (iSup_le fun _ => tsub_le_tsub (le_iSup _ _) (le_refl a)) #align ennreal.supr_sub ENNReal.iSup_sub
Mathlib/Data/ENNReal/Real.lean
600
603
theorem sub_iInf : (a - β¨… i, f i) = ⨆ i, a - f i := by
refine eq_of_forall_ge_iff fun c => ?_ rw [tsub_le_iff_right, add_comm, iInf_add] simp [tsub_le_iff_right, sub_eq_add_neg, add_comm]
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.List.Perm import Mathlib.Data.List.Range #align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6" universe u v w variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} open Nat namespace List @[simp] theorem sublists'_nil : sublists' (@nil Ξ±) = [[]] := rfl #align list.sublists'_nil List.sublists'_nil @[simp] theorem sublists'_singleton (a : Ξ±) : sublists' [a] = [[], [a]] := rfl #align list.sublists'_singleton List.sublists'_singleton #noalign list.map_sublists'_aux #noalign list.sublists'_aux_append #noalign list.sublists'_aux_eq_sublists' -- Porting note: Not the same as `sublists'_aux` from Lean3 def sublists'Aux (a : Ξ±) (r₁ rβ‚‚ : List (List Ξ±)) : List (List Ξ±) := r₁.foldl (init := rβ‚‚) fun r l => r ++ [a :: l] #align list.sublists'_aux List.sublists'Aux theorem sublists'Aux_eq_array_foldl (a : Ξ±) : βˆ€ (r₁ rβ‚‚ : List (List Ξ±)), sublists'Aux a r₁ rβ‚‚ = ((r₁.toArray).foldl (init := rβ‚‚.toArray) (fun r l => r.push (a :: l))).toList := by intro r₁ rβ‚‚ rw [sublists'Aux, Array.foldl_eq_foldl_data] have := List.foldl_hom Array.toList (fun r l => r.push (a :: l)) (fun r l => r ++ [a :: l]) r₁ rβ‚‚.toArray (by simp) simpa using this theorem sublists'_eq_sublists'Aux (l : List Ξ±) : sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by simp only [sublists', sublists'Aux_eq_array_foldl] rw [← List.foldr_hom Array.toList] Β· rfl Β· intros _ _; congr <;> simp theorem sublists'Aux_eq_map (a : Ξ±) (r₁ : List (List Ξ±)) : βˆ€ (rβ‚‚ : List (List Ξ±)), sublists'Aux a r₁ rβ‚‚ = rβ‚‚ ++ map (cons a) r₁ := List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih rβ‚‚ => by rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl] simp [sublists'Aux] -- Porting note: simp can prove `sublists'_singleton` @[simp 900] theorem sublists'_cons (a : Ξ±) (l : List Ξ±) : sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) := by simp [sublists'_eq_sublists'Aux, foldr_cons, sublists'Aux_eq_map] #align list.sublists'_cons List.sublists'_cons @[simp] theorem mem_sublists' {s t : List Ξ±} : s ∈ sublists' t ↔ s <+ t := by induction' t with a t IH generalizing s Β· simp only [sublists'_nil, mem_singleton] exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩ simp only [sublists'_cons, mem_append, IH, mem_map] constructor <;> intro h Β· rcases h with (h | ⟨s, h, rfl⟩) Β· exact sublist_cons_of_sublist _ h Β· exact h.cons_cons _ Β· cases' h with _ _ _ h s _ _ h Β· exact Or.inl h Β· exact Or.inr ⟨s, h, rfl⟩ #align list.mem_sublists' List.mem_sublists' @[simp] theorem length_sublists' : βˆ€ l : List Ξ±, length (sublists' l) = 2 ^ length l | [] => rfl | a :: l => by simp_arith only [sublists'_cons, length_append, length_sublists' l, length_map, length, Nat.pow_succ'] #align list.length_sublists' List.length_sublists' @[simp] theorem sublists_nil : sublists (@nil Ξ±) = [[]] := rfl #align list.sublists_nil List.sublists_nil @[simp] theorem sublists_singleton (a : Ξ±) : sublists [a] = [[], [a]] := rfl #align list.sublists_singleton List.sublists_singleton -- Porting note: Not the same as `sublists_aux` from Lean3 def sublistsAux (a : Ξ±) (r : List (List Ξ±)) : List (List Ξ±) := r.foldl (init := []) fun r l => r ++ [l, a :: l] #align list.sublists_aux List.sublistsAux theorem sublistsAux_eq_array_foldl : sublistsAux = fun (a : Ξ±) (r : List (List Ξ±)) => (r.toArray.foldl (init := #[]) fun r l => (r.push l).push (a :: l)).toList := by funext a r simp only [sublistsAux, Array.foldl_eq_foldl_data, Array.mkEmpty] have := foldl_hom Array.toList (fun r l => (r.push l).push (a :: l)) (fun (r : List (List Ξ±)) l => r ++ [l, a :: l]) r #[] (by simp) simpa using this theorem sublistsAux_eq_bind : sublistsAux = fun (a : Ξ±) (r : List (List Ξ±)) => r.bind fun l => [l, a :: l] := funext fun a => funext fun r => List.reverseRecOn r (by simp [sublistsAux]) (fun r l ih => by rw [append_bind, ← ih, bind_singleton, sublistsAux, foldl_append] simp [sublistsAux]) @[csimp] theorem sublists_eq_sublistsFast : @sublists = @sublistsFast := by ext Ξ± l : 2 trans l.foldr sublistsAux [[]] Β· rw [sublistsAux_eq_bind, sublists] Β· simp only [sublistsFast, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data] rw [← foldr_hom Array.toList] Β· rfl Β· intros _ _; congr <;> simp #noalign list.sublists_aux₁_eq_sublists_aux #noalign list.sublists_aux_cons_eq_sublists_aux₁ #noalign list.sublists_aux_eq_foldr.aux #noalign list.sublists_aux_eq_foldr #noalign list.sublists_aux_cons_cons #noalign list.sublists_aux₁_append #noalign list.sublists_aux₁_concat #noalign list.sublists_aux₁_bind #noalign list.sublists_aux_cons_append theorem sublists_append (l₁ lβ‚‚ : List Ξ±) : sublists (l₁ ++ lβ‚‚) = (sublists lβ‚‚) >>= (fun x => (sublists l₁).map (Β· ++ x)) := by simp only [sublists, foldr_append] induction l₁ with | nil => simp | cons a l₁ ih => rw [foldr_cons, ih] simp [List.bind, join_join, Function.comp] #align list.sublists_append List.sublists_append -- Porting note (#10756): new theorem theorem sublists_cons (a : Ξ±) (l : List Ξ±) : sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) := show sublists ([a] ++ l) = _ by rw [sublists_append] simp only [sublists_singleton, map_cons, bind_eq_bind, nil_append, cons_append, map_nil] @[simp]
Mathlib/Data/List/Sublists.lean
177
180
theorem sublists_concat (l : List Ξ±) (a : Ξ±) : sublists (l ++ [a]) = sublists l ++ map (fun x => x ++ [a]) (sublists l) := by
rw [sublists_append, sublists_singleton, bind_eq_bind, cons_bind, cons_bind, nil_bind, map_id'' append_nil, append_nil]
import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.FractionalIdeal.Basic #align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7" open IsLocalization Pointwise nonZeroDivisors namespace FractionalIdeal open Set Submodule variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P] variable [Algebra R P] [loc : IsLocalization S P] section variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P'] variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P''] theorem _root_.IsFractional.map (g : P →ₐ[R] P') {I : Submodule R P} : IsFractional S I β†’ IsFractional S (Submodule.map g.toLinearMap I) | ⟨a, a_nonzero, hI⟩ => ⟨a, a_nonzero, fun b hb => by obtain ⟨b', b'_mem, hb'⟩ := Submodule.mem_map.mp hb rw [AlgHom.toLinearMap_apply] at hb' obtain ⟨x, hx⟩ := hI b' b'_mem use x rw [← g.commutes, hx, g.map_smul, hb']⟩ #align is_fractional.map IsFractional.map def map (g : P →ₐ[R] P') : FractionalIdeal S P β†’ FractionalIdeal S P' := fun I => ⟨Submodule.map g.toLinearMap I, I.isFractional.map g⟩ #align fractional_ideal.map FractionalIdeal.map @[simp, norm_cast] theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) : ↑(map g I) = Submodule.map g.toLinearMap I := rfl #align fractional_ideal.coe_map FractionalIdeal.coe_map @[simp] theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} : y ∈ I.map g ↔ βˆƒ x, x ∈ I ∧ g x = y := Submodule.mem_map #align fractional_ideal.mem_map FractionalIdeal.mem_map variable (I J : FractionalIdeal S P) (g : P →ₐ[R] P') @[simp] theorem map_id : I.map (AlgHom.id _ _) = I := coeToSubmodule_injective (Submodule.map_id (I : Submodule R P)) #align fractional_ideal.map_id FractionalIdeal.map_id @[simp] theorem map_comp (g' : P' →ₐ[R] P'') : I.map (g'.comp g) = (I.map g).map g' := coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I) #align fractional_ideal.map_comp FractionalIdeal.map_comp @[simp, norm_cast] theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by ext x simp only [mem_coeIdeal] constructor Β· rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ exact ⟨y, hy, (g.commutes y).symm⟩ Β· rintro ⟨y, hy, rfl⟩ exact ⟨_, ⟨y, hy, rfl⟩, g.commutes y⟩ #align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal @[simp] theorem map_one : (1 : FractionalIdeal S P).map g = 1 := map_coeIdeal g ⊀ #align fractional_ideal.map_one FractionalIdeal.map_one @[simp] theorem map_zero : (0 : FractionalIdeal S P).map g = 0 := map_coeIdeal g 0 #align fractional_ideal.map_zero FractionalIdeal.map_zero @[simp] theorem map_add : (I + J).map g = I.map g + J.map g := coeToSubmodule_injective (Submodule.map_sup _ _ _) #align fractional_ideal.map_add FractionalIdeal.map_add @[simp] theorem map_mul : (I * J).map g = I.map g * J.map g := by simp only [mul_def] exact coeToSubmodule_injective (Submodule.map_mul _ _ _) #align fractional_ideal.map_mul FractionalIdeal.map_mul @[simp] theorem map_map_symm (g : P ≃ₐ[R] P') : (I.map (g : P →ₐ[R] P')).map (g.symm : P' →ₐ[R] P) = I := by rw [← map_comp, g.symm_comp, map_id] #align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm @[simp] theorem map_symm_map (I : FractionalIdeal S P') (g : P ≃ₐ[R] P') : (I.map (g.symm : P' →ₐ[R] P)).map (g : P →ₐ[R] P') = I := by rw [← map_comp, g.comp_symm, map_id] #align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map theorem map_mem_map {f : P →ₐ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} : f x ∈ map f I ↔ x ∈ I := mem_map.trans ⟨fun ⟨_, hx', x'_eq⟩ => h x'_eq β–Έ hx', fun h => ⟨x, h, rfl⟩⟩ #align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map theorem map_injective (f : P →ₐ[R] P') (h : Function.Injective f) : Function.Injective (map f : FractionalIdeal S P β†’ FractionalIdeal S P') := fun _ _ hIJ => ext fun _ => (map_mem_map h).symm.trans (hIJ.symm β–Έ map_mem_map h) #align fractional_ideal.map_injective FractionalIdeal.map_injective def mapEquiv (g : P ≃ₐ[R] P') : FractionalIdeal S P ≃+* FractionalIdeal S P' where toFun := map g invFun := map g.symm map_add' I J := map_add I J _ map_mul' I J := map_mul I J _ left_inv I := by rw [← map_comp, AlgEquiv.symm_comp, map_id] right_inv I := by rw [← map_comp, AlgEquiv.comp_symm, map_id] #align fractional_ideal.map_equiv FractionalIdeal.mapEquiv @[simp] theorem coeFun_mapEquiv (g : P ≃ₐ[R] P') : (mapEquiv g : FractionalIdeal S P β†’ FractionalIdeal S P') = map g := rfl #align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv @[simp] theorem mapEquiv_apply (g : P ≃ₐ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (↑g) I := rfl #align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply @[simp] theorem mapEquiv_symm (g : P ≃ₐ[R] P') : ((mapEquiv g).symm : FractionalIdeal S P' ≃+* _) = mapEquiv g.symm := rfl #align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm @[simp] theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) := RingEquiv.ext fun x => by simp #align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl theorem isFractional_span_iff {s : Set P} : IsFractional S (span R s) ↔ βˆƒ a ∈ S, βˆ€ b : P, b ∈ s β†’ IsInteger R (a β€’ b) := ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => span_induction hb h (by rw [smul_zero] exact isInteger_zero) (fun x y hx hy => by rw [smul_add] exact isInteger_add hx hy) fun s x hx => by rw [smul_comm] exact isInteger_smul hx⟩⟩ #align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
Mathlib/RingTheory/FractionalIdeal/Operations.lean
191
195
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with ⟨I, rfl⟩ rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩ rw [isFractional_span_iff] exact ⟨s, hs1, hs⟩
import Mathlib.Analysis.RCLike.Basic import Mathlib.Dynamics.BirkhoffSum.Average open Function Set Filter open scoped Topology ENNReal Uniformity section variable {Ξ± E : Type*} theorem Function.IsFixedPt.tendsto_birkhoffAverage (R : Type*) [DivisionSemiring R] [CharZero R] [AddCommMonoid E] [TopologicalSpace E] [Module R E] {f : Ξ± β†’ Ξ±} {x : Ξ±} (h : f.IsFixedPt x) (g : Ξ± β†’ E) : Tendsto (birkhoffAverage R f g Β· x) atTop (𝓝 (g x)) := tendsto_const_nhds.congr' <| (eventually_ne_atTop 0).mono fun _n hn ↦ (h.birkhoffAverage_eq R g hn).symm variable [NormedAddCommGroup E] theorem dist_birkhoffSum_apply_birkhoffSum (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ E) (n : β„•) (x : Ξ±) : dist (birkhoffSum f g n (f x)) (birkhoffSum f g n x) = dist (g (f^[n] x)) (g x) := by simp only [dist_eq_norm, birkhoffSum_apply_sub_birkhoffSum] theorem dist_birkhoffSum_birkhoffSum_le (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ E) (n : β„•) (x y : Ξ±) : dist (birkhoffSum f g n x) (birkhoffSum f g n y) ≀ βˆ‘ k ∈ Finset.range n, dist (g (f^[k] x)) (g (f^[k] y)) := dist_sum_sum_le _ _ _ variable (π•œ : Type*) [RCLike π•œ] [Module π•œ E] [BoundedSMul π•œ E] theorem dist_birkhoffAverage_birkhoffAverage (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ E) (n : β„•) (x y : Ξ±) : dist (birkhoffAverage π•œ f g n x) (birkhoffAverage π•œ f g n y) = dist (birkhoffSum f g n x) (birkhoffSum f g n y) / n := by simp [birkhoffAverage, dist_smulβ‚€, div_eq_inv_mul] theorem dist_birkhoffAverage_birkhoffAverage_le (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ E) (n : β„•) (x y : Ξ±) : dist (birkhoffAverage π•œ f g n x) (birkhoffAverage π•œ f g n y) ≀ (βˆ‘ k ∈ Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n := (dist_birkhoffAverage_birkhoffAverage _ _ _ _ _ _).trans_le <| by gcongr; apply dist_birkhoffSum_birkhoffSum_le theorem dist_birkhoffAverage_apply_birkhoffAverage (f : Ξ± β†’ Ξ±) (g : Ξ± β†’ E) (n : β„•) (x : Ξ±) : dist (birkhoffAverage π•œ f g n (f x)) (birkhoffAverage π•œ f g n x) = dist (g (f^[n] x)) (g x) / n := by simp [dist_birkhoffAverage_birkhoffAverage, dist_birkhoffSum_apply_birkhoffSum]
Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean
75
84
theorem tendsto_birkhoffAverage_apply_sub_birkhoffAverage {f : Ξ± β†’ Ξ±} {g : Ξ± β†’ E} {x : Ξ±} (h : Bornology.IsBounded (range (g <| f^[Β·] x))) : Tendsto (fun n ↦ birkhoffAverage π•œ f g n (f x) - birkhoffAverage π•œ f g n x) atTop (𝓝 0) := by
rcases Metric.isBounded_range_iff.1 h with ⟨C, hC⟩ have : Tendsto (fun n : β„• ↦ C / n) atTop (𝓝 0) := tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop refine squeeze_zero_norm (fun n ↦ ?_) this rw [← dist_eq_norm, dist_birkhoffAverage_apply_birkhoffAverage] gcongr exact hC n 0
import Mathlib.GroupTheory.Solvable import Mathlib.FieldTheory.PolynomialGaloisGroup import Mathlib.RingTheory.RootsOfUnity.Basic #align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial IntermediateField open Polynomial IntermediateField section AbelRuffini variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E] theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance #align gal_zero_is_solvable gal_zero_isSolvable theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance #align gal_one_is_solvable gal_one_isSolvable theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_C_is_solvable gal_C_isSolvable theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_is_solvable gal_X_isSolvable theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable theorem gal_X_pow_isSolvable (n : β„•) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_pow_is_solvable gal_X_pow_isSolvable theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) : IsSolvable (p * q).Gal := solvable_of_solvable_injective (Gal.restrictProd_injective p q) #align gal_mul_is_solvable gal_mul_isSolvable theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : βˆ€ p ∈ s, IsSolvable (Gal p)) : IsSolvable s.prod.Gal := by apply Multiset.induction_on' s Β· exact gal_one_isSolvable Β· intro p t hps _ ht rw [Multiset.insert_eq_cons, Multiset.prod_cons] exact gal_mul_isSolvable (hs p hps) ht #align gal_prod_is_solvable gal_prod_isSolvable theorem gal_isSolvable_of_splits {p q : F[X]} (_ : Fact (p.Splits (algebraMap F q.SplittingField))) (hq : IsSolvable q.Gal) : IsSolvable p.Gal := haveI : IsSolvable (q.SplittingField ≃ₐ[F] q.SplittingField) := hq solvable_of_surjective (AlgEquiv.restrictNormalHom_surjective q.SplittingField) #align gal_is_solvable_of_splits gal_isSolvable_of_splits theorem gal_isSolvable_tower (p q : F[X]) (hpq : p.Splits (algebraMap F q.SplittingField)) (hp : IsSolvable p.Gal) (hq : IsSolvable (q.map (algebraMap F p.SplittingField)).Gal) : IsSolvable q.Gal := by let K := p.SplittingField let L := q.SplittingField haveI : Fact (p.Splits (algebraMap F L)) := ⟨hpq⟩ let Ο• : (L ≃ₐ[K] L) ≃* (q.map (algebraMap F K)).Gal := (IsSplittingField.algEquiv L (q.map (algebraMap F K))).autCongr have Ο•_inj : Function.Injective Ο•.toMonoidHom := Ο•.injective haveI : IsSolvable (K ≃ₐ[F] K) := hp haveI : IsSolvable (L ≃ₐ[K] L) := solvable_of_solvable_injective Ο•_inj exact isSolvable_of_isScalarTower F p.SplittingField q.SplittingField #align gal_is_solvable_tower gal_isSolvable_tower variable (F) inductive IsSolvableByRad : E β†’ Prop | base (Ξ± : F) : IsSolvableByRad (algebraMap F E Ξ±) | add (Ξ± Ξ² : E) : IsSolvableByRad Ξ± β†’ IsSolvableByRad Ξ² β†’ IsSolvableByRad (Ξ± + Ξ²) | neg (Ξ± : E) : IsSolvableByRad Ξ± β†’ IsSolvableByRad (-Ξ±) | mul (Ξ± Ξ² : E) : IsSolvableByRad Ξ± β†’ IsSolvableByRad Ξ² β†’ IsSolvableByRad (Ξ± * Ξ²) | inv (Ξ± : E) : IsSolvableByRad Ξ± β†’ IsSolvableByRad α⁻¹ | rad (Ξ± : E) (n : β„•) (hn : n β‰  0) : IsSolvableByRad (Ξ± ^ n) β†’ IsSolvableByRad Ξ± #align is_solvable_by_rad IsSolvableByRad variable (E) def solvableByRad : IntermediateField F E where carrier := IsSolvableByRad F zero_mem' := by change IsSolvableByRad F 0 convert IsSolvableByRad.base (E := E) (0 : F); rw [RingHom.map_zero] add_mem' := by apply IsSolvableByRad.add one_mem' := by change IsSolvableByRad F 1 convert IsSolvableByRad.base (E := E) (1 : F); rw [RingHom.map_one] mul_mem' := by apply IsSolvableByRad.mul inv_mem' := IsSolvableByRad.inv algebraMap_mem' := IsSolvableByRad.base #align solvable_by_rad solvableByRad namespace solvableByRad variable {F} {E} {Ξ± : E}
Mathlib/FieldTheory/AbelRuffini.lean
248
280
theorem induction (P : solvableByRad F E β†’ Prop) (base : βˆ€ Ξ± : F, P (algebraMap F (solvableByRad F E) Ξ±)) (add : βˆ€ Ξ± Ξ² : solvableByRad F E, P Ξ± β†’ P Ξ² β†’ P (Ξ± + Ξ²)) (neg : βˆ€ Ξ± : solvableByRad F E, P Ξ± β†’ P (-Ξ±)) (mul : βˆ€ Ξ± Ξ² : solvableByRad F E, P Ξ± β†’ P Ξ² β†’ P (Ξ± * Ξ²)) (inv : βˆ€ Ξ± : solvableByRad F E, P Ξ± β†’ P α⁻¹) (rad : βˆ€ Ξ± : solvableByRad F E, βˆ€ n : β„•, n β‰  0 β†’ P (Ξ± ^ n) β†’ P Ξ±) (Ξ± : solvableByRad F E) : P Ξ± := by
revert Ξ± suffices βˆ€ Ξ± : E, IsSolvableByRad F Ξ± β†’ βˆƒ Ξ² : solvableByRad F E, ↑β = Ξ± ∧ P Ξ² by intro Ξ± obtain βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩ := this Ξ± (Subtype.mem Ξ±) convert PΞ± exact Subtype.ext hΞ±β‚€.symm apply IsSolvableByRad.rec Β· exact fun Ξ± => ⟨algebraMap F (solvableByRad F E) Ξ±, rfl, base α⟩ Β· intro Ξ± Ξ² _ _ PΞ± PΞ² obtain βŸ¨βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩, Ξ²β‚€, hΞ²β‚€, Pβ⟩ := PΞ±, PΞ² exact βŸ¨Ξ±β‚€ + Ξ²β‚€, by rw [← hΞ±β‚€, ← hΞ²β‚€]; rfl, add Ξ±β‚€ Ξ²β‚€ PΞ± Pβ⟩ Β· intro Ξ± _ PΞ± obtain βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩ := PΞ± exact ⟨-Ξ±β‚€, by rw [← hΞ±β‚€]; rfl, neg Ξ±β‚€ Pα⟩ Β· intro Ξ± Ξ² _ _ PΞ± PΞ² obtain βŸ¨βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩, Ξ²β‚€, hΞ²β‚€, Pβ⟩ := PΞ±, PΞ² exact βŸ¨Ξ±β‚€ * Ξ²β‚€, by rw [← hΞ±β‚€, ← hΞ²β‚€]; rfl, mul Ξ±β‚€ Ξ²β‚€ PΞ± Pβ⟩ Β· intro Ξ± _ PΞ± obtain βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩ := PΞ± exact βŸ¨Ξ±β‚€β»ΒΉ, by rw [← hΞ±β‚€]; rfl, inv Ξ±β‚€ Pα⟩ Β· intro Ξ± n hn hΞ± PΞ± obtain βŸ¨Ξ±β‚€, hΞ±β‚€, Pα⟩ := PΞ± refine ⟨⟨α, IsSolvableByRad.rad Ξ± n hn hα⟩, rfl, rad _ n hn ?_⟩ convert PΞ± exact Subtype.ext (Eq.trans ((solvableByRad F E).coe_pow _ n) hΞ±β‚€.symm)
import Mathlib.MeasureTheory.Measure.MeasureSpace open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function variable {R Ξ± Ξ² Ξ΄ Ξ³ ΞΉ : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace Ξ±} [MeasurableSpace Ξ²] [MeasurableSpace Ξ³] variable {ΞΌ μ₁ ΞΌβ‚‚ μ₃ Ξ½ Ξ½' ν₁ Ξ½β‚‚ : Measure Ξ±} {s s' t : Set Ξ±} namespace Measure noncomputable def restrictβ‚— {m0 : MeasurableSpace Ξ±} (s : Set Ξ±) : Measure Ξ± β†’β‚—[ℝβ‰₯0∞] Measure Ξ± := liftLinear (OuterMeasure.restrict s) fun ΞΌ s' hs' t => by suffices ΞΌ (s ∩ t) = ΞΌ (s ∩ t ∩ s') + ΞΌ ((s ∩ t) \ s') by simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc] exact le_toOuterMeasure_caratheodory _ _ hs' _ #align measure_theory.measure.restrictβ‚— MeasureTheory.Measure.restrictβ‚— noncomputable def restrict {_m0 : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (s : Set Ξ±) : Measure Ξ± := restrictβ‚— s ΞΌ #align measure_theory.measure.restrict MeasureTheory.Measure.restrict @[simp] theorem restrictβ‚—_apply {_m0 : MeasurableSpace Ξ±} (s : Set Ξ±) (ΞΌ : Measure Ξ±) : restrictβ‚— s ΞΌ = ΞΌ.restrict s := rfl #align measure_theory.measure.restrictβ‚—_apply MeasureTheory.Measure.restrictβ‚—_apply theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) : (ΞΌ.restrict s).toOuterMeasure = OuterMeasure.restrict s ΞΌ.toOuterMeasure := by simp_rw [restrict, restrictβ‚—, liftLinear, LinearMap.coe_mk, AddHom.coe_mk, toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, ΞΌ.trimmed] #align measure_theory.measure.restrict_to_outer_measure_eq_to_outer_measure_restrict MeasureTheory.Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict theorem restrict_applyβ‚€ (ht : NullMeasurableSet t (ΞΌ.restrict s)) : ΞΌ.restrict s t = ΞΌ (t ∩ s) := by rw [← restrictβ‚—_apply, restrictβ‚—, liftLinear_applyβ‚€ _ ht, OuterMeasure.restrict_apply, coe_toOuterMeasure] #align measure_theory.measure.restrict_applyβ‚€ MeasureTheory.Measure.restrict_applyβ‚€ @[simp] theorem restrict_apply (ht : MeasurableSet t) : ΞΌ.restrict s t = ΞΌ (t ∩ s) := restrict_applyβ‚€ ht.nullMeasurableSet #align measure_theory.measure.restrict_apply MeasureTheory.Measure.restrict_apply theorem restrict_mono' {_m0 : MeasurableSpace Ξ±} ⦃s s' : Set α⦄ ⦃μ Ξ½ : Measure α⦄ (hs : s ≀ᡐ[ΞΌ] s') (hΞΌΞ½ : ΞΌ ≀ Ξ½) : ΞΌ.restrict s ≀ Ξ½.restrict s' := Measure.le_iff.2 fun t ht => calc ΞΌ.restrict s t = ΞΌ (t ∩ s) := restrict_apply ht _ ≀ ΞΌ (t ∩ s') := (measure_mono_ae <| hs.mono fun _x hx ⟨hxt, hxs⟩ => ⟨hxt, hx hxs⟩) _ ≀ Ξ½ (t ∩ s') := le_iff'.1 hΞΌΞ½ (t ∩ s') _ = Ξ½.restrict s' t := (restrict_apply ht).symm #align measure_theory.measure.restrict_mono' MeasureTheory.Measure.restrict_mono' @[mono] theorem restrict_mono {_m0 : MeasurableSpace Ξ±} ⦃s s' : Set α⦄ (hs : s βŠ† s') ⦃μ Ξ½ : Measure α⦄ (hΞΌΞ½ : ΞΌ ≀ Ξ½) : ΞΌ.restrict s ≀ Ξ½.restrict s' := restrict_mono' (ae_of_all _ hs) hΞΌΞ½ #align measure_theory.measure.restrict_mono MeasureTheory.Measure.restrict_mono theorem restrict_mono_ae (h : s ≀ᡐ[ΞΌ] t) : ΞΌ.restrict s ≀ ΞΌ.restrict t := restrict_mono' h (le_refl ΞΌ) #align measure_theory.measure.restrict_mono_ae MeasureTheory.Measure.restrict_mono_ae theorem restrict_congr_set (h : s =ᡐ[ΞΌ] t) : ΞΌ.restrict s = ΞΌ.restrict t := le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le) #align measure_theory.measure.restrict_congr_set MeasureTheory.Measure.restrict_congr_set @[simp] theorem restrict_apply' (hs : MeasurableSet s) : ΞΌ.restrict s t = ΞΌ (t ∩ s) := by rw [← toOuterMeasure_apply, Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict hs, OuterMeasure.restrict_apply s t _, toOuterMeasure_apply] #align measure_theory.measure.restrict_apply' MeasureTheory.Measure.restrict_apply' theorem restrict_applyβ‚€' (hs : NullMeasurableSet s ΞΌ) : ΞΌ.restrict s t = ΞΌ (t ∩ s) := by rw [← restrict_congr_set hs.toMeasurable_ae_eq, restrict_apply' (measurableSet_toMeasurable _ _), measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)] #align measure_theory.measure.restrict_applyβ‚€' MeasureTheory.Measure.restrict_applyβ‚€' theorem restrict_le_self : ΞΌ.restrict s ≀ ΞΌ := Measure.le_iff.2 fun t ht => calc ΞΌ.restrict s t = ΞΌ (t ∩ s) := restrict_apply ht _ ≀ ΞΌ t := measure_mono inter_subset_left #align measure_theory.measure.restrict_le_self MeasureTheory.Measure.restrict_le_self variable (ΞΌ) theorem restrict_eq_self (h : s βŠ† t) : ΞΌ.restrict t s = ΞΌ s := (le_iff'.1 restrict_le_self s).antisymm <| calc ΞΌ s ≀ ΞΌ (toMeasurable (ΞΌ.restrict t) s ∩ t) := measure_mono (subset_inter (subset_toMeasurable _ _) h) _ = ΞΌ.restrict t s := by rw [← restrict_apply (measurableSet_toMeasurable _ _), measure_toMeasurable] #align measure_theory.measure.restrict_eq_self MeasureTheory.Measure.restrict_eq_self @[simp] theorem restrict_apply_self (s : Set Ξ±) : (ΞΌ.restrict s) s = ΞΌ s := restrict_eq_self ΞΌ Subset.rfl #align measure_theory.measure.restrict_apply_self MeasureTheory.Measure.restrict_apply_self variable {ΞΌ} theorem restrict_apply_univ (s : Set Ξ±) : ΞΌ.restrict s univ = ΞΌ s := by rw [restrict_apply MeasurableSet.univ, Set.univ_inter] #align measure_theory.measure.restrict_apply_univ MeasureTheory.Measure.restrict_apply_univ theorem le_restrict_apply (s t : Set Ξ±) : ΞΌ (t ∩ s) ≀ ΞΌ.restrict s t := calc ΞΌ (t ∩ s) = ΞΌ.restrict s (t ∩ s) := (restrict_eq_self ΞΌ inter_subset_right).symm _ ≀ ΞΌ.restrict s t := measure_mono inter_subset_left #align measure_theory.measure.le_restrict_apply MeasureTheory.Measure.le_restrict_apply theorem restrict_apply_le (s t : Set Ξ±) : ΞΌ.restrict s t ≀ ΞΌ t := Measure.le_iff'.1 restrict_le_self _ theorem restrict_apply_superset (h : s βŠ† t) : ΞΌ.restrict s t = ΞΌ s := ((measure_mono (subset_univ _)).trans_eq <| restrict_apply_univ _).antisymm ((restrict_apply_self ΞΌ s).symm.trans_le <| measure_mono h) #align measure_theory.measure.restrict_apply_superset MeasureTheory.Measure.restrict_apply_superset @[simp] theorem restrict_add {_m0 : MeasurableSpace Ξ±} (ΞΌ Ξ½ : Measure Ξ±) (s : Set Ξ±) : (ΞΌ + Ξ½).restrict s = ΞΌ.restrict s + Ξ½.restrict s := (restrictβ‚— s).map_add ΞΌ Ξ½ #align measure_theory.measure.restrict_add MeasureTheory.Measure.restrict_add @[simp] theorem restrict_zero {_m0 : MeasurableSpace Ξ±} (s : Set Ξ±) : (0 : Measure Ξ±).restrict s = 0 := (restrictβ‚— s).map_zero #align measure_theory.measure.restrict_zero MeasureTheory.Measure.restrict_zero @[simp] theorem restrict_smul {_m0 : MeasurableSpace Ξ±} (c : ℝβ‰₯0∞) (ΞΌ : Measure Ξ±) (s : Set Ξ±) : (c β€’ ΞΌ).restrict s = c β€’ ΞΌ.restrict s := (restrictβ‚— s).map_smul c ΞΌ #align measure_theory.measure.restrict_smul MeasureTheory.Measure.restrict_smul theorem restrict_restrictβ‚€ (hs : NullMeasurableSet s (ΞΌ.restrict t)) : (ΞΌ.restrict t).restrict s = ΞΌ.restrict (s ∩ t) := ext fun u hu => by simp only [Set.inter_assoc, restrict_apply hu, restrict_applyβ‚€ (hu.nullMeasurableSet.inter hs)] #align measure_theory.measure.restrict_restrictβ‚€ MeasureTheory.Measure.restrict_restrictβ‚€ @[simp] theorem restrict_restrict (hs : MeasurableSet s) : (ΞΌ.restrict t).restrict s = ΞΌ.restrict (s ∩ t) := restrict_restrictβ‚€ hs.nullMeasurableSet #align measure_theory.measure.restrict_restrict MeasureTheory.Measure.restrict_restrict theorem restrict_restrict_of_subset (h : s βŠ† t) : (ΞΌ.restrict t).restrict s = ΞΌ.restrict s := by ext1 u hu rw [restrict_apply hu, restrict_apply hu, restrict_eq_self] exact inter_subset_right.trans h #align measure_theory.measure.restrict_restrict_of_subset MeasureTheory.Measure.restrict_restrict_of_subset theorem restrict_restrictβ‚€' (ht : NullMeasurableSet t ΞΌ) : (ΞΌ.restrict t).restrict s = ΞΌ.restrict (s ∩ t) := ext fun u hu => by simp only [restrict_apply hu, restrict_applyβ‚€' ht, inter_assoc] #align measure_theory.measure.restrict_restrictβ‚€' MeasureTheory.Measure.restrict_restrictβ‚€' theorem restrict_restrict' (ht : MeasurableSet t) : (ΞΌ.restrict t).restrict s = ΞΌ.restrict (s ∩ t) := restrict_restrictβ‚€' ht.nullMeasurableSet #align measure_theory.measure.restrict_restrict' MeasureTheory.Measure.restrict_restrict' theorem restrict_comm (hs : MeasurableSet s) : (ΞΌ.restrict t).restrict s = (ΞΌ.restrict s).restrict t := by rw [restrict_restrict hs, restrict_restrict' hs, inter_comm] #align measure_theory.measure.restrict_comm MeasureTheory.Measure.restrict_comm theorem restrict_apply_eq_zero (ht : MeasurableSet t) : ΞΌ.restrict s t = 0 ↔ ΞΌ (t ∩ s) = 0 := by rw [restrict_apply ht] #align measure_theory.measure.restrict_apply_eq_zero MeasureTheory.Measure.restrict_apply_eq_zero theorem measure_inter_eq_zero_of_restrict (h : ΞΌ.restrict s t = 0) : ΞΌ (t ∩ s) = 0 := nonpos_iff_eq_zero.1 (h β–Έ le_restrict_apply _ _) #align measure_theory.measure.measure_inter_eq_zero_of_restrict MeasureTheory.Measure.measure_inter_eq_zero_of_restrict theorem restrict_apply_eq_zero' (hs : MeasurableSet s) : ΞΌ.restrict s t = 0 ↔ ΞΌ (t ∩ s) = 0 := by rw [restrict_apply' hs] #align measure_theory.measure.restrict_apply_eq_zero' MeasureTheory.Measure.restrict_apply_eq_zero' @[simp] theorem restrict_eq_zero : ΞΌ.restrict s = 0 ↔ ΞΌ s = 0 := by rw [← measure_univ_eq_zero, restrict_apply_univ] #align measure_theory.measure.restrict_eq_zero MeasureTheory.Measure.restrict_eq_zero instance restrict.neZero [NeZero (ΞΌ s)] : NeZero (ΞΌ.restrict s) := ⟨mt restrict_eq_zero.mp <| NeZero.ne _⟩ theorem restrict_zero_set {s : Set Ξ±} (h : ΞΌ s = 0) : ΞΌ.restrict s = 0 := restrict_eq_zero.2 h #align measure_theory.measure.restrict_zero_set MeasureTheory.Measure.restrict_zero_set @[simp] theorem restrict_empty : ΞΌ.restrict βˆ… = 0 := restrict_zero_set measure_empty #align measure_theory.measure.restrict_empty MeasureTheory.Measure.restrict_empty @[simp] theorem restrict_univ : ΞΌ.restrict univ = ΞΌ := ext fun s hs => by simp [hs] #align measure_theory.measure.restrict_univ MeasureTheory.Measure.restrict_univ theorem restrict_inter_add_diffβ‚€ (s : Set Ξ±) (ht : NullMeasurableSet t ΞΌ) : ΞΌ.restrict (s ∩ t) + ΞΌ.restrict (s \ t) = ΞΌ.restrict s := by ext1 u hu simp only [add_apply, restrict_apply hu, ← inter_assoc, diff_eq] exact measure_inter_add_diffβ‚€ (u ∩ s) ht #align measure_theory.measure.restrict_inter_add_diffβ‚€ MeasureTheory.Measure.restrict_inter_add_diffβ‚€ theorem restrict_inter_add_diff (s : Set Ξ±) (ht : MeasurableSet t) : ΞΌ.restrict (s ∩ t) + ΞΌ.restrict (s \ t) = ΞΌ.restrict s := restrict_inter_add_diffβ‚€ s ht.nullMeasurableSet #align measure_theory.measure.restrict_inter_add_diff MeasureTheory.Measure.restrict_inter_add_diff theorem restrict_union_add_interβ‚€ (s : Set Ξ±) (ht : NullMeasurableSet t ΞΌ) : ΞΌ.restrict (s βˆͺ t) + ΞΌ.restrict (s ∩ t) = ΞΌ.restrict s + ΞΌ.restrict t := by rw [← restrict_inter_add_diffβ‚€ (s βˆͺ t) ht, union_inter_cancel_right, union_diff_right, ← restrict_inter_add_diffβ‚€ s ht, add_comm, ← add_assoc, add_right_comm] #align measure_theory.measure.restrict_union_add_interβ‚€ MeasureTheory.Measure.restrict_union_add_interβ‚€ theorem restrict_union_add_inter (s : Set Ξ±) (ht : MeasurableSet t) : ΞΌ.restrict (s βˆͺ t) + ΞΌ.restrict (s ∩ t) = ΞΌ.restrict s + ΞΌ.restrict t := restrict_union_add_interβ‚€ s ht.nullMeasurableSet #align measure_theory.measure.restrict_union_add_inter MeasureTheory.Measure.restrict_union_add_inter theorem restrict_union_add_inter' (hs : MeasurableSet s) (t : Set Ξ±) : ΞΌ.restrict (s βˆͺ t) + ΞΌ.restrict (s ∩ t) = ΞΌ.restrict s + ΞΌ.restrict t := by simpa only [union_comm, inter_comm, add_comm] using restrict_union_add_inter t hs #align measure_theory.measure.restrict_union_add_inter' MeasureTheory.Measure.restrict_union_add_inter' theorem restrict_unionβ‚€ (h : AEDisjoint ΞΌ s t) (ht : NullMeasurableSet t ΞΌ) : ΞΌ.restrict (s βˆͺ t) = ΞΌ.restrict s + ΞΌ.restrict t := by simp [← restrict_union_add_interβ‚€ s ht, restrict_zero_set h] #align measure_theory.measure.restrict_unionβ‚€ MeasureTheory.Measure.restrict_unionβ‚€ theorem restrict_union (h : Disjoint s t) (ht : MeasurableSet t) : ΞΌ.restrict (s βˆͺ t) = ΞΌ.restrict s + ΞΌ.restrict t := restrict_unionβ‚€ h.aedisjoint ht.nullMeasurableSet #align measure_theory.measure.restrict_union MeasureTheory.Measure.restrict_union
Mathlib/MeasureTheory/Measure/Restrict.lean
281
283
theorem restrict_union' (h : Disjoint s t) (hs : MeasurableSet s) : ΞΌ.restrict (s βˆͺ t) = ΞΌ.restrict s + ΞΌ.restrict t := by
rw [union_comm, restrict_union h.symm hs, add_comm]
import Mathlib.Algebra.Associated import Mathlib.Algebra.Star.Unitary import Mathlib.RingTheory.Int.Basic import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.Tactic.Ring #align_import number_theory.zsqrtd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" @[ext] structure Zsqrtd (d : β„€) where re : β„€ im : β„€ deriving DecidableEq #align zsqrtd Zsqrtd #align zsqrtd.ext Zsqrtd.ext_iff prefix:100 "β„€βˆš" => Zsqrtd namespace Zsqrtd section variable {d : β„€} def ofInt (n : β„€) : β„€βˆšd := ⟨n, 0⟩ #align zsqrtd.of_int Zsqrtd.ofInt theorem ofInt_re (n : β„€) : (ofInt n : β„€βˆšd).re = n := rfl #align zsqrtd.of_int_re Zsqrtd.ofInt_re theorem ofInt_im (n : β„€) : (ofInt n : β„€βˆšd).im = 0 := rfl #align zsqrtd.of_int_im Zsqrtd.ofInt_im instance : Zero (β„€βˆšd) := ⟨ofInt 0⟩ @[simp] theorem zero_re : (0 : β„€βˆšd).re = 0 := rfl #align zsqrtd.zero_re Zsqrtd.zero_re @[simp] theorem zero_im : (0 : β„€βˆšd).im = 0 := rfl #align zsqrtd.zero_im Zsqrtd.zero_im instance : Inhabited (β„€βˆšd) := ⟨0⟩ instance : One (β„€βˆšd) := ⟨ofInt 1⟩ @[simp] theorem one_re : (1 : β„€βˆšd).re = 1 := rfl #align zsqrtd.one_re Zsqrtd.one_re @[simp] theorem one_im : (1 : β„€βˆšd).im = 0 := rfl #align zsqrtd.one_im Zsqrtd.one_im def sqrtd : β„€βˆšd := ⟨0, 1⟩ #align zsqrtd.sqrtd Zsqrtd.sqrtd @[simp] theorem sqrtd_re : (sqrtd : β„€βˆšd).re = 0 := rfl #align zsqrtd.sqrtd_re Zsqrtd.sqrtd_re @[simp] theorem sqrtd_im : (sqrtd : β„€βˆšd).im = 1 := rfl #align zsqrtd.sqrtd_im Zsqrtd.sqrtd_im instance : Add (β„€βˆšd) := ⟨fun z w => ⟨z.1 + w.1, z.2 + w.2⟩⟩ @[simp] theorem add_def (x y x' y' : β„€) : (⟨x, y⟩ + ⟨x', y'⟩ : β„€βˆšd) = ⟨x + x', y + y'⟩ := rfl #align zsqrtd.add_def Zsqrtd.add_def @[simp] theorem add_re (z w : β„€βˆšd) : (z + w).re = z.re + w.re := rfl #align zsqrtd.add_re Zsqrtd.add_re @[simp] theorem add_im (z w : β„€βˆšd) : (z + w).im = z.im + w.im := rfl #align zsqrtd.add_im Zsqrtd.add_im #noalign zsqrtd.bit0_re #noalign zsqrtd.bit0_im #noalign zsqrtd.bit1_re #noalign zsqrtd.bit1_im instance : Neg (β„€βˆšd) := ⟨fun z => ⟨-z.1, -z.2⟩⟩ @[simp] theorem neg_re (z : β„€βˆšd) : (-z).re = -z.re := rfl #align zsqrtd.neg_re Zsqrtd.neg_re @[simp] theorem neg_im (z : β„€βˆšd) : (-z).im = -z.im := rfl #align zsqrtd.neg_im Zsqrtd.neg_im instance : Mul (β„€βˆšd) := ⟨fun z w => ⟨z.1 * w.1 + d * z.2 * w.2, z.1 * w.2 + z.2 * w.1⟩⟩ @[simp] theorem mul_re (z w : β„€βˆšd) : (z * w).re = z.re * w.re + d * z.im * w.im := rfl #align zsqrtd.mul_re Zsqrtd.mul_re @[simp] theorem mul_im (z w : β„€βˆšd) : (z * w).im = z.re * w.im + z.im * w.re := rfl #align zsqrtd.mul_im Zsqrtd.mul_im instance addCommGroup : AddCommGroup (β„€βˆšd) := by refine { add := (Β· + Β·) zero := (0 : β„€βˆšd) sub := fun a b => a + -b neg := Neg.neg nsmul := @nsmulRec (β„€βˆšd) ⟨0⟩ ⟨(Β· + Β·)⟩ zsmul := @zsmulRec (β„€βˆšd) ⟨0⟩ ⟨(Β· + Β·)⟩ ⟨Neg.neg⟩ (@nsmulRec (β„€βˆšd) ⟨0⟩ ⟨(Β· + Β·)⟩) add_assoc := ?_ zero_add := ?_ add_zero := ?_ add_left_neg := ?_ add_comm := ?_ } <;> intros <;> ext <;> simp [add_comm, add_left_comm] @[simp] theorem sub_re (z w : β„€βˆšd) : (z - w).re = z.re - w.re := rfl @[simp] theorem sub_im (z w : β„€βˆšd) : (z - w).im = z.im - w.im := rfl instance addGroupWithOne : AddGroupWithOne (β„€βˆšd) := { Zsqrtd.addCommGroup with natCast := fun n => ofInt n intCast := ofInt one := 1 } instance commRing : CommRing (β„€βˆšd) := by refine { Zsqrtd.addGroupWithOne with mul := (Β· * Β·) npow := @npowRec (β„€βˆšd) ⟨1⟩ ⟨(Β· * Β·)⟩, add_comm := ?_ left_distrib := ?_ right_distrib := ?_ zero_mul := ?_ mul_zero := ?_ mul_assoc := ?_ one_mul := ?_ mul_one := ?_ mul_comm := ?_ } <;> intros <;> ext <;> simp <;> ring instance : AddMonoid (β„€βˆšd) := by infer_instance instance : Monoid (β„€βˆšd) := by infer_instance instance : CommMonoid (β„€βˆšd) := by infer_instance instance : CommSemigroup (β„€βˆšd) := by infer_instance instance : Semigroup (β„€βˆšd) := by infer_instance instance : AddCommSemigroup (β„€βˆšd) := by infer_instance instance : AddSemigroup (β„€βˆšd) := by infer_instance instance : CommSemiring (β„€βˆšd) := by infer_instance instance : Semiring (β„€βˆšd) := by infer_instance instance : Ring (β„€βˆšd) := by infer_instance instance : Distrib (β„€βˆšd) := by infer_instance instance : Star (β„€βˆšd) where star z := ⟨z.1, -z.2⟩ @[simp] theorem star_mk (x y : β„€) : star (⟨x, y⟩ : β„€βˆšd) = ⟨x, -y⟩ := rfl #align zsqrtd.star_mk Zsqrtd.star_mk @[simp] theorem star_re (z : β„€βˆšd) : (star z).re = z.re := rfl #align zsqrtd.star_re Zsqrtd.star_re @[simp] theorem star_im (z : β„€βˆšd) : (star z).im = -z.im := rfl #align zsqrtd.star_im Zsqrtd.star_im instance : StarRing (β„€βˆšd) where star_involutive x := Zsqrtd.ext _ _ rfl (neg_neg _) star_mul a b := by ext <;> simp <;> ring star_add a b := Zsqrtd.ext _ _ rfl (neg_add _ _) -- Porting note: proof was `by decide` instance nontrivial : Nontrivial (β„€βˆšd) := ⟨⟨0, 1, (Zsqrtd.ext_iff 0 1).not.mpr (by simp)⟩⟩ @[simp] theorem natCast_re (n : β„•) : (n : β„€βˆšd).re = n := rfl #align zsqrtd.coe_nat_re Zsqrtd.natCast_re @[simp] theorem ofNat_re (n : β„•) [n.AtLeastTwo] : (no_index (OfNat.ofNat n) : β„€βˆšd).re = n := rfl @[simp] theorem natCast_im (n : β„•) : (n : β„€βˆšd).im = 0 := rfl #align zsqrtd.coe_nat_im Zsqrtd.natCast_im @[simp] theorem ofNat_im (n : β„•) [n.AtLeastTwo] : (no_index (OfNat.ofNat n) : β„€βˆšd).im = 0 := rfl theorem natCast_val (n : β„•) : (n : β„€βˆšd) = ⟨n, 0⟩ := rfl #align zsqrtd.coe_nat_val Zsqrtd.natCast_val @[simp] theorem intCast_re (n : β„€) : (n : β„€βˆšd).re = n := by cases n <;> rfl #align zsqrtd.coe_int_re Zsqrtd.intCast_re @[simp] theorem intCast_im (n : β„€) : (n : β„€βˆšd).im = 0 := by cases n <;> rfl #align zsqrtd.coe_int_im Zsqrtd.intCast_im theorem intCast_val (n : β„€) : (n : β„€βˆšd) = ⟨n, 0⟩ := by ext <;> simp #align zsqrtd.coe_int_val Zsqrtd.intCast_val instance : CharZero (β„€βˆšd) where cast_injective m n := by simp [Zsqrtd.ext_iff] @[simp] theorem ofInt_eq_intCast (n : β„€) : (ofInt n : β„€βˆšd) = n := by ext <;> simp [ofInt_re, ofInt_im] #align zsqrtd.of_int_eq_coe Zsqrtd.ofInt_eq_intCast @[deprecated (since := "2024-04-05")] alias coe_nat_re := natCast_re @[deprecated (since := "2024-04-05")] alias coe_nat_im := natCast_im @[deprecated (since := "2024-04-05")] alias coe_nat_val := natCast_val @[deprecated (since := "2024-04-05")] alias coe_int_re := intCast_re @[deprecated (since := "2024-04-05")] alias coe_int_im := intCast_im @[deprecated (since := "2024-04-05")] alias coe_int_val := intCast_val @[deprecated (since := "2024-04-05")] alias ofInt_eq_coe := ofInt_eq_intCast @[simp] theorem smul_val (n x y : β„€) : (n : β„€βˆšd) * ⟨x, y⟩ = ⟨n * x, n * y⟩ := by ext <;> simp #align zsqrtd.smul_val Zsqrtd.smul_val theorem smul_re (a : β„€) (b : β„€βˆšd) : (↑a * b).re = a * b.re := by simp #align zsqrtd.smul_re Zsqrtd.smul_re theorem smul_im (a : β„€) (b : β„€βˆšd) : (↑a * b).im = a * b.im := by simp #align zsqrtd.smul_im Zsqrtd.smul_im @[simp] theorem muld_val (x y : β„€) : sqrtd (d := d) * ⟨x, y⟩ = ⟨d * y, x⟩ := by ext <;> simp #align zsqrtd.muld_val Zsqrtd.muld_val @[simp] theorem dmuld : sqrtd (d := d) * sqrtd (d := d) = d := by ext <;> simp #align zsqrtd.dmuld Zsqrtd.dmuld @[simp] theorem smuld_val (n x y : β„€) : sqrtd * (n : β„€βˆšd) * ⟨x, y⟩ = ⟨d * n * y, n * x⟩ := by ext <;> simp #align zsqrtd.smuld_val Zsqrtd.smuld_val theorem decompose {x y : β„€} : (⟨x, y⟩ : β„€βˆšd) = x + sqrtd (d := d) * y := by ext <;> simp #align zsqrtd.decompose Zsqrtd.decompose theorem mul_star {x y : β„€} : (⟨x, y⟩ * star ⟨x, y⟩ : β„€βˆšd) = x * x - d * y * y := by ext <;> simp [sub_eq_add_neg, mul_comm] #align zsqrtd.mul_star Zsqrtd.mul_star @[deprecated (since := "2024-05-25")] alias coe_int_add := Int.cast_add @[deprecated (since := "2024-05-25")] alias coe_int_sub := Int.cast_sub @[deprecated (since := "2024-05-25")] alias coe_int_mul := Int.cast_mul @[deprecated (since := "2024-05-25")] alias coe_int_inj := Int.cast_inj theorem intCast_dvd (z : β„€) (a : β„€βˆšd) : ↑z ∣ a ↔ z ∣ a.re ∧ z ∣ a.im := by constructor Β· rintro ⟨x, rfl⟩ simp only [add_zero, intCast_re, zero_mul, mul_im, dvd_mul_right, and_self_iff, mul_re, mul_zero, intCast_im] Β· rintro ⟨⟨r, hr⟩, ⟨i, hi⟩⟩ use ⟨r, i⟩ rw [smul_val, Zsqrtd.ext_iff] exact ⟨hr, hi⟩ #align zsqrtd.coe_int_dvd_iff Zsqrtd.intCast_dvd @[simp, norm_cast] theorem intCast_dvd_intCast (a b : β„€) : (a : β„€βˆšd) ∣ b ↔ a ∣ b := by rw [intCast_dvd] constructor Β· rintro ⟨hre, -⟩ rwa [intCast_re] at hre Β· rw [intCast_re, intCast_im] exact fun hc => ⟨hc, dvd_zero a⟩ #align zsqrtd.coe_int_dvd_coe_int Zsqrtd.intCast_dvd_intCast @[deprecated (since := "2024-05-25")] alias coe_int_dvd_iff := intCast_dvd @[deprecated (since := "2024-05-25")] alias coe_int_dvd_coe_int := intCast_dvd_intCast protected theorem eq_of_smul_eq_smul_left {a : β„€} {b c : β„€βˆšd} (ha : a β‰  0) (h : ↑a * b = a * c) : b = c := by rw [Zsqrtd.ext_iff] at h ⊒ apply And.imp _ _ h <;> simpa only [smul_re, smul_im] using mul_left_cancelβ‚€ ha #align zsqrtd.eq_of_smul_eq_smul_left Zsqrtd.eq_of_smul_eq_smul_left def SqLe (a c b d : β„•) : Prop := c * a * a ≀ d * b * b #align zsqrtd.sq_le Zsqrtd.SqLe theorem sqLe_of_le {c d x y z w : β„•} (xz : z ≀ x) (yw : y ≀ w) (xy : SqLe x c y d) : SqLe z c w d := le_trans (mul_le_mul (Nat.mul_le_mul_left _ xz) xz (Nat.zero_le _) (Nat.zero_le _)) <| le_trans xy (mul_le_mul (Nat.mul_le_mul_left _ yw) yw (Nat.zero_le _) (Nat.zero_le _)) #align zsqrtd.sq_le_of_le Zsqrtd.sqLe_of_le theorem sqLe_add_mixed {c d x y z w : β„•} (xy : SqLe x c y d) (zw : SqLe z c w d) : c * (x * z) ≀ d * (y * w) := Nat.mul_self_le_mul_self_iff.1 <| by simpa [mul_comm, mul_left_comm] using mul_le_mul xy zw (Nat.zero_le _) (Nat.zero_le _) #align zsqrtd.sq_le_add_mixed Zsqrtd.sqLe_add_mixed theorem sqLe_add {c d x y z w : β„•} (xy : SqLe x c y d) (zw : SqLe z c w d) : SqLe (x + z) c (y + w) d := by have xz := sqLe_add_mixed xy zw simp? [SqLe, mul_assoc] at xy zw says simp only [SqLe, mul_assoc] at xy zw simp [SqLe, mul_add, mul_comm, mul_left_comm, add_le_add, *] #align zsqrtd.sq_le_add Zsqrtd.sqLe_add theorem sqLe_cancel {c d x y z w : β„•} (zw : SqLe y d x c) (h : SqLe (x + z) c (y + w) d) : SqLe z c w d := by apply le_of_not_gt intro l refine not_le_of_gt ?_ h simp only [SqLe, mul_add, mul_comm, mul_left_comm, add_assoc, gt_iff_lt] have hm := sqLe_add_mixed zw (le_of_lt l) simp only [SqLe, mul_assoc, gt_iff_lt] at l zw exact lt_of_le_of_lt (add_le_add_right zw _) (add_lt_add_left (add_lt_add_of_le_of_lt hm (add_lt_add_of_le_of_lt hm l)) _) #align zsqrtd.sq_le_cancel Zsqrtd.sqLe_cancel theorem sqLe_smul {c d x y : β„•} (n : β„•) (xy : SqLe x c y d) : SqLe (n * x) c (n * y) d := by simpa [SqLe, mul_left_comm, mul_assoc] using Nat.mul_le_mul_left (n * n) xy #align zsqrtd.sq_le_smul Zsqrtd.sqLe_smul theorem sqLe_mul {d x y z w : β„•} : (SqLe x 1 y d β†’ SqLe z 1 w d β†’ SqLe (x * w + y * z) d (x * z + d * y * w) 1) ∧ (SqLe x 1 y d β†’ SqLe w d z 1 β†’ SqLe (x * z + d * y * w) 1 (x * w + y * z) d) ∧ (SqLe y d x 1 β†’ SqLe z 1 w d β†’ SqLe (x * z + d * y * w) 1 (x * w + y * z) d) ∧ (SqLe y d x 1 β†’ SqLe w d z 1 β†’ SqLe (x * w + y * z) d (x * z + d * y * w) 1) := by refine ⟨?_, ?_, ?_, ?_⟩ <;> Β· intro xy zw have := Int.mul_nonneg (sub_nonneg_of_le (Int.ofNat_le_ofNat_of_le xy)) (sub_nonneg_of_le (Int.ofNat_le_ofNat_of_le zw)) refine Int.le_of_ofNat_le_ofNat (le_of_sub_nonneg ?_) convert this using 1 simp only [one_mul, Int.ofNat_add, Int.ofNat_mul] ring #align zsqrtd.sq_le_mul Zsqrtd.sqLe_mul open Int in def Nonnegg (c d : β„•) : β„€ β†’ β„€ β†’ Prop | (a : β„•), (b : β„•) => True | (a : β„•), -[b+1] => SqLe (b + 1) c a d | -[a+1], (b : β„•) => SqLe (a + 1) d b c | -[_+1], -[_+1] => False #align zsqrtd.nonnegg Zsqrtd.Nonnegg theorem nonnegg_comm {c d : β„•} {x y : β„€} : Nonnegg c d x y = Nonnegg d c y x := by induction x <;> induction y <;> rfl #align zsqrtd.nonnegg_comm Zsqrtd.nonnegg_comm theorem nonnegg_neg_pos {c d} : βˆ€ {a b : β„•}, Nonnegg c d (-a) b ↔ SqLe a d b c | 0, b => ⟨by simp [SqLe, Nat.zero_le], fun _ => trivial⟩ | a + 1, b => by rw [← Int.negSucc_coe]; rfl #align zsqrtd.nonnegg_neg_pos Zsqrtd.nonnegg_neg_pos theorem nonnegg_pos_neg {c d} {a b : β„•} : Nonnegg c d a (-b) ↔ SqLe b c a d := by rw [nonnegg_comm]; exact nonnegg_neg_pos #align zsqrtd.nonnegg_pos_neg Zsqrtd.nonnegg_pos_neg open Int in theorem nonnegg_cases_right {c d} {a : β„•} : βˆ€ {b : β„€}, (βˆ€ x : β„•, b = -x β†’ SqLe x c a d) β†’ Nonnegg c d a b | (b : Nat), _ => trivial | -[b+1], h => h (b + 1) rfl #align zsqrtd.nonnegg_cases_right Zsqrtd.nonnegg_cases_right theorem nonnegg_cases_left {c d} {b : β„•} {a : β„€} (h : βˆ€ x : β„•, a = -x β†’ SqLe x d b c) : Nonnegg c d a b := cast nonnegg_comm (nonnegg_cases_right h) #align zsqrtd.nonnegg_cases_left Zsqrtd.nonnegg_cases_left end section variable {d : β„•} def Nonneg : β„€βˆšd β†’ Prop | ⟨a, b⟩ => Nonnegg d 1 a b #align zsqrtd.nonneg Zsqrtd.Nonneg instance : LE (β„€βˆšd) := ⟨fun a b => Nonneg (b - a)⟩ instance : LT (β„€βˆšd) := ⟨fun a b => Β¬b ≀ a⟩ instance decidableNonnegg (c d a b) : Decidable (Nonnegg c d a b) := by cases a <;> cases b <;> unfold Nonnegg SqLe <;> infer_instance #align zsqrtd.decidable_nonnegg Zsqrtd.decidableNonnegg instance decidableNonneg : βˆ€ a : β„€βˆšd, Decidable (Nonneg a) | ⟨_, _⟩ => Zsqrtd.decidableNonnegg _ _ _ _ #align zsqrtd.decidable_nonneg Zsqrtd.decidableNonneg instance decidableLE : @DecidableRel (β„€βˆšd) (Β· ≀ Β·) := fun _ _ => decidableNonneg _ #align zsqrtd.decidable_le Zsqrtd.decidableLE open Int in theorem nonneg_cases : βˆ€ {a : β„€βˆšd}, Nonneg a β†’ βˆƒ x y : β„•, a = ⟨x, y⟩ ∨ a = ⟨x, -y⟩ ∨ a = ⟨-x, y⟩ | ⟨(x : β„•), (y : β„•)⟩, _ => ⟨x, y, Or.inl rfl⟩ | ⟨(x : β„•), -[y+1]⟩, _ => ⟨x, y + 1, Or.inr <| Or.inl rfl⟩ | ⟨-[x+1], (y : β„•)⟩, _ => ⟨x + 1, y, Or.inr <| Or.inr rfl⟩ | ⟨-[_+1], -[_+1]⟩, h => False.elim h #align zsqrtd.nonneg_cases Zsqrtd.nonneg_cases open Int in theorem nonneg_add_lem {x y z w : β„•} (xy : Nonneg (⟨x, -y⟩ : β„€βˆšd)) (zw : Nonneg (⟨-z, w⟩ : β„€βˆšd)) : Nonneg (⟨x, -y⟩ + ⟨-z, w⟩ : β„€βˆšd) := by have : Nonneg ⟨Int.subNatNat x z, Int.subNatNat w y⟩ := Int.subNatNat_elim x z (fun m n i => SqLe y d m 1 β†’ SqLe n 1 w d β†’ Nonneg ⟨i, Int.subNatNat w y⟩) (fun j k => Int.subNatNat_elim w y (fun m n i => SqLe n d (k + j) 1 β†’ SqLe k 1 m d β†’ Nonneg ⟨Int.ofNat j, i⟩) (fun _ _ _ _ => trivial) fun m n xy zw => sqLe_cancel zw xy) (fun j k => Int.subNatNat_elim w y (fun m n i => SqLe n d k 1 β†’ SqLe (k + j + 1) 1 m d β†’ Nonneg ⟨-[j+1], i⟩) (fun m n xy zw => sqLe_cancel xy zw) fun m n xy zw => let t := Nat.le_trans zw (sqLe_of_le (Nat.le_add_right n (m + 1)) le_rfl xy) have : k + j + 1 ≀ k := Nat.mul_self_le_mul_self_iff.1 (by simpa [one_mul] using t) absurd this (not_le_of_gt <| Nat.succ_le_succ <| Nat.le_add_right _ _)) (nonnegg_pos_neg.1 xy) (nonnegg_neg_pos.1 zw) rw [add_def, neg_add_eq_sub] rwa [Int.subNatNat_eq_coe, Int.subNatNat_eq_coe] at this #align zsqrtd.nonneg_add_lem Zsqrtd.nonneg_add_lem theorem Nonneg.add {a b : β„€βˆšd} (ha : Nonneg a) (hb : Nonneg b) : Nonneg (a + b) := by rcases nonneg_cases ha with ⟨x, y, rfl | rfl | rfl⟩ <;> rcases nonneg_cases hb with ⟨z, w, rfl | rfl | rfl⟩ Β· trivial Β· refine nonnegg_cases_right fun i h => sqLe_of_le ?_ ?_ (nonnegg_pos_neg.1 hb) Β· dsimp only at h exact Int.ofNat_le.1 (le_of_neg_le_neg (Int.le.intro y (by simp [add_comm, *]))) Β· apply Nat.le_add_left Β· refine nonnegg_cases_left fun i h => sqLe_of_le ?_ ?_ (nonnegg_neg_pos.1 hb) Β· dsimp only at h exact Int.ofNat_le.1 (le_of_neg_le_neg (Int.le.intro x (by simp [add_comm, *]))) Β· apply Nat.le_add_left Β· refine nonnegg_cases_right fun i h => sqLe_of_le ?_ ?_ (nonnegg_pos_neg.1 ha) Β· dsimp only at h exact Int.ofNat_le.1 (le_of_neg_le_neg (Int.le.intro w (by simp [*]))) Β· apply Nat.le_add_right Β· have : Nonneg ⟨_, _⟩ := nonnegg_pos_neg.2 (sqLe_add (nonnegg_pos_neg.1 ha) (nonnegg_pos_neg.1 hb)) rw [Nat.cast_add, Nat.cast_add, neg_add] at this rwa [add_def] -- Porting note: was -- simpa [add_comm] using -- nonnegg_pos_neg.2 (sqLe_add (nonnegg_pos_neg.1 ha) (nonnegg_pos_neg.1 hb)) Β· exact nonneg_add_lem ha hb Β· refine nonnegg_cases_left fun i h => sqLe_of_le ?_ ?_ (nonnegg_neg_pos.1 ha) Β· dsimp only at h exact Int.ofNat_le.1 (le_of_neg_le_neg (Int.le.intro _ h)) Β· apply Nat.le_add_right Β· dsimp rw [add_comm, add_comm (y : β„€)] exact nonneg_add_lem hb ha Β· have : Nonneg ⟨_, _⟩ := nonnegg_neg_pos.2 (sqLe_add (nonnegg_neg_pos.1 ha) (nonnegg_neg_pos.1 hb)) rw [Nat.cast_add, Nat.cast_add, neg_add] at this rwa [add_def] -- Porting note: was -- simpa [add_comm] using -- nonnegg_neg_pos.2 (sqLe_add (nonnegg_neg_pos.1 ha) (nonnegg_neg_pos.1 hb)) #align zsqrtd.nonneg.add Zsqrtd.Nonneg.add theorem nonneg_iff_zero_le {a : β„€βˆšd} : Nonneg a ↔ 0 ≀ a := show _ ↔ Nonneg _ by simp #align zsqrtd.nonneg_iff_zero_le Zsqrtd.nonneg_iff_zero_le theorem le_of_le_le {x y z w : β„€} (xz : x ≀ z) (yw : y ≀ w) : (⟨x, y⟩ : β„€βˆšd) ≀ ⟨z, w⟩ := show Nonneg ⟨z - x, w - y⟩ from match z - x, w - y, Int.le.dest_sub xz, Int.le.dest_sub yw with | _, _, ⟨_, rfl⟩, ⟨_, rfl⟩ => trivial #align zsqrtd.le_of_le_le Zsqrtd.le_of_le_le open Int in protected theorem nonneg_total : βˆ€ a : β„€βˆšd, Nonneg a ∨ Nonneg (-a) | ⟨(x : β„•), (y : β„•)⟩ => Or.inl trivial | ⟨-[_+1], -[_+1]⟩ => Or.inr trivial | ⟨0, -[_+1]⟩ => Or.inr trivial | ⟨-[_+1], 0⟩ => Or.inr trivial | ⟨(_ + 1 : β„•), -[_+1]⟩ => Nat.le_total _ _ | ⟨-[_+1], (_ + 1 : β„•)⟩ => Nat.le_total _ _ #align zsqrtd.nonneg_total Zsqrtd.nonneg_total protected theorem le_total (a b : β„€βˆšd) : a ≀ b ∨ b ≀ a := by have t := (b - a).nonneg_total rwa [neg_sub] at t #align zsqrtd.le_total Zsqrtd.le_total instance preorder : Preorder (β„€βˆšd) where le := (Β· ≀ Β·) le_refl a := show Nonneg (a - a) by simp only [sub_self]; trivial le_trans a b c hab hbc := by simpa [sub_add_sub_cancel'] using hab.add hbc lt := (Β· < Β·) lt_iff_le_not_le a b := (and_iff_right_of_imp (Zsqrtd.le_total _ _).resolve_left).symm open Int in theorem le_arch (a : β„€βˆšd) : βˆƒ n : β„•, a ≀ n := by obtain ⟨x, y, (h : a ≀ ⟨x, y⟩)⟩ : βˆƒ x y : β„•, Nonneg (⟨x, y⟩ + -a) := match -a with | ⟨Int.ofNat x, Int.ofNat y⟩ => ⟨0, 0, by trivial⟩ | ⟨Int.ofNat x, -[y+1]⟩ => ⟨0, y + 1, by simp [add_def, Int.negSucc_coe, add_assoc]; trivial⟩ | ⟨-[x+1], Int.ofNat y⟩ => ⟨x + 1, 0, by simp [Int.negSucc_coe, add_assoc]; trivial⟩ | ⟨-[x+1], -[y+1]⟩ => ⟨x + 1, y + 1, by simp [Int.negSucc_coe, add_assoc]; trivial⟩ refine ⟨x + d * y, h.trans ?_⟩ change Nonneg βŸ¨β†‘x + d * y - ↑x, 0 - ↑y⟩ cases' y with y Β· simp trivial have h : βˆ€ y, SqLe y d (d * y) 1 := fun y => by simpa [SqLe, mul_comm, mul_left_comm] using Nat.mul_le_mul_right (y * y) (Nat.le_mul_self d) rw [show (x : β„€) + d * Nat.succ y - x = d * Nat.succ y by simp] exact h (y + 1) #align zsqrtd.le_arch Zsqrtd.le_arch protected theorem add_le_add_left (a b : β„€βˆšd) (ab : a ≀ b) (c : β„€βˆšd) : c + a ≀ c + b := show Nonneg _ by rw [add_sub_add_left_eq_sub]; exact ab #align zsqrtd.add_le_add_left Zsqrtd.add_le_add_left protected theorem le_of_add_le_add_left (a b c : β„€βˆšd) (h : c + a ≀ c + b) : a ≀ b := by simpa using Zsqrtd.add_le_add_left _ _ h (-c) #align zsqrtd.le_of_add_le_add_left Zsqrtd.le_of_add_le_add_left protected theorem add_lt_add_left (a b : β„€βˆšd) (h : a < b) (c) : c + a < c + b := fun h' => h (Zsqrtd.le_of_add_le_add_left _ _ _ h') #align zsqrtd.add_lt_add_left Zsqrtd.add_lt_add_left theorem nonneg_smul {a : β„€βˆšd} {n : β„•} (ha : Nonneg a) : Nonneg ((n : β„€βˆšd) * a) := by rw [← Int.cast_natCast n] exact match a, nonneg_cases ha, ha with | _, ⟨x, y, Or.inl rfl⟩, _ => by rw [smul_val]; trivial | _, ⟨x, y, Or.inr <| Or.inl rfl⟩, ha => by rw [smul_val]; simpa using nonnegg_pos_neg.2 (sqLe_smul n <| nonnegg_pos_neg.1 ha) | _, ⟨x, y, Or.inr <| Or.inr rfl⟩, ha => by rw [smul_val]; simpa using nonnegg_neg_pos.2 (sqLe_smul n <| nonnegg_neg_pos.1 ha) #align zsqrtd.nonneg_smul Zsqrtd.nonneg_smul theorem nonneg_muld {a : β„€βˆšd} (ha : Nonneg a) : Nonneg (sqrtd * a) := match a, nonneg_cases ha, ha with | _, ⟨_, _, Or.inl rfl⟩, _ => trivial | _, ⟨x, y, Or.inr <| Or.inl rfl⟩, ha => by simp only [muld_val, mul_neg] apply nonnegg_neg_pos.2 simpa [SqLe, mul_comm, mul_left_comm] using Nat.mul_le_mul_left d (nonnegg_pos_neg.1 ha) | _, ⟨x, y, Or.inr <| Or.inr rfl⟩, ha => by simp only [muld_val] apply nonnegg_pos_neg.2 simpa [SqLe, mul_comm, mul_left_comm] using Nat.mul_le_mul_left d (nonnegg_neg_pos.1 ha) #align zsqrtd.nonneg_muld Zsqrtd.nonneg_muld theorem nonneg_mul_lem {x y : β„•} {a : β„€βˆšd} (ha : Nonneg a) : Nonneg (⟨x, y⟩ * a) := by have : (⟨x, y⟩ * a : β„€βˆšd) = (x : β„€βˆšd) * a + sqrtd * ((y : β„€βˆšd) * a) := by rw [decompose, right_distrib, mul_assoc, Int.cast_natCast, Int.cast_natCast] rw [this] exact (nonneg_smul ha).add (nonneg_muld <| nonneg_smul ha) #align zsqrtd.nonneg_mul_lem Zsqrtd.nonneg_mul_lem
Mathlib/NumberTheory/Zsqrtd/Basic.lean
813
848
theorem nonneg_mul {a b : β„€βˆšd} (ha : Nonneg a) (hb : Nonneg b) : Nonneg (a * b) := match a, b, nonneg_cases ha, nonneg_cases hb, ha, hb with | _, _, ⟨_, _, Or.inl rfl⟩, ⟨_, _, Or.inl rfl⟩, _, _ => trivial | _, _, ⟨x, y, Or.inl rfl⟩, ⟨z, w, Or.inr <| Or.inr rfl⟩, _, hb => nonneg_mul_lem hb | _, _, ⟨x, y, Or.inl rfl⟩, ⟨z, w, Or.inr <| Or.inl rfl⟩, _, hb => nonneg_mul_lem hb | _, _, ⟨x, y, Or.inr <| Or.inr rfl⟩, ⟨z, w, Or.inl rfl⟩, ha, _ => by rw [mul_comm]; exact nonneg_mul_lem ha | _, _, ⟨x, y, Or.inr <| Or.inl rfl⟩, ⟨z, w, Or.inl rfl⟩, ha, _ => by rw [mul_comm]; exact nonneg_mul_lem ha | _, _, ⟨x, y, Or.inr <| Or.inr rfl⟩, ⟨z, w, Or.inr <| Or.inr rfl⟩, ha, hb => by rw [calc (⟨-x, y⟩ * ⟨-z, w⟩ : β„€βˆšd) = ⟨_, _⟩ := rfl _ = ⟨x * z + d * y * w, -(x * w + y * z)⟩ := by
simp [add_comm] ] exact nonnegg_pos_neg.2 (sqLe_mul.left (nonnegg_neg_pos.1 ha) (nonnegg_neg_pos.1 hb)) | _, _, ⟨x, y, Or.inr <| Or.inr rfl⟩, ⟨z, w, Or.inr <| Or.inl rfl⟩, ha, hb => by rw [calc (⟨-x, y⟩ * ⟨z, -w⟩ : β„€βˆšd) = ⟨_, _⟩ := rfl _ = ⟨-(x * z + d * y * w), x * w + y * z⟩ := by simp [add_comm] ] exact nonnegg_neg_pos.2 (sqLe_mul.right.left (nonnegg_neg_pos.1 ha) (nonnegg_pos_neg.1 hb)) | _, _, ⟨x, y, Or.inr <| Or.inl rfl⟩, ⟨z, w, Or.inr <| Or.inr rfl⟩, ha, hb => by rw [calc (⟨x, -y⟩ * ⟨-z, w⟩ : β„€βˆšd) = ⟨_, _⟩ := rfl _ = ⟨-(x * z + d * y * w), x * w + y * z⟩ := by simp [add_comm] ] exact nonnegg_neg_pos.2 (sqLe_mul.right.right.left (nonnegg_pos_neg.1 ha) (nonnegg_neg_pos.1 hb)) | _, _, ⟨x, y, Or.inr <| Or.inl rfl⟩, ⟨z, w, Or.inr <| Or.inl rfl⟩, ha, hb => by rw [calc (⟨x, -y⟩ * ⟨z, -w⟩ : β„€βˆšd) = ⟨_, _⟩ := rfl _ = ⟨x * z + d * y * w, -(x * w + y * z)⟩ := by simp [add_comm] ] exact nonnegg_pos_neg.2 (sqLe_mul.right.right.right (nonnegg_pos_neg.1 ha) (nonnegg_pos_neg.1 hb))
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Group.Int import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Algebra.Ring.Rat import Mathlib.Data.PNat.Defs #align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11" namespace Rat open Rat theorem num_dvd (a) {b : β„€} (b0 : b β‰  0) : (a /. b).num ∣ a := by cases' e : a /. b with n d h c rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.dvd_of_dvd_mul_right ?_ have := congr_arg Int.natAbs e simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this] #align rat.num_dvd Rat.num_dvd theorem den_dvd (a b : β„€) : ((a /. b).den : β„€) ∣ b := by by_cases b0 : b = 0; Β· simp [b0] cases' e : a /. b with n d h c rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_ rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp #align rat.denom_dvd Rat.den_dvd theorem num_den_mk {q : β„š} {n d : β„€} (hd : d β‰  0) (qdf : q = n /. d) : βˆƒ c : β„€, n = c * q.num ∧ d = c * q.den := by obtain rfl | hn := eq_or_ne n 0 Β· simp [qdf] have : q.num * d = n * ↑q.den := by refine (divInt_eq_iff ?_ hd).mp ?_ Β· exact Int.natCast_ne_zero.mpr (Rat.den_nz _) Β· rwa [num_divInt_den] have hqdn : q.num ∣ n := by rw [qdf] exact Rat.num_dvd _ hd refine ⟨n / q.num, ?_, ?_⟩ Β· rw [Int.ediv_mul_cancel hqdn] Β· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this rw [qdf] exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn) #align rat.num_denom_mk Rat.num_den_mk #noalign rat.mk_pnat_num #noalign rat.mk_pnat_denom theorem num_mk (n d : β„€) : (n /. d).num = d.sign * n / n.gcd d := by have (m : β„•) : Int.natAbs (m + 1) = m + 1 := by rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast] rcases d with ((_ | _) | _) <;> rw [← Int.div_eq_ediv_of_dvd] <;> simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd, Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this] #align rat.num_mk Rat.num_mk theorem den_mk (n d : β„€) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by have (m : β„•) : Int.natAbs (m + 1) = m + 1 := by rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast] rcases d with ((_ | _) | _) <;> simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd, if_neg (Nat.cast_add_one_ne_zero _), this] #align rat.denom_mk Rat.den_mk #noalign rat.mk_pnat_denom_dvd theorem add_den_dvd (q₁ qβ‚‚ : β„š) : (q₁ + qβ‚‚).den ∣ q₁.den * qβ‚‚.den := by rw [add_def, normalize_eq] apply Nat.div_dvd_of_dvd apply Nat.gcd_dvd_right #align rat.add_denom_dvd Rat.add_den_dvd theorem mul_den_dvd (q₁ qβ‚‚ : β„š) : (q₁ * qβ‚‚).den ∣ q₁.den * qβ‚‚.den := by rw [mul_def, normalize_eq] apply Nat.div_dvd_of_dvd apply Nat.gcd_dvd_right #align rat.mul_denom_dvd Rat.mul_den_dvd theorem mul_num (q₁ qβ‚‚ : β„š) : (q₁ * qβ‚‚).num = q₁.num * qβ‚‚.num / Nat.gcd (q₁.num * qβ‚‚.num).natAbs (q₁.den * qβ‚‚.den) := by rw [mul_def, normalize_eq] #align rat.mul_num Rat.mul_num
Mathlib/Data/Rat/Lemmas.lean
98
101
theorem mul_den (q₁ qβ‚‚ : β„š) : (q₁ * qβ‚‚).den = q₁.den * qβ‚‚.den / Nat.gcd (q₁.num * qβ‚‚.num).natAbs (q₁.den * qβ‚‚.den) := by
rw [mul_def, normalize_eq]
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Analysis.NormedSpace.Real #align_import analysis.special_functions.log.basic from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def log (x : ℝ) : ℝ := if hx : x = 0 then 0 else expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ #align real.log Real.log theorem log_of_ne_zero (hx : x β‰  0) : log x = expOrderIso.symm ⟨|x|, abs_pos.2 hx⟩ := dif_neg hx #align real.log_of_ne_zero Real.log_of_ne_zero theorem log_of_pos (hx : 0 < x) : log x = expOrderIso.symm ⟨x, hx⟩ := by rw [log_of_ne_zero hx.ne'] congr exact abs_of_pos hx #align real.log_of_pos Real.log_of_pos theorem exp_log_eq_abs (hx : x β‰  0) : exp (log x) = |x| := by rw [log_of_ne_zero hx, ← coe_expOrderIso_apply, OrderIso.apply_symm_apply, Subtype.coe_mk] #align real.exp_log_eq_abs Real.exp_log_eq_abs theorem exp_log (hx : 0 < x) : exp (log x) = x := by rw [exp_log_eq_abs hx.ne'] exact abs_of_pos hx #align real.exp_log Real.exp_log theorem exp_log_of_neg (hx : x < 0) : exp (log x) = -x := by rw [exp_log_eq_abs (ne_of_lt hx)] exact abs_of_neg hx #align real.exp_log_of_neg Real.exp_log_of_neg theorem le_exp_log (x : ℝ) : x ≀ exp (log x) := by by_cases h_zero : x = 0 Β· rw [h_zero, log, dif_pos rfl, exp_zero] exact zero_le_one Β· rw [exp_log_eq_abs h_zero] exact le_abs_self _ #align real.le_exp_log Real.le_exp_log @[simp] theorem log_exp (x : ℝ) : log (exp x) = x := exp_injective <| exp_log (exp_pos x) #align real.log_exp Real.log_exp theorem surjOn_log : SurjOn log (Ioi 0) univ := fun x _ => ⟨exp x, exp_pos x, log_exp x⟩ #align real.surj_on_log Real.surjOn_log theorem log_surjective : Surjective log := fun x => ⟨exp x, log_exp x⟩ #align real.log_surjective Real.log_surjective @[simp] theorem range_log : range log = univ := log_surjective.range_eq #align real.range_log Real.range_log @[simp] theorem log_zero : log 0 = 0 := dif_pos rfl #align real.log_zero Real.log_zero @[simp] theorem log_one : log 1 = 0 := exp_injective <| by rw [exp_log zero_lt_one, exp_zero] #align real.log_one Real.log_one @[simp]
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
104
107
theorem log_abs (x : ℝ) : log |x| = log x := by
by_cases h : x = 0 Β· simp [h] Β· rw [← exp_eq_exp, exp_log_eq_abs h, exp_log_eq_abs (abs_pos.2 h).ne', abs_abs]
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian import Mathlib.RingTheory.ChainOfDivisors import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.FractionalIdeal.Operations #align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial section Inverse namespace FractionalIdeal variable {R₁ : Type*} [CommRing R₁] [IsDomain R₁] [Algebra R₁ K] [IsFractionRing R₁ K] variable {I J : FractionalIdeal R₁⁰ K} noncomputable instance : Inv (FractionalIdeal R₁⁰ K) := ⟨fun I => 1 / I⟩ theorem inv_eq : I⁻¹ = 1 / I := rfl #align fractional_ideal.inv_eq FractionalIdeal.inv_eq theorem inv_zero' : (0 : FractionalIdeal R₁⁰ K)⁻¹ = 0 := div_zero #align fractional_ideal.inv_zero' FractionalIdeal.inv_zero' theorem inv_nonzero {J : FractionalIdeal R₁⁰ K} (h : J β‰  0) : J⁻¹ = ⟨(1 : FractionalIdeal R₁⁰ K) / J, fractional_div_of_nonzero h⟩ := div_nonzero h #align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero theorem coe_inv_of_nonzero {J : FractionalIdeal R₁⁰ K} (h : J β‰  0) : (↑J⁻¹ : Submodule R₁ K) = IsLocalization.coeSubmodule K ⊀ / (J : Submodule R₁ K) := by simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top] #align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero variable {K} theorem mem_inv_iff (hI : I β‰  0) {x : K} : x ∈ I⁻¹ ↔ βˆ€ y ∈ I, x * y ∈ (1 : FractionalIdeal R₁⁰ K) := mem_div_iff_of_nonzero hI #align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff theorem inv_anti_mono (hI : I β‰  0) (hJ : J β‰  0) (hIJ : I ≀ J) : J⁻¹ ≀ I⁻¹ := by -- Porting note: in Lean3, introducing `x` would just give `x ∈ J⁻¹ β†’ x ∈ I⁻¹`, but -- in Lean4, it goes all the way down to the subtypes intro x simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI] exact fun h y hy => h y (hIJ hy) #align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono theorem le_self_mul_inv {I : FractionalIdeal R₁⁰ K} (hI : I ≀ (1 : FractionalIdeal R₁⁰ K)) : I ≀ I * I⁻¹ := le_self_mul_one_div hI #align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv variable (K) theorem coe_ideal_le_self_mul_inv (I : Ideal R₁) : (I : FractionalIdeal R₁⁰ K) ≀ I * (I : FractionalIdeal R₁⁰ K)⁻¹ := le_self_mul_inv coeIdeal_le_one #align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
Mathlib/RingTheory/DedekindDomain/Ideal.lean
108
122
theorem right_inverse_eq (I J : FractionalIdeal R₁⁰ K) (h : I * J = 1) : J = I⁻¹ := by
have hI : I β‰  0 := ne_zero_of_mul_eq_one I J h suffices h' : I * (1 / I) = 1 from congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl apply le_antisymm Β· apply mul_le.mpr _ intro x hx y hy rw [mul_comm] exact (mem_div_iff_of_nonzero hI).mp hy x hx rw [← h] apply mul_left_mono I apply (le_div_iff_of_nonzero hI).mpr _ intro y hy x hx rw [mul_comm] exact mul_mem_mul hx hy
import Mathlib.Order.Interval.Set.Monotone import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic import Mathlib.Tactic.AdaptationNote #align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory Topology namespace MeasureTheory variable {Ξ© ΞΉ : Type*} {m0 : MeasurableSpace Ξ©} {ΞΌ : Measure Ξ©} noncomputable def lowerCrossingTimeAux [Preorder ΞΉ] [InfSet ΞΉ] (a : ℝ) (f : ΞΉ β†’ Ξ© β†’ ℝ) (c N : ΞΉ) : Ξ© β†’ ΞΉ := hitting f (Set.Iic a) c N #align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux noncomputable def upperCrossingTime [Preorder ΞΉ] [OrderBot ΞΉ] [InfSet ΞΉ] (a b : ℝ) (f : ΞΉ β†’ Ξ© β†’ ℝ) (N : ΞΉ) : β„• β†’ Ξ© β†’ ΞΉ | 0 => βŠ₯ | n + 1 => fun Ο‰ => hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n Ο‰) N Ο‰) N Ο‰ #align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime noncomputable def lowerCrossingTime [Preorder ΞΉ] [OrderBot ΞΉ] [InfSet ΞΉ] (a b : ℝ) (f : ΞΉ β†’ Ξ© β†’ ℝ) (N : ΞΉ) (n : β„•) : Ξ© β†’ ΞΉ := fun Ο‰ => hitting f (Set.Iic a) (upperCrossingTime a b f N n Ο‰) N Ο‰ #align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime section variable [Preorder ΞΉ] [OrderBot ΞΉ] [InfSet ΞΉ] variable {a b : ℝ} {f : ΞΉ β†’ Ξ© β†’ ℝ} {N : ΞΉ} {n m : β„•} {Ο‰ : Ξ©} @[simp] theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = βŠ₯ := rfl #align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero @[simp] theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) βŠ₯ N := rfl #align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) Ο‰ = hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n Ο‰) N Ο‰) N Ο‰ := by rw [upperCrossingTime] #align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ theorem upperCrossingTime_succ_eq (Ο‰ : Ξ©) : upperCrossingTime a b f N (n + 1) Ο‰ = hitting f (Set.Ici b) (lowerCrossingTime a b f N n Ο‰) N Ο‰ := by simp only [upperCrossingTime_succ] rfl #align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq end section ConditionallyCompleteLinearOrderBot variable [ConditionallyCompleteLinearOrderBot ΞΉ] variable {a b : ℝ} {f : ΞΉ β†’ Ξ© β†’ ℝ} {N : ΞΉ} {n m : β„•} {Ο‰ : Ξ©} theorem upperCrossingTime_le : upperCrossingTime a b f N n Ο‰ ≀ N := by cases n Β· simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq] Β· simp only [upperCrossingTime_succ, hitting_le] #align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le @[simp] theorem upperCrossingTime_zero' : upperCrossingTime a b f βŠ₯ n Ο‰ = βŠ₯ := eq_bot_iff.2 upperCrossingTime_le #align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero'
Mathlib/Probability/Martingale/Upcrossing.lean
197
198
theorem lowerCrossingTime_le : lowerCrossingTime a b f N n Ο‰ ≀ N := by
simp only [lowerCrossingTime, hitting_le Ο‰]
import Mathlib.Algebra.Algebra.Unitization import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul suppress_compilation variable (π•œ A : Type*) [NontriviallyNormedField π•œ] [NonUnitalNormedRing A] variable [NormedSpace π•œ A] [IsScalarTower π•œ A A] [SMulCommClass π•œ A A] open ContinuousLinearMap namespace Unitization def splitMul : Unitization π•œ A →ₐ[π•œ] π•œ Γ— (A β†’L[π•œ] A) := (lift 0).prod (lift <| NonUnitalAlgHom.Lmul π•œ A) variable {π•œ A} @[simp] theorem splitMul_apply (x : Unitization π•œ A) : splitMul π•œ A x = (x.fst, algebraMap π•œ (A β†’L[π•œ] A) x.fst + mul π•œ A x.snd) := show (x.fst + 0, _) = (x.fst, _) by rw [add_zero]; rfl theorem splitMul_injective_of_clm_mul_injective (h : Function.Injective (mul π•œ A)) : Function.Injective (splitMul π•œ A) := by rw [injective_iff_map_eq_zero] intro x hx induction x rw [map_add] at hx simp only [splitMul_apply, fst_inl, snd_inl, map_zero, add_zero, fst_inr, snd_inr, zero_add, Prod.mk_add_mk, Prod.mk_eq_zero] at hx obtain ⟨rfl, hx⟩ := hx simp only [map_zero, zero_add, inl_zero] at hx ⊒ rw [← map_zero (mul π•œ A)] at hx rw [h hx, inr_zero] variable [RegularNormedAlgebra π•œ A] variable (π•œ A) theorem splitMul_injective : Function.Injective (splitMul π•œ A) := splitMul_injective_of_clm_mul_injective (isometry_mul π•œ A).injective variable {π•œ A} section Aux noncomputable abbrev normedRingAux : NormedRing (Unitization π•œ A) := NormedRing.induced (Unitization π•œ A) (π•œ Γ— (A β†’L[π•œ] A)) (splitMul π•œ A) (splitMul_injective π•œ A) attribute [local instance] Unitization.normedRingAux noncomputable abbrev normedAlgebraAux : NormedAlgebra π•œ (Unitization π•œ A) := NormedAlgebra.induced π•œ (Unitization π•œ A) (π•œ Γ— (A β†’L[π•œ] A)) (splitMul π•œ A) attribute [local instance] Unitization.normedAlgebraAux theorem norm_def (x : Unitization π•œ A) : β€–xβ€– = β€–splitMul π•œ A xβ€– := rfl theorem nnnorm_def (x : Unitization π•œ A) : β€–xβ€–β‚Š = β€–splitMul π•œ A xβ€–β‚Š := rfl
Mathlib/Analysis/NormedSpace/Unitization.lean
139
141
theorem norm_eq_sup (x : Unitization π•œ A) : β€–xβ€– = β€–x.fstβ€– βŠ” β€–algebraMap π•œ (A β†’L[π•œ] A) x.fst + mul π•œ A x.sndβ€– := by
rw [norm_def, splitMul_apply, Prod.norm_def, sup_eq_max]
import Mathlib.RingTheory.TensorProduct.Basic #align_import algebra.module.bimodule from "leanprover-community/mathlib"@"58cef51f7a819e7227224461e392dee423302f2d" open TensorProduct attribute [local instance] TensorProduct.Algebra.module namespace Subbimodule section Algebra variable {R A B M : Type*} variable [CommSemiring R] [AddCommMonoid M] [Module R M] variable [Semiring A] [Semiring B] [Module A M] [Module B M] variable [Algebra R A] [Algebra R B] variable [IsScalarTower R A M] [IsScalarTower R B M] variable [SMulCommClass A B M] @[simps] def mk (p : AddSubmonoid M) (hA : βˆ€ (a : A) {m : M}, m ∈ p β†’ a β€’ m ∈ p) (hB : βˆ€ (b : B) {m : M}, m ∈ p β†’ b β€’ m ∈ p) : Submodule (A βŠ—[R] B) M := { p with carrier := p smul_mem' := fun ab m => TensorProduct.induction_on ab (fun _ => by simpa only [zero_smul] using p.zero_mem) (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm)) fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) } #align subbimodule.mk Subbimodule.mk theorem smul_mem (p : Submodule (A βŠ—[R] B) M) (a : A) {m : M} (hm : m ∈ p) : a β€’ m ∈ p := by suffices a β€’ m = a βŠ—β‚œ[R] (1 : B) β€’ m by exact this.symm β–Έ p.smul_mem _ hm simp [TensorProduct.Algebra.smul_def] #align subbimodule.smul_mem Subbimodule.smul_mem
Mathlib/Algebra/Module/Bimodule.lean
95
97
theorem smul_mem' (p : Submodule (A βŠ—[R] B) M) (b : B) {m : M} (hm : m ∈ p) : b β€’ m ∈ p := by
suffices b β€’ m = (1 : A) βŠ—β‚œ[R] b β€’ m by exact this.symm β–Έ p.smul_mem _ hm simp [TensorProduct.Algebra.smul_def]
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.MeasureTheory.Function.SimpleFunc import Mathlib.MeasureTheory.Measure.MutuallySingular import Mathlib.MeasureTheory.Measure.Count import Mathlib.Topology.IndicatorConstPointwise import Mathlib.MeasureTheory.Constructions.BorelSpace.Real #align_import measure_theory.integral.lebesgue from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" assert_not_exists NormedSpace set_option autoImplicit true noncomputable section open Set hiding restrict restrict_apply open Filter ENNReal open Function (support) open scoped Classical open Topology NNReal ENNReal MeasureTheory namespace MeasureTheory local infixr:25 " β†’β‚› " => SimpleFunc variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} section Lintegral open SimpleFunc variable {m : MeasurableSpace Ξ±} {ΞΌ Ξ½ : Measure Ξ±} irreducible_def lintegral {_ : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (f : Ξ± β†’ ℝβ‰₯0∞) : ℝβ‰₯0∞ := ⨆ (g : Ξ± β†’β‚› ℝβ‰₯0∞) (_ : ⇑g ≀ f), g.lintegral ΞΌ #align measure_theory.lintegral MeasureTheory.lintegral @[inherit_doc MeasureTheory.lintegral] notation3 "∫⁻ "(...)", "r:60:(scoped f => f)" βˆ‚"ΞΌ:70 => lintegral ΞΌ r @[inherit_doc MeasureTheory.lintegral] notation3 "∫⁻ "(...)", "r:60:(scoped f => lintegral volume f) => r @[inherit_doc MeasureTheory.lintegral] notation3"∫⁻ "(...)" in "s", "r:60:(scoped f => f)" βˆ‚"ΞΌ:70 => lintegral (Measure.restrict ΞΌ s) r @[inherit_doc MeasureTheory.lintegral] notation3"∫⁻ "(...)" in "s", "r:60:(scoped f => lintegral (Measure.restrict volume s) f) => r theorem SimpleFunc.lintegral_eq_lintegral {m : MeasurableSpace Ξ±} (f : Ξ± β†’β‚› ℝβ‰₯0∞) (ΞΌ : Measure Ξ±) : ∫⁻ a, f a βˆ‚ΞΌ = f.lintegral ΞΌ := by rw [MeasureTheory.lintegral] exact le_antisymm (iSupβ‚‚_le fun g hg => lintegral_mono hg <| le_rfl) (le_iSupβ‚‚_of_le f le_rfl le_rfl) #align measure_theory.simple_func.lintegral_eq_lintegral MeasureTheory.SimpleFunc.lintegral_eq_lintegral @[mono]
Mathlib/MeasureTheory/Integral/Lebesgue.lean
90
93
theorem lintegral_mono' {m : MeasurableSpace Ξ±} ⦃μ Ξ½ : Measure α⦄ (hΞΌΞ½ : ΞΌ ≀ Ξ½) ⦃f g : Ξ± β†’ ℝβ‰₯0βˆžβ¦„ (hfg : f ≀ g) : ∫⁻ a, f a βˆ‚ΞΌ ≀ ∫⁻ a, g a βˆ‚Ξ½ := by
rw [lintegral, lintegral] exact iSup_mono fun Ο† => iSup_mono' fun hΟ† => ⟨le_trans hΟ† hfg, lintegral_mono (le_refl Ο†) hμν⟩
import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.Bicategory.Free import Mathlib.CategoryTheory.Bicategory.LocallyDiscrete #align_import category_theory.bicategory.coherence from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff" open Quiver (Path) open Quiver.Path namespace CategoryTheory open Bicategory Category universe v u namespace FreeBicategory variable {B : Type u} [Quiver.{v + 1} B] @[simp] def inclusionPathAux {a : B} : βˆ€ {b : B}, Path a b β†’ Hom a b | _, nil => Hom.id a | _, cons p f => (inclusionPathAux p).comp (Hom.of f) #align category_theory.free_bicategory.inclusion_path_aux CategoryTheory.FreeBicategory.inclusionPathAux local instance homCategory' (a b : B) : Category (Hom a b) := homCategory a b def inclusionPath (a b : B) : Discrete (Path.{v + 1} a b) β₯€ Hom a b := Discrete.functor inclusionPathAux #align category_theory.free_bicategory.inclusion_path CategoryTheory.FreeBicategory.inclusionPath def preinclusion (B : Type u) [Quiver.{v + 1} B] : PrelaxFunctor (LocallyDiscrete (Paths B)) (FreeBicategory B) where obj a := a.as map := @fun a b f => (@inclusionPath B _ a.as b.as).obj f mapβ‚‚ Ξ· := (inclusionPath _ _).map Ξ· #align category_theory.free_bicategory.preinclusion CategoryTheory.FreeBicategory.preinclusion @[simp] theorem preinclusion_obj (a : B) : (preinclusion B).obj ⟨a⟩ = a := rfl #align category_theory.free_bicategory.preinclusion_obj CategoryTheory.FreeBicategory.preinclusion_obj @[simp]
Mathlib/CategoryTheory/Bicategory/Coherence.lean
94
98
theorem preinclusion_mapβ‚‚ {a b : B} (f g : Discrete (Path.{v + 1} a b)) (Ξ· : f ⟢ g) : (preinclusion B).mapβ‚‚ Ξ· = eqToHom (congr_arg _ (Discrete.ext _ _ (Discrete.eq_of_hom Ξ·))) := by
rcases η with ⟨⟨⟩⟩ cases Discrete.ext _ _ (by assumption) convert (inclusionPath a b).map_id _
import Mathlib.Topology.Compactness.SigmaCompact import Mathlib.Topology.Connected.TotallyDisconnected import Mathlib.Topology.Inseparable #align_import topology.separation from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d" open Function Set Filter Topology TopologicalSpace open scoped Classical universe u v variable {X : Type*} {Y : Type*} [TopologicalSpace X] section Separation def SeparatedNhds : Set X β†’ Set X β†’ Prop := fun s t : Set X => βˆƒ U V : Set X, IsOpen U ∧ IsOpen V ∧ s βŠ† U ∧ t βŠ† V ∧ Disjoint U V #align separated_nhds SeparatedNhds theorem separatedNhds_iff_disjoint {s t : Set X} : SeparatedNhds s t ↔ Disjoint (𝓝˒ s) (𝓝˒ t) := by simp only [(hasBasis_nhdsSet s).disjoint_iff (hasBasis_nhdsSet t), SeparatedNhds, exists_prop, ← exists_and_left, and_assoc, and_comm, and_left_comm] #align separated_nhds_iff_disjoint separatedNhds_iff_disjoint alias ⟨SeparatedNhds.disjoint_nhdsSet, _⟩ := separatedNhds_iff_disjoint class T0Space (X : Type u) [TopologicalSpace X] : Prop where t0 : βˆ€ ⦃x y : X⦄, Inseparable x y β†’ x = y #align t0_space T0Space theorem t0Space_iff_inseparable (X : Type u) [TopologicalSpace X] : T0Space X ↔ βˆ€ x y : X, Inseparable x y β†’ x = y := ⟨fun ⟨h⟩ => h, fun h => ⟨h⟩⟩ #align t0_space_iff_inseparable t0Space_iff_inseparable theorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] : T0Space X ↔ Pairwise fun x y : X => Β¬Inseparable x y := by simp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise] #align t0_space_iff_not_inseparable t0Space_iff_not_inseparable theorem Inseparable.eq [T0Space X] {x y : X} (h : Inseparable x y) : x = y := T0Space.t0 h #align inseparable.eq Inseparable.eq protected theorem Inducing.injective [TopologicalSpace Y] [T0Space X] {f : X β†’ Y} (hf : Inducing f) : Injective f := fun _ _ h => (hf.inseparable_iff.1 <| .of_eq h).eq #align inducing.injective Inducing.injective protected theorem Inducing.embedding [TopologicalSpace Y] [T0Space X] {f : X β†’ Y} (hf : Inducing f) : Embedding f := ⟨hf, hf.injective⟩ #align inducing.embedding Inducing.embedding lemma embedding_iff_inducing [TopologicalSpace Y] [T0Space X] {f : X β†’ Y} : Embedding f ↔ Inducing f := ⟨Embedding.toInducing, Inducing.embedding⟩ #align embedding_iff_inducing embedding_iff_inducing theorem t0Space_iff_nhds_injective (X : Type u) [TopologicalSpace X] : T0Space X ↔ Injective (𝓝 : X β†’ Filter X) := t0Space_iff_inseparable X #align t0_space_iff_nhds_injective t0Space_iff_nhds_injective theorem nhds_injective [T0Space X] : Injective (𝓝 : X β†’ Filter X) := (t0Space_iff_nhds_injective X).1 β€Ή_β€Ί #align nhds_injective nhds_injective theorem inseparable_iff_eq [T0Space X] {x y : X} : Inseparable x y ↔ x = y := nhds_injective.eq_iff #align inseparable_iff_eq inseparable_iff_eq @[simp] theorem nhds_eq_nhds_iff [T0Space X] {a b : X} : 𝓝 a = 𝓝 b ↔ a = b := nhds_injective.eq_iff #align nhds_eq_nhds_iff nhds_eq_nhds_iff @[simp] theorem inseparable_eq_eq [T0Space X] : Inseparable = @Eq X := funextβ‚‚ fun _ _ => propext inseparable_iff_eq #align inseparable_eq_eq inseparable_eq_eq theorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)} (hb : IsTopologicalBasis b) {x y : X} : Inseparable x y ↔ βˆ€ s ∈ b, (x ∈ s ↔ y ∈ s) := ⟨fun h s hs ↦ inseparable_iff_forall_open.1 h _ (hb.isOpen hs), fun h ↦ hb.nhds_hasBasis.eq_of_same_basis <| by convert hb.nhds_hasBasis using 2 exact and_congr_right (h _)⟩ theorem TopologicalSpace.IsTopologicalBasis.eq_iff [T0Space X] {b : Set (Set X)} (hb : IsTopologicalBasis b) {x y : X} : x = y ↔ βˆ€ s ∈ b, (x ∈ s ↔ y ∈ s) := inseparable_iff_eq.symm.trans hb.inseparable_iff theorem t0Space_iff_exists_isOpen_xor'_mem (X : Type u) [TopologicalSpace X] : T0Space X ↔ Pairwise fun x y => βˆƒ U : Set X, IsOpen U ∧ Xor' (x ∈ U) (y ∈ U) := by simp only [t0Space_iff_not_inseparable, xor_iff_not_iff, not_forall, exists_prop, inseparable_iff_forall_open, Pairwise] #align t0_space_iff_exists_is_open_xor_mem t0Space_iff_exists_isOpen_xor'_mem theorem exists_isOpen_xor'_mem [T0Space X] {x y : X} (h : x β‰  y) : βˆƒ U : Set X, IsOpen U ∧ Xor' (x ∈ U) (y ∈ U) := (t0Space_iff_exists_isOpen_xor'_mem X).1 β€Ή_β€Ί h #align exists_is_open_xor_mem exists_isOpen_xor'_mem def specializationOrder (X) [TopologicalSpace X] [T0Space X] : PartialOrder X := { specializationPreorder X, PartialOrder.lift (OrderDual.toDual ∘ 𝓝) nhds_injective with } #align specialization_order specializationOrder instance SeparationQuotient.instT0Space : T0Space (SeparationQuotient X) := ⟨fun x y => Quotient.inductionOnβ‚‚' x y fun _ _ h => SeparationQuotient.mk_eq_mk.2 <| SeparationQuotient.inducing_mk.inseparable_iff.1 h⟩ theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s) (hmin : βˆ€ t, t βŠ† s β†’ t.Nonempty β†’ IsClosed t β†’ t = s) : s.Subsingleton := by clear Y -- Porting note: added refine fun x hx y hy => of_not_not fun hxy => ?_ rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩ wlog h : x ∈ U ∧ y βˆ‰ U Β· refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h) cases' h with hxU hyU have : s \ U = s := hmin (s \ U) diff_subset ⟨y, hy, hyU⟩ (hs.sdiff hUo) exact (this.symm.subset hx).2 hxU #align minimal_nonempty_closed_subsingleton minimal_nonempty_closed_subsingleton theorem minimal_nonempty_closed_eq_singleton [T0Space X] {s : Set X} (hs : IsClosed s) (hne : s.Nonempty) (hmin : βˆ€ t, t βŠ† s β†’ t.Nonempty β†’ IsClosed t β†’ t = s) : βˆƒ x, s = {x} := exists_eq_singleton_iff_nonempty_subsingleton.2 ⟨hne, minimal_nonempty_closed_subsingleton hs hmin⟩ #align minimal_nonempty_closed_eq_singleton minimal_nonempty_closed_eq_singleton theorem IsClosed.exists_closed_singleton [T0Space X] [CompactSpace X] {S : Set X} (hS : IsClosed S) (hne : S.Nonempty) : βˆƒ x : X, x ∈ S ∧ IsClosed ({x} : Set X) := by obtain ⟨V, Vsub, Vne, Vcls, hV⟩ := hS.exists_minimal_nonempty_closed_subset hne rcases minimal_nonempty_closed_eq_singleton Vcls Vne hV with ⟨x, rfl⟩ exact ⟨x, Vsub (mem_singleton x), Vcls⟩ #align is_closed.exists_closed_singleton IsClosed.exists_closed_singleton theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s) (hmin : βˆ€ t, t βŠ† s β†’ t.Nonempty β†’ IsOpen t β†’ t = s) : s.Subsingleton := by clear Y -- Porting note: added refine fun x hx y hy => of_not_not fun hxy => ?_ rcases exists_isOpen_xor'_mem hxy with ⟨U, hUo, hU⟩ wlog h : x ∈ U ∧ y βˆ‰ U Β· exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h) cases' h with hxU hyU have : s ∩ U = s := hmin (s ∩ U) inter_subset_left ⟨x, hx, hxU⟩ (hs.inter hUo) exact hyU (this.symm.subset hy).2 #align minimal_nonempty_open_subsingleton minimal_nonempty_open_subsingleton theorem minimal_nonempty_open_eq_singleton [T0Space X] {s : Set X} (hs : IsOpen s) (hne : s.Nonempty) (hmin : βˆ€ t, t βŠ† s β†’ t.Nonempty β†’ IsOpen t β†’ t = s) : βˆƒ x, s = {x} := exists_eq_singleton_iff_nonempty_subsingleton.2 ⟨hne, minimal_nonempty_open_subsingleton hs hmin⟩ #align minimal_nonempty_open_eq_singleton minimal_nonempty_open_eq_singleton theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite) (hne : s.Nonempty) (ho : IsOpen s) : βˆƒ x ∈ s, IsOpen ({x} : Set X) := by lift s to Finset X using hfin induction' s using Finset.strongInductionOn with s ihs rcases em (βˆƒ t, t βŠ‚ s ∧ t.Nonempty ∧ IsOpen (t : Set X)) with (⟨t, hts, htne, hto⟩ | ht) Β· rcases ihs t hts htne hto with ⟨x, hxt, hxo⟩ exact ⟨x, hts.1 hxt, hxo⟩ Β· -- Porting note: was `rcases minimal_nonempty_open_eq_singleton ho hne _ with ⟨x, hx⟩` -- https://github.com/leanprover/std4/issues/116 rsuffices ⟨x, hx⟩ : βˆƒ x, s.toSet = {x} Β· exact ⟨x, hx.symm β–Έ rfl, hx β–Έ ho⟩ refine minimal_nonempty_open_eq_singleton ho hne ?_ refine fun t hts htne hto => of_not_not fun hts' => ht ?_ lift t to Finset X using s.finite_toSet.subset hts exact ⟨t, ssubset_iff_subset_ne.2 ⟨hts, mt Finset.coe_inj.2 hts'⟩, htne, hto⟩ #align exists_open_singleton_of_open_finite exists_isOpen_singleton_of_isOpen_finite theorem exists_open_singleton_of_finite [T0Space X] [Finite X] [Nonempty X] : βˆƒ x : X, IsOpen ({x} : Set X) := let ⟨x, _, h⟩ := exists_isOpen_singleton_of_isOpen_finite (Set.toFinite _) univ_nonempty isOpen_univ ⟨x, h⟩ #align exists_open_singleton_of_fintype exists_open_singleton_of_finite theorem t0Space_of_injective_of_continuous [TopologicalSpace Y] {f : X β†’ Y} (hf : Function.Injective f) (hf' : Continuous f) [T0Space Y] : T0Space X := ⟨fun _ _ h => hf <| (h.map hf').eq⟩ #align t0_space_of_injective_of_continuous t0Space_of_injective_of_continuous protected theorem Embedding.t0Space [TopologicalSpace Y] [T0Space Y] {f : X β†’ Y} (hf : Embedding f) : T0Space X := t0Space_of_injective_of_continuous hf.inj hf.continuous #align embedding.t0_space Embedding.t0Space instance Subtype.t0Space [T0Space X] {p : X β†’ Prop} : T0Space (Subtype p) := embedding_subtype_val.t0Space #align subtype.t0_space Subtype.t0Space theorem t0Space_iff_or_not_mem_closure (X : Type u) [TopologicalSpace X] : T0Space X ↔ Pairwise fun a b : X => a βˆ‰ closure ({b} : Set X) ∨ b βˆ‰ closure ({a} : Set X) := by simp only [t0Space_iff_not_inseparable, inseparable_iff_mem_closure, not_and_or] #align t0_space_iff_or_not_mem_closure t0Space_iff_or_not_mem_closure instance Prod.instT0Space [TopologicalSpace Y] [T0Space X] [T0Space Y] : T0Space (X Γ— Y) := ⟨fun _ _ h => Prod.ext (h.map continuous_fst).eq (h.map continuous_snd).eq⟩ instance Pi.instT0Space {ΞΉ : Type*} {X : ΞΉ β†’ Type*} [βˆ€ i, TopologicalSpace (X i)] [βˆ€ i, T0Space (X i)] : T0Space (βˆ€ i, X i) := ⟨fun _ _ h => funext fun i => (h.map (continuous_apply i)).eq⟩ #align pi.t0_space Pi.instT0Space instance ULift.instT0Space [T0Space X] : T0Space (ULift X) := embedding_uLift_down.t0Space theorem T0Space.of_cover (h : βˆ€ x y, Inseparable x y β†’ βˆƒ s : Set X, x ∈ s ∧ y ∈ s ∧ T0Space s) : T0Space X := by refine ⟨fun x y hxy => ?_⟩ rcases h x y hxy with ⟨s, hxs, hys, hs⟩ lift x to s using hxs; lift y to s using hys rw [← subtype_inseparable_iff] at hxy exact congr_arg Subtype.val hxy.eq #align t0_space.of_cover T0Space.of_cover theorem T0Space.of_open_cover (h : βˆ€ x, βˆƒ s : Set X, x ∈ s ∧ IsOpen s ∧ T0Space s) : T0Space X := T0Space.of_cover fun x _ hxy => let ⟨s, hxs, hso, hs⟩ := h x ⟨s, hxs, (hxy.mem_open_iff hso).1 hxs, hs⟩ #align t0_space.of_open_cover T0Space.of_open_cover @[mk_iff] class R0Space (X : Type u) [TopologicalSpace X] : Prop where specializes_symmetric : Symmetric (Specializes : X β†’ X β†’ Prop) export R0Space (specializes_symmetric) class T1Space (X : Type u) [TopologicalSpace X] : Prop where t1 : βˆ€ x, IsClosed ({x} : Set X) #align t1_space T1Space theorem isClosed_singleton [T1Space X] {x : X} : IsClosed ({x} : Set X) := T1Space.t1 x #align is_closed_singleton isClosed_singleton theorem isOpen_compl_singleton [T1Space X] {x : X} : IsOpen ({x}ᢜ : Set X) := isClosed_singleton.isOpen_compl #align is_open_compl_singleton isOpen_compl_singleton theorem isOpen_ne [T1Space X] {x : X} : IsOpen { y | y β‰  x } := isOpen_compl_singleton #align is_open_ne isOpen_ne @[to_additive] theorem Continuous.isOpen_mulSupport [T1Space X] [One X] [TopologicalSpace Y] {f : Y β†’ X} (hf : Continuous f) : IsOpen (mulSupport f) := isOpen_ne.preimage hf #align continuous.is_open_mul_support Continuous.isOpen_mulSupport #align continuous.is_open_support Continuous.isOpen_support theorem Ne.nhdsWithin_compl_singleton [T1Space X] {x y : X} (h : x β‰  y) : 𝓝[{y}ᢜ] x = 𝓝 x := isOpen_ne.nhdsWithin_eq h #align ne.nhds_within_compl_singleton Ne.nhdsWithin_compl_singleton theorem Ne.nhdsWithin_diff_singleton [T1Space X] {x y : X} (h : x β‰  y) (s : Set X) : 𝓝[s \ {y}] x = 𝓝[s] x := by rw [diff_eq, inter_comm, nhdsWithin_inter_of_mem] exact mem_nhdsWithin_of_mem_nhds (isOpen_ne.mem_nhds h) #align ne.nhds_within_diff_singleton Ne.nhdsWithin_diff_singleton lemma nhdsWithin_compl_singleton_le [T1Space X] (x y : X) : 𝓝[{x}ᢜ] x ≀ 𝓝[{y}ᢜ] x := by rcases eq_or_ne x y with rfl|hy Β· exact Eq.le rfl Β· rw [Ne.nhdsWithin_compl_singleton hy] exact nhdsWithin_le_nhds theorem isOpen_setOf_eventually_nhdsWithin [T1Space X] {p : X β†’ Prop} : IsOpen { x | βˆ€αΆ  y in 𝓝[β‰ ] x, p y } := by refine isOpen_iff_mem_nhds.mpr fun a ha => ?_ filter_upwards [eventually_nhds_nhdsWithin.mpr ha] with b hb rcases eq_or_ne a b with rfl | h Β· exact hb Β· rw [h.symm.nhdsWithin_compl_singleton] at hb exact hb.filter_mono nhdsWithin_le_nhds #align is_open_set_of_eventually_nhds_within isOpen_setOf_eventually_nhdsWithin protected theorem Set.Finite.isClosed [T1Space X] {s : Set X} (hs : Set.Finite s) : IsClosed s := by rw [← biUnion_of_singleton s] exact hs.isClosed_biUnion fun i _ => isClosed_singleton #align set.finite.is_closed Set.Finite.isClosed theorem TopologicalSpace.IsTopologicalBasis.exists_mem_of_ne [T1Space X] {b : Set (Set X)} (hb : IsTopologicalBasis b) {x y : X} (h : x β‰  y) : βˆƒ a ∈ b, x ∈ a ∧ y βˆ‰ a := by rcases hb.isOpen_iff.1 isOpen_ne x h with ⟨a, ab, xa, ha⟩ exact ⟨a, ab, xa, fun h => ha h rfl⟩ #align topological_space.is_topological_basis.exists_mem_of_ne TopologicalSpace.IsTopologicalBasis.exists_mem_of_ne protected theorem Finset.isClosed [T1Space X] (s : Finset X) : IsClosed (s : Set X) := s.finite_toSet.isClosed #align finset.is_closed Finset.isClosed theorem t1Space_TFAE (X : Type u) [TopologicalSpace X] : List.TFAE [T1Space X, βˆ€ x, IsClosed ({ x } : Set X), βˆ€ x, IsOpen ({ x }ᢜ : Set X), Continuous (@CofiniteTopology.of X), βˆ€ ⦃x y : X⦄, x β‰  y β†’ {y}ᢜ ∈ 𝓝 x, βˆ€ ⦃x y : X⦄, x β‰  y β†’ βˆƒ s ∈ 𝓝 x, y βˆ‰ s, βˆ€ ⦃x y : X⦄, x β‰  y β†’ βˆƒ U : Set X, IsOpen U ∧ x ∈ U ∧ y βˆ‰ U, βˆ€ ⦃x y : X⦄, x β‰  y β†’ Disjoint (𝓝 x) (pure y), βˆ€ ⦃x y : X⦄, x β‰  y β†’ Disjoint (pure x) (𝓝 y), βˆ€ ⦃x y : X⦄, x β€³ y β†’ x = y] := by tfae_have 1 ↔ 2 Β· exact ⟨fun h => h.1, fun h => ⟨h⟩⟩ tfae_have 2 ↔ 3 Β· simp only [isOpen_compl_iff] tfae_have 5 ↔ 3 Β· refine forall_swap.trans ?_ simp only [isOpen_iff_mem_nhds, mem_compl_iff, mem_singleton_iff] tfae_have 5 ↔ 6 Β· simp only [← subset_compl_singleton_iff, exists_mem_subset_iff] tfae_have 5 ↔ 7 Β· simp only [(nhds_basis_opens _).mem_iff, subset_compl_singleton_iff, exists_prop, and_assoc, and_left_comm] tfae_have 5 ↔ 8 Β· simp only [← principal_singleton, disjoint_principal_right] tfae_have 8 ↔ 9 Β· exact forall_swap.trans (by simp only [disjoint_comm, ne_comm]) tfae_have 1 β†’ 4 Β· simp only [continuous_def, CofiniteTopology.isOpen_iff'] rintro H s (rfl | hs) exacts [isOpen_empty, compl_compl s β–Έ (@Set.Finite.isClosed _ _ H _ hs).isOpen_compl] tfae_have 4 β†’ 2 Β· exact fun h x => (CofiniteTopology.isClosed_iff.2 <| Or.inr (finite_singleton _)).preimage h tfae_have 2 ↔ 10 Β· simp only [← closure_subset_iff_isClosed, specializes_iff_mem_closure, subset_def, mem_singleton_iff, eq_comm] tfae_finish #align t1_space_tfae t1Space_TFAE theorem t1Space_iff_continuous_cofinite_of : T1Space X ↔ Continuous (@CofiniteTopology.of X) := (t1Space_TFAE X).out 0 3 #align t1_space_iff_continuous_cofinite_of t1Space_iff_continuous_cofinite_of theorem CofiniteTopology.continuous_of [T1Space X] : Continuous (@CofiniteTopology.of X) := t1Space_iff_continuous_cofinite_of.mp β€Ή_β€Ί #align cofinite_topology.continuous_of CofiniteTopology.continuous_of theorem t1Space_iff_exists_open : T1Space X ↔ Pairwise fun x y => βˆƒ U : Set X, IsOpen U ∧ x ∈ U ∧ y βˆ‰ U := (t1Space_TFAE X).out 0 6 #align t1_space_iff_exists_open t1Space_iff_exists_open theorem t1Space_iff_disjoint_pure_nhds : T1Space X ↔ βˆ€ ⦃x y : X⦄, x β‰  y β†’ Disjoint (pure x) (𝓝 y) := (t1Space_TFAE X).out 0 8 #align t1_space_iff_disjoint_pure_nhds t1Space_iff_disjoint_pure_nhds theorem t1Space_iff_disjoint_nhds_pure : T1Space X ↔ βˆ€ ⦃x y : X⦄, x β‰  y β†’ Disjoint (𝓝 x) (pure y) := (t1Space_TFAE X).out 0 7 #align t1_space_iff_disjoint_nhds_pure t1Space_iff_disjoint_nhds_pure theorem t1Space_iff_specializes_imp_eq : T1Space X ↔ βˆ€ ⦃x y : X⦄, x β€³ y β†’ x = y := (t1Space_TFAE X).out 0 9 #align t1_space_iff_specializes_imp_eq t1Space_iff_specializes_imp_eq theorem disjoint_pure_nhds [T1Space X] {x y : X} (h : x β‰  y) : Disjoint (pure x) (𝓝 y) := t1Space_iff_disjoint_pure_nhds.mp β€Ή_β€Ί h #align disjoint_pure_nhds disjoint_pure_nhds theorem disjoint_nhds_pure [T1Space X] {x y : X} (h : x β‰  y) : Disjoint (𝓝 x) (pure y) := t1Space_iff_disjoint_nhds_pure.mp β€Ή_β€Ί h #align disjoint_nhds_pure disjoint_nhds_pure theorem Specializes.eq [T1Space X] {x y : X} (h : x β€³ y) : x = y := t1Space_iff_specializes_imp_eq.1 β€Ή_β€Ί h #align specializes.eq Specializes.eq theorem specializes_iff_eq [T1Space X] {x y : X} : x β€³ y ↔ x = y := ⟨Specializes.eq, fun h => h β–Έ specializes_rfl⟩ #align specializes_iff_eq specializes_iff_eq @[simp] theorem specializes_eq_eq [T1Space X] : (Β· β€³ Β·) = @Eq X := funextβ‚‚ fun _ _ => propext specializes_iff_eq #align specializes_eq_eq specializes_eq_eq @[simp] theorem pure_le_nhds_iff [T1Space X] {a b : X} : pure a ≀ 𝓝 b ↔ a = b := specializes_iff_pure.symm.trans specializes_iff_eq #align pure_le_nhds_iff pure_le_nhds_iff @[simp] theorem nhds_le_nhds_iff [T1Space X] {a b : X} : 𝓝 a ≀ 𝓝 b ↔ a = b := specializes_iff_eq #align nhds_le_nhds_iff nhds_le_nhds_iff instance (priority := 100) [T1Space X] : R0Space X where specializes_symmetric _ _ := by rw [specializes_iff_eq, specializes_iff_eq]; exact Eq.symm instance : T1Space (CofiniteTopology X) := t1Space_iff_continuous_cofinite_of.mpr continuous_id theorem t1Space_antitone : Antitone (@T1Space X) := fun a _ h _ => @T1Space.mk _ a fun x => (T1Space.t1 x).mono h #align t1_space_antitone t1Space_antitone theorem continuousWithinAt_update_of_ne [T1Space X] [DecidableEq X] [TopologicalSpace Y] {f : X β†’ Y} {s : Set X} {x x' : X} {y : Y} (hne : x' β‰  x) : ContinuousWithinAt (Function.update f x y) s x' ↔ ContinuousWithinAt f s x' := EventuallyEq.congr_continuousWithinAt (mem_nhdsWithin_of_mem_nhds <| mem_of_superset (isOpen_ne.mem_nhds hne) fun _y' hy' => Function.update_noteq hy' _ _) (Function.update_noteq hne _ _) #align continuous_within_at_update_of_ne continuousWithinAt_update_of_ne theorem continuousAt_update_of_ne [T1Space X] [DecidableEq X] [TopologicalSpace Y] {f : X β†’ Y} {x x' : X} {y : Y} (hne : x' β‰  x) : ContinuousAt (Function.update f x y) x' ↔ ContinuousAt f x' := by simp only [← continuousWithinAt_univ, continuousWithinAt_update_of_ne hne] #align continuous_at_update_of_ne continuousAt_update_of_ne
Mathlib/Topology/Separation.lean
664
676
theorem continuousOn_update_iff [T1Space X] [DecidableEq X] [TopologicalSpace Y] {f : X β†’ Y} {s : Set X} {x : X} {y : Y} : ContinuousOn (Function.update f x y) s ↔ ContinuousOn f (s \ {x}) ∧ (x ∈ s β†’ Tendsto f (𝓝[s \ {x}] x) (𝓝 y)) := by
rw [ContinuousOn, ← and_forall_ne x, and_comm] refine and_congr ⟨fun H z hz => ?_, fun H z hzx hzs => ?_⟩ (forall_congr' fun _ => ?_) Β· specialize H z hz.2 hz.1 rw [continuousWithinAt_update_of_ne hz.2] at H exact H.mono diff_subset Β· rw [continuousWithinAt_update_of_ne hzx] refine (H z ⟨hzs, hzx⟩).mono_of_mem (inter_mem_nhdsWithin _ ?_) exact isOpen_ne.mem_nhds hzx Β· exact continuousWithinAt_update_same
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ΞΉ : Type w} {ΞΉ' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section RankCondition variable [RankCondition R] theorem Basis.le_span'' {ΞΉ : Type*} [Fintype ΞΉ] (b : Basis ΞΉ R M) {w : Set M} [Fintype w] (s : span R w = ⊀) : Fintype.card ΞΉ ≀ Fintype.card w := by -- We construct a surjective linear map `(w β†’ R) β†’β‚—[R] (ΞΉ β†’ R)`, -- by expressing a linear combination in `w` as a linear combination in `ΞΉ`. fapply card_le_of_surjective' R Β· exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑)) Β· apply Surjective.comp (g := b.repr.toLinearMap) Β· apply LinearEquiv.surjective rw [← LinearMap.range_eq_top, Finsupp.range_total] simpa using s #align basis.le_span'' Basis.le_span''
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
125
132
theorem basis_le_span' {ΞΉ : Type*} (b : Basis ΞΉ R M) {w : Set M} [Fintype w] (s : span R w = ⊀) : #ΞΉ ≀ Fintype.card w := by
haveI := nontrivial_of_invariantBasisNumber R haveI := basis_finite_of_finite_spans w (toFinite _) s b cases nonempty_fintype ΞΉ rw [Cardinal.mk_fintype ΞΉ] simp only [Cardinal.natCast_le] exact Basis.le_span'' b s
import Mathlib.MeasureTheory.OuterMeasure.OfFunction import Mathlib.MeasureTheory.PiSystem #align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set Function Filter open scoped Classical NNReal Topology ENNReal namespace MeasureTheory namespace OuterMeasure section CaratheodoryMeasurable universe u variable {Ξ± : Type u} (m : OuterMeasure Ξ±) attribute [local simp] Set.inter_comm Set.inter_left_comm Set.inter_assoc variable {s s₁ sβ‚‚ : Set Ξ±} def IsCaratheodory (s : Set Ξ±) : Prop := βˆ€ t, m t = m (t ∩ s) + m (t \ s) #align measure_theory.outer_measure.is_caratheodory MeasureTheory.OuterMeasure.IsCaratheodory theorem isCaratheodory_iff_le' {s : Set Ξ±} : IsCaratheodory m s ↔ βˆ€ t, m (t ∩ s) + m (t \ s) ≀ m t := forall_congr' fun _ => le_antisymm_iff.trans <| and_iff_right <| measure_le_inter_add_diff _ _ _ #align measure_theory.outer_measure.is_caratheodory_iff_le' MeasureTheory.OuterMeasure.isCaratheodory_iff_le' @[simp]
Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean
62
62
theorem isCaratheodory_empty : IsCaratheodory m βˆ… := by
simp [IsCaratheodory, m.empty, diff_empty]
import Mathlib.CategoryTheory.NatIso #align_import category_theory.bicategory.basic from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" namespace CategoryTheory universe w v u open Category Iso -- intended to be used with explicit universe parameters @[nolint checkUnivs] class Bicategory (B : Type u) extends CategoryStruct.{v} B where -- category structure on the collection of 1-morphisms: homCategory : βˆ€ a b : B, Category.{w} (a ⟢ b) := by infer_instance -- left whiskering: whiskerLeft {a b c : B} (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g ⟢ h) : f ≫ g ⟢ f ≫ h -- right whiskering: whiskerRight {a b c : B} {f g : a ⟢ b} (Ξ· : f ⟢ g) (h : b ⟢ c) : f ≫ h ⟢ g ≫ h -- associator: associator {a b c d : B} (f : a ⟢ b) (g : b ⟢ c) (h : c ⟢ d) : (f ≫ g) ≫ h β‰… f ≫ g ≫ h -- left unitor: leftUnitor {a b : B} (f : a ⟢ b) : πŸ™ a ≫ f β‰… f -- right unitor: rightUnitor {a b : B} (f : a ⟢ b) : f ≫ πŸ™ b β‰… f -- axioms for left whiskering: whiskerLeft_id : βˆ€ {a b c} (f : a ⟢ b) (g : b ⟢ c), whiskerLeft f (πŸ™ g) = πŸ™ (f ≫ g) := by aesop_cat whiskerLeft_comp : βˆ€ {a b c} (f : a ⟢ b) {g h i : b ⟢ c} (Ξ· : g ⟢ h) (ΞΈ : h ⟢ i), whiskerLeft f (Ξ· ≫ ΞΈ) = whiskerLeft f Ξ· ≫ whiskerLeft f ΞΈ := by aesop_cat id_whiskerLeft : βˆ€ {a b} {f g : a ⟢ b} (Ξ· : f ⟢ g), whiskerLeft (πŸ™ a) Ξ· = (leftUnitor f).hom ≫ Ξ· ≫ (leftUnitor g).inv := by aesop_cat comp_whiskerLeft : βˆ€ {a b c d} (f : a ⟢ b) (g : b ⟢ c) {h h' : c ⟢ d} (Ξ· : h ⟢ h'), whiskerLeft (f ≫ g) Ξ· = (associator f g h).hom ≫ whiskerLeft f (whiskerLeft g Ξ·) ≫ (associator f g h').inv := by aesop_cat -- axioms for right whiskering: id_whiskerRight : βˆ€ {a b c} (f : a ⟢ b) (g : b ⟢ c), whiskerRight (πŸ™ f) g = πŸ™ (f ≫ g) := by aesop_cat comp_whiskerRight : βˆ€ {a b c} {f g h : a ⟢ b} (Ξ· : f ⟢ g) (ΞΈ : g ⟢ h) (i : b ⟢ c), whiskerRight (Ξ· ≫ ΞΈ) i = whiskerRight Ξ· i ≫ whiskerRight ΞΈ i := by aesop_cat whiskerRight_id : βˆ€ {a b} {f g : a ⟢ b} (Ξ· : f ⟢ g), whiskerRight Ξ· (πŸ™ b) = (rightUnitor f).hom ≫ Ξ· ≫ (rightUnitor g).inv := by aesop_cat whiskerRight_comp : βˆ€ {a b c d} {f f' : a ⟢ b} (Ξ· : f ⟢ f') (g : b ⟢ c) (h : c ⟢ d), whiskerRight Ξ· (g ≫ h) = (associator f g h).inv ≫ whiskerRight (whiskerRight Ξ· g) h ≫ (associator f' g h).hom := by aesop_cat -- associativity of whiskerings: whisker_assoc : βˆ€ {a b c d} (f : a ⟢ b) {g g' : b ⟢ c} (Ξ· : g ⟢ g') (h : c ⟢ d), whiskerRight (whiskerLeft f Ξ·) h = (associator f g h).hom ≫ whiskerLeft f (whiskerRight Ξ· h) ≫ (associator f g' h).inv := by aesop_cat -- exchange law of left and right whiskerings: whisker_exchange : βˆ€ {a b c} {f g : a ⟢ b} {h i : b ⟢ c} (Ξ· : f ⟢ g) (ΞΈ : h ⟢ i), whiskerLeft f ΞΈ ≫ whiskerRight Ξ· i = whiskerRight Ξ· h ≫ whiskerLeft g ΞΈ := by aesop_cat -- pentagon identity: pentagon : βˆ€ {a b c d e} (f : a ⟢ b) (g : b ⟢ c) (h : c ⟢ d) (i : d ⟢ e), whiskerRight (associator f g h).hom i ≫ (associator f (g ≫ h) i).hom ≫ whiskerLeft f (associator g h i).hom = (associator (f ≫ g) h i).hom ≫ (associator f g (h ≫ i)).hom := by aesop_cat -- triangle identity: triangle : βˆ€ {a b c} (f : a ⟢ b) (g : b ⟢ c), (associator f (πŸ™ b) g).hom ≫ whiskerLeft f (leftUnitor g).hom = whiskerRight (rightUnitor f).hom g := by aesop_cat #align category_theory.bicategory CategoryTheory.Bicategory #align category_theory.bicategory.hom_category CategoryTheory.Bicategory.homCategory #align category_theory.bicategory.whisker_left CategoryTheory.Bicategory.whiskerLeft #align category_theory.bicategory.whisker_right CategoryTheory.Bicategory.whiskerRight #align category_theory.bicategory.left_unitor CategoryTheory.Bicategory.leftUnitor #align category_theory.bicategory.right_unitor CategoryTheory.Bicategory.rightUnitor #align category_theory.bicategory.whisker_left_id' CategoryTheory.Bicategory.whiskerLeft_id #align category_theory.bicategory.whisker_left_comp' CategoryTheory.Bicategory.whiskerLeft_comp #align category_theory.bicategory.id_whisker_left' CategoryTheory.Bicategory.id_whiskerLeft #align category_theory.bicategory.comp_whisker_left' CategoryTheory.Bicategory.comp_whiskerLeft #align category_theory.bicategory.id_whisker_right' CategoryTheory.Bicategory.id_whiskerRight #align category_theory.bicategory.comp_whisker_right' CategoryTheory.Bicategory.comp_whiskerRight #align category_theory.bicategory.whisker_right_id' CategoryTheory.Bicategory.whiskerRight_id #align category_theory.bicategory.whisker_right_comp' CategoryTheory.Bicategory.whiskerRight_comp #align category_theory.bicategory.whisker_assoc' CategoryTheory.Bicategory.whisker_assoc #align category_theory.bicategory.whisker_exchange' CategoryTheory.Bicategory.whisker_exchange #align category_theory.bicategory.pentagon' CategoryTheory.Bicategory.pentagon #align category_theory.bicategory.triangle' CategoryTheory.Bicategory.triangle namespace Bicategory scoped infixr:81 " ◁ " => Bicategory.whiskerLeft scoped infixl:81 " β–· " => Bicategory.whiskerRight scoped notation "Ξ±_" => Bicategory.associator scoped notation "Ξ»_" => Bicategory.leftUnitor scoped notation "ρ_" => Bicategory.rightUnitor attribute [instance] homCategory attribute [reassoc] whiskerLeft_comp id_whiskerLeft comp_whiskerLeft comp_whiskerRight whiskerRight_id whiskerRight_comp whisker_assoc whisker_exchange attribute [reassoc (attr := simp)] pentagon triangle attribute [simp] whiskerLeft_id whiskerLeft_comp id_whiskerLeft comp_whiskerLeft id_whiskerRight comp_whiskerRight whiskerRight_id whiskerRight_comp whisker_assoc variable {B : Type u} [Bicategory.{w, v} B] {a b c d e : B} @[reassoc (attr := simp)] theorem whiskerLeft_hom_inv (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g β‰… h) : f ◁ Ξ·.hom ≫ f ◁ Ξ·.inv = πŸ™ (f ≫ g) := by rw [← whiskerLeft_comp, hom_inv_id, whiskerLeft_id] #align category_theory.bicategory.hom_inv_whisker_left CategoryTheory.Bicategory.whiskerLeft_hom_inv @[reassoc (attr := simp)] theorem hom_inv_whiskerRight {f g : a ⟢ b} (Ξ· : f β‰… g) (h : b ⟢ c) : Ξ·.hom β–· h ≫ Ξ·.inv β–· h = πŸ™ (f ≫ h) := by rw [← comp_whiskerRight, hom_inv_id, id_whiskerRight] #align category_theory.bicategory.hom_inv_whisker_right CategoryTheory.Bicategory.hom_inv_whiskerRight @[reassoc (attr := simp)] theorem whiskerLeft_inv_hom (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g β‰… h) : f ◁ Ξ·.inv ≫ f ◁ Ξ·.hom = πŸ™ (f ≫ h) := by rw [← whiskerLeft_comp, inv_hom_id, whiskerLeft_id] #align category_theory.bicategory.inv_hom_whisker_left CategoryTheory.Bicategory.whiskerLeft_inv_hom @[reassoc (attr := simp)] theorem inv_hom_whiskerRight {f g : a ⟢ b} (Ξ· : f β‰… g) (h : b ⟢ c) : Ξ·.inv β–· h ≫ Ξ·.hom β–· h = πŸ™ (g ≫ h) := by rw [← comp_whiskerRight, inv_hom_id, id_whiskerRight] #align category_theory.bicategory.inv_hom_whisker_right CategoryTheory.Bicategory.inv_hom_whiskerRight @[simps] def whiskerLeftIso (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g β‰… h) : f ≫ g β‰… f ≫ h where hom := f ◁ Ξ·.hom inv := f ◁ Ξ·.inv #align category_theory.bicategory.whisker_left_iso CategoryTheory.Bicategory.whiskerLeftIso instance whiskerLeft_isIso (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g ⟢ h) [IsIso Ξ·] : IsIso (f ◁ Ξ·) := (whiskerLeftIso f (asIso Ξ·)).isIso_hom #align category_theory.bicategory.whisker_left_is_iso CategoryTheory.Bicategory.whiskerLeft_isIso @[simp] theorem inv_whiskerLeft (f : a ⟢ b) {g h : b ⟢ c} (Ξ· : g ⟢ h) [IsIso Ξ·] : inv (f ◁ Ξ·) = f ◁ inv Ξ· := by apply IsIso.inv_eq_of_hom_inv_id simp only [← whiskerLeft_comp, whiskerLeft_id, IsIso.hom_inv_id] #align category_theory.bicategory.inv_whisker_left CategoryTheory.Bicategory.inv_whiskerLeft @[simps!] def whiskerRightIso {f g : a ⟢ b} (Ξ· : f β‰… g) (h : b ⟢ c) : f ≫ h β‰… g ≫ h where hom := Ξ·.hom β–· h inv := Ξ·.inv β–· h #align category_theory.bicategory.whisker_right_iso CategoryTheory.Bicategory.whiskerRightIso instance whiskerRight_isIso {f g : a ⟢ b} (Ξ· : f ⟢ g) (h : b ⟢ c) [IsIso Ξ·] : IsIso (Ξ· β–· h) := (whiskerRightIso (asIso Ξ·) h).isIso_hom #align category_theory.bicategory.whisker_right_is_iso CategoryTheory.Bicategory.whiskerRight_isIso @[simp] theorem inv_whiskerRight {f g : a ⟢ b} (Ξ· : f ⟢ g) (h : b ⟢ c) [IsIso Ξ·] : inv (Ξ· β–· h) = inv Ξ· β–· h := by apply IsIso.inv_eq_of_hom_inv_id simp only [← comp_whiskerRight, id_whiskerRight, IsIso.hom_inv_id] #align category_theory.bicategory.inv_whisker_right CategoryTheory.Bicategory.inv_whiskerRight @[reassoc (attr := simp)] theorem pentagon_inv (f : a ⟢ b) (g : b ⟢ c) (h : c ⟢ d) (i : d ⟢ e) : f ◁ (Ξ±_ g h i).inv ≫ (Ξ±_ f (g ≫ h) i).inv ≫ (Ξ±_ f g h).inv β–· i = (Ξ±_ f g (h ≫ i)).inv ≫ (Ξ±_ (f ≫ g) h i).inv := eq_of_inv_eq_inv (by simp) #align category_theory.bicategory.pentagon_inv CategoryTheory.Bicategory.pentagon_inv @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Bicategory/Basic.lean
259
263
theorem pentagon_inv_inv_hom_hom_inv (f : a ⟢ b) (g : b ⟢ c) (h : c ⟢ d) (i : d ⟢ e) : (Ξ±_ f (g ≫ h) i).inv ≫ (Ξ±_ f g h).inv β–· i ≫ (Ξ±_ (f ≫ g) h i).hom = f ◁ (Ξ±_ g h i).hom ≫ (Ξ±_ f g (h ≫ i)).inv := by
rw [← cancel_epi (f ◁ (Ξ±_ g h i).inv), ← cancel_mono (Ξ±_ (f ≫ g) h i).inv] simp
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.Calculus.Deriv.Shift import Mathlib.Analysis.Calculus.IteratedDeriv.Defs variable {π•œ : Type*} [NontriviallyNormedField π•œ] {F : Type*} [NormedAddCommGroup F] [NormedSpace π•œ F] {R : Type*} [Semiring R] [Module R F] [SMulCommClass π•œ R F] [ContinuousConstSMul R F] {n : β„•} {x : π•œ} {s : Set π•œ} (hx : x ∈ s) (h : UniqueDiffOn π•œ s) {f g : π•œ β†’ F} theorem iteratedDerivWithin_add (hf : ContDiffOn π•œ n f s) (hg : ContDiffOn π•œ n g s) : iteratedDerivWithin n (f + g) s x = iteratedDerivWithin n f s x + iteratedDerivWithin n g s x := by simp_rw [iteratedDerivWithin, iteratedFDerivWithin_add_apply hf hg h hx, ContinuousMultilinearMap.add_apply] theorem iteratedDerivWithin_congr (hfg : Set.EqOn f g s) : Set.EqOn (iteratedDerivWithin n f s) (iteratedDerivWithin n g s) s := by induction n generalizing f g with | zero => rwa [iteratedDerivWithin_zero] | succ n IH => intro y hy have : UniqueDiffWithinAt π•œ s y := h.uniqueDiffWithinAt hy rw [iteratedDerivWithin_succ this, iteratedDerivWithin_succ this] exact derivWithin_congr (IH hfg) (IH hfg hy) theorem iteratedDerivWithin_const_add (hn : 0 < n) (c : F) : iteratedDerivWithin n (fun z => c + f z) s x = iteratedDerivWithin n f s x := by obtain ⟨n, rfl⟩ := n.exists_eq_succ_of_ne_zero hn.ne' rw [iteratedDerivWithin_succ' h hx, iteratedDerivWithin_succ' h hx] refine iteratedDerivWithin_congr h ?_ hx intro y hy exact derivWithin_const_add (h.uniqueDiffWithinAt hy) _ theorem iteratedDerivWithin_const_neg (hn : 0 < n) (c : F) : iteratedDerivWithin n (fun z => c - f z) s x = iteratedDerivWithin n (fun z => -f z) s x := by obtain ⟨n, rfl⟩ := n.exists_eq_succ_of_ne_zero hn.ne' rw [iteratedDerivWithin_succ' h hx, iteratedDerivWithin_succ' h hx] refine iteratedDerivWithin_congr h ?_ hx intro y hy have : UniqueDiffWithinAt π•œ s y := h.uniqueDiffWithinAt hy rw [derivWithin.neg this] exact derivWithin_const_sub this _
Mathlib/Analysis/Calculus/IteratedDeriv/Lemmas.lean
58
62
theorem iteratedDerivWithin_const_smul (c : R) (hf : ContDiffOn π•œ n f s) : iteratedDerivWithin n (c β€’ f) s x = c β€’ iteratedDerivWithin n f s x := by
simp_rw [iteratedDerivWithin] rw [iteratedFDerivWithin_const_smul_apply hf h hx] simp only [ContinuousMultilinearMap.smul_apply]
import Mathlib.Algebra.FreeMonoid.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.GroupTheory.Congruence.Basic import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.Data.List.Chain import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Data.Set.Pointwise.SMul #align_import group_theory.free_product from "leanprover-community/mathlib"@"9114ddffa023340c9ec86965e00cdd6fe26fcdf6" open Set variable {ΞΉ : Type*} (M : ΞΉ β†’ Type*) [βˆ€ i, Monoid (M i)] inductive Monoid.CoprodI.Rel : FreeMonoid (Ξ£i, M i) β†’ FreeMonoid (Ξ£i, M i) β†’ Prop | of_one (i : ΞΉ) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, 1⟩) 1 | of_mul {i : ΞΉ} (x y : M i) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, x⟩ * FreeMonoid.of ⟨i, y⟩) (FreeMonoid.of ⟨i, x * y⟩) #align free_product.rel Monoid.CoprodI.Rel def Monoid.CoprodI : Type _ := (conGen (Monoid.CoprodI.Rel M)).Quotient #align free_product Monoid.CoprodI -- Porting note: could not de derived instance : Monoid (Monoid.CoprodI M) := by delta Monoid.CoprodI; infer_instance instance : Inhabited (Monoid.CoprodI M) := ⟨1⟩ namespace Monoid.CoprodI @[ext] structure Word where toList : List (Ξ£i, M i) ne_one : βˆ€ l ∈ toList, Sigma.snd l β‰  1 chain_ne : toList.Chain' fun l l' => Sigma.fst l β‰  Sigma.fst l' #align free_product.word Monoid.CoprodI.Word variable {M} def of {i : ΞΉ} : M i β†’* CoprodI M where toFun x := Con.mk' _ (FreeMonoid.of <| Sigma.mk i x) map_one' := (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_one i)) map_mul' x y := Eq.symm <| (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_mul x y)) #align free_product.of Monoid.CoprodI.of theorem of_apply {i} (m : M i) : of m = Con.mk' _ (FreeMonoid.of <| Sigma.mk i m) := rfl #align free_product.of_apply Monoid.CoprodI.of_apply variable {N : Type*} [Monoid N] -- Porting note: higher `ext` priority @[ext 1100] theorem ext_hom (f g : CoprodI M β†’* N) (h : βˆ€ i, f.comp (of : M i β†’* _) = g.comp of) : f = g := (MonoidHom.cancel_right Con.mk'_surjective).mp <| FreeMonoid.hom_eq fun ⟨i, x⟩ => by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, MonoidHom.comp_apply, ← of_apply, ← MonoidHom.comp_apply, ← MonoidHom.comp_apply, h]; rfl #align free_product.ext_hom Monoid.CoprodI.ext_hom @[simps symm_apply] def lift : (βˆ€ i, M i β†’* N) ≃ (CoprodI M β†’* N) where toFun fi := Con.lift _ (FreeMonoid.lift fun p : Ξ£i, M i => fi p.fst p.snd) <| Con.conGen_le <| by simp_rw [Con.ker_rel] rintro _ _ (i | ⟨x, y⟩) Β· change FreeMonoid.lift _ (FreeMonoid.of _) = FreeMonoid.lift _ 1 simp only [MonoidHom.map_one, FreeMonoid.lift_eval_of] Β· change FreeMonoid.lift _ (FreeMonoid.of _ * FreeMonoid.of _) = FreeMonoid.lift _ (FreeMonoid.of _) simp only [MonoidHom.map_mul, FreeMonoid.lift_eval_of] invFun f i := f.comp of left_inv := by intro fi ext i x -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, of_apply, Con.lift_mk', FreeMonoid.lift_eval_of] right_inv := by intro f ext i x rfl #align free_product.lift Monoid.CoprodI.lift @[simp] theorem lift_comp_of {N} [Monoid N] (fi : βˆ€ i, M i β†’* N) i : (lift fi).comp of = fi i := congr_fun (lift.symm_apply_apply fi) i @[simp] theorem lift_of {N} [Monoid N] (fi : βˆ€ i, M i β†’* N) {i} (m : M i) : lift fi (of m) = fi i m := DFunLike.congr_fun (lift_comp_of ..) m #align free_product.lift_of Monoid.CoprodI.lift_of @[simp] theorem lift_comp_of' {N} [Monoid N] (f : CoprodI M β†’* N) : lift (fun i ↦ f.comp (of (i := i))) = f := lift.apply_symm_apply f @[simp] theorem lift_of' : lift (fun i ↦ (of : M i β†’* CoprodI M)) = .id (CoprodI M) := lift_comp_of' (.id _) theorem of_leftInverse [DecidableEq ΞΉ] (i : ΞΉ) : Function.LeftInverse (lift <| Pi.mulSingle i (MonoidHom.id (M i))) of := fun x => by simp only [lift_of, Pi.mulSingle_eq_same, MonoidHom.id_apply] #align free_product.of_left_inverse Monoid.CoprodI.of_leftInverse theorem of_injective (i : ΞΉ) : Function.Injective (of : M i β†’* _) := by classical exact (of_leftInverse i).injective #align free_product.of_injective Monoid.CoprodI.of_injective theorem mrange_eq_iSup {N} [Monoid N] (f : βˆ€ i, M i β†’* N) : MonoidHom.mrange (lift f) = ⨆ i, MonoidHom.mrange (f i) := by rw [lift, Equiv.coe_fn_mk, Con.lift_range, FreeMonoid.mrange_lift, range_sigma_eq_iUnion_range, Submonoid.closure_iUnion] simp only [MonoidHom.mclosure_range] #align free_product.mrange_eq_supr Monoid.CoprodI.mrange_eq_iSup theorem lift_mrange_le {N} [Monoid N] (f : βˆ€ i, M i β†’* N) {s : Submonoid N} : MonoidHom.mrange (lift f) ≀ s ↔ βˆ€ i, MonoidHom.mrange (f i) ≀ s := by simp [mrange_eq_iSup] #align free_product.lift_mrange_le Monoid.CoprodI.lift_mrange_le @[simp] theorem iSup_mrange_of : ⨆ i, MonoidHom.mrange (of : M i β†’* CoprodI M) = ⊀ := by simp [← mrange_eq_iSup] @[simp] theorem mclosure_iUnion_range_of : Submonoid.closure (⋃ i, Set.range (of : M i β†’* CoprodI M)) = ⊀ := by simp [Submonoid.closure_iUnion] @[elab_as_elim]
Mathlib/GroupTheory/CoprodI.lean
225
231
theorem induction_left {C : CoprodI M β†’ Prop} (m : CoprodI M) (one : C 1) (mul : βˆ€ {i} (m : M i) x, C x β†’ C (of m * x)) : C m := by
induction m using Submonoid.induction_of_closure_eq_top_left mclosure_iUnion_range_of with | one => exact one | mul x hx y ihy => obtain ⟨i, m, rfl⟩ : βˆƒ (i : ΞΉ) (m : M i), of m = x := by simpa using hx exact mul m y ihy
import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.Algebra.Order.LiminfLimsup import Mathlib.Topology.Instances.NNReal import Mathlib.Topology.EMetricSpace.Lipschitz import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.Order.T5 #align_import topology.instances.ennreal from "leanprover-community/mathlib"@"ec4b2eeb50364487f80421c0b4c41328a611f30d" noncomputable section open Set Filter Metric Function open scoped Classical Topology ENNReal NNReal Filter variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} namespace ENNReal variable {a b c d : ℝβ‰₯0∞} {r p q : ℝβ‰₯0} {x y z : ℝβ‰₯0∞} {Ξ΅ Ρ₁ Ξ΅β‚‚ : ℝβ‰₯0∞} {s : Set ℝβ‰₯0∞} section Liminf theorem exists_frequently_lt_of_liminf_ne_top {ΞΉ : Type*} {l : Filter ΞΉ} {x : ΞΉ β†’ ℝ} (hx : liminf (fun n => (Real.nnabs (x n) : ℝβ‰₯0∞)) l β‰  ∞) : βˆƒ R, βˆƒαΆ  n in l, x n < R := by by_contra h simp_rw [not_exists, not_frequently, not_lt] at h refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_) simp only [eventually_map, ENNReal.coe_le_coe] filter_upwards [h r] with i hi using hi.trans (le_abs_self (x i)) #align ennreal.exists_frequently_lt_of_liminf_ne_top ENNReal.exists_frequently_lt_of_liminf_ne_top theorem exists_frequently_lt_of_liminf_ne_top' {ΞΉ : Type*} {l : Filter ΞΉ} {x : ΞΉ β†’ ℝ} (hx : liminf (fun n => (Real.nnabs (x n) : ℝβ‰₯0∞)) l β‰  ∞) : βˆƒ R, βˆƒαΆ  n in l, R < x n := by by_contra h simp_rw [not_exists, not_frequently, not_lt] at h refine hx (ENNReal.eq_top_of_forall_nnreal_le fun r => le_limsInf_of_le (by isBoundedDefault) ?_) simp only [eventually_map, ENNReal.coe_le_coe] filter_upwards [h (-r)] with i hi using(le_neg.1 hi).trans (neg_le_abs _) #align ennreal.exists_frequently_lt_of_liminf_ne_top' ENNReal.exists_frequently_lt_of_liminf_ne_top'
Mathlib/Topology/Instances/ENNReal.lean
748
771
theorem exists_upcrossings_of_not_bounded_under {ΞΉ : Type*} {l : Filter ΞΉ} {x : ΞΉ β†’ ℝ} (hf : liminf (fun i => (Real.nnabs (x i) : ℝβ‰₯0∞)) l β‰  ∞) (hbdd : Β¬IsBoundedUnder (Β· ≀ Β·) l fun i => |x i|) : βˆƒ a b : β„š, a < b ∧ (βˆƒαΆ  i in l, x i < a) ∧ βˆƒαΆ  i in l, ↑b < x i := by
rw [isBoundedUnder_le_abs, not_and_or] at hbdd obtain hbdd | hbdd := hbdd Β· obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top hf obtain ⟨q, hq⟩ := exists_rat_gt R refine ⟨q, q + 1, (lt_add_iff_pos_right _).2 zero_lt_one, ?_, ?_⟩ Β· refine fun hcon => hR ?_ filter_upwards [hcon] with x hx using not_lt.2 (lt_of_lt_of_le hq (not_lt.1 hx)).le Β· simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, ge_iff_le, not_exists, not_forall, not_le, exists_prop] at hbdd refine fun hcon => hbdd ↑(q + 1) ?_ filter_upwards [hcon] with x hx using not_lt.1 hx Β· obtain ⟨R, hR⟩ := exists_frequently_lt_of_liminf_ne_top' hf obtain ⟨q, hq⟩ := exists_rat_lt R refine ⟨q - 1, q, (sub_lt_self_iff _).2 zero_lt_one, ?_, ?_⟩ Β· simp only [IsBoundedUnder, IsBounded, eventually_map, eventually_atTop, ge_iff_le, not_exists, not_forall, not_le, exists_prop] at hbdd refine fun hcon => hbdd ↑(q - 1) ?_ filter_upwards [hcon] with x hx using not_lt.1 hx Β· refine fun hcon => hR ?_ filter_upwards [hcon] with x hx using not_lt.2 ((not_lt.1 hx).trans hq.le)
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 theorem normed_sub (x : E) : f.normed ΞΌ (c - x) = f.normed ΞΌ (c + x) := by simp_rw [f.normed_def, f.sub] #align cont_diff_bump.normed_sub ContDiffBump.normed_sub theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed ΞΌ (-x) = f.normed ΞΌ x := by simp_rw [f.normed_def, f.neg] #align cont_diff_bump.normed_neg ContDiffBump.normed_neg variable [BorelSpace E] [FiniteDimensional ℝ E] [IsLocallyFiniteMeasure ΞΌ] protected theorem integrable : Integrable f ΞΌ := f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport #align cont_diff_bump.integrable ContDiffBump.integrable protected theorem integrable_normed : Integrable (f.normed ΞΌ) ΞΌ := f.integrable.div_const _ #align cont_diff_bump.integrable_normed ContDiffBump.integrable_normed variable [ΞΌ.IsOpenPosMeasure] theorem integral_pos : 0 < ∫ x, f x βˆ‚ΞΌ := by refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_ rw [f.support_eq] exact measure_ball_pos ΞΌ c f.rOut_pos #align cont_diff_bump.integral_pos ContDiffBump.integral_pos theorem integral_normed : ∫ x, f.normed ΞΌ x βˆ‚ΞΌ = 1 := by simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ← smul_eq_mul, integral_smul] exact inv_mul_cancel f.integral_pos.ne' #align cont_diff_bump.integral_normed ContDiffBump.integral_normed theorem support_normed_eq : Function.support (f.normed ΞΌ) = Metric.ball c f.rOut := by unfold ContDiffBump.normed rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ] #align cont_diff_bump.support_normed_eq ContDiffBump.support_normed_eq theorem tsupport_normed_eq : tsupport (f.normed ΞΌ) = Metric.closedBall c f.rOut := by rw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne'] #align cont_diff_bump.tsupport_normed_eq ContDiffBump.tsupport_normed_eq theorem hasCompactSupport_normed : HasCompactSupport (f.normed ΞΌ) := by simp only [HasCompactSupport, f.tsupport_normed_eq (ΞΌ := ΞΌ), isCompact_closedBall] #align cont_diff_bump.has_compact_support_normed ContDiffBump.hasCompactSupport_normed theorem tendsto_support_normed_smallSets {ΞΉ} {Ο† : ΞΉ β†’ ContDiffBump c} {l : Filter ΞΉ} (hΟ† : Tendsto (fun i => (Ο† i).rOut) l (𝓝 0)) : Tendsto (fun i => Function.support fun x => (Ο† i).normed ΞΌ x) l (𝓝 c).smallSets := by simp_rw [NormedAddCommGroup.tendsto_nhds_zero, Real.norm_eq_abs, abs_eq_self.mpr (Ο† _).rOut_pos.le] at hΟ† rw [nhds_basis_ball.smallSets.tendsto_right_iff] refine fun Ξ΅ hΞ΅ ↦ (hΟ† Ξ΅ hΞ΅).mono fun i hi ↦ ?_ rw [(Ο† i).support_normed_eq] exact ball_subset_ball hi.le #align cont_diff_bump.tendsto_support_normed_small_sets ContDiffBump.tendsto_support_normed_smallSets variable (ΞΌ)
Mathlib/Analysis/Calculus/BumpFunction/Normed.lean
106
108
theorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X] (z : X) : ∫ x, f.normed ΞΌ x β€’ z βˆ‚ΞΌ = z := by
simp_rw [integral_smul_const, f.integral_normed (ΞΌ := ΞΌ), one_smul]
import Mathlib.Order.Lattice import Mathlib.Data.List.Sort import Mathlib.Logic.Equiv.Fin import Mathlib.Logic.Equiv.Functor import Mathlib.Data.Fintype.Card import Mathlib.Order.RelSeries #align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u open Set RelSeries class JordanHolderLattice (X : Type u) [Lattice X] where IsMaximal : X β†’ X β†’ Prop lt_of_isMaximal : βˆ€ {x y}, IsMaximal x y β†’ x < y sup_eq_of_isMaximal : βˆ€ {x y z}, IsMaximal x z β†’ IsMaximal y z β†’ x β‰  y β†’ x βŠ” y = z isMaximal_inf_left_of_isMaximal_sup : βˆ€ {x y}, IsMaximal x (x βŠ” y) β†’ IsMaximal y (x βŠ” y) β†’ IsMaximal (x βŠ“ y) x Iso : X Γ— X β†’ X Γ— X β†’ Prop iso_symm : βˆ€ {x y}, Iso x y β†’ Iso y x iso_trans : βˆ€ {x y z}, Iso x y β†’ Iso y z β†’ Iso x z second_iso : βˆ€ {x y}, IsMaximal x (x βŠ” y) β†’ Iso (x, x βŠ” y) (x βŠ“ y, y) #align jordan_holder_lattice JordanHolderLattice open JordanHolderLattice attribute [symm] iso_symm attribute [trans] iso_trans abbrev CompositionSeries (X : Type u) [Lattice X] [JordanHolderLattice X] : Type u := RelSeries (IsMaximal (X := X)) #align composition_series CompositionSeries namespace CompositionSeries variable {X : Type u} [Lattice X] [JordanHolderLattice X] #noalign composition_series.has_coe_to_fun #align composition_series.has_inhabited RelSeries.instInhabited #align composition_series.step RelSeries.membership theorem lt_succ (s : CompositionSeries X) (i : Fin s.length) : s (Fin.castSucc i) < s (Fin.succ i) := lt_of_isMaximal (s.step _) #align composition_series.lt_succ CompositionSeries.lt_succ protected theorem strictMono (s : CompositionSeries X) : StrictMono s := Fin.strictMono_iff_lt_succ.2 s.lt_succ #align composition_series.strict_mono CompositionSeries.strictMono protected theorem injective (s : CompositionSeries X) : Function.Injective s := s.strictMono.injective #align composition_series.injective CompositionSeries.injective @[simp] protected theorem inj (s : CompositionSeries X) {i j : Fin s.length.succ} : s i = s j ↔ i = j := s.injective.eq_iff #align composition_series.inj CompositionSeries.inj #align composition_series.has_mem RelSeries.membership #align composition_series.mem_def RelSeries.mem_def theorem total {s : CompositionSeries X} {x y : X} (hx : x ∈ s) (hy : y ∈ s) : x ≀ y ∨ y ≀ x := by rcases Set.mem_range.1 hx with ⟨i, rfl⟩ rcases Set.mem_range.1 hy with ⟨j, rfl⟩ rw [s.strictMono.le_iff_le, s.strictMono.le_iff_le] exact le_total i j #align composition_series.total CompositionSeries.total #align composition_series.to_list RelSeries.toList #align composition_series.ext_fun RelSeries.ext #align composition_series.length_to_list RelSeries.length_toList #align composition_series.to_list_ne_nil RelSeries.toList_ne_nil #align composition_series.to_list_injective RelSeries.toList_injective #align composition_series.chain'_to_list RelSeries.toList_chain' theorem toList_sorted (s : CompositionSeries X) : s.toList.Sorted (Β· < Β·) := List.pairwise_iff_get.2 fun i j h => by dsimp only [RelSeries.toList] rw [List.get_ofFn, List.get_ofFn] exact s.strictMono h #align composition_series.to_list_sorted CompositionSeries.toList_sorted theorem toList_nodup (s : CompositionSeries X) : s.toList.Nodup := s.toList_sorted.nodup #align composition_series.to_list_nodup CompositionSeries.toList_nodup #align composition_series.mem_to_list RelSeries.mem_toList #align composition_series.of_list RelSeries.fromListChain' #align composition_series.length_of_list RelSeries.fromListChain'_length #noalign composition_series.of_list_to_list #noalign composition_series.of_list_to_list' #noalign composition_series.to_list_of_list @[ext] theorem ext {s₁ sβ‚‚ : CompositionSeries X} (h : βˆ€ x, x ∈ s₁ ↔ x ∈ sβ‚‚) : s₁ = sβ‚‚ := toList_injective <| List.eq_of_perm_of_sorted (by classical exact List.perm_of_nodup_nodup_toFinset_eq s₁.toList_nodup sβ‚‚.toList_nodup (Finset.ext <| by simpa only [List.mem_toFinset, RelSeries.mem_toList])) s₁.toList_sorted sβ‚‚.toList_sorted #align composition_series.ext CompositionSeries.ext #align composition_series.top RelSeries.last #align composition_series.top_mem RelSeries.last_mem @[simp] theorem le_last {s : CompositionSeries X} (i : Fin (s.length + 1)) : s i ≀ s.last := s.strictMono.monotone (Fin.le_last _) #align composition_series.le_top CompositionSeries.le_last theorem le_last_of_mem {s : CompositionSeries X} {x : X} (hx : x ∈ s) : x ≀ s.last := let ⟨_i, hi⟩ := Set.mem_range.2 hx hi β–Έ le_last _ #align composition_series.le_top_of_mem CompositionSeries.le_last_of_mem #align composition_series.bot RelSeries.head #align composition_series.bot_mem RelSeries.head_mem @[simp] theorem head_le {s : CompositionSeries X} (i : Fin (s.length + 1)) : s.head ≀ s i := s.strictMono.monotone (Fin.zero_le _) #align composition_series.bot_le CompositionSeries.head_le theorem head_le_of_mem {s : CompositionSeries X} {x : X} (hx : x ∈ s) : s.head ≀ x := let ⟨_i, hi⟩ := Set.mem_range.2 hx hi β–Έ head_le _ #align composition_series.bot_le_of_mem CompositionSeries.head_le_of_mem -- The aligned versions of the following two lemmas are not exactly the same as the original -- but they are mathematically equivalent. #align composition_series.length_pos_of_mem_ne RelSeries.length_pos_of_nontrivial #align composition_series.forall_mem_eq_of_length_eq_zero RelSeries.subsingleton_of_length_eq_zero #align composition_series.erase_top RelSeries.eraseLast #align composition_series.top_erase_top RelSeries.last_eraseLast
Mathlib/Order/JordanHolder.lean
251
252
theorem last_eraseLast_le (s : CompositionSeries X) : s.eraseLast.last ≀ s.last := by
simp [eraseLast, last, s.strictMono.le_iff_le, Fin.le_iff_val_le_val, tsub_le_self]
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840" noncomputable section open Affine open Set section variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] def vectorSpan (s : Set P) : Submodule k V := Submodule.span k (s -α΅₯ s) #align vector_span vectorSpan theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -α΅₯ s) := rfl #align vector_span_def vectorSpan_def theorem vectorSpan_mono {s₁ sβ‚‚ : Set P} (h : s₁ βŠ† sβ‚‚) : vectorSpan k s₁ ≀ vectorSpan k sβ‚‚ := Submodule.span_mono (vsub_self_mono h) #align vector_span_mono vectorSpan_mono variable (P) @[simp] theorem vectorSpan_empty : vectorSpan k (βˆ… : Set P) = (βŠ₯ : Submodule k V) := by rw [vectorSpan_def, vsub_empty, Submodule.span_empty] #align vector_span_empty vectorSpan_empty variable {P} @[simp] theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = βŠ₯ := by simp [vectorSpan_def] #align vector_span_singleton vectorSpan_singleton theorem vsub_set_subset_vectorSpan (s : Set P) : s -α΅₯ s βŠ† ↑(vectorSpan k s) := Submodule.subset_span #align vsub_set_subset_vector_span vsub_set_subset_vectorSpan theorem vsub_mem_vectorSpan {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) : p1 -α΅₯ p2 ∈ vectorSpan k s := vsub_set_subset_vectorSpan k s (vsub_mem_vsub hp1 hp2) #align vsub_mem_vector_span vsub_mem_vectorSpan def spanPoints (s : Set P) : Set P := { p | βˆƒ p1 ∈ s, βˆƒ v ∈ vectorSpan k s, p = v +α΅₯ p1 } #align span_points spanPoints theorem mem_spanPoints (p : P) (s : Set P) : p ∈ s β†’ p ∈ spanPoints k s | hp => ⟨p, hp, 0, Submodule.zero_mem _, (zero_vadd V p).symm⟩ #align mem_span_points mem_spanPoints theorem subset_spanPoints (s : Set P) : s βŠ† spanPoints k s := fun p => mem_spanPoints k p s #align subset_span_points subset_spanPoints @[simp] theorem spanPoints_nonempty (s : Set P) : (spanPoints k s).Nonempty ↔ s.Nonempty := by constructor Β· contrapose rw [Set.not_nonempty_iff_eq_empty, Set.not_nonempty_iff_eq_empty] intro h simp [h, spanPoints] Β· exact fun h => h.mono (subset_spanPoints _ _) #align span_points_nonempty spanPoints_nonempty theorem vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan {s : Set P} {p : P} {v : V} (hp : p ∈ spanPoints k s) (hv : v ∈ vectorSpan k s) : v +α΅₯ p ∈ spanPoints k s := by rcases hp with ⟨p2, ⟨hp2, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩ rw [hv2p, vadd_vadd] exact ⟨p2, hp2, v + v2, (vectorSpan k s).add_mem hv hv2, rfl⟩ #align vadd_mem_span_points_of_mem_span_points_of_mem_vector_span vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan theorem vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ spanPoints k s) (hp2 : p2 ∈ spanPoints k s) : p1 -α΅₯ p2 ∈ vectorSpan k s := by rcases hp1 with ⟨p1a, ⟨hp1a, ⟨v1, ⟨hv1, hv1p⟩⟩⟩⟩ rcases hp2 with ⟨p2a, ⟨hp2a, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩ rw [hv1p, hv2p, vsub_vadd_eq_vsub_sub (v1 +α΅₯ p1a), vadd_vsub_assoc, add_comm, add_sub_assoc] have hv1v2 : v1 - v2 ∈ vectorSpan k s := (vectorSpan k s).sub_mem hv1 hv2 refine (vectorSpan k s).add_mem ?_ hv1v2 exact vsub_mem_vectorSpan k hp1a hp2a #align vsub_mem_vector_span_of_mem_span_points_of_mem_span_points vsub_mem_vectorSpan_of_mem_spanPoints_of_mem_spanPoints end structure AffineSubspace (k : Type*) {V : Type*} (P : Type*) [Ring k] [AddCommGroup V] [Module k V] [AffineSpace V P] where carrier : Set P smul_vsub_vadd_mem : βˆ€ (c : k) {p1 p2 p3 : P}, p1 ∈ carrier β†’ p2 ∈ carrier β†’ p3 ∈ carrier β†’ c β€’ (p1 -α΅₯ p2 : V) +α΅₯ p3 ∈ carrier #align affine_subspace AffineSubspace namespace AffineSubspace variable (k : Type*) {V : Type*} (P : Type*) [Ring k] [AddCommGroup V] [Module k V] [AffineSpace V P] instance : SetLike (AffineSubspace k P) P where coe := carrier coe_injective' p q _ := by cases p; cases q; congr -- Porting note: removed `simp`, proof is `simp only [SetLike.mem_coe]` theorem mem_coe (p : P) (s : AffineSubspace k P) : p ∈ (s : Set P) ↔ p ∈ s := Iff.rfl #align affine_subspace.mem_coe AffineSubspace.mem_coe variable {k P} def direction (s : AffineSubspace k P) : Submodule k V := vectorSpan k (s : Set P) #align affine_subspace.direction AffineSubspace.direction theorem direction_eq_vectorSpan (s : AffineSubspace k P) : s.direction = vectorSpan k (s : Set P) := rfl #align affine_subspace.direction_eq_vector_span AffineSubspace.direction_eq_vectorSpan def directionOfNonempty {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : Submodule k V where carrier := (s : Set P) -α΅₯ s zero_mem' := by cases' h with p hp exact vsub_self p β–Έ vsub_mem_vsub hp hp add_mem' := by rintro _ _ ⟨p1, hp1, p2, hp2, rfl⟩ ⟨p3, hp3, p4, hp4, rfl⟩ rw [← vadd_vsub_assoc] refine vsub_mem_vsub ?_ hp4 convert s.smul_vsub_vadd_mem 1 hp1 hp2 hp3 rw [one_smul] smul_mem' := by rintro c _ ⟨p1, hp1, p2, hp2, rfl⟩ rw [← vadd_vsub (c β€’ (p1 -α΅₯ p2)) p2] refine vsub_mem_vsub ?_ hp2 exact s.smul_vsub_vadd_mem c hp1 hp2 hp2 #align affine_subspace.direction_of_nonempty AffineSubspace.directionOfNonempty theorem directionOfNonempty_eq_direction {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : directionOfNonempty h = s.direction := by refine le_antisymm ?_ (Submodule.span_le.2 Set.Subset.rfl) rw [← SetLike.coe_subset_coe, directionOfNonempty, direction, Submodule.coe_set_mk, AddSubmonoid.coe_set_mk] exact vsub_set_subset_vectorSpan k _ #align affine_subspace.direction_of_nonempty_eq_direction AffineSubspace.directionOfNonempty_eq_direction theorem coe_direction_eq_vsub_set {s : AffineSubspace k P} (h : (s : Set P).Nonempty) : (s.direction : Set V) = (s : Set P) -α΅₯ s := directionOfNonempty_eq_direction h β–Έ rfl #align affine_subspace.coe_direction_eq_vsub_set AffineSubspace.coe_direction_eq_vsub_set theorem mem_direction_iff_eq_vsub {s : AffineSubspace k P} (h : (s : Set P).Nonempty) (v : V) : v ∈ s.direction ↔ βˆƒ p1 ∈ s, βˆƒ p2 ∈ s, v = p1 -α΅₯ p2 := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set h, Set.mem_vsub] simp only [SetLike.mem_coe, eq_comm] #align affine_subspace.mem_direction_iff_eq_vsub AffineSubspace.mem_direction_iff_eq_vsub theorem vadd_mem_of_mem_direction {s : AffineSubspace k P} {v : V} (hv : v ∈ s.direction) {p : P} (hp : p ∈ s) : v +α΅₯ p ∈ s := by rw [mem_direction_iff_eq_vsub ⟨p, hp⟩] at hv rcases hv with ⟨p1, hp1, p2, hp2, hv⟩ rw [hv] convert s.smul_vsub_vadd_mem 1 hp1 hp2 hp rw [one_smul] exact s.mem_coe k P _ #align affine_subspace.vadd_mem_of_mem_direction AffineSubspace.vadd_mem_of_mem_direction theorem vsub_mem_direction {s : AffineSubspace k P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) : p1 -α΅₯ p2 ∈ s.direction := vsub_mem_vectorSpan k hp1 hp2 #align affine_subspace.vsub_mem_direction AffineSubspace.vsub_mem_direction theorem vadd_mem_iff_mem_direction {s : AffineSubspace k P} (v : V) {p : P} (hp : p ∈ s) : v +α΅₯ p ∈ s ↔ v ∈ s.direction := ⟨fun h => by simpa using vsub_mem_direction h hp, fun h => vadd_mem_of_mem_direction h hp⟩ #align affine_subspace.vadd_mem_iff_mem_direction AffineSubspace.vadd_mem_iff_mem_direction theorem vadd_mem_iff_mem_of_mem_direction {s : AffineSubspace k P} {v : V} (hv : v ∈ s.direction) {p : P} : v +α΅₯ p ∈ s ↔ p ∈ s := by refine ⟨fun h => ?_, fun h => vadd_mem_of_mem_direction hv h⟩ convert vadd_mem_of_mem_direction (Submodule.neg_mem _ hv) h simp #align affine_subspace.vadd_mem_iff_mem_of_mem_direction AffineSubspace.vadd_mem_iff_mem_of_mem_direction theorem coe_direction_eq_vsub_set_right {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : (s.direction : Set V) = (Β· -α΅₯ p) '' s := by rw [coe_direction_eq_vsub_set ⟨p, hp⟩] refine le_antisymm ?_ ?_ Β· rintro v ⟨p1, hp1, p2, hp2, rfl⟩ exact ⟨p1 -α΅₯ p2 +α΅₯ p, vadd_mem_of_mem_direction (vsub_mem_direction hp1 hp2) hp, vadd_vsub _ _⟩ Β· rintro v ⟨p2, hp2, rfl⟩ exact ⟨p2, hp2, p, hp, rfl⟩ #align affine_subspace.coe_direction_eq_vsub_set_right AffineSubspace.coe_direction_eq_vsub_set_right theorem coe_direction_eq_vsub_set_left {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : (s.direction : Set V) = (p -α΅₯ Β·) '' s := by ext v rw [SetLike.mem_coe, ← Submodule.neg_mem_iff, ← SetLike.mem_coe, coe_direction_eq_vsub_set_right hp, Set.mem_image, Set.mem_image] conv_lhs => congr ext rw [← neg_vsub_eq_vsub_rev, neg_inj] #align affine_subspace.coe_direction_eq_vsub_set_left AffineSubspace.coe_direction_eq_vsub_set_left theorem mem_direction_iff_eq_vsub_right {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (v : V) : v ∈ s.direction ↔ βˆƒ p2 ∈ s, v = p2 -α΅₯ p := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set_right hp] exact ⟨fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩, fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩⟩ #align affine_subspace.mem_direction_iff_eq_vsub_right AffineSubspace.mem_direction_iff_eq_vsub_right theorem mem_direction_iff_eq_vsub_left {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (v : V) : v ∈ s.direction ↔ βˆƒ p2 ∈ s, v = p -α΅₯ p2 := by rw [← SetLike.mem_coe, coe_direction_eq_vsub_set_left hp] exact ⟨fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩, fun ⟨p2, hp2, hv⟩ => ⟨p2, hp2, hv.symm⟩⟩ #align affine_subspace.mem_direction_iff_eq_vsub_left AffineSubspace.mem_direction_iff_eq_vsub_left theorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (p2 : P) : p2 -α΅₯ p ∈ s.direction ↔ p2 ∈ s := by rw [mem_direction_iff_eq_vsub_right hp] simp #align affine_subspace.vsub_right_mem_direction_iff_mem AffineSubspace.vsub_right_mem_direction_iff_mem theorem vsub_left_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p ∈ s) (p2 : P) : p -α΅₯ p2 ∈ s.direction ↔ p2 ∈ s := by rw [mem_direction_iff_eq_vsub_left hp] simp #align affine_subspace.vsub_left_mem_direction_iff_mem AffineSubspace.vsub_left_mem_direction_iff_mem theorem coe_injective : Function.Injective ((↑) : AffineSubspace k P β†’ Set P) := SetLike.coe_injective #align affine_subspace.coe_injective AffineSubspace.coe_injective @[ext] theorem ext {p q : AffineSubspace k P} (h : βˆ€ x, x ∈ p ↔ x ∈ q) : p = q := SetLike.ext h #align affine_subspace.ext AffineSubspace.ext -- Porting note: removed `simp`, proof is `simp only [SetLike.ext'_iff]` theorem ext_iff (s₁ sβ‚‚ : AffineSubspace k P) : (s₁ : Set P) = sβ‚‚ ↔ s₁ = sβ‚‚ := SetLike.ext'_iff.symm #align affine_subspace.ext_iff AffineSubspace.ext_iff theorem ext_of_direction_eq {s1 s2 : AffineSubspace k P} (hd : s1.direction = s2.direction) (hn : ((s1 : Set P) ∩ s2).Nonempty) : s1 = s2 := by ext p have hq1 := Set.mem_of_mem_inter_left hn.some_mem have hq2 := Set.mem_of_mem_inter_right hn.some_mem constructor Β· intro hp rw [← vsub_vadd p hn.some] refine vadd_mem_of_mem_direction ?_ hq2 rw [← hd] exact vsub_mem_direction hp hq1 Β· intro hp rw [← vsub_vadd p hn.some] refine vadd_mem_of_mem_direction ?_ hq1 rw [hd] exact vsub_mem_direction hp hq2 #align affine_subspace.ext_of_direction_eq AffineSubspace.ext_of_direction_eq -- See note [reducible non instances] abbrev toAddTorsor (s : AffineSubspace k P) [Nonempty s] : AddTorsor s.direction s where vadd a b := ⟨(a : V) +α΅₯ (b : P), vadd_mem_of_mem_direction a.2 b.2⟩ zero_vadd := fun a => by ext exact zero_vadd _ _ add_vadd a b c := by ext apply add_vadd vsub a b := ⟨(a : P) -α΅₯ (b : P), (vsub_left_mem_direction_iff_mem a.2 _).mpr b.2⟩ vsub_vadd' a b := by ext apply AddTorsor.vsub_vadd' vadd_vsub' a b := by ext apply AddTorsor.vadd_vsub' #align affine_subspace.to_add_torsor AffineSubspace.toAddTorsor attribute [local instance] toAddTorsor @[simp, norm_cast] theorem coe_vsub (s : AffineSubspace k P) [Nonempty s] (a b : s) : ↑(a -α΅₯ b) = (a : P) -α΅₯ (b : P) := rfl #align affine_subspace.coe_vsub AffineSubspace.coe_vsub @[simp, norm_cast] theorem coe_vadd (s : AffineSubspace k P) [Nonempty s] (a : s.direction) (b : s) : ↑(a +α΅₯ b) = (a : V) +α΅₯ (b : P) := rfl #align affine_subspace.coe_vadd AffineSubspace.coe_vadd protected def subtype (s : AffineSubspace k P) [Nonempty s] : s →ᡃ[k] P where toFun := (↑) linear := s.direction.subtype map_vadd' _ _ := rfl #align affine_subspace.subtype AffineSubspace.subtype @[simp] theorem subtype_linear (s : AffineSubspace k P) [Nonempty s] : s.subtype.linear = s.direction.subtype := rfl #align affine_subspace.subtype_linear AffineSubspace.subtype_linear theorem subtype_apply (s : AffineSubspace k P) [Nonempty s] (p : s) : s.subtype p = p := rfl #align affine_subspace.subtype_apply AffineSubspace.subtype_apply @[simp] theorem coeSubtype (s : AffineSubspace k P) [Nonempty s] : (s.subtype : s β†’ P) = ((↑) : s β†’ P) := rfl #align affine_subspace.coe_subtype AffineSubspace.coeSubtype theorem injective_subtype (s : AffineSubspace k P) [Nonempty s] : Function.Injective s.subtype := Subtype.coe_injective #align affine_subspace.injective_subtype AffineSubspace.injective_subtype theorem eq_iff_direction_eq_of_mem {s₁ sβ‚‚ : AffineSubspace k P} {p : P} (h₁ : p ∈ s₁) (hβ‚‚ : p ∈ sβ‚‚) : s₁ = sβ‚‚ ↔ s₁.direction = sβ‚‚.direction := ⟨fun h => h β–Έ rfl, fun h => ext_of_direction_eq h ⟨p, h₁, hβ‚‚βŸ©βŸ© #align affine_subspace.eq_iff_direction_eq_of_mem AffineSubspace.eq_iff_direction_eq_of_mem def mk' (p : P) (direction : Submodule k V) : AffineSubspace k P where carrier := { q | βˆƒ v ∈ direction, q = v +α΅₯ p } smul_vsub_vadd_mem c p1 p2 p3 hp1 hp2 hp3 := by rcases hp1 with ⟨v1, hv1, hp1⟩ rcases hp2 with ⟨v2, hv2, hp2⟩ rcases hp3 with ⟨v3, hv3, hp3⟩ use c β€’ (v1 - v2) + v3, direction.add_mem (direction.smul_mem c (direction.sub_mem hv1 hv2)) hv3 simp [hp1, hp2, hp3, vadd_vadd] #align affine_subspace.mk' AffineSubspace.mk' theorem self_mem_mk' (p : P) (direction : Submodule k V) : p ∈ mk' p direction := ⟨0, ⟨direction.zero_mem, (zero_vadd _ _).symm⟩⟩ #align affine_subspace.self_mem_mk' AffineSubspace.self_mem_mk' theorem vadd_mem_mk' {v : V} (p : P) {direction : Submodule k V} (hv : v ∈ direction) : v +α΅₯ p ∈ mk' p direction := ⟨v, hv, rfl⟩ #align affine_subspace.vadd_mem_mk' AffineSubspace.vadd_mem_mk' theorem mk'_nonempty (p : P) (direction : Submodule k V) : (mk' p direction : Set P).Nonempty := ⟨p, self_mem_mk' p direction⟩ #align affine_subspace.mk'_nonempty AffineSubspace.mk'_nonempty @[simp] theorem direction_mk' (p : P) (direction : Submodule k V) : (mk' p direction).direction = direction := by ext v rw [mem_direction_iff_eq_vsub (mk'_nonempty _ _)] constructor Β· rintro ⟨p1, ⟨v1, hv1, hp1⟩, p2, ⟨v2, hv2, hp2⟩, hv⟩ rw [hv, hp1, hp2, vadd_vsub_vadd_cancel_right] exact direction.sub_mem hv1 hv2 Β· exact fun hv => ⟨v +α΅₯ p, vadd_mem_mk' _ hv, p, self_mem_mk' _ _, (vadd_vsub _ _).symm⟩ #align affine_subspace.direction_mk' AffineSubspace.direction_mk' theorem mem_mk'_iff_vsub_mem {p₁ pβ‚‚ : P} {direction : Submodule k V} : pβ‚‚ ∈ mk' p₁ direction ↔ pβ‚‚ -α΅₯ p₁ ∈ direction := by refine ⟨fun h => ?_, fun h => ?_⟩ Β· rw [← direction_mk' p₁ direction] exact vsub_mem_direction h (self_mem_mk' _ _) Β· rw [← vsub_vadd pβ‚‚ p₁] exact vadd_mem_mk' p₁ h #align affine_subspace.mem_mk'_iff_vsub_mem AffineSubspace.mem_mk'_iff_vsub_mem @[simp] theorem mk'_eq {s : AffineSubspace k P} {p : P} (hp : p ∈ s) : mk' p s.direction = s := ext_of_direction_eq (direction_mk' p s.direction) ⟨p, Set.mem_inter (self_mem_mk' _ _) hp⟩ #align affine_subspace.mk'_eq AffineSubspace.mk'_eq
Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean
496
505
theorem spanPoints_subset_coe_of_subset_coe {s : Set P} {s1 : AffineSubspace k P} (h : s βŠ† s1) : spanPoints k s βŠ† s1 := by
rintro p ⟨p1, hp1, v, hv, hp⟩ rw [hp] have hp1s1 : p1 ∈ (s1 : Set P) := Set.mem_of_mem_of_subset hp1 h refine vadd_mem_of_mem_direction ?_ hp1s1 have hs : vectorSpan k s ≀ s1.direction := vectorSpan_mono k h rw [SetLike.le_def] at hs rw [← SetLike.mem_coe] exact Set.mem_of_mem_of_subset hv hs
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Identities import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.RingTheory.Polynomial.Nilpotent import Mathlib.RingTheory.Polynomial.Tower open Set Function noncomputable section namespace Polynomial variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (P : R[X]) {x : S} def newtonMap (x : S) : S := x - (Ring.inverse <| aeval x (derivative P)) * aeval x P theorem newtonMap_apply : P.newtonMap x = x - (Ring.inverse <| aeval x (derivative P)) * (aeval x P) := rfl variable {P} theorem newtonMap_apply_of_isUnit (h : IsUnit <| aeval x (derivative P)) : P.newtonMap x = x - h.unit⁻¹ * aeval x P := by simp [newtonMap_apply, Ring.inverse, h]
Mathlib/Dynamics/Newton.lean
57
59
theorem newtonMap_apply_of_not_isUnit (h : Β¬ (IsUnit <| aeval x (derivative P))) : P.newtonMap x = x := by
simp [newtonMap_apply, Ring.inverse, h]
import Mathlib.Data.Set.Prod #align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654" open Function namespace Set variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ Ξ³' Ξ΄ Ξ΄' Ξ΅ Ξ΅' ΞΆ ΞΆ' Ξ½ : Type*} {f f' : Ξ± β†’ Ξ² β†’ Ξ³} {g g' : Ξ± β†’ Ξ² β†’ Ξ³ β†’ Ξ΄} variable {s s' : Set Ξ±} {t t' : Set Ξ²} {u u' : Set Ξ³} {v : Set Ξ΄} {a a' : Ξ±} {b b' : Ξ²} {c c' : Ξ³} {d d' : Ξ΄} theorem mem_image2_iff (hf : Injective2 f) : f a b ∈ image2 f s t ↔ a ∈ s ∧ b ∈ t := ⟨by rintro ⟨a', ha', b', hb', h⟩ rcases hf h with ⟨rfl, rfl⟩ exact ⟨ha', hb'⟩, fun ⟨ha, hb⟩ => mem_image2_of_mem ha hb⟩ #align set.mem_image2_iff Set.mem_image2_iff theorem image2_subset (hs : s βŠ† s') (ht : t βŠ† t') : image2 f s t βŠ† image2 f s' t' := by rintro _ ⟨a, ha, b, hb, rfl⟩ exact mem_image2_of_mem (hs ha) (ht hb) #align set.image2_subset Set.image2_subset theorem image2_subset_left (ht : t βŠ† t') : image2 f s t βŠ† image2 f s t' := image2_subset Subset.rfl ht #align set.image2_subset_left Set.image2_subset_left theorem image2_subset_right (hs : s βŠ† s') : image2 f s t βŠ† image2 f s' t := image2_subset hs Subset.rfl #align set.image2_subset_right Set.image2_subset_right theorem image_subset_image2_left (hb : b ∈ t) : (fun a => f a b) '' s βŠ† image2 f s t := forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb #align set.image_subset_image2_left Set.image_subset_image2_left theorem image_subset_image2_right (ha : a ∈ s) : f a '' t βŠ† image2 f s t := forall_mem_image.2 fun _ => mem_image2_of_mem ha #align set.image_subset_image2_right Set.image_subset_image2_right theorem forall_image2_iff {p : Ξ³ β†’ Prop} : (βˆ€ z ∈ image2 f s t, p z) ↔ βˆ€ x ∈ s, βˆ€ y ∈ t, p (f x y) := ⟨fun h x hx y hy => h _ ⟨x, hx, y, hy, rfl⟩, fun h _ ⟨x, hx, y, hy, hz⟩ => hz β–Έ h x hx y hy⟩ #align set.forall_image2_iff Set.forall_image2_iff @[simp] theorem image2_subset_iff {u : Set Ξ³} : image2 f s t βŠ† u ↔ βˆ€ x ∈ s, βˆ€ y ∈ t, f x y ∈ u := forall_image2_iff #align set.image2_subset_iff Set.image2_subset_iff theorem image2_subset_iff_left : image2 f s t βŠ† u ↔ βˆ€ a ∈ s, (fun b => f a b) '' t βŠ† u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage] #align set.image2_subset_iff_left Set.image2_subset_iff_left theorem image2_subset_iff_right : image2 f s t βŠ† u ↔ βˆ€ b ∈ t, (fun a => f a b) '' s βŠ† u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage, @forallβ‚‚_swap Ξ±] #align set.image2_subset_iff_right Set.image2_subset_iff_right variable (f) -- Porting note: Removing `simp` - LHS does not simplify lemma image_prod : (fun x : Ξ± Γ— Ξ² ↦ f x.1 x.2) '' s Γ—Λ’ t = image2 f s t := ext fun _ ↦ by simp [and_assoc] #align set.image_prod Set.image_prod @[simp] lemma image_uncurry_prod (s : Set Ξ±) (t : Set Ξ²) : uncurry f '' s Γ—Λ’ t = image2 f s t := image_prod _ #align set.image_uncurry_prod Set.image_uncurry_prod @[simp] lemma image2_mk_eq_prod : image2 Prod.mk s t = s Γ—Λ’ t := ext <| by simp #align set.image2_mk_eq_prod Set.image2_mk_eq_prod -- Porting note: Removing `simp` - LHS does not simplify lemma image2_curry (f : Ξ± Γ— Ξ² β†’ Ξ³) (s : Set Ξ±) (t : Set Ξ²) : image2 (fun a b ↦ f (a, b)) s t = f '' s Γ—Λ’ t := by simp [← image_uncurry_prod, uncurry] #align set.image2_curry Set.image2_curry theorem image2_swap (s : Set Ξ±) (t : Set Ξ²) : image2 f s t = image2 (fun a b => f b a) t s := by ext constructor <;> rintro ⟨a, ha, b, hb, rfl⟩ <;> exact ⟨b, hb, a, ha, rfl⟩ #align set.image2_swap Set.image2_swap variable {f} theorem image2_union_left : image2 f (s βˆͺ s') t = image2 f s t βˆͺ image2 f s' t := by simp_rw [← image_prod, union_prod, image_union] #align set.image2_union_left Set.image2_union_left theorem image2_union_right : image2 f s (t βˆͺ t') = image2 f s t βˆͺ image2 f s t' := by rw [← image2_swap, image2_union_left, image2_swap f, image2_swap f] #align set.image2_union_right Set.image2_union_right lemma image2_inter_left (hf : Injective2 f) : image2 f (s ∩ s') t = image2 f s t ∩ image2 f s' t := by simp_rw [← image_uncurry_prod, inter_prod, image_inter hf.uncurry] #align set.image2_inter_left Set.image2_inter_left lemma image2_inter_right (hf : Injective2 f) : image2 f s (t ∩ t') = image2 f s t ∩ image2 f s t' := by simp_rw [← image_uncurry_prod, prod_inter, image_inter hf.uncurry] #align set.image2_inter_right Set.image2_inter_right @[simp] theorem image2_empty_left : image2 f βˆ… t = βˆ… := ext <| by simp #align set.image2_empty_left Set.image2_empty_left @[simp] theorem image2_empty_right : image2 f s βˆ… = βˆ… := ext <| by simp #align set.image2_empty_right Set.image2_empty_right theorem Nonempty.image2 : s.Nonempty β†’ t.Nonempty β†’ (image2 f s t).Nonempty := fun ⟨_, ha⟩ ⟨_, hb⟩ => ⟨_, mem_image2_of_mem ha hb⟩ #align set.nonempty.image2 Set.Nonempty.image2 @[simp] theorem image2_nonempty_iff : (image2 f s t).Nonempty ↔ s.Nonempty ∧ t.Nonempty := ⟨fun ⟨_, a, ha, b, hb, _⟩ => ⟨⟨a, ha⟩, b, hb⟩, fun h => h.1.image2 h.2⟩ #align set.image2_nonempty_iff Set.image2_nonempty_iff theorem Nonempty.of_image2_left (h : (Set.image2 f s t).Nonempty) : s.Nonempty := (image2_nonempty_iff.1 h).1 #align set.nonempty.of_image2_left Set.Nonempty.of_image2_left theorem Nonempty.of_image2_right (h : (Set.image2 f s t).Nonempty) : t.Nonempty := (image2_nonempty_iff.1 h).2 #align set.nonempty.of_image2_right Set.Nonempty.of_image2_right @[simp] theorem image2_eq_empty_iff : image2 f s t = βˆ… ↔ s = βˆ… ∨ t = βˆ… := by rw [← not_nonempty_iff_eq_empty, image2_nonempty_iff, not_and_or] simp [not_nonempty_iff_eq_empty] #align set.image2_eq_empty_iff Set.image2_eq_empty_iff theorem Subsingleton.image2 (hs : s.Subsingleton) (ht : t.Subsingleton) (f : Ξ± β†’ Ξ² β†’ Ξ³) : (image2 f s t).Subsingleton := by rw [← image_prod] apply (hs.prod ht).image theorem image2_inter_subset_left : image2 f (s ∩ s') t βŠ† image2 f s t ∩ image2 f s' t := Monotone.map_inf_le (fun _ _ ↦ image2_subset_right) s s' #align set.image2_inter_subset_left Set.image2_inter_subset_left theorem image2_inter_subset_right : image2 f s (t ∩ t') βŠ† image2 f s t ∩ image2 f s t' := Monotone.map_inf_le (fun _ _ ↦ image2_subset_left) t t' #align set.image2_inter_subset_right Set.image2_inter_subset_right @[simp] theorem image2_singleton_left : image2 f {a} t = f a '' t := ext fun x => by simp #align set.image2_singleton_left Set.image2_singleton_left @[simp] theorem image2_singleton_right : image2 f s {b} = (fun a => f a b) '' s := ext fun x => by simp #align set.image2_singleton_right Set.image2_singleton_right theorem image2_singleton : image2 f {a} {b} = {f a b} := by simp #align set.image2_singleton Set.image2_singleton @[simp] theorem image2_insert_left : image2 f (insert a s) t = (fun b => f a b) '' t βˆͺ image2 f s t := by rw [insert_eq, image2_union_left, image2_singleton_left] #align set.image2_insert_left Set.image2_insert_left @[simp] theorem image2_insert_right : image2 f s (insert b t) = (fun a => f a b) '' s βˆͺ image2 f s t := by rw [insert_eq, image2_union_right, image2_singleton_right] #align set.image2_insert_right Set.image2_insert_right @[congr] theorem image2_congr (h : βˆ€ a ∈ s, βˆ€ b ∈ t, f a b = f' a b) : image2 f s t = image2 f' s t := by ext constructor <;> rintro ⟨a, ha, b, hb, rfl⟩ <;> exact ⟨a, ha, b, hb, by rw [h a ha b hb]⟩ #align set.image2_congr Set.image2_congr theorem image2_congr' (h : βˆ€ a b, f a b = f' a b) : image2 f s t = image2 f' s t := image2_congr fun a _ b _ => h a b #align set.image2_congr' Set.image2_congr' #noalign set.image3 #noalign set.mem_image3 #noalign set.image3_mono #noalign set.image3_congr #noalign set.image3_congr' #noalign set.image2_image2_left #noalign set.image2_image2_right theorem image_image2 (f : Ξ± β†’ Ξ² β†’ Ξ³) (g : Ξ³ β†’ Ξ΄) : g '' image2 f s t = image2 (fun a b => g (f a b)) s t := by simp only [← image_prod, image_image] #align set.image_image2 Set.image_image2 theorem image2_image_left (f : Ξ³ β†’ Ξ² β†’ Ξ΄) (g : Ξ± β†’ Ξ³) : image2 f (g '' s) t = image2 (fun a b => f (g a) b) s t := by ext; simp #align set.image2_image_left Set.image2_image_left theorem image2_image_right (f : Ξ± β†’ Ξ³ β†’ Ξ΄) (g : Ξ² β†’ Ξ³) : image2 f s (g '' t) = image2 (fun a b => f a (g b)) s t := by ext; simp #align set.image2_image_right Set.image2_image_right @[simp] theorem image2_left (h : t.Nonempty) : image2 (fun x _ => x) s t = s := by simp [nonempty_def.mp h, ext_iff] #align set.image2_left Set.image2_left @[simp]
Mathlib/Data/Set/NAry.lean
230
231
theorem image2_right (h : s.Nonempty) : image2 (fun _ y => y) s t = t := by
simp [nonempty_def.mp h, ext_iff]
import Mathlib.LinearAlgebra.AffineSpace.Basis import Mathlib.LinearAlgebra.Matrix.NonsingularInverse #align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine Matrix open Set universe u₁ uβ‚‚ u₃ uβ‚„ variable {ΞΉ : Type u₁} {k : Type uβ‚‚} {V : Type u₃} {P : Type uβ‚„} variable [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ΞΉ k P) noncomputable def toMatrix {ΞΉ' : Type*} (q : ΞΉ' β†’ P) : Matrix ΞΉ' ΞΉ k := fun i j => b.coord j (q i) #align affine_basis.to_matrix AffineBasis.toMatrix @[simp] theorem toMatrix_apply {ΞΉ' : Type*} (q : ΞΉ' β†’ P) (i : ΞΉ') (j : ΞΉ) : b.toMatrix q i j = b.coord j (q i) := rfl #align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply @[simp] theorem toMatrix_self [DecidableEq ΞΉ] : b.toMatrix b = (1 : Matrix ΞΉ ΞΉ k) := by ext i j rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply] #align affine_basis.to_matrix_self AffineBasis.toMatrix_self variable {ΞΉ' : Type*}
Mathlib/LinearAlgebra/AffineSpace/Matrix.lean
55
56
theorem toMatrix_row_sum_one [Fintype ΞΉ] (q : ΞΉ' β†’ P) (i : ΞΉ') : βˆ‘ j, b.toMatrix q i j = 1 := by
simp
import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Limits.HasLimits #align_import category_theory.limits.shapes.equalizers from "leanprover-community/mathlib"@"4698e35ca56a0d4fa53aa5639c3364e0a77f4eba" section open CategoryTheory Opposite namespace CategoryTheory.Limits -- attribute [local tidy] tactic.case_bash -- Porting note: no tidy nor cases_bash universe v vβ‚‚ u uβ‚‚ inductive WalkingParallelPair : Type | zero | one deriving DecidableEq, Inhabited #align category_theory.limits.walking_parallel_pair CategoryTheory.Limits.WalkingParallelPair open WalkingParallelPair inductive WalkingParallelPairHom : WalkingParallelPair β†’ WalkingParallelPair β†’ Type | left : WalkingParallelPairHom zero one | right : WalkingParallelPairHom zero one | id (X : WalkingParallelPair) : WalkingParallelPairHom X X deriving DecidableEq #align category_theory.limits.walking_parallel_pair_hom CategoryTheory.Limits.WalkingParallelPairHom attribute [-simp, nolint simpNF] WalkingParallelPairHom.id.sizeOf_spec instance : Inhabited (WalkingParallelPairHom zero one) where default := WalkingParallelPairHom.left open WalkingParallelPairHom def WalkingParallelPairHom.comp : -- Porting note: changed X Y Z to implicit to match comp fields in precategory βˆ€ { X Y Z : WalkingParallelPair } (_ : WalkingParallelPairHom X Y) (_ : WalkingParallelPairHom Y Z), WalkingParallelPairHom X Z | _, _, _, id _, h => h | _, _, _, left, id one => left | _, _, _, right, id one => right #align category_theory.limits.walking_parallel_pair_hom.comp CategoryTheory.Limits.WalkingParallelPairHom.comp -- Porting note: adding these since they are simple and aesop couldn't directly prove them theorem WalkingParallelPairHom.id_comp {X Y : WalkingParallelPair} (g : WalkingParallelPairHom X Y) : comp (id X) g = g := rfl theorem WalkingParallelPairHom.comp_id {X Y : WalkingParallelPair} (f : WalkingParallelPairHom X Y) : comp f (id Y) = f := by cases f <;> rfl theorem WalkingParallelPairHom.assoc {X Y Z W : WalkingParallelPair} (f : WalkingParallelPairHom X Y) (g: WalkingParallelPairHom Y Z) (h : WalkingParallelPairHom Z W) : comp (comp f g) h = comp f (comp g h) := by cases f <;> cases g <;> cases h <;> rfl instance walkingParallelPairHomCategory : SmallCategory WalkingParallelPair where Hom := WalkingParallelPairHom id := id comp := comp comp_id := comp_id id_comp := id_comp assoc := assoc #align category_theory.limits.walking_parallel_pair_hom_category CategoryTheory.Limits.walkingParallelPairHomCategory @[simp] theorem walkingParallelPairHom_id (X : WalkingParallelPair) : WalkingParallelPairHom.id X = πŸ™ X := rfl #align category_theory.limits.walking_parallel_pair_hom_id CategoryTheory.Limits.walkingParallelPairHom_id -- Porting note: simpNF asked me to do this because the LHS of the non-primed version reduced @[simp] theorem WalkingParallelPairHom.id.sizeOf_spec' (X : WalkingParallelPair) : (WalkingParallelPairHom._sizeOf_inst X X).sizeOf (πŸ™ X) = 1 + sizeOf X := by cases X <;> rfl def walkingParallelPairOp : WalkingParallelPair β₯€ WalkingParallelPairα΅’α΅– where obj x := op <| by cases x; exacts [one, zero] map f := by cases f <;> apply Quiver.Hom.op exacts [left, right, WalkingParallelPairHom.id _] map_comp := by rintro _ _ _ (_|_|_) g <;> cases g <;> rfl #align category_theory.limits.walking_parallel_pair_op CategoryTheory.Limits.walkingParallelPairOp @[simp] theorem walkingParallelPairOp_zero : walkingParallelPairOp.obj zero = op one := rfl #align category_theory.limits.walking_parallel_pair_op_zero CategoryTheory.Limits.walkingParallelPairOp_zero @[simp] theorem walkingParallelPairOp_one : walkingParallelPairOp.obj one = op zero := rfl #align category_theory.limits.walking_parallel_pair_op_one CategoryTheory.Limits.walkingParallelPairOp_one @[simp] theorem walkingParallelPairOp_left : walkingParallelPairOp.map left = @Quiver.Hom.op _ _ zero one left := rfl #align category_theory.limits.walking_parallel_pair_op_left CategoryTheory.Limits.walkingParallelPairOp_left @[simp] theorem walkingParallelPairOp_right : walkingParallelPairOp.map right = @Quiver.Hom.op _ _ zero one right := rfl #align category_theory.limits.walking_parallel_pair_op_right CategoryTheory.Limits.walkingParallelPairOp_right @[simps functor inverse] def walkingParallelPairOpEquiv : WalkingParallelPair β‰Œ WalkingParallelPairα΅’α΅– where functor := walkingParallelPairOp inverse := walkingParallelPairOp.leftOp unitIso := NatIso.ofComponents (fun j => eqToIso (by cases j <;> rfl)) (by rintro _ _ (_ | _ | _) <;> simp) counitIso := NatIso.ofComponents (fun j => eqToIso (by induction' j with X cases X <;> rfl)) (fun {i} {j} f => by induction' i with i induction' j with j let g := f.unop have : f = g.op := rfl rw [this] cases i <;> cases j <;> cases g <;> rfl) functor_unitIso_comp := fun j => by cases j <;> rfl #align category_theory.limits.walking_parallel_pair_op_equiv CategoryTheory.Limits.walkingParallelPairOpEquiv @[simp] theorem walkingParallelPairOpEquiv_unitIso_zero : walkingParallelPairOpEquiv.unitIso.app zero = Iso.refl zero := rfl #align category_theory.limits.walking_parallel_pair_op_equiv_unit_iso_zero CategoryTheory.Limits.walkingParallelPairOpEquiv_unitIso_zero @[simp] theorem walkingParallelPairOpEquiv_unitIso_one : walkingParallelPairOpEquiv.unitIso.app one = Iso.refl one := rfl #align category_theory.limits.walking_parallel_pair_op_equiv_unit_iso_one CategoryTheory.Limits.walkingParallelPairOpEquiv_unitIso_one @[simp] theorem walkingParallelPairOpEquiv_counitIso_zero : walkingParallelPairOpEquiv.counitIso.app (op zero) = Iso.refl (op zero) := rfl #align category_theory.limits.walking_parallel_pair_op_equiv_counit_iso_zero CategoryTheory.Limits.walkingParallelPairOpEquiv_counitIso_zero @[simp] theorem walkingParallelPairOpEquiv_counitIso_one : walkingParallelPairOpEquiv.counitIso.app (op one) = Iso.refl (op one) := rfl #align category_theory.limits.walking_parallel_pair_op_equiv_counit_iso_one CategoryTheory.Limits.walkingParallelPairOpEquiv_counitIso_one variable {C : Type u} [Category.{v} C] variable {X Y : C} def parallelPair (f g : X ⟢ Y) : WalkingParallelPair β₯€ C where obj x := match x with | zero => X | one => Y map h := match h with | WalkingParallelPairHom.id _ => πŸ™ _ | left => f | right => g -- `sorry` can cope with this, but it's too slow: map_comp := by rintro _ _ _ ⟨⟩ g <;> cases g <;> {dsimp; simp} #align category_theory.limits.parallel_pair CategoryTheory.Limits.parallelPair @[simp] theorem parallelPair_obj_zero (f g : X ⟢ Y) : (parallelPair f g).obj zero = X := rfl #align category_theory.limits.parallel_pair_obj_zero CategoryTheory.Limits.parallelPair_obj_zero @[simp] theorem parallelPair_obj_one (f g : X ⟢ Y) : (parallelPair f g).obj one = Y := rfl #align category_theory.limits.parallel_pair_obj_one CategoryTheory.Limits.parallelPair_obj_one @[simp] theorem parallelPair_map_left (f g : X ⟢ Y) : (parallelPair f g).map left = f := rfl #align category_theory.limits.parallel_pair_map_left CategoryTheory.Limits.parallelPair_map_left @[simp] theorem parallelPair_map_right (f g : X ⟢ Y) : (parallelPair f g).map right = g := rfl #align category_theory.limits.parallel_pair_map_right CategoryTheory.Limits.parallelPair_map_right @[simp]
Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean
241
242
theorem parallelPair_functor_obj {F : WalkingParallelPair β₯€ C} (j : WalkingParallelPair) : (parallelPair (F.map left) (F.map right)).obj j = F.obj j := by
cases j <;> rfl
import Mathlib.Algebra.Exact import Mathlib.RingTheory.TensorProduct.Basic section Modules open TensorProduct LinearMap section Semiring variable {R : Type*} [CommSemiring R] {M N P Q: Type*} [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q] [Module R M] [Module R N] [Module R P] [Module R Q] {f : M β†’β‚—[R] N} (g : N β†’β‚—[R] P) lemma le_comap_range_lTensor (q : Q) : LinearMap.range g ≀ (LinearMap.range (lTensor Q g)).comap (TensorProduct.mk R Q P q) := by rintro x ⟨n, rfl⟩ exact ⟨q βŠ—β‚œ[R] n, rfl⟩ lemma le_comap_range_rTensor (q : Q) : LinearMap.range g ≀ (LinearMap.range (rTensor Q g)).comap ((TensorProduct.mk R P Q).flip q) := by rintro x ⟨n, rfl⟩ exact ⟨n βŠ—β‚œ[R] q, rfl⟩ variable (Q) {g} theorem LinearMap.lTensor_surjective (hg : Function.Surjective g) : Function.Surjective (lTensor Q g) := by intro z induction z using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul q p => obtain ⟨n, rfl⟩ := hg p exact ⟨q βŠ—β‚œ[R] n, rfl⟩ | add x y hx hy => obtain ⟨x, rfl⟩ := hx obtain ⟨y, rfl⟩ := hy exact ⟨x + y, map_add _ _ _⟩ theorem LinearMap.lTensor_range : range (lTensor Q g) = range (lTensor Q (Submodule.subtype (range g))) := by have : g = (Submodule.subtype _).comp g.rangeRestrict := rfl nth_rewrite 1 [this] rw [lTensor_comp] apply range_comp_of_range_eq_top rw [range_eq_top] apply lTensor_surjective rw [← range_eq_top, range_rangeRestrict] theorem LinearMap.rTensor_surjective (hg : Function.Surjective g) : Function.Surjective (rTensor Q g) := by intro z induction z using TensorProduct.induction_on with | zero => exact ⟨0, map_zero _⟩ | tmul p q => obtain ⟨n, rfl⟩ := hg p exact ⟨n βŠ—β‚œ[R] q, rfl⟩ | add x y hx hy => obtain ⟨x, rfl⟩ := hx obtain ⟨y, rfl⟩ := hy exact ⟨x + y, map_add _ _ _⟩
Mathlib/LinearAlgebra/TensorProduct/RightExactness.lean
149
158
theorem LinearMap.rTensor_range : range (rTensor Q g) = range (rTensor Q (Submodule.subtype (range g))) := by
have : g = (Submodule.subtype _).comp g.rangeRestrict := rfl nth_rewrite 1 [this] rw [rTensor_comp] apply range_comp_of_range_eq_top rw [range_eq_top] apply rTensor_surjective rw [← range_eq_top, range_rangeRestrict]
import Mathlib.Algebra.Group.Aut import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Logic.Function.Basic #align_import group_theory.semidirect_product from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable (N : Type*) (G : Type*) {H : Type*} [Group N] [Group G] [Group H] @[ext] structure SemidirectProduct (Ο† : G β†’* MulAut N) where left : N right : G deriving DecidableEq #align semidirect_product SemidirectProduct -- Porting note: these lemmas are autogenerated by the inductive definition and are not -- in simple form due to the existence of mk_eq_inl_mul_inr attribute [nolint simpNF] SemidirectProduct.mk.injEq attribute [nolint simpNF] SemidirectProduct.mk.sizeOf_spec -- Porting note: unknown attribute -- attribute [pp_using_anonymous_constructor] SemidirectProduct @[inherit_doc] notation:35 N " β‹Š[" Ο†:35 "] " G:35 => SemidirectProduct N G Ο† namespace SemidirectProduct variable {N G} variable {Ο† : G β†’* MulAut N} instance : Mul (SemidirectProduct N G Ο†) where mul a b := ⟨a.1 * Ο† a.2 b.1, a.2 * b.2⟩ lemma mul_def (a b : SemidirectProduct N G Ο†) : a * b = ⟨a.1 * Ο† a.2 b.1, a.2 * b.2⟩ := rfl @[simp] theorem mul_left (a b : N β‹Š[Ο†] G) : (a * b).left = a.left * Ο† a.right b.left := rfl #align semidirect_product.mul_left SemidirectProduct.mul_left @[simp] theorem mul_right (a b : N β‹Š[Ο†] G) : (a * b).right = a.right * b.right := rfl #align semidirect_product.mul_right SemidirectProduct.mul_right instance : One (SemidirectProduct N G Ο†) where one := ⟨1, 1⟩ @[simp] theorem one_left : (1 : N β‹Š[Ο†] G).left = 1 := rfl #align semidirect_product.one_left SemidirectProduct.one_left @[simp] theorem one_right : (1 : N β‹Š[Ο†] G).right = 1 := rfl #align semidirect_product.one_right SemidirectProduct.one_right instance : Inv (SemidirectProduct N G Ο†) where inv x := βŸ¨Ο† x.2⁻¹ x.1⁻¹, x.2⁻¹⟩ @[simp] theorem inv_left (a : N β‹Š[Ο†] G) : a⁻¹.left = Ο† a.right⁻¹ a.left⁻¹ := rfl #align semidirect_product.inv_left SemidirectProduct.inv_left @[simp] theorem inv_right (a : N β‹Š[Ο†] G) : a⁻¹.right = a.right⁻¹ := rfl #align semidirect_product.inv_right SemidirectProduct.inv_right instance : Group (N β‹Š[Ο†] G) where mul_assoc a b c := SemidirectProduct.ext _ _ (by simp [mul_assoc]) (by simp [mul_assoc]) one_mul a := SemidirectProduct.ext _ _ (by simp) (one_mul a.2) mul_one a := SemidirectProduct.ext _ _ (by simp) (mul_one _) mul_left_inv a := SemidirectProduct.ext _ _ (by simp) (by simp) instance : Inhabited (N β‹Š[Ο†] G) := ⟨1⟩ def inl : N β†’* N β‹Š[Ο†] G where toFun n := ⟨n, 1⟩ map_one' := rfl map_mul' := by intros; ext <;> simp only [mul_left, map_one, MulAut.one_apply, mul_right, mul_one] #align semidirect_product.inl SemidirectProduct.inl @[simp] theorem left_inl (n : N) : (inl n : N β‹Š[Ο†] G).left = n := rfl #align semidirect_product.left_inl SemidirectProduct.left_inl @[simp] theorem right_inl (n : N) : (inl n : N β‹Š[Ο†] G).right = 1 := rfl #align semidirect_product.right_inl SemidirectProduct.right_inl theorem inl_injective : Function.Injective (inl : N β†’ N β‹Š[Ο†] G) := Function.injective_iff_hasLeftInverse.2 ⟨left, left_inl⟩ #align semidirect_product.inl_injective SemidirectProduct.inl_injective @[simp] theorem inl_inj {n₁ nβ‚‚ : N} : (inl n₁ : N β‹Š[Ο†] G) = inl nβ‚‚ ↔ n₁ = nβ‚‚ := inl_injective.eq_iff #align semidirect_product.inl_inj SemidirectProduct.inl_inj def inr : G β†’* N β‹Š[Ο†] G where toFun g := ⟨1, g⟩ map_one' := rfl map_mul' := by intros; ext <;> simp #align semidirect_product.inr SemidirectProduct.inr @[simp] theorem left_inr (g : G) : (inr g : N β‹Š[Ο†] G).left = 1 := rfl #align semidirect_product.left_inr SemidirectProduct.left_inr @[simp] theorem right_inr (g : G) : (inr g : N β‹Š[Ο†] G).right = g := rfl #align semidirect_product.right_inr SemidirectProduct.right_inr theorem inr_injective : Function.Injective (inr : G β†’ N β‹Š[Ο†] G) := Function.injective_iff_hasLeftInverse.2 ⟨right, right_inr⟩ #align semidirect_product.inr_injective SemidirectProduct.inr_injective @[simp] theorem inr_inj {g₁ gβ‚‚ : G} : (inr g₁ : N β‹Š[Ο†] G) = inr gβ‚‚ ↔ g₁ = gβ‚‚ := inr_injective.eq_iff #align semidirect_product.inr_inj SemidirectProduct.inr_inj theorem inl_aut (g : G) (n : N) : (inl (Ο† g n) : N β‹Š[Ο†] G) = inr g * inl n * inr g⁻¹ := by ext <;> simp #align semidirect_product.inl_aut SemidirectProduct.inl_aut theorem inl_aut_inv (g : G) (n : N) : (inl ((Ο† g)⁻¹ n) : N β‹Š[Ο†] G) = inr g⁻¹ * inl n * inr g := by rw [← MonoidHom.map_inv, inl_aut, inv_inv] #align semidirect_product.inl_aut_inv SemidirectProduct.inl_aut_inv @[simp] theorem mk_eq_inl_mul_inr (g : G) (n : N) : (⟨n, g⟩ : N β‹Š[Ο†] G) = inl n * inr g := by ext <;> simp #align semidirect_product.mk_eq_inl_mul_inr SemidirectProduct.mk_eq_inl_mul_inr @[simp] theorem inl_left_mul_inr_right (x : N β‹Š[Ο†] G) : inl x.left * inr x.right = x := by ext <;> simp #align semidirect_product.inl_left_mul_inr_right SemidirectProduct.inl_left_mul_inr_right def rightHom : N β‹Š[Ο†] G β†’* G where toFun := SemidirectProduct.right map_one' := rfl map_mul' _ _ := rfl #align semidirect_product.right_hom SemidirectProduct.rightHom @[simp] theorem rightHom_eq_right : (rightHom : N β‹Š[Ο†] G β†’ G) = right := rfl #align semidirect_product.right_hom_eq_right SemidirectProduct.rightHom_eq_right @[simp] theorem rightHom_comp_inl : (rightHom : N β‹Š[Ο†] G β†’* G).comp inl = 1 := by ext; simp [rightHom] #align semidirect_product.right_hom_comp_inl SemidirectProduct.rightHom_comp_inl @[simp] theorem rightHom_comp_inr : (rightHom : N β‹Š[Ο†] G β†’* G).comp inr = MonoidHom.id _ := by ext; simp [rightHom] #align semidirect_product.right_hom_comp_inr SemidirectProduct.rightHom_comp_inr @[simp] theorem rightHom_inl (n : N) : rightHom (inl n : N β‹Š[Ο†] G) = 1 := by simp [rightHom] #align semidirect_product.right_hom_inl SemidirectProduct.rightHom_inl @[simp] theorem rightHom_inr (g : G) : rightHom (inr g : N β‹Š[Ο†] G) = g := by simp [rightHom] #align semidirect_product.right_hom_inr SemidirectProduct.rightHom_inr theorem rightHom_surjective : Function.Surjective (rightHom : N β‹Š[Ο†] G β†’ G) := Function.surjective_iff_hasRightInverse.2 ⟨inr, rightHom_inr⟩ #align semidirect_product.right_hom_surjective SemidirectProduct.rightHom_surjective theorem range_inl_eq_ker_rightHom : (inl : N β†’* N β‹Š[Ο†] G).range = rightHom.ker := le_antisymm (fun _ ↦ by simp (config := { contextual := true }) [MonoidHom.mem_ker, eq_comm]) fun x hx ↦ ⟨x.left, by ext <;> simp_all [MonoidHom.mem_ker]⟩ #align semidirect_product.range_inl_eq_ker_right_hom SemidirectProduct.range_inl_eq_ker_rightHom section Map variable {N₁ : Type*} {G₁ : Type*} [Group N₁] [Group G₁] {φ₁ : G₁ β†’* MulAut N₁} def map (f₁ : N β†’* N₁) (fβ‚‚ : G β†’* G₁) (h : βˆ€ g : G, f₁.comp (Ο† g).toMonoidHom = (φ₁ (fβ‚‚ g)).toMonoidHom.comp f₁) : N β‹Š[Ο†] G β†’* N₁ β‹Š[φ₁] G₁ where toFun x := ⟨f₁ x.1, fβ‚‚ x.2⟩ map_one' := by simp map_mul' x y := by replace h := DFunLike.ext_iff.1 (h x.right) y.left ext <;> simp_all #align semidirect_product.map SemidirectProduct.map variable (f₁ : N β†’* N₁) (fβ‚‚ : G β†’* G₁) (h : βˆ€ g : G, f₁.comp (Ο† g).toMonoidHom = (φ₁ (fβ‚‚ g)).toMonoidHom.comp f₁) @[simp] theorem map_left (g : N β‹Š[Ο†] G) : (map f₁ fβ‚‚ h g).left = f₁ g.left := rfl #align semidirect_product.map_left SemidirectProduct.map_left @[simp] theorem map_right (g : N β‹Š[Ο†] G) : (map f₁ fβ‚‚ h g).right = fβ‚‚ g.right := rfl #align semidirect_product.map_right SemidirectProduct.map_right @[simp] theorem rightHom_comp_map : rightHom.comp (map f₁ fβ‚‚ h) = fβ‚‚.comp rightHom := rfl #align semidirect_product.right_hom_comp_map SemidirectProduct.rightHom_comp_map @[simp]
Mathlib/GroupTheory/SemidirectProduct.lean
292
292
theorem map_inl (n : N) : map f₁ fβ‚‚ h (inl n) = inl (f₁ n) := by
simp [map]
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 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 #align list.nodupkeys.eq_of_mk_mem List.NodupKeys.eq_of_mk_mem theorem nodupKeys_singleton (s : Sigma Ξ²) : NodupKeys [s] := nodup_singleton _ #align list.nodupkeys_singleton List.nodupKeys_singleton theorem NodupKeys.sublist {l₁ lβ‚‚ : List (Sigma Ξ²)} (h : l₁ <+ lβ‚‚) : NodupKeys lβ‚‚ β†’ NodupKeys l₁ := Nodup.sublist <| h.map _ #align list.nodupkeys.sublist List.NodupKeys.sublist protected theorem NodupKeys.nodup {l : List (Sigma Ξ²)} : NodupKeys l β†’ Nodup l := Nodup.of_map _ #align list.nodupkeys.nodup List.NodupKeys.nodup theorem perm_nodupKeys {l₁ lβ‚‚ : List (Sigma Ξ²)} (h : l₁ ~ lβ‚‚) : NodupKeys l₁ ↔ NodupKeys lβ‚‚ := (h.map _).nodup_iff #align list.perm_nodupkeys List.perm_nodupKeys theorem nodupKeys_join {L : List (List (Sigma Ξ²))} : NodupKeys (join L) ↔ (βˆ€ l ∈ L, NodupKeys l) ∧ Pairwise Disjoint (L.map keys) := by rw [nodupKeys_iff_pairwise, pairwise_join, pairwise_map] refine and_congr (forallβ‚‚_congr fun l _ => by simp [nodupKeys_iff_pairwise]) ?_ apply iff_of_eq; congr with (l₁ lβ‚‚) simp [keys, disjoint_iff_ne] #align list.nodupkeys_join List.nodupKeys_join theorem nodup_enum_map_fst (l : List Ξ±) : (l.enum.map Prod.fst).Nodup := by simp [List.nodup_range] #align list.nodup_enum_map_fst List.nodup_enum_map_fst theorem mem_ext {lβ‚€ l₁ : List (Sigma Ξ²)} (ndβ‚€ : lβ‚€.Nodup) (nd₁ : l₁.Nodup) (h : βˆ€ x, x ∈ lβ‚€ ↔ x ∈ l₁) : lβ‚€ ~ l₁ := (perm_ext_iff_of_nodup ndβ‚€ nd₁).2 h #align list.mem_ext List.mem_ext variable [DecidableEq Ξ±] -- Porting note: renaming to `dlookup` since `lookup` already exists def dlookup (a : Ξ±) : List (Sigma Ξ²) β†’ Option (Ξ² a) | [] => none | ⟨a', b⟩ :: l => if h : a' = a then some (Eq.recOn h b) else dlookup a l #align list.lookup List.dlookup @[simp] theorem dlookup_nil (a : Ξ±) : dlookup a [] = @none (Ξ² a) := rfl #align list.lookup_nil List.dlookup_nil @[simp] theorem dlookup_cons_eq (l) (a : Ξ±) (b : Ξ² a) : dlookup a (⟨a, b⟩ :: l) = some b := dif_pos rfl #align list.lookup_cons_eq List.dlookup_cons_eq @[simp] theorem dlookup_cons_ne (l) {a} : βˆ€ s : Sigma Ξ², a β‰  s.1 β†’ dlookup a (s :: l) = dlookup a l | ⟨_, _⟩, h => dif_neg h.symm #align list.lookup_cons_ne List.dlookup_cons_ne theorem dlookup_isSome {a : Ξ±} : βˆ€ {l : List (Sigma Ξ²)}, (dlookup a l).isSome ↔ a ∈ l.keys | [] => by simp | ⟨a', b⟩ :: l => by by_cases h : a = a' Β· subst a' simp Β· simp [h, dlookup_isSome] #align list.lookup_is_some List.dlookup_isSome theorem dlookup_eq_none {a : Ξ±} {l : List (Sigma Ξ²)} : dlookup a l = none ↔ a βˆ‰ l.keys := by simp [← dlookup_isSome, Option.isNone_iff_eq_none] #align list.lookup_eq_none List.dlookup_eq_none theorem of_mem_dlookup {a : Ξ±} {b : Ξ² a} : βˆ€ {l : List (Sigma Ξ²)}, b ∈ dlookup a l β†’ Sigma.mk a b ∈ l | ⟨a', b'⟩ :: l, H => by by_cases h : a = a' Β· subst a' simp? at H says simp only [dlookup_cons_eq, Option.mem_def, Option.some.injEq] at H simp [H] Β· simp only [ne_eq, h, not_false_iff, dlookup_cons_ne] at H simp [of_mem_dlookup H] #align list.of_mem_lookup List.of_mem_dlookup theorem mem_dlookup {a} {b : Ξ² a} {l : List (Sigma Ξ²)} (nd : l.NodupKeys) (h : Sigma.mk a b ∈ l) : b ∈ dlookup a l := by cases' Option.isSome_iff_exists.mp (dlookup_isSome.mpr (mem_keys_of_mem h)) with b' h' cases nd.eq_of_mk_mem h (of_mem_dlookup h') exact h' #align list.mem_lookup List.mem_dlookup theorem map_dlookup_eq_find (a : Ξ±) : βˆ€ l : List (Sigma Ξ²), (dlookup a l).map (Sigma.mk a) = find? (fun s => a = s.1) l | [] => rfl | ⟨a', b'⟩ :: l => by by_cases h : a = a' Β· subst a' simp Β· simpa [h] using map_dlookup_eq_find a l #align list.map_lookup_eq_find List.map_dlookup_eq_find theorem mem_dlookup_iff {a : Ξ±} {b : Ξ² a} {l : List (Sigma Ξ²)} (nd : l.NodupKeys) : b ∈ dlookup a l ↔ Sigma.mk a b ∈ l := ⟨of_mem_dlookup, mem_dlookup nd⟩ #align list.mem_lookup_iff List.mem_dlookup_iff theorem perm_dlookup (a : Ξ±) {l₁ lβ‚‚ : List (Sigma Ξ²)} (nd₁ : l₁.NodupKeys) (ndβ‚‚ : lβ‚‚.NodupKeys) (p : l₁ ~ lβ‚‚) : dlookup a l₁ = dlookup a lβ‚‚ := by ext b; simp only [mem_dlookup_iff nd₁, mem_dlookup_iff ndβ‚‚]; exact p.mem_iff #align list.perm_lookup List.perm_dlookup theorem lookup_ext {lβ‚€ l₁ : List (Sigma Ξ²)} (ndβ‚€ : lβ‚€.NodupKeys) (nd₁ : l₁.NodupKeys) (h : βˆ€ x y, y ∈ lβ‚€.dlookup x ↔ y ∈ l₁.dlookup x) : lβ‚€ ~ l₁ := mem_ext ndβ‚€.nodup nd₁.nodup fun ⟨a, b⟩ => by rw [← mem_dlookup_iff, ← mem_dlookup_iff, h] <;> assumption #align list.lookup_ext List.lookup_ext def lookupAll (a : Ξ±) : List (Sigma Ξ²) β†’ List (Ξ² a) | [] => [] | ⟨a', b⟩ :: l => if h : a' = a then Eq.recOn h b :: lookupAll a l else lookupAll a l #align list.lookup_all List.lookupAll @[simp] theorem lookupAll_nil (a : Ξ±) : lookupAll a [] = @nil (Ξ² a) := rfl #align list.lookup_all_nil List.lookupAll_nil @[simp] theorem lookupAll_cons_eq (l) (a : Ξ±) (b : Ξ² a) : lookupAll a (⟨a, b⟩ :: l) = b :: lookupAll a l := dif_pos rfl #align list.lookup_all_cons_eq List.lookupAll_cons_eq @[simp] theorem lookupAll_cons_ne (l) {a} : βˆ€ s : Sigma Ξ², a β‰  s.1 β†’ lookupAll a (s :: l) = lookupAll a l | ⟨_, _⟩, h => dif_neg h.symm #align list.lookup_all_cons_ne List.lookupAll_cons_ne theorem lookupAll_eq_nil {a : Ξ±} : βˆ€ {l : List (Sigma Ξ²)}, lookupAll a l = [] ↔ βˆ€ b : Ξ² a, Sigma.mk a b βˆ‰ l | [] => by simp | ⟨a', b⟩ :: l => by by_cases h : a = a' Β· subst a' simp only [lookupAll_cons_eq, mem_cons, Sigma.mk.inj_iff, heq_eq_eq, true_and, not_or, false_iff, not_forall, not_and, not_not] use b simp Β· simp [h, lookupAll_eq_nil] #align list.lookup_all_eq_nil List.lookupAll_eq_nil theorem head?_lookupAll (a : Ξ±) : βˆ€ l : List (Sigma Ξ²), head? (lookupAll a l) = dlookup a l | [] => by simp | ⟨a', b⟩ :: l => by by_cases h : a = a' Β· subst h; simp Β· rw [lookupAll_cons_ne, dlookup_cons_ne, head?_lookupAll a l] <;> assumption #align list.head_lookup_all List.head?_lookupAll theorem mem_lookupAll {a : Ξ±} {b : Ξ² a} : βˆ€ {l : List (Sigma Ξ²)}, b ∈ lookupAll a l ↔ Sigma.mk a b ∈ l | [] => by simp | ⟨a', b'⟩ :: l => by by_cases h : a = a' Β· subst h simp [*, mem_lookupAll] Β· simp [*, mem_lookupAll] #align list.mem_lookup_all List.mem_lookupAll theorem lookupAll_sublist (a : Ξ±) : βˆ€ l : List (Sigma Ξ²), (lookupAll a l).map (Sigma.mk a) <+ l | [] => by simp | ⟨a', b'⟩ :: l => by by_cases h : a = a' Β· subst h simp only [ne_eq, not_true, lookupAll_cons_eq, List.map] exact (lookupAll_sublist a l).consβ‚‚ _ Β· simp only [ne_eq, h, not_false_iff, lookupAll_cons_ne] exact (lookupAll_sublist a l).cons _ #align list.lookup_all_sublist List.lookupAll_sublist theorem lookupAll_length_le_one (a : Ξ±) {l : List (Sigma Ξ²)} (h : l.NodupKeys) : length (lookupAll a l) ≀ 1 := by have := Nodup.sublist ((lookupAll_sublist a l).map _) h rw [map_map] at this rwa [← nodup_replicate, ← map_const] #align list.lookup_all_length_le_one List.lookupAll_length_le_one theorem lookupAll_eq_dlookup (a : Ξ±) {l : List (Sigma Ξ²)} (h : l.NodupKeys) : lookupAll a l = (dlookup a l).toList := by rw [← head?_lookupAll] have h1 := lookupAll_length_le_one a h; revert h1 rcases lookupAll a l with (_ | ⟨b, _ | ⟨c, l⟩⟩) <;> intro h1 <;> try rfl exact absurd h1 (by simp) #align list.lookup_all_eq_lookup List.lookupAll_eq_dlookup theorem lookupAll_nodup (a : Ξ±) {l : List (Sigma Ξ²)} (h : l.NodupKeys) : (lookupAll a l).Nodup := by (rw [lookupAll_eq_dlookup a h]; apply Option.toList_nodup) #align list.lookup_all_nodup List.lookupAll_nodup theorem perm_lookupAll (a : Ξ±) {l₁ lβ‚‚ : List (Sigma Ξ²)} (nd₁ : l₁.NodupKeys) (ndβ‚‚ : lβ‚‚.NodupKeys) (p : l₁ ~ lβ‚‚) : lookupAll a l₁ = lookupAll a lβ‚‚ := by simp [lookupAll_eq_dlookup, nd₁, ndβ‚‚, perm_dlookup a nd₁ ndβ‚‚ p] #align list.perm_lookup_all List.perm_lookupAll def kreplace (a : Ξ±) (b : Ξ² a) : List (Sigma Ξ²) β†’ List (Sigma Ξ²) := lookmap fun s => if a = s.1 then some ⟨a, b⟩ else none #align list.kreplace List.kreplace theorem kreplace_of_forall_not (a : Ξ±) (b : Ξ² a) {l : List (Sigma Ξ²)} (H : βˆ€ b : Ξ² a, Sigma.mk a b βˆ‰ l) : kreplace a b l = l := lookmap_of_forall_not _ <| by rintro ⟨a', b'⟩ h; dsimp; split_ifs Β· subst a' exact H _ h Β· rfl #align list.kreplace_of_forall_not List.kreplace_of_forall_not theorem kreplace_self {a : Ξ±} {b : Ξ² a} {l : List (Sigma Ξ²)} (nd : NodupKeys l) (h : Sigma.mk a b ∈ l) : kreplace a b l = l := by refine (lookmap_congr ?_).trans (lookmap_id' (Option.guard fun (s : Sigma Ξ²) => a = s.1) ?_ _) Β· rintro ⟨a', b'⟩ h' dsimp [Option.guard] split_ifs Β· subst a' simp [nd.eq_of_mk_mem h h'] Β· rfl Β· rintro ⟨a₁, bβ‚βŸ© ⟨aβ‚‚, bβ‚‚βŸ© dsimp [Option.guard] split_ifs Β· simp Β· rintro ⟨⟩ #align list.kreplace_self List.kreplace_self theorem keys_kreplace (a : Ξ±) (b : Ξ² a) : βˆ€ l : List (Sigma Ξ²), (kreplace a b l).keys = l.keys := lookmap_map_eq _ _ <| by rintro ⟨a₁, bβ‚‚βŸ© ⟨aβ‚‚, bβ‚‚βŸ© dsimp split_ifs with h <;> simp (config := { contextual := true }) [h] #align list.keys_kreplace List.keys_kreplace theorem kreplace_nodupKeys (a : Ξ±) (b : Ξ² a) {l : List (Sigma Ξ²)} : (kreplace a b l).NodupKeys ↔ l.NodupKeys := by simp [NodupKeys, keys_kreplace] #align list.kreplace_nodupkeys List.kreplace_nodupKeys theorem Perm.kreplace {a : Ξ±} {b : Ξ² a} {l₁ lβ‚‚ : List (Sigma Ξ²)} (nd : l₁.NodupKeys) : l₁ ~ lβ‚‚ β†’ kreplace a b l₁ ~ kreplace a b lβ‚‚ := perm_lookmap _ <| by refine nd.pairwise_ne.imp ?_ intro x y h z h₁ w hβ‚‚ split_ifs at h₁ hβ‚‚ with h_2 h_1 <;> cases h₁ <;> cases hβ‚‚ exact (h (h_2.symm.trans h_1)).elim #align list.perm.kreplace List.Perm.kreplace def kerase (a : Ξ±) : List (Sigma Ξ²) β†’ List (Sigma Ξ²) := eraseP fun s => a = s.1 #align list.kerase List.kerase -- Porting note (#10618): removing @[simp], `simp` can prove it theorem kerase_nil {a} : @kerase _ Ξ² _ a [] = [] := rfl #align list.kerase_nil List.kerase_nil @[simp] theorem kerase_cons_eq {a} {s : Sigma Ξ²} {l : List (Sigma Ξ²)} (h : a = s.1) : kerase a (s :: l) = l := by simp [kerase, h] #align list.kerase_cons_eq List.kerase_cons_eq @[simp] theorem kerase_cons_ne {a} {s : Sigma Ξ²} {l : List (Sigma Ξ²)} (h : a β‰  s.1) : kerase a (s :: l) = s :: kerase a l := by simp [kerase, h] #align list.kerase_cons_ne List.kerase_cons_ne @[simp] theorem kerase_of_not_mem_keys {a} {l : List (Sigma Ξ²)} (h : a βˆ‰ l.keys) : kerase a l = l := by induction' l with _ _ ih <;> [rfl; (simp [not_or] at h; simp [h.1, ih h.2])] #align list.kerase_of_not_mem_keys List.kerase_of_not_mem_keys theorem kerase_sublist (a : Ξ±) (l : List (Sigma Ξ²)) : kerase a l <+ l := eraseP_sublist _ #align list.kerase_sublist List.kerase_sublist theorem kerase_keys_subset (a) (l : List (Sigma Ξ²)) : (kerase a l).keys βŠ† l.keys := ((kerase_sublist a l).map _).subset #align list.kerase_keys_subset List.kerase_keys_subset theorem mem_keys_of_mem_keys_kerase {a₁ aβ‚‚} {l : List (Sigma Ξ²)} : a₁ ∈ (kerase aβ‚‚ l).keys β†’ a₁ ∈ l.keys := @kerase_keys_subset _ _ _ _ _ _ #align list.mem_keys_of_mem_keys_kerase List.mem_keys_of_mem_keys_kerase theorem exists_of_kerase {a : Ξ±} {l : List (Sigma Ξ²)} (h : a ∈ l.keys) : βˆƒ (b : Ξ² a) (l₁ lβ‚‚ : List (Sigma Ξ²)), a βˆ‰ l₁.keys ∧ l = l₁ ++ ⟨a, b⟩ :: lβ‚‚ ∧ kerase a l = l₁ ++ lβ‚‚ := by induction l with | nil => cases h | cons hd tl ih => by_cases e : a = hd.1 Β· subst e exact ⟨hd.2, [], tl, by simp, by cases hd; rfl, by simp⟩ Β· simp only [keys_cons, mem_cons] at h cases' h with h h Β· exact absurd h e rcases ih h with ⟨b, tl₁, tlβ‚‚, h₁, hβ‚‚, hβ‚ƒβŸ© exact ⟨b, hd :: tl₁, tlβ‚‚, not_mem_cons_of_ne_of_not_mem e h₁, by (rw [hβ‚‚]; rfl), by simp [e, h₃]⟩ #align list.exists_of_kerase List.exists_of_kerase @[simp] theorem mem_keys_kerase_of_ne {a₁ aβ‚‚} {l : List (Sigma Ξ²)} (h : a₁ β‰  aβ‚‚) : a₁ ∈ (kerase aβ‚‚ l).keys ↔ a₁ ∈ l.keys := (Iff.intro mem_keys_of_mem_keys_kerase) fun p => if q : aβ‚‚ ∈ l.keys then match l, kerase aβ‚‚ l, exists_of_kerase q, p with | _, _, ⟨_, _, _, _, rfl, rfl⟩, p => by simpa [keys, h] using p else by simp [q, p] #align list.mem_keys_kerase_of_ne List.mem_keys_kerase_of_ne theorem keys_kerase {a} {l : List (Sigma Ξ²)} : (kerase a l).keys = l.keys.erase a := by rw [keys, kerase, erase_eq_eraseP, eraseP_map, Function.comp] simp only [beq_eq_decide] congr funext simp #align list.keys_kerase List.keys_kerase theorem kerase_kerase {a a'} {l : List (Sigma Ξ²)} : (kerase a' l).kerase a = (kerase a l).kerase a' := by by_cases h : a = a' Β· subst a'; rfl induction' l with x xs Β· rfl Β· by_cases a' = x.1 Β· subst a' simp [kerase_cons_ne h, kerase_cons_eq rfl] by_cases h' : a = x.1 Β· subst a simp [kerase_cons_eq rfl, kerase_cons_ne (Ne.symm h)] Β· simp [kerase_cons_ne, *] #align list.kerase_kerase List.kerase_kerase theorem NodupKeys.kerase (a : Ξ±) : NodupKeys l β†’ (kerase a l).NodupKeys := NodupKeys.sublist <| kerase_sublist _ _ #align list.nodupkeys.kerase List.NodupKeys.kerase theorem Perm.kerase {a : Ξ±} {l₁ lβ‚‚ : List (Sigma Ξ²)} (nd : l₁.NodupKeys) : l₁ ~ lβ‚‚ β†’ kerase a l₁ ~ kerase a lβ‚‚ := by apply Perm.eraseP apply (nodupKeys_iff_pairwise.1 nd).imp intros; simp_all #align list.perm.kerase List.Perm.kerase @[simp]
Mathlib/Data/List/Sigma.lean
491
500
theorem not_mem_keys_kerase (a) {l : List (Sigma Ξ²)} (nd : l.NodupKeys) : a βˆ‰ (kerase a l).keys := by
induction l with | nil => simp | cons hd tl ih => simp? at nd says simp only [nodupKeys_cons] at nd by_cases h : a = hd.1 Β· subst h simp [nd.1] Β· simp [h, ih nd.2]
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
Mathlib/CategoryTheory/Abelian/Opposite.lean
95
98
theorem cokernel.Ο€_op : (cokernel.Ο€ f.op).unop = (cokernelOpUnop f).hom ≫ kernel.ΞΉ f ≫ eqToHom (Opposite.unop_op _).symm := by
simp [cokernelOpUnop]
import Mathlib.Data.List.Basic #align_import data.list.infix from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" open Nat variable {Ξ± Ξ² : Type*} namespace List variable {l l₁ lβ‚‚ l₃ : List Ξ±} {a b : Ξ±} {m n : β„•} section Fix #align list.prefix_append List.prefix_append #align list.suffix_append List.suffix_append #align list.infix_append List.infix_append #align list.infix_append' List.infix_append' #align list.is_prefix.is_infix List.IsPrefix.isInfix #align list.is_suffix.is_infix List.IsSuffix.isInfix #align list.nil_prefix List.nil_prefix #align list.nil_suffix List.nil_suffix #align list.nil_infix List.nil_infix #align list.prefix_refl List.prefix_refl #align list.suffix_refl List.suffix_refl #align list.infix_refl List.infix_refl theorem prefix_rfl : l <+: l := prefix_refl _ #align list.prefix_rfl List.prefix_rfl theorem suffix_rfl : l <:+ l := suffix_refl _ #align list.suffix_rfl List.suffix_rfl theorem infix_rfl : l <:+: l := infix_refl _ #align list.infix_rfl List.infix_rfl #align list.suffix_cons List.suffix_cons theorem prefix_concat (a : Ξ±) (l) : l <+: concat l a := by simp #align list.prefix_concat List.prefix_concat theorem prefix_concat_iff {l₁ lβ‚‚ : List Ξ±} {a : Ξ±} : l₁ <+: lβ‚‚ ++ [a] ↔ l₁ = lβ‚‚ ++ [a] ∨ l₁ <+: lβ‚‚ := by simpa only [← reverse_concat', reverse_inj, reverse_suffix] using suffix_cons_iff (l₁ := l₁.reverse) (lβ‚‚ := lβ‚‚.reverse) #align list.infix_cons List.infix_cons #align list.infix_concat List.infix_concat #align list.is_prefix.trans List.IsPrefix.trans #align list.is_suffix.trans List.IsSuffix.trans #align list.is_infix.trans List.IsInfix.trans #align list.is_infix.sublist List.IsInfix.sublist #align list.is_infix.subset List.IsInfix.subset #align list.is_prefix.sublist List.IsPrefix.sublist #align list.is_prefix.subset List.IsPrefix.subset #align list.is_suffix.sublist List.IsSuffix.sublist #align list.is_suffix.subset List.IsSuffix.subset #align list.reverse_suffix List.reverse_suffix #align list.reverse_prefix List.reverse_prefix #align list.reverse_infix List.reverse_infix protected alias ⟨_, isSuffix.reverse⟩ := reverse_prefix #align list.is_suffix.reverse List.isSuffix.reverse protected alias ⟨_, isPrefix.reverse⟩ := reverse_suffix #align list.is_prefix.reverse List.isPrefix.reverse protected alias ⟨_, isInfix.reverse⟩ := reverse_infix #align list.is_infix.reverse List.isInfix.reverse #align list.is_infix.length_le List.IsInfix.length_le #align list.is_prefix.length_le List.IsPrefix.length_le #align list.is_suffix.length_le List.IsSuffix.length_le #align list.infix_nil_iff List.infix_nil #align list.prefix_nil_iff List.prefix_nil #align list.suffix_nil_iff List.suffix_nil alias ⟨eq_nil_of_infix_nil, _⟩ := infix_nil #align list.eq_nil_of_infix_nil List.eq_nil_of_infix_nil alias ⟨eq_nil_of_prefix_nil, _⟩ := prefix_nil #align list.eq_nil_of_prefix_nil List.eq_nil_of_prefix_nil alias ⟨eq_nil_of_suffix_nil, _⟩ := suffix_nil #align list.eq_nil_of_suffix_nil List.eq_nil_of_suffix_nil #align list.infix_iff_prefix_suffix List.infix_iff_prefix_suffix theorem eq_of_infix_of_length_eq (h : l₁ <:+: lβ‚‚) : l₁.length = lβ‚‚.length β†’ l₁ = lβ‚‚ := h.sublist.eq_of_length #align list.eq_of_infix_of_length_eq List.eq_of_infix_of_length_eq theorem eq_of_prefix_of_length_eq (h : l₁ <+: lβ‚‚) : l₁.length = lβ‚‚.length β†’ l₁ = lβ‚‚ := h.sublist.eq_of_length #align list.eq_of_prefix_of_length_eq List.eq_of_prefix_of_length_eq theorem eq_of_suffix_of_length_eq (h : l₁ <:+ lβ‚‚) : l₁.length = lβ‚‚.length β†’ l₁ = lβ‚‚ := h.sublist.eq_of_length #align list.eq_of_suffix_of_length_eq List.eq_of_suffix_of_length_eq #align list.prefix_of_prefix_length_le List.prefix_of_prefix_length_le #align list.prefix_or_prefix_of_prefix List.prefix_or_prefix_of_prefix #align list.suffix_of_suffix_length_le List.suffix_of_suffix_length_le #align list.suffix_or_suffix_of_suffix List.suffix_or_suffix_of_suffix #align list.suffix_cons_iff List.suffix_cons_iff #align list.infix_cons_iff List.infix_cons_iff #align list.infix_of_mem_join List.infix_of_mem_join #align list.prefix_append_right_inj List.prefix_append_right_inj #align list.prefix_cons_inj List.prefix_cons_inj #align list.take_prefix List.take_prefix #align list.drop_suffix List.drop_suffix #align list.take_sublist List.take_sublist #align list.drop_sublist List.drop_sublist #align list.take_subset List.take_subset #align list.drop_subset List.drop_subset #align list.mem_of_mem_take List.mem_of_mem_take #align list.mem_of_mem_drop List.mem_of_mem_drop lemma dropSlice_sublist (n m : β„•) (l : List Ξ±) : l.dropSlice n m <+ l := calc l.dropSlice n m = take n l ++ drop m (drop n l) := by rw [dropSlice_eq, drop_drop, Nat.add_comm] _ <+ take n l ++ drop n l := (Sublist.refl _).append (drop_sublist _ _) _ = _ := take_append_drop _ _ #align list.slice_sublist List.dropSlice_sublist lemma dropSlice_subset (n m : β„•) (l : List Ξ±) : l.dropSlice n m βŠ† l := (dropSlice_sublist n m l).subset #align list.slice_subset List.dropSlice_subset lemma mem_of_mem_dropSlice {n m : β„•} {l : List Ξ±} {a : Ξ±} (h : a ∈ l.dropSlice n m) : a ∈ l := dropSlice_subset n m l h #align list.mem_of_mem_slice List.mem_of_mem_dropSlice theorem takeWhile_prefix (p : Ξ± β†’ Bool) : l.takeWhile p <+: l := ⟨l.dropWhile p, takeWhile_append_dropWhile p l⟩ #align list.take_while_prefix List.takeWhile_prefix theorem dropWhile_suffix (p : Ξ± β†’ Bool) : l.dropWhile p <:+ l := ⟨l.takeWhile p, takeWhile_append_dropWhile p l⟩ #align list.drop_while_suffix List.dropWhile_suffix theorem dropLast_prefix : βˆ€ l : List Ξ±, l.dropLast <+: l | [] => ⟨nil, by rw [dropLast, List.append_nil]⟩ | a :: l => ⟨_, dropLast_append_getLast (cons_ne_nil a l)⟩ #align list.init_prefix List.dropLast_prefix theorem tail_suffix (l : List Ξ±) : tail l <:+ l := by rw [← drop_one]; apply drop_suffix #align list.tail_suffix List.tail_suffix theorem dropLast_sublist (l : List Ξ±) : l.dropLast <+ l := (dropLast_prefix l).sublist #align list.init_sublist List.dropLast_sublist @[gcongr] theorem drop_sublist_drop_left (l : List Ξ±) {m n : β„•} (h : m ≀ n) : drop n l <+ drop m l := by rw [← Nat.sub_add_cancel h, drop_add] apply drop_sublist theorem dropLast_subset (l : List Ξ±) : l.dropLast βŠ† l := (dropLast_sublist l).subset #align list.init_subset List.dropLast_subset theorem tail_subset (l : List Ξ±) : tail l βŠ† l := (tail_sublist l).subset #align list.tail_subset List.tail_subset theorem mem_of_mem_dropLast (h : a ∈ l.dropLast) : a ∈ l := dropLast_subset l h #align list.mem_of_mem_init List.mem_of_mem_dropLast theorem mem_of_mem_tail (h : a ∈ l.tail) : a ∈ l := tail_subset l h #align list.mem_of_mem_tail List.mem_of_mem_tail @[gcongr] protected theorem Sublist.drop : βˆ€ {l₁ lβ‚‚ : List Ξ±}, l₁ <+ lβ‚‚ β†’ βˆ€ n, l₁.drop n <+ lβ‚‚.drop n | _, _, h, 0 => h | _, _, h, n + 1 => by rw [← drop_tail, ← drop_tail]; exact h.tail.drop n theorem prefix_iff_eq_append : l₁ <+: lβ‚‚ ↔ l₁ ++ drop (length l₁) lβ‚‚ = lβ‚‚ := ⟨by rintro ⟨r, rfl⟩; rw [drop_left], fun e => ⟨_, e⟩⟩ #align list.prefix_iff_eq_append List.prefix_iff_eq_append theorem suffix_iff_eq_append : l₁ <:+ lβ‚‚ ↔ take (length lβ‚‚ - length l₁) lβ‚‚ ++ l₁ = lβ‚‚ := ⟨by rintro ⟨r, rfl⟩; simp only [length_append, Nat.add_sub_cancel_right, take_left], fun e => ⟨_, e⟩⟩ #align list.suffix_iff_eq_append List.suffix_iff_eq_append theorem prefix_iff_eq_take : l₁ <+: lβ‚‚ ↔ l₁ = take (length l₁) lβ‚‚ := ⟨fun h => append_cancel_right <| (prefix_iff_eq_append.1 h).trans (take_append_drop _ _).symm, fun e => e.symm β–Έ take_prefix _ _⟩ #align list.prefix_iff_eq_take List.prefix_iff_eq_take theorem prefix_take_iff {x y : List Ξ±} {n : β„•} : x <+: y.take n ↔ x <+: y ∧ x.length ≀ n := by constructor Β· intro h constructor Β· exact List.IsPrefix.trans h <| List.take_prefix n y Β· replace h := h.length_le rw [length_take, Nat.le_min] at h exact h.left Β· intro ⟨hp, hl⟩ have hl' := hp.length_le rw [List.prefix_iff_eq_take] at * rw [hp, List.take_take] simp [min_eq_left, hl, hl'] theorem concat_get_prefix {x y : List Ξ±} (h : x <+: y) (hl : x.length < y.length) : x ++ [y.get ⟨x.length, hl⟩] <+: y := by use y.drop (x.length + 1) nth_rw 1 [List.prefix_iff_eq_take.mp h] convert List.take_append_drop (x.length + 1) y using 2 rw [← List.take_concat_get, List.concat_eq_append]; rfl theorem suffix_iff_eq_drop : l₁ <:+ lβ‚‚ ↔ l₁ = drop (length lβ‚‚ - length l₁) lβ‚‚ := ⟨fun h => append_cancel_left <| (suffix_iff_eq_append.1 h).trans (take_append_drop _ _).symm, fun e => e.symm β–Έ drop_suffix _ _⟩ #align list.suffix_iff_eq_drop List.suffix_iff_eq_drop instance decidablePrefix [DecidableEq Ξ±] : βˆ€ l₁ lβ‚‚ : List Ξ±, Decidable (l₁ <+: lβ‚‚) | [], lβ‚‚ => isTrue ⟨lβ‚‚, rfl⟩ | a :: l₁, [] => isFalse fun ⟨t, te⟩ => List.noConfusion te | a :: l₁, b :: lβ‚‚ => if h : a = b then @decidable_of_decidable_of_iff _ _ (decidablePrefix l₁ lβ‚‚) (by rw [← h, prefix_cons_inj]) else isFalse fun ⟨t, te⟩ => h <| by injection te #align list.decidable_prefix List.decidablePrefix -- Alternatively, use mem_tails instance decidableSuffix [DecidableEq Ξ±] : βˆ€ l₁ lβ‚‚ : List Ξ±, Decidable (l₁ <:+ lβ‚‚) | [], lβ‚‚ => isTrue ⟨lβ‚‚, append_nil _⟩ | a :: l₁, [] => isFalse <| mt (Sublist.length_le ∘ IsSuffix.sublist) (by simp) | l₁, b :: lβ‚‚ => @decidable_of_decidable_of_iff _ _ (@instDecidableOr _ _ _ (l₁.decidableSuffix lβ‚‚)) suffix_cons_iff.symm #align list.decidable_suffix List.decidableSuffix instance decidableInfix [DecidableEq Ξ±] : βˆ€ l₁ lβ‚‚ : List Ξ±, Decidable (l₁ <:+: lβ‚‚) | [], lβ‚‚ => isTrue ⟨[], lβ‚‚, rfl⟩ | a :: l₁, [] => isFalse fun ⟨s, t, te⟩ => by simp at te | l₁, b :: lβ‚‚ => @decidable_of_decidable_of_iff _ _ (@instDecidableOr _ _ (l₁.decidablePrefix (b :: lβ‚‚)) (l₁.decidableInfix lβ‚‚)) infix_cons_iff.symm #align list.decidable_infix List.decidableInfix
Mathlib/Data/List/Infix.lean
280
294
theorem prefix_take_le_iff {L : List (List (Option Ξ±))} (hm : m < L.length) : L.take m <+: L.take n ↔ m ≀ n := by
simp only [prefix_iff_eq_take, length_take] induction m generalizing L n with | zero => simp [min_eq_left, eq_self_iff_true, Nat.zero_le, take] | succ m IH => cases L with | nil => simp_all | cons l ls => cases n with | zero => simp | succ n => simp only [length_cons, succ_eq_add_one, Nat.add_lt_add_iff_right] at hm simp [← @IH n ls hm, Nat.min_eq_left, Nat.le_of_lt hm]
import Mathlib.Data.PFunctor.Multivariate.W import Mathlib.Data.QPF.Multivariate.Basic #align_import data.qpf.multivariate.constructions.fix from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" universe u v namespace MvQPF open TypeVec open MvFunctor (LiftP LiftR) open MvFunctor variable {n : β„•} {F : TypeVec.{u} (n + 1) β†’ Type u} [MvFunctor F] [q : MvQPF F] def recF {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β†’ Ξ²) : q.P.W Ξ± β†’ Ξ² := q.P.wRec fun a f' _f rec => g (abs ⟨a, splitFun f' rec⟩) set_option linter.uppercaseLean3 false in #align mvqpf.recF MvQPF.recF theorem recF_eq {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β†’ Ξ²) (a : q.P.A) (f' : q.P.drop.B a ⟹ Ξ±) (f : q.P.last.B a β†’ q.P.W Ξ±) : recF g (q.P.wMk a f' f) = g (abs ⟨a, splitFun f' (recF g ∘ f)⟩) := by rw [recF, MvPFunctor.wRec_eq]; rfl set_option linter.uppercaseLean3 false in #align mvqpf.recF_eq MvQPF.recF_eq theorem recF_eq' {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β†’ Ξ²) (x : q.P.W Ξ±) : recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by apply q.P.w_cases _ x intro a f' f rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp] set_option linter.uppercaseLean3 false in #align mvqpf.recF_eq' MvQPF.recF_eq' inductive WEquiv {Ξ± : TypeVec n} : q.P.W Ξ± β†’ q.P.W Ξ± β†’ Prop | ind (a : q.P.A) (f' : q.P.drop.B a ⟹ Ξ±) (fβ‚€ f₁ : q.P.last.B a β†’ q.P.W Ξ±) : (βˆ€ x, WEquiv (fβ‚€ x) (f₁ x)) β†’ WEquiv (q.P.wMk a f' fβ‚€) (q.P.wMk a f' f₁) | abs (aβ‚€ : q.P.A) (f'β‚€ : q.P.drop.B aβ‚€ ⟹ Ξ±) (fβ‚€ : q.P.last.B aβ‚€ β†’ q.P.W Ξ±) (a₁ : q.P.A) (f'₁ : q.P.drop.B a₁ ⟹ Ξ±) (f₁ : q.P.last.B a₁ β†’ q.P.W Ξ±) : abs ⟨aβ‚€, q.P.appendContents f'β‚€ fβ‚€βŸ© = abs ⟨a₁, q.P.appendContents f'₁ fβ‚βŸ© β†’ WEquiv (q.P.wMk aβ‚€ f'β‚€ fβ‚€) (q.P.wMk a₁ f'₁ f₁) | trans (u v w : q.P.W Ξ±) : WEquiv u v β†’ WEquiv v w β†’ WEquiv u w set_option linter.uppercaseLean3 false in #align mvqpf.Wequiv MvQPF.WEquiv theorem recF_eq_of_wEquiv (Ξ± : TypeVec n) {Ξ² : Type u} (u : F (Ξ±.append1 Ξ²) β†’ Ξ²) (x y : q.P.W Ξ±) : WEquiv x y β†’ recF u x = recF u y := by apply q.P.w_cases _ x intro aβ‚€ f'β‚€ fβ‚€ apply q.P.w_cases _ y intro a₁ f'₁ f₁ intro h -- Porting note: induction on h doesn't work. refine @WEquiv.recOn _ _ _ _ _ (fun a a' _ ↦ recF u a = recF u a') _ _ h ?_ ?_ ?_ Β· intros a f' fβ‚€ f₁ _h ih; simp only [recF_eq, Function.comp] congr; funext; congr; funext; apply ih Β· intros aβ‚€ f'β‚€ fβ‚€ a₁ f'₁ f₁ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h] Β· intros x y z _e₁ _eβ‚‚ ih₁ ihβ‚‚; exact Eq.trans ih₁ ihβ‚‚ set_option linter.uppercaseLean3 false in #align mvqpf.recF_eq_of_Wequiv MvQPF.recF_eq_of_wEquiv theorem wEquiv.abs' {Ξ± : TypeVec n} (x y : q.P.W Ξ±) (h : MvQPF.abs (q.P.wDest' x) = MvQPF.abs (q.P.wDest' y)) : WEquiv x y := by revert h apply q.P.w_cases _ x intro aβ‚€ f'β‚€ fβ‚€ apply q.P.w_cases _ y intro a₁ f'₁ f₁ apply WEquiv.abs set_option linter.uppercaseLean3 false in #align mvqpf.Wequiv.abs' MvQPF.wEquiv.abs' theorem wEquiv.refl {Ξ± : TypeVec n} (x : q.P.W Ξ±) : WEquiv x x := by apply q.P.w_cases _ x; intro a f' f; exact WEquiv.abs a f' f a f' f rfl set_option linter.uppercaseLean3 false in #align mvqpf.Wequiv.refl MvQPF.wEquiv.refl theorem wEquiv.symm {Ξ± : TypeVec n} (x y : q.P.W Ξ±) : WEquiv x y β†’ WEquiv y x := by intro h; induction h with | ind a f' fβ‚€ f₁ _h ih => exact WEquiv.ind _ _ _ _ ih | abs aβ‚€ f'β‚€ fβ‚€ a₁ f'₁ f₁ h => exact WEquiv.abs _ _ _ _ _ _ h.symm | trans x y z _e₁ _eβ‚‚ ih₁ ihβ‚‚ => exact MvQPF.WEquiv.trans _ _ _ ihβ‚‚ ih₁ set_option linter.uppercaseLean3 false in #align mvqpf.Wequiv.symm MvQPF.wEquiv.symm def wrepr {Ξ± : TypeVec n} : q.P.W Ξ± β†’ q.P.W Ξ± := recF (q.P.wMk' ∘ repr) set_option linter.uppercaseLean3 false in #align mvqpf.Wrepr MvQPF.wrepr theorem wrepr_wMk {Ξ± : TypeVec n} (a : q.P.A) (f' : q.P.drop.B a ⟹ Ξ±) (f : q.P.last.B a β†’ q.P.W Ξ±) : wrepr (q.P.wMk a f' f) = q.P.wMk' (repr (abs (appendFun id wrepr <$$> ⟨a, q.P.appendContents f' f⟩))) := by rw [wrepr, recF_eq', q.P.wDest'_wMk]; rfl set_option linter.uppercaseLean3 false in #align mvqpf.Wrepr_W_mk MvQPF.wrepr_wMk theorem wrepr_equiv {Ξ± : TypeVec n} (x : q.P.W Ξ±) : WEquiv (wrepr x) x := by apply q.P.w_ind _ x; intro a f' f ih apply WEquiv.trans _ (q.P.wMk' (appendFun id wrepr <$$> ⟨a, q.P.appendContents f' f⟩)) Β· apply wEquiv.abs' rw [wrepr_wMk, q.P.wDest'_wMk', q.P.wDest'_wMk', abs_repr] rw [q.P.map_eq, MvPFunctor.wMk', appendFun_comp_splitFun, id_comp] apply WEquiv.ind; exact ih set_option linter.uppercaseLean3 false in #align mvqpf.Wrepr_equiv MvQPF.wrepr_equiv
Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean
157
170
theorem wEquiv_map {Ξ± Ξ² : TypeVec n} (g : Ξ± ⟹ Ξ²) (x y : q.P.W Ξ±) : WEquiv x y β†’ WEquiv (g <$$> x) (g <$$> y) := by
intro h; induction h with | ind a f' fβ‚€ f₁ h ih => rw [q.P.w_map_wMk, q.P.w_map_wMk]; apply WEquiv.ind; exact ih | abs aβ‚€ f'β‚€ fβ‚€ a₁ f'₁ f₁ h => rw [q.P.w_map_wMk, q.P.w_map_wMk]; apply WEquiv.abs show abs (q.P.objAppend1 aβ‚€ (g ⊚ f'β‚€) fun x => q.P.wMap g (fβ‚€ x)) = abs (q.P.objAppend1 a₁ (g ⊚ f'₁) fun x => q.P.wMap g (f₁ x)) rw [← q.P.map_objAppend1, ← q.P.map_objAppend1, abs_map, abs_map, h] | trans x y z _ _ ih₁ ihβ‚‚ => apply MvQPF.WEquiv.trans Β· apply ih₁ Β· apply ihβ‚‚
import Mathlib.Data.List.Nodup import Mathlib.Data.List.Zip import Mathlib.Data.Nat.Defs import Mathlib.Data.List.Infix #align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u variable {Ξ± : Type u} open Nat Function namespace List
Mathlib/Data/List/Rotate.lean
37
37
theorem rotate_mod (l : List Ξ±) (n : β„•) : l.rotate (n % l.length) = l.rotate n := by
simp [rotate]
import Mathlib.Order.RelClasses import Mathlib.Order.Interval.Set.Basic #align_import order.bounded from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9" namespace Set variable {Ξ± : Type*} {r : Ξ± β†’ Ξ± β†’ Prop} {s t : Set Ξ±} theorem Bounded.mono (hst : s βŠ† t) (hs : Bounded r t) : Bounded r s := hs.imp fun _ ha b hb => ha b (hst hb) #align set.bounded.mono Set.Bounded.mono theorem Unbounded.mono (hst : s βŠ† t) (hs : Unbounded r s) : Unbounded r t := fun a => let ⟨b, hb, hb'⟩ := hs a ⟨b, hst hb, hb'⟩ #align set.unbounded.mono Set.Unbounded.mono theorem unbounded_le_of_forall_exists_lt [Preorder Ξ±] (h : βˆ€ a, βˆƒ b ∈ s, a < b) : Unbounded (Β· ≀ Β·) s := fun a => let ⟨b, hb, hb'⟩ := h a ⟨b, hb, fun hba => hba.not_lt hb'⟩ #align set.unbounded_le_of_forall_exists_lt Set.unbounded_le_of_forall_exists_lt theorem unbounded_le_iff [LinearOrder Ξ±] : Unbounded (Β· ≀ Β·) s ↔ βˆ€ a, βˆƒ b ∈ s, a < b := by simp only [Unbounded, not_le] #align set.unbounded_le_iff Set.unbounded_le_iff theorem unbounded_lt_of_forall_exists_le [Preorder Ξ±] (h : βˆ€ a, βˆƒ b ∈ s, a ≀ b) : Unbounded (Β· < Β·) s := fun a => let ⟨b, hb, hb'⟩ := h a ⟨b, hb, fun hba => hba.not_le hb'⟩ #align set.unbounded_lt_of_forall_exists_le Set.unbounded_lt_of_forall_exists_le theorem unbounded_lt_iff [LinearOrder Ξ±] : Unbounded (Β· < Β·) s ↔ βˆ€ a, βˆƒ b ∈ s, a ≀ b := by simp only [Unbounded, not_lt] #align set.unbounded_lt_iff Set.unbounded_lt_iff theorem unbounded_ge_of_forall_exists_gt [Preorder Ξ±] (h : βˆ€ a, βˆƒ b ∈ s, b < a) : Unbounded (Β· β‰₯ Β·) s := @unbounded_le_of_forall_exists_lt Ξ±α΅’α΅ˆ _ _ h #align set.unbounded_ge_of_forall_exists_gt Set.unbounded_ge_of_forall_exists_gt theorem unbounded_ge_iff [LinearOrder Ξ±] : Unbounded (Β· β‰₯ Β·) s ↔ βˆ€ a, βˆƒ b ∈ s, b < a := ⟨fun h a => let ⟨b, hb, hba⟩ := h a ⟨b, hb, lt_of_not_ge hba⟩, unbounded_ge_of_forall_exists_gt⟩ #align set.unbounded_ge_iff Set.unbounded_ge_iff theorem unbounded_gt_of_forall_exists_ge [Preorder Ξ±] (h : βˆ€ a, βˆƒ b ∈ s, b ≀ a) : Unbounded (Β· > Β·) s := fun a => let ⟨b, hb, hb'⟩ := h a ⟨b, hb, fun hba => not_le_of_gt hba hb'⟩ #align set.unbounded_gt_of_forall_exists_ge Set.unbounded_gt_of_forall_exists_ge theorem unbounded_gt_iff [LinearOrder Ξ±] : Unbounded (Β· > Β·) s ↔ βˆ€ a, βˆƒ b ∈ s, b ≀ a := ⟨fun h a => let ⟨b, hb, hba⟩ := h a ⟨b, hb, le_of_not_gt hba⟩, unbounded_gt_of_forall_exists_ge⟩ #align set.unbounded_gt_iff Set.unbounded_gt_iff theorem Bounded.rel_mono {r' : Ξ± β†’ Ξ± β†’ Prop} (h : Bounded r s) (hrr' : r ≀ r') : Bounded r' s := let ⟨a, ha⟩ := h ⟨a, fun b hb => hrr' b a (ha b hb)⟩ #align set.bounded.rel_mono Set.Bounded.rel_mono theorem bounded_le_of_bounded_lt [Preorder Ξ±] (h : Bounded (Β· < Β·) s) : Bounded (Β· ≀ Β·) s := h.rel_mono fun _ _ => le_of_lt #align set.bounded_le_of_bounded_lt Set.bounded_le_of_bounded_lt theorem Unbounded.rel_mono {r' : Ξ± β†’ Ξ± β†’ Prop} (hr : r' ≀ r) (h : Unbounded r s) : Unbounded r' s := fun a => let ⟨b, hb, hba⟩ := h a ⟨b, hb, fun hba' => hba (hr b a hba')⟩ #align set.unbounded.rel_mono Set.Unbounded.rel_mono theorem unbounded_lt_of_unbounded_le [Preorder Ξ±] (h : Unbounded (Β· ≀ Β·) s) : Unbounded (Β· < Β·) s := h.rel_mono fun _ _ => le_of_lt #align set.unbounded_lt_of_unbounded_le Set.unbounded_lt_of_unbounded_le theorem bounded_le_iff_bounded_lt [Preorder Ξ±] [NoMaxOrder Ξ±] : Bounded (Β· ≀ Β·) s ↔ Bounded (Β· < Β·) s := by refine ⟨fun h => ?_, bounded_le_of_bounded_lt⟩ cases' h with a ha cases' exists_gt a with b hb exact ⟨b, fun c hc => lt_of_le_of_lt (ha c hc) hb⟩ #align set.bounded_le_iff_bounded_lt Set.bounded_le_iff_bounded_lt theorem unbounded_lt_iff_unbounded_le [Preorder Ξ±] [NoMaxOrder Ξ±] : Unbounded (Β· < Β·) s ↔ Unbounded (Β· ≀ Β·) s := by simp_rw [← not_bounded_iff, bounded_le_iff_bounded_lt] #align set.unbounded_lt_iff_unbounded_le Set.unbounded_lt_iff_unbounded_le theorem bounded_ge_of_bounded_gt [Preorder Ξ±] (h : Bounded (Β· > Β·) s) : Bounded (Β· β‰₯ Β·) s := let ⟨a, ha⟩ := h ⟨a, fun b hb => le_of_lt (ha b hb)⟩ #align set.bounded_ge_of_bounded_gt Set.bounded_ge_of_bounded_gt theorem unbounded_gt_of_unbounded_ge [Preorder Ξ±] (h : Unbounded (Β· β‰₯ Β·) s) : Unbounded (Β· > Β·) s := fun a => let ⟨b, hb, hba⟩ := h a ⟨b, hb, fun hba' => hba (le_of_lt hba')⟩ #align set.unbounded_gt_of_unbounded_ge Set.unbounded_gt_of_unbounded_ge theorem bounded_ge_iff_bounded_gt [Preorder Ξ±] [NoMinOrder Ξ±] : Bounded (Β· β‰₯ Β·) s ↔ Bounded (Β· > Β·) s := @bounded_le_iff_bounded_lt Ξ±α΅’α΅ˆ _ _ _ #align set.bounded_ge_iff_bounded_gt Set.bounded_ge_iff_bounded_gt theorem unbounded_gt_iff_unbounded_ge [Preorder Ξ±] [NoMinOrder Ξ±] : Unbounded (Β· > Β·) s ↔ Unbounded (Β· β‰₯ Β·) s := @unbounded_lt_iff_unbounded_le Ξ±α΅’α΅ˆ _ _ _ #align set.unbounded_gt_iff_unbounded_ge Set.unbounded_gt_iff_unbounded_ge theorem unbounded_le_univ [LE Ξ±] [NoTopOrder Ξ±] : Unbounded (Β· ≀ Β·) (@Set.univ Ξ±) := fun a => let ⟨b, hb⟩ := exists_not_le a ⟨b, ⟨⟩, hb⟩ #align set.unbounded_le_univ Set.unbounded_le_univ theorem unbounded_lt_univ [Preorder Ξ±] [NoTopOrder Ξ±] : Unbounded (Β· < Β·) (@Set.univ Ξ±) := unbounded_lt_of_unbounded_le unbounded_le_univ #align set.unbounded_lt_univ Set.unbounded_lt_univ theorem unbounded_ge_univ [LE Ξ±] [NoBotOrder Ξ±] : Unbounded (Β· β‰₯ Β·) (@Set.univ Ξ±) := fun a => let ⟨b, hb⟩ := exists_not_ge a ⟨b, ⟨⟩, hb⟩ #align set.unbounded_ge_univ Set.unbounded_ge_univ theorem unbounded_gt_univ [Preorder Ξ±] [NoBotOrder Ξ±] : Unbounded (Β· > Β·) (@Set.univ Ξ±) := unbounded_gt_of_unbounded_ge unbounded_ge_univ #align set.unbounded_gt_univ Set.unbounded_gt_univ theorem bounded_self (a : Ξ±) : Bounded r { b | r b a } := ⟨a, fun _ => id⟩ #align set.bounded_self Set.bounded_self theorem bounded_lt_Iio [Preorder Ξ±] (a : Ξ±) : Bounded (Β· < Β·) (Iio a) := bounded_self a #align set.bounded_lt_Iio Set.bounded_lt_Iio theorem bounded_le_Iio [Preorder Ξ±] (a : Ξ±) : Bounded (Β· ≀ Β·) (Iio a) := bounded_le_of_bounded_lt (bounded_lt_Iio a) #align set.bounded_le_Iio Set.bounded_le_Iio theorem bounded_le_Iic [Preorder Ξ±] (a : Ξ±) : Bounded (Β· ≀ Β·) (Iic a) := bounded_self a #align set.bounded_le_Iic Set.bounded_le_Iic theorem bounded_lt_Iic [Preorder Ξ±] [NoMaxOrder Ξ±] (a : Ξ±) : Bounded (Β· < Β·) (Iic a) := by simp only [← bounded_le_iff_bounded_lt, bounded_le_Iic] #align set.bounded_lt_Iic Set.bounded_lt_Iic theorem bounded_gt_Ioi [Preorder Ξ±] (a : Ξ±) : Bounded (Β· > Β·) (Ioi a) := bounded_self a #align set.bounded_gt_Ioi Set.bounded_gt_Ioi theorem bounded_ge_Ioi [Preorder Ξ±] (a : Ξ±) : Bounded (Β· β‰₯ Β·) (Ioi a) := bounded_ge_of_bounded_gt (bounded_gt_Ioi a) #align set.bounded_ge_Ioi Set.bounded_ge_Ioi theorem bounded_ge_Ici [Preorder Ξ±] (a : Ξ±) : Bounded (Β· β‰₯ Β·) (Ici a) := bounded_self a #align set.bounded_ge_Ici Set.bounded_ge_Ici theorem bounded_gt_Ici [Preorder Ξ±] [NoMinOrder Ξ±] (a : Ξ±) : Bounded (Β· > Β·) (Ici a) := by simp only [← bounded_ge_iff_bounded_gt, bounded_ge_Ici] #align set.bounded_gt_Ici Set.bounded_gt_Ici theorem bounded_lt_Ioo [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· < Β·) (Ioo a b) := (bounded_lt_Iio b).mono Set.Ioo_subset_Iio_self #align set.bounded_lt_Ioo Set.bounded_lt_Ioo theorem bounded_lt_Ico [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· < Β·) (Ico a b) := (bounded_lt_Iio b).mono Set.Ico_subset_Iio_self #align set.bounded_lt_Ico Set.bounded_lt_Ico theorem bounded_lt_Ioc [Preorder Ξ±] [NoMaxOrder Ξ±] (a b : Ξ±) : Bounded (Β· < Β·) (Ioc a b) := (bounded_lt_Iic b).mono Set.Ioc_subset_Iic_self #align set.bounded_lt_Ioc Set.bounded_lt_Ioc theorem bounded_lt_Icc [Preorder Ξ±] [NoMaxOrder Ξ±] (a b : Ξ±) : Bounded (Β· < Β·) (Icc a b) := (bounded_lt_Iic b).mono Set.Icc_subset_Iic_self #align set.bounded_lt_Icc Set.bounded_lt_Icc theorem bounded_le_Ioo [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· ≀ Β·) (Ioo a b) := (bounded_le_Iio b).mono Set.Ioo_subset_Iio_self #align set.bounded_le_Ioo Set.bounded_le_Ioo theorem bounded_le_Ico [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· ≀ Β·) (Ico a b) := (bounded_le_Iio b).mono Set.Ico_subset_Iio_self #align set.bounded_le_Ico Set.bounded_le_Ico theorem bounded_le_Ioc [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· ≀ Β·) (Ioc a b) := (bounded_le_Iic b).mono Set.Ioc_subset_Iic_self #align set.bounded_le_Ioc Set.bounded_le_Ioc theorem bounded_le_Icc [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· ≀ Β·) (Icc a b) := (bounded_le_Iic b).mono Set.Icc_subset_Iic_self #align set.bounded_le_Icc Set.bounded_le_Icc theorem bounded_gt_Ioo [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· > Β·) (Ioo a b) := (bounded_gt_Ioi a).mono Set.Ioo_subset_Ioi_self #align set.bounded_gt_Ioo Set.bounded_gt_Ioo theorem bounded_gt_Ioc [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· > Β·) (Ioc a b) := (bounded_gt_Ioi a).mono Set.Ioc_subset_Ioi_self #align set.bounded_gt_Ioc Set.bounded_gt_Ioc theorem bounded_gt_Ico [Preorder Ξ±] [NoMinOrder Ξ±] (a b : Ξ±) : Bounded (Β· > Β·) (Ico a b) := (bounded_gt_Ici a).mono Set.Ico_subset_Ici_self #align set.bounded_gt_Ico Set.bounded_gt_Ico theorem bounded_gt_Icc [Preorder Ξ±] [NoMinOrder Ξ±] (a b : Ξ±) : Bounded (Β· > Β·) (Icc a b) := (bounded_gt_Ici a).mono Set.Icc_subset_Ici_self #align set.bounded_gt_Icc Set.bounded_gt_Icc theorem bounded_ge_Ioo [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· β‰₯ Β·) (Ioo a b) := (bounded_ge_Ioi a).mono Set.Ioo_subset_Ioi_self #align set.bounded_ge_Ioo Set.bounded_ge_Ioo theorem bounded_ge_Ioc [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· β‰₯ Β·) (Ioc a b) := (bounded_ge_Ioi a).mono Set.Ioc_subset_Ioi_self #align set.bounded_ge_Ioc Set.bounded_ge_Ioc theorem bounded_ge_Ico [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· β‰₯ Β·) (Ico a b) := (bounded_ge_Ici a).mono Set.Ico_subset_Ici_self #align set.bounded_ge_Ico Set.bounded_ge_Ico theorem bounded_ge_Icc [Preorder Ξ±] (a b : Ξ±) : Bounded (Β· β‰₯ Β·) (Icc a b) := (bounded_ge_Ici a).mono Set.Icc_subset_Ici_self #align set.bounded_ge_Icc Set.bounded_ge_Icc theorem unbounded_le_Ioi [SemilatticeSup Ξ±] [NoMaxOrder Ξ±] (a : Ξ±) : Unbounded (Β· ≀ Β·) (Ioi a) := fun b => let ⟨c, hc⟩ := exists_gt (a βŠ” b) ⟨c, le_sup_left.trans_lt hc, (le_sup_right.trans_lt hc).not_le⟩ #align set.unbounded_le_Ioi Set.unbounded_le_Ioi theorem unbounded_le_Ici [SemilatticeSup Ξ±] [NoMaxOrder Ξ±] (a : Ξ±) : Unbounded (Β· ≀ Β·) (Ici a) := (unbounded_le_Ioi a).mono Set.Ioi_subset_Ici_self #align set.unbounded_le_Ici Set.unbounded_le_Ici theorem unbounded_lt_Ioi [SemilatticeSup Ξ±] [NoMaxOrder Ξ±] (a : Ξ±) : Unbounded (Β· < Β·) (Ioi a) := unbounded_lt_of_unbounded_le (unbounded_le_Ioi a) #align set.unbounded_lt_Ioi Set.unbounded_lt_Ioi theorem unbounded_lt_Ici [SemilatticeSup Ξ±] (a : Ξ±) : Unbounded (Β· < Β·) (Ici a) := fun b => ⟨a βŠ” b, le_sup_left, le_sup_right.not_lt⟩ #align set.unbounded_lt_Ici Set.unbounded_lt_Ici theorem bounded_inter_not (H : βˆ€ a b, βˆƒ m, βˆ€ c, r c a ∨ r c b β†’ r c m) (a : Ξ±) : Bounded r (s ∩ { b | Β¬r b a }) ↔ Bounded r s := by refine ⟨?_, Bounded.mono inter_subset_left⟩ rintro ⟨b, hb⟩ cases' H a b with m hm exact ⟨m, fun c hc => hm c (or_iff_not_imp_left.2 fun hca => hb c ⟨hc, hca⟩)⟩ #align set.bounded_inter_not Set.bounded_inter_not theorem unbounded_inter_not (H : βˆ€ a b, βˆƒ m, βˆ€ c, r c a ∨ r c b β†’ r c m) (a : Ξ±) : Unbounded r (s ∩ { b | Β¬r b a }) ↔ Unbounded r s := by simp_rw [← not_bounded_iff, bounded_inter_not H] #align set.unbounded_inter_not Set.unbounded_inter_not theorem bounded_le_inter_not_le [SemilatticeSup Ξ±] (a : Ξ±) : Bounded (Β· ≀ Β·) (s ∩ { b | Β¬b ≀ a }) ↔ Bounded (Β· ≀ Β·) s := bounded_inter_not (fun x y => ⟨x βŠ” y, fun _ h => h.elim le_sup_of_le_left le_sup_of_le_right⟩) a #align set.bounded_le_inter_not_le Set.bounded_le_inter_not_le theorem unbounded_le_inter_not_le [SemilatticeSup Ξ±] (a : Ξ±) : Unbounded (Β· ≀ Β·) (s ∩ { b | Β¬b ≀ a }) ↔ Unbounded (Β· ≀ Β·) s := by rw [← not_bounded_iff, ← not_bounded_iff, not_iff_not] exact bounded_le_inter_not_le a #align set.unbounded_le_inter_not_le Set.unbounded_le_inter_not_le theorem bounded_le_inter_lt [LinearOrder Ξ±] (a : Ξ±) : Bounded (Β· ≀ Β·) (s ∩ { b | a < b }) ↔ Bounded (Β· ≀ Β·) s := by simp_rw [← not_le, bounded_le_inter_not_le] #align set.bounded_le_inter_lt Set.bounded_le_inter_lt
Mathlib/Order/Bounded.lean
333
336
theorem unbounded_le_inter_lt [LinearOrder Ξ±] (a : Ξ±) : Unbounded (Β· ≀ Β·) (s ∩ { b | a < b }) ↔ Unbounded (Β· ≀ Β·) s := by
convert @unbounded_le_inter_not_le _ s _ a exact lt_iff_not_le
import Mathlib.Topology.Separation import Mathlib.Topology.UniformSpace.Basic import Mathlib.Topology.UniformSpace.Cauchy #align_import topology.uniform_space.uniform_convergence from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9" noncomputable section open Topology Uniformity Filter Set universe u v w x variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {ΞΉ : Type x} [UniformSpace Ξ²] variable {F : ΞΉ β†’ Ξ± β†’ Ξ²} {f : Ξ± β†’ Ξ²} {s s' : Set Ξ±} {x : Ξ±} {p : Filter ΞΉ} {p' : Filter Ξ±} {g : ΞΉ β†’ Ξ±} def TendstoUniformlyOnFilter (F : ΞΉ β†’ Ξ± β†’ Ξ²) (f : Ξ± β†’ Ξ²) (p : Filter ΞΉ) (p' : Filter Ξ±) := βˆ€ u ∈ 𝓀 Ξ², βˆ€αΆ  n : ΞΉ Γ— Ξ± in p Γ—Λ’ p', (f n.snd, F n.fst n.snd) ∈ u #align tendsto_uniformly_on_filter TendstoUniformlyOnFilter theorem tendstoUniformlyOnFilter_iff_tendsto : TendstoUniformlyOnFilter F f p p' ↔ Tendsto (fun q : ΞΉ Γ— Ξ± => (f q.2, F q.1 q.2)) (p Γ—Λ’ p') (𝓀 Ξ²) := Iff.rfl #align tendsto_uniformly_on_filter_iff_tendsto tendstoUniformlyOnFilter_iff_tendsto def TendstoUniformlyOn (F : ΞΉ β†’ Ξ± β†’ Ξ²) (f : Ξ± β†’ Ξ²) (p : Filter ΞΉ) (s : Set Ξ±) := βˆ€ u ∈ 𝓀 Ξ², βˆ€αΆ  n in p, βˆ€ x : Ξ±, x ∈ s β†’ (f x, F n x) ∈ u #align tendsto_uniformly_on TendstoUniformlyOn theorem tendstoUniformlyOn_iff_tendstoUniformlyOnFilter : TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (π“Ÿ s) := by simp only [TendstoUniformlyOn, TendstoUniformlyOnFilter] apply forallβ‚‚_congr simp_rw [eventually_prod_principal_iff] simp #align tendsto_uniformly_on_iff_tendsto_uniformly_on_filter tendstoUniformlyOn_iff_tendstoUniformlyOnFilter alias ⟨TendstoUniformlyOn.tendstoUniformlyOnFilter, TendstoUniformlyOnFilter.tendstoUniformlyOn⟩ := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter #align tendsto_uniformly_on.tendsto_uniformly_on_filter TendstoUniformlyOn.tendstoUniformlyOnFilter #align tendsto_uniformly_on_filter.tendsto_uniformly_on TendstoUniformlyOnFilter.tendstoUniformlyOn theorem tendstoUniformlyOn_iff_tendsto {F : ΞΉ β†’ Ξ± β†’ Ξ²} {f : Ξ± β†’ Ξ²} {p : Filter ΞΉ} {s : Set Ξ±} : TendstoUniformlyOn F f p s ↔ Tendsto (fun q : ΞΉ Γ— Ξ± => (f q.2, F q.1 q.2)) (p Γ—Λ’ π“Ÿ s) (𝓀 Ξ²) := by simp [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto] #align tendsto_uniformly_on_iff_tendsto tendstoUniformlyOn_iff_tendsto def TendstoUniformly (F : ΞΉ β†’ Ξ± β†’ Ξ²) (f : Ξ± β†’ Ξ²) (p : Filter ΞΉ) := βˆ€ u ∈ 𝓀 Ξ², βˆ€αΆ  n in p, βˆ€ x : Ξ±, (f x, F n x) ∈ u #align tendsto_uniformly TendstoUniformly -- Porting note: moved from below theorem tendstoUniformlyOn_univ : TendstoUniformlyOn F f p univ ↔ TendstoUniformly F f p := by simp [TendstoUniformlyOn, TendstoUniformly] #align tendsto_uniformly_on_univ tendstoUniformlyOn_univ theorem tendstoUniformly_iff_tendstoUniformlyOnFilter : TendstoUniformly F f p ↔ TendstoUniformlyOnFilter F f p ⊀ := by rw [← tendstoUniformlyOn_univ, tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, principal_univ] #align tendsto_uniformly_iff_tendsto_uniformly_on_filter tendstoUniformly_iff_tendstoUniformlyOnFilter theorem TendstoUniformly.tendstoUniformlyOnFilter (h : TendstoUniformly F f p) : TendstoUniformlyOnFilter F f p ⊀ := by rwa [← tendstoUniformly_iff_tendstoUniformlyOnFilter] #align tendsto_uniformly.tendsto_uniformly_on_filter TendstoUniformly.tendstoUniformlyOnFilter theorem tendstoUniformlyOn_iff_tendstoUniformly_comp_coe : TendstoUniformlyOn F f p s ↔ TendstoUniformly (fun i (x : s) => F i x) (f ∘ (↑)) p := forallβ‚‚_congr fun u _ => by simp #align tendsto_uniformly_on_iff_tendsto_uniformly_comp_coe tendstoUniformlyOn_iff_tendstoUniformly_comp_coe theorem tendstoUniformly_iff_tendsto {F : ΞΉ β†’ Ξ± β†’ Ξ²} {f : Ξ± β†’ Ξ²} {p : Filter ΞΉ} : TendstoUniformly F f p ↔ Tendsto (fun q : ΞΉ Γ— Ξ± => (f q.2, F q.1 q.2)) (p Γ—Λ’ ⊀) (𝓀 Ξ²) := by simp [tendstoUniformly_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto] #align tendsto_uniformly_iff_tendsto tendstoUniformly_iff_tendsto theorem TendstoUniformlyOnFilter.tendsto_at (h : TendstoUniformlyOnFilter F f p p') (hx : π“Ÿ {x} ≀ p') : Tendsto (fun n => F n x) p <| 𝓝 (f x) := by refine Uniform.tendsto_nhds_right.mpr fun u hu => mem_map.mpr ?_ filter_upwards [(h u hu).curry] intro i h simpa using h.filter_mono hx #align tendsto_uniformly_on_filter.tendsto_at TendstoUniformlyOnFilter.tendsto_at theorem TendstoUniformlyOn.tendsto_at (h : TendstoUniformlyOn F f p s) {x : Ξ±} (hx : x ∈ s) : Tendsto (fun n => F n x) p <| 𝓝 (f x) := h.tendstoUniformlyOnFilter.tendsto_at (le_principal_iff.mpr <| mem_principal.mpr <| singleton_subset_iff.mpr <| hx) #align tendsto_uniformly_on.tendsto_at TendstoUniformlyOn.tendsto_at theorem TendstoUniformly.tendsto_at (h : TendstoUniformly F f p) (x : Ξ±) : Tendsto (fun n => F n x) p <| 𝓝 (f x) := h.tendstoUniformlyOnFilter.tendsto_at le_top #align tendsto_uniformly.tendsto_at TendstoUniformly.tendsto_at -- Porting note: tendstoUniformlyOn_univ moved up theorem TendstoUniformlyOnFilter.mono_left {p'' : Filter ΞΉ} (h : TendstoUniformlyOnFilter F f p p') (hp : p'' ≀ p) : TendstoUniformlyOnFilter F f p'' p' := fun u hu => (h u hu).filter_mono (p'.prod_mono_left hp) #align tendsto_uniformly_on_filter.mono_left TendstoUniformlyOnFilter.mono_left theorem TendstoUniformlyOnFilter.mono_right {p'' : Filter Ξ±} (h : TendstoUniformlyOnFilter F f p p') (hp : p'' ≀ p') : TendstoUniformlyOnFilter F f p p'' := fun u hu => (h u hu).filter_mono (p.prod_mono_right hp) #align tendsto_uniformly_on_filter.mono_right TendstoUniformlyOnFilter.mono_right theorem TendstoUniformlyOn.mono {s' : Set Ξ±} (h : TendstoUniformlyOn F f p s) (h' : s' βŠ† s) : TendstoUniformlyOn F f p s' := tendstoUniformlyOn_iff_tendstoUniformlyOnFilter.mpr (h.tendstoUniformlyOnFilter.mono_right (le_principal_iff.mpr <| mem_principal.mpr h')) #align tendsto_uniformly_on.mono TendstoUniformlyOn.mono theorem TendstoUniformlyOnFilter.congr {F' : ΞΉ β†’ Ξ± β†’ Ξ²} (hf : TendstoUniformlyOnFilter F f p p') (hff' : βˆ€αΆ  n : ΞΉ Γ— Ξ± in p Γ—Λ’ p', F n.fst n.snd = F' n.fst n.snd) : TendstoUniformlyOnFilter F' f p p' := by refine fun u hu => ((hf u hu).and hff').mono fun n h => ?_ rw [← h.right] exact h.left #align tendsto_uniformly_on_filter.congr TendstoUniformlyOnFilter.congr theorem TendstoUniformlyOn.congr {F' : ΞΉ β†’ Ξ± β†’ Ξ²} (hf : TendstoUniformlyOn F f p s) (hff' : βˆ€αΆ  n in p, Set.EqOn (F n) (F' n) s) : TendstoUniformlyOn F' f p s := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at hf ⊒ refine hf.congr ?_ rw [eventually_iff] at hff' ⊒ simp only [Set.EqOn] at hff' simp only [mem_prod_principal, hff', mem_setOf_eq] #align tendsto_uniformly_on.congr TendstoUniformlyOn.congr theorem TendstoUniformlyOn.congr_right {g : Ξ± β†’ Ξ²} (hf : TendstoUniformlyOn F f p s) (hfg : EqOn f g s) : TendstoUniformlyOn F g p s := fun u hu => by filter_upwards [hf u hu] with i hi a ha using hfg ha β–Έ hi a ha #align tendsto_uniformly_on.congr_right TendstoUniformlyOn.congr_right protected theorem TendstoUniformly.tendstoUniformlyOn (h : TendstoUniformly F f p) : TendstoUniformlyOn F f p s := (tendstoUniformlyOn_univ.2 h).mono (subset_univ s) #align tendsto_uniformly.tendsto_uniformly_on TendstoUniformly.tendstoUniformlyOn theorem TendstoUniformlyOnFilter.comp (h : TendstoUniformlyOnFilter F f p p') (g : Ξ³ β†’ Ξ±) : TendstoUniformlyOnFilter (fun n => F n ∘ g) (f ∘ g) p (p'.comap g) := by rw [tendstoUniformlyOnFilter_iff_tendsto] at h ⊒ exact h.comp (tendsto_id.prod_map tendsto_comap) #align tendsto_uniformly_on_filter.comp TendstoUniformlyOnFilter.comp theorem TendstoUniformlyOn.comp (h : TendstoUniformlyOn F f p s) (g : Ξ³ β†’ Ξ±) : TendstoUniformlyOn (fun n => F n ∘ g) (f ∘ g) p (g ⁻¹' s) := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at h ⊒ simpa [TendstoUniformlyOn, comap_principal] using TendstoUniformlyOnFilter.comp h g #align tendsto_uniformly_on.comp TendstoUniformlyOn.comp theorem TendstoUniformly.comp (h : TendstoUniformly F f p) (g : Ξ³ β†’ Ξ±) : TendstoUniformly (fun n => F n ∘ g) (f ∘ g) p := by rw [tendstoUniformly_iff_tendstoUniformlyOnFilter] at h ⊒ simpa [principal_univ, comap_principal] using h.comp g #align tendsto_uniformly.comp TendstoUniformly.comp theorem UniformContinuous.comp_tendstoUniformlyOnFilter [UniformSpace Ξ³] {g : Ξ² β†’ Ξ³} (hg : UniformContinuous g) (h : TendstoUniformlyOnFilter F f p p') : TendstoUniformlyOnFilter (fun i => g ∘ F i) (g ∘ f) p p' := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly_on_filter UniformContinuous.comp_tendstoUniformlyOnFilter theorem UniformContinuous.comp_tendstoUniformlyOn [UniformSpace Ξ³] {g : Ξ² β†’ Ξ³} (hg : UniformContinuous g) (h : TendstoUniformlyOn F f p s) : TendstoUniformlyOn (fun i => g ∘ F i) (g ∘ f) p s := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly_on UniformContinuous.comp_tendstoUniformlyOn theorem UniformContinuous.comp_tendstoUniformly [UniformSpace Ξ³] {g : Ξ² β†’ Ξ³} (hg : UniformContinuous g) (h : TendstoUniformly F f p) : TendstoUniformly (fun i => g ∘ F i) (g ∘ f) p := fun _u hu => h _ (hg hu) #align uniform_continuous.comp_tendsto_uniformly UniformContinuous.comp_tendstoUniformly theorem TendstoUniformlyOnFilter.prod_map {ΞΉ' Ξ±' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ±' β†’ Ξ²'} {f' : Ξ±' β†’ Ξ²'} {q : Filter ΞΉ'} {q' : Filter Ξ±'} (h : TendstoUniformlyOnFilter F f p p') (h' : TendstoUniformlyOnFilter F' f' q q') : TendstoUniformlyOnFilter (fun i : ΞΉ Γ— ΞΉ' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p Γ—Λ’ q) (p' Γ—Λ’ q') := by rw [tendstoUniformlyOnFilter_iff_tendsto] at h h' ⊒ rw [uniformity_prod_eq_comap_prod, tendsto_comap_iff, ← map_swap4_prod, tendsto_map'_iff] convert h.prod_map h' -- seems to be faster than `exact` here #align tendsto_uniformly_on_filter.prod_map TendstoUniformlyOnFilter.prod_map theorem TendstoUniformlyOn.prod_map {ΞΉ' Ξ±' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ±' β†’ Ξ²'} {f' : Ξ±' β†’ Ξ²'} {p' : Filter ΞΉ'} {s' : Set Ξ±'} (h : TendstoUniformlyOn F f p s) (h' : TendstoUniformlyOn F' f' p' s') : TendstoUniformlyOn (fun i : ΞΉ Γ— ΞΉ' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p Γ—Λ’ p') (s Γ—Λ’ s') := by rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] at h h' ⊒ simpa only [prod_principal_principal] using h.prod_map h' #align tendsto_uniformly_on.prod_map TendstoUniformlyOn.prod_map theorem TendstoUniformly.prod_map {ΞΉ' Ξ±' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ±' β†’ Ξ²'} {f' : Ξ±' β†’ Ξ²'} {p' : Filter ΞΉ'} (h : TendstoUniformly F f p) (h' : TendstoUniformly F' f' p') : TendstoUniformly (fun i : ΞΉ Γ— ΞΉ' => Prod.map (F i.1) (F' i.2)) (Prod.map f f') (p Γ—Λ’ p') := by rw [← tendstoUniformlyOn_univ, ← univ_prod_univ] at * exact h.prod_map h' #align tendsto_uniformly.prod_map TendstoUniformly.prod_map theorem TendstoUniformlyOnFilter.prod {ΞΉ' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ± β†’ Ξ²'} {f' : Ξ± β†’ Ξ²'} {q : Filter ΞΉ'} (h : TendstoUniformlyOnFilter F f p p') (h' : TendstoUniformlyOnFilter F' f' q p') : TendstoUniformlyOnFilter (fun (i : ΞΉ Γ— ΞΉ') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p Γ—Λ’ q) p' := fun u hu => ((h.prod_map h') u hu).diag_of_prod_right #align tendsto_uniformly_on_filter.prod TendstoUniformlyOnFilter.prod theorem TendstoUniformlyOn.prod {ΞΉ' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ± β†’ Ξ²'} {f' : Ξ± β†’ Ξ²'} {p' : Filter ΞΉ'} (h : TendstoUniformlyOn F f p s) (h' : TendstoUniformlyOn F' f' p' s) : TendstoUniformlyOn (fun (i : ΞΉ Γ— ΞΉ') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p.prod p') s := (congr_arg _ s.inter_self).mp ((h.prod_map h').comp fun a => (a, a)) #align tendsto_uniformly_on.prod TendstoUniformlyOn.prod theorem TendstoUniformly.prod {ΞΉ' Ξ²' : Type*} [UniformSpace Ξ²'] {F' : ΞΉ' β†’ Ξ± β†’ Ξ²'} {f' : Ξ± β†’ Ξ²'} {p' : Filter ΞΉ'} (h : TendstoUniformly F f p) (h' : TendstoUniformly F' f' p') : TendstoUniformly (fun (i : ΞΉ Γ— ΞΉ') a => (F i.1 a, F' i.2 a)) (fun a => (f a, f' a)) (p Γ—Λ’ p') := (h.prod_map h').comp fun a => (a, a) #align tendsto_uniformly.prod TendstoUniformly.prod theorem tendsto_prod_filter_iff {c : Ξ²} : Tendsto (β†ΏF) (p Γ—Λ’ p') (𝓝 c) ↔ TendstoUniformlyOnFilter F (fun _ => c) p p' := by simp_rw [nhds_eq_comap_uniformity, tendsto_comap_iff] rfl #align tendsto_prod_filter_iff tendsto_prod_filter_iff
Mathlib/Topology/UniformSpace/UniformConvergence.lean
331
334
theorem tendsto_prod_principal_iff {c : Ξ²} : Tendsto (β†ΏF) (p Γ—Λ’ π“Ÿ s) (𝓝 c) ↔ TendstoUniformlyOn F (fun _ => c) p s := by
rw [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter] exact tendsto_prod_filter_iff
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ΞΉ Ξ± Ξ² : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield Ξ±] {a b c d e : Ξ±} {m n : β„€} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeftβ‚€ (a : Ξ±) (ha : 0 < a) : Ξ± ≃o Ξ± := { Equiv.mulLeftβ‚€ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_leftβ‚€ OrderIso.mulLeftβ‚€ #align order_iso.mul_leftβ‚€_symm_apply OrderIso.mulLeftβ‚€_symm_apply #align order_iso.mul_leftβ‚€_apply OrderIso.mulLeftβ‚€_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRightβ‚€ (a : Ξ±) (ha : 0 < a) : Ξ± ≃o Ξ± := { Equiv.mulRightβ‚€ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_rightβ‚€ OrderIso.mulRightβ‚€ #align order_iso.mul_rightβ‚€_symm_apply OrderIso.mulRightβ‚€_symm_apply #align order_iso.mul_rightβ‚€_apply OrderIso.mulRightβ‚€_apply theorem le_div_iff (hc : 0 < c) : a ≀ b / c ↔ a * c ≀ b := ⟨fun h => div_mul_cancelβ‚€ b (ne_of_lt hc).symm β–Έ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≀ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff theorem le_div_iff' (hc : 0 < c) : a ≀ b / c ↔ c * a ≀ b := by rw [mul_comm, le_div_iff hc] #align le_div_iff' le_div_iff' theorem div_le_iff (hb : 0 < b) : a / b ≀ c ↔ a ≀ c * b := ⟨fun h => calc a = a / b * b := by rw [div_mul_cancelβ‚€ _ (ne_of_lt hb).symm] _ ≀ c * b := mul_le_mul_of_nonneg_right h hb.le , fun h => calc a / b = a * (1 / b) := div_eq_mul_one_div a b _ ≀ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le _ = c * b / b := (div_eq_mul_one_div (c * b) b).symm _ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl ⟩ #align div_le_iff div_le_iff theorem div_le_iff' (hb : 0 < b) : a / b ≀ c ↔ a ≀ b * c := by rw [mul_comm, div_le_iff hb] #align div_le_iff' div_le_iff' lemma div_le_commβ‚€ (hb : 0 < b) (hc : 0 < c) : a / b ≀ c ↔ a / c ≀ b := by rw [div_le_iff hb, div_le_iff' hc] theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b := lt_iff_lt_of_le_iff_le <| div_le_iff hc #align lt_div_iff lt_div_iff theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by rw [mul_comm, lt_div_iff hc] #align lt_div_iff' lt_div_iff' theorem div_lt_iff (hc : 0 < c) : b / c < a ↔ b < a * c := lt_iff_lt_of_le_iff_le (le_div_iff hc) #align div_lt_iff div_lt_iff theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by rw [mul_comm, div_lt_iff hc] #align div_lt_iff' div_lt_iff' lemma div_lt_commβ‚€ (hb : 0 < b) (hc : 0 < c) : a / b < c ↔ a / c < b := by rw [div_lt_iff hb, div_lt_iff' hc] theorem inv_mul_le_iff (h : 0 < b) : b⁻¹ * a ≀ c ↔ a ≀ b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_le_iff' h #align inv_mul_le_iff inv_mul_le_iff theorem inv_mul_le_iff' (h : 0 < b) : b⁻¹ * a ≀ c ↔ a ≀ c * b := by rw [inv_mul_le_iff h, mul_comm] #align inv_mul_le_iff' inv_mul_le_iff' theorem mul_inv_le_iff (h : 0 < b) : a * b⁻¹ ≀ c ↔ a ≀ b * c := by rw [mul_comm, inv_mul_le_iff h] #align mul_inv_le_iff mul_inv_le_iff theorem mul_inv_le_iff' (h : 0 < b) : a * b⁻¹ ≀ c ↔ a ≀ c * b := by rw [mul_comm, inv_mul_le_iff' h] #align mul_inv_le_iff' mul_inv_le_iff' theorem div_self_le_one (a : Ξ±) : a / a ≀ 1 := if h : a = 0 then by simp [h] else by simp [h] #align div_self_le_one div_self_le_one theorem inv_mul_lt_iff (h : 0 < b) : b⁻¹ * a < c ↔ a < b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_lt_iff' h #align inv_mul_lt_iff inv_mul_lt_iff theorem inv_mul_lt_iff' (h : 0 < b) : b⁻¹ * a < c ↔ a < c * b := by rw [inv_mul_lt_iff h, mul_comm] #align inv_mul_lt_iff' inv_mul_lt_iff' theorem mul_inv_lt_iff (h : 0 < b) : a * b⁻¹ < c ↔ a < b * c := by rw [mul_comm, inv_mul_lt_iff h] #align mul_inv_lt_iff mul_inv_lt_iff theorem mul_inv_lt_iff' (h : 0 < b) : a * b⁻¹ < c ↔ a < c * b := by rw [mul_comm, inv_mul_lt_iff' h] #align mul_inv_lt_iff' mul_inv_lt_iff' theorem inv_pos_le_iff_one_le_mul (ha : 0 < a) : a⁻¹ ≀ b ↔ 1 ≀ b * a := by rw [inv_eq_one_div] exact div_le_iff ha #align inv_pos_le_iff_one_le_mul inv_pos_le_iff_one_le_mul theorem inv_pos_le_iff_one_le_mul' (ha : 0 < a) : a⁻¹ ≀ b ↔ 1 ≀ a * b := by rw [inv_eq_one_div] exact div_le_iff' ha #align inv_pos_le_iff_one_le_mul' inv_pos_le_iff_one_le_mul' theorem inv_pos_lt_iff_one_lt_mul (ha : 0 < a) : a⁻¹ < b ↔ 1 < b * a := by rw [inv_eq_one_div] exact div_lt_iff ha #align inv_pos_lt_iff_one_lt_mul inv_pos_lt_iff_one_lt_mul theorem inv_pos_lt_iff_one_lt_mul' (ha : 0 < a) : a⁻¹ < b ↔ 1 < a * b := by rw [inv_eq_one_div] exact div_lt_iff' ha #align inv_pos_lt_iff_one_lt_mul' inv_pos_lt_iff_one_lt_mul' theorem div_le_of_nonneg_of_le_mul (hb : 0 ≀ b) (hc : 0 ≀ c) (h : a ≀ c * b) : a / b ≀ c := by rcases eq_or_lt_of_le hb with (rfl | hb') Β· simp only [div_zero, hc] Β· rwa [div_le_iff hb'] #align div_le_of_nonneg_of_le_mul div_le_of_nonneg_of_le_mul lemma mul_le_of_nonneg_of_le_div (hb : 0 ≀ b) (hc : 0 ≀ c) (h : a ≀ b / c) : a * c ≀ b := by obtain rfl | hc := hc.eq_or_lt Β· simpa using hb Β· rwa [le_div_iff hc] at h #align mul_le_of_nonneg_of_le_div mul_le_of_nonneg_of_le_div theorem div_le_one_of_le (h : a ≀ b) (hb : 0 ≀ b) : a / b ≀ 1 := div_le_of_nonneg_of_le_mul hb zero_le_one <| by rwa [one_mul] #align div_le_one_of_le div_le_one_of_le lemma mul_inv_le_one_of_le (h : a ≀ b) (hb : 0 ≀ b) : a * b⁻¹ ≀ 1 := by simpa only [← div_eq_mul_inv] using div_le_one_of_le h hb lemma inv_mul_le_one_of_le (h : a ≀ b) (hb : 0 ≀ b) : b⁻¹ * a ≀ 1 := by simpa only [← div_eq_inv_mul] using div_le_one_of_le h hb @[gcongr] theorem inv_le_inv_of_le (ha : 0 < a) (h : a ≀ b) : b⁻¹ ≀ a⁻¹ := by rwa [← one_div a, le_div_iff' ha, ← div_eq_mul_inv, div_le_iff (ha.trans_le h), one_mul] #align inv_le_inv_of_le inv_le_inv_of_le theorem inv_le_inv (ha : 0 < a) (hb : 0 < b) : a⁻¹ ≀ b⁻¹ ↔ b ≀ a := by rw [← one_div, div_le_iff ha, ← div_eq_inv_mul, le_div_iff hb, one_mul] #align inv_le_inv inv_le_inv theorem inv_le (ha : 0 < a) (hb : 0 < b) : a⁻¹ ≀ b ↔ b⁻¹ ≀ a := by rw [← inv_le_inv hb (inv_pos.2 ha), inv_inv] #align inv_le inv_le theorem inv_le_of_inv_le (ha : 0 < a) (h : a⁻¹ ≀ b) : b⁻¹ ≀ a := (inv_le ha ((inv_pos.2 ha).trans_le h)).1 h #align inv_le_of_inv_le inv_le_of_inv_le theorem le_inv (ha : 0 < a) (hb : 0 < b) : a ≀ b⁻¹ ↔ b ≀ a⁻¹ := by rw [← inv_le_inv (inv_pos.2 hb) ha, inv_inv] #align le_inv le_inv theorem inv_lt_inv (ha : 0 < a) (hb : 0 < b) : a⁻¹ < b⁻¹ ↔ b < a := lt_iff_lt_of_le_iff_le (inv_le_inv hb ha) #align inv_lt_inv inv_lt_inv @[gcongr] theorem inv_lt_inv_of_lt (hb : 0 < b) (h : b < a) : a⁻¹ < b⁻¹ := (inv_lt_inv (hb.trans h) hb).2 h #align inv_lt_inv_of_lt inv_lt_inv_of_lt theorem inv_lt (ha : 0 < a) (hb : 0 < b) : a⁻¹ < b ↔ b⁻¹ < a := lt_iff_lt_of_le_iff_le (le_inv hb ha) #align inv_lt inv_lt theorem inv_lt_of_inv_lt (ha : 0 < a) (h : a⁻¹ < b) : b⁻¹ < a := (inv_lt ha ((inv_pos.2 ha).trans h)).1 h #align inv_lt_of_inv_lt inv_lt_of_inv_lt theorem lt_inv (ha : 0 < a) (hb : 0 < b) : a < b⁻¹ ↔ b < a⁻¹ := lt_iff_lt_of_le_iff_le (inv_le hb ha) #align lt_inv lt_inv theorem inv_lt_one (ha : 1 < a) : a⁻¹ < 1 := by rwa [inv_lt (zero_lt_one.trans ha) zero_lt_one, inv_one] #align inv_lt_one inv_lt_one theorem one_lt_inv (h₁ : 0 < a) (hβ‚‚ : a < 1) : 1 < a⁻¹ := by rwa [lt_inv (@zero_lt_one Ξ± _ _ _ _ _) h₁, inv_one] #align one_lt_inv one_lt_inv theorem inv_le_one (ha : 1 ≀ a) : a⁻¹ ≀ 1 := by rwa [inv_le (zero_lt_one.trans_le ha) zero_lt_one, inv_one] #align inv_le_one inv_le_one theorem one_le_inv (h₁ : 0 < a) (hβ‚‚ : a ≀ 1) : 1 ≀ a⁻¹ := by rwa [le_inv (@zero_lt_one Ξ± _ _ _ _ _) h₁, inv_one] #align one_le_inv one_le_inv theorem inv_lt_one_iff_of_pos (hβ‚€ : 0 < a) : a⁻¹ < 1 ↔ 1 < a := ⟨fun h₁ => inv_inv a β–Έ one_lt_inv (inv_pos.2 hβ‚€) h₁, inv_lt_one⟩ #align inv_lt_one_iff_of_pos inv_lt_one_iff_of_pos theorem inv_lt_one_iff : a⁻¹ < 1 ↔ a ≀ 0 ∨ 1 < a := by rcases le_or_lt a 0 with ha | ha Β· simp [ha, (inv_nonpos.2 ha).trans_lt zero_lt_one] Β· simp only [ha.not_le, false_or_iff, inv_lt_one_iff_of_pos ha] #align inv_lt_one_iff inv_lt_one_iff theorem one_lt_inv_iff : 1 < a⁻¹ ↔ 0 < a ∧ a < 1 := ⟨fun h => ⟨inv_pos.1 (zero_lt_one.trans h), inv_inv a β–Έ inv_lt_one h⟩, and_imp.2 one_lt_inv⟩ #align one_lt_inv_iff one_lt_inv_iff theorem inv_le_one_iff : a⁻¹ ≀ 1 ↔ a ≀ 0 ∨ 1 ≀ a := by rcases em (a = 1) with (rfl | ha) Β· simp [le_rfl] Β· simp only [Ne.le_iff_lt (Ne.symm ha), Ne.le_iff_lt (mt inv_eq_one.1 ha), inv_lt_one_iff] #align inv_le_one_iff inv_le_one_iff theorem one_le_inv_iff : 1 ≀ a⁻¹ ↔ 0 < a ∧ a ≀ 1 := ⟨fun h => ⟨inv_pos.1 (zero_lt_one.trans_le h), inv_inv a β–Έ inv_le_one h⟩, and_imp.2 one_le_inv⟩ #align one_le_inv_iff one_le_inv_iff @[mono, gcongr] lemma div_le_div_of_nonneg_right (hab : a ≀ b) (hc : 0 ≀ c) : a / c ≀ b / c := by rw [div_eq_mul_one_div a c, div_eq_mul_one_div b c] exact mul_le_mul_of_nonneg_right hab (one_div_nonneg.2 hc) #align div_le_div_of_le_of_nonneg div_le_div_of_nonneg_right @[gcongr] lemma div_lt_div_of_pos_right (h : a < b) (hc : 0 < c) : a / c < b / c := by rw [div_eq_mul_one_div a c, div_eq_mul_one_div b c] exact mul_lt_mul_of_pos_right h (one_div_pos.2 hc) #align div_lt_div_of_lt div_lt_div_of_pos_right -- Not a `mono` lemma b/c `div_le_div` is strictly more general @[gcongr] lemma div_le_div_of_nonneg_left (ha : 0 ≀ a) (hc : 0 < c) (h : c ≀ b) : a / b ≀ a / c := by rw [div_eq_mul_inv, div_eq_mul_inv] exact mul_le_mul_of_nonneg_left ((inv_le_inv (hc.trans_le h) hc).mpr h) ha #align div_le_div_of_le_left div_le_div_of_nonneg_left @[gcongr] lemma div_lt_div_of_pos_left (ha : 0 < a) (hc : 0 < c) (h : c < b) : a / b < a / c := by simpa only [div_eq_mul_inv, mul_lt_mul_left ha, inv_lt_inv (hc.trans h) hc] #align div_lt_div_of_lt_left div_lt_div_of_pos_left -- 2024-02-16 @[deprecated] alias div_le_div_of_le_of_nonneg := div_le_div_of_nonneg_right @[deprecated] alias div_lt_div_of_lt := div_lt_div_of_pos_right @[deprecated] alias div_le_div_of_le_left := div_le_div_of_nonneg_left @[deprecated] alias div_lt_div_of_lt_left := div_lt_div_of_pos_left @[deprecated div_le_div_of_nonneg_right (since := "2024-02-16")] lemma div_le_div_of_le (hc : 0 ≀ c) (hab : a ≀ b) : a / c ≀ b / c := div_le_div_of_nonneg_right hab hc #align div_le_div_of_le div_le_div_of_le theorem div_le_div_right (hc : 0 < c) : a / c ≀ b / c ↔ a ≀ b := ⟨le_imp_le_of_lt_imp_lt fun hab ↦ div_lt_div_of_pos_right hab hc, fun hab ↦ div_le_div_of_nonneg_right hab hc.le⟩ #align div_le_div_right div_le_div_right theorem div_lt_div_right (hc : 0 < c) : a / c < b / c ↔ a < b := lt_iff_lt_of_le_iff_le <| div_le_div_right hc #align div_lt_div_right div_lt_div_right theorem div_lt_div_left (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : a / b < a / c ↔ c < b := by simp only [div_eq_mul_inv, mul_lt_mul_left ha, inv_lt_inv hb hc] #align div_lt_div_left div_lt_div_left theorem div_le_div_left (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : a / b ≀ a / c ↔ c ≀ b := le_iff_le_iff_lt_iff_lt.2 (div_lt_div_left ha hc hb) #align div_le_div_left div_le_div_left theorem div_lt_div_iff (b0 : 0 < b) (d0 : 0 < d) : a / b < c / d ↔ a * d < c * b := by rw [lt_div_iff d0, div_mul_eq_mul_div, div_lt_iff b0] #align div_lt_div_iff div_lt_div_iff theorem div_le_div_iff (b0 : 0 < b) (d0 : 0 < d) : a / b ≀ c / d ↔ a * d ≀ c * b := by rw [le_div_iff d0, div_mul_eq_mul_div, div_le_iff b0] #align div_le_div_iff div_le_div_iff @[mono, gcongr] theorem div_le_div (hc : 0 ≀ c) (hac : a ≀ c) (hd : 0 < d) (hbd : d ≀ b) : a / b ≀ c / d := by rw [div_le_div_iff (hd.trans_le hbd) hd] exact mul_le_mul hac hbd hd.le hc #align div_le_div div_le_div @[gcongr] theorem div_lt_div (hac : a < c) (hbd : d ≀ b) (c0 : 0 ≀ c) (d0 : 0 < d) : a / b < c / d := (div_lt_div_iff (d0.trans_le hbd) d0).2 (mul_lt_mul hac hbd d0 c0) #align div_lt_div div_lt_div theorem div_lt_div' (hac : a ≀ c) (hbd : d < b) (c0 : 0 < c) (d0 : 0 < d) : a / b < c / d := (div_lt_div_iff (d0.trans hbd) d0).2 (mul_lt_mul' hac hbd d0.le c0) #align div_lt_div' div_lt_div' theorem div_le_self (ha : 0 ≀ a) (hb : 1 ≀ b) : a / b ≀ a := by simpa only [div_one] using div_le_div_of_nonneg_left ha zero_lt_one hb #align div_le_self div_le_self theorem div_lt_self (ha : 0 < a) (hb : 1 < b) : a / b < a := by simpa only [div_one] using div_lt_div_of_pos_left ha zero_lt_one hb #align div_lt_self div_lt_self
Mathlib/Algebra/Order/Field/Basic.lean
360
361
theorem le_div_self (ha : 0 ≀ a) (hbβ‚€ : 0 < b) (hb₁ : b ≀ 1) : a ≀ a / b := by
simpa only [div_one] using div_le_div_of_nonneg_left ha hbβ‚€ hb₁
import Mathlib.Data.List.Sublists import Mathlib.Data.Multiset.Bind #align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {Ξ± : Type*} -- Porting note (#11215): TODO: Write a more efficient version def powersetAux (l : List Ξ±) : List (Multiset Ξ±) := (sublists l).map (↑) #align multiset.powerset_aux Multiset.powersetAux theorem powersetAux_eq_map_coe {l : List Ξ±} : powersetAux l = (sublists l).map (↑) := rfl #align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe @[simp] theorem mem_powersetAux {l : List Ξ±} {s} : s ∈ powersetAux l ↔ s ≀ ↑l := Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm] #align multiset.mem_powerset_aux Multiset.mem_powersetAux def powersetAux' (l : List Ξ±) : List (Multiset Ξ±) := (sublists' l).map (↑) #align multiset.powerset_aux' Multiset.powersetAux' theorem powersetAux_perm_powersetAux' {l : List Ξ±} : powersetAux l ~ powersetAux' l := by rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _ #align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux' @[simp] theorem powersetAux'_nil : powersetAux' (@nil Ξ±) = [0] := rfl #align multiset.powerset_aux'_nil Multiset.powersetAux'_nil @[simp] theorem powersetAux'_cons (a : Ξ±) (l : List Ξ±) : powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_aux'_cons Multiset.powersetAux'_cons theorem powerset_aux'_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux' l₁ ~ powersetAux' lβ‚‚ := by induction' p with a l₁ lβ‚‚ p IH a b l l₁ lβ‚‚ l₃ _ _ IH₁ IHβ‚‚ Β· simp Β· simp only [powersetAux'_cons] exact IH.append (IH.map _) Β· simp only [powersetAux'_cons, map_append, List.map_map, append_assoc] apply Perm.append_left rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ Β· exact IH₁.trans IHβ‚‚ #align multiset.powerset_aux'_perm Multiset.powerset_aux'_perm theorem powersetAux_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetAux l₁ ~ powersetAux lβ‚‚ := powersetAux_perm_powersetAux'.trans <| (powerset_aux'_perm p).trans powersetAux_perm_powersetAux'.symm #align multiset.powerset_aux_perm Multiset.powersetAux_perm --Porting note (#11083): slightly slower implementation due to `map ofList` def powerset (s : Multiset Ξ±) : Multiset (Multiset Ξ±) := Quot.liftOn s (fun l => (powersetAux l : Multiset (Multiset Ξ±))) (fun _ _ h => Quot.sound (powersetAux_perm h)) #align multiset.powerset Multiset.powerset theorem powerset_coe (l : List Ξ±) : @powerset Ξ± l = ((sublists l).map (↑) : List (Multiset Ξ±)) := congr_arg ((↑) : List (Multiset Ξ±) β†’ Multiset (Multiset Ξ±)) powersetAux_eq_map_coe #align multiset.powerset_coe Multiset.powerset_coe @[simp] theorem powerset_coe' (l : List Ξ±) : @powerset Ξ± l = ((sublists' l).map (↑) : List (Multiset Ξ±)) := Quot.sound powersetAux_perm_powersetAux' #align multiset.powerset_coe' Multiset.powerset_coe' @[simp] theorem powerset_zero : @powerset Ξ± 0 = {0} := rfl #align multiset.powerset_zero Multiset.powerset_zero @[simp] theorem powerset_cons (a : Ξ±) (s) : powerset (a ::β‚˜ s) = powerset s + map (cons a) (powerset s) := Quotient.inductionOn s fun l => by simp only [quot_mk_to_coe, cons_coe, powerset_coe', sublists'_cons, map_append, List.map_map, map_coe, coe_add, coe_eq_coe]; rfl #align multiset.powerset_cons Multiset.powerset_cons @[simp] theorem mem_powerset {s t : Multiset Ξ±} : s ∈ powerset t ↔ s ≀ t := Quotient.inductionOnβ‚‚ s t <| by simp [Subperm, and_comm] #align multiset.mem_powerset Multiset.mem_powerset theorem map_single_le_powerset (s : Multiset Ξ±) : s.map singleton ≀ powerset s := Quotient.inductionOn s fun l => by simp only [powerset_coe, quot_mk_to_coe, coe_le, map_coe] show l.map (((↑) : List Ξ± β†’ Multiset Ξ±) ∘ pure) <+~ (sublists l).map (↑) rw [← List.map_map] exact ((map_pure_sublist_sublists _).map _).subperm #align multiset.map_single_le_powerset Multiset.map_single_le_powerset @[simp] theorem card_powerset (s : Multiset Ξ±) : card (powerset s) = 2 ^ card s := Quotient.inductionOn s <| by simp #align multiset.card_powerset Multiset.card_powerset theorem revzip_powersetAux {l : List Ξ±} ⦃x⦄ (h : x ∈ revzip (powersetAux l)) : x.1 + x.2 = ↑l := by rw [revzip, powersetAux_eq_map_coe, ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, lβ‚‚, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists _ _ _ h) #align multiset.revzip_powerset_aux Multiset.revzip_powersetAux theorem revzip_powersetAux' {l : List Ξ±} ⦃x⦄ (h : x ∈ revzip (powersetAux' l)) : x.1 + x.2 = ↑l := by rw [revzip, powersetAux', ← map_reverse, zip_map, ← revzip, List.mem_map] at h simp only [Prod.map_apply, Prod.exists] at h rcases h with ⟨l₁, lβ‚‚, h, rfl, rfl⟩ exact Quot.sound (revzip_sublists' _ _ _ h) #align multiset.revzip_powerset_aux' Multiset.revzip_powersetAux' theorem revzip_powersetAux_lemma {Ξ± : Type*} [DecidableEq Ξ±] (l : List Ξ±) {l' : List (Multiset Ξ±)} (H : βˆ€ ⦃x : _ Γ— _⦄, x ∈ revzip l' β†’ x.1 + x.2 = ↑l) : revzip l' = l'.map fun x => (x, (l : Multiset Ξ±) - x) := by have : Forallβ‚‚ (fun (p : Multiset Ξ± Γ— Multiset Ξ±) (s : Multiset Ξ±) => p = (s, ↑l - s)) (revzip l') ((revzip l').map Prod.fst) := by rw [forallβ‚‚_map_right_iff, forallβ‚‚_same] rintro ⟨s, t⟩ h dsimp rw [← H h, add_tsub_cancel_left] rw [← forallβ‚‚_eq_eq_eq, forallβ‚‚_map_right_iff] simpa using this #align multiset.revzip_powerset_aux_lemma Multiset.revzip_powersetAux_lemma theorem revzip_powersetAux_perm_aux' {l : List Ξ±} : revzip (powersetAux l) ~ revzip (powersetAux' l) := by haveI := Classical.decEq Ξ± rw [revzip_powersetAux_lemma l revzip_powersetAux, revzip_powersetAux_lemma l revzip_powersetAux'] exact powersetAux_perm_powersetAux'.map _ #align multiset.revzip_powerset_aux_perm_aux' Multiset.revzip_powersetAux_perm_aux' theorem revzip_powersetAux_perm {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : revzip (powersetAux l₁) ~ revzip (powersetAux lβ‚‚) := by haveI := Classical.decEq Ξ± simp only [fun l : List Ξ± => revzip_powersetAux_lemma l revzip_powersetAux, coe_eq_coe.2 p, ge_iff_le] exact (powersetAux_perm p).map _ #align multiset.revzip_powerset_aux_perm Multiset.revzip_powersetAux_perm def powersetCardAux (n : β„•) (l : List Ξ±) : List (Multiset Ξ±) := sublistsLenAux n l (↑) [] #align multiset.powerset_len_aux Multiset.powersetCardAux theorem powersetCardAux_eq_map_coe {n} {l : List Ξ±} : powersetCardAux n l = (sublistsLen n l).map (↑) := by rw [powersetCardAux, sublistsLenAux_eq, append_nil] #align multiset.powerset_len_aux_eq_map_coe Multiset.powersetCardAux_eq_map_coe @[simp] theorem mem_powersetCardAux {n} {l : List Ξ±} {s} : s ∈ powersetCardAux n l ↔ s ≀ ↑l ∧ card s = n := Quotient.inductionOn s <| by simp only [quot_mk_to_coe, powersetCardAux_eq_map_coe, List.mem_map, mem_sublistsLen, coe_eq_coe, coe_le, Subperm, exists_prop, coe_card] exact fun l₁ => ⟨fun ⟨lβ‚‚, ⟨s, e⟩, p⟩ => ⟨⟨_, p, s⟩, p.symm.length_eq.trans e⟩, fun ⟨⟨lβ‚‚, p, s⟩, e⟩ => ⟨_, ⟨s, p.length_eq.trans e⟩, p⟩⟩ #align multiset.mem_powerset_len_aux Multiset.mem_powersetCardAux @[simp] theorem powersetCardAux_zero (l : List Ξ±) : powersetCardAux 0 l = [0] := by simp [powersetCardAux_eq_map_coe] #align multiset.powerset_len_aux_zero Multiset.powersetCardAux_zero @[simp] theorem powersetCardAux_nil (n : β„•) : powersetCardAux (n + 1) (@nil Ξ±) = [] := rfl #align multiset.powerset_len_aux_nil Multiset.powersetCardAux_nil @[simp] theorem powersetCardAux_cons (n : β„•) (a : Ξ±) (l : List Ξ±) : powersetCardAux (n + 1) (a :: l) = powersetCardAux (n + 1) l ++ List.map (cons a) (powersetCardAux n l) := by simp only [powersetCardAux_eq_map_coe, sublistsLen_succ_cons, map_append, List.map_map, append_cancel_left_eq]; rfl #align multiset.powerset_len_aux_cons Multiset.powersetCardAux_cons theorem powersetCardAux_perm {n} {l₁ lβ‚‚ : List Ξ±} (p : l₁ ~ lβ‚‚) : powersetCardAux n l₁ ~ powersetCardAux n lβ‚‚ := by induction' n with n IHn generalizing l₁ lβ‚‚ Β· simp induction' p with a l₁ lβ‚‚ p IH a b l l₁ lβ‚‚ l₃ _ _ IH₁ IHβ‚‚ Β· rfl Β· simp only [powersetCardAux_cons] exact IH.append ((IHn p).map _) Β· simp only [powersetCardAux_cons, append_assoc] apply Perm.append_left cases n Β· simp [Perm.swap] simp only [powersetCardAux_cons, map_append, List.map_map] rw [← append_assoc, ← append_assoc, (by funext s; simp [cons_swap] : cons b ∘ cons a = cons a ∘ cons b)] exact perm_append_comm.append_right _ Β· exact IH₁.trans IHβ‚‚ #align multiset.powerset_len_aux_perm Multiset.powersetCardAux_perm def powersetCard (n : β„•) (s : Multiset Ξ±) : Multiset (Multiset Ξ±) := Quot.liftOn s (fun l => (powersetCardAux n l : Multiset (Multiset Ξ±))) fun _ _ h => Quot.sound (powersetCardAux_perm h) #align multiset.powerset_len Multiset.powersetCard theorem powersetCard_coe' (n) (l : List Ξ±) : @powersetCard Ξ± n l = powersetCardAux n l := rfl #align multiset.powerset_len_coe' Multiset.powersetCard_coe' theorem powersetCard_coe (n) (l : List Ξ±) : @powersetCard Ξ± n l = ((sublistsLen n l).map (↑) : List (Multiset Ξ±)) := congr_arg ((↑) : List (Multiset Ξ±) β†’ Multiset (Multiset Ξ±)) powersetCardAux_eq_map_coe #align multiset.powerset_len_coe Multiset.powersetCard_coe @[simp] theorem powersetCard_zero_left (s : Multiset Ξ±) : powersetCard 0 s = {0} := Quotient.inductionOn s fun l => by simp [powersetCard_coe'] #align multiset.powerset_len_zero_left Multiset.powersetCard_zero_left theorem powersetCard_zero_right (n : β„•) : @powersetCard Ξ± (n + 1) 0 = 0 := rfl #align multiset.powerset_len_zero_right Multiset.powersetCard_zero_right @[simp] theorem powersetCard_cons (n : β„•) (a : Ξ±) (s) : powersetCard (n + 1) (a ::β‚˜ s) = powersetCard (n + 1) s + map (cons a) (powersetCard n s) := Quotient.inductionOn s fun l => by simp [powersetCard_coe'] #align multiset.powerset_len_cons Multiset.powersetCard_cons theorem powersetCard_one (s : Multiset Ξ±) : powersetCard 1 s = s.map singleton := Quotient.inductionOn s fun l ↦ by simp [powersetCard_coe, sublistsLen_one, map_reverse, Function.comp] @[simp] theorem mem_powersetCard {n : β„•} {s t : Multiset Ξ±} : s ∈ powersetCard n t ↔ s ≀ t ∧ card s = n := Quotient.inductionOn t fun l => by simp [powersetCard_coe'] #align multiset.mem_powerset_len Multiset.mem_powersetCard @[simp] theorem card_powersetCard (n : β„•) (s : Multiset Ξ±) : card (powersetCard n s) = Nat.choose (card s) n := Quotient.inductionOn s <| by simp [powersetCard_coe] #align multiset.card_powerset_len Multiset.card_powersetCard theorem powersetCard_le_powerset (n : β„•) (s : Multiset Ξ±) : powersetCard n s ≀ powerset s := Quotient.inductionOn s fun l => by simp only [quot_mk_to_coe, powersetCard_coe, powerset_coe', coe_le] exact ((sublistsLen_sublist_sublists' _ _).map _).subperm #align multiset.powerset_len_le_powerset Multiset.powersetCard_le_powerset theorem powersetCard_mono (n : β„•) {s t : Multiset Ξ±} (h : s ≀ t) : powersetCard n s ≀ powersetCard n t := leInductionOn h fun {l₁ lβ‚‚} h => by simp only [powersetCard_coe, coe_le] exact ((sublistsLen_sublist_of_sublist _ h).map _).subperm #align multiset.powerset_len_mono Multiset.powersetCard_mono @[simp] theorem powersetCard_eq_empty {Ξ± : Type*} (n : β„•) {s : Multiset Ξ±} (h : card s < n) : powersetCard n s = 0 := card_eq_zero.mp (Nat.choose_eq_zero_of_lt h β–Έ card_powersetCard _ _) #align multiset.powerset_len_empty Multiset.powersetCard_eq_empty @[simp] theorem powersetCard_card_add (s : Multiset Ξ±) {i : β„•} (hi : 0 < i) : s.powersetCard (card s + i) = 0 := powersetCard_eq_empty _ (Nat.lt_add_of_pos_right hi) #align multiset.powerset_len_card_add Multiset.powersetCard_card_add
Mathlib/Data/Multiset/Powerset.lean
300
304
theorem powersetCard_map {Ξ² : Type*} (f : Ξ± β†’ Ξ²) (n : β„•) (s : Multiset Ξ±) : powersetCard n (s.map f) = (powersetCard n s).map (map f) := by
induction' s using Multiset.induction with t s ih generalizing n Β· cases n <;> simp [powersetCard_zero_left, powersetCard_zero_right] Β· cases n <;> simp [ih, map_comp_cons]
import Mathlib.AlgebraicTopology.SimplicialObject import Mathlib.CategoryTheory.Limits.Shapes.Products #align_import algebraic_topology.split_simplicial_object from "leanprover-community/mathlib"@"dd1f8496baa505636a82748e6b652165ea888733" noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits Opposite SimplexCategory open Simplicial universe u variable {C : Type*} [Category C] namespace SimplicialObject namespace Splitting def IndexSet (Ξ” : SimplexCategoryα΅’α΅–) := ΣΔ' : SimplexCategoryα΅’α΅–, { Ξ± : Ξ”.unop ⟢ Ξ”'.unop // Epi Ξ± } #align simplicial_object.splitting.index_set SimplicialObject.Splitting.IndexSet namespace IndexSet @[simps] def mk {Ξ” Ξ”' : SimplexCategory} (f : Ξ” ⟢ Ξ”') [Epi f] : IndexSet (op Ξ”) := ⟨op Ξ”', f, inferInstance⟩ #align simplicial_object.splitting.index_set.mk SimplicialObject.Splitting.IndexSet.mk variable {Ξ” : SimplexCategoryα΅’α΅–} (A : IndexSet Ξ”) def e := A.2.1 #align simplicial_object.splitting.index_set.e SimplicialObject.Splitting.IndexSet.e instance : Epi A.e := A.2.2 theorem ext' : A = ⟨A.1, ⟨A.e, A.2.2⟩⟩ := rfl #align simplicial_object.splitting.index_set.ext' SimplicialObject.Splitting.IndexSet.ext' theorem ext (A₁ Aβ‚‚ : IndexSet Ξ”) (h₁ : A₁.1 = Aβ‚‚.1) (hβ‚‚ : A₁.e ≫ eqToHom (by rw [h₁]) = Aβ‚‚.e) : A₁ = Aβ‚‚ := by rcases A₁ with βŸ¨Ξ”β‚, βŸ¨Ξ±β‚, hΞ±β‚βŸ©βŸ© rcases Aβ‚‚ with βŸ¨Ξ”β‚‚, βŸ¨Ξ±β‚‚, hΞ±β‚‚βŸ©βŸ© simp only at h₁ subst h₁ simp only [eqToHom_refl, comp_id, IndexSet.e] at hβ‚‚ simp only [hβ‚‚] #align simplicial_object.splitting.index_set.ext SimplicialObject.Splitting.IndexSet.ext instance : Fintype (IndexSet Ξ”) := Fintype.ofInjective (fun A => ⟨⟨A.1.unop.len, Nat.lt_succ_iff.mpr (len_le_of_epi (inferInstance : Epi A.e))⟩, A.e.toOrderHom⟩ : IndexSet Ξ” β†’ Sigma fun k : Fin (Ξ”.unop.len + 1) => Fin (Ξ”.unop.len + 1) β†’ Fin (k + 1)) (by rintro βŸ¨Ξ”β‚, Ξ±β‚βŸ© βŸ¨Ξ”β‚‚, Ξ±β‚‚βŸ© h₁ induction' Δ₁ using Opposite.rec with Δ₁ induction' Ξ”β‚‚ using Opposite.rec with Ξ”β‚‚ simp only [unop_op, Sigma.mk.inj_iff, Fin.mk.injEq] at h₁ have hβ‚‚ : Δ₁ = Ξ”β‚‚ := by ext1 simpa only [Fin.mk_eq_mk] using h₁.1 subst hβ‚‚ refine ext _ _ rfl ?_ ext : 2 exact eq_of_heq h₁.2) variable (Ξ”) @[simps] def id : IndexSet Ξ” := βŸ¨Ξ”, βŸ¨πŸ™ _, by infer_instance⟩⟩ #align simplicial_object.splitting.index_set.id SimplicialObject.Splitting.IndexSet.id instance : Inhabited (IndexSet Ξ”) := ⟨id Ξ”βŸ© variable {Ξ”} @[simp] def EqId : Prop := A = id _ #align simplicial_object.splitting.index_set.eq_id SimplicialObject.Splitting.IndexSet.EqId theorem eqId_iff_eq : A.EqId ↔ A.1 = Ξ” := by constructor Β· intro h dsimp at h rw [h] rfl Β· intro h rcases A with ⟨_, ⟨f, hf⟩⟩ simp only at h subst h refine ext _ _ rfl ?_ haveI := hf simp only [eqToHom_refl, comp_id] exact eq_id_of_epi f #align simplicial_object.splitting.index_set.eq_id_iff_eq SimplicialObject.Splitting.IndexSet.eqId_iff_eq
Mathlib/AlgebraicTopology/SplitSimplicialObject.lean
143
151
theorem eqId_iff_len_eq : A.EqId ↔ A.1.unop.len = Ξ”.unop.len := by
rw [eqId_iff_eq] constructor Β· intro h rw [h] Β· intro h rw [← unop_inj_iff] ext exact h
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section RealDerivOfComplex open Complex variable {e : β„‚ β†’ β„‚} {e' : β„‚} {z : ℝ} theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) : HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasStrictFDerivAt ((↑) : ℝ β†’ β„‚) ofRealCLM z := ofRealCLM.hasStrictFDerivAt have B : HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : β„‚ β†’L[β„‚] β„‚).restrictScalars ℝ) (ofRealCLM z) := h.hasStrictFDerivAt.restrictScalars ℝ have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasStrictDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) : HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasFDerivAt ((↑) : ℝ β†’ β„‚) ofRealCLM z := ofRealCLM.hasFDerivAt have B : HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : β„‚ β†’L[β„‚] β„‚).restrictScalars ℝ) (ofRealCLM z) := h.hasFDerivAt.restrictScalars ℝ have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_deriv_at.real_of_complex HasDerivAt.real_of_complex theorem ContDiffAt.real_of_complex {n : β„•βˆž} (h : ContDiffAt β„‚ n e z) : ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by have A : ContDiffAt ℝ n ((↑) : ℝ β†’ β„‚) z := ofRealCLM.contDiff.contDiffAt have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt exact C.comp z (B.comp z A) #align cont_diff_at.real_of_complex ContDiffAt.real_of_complex theorem ContDiff.real_of_complex {n : β„•βˆž} (h : ContDiff β„‚ n e) : ContDiff ℝ n fun x : ℝ => (e x).re := contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex #align cont_diff.real_of_complex ContDiff.real_of_complex variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β„‚ E] theorem HasStrictDerivAt.complexToReal_fderiv' {f : β„‚ β†’ E} {x : β„‚} {f' : E} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv' theorem HasDerivAt.complexToReal_fderiv' {f : β„‚ β†’ E} {x : β„‚} {f' : E} (h : HasDerivAt f f' x) : HasFDerivAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ #align has_deriv_at.complex_to_real_fderiv' HasDerivAt.complexToReal_fderiv'
Mathlib/Analysis/Complex/RealDeriv.lean
111
115
theorem HasDerivWithinAt.complexToReal_fderiv' {f : β„‚ β†’ E} {s : Set β„‚} {x : β„‚} {f' : E} (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (reCLM.smulRight f' + I β€’ imCLM.smulRight f') s x := by
simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivWithinAt.restrictScalars ℝ
import Mathlib.Data.List.Basic #align_import data.list.count from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" assert_not_exists Set.range assert_not_exists GroupWithZero assert_not_exists Ring open Nat variable {Ξ± : Type*} {l : List Ξ±} namespace List section CountP variable (p q : Ξ± β†’ Bool) #align list.countp_nil List.countP_nil #align list.countp_cons_of_pos List.countP_cons_of_pos #align list.countp_cons_of_neg List.countP_cons_of_neg #align list.countp_cons List.countP_cons #align list.length_eq_countp_add_countp List.length_eq_countP_add_countP #align list.countp_eq_length_filter List.countP_eq_length_filter #align list.countp_le_length List.countP_le_length #align list.countp_append List.countP_append #align list.countp_pos List.countP_pos #align list.countp_eq_zero List.countP_eq_zero #align list.countp_eq_length List.countP_eq_length
Mathlib/Data/List/Count.lean
54
57
theorem length_filter_lt_length_iff_exists (l) : length (filter p l) < length l ↔ βˆƒ x ∈ l, Β¬p x := by
simpa [length_eq_countP_add_countP p l, countP_eq_length_filter] using countP_pos (fun x => Β¬p x) (l := l)
import Mathlib.CategoryTheory.Abelian.Homology import Mathlib.CategoryTheory.Abelian.ProjectiveResolution import Mathlib.Algebra.Homology.Additive #align_import category_theory.abelian.left_derived from "leanprover-community/mathlib"@"8001ea54ece3bd5c0d0932f1e4f6d0f142ea20d9" universe v u namespace CategoryTheory open Category Limits variable {C : Type u} [Category.{v} C] {D : Type*} [Category D] [Abelian C] [HasProjectiveResolutions C] [Abelian D] noncomputable def Functor.leftDerivedToHomotopyCategory (F : C β₯€ D) [F.Additive] : C β₯€ HomotopyCategory D (ComplexShape.down β„•) := projectiveResolutions C β‹™ F.mapHomotopyCategory _ noncomputable def ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj {X : C} (P : ProjectiveResolution X) (F : C β₯€ D) [F.Additive] : F.leftDerivedToHomotopyCategory.obj X β‰… (F.mapHomologicalComplex _ β‹™ HomotopyCategory.quotient _ _).obj P.complex := (F.mapHomotopyCategory _).mapIso P.iso β‰ͺ≫ (F.mapHomotopyCategoryFactors _).app P.complex @[reassoc] lemma ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_inv_naturality {X Y : C} (f : X ⟢ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y) (Ο† : P.complex ⟢ Q.complex) (comm : Ο†.f 0 ≫ Q.Ο€.f 0 = P.Ο€.f 0 ≫ f) (F : C β₯€ D) [F.Additive] : (P.isoLeftDerivedToHomotopyCategoryObj F).inv ≫ F.leftDerivedToHomotopyCategory.map f = (F.mapHomologicalComplex _ β‹™ HomotopyCategory.quotient _ _).map Ο† ≫ (Q.isoLeftDerivedToHomotopyCategoryObj F).inv := by dsimp [Functor.leftDerivedToHomotopyCategory, isoLeftDerivedToHomotopyCategoryObj] rw [assoc, ← Functor.map_comp, iso_inv_naturality f P Q Ο† comm, Functor.map_comp] erw [(F.mapHomotopyCategoryFactors (ComplexShape.down β„•)).inv.naturality_assoc] rfl @[reassoc] lemma ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_hom_naturality {X Y : C} (f : X ⟢ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y) (Ο† : P.complex ⟢ Q.complex) (comm : Ο†.f 0 ≫ Q.Ο€.f 0 = P.Ο€.f 0 ≫ f) (F : C β₯€ D) [F.Additive] : F.leftDerivedToHomotopyCategory.map f ≫ (Q.isoLeftDerivedToHomotopyCategoryObj F).hom = (P.isoLeftDerivedToHomotopyCategoryObj F).hom ≫ (F.mapHomologicalComplex _ β‹™ HomotopyCategory.quotient _ _).map Ο† := by dsimp rw [← cancel_epi (P.isoLeftDerivedToHomotopyCategoryObj F).inv, Iso.inv_hom_id_assoc, isoLeftDerivedToHomotopyCategoryObj_inv_naturality_assoc f P Q Ο† comm F, Iso.inv_hom_id, comp_id] noncomputable def Functor.leftDerived (F : C β₯€ D) [F.Additive] (n : β„•) : C β₯€ D := F.leftDerivedToHomotopyCategory β‹™ HomotopyCategory.homologyFunctor D _ n #align category_theory.functor.left_derived CategoryTheory.Functor.leftDerived noncomputable def ProjectiveResolution.isoLeftDerivedObj {X : C} (P : ProjectiveResolution X) (F : C β₯€ D) [F.Additive] (n : β„•) : (F.leftDerived n).obj X β‰… (HomologicalComplex.homologyFunctor D _ n).obj ((F.mapHomologicalComplex _).obj P.complex) := (HomotopyCategory.homologyFunctor D _ n).mapIso (P.isoLeftDerivedToHomotopyCategoryObj F) β‰ͺ≫ (HomotopyCategory.homologyFunctorFactors D (ComplexShape.down β„•) n).app _ @[reassoc] lemma ProjectiveResolution.isoLeftDerivedObj_hom_naturality {X Y : C} (f : X ⟢ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y) (Ο† : P.complex ⟢ Q.complex) (comm : Ο†.f 0 ≫ Q.Ο€.f 0 = P.Ο€.f 0 ≫ f) (F : C β₯€ D) [F.Additive] (n : β„•) : (F.leftDerived n).map f ≫ (Q.isoLeftDerivedObj F n).hom = (P.isoLeftDerivedObj F n).hom ≫ (F.mapHomologicalComplex _ β‹™ HomologicalComplex.homologyFunctor _ _ n).map Ο† := by dsimp [isoLeftDerivedObj, Functor.leftDerived] rw [assoc, ← Functor.map_comp_assoc, ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_hom_naturality f P Q Ο† comm F, Functor.map_comp, assoc] erw [(HomotopyCategory.homologyFunctorFactors D (ComplexShape.down β„•) n).hom.naturality] rfl @[reassoc] lemma ProjectiveResolution.isoLeftDerivedObj_inv_naturality {X Y : C} (f : X ⟢ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y) (Ο† : P.complex ⟢ Q.complex) (comm : Ο†.f 0 ≫ Q.Ο€.f 0 = P.Ο€.f 0 ≫ f) (F : C β₯€ D) [F.Additive] (n : β„•) : (P.isoLeftDerivedObj F n).inv ≫ (F.leftDerived n).map f = (F.mapHomologicalComplex _ β‹™ HomologicalComplex.homologyFunctor _ _ n).map Ο† ≫ (Q.isoLeftDerivedObj F n).inv := by rw [← cancel_mono (Q.isoLeftDerivedObj F n).hom, assoc, assoc, ProjectiveResolution.isoLeftDerivedObj_hom_naturality f P Q Ο† comm F n, Iso.inv_hom_id_assoc, Iso.inv_hom_id, comp_id] lemma Functor.isZero_leftDerived_obj_projective_succ (F : C β₯€ D) [F.Additive] (n : β„•) (X : C) [Projective X] : IsZero ((F.leftDerived (n + 1)).obj X) := by refine IsZero.of_iso ?_ ((ProjectiveResolution.self X).isoLeftDerivedObj F (n + 1)) erw [← HomologicalComplex.exactAt_iff_isZero_homology] exact ShortComplex.exact_of_isZero_Xβ‚‚ _ (F.map_isZero (by apply isZero_zero))
Mathlib/CategoryTheory/Abelian/LeftDerived.lean
157
168
theorem Functor.leftDerived_map_eq (F : C β₯€ D) [F.Additive] (n : β„•) {X Y : C} (f : X ⟢ Y) {P : ProjectiveResolution X} {Q : ProjectiveResolution Y} (g : P.complex ⟢ Q.complex) (w : g ≫ Q.Ο€ = P.Ο€ ≫ (ChainComplex.singleβ‚€ C).map f) : (F.leftDerived n).map f = (P.isoLeftDerivedObj F n).hom ≫ (F.mapHomologicalComplex _ β‹™ HomologicalComplex.homologyFunctor _ _ n).map g ≫ (Q.isoLeftDerivedObj F n).inv := by
rw [← cancel_mono (Q.isoLeftDerivedObj F n).hom, ProjectiveResolution.isoLeftDerivedObj_hom_naturality f P Q g _ F n, assoc, assoc, Iso.inv_hom_id, comp_id] rw [← HomologicalComplex.comp_f, w, HomologicalComplex.comp_f, ChainComplex.singleβ‚€_map_f_zero]
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.SetTheory.Ordinal.Exponential #align_import set_theory.ordinal.fixed_point from "leanprover-community/mathlib"@"0dd4319a17376eda5763cd0a7e0d35bbaaa50e83" noncomputable section universe u v open Function Order namespace Ordinal section variable {ΞΉ : Type u} {f : ΞΉ β†’ Ordinal.{max u v} β†’ Ordinal.{max u v}} def nfpFamily (f : ΞΉ β†’ Ordinal β†’ Ordinal) (a : Ordinal) : Ordinal := sup (List.foldr f a) #align ordinal.nfp_family Ordinal.nfpFamily theorem nfpFamily_eq_sup (f : ΞΉ β†’ Ordinal.{max u v} β†’ Ordinal.{max u v}) (a : Ordinal.{max u v}) : nfpFamily.{u, v} f a = sup.{u, v} (List.foldr f a) := rfl #align ordinal.nfp_family_eq_sup Ordinal.nfpFamily_eq_sup theorem foldr_le_nfpFamily (f : ΞΉ β†’ Ordinal β†’ Ordinal) (a l) : List.foldr f a l ≀ nfpFamily.{u, v} f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_family Ordinal.foldr_le_nfpFamily theorem le_nfpFamily (f : ΞΉ β†’ Ordinal β†’ Ordinal) (a) : a ≀ nfpFamily f a := le_sup _ [] #align ordinal.le_nfp_family Ordinal.le_nfpFamily theorem lt_nfpFamily {a b} : a < nfpFamily.{u, v} f b ↔ βˆƒ l, a < List.foldr f b l := lt_sup.{u, v} #align ordinal.lt_nfp_family Ordinal.lt_nfpFamily theorem nfpFamily_le_iff {a b} : nfpFamily.{u, v} f a ≀ b ↔ βˆ€ l, List.foldr f a l ≀ b := sup_le_iff #align ordinal.nfp_family_le_iff Ordinal.nfpFamily_le_iff theorem nfpFamily_le {a b} : (βˆ€ l, List.foldr f a l ≀ b) β†’ nfpFamily.{u, v} f a ≀ b := sup_le.{u, v} #align ordinal.nfp_family_le Ordinal.nfpFamily_le theorem nfpFamily_monotone (hf : βˆ€ i, Monotone (f i)) : Monotone (nfpFamily.{u, v} f) := fun _ _ h => sup_le.{u, v} fun l => (List.foldr_monotone hf l h).trans (le_sup.{u, v} _ l) #align ordinal.nfp_family_monotone Ordinal.nfpFamily_monotone theorem apply_lt_nfpFamily (H : βˆ€ i, IsNormal (f i)) {a b} (hb : b < nfpFamily.{u, v} f a) (i) : f i b < nfpFamily.{u, v} f a := let ⟨l, hl⟩ := lt_nfpFamily.1 hb lt_sup.2 ⟨i::l, (H i).strictMono hl⟩ #align ordinal.apply_lt_nfp_family Ordinal.apply_lt_nfpFamily theorem apply_lt_nfpFamily_iff [Nonempty ΞΉ] (H : βˆ€ i, IsNormal (f i)) {a b} : (βˆ€ i, f i b < nfpFamily.{u, v} f a) ↔ b < nfpFamily.{u, v} f a := ⟨fun h => lt_nfpFamily.2 <| let ⟨l, hl⟩ := lt_sup.1 <| h <| Classical.arbitrary ΞΉ ⟨l, ((H _).self_le b).trans_lt hl⟩, apply_lt_nfpFamily H⟩ #align ordinal.apply_lt_nfp_family_iff Ordinal.apply_lt_nfpFamily_iff theorem nfpFamily_le_apply [Nonempty ΞΉ] (H : βˆ€ i, IsNormal (f i)) {a b} : (βˆƒ i, nfpFamily.{u, v} f a ≀ f i b) ↔ nfpFamily.{u, v} f a ≀ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpFamily_iff H #align ordinal.nfp_family_le_apply Ordinal.nfpFamily_le_apply theorem nfpFamily_le_fp (H : βˆ€ i, Monotone (f i)) {a b} (ab : a ≀ b) (h : βˆ€ i, f i b ≀ b) : nfpFamily.{u, v} f a ≀ b := sup_le fun l => by by_cases hΞΉ : IsEmpty ΞΉ Β· rwa [Unique.eq_default l] Β· induction' l with i l IH generalizing a Β· exact ab exact (H i (IH ab)).trans (h i) #align ordinal.nfp_family_le_fp Ordinal.nfpFamily_le_fp theorem nfpFamily_fp {i} (H : IsNormal (f i)) (a) : f i (nfpFamily.{u, v} f a) = nfpFamily.{u, v} f a := by unfold nfpFamily rw [@IsNormal.sup.{u, v, v} _ H _ _ ⟨[]⟩] apply le_antisymm <;> refine Ordinal.sup_le fun l => ?_ Β· exact le_sup _ (i::l) Β· exact (H.self_le _).trans (le_sup _ _) #align ordinal.nfp_family_fp Ordinal.nfpFamily_fp theorem apply_le_nfpFamily [hΞΉ : Nonempty ΞΉ] {f : ΞΉ β†’ Ordinal β†’ Ordinal} (H : βˆ€ i, IsNormal (f i)) {a b} : (βˆ€ i, f i b ≀ nfpFamily.{u, v} f a) ↔ b ≀ nfpFamily.{u, v} f a := by refine ⟨fun h => ?_, fun h i => ?_⟩ Β· cases' hΞΉ with i exact ((H i).self_le b).trans (h i) rw [← nfpFamily_fp (H i)] exact (H i).monotone h #align ordinal.apply_le_nfp_family Ordinal.apply_le_nfpFamily theorem nfpFamily_eq_self {f : ΞΉ β†’ Ordinal β†’ Ordinal} {a} (h : βˆ€ i, f i a = a) : nfpFamily f a = a := le_antisymm (sup_le fun l => by rw [List.foldr_fixed' h l]) <| le_nfpFamily f a #align ordinal.nfp_family_eq_self Ordinal.nfpFamily_eq_self -- Todo: This is actually a special case of the fact the intersection of club sets is a club set. theorem fp_family_unbounded (H : βˆ€ i, IsNormal (f i)) : (β‹‚ i, Function.fixedPoints (f i)).Unbounded (Β· < Β·) := fun a => ⟨nfpFamily.{u, v} f a, fun s ⟨i, hi⟩ => by rw [← hi, mem_fixedPoints_iff] exact nfpFamily_fp.{u, v} (H i) a, (le_nfpFamily f a).not_lt⟩ #align ordinal.fp_family_unbounded Ordinal.fp_family_unbounded def derivFamily (f : ΞΉ β†’ Ordinal β†’ Ordinal) (o : Ordinal) : Ordinal := limitRecOn o (nfpFamily.{u, v} f 0) (fun _ IH => nfpFamily.{u, v} f (succ IH)) fun a _ => bsup.{max u v, u} a #align ordinal.deriv_family Ordinal.derivFamily @[simp] theorem derivFamily_zero (f : ΞΉ β†’ Ordinal β†’ Ordinal) : derivFamily.{u, v} f 0 = nfpFamily.{u, v} f 0 := limitRecOn_zero _ _ _ #align ordinal.deriv_family_zero Ordinal.derivFamily_zero @[simp] theorem derivFamily_succ (f : ΞΉ β†’ Ordinal β†’ Ordinal) (o) : derivFamily.{u, v} f (succ o) = nfpFamily.{u, v} f (succ (derivFamily.{u, v} f o)) := limitRecOn_succ _ _ _ _ #align ordinal.deriv_family_succ Ordinal.derivFamily_succ theorem derivFamily_limit (f : ΞΉ β†’ Ordinal β†’ Ordinal) {o} : IsLimit o β†’ derivFamily.{u, v} f o = bsup.{max u v, u} o fun a _ => derivFamily.{u, v} f a := limitRecOn_limit _ _ _ _ #align ordinal.deriv_family_limit Ordinal.derivFamily_limit theorem derivFamily_isNormal (f : ΞΉ β†’ Ordinal β†’ Ordinal) : IsNormal (derivFamily f) := ⟨fun o => by rw [derivFamily_succ, ← succ_le_iff]; apply le_nfpFamily, fun o l a => by rw [derivFamily_limit _ l, bsup_le_iff]⟩ #align ordinal.deriv_family_is_normal Ordinal.derivFamily_isNormal theorem derivFamily_fp {i} (H : IsNormal (f i)) (o : Ordinal.{max u v}) : f i (derivFamily.{u, v} f o) = derivFamily.{u, v} f o := by induction' o using limitRecOn with o _ o l IH Β· rw [derivFamily_zero] exact nfpFamily_fp H 0 Β· rw [derivFamily_succ] exact nfpFamily_fp H _ Β· rw [derivFamily_limit _ l, IsNormal.bsup.{max u v, u, max u v} H (fun a _ => derivFamily f a) l.1] refine eq_of_forall_ge_iff fun c => ?_ simp (config := { contextual := true }) only [bsup_le_iff, IH] #align ordinal.deriv_family_fp Ordinal.derivFamily_fp theorem le_iff_derivFamily (H : βˆ€ i, IsNormal (f i)) {a} : (βˆ€ i, f i a ≀ a) ↔ βˆƒ o, derivFamily.{u, v} f o = a := ⟨fun ha => by suffices βˆ€ (o) (_ : a ≀ derivFamily.{u, v} f o), βˆƒ o, derivFamily.{u, v} f o = a from this a ((derivFamily_isNormal _).self_le _) intro o induction' o using limitRecOn with o IH o l IH Β· intro h₁ refine ⟨0, le_antisymm ?_ hβ‚βŸ© rw [derivFamily_zero] exact nfpFamily_le_fp (fun i => (H i).monotone) (Ordinal.zero_le _) ha Β· intro h₁ rcases le_or_lt a (derivFamily.{u, v} f o) with h | h Β· exact IH h refine ⟨succ o, le_antisymm ?_ hβ‚βŸ© rw [derivFamily_succ] exact nfpFamily_le_fp (fun i => (H i).monotone) (succ_le_of_lt h) ha Β· intro h₁ cases' eq_or_lt_of_le h₁ with h h Β· exact ⟨_, h.symm⟩ rw [derivFamily_limit _ l, ← not_le, bsup_le_iff, not_forallβ‚‚] at h exact let ⟨o', h, hl⟩ := h IH o' h (le_of_not_le hl), fun ⟨o, e⟩ i => e β–Έ (derivFamily_fp (H i) _).le⟩ #align ordinal.le_iff_deriv_family Ordinal.le_iff_derivFamily theorem fp_iff_derivFamily (H : βˆ€ i, IsNormal (f i)) {a} : (βˆ€ i, f i a = a) ↔ βˆƒ o, derivFamily.{u, v} f o = a := Iff.trans ⟨fun h i => le_of_eq (h i), fun h i => (H i).le_iff_eq.1 (h i)⟩ (le_iff_derivFamily H) #align ordinal.fp_iff_deriv_family Ordinal.fp_iff_derivFamily theorem derivFamily_eq_enumOrd (H : βˆ€ i, IsNormal (f i)) : derivFamily.{u, v} f = enumOrd (β‹‚ i, Function.fixedPoints (f i)) := by rw [← eq_enumOrd _ (fp_family_unbounded.{u, v} H)] use (derivFamily_isNormal f).strictMono rw [Set.range_eq_iff] refine ⟨?_, fun a ha => ?_⟩ Β· rintro a S ⟨i, hi⟩ rw [← hi] exact derivFamily_fp (H i) a rw [Set.mem_iInter] at ha rwa [← fp_iff_derivFamily H] #align ordinal.deriv_family_eq_enum_ord Ordinal.derivFamily_eq_enumOrd end section variable {o : Ordinal.{u}} {f : βˆ€ b < o, Ordinal.{max u v} β†’ Ordinal.{max u v}} def nfpBFamily (o : Ordinal) (f : βˆ€ b < o, Ordinal β†’ Ordinal) : Ordinal β†’ Ordinal := nfpFamily (familyOfBFamily o f) #align ordinal.nfp_bfamily Ordinal.nfpBFamily theorem nfpBFamily_eq_nfpFamily {o : Ordinal} (f : βˆ€ b < o, Ordinal β†’ Ordinal) : nfpBFamily.{u, v} o f = nfpFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.nfp_bfamily_eq_nfp_family Ordinal.nfpBFamily_eq_nfpFamily theorem foldr_le_nfpBFamily {o : Ordinal} (f : βˆ€ b < o, Ordinal β†’ Ordinal) (a l) : List.foldr (familyOfBFamily o f) a l ≀ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ _ #align ordinal.foldr_le_nfp_bfamily Ordinal.foldr_le_nfpBFamily theorem le_nfpBFamily {o : Ordinal} (f : βˆ€ b < o, Ordinal β†’ Ordinal) (a) : a ≀ nfpBFamily.{u, v} o f a := le_sup.{u, v} _ [] #align ordinal.le_nfp_bfamily Ordinal.le_nfpBFamily theorem lt_nfpBFamily {a b} : a < nfpBFamily.{u, v} o f b ↔ βˆƒ l, a < List.foldr (familyOfBFamily o f) b l := lt_sup.{u, v} #align ordinal.lt_nfp_bfamily Ordinal.lt_nfpBFamily theorem nfpBFamily_le_iff {o : Ordinal} {f : βˆ€ b < o, Ordinal β†’ Ordinal} {a b} : nfpBFamily.{u, v} o f a ≀ b ↔ βˆ€ l, List.foldr (familyOfBFamily o f) a l ≀ b := sup_le_iff.{u, v} #align ordinal.nfp_bfamily_le_iff Ordinal.nfpBFamily_le_iff theorem nfpBFamily_le {o : Ordinal} {f : βˆ€ b < o, Ordinal β†’ Ordinal} {a b} : (βˆ€ l, List.foldr (familyOfBFamily o f) a l ≀ b) β†’ nfpBFamily.{u, v} o f a ≀ b := sup_le.{u, v} #align ordinal.nfp_bfamily_le Ordinal.nfpBFamily_le theorem nfpBFamily_monotone (hf : βˆ€ i hi, Monotone (f i hi)) : Monotone (nfpBFamily.{u, v} o f) := nfpFamily_monotone fun _ => hf _ _ #align ordinal.nfp_bfamily_monotone Ordinal.nfpBFamily_monotone theorem apply_lt_nfpBFamily (H : βˆ€ i hi, IsNormal (f i hi)) {a b} (hb : b < nfpBFamily.{u, v} o f a) (i hi) : f i hi b < nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply apply_lt_nfpFamily (fun _ => H _ _) hb #align ordinal.apply_lt_nfp_bfamily Ordinal.apply_lt_nfpBFamily theorem apply_lt_nfpBFamily_iff (ho : o β‰  0) (H : βˆ€ i hi, IsNormal (f i hi)) {a b} : (βˆ€ i hi, f i hi b < nfpBFamily.{u, v} o f a) ↔ b < nfpBFamily.{u, v} o f a := ⟨fun h => by haveI := out_nonempty_iff_ne_zero.2 ho refine (apply_lt_nfpFamily_iff.{u, v} ?_).1 fun _ => h _ _ exact fun _ => H _ _, apply_lt_nfpBFamily H⟩ #align ordinal.apply_lt_nfp_bfamily_iff Ordinal.apply_lt_nfpBFamily_iff theorem nfpBFamily_le_apply (ho : o β‰  0) (H : βˆ€ i hi, IsNormal (f i hi)) {a b} : (βˆƒ i hi, nfpBFamily.{u, v} o f a ≀ f i hi b) ↔ nfpBFamily.{u, v} o f a ≀ b := by rw [← not_iff_not] push_neg exact apply_lt_nfpBFamily_iff.{u, v} ho H #align ordinal.nfp_bfamily_le_apply Ordinal.nfpBFamily_le_apply theorem nfpBFamily_le_fp (H : βˆ€ i hi, Monotone (f i hi)) {a b} (ab : a ≀ b) (h : βˆ€ i hi, f i hi b ≀ b) : nfpBFamily.{u, v} o f a ≀ b := nfpFamily_le_fp (fun _ => H _ _) ab fun _ => h _ _ #align ordinal.nfp_bfamily_le_fp Ordinal.nfpBFamily_le_fp theorem nfpBFamily_fp {i hi} (H : IsNormal (f i hi)) (a) : f i hi (nfpBFamily.{u, v} o f a) = nfpBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply nfpFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.nfp_bfamily_fp Ordinal.nfpBFamily_fp theorem apply_le_nfpBFamily (ho : o β‰  0) (H : βˆ€ i hi, IsNormal (f i hi)) {a b} : (βˆ€ i hi, f i hi b ≀ nfpBFamily.{u, v} o f a) ↔ b ≀ nfpBFamily.{u, v} o f a := by refine ⟨fun h => ?_, fun h i hi => ?_⟩ Β· have ho' : 0 < o := Ordinal.pos_iff_ne_zero.2 ho exact ((H 0 ho').self_le b).trans (h 0 ho') Β· rw [← nfpBFamily_fp (H i hi)] exact (H i hi).monotone h #align ordinal.apply_le_nfp_bfamily Ordinal.apply_le_nfpBFamily theorem nfpBFamily_eq_self {a} (h : βˆ€ i hi, f i hi a = a) : nfpBFamily.{u, v} o f a = a := nfpFamily_eq_self fun _ => h _ _ #align ordinal.nfp_bfamily_eq_self Ordinal.nfpBFamily_eq_self theorem fp_bfamily_unbounded (H : βˆ€ i hi, IsNormal (f i hi)) : (β‹‚ (i) (hi), Function.fixedPoints (f i hi)).Unbounded (Β· < Β·) := fun a => ⟨nfpBFamily.{u, v} _ f a, by rw [Set.mem_iInterβ‚‚] exact fun i hi => nfpBFamily_fp (H i hi) _, (le_nfpBFamily f a).not_lt⟩ #align ordinal.fp_bfamily_unbounded Ordinal.fp_bfamily_unbounded def derivBFamily (o : Ordinal) (f : βˆ€ b < o, Ordinal β†’ Ordinal) : Ordinal β†’ Ordinal := derivFamily (familyOfBFamily o f) #align ordinal.deriv_bfamily Ordinal.derivBFamily theorem derivBFamily_eq_derivFamily {o : Ordinal} (f : βˆ€ b < o, Ordinal β†’ Ordinal) : derivBFamily.{u, v} o f = derivFamily.{u, v} (familyOfBFamily o f) := rfl #align ordinal.deriv_bfamily_eq_deriv_family Ordinal.derivBFamily_eq_derivFamily theorem derivBFamily_isNormal {o : Ordinal} (f : βˆ€ b < o, Ordinal β†’ Ordinal) : IsNormal (derivBFamily o f) := derivFamily_isNormal _ #align ordinal.deriv_bfamily_is_normal Ordinal.derivBFamily_isNormal theorem derivBFamily_fp {i hi} (H : IsNormal (f i hi)) (a : Ordinal) : f i hi (derivBFamily.{u, v} o f a) = derivBFamily.{u, v} o f a := by rw [← familyOfBFamily_enum o f] apply derivFamily_fp rw [familyOfBFamily_enum] exact H #align ordinal.deriv_bfamily_fp Ordinal.derivBFamily_fp theorem le_iff_derivBFamily (H : βˆ€ i hi, IsNormal (f i hi)) {a} : (βˆ€ i hi, f i hi a ≀ a) ↔ βˆƒ b, derivBFamily.{u, v} o f b = a := by unfold derivBFamily rw [← le_iff_derivFamily] Β· refine ⟨fun h i => h _ _, fun h i hi => ?_⟩ rw [← familyOfBFamily_enum o f] apply h Β· exact fun _ => H _ _ #align ordinal.le_iff_deriv_bfamily Ordinal.le_iff_derivBFamily
Mathlib/SetTheory/Ordinal/FixedPoint.lean
384
389
theorem fp_iff_derivBFamily (H : βˆ€ i hi, IsNormal (f i hi)) {a} : (βˆ€ i hi, f i hi a = a) ↔ βˆƒ b, derivBFamily.{u, v} o f b = a := by
rw [← le_iff_derivBFamily H] refine ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => ?_⟩ rw [← (H i hi).le_iff_eq] exact h i hi
import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.Data.Set.MemPartition import Mathlib.Order.Filter.CountableSeparatingOn open Set MeasureTheory namespace MeasurableSpace variable {Ξ± Ξ² : Type*} class CountablyGenerated (Ξ± : Type*) [m : MeasurableSpace Ξ±] : Prop where isCountablyGenerated : βˆƒ b : Set (Set Ξ±), b.Countable ∧ m = generateFrom b #align measurable_space.countably_generated MeasurableSpace.CountablyGenerated def countableGeneratingSet (Ξ± : Type*) [MeasurableSpace Ξ±] [h : CountablyGenerated Ξ±] : Set (Set Ξ±) := insert βˆ… h.isCountablyGenerated.choose lemma countable_countableGeneratingSet [MeasurableSpace Ξ±] [h : CountablyGenerated Ξ±] : Set.Countable (countableGeneratingSet Ξ±) := Countable.insert _ h.isCountablyGenerated.choose_spec.1 lemma generateFrom_countableGeneratingSet [m : MeasurableSpace Ξ±] [h : CountablyGenerated Ξ±] : generateFrom (countableGeneratingSet Ξ±) = m := (generateFrom_insert_empty _).trans <| h.isCountablyGenerated.choose_spec.2.symm lemma empty_mem_countableGeneratingSet [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] : βˆ… ∈ countableGeneratingSet Ξ± := mem_insert _ _ lemma nonempty_countableGeneratingSet [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] : Set.Nonempty (countableGeneratingSet Ξ±) := βŸ¨βˆ…, mem_insert _ _⟩ lemma measurableSet_countableGeneratingSet [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] {s : Set Ξ±} (hs : s ∈ countableGeneratingSet Ξ±) : MeasurableSet s := by rw [← generateFrom_countableGeneratingSet (Ξ± := Ξ±)] exact measurableSet_generateFrom hs def natGeneratingSequence (Ξ± : Type*) [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] : β„• β†’ (Set Ξ±) := enumerateCountable (countable_countableGeneratingSet (Ξ± := Ξ±)) βˆ… lemma generateFrom_natGeneratingSequence (Ξ± : Type*) [m : MeasurableSpace Ξ±] [CountablyGenerated Ξ±] : generateFrom (range (natGeneratingSequence _)) = m := by rw [natGeneratingSequence, range_enumerateCountable_of_mem _ empty_mem_countableGeneratingSet, generateFrom_countableGeneratingSet] lemma measurableSet_natGeneratingSequence [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] (n : β„•) : MeasurableSet (natGeneratingSequence Ξ± n) := measurableSet_countableGeneratingSet $ Set.enumerateCountable_mem _ empty_mem_countableGeneratingSet n theorem CountablyGenerated.comap [m : MeasurableSpace Ξ²] [h : CountablyGenerated Ξ²] (f : Ξ± β†’ Ξ²) : @CountablyGenerated Ξ± (.comap f m) := by rcases h with ⟨⟨b, hbc, rfl⟩⟩ rw [comap_generateFrom] letI := generateFrom (preimage f '' b) exact ⟨_, hbc.image _, rfl⟩ theorem CountablyGenerated.sup {m₁ mβ‚‚ : MeasurableSpace Ξ²} (h₁ : @CountablyGenerated Ξ² m₁) (hβ‚‚ : @CountablyGenerated Ξ² mβ‚‚) : @CountablyGenerated Ξ² (m₁ βŠ” mβ‚‚) := by rcases h₁ with ⟨⟨b₁, hb₁c, rfl⟩⟩ rcases hβ‚‚ with ⟨⟨bβ‚‚, hbβ‚‚c, rfl⟩⟩ exact @mk _ (_ βŠ” _) ⟨_, hb₁c.union hbβ‚‚c, generateFrom_sup_generateFrom⟩ instance (priority := 100) [MeasurableSpace Ξ±] [Countable Ξ±] : CountablyGenerated Ξ± where isCountablyGenerated := by refine βŸ¨β‹ƒ y, {measurableAtom y}, countable_iUnion (fun i ↦ countable_singleton _), ?_⟩ refine le_antisymm ?_ (generateFrom_le (by simp [MeasurableSet.measurableAtom_of_countable])) intro s hs have : s = ⋃ y ∈ s, measurableAtom y := by apply Subset.antisymm Β· intro x hx simpa using ⟨x, hx, by simp⟩ Β· simp only [iUnion_subset_iff] intro x hx exact measurableAtom_subset hs hx rw [this] apply MeasurableSet.biUnion (to_countable s) (fun x _hx ↦ ?_) apply measurableSet_generateFrom simp instance [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] {p : Ξ± β†’ Prop} : CountablyGenerated { x // p x } := .comap _ instance [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] [MeasurableSpace Ξ²] [CountablyGenerated Ξ²] : CountablyGenerated (Ξ± Γ— Ξ²) := .sup (.comap Prod.fst) (.comap Prod.snd) section SeparatesPoints class SeparatesPoints (Ξ± : Type*) [m : MeasurableSpace Ξ±] : Prop where separates : βˆ€ x y : Ξ±, (βˆ€ s, MeasurableSet s β†’ (x ∈ s β†’ y ∈ s)) β†’ x = y theorem separatesPoints_def [MeasurableSpace Ξ±] [hs : SeparatesPoints Ξ±] {x y : Ξ±} (h : βˆ€ s, MeasurableSet s β†’ (x ∈ s β†’ y ∈ s)) : x = y := hs.separates _ _ h theorem exists_measurableSet_of_ne [MeasurableSpace Ξ±] [SeparatesPoints Ξ±] {x y : Ξ±} (h : x β‰  y) : βˆƒ s, MeasurableSet s ∧ x ∈ s ∧ y βˆ‰ s := by contrapose! h exact separatesPoints_def h theorem separatesPoints_iff [MeasurableSpace Ξ±] : SeparatesPoints Ξ± ↔ βˆ€ x y : Ξ±, (βˆ€ s, MeasurableSet s β†’ (x ∈ s ↔ y ∈ s)) β†’ x = y := ⟨fun h ↦ fun _ _ hxy ↦ h.separates _ _ fun _ hs xs ↦ (hxy _ hs).mp xs, fun h ↦ ⟨fun _ _ hxy ↦ h _ _ fun _ hs ↦ ⟨fun xs ↦ hxy _ hs xs, not_imp_not.mp fun xs ↦ hxy _ hs.compl xs⟩⟩⟩ theorem separating_of_generateFrom (S : Set (Set Ξ±)) [h : @SeparatesPoints Ξ± (generateFrom S)] : βˆ€ x y : Ξ±, (βˆ€ s ∈ S, x ∈ s ↔ y ∈ s) β†’ x = y := by letI := generateFrom S intros x y hxy rw [← forall_generateFrom_mem_iff_mem_iff] at hxy exact separatesPoints_def $ fun _ hs ↦ (hxy _ hs).mp theorem SeparatesPoints.mono {m m' : MeasurableSpace Ξ±} [hsep : @SeparatesPoints _ m] (h : m ≀ m') : @SeparatesPoints _ m' := @SeparatesPoints.mk _ m' fun _ _ hxy ↦ @SeparatesPoints.separates _ m hsep _ _ fun _ hs ↦ hxy _ (h _ hs) class CountablySeparated (Ξ± : Type*) [MeasurableSpace Ξ±] : Prop where countably_separated : HasCountableSeparatingOn Ξ± MeasurableSet univ instance countablySeparated_of_hasCountableSeparatingOn [MeasurableSpace Ξ±] [h : HasCountableSeparatingOn Ξ± MeasurableSet univ] : CountablySeparated Ξ± := ⟨h⟩ instance hasCountableSeparatingOn_of_countablySeparated [MeasurableSpace Ξ±] [h : CountablySeparated Ξ±] : HasCountableSeparatingOn Ξ± MeasurableSet univ := h.countably_separated theorem countablySeparated_def [MeasurableSpace Ξ±] : CountablySeparated Ξ± ↔ HasCountableSeparatingOn Ξ± MeasurableSet univ := ⟨fun h ↦ h.countably_separated, fun h ↦ ⟨h⟩⟩ theorem CountablySeparated.mono {m m' : MeasurableSpace Ξ±} [hsep : @CountablySeparated _ m] (h : m ≀ m') : @CountablySeparated _ m' := by simp_rw [countablySeparated_def] at * rcases hsep with ⟨S, Sct, Smeas, hS⟩ use S, Sct, (fun s hs ↦ h _ <| Smeas _ hs), hS theorem CountablySeparated.subtype_iff [MeasurableSpace Ξ±] {s : Set Ξ±} : CountablySeparated s ↔ HasCountableSeparatingOn Ξ± MeasurableSet s := by rw [countablySeparated_def] exact HasCountableSeparatingOn.subtype_iff instance (priority := 100) Subtype.separatesPoints [MeasurableSpace Ξ±] [h : SeparatesPoints Ξ±] {s : Set Ξ±} : SeparatesPoints s := ⟨fun _ _ hxy ↦ Subtype.val_injective $ h.1 _ _ fun _ ht ↦ hxy _ $ measurable_subtype_coe ht⟩ instance (priority := 100) Subtype.countablySeparated [MeasurableSpace Ξ±] [h : CountablySeparated Ξ±] {s : Set Ξ±} : CountablySeparated s := by rw [CountablySeparated.subtype_iff] exact h.countably_separated.mono (fun s ↦ id) $ subset_univ _ instance (priority := 100) separatesPoints_of_measurableSingletonClass [MeasurableSpace Ξ±] [MeasurableSingletonClass Ξ±] : SeparatesPoints Ξ± := by refine ⟨fun x y h ↦ ?_⟩ specialize h _ (MeasurableSet.singleton x) simp_rw [mem_singleton_iff, forall_true_left] at h exact h.symm instance hasCountableSeparatingOn_of_countablySeparated_subtype [MeasurableSpace Ξ±] {s : Set Ξ±} [h : CountablySeparated s] : HasCountableSeparatingOn _ MeasurableSet s := CountablySeparated.subtype_iff.mp h instance countablySeparated_subtype_of_hasCountableSeparatingOn [MeasurableSpace Ξ±] {s : Set Ξ±} [h : HasCountableSeparatingOn _ MeasurableSet s] : CountablySeparated s := CountablySeparated.subtype_iff.mpr h instance countablySeparated_of_separatesPoints [MeasurableSpace Ξ±] [h : CountablyGenerated Ξ±] [SeparatesPoints Ξ±] : CountablySeparated Ξ± := by rcases h with ⟨b, hbc, hb⟩ refine ⟨⟨b, hbc, fun t ht ↦ hb.symm β–Έ .basic t ht, ?_⟩⟩ rw [hb] at β€ΉSeparatesPoints _β€Ί convert separating_of_generateFrom b simp variable (Ξ±) theorem exists_countablyGenerated_le_of_countablySeparated [m : MeasurableSpace Ξ±] [h : CountablySeparated Ξ±] : βˆƒ m' : MeasurableSpace Ξ±, @CountablyGenerated _ m' ∧ @SeparatesPoints _ m' ∧ m' ≀ m := by rcases h with ⟨b, bct, hbm, hb⟩ refine ⟨generateFrom b, ?_, ?_, generateFrom_le hbm⟩ Β· use b rw [@separatesPoints_iff] exact fun x y hxy ↦ hb _ trivial _ trivial fun _ hs ↦ hxy _ $ measurableSet_generateFrom hs open scoped Classical open Function noncomputable def mapNatBool [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] (x : Ξ±) (n : β„•) : Bool := x ∈ natGeneratingSequence Ξ± n
Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean
251
257
theorem measurable_mapNatBool [MeasurableSpace Ξ±] [CountablyGenerated Ξ±] : Measurable (mapNatBool Ξ±) := by
rw [measurable_pi_iff] refine fun n ↦ measurable_to_bool ?_ simp only [preimage, mem_singleton_iff, mapNatBool, Bool.decide_iff, setOf_mem_eq] apply measurableSet_natGeneratingSequence
import Mathlib.Data.Fintype.Option import Mathlib.Topology.Separation import Mathlib.Topology.Sets.Opens #align_import topology.alexandroff from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" open Set Filter Topology variable {X : Type*} def OnePoint (X : Type*) := Option X #align alexandroff OnePoint instance [Repr X] : Repr (OnePoint X) := ⟨fun o _ => match o with | none => "∞" | some a => "↑" ++ repr a⟩ namespace OnePoint @[match_pattern] def infty : OnePoint X := none #align alexandroff.infty OnePoint.infty @[inherit_doc] scoped notation "∞" => OnePoint.infty @[coe, match_pattern] def some : X β†’ OnePoint X := Option.some instance : CoeTC X (OnePoint X) := ⟨some⟩ instance : Inhabited (OnePoint X) := ⟨∞⟩ instance [Fintype X] : Fintype (OnePoint X) := inferInstanceAs (Fintype (Option X)) instance infinite [Infinite X] : Infinite (OnePoint X) := inferInstanceAs (Infinite (Option X)) #align alexandroff.infinite OnePoint.infinite theorem coe_injective : Function.Injective ((↑) : X β†’ OnePoint X) := Option.some_injective X #align alexandroff.coe_injective OnePoint.coe_injective @[norm_cast] theorem coe_eq_coe {x y : X} : (x : OnePoint X) = y ↔ x = y := coe_injective.eq_iff #align alexandroff.coe_eq_coe OnePoint.coe_eq_coe @[simp] theorem coe_ne_infty (x : X) : (x : OnePoint X) β‰  ∞ := nofun #align alexandroff.coe_ne_infty OnePoint.coe_ne_infty @[simp] theorem infty_ne_coe (x : X) : ∞ β‰  (x : OnePoint X) := nofun #align alexandroff.infty_ne_coe OnePoint.infty_ne_coe @[elab_as_elim] protected def rec {C : OnePoint X β†’ Sort*} (h₁ : C ∞) (hβ‚‚ : βˆ€ x : X, C x) : βˆ€ z : OnePoint X, C z | ∞ => h₁ | (x : X) => hβ‚‚ x #align alexandroff.rec OnePoint.rec theorem isCompl_range_coe_infty : IsCompl (range ((↑) : X β†’ OnePoint X)) {∞} := isCompl_range_some_none X #align alexandroff.is_compl_range_coe_infty OnePoint.isCompl_range_coe_infty -- Porting note: moved @[simp] to a new lemma theorem range_coe_union_infty : range ((↑) : X β†’ OnePoint X) βˆͺ {∞} = univ := range_some_union_none X #align alexandroff.range_coe_union_infty OnePoint.range_coe_union_infty @[simp] theorem insert_infty_range_coe : insert ∞ (range (@some X)) = univ := insert_none_range_some _ @[simp] theorem range_coe_inter_infty : range ((↑) : X β†’ OnePoint X) ∩ {∞} = βˆ… := range_some_inter_none X #align alexandroff.range_coe_inter_infty OnePoint.range_coe_inter_infty @[simp] theorem compl_range_coe : (range ((↑) : X β†’ OnePoint X))ᢜ = {∞} := compl_range_some X #align alexandroff.compl_range_coe OnePoint.compl_range_coe theorem compl_infty : ({∞}ᢜ : Set (OnePoint X)) = range ((↑) : X β†’ OnePoint X) := (@isCompl_range_coe_infty X).symm.compl_eq #align alexandroff.compl_infty OnePoint.compl_infty theorem compl_image_coe (s : Set X) : ((↑) '' s : Set (OnePoint X))ᢜ = (↑) '' sᢜ βˆͺ {∞} := by rw [coe_injective.compl_image_eq, compl_range_coe] #align alexandroff.compl_image_coe OnePoint.compl_image_coe theorem ne_infty_iff_exists {x : OnePoint X} : x β‰  ∞ ↔ βˆƒ y : X, (y : OnePoint X) = x := by induction x using OnePoint.rec <;> simp #align alexandroff.ne_infty_iff_exists OnePoint.ne_infty_iff_exists instance canLift : CanLift (OnePoint X) X (↑) fun x => x β‰  ∞ := WithTop.canLift #align alexandroff.can_lift OnePoint.canLift theorem not_mem_range_coe_iff {x : OnePoint X} : x βˆ‰ range some ↔ x = ∞ := by rw [← mem_compl_iff, compl_range_coe, mem_singleton_iff] #align alexandroff.not_mem_range_coe_iff OnePoint.not_mem_range_coe_iff theorem infty_not_mem_range_coe : ∞ βˆ‰ range ((↑) : X β†’ OnePoint X) := not_mem_range_coe_iff.2 rfl #align alexandroff.infty_not_mem_range_coe OnePoint.infty_not_mem_range_coe theorem infty_not_mem_image_coe {s : Set X} : ∞ βˆ‰ ((↑) : X β†’ OnePoint X) '' s := not_mem_subset (image_subset_range _ _) infty_not_mem_range_coe #align alexandroff.infty_not_mem_image_coe OnePoint.infty_not_mem_image_coe @[simp] theorem coe_preimage_infty : ((↑) : X β†’ OnePoint X) ⁻¹' {∞} = βˆ… := by ext simp #align alexandroff.coe_preimage_infty OnePoint.coe_preimage_infty variable [TopologicalSpace X] instance : TopologicalSpace (OnePoint X) where IsOpen s := (∞ ∈ s β†’ IsCompact (((↑) : X β†’ OnePoint X) ⁻¹' s)ᢜ) ∧ IsOpen (((↑) : X β†’ OnePoint X) ⁻¹' s) isOpen_univ := by simp isOpen_inter s t := by rintro ⟨hms, hs⟩ ⟨hmt, ht⟩ refine ⟨?_, hs.inter ht⟩ rintro ⟨hms', hmt'⟩ simpa [compl_inter] using (hms hms').union (hmt hmt') isOpen_sUnion S ho := by suffices IsOpen ((↑) ⁻¹' ⋃₀ S : Set X) by refine ⟨?_, this⟩ rintro ⟨s, hsS : s ∈ S, hs : ∞ ∈ s⟩ refine IsCompact.of_isClosed_subset ((ho s hsS).1 hs) this.isClosed_compl ?_ exact compl_subset_compl.mpr (preimage_mono <| subset_sUnion_of_mem hsS) rw [preimage_sUnion] exact isOpen_biUnion fun s hs => (ho s hs).2 variable {s : Set (OnePoint X)} {t : Set X} theorem isOpen_def : IsOpen s ↔ (∞ ∈ s β†’ IsCompact ((↑) ⁻¹' s : Set X)ᢜ) ∧ IsOpen ((↑) ⁻¹' s : Set X) := Iff.rfl #align alexandroff.is_open_def OnePoint.isOpen_def theorem isOpen_iff_of_mem' (h : ∞ ∈ s) : IsOpen s ↔ IsCompact ((↑) ⁻¹' s : Set X)ᢜ ∧ IsOpen ((↑) ⁻¹' s : Set X) := by simp [isOpen_def, h] #align alexandroff.is_open_iff_of_mem' OnePoint.isOpen_iff_of_mem' theorem isOpen_iff_of_mem (h : ∞ ∈ s) : IsOpen s ↔ IsClosed ((↑) ⁻¹' s : Set X)ᢜ ∧ IsCompact ((↑) ⁻¹' s : Set X)ᢜ := by simp only [isOpen_iff_of_mem' h, isClosed_compl_iff, and_comm] #align alexandroff.is_open_iff_of_mem OnePoint.isOpen_iff_of_mem theorem isOpen_iff_of_not_mem (h : ∞ βˆ‰ s) : IsOpen s ↔ IsOpen ((↑) ⁻¹' s : Set X) := by simp [isOpen_def, h] #align alexandroff.is_open_iff_of_not_mem OnePoint.isOpen_iff_of_not_mem theorem isClosed_iff_of_mem (h : ∞ ∈ s) : IsClosed s ↔ IsClosed ((↑) ⁻¹' s : Set X) := by have : ∞ βˆ‰ sᢜ := fun H => H h rw [← isOpen_compl_iff, isOpen_iff_of_not_mem this, ← isOpen_compl_iff, preimage_compl] #align alexandroff.is_closed_iff_of_mem OnePoint.isClosed_iff_of_mem theorem isClosed_iff_of_not_mem (h : ∞ βˆ‰ s) : IsClosed s ↔ IsClosed ((↑) ⁻¹' s : Set X) ∧ IsCompact ((↑) ⁻¹' s : Set X) := by rw [← isOpen_compl_iff, isOpen_iff_of_mem (mem_compl h), ← preimage_compl, compl_compl] #align alexandroff.is_closed_iff_of_not_mem OnePoint.isClosed_iff_of_not_mem @[simp] theorem isOpen_image_coe {s : Set X} : IsOpen ((↑) '' s : Set (OnePoint X)) ↔ IsOpen s := by rw [isOpen_iff_of_not_mem infty_not_mem_image_coe, preimage_image_eq _ coe_injective] #align alexandroff.is_open_image_coe OnePoint.isOpen_image_coe theorem isOpen_compl_image_coe {s : Set X} : IsOpen ((↑) '' s : Set (OnePoint X))ᢜ ↔ IsClosed s ∧ IsCompact s := by rw [isOpen_iff_of_mem, ← preimage_compl, compl_compl, preimage_image_eq _ coe_injective] exact infty_not_mem_image_coe #align alexandroff.is_open_compl_image_coe OnePoint.isOpen_compl_image_coe @[simp] theorem isClosed_image_coe {s : Set X} : IsClosed ((↑) '' s : Set (OnePoint X)) ↔ IsClosed s ∧ IsCompact s := by rw [← isOpen_compl_iff, isOpen_compl_image_coe] #align alexandroff.is_closed_image_coe OnePoint.isClosed_image_coe def opensOfCompl (s : Set X) (h₁ : IsClosed s) (hβ‚‚ : IsCompact s) : TopologicalSpace.Opens (OnePoint X) := ⟨((↑) '' s)ᢜ, isOpen_compl_image_coe.2 ⟨h₁, hβ‚‚βŸ©βŸ© #align alexandroff.opens_of_compl OnePoint.opensOfCompl theorem infty_mem_opensOfCompl {s : Set X} (h₁ : IsClosed s) (hβ‚‚ : IsCompact s) : ∞ ∈ opensOfCompl s h₁ hβ‚‚ := mem_compl infty_not_mem_image_coe #align alexandroff.infty_mem_opens_of_compl OnePoint.infty_mem_opensOfCompl @[continuity] theorem continuous_coe : Continuous ((↑) : X β†’ OnePoint X) := continuous_def.mpr fun _s hs => hs.right #align alexandroff.continuous_coe OnePoint.continuous_coe theorem isOpenMap_coe : IsOpenMap ((↑) : X β†’ OnePoint X) := fun _ => isOpen_image_coe.2 #align alexandroff.is_open_map_coe OnePoint.isOpenMap_coe theorem openEmbedding_coe : OpenEmbedding ((↑) : X β†’ OnePoint X) := openEmbedding_of_continuous_injective_open continuous_coe coe_injective isOpenMap_coe #align alexandroff.open_embedding_coe OnePoint.openEmbedding_coe theorem isOpen_range_coe : IsOpen (range ((↑) : X β†’ OnePoint X)) := openEmbedding_coe.isOpen_range #align alexandroff.is_open_range_coe OnePoint.isOpen_range_coe theorem isClosed_infty : IsClosed ({∞} : Set (OnePoint X)) := by rw [← compl_range_coe, isClosed_compl_iff] exact isOpen_range_coe #align alexandroff.is_closed_infty OnePoint.isClosed_infty theorem nhds_coe_eq (x : X) : 𝓝 ↑x = map ((↑) : X β†’ OnePoint X) (𝓝 x) := (openEmbedding_coe.map_nhds_eq x).symm #align alexandroff.nhds_coe_eq OnePoint.nhds_coe_eq theorem nhdsWithin_coe_image (s : Set X) (x : X) : 𝓝[(↑) '' s] (x : OnePoint X) = map (↑) (𝓝[s] x) := (openEmbedding_coe.toEmbedding.map_nhdsWithin_eq _ _).symm #align alexandroff.nhds_within_coe_image OnePoint.nhdsWithin_coe_image theorem nhdsWithin_coe (s : Set (OnePoint X)) (x : X) : 𝓝[s] ↑x = map (↑) (𝓝[(↑) ⁻¹' s] x) := (openEmbedding_coe.map_nhdsWithin_preimage_eq _ _).symm #align alexandroff.nhds_within_coe OnePoint.nhdsWithin_coe theorem comap_coe_nhds (x : X) : comap ((↑) : X β†’ OnePoint X) (𝓝 x) = 𝓝 x := (openEmbedding_coe.toInducing.nhds_eq_comap x).symm #align alexandroff.comap_coe_nhds OnePoint.comap_coe_nhds instance nhdsWithin_compl_coe_neBot (x : X) [h : NeBot (𝓝[β‰ ] x)] : NeBot (𝓝[β‰ ] (x : OnePoint X)) := by simpa [nhdsWithin_coe, preimage, coe_eq_coe] using h.map some #align alexandroff.nhds_within_compl_coe_ne_bot OnePoint.nhdsWithin_compl_coe_neBot
Mathlib/Topology/Compactification/OnePoint.lean
308
315
theorem nhdsWithin_compl_infty_eq : 𝓝[β‰ ] (∞ : OnePoint X) = map (↑) (coclosedCompact X) := by
refine (nhdsWithin_basis_open ∞ _).ext (hasBasis_coclosedCompact.map _) ?_ ?_ Β· rintro s ⟨hs, hso⟩ refine ⟨_, (isOpen_iff_of_mem hs).mp hso, ?_⟩ simp [Subset.rfl] Β· rintro s ⟨h₁, hβ‚‚βŸ© refine ⟨_, ⟨mem_compl infty_not_mem_image_coe, isOpen_compl_image_coe.2 ⟨h₁, hβ‚‚βŸ©βŸ©, ?_⟩ simp [compl_image_coe, ← diff_eq, subset_preimage_image]
import Mathlib.Probability.ProbabilityMassFunction.Monad #align_import probability.probability_mass_function.constructions from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d" universe u namespace PMF noncomputable section variable {Ξ± Ξ² Ξ³ : Type*} open scoped Classical open NNReal ENNReal section Map def map (f : Ξ± β†’ Ξ²) (p : PMF Ξ±) : PMF Ξ² := bind p (pure ∘ f) #align pmf.map PMF.map variable (f : Ξ± β†’ Ξ²) (p : PMF Ξ±) (b : Ξ²) theorem monad_map_eq_map {Ξ± Ξ² : Type u} (f : Ξ± β†’ Ξ²) (p : PMF Ξ±) : f <$> p = p.map f := rfl #align pmf.monad_map_eq_map PMF.monad_map_eq_map @[simp] theorem map_apply : (map f p) b = βˆ‘' a, if b = f a then p a else 0 := by simp [map] #align pmf.map_apply PMF.map_apply @[simp] theorem support_map : (map f p).support = f '' p.support := Set.ext fun b => by simp [map, @eq_comm Ξ² b] #align pmf.support_map PMF.support_map theorem mem_support_map_iff : b ∈ (map f p).support ↔ βˆƒ a ∈ p.support, f a = b := by simp #align pmf.mem_support_map_iff PMF.mem_support_map_iff theorem bind_pure_comp : bind p (pure ∘ f) = map f p := rfl #align pmf.bind_pure_comp PMF.bind_pure_comp theorem map_id : map id p = p := bind_pure _ #align pmf.map_id PMF.map_id theorem map_comp (g : Ξ² β†’ Ξ³) : (p.map f).map g = p.map (g ∘ f) := by simp [map, Function.comp] #align pmf.map_comp PMF.map_comp theorem pure_map (a : Ξ±) : (pure a).map f = pure (f a) := pure_bind _ _ #align pmf.pure_map PMF.pure_map theorem map_bind (q : Ξ± β†’ PMF Ξ²) (f : Ξ² β†’ Ξ³) : (p.bind q).map f = p.bind fun a => (q a).map f := bind_bind _ _ _ #align pmf.map_bind PMF.map_bind @[simp] theorem bind_map (p : PMF Ξ±) (f : Ξ± β†’ Ξ²) (q : Ξ² β†’ PMF Ξ³) : (p.map f).bind q = p.bind (q ∘ f) := (bind_bind _ _ _).trans (congr_arg _ (funext fun _ => pure_bind _ _)) #align pmf.bind_map PMF.bind_map @[simp] theorem map_const : p.map (Function.const Ξ± b) = pure b := by simp only [map, Function.comp, bind_const, Function.const] #align pmf.map_const PMF.map_const instance : LawfulFunctor PMF where map_const := rfl id_map := bind_pure comp_map _ _ _ := (map_comp _ _ _).symm instance : LawfulMonad PMF := LawfulMonad.mk' (bind_pure_comp := fun f x => rfl) (id_map := id_map) (pure_bind := pure_bind) (bind_assoc := bind_bind) section OfFinset def ofFinset (f : Ξ± β†’ ℝβ‰₯0∞) (s : Finset Ξ±) (h : βˆ‘ a ∈ s, f a = 1) (h' : βˆ€ (a) (_ : a βˆ‰ s), f a = 0) : PMF Ξ± := ⟨f, h β–Έ hasSum_sum_of_ne_finset_zero h'⟩ #align pmf.of_finset PMF.ofFinset variable {f : Ξ± β†’ ℝβ‰₯0∞} {s : Finset Ξ±} (h : βˆ‘ a ∈ s, f a = 1) (h' : βˆ€ (a) (_ : a βˆ‰ s), f a = 0) @[simp] theorem ofFinset_apply (a : Ξ±) : ofFinset f s h h' a = f a := rfl #align pmf.of_finset_apply PMF.ofFinset_apply @[simp] theorem support_ofFinset : (ofFinset f s h h').support = ↑s ∩ Function.support f := Set.ext fun a => by simpa [mem_support_iff] using mt (h' a) #align pmf.support_of_finset PMF.support_ofFinset
Mathlib/Probability/ProbabilityMassFunction/Constructions.lean
172
173
theorem mem_support_ofFinset_iff (a : Ξ±) : a ∈ (ofFinset f s h h').support ↔ a ∈ s ∧ f a β‰  0 := by
simp
import Mathlib.MeasureTheory.Measure.Content import Mathlib.MeasureTheory.Group.Prod import Mathlib.Topology.Algebra.Group.Compact #align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Set Inv Function TopologicalSpace MeasurableSpace open scoped NNReal Classical ENNReal Pointwise Topology namespace MeasureTheory namespace Measure section Group variable {G : Type*} [Group G] namespace haar -- Porting note: Even in `noncomputable section`, a definition with `to_additive` require -- `noncomputable` to generate an additive definition. -- Please refer to leanprover/lean4#2077. @[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"] noncomputable def index (K V : Set G) : β„• := sInf <| Finset.card '' { t : Finset G | K βŠ† ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } #align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index #align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex @[to_additive addIndex_empty] theorem index_empty {V : Set G} : index βˆ… V = 0 := by simp only [index, Nat.sInf_eq_zero]; left; use βˆ… simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff] #align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty #align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty variable [TopologicalSpace G] @[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"] noncomputable def prehaar (Kβ‚€ U : Set G) (K : Compacts G) : ℝ := (index (K : Set G) U : ℝ) / index Kβ‚€ U #align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar #align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar @[to_additive] theorem prehaar_empty (Kβ‚€ : PositiveCompacts G) {U : Set G} : prehaar (Kβ‚€ : Set G) U βŠ₯ = 0 := by rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div] #align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty #align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty @[to_additive] theorem prehaar_nonneg (Kβ‚€ : PositiveCompacts G) {U : Set G} (K : Compacts G) : 0 ≀ prehaar (Kβ‚€ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le #align measure_theory.measure.haar.prehaar_nonneg MeasureTheory.Measure.haar.prehaar_nonneg #align measure_theory.measure.haar.add_prehaar_nonneg MeasureTheory.Measure.haar.addPrehaar_nonneg @[to_additive "additive version of `MeasureTheory.Measure.haar.haarProduct`"] def haarProduct (Kβ‚€ : Set G) : Set (Compacts G β†’ ℝ) := pi univ fun K => Icc 0 <| index (K : Set G) Kβ‚€ #align measure_theory.measure.haar.haar_product MeasureTheory.Measure.haar.haarProduct #align measure_theory.measure.haar.add_haar_product MeasureTheory.Measure.haar.addHaarProduct @[to_additive (attr := simp)] theorem mem_prehaar_empty {Kβ‚€ : Set G} {f : Compacts G β†’ ℝ} : f ∈ haarProduct Kβ‚€ ↔ βˆ€ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) Kβ‚€) := by simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq] #align measure_theory.measure.haar.mem_prehaar_empty MeasureTheory.Measure.haar.mem_prehaar_empty #align measure_theory.measure.haar.mem_add_prehaar_empty MeasureTheory.Measure.haar.mem_addPrehaar_empty @[to_additive "additive version of `MeasureTheory.Measure.haar.clPrehaar`"] def clPrehaar (Kβ‚€ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G β†’ ℝ) := closure <| prehaar Kβ‚€ '' { U : Set G | U βŠ† V.1 ∧ IsOpen U ∧ (1 : G) ∈ U } #align measure_theory.measure.haar.cl_prehaar MeasureTheory.Measure.haar.clPrehaar #align measure_theory.measure.haar.cl_add_prehaar MeasureTheory.Measure.haar.clAddPrehaar variable [TopologicalGroup G] @[to_additive addIndex_defined "If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined, there is a finite set `t` satisfying the desired properties."] theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : βˆƒ n : β„•, n ∈ Finset.card '' { t : Finset G | K βŠ† ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩ #align measure_theory.measure.haar.index_defined MeasureTheory.Measure.haar.index_defined #align measure_theory.measure.haar.add_index_defined MeasureTheory.Measure.haar.addIndex_defined @[to_additive addIndex_elim]
Mathlib/MeasureTheory/Measure/Haar/Basic.lean
178
180
theorem index_elim {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) : βˆƒ t : Finset G, (K βŠ† ⋃ g ∈ t, (fun h => g * h) ⁻¹' V) ∧ Finset.card t = index K V := by
have := Nat.sInf_mem (index_defined hK hV); rwa [mem_image] at this
import Mathlib.Topology.Sets.Opens #align_import topology.sets.closeds from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" open Order OrderDual Set variable {ΞΉ Ξ± Ξ² : Type*} [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] namespace TopologicalSpace structure Closeds (Ξ± : Type*) [TopologicalSpace Ξ±] where carrier : Set Ξ± closed' : IsClosed carrier #align topological_space.closeds TopologicalSpace.Closeds namespace Closeds instance : SetLike (Closeds Ξ±) Ξ± where coe := Closeds.carrier coe_injective' s t h := by cases s; cases t; congr instance : CanLift (Set Ξ±) (Closeds Ξ±) (↑) IsClosed where prf s hs := ⟨⟨s, hs⟩, rfl⟩ theorem closed (s : Closeds Ξ±) : IsClosed (s : Set Ξ±) := s.closed' #align topological_space.closeds.closed TopologicalSpace.Closeds.closed def Simps.coe (s : Closeds Ξ±) : Set Ξ± := s initialize_simps_projections Closeds (carrier β†’ coe, as_prefix coe) @[ext] protected theorem ext {s t : Closeds Ξ±} (h : (s : Set Ξ±) = t) : s = t := SetLike.ext' h #align topological_space.closeds.ext TopologicalSpace.Closeds.ext @[simp] theorem coe_mk (s : Set Ξ±) (h) : (mk s h : Set Ξ±) = s := rfl #align topological_space.closeds.coe_mk TopologicalSpace.Closeds.coe_mk @[simps] protected def closure (s : Set Ξ±) : Closeds Ξ± := ⟨closure s, isClosed_closure⟩ #align topological_space.closeds.closure TopologicalSpace.Closeds.closure theorem gc : GaloisConnection Closeds.closure ((↑) : Closeds Ξ± β†’ Set Ξ±) := fun _ U => ⟨subset_closure.trans, fun h => closure_minimal h U.closed⟩ #align topological_space.closeds.gc TopologicalSpace.Closeds.gc def gi : GaloisInsertion (@Closeds.closure Ξ± _) (↑) where choice s hs := ⟨s, closure_eq_iff_isClosed.1 <| hs.antisymm subset_closure⟩ gc := gc le_l_u _ := subset_closure choice_eq _s hs := SetLike.coe_injective <| subset_closure.antisymm hs #align topological_space.closeds.gi TopologicalSpace.Closeds.gi instance completeLattice : CompleteLattice (Closeds Ξ±) := CompleteLattice.copy (GaloisInsertion.liftCompleteLattice gi) -- le _ rfl -- top ⟨univ, isClosed_univ⟩ rfl -- bot βŸ¨βˆ…, isClosed_empty⟩ (SetLike.coe_injective closure_empty.symm) -- sup (fun s t => ⟨s βˆͺ t, s.2.union t.2⟩) (funext fun s => funext fun t => SetLike.coe_injective (s.2.union t.2).closure_eq.symm) -- inf (fun s t => ⟨s ∩ t, s.2.inter t.2⟩) rfl -- sSup _ rfl -- sInf (fun S => βŸ¨β‹‚ s ∈ S, ↑s, isClosed_biInter fun s _ => s.2⟩) (funext fun _ => SetLike.coe_injective sInf_image.symm) instance : Inhabited (Closeds Ξ±) := ⟨βŠ₯⟩ @[simp, norm_cast] theorem coe_sup (s t : Closeds Ξ±) : (↑(s βŠ” t) : Set Ξ±) = ↑s βˆͺ ↑t := by rfl #align topological_space.closeds.coe_sup TopologicalSpace.Closeds.coe_sup @[simp, norm_cast] theorem coe_inf (s t : Closeds Ξ±) : (↑(s βŠ“ t) : Set Ξ±) = ↑s ∩ ↑t := rfl #align topological_space.closeds.coe_inf TopologicalSpace.Closeds.coe_inf @[simp, norm_cast] theorem coe_top : (↑(⊀ : Closeds Ξ±) : Set Ξ±) = univ := rfl #align topological_space.closeds.coe_top TopologicalSpace.Closeds.coe_top @[simp, norm_cast] -- Porting note (#10756): new theorem theorem coe_eq_univ {s : Closeds Ξ±} : (s : Set Ξ±) = univ ↔ s = ⊀ := SetLike.coe_injective.eq_iff' rfl @[simp, norm_cast] theorem coe_bot : (↑(βŠ₯ : Closeds Ξ±) : Set Ξ±) = βˆ… := rfl #align topological_space.closeds.coe_bot TopologicalSpace.Closeds.coe_bot @[simp, norm_cast] -- Porting note (#10756): new theorem theorem coe_eq_empty {s : Closeds Ξ±} : (s : Set Ξ±) = βˆ… ↔ s = βŠ₯ := SetLike.coe_injective.eq_iff' rfl theorem coe_nonempty {s : Closeds Ξ±} : (s : Set Ξ±).Nonempty ↔ s β‰  βŠ₯ := nonempty_iff_ne_empty.trans coe_eq_empty.not @[simp, norm_cast] theorem coe_sInf {S : Set (Closeds Ξ±)} : (↑(sInf S) : Set Ξ±) = β‹‚ i ∈ S, ↑i := rfl #align topological_space.closeds.coe_Inf TopologicalSpace.Closeds.coe_sInf @[simp] lemma coe_sSup {S : Set (Closeds Ξ±)} : ((sSup S : Closeds Ξ±) : Set Ξ±) = closure (⋃₀ ((↑) '' S)) := by rfl @[simp, norm_cast] theorem coe_finset_sup (f : ΞΉ β†’ Closeds Ξ±) (s : Finset ΞΉ) : (↑(s.sup f) : Set Ξ±) = s.sup ((↑) ∘ f) := map_finset_sup (⟨⟨(↑), coe_sup⟩, coe_bot⟩ : SupBotHom (Closeds Ξ±) (Set Ξ±)) _ _ #align topological_space.closeds.coe_finset_sup TopologicalSpace.Closeds.coe_finset_sup @[simp, norm_cast] theorem coe_finset_inf (f : ΞΉ β†’ Closeds Ξ±) (s : Finset ΞΉ) : (↑(s.inf f) : Set Ξ±) = s.inf ((↑) ∘ f) := map_finset_inf (⟨⟨(↑), coe_inf⟩, coe_top⟩ : InfTopHom (Closeds Ξ±) (Set Ξ±)) _ _ #align topological_space.closeds.coe_finset_inf TopologicalSpace.Closeds.coe_finset_inf -- Porting note: Lean 3 proofs didn't work as expected, so I reordered lemmas to fix&golf the proofs @[simp] theorem mem_sInf {S : Set (Closeds Ξ±)} {x : Ξ±} : x ∈ sInf S ↔ βˆ€ s ∈ S, x ∈ s := mem_iInterβ‚‚ #align topological_space.closeds.mem_Inf TopologicalSpace.Closeds.mem_sInf @[simp]
Mathlib/Topology/Sets/Closeds.lean
168
168
theorem mem_iInf {ΞΉ} {x : Ξ±} {s : ΞΉ β†’ Closeds Ξ±} : x ∈ iInf s ↔ βˆ€ i, x ∈ s i := by
simp [iInf]
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm import Mathlib.Analysis.NormedSpace.Span 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 Normed variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] [NormedAddCommGroup Fβ‚—] open Metric ContinuousLinearMap section variable [NontriviallyNormedField π•œ] [NontriviallyNormedField π•œβ‚‚] [NontriviallyNormedField π•œβ‚ƒ] [NormedSpace π•œ E] [NormedSpace π•œβ‚‚ F] [NormedSpace π•œβ‚ƒ G] [NormedSpace π•œ Fβ‚—] (c : π•œ) {σ₁₂ : π•œ β†’+* π•œβ‚‚} {σ₂₃ : π•œβ‚‚ β†’+* π•œβ‚ƒ} (f g : E β†’SL[σ₁₂] F) (x y z : E) namespace LinearMap theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E β†’β‚›β‚—[σ₁₂] F) {Ξ΅ C : ℝ} (Ξ΅_pos : 0 < Ξ΅) {c : π•œ} (hc : 1 < β€–cβ€–) (hf : βˆ€ x, Ξ΅ / β€–cβ€– ≀ β€–xβ€– β†’ β€–xβ€– < Ξ΅ β†’ β€–f xβ€– ≀ C * β€–xβ€–) (x : E) : β€–f xβ€– ≀ C * β€–xβ€– := by by_cases hx : x = 0; Β· simp [hx] exact SemilinearMapClass.bound_of_shell_semi_normed f Ξ΅_pos hc hf (norm_ne_zero_iff.2 hx) #align linear_map.bound_of_shell LinearMap.bound_of_shell
Mathlib/Analysis/NormedSpace/OperatorNorm/NormedSpace.lean
52
64
theorem bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E β†’β‚—[π•œ] Fβ‚—) (h : βˆ€ z ∈ Metric.ball (0 : E) r, β€–f zβ€– ≀ c) : βˆƒ C, βˆ€ z : E, β€–f zβ€– ≀ C * β€–zβ€– := by
cases' @NontriviallyNormedField.non_trivial π•œ _ with k hk use c * (β€–kβ€– / r) intro z refine bound_of_shell _ r_pos hk (fun x hko hxo => ?_) _ calc β€–f xβ€– ≀ c := h _ (mem_ball_zero_iff.mpr hxo) _ ≀ c * (β€–xβ€– * β€–kβ€– / r) := le_mul_of_one_le_right ?_ ?_ _ = _ := by ring Β· exact le_trans (norm_nonneg _) (h 0 (by simp [r_pos])) Β· rw [div_le_iff (zero_lt_one.trans hk)] at hko exact (one_le_div r_pos).mpr hko
import Mathlib.CategoryTheory.Comma.Over import Mathlib.CategoryTheory.DiscreteCategory import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Limits.Shapes.Terminal #align_import category_theory.limits.shapes.binary_products from "leanprover-community/mathlib"@"fec1d95fc61c750c1ddbb5b1f7f48b8e811a80d7" noncomputable section universe v u uβ‚‚ open CategoryTheory namespace CategoryTheory.Limits inductive WalkingPair : Type | left | right deriving DecidableEq, Inhabited #align category_theory.limits.walking_pair CategoryTheory.Limits.WalkingPair open WalkingPair def WalkingPair.swap : WalkingPair ≃ WalkingPair where toFun j := WalkingPair.recOn j right left invFun j := WalkingPair.recOn j right left left_inv j := by cases j; repeat rfl right_inv j := by cases j; repeat rfl #align category_theory.limits.walking_pair.swap CategoryTheory.Limits.WalkingPair.swap @[simp] theorem WalkingPair.swap_apply_left : WalkingPair.swap left = right := rfl #align category_theory.limits.walking_pair.swap_apply_left CategoryTheory.Limits.WalkingPair.swap_apply_left @[simp] theorem WalkingPair.swap_apply_right : WalkingPair.swap right = left := rfl #align category_theory.limits.walking_pair.swap_apply_right CategoryTheory.Limits.WalkingPair.swap_apply_right @[simp] theorem WalkingPair.swap_symm_apply_tt : WalkingPair.swap.symm left = right := rfl #align category_theory.limits.walking_pair.swap_symm_apply_tt CategoryTheory.Limits.WalkingPair.swap_symm_apply_tt @[simp] theorem WalkingPair.swap_symm_apply_ff : WalkingPair.swap.symm right = left := rfl #align category_theory.limits.walking_pair.swap_symm_apply_ff CategoryTheory.Limits.WalkingPair.swap_symm_apply_ff def WalkingPair.equivBool : WalkingPair ≃ Bool where toFun j := WalkingPair.recOn j true false -- to match equiv.sum_equiv_sigma_bool invFun b := Bool.recOn b right left left_inv j := by cases j; repeat rfl right_inv b := by cases b; repeat rfl #align category_theory.limits.walking_pair.equiv_bool CategoryTheory.Limits.WalkingPair.equivBool @[simp] theorem WalkingPair.equivBool_apply_left : WalkingPair.equivBool left = true := rfl #align category_theory.limits.walking_pair.equiv_bool_apply_left CategoryTheory.Limits.WalkingPair.equivBool_apply_left @[simp] theorem WalkingPair.equivBool_apply_right : WalkingPair.equivBool right = false := rfl #align category_theory.limits.walking_pair.equiv_bool_apply_right CategoryTheory.Limits.WalkingPair.equivBool_apply_right @[simp] theorem WalkingPair.equivBool_symm_apply_true : WalkingPair.equivBool.symm true = left := rfl #align category_theory.limits.walking_pair.equiv_bool_symm_apply_tt CategoryTheory.Limits.WalkingPair.equivBool_symm_apply_true @[simp] theorem WalkingPair.equivBool_symm_apply_false : WalkingPair.equivBool.symm false = right := rfl #align category_theory.limits.walking_pair.equiv_bool_symm_apply_ff CategoryTheory.Limits.WalkingPair.equivBool_symm_apply_false variable {C : Type u} def pairFunction (X Y : C) : WalkingPair β†’ C := fun j => WalkingPair.casesOn j X Y #align category_theory.limits.pair_function CategoryTheory.Limits.pairFunction @[simp] theorem pairFunction_left (X Y : C) : pairFunction X Y left = X := rfl #align category_theory.limits.pair_function_left CategoryTheory.Limits.pairFunction_left @[simp] theorem pairFunction_right (X Y : C) : pairFunction X Y right = Y := rfl #align category_theory.limits.pair_function_right CategoryTheory.Limits.pairFunction_right variable [Category.{v} C] def pair (X Y : C) : Discrete WalkingPair β₯€ C := Discrete.functor fun j => WalkingPair.casesOn j X Y #align category_theory.limits.pair CategoryTheory.Limits.pair @[simp] theorem pair_obj_left (X Y : C) : (pair X Y).obj ⟨left⟩ = X := rfl #align category_theory.limits.pair_obj_left CategoryTheory.Limits.pair_obj_left @[simp] theorem pair_obj_right (X Y : C) : (pair X Y).obj ⟨right⟩ = Y := rfl #align category_theory.limits.pair_obj_right CategoryTheory.Limits.pair_obj_right section variable {F G : Discrete WalkingPair β₯€ C} (f : F.obj ⟨left⟩ ⟢ G.obj ⟨left⟩) (g : F.obj ⟨right⟩ ⟢ G.obj ⟨right⟩) attribute [local aesop safe tactic (rule_sets := [CategoryTheory])] CategoryTheory.Discrete.discreteCases def mapPair : F ⟢ G where app j := Discrete.recOn j fun j => WalkingPair.casesOn j f g naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨u⟩⟩ => by aesop_cat #align category_theory.limits.map_pair CategoryTheory.Limits.mapPair @[simp] theorem mapPair_left : (mapPair f g).app ⟨left⟩ = f := rfl #align category_theory.limits.map_pair_left CategoryTheory.Limits.mapPair_left @[simp] theorem mapPair_right : (mapPair f g).app ⟨right⟩ = g := rfl #align category_theory.limits.map_pair_right CategoryTheory.Limits.mapPair_right @[simps!] def mapPairIso (f : F.obj ⟨left⟩ β‰… G.obj ⟨left⟩) (g : F.obj ⟨right⟩ β‰… G.obj ⟨right⟩) : F β‰… G := NatIso.ofComponents (fun j => Discrete.recOn j fun j => WalkingPair.casesOn j f g) (fun ⟨⟨u⟩⟩ => by aesop_cat) #align category_theory.limits.map_pair_iso CategoryTheory.Limits.mapPairIso end @[simps!] def diagramIsoPair (F : Discrete WalkingPair β₯€ C) : F β‰… pair (F.obj ⟨WalkingPair.left⟩) (F.obj ⟨WalkingPair.right⟩) := mapPairIso (Iso.refl _) (Iso.refl _) #align category_theory.limits.diagram_iso_pair CategoryTheory.Limits.diagramIsoPair section variable {D : Type u} [Category.{v} D] def pairComp (X Y : C) (F : C β₯€ D) : pair X Y β‹™ F β‰… pair (F.obj X) (F.obj Y) := diagramIsoPair _ #align category_theory.limits.pair_comp CategoryTheory.Limits.pairComp end abbrev BinaryFan (X Y : C) := Cone (pair X Y) #align category_theory.limits.binary_fan CategoryTheory.Limits.BinaryFan abbrev BinaryFan.fst {X Y : C} (s : BinaryFan X Y) := s.Ο€.app ⟨WalkingPair.left⟩ #align category_theory.limits.binary_fan.fst CategoryTheory.Limits.BinaryFan.fst abbrev BinaryFan.snd {X Y : C} (s : BinaryFan X Y) := s.Ο€.app ⟨WalkingPair.right⟩ #align category_theory.limits.binary_fan.snd CategoryTheory.Limits.BinaryFan.snd @[simp] theorem BinaryFan.Ο€_app_left {X Y : C} (s : BinaryFan X Y) : s.Ο€.app ⟨WalkingPair.left⟩ = s.fst := rfl #align category_theory.limits.binary_fan.Ο€_app_left CategoryTheory.Limits.BinaryFan.Ο€_app_left @[simp] theorem BinaryFan.Ο€_app_right {X Y : C} (s : BinaryFan X Y) : s.Ο€.app ⟨WalkingPair.right⟩ = s.snd := rfl #align category_theory.limits.binary_fan.Ο€_app_right CategoryTheory.Limits.BinaryFan.Ο€_app_right def BinaryFan.IsLimit.mk {X Y : C} (s : BinaryFan X Y) (lift : βˆ€ {T : C} (_ : T ⟢ X) (_ : T ⟢ Y), T ⟢ s.pt) (hl₁ : βˆ€ {T : C} (f : T ⟢ X) (g : T ⟢ Y), lift f g ≫ s.fst = f) (hlβ‚‚ : βˆ€ {T : C} (f : T ⟢ X) (g : T ⟢ Y), lift f g ≫ s.snd = g) (uniq : βˆ€ {T : C} (f : T ⟢ X) (g : T ⟢ Y) (m : T ⟢ s.pt) (_ : m ≫ s.fst = f) (_ : m ≫ s.snd = g), m = lift f g) : IsLimit s := Limits.IsLimit.mk (fun t => lift (BinaryFan.fst t) (BinaryFan.snd t)) (by rintro t (rfl | rfl) Β· exact hl₁ _ _ Β· exact hlβ‚‚ _ _) fun t m h => uniq _ _ _ (h ⟨WalkingPair.left⟩) (h ⟨WalkingPair.right⟩) #align category_theory.limits.binary_fan.is_limit.mk CategoryTheory.Limits.BinaryFan.IsLimit.mk theorem BinaryFan.IsLimit.hom_ext {W X Y : C} {s : BinaryFan X Y} (h : IsLimit s) {f g : W ⟢ s.pt} (h₁ : f ≫ s.fst = g ≫ s.fst) (hβ‚‚ : f ≫ s.snd = g ≫ s.snd) : f = g := h.hom_ext fun j => Discrete.recOn j fun j => WalkingPair.casesOn j h₁ hβ‚‚ #align category_theory.limits.binary_fan.is_limit.hom_ext CategoryTheory.Limits.BinaryFan.IsLimit.hom_ext abbrev BinaryCofan (X Y : C) := Cocone (pair X Y) #align category_theory.limits.binary_cofan CategoryTheory.Limits.BinaryCofan abbrev BinaryCofan.inl {X Y : C} (s : BinaryCofan X Y) := s.ΞΉ.app ⟨WalkingPair.left⟩ #align category_theory.limits.binary_cofan.inl CategoryTheory.Limits.BinaryCofan.inl abbrev BinaryCofan.inr {X Y : C} (s : BinaryCofan X Y) := s.ΞΉ.app ⟨WalkingPair.right⟩ #align category_theory.limits.binary_cofan.inr CategoryTheory.Limits.BinaryCofan.inr @[simp] theorem BinaryCofan.ΞΉ_app_left {X Y : C} (s : BinaryCofan X Y) : s.ΞΉ.app ⟨WalkingPair.left⟩ = s.inl := rfl #align category_theory.limits.binary_cofan.ΞΉ_app_left CategoryTheory.Limits.BinaryCofan.ΞΉ_app_left @[simp] theorem BinaryCofan.ΞΉ_app_right {X Y : C} (s : BinaryCofan X Y) : s.ΞΉ.app ⟨WalkingPair.right⟩ = s.inr := rfl #align category_theory.limits.binary_cofan.ΞΉ_app_right CategoryTheory.Limits.BinaryCofan.ΞΉ_app_right def BinaryCofan.IsColimit.mk {X Y : C} (s : BinaryCofan X Y) (desc : βˆ€ {T : C} (_ : X ⟢ T) (_ : Y ⟢ T), s.pt ⟢ T) (hd₁ : βˆ€ {T : C} (f : X ⟢ T) (g : Y ⟢ T), s.inl ≫ desc f g = f) (hdβ‚‚ : βˆ€ {T : C} (f : X ⟢ T) (g : Y ⟢ T), s.inr ≫ desc f g = g) (uniq : βˆ€ {T : C} (f : X ⟢ T) (g : Y ⟢ T) (m : s.pt ⟢ T) (_ : s.inl ≫ m = f) (_ : s.inr ≫ m = g), m = desc f g) : IsColimit s := Limits.IsColimit.mk (fun t => desc (BinaryCofan.inl t) (BinaryCofan.inr t)) (by rintro t (rfl | rfl) Β· exact hd₁ _ _ Β· exact hdβ‚‚ _ _) fun t m h => uniq _ _ _ (h ⟨WalkingPair.left⟩) (h ⟨WalkingPair.right⟩) #align category_theory.limits.binary_cofan.is_colimit.mk CategoryTheory.Limits.BinaryCofan.IsColimit.mk theorem BinaryCofan.IsColimit.hom_ext {W X Y : C} {s : BinaryCofan X Y} (h : IsColimit s) {f g : s.pt ⟢ W} (h₁ : s.inl ≫ f = s.inl ≫ g) (hβ‚‚ : s.inr ≫ f = s.inr ≫ g) : f = g := h.hom_ext fun j => Discrete.recOn j fun j => WalkingPair.casesOn j h₁ hβ‚‚ #align category_theory.limits.binary_cofan.is_colimit.hom_ext CategoryTheory.Limits.BinaryCofan.IsColimit.hom_ext variable {X Y : C} section attribute [local aesop safe tactic (rule_sets := [CategoryTheory])] CategoryTheory.Discrete.discreteCases -- Porting note: would it be okay to use this more generally? attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Eq @[simps pt] def BinaryFan.mk {P : C} (π₁ : P ⟢ X) (Ο€β‚‚ : P ⟢ Y) : BinaryFan X Y where pt := P Ο€ := { app := fun ⟨j⟩ => by cases j <;> simpa } #align category_theory.limits.binary_fan.mk CategoryTheory.Limits.BinaryFan.mk @[simps pt] def BinaryCofan.mk {P : C} (ι₁ : X ⟢ P) (ΞΉβ‚‚ : Y ⟢ P) : BinaryCofan X Y where pt := P ΞΉ := { app := fun ⟨j⟩ => by cases j <;> simpa } #align category_theory.limits.binary_cofan.mk CategoryTheory.Limits.BinaryCofan.mk end @[simp] theorem BinaryFan.mk_fst {P : C} (π₁ : P ⟢ X) (Ο€β‚‚ : P ⟢ Y) : (BinaryFan.mk π₁ Ο€β‚‚).fst = π₁ := rfl #align category_theory.limits.binary_fan.mk_fst CategoryTheory.Limits.BinaryFan.mk_fst @[simp] theorem BinaryFan.mk_snd {P : C} (π₁ : P ⟢ X) (Ο€β‚‚ : P ⟢ Y) : (BinaryFan.mk π₁ Ο€β‚‚).snd = Ο€β‚‚ := rfl #align category_theory.limits.binary_fan.mk_snd CategoryTheory.Limits.BinaryFan.mk_snd @[simp] theorem BinaryCofan.mk_inl {P : C} (ι₁ : X ⟢ P) (ΞΉβ‚‚ : Y ⟢ P) : (BinaryCofan.mk ι₁ ΞΉβ‚‚).inl = ι₁ := rfl #align category_theory.limits.binary_cofan.mk_inl CategoryTheory.Limits.BinaryCofan.mk_inl @[simp] theorem BinaryCofan.mk_inr {P : C} (ι₁ : X ⟢ P) (ΞΉβ‚‚ : Y ⟢ P) : (BinaryCofan.mk ι₁ ΞΉβ‚‚).inr = ΞΉβ‚‚ := rfl #align category_theory.limits.binary_cofan.mk_inr CategoryTheory.Limits.BinaryCofan.mk_inr def isoBinaryFanMk {X Y : C} (c : BinaryFan X Y) : c β‰… BinaryFan.mk c.fst c.snd := Cones.ext (Iso.refl _) fun j => by cases' j with l; cases l; repeat simp #align category_theory.limits.iso_binary_fan_mk CategoryTheory.Limits.isoBinaryFanMk def isoBinaryCofanMk {X Y : C} (c : BinaryCofan X Y) : c β‰… BinaryCofan.mk c.inl c.inr := Cocones.ext (Iso.refl _) fun j => by cases' j with l; cases l; repeat simp #align category_theory.limits.iso_binary_cofan_mk CategoryTheory.Limits.isoBinaryCofanMk def BinaryFan.isLimitMk {W : C} {fst : W ⟢ X} {snd : W ⟢ Y} (lift : βˆ€ s : BinaryFan X Y, s.pt ⟢ W) (fac_left : βˆ€ s : BinaryFan X Y, lift s ≫ fst = s.fst) (fac_right : βˆ€ s : BinaryFan X Y, lift s ≫ snd = s.snd) (uniq : βˆ€ (s : BinaryFan X Y) (m : s.pt ⟢ W) (_ : m ≫ fst = s.fst) (_ : m ≫ snd = s.snd), m = lift s) : IsLimit (BinaryFan.mk fst snd) := { lift := lift fac := fun s j => by rcases j with ⟨⟨⟩⟩ exacts [fac_left s, fac_right s] uniq := fun s m w => uniq s m (w ⟨WalkingPair.left⟩) (w ⟨WalkingPair.right⟩) } #align category_theory.limits.binary_fan.is_limit_mk CategoryTheory.Limits.BinaryFan.isLimitMk def BinaryCofan.isColimitMk {W : C} {inl : X ⟢ W} {inr : Y ⟢ W} (desc : βˆ€ s : BinaryCofan X Y, W ⟢ s.pt) (fac_left : βˆ€ s : BinaryCofan X Y, inl ≫ desc s = s.inl) (fac_right : βˆ€ s : BinaryCofan X Y, inr ≫ desc s = s.inr) (uniq : βˆ€ (s : BinaryCofan X Y) (m : W ⟢ s.pt) (_ : inl ≫ m = s.inl) (_ : inr ≫ m = s.inr), m = desc s) : IsColimit (BinaryCofan.mk inl inr) := { desc := desc fac := fun s j => by rcases j with ⟨⟨⟩⟩ exacts [fac_left s, fac_right s] uniq := fun s m w => uniq s m (w ⟨WalkingPair.left⟩) (w ⟨WalkingPair.right⟩) } #align category_theory.limits.binary_cofan.is_colimit_mk CategoryTheory.Limits.BinaryCofan.isColimitMk @[simps] def BinaryFan.IsLimit.lift' {W X Y : C} {s : BinaryFan X Y} (h : IsLimit s) (f : W ⟢ X) (g : W ⟢ Y) : { l : W ⟢ s.pt // l ≫ s.fst = f ∧ l ≫ s.snd = g } := ⟨h.lift <| BinaryFan.mk f g, h.fac _ _, h.fac _ _⟩ #align category_theory.limits.binary_fan.is_limit.lift' CategoryTheory.Limits.BinaryFan.IsLimit.lift' @[simps] def BinaryCofan.IsColimit.desc' {W X Y : C} {s : BinaryCofan X Y} (h : IsColimit s) (f : X ⟢ W) (g : Y ⟢ W) : { l : s.pt ⟢ W // s.inl ≫ l = f ∧ s.inr ≫ l = g } := ⟨h.desc <| BinaryCofan.mk f g, h.fac _ _, h.fac _ _⟩ #align category_theory.limits.binary_cofan.is_colimit.desc' CategoryTheory.Limits.BinaryCofan.IsColimit.desc' def BinaryFan.isLimitFlip {X Y : C} {c : BinaryFan X Y} (hc : IsLimit c) : IsLimit (BinaryFan.mk c.snd c.fst) := BinaryFan.isLimitMk (fun s => hc.lift (BinaryFan.mk s.snd s.fst)) (fun _ => hc.fac _ _) (fun _ => hc.fac _ _) fun s _ e₁ eβ‚‚ => BinaryFan.IsLimit.hom_ext hc (eβ‚‚.trans (hc.fac (BinaryFan.mk s.snd s.fst) ⟨WalkingPair.left⟩).symm) (e₁.trans (hc.fac (BinaryFan.mk s.snd s.fst) ⟨WalkingPair.right⟩).symm) #align category_theory.limits.binary_fan.is_limit_flip CategoryTheory.Limits.BinaryFan.isLimitFlip theorem BinaryFan.isLimit_iff_isIso_fst {X Y : C} (h : IsTerminal Y) (c : BinaryFan X Y) : Nonempty (IsLimit c) ↔ IsIso c.fst := by constructor Β· rintro ⟨H⟩ obtain ⟨l, hl, -⟩ := BinaryFan.IsLimit.lift' H (πŸ™ X) (h.from X) exact ⟨⟨l, BinaryFan.IsLimit.hom_ext H (by simpa [hl, -Category.comp_id] using Category.comp_id _) (h.hom_ext _ _), hl⟩⟩ Β· intro exact ⟨BinaryFan.IsLimit.mk _ (fun f _ => f ≫ inv c.fst) (fun _ _ => by simp) (fun _ _ => h.hom_ext _ _) fun _ _ _ e _ => by simp [← e]⟩ #align category_theory.limits.binary_fan.is_limit_iff_is_iso_fst CategoryTheory.Limits.BinaryFan.isLimit_iff_isIso_fst theorem BinaryFan.isLimit_iff_isIso_snd {X Y : C} (h : IsTerminal X) (c : BinaryFan X Y) : Nonempty (IsLimit c) ↔ IsIso c.snd := by refine Iff.trans ?_ (BinaryFan.isLimit_iff_isIso_fst h (BinaryFan.mk c.snd c.fst)) exact ⟨fun h => ⟨BinaryFan.isLimitFlip h.some⟩, fun h => ⟨(BinaryFan.isLimitFlip h.some).ofIsoLimit (isoBinaryFanMk c).symm⟩⟩ #align category_theory.limits.binary_fan.is_limit_iff_is_iso_snd CategoryTheory.Limits.BinaryFan.isLimit_iff_isIso_snd noncomputable def BinaryFan.isLimitCompLeftIso {X Y X' : C} (c : BinaryFan X Y) (f : X ⟢ X') [IsIso f] (h : IsLimit c) : IsLimit (BinaryFan.mk (c.fst ≫ f) c.snd) := by fapply BinaryFan.isLimitMk Β· exact fun s => h.lift (BinaryFan.mk (s.fst ≫ inv f) s.snd) Β· intro s -- Porting note: simp timed out here simp only [Category.comp_id,BinaryFan.Ο€_app_left,IsIso.inv_hom_id, BinaryFan.mk_fst,IsLimit.fac_assoc,eq_self_iff_true,Category.assoc] Β· intro s -- Porting note: simp timed out here simp only [BinaryFan.Ο€_app_right,BinaryFan.mk_snd,eq_self_iff_true,IsLimit.fac] Β· intro s m e₁ eβ‚‚ -- Porting note: simpa timed out here also apply BinaryFan.IsLimit.hom_ext h Β· simpa only [BinaryFan.Ο€_app_left,BinaryFan.mk_fst,Category.assoc,IsLimit.fac,IsIso.eq_comp_inv] Β· simpa only [BinaryFan.Ο€_app_right,BinaryFan.mk_snd,IsLimit.fac] #align category_theory.limits.binary_fan.is_limit_comp_left_iso CategoryTheory.Limits.BinaryFan.isLimitCompLeftIso noncomputable def BinaryFan.isLimitCompRightIso {X Y Y' : C} (c : BinaryFan X Y) (f : Y ⟢ Y') [IsIso f] (h : IsLimit c) : IsLimit (BinaryFan.mk c.fst (c.snd ≫ f)) := BinaryFan.isLimitFlip <| BinaryFan.isLimitCompLeftIso _ f (BinaryFan.isLimitFlip h) #align category_theory.limits.binary_fan.is_limit_comp_right_iso CategoryTheory.Limits.BinaryFan.isLimitCompRightIso def BinaryCofan.isColimitFlip {X Y : C} {c : BinaryCofan X Y} (hc : IsColimit c) : IsColimit (BinaryCofan.mk c.inr c.inl) := BinaryCofan.isColimitMk (fun s => hc.desc (BinaryCofan.mk s.inr s.inl)) (fun _ => hc.fac _ _) (fun _ => hc.fac _ _) fun s _ e₁ eβ‚‚ => BinaryCofan.IsColimit.hom_ext hc (eβ‚‚.trans (hc.fac (BinaryCofan.mk s.inr s.inl) ⟨WalkingPair.left⟩).symm) (e₁.trans (hc.fac (BinaryCofan.mk s.inr s.inl) ⟨WalkingPair.right⟩).symm) #align category_theory.limits.binary_cofan.is_colimit_flip CategoryTheory.Limits.BinaryCofan.isColimitFlip theorem BinaryCofan.isColimit_iff_isIso_inl {X Y : C} (h : IsInitial Y) (c : BinaryCofan X Y) : Nonempty (IsColimit c) ↔ IsIso c.inl := by constructor Β· rintro ⟨H⟩ obtain ⟨l, hl, -⟩ := BinaryCofan.IsColimit.desc' H (πŸ™ X) (h.to X) refine ⟨⟨l, hl, BinaryCofan.IsColimit.hom_ext H (?_) (h.hom_ext _ _)⟩⟩ rw [Category.comp_id] have e : (inl c ≫ l) ≫ inl c = πŸ™ X ≫ inl c := congrArg (·≫inl c) hl rwa [Category.assoc,Category.id_comp] at e Β· intro exact ⟨BinaryCofan.IsColimit.mk _ (fun f _ => inv c.inl ≫ f) (fun _ _ => IsIso.hom_inv_id_assoc _ _) (fun _ _ => h.hom_ext _ _) fun _ _ _ e _ => (IsIso.eq_inv_comp _).mpr e⟩ #align category_theory.limits.binary_cofan.is_colimit_iff_is_iso_inl CategoryTheory.Limits.BinaryCofan.isColimit_iff_isIso_inl theorem BinaryCofan.isColimit_iff_isIso_inr {X Y : C} (h : IsInitial X) (c : BinaryCofan X Y) : Nonempty (IsColimit c) ↔ IsIso c.inr := by refine Iff.trans ?_ (BinaryCofan.isColimit_iff_isIso_inl h (BinaryCofan.mk c.inr c.inl)) exact ⟨fun h => ⟨BinaryCofan.isColimitFlip h.some⟩, fun h => ⟨(BinaryCofan.isColimitFlip h.some).ofIsoColimit (isoBinaryCofanMk c).symm⟩⟩ #align category_theory.limits.binary_cofan.is_colimit_iff_is_iso_inr CategoryTheory.Limits.BinaryCofan.isColimit_iff_isIso_inr noncomputable def BinaryCofan.isColimitCompLeftIso {X Y X' : C} (c : BinaryCofan X Y) (f : X' ⟢ X) [IsIso f] (h : IsColimit c) : IsColimit (BinaryCofan.mk (f ≫ c.inl) c.inr) := by fapply BinaryCofan.isColimitMk Β· exact fun s => h.desc (BinaryCofan.mk (inv f ≫ s.inl) s.inr) Β· intro s -- Porting note: simp timed out here too simp only [IsColimit.fac,BinaryCofan.ΞΉ_app_left,eq_self_iff_true, Category.assoc,BinaryCofan.mk_inl,IsIso.hom_inv_id_assoc] Β· intro s -- Porting note: simp timed out here too simp only [IsColimit.fac,BinaryCofan.ΞΉ_app_right,eq_self_iff_true,BinaryCofan.mk_inr] Β· intro s m e₁ eβ‚‚ apply BinaryCofan.IsColimit.hom_ext h Β· rw [← cancel_epi f] -- Porting note: simp timed out here too simpa only [IsColimit.fac,BinaryCofan.ΞΉ_app_left,eq_self_iff_true, Category.assoc,BinaryCofan.mk_inl,IsIso.hom_inv_id_assoc] using e₁ -- Porting note: simp timed out here too Β· simpa only [IsColimit.fac,BinaryCofan.ΞΉ_app_right,eq_self_iff_true,BinaryCofan.mk_inr] #align category_theory.limits.binary_cofan.is_colimit_comp_left_iso CategoryTheory.Limits.BinaryCofan.isColimitCompLeftIso noncomputable def BinaryCofan.isColimitCompRightIso {X Y Y' : C} (c : BinaryCofan X Y) (f : Y' ⟢ Y) [IsIso f] (h : IsColimit c) : IsColimit (BinaryCofan.mk c.inl (f ≫ c.inr)) := BinaryCofan.isColimitFlip <| BinaryCofan.isColimitCompLeftIso _ f (BinaryCofan.isColimitFlip h) #align category_theory.limits.binary_cofan.is_colimit_comp_right_iso CategoryTheory.Limits.BinaryCofan.isColimitCompRightIso abbrev HasBinaryProduct (X Y : C) := HasLimit (pair X Y) #align category_theory.limits.has_binary_product CategoryTheory.Limits.HasBinaryProduct abbrev HasBinaryCoproduct (X Y : C) := HasColimit (pair X Y) #align category_theory.limits.has_binary_coproduct CategoryTheory.Limits.HasBinaryCoproduct abbrev prod (X Y : C) [HasBinaryProduct X Y] := limit (pair X Y) #align category_theory.limits.prod CategoryTheory.Limits.prod abbrev coprod (X Y : C) [HasBinaryCoproduct X Y] := colimit (pair X Y) #align category_theory.limits.coprod CategoryTheory.Limits.coprod notation:20 X " β¨― " Y:20 => prod X Y notation:20 X " β¨Ώ " Y:20 => coprod X Y abbrev prod.fst {X Y : C} [HasBinaryProduct X Y] : X β¨― Y ⟢ X := limit.Ο€ (pair X Y) ⟨WalkingPair.left⟩ #align category_theory.limits.prod.fst CategoryTheory.Limits.prod.fst abbrev prod.snd {X Y : C} [HasBinaryProduct X Y] : X β¨― Y ⟢ Y := limit.Ο€ (pair X Y) ⟨WalkingPair.right⟩ #align category_theory.limits.prod.snd CategoryTheory.Limits.prod.snd abbrev coprod.inl {X Y : C} [HasBinaryCoproduct X Y] : X ⟢ X β¨Ώ Y := colimit.ΞΉ (pair X Y) ⟨WalkingPair.left⟩ #align category_theory.limits.coprod.inl CategoryTheory.Limits.coprod.inl abbrev coprod.inr {X Y : C} [HasBinaryCoproduct X Y] : Y ⟢ X β¨Ώ Y := colimit.ΞΉ (pair X Y) ⟨WalkingPair.right⟩ #align category_theory.limits.coprod.inr CategoryTheory.Limits.coprod.inr def prodIsProd (X Y : C) [HasBinaryProduct X Y] : IsLimit (BinaryFan.mk (prod.fst : X β¨― Y ⟢ X) prod.snd) := (limit.isLimit _).ofIsoLimit (Cones.ext (Iso.refl _) (fun ⟨u⟩ => by cases u Β· dsimp; simp only [Category.id_comp]; rfl Β· dsimp; simp only [Category.id_comp]; rfl )) #align category_theory.limits.prod_is_prod CategoryTheory.Limits.prodIsProd def coprodIsCoprod (X Y : C) [HasBinaryCoproduct X Y] : IsColimit (BinaryCofan.mk (coprod.inl : X ⟢ X β¨Ώ Y) coprod.inr) := (colimit.isColimit _).ofIsoColimit (Cocones.ext (Iso.refl _) (fun ⟨u⟩ => by cases u Β· dsimp; simp only [Category.comp_id] Β· dsimp; simp only [Category.comp_id] )) #align category_theory.limits.coprod_is_coprod CategoryTheory.Limits.coprodIsCoprod @[ext 1100] theorem prod.hom_ext {W X Y : C} [HasBinaryProduct X Y] {f g : W ⟢ X β¨― Y} (h₁ : f ≫ prod.fst = g ≫ prod.fst) (hβ‚‚ : f ≫ prod.snd = g ≫ prod.snd) : f = g := BinaryFan.IsLimit.hom_ext (limit.isLimit _) h₁ hβ‚‚ #align category_theory.limits.prod.hom_ext CategoryTheory.Limits.prod.hom_ext @[ext 1100] theorem coprod.hom_ext {W X Y : C} [HasBinaryCoproduct X Y] {f g : X β¨Ώ Y ⟢ W} (h₁ : coprod.inl ≫ f = coprod.inl ≫ g) (hβ‚‚ : coprod.inr ≫ f = coprod.inr ≫ g) : f = g := BinaryCofan.IsColimit.hom_ext (colimit.isColimit _) h₁ hβ‚‚ #align category_theory.limits.coprod.hom_ext CategoryTheory.Limits.coprod.hom_ext abbrev prod.lift {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) : W ⟢ X β¨― Y := limit.lift _ (BinaryFan.mk f g) #align category_theory.limits.prod.lift CategoryTheory.Limits.prod.lift abbrev diag (X : C) [HasBinaryProduct X X] : X ⟢ X β¨― X := prod.lift (πŸ™ _) (πŸ™ _) #align category_theory.limits.diag CategoryTheory.Limits.diag abbrev coprod.desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) : X β¨Ώ Y ⟢ W := colimit.desc _ (BinaryCofan.mk f g) #align category_theory.limits.coprod.desc CategoryTheory.Limits.coprod.desc abbrev codiag (X : C) [HasBinaryCoproduct X X] : X β¨Ώ X ⟢ X := coprod.desc (πŸ™ _) (πŸ™ _) #align category_theory.limits.codiag CategoryTheory.Limits.codiag -- Porting note (#10618): simp removes as simp can prove this @[reassoc] theorem prod.lift_fst {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) : prod.lift f g ≫ prod.fst = f := limit.lift_Ο€ _ _ #align category_theory.limits.prod.lift_fst CategoryTheory.Limits.prod.lift_fst #align category_theory.limits.prod.lift_fst_assoc CategoryTheory.Limits.prod.lift_fst_assoc -- Porting note (#10618): simp removes as simp can prove this @[reassoc] theorem prod.lift_snd {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) : prod.lift f g ≫ prod.snd = g := limit.lift_Ο€ _ _ #align category_theory.limits.prod.lift_snd CategoryTheory.Limits.prod.lift_snd #align category_theory.limits.prod.lift_snd_assoc CategoryTheory.Limits.prod.lift_snd_assoc -- The simp linter says simp can prove the reassoc version of this lemma. -- Porting note: it can also prove the og version @[reassoc] theorem coprod.inl_desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) : coprod.inl ≫ coprod.desc f g = f := colimit.ΞΉ_desc _ _ #align category_theory.limits.coprod.inl_desc CategoryTheory.Limits.coprod.inl_desc #align category_theory.limits.coprod.inl_desc_assoc CategoryTheory.Limits.coprod.inl_desc_assoc -- The simp linter says simp can prove the reassoc version of this lemma. -- Porting note: it can also prove the og version @[reassoc] theorem coprod.inr_desc {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) : coprod.inr ≫ coprod.desc f g = g := colimit.ΞΉ_desc _ _ #align category_theory.limits.coprod.inr_desc CategoryTheory.Limits.coprod.inr_desc #align category_theory.limits.coprod.inr_desc_assoc CategoryTheory.Limits.coprod.inr_desc_assoc instance prod.mono_lift_of_mono_left {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) [Mono f] : Mono (prod.lift f g) := mono_of_mono_fac <| prod.lift_fst _ _ #align category_theory.limits.prod.mono_lift_of_mono_left CategoryTheory.Limits.prod.mono_lift_of_mono_left instance prod.mono_lift_of_mono_right {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) [Mono g] : Mono (prod.lift f g) := mono_of_mono_fac <| prod.lift_snd _ _ #align category_theory.limits.prod.mono_lift_of_mono_right CategoryTheory.Limits.prod.mono_lift_of_mono_right instance coprod.epi_desc_of_epi_left {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) [Epi f] : Epi (coprod.desc f g) := epi_of_epi_fac <| coprod.inl_desc _ _ #align category_theory.limits.coprod.epi_desc_of_epi_left CategoryTheory.Limits.coprod.epi_desc_of_epi_left instance coprod.epi_desc_of_epi_right {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) [Epi g] : Epi (coprod.desc f g) := epi_of_epi_fac <| coprod.inr_desc _ _ #align category_theory.limits.coprod.epi_desc_of_epi_right CategoryTheory.Limits.coprod.epi_desc_of_epi_right def prod.lift' {W X Y : C} [HasBinaryProduct X Y] (f : W ⟢ X) (g : W ⟢ Y) : { l : W ⟢ X β¨― Y // l ≫ prod.fst = f ∧ l ≫ prod.snd = g } := ⟨prod.lift f g, prod.lift_fst _ _, prod.lift_snd _ _⟩ #align category_theory.limits.prod.lift' CategoryTheory.Limits.prod.lift' def coprod.desc' {W X Y : C} [HasBinaryCoproduct X Y] (f : X ⟢ W) (g : Y ⟢ W) : { l : X β¨Ώ Y ⟢ W // coprod.inl ≫ l = f ∧ coprod.inr ≫ l = g } := ⟨coprod.desc f g, coprod.inl_desc _ _, coprod.inr_desc _ _⟩ #align category_theory.limits.coprod.desc' CategoryTheory.Limits.coprod.desc' def prod.map {W X Y Z : C} [HasBinaryProduct W X] [HasBinaryProduct Y Z] (f : W ⟢ Y) (g : X ⟢ Z) : W β¨― X ⟢ Y β¨― Z := limMap (mapPair f g) #align category_theory.limits.prod.map CategoryTheory.Limits.prod.map def coprod.map {W X Y Z : C} [HasBinaryCoproduct W X] [HasBinaryCoproduct Y Z] (f : W ⟢ Y) (g : X ⟢ Z) : W β¨Ώ X ⟢ Y β¨Ώ Z := colimMap (mapPair f g) #align category_theory.limits.coprod.map CategoryTheory.Limits.coprod.map section CoprodLemmas -- @[reassoc (attr := simp)] @[simp] -- Porting note: removing reassoc tag since result is not hygienic (two h's) theorem coprod.desc_comp {V W X Y : C} [HasBinaryCoproduct X Y] (f : V ⟢ W) (g : X ⟢ V) (h : Y ⟢ V) : coprod.desc g h ≫ f = coprod.desc (g ≫ f) (h ≫ f) := by ext <;> simp #align category_theory.limits.coprod.desc_comp CategoryTheory.Limits.coprod.desc_comp -- Porting note: hand generated reassoc here. Simp can prove it theorem coprod.desc_comp_assoc {C : Type u} [Category C] {V W X Y : C} [HasBinaryCoproduct X Y] (f : V ⟢ W) (g : X ⟢ V) (h : Y ⟢ V) {Z : C} (l : W ⟢ Z) : coprod.desc g h ≫ f ≫ l = coprod.desc (g ≫ f) (h ≫ f) ≫ l := by simp #align category_theory.limits.coprod.desc_comp_assoc CategoryTheory.Limits.coprod.desc_comp theorem coprod.diag_comp {X Y : C} [HasBinaryCoproduct X X] (f : X ⟢ Y) : codiag X ≫ f = coprod.desc f f := by simp #align category_theory.limits.coprod.diag_comp CategoryTheory.Limits.coprod.diag_comp @[reassoc (attr := simp)] theorem coprod.inl_map {W X Y Z : C} [HasBinaryCoproduct W X] [HasBinaryCoproduct Y Z] (f : W ⟢ Y) (g : X ⟢ Z) : coprod.inl ≫ coprod.map f g = f ≫ coprod.inl := ΞΉ_colimMap _ _ #align category_theory.limits.coprod.inl_map CategoryTheory.Limits.coprod.inl_map #align category_theory.limits.coprod.inl_map_assoc CategoryTheory.Limits.coprod.inl_map_assoc @[reassoc (attr := simp)] theorem coprod.inr_map {W X Y Z : C} [HasBinaryCoproduct W X] [HasBinaryCoproduct Y Z] (f : W ⟢ Y) (g : X ⟢ Z) : coprod.inr ≫ coprod.map f g = g ≫ coprod.inr := ΞΉ_colimMap _ _ #align category_theory.limits.coprod.inr_map CategoryTheory.Limits.coprod.inr_map #align category_theory.limits.coprod.inr_map_assoc CategoryTheory.Limits.coprod.inr_map_assoc @[simp] theorem coprod.map_id_id {X Y : C} [HasBinaryCoproduct X Y] : coprod.map (πŸ™ X) (πŸ™ Y) = πŸ™ _ := by ext <;> simp #align category_theory.limits.coprod.map_id_id CategoryTheory.Limits.coprod.map_id_id @[simp]
Mathlib/CategoryTheory/Limits/Shapes/BinaryProducts.lean
872
873
theorem coprod.desc_inl_inr {X Y : C} [HasBinaryCoproduct X Y] : coprod.desc coprod.inl coprod.inr = πŸ™ (X β¨Ώ Y) := by
ext <;> simp
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
Mathlib/Data/Int/Lemmas.lean
50
52
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
import Mathlib.Algebra.MonoidAlgebra.Division import Mathlib.Algebra.MvPolynomial.Basic #align_import data.mv_polynomial.division from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951" variable {Οƒ R : Type*} [CommSemiring R] namespace MvPolynomial
Mathlib/Algebra/MvPolynomial/Division.lean
221
240
theorem monomial_dvd_monomial {r s : R} {i j : Οƒ β†’β‚€ β„•} : monomial i r ∣ monomial j s ↔ (s = 0 ∨ i ≀ j) ∧ r ∣ s := by
constructor Β· rintro ⟨x, hx⟩ rw [MvPolynomial.ext_iff] at hx have hj := hx j have hi := hx i classical simp_rw [coeff_monomial, if_pos] at hj hi simp_rw [coeff_monomial_mul'] at hi hj split_ifs at hi hj with hi hi Β· exact ⟨Or.inr hi, _, hj⟩ Β· exact ⟨Or.inl hj, hj.symm β–Έ dvd_zero _⟩ -- Porting note: two goals remain at this point in Lean 4 Β· simp_all only [or_true, dvd_mul_right, and_self] Β· simp_all only [ite_self, le_refl, ite_true, dvd_mul_right, or_false, and_self] Β· rintro ⟨h | hij, d, rfl⟩ Β· simp_rw [h, monomial_zero, dvd_zero] Β· refine ⟨monomial (j - i) d, ?_⟩ rw [monomial_mul, add_tsub_cancel_of_le hij]
import Mathlib.Analysis.Normed.Group.Seminorm import Mathlib.Order.LiminfLimsup import Mathlib.Topology.Instances.Rat import Mathlib.Topology.MetricSpace.Algebra import Mathlib.Topology.MetricSpace.IsometricSMul import Mathlib.Topology.Sequences #align_import analysis.normed.group.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01" variable {𝓕 π•œ Ξ± ΞΉ ΞΊ E F G : Type*} open Filter Function Metric Bornology open ENNReal Filter NNReal Uniformity Pointwise Topology @[notation_class] class Norm (E : Type*) where norm : E β†’ ℝ #align has_norm Norm @[notation_class] class NNNorm (E : Type*) where nnnorm : E β†’ ℝβ‰₯0 #align has_nnnorm NNNorm export Norm (norm) export NNNorm (nnnorm) @[inherit_doc] notation "β€–" e "β€–" => norm e @[inherit_doc] notation "β€–" e "β€–β‚Š" => nnnorm e class SeminormedAddGroup (E : Type*) extends Norm E, AddGroup E, PseudoMetricSpace E where dist := fun x y => β€–x - yβ€– dist_eq : βˆ€ x y, dist x y = β€–x - yβ€– := by aesop #align seminormed_add_group SeminormedAddGroup @[to_additive] class SeminormedGroup (E : Type*) extends Norm E, Group E, PseudoMetricSpace E where dist := fun x y => β€–x / yβ€– dist_eq : βˆ€ x y, dist x y = β€–x / yβ€– := by aesop #align seminormed_group SeminormedGroup class NormedAddGroup (E : Type*) extends Norm E, AddGroup E, MetricSpace E where dist := fun x y => β€–x - yβ€– dist_eq : βˆ€ x y, dist x y = β€–x - yβ€– := by aesop #align normed_add_group NormedAddGroup @[to_additive] class NormedGroup (E : Type*) extends Norm E, Group E, MetricSpace E where dist := fun x y => β€–x / yβ€– dist_eq : βˆ€ x y, dist x y = β€–x / yβ€– := by aesop #align normed_group NormedGroup class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, PseudoMetricSpace E where dist := fun x y => β€–x - yβ€– dist_eq : βˆ€ x y, dist x y = β€–x - yβ€– := by aesop #align seminormed_add_comm_group SeminormedAddCommGroup @[to_additive] class SeminormedCommGroup (E : Type*) extends Norm E, CommGroup E, PseudoMetricSpace E where dist := fun x y => β€–x / yβ€– dist_eq : βˆ€ x y, dist x y = β€–x / yβ€– := by aesop #align seminormed_comm_group SeminormedCommGroup class NormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, MetricSpace E where dist := fun x y => β€–x - yβ€– dist_eq : βˆ€ x y, dist x y = β€–x - yβ€– := by aesop #align normed_add_comm_group NormedAddCommGroup @[to_additive] class NormedCommGroup (E : Type*) extends Norm E, CommGroup E, MetricSpace E where dist := fun x y => β€–x / yβ€– dist_eq : βˆ€ x y, dist x y = β€–x / yβ€– := by aesop #align normed_comm_group NormedCommGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedGroup.toSeminormedGroup [NormedGroup E] : SeminormedGroup E := { β€ΉNormedGroup Eβ€Ί with } #align normed_group.to_seminormed_group NormedGroup.toSeminormedGroup #align normed_add_group.to_seminormed_add_group NormedAddGroup.toSeminormedAddGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toSeminormedCommGroup [NormedCommGroup E] : SeminormedCommGroup E := { β€ΉNormedCommGroup Eβ€Ί with } #align normed_comm_group.to_seminormed_comm_group NormedCommGroup.toSeminormedCommGroup #align normed_add_comm_group.to_seminormed_add_comm_group NormedAddCommGroup.toSeminormedAddCommGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedCommGroup.toSeminormedGroup [SeminormedCommGroup E] : SeminormedGroup E := { β€ΉSeminormedCommGroup Eβ€Ί with } #align seminormed_comm_group.to_seminormed_group SeminormedCommGroup.toSeminormedGroup #align seminormed_add_comm_group.to_seminormed_add_group SeminormedAddCommGroup.toSeminormedAddGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toNormedGroup [NormedCommGroup E] : NormedGroup E := { β€ΉNormedCommGroup Eβ€Ί with } #align normed_comm_group.to_normed_group NormedCommGroup.toNormedGroup #align normed_add_comm_group.to_normed_add_group NormedAddCommGroup.toNormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a `NormedAddGroup` from a `SeminormedAddGroup` satisfying `βˆ€ x, β€–xβ€– = 0 β†’ x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddGroup` instance as a special case of a more general `SeminormedAddGroup` instance."] def NormedGroup.ofSeparation [SeminormedGroup E] (h : βˆ€ x : E, β€–xβ€– = 0 β†’ x = 1) : NormedGroup E where dist_eq := β€ΉSeminormedGroup Eβ€Ί.dist_eq toMetricSpace := { eq_of_dist_eq_zero := fun hxy => div_eq_one.1 <| h _ <| by exact (β€ΉSeminormedGroup Eβ€Ί.dist_eq _ _).symm.trans hxy } -- Porting note: the `rwa` no longer worked, but it was easy enough to provide the term. -- however, notice that if you make `x` and `y` accessible, then the following does work: -- `have := β€ΉSeminormedGroup Eβ€Ί.dist_eq x y; rwa [← this]`, so I'm not sure why the `rwa` -- was broken. #align normed_group.of_separation NormedGroup.ofSeparation #align normed_add_group.of_separation NormedAddGroup.ofSeparation -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a `NormedAddCommGroup` from a `SeminormedAddCommGroup` satisfying `βˆ€ x, β€–xβ€– = 0 β†’ x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddCommGroup` instance as a special case of a more general `SeminormedAddCommGroup` instance."] def NormedCommGroup.ofSeparation [SeminormedCommGroup E] (h : βˆ€ x : E, β€–xβ€– = 0 β†’ x = 1) : NormedCommGroup E := { β€ΉSeminormedCommGroup Eβ€Ί, NormedGroup.ofSeparation h with } #align normed_comm_group.of_separation NormedCommGroup.ofSeparation #align normed_add_comm_group.of_separation NormedAddCommGroup.ofSeparation -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant distance."] def SeminormedGroup.ofMulDist [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist x y ≀ dist (x * z) (y * z)) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm Β· simpa only [div_eq_mul_inv, ← mul_right_inv y] using hβ‚‚ _ _ _ Β· simpa only [div_mul_cancel, one_mul] using hβ‚‚ (x / y) 1 y #align seminormed_group.of_mul_dist SeminormedGroup.ofMulDist #align seminormed_add_group.of_add_dist SeminormedAddGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedGroup.ofMulDist' [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist (x * z) (y * z) ≀ dist x y) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm Β· simpa only [div_mul_cancel, one_mul] using hβ‚‚ (x / y) 1 y Β· simpa only [div_eq_mul_inv, ← mul_right_inv y] using hβ‚‚ _ _ _ #align seminormed_group.of_mul_dist' SeminormedGroup.ofMulDist' #align seminormed_add_group.of_add_dist' SeminormedAddGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist x y ≀ dist (x * z) (y * z)) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist h₁ hβ‚‚ with mul_comm := mul_comm } #align seminormed_comm_group.of_mul_dist SeminormedCommGroup.ofMulDist #align seminormed_add_comm_group.of_add_dist SeminormedAddCommGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist (x * z) (y * z) ≀ dist x y) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist' h₁ hβ‚‚ with mul_comm := mul_comm } #align seminormed_comm_group.of_mul_dist' SeminormedCommGroup.ofMulDist' #align seminormed_add_comm_group.of_add_dist' SeminormedAddCommGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant distance."] def NormedGroup.ofMulDist [Norm E] [Group E] [MetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist x y ≀ dist (x * z) (y * z)) : NormedGroup E := { SeminormedGroup.ofMulDist h₁ hβ‚‚ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } #align normed_group.of_mul_dist NormedGroup.ofMulDist #align normed_add_group.of_add_dist NormedAddGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedGroup.ofMulDist' [Norm E] [Group E] [MetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist (x * z) (y * z) ≀ dist x y) : NormedGroup E := { SeminormedGroup.ofMulDist' h₁ hβ‚‚ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } #align normed_group.of_mul_dist' NormedGroup.ofMulDist' #align normed_add_group.of_add_dist' NormedAddGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist [Norm E] [CommGroup E] [MetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist x y ≀ dist (x * z) (y * z)) : NormedCommGroup E := { NormedGroup.ofMulDist h₁ hβ‚‚ with mul_comm := mul_comm } #align normed_comm_group.of_mul_dist NormedCommGroup.ofMulDist #align normed_add_comm_group.of_add_dist NormedAddCommGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [MetricSpace E] (h₁ : βˆ€ x : E, β€–xβ€– = dist x 1) (hβ‚‚ : βˆ€ x y z : E, dist (x * z) (y * z) ≀ dist x y) : NormedCommGroup E := { NormedGroup.ofMulDist' h₁ hβ‚‚ with mul_comm := mul_comm } #align normed_comm_group.of_mul_dist' NormedCommGroup.ofMulDist' #align normed_add_comm_group.of_add_dist' NormedAddCommGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedGroup [Group E] (f : GroupSeminorm E) : SeminormedGroup E where dist x y := f (x / y) norm := f dist_eq x y := rfl dist_self x := by simp only [div_self', map_one_eq_zero] dist_triangle := le_map_div_add_map_div f dist_comm := map_div_rev f edist_dist x y := by exact ENNReal.coe_nnreal_eq _ -- Porting note: how did `mathlib3` solve this automatically? #align group_seminorm.to_seminormed_group GroupSeminorm.toSeminormedGroup #align add_group_seminorm.to_seminormed_add_group AddGroupSeminorm.toSeminormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedCommGroup [CommGroup E] (f : GroupSeminorm E) : SeminormedCommGroup E := { f.toSeminormedGroup with mul_comm := mul_comm } #align group_seminorm.to_seminormed_comm_group GroupSeminorm.toSeminormedCommGroup #align add_group_seminorm.to_seminormed_add_comm_group AddGroupSeminorm.toSeminormedAddCommGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedGroup [Group E] (f : GroupNorm E) : NormedGroup E := { f.toGroupSeminorm.toSeminormedGroup with eq_of_dist_eq_zero := fun h => div_eq_one.1 <| eq_one_of_map_eq_zero f h } #align group_norm.to_normed_group GroupNorm.toNormedGroup #align add_group_norm.to_normed_add_group AddGroupNorm.toNormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedCommGroup [CommGroup E] (f : GroupNorm E) : NormedCommGroup E := { f.toNormedGroup with mul_comm := mul_comm } #align group_norm.to_normed_comm_group GroupNorm.toNormedCommGroup #align add_group_norm.to_normed_add_comm_group AddGroupNorm.toNormedAddCommGroup instance PUnit.normedAddCommGroup : NormedAddCommGroup PUnit where norm := Function.const _ 0 dist_eq _ _ := rfl @[simp] theorem PUnit.norm_eq_zero (r : PUnit) : β€–rβ€– = 0 := rfl #align punit.norm_eq_zero PUnit.norm_eq_zero section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a a₁ aβ‚‚ b b₁ bβ‚‚ : E} {r r₁ rβ‚‚ : ℝ} @[to_additive] theorem dist_eq_norm_div (a b : E) : dist a b = β€–a / bβ€– := SeminormedGroup.dist_eq _ _ #align dist_eq_norm_div dist_eq_norm_div #align dist_eq_norm_sub dist_eq_norm_sub @[to_additive] theorem dist_eq_norm_div' (a b : E) : dist a b = β€–b / aβ€– := by rw [dist_comm, dist_eq_norm_div] #align dist_eq_norm_div' dist_eq_norm_div' #align dist_eq_norm_sub' dist_eq_norm_sub' alias dist_eq_norm := dist_eq_norm_sub #align dist_eq_norm dist_eq_norm alias dist_eq_norm' := dist_eq_norm_sub' #align dist_eq_norm' dist_eq_norm' @[to_additive] instance NormedGroup.to_isometricSMul_right : IsometricSMul Eᡐᡒᡖ E := ⟨fun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]⟩ #align normed_group.to_has_isometric_smul_right NormedGroup.to_isometricSMul_right #align normed_add_group.to_has_isometric_vadd_right NormedAddGroup.to_isometricVAdd_right @[to_additive (attr := simp)] theorem dist_one_right (a : E) : dist a 1 = β€–aβ€– := by rw [dist_eq_norm_div, div_one] #align dist_one_right dist_one_right #align dist_zero_right dist_zero_right @[to_additive] theorem inseparable_one_iff_norm {a : E} : Inseparable a 1 ↔ β€–aβ€– = 0 := by rw [Metric.inseparable_iff, dist_one_right] @[to_additive (attr := simp)] theorem dist_one_left : dist (1 : E) = norm := funext fun a => by rw [dist_comm, dist_one_right] #align dist_one_left dist_one_left #align dist_zero_left dist_zero_left @[to_additive] theorem Isometry.norm_map_of_map_one {f : E β†’ F} (hi : Isometry f) (h₁ : f 1 = 1) (x : E) : β€–f xβ€– = β€–xβ€– := by rw [← dist_one_right, ← h₁, hi.dist_eq, dist_one_right] #align isometry.norm_map_of_map_one Isometry.norm_map_of_map_one #align isometry.norm_map_of_map_zero Isometry.norm_map_of_map_zero @[to_additive (attr := simp) comap_norm_atTop] theorem comap_norm_atTop' : comap norm atTop = cobounded E := by simpa only [dist_one_right] using comap_dist_right_atTop (1 : E) @[to_additive Filter.HasBasis.cobounded_of_norm] lemma Filter.HasBasis.cobounded_of_norm' {ΞΉ : Sort*} {p : ΞΉ β†’ Prop} {s : ΞΉ β†’ Set ℝ} (h : HasBasis atTop p s) : HasBasis (cobounded E) p fun i ↦ norm ⁻¹' s i := comap_norm_atTop' (E := E) β–Έ h.comap _ @[to_additive Filter.hasBasis_cobounded_norm] lemma Filter.hasBasis_cobounded_norm' : HasBasis (cobounded E) (fun _ ↦ True) ({x | Β· ≀ β€–xβ€–}) := atTop_basis.cobounded_of_norm' @[to_additive (attr := simp) tendsto_norm_atTop_iff_cobounded] theorem tendsto_norm_atTop_iff_cobounded' {f : Ξ± β†’ E} {l : Filter Ξ±} : Tendsto (β€–f Β·β€–) l atTop ↔ Tendsto f l (cobounded E) := by rw [← comap_norm_atTop', tendsto_comap_iff]; rfl @[to_additive tendsto_norm_cobounded_atTop] theorem tendsto_norm_cobounded_atTop' : Tendsto norm (cobounded E) atTop := tendsto_norm_atTop_iff_cobounded'.2 tendsto_id @[to_additive eventually_cobounded_le_norm] lemma eventually_cobounded_le_norm' (a : ℝ) : βˆ€αΆ  x in cobounded E, a ≀ β€–xβ€– := tendsto_norm_cobounded_atTop'.eventually_ge_atTop a @[to_additive tendsto_norm_cocompact_atTop] theorem tendsto_norm_cocompact_atTop' [ProperSpace E] : Tendsto norm (cocompact E) atTop := cobounded_eq_cocompact (Ξ± := E) β–Έ tendsto_norm_cobounded_atTop' #align tendsto_norm_cocompact_at_top' tendsto_norm_cocompact_atTop' #align tendsto_norm_cocompact_at_top tendsto_norm_cocompact_atTop @[to_additive] theorem norm_div_rev (a b : E) : β€–a / bβ€– = β€–b / aβ€– := by simpa only [dist_eq_norm_div] using dist_comm a b #align norm_div_rev norm_div_rev #align norm_sub_rev norm_sub_rev @[to_additive (attr := simp) norm_neg]
Mathlib/Analysis/Normed/Group/Basic.lean
483
483
theorem norm_inv' (a : E) : β€–a⁻¹‖ = β€–aβ€– := by
simpa using norm_div_rev 1 a
import Mathlib.Init.Logic import Mathlib.Init.Function import Mathlib.Init.Algebra.Classes import Batteries.Util.LibraryNote import Batteries.Tactic.Lint.Basic #align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" #align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db" open Function attribute [local instance 10] Classical.propDecidable open Function alias Membership.mem.ne_of_not_mem := ne_of_mem_of_not_mem alias Membership.mem.ne_of_not_mem' := ne_of_mem_of_not_mem' #align has_mem.mem.ne_of_not_mem Membership.mem.ne_of_not_mem #align has_mem.mem.ne_of_not_mem' Membership.mem.ne_of_not_mem' section Equality -- todo: change name theorem forall_cond_comm {Ξ±} {s : Ξ± β†’ Prop} {p : Ξ± β†’ Ξ± β†’ Prop} : (βˆ€ a, s a β†’ βˆ€ b, s b β†’ p a b) ↔ βˆ€ a b, s a β†’ s b β†’ p a b := ⟨fun h a b ha hb ↦ h a ha b hb, fun h a ha b hb ↦ h a b ha hb⟩ #align ball_cond_comm forall_cond_comm theorem forall_mem_comm {Ξ± Ξ²} [Membership Ξ± Ξ²] {s : Ξ²} {p : Ξ± β†’ Ξ± β†’ Prop} : (βˆ€ a (_ : a ∈ s) b (_ : b ∈ s), p a b) ↔ βˆ€ a b, a ∈ s β†’ b ∈ s β†’ p a b := forall_cond_comm #align ball_mem_comm forall_mem_comm @[deprecated (since := "2024-03-23")] alias ball_cond_comm := forall_cond_comm @[deprecated (since := "2024-03-23")] alias ball_mem_comm := forall_mem_comm #align ne_of_apply_ne ne_of_apply_ne lemma ne_of_eq_of_ne {Ξ± : Sort*} {a b c : Ξ±} (h₁ : a = b) (hβ‚‚ : b β‰  c) : a β‰  c := h₁.symm β–Έ hβ‚‚ lemma ne_of_ne_of_eq {Ξ± : Sort*} {a b c : Ξ±} (h₁ : a β‰  b) (hβ‚‚ : b = c) : a β‰  c := hβ‚‚ β–Έ h₁ alias Eq.trans_ne := ne_of_eq_of_ne alias Ne.trans_eq := ne_of_ne_of_eq #align eq.trans_ne Eq.trans_ne #align ne.trans_eq Ne.trans_eq theorem eq_equivalence {Ξ± : Sort*} : Equivalence (@Eq Ξ±) := ⟨Eq.refl, @Eq.symm _, @Eq.trans _⟩ #align eq_equivalence eq_equivalence -- These were migrated to Batteries but the `@[simp]` attributes were (mysteriously?) removed. attribute [simp] eq_mp_eq_cast eq_mpr_eq_cast #align eq_mp_eq_cast eq_mp_eq_cast #align eq_mpr_eq_cast eq_mpr_eq_cast #align cast_cast cast_cast -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_refl_left {Ξ± Ξ² : Sort*} (f : Ξ± β†’ Ξ²) {a b : Ξ±} (h : a = b) : congr (Eq.refl f) h = congr_arg f h := rfl #align congr_refl_left congr_refl_left -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_refl_right {Ξ± Ξ² : Sort*} {f g : Ξ± β†’ Ξ²} (h : f = g) (a : Ξ±) : congr h (Eq.refl a) = congr_fun h a := rfl #align congr_refl_right congr_refl_right -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_arg_refl {Ξ± Ξ² : Sort*} (f : Ξ± β†’ Ξ²) (a : Ξ±) : congr_arg f (Eq.refl a) = Eq.refl (f a) := rfl #align congr_arg_refl congr_arg_refl -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_fun_rfl {Ξ± Ξ² : Sort*} (f : Ξ± β†’ Ξ²) (a : Ξ±) : congr_fun (Eq.refl f) a = Eq.refl (f a) := rfl #align congr_fun_rfl congr_fun_rfl -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_fun_congr_arg {Ξ± Ξ² Ξ³ : Sort*} (f : Ξ± β†’ Ξ² β†’ Ξ³) {a a' : Ξ±} (p : a = a') (b : Ξ²) : congr_fun (congr_arg f p) b = congr_arg (fun a ↦ f a b) p := rfl #align congr_fun_congr_arg congr_fun_congr_arg #align heq_of_cast_eq heq_of_cast_eq #align cast_eq_iff_heq cast_eq_iff_heq theorem Eq.rec_eq_cast {Ξ± : Sort _} {P : Ξ± β†’ Sort _} {x y : Ξ±} (h : x = y) (z : P x) : h β–Έ z = cast (congr_arg P h) z := by induction h; rfl -- Porting note (#10756): new theorem. More general version of `eqRec_heq` theorem eqRec_heq' {Ξ± : Sort*} {a' : Ξ±} {motive : (a : Ξ±) β†’ a' = a β†’ Sort*} (p : motive a' (rfl : a' = a')) {a : Ξ±} (t : a' = a) : HEq (@Eq.rec Ξ± a' motive p a t) p := by subst t; rfl set_option autoImplicit true in theorem rec_heq_of_heq {C : Ξ± β†’ Sort*} {x : C a} {y : Ξ²} (e : a = b) (h : HEq x y) : HEq (e β–Έ x) y := by subst e; exact h #align rec_heq_of_heq rec_heq_of_heq set_option autoImplicit true in theorem rec_heq_iff_heq {C : Ξ± β†’ Sort*} {x : C a} {y : Ξ²} {e : a = b} : HEq (e β–Έ x) y ↔ HEq x y := by subst e; rfl #align rec_heq_iff_heq rec_heq_iff_heq set_option autoImplicit true in
Mathlib/Logic/Basic.lean
611
612
theorem heq_rec_iff_heq {C : Ξ± β†’ Sort*} {x : Ξ²} {y : C a} {e : a = b} : HEq x (e β–Έ y) ↔ HEq x y := by
subst e; rfl
import Mathlib.Algebra.Quaternion import Mathlib.Tactic.Ring #align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d" open Quaternion namespace QuaternionAlgebra structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ cβ‚‚ : R) where (i j k : A) i_mul_i : i * i = c₁ β€’ (1 : A) j_mul_j : j * j = cβ‚‚ β€’ (1 : A) i_mul_j : i * j = k j_mul_i : j * i = -k #align quaternion_algebra.basis QuaternionAlgebra.Basis variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] variable {c₁ cβ‚‚ : R} namespace Basis @[ext] protected theorem ext ⦃q₁ qβ‚‚ : Basis A c₁ c₂⦄ (hi : q₁.i = qβ‚‚.i) (hj : q₁.j = qβ‚‚.j) : q₁ = qβ‚‚ := by cases q₁; rename_i q₁_i_mul_j _ cases qβ‚‚; rename_i qβ‚‚_i_mul_j _ congr rw [← q₁_i_mul_j, ← qβ‚‚_i_mul_j] congr #align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext variable (R) @[simps i j k] protected def self : Basis ℍ[R,c₁,cβ‚‚] c₁ cβ‚‚ where i := ⟨0, 1, 0, 0⟩ i_mul_i := by ext <;> simp j := ⟨0, 0, 1, 0⟩ j_mul_j := by ext <;> simp k := ⟨0, 0, 0, 1⟩ i_mul_j := by ext <;> simp j_mul_i := by ext <;> simp #align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self variable {R} instance : Inhabited (Basis ℍ[R,c₁,cβ‚‚] c₁ cβ‚‚) := ⟨Basis.self R⟩ variable (q : Basis A c₁ cβ‚‚) attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i @[simp] theorem i_mul_k : q.i * q.k = c₁ β€’ q.j := by rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul] #align quaternion_algebra.basis.i_mul_k QuaternionAlgebra.Basis.i_mul_k @[simp]
Mathlib/Algebra/QuaternionBasis.lean
89
90
theorem k_mul_i : q.k * q.i = -c₁ β€’ q.j := by
rw [← i_mul_j, mul_assoc, j_mul_i, mul_neg, i_mul_k, neg_smul]
import Mathlib.Topology.Maps import Mathlib.Topology.NhdsSet #align_import topology.constructions from "leanprover-community/mathlib"@"f7ebde7ee0d1505dfccac8644ae12371aa3c1c9f" noncomputable section open scoped Classical open Topology TopologicalSpace Set Filter Function universe u v variable {X : Type u} {Y : Type v} {Z W Ξ΅ ΞΆ : Type*} section Constructions instance instTopologicalSpaceSubtype {p : X β†’ Prop} [t : TopologicalSpace X] : TopologicalSpace (Subtype p) := induced (↑) t instance {r : X β†’ X β†’ Prop} [t : TopologicalSpace X] : TopologicalSpace (Quot r) := coinduced (Quot.mk r) t instance instTopologicalSpaceQuotient {s : Setoid X} [t : TopologicalSpace X] : TopologicalSpace (Quotient s) := coinduced Quotient.mk' t instance instTopologicalSpaceProd [t₁ : TopologicalSpace X] [tβ‚‚ : TopologicalSpace Y] : TopologicalSpace (X Γ— Y) := induced Prod.fst t₁ βŠ“ induced Prod.snd tβ‚‚ instance instTopologicalSpaceSum [t₁ : TopologicalSpace X] [tβ‚‚ : TopologicalSpace Y] : TopologicalSpace (X βŠ• Y) := coinduced Sum.inl t₁ βŠ” coinduced Sum.inr tβ‚‚ instance instTopologicalSpaceSigma {ΞΉ : Type*} {X : ΞΉ β†’ Type v} [tβ‚‚ : βˆ€ i, TopologicalSpace (X i)] : TopologicalSpace (Sigma X) := ⨆ i, coinduced (Sigma.mk i) (tβ‚‚ i) instance Pi.topologicalSpace {ΞΉ : Type*} {Y : ΞΉ β†’ Type v} [tβ‚‚ : (i : ΞΉ) β†’ TopologicalSpace (Y i)] : TopologicalSpace ((i : ΞΉ) β†’ Y i) := β¨… i, induced (fun f => f i) (tβ‚‚ i) #align Pi.topological_space Pi.topologicalSpace instance ULift.topologicalSpace [t : TopologicalSpace X] : TopologicalSpace (ULift.{v, u} X) := t.induced ULift.down #align ulift.topological_space ULift.topologicalSpace section variable [TopologicalSpace X] open Additive Multiplicative instance : TopologicalSpace (Additive X) := β€ΉTopologicalSpace Xβ€Ί instance : TopologicalSpace (Multiplicative X) := β€ΉTopologicalSpace Xβ€Ί instance [DiscreteTopology X] : DiscreteTopology (Additive X) := β€ΉDiscreteTopology Xβ€Ί instance [DiscreteTopology X] : DiscreteTopology (Multiplicative X) := β€ΉDiscreteTopology Xβ€Ί theorem continuous_ofMul : Continuous (ofMul : X β†’ Additive X) := continuous_id #align continuous_of_mul continuous_ofMul theorem continuous_toMul : Continuous (toMul : Additive X β†’ X) := continuous_id #align continuous_to_mul continuous_toMul theorem continuous_ofAdd : Continuous (ofAdd : X β†’ Multiplicative X) := continuous_id #align continuous_of_add continuous_ofAdd theorem continuous_toAdd : Continuous (toAdd : Multiplicative X β†’ X) := continuous_id #align continuous_to_add continuous_toAdd theorem isOpenMap_ofMul : IsOpenMap (ofMul : X β†’ Additive X) := IsOpenMap.id #align is_open_map_of_mul isOpenMap_ofMul theorem isOpenMap_toMul : IsOpenMap (toMul : Additive X β†’ X) := IsOpenMap.id #align is_open_map_to_mul isOpenMap_toMul theorem isOpenMap_ofAdd : IsOpenMap (ofAdd : X β†’ Multiplicative X) := IsOpenMap.id #align is_open_map_of_add isOpenMap_ofAdd theorem isOpenMap_toAdd : IsOpenMap (toAdd : Multiplicative X β†’ X) := IsOpenMap.id #align is_open_map_to_add isOpenMap_toAdd theorem isClosedMap_ofMul : IsClosedMap (ofMul : X β†’ Additive X) := IsClosedMap.id #align is_closed_map_of_mul isClosedMap_ofMul theorem isClosedMap_toMul : IsClosedMap (toMul : Additive X β†’ X) := IsClosedMap.id #align is_closed_map_to_mul isClosedMap_toMul theorem isClosedMap_ofAdd : IsClosedMap (ofAdd : X β†’ Multiplicative X) := IsClosedMap.id #align is_closed_map_of_add isClosedMap_ofAdd theorem isClosedMap_toAdd : IsClosedMap (toAdd : Multiplicative X β†’ X) := IsClosedMap.id #align is_closed_map_to_add isClosedMap_toAdd theorem nhds_ofMul (x : X) : 𝓝 (ofMul x) = map ofMul (𝓝 x) := rfl #align nhds_of_mul nhds_ofMul theorem nhds_ofAdd (x : X) : 𝓝 (ofAdd x) = map ofAdd (𝓝 x) := rfl #align nhds_of_add nhds_ofAdd theorem nhds_toMul (x : Additive X) : 𝓝 (toMul x) = map toMul (𝓝 x) := rfl #align nhds_to_mul nhds_toMul theorem nhds_toAdd (x : Multiplicative X) : 𝓝 (toAdd x) = map toAdd (𝓝 x) := rfl #align nhds_to_add nhds_toAdd end section variable [TopologicalSpace X] open OrderDual instance : TopologicalSpace Xα΅’α΅ˆ := β€ΉTopologicalSpace Xβ€Ί instance [DiscreteTopology X] : DiscreteTopology Xα΅’α΅ˆ := β€ΉDiscreteTopology Xβ€Ί theorem continuous_toDual : Continuous (toDual : X β†’ Xα΅’α΅ˆ) := continuous_id #align continuous_to_dual continuous_toDual theorem continuous_ofDual : Continuous (ofDual : Xα΅’α΅ˆ β†’ X) := continuous_id #align continuous_of_dual continuous_ofDual theorem isOpenMap_toDual : IsOpenMap (toDual : X β†’ Xα΅’α΅ˆ) := IsOpenMap.id #align is_open_map_to_dual isOpenMap_toDual theorem isOpenMap_ofDual : IsOpenMap (ofDual : Xα΅’α΅ˆ β†’ X) := IsOpenMap.id #align is_open_map_of_dual isOpenMap_ofDual theorem isClosedMap_toDual : IsClosedMap (toDual : X β†’ Xα΅’α΅ˆ) := IsClosedMap.id #align is_closed_map_to_dual isClosedMap_toDual theorem isClosedMap_ofDual : IsClosedMap (ofDual : Xα΅’α΅ˆ β†’ X) := IsClosedMap.id #align is_closed_map_of_dual isClosedMap_ofDual theorem nhds_toDual (x : X) : 𝓝 (toDual x) = map toDual (𝓝 x) := rfl #align nhds_to_dual nhds_toDual theorem nhds_ofDual (x : X) : 𝓝 (ofDual x) = map ofDual (𝓝 x) := rfl #align nhds_of_dual nhds_ofDual end theorem Quotient.preimage_mem_nhds [TopologicalSpace X] [s : Setoid X] {V : Set <| Quotient s} {x : X} (hs : V ∈ 𝓝 (Quotient.mk' x)) : Quotient.mk' ⁻¹' V ∈ 𝓝 x := preimage_nhds_coinduced hs #align quotient.preimage_mem_nhds Quotient.preimage_mem_nhds theorem Dense.quotient [Setoid X] [TopologicalSpace X] {s : Set X} (H : Dense s) : Dense (Quotient.mk' '' s) := Quotient.surjective_Quotient_mk''.denseRange.dense_image continuous_coinduced_rng H #align dense.quotient Dense.quotient theorem DenseRange.quotient [Setoid X] [TopologicalSpace X] {f : Y β†’ X} (hf : DenseRange f) : DenseRange (Quotient.mk' ∘ f) := Quotient.surjective_Quotient_mk''.denseRange.comp hf continuous_coinduced_rng #align dense_range.quotient DenseRange.quotient theorem continuous_map_of_le {Ξ± : Type*} [TopologicalSpace Ξ±] {s t : Setoid Ξ±} (h : s ≀ t) : Continuous (Setoid.map_of_le h) := continuous_coinduced_rng theorem continuous_map_sInf {Ξ± : Type*} [TopologicalSpace Ξ±] {S : Set (Setoid Ξ±)} {s : Setoid Ξ±} (h : s ∈ S) : Continuous (Setoid.map_sInf h) := continuous_coinduced_rng instance {p : X β†’ Prop} [TopologicalSpace X] [DiscreteTopology X] : DiscreteTopology (Subtype p) := ⟨bot_unique fun s _ => ⟨(↑) '' s, isOpen_discrete _, preimage_image_eq _ Subtype.val_injective⟩⟩ instance Sum.discreteTopology [TopologicalSpace X] [TopologicalSpace Y] [h : DiscreteTopology X] [hY : DiscreteTopology Y] : DiscreteTopology (X βŠ• Y) := ⟨sup_eq_bot_iff.2 <| by simp [h.eq_bot, hY.eq_bot]⟩ #align sum.discrete_topology Sum.discreteTopology instance Sigma.discreteTopology {ΞΉ : Type*} {Y : ΞΉ β†’ Type v} [βˆ€ i, TopologicalSpace (Y i)] [h : βˆ€ i, DiscreteTopology (Y i)] : DiscreteTopology (Sigma Y) := ⟨iSup_eq_bot.2 fun _ => by simp only [(h _).eq_bot, coinduced_bot]⟩ #align sigma.discrete_topology Sigma.discreteTopology def CofiniteTopology (X : Type*) := X #align cofinite_topology CofiniteTopology section Sigma variable {ΞΉ ΞΊ : Type*} {Οƒ : ΞΉ β†’ Type*} {Ο„ : ΞΊ β†’ Type*} [βˆ€ i, TopologicalSpace (Οƒ i)] [βˆ€ k, TopologicalSpace (Ο„ k)] [TopologicalSpace X] @[continuity] theorem continuous_sigmaMk {i : ΞΉ} : Continuous (@Sigma.mk ΞΉ Οƒ i) := continuous_iSup_rng continuous_coinduced_rng #align continuous_sigma_mk continuous_sigmaMk -- Porting note: the proof was `by simp only [isOpen_iSup_iff, isOpen_coinduced]` theorem isOpen_sigma_iff {s : Set (Sigma Οƒ)} : IsOpen s ↔ βˆ€ i, IsOpen (Sigma.mk i ⁻¹' s) := by delta instTopologicalSpaceSigma rw [isOpen_iSup_iff] rfl #align is_open_sigma_iff isOpen_sigma_iff theorem isClosed_sigma_iff {s : Set (Sigma Οƒ)} : IsClosed s ↔ βˆ€ i, IsClosed (Sigma.mk i ⁻¹' s) := by simp only [← isOpen_compl_iff, isOpen_sigma_iff, preimage_compl] #align is_closed_sigma_iff isClosed_sigma_iff theorem isOpenMap_sigmaMk {i : ΞΉ} : IsOpenMap (@Sigma.mk ΞΉ Οƒ i) := by intro s hs rw [isOpen_sigma_iff] intro j rcases eq_or_ne j i with (rfl | hne) Β· rwa [preimage_image_eq _ sigma_mk_injective] Β· rw [preimage_image_sigmaMk_of_ne hne] exact isOpen_empty #align is_open_map_sigma_mk isOpenMap_sigmaMk theorem isOpen_range_sigmaMk {i : ΞΉ} : IsOpen (range (@Sigma.mk ΞΉ Οƒ i)) := isOpenMap_sigmaMk.isOpen_range #align is_open_range_sigma_mk isOpen_range_sigmaMk
Mathlib/Topology/Constructions.lean
1,605
1,612
theorem isClosedMap_sigmaMk {i : ΞΉ} : IsClosedMap (@Sigma.mk ΞΉ Οƒ i) := by
intro s hs rw [isClosed_sigma_iff] intro j rcases eq_or_ne j i with (rfl | hne) Β· rwa [preimage_image_eq _ sigma_mk_injective] Β· rw [preimage_image_sigmaMk_of_ne hne] exact isClosed_empty
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 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] #align fintype.linear_independent_iff' Fintype.linearIndependent_iff' theorem Fintype.not_linearIndependent_iff [Fintype ΞΉ] : Β¬LinearIndependent R v ↔ βˆƒ g : ΞΉ β†’ R, βˆ‘ i, g i β€’ v i = 0 ∧ βˆƒ i, g i β‰  0 := by simpa using not_iff_not.2 Fintype.linearIndependent_iff #align fintype.not_linear_independent_iff Fintype.not_linearIndependent_iff theorem linearIndependent_empty_type [IsEmpty ΞΉ] : LinearIndependent R v := linearIndependent_iff.mpr fun v _hv => Subsingleton.elim v 0 #align linear_independent_empty_type linearIndependent_empty_type theorem LinearIndependent.ne_zero [Nontrivial R] (i : ΞΉ) (hv : LinearIndependent R v) : v i β‰  0 := fun h => zero_ne_one' R <| Eq.symm (by suffices (Finsupp.single i 1 : ΞΉ β†’β‚€ R) i = 0 by simpa rw [linearIndependent_iff.1 hv (Finsupp.single i 1)] Β· simp Β· simp [h]) #align linear_independent.ne_zero LinearIndependent.ne_zero lemma LinearIndependent.eq_zero_of_pair {x y : M} (h : LinearIndependent R ![x, y]) {s t : R} (h' : s β€’ x + t β€’ y = 0) : s = 0 ∧ t = 0 := by have := linearIndependent_iff'.1 h Finset.univ ![s, t] simp only [Fin.sum_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons, h', Finset.mem_univ, forall_true_left] at this exact ⟨this 0, this 1⟩ lemma LinearIndependent.pair_iff {x y : M} : LinearIndependent R ![x, y] ↔ βˆ€ (s t : R), s β€’ x + t β€’ y = 0 β†’ s = 0 ∧ t = 0 := by refine ⟨fun h s t hst ↦ h.eq_zero_of_pair hst, fun h ↦ ?_⟩ apply Fintype.linearIndependent_iff.2 intro g hg simp only [Fin.sum_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons] at hg intro i fin_cases i exacts [(h _ _ hg).1, (h _ _ hg).2] theorem LinearIndependent.comp (h : LinearIndependent R v) (f : ΞΉ' β†’ ΞΉ) (hf : Injective f) : LinearIndependent R (v ∘ f) := by rw [linearIndependent_iff, Finsupp.total_comp] intro l hl have h_map_domain : βˆ€ x, (Finsupp.mapDomain f l) (f x) = 0 := by rw [linearIndependent_iff.1 h (Finsupp.mapDomain f l) hl]; simp ext x convert h_map_domain x rw [Finsupp.mapDomain_apply hf] #align linear_independent.comp LinearIndependent.comp theorem linearIndependent_iff_finset_linearIndependent : LinearIndependent R v ↔ βˆ€ (s : Finset ΞΉ), LinearIndependent R (v ∘ (Subtype.val : s β†’ ΞΉ)) := ⟨fun H _ ↦ H.comp _ Subtype.val_injective, fun H ↦ linearIndependent_iff'.2 fun s g hg i hi ↦ Fintype.linearIndependent_iff.1 (H s) (g ∘ Subtype.val) (hg β–Έ Finset.sum_attach s fun j ↦ g j β€’ v j) ⟨i, hi⟩⟩ theorem LinearIndependent.coe_range (i : LinearIndependent R v) : LinearIndependent R ((↑) : range v β†’ M) := by simpa using i.comp _ (rangeSplitting_injective v) #align linear_independent.coe_range LinearIndependent.coe_range theorem LinearIndependent.map (hv : LinearIndependent R v) {f : M β†’β‚—[R] M'} (hf_inj : Disjoint (span R (range v)) (LinearMap.ker f)) : LinearIndependent R (f ∘ v) := by rw [disjoint_iff_inf_le, ← Set.image_univ, Finsupp.span_image_eq_map_total, map_inf_eq_map_inf_comap, map_le_iff_le_comap, comap_bot, Finsupp.supported_univ, top_inf_eq] at hf_inj unfold LinearIndependent at hv ⊒ rw [hv, le_bot_iff] at hf_inj haveI : Inhabited M := ⟨0⟩ rw [Finsupp.total_comp, Finsupp.lmapDomain_total _ _ f, LinearMap.ker_comp, hf_inj] exact fun _ => rfl #align linear_independent.map LinearIndependent.map theorem Submodule.range_ker_disjoint {f : M β†’β‚—[R] M'} (hv : LinearIndependent R (f ∘ v)) : Disjoint (span R (range v)) (LinearMap.ker f) := by rw [LinearIndependent, Finsupp.total_comp, Finsupp.lmapDomain_total R _ f (fun _ ↦ rfl), LinearMap.ker_comp] at hv rw [disjoint_iff_inf_le, ← Set.image_univ, Finsupp.span_image_eq_map_total, map_inf_eq_map_inf_comap, hv, inf_bot_eq, map_bot] theorem LinearIndependent.map' (hv : LinearIndependent R v) (f : M β†’β‚—[R] M') (hf_inj : LinearMap.ker f = βŠ₯) : LinearIndependent R (f ∘ v) := hv.map <| by simp [hf_inj] #align linear_independent.map' LinearIndependent.map' theorem LinearIndependent.map_of_injective_injective {R' : Type*} {M' : Type*} [Semiring R'] [AddCommMonoid M'] [Module R' M'] (hv : LinearIndependent R v) (i : R' β†’ R) (j : M β†’+ M') (hi : βˆ€ r, i r = 0 β†’ r = 0) (hj : βˆ€ m, j m = 0 β†’ m = 0) (hc : βˆ€ (r : R') (m : M), j (i r β€’ m) = r β€’ j m) : LinearIndependent R' (j ∘ v) := by rw [linearIndependent_iff'] at hv ⊒ intro S r' H s hs simp_rw [comp_apply, ← hc, ← map_sum] at H exact hi _ <| hv _ _ (hj _ H) s hs theorem LinearIndependent.map_of_surjective_injective {R' : Type*} {M' : Type*} [Semiring R'] [AddCommMonoid M'] [Module R' M'] (hv : LinearIndependent R v) (i : ZeroHom R R') (j : M β†’+ M') (hi : Surjective i) (hj : βˆ€ m, j m = 0 β†’ m = 0) (hc : βˆ€ (r : R) (m : M), j (r β€’ m) = i r β€’ j m) : LinearIndependent R' (j ∘ v) := by obtain ⟨i', hi'⟩ := hi.hasRightInverse refine hv.map_of_injective_injective i' j (fun _ h ↦ ?_) hj fun r m ↦ ?_ Β· apply_fun i at h rwa [hi', i.map_zero] at h rw [hc (i' r) m, hi'] theorem LinearIndependent.of_comp (f : M β†’β‚—[R] M') (hfv : LinearIndependent R (f ∘ v)) : LinearIndependent R v := linearIndependent_iff'.2 fun s g hg i his => have : (βˆ‘ i ∈ s, g i β€’ f (v i)) = 0 := by simp_rw [← map_smul, ← map_sum, hg, f.map_zero] linearIndependent_iff'.1 hfv s g this i his #align linear_independent.of_comp LinearIndependent.of_comp protected theorem LinearMap.linearIndependent_iff (f : M β†’β‚—[R] M') (hf_inj : LinearMap.ker f = βŠ₯) : LinearIndependent R (f ∘ v) ↔ LinearIndependent R v := ⟨fun h => h.of_comp f, fun h => h.map <| by simp only [hf_inj, disjoint_bot_right]⟩ #align linear_map.linear_independent_iff LinearMap.linearIndependent_iff @[nontriviality] theorem linearIndependent_of_subsingleton [Subsingleton R] : LinearIndependent R v := linearIndependent_iff.2 fun _l _hl => Subsingleton.elim _ _ #align linear_independent_of_subsingleton linearIndependent_of_subsingleton theorem linearIndependent_equiv (e : ΞΉ ≃ ΞΉ') {f : ΞΉ' β†’ M} : LinearIndependent R (f ∘ e) ↔ LinearIndependent R f := ⟨fun h => Function.comp_id f β–Έ e.self_comp_symm β–Έ h.comp _ e.symm.injective, fun h => h.comp _ e.injective⟩ #align linear_independent_equiv linearIndependent_equiv theorem linearIndependent_equiv' (e : ΞΉ ≃ ΞΉ') {f : ΞΉ' β†’ M} {g : ΞΉ β†’ M} (h : f ∘ e = g) : LinearIndependent R g ↔ LinearIndependent R f := h β–Έ linearIndependent_equiv e #align linear_independent_equiv' linearIndependent_equiv' theorem linearIndependent_subtype_range {ΞΉ} {f : ΞΉ β†’ M} (hf : Injective f) : LinearIndependent R ((↑) : range f β†’ M) ↔ LinearIndependent R f := Iff.symm <| linearIndependent_equiv' (Equiv.ofInjective f hf) rfl #align linear_independent_subtype_range linearIndependent_subtype_range alias ⟨LinearIndependent.of_subtype_range, _⟩ := linearIndependent_subtype_range #align linear_independent.of_subtype_range LinearIndependent.of_subtype_range theorem linearIndependent_image {ΞΉ} {s : Set ΞΉ} {f : ΞΉ β†’ M} (hf : Set.InjOn f s) : (LinearIndependent R fun x : s => f x) ↔ LinearIndependent R fun x : f '' s => (x : M) := linearIndependent_equiv' (Equiv.Set.imageOfInjOn _ _ hf) rfl #align linear_independent_image linearIndependent_image theorem linearIndependent_span (hs : LinearIndependent R v) : LinearIndependent R (M := span R (range v)) (fun i : ΞΉ => ⟨v i, subset_span (mem_range_self i)⟩) := LinearIndependent.of_comp (span R (range v)).subtype hs #align linear_independent_span linearIndependent_span theorem LinearIndependent.fin_cons' {m : β„•} (x : M) (v : Fin m β†’ M) (hli : LinearIndependent R v) (x_ortho : βˆ€ (c : R) (y : Submodule.span R (Set.range v)), c β€’ x + y = (0 : M) β†’ c = 0) : LinearIndependent R (Fin.cons x v : Fin m.succ β†’ M) := by rw [Fintype.linearIndependent_iff] at hli ⊒ rintro g total_eq j simp_rw [Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ] at total_eq have : g 0 = 0 := by refine x_ortho (g 0) βŸ¨βˆ‘ i : Fin m, g i.succ β€’ v i, ?_⟩ total_eq exact sum_mem fun i _ => smul_mem _ _ (subset_span ⟨i, rfl⟩) rw [this, zero_smul, zero_add] at total_eq exact Fin.cases this (hli _ total_eq) j #align linear_independent.fin_cons' LinearIndependent.fin_cons' theorem LinearIndependent.restrict_scalars [Semiring K] [SMulWithZero R K] [Module K M] [IsScalarTower R K M] (hinj : Function.Injective fun r : R => r β€’ (1 : K)) (li : LinearIndependent K v) : LinearIndependent R v := by refine linearIndependent_iff'.mpr fun s g hg i hi => hinj ?_ dsimp only; rw [zero_smul] refine (linearIndependent_iff'.mp li : _) _ (g Β· β€’ (1:K)) ?_ i hi simp_rw [smul_assoc, one_smul] exact hg #align linear_independent.restrict_scalars LinearIndependent.restrict_scalars theorem linearIndependent_finset_map_embedding_subtype (s : Set M) (li : LinearIndependent R ((↑) : s β†’ M)) (t : Finset s) : LinearIndependent R ((↑) : Finset.map (Embedding.subtype s) t β†’ M) := by let f : t.map (Embedding.subtype s) β†’ s := fun x => ⟨x.1, by obtain ⟨x, h⟩ := x rw [Finset.mem_map] at h obtain ⟨a, _ha, rfl⟩ := h simp only [Subtype.coe_prop, Embedding.coe_subtype]⟩ convert LinearIndependent.comp li f ?_ rintro ⟨x, hx⟩ ⟨y, hy⟩ rw [Finset.mem_map] at hx hy obtain ⟨a, _ha, rfl⟩ := hx obtain ⟨b, _hb, rfl⟩ := hy simp only [f, imp_self, Subtype.mk_eq_mk] #align linear_independent_finset_map_embedding_subtype linearIndependent_finset_map_embedding_subtype
Mathlib/LinearAlgebra/LinearIndependent.lean
419
427
theorem linearIndependent_bounded_of_finset_linearIndependent_bounded {n : β„•} (H : βˆ€ s : Finset M, (LinearIndependent R fun i : s => (i : M)) β†’ s.card ≀ n) : βˆ€ s : Set M, LinearIndependent R ((↑) : s β†’ M) β†’ #s ≀ n := by
intro s li apply Cardinal.card_le_of intro t rw [← Finset.card_map (Embedding.subtype s)] apply H apply linearIndependent_finset_map_embedding_subtype _ li
import Mathlib.CategoryTheory.EpiMono import Mathlib.CategoryTheory.Limits.Shapes.StrongEpi import Mathlib.CategoryTheory.LiftingProperties.Adjunction #align_import category_theory.functor.epi_mono from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" open CategoryTheory universe v₁ vβ‚‚ v₃ u₁ uβ‚‚ u₃ namespace CategoryTheory.Functor variable {C : Type u₁} [Category.{v₁} C] {D : Type uβ‚‚} [Category.{vβ‚‚} D] {E : Type u₃} [Category.{v₃} E] class PreservesMonomorphisms (F : C β₯€ D) : Prop where preserves : βˆ€ {X Y : C} (f : X ⟢ Y) [Mono f], Mono (F.map f) #align category_theory.functor.preserves_monomorphisms CategoryTheory.Functor.PreservesMonomorphisms instance map_mono (F : C β₯€ D) [PreservesMonomorphisms F] {X Y : C} (f : X ⟢ Y) [Mono f] : Mono (F.map f) := PreservesMonomorphisms.preserves f #align category_theory.functor.map_mono CategoryTheory.Functor.map_mono class PreservesEpimorphisms (F : C β₯€ D) : Prop where preserves : βˆ€ {X Y : C} (f : X ⟢ Y) [Epi f], Epi (F.map f) #align category_theory.functor.preserves_epimorphisms CategoryTheory.Functor.PreservesEpimorphisms instance map_epi (F : C β₯€ D) [PreservesEpimorphisms F] {X Y : C} (f : X ⟢ Y) [Epi f] : Epi (F.map f) := PreservesEpimorphisms.preserves f #align category_theory.functor.map_epi CategoryTheory.Functor.map_epi class ReflectsMonomorphisms (F : C β₯€ D) : Prop where reflects : βˆ€ {X Y : C} (f : X ⟢ Y), Mono (F.map f) β†’ Mono f #align category_theory.functor.reflects_monomorphisms CategoryTheory.Functor.ReflectsMonomorphisms theorem mono_of_mono_map (F : C β₯€ D) [ReflectsMonomorphisms F] {X Y : C} {f : X ⟢ Y} (h : Mono (F.map f)) : Mono f := ReflectsMonomorphisms.reflects f h #align category_theory.functor.mono_of_mono_map CategoryTheory.Functor.mono_of_mono_map class ReflectsEpimorphisms (F : C β₯€ D) : Prop where reflects : βˆ€ {X Y : C} (f : X ⟢ Y), Epi (F.map f) β†’ Epi f #align category_theory.functor.reflects_epimorphisms CategoryTheory.Functor.ReflectsEpimorphisms theorem epi_of_epi_map (F : C β₯€ D) [ReflectsEpimorphisms F] {X Y : C} {f : X ⟢ Y} (h : Epi (F.map f)) : Epi f := ReflectsEpimorphisms.reflects f h #align category_theory.functor.epi_of_epi_map CategoryTheory.Functor.epi_of_epi_map instance preservesMonomorphisms_comp (F : C β₯€ D) (G : D β₯€ E) [PreservesMonomorphisms F] [PreservesMonomorphisms G] : PreservesMonomorphisms (F β‹™ G) where preserves f h := by rw [comp_map] exact inferInstance #align category_theory.functor.preserves_monomorphisms_comp CategoryTheory.Functor.preservesMonomorphisms_comp instance preservesEpimorphisms_comp (F : C β₯€ D) (G : D β₯€ E) [PreservesEpimorphisms F] [PreservesEpimorphisms G] : PreservesEpimorphisms (F β‹™ G) where preserves f h := by rw [comp_map] exact inferInstance #align category_theory.functor.preserves_epimorphisms_comp CategoryTheory.Functor.preservesEpimorphisms_comp instance reflectsMonomorphisms_comp (F : C β₯€ D) (G : D β₯€ E) [ReflectsMonomorphisms F] [ReflectsMonomorphisms G] : ReflectsMonomorphisms (F β‹™ G) where reflects _ h := F.mono_of_mono_map (G.mono_of_mono_map h) #align category_theory.functor.reflects_monomorphisms_comp CategoryTheory.Functor.reflectsMonomorphisms_comp instance reflectsEpimorphisms_comp (F : C β₯€ D) (G : D β₯€ E) [ReflectsEpimorphisms F] [ReflectsEpimorphisms G] : ReflectsEpimorphisms (F β‹™ G) where reflects _ h := F.epi_of_epi_map (G.epi_of_epi_map h) #align category_theory.functor.reflects_epimorphisms_comp CategoryTheory.Functor.reflectsEpimorphisms_comp theorem preservesEpimorphisms_of_preserves_of_reflects (F : C β₯€ D) (G : D β₯€ E) [PreservesEpimorphisms (F β‹™ G)] [ReflectsEpimorphisms G] : PreservesEpimorphisms F := ⟨fun f _ => G.epi_of_epi_map <| show Epi ((F β‹™ G).map f) from inferInstance⟩ #align category_theory.functor.preserves_epimorphisms_of_preserves_of_reflects CategoryTheory.Functor.preservesEpimorphisms_of_preserves_of_reflects theorem preservesMonomorphisms_of_preserves_of_reflects (F : C β₯€ D) (G : D β₯€ E) [PreservesMonomorphisms (F β‹™ G)] [ReflectsMonomorphisms G] : PreservesMonomorphisms F := ⟨fun f _ => G.mono_of_mono_map <| show Mono ((F β‹™ G).map f) from inferInstance⟩ #align category_theory.functor.preserves_monomorphisms_of_preserves_of_reflects CategoryTheory.Functor.preservesMonomorphisms_of_preserves_of_reflects theorem reflectsEpimorphisms_of_preserves_of_reflects (F : C β₯€ D) (G : D β₯€ E) [PreservesEpimorphisms G] [ReflectsEpimorphisms (F β‹™ G)] : ReflectsEpimorphisms F := ⟨fun f _ => (F β‹™ G).epi_of_epi_map <| show Epi (G.map (F.map f)) from inferInstance⟩ #align category_theory.functor.reflects_epimorphisms_of_preserves_of_reflects CategoryTheory.Functor.reflectsEpimorphisms_of_preserves_of_reflects theorem reflectsMonomorphisms_of_preserves_of_reflects (F : C β₯€ D) (G : D β₯€ E) [PreservesMonomorphisms G] [ReflectsMonomorphisms (F β‹™ G)] : ReflectsMonomorphisms F := ⟨fun f _ => (F β‹™ G).mono_of_mono_map <| show Mono (G.map (F.map f)) from inferInstance⟩ #align category_theory.functor.reflects_monomorphisms_of_preserves_of_reflects CategoryTheory.Functor.reflectsMonomorphisms_of_preserves_of_reflects theorem preservesMonomorphisms.of_iso {F G : C β₯€ D} [PreservesMonomorphisms F] (Ξ± : F β‰… G) : PreservesMonomorphisms G := { preserves := fun {X} {Y} f h => by haveI : Mono (F.map f ≫ (Ξ±.app Y).hom) := mono_comp _ _ convert (mono_comp _ _ : Mono ((Ξ±.app X).inv ≫ F.map f ≫ (Ξ±.app Y).hom)) rw [Iso.eq_inv_comp, Iso.app_hom, Iso.app_hom, NatTrans.naturality] } #align category_theory.functor.preserves_monomorphisms.of_iso CategoryTheory.Functor.preservesMonomorphisms.of_iso theorem preservesMonomorphisms.iso_iff {F G : C β₯€ D} (Ξ± : F β‰… G) : PreservesMonomorphisms F ↔ PreservesMonomorphisms G := ⟨fun _ => preservesMonomorphisms.of_iso Ξ±, fun _ => preservesMonomorphisms.of_iso Ξ±.symm⟩ #align category_theory.functor.preserves_monomorphisms.iso_iff CategoryTheory.Functor.preservesMonomorphisms.iso_iff theorem preservesEpimorphisms.of_iso {F G : C β₯€ D} [PreservesEpimorphisms F] (Ξ± : F β‰… G) : PreservesEpimorphisms G := { preserves := fun {X} {Y} f h => by haveI : Epi (F.map f ≫ (Ξ±.app Y).hom) := epi_comp _ _ convert (epi_comp _ _ : Epi ((Ξ±.app X).inv ≫ F.map f ≫ (Ξ±.app Y).hom)) rw [Iso.eq_inv_comp, Iso.app_hom, Iso.app_hom, NatTrans.naturality] } #align category_theory.functor.preserves_epimorphisms.of_iso CategoryTheory.Functor.preservesEpimorphisms.of_iso theorem preservesEpimorphisms.iso_iff {F G : C β₯€ D} (Ξ± : F β‰… G) : PreservesEpimorphisms F ↔ PreservesEpimorphisms G := ⟨fun _ => preservesEpimorphisms.of_iso Ξ±, fun _ => preservesEpimorphisms.of_iso Ξ±.symm⟩ #align category_theory.functor.preserves_epimorphisms.iso_iff CategoryTheory.Functor.preservesEpimorphisms.iso_iff theorem reflectsMonomorphisms.of_iso {F G : C β₯€ D} [ReflectsMonomorphisms F] (Ξ± : F β‰… G) : ReflectsMonomorphisms G := { reflects := fun {X} {Y} f h => by apply F.mono_of_mono_map haveI : Mono (G.map f ≫ (Ξ±.app Y).inv) := mono_comp _ _ convert (mono_comp _ _ : Mono ((Ξ±.app X).hom ≫ G.map f ≫ (Ξ±.app Y).inv)) rw [← Category.assoc, Iso.eq_comp_inv, Iso.app_hom, Iso.app_hom, NatTrans.naturality] } #align category_theory.functor.reflects_monomorphisms.of_iso CategoryTheory.Functor.reflectsMonomorphisms.of_iso theorem reflectsMonomorphisms.iso_iff {F G : C β₯€ D} (Ξ± : F β‰… G) : ReflectsMonomorphisms F ↔ ReflectsMonomorphisms G := ⟨fun _ => reflectsMonomorphisms.of_iso Ξ±, fun _ => reflectsMonomorphisms.of_iso Ξ±.symm⟩ #align category_theory.functor.reflects_monomorphisms.iso_iff CategoryTheory.Functor.reflectsMonomorphisms.iso_iff theorem reflectsEpimorphisms.of_iso {F G : C β₯€ D} [ReflectsEpimorphisms F] (Ξ± : F β‰… G) : ReflectsEpimorphisms G := { reflects := fun {X} {Y} f h => by apply F.epi_of_epi_map haveI : Epi (G.map f ≫ (Ξ±.app Y).inv) := epi_comp _ _ convert (epi_comp _ _ : Epi ((Ξ±.app X).hom ≫ G.map f ≫ (Ξ±.app Y).inv)) rw [← Category.assoc, Iso.eq_comp_inv, Iso.app_hom, Iso.app_hom, NatTrans.naturality] } #align category_theory.functor.reflects_epimorphisms.of_iso CategoryTheory.Functor.reflectsEpimorphisms.of_iso theorem reflectsEpimorphisms.iso_iff {F G : C β₯€ D} (Ξ± : F β‰… G) : ReflectsEpimorphisms F ↔ ReflectsEpimorphisms G := ⟨fun _ => reflectsEpimorphisms.of_iso Ξ±, fun _ => reflectsEpimorphisms.of_iso Ξ±.symm⟩ #align category_theory.functor.reflects_epimorphisms.iso_iff CategoryTheory.Functor.reflectsEpimorphisms.iso_iff theorem preservesEpimorphsisms_of_adjunction {F : C β₯€ D} {G : D β₯€ C} (adj : F ⊣ G) : PreservesEpimorphisms F := { preserves := fun {X} {Y} f hf => ⟨by intro Z g h H replace H := congr_arg (adj.homEquiv X Z) H rwa [adj.homEquiv_naturality_left, adj.homEquiv_naturality_left, cancel_epi, Equiv.apply_eq_iff_eq] at H⟩ } #align category_theory.functor.preserves_epimorphsisms_of_adjunction CategoryTheory.Functor.preservesEpimorphsisms_of_adjunction instance (priority := 100) preservesEpimorphisms_of_isLeftAdjoint (F : C β₯€ D) [IsLeftAdjoint F] : PreservesEpimorphisms F := preservesEpimorphsisms_of_adjunction (Adjunction.ofIsLeftAdjoint F) #align category_theory.functor.preserves_epimorphisms_of_is_left_adjoint CategoryTheory.Functor.preservesEpimorphisms_of_isLeftAdjoint theorem preservesMonomorphisms_of_adjunction {F : C β₯€ D} {G : D β₯€ C} (adj : F ⊣ G) : PreservesMonomorphisms G := { preserves := fun {X} {Y} f hf => ⟨by intro Z g h H replace H := congr_arg (adj.homEquiv Z Y).symm H rwa [adj.homEquiv_naturality_right_symm, adj.homEquiv_naturality_right_symm, cancel_mono, Equiv.apply_eq_iff_eq] at H⟩ } #align category_theory.functor.preserves_monomorphisms_of_adjunction CategoryTheory.Functor.preservesMonomorphisms_of_adjunction instance (priority := 100) preservesMonomorphisms_of_isRightAdjoint (F : C β₯€ D) [IsRightAdjoint F] : PreservesMonomorphisms F := preservesMonomorphisms_of_adjunction (Adjunction.ofIsRightAdjoint F) #align category_theory.functor.preserves_monomorphisms_of_is_right_adjoint CategoryTheory.Functor.preservesMonomorphisms_of_isRightAdjoint instance (priority := 100) reflectsMonomorphisms_of_faithful (F : C β₯€ D) [Faithful F] : ReflectsMonomorphisms F where reflects {X} {Y} f hf := ⟨fun {Z} g h hgh => F.map_injective ((cancel_mono (F.map f)).1 (by rw [← F.map_comp, hgh, F.map_comp]))⟩ #align category_theory.functor.reflects_monomorphisms_of_faithful CategoryTheory.Functor.reflectsMonomorphisms_of_faithful instance (priority := 100) reflectsEpimorphisms_of_faithful (F : C β₯€ D) [Faithful F] : ReflectsEpimorphisms F where reflects {X} {Y} f hf := ⟨fun {Z} g h hgh => F.map_injective ((cancel_epi (F.map f)).1 (by rw [← F.map_comp, hgh, F.map_comp]))⟩ #align category_theory.functor.reflects_epimorphisms_of_faithful CategoryTheory.Functor.reflectsEpimorphisms_of_faithful section variable (F : C β₯€ D) {X Y : C} (f : X ⟢ Y) noncomputable def splitEpiEquiv [Full F] [Faithful F] : SplitEpi f ≃ SplitEpi (F.map f) where toFun f := f.map F invFun s := ⟨F.preimage s.section_, by apply F.map_injective simp only [map_comp, map_preimage, map_id] apply SplitEpi.id⟩ left_inv := by aesop_cat right_inv x := by aesop_cat #align category_theory.functor.split_epi_equiv CategoryTheory.Functor.splitEpiEquiv @[simp]
Mathlib/CategoryTheory/Functor/EpiMono.lean
235
240
theorem isSplitEpi_iff [Full F] [Faithful F] : IsSplitEpi (F.map f) ↔ IsSplitEpi f := by
constructor Β· intro h exact IsSplitEpi.mk' ((splitEpiEquiv F f).invFun h.exists_splitEpi.some) Β· intro h exact IsSplitEpi.mk' ((splitEpiEquiv F f).toFun h.exists_splitEpi.some)
import Mathlib.MeasureTheory.Constructions.Pi import Mathlib.MeasureTheory.Integral.Lebesgue open scoped Classical ENNReal open Set Function Equiv Finset noncomputable section namespace MeasureTheory section LMarginal variable {Ξ΄ Ξ΄' : Type*} {Ο€ : Ξ΄ β†’ Type*} [βˆ€ x, MeasurableSpace (Ο€ x)] variable {ΞΌ : βˆ€ i, Measure (Ο€ i)} [βˆ€ i, SigmaFinite (ΞΌ i)] [DecidableEq Ξ΄] variable {s t : Finset Ξ΄} {f g : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞} {x y : βˆ€ i, Ο€ i} {i : Ξ΄} def lmarginal (ΞΌ : βˆ€ i, Measure (Ο€ i)) (s : Finset Ξ΄) (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (x : βˆ€ i, Ο€ i) : ℝβ‰₯0∞ := ∫⁻ y : βˆ€ i : s, Ο€ i, f (updateFinset x s y) βˆ‚Measure.pi fun i : s => ΞΌ i -- Note: this notation is not a binder. This is more convenient since it returns a function. @[inherit_doc] notation "βˆ«β‹―βˆ«β»_" s ", " f " βˆ‚" ΞΌ:70 => lmarginal ΞΌ s f @[inherit_doc] notation "βˆ«β‹―βˆ«β»_" s ", " f => lmarginal (fun _ ↦ volume) s f variable (ΞΌ) theorem _root_.Measurable.lmarginal (hf : Measurable f) : Measurable (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) := by refine Measurable.lintegral_prod_right ?_ refine hf.comp ?_ rw [measurable_pi_iff]; intro i by_cases hi : i ∈ s Β· simp [hi, updateFinset] exact measurable_pi_iff.1 measurable_snd _ Β· simp [hi, updateFinset] exact measurable_pi_iff.1 measurable_fst _ @[simp] theorem lmarginal_empty (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) : βˆ«β‹―βˆ«β»_βˆ…, f βˆ‚ΞΌ = f := by ext1 x simp_rw [lmarginal, Measure.pi_of_empty fun i : (βˆ… : Finset Ξ΄) => ΞΌ i] apply lintegral_dirac' exact Subsingleton.measurable theorem lmarginal_congr {x y : βˆ€ i, Ο€ i} (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (h : βˆ€ i βˆ‰ s, x i = y i) : (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) x = (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) y := by dsimp [lmarginal, updateFinset_def]; rcongr; exact h _ β€Ή_β€Ί theorem lmarginal_update_of_mem {i : Ξ΄} (hi : i ∈ s) (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (x : βˆ€ i, Ο€ i) (y : Ο€ i) : (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) (Function.update x i y) = (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) x := by apply lmarginal_congr intro j hj have : j β‰  i := by rintro rfl; exact hj hi apply update_noteq this theorem lmarginal_union (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (hf : Measurable f) (hst : Disjoint s t) : βˆ«β‹―βˆ«β»_s βˆͺ t, f βˆ‚ΞΌ = βˆ«β‹―βˆ«β»_s, βˆ«β‹―βˆ«β»_t, f βˆ‚ΞΌ βˆ‚ΞΌ := by ext1 x let e := MeasurableEquiv.piFinsetUnion Ο€ hst calc (βˆ«β‹―βˆ«β»_s βˆͺ t, f βˆ‚ΞΌ) x = ∫⁻ (y : (i : β†₯(s βˆͺ t)) β†’ Ο€ i), f (updateFinset x (s βˆͺ t) y) βˆ‚.pi fun i' : β†₯(s βˆͺ t) ↦ ΞΌ i' := rfl _ = ∫⁻ (y : ((i : s) β†’ Ο€ i) Γ— ((j : t) β†’ Ο€ j)), f (updateFinset x (s βˆͺ t) _) βˆ‚(Measure.pi fun i : s ↦ ΞΌ i).prod (.pi fun j : t ↦ ΞΌ j) := by rw [measurePreserving_piFinsetUnion hst ΞΌ |>.lintegral_map_equiv] _ = ∫⁻ (y : (i : s) β†’ Ο€ i), ∫⁻ (z : (j : t) β†’ Ο€ j), f (updateFinset x (s βˆͺ t) (e (y, z))) βˆ‚.pi fun j : t ↦ ΞΌ j βˆ‚.pi fun i : s ↦ ΞΌ i := by apply lintegral_prod apply Measurable.aemeasurable exact hf.comp <| measurable_updateFinset.comp e.measurable _ = (βˆ«β‹―βˆ«β»_s, βˆ«β‹―βˆ«β»_t, f βˆ‚ΞΌ βˆ‚ΞΌ) x := by simp_rw [lmarginal, updateFinset_updateFinset hst] rfl theorem lmarginal_union' (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (hf : Measurable f) {s t : Finset Ξ΄} (hst : Disjoint s t) : βˆ«β‹―βˆ«β»_s βˆͺ t, f βˆ‚ΞΌ = βˆ«β‹―βˆ«β»_t, βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ βˆ‚ΞΌ := by rw [Finset.union_comm, lmarginal_union ΞΌ f hf hst.symm] variable {ΞΌ} set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532 theorem lmarginal_singleton (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (i : Ξ΄) : βˆ«β‹―βˆ«β»_{i}, f βˆ‚ΞΌ = fun x => ∫⁻ xα΅’, f (Function.update x i xα΅’) βˆ‚ΞΌ i := by let Ξ± : Type _ := ({i} : Finset Ξ΄) let e := (MeasurableEquiv.piUnique fun j : Ξ± ↦ Ο€ j).symm ext1 x calc (βˆ«β‹―βˆ«β»_{i}, f βˆ‚ΞΌ) x = ∫⁻ (y : Ο€ (default : Ξ±)), f (updateFinset x {i} (e y)) βˆ‚ΞΌ (default : Ξ±) := by simp_rw [lmarginal, measurePreserving_piUnique (fun j : ({i} : Finset Ξ΄) ↦ ΞΌ j) |>.symm _ |>.lintegral_map_equiv] _ = ∫⁻ xα΅’, f (Function.update x i xα΅’) βˆ‚ΞΌ i := by simp [update_eq_updateFinset]; rfl theorem lmarginal_insert (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (hf : Measurable f) {i : Ξ΄} (hi : i βˆ‰ s) (x : βˆ€ i, Ο€ i) : (βˆ«β‹―βˆ«β»_insert i s, f βˆ‚ΞΌ) x = ∫⁻ xα΅’, (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) (Function.update x i xα΅’) βˆ‚ΞΌ i := by rw [Finset.insert_eq, lmarginal_union ΞΌ f hf (Finset.disjoint_singleton_left.mpr hi), lmarginal_singleton] theorem lmarginal_erase (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (hf : Measurable f) {i : Ξ΄} (hi : i ∈ s) (x : βˆ€ i, Ο€ i) : (βˆ«β‹―βˆ«β»_s, f βˆ‚ΞΌ) x = ∫⁻ xα΅’, (βˆ«β‹―βˆ«β»_(erase s i), f βˆ‚ΞΌ) (Function.update x i xα΅’) βˆ‚ΞΌ i := by simpa [insert_erase hi] using lmarginal_insert _ hf (not_mem_erase i s) x
Mathlib/MeasureTheory/Integral/Marginal.lean
172
176
theorem lmarginal_insert' (f : (βˆ€ i, Ο€ i) β†’ ℝβ‰₯0∞) (hf : Measurable f) {i : Ξ΄} (hi : i βˆ‰ s) : βˆ«β‹―βˆ«β»_insert i s, f βˆ‚ΞΌ = βˆ«β‹―βˆ«β»_s, (fun x ↦ ∫⁻ xα΅’, f (Function.update x i xα΅’) βˆ‚ΞΌ i) βˆ‚ΞΌ := by
rw [Finset.insert_eq, Finset.union_comm, lmarginal_union (s := s) ΞΌ f hf (Finset.disjoint_singleton_right.mpr hi), lmarginal_singleton]
import Mathlib.Data.List.Cycle import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a" open Equiv Equiv.Perm List variable {Ξ± : Type*} namespace Equiv.Perm section Fintype variable [Fintype Ξ±] [DecidableEq Ξ±] (p : Equiv.Perm Ξ±) (x : Ξ±) def toList : List Ξ± := (List.range (cycleOf p x).support.card).map fun k => (p ^ k) x #align equiv.perm.to_list Equiv.Perm.toList @[simp] theorem toList_one : toList (1 : Perm Ξ±) x = [] := by simp [toList, cycleOf_one] #align equiv.perm.to_list_one Equiv.Perm.toList_one @[simp]
Mathlib/GroupTheory/Perm/Cycle/Concrete.lean
225
225
theorem toList_eq_nil_iff {p : Perm Ξ±} {x} : toList p x = [] ↔ x βˆ‰ p.support := by
simp [toList]
import Mathlib.RingTheory.Valuation.Integers import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Integer import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.RingTheory.Bezout import Mathlib.Tactic.FieldSimp #align_import ring_theory.valuation.valuation_ring from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" universe u v w class ValuationRing (A : Type u) [CommRing A] [IsDomain A] : Prop where cond' : βˆ€ a b : A, βˆƒ c : A, a * c = b ∨ b * c = a #align valuation_ring ValuationRing -- Porting note: this lemma is needed since infer kinds are unsupported in Lean 4 lemma ValuationRing.cond {A : Type u} [CommRing A] [IsDomain A] [ValuationRing A] (a b : A) : βˆƒ c : A, a * c = b ∨ b * c = a := @ValuationRing.cond' A _ _ _ _ _ namespace ValuationRing section variable (A : Type u) [CommRing A] variable (K : Type v) [Field K] [Algebra A K] def ValueGroup : Type v := Quotient (MulAction.orbitRel AΛ£ K) #align valuation_ring.value_group ValuationRing.ValueGroup instance : Inhabited (ValueGroup A K) := ⟨Quotient.mk'' 0⟩ instance : LE (ValueGroup A K) := LE.mk fun x y => Quotient.liftOnβ‚‚' x y (fun a b => βˆƒ c : A, c β€’ b = a) (by rintro _ _ a b ⟨c, rfl⟩ ⟨d, rfl⟩; ext constructor Β· rintro ⟨e, he⟩; use (c⁻¹ : AΛ£) * e * d apply_fun fun t => c⁻¹ β€’ t at he simpa [mul_smul] using he Β· rintro ⟨e, he⟩; dsimp use c * e * (d⁻¹ : AΛ£) simp_rw [Units.smul_def, ← he, mul_smul] rw [← mul_smul _ _ b, Units.inv_mul, one_smul]) instance : Zero (ValueGroup A K) := ⟨Quotient.mk'' 0⟩ instance : One (ValueGroup A K) := ⟨Quotient.mk'' 1⟩ instance : Mul (ValueGroup A K) := Mul.mk fun x y => Quotient.liftOnβ‚‚' x y (fun a b => Quotient.mk'' <| a * b) (by rintro _ _ a b ⟨c, rfl⟩ ⟨d, rfl⟩ apply Quotient.sound' dsimp use c * d simp only [mul_smul, Algebra.smul_def, Units.smul_def, RingHom.map_mul, Units.val_mul] ring) instance : Inv (ValueGroup A K) := Inv.mk fun x => Quotient.liftOn' x (fun a => Quotient.mk'' a⁻¹) (by rintro _ a ⟨b, rfl⟩ apply Quotient.sound' use b⁻¹ dsimp rw [Units.smul_def, Units.smul_def, Algebra.smul_def, Algebra.smul_def, mul_inv, map_units_inv]) variable [IsDomain A] [ValuationRing A] [IsFractionRing A K] protected theorem le_total (a b : ValueGroup A K) : a ≀ b ∨ b ≀ a := by rcases a with ⟨a⟩; rcases b with ⟨b⟩ obtain ⟨xa, ya, hya, rfl⟩ : βˆƒ a b : A, _ := IsFractionRing.div_surjective a obtain ⟨xb, yb, hyb, rfl⟩ : βˆƒ a b : A, _ := IsFractionRing.div_surjective b have : (algebraMap A K) ya β‰  0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors hya have : (algebraMap A K) yb β‰  0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors hyb obtain ⟨c, h | h⟩ := ValuationRing.cond (xa * yb) (xb * ya) Β· right use c rw [Algebra.smul_def] field_simp simp only [← RingHom.map_mul, ← h]; congr 1; ring Β· left use c rw [Algebra.smul_def] field_simp simp only [← RingHom.map_mul, ← h]; congr 1; ring #align valuation_ring.le_total ValuationRing.le_total -- Porting note: it is much faster to split the instance `LinearOrderedCommGroupWithZero` -- into two parts noncomputable instance linearOrder : LinearOrder (ValueGroup A K) where le_refl := by rintro ⟨⟩; use 1; rw [one_smul] le_trans := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ ⟨e, rfl⟩ ⟨f, rfl⟩; use e * f; rw [mul_smul] le_antisymm := by rintro ⟨a⟩ ⟨b⟩ ⟨e, rfl⟩ ⟨f, hf⟩ by_cases hb : b = 0; Β· simp [hb] have : IsUnit e := by apply isUnit_of_dvd_one use f rw [mul_comm] rw [← mul_smul, Algebra.smul_def] at hf nth_rw 2 [← one_mul b] at hf rw [← (algebraMap A K).map_one] at hf exact IsFractionRing.injective _ _ (mul_right_cancelβ‚€ hb hf).symm apply Quotient.sound' exact ⟨this.unit, rfl⟩ le_total := ValuationRing.le_total _ _ decidableLE := by classical infer_instance noncomputable instance linearOrderedCommGroupWithZero : LinearOrderedCommGroupWithZero (ValueGroup A K) := { linearOrder .. with mul_assoc := by rintro ⟨a⟩ ⟨b⟩ ⟨c⟩; apply Quotient.sound'; rw [mul_assoc]; apply Setoid.refl' one_mul := by rintro ⟨a⟩; apply Quotient.sound'; rw [one_mul]; apply Setoid.refl' mul_one := by rintro ⟨a⟩; apply Quotient.sound'; rw [mul_one]; apply Setoid.refl' mul_comm := by rintro ⟨a⟩ ⟨b⟩; apply Quotient.sound'; rw [mul_comm]; apply Setoid.refl' mul_le_mul_left := by rintro ⟨a⟩ ⟨b⟩ ⟨c, rfl⟩ ⟨d⟩ use c; simp only [Algebra.smul_def]; ring zero_mul := by rintro ⟨a⟩; apply Quotient.sound'; rw [zero_mul]; apply Setoid.refl' mul_zero := by rintro ⟨a⟩; apply Quotient.sound'; rw [mul_zero]; apply Setoid.refl' zero_le_one := ⟨0, by rw [zero_smul]⟩ exists_pair_ne := by use 0, 1 intro c; obtain ⟨d, hd⟩ := Quotient.exact' c apply_fun fun t => d⁻¹ β€’ t at hd simp only [inv_smul_smul, smul_zero, one_ne_zero] at hd inv_zero := by apply Quotient.sound'; rw [inv_zero]; apply Setoid.refl' mul_inv_cancel := by rintro ⟨a⟩ ha apply Quotient.sound' use 1 simp only [one_smul, ne_eq] apply (mul_inv_cancel _).symm contrapose ha simp only [Classical.not_not] at ha ⊒ rw [ha] rfl } def valuation : Valuation K (ValueGroup A K) where toFun := Quotient.mk'' map_zero' := rfl map_one' := rfl map_mul' _ _ := rfl map_add_le_max' := by intro a b obtain ⟨xa, ya, hya, rfl⟩ : βˆƒ a b : A, _ := IsFractionRing.div_surjective a obtain ⟨xb, yb, hyb, rfl⟩ : βˆƒ a b : A, _ := IsFractionRing.div_surjective b have : (algebraMap A K) ya β‰  0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors hya have : (algebraMap A K) yb β‰  0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors hyb obtain ⟨c, h | h⟩ := ValuationRing.cond (xa * yb) (xb * ya) Β· dsimp apply le_trans _ (le_max_left _ _) use c + 1 rw [Algebra.smul_def] field_simp simp only [← RingHom.map_mul, ← RingHom.map_add, ← (algebraMap A K).map_one, ← h] congr 1; ring Β· apply le_trans _ (le_max_right _ _) use c + 1 rw [Algebra.smul_def] field_simp simp only [← RingHom.map_mul, ← RingHom.map_add, ← (algebraMap A K).map_one, ← h] congr 1; ring #align valuation_ring.valuation ValuationRing.valuation theorem mem_integer_iff (x : K) : x ∈ (valuation A K).integer ↔ βˆƒ a : A, algebraMap A K a = x := by constructor Β· rintro ⟨c, rfl⟩ use c rw [Algebra.smul_def, mul_one] Β· rintro ⟨c, rfl⟩ use c rw [Algebra.smul_def, mul_one] #align valuation_ring.mem_integer_iff ValuationRing.mem_integer_iff noncomputable def equivInteger : A ≃+* (valuation A K).integer := RingEquiv.ofBijective (show A β†’β‚™+* (valuation A K).integer from { toFun := fun a => ⟨algebraMap A K a, (mem_integer_iff _ _ _).mpr ⟨a, rfl⟩⟩ map_mul' := fun _ _ => by ext1; exact (algebraMap A K).map_mul _ _ map_zero' := by ext1; exact (algebraMap A K).map_zero map_add' := fun _ _ => by ext1; exact (algebraMap A K).map_add _ _ }) (by constructor Β· intro x y h apply_fun (algebraMap (valuation A K).integer K) at h exact IsFractionRing.injective _ _ h Β· rintro ⟨-, ha⟩ rw [mem_integer_iff] at ha obtain ⟨a, rfl⟩ := ha exact ⟨a, rfl⟩) #align valuation_ring.equiv_integer ValuationRing.equivInteger @[simp] theorem coe_equivInteger_apply (a : A) : (equivInteger A K a : K) = algebraMap A K a := rfl #align valuation_ring.coe_equiv_integer_apply ValuationRing.coe_equivInteger_apply
Mathlib/RingTheory/Valuation/ValuationRing.lean
236
237
theorem range_algebraMap_eq : (valuation A K).integer = (algebraMap A K).range := by
ext; exact mem_integer_iff _ _ _
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {Οƒ : Type*} {Ο„ : Type*} {R : Type*} {S : Type*} def degree (d : Οƒ β†’β‚€ β„•) := βˆ‘ i ∈ d.support, d i theorem weightedDegree_one (d : Οƒ β†’β‚€ β„•) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (Ο† : MvPolynomial Οƒ R) (n : β„•) := IsWeightedHomogeneous 1 Ο† n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (Ο† : MvPolynomial Οƒ R) : weightedTotalDegree (1 : Οƒ β†’ β„•) Ο† = Ο†.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (Οƒ R) def homogeneousSubmodule (n : β„•) : Submodule R (MvPolynomial Οƒ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a β‰  0 ∨ coeff c b β‰  0 := by contrapose! hc simp only [hc, add_zero] Β· exact ha h Β· exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : β„•) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule Οƒ R n := rfl variable {Οƒ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : β„•) (p : MvPolynomial Οƒ R) : p ∈ homogeneousSubmodule Οƒ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (Οƒ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : β„•) : homogeneousSubmodule Οƒ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {Οƒ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : β„•) : homogeneousSubmodule Οƒ R m * homogeneousSubmodule Οƒ R n ≀ homogeneousSubmodule Οƒ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : Οƒ β†’β‚€ β„•} (r : R) {n : β„•} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (Οƒ) theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial Οƒ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous] alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous #align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial Οƒ R) 0 := by apply isHomogeneous_monomial simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_C MvPolynomial.isHomogeneous_C variable (R) theorem isHomogeneous_zero (n : β„•) : IsHomogeneous (0 : MvPolynomial Οƒ R) n := (homogeneousSubmodule Οƒ R n).zero_mem #align mv_polynomial.is_homogeneous_zero MvPolynomial.isHomogeneous_zero theorem isHomogeneous_one : IsHomogeneous (1 : MvPolynomial Οƒ R) 0 := isHomogeneous_C _ _ #align mv_polynomial.is_homogeneous_one MvPolynomial.isHomogeneous_one variable {Οƒ}
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
150
153
theorem isHomogeneous_X (i : Οƒ) : IsHomogeneous (X i : MvPolynomial Οƒ R) 1 := by
apply isHomogeneous_monomial rw [degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton] exact Finsupp.single_eq_same
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory variable {Ξ± E : Type*} {m : MeasurableSpace Ξ±} [NormedAddCommGroup E] {p : ℝβ‰₯0∞} {q : ℝ} {ΞΌ : Measure Ξ±} {f g : Ξ± β†’ E} theorem snorm'_add_le {f g : Ξ± β†’ E} (hf : AEStronglyMeasurable f ΞΌ) (hg : AEStronglyMeasurable g ΞΌ) (hq1 : 1 ≀ q) : snorm' (f + g) q ΞΌ ≀ snorm' f q ΞΌ + snorm' g q ΞΌ := calc (∫⁻ a, (β€–(f + g) aβ€–β‚Š : ℝβ‰₯0∞) ^ q βˆ‚ΞΌ) ^ (1 / q) ≀ (∫⁻ a, ((fun a => (β€–f aβ€–β‚Š : ℝβ‰₯0∞)) + fun a => (β€–g aβ€–β‚Š : ℝβ‰₯0∞)) a ^ q βˆ‚ΞΌ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≀ snorm' f q ΞΌ + snorm' g q ΞΌ := ENNReal.lintegral_Lp_add_le hf.ennnorm hg.ennnorm hq1 #align measure_theory.snorm'_add_le MeasureTheory.snorm'_add_le theorem snorm'_add_le_of_le_one {f g : Ξ± β†’ E} (hf : AEStronglyMeasurable f ΞΌ) (hq0 : 0 ≀ q) (hq1 : q ≀ 1) : snorm' (f + g) q ΞΌ ≀ (2 : ℝβ‰₯0∞) ^ (1 / q - 1) * (snorm' f q ΞΌ + snorm' g q ΞΌ) := calc (∫⁻ a, (β€–(f + g) aβ€–β‚Š : ℝβ‰₯0∞) ^ q βˆ‚ΞΌ) ^ (1 / q) ≀ (∫⁻ a, ((fun a => (β€–f aβ€–β‚Š : ℝβ‰₯0∞)) + fun a => (β€–g aβ€–β‚Š : ℝβ‰₯0∞)) a ^ q βˆ‚ΞΌ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≀ (2 : ℝβ‰₯0∞) ^ (1 / q - 1) * (snorm' f q ΞΌ + snorm' g q ΞΌ) := ENNReal.lintegral_Lp_add_le_of_le_one hf.ennnorm hq0 hq1 #align measure_theory.snorm'_add_le_of_le_one MeasureTheory.snorm'_add_le_of_le_one theorem snormEssSup_add_le {f g : Ξ± β†’ E} : snormEssSup (f + g) ΞΌ ≀ snormEssSup f ΞΌ + snormEssSup g ΞΌ := by refine le_trans (essSup_mono_ae (eventually_of_forall fun x => ?_)) (ENNReal.essSup_add_le _ _) simp_rw [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe] exact nnnorm_add_le _ _ #align measure_theory.snorm_ess_sup_add_le MeasureTheory.snormEssSup_add_le theorem snorm_add_le {f g : Ξ± β†’ E} (hf : AEStronglyMeasurable f ΞΌ) (hg : AEStronglyMeasurable g ΞΌ) (hp1 : 1 ≀ p) : snorm (f + g) p ΞΌ ≀ snorm f p ΞΌ + snorm g p ΞΌ := by by_cases hp0 : p = 0 Β· simp [hp0] by_cases hp_top : p = ∞ Β· simp [hp_top, snormEssSup_add_le] have hp1_real : 1 ≀ p.toReal := by rwa [← ENNReal.one_toReal, ENNReal.toReal_le_toReal ENNReal.one_ne_top hp_top] repeat rw [snorm_eq_snorm' hp0 hp_top] exact snorm'_add_le hf hg hp1_real #align measure_theory.snorm_add_le MeasureTheory.snorm_add_le noncomputable def LpAddConst (p : ℝβ‰₯0∞) : ℝβ‰₯0∞ := if p ∈ Set.Ioo (0 : ℝβ‰₯0∞) 1 then (2 : ℝβ‰₯0∞) ^ (1 / p.toReal - 1) else 1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const MeasureTheory.LpAddConst theorem LpAddConst_of_one_le {p : ℝβ‰₯0∞} (hp : 1 ≀ p) : LpAddConst p = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ (h.2.trans_le hp) set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_of_one_le MeasureTheory.LpAddConst_of_one_le theorem LpAddConst_zero : LpAddConst 0 = 1 := by rw [LpAddConst, if_neg] intro h exact lt_irrefl _ h.1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_zero MeasureTheory.LpAddConst_zero theorem LpAddConst_lt_top (p : ℝβ‰₯0∞) : LpAddConst p < ∞ := by rw [LpAddConst] split_ifs with h Β· apply ENNReal.rpow_lt_top_of_nonneg _ ENNReal.two_ne_top simp only [one_div, sub_nonneg] apply one_le_inv (ENNReal.toReal_pos h.1.ne' (h.2.trans ENNReal.one_lt_top).ne) simpa using ENNReal.toReal_mono ENNReal.one_ne_top h.2.le Β· exact ENNReal.one_lt_top set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const_lt_top MeasureTheory.LpAddConst_lt_top
Mathlib/MeasureTheory/Function/LpSeminorm/TriangleInequality.lean
98
109
theorem snorm_add_le' {f g : Ξ± β†’ E} (hf : AEStronglyMeasurable f ΞΌ) (hg : AEStronglyMeasurable g ΞΌ) (p : ℝβ‰₯0∞) : snorm (f + g) p ΞΌ ≀ LpAddConst p * (snorm f p ΞΌ + snorm g p ΞΌ) := by
rcases eq_or_ne p 0 with (rfl | hp) Β· simp only [snorm_exponent_zero, add_zero, mul_zero, le_zero_iff] rcases lt_or_le p 1 with (h'p | h'p) Β· simp only [snorm_eq_snorm' hp (h'p.trans ENNReal.one_lt_top).ne] convert snorm'_add_le_of_le_one hf ENNReal.toReal_nonneg _ Β· have : p ∈ Set.Ioo (0 : ℝβ‰₯0∞) 1 := ⟨hp.bot_lt, h'p⟩ simp only [LpAddConst, if_pos this] Β· simpa using ENNReal.toReal_mono ENNReal.one_ne_top h'p.le Β· simp [LpAddConst_of_one_le h'p] exact snorm_add_le hf hg h'p
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector Ξ± n) (ys : Vector Ξ² n) @[simp] theorem mapAccumrβ‚‚_mapAccumr_left (f₁ : Ξ³ β†’ Ξ² β†’ σ₁ β†’ σ₁ Γ— ΞΆ) (fβ‚‚ : Ξ± β†’ Οƒβ‚‚ β†’ Οƒβ‚‚ Γ— Ξ³) : (mapAccumrβ‚‚ f₁ (mapAccumr fβ‚‚ xs sβ‚‚).snd ys s₁) = let m := (mapAccumrβ‚‚ (fun x y s => let rβ‚‚ := fβ‚‚ x s.snd let r₁ := f₁ rβ‚‚.snd y s.fst ((r₁.fst, rβ‚‚.fst), r₁.snd) ) xs ys (s₁, sβ‚‚)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOnβ‚‚ generalizing s₁ sβ‚‚ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
71
73
theorem mapβ‚‚_map_left (f₁ : Ξ³ β†’ Ξ² β†’ ΞΆ) (fβ‚‚ : Ξ± β†’ Ξ³) : mapβ‚‚ f₁ (map fβ‚‚ xs) ys = mapβ‚‚ (fun x y => f₁ (fβ‚‚ x) y) xs ys := by
induction xs, ys using Vector.revInductionOnβ‚‚ <;> simp_all
import Mathlib.Algebra.MonoidAlgebra.Basic #align_import algebra.monoid_algebra.division from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951" variable {k G : Type*} [Semiring k] namespace AddMonoidAlgebra section variable [AddCancelCommMonoid G] noncomputable def divOf (x : k[G]) (g : G) : k[G] := -- note: comapping by `+ g` has the effect of subtracting `g` from every element in -- the support, and discarding the elements of the support from which `g` can't be subtracted. -- If `G` is an additive group, such as `β„€` when used for `LaurentPolynomial`, -- then no discarding occurs. @Finsupp.comapDomain.addMonoidHom _ _ _ _ (g + Β·) (add_right_injective g) x #align add_monoid_algebra.div_of AddMonoidAlgebra.divOf local infixl:70 " /α΅’αΆ  " => divOf @[simp] theorem divOf_apply (g : G) (x : k[G]) (g' : G) : (x /α΅’αΆ  g) g' = x (g + g') := rfl #align add_monoid_algebra.div_of_apply AddMonoidAlgebra.divOf_apply @[simp] theorem support_divOf (g : G) (x : k[G]) : (x /α΅’αΆ  g).support = x.support.preimage (g + Β·) (Function.Injective.injOn (add_right_injective g)) := rfl #align add_monoid_algebra.support_div_of AddMonoidAlgebra.support_divOf @[simp] theorem zero_divOf (g : G) : (0 : k[G]) /α΅’αΆ  g = 0 := map_zero (Finsupp.comapDomain.addMonoidHom _) #align add_monoid_algebra.zero_div_of AddMonoidAlgebra.zero_divOf @[simp] theorem divOf_zero (x : k[G]) : x /α΅’αΆ  0 = x := by refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work simp only [AddMonoidAlgebra.divOf_apply, zero_add] #align add_monoid_algebra.div_of_zero AddMonoidAlgebra.divOf_zero theorem add_divOf (x y : k[G]) (g : G) : (x + y) /α΅’αΆ  g = x /α΅’αΆ  g + y /α΅’αΆ  g := map_add (Finsupp.comapDomain.addMonoidHom _) _ _ #align add_monoid_algebra.add_div_of AddMonoidAlgebra.add_divOf theorem divOf_add (x : k[G]) (a b : G) : x /α΅’αΆ  (a + b) = x /α΅’αΆ  a /α΅’αΆ  b := by refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work simp only [AddMonoidAlgebra.divOf_apply, add_assoc] #align add_monoid_algebra.div_of_add AddMonoidAlgebra.divOf_add @[simps] noncomputable def divOfHom : Multiplicative G β†’* AddMonoid.End k[G] where toFun g := { toFun := fun x => divOf x (Multiplicative.toAdd g) map_zero' := zero_divOf _ map_add' := fun x y => add_divOf x y (Multiplicative.toAdd g) } map_one' := AddMonoidHom.ext divOf_zero map_mul' g₁ gβ‚‚ := AddMonoidHom.ext fun _x => (congr_arg _ (add_comm (Multiplicative.toAdd g₁) (Multiplicative.toAdd gβ‚‚))).trans (divOf_add _ _ _) #align add_monoid_algebra.div_of_hom AddMonoidAlgebra.divOfHom theorem of'_mul_divOf (a : G) (x : k[G]) : of' k G a * x /α΅’αΆ  a = x := by refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work rw [AddMonoidAlgebra.divOf_apply, of'_apply, single_mul_apply_aux, one_mul] intro c exact add_right_inj _ #align add_monoid_algebra.of'_mul_div_of AddMonoidAlgebra.of'_mul_divOf theorem mul_of'_divOf (x : k[G]) (a : G) : x * of' k G a /α΅’αΆ  a = x := by refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work rw [AddMonoidAlgebra.divOf_apply, of'_apply, mul_single_apply_aux, mul_one] intro c rw [add_comm] exact add_right_inj _ #align add_monoid_algebra.mul_of'_div_of AddMonoidAlgebra.mul_of'_divOf theorem of'_divOf (a : G) : of' k G a /α΅’αΆ  a = 1 := by simpa only [one_mul] using mul_of'_divOf (1 : k[G]) a #align add_monoid_algebra.of'_div_of AddMonoidAlgebra.of'_divOf noncomputable def modOf (x : k[G]) (g : G) : k[G] := letI := Classical.decPred fun g₁ => βˆƒ gβ‚‚, g₁ = g + gβ‚‚ x.filter fun g₁ => Β¬βˆƒ gβ‚‚, g₁ = g + gβ‚‚ #align add_monoid_algebra.mod_of AddMonoidAlgebra.modOf local infixl:70 " %α΅’αΆ  " => modOf @[simp] theorem modOf_apply_of_not_exists_add (x : k[G]) (g : G) (g' : G) (h : Β¬βˆƒ d, g' = g + d) : (x %α΅’αΆ  g) g' = x g' := by classical exact Finsupp.filter_apply_pos _ _ h #align add_monoid_algebra.mod_of_apply_of_not_exists_add AddMonoidAlgebra.modOf_apply_of_not_exists_add @[simp] theorem modOf_apply_of_exists_add (x : k[G]) (g : G) (g' : G) (h : βˆƒ d, g' = g + d) : (x %α΅’αΆ  g) g' = 0 := by classical exact Finsupp.filter_apply_neg _ _ <| by rwa [Classical.not_not] #align add_monoid_algebra.mod_of_apply_of_exists_add AddMonoidAlgebra.modOf_apply_of_exists_add @[simp] theorem modOf_apply_add_self (x : k[G]) (g : G) (d : G) : (x %α΅’αΆ  g) (d + g) = 0 := modOf_apply_of_exists_add _ _ _ ⟨_, add_comm _ _⟩ #align add_monoid_algebra.mod_of_apply_add_self AddMonoidAlgebra.modOf_apply_add_self -- @[simp] -- Porting note (#10618): simp can prove this theorem modOf_apply_self_add (x : k[G]) (g : G) (d : G) : (x %α΅’αΆ  g) (g + d) = 0 := modOf_apply_of_exists_add _ _ _ ⟨_, rfl⟩ #align add_monoid_algebra.mod_of_apply_self_add AddMonoidAlgebra.modOf_apply_self_add
Mathlib/Algebra/MonoidAlgebra/Division.lean
154
159
theorem of'_mul_modOf (g : G) (x : k[G]) : of' k G g * x %α΅’αΆ  g = 0 := by
refine Finsupp.ext fun g' => ?_ -- Porting note: `ext g'` doesn't work rw [Finsupp.zero_apply] obtain ⟨d, rfl⟩ | h := em (βˆƒ d, g' = g + d) Β· rw [modOf_apply_self_add] Β· rw [modOf_apply_of_not_exists_add _ _ _ h, of'_apply, single_mul_apply_of_not_exists_add _ _ h]
import Mathlib.Combinatorics.SimpleGraph.Clique import Mathlib.Data.ENat.Lattice import Mathlib.Data.Nat.Lattice import Mathlib.Data.Setoid.Partition import Mathlib.Order.Antichain #align_import combinatorics.simple_graph.coloring from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open Fintype Function universe u v namespace SimpleGraph variable {V : Type u} (G : SimpleGraph V) {n : β„•} abbrev Coloring (Ξ± : Type v) := G β†’g (⊀ : SimpleGraph Ξ±) #align simple_graph.coloring SimpleGraph.Coloring variable {G} {Ξ± Ξ² : Type*} (C : G.Coloring Ξ±) theorem Coloring.valid {v w : V} (h : G.Adj v w) : C v β‰  C w := C.map_rel h #align simple_graph.coloring.valid SimpleGraph.Coloring.valid @[match_pattern] def Coloring.mk (color : V β†’ Ξ±) (valid : βˆ€ {v w : V}, G.Adj v w β†’ color v β‰  color w) : G.Coloring Ξ± := ⟨color, @valid⟩ #align simple_graph.coloring.mk SimpleGraph.Coloring.mk def Coloring.colorClass (c : Ξ±) : Set V := { v : V | C v = c } #align simple_graph.coloring.color_class SimpleGraph.Coloring.colorClass def Coloring.colorClasses : Set (Set V) := (Setoid.ker C).classes #align simple_graph.coloring.color_classes SimpleGraph.Coloring.colorClasses theorem Coloring.mem_colorClass (v : V) : v ∈ C.colorClass (C v) := rfl #align simple_graph.coloring.mem_color_class SimpleGraph.Coloring.mem_colorClass theorem Coloring.colorClasses_isPartition : Setoid.IsPartition C.colorClasses := Setoid.isPartition_classes (Setoid.ker C) #align simple_graph.coloring.color_classes_is_partition SimpleGraph.Coloring.colorClasses_isPartition theorem Coloring.mem_colorClasses {v : V} : C.colorClass (C v) ∈ C.colorClasses := ⟨v, rfl⟩ #align simple_graph.coloring.mem_color_classes SimpleGraph.Coloring.mem_colorClasses theorem Coloring.colorClasses_finite [Finite Ξ±] : C.colorClasses.Finite := Setoid.finite_classes_ker _ #align simple_graph.coloring.color_classes_finite SimpleGraph.Coloring.colorClasses_finite theorem Coloring.card_colorClasses_le [Fintype Ξ±] [Fintype C.colorClasses] : Fintype.card C.colorClasses ≀ Fintype.card Ξ± := by simp [colorClasses] -- Porting note: brute force instance declaration `[Fintype (Setoid.classes (Setoid.ker C))]` haveI : Fintype (Setoid.classes (Setoid.ker C)) := by assumption convert Setoid.card_classes_ker_le C #align simple_graph.coloring.card_color_classes_le SimpleGraph.Coloring.card_colorClasses_le theorem Coloring.not_adj_of_mem_colorClass {c : Ξ±} {v w : V} (hv : v ∈ C.colorClass c) (hw : w ∈ C.colorClass c) : Β¬G.Adj v w := fun h => C.valid h (Eq.trans hv (Eq.symm hw)) #align simple_graph.coloring.not_adj_of_mem_color_class SimpleGraph.Coloring.not_adj_of_mem_colorClass theorem Coloring.color_classes_independent (c : Ξ±) : IsAntichain G.Adj (C.colorClass c) := fun _ hv _ hw _ => C.not_adj_of_mem_colorClass hv hw #align simple_graph.coloring.color_classes_independent SimpleGraph.Coloring.color_classes_independent -- TODO make this computable noncomputable instance [Fintype V] [Fintype Ξ±] : Fintype (Coloring G Ξ±) := by classical change Fintype (RelHom G.Adj (⊀ : SimpleGraph Ξ±).Adj) apply Fintype.ofInjective _ RelHom.coe_fn_injective variable (G) def Colorable (n : β„•) : Prop := Nonempty (G.Coloring (Fin n)) #align simple_graph.colorable SimpleGraph.Colorable def coloringOfIsEmpty [IsEmpty V] : G.Coloring Ξ± := Coloring.mk isEmptyElim fun {v} => isEmptyElim v #align simple_graph.coloring_of_is_empty SimpleGraph.coloringOfIsEmpty theorem colorable_of_isEmpty [IsEmpty V] (n : β„•) : G.Colorable n := ⟨G.coloringOfIsEmpty⟩ #align simple_graph.colorable_of_is_empty SimpleGraph.colorable_of_isEmpty theorem isEmpty_of_colorable_zero (h : G.Colorable 0) : IsEmpty V := by constructor intro v obtain ⟨i, hi⟩ := h.some v exact Nat.not_lt_zero _ hi #align simple_graph.is_empty_of_colorable_zero SimpleGraph.isEmpty_of_colorable_zero def selfColoring : G.Coloring V := Coloring.mk id fun {_ _} => G.ne_of_adj #align simple_graph.self_coloring SimpleGraph.selfColoring noncomputable def chromaticNumber : β„•βˆž := β¨… n ∈ setOf G.Colorable, (n : β„•βˆž) #align simple_graph.chromatic_number SimpleGraph.chromaticNumber lemma chromaticNumber_eq_biInf {G : SimpleGraph V} : G.chromaticNumber = β¨… n ∈ setOf G.Colorable, (n : β„•βˆž) := rfl lemma chromaticNumber_eq_iInf {G : SimpleGraph V} : G.chromaticNumber = β¨… n : {m | G.Colorable m}, (n : β„•βˆž) := by rw [chromaticNumber, iInf_subtype] lemma Colorable.chromaticNumber_eq_sInf {G : SimpleGraph V} {n} (h : G.Colorable n) : G.chromaticNumber = sInf {n' : β„• | G.Colorable n'} := by rw [ENat.coe_sInf, chromaticNumber] exact ⟨_, h⟩ def recolorOfEmbedding {Ξ± Ξ² : Type*} (f : Ξ± β†ͺ Ξ²) : G.Coloring Ξ± β†ͺ G.Coloring Ξ² where toFun C := (Embedding.completeGraph f).toHom.comp C inj' := by -- this was strangely painful; seems like missing lemmas about embeddings intro C C' h dsimp only at h ext v apply (Embedding.completeGraph f).inj' change ((Embedding.completeGraph f).toHom.comp C) v = _ rw [h] rfl #align simple_graph.recolor_of_embedding SimpleGraph.recolorOfEmbedding @[simp] lemma coe_recolorOfEmbedding (f : Ξ± β†ͺ Ξ²) : ⇑(G.recolorOfEmbedding f) = (Embedding.completeGraph f).toHom.comp := rfl def recolorOfEquiv {Ξ± Ξ² : Type*} (f : Ξ± ≃ Ξ²) : G.Coloring Ξ± ≃ G.Coloring Ξ² where toFun := G.recolorOfEmbedding f.toEmbedding invFun := G.recolorOfEmbedding f.symm.toEmbedding left_inv C := by ext v apply Equiv.symm_apply_apply right_inv C := by ext v apply Equiv.apply_symm_apply #align simple_graph.recolor_of_equiv SimpleGraph.recolorOfEquiv @[simp] lemma coe_recolorOfEquiv (f : Ξ± ≃ Ξ²) : ⇑(G.recolorOfEquiv f) = (Embedding.completeGraph f).toHom.comp := rfl noncomputable def recolorOfCardLE {Ξ± Ξ² : Type*} [Fintype Ξ±] [Fintype Ξ²] (hn : Fintype.card Ξ± ≀ Fintype.card Ξ²) : G.Coloring Ξ± β†ͺ G.Coloring Ξ² := G.recolorOfEmbedding <| (Function.Embedding.nonempty_of_card_le hn).some #align simple_graph.recolor_of_card_le SimpleGraph.recolorOfCardLE @[simp] lemma coe_recolorOfCardLE [Fintype Ξ±] [Fintype Ξ²] (hΞ±Ξ² : card Ξ± ≀ card Ξ²) : ⇑(G.recolorOfCardLE hΞ±Ξ²) = (Embedding.completeGraph (Embedding.nonempty_of_card_le hΞ±Ξ²).some).toHom.comp := rfl variable {G} theorem Colorable.mono {n m : β„•} (h : n ≀ m) (hc : G.Colorable n) : G.Colorable m := ⟨G.recolorOfCardLE (by simp [h]) hc.some⟩ #align simple_graph.colorable.mono SimpleGraph.Colorable.mono theorem Coloring.colorable [Fintype Ξ±] (C : G.Coloring Ξ±) : G.Colorable (Fintype.card Ξ±) := ⟨G.recolorOfCardLE (by simp) C⟩ #align simple_graph.coloring.to_colorable SimpleGraph.Coloring.colorable theorem colorable_of_fintype (G : SimpleGraph V) [Fintype V] : G.Colorable (Fintype.card V) := G.selfColoring.colorable #align simple_graph.colorable_of_fintype SimpleGraph.colorable_of_fintype noncomputable def Colorable.toColoring [Fintype Ξ±] {n : β„•} (hc : G.Colorable n) (hn : n ≀ Fintype.card Ξ±) : G.Coloring Ξ± := by rw [← Fintype.card_fin n] at hn exact G.recolorOfCardLE hn hc.some #align simple_graph.colorable.to_coloring SimpleGraph.Colorable.toColoring theorem Colorable.of_embedding {V' : Type*} {G' : SimpleGraph V'} (f : G β†ͺg G') {n : β„•} (h : G'.Colorable n) : G.Colorable n := ⟨(h.toColoring (by simp)).comp f⟩ #align simple_graph.colorable.of_embedding SimpleGraph.Colorable.of_embedding theorem colorable_iff_exists_bdd_nat_coloring (n : β„•) : G.Colorable n ↔ βˆƒ C : G.Coloring β„•, βˆ€ v, C v < n := by constructor Β· rintro hc have C : G.Coloring (Fin n) := hc.toColoring (by simp) let f := Embedding.completeGraph (@Fin.valEmbedding n) use f.toHom.comp C intro v cases' C with color valid exact Fin.is_lt (color v) Β· rintro ⟨C, Cf⟩ refine ⟨Coloring.mk ?_ ?_⟩ Β· exact fun v => ⟨C v, Cf v⟩ Β· rintro v w hvw simp only [Fin.mk_eq_mk, Ne] exact C.valid hvw #align simple_graph.colorable_iff_exists_bdd_nat_coloring SimpleGraph.colorable_iff_exists_bdd_nat_coloring theorem colorable_set_nonempty_of_colorable {n : β„•} (hc : G.Colorable n) : { n : β„• | G.Colorable n }.Nonempty := ⟨n, hc⟩ #align simple_graph.colorable_set_nonempty_of_colorable SimpleGraph.colorable_set_nonempty_of_colorable theorem chromaticNumber_bddBelow : BddBelow { n : β„• | G.Colorable n } := ⟨0, fun _ _ => zero_le _⟩ #align simple_graph.chromatic_number_bdd_below SimpleGraph.chromaticNumber_bddBelow
Mathlib/Combinatorics/SimpleGraph/Coloring.lean
276
280
theorem Colorable.chromaticNumber_le {n : β„•} (hc : G.Colorable n) : G.chromaticNumber ≀ n := by
rw [hc.chromaticNumber_eq_sInf] norm_cast apply csInf_le chromaticNumber_bddBelow exact hc
import Mathlib.FieldTheory.Finiteness import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition import Mathlib.LinearAlgebra.Dimension.DivisionRing #align_import linear_algebra.finite_dimensional from "leanprover-community/mathlib"@"e95e4f92c8f8da3c7f693c3ec948bcf9b6683f51" universe u v v' w open Cardinal Submodule Module Function abbrev FiniteDimensional (K V : Type*) [DivisionRing K] [AddCommGroup V] [Module K V] := Module.Finite K V #align finite_dimensional FiniteDimensional variable {K : Type u} {V : Type v} namespace FiniteDimensional open IsNoetherian section DivisionRing variable [DivisionRing K] [AddCommGroup V] [Module K V] {Vβ‚‚ : Type v'} [AddCommGroup Vβ‚‚] [Module K Vβ‚‚] theorem of_injective (f : V β†’β‚—[K] Vβ‚‚) (w : Function.Injective f) [FiniteDimensional K Vβ‚‚] : FiniteDimensional K V := have : IsNoetherian K Vβ‚‚ := IsNoetherian.iff_fg.mpr β€Ή_β€Ί Module.Finite.of_injective f w #align finite_dimensional.of_injective FiniteDimensional.of_injective theorem of_surjective (f : V β†’β‚—[K] Vβ‚‚) (w : Function.Surjective f) [FiniteDimensional K V] : FiniteDimensional K Vβ‚‚ := Module.Finite.of_surjective f w #align finite_dimensional.of_surjective FiniteDimensional.of_surjective variable (K V) instance finiteDimensional_pi {ΞΉ : Type*} [Finite ΞΉ] : FiniteDimensional K (ΞΉ β†’ K) := Finite.pi #align finite_dimensional.finite_dimensional_pi FiniteDimensional.finiteDimensional_pi instance finiteDimensional_pi' {ΞΉ : Type*} [Finite ΞΉ] (M : ΞΉ β†’ Type*) [βˆ€ i, AddCommGroup (M i)] [βˆ€ i, Module K (M i)] [βˆ€ i, FiniteDimensional K (M i)] : FiniteDimensional K (βˆ€ i, M i) := Finite.pi #align finite_dimensional.finite_dimensional_pi' FiniteDimensional.finiteDimensional_pi' noncomputable def fintypeOfFintype [Fintype K] [FiniteDimensional K V] : Fintype V := Module.fintypeOfFintype (@finsetBasis K V _ _ _ (iff_fg.2 inferInstance)) #align finite_dimensional.fintype_of_fintype FiniteDimensional.fintypeOfFintype theorem finite_of_finite [Finite K] [FiniteDimensional K V] : Finite V := by cases nonempty_fintype K haveI := fintypeOfFintype K V infer_instance #align finite_dimensional.finite_of_finite FiniteDimensional.finite_of_finite variable {K V} theorem of_fintype_basis {ΞΉ : Type w} [Finite ΞΉ] (h : Basis ΞΉ K V) : FiniteDimensional K V := Module.Finite.of_basis h #align finite_dimensional.of_fintype_basis FiniteDimensional.of_fintype_basis noncomputable def fintypeBasisIndex {ΞΉ : Type*} [FiniteDimensional K V] (b : Basis ΞΉ K V) : Fintype ΞΉ := @Fintype.ofFinite _ (Module.Finite.finite_basis b) #align finite_dimensional.fintype_basis_index FiniteDimensional.fintypeBasisIndex noncomputable instance [FiniteDimensional K V] : Fintype (Basis.ofVectorSpaceIndex K V) := by letI : IsNoetherian K V := IsNoetherian.iff_fg.2 inferInstance infer_instance theorem of_finite_basis {ΞΉ : Type w} {s : Set ΞΉ} (h : Basis s K V) (hs : Set.Finite s) : FiniteDimensional K V := haveI := hs.fintype of_fintype_basis h #align finite_dimensional.of_finite_basis FiniteDimensional.of_finite_basis instance finiteDimensional_submodule [FiniteDimensional K V] (S : Submodule K V) : FiniteDimensional K S := by letI : IsNoetherian K V := iff_fg.2 ?_ Β· exact iff_fg.1 (IsNoetherian.iff_rank_lt_aleph0.2 (lt_of_le_of_lt (rank_submodule_le _) (_root_.rank_lt_aleph0 K V))) Β· infer_instance #align finite_dimensional.finite_dimensional_submodule FiniteDimensional.finiteDimensional_submodule instance finiteDimensional_quotient [FiniteDimensional K V] (S : Submodule K V) : FiniteDimensional K (V β§Έ S) := Module.Finite.quotient K S #align finite_dimensional.finite_dimensional_quotient FiniteDimensional.finiteDimensional_quotient variable (K V) theorem finrank_eq_rank' [FiniteDimensional K V] : (finrank K V : Cardinal.{v}) = Module.rank K V := finrank_eq_rank _ _ #align finite_dimensional.finrank_eq_rank' FiniteDimensional.finrank_eq_rank' variable {K V} theorem finrank_of_infinite_dimensional (h : Β¬FiniteDimensional K V) : finrank K V = 0 := FiniteDimensional.finrank_of_not_finite h #align finite_dimensional.finrank_of_infinite_dimensional FiniteDimensional.finrank_of_infinite_dimensional theorem of_finrank_pos (h : 0 < finrank K V) : FiniteDimensional K V := Module.finite_of_finrank_pos h #align finite_dimensional.finite_dimensional_of_finrank FiniteDimensional.of_finrank_pos theorem of_finrank_eq_succ {n : β„•} (hn : finrank K V = n.succ) : FiniteDimensional K V := Module.finite_of_finrank_eq_succ hn #align finite_dimensional.finite_dimensional_of_finrank_eq_succ FiniteDimensional.of_finrank_eq_succ theorem of_fact_finrank_eq_succ (n : β„•) [hn : Fact (finrank K V = n + 1)] : FiniteDimensional K V := of_finrank_eq_succ hn.out #align finite_dimensional.fact_finite_dimensional_of_finrank_eq_succ FiniteDimensional.of_fact_finrank_eq_succ theorem finiteDimensional_iff_of_rank_eq_nsmul {W} [AddCommGroup W] [Module K W] {n : β„•} (hn : n β‰  0) (hVW : Module.rank K V = n β€’ Module.rank K W) : FiniteDimensional K V ↔ FiniteDimensional K W := Module.finite_iff_of_rank_eq_nsmul hn hVW #align finite_dimensional.finite_dimensional_iff_of_rank_eq_nsmul FiniteDimensional.finiteDimensional_iff_of_rank_eq_nsmul theorem finrank_eq_card_basis' [FiniteDimensional K V] {ΞΉ : Type w} (h : Basis ΞΉ K V) : (finrank K V : Cardinal.{w}) = #ΞΉ := Module.mk_finrank_eq_card_basis h #align finite_dimensional.finrank_eq_card_basis' FiniteDimensional.finrank_eq_card_basis' theorem _root_.LinearIndependent.lt_aleph0_of_finiteDimensional {ΞΉ : Type w} [FiniteDimensional K V] {v : ΞΉ β†’ V} (h : LinearIndependent K v) : #ΞΉ < β„΅β‚€ := h.lt_aleph0_of_finite #align finite_dimensional.lt_aleph_0_of_linear_independent LinearIndependent.lt_aleph0_of_finiteDimensional @[deprecated (since := "2023-12-27")] alias lt_aleph0_of_linearIndependent := LinearIndependent.lt_aleph0_of_finiteDimensional
Mathlib/LinearAlgebra/FiniteDimensional.lean
225
250
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V} (h : finrank K S = finrank K V) : S = ⊀ := by
haveI : IsNoetherian K V := iff_fg.2 inferInstance set bS := Basis.ofVectorSpace K S with bS_eq have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) β†’ V) := LinearIndependent.image_subtype (f := Submodule.subtype S) (by simpa [bS] using bS.linearIndependent) (by simp) set b := Basis.extend this with b_eq -- Porting note: `letI` now uses `this` so we need to give different names letI i1 : Fintype (this.extend _) := (LinearIndependent.set_finite_of_isNoetherian (by simpa [b] using b.linearIndependent)).fintype letI i2 : Fintype (((↑) : S β†’ V) '' Basis.ofVectorSpaceIndex K S) := (LinearIndependent.set_finite_of_isNoetherian this).fintype letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) := (LinearIndependent.set_finite_of_isNoetherian (by simpa [bS] using bS.linearIndependent)).fintype have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) := Set.eq_of_subset_of_card_le (this.subset_extend _) (by rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ← finrank_eq_card_basis b, h]) rw [← b.span_eq, b_eq, Basis.coe_extend, Subtype.range_coe, ← this, ← Submodule.coeSubtype, span_image] have := bS.span_eq rw [bS_eq, Basis.coe_ofVectorSpace, Subtype.range_coe] at this rw [this, Submodule.map_top (Submodule.subtype S), range_subtype]
import Mathlib.Logic.Encodable.Lattice import Mathlib.MeasureTheory.MeasurableSpace.Defs #align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" open MeasurableSpace Set open scoped Classical open MeasureTheory def IsPiSystem {Ξ±} (C : Set (Set Ξ±)) : Prop := βˆ€α΅‰ (s ∈ C) (t ∈ C), (s ∩ t : Set Ξ±).Nonempty β†’ s ∩ t ∈ C #align is_pi_system IsPiSystem theorem IsPiSystem.singleton {Ξ±} (S : Set Ξ±) : IsPiSystem ({S} : Set (Set Ξ±)) := by intro s h_s t h_t _ rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self, Set.mem_singleton_iff] #align is_pi_system.singleton IsPiSystem.singleton theorem IsPiSystem.insert_empty {Ξ±} {S : Set (Set Ξ±)} (h_pi : IsPiSystem S) : IsPiSystem (insert βˆ… S) := by intro s hs t ht hst cases' hs with hs hs Β· simp [hs] Β· cases' ht with ht ht Β· simp [ht] Β· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_empty IsPiSystem.insert_empty theorem IsPiSystem.insert_univ {Ξ±} {S : Set (Set Ξ±)} (h_pi : IsPiSystem S) : IsPiSystem (insert Set.univ S) := by intro s hs t ht hst cases' hs with hs hs Β· cases' ht with ht ht <;> simp [hs, ht] Β· cases' ht with ht ht Β· simp [hs, ht] Β· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst) #align is_pi_system.insert_univ IsPiSystem.insert_univ theorem IsPiSystem.comap {Ξ± Ξ²} {S : Set (Set Ξ²)} (h_pi : IsPiSystem S) (f : Ξ± β†’ Ξ²) : IsPiSystem { s : Set Ξ± | βˆƒ t ∈ S, f ⁻¹' t = s } := by rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst rw [← Set.preimage_inter] at hst ⊒ exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩ #align is_pi_system.comap IsPiSystem.comap theorem isPiSystem_iUnion_of_directed_le {Ξ± ΞΉ} (p : ΞΉ β†’ Set (Set Ξ±)) (hp_pi : βˆ€ n, IsPiSystem (p n)) (hp_directed : Directed (Β· ≀ Β·) p) : IsPiSystem (⋃ n, p n) := by intro t1 ht1 t2 ht2 h rw [Set.mem_iUnion] at ht1 ht2 ⊒ cases' ht1 with n ht1 cases' ht2 with m ht2 obtain ⟨k, hpnk, hpmk⟩ : βˆƒ k, p n ≀ p k ∧ p m ≀ p k := hp_directed n m exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩ #align is_pi_system_Union_of_directed_le isPiSystem_iUnion_of_directed_le theorem isPiSystem_iUnion_of_monotone {Ξ± ΞΉ} [SemilatticeSup ΞΉ] (p : ΞΉ β†’ Set (Set Ξ±)) (hp_pi : βˆ€ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) := isPiSystem_iUnion_of_directed_le p hp_pi (Monotone.directed_le hp_mono) #align is_pi_system_Union_of_monotone isPiSystem_iUnion_of_monotone section Order variable {Ξ± : Type*} {ΞΉ ΞΉ' : Sort*} [LinearOrder Ξ±] theorem isPiSystem_image_Iio (s : Set Ξ±) : IsPiSystem (Iio '' s) := by rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - exact ⟨a βŠ“ b, inf_ind a b ha hb, Iio_inter_Iio.symm⟩ #align is_pi_system_image_Iio isPiSystem_image_Iio theorem isPiSystem_Iio : IsPiSystem (range Iio : Set (Set Ξ±)) := @image_univ Ξ± _ Iio β–Έ isPiSystem_image_Iio univ #align is_pi_system_Iio isPiSystem_Iio theorem isPiSystem_image_Ioi (s : Set Ξ±) : IsPiSystem (Ioi '' s) := @isPiSystem_image_Iio Ξ±α΅’α΅ˆ _ s #align is_pi_system_image_Ioi isPiSystem_image_Ioi theorem isPiSystem_Ioi : IsPiSystem (range Ioi : Set (Set Ξ±)) := @image_univ Ξ± _ Ioi β–Έ isPiSystem_image_Ioi univ #align is_pi_system_Ioi isPiSystem_Ioi theorem isPiSystem_image_Iic (s : Set Ξ±) : IsPiSystem (Iic '' s) := by rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ - exact ⟨a βŠ“ b, inf_ind a b ha hb, Iic_inter_Iic.symm⟩ theorem isPiSystem_Iic : IsPiSystem (range Iic : Set (Set Ξ±)) := @image_univ Ξ± _ Iic β–Έ isPiSystem_image_Iic univ #align is_pi_system_Iic isPiSystem_Iic theorem isPiSystem_image_Ici (s : Set Ξ±) : IsPiSystem (Ici '' s) := @isPiSystem_image_Iic Ξ±α΅’α΅ˆ _ s theorem isPiSystem_Ici : IsPiSystem (range Ici : Set (Set Ξ±)) := @image_univ Ξ± _ Ici β–Έ isPiSystem_image_Ici univ #align is_pi_system_Ici isPiSystem_Ici theorem isPiSystem_Ixx_mem {Ixx : Ξ± β†’ Ξ± β†’ Set Ξ±} {p : Ξ± β†’ Ξ± β†’ Prop} (Hne : βˆ€ {a b}, (Ixx a b).Nonempty β†’ p a b) (Hi : βˆ€ {a₁ b₁ aβ‚‚ bβ‚‚}, Ixx a₁ b₁ ∩ Ixx aβ‚‚ bβ‚‚ = Ixx (max a₁ aβ‚‚) (min b₁ bβ‚‚)) (s t : Set Ξ±) : IsPiSystem { S | βˆƒα΅‰ (l ∈ s) (u ∈ t), p l u ∧ Ixx l u = S } := by rintro _ ⟨l₁, hls₁, u₁, hut₁, _, rfl⟩ _ ⟨lβ‚‚, hlsβ‚‚, uβ‚‚, hutβ‚‚, _, rfl⟩ simp only [Hi] exact fun H => ⟨l₁ βŠ” lβ‚‚, sup_ind l₁ lβ‚‚ hls₁ hlsβ‚‚, u₁ βŠ“ uβ‚‚, inf_ind u₁ uβ‚‚ hut₁ hutβ‚‚, Hne H, rfl⟩ #align is_pi_system_Ixx_mem isPiSystem_Ixx_mem
Mathlib/MeasureTheory/PiSystem.lean
173
177
theorem isPiSystem_Ixx {Ixx : Ξ± β†’ Ξ± β†’ Set Ξ±} {p : Ξ± β†’ Ξ± β†’ Prop} (Hne : βˆ€ {a b}, (Ixx a b).Nonempty β†’ p a b) (Hi : βˆ€ {a₁ b₁ aβ‚‚ bβ‚‚}, Ixx a₁ b₁ ∩ Ixx aβ‚‚ bβ‚‚ = Ixx (max a₁ aβ‚‚) (min b₁ bβ‚‚)) (f : ΞΉ β†’ Ξ±) (g : ΞΉ' β†’ Ξ±) : @IsPiSystem Ξ± { S | βˆƒ i j, p (f i) (g j) ∧ Ixx (f i) (g j) = S } := by
simpa only [exists_range_iff] using isPiSystem_Ixx_mem (@Hne) (@Hi) (range f) (range g)
import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.Coxeter.Basic namespace CoxeterSystem open List Matrix Function Classical variable {B : Type*} variable {W : Type*} [Group W] variable {M : CoxeterMatrix B} (cs : CoxeterSystem M W) local prefix:100 "s" => cs.simple local prefix:100 "Ο€" => cs.wordProd private theorem exists_word_with_prod (w : W) : βˆƒ n Ο‰, Ο‰.length = n ∧ Ο€ Ο‰ = w := by rcases cs.wordProd_surjective w with βŸ¨Ο‰, rfl⟩ use Ο‰.length, Ο‰ noncomputable def length (w : W) : β„• := Nat.find (cs.exists_word_with_prod w) local prefix:100 "β„“" => cs.length theorem exists_reduced_word (w : W) : βˆƒ Ο‰, Ο‰.length = β„“ w ∧ w = Ο€ Ο‰ := by have := Nat.find_spec (cs.exists_word_with_prod w) tauto theorem length_wordProd_le (Ο‰ : List B) : β„“ (Ο€ Ο‰) ≀ Ο‰.length := Nat.find_min' (cs.exists_word_with_prod (Ο€ Ο‰)) βŸ¨Ο‰, by tauto⟩ @[simp] theorem length_one : β„“ (1 : W) = 0 := Nat.eq_zero_of_le_zero (cs.length_wordProd_le []) @[simp] theorem length_eq_zero_iff {w : W} : β„“ w = 0 ↔ w = 1 := by constructor Β· intro h rcases cs.exists_reduced_word w with βŸ¨Ο‰, hΟ‰, rfl⟩ have : Ο‰ = [] := eq_nil_of_length_eq_zero (hΟ‰.trans h) rw [this, wordProd_nil] Β· rintro rfl exact cs.length_one @[simp] theorem length_inv (w : W) : β„“ (w⁻¹) = β„“ w := by apply Nat.le_antisymm Β· rcases cs.exists_reduced_word w with βŸ¨Ο‰, hΟ‰, rfl⟩ have := cs.length_wordProd_le (List.reverse Ο‰) rwa [wordProd_reverse, length_reverse, hΟ‰] at this Β· rcases cs.exists_reduced_word w⁻¹ with βŸ¨Ο‰, hΟ‰, h'Ο‰βŸ© have := cs.length_wordProd_le (List.reverse Ο‰) rwa [wordProd_reverse, length_reverse, ← h'Ο‰, hΟ‰, inv_inv] at this theorem length_mul_le (w₁ wβ‚‚ : W) : β„“ (w₁ * wβ‚‚) ≀ β„“ w₁ + β„“ wβ‚‚ := by rcases cs.exists_reduced_word w₁ with βŸ¨Ο‰β‚, hω₁, rfl⟩ rcases cs.exists_reduced_word wβ‚‚ with βŸ¨Ο‰β‚‚, hΟ‰β‚‚, rfl⟩ have := cs.length_wordProd_le (ω₁ ++ Ο‰β‚‚) simpa [hω₁, hΟ‰β‚‚, wordProd_append] using this theorem length_mul_ge_length_sub_length (w₁ wβ‚‚ : W) : β„“ w₁ - β„“ wβ‚‚ ≀ β„“ (w₁ * wβ‚‚) := by simpa [Nat.sub_le_of_le_add] using cs.length_mul_le (w₁ * wβ‚‚) w₂⁻¹ theorem length_mul_ge_length_sub_length' (w₁ wβ‚‚ : W) : β„“ wβ‚‚ - β„“ w₁ ≀ β„“ (w₁ * wβ‚‚) := by simpa [Nat.sub_le_of_le_add, add_comm] using cs.length_mul_le w₁⁻¹ (w₁ * wβ‚‚) theorem length_mul_ge_max (w₁ wβ‚‚ : W) : max (β„“ w₁ - β„“ wβ‚‚) (β„“ wβ‚‚ - β„“ w₁) ≀ β„“ (w₁ * wβ‚‚) := max_le_iff.mpr ⟨length_mul_ge_length_sub_length _ _ _, length_mul_ge_length_sub_length' _ _ _⟩ def lengthParity : W β†’* Multiplicative (ZMod 2) := cs.lift ⟨fun _ ↦ Multiplicative.ofAdd 1, by simp_rw [CoxeterMatrix.IsLiftable, ← ofAdd_add, (by decide : (1 + 1 : ZMod 2) = 0)] simp⟩ theorem lengthParity_simple (i : B): cs.lengthParity (s i) = Multiplicative.ofAdd 1 := cs.lift_apply_simple _ _ theorem lengthParity_comp_simple : cs.lengthParity ∘ cs.simple = fun _ ↦ Multiplicative.ofAdd 1 := funext cs.lengthParity_simple theorem lengthParity_eq_ofAdd_length (w : W) : cs.lengthParity w = Multiplicative.ofAdd (↑(β„“ w)) := by rcases cs.exists_reduced_word w with βŸ¨Ο‰, hΟ‰, rfl⟩ rw [← hΟ‰, wordProd, map_list_prod, List.map_map, lengthParity_comp_simple, map_const', prod_replicate, ← ofAdd_nsmul, nsmul_one] theorem length_mul_mod_two (w₁ wβ‚‚ : W) : β„“ (w₁ * wβ‚‚) % 2 = (β„“ w₁ + β„“ wβ‚‚) % 2 := by rw [← ZMod.natCast_eq_natCast_iff', Nat.cast_add] simpa only [lengthParity_eq_ofAdd_length, ofAdd_add] using map_mul cs.lengthParity w₁ wβ‚‚ @[simp] theorem length_simple (i : B) : β„“ (s i) = 1 := by apply Nat.le_antisymm Β· simpa using cs.length_wordProd_le [i] Β· by_contra! length_lt_one have : cs.lengthParity (s i) = Multiplicative.ofAdd 0 := by rw [lengthParity_eq_ofAdd_length, Nat.lt_one_iff.mp length_lt_one, Nat.cast_zero] have : Multiplicative.ofAdd (0 : ZMod 2) = Multiplicative.ofAdd 1 := this.symm.trans (cs.lengthParity_simple i) contradiction theorem length_eq_one_iff {w : W} : β„“ w = 1 ↔ βˆƒ i : B, w = s i := by constructor Β· intro h rcases cs.exists_reduced_word w with βŸ¨Ο‰, hΟ‰, rfl⟩ rcases List.length_eq_one.mp (hΟ‰.trans h) with ⟨i, rfl⟩ exact ⟨i, cs.wordProd_singleton i⟩ Β· rintro ⟨i, rfl⟩ exact cs.length_simple i theorem length_mul_simple_ne (w : W) (i : B) : β„“ (w * s i) β‰  β„“ w := by intro eq have length_mod_two := cs.length_mul_mod_two w (s i) rw [eq, length_simple] at length_mod_two rcases Nat.mod_two_eq_zero_or_one (β„“ w) with even | odd Β· rw [even, Nat.succ_mod_two_eq_one_iff.mpr even] at length_mod_two contradiction Β· rw [odd, Nat.succ_mod_two_eq_zero_iff.mpr odd] at length_mod_two contradiction theorem length_simple_mul_ne (w : W) (i : B) : β„“ (s i * w) β‰  β„“ w := by convert cs.length_mul_simple_ne w⁻¹ i using 1 Β· convert cs.length_inv ?_ using 2 simp Β· simp theorem length_mul_simple (w : W) (i : B) : β„“ (w * s i) = β„“ w + 1 ∨ β„“ (w * s i) + 1 = β„“ w := by rcases Nat.lt_or_gt_of_ne (cs.length_mul_simple_ne w i) with lt | gt Β· -- lt : β„“ (w * s i) < β„“ w right have length_ge := cs.length_mul_ge_length_sub_length w (s i) simp only [length_simple, tsub_le_iff_right] at length_ge -- length_ge : β„“ w ≀ β„“ (w * s i) + 1 linarith Β· -- gt : β„“ w < β„“ (w * s i) left have length_le := cs.length_mul_le w (s i) simp only [length_simple] at length_le -- length_le : β„“ (w * s i) ≀ β„“ w + 1 linarith theorem length_simple_mul (w : W) (i : B) : β„“ (s i * w) = β„“ w + 1 ∨ β„“ (s i * w) + 1 = β„“ w := by have := cs.length_mul_simple w⁻¹ i rwa [(by simp : w⁻¹ * (s i) = ((s i) * w)⁻¹), length_inv, length_inv] at this def IsReduced (Ο‰ : List B) : Prop := β„“ (Ο€ Ο‰) = Ο‰.length @[simp] theorem isReduced_reverse (Ο‰ : List B) : cs.IsReduced (Ο‰.reverse) ↔ cs.IsReduced Ο‰ := by simp [IsReduced] theorem exists_reduced_word' (w : W) : βˆƒ Ο‰ : List B, cs.IsReduced Ο‰ ∧ w = Ο€ Ο‰ := by rcases cs.exists_reduced_word w with βŸ¨Ο‰, hΟ‰, rfl⟩ use Ο‰ tauto private theorem isReduced_take_and_drop {Ο‰ : List B} (hΟ‰ : cs.IsReduced Ο‰) (j : β„•) : cs.IsReduced (Ο‰.take j) ∧ cs.IsReduced (Ο‰.drop j) := by have h₁ : β„“ (Ο€ (Ο‰.take j)) ≀ (Ο‰.take j).length := cs.length_wordProd_le (Ο‰.take j) have hβ‚‚ : β„“ (Ο€ (Ο‰.drop j)) ≀ (Ο‰.drop j).length := cs.length_wordProd_le (Ο‰.drop j) have h₃ := calc (Ο‰.take j).length + (Ο‰.drop j).length _ = Ο‰.length := by rw [← List.length_append, Ο‰.take_append_drop j]; _ = β„“ (Ο€ Ο‰) := hΟ‰.symm _ = β„“ (Ο€ (Ο‰.take j) * Ο€ (Ο‰.drop j)) := by rw [← cs.wordProd_append, Ο‰.take_append_drop j]; _ ≀ β„“ (Ο€ (Ο‰.take j)) + β„“ (Ο€ (Ο‰.drop j)) := cs.length_mul_le _ _ unfold IsReduced exact ⟨by linarith, by linarith⟩ theorem isReduced_take {Ο‰ : List B} (hΟ‰ : cs.IsReduced Ο‰) (j : β„•) : cs.IsReduced (Ο‰.take j) := (isReduced_take_and_drop _ hΟ‰ _).1 theorem isReduced_drop {Ο‰ : List B} (hΟ‰ : cs.IsReduced Ο‰) (j : β„•) : cs.IsReduced (Ο‰.drop j) := (isReduced_take_and_drop _ hΟ‰ _).2 theorem not_isReduced_alternatingWord (i i' : B) {m : β„•} (hM : M i i' β‰  0) (hm : m > M i i') : Β¬cs.IsReduced (alternatingWord i i' m) := by induction' hm with m _ ih Β· -- Base case; m = M i i' + 1 suffices h : β„“ (Ο€ (alternatingWord i i' (M i i' + 1))) < M i i' + 1 by unfold IsReduced rw [Nat.succ_eq_add_one, length_alternatingWord] linarith have : M i i' + 1 ≀ M i i' * 2 := by linarith [Nat.one_le_iff_ne_zero.mpr hM] rw [cs.prod_alternatingWord_eq_prod_alternatingWord_sub i i' _ this] have : M i i' * 2 - (M i i' + 1) = M i i' - 1 := by apply (Nat.sub_eq_iff_eq_add' this).mpr rw [add_assoc, add_comm 1, Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hM)] exact mul_two _ rw [this] calc β„“ (Ο€ (alternatingWord i' i (M i i' - 1))) _ ≀ (alternatingWord i' i (M i i' - 1)).length := cs.length_wordProd_le _ _ = M i i' - 1 := length_alternatingWord _ _ _ _ ≀ M i i' := Nat.sub_le _ _ _ < M i i' + 1 := Nat.lt_succ_self _ Β· -- Inductive step contrapose! ih rw [alternatingWord_succ'] at ih apply isReduced_drop (j := 1) at ih simpa using ih def IsLeftDescent (w : W) (i : B) : Prop := β„“ (s i * w) < β„“ w def IsRightDescent (w : W) (i : B) : Prop := β„“ (w * s i) < β„“ w
Mathlib/GroupTheory/Coxeter/Length.lean
267
267
theorem not_isLeftDescent_one (i : B) : Β¬cs.IsLeftDescent 1 i := by
simp [IsLeftDescent]
import Mathlib.Data.ZMod.Basic import Mathlib.Algebra.Group.Nat import Mathlib.Tactic.IntervalCases import Mathlib.GroupTheory.SpecificGroups.Dihedral import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import group_theory.specific_groups.quaternion from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6" inductive QuaternionGroup (n : β„•) : Type | a : ZMod (2 * n) β†’ QuaternionGroup n | xa : ZMod (2 * n) β†’ QuaternionGroup n deriving DecidableEq #align quaternion_group QuaternionGroup namespace QuaternionGroup variable {n : β„•} private def mul : QuaternionGroup n β†’ QuaternionGroup n β†’ QuaternionGroup n | a i, a j => a (i + j) | a i, xa j => xa (j - i) | xa i, a j => xa (i + j) | xa i, xa j => a (n + j - i) private def one : QuaternionGroup n := a 0 instance : Inhabited (QuaternionGroup n) := ⟨one⟩ private def inv : QuaternionGroup n β†’ QuaternionGroup n | a i => a (-i) | xa i => xa (n + i) instance : Group (QuaternionGroup n) where mul := mul mul_assoc := by rintro (i | i) (j | j) (k | k) <;> simp only [(Β· * Β·), mul] <;> ring_nf congr calc -(n : ZMod (2 * n)) = 0 - n := by rw [zero_sub] _ = 2 * n - n := by norm_cast; simp _ = n := by ring one := one one_mul := by rintro (i | i) Β· exact congr_arg a (zero_add i) Β· exact congr_arg xa (sub_zero i) mul_one := by rintro (i | i) Β· exact congr_arg a (add_zero i) Β· exact congr_arg xa (add_zero i) inv := inv mul_left_inv := by rintro (i | i) Β· exact congr_arg a (neg_add_self i) Β· exact congr_arg a (sub_self (n + i)) @[simp] theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) := rfl #align quaternion_group.a_mul_a QuaternionGroup.a_mul_a @[simp] theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) := rfl #align quaternion_group.a_mul_xa QuaternionGroup.a_mul_xa @[simp] theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) := rfl #align quaternion_group.xa_mul_a QuaternionGroup.xa_mul_a @[simp] theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) := rfl #align quaternion_group.xa_mul_xa QuaternionGroup.xa_mul_xa theorem one_def : (1 : QuaternionGroup n) = a 0 := rfl #align quaternion_group.one_def QuaternionGroup.one_def private def fintypeHelper : Sum (ZMod (2 * n)) (ZMod (2 * n)) ≃ QuaternionGroup n where invFun i := match i with | a j => Sum.inl j | xa j => Sum.inr j toFun i := match i with | Sum.inl j => a j | Sum.inr j => xa j left_inv := by rintro (x | x) <;> rfl right_inv := by rintro (x | x) <;> rfl def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 where toFun i := -- Porting note: Originally `QuaternionGroup.recOn i DihedralGroup.r DihedralGroup.sr` match i with | a j => DihedralGroup.r j | xa j => DihedralGroup.sr j invFun i := match i with | DihedralGroup.r j => a j | DihedralGroup.sr j => xa j left_inv := by rintro (k | k) <;> rfl right_inv := by rintro (k | k) <;> rfl map_mul' := by rintro (k | k) (l | l) <;> simp #align quaternion_group.quaternion_group_zero_equiv_dihedral_group_zero QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero instance [NeZero n] : Fintype (QuaternionGroup n) := Fintype.ofEquiv _ fintypeHelper instance : Nontrivial (QuaternionGroup n) := ⟨⟨a 0, xa 0, by revert n; simp⟩⟩ -- Porting note: `revert n; simp` was `decide` theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n := by rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul] ring #align quaternion_group.card QuaternionGroup.card @[simp] theorem a_one_pow (k : β„•) : (a 1 : QuaternionGroup n) ^ k = a k := by induction' k with k IH Β· rw [Nat.cast_zero]; rfl Β· rw [pow_succ, IH, a_mul_a] congr 1 norm_cast #align quaternion_group.a_one_pow QuaternionGroup.a_one_pow -- @[simp] -- Porting note: simp changes this to `a 0 = 1`, so this is no longer a good simp lemma.
Mathlib/GroupTheory/SpecificGroups/Quaternion.lean
189
192
theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 := by
rw [a_one_pow, one_def] congr 1 exact ZMod.natCast_self _
import Mathlib.Data.Matrix.Basic import Mathlib.Data.PEquiv #align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" namespace PEquiv open Matrix universe u v variable {k l m n : Type*} variable {Ξ± : Type v} open Matrix def toMatrix [DecidableEq n] [Zero Ξ±] [One Ξ±] (f : m ≃. n) : Matrix m n Ξ± := of fun i j => if j ∈ f i then (1 : Ξ±) else 0 #align pequiv.to_matrix PEquiv.toMatrix -- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024 @[simp] theorem toMatrix_apply [DecidableEq n] [Zero Ξ±] [One Ξ±] (f : m ≃. n) (i j) : toMatrix f i j = if j ∈ f i then (1 : Ξ±) else 0 := rfl #align pequiv.to_matrix_apply PEquiv.toMatrix_apply theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring Ξ±] (f : l ≃. m) (M : Matrix m n Ξ±) (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f i with fi Β· simp [h] Β· rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm] #align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero Ξ±] [One Ξ±] (f : m ≃. n) : (f.symm.toMatrix : Matrix n m Ξ±) = f.toMatrixα΅€ := by ext simp only [transpose, mem_iff_mem f, toMatrix_apply] congr #align pequiv.to_matrix_symm PEquiv.toMatrix_symm @[simp] theorem toMatrix_refl [DecidableEq n] [Zero Ξ±] [One Ξ±] : ((PEquiv.refl n).toMatrix : Matrix n n Ξ±) = 1 := by ext simp [toMatrix_apply, one_apply] #align pequiv.to_matrix_refl PEquiv.toMatrix_refl theorem matrix_mul_apply [Fintype m] [Semiring Ξ±] [DecidableEq n] (M : Matrix l m Ξ±) (f : m ≃. n) (i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f.symm j with fj Β· simp [h, ← f.eq_some_iff] Β· rw [Finset.sum_eq_single fj] Β· simp [h, ← f.eq_some_iff] Β· rintro b - n simp [h, ← f.eq_some_iff, n.symm] Β· simp #align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring Ξ±] (f : m ≃ m) (M : Matrix m n Ξ±) : f.toPEquiv.toMatrix * M = M.submatrix f id := by ext i j rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id] #align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix theorem mul_toPEquiv_toMatrix {m n Ξ± : Type*} [Fintype n] [DecidableEq n] [Semiring Ξ±] (f : n ≃ n) (M : Matrix m n Ξ±) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm := Matrix.ext fun i j => by rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply, Matrix.submatrix_apply, id] #align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring Ξ±] (f : l ≃. m) (g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n Ξ±) = f.toMatrix * g.toMatrix := by ext i j rw [mul_matrix_apply] dsimp [toMatrix, PEquiv.trans] cases f i <;> simp #align pequiv.to_matrix_trans PEquiv.toMatrix_trans @[simp] theorem toMatrix_bot [DecidableEq n] [Zero Ξ±] [One Ξ±] : ((βŠ₯ : PEquiv m n).toMatrix : Matrix m n Ξ±) = 0 := rfl #align pequiv.to_matrix_bot PEquiv.toMatrix_bot theorem toMatrix_injective [DecidableEq n] [MonoidWithZero Ξ±] [Nontrivial Ξ±] : Function.Injective (@toMatrix m n Ξ± _ _ _) := by classical intro f g refine not_imp_not.1 ?_ simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp] intro i hi use i cases' hf : f i with fi Β· cases' hg : g i with gi -- Porting note: was `cc` Β· rw [hf, hg] at hi exact (hi rfl).elim Β· use gi simp Β· use fi simp [hf.symm, Ne.symm hi] #align pequiv.to_matrix_injective PEquiv.toMatrix_injective theorem toMatrix_swap [DecidableEq n] [Ring Ξ±] (i j : n) : (Equiv.swap i j).toPEquiv.toMatrix = (1 : Matrix n n Ξ±) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix + (single j i).toMatrix := by ext dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply] split_ifs <;> simp_all #align pequiv.to_matrix_swap PEquiv.toMatrix_swap @[simp] theorem single_mul_single [Fintype n] [DecidableEq k] [DecidableEq m] [DecidableEq n] [Semiring Ξ±] (a : m) (b : n) (c : k) : ((single a b).toMatrix : Matrix _ _ Ξ±) * (single b c).toMatrix = (single a c).toMatrix := by rw [← toMatrix_trans, single_trans_single] #align pequiv.single_mul_single PEquiv.single_mul_single theorem single_mul_single_of_ne [Fintype n] [DecidableEq n] [DecidableEq k] [DecidableEq m] [Semiring Ξ±] {b₁ bβ‚‚ : n} (hb : b₁ β‰  bβ‚‚) (a : m) (c : k) : (single a b₁).toMatrix * (single bβ‚‚ c).toMatrix = (0 : Matrix _ _ Ξ±) := by rw [← toMatrix_trans, single_trans_single_of_ne hb, toMatrix_bot] #align pequiv.single_mul_single_of_ne PEquiv.single_mul_single_of_ne @[simp]
Mathlib/Data/Matrix/PEquiv.lean
167
170
theorem single_mul_single_right [Fintype n] [Fintype k] [DecidableEq n] [DecidableEq k] [DecidableEq m] [Semiring Ξ±] (a : m) (b : n) (c : k) (M : Matrix k l Ξ±) : (single a b).toMatrix * ((single b c).toMatrix * M) = (single a c).toMatrix * M := by
rw [← Matrix.mul_assoc, single_mul_single]
import Mathlib.Geometry.Manifold.ContMDiff.Basic open Set ChartedSpace SmoothManifoldWithCorners open scoped Manifold variable {π•œ : Type*} [NontriviallyNormedField π•œ] -- declare a smooth manifold `M` over the pair `(E, H)`. {E : Type*} [NormedAddCommGroup E] [NormedSpace π•œ E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners π•œ E H} {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] -- declare a smooth manifold `M'` over the pair `(E', H')`. {E' : Type*} [NormedAddCommGroup E'] [NormedSpace π•œ E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners π•œ E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] [SmoothManifoldWithCorners I' M'] -- declare functions, sets, points and smoothness indices {e : PartialHomeomorph M H} {x : M} {m n : β„•βˆž} section Atlas theorem contMDiff_model : ContMDiff I π“˜(π•œ, E) n I := by intro x refine (contMDiffAt_iff _ _).mpr ⟨I.continuousAt, ?_⟩ simp only [mfld_simps] refine contDiffWithinAt_id.congr_of_eventuallyEq ?_ ?_ Β· exact Filter.eventuallyEq_of_mem self_mem_nhdsWithin fun xβ‚‚ => I.right_inv simp_rw [Function.comp_apply, I.left_inv, Function.id_def] #align cont_mdiff_model contMDiff_model
Mathlib/Geometry/Manifold/ContMDiff/Atlas.lean
45
49
theorem contMDiffOn_model_symm : ContMDiffOn π“˜(π•œ, E) I n I.symm (range I) := by
rw [contMDiffOn_iff] refine ⟨I.continuousOn_symm, fun x y => ?_⟩ simp only [mfld_simps] exact contDiffOn_id.congr fun x' => I.right_inv
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ΞΉ : Type*} [Fintype ΞΉ] theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul] #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by simp [volume_eq_stieltjes_id] #align real.volume_val Real.volume_val @[simp] theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ico Real.volume_Ico @[simp] theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Icc Real.volume_Icc @[simp] theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioo Real.volume_Ioo @[simp] theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioc Real.volume_Ioc -- @[simp] -- Porting note (#10618): simp can prove this theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val] #align real.volume_singleton Real.volume_singleton -- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628 theorem volume_univ : volume (univ : Set ℝ) = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => calc (r : ℝβ‰₯0∞) = volume (Icc (0 : ℝ) r) := by simp _ ≀ volume univ := measure_mono (subset_univ _) #align real.volume_univ Real.volume_univ @[simp] theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_ball Real.volume_ball @[simp] theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_closed_ball Real.volume_closedBall @[simp] theorem volume_emetric_ball (a : ℝ) (r : ℝβ‰₯0∞) : volume (EMetric.ball a r) = 2 * r := by rcases eq_or_ne r ∞ with (rfl | hr) Β· rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add] Β· lift r to ℝβ‰₯0 using hr rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, ← NNReal.coe_add, ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul] #align real.volume_emetric_ball Real.volume_emetric_ball @[simp] theorem volume_emetric_closedBall (a : ℝ) (r : ℝβ‰₯0∞) : volume (EMetric.closedBall a r) = 2 * r := by rcases eq_or_ne r ∞ with (rfl | hr) Β· rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add] Β· lift r to ℝβ‰₯0 using hr rw [Metric.emetric_closedBall_nnreal, volume_closedBall, two_mul, ← NNReal.coe_add, ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul] #align real.volume_emetric_closed_ball Real.volume_emetric_closedBall instance noAtoms_volume : NoAtoms (volume : Measure ℝ) := ⟨fun _ => volume_singleton⟩ #align real.has_no_atoms_volume Real.noAtoms_volume @[simp] theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs] #align real.volume_interval Real.volume_interval @[simp] theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ := top_unique <| le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n => calc (n : ℝβ‰₯0∞) = volume (Ioo a (a + n)) := by simp _ ≀ volume (Ioi a) := measure_mono Ioo_subset_Ioi_self #align real.volume_Ioi Real.volume_Ioi @[simp] theorem volume_Ici {a : ℝ} : volume (Ici a) = ∞ := by rw [← measure_congr Ioi_ae_eq_Ici]; simp #align real.volume_Ici Real.volume_Ici @[simp]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
158
163
theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ := top_unique <| le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n => calc (n : ℝβ‰₯0∞) = volume (Ioo (a - n) a) := by
simp _ ≀ volume (Iio a) := measure_mono Ioo_subset_Iio_self
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.Finsupp import Mathlib.Tactic.FinCases #align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Affine namespace Finset theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by ext x fin_cases x <;> simp #align finset.univ_fin2 Finset.univ_fin2 variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [S : AffineSpace V P] variable {ΞΉ : Type*} (s : Finset ΞΉ) variable {ΞΉβ‚‚ : Type*} (sβ‚‚ : Finset ΞΉβ‚‚) def weightedVSubOfPoint (p : ΞΉ β†’ P) (b : P) : (ΞΉ β†’ k) β†’β‚—[k] V := βˆ‘ i ∈ s, (LinearMap.proj i : (ΞΉ β†’ k) β†’β‚—[k] k).smulRight (p i -α΅₯ b) #align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint @[simp] theorem weightedVSubOfPoint_apply (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) : s.weightedVSubOfPoint p b w = βˆ‘ i ∈ s, w i β€’ (p i -α΅₯ b) := by simp [weightedVSubOfPoint, LinearMap.sum_apply] #align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply @[simp (high)] theorem weightedVSubOfPoint_apply_const (w : ΞΉ β†’ k) (p : P) (b : P) : s.weightedVSubOfPoint (fun _ => p) b w = (βˆ‘ i ∈ s, w i) β€’ (p -α΅₯ b) := by rw [weightedVSubOfPoint_apply, sum_smul] #align finset.weighted_vsub_of_point_apply_const Finset.weightedVSubOfPoint_apply_const theorem weightedVSubOfPoint_congr {w₁ wβ‚‚ : ΞΉ β†’ k} (hw : βˆ€ i ∈ s, w₁ i = wβ‚‚ i) {p₁ pβ‚‚ : ΞΉ β†’ P} (hp : βˆ€ i ∈ s, p₁ i = pβ‚‚ i) (b : P) : s.weightedVSubOfPoint p₁ b w₁ = s.weightedVSubOfPoint pβ‚‚ b wβ‚‚ := by simp_rw [weightedVSubOfPoint_apply] refine sum_congr rfl fun i hi => ?_ rw [hw i hi, hp i hi] #align finset.weighted_vsub_of_point_congr Finset.weightedVSubOfPoint_congr theorem weightedVSubOfPoint_eq_of_weights_eq (p : ΞΉ β†’ P) (j : ΞΉ) (w₁ wβ‚‚ : ΞΉ β†’ k) (hw : βˆ€ i, i β‰  j β†’ w₁ i = wβ‚‚ i) : s.weightedVSubOfPoint p (p j) w₁ = s.weightedVSubOfPoint p (p j) wβ‚‚ := by simp only [Finset.weightedVSubOfPoint_apply] congr ext i rcases eq_or_ne i j with h | h Β· simp [h] Β· simp [hw i h] #align finset.weighted_vsub_of_point_eq_of_weights_eq Finset.weightedVSubOfPoint_eq_of_weights_eq theorem weightedVSubOfPoint_eq_of_sum_eq_zero (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (h : βˆ‘ i ∈ s, w i = 0) (b₁ bβ‚‚ : P) : s.weightedVSubOfPoint p b₁ w = s.weightedVSubOfPoint p bβ‚‚ w := by apply eq_of_sub_eq_zero rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_sub_distrib] conv_lhs => congr Β· skip Β· ext rw [← smul_sub, vsub_sub_vsub_cancel_left] rw [← sum_smul, h, zero_smul] #align finset.weighted_vsub_of_point_eq_of_sum_eq_zero Finset.weightedVSubOfPoint_eq_of_sum_eq_zero theorem weightedVSubOfPoint_vadd_eq_of_sum_eq_one (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (h : βˆ‘ i ∈ s, w i = 1) (b₁ bβ‚‚ : P) : s.weightedVSubOfPoint p b₁ w +α΅₯ b₁ = s.weightedVSubOfPoint p bβ‚‚ w +α΅₯ bβ‚‚ := by erw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← @vsub_eq_zero_iff_eq V, vadd_vsub_assoc, vsub_vadd_eq_vsub_sub, ← add_sub_assoc, add_comm, add_sub_assoc, ← sum_sub_distrib] conv_lhs => congr Β· skip Β· congr Β· skip Β· ext rw [← smul_sub, vsub_sub_vsub_cancel_left] rw [← sum_smul, h, one_smul, vsub_add_vsub_cancel, vsub_self] #align finset.weighted_vsub_of_point_vadd_eq_of_sum_eq_one Finset.weightedVSubOfPoint_vadd_eq_of_sum_eq_one @[simp (high)] theorem weightedVSubOfPoint_erase [DecidableEq ΞΉ] (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (i : ΞΉ) : (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] apply sum_erase rw [vsub_self, smul_zero] #align finset.weighted_vsub_of_point_erase Finset.weightedVSubOfPoint_erase @[simp (high)] theorem weightedVSubOfPoint_insert [DecidableEq ΞΉ] (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (i : ΞΉ) : (insert i s).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] apply sum_insert_zero rw [vsub_self, smul_zero] #align finset.weighted_vsub_of_point_insert Finset.weightedVSubOfPoint_insert theorem weightedVSubOfPoint_indicator_subset (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) {s₁ sβ‚‚ : Finset ΞΉ} (h : s₁ βŠ† sβ‚‚) : s₁.weightedVSubOfPoint p b w = sβ‚‚.weightedVSubOfPoint p b (Set.indicator (↑s₁) w) := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] exact Eq.symm <| sum_indicator_subset_of_eq_zero w (fun i wi => wi β€’ (p i -α΅₯ b : V)) h fun i => zero_smul k _ #align finset.weighted_vsub_of_point_indicator_subset Finset.weightedVSubOfPoint_indicator_subset theorem weightedVSubOfPoint_map (e : ΞΉβ‚‚ β†ͺ ΞΉ) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) : (sβ‚‚.map e).weightedVSubOfPoint p b w = sβ‚‚.weightedVSubOfPoint (p ∘ e) b (w ∘ e) := by simp_rw [weightedVSubOfPoint_apply] exact Finset.sum_map _ _ _ #align finset.weighted_vsub_of_point_map Finset.weightedVSubOfPoint_map theorem sum_smul_vsub_eq_weightedVSubOfPoint_sub (w : ΞΉ β†’ k) (p₁ pβ‚‚ : ΞΉ β†’ P) (b : P) : (βˆ‘ i ∈ s, w i β€’ (p₁ i -α΅₯ pβ‚‚ i)) = s.weightedVSubOfPoint p₁ b w - s.weightedVSubOfPoint pβ‚‚ b w := by simp_rw [weightedVSubOfPoint_apply, ← sum_sub_distrib, ← smul_sub, vsub_sub_vsub_cancel_right] #align finset.sum_smul_vsub_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_eq_weightedVSubOfPoint_sub theorem sum_smul_vsub_const_eq_weightedVSubOfPoint_sub (w : ΞΉ β†’ k) (p₁ : ΞΉ β†’ P) (pβ‚‚ b : P) : (βˆ‘ i ∈ s, w i β€’ (p₁ i -α΅₯ pβ‚‚)) = s.weightedVSubOfPoint p₁ b w - (βˆ‘ i ∈ s, w i) β€’ (pβ‚‚ -α΅₯ b) := by rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const] #align finset.sum_smul_vsub_const_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_const_eq_weightedVSubOfPoint_sub theorem sum_smul_const_vsub_eq_sub_weightedVSubOfPoint (w : ΞΉ β†’ k) (pβ‚‚ : ΞΉ β†’ P) (p₁ b : P) : (βˆ‘ i ∈ s, w i β€’ (p₁ -α΅₯ pβ‚‚ i)) = (βˆ‘ i ∈ s, w i) β€’ (p₁ -α΅₯ b) - s.weightedVSubOfPoint pβ‚‚ b w := by rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const] #align finset.sum_smul_const_vsub_eq_sub_weighted_vsub_of_point Finset.sum_smul_const_vsub_eq_sub_weightedVSubOfPoint theorem weightedVSubOfPoint_sdiff [DecidableEq ΞΉ] {sβ‚‚ : Finset ΞΉ} (h : sβ‚‚ βŠ† s) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) : (s \ sβ‚‚).weightedVSubOfPoint p b w + sβ‚‚.weightedVSubOfPoint p b w = s.weightedVSubOfPoint p b w := by simp_rw [weightedVSubOfPoint_apply, sum_sdiff h] #align finset.weighted_vsub_of_point_sdiff Finset.weightedVSubOfPoint_sdiff theorem weightedVSubOfPoint_sdiff_sub [DecidableEq ΞΉ] {sβ‚‚ : Finset ΞΉ} (h : sβ‚‚ βŠ† s) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) : (s \ sβ‚‚).weightedVSubOfPoint p b w - sβ‚‚.weightedVSubOfPoint p b (-w) = s.weightedVSubOfPoint p b w := by rw [map_neg, sub_neg_eq_add, s.weightedVSubOfPoint_sdiff h] #align finset.weighted_vsub_of_point_sdiff_sub Finset.weightedVSubOfPoint_sdiff_sub theorem weightedVSubOfPoint_subtype_eq_filter (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) (pred : ΞΉ β†’ Prop) [DecidablePred pred] : ((s.subtype pred).weightedVSubOfPoint (fun i => p i) b fun i => w i) = (s.filter pred).weightedVSubOfPoint p b w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_subtype_eq_sum_filter] #align finset.weighted_vsub_of_point_subtype_eq_filter Finset.weightedVSubOfPoint_subtype_eq_filter theorem weightedVSubOfPoint_filter_of_ne (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) {pred : ΞΉ β†’ Prop} [DecidablePred pred] (h : βˆ€ i ∈ s, w i β‰  0 β†’ pred i) : (s.filter pred).weightedVSubOfPoint p b w = s.weightedVSubOfPoint p b w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, sum_filter_of_ne] intro i hi hne refine h i hi ?_ intro hw simp [hw] at hne #align finset.weighted_vsub_of_point_filter_of_ne Finset.weightedVSubOfPoint_filter_of_ne theorem weightedVSubOfPoint_const_smul (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (b : P) (c : k) : s.weightedVSubOfPoint p b (c β€’ w) = c β€’ s.weightedVSubOfPoint p b w := by simp_rw [weightedVSubOfPoint_apply, smul_sum, Pi.smul_apply, smul_smul, smul_eq_mul] #align finset.weighted_vsub_of_point_const_smul Finset.weightedVSubOfPoint_const_smul def weightedVSub (p : ΞΉ β†’ P) : (ΞΉ β†’ k) β†’β‚—[k] V := s.weightedVSubOfPoint p (Classical.choice S.nonempty) #align finset.weighted_vsub Finset.weightedVSub theorem weightedVSub_apply (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : s.weightedVSub p w = βˆ‘ i ∈ s, w i β€’ (p i -α΅₯ Classical.choice S.nonempty) := by simp [weightedVSub, LinearMap.sum_apply] #align finset.weighted_vsub_apply Finset.weightedVSub_apply theorem weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (h : βˆ‘ i ∈ s, w i = 0) (b : P) : s.weightedVSub p w = s.weightedVSubOfPoint p b w := s.weightedVSubOfPoint_eq_of_sum_eq_zero w p h _ _ #align finset.weighted_vsub_eq_weighted_vsub_of_point_of_sum_eq_zero Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero @[simp] theorem weightedVSub_apply_const (w : ΞΉ β†’ k) (p : P) (h : βˆ‘ i ∈ s, w i = 0) : s.weightedVSub (fun _ => p) w = 0 := by rw [weightedVSub, weightedVSubOfPoint_apply_const, h, zero_smul] #align finset.weighted_vsub_apply_const Finset.weightedVSub_apply_const @[simp] theorem weightedVSub_empty (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : (βˆ… : Finset ΞΉ).weightedVSub p w = (0 : V) := by simp [weightedVSub_apply] #align finset.weighted_vsub_empty Finset.weightedVSub_empty theorem weightedVSub_congr {w₁ wβ‚‚ : ΞΉ β†’ k} (hw : βˆ€ i ∈ s, w₁ i = wβ‚‚ i) {p₁ pβ‚‚ : ΞΉ β†’ P} (hp : βˆ€ i ∈ s, p₁ i = pβ‚‚ i) : s.weightedVSub p₁ w₁ = s.weightedVSub pβ‚‚ wβ‚‚ := s.weightedVSubOfPoint_congr hw hp _ #align finset.weighted_vsub_congr Finset.weightedVSub_congr theorem weightedVSub_indicator_subset (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) {s₁ sβ‚‚ : Finset ΞΉ} (h : s₁ βŠ† sβ‚‚) : s₁.weightedVSub p w = sβ‚‚.weightedVSub p (Set.indicator (↑s₁) w) := weightedVSubOfPoint_indicator_subset _ _ _ h #align finset.weighted_vsub_indicator_subset Finset.weightedVSub_indicator_subset theorem weightedVSub_map (e : ΞΉβ‚‚ β†ͺ ΞΉ) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : (sβ‚‚.map e).weightedVSub p w = sβ‚‚.weightedVSub (p ∘ e) (w ∘ e) := sβ‚‚.weightedVSubOfPoint_map _ _ _ _ #align finset.weighted_vsub_map Finset.weightedVSub_map theorem sum_smul_vsub_eq_weightedVSub_sub (w : ΞΉ β†’ k) (p₁ pβ‚‚ : ΞΉ β†’ P) : (βˆ‘ i ∈ s, w i β€’ (p₁ i -α΅₯ pβ‚‚ i)) = s.weightedVSub p₁ w - s.weightedVSub pβ‚‚ w := s.sum_smul_vsub_eq_weightedVSubOfPoint_sub _ _ _ _ #align finset.sum_smul_vsub_eq_weighted_vsub_sub Finset.sum_smul_vsub_eq_weightedVSub_sub theorem sum_smul_vsub_const_eq_weightedVSub (w : ΞΉ β†’ k) (p₁ : ΞΉ β†’ P) (pβ‚‚ : P) (h : βˆ‘ i ∈ s, w i = 0) : (βˆ‘ i ∈ s, w i β€’ (p₁ i -α΅₯ pβ‚‚)) = s.weightedVSub p₁ w := by rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, sub_zero] #align finset.sum_smul_vsub_const_eq_weighted_vsub Finset.sum_smul_vsub_const_eq_weightedVSub theorem sum_smul_const_vsub_eq_neg_weightedVSub (w : ΞΉ β†’ k) (pβ‚‚ : ΞΉ β†’ P) (p₁ : P) (h : βˆ‘ i ∈ s, w i = 0) : (βˆ‘ i ∈ s, w i β€’ (p₁ -α΅₯ pβ‚‚ i)) = -s.weightedVSub pβ‚‚ w := by rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, zero_sub] #align finset.sum_smul_const_vsub_eq_neg_weighted_vsub Finset.sum_smul_const_vsub_eq_neg_weightedVSub theorem weightedVSub_sdiff [DecidableEq ΞΉ] {sβ‚‚ : Finset ΞΉ} (h : sβ‚‚ βŠ† s) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : (s \ sβ‚‚).weightedVSub p w + sβ‚‚.weightedVSub p w = s.weightedVSub p w := s.weightedVSubOfPoint_sdiff h _ _ _ #align finset.weighted_vsub_sdiff Finset.weightedVSub_sdiff theorem weightedVSub_sdiff_sub [DecidableEq ΞΉ] {sβ‚‚ : Finset ΞΉ} (h : sβ‚‚ βŠ† s) (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : (s \ sβ‚‚).weightedVSub p w - sβ‚‚.weightedVSub p (-w) = s.weightedVSub p w := s.weightedVSubOfPoint_sdiff_sub h _ _ _ #align finset.weighted_vsub_sdiff_sub Finset.weightedVSub_sdiff_sub theorem weightedVSub_subtype_eq_filter (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (pred : ΞΉ β†’ Prop) [DecidablePred pred] : ((s.subtype pred).weightedVSub (fun i => p i) fun i => w i) = (s.filter pred).weightedVSub p w := s.weightedVSubOfPoint_subtype_eq_filter _ _ _ _ #align finset.weighted_vsub_subtype_eq_filter Finset.weightedVSub_subtype_eq_filter theorem weightedVSub_filter_of_ne (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) {pred : ΞΉ β†’ Prop} [DecidablePred pred] (h : βˆ€ i ∈ s, w i β‰  0 β†’ pred i) : (s.filter pred).weightedVSub p w = s.weightedVSub p w := s.weightedVSubOfPoint_filter_of_ne _ _ _ h #align finset.weighted_vsub_filter_of_ne Finset.weightedVSub_filter_of_ne theorem weightedVSub_const_smul (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (c : k) : s.weightedVSub p (c β€’ w) = c β€’ s.weightedVSub p w := s.weightedVSubOfPoint_const_smul _ _ _ _ #align finset.weighted_vsub_const_smul Finset.weightedVSub_const_smul instance : AffineSpace (ΞΉ β†’ k) (ΞΉ β†’ k) := Pi.instAddTorsor variable (k) def affineCombination (p : ΞΉ β†’ P) : (ΞΉ β†’ k) →ᡃ[k] P where toFun w := s.weightedVSubOfPoint p (Classical.choice S.nonempty) w +α΅₯ Classical.choice S.nonempty linear := s.weightedVSub p map_vadd' w₁ wβ‚‚ := by simp_rw [vadd_vadd, weightedVSub, vadd_eq_add, LinearMap.map_add] #align finset.affine_combination Finset.affineCombination @[simp] theorem affineCombination_linear (p : ΞΉ β†’ P) : (s.affineCombination k p).linear = s.weightedVSub p := rfl #align finset.affine_combination_linear Finset.affineCombination_linear variable {k} theorem affineCombination_apply (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) : (s.affineCombination k p) w = s.weightedVSubOfPoint p (Classical.choice S.nonempty) w +α΅₯ Classical.choice S.nonempty := rfl #align finset.affine_combination_apply Finset.affineCombination_apply @[simp] theorem affineCombination_apply_const (w : ΞΉ β†’ k) (p : P) (h : βˆ‘ i ∈ s, w i = 1) : s.affineCombination k (fun _ => p) w = p := by rw [affineCombination_apply, s.weightedVSubOfPoint_apply_const, h, one_smul, vsub_vadd] #align finset.affine_combination_apply_const Finset.affineCombination_apply_const theorem affineCombination_congr {w₁ wβ‚‚ : ΞΉ β†’ k} (hw : βˆ€ i ∈ s, w₁ i = wβ‚‚ i) {p₁ pβ‚‚ : ΞΉ β†’ P} (hp : βˆ€ i ∈ s, p₁ i = pβ‚‚ i) : s.affineCombination k p₁ w₁ = s.affineCombination k pβ‚‚ wβ‚‚ := by simp_rw [affineCombination_apply, s.weightedVSubOfPoint_congr hw hp] #align finset.affine_combination_congr Finset.affineCombination_congr theorem affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one (w : ΞΉ β†’ k) (p : ΞΉ β†’ P) (h : βˆ‘ i ∈ s, w i = 1) (b : P) : s.affineCombination k p w = s.weightedVSubOfPoint p b w +α΅₯ b := s.weightedVSubOfPoint_vadd_eq_of_sum_eq_one w p h _ _ #align finset.affine_combination_eq_weighted_vsub_of_point_vadd_of_sum_eq_one Finset.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one theorem weightedVSub_vadd_affineCombination (w₁ wβ‚‚ : ΞΉ β†’ k) (p : ΞΉ β†’ P) : s.weightedVSub p w₁ +α΅₯ s.affineCombination k p wβ‚‚ = s.affineCombination k p (w₁ + wβ‚‚) := by rw [← vadd_eq_add, AffineMap.map_vadd, affineCombination_linear] #align finset.weighted_vsub_vadd_affine_combination Finset.weightedVSub_vadd_affineCombination theorem affineCombination_vsub (w₁ wβ‚‚ : ΞΉ β†’ k) (p : ΞΉ β†’ P) : s.affineCombination k p w₁ -α΅₯ s.affineCombination k p wβ‚‚ = s.weightedVSub p (w₁ - wβ‚‚) := by rw [← AffineMap.linearMap_vsub, affineCombination_linear, vsub_eq_sub] #align finset.affine_combination_vsub Finset.affineCombination_vsub
Mathlib/LinearAlgebra/AffineSpace/Combination.lean
431
444
theorem attach_affineCombination_of_injective [DecidableEq P] (s : Finset P) (w : P β†’ k) (f : s β†’ P) (hf : Function.Injective f) : s.attach.affineCombination k f (w ∘ f) = (image f univ).affineCombination k id w := by
simp only [affineCombination, weightedVSubOfPoint_apply, id, vadd_right_cancel_iff, Function.comp_apply, AffineMap.coe_mk] let g₁ : s β†’ V := fun i => w (f i) β€’ (f i -α΅₯ Classical.choice S.nonempty) let gβ‚‚ : P β†’ V := fun i => w i β€’ (i -α΅₯ Classical.choice S.nonempty) change univ.sum g₁ = (image f univ).sum gβ‚‚ have hgf : g₁ = gβ‚‚ ∘ f := by ext simp rw [hgf, sum_image] Β· simp only [Function.comp_apply] Β· exact fun _ _ _ _ hxy => hf hxy
import Mathlib.Analysis.BoxIntegral.Partition.Filter import Mathlib.Analysis.BoxIntegral.Partition.Measure import Mathlib.Topology.UniformSpace.Compact import Mathlib.Init.Data.Bool.Lemmas #align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical Topology NNReal Filter Uniformity BoxIntegral open Set Finset Function Filter Metric BoxIntegral.IntegrationParams noncomputable section namespace BoxIntegral universe u v w variable {ΞΉ : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {I J : Box ΞΉ} {Ο€ : TaggedPrepartition I} open TaggedPrepartition local notation "ℝⁿ" => ΞΉ β†’ ℝ def integralSum (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) : F := βˆ‘ J ∈ Ο€.boxes, vol J (f (Ο€.tag J)) #align box_integral.integral_sum BoxIntegral.integralSum theorem integralSum_biUnionTagged (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : Prepartition I) (Ο€i : βˆ€ J, TaggedPrepartition J) : integralSum f vol (Ο€.biUnionTagged Ο€i) = βˆ‘ J ∈ Ο€.boxes, integralSum f vol (Ο€i J) := by refine (Ο€.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_ rw [Ο€.tag_biUnionTagged hJ hJ'] #align box_integral.integral_sum_bUnion_tagged BoxIntegral.integralSum_biUnionTagged theorem integralSum_biUnion_partition (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) (Ο€i : βˆ€ J, Prepartition J) (hΟ€i : βˆ€ J ∈ Ο€, (Ο€i J).IsPartition) : integralSum f vol (Ο€.biUnionPrepartition Ο€i) = integralSum f vol Ο€ := by refine (Ο€.sum_biUnion_boxes _ _).trans (sum_congr rfl fun J hJ => ?_) calc (βˆ‘ J' ∈ (Ο€i J).boxes, vol J' (f (Ο€.tag <| Ο€.toPrepartition.biUnionIndex Ο€i J'))) = βˆ‘ J' ∈ (Ο€i J).boxes, vol J' (f (Ο€.tag J)) := sum_congr rfl fun J' hJ' => by rw [Prepartition.biUnionIndex_of_mem _ hJ hJ'] _ = vol J (f (Ο€.tag J)) := (vol.map ⟨⟨fun g : E β†’L[ℝ] F => g (f (Ο€.tag J)), rfl⟩, fun _ _ => rfl⟩).sum_partition_boxes le_top (hΟ€i J hJ) #align box_integral.integral_sum_bUnion_partition BoxIntegral.integralSum_biUnion_partition theorem integralSum_inf_partition (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) {Ο€' : Prepartition I} (h : Ο€'.IsPartition) : integralSum f vol (Ο€.infPrepartition Ο€') = integralSum f vol Ο€ := integralSum_biUnion_partition f vol Ο€ _ fun _J hJ => h.restrict (Prepartition.le_of_mem _ hJ) #align box_integral.integral_sum_inf_partition BoxIntegral.integralSum_inf_partition theorem integralSum_fiberwise {Ξ±} (g : Box ΞΉ β†’ Ξ±) (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) : (βˆ‘ y ∈ Ο€.boxes.image g, integralSum f vol (Ο€.filter (g Β· = y))) = integralSum f vol Ο€ := Ο€.sum_fiberwise g fun J => vol J (f <| Ο€.tag J) #align box_integral.integral_sum_fiberwise BoxIntegral.integralSum_fiberwise theorem integralSum_sub_partitions (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) {π₁ Ο€β‚‚ : TaggedPrepartition I} (h₁ : π₁.IsPartition) (hβ‚‚ : Ο€β‚‚.IsPartition) : integralSum f vol π₁ - integralSum f vol Ο€β‚‚ = βˆ‘ J ∈ (π₁.toPrepartition βŠ“ Ο€β‚‚.toPrepartition).boxes, (vol J (f <| (π₁.infPrepartition Ο€β‚‚.toPrepartition).tag J) - vol J (f <| (Ο€β‚‚.infPrepartition π₁.toPrepartition).tag J)) := by rw [← integralSum_inf_partition f vol π₁ hβ‚‚, ← integralSum_inf_partition f vol Ο€β‚‚ h₁, integralSum, integralSum, Finset.sum_sub_distrib] simp only [infPrepartition_toPrepartition, inf_comm] #align box_integral.integral_sum_sub_partitions BoxIntegral.integralSum_sub_partitions @[simp] theorem integralSum_disjUnion (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) {π₁ Ο€β‚‚ : TaggedPrepartition I} (h : Disjoint π₁.iUnion Ο€β‚‚.iUnion) : integralSum f vol (π₁.disjUnion Ο€β‚‚ h) = integralSum f vol π₁ + integralSum f vol Ο€β‚‚ := by refine (Prepartition.sum_disj_union_boxes h _).trans (congr_argβ‚‚ (Β· + Β·) (sum_congr rfl fun J hJ => ?_) (sum_congr rfl fun J hJ => ?_)) Β· rw [disjUnion_tag_of_mem_left _ hJ] Β· rw [disjUnion_tag_of_mem_right _ hJ] #align box_integral.integral_sum_disj_union BoxIntegral.integralSum_disjUnion @[simp] theorem integralSum_add (f g : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) : integralSum (f + g) vol Ο€ = integralSum f vol Ο€ + integralSum g vol Ο€ := by simp only [integralSum, Pi.add_apply, (vol _).map_add, Finset.sum_add_distrib] #align box_integral.integral_sum_add BoxIntegral.integralSum_add @[simp] theorem integralSum_neg (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) : integralSum (-f) vol Ο€ = -integralSum f vol Ο€ := by simp only [integralSum, Pi.neg_apply, (vol _).map_neg, Finset.sum_neg_distrib] #align box_integral.integral_sum_neg BoxIntegral.integralSum_neg @[simp] theorem integralSum_smul (c : ℝ) (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (Ο€ : TaggedPrepartition I) : integralSum (c β€’ f) vol Ο€ = c β€’ integralSum f vol Ο€ := by simp only [integralSum, Finset.smul_sum, Pi.smul_apply, ContinuousLinearMap.map_smul] #align box_integral.integral_sum_smul BoxIntegral.integralSum_smul variable [Fintype ΞΉ] def HasIntegral (I : Box ΞΉ) (l : IntegrationParams) (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) (y : F) : Prop := Tendsto (integralSum f vol) (l.toFilteriUnion I ⊀) (𝓝 y) #align box_integral.has_integral BoxIntegral.HasIntegral def Integrable (I : Box ΞΉ) (l : IntegrationParams) (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) := βˆƒ y, HasIntegral I l f vol y #align box_integral.integrable BoxIntegral.Integrable def integral (I : Box ΞΉ) (l : IntegrationParams) (f : ℝⁿ β†’ E) (vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F) := if h : Integrable I l f vol then h.choose else 0 #align box_integral.integral BoxIntegral.integral -- Porting note: using the above notation ℝⁿ here causes the theorem below to be silently ignored -- see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Lean.204.20doesn't.20add.20lemma.20to.20the.20environment/near/363764522 -- and https://github.com/leanprover/lean4/issues/2257 variable {l : IntegrationParams} {f g : (ΞΉ β†’ ℝ) β†’ E} {vol : ΞΉ →ᡇᡃ E β†’L[ℝ] F} {y y' : F} theorem HasIntegral.tendsto (h : HasIntegral I l f vol y) : Tendsto (integralSum f vol) (l.toFilteriUnion I ⊀) (𝓝 y) := h #align box_integral.has_integral.tendsto BoxIntegral.HasIntegral.tendsto theorem hasIntegral_iff : HasIntegral I l f vol y ↔ βˆ€ Ξ΅ > (0 : ℝ), βˆƒ r : ℝβ‰₯0 β†’ ℝⁿ β†’ Ioi (0 : ℝ), (βˆ€ c, l.RCond (r c)) ∧ βˆ€ c Ο€, l.MemBaseSet I c (r c) Ο€ β†’ IsPartition Ο€ β†’ dist (integralSum f vol Ο€) y ≀ Ξ΅ := ((l.hasBasis_toFilteriUnion_top I).tendsto_iff nhds_basis_closedBall).trans <| by simp [@forall_swap ℝβ‰₯0 (TaggedPrepartition I)] #align box_integral.has_integral_iff BoxIntegral.hasIntegral_iff theorem HasIntegral.of_mul (a : ℝ) (h : βˆ€ Ξ΅ : ℝ, 0 < Ξ΅ β†’ βˆƒ r : ℝβ‰₯0 β†’ ℝⁿ β†’ Ioi (0 : ℝ), (βˆ€ c, l.RCond (r c)) ∧ βˆ€ c Ο€, l.MemBaseSet I c (r c) Ο€ β†’ IsPartition Ο€ β†’ dist (integralSum f vol Ο€) y ≀ a * Ξ΅) : HasIntegral I l f vol y := by refine hasIntegral_iff.2 fun Ξ΅ hΞ΅ => ?_ rcases exists_pos_mul_lt hΞ΅ a with ⟨Ρ', hΞ΅', ha⟩ rcases h Ξ΅' hΞ΅' with ⟨r, hr, H⟩ exact ⟨r, hr, fun c Ο€ hΟ€ hΟ€p => (H c Ο€ hΟ€ hΟ€p).trans ha.le⟩ #align box_integral.has_integral_of_mul BoxIntegral.HasIntegral.of_mul theorem integrable_iff_cauchy [CompleteSpace F] : Integrable I l f vol ↔ Cauchy ((l.toFilteriUnion I ⊀).map (integralSum f vol)) := cauchy_map_iff_exists_tendsto.symm #align box_integral.integrable_iff_cauchy BoxIntegral.integrable_iff_cauchy theorem integrable_iff_cauchy_basis [CompleteSpace F] : Integrable I l f vol ↔ βˆ€ Ξ΅ > (0 : ℝ), βˆƒ r : ℝβ‰₯0 β†’ ℝⁿ β†’ Ioi (0 : ℝ), (βˆ€ c, l.RCond (r c)) ∧ βˆ€ c₁ cβ‚‚ π₁ Ο€β‚‚, l.MemBaseSet I c₁ (r c₁) π₁ β†’ π₁.IsPartition β†’ l.MemBaseSet I cβ‚‚ (r cβ‚‚) Ο€β‚‚ β†’ Ο€β‚‚.IsPartition β†’ dist (integralSum f vol π₁) (integralSum f vol Ο€β‚‚) ≀ Ξ΅ := by rw [integrable_iff_cauchy, cauchy_map_iff', (l.hasBasis_toFilteriUnion_top _).prod_self.tendsto_iff uniformity_basis_dist_le] refine forallβ‚‚_congr fun Ξ΅ _ => exists_congr fun r => ?_ simp only [exists_prop, Prod.forall, Set.mem_iUnion, exists_imp, prod_mk_mem_set_prod_eq, and_imp, mem_inter_iff, mem_setOf_eq] exact and_congr Iff.rfl ⟨fun H c₁ cβ‚‚ π₁ Ο€β‚‚ h₁ hU₁ hβ‚‚ hUβ‚‚ => H π₁ Ο€β‚‚ c₁ h₁ hU₁ cβ‚‚ hβ‚‚ hUβ‚‚, fun H π₁ Ο€β‚‚ c₁ h₁ hU₁ cβ‚‚ hβ‚‚ hUβ‚‚ => H c₁ cβ‚‚ π₁ Ο€β‚‚ h₁ hU₁ hβ‚‚ hUβ‚‚βŸ© #align box_integral.integrable_iff_cauchy_basis BoxIntegral.integrable_iff_cauchy_basis theorem HasIntegral.mono {l₁ lβ‚‚ : IntegrationParams} (h : HasIntegral I l₁ f vol y) (hl : lβ‚‚ ≀ l₁) : HasIntegral I lβ‚‚ f vol y := h.mono_left <| IntegrationParams.toFilteriUnion_mono _ hl _ #align box_integral.has_integral.mono BoxIntegral.HasIntegral.mono protected theorem Integrable.hasIntegral (h : Integrable I l f vol) : HasIntegral I l f vol (integral I l f vol) := by rw [integral, dif_pos h] exact Classical.choose_spec h #align box_integral.integrable.has_integral BoxIntegral.Integrable.hasIntegral theorem Integrable.mono {l'} (h : Integrable I l f vol) (hle : l' ≀ l) : Integrable I l' f vol := ⟨_, h.hasIntegral.mono hle⟩ #align box_integral.integrable.mono BoxIntegral.Integrable.mono theorem HasIntegral.unique (h : HasIntegral I l f vol y) (h' : HasIntegral I l f vol y') : y = y' := tendsto_nhds_unique h h' #align box_integral.has_integral.unique BoxIntegral.HasIntegral.unique theorem HasIntegral.integrable (h : HasIntegral I l f vol y) : Integrable I l f vol := ⟨_, h⟩ #align box_integral.has_integral.integrable BoxIntegral.HasIntegral.integrable theorem HasIntegral.integral_eq (h : HasIntegral I l f vol y) : integral I l f vol = y := h.integrable.hasIntegral.unique h #align box_integral.has_integral.integral_eq BoxIntegral.HasIntegral.integral_eq nonrec theorem HasIntegral.add (h : HasIntegral I l f vol y) (h' : HasIntegral I l g vol y') : HasIntegral I l (f + g) vol (y + y') := by simpa only [HasIntegral, ← integralSum_add] using h.add h' #align box_integral.has_integral.add BoxIntegral.HasIntegral.add theorem Integrable.add (hf : Integrable I l f vol) (hg : Integrable I l g vol) : Integrable I l (f + g) vol := (hf.hasIntegral.add hg.hasIntegral).integrable #align box_integral.integrable.add BoxIntegral.Integrable.add theorem integral_add (hf : Integrable I l f vol) (hg : Integrable I l g vol) : integral I l (f + g) vol = integral I l f vol + integral I l g vol := (hf.hasIntegral.add hg.hasIntegral).integral_eq #align box_integral.integral_add BoxIntegral.integral_add nonrec theorem HasIntegral.neg (hf : HasIntegral I l f vol y) : HasIntegral I l (-f) vol (-y) := by simpa only [HasIntegral, ← integralSum_neg] using hf.neg #align box_integral.has_integral.neg BoxIntegral.HasIntegral.neg theorem Integrable.neg (hf : Integrable I l f vol) : Integrable I l (-f) vol := hf.hasIntegral.neg.integrable #align box_integral.integrable.neg BoxIntegral.Integrable.neg theorem Integrable.of_neg (hf : Integrable I l (-f) vol) : Integrable I l f vol := neg_neg f β–Έ hf.neg #align box_integral.integrable.of_neg BoxIntegral.Integrable.of_neg @[simp] theorem integrable_neg : Integrable I l (-f) vol ↔ Integrable I l f vol := ⟨fun h => h.of_neg, fun h => h.neg⟩ #align box_integral.integrable_neg BoxIntegral.integrable_neg @[simp] theorem integral_neg : integral I l (-f) vol = -integral I l f vol := if h : Integrable I l f vol then h.hasIntegral.neg.integral_eq else by rw [integral, integral, dif_neg h, dif_neg (mt Integrable.of_neg h), neg_zero] #align box_integral.integral_neg BoxIntegral.integral_neg theorem HasIntegral.sub (h : HasIntegral I l f vol y) (h' : HasIntegral I l g vol y') : HasIntegral I l (f - g) vol (y - y') := by simpa only [sub_eq_add_neg] using h.add h'.neg #align box_integral.has_integral.sub BoxIntegral.HasIntegral.sub theorem Integrable.sub (hf : Integrable I l f vol) (hg : Integrable I l g vol) : Integrable I l (f - g) vol := (hf.hasIntegral.sub hg.hasIntegral).integrable #align box_integral.integrable.sub BoxIntegral.Integrable.sub theorem integral_sub (hf : Integrable I l f vol) (hg : Integrable I l g vol) : integral I l (f - g) vol = integral I l f vol - integral I l g vol := (hf.hasIntegral.sub hg.hasIntegral).integral_eq #align box_integral.integral_sub BoxIntegral.integral_sub theorem hasIntegral_const (c : E) : HasIntegral I l (fun _ => c) vol (vol I c) := tendsto_const_nhds.congr' <| (l.eventually_isPartition I).mono fun _Ο€ hΟ€ => Eq.symm <| (vol.map ⟨⟨fun g : E β†’L[ℝ] F ↦ g c, rfl⟩, fun _ _ ↦ rfl⟩).sum_partition_boxes le_top hΟ€ #align box_integral.has_integral_const BoxIntegral.hasIntegral_const @[simp] theorem integral_const (c : E) : integral I l (fun _ => c) vol = vol I c := (hasIntegral_const c).integral_eq #align box_integral.integral_const BoxIntegral.integral_const theorem integrable_const (c : E) : Integrable I l (fun _ => c) vol := ⟨_, hasIntegral_const c⟩ #align box_integral.integrable_const BoxIntegral.integrable_const theorem hasIntegral_zero : HasIntegral I l (fun _ => (0 : E)) vol 0 := by simpa only [← (vol I).map_zero] using hasIntegral_const (0 : E) #align box_integral.has_integral_zero BoxIntegral.hasIntegral_zero theorem integrable_zero : Integrable I l (fun _ => (0 : E)) vol := ⟨0, hasIntegral_zero⟩ #align box_integral.integrable_zero BoxIntegral.integrable_zero theorem integral_zero : integral I l (fun _ => (0 : E)) vol = 0 := hasIntegral_zero.integral_eq #align box_integral.integral_zero BoxIntegral.integral_zero theorem HasIntegral.sum {Ξ± : Type*} {s : Finset Ξ±} {f : Ξ± β†’ ℝⁿ β†’ E} {g : Ξ± β†’ F} (h : βˆ€ i ∈ s, HasIntegral I l (f i) vol (g i)) : HasIntegral I l (fun x => βˆ‘ i ∈ s, f i x) vol (βˆ‘ i ∈ s, g i) := by induction' s using Finset.induction_on with a s ha ihs; Β· simp [hasIntegral_zero] simp only [Finset.sum_insert ha]; rw [Finset.forall_mem_insert] at h exact h.1.add (ihs h.2) #align box_integral.has_integral_sum BoxIntegral.HasIntegral.sum theorem HasIntegral.smul (hf : HasIntegral I l f vol y) (c : ℝ) : HasIntegral I l (c β€’ f) vol (c β€’ y) := by simpa only [HasIntegral, ← integralSum_smul] using (tendsto_const_nhds : Tendsto _ _ (𝓝 c)).smul hf #align box_integral.has_integral.smul BoxIntegral.HasIntegral.smul theorem Integrable.smul (hf : Integrable I l f vol) (c : ℝ) : Integrable I l (c β€’ f) vol := (hf.hasIntegral.smul c).integrable #align box_integral.integrable.smul BoxIntegral.Integrable.smul theorem Integrable.of_smul {c : ℝ} (hf : Integrable I l (c β€’ f) vol) (hc : c β‰  0) : Integrable I l f vol := by simpa [inv_smul_smulβ‚€ hc] using hf.smul c⁻¹ #align box_integral.integrable.of_smul BoxIntegral.Integrable.of_smul @[simp]
Mathlib/Analysis/BoxIntegral/Basic.lean
364
369
theorem integral_smul (c : ℝ) : integral I l (fun x => c β€’ f x) vol = c β€’ integral I l f vol := by
rcases eq_or_ne c 0 with (rfl | hc); Β· simp only [zero_smul, integral_zero] by_cases hf : Integrable I l f vol Β· exact (hf.hasIntegral.smul c).integral_eq Β· have : Β¬Integrable I l (fun x => c β€’ f x) vol := mt (fun h => h.of_smul hc) hf rw [integral, integral, dif_neg hf, dif_neg this, smul_zero]
import Mathlib.SetTheory.Ordinal.Arithmetic #align_import set_theory.ordinal.exponential from "leanprover-community/mathlib"@"b67044ba53af18680e1dd246861d9584e968495d" noncomputable section open Function Cardinal Set Equiv Order open scoped Classical open Cardinal Ordinal universe u v w namespace Ordinal instance pow : Pow Ordinal Ordinal := ⟨fun a b => if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b⟩ -- Porting note: Ambiguous notations. -- local infixr:0 "^" => @Pow.pow Ordinal Ordinal Ordinal.instPowOrdinalOrdinal theorem opow_def (a b : Ordinal) : a ^ b = if a = 0 then 1 - b else limitRecOn b 1 (fun _ IH => IH * a) fun b _ => bsup.{u, u} b := rfl #align ordinal.opow_def Ordinal.opow_def -- Porting note: `if_pos rfl` β†’ `if_true` theorem zero_opow' (a : Ordinal) : 0 ^ a = 1 - a := by simp only [opow_def, if_true] #align ordinal.zero_opow' Ordinal.zero_opow' @[simp] theorem zero_opow {a : Ordinal} (a0 : a β‰  0) : (0 : Ordinal) ^ a = 0 := by rwa [zero_opow', Ordinal.sub_eq_zero_iff_le, one_le_iff_ne_zero] #align ordinal.zero_opow Ordinal.zero_opow @[simp] theorem opow_zero (a : Ordinal) : a ^ (0 : Ordinal) = 1 := by by_cases h : a = 0 Β· simp only [opow_def, if_pos h, sub_zero] Β· simp only [opow_def, if_neg h, limitRecOn_zero] #align ordinal.opow_zero Ordinal.opow_zero @[simp] theorem opow_succ (a b : Ordinal) : a ^ succ b = a ^ b * a := if h : a = 0 then by subst a; simp only [zero_opow (succ_ne_zero _), mul_zero] else by simp only [opow_def, limitRecOn_succ, if_neg h] #align ordinal.opow_succ Ordinal.opow_succ theorem opow_limit {a b : Ordinal} (a0 : a β‰  0) (h : IsLimit b) : a ^ b = bsup.{u, u} b fun c _ => a ^ c := by simp only [opow_def, if_neg a0]; rw [limitRecOn_limit _ _ _ _ h] #align ordinal.opow_limit Ordinal.opow_limit theorem opow_le_of_limit {a b c : Ordinal} (a0 : a β‰  0) (h : IsLimit b) : a ^ b ≀ c ↔ βˆ€ b' < b, a ^ b' ≀ c := by rw [opow_limit a0 h, bsup_le_iff] #align ordinal.opow_le_of_limit Ordinal.opow_le_of_limit theorem lt_opow_of_limit {a b c : Ordinal} (b0 : b β‰  0) (h : IsLimit c) : a < b ^ c ↔ βˆƒ c' < c, a < b ^ c' := by rw [← not_iff_not, not_exists]; simp only [not_lt, opow_le_of_limit b0 h, exists_prop, not_and] #align ordinal.lt_opow_of_limit Ordinal.lt_opow_of_limit @[simp] theorem opow_one (a : Ordinal) : a ^ (1 : Ordinal) = a := by rw [← succ_zero, opow_succ]; simp only [opow_zero, one_mul] #align ordinal.opow_one Ordinal.opow_one @[simp] theorem one_opow (a : Ordinal) : (1 : Ordinal) ^ a = 1 := by induction a using limitRecOn with | H₁ => simp only [opow_zero] | Hβ‚‚ _ ih => simp only [opow_succ, ih, mul_one] | H₃ b l IH => refine eq_of_forall_ge_iff fun c => ?_ rw [opow_le_of_limit Ordinal.one_ne_zero l] exact ⟨fun H => by simpa only [opow_zero] using H 0 l.pos, fun H b' h => by rwa [IH _ h]⟩ #align ordinal.one_opow Ordinal.one_opow theorem opow_pos {a : Ordinal} (b : Ordinal) (a0 : 0 < a) : 0 < a ^ b := by have h0 : 0 < a ^ (0 : Ordinal) := by simp only [opow_zero, zero_lt_one] induction b using limitRecOn with | H₁ => exact h0 | Hβ‚‚ b IH => rw [opow_succ] exact mul_pos IH a0 | H₃ b l _ => exact (lt_opow_of_limit (Ordinal.pos_iff_ne_zero.1 a0) l).2 ⟨0, l.pos, h0⟩ #align ordinal.opow_pos Ordinal.opow_pos theorem opow_ne_zero {a : Ordinal} (b : Ordinal) (a0 : a β‰  0) : a ^ b β‰  0 := Ordinal.pos_iff_ne_zero.1 <| opow_pos b <| Ordinal.pos_iff_ne_zero.2 a0 #align ordinal.opow_ne_zero Ordinal.opow_ne_zero theorem opow_isNormal {a : Ordinal} (h : 1 < a) : IsNormal (a ^ Β·) := have a0 : 0 < a := zero_lt_one.trans h ⟨fun b => by simpa only [mul_one, opow_succ] using (mul_lt_mul_iff_left (opow_pos b a0)).2 h, fun b l c => opow_le_of_limit (ne_of_gt a0) l⟩ #align ordinal.opow_is_normal Ordinal.opow_isNormal theorem opow_lt_opow_iff_right {a b c : Ordinal} (a1 : 1 < a) : a ^ b < a ^ c ↔ b < c := (opow_isNormal a1).lt_iff #align ordinal.opow_lt_opow_iff_right Ordinal.opow_lt_opow_iff_right theorem opow_le_opow_iff_right {a b c : Ordinal} (a1 : 1 < a) : a ^ b ≀ a ^ c ↔ b ≀ c := (opow_isNormal a1).le_iff #align ordinal.opow_le_opow_iff_right Ordinal.opow_le_opow_iff_right theorem opow_right_inj {a b c : Ordinal} (a1 : 1 < a) : a ^ b = a ^ c ↔ b = c := (opow_isNormal a1).inj #align ordinal.opow_right_inj Ordinal.opow_right_inj theorem opow_isLimit {a b : Ordinal} (a1 : 1 < a) : IsLimit b β†’ IsLimit (a ^ b) := (opow_isNormal a1).isLimit #align ordinal.opow_is_limit Ordinal.opow_isLimit theorem opow_isLimit_left {a b : Ordinal} (l : IsLimit a) (hb : b β‰  0) : IsLimit (a ^ b) := by rcases zero_or_succ_or_limit b with (e | ⟨b, rfl⟩ | l') Β· exact absurd e hb Β· rw [opow_succ] exact mul_isLimit (opow_pos _ l.pos) l Β· exact opow_isLimit l.one_lt l' #align ordinal.opow_is_limit_left Ordinal.opow_isLimit_left theorem opow_le_opow_right {a b c : Ordinal} (h₁ : 0 < a) (hβ‚‚ : b ≀ c) : a ^ b ≀ a ^ c := by rcases lt_or_eq_of_le (one_le_iff_pos.2 h₁) with h₁ | h₁ Β· exact (opow_le_opow_iff_right h₁).2 hβ‚‚ Β· subst a -- Porting note: `le_refl` is required. simp only [one_opow, le_refl] #align ordinal.opow_le_opow_right Ordinal.opow_le_opow_right theorem opow_le_opow_left {a b : Ordinal} (c : Ordinal) (ab : a ≀ b) : a ^ c ≀ b ^ c := by by_cases a0 : a = 0 -- Porting note: `le_refl` is required. Β· subst a by_cases c0 : c = 0 Β· subst c simp only [opow_zero, le_refl] Β· simp only [zero_opow c0, Ordinal.zero_le] Β· induction c using limitRecOn with | H₁ => simp only [opow_zero, le_refl] | Hβ‚‚ c IH => simpa only [opow_succ] using mul_le_mul' IH ab | H₃ c l IH => exact (opow_le_of_limit a0 l).2 fun b' h => (IH _ h).trans (opow_le_opow_right ((Ordinal.pos_iff_ne_zero.2 a0).trans_le ab) h.le) #align ordinal.opow_le_opow_left Ordinal.opow_le_opow_left theorem left_le_opow (a : Ordinal) {b : Ordinal} (b1 : 0 < b) : a ≀ a ^ b := by nth_rw 1 [← opow_one a] cases' le_or_gt a 1 with a1 a1 Β· rcases lt_or_eq_of_le a1 with a0 | a1 Β· rw [lt_one_iff_zero] at a0 rw [a0, zero_opow Ordinal.one_ne_zero] exact Ordinal.zero_le _ rw [a1, one_opow, one_opow] rwa [opow_le_opow_iff_right a1, one_le_iff_pos] #align ordinal.left_le_opow Ordinal.left_le_opow theorem right_le_opow {a : Ordinal} (b : Ordinal) (a1 : 1 < a) : b ≀ a ^ b := (opow_isNormal a1).self_le _ #align ordinal.right_le_opow Ordinal.right_le_opow theorem opow_lt_opow_left_of_succ {a b c : Ordinal} (ab : a < b) : a ^ succ c < b ^ succ c := by rw [opow_succ, opow_succ] exact (mul_le_mul_right' (opow_le_opow_left c ab.le) a).trans_lt (mul_lt_mul_of_pos_left ab (opow_pos c ((Ordinal.zero_le a).trans_lt ab))) #align ordinal.opow_lt_opow_left_of_succ Ordinal.opow_lt_opow_left_of_succ
Mathlib/SetTheory/Ordinal/Exponential.lean
187
208
theorem opow_add (a b c : Ordinal) : a ^ (b + c) = a ^ b * a ^ c := by
rcases eq_or_ne a 0 with (rfl | a0) Β· rcases eq_or_ne c 0 with (rfl | c0) Β· simp have : b + c β‰  0 := ((Ordinal.pos_iff_ne_zero.2 c0).trans_le (le_add_left _ _)).ne' simp only [zero_opow c0, zero_opow this, mul_zero] rcases eq_or_lt_of_le (one_le_iff_ne_zero.2 a0) with (rfl | a1) Β· simp only [one_opow, mul_one] induction c using limitRecOn with | H₁ => simp | Hβ‚‚ c IH => rw [add_succ, opow_succ, IH, opow_succ, mul_assoc] | H₃ c l IH => refine eq_of_forall_ge_iff fun d => (((opow_isNormal a1).trans (add_isNormal b)).limit_le l).trans ?_ dsimp only [Function.comp_def] simp (config := { contextual := true }) only [IH] exact (((mul_isNormal <| opow_pos b (Ordinal.pos_iff_ne_zero.2 a0)).trans (opow_isNormal a1)).limit_le l).symm
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Combinatorics.SimpleGraph.Density import Mathlib.Data.Nat.Cast.Field import Mathlib.Order.Partition.Equipartition import Mathlib.SetTheory.Ordinal.Basic #align_import combinatorics.simple_graph.regularity.uniform from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d" open Finset variable {Ξ± π•œ : Type*} [LinearOrderedField π•œ] namespace SimpleGraph variable (G : SimpleGraph Ξ±) [DecidableRel G.Adj] (Ξ΅ : π•œ) {s t : Finset Ξ±} {a b : Ξ±} def IsUniform (s t : Finset Ξ±) : Prop := βˆ€ ⦃s'⦄, s' βŠ† s β†’ βˆ€ ⦃t'⦄, t' βŠ† t β†’ (s.card : π•œ) * Ξ΅ ≀ s'.card β†’ (t.card : π•œ) * Ξ΅ ≀ t'.card β†’ |(G.edgeDensity s' t' : π•œ) - (G.edgeDensity s t : π•œ)| < Ξ΅ #align simple_graph.is_uniform SimpleGraph.IsUniform variable {G Ξ΅} instance IsUniform.instDecidableRel : DecidableRel (G.IsUniform Ξ΅) := by unfold IsUniform; infer_instance theorem IsUniform.mono {Ξ΅' : π•œ} (h : Ξ΅ ≀ Ξ΅') (hΞ΅ : IsUniform G Ξ΅ s t) : IsUniform G Ξ΅' s t := fun s' hs' t' ht' hs ht => by refine (hΞ΅ hs' ht' (le_trans ?_ hs) (le_trans ?_ ht)).trans_le h <;> gcongr #align simple_graph.is_uniform.mono SimpleGraph.IsUniform.mono theorem IsUniform.symm : Symmetric (IsUniform G Ξ΅) := fun s t h t' ht' s' hs' ht hs => by rw [edgeDensity_comm _ t', edgeDensity_comm _ t] exact h hs' ht' hs ht #align simple_graph.is_uniform.symm SimpleGraph.IsUniform.symm variable (G) theorem isUniform_comm : IsUniform G Ξ΅ s t ↔ IsUniform G Ξ΅ t s := ⟨fun h => h.symm, fun h => h.symm⟩ #align simple_graph.is_uniform_comm SimpleGraph.isUniform_comm lemma isUniform_one : G.IsUniform (1 : π•œ) s t := by intro s' hs' t' ht' hs ht rw [mul_one] at hs ht rw [eq_of_subset_of_card_le hs' (Nat.cast_le.1 hs), eq_of_subset_of_card_le ht' (Nat.cast_le.1 ht), sub_self, abs_zero] exact zero_lt_one #align simple_graph.is_uniform_one SimpleGraph.isUniform_one variable {G} lemma IsUniform.pos (hG : G.IsUniform Ξ΅ s t) : 0 < Ξ΅ := not_le.1 fun hΞ΅ ↦ (hΞ΅.trans $ abs_nonneg _).not_lt $ hG (empty_subset _) (empty_subset _) (by simpa using mul_nonpos_of_nonneg_of_nonpos (Nat.cast_nonneg _) hΞ΅) (by simpa using mul_nonpos_of_nonneg_of_nonpos (Nat.cast_nonneg _) hΞ΅) @[simp] lemma isUniform_singleton : G.IsUniform Ξ΅ {a} {b} ↔ 0 < Ξ΅ := by refine ⟨IsUniform.pos, fun hΞ΅ s' hs' t' ht' hs ht ↦ ?_⟩ rw [card_singleton, Nat.cast_one, one_mul] at hs ht obtain rfl | rfl := Finset.subset_singleton_iff.1 hs' Β· replace hs : Ξ΅ ≀ 0 := by simpa using hs exact (hΞ΅.not_le hs).elim obtain rfl | rfl := Finset.subset_singleton_iff.1 ht' Β· replace ht : Ξ΅ ≀ 0 := by simpa using ht exact (hΞ΅.not_le ht).elim Β· rwa [sub_self, abs_zero] #align simple_graph.is_uniform_singleton SimpleGraph.isUniform_singleton theorem not_isUniform_zero : Β¬G.IsUniform (0 : π•œ) s t := fun h => (abs_nonneg _).not_lt <| h (empty_subset _) (empty_subset _) (by simp) (by simp) #align simple_graph.not_is_uniform_zero SimpleGraph.not_isUniform_zero theorem not_isUniform_iff : Β¬G.IsUniform Ξ΅ s t ↔ βˆƒ s', s' βŠ† s ∧ βˆƒ t', t' βŠ† t ∧ ↑s.card * Ξ΅ ≀ s'.card ∧ ↑t.card * Ξ΅ ≀ t'.card ∧ Ξ΅ ≀ |G.edgeDensity s' t' - G.edgeDensity s t| := by unfold IsUniform simp only [not_forall, not_lt, exists_prop, exists_and_left, Rat.cast_abs, Rat.cast_sub] #align simple_graph.not_is_uniform_iff SimpleGraph.not_isUniform_iff open scoped Classical variable (G) noncomputable def nonuniformWitnesses (Ξ΅ : π•œ) (s t : Finset Ξ±) : Finset Ξ± Γ— Finset Ξ± := if h : Β¬G.IsUniform Ξ΅ s t then ((not_isUniform_iff.1 h).choose, (not_isUniform_iff.1 h).choose_spec.2.choose) else (s, t) #align simple_graph.nonuniform_witnesses SimpleGraph.nonuniformWitnesses theorem left_nonuniformWitnesses_subset (h : Β¬G.IsUniform Ξ΅ s t) : (G.nonuniformWitnesses Ξ΅ s t).1 βŠ† s := by rw [nonuniformWitnesses, dif_pos h] exact (not_isUniform_iff.1 h).choose_spec.1 #align simple_graph.left_nonuniform_witnesses_subset SimpleGraph.left_nonuniformWitnesses_subset theorem left_nonuniformWitnesses_card (h : Β¬G.IsUniform Ξ΅ s t) : (s.card : π•œ) * Ξ΅ ≀ (G.nonuniformWitnesses Ξ΅ s t).1.card := by rw [nonuniformWitnesses, dif_pos h] exact (not_isUniform_iff.1 h).choose_spec.2.choose_spec.2.1 #align simple_graph.left_nonuniform_witnesses_card SimpleGraph.left_nonuniformWitnesses_card theorem right_nonuniformWitnesses_subset (h : Β¬G.IsUniform Ξ΅ s t) : (G.nonuniformWitnesses Ξ΅ s t).2 βŠ† t := by rw [nonuniformWitnesses, dif_pos h] exact (not_isUniform_iff.1 h).choose_spec.2.choose_spec.1 #align simple_graph.right_nonuniform_witnesses_subset SimpleGraph.right_nonuniformWitnesses_subset theorem right_nonuniformWitnesses_card (h : Β¬G.IsUniform Ξ΅ s t) : (t.card : π•œ) * Ξ΅ ≀ (G.nonuniformWitnesses Ξ΅ s t).2.card := by rw [nonuniformWitnesses, dif_pos h] exact (not_isUniform_iff.1 h).choose_spec.2.choose_spec.2.2.1 #align simple_graph.right_nonuniform_witnesses_card SimpleGraph.right_nonuniformWitnesses_card theorem nonuniformWitnesses_spec (h : Β¬G.IsUniform Ξ΅ s t) : Ξ΅ ≀ |G.edgeDensity (G.nonuniformWitnesses Ξ΅ s t).1 (G.nonuniformWitnesses Ξ΅ s t).2 - G.edgeDensity s t| := by rw [nonuniformWitnesses, dif_pos h] exact (not_isUniform_iff.1 h).choose_spec.2.choose_spec.2.2.2 #align simple_graph.nonuniform_witnesses_spec SimpleGraph.nonuniformWitnesses_spec noncomputable def nonuniformWitness (Ξ΅ : π•œ) (s t : Finset Ξ±) : Finset Ξ± := if WellOrderingRel s t then (G.nonuniformWitnesses Ξ΅ s t).1 else (G.nonuniformWitnesses Ξ΅ t s).2 #align simple_graph.nonuniform_witness SimpleGraph.nonuniformWitness
Mathlib/Combinatorics/SimpleGraph/Regularity/Uniform.lean
175
179
theorem nonuniformWitness_subset (h : Β¬G.IsUniform Ξ΅ s t) : G.nonuniformWitness Ξ΅ s t βŠ† s := by
unfold nonuniformWitness split_ifs Β· exact G.left_nonuniformWitnesses_subset h Β· exact G.right_nonuniformWitnesses_subset fun i => h i.symm
import Mathlib.Analysis.NormedSpace.Multilinear.Basic #align_import analysis.normed_space.multilinear from "leanprover-community/mathlib"@"f40476639bac089693a489c9e354ebd75dc0f886" suppress_compilation noncomputable section open NNReal Finset Metric ContinuousMultilinearMap Fin Function universe u v v' wE wE₁ wE' wEi wG wG' variable {π•œ : Type u} {ΞΉ : Type v} {ΞΉ' : Type v'} {n : β„•} {E : ΞΉ β†’ Type wE} {E₁ : ΞΉ β†’ Type wE₁} {E' : ΞΉ' β†’ Type wE'} {Ei : Fin n.succ β†’ Type wEi} {G : Type wG} {G' : Type wG'} [Fintype ΞΉ] [Fintype ΞΉ'] [NontriviallyNormedField π•œ] [βˆ€ i, NormedAddCommGroup (E i)] [βˆ€ i, NormedSpace π•œ (E i)] [βˆ€ i, NormedAddCommGroup (E₁ i)] [βˆ€ i, NormedSpace π•œ (E₁ i)] [βˆ€ i, NormedAddCommGroup (E' i)] [βˆ€ i, NormedSpace π•œ (E' i)] [βˆ€ i, NormedAddCommGroup (Ei i)] [βˆ€ i, NormedSpace π•œ (Ei i)] [NormedAddCommGroup G] [NormedSpace π•œ G] [NormedAddCommGroup G'] [NormedSpace π•œ G'] theorem ContinuousLinearMap.norm_map_tail_le (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) (m : βˆ€ i, Ei i) : β€–f (m 0) (tail m)β€– ≀ β€–fβ€– * ∏ i, β€–m iβ€– := calc β€–f (m 0) (tail m)β€– ≀ β€–f (m 0)β€– * ∏ i, β€–(tail m) iβ€– := (f (m 0)).le_opNorm _ _ ≀ β€–fβ€– * β€–m 0β€– * ∏ i, β€–tail m iβ€– := mul_le_mul_of_nonneg_right (f.le_opNorm _) <| by positivity _ = β€–fβ€– * (β€–m 0β€– * ∏ i, β€–(tail m) iβ€–) := by ring _ = β€–fβ€– * ∏ i, β€–m iβ€– := by rw [prod_univ_succ] rfl #align continuous_linear_map.norm_map_tail_le ContinuousLinearMap.norm_map_tail_le theorem ContinuousMultilinearMap.norm_map_init_le (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) (m : βˆ€ i, Ei i) : β€–f (init m) (m (last n))β€– ≀ β€–fβ€– * ∏ i, β€–m iβ€– := calc β€–f (init m) (m (last n))β€– ≀ β€–f (init m)β€– * β€–m (last n)β€– := (f (init m)).le_opNorm _ _ ≀ (β€–fβ€– * ∏ i, β€–(init m) iβ€–) * β€–m (last n)β€– := (mul_le_mul_of_nonneg_right (f.le_opNorm _) (norm_nonneg _)) _ = β€–fβ€– * ((∏ i, β€–(init m) iβ€–) * β€–m (last n)β€–) := mul_assoc _ _ _ _ = β€–fβ€– * ∏ i, β€–m iβ€– := by rw [prod_univ_castSucc] rfl #align continuous_multilinear_map.norm_map_init_le ContinuousMultilinearMap.norm_map_init_le theorem ContinuousMultilinearMap.norm_map_cons_le (f : ContinuousMultilinearMap π•œ Ei G) (x : Ei 0) (m : βˆ€ i : Fin n, Ei i.succ) : β€–f (cons x m)β€– ≀ β€–fβ€– * β€–xβ€– * ∏ i, β€–m iβ€– := calc β€–f (cons x m)β€– ≀ β€–fβ€– * ∏ i, β€–cons x m iβ€– := f.le_opNorm _ _ = β€–fβ€– * β€–xβ€– * ∏ i, β€–m iβ€– := by rw [prod_univ_succ] simp [mul_assoc] #align continuous_multilinear_map.norm_map_cons_le ContinuousMultilinearMap.norm_map_cons_le theorem ContinuousMultilinearMap.norm_map_snoc_le (f : ContinuousMultilinearMap π•œ Ei G) (m : βˆ€ i : Fin n, Ei <| castSucc i) (x : Ei (last n)) : β€–f (snoc m x)β€– ≀ (β€–fβ€– * ∏ i, β€–m iβ€–) * β€–xβ€– := calc β€–f (snoc m x)β€– ≀ β€–fβ€– * ∏ i, β€–snoc m x iβ€– := f.le_opNorm _ _ = (β€–fβ€– * ∏ i, β€–m iβ€–) * β€–xβ€– := by rw [prod_univ_castSucc] simp [mul_assoc] #align continuous_multilinear_map.norm_map_snoc_le ContinuousMultilinearMap.norm_map_snoc_le def ContinuousLinearMap.uncurryLeft (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) : ContinuousMultilinearMap π•œ Ei G := (@LinearMap.uncurryLeft π•œ n Ei G _ _ _ _ _ (ContinuousMultilinearMap.toMultilinearMapLinear.comp f.toLinearMap)).mkContinuous β€–fβ€– fun m => by exact ContinuousLinearMap.norm_map_tail_le f m #align continuous_linear_map.uncurry_left ContinuousLinearMap.uncurryLeft @[simp] theorem ContinuousLinearMap.uncurryLeft_apply (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) (m : βˆ€ i, Ei i) : f.uncurryLeft m = f (m 0) (tail m) := rfl #align continuous_linear_map.uncurry_left_apply ContinuousLinearMap.uncurryLeft_apply def ContinuousMultilinearMap.curryLeft (f : ContinuousMultilinearMap π•œ Ei G) : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G := LinearMap.mkContinuous { -- define a linear map into `n` continuous multilinear maps -- from an `n+1` continuous multilinear map toFun := fun x => (f.toMultilinearMap.curryLeft x).mkContinuous (β€–fβ€– * β€–xβ€–) (f.norm_map_cons_le x) map_add' := fun x y => by ext m exact f.cons_add m x y map_smul' := fun c x => by ext m exact f.cons_smul m c x }-- then register its continuity thanks to its boundedness properties. β€–fβ€– fun x => by rw [LinearMap.coe_mk, AddHom.coe_mk] exact MultilinearMap.mkContinuous_norm_le _ (mul_nonneg (norm_nonneg _) (norm_nonneg _)) _ #align continuous_multilinear_map.curry_left ContinuousMultilinearMap.curryLeft @[simp] theorem ContinuousMultilinearMap.curryLeft_apply (f : ContinuousMultilinearMap π•œ Ei G) (x : Ei 0) (m : βˆ€ i : Fin n, Ei i.succ) : f.curryLeft x m = f (cons x m) := rfl #align continuous_multilinear_map.curry_left_apply ContinuousMultilinearMap.curryLeft_apply @[simp] theorem ContinuousLinearMap.curry_uncurryLeft (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) : f.uncurryLeft.curryLeft = f := by ext m x rw [ContinuousMultilinearMap.curryLeft_apply, ContinuousLinearMap.uncurryLeft_apply, tail_cons, cons_zero] #align continuous_linear_map.curry_uncurry_left ContinuousLinearMap.curry_uncurryLeft @[simp] theorem ContinuousMultilinearMap.uncurry_curryLeft (f : ContinuousMultilinearMap π•œ Ei G) : f.curryLeft.uncurryLeft = f := ContinuousMultilinearMap.toMultilinearMap_injective <| f.toMultilinearMap.uncurry_curryLeft #align continuous_multilinear_map.uncurry_curry_left ContinuousMultilinearMap.uncurry_curryLeft variable (π•œ Ei G) def continuousMultilinearCurryLeftEquiv : (Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) ≃ₗᡒ[π•œ] ContinuousMultilinearMap π•œ Ei G := LinearIsometryEquiv.ofBounds { toFun := ContinuousLinearMap.uncurryLeft map_add' := fun f₁ fβ‚‚ => by ext m rfl map_smul' := fun c f => by ext m rfl invFun := ContinuousMultilinearMap.curryLeft left_inv := ContinuousLinearMap.curry_uncurryLeft right_inv := ContinuousMultilinearMap.uncurry_curryLeft } (fun f => by simp only [LinearEquiv.coe_mk] exact MultilinearMap.mkContinuous_norm_le _ (norm_nonneg f) _) (fun f => by simp only [LinearEquiv.coe_symm_mk] exact LinearMap.mkContinuous_norm_le _ (norm_nonneg f) _) #align continuous_multilinear_curry_left_equiv continuousMultilinearCurryLeftEquiv variable {π•œ Ei G} @[simp] theorem continuousMultilinearCurryLeftEquiv_apply (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) (v : βˆ€ i, Ei i) : continuousMultilinearCurryLeftEquiv π•œ Ei G f v = f (v 0) (tail v) := rfl #align continuous_multilinear_curry_left_equiv_apply continuousMultilinearCurryLeftEquiv_apply @[simp] theorem continuousMultilinearCurryLeftEquiv_symm_apply (f : ContinuousMultilinearMap π•œ Ei G) (x : Ei 0) (v : βˆ€ i : Fin n, Ei i.succ) : (continuousMultilinearCurryLeftEquiv π•œ Ei G).symm f x v = f (cons x v) := rfl #align continuous_multilinear_curry_left_equiv_symm_apply continuousMultilinearCurryLeftEquiv_symm_apply @[simp] theorem ContinuousMultilinearMap.curryLeft_norm (f : ContinuousMultilinearMap π•œ Ei G) : β€–f.curryLeftβ€– = β€–fβ€– := (continuousMultilinearCurryLeftEquiv π•œ Ei G).symm.norm_map f #align continuous_multilinear_map.curry_left_norm ContinuousMultilinearMap.curryLeft_norm @[simp] theorem ContinuousLinearMap.uncurryLeft_norm (f : Ei 0 β†’L[π•œ] ContinuousMultilinearMap π•œ (fun i : Fin n => Ei i.succ) G) : β€–f.uncurryLeftβ€– = β€–fβ€– := (continuousMultilinearCurryLeftEquiv π•œ Ei G).norm_map f #align continuous_linear_map.uncurry_left_norm ContinuousLinearMap.uncurryLeft_norm def ContinuousMultilinearMap.uncurryRight (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) : ContinuousMultilinearMap π•œ Ei G := let f' : MultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’β‚—[π•œ] G) := { toFun := fun m => (f m).toLinearMap map_add' := fun m i x y => by simp map_smul' := fun m i c x => by simp } (@MultilinearMap.uncurryRight π•œ n Ei G _ _ _ _ _ f').mkContinuous β€–fβ€– fun m => f.norm_map_init_le m #align continuous_multilinear_map.uncurry_right ContinuousMultilinearMap.uncurryRight @[simp] theorem ContinuousMultilinearMap.uncurryRight_apply (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) (m : βˆ€ i, Ei i) : f.uncurryRight m = f (init m) (m (last n)) := rfl #align continuous_multilinear_map.uncurry_right_apply ContinuousMultilinearMap.uncurryRight_apply def ContinuousMultilinearMap.curryRight (f : ContinuousMultilinearMap π•œ Ei G) : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G) := let f' : MultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G) := { toFun := fun m => (f.toMultilinearMap.curryRight m).mkContinuous (β€–fβ€– * ∏ i, β€–m iβ€–) fun x => f.norm_map_snoc_le m x map_add' := fun m i x y => by ext simp map_smul' := fun m i c x => by ext simp } f'.mkContinuous β€–fβ€– fun m => by simp only [f', MultilinearMap.coe_mk] exact LinearMap.mkContinuous_norm_le _ (by positivity) _ #align continuous_multilinear_map.curry_right ContinuousMultilinearMap.curryRight @[simp] theorem ContinuousMultilinearMap.curryRight_apply (f : ContinuousMultilinearMap π•œ Ei G) (m : βˆ€ i : Fin n, Ei <| castSucc i) (x : Ei (last n)) : f.curryRight m x = f (snoc m x) := rfl #align continuous_multilinear_map.curry_right_apply ContinuousMultilinearMap.curryRight_apply @[simp] theorem ContinuousMultilinearMap.curry_uncurryRight (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) : f.uncurryRight.curryRight = f := by ext m x rw [ContinuousMultilinearMap.curryRight_apply, ContinuousMultilinearMap.uncurryRight_apply, snoc_last, init_snoc] #align continuous_multilinear_map.curry_uncurry_right ContinuousMultilinearMap.curry_uncurryRight @[simp] theorem ContinuousMultilinearMap.uncurry_curryRight (f : ContinuousMultilinearMap π•œ Ei G) : f.curryRight.uncurryRight = f := by ext m rw [uncurryRight_apply, curryRight_apply, snoc_init_self] #align continuous_multilinear_map.uncurry_curry_right ContinuousMultilinearMap.uncurry_curryRight variable (π•œ Ei G) def continuousMultilinearCurryRightEquiv : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G) ≃ₗᡒ[π•œ] ContinuousMultilinearMap π•œ Ei G := LinearIsometryEquiv.ofBounds { toFun := ContinuousMultilinearMap.uncurryRight map_add' := fun f₁ fβ‚‚ => by ext m rfl map_smul' := fun c f => by ext m rfl invFun := ContinuousMultilinearMap.curryRight left_inv := ContinuousMultilinearMap.curry_uncurryRight right_inv := ContinuousMultilinearMap.uncurry_curryRight } (fun f => by simp only [uncurryRight, LinearEquiv.coe_mk] exact MultilinearMap.mkContinuous_norm_le _ (norm_nonneg f) _) fun f => by simp only [curryRight, LinearEquiv.coe_symm_mk] exact MultilinearMap.mkContinuous_norm_le _ (norm_nonneg f) _ #align continuous_multilinear_curry_right_equiv continuousMultilinearCurryRightEquiv variable (n G') def continuousMultilinearCurryRightEquiv' : (G[Γ—n]β†’L[π•œ] G β†’L[π•œ] G') ≃ₗᡒ[π•œ] G[Γ—n.succ]β†’L[π•œ] G' := continuousMultilinearCurryRightEquiv π•œ (fun _ => G) G' #align continuous_multilinear_curry_right_equiv' continuousMultilinearCurryRightEquiv' variable {n π•œ G Ei G'} @[simp] theorem continuousMultilinearCurryRightEquiv_apply (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) (v : βˆ€ i, Ei i) : (continuousMultilinearCurryRightEquiv π•œ Ei G) f v = f (init v) (v (last n)) := rfl #align continuous_multilinear_curry_right_equiv_apply continuousMultilinearCurryRightEquiv_apply @[simp] theorem continuousMultilinearCurryRightEquiv_symm_apply (f : ContinuousMultilinearMap π•œ Ei G) (v : βˆ€ i : Fin n, Ei <| castSucc i) (x : Ei (last n)) : (continuousMultilinearCurryRightEquiv π•œ Ei G).symm f v x = f (snoc v x) := rfl #align continuous_multilinear_curry_right_equiv_symm_apply continuousMultilinearCurryRightEquiv_symm_apply @[simp] theorem continuousMultilinearCurryRightEquiv_apply' (f : G[Γ—n]β†’L[π•œ] G β†’L[π•œ] G') (v : Fin (n + 1) β†’ G) : continuousMultilinearCurryRightEquiv' π•œ n G G' f v = f (init v) (v (last n)) := rfl #align continuous_multilinear_curry_right_equiv_apply' continuousMultilinearCurryRightEquiv_apply' @[simp] theorem continuousMultilinearCurryRightEquiv_symm_apply' (f : G[Γ—n.succ]β†’L[π•œ] G') (v : Fin n β†’ G) (x : G) : (continuousMultilinearCurryRightEquiv' π•œ n G G').symm f v x = f (snoc v x) := rfl #align continuous_multilinear_curry_right_equiv_symm_apply' continuousMultilinearCurryRightEquiv_symm_apply' @[simp] theorem ContinuousMultilinearMap.curryRight_norm (f : ContinuousMultilinearMap π•œ Ei G) : β€–f.curryRightβ€– = β€–fβ€– := (continuousMultilinearCurryRightEquiv π•œ Ei G).symm.norm_map f #align continuous_multilinear_map.curry_right_norm ContinuousMultilinearMap.curryRight_norm @[simp] theorem ContinuousMultilinearMap.uncurryRight_norm (f : ContinuousMultilinearMap π•œ (fun i : Fin n => Ei <| castSucc i) (Ei (last n) β†’L[π•œ] G)) : β€–f.uncurryRightβ€– = β€–fβ€– := (continuousMultilinearCurryRightEquiv π•œ Ei G).norm_map f #align continuous_multilinear_map.uncurry_right_norm ContinuousMultilinearMap.uncurryRight_norm section def ContinuousMultilinearMap.uncurry0 (f : ContinuousMultilinearMap π•œ (fun _ : Fin 0 => G) G') : G' := f 0 #align continuous_multilinear_map.uncurry0 ContinuousMultilinearMap.uncurry0 variable (π•œ G) def ContinuousMultilinearMap.curry0 (x : G') : G[Γ—0]β†’L[π•œ] G' := ContinuousMultilinearMap.constOfIsEmpty π•œ _ x #align continuous_multilinear_map.curry0 ContinuousMultilinearMap.curry0 variable {G} @[simp] theorem ContinuousMultilinearMap.curry0_apply (x : G') (m : Fin 0 β†’ G) : ContinuousMultilinearMap.curry0 π•œ G x m = x := rfl #align continuous_multilinear_map.curry0_apply ContinuousMultilinearMap.curry0_apply variable {π•œ} @[simp] theorem ContinuousMultilinearMap.uncurry0_apply (f : G[Γ—0]β†’L[π•œ] G') : f.uncurry0 = f 0 := rfl #align continuous_multilinear_map.uncurry0_apply ContinuousMultilinearMap.uncurry0_apply @[simp] theorem ContinuousMultilinearMap.apply_zero_curry0 (f : G[Γ—0]β†’L[π•œ] G') {x : Fin 0 β†’ G} : ContinuousMultilinearMap.curry0 π•œ G (f x) = f := by ext m simp [Subsingleton.elim x m] #align continuous_multilinear_map.apply_zero_curry0 ContinuousMultilinearMap.apply_zero_curry0 theorem ContinuousMultilinearMap.uncurry0_curry0 (f : G[Γ—0]β†’L[π•œ] G') : ContinuousMultilinearMap.curry0 π•œ G f.uncurry0 = f := by simp #align continuous_multilinear_map.uncurry0_curry0 ContinuousMultilinearMap.uncurry0_curry0 variable (π•œ G) theorem ContinuousMultilinearMap.curry0_uncurry0 (x : G') : (ContinuousMultilinearMap.curry0 π•œ G x).uncurry0 = x := rfl #align continuous_multilinear_map.curry0_uncurry0 ContinuousMultilinearMap.curry0_uncurry0 @[simp] theorem ContinuousMultilinearMap.curry0_norm (x : G') : β€–ContinuousMultilinearMap.curry0 π•œ G xβ€– = β€–xβ€– := norm_constOfIsEmpty _ _ _ #align continuous_multilinear_map.curry0_norm ContinuousMultilinearMap.curry0_norm variable {π•œ G} @[simp]
Mathlib/Analysis/NormedSpace/Multilinear/Curry.lean
454
461
theorem ContinuousMultilinearMap.fin0_apply_norm (f : G[Γ—0]β†’L[π•œ] G') {x : Fin 0 β†’ G} : β€–f xβ€– = β€–fβ€– := by
obtain rfl : x = 0 := Subsingleton.elim _ _ refine le_antisymm (by simpa using f.le_opNorm 0) ?_ have : β€–ContinuousMultilinearMap.curry0 π•œ G f.uncurry0β€– ≀ β€–f.uncurry0β€– := ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) fun m => by simp [-ContinuousMultilinearMap.apply_zero_curry0] simpa [-Matrix.zero_empty] using this
import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Data.Fintype.BigOperators import Mathlib.Topology.Algebra.Monoid noncomputable section open Filter Finset Function open scoped Topology variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} section HasProd variable [CommMonoid Ξ±] [TopologicalSpace Ξ±] variable {f g : Ξ² β†’ Ξ±} {a b : Ξ±} {s : Finset Ξ²} @[to_additive "Constant zero function has sum `0`"] theorem hasProd_one : HasProd (fun _ ↦ 1 : Ξ² β†’ Ξ±) 1 := by simp [HasProd, tendsto_const_nhds] #align has_sum_zero hasSum_zero @[to_additive] theorem hasProd_empty [IsEmpty Ξ²] : HasProd f 1 := by convert @hasProd_one Ξ± Ξ² _ _ #align has_sum_empty hasSum_empty @[to_additive] theorem multipliable_one : Multipliable (fun _ ↦ 1 : Ξ² β†’ Ξ±) := hasProd_one.multipliable #align summable_zero summable_zero @[to_additive] theorem multipliable_empty [IsEmpty Ξ²] : Multipliable f := hasProd_empty.multipliable #align summable_empty summable_empty @[to_additive] theorem multipliable_congr (hfg : βˆ€ b, f b = g b) : Multipliable f ↔ Multipliable g := iff_of_eq (congr_arg Multipliable <| funext hfg) #align summable_congr summable_congr @[to_additive] theorem Multipliable.congr (hf : Multipliable f) (hfg : βˆ€ b, f b = g b) : Multipliable g := (multipliable_congr hfg).mp hf #align summable.congr Summable.congr @[to_additive] lemma HasProd.congr_fun (hf : HasProd f a) (h : βˆ€ x : Ξ², g x = f x) : HasProd g a := (funext h : g = f) β–Έ hf @[to_additive] theorem HasProd.hasProd_of_prod_eq {g : Ξ³ β†’ Ξ±} (h_eq : βˆ€ u : Finset Ξ³, βˆƒ v : Finset Ξ², βˆ€ v', v βŠ† v' β†’ βˆƒ u', u βŠ† u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b) (hf : HasProd g a) : HasProd f a := le_trans (map_atTop_finset_prod_le_of_prod_eq h_eq) hf #align has_sum.has_sum_of_sum_eq HasSum.hasSum_of_sum_eq @[to_additive] theorem hasProd_iff_hasProd {g : Ξ³ β†’ Ξ±} (h₁ : βˆ€ u : Finset Ξ³, βˆƒ v : Finset Ξ², βˆ€ v', v βŠ† v' β†’ βˆƒ u', u βŠ† u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b) (hβ‚‚ : βˆ€ v : Finset Ξ², βˆƒ u : Finset Ξ³, βˆ€ u', u βŠ† u' β†’ βˆƒ v', v βŠ† v' ∧ ∏ b ∈ v', f b = ∏ x ∈ u', g x) : HasProd f a ↔ HasProd g a := ⟨HasProd.hasProd_of_prod_eq hβ‚‚, HasProd.hasProd_of_prod_eq hβ‚βŸ© #align has_sum_iff_has_sum hasSum_iff_hasSum @[to_additive] theorem Function.Injective.multipliable_iff {g : Ξ³ β†’ Ξ²} (hg : Injective g) (hf : βˆ€ x βˆ‰ Set.range g, f x = 1) : Multipliable (f ∘ g) ↔ Multipliable f := exists_congr fun _ ↦ hg.hasProd_iff hf #align function.injective.summable_iff Function.Injective.summable_iff @[to_additive (attr := simp)] theorem hasProd_extend_one {g : Ξ² β†’ Ξ³} (hg : Injective g) : HasProd (extend g f 1) a ↔ HasProd f a := by rw [← hg.hasProd_iff, extend_comp hg] exact extend_apply' _ _ @[to_additive (attr := simp)] theorem multipliable_extend_one {g : Ξ² β†’ Ξ³} (hg : Injective g) : Multipliable (extend g f 1) ↔ Multipliable f := exists_congr fun _ ↦ hasProd_extend_one hg @[to_additive] theorem hasProd_subtype_iff_mulIndicator {s : Set Ξ²} : HasProd (f ∘ (↑) : s β†’ Ξ±) a ↔ HasProd (s.mulIndicator f) a := by rw [← Set.mulIndicator_range_comp, Subtype.range_coe, hasProd_subtype_iff_of_mulSupport_subset Set.mulSupport_mulIndicator_subset] #align has_sum_subtype_iff_indicator hasSum_subtype_iff_indicator @[to_additive] theorem multipliable_subtype_iff_mulIndicator {s : Set Ξ²} : Multipliable (f ∘ (↑) : s β†’ Ξ±) ↔ Multipliable (s.mulIndicator f) := exists_congr fun _ ↦ hasProd_subtype_iff_mulIndicator #align summable_subtype_iff_indicator summable_subtype_iff_indicator @[to_additive (attr := simp)] theorem hasProd_subtype_mulSupport : HasProd (f ∘ (↑) : mulSupport f β†’ Ξ±) a ↔ HasProd f a := hasProd_subtype_iff_of_mulSupport_subset <| Set.Subset.refl _ #align has_sum_subtype_support hasSum_subtype_support @[to_additive] protected theorem Finset.multipliable (s : Finset Ξ²) (f : Ξ² β†’ Ξ±) : Multipliable (f ∘ (↑) : (↑s : Set Ξ²) β†’ Ξ±) := (s.hasProd f).multipliable #align finset.summable Finset.summable @[to_additive] protected theorem Set.Finite.multipliable {s : Set Ξ²} (hs : s.Finite) (f : Ξ² β†’ Ξ±) : Multipliable (f ∘ (↑) : s β†’ Ξ±) := by have := hs.toFinset.multipliable f rwa [hs.coe_toFinset] at this #align set.finite.summable Set.Finite.summable @[to_additive] theorem multipliable_of_finite_mulSupport (h : (mulSupport f).Finite) : Multipliable f := by apply multipliable_of_ne_finset_one (s := h.toFinset); simp @[to_additive] theorem hasProd_single {f : Ξ² β†’ Ξ±} (b : Ξ²) (hf : βˆ€ (b') (_ : b' β‰  b), f b' = 1) : HasProd f (f b) := suffices HasProd f (∏ b' ∈ {b}, f b') by simpa using this hasProd_prod_of_ne_finset_one <| by simpa [hf] #align has_sum_single hasSum_single @[to_additive (attr := simp)] lemma hasProd_unique [Unique Ξ²] (f : Ξ² β†’ Ξ±) : HasProd f (f default) := hasProd_single default (fun _ hb ↦ False.elim <| hb <| Unique.uniq ..) @[to_additive (attr := simp)] lemma hasProd_singleton (m : Ξ²) (f : Ξ² β†’ Ξ±) : HasProd (({m} : Set Ξ²).restrict f) (f m) := hasProd_unique (Set.restrict {m} f) @[to_additive] theorem hasProd_ite_eq (b : Ξ²) [DecidablePred (Β· = b)] (a : Ξ±) : HasProd (fun b' ↦ if b' = b then a else 1) a := by convert @hasProd_single _ _ _ _ (fun b' ↦ if b' = b then a else 1) b (fun b' hb' ↦ if_neg hb') exact (if_pos rfl).symm #align has_sum_ite_eq hasSum_ite_eq @[to_additive] theorem Equiv.hasProd_iff (e : Ξ³ ≃ Ξ²) : HasProd (f ∘ e) a ↔ HasProd f a := e.injective.hasProd_iff <| by simp #align equiv.has_sum_iff Equiv.hasSum_iff @[to_additive] theorem Function.Injective.hasProd_range_iff {g : Ξ³ β†’ Ξ²} (hg : Injective g) : HasProd (fun x : Set.range g ↦ f x) a ↔ HasProd (f ∘ g) a := (Equiv.ofInjective g hg).hasProd_iff.symm #align function.injective.has_sum_range_iff Function.Injective.hasSum_range_iff @[to_additive] theorem Equiv.multipliable_iff (e : Ξ³ ≃ Ξ²) : Multipliable (f ∘ e) ↔ Multipliable f := exists_congr fun _ ↦ e.hasProd_iff #align equiv.summable_iff Equiv.summable_iff @[to_additive] theorem Equiv.hasProd_iff_of_mulSupport {g : Ξ³ β†’ Ξ±} (e : mulSupport f ≃ mulSupport g) (he : βˆ€ x : mulSupport f, g (e x) = f x) : HasProd f a ↔ HasProd g a := by have : (g ∘ (↑)) ∘ e = f ∘ (↑) := funext he rw [← hasProd_subtype_mulSupport, ← this, e.hasProd_iff, hasProd_subtype_mulSupport] #align equiv.has_sum_iff_of_support Equiv.hasSum_iff_of_support @[to_additive] theorem hasProd_iff_hasProd_of_ne_one_bij {g : Ξ³ β†’ Ξ±} (i : mulSupport g β†’ Ξ²) (hi : Injective i) (hf : mulSupport f βŠ† Set.range i) (hfg : βˆ€ x, f (i x) = g x) : HasProd f a ↔ HasProd g a := Iff.symm <| Equiv.hasProd_iff_of_mulSupport (Equiv.ofBijective (fun x ↦ ⟨i x, fun hx ↦ x.coe_prop <| hfg x β–Έ hx⟩) ⟨fun _ _ h ↦ hi <| Subtype.ext_iff.1 h, fun y ↦ (hf y.coe_prop).imp fun _ hx ↦ Subtype.ext hx⟩) hfg #align has_sum_iff_has_sum_of_ne_zero_bij hasSum_iff_hasSum_of_ne_zero_bij @[to_additive] theorem Equiv.multipliable_iff_of_mulSupport {g : Ξ³ β†’ Ξ±} (e : mulSupport f ≃ mulSupport g) (he : βˆ€ x : mulSupport f, g (e x) = f x) : Multipliable f ↔ Multipliable g := exists_congr fun _ ↦ e.hasProd_iff_of_mulSupport he #align equiv.summable_iff_of_support Equiv.summable_iff_of_support @[to_additive] protected theorem HasProd.map [CommMonoid Ξ³] [TopologicalSpace Ξ³] (hf : HasProd f a) {G} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] (g : G) (hg : Continuous g) : HasProd (g ∘ f) (g a) := by have : (g ∘ fun s : Finset Ξ² ↦ ∏ b ∈ s, f b) = fun s : Finset Ξ² ↦ ∏ b ∈ s, (g ∘ f) b := funext <| map_prod g _ unfold HasProd rw [← this] exact (hg.tendsto a).comp hf #align has_sum.map HasSum.map @[to_additive] protected theorem Inducing.hasProd_iff [CommMonoid Ξ³] [TopologicalSpace Ξ³] {G} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] {g : G} (hg : Inducing g) (f : Ξ² β†’ Ξ±) (a : Ξ±) : HasProd (g ∘ f) (g a) ↔ HasProd f a := by simp_rw [HasProd, comp_apply, ← map_prod] exact hg.tendsto_nhds_iff.symm @[to_additive] protected theorem Multipliable.map [CommMonoid Ξ³] [TopologicalSpace Ξ³] (hf : Multipliable f) {G} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] (g : G) (hg : Continuous g) : Multipliable (g ∘ f) := (hf.hasProd.map g hg).multipliable #align summable.map Summable.map @[to_additive] protected theorem Multipliable.map_iff_of_leftInverse [CommMonoid Ξ³] [TopologicalSpace Ξ³] {G G'} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] [FunLike G' Ξ³ Ξ±] [MonoidHomClass G' Ξ³ Ξ±] (g : G) (g' : G') (hg : Continuous g) (hg' : Continuous g') (hinv : Function.LeftInverse g' g) : Multipliable (g ∘ f) ↔ Multipliable f := ⟨fun h ↦ by have := h.map _ hg' rwa [← Function.comp.assoc, hinv.id] at this, fun h ↦ h.map _ hg⟩ #align summable.map_iff_of_left_inverse Summable.map_iff_of_leftInverse @[to_additive] theorem Multipliable.map_tprod [CommMonoid Ξ³] [TopologicalSpace Ξ³] [T2Space Ξ³] (hf : Multipliable f) {G} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] (g : G) (hg : Continuous g) : g (∏' i, f i) = ∏' i, g (f i) := (HasProd.tprod_eq (HasProd.map hf.hasProd g hg)).symm @[to_additive] theorem Inducing.multipliable_iff_tprod_comp_mem_range [CommMonoid Ξ³] [TopologicalSpace Ξ³] [T2Space Ξ³] {G} [FunLike G Ξ± Ξ³] [MonoidHomClass G Ξ± Ξ³] {g : G} (hg : Inducing g) (f : Ξ² β†’ Ξ±) : Multipliable f ↔ Multipliable (g ∘ f) ∧ ∏' i, g (f i) ∈ Set.range g := by constructor Β· intro hf constructor Β· exact hf.map g hg.continuous Β· use ∏' i, f i exact hf.map_tprod g hg.continuous Β· rintro ⟨hgf, a, ha⟩ use a have := hgf.hasProd simp_rw [comp_apply, ← ha] at this exact (hg.hasProd_iff f a).mp this @[to_additive "A special case of `Summable.map_iff_of_leftInverse` for convenience"] protected theorem Multipliable.map_iff_of_equiv [CommMonoid Ξ³] [TopologicalSpace Ξ³] {G} [EquivLike G Ξ± Ξ³] [MulEquivClass G Ξ± Ξ³] (g : G) (hg : Continuous g) (hg' : Continuous (EquivLike.inv g : Ξ³ β†’ Ξ±)) : Multipliable (g ∘ f) ↔ Multipliable f := Multipliable.map_iff_of_leftInverse g (g : Ξ± ≃* Ξ³).symm hg hg' (EquivLike.left_inv g) #align summable.map_iff_of_equiv Summable.map_iff_of_equiv @[to_additive] theorem Function.Surjective.multipliable_iff_of_hasProd_iff {Ξ±' : Type*} [CommMonoid Ξ±'] [TopologicalSpace Ξ±'] {e : Ξ±' β†’ Ξ±} (hes : Function.Surjective e) {f : Ξ² β†’ Ξ±} {g : Ξ³ β†’ Ξ±'} (he : βˆ€ {a}, HasProd f (e a) ↔ HasProd g a) : Multipliable f ↔ Multipliable g := hes.exists.trans <| exists_congr <| @he #align function.surjective.summable_iff_of_has_sum_iff Function.Surjective.summable_iff_of_hasSum_iff variable [ContinuousMul Ξ±] @[to_additive] theorem HasProd.mul (hf : HasProd f a) (hg : HasProd g b) : HasProd (fun b ↦ f b * g b) (a * b) := by dsimp only [HasProd] at hf hg ⊒ simp_rw [prod_mul_distrib] exact hf.mul hg #align has_sum.add HasSum.add @[to_additive] theorem Multipliable.mul (hf : Multipliable f) (hg : Multipliable g) : Multipliable fun b ↦ f b * g b := (hf.hasProd.mul hg.hasProd).multipliable #align summable.add Summable.add @[to_additive] theorem hasProd_prod {f : Ξ³ β†’ Ξ² β†’ Ξ±} {a : Ξ³ β†’ Ξ±} {s : Finset Ξ³} : (βˆ€ i ∈ s, HasProd (f i) (a i)) β†’ HasProd (fun b ↦ ∏ i ∈ s, f i b) (∏ i ∈ s, a i) := by classical exact Finset.induction_on s (by simp only [hasProd_one, prod_empty, forall_true_iff]) <| by -- Porting note: with some help, `simp` used to be able to close the goal simp (config := { contextual := true }) only [mem_insert, forall_eq_or_imp, not_false_iff, prod_insert, and_imp] exact fun x s _ IH hx h ↦ hx.mul (IH h) #align has_sum_sum hasSum_sum @[to_additive] theorem multipliable_prod {f : Ξ³ β†’ Ξ² β†’ Ξ±} {s : Finset Ξ³} (hf : βˆ€ i ∈ s, Multipliable (f i)) : Multipliable fun b ↦ ∏ i ∈ s, f i b := (hasProd_prod fun i hi ↦ (hf i hi).hasProd).multipliable #align summable_sum summable_sum @[to_additive] theorem HasProd.mul_disjoint {s t : Set Ξ²} (hs : Disjoint s t) (ha : HasProd (f ∘ (↑) : s β†’ Ξ±) a) (hb : HasProd (f ∘ (↑) : t β†’ Ξ±) b) : HasProd (f ∘ (↑) : (s βˆͺ t : Set Ξ²) β†’ Ξ±) (a * b) := by rw [hasProd_subtype_iff_mulIndicator] at * rw [Set.mulIndicator_union_of_disjoint hs] exact ha.mul hb #align has_sum.add_disjoint HasSum.add_disjoint @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Basic.lean
308
313
theorem hasProd_prod_disjoint {ΞΉ} (s : Finset ΞΉ) {t : ΞΉ β†’ Set Ξ²} {a : ΞΉ β†’ Ξ±} (hs : (s : Set ΞΉ).Pairwise (Disjoint on t)) (hf : βˆ€ i ∈ s, HasProd (f ∘ (↑) : t i β†’ Ξ±) (a i)) : HasProd (f ∘ (↑) : (⋃ i ∈ s, t i) β†’ Ξ±) (∏ i ∈ s, a i) := by
simp_rw [hasProd_subtype_iff_mulIndicator] at * rw [Finset.mulIndicator_biUnion _ _ hs] exact hasProd_prod hf
import Mathlib.LinearAlgebra.Basis.VectorSpace import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.SetTheory.Cardinal.Subfield import Mathlib.LinearAlgebra.Dimension.RankNullity #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe uβ‚€ u v v' v'' u₁' w w' variable {K R : Type u} {V V₁ Vβ‚‚ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} variable {ΞΉ : Type w} {ΞΉ' : Type w'} {Ξ· : Type u₁'} {Ο† : Ξ· β†’ Type*} open Cardinal Basis Submodule Function Set section Module section Basis open FiniteDimensional variable [DivisionRing K] [AddCommGroup V] [Module K V] theorem linearIndependent_of_top_le_span_of_card_eq_finrank {ΞΉ : Type*} [Fintype ΞΉ] {b : ΞΉ β†’ V} (spans : ⊀ ≀ span K (Set.range b)) (card_eq : Fintype.card ΞΉ = finrank K V) : LinearIndependent K b := linearIndependent_iff'.mpr fun s g dependent i i_mem_s => by classical by_contra gx_ne_zero -- We'll derive a contradiction by showing `b '' (univ \ {i})` of cardinality `n - 1` -- spans a vector space of dimension `n`. refine not_le_of_gt (span_lt_top_of_card_lt_finrank (show (b '' (Set.univ \ {i})).toFinset.card < finrank K V from ?_)) ?_ Β· calc (b '' (Set.univ \ {i})).toFinset.card = ((Set.univ \ {i}).toFinset.image b).card := by rw [Set.toFinset_card, Fintype.card_ofFinset] _ ≀ (Set.univ \ {i}).toFinset.card := Finset.card_image_le _ = (Finset.univ.erase i).card := (congr_arg Finset.card (Finset.ext (by simp [and_comm]))) _ < Finset.univ.card := Finset.card_erase_lt_of_mem (Finset.mem_univ i) _ = finrank K V := card_eq -- We already have that `b '' univ` spans the whole space, -- so we only need to show that the span of `b '' (univ \ {i})` contains each `b j`. refine spans.trans (span_le.mpr ?_) rintro _ ⟨j, rfl, rfl⟩ -- The case that `j β‰  i` is easy because `b j ∈ b '' (univ \ {i})`. by_cases j_eq : j = i swap Β· refine subset_span ⟨j, (Set.mem_diff _).mpr ⟨Set.mem_univ _, ?_⟩, rfl⟩ exact mt Set.mem_singleton_iff.mp j_eq -- To show `b i ∈ span (b '' (univ \ {i}))`, we use that it's a weighted sum -- of the other `b j`s. rw [j_eq, SetLike.mem_coe, show b i = -((g i)⁻¹ β€’ (s.erase i).sum fun j => g j β€’ b j) from _] Β· refine neg_mem (smul_mem _ _ (sum_mem fun k hk => ?_)) obtain ⟨k_ne_i, _⟩ := Finset.mem_erase.mp hk refine smul_mem _ _ (subset_span ⟨k, ?_, rfl⟩) simp_all only [Set.mem_univ, Set.mem_diff, Set.mem_singleton_iff, and_self, not_false_eq_true] -- To show `b i` is a weighted sum of the other `b j`s, we'll rewrite this sum -- to have the form of the assumption `dependent`. apply eq_neg_of_add_eq_zero_left calc (b i + (g i)⁻¹ β€’ (s.erase i).sum fun j => g j β€’ b j) = (g i)⁻¹ β€’ (g i β€’ b i + (s.erase i).sum fun j => g j β€’ b j) := by rw [smul_add, ← mul_smul, inv_mul_cancel gx_ne_zero, one_smul] _ = (g i)⁻¹ β€’ (0 : V) := congr_arg _ ?_ _ = 0 := smul_zero _ -- And then it's just a bit of manipulation with finite sums. rwa [← Finset.insert_erase i_mem_s, Finset.sum_insert (Finset.not_mem_erase _ _)] at dependent #align linear_independent_of_top_le_span_of_card_eq_finrank linearIndependent_of_top_le_span_of_card_eq_finrank
Mathlib/LinearAlgebra/Dimension/DivisionRing.lean
171
193
theorem linearIndependent_iff_card_eq_finrank_span {ΞΉ : Type*} [Fintype ΞΉ] {b : ΞΉ β†’ V} : LinearIndependent K b ↔ Fintype.card ΞΉ = (Set.range b).finrank K := by
constructor Β· intro h exact (finrank_span_eq_card h).symm Β· intro hc let f := Submodule.subtype (span K (Set.range b)) let b' : ΞΉ β†’ span K (Set.range b) := fun i => ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩ have hs : ⊀ ≀ span K (Set.range b') := by intro x have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f have hf : f '' Set.range b' = Set.range b := by ext x simp [f, Set.mem_image, Set.mem_range] rw [hf] at h have hx : (x : V) ∈ span K (Set.range b) := x.property conv at hx => arg 2 rw [h] simpa [f, mem_map] using hx have hi : LinearMap.ker f = βŠ₯ := ker_subtype _ convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : β„• β†’ S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : β„•) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : β„•) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn Β· simp Β· have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) β‰  0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S β†’+* T) (n : β„•) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih Β· simp Β· simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_evalβ‚‚ (f : S β†’+* T) (n : β„•) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).evalβ‚‚ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : β„•) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.evalβ‚‚ (algebraMap R S) x) := by rw [ascPochhammer_evalβ‚‚ (algebraMap R S), ← evalβ‚‚_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : β„•) : (((ascPochhammer β„• n).eval k : β„•) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap β„• S), eval_map, ← eq_natCast (algebraMap β„• S), evalβ‚‚_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : β„•} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n Β· simp Β· simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp #align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero @[simp] theorem ascPochhammer_ne_zero_eval_zero {n : β„•} (h : n β‰  0) : (ascPochhammer S n).eval 0 = 0 := by simp [ascPochhammer_eval_zero, h] #align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero theorem ascPochhammer_succ_right (n : β„•) : ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by suffices h : ascPochhammer β„• (n + 1) = ascPochhammer β„• n * (X + (n : β„•[X])) by apply_fun Polynomial.map (algebraMap β„• S) at h simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_natCast] using h induction' n with n ih Β· simp Β· conv_lhs => rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp, X_comp, natCast_comp, add_assoc, add_comm (1 : β„•[X]), ← Nat.cast_succ] #align pochhammer_succ_right ascPochhammer_succ_right theorem ascPochhammer_succ_eval {S : Type*} [Semiring S] (n : β„•) (k : S) : (ascPochhammer S (n + 1)).eval k = (ascPochhammer S n).eval k * (k + n) := by rw [ascPochhammer_succ_right, mul_add, eval_add, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast, eval_C_mul, Nat.cast_comm, ← mul_add] #align pochhammer_succ_eval ascPochhammer_succ_eval theorem ascPochhammer_succ_comp_X_add_one (n : β„•) : (ascPochhammer S (n + 1)).comp (X + 1) = ascPochhammer S (n + 1) + (n + 1) β€’ (ascPochhammer S n).comp (X + 1) := by suffices (ascPochhammer β„• (n + 1)).comp (X + 1) = ascPochhammer β„• (n + 1) + (n + 1) * (ascPochhammer β„• n).comp (X + 1) by simpa [map_comp] using congr_arg (Polynomial.map (Nat.castRingHom S)) this nth_rw 2 [ascPochhammer_succ_left] rw [← add_mul, ascPochhammer_succ_right β„• n, mul_comp, mul_comm, add_comp, X_comp, natCast_comp, add_comm, ← add_assoc] ring set_option linter.uppercaseLean3 false in #align pochhammer_succ_comp_X_add_one ascPochhammer_succ_comp_X_add_one theorem ascPochhammer_mul (n m : β„•) : ascPochhammer S n * (ascPochhammer S m).comp (X + (n : S[X])) = ascPochhammer S (n + m) := by induction' m with m ih Β· simp Β· rw [ascPochhammer_succ_right, Polynomial.mul_X_add_natCast_comp, ← mul_assoc, ih, ← add_assoc, ascPochhammer_succ_right, Nat.cast_add, add_assoc] #align pochhammer_mul ascPochhammer_mul theorem ascPochhammer_nat_eq_ascFactorial (n : β„•) : βˆ€ k, (ascPochhammer β„• k).eval n = n.ascFactorial k | 0 => by rw [ascPochhammer_zero, eval_one, Nat.ascFactorial_zero] | t + 1 => by rw [ascPochhammer_succ_right, eval_mul, ascPochhammer_nat_eq_ascFactorial n t, eval_add, eval_X, eval_natCast, Nat.cast_id, Nat.ascFactorial_succ, mul_comm] #align pochhammer_nat_eq_asc_factorial ascPochhammer_nat_eq_ascFactorial
Mathlib/RingTheory/Polynomial/Pochhammer.lean
172
174
theorem ascPochhammer_nat_eq_descFactorial (a b : β„•) : (ascPochhammer β„• b).eval a = (a + b - 1).descFactorial b := by
rw [ascPochhammer_nat_eq_ascFactorial, Nat.add_descFactorial_eq_ascFactorial']