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
eval_complexity
float64
0
1
import Aesop import Mathlib.Algebra.Group.Defs import Mathlib.Data.Nat.Defs import Mathlib.Data.Int.Defs import Mathlib.Logic.Function.Basic import Mathlib.Tactic.Cases import Mathlib.Tactic.SimpRw import Mathlib.Tactic.SplitIfs #align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open Function universe u variable {α β G M : Type*} @[to_additive] instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩ #align comm_semigroup.to_is_commutative CommMagma.to_isCommutative #align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative section CommSemigroup variable [CommSemigroup G] @[to_additive] theorem mul_left_comm : ∀ a b c : G, a * (b * c) = b * (a * c) := left_comm Mul.mul mul_comm mul_assoc #align mul_left_comm mul_left_comm #align add_left_comm add_left_comm @[to_additive] theorem mul_right_comm : ∀ a b c : G, a * b * c = a * c * b := right_comm Mul.mul mul_comm mul_assoc #align mul_right_comm mul_right_comm #align add_right_comm add_right_comm @[to_additive] theorem mul_mul_mul_comm (a b c d : G) : a * b * (c * d) = a * c * (b * d) := by simp only [mul_left_comm, mul_assoc] #align mul_mul_mul_comm mul_mul_mul_comm #align add_add_add_comm add_add_add_comm @[to_additive] theorem mul_rotate (a b c : G) : a * b * c = b * c * a := by simp only [mul_left_comm, mul_comm] #align mul_rotate mul_rotate #align add_rotate add_rotate @[to_additive]
Mathlib/Algebra/Group/Basic.lean
208
209
theorem mul_rotate' (a b c : G) : a * (b * c) = b * (c * a) := by
simp only [mul_left_comm, mul_comm]
0.65625
import Mathlib.Algebra.Group.Defs import Mathlib.Control.Functor #align_import control.applicative from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w section Lemmas open Function variable {F : Type u → Type v} variable [Applicative F] [LawfulApplicative F] variable {α β γ σ : Type u}
Mathlib/Control/Applicative.lean
31
33
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) : f <$> x <*> g <$> y = ((· ∘ g) ∘ f) <$> x <*> y := by
simp [flip, functor_norm]
0.65625
import Mathlib.Topology.Order.IsLUB open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section DenselyOrdered variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α} {s : Set α} theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by apply Subset.antisymm · exact closure_minimal Ioi_subset_Ici_self isClosed_Ici · rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff] exact isGLB_Ioi.mem_closure h #align closure_Ioi' closure_Ioi' @[simp] theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a := closure_Ioi' nonempty_Ioi #align closure_Ioi closure_Ioi theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a := closure_Ioi' (α := αᵒᵈ) h #align closure_Iio' closure_Iio' @[simp] theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a := closure_Iio' nonempty_Iio #align closure_Iio closure_Iio @[simp] theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ioo_subset_Icc_self isClosed_Icc · cases' hab.lt_or_lt with hab hab · rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le] have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab simp only [insert_subset_iff, singleton_subset_iff] exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩ · rw [Icc_eq_empty_of_lt hab] exact empty_subset _ #align closure_Ioo closure_Ioo @[simp] theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ioc_subset_Icc_self isClosed_Icc · apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self) rw [closure_Ioo hab] #align closure_Ioc closure_Ioc @[simp] theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ico_subset_Icc_self isClosed_Icc · apply Subset.trans _ (closure_mono Ioo_subset_Ico_self) rw [closure_Ioo hab] #align closure_Ico closure_Ico @[simp] theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic] #align interior_Ici' interior_Ici' theorem interior_Ici [NoMinOrder α] {a : α} : interior (Ici a) = Ioi a := interior_Ici' nonempty_Iio #align interior_Ici interior_Ici @[simp] theorem interior_Iic' {a : α} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a := interior_Ici' (α := αᵒᵈ) ha #align interior_Iic' interior_Iic' theorem interior_Iic [NoMaxOrder α] {a : α} : interior (Iic a) = Iio a := interior_Iic' nonempty_Ioi #align interior_Iic interior_Iic @[simp] theorem interior_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} : interior (Icc a b) = Ioo a b := by rw [← Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio] #align interior_Icc interior_Icc @[simp] theorem Icc_mem_nhds_iff [NoMinOrder α] [NoMaxOrder α] {a b x : α} : Icc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Icc, mem_interior_iff_mem_nhds] @[simp] theorem interior_Ico [NoMinOrder α] {a b : α} : interior (Ico a b) = Ioo a b := by rw [← Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio] #align interior_Ico interior_Ico @[simp] theorem Ico_mem_nhds_iff [NoMinOrder α] {a b x : α} : Ico a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Ico, mem_interior_iff_mem_nhds] @[simp] theorem interior_Ioc [NoMaxOrder α] {a b : α} : interior (Ioc a b) = Ioo a b := by rw [← Ioi_inter_Iic, interior_inter, interior_Ioi, interior_Iic, Ioi_inter_Iio] #align interior_Ioc interior_Ioc @[simp] theorem Ioc_mem_nhds_iff [NoMaxOrder α] {a b x : α} : Ioc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Ioc, mem_interior_iff_mem_nhds] theorem closure_interior_Icc {a b : α} (h : a ≠ b) : closure (interior (Icc a b)) = Icc a b := (closure_minimal interior_subset isClosed_Icc).antisymm <| calc Icc a b = closure (Ioo a b) := (closure_Ioo h).symm _ ⊆ closure (interior (Icc a b)) := closure_mono (interior_maximal Ioo_subset_Icc_self isOpen_Ioo) #align closure_interior_Icc closure_interior_Icc theorem Ioc_subset_closure_interior (a b : α) : Ioc a b ⊆ closure (interior (Ioc a b)) := by rcases eq_or_ne a b with (rfl | h) · simp · calc Ioc a b ⊆ Icc a b := Ioc_subset_Icc_self _ = closure (Ioo a b) := (closure_Ioo h).symm _ ⊆ closure (interior (Ioc a b)) := closure_mono (interior_maximal Ioo_subset_Ioc_self isOpen_Ioo) #align Ioc_subset_closure_interior Ioc_subset_closure_interior
Mathlib/Topology/Order/DenselyOrdered.lean
146
147
theorem Ico_subset_closure_interior (a b : α) : Ico a b ⊆ closure (interior (Ico a b)) := by
simpa only [dual_Ioc] using Ioc_subset_closure_interior (OrderDual.toDual b) (OrderDual.toDual a)
0.65625
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap ℚ A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap ℚ A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap ℚ A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A'] (n : ℕ) (f : A →+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap ℚ A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_cos_bit0 PowerSeries.coeff_cos_bit0 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit1 : coeff A (bit1 n) (cos A) = 0 := by rw [cos, coeff_mk, if_neg n.not_even_bit1] #align power_series.coeff_cos_bit1 PowerSeries.coeff_cos_bit1 @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
206
208
theorem map_exp : map (f : A →+* A') (exp A) = exp A' := by
ext simp
0.65625
import Mathlib.Logic.Equiv.Option import Mathlib.Order.RelIso.Basic import Mathlib.Order.Disjoint import Mathlib.Order.WithBot import Mathlib.Tactic.Monotonicity.Attr import Mathlib.Util.AssertExists #align_import order.hom.basic from "leanprover-community/mathlib"@"62a5626868683c104774de8d85b9855234ac807c" open OrderDual variable {F α β γ δ : Type*} structure OrderHom (α β : Type*) [Preorder α] [Preorder β] where toFun : α → β monotone' : Monotone toFun #align order_hom OrderHom infixr:25 " →o " => OrderHom abbrev OrderEmbedding (α β : Type*) [LE α] [LE β] := @RelEmbedding α β (· ≤ ·) (· ≤ ·) #align order_embedding OrderEmbedding infixl:25 " ↪o " => OrderEmbedding abbrev OrderIso (α β : Type*) [LE α] [LE β] := @RelIso α β (· ≤ ·) (· ≤ ·) #align order_iso OrderIso infixl:25 " ≃o " => OrderIso section abbrev OrderHomClass (F : Type*) (α β : outParam Type*) [LE α] [LE β] [FunLike F α β] := RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop) #align order_hom_class OrderHomClass class OrderIsoClass (F α β : Type*) [LE α] [LE β] [EquivLike F α β] : Prop where map_le_map_iff (f : F) {a b : α} : f a ≤ f b ↔ a ≤ b #align order_iso_class OrderIsoClass end export OrderIsoClass (map_le_map_iff) attribute [simp] map_le_map_iff @[coe] def OrderIsoClass.toOrderIso [LE α] [LE β] [EquivLike F α β] [OrderIsoClass F α β] (f : F) : α ≃o β := { EquivLike.toEquiv f with map_rel_iff' := map_le_map_iff f } instance [LE α] [LE β] [EquivLike F α β] [OrderIsoClass F α β] : CoeTC F (α ≃o β) := ⟨OrderIsoClass.toOrderIso⟩ -- See note [lower instance priority] instance (priority := 100) OrderIsoClass.toOrderHomClass [LE α] [LE β] [EquivLike F α β] [OrderIsoClass F α β] : OrderHomClass F α β := { EquivLike.toEmbeddingLike (E := F) with map_rel := fun f _ _ => (map_le_map_iff f).2 } #align order_iso_class.to_order_hom_class OrderIsoClass.toOrderHomClass section OrderIsoClass variable [Preorder α] [Preorder β] [EquivLike F α β] [OrderIsoClass F α β] theorem map_lt_map_iff (f : F) {a b : α} : f a < f b ↔ a < b := lt_iff_lt_of_le_iff_le' (map_le_map_iff f) (map_le_map_iff f) #align map_lt_map_iff map_lt_map_iff @[simp] theorem map_inv_lt_iff (f : F) {a : α} {b : β} : EquivLike.inv f b < a ↔ b < f a := by rw [← map_lt_map_iff f] simp only [EquivLike.apply_inv_apply] #align map_inv_lt_iff map_inv_lt_iff @[simp]
Mathlib/Order/Hom/Basic.lean
207
209
theorem lt_map_inv_iff (f : F) {a : α} {b : β} : a < EquivLike.inv f b ↔ f a < b := by
rw [← map_lt_map_iff f] simp only [EquivLike.apply_inv_apply]
0.65625
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Tactic.LinearCombination #align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946" namespace Polynomial.Chebyshev set_option linter.uppercaseLean3 false -- `T` `U` `X` open Polynomial variable (R S : Type*) [CommRing R] [CommRing S] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def T : ℤ → R[X] | 0 => 1 | 1 => X | (n : ℕ) + 2 => 2 * X * T (n + 1) - T n | -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.T Polynomial.Chebyshev.T @[elab_as_elim] protected theorem induct (motive : ℤ → Prop) (zero : motive 0) (one : motive 1) (add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2)) (neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) : ∀ (a : ℤ), motive a := T.induct Unit motive zero one add_two fun n hn hnm => by simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm @[simp] theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n | (k : ℕ) => T.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k #align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by linear_combination (norm := ring_nf) T_add_two R (n - 2) theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by linear_combination (norm := ring_nf) T_add_two R (n - 2) #align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq @[simp] theorem T_zero : T R 0 = 1 := rfl #align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero @[simp] theorem T_one : T R 1 = X := rfl #align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X) theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simpa [pow_two, mul_assoc] using T_add_two R 0 #align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two @[simp] theorem T_neg (n : ℤ) : T R (-n) = T R n := by induction n using Polynomial.Chebyshev.induct with | zero => rfl | one => show 2 * X * 1 - X = X; ring | add_two n ih1 ih2 => have h₁ := T_add_two R n have h₂ := T_sub_two R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 - h₁ + h₂ | neg_add_one n ih1 ih2 => have h₁ := T_add_one R n have h₂ := T_sub_one R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 + h₁ - h₂ theorem T_natAbs (n : ℤ) : T R n.natAbs = T R n := by obtain h | h := Int.natAbs_eq n <;> nth_rw 2 [h]; simp theorem T_neg_two : T R (-2) = 2 * X ^ 2 - 1 := by simp [T_two] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def U : ℤ → R[X] | 0 => 1 | 1 => 2 * X | (n : ℕ) + 2 => 2 * X * U (n + 1) - U n | -((n : ℕ) + 1) => 2 * X * U (-n) - U (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.U Polynomial.Chebyshev.U @[simp] theorem U_add_two : ∀ n, U R (n + 2) = 2 * X * U R (n + 1) - U R n | (k : ℕ) => U.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) U.eq_4 R k
Mathlib/RingTheory/Polynomial/Chebyshev.lean
153
154
theorem U_add_one (n : ℤ) : U R (n + 1) = 2 * X * U R n - U R (n - 1) := by
linear_combination (norm := ring_nf) U_add_two R (n - 1)
0.65625
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import analysis.inner_product_space.adjoint from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open RCLike open scoped ComplexConjugate variable {𝕜 E F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] variable [InnerProductSpace 𝕜 E] [InnerProductSpace 𝕜 F] [InnerProductSpace 𝕜 G] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y open InnerProductSpace namespace ContinuousLinearMap variable [CompleteSpace E] [CompleteSpace G] -- Note: made noncomputable to stop excess compilation -- leanprover-community/mathlib4#7103 noncomputable def adjointAux : (E →L[𝕜] F) →L⋆[𝕜] F →L[𝕜] E := (ContinuousLinearMap.compSL _ _ _ _ _ ((toDual 𝕜 E).symm : NormedSpace.Dual 𝕜 E →L⋆[𝕜] E)).comp (toSesqForm : (E →L[𝕜] F) →L[𝕜] F →L⋆[𝕜] NormedSpace.Dual 𝕜 E) #align continuous_linear_map.adjoint_aux ContinuousLinearMap.adjointAux @[simp] theorem adjointAux_apply (A : E →L[𝕜] F) (x : F) : adjointAux A x = ((toDual 𝕜 E).symm : NormedSpace.Dual 𝕜 E → E) ((toSesqForm A) x) := rfl #align continuous_linear_map.adjoint_aux_apply ContinuousLinearMap.adjointAux_apply theorem adjointAux_inner_left (A : E →L[𝕜] F) (x : E) (y : F) : ⟪adjointAux A y, x⟫ = ⟪y, A x⟫ := by rw [adjointAux_apply, toDual_symm_apply, toSesqForm_apply_coe, coe_comp', innerSL_apply_coe, Function.comp_apply] #align continuous_linear_map.adjoint_aux_inner_left ContinuousLinearMap.adjointAux_inner_left theorem adjointAux_inner_right (A : E →L[𝕜] F) (x : E) (y : F) : ⟪x, adjointAux A y⟫ = ⟪A x, y⟫ := by rw [← inner_conj_symm, adjointAux_inner_left, inner_conj_symm] #align continuous_linear_map.adjoint_aux_inner_right ContinuousLinearMap.adjointAux_inner_right variable [CompleteSpace F]
Mathlib/Analysis/InnerProductSpace/Adjoint.lean
92
95
theorem adjointAux_adjointAux (A : E →L[𝕜] F) : adjointAux (adjointAux A) = A := by
ext v refine ext_inner_left 𝕜 fun w => ?_ rw [adjointAux_inner_right, adjointAux_inner_left]
0.65625
import Mathlib.Combinatorics.Young.YoungDiagram #align_import combinatorics.young.semistandard_tableau from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205" structure SemistandardYoungTableau (μ : YoungDiagram) where entry : ℕ → ℕ → ℕ row_weak' : ∀ {i j1 j2 : ℕ}, j1 < j2 → (i, j2) ∈ μ → entry i j1 ≤ entry i j2 col_strict' : ∀ {i1 i2 j : ℕ}, i1 < i2 → (i2, j) ∈ μ → entry i1 j < entry i2 j zeros' : ∀ {i j}, (i, j) ∉ μ → entry i j = 0 #align ssyt SemistandardYoungTableau namespace SemistandardYoungTableau instance instFunLike {μ : YoungDiagram} : FunLike (SemistandardYoungTableau μ) ℕ (ℕ → ℕ) where coe := SemistandardYoungTableau.entry coe_injective' T T' h := by cases T cases T' congr #align ssyt.fun_like SemistandardYoungTableau.instFunLike instance {μ : YoungDiagram} : CoeFun (SemistandardYoungTableau μ) fun _ ↦ ℕ → ℕ → ℕ := inferInstance @[simp] theorem to_fun_eq_coe {μ : YoungDiagram} {T : SemistandardYoungTableau μ} : T.entry = (T : ℕ → ℕ → ℕ) := rfl #align ssyt.to_fun_eq_coe SemistandardYoungTableau.to_fun_eq_coe @[ext] theorem ext {μ : YoungDiagram} {T T' : SemistandardYoungTableau μ} (h : ∀ i j, T i j = T' i j) : T = T' := DFunLike.ext T T' fun _ ↦ by funext apply h #align ssyt.ext SemistandardYoungTableau.ext protected def copy {μ : YoungDiagram} (T : SemistandardYoungTableau μ) (entry' : ℕ → ℕ → ℕ) (h : entry' = T) : SemistandardYoungTableau μ where entry := entry' row_weak' := h.symm ▸ T.row_weak' col_strict' := h.symm ▸ T.col_strict' zeros' := h.symm ▸ T.zeros' #align ssyt.copy SemistandardYoungTableau.copy @[simp] theorem coe_copy {μ : YoungDiagram} (T : SemistandardYoungTableau μ) (entry' : ℕ → ℕ → ℕ) (h : entry' = T) : ⇑(T.copy entry' h) = entry' := rfl #align ssyt.coe_copy SemistandardYoungTableau.coe_copy theorem copy_eq {μ : YoungDiagram} (T : SemistandardYoungTableau μ) (entry' : ℕ → ℕ → ℕ) (h : entry' = T) : T.copy entry' h = T := DFunLike.ext' h #align ssyt.copy_eq SemistandardYoungTableau.copy_eq theorem row_weak {μ : YoungDiagram} (T : SemistandardYoungTableau μ) {i j1 j2 : ℕ} (hj : j1 < j2) (hcell : (i, j2) ∈ μ) : T i j1 ≤ T i j2 := T.row_weak' hj hcell #align ssyt.row_weak SemistandardYoungTableau.row_weak theorem col_strict {μ : YoungDiagram} (T : SemistandardYoungTableau μ) {i1 i2 j : ℕ} (hi : i1 < i2) (hcell : (i2, j) ∈ μ) : T i1 j < T i2 j := T.col_strict' hi hcell #align ssyt.col_strict SemistandardYoungTableau.col_strict theorem zeros {μ : YoungDiagram} (T : SemistandardYoungTableau μ) {i j : ℕ} (not_cell : (i, j) ∉ μ) : T i j = 0 := T.zeros' not_cell #align ssyt.zeros SemistandardYoungTableau.zeros theorem row_weak_of_le {μ : YoungDiagram} (T : SemistandardYoungTableau μ) {i j1 j2 : ℕ} (hj : j1 ≤ j2) (cell : (i, j2) ∈ μ) : T i j1 ≤ T i j2 := by cases' eq_or_lt_of_le hj with h h · rw [h] · exact T.row_weak h cell #align ssyt.row_weak_of_le SemistandardYoungTableau.row_weak_of_le
Mathlib/Combinatorics/Young/SemistandardTableau.lean
136
140
theorem col_weak {μ : YoungDiagram} (T : SemistandardYoungTableau μ) {i1 i2 j : ℕ} (hi : i1 ≤ i2) (cell : (i2, j) ∈ μ) : T i1 j ≤ T i2 j := by
cases' eq_or_lt_of_le hi with h h · rw [h] · exact le_of_lt (T.col_strict h cell)
0.65625
import Mathlib.Data.Nat.Bitwise import Mathlib.SetTheory.Game.Birthday import Mathlib.SetTheory.Game.Impartial #align_import set_theory.game.nim from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" noncomputable section universe u namespace SetTheory open scoped PGame namespace PGame -- Uses `noncomputable!` to avoid `rec_fn_macro only allowed in meta definitions` VM error noncomputable def nim : Ordinal.{u} → PGame.{u} | o₁ => let f o₂ := have _ : Ordinal.typein o₁.out.r o₂ < o₁ := Ordinal.typein_lt_self o₂ nim (Ordinal.typein o₁.out.r o₂) ⟨o₁.out.α, o₁.out.α, f, f⟩ termination_by o => o #align pgame.nim SetTheory.PGame.nim open Ordinal theorem nim_def (o : Ordinal) : have : IsWellOrder (Quotient.out o).α (· < ·) := inferInstance nim o = PGame.mk o.out.α o.out.α (fun o₂ => nim (Ordinal.typein (· < ·) o₂)) fun o₂ => nim (Ordinal.typein (· < ·) o₂) := by rw [nim]; rfl #align pgame.nim_def SetTheory.PGame.nim_def theorem leftMoves_nim (o : Ordinal) : (nim o).LeftMoves = o.out.α := by rw [nim_def]; rfl #align pgame.left_moves_nim SetTheory.PGame.leftMoves_nim theorem rightMoves_nim (o : Ordinal) : (nim o).RightMoves = o.out.α := by rw [nim_def]; rfl #align pgame.right_moves_nim SetTheory.PGame.rightMoves_nim theorem moveLeft_nim_hEq (o : Ordinal) : have : IsWellOrder (Quotient.out o).α (· < ·) := inferInstance HEq (nim o).moveLeft fun i : o.out.α => nim (typein (· < ·) i) := by rw [nim_def]; rfl #align pgame.move_left_nim_heq SetTheory.PGame.moveLeft_nim_hEq
Mathlib/SetTheory/Game/Nim.lean
78
80
theorem moveRight_nim_hEq (o : Ordinal) : have : IsWellOrder (Quotient.out o).α (· < ·) := inferInstance HEq (nim o).moveRight fun i : o.out.α => nim (typein (· < ·) i) := by
rw [nim_def]; rfl
0.65625
import Mathlib.Order.ConditionallyCompleteLattice.Finset import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.lattice from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54" assert_not_exists MonoidWithZero open Set namespace Nat open scoped Classical noncomputable instance : InfSet ℕ := ⟨fun s ↦ if h : ∃ n, n ∈ s then @Nat.find (fun n ↦ n ∈ s) _ h else 0⟩ noncomputable instance : SupSet ℕ := ⟨fun s ↦ if h : ∃ n, ∀ a ∈ s, a ≤ n then @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h else 0⟩ theorem sInf_def {s : Set ℕ} (h : s.Nonempty) : sInf s = @Nat.find (fun n ↦ n ∈ s) _ h := dif_pos _ #align nat.Inf_def Nat.sInf_def theorem sSup_def {s : Set ℕ} (h : ∃ n, ∀ a ∈ s, a ≤ n) : sSup s = @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h := dif_pos _ #align nat.Sup_def Nat.sSup_def theorem _root_.Set.Infinite.Nat.sSup_eq_zero {s : Set ℕ} (h : s.Infinite) : sSup s = 0 := dif_neg fun ⟨n, hn⟩ ↦ let ⟨k, hks, hk⟩ := h.exists_gt n (hn k hks).not_lt hk #align set.infinite.nat.Sup_eq_zero Set.Infinite.Nat.sSup_eq_zero @[simp] theorem sInf_eq_zero {s : Set ℕ} : sInf s = 0 ↔ 0 ∈ s ∨ s = ∅ := by cases eq_empty_or_nonempty s with | inl h => subst h simp only [or_true_iff, eq_self_iff_true, iff_true_iff, iInf, InfSet.sInf, mem_empty_iff_false, exists_false, dif_neg, not_false_iff] | inr h => simp only [h.ne_empty, or_false_iff, Nat.sInf_def, h, Nat.find_eq_zero] #align nat.Inf_eq_zero Nat.sInf_eq_zero @[simp] theorem sInf_empty : sInf ∅ = 0 := by rw [sInf_eq_zero] right rfl #align nat.Inf_empty Nat.sInf_empty @[simp] theorem iInf_of_empty {ι : Sort*} [IsEmpty ι] (f : ι → ℕ) : iInf f = 0 := by rw [iInf_of_isEmpty, sInf_empty] #align nat.infi_of_empty Nat.iInf_of_empty @[simp] lemma iInf_const_zero {ι : Sort*} : ⨅ i : ι, 0 = 0 := (isEmpty_or_nonempty ι).elim (fun h ↦ by simp) fun h ↦ sInf_eq_zero.2 <| by simp theorem sInf_mem {s : Set ℕ} (h : s.Nonempty) : sInf s ∈ s := by rw [Nat.sInf_def h] exact Nat.find_spec h #align nat.Inf_mem Nat.sInf_mem theorem not_mem_of_lt_sInf {s : Set ℕ} {m : ℕ} (hm : m < sInf s) : m ∉ s := by cases eq_empty_or_nonempty s with | inl h => subst h; apply not_mem_empty | inr h => rw [Nat.sInf_def h] at hm; exact Nat.find_min h hm #align nat.not_mem_of_lt_Inf Nat.not_mem_of_lt_sInf protected theorem sInf_le {s : Set ℕ} {m : ℕ} (hm : m ∈ s) : sInf s ≤ m := by rw [Nat.sInf_def ⟨m, hm⟩] exact Nat.find_min' ⟨m, hm⟩ hm #align nat.Inf_le Nat.sInf_le
Mathlib/Data/Nat/Lattice.lean
91
98
theorem nonempty_of_pos_sInf {s : Set ℕ} (h : 0 < sInf s) : s.Nonempty := by
by_contra contra rw [Set.not_nonempty_iff_eq_empty] at contra have h' : sInf s ≠ 0 := ne_of_gt h apply h' rw [Nat.sInf_eq_zero] right assumption
0.65625
import Mathlib.Data.Nat.Factorization.Basic import Mathlib.Data.SetLike.Fintype import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.GroupTheory.PGroup import Mathlib.GroupTheory.NoncommPiCoprod import Mathlib.Order.Atoms.Finite import Mathlib.Data.Set.Lattice #align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" open Fintype MulAction Subgroup section InfiniteSylow variable (p : ℕ) (G : Type*) [Group G] structure Sylow extends Subgroup G where isPGroup' : IsPGroup p toSubgroup is_maximal' : ∀ {Q : Subgroup G}, IsPGroup p Q → toSubgroup ≤ Q → Q = toSubgroup #align sylow Sylow variable {p} {G} open Equiv Equiv.Perm Finset Function List QuotientGroup universe u v w variable {G : Type u} {α : Type v} {β : Type w} [Group G] attribute [local instance 10] Subtype.fintype setFintype Classical.propDecidable
Mathlib/GroupTheory/Sylow.lean
493
495
theorem QuotientGroup.card_preimage_mk [Fintype G] (s : Subgroup G) (t : Set (G ⧸ s)) : Fintype.card (QuotientGroup.mk ⁻¹' t) = Fintype.card s * Fintype.card t := by
rw [← Fintype.card_prod, Fintype.card_congr (preimageMkEquivSubgroupProdSet _ _)]
0.65625
import Mathlib.Data.List.Basic #align_import data.list.infix from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" open Nat variable {α β : Type*} namespace List variable {l l₁ l₂ l₃ : List α} {a b : α} {m n : ℕ} section Fix #align list.prefix_append List.prefix_append #align list.suffix_append List.suffix_append #align list.infix_append List.infix_append #align list.infix_append' List.infix_append' #align list.is_prefix.is_infix List.IsPrefix.isInfix #align list.is_suffix.is_infix List.IsSuffix.isInfix #align list.nil_prefix List.nil_prefix #align list.nil_suffix List.nil_suffix #align list.nil_infix List.nil_infix #align list.prefix_refl List.prefix_refl #align list.suffix_refl List.suffix_refl #align list.infix_refl List.infix_refl theorem prefix_rfl : l <+: l := prefix_refl _ #align list.prefix_rfl List.prefix_rfl theorem suffix_rfl : l <:+ l := suffix_refl _ #align list.suffix_rfl List.suffix_rfl theorem infix_rfl : l <:+: l := infix_refl _ #align list.infix_rfl List.infix_rfl #align list.suffix_cons List.suffix_cons
Mathlib/Data/List/Infix.lean
70
70
theorem prefix_concat (a : α) (l) : l <+: concat l a := by
simp
0.65625
import Mathlib.Algebra.CharP.Invertible import Mathlib.Analysis.NormedSpace.LinearIsometry import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.Analysis.NormedSpace.Basic import Mathlib.LinearAlgebra.AffineSpace.Restrict import Mathlib.Tactic.FailIfNoProgress #align_import analysis.normed_space.affine_isometry from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open Function Set variable (𝕜 : Type*) {V V₁ V₁' V₂ V₃ V₄ : Type*} {P₁ P₁' : Type*} (P P₂ : Type*) {P₃ P₄ : Type*} [NormedField 𝕜] [SeminormedAddCommGroup V] [NormedSpace 𝕜 V] [PseudoMetricSpace P] [NormedAddTorsor V P] [SeminormedAddCommGroup V₁] [NormedSpace 𝕜 V₁] [PseudoMetricSpace P₁] [NormedAddTorsor V₁ P₁] [SeminormedAddCommGroup V₁'] [NormedSpace 𝕜 V₁'] [MetricSpace P₁'] [NormedAddTorsor V₁' P₁'] [SeminormedAddCommGroup V₂] [NormedSpace 𝕜 V₂] [PseudoMetricSpace P₂] [NormedAddTorsor V₂ P₂] [SeminormedAddCommGroup V₃] [NormedSpace 𝕜 V₃] [PseudoMetricSpace P₃] [NormedAddTorsor V₃ P₃] [SeminormedAddCommGroup V₄] [NormedSpace 𝕜 V₄] [PseudoMetricSpace P₄] [NormedAddTorsor V₄ P₄] structure AffineIsometry extends P →ᵃ[𝕜] P₂ where norm_map : ∀ x : V, ‖linear x‖ = ‖x‖ #align affine_isometry AffineIsometry variable {𝕜 P P₂} @[inherit_doc] notation:25 -- `→ᵃᵢ` would be more consistent with the linear isometry notation, but it is uglier P " →ᵃⁱ[" 𝕜:25 "] " P₂:0 => AffineIsometry 𝕜 P P₂ namespace AffineIsometry variable (f : P →ᵃⁱ[𝕜] P₂) protected def linearIsometry : V →ₗᵢ[𝕜] V₂ := { f.linear with norm_map' := f.norm_map } #align affine_isometry.linear_isometry AffineIsometry.linearIsometry @[simp] theorem linear_eq_linearIsometry : f.linear = f.linearIsometry.toLinearMap := by ext rfl #align affine_isometry.linear_eq_linear_isometry AffineIsometry.linear_eq_linearIsometry instance : FunLike (P →ᵃⁱ[𝕜] P₂) P P₂ := { coe := fun f => f.toFun, coe_injective' := fun f g => by cases f; cases g; simp } @[simp] theorem coe_toAffineMap : ⇑f.toAffineMap = f := by rfl #align affine_isometry.coe_to_affine_map AffineIsometry.coe_toAffineMap
Mathlib/Analysis/NormedSpace/AffineIsometry.lean
86
88
theorem toAffineMap_injective : Injective (toAffineMap : (P →ᵃⁱ[𝕜] P₂) → P →ᵃ[𝕜] P₂) := by
rintro ⟨f, _⟩ ⟨g, _⟩ rfl rfl
0.65625
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Fintype.Fin import Mathlib.GroupTheory.GroupAction.Pi import Mathlib.Logic.Equiv.Fin #align_import algebra.big_operators.fin from "leanprover-community/mathlib"@"cc5dd6244981976cc9da7afc4eee5682b037a013" open Finset variable {α : Type*} {β : Type*} namespace Fin @[to_additive] theorem prod_ofFn [CommMonoid β] {n : ℕ} (f : Fin n → β) : (List.ofFn f).prod = ∏ i, f i := by simp [prod_eq_multiset_prod] #align fin.prod_of_fn Fin.prod_ofFn #align fin.sum_of_fn Fin.sum_ofFn @[to_additive] theorem prod_univ_def [CommMonoid β] {n : ℕ} (f : Fin n → β) : ∏ i, f i = ((List.finRange n).map f).prod := by rw [← List.ofFn_eq_map, prod_ofFn] #align fin.prod_univ_def Fin.prod_univ_def #align fin.sum_univ_def Fin.sum_univ_def @[to_additive "A sum of a function `f : Fin 0 → β` is `0` because `Fin 0` is empty"] theorem prod_univ_zero [CommMonoid β] (f : Fin 0 → β) : ∏ i, f i = 1 := rfl #align fin.prod_univ_zero Fin.prod_univ_zero #align fin.sum_univ_zero Fin.sum_univ_zero @[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of `f x`, for some `x : Fin (n + 1)` plus the remaining product"] theorem prod_univ_succAbove [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) (x : Fin (n + 1)) : ∏ i, f i = f x * ∏ i : Fin n, f (x.succAbove i) := by rw [univ_succAbove, prod_cons, Finset.prod_map _ x.succAboveEmb] rfl #align fin.prod_univ_succ_above Fin.prod_univ_succAbove #align fin.sum_univ_succ_above Fin.sum_univ_succAbove @[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of `f 0` plus the remaining product"] theorem prod_univ_succ [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) : ∏ i, f i = f 0 * ∏ i : Fin n, f i.succ := prod_univ_succAbove f 0 #align fin.prod_univ_succ Fin.prod_univ_succ #align fin.sum_univ_succ Fin.sum_univ_succ @[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of `f (Fin.last n)` plus the remaining sum"] theorem prod_univ_castSucc [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) : ∏ i, f i = (∏ i : Fin n, f (Fin.castSucc i)) * f (last n) := by simpa [mul_comm] using prod_univ_succAbove f (last n) #align fin.prod_univ_cast_succ Fin.prod_univ_castSucc #align fin.sum_univ_cast_succ Fin.sum_univ_castSucc @[to_additive (attr := simp)] theorem prod_univ_get [CommMonoid α] (l : List α) : ∏ i, l.get i = l.prod := by simp [Finset.prod_eq_multiset_prod] @[to_additive (attr := simp)] theorem prod_univ_get' [CommMonoid β] (l : List α) (f : α → β) : ∏ i, f (l.get i) = (l.map f).prod := by simp [Finset.prod_eq_multiset_prod] @[to_additive] theorem prod_cons [CommMonoid β] {n : ℕ} (x : β) (f : Fin n → β) : (∏ i : Fin n.succ, (cons x f : Fin n.succ → β) i) = x * ∏ i : Fin n, f i := by simp_rw [prod_univ_succ, cons_zero, cons_succ] #align fin.prod_cons Fin.prod_cons #align fin.sum_cons Fin.sum_cons @[to_additive sum_univ_one] theorem prod_univ_one [CommMonoid β] (f : Fin 1 → β) : ∏ i, f i = f 0 := by simp #align fin.prod_univ_one Fin.prod_univ_one #align fin.sum_univ_one Fin.sum_univ_one @[to_additive (attr := simp)] theorem prod_univ_two [CommMonoid β] (f : Fin 2 → β) : ∏ i, f i = f 0 * f 1 := by simp [prod_univ_succ] #align fin.prod_univ_two Fin.prod_univ_two #align fin.sum_univ_two Fin.sum_univ_two @[to_additive] theorem prod_univ_two' [CommMonoid β] (f : α → β) (a b : α) : ∏ i, f (![a, b] i) = f a * f b := prod_univ_two _ @[to_additive] theorem prod_univ_three [CommMonoid β] (f : Fin 3 → β) : ∏ i, f i = f 0 * f 1 * f 2 := by rw [prod_univ_castSucc, prod_univ_two] rfl #align fin.prod_univ_three Fin.prod_univ_three #align fin.sum_univ_three Fin.sum_univ_three @[to_additive] theorem prod_univ_four [CommMonoid β] (f : Fin 4 → β) : ∏ i, f i = f 0 * f 1 * f 2 * f 3 := by rw [prod_univ_castSucc, prod_univ_three] rfl #align fin.prod_univ_four Fin.prod_univ_four #align fin.sum_univ_four Fin.sum_univ_four @[to_additive]
Mathlib/Algebra/BigOperators/Fin.lean
143
146
theorem prod_univ_five [CommMonoid β] (f : Fin 5 → β) : ∏ i, f i = f 0 * f 1 * f 2 * f 3 * f 4 := by
rw [prod_univ_castSucc, prod_univ_four] rfl
0.65625
import Mathlib.Data.Fin.VecNotation import Mathlib.Logic.Embedding.Set #align_import logic.equiv.fin from "leanprover-community/mathlib"@"bd835ef554f37ef9b804f0903089211f89cb370b" assert_not_exists MonoidWithZero universe u variable {m n : ℕ} def finZeroEquiv : Fin 0 ≃ Empty := Equiv.equivEmpty _ #align fin_zero_equiv finZeroEquiv def finZeroEquiv' : Fin 0 ≃ PEmpty.{u} := Equiv.equivPEmpty _ #align fin_zero_equiv' finZeroEquiv' def finOneEquiv : Fin 1 ≃ Unit := Equiv.equivPUnit _ #align fin_one_equiv finOneEquiv def finTwoEquiv : Fin 2 ≃ Bool where toFun := ![false, true] invFun b := b.casesOn 0 1 left_inv := Fin.forall_fin_two.2 <| by simp right_inv := Bool.forall_bool.2 <| by simp #align fin_two_equiv finTwoEquiv @[simps (config := .asFn)] def piFinTwoEquiv (α : Fin 2 → Type u) : (∀ i, α i) ≃ α 0 × α 1 where toFun f := (f 0, f 1) invFun p := Fin.cons p.1 <| Fin.cons p.2 finZeroElim left_inv _ := funext <| Fin.forall_fin_two.2 ⟨rfl, rfl⟩ right_inv := fun _ => rfl #align pi_fin_two_equiv piFinTwoEquiv #align pi_fin_two_equiv_symm_apply piFinTwoEquiv_symm_apply #align pi_fin_two_equiv_apply piFinTwoEquiv_apply
Mathlib/Logic/Equiv/Fin.lean
56
60
theorem Fin.preimage_apply_01_prod {α : Fin 2 → Type u} (s : Set (α 0)) (t : Set (α 1)) : (fun f : ∀ i, α i => (f 0, f 1)) ⁻¹' s ×ˢ t = Set.pi Set.univ (Fin.cons s <| Fin.cons t finZeroElim) := by
ext f simp [Fin.forall_fin_two]
0.65625
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
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
69
74
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 _
0.65625
import Mathlib.CategoryTheory.Subobject.Limits #align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff" universe v u w open CategoryTheory CategoryTheory.Limits variable {ι : Type*} variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V] open scoped Classical noncomputable section section variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g] theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g := imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp) #align image_le_kernel image_le_kernel def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) := Subobject.ofLE _ _ (image_le_kernel _ _ w) #align image_to_kernel imageToKernel instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by dsimp only [imageToKernel] infer_instance @[simp] theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) : Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w := rfl #align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel attribute [local instance] ConcreteCategory.instFunLike -- Porting note: removed elementwise attribute which does not seem to be helpful here -- a more suitable lemma is added below @[reassoc (attr := simp)] theorem imageToKernel_arrow (w : f ≫ g = 0) : imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by simp [imageToKernel] #align image_to_kernel_arrow imageToKernel_arrow @[simp] lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0) (x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) : (kernelSubobject g).arrow (imageToKernel f g w x) = (imageSubobject f).arrow x := by rw [← comp_apply, imageToKernel_arrow] -- This is less useful as a `simp` lemma than it initially appears, -- as it "loses" the information the morphism factors through the image. theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) : factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by ext simp #align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel end section variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C) @[simp] theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} : imageToKernel (0 : A ⟶ B) g w = 0 := by ext simp #align image_to_kernel_zero_left imageToKernel_zero_left theorem imageToKernel_zero_right [HasImages V] {w} : imageToKernel f (0 : B ⟶ C) w = (imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by ext simp #align image_to_kernel_zero_right imageToKernel_zero_right section variable [HasKernels V] [HasImages V]
Mathlib/Algebra/Homology/ImageToKernel.lean
112
116
theorem imageToKernel_comp_right {D : V} (h : C ⟶ D) (w : f ≫ g = 0) : imageToKernel f (g ≫ h) (by simp [reassoc_of% w]) = imageToKernel f g w ≫ Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by
ext simp
0.65625
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section RealDerivOfComplex open Complex variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ} theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) : HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt have B : HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasStrictFDerivAt.restrictScalars ℝ have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasStrictDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) : HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasFDerivAt have B : HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasFDerivAt.restrictScalars ℝ have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_deriv_at.real_of_complex HasDerivAt.real_of_complex theorem ContDiffAt.real_of_complex {n : ℕ∞} (h : ContDiffAt ℂ n e z) : ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by have A : ContDiffAt ℝ n ((↑) : ℝ → ℂ) z := ofRealCLM.contDiff.contDiffAt have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt exact C.comp z (B.comp z A) #align cont_diff_at.real_of_complex ContDiffAt.real_of_complex theorem ContDiff.real_of_complex {n : ℕ∞} (h : ContDiff ℂ n e) : ContDiff ℝ n fun x : ℝ => (e x).re := contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex #align cont_diff.real_of_complex ContDiff.real_of_complex variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] theorem HasStrictDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv' theorem HasDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasDerivAt f f' x) : HasFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ #align has_deriv_at.complex_to_real_fderiv' HasDerivAt.complexToReal_fderiv' theorem HasDerivWithinAt.complexToReal_fderiv' {f : ℂ → E} {s : Set ℂ} {x : ℂ} {f' : E} (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (reCLM.smulRight f' + I • imCLM.smulRight f') s x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivWithinAt.restrictScalars ℝ #align has_deriv_within_at.complex_to_real_fderiv' HasDerivWithinAt.complexToReal_fderiv' theorem HasStrictDerivAt.complexToReal_fderiv {f : ℂ → ℂ} {f' x : ℂ} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (f' • (1 : ℂ →L[ℝ] ℂ)) x := by simpa only [Complex.restrictScalars_one_smulRight] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv HasStrictDerivAt.complexToReal_fderiv
Mathlib/Analysis/Complex/RealDeriv.lean
123
125
theorem HasDerivAt.complexToReal_fderiv {f : ℂ → ℂ} {f' x : ℂ} (h : HasDerivAt f f' x) : HasFDerivAt f (f' • (1 : ℂ →L[ℝ] ℂ)) x := by
simpa only [Complex.restrictScalars_one_smulRight] using h.hasFDerivAt.restrictScalars ℝ
0.65625
import Mathlib.FieldTheory.Normal import Mathlib.FieldTheory.Perfect import Mathlib.RingTheory.Localization.Integral #align_import field_theory.is_alg_closed.basic from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" universe u v w open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] class IsAlgClosed : Prop where splits : ∀ p : k[X], p.Splits <| RingHom.id k #align is_alg_closed IsAlgClosed theorem IsAlgClosed.splits_codomain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : K →+* k} (p : K[X]) : p.Splits f := by convert IsAlgClosed.splits (p.map f); simp [splits_map_iff] #align is_alg_closed.splits_codomain IsAlgClosed.splits_codomain theorem IsAlgClosed.splits_domain {k K : Type*} [Field k] [IsAlgClosed k] [Field K] {f : k →+* K} (p : k[X]) : p.Splits f := Polynomial.splits_of_splits_id _ <| IsAlgClosed.splits _ #align is_alg_closed.splits_domain IsAlgClosed.splits_domain namespace IsAlgClosed variable {k} theorem exists_root [IsAlgClosed k] (p : k[X]) (hp : p.degree ≠ 0) : ∃ x, IsRoot p x := exists_root_of_splits _ (IsAlgClosed.splits p) hp #align is_alg_closed.exists_root IsAlgClosed.exists_root
Mathlib/FieldTheory/IsAlgClosed/Basic.lean
89
96
theorem exists_pow_nat_eq [IsAlgClosed k] (x : k) {n : ℕ} (hn : 0 < n) : ∃ z, z ^ n = x := by
have : degree (X ^ n - C x) ≠ 0 := by rw [degree_X_pow_sub_C hn x] exact ne_of_gt (WithBot.coe_lt_coe.2 hn) obtain ⟨z, hz⟩ := exists_root (X ^ n - C x) this use z simp only [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def] at hz exact sub_eq_zero.1 hz
0.65625
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.GroupWithZero.NeZero import Mathlib.Logic.Unique #align_import algebra.group_with_zero.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" assert_not_exists DenselyOrdered open scoped Classical open Function variable {α M₀ G₀ M₀' G₀' F F' : Type*} section end section variable [MulZeroOneClass M₀]
Mathlib/Algebra/GroupWithZero/Basic.lean
110
111
theorem eq_zero_of_zero_eq_one (h : (0 : M₀) = 1) (a : M₀) : a = 0 := by
rw [← mul_one a, ← h, mul_zero]
0.65625
import Mathlib.Data.Multiset.Nodup #align_import data.multiset.sum from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Sum namespace Multiset variable {α β : Type*} (s : Multiset α) (t : Multiset β) def disjSum : Multiset (Sum α β) := s.map inl + t.map inr #align multiset.disj_sum Multiset.disjSum @[simp] theorem zero_disjSum : (0 : Multiset α).disjSum t = t.map inr := zero_add _ #align multiset.zero_disj_sum Multiset.zero_disjSum @[simp] theorem disjSum_zero : s.disjSum (0 : Multiset β) = s.map inl := add_zero _ #align multiset.disj_sum_zero Multiset.disjSum_zero @[simp] theorem card_disjSum : Multiset.card (s.disjSum t) = Multiset.card s + Multiset.card t := by rw [disjSum, card_add, card_map, card_map] #align multiset.card_disj_sum Multiset.card_disjSum variable {s t} {s₁ s₂ : Multiset α} {t₁ t₂ : Multiset β} {a : α} {b : β} {x : Sum α β} theorem mem_disjSum : x ∈ s.disjSum t ↔ (∃ a, a ∈ s ∧ inl a = x) ∨ ∃ b, b ∈ t ∧ inr b = x := by simp_rw [disjSum, mem_add, mem_map] #align multiset.mem_disj_sum Multiset.mem_disjSum @[simp]
Mathlib/Data/Multiset/Sum.lean
55
60
theorem inl_mem_disjSum : inl a ∈ s.disjSum t ↔ a ∈ s := by
rw [mem_disjSum, or_iff_left] -- Porting note: Previous code for L62 was: simp only [exists_eq_right] · simp only [inl.injEq, exists_eq_right] rintro ⟨b, _, hb⟩ exact inr_ne_inl hb
0.65625
import Mathlib.Algebra.Group.Units import Mathlib.Algebra.GroupWithZero.Basic import Mathlib.Logic.Equiv.Defs import Mathlib.Tactic.Contrapose import Mathlib.Tactic.Nontriviality import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.group_with_zero.units.basic from "leanprover-community/mathlib"@"df5e9937a06fdd349fc60106f54b84d47b1434f0" -- Guard against import creep assert_not_exists Multiplicative assert_not_exists DenselyOrdered variable {α M₀ G₀ M₀' G₀' F F' : Type*} variable [MonoidWithZero M₀] @[simp] theorem isUnit_zero_iff : IsUnit (0 : M₀) ↔ (0 : M₀) = 1 := ⟨fun ⟨⟨_, a, (a0 : 0 * a = 1), _⟩, rfl⟩ => by rwa [zero_mul] at a0, fun h => @isUnit_of_subsingleton _ _ (subsingleton_of_zero_eq_one h) 0⟩ #align is_unit_zero_iff isUnit_zero_iff -- Porting note: removed `simp` tag because `simpNF` says it's redundant theorem not_isUnit_zero [Nontrivial M₀] : ¬IsUnit (0 : M₀) := mt isUnit_zero_iff.1 zero_ne_one #align not_is_unit_zero not_isUnit_zero namespace Ring open scoped Classical noncomputable def inverse : M₀ → M₀ := fun x => if h : IsUnit x then ((h.unit⁻¹ : M₀ˣ) : M₀) else 0 #align ring.inverse Ring.inverse @[simp] theorem inverse_unit (u : M₀ˣ) : inverse (u : M₀) = (u⁻¹ : M₀ˣ) := by rw [inverse, dif_pos u.isUnit, IsUnit.unit_of_val_units] #align ring.inverse_unit Ring.inverse_unit @[simp] theorem inverse_non_unit (x : M₀) (h : ¬IsUnit x) : inverse x = 0 := dif_neg h #align ring.inverse_non_unit Ring.inverse_non_unit
Mathlib/Algebra/GroupWithZero/Units/Basic.lean
108
110
theorem mul_inverse_cancel (x : M₀) (h : IsUnit x) : x * inverse x = 1 := by
rcases h with ⟨u, rfl⟩ rw [inverse_unit, Units.mul_inv]
0.65625
import Mathlib.Analysis.Calculus.TangentCone import Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics #align_import analysis.calculus.fderiv.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] @[mk_iff hasFDerivAtFilter_iff_isLittleO] structure HasFDerivAtFilter (f : E → F) (f' : E →L[𝕜] F) (x : E) (L : Filter E) : Prop where of_isLittleO :: isLittleO : (fun x' => f x' - f x - f' (x' - x)) =o[L] fun x' => x' - x #align has_fderiv_at_filter HasFDerivAtFilter @[fun_prop] def HasFDerivWithinAt (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (x : E) := HasFDerivAtFilter f f' x (𝓝[s] x) #align has_fderiv_within_at HasFDerivWithinAt @[fun_prop] def HasFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := HasFDerivAtFilter f f' x (𝓝 x) #align has_fderiv_at HasFDerivAt @[fun_prop] def HasStrictFDerivAt (f : E → F) (f' : E →L[𝕜] F) (x : E) := (fun p : E × E => f p.1 - f p.2 - f' (p.1 - p.2)) =o[𝓝 (x, x)] fun p : E × E => p.1 - p.2 #align has_strict_fderiv_at HasStrictFDerivAt variable (𝕜) @[fun_prop] def DifferentiableWithinAt (f : E → F) (s : Set E) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivWithinAt f f' s x #align differentiable_within_at DifferentiableWithinAt @[fun_prop] def DifferentiableAt (f : E → F) (x : E) := ∃ f' : E →L[𝕜] F, HasFDerivAt f f' x #align differentiable_at DifferentiableAt irreducible_def fderivWithin (f : E → F) (s : Set E) (x : E) : E →L[𝕜] F := if 𝓝[s \ {x}] x = ⊥ then 0 else if h : ∃ f', HasFDerivWithinAt f f' s x then Classical.choose h else 0 #align fderiv_within fderivWithin irreducible_def fderiv (f : E → F) (x : E) : E →L[𝕜] F := if h : ∃ f', HasFDerivAt f f' x then Classical.choose h else 0 #align fderiv fderiv @[fun_prop] def DifferentiableOn (f : E → F) (s : Set E) := ∀ x ∈ s, DifferentiableWithinAt 𝕜 f s x #align differentiable_on DifferentiableOn @[fun_prop] def Differentiable (f : E → F) := ∀ x, DifferentiableAt 𝕜 f x #align differentiable Differentiable variable {𝕜} variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} theorem fderivWithin_zero_of_isolated (h : 𝓝[s \ {x}] x = ⊥) : fderivWithin 𝕜 f s x = 0 := by rw [fderivWithin, if_pos h] theorem fderivWithin_zero_of_nmem_closure (h : x ∉ closure s) : fderivWithin 𝕜 f s x = 0 := by apply fderivWithin_zero_of_isolated simp only [mem_closure_iff_nhdsWithin_neBot, neBot_iff, Ne, Classical.not_not] at h rw [eq_bot_iff, ← h] exact nhdsWithin_mono _ diff_subset theorem fderivWithin_zero_of_not_differentiableWithinAt (h : ¬DifferentiableWithinAt 𝕜 f s x) : fderivWithin 𝕜 f s x = 0 := by have : ¬∃ f', HasFDerivWithinAt f f' s x := h simp [fderivWithin, this] #align fderiv_within_zero_of_not_differentiable_within_at fderivWithin_zero_of_not_differentiableWithinAt
Mathlib/Analysis/Calculus/FDeriv/Basic.lean
231
233
theorem fderiv_zero_of_not_differentiableAt (h : ¬DifferentiableAt 𝕜 f x) : fderiv 𝕜 f x = 0 := by
have : ¬∃ f', HasFDerivAt f f' x := h simp [fderiv, this]
0.65625
import Mathlib.Analysis.BoxIntegral.Partition.Filter import Mathlib.Analysis.BoxIntegral.Partition.Measure import Mathlib.Topology.UniformSpace.Compact import Mathlib.Init.Data.Bool.Lemmas #align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical Topology NNReal Filter Uniformity BoxIntegral open Set Finset Function Filter Metric BoxIntegral.IntegrationParams noncomputable section namespace BoxIntegral universe u v w variable {ι : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] {I J : Box ι} {π : TaggedPrepartition I} open TaggedPrepartition local notation "ℝⁿ" => ι → ℝ def integralSum (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : F := ∑ J ∈ π.boxes, vol J (f (π.tag J)) #align box_integral.integral_sum BoxIntegral.integralSum theorem integralSum_biUnionTagged (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : Prepartition I) (πi : ∀ J, TaggedPrepartition J) : integralSum f vol (π.biUnionTagged πi) = ∑ J ∈ π.boxes, integralSum f vol (πi J) := by refine (π.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_ rw [π.tag_biUnionTagged hJ hJ'] #align box_integral.integral_sum_bUnion_tagged BoxIntegral.integralSum_biUnionTagged theorem integralSum_biUnion_partition (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) (πi : ∀ J, Prepartition J) (hπi : ∀ J ∈ π, (πi J).IsPartition) : integralSum f vol (π.biUnionPrepartition πi) = integralSum f vol π := by refine (π.sum_biUnion_boxes _ _).trans (sum_congr rfl fun J hJ => ?_) calc (∑ J' ∈ (πi J).boxes, vol J' (f (π.tag <| π.toPrepartition.biUnionIndex πi J'))) = ∑ J' ∈ (πi J).boxes, vol J' (f (π.tag J)) := sum_congr rfl fun J' hJ' => by rw [Prepartition.biUnionIndex_of_mem _ hJ hJ'] _ = vol J (f (π.tag J)) := (vol.map ⟨⟨fun g : E →L[ℝ] F => g (f (π.tag J)), rfl⟩, fun _ _ => rfl⟩).sum_partition_boxes le_top (hπi J hJ) #align box_integral.integral_sum_bUnion_partition BoxIntegral.integralSum_biUnion_partition theorem integralSum_inf_partition (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) {π' : Prepartition I} (h : π'.IsPartition) : integralSum f vol (π.infPrepartition π') = integralSum f vol π := integralSum_biUnion_partition f vol π _ fun _J hJ => h.restrict (Prepartition.le_of_mem _ hJ) #align box_integral.integral_sum_inf_partition BoxIntegral.integralSum_inf_partition theorem integralSum_fiberwise {α} (g : Box ι → α) (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : (∑ y ∈ π.boxes.image g, integralSum f vol (π.filter (g · = y))) = integralSum f vol π := π.sum_fiberwise g fun J => vol J (f <| π.tag J) #align box_integral.integral_sum_fiberwise BoxIntegral.integralSum_fiberwise theorem integralSum_sub_partitions (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) {π₁ π₂ : TaggedPrepartition I} (h₁ : π₁.IsPartition) (h₂ : π₂.IsPartition) : integralSum f vol π₁ - integralSum f vol π₂ = ∑ J ∈ (π₁.toPrepartition ⊓ π₂.toPrepartition).boxes, (vol J (f <| (π₁.infPrepartition π₂.toPrepartition).tag J) - vol J (f <| (π₂.infPrepartition π₁.toPrepartition).tag J)) := by rw [← integralSum_inf_partition f vol π₁ h₂, ← integralSum_inf_partition f vol π₂ h₁, integralSum, integralSum, Finset.sum_sub_distrib] simp only [infPrepartition_toPrepartition, inf_comm] #align box_integral.integral_sum_sub_partitions BoxIntegral.integralSum_sub_partitions @[simp] theorem integralSum_disjUnion (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) {π₁ π₂ : TaggedPrepartition I} (h : Disjoint π₁.iUnion π₂.iUnion) : integralSum f vol (π₁.disjUnion π₂ h) = integralSum f vol π₁ + integralSum f vol π₂ := by refine (Prepartition.sum_disj_union_boxes h _).trans (congr_arg₂ (· + ·) (sum_congr rfl fun J hJ => ?_) (sum_congr rfl fun J hJ => ?_)) · rw [disjUnion_tag_of_mem_left _ hJ] · rw [disjUnion_tag_of_mem_right _ hJ] #align box_integral.integral_sum_disj_union BoxIntegral.integralSum_disjUnion @[simp] theorem integralSum_add (f g : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : integralSum (f + g) vol π = integralSum f vol π + integralSum g vol π := by simp only [integralSum, Pi.add_apply, (vol _).map_add, Finset.sum_add_distrib] #align box_integral.integral_sum_add BoxIntegral.integralSum_add @[simp]
Mathlib/Analysis/BoxIntegral/Basic.lean
143
145
theorem integralSum_neg (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : integralSum (-f) vol π = -integralSum f vol π := by
simp only [integralSum, Pi.neg_apply, (vol _).map_neg, Finset.sum_neg_distrib]
0.65625
import Mathlib.Data.Multiset.Nodup #align_import data.multiset.dedup from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset open List variable {α β : Type*} [DecidableEq α] def dedup (s : Multiset α) : Multiset α := Quot.liftOn s (fun l => (l.dedup : Multiset α)) fun _ _ p => Quot.sound p.dedup #align multiset.dedup Multiset.dedup @[simp] theorem coe_dedup (l : List α) : @dedup α _ l = l.dedup := rfl #align multiset.coe_dedup Multiset.coe_dedup @[simp] theorem dedup_zero : @dedup α _ 0 = 0 := rfl #align multiset.dedup_zero Multiset.dedup_zero @[simp] theorem mem_dedup {a : α} {s : Multiset α} : a ∈ dedup s ↔ a ∈ s := Quot.induction_on s fun _ => List.mem_dedup #align multiset.mem_dedup Multiset.mem_dedup @[simp] theorem dedup_cons_of_mem {a : α} {s : Multiset α} : a ∈ s → dedup (a ::ₘ s) = dedup s := Quot.induction_on s fun _ m => @congr_arg _ _ _ _ ofList <| List.dedup_cons_of_mem m #align multiset.dedup_cons_of_mem Multiset.dedup_cons_of_mem @[simp] theorem dedup_cons_of_not_mem {a : α} {s : Multiset α} : a ∉ s → dedup (a ::ₘ s) = a ::ₘ dedup s := Quot.induction_on s fun _ m => congr_arg ofList <| List.dedup_cons_of_not_mem m #align multiset.dedup_cons_of_not_mem Multiset.dedup_cons_of_not_mem theorem dedup_le (s : Multiset α) : dedup s ≤ s := Quot.induction_on s fun _ => (dedup_sublist _).subperm #align multiset.dedup_le Multiset.dedup_le theorem dedup_subset (s : Multiset α) : dedup s ⊆ s := subset_of_le <| dedup_le _ #align multiset.dedup_subset Multiset.dedup_subset theorem subset_dedup (s : Multiset α) : s ⊆ dedup s := fun _ => mem_dedup.2 #align multiset.subset_dedup Multiset.subset_dedup @[simp] theorem dedup_subset' {s t : Multiset α} : dedup s ⊆ t ↔ s ⊆ t := ⟨Subset.trans (subset_dedup _), Subset.trans (dedup_subset _)⟩ #align multiset.dedup_subset' Multiset.dedup_subset' @[simp] theorem subset_dedup' {s t : Multiset α} : s ⊆ dedup t ↔ s ⊆ t := ⟨fun h => Subset.trans h (dedup_subset _), fun h => Subset.trans h (subset_dedup _)⟩ #align multiset.subset_dedup' Multiset.subset_dedup' @[simp] theorem nodup_dedup (s : Multiset α) : Nodup (dedup s) := Quot.induction_on s List.nodup_dedup #align multiset.nodup_dedup Multiset.nodup_dedup theorem dedup_eq_self {s : Multiset α} : dedup s = s ↔ Nodup s := ⟨fun e => e ▸ nodup_dedup s, Quot.induction_on s fun _ h => congr_arg ofList h.dedup⟩ #align multiset.dedup_eq_self Multiset.dedup_eq_self alias ⟨_, Nodup.dedup⟩ := dedup_eq_self #align multiset.nodup.dedup Multiset.Nodup.dedup theorem count_dedup (m : Multiset α) (a : α) : m.dedup.count a = if a ∈ m then 1 else 0 := Quot.induction_on m fun _ => by simp only [quot_mk_to_coe'', coe_dedup, mem_coe, List.mem_dedup, coe_nodup, coe_count] apply List.count_dedup _ _ #align multiset.count_dedup Multiset.count_dedup @[simp] theorem dedup_idem {m : Multiset α} : m.dedup.dedup = m.dedup := Quot.induction_on m fun _ => @congr_arg _ _ _ _ ofList List.dedup_idem #align multiset.dedup_idempotent Multiset.dedup_idem theorem dedup_eq_zero {s : Multiset α} : dedup s = 0 ↔ s = 0 := ⟨fun h => eq_zero_of_subset_zero <| h ▸ subset_dedup _, fun h => h.symm ▸ dedup_zero⟩ #align multiset.dedup_eq_zero Multiset.dedup_eq_zero @[simp] theorem dedup_singleton {a : α} : dedup ({a} : Multiset α) = {a} := (nodup_singleton _).dedup #align multiset.dedup_singleton Multiset.dedup_singleton theorem le_dedup {s t : Multiset α} : s ≤ dedup t ↔ s ≤ t ∧ Nodup s := ⟨fun h => ⟨le_trans h (dedup_le _), nodup_of_le h (nodup_dedup _)⟩, fun ⟨l, d⟩ => (le_iff_subset d).2 <| Subset.trans (subset_of_le l) (subset_dedup _)⟩ #align multiset.le_dedup Multiset.le_dedup theorem le_dedup_self {s : Multiset α} : s ≤ dedup s ↔ Nodup s := by rw [le_dedup, and_iff_right le_rfl] #align multiset.le_dedup_self Multiset.le_dedup_self theorem dedup_ext {s t : Multiset α} : dedup s = dedup t ↔ ∀ a, a ∈ s ↔ a ∈ t := by simp [Nodup.ext] #align multiset.dedup_ext Multiset.dedup_ext theorem dedup_map_dedup_eq [DecidableEq β] (f : α → β) (s : Multiset α) : dedup (map f (dedup s)) = dedup (map f s) := by simp [dedup_ext] #align multiset.dedup_map_dedup_eq Multiset.dedup_map_dedup_eq @[simp]
Mathlib/Data/Multiset/Dedup.lean
126
128
theorem dedup_nsmul {s : Multiset α} {n : ℕ} (h0 : n ≠ 0) : (n • s).dedup = s.dedup := by
ext a by_cases h : a ∈ s <;> simp [h, h0]
0.65625
import Mathlib.Analysis.Calculus.Deriv.Comp import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.Calculus.Deriv.Slope noncomputable section open scoped Topology Filter ENNReal NNReal open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] section Module variable (𝕜) variable {E : Type*} [AddCommGroup E] [Module 𝕜 E] def HasLineDerivWithinAt (f : E → F) (f' : F) (s : Set E) (x : E) (v : E) := HasDerivWithinAt (fun t ↦ f (x + t • v)) f' ((fun t ↦ x + t • v) ⁻¹' s) (0 : 𝕜) def HasLineDerivAt (f : E → F) (f' : F) (x : E) (v : E) := HasDerivAt (fun t ↦ f (x + t • v)) f' (0 : 𝕜) def LineDifferentiableWithinAt (f : E → F) (s : Set E) (x : E) (v : E) : Prop := DifferentiableWithinAt 𝕜 (fun t ↦ f (x + t • v)) ((fun t ↦ x + t • v) ⁻¹' s) (0 : 𝕜) def LineDifferentiableAt (f : E → F) (x : E) (v : E) : Prop := DifferentiableAt 𝕜 (fun t ↦ f (x + t • v)) (0 : 𝕜) def lineDerivWithin (f : E → F) (s : Set E) (x : E) (v : E) : F := derivWithin (fun t ↦ f (x + t • v)) ((fun t ↦ x + t • v) ⁻¹' s) (0 : 𝕜) def lineDeriv (f : E → F) (x : E) (v : E) : F := deriv (fun t ↦ f (x + t • v)) (0 : 𝕜) variable {𝕜} variable {f f₁ : E → F} {f' f₀' f₁' : F} {s t : Set E} {x v : E} lemma HasLineDerivWithinAt.mono (hf : HasLineDerivWithinAt 𝕜 f f' s x v) (hst : t ⊆ s) : HasLineDerivWithinAt 𝕜 f f' t x v := HasDerivWithinAt.mono hf (preimage_mono hst) lemma HasLineDerivAt.hasLineDerivWithinAt (hf : HasLineDerivAt 𝕜 f f' x v) (s : Set E) : HasLineDerivWithinAt 𝕜 f f' s x v := HasDerivAt.hasDerivWithinAt hf lemma HasLineDerivWithinAt.lineDifferentiableWithinAt (hf : HasLineDerivWithinAt 𝕜 f f' s x v) : LineDifferentiableWithinAt 𝕜 f s x v := HasDerivWithinAt.differentiableWithinAt hf theorem HasLineDerivAt.lineDifferentiableAt (hf : HasLineDerivAt 𝕜 f f' x v) : LineDifferentiableAt 𝕜 f x v := HasDerivAt.differentiableAt hf theorem LineDifferentiableWithinAt.hasLineDerivWithinAt (h : LineDifferentiableWithinAt 𝕜 f s x v) : HasLineDerivWithinAt 𝕜 f (lineDerivWithin 𝕜 f s x v) s x v := DifferentiableWithinAt.hasDerivWithinAt h theorem LineDifferentiableAt.hasLineDerivAt (h : LineDifferentiableAt 𝕜 f x v) : HasLineDerivAt 𝕜 f (lineDeriv 𝕜 f x v) x v := DifferentiableAt.hasDerivAt h @[simp] lemma hasLineDerivWithinAt_univ : HasLineDerivWithinAt 𝕜 f f' univ x v ↔ HasLineDerivAt 𝕜 f f' x v := by simp only [HasLineDerivWithinAt, HasLineDerivAt, preimage_univ, hasDerivWithinAt_univ] theorem lineDerivWithin_zero_of_not_lineDifferentiableWithinAt (h : ¬LineDifferentiableWithinAt 𝕜 f s x v) : lineDerivWithin 𝕜 f s x v = 0 := derivWithin_zero_of_not_differentiableWithinAt h theorem lineDeriv_zero_of_not_lineDifferentiableAt (h : ¬LineDifferentiableAt 𝕜 f x v) : lineDeriv 𝕜 f x v = 0 := deriv_zero_of_not_differentiableAt h theorem hasLineDerivAt_iff_isLittleO_nhds_zero : HasLineDerivAt 𝕜 f f' x v ↔ (fun t : 𝕜 => f (x + t • v) - f x - t • f') =o[𝓝 0] fun t => t := by simp only [HasLineDerivAt, hasDerivAt_iff_isLittleO_nhds_zero, zero_add, zero_smul, add_zero] theorem HasLineDerivAt.unique (h₀ : HasLineDerivAt 𝕜 f f₀' x v) (h₁ : HasLineDerivAt 𝕜 f f₁' x v) : f₀' = f₁' := HasDerivAt.unique h₀ h₁ protected theorem HasLineDerivAt.lineDeriv (h : HasLineDerivAt 𝕜 f f' x v) : lineDeriv 𝕜 f x v = f' := by rw [h.unique h.lineDifferentiableAt.hasLineDerivAt] theorem lineDifferentiableWithinAt_univ : LineDifferentiableWithinAt 𝕜 f univ x v ↔ LineDifferentiableAt 𝕜 f x v := by simp only [LineDifferentiableWithinAt, LineDifferentiableAt, preimage_univ, differentiableWithinAt_univ] theorem LineDifferentiableAt.lineDifferentiableWithinAt (h : LineDifferentiableAt 𝕜 f x v) : LineDifferentiableWithinAt 𝕜 f s x v := (differentiableWithinAt_univ.2 h).mono (subset_univ _) @[simp]
Mathlib/Analysis/Calculus/LineDeriv/Basic.lean
170
171
theorem lineDerivWithin_univ : lineDerivWithin 𝕜 f univ x v = lineDeriv 𝕜 f x v := by
simp [lineDerivWithin, lineDeriv]
0.65625
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] section Group variable [Group α] [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] (s t : Set α) @[to_additive] theorem sSup_inv (s : Set α) : sSup s⁻¹ = (sInf s)⁻¹ := by rw [← image_inv, sSup_image] exact ((OrderIso.inv α).map_sInf _).symm #align Sup_inv sSup_inv #align Sup_neg sSup_neg @[to_additive] theorem sInf_inv (s : Set α) : sInf s⁻¹ = (sSup s)⁻¹ := by rw [← image_inv, sInf_image] exact ((OrderIso.inv α).map_sSup _).symm #align Inf_inv sInf_inv #align Inf_neg sInf_neg @[to_additive] theorem sSup_mul : sSup (s * t) = sSup s * sSup t := (sSup_image2_eq_sSup_sSup fun _ => (OrderIso.mulRight _).to_galoisConnection) fun _ => (OrderIso.mulLeft _).to_galoisConnection #align Sup_mul sSup_mul #align Sup_add sSup_add @[to_additive] theorem sInf_mul : sInf (s * t) = sInf s * sInf t := (sInf_image2_eq_sInf_sInf fun _ => (OrderIso.mulRight _).symm.to_galoisConnection) fun _ => (OrderIso.mulLeft _).symm.to_galoisConnection #align Inf_mul sInf_mul #align Inf_add sInf_add @[to_additive] theorem sSup_div : sSup (s / t) = sSup s / sInf t := by simp_rw [div_eq_mul_inv, sSup_mul, sSup_inv] #align Sup_div sSup_div #align Sup_sub sSup_sub @[to_additive]
Mathlib/Algebra/Order/Pointwise.lean
94
94
theorem sInf_div : sInf (s / t) = sInf s / sSup t := by
simp_rw [div_eq_mul_inv, sInf_mul, sInf_inv]
0.65625
import Mathlib.Algebra.Group.Commutator import Mathlib.Algebra.Group.Subgroup.Finite import Mathlib.Data.Bracket import Mathlib.GroupTheory.Subgroup.Centralizer import Mathlib.Tactic.Group #align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef" variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G'] variable (f : F) {g₁ g₂ g₃ g : G} theorem commutatorElement_eq_one_iff_mul_comm : ⁅g₁, g₂⁆ = 1 ↔ g₁ * g₂ = g₂ * g₁ := by rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul] #align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm theorem commutatorElement_eq_one_iff_commute : ⁅g₁, g₂⁆ = 1 ↔ Commute g₁ g₂ := commutatorElement_eq_one_iff_mul_comm #align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute theorem Commute.commutator_eq (h : Commute g₁ g₂) : ⁅g₁, g₂⁆ = 1 := commutatorElement_eq_one_iff_commute.mpr h #align commute.commutator_eq Commute.commutator_eq variable (g₁ g₂ g₃ g) @[simp] theorem commutatorElement_one_right : ⁅g, (1 : G)⁆ = 1 := (Commute.one_right g).commutator_eq #align commutator_element_one_right commutatorElement_one_right @[simp] theorem commutatorElement_one_left : ⁅(1 : G), g⁆ = 1 := (Commute.one_left g).commutator_eq #align commutator_element_one_left commutatorElement_one_left @[simp] theorem commutatorElement_self : ⁅g, g⁆ = 1 := (Commute.refl g).commutator_eq #align commutator_element_self commutatorElement_self @[simp] theorem commutatorElement_inv : ⁅g₁, g₂⁆⁻¹ = ⁅g₂, g₁⁆ := by simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc] #align commutator_element_inv commutatorElement_inv
Mathlib/GroupTheory/Commutator.lean
65
66
theorem map_commutatorElement : (f ⁅g₁, g₂⁆ : G') = ⁅f g₁, f g₂⁆ := by
simp_rw [commutatorElement_def, map_mul f, map_inv f]
0.65625
import Mathlib.Analysis.Normed.Group.Basic #align_import information_theory.hamming from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3" section HammingDistNorm open Finset Function variable {α ι : Type*} {β : ι → Type*} [Fintype ι] [∀ i, DecidableEq (β i)] variable {γ : ι → Type*} [∀ i, DecidableEq (γ i)] def hammingDist (x y : ∀ i, β i) : ℕ := (univ.filter fun i => x i ≠ y i).card #align hamming_dist hammingDist @[simp] theorem hammingDist_self (x : ∀ i, β i) : hammingDist x x = 0 := by rw [hammingDist, card_eq_zero, filter_eq_empty_iff] exact fun _ _ H => H rfl #align hamming_dist_self hammingDist_self theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y := zero_le _ #align hamming_dist_nonneg hammingDist_nonneg
Mathlib/InformationTheory/Hamming.lean
56
57
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x := by
simp_rw [hammingDist, ne_comm]
0.65625
import Mathlib.Algebra.Group.Pi.Lemmas import Mathlib.Topology.Algebra.Monoid import Mathlib.Topology.Homeomorph #align_import topology.algebra.group_with_zero from "leanprover-community/mathlib"@"c10e724be91096453ee3db13862b9fb9a992fef2" open Topology Filter Function variable {α β G₀ : Type*} section DivConst variable [DivInvMonoid G₀] [TopologicalSpace G₀] [ContinuousMul G₀] {f : α → G₀} {s : Set α} {l : Filter α} theorem Filter.Tendsto.div_const {x : G₀} (hf : Tendsto f l (𝓝 x)) (y : G₀) : Tendsto (fun a => f a / y) l (𝓝 (x / y)) := by simpa only [div_eq_mul_inv] using hf.mul tendsto_const_nhds #align filter.tendsto.div_const Filter.Tendsto.div_const variable [TopologicalSpace α] nonrec theorem ContinuousAt.div_const {a : α} (hf : ContinuousAt f a) (y : G₀) : ContinuousAt (fun x => f x / y) a := hf.div_const y #align continuous_at.div_const ContinuousAt.div_const nonrec theorem ContinuousWithinAt.div_const {a} (hf : ContinuousWithinAt f s a) (y : G₀) : ContinuousWithinAt (fun x => f x / y) s a := hf.div_const _ #align continuous_within_at.div_const ContinuousWithinAt.div_const theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : G₀) : ContinuousOn (fun x => f x / y) s := by simpa only [div_eq_mul_inv] using hf.mul continuousOn_const #align continuous_on.div_const ContinuousOn.div_const @[continuity]
Mathlib/Topology/Algebra/GroupWithZero.lean
75
76
theorem Continuous.div_const (hf : Continuous f) (y : G₀) : Continuous fun x => f x / y := by
simpa only [div_eq_mul_inv] using hf.mul continuous_const
0.65625
import Mathlib.Analysis.Calculus.FDeriv.Bilinear #align_import analysis.calculus.fderiv.mul from "leanprover-community/mathlib"@"d608fc5d4e69d4cc21885913fb573a88b0deb521" open scoped Classical open Filter Asymptotics ContinuousLinearMap Set Metric Topology NNReal ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section SMul variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F] variable {c : E → 𝕜'} {c' : E →L[𝕜] 𝕜'} @[fun_prop] theorem HasStrictFDerivAt.smul (hc : HasStrictFDerivAt c c' x) (hf : HasStrictFDerivAt f f' x) : HasStrictFDerivAt (fun y => c y • f y) (c x • f' + c'.smulRight (f x)) x := (isBoundedBilinearMap_smul.hasStrictFDerivAt (c x, f x)).comp x <| hc.prod hf #align has_strict_fderiv_at.smul HasStrictFDerivAt.smul @[fun_prop] theorem HasFDerivWithinAt.smul (hc : HasFDerivWithinAt c c' s x) (hf : HasFDerivWithinAt f f' s x) : HasFDerivWithinAt (fun y => c y • f y) (c x • f' + c'.smulRight (f x)) s x := (isBoundedBilinearMap_smul.hasFDerivAt (c x, f x)).comp_hasFDerivWithinAt x <| hc.prod hf #align has_fderiv_within_at.smul HasFDerivWithinAt.smul @[fun_prop] theorem HasFDerivAt.smul (hc : HasFDerivAt c c' x) (hf : HasFDerivAt f f' x) : HasFDerivAt (fun y => c y • f y) (c x • f' + c'.smulRight (f x)) x := (isBoundedBilinearMap_smul.hasFDerivAt (c x, f x)).comp x <| hc.prod hf #align has_fderiv_at.smul HasFDerivAt.smul @[fun_prop] theorem DifferentiableWithinAt.smul (hc : DifferentiableWithinAt 𝕜 c s x) (hf : DifferentiableWithinAt 𝕜 f s x) : DifferentiableWithinAt 𝕜 (fun y => c y • f y) s x := (hc.hasFDerivWithinAt.smul hf.hasFDerivWithinAt).differentiableWithinAt #align differentiable_within_at.smul DifferentiableWithinAt.smul @[simp, fun_prop] theorem DifferentiableAt.smul (hc : DifferentiableAt 𝕜 c x) (hf : DifferentiableAt 𝕜 f x) : DifferentiableAt 𝕜 (fun y => c y • f y) x := (hc.hasFDerivAt.smul hf.hasFDerivAt).differentiableAt #align differentiable_at.smul DifferentiableAt.smul @[fun_prop] theorem DifferentiableOn.smul (hc : DifferentiableOn 𝕜 c s) (hf : DifferentiableOn 𝕜 f s) : DifferentiableOn 𝕜 (fun y => c y • f y) s := fun x hx => (hc x hx).smul (hf x hx) #align differentiable_on.smul DifferentiableOn.smul @[simp, fun_prop] theorem Differentiable.smul (hc : Differentiable 𝕜 c) (hf : Differentiable 𝕜 f) : Differentiable 𝕜 fun y => c y • f y := fun x => (hc x).smul (hf x) #align differentiable.smul Differentiable.smul theorem fderivWithin_smul (hxs : UniqueDiffWithinAt 𝕜 s x) (hc : DifferentiableWithinAt 𝕜 c s x) (hf : DifferentiableWithinAt 𝕜 f s x) : fderivWithin 𝕜 (fun y => c y • f y) s x = c x • fderivWithin 𝕜 f s x + (fderivWithin 𝕜 c s x).smulRight (f x) := (hc.hasFDerivWithinAt.smul hf.hasFDerivWithinAt).fderivWithin hxs #align fderiv_within_smul fderivWithin_smul theorem fderiv_smul (hc : DifferentiableAt 𝕜 c x) (hf : DifferentiableAt 𝕜 f x) : fderiv 𝕜 (fun y => c y • f y) x = c x • fderiv 𝕜 f x + (fderiv 𝕜 c x).smulRight (f x) := (hc.hasFDerivAt.smul hf.hasFDerivAt).fderiv #align fderiv_smul fderiv_smul @[fun_prop] theorem HasStrictFDerivAt.smul_const (hc : HasStrictFDerivAt c c' x) (f : F) : HasStrictFDerivAt (fun y => c y • f) (c'.smulRight f) x := by simpa only [smul_zero, zero_add] using hc.smul (hasStrictFDerivAt_const f x) #align has_strict_fderiv_at.smul_const HasStrictFDerivAt.smul_const @[fun_prop]
Mathlib/Analysis/Calculus/FDeriv/Mul.lean
313
315
theorem HasFDerivWithinAt.smul_const (hc : HasFDerivWithinAt c c' s x) (f : F) : HasFDerivWithinAt (fun y => c y • f) (c'.smulRight f) s x := by
simpa only [smul_zero, zero_add] using hc.smul (hasFDerivWithinAt_const f x s)
0.65625
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} section SMul variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F] {c : 𝕜 → 𝕜'} {c' : 𝕜'} theorem HasDerivWithinAt.smul (hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (fun y => c y • f y) (c x • f' + c' • f x) s x := by simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt #align has_deriv_within_at.smul HasDerivWithinAt.smul theorem HasDerivAt.smul (hc : HasDerivAt c c' x) (hf : HasDerivAt f f' x) : HasDerivAt (fun y => c y • f y) (c x • f' + c' • f x) x := by rw [← hasDerivWithinAt_univ] at * exact hc.smul hf #align has_deriv_at.smul HasDerivAt.smul nonrec theorem HasStrictDerivAt.smul (hc : HasStrictDerivAt c c' x) (hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (fun y => c y • f y) (c x • f' + c' • f x) x := by simpa using (hc.smul hf).hasStrictDerivAt #align has_strict_deriv_at.smul HasStrictDerivAt.smul theorem derivWithin_smul (hxs : UniqueDiffWithinAt 𝕜 s x) (hc : DifferentiableWithinAt 𝕜 c s x) (hf : DifferentiableWithinAt 𝕜 f s x) : derivWithin (fun y => c y • f y) s x = c x • derivWithin f s x + derivWithin c s x • f x := (hc.hasDerivWithinAt.smul hf.hasDerivWithinAt).derivWithin hxs #align deriv_within_smul derivWithin_smul theorem deriv_smul (hc : DifferentiableAt 𝕜 c x) (hf : DifferentiableAt 𝕜 f x) : deriv (fun y => c y • f y) x = c x • deriv f x + deriv c x • f x := (hc.hasDerivAt.smul hf.hasDerivAt).deriv #align deriv_smul deriv_smul theorem HasStrictDerivAt.smul_const (hc : HasStrictDerivAt c c' x) (f : F) : HasStrictDerivAt (fun y => c y • f) (c' • f) x := by have := hc.smul (hasStrictDerivAt_const x f) rwa [smul_zero, zero_add] at this #align has_strict_deriv_at.smul_const HasStrictDerivAt.smul_const theorem HasDerivWithinAt.smul_const (hc : HasDerivWithinAt c c' s x) (f : F) : HasDerivWithinAt (fun y => c y • f) (c' • f) s x := by have := hc.smul (hasDerivWithinAt_const x s f) rwa [smul_zero, zero_add] at this #align has_deriv_within_at.smul_const HasDerivWithinAt.smul_const
Mathlib/Analysis/Calculus/Deriv/Mul.lean
126
129
theorem HasDerivAt.smul_const (hc : HasDerivAt c c' x) (f : F) : HasDerivAt (fun y => c y • f) (c' • f) x := by
rw [← hasDerivWithinAt_univ] at * exact hc.smul_const f
0.65625
import Mathlib.Order.SuccPred.Basic import Mathlib.Topology.Order.Basic import Mathlib.Topology.Metrizable.Uniformity #align_import topology.instances.discrete from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4" open Order Set TopologicalSpace Filter variable {α : Type*} [TopologicalSpace α] instance (priority := 100) DiscreteTopology.firstCountableTopology [DiscreteTopology α] : FirstCountableTopology α where nhds_generated_countable := by rw [nhds_discrete]; exact isCountablyGenerated_pure #align discrete_topology.first_countable_topology DiscreteTopology.firstCountableTopology instance (priority := 100) DiscreteTopology.secondCountableTopology_of_countable [hd : DiscreteTopology α] [Countable α] : SecondCountableTopology α := haveI : ∀ i : α, SecondCountableTopology (↥({i} : Set α)) := fun i => { is_open_generated_countable := ⟨{univ}, countable_singleton _, by simp only [eq_iff_true_of_subsingleton]⟩ } secondCountableTopology_of_countable_cover (singletons_open_iff_discrete.mpr hd) (iUnion_of_singleton α) #align discrete_topology.second_countable_topology_of_encodable DiscreteTopology.secondCountableTopology_of_countable @[deprecated DiscreteTopology.secondCountableTopology_of_countable (since := "2024-03-11")] theorem DiscreteTopology.secondCountableTopology_of_encodable {α : Type*} [TopologicalSpace α] [DiscreteTopology α] [Countable α] : SecondCountableTopology α := DiscreteTopology.secondCountableTopology_of_countable #align discrete_topology.second_countable_topology_of_countable DiscreteTopology.secondCountableTopology_of_countable theorem bot_topologicalSpace_eq_generateFrom_of_pred_succOrder [PartialOrder α] [PredOrder α] [SuccOrder α] [NoMinOrder α] [NoMaxOrder α] : (⊥ : TopologicalSpace α) = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } := by refine (eq_bot_of_singletons_open fun a => ?_).symm have h_singleton_eq_inter : {a} = Iio (succ a) ∩ Ioi (pred a) := by suffices h_singleton_eq_inter' : {a} = Iic a ∩ Ici a by rw [h_singleton_eq_inter', ← Ioi_pred, ← Iio_succ] rw [inter_comm, Ici_inter_Iic, Icc_self a] rw [h_singleton_eq_inter] letI := Preorder.topology α apply IsOpen.inter · exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩ · exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩ #align bot_topological_space_eq_generate_from_of_pred_succ_order bot_topologicalSpace_eq_generateFrom_of_pred_succOrder theorem discreteTopology_iff_orderTopology_of_pred_succ' [PartialOrder α] [PredOrder α] [SuccOrder α] [NoMinOrder α] [NoMaxOrder α] : DiscreteTopology α ↔ OrderTopology α := by refine ⟨fun h => ⟨?_⟩, fun h => ⟨?_⟩⟩ · rw [h.eq_bot] exact bot_topologicalSpace_eq_generateFrom_of_pred_succOrder · rw [h.topology_eq_generate_intervals] exact bot_topologicalSpace_eq_generateFrom_of_pred_succOrder.symm #align discrete_topology_iff_order_topology_of_pred_succ' discreteTopology_iff_orderTopology_of_pred_succ' instance (priority := 100) DiscreteTopology.orderTopology_of_pred_succ' [h : DiscreteTopology α] [PartialOrder α] [PredOrder α] [SuccOrder α] [NoMinOrder α] [NoMaxOrder α] : OrderTopology α := discreteTopology_iff_orderTopology_of_pred_succ'.1 h #align discrete_topology.order_topology_of_pred_succ' DiscreteTopology.orderTopology_of_pred_succ' theorem LinearOrder.bot_topologicalSpace_eq_generateFrom [LinearOrder α] [PredOrder α] [SuccOrder α] : (⊥ : TopologicalSpace α) = generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a } := by refine (eq_bot_of_singletons_open fun a => ?_).symm have h_singleton_eq_inter : {a} = Iic a ∩ Ici a := by rw [inter_comm, Ici_inter_Iic, Icc_self a] by_cases ha_top : IsTop a · rw [ha_top.Iic_eq, inter_comm, inter_univ] at h_singleton_eq_inter by_cases ha_bot : IsBot a · rw [ha_bot.Ici_eq] at h_singleton_eq_inter rw [h_singleton_eq_inter] -- Porting note: Specified instance for `isOpen_univ` explicitly to fix an error. apply @isOpen_univ _ (generateFrom { s | ∃ a, s = Ioi a ∨ s = Iio a }) · rw [isBot_iff_isMin] at ha_bot rw [← Ioi_pred_of_not_isMin ha_bot] at h_singleton_eq_inter rw [h_singleton_eq_inter] exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩ · rw [isTop_iff_isMax] at ha_top rw [← Iio_succ_of_not_isMax ha_top] at h_singleton_eq_inter by_cases ha_bot : IsBot a · rw [ha_bot.Ici_eq, inter_univ] at h_singleton_eq_inter rw [h_singleton_eq_inter] exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩ · rw [isBot_iff_isMin] at ha_bot rw [← Ioi_pred_of_not_isMin ha_bot] at h_singleton_eq_inter rw [h_singleton_eq_inter] -- Porting note: Specified instance for `IsOpen.inter` explicitly to fix an error. letI := Preorder.topology α apply IsOpen.inter · exact isOpen_generateFrom_of_mem ⟨succ a, Or.inr rfl⟩ · exact isOpen_generateFrom_of_mem ⟨pred a, Or.inl rfl⟩ #align linear_order.bot_topological_space_eq_generate_from LinearOrder.bot_topologicalSpace_eq_generateFrom
Mathlib/Topology/Instances/Discrete.lean
111
117
theorem discreteTopology_iff_orderTopology_of_pred_succ [LinearOrder α] [PredOrder α] [SuccOrder α] : DiscreteTopology α ↔ OrderTopology α := by
refine ⟨fun h => ⟨?_⟩, fun h => ⟨?_⟩⟩ · rw [h.eq_bot] exact LinearOrder.bot_topologicalSpace_eq_generateFrom · rw [h.topology_eq_generate_intervals] exact LinearOrder.bot_topologicalSpace_eq_generateFrom.symm
0.65625
namespace Nat @[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1 instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1)) theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩ theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by let t := dvd_gcd (Nat.dvd_mul_left k m) H2 rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n := H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm]) theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n := have H1 : Coprime (gcd (k * m) n) k := by rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right] Nat.dvd_antisymm (dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _)) (gcd_dvd_gcd_mul_left _ _ _) theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m]
.lake/packages/batteries/Batteries/Data/Nat/Gcd.lean
49
51
theorem Coprime.gcd_mul_left_cancel_right (n : Nat) (H : Coprime k m) : gcd m (k * n) = gcd m n := by
rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n]
0.65625
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp]
Mathlib/Data/List/ReduceOption.lean
19
21
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]
0.65625
import Mathlib.Algebra.FreeMonoid.Basic #align_import algebra.free_monoid.count from "leanprover-community/mathlib"@"a2d2e18906e2b62627646b5d5be856e6a642062f" variable {α : Type*} (p : α → Prop) [DecidablePred p] namespace FreeAddMonoid def countP : FreeAddMonoid α →+ ℕ where toFun := List.countP p map_zero' := List.countP_nil _ map_add' := List.countP_append _ #align free_add_monoid.countp FreeAddMonoid.countP theorem countP_of (x : α) : countP p (of x) = if p x = true then 1 else 0 := by simp [countP, List.countP, List.countP.go] #align free_add_monoid.countp_of FreeAddMonoid.countP_of theorem countP_apply (l : FreeAddMonoid α) : countP p l = List.countP p l := rfl #align free_add_monoid.countp_apply FreeAddMonoid.countP_apply -- Porting note: was (x = ·) def count [DecidableEq α] (x : α) : FreeAddMonoid α →+ ℕ := countP (· = x) #align free_add_monoid.count FreeAddMonoid.count
Mathlib/Algebra/FreeMonoid/Count.lean
43
45
theorem count_of [DecidableEq α] (x y : α) : count x (of y) = (Pi.single x 1 : α → ℕ) y := by
simp [Pi.single, Function.update, count, countP, List.countP, List.countP.go, Bool.beq_eq_decide_eq]
0.65625
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic #align_import linear_algebra.matrix.reindex from "leanprover-community/mathlib"@"1cfdf5f34e1044ecb65d10be753008baaf118edf" namespace Matrix open Equiv Matrix variable {l m n o : Type*} {l' m' n' o' : Type*} {m'' n'' : Type*} variable (R A : Type*) section AddCommMonoid variable [Semiring R] [AddCommMonoid A] [Module R A] def reindexLinearEquiv (eₘ : m ≃ m') (eₙ : n ≃ n') : Matrix m n A ≃ₗ[R] Matrix m' n' A := { reindex eₘ eₙ with map_add' := fun _ _ => rfl map_smul' := fun _ _ => rfl } #align matrix.reindex_linear_equiv Matrix.reindexLinearEquiv @[simp] theorem reindexLinearEquiv_apply (eₘ : m ≃ m') (eₙ : n ≃ n') (M : Matrix m n A) : reindexLinearEquiv R A eₘ eₙ M = reindex eₘ eₙ M := rfl #align matrix.reindex_linear_equiv_apply Matrix.reindexLinearEquiv_apply @[simp] theorem reindexLinearEquiv_symm (eₘ : m ≃ m') (eₙ : n ≃ n') : (reindexLinearEquiv R A eₘ eₙ).symm = reindexLinearEquiv R A eₘ.symm eₙ.symm := rfl #align matrix.reindex_linear_equiv_symm Matrix.reindexLinearEquiv_symm @[simp] theorem reindexLinearEquiv_refl_refl : reindexLinearEquiv R A (Equiv.refl m) (Equiv.refl n) = LinearEquiv.refl R _ := LinearEquiv.ext fun _ => rfl #align matrix.reindex_linear_equiv_refl_refl Matrix.reindexLinearEquiv_refl_refl
Mathlib/LinearAlgebra/Matrix/Reindex.lean
66
70
theorem reindexLinearEquiv_trans (e₁ : m ≃ m') (e₂ : n ≃ n') (e₁' : m' ≃ m'') (e₂' : n' ≃ n'') : (reindexLinearEquiv R A e₁ e₂).trans (reindexLinearEquiv R A e₁' e₂') = (reindexLinearEquiv R A (e₁.trans e₁') (e₂.trans e₂') : _ ≃ₗ[R] _) := by
ext rfl
0.65625
import Mathlib.Algebra.BigOperators.Group.List import Mathlib.Algebra.Group.Prod import Mathlib.Data.Multiset.Basic #align_import algebra.big_operators.multiset.basic from "leanprover-community/mathlib"@"6c5f73fd6f6cc83122788a80a27cdd54663609f4" assert_not_exists MonoidWithZero variable {F ι α β γ : Type*} namespace Multiset section CommMonoid variable [CommMonoid α] [CommMonoid β] {s t : Multiset α} {a : α} {m : Multiset ι} {f g : ι → α} @[to_additive "Sum of a multiset given a commutative additive monoid structure on `α`. `sum {a, b, c} = a + b + c`"] def prod : Multiset α → α := foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 #align multiset.prod Multiset.prod #align multiset.sum Multiset.sum @[to_additive] theorem prod_eq_foldr (s : Multiset α) : prod s = foldr (· * ·) (fun x y z => by simp [mul_left_comm]) 1 s := rfl #align multiset.prod_eq_foldr Multiset.prod_eq_foldr #align multiset.sum_eq_foldr Multiset.sum_eq_foldr @[to_additive] theorem prod_eq_foldl (s : Multiset α) : prod s = foldl (· * ·) (fun x y z => by simp [mul_right_comm]) 1 s := (foldr_swap _ _ _ _).trans (by simp [mul_comm]) #align multiset.prod_eq_foldl Multiset.prod_eq_foldl #align multiset.sum_eq_foldl Multiset.sum_eq_foldl @[to_additive (attr := simp, norm_cast)] theorem prod_coe (l : List α) : prod ↑l = l.prod := prod_eq_foldl _ #align multiset.coe_prod Multiset.prod_coe #align multiset.coe_sum Multiset.sum_coe @[to_additive (attr := simp)] theorem prod_toList (s : Multiset α) : s.toList.prod = s.prod := by conv_rhs => rw [← coe_toList s] rw [prod_coe] #align multiset.prod_to_list Multiset.prod_toList #align multiset.sum_to_list Multiset.sum_toList @[to_additive (attr := simp)] theorem prod_zero : @prod α _ 0 = 1 := rfl #align multiset.prod_zero Multiset.prod_zero #align multiset.sum_zero Multiset.sum_zero @[to_additive (attr := simp)] theorem prod_cons (a : α) (s) : prod (a ::ₘ s) = a * prod s := foldr_cons _ _ _ _ _ #align multiset.prod_cons Multiset.prod_cons #align multiset.sum_cons Multiset.sum_cons @[to_additive (attr := simp)] theorem prod_erase [DecidableEq α] (h : a ∈ s) : a * (s.erase a).prod = s.prod := by rw [← s.coe_toList, coe_erase, prod_coe, prod_coe, List.prod_erase (mem_toList.2 h)] #align multiset.prod_erase Multiset.prod_erase #align multiset.sum_erase Multiset.sum_erase @[to_additive (attr := simp)] theorem prod_map_erase [DecidableEq ι] {a : ι} (h : a ∈ m) : f a * ((m.erase a).map f).prod = (m.map f).prod := by rw [← m.coe_toList, coe_erase, map_coe, map_coe, prod_coe, prod_coe, List.prod_map_erase f (mem_toList.2 h)] #align multiset.prod_map_erase Multiset.prod_map_erase #align multiset.sum_map_erase Multiset.sum_map_erase @[to_additive (attr := simp)] theorem prod_singleton (a : α) : prod {a} = a := by simp only [mul_one, prod_cons, ← cons_zero, eq_self_iff_true, prod_zero] #align multiset.prod_singleton Multiset.prod_singleton #align multiset.sum_singleton Multiset.sum_singleton @[to_additive] theorem prod_pair (a b : α) : ({a, b} : Multiset α).prod = a * b := by rw [insert_eq_cons, prod_cons, prod_singleton] #align multiset.prod_pair Multiset.prod_pair #align multiset.sum_pair Multiset.sum_pair @[to_additive (attr := simp)] theorem prod_add (s t : Multiset α) : prod (s + t) = prod s * prod t := Quotient.inductionOn₂ s t fun l₁ l₂ => by simp #align multiset.prod_add Multiset.prod_add #align multiset.sum_add Multiset.sum_add @[to_additive] theorem prod_nsmul (m : Multiset α) : ∀ n : ℕ, (n • m).prod = m.prod ^ n | 0 => by rw [zero_nsmul, pow_zero] rfl | n + 1 => by rw [add_nsmul, one_nsmul, pow_add, pow_one, prod_add, prod_nsmul m n] #align multiset.prod_nsmul Multiset.prod_nsmul @[to_additive]
Mathlib/Algebra/BigOperators/Group/Multiset.lean
125
127
theorem prod_filter_mul_prod_filter_not (p) [DecidablePred p] : (s.filter p).prod * (s.filter (fun a ↦ ¬ p a)).prod = s.prod := by
rw [← prod_add, filter_add_not]
0.65625
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] namespace LinearOrderedField variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r) open Set theorem smul_Ioo : r • Ioo a b = Ioo (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Ioo] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_lt_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo theorem smul_Icc : r • Icc a b = Icc (r • a) (r • b) := by ext x simp only [mem_smul_set, smul_eq_mul, mem_Icc] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_le_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)] #align linear_ordered_field.smul_Icc LinearOrderedField.smul_Icc
Mathlib/Algebra/Order/Pointwise.lean
211
222
theorem smul_Ico : r • Ico a b = Ico (r • a) (r • b) := by
ext x simp only [mem_smul_set, smul_eq_mul, mem_Ico] constructor · rintro ⟨a, ⟨a_h_left_left, a_h_left_right⟩, rfl⟩ constructor · exact (mul_le_mul_left hr).mpr a_h_left_left · exact (mul_lt_mul_left hr).mpr a_h_left_right · rintro ⟨a_left, a_right⟩ use x / r refine ⟨⟨(le_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_right⟩, ?_⟩ rw [mul_div_cancel₀ _ (ne_of_gt hr)]
0.65625
import Mathlib.Algebra.Associated import Mathlib.Algebra.GeomSum import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.SMulWithZero import Mathlib.Data.Nat.Choose.Sum import Mathlib.Data.Nat.Lattice import Mathlib.RingTheory.Nilpotent.Defs #align_import ring_theory.nilpotent from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" universe u v open Function Set variable {R S : Type*} {x y : R} theorem IsNilpotent.neg [Ring R] (h : IsNilpotent x) : IsNilpotent (-x) := by obtain ⟨n, hn⟩ := h use n rw [neg_pow, hn, mul_zero] #align is_nilpotent.neg IsNilpotent.neg @[simp] theorem isNilpotent_neg_iff [Ring R] : IsNilpotent (-x) ↔ IsNilpotent x := ⟨fun h => neg_neg x ▸ h.neg, fun h => h.neg⟩ #align is_nilpotent_neg_iff isNilpotent_neg_iff lemma IsNilpotent.smul [MonoidWithZero R] [MonoidWithZero S] [MulActionWithZero R S] [SMulCommClass R S S] [IsScalarTower R S S] {a : S} (ha : IsNilpotent a) (t : R) : IsNilpotent (t • a) := by obtain ⟨k, ha⟩ := ha use k rw [smul_pow, ha, smul_zero] theorem IsNilpotent.isUnit_sub_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r - 1) := by obtain ⟨n, hn⟩ := hnil refine ⟨⟨r - 1, -∑ i ∈ Finset.range n, r ^ i, ?_, ?_⟩, rfl⟩ · simp [mul_geom_sum, hn] · simp [geom_sum_mul, hn] theorem IsNilpotent.isUnit_one_sub [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (1 - r) := by rw [← IsUnit.neg_iff, neg_sub] exact isUnit_sub_one hnil
Mathlib/RingTheory/Nilpotent/Basic.lean
68
70
theorem IsNilpotent.isUnit_add_one [Ring R] {r : R} (hnil : IsNilpotent r) : IsUnit (r + 1) := by
rw [← IsUnit.neg_iff, neg_add'] exact isUnit_sub_one hnil.neg
0.65625
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9" namespace Set variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M) theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by refine ⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩ obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h) rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h exact ⟨a + c, h, by rw [add_right_comm]⟩ #align set.Ici_add_bij Set.Ici_add_bij theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) := by refine ⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h => ?_⟩ obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h exact ⟨a + c, h, by rw [add_right_comm]⟩ #align set.Ioi_add_bij Set.Ioi_add_bij theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) := by rw [← Ici_inter_Iic, ← Ici_inter_Iic] exact (Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx => le_of_add_le_add_right hx.2 #align set.Icc_add_bij Set.Icc_add_bij theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by rw [← Ioi_inter_Iio, ← Ioi_inter_Iio] exact (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx => lt_of_add_lt_add_right hx.2 #align set.Ioo_add_bij Set.Ioo_add_bij theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic] exact (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx => le_of_add_le_add_right hx.2 #align set.Ioc_add_bij Set.Ioc_add_bij theorem Ico_add_bij : BijOn (· + d) (Ico a b) (Ico (a + d) (b + d)) := by rw [← Ici_inter_Iio, ← Ici_inter_Iio] exact (Ici_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx => lt_of_add_lt_add_right hx.2 #align set.Ico_add_bij Set.Ico_add_bij @[simp] theorem image_add_const_Ici : (fun x => x + a) '' Ici b = Ici (b + a) := (Ici_add_bij _ _).image_eq #align set.image_add_const_Ici Set.image_add_const_Ici @[simp] theorem image_add_const_Ioi : (fun x => x + a) '' Ioi b = Ioi (b + a) := (Ioi_add_bij _ _).image_eq #align set.image_add_const_Ioi Set.image_add_const_Ioi @[simp] theorem image_add_const_Icc : (fun x => x + a) '' Icc b c = Icc (b + a) (c + a) := (Icc_add_bij _ _ _).image_eq #align set.image_add_const_Icc Set.image_add_const_Icc @[simp] theorem image_add_const_Ico : (fun x => x + a) '' Ico b c = Ico (b + a) (c + a) := (Ico_add_bij _ _ _).image_eq #align set.image_add_const_Ico Set.image_add_const_Ico @[simp] theorem image_add_const_Ioc : (fun x => x + a) '' Ioc b c = Ioc (b + a) (c + a) := (Ioc_add_bij _ _ _).image_eq #align set.image_add_const_Ioc Set.image_add_const_Ioc @[simp] theorem image_add_const_Ioo : (fun x => x + a) '' Ioo b c = Ioo (b + a) (c + a) := (Ioo_add_bij _ _ _).image_eq #align set.image_add_const_Ioo Set.image_add_const_Ioo @[simp] theorem image_const_add_Ici : (fun x => a + x) '' Ici b = Ici (a + b) := by simp only [add_comm a, image_add_const_Ici] #align set.image_const_add_Ici Set.image_const_add_Ici @[simp]
Mathlib/Algebra/Order/Interval/Set/Monoid.lean
118
119
theorem image_const_add_Ioi : (fun x => a + x) '' Ioi b = Ioi (a + b) := by
simp only [add_comm a, image_add_const_Ioi]
0.65625
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n)
Mathlib/FieldTheory/Perfect.lean
113
114
theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by
rw [iterateFrobeniusEquiv_def, pow_zero, pow_one]
0.65625
import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Nat.Factors import Mathlib.Order.Interval.Finset.Nat #align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open scoped Classical open Finset namespace Nat variable (n : ℕ) def divisors : Finset ℕ := Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1)) #align nat.divisors Nat.divisors def properDivisors : Finset ℕ := Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n) #align nat.proper_divisors Nat.properDivisors def divisorsAntidiagonal : Finset (ℕ × ℕ) := Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1)) #align nat.divisors_antidiagonal Nat.divisorsAntidiagonal variable {n} @[simp] theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by ext simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self] exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt) #align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors @[simp] theorem filter_dvd_eq_properDivisors (h : n ≠ 0) : (Finset.range n).filter (· ∣ n) = n.properDivisors := by ext simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self] exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt) #align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors] #align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem @[simp] theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors] simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range] #align nat.mem_proper_divisors Nat.mem_properDivisors theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h), Finset.filter_insert, if_pos (dvd_refl n)] #align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
Mathlib/NumberTheory/Divisors.lean
89
91
theorem cons_self_properDivisors (h : n ≠ 0) : cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by
rw [cons_eq_insert, insert_self_properDivisors h]
0.65625
import Mathlib.Analysis.Convex.Gauge import Mathlib.Analysis.Convex.Normed open Metric Bornology Filter Set open scoped NNReal Topology Pointwise noncomputable section section Module variable {E : Type*} [AddCommGroup E] [Module ℝ E] def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x theorem gaugeRescale_def (s t : Set E) (x : E) : gaugeRescale s t x = (gauge s x / gauge t x) • x := rfl @[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _ theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) : gaugeRescale s t (c • x) = c • gaugeRescale s t x := by simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul] rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self] variable [TopologicalSpace E] [T1Space E] theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) (x : E) : gaugeRescale s s x = x := by rcases eq_or_ne x 0 with rfl | hx; · simp rw [gaugeRescale, div_self, one_smul] exact ((gauge_pos hsa hsb).2 hx).ne' theorem gaugeRescale_self {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) : gaugeRescale s s = id := funext <| gaugeRescale_self_apply hsa hsb theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x ≠ 0) : gauge t (gaugeRescale s t x) = gauge s x := by rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)), smul_eq_mul, div_mul_cancel₀ _ hx] theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t) (x : E) : gauge t (gaugeRescale s t x) = gauge s x := by rcases eq_or_ne x 0 with rfl | hx · simp · exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne'
Mathlib/Analysis/Convex/GaugeRescale.lean
69
73
theorem gauge_gaugeRescale_le (s t : Set E) (x : E) : gauge t (gaugeRescale s t x) ≤ gauge s x := by
by_cases hx : gauge t x = 0 · simp [gaugeRescale, hx, gauge_nonneg] · exact (gauge_gaugeRescale' s hx).le
0.65625
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w noncomputable section open scoped Classical Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} section SMul variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F] {c : 𝕜 → 𝕜'} {c' : 𝕜'}
Mathlib/Analysis/Calculus/Deriv/Mul.lean
87
89
theorem HasDerivWithinAt.smul (hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (fun y => c y • f y) (c x • f' + c' • f x) s x := by
simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt
0.65625
import Mathlib.Order.ConditionallyCompleteLattice.Finset import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.lattice from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54" assert_not_exists MonoidWithZero open Set namespace Nat open scoped Classical noncomputable instance : InfSet ℕ := ⟨fun s ↦ if h : ∃ n, n ∈ s then @Nat.find (fun n ↦ n ∈ s) _ h else 0⟩ noncomputable instance : SupSet ℕ := ⟨fun s ↦ if h : ∃ n, ∀ a ∈ s, a ≤ n then @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h else 0⟩ theorem sInf_def {s : Set ℕ} (h : s.Nonempty) : sInf s = @Nat.find (fun n ↦ n ∈ s) _ h := dif_pos _ #align nat.Inf_def Nat.sInf_def theorem sSup_def {s : Set ℕ} (h : ∃ n, ∀ a ∈ s, a ≤ n) : sSup s = @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h := dif_pos _ #align nat.Sup_def Nat.sSup_def theorem _root_.Set.Infinite.Nat.sSup_eq_zero {s : Set ℕ} (h : s.Infinite) : sSup s = 0 := dif_neg fun ⟨n, hn⟩ ↦ let ⟨k, hks, hk⟩ := h.exists_gt n (hn k hks).not_lt hk #align set.infinite.nat.Sup_eq_zero Set.Infinite.Nat.sSup_eq_zero @[simp] theorem sInf_eq_zero {s : Set ℕ} : sInf s = 0 ↔ 0 ∈ s ∨ s = ∅ := by cases eq_empty_or_nonempty s with | inl h => subst h simp only [or_true_iff, eq_self_iff_true, iff_true_iff, iInf, InfSet.sInf, mem_empty_iff_false, exists_false, dif_neg, not_false_iff] | inr h => simp only [h.ne_empty, or_false_iff, Nat.sInf_def, h, Nat.find_eq_zero] #align nat.Inf_eq_zero Nat.sInf_eq_zero @[simp]
Mathlib/Data/Nat/Lattice.lean
59
62
theorem sInf_empty : sInf ∅ = 0 := by
rw [sInf_eq_zero] right rfl
0.65625
import Mathlib.Algebra.Polynomial.Splits #align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222" noncomputable section @[ext] structure Cubic (R : Type*) where (a b c d : R) #align cubic Cubic namespace Cubic open Cubic Polynomial open Polynomial variable {R S F K : Type*} instance [Inhabited R] : Inhabited (Cubic R) := ⟨⟨default, default, default, default⟩⟩ instance [Zero R] : Zero (Cubic R) := ⟨⟨0, 0, 0, 0⟩⟩ section Basic variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R] def toPoly (P : Cubic R) : R[X] := C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d #align cubic.to_poly Cubic.toPoly theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} : C w * (X - C x) * (X - C y) * (X - C z) = toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by simp only [toPoly, C_neg, C_add, C_mul] ring1 set_option linter.uppercaseLean3 false in #align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq theorem prod_X_sub_C_eq [CommRing S] {x y z : S} : (X - C x) * (X - C y) * (X - C z) = toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul] set_option linter.uppercaseLean3 false in #align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq section Coeff private theorem coeffs : (∀ n > 3, P.toPoly.coeff n = 0) ∧ P.toPoly.coeff 3 = P.a ∧ P.toPoly.coeff 2 = P.b ∧ P.toPoly.coeff 1 = P.c ∧ P.toPoly.coeff 0 = P.d := by simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow] set_option tactic.skipAssignedInstances false in norm_num intro n hn repeat' rw [if_neg] any_goals linarith only [hn] repeat' rw [zero_add] @[simp] theorem coeff_eq_zero {n : ℕ} (hn : 3 < n) : P.toPoly.coeff n = 0 := coeffs.1 n hn #align cubic.coeff_eq_zero Cubic.coeff_eq_zero @[simp] theorem coeff_eq_a : P.toPoly.coeff 3 = P.a := coeffs.2.1 #align cubic.coeff_eq_a Cubic.coeff_eq_a @[simp] theorem coeff_eq_b : P.toPoly.coeff 2 = P.b := coeffs.2.2.1 #align cubic.coeff_eq_b Cubic.coeff_eq_b @[simp] theorem coeff_eq_c : P.toPoly.coeff 1 = P.c := coeffs.2.2.2.1 #align cubic.coeff_eq_c Cubic.coeff_eq_c @[simp] theorem coeff_eq_d : P.toPoly.coeff 0 = P.d := coeffs.2.2.2.2 #align cubic.coeff_eq_d Cubic.coeff_eq_d theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [← coeff_eq_a, h, coeff_eq_a] #align cubic.a_of_eq Cubic.a_of_eq theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [← coeff_eq_b, h, coeff_eq_b] #align cubic.b_of_eq Cubic.b_of_eq theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [← coeff_eq_c, h, coeff_eq_c] #align cubic.c_of_eq Cubic.c_of_eq theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by rw [← coeff_eq_d, h, coeff_eq_d] #align cubic.d_of_eq Cubic.d_of_eq theorem toPoly_injective (P Q : Cubic R) : P.toPoly = Q.toPoly ↔ P = Q := ⟨fun h ↦ Cubic.ext P Q (a_of_eq h) (b_of_eq h) (c_of_eq h) (d_of_eq h), congr_arg toPoly⟩ #align cubic.to_poly_injective Cubic.toPoly_injective theorem of_a_eq_zero (ha : P.a = 0) : P.toPoly = C P.b * X ^ 2 + C P.c * X + C P.d := by rw [toPoly, ha, C_0, zero_mul, zero_add] #align cubic.of_a_eq_zero Cubic.of_a_eq_zero theorem of_a_eq_zero' : toPoly ⟨0, b, c, d⟩ = C b * X ^ 2 + C c * X + C d := of_a_eq_zero rfl #align cubic.of_a_eq_zero' Cubic.of_a_eq_zero' theorem of_b_eq_zero (ha : P.a = 0) (hb : P.b = 0) : P.toPoly = C P.c * X + C P.d := by rw [of_a_eq_zero ha, hb, C_0, zero_mul, zero_add] #align cubic.of_b_eq_zero Cubic.of_b_eq_zero theorem of_b_eq_zero' : toPoly ⟨0, 0, c, d⟩ = C c * X + C d := of_b_eq_zero rfl rfl #align cubic.of_b_eq_zero' Cubic.of_b_eq_zero'
Mathlib/Algebra/CubicDiscriminant.lean
153
154
theorem of_c_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) : P.toPoly = C P.d := by
rw [of_b_eq_zero ha hb, hc, C_0, zero_mul, zero_add]
0.65625
import Mathlib.FieldTheory.RatFunc.AsPolynomial import Mathlib.RingTheory.EuclideanDomain import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Polynomial.Content noncomputable section universe u variable {K : Type u} namespace RatFunc section IntDegree open Polynomial variable [Field K] def intDegree (x : RatFunc K) : ℤ := natDegree x.num - natDegree x.denom #align ratfunc.int_degree RatFunc.intDegree @[simp] theorem intDegree_zero : intDegree (0 : RatFunc K) = 0 := by rw [intDegree, num_zero, natDegree_zero, denom_zero, natDegree_one, sub_self] #align ratfunc.int_degree_zero RatFunc.intDegree_zero @[simp] theorem intDegree_one : intDegree (1 : RatFunc K) = 0 := by rw [intDegree, num_one, denom_one, sub_self] #align ratfunc.int_degree_one RatFunc.intDegree_one @[simp]
Mathlib/FieldTheory/RatFunc/Degree.lean
54
55
theorem intDegree_C (k : K) : intDegree (C k) = 0 := by
rw [intDegree, num_C, natDegree_C, denom_C, natDegree_one, sub_self]
0.65625
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Logic.Lemmas #align_import combinatorics.quiver.path from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" open Function universe v v₁ v₂ u u₁ u₂ namespace Quiver inductive Path {V : Type u} [Quiver.{v} V] (a : V) : V → Sort max (u + 1) v | nil : Path a a | cons : ∀ {b c : V}, Path a b → (b ⟶ c) → Path a c #align quiver.path Quiver.Path -- See issue lean4#2049 compile_inductive% Path def Hom.toPath {V} [Quiver V] {a b : V} (e : a ⟶ b) : Path a b := Path.nil.cons e #align quiver.hom.to_path Quiver.Hom.toPath namespace Path variable {V : Type u} [Quiver V] {a b c d : V} lemma nil_ne_cons (p : Path a b) (e : b ⟶ a) : Path.nil ≠ p.cons e := fun h => by injection h #align quiver.path.nil_ne_cons Quiver.Path.nil_ne_cons lemma cons_ne_nil (p : Path a b) (e : b ⟶ a) : p.cons e ≠ Path.nil := fun h => by injection h #align quiver.path.cons_ne_nil Quiver.Path.cons_ne_nil lemma obj_eq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : b = c := by injection h #align quiver.path.obj_eq_of_cons_eq_cons Quiver.Path.obj_eq_of_cons_eq_cons lemma heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq p p' := by injection h #align quiver.path.heq_of_cons_eq_cons Quiver.Path.heq_of_cons_eq_cons lemma hom_heq_of_cons_eq_cons {p : Path a b} {p' : Path a c} {e : b ⟶ d} {e' : c ⟶ d} (h : p.cons e = p'.cons e') : HEq e e' := by injection h #align quiver.path.hom_heq_of_cons_eq_cons Quiver.Path.hom_heq_of_cons_eq_cons def length {a : V} : ∀ {b : V}, Path a b → ℕ | _, nil => 0 | _, cons p _ => p.length + 1 #align quiver.path.length Quiver.Path.length instance {a : V} : Inhabited (Path a a) := ⟨nil⟩ @[simp] theorem length_nil {a : V} : (nil : Path a a).length = 0 := rfl #align quiver.path.length_nil Quiver.Path.length_nil @[simp] theorem length_cons (a b c : V) (p : Path a b) (e : b ⟶ c) : (p.cons e).length = p.length + 1 := rfl #align quiver.path.length_cons Quiver.Path.length_cons
Mathlib/Combinatorics/Quiver/Path.lean
81
84
theorem eq_of_length_zero (p : Path a b) (hzero : p.length = 0) : a = b := by
cases p · rfl · cases Nat.succ_ne_zero _ hzero
0.65625
import Mathlib.LinearAlgebra.Dual open Function Module variable (R M N : Type*) [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] structure PerfectPairing := toLin : M →ₗ[R] N →ₗ[R] R bijectiveLeft : Bijective toLin bijectiveRight : Bijective toLin.flip attribute [nolint docBlame] PerfectPairing.toLin variable {R M N} namespace PerfectPairing instance instFunLike : FunLike (PerfectPairing R M N) M (N →ₗ[R] R) where coe f := f.toLin coe_injective' x y h := by cases x; cases y; simpa using h variable (p : PerfectPairing R M N) protected def flip : PerfectPairing R N M where toLin := p.toLin.flip bijectiveLeft := p.bijectiveRight bijectiveRight := p.bijectiveLeft @[simp] lemma flip_flip : p.flip.flip = p := rfl noncomputable def toDualLeft : M ≃ₗ[R] Dual R N := LinearEquiv.ofBijective p.toLin p.bijectiveLeft @[simp] theorem toDualLeft_apply (a : M) : p.toDualLeft a = p a := rfl @[simp] theorem apply_toDualLeft_symm_apply (f : Dual R N) (x : N) : p (p.toDualLeft.symm f) x = f x := by have h := LinearEquiv.apply_symm_apply p.toDualLeft f rw [toDualLeft_apply] at h exact congrFun (congrArg DFunLike.coe h) x noncomputable def toDualRight : N ≃ₗ[R] Dual R M := toDualLeft p.flip @[simp] theorem toDualRight_apply (a : N) : p.toDualRight a = p.flip a := rfl @[simp]
Mathlib/LinearAlgebra/PerfectPairing.lean
85
89
theorem apply_apply_toDualRight_symm (x : M) (f : Dual R M) : (p x) (p.toDualRight.symm f) = f x := by
have h := LinearEquiv.apply_symm_apply p.toDualRight f rw [toDualRight_apply] at h exact congrFun (congrArg DFunLike.coe h) x
0.65625
import Mathlib.Algebra.Group.Semiconj.Defs import Mathlib.Algebra.Ring.Defs #align_import algebra.ring.semiconj from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function namespace SemiconjBy @[simp] theorem add_right [Distrib R] {a x y x' y' : R} (h : SemiconjBy a x y) (h' : SemiconjBy a x' y') : SemiconjBy a (x + x') (y + y') := by simp only [SemiconjBy, left_distrib, right_distrib, h.eq, h'.eq] #align semiconj_by.add_right SemiconjBy.add_right @[simp]
Mathlib/Algebra/Ring/Semiconj.lean
39
41
theorem add_left [Distrib R] {a b x y : R} (ha : SemiconjBy a x y) (hb : SemiconjBy b x y) : SemiconjBy (a + b) x y := by
simp only [SemiconjBy, left_distrib, right_distrib, ha.eq, hb.eq]
0.65625
import Mathlib.Algebra.Group.Units import Mathlib.Algebra.GroupWithZero.Basic import Mathlib.Logic.Equiv.Defs import Mathlib.Tactic.Contrapose import Mathlib.Tactic.Nontriviality import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.group_with_zero.units.basic from "leanprover-community/mathlib"@"df5e9937a06fdd349fc60106f54b84d47b1434f0" -- Guard against import creep assert_not_exists Multiplicative assert_not_exists DenselyOrdered variable {α M₀ G₀ M₀' G₀' F F' : Type*} variable [MonoidWithZero M₀] @[simp] theorem isUnit_zero_iff : IsUnit (0 : M₀) ↔ (0 : M₀) = 1 := ⟨fun ⟨⟨_, a, (a0 : 0 * a = 1), _⟩, rfl⟩ => by rwa [zero_mul] at a0, fun h => @isUnit_of_subsingleton _ _ (subsingleton_of_zero_eq_one h) 0⟩ #align is_unit_zero_iff isUnit_zero_iff -- Porting note: removed `simp` tag because `simpNF` says it's redundant theorem not_isUnit_zero [Nontrivial M₀] : ¬IsUnit (0 : M₀) := mt isUnit_zero_iff.1 zero_ne_one #align not_is_unit_zero not_isUnit_zero namespace Ring open scoped Classical noncomputable def inverse : M₀ → M₀ := fun x => if h : IsUnit x then ((h.unit⁻¹ : M₀ˣ) : M₀) else 0 #align ring.inverse Ring.inverse @[simp] theorem inverse_unit (u : M₀ˣ) : inverse (u : M₀) = (u⁻¹ : M₀ˣ) := by rw [inverse, dif_pos u.isUnit, IsUnit.unit_of_val_units] #align ring.inverse_unit Ring.inverse_unit @[simp] theorem inverse_non_unit (x : M₀) (h : ¬IsUnit x) : inverse x = 0 := dif_neg h #align ring.inverse_non_unit Ring.inverse_non_unit theorem mul_inverse_cancel (x : M₀) (h : IsUnit x) : x * inverse x = 1 := by rcases h with ⟨u, rfl⟩ rw [inverse_unit, Units.mul_inv] #align ring.mul_inverse_cancel Ring.mul_inverse_cancel theorem inverse_mul_cancel (x : M₀) (h : IsUnit x) : inverse x * x = 1 := by rcases h with ⟨u, rfl⟩ rw [inverse_unit, Units.inv_mul] #align ring.inverse_mul_cancel Ring.inverse_mul_cancel theorem mul_inverse_cancel_right (x y : M₀) (h : IsUnit x) : y * x * inverse x = y := by rw [mul_assoc, mul_inverse_cancel x h, mul_one] #align ring.mul_inverse_cancel_right Ring.mul_inverse_cancel_right theorem inverse_mul_cancel_right (x y : M₀) (h : IsUnit x) : y * inverse x * x = y := by rw [mul_assoc, inverse_mul_cancel x h, mul_one] #align ring.inverse_mul_cancel_right Ring.inverse_mul_cancel_right
Mathlib/Algebra/GroupWithZero/Units/Basic.lean
126
127
theorem mul_inverse_cancel_left (x y : M₀) (h : IsUnit x) : x * (inverse x * y) = y := by
rw [← mul_assoc, mul_inverse_cancel x h, one_mul]
0.65625
import Mathlib.NumberTheory.Zsqrtd.Basic import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.Data.Complex.Basic import Mathlib.Data.Real.Archimedean #align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Zsqrtd Complex open scoped ComplexConjugate abbrev GaussianInt : Type := Zsqrtd (-1) #align gaussian_int GaussianInt local notation "ℤ[i]" => GaussianInt namespace GaussianInt instance : Repr ℤ[i] := ⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩ instance instCommRing : CommRing ℤ[i] := Zsqrtd.commRing #align gaussian_int.comm_ring GaussianInt.instCommRing section attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily. def toComplex : ℤ[i] →+* ℂ := Zsqrtd.lift ⟨I, by simp⟩ #align gaussian_int.to_complex GaussianInt.toComplex end instance : Coe ℤ[i] ℂ := ⟨toComplex⟩ theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I := rfl #align gaussian_int.to_complex_def GaussianInt.toComplex_def theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def] #align gaussian_int.to_complex_def' GaussianInt.toComplex_def' theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by apply Complex.ext <;> simp [toComplex_def] #align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂ @[simp] theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def] #align gaussian_int.to_real_re GaussianInt.to_real_re @[simp] theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def] #align gaussian_int.to_real_im GaussianInt.to_real_im @[simp] theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def] #align gaussian_int.to_complex_re GaussianInt.toComplex_re @[simp] theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def] #align gaussian_int.to_complex_im GaussianInt.toComplex_im -- Porting note (#10618): @[simp] can prove this theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y := toComplex.map_add _ _ #align gaussian_int.to_complex_add GaussianInt.toComplex_add -- Porting note (#10618): @[simp] can prove this theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y := toComplex.map_mul _ _ #align gaussian_int.to_complex_mul GaussianInt.toComplex_mul -- Porting note (#10618): @[simp] can prove this theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 := toComplex.map_one #align gaussian_int.to_complex_one GaussianInt.toComplex_one -- Porting note (#10618): @[simp] can prove this theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 := toComplex.map_zero #align gaussian_int.to_complex_zero GaussianInt.toComplex_zero -- Porting note (#10618): @[simp] can prove this theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x := toComplex.map_neg _ #align gaussian_int.to_complex_neg GaussianInt.toComplex_neg -- Porting note (#10618): @[simp] can prove this theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y := toComplex.map_sub _ _ #align gaussian_int.to_complex_sub GaussianInt.toComplex_sub @[simp] theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by rw [toComplex_def₂, toComplex_def₂] exact congr_arg₂ _ rfl (Int.cast_neg _) #align gaussian_int.to_complex_star GaussianInt.toComplex_star @[simp] theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by cases x; cases y; simp [toComplex_def₂] #align gaussian_int.to_complex_inj GaussianInt.toComplex_inj lemma toComplex_injective : Function.Injective GaussianInt.toComplex := fun ⦃_ _⦄ ↦ toComplex_inj.mp @[simp]
Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean
149
150
theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
rw [← toComplex_zero, toComplex_inj]
0.65625
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]
Mathlib/Order/Interval/Set/OrderIso.lean
88
89
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]
0.65625
import Mathlib.Algebra.MvPolynomial.Degrees #align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section open Set Function Finsupp AddMonoidAlgebra universe u v w variable {R : Type u} {S : Type v} namespace MvPolynomial variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ} section CommSemiring variable [CommSemiring R] {p q : MvPolynomial σ R} section Vars def vars (p : MvPolynomial σ R) : Finset σ := letI := Classical.decEq σ p.degrees.toFinset #align mv_polynomial.vars MvPolynomial.vars theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by rw [vars] convert rfl #align mv_polynomial.vars_def MvPolynomial.vars_def @[simp] theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by classical rw [vars_def, degrees_zero, Multiset.toFinset_zero] #align mv_polynomial.vars_0 MvPolynomial.vars_0 @[simp] theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset] #align mv_polynomial.vars_monomial MvPolynomial.vars_monomial @[simp] theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by classical rw [vars_def, degrees_C, Multiset.toFinset_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_C MvPolynomial.vars_C @[simp] theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_X MvPolynomial.vars_X theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop] #align mv_polynomial.mem_vars MvPolynomial.mem_vars theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support) {v : σ} (h : v ∉ vars f) : x v = 0 := by contrapose! h exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩ #align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) : (p + q).vars ⊆ p.vars ∪ q.vars := by intro x hx simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢ simpa using Multiset.mem_of_le (degrees_add _ _) hx #align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) : (p + q).vars = p.vars ∪ q.vars := by refine (vars_add_subset p q).antisymm fun x hx => ?_ simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢ rwa [degrees_add_of_disjoint h, Multiset.toFinset_union] #align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint section Mul theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset] exact Multiset.subset_of_le (degrees_mul φ ψ) #align mv_polynomial.vars_mul MvPolynomial.vars_mul @[simp] theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ := vars_C #align mv_polynomial.vars_one MvPolynomial.vars_one
Mathlib/Algebra/MvPolynomial/Variables.lean
134
140
theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by
classical induction' n with n ih · simp · rw [pow_succ'] apply Finset.Subset.trans (vars_mul _ _) exact Finset.union_subset (Finset.Subset.refl _) ih
0.65625
import Mathlib.Data.Finset.Image #align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83" assert_not_exists MonoidWithZero -- TODO: After a lot more work, -- assert_not_exists OrderedCommMonoid open Function Multiset Nat variable {α β R : Type*} namespace Finset variable {s t : Finset α} {a b : α} def card (s : Finset α) : ℕ := Multiset.card s.1 #align finset.card Finset.card theorem card_def (s : Finset α) : s.card = Multiset.card s.1 := rfl #align finset.card_def Finset.card_def @[simp] lemma card_val (s : Finset α) : Multiset.card s.1 = s.card := rfl #align finset.card_val Finset.card_val @[simp] theorem card_mk {m nodup} : (⟨m, nodup⟩ : Finset α).card = Multiset.card m := rfl #align finset.card_mk Finset.card_mk @[simp] theorem card_empty : card (∅ : Finset α) = 0 := rfl #align finset.card_empty Finset.card_empty @[gcongr] theorem card_le_card : s ⊆ t → s.card ≤ t.card := Multiset.card_le_card ∘ val_le_iff.mpr #align finset.card_le_of_subset Finset.card_le_card @[mono] theorem card_mono : Monotone (@card α) := by apply card_le_card #align finset.card_mono Finset.card_mono @[simp] lemma card_eq_zero : s.card = 0 ↔ s = ∅ := card_eq_zero.trans val_eq_zero lemma card_ne_zero : s.card ≠ 0 ↔ s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm lemma card_pos : 0 < s.card ↔ s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero #align finset.card_eq_zero Finset.card_eq_zero #align finset.card_pos Finset.card_pos alias ⟨_, Nonempty.card_pos⟩ := card_pos alias ⟨_, Nonempty.card_ne_zero⟩ := card_ne_zero #align finset.nonempty.card_pos Finset.Nonempty.card_pos theorem card_ne_zero_of_mem (h : a ∈ s) : s.card ≠ 0 := (not_congr card_eq_zero).2 <| ne_empty_of_mem h #align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem @[simp] theorem card_singleton (a : α) : card ({a} : Finset α) = 1 := Multiset.card_singleton _ #align finset.card_singleton Finset.card_singleton
Mathlib/Data/Finset/Card.lean
91
94
theorem card_singleton_inter [DecidableEq α] : ({a} ∩ s).card ≤ 1 := by
cases' Finset.decidableMem a s with h h · simp [Finset.singleton_inter_of_not_mem h] · simp [Finset.singleton_inter_of_mem h]
0.65625
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" set_option linter.uppercaseLean3 false noncomputable section open scoped Classical open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set namespace Complex section variable {α : Type*} {l : Filter α} {f g : α → ℂ} open Asymptotics theorem isTheta_exp_arg_mul_im (hl : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) : (fun x => Real.exp (arg (f x) * im (g x))) =Θ[l] fun _ => (1 : ℝ) := by rcases hl with ⟨b, hb⟩ refine Real.isTheta_exp_comp_one.2 ⟨π * b, ?_⟩ rw [eventually_map] at hb ⊢ refine hb.mono fun x hx => ?_ erw [abs_mul] exact mul_le_mul (abs_arg_le_pi _) hx (abs_nonneg _) Real.pi_pos.le #align complex.is_Theta_exp_arg_mul_im Complex.isTheta_exp_arg_mul_im theorem isBigO_cpow_rpow (hl : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) : (fun x => f x ^ g x) =O[l] fun x => abs (f x) ^ (g x).re := calc (fun x => f x ^ g x) =O[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / Real.exp (arg (f x) * im (g x))) := isBigO_of_le _ fun x => (abs_cpow_le _ _).trans (le_abs_self _) _ =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / (1 : ℝ)) := ((isTheta_refl _ _).div (isTheta_exp_arg_mul_im hl)) _ =ᶠ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re) := by simp only [ofReal_one, div_one] rfl #align complex.is_O_cpow_rpow Complex.isBigO_cpow_rpow
Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean
223
234
theorem isTheta_cpow_rpow (hl_im : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) (hl : ∀ᶠ x in l, f x = 0 → re (g x) = 0 → g x = 0) : (fun x => f x ^ g x) =Θ[l] fun x => abs (f x) ^ (g x).re := calc (fun x => f x ^ g x) =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / Real.exp (arg (f x) * im (g x))) := isTheta_of_norm_eventuallyEq' <| hl.mono fun x => abs_cpow_of_imp _ =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / (1 : ℝ)) := ((isTheta_refl _ _).div (isTheta_exp_arg_mul_im hl_im)) _ =ᶠ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re) := by
simp only [ofReal_one, div_one] rfl
0.65625
import Mathlib.Combinatorics.SimpleGraph.DegreeSum import Mathlib.Combinatorics.SimpleGraph.Subgraph #align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508" universe u namespace SimpleGraph variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G) namespace Subgraph def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w #align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet := ⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩ #align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts) (hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by simp only [IsMatching.toEdge, Subtype.mk_eq_mk] congr exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm #align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj
Mathlib/Combinatorics/SimpleGraph/Matching.lean
70
74
theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) : Function.Surjective h.toEdge := by
rintro ⟨e, he⟩ refine Sym2.ind (fun x y he => ?_) e he exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩
0.65625
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions noncomputable section open scoped Manifold open Bundle Set Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] namespace PartialHomeomorph.MDifferentiable variable {I I' I''} variable {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') {e' : PartialHomeomorph M' M''} nonrec theorem symm : e.symm.MDifferentiable I' I := he.symm #align local_homeomorph.mdifferentiable.symm PartialHomeomorph.MDifferentiable.symm protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x := (he.1 x hx).mdifferentiableAt (e.open_source.mem_nhds hx) #align local_homeomorph.mdifferentiable.mdifferentiable_at PartialHomeomorph.MDifferentiable.mdifferentiableAt theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x := (he.2 x hx).mdifferentiableAt (e.open_target.mem_nhds hx) #align local_homeomorph.mdifferentiable.mdifferentiable_at_symm PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M'] [SmoothManifoldWithCorners I'' M'']
Mathlib/Geometry/Manifold/MFDeriv/Atlas.lean
200
210
theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) : (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
have : mfderiv I I (e.symm ∘ e) x = (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) := mfderiv_comp x (he.mdifferentiableAt_symm (e.map_source hx)) (he.mdifferentiableAt hx) rw [← this] have : mfderiv I I (_root_.id : M → M) x = ContinuousLinearMap.id _ _ := mfderiv_id I rw [← this] apply Filter.EventuallyEq.mfderiv_eq have : e.source ∈ 𝓝 x := e.open_source.mem_nhds hx exact Filter.mem_of_superset this (by mfld_set_tac)
0.65625
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] theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by rw [← mul_assoc, mul_invOf_self, one_mul] theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by rw [← mul_assoc, mul_invOf_self, one_mul] #align mul_inv_of_self_assoc mul_invOf_self_assoc @[simp]
Mathlib/Algebra/Group/Invertible/Defs.lean
133
134
theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by
simp [mul_assoc]
0.65625
import Mathlib.Dynamics.PeriodicPts import Mathlib.GroupTheory.Exponent import Mathlib.GroupTheory.GroupAction.Basic namespace MulAction universe u v variable {α : Type v} variable {G : Type u} [Group G] [MulAction G α] variable {M : Type u} [Monoid M] [MulAction M α] @[to_additive "If the action is periodic, then a lower bound for its period can be computed."] theorem le_period {m : M} {a : α} {n : ℕ} (period_pos : 0 < period m a) (moved : ∀ k, 0 < k → k < n → m ^ k • a ≠ a) : n ≤ period m a := le_of_not_gt fun period_lt_n => moved _ period_pos period_lt_n <| pow_period_smul m a @[to_additive "If for some `n`, `(n • m) +ᵥ a = a`, then `period m a ≤ n`."] theorem period_le_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) : period m a ≤ n := (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_le n_pos @[to_additive "If for some `n`, `(n • m) +ᵥ a = a`, then `0 < period m a`."] theorem period_pos_of_fixed {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (fixed : m ^ n • a = a) : 0 < period m a := (isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_pos n_pos @[to_additive] theorem period_eq_one_iff {m : M} {a : α} : period m a = 1 ↔ m • a = a := ⟨fun eq_one => pow_one m ▸ eq_one ▸ pow_period_smul m a, fun fixed => le_antisymm (period_le_of_fixed one_pos (by simpa)) (period_pos_of_fixed one_pos (by simpa))⟩ @[to_additive "For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `n • m`."] theorem pow_smul_ne_of_lt_period {m : M} {a : α} {n : ℕ} (n_pos : 0 < n) (n_lt_period : n < period m a) : m ^ n • a ≠ a := fun a_fixed => not_le_of_gt n_lt_period <| period_le_of_fixed n_pos a_fixed section MonoidExponent @[to_additive] theorem period_dvd_orderOf (m : M) (a : α) : period m a ∣ orderOf m := by rw [← pow_smul_eq_iff_period_dvd, pow_orderOf_eq_one, one_smul] @[to_additive] theorem period_pos_of_orderOf_pos {m : M} (order_pos : 0 < orderOf m) (a : α) : 0 < period m a := Nat.pos_of_dvd_of_pos (period_dvd_orderOf m a) order_pos @[to_additive] theorem period_le_orderOf {m : M} (order_pos : 0 < orderOf m) (a : α) : period m a ≤ orderOf m := Nat.le_of_dvd order_pos (period_dvd_orderOf m a) @[to_additive]
Mathlib/GroupTheory/GroupAction/Period.lean
101
102
theorem period_dvd_exponent (m : M) (a : α) : period m a ∣ Monoid.exponent M := by
rw [← pow_smul_eq_iff_period_dvd, Monoid.pow_exponent_eq_one, one_smul]
0.65625
import Mathlib.Order.Interval.Finset.Nat #align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" assert_not_exists MonoidWithZero open Finset Fin Function namespace Fin variable (n : ℕ) instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) := OrderIso.locallyFiniteOrder Fin.orderIsoSubtype instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) := OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n) | 0 => IsEmpty.toLocallyFiniteOrderTop | _ + 1 => inferInstance variable {n} (a b : Fin n) theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n := rfl #align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n := rfl #align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n := rfl #align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n := rfl #align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl #align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype @[simp] theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc @[simp] theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico @[simp] theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc @[simp]
Mathlib/Order/Interval/Finset/Fin.lean
94
95
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
0.65625
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840" noncomputable section open Affine open Set section variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] def vectorSpan (s : Set P) : Submodule k V := Submodule.span k (s -ᵥ s) #align vector_span vectorSpan theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -ᵥ s) := rfl #align vector_span_def vectorSpan_def theorem vectorSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : vectorSpan k s₁ ≤ vectorSpan k s₂ := Submodule.span_mono (vsub_self_mono h) #align vector_span_mono vectorSpan_mono variable (P) @[simp]
Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean
78
79
theorem vectorSpan_empty : vectorSpan k (∅ : Set P) = (⊥ : Submodule k V) := by
rw [vectorSpan_def, vsub_empty, Submodule.span_empty]
0.65625
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.RingTheory.Int.Basic import Mathlib.Tactic.Ring import Mathlib.Tactic.FieldSimp import Mathlib.Data.Int.NatPrime import Mathlib.Data.ZMod.Basic #align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
Mathlib/NumberTheory/PythagoreanTriples.lean
32
34
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by
change Fin 4 at z fin_cases z <;> decide
0.65625
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.CharZero.Lemmas import Mathlib.Data.Finset.NatAntidiagonal import Mathlib.Data.Nat.Choose.Central import Mathlib.Data.Tree.Basic import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.GCongr import Mathlib.Tactic.Positivity #align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da" open Finset open Finset.antidiagonal (fst_le snd_le) def catalan : ℕ → ℕ | 0 => 1 | n + 1 => ∑ i : Fin n.succ, catalan i * catalan (n - i) #align catalan catalan @[simp] theorem catalan_zero : catalan 0 = 1 := by rw [catalan] #align catalan_zero catalan_zero
Mathlib/Combinatorics/Enumerative/Catalan.lean
68
69
theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
0.65625
import Mathlib.Data.Analysis.Filter import Mathlib.Topology.Bases import Mathlib.Topology.LocallyFinite #align_import data.analysis.topology from "leanprover-community/mathlib"@"55d771df074d0dd020139ee1cd4b95521422df9f" open Set open Filter hiding Realizer open Topology structure Ctop (α σ : Type*) where f : σ → Set α top : α → σ top_mem : ∀ x : α, x ∈ f (top x) inter : ∀ (a b) (x : α), x ∈ f a ∩ f b → σ inter_mem : ∀ a b x h, x ∈ f (inter a b x h) inter_sub : ∀ a b x h, f (inter a b x h) ⊆ f a ∩ f b #align ctop Ctop variable {α : Type*} {β : Type*} {σ : Type*} {τ : Type*} instance : Inhabited (Ctop α (Set α)) := ⟨{ f := id top := singleton top_mem := mem_singleton inter := fun s t _ _ ↦ s ∩ t inter_mem := fun _s _t _a ↦ id inter_sub := fun _s _t _a _ha ↦ Subset.rfl }⟩ namespace Ctop section variable (F : Ctop α σ) instance : CoeFun (Ctop α σ) fun _ ↦ σ → Set α := ⟨Ctop.f⟩ -- @[simp] -- Porting note (#10685): dsimp can prove this theorem coe_mk (f T h₁ I h₂ h₃ a) : (@Ctop.mk α σ f T h₁ I h₂ h₃) a = f a := rfl #align ctop.coe_mk Ctop.coe_mk def ofEquiv (E : σ ≃ τ) : Ctop α σ → Ctop α τ | ⟨f, T, h₁, I, h₂, h₃⟩ => { f := fun a ↦ f (E.symm a) top := fun x ↦ E (T x) top_mem := fun x ↦ by simpa using h₁ x inter := fun a b x h ↦ E (I (E.symm a) (E.symm b) x h) inter_mem := fun a b x h ↦ by simpa using h₂ (E.symm a) (E.symm b) x h inter_sub := fun a b x h ↦ by simpa using h₃ (E.symm a) (E.symm b) x h } #align ctop.of_equiv Ctop.ofEquiv @[simp]
Mathlib/Data/Analysis/Topology.lean
79
80
theorem ofEquiv_val (E : σ ≃ τ) (F : Ctop α σ) (a : τ) : F.ofEquiv E a = F (E.symm a) := by
cases F; rfl
0.65625
import Mathlib.Order.Interval.Finset.Nat #align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" assert_not_exists MonoidWithZero open Finset Fin Function namespace Fin variable (n : ℕ) instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) := OrderIso.locallyFiniteOrder Fin.orderIsoSubtype instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) := OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n) | 0 => IsEmpty.toLocallyFiniteOrderTop | _ + 1 => inferInstance variable {n} (a b : Fin n) theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n := rfl #align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n := rfl #align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n := rfl #align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n := rfl #align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl #align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype @[simp] theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc @[simp] theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico @[simp] theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc @[simp] theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo @[simp] theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b := map_valEmbedding_Icc _ _ #align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map] #align fin.card_Icc Fin.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := by rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map] #align fin.card_Ico Fin.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := by rw [← Nat.card_Ioc, ← map_valEmbedding_Ioc, card_map] #align fin.card_Ioc Fin.card_Ioc @[simp]
Mathlib/Order/Interval/Finset/Fin.lean
119
120
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map]
0.65625
import Mathlib.Init.Function #align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb" universe u open Function namespace Option variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ} def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ := a.bind fun a => b.map <| f a #align option.map₂ Option.map₂ theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) : map₂ f a b = f <$> a <*> b := by cases a <;> rfl #align option.map₂_def Option.map₂_def -- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl #align option.map₂_some_some Option.map₂_some_some theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl #align option.map₂_coe_coe Option.map₂_coe_coe @[simp] theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl #align option.map₂_none_left Option.map₂_none_left @[simp] theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl #align option.map₂_none_right Option.map₂_none_right @[simp] theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b := rfl #align option.map₂_coe_left Option.map₂_coe_left -- Porting note: This proof was `rfl` in Lean3, but now is not. @[simp] theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) : map₂ f a b = a.map fun a => f a b := by cases a <;> rfl #align option.map₂_coe_right Option.map₂_coe_right -- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal. theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by simp [map₂, bind_eq_some] #align option.mem_map₂_iff Option.mem_map₂_iff @[simp] theorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by cases a <;> cases b <;> simp #align option.map₂_eq_none_iff Option.map₂_eq_none_iff theorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) : map₂ f a b = map₂ (fun a b => f b a) b a := by cases a <;> cases b <;> rfl #align option.map₂_swap Option.map₂_swap theorem map_map₂ (f : α → β → γ) (g : γ → δ) : (map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by cases a <;> cases b <;> rfl #align option.map_map₂ Option.map_map₂
Mathlib/Data/Option/NAry.lean
95
96
theorem map₂_map_left (f : γ → β → δ) (g : α → γ) : map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by
cases a <;> rfl
0.65625
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section RealDerivOfComplex open Complex variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ} theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) : HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt have B : HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasStrictFDerivAt.restrictScalars ℝ have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasStrictDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) : HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasFDerivAt have B : HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasFDerivAt.restrictScalars ℝ have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_deriv_at.real_of_complex HasDerivAt.real_of_complex theorem ContDiffAt.real_of_complex {n : ℕ∞} (h : ContDiffAt ℂ n e z) : ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by have A : ContDiffAt ℝ n ((↑) : ℝ → ℂ) z := ofRealCLM.contDiff.contDiffAt have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt exact C.comp z (B.comp z A) #align cont_diff_at.real_of_complex ContDiffAt.real_of_complex theorem ContDiff.real_of_complex {n : ℕ∞} (h : ContDiff ℂ n e) : ContDiff ℝ n fun x : ℝ => (e x).re := contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex #align cont_diff.real_of_complex ContDiff.real_of_complex variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] theorem HasStrictDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv'
Mathlib/Analysis/Complex/RealDeriv.lean
106
108
theorem HasDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasDerivAt f f' x) : HasFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by
simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ
0.65625
import Mathlib.Data.List.Defs import Mathlib.Data.Option.Basic import Mathlib.Data.Nat.Defs import Mathlib.Init.Data.List.Basic import Mathlib.Util.AssertExists -- Make sure we haven't imported `Data.Nat.Order.Basic` assert_not_exists OrderedSub namespace List universe u v variable {α : Type u} {β : Type v} (l : List α) (x : α) (xs : List α) (n : ℕ) section getD variable (d : α) #align list.nthd_nil List.getD_nilₓ -- argument order #align list.nthd_cons_zero List.getD_cons_zeroₓ -- argument order #align list.nthd_cons_succ List.getD_cons_succₓ -- argument order theorem getD_eq_get {n : ℕ} (hn : n < l.length) : l.getD n d = l.get ⟨n, hn⟩ := by induction l generalizing n with | nil => simp at hn | cons head tail ih => cases n · exact getD_cons_zero · exact ih _ @[simp]
Mathlib/Data/List/GetD.lean
47
53
theorem getD_map {n : ℕ} (f : α → β) : (map f l).getD n (f d) = f (l.getD n d) := by
induction l generalizing n with | nil => rfl | cons head tail ih => cases n · rfl · simp [ih]
0.65625
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.List.Rotate import Mathlib.GroupTheory.Perm.Support #align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace List variable {α β : Type*} section FormPerm variable [DecidableEq α] (l : List α) open Equiv Equiv.Perm def formPerm : Equiv.Perm α := (zipWith Equiv.swap l l.tail).prod #align list.form_perm List.formPerm @[simp] theorem formPerm_nil : formPerm ([] : List α) = 1 := rfl #align list.form_perm_nil List.formPerm_nil @[simp] theorem formPerm_singleton (x : α) : formPerm [x] = 1 := rfl #align list.form_perm_singleton List.formPerm_singleton @[simp] theorem formPerm_cons_cons (x y : α) (l : List α) : formPerm (x :: y :: l) = swap x y * formPerm (y :: l) := prod_cons #align list.form_perm_cons_cons List.formPerm_cons_cons theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y := rfl #align list.form_perm_pair List.formPerm_pair theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α}, (zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l' | [], _, _ => by simp | _, [], _ => by simp | a::l, b::l', x => fun hx ↦ if h : (zipWith swap l l').prod x = x then (eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp (by rintro rfl; exact .head _) (by rintro rfl; exact .head _) else (mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _) theorem zipWith_swap_prod_support' (l l' : List α) : { x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by simpa using mem_or_mem_of_zipWith_swap_prod_ne h #align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support' theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) : (zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by intro x hx have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx simpa using zipWith_swap_prod_support' _ _ hx' #align list.zip_with_swap_prod_support List.zipWith_swap_prod_support theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by refine (zipWith_swap_prod_support' l l.tail).trans ?_ simpa [Finset.subset_iff] using tail_subset l #align list.support_form_perm_le' List.support_formPerm_le'
Mathlib/GroupTheory/Perm/List.lean
100
103
theorem support_formPerm_le [Fintype α] : support (formPerm l) ≤ l.toFinset := by
intro x hx have hx' : x ∈ { x | formPerm l x ≠ x } := by simpa using hx simpa using support_formPerm_le' _ hx'
0.65625
import Mathlib.Topology.UniformSpace.Cauchy import Mathlib.Topology.UniformSpace.Separation import Mathlib.Topology.DenseEmbedding #align_import topology.uniform_space.uniform_embedding from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Filter Function Set Uniformity Topology section universe u v w variable {α : Type u} {β : Type v} {γ : Type w} [UniformSpace α] [UniformSpace β] [UniformSpace γ] @[mk_iff] structure UniformInducing (f : α → β) : Prop where comap_uniformity : comap (fun x : α × α => (f x.1, f x.2)) (𝓤 β) = 𝓤 α #align uniform_inducing UniformInducing #align uniform_inducing_iff uniformInducing_iff lemma uniformInducing_iff_uniformSpace {f : α → β} : UniformInducing f ↔ ‹UniformSpace β›.comap f = ‹UniformSpace α› := by rw [uniformInducing_iff, UniformSpace.ext_iff, Filter.ext_iff] rfl protected alias ⟨UniformInducing.comap_uniformSpace, _⟩ := uniformInducing_iff_uniformSpace #align uniform_inducing.comap_uniform_space UniformInducing.comap_uniformSpace lemma uniformInducing_iff' {f : α → β} : UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α := by rw [uniformInducing_iff, UniformContinuous, tendsto_iff_comap, le_antisymm_iff, and_comm]; rfl #align uniform_inducing_iff' uniformInducing_iff' protected lemma Filter.HasBasis.uniformInducing_iff {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'} (h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} : UniformInducing f ↔ (∀ i, p' i → ∃ j, p j ∧ ∀ x y, (x, y) ∈ s j → (f x, f y) ∈ s' i) ∧ (∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by simp [uniformInducing_iff', h.uniformContinuous_iff h', (h'.comap _).le_basis_iff h, subset_def] #align filter.has_basis.uniform_inducing_iff Filter.HasBasis.uniformInducing_iff theorem UniformInducing.mk' {f : α → β} (h : ∀ s, s ∈ 𝓤 α ↔ ∃ t ∈ 𝓤 β, ∀ x y : α, (f x, f y) ∈ t → (x, y) ∈ s) : UniformInducing f := ⟨by simp [eq_comm, Filter.ext_iff, subset_def, h]⟩ #align uniform_inducing.mk' UniformInducing.mk' theorem uniformInducing_id : UniformInducing (@id α) := ⟨by rw [← Prod.map_def, Prod.map_id, comap_id]⟩ #align uniform_inducing_id uniformInducing_id theorem UniformInducing.comp {g : β → γ} (hg : UniformInducing g) {f : α → β} (hf : UniformInducing f) : UniformInducing (g ∘ f) := ⟨by rw [← hf.1, ← hg.1, comap_comap]; rfl⟩ #align uniform_inducing.comp UniformInducing.comp theorem UniformInducing.of_comp_iff {g : β → γ} (hg : UniformInducing g) {f : α → β} : UniformInducing (g ∘ f) ↔ UniformInducing f := by refine ⟨fun h ↦ ?_, hg.comp⟩ rw [uniformInducing_iff, ← hg.comap_uniformity, comap_comap, ← h.comap_uniformity, Function.comp, Function.comp] theorem UniformInducing.basis_uniformity {f : α → β} (hf : UniformInducing f) {ι : Sort*} {p : ι → Prop} {s : ι → Set (β × β)} (H : (𝓤 β).HasBasis p s) : (𝓤 α).HasBasis p fun i => Prod.map f f ⁻¹' s i := hf.1 ▸ H.comap _ #align uniform_inducing.basis_uniformity UniformInducing.basis_uniformity theorem UniformInducing.cauchy_map_iff {f : α → β} (hf : UniformInducing f) {F : Filter α} : Cauchy (map f F) ↔ Cauchy F := by simp only [Cauchy, map_neBot_iff, prod_map_map_eq, map_le_iff_le_comap, ← hf.comap_uniformity] #align uniform_inducing.cauchy_map_iff UniformInducing.cauchy_map_iff theorem uniformInducing_of_compose {f : α → β} {g : β → γ} (hf : UniformContinuous f) (hg : UniformContinuous g) (hgf : UniformInducing (g ∘ f)) : UniformInducing f := by refine ⟨le_antisymm ?_ hf.le_comap⟩ rw [← hgf.1, ← Prod.map_def, ← Prod.map_def, ← Prod.map_comp_map f f g g, ← comap_comap] exact comap_mono hg.le_comap #align uniform_inducing_of_compose uniformInducing_of_compose theorem UniformInducing.uniformContinuous {f : α → β} (hf : UniformInducing f) : UniformContinuous f := (uniformInducing_iff'.1 hf).1 #align uniform_inducing.uniform_continuous UniformInducing.uniformContinuous theorem UniformInducing.uniformContinuous_iff {f : α → β} {g : β → γ} (hg : UniformInducing g) : UniformContinuous f ↔ UniformContinuous (g ∘ f) := by dsimp only [UniformContinuous, Tendsto] rw [← hg.comap_uniformity, ← map_le_iff_le_comap, Filter.map_map]; rfl #align uniform_inducing.uniform_continuous_iff UniformInducing.uniformContinuous_iff theorem UniformInducing.uniformContinuousOn_iff {f : α → β} {g : β → γ} {S : Set α} (hg : UniformInducing g) : UniformContinuousOn f S ↔ UniformContinuousOn (g ∘ f) S := by dsimp only [UniformContinuousOn, Tendsto] rw [← hg.comap_uniformity, ← map_le_iff_le_comap, Filter.map_map, comp_def, comp_def]
Mathlib/Topology/UniformSpace/UniformEmbedding.lean
116
118
theorem UniformInducing.inducing {f : α → β} (h : UniformInducing f) : Inducing f := by
obtain rfl := h.comap_uniformSpace exact inducing_induced f
0.65625
import Mathlib.Analysis.Calculus.ContDiff.Defs import Mathlib.Analysis.Calculus.FDeriv.Add import Mathlib.Analysis.Calculus.FDeriv.Mul import Mathlib.Analysis.Calculus.Deriv.Inverse #align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical NNReal Nat local notation "∞" => (⊤ : ℕ∞) universe u v w uD uE uF uG attribute [local instance 1001] NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid open Set Fin Filter Function open scoped Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {D : Type uD} [NormedAddCommGroup D] [NormedSpace 𝕜 D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type uF} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {X : Type*} [NormedAddCommGroup X] [NormedSpace 𝕜 X] {s s₁ t u : Set E} {f f₁ : E → F} {g : F → G} {x x₀ : E} {c : F} {b : E × F → G} {m n : ℕ∞} {p : E → FormalMultilinearSeries 𝕜 E F} @[simp] theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn 𝕜 s) (hx : x ∈ s) {i : ℕ} : iteratedFDerivWithin 𝕜 i (fun _ : E ↦ (0 : F)) s x = 0 := by induction i generalizing x with | zero => ext; simp | succ i IH => ext m rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ ↦ IH) (IH hx)] rw [fderivWithin_const_apply _ (hs x hx)] rfl @[simp] theorem iteratedFDeriv_zero_fun {n : ℕ} : (iteratedFDeriv 𝕜 n fun _ : E ↦ (0 : F)) = 0 := funext fun x ↦ by simpa [← iteratedFDerivWithin_univ] using iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x) #align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun theorem contDiff_zero_fun : ContDiff 𝕜 n fun _ : E => (0 : F) := contDiff_of_differentiable_iteratedFDeriv fun m _ => by rw [iteratedFDeriv_zero_fun] exact differentiable_const (0 : E[×m]→L[𝕜] F) #align cont_diff_zero_fun contDiff_zero_fun theorem contDiff_const {c : F} : ContDiff 𝕜 n fun _ : E => c := by suffices h : ContDiff 𝕜 ∞ fun _ : E => c from h.of_le le_top rw [contDiff_top_iff_fderiv] refine ⟨differentiable_const c, ?_⟩ rw [fderiv_const] exact contDiff_zero_fun #align cont_diff_const contDiff_const theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn 𝕜 n (fun _ : E => c) s := contDiff_const.contDiffOn #align cont_diff_on_const contDiffOn_const theorem contDiffAt_const {c : F} : ContDiffAt 𝕜 n (fun _ : E => c) x := contDiff_const.contDiffAt #align cont_diff_at_const contDiffAt_const theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt 𝕜 n (fun _ : E => c) s x := contDiffAt_const.contDiffWithinAt #align cont_diff_within_at_const contDiffWithinAt_const @[nontriviality] theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff 𝕜 n f := by rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const #align cont_diff_of_subsingleton contDiff_of_subsingleton @[nontriviality]
Mathlib/Analysis/Calculus/ContDiff/Basic.lean
112
113
theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt 𝕜 n f x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
0.65625
import Mathlib.Data.Set.Prod import Mathlib.Logic.Equiv.Fin import Mathlib.ModelTheory.LanguageMap #align_import model_theory.syntax from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" universe u v w u' v' namespace FirstOrder namespace Language variable (L : Language.{u, v}) {L' : Language} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} {γ : Type*} open FirstOrder open Structure Fin inductive Term (α : Type u') : Type max u u' | var : α → Term α | func : ∀ {l : ℕ} (_f : L.Functions l) (_ts : Fin l → Term α), Term α #align first_order.language.term FirstOrder.Language.Term export Term (var func) variable {L} scoped[FirstOrder] prefix:arg "&" => FirstOrder.Language.Term.var ∘ Sum.inr namespace LHom open Term -- Porting note: universes in different order @[simp] def onTerm (φ : L →ᴸ L') : L.Term α → L'.Term α | var i => var i | func f ts => func (φ.onFunction f) fun i => onTerm φ (ts i) set_option linter.uppercaseLean3 false in #align first_order.language.LHom.on_term FirstOrder.Language.LHom.onTerm @[simp]
Mathlib/ModelTheory/Syntax.lean
274
279
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
ext t induction' t with _ _ _ _ ih · rfl · simp_rw [onTerm, ih] rfl
0.65625
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 restrict def restrict (s : Set α) (f : ∀ a : α, π a) : ∀ a : s, π a := fun x => f x #align set.restrict Set.restrict theorem restrict_eq (f : α → β) (s : Set α) : s.restrict f = f ∘ Subtype.val := rfl #align set.restrict_eq Set.restrict_eq @[simp] theorem restrict_apply (f : α → β) (s : Set α) (x : s) : s.restrict f x = f x := rfl #align set.restrict_apply Set.restrict_apply theorem restrict_eq_iff {f : ∀ a, π a} {s : Set α} {g : ∀ a : s, π a} : restrict s f = g ↔ ∀ (a) (ha : a ∈ s), f a = g ⟨a, ha⟩ := funext_iff.trans Subtype.forall #align set.restrict_eq_iff Set.restrict_eq_iff theorem eq_restrict_iff {s : Set α} {f : ∀ a : s, π a} {g : ∀ a, π a} : f = restrict s g ↔ ∀ (a) (ha : a ∈ s), f ⟨a, ha⟩ = g a := funext_iff.trans Subtype.forall #align set.eq_restrict_iff Set.eq_restrict_iff @[simp] theorem range_restrict (f : α → β) (s : Set α) : Set.range (s.restrict f) = f '' s := (range_comp _ _).trans <| congr_arg (f '' ·) Subtype.range_coe #align set.range_restrict Set.range_restrict theorem image_restrict (f : α → β) (s t : Set α) : s.restrict f '' (Subtype.val ⁻¹' t) = f '' (t ∩ s) := by rw [restrict_eq, image_comp, image_preimage_eq_inter_range, Subtype.range_coe] #align set.image_restrict Set.image_restrict @[simp] theorem restrict_dite {s : Set α} [∀ x, Decidable (x ∈ s)] (f : ∀ a ∈ s, β) (g : ∀ a ∉ s, β) : (s.restrict fun a => if h : a ∈ s then f a h else g a h) = (fun a : s => f a a.2) := funext fun a => dif_pos a.2 #align set.restrict_dite Set.restrict_dite @[simp] theorem restrict_dite_compl {s : Set α} [∀ x, Decidable (x ∈ s)] (f : ∀ a ∈ s, β) (g : ∀ a ∉ s, β) : (sᶜ.restrict fun a => if h : a ∈ s then f a h else g a h) = (fun a : (sᶜ : Set α) => g a a.2) := funext fun a => dif_neg a.2 #align set.restrict_dite_compl Set.restrict_dite_compl @[simp] theorem restrict_ite (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] : (s.restrict fun a => if a ∈ s then f a else g a) = s.restrict f := restrict_dite _ _ #align set.restrict_ite Set.restrict_ite @[simp] theorem restrict_ite_compl (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] : (sᶜ.restrict fun a => if a ∈ s then f a else g a) = sᶜ.restrict g := restrict_dite_compl _ _ #align set.restrict_ite_compl Set.restrict_ite_compl @[simp] theorem restrict_piecewise (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] : s.restrict (piecewise s f g) = s.restrict f := restrict_ite _ _ _ #align set.restrict_piecewise Set.restrict_piecewise @[simp] theorem restrict_piecewise_compl (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] : sᶜ.restrict (piecewise s f g) = sᶜ.restrict g := restrict_ite_compl _ _ _ #align set.restrict_piecewise_compl Set.restrict_piecewise_compl theorem restrict_extend_range (f : α → β) (g : α → γ) (g' : β → γ) : (range f).restrict (extend f g g') = fun x => g x.coe_prop.choose := by classical exact restrict_dite _ _ #align set.restrict_extend_range Set.restrict_extend_range @[simp]
Mathlib/Data/Set/Function.lean
124
127
theorem restrict_extend_compl_range (f : α → β) (g : α → γ) (g' : β → γ) : (range f)ᶜ.restrict (extend f g g') = g' ∘ Subtype.val := by
classical exact restrict_dite_compl _ _
0.65625
import Mathlib.Data.List.Nodup #align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" variable {α : Type*} namespace List inductive Duplicate (x : α) : List α → Prop | cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l) | cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l) #align list.duplicate List.Duplicate local infixl:50 " ∈+ " => List.Duplicate variable {l : List α} {x : α} theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l := Duplicate.cons_mem h #align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l := Duplicate.cons_duplicate h #align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by induction' h with l' _ y l' _ hm · exact mem_cons_self _ _ · exact mem_cons_of_mem _ hm #align list.duplicate.mem List.Duplicate.mem theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by cases' h with _ h _ _ h · exact h · exact h.mem #align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self @[simp] theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l := ⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩ #align list.duplicate_cons_self_iff List.duplicate_cons_self_iff theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem) #align list.duplicate.ne_nil List.Duplicate.ne_nil @[simp] theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl #align list.not_duplicate_nil List.not_duplicate_nil theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by induction' h with l' h z l' h _ · simp [ne_nil_of_mem h] · simp [ne_nil_of_mem h.mem] #align list.duplicate.ne_singleton List.Duplicate.ne_singleton @[simp] theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl #align list.not_duplicate_singleton List.not_duplicate_singleton theorem Duplicate.elim_nil (h : x ∈+ []) : False := not_duplicate_nil x h #align list.duplicate.elim_nil List.Duplicate.elim_nil theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False := not_duplicate_singleton x y h #align list.duplicate.elim_singleton List.Duplicate.elim_singleton theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by refine ⟨fun h => ?_, fun h => ?_⟩ · cases' h with _ hm _ _ hm · exact Or.inl ⟨rfl, hm⟩ · exact Or.inr hm · rcases h with (⟨rfl | h⟩ | h) · simpa · exact h.cons_duplicate #align list.duplicate_cons_iff List.duplicate_cons_iff theorem Duplicate.of_duplicate_cons {y : α} (h : x ∈+ y :: l) (hx : x ≠ y) : x ∈+ l := by simpa [duplicate_cons_iff, hx.symm] using h #align list.duplicate.of_duplicate_cons List.Duplicate.of_duplicate_cons theorem duplicate_cons_iff_of_ne {y : α} (hne : x ≠ y) : x ∈+ y :: l ↔ x ∈+ l := by simp [duplicate_cons_iff, hne.symm] #align list.duplicate_cons_iff_of_ne List.duplicate_cons_iff_of_ne theorem Duplicate.mono_sublist {l' : List α} (hx : x ∈+ l) (h : l <+ l') : x ∈+ l' := by induction' h with l₁ l₂ y _ IH l₁ l₂ y h IH · exact hx · exact (IH hx).duplicate_cons _ · rw [duplicate_cons_iff] at hx ⊢ rcases hx with (⟨rfl, hx⟩ | hx) · simp [h.subset hx] · simp [IH hx] #align list.duplicate.mono_sublist List.Duplicate.mono_sublist theorem duplicate_iff_sublist : x ∈+ l ↔ [x, x] <+ l := by induction' l with y l IH · simp · by_cases hx : x = y · simp [hx, cons_sublist_cons, singleton_sublist] · rw [duplicate_cons_iff_of_ne hx, IH] refine ⟨sublist_cons_of_sublist y, fun h => ?_⟩ cases h · assumption · contradiction #align list.duplicate_iff_sublist List.duplicate_iff_sublist theorem nodup_iff_forall_not_duplicate : Nodup l ↔ ∀ x : α, ¬x ∈+ l := by simp_rw [nodup_iff_sublist, duplicate_iff_sublist] #align list.nodup_iff_forall_not_duplicate List.nodup_iff_forall_not_duplicate
Mathlib/Data/List/Duplicate.lean
133
134
theorem exists_duplicate_iff_not_nodup : (∃ x : α, x ∈+ l) ↔ ¬Nodup l := by
simp [nodup_iff_forall_not_duplicate]
0.65625
import Mathlib.Data.DFinsupp.Interval import Mathlib.Data.DFinsupp.Multiset import Mathlib.Order.Interval.Finset.Nat #align_import data.multiset.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" open Finset DFinsupp Function open Pointwise variable {α : Type*} namespace Multiset variable [DecidableEq α] (s t : Multiset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Multiset α) := LocallyFiniteOrder.ofIcc (Multiset α) (fun s t => (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding) fun s t x => by simp theorem Icc_eq : Finset.Icc s t = (Finset.Icc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := rfl #align multiset.Icc_eq Multiset.Icc_eq theorem uIcc_eq : uIcc s t = (uIcc (toDFinsupp s) (toDFinsupp t)).map Multiset.equivDFinsupp.toEquiv.symm.toEmbedding := (Icc_eq _ _).trans <| by simp [uIcc] #align multiset.uIcc_eq Multiset.uIcc_eq theorem card_Icc : (Finset.Icc s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) := by simp_rw [Icc_eq, Finset.card_map, DFinsupp.card_Icc, Nat.card_Icc, Multiset.toDFinsupp_apply, toDFinsupp_support] #align multiset.card_Icc Multiset.card_Icc
Mathlib/Data/Multiset/Interval.lean
62
64
theorem card_Ico : (Finset.Ico s t).card = ∏ i ∈ s.toFinset ∪ t.toFinset, (t.count i + 1 - s.count i) - 1 := by
rw [Finset.card_Ico_eq_card_Icc_sub_one, card_Icc]
0.65625
import Mathlib.Topology.MetricSpace.Isometry #align_import topology.metric_space.gluing from "leanprover-community/mathlib"@"e1a7bdeb4fd826b7e71d130d34988f0a2d26a177" noncomputable section universe u v w open Function Set Uniformity Topology namespace Metric namespace Sigma variable {ι : Type*} {E : ι → Type*} [∀ i, MetricSpace (E i)] open scoped Classical protected def dist : (Σ i, E i) → (Σ i, E i) → ℝ | ⟨i, x⟩, ⟨j, y⟩ => if h : i = j then haveI : E j = E i := by rw [h] Dist.dist x (cast this y) else Dist.dist x (Nonempty.some ⟨x⟩) + 1 + Dist.dist (Nonempty.some ⟨y⟩) y #align metric.sigma.dist Metric.Sigma.dist def instDist : Dist (Σi, E i) := ⟨Sigma.dist⟩ #align metric.sigma.has_dist Metric.Sigma.instDist attribute [local instance] Sigma.instDist @[simp] theorem dist_same (i : ι) (x y : E i) : dist (Sigma.mk i x) ⟨i, y⟩ = dist x y := by simp [Dist.dist, Sigma.dist] #align metric.sigma.dist_same Metric.Sigma.dist_same @[simp] theorem dist_ne {i j : ι} (h : i ≠ j) (x : E i) (y : E j) : dist (⟨i, x⟩ : Σk, E k) ⟨j, y⟩ = dist x (Nonempty.some ⟨x⟩) + 1 + dist (Nonempty.some ⟨y⟩) y := dif_neg h #align metric.sigma.dist_ne Metric.Sigma.dist_ne
Mathlib/Topology/MetricSpace/Gluing.lean
352
355
theorem one_le_dist_of_ne {i j : ι} (h : i ≠ j) (x : E i) (y : E j) : 1 ≤ dist (⟨i, x⟩ : Σk, E k) ⟨j, y⟩ := by
rw [Sigma.dist_ne h x y] linarith [@dist_nonneg _ _ x (Nonempty.some ⟨x⟩), @dist_nonneg _ _ (Nonempty.some ⟨y⟩) y]
0.65625
import Mathlib.Algebra.BigOperators.WithTop import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Data.ENNReal.Basic #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} section OperationsAndInfty variable {α : Type*} @[simp] theorem add_eq_top : a + b = ∞ ↔ a = ∞ ∨ b = ∞ := WithTop.add_eq_top #align ennreal.add_eq_top ENNReal.add_eq_top @[simp] theorem add_lt_top : a + b < ∞ ↔ a < ∞ ∧ b < ∞ := WithTop.add_lt_top #align ennreal.add_lt_top ENNReal.add_lt_top theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) : (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by lift r₁ to ℝ≥0 using h₁ lift r₂ to ℝ≥0 using h₂ rfl #align ennreal.to_nnreal_add ENNReal.toNNReal_add theorem not_lt_top {x : ℝ≥0∞} : ¬x < ∞ ↔ x = ∞ := by rw [lt_top_iff_ne_top, Classical.not_not] #align ennreal.not_lt_top ENNReal.not_lt_top theorem add_ne_top : a + b ≠ ∞ ↔ a ≠ ∞ ∧ b ≠ ∞ := by simpa only [lt_top_iff_ne_top] using add_lt_top #align ennreal.add_ne_top ENNReal.add_ne_top theorem mul_top' : a * ∞ = if a = 0 then 0 else ∞ := by convert WithTop.mul_top' a #align ennreal.mul_top ENNReal.mul_top' -- Porting note: added because `simp` no longer uses `WithTop` lemmas for `ℝ≥0∞` @[simp] theorem mul_top (h : a ≠ 0) : a * ∞ = ∞ := WithTop.mul_top h theorem top_mul' : ∞ * a = if a = 0 then 0 else ∞ := by convert WithTop.top_mul' a #align ennreal.top_mul ENNReal.top_mul' -- Porting note: added because `simp` no longer uses `WithTop` lemmas for `ℝ≥0∞` @[simp] theorem top_mul (h : a ≠ 0) : ∞ * a = ∞ := WithTop.top_mul h theorem top_mul_top : ∞ * ∞ = ∞ := WithTop.top_mul_top #align ennreal.top_mul_top ENNReal.top_mul_top -- Porting note (#11215): TODO: assume `n ≠ 0` instead of `0 < n` -- Porting note (#11215): TODO: generalize to `WithTop` theorem top_pow {n : ℕ} (h : 0 < n) : ∞ ^ n = ∞ := Nat.le_induction (pow_one _) (fun m _ hm => by rw [pow_succ, hm, top_mul_top]) _ (Nat.succ_le_of_lt h) #align ennreal.top_pow ENNReal.top_pow theorem mul_eq_top : a * b = ∞ ↔ a ≠ 0 ∧ b = ∞ ∨ a = ∞ ∧ b ≠ 0 := WithTop.mul_eq_top_iff #align ennreal.mul_eq_top ENNReal.mul_eq_top theorem mul_lt_top : a ≠ ∞ → b ≠ ∞ → a * b < ∞ := WithTop.mul_lt_top #align ennreal.mul_lt_top ENNReal.mul_lt_top
Mathlib/Data/ENNReal/Operations.lean
235
235
theorem mul_ne_top : a ≠ ∞ → b ≠ ∞ → a * b ≠ ∞ := by
simpa only [lt_top_iff_ne_top] using mul_lt_top
0.65625
import Mathlib.Algebra.Module.Submodule.Lattice import Mathlib.Order.Hom.CompleteLattice namespace Submodule variable (S : Type*) {R M : Type*} [Semiring R] [AddCommMonoid M] [Semiring S] [Module S M] [Module R M] [SMul S R] [IsScalarTower S R M] def restrictScalars (V : Submodule R M) : Submodule S M where carrier := V zero_mem' := V.zero_mem smul_mem' c _ h := V.smul_of_tower_mem c h add_mem' hx hy := V.add_mem hx hy #align submodule.restrict_scalars Submodule.restrictScalars @[simp] theorem coe_restrictScalars (V : Submodule R M) : (V.restrictScalars S : Set M) = V := rfl #align submodule.coe_restrict_scalars Submodule.coe_restrictScalars @[simp] theorem toAddSubmonoid_restrictScalars (V : Submodule R M) : (V.restrictScalars S).toAddSubmonoid = V.toAddSubmonoid := rfl @[simp] theorem restrictScalars_mem (V : Submodule R M) (m : M) : m ∈ V.restrictScalars S ↔ m ∈ V := Iff.refl _ #align submodule.restrict_scalars_mem Submodule.restrictScalars_mem @[simp] theorem restrictScalars_self (V : Submodule R M) : V.restrictScalars R = V := SetLike.coe_injective rfl #align submodule.restrict_scalars_self Submodule.restrictScalars_self variable (R M) theorem restrictScalars_injective : Function.Injective (restrictScalars S : Submodule R M → Submodule S M) := fun _ _ h => ext <| Set.ext_iff.1 (SetLike.ext'_iff.1 h : _) #align submodule.restrict_scalars_injective Submodule.restrictScalars_injective @[simp] theorem restrictScalars_inj {V₁ V₂ : Submodule R M} : restrictScalars S V₁ = restrictScalars S V₂ ↔ V₁ = V₂ := (restrictScalars_injective S _ _).eq_iff #align submodule.restrict_scalars_inj Submodule.restrictScalars_inj instance restrictScalars.origModule (p : Submodule R M) : Module R (p.restrictScalars S) := (by infer_instance : Module R p) #align submodule.restrict_scalars.orig_module Submodule.restrictScalars.origModule instance restrictScalars.isScalarTower (p : Submodule R M) : IsScalarTower S R (p.restrictScalars S) where smul_assoc r s x := Subtype.ext <| smul_assoc r s (x : M) #align submodule.restrict_scalars.is_scalar_tower Submodule.restrictScalars.isScalarTower @[simps] def restrictScalarsEmbedding : Submodule R M ↪o Submodule S M where toFun := restrictScalars S inj' := restrictScalars_injective S R M map_rel_iff' := by simp [SetLike.le_def] #align submodule.restrict_scalars_embedding Submodule.restrictScalarsEmbedding #align submodule.restrict_scalars_embedding_apply Submodule.restrictScalarsEmbedding_apply @[simps (config := { simpRhs := true })] def restrictScalarsEquiv (p : Submodule R M) : p.restrictScalars S ≃ₗ[R] p := { AddEquiv.refl p with map_smul' := fun _ _ => rfl } #align submodule.restrict_scalars_equiv Submodule.restrictScalarsEquiv #align submodule.restrict_scalars_equiv_symm_apply Submodule.restrictScalarsEquiv_symm_apply @[simp] theorem restrictScalars_bot : restrictScalars S (⊥ : Submodule R M) = ⊥ := rfl #align submodule.restrict_scalars_bot Submodule.restrictScalars_bot @[simp] theorem restrictScalars_eq_bot_iff {p : Submodule R M} : restrictScalars S p = ⊥ ↔ p = ⊥ := by simp [SetLike.ext_iff] #align submodule.restrict_scalars_eq_bot_iff Submodule.restrictScalars_eq_bot_iff @[simp] theorem restrictScalars_top : restrictScalars S (⊤ : Submodule R M) = ⊤ := rfl #align submodule.restrict_scalars_top Submodule.restrictScalars_top @[simp]
Mathlib/Algebra/Module/Submodule/RestrictScalars.lean
116
117
theorem restrictScalars_eq_top_iff {p : Submodule R M} : restrictScalars S p = ⊤ ↔ p = ⊤ := by
simp [SetLike.ext_iff]
0.65625
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 CoheytingAlgebra variable [CoheytingAlgebra α] (a : α) @[simp]
Mathlib/Order/SymmDiff.lean
343
343
theorem symmDiff_top' : a ∆ ⊤ = ¬a := by
simp [symmDiff]
0.625
import Mathlib.Data.Stream.Defs import Mathlib.Logic.Function.Basic import Mathlib.Init.Data.List.Basic import Mathlib.Data.List.Basic #align_import data.stream.init from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" set_option autoImplicit true open Nat Function Option namespace Stream' variable {α : Type u} {β : Type v} {δ : Type w} instance [Inhabited α] : Inhabited (Stream' α) := ⟨Stream'.const default⟩ protected theorem eta (s : Stream' α) : (head s::tail s) = s := funext fun i => by cases i <;> rfl #align stream.eta Stream'.eta @[ext] protected theorem ext {s₁ s₂ : Stream' α} : (∀ n, get s₁ n = get s₂ n) → s₁ = s₂ := fun h => funext h #align stream.ext Stream'.ext @[simp] theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a := rfl #align stream.nth_zero_cons Stream'.get_zero_cons @[simp] theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a := rfl #align stream.head_cons Stream'.head_cons @[simp] theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s := rfl #align stream.tail_cons Stream'.tail_cons @[simp] theorem get_drop (n m : Nat) (s : Stream' α) : get (drop m s) n = get s (n + m) := rfl #align stream.nth_drop Stream'.get_drop theorem tail_eq_drop (s : Stream' α) : tail s = drop 1 s := rfl #align stream.tail_eq_drop Stream'.tail_eq_drop @[simp]
Mathlib/Data/Stream/Init.lean
65
66
theorem drop_drop (n m : Nat) (s : Stream' α) : drop n (drop m s) = drop (n + m) s := by
ext; simp [Nat.add_assoc]
0.625
import Mathlib.LinearAlgebra.CliffordAlgebra.Fold import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic #align_import linear_algebra.exterior_algebra.of_alternating from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a" variable {R M N N' : Type*} variable [CommRing R] [AddCommGroup M] [AddCommGroup N] [AddCommGroup N'] variable [Module R M] [Module R N] [Module R N'] -- This instance can't be found where it's needed if we don't remind lean that it exists. instance AlternatingMap.instModuleAddCommGroup {ι : Type*} : Module R (M [⋀^ι]→ₗ[R] N) := by infer_instance #align alternating_map.module_add_comm_group AlternatingMap.instModuleAddCommGroup namespace ExteriorAlgebra open CliffordAlgebra hiding ι def liftAlternating : (∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N := by suffices (∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] ∀ i, M [⋀^Fin i]→ₗ[R] N by refine LinearMap.compr₂ this ?_ refine (LinearEquiv.toLinearMap ?_).comp (LinearMap.proj 0) exact AlternatingMap.constLinearEquivOfIsEmpty.symm refine CliffordAlgebra.foldl _ ?_ ?_ · refine LinearMap.mk₂ R (fun m f i => (f i.succ).curryLeft m) (fun m₁ m₂ f => ?_) (fun c m f => ?_) (fun m f₁ f₂ => ?_) fun c m f => ?_ all_goals ext i : 1 simp only [map_smul, map_add, Pi.add_apply, Pi.smul_apply, AlternatingMap.curryLeft_add, AlternatingMap.curryLeft_smul, map_add, map_smul, LinearMap.add_apply, LinearMap.smul_apply] · -- when applied twice with the same `m`, this recursive step produces 0 intro m x dsimp only [LinearMap.mk₂_apply, QuadraticForm.coeFn_zero, Pi.zero_apply] simp_rw [zero_smul] ext i : 1 exact AlternatingMap.curryLeft_same _ _ #align exterior_algebra.lift_alternating ExteriorAlgebra.liftAlternating @[simp] theorem liftAlternating_ι (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M) : liftAlternating (R := R) (M := M) (N := N) f (ι R m) = f 1 ![m] := by dsimp [liftAlternating] rw [foldl_ι, LinearMap.mk₂_apply, AlternatingMap.curryLeft_apply_apply] congr -- Porting note: In Lean 3, `congr` could use the `[Subsingleton (Fin 0 → M)]` instance to finish -- the proof. Here, the instance can be synthesized but `congr` does not use it so the following -- line is provided. rw [Matrix.zero_empty] #align exterior_algebra.lift_alternating_ι ExteriorAlgebra.liftAlternating_ι theorem liftAlternating_ι_mul (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M) (x : ExteriorAlgebra R M) : liftAlternating (R := R) (M := M) (N := N) f (ι R m * x) = liftAlternating (R := R) (M := M) (N := N) (fun i => (f i.succ).curryLeft m) x := by dsimp [liftAlternating] rw [foldl_mul, foldl_ι] rfl #align exterior_algebra.lift_alternating_ι_mul ExteriorAlgebra.liftAlternating_ι_mul @[simp] theorem liftAlternating_one (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) : liftAlternating (R := R) (M := M) (N := N) f (1 : ExteriorAlgebra R M) = f 0 0 := by dsimp [liftAlternating] rw [foldl_one] #align exterior_algebra.lift_alternating_one ExteriorAlgebra.liftAlternating_one @[simp]
Mathlib/LinearAlgebra/ExteriorAlgebra/OfAlternating.lean
96
99
theorem liftAlternating_algebraMap (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (r : R) : liftAlternating (R := R) (M := M) (N := N) f (algebraMap _ (ExteriorAlgebra R M) r) = r • f 0 0 := by
rw [Algebra.algebraMap_eq_smul_one, map_smul, liftAlternating_one]
0.625
import Mathlib.Data.Set.Pairwise.Basic import Mathlib.Data.Set.Lattice import Mathlib.Data.SetLike.Basic #align_import order.chain from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" open scoped Classical open Set variable {α β : Type*} section Chain variable (r : α → α → Prop) local infixl:50 " ≺ " => r def IsChain (s : Set α) : Prop := s.Pairwise fun x y => x ≺ y ∨ y ≺ x #align is_chain IsChain def SuperChain (s t : Set α) : Prop := IsChain r t ∧ s ⊂ t #align super_chain SuperChain def IsMaxChain (s : Set α) : Prop := IsChain r s ∧ ∀ ⦃t⦄, IsChain r t → s ⊆ t → s = t #align is_max_chain IsMaxChain variable {r} {c c₁ c₂ c₃ s t : Set α} {a b x y : α} theorem isChain_empty : IsChain r ∅ := Set.pairwise_empty _ #align is_chain_empty isChain_empty theorem Set.Subsingleton.isChain (hs : s.Subsingleton) : IsChain r s := hs.pairwise _ #align set.subsingleton.is_chain Set.Subsingleton.isChain theorem IsChain.mono : s ⊆ t → IsChain r t → IsChain r s := Set.Pairwise.mono #align is_chain.mono IsChain.mono theorem IsChain.mono_rel {r' : α → α → Prop} (h : IsChain r s) (h_imp : ∀ x y, r x y → r' x y) : IsChain r' s := h.mono' fun x y => Or.imp (h_imp x y) (h_imp y x) #align is_chain.mono_rel IsChain.mono_rel theorem IsChain.symm (h : IsChain r s) : IsChain (flip r) s := h.mono' fun _ _ => Or.symm #align is_chain.symm IsChain.symm theorem isChain_of_trichotomous [IsTrichotomous α r] (s : Set α) : IsChain r s := fun a _ b _ hab => (trichotomous_of r a b).imp_right fun h => h.resolve_left hab #align is_chain_of_trichotomous isChain_of_trichotomous protected theorem IsChain.insert (hs : IsChain r s) (ha : ∀ b ∈ s, a ≠ b → a ≺ b ∨ b ≺ a) : IsChain r (insert a s) := hs.insert_of_symmetric (fun _ _ => Or.symm) ha #align is_chain.insert IsChain.insert theorem isChain_univ_iff : IsChain r (univ : Set α) ↔ IsTrichotomous α r := by refine ⟨fun h => ⟨fun a b => ?_⟩, fun h => @isChain_of_trichotomous _ _ h univ⟩ rw [or_left_comm, or_iff_not_imp_left] exact h trivial trivial #align is_chain_univ_iff isChain_univ_iff theorem IsChain.image (r : α → α → Prop) (s : β → β → Prop) (f : α → β) (h : ∀ x y, r x y → s (f x) (f y)) {c : Set α} (hrc : IsChain r c) : IsChain s (f '' c) := fun _ ⟨_, ha₁, ha₂⟩ _ ⟨_, hb₁, hb₂⟩ => ha₂ ▸ hb₂ ▸ fun hxy => (hrc ha₁ hb₁ <| ne_of_apply_ne f hxy).imp (h _ _) (h _ _) #align is_chain.image IsChain.image
Mathlib/Order/Chain.lean
107
110
theorem Monotone.isChain_range [LinearOrder α] [Preorder β] {f : α → β} (hf : Monotone f) : IsChain (· ≤ ·) (range f) := by
rw [← image_univ] exact (isChain_of_trichotomous _).image (· ≤ ·) _ _ hf
0.625
import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Algebra.Order.Ring.Nat import Mathlib.Tactic.NthRewrite #align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" namespace Nat theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) : d = a.gcd b := (dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm #align nat.gcd_greatest Nat.gcd_greatest @[simp] theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by simp [gcd_rec m (n + k * m), gcd_rec m n] #align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right @[simp] theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by simp [gcd_rec m (n + m * k), gcd_rec m n] #align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right @[simp] theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right @[simp] theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n] #align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right @[simp] theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by rw [gcd_comm, gcd_add_mul_right_right, gcd_comm] #align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left @[simp] theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by rw [gcd_comm, gcd_add_mul_left_right, gcd_comm] #align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left @[simp] theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by rw [gcd_comm, gcd_mul_right_add_right, gcd_comm] #align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left @[simp]
Mathlib/Data/Nat/GCD/Basic.lean
68
69
theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
0.625
import Mathlib.Algebra.Group.Defs import Mathlib.Algebra.GroupWithZero.Defs import Mathlib.Data.Int.Cast.Defs import Mathlib.Tactic.Spread import Mathlib.Util.AssertExists #align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function class Distrib (R : Type*) extends Mul R, Add R where protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c #align distrib Distrib class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c #align left_distrib_class LeftDistribClass class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c #align right_distrib_class RightDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R := ⟨Distrib.left_distrib⟩ #align distrib.left_distrib_class Distrib.leftDistribClass -- see Note [lower instance priority] instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] : RightDistribClass R := ⟨Distrib.right_distrib⟩ #align distrib.right_distrib_class Distrib.rightDistribClass theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) : a * (b + c) = a * b + a * c := LeftDistribClass.left_distrib a b c #align left_distrib left_distrib alias mul_add := left_distrib #align mul_add mul_add theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) : (a + b) * c = a * c + b * c := RightDistribClass.right_distrib a b c #align right_distrib right_distrib alias add_mul := right_distrib #align add_mul add_mul theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) : (a + b + c) * d = a * d + b * d + c * d := by simp [right_distrib] #align distrib_three_right distrib_three_right class NonUnitalNonAssocSemiring (α : Type u) extends AddCommMonoid α, Distrib α, MulZeroClass α #align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring class NonUnitalSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, SemigroupWithZero α #align non_unital_semiring NonUnitalSemiring class NonAssocSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, MulZeroOneClass α, AddCommMonoidWithOne α #align non_assoc_semiring NonAssocSemiring class NonUnitalNonAssocRing (α : Type u) extends AddCommGroup α, NonUnitalNonAssocSemiring α #align non_unital_non_assoc_ring NonUnitalNonAssocRing class NonUnitalRing (α : Type*) extends NonUnitalNonAssocRing α, NonUnitalSemiring α #align non_unital_ring NonUnitalRing class NonAssocRing (α : Type*) extends NonUnitalNonAssocRing α, NonAssocSemiring α, AddCommGroupWithOne α #align non_assoc_ring NonAssocRing class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, MonoidWithZero α #align semiring Semiring class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R #align ring Ring section DistribMulOneClass variable [Add α] [MulOneClass α]
Mathlib/Algebra/Ring/Defs.lean
156
157
theorem add_one_mul [RightDistribClass α] (a b : α) : (a + 1) * b = a * b + b := by
rw [add_mul, one_mul]
0.625
import Mathlib.Analysis.SpecialFunctions.Complex.Log #align_import analysis.special_functions.pow.complex from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" open scoped Classical open Real Topology Filter ComplexConjugate Finset Set namespace Complex noncomputable def cpow (x y : ℂ) : ℂ := if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) #align complex.cpow Complex.cpow noncomputable instance : Pow ℂ ℂ := ⟨cpow⟩ @[simp] theorem cpow_eq_pow (x y : ℂ) : cpow x y = x ^ y := rfl #align complex.cpow_eq_pow Complex.cpow_eq_pow theorem cpow_def (x y : ℂ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := rfl #align complex.cpow_def Complex.cpow_def theorem cpow_def_of_ne_zero {x : ℂ} (hx : x ≠ 0) (y : ℂ) : x ^ y = exp (log x * y) := if_neg hx #align complex.cpow_def_of_ne_zero Complex.cpow_def_of_ne_zero @[simp] theorem cpow_zero (x : ℂ) : x ^ (0 : ℂ) = 1 := by simp [cpow_def] #align complex.cpow_zero Complex.cpow_zero @[simp] theorem cpow_eq_zero_iff (x y : ℂ) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by simp only [cpow_def] split_ifs <;> simp [*, exp_ne_zero] #align complex.cpow_eq_zero_iff Complex.cpow_eq_zero_iff @[simp] theorem zero_cpow {x : ℂ} (h : x ≠ 0) : (0 : ℂ) ^ x = 0 := by simp [cpow_def, *] #align complex.zero_cpow Complex.zero_cpow
Mathlib/Analysis/SpecialFunctions/Pow/Complex.lean
58
72
theorem zero_cpow_eq_iff {x : ℂ} {a : ℂ} : (0 : ℂ) ^ x = a ↔ x ≠ 0 ∧ a = 0 ∨ x = 0 ∧ a = 1 := by
constructor · intro hyp simp only [cpow_def, eq_self_iff_true, if_true] at hyp by_cases h : x = 0 · subst h simp only [if_true, eq_self_iff_true] at hyp right exact ⟨rfl, hyp.symm⟩ · rw [if_neg h] at hyp left exact ⟨h, hyp.symm⟩ · rintro (⟨h, rfl⟩ | ⟨rfl, rfl⟩) · exact zero_cpow h · exact cpow_zero _
0.625
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Data.ENat.Basic #align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836" noncomputable section open Function Polynomial Finsupp Finset open scoped Polynomial namespace Polynomial universe u v variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} def trailingDegree (p : R[X]) : ℕ∞ := p.support.min #align polynomial.trailing_degree Polynomial.trailingDegree theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q := InvImage.wf trailingDegree wellFounded_lt #align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf def natTrailingDegree (p : R[X]) : ℕ := (trailingDegree p).getD 0 #align polynomial.nat_trailing_degree Polynomial.natTrailingDegree def trailingCoeff (p : R[X]) : R := coeff p (natTrailingDegree p) #align polynomial.trailing_coeff Polynomial.trailingCoeff def TrailingMonic (p : R[X]) := trailingCoeff p = (1 : R) #align polynomial.trailing_monic Polynomial.TrailingMonic theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 := Iff.rfl #align polynomial.trailing_monic.def Polynomial.TrailingMonic.def instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) := inferInstanceAs <| Decidable (trailingCoeff p = (1 : R)) #align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable @[simp] theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 := hp #align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff @[simp] theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ := rfl #align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero @[simp] theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 := rfl #align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero @[simp] theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 := rfl #align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 := ⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩ #align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) : trailingDegree p = (natTrailingDegree p : ℕ∞) := by let ⟨n, hn⟩ := not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp)) have hn : trailingDegree p = n := Classical.not_not.1 hn rw [natTrailingDegree, hn] rfl #align polynomial.trailing_degree_eq_nat_trailing_degree Polynomial.trailingDegree_eq_natTrailingDegree theorem trailingDegree_eq_iff_natTrailingDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) : p.trailingDegree = n ↔ p.natTrailingDegree = n := by rw [trailingDegree_eq_natTrailingDegree hp] exact WithTop.coe_eq_coe #align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq theorem trailingDegree_eq_iff_natTrailingDegree_eq_of_pos {p : R[X]} {n : ℕ} (hn : 0 < n) : p.trailingDegree = n ↔ p.natTrailingDegree = n := by constructor · intro H rwa [← trailingDegree_eq_iff_natTrailingDegree_eq] rintro rfl rw [trailingDegree_zero] at H exact Option.noConfusion H · intro H rwa [trailingDegree_eq_iff_natTrailingDegree_eq] rintro rfl rw [natTrailingDegree_zero] at H rw [H] at hn exact lt_irrefl _ hn #align polynomial.trailing_degree_eq_iff_nat_trailing_degree_eq_of_pos Polynomial.trailingDegree_eq_iff_natTrailingDegree_eq_of_pos theorem natTrailingDegree_eq_of_trailingDegree_eq_some {p : R[X]} {n : ℕ} (h : trailingDegree p = n) : natTrailingDegree p = n := have hp0 : p ≠ 0 := fun hp0 => by rw [hp0] at h; exact Option.noConfusion h Option.some_inj.1 <| show (natTrailingDegree p : ℕ∞) = n by rwa [← trailingDegree_eq_natTrailingDegree hp0] #align polynomial.nat_trailing_degree_eq_of_trailing_degree_eq_some Polynomial.natTrailingDegree_eq_of_trailingDegree_eq_some @[simp]
Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean
141
145
theorem natTrailingDegree_le_trailingDegree : ↑(natTrailingDegree p) ≤ trailingDegree p := by
by_cases hp : p = 0; · rw [hp, trailingDegree_zero] exact le_top rw [trailingDegree_eq_natTrailingDegree hp]
0.625
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] theorem lipschitzOn_univ [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {f : α → β} : LipschitzOnWith K f univ ↔ LipschitzWith K f := by simp [LipschitzOnWith, LipschitzWith] #align lipschitz_on_univ lipschitzOn_univ
Mathlib/Topology/EMetricSpace/Lipschitz.lean
86
88
theorem lipschitzOnWith_iff_restrict [PseudoEMetricSpace α] [PseudoEMetricSpace β] {K : ℝ≥0} {f : α → β} {s : Set α} : LipschitzOnWith K f s ↔ LipschitzWith K (s.restrict f) := by
simp only [LipschitzOnWith, LipschitzWith, SetCoe.forall', restrict, Subtype.edist_eq]
0.625
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] theorem log_neg_eq_log (x : ℝ) : log (-x) = log x := by rw [← log_abs x, ← log_abs (-x), abs_neg] #align real.log_neg_eq_log Real.log_neg_eq_log theorem sinh_log {x : ℝ} (hx : 0 < x) : sinh (log x) = (x - x⁻¹) / 2 := by rw [sinh_eq, exp_neg, exp_log hx] #align real.sinh_log Real.sinh_log
Mathlib/Analysis/SpecialFunctions/Log/Basic.lean
118
119
theorem cosh_log {x : ℝ} (hx : 0 < x) : cosh (log x) = (x + x⁻¹) / 2 := by
rw [cosh_eq, exp_neg, exp_log hx]
0.625
import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.Calculus.Deriv.Comp #align_import analysis.calculus.deriv.pow from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set 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 𝕜} variable {c : 𝕜 → 𝕜} {c' : 𝕜} variable (n : ℕ) theorem hasStrictDerivAt_pow : ∀ (n : ℕ) (x : 𝕜), HasStrictDerivAt (fun x : 𝕜 ↦ x ^ n) ((n : 𝕜) * x ^ (n - 1)) x | 0, x => by simp [hasStrictDerivAt_const] | 1, x => by simpa using hasStrictDerivAt_id x | n + 1 + 1, x => by simpa [pow_succ, add_mul, mul_assoc] using (hasStrictDerivAt_pow (n + 1) x).mul (hasStrictDerivAt_id x) #align has_strict_deriv_at_pow hasStrictDerivAt_pow theorem hasDerivAt_pow (n : ℕ) (x : 𝕜) : HasDerivAt (fun x : 𝕜 => x ^ n) ((n : 𝕜) * x ^ (n - 1)) x := (hasStrictDerivAt_pow n x).hasDerivAt #align has_deriv_at_pow hasDerivAt_pow theorem hasDerivWithinAt_pow (n : ℕ) (x : 𝕜) (s : Set 𝕜) : HasDerivWithinAt (fun x : 𝕜 => x ^ n) ((n : 𝕜) * x ^ (n - 1)) s x := (hasDerivAt_pow n x).hasDerivWithinAt #align has_deriv_within_at_pow hasDerivWithinAt_pow theorem differentiableAt_pow : DifferentiableAt 𝕜 (fun x : 𝕜 => x ^ n) x := (hasDerivAt_pow n x).differentiableAt #align differentiable_at_pow differentiableAt_pow theorem differentiableWithinAt_pow : DifferentiableWithinAt 𝕜 (fun x : 𝕜 => x ^ n) s x := (differentiableAt_pow n).differentiableWithinAt #align differentiable_within_at_pow differentiableWithinAt_pow theorem differentiable_pow : Differentiable 𝕜 fun x : 𝕜 => x ^ n := fun _ => differentiableAt_pow n #align differentiable_pow differentiable_pow theorem differentiableOn_pow : DifferentiableOn 𝕜 (fun x : 𝕜 => x ^ n) s := (differentiable_pow n).differentiableOn #align differentiable_on_pow differentiableOn_pow theorem deriv_pow : deriv (fun x : 𝕜 => x ^ n) x = (n : 𝕜) * x ^ (n - 1) := (hasDerivAt_pow n x).deriv #align deriv_pow deriv_pow @[simp] theorem deriv_pow' : (deriv fun x : 𝕜 => x ^ n) = fun x => (n : 𝕜) * x ^ (n - 1) := funext fun _ => deriv_pow n #align deriv_pow' deriv_pow' theorem derivWithin_pow (hxs : UniqueDiffWithinAt 𝕜 s x) : derivWithin (fun x : 𝕜 => x ^ n) s x = (n : 𝕜) * x ^ (n - 1) := (hasDerivWithinAt_pow n x s).derivWithin hxs #align deriv_within_pow derivWithin_pow theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) : HasDerivWithinAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') s x := (hasDerivAt_pow n (c x)).comp_hasDerivWithinAt x hc #align has_deriv_within_at.pow HasDerivWithinAt.pow
Mathlib/Analysis/Calculus/Deriv/Pow.lean
99
102
theorem HasDerivAt.pow (hc : HasDerivAt c c' x) : HasDerivAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') x := by
rw [← hasDerivWithinAt_univ] at * exact hc.pow n
0.625
import Mathlib.RepresentationTheory.FdRep import Mathlib.LinearAlgebra.Trace import Mathlib.RepresentationTheory.Invariants #align_import representation_theory.character from "leanprover-community/mathlib"@"55b3f8206b8596db8bb1804d8a92814a0b6670c9" noncomputable section universe u open CategoryTheory LinearMap CategoryTheory.MonoidalCategory Representation FiniteDimensional variable {k : Type u} [Field k] namespace FdRep set_option linter.uppercaseLean3 false -- `FdRep` section Monoid variable {G : Type u} [Monoid G] def character (V : FdRep k G) (g : G) := LinearMap.trace k V (V.ρ g) #align fdRep.character FdRep.character theorem char_mul_comm (V : FdRep k G) (g : G) (h : G) : V.character (h * g) = V.character (g * h) := by simp only [trace_mul_comm, character, map_mul] #align fdRep.char_mul_comm FdRep.char_mul_comm @[simp] theorem char_one (V : FdRep k G) : V.character 1 = FiniteDimensional.finrank k V := by simp only [character, map_one, trace_one] #align fdRep.char_one FdRep.char_one theorem char_tensor (V W : FdRep k G) : (V ⊗ W).character = V.character * W.character := by ext g; convert trace_tensorProduct' (V.ρ g) (W.ρ g) #align fdRep.char_tensor FdRep.char_tensor -- Porting note: adding variant of `char_tensor` to make the simp-set confluent @[simp]
Mathlib/RepresentationTheory/Character.lean
70
74
theorem char_tensor' (V W : FdRep k G) : character (Action.FunctorCategoryEquivalence.inverse.obj (Action.FunctorCategoryEquivalence.functor.obj V ⊗ Action.FunctorCategoryEquivalence.functor.obj W)) = V.character * W.character := by
simp [← char_tensor]
0.625
import Mathlib.Geometry.RingedSpace.PresheafedSpace import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.Topology.Sheaves.Limits import Mathlib.CategoryTheory.ConcreteCategory.Elementwise #align_import algebraic_geometry.presheafed_space.has_colimits from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" noncomputable section universe v' u' v u open CategoryTheory Opposite CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits TopCat TopCat.Presheaf TopologicalSpace variable {J : Type u'} [Category.{v'} J] {C : Type u} [Category.{v} C] namespace AlgebraicGeometry namespace PresheafedSpace attribute [local simp] eqToHom_map -- Porting note: we used to have: -- local attribute [tidy] tactic.auto_cases_opens -- We would replace this by: -- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens -- although it doesn't appear to help in this file, in any case. @[simp] theorem map_id_c_app (F : J ⥤ PresheafedSpace.{_, _, v} C) (j) (U) : (F.map (𝟙 j)).c.app (op U) = (Pushforward.id (F.obj j).presheaf).inv.app (op U) ≫ (pushforwardEq (by simp) (F.obj j).presheaf).hom.app (op U) := by cases U simp [PresheafedSpace.congr_app (F.map_id j)] set_option linter.uppercaseLean3 false in #align algebraic_geometry.PresheafedSpace.map_id_c_app AlgebraicGeometry.PresheafedSpace.map_id_c_app @[simp]
Mathlib/Geometry/RingedSpace/PresheafedSpace/HasColimits.lean
70
79
theorem map_comp_c_app (F : J ⥤ PresheafedSpace.{_, _, v} C) {j₁ j₂ j₃} (f : j₁ ⟶ j₂) (g : j₂ ⟶ j₃) (U) : (F.map (f ≫ g)).c.app (op U) = (F.map g).c.app (op U) ≫ (pushforwardMap (F.map g).base (F.map f).c).app (op U) ≫ (Pushforward.comp (F.obj j₁).presheaf (F.map f).base (F.map g).base).inv.app (op U) ≫ (pushforwardEq (by rw [F.map_comp]; rfl) _).hom.app _ := by
cases U simp [PresheafedSpace.congr_app (F.map_comp f g)]
0.625
import Mathlib.Data.Finset.Prod import Mathlib.Data.Sym.Basic import Mathlib.Data.Sym.Sym2.Init import Mathlib.Data.SetLike.Basic #align_import data.sym.sym2 from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" assert_not_exists MonoidWithZero open Finset Function Sym universe u variable {α β γ : Type*} namespace Sym2 @[aesop (rule_sets := [Sym2]) [safe [constructors, cases], norm]] inductive Rel (α : Type u) : α × α → α × α → Prop | refl (x y : α) : Rel _ (x, y) (x, y) | swap (x y : α) : Rel _ (x, y) (y, x) #align sym2.rel Sym2.Rel #align sym2.rel.refl Sym2.Rel.refl #align sym2.rel.swap Sym2.Rel.swap attribute [refl] Rel.refl @[symm] theorem Rel.symm {x y : α × α} : Rel α x y → Rel α y x := by aesop (rule_sets := [Sym2]) #align sym2.rel.symm Sym2.Rel.symm @[trans] theorem Rel.trans {x y z : α × α} (a : Rel α x y) (b : Rel α y z) : Rel α x z := by aesop (rule_sets := [Sym2]) #align sym2.rel.trans Sym2.Rel.trans theorem Rel.is_equivalence : Equivalence (Rel α) := { refl := fun (x, y) ↦ Rel.refl x y, symm := Rel.symm, trans := Rel.trans } #align sym2.rel.is_equivalence Sym2.Rel.is_equivalence def Rel.setoid (α : Type u) : Setoid (α × α) := ⟨Rel α, Rel.is_equivalence⟩ #align sym2.rel.setoid Sym2.Rel.setoid @[simp] theorem rel_iff' {p q : α × α} : Rel α p q ↔ p = q ∨ p = q.swap := by aesop (rule_sets := [Sym2])
Mathlib/Data/Sym/Sym2.lean
91
92
theorem rel_iff {x y z w : α} : Rel α (x, y) (z, w) ↔ x = z ∧ y = w ∨ x = w ∧ y = z := by
simp
0.625
import Mathlib.MeasureTheory.Measure.Dirac set_option autoImplicit true open Set open scoped ENNReal Classical variable [MeasurableSpace α] [MeasurableSpace β] {s : Set α} noncomputable section namespace MeasureTheory.Measure def count : Measure α := sum dirac #align measure_theory.measure.count MeasureTheory.Measure.count theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s := calc (∑' _ : s, 1 : ℝ≥0∞) = ∑' i, indicator s 1 i := tsum_subtype s 1 _ ≤ ∑' i, dirac i s := ENNReal.tsum_le_tsum fun _ => le_dirac_apply _ ≤ count s := le_sum_apply _ _ #align measure_theory.measure.le_count_apply MeasureTheory.Measure.le_count_apply theorem count_apply (hs : MeasurableSet s) : count s = ∑' i : s, 1 := by simp only [count, sum_apply, hs, dirac_apply', ← tsum_subtype s (1 : α → ℝ≥0∞), Pi.one_apply] #align measure_theory.measure.count_apply MeasureTheory.Measure.count_apply -- @[simp] -- Porting note (#10618): simp can prove this theorem count_empty : count (∅ : Set α) = 0 := by rw [count_apply MeasurableSet.empty, tsum_empty] #align measure_theory.measure.count_empty MeasureTheory.Measure.count_empty @[simp] theorem count_apply_finset' {s : Finset α} (s_mble : MeasurableSet (s : Set α)) : count (↑s : Set α) = s.card := calc count (↑s : Set α) = ∑' i : (↑s : Set α), 1 := count_apply s_mble _ = ∑ i ∈ s, 1 := s.tsum_subtype 1 _ = s.card := by simp #align measure_theory.measure.count_apply_finset' MeasureTheory.Measure.count_apply_finset' @[simp] theorem count_apply_finset [MeasurableSingletonClass α] (s : Finset α) : count (↑s : Set α) = s.card := count_apply_finset' s.measurableSet #align measure_theory.measure.count_apply_finset MeasureTheory.Measure.count_apply_finset theorem count_apply_finite' {s : Set α} (s_fin : s.Finite) (s_mble : MeasurableSet s) : count s = s_fin.toFinset.card := by simp [← @count_apply_finset' _ _ s_fin.toFinset (by simpa only [Finite.coe_toFinset] using s_mble)] #align measure_theory.measure.count_apply_finite' MeasureTheory.Measure.count_apply_finite' theorem count_apply_finite [MeasurableSingletonClass α] (s : Set α) (hs : s.Finite) : count s = hs.toFinset.card := by rw [← count_apply_finset, Finite.coe_toFinset] #align measure_theory.measure.count_apply_finite MeasureTheory.Measure.count_apply_finite theorem count_apply_infinite (hs : s.Infinite) : count s = ∞ := by refine top_unique (le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n => ?_) rcases hs.exists_subset_card_eq n with ⟨t, ht, rfl⟩ calc (t.card : ℝ≥0∞) = ∑ i ∈ t, 1 := by simp _ = ∑' i : (t : Set α), 1 := (t.tsum_subtype 1).symm _ ≤ count (t : Set α) := le_count_apply _ ≤ count s := measure_mono ht #align measure_theory.measure.count_apply_infinite MeasureTheory.Measure.count_apply_infinite @[simp]
Mathlib/MeasureTheory/Measure/Count.lean
84
88
theorem count_apply_eq_top' (s_mble : MeasurableSet s) : count s = ∞ ↔ s.Infinite := by
by_cases hs : s.Finite · simp [Set.Infinite, hs, count_apply_finite' hs s_mble] · change s.Infinite at hs simp [hs, count_apply_infinite]
0.625
import Mathlib.Algebra.Category.MonCat.Basic import Mathlib.CategoryTheory.Limits.HasLimits import Mathlib.CategoryTheory.ConcreteCategory.Elementwise #align_import algebra.category.Mon.colimits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v open CategoryTheory open CategoryTheory.Limits namespace MonCat.Colimits variable {J : Type v} [SmallCategory J] (F : J ⥤ MonCat.{v}) inductive Prequotient -- There's always `of` | of : ∀ (j : J) (_ : F.obj j), Prequotient -- Then one generator for each operation | one : Prequotient | mul : Prequotient → Prequotient → Prequotient set_option linter.uppercaseLean3 false in #align Mon.colimits.prequotient MonCat.Colimits.Prequotient instance : Inhabited (Prequotient F) := ⟨Prequotient.one⟩ open Prequotient inductive Relation : Prequotient F → Prequotient F → Prop-- Make it an equivalence relation: | refl : ∀ x, Relation x x | symm : ∀ (x y) (_ : Relation x y), Relation y x | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z-- There's always a `map` relation | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' ((F.map f) x)) (Prequotient.of j x)-- Then one relation per operation, describing the interaction with `of` | mul : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x * y)) (mul (Prequotient.of j x) (Prequotient.of j y)) | one : ∀ j, Relation (Prequotient.of j 1) one-- Then one relation per argument of each operation | mul_1 : ∀ (x x' y) (_ : Relation x x'), Relation (mul x y) (mul x' y) | mul_2 : ∀ (x y y') (_ : Relation y y'), Relation (mul x y) (mul x y') -- And one relation per axiom | mul_assoc : ∀ x y z, Relation (mul (mul x y) z) (mul x (mul y z)) | one_mul : ∀ x, Relation (mul one x) x | mul_one : ∀ x, Relation (mul x one) x set_option linter.uppercaseLean3 false in #align Mon.colimits.relation MonCat.Colimits.Relation def colimitSetoid : Setoid (Prequotient F) where r := Relation F iseqv := ⟨Relation.refl, Relation.symm _ _, Relation.trans _ _ _⟩ set_option linter.uppercaseLean3 false in #align Mon.colimits.colimit_setoid MonCat.Colimits.colimitSetoid attribute [instance] colimitSetoid def ColimitType : Type v := Quotient (colimitSetoid F) set_option linter.uppercaseLean3 false in #align Mon.colimits.colimit_type MonCat.Colimits.ColimitType instance : Inhabited (ColimitType F) := by dsimp [ColimitType] infer_instance instance monoidColimitType : Monoid (ColimitType F) where one := Quotient.mk _ one mul := Quotient.map₂ mul fun x x' rx y y' ry => Setoid.trans (Relation.mul_1 _ _ y rx) (Relation.mul_2 x' _ _ ry) one_mul := Quotient.ind fun _ => Quotient.sound <| Relation.one_mul _ mul_one := Quotient.ind fun _ => Quotient.sound <| Relation.mul_one _ mul_assoc := Quotient.ind fun _ => Quotient.ind₂ fun _ _ => Quotient.sound <| Relation.mul_assoc _ _ _ set_option linter.uppercaseLean3 false in #align Mon.colimits.monoid_colimit_type MonCat.Colimits.monoidColimitType @[simp] theorem quot_one : Quot.mk Setoid.r one = (1 : ColimitType F) := rfl set_option linter.uppercaseLean3 false in #align Mon.colimits.quot_one MonCat.Colimits.quot_one @[simp] theorem quot_mul (x y : Prequotient F) : Quot.mk Setoid.r (mul x y) = @HMul.hMul (ColimitType F) (ColimitType F) (ColimitType F) _ (Quot.mk Setoid.r x) (Quot.mk Setoid.r y) := rfl set_option linter.uppercaseLean3 false in #align Mon.colimits.quot_mul MonCat.Colimits.quot_mul def colimit : MonCat := ⟨ColimitType F, by infer_instance⟩ set_option linter.uppercaseLean3 false in #align Mon.colimits.colimit MonCat.Colimits.colimit def coconeFun (j : J) (x : F.obj j) : ColimitType F := Quot.mk _ (Prequotient.of j x) set_option linter.uppercaseLean3 false in #align Mon.colimits.cocone_fun MonCat.Colimits.coconeFun def coconeMorphism (j : J) : F.obj j ⟶ colimit F where toFun := coconeFun F j map_one' := Quot.sound (Relation.one _) map_mul' _ _ := Quot.sound (Relation.mul _ _ _) set_option linter.uppercaseLean3 false in #align Mon.colimits.cocone_morphism MonCat.Colimits.coconeMorphism @[simp] theorem cocone_naturality {j j' : J} (f : j ⟶ j') : F.map f ≫ coconeMorphism F j' = coconeMorphism F j := by ext apply Quot.sound apply Relation.map set_option linter.uppercaseLean3 false in #align Mon.colimits.cocone_naturality MonCat.Colimits.cocone_naturality @[simp]
Mathlib/Algebra/Category/MonCat/Colimits.lean
188
191
theorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) : (coconeMorphism F j') (F.map f x) = (coconeMorphism F j) x := by
rw [← cocone_naturality F f] rfl
0.625
import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Instances.Real def preCantorSet : ℕ → Set ℝ | 0 => Set.Icc 0 1 | n + 1 => (· / 3) '' preCantorSet n ∪ (fun x ↦ (2 + x) / 3) '' preCantorSet n @[simp] lemma preCantorSet_zero : preCantorSet 0 = Set.Icc 0 1 := rfl @[simp] lemma preCantorSet_succ (n : ℕ) : preCantorSet (n + 1) = (· / 3) '' preCantorSet n ∪ (fun x ↦ (2 + x) / 3) '' preCantorSet n := rfl def cantorSet : Set ℝ := ⋂ n, preCantorSet n lemma quarters_mem_preCantorSet (n : ℕ) : 1/4 ∈ preCantorSet n ∧ 3/4 ∈ preCantorSet n := by induction n with | zero => simp only [preCantorSet_zero, inv_nonneg] refine ⟨⟨ ?_, ?_⟩, ?_, ?_⟩ <;> norm_num | succ n ih => apply And.intro · -- goal: 1 / 4 ∈ preCantorSet (n + 1) -- follows by the inductive hyphothesis, since 3 / 4 ∈ preCantorSet n exact Or.inl ⟨3 / 4, ih.2, by norm_num⟩ · -- goal: 3 / 4 ∈ preCantorSet (n + 1) -- follows by the inductive hyphothesis, since 1 / 4 ∈ preCantorSet n exact Or.inr ⟨1 / 4, ih.1, by norm_num⟩ lemma quarter_mem_preCantorSet (n : ℕ) : 1/4 ∈ preCantorSet n := (quarters_mem_preCantorSet n).1 theorem quarter_mem_cantorSet : 1/4 ∈ cantorSet := Set.mem_iInter.mpr quarter_mem_preCantorSet lemma zero_mem_preCantorSet (n : ℕ) : 0 ∈ preCantorSet n := by induction n with | zero => simp [preCantorSet] | succ n ih => exact Or.inl ⟨0, ih, by simp only [zero_div]⟩
Mathlib/Topology/Instances/CantorSet.lean
75
75
theorem zero_mem_cantorSet : 0 ∈ cantorSet := by
simp [cantorSet, zero_mem_preCantorSet]
0.625
import Mathlib.Topology.GDelta #align_import topology.metric_space.baire from "leanprover-community/mathlib"@"b9e46fe101fc897fb2e7edaf0bf1f09ea49eb81a" noncomputable section open scoped Topology open Filter Set TopologicalSpace variable {X α : Type*} {ι : Sort*} section BaireTheorem variable [TopologicalSpace X] [BaireSpace X] theorem dense_iInter_of_isOpen_nat {f : ℕ → Set X} (ho : ∀ n, IsOpen (f n)) (hd : ∀ n, Dense (f n)) : Dense (⋂ n, f n) := BaireSpace.baire_property f ho hd #align dense_Inter_of_open_nat dense_iInter_of_isOpen_nat theorem dense_sInter_of_isOpen {S : Set (Set X)} (ho : ∀ s ∈ S, IsOpen s) (hS : S.Countable) (hd : ∀ s ∈ S, Dense s) : Dense (⋂₀ S) := by rcases S.eq_empty_or_nonempty with h | h · simp [h] · rcases hS.exists_eq_range h with ⟨f, rfl⟩ exact dense_iInter_of_isOpen_nat (forall_mem_range.1 ho) (forall_mem_range.1 hd) #align dense_sInter_of_open dense_sInter_of_isOpen
Mathlib/Topology/Baire/Lemmas.lean
60
63
theorem dense_biInter_of_isOpen {S : Set α} {f : α → Set X} (ho : ∀ s ∈ S, IsOpen (f s)) (hS : S.Countable) (hd : ∀ s ∈ S, Dense (f s)) : Dense (⋂ s ∈ S, f s) := by
rw [← sInter_image] refine dense_sInter_of_isOpen ?_ (hS.image _) ?_ <;> rwa [forall_mem_image]
0.625
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] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq
Mathlib/RingTheory/RootsOfUnity/Basic.lean
119
122
theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by
obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow]
0.625
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α} {s t : Set α} namespace MeasureTheory section NormedAddCommGroup variable (μ) variable {f g : α → E} noncomputable def average (f : α → E) := ∫ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.average MeasureTheory.average notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r @[simp] theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero] #align measure_theory.average_zero MeasureTheory.average_zero @[simp] theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by rw [average, smul_zero, integral_zero_measure] #align measure_theory.average_zero_measure MeasureTheory.average_zero_measure @[simp] theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ := integral_neg f #align measure_theory.average_neg MeasureTheory.average_neg theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ := rfl #align measure_theory.average_eq' MeasureTheory.average_eq'
Mathlib/MeasureTheory/Integral/Average.lean
332
333
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
0.625