Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
num_lines
int64
1
150
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] 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] #align real.log_abs Real.log_abs @[simp]
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
111
111
theorem log_neg_eq_log (x : ℝ) : log (-x) = log x := by
rw [← log_abs x, ← log_abs (-x), abs_neg]
1
import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.OrdConnected #align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c" variable {α β : Type*} [LinearOrder α] open Function namespace Set def projIci (a x : α) : Ici a := ⟨max a x, le_max_left _ _⟩ #align set.proj_Ici Set.projIci def projIic (b x : α) : Iic b := ⟨min b x, min_le_left _ _⟩ #align set.proj_Iic Set.projIic def projIcc (a b : α) (h : a ≤ b) (x : α) : Icc a b := ⟨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)⟩ #align set.proj_Icc Set.projIcc variable {a b : α} (h : a ≤ b) {x : α} @[norm_cast] theorem coe_projIci (a x : α) : (projIci a x : α) = max a x := rfl #align set.coe_proj_Ici Set.coe_projIci @[norm_cast] theorem coe_projIic (b x : α) : (projIic b x : α) = min b x := rfl #align set.coe_proj_Iic Set.coe_projIic @[norm_cast] theorem coe_projIcc (a b : α) (h : a ≤ b) (x : α) : (projIcc a b h x : α) = max a (min b x) := rfl #align set.coe_proj_Icc Set.coe_projIcc theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩ := Subtype.ext <| max_eq_left hx #align set.proj_Ici_of_le Set.projIci_of_le theorem projIic_of_le (hx : b ≤ x) : projIic b x = ⟨b, le_rfl⟩ := Subtype.ext <| min_eq_left hx #align set.proj_Iic_of_le Set.projIic_of_le
Mathlib/Order/Interval/Set/ProjIcc.lean
72
73
theorem projIcc_of_le_left (hx : x ≤ a) : projIcc a b h x = ⟨a, left_mem_Icc.2 h⟩ := by
simp [projIcc, hx, hx.trans h]
1
import Mathlib.Data.Multiset.Sum import Mathlib.Data.Finset.Card #align_import data.finset.sum from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999" open Function Multiset Sum namespace Finset variable {α β : Type*} (s : Finset α) (t : Finset β) def disjSum : Finset (Sum α β) := ⟨s.1.disjSum t.1, s.2.disjSum t.2⟩ #align finset.disj_sum Finset.disjSum @[simp] theorem val_disjSum : (s.disjSum t).1 = s.1.disjSum t.1 := rfl #align finset.val_disj_sum Finset.val_disjSum @[simp] theorem empty_disjSum : (∅ : Finset α).disjSum t = t.map Embedding.inr := val_inj.1 <| Multiset.zero_disjSum _ #align finset.empty_disj_sum Finset.empty_disjSum @[simp] theorem disjSum_empty : s.disjSum (∅ : Finset β) = s.map Embedding.inl := val_inj.1 <| Multiset.disjSum_zero _ #align finset.disj_sum_empty Finset.disjSum_empty @[simp] theorem card_disjSum : (s.disjSum t).card = s.card + t.card := Multiset.card_disjSum _ _ #align finset.card_disj_sum Finset.card_disjSum theorem disjoint_map_inl_map_inr : Disjoint (s.map Embedding.inl) (t.map Embedding.inr) := by simp_rw [disjoint_left, mem_map] rintro x ⟨a, _, rfl⟩ ⟨b, _, ⟨⟩⟩ #align finset.disjoint_map_inl_map_inr Finset.disjoint_map_inl_map_inr @[simp] theorem map_inl_disjUnion_map_inr : (s.map Embedding.inl).disjUnion (t.map Embedding.inr) (disjoint_map_inl_map_inr _ _) = s.disjSum t := rfl #align finset.map_inl_disj_union_map_inr Finset.map_inl_disjUnion_map_inr variable {s t} {s₁ s₂ : Finset α} {t₁ t₂ : Finset β} {a : α} {b : β} {x : Sum α β} theorem mem_disjSum : x ∈ s.disjSum t ↔ (∃ a, a ∈ s ∧ inl a = x) ∨ ∃ b, b ∈ t ∧ inr b = x := Multiset.mem_disjSum #align finset.mem_disj_sum Finset.mem_disjSum @[simp] theorem inl_mem_disjSum : inl a ∈ s.disjSum t ↔ a ∈ s := Multiset.inl_mem_disjSum #align finset.inl_mem_disj_sum Finset.inl_mem_disjSum @[simp] theorem inr_mem_disjSum : inr b ∈ s.disjSum t ↔ b ∈ t := Multiset.inr_mem_disjSum #align finset.inr_mem_disj_sum Finset.inr_mem_disjSum @[simp]
Mathlib/Data/Finset/Sum.lean
83
83
theorem disjSum_eq_empty : s.disjSum t = ∅ ↔ s = ∅ ∧ t = ∅ := by
simp [ext_iff]
1
import Mathlib.Order.BooleanAlgebra import Mathlib.Logic.Equiv.Basic #align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904" open Function OrderDual variable {ι α β : Type*} {π : ι → Type*} def symmDiff [Sup α] [SDiff α] (a b : α) : α := a \ b ⊔ b \ a #align symm_diff symmDiff def bihimp [Inf α] [HImp α] (a b : α) : α := (b ⇨ a) ⊓ (a ⇨ b) #align bihimp bihimp scoped[symmDiff] infixl:100 " ∆ " => symmDiff scoped[symmDiff] infixl:100 " ⇔ " => bihimp open scoped symmDiff theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a := rfl #align symm_diff_def symmDiff_def theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) := rfl #align bihimp_def bihimp_def theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q := rfl #align symm_diff_eq_xor symmDiff_eq_Xor' @[simp] theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) := (iff_iff_implies_and_implies _ _).symm.trans Iff.comm #align bihimp_iff_iff bihimp_iff_iff @[simp] theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide #align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor section GeneralizedCoheytingAlgebra variable [GeneralizedCoheytingAlgebra α] (a b c d : α) @[simp] theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b := rfl #align to_dual_symm_diff toDual_symmDiff @[simp] theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b := rfl #align of_dual_bihimp ofDual_bihimp theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm] #align symm_diff_comm symmDiff_comm instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) := ⟨symmDiff_comm⟩ #align symm_diff_is_comm symmDiff_isCommutative @[simp]
Mathlib/Order/SymmDiff.lean
121
121
theorem symmDiff_self : a ∆ a = ⊥ := by
rw [symmDiff, sup_idem, sdiff_self]
1
import Mathlib.Data.Set.Pointwise.SMul import Mathlib.GroupTheory.GroupAction.Hom open Set Pointwise theorem MulAction.smul_bijective_of_is_unit {M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) : Function.Bijective (fun (a : α) ↦ m • a) := by lift m to Mˣ using hm rw [Function.bijective_iff_has_inverse] use fun a ↦ m⁻¹ • a constructor · intro x; simp [← Units.smul_def] · intro x; simp [← Units.smul_def] variable {R S : Type*} (M M₁ M₂ N : Type*) variable [Monoid R] [Monoid S] (σ : R → S) variable [MulAction R M] [MulAction S N] [MulAction R M₁] [MulAction R M₂] variable {F : Type*} (h : F) section MulActionSemiHomClass variable [FunLike F M N] [MulActionSemiHomClass F σ M N] (c : R) (s : Set M) (t : Set N) -- @[simp] -- In #8386, the `simp_nf` linter complains: -- "Left-hand side does not simplify, when using the simp lemma on itself." -- For now we will have to manually add `image_smul_setₛₗ _` to the `simp` argument list. -- TODO: when lean4#3107 is fixed, mark this as `@[simp]`.
Mathlib/GroupTheory/GroupAction/Pointwise.lean
58
60
theorem image_smul_setₛₗ : h '' (c • s) = σ c • h '' s := by
simp only [← image_smul, image_image, map_smulₛₗ h]
1
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Order.Hom.Basic #align_import algebra.lie.solvable from "leanprover-community/mathlib"@"a50170a88a47570ed186b809ca754110590f9476" universe u v w w₁ w₂ variable (R : Type u) (L : Type v) (M : Type w) {L' : Type w₁} variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] variable (I J : LieIdeal R L) {f : L' →ₗ⁅R⁆ L} namespace LieAlgebra def derivedSeriesOfIdeal (k : ℕ) : LieIdeal R L → LieIdeal R L := (fun I => ⁅I, I⁆)^[k] #align lie_algebra.derived_series_of_ideal LieAlgebra.derivedSeriesOfIdeal @[simp] theorem derivedSeriesOfIdeal_zero : derivedSeriesOfIdeal R L 0 I = I := rfl #align lie_algebra.derived_series_of_ideal_zero LieAlgebra.derivedSeriesOfIdeal_zero @[simp] theorem derivedSeriesOfIdeal_succ (k : ℕ) : derivedSeriesOfIdeal R L (k + 1) I = ⁅derivedSeriesOfIdeal R L k I, derivedSeriesOfIdeal R L k I⁆ := Function.iterate_succ_apply' (fun I => ⁅I, I⁆) k I #align lie_algebra.derived_series_of_ideal_succ LieAlgebra.derivedSeriesOfIdeal_succ abbrev derivedSeries (k : ℕ) : LieIdeal R L := derivedSeriesOfIdeal R L k ⊤ #align lie_algebra.derived_series LieAlgebra.derivedSeries theorem derivedSeries_def (k : ℕ) : derivedSeries R L k = derivedSeriesOfIdeal R L k ⊤ := rfl #align lie_algebra.derived_series_def LieAlgebra.derivedSeries_def variable {R L} local notation "D" => derivedSeriesOfIdeal R L theorem derivedSeriesOfIdeal_add (k l : ℕ) : D (k + l) I = D k (D l I) := by induction' k with k ih · rw [Nat.zero_add, derivedSeriesOfIdeal_zero] · rw [Nat.succ_add k l, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ, ih] #align lie_algebra.derived_series_of_ideal_add LieAlgebra.derivedSeriesOfIdeal_add @[mono] theorem derivedSeriesOfIdeal_le {I J : LieIdeal R L} {k l : ℕ} (h₁ : I ≤ J) (h₂ : l ≤ k) : D k I ≤ D l J := by revert l; induction' k with k ih <;> intro l h₂ · rw [le_zero_iff] at h₂; rw [h₂, derivedSeriesOfIdeal_zero]; exact h₁ · have h : l = k.succ ∨ l ≤ k := by rwa [le_iff_eq_or_lt, Nat.lt_succ_iff] at h₂ cases' h with h h · rw [h, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ] exact LieSubmodule.mono_lie _ _ _ _ (ih (le_refl k)) (ih (le_refl k)) · rw [derivedSeriesOfIdeal_succ]; exact le_trans (LieSubmodule.lie_le_left _ _) (ih h) #align lie_algebra.derived_series_of_ideal_le LieAlgebra.derivedSeriesOfIdeal_le theorem derivedSeriesOfIdeal_succ_le (k : ℕ) : D (k + 1) I ≤ D k I := derivedSeriesOfIdeal_le (le_refl I) k.le_succ #align lie_algebra.derived_series_of_ideal_succ_le LieAlgebra.derivedSeriesOfIdeal_succ_le theorem derivedSeriesOfIdeal_le_self (k : ℕ) : D k I ≤ I := derivedSeriesOfIdeal_le (le_refl I) (zero_le k) #align lie_algebra.derived_series_of_ideal_le_self LieAlgebra.derivedSeriesOfIdeal_le_self theorem derivedSeriesOfIdeal_mono {I J : LieIdeal R L} (h : I ≤ J) (k : ℕ) : D k I ≤ D k J := derivedSeriesOfIdeal_le h (le_refl k) #align lie_algebra.derived_series_of_ideal_mono LieAlgebra.derivedSeriesOfIdeal_mono theorem derivedSeriesOfIdeal_antitone {k l : ℕ} (h : l ≤ k) : D k I ≤ D l I := derivedSeriesOfIdeal_le (le_refl I) h #align lie_algebra.derived_series_of_ideal_antitone LieAlgebra.derivedSeriesOfIdeal_antitone theorem derivedSeriesOfIdeal_add_le_add (J : LieIdeal R L) (k l : ℕ) : D (k + l) (I + J) ≤ D k I + D l J := by let D₁ : LieIdeal R L →o LieIdeal R L := { toFun := fun I => ⁅I, I⁆ monotone' := fun I J h => LieSubmodule.mono_lie I J I J h h } have h₁ : ∀ I J : LieIdeal R L, D₁ (I ⊔ J) ≤ D₁ I ⊔ J := by simp [D₁, LieSubmodule.lie_le_right, LieSubmodule.lie_le_left, le_sup_of_le_right] rw [← D₁.iterate_sup_le_sup_iff] at h₁ exact h₁ k l I J #align lie_algebra.derived_series_of_ideal_add_le_add LieAlgebra.derivedSeriesOfIdeal_add_le_add
Mathlib/Algebra/Lie/Solvable.lean
127
128
theorem derivedSeries_of_bot_eq_bot (k : ℕ) : derivedSeriesOfIdeal R L k ⊥ = ⊥ := by
rw [eq_bot_iff]; exact derivedSeriesOfIdeal_le_self ⊥ k
1
import Mathlib.Algebra.Category.ModuleCat.Basic import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.CategoryTheory.Monoidal.Linear #align_import algebra.category.Module.monoidal.basic from "leanprover-community/mathlib"@"74403a3b2551b0970855e14ef5e8fd0d6af1bfc2" -- Porting note: Module set_option linter.uppercaseLean3 false suppress_compilation universe v w x u open CategoryTheory namespace ModuleCat variable {R : Type u} [CommRing R] namespace MonoidalCategory -- The definitions inside this namespace are essentially private. -- After we build the `MonoidalCategory (Module R)` instance, -- you should use that API. open TensorProduct attribute [local ext] TensorProduct.ext def tensorObj (M N : ModuleCat R) : ModuleCat R := ModuleCat.of R (M ⊗[R] N) #align Module.monoidal_category.tensor_obj ModuleCat.MonoidalCategory.tensorObj def tensorHom {M N M' N' : ModuleCat R} (f : M ⟶ N) (g : M' ⟶ N') : tensorObj M M' ⟶ tensorObj N N' := TensorProduct.map f g #align Module.monoidal_category.tensor_hom ModuleCat.MonoidalCategory.tensorHom def whiskerLeft (M : ModuleCat R) {N₁ N₂ : ModuleCat R} (f : N₁ ⟶ N₂) : tensorObj M N₁ ⟶ tensorObj M N₂ := f.lTensor M def whiskerRight {M₁ M₂ : ModuleCat R} (f : M₁ ⟶ M₂) (N : ModuleCat R) : tensorObj M₁ N ⟶ tensorObj M₂ N := f.rTensor N theorem tensor_id (M N : ModuleCat R) : tensorHom (𝟙 M) (𝟙 N) = 𝟙 (ModuleCat.of R (M ⊗ N)) := by -- Porting note: even with high priority ext fails to find this apply TensorProduct.ext rfl #align Module.monoidal_category.tensor_id ModuleCat.MonoidalCategory.tensor_id theorem tensor_comp {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂) : tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂ := by -- Porting note: even with high priority ext fails to find this apply TensorProduct.ext rfl #align Module.monoidal_category.tensor_comp ModuleCat.MonoidalCategory.tensor_comp def associator (M : ModuleCat.{v} R) (N : ModuleCat.{w} R) (K : ModuleCat.{x} R) : tensorObj (tensorObj M N) K ≅ tensorObj M (tensorObj N K) := (TensorProduct.assoc R M N K).toModuleIso #align Module.monoidal_category.associator ModuleCat.MonoidalCategory.associator def leftUnitor (M : ModuleCat.{u} R) : ModuleCat.of R (R ⊗[R] M) ≅ M := (LinearEquiv.toModuleIso (TensorProduct.lid R M) : of R (R ⊗ M) ≅ of R M).trans (ofSelfIso M) #align Module.monoidal_category.left_unitor ModuleCat.MonoidalCategory.leftUnitor def rightUnitor (M : ModuleCat.{u} R) : ModuleCat.of R (M ⊗[R] R) ≅ M := (LinearEquiv.toModuleIso (TensorProduct.rid R M) : of R (M ⊗ R) ≅ of R M).trans (ofSelfIso M) #align Module.monoidal_category.right_unitor ModuleCat.MonoidalCategory.rightUnitor instance : MonoidalCategoryStruct (ModuleCat.{u} R) where tensorObj := tensorObj whiskerLeft := whiskerLeft whiskerRight := whiskerRight tensorHom f g := TensorProduct.map f g tensorUnit := ModuleCat.of R R associator := associator leftUnitor := leftUnitor rightUnitor := rightUnitor section open TensorProduct (assoc map) private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂] [AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*} [AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂] [Module R Y₃] (f₁ : X₁ →ₗ[R] Y₁) (f₂ : X₂ →ₗ[R] Y₂) (f₃ : X₃ →ₗ[R] Y₃) : ↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃) := by apply TensorProduct.ext_threefold intro x y z rfl -- Porting note: private so hopeful never used outside this file -- #align Module.monoidal_category.associator_naturality_aux ModuleCat.MonoidalCategory.associator_naturality_aux variable (R) private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid X] [AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] : (((assoc R X Y Z).toLinearMap.lTensor W).comp (assoc R W (X ⊗[R] Y) Z).toLinearMap).comp ((assoc R W X Y).toLinearMap.rTensor Z) = (assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by apply TensorProduct.ext_fourfold intro w x y z rfl -- Porting note: private so hopeful never used outside this file -- #align Module.monoidal_category.pentagon_aux Module.monoidal_category.pentagon_aux end
Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean
151
155
theorem associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃) : tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom = (associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃) := by
convert associator_naturality_aux f₁ f₂ f₃ using 1
1
import Mathlib.LinearAlgebra.Matrix.DotProduct import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal #align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7" open Matrix namespace Matrix open FiniteDimensional variable {l m n o R : Type*} [Fintype n] [Fintype o] section CommRing variable [CommRing R] noncomputable def rank (A : Matrix m n R) : ℕ := finrank R <| LinearMap.range A.mulVecLin #align matrix.rank Matrix.rank @[simp] theorem rank_one [StrongRankCondition R] [DecidableEq n] : rank (1 : Matrix n n R) = Fintype.card n := by rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi] #align matrix.rank_one Matrix.rank_one @[simp]
Mathlib/Data/Matrix/Rank.lean
55
56
theorem rank_zero [Nontrivial R] : rank (0 : Matrix m n R) = 0 := by
rw [rank, mulVecLin_zero, LinearMap.range_zero, finrank_bot]
1
import Mathlib.Topology.Constructions #align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" open Set Filter Function Topology Filter variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} variable [TopologicalSpace α] @[simp] theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a := bind_inf_principal.trans <| congr_arg₂ _ nhds_bind_nhds rfl #align nhds_bind_nhds_within nhds_bind_nhdsWithin @[simp] theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x } #align eventually_nhds_nhds_within eventually_nhds_nhdsWithin theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x := eventually_inf_principal #align eventually_nhds_within_iff eventually_nhdsWithin_iff theorem frequently_nhdsWithin_iff {z : α} {s : Set α} {p : α → Prop} : (∃ᶠ x in 𝓝[s] z, p x) ↔ ∃ᶠ x in 𝓝 z, p x ∧ x ∈ s := frequently_inf_principal.trans <| by simp only [and_comm] #align frequently_nhds_within_iff frequently_nhdsWithin_iff theorem mem_closure_ne_iff_frequently_within {z : α} {s : Set α} : z ∈ closure (s \ {z}) ↔ ∃ᶠ x in 𝓝[≠] z, x ∈ s := by simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff] #align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within @[simp] theorem eventually_nhdsWithin_nhdsWithin {a : α} {s : Set α} {p : α → Prop} : (∀ᶠ y in 𝓝[s] a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := by refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩ simp only [eventually_nhdsWithin_iff] at h ⊢ exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs #align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin theorem nhdsWithin_eq (a : α) (s : Set α) : 𝓝[s] a = ⨅ t ∈ { t : Set α | a ∈ t ∧ IsOpen t }, 𝓟 (t ∩ s) := ((nhds_basis_opens a).inf_principal s).eq_biInf #align nhds_within_eq nhdsWithin_eq theorem nhdsWithin_univ (a : α) : 𝓝[Set.univ] a = 𝓝 a := by rw [nhdsWithin, principal_univ, inf_top_eq] #align nhds_within_univ nhdsWithin_univ theorem nhdsWithin_hasBasis {p : β → Prop} {s : β → Set α} {a : α} (h : (𝓝 a).HasBasis p s) (t : Set α) : (𝓝[t] a).HasBasis p fun i => s i ∩ t := h.inf_principal t #align nhds_within_has_basis nhdsWithin_hasBasis theorem nhdsWithin_basis_open (a : α) (t : Set α) : (𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t := nhdsWithin_hasBasis (nhds_basis_opens a) t #align nhds_within_basis_open nhdsWithin_basis_open
Mathlib/Topology/ContinuousOn.lean
89
91
theorem mem_nhdsWithin {t : Set α} {a : α} {s : Set α} : t ∈ 𝓝[s] a ↔ ∃ u, IsOpen u ∧ a ∈ u ∧ u ∩ s ⊆ t := by
simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff
1
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Comp import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars #align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} section CompositionVector open ContinuousLinearMap variable {l : F → E} {l' : F →L[𝕜] E} {y : F} variable (x) theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x)) (hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) : HasDerivWithinAt (l ∘ f) (l' f') s x := by simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using (hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt #align has_fderiv_within_at.comp_has_deriv_within_at HasFDerivWithinAt.comp_hasDerivWithinAt theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F} (hl : HasFDerivWithinAt l l' t y) (hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) : HasDerivWithinAt (l ∘ f) (l' f') s x := by rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ∘ f) (l' f') s x := hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _) #align has_fderiv_at.comp_has_deriv_within_at HasFDerivAt.comp_hasDerivWithinAt theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y) (hf : HasDerivWithinAt f f' s x) (hy : y = f x) : HasDerivWithinAt (l ∘ f) (l' f') s x := by rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) : HasDerivAt (l ∘ f) (l' f') x := hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt #align has_fderiv_at.comp_has_deriv_at HasFDerivAt.comp_hasDerivAt theorem HasFDerivAt.comp_hasDerivAt_of_eq (hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) : HasDerivAt (l ∘ f) (l' f') x := by rw [hy] at hl; exact hl.comp_hasDerivAt x hf theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x)) (hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ∘ f) (l' f') x := by simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using (hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt #align has_strict_fderiv_at.comp_has_strict_deriv_at HasStrictFDerivAt.comp_hasStrictDerivAt
Mathlib/Analysis/Calculus/Deriv/Comp.lean
393
396
theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y) (hf : HasStrictDerivAt f f' x) (hy : y = f x) : HasStrictDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
1
import Mathlib.Algebra.Algebra.Hom import Mathlib.RingTheory.Ideal.Quotient #align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72" universe uR uS uT uA u₄ variable {R : Type uR} [Semiring R] variable {S : Type uS} [CommSemiring S] variable {T : Type uT} variable {A : Type uA} [Semiring A] [Algebra S A] namespace RingQuot inductive Rel (r : R → R → Prop) : R → R → Prop | of ⦃x y : R⦄ (h : r x y) : Rel r x y | add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c) | mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c) | mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c) #align ring_quot.rel RingQuot.Rel theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by rw [add_comm a b, add_comm a c] exact Rel.add_left h #align ring_quot.rel.add_right RingQuot.Rel.add_right theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) : Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h] #align ring_quot.rel.neg RingQuot.Rel.neg
Mathlib/Algebra/RingQuot.lean
71
72
theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) : Rel r (a - c) (b - c) := by
simp only [sub_eq_add_neg, h.add_left]
1
import Mathlib.Analysis.BoxIntegral.Partition.Basic #align_import analysis.box_integral.partition.split from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f" noncomputable section open scoped Classical open Filter open Function Set Filter namespace BoxIntegral variable {ι M : Type*} {n : ℕ} namespace Box variable {I : Box ι} {i : ι} {x : ℝ} {y : ι → ℝ} def splitLower (I : Box ι) (i : ι) (x : ℝ) : WithBot (Box ι) := mk' I.lower (update I.upper i (min x (I.upper i))) #align box_integral.box.split_lower BoxIntegral.Box.splitLower @[simp] theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by rw [splitLower, coe_mk'] ext y simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, ← Pi.le_def, le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j ≤ upper I j) i, mem_def] rw [and_comm (a := y i ≤ x)] #align box_integral.box.coe_split_lower BoxIntegral.Box.coe_splitLower theorem splitLower_le : I.splitLower i x ≤ I := withBotCoe_subset_iff.1 <| by simp #align box_integral.box.split_lower_le BoxIntegral.Box.splitLower_le @[simp] theorem splitLower_eq_bot {i x} : I.splitLower i x = ⊥ ↔ x ≤ I.lower i := by rw [splitLower, mk'_eq_bot, exists_update_iff I.upper fun j y => y ≤ I.lower j] simp [(I.lower_lt_upper _).not_le] #align box_integral.box.split_lower_eq_bot BoxIntegral.Box.splitLower_eq_bot @[simp]
Mathlib/Analysis/BoxIntegral/Partition/Split.lean
84
85
theorem splitLower_eq_self : I.splitLower i x = I ↔ I.upper i ≤ x := by
simp [splitLower, update_eq_iff]
1
import Mathlib.Algebra.ContinuedFractions.Basic import Mathlib.Algebra.GroupWithZero.Basic #align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction section General variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ} theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by rfl #align generalized_continued_fraction.terminated_at_iff_s_terminated_at GeneralizedContinuedFraction.terminatedAt_iff_s_terminatedAt theorem terminatedAt_iff_s_none : g.TerminatedAt n ↔ g.s.get? n = none := by rfl #align generalized_continued_fraction.terminated_at_iff_s_none GeneralizedContinuedFraction.terminatedAt_iff_s_none theorem part_num_none_iff_s_none : g.partialNumerators.get? n = none ↔ g.s.get? n = none := by cases s_nth_eq : g.s.get? n <;> simp [partialNumerators, s_nth_eq] #align generalized_continued_fraction.part_num_none_iff_s_none GeneralizedContinuedFraction.part_num_none_iff_s_none
Mathlib/Algebra/ContinuedFractions/Translations.lean
45
46
theorem terminatedAt_iff_part_num_none : g.TerminatedAt n ↔ g.partialNumerators.get? n = none := by
rw [terminatedAt_iff_s_none, part_num_none_iff_s_none]
1
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" variable {α : Type*} namespace Ordnode theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node' theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by rw [h.1] #align ordnode.sized.eq_node' Ordnode.Sized.eq_node' theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.1 #align ordnode.sized.size_eq Ordnode.Sized.size_eq @[elab_as_elim] theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil) (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by induction t with | nil => exact H0 | node _ _ _ _ t_ih_l t_ih_r => rw [hl.eq_node'] exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2) #align ordnode.sized.induction Ordnode.Sized.induction theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t | nil, _ => rfl | node s l x r, ⟨h₁, h₂, h₃⟩ => by rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl #align ordnode.size_eq_real_size Ordnode.size_eq_realSize @[simp] theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by cases t <;> [simp;simp [ht.1]] #align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero
Mathlib/Data/Ordmap/Ordset.lean
144
145
theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by
rw [h.1]; apply Nat.le_add_left
1
import Batteries.Tactic.Lint.Basic import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Order import Mathlib.Init.Data.Int.Order set_option autoImplicit true namespace Linarith theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by simp [*] theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by simp [*] theorem lt_of_eq_of_lt {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b < 0) : a + b < 0 := by simp [*] theorem le_of_le_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a ≤ 0) (hb : b = 0) : a + b ≤ 0 := by simp [*]
Mathlib/Tactic/Linarith/Lemmas.lean
39
40
theorem lt_of_lt_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a < 0) (hb : b = 0) : a + b < 0 := by
simp [*]
1
import Mathlib.Analysis.InnerProductSpace.Spectrum import Mathlib.Data.Matrix.Rank import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Hermitian #align_import linear_algebra.matrix.spectrum from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" namespace Matrix variable {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] variable {A : Matrix n n 𝕜} namespace IsHermitian section DecidableEq variable [DecidableEq n] variable (hA : A.IsHermitian) noncomputable def eigenvalues₀ : Fin (Fintype.card n) → ℝ := (isHermitian_iff_isSymmetric.1 hA).eigenvalues finrank_euclideanSpace #align matrix.is_hermitian.eigenvalues₀ Matrix.IsHermitian.eigenvalues₀ noncomputable def eigenvalues : n → ℝ := fun i => hA.eigenvalues₀ <| (Fintype.equivOfCardEq (Fintype.card_fin _)).symm i #align matrix.is_hermitian.eigenvalues Matrix.IsHermitian.eigenvalues noncomputable def eigenvectorBasis : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n) := ((isHermitian_iff_isSymmetric.1 hA).eigenvectorBasis finrank_euclideanSpace).reindex (Fintype.equivOfCardEq (Fintype.card_fin _)) #align matrix.is_hermitian.eigenvector_basis Matrix.IsHermitian.eigenvectorBasis lemma mulVec_eigenvectorBasis (j : n) : A *ᵥ ⇑(hA.eigenvectorBasis j) = (hA.eigenvalues j) • ⇑(hA.eigenvectorBasis j) := by simpa only [eigenvectorBasis, OrthonormalBasis.reindex_apply, toEuclideanLin_apply, RCLike.real_smul_eq_coe_smul (K := 𝕜)] using congr(⇑$((isHermitian_iff_isSymmetric.1 hA).apply_eigenvectorBasis finrank_euclideanSpace ((Fintype.equivOfCardEq (Fintype.card_fin _)).symm j))) noncomputable def eigenvectorUnitary {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]{A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) : Matrix.unitaryGroup n 𝕜 := ⟨(EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis, (EuclideanSpace.basisFun n 𝕜).toMatrix_orthonormalBasis_mem_unitary (eigenvectorBasis hA)⟩ #align matrix.is_hermitian.eigenvector_matrix Matrix.IsHermitian.eigenvectorUnitary lemma eigenvectorUnitary_coe {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n] {A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) : eigenvectorUnitary hA = (EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis := rfl @[simp] theorem eigenvectorUnitary_apply (i j : n) : eigenvectorUnitary hA i j = ⇑(hA.eigenvectorBasis j) i := rfl #align matrix.is_hermitian.eigenvector_matrix_apply Matrix.IsHermitian.eigenvectorUnitary_apply theorem eigenvectorUnitary_mulVec (j : n) : eigenvectorUnitary hA *ᵥ Pi.single j 1 = ⇑(hA.eigenvectorBasis j) := by simp only [mulVec_single, eigenvectorUnitary_apply, mul_one]
Mathlib/LinearAlgebra/Matrix/Spectrum.lean
82
84
theorem star_eigenvectorUnitary_mulVec (j : n) : (star (eigenvectorUnitary hA : Matrix n n 𝕜)) *ᵥ ⇑(hA.eigenvectorBasis j) = Pi.single j 1 := by
rw [← eigenvectorUnitary_mulVec, mulVec_mulVec, unitary.coe_star_mul_self, one_mulVec]
1
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Order.Hom.Basic #align_import algebra.lie.solvable from "leanprover-community/mathlib"@"a50170a88a47570ed186b809ca754110590f9476" universe u v w w₁ w₂ variable (R : Type u) (L : Type v) (M : Type w) {L' : Type w₁} variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] variable (I J : LieIdeal R L) {f : L' →ₗ⁅R⁆ L} namespace LieAlgebra def derivedSeriesOfIdeal (k : ℕ) : LieIdeal R L → LieIdeal R L := (fun I => ⁅I, I⁆)^[k] #align lie_algebra.derived_series_of_ideal LieAlgebra.derivedSeriesOfIdeal @[simp] theorem derivedSeriesOfIdeal_zero : derivedSeriesOfIdeal R L 0 I = I := rfl #align lie_algebra.derived_series_of_ideal_zero LieAlgebra.derivedSeriesOfIdeal_zero @[simp] theorem derivedSeriesOfIdeal_succ (k : ℕ) : derivedSeriesOfIdeal R L (k + 1) I = ⁅derivedSeriesOfIdeal R L k I, derivedSeriesOfIdeal R L k I⁆ := Function.iterate_succ_apply' (fun I => ⁅I, I⁆) k I #align lie_algebra.derived_series_of_ideal_succ LieAlgebra.derivedSeriesOfIdeal_succ abbrev derivedSeries (k : ℕ) : LieIdeal R L := derivedSeriesOfIdeal R L k ⊤ #align lie_algebra.derived_series LieAlgebra.derivedSeries theorem derivedSeries_def (k : ℕ) : derivedSeries R L k = derivedSeriesOfIdeal R L k ⊤ := rfl #align lie_algebra.derived_series_def LieAlgebra.derivedSeries_def variable {R L} local notation "D" => derivedSeriesOfIdeal R L theorem derivedSeriesOfIdeal_add (k l : ℕ) : D (k + l) I = D k (D l I) := by induction' k with k ih · rw [Nat.zero_add, derivedSeriesOfIdeal_zero] · rw [Nat.succ_add k l, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ, ih] #align lie_algebra.derived_series_of_ideal_add LieAlgebra.derivedSeriesOfIdeal_add @[mono] theorem derivedSeriesOfIdeal_le {I J : LieIdeal R L} {k l : ℕ} (h₁ : I ≤ J) (h₂ : l ≤ k) : D k I ≤ D l J := by revert l; induction' k with k ih <;> intro l h₂ · rw [le_zero_iff] at h₂; rw [h₂, derivedSeriesOfIdeal_zero]; exact h₁ · have h : l = k.succ ∨ l ≤ k := by rwa [le_iff_eq_or_lt, Nat.lt_succ_iff] at h₂ cases' h with h h · rw [h, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ] exact LieSubmodule.mono_lie _ _ _ _ (ih (le_refl k)) (ih (le_refl k)) · rw [derivedSeriesOfIdeal_succ]; exact le_trans (LieSubmodule.lie_le_left _ _) (ih h) #align lie_algebra.derived_series_of_ideal_le LieAlgebra.derivedSeriesOfIdeal_le theorem derivedSeriesOfIdeal_succ_le (k : ℕ) : D (k + 1) I ≤ D k I := derivedSeriesOfIdeal_le (le_refl I) k.le_succ #align lie_algebra.derived_series_of_ideal_succ_le LieAlgebra.derivedSeriesOfIdeal_succ_le theorem derivedSeriesOfIdeal_le_self (k : ℕ) : D k I ≤ I := derivedSeriesOfIdeal_le (le_refl I) (zero_le k) #align lie_algebra.derived_series_of_ideal_le_self LieAlgebra.derivedSeriesOfIdeal_le_self theorem derivedSeriesOfIdeal_mono {I J : LieIdeal R L} (h : I ≤ J) (k : ℕ) : D k I ≤ D k J := derivedSeriesOfIdeal_le h (le_refl k) #align lie_algebra.derived_series_of_ideal_mono LieAlgebra.derivedSeriesOfIdeal_mono theorem derivedSeriesOfIdeal_antitone {k l : ℕ} (h : l ≤ k) : D k I ≤ D l I := derivedSeriesOfIdeal_le (le_refl I) h #align lie_algebra.derived_series_of_ideal_antitone LieAlgebra.derivedSeriesOfIdeal_antitone theorem derivedSeriesOfIdeal_add_le_add (J : LieIdeal R L) (k l : ℕ) : D (k + l) (I + J) ≤ D k I + D l J := by let D₁ : LieIdeal R L →o LieIdeal R L := { toFun := fun I => ⁅I, I⁆ monotone' := fun I J h => LieSubmodule.mono_lie I J I J h h } have h₁ : ∀ I J : LieIdeal R L, D₁ (I ⊔ J) ≤ D₁ I ⊔ J := by simp [D₁, LieSubmodule.lie_le_right, LieSubmodule.lie_le_left, le_sup_of_le_right] rw [← D₁.iterate_sup_le_sup_iff] at h₁ exact h₁ k l I J #align lie_algebra.derived_series_of_ideal_add_le_add LieAlgebra.derivedSeriesOfIdeal_add_le_add theorem derivedSeries_of_bot_eq_bot (k : ℕ) : derivedSeriesOfIdeal R L k ⊥ = ⊥ := by rw [eq_bot_iff]; exact derivedSeriesOfIdeal_le_self ⊥ k #align lie_algebra.derived_series_of_bot_eq_bot LieAlgebra.derivedSeries_of_bot_eq_bot theorem abelian_iff_derived_one_eq_bot : IsLieAbelian I ↔ derivedSeriesOfIdeal R L 1 I = ⊥ := by rw [derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_zero, LieSubmodule.lie_abelian_iff_lie_self_eq_bot] #align lie_algebra.abelian_iff_derived_one_eq_bot LieAlgebra.abelian_iff_derived_one_eq_bot
Mathlib/Algebra/Lie/Solvable.lean
136
138
theorem abelian_iff_derived_succ_eq_bot (I : LieIdeal R L) (k : ℕ) : IsLieAbelian (derivedSeriesOfIdeal R L k I) ↔ derivedSeriesOfIdeal R L (k + 1) I = ⊥ := by
rw [add_comm, derivedSeriesOfIdeal_add I 1 k, abelian_iff_derived_one_eq_bot]
1
import Mathlib.Init.Data.Nat.Notation import Mathlib.Init.Order.Defs set_option autoImplicit true structure UFModel (n) where parent : Fin n → Fin n rank : Nat → Nat rank_lt : ∀ i, (parent i).1 ≠ i → rank i < rank (parent i) structure UFNode (α : Type*) where parent : Nat value : α rank : Nat inductive UFModel.Agrees (arr : Array α) (f : α → β) : ∀ {n}, (Fin n → β) → Prop | mk : Agrees arr f fun i ↦ f (arr.get i) namespace UFModel.Agrees theorem mk' {arr : Array α} {f : α → β} {n} {g : Fin n → β} (e : n = arr.size) (H : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = g ⟨i, h₂⟩) : Agrees arr f g := by cases e have : (fun i ↦ f (arr.get i)) = g := by funext ⟨i, h⟩; apply H cases this; constructor theorem size_eq {arr : Array α} {m : Fin n → β} (H : Agrees arr f m) : n = arr.size := by cases H; rfl
Mathlib/Data/UnionFind.lean
82
84
theorem get_eq {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m) : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩ := by
cases H; exact fun i h _ ↦ rfl
1
import Mathlib.Topology.Order.ProjIcc import Mathlib.Topology.CompactOpen import Mathlib.Topology.UnitInterval #align_import topology.path_connected from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology Filter unitInterval Set Function variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {x y z : X} {ι : Type*} -- porting note (#5171): removed @[nolint has_nonempty_instance] structure Path (x y : X) extends C(I, X) where source' : toFun 0 = x target' : toFun 1 = y #align path Path instance Path.funLike : FunLike (Path x y) I X where coe := fun γ ↦ ⇑γ.toContinuousMap coe_injective' := fun γ₁ γ₂ h => by simp only [DFunLike.coe_fn_eq] at h cases γ₁; cases γ₂; congr -- Porting note (#10754): added this instance so that we can use `FunLike.coe` for `CoeFun` -- this also fixed very strange `simp` timeout issues instance Path.continuousMapClass : ContinuousMapClass (Path x y) I X where map_continuous := fun γ => show Continuous γ.toContinuousMap by continuity -- Porting note: not necessary in light of the instance above @[ext] protected theorem Path.ext : ∀ {γ₁ γ₂ : Path x y}, (γ₁ : I → X) = γ₂ → γ₁ = γ₂ := by rintro ⟨⟨x, h11⟩, h12, h13⟩ ⟨⟨x, h21⟩, h22, h23⟩ rfl rfl #align path.ext Path.ext namespace Path @[simp] theorem coe_mk_mk (f : I → X) (h₁) (h₂ : f 0 = x) (h₃ : f 1 = y) : ⇑(mk ⟨f, h₁⟩ h₂ h₃ : Path x y) = f := rfl #align path.coe_mk Path.coe_mk_mk -- Porting note: the name `Path.coe_mk` better refers to a new lemma below variable (γ : Path x y) @[continuity] protected theorem continuous : Continuous γ := γ.continuous_toFun #align path.continuous Path.continuous @[simp] protected theorem source : γ 0 = x := γ.source' #align path.source Path.source @[simp] protected theorem target : γ 1 = y := γ.target' #align path.target Path.target def simps.apply : I → X := γ #align path.simps.apply Path.simps.apply initialize_simps_projections Path (toFun → simps.apply, -toContinuousMap) @[simp] theorem coe_toContinuousMap : ⇑γ.toContinuousMap = γ := rfl #align path.coe_to_continuous_map Path.coe_toContinuousMap -- Porting note: this is needed because of the `Path.continuousMapClass` instance @[simp] theorem coe_mk : ⇑(γ : C(I, X)) = γ := rfl instance hasUncurryPath {X α : Type*} [TopologicalSpace X] {x y : α → X} : HasUncurry (∀ a : α, Path (x a) (y a)) (α × I) X := ⟨fun φ p => φ p.1 p.2⟩ #align path.has_uncurry_path Path.hasUncurryPath @[refl, simps] def refl (x : X) : Path x x where toFun _t := x continuous_toFun := continuous_const source' := rfl target' := rfl #align path.refl Path.refl @[simp]
Mathlib/Topology/Connected/PathConnected.lean
165
165
theorem refl_range {a : X} : range (Path.refl a) = {a} := by
simp [Path.refl, CoeFun.coe]
1
import Mathlib.Analysis.Convex.Between import Mathlib.Analysis.Convex.Jensen import Mathlib.Analysis.Convex.Topology import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.AddTorsor #align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" variable {ι : Type*} {E P : Type*} open Metric Set open scoped Convex variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P] variable {s t : Set E}
Mathlib/Analysis/Convex/Normed.lean
39
44
theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm := ⟨hs, fun x _ y _ a b ha hb _ => calc ‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _ _ = a * ‖x‖ + b * ‖y‖ := by
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
1
import Mathlib.CategoryTheory.Adjunction.FullyFaithful import Mathlib.CategoryTheory.Conj import Mathlib.CategoryTheory.Functor.ReflectsIso #align_import category_theory.adjunction.reflective from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a" universe v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section namespace CategoryTheory open Category Adjunction variable {C : Type u₁} {D : Type u₂} {E : Type u₃} variable [Category.{v₁} C] [Category.{v₂} D] [Category.{v₃} E] class Reflective (R : D ⥤ C) extends R.Full, R.Faithful where L : C ⥤ D adj : L ⊣ R #align category_theory.reflective CategoryTheory.Reflective variable (i : D ⥤ C) def reflector [Reflective i] : C ⥤ D := Reflective.L (R := i) def reflectorAdjunction [Reflective i] : reflector i ⊣ i := Reflective.adj instance [Reflective i] : i.IsRightAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ instance [Reflective i] : (reflector i).IsLeftAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩ def Functor.fullyFaithfulOfReflective [Reflective i] : i.FullyFaithful := (reflectorAdjunction i).fullyFaithfulROfIsIsoCounit -- TODO: This holds more generally for idempotent adjunctions, not just reflective adjunctions. theorem unit_obj_eq_map_unit [Reflective i] (X : C) : (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) = i.map ((reflector i).map ((reflectorAdjunction i).unit.app X)) := by rw [← cancel_mono (i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X))), ← i.map_comp] simp #align category_theory.unit_obj_eq_map_unit CategoryTheory.unit_obj_eq_map_unit example [Reflective i] {B : D} : IsIso ((reflectorAdjunction i).unit.app (i.obj B)) := inferInstance variable {i} theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) : IsIso ((reflectorAdjunction i).unit.app A) := by rwa [isIso_unit_app_iff_mem_essImage] #align category_theory.functor.ess_image.unit_is_iso CategoryTheory.Functor.essImage.unit_isIso theorem mem_essImage_of_unit_isIso {L : C ⥤ D} (adj : L ⊣ i) (A : C) [IsIso (adj.unit.app A)] : A ∈ i.essImage := ⟨L.obj A, ⟨(asIso (adj.unit.app A)).symm⟩⟩ #align category_theory.mem_ess_image_of_unit_is_iso CategoryTheory.mem_essImage_of_unit_isIso theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C} [IsSplitMono ((reflectorAdjunction i).unit.app A)] : A ∈ i.essImage := by let η : 𝟭 C ⟶ reflector i ⋙ i := (reflectorAdjunction i).unit haveI : IsIso (η.app (i.obj ((reflector i).obj A))) := Functor.essImage.unit_isIso ((i.obj_mem_essImage _)) have : Epi (η.app A) := by refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_ rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))] apply epi_comp (η.app (i.obj ((reflector i).obj A))) haveI := isIso_of_epi_of_isSplitMono (η.app A) exact mem_essImage_of_unit_isIso (reflectorAdjunction i) A #align category_theory.mem_ess_image_of_unit_is_split_mono CategoryTheory.mem_essImage_of_unit_isSplitMono instance Reflective.comp (F : C ⥤ D) (G : D ⥤ E) [Reflective F] [Reflective G] : Reflective (F ⋙ G) where L := reflector G ⋙ reflector F adj := (reflectorAdjunction G).comp (reflectorAdjunction F) #align category_theory.reflective.comp CategoryTheory.Reflective.comp def unitCompPartialBijectiveAux [Reflective i] (A : C) (B : D) : (A ⟶ i.obj B) ≃ (i.obj ((reflector i).obj A) ⟶ i.obj B) := ((reflectorAdjunction i).homEquiv _ _).symm.trans (Functor.FullyFaithful.ofFullyFaithful i).homEquiv #align category_theory.unit_comp_partial_bijective_aux CategoryTheory.unitCompPartialBijectiveAux theorem unitCompPartialBijectiveAux_symm_apply [Reflective i] {A : C} {B : D} (f : i.obj ((reflector i).obj A) ⟶ i.obj B) : (unitCompPartialBijectiveAux _ _).symm f = (reflectorAdjunction i).unit.app A ≫ f := by simp [unitCompPartialBijectiveAux] #align category_theory.unit_comp_partial_bijective_aux_symm_apply CategoryTheory.unitCompPartialBijectiveAux_symm_apply def unitCompPartialBijective [Reflective i] (A : C) {B : C} (hB : B ∈ i.essImage) : (A ⟶ B) ≃ (i.obj ((reflector i).obj A) ⟶ B) := calc (A ⟶ B) ≃ (A ⟶ i.obj (Functor.essImage.witness hB)) := Iso.homCongr (Iso.refl _) hB.getIso.symm _ ≃ (i.obj _ ⟶ i.obj (Functor.essImage.witness hB)) := unitCompPartialBijectiveAux _ _ _ ≃ (i.obj ((reflector i).obj A) ⟶ B) := Iso.homCongr (Iso.refl _) (Functor.essImage.getIso hB) #align category_theory.unit_comp_partial_bijective CategoryTheory.unitCompPartialBijective @[simp]
Mathlib/CategoryTheory/Adjunction/Reflective.lean
154
156
theorem unitCompPartialBijective_symm_apply [Reflective i] (A : C) {B : C} (hB : B ∈ i.essImage) (f) : (unitCompPartialBijective A hB).symm f = (reflectorAdjunction i).unit.app A ≫ f := by
simp [unitCompPartialBijective, unitCompPartialBijectiveAux_symm_apply]
1
import Mathlib.Order.Filter.Cofinite import Mathlib.Order.Hom.CompleteLattice #align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780" set_option autoImplicit true open Filter Set Function variable {α β γ ι ι' : Type*} namespace Filter section Relation def IsBounded (r : α → α → Prop) (f : Filter α) := ∃ b, ∀ᶠ x in f, r x b #align filter.is_bounded Filter.IsBounded def IsBoundedUnder (r : α → α → Prop) (f : Filter β) (u : β → α) := (map u f).IsBounded r #align filter.is_bounded_under Filter.IsBoundedUnder variable {r : α → α → Prop} {f g : Filter α} theorem isBounded_iff : f.IsBounded r ↔ ∃ s ∈ f.sets, ∃ b, s ⊆ { x | r x b } := Iff.intro (fun ⟨b, hb⟩ => ⟨{ a | r a b }, hb, b, Subset.refl _⟩) fun ⟨_, hs, b, hb⟩ => ⟨b, mem_of_superset hs hb⟩ #align filter.is_bounded_iff Filter.isBounded_iff theorem isBoundedUnder_of {f : Filter β} {u : β → α} : (∃ b, ∀ x, r (u x) b) → f.IsBoundedUnder r u | ⟨b, hb⟩ => ⟨b, show ∀ᶠ x in f, r (u x) b from eventually_of_forall hb⟩ #align filter.is_bounded_under_of Filter.isBoundedUnder_of theorem isBounded_bot : IsBounded r ⊥ ↔ Nonempty α := by simp [IsBounded, exists_true_iff_nonempty] #align filter.is_bounded_bot Filter.isBounded_bot
Mathlib/Order/LiminfLimsup.lean
80
80
theorem isBounded_top : IsBounded r ⊤ ↔ ∃ t, ∀ x, r x t := by
simp [IsBounded, eq_univ_iff_forall]
1
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition open FiniteDimensional namespace Subalgebra variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (A B : Subalgebra R S) [Module.Free R A] [Module.Free R B] [Module.Free A (Algebra.adjoin A (B : Set S))] [Module.Free B (Algebra.adjoin B (A : Set S))] theorem rank_sup_eq_rank_left_mul_rank_of_free : Module.rank R ↥(A ⊔ B) = Module.rank R A * Module.rank A (Algebra.adjoin A (B : Set S)) := by rcases subsingleton_or_nontrivial R with _ | _ · haveI := Module.subsingleton R S; simp nontriviality S using rank_subsingleton' letI : Algebra A (Algebra.adjoin A (B : Set S)) := Subalgebra.algebra _ letI : SMul A (Algebra.adjoin A (B : Set S)) := Algebra.toSMul haveI : IsScalarTower R A (Algebra.adjoin A (B : Set S)) := IsScalarTower.of_algebraMap_eq (congrFun rfl) rw [rank_mul_rank R A (Algebra.adjoin A (B : Set S))] change _ = Module.rank R ((Algebra.adjoin A (B : Set S)).restrictScalars R) rw [Algebra.restrictScalars_adjoin]; rfl theorem rank_sup_eq_rank_right_mul_rank_of_free : Module.rank R ↥(A ⊔ B) = Module.rank R B * Module.rank B (Algebra.adjoin B (A : Set S)) := by rw [sup_comm, rank_sup_eq_rank_left_mul_rank_of_free]
Mathlib/Algebra/Algebra/Subalgebra/Rank.lean
47
49
theorem finrank_sup_eq_finrank_left_mul_finrank_of_free : finrank R ↥(A ⊔ B) = finrank R A * finrank A (Algebra.adjoin A (B : Set S)) := by
simpa only [map_mul] using congr(Cardinal.toNat $(rank_sup_eq_rank_left_mul_rank_of_free A B))
1
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Analysis.Normed.Group.Basic import Mathlib.Topology.Instances.NNReal #align_import analysis.normed.group.infinite_sum from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Topology NNReal open Finset Filter Metric variable {ι α E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} : (CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff] · simp only [ball_zero_eq, Set.mem_setOf_eq] · rintro s t hst ⟨s', hs'⟩ exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩ #align cauchy_seq_finset_iff_vanishing_norm cauchySeq_finset_iff_vanishing_norm
Mathlib/Analysis/Normed/Group/InfiniteSum.lean
49
51
theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι → E} : Summable f ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm]
1
import Batteries.Data.Sum.Basic import Batteries.Logic open Function namespace Sum @[simp] protected theorem «forall» {p : α ⊕ β → Prop} : (∀ x, p x) ↔ (∀ a, p (inl a)) ∧ ∀ b, p (inr b) := ⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, h₂⟩ => Sum.rec h₁ h₂⟩ @[simp] protected theorem «exists» {p : α ⊕ β → Prop} : (∃ x, p x) ↔ (∃ a, p (inl a)) ∨ ∃ b, p (inr b) := ⟨ fun | ⟨inl a, h⟩ => Or.inl ⟨a, h⟩ | ⟨inr b, h⟩ => Or.inr ⟨b, h⟩, fun | Or.inl ⟨a, h⟩ => ⟨inl a, h⟩ | Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩ theorem forall_sum {γ : α ⊕ β → Sort _} (p : (∀ ab, γ ab) → Prop) : (∀ fab, p fab) ↔ (∀ fa fb, p (Sum.rec fa fb)) := by refine ⟨fun h fa fb => h _, fun h fab => ?_⟩ have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by ext ab; cases ab <;> rfl rw [h1]; exact h _ _ section get @[simp] theorem inl_getLeft : ∀ (x : α ⊕ β) (h : x.isLeft), inl (x.getLeft h) = x | inl _, _ => rfl @[simp] theorem inr_getRight : ∀ (x : α ⊕ β) (h : x.isRight), inr (x.getRight h) = x | inr _, _ => rfl @[simp] theorem getLeft?_eq_none_iff {x : α ⊕ β} : x.getLeft? = none ↔ x.isRight := by cases x <;> simp only [getLeft?, isRight, eq_self_iff_true] @[simp] theorem getRight?_eq_none_iff {x : α ⊕ β} : x.getRight? = none ↔ x.isLeft := by cases x <;> simp only [getRight?, isLeft, eq_self_iff_true] theorem eq_left_getLeft_of_isLeft : ∀ {x : α ⊕ β} (h : x.isLeft), x = inl (x.getLeft h) | inl _, _ => rfl @[simp] theorem getLeft_eq_iff (h : x.isLeft) : x.getLeft h = a ↔ x = inl a := by cases x <;> simp at h ⊢ theorem eq_right_getRight_of_isRight : ∀ {x : α ⊕ β} (h : x.isRight), x = inr (x.getRight h) | inr _, _ => rfl @[simp] theorem getRight_eq_iff (h : x.isRight) : x.getRight h = b ↔ x = inr b := by cases x <;> simp at h ⊢ @[simp] theorem getLeft?_eq_some_iff : x.getLeft? = some a ↔ x = inl a := by cases x <;> simp only [getLeft?, Option.some.injEq, inl.injEq] @[simp] theorem getRight?_eq_some_iff : x.getRight? = some b ↔ x = inr b := by cases x <;> simp only [getRight?, Option.some.injEq, inr.injEq] @[simp] theorem bnot_isLeft (x : α ⊕ β) : !x.isLeft = x.isRight := by cases x <;> rfl @[simp] theorem isLeft_eq_false {x : α ⊕ β} : x.isLeft = false ↔ x.isRight := by cases x <;> simp theorem not_isLeft {x : α ⊕ β} : ¬x.isLeft ↔ x.isRight := by simp @[simp] theorem bnot_isRight (x : α ⊕ β) : !x.isRight = x.isLeft := by cases x <;> rfl @[simp] theorem isRight_eq_false {x : α ⊕ β} : x.isRight = false ↔ x.isLeft := by cases x <;> simp theorem not_isRight {x : α ⊕ β} : ¬x.isRight ↔ x.isLeft := by simp theorem isLeft_iff : x.isLeft ↔ ∃ y, x = Sum.inl y := by cases x <;> simp
.lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean
85
85
theorem isRight_iff : x.isRight ↔ ∃ y, x = Sum.inr y := by
cases x <;> simp
1
import Mathlib.LinearAlgebra.AffineSpace.Independent import Mathlib.LinearAlgebra.Basis #align_import linear_algebra.affine_space.basis from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Affine open Set universe u₁ u₂ u₃ u₄ structure AffineBasis (ι : Type u₁) (k : Type u₂) {V : Type u₃} (P : Type u₄) [AddCommGroup V] [AffineSpace V P] [Ring k] [Module k V] where protected toFun : ι → P protected ind' : AffineIndependent k toFun protected tot' : affineSpan k (range toFun) = ⊤ #align affine_basis AffineBasis variable {ι ι' k V P : Type*} [AddCommGroup V] [AffineSpace V P] namespace AffineBasis section Ring variable [Ring k] [Module k V] (b : AffineBasis ι k P) {s : Finset ι} {i j : ι} (e : ι ≃ ι') instance : Inhabited (AffineBasis PUnit k PUnit) := ⟨⟨id, affineIndependent_of_subsingleton k id, by simp⟩⟩ instance instFunLike : FunLike (AffineBasis ι k P) ι P where coe := AffineBasis.toFun coe_injective' f g h := by cases f; cases g; congr #align affine_basis.fun_like AffineBasis.instFunLike @[ext] theorem ext {b₁ b₂ : AffineBasis ι k P} (h : (b₁ : ι → P) = b₂) : b₁ = b₂ := DFunLike.coe_injective h #align affine_basis.ext AffineBasis.ext theorem ind : AffineIndependent k b := b.ind' #align affine_basis.ind AffineBasis.ind theorem tot : affineSpan k (range b) = ⊤ := b.tot' #align affine_basis.tot AffineBasis.tot protected theorem nonempty : Nonempty ι := not_isEmpty_iff.mp fun hι => by simpa only [@range_eq_empty _ _ hι, AffineSubspace.span_empty, bot_ne_top] using b.tot #align affine_basis.nonempty AffineBasis.nonempty def reindex (e : ι ≃ ι') : AffineBasis ι' k P := ⟨b ∘ e.symm, b.ind.comp_embedding e.symm.toEmbedding, by rw [e.symm.surjective.range_comp] exact b.3⟩ #align affine_basis.reindex AffineBasis.reindex @[simp, norm_cast] theorem coe_reindex : ⇑(b.reindex e) = b ∘ e.symm := rfl #align affine_basis.coe_reindex AffineBasis.coe_reindex @[simp] theorem reindex_apply (i' : ι') : b.reindex e i' = b (e.symm i') := rfl #align affine_basis.reindex_apply AffineBasis.reindex_apply @[simp] theorem reindex_refl : b.reindex (Equiv.refl _) = b := ext rfl #align affine_basis.reindex_refl AffineBasis.reindex_refl noncomputable def basisOf (i : ι) : Basis { j : ι // j ≠ i } k V := Basis.mk ((affineIndependent_iff_linearIndependent_vsub k b i).mp b.ind) (by suffices Submodule.span k (range fun j : { x // x ≠ i } => b ↑j -ᵥ b i) = vectorSpan k (range b) by rw [this, ← direction_affineSpan, b.tot, AffineSubspace.direction_top] conv_rhs => rw [← image_univ] rw [vectorSpan_image_eq_span_vsub_set_right_ne k b (mem_univ i)] congr ext v simp) #align affine_basis.basis_of AffineBasis.basisOf @[simp]
Mathlib/LinearAlgebra/AffineSpace/Basis.lean
134
135
theorem basisOf_apply (i : ι) (j : { j : ι // j ≠ i }) : b.basisOf i j = b ↑j -ᵥ b i := by
simp [basisOf]
1
import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.FreeModule.Basic import Mathlib.LinearAlgebra.LinearPMap import Mathlib.LinearAlgebra.Projection #align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395" open Function Set Submodule set_option autoImplicit false variable {ι : Type*} {ι' : Type*} {K : Type*} {V : Type*} {V' : Type*} section DivisionRing variable [DivisionRing K] [AddCommGroup V] [AddCommGroup V'] [Module K V] [Module K V'] variable {v : ι → V} {s t : Set V} {x y z : V} open Submodule namespace Basis section ExistsBasis noncomputable def extend (hs : LinearIndependent K ((↑) : s → V)) : Basis (hs.extend (subset_univ s)) K V := Basis.mk (@LinearIndependent.restrict_of_comp_subtype _ _ _ id _ _ _ _ (hs.linearIndependent_extend _)) (SetLike.coe_subset_coe.mp <| by simpa using hs.subset_span_extend (subset_univ s)) #align basis.extend Basis.extend theorem extend_apply_self (hs : LinearIndependent K ((↑) : s → V)) (x : hs.extend _) : Basis.extend hs x = x := Basis.mk_apply _ _ _ #align basis.extend_apply_self Basis.extend_apply_self @[simp] theorem coe_extend (hs : LinearIndependent K ((↑) : s → V)) : ⇑(Basis.extend hs) = ((↑) : _ → _) := funext (extend_apply_self hs) #align basis.coe_extend Basis.coe_extend
Mathlib/LinearAlgebra/Basis/VectorSpace.lean
67
69
theorem range_extend (hs : LinearIndependent K ((↑) : s → V)) : range (Basis.extend hs) = hs.extend (subset_univ _) := by
rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq]
1
import Mathlib.Analysis.SpecialFunctions.Pow.Real #align_import analysis.special_functions.pow.nnreal from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" noncomputable section open scoped Classical open Real NNReal ENNReal ComplexConjugate open Finset Function Set namespace NNReal variable {w x y z : ℝ} noncomputable def rpow (x : ℝ≥0) (y : ℝ) : ℝ≥0 := ⟨(x : ℝ) ^ y, Real.rpow_nonneg x.2 y⟩ #align nnreal.rpow NNReal.rpow noncomputable instance : Pow ℝ≥0 ℝ := ⟨rpow⟩ @[simp] theorem rpow_eq_pow (x : ℝ≥0) (y : ℝ) : rpow x y = x ^ y := rfl #align nnreal.rpow_eq_pow NNReal.rpow_eq_pow @[simp, norm_cast] theorem coe_rpow (x : ℝ≥0) (y : ℝ) : ((x ^ y : ℝ≥0) : ℝ) = (x : ℝ) ^ y := rfl #align nnreal.coe_rpow NNReal.coe_rpow @[simp] theorem rpow_zero (x : ℝ≥0) : x ^ (0 : ℝ) = 1 := NNReal.eq <| Real.rpow_zero _ #align nnreal.rpow_zero NNReal.rpow_zero @[simp] theorem rpow_eq_zero_iff {x : ℝ≥0} {y : ℝ} : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by rw [← NNReal.coe_inj, coe_rpow, ← NNReal.coe_eq_zero] exact Real.rpow_eq_zero_iff_of_nonneg x.2 #align nnreal.rpow_eq_zero_iff NNReal.rpow_eq_zero_iff @[simp] theorem zero_rpow {x : ℝ} (h : x ≠ 0) : (0 : ℝ≥0) ^ x = 0 := NNReal.eq <| Real.zero_rpow h #align nnreal.zero_rpow NNReal.zero_rpow @[simp] theorem rpow_one (x : ℝ≥0) : x ^ (1 : ℝ) = x := NNReal.eq <| Real.rpow_one _ #align nnreal.rpow_one NNReal.rpow_one @[simp] theorem one_rpow (x : ℝ) : (1 : ℝ≥0) ^ x = 1 := NNReal.eq <| Real.one_rpow _ #align nnreal.one_rpow NNReal.one_rpow theorem rpow_add {x : ℝ≥0} (hx : x ≠ 0) (y z : ℝ) : x ^ (y + z) = x ^ y * x ^ z := NNReal.eq <| Real.rpow_add (pos_iff_ne_zero.2 hx) _ _ #align nnreal.rpow_add NNReal.rpow_add theorem rpow_add' (x : ℝ≥0) {y z : ℝ} (h : y + z ≠ 0) : x ^ (y + z) = x ^ y * x ^ z := NNReal.eq <| Real.rpow_add' x.2 h #align nnreal.rpow_add' NNReal.rpow_add' lemma rpow_of_add_eq (x : ℝ≥0) (hw : w ≠ 0) (h : y + z = w) : x ^ w = x ^ y * x ^ z := by rw [← h, rpow_add']; rwa [h] theorem rpow_mul (x : ℝ≥0) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z := NNReal.eq <| Real.rpow_mul x.2 y z #align nnreal.rpow_mul NNReal.rpow_mul theorem rpow_neg (x : ℝ≥0) (y : ℝ) : x ^ (-y) = (x ^ y)⁻¹ := NNReal.eq <| Real.rpow_neg x.2 _ #align nnreal.rpow_neg NNReal.rpow_neg
Mathlib/Analysis/SpecialFunctions/Pow/NNReal.lean
97
97
theorem rpow_neg_one (x : ℝ≥0) : x ^ (-1 : ℝ) = x⁻¹ := by
simp [rpow_neg]
1
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Ring.Basic import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Order.Hom.Basic #align_import algebra.order.sub.basic from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" variable {α β : Type*} section Add variable [Preorder α] [Add α] [Sub α] [OrderedSub α] {a b c d : α} theorem AddHom.le_map_tsub [Preorder β] [Add β] [Sub β] [OrderedSub β] (f : AddHom α β) (hf : Monotone f) (a b : α) : f a - f b ≤ f (a - b) := by rw [tsub_le_iff_right, ← f.map_add] exact hf le_tsub_add #align add_hom.le_map_tsub AddHom.le_map_tsub theorem le_mul_tsub {R : Type*} [Distrib R] [Preorder R] [Sub R] [OrderedSub R] [CovariantClass R R (· * ·) (· ≤ ·)] {a b c : R} : a * b - a * c ≤ a * (b - c) := (AddHom.mulLeft a).le_map_tsub (monotone_id.const_mul' a) _ _ #align le_mul_tsub le_mul_tsub
Mathlib/Algebra/Order/Sub/Basic.lean
36
38
theorem le_tsub_mul {R : Type*} [CommSemiring R] [Preorder R] [Sub R] [OrderedSub R] [CovariantClass R R (· * ·) (· ≤ ·)] {a b c : R} : a * c - b * c ≤ (a - b) * c := by
simpa only [mul_comm _ c] using le_mul_tsub
1
import Mathlib.Init.Control.Combinators import Mathlib.Data.Option.Defs import Mathlib.Logic.IsEmpty import Mathlib.Logic.Relator import Mathlib.Util.CompileInductive import Aesop #align_import data.option.basic from "leanprover-community/mathlib"@"f340f229b1f461aa1c8ee11e0a172d0a3b301a4a" universe u namespace Option variable {α β γ δ : Type*} theorem coe_def : (fun a ↦ ↑a : α → Option α) = some := rfl #align option.coe_def Option.coe_def theorem mem_map {f : α → β} {y : β} {o : Option α} : y ∈ o.map f ↔ ∃ x ∈ o, f x = y := by simp #align option.mem_map Option.mem_map -- The simpNF linter says that the LHS can be simplified via `Option.mem_def`. -- However this is a higher priority lemma. -- https://github.com/leanprover/std4/issues/207 @[simp 1100, nolint simpNF] theorem mem_map_of_injective {f : α → β} (H : Function.Injective f) {a : α} {o : Option α} : f a ∈ o.map f ↔ a ∈ o := by aesop theorem forall_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∀ y ∈ o.map f, p y) ↔ ∀ x ∈ o, p (f x) := by simp #align option.forall_mem_map Option.forall_mem_map
Mathlib/Data/Option/Basic.lean
61
62
theorem exists_mem_map {f : α → β} {o : Option α} {p : β → Prop} : (∃ y ∈ o.map f, p y) ↔ ∃ x ∈ o, p (f x) := by
simp
1
import Mathlib.MeasureTheory.Measure.NullMeasurable import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.Topology.Algebra.Order.LiminfLimsup #align_import measure_theory.measure.measure_space from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55" noncomputable section open Set open Filter hiding map open Function MeasurableSpace open scoped Classical symmDiff open Topology Filter ENNReal NNReal Interval MeasureTheory variable {α β γ δ ι R R' : Type*} namespace MeasureTheory section variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α} instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) := ⟨fun _s hs => let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs ⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩ #align measure_theory.ae_is_measurably_generated MeasureTheory.ae_isMeasurablyGenerated
Mathlib/MeasureTheory/Measure/MeasureSpace.lean
107
109
theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} : (∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by
simp only [uIoc_eq_union, mem_union, or_imp, eventually_and]
1
import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.SimpleGraph.Density import Mathlib.Data.Rat.BigOperators #align_import combinatorics.simple_graph.regularity.energy from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d" open Finset variable {α : Type*} [DecidableEq α] {s : Finset α} (P : Finpartition s) (G : SimpleGraph α) [DecidableRel G.Adj] namespace Finpartition def energy : ℚ := ((∑ uv ∈ P.parts.offDiag, G.edgeDensity uv.1 uv.2 ^ 2) : ℚ) / (P.parts.card : ℚ) ^ 2 #align finpartition.energy Finpartition.energy
Mathlib/Combinatorics/SimpleGraph/Regularity/Energy.lean
42
43
theorem energy_nonneg : 0 ≤ P.energy G := by
exact div_nonneg (Finset.sum_nonneg fun _ _ => sq_nonneg _) <| sq_nonneg _
1
import Mathlib.Algebra.Lie.Submodule #align_import algebra.lie.ideal_operations from "leanprover-community/mathlib"@"8983bec7cdf6cb2dd1f21315c8a34ab00d7b2f6d" universe u v w w₁ w₂ namespace LieSubmodule variable {R : Type u} {L : Type v} {M : Type w} {M₂ : Type w₁} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M₂] [Module R M₂] [LieRingModule L M₂] [LieModule R L M₂] variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L) (N₂ : LieSubmodule R L M₂) section LieIdealOperations instance hasBracket : Bracket (LieIdeal R L) (LieSubmodule R L M) := ⟨fun I N => lieSpan R L { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m }⟩ #align lie_submodule.has_bracket LieSubmodule.hasBracket theorem lieIdeal_oper_eq_span : ⁅I, N⁆ = lieSpan R L { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m } := rfl #align lie_submodule.lie_ideal_oper_eq_span LieSubmodule.lieIdeal_oper_eq_span theorem lieIdeal_oper_eq_linear_span : (↑⁅I, N⁆ : Submodule R M) = Submodule.span R { m | ∃ (x : I) (n : N), ⁅(x : L), (n : M)⁆ = m } := by apply le_antisymm · let s := { m : M | ∃ (x : ↥I) (n : ↥N), ⁅(x : L), (n : M)⁆ = m } have aux : ∀ (y : L), ∀ m' ∈ Submodule.span R s, ⁅y, m'⁆ ∈ Submodule.span R s := by intro y m' hm' refine Submodule.span_induction (R := R) (M := M) (s := s) (p := fun m' ↦ ⁅y, m'⁆ ∈ Submodule.span R s) hm' ?_ ?_ ?_ ?_ · rintro m'' ⟨x, n, hm''⟩; rw [← hm'', leibniz_lie] refine Submodule.add_mem _ ?_ ?_ <;> apply Submodule.subset_span · use ⟨⁅y, ↑x⁆, I.lie_mem x.property⟩, n · use x, ⟨⁅y, ↑n⁆, N.lie_mem n.property⟩ · simp only [lie_zero, Submodule.zero_mem] · intro m₁ m₂ hm₁ hm₂; rw [lie_add]; exact Submodule.add_mem _ hm₁ hm₂ · intro t m'' hm''; rw [lie_smul]; exact Submodule.smul_mem _ t hm'' change _ ≤ ({ Submodule.span R s with lie_mem := fun hm' => aux _ _ hm' } : LieSubmodule R L M) rw [lieIdeal_oper_eq_span, lieSpan_le] exact Submodule.subset_span · rw [lieIdeal_oper_eq_span]; apply submodule_span_le_lieSpan #align lie_submodule.lie_ideal_oper_eq_linear_span LieSubmodule.lieIdeal_oper_eq_linear_span theorem lieIdeal_oper_eq_linear_span' : (↑⁅I, N⁆ : Submodule R M) = Submodule.span R { m | ∃ x ∈ I, ∃ n ∈ N, ⁅x, n⁆ = m } := by rw [lieIdeal_oper_eq_linear_span] congr ext m constructor · rintro ⟨⟨x, hx⟩, ⟨n, hn⟩, rfl⟩ exact ⟨x, hx, n, hn, rfl⟩ · rintro ⟨x, hx, n, hn, rfl⟩ exact ⟨⟨x, hx⟩, ⟨n, hn⟩, rfl⟩ #align lie_submodule.lie_ideal_oper_eq_linear_span' LieSubmodule.lieIdeal_oper_eq_linear_span' theorem lie_le_iff : ⁅I, N⁆ ≤ N' ↔ ∀ x ∈ I, ∀ m ∈ N, ⁅x, m⁆ ∈ N' := by rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le] refine ⟨fun h x hx m hm => h ⟨⟨x, hx⟩, ⟨m, hm⟩, rfl⟩, ?_⟩ rintro h _ ⟨⟨x, hx⟩, ⟨m, hm⟩, rfl⟩ exact h x hx m hm #align lie_submodule.lie_le_iff LieSubmodule.lie_le_iff
Mathlib/Algebra/Lie/IdealOperations.lean
103
104
theorem lie_coe_mem_lie (x : I) (m : N) : ⁅(x : L), (m : M)⁆ ∈ ⁅I, N⁆ := by
rw [lieIdeal_oper_eq_span]; apply subset_lieSpan; use x, m
1
import Mathlib.Data.Set.Pointwise.Interval import Mathlib.Topology.Algebra.Field import Mathlib.Topology.Algebra.Order.Group #align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd" open Set Filter TopologicalSpace Function open scoped Pointwise Topology open OrderDual (toDual ofDual) theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜] [TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜) (norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y) (nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) : TopologicalRing R := by have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) → Tendsto f (𝓝 0) (𝓝 0) := by refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩ refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩ exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ apply TopologicalRing.of_addGroup_of_nhds_zero case hmul => refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_ refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩ simp only [sub_zero] at * calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _ _ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _) case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x) case hmul_right => exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x => (norm_mul_le x y).trans_eq (mul_comm _ _) variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜] {l : Filter α} {f g : α → 𝕜} -- see Note [lower instance priority] instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 := .of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by simpa using nhds_basis_abs_sub_lt (0 : 𝕜) theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop) (hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC)) filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0] with x hg hf using mul_le_mul_of_nonneg_left hg.le hf #align filter.tendsto.at_top_mul Filter.Tendsto.atTop_mul
Mathlib/Topology/Algebra/Order/Field.lean
72
74
theorem Filter.Tendsto.mul_atTop {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C)) (hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atTop_mul hC hf
1
import Mathlib.Topology.PartialHomeomorph import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Data.Real.Sqrt #align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Set Metric Pointwise variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E] noncomputable section @[simps (config := .lemmasOnly)] def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E) source := univ target := ball 0 1 map_source' x _ := by have : 0 < 1 + ‖x‖ ^ 2 := by positivity rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul, div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq, abs_norm, Real.sq_sqrt this.le] exact lt_one_add _ map_target' _ _ := trivial left_inv' x _ := by field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs, Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le] right_inv' y hy := by have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le, ← Real.sqrt_div this.le] open_source := isOpen_univ open_target := isOpen_ball continuousOn_toFun := by suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹ from (this.smul continuous_id).continuousOn refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity) continuity continuousOn_invFun := by have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by rw [Real.sqrt_ne_zero'] nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy] exact ContinuousOn.smul (ContinuousOn.inv₀ (continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id @[simp] theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_apply] @[simp] theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by simp [PartialHomeomorph.univUnitBall_symm_apply] @[simps! (config := .lemmasOnly)] def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 := (Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget #align homeomorph_unit_ball Homeomorph.unitBall @[simp] theorem Homeomorph.coe_unitBall_apply_zero : (Homeomorph.unitBall (0 : E) : E) = 0 := PartialHomeomorph.univUnitBall_apply_zero #align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P] namespace PartialHomeomorph @[simps!] def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P := ((Homeomorph.smulOfNeZero r hr.ne').trans (IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq (ball 0 1) isOpen_ball (ball c r) <| by change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball] simp [abs_of_pos hr] def univBall (c : P) (r : ℝ) : PartialHomeomorph E P := if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph @[simp] theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by unfold univBall; split_ifs <;> rfl theorem univBall_target (c : P) {r : ℝ} (hr : 0 < r) : (univBall c r).target = ball c r := by rw [univBall, dif_pos hr]; rfl theorem ball_subset_univBall_target (c : P) (r : ℝ) : ball c r ⊆ (univBall c r).target := by by_cases hr : 0 < r · rw [univBall_target c hr] · rw [univBall, dif_neg hr] exact subset_univ _ @[simp]
Mathlib/Analysis/NormedSpace/HomeomorphBall.lean
140
141
theorem univBall_apply_zero (c : P) (r : ℝ) : univBall c r 0 = c := by
unfold univBall; split_ifs <;> simp
1
import Mathlib.Data.Matrix.Invertible import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.LinearAlgebra.FiniteDimensional #align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" namespace Matrix universe u u' v variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v} open Matrix Equiv Equiv.Perm Finset section Inv variable [Fintype n] [DecidableEq n] [CommRing α] variable (A : Matrix n n α) (B : Matrix n n α) theorem isUnit_det_transpose (h : IsUnit A.det) : IsUnit Aᵀ.det := by rw [det_transpose] exact h #align matrix.is_unit_det_transpose Matrix.isUnit_det_transpose noncomputable instance inv : Inv (Matrix n n α) := ⟨fun A => Ring.inverse A.det • A.adjugate⟩ theorem inv_def (A : Matrix n n α) : A⁻¹ = Ring.inverse A.det • A.adjugate := rfl #align matrix.inv_def Matrix.inv_def
Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean
221
222
theorem nonsing_inv_apply_not_isUnit (h : ¬IsUnit A.det) : A⁻¹ = 0 := by
rw [inv_def, Ring.inverse_non_unit _ h, zero_smul]
1
import Mathlib.Data.Set.Function import Mathlib.Logic.Relation import Mathlib.Logic.Pairwise #align_import data.set.pairwise.basic from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Order Set variable {α β γ ι ι' : Type*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} theorem pairwise_on_bool (hr : Symmetric r) {a b : α} : Pairwise (r on fun c => cond c a b) ↔ r a b := by simpa [Pairwise, Function.onFun] using @hr a b #align pairwise_on_bool pairwise_on_bool theorem pairwise_disjoint_on_bool [SemilatticeInf α] [OrderBot α] {a b : α} : Pairwise (Disjoint on fun c => cond c a b) ↔ Disjoint a b := pairwise_on_bool Disjoint.symm #align pairwise_disjoint_on_bool pairwise_disjoint_on_bool theorem Symmetric.pairwise_on [LinearOrder ι] (hr : Symmetric r) (f : ι → α) : Pairwise (r on f) ↔ ∀ ⦃m n⦄, m < n → r (f m) (f n) := ⟨fun h _m _n hmn => h hmn.ne, fun h _m _n hmn => hmn.lt_or_lt.elim (@h _ _) fun h' => hr (h h')⟩ #align symmetric.pairwise_on Symmetric.pairwise_on theorem pairwise_disjoint_on [SemilatticeInf α] [OrderBot α] [LinearOrder ι] (f : ι → α) : Pairwise (Disjoint on f) ↔ ∀ ⦃m n⦄, m < n → Disjoint (f m) (f n) := Symmetric.pairwise_on Disjoint.symm f #align pairwise_disjoint_on pairwise_disjoint_on theorem pairwise_disjoint_mono [SemilatticeInf α] [OrderBot α] (hs : Pairwise (Disjoint on f)) (h : g ≤ f) : Pairwise (Disjoint on g) := hs.mono fun i j hij => Disjoint.mono (h i) (h j) hij #align pairwise_disjoint.mono pairwise_disjoint_mono
Mathlib/Data/Set/Pairwise/Basic.lean
234
236
theorem pairwise_subtype_iff_pairwise_set (s : Set α) (r : α → α → Prop) : (Pairwise fun (x : s) (y : s) => r x y) ↔ s.Pairwise r := by
simp only [Pairwise, Set.Pairwise, SetCoe.forall, Ne, Subtype.ext_iff, Subtype.coe_mk]
1
import Mathlib.MeasureTheory.Measure.MeasureSpace #align_import measure_theory.covering.vitali_family from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open MeasureTheory Metric Set Filter TopologicalSpace MeasureTheory.Measure open Filter MeasureTheory Topology variable {α : Type*} [MetricSpace α] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure VitaliFamily {m : MeasurableSpace α} (μ : Measure α) where setsAt : α → Set (Set α) measurableSet : ∀ x : α, ∀ s ∈ setsAt x, MeasurableSet s nonempty_interior : ∀ x : α, ∀ s ∈ setsAt x, (interior s).Nonempty nontrivial : ∀ (x : α), ∀ ε > (0 : ℝ), ∃ s ∈ setsAt x, s ⊆ closedBall x ε covering : ∀ (s : Set α) (f : α → Set (Set α)), (∀ x ∈ s, f x ⊆ setsAt x) → (∀ x ∈ s, ∀ ε > (0 : ℝ), ∃ a ∈ f x, a ⊆ closedBall x ε) → ∃ t : Set (α × Set α), (∀ p ∈ t, p.1 ∈ s) ∧ (t.PairwiseDisjoint fun p ↦ p.2) ∧ (∀ p ∈ t, p.2 ∈ f p.1) ∧ μ (s \ ⋃ p ∈ t, p.2) = 0 #align vitali_family VitaliFamily namespace VitaliFamily variable {m0 : MeasurableSpace α} {μ : Measure α} def mono (v : VitaliFamily μ) (ν : Measure α) (hν : ν ≪ μ) : VitaliFamily ν where __ := v covering s f h h' := let ⟨t, ts, disj, mem_f, hμ⟩ := v.covering s f h h' ⟨t, ts, disj, mem_f, hν hμ⟩ #align vitali_family.mono VitaliFamily.mono def FineSubfamilyOn (v : VitaliFamily μ) (f : α → Set (Set α)) (s : Set α) : Prop := ∀ x ∈ s, ∀ ε > 0, ∃ a ∈ v.setsAt x ∩ f x, a ⊆ closedBall x ε #align vitali_family.fine_subfamily_on VitaliFamily.FineSubfamilyOn def enlarge (v : VitaliFamily μ) (δ : ℝ) (δpos : 0 < δ) : VitaliFamily μ where setsAt x := v.setsAt x ∪ { a | MeasurableSet a ∧ (interior a).Nonempty ∧ ¬a ⊆ closedBall x δ } measurableSet x a ha := by cases' ha with ha ha exacts [v.measurableSet _ _ ha, ha.1] nonempty_interior x a ha := by cases' ha with ha ha exacts [v.nonempty_interior _ _ ha, ha.2.1] nontrivial := by intro x ε εpos rcases v.nontrivial x ε εpos with ⟨a, ha, h'a⟩ exact ⟨a, mem_union_left _ ha, h'a⟩ covering := by intro s f fset ffine let g : α → Set (Set α) := fun x => f x ∩ v.setsAt x have : ∀ x ∈ s, ∀ ε : ℝ, ε > 0 → ∃ (a : Set α), a ∈ g x ∧ a ⊆ closedBall x ε := by intro x hx ε εpos obtain ⟨a, af, ha⟩ : ∃ a ∈ f x, a ⊆ closedBall x (min ε δ) := ffine x hx (min ε δ) (lt_min εpos δpos) rcases fset x hx af with (h'a | h'a) · exact ⟨a, ⟨af, h'a⟩, ha.trans (closedBall_subset_closedBall (min_le_left _ _))⟩ · refine False.elim (h'a.2.2 ?_) exact ha.trans (closedBall_subset_closedBall (min_le_right _ _)) rcases v.covering s g (fun x _ => inter_subset_right) this with ⟨t, ts, tdisj, tg, μt⟩ exact ⟨t, ts, tdisj, fun p hp => (tg p hp).1, μt⟩ #align vitali_family.enlarge VitaliFamily.enlarge variable (v : VitaliFamily μ) def filterAt (x : α) : Filter (Set α) := (𝓝 x).smallSets ⊓ 𝓟 (v.setsAt x) #align vitali_family.filter_at VitaliFamily.filterAt theorem _root_.Filter.HasBasis.vitaliFamily {ι : Sort*} {p : ι → Prop} {s : ι → Set α} {x : α} (h : (𝓝 x).HasBasis p s) : (v.filterAt x).HasBasis p (fun i ↦ {t ∈ v.setsAt x | t ⊆ s i}) := by simpa only [← Set.setOf_inter_eq_sep] using h.smallSets.inf_principal _ theorem filterAt_basis_closedBall (x : α) : (v.filterAt x).HasBasis (0 < ·) ({a ∈ v.setsAt x | a ⊆ closedBall x ·}) := nhds_basis_closedBall.vitaliFamily v
Mathlib/MeasureTheory/Covering/VitaliFamily.lean
234
236
theorem mem_filterAt_iff {x : α} {s : Set (Set α)} : s ∈ v.filterAt x ↔ ∃ ε > (0 : ℝ), ∀ a ∈ v.setsAt x, a ⊆ closedBall x ε → a ∈ s := by
simp only [(v.filterAt_basis_closedBall x).mem_iff, ← and_imp, subset_def, mem_setOf]
1
import Batteries.Tactic.SeqFocus namespace Ordering @[simp] theorem swap_swap {o : Ordering} : o.swap.swap = o := by cases o <;> rfl @[simp] theorem swap_inj {o₁ o₂ : Ordering} : o₁.swap = o₂.swap ↔ o₁ = o₂ := ⟨fun h => by simpa using congrArg swap h, congrArg _⟩ theorem swap_then (o₁ o₂ : Ordering) : (o₁.then o₂).swap = o₁.swap.then o₂.swap := by cases o₁ <;> rfl theorem then_eq_lt {o₁ o₂ : Ordering} : o₁.then o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by cases o₁ <;> cases o₂ <;> decide
.lake/packages/batteries/Batteries/Classes/Order.lean
23
24
theorem then_eq_eq {o₁ o₂ : Ordering} : o₁.then o₂ = eq ↔ o₁ = eq ∧ o₂ = eq := by
cases o₁ <;> simp [«then»]
1
import Mathlib.Data.Finset.Grade import Mathlib.Order.Interval.Finset.Basic #align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" variable {α β : Type*} namespace Finset section Decidable variable [DecidableEq α] (s t : Finset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where finsetIcc s t := t.powerset.filter (s ⊆ ·) finsetIco s t := t.ssubsets.filter (s ⊆ ·) finsetIoc s t := t.powerset.filter (s ⊂ ·) finsetIoo s t := t.ssubsets.filter (s ⊂ ·) finset_mem_Icc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ico s t u := by rw [mem_filter, mem_ssubsets] exact and_comm finset_mem_Ioc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ioo s t u := by rw [mem_filter, mem_ssubsets] exact and_comm theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) := rfl #align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) := rfl #align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) := rfl #align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) := rfl #align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets theorem Iic_eq_powerset : Iic s = s.powerset := filter_true_of_mem fun t _ => empty_subset t #align finset.Iic_eq_powerset Finset.Iic_eq_powerset theorem Iio_eq_ssubsets : Iio s = s.ssubsets := filter_true_of_mem fun t _ => empty_subset t #align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets variable {s t} theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by ext u simp_rw [mem_Icc, mem_image, mem_powerset] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩ #align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset theorem Ico_eq_image_ssubsets (h : s ⊆ t) : Ico s t = (t \ s).ssubsets.image (s ∪ ·) := by ext u simp_rw [mem_Ico, mem_image, mem_ssubsets] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, sup_lt_of_lt_sdiff_left hv h⟩ #align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets theorem card_Icc_finset (h : s ⊆ t) : (Icc s t).card = 2 ^ (t.card - s.card) := by rw [← card_sdiff h, ← card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff] rintro u hu v hv (huv : s ⊔ u = s ⊔ v) rw [mem_coe, mem_powerset] at hu hv rw [← (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, ← (disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv] #align finset.card_Icc_finset Finset.card_Icc_finset theorem card_Ico_finset (h : s ⊆ t) : (Ico s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ico_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ico_finset Finset.card_Ico_finset
Mathlib/Data/Finset/Interval.lean
115
116
theorem card_Ioc_finset (h : s ⊆ t) : (Ioc s t).card = 2 ^ (t.card - s.card) - 1 := by
rw [card_Ioc_eq_card_Icc_sub_one, card_Icc_finset h]
1
import Mathlib.Order.CompleteLattice import Mathlib.Order.Cover import Mathlib.Order.Iterate import Mathlib.Order.WellFounded #align_import order.succ_pred.basic from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" open Function OrderDual Set variable {α β : Type*} @[ext] class SuccOrder (α : Type*) [Preorder α] where succ : α → α le_succ : ∀ a, a ≤ succ a max_of_succ_le {a} : succ a ≤ a → IsMax a succ_le_of_lt {a b} : a < b → succ a ≤ b le_of_lt_succ {a b} : a < succ b → a ≤ b #align succ_order SuccOrder #align succ_order.ext_iff SuccOrder.ext_iff #align succ_order.ext SuccOrder.ext @[ext] class PredOrder (α : Type*) [Preorder α] where pred : α → α pred_le : ∀ a, pred a ≤ a min_of_le_pred {a} : a ≤ pred a → IsMin a le_pred_of_lt {a b} : a < b → a ≤ pred b le_of_pred_lt {a b} : pred a < b → a ≤ b #align pred_order PredOrder #align pred_order.ext PredOrder.ext #align pred_order.ext_iff PredOrder.ext_iff instance [Preorder α] [SuccOrder α] : PredOrder αᵒᵈ where pred := toDual ∘ SuccOrder.succ ∘ ofDual pred_le := by simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual, SuccOrder.le_succ, implies_true] min_of_le_pred h := by apply SuccOrder.max_of_succ_le h le_pred_of_lt := by intro a b h; exact SuccOrder.succ_le_of_lt h le_of_pred_lt := SuccOrder.le_of_lt_succ instance [Preorder α] [PredOrder α] : SuccOrder αᵒᵈ where succ := toDual ∘ PredOrder.pred ∘ ofDual le_succ := by simp only [comp, OrderDual.forall, ofDual_toDual, toDual_le_toDual, PredOrder.pred_le, implies_true] max_of_succ_le h := by apply PredOrder.min_of_le_pred h succ_le_of_lt := by intro a b h; exact PredOrder.le_pred_of_lt h le_of_lt_succ := PredOrder.le_of_pred_lt namespace Order section Preorder variable [Preorder α] [SuccOrder α] {a b : α} def succ : α → α := SuccOrder.succ #align order.succ Order.succ theorem le_succ : ∀ a : α, a ≤ succ a := SuccOrder.le_succ #align order.le_succ Order.le_succ theorem max_of_succ_le {a : α} : succ a ≤ a → IsMax a := SuccOrder.max_of_succ_le #align order.max_of_succ_le Order.max_of_succ_le theorem succ_le_of_lt {a b : α} : a < b → succ a ≤ b := SuccOrder.succ_le_of_lt #align order.succ_le_of_lt Order.succ_le_of_lt theorem le_of_lt_succ {a b : α} : a < succ b → a ≤ b := SuccOrder.le_of_lt_succ #align order.le_of_lt_succ Order.le_of_lt_succ @[simp] theorem succ_le_iff_isMax : succ a ≤ a ↔ IsMax a := ⟨max_of_succ_le, fun h => h <| le_succ _⟩ #align order.succ_le_iff_is_max Order.succ_le_iff_isMax @[simp] theorem lt_succ_iff_not_isMax : a < succ a ↔ ¬IsMax a := ⟨not_isMax_of_lt, fun ha => (le_succ a).lt_of_not_le fun h => ha <| max_of_succ_le h⟩ #align order.lt_succ_iff_not_is_max Order.lt_succ_iff_not_isMax alias ⟨_, lt_succ_of_not_isMax⟩ := lt_succ_iff_not_isMax #align order.lt_succ_of_not_is_max Order.lt_succ_of_not_isMax theorem wcovBy_succ (a : α) : a ⩿ succ a := ⟨le_succ a, fun _ hb => (succ_le_of_lt hb).not_lt⟩ #align order.wcovby_succ Order.wcovBy_succ theorem covBy_succ_of_not_isMax (h : ¬IsMax a) : a ⋖ succ a := (wcovBy_succ a).covBy_of_lt <| lt_succ_of_not_isMax h #align order.covby_succ_of_not_is_max Order.covBy_succ_of_not_isMax theorem lt_succ_iff_of_not_isMax (ha : ¬IsMax a) : b < succ a ↔ b ≤ a := ⟨le_of_lt_succ, fun h => h.trans_lt <| lt_succ_of_not_isMax ha⟩ #align order.lt_succ_iff_of_not_is_max Order.lt_succ_iff_of_not_isMax theorem succ_le_iff_of_not_isMax (ha : ¬IsMax a) : succ a ≤ b ↔ a < b := ⟨(lt_succ_of_not_isMax ha).trans_le, succ_le_of_lt⟩ #align order.succ_le_iff_of_not_is_max Order.succ_le_iff_of_not_isMax lemma succ_lt_succ_of_not_isMax (h : a < b) (hb : ¬ IsMax b) : succ a < succ b := (lt_succ_iff_of_not_isMax hb).2 <| succ_le_of_lt h theorem succ_lt_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) : succ a < succ b ↔ a < b := by rw [lt_succ_iff_of_not_isMax hb, succ_le_iff_of_not_isMax ha] #align order.succ_lt_succ_iff_of_not_is_max Order.succ_lt_succ_iff_of_not_isMax
Mathlib/Order/SuccPred/Basic.lean
284
286
theorem succ_le_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) : succ a ≤ succ b ↔ a ≤ b := by
rw [succ_le_iff_of_not_isMax ha, lt_succ_iff_of_not_isMax hb]
1
import Mathlib.SetTheory.Cardinal.Finite #align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04" namespace Set variable {α β : Type*} {s t : Set α} noncomputable def encard (s : Set α) : ℕ∞ := PartENat.withTopEquiv (PartENat.card s) @[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s := by rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)] theorem encard_univ (α : Type*) : encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) := by rw [encard, PartENat.card_congr (Equiv.Set.univ α)] theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by have := h.fintype rw [encard, PartENat.card_eq_coe_fintype_card, PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card] theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card := by have h := toFinite s rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset] theorem encard_coe_eq_coe_finsetCard (s : Finset α) : encard (s : Set α) = s.card := by rw [Finite.encard_eq_coe_toFinset_card (Finset.finite_toSet s)]; simp theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ := by have := h.to_subtype rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_top, PartENat.card_eq_top_of_infinite] @[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.withTopEquiv_symm_zero, PartENat.card_eq_zero_iff_empty, isEmpty_subtype, eq_empty_iff_forall_not_mem] @[simp] theorem encard_empty : (∅ : Set α).encard = 0 := by rw [encard_eq_zero] theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty := by rwa [nonempty_iff_ne_empty, Ne, ← encard_eq_zero] theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty := by rw [ne_eq, encard_eq_zero, nonempty_iff_ne_empty] @[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty := by rw [pos_iff_ne_zero, encard_ne_zero] @[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 := by rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply, PartENat.card_eq_coe_fintype_card, Fintype.card_ofSubsingleton, Nat.cast_one]; rfl theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard := by classical have e := (Equiv.Set.union (by rwa [subset_empty_iff, ← disjoint_iff_inter_eq_empty])).symm simp [encard, ← PartENat.card_congr e, PartENat.card_sum, PartENat.withTopEquiv] theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 := by rw [← union_singleton, encard_union_eq (by simpa), encard_singleton] theorem Finite.encard_lt_top (h : s.Finite) : s.encard < ⊤ := by refine h.induction_on (by simp) ?_ rintro a t hat _ ht' rw [encard_insert_of_not_mem hat] exact lt_tsub_iff_right.1 ht' theorem Finite.encard_eq_coe (h : s.Finite) : s.encard = ENat.toNat s.encard := (ENat.coe_toNat h.encard_lt_top.ne).symm theorem Finite.exists_encard_eq_coe (h : s.Finite) : ∃ (n : ℕ), s.encard = n := ⟨_, h.encard_eq_coe⟩ @[simp] theorem encard_lt_top_iff : s.encard < ⊤ ↔ s.Finite := ⟨fun h ↦ by_contra fun h' ↦ h.ne (Infinite.encard_eq h'), Finite.encard_lt_top⟩ @[simp] theorem encard_eq_top_iff : s.encard = ⊤ ↔ s.Infinite := by rw [← not_iff_not, ← Ne, ← lt_top_iff_ne_top, encard_lt_top_iff, not_infinite] theorem encard_ne_top_iff : s.encard ≠ ⊤ ↔ s.Finite := by simp theorem finite_of_encard_le_coe {k : ℕ} (h : s.encard ≤ k) : s.Finite := by rw [← encard_lt_top_iff]; exact h.trans_lt (WithTop.coe_lt_top _) theorem finite_of_encard_eq_coe {k : ℕ} (h : s.encard = k) : s.Finite := finite_of_encard_le_coe h.le theorem encard_le_coe_iff {k : ℕ} : s.encard ≤ k ↔ s.Finite ∧ ∃ (n₀ : ℕ), s.encard = n₀ ∧ n₀ ≤ k := ⟨fun h ↦ ⟨finite_of_encard_le_coe h, by rwa [ENat.le_coe_iff] at h⟩, fun ⟨_,⟨n₀,hs, hle⟩⟩ ↦ by rwa [hs, Nat.cast_le]⟩ section Lattice
Mathlib/Data/Set/Card.lean
152
153
theorem encard_le_card (h : s ⊆ t) : s.encard ≤ t.encard := by
rw [← union_diff_cancel h, encard_union_eq disjoint_sdiff_right]; exact le_self_add
1
import Mathlib.Order.Interval.Set.Disjoint import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.MeasureTheory.Measure.Lebesgue.Basic #align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open scoped Classical open MeasureTheory Set Filter Function open scoped Classical Topology Filter ENNReal Interval NNReal variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E] def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop := IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ #align interval_integrable IntervalIntegrable section variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ} theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable] #align interval_integrable_iff intervalIntegrable_iff theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ := intervalIntegrable_iff.mp h #align interval_integrable.def IntervalIntegrable.def'
Mathlib/MeasureTheory/Integral/IntervalIntegral.lean
93
95
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
1
import Mathlib.Algebra.Homology.ComplexShape import Mathlib.CategoryTheory.Subobject.Limits import Mathlib.CategoryTheory.GradedObject import Mathlib.Algebra.Homology.ShortComplex.Basic #align_import algebra.homology.homological_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347" universe v u open CategoryTheory CategoryTheory.Category CategoryTheory.Limits variable {ι : Type*} variable (V : Type u) [Category.{v} V] [HasZeroMorphisms V] structure HomologicalComplex (c : ComplexShape ι) where X : ι → V d : ∀ i j, X i ⟶ X j shape : ∀ i j, ¬c.Rel i j → d i j = 0 := by aesop_cat d_comp_d' : ∀ i j k, c.Rel i j → c.Rel j k → d i j ≫ d j k = 0 := by aesop_cat #align homological_complex HomologicalComplex abbrev ChainComplex (α : Type*) [AddRightCancelSemigroup α] [One α] : Type _ := HomologicalComplex V (ComplexShape.down α) #align chain_complex ChainComplex abbrev CochainComplex (α : Type*) [AddRightCancelSemigroup α] [One α] : Type _ := HomologicalComplex V (ComplexShape.up α) #align cochain_complex CochainComplex namespace HomologicalComplex variable {V} variable {c : ComplexShape ι} (C : HomologicalComplex V c) @[ext] structure Hom (A B : HomologicalComplex V c) where f : ∀ i, A.X i ⟶ B.X i comm' : ∀ i j, c.Rel i j → f i ≫ B.d i j = A.d i j ≫ f j := by aesop_cat #align homological_complex.hom HomologicalComplex.Hom @[reassoc (attr := simp)] theorem Hom.comm {A B : HomologicalComplex V c} (f : A.Hom B) (i j : ι) : f.f i ≫ B.d i j = A.d i j ≫ f.f j := by by_cases hij : c.Rel i j · exact f.comm' i j hij · rw [A.shape i j hij, B.shape i j hij, comp_zero, zero_comp] #align homological_complex.hom.comm HomologicalComplex.Hom.comm instance (A B : HomologicalComplex V c) : Inhabited (Hom A B) := ⟨{ f := fun i => 0 }⟩ def id (A : HomologicalComplex V c) : Hom A A where f _ := 𝟙 _ #align homological_complex.id HomologicalComplex.id def comp (A B C : HomologicalComplex V c) (φ : Hom A B) (ψ : Hom B C) : Hom A C where f i := φ.f i ≫ ψ.f i #align homological_complex.comp HomologicalComplex.comp section attribute [local simp] id comp instance : Category (HomologicalComplex V c) where Hom := Hom id := id comp := comp _ _ _ end -- Porting note: added because `Hom.ext` is not triggered automatically @[ext] lemma hom_ext {C D : HomologicalComplex V c} (f g : C ⟶ D) (h : ∀ i, f.f i = g.f i) : f = g := by apply Hom.ext funext apply h @[simp] theorem id_f (C : HomologicalComplex V c) (i : ι) : Hom.f (𝟙 C) i = 𝟙 (C.X i) := rfl #align homological_complex.id_f HomologicalComplex.id_f @[simp, reassoc] theorem comp_f {C₁ C₂ C₃ : HomologicalComplex V c} (f : C₁ ⟶ C₂) (g : C₂ ⟶ C₃) (i : ι) : (f ≫ g).f i = f.f i ≫ g.f i := rfl #align homological_complex.comp_f HomologicalComplex.comp_f @[simp] theorem eqToHom_f {C₁ C₂ : HomologicalComplex V c} (h : C₁ = C₂) (n : ι) : HomologicalComplex.Hom.f (eqToHom h) n = eqToHom (congr_fun (congr_arg HomologicalComplex.X h) n) := by subst h rfl #align homological_complex.eq_to_hom_f HomologicalComplex.eqToHom_f -- We'll use this later to show that `HomologicalComplex V c` is preadditive when `V` is.
Mathlib/Algebra/Homology/HomologicalComplex.lean
294
295
theorem hom_f_injective {C₁ C₂ : HomologicalComplex V c} : Function.Injective fun f : Hom C₁ C₂ => f.f := by
aesop_cat
1
import Mathlib.Data.Fin.Tuple.Basic import Mathlib.Data.List.Join #align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" universe u variable {α : Type u} open Nat namespace List #noalign list.length_of_fn_aux @[simp] theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by induction i generalizing j <;> simp_all [ofFn.go] @[simp] theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by simp [ofFn, length_ofFn_go] #align list.length_of_fn List.length_ofFn #noalign list.nth_of_fn_aux theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) : get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by let i+1 := i cases k <;> simp [ofFn.go, get_ofFn_go (i := i)] congr 2; omega -- Porting note (#10756): new theorem @[simp]
Mathlib/Data/List/OfFn.lean
58
59
theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by
cases i; simp [ofFn, get_ofFn_go]
1
import Mathlib.Analysis.SpecialFunctions.Gamma.Beta import Mathlib.NumberTheory.LSeries.HurwitzZeta import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.Analysis.PSeriesComplex #align_import number_theory.zeta_function from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf" open MeasureTheory Set Filter Asymptotics TopologicalSpace Real Asymptotics Classical HurwitzZeta open Complex hiding exp norm_eq_abs abs_of_nonneg abs_two continuous_exp open scoped Topology Real Nat noncomputable section def completedRiemannZeta₀ (s : ℂ) : ℂ := completedHurwitzZetaEven₀ 0 s #align riemann_completed_zeta₀ completedRiemannZeta₀ def completedRiemannZeta (s : ℂ) : ℂ := completedHurwitzZetaEven 0 s #align riemann_completed_zeta completedRiemannZeta lemma HurwitzZeta.completedHurwitzZetaEven_zero (s : ℂ) : completedHurwitzZetaEven 0 s = completedRiemannZeta s := rfl lemma HurwitzZeta.completedHurwitzZetaEven₀_zero (s : ℂ) : completedHurwitzZetaEven₀ 0 s = completedRiemannZeta₀ s := rfl lemma HurwitzZeta.completedCosZeta_zero (s : ℂ) : completedCosZeta 0 s = completedRiemannZeta s := by rw [completedRiemannZeta, completedHurwitzZetaEven, completedCosZeta, hurwitzEvenFEPair_zero_symm] lemma HurwitzZeta.completedCosZeta₀_zero (s : ℂ) : completedCosZeta₀ 0 s = completedRiemannZeta₀ s := by rw [completedRiemannZeta₀, completedHurwitzZetaEven₀, completedCosZeta₀, hurwitzEvenFEPair_zero_symm] lemma completedRiemannZeta_eq (s : ℂ) : completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s) := by simp_rw [completedRiemannZeta, completedRiemannZeta₀, completedHurwitzZetaEven_eq, if_true] theorem differentiable_completedZeta₀ : Differentiable ℂ completedRiemannZeta₀ := differentiable_completedHurwitzZetaEven₀ 0 #align differentiable_completed_zeta₀ differentiable_completedZeta₀ theorem differentiableAt_completedZeta {s : ℂ} (hs : s ≠ 0) (hs' : s ≠ 1) : DifferentiableAt ℂ completedRiemannZeta s := differentiableAt_completedHurwitzZetaEven 0 (Or.inl hs) hs' theorem completedRiemannZeta₀_one_sub (s : ℂ) : completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s := by rw [← completedHurwitzZetaEven₀_zero, ← completedCosZeta₀_zero, completedHurwitzZetaEven₀_one_sub] #align riemann_completed_zeta₀_one_sub completedRiemannZeta₀_one_sub
Mathlib/NumberTheory/LSeries/RiemannZeta.lean
110
112
theorem completedRiemannZeta_one_sub (s : ℂ) : completedRiemannZeta (1 - s) = completedRiemannZeta s := by
rw [← completedHurwitzZetaEven_zero, ← completedCosZeta_zero, completedHurwitzZetaEven_one_sub]
1
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`
Mathlib/SetTheory/Ordinal/Exponential.lean
42
42
theorem zero_opow' (a : Ordinal) : 0 ^ a = 1 - a := by
simp only [opow_def, if_true]
1
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Group.Submonoid.Basic import Mathlib.Deprecated.Group #align_import deprecated.submonoid from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" variable {M : Type*} [Monoid M] {s : Set M} variable {A : Type*} [AddMonoid A] {t : Set A} structure IsAddSubmonoid (s : Set A) : Prop where zero_mem : (0 : A) ∈ s add_mem {a b} : a ∈ s → b ∈ s → a + b ∈ s #align is_add_submonoid IsAddSubmonoid @[to_additive] structure IsSubmonoid (s : Set M) : Prop where one_mem : (1 : M) ∈ s mul_mem {a b} : a ∈ s → b ∈ s → a * b ∈ s #align is_submonoid IsSubmonoid theorem Additive.isAddSubmonoid {s : Set M} : IsSubmonoid s → @IsAddSubmonoid (Additive M) _ s | ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩ #align additive.is_add_submonoid Additive.isAddSubmonoid theorem Additive.isAddSubmonoid_iff {s : Set M} : @IsAddSubmonoid (Additive M) _ s ↔ IsSubmonoid s := ⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Additive.isAddSubmonoid⟩ #align additive.is_add_submonoid_iff Additive.isAddSubmonoid_iff theorem Multiplicative.isSubmonoid {s : Set A} : IsAddSubmonoid s → @IsSubmonoid (Multiplicative A) _ s | ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩ #align multiplicative.is_submonoid Multiplicative.isSubmonoid theorem Multiplicative.isSubmonoid_iff {s : Set A} : @IsSubmonoid (Multiplicative A) _ s ↔ IsAddSubmonoid s := ⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Multiplicative.isSubmonoid⟩ #align multiplicative.is_submonoid_iff Multiplicative.isSubmonoid_iff @[to_additive "The intersection of two `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of M."] theorem IsSubmonoid.inter {s₁ s₂ : Set M} (is₁ : IsSubmonoid s₁) (is₂ : IsSubmonoid s₂) : IsSubmonoid (s₁ ∩ s₂) := { one_mem := ⟨is₁.one_mem, is₂.one_mem⟩ mul_mem := @fun _ _ hx hy => ⟨is₁.mul_mem hx.1 hy.1, is₂.mul_mem hx.2 hy.2⟩ } #align is_submonoid.inter IsSubmonoid.inter #align is_add_submonoid.inter IsAddSubmonoid.inter @[to_additive "The intersection of an indexed set of `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of `M`."] theorem IsSubmonoid.iInter {ι : Sort*} {s : ι → Set M} (h : ∀ y : ι, IsSubmonoid (s y)) : IsSubmonoid (Set.iInter s) := { one_mem := Set.mem_iInter.2 fun y => (h y).one_mem mul_mem := fun h₁ h₂ => Set.mem_iInter.2 fun y => (h y).mul_mem (Set.mem_iInter.1 h₁ y) (Set.mem_iInter.1 h₂ y) } #align is_submonoid.Inter IsSubmonoid.iInter #align is_add_submonoid.Inter IsAddSubmonoid.iInter @[to_additive "The union of an indexed, directed, nonempty set of `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of `M`. "] theorem isSubmonoid_iUnion_of_directed {ι : Type*} [hι : Nonempty ι] {s : ι → Set M} (hs : ∀ i, IsSubmonoid (s i)) (Directed : ∀ i j, ∃ k, s i ⊆ s k ∧ s j ⊆ s k) : IsSubmonoid (⋃ i, s i) := { one_mem := let ⟨i⟩ := hι Set.mem_iUnion.2 ⟨i, (hs i).one_mem⟩ mul_mem := fun ha hb => let ⟨i, hi⟩ := Set.mem_iUnion.1 ha let ⟨j, hj⟩ := Set.mem_iUnion.1 hb let ⟨k, hk⟩ := Directed i j Set.mem_iUnion.2 ⟨k, (hs k).mul_mem (hk.1 hi) (hk.2 hj)⟩ } #align is_submonoid_Union_of_directed isSubmonoid_iUnion_of_directed #align is_add_submonoid_Union_of_directed isAddSubmonoid_iUnion_of_directed @[to_additive "Create a bundled additive submonoid from a set `s` and `[IsAddSubmonoid s]`."] def Submonoid.of {s : Set M} (h : IsSubmonoid s) : Submonoid M := ⟨⟨s, @fun _ _ => h.2⟩, h.1⟩ #align submonoid.of Submonoid.of #align add_submonoid.of AddSubmonoid.of @[to_additive]
Mathlib/Deprecated/Submonoid.lean
426
427
theorem Submonoid.isSubmonoid (S : Submonoid M) : IsSubmonoid (S : Set M) := by
exact ⟨S.2, S.1.2⟩
1
import Mathlib.Algebra.FreeMonoid.Basic import Mathlib.Algebra.Group.Submonoid.MulOpposite import Mathlib.Algebra.Group.Submonoid.Operations import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Data.Finset.NoncommProd import Mathlib.Data.Int.Order.Lemmas #align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802" variable {M A B : Type*} section Assoc variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B} namespace Submonoid variable [Monoid M] {a : M} open MonoidHom theorem closure_singleton_eq (x : M) : closure ({x} : Set M) = mrange (powersHom M x) := closure_eq_of_le (Set.singleton_subset_iff.2 ⟨Multiplicative.ofAdd 1, pow_one x⟩) fun _ ⟨_, hn⟩ => hn ▸ pow_mem (subset_closure <| Set.mem_singleton _) _ #align submonoid.closure_singleton_eq Submonoid.closure_singleton_eq theorem mem_closure_singleton {x y : M} : y ∈ closure ({x} : Set M) ↔ ∃ n : ℕ, x ^ n = y := by rw [closure_singleton_eq, mem_mrange]; rfl #align submonoid.mem_closure_singleton Submonoid.mem_closure_singleton theorem mem_closure_singleton_self {y : M} : y ∈ closure ({y} : Set M) := mem_closure_singleton.2 ⟨1, pow_one y⟩ #align submonoid.mem_closure_singleton_self Submonoid.mem_closure_singleton_self
Mathlib/Algebra/Group/Submonoid/Membership.lean
340
341
theorem closure_singleton_one : closure ({1} : Set M) = ⊥ := by
simp [eq_bot_iff_forall, mem_closure_singleton]
1
import Batteries.Tactic.Lint.Basic import Mathlib.Algebra.Order.Monoid.Unbundled.Basic import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Order import Mathlib.Init.Data.Int.Order set_option autoImplicit true namespace Linarith theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by simp [*] theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by simp [*]
Mathlib/Tactic/Linarith/Lemmas.lean
33
34
theorem lt_of_eq_of_lt {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b < 0) : a + b < 0 := by
simp [*]
1
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)]
Mathlib/LinearAlgebra/AffineSpace/Combination.lean
79
81
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]
1
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd" namespace Polynomial open Polynomial Finsupp Finset open Polynomial section Semiring variable {R : Type*} [Semiring R] {f : R[X]} def revAtFun (N i : ℕ) : ℕ := ite (i ≤ N) (N - i) i #align polynomial.rev_at_fun Polynomial.revAtFun theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by unfold revAtFun split_ifs with h j · exact tsub_tsub_cancel_of_le h · exfalso apply j exact Nat.sub_le N i · rfl #align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by intro a b hab rw [← @revAtFun_invol N a, hab, revAtFun_invol] #align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj def revAt (N : ℕ) : Function.Embedding ℕ ℕ where toFun i := ite (i ≤ N) (N - i) i inj' := revAtFun_inj #align polynomial.rev_at Polynomial.revAt @[simp] theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i := rfl #align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq @[simp] theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i := revAtFun_invol #align polynomial.rev_at_invol Polynomial.revAt_invol @[simp] theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i := if_pos H #align polynomial.rev_at_le Polynomial.revAt_le lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h] theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) : revAt (N + O) (n + o) = revAt N n + revAt O o := by rcases Nat.le.dest hn with ⟨n', rfl⟩ rcases Nat.le.dest ho with ⟨o', rfl⟩ repeat' rw [revAt_le (le_add_right rfl.le)] rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)] repeat' rw [add_tsub_cancel_left] #align polynomial.rev_at_add Polynomial.revAt_add -- @[simp] -- Porting note (#10618): simp can prove this theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp #align polynomial.rev_at_zero Polynomial.revAt_zero noncomputable def reflect (N : ℕ) : R[X] → R[X] | ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩ #align polynomial.reflect Polynomial.reflect theorem reflect_support (N : ℕ) (f : R[X]) : (reflect N f).support = Finset.image (revAt N) f.support := by rcases f with ⟨⟩ ext1 simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image] #align polynomial.reflect_support Polynomial.reflect_support @[simp] theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by rcases f with ⟨f⟩ simp only [reflect, coeff] calc Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by rw [revAt_invol] _ = f (revAt N i) := Finsupp.embDomain_apply _ _ _ #align polynomial.coeff_reflect Polynomial.coeff_reflect @[simp] theorem reflect_zero {N : ℕ} : reflect N (0 : R[X]) = 0 := rfl #align polynomial.reflect_zero Polynomial.reflect_zero @[simp] theorem reflect_eq_zero_iff {N : ℕ} {f : R[X]} : reflect N (f : R[X]) = 0 ↔ f = 0 := by rw [ofFinsupp_eq_zero, reflect, embDomain_eq_zero, ofFinsupp_eq_zero] #align polynomial.reflect_eq_zero_iff Polynomial.reflect_eq_zero_iff @[simp] theorem reflect_add (f g : R[X]) (N : ℕ) : reflect N (f + g) = reflect N f + reflect N g := by ext simp only [coeff_add, coeff_reflect] #align polynomial.reflect_add Polynomial.reflect_add @[simp] theorem reflect_C_mul (f : R[X]) (r : R) (N : ℕ) : reflect N (C r * f) = C r * reflect N f := by ext simp only [coeff_reflect, coeff_C_mul] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul Polynomial.reflect_C_mul -- @[simp] -- Porting note (#10618): simp can prove this (once `reflect_monomial` is in simp scope) theorem reflect_C_mul_X_pow (N n : ℕ) {c : R} : reflect N (C c * X ^ n) = C c * X ^ revAt N n := by ext rw [reflect_C_mul, coeff_C_mul, coeff_C_mul, coeff_X_pow, coeff_reflect] split_ifs with h · rw [h, revAt_invol, coeff_X_pow_self] · rw [not_mem_support_iff.mp] intro a rw [← one_mul (X ^ n), ← C_1] at a apply h rw [← mem_support_C_mul_X_pow a, revAt_invol] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul_X_pow Polynomial.reflect_C_mul_X_pow @[simp]
Mathlib/Algebra/Polynomial/Reverse.lean
160
161
theorem reflect_C (r : R) (N : ℕ) : reflect N (C r) = C r * X ^ N := by
conv_lhs => rw [← mul_one (C r), ← pow_zero X, reflect_C_mul_X_pow, revAt_zero]
1
import Mathlib.Data.Set.Image #align_import data.nat.set from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9" namespace Nat section Set open Set theorem zero_union_range_succ : {0} ∪ range succ = univ := by ext n cases n <;> simp #align nat.zero_union_range_succ Nat.zero_union_range_succ @[simp] protected theorem range_succ : range succ = { i | 0 < i } := by ext (_ | i) <;> simp [succ_pos, succ_ne_zero, Set.mem_setOf] #align nat.range_succ Nat.range_succ variable {α : Type*}
Mathlib/Data/Nat/Set.lean
33
34
theorem range_of_succ (f : ℕ → α) : {f 0} ∪ range (f ∘ succ) = range f := by
rw [← image_singleton, range_comp, ← image_union, zero_union_range_succ, image_univ]
1
import Mathlib.Algebra.Field.Rat import Mathlib.Algebra.Group.Commute.Basic import Mathlib.Algebra.GroupWithZero.Units.Lemmas import Mathlib.Algebra.Order.Field.Rat import Mathlib.Data.Int.Cast.Lemmas import Mathlib.Data.Rat.Lemmas #align_import data.rat.cast from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441" variable {F ι α β : Type*} open Rat variable [FunLike F α β] @[simp] lemma map_nnratCast [DivisionSemiring α] [DivisionSemiring β] [RingHomClass F α β] (f : F) (q : ℚ≥0) : f q = q := by simp_rw [NNRat.cast_def, map_div₀, map_natCast] @[simp] lemma eq_nnratCast [DivisionSemiring α] [FunLike F ℚ≥0 α] [RingHomClass F ℚ≥0 α] (f : F) (q : ℚ≥0) : f q = q := by rw [← map_nnratCast f, NNRat.cast_id] @[simp]
Mathlib/Data/Rat/Cast/Defs.lean
237
238
theorem map_ratCast [DivisionRing α] [DivisionRing β] [RingHomClass F α β] (f : F) (q : ℚ) : f q = q := by
rw [cast_def, map_div₀, map_intCast, map_natCast, cast_def]
1
import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.AbsoluteValue import Mathlib.Data.Int.Cast.Lemmas import Mathlib.GroupTheory.GroupAction.Units #align_import data.int.absolute_value from "leanprover-community/mathlib"@"9aba7801eeecebb61f58a5763c2b6dd1b47dc6ef" variable {R S : Type*} [Ring R] [LinearOrderedCommRing S] @[simp] theorem AbsoluteValue.map_units_int (abv : AbsoluteValue ℤ S) (x : ℤˣ) : abv x = 1 := by rcases Int.units_eq_one_or x with (rfl | rfl) <;> simp #align absolute_value.map_units_int AbsoluteValue.map_units_int @[simp]
Mathlib/Data/Int/AbsoluteValue.lean
33
34
theorem AbsoluteValue.map_units_intCast [Nontrivial R] (abv : AbsoluteValue R S) (x : ℤˣ) : abv ((x : ℤ) : R) = 1 := by
rcases Int.units_eq_one_or x with (rfl | rfl) <;> simp
1
import Mathlib.LinearAlgebra.Dimension.Free import Mathlib.LinearAlgebra.Dimension.Finite import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition open FiniteDimensional namespace Subalgebra variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] (A B : Subalgebra R S) [Module.Free R A] [Module.Free R B] [Module.Free A (Algebra.adjoin A (B : Set S))] [Module.Free B (Algebra.adjoin B (A : Set S))] theorem rank_sup_eq_rank_left_mul_rank_of_free : Module.rank R ↥(A ⊔ B) = Module.rank R A * Module.rank A (Algebra.adjoin A (B : Set S)) := by rcases subsingleton_or_nontrivial R with _ | _ · haveI := Module.subsingleton R S; simp nontriviality S using rank_subsingleton' letI : Algebra A (Algebra.adjoin A (B : Set S)) := Subalgebra.algebra _ letI : SMul A (Algebra.adjoin A (B : Set S)) := Algebra.toSMul haveI : IsScalarTower R A (Algebra.adjoin A (B : Set S)) := IsScalarTower.of_algebraMap_eq (congrFun rfl) rw [rank_mul_rank R A (Algebra.adjoin A (B : Set S))] change _ = Module.rank R ((Algebra.adjoin A (B : Set S)).restrictScalars R) rw [Algebra.restrictScalars_adjoin]; rfl
Mathlib/Algebra/Algebra/Subalgebra/Rank.lean
43
45
theorem rank_sup_eq_rank_right_mul_rank_of_free : Module.rank R ↥(A ⊔ B) = Module.rank R B * Module.rank B (Algebra.adjoin B (A : Set S)) := by
rw [sup_comm, rank_sup_eq_rank_left_mul_rank_of_free]
1
import Mathlib.Data.Int.Interval import Mathlib.Data.Int.ModEq import Mathlib.Data.Nat.Count import Mathlib.Data.Rat.Floor import Mathlib.Order.Interval.Finset.Nat open Finset Int namespace Int variable (a b : ℤ) {r : ℤ} (hr : 0 < r) lemma Ico_filter_dvd_eq : (Ico a b).filter (r ∣ ·) = (Ico ⌈a / (r : ℚ)⌉ ⌈b / (r : ℚ)⌉).map ⟨(· * r), mul_left_injective₀ hr.ne'⟩ := by ext x simp only [mem_map, mem_filter, mem_Ico, ceil_le, lt_ceil, div_le_iff, lt_div_iff, dvd_iff_exists_eq_mul_left, cast_pos.2 hr, ← cast_mul, cast_lt, cast_le] aesop lemma Ioc_filter_dvd_eq : (Ioc a b).filter (r ∣ ·) = (Ioc ⌊a / (r : ℚ)⌋ ⌊b / (r : ℚ)⌋).map ⟨(· * r), mul_left_injective₀ hr.ne'⟩ := by ext x simp only [mem_map, mem_filter, mem_Ioc, floor_lt, le_floor, div_lt_iff, le_div_iff, dvd_iff_exists_eq_mul_left, cast_pos.2 hr, ← cast_mul, cast_lt, cast_le] aesop theorem Ico_filter_dvd_card : ((Ico a b).filter (r ∣ ·)).card = max (⌈b / (r : ℚ)⌉ - ⌈a / (r : ℚ)⌉) 0 := by rw [Ico_filter_dvd_eq _ _ hr, card_map, card_Ico, toNat_eq_max] theorem Ioc_filter_dvd_card : ((Ioc a b).filter (r ∣ ·)).card = max (⌊b / (r : ℚ)⌋ - ⌊a / (r : ℚ)⌋) 0 := by rw [Ioc_filter_dvd_eq _ _ hr, card_map, card_Ioc, toNat_eq_max] lemma Ico_filter_modEq_eq (v : ℤ) : (Ico a b).filter (· ≡ v [ZMOD r]) = ((Ico (a - v) (b - v)).filter (r ∣ ·)).map ⟨(· + v), add_left_injective v⟩ := by ext x simp_rw [mem_map, mem_filter, mem_Ico, Function.Embedding.coeFn_mk, ← eq_sub_iff_add_eq, exists_eq_right, modEq_comm, modEq_iff_dvd, sub_lt_sub_iff_right, sub_le_sub_iff_right] lemma Ioc_filter_modEq_eq (v : ℤ) : (Ioc a b).filter (· ≡ v [ZMOD r]) = ((Ioc (a - v) (b - v)).filter (r ∣ ·)).map ⟨(· + v), add_left_injective v⟩ := by ext x simp_rw [mem_map, mem_filter, mem_Ioc, Function.Embedding.coeFn_mk, ← eq_sub_iff_add_eq, exists_eq_right, modEq_comm, modEq_iff_dvd, sub_lt_sub_iff_right, sub_le_sub_iff_right]
Mathlib/Data/Int/CardIntervalMod.lean
65
67
theorem Ico_filter_modEq_card (v : ℤ) : ((Ico a b).filter (· ≡ v [ZMOD r])).card = max (⌈(b - v) / (r : ℚ)⌉ - ⌈(a - v) / (r : ℚ)⌉) 0 := by
simp [Ico_filter_modEq_eq, Ico_filter_dvd_eq, toNat_eq_max, hr]
1
import Mathlib.Data.Matrix.Basic import Mathlib.LinearAlgebra.Matrix.Trace #align_import data.matrix.basis from "leanprover-community/mathlib"@"320df450e9abeb5fc6417971e75acb6ae8bc3794" variable {l m n : Type*} variable {R α : Type*} namespace Matrix open Matrix variable [DecidableEq l] [DecidableEq m] [DecidableEq n] variable [Semiring α] def stdBasisMatrix (i : m) (j : n) (a : α) : Matrix m n α := fun i' j' => if i = i' ∧ j = j' then a else 0 #align matrix.std_basis_matrix Matrix.stdBasisMatrix @[simp] theorem smul_stdBasisMatrix [SMulZeroClass R α] (r : R) (i : m) (j : n) (a : α) : r • stdBasisMatrix i j a = stdBasisMatrix i j (r • a) := by unfold stdBasisMatrix ext simp [smul_ite] #align matrix.smul_std_basis_matrix Matrix.smul_stdBasisMatrix @[simp] theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by unfold stdBasisMatrix ext simp #align matrix.std_basis_matrix_zero Matrix.stdBasisMatrix_zero theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) : stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by unfold stdBasisMatrix; ext split_ifs with h <;> simp [h] #align matrix.std_basis_matrix_add Matrix.stdBasisMatrix_add theorem mulVec_stdBasisMatrix [Fintype m] (i : n) (j : m) (c : α) (x : m → α) : mulVec (stdBasisMatrix i j c) x = Function.update (0 : n → α) i (c * x j) := by ext i' simp [stdBasisMatrix, mulVec, dotProduct] rcases eq_or_ne i i' with rfl|h · simp simp [h, h.symm] theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) : x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by ext i j; symm iterate 2 rw [Finset.sum_apply] -- Porting note: was `convert` refine (Fintype.sum_eq_single i ?_).trans ?_; swap · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply` simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix] rw [Fintype.sum_apply, Fintype.sum_apply] simp · intro j' hj' -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply` simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix] rw [Fintype.sum_apply, Fintype.sum_apply] simp [hj'] #align matrix.matrix_eq_sum_std_basis Matrix.matrix_eq_sum_std_basis -- TODO: tie this up with the `Basis` machinery of linear algebra -- this is not completely trivial because we are indexing by two types, instead of one -- TODO: add `std_basis_vec` theorem std_basis_eq_basis_mul_basis (i : m) (j : n) : stdBasisMatrix i j (1 : α) = vecMulVec (fun i' => ite (i = i') 1 0) fun j' => ite (j = j') 1 0 := by ext i' j' -- Porting note: was `norm_num [std_basis_matrix, vec_mul_vec]` though there are no numerals -- involved. simp only [stdBasisMatrix, vecMulVec, mul_ite, mul_one, mul_zero, of_apply] -- Porting note: added next line simp_rw [@and_comm (i = i')] exact ite_and _ _ _ _ #align matrix.std_basis_eq_basis_mul_basis Matrix.std_basis_eq_basis_mul_basis -- todo: the old proof used fintypes, I don't know `Finsupp` but this feels generalizable @[elab_as_elim] protected theorem induction_on' [Finite m] [Finite n] {P : Matrix m n α → Prop} (M : Matrix m n α) (h_zero : P 0) (h_add : ∀ p q, P p → P q → P (p + q)) (h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)) : P M := by cases nonempty_fintype m; cases nonempty_fintype n rw [matrix_eq_sum_std_basis M, ← Finset.sum_product'] apply Finset.sum_induction _ _ h_add h_zero · intros apply h_std_basis #align matrix.induction_on' Matrix.induction_on' @[elab_as_elim] protected theorem induction_on [Finite m] [Finite n] [Nonempty m] [Nonempty n] {P : Matrix m n α → Prop} (M : Matrix m n α) (h_add : ∀ p q, P p → P q → P (p + q)) (h_std_basis : ∀ i j x, P (stdBasisMatrix i j x)) : P M := Matrix.induction_on' M (by inhabit m inhabit n simpa using h_std_basis default default 0) h_add h_std_basis #align matrix.induction_on Matrix.induction_on namespace StdBasisMatrix section variable (i : m) (j : n) (c : α) (i' : m) (j' : n) @[simp] theorem apply_same : stdBasisMatrix i j c i j = c := if_pos (And.intro rfl rfl) #align matrix.std_basis_matrix.apply_same Matrix.StdBasisMatrix.apply_same @[simp] theorem apply_of_ne (h : ¬(i = i' ∧ j = j')) : stdBasisMatrix i j c i' j' = 0 := by simp only [stdBasisMatrix, and_imp, ite_eq_right_iff] tauto #align matrix.std_basis_matrix.apply_of_ne Matrix.StdBasisMatrix.apply_of_ne @[simp] theorem apply_of_row_ne {i i' : m} (hi : i ≠ i') (j j' : n) (a : α) : stdBasisMatrix i j a i' j' = 0 := by simp [hi] #align matrix.std_basis_matrix.apply_of_row_ne Matrix.StdBasisMatrix.apply_of_row_ne @[simp]
Mathlib/Data/Matrix/Basis.lean
144
145
theorem apply_of_col_ne (i i' : m) {j j' : n} (hj : j ≠ j') (a : α) : stdBasisMatrix i j a i' j' = 0 := by
simp [hj]
1
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : ℕ) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≤ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≤ n := tsub_eq_zero_iff_le.mp this le_antisymm ‹n ≤ m› ‹m ≤ n› #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero
Mathlib/Data/Nat/Dist.lean
45
46
theorem dist_eq_sub_of_le {n m : ℕ} (h : n ≤ m) : dist n m = m - n := by
rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add]
1
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by simpa only [not_iff_not] using dist_eq_zero #align dist_ne_zero dist_ne_zero @[simp]
Mathlib/Topology/MetricSpace/Basic.lean
82
83
theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y := by
simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y
1
import Mathlib.Order.ConditionallyCompleteLattice.Basic import Mathlib.Order.RelIso.Basic #align_import order.ord_continuous from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {ι : Sort x} open Function OrderDual Set def LeftOrdContinuous [Preorder α] [Preorder β] (f : α → β) := ∀ ⦃s : Set α⦄ ⦃x⦄, IsLUB s x → IsLUB (f '' s) (f x) #align left_ord_continuous LeftOrdContinuous def RightOrdContinuous [Preorder α] [Preorder β] (f : α → β) := ∀ ⦃s : Set α⦄ ⦃x⦄, IsGLB s x → IsGLB (f '' s) (f x) #align right_ord_continuous RightOrdContinuous namespace LeftOrdContinuous section SemilatticeSup variable [SemilatticeSup α] [SemilatticeSup β] {f : α → β} theorem map_sup (hf : LeftOrdContinuous f) (x y : α) : f (x ⊔ y) = f x ⊔ f y := (hf isLUB_pair).unique <| by simp only [image_pair, isLUB_pair] #align left_ord_continuous.map_sup LeftOrdContinuous.map_sup theorem le_iff (hf : LeftOrdContinuous f) (h : Injective f) {x y} : f x ≤ f y ↔ x ≤ y := by simp only [← sup_eq_right, ← hf.map_sup, h.eq_iff] #align left_ord_continuous.le_iff LeftOrdContinuous.le_iff
Mathlib/Order/OrdContinuous.lean
102
103
theorem lt_iff (hf : LeftOrdContinuous f) (h : Injective f) {x y} : f x < f y ↔ x < y := by
simp only [lt_iff_le_not_le, hf.le_iff h]
1
import Mathlib.Data.Set.Prod import Mathlib.Logic.Function.Conjugate #align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207" variable {α β γ : Type*} {ι : Sort*} {π : α → Type*} open Equiv Equiv.Perm Function namespace Set section equality variable {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {p : Set γ} {f f₁ f₂ f₃ : α → β} {g g₁ g₂ : β → γ} {f' f₁' f₂' : β → α} {g' : γ → β} {a : α} {b : β} @[simp] theorem eqOn_empty (f₁ f₂ : α → β) : EqOn f₁ f₂ ∅ := fun _ => False.elim #align set.eq_on_empty Set.eqOn_empty @[simp]
Mathlib/Data/Set/Function.lean
185
186
theorem eqOn_singleton : Set.EqOn f₁ f₂ {a} ↔ f₁ a = f₂ a := by
simp [Set.EqOn]
1
import Batteries.Data.List.Basic import Batteries.Data.List.Lemmas open Nat namespace List section countP variable (p q : α → Bool) @[simp] theorem countP_nil : countP p [] = 0 := rfl protected theorem countP_go_eq_add (l) : countP.go p l n = n + countP.go p l 0 := by induction l generalizing n with | nil => rfl | cons head tail ih => unfold countP.go rw [ih (n := n + 1), ih (n := n), ih (n := 1)] if h : p head then simp [h, Nat.add_assoc] else simp [h] @[simp] theorem countP_cons_of_pos (l) (pa : p a) : countP p (a :: l) = countP p l + 1 := by have : countP.go p (a :: l) 0 = countP.go p l 1 := show cond .. = _ by rw [pa]; rfl unfold countP rw [this, Nat.add_comm, List.countP_go_eq_add] @[simp] theorem countP_cons_of_neg (l) (pa : ¬p a) : countP p (a :: l) = countP p l := by simp [countP, countP.go, pa] theorem countP_cons (a : α) (l) : countP p (a :: l) = countP p l + if p a then 1 else 0 := by by_cases h : p a <;> simp [h] theorem length_eq_countP_add_countP (l) : length l = countP p l + countP (fun a => ¬p a) l := by induction l with | nil => rfl | cons x h ih => if h : p x then rw [countP_cons_of_pos _ _ h, countP_cons_of_neg _ _ _, length, ih] · rw [Nat.add_assoc, Nat.add_comm _ 1, Nat.add_assoc] · simp only [h, not_true_eq_false, decide_False, not_false_eq_true] else rw [countP_cons_of_pos (fun a => ¬p a) _ _, countP_cons_of_neg _ _ h, length, ih] · rfl · simp only [h, not_false_eq_true, decide_True] theorem countP_eq_length_filter (l) : countP p l = length (filter p l) := by induction l with | nil => rfl | cons x l ih => if h : p x then rw [countP_cons_of_pos p l h, ih, filter_cons_of_pos l h, length] else rw [countP_cons_of_neg p l h, ih, filter_cons_of_neg l h] theorem countP_le_length : countP p l ≤ l.length := by simp only [countP_eq_length_filter] apply length_filter_le @[simp] theorem countP_append (l₁ l₂) : countP p (l₁ ++ l₂) = countP p l₁ + countP p l₂ := by simp only [countP_eq_length_filter, filter_append, length_append] theorem countP_pos : 0 < countP p l ↔ ∃ a ∈ l, p a := by simp only [countP_eq_length_filter, length_pos_iff_exists_mem, mem_filter, exists_prop] theorem countP_eq_zero : countP p l = 0 ↔ ∀ a ∈ l, ¬p a := by simp only [countP_eq_length_filter, length_eq_zero, filter_eq_nil] theorem countP_eq_length : countP p l = l.length ↔ ∀ a ∈ l, p a := by rw [countP_eq_length_filter, filter_length_eq_length] theorem Sublist.countP_le (s : l₁ <+ l₂) : countP p l₁ ≤ countP p l₂ := by simp only [countP_eq_length_filter] apply s.filter _ |>.length_le
.lake/packages/batteries/Batteries/Data/List/Count.lean
88
90
theorem countP_filter (l : List α) : countP p (filter q l) = countP (fun a => p a ∧ q a) l := by
simp only [countP_eq_length_filter, filter_filter]
1
import Mathlib.RingTheory.Localization.LocalizationLocalization #align_import ring_theory.localization.as_subring from "leanprover-community/mathlib"@"649ca66bf4d62796b5eefef966e622d91aa471f3" namespace Localization open nonZeroDivisors variable {A : Type*} (K : Type*) [CommRing A] (S : Submonoid A) (hS : S ≤ A⁰) section CommRing variable [CommRing K] [Algebra A K] [IsFractionRing A K]
Mathlib/RingTheory/Localization/AsSubring.lean
31
32
theorem map_isUnit_of_le (hS : S ≤ A⁰) (s : S) : IsUnit (algebraMap A K s) := by
apply IsLocalization.map_units K (⟨s.1, hS s.2⟩ : A⁰)
1
import Mathlib.Algebra.Group.ConjFinite import Mathlib.GroupTheory.Perm.Fin import Mathlib.GroupTheory.Subgroup.Simple import Mathlib.Tactic.IntervalCases #align_import group_theory.specific_groups.alternating from "leanprover-community/mathlib"@"0f6670b8af2dff699de1c0b4b49039b31bc13c46" -- An example on how to determine the order of an element of a finite group. example : orderOf (-1 : ℤˣ) = 2 := orderOf_eq_prime (Int.units_sq _) (by decide) open Equiv Equiv.Perm Subgroup Fintype variable (α : Type*) [Fintype α] [DecidableEq α] def alternatingGroup : Subgroup (Perm α) := sign.ker #align alternating_group alternatingGroup -- Porting note (#10754): manually added instance instance fta : Fintype (alternatingGroup α) := @Subtype.fintype _ _ sign.decidableMemKer _ instance [Subsingleton α] : Unique (alternatingGroup α) := ⟨⟨1⟩, fun ⟨p, _⟩ => Subtype.eq (Subsingleton.elim p _)⟩ variable {α} theorem alternatingGroup_eq_sign_ker : alternatingGroup α = sign.ker := rfl #align alternating_group_eq_sign_ker alternatingGroup_eq_sign_ker namespace Equiv.Perm @[simp] theorem mem_alternatingGroup {f : Perm α} : f ∈ alternatingGroup α ↔ sign f = 1 := sign.mem_ker #align equiv.perm.mem_alternating_group Equiv.Perm.mem_alternatingGroup theorem prod_list_swap_mem_alternatingGroup_iff_even_length {l : List (Perm α)} (hl : ∀ g ∈ l, IsSwap g) : l.prod ∈ alternatingGroup α ↔ Even l.length := by rw [mem_alternatingGroup, sign_prod_list_swap hl, neg_one_pow_eq_one_iff_even] decide #align equiv.perm.prod_list_swap_mem_alternating_group_iff_even_length Equiv.Perm.prod_list_swap_mem_alternatingGroup_iff_even_length theorem IsThreeCycle.mem_alternatingGroup {f : Perm α} (h : IsThreeCycle f) : f ∈ alternatingGroup α := mem_alternatingGroup.mpr h.sign #align equiv.perm.is_three_cycle.mem_alternating_group Equiv.Perm.IsThreeCycle.mem_alternatingGroup set_option linter.deprecated false in
Mathlib/GroupTheory/SpecificGroups/Alternating.lean
89
91
theorem finRotate_bit1_mem_alternatingGroup {n : ℕ} : finRotate (bit1 n) ∈ alternatingGroup (Fin (bit1 n)) := by
rw [mem_alternatingGroup, bit1, sign_finRotate, pow_bit0', Int.units_mul_self, one_pow]
1
import Mathlib.Algebra.BigOperators.Group.Multiset import Mathlib.Data.Multiset.Dedup #align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" assert_not_exists MonoidWithZero assert_not_exists MulAction universe v variable {α : Type*} {β : Type v} {γ δ : Type*} namespace Multiset def join : Multiset (Multiset α) → Multiset α := sum #align multiset.join Multiset.join theorem coe_join : ∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join | [] => rfl | l :: L => by exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L) #align multiset.coe_join Multiset.coe_join @[simp] theorem join_zero : @join α 0 = 0 := rfl #align multiset.join_zero Multiset.join_zero @[simp] theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S := sum_cons _ _ #align multiset.join_cons Multiset.join_cons @[simp] theorem join_add (S T) : @join α (S + T) = join S + join T := sum_add _ _ #align multiset.join_add Multiset.join_add @[simp] theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a := sum_singleton _ #align multiset.singleton_join Multiset.singleton_join @[simp] theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s := Multiset.induction_on S (by simp) <| by simp (config := { contextual := true }) [or_and_right, exists_or] #align multiset.mem_join Multiset.mem_join @[simp] theorem card_join (S) : card (@join α S) = sum (map card S) := Multiset.induction_on S (by simp) (by simp) #align multiset.card_join Multiset.card_join @[simp] theorem map_join (f : α → β) (S : Multiset (Multiset α)) : map f (join S) = join (map (map f) S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] @[to_additive (attr := simp)] theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} : prod (join S) = prod (map prod S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] theorem rel_join {r : α → β → Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by induction h with | zero => simp | cons hab hst ih => simpa using hab.add ih #align multiset.rel_join Multiset.rel_join section Bind variable (a : α) (s t : Multiset α) (f g : α → Multiset β) def bind (s : Multiset α) (f : α → Multiset β) : Multiset β := (s.map f).join #align multiset.bind Multiset.bind @[simp] theorem coe_bind (l : List α) (f : α → List β) : (@bind α β l fun a => f a) = l.bind f := by rw [List.bind, ← coe_join, List.map_map] rfl #align multiset.coe_bind Multiset.coe_bind @[simp] theorem zero_bind : bind 0 f = 0 := rfl #align multiset.zero_bind Multiset.zero_bind @[simp] theorem cons_bind : (a ::ₘ s).bind f = f a + s.bind f := by simp [bind] #align multiset.cons_bind Multiset.cons_bind @[simp] theorem singleton_bind : bind {a} f = f a := by simp [bind] #align multiset.singleton_bind Multiset.singleton_bind @[simp] theorem add_bind : (s + t).bind f = s.bind f + t.bind f := by simp [bind] #align multiset.add_bind Multiset.add_bind @[simp] theorem bind_zero : s.bind (fun _ => 0 : α → Multiset β) = 0 := by simp [bind, join, nsmul_zero] #align multiset.bind_zero Multiset.bind_zero @[simp] theorem bind_add : (s.bind fun a => f a + g a) = s.bind f + s.bind g := by simp [bind, join] #align multiset.bind_add Multiset.bind_add @[simp] theorem bind_cons (f : α → β) (g : α → Multiset β) : (s.bind fun a => f a ::ₘ g a) = map f s + s.bind g := Multiset.induction_on s (by simp) (by simp (config := { contextual := true }) [add_comm, add_left_comm, add_assoc]) #align multiset.bind_cons Multiset.bind_cons @[simp] theorem bind_singleton (f : α → β) : (s.bind fun x => ({f x} : Multiset β)) = map f s := Multiset.induction_on s (by rw [zero_bind, map_zero]) (by simp [singleton_add]) #align multiset.bind_singleton Multiset.bind_singleton @[simp] theorem mem_bind {b s} {f : α → Multiset β} : b ∈ bind s f ↔ ∃ a ∈ s, b ∈ f a := by simp [bind] #align multiset.mem_bind Multiset.mem_bind @[simp] theorem card_bind : card (s.bind f) = (s.map (card ∘ f)).sum := by simp [bind] #align multiset.card_bind Multiset.card_bind
Mathlib/Data/Multiset/Bind.lean
166
167
theorem bind_congr {f g : α → Multiset β} {m : Multiset α} : (∀ a ∈ m, f a = g a) → bind m f = bind m g := by
simp (config := { contextual := true }) [bind]
1
import Mathlib.Algebra.Algebra.Hom import Mathlib.RingTheory.Ideal.Quotient #align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72" universe uR uS uT uA u₄ variable {R : Type uR} [Semiring R] variable {S : Type uS} [CommSemiring S] variable {T : Type uT} variable {A : Type uA} [Semiring A] [Algebra S A] namespace RingQuot inductive Rel (r : R → R → Prop) : R → R → Prop | of ⦃x y : R⦄ (h : r x y) : Rel r x y | add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c) | mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c) | mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c) #align ring_quot.rel RingQuot.Rel theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by rw [add_comm a b, add_comm a c] exact Rel.add_left h #align ring_quot.rel.add_right RingQuot.Rel.add_right theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) : Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h] #align ring_quot.rel.neg RingQuot.Rel.neg theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) : Rel r (a - c) (b - c) := by simp only [sub_eq_add_neg, h.add_left] #align ring_quot.rel.sub_left RingQuot.Rel.sub_left
Mathlib/Algebra/RingQuot.lean
75
76
theorem Rel.sub_right {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a - b) (a - c) := by
simp only [sub_eq_add_neg, h.neg.add_right]
1
import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import topology.metric_space.pi_nat from "leanprover-community/mathlib"@"49b7f94aab3a3bdca1f9f34c5d818afb253b3993" noncomputable section open scoped Classical open Topology Filter open TopologicalSpace Set Metric Filter Function attribute [local simp] pow_le_pow_iff_right one_lt_two inv_le_inv zero_le_two zero_lt_two variable {E : ℕ → Type*} namespace PiNat irreducible_def firstDiff (x y : ∀ n, E n) : ℕ := if h : x ≠ y then Nat.find (ne_iff.1 h) else 0 #align pi_nat.first_diff PiNat.firstDiff theorem apply_firstDiff_ne {x y : ∀ n, E n} (h : x ≠ y) : x (firstDiff x y) ≠ y (firstDiff x y) := by rw [firstDiff_def, dif_pos h] exact Nat.find_spec (ne_iff.1 h) #align pi_nat.apply_first_diff_ne PiNat.apply_firstDiff_ne theorem apply_eq_of_lt_firstDiff {x y : ∀ n, E n} {n : ℕ} (hn : n < firstDiff x y) : x n = y n := by rw [firstDiff_def] at hn split_ifs at hn with h · convert Nat.find_min (ne_iff.1 h) hn simp · exact (not_lt_zero' hn).elim #align pi_nat.apply_eq_of_lt_first_diff PiNat.apply_eq_of_lt_firstDiff theorem firstDiff_comm (x y : ∀ n, E n) : firstDiff x y = firstDiff y x := by simp only [firstDiff_def, ne_comm] #align pi_nat.first_diff_comm PiNat.firstDiff_comm theorem min_firstDiff_le (x y z : ∀ n, E n) (h : x ≠ z) : min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z := by by_contra! H rw [lt_min_iff] at H refine apply_firstDiff_ne h ?_ calc x (firstDiff x z) = y (firstDiff x z) := apply_eq_of_lt_firstDiff H.1 _ = z (firstDiff x z) := apply_eq_of_lt_firstDiff H.2 #align pi_nat.min_first_diff_le PiNat.min_firstDiff_le def cylinder (x : ∀ n, E n) (n : ℕ) : Set (∀ n, E n) := { y | ∀ i, i < n → y i = x i } #align pi_nat.cylinder PiNat.cylinder theorem cylinder_eq_pi (x : ∀ n, E n) (n : ℕ) : cylinder x n = Set.pi (Finset.range n : Set ℕ) fun i : ℕ => {x i} := by ext y simp [cylinder] #align pi_nat.cylinder_eq_pi PiNat.cylinder_eq_pi @[simp] theorem cylinder_zero (x : ∀ n, E n) : cylinder x 0 = univ := by simp [cylinder_eq_pi] #align pi_nat.cylinder_zero PiNat.cylinder_zero theorem cylinder_anti (x : ∀ n, E n) {m n : ℕ} (h : m ≤ n) : cylinder x n ⊆ cylinder x m := fun _y hy i hi => hy i (hi.trans_le h) #align pi_nat.cylinder_anti PiNat.cylinder_anti @[simp] theorem mem_cylinder_iff {x y : ∀ n, E n} {n : ℕ} : y ∈ cylinder x n ↔ ∀ i < n, y i = x i := Iff.rfl #align pi_nat.mem_cylinder_iff PiNat.mem_cylinder_iff theorem self_mem_cylinder (x : ∀ n, E n) (n : ℕ) : x ∈ cylinder x n := by simp #align pi_nat.self_mem_cylinder PiNat.self_mem_cylinder theorem mem_cylinder_iff_eq {x y : ∀ n, E n} {n : ℕ} : y ∈ cylinder x n ↔ cylinder y n = cylinder x n := by constructor · intro hy apply Subset.antisymm · intro z hz i hi rw [← hy i hi] exact hz i hi · intro z hz i hi rw [hy i hi] exact hz i hi · intro h rw [← h] exact self_mem_cylinder _ _ #align pi_nat.mem_cylinder_iff_eq PiNat.mem_cylinder_iff_eq
Mathlib/Topology/MetricSpace/PiNat.lean
150
151
theorem mem_cylinder_comm (x y : ∀ n, E n) (n : ℕ) : y ∈ cylinder x n ↔ x ∈ cylinder y n := by
simp [mem_cylinder_iff_eq, eq_comm]
1
import Mathlib.Algebra.BigOperators.Finprod import Mathlib.SetTheory.Ordinal.Basic import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.Compactness.Paracompact import Mathlib.Topology.ShrinkingLemma import Mathlib.Topology.UrysohnsLemma #align_import topology.partition_of_unity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v open Function Set Filter open scoped Classical open Topology noncomputable section structure PartitionOfUnity (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun sum_eq_one' : ∀ x ∈ s, ∑ᶠ i, toFun i x = 1 sum_le_one' : ∀ x, ∑ᶠ i, toFun i x ≤ 1 #align partition_of_unity PartitionOfUnity structure BumpCovering (ι X : Type*) [TopologicalSpace X] (s : Set X := univ) where toFun : ι → C(X, ℝ) locallyFinite' : LocallyFinite fun i => support (toFun i) nonneg' : 0 ≤ toFun le_one' : toFun ≤ 1 eventuallyEq_one' : ∀ x ∈ s, ∃ i, toFun i =ᶠ[𝓝 x] 1 #align bump_covering BumpCovering variable {ι : Type u} {X : Type v} [TopologicalSpace X] namespace PartitionOfUnity variable {E : Type*} [AddCommMonoid E] [SMulWithZero ℝ E] [TopologicalSpace E] [ContinuousSMul ℝ E] {s : Set X} (f : PartitionOfUnity ι X s) instance : FunLike (PartitionOfUnity ι X s) ι C(X, ℝ) where coe := toFun coe_injective' := fun f g h ↦ by cases f; cases g; congr protected theorem locallyFinite : LocallyFinite fun i => support (f i) := f.locallyFinite' #align partition_of_unity.locally_finite PartitionOfUnity.locallyFinite theorem locallyFinite_tsupport : LocallyFinite fun i => tsupport (f i) := f.locallyFinite.closure #align partition_of_unity.locally_finite_tsupport PartitionOfUnity.locallyFinite_tsupport theorem nonneg (i : ι) (x : X) : 0 ≤ f i x := f.nonneg' i x #align partition_of_unity.nonneg PartitionOfUnity.nonneg theorem sum_eq_one {x : X} (hx : x ∈ s) : ∑ᶠ i, f i x = 1 := f.sum_eq_one' x hx #align partition_of_unity.sum_eq_one PartitionOfUnity.sum_eq_one theorem exists_pos {x : X} (hx : x ∈ s) : ∃ i, 0 < f i x := by have H := f.sum_eq_one hx contrapose! H simpa only [fun i => (H i).antisymm (f.nonneg i x), finsum_zero] using zero_ne_one #align partition_of_unity.exists_pos PartitionOfUnity.exists_pos theorem sum_le_one (x : X) : ∑ᶠ i, f i x ≤ 1 := f.sum_le_one' x #align partition_of_unity.sum_le_one PartitionOfUnity.sum_le_one theorem sum_nonneg (x : X) : 0 ≤ ∑ᶠ i, f i x := finsum_nonneg fun i => f.nonneg i x #align partition_of_unity.sum_nonneg PartitionOfUnity.sum_nonneg theorem le_one (i : ι) (x : X) : f i x ≤ 1 := (single_le_finsum i (f.locallyFinite.point_finite x) fun j => f.nonneg j x).trans (f.sum_le_one x) #align partition_of_unity.le_one PartitionOfUnity.le_one section finsupport variable {s : Set X} (ρ : PartitionOfUnity ι X s) (x₀ : X) def finsupport : Finset ι := (ρ.locallyFinite.point_finite x₀).toFinset @[simp] theorem mem_finsupport (x₀ : X) {i} : i ∈ ρ.finsupport x₀ ↔ i ∈ support fun i ↦ ρ i x₀ := by simp only [finsupport, mem_support, Finite.mem_toFinset, mem_setOf_eq] @[simp] theorem coe_finsupport (x₀ : X) : (ρ.finsupport x₀ : Set ι) = support fun i ↦ ρ i x₀ := by ext rw [Finset.mem_coe, mem_finsupport] variable {x₀ : X}
Mathlib/Topology/PartitionOfUnity.lean
200
201
theorem sum_finsupport (hx₀ : x₀ ∈ s) : ∑ i ∈ ρ.finsupport x₀, ρ i x₀ = 1 := by
rw [← ρ.sum_eq_one hx₀, finsum_eq_sum_of_support_subset _ (ρ.coe_finsupport x₀).superset]
1
import Mathlib.Tactic.NormNum import Mathlib.Tactic.TryThis import Mathlib.Util.AtomM set_option autoImplicit true namespace Mathlib.Tactic.Abel open Lean Elab Meta Tactic Qq initialize registerTraceClass `abel initialize registerTraceClass `abel.detail structure Context where α : Expr univ : Level α0 : Expr isGroup : Bool inst : Expr def mkContext (e : Expr) : MetaM Context := do let α ← inferType e let c ← synthInstance (← mkAppM ``AddCommMonoid #[α]) let cg ← synthInstance? (← mkAppM ``AddCommGroup #[α]) let u ← mkFreshLevelMVar _ ← isDefEq (.sort (.succ u)) (← inferType α) let α0 ← Expr.ofNat α 0 match cg with | some cg => return ⟨α, u, α0, true, cg⟩ | _ => return ⟨α, u, α0, false, c⟩ abbrev M := ReaderT Context AtomM def Context.app (c : Context) (n : Name) (inst : Expr) : Array Expr → Expr := mkAppN (((@Expr.const n [c.univ]).app c.α).app inst) def Context.mkApp (c : Context) (n inst : Name) (l : Array Expr) : MetaM Expr := do return c.app n (← synthInstance ((Expr.const inst [c.univ]).app c.α)) l def addG : Name → Name | .str p s => .str p (s ++ "g") | n => n def iapp (n : Name) (xs : Array Expr) : M Expr := do let c ← read return c.app (if c.isGroup then addG n else n) c.inst xs def term {α} [AddCommMonoid α] (n : ℕ) (x a : α) : α := n • x + a def termg {α} [AddCommGroup α] (n : ℤ) (x a : α) : α := n • x + a def mkTerm (n x a : Expr) : M Expr := iapp ``term #[n, x, a] def intToExpr (n : ℤ) : M Expr := do Expr.ofInt (mkConst (if (← read).isGroup then ``Int else ``Nat) []) n inductive NormalExpr : Type | zero (e : Expr) : NormalExpr | nterm (e : Expr) (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : NormalExpr deriving Inhabited def NormalExpr.e : NormalExpr → Expr | .zero e => e | .nterm e .. => e instance : Coe NormalExpr Expr where coe := NormalExpr.e def NormalExpr.term' (n : Expr × ℤ) (x : ℕ × Expr) (a : NormalExpr) : M NormalExpr := return .nterm (← mkTerm n.1 x.2 a) n x a def NormalExpr.zero' : M NormalExpr := return NormalExpr.zero (← read).α0 open NormalExpr theorem const_add_term {α} [AddCommMonoid α] (k n x a a') (h : k + a = a') : k + @term α _ n x a = term n x a' := by simp [h.symm, term, add_comm, add_assoc] theorem const_add_termg {α} [AddCommGroup α] (k n x a a') (h : k + a = a') : k + @termg α _ n x a = termg n x a' := by simp [h.symm, termg, add_comm, add_assoc] theorem term_add_const {α} [AddCommMonoid α] (n x a k a') (h : a + k = a') : @term α _ n x a + k = term n x a' := by simp [h.symm, term, add_assoc] theorem term_add_constg {α} [AddCommGroup α] (n x a k a') (h : a + k = a') : @termg α _ n x a + k = termg n x a' := by simp [h.symm, termg, add_assoc] theorem term_add_term {α} [AddCommMonoid α] (n₁ x a₁ n₂ a₂ n' a') (h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') : @term α _ n₁ x a₁ + @term α _ n₂ x a₂ = term n' x a' := by simp [h₁.symm, h₂.symm, term, add_nsmul, add_assoc, add_left_comm] theorem term_add_termg {α} [AddCommGroup α] (n₁ x a₁ n₂ a₂ n' a') (h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') : @termg α _ n₁ x a₁ + @termg α _ n₂ x a₂ = termg n' x a' := by simp only [termg, h₁.symm, add_zsmul, h₂.symm] exact add_add_add_comm (n₁ • x) a₁ (n₂ • x) a₂ theorem zero_term {α} [AddCommMonoid α] (x a) : @term α _ 0 x a = a := by simp [term, zero_nsmul, one_nsmul]
Mathlib/Tactic/Abel.lean
157
158
theorem zero_termg {α} [AddCommGroup α] (x a) : @termg α _ 0 x a = a := by
simp [termg, zero_zsmul]
1
import Mathlib.Logic.Function.Iterate import Mathlib.Topology.EMetricSpace.Basic import Mathlib.Tactic.GCongr #align_import topology.metric_space.lipschitz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" universe u v w x open Filter Function Set Topology NNReal ENNReal Bornology variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x} def LipschitzWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) := ∀ x y, edist (f x) (f y) ≤ K * edist x y #align lipschitz_with LipschitzWith def LipschitzOnWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) (s : Set α) := ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → edist (f x) (f y) ≤ K * edist x y #align lipschitz_on_with LipschitzOnWith def LocallyLipschitz [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop := ∀ x : α, ∃ K, ∃ t ∈ 𝓝 x, LipschitzOnWith K f t @[simp] theorem lipschitzOnWith_empty [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) : LipschitzOnWith K f ∅ := fun _ => False.elim #align lipschitz_on_with_empty lipschitzOnWith_empty theorem LipschitzOnWith.mono [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {s t : Set α} {f : α → β} (hf : LipschitzOnWith K f t) (h : s ⊆ t) : LipschitzOnWith K f s := fun _x x_in _y y_in => hf (h x_in) (h y_in) #align lipschitz_on_with.mono LipschitzOnWith.mono @[simp]
Mathlib/Topology/EMetricSpace/Lipschitz.lean
82
83
theorem lipschitzOn_univ [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {f : α → β} : LipschitzOnWith K f univ ↔ LipschitzWith K f := by
simp [LipschitzOnWith, LipschitzWith]
1
import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.Bicategory.Coherence namespace CategoryTheory namespace Bicategory open Category open scoped Bicategory open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp) universe w v u variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a ⟶ b} {g : b ⟶ a} def leftZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := η ▷ f ⊗≫ f ◁ ε def rightZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := g ◁ η ⊗≫ ε ▷ g theorem rightZigzag_idempotent_of_left_triangle (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) (h : leftZigzag η ε = (λ_ _).hom ≫ (ρ_ _).inv) : rightZigzag η ε ⊗≫ rightZigzag η ε = rightZigzag η ε := by dsimp only [rightZigzag] calc _ = g ◁ η ⊗≫ ((ε ▷ g ▷ 𝟙 a) ≫ (𝟙 b ≫ g) ◁ η) ⊗≫ ε ▷ g := by simp [bicategoricalComp]; coherence _ = 𝟙 _ ⊗≫ g ◁ (η ▷ 𝟙 a ≫ (f ≫ g) ◁ η) ⊗≫ (ε ▷ (g ≫ f) ≫ 𝟙 b ◁ ε) ▷ g ⊗≫ 𝟙 _ := by rw [← whisker_exchange]; simp [bicategoricalComp]; coherence _ = g ◁ η ⊗≫ g ◁ leftZigzag η ε ▷ g ⊗≫ ε ▷ g := by rw [← whisker_exchange, ← whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence _ = g ◁ η ⊗≫ ε ▷ g := by rw [h]; simp [bicategoricalComp]; coherence structure Adjunction (f : a ⟶ b) (g : b ⟶ a) where unit : 𝟙 a ⟶ f ≫ g counit : g ≫ f ⟶ 𝟙 b left_triangle : leftZigzag unit counit = (λ_ _).hom ≫ (ρ_ _).inv := by aesop_cat right_triangle : rightZigzag unit counit = (ρ_ _).hom ≫ (λ_ _).inv := by aesop_cat @[inherit_doc] scoped infixr:15 " ⊣ " => Bicategory.Adjunction namespace Adjunction attribute [simp] left_triangle right_triangle attribute [local simp] leftZigzag rightZigzag def id (a : B) : 𝟙 a ⊣ 𝟙 a where unit := (ρ_ _).inv counit := (ρ_ _).hom left_triangle := by dsimp; coherence right_triangle := by dsimp; coherence instance : Inhabited (Adjunction (𝟙 a) (𝟙 a)) := ⟨id a⟩ noncomputable section variable (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) def leftZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerRightIso η f ≪⊗≫ whiskerLeftIso f ε def rightZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerLeftIso g η ≪⊗≫ whiskerRightIso ε g attribute [local simp] leftZigzagIso rightZigzagIso leftZigzag rightZigzag @[simp] theorem leftZigzagIso_hom : (leftZigzagIso η ε).hom = leftZigzag η.hom ε.hom := rfl @[simp] theorem rightZigzagIso_hom : (rightZigzagIso η ε).hom = rightZigzag η.hom ε.hom := rfl @[simp]
Mathlib/CategoryTheory/Bicategory/Adjunction.lean
201
202
theorem leftZigzagIso_inv : (leftZigzagIso η ε).inv = rightZigzag ε.inv η.inv := by
simp [bicategoricalComp, bicategoricalIsoComp]
1
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by simpa only [not_iff_not] using dist_eq_zero #align dist_ne_zero dist_ne_zero @[simp] theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y := by simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y #align dist_le_zero dist_le_zero @[simp] theorem dist_pos {x y : γ} : 0 < dist x y ↔ x ≠ y := by simpa only [not_le] using not_congr dist_le_zero #align dist_pos dist_pos theorem eq_of_forall_dist_le {x y : γ} (h : ∀ ε > 0, dist x y ≤ ε) : x = y := eq_of_dist_eq_zero (eq_of_le_of_forall_le_of_dense dist_nonneg h) #align eq_of_forall_dist_le eq_of_forall_dist_le theorem eq_of_nndist_eq_zero {x y : γ} : nndist x y = 0 → x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero] #align eq_of_nndist_eq_zero eq_of_nndist_eq_zero @[simp]
Mathlib/Topology/MetricSpace/Basic.lean
102
103
theorem nndist_eq_zero {x y : γ} : nndist x y = 0 ↔ x = y := by
simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero]
1
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
98
98
theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by
ext; simp
1
import Mathlib.Algebra.Ring.Defs import Mathlib.Data.Rat.Init #align_import algebra.field.defs from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c" -- `NeZero` should not be needed in the basic algebraic hierarchy. assert_not_exists NeZero -- Check that we have not imported `Mathlib.Tactic.Common` yet. assert_not_exists Mathlib.Tactic.LibrarySearch.librarySearch assert_not_exists MonoidHom open Function Set universe u variable {α β K : Type*} def NNRat.castRec [NatCast K] [Div K] (q : ℚ≥0) : K := q.num / q.den def Rat.castRec [NatCast K] [IntCast K] [Div K] (q : ℚ) : K := q.num / q.den #align rat.cast_rec Rat.castRec #noalign qsmul_rec class DivisionSemiring (α : Type*) extends Semiring α, GroupWithZero α, NNRatCast α where protected nnratCast := NNRat.castRec protected nnratCast_def (q : ℚ≥0) : (NNRat.cast q : α) = q.num / q.den := by intros; rfl protected nnqsmul : ℚ≥0 → α → α protected nnqsmul_def (q : ℚ≥0) (a : α) : nnqsmul q a = NNRat.cast q * a := by intros; rfl #align division_semiring DivisionSemiring class DivisionRing (α : Type*) extends Ring α, DivInvMonoid α, Nontrivial α, NNRatCast α, RatCast α where protected mul_inv_cancel : ∀ (a : α), a ≠ 0 → a * a⁻¹ = 1 protected inv_zero : (0 : α)⁻¹ = 0 protected nnratCast := NNRat.castRec protected nnratCast_def (q : ℚ≥0) : (NNRat.cast q : α) = q.num / q.den := by intros; rfl protected nnqsmul : ℚ≥0 → α → α protected nnqsmul_def (q : ℚ≥0) (a : α) : nnqsmul q a = NNRat.cast q * a := by intros; rfl protected ratCast := Rat.castRec protected ratCast_def (q : ℚ) : (Rat.cast q : α) = q.num / q.den := by intros; rfl protected qsmul : ℚ → α → α protected qsmul_def (a : ℚ) (x : α) : qsmul a x = Rat.cast a * x := by intros; rfl #align division_ring DivisionRing #align division_ring.rat_cast_mk DivisionRing.ratCast_def -- see Note [lower instance priority] instance (priority := 100) DivisionRing.toDivisionSemiring [DivisionRing α] : DivisionSemiring α := { ‹DivisionRing α› with } #align division_ring.to_division_semiring DivisionRing.toDivisionSemiring class Semifield (α : Type*) extends CommSemiring α, DivisionSemiring α, CommGroupWithZero α #align semifield Semifield class Field (K : Type u) extends CommRing K, DivisionRing K #align field Field -- see Note [lower instance priority] instance (priority := 100) Field.toSemifield [Field α] : Semifield α := { ‹Field α› with } #align field.to_semifield Field.toSemifield namespace Rat variable [DivisionRing K] {a b : K} lemma cast_def (q : ℚ) : (q : K) = q.num / q.den := DivisionRing.ratCast_def _ #align rat.cast_def Rat.cast_def lemma cast_mk' (a b h1 h2) : ((⟨a, b, h1, h2⟩ : ℚ) : K) = a / b := cast_def _ #align rat.cast_mk' Rat.cast_mk' instance (priority := 100) smulDivisionRing : SMul ℚ K := ⟨DivisionRing.qsmul⟩ #align rat.smul_division_ring Rat.smulDivisionRing theorem smul_def (a : ℚ) (x : K) : a • x = ↑a * x := DivisionRing.qsmul_def a x #align rat.smul_def Rat.smul_def @[simp]
Mathlib/Algebra/Field/Defs.lean
226
227
theorem smul_one_eq_cast (A : Type*) [DivisionRing A] (m : ℚ) : m • (1 : A) = ↑m := by
rw [Rat.smul_def, mul_one]
1
import Mathlib.Deprecated.Group #align_import deprecated.ring from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec" universe u v w variable {α : Type u} structure IsSemiringHom {α : Type u} {β : Type v} [Semiring α] [Semiring β] (f : α → β) : Prop where map_zero : f 0 = 0 map_one : f 1 = 1 map_add : ∀ x y, f (x + y) = f x + f y map_mul : ∀ x y, f (x * y) = f x * f y #align is_semiring_hom IsSemiringHom structure IsRingHom {α : Type u} {β : Type v} [Ring α] [Ring β] (f : α → β) : Prop where map_one : f 1 = 1 map_mul : ∀ x y, f (x * y) = f x * f y map_add : ∀ x y, f (x + y) = f x + f y #align is_ring_hom IsRingHom namespace IsRingHom variable {β : Type v} [Ring α] [Ring β] theorem of_semiring {f : α → β} (H : IsSemiringHom f) : IsRingHom f := { H with } #align is_ring_hom.of_semiring IsRingHom.of_semiring variable {f : α → β} (hf : IsRingHom f) {x y : α} theorem map_zero (hf : IsRingHom f) : f 0 = 0 := calc f 0 = f (0 + 0) - f 0 := by rw [hf.map_add]; simp _ = 0 := by simp #align is_ring_hom.map_zero IsRingHom.map_zero theorem map_neg (hf : IsRingHom f) : f (-x) = -f x := calc f (-x) = f (-x + x) - f x := by rw [hf.map_add]; simp _ = -f x := by simp [hf.map_zero] #align is_ring_hom.map_neg IsRingHom.map_neg theorem map_sub (hf : IsRingHom f) : f (x - y) = f x - f y := by simp [sub_eq_add_neg, hf.map_add, hf.map_neg] #align is_ring_hom.map_sub IsRingHom.map_sub theorem id : IsRingHom (@id α) := by constructor <;> intros <;> rfl #align is_ring_hom.id IsRingHom.id -- see Note [no instance on morphisms]
Mathlib/Deprecated/Ring.lean
124
127
theorem comp (hf : IsRingHom f) {γ} [Ring γ] {g : β → γ} (hg : IsRingHom g) : IsRingHom (g ∘ f) := { map_add := fun x y => by simp only [Function.comp_apply, map_add hf, map_add hg] map_mul := fun x y => by simp only [Function.comp_apply, map_mul hf, map_mul hg] map_one := by
simp only [Function.comp_apply, map_one hf, map_one hg] }
1
import Mathlib.Data.Finset.Option import Mathlib.Data.PFun import Mathlib.Data.Part #align_import data.finset.pimage from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable {α β : Type*} namespace Part def toFinset (o : Part α) [Decidable o.Dom] : Finset α := o.toOption.toFinset #align part.to_finset Part.toFinset @[simp] theorem mem_toFinset {o : Part α} [Decidable o.Dom] {x : α} : x ∈ o.toFinset ↔ x ∈ o := by simp [toFinset] #align part.mem_to_finset Part.mem_toFinset @[simp] theorem toFinset_none [Decidable (none : Part α).Dom] : none.toFinset = (∅ : Finset α) := by simp [toFinset] #align part.to_finset_none Part.toFinset_none @[simp]
Mathlib/Data/Finset/PImage.lean
44
45
theorem toFinset_some {a : α} [Decidable (some a).Dom] : (some a).toFinset = {a} := by
simp [toFinset]
1
import Mathlib.FieldTheory.PrimitiveElement import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Galois #align_import ring_theory.norm from "leanprover-community/mathlib"@"fecd3520d2a236856f254f27714b80dcfe28ea57" universe u v w variable {R S T : Type*} [CommRing R] [Ring S] variable [Algebra R S] variable {K L F : Type*} [Field K] [Field L] [Field F] variable [Algebra K L] [Algebra K F] variable {ι : Type w} open FiniteDimensional open LinearMap open Matrix Polynomial open scoped Matrix namespace Algebra variable (R) noncomputable def norm : S →* R := LinearMap.det.comp (lmul R S).toRingHom.toMonoidHom #align algebra.norm Algebra.norm theorem norm_apply (x : S) : norm R x = LinearMap.det (lmul R S x) := rfl #align algebra.norm_apply Algebra.norm_apply theorem norm_eq_one_of_not_exists_basis (h : ¬∃ s : Finset S, Nonempty (Basis s R S)) (x : S) : norm R x = 1 := by rw [norm_apply, LinearMap.det]; split_ifs <;> trivial #align algebra.norm_eq_one_of_not_exists_basis Algebra.norm_eq_one_of_not_exists_basis variable {R} theorem norm_eq_one_of_not_module_finite (h : ¬Module.Finite R S) (x : S) : norm R x = 1 := by refine norm_eq_one_of_not_exists_basis _ (mt ?_ h) _ rintro ⟨s, ⟨b⟩⟩ exact Module.Finite.of_basis b #align algebra.norm_eq_one_of_not_module_finite Algebra.norm_eq_one_of_not_module_finite -- Can't be a `simp` lemma because it depends on a choice of basis
Mathlib/RingTheory/Norm.lean
85
87
theorem norm_eq_matrix_det [Fintype ι] [DecidableEq ι] (b : Basis ι R S) (s : S) : norm R s = Matrix.det (Algebra.leftMulMatrix b s) := by
rw [norm_apply, ← LinearMap.det_toMatrix b, ← toMatrix_lmul_eq]; rfl
1
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp] theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) : reduceOption (some x :: l) = x :: l.reduceOption := by simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff] #align list.reduce_option_cons_of_some List.reduceOption_cons_of_some @[simp] theorem reduceOption_cons_of_none (l : List (Option α)) : reduceOption (none :: l) = l.reduceOption := by simp only [reduceOption, filterMap, id] #align list.reduce_option_cons_of_none List.reduceOption_cons_of_none @[simp] theorem reduceOption_nil : @reduceOption α [] = [] := rfl #align list.reduce_option_nil List.reduceOption_nil @[simp] theorem reduceOption_map {l : List (Option α)} {f : α → β} : reduceOption (map (Option.map f) l) = map f (reduceOption l) := by induction' l with hd tl hl · simp only [reduceOption_nil, map_nil] · cases hd <;> simpa [true_and_iff, Option.map_some', map, eq_self_iff_true, reduceOption_cons_of_some] using hl #align list.reduce_option_map List.reduceOption_map theorem reduceOption_append (l l' : List (Option α)) : (l ++ l').reduceOption = l.reduceOption ++ l'.reduceOption := filterMap_append l l' id #align list.reduce_option_append List.reduceOption_append theorem reduceOption_length_eq {l : List (Option α)} : l.reduceOption.length = (l.filter Option.isSome).length := by induction' l with hd tl hl · simp_rw [reduceOption_nil, filter_nil, length] · cases hd <;> simp [hl] theorem length_eq_reduceOption_length_add_filter_none {l : List (Option α)} : l.length = l.reduceOption.length + (l.filter Option.isNone).length := by simp_rw [reduceOption_length_eq, l.length_eq_length_filter_add Option.isSome, Option.bnot_isSome] theorem reduceOption_length_le (l : List (Option α)) : l.reduceOption.length ≤ l.length := by rw [length_eq_reduceOption_length_add_filter_none] apply Nat.le_add_right #align list.reduce_option_length_le List.reduceOption_length_le theorem reduceOption_length_eq_iff {l : List (Option α)} : l.reduceOption.length = l.length ↔ ∀ x ∈ l, Option.isSome x := by rw [reduceOption_length_eq, List.filter_length_eq_length] #align list.reduce_option_length_eq_iff List.reduceOption_length_eq_iff theorem reduceOption_length_lt_iff {l : List (Option α)} : l.reduceOption.length < l.length ↔ none ∈ l := by rw [Nat.lt_iff_le_and_ne, and_iff_right (reduceOption_length_le l), Ne, reduceOption_length_eq_iff] induction l <;> simp [*] rw [@eq_comm _ none, ← Option.not_isSome_iff_eq_none, Decidable.imp_iff_not_or] #align list.reduce_option_length_lt_iff List.reduceOption_length_lt_iff theorem reduceOption_singleton (x : Option α) : [x].reduceOption = x.toList := by cases x <;> rfl #align list.reduce_option_singleton List.reduceOption_singleton theorem reduceOption_concat (l : List (Option α)) (x : Option α) : (l.concat x).reduceOption = l.reduceOption ++ x.toList := by induction' l with hd tl hl generalizing x · cases x <;> simp [Option.toList] · simp only [concat_eq_append, reduceOption_append] at hl cases hd <;> simp [hl, reduceOption_append] #align list.reduce_option_concat List.reduceOption_concat theorem reduceOption_concat_of_some (l : List (Option α)) (x : α) : (l.concat (some x)).reduceOption = l.reduceOption.concat x := by simp only [reduceOption_nil, concat_eq_append, reduceOption_append, reduceOption_cons_of_some] #align list.reduce_option_concat_of_some List.reduceOption_concat_of_some theorem reduceOption_mem_iff {l : List (Option α)} {x : α} : x ∈ l.reduceOption ↔ some x ∈ l := by simp only [reduceOption, id, mem_filterMap, exists_eq_right] #align list.reduce_option_mem_iff List.reduceOption_mem_iff
Mathlib/Data/List/ReduceOption.lean
97
99
theorem reduceOption_get?_iff {l : List (Option α)} {x : α} : (∃ i, l.get? i = some (some x)) ↔ ∃ i, l.reduceOption.get? i = some x := by
rw [← mem_iff_get?, ← mem_iff_get?, reduceOption_mem_iff]
1
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.SetTheory.Ordinal.Exponential #align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b" noncomputable section universe u open List namespace Ordinal @[elab_as_elim] noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o := fun o ↦ by by_cases h : o = 0 · rw [h]; exact H0 · exact H o h (CNFRec _ H0 H (o % b ^ log b o)) termination_by o => o decreasing_by exact mod_opow_log_lt_self b h set_option linter.uppercaseLean3 false in #align ordinal.CNF_rec Ordinal.CNFRec @[simp] theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by rw [CNFRec, dif_pos rfl] rfl set_option linter.uppercaseLean3 false in #align ordinal.CNF_rec_zero Ordinal.CNFRec_zero theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by rw [CNFRec, dif_neg ho] set_option linter.uppercaseLean3 false in #align ordinal.CNF_rec_pos Ordinal.CNFRec_pos -- Porting note: unknown attribute @[pp_nodot] def CNF (b o : Ordinal) : List (Ordinal × Ordinal) := CNFRec b [] (fun o _ho IH ↦ (log b o, o / b ^ log b o)::IH) o set_option linter.uppercaseLean3 false in #align ordinal.CNF Ordinal.CNF @[simp] theorem CNF_zero (b : Ordinal) : CNF b 0 = [] := CNFRec_zero b _ _ set_option linter.uppercaseLean3 false in #align ordinal.CNF_zero Ordinal.CNF_zero theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) : CNF b o = (log b o, o / b ^ log b o)::CNF b (o % b ^ log b o) := CNFRec_pos b ho _ _ set_option linter.uppercaseLean3 false in #align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho] set_option linter.uppercaseLean3 false in #align ordinal.zero_CNF Ordinal.zero_CNF
Mathlib/SetTheory/Ordinal/CantorNormalForm.lean
97
97
theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by
simp [CNF_ne_zero ho]
1
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊢ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊢ cases b; · exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF] theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false] #align nat.size_shiftl Nat.size_shiftLeft theorem lt_size_self (n : ℕ) : n < 2 ^ size n := by rw [← one_shiftLeft] have : ∀ {n}, n = 0 → n < 1 <<< (size n) := by simp apply binaryRec _ _ n · apply this rfl intro b n IH by_cases h : bit b n = 0 · apply this h rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val] exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH) #align nat.lt_size_self Nat.lt_size_self theorem size_le {m n : ℕ} : size m ≤ n ↔ m < 2 ^ n := ⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by rw [← one_shiftLeft]; revert n apply binaryRec _ _ m · intro n simp · intro b m IH n h by_cases e : bit b m = 0 · simp [e] rw [size_bit e] cases' n with n · exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h)) · apply succ_le_succ (IH _) apply Nat.lt_of_mul_lt_mul_left (a := 2) simp only [← bit0_val, shiftLeft_succ] at * exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩ #align nat.size_le Nat.size_le
Mathlib/Data/Nat/Size.lean
137
138
theorem lt_size {m n : ℕ} : m < size n ↔ 2 ^ m ≤ n := by
rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le]
1
import Mathlib.Logic.Function.Basic import Mathlib.Tactic.MkIffOfInductiveProp #align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" universe u v w x variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*} namespace Sum #align sum.forall Sum.forall #align sum.exists Sum.exists theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) : (∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by rw [← not_forall_not, forall_sum] simp theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj #align sum.inl_injective Sum.inl_injective theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj #align sum.inr_injective Sum.inr_injective
Mathlib/Data/Sum/Basic.lean
38
40
theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i)) {x y : α ⊕ β} (h : x = y) : @Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by
cases h; rfl
1
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] theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList] #align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff @[simp] theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList] #align equiv.perm.length_to_list Equiv.Perm.length_toList theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by intro H simpa [card_support_ne_one] using congr_arg length H #align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
Mathlib/GroupTheory/Perm/Cycle/Concrete.lean
237
238
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} : 2 ≤ length (toList p x) ↔ x ∈ p.support := by
simp
1
import Mathlib.Algebra.Group.Defs #align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered universe u variable {α : Type u} class Invertible [Mul α] [One α] (a : α) : Type u where invOf : α invOf_mul_self : invOf * a = 1 mul_invOf_self : a * invOf = 1 #align invertible Invertible prefix:max "⅟" =>-- This notation has the same precedence as `Inv.inv`. Invertible.invOf @[simp] theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 := Invertible.invOf_mul_self theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 := Invertible.invOf_mul_self #align inv_of_mul_self invOf_mul_self @[simp] theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 := Invertible.mul_invOf_self theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 := Invertible.mul_invOf_self #align mul_inv_of_self mul_invOf_self @[simp] theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] #align inv_of_mul_self_assoc invOf_mul_self_assoc @[simp]
Mathlib/Algebra/Group/Invertible/Defs.lean
125
126
theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
1
import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp] theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left] #align nat.unpair_mkpair Nat.unpair_pair @[simps (config := .asFn)] def pairEquiv : ℕ × ℕ ≃ ℕ := ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩ #align nat.mkpair_equiv Nat.pairEquiv #align nat.mkpair_equiv_apply Nat.pairEquiv_apply #align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply theorem surjective_unpair : Surjective unpair := pairEquiv.symm.surjective #align nat.surjective_unpair Nat.surjective_unpair @[simp] theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d := pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d)) #align nat.mkpair_eq_mkpair Nat.pair_eq_pair theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by let s := sqrt n simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add] by_cases h : n - s * s < s <;> simp [h] · exact lt_of_lt_of_le h (sqrt_le_self _) · simp at h have s0 : 0 < s := sqrt_pos.2 n1 exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0)) #align nat.unpair_lt Nat.unpair_lt @[simp] theorem unpair_zero : unpair 0 = 0 := by rw [unpair] simp #align nat.unpair_zero Nat.unpair_zero theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n | 0 => by simp | n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _)) #align nat.unpair_left_le Nat.unpair_left_le theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b) #align nat.left_le_mkpair Nat.left_le_pair theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by by_cases h : a < b <;> simp [pair, h] exact le_trans (le_mul_self _) (Nat.le_add_right _ _) #align nat.right_le_mkpair Nat.right_le_pair
Mathlib/Data/Nat/Pairing.lean
122
123
theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
simpa using right_le_pair n.unpair.1 n.unpair.2
1
import Mathlib.Analysis.SpecialFunctions.Gamma.Beta import Mathlib.NumberTheory.LSeries.HurwitzZeta import Mathlib.Analysis.Complex.RemovableSingularity import Mathlib.Analysis.PSeriesComplex #align_import number_theory.zeta_function from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf" open MeasureTheory Set Filter Asymptotics TopologicalSpace Real Asymptotics Classical HurwitzZeta open Complex hiding exp norm_eq_abs abs_of_nonneg abs_two continuous_exp open scoped Topology Real Nat noncomputable section def completedRiemannZeta₀ (s : ℂ) : ℂ := completedHurwitzZetaEven₀ 0 s #align riemann_completed_zeta₀ completedRiemannZeta₀ def completedRiemannZeta (s : ℂ) : ℂ := completedHurwitzZetaEven 0 s #align riemann_completed_zeta completedRiemannZeta lemma HurwitzZeta.completedHurwitzZetaEven_zero (s : ℂ) : completedHurwitzZetaEven 0 s = completedRiemannZeta s := rfl lemma HurwitzZeta.completedHurwitzZetaEven₀_zero (s : ℂ) : completedHurwitzZetaEven₀ 0 s = completedRiemannZeta₀ s := rfl lemma HurwitzZeta.completedCosZeta_zero (s : ℂ) : completedCosZeta 0 s = completedRiemannZeta s := by rw [completedRiemannZeta, completedHurwitzZetaEven, completedCosZeta, hurwitzEvenFEPair_zero_symm] lemma HurwitzZeta.completedCosZeta₀_zero (s : ℂ) : completedCosZeta₀ 0 s = completedRiemannZeta₀ s := by rw [completedRiemannZeta₀, completedHurwitzZetaEven₀, completedCosZeta₀, hurwitzEvenFEPair_zero_symm] lemma completedRiemannZeta_eq (s : ℂ) : completedRiemannZeta s = completedRiemannZeta₀ s - 1 / s - 1 / (1 - s) := by simp_rw [completedRiemannZeta, completedRiemannZeta₀, completedHurwitzZetaEven_eq, if_true] theorem differentiable_completedZeta₀ : Differentiable ℂ completedRiemannZeta₀ := differentiable_completedHurwitzZetaEven₀ 0 #align differentiable_completed_zeta₀ differentiable_completedZeta₀ theorem differentiableAt_completedZeta {s : ℂ} (hs : s ≠ 0) (hs' : s ≠ 1) : DifferentiableAt ℂ completedRiemannZeta s := differentiableAt_completedHurwitzZetaEven 0 (Or.inl hs) hs' theorem completedRiemannZeta₀_one_sub (s : ℂ) : completedRiemannZeta₀ (1 - s) = completedRiemannZeta₀ s := by rw [← completedHurwitzZetaEven₀_zero, ← completedCosZeta₀_zero, completedHurwitzZetaEven₀_one_sub] #align riemann_completed_zeta₀_one_sub completedRiemannZeta₀_one_sub theorem completedRiemannZeta_one_sub (s : ℂ) : completedRiemannZeta (1 - s) = completedRiemannZeta s := by rw [← completedHurwitzZetaEven_zero, ← completedCosZeta_zero, completedHurwitzZetaEven_one_sub] #align riemann_completed_zeta_one_sub completedRiemannZeta_one_sub lemma completedRiemannZeta_residue_one : Tendsto (fun s ↦ (s - 1) * completedRiemannZeta s) (𝓝[≠] 1) (𝓝 1) := completedHurwitzZetaEven_residue_one 0 def riemannZeta := hurwitzZetaEven 0 #align riemann_zeta riemannZeta lemma HurwitzZeta.hurwitzZetaEven_zero : hurwitzZetaEven 0 = riemannZeta := rfl lemma HurwitzZeta.cosZeta_zero : cosZeta 0 = riemannZeta := by simp_rw [cosZeta, riemannZeta, hurwitzZetaEven, if_true, completedHurwitzZetaEven_zero, completedCosZeta_zero] lemma HurwitzZeta.hurwitzZeta_zero : hurwitzZeta 0 = riemannZeta := by ext1 s simpa [hurwitzZeta, hurwitzZetaEven_zero] using hurwitzZetaOdd_neg 0 s lemma HurwitzZeta.expZeta_zero : expZeta 0 = riemannZeta := by ext1 s rw [expZeta, cosZeta_zero, add_right_eq_self, mul_eq_zero, eq_false_intro I_ne_zero, false_or, ← eq_neg_self_iff, ← sinZeta_neg, neg_zero] theorem differentiableAt_riemannZeta {s : ℂ} (hs' : s ≠ 1) : DifferentiableAt ℂ riemannZeta s := differentiableAt_hurwitzZetaEven _ hs' #align differentiable_at_riemann_zeta differentiableAt_riemannZeta
Mathlib/NumberTheory/LSeries/RiemannZeta.lean
149
150
theorem riemannZeta_zero : riemannZeta 0 = -1 / 2 := by
simp_rw [riemannZeta, hurwitzZetaEven, Function.update_same, if_true]
1
import Mathlib.Analysis.RCLike.Lemmas import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad" set_option linter.uppercaseLean3 false noncomputable section open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter open scoped NNReal ENNReal MeasureTheory namespace MeasureTheory section variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F]
Mathlib/MeasureTheory/Function/L2Space.lean
42
43
theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by
simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top
1
import Mathlib.Data.Set.Prod import Mathlib.Logic.Function.Conjugate #align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207" variable {α β γ : Type*} {ι : Sort*} {π : α → Type*} open Equiv Equiv.Perm Function namespace Set section equality variable {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {p : Set γ} {f f₁ f₂ f₃ : α → β} {g g₁ g₂ : β → γ} {f' f₁' f₂' : β → α} {g' : γ → β} {a : α} {b : β} @[simp] theorem eqOn_empty (f₁ f₂ : α → β) : EqOn f₁ f₂ ∅ := fun _ => False.elim #align set.eq_on_empty Set.eqOn_empty @[simp] theorem eqOn_singleton : Set.EqOn f₁ f₂ {a} ↔ f₁ a = f₂ a := by simp [Set.EqOn] #align set.eq_on_singleton Set.eqOn_singleton @[simp]
Mathlib/Data/Set/Function.lean
190
191
theorem eqOn_univ (f₁ f₂ : α → β) : EqOn f₁ f₂ univ ↔ f₁ = f₂ := by
simp [EqOn, funext_iff]
1
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Polynomial.Eval import Mathlib.GroupTheory.GroupAction.Ring #align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Finset open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ} section Derivative section Semiring variable [Semiring R] def derivative : R[X] →ₗ[R] R[X] where toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1) map_add' p q := by dsimp only rw [sum_add_index] <;> simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul, RingHom.map_zero] map_smul' a p := by dsimp; rw [sum_smul_index] <;> simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul, RingHom.map_zero, sum] #align polynomial.derivative Polynomial.derivative theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) := rfl #align polynomial.derivative_apply Polynomial.derivative_apply theorem coeff_derivative (p : R[X]) (n : ℕ) : coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by rw [derivative_apply] simp only [coeff_X_pow, coeff_sum, coeff_C_mul] rw [sum, Finset.sum_eq_single (n + 1)] · simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast · intro b cases b · intros rw [Nat.cast_zero, mul_zero, zero_mul] · intro _ H rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero] · rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one, mem_support_iff] intro h push_neg at h simp [h] #align polynomial.coeff_derivative Polynomial.coeff_derivative -- Porting note (#10618): removed `simp`: `simp` can prove it. theorem derivative_zero : derivative (0 : R[X]) = 0 := derivative.map_zero #align polynomial.derivative_zero Polynomial.derivative_zero theorem iterate_derivative_zero {k : ℕ} : derivative^[k] (0 : R[X]) = 0 := iterate_map_zero derivative k #align polynomial.iterate_derivative_zero Polynomial.iterate_derivative_zero @[simp] theorem derivative_monomial (a : R) (n : ℕ) : derivative (monomial n a) = monomial (n - 1) (a * n) := by rw [derivative_apply, sum_monomial_index, C_mul_X_pow_eq_monomial] simp #align polynomial.derivative_monomial Polynomial.derivative_monomial theorem derivative_C_mul_X (a : R) : derivative (C a * X) = C a := by simp [C_mul_X_eq_monomial, derivative_monomial, Nat.cast_one, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X Polynomial.derivative_C_mul_X
Mathlib/Algebra/Polynomial/Derivative.lean
97
99
theorem derivative_C_mul_X_pow (a : R) (n : ℕ) : derivative (C a * X ^ n) = C (a * n) * X ^ (n - 1) := by
rw [C_mul_X_pow_eq_monomial, C_mul_X_pow_eq_monomial, derivative_monomial]
1
import Mathlib.Order.Filter.AtTopBot import Mathlib.Order.Filter.Subsingleton open Set variable {α β γ δ : Type*} {l : Filter α} {f : α → β} namespace Filter def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α} (h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y := (h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image] theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α} {x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) := h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦ ⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩ lemma eventuallyConst_iff_tendsto [Nonempty β] : EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) := subsingleton_iff_exists_le_pure alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l := have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩ theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] : EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c := subsingleton_iff_exists_singleton_mem alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq theorem eventuallyConst_pred' {p : α → Prop} : EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff] theorem eventuallyConst_pred {p : α → Prop} : EventuallyConst p l ↔ (∀ᶠ x in l, p x) ∨ (∀ᶠ x in l, ¬p x) := by simp [eventuallyConst_pred', or_comm, EventuallyEq] theorem eventuallyConst_set' {s : Set α} : EventuallyConst s l ↔ (s =ᶠ[l] (∅ : Set α)) ∨ s =ᶠ[l] univ := eventuallyConst_pred' theorem eventuallyConst_set {s : Set α} : EventuallyConst s l ↔ (∀ᶠ x in l, x ∈ s) ∨ (∀ᶠ x in l, x ∉ s) := eventuallyConst_pred
Mathlib/Order/Filter/EventuallyConst.lean
73
75
theorem EventuallyEq.eventuallyConst_iff {g : α → β} (h : f =ᶠ[l] g) : EventuallyConst f l ↔ EventuallyConst g l := by
simp only [EventuallyConst, map_congr h]
1
import Mathlib.Data.Set.Lattice import Mathlib.Init.Set import Mathlib.Control.Basic import Mathlib.Lean.Expr.ExtraRecognizers #align_import data.set.functor from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" universe u open Function namespace Set variable {α β : Type u} {s : Set α} {f : α → Set β} {g : Set (α → β)} protected def monad : Monad.{u} Set where pure a := {a} bind s f := ⋃ i ∈ s, f i seq s t := Set.seq s (t ()) map := Set.image section with_instance attribute [local instance] Set.monad @[simp] theorem bind_def : s >>= f = ⋃ i ∈ s, f i := rfl #align set.bind_def Set.bind_def @[simp] theorem fmap_eq_image (f : α → β) : f <$> s = f '' s := rfl #align set.fmap_eq_image Set.fmap_eq_image @[simp] theorem seq_eq_set_seq (s : Set (α → β)) (t : Set α) : s <*> t = s.seq t := rfl #align set.seq_eq_set_seq Set.seq_eq_set_seq @[simp] theorem pure_def (a : α) : (pure a : Set α) = {a} := rfl #align set.pure_def Set.pure_def theorem image2_def {α β γ : Type u} (f : α → β → γ) (s : Set α) (t : Set β) : image2 f s t = f <$> s <*> t := by ext simp #align set.image2_def Set.image2_def instance : LawfulMonad Set := LawfulMonad.mk' (id_map := image_id) (pure_bind := biUnion_singleton) (bind_assoc := fun _ _ _ => by simp only [bind_def, biUnion_iUnion]) (bind_pure_comp := fun _ _ => (image_eq_iUnion _ _).symm) (bind_map := fun _ _ => seq_def.symm) instance : CommApplicative (Set : Type u → Type u) := ⟨fun s t => prod_image_seq_comm s t⟩ instance : Alternative Set := { Set.monad with orElse := fun s t => s ∪ (t ()) failure := ∅ } variable {β : Set α} {γ : Set β} theorem mem_coe_of_mem {a : α} (ha : a ∈ β) (ha' : ⟨a, ha⟩ ∈ γ) : a ∈ (γ : Set α) := ⟨_, ⟨⟨_, rfl⟩, _, ⟨ha', rfl⟩, rfl⟩⟩
Mathlib/Data/Set/Functor.lean
93
94
theorem coe_subset : (γ : Set α) ⊆ β := by
intro _ ⟨_, ⟨⟨⟨_, ha⟩, rfl⟩, _, ⟨_, rfl⟩, _⟩⟩; convert ha
1
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" section Fintype variable {α β : Type*} [Fintype α] [DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β) def Function.Embedding.toEquivRange : α ≃ Set.range f := ⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩ #align function.embedding.to_equiv_range Function.Embedding.toEquivRange @[simp] theorem Function.Embedding.toEquivRange_apply (a : α) : f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ := rfl #align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply @[simp] theorem Function.Embedding.toEquivRange_symm_apply_self (a : α) : f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq] #align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self theorem Function.Embedding.toEquivRange_eq_ofInjective : f.toEquivRange = Equiv.ofInjective f f.injective := by ext simp #align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm β := e.extendDomain f.toEquivRange #align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding @[simp] theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : α) : e.viaFintypeEmbedding f (f a) = f (e a) := by rw [Equiv.Perm.viaFintypeEmbedding] convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a #align equiv.perm.via_fintype_embedding_apply_image Equiv.Perm.viaFintypeEmbedding_apply_image theorem Equiv.Perm.viaFintypeEmbedding_apply_mem_range {b : β} (h : b ∈ Set.range f) : e.viaFintypeEmbedding f b = f (e (f.invOfMemRange ⟨b, h⟩)) := by simp only [viaFintypeEmbedding, Function.Embedding.invOfMemRange] rw [Equiv.Perm.extendDomain_apply_subtype] congr #align equiv.perm.via_fintype_embedding_apply_mem_range Equiv.Perm.viaFintypeEmbedding_apply_mem_range theorem Equiv.Perm.viaFintypeEmbedding_apply_not_mem_range {b : β} (h : b ∉ Set.range f) : e.viaFintypeEmbedding f b = b := by rwa [Equiv.Perm.viaFintypeEmbedding, Equiv.Perm.extendDomain_apply_not_subtype] #align equiv.perm.via_fintype_embedding_apply_not_mem_range Equiv.Perm.viaFintypeEmbedding_apply_not_mem_range @[simp]
Mathlib/Logic/Equiv/Fintype.lean
91
93
theorem Equiv.Perm.viaFintypeEmbedding_sign [DecidableEq α] [Fintype β] : Equiv.Perm.sign (e.viaFintypeEmbedding f) = Equiv.Perm.sign e := by
simp [Equiv.Perm.viaFintypeEmbedding]
1
import Mathlib.Order.Interval.Multiset #align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" -- TODO -- assert_not_exists Ring open Finset Nat variable (a b c : ℕ) namespace Nat instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ where finsetIcc a b := ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ finsetIco a b := ⟨List.range' a (b - a), List.nodup_range' _ _⟩ finsetIoc a b := ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ finsetIoo a b := ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega theorem Icc_eq_range' : Icc a b = ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ := rfl #align nat.Icc_eq_range' Nat.Icc_eq_range' theorem Ico_eq_range' : Ico a b = ⟨List.range' a (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ico_eq_range' Nat.Ico_eq_range' theorem Ioc_eq_range' : Ioc a b = ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ioc_eq_range' Nat.Ioc_eq_range' theorem Ioo_eq_range' : Ioo a b = ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ := rfl #align nat.Ioo_eq_range' Nat.Ioo_eq_range' theorem uIcc_eq_range' : uIcc a b = ⟨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _⟩ := rfl #align nat.uIcc_eq_range' Nat.uIcc_eq_range' theorem Iio_eq_range : Iio = range := by ext b x rw [mem_Iio, mem_range] #align nat.Iio_eq_range Nat.Iio_eq_range @[simp] theorem Ico_zero_eq_range : Ico 0 = range := by rw [← Nat.bot_eq_zero, ← Iio_eq_Ico, Iio_eq_range] #align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range lemma range_eq_Icc_zero_sub_one (n : ℕ) (hn : n ≠ 0): range n = Icc 0 (n - 1) := by ext b simp_all only [mem_Icc, zero_le, true_and, mem_range] exact lt_iff_le_pred (zero_lt_of_ne_zero hn) theorem _root_.Finset.range_eq_Ico : range = Ico 0 := Ico_zero_eq_range.symm #align finset.range_eq_Ico Finset.range_eq_Ico @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := List.length_range' _ _ _ #align nat.card_Icc Nat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ico Nat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ioc Nat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := List.length_range' _ _ _ #align nat.card_Ioo Nat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := (card_Icc _ _).trans $ by rw [← Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega #align nat.card_uIcc Nat.card_uIcc @[simp] lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iic Nat.card_Iic @[simp] theorem card_Iio : (Iio b).card = b := by rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iio Nat.card_Iio -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [Fintype.card_ofFinset, card_Icc] #align nat.card_fintype_Icc Nat.card_fintypeIcc -- Porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Nat.lean
120
121
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [Fintype.card_ofFinset, card_Ico]
1
import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.OrdConnected #align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c" variable {α β : Type*} [LinearOrder α] open Function namespace Set def projIci (a x : α) : Ici a := ⟨max a x, le_max_left _ _⟩ #align set.proj_Ici Set.projIci def projIic (b x : α) : Iic b := ⟨min b x, min_le_left _ _⟩ #align set.proj_Iic Set.projIic def projIcc (a b : α) (h : a ≤ b) (x : α) : Icc a b := ⟨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)⟩ #align set.proj_Icc Set.projIcc variable {a b : α} (h : a ≤ b) {x : α} @[norm_cast] theorem coe_projIci (a x : α) : (projIci a x : α) = max a x := rfl #align set.coe_proj_Ici Set.coe_projIci @[norm_cast] theorem coe_projIic (b x : α) : (projIic b x : α) = min b x := rfl #align set.coe_proj_Iic Set.coe_projIic @[norm_cast] theorem coe_projIcc (a b : α) (h : a ≤ b) (x : α) : (projIcc a b h x : α) = max a (min b x) := rfl #align set.coe_proj_Icc Set.coe_projIcc theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩ := Subtype.ext <| max_eq_left hx #align set.proj_Ici_of_le Set.projIci_of_le theorem projIic_of_le (hx : b ≤ x) : projIic b x = ⟨b, le_rfl⟩ := Subtype.ext <| min_eq_left hx #align set.proj_Iic_of_le Set.projIic_of_le theorem projIcc_of_le_left (hx : x ≤ a) : projIcc a b h x = ⟨a, left_mem_Icc.2 h⟩ := by simp [projIcc, hx, hx.trans h] #align set.proj_Icc_of_le_left Set.projIcc_of_le_left theorem projIcc_of_right_le (hx : b ≤ x) : projIcc a b h x = ⟨b, right_mem_Icc.2 h⟩ := by simp [projIcc, hx, h] #align set.proj_Icc_of_right_le Set.projIcc_of_right_le @[simp] theorem projIci_self (a : α) : projIci a a = ⟨a, le_rfl⟩ := projIci_of_le le_rfl #align set.proj_Ici_self Set.projIci_self @[simp] theorem projIic_self (b : α) : projIic b b = ⟨b, le_rfl⟩ := projIic_of_le le_rfl #align set.proj_Iic_self Set.projIic_self @[simp] theorem projIcc_left : projIcc a b h a = ⟨a, left_mem_Icc.2 h⟩ := projIcc_of_le_left h le_rfl #align set.proj_Icc_left Set.projIcc_left @[simp] theorem projIcc_right : projIcc a b h b = ⟨b, right_mem_Icc.2 h⟩ := projIcc_of_right_le h le_rfl #align set.proj_Icc_right Set.projIcc_right theorem projIci_eq_self : projIci a x = ⟨a, le_rfl⟩ ↔ x ≤ a := by simp [projIci, Subtype.ext_iff] #align set.proj_Ici_eq_self Set.projIci_eq_self
Mathlib/Order/Interval/Set/ProjIcc.lean
102
102
theorem projIic_eq_self : projIic b x = ⟨b, le_rfl⟩ ↔ b ≤ x := by
simp [projIic, Subtype.ext_iff]
1
import Mathlib.Data.Matrix.Basic import Mathlib.Data.Matrix.RowCol import Mathlib.Data.Fin.VecNotation import Mathlib.Tactic.FinCases #align_import data.matrix.notation from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a" namespace Matrix universe u uₘ uₙ uₒ variable {α : Type u} {o n m : ℕ} {m' : Type uₘ} {n' : Type uₙ} {o' : Type uₒ} open Matrix variable (a b : ℕ) instance repr [Repr α] : Repr (Matrix (Fin m) (Fin n) α) where reprPrec f _p := (Std.Format.bracket "!![" · "]") <| (Std.Format.joinSep · (";" ++ Std.Format.line)) <| (List.finRange m).map fun i => Std.Format.fill <| -- wrap line in a single place rather than all at once (Std.Format.joinSep · ("," ++ Std.Format.line)) <| (List.finRange n).map fun j => _root_.repr (f i j) #align matrix.has_repr Matrix.repr @[simp] theorem cons_val' (v : n' → α) (B : Fin m → n' → α) (i j) : vecCons v B i j = vecCons (v j) (fun i => B i j) i := by refine Fin.cases ?_ ?_ i <;> simp #align matrix.cons_val' Matrix.cons_val' @[simp, nolint simpNF] -- Porting note: LHS does not simplify. theorem head_val' (B : Fin m.succ → n' → α) (j : n') : (vecHead fun i => B i j) = vecHead B j := rfl #align matrix.head_val' Matrix.head_val' @[simp, nolint simpNF] -- Porting note: LHS does not simplify. theorem tail_val' (B : Fin m.succ → n' → α) (j : n') : (vecTail fun i => B i j) = fun i => vecTail B i j := rfl #align matrix.tail_val' Matrix.tail_val' section DotProduct variable [AddCommMonoid α] [Mul α] @[simp] theorem dotProduct_empty (v w : Fin 0 → α) : dotProduct v w = 0 := Finset.sum_empty #align matrix.dot_product_empty Matrix.dotProduct_empty @[simp] theorem cons_dotProduct (x : α) (v : Fin n → α) (w : Fin n.succ → α) : dotProduct (vecCons x v) w = x * vecHead w + dotProduct v (vecTail w) := by simp [dotProduct, Fin.sum_univ_succ, vecHead, vecTail] #align matrix.cons_dot_product Matrix.cons_dotProduct @[simp]
Mathlib/Data/Matrix/Notation.lean
168
170
theorem dotProduct_cons (v : Fin n.succ → α) (x : α) (w : Fin n → α) : dotProduct v (vecCons x w) = vecHead v * x + dotProduct (vecTail v) w := by
simp [dotProduct, Fin.sum_univ_succ, vecHead, vecTail]
1
import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Hom.Set #align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" open Set namespace OrderIso section Preorder variable {α β : Type*} [Preorder α] [Preorder β] @[simp] theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by ext x simp [← e.le_iff_le] #align order_iso.preimage_Iic OrderIso.preimage_Iic @[simp] theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by ext x simp [← e.le_iff_le] #align order_iso.preimage_Ici OrderIso.preimage_Ici @[simp] theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by ext x simp [← e.lt_iff_lt] #align order_iso.preimage_Iio OrderIso.preimage_Iio @[simp] theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by ext x simp [← e.lt_iff_lt] #align order_iso.preimage_Ioi OrderIso.preimage_Ioi @[simp] theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by simp [← Ici_inter_Iic] #align order_iso.preimage_Icc OrderIso.preimage_Icc @[simp] theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by simp [← Ici_inter_Iio] #align order_iso.preimage_Ico OrderIso.preimage_Ico @[simp] theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by simp [← Ioi_inter_Iic] #align order_iso.preimage_Ioc OrderIso.preimage_Ioc @[simp] theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by simp [← Ioi_inter_Iio] #align order_iso.preimage_Ioo OrderIso.preimage_Ioo @[simp] theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm] #align order_iso.image_Iic OrderIso.image_Iic @[simp] theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) := e.dual.image_Iic a #align order_iso.image_Ici OrderIso.image_Ici @[simp] theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm] #align order_iso.image_Iio OrderIso.image_Iio @[simp] theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) := e.dual.image_Iio a #align order_iso.image_Ioi OrderIso.image_Ioi @[simp] theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm] #align order_iso.image_Ioo OrderIso.image_Ioo @[simp] theorem image_Ioc (e : α ≃o β) (a b : α) : e '' Ioc a b = Ioc (e a) (e b) := by rw [e.image_eq_preimage, e.symm.preimage_Ioc, e.symm_symm] #align order_iso.image_Ioc OrderIso.image_Ioc @[simp] theorem image_Ico (e : α ≃o β) (a b : α) : e '' Ico a b = Ico (e a) (e b) := by rw [e.image_eq_preimage, e.symm.preimage_Ico, e.symm_symm] #align order_iso.image_Ico OrderIso.image_Ico @[simp]
Mathlib/Order/Interval/Set/OrderIso.lean
103
104
theorem image_Icc (e : α ≃o β) (a b : α) : e '' Icc a b = Icc (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Icc, e.symm_symm]
1
import Mathlib.Topology.Order.Basic open Set Filter OrderDual open scoped Topology section OrderClosedTopology variable {α : Type*} [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] {a b c d : α} @[simp] theorem nhdsSet_Ioi : 𝓝ˢ (Ioi a) = 𝓟 (Ioi a) := isOpen_Ioi.nhdsSet_eq @[simp] theorem nhdsSet_Iio : 𝓝ˢ (Iio a) = 𝓟 (Iio a) := isOpen_Iio.nhdsSet_eq @[simp] theorem nhdsSet_Ioo : 𝓝ˢ (Ioo a b) = 𝓟 (Ioo a b) := isOpen_Ioo.nhdsSet_eq theorem nhdsSet_Ici : 𝓝ˢ (Ici a) = 𝓝 a ⊔ 𝓟 (Ioi a) := by rw [← Ioi_insert, nhdsSet_insert, nhdsSet_Ioi] theorem nhdsSet_Iic : 𝓝ˢ (Iic a) = 𝓝 a ⊔ 𝓟 (Iio a) := nhdsSet_Ici (α := αᵒᵈ) theorem nhdsSet_Ico (h : a < b) : 𝓝ˢ (Ico a b) = 𝓝 a ⊔ 𝓟 (Ioo a b) := by rw [← Ioo_insert_left h, nhdsSet_insert, nhdsSet_Ioo]
Mathlib/Topology/Order/NhdsSet.lean
44
45
theorem nhdsSet_Ioc (h : a < b) : 𝓝ˢ (Ioc a b) = 𝓝 b ⊔ 𝓟 (Ioo a b) := by
rw [← Ioo_insert_right h, nhdsSet_insert, nhdsSet_Ioo]
1
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic suppress_compilation open Bornology open Filter hiding map_smul open scoped Classical NNReal Topology Uniformity -- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*} section SemiNormed open Metric ContinuousLinearMap variable [SeminormedAddCommGroup E] [SeminormedAddCommGroup Eₗ] [SeminormedAddCommGroup F] [SeminormedAddCommGroup Fₗ] [SeminormedAddCommGroup G] [SeminormedAddCommGroup Gₗ] variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃] [NormedSpace 𝕜 E] [NormedSpace 𝕜 Eₗ] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜 Fₗ] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Gₗ] {σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} {σ₁₃ : 𝕜 →+* 𝕜₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃] variable [FunLike 𝓕 E F] namespace ContinuousLinearMap section OpNorm open Set Real section variable [RingHomIsometric σ₁₂] [RingHomIsometric σ₂₃] (f g : E →SL[σ₁₂] F) (h : F →SL[σ₂₃] G) (x : E) theorem nnnorm_def (f : E →SL[σ₁₂] F) : ‖f‖₊ = sInf { c | ∀ x, ‖f x‖₊ ≤ c * ‖x‖₊ } := by ext rw [NNReal.coe_sInf, coe_nnnorm, norm_def, NNReal.coe_image] simp_rw [← NNReal.coe_le_coe, NNReal.coe_mul, coe_nnnorm, mem_setOf_eq, NNReal.coe_mk, exists_prop] #align continuous_linear_map.nnnorm_def ContinuousLinearMap.nnnorm_def theorem opNNNorm_le_bound (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖f x‖₊ ≤ M * ‖x‖₊) : ‖f‖₊ ≤ M := opNorm_le_bound f (zero_le M) hM #align continuous_linear_map.op_nnnorm_le_bound ContinuousLinearMap.opNNNorm_le_bound @[deprecated (since := "2024-02-02")] alias op_nnnorm_le_bound := opNNNorm_le_bound theorem opNNNorm_le_bound' (f : E →SL[σ₁₂] F) (M : ℝ≥0) (hM : ∀ x, ‖x‖₊ ≠ 0 → ‖f x‖₊ ≤ M * ‖x‖₊) : ‖f‖₊ ≤ M := opNorm_le_bound' f (zero_le M) fun x hx => hM x <| by rwa [← NNReal.coe_ne_zero] #align continuous_linear_map.op_nnnorm_le_bound' ContinuousLinearMap.opNNNorm_le_bound' @[deprecated (since := "2024-02-02")] alias op_nnnorm_le_bound' := opNNNorm_le_bound' theorem opNNNorm_le_of_unit_nnnorm [NormedSpace ℝ E] [NormedSpace ℝ F] {f : E →L[ℝ] F} {C : ℝ≥0} (hf : ∀ x, ‖x‖₊ = 1 → ‖f x‖₊ ≤ C) : ‖f‖₊ ≤ C := opNorm_le_of_unit_norm C.coe_nonneg fun x hx => hf x <| by rwa [← NNReal.coe_eq_one] #align continuous_linear_map.op_nnnorm_le_of_unit_nnnorm ContinuousLinearMap.opNNNorm_le_of_unit_nnnorm @[deprecated (since := "2024-02-02")] alias op_nnnorm_le_of_unit_nnnorm := opNNNorm_le_of_unit_nnnorm theorem opNNNorm_le_of_lipschitz {f : E →SL[σ₁₂] F} {K : ℝ≥0} (hf : LipschitzWith K f) : ‖f‖₊ ≤ K := opNorm_le_of_lipschitz hf #align continuous_linear_map.op_nnnorm_le_of_lipschitz ContinuousLinearMap.opNNNorm_le_of_lipschitz @[deprecated (since := "2024-02-02")] alias op_nnnorm_le_of_lipschitz := opNNNorm_le_of_lipschitz theorem opNNNorm_eq_of_bounds {φ : E →SL[σ₁₂] F} (M : ℝ≥0) (h_above : ∀ x, ‖φ x‖₊ ≤ M * ‖x‖₊) (h_below : ∀ N, (∀ x, ‖φ x‖₊ ≤ N * ‖x‖₊) → M ≤ N) : ‖φ‖₊ = M := Subtype.ext <| opNorm_eq_of_bounds (zero_le M) h_above <| Subtype.forall'.mpr h_below #align continuous_linear_map.op_nnnorm_eq_of_bounds ContinuousLinearMap.opNNNorm_eq_of_bounds @[deprecated (since := "2024-02-02")] alias op_nnnorm_eq_of_bounds := opNNNorm_eq_of_bounds theorem opNNNorm_le_iff {f : E →SL[σ₁₂] F} {C : ℝ≥0} : ‖f‖₊ ≤ C ↔ ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊ := opNorm_le_iff C.2 @[deprecated (since := "2024-02-02")] alias op_nnnorm_le_iff := opNNNorm_le_iff
Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean
100
101
theorem isLeast_opNNNorm : IsLeast {C : ℝ≥0 | ∀ x, ‖f x‖₊ ≤ C * ‖x‖₊} ‖f‖₊ := by
simpa only [← opNNNorm_le_iff] using isLeast_Ici
1
import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.Complex.Circle import Mathlib.Analysis.InnerProductSpace.l2Space import Mathlib.MeasureTheory.Function.ContinuousMapDense import Mathlib.MeasureTheory.Function.L2Space import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Integral.Periodic import Mathlib.Topology.ContinuousFunction.StoneWeierstrass import Mathlib.MeasureTheory.Integral.FundThmCalculus #align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section open scoped ENNReal ComplexConjugate Real open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set variable {T : ℝ} open AddCircle section Monomials def fourier (n : ℤ) : C(AddCircle T, ℂ) where toFun x := toCircle (n • x :) continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _ #align fourier fourier @[simp] theorem fourier_apply {n : ℤ} {x : AddCircle T} : fourier n x = toCircle (n • x :) := rfl #align fourier_apply fourier_apply -- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'` theorem fourier_coe_apply {n : ℤ} {x : ℝ} : fourier n (x : AddCircle T) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [fourier_apply, ← QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe, expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul, Complex.ofReal_mul, Complex.ofReal_intCast] norm_num congr 1; ring #align fourier_coe_apply fourier_coe_apply @[simp] theorem fourier_coe_apply' {n : ℤ} {x : ℝ} : toCircle (n • (x : AddCircle T) :) = Complex.exp (2 * π * Complex.I * n * x / T) := by rw [← fourier_apply]; exact fourier_coe_apply -- @[simp] -- Porting note: simp normal form is `fourier_zero'` theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by induction x using QuotientAddGroup.induction_on' simp only [fourier_coe_apply] norm_num #align fourier_zero fourier_zero @[simp] theorem fourier_zero' {x : AddCircle T} : @toCircle T 0 = (1 : ℂ) := by have : fourier 0 x = @toCircle T 0 := by rw [fourier_apply, zero_smul] rw [← this]; exact fourier_zero -- @[simp] -- Porting note: simp normal form is *also* `fourier_zero'` theorem fourier_eval_zero (n : ℤ) : fourier n (0 : AddCircle T) = 1 := by rw [← QuotientAddGroup.mk_zero, fourier_coe_apply, Complex.ofReal_zero, mul_zero, zero_div, Complex.exp_zero] #align fourier_eval_zero fourier_eval_zero -- @[simp] -- Porting note (#10618): simp can prove this theorem fourier_one {x : AddCircle T} : fourier 1 x = toCircle x := by rw [fourier_apply, one_zsmul] #align fourier_one fourier_one -- @[simp] -- Porting note: simp normal form is `fourier_neg'` theorem fourier_neg {n : ℤ} {x : AddCircle T} : fourier (-n) x = conj (fourier n x) := by induction x using QuotientAddGroup.induction_on' simp_rw [fourier_apply, toCircle] rw [← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_zsmul] simp_rw [Function.Periodic.lift_coe, ← coe_inv_circle_eq_conj, ← expMapCircle_neg, neg_smul, mul_neg] #align fourier_neg fourier_neg @[simp]
Mathlib/Analysis/Fourier/AddCircle.lean
163
164
theorem fourier_neg' {n : ℤ} {x : AddCircle T} : @toCircle T (-(n • x)) = conj (fourier n x) := by
rw [← neg_smul, ← fourier_apply]; exact fourier_neg
1
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5" noncomputable section open scoped NNReal ENNReal Pointwise Topology open Inv Set Function MeasureTheory.Measure Filter open FiniteDimensional namespace MeasureTheory namespace Measure example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by infer_instance variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {s : Set E} theorem integral_comp_smul (f : E → F) (R : ℝ) : ∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by by_cases hF : CompleteSpace F; swap · simp [integral, hF] rcases eq_or_ne R 0 with (rfl | hR) · simp only [zero_smul, integral_const] rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE) · have : Subsingleton E := finrank_zero_iff.1 hE have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0] conv_rhs => rw [this] simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const] · have : Nontrivial E := finrank_pos_iff.1 hE simp only [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, ENNReal.top_toReal, zero_smul, inv_zero, abs_zero] · calc (∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ := (integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv f).symm _ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg] #align measure_theory.measure.integral_comp_smul MeasureTheory.Measure.integral_comp_smul theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} : ∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))] #align measure_theory.measure.integral_comp_smul_of_nonneg MeasureTheory.Measure.integral_comp_smul_of_nonneg theorem integral_comp_inv_smul (f : E → F) (R : ℝ) : ∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv] #align measure_theory.measure.integral_comp_inv_smul MeasureTheory.Measure.integral_comp_inv_smul theorem integral_comp_inv_smul_of_nonneg (f : E → F) {R : ℝ} (hR : 0 ≤ R) : ∫ x, f (R⁻¹ • x) ∂μ = R ^ finrank ℝ E • ∫ x, f x ∂μ := by rw [integral_comp_inv_smul μ f R, abs_of_nonneg (pow_nonneg hR _)] #align measure_theory.measure.integral_comp_inv_smul_of_nonneg MeasureTheory.Measure.integral_comp_inv_smul_of_nonneg theorem setIntegral_comp_smul (f : E → F) {R : ℝ} (s : Set E) (hR : R ≠ 0) : ∫ x in s, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by let e : E ≃ᵐ E := (Homeomorph.smul (Units.mk0 R hR)).toMeasurableEquiv calc ∫ x in s, f (R • x) ∂μ = ∫ x in e ⁻¹' (e.symm ⁻¹' s), f (e x) ∂μ := by simp [← preimage_comp]; rfl _ = ∫ y in e.symm ⁻¹' s, f y ∂map (fun x ↦ R • x) μ := (setIntegral_map_equiv _ _ _).symm _ = |(R ^ finrank ℝ E)⁻¹| • ∫ y in e.symm ⁻¹' s, f y ∂μ := by simp [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg] _ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by congr ext y rw [mem_smul_set_iff_inv_smul_mem₀ hR] rfl @[deprecated (since := "2024-04-17")] alias set_integral_comp_smul := setIntegral_comp_smul
Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean
128
130
theorem setIntegral_comp_smul_of_pos (f : E → F) {R : ℝ} (s : Set E) (hR : 0 < R) : ∫ x in s, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x in R • s, f x ∂μ := by
rw [setIntegral_comp_smul μ f s hR.ne', abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR.le _))]
1