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 Mathlib.Order.Interval.Multiset #align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" -- TODO -- assert_not_exists Ring open Finset Nat variable (a b c : ℕ) namespace Nat instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ where finsetIcc a b := ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ finsetIco a b := ⟨List.range' a (b - a), List.nodup_range' _ _⟩ finsetIoc a b := ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ finsetIoo a b := ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega theorem Icc_eq_range' : Icc a b = ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ := rfl #align nat.Icc_eq_range' Nat.Icc_eq_range' theorem Ico_eq_range' : Ico a b = ⟨List.range' a (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ico_eq_range' Nat.Ico_eq_range' theorem Ioc_eq_range' : Ioc a b = ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ioc_eq_range' Nat.Ioc_eq_range' theorem Ioo_eq_range' : Ioo a b = ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ := rfl #align nat.Ioo_eq_range' Nat.Ioo_eq_range' theorem uIcc_eq_range' : uIcc a b = ⟨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _⟩ := rfl #align nat.uIcc_eq_range' Nat.uIcc_eq_range' theorem Iio_eq_range : Iio = range := by ext b x rw [mem_Iio, mem_range] #align nat.Iio_eq_range Nat.Iio_eq_range @[simp] theorem Ico_zero_eq_range : Ico 0 = range := by rw [← Nat.bot_eq_zero, ← Iio_eq_Ico, Iio_eq_range] #align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range lemma range_eq_Icc_zero_sub_one (n : ℕ) (hn : n ≠ 0): range n = Icc 0 (n - 1) := by ext b simp_all only [mem_Icc, zero_le, true_and, mem_range] exact lt_iff_le_pred (zero_lt_of_ne_zero hn) theorem _root_.Finset.range_eq_Ico : range = Ico 0 := Ico_zero_eq_range.symm #align finset.range_eq_Ico Finset.range_eq_Ico @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := List.length_range' _ _ _ #align nat.card_Icc Nat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ico Nat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ioc Nat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := List.length_range' _ _ _ #align nat.card_Ioo Nat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := (card_Icc _ _).trans $ by rw [← Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega #align nat.card_uIcc Nat.card_uIcc @[simp] lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iic Nat.card_Iic @[simp] theorem card_Iio : (Iio b).card = b := by rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iio Nat.card_Iio -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [Fintype.card_ofFinset, card_Icc] #align nat.card_fintype_Icc Nat.card_fintypeIcc -- Porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Nat.lean
120
121
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [Fintype.card_ofFinset, card_Ico]
0.84375
import Mathlib.Combinatorics.Quiver.Basic import Mathlib.Combinatorics.Quiver.Path #align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" universe v v₁ v₂ u u₁ u₂ variable {U : Type*} [Quiver.{u + 1} U] namespace Quiver def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : u' ⟶ v' := Eq.ndrec (motive := (· ⟶ v')) (Eq.ndrec e hv) hu #align quiver.hom.cast Quiver.Hom.cast theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by subst_vars rfl #align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast @[simp] theorem Hom.cast_rfl_rfl {u v : U} (e : u ⟶ v) : e.cast rfl rfl = e := rfl #align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl @[simp]
Mathlib/Combinatorics/Quiver/Cast.lean
50
54
theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u ⟶ v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by
subst_vars rfl
0.84375
import Mathlib.Algebra.CharZero.Defs import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Monoid.OrderDual import Mathlib.Algebra.Order.ZeroLEOne import Mathlib.Data.Nat.Cast.Defs import Mathlib.Order.WithBot #align_import algebra.order.monoid.with_top from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907" universe u v variable {α : Type u} {β : Type v} open Function namespace WithTop section Add variable [Add α] {a b c d : WithTop α} {x y : α} instance add : Add (WithTop α) := ⟨Option.map₂ (· + ·)⟩ #align with_top.has_add WithTop.add @[simp, norm_cast] lemma coe_add (a b : α) : ↑(a + b) = (a + b : WithTop α) := rfl #align with_top.coe_add WithTop.coe_add #noalign with_top.coe_bit0 #noalign with_top.coe_bit1 @[simp] theorem top_add (a : WithTop α) : ⊤ + a = ⊤ := rfl #align with_top.top_add WithTop.top_add @[simp] theorem add_top (a : WithTop α) : a + ⊤ = ⊤ := by cases a <;> rfl #align with_top.add_top WithTop.add_top @[simp]
Mathlib/Algebra/Order/Monoid/WithTop.lean
132
136
theorem add_eq_top : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
match a, b with | ⊤, _ => simp | _, ⊤ => simp | (a : α), (b : α) => simp only [← coe_add, coe_ne_top, or_false]
0.84375
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by simp_rw [logb, log_mul hx hy, add_div] #align real.logb_mul Real.logb_mul theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by simp_rw [logb, log_div hx hy, sub_div] #align real.logb_div Real.logb_div @[simp] theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div] #align real.logb_inv Real.logb_inv
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
84
84
theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by
simp_rw [logb, inv_div]
0.84375
import Mathlib.Algebra.Algebra.Subalgebra.Operations import Mathlib.Algebra.Ring.Fin import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.ideal.quotient_operations from "leanprover-community/mathlib"@"b88d81c84530450a8989e918608e5960f015e6c8" universe u v w namespace Ideal open Function RingHom variable {R : Type u} {S : Type v} {F : Type w} [CommRing R] [Semiring S] @[simp] theorem map_quotient_self (I : Ideal R) : map (Quotient.mk I) I = ⊥ := eq_bot_iff.2 <| Ideal.map_le_iff_le_comap.2 fun _ hx => (Submodule.mem_bot (R ⧸ I)).2 <| Ideal.Quotient.eq_zero_iff_mem.2 hx #align ideal.map_quotient_self Ideal.map_quotient_self @[simp]
Mathlib/RingTheory/Ideal/QuotientOperations.lean
131
133
theorem mk_ker {I : Ideal R} : ker (Quotient.mk I) = I := by
ext rw [ker, mem_comap, Submodule.mem_bot, Quotient.eq_zero_iff_mem]
0.84375
import Mathlib.Algebra.Quotient import Mathlib.Algebra.Group.Subgroup.Actions import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.SetTheory.Cardinal.Finite #align_import group_theory.coset from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open Function MulOpposite Set open scoped Pointwise variable {α : Type*} #align left_coset HSMul.hSMul #align left_add_coset HVAdd.hVAdd #noalign right_coset #noalign right_add_coset section CosetSemigroup variable [Semigroup α] @[to_additive leftAddCoset_assoc] theorem leftCoset_assoc (s : Set α) (a b : α) : a • (b • s) = (a * b) • s := by simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc] #align left_coset_assoc leftCoset_assoc #align left_add_coset_assoc leftAddCoset_assoc @[to_additive rightAddCoset_assoc] theorem rightCoset_assoc (s : Set α) (a b : α) : op b • op a • s = op (a * b) • s := by simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc] #align right_coset_assoc rightCoset_assoc #align right_add_coset_assoc rightAddCoset_assoc @[to_additive leftAddCoset_rightAddCoset]
Mathlib/GroupTheory/Coset.lean
117
118
theorem leftCoset_rightCoset (s : Set α) (a b : α) : op b • a • s = a • (op b • s) := by
simp [← image_smul, (image_comp _ _ _).symm, Function.comp, mul_assoc]
0.84375
import Mathlib.Data.Matrix.Basic import Mathlib.Data.Matrix.RowCol import Mathlib.Data.Fin.VecNotation import Mathlib.Tactic.FinCases #align_import data.matrix.notation from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a" namespace Matrix universe u uₘ uₙ uₒ variable {α : Type u} {o n m : ℕ} {m' : Type uₘ} {n' : Type uₙ} {o' : Type uₒ} open Matrix variable (a b : ℕ) instance repr [Repr α] : Repr (Matrix (Fin m) (Fin n) α) where reprPrec f _p := (Std.Format.bracket "!![" · "]") <| (Std.Format.joinSep · (";" ++ Std.Format.line)) <| (List.finRange m).map fun i => Std.Format.fill <| -- wrap line in a single place rather than all at once (Std.Format.joinSep · ("," ++ Std.Format.line)) <| (List.finRange n).map fun j => _root_.repr (f i j) #align matrix.has_repr Matrix.repr @[simp]
Mathlib/Data/Matrix/Notation.lean
138
139
theorem cons_val' (v : n' → α) (B : Fin m → n' → α) (i j) : vecCons v B i j = vecCons (v j) (fun i => B i j) i := by
refine Fin.cases ?_ ?_ i <;> simp
0.84375
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section iInf variable {ι : Sort*} {f g : ι → ℝ≥0∞} variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by cases isEmpty_or_nonempty ι · rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty] · lift f to ι → ℝ≥0 using hf simp_rw [← coe_iInf, toNNReal_coe] #align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) : (sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf) #align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by lift f to ι → ℝ≥0 using hf simp_rw [toNNReal_coe] by_cases h : BddAbove (range f) · rw [← coe_iSup h, toNNReal_coe] · rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal] #align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup theorem toNNReal_sSup (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) : (sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs -- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used -- in a different order. simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf) #align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup theorem toReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toReal = ⨅ i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf] #align ennreal.to_real_infi ENNReal.toReal_iInf theorem toReal_sInf (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) : (sInf s).toReal = sInf (ENNReal.toReal '' s) := by simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image] #align ennreal.to_real_Inf ENNReal.toReal_sInf theorem toReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toReal = ⨆ i, (f i).toReal := by simp only [ENNReal.toReal, toNNReal_iSup hf, NNReal.coe_iSup] #align ennreal.to_real_supr ENNReal.toReal_iSup
Mathlib/Data/ENNReal/Real.lean
585
587
theorem toReal_sSup (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) : (sSup s).toReal = sSup (ENNReal.toReal '' s) := by
simp only [ENNReal.toReal, toNNReal_sSup s hf, NNReal.coe_sSup, Set.image_image]
0.84375
import Mathlib.Data.Multiset.Basic #align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" open List Nat namespace Multiset -- range def range (n : ℕ) : Multiset ℕ := List.range n #align multiset.range Multiset.range theorem coe_range (n : ℕ) : ↑(List.range n) = range n := rfl #align multiset.coe_range Multiset.coe_range @[simp] theorem range_zero : range 0 = 0 := rfl #align multiset.range_zero Multiset.range_zero @[simp]
Mathlib/Data/Multiset/Range.lean
34
35
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
0.84375
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp] theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop] #align list.rdrop_nil List.rdrop_nil @[simp]
Mathlib/Data/List/DropRight.lean
51
51
theorem rdrop_zero : rdrop l 0 = l := by
simp [rdrop]
0.84375
import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.Normed.Group.InfiniteSum import Mathlib.Topology.Algebra.InfiniteSum.Real #align_import analysis.normed.field.infinite_sum from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" variable {R : Type*} {ι : Type*} {ι' : Type*} [NormedRing R] open scoped Classical open Finset theorem Summable.mul_of_nonneg {f : ι → ℝ} {g : ι' → ℝ} (hf : Summable f) (hg : Summable g) (hf' : 0 ≤ f) (hg' : 0 ≤ g) : Summable fun x : ι × ι' => f x.1 * g x.2 := (summable_prod_of_nonneg fun _ ↦ mul_nonneg (hf' _) (hg' _)).2 ⟨fun x ↦ hg.mul_left (f x), by simpa only [hg.tsum_mul_left _] using hf.mul_right (∑' x, g x)⟩ #align summable.mul_of_nonneg Summable.mul_of_nonneg theorem Summable.mul_norm {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun x : ι × ι' => ‖f x.1 * g x.2‖ := .of_nonneg_of_le (fun _ ↦ norm_nonneg _) (fun x => norm_mul_le (f x.1) (g x.2)) (hf.mul_of_nonneg hg (fun x => norm_nonneg <| f x) fun x => norm_nonneg <| g x : _) #align summable.mul_norm Summable.mul_norm theorem summable_mul_of_summable_norm [CompleteSpace R] {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun x : ι × ι' => f x.1 * g x.2 := (hf.mul_norm hg).of_norm #align summable_mul_of_summable_norm summable_mul_of_summable_norm theorem tsum_mul_tsum_of_summable_norm [CompleteSpace R] {f : ι → R} {g : ι' → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' x, f x) * ∑' y, g y) = ∑' z : ι × ι', f z.1 * g z.2 := tsum_mul_tsum hf.of_norm hg.of_norm (summable_mul_of_summable_norm hf hg) #align tsum_mul_tsum_of_summable_norm tsum_mul_tsum_of_summable_norm section Nat open Finset.Nat theorem summable_norm_sum_mul_antidiagonal_of_summable_norm {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun n => ‖∑ kl ∈ antidiagonal n, f kl.1 * g kl.2‖ := by have := summable_sum_mul_antidiagonal_of_summable_mul (Summable.mul_of_nonneg hf hg (fun _ => norm_nonneg _) fun _ => norm_nonneg _) refine this.of_nonneg_of_le (fun _ => norm_nonneg _) (fun n ↦ ?_) calc ‖∑ kl ∈ antidiagonal n, f kl.1 * g kl.2‖ ≤ ∑ kl ∈ antidiagonal n, ‖f kl.1 * g kl.2‖ := norm_sum_le _ _ _ ≤ ∑ kl ∈ antidiagonal n, ‖f kl.1‖ * ‖g kl.2‖ := by gcongr; apply norm_mul_le #align summable_norm_sum_mul_antidiagonal_of_summable_norm summable_norm_sum_mul_antidiagonal_of_summable_norm theorem tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm [CompleteSpace R] {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ kl ∈ antidiagonal n, f kl.1 * g kl.2 := tsum_mul_tsum_eq_tsum_sum_antidiagonal hf.of_norm hg.of_norm (summable_mul_of_summable_norm hf hg) #align tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm theorem summable_norm_sum_mul_range_of_summable_norm {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : Summable fun n => ‖∑ k ∈ range (n + 1), f k * g (n - k)‖ := by simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l] exact summable_norm_sum_mul_antidiagonal_of_summable_norm hf hg #align summable_norm_sum_mul_range_of_summable_norm summable_norm_sum_mul_range_of_summable_norm
Mathlib/Analysis/Normed/Field/InfiniteSum.lean
106
110
theorem tsum_mul_tsum_eq_tsum_sum_range_of_summable_norm [CompleteSpace R] {f g : ℕ → R} (hf : Summable fun x => ‖f x‖) (hg : Summable fun x => ‖g x‖) : ((∑' n, f n) * ∑' n, g n) = ∑' n, ∑ k ∈ range (n + 1), f k * g (n - k) := by
simp_rw [← sum_antidiagonal_eq_sum_range_succ fun k l => f k * g l] exact tsum_mul_tsum_eq_tsum_sum_antidiagonal_of_summable_norm hf hg
0.84375
import Mathlib.Topology.Order.MonotoneContinuity import Mathlib.Topology.Algebra.Order.LiminfLimsup import Mathlib.Topology.Instances.NNReal import Mathlib.Topology.EMetricSpace.Lipschitz import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.Order.T5 #align_import topology.instances.ennreal from "leanprover-community/mathlib"@"ec4b2eeb50364487f80421c0b4c41328a611f30d" noncomputable section open Set Filter Metric Function open scoped Classical Topology ENNReal NNReal Filter variable {α : Type*} {β : Type*} {γ : Type*} namespace ENNReal variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} {x y z : ℝ≥0∞} {ε ε₁ ε₂ : ℝ≥0∞} {s : Set ℝ≥0∞} section TopologicalSpace open TopologicalSpace instance : TopologicalSpace ℝ≥0∞ := Preorder.topology ℝ≥0∞ instance : OrderTopology ℝ≥0∞ := ⟨rfl⟩ -- short-circuit type class inference instance : T2Space ℝ≥0∞ := inferInstance instance : T5Space ℝ≥0∞ := inferInstance instance : T4Space ℝ≥0∞ := inferInstance instance : SecondCountableTopology ℝ≥0∞ := orderIsoUnitIntervalBirational.toHomeomorph.embedding.secondCountableTopology instance : MetrizableSpace ENNReal := orderIsoUnitIntervalBirational.toHomeomorph.embedding.metrizableSpace theorem embedding_coe : Embedding ((↑) : ℝ≥0 → ℝ≥0∞) := coe_strictMono.embedding_of_ordConnected <| by rw [range_coe']; exact ordConnected_Iio #align ennreal.embedding_coe ENNReal.embedding_coe theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ } := isOpen_ne #align ennreal.is_open_ne_top ENNReal.isOpen_ne_top
Mathlib/Topology/Instances/ENNReal.lean
60
62
theorem isOpen_Ico_zero : IsOpen (Ico 0 b) := by
rw [ENNReal.Ico_eq_Iio] exact isOpen_Iio
0.84375
import Mathlib.Data.Multiset.Dedup #align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" namespace Multiset open List variable {α : Type*} [DecidableEq α] {s : Multiset α} def ndinsert (a : α) (s : Multiset α) : Multiset α := Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a) #align multiset.ndinsert Multiset.ndinsert @[simp] theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) := rfl #align multiset.coe_ndinsert Multiset.coe_ndinsert @[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} := rfl #align multiset.ndinsert_zero Multiset.ndinsert_zero @[simp] theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h #align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem @[simp] theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s := Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h #align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem @[simp] theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s := Quot.inductionOn s fun _ => mem_insert_iff #align multiset.mem_ndinsert Multiset.mem_ndinsert @[simp] theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s := Quot.inductionOn s fun _ => (sublist_insert _ _).subperm #align multiset.le_ndinsert_self Multiset.le_ndinsert_self -- Porting note: removing @[simp], simp can prove it theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s := mem_ndinsert.2 (Or.inl rfl) #align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s := mem_ndinsert.2 (Or.inr h) #align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem @[simp] theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) : card (ndinsert a s) = card s := by simp [h] #align multiset.length_ndinsert_of_mem Multiset.length_ndinsert_of_mem @[simp] theorem length_ndinsert_of_not_mem {a : α} {s : Multiset α} (h : a ∉ s) : card (ndinsert a s) = card s + 1 := by simp [h] #align multiset.length_ndinsert_of_not_mem Multiset.length_ndinsert_of_not_mem theorem dedup_cons {a : α} {s : Multiset α} : dedup (a ::ₘ s) = ndinsert a (dedup s) := by by_cases h : a ∈ s <;> simp [h] #align multiset.dedup_cons Multiset.dedup_cons theorem Nodup.ndinsert (a : α) : Nodup s → Nodup (ndinsert a s) := Quot.inductionOn s fun _ => Nodup.insert #align multiset.nodup.ndinsert Multiset.Nodup.ndinsert theorem ndinsert_le {a : α} {s t : Multiset α} : ndinsert a s ≤ t ↔ s ≤ t ∧ a ∈ t := ⟨fun h => ⟨le_trans (le_ndinsert_self _ _) h, mem_of_le h (mem_ndinsert_self _ _)⟩, fun ⟨l, m⟩ => if h : a ∈ s then by simp [h, l] else by rw [ndinsert_of_not_mem h, ← cons_erase m, cons_le_cons_iff, ← le_cons_of_not_mem h, cons_erase m]; exact l⟩ #align multiset.ndinsert_le Multiset.ndinsert_le theorem attach_ndinsert (a : α) (s : Multiset α) : (s.ndinsert a).attach = ndinsert ⟨a, mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, mem_ndinsert_of_mem p.2⟩) := have eq : ∀ h : ∀ p : { x // x ∈ s }, p.1 ∈ s, (fun p : { x // x ∈ s } => ⟨p.val, h p⟩ : { x // x ∈ s } → { x // x ∈ s }) = id := fun h => funext fun p => Subtype.eq rfl have : ∀ (t) (eq : s.ndinsert a = t), t.attach = ndinsert ⟨a, eq ▸ mem_ndinsert_self a s⟩ (s.attach.map fun p => ⟨p.1, eq ▸ mem_ndinsert_of_mem p.2⟩) := by intro t ht by_cases h : a ∈ s · rw [ndinsert_of_mem h] at ht subst ht rw [eq, map_id, ndinsert_of_mem (mem_attach _ _)] · rw [ndinsert_of_not_mem h] at ht subst ht simp [attach_cons, h] this _ rfl #align multiset.attach_ndinsert Multiset.attach_ndinsert @[simp] theorem disjoint_ndinsert_left {a : α} {s t : Multiset α} : Disjoint (ndinsert a s) t ↔ a ∉ t ∧ Disjoint s t := Iff.trans (by simp [Disjoint]) disjoint_cons_left #align multiset.disjoint_ndinsert_left Multiset.disjoint_ndinsert_left @[simp]
Mathlib/Data/Multiset/FinsetOps.lean
127
129
theorem disjoint_ndinsert_right {a : α} {s t : Multiset α} : Disjoint s (ndinsert a t) ↔ a ∉ s ∧ Disjoint s t := by
rw [disjoint_comm, disjoint_ndinsert_left]; tauto
0.84375
import Mathlib.Algebra.Group.Support import Mathlib.Algebra.Order.Monoid.WithTop import Mathlib.Data.Nat.Cast.Field #align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829" open Function Set section AddMonoidWithOne variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ} instance CharZero.NeZero.two : NeZero (2 : M) := ⟨by have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide) rwa [Nat.cast_two] at this⟩ #align char_zero.ne_zero.two CharZero.NeZero.two section variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R} @[simp] theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff] #align add_self_eq_zero add_self_eq_zero set_option linter.deprecated false @[simp] theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 := add_self_eq_zero #align bit0_eq_zero bit0_eq_zero @[simp]
Mathlib/Algebra/CharZero/Lemmas.lean
100
102
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm] exact bit0_eq_zero
0.84375
import Mathlib.SetTheory.Cardinal.Ordinal #align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925" namespace Cardinal universe u v open Cardinal def continuum : Cardinal.{u} := 2 ^ ℵ₀ #align cardinal.continuum Cardinal.continuum scoped notation "𝔠" => Cardinal.continuum @[simp] theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} := rfl #align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0 @[simp] theorem lift_continuum : lift.{v} 𝔠 = 𝔠 := by rw [← two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0] #align cardinal.lift_continuum Cardinal.lift_continuum @[simp] theorem continuum_le_lift {c : Cardinal.{u}} : 𝔠 ≤ lift.{v} c ↔ 𝔠 ≤ c := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_le] #align cardinal.continuum_le_lift Cardinal.continuum_le_lift @[simp] theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c ≤ 𝔠 ↔ c ≤ 𝔠 := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_le] #align cardinal.lift_le_continuum Cardinal.lift_le_continuum @[simp] theorem continuum_lt_lift {c : Cardinal.{u}} : 𝔠 < lift.{v} c ↔ 𝔠 < c := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_lt] #align cardinal.continuum_lt_lift Cardinal.continuum_lt_lift @[simp] theorem lift_lt_continuum {c : Cardinal.{u}} : lift.{v} c < 𝔠 ↔ c < 𝔠 := by -- Porting note: added explicit universes rw [← lift_continuum.{u,v}, lift_lt] #align cardinal.lift_lt_continuum Cardinal.lift_lt_continuum theorem aleph0_lt_continuum : ℵ₀ < 𝔠 := cantor ℵ₀ #align cardinal.aleph_0_lt_continuum Cardinal.aleph0_lt_continuum theorem aleph0_le_continuum : ℵ₀ ≤ 𝔠 := aleph0_lt_continuum.le #align cardinal.aleph_0_le_continuum Cardinal.aleph0_le_continuum @[simp] theorem beth_one : beth 1 = 𝔠 := by simpa using beth_succ 0 #align cardinal.beth_one Cardinal.beth_one theorem nat_lt_continuum (n : ℕ) : ↑n < 𝔠 := (nat_lt_aleph0 n).trans aleph0_lt_continuum #align cardinal.nat_lt_continuum Cardinal.nat_lt_continuum
Mathlib/SetTheory/Cardinal/Continuum.lean
90
90
theorem mk_set_nat : #(Set ℕ) = 𝔠 := by
simp
0.84375
import Mathlib.GroupTheory.Coprod.Basic import Mathlib.GroupTheory.Complement open Monoid Coprod Multiplicative Subgroup Function def HNNExtension.con (G : Type*) [Group G] (A B : Subgroup G) (φ : A ≃* B) : Con (G ∗ Multiplicative ℤ) := conGen (fun x y => ∃ (a : A), x = inr (ofAdd 1) * inl (a : G) ∧ y = inl (φ a : G) * inr (ofAdd 1)) def HNNExtension (G : Type*) [Group G] (A B : Subgroup G) (φ : A ≃* B) : Type _ := (HNNExtension.con G A B φ).Quotient variable {G : Type*} [Group G] {A B : Subgroup G} {φ : A ≃* B} {H : Type*} [Group H] {M : Type*} [Monoid M] instance : Group (HNNExtension G A B φ) := by delta HNNExtension; infer_instance namespace HNNExtension def of : G →* HNNExtension G A B φ := (HNNExtension.con G A B φ).mk'.comp inl def t : HNNExtension G A B φ := (HNNExtension.con G A B φ).mk'.comp inr (ofAdd 1) theorem t_mul_of (a : A) : t * (of (a : G) : HNNExtension G A B φ) = of (φ a : G) * t := (Con.eq _).2 <| ConGen.Rel.of _ _ <| ⟨a, by simp⟩ theorem of_mul_t (b : B) : (of (b : G) : HNNExtension G A B φ) * t = t * of (φ.symm b : G) := by rw [t_mul_of]; simp theorem equiv_eq_conj (a : A) : (of (φ a : G) : HNNExtension G A B φ) = t * of (a : G) * t⁻¹ := by rw [t_mul_of]; simp theorem equiv_symm_eq_conj (b : B) : (of (φ.symm b : G) : HNNExtension G A B φ) = t⁻¹ * of (b : G) * t := by rw [mul_assoc, of_mul_t]; simp theorem inv_t_mul_of (b : B) : t⁻¹ * (of (b : G) : HNNExtension G A B φ) = of (φ.symm b : G) * t⁻¹ := by rw [equiv_symm_eq_conj]; simp theorem of_mul_inv_t (a : A) : (of (a : G) : HNNExtension G A B φ) * t⁻¹ = t⁻¹ * of (φ a : G) := by rw [equiv_eq_conj]; simp [mul_assoc] def lift (f : G →* H) (x : H) (hx : ∀ a : A, x * f ↑a = f (φ a : G) * x) : HNNExtension G A B φ →* H := Con.lift _ (Coprod.lift f (zpowersHom H x)) (Con.conGen_le <| by rintro _ _ ⟨a, rfl, rfl⟩ simp [hx]) @[simp] theorem lift_t (f : G →* H) (x : H) (hx : ∀ a : A, x * f ↑a = f (φ a : G) * x) : lift f x hx t = x := by delta HNNExtension; simp [lift, t] @[simp]
Mathlib/GroupTheory/HNNExtension.lean
102
104
theorem lift_of (f : G →* H) (x : H) (hx : ∀ a : A, x * f ↑a = f (φ a : G) * x) (g : G) : lift f x hx (of g) = f g := by
delta HNNExtension; simp [lift, of]
0.84375
import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.Tactic.FieldSimp #align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" universe u₁ u₂ namespace Matrix open Matrix variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜] variable [DecidableEq n] [DecidableEq p] variable [CommRing R] section Transvection variable {R n} (i j : n) def transvection (c : R) : Matrix n n R := 1 + Matrix.stdBasisMatrix i j c #align matrix.transvection Matrix.transvection @[simp] theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection] #align matrix.transvection_zero Matrix.transvection_zero section theorem updateRow_eq_transvection [Finite n] (c : R) : updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) = transvection i j c := by cases nonempty_fintype n ext a b by_cases ha : i = a · by_cases hb : j = b · simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same, one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply] · simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply, Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul, mul_zero, add_apply] · simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero, Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply, mul_zero, false_and_iff, add_apply] #align matrix.update_row_eq_transvection Matrix.updateRow_eq_transvection variable [Fintype n] theorem transvection_mul_transvection_same (h : i ≠ j) (c d : R) : transvection i j c * transvection i j d = transvection i j (c + d) := by simp [transvection, Matrix.add_mul, Matrix.mul_add, h, h.symm, add_smul, add_assoc, stdBasisMatrix_add] #align matrix.transvection_mul_transvection_same Matrix.transvection_mul_transvection_same @[simp] theorem transvection_mul_apply_same (b : n) (c : R) (M : Matrix n n R) : (transvection i j c * M) i b = M i b + c * M j b := by simp [transvection, Matrix.add_mul] #align matrix.transvection_mul_apply_same Matrix.transvection_mul_apply_same @[simp] theorem mul_transvection_apply_same (a : n) (c : R) (M : Matrix n n R) : (M * transvection i j c) a j = M a j + c * M a i := by simp [transvection, Matrix.mul_add, mul_comm] #align matrix.mul_transvection_apply_same Matrix.mul_transvection_apply_same @[simp]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
131
132
theorem transvection_mul_apply_of_ne (a b : n) (ha : a ≠ i) (c : R) (M : Matrix n n R) : (transvection i j c * M) a b = M a b := by
simp [transvection, Matrix.add_mul, ha]
0.84375
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Finset.Card import Mathlib.Data.List.NodupEquivFin import Mathlib.Data.Set.Image #align_import data.fintype.card from "leanprover-community/mathlib"@"bf2428c9486c407ca38b5b3fb10b87dad0bc99fa" assert_not_exists MonoidWithZero assert_not_exists MulAction open Function open Nat universe u v variable {α β γ : Type*} open Finset Function namespace Fintype def card (α) [Fintype α] : ℕ := (@univ α _).card #align fintype.card Fintype.card def truncEquivFin (α) [DecidableEq α] [Fintype α] : Trunc (α ≃ Fin (card α)) := by unfold card Finset.card exact Quot.recOnSubsingleton' (motive := fun s : Multiset α => (∀ x : α, x ∈ s) → s.Nodup → Trunc (α ≃ Fin (Multiset.card s))) univ.val (fun l (h : ∀ x : α, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getEquivOfForallMemList _ h).symm) mem_univ_val univ.2 #align fintype.trunc_equiv_fin Fintype.truncEquivFin noncomputable def equivFin (α) [Fintype α] : α ≃ Fin (card α) := letI := Classical.decEq α (truncEquivFin α).out #align fintype.equiv_fin Fintype.equivFin def truncFinBijection (α) [Fintype α] : Trunc { f : Fin (card α) → α // Bijective f } := by unfold card Finset.card refine Quot.recOnSubsingleton' (motive := fun s : Multiset α => (∀ x : α, x ∈ s) → s.Nodup → Trunc {f : Fin (Multiset.card s) → α // Bijective f}) univ.val (fun l (h : ∀ x : α, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getBijectionOfForallMemList _ h)) mem_univ_val univ.2 #align fintype.trunc_fin_bijection Fintype.truncFinBijection theorem subtype_card {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) : @card { x // p x } (Fintype.subtype s H) = s.card := Multiset.card_pmap _ _ _ #align fintype.subtype_card Fintype.subtype_card
Mathlib/Data/Fintype/Card.lean
126
130
theorem card_of_subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) [Fintype { x // p x }] : card { x // p x } = s.card := by
rw [← subtype_card s H] congr apply Subsingleton.elim
0.84375
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} @[simp] theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) : reduceOption (some x :: l) = x :: l.reduceOption := by simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff] #align list.reduce_option_cons_of_some List.reduceOption_cons_of_some @[simp]
Mathlib/Data/List/ReduceOption.lean
25
26
theorem reduceOption_cons_of_none (l : List (Option α)) : reduceOption (none :: l) = l.reduceOption := by
simp only [reduceOption, filterMap, id]
0.84375
import Mathlib.Data.Complex.Module import Mathlib.Data.Complex.Order import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" assert_not_exists Absorbs noncomputable section namespace Complex variable {z : ℂ} open ComplexConjugate Topology Filter instance : Norm ℂ := ⟨abs⟩ @[simp] theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z := rfl #align complex.norm_eq_abs Complex.norm_eq_abs lemma norm_I : ‖I‖ = 1 := abs_I theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by simp only [norm_eq_abs, abs_exp_ofReal_mul_I] set_option linter.uppercaseLean3 false in #align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I instance instNormedAddCommGroup : NormedAddCommGroup ℂ := AddGroupNorm.toNormedAddCommGroup { abs with map_zero' := map_zero abs neg' := abs.map_neg eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 } instance : NormedField ℂ where dist_eq _ _ := rfl norm_mul' := map_mul abs instance : DenselyNormedField ℂ where lt_norm_lt r₁ r₂ h₀ hr := let ⟨x, h⟩ := exists_between hr ⟨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]⟩ instance {R : Type*} [NormedField R] [NormedAlgebra R ℝ] : NormedAlgebra R ℂ where norm_smul_le r x := by rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs, norm_algebraMap'] variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℂ E] -- see Note [lower instance priority] instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ ℂ E #align normed_space.complex_to_real NormedSpace.complexToReal -- see Note [lower instance priority] instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A] [NormedAlgebra ℂ A] : NormedAlgebra ℝ A := NormedAlgebra.restrictScalars ℝ ℂ A theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) := rfl #align complex.dist_eq Complex.dist_eq theorem dist_eq_re_im (z w : ℂ) : dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by rw [sq, sq] rfl #align complex.dist_eq_re_im Complex.dist_eq_re_im @[simp] theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) : dist (mk x₁ y₁) (mk x₂ y₂) = √((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) := dist_eq_re_im _ _ #align complex.dist_mk Complex.dist_mk theorem dist_of_re_eq {z w : ℂ} (h : z.re = w.re) : dist z w = dist z.im w.im := by rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq] #align complex.dist_of_re_eq Complex.dist_of_re_eq theorem nndist_of_re_eq {z w : ℂ} (h : z.re = w.re) : nndist z w = nndist z.im w.im := NNReal.eq <| dist_of_re_eq h #align complex.nndist_of_re_eq Complex.nndist_of_re_eq
Mathlib/Analysis/Complex/Basic.lean
121
122
theorem edist_of_re_eq {z w : ℂ} (h : z.re = w.re) : edist z w = edist z.im w.im := by
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
0.84375
import Mathlib.Algebra.Lie.Abelian import Mathlib.Algebra.Lie.IdealOperations import Mathlib.Algebra.Lie.Quotient #align_import algebra.lie.normalizer from "leanprover-community/mathlib"@"938fead7abdc0cbbca8eba7a1052865a169dc102" variable {R L M M' : Type*} variable [CommRing R] [LieRing L] [LieAlgebra R L] variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M] variable [AddCommGroup M'] [Module R M'] [LieRingModule L M'] [LieModule R L M'] namespace LieSubmodule variable (N : LieSubmodule R L M) {N₁ N₂ : LieSubmodule R L M} def normalizer : LieSubmodule R L M where carrier := {m | ∀ x : L, ⁅x, m⁆ ∈ N} add_mem' hm₁ hm₂ x := by rw [lie_add]; exact N.add_mem' (hm₁ x) (hm₂ x) zero_mem' x := by simp smul_mem' t m hm x := by rw [lie_smul]; exact N.smul_mem' t (hm x) lie_mem {x m} hm y := by rw [leibniz_lie]; exact N.add_mem' (hm ⁅y, x⁆) (N.lie_mem (hm y)) #align lie_submodule.normalizer LieSubmodule.normalizer @[simp] theorem mem_normalizer (m : M) : m ∈ N.normalizer ↔ ∀ x : L, ⁅x, m⁆ ∈ N := Iff.rfl #align lie_submodule.mem_normalizer LieSubmodule.mem_normalizer @[simp] theorem le_normalizer : N ≤ N.normalizer := by intro m hm rw [mem_normalizer] exact fun x => N.lie_mem hm #align lie_submodule.le_normalizer LieSubmodule.le_normalizer
Mathlib/Algebra/Lie/Normalizer.lean
70
71
theorem normalizer_inf : (N₁ ⊓ N₂).normalizer = N₁.normalizer ⊓ N₂.normalizer := by
ext; simp [← forall_and]
0.84375
import Mathlib.Control.EquivFunctor import Mathlib.CategoryTheory.Groupoid import Mathlib.CategoryTheory.Whiskering import Mathlib.CategoryTheory.Types #align_import category_theory.core from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768" namespace CategoryTheory universe v₁ v₂ u₁ u₂ -- morphism levels before object levels. See note [CategoryTheory universes]. -- Porting note(#5171): linter not yet ported -- @[nolint has_nonempty_instance] def Core (C : Type u₁) := C #align category_theory.core CategoryTheory.Core variable {C : Type u₁} [Category.{v₁} C] instance coreCategory : Groupoid.{v₁} (Core C) where Hom (X Y : C) := X ≅ Y id (X : C) := Iso.refl X comp f g := Iso.trans f g inv {X Y} f := Iso.symm f #align category_theory.core_category CategoryTheory.coreCategory namespace Core @[simp]
Mathlib/CategoryTheory/Core.lean
52
53
theorem id_hom (X : C) : Iso.hom (coreCategory.id X) = @CategoryStruct.id C _ X := by
rfl
0.84375
import Mathlib.Algebra.Module.Equiv import Mathlib.Data.DFinsupp.Basic import Mathlib.Data.Finsupp.Basic #align_import data.finsupp.to_dfinsupp from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" variable {ι : Type*} {R : Type*} {M : Type*} section Defs def Finsupp.toDFinsupp [Zero M] (f : ι →₀ M) : Π₀ _ : ι, M where toFun := f support' := Trunc.mk ⟨f.support.1, fun i => (Classical.em (f i = 0)).symm.imp_left Finsupp.mem_support_iff.mpr⟩ #align finsupp.to_dfinsupp Finsupp.toDFinsupp @[simp] theorem Finsupp.toDFinsupp_coe [Zero M] (f : ι →₀ M) : ⇑f.toDFinsupp = f := rfl #align finsupp.to_dfinsupp_coe Finsupp.toDFinsupp_coe section variable [DecidableEq ι] [Zero M] @[simp] theorem Finsupp.toDFinsupp_single (i : ι) (m : M) : (Finsupp.single i m).toDFinsupp = DFinsupp.single i m := by ext simp [Finsupp.single_apply, DFinsupp.single_apply] #align finsupp.to_dfinsupp_single Finsupp.toDFinsupp_single variable [∀ m : M, Decidable (m ≠ 0)] @[simp]
Mathlib/Data/Finsupp/ToDFinsupp.lean
97
99
theorem toDFinsupp_support (f : ι →₀ M) : f.toDFinsupp.support = f.support := by
ext simp
0.84375
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*} section Semigroup variable [Semigroup α] @[to_additive] instance Semigroup.to_isAssociative : Std.Associative (α := α) (· * ·) := ⟨mul_assoc⟩ #align semigroup.to_is_associative Semigroup.to_isAssociative #align add_semigroup.to_is_associative AddSemigroup.to_isAssociative @[to_additive (attr := simp) "Composing two additions on the left by `y` then `x` is equal to an addition on the left by `x + y`."] theorem comp_mul_left (x y : α) : (x * ·) ∘ (y * ·) = (x * y * ·) := by ext z simp [mul_assoc] #align comp_mul_left comp_mul_left #align comp_add_left comp_add_left @[to_additive (attr := simp) "Composing two additions on the right by `y` and `x` is equal to an addition on the right by `y + x`."]
Mathlib/Algebra/Group/Basic.lean
128
130
theorem comp_mul_right (x y : α) : (· * x) ∘ (· * y) = (· * (y * x)) := by
ext z simp [mul_assoc]
0.84375
import Mathlib.Analysis.Convex.Hull #align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8" open Set variable {ι : Sort*} {𝕜 E : Type*} section OrderedSemiring variable (𝕜) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] {s t s₁ s₂ t₁ t₂ u : Set E} {x y : E} def convexJoin (s t : Set E) : Set E := ⋃ (x ∈ s) (y ∈ t), segment 𝕜 x y #align convex_join convexJoin variable {𝕜} theorem mem_convexJoin : x ∈ convexJoin 𝕜 s t ↔ ∃ a ∈ s, ∃ b ∈ t, x ∈ segment 𝕜 a b := by simp [convexJoin] #align mem_convex_join mem_convexJoin theorem convexJoin_comm (s t : Set E) : convexJoin 𝕜 s t = convexJoin 𝕜 t s := (iUnion₂_comm _).trans <| by simp_rw [convexJoin, segment_symm] #align convex_join_comm convexJoin_comm theorem convexJoin_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s₁ t₁ ⊆ convexJoin 𝕜 s₂ t₂ := biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht #align convex_join_mono convexJoin_mono theorem convexJoin_mono_left (hs : s₁ ⊆ s₂) : convexJoin 𝕜 s₁ t ⊆ convexJoin 𝕜 s₂ t := convexJoin_mono hs Subset.rfl #align convex_join_mono_left convexJoin_mono_left theorem convexJoin_mono_right (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s t₁ ⊆ convexJoin 𝕜 s t₂ := convexJoin_mono Subset.rfl ht #align convex_join_mono_right convexJoin_mono_right @[simp] theorem convexJoin_empty_left (t : Set E) : convexJoin 𝕜 ∅ t = ∅ := by simp [convexJoin] #align convex_join_empty_left convexJoin_empty_left @[simp]
Mathlib/Analysis/Convex/Join.lean
61
61
theorem convexJoin_empty_right (s : Set E) : convexJoin 𝕜 s ∅ = ∅ := by
simp [convexJoin]
0.84375
import Mathlib.CategoryTheory.Subobject.Lattice #align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d" universe v u noncomputable section open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite variable {C : Type u} [Category.{v} C] {X Y Z : C} namespace CategoryTheory namespace Limits section Image variable (f : X ⟶ Y) [HasImage f] abbrev imageSubobject : Subobject Y := Subobject.mk (image.ι f) #align category_theory.limits.image_subobject CategoryTheory.Limits.imageSubobject def imageSubobjectIso : (imageSubobject f : C) ≅ image f := Subobject.underlyingIso (image.ι f) #align category_theory.limits.image_subobject_iso CategoryTheory.Limits.imageSubobjectIso @[reassoc (attr := simp)] theorem imageSubobject_arrow : (imageSubobjectIso f).hom ≫ image.ι f = (imageSubobject f).arrow := by simp [imageSubobjectIso] #align category_theory.limits.image_subobject_arrow CategoryTheory.Limits.imageSubobject_arrow @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Subobject/Limits.lean
314
315
theorem imageSubobject_arrow' : (imageSubobjectIso f).inv ≫ (imageSubobject f).arrow = image.ι f := by
simp [imageSubobjectIso]
0.84375
import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Lifts import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.RootsOfUnity.Complex import Mathlib.NumberTheory.ArithmeticFunction import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.FieldTheory.RatFunc.AsPolynomial #align_import ring_theory.polynomial.cyclotomic.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Polynomial noncomputable section universe u namespace Polynomial section Cyclotomic' section IsDomain variable {R : Type*} [CommRing R] [IsDomain R] def cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] := ∏ μ ∈ primitiveRoots n R, (X - C μ) #align polynomial.cyclotomic' Polynomial.cyclotomic' @[simp]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
72
73
theorem cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by
simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero]
0.84375
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] theorem card_Ioo : (Ioo a b).card = b - a - 1 := by rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map] #align fin.card_Ioo Fin.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map] #align fin.card_uIcc Fin.card_uIcc -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by rw [← card_Icc, Fintype.card_ofFinset] #align fin.card_fintype_Icc Fin.card_fintypeIcc -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by rw [← card_Ico, Fintype.card_ofFinset] #align fin.card_fintype_Ico Fin.card_fintypeIco -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by rw [← card_Ioc, Fintype.card_ofFinset] #align fin.card_fintype_Ioc Fin.card_fintypeIoc -- Porting note (#10618): simp can prove this -- @[simp] theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by rw [← card_Ioo, Fintype.card_ofFinset] #align fin.card_fintype_Ioo Fin.card_fintypeIoo theorem card_fintype_uIcc : Fintype.card (Set.uIcc a b) = (b - a : ℤ).natAbs + 1 := by rw [← card_uIcc, Fintype.card_ofFinset] #align fin.card_fintype_uIcc Fin.card_fintype_uIcc
Mathlib/Order/Interval/Finset/Fin.lean
156
158
theorem Ici_eq_finset_subtype : Ici a = (Icc (a : ℕ) n).fin n := by
ext simp
0.84375
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by simpa only [not_iff_not] using dist_eq_zero #align dist_ne_zero dist_ne_zero @[simp] theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y := by simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y #align dist_le_zero dist_le_zero @[simp] theorem dist_pos {x y : γ} : 0 < dist x y ↔ x ≠ y := by simpa only [not_le] using not_congr dist_le_zero #align dist_pos dist_pos theorem eq_of_forall_dist_le {x y : γ} (h : ∀ ε > 0, dist x y ≤ ε) : x = y := eq_of_dist_eq_zero (eq_of_le_of_forall_le_of_dense dist_nonneg h) #align eq_of_forall_dist_le eq_of_forall_dist_le theorem eq_of_nndist_eq_zero {x y : γ} : nndist x y = 0 → x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero] #align eq_of_nndist_eq_zero eq_of_nndist_eq_zero @[simp] theorem nndist_eq_zero {x y : γ} : nndist x y = 0 ↔ x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero] #align nndist_eq_zero nndist_eq_zero @[simp] theorem zero_eq_nndist {x y : γ} : 0 = nndist x y ↔ x = y := by simp only [← NNReal.eq_iff, ← dist_nndist, imp_self, NNReal.coe_zero, zero_eq_dist] #align zero_eq_nndist zero_eq_nndist def MetricSpace.replaceUniformity {γ} [U : UniformSpace γ] (m : MetricSpace γ) (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace]) : MetricSpace γ where toPseudoMetricSpace := PseudoMetricSpace.replaceUniformity m.toPseudoMetricSpace H eq_of_dist_eq_zero := @eq_of_dist_eq_zero _ _ #align metric_space.replace_uniformity MetricSpace.replaceUniformity theorem MetricSpace.replaceUniformity_eq {γ} [U : UniformSpace γ] (m : MetricSpace γ) (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace]) : m.replaceUniformity H = m := by ext; rfl #align metric_space.replace_uniformity_eq MetricSpace.replaceUniformity_eq abbrev MetricSpace.replaceTopology {γ} [U : TopologicalSpace γ] (m : MetricSpace γ) (H : U = m.toPseudoMetricSpace.toUniformSpace.toTopologicalSpace) : MetricSpace γ := @MetricSpace.replaceUniformity γ (m.toUniformSpace.replaceTopology H) m rfl #align metric_space.replace_topology MetricSpace.replaceTopology
Mathlib/Topology/MetricSpace/Basic.lean
205
208
theorem MetricSpace.replaceTopology_eq {γ} [U : TopologicalSpace γ] (m : MetricSpace γ) (H : U = m.toPseudoMetricSpace.toUniformSpace.toTopologicalSpace) : m.replaceTopology H = m := by
ext; rfl
0.84375
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp] theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by rw [enum, get?_enumFrom, Nat.zero_add] #align list.enum_nth List.get?_enum @[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum @[simp] theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l | _, [] => rfl | _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _) #align list.enum_from_map_snd List.enumFrom_map_snd @[simp] theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l := enumFrom_map_snd _ _ #align list.enum_map_snd List.enum_map_snd @[simp] theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) : (l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by simp [get_eq_get?] #align list.nth_le_enum_from List.get_enumFrom @[simp] theorem get_enum (l : List α) (i : Fin l.enum.length) : l.enum.get i = (i.1, l.get (i.cast enum_length)) := by simp [enum] #align list.nth_le_enum List.get_enum theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} : (n + i, x) ∈ enumFrom n l ↔ l.get? i = x := by simp [mem_iff_get?] theorem mk_mem_enumFrom_iff_le_and_get?_sub {n i : ℕ} {x : α} {l : List α} : (i, x) ∈ enumFrom n l ↔ n ≤ i ∧ l.get? (i - n) = x := by if h : n ≤ i then rcases Nat.exists_eq_add_of_le h with ⟨i, rfl⟩ simp [mk_add_mem_enumFrom_iff_get?, Nat.add_sub_cancel_left] else have : ∀ k, n + k ≠ i := by rintro k rfl; simp at h simp [h, mem_iff_get?, this] theorem mk_mem_enum_iff_get? {i : ℕ} {x : α} {l : List α} : (i, x) ∈ enum l ↔ l.get? i = x := by simp [enum, mk_mem_enumFrom_iff_le_and_get?_sub] theorem mem_enum_iff_get? {x : ℕ × α} {l : List α} : x ∈ enum l ↔ l.get? x.1 = x.2 := mk_mem_enum_iff_get? theorem le_fst_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : n ≤ x.1 := (mk_mem_enumFrom_iff_le_and_get?_sub.1 h).1 theorem fst_lt_add_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : x.1 < n + length l := by rcases mem_iff_get.1 h with ⟨i, rfl⟩ simpa using i.is_lt
Mathlib/Data/List/Enum.lean
87
88
theorem fst_lt_of_mem_enum {x : ℕ × α} {l : List α} (h : x ∈ enum l) : x.1 < length l := by
simpa using fst_lt_add_of_mem_enumFrom h
0.84375
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : ℕ) (φ : R⟦X⟧) : R[X] := ∑ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m φ) #align power_series.trunc PowerSeries.trunc
Mathlib/RingTheory/PowerSeries/Trunc.lean
44
46
theorem coeff_trunc (m) (n) (φ : R⟦X⟧) : (trunc n φ).coeff m = if m < n then coeff R m φ else 0 := by
simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff]
0.84375
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : ℕ) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≤ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≤ n := tsub_eq_zero_iff_le.mp this le_antisymm ‹n ≤ m› ‹m ≤ n› #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : ℕ} (h : n ≤ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le theorem dist_eq_sub_of_le_right {n m : ℕ} (h : m ≤ n) : dist n m = n - m := by rw [dist_comm]; apply dist_eq_sub_of_le h #align nat.dist_eq_sub_of_le_right Nat.dist_eq_sub_of_le_right theorem dist_tri_left (n m : ℕ) : m ≤ dist n m + n := le_trans le_tsub_add (add_le_add_right (Nat.le_add_left _ _) _) #align nat.dist_tri_left Nat.dist_tri_left theorem dist_tri_right (n m : ℕ) : m ≤ n + dist n m := by rw [add_comm]; apply dist_tri_left #align nat.dist_tri_right Nat.dist_tri_right theorem dist_tri_left' (n m : ℕ) : n ≤ dist n m + m := by rw [dist_comm]; apply dist_tri_left #align nat.dist_tri_left' Nat.dist_tri_left' theorem dist_tri_right' (n m : ℕ) : n ≤ m + dist n m := by rw [dist_comm]; apply dist_tri_right #align nat.dist_tri_right' Nat.dist_tri_right' theorem dist_zero_right (n : ℕ) : dist n 0 = n := Eq.trans (dist_eq_sub_of_le_right (zero_le n)) (tsub_zero n) #align nat.dist_zero_right Nat.dist_zero_right theorem dist_zero_left (n : ℕ) : dist 0 n = n := Eq.trans (dist_eq_sub_of_le (zero_le n)) (tsub_zero n) #align nat.dist_zero_left Nat.dist_zero_left theorem dist_add_add_right (n k m : ℕ) : dist (n + k) (m + k) = dist n m := calc dist (n + k) (m + k) = n + k - (m + k) + (m + k - (n + k)) := rfl _ = n - m + (m + k - (n + k)) := by rw [@add_tsub_add_eq_tsub_right] _ = n - m + (m - n) := by rw [@add_tsub_add_eq_tsub_right] #align nat.dist_add_add_right Nat.dist_add_add_right theorem dist_add_add_left (k n m : ℕ) : dist (k + n) (k + m) = dist n m := by rw [add_comm k n, add_comm k m]; apply dist_add_add_right #align nat.dist_add_add_left Nat.dist_add_add_left theorem dist_eq_intro {n m k l : ℕ} (h : n + m = k + l) : dist n k = dist l m := calc dist n k = dist (n + m) (k + m) := by rw [dist_add_add_right] _ = dist (k + l) (k + m) := by rw [h] _ = dist l m := by rw [dist_add_add_left] #align nat.dist_eq_intro Nat.dist_eq_intro theorem dist.triangle_inequality (n m k : ℕ) : dist n k ≤ dist n m + dist m k := by have : dist n m + dist m k = n - m + (m - k) + (k - m + (m - n)) := by simp [dist, add_comm, add_left_comm, add_assoc] rw [this, dist] exact add_le_add tsub_le_tsub_add_tsub tsub_le_tsub_add_tsub #align nat.dist.triangle_inequality Nat.dist.triangle_inequality theorem dist_mul_right (n k m : ℕ) : dist (n * k) (m * k) = dist n m * k := by rw [dist, dist, right_distrib, tsub_mul n, tsub_mul m] #align nat.dist_mul_right Nat.dist_mul_right theorem dist_mul_left (k n m : ℕ) : dist (k * n) (k * m) = k * dist n m := by rw [mul_comm k n, mul_comm k m, dist_mul_right, mul_comm] #align nat.dist_mul_left Nat.dist_mul_left theorem dist_eq_max_sub_min {i j : ℕ} : dist i j = (max i j) - min i j := Or.elim (lt_or_ge i j) (by intro h; rw [max_eq_right_of_lt h, min_eq_left_of_lt h, dist_eq_sub_of_le (Nat.le_of_lt h)]) (by intro h; rw [max_eq_left h, min_eq_right h, dist_eq_sub_of_le_right h])
Mathlib/Data/Nat/Dist.lean
112
113
theorem dist_succ_succ {i j : Nat} : dist (succ i) (succ j) = dist i j := by
simp [dist, succ_sub_succ]
0.84375
import Mathlib.Algebra.CharP.ExpChar import Mathlib.GroupTheory.OrderOfElement #align_import algebra.char_p.two from "leanprover-community/mathlib"@"7f1ba1a333d66eed531ecb4092493cd1b6715450" variable {R ι : Type*} namespace CharTwo section CommSemiring variable [CommSemiring R] [CharP R 2] theorem add_sq (x y : R) : (x + y) ^ 2 = x ^ 2 + y ^ 2 := add_pow_char _ _ _ #align char_two.add_sq CharTwo.add_sq theorem add_mul_self (x y : R) : (x + y) * (x + y) = x * x + y * y := by rw [← pow_two, ← pow_two, ← pow_two, add_sq] #align char_two.add_mul_self CharTwo.add_mul_self theorem list_sum_sq (l : List R) : l.sum ^ 2 = (l.map (· ^ 2)).sum := list_sum_pow_char _ _ #align char_two.list_sum_sq CharTwo.list_sum_sq theorem list_sum_mul_self (l : List R) : l.sum * l.sum = (List.map (fun x => x * x) l).sum := by simp_rw [← pow_two, list_sum_sq] #align char_two.list_sum_mul_self CharTwo.list_sum_mul_self theorem multiset_sum_sq (l : Multiset R) : l.sum ^ 2 = (l.map (· ^ 2)).sum := multiset_sum_pow_char _ _ #align char_two.multiset_sum_sq CharTwo.multiset_sum_sq theorem multiset_sum_mul_self (l : Multiset R) : l.sum * l.sum = (Multiset.map (fun x => x * x) l).sum := by simp_rw [← pow_two, multiset_sum_sq] #align char_two.multiset_sum_mul_self CharTwo.multiset_sum_mul_self theorem sum_sq (s : Finset ι) (f : ι → R) : (∑ i ∈ s, f i) ^ 2 = ∑ i ∈ s, f i ^ 2 := sum_pow_char _ _ _ #align char_two.sum_sq CharTwo.sum_sq
Mathlib/Algebra/CharP/Two.lean
115
116
theorem sum_mul_self (s : Finset ι) (f : ι → R) : ((∑ i ∈ s, f i) * ∑ i ∈ s, f i) = ∑ i ∈ s, f i * f i := by
simp_rw [← pow_two, sum_sq]
0.84375
import Mathlib.SetTheory.Cardinal.ToNat import Mathlib.Data.Nat.PartENat #align_import set_theory.cardinal.basic from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" universe u v open Function variable {α : Type u} namespace Cardinal noncomputable def toPartENat : Cardinal →+o PartENat := .comp { (PartENat.withTopAddEquiv.symm : ℕ∞ →+ PartENat), (PartENat.withTopOrderIso.symm : ℕ∞ →o PartENat) with } toENat #align cardinal.to_part_enat Cardinal.toPartENat @[simp] theorem partENatOfENat_toENat (c : Cardinal) : (toENat c : PartENat) = toPartENat c := rfl @[simp] theorem toPartENat_natCast (n : ℕ) : toPartENat n = n := by simp only [← partENatOfENat_toENat, toENat_nat, PartENat.ofENat_coe] #align cardinal.to_part_enat_cast Cardinal.toPartENat_natCast theorem toPartENat_apply_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : toPartENat c = toNat c := by lift c to ℕ using h; simp #align cardinal.to_part_enat_apply_of_lt_aleph_0 Cardinal.toPartENat_apply_of_lt_aleph0 theorem toPartENat_eq_top {c : Cardinal} : toPartENat c = ⊤ ↔ ℵ₀ ≤ c := by rw [← partENatOfENat_toENat, ← PartENat.withTopEquiv_symm_top, ← toENat_eq_top, ← PartENat.withTopEquiv.symm.injective.eq_iff] simp #align to_part_enat_eq_top_iff_le_aleph_0 Cardinal.toPartENat_eq_top theorem toPartENat_apply_of_aleph0_le {c : Cardinal} (h : ℵ₀ ≤ c) : toPartENat c = ⊤ := congr_arg PartENat.ofENat (toENat_eq_top.2 h) #align cardinal.to_part_enat_apply_of_aleph_0_le Cardinal.toPartENat_apply_of_aleph0_le @[deprecated (since := "2024-02-15")] alias toPartENat_cast := toPartENat_natCast @[simp] theorem mk_toPartENat_of_infinite [h : Infinite α] : toPartENat #α = ⊤ := toPartENat_apply_of_aleph0_le (infinite_iff.1 h) #align cardinal.mk_to_part_enat_of_infinite Cardinal.mk_toPartENat_of_infinite @[simp] theorem aleph0_toPartENat : toPartENat ℵ₀ = ⊤ := toPartENat_apply_of_aleph0_le le_rfl #align cardinal.aleph_0_to_part_enat Cardinal.aleph0_toPartENat theorem toPartENat_surjective : Surjective toPartENat := fun x => PartENat.casesOn x ⟨ℵ₀, toPartENat_apply_of_aleph0_le le_rfl⟩ fun n => ⟨n, toPartENat_natCast n⟩ #align cardinal.to_part_enat_surjective Cardinal.toPartENat_surjective @[deprecated (since := "2024-02-15")] alias toPartENat_eq_top_iff_le_aleph0 := toPartENat_eq_top theorem toPartENat_strictMonoOn : StrictMonoOn toPartENat (Set.Iic ℵ₀) := PartENat.withTopOrderIso.symm.strictMono.comp_strictMonoOn toENat_strictMonoOn lemma toPartENat_le_iff_of_le_aleph0 {c c' : Cardinal} (h : c ≤ ℵ₀) : toPartENat c ≤ toPartENat c' ↔ c ≤ c' := by lift c to ℕ∞ using h simp_rw [← partENatOfENat_toENat, toENat_ofENat, enat_gc _, ← PartENat.withTopOrderIso.symm.le_iff_le, PartENat.ofENat_le, map_le_map_iff] #align to_part_enat_le_iff_le_of_le_aleph_0 Cardinal.toPartENat_le_iff_of_le_aleph0 lemma toPartENat_le_iff_of_lt_aleph0 {c c' : Cardinal} (hc' : c' < ℵ₀) : toPartENat c ≤ toPartENat c' ↔ c ≤ c' := by lift c' to ℕ using hc' simp_rw [← partENatOfENat_toENat, toENat_nat, ← toENat_le_nat, ← PartENat.withTopOrderIso.symm.le_iff_le, PartENat.ofENat_le, map_le_map_iff] #align to_part_enat_le_iff_le_of_lt_aleph_0 Cardinal.toPartENat_le_iff_of_lt_aleph0 lemma toPartENat_eq_iff_of_le_aleph0 {c c' : Cardinal} (hc : c ≤ ℵ₀) (hc' : c' ≤ ℵ₀) : toPartENat c = toPartENat c' ↔ c = c' := toPartENat_strictMonoOn.injOn.eq_iff hc hc' #align to_part_enat_eq_iff_eq_of_le_aleph_0 Cardinal.toPartENat_eq_iff_of_le_aleph0 theorem toPartENat_mono {c c' : Cardinal} (h : c ≤ c') : toPartENat c ≤ toPartENat c' := OrderHomClass.mono _ h #align cardinal.to_part_enat_mono Cardinal.toPartENat_mono theorem toPartENat_lift (c : Cardinal.{v}) : toPartENat (lift.{u, v} c) = toPartENat c := by simp only [← partENatOfENat_toENat, toENat_lift] #align cardinal.to_part_enat_lift Cardinal.toPartENat_lift theorem toPartENat_congr {β : Type v} (e : α ≃ β) : toPartENat #α = toPartENat #β := by rw [← toPartENat_lift, lift_mk_eq.{_, _,v}.mpr ⟨e⟩, toPartENat_lift] #align cardinal.to_part_enat_congr Cardinal.toPartENat_congr
Mathlib/SetTheory/Cardinal/PartENat.lean
112
113
theorem mk_toPartENat_eq_coe_card [Fintype α] : toPartENat #α = Fintype.card α := by
simp
0.84375
import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.Tactic.FieldSimp #align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open AffineMap variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE] def slope (f : k → PE) (a b : k) : E := (b - a)⁻¹ • (f b -ᵥ f a) #align slope slope theorem slope_fun_def (f : k → PE) : slope f = fun a b => (b - a)⁻¹ • (f b -ᵥ f a) := rfl #align slope_fun_def slope_fun_def theorem slope_def_field (f : k → k) (a b : k) : slope f a b = (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_def_field slope_def_field theorem slope_fun_def_field (f : k → k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) := (div_eq_inv_mul _ _).symm #align slope_fun_def_field slope_fun_def_field @[simp]
Mathlib/LinearAlgebra/AffineSpace/Slope.lean
47
48
theorem slope_same (f : k → PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
0.84375
import Mathlib.Logic.Relation import Mathlib.Data.List.Forall2 import Mathlib.Data.List.Lex import Mathlib.Data.List.Infix #align_import data.list.chain from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734" -- Make sure we haven't imported `Data.Nat.Order.Basic` assert_not_exists OrderedSub universe u v open Nat namespace List variable {α : Type u} {β : Type v} {R r : α → α → Prop} {l l₁ l₂ : List α} {a b : α} mk_iff_of_inductive_prop List.Chain List.chain_iff #align list.chain_iff List.chain_iff #align list.chain.nil List.Chain.nil #align list.chain.cons List.Chain.cons #align list.rel_of_chain_cons List.rel_of_chain_cons #align list.chain_of_chain_cons List.chain_of_chain_cons #align list.chain.imp' List.Chain.imp' #align list.chain.imp List.Chain.imp theorem Chain.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {a : α} {l : List α} : Chain R a l ↔ Chain S a l := ⟨Chain.imp fun a b => (H a b).1, Chain.imp fun a b => (H a b).2⟩ #align list.chain.iff List.Chain.iff theorem Chain.iff_mem {a : α} {l : List α} : Chain R a l ↔ Chain (fun x y => x ∈ a :: l ∧ y ∈ l ∧ R x y) a l := ⟨fun p => by induction' p with _ a b l r _ IH <;> constructor <;> [exact ⟨mem_cons_self _ _, mem_cons_self _ _, r⟩; exact IH.imp fun a b ⟨am, bm, h⟩ => ⟨mem_cons_of_mem _ am, mem_cons_of_mem _ bm, h⟩], Chain.imp fun a b h => h.2.2⟩ #align list.chain.iff_mem List.Chain.iff_mem theorem chain_singleton {a b : α} : Chain R a [b] ↔ R a b := by simp only [chain_cons, Chain.nil, and_true_iff] #align list.chain_singleton List.chain_singleton theorem chain_split {a b : α} {l₁ l₂ : List α} : Chain R a (l₁ ++ b :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ Chain R b l₂ := by induction' l₁ with x l₁ IH generalizing a <;> simp only [*, nil_append, cons_append, Chain.nil, chain_cons, and_true_iff, and_assoc] #align list.chain_split List.chain_split @[simp]
Mathlib/Data/List/Chain.lean
69
71
theorem chain_append_cons_cons {a b c : α} {l₁ l₂ : List α} : Chain R a (l₁ ++ b :: c :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ R b c ∧ Chain R c l₂ := by
rw [chain_split, chain_cons]
0.84375
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 Mul variable {𝕜' 𝔸 : Type*} [NormedField 𝕜'] [NormedRing 𝔸] [NormedAlgebra 𝕜 𝕜'] [NormedAlgebra 𝕜 𝔸] {c d : 𝕜 → 𝔸} {c' d' : 𝔸} {u v : 𝕜 → 𝕜'} theorem HasDerivWithinAt.mul (hc : HasDerivWithinAt c c' s x) (hd : HasDerivWithinAt d d' s x) : HasDerivWithinAt (fun y => c y * d y) (c' * d x + c x * d') s x := by have := (HasFDerivWithinAt.mul' hc hd).hasDerivWithinAt rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul, add_comm] at this #align has_deriv_within_at.mul HasDerivWithinAt.mul theorem HasDerivAt.mul (hc : HasDerivAt c c' x) (hd : HasDerivAt d d' x) : HasDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by rw [← hasDerivWithinAt_univ] at * exact hc.mul hd #align has_deriv_at.mul HasDerivAt.mul theorem HasStrictDerivAt.mul (hc : HasStrictDerivAt c c' x) (hd : HasStrictDerivAt d d' x) : HasStrictDerivAt (fun y => c y * d y) (c' * d x + c x * d') x := by have := (HasStrictFDerivAt.mul' hc hd).hasStrictDerivAt rwa [ContinuousLinearMap.add_apply, ContinuousLinearMap.smul_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply, one_smul, one_smul, add_comm] at this #align has_strict_deriv_at.mul HasStrictDerivAt.mul theorem derivWithin_mul (hxs : UniqueDiffWithinAt 𝕜 s x) (hc : DifferentiableWithinAt 𝕜 c s x) (hd : DifferentiableWithinAt 𝕜 d s x) : derivWithin (fun y => c y * d y) s x = derivWithin c s x * d x + c x * derivWithin d s x := (hc.hasDerivWithinAt.mul hd.hasDerivWithinAt).derivWithin hxs #align deriv_within_mul derivWithin_mul @[simp] theorem deriv_mul (hc : DifferentiableAt 𝕜 c x) (hd : DifferentiableAt 𝕜 d x) : deriv (fun y => c y * d y) x = deriv c x * d x + c x * deriv d x := (hc.hasDerivAt.mul hd.hasDerivAt).deriv #align deriv_mul deriv_mul theorem HasDerivWithinAt.mul_const (hc : HasDerivWithinAt c c' s x) (d : 𝔸) : HasDerivWithinAt (fun y => c y * d) (c' * d) s x := by convert hc.mul (hasDerivWithinAt_const x s d) using 1 rw [mul_zero, add_zero] #align has_deriv_within_at.mul_const HasDerivWithinAt.mul_const theorem HasDerivAt.mul_const (hc : HasDerivAt c c' x) (d : 𝔸) : HasDerivAt (fun y => c y * d) (c' * d) x := by rw [← hasDerivWithinAt_univ] at * exact hc.mul_const d #align has_deriv_at.mul_const HasDerivAt.mul_const
Mathlib/Analysis/Calculus/Deriv/Mul.lean
254
255
theorem hasDerivAt_mul_const (c : 𝕜) : HasDerivAt (fun x => x * c) c x := by
simpa only [one_mul] using (hasDerivAt_id' x).mul_const c
0.84375
import Mathlib.Data.Set.Image import Mathlib.Data.SProd #align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" open Function namespace Set section Prod variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β} theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) : (s ×ˢ t).Subsingleton := fun _x hx _y hy ↦ Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2) noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] : DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable #align set.decidable_mem_prod Set.decidableMemProd @[gcongr] theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ := fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩ #align set.prod_mono Set.prod_mono @[gcongr] theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t := prod_mono hs Subset.rfl #align set.prod_mono_left Set.prod_mono_left @[gcongr] theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ := prod_mono Subset.rfl ht #align set.prod_mono_right Set.prod_mono_right @[simp] theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ := ⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩ #align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self @[simp] theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ := and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self #align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P := ⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩ #align set.prod_subset_iff Set.prod_subset_iff theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) := prod_subset_iff #align set.forall_prod_set Set.forall_prod_set theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by simp [and_assoc] #align set.exists_prod_set Set.exists_prod_set @[simp] theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by ext exact and_false_iff _ #align set.prod_empty Set.prod_empty @[simp]
Mathlib/Data/Set/Prod.lean
90
92
theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by
ext exact false_and_iff _
0.84375
import Mathlib.Algebra.GroupWithZero.Indicator import Mathlib.Topology.ContinuousOn import Mathlib.Topology.Instances.ENNReal #align_import topology.semicontinuous from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology ENNReal open Set Function Filter variable {α : Type*} [TopologicalSpace α] {β : Type*} [Preorder β] {f g : α → β} {x : α} {s t : Set α} {y z : β} def LowerSemicontinuousWithinAt (f : α → β) (s : Set α) (x : α) := ∀ y < f x, ∀ᶠ x' in 𝓝[s] x, y < f x' #align lower_semicontinuous_within_at LowerSemicontinuousWithinAt def LowerSemicontinuousOn (f : α → β) (s : Set α) := ∀ x ∈ s, LowerSemicontinuousWithinAt f s x #align lower_semicontinuous_on LowerSemicontinuousOn def LowerSemicontinuousAt (f : α → β) (x : α) := ∀ y < f x, ∀ᶠ x' in 𝓝 x, y < f x' #align lower_semicontinuous_at LowerSemicontinuousAt def LowerSemicontinuous (f : α → β) := ∀ x, LowerSemicontinuousAt f x #align lower_semicontinuous LowerSemicontinuous def UpperSemicontinuousWithinAt (f : α → β) (s : Set α) (x : α) := ∀ y, f x < y → ∀ᶠ x' in 𝓝[s] x, f x' < y #align upper_semicontinuous_within_at UpperSemicontinuousWithinAt def UpperSemicontinuousOn (f : α → β) (s : Set α) := ∀ x ∈ s, UpperSemicontinuousWithinAt f s x #align upper_semicontinuous_on UpperSemicontinuousOn def UpperSemicontinuousAt (f : α → β) (x : α) := ∀ y, f x < y → ∀ᶠ x' in 𝓝 x, f x' < y #align upper_semicontinuous_at UpperSemicontinuousAt def UpperSemicontinuous (f : α → β) := ∀ x, UpperSemicontinuousAt f x #align upper_semicontinuous UpperSemicontinuous theorem LowerSemicontinuousWithinAt.mono (h : LowerSemicontinuousWithinAt f s x) (hst : t ⊆ s) : LowerSemicontinuousWithinAt f t x := fun y hy => Filter.Eventually.filter_mono (nhdsWithin_mono _ hst) (h y hy) #align lower_semicontinuous_within_at.mono LowerSemicontinuousWithinAt.mono theorem lowerSemicontinuousWithinAt_univ_iff : LowerSemicontinuousWithinAt f univ x ↔ LowerSemicontinuousAt f x := by simp [LowerSemicontinuousWithinAt, LowerSemicontinuousAt, nhdsWithin_univ] #align lower_semicontinuous_within_at_univ_iff lowerSemicontinuousWithinAt_univ_iff theorem LowerSemicontinuousAt.lowerSemicontinuousWithinAt (s : Set α) (h : LowerSemicontinuousAt f x) : LowerSemicontinuousWithinAt f s x := fun y hy => Filter.Eventually.filter_mono nhdsWithin_le_nhds (h y hy) #align lower_semicontinuous_at.lower_semicontinuous_within_at LowerSemicontinuousAt.lowerSemicontinuousWithinAt theorem LowerSemicontinuousOn.lowerSemicontinuousWithinAt (h : LowerSemicontinuousOn f s) (hx : x ∈ s) : LowerSemicontinuousWithinAt f s x := h x hx #align lower_semicontinuous_on.lower_semicontinuous_within_at LowerSemicontinuousOn.lowerSemicontinuousWithinAt theorem LowerSemicontinuousOn.mono (h : LowerSemicontinuousOn f s) (hst : t ⊆ s) : LowerSemicontinuousOn f t := fun x hx => (h x (hst hx)).mono hst #align lower_semicontinuous_on.mono LowerSemicontinuousOn.mono
Mathlib/Topology/Semicontinuous.lean
169
170
theorem lowerSemicontinuousOn_univ_iff : LowerSemicontinuousOn f univ ↔ LowerSemicontinuous f := by
simp [LowerSemicontinuousOn, LowerSemicontinuous, lowerSemicontinuousWithinAt_univ_iff]
0.84375
import Mathlib.Algebra.Group.Even import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Algebra.Order.Sub.Defs #align_import algebra.order.sub.canonical from "leanprover-community/mathlib"@"62a5626868683c104774de8d85b9855234ac807c" variable {α : Type*} section ExistsAddOfLE variable [AddCommSemigroup α] [PartialOrder α] [ExistsAddOfLE α] [CovariantClass α α (· + ·) (· ≤ ·)] [Sub α] [OrderedSub α] {a b c d : α} @[simp] theorem add_tsub_cancel_of_le (h : a ≤ b) : a + (b - a) = b := by refine le_antisymm ?_ le_add_tsub obtain ⟨c, rfl⟩ := exists_add_of_le h exact add_le_add_left add_tsub_le_left a #align add_tsub_cancel_of_le add_tsub_cancel_of_le
Mathlib/Algebra/Order/Sub/Canonical.lean
31
33
theorem tsub_add_cancel_of_le (h : a ≤ b) : b - a + a = b := by
rw [add_comm] exact add_tsub_cancel_of_le h
0.84375
import Mathlib.RepresentationTheory.Action.Limits import Mathlib.RepresentationTheory.Action.Concrete import Mathlib.CategoryTheory.Monoidal.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Transport import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory import Mathlib.CategoryTheory.Monoidal.Linear import Mathlib.CategoryTheory.Monoidal.Braided.Basic import Mathlib.CategoryTheory.Monoidal.Types.Basic universe u v open CategoryTheory Limits variable {V : Type (u + 1)} [LargeCategory V] {G : MonCat.{u}} namespace Action section Monoidal open MonoidalCategory variable [MonoidalCategory V] instance instMonoidalCategory : MonoidalCategory (Action V G) := Monoidal.transport (Action.functorCategoryEquivalence _ _).symm @[simp] theorem tensorUnit_v : (𝟙_ (Action V G)).V = 𝟙_ V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_V Action.tensorUnit_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensorUnit_rho {g : G} : (𝟙_ (Action V G)).ρ g = 𝟙 (𝟙_ V) := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_unit_rho Action.tensorUnit_rho @[simp] theorem tensor_v {X Y : Action V G} : (X ⊗ Y).V = X.V ⊗ Y.V := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_V Action.tensor_v -- Porting note: removed @[simp] as the simpNF linter complains theorem tensor_rho {X Y : Action V G} {g : G} : (X ⊗ Y).ρ g = X.ρ g ⊗ Y.ρ g := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_rho Action.tensor_rho @[simp] theorem tensor_hom {W X Y Z : Action V G} (f : W ⟶ X) (g : Y ⟶ Z) : (f ⊗ g).hom = f.hom ⊗ g.hom := rfl set_option linter.uppercaseLean3 false in #align Action.tensor_hom Action.tensor_hom @[simp] theorem whiskerLeft_hom (X : Action V G) {Y Z : Action V G} (f : Y ⟶ Z) : (X ◁ f).hom = X.V ◁ f.hom := rfl @[simp] theorem whiskerRight_hom {X Y : Action V G} (f : X ⟶ Y) (Z : Action V G) : (f ▷ Z).hom = f.hom ▷ Z.V := rfl -- Porting note: removed @[simp] as the simpNF linter complains theorem associator_hom_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).hom = (α_ X.V Y.V Z.V).hom := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.associator_hom_hom Action.associator_hom_hom -- Porting note: removed @[simp] as the simpNF linter complains theorem associator_inv_hom {X Y Z : Action V G} : Hom.hom (α_ X Y Z).inv = (α_ X.V Y.V Z.V).inv := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.associator_inv_hom Action.associator_inv_hom -- Porting note: removed @[simp] as the simpNF linter complains theorem leftUnitor_hom_hom {X : Action V G} : Hom.hom (λ_ X).hom = (λ_ X.V).hom := by dsimp simp set_option linter.uppercaseLean3 false in #align Action.left_unitor_hom_hom Action.leftUnitor_hom_hom -- Porting note: removed @[simp] as the simpNF linter complains
Mathlib/RepresentationTheory/Action/Monoidal.lean
105
107
theorem leftUnitor_inv_hom {X : Action V G} : Hom.hom (λ_ X).inv = (λ_ X.V).inv := by
dsimp simp
0.84375
import Mathlib.Data.Set.Image import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" open Set variable {α : Type*} namespace WithTop @[simp] theorem preimage_coe_top : (some : α → WithTop α) ⁻¹' {⊤} = (∅ : Set α) := eq_empty_of_subset_empty fun _ => coe_ne_top #align with_top.preimage_coe_top WithTop.preimage_coe_top variable [Preorder α] {a b : α} theorem range_coe : range (some : α → WithTop α) = Iio ⊤ := by ext x rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists] #align with_top.range_coe WithTop.range_coe @[simp] theorem preimage_coe_Ioi : (some : α → WithTop α) ⁻¹' Ioi a = Ioi a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi @[simp] theorem preimage_coe_Ici : (some : α → WithTop α) ⁻¹' Ici a = Ici a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici @[simp] theorem preimage_coe_Iio : (some : α → WithTop α) ⁻¹' Iio a = Iio a := ext fun _ => coe_lt_coe #align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio @[simp] theorem preimage_coe_Iic : (some : α → WithTop α) ⁻¹' Iic a = Iic a := ext fun _ => coe_le_coe #align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic @[simp] theorem preimage_coe_Icc : (some : α → WithTop α) ⁻¹' Icc a b = Icc a b := by simp [← Ici_inter_Iic] #align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc @[simp]
Mathlib/Order/Interval/Set/WithBotTop.lean
63
63
theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by
simp [← Ici_inter_Iio]
0.84375
import Mathlib.Algebra.Divisibility.Basic import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Ring.Defs #align_import algebra.euclidean_domain.defs from "leanprover-community/mathlib"@"ee7b9f9a9ac2a8d9f04ea39bbfe6b1a3be053b38" universe u class EuclideanDomain (R : Type u) extends CommRing R, Nontrivial R where protected quotient : R → R → R protected quotient_zero : ∀ a, quotient a 0 = 0 protected remainder : R → R → R protected quotient_mul_add_remainder_eq : ∀ a b, b * quotient a b + remainder a b = a protected r : R → R → Prop r_wellFounded : WellFounded r protected remainder_lt : ∀ (a) {b}, b ≠ 0 → r (remainder a b) b mul_left_not_lt : ∀ (a) {b}, b ≠ 0 → ¬r (a * b) a #align euclidean_domain EuclideanDomain #align euclidean_domain.quotient EuclideanDomain.quotient #align euclidean_domain.quotient_zero EuclideanDomain.quotient_zero #align euclidean_domain.remainder EuclideanDomain.remainder #align euclidean_domain.quotient_mul_add_remainder_eq EuclideanDomain.quotient_mul_add_remainder_eq #align euclidean_domain.r EuclideanDomain.r #align euclidean_domain.r_well_founded EuclideanDomain.r_wellFounded #align euclidean_domain.remainder_lt EuclideanDomain.remainder_lt #align euclidean_domain.mul_left_not_lt EuclideanDomain.mul_left_not_lt namespace EuclideanDomain variable {R : Type u} [EuclideanDomain R] local infixl:50 " ≺ " => EuclideanDomain.r local instance wellFoundedRelation : WellFoundedRelation R where wf := r_wellFounded -- see Note [lower instance priority] instance (priority := 70) : Div R := ⟨EuclideanDomain.quotient⟩ -- see Note [lower instance priority] instance (priority := 70) : Mod R := ⟨EuclideanDomain.remainder⟩ theorem div_add_mod (a b : R) : b * (a / b) + a % b = a := EuclideanDomain.quotient_mul_add_remainder_eq _ _ #align euclidean_domain.div_add_mod EuclideanDomain.div_add_mod theorem mod_add_div (a b : R) : a % b + b * (a / b) = a := (add_comm _ _).trans (div_add_mod _ _) #align euclidean_domain.mod_add_div EuclideanDomain.mod_add_div theorem mod_add_div' (m k : R) : m % k + m / k * k = m := by rw [mul_comm] exact mod_add_div _ _ #align euclidean_domain.mod_add_div' EuclideanDomain.mod_add_div' theorem div_add_mod' (m k : R) : m / k * k + m % k = m := by rw [mul_comm] exact div_add_mod _ _ #align euclidean_domain.div_add_mod' EuclideanDomain.div_add_mod' theorem mod_eq_sub_mul_div {R : Type*} [EuclideanDomain R] (a b : R) : a % b = a - b * (a / b) := calc a % b = b * (a / b) + a % b - b * (a / b) := (add_sub_cancel_left _ _).symm _ = a - b * (a / b) := by rw [div_add_mod] #align euclidean_domain.mod_eq_sub_mul_div EuclideanDomain.mod_eq_sub_mul_div theorem mod_lt : ∀ (a) {b : R}, b ≠ 0 → a % b ≺ b := EuclideanDomain.remainder_lt #align euclidean_domain.mod_lt EuclideanDomain.mod_lt theorem mul_right_not_lt {a : R} (b) (h : a ≠ 0) : ¬a * b ≺ b := by rw [mul_comm] exact mul_left_not_lt b h #align euclidean_domain.mul_right_not_lt EuclideanDomain.mul_right_not_lt @[simp]
Mathlib/Algebra/EuclideanDomain/Defs.lean
157
157
theorem mod_zero (a : R) : a % 0 = a := by
simpa only [zero_mul, zero_add] using div_add_mod a 0
0.84375
import Mathlib.Data.List.Basic #align_import data.list.join from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" -- Make sure we don't import algebra assert_not_exists Monoid variable {α β : Type*} namespace List attribute [simp] join -- Porting note (#10618): simp can prove this -- @[simp] theorem join_singleton (l : List α) : [l].join = l := by rw [join, join, append_nil] #align list.join_singleton List.join_singleton @[simp] theorem join_eq_nil : ∀ {L : List (List α)}, join L = [] ↔ ∀ l ∈ L, l = [] | [] => iff_of_true rfl (forall_mem_nil _) | l :: L => by simp only [join, append_eq_nil, join_eq_nil, forall_mem_cons] #align list.join_eq_nil List.join_eq_nil @[simp] theorem join_append (L₁ L₂ : List (List α)) : join (L₁ ++ L₂) = join L₁ ++ join L₂ := by induction L₁ · rfl · simp [*] #align list.join_append List.join_append theorem join_concat (L : List (List α)) (l : List α) : join (L.concat l) = join L ++ l := by simp #align list.join_concat List.join_concat @[simp] theorem join_filter_not_isEmpty : ∀ {L : List (List α)}, join (L.filter fun l => !l.isEmpty) = L.join | [] => rfl | [] :: L => by simp [join_filter_not_isEmpty (L := L), isEmpty_iff_eq_nil] | (a :: l) :: L => by simp [join_filter_not_isEmpty (L := L)] #align list.join_filter_empty_eq_ff List.join_filter_not_isEmpty @[deprecated (since := "2024-02-25")] alias join_filter_isEmpty_eq_false := join_filter_not_isEmpty @[simp] theorem join_filter_ne_nil [DecidablePred fun l : List α => l ≠ []] {L : List (List α)} : join (L.filter fun l => l ≠ []) = L.join := by simp [join_filter_not_isEmpty, ← isEmpty_iff_eq_nil] #align list.join_filter_ne_nil List.join_filter_ne_nil
Mathlib/Data/List/Join.lean
65
66
theorem join_join (l : List (List (List α))) : l.join.join = (l.map join).join := by
induction l <;> simp [*]
0.84375
import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks import Mathlib.CategoryTheory.Extensive import Mathlib.CategoryTheory.Limits.Preserves.Finite namespace CompHaus attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike universe u w open CategoryTheory Limits section Pullbacks variable {X Y B : CompHaus.{u}} (f : X ⟶ B) (g : Y ⟶ B) def pullback : CompHaus.{u} := letI set := { xy : X × Y | f xy.fst = g xy.snd } haveI : CompactSpace set := isCompact_iff_compactSpace.mp (isClosed_eq (f.continuous.comp continuous_fst) (g.continuous.comp continuous_snd)).isCompact CompHaus.of set def pullback.fst : pullback f g ⟶ X where toFun := fun ⟨⟨x,_⟩,_⟩ => x continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val def pullback.snd : pullback f g ⟶ Y where toFun := fun ⟨⟨_,y⟩,_⟩ => y continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val @[reassoc] lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by ext ⟨_,h⟩; exact h def pullback.lift {Z : CompHaus.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : Z ⟶ pullback f g where toFun := fun z => ⟨⟨a z, b z⟩, by apply_fun (fun q => q z) at w; exact w⟩ continuous_toFun := by apply Continuous.subtype_mk rw [continuous_prod_mk] exact ⟨a.continuous, b.continuous⟩ @[reassoc (attr := simp)] lemma pullback.lift_fst {Z : CompHaus.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.fst f g = a := rfl @[reassoc (attr := simp)] lemma pullback.lift_snd {Z : CompHaus.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.snd f g = b := rfl lemma pullback.hom_ext {Z : CompHaus.{u}} (a b : Z ⟶ pullback f g) (hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g) (hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by ext z apply_fun (fun q => q z) at hfst hsnd apply Subtype.ext apply Prod.ext · exact hfst · exact hsnd @[simps! pt π] def pullback.cone : Limits.PullbackCone f g := Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g) @[simps! lift] def pullback.isLimit : Limits.IsLimit (pullback.cone f g) := Limits.PullbackCone.isLimitAux _ (fun s => pullback.lift f g s.fst s.snd s.condition) (fun _ => pullback.lift_fst _ _ _ _ _) (fun _ => pullback.lift_snd _ _ _ _ _) (fun _ _ hm => pullback.hom_ext _ _ _ _ (hm .left) (hm .right)) section Isos noncomputable def pullbackIsoPullback : CompHaus.pullback f g ≅ Limits.pullback f g := Limits.IsLimit.conePointUniqueUpToIso (pullback.isLimit f g) (Limits.limit.isLimit _) noncomputable def pullbackHomeoPullback : (CompHaus.pullback f g).toTop ≃ₜ (Limits.pullback f g).toTop := CompHaus.homeoOfIso (pullbackIsoPullback f g) theorem pullback_fst_eq : CompHaus.pullback.fst f g = (pullbackIsoPullback f g).hom ≫ Limits.pullback.fst := by dsimp [pullbackIsoPullback] simp only [Limits.limit.conePointUniqueUpToIso_hom_comp, pullback.cone_pt, pullback.cone_π]
Mathlib/Topology/Category/CompHaus/Limits.lean
136
139
theorem pullback_snd_eq : CompHaus.pullback.snd f g = (pullbackIsoPullback f g).hom ≫ Limits.pullback.snd := by
dsimp [pullbackIsoPullback] simp only [Limits.limit.conePointUniqueUpToIso_hom_comp, pullback.cone_pt, pullback.cone_π]
0.84375
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
Mathlib/Topology/UniformSpace/UniformEmbedding.lean
110
114
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]
0.84375
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Data.Fintype.Basic import Mathlib.Data.Int.GCD import Mathlib.RingTheory.Coprime.Basic #align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" universe u v section IsCoprime variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I} section theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by constructor · rintro ⟨a, b, h⟩ have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm] exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩) · rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one] intro h exact ⟨_, _, h⟩ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by rw [Int.isCoprime_iff_gcd_eq_one, Int.gcd_natCast_natCast] #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime #align is_coprime.nat_coprime IsCoprime.nat_coprime #align nat.coprime.is_coprime Nat.Coprime.isCoprime theorem Nat.Coprime.cast {R : Type*} [CommRing R] {a b : ℕ} (h : Nat.Coprime a b) : IsCoprime (a : R) (b : R) := by rw [← isCoprime_iff_coprime] at h rw [← Int.cast_natCast a, ← Int.cast_natCast b] exact IsCoprime.intCast h theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ} (h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 := IsCoprime.ne_zero_or_ne_zero (R := A) <| by simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
Mathlib/RingTheory/Coprime/Lemmas.lean
61
66
theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i ∈ t, s i) x := by
classical refine Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ ?_ rw [Finset.prod_insert hbt] rw [Finset.forall_mem_insert] at H exact H.1.mul_left (ih H.2)
0.84375
import Mathlib.Data.Int.Bitwise import Mathlib.Data.Int.Order.Lemmas import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.int.lemmas from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f" open Nat namespace Int theorem le_natCast_sub (m n : ℕ) : (m - n : ℤ) ≤ ↑(m - n : ℕ) := by by_cases h : m ≥ n · exact le_of_eq (Int.ofNat_sub h).symm · simp [le_of_not_ge h, ofNat_le] #align int.le_coe_nat_sub Int.le_natCast_sub -- Porting note (#10618): simp can prove this @[simp] theorem succ_natCast_pos (n : ℕ) : 0 < (n : ℤ) + 1 := lt_add_one_iff.mpr (by simp) #align int.succ_coe_nat_pos Int.succ_natCast_pos variable {a b : ℤ} {n : ℕ} theorem natAbs_eq_iff_sq_eq {a b : ℤ} : a.natAbs = b.natAbs ↔ a ^ 2 = b ^ 2 := by rw [sq, sq] exact natAbs_eq_iff_mul_self_eq #align int.nat_abs_eq_iff_sq_eq Int.natAbs_eq_iff_sq_eq theorem natAbs_lt_iff_sq_lt {a b : ℤ} : a.natAbs < b.natAbs ↔ a ^ 2 < b ^ 2 := by rw [sq, sq] exact natAbs_lt_iff_mul_self_lt #align int.nat_abs_lt_iff_sq_lt Int.natAbs_lt_iff_sq_lt theorem natAbs_le_iff_sq_le {a b : ℤ} : a.natAbs ≤ b.natAbs ↔ a ^ 2 ≤ b ^ 2 := by rw [sq, sq] exact natAbs_le_iff_mul_self_le #align int.nat_abs_le_iff_sq_le Int.natAbs_le_iff_sq_le theorem natAbs_inj_of_nonneg_of_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) : natAbs a = natAbs b ↔ a = b := by rw [← sq_eq_sq ha hb, ← natAbs_eq_iff_sq_eq] #align int.nat_abs_inj_of_nonneg_of_nonneg Int.natAbs_inj_of_nonneg_of_nonneg theorem natAbs_inj_of_nonpos_of_nonpos {a b : ℤ} (ha : a ≤ 0) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = b := by simpa only [Int.natAbs_neg, neg_inj] using natAbs_inj_of_nonneg_of_nonneg (neg_nonneg_of_nonpos ha) (neg_nonneg_of_nonpos hb) #align int.nat_abs_inj_of_nonpos_of_nonpos Int.natAbs_inj_of_nonpos_of_nonpos
Mathlib/Data/Int/Lemmas.lean
70
72
theorem natAbs_inj_of_nonneg_of_nonpos {a b : ℤ} (ha : 0 ≤ a) (hb : b ≤ 0) : natAbs a = natAbs b ↔ a = -b := by
simpa only [Int.natAbs_neg] using natAbs_inj_of_nonneg_of_nonneg ha (neg_nonneg_of_nonpos hb)
0.84375
import Mathlib.Logic.Function.Basic import Mathlib.Tactic.MkIffOfInductiveProp #align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" universe u v w x variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*} namespace Sum #align sum.forall Sum.forall #align sum.exists Sum.exists theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) : (∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by rw [← not_forall_not, forall_sum] simp theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj #align sum.inl_injective Sum.inl_injective theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj #align sum.inr_injective Sum.inr_injective theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i)) {x y : α ⊕ β} (h : x = y) : @Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl section get #align sum.is_left Sum.isLeft #align sum.is_right Sum.isRight #align sum.get_left Sum.getLeft? #align sum.get_right Sum.getRight? variable {x y : Sum α β} #align sum.get_left_eq_none_iff Sum.getLeft?_eq_none_iff #align sum.get_right_eq_none_iff Sum.getRight?_eq_none_iff theorem eq_left_iff_getLeft_eq {a : α} : x = inl a ↔ ∃ h, x.getLeft h = a := by cases x <;> simp
Mathlib/Data/Sum/Basic.lean
57
58
theorem eq_right_iff_getRight_eq {b : β} : x = inr b ↔ ∃ h, x.getRight h = b := by
cases x <;> simp
0.84375
import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Tactic.Positivity.Core import Mathlib.Algebra.Ring.NegOnePow #align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section open scoped Classical open Topology Filter Set namespace Complex @[continuity, fun_prop] theorem continuous_sin : Continuous sin := by change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2 continuity #align complex.continuous_sin Complex.continuous_sin @[fun_prop] theorem continuousOn_sin {s : Set ℂ} : ContinuousOn sin s := continuous_sin.continuousOn #align complex.continuous_on_sin Complex.continuousOn_sin @[continuity, fun_prop] theorem continuous_cos : Continuous cos := by change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2 continuity #align complex.continuous_cos Complex.continuous_cos @[fun_prop] theorem continuousOn_cos {s : Set ℂ} : ContinuousOn cos s := continuous_cos.continuousOn #align complex.continuous_on_cos Complex.continuousOn_cos @[continuity, fun_prop] theorem continuous_sinh : Continuous sinh := by change Continuous fun z => (exp z - exp (-z)) / 2 continuity #align complex.continuous_sinh Complex.continuous_sinh @[continuity, fun_prop]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean
82
84
theorem continuous_cosh : Continuous cosh := by
change Continuous fun z => (exp z + exp (-z)) / 2 continuity
0.84375
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]
Mathlib/Analysis/Calculus/ContDiff/Basic.lean
62
70
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
0.84375
import Mathlib.Init.Data.Ordering.Basic import Mathlib.Order.Synonym #align_import order.compare from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" variable {α β : Type*} def cmpLE {α} [LE α] [@DecidableRel α (· ≤ ·)] (x y : α) : Ordering := if x ≤ y then if y ≤ x then Ordering.eq else Ordering.lt else Ordering.gt #align cmp_le cmpLE theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) : (cmpLE x y).swap = cmpLE y x := by by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, *, Ordering.swap] cases not_or_of_not xy yx (total_of _ _ _) #align cmp_le_swap cmpLE_swap
Mathlib/Order/Compare.lean
40
43
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing] cases not_or_of_not xy yx (total_of _ _ _)
0.84375
import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.Polynomial.Basic import Mathlib.Algebra.Regular.Basic import Mathlib.Data.Nat.Choose.Sum #align_import data.polynomial.coeff from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c" set_option linter.uppercaseLean3 false noncomputable section open Finsupp Finset AddMonoidAlgebra open Polynomial namespace Polynomial universe u v variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ} variable [Semiring R] {p q r : R[X]} section Coeff @[simp] theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n := by rcases p with ⟨⟩ rcases q with ⟨⟩ simp_rw [← ofFinsupp_add, coeff] exact Finsupp.add_apply _ _ _ #align polynomial.coeff_add Polynomial.coeff_add set_option linter.deprecated false in @[simp] theorem coeff_bit0 (p : R[X]) (n : ℕ) : coeff (bit0 p) n = bit0 (coeff p n) := by simp [bit0] #align polynomial.coeff_bit0 Polynomial.coeff_bit0 @[simp] theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) : coeff (r • p) n = r • coeff p n := by rcases p with ⟨⟩ simp_rw [← ofFinsupp_smul, coeff] exact Finsupp.smul_apply _ _ _ #align polynomial.coeff_smul Polynomial.coeff_smul theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) : support (r • p) ⊆ support p := by intro i hi simp? [mem_support_iff] at hi ⊢ says simp only [mem_support_iff, coeff_smul, ne_eq] at hi ⊢ contrapose! hi simp [hi] #align polynomial.support_smul Polynomial.support_smul open scoped Pointwise in theorem card_support_mul_le : (p * q).support.card ≤ p.support.card * q.support.card := by calc (p * q).support.card _ = (p.toFinsupp * q.toFinsupp).support.card := by rw [← support_toFinsupp, toFinsupp_mul] _ ≤ (p.toFinsupp.support + q.toFinsupp.support).card := Finset.card_le_card (AddMonoidAlgebra.support_mul p.toFinsupp q.toFinsupp) _ ≤ p.support.card * q.support.card := Finset.card_image₂_le .. @[simps] def lsum {R A M : Type*} [Semiring R] [Semiring A] [AddCommMonoid M] [Module R A] [Module R M] (f : ℕ → A →ₗ[R] M) : A[X] →ₗ[R] M where toFun p := p.sum (f · ·) map_add' p q := sum_add_index p q _ (fun n => (f n).map_zero) fun n _ _ => (f n).map_add _ _ map_smul' c p := by -- Porting note: added `dsimp only`; `beta_reduce` alone is not sufficient dsimp only rw [sum_eq_of_subset (f · ·) (fun n => (f n).map_zero) (support_smul c p)] simp only [sum_def, Finset.smul_sum, coeff_smul, LinearMap.map_smul, RingHom.id_apply] #align polynomial.lsum Polynomial.lsum #align polynomial.lsum_apply Polynomial.lsum_apply variable (R) def lcoeff (n : ℕ) : R[X] →ₗ[R] R where toFun p := coeff p n map_add' p q := coeff_add p q n map_smul' r p := coeff_smul r p n #align polynomial.lcoeff Polynomial.lcoeff variable {R} @[simp] theorem lcoeff_apply (n : ℕ) (f : R[X]) : lcoeff R n f = coeff f n := rfl #align polynomial.lcoeff_apply Polynomial.lcoeff_apply @[simp] theorem finset_sum_coeff {ι : Type*} (s : Finset ι) (f : ι → R[X]) (n : ℕ) : coeff (∑ b ∈ s, f b) n = ∑ b ∈ s, coeff (f b) n := map_sum (lcoeff R n) _ _ #align polynomial.finset_sum_coeff Polynomial.finset_sum_coeff lemma coeff_list_sum (l : List R[X]) (n : ℕ) : l.sum.coeff n = (l.map (lcoeff R n)).sum := map_list_sum (lcoeff R n) _ lemma coeff_list_sum_map {ι : Type*} (l : List ι) (f : ι → R[X]) (n : ℕ) : (l.map f).sum.coeff n = (l.map (fun a => (f a).coeff n)).sum := by simp_rw [coeff_list_sum, List.map_map, Function.comp, lcoeff_apply] theorem coeff_sum [Semiring S] (n : ℕ) (f : ℕ → R → S[X]) : coeff (p.sum f) n = p.sum fun a b => coeff (f a b) n := by rcases p with ⟨⟩ -- porting note (#10745): was `simp [Polynomial.sum, support, coeff]`. simp [Polynomial.sum, support_ofFinsupp, coeff_ofFinsupp] #align polynomial.coeff_sum Polynomial.coeff_sum theorem coeff_mul (p q : R[X]) (n : ℕ) : coeff (p * q) n = ∑ x ∈ antidiagonal n, coeff p x.1 * coeff q x.2 := by rcases p with ⟨p⟩; rcases q with ⟨q⟩ simp_rw [← ofFinsupp_mul, coeff] exact AddMonoidAlgebra.mul_apply_antidiagonal p q n _ Finset.mem_antidiagonal #align polynomial.coeff_mul Polynomial.coeff_mul @[simp]
Mathlib/Algebra/Polynomial/Coeff.lean
138
138
theorem mul_coeff_zero (p q : R[X]) : coeff (p * q) 0 = coeff p 0 * coeff q 0 := by
simp [coeff_mul]
0.84375
import Mathlib.Order.Interval.Multiset #align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" -- TODO -- assert_not_exists Ring open Finset Nat variable (a b c : ℕ) namespace Nat instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ where finsetIcc a b := ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ finsetIco a b := ⟨List.range' a (b - a), List.nodup_range' _ _⟩ finsetIoc a b := ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ finsetIoo a b := ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega theorem Icc_eq_range' : Icc a b = ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ := rfl #align nat.Icc_eq_range' Nat.Icc_eq_range' theorem Ico_eq_range' : Ico a b = ⟨List.range' a (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ico_eq_range' Nat.Ico_eq_range' theorem Ioc_eq_range' : Ioc a b = ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ := rfl #align nat.Ioc_eq_range' Nat.Ioc_eq_range' theorem Ioo_eq_range' : Ioo a b = ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ := rfl #align nat.Ioo_eq_range' Nat.Ioo_eq_range' theorem uIcc_eq_range' : uIcc a b = ⟨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _⟩ := rfl #align nat.uIcc_eq_range' Nat.uIcc_eq_range' theorem Iio_eq_range : Iio = range := by ext b x rw [mem_Iio, mem_range] #align nat.Iio_eq_range Nat.Iio_eq_range @[simp] theorem Ico_zero_eq_range : Ico 0 = range := by rw [← Nat.bot_eq_zero, ← Iio_eq_Ico, Iio_eq_range] #align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range lemma range_eq_Icc_zero_sub_one (n : ℕ) (hn : n ≠ 0): range n = Icc 0 (n - 1) := by ext b simp_all only [mem_Icc, zero_le, true_and, mem_range] exact lt_iff_le_pred (zero_lt_of_ne_zero hn) theorem _root_.Finset.range_eq_Ico : range = Ico 0 := Ico_zero_eq_range.symm #align finset.range_eq_Ico Finset.range_eq_Ico @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := List.length_range' _ _ _ #align nat.card_Icc Nat.card_Icc @[simp] theorem card_Ico : (Ico a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ico Nat.card_Ico @[simp] theorem card_Ioc : (Ioc a b).card = b - a := List.length_range' _ _ _ #align nat.card_Ioc Nat.card_Ioc @[simp] theorem card_Ioo : (Ioo a b).card = b - a - 1 := List.length_range' _ _ _ #align nat.card_Ioo Nat.card_Ioo @[simp] theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := (card_Icc _ _).trans $ by rw [← Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega #align nat.card_uIcc Nat.card_uIcc @[simp] lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iic Nat.card_Iic @[simp] theorem card_Iio : (Iio b).card = b := by rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero] #align nat.card_Iio Nat.card_Iio -- Porting note (#10618): simp can prove this -- @[simp]
Mathlib/Order/Interval/Finset/Nat.lean
114
115
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [Fintype.card_ofFinset, card_Icc]
0.84375
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.GeomSum import Mathlib.LinearAlgebra.Matrix.Block import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Nondegenerate #align_import linear_algebra.vandermonde from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" variable {R : Type*} [CommRing R] open Equiv Finset open Matrix namespace Matrix def vandermonde {n : ℕ} (v : Fin n → R) : Matrix (Fin n) (Fin n) R := fun i j => v i ^ (j : ℕ) #align matrix.vandermonde Matrix.vandermonde @[simp] theorem vandermonde_apply {n : ℕ} (v : Fin n → R) (i j) : vandermonde v i j = v i ^ (j : ℕ) := rfl #align matrix.vandermonde_apply Matrix.vandermonde_apply @[simp] theorem vandermonde_cons {n : ℕ} (v0 : R) (v : Fin n → R) : vandermonde (Fin.cons v0 v : Fin n.succ → R) = Fin.cons (fun (j : Fin n.succ) => v0 ^ (j : ℕ)) fun i => Fin.cons 1 fun j => v i * vandermonde v i j := by ext i j refine Fin.cases (by simp) (fun i => ?_) i refine Fin.cases (by simp) (fun j => ?_) j simp [pow_succ'] #align matrix.vandermonde_cons Matrix.vandermonde_cons
Mathlib/LinearAlgebra/Vandermonde.lean
59
64
theorem vandermonde_succ {n : ℕ} (v : Fin n.succ → R) : vandermonde v = Fin.cons (fun (j : Fin n.succ) => v 0 ^ (j : ℕ)) fun i => Fin.cons 1 fun j => v i.succ * vandermonde (Fin.tail v) i j := by
conv_lhs => rw [← Fin.cons_self_tail v, vandermonde_cons] rfl
0.84375
import Mathlib.SetTheory.Game.Basic import Mathlib.SetTheory.Ordinal.NaturalOps #align_import set_theory.game.ordinal from "leanprover-community/mathlib"@"b90e72c7eebbe8de7c8293a80208ea2ba135c834" universe u open SetTheory PGame open scoped NaturalOps PGame namespace Ordinal noncomputable def toPGame : Ordinal.{u} → PGame.{u} | o => have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o ⟨o.out.α, PEmpty, fun x => have := Ordinal.typein_lt_self x (typein (· < ·) x).toPGame, PEmpty.elim⟩ termination_by x => x #align ordinal.to_pgame Ordinal.toPGame @[nolint unusedHavesSuffices] theorem toPGame_def (o : Ordinal) : have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o o.toPGame = ⟨o.out.α, PEmpty, fun x => (typein (· < ·) x).toPGame, PEmpty.elim⟩ := by rw [toPGame] #align ordinal.to_pgame_def Ordinal.toPGame_def @[simp, nolint unusedHavesSuffices]
Mathlib/SetTheory/Game/Ordinal.lean
53
54
theorem toPGame_leftMoves (o : Ordinal) : o.toPGame.LeftMoves = o.out.α := by
rw [toPGame, LeftMoves]
0.84375
import Mathlib.Topology.Algebra.InfiniteSum.Group import Mathlib.Topology.Algebra.Star noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section ProdDomain variable [CommMonoid α] [TopologicalSpace α] @[to_additive] theorem hasProd_pi_single [DecidableEq β] (b : β) (a : α) : HasProd (Pi.mulSingle b a) a := by convert hasProd_ite_eq b a simp [Pi.mulSingle_apply] #align has_sum_pi_single hasSum_pi_single @[to_additive (attr := simp)]
Mathlib/Topology/Algebra/InfiniteSum/Constructions.lean
39
42
theorem tprod_pi_single [DecidableEq β] (b : β) (a : α) : ∏' b', Pi.mulSingle b a b' = a := by
rw [tprod_eq_mulSingle b] · simp · intro b' hb'; simp [hb']
0.84375
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]
Mathlib/Analysis/BoxIntegral/Basic.lean
137
139
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]
0.84375
import Mathlib.Topology.Order.Basic open Set Filter OrderDual open scoped Topology section OrderClosedTopology variable {α : Type*} [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] {a b c d : α} @[simp] theorem nhdsSet_Ioi : 𝓝ˢ (Ioi a) = 𝓟 (Ioi a) := isOpen_Ioi.nhdsSet_eq @[simp] theorem nhdsSet_Iio : 𝓝ˢ (Iio a) = 𝓟 (Iio a) := isOpen_Iio.nhdsSet_eq @[simp] theorem nhdsSet_Ioo : 𝓝ˢ (Ioo a b) = 𝓟 (Ioo a b) := isOpen_Ioo.nhdsSet_eq theorem nhdsSet_Ici : 𝓝ˢ (Ici a) = 𝓝 a ⊔ 𝓟 (Ioi a) := by rw [← Ioi_insert, nhdsSet_insert, nhdsSet_Ioi] theorem nhdsSet_Iic : 𝓝ˢ (Iic a) = 𝓝 a ⊔ 𝓟 (Iio a) := nhdsSet_Ici (α := αᵒᵈ)
Mathlib/Topology/Order/NhdsSet.lean
41
42
theorem nhdsSet_Ico (h : a < b) : 𝓝ˢ (Ico a b) = 𝓝 a ⊔ 𝓟 (Ioo a b) := by
rw [← Ioo_insert_left h, nhdsSet_insert, nhdsSet_Ioo]
0.84375
import Mathlib.Data.Fintype.Option import Mathlib.Data.Fintype.Prod import Mathlib.Data.Fintype.Pi import Mathlib.Data.Vector.Basic import Mathlib.Data.PFun import Mathlib.Logic.Function.Iterate import Mathlib.Order.Basic import Mathlib.Tactic.ApplyFun #align_import computability.turing_machine from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" assert_not_exists MonoidWithZero open Relation open Nat (iterate) open Function (update iterate_succ iterate_succ_apply iterate_succ' iterate_succ_apply' iterate_zero_apply) namespace Turing def BlankExtends {Γ} [Inhabited Γ] (l₁ l₂ : List Γ) : Prop := ∃ n, l₂ = l₁ ++ List.replicate n default #align turing.blank_extends Turing.BlankExtends @[refl] theorem BlankExtends.refl {Γ} [Inhabited Γ] (l : List Γ) : BlankExtends l l := ⟨0, by simp⟩ #align turing.blank_extends.refl Turing.BlankExtends.refl @[trans]
Mathlib/Computability/TuringMachine.lean
85
88
theorem BlankExtends.trans {Γ} [Inhabited Γ] {l₁ l₂ l₃ : List Γ} : BlankExtends l₁ l₂ → BlankExtends l₂ l₃ → BlankExtends l₁ l₃ := by
rintro ⟨i, rfl⟩ ⟨j, rfl⟩ exact ⟨i + j, by simp [List.replicate_add]⟩
0.84375
import Mathlib.Topology.Algebra.InfiniteSum.Basic import Mathlib.Topology.Algebra.UniformGroup noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section TopologicalGroup variable [CommGroup α] [TopologicalSpace α] [TopologicalGroup α] variable {f g : β → α} {a a₁ a₂ : α} -- `by simpa using` speeds up elaboration. Why? @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Group.lean
30
31
theorem HasProd.inv (h : HasProd f a) : HasProd (fun b ↦ (f b)⁻¹) a⁻¹ := by
simpa only using h.map (MonoidHom.id α)⁻¹ continuous_inv
0.84375
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 · rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 · rw [hq, mul_zero, trailingDegree_zero, add_top] · rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : ℕ) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 · obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow
Mathlib/Algebra/Polynomial/RingDivision.lean
148
153
theorem degree_le_mul_left (p : R[X]) (hq : q ≠ 0) : degree p ≤ degree (p * q) := by
classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _)
0.84375
import Mathlib.Analysis.Convex.Side import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine #align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open FiniteDimensional Complex open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate namespace EuclideanGeometry variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] [NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)] abbrev o := @Module.Oriented.positiveOrientation def oangle (p₁ p₂ p₃ : P) : Real.Angle := o.oangle (p₁ -ᵥ p₂) (p₃ -ᵥ p₂) #align euclidean_geometry.oangle EuclideanGeometry.oangle @[inherit_doc] scoped notation "∡" => EuclideanGeometry.oangle
Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean
49
55
theorem continuousAt_oangle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) : ContinuousAt (fun y : P × P × P => ∡ y.1 y.2.1 y.2.2) x := by
let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1) have hf1 : (f x).1 ≠ 0 := by simp [hx12] have hf2 : (f x).2 ≠ 0 := by simp [hx32] exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk (continuous_snd.snd.vsub continuous_snd.fst)).continuousAt
0.84375
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex #align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section namespace Real open Set Filter open scoped Topology Real theorem tan_add {x y : ℝ} (h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨ (∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) : tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_tan] using @Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast) #align real.tan_add Real.tan_add theorem tan_add' {x y : ℝ} (h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) : tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := tan_add (Or.inl h) #align real.tan_add' Real.tan_add' theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by have := @Complex.tan_two_mul x norm_cast at * #align real.tan_two_mul Real.tan_two_mul theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 := tan_eq_zero_iff.mpr (by use n) #align real.tan_int_mul_pi_div_two Real.tan_int_mul_pi_div_two
Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean
56
60
theorem continuousOn_tan : ContinuousOn tan {x | cos x ≠ 0} := by
suffices ContinuousOn (fun x => sin x / cos x) {x | cos x ≠ 0} by have h_eq : (fun x => sin x / cos x) = tan := by ext1 x; rw [tan_eq_sin_div_cos] rwa [h_eq] at this exact continuousOn_sin.div continuousOn_cos fun x => id
0.84375
import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` -- This lemma competes with `Int.ofNat_eq_natCast` to come later @[simp high, nolint simpNF, norm_cast] theorem cast_natCast (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_natCastₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_natCastₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast]
Mathlib/Data/Int/Cast/Basic.lean
74
76
theorem cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
0.84375
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) noncomputable def _root_.NumberField.mixedEmbedding : K →+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex · have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left · have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank ℚ K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K ℂ, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) →*₀ ℝ where toFun x := if hw : IsReal w then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, not_isReal_iff_isComplex.mp hw⟩‖ map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≤ normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _ theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) : normAtPlace w (- x) = normAtPlace w x := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> simp theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) : normAtPlace w (x + y) ≤ normAtPlace w x + normAtPlace w y := by rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_add_le _ _
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
274
279
theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) : normAtPlace w (c • x) = |c| * normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs · rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs] · rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
0.84375
import Mathlib.Data.Real.Basic #align_import data.real.sign from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Real noncomputable def sign (r : ℝ) : ℝ := if r < 0 then -1 else if 0 < r then 1 else 0 #align real.sign Real.sign theorem sign_of_neg {r : ℝ} (hr : r < 0) : sign r = -1 := by rw [sign, if_pos hr] #align real.sign_of_neg Real.sign_of_neg theorem sign_of_pos {r : ℝ} (hr : 0 < r) : sign r = 1 := by rw [sign, if_pos hr, if_neg hr.not_lt] #align real.sign_of_pos Real.sign_of_pos @[simp]
Mathlib/Data/Real/Sign.lean
43
43
theorem sign_zero : sign 0 = 0 := by
rw [sign, if_neg (lt_irrefl _), if_neg (lt_irrefl _)]
0.84375
import Mathlib.Data.Fintype.Basic import Mathlib.Data.Finset.Card import Mathlib.Data.List.NodupEquivFin import Mathlib.Data.Set.Image #align_import data.fintype.card from "leanprover-community/mathlib"@"bf2428c9486c407ca38b5b3fb10b87dad0bc99fa" assert_not_exists MonoidWithZero assert_not_exists MulAction open Function open Nat universe u v variable {α β γ : Type*} open Finset Function namespace Fintype def card (α) [Fintype α] : ℕ := (@univ α _).card #align fintype.card Fintype.card def truncEquivFin (α) [DecidableEq α] [Fintype α] : Trunc (α ≃ Fin (card α)) := by unfold card Finset.card exact Quot.recOnSubsingleton' (motive := fun s : Multiset α => (∀ x : α, x ∈ s) → s.Nodup → Trunc (α ≃ Fin (Multiset.card s))) univ.val (fun l (h : ∀ x : α, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getEquivOfForallMemList _ h).symm) mem_univ_val univ.2 #align fintype.trunc_equiv_fin Fintype.truncEquivFin noncomputable def equivFin (α) [Fintype α] : α ≃ Fin (card α) := letI := Classical.decEq α (truncEquivFin α).out #align fintype.equiv_fin Fintype.equivFin def truncFinBijection (α) [Fintype α] : Trunc { f : Fin (card α) → α // Bijective f } := by unfold card Finset.card refine Quot.recOnSubsingleton' (motive := fun s : Multiset α => (∀ x : α, x ∈ s) → s.Nodup → Trunc {f : Fin (Multiset.card s) → α // Bijective f}) univ.val (fun l (h : ∀ x : α, x ∈ l) (nd : l.Nodup) => Trunc.mk (nd.getBijectionOfForallMemList _ h)) mem_univ_val univ.2 #align fintype.trunc_fin_bijection Fintype.truncFinBijection theorem subtype_card {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) : @card { x // p x } (Fintype.subtype s H) = s.card := Multiset.card_pmap _ _ _ #align fintype.subtype_card Fintype.subtype_card theorem card_of_subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) [Fintype { x // p x }] : card { x // p x } = s.card := by rw [← subtype_card s H] congr apply Subsingleton.elim #align fintype.card_of_subtype Fintype.card_of_subtype @[simp] theorem card_ofFinset {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) : @Fintype.card p (ofFinset s H) = s.card := Fintype.subtype_card s H #align fintype.card_of_finset Fintype.card_ofFinset
Mathlib/Data/Fintype/Card.lean
139
140
theorem card_of_finset' {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) [Fintype p] : Fintype.card p = s.card := by
rw [← card_ofFinset s H]; congr; apply Subsingleton.elim
0.84375
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex #align_import analysis.special_functions.trigonometric.complex_deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" noncomputable section namespace Complex open Set Filter open scoped Real theorem hasStrictDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasStrictDerivAt tan (1 / cos x ^ 2) x := by convert (hasStrictDerivAt_sin x).div (hasStrictDerivAt_cos x) h using 1 rw_mod_cast [← sin_sq_add_cos_sq x] ring #align complex.has_strict_deriv_at_tan Complex.hasStrictDerivAt_tan theorem hasDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasDerivAt tan (1 / cos x ^ 2) x := (hasStrictDerivAt_tan h).hasDerivAt #align complex.has_deriv_at_tan Complex.hasDerivAt_tan open scoped Topology theorem tendsto_abs_tan_of_cos_eq_zero {x : ℂ} (hx : cos x = 0) : Tendsto (fun x => abs (tan x)) (𝓝[≠] x) atTop := by simp only [tan_eq_sin_div_cos, ← norm_eq_abs, norm_div] have A : sin x ≠ 0 := fun h => by simpa [*, sq] using sin_sq_add_cos_sq x have B : Tendsto cos (𝓝[≠] x) (𝓝[≠] 0) := hx ▸ (hasDerivAt_cos x).tendsto_punctured_nhds (neg_ne_zero.2 A) exact continuous_sin.continuousWithinAt.norm.mul_atTop (norm_pos_iff.2 A) (tendsto_norm_nhdsWithin_zero.comp B).inv_tendsto_zero #align complex.tendsto_abs_tan_of_cos_eq_zero Complex.tendsto_abs_tan_of_cos_eq_zero theorem tendsto_abs_tan_atTop (k : ℤ) : Tendsto (fun x => abs (tan x)) (𝓝[≠] ((2 * k + 1) * π / 2 : ℂ)) atTop := tendsto_abs_tan_of_cos_eq_zero <| cos_eq_zero_iff.2 ⟨k, rfl⟩ #align complex.tendsto_abs_tan_at_top Complex.tendsto_abs_tan_atTop @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/ComplexDeriv.lean
53
56
theorem continuousAt_tan {x : ℂ} : ContinuousAt tan x ↔ cos x ≠ 0 := by
refine ⟨fun hc h₀ => ?_, fun h => (hasDerivAt_tan h).continuousAt⟩ exact not_tendsto_nhds_of_tendsto_atTop (tendsto_abs_tan_of_cos_eq_zero h₀) _ (hc.norm.tendsto.mono_left inf_le_left)
0.84375
import Mathlib.Algebra.Module.Submodule.Ker #align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" variable {R : Type*} {R₂ : Type*} variable {M : Type*} {M₂ : Type*} namespace LinearMap section AddCommMonoid variable [Semiring R] [Semiring R₂] variable [AddCommMonoid M] [AddCommMonoid M₂] variable [Module R M] [Module R₂ M₂] open Submodule variable {τ₁₂ : R →+* R₂} section variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂] def eqLocus (f g : F) : Submodule R M := { (f : M →+ M₂).eqLocusM g with carrier := { x | f x = g x } smul_mem' := fun {r} {x} (hx : _ = _) => show _ = _ by -- Note: #8386 changed `map_smulₛₗ` into `map_smulₛₗ _` simpa only [map_smulₛₗ _] using congr_arg (τ₁₂ r • ·) hx } #align linear_map.eq_locus LinearMap.eqLocus @[simp] theorem mem_eqLocus {x : M} {f g : F} : x ∈ eqLocus f g ↔ f x = g x := Iff.rfl #align linear_map.mem_eq_locus LinearMap.mem_eqLocus theorem eqLocus_toAddSubmonoid (f g : F) : (eqLocus f g).toAddSubmonoid = (f : M →+ M₂).eqLocusM g := rfl #align linear_map.eq_locus_to_add_submonoid LinearMap.eqLocus_toAddSubmonoid @[simp] theorem eqLocus_eq_top {f g : F} : eqLocus f g = ⊤ ↔ f = g := by simp [SetLike.ext_iff, DFunLike.ext_iff] @[simp] theorem eqLocus_same (f : F) : eqLocus f f = ⊤ := eqLocus_eq_top.2 rfl #align linear_map.eq_locus_same LinearMap.eqLocus_same theorem le_eqLocus {f g : F} {S : Submodule R M} : S ≤ eqLocus f g ↔ Set.EqOn f g S := Iff.rfl
Mathlib/Algebra/Module/Submodule/EqLocus.lean
73
76
theorem eqOn_sup {f g : F} {S T : Submodule R M} (hS : Set.EqOn f g S) (hT : Set.EqOn f g T) : Set.EqOn f g ↑(S ⊔ T) := by
rw [← le_eqLocus] at hS hT ⊢ exact sup_le hS hT
0.84375
import Mathlib.Data.Set.Image import Mathlib.Data.SProd #align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" open Function namespace Set section Prod variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β} theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) : (s ×ˢ t).Subsingleton := fun _x hx _y hy ↦ Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2) noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] : DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable #align set.decidable_mem_prod Set.decidableMemProd @[gcongr] theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ := fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩ #align set.prod_mono Set.prod_mono @[gcongr] theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t := prod_mono hs Subset.rfl #align set.prod_mono_left Set.prod_mono_left @[gcongr] theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ := prod_mono Subset.rfl ht #align set.prod_mono_right Set.prod_mono_right @[simp] theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ := ⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩ #align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self @[simp] theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ := and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self #align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P := ⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩ #align set.prod_subset_iff Set.prod_subset_iff theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) := prod_subset_iff #align set.forall_prod_set Set.forall_prod_set theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by simp [and_assoc] #align set.exists_prod_set Set.exists_prod_set @[simp] theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by ext exact and_false_iff _ #align set.prod_empty Set.prod_empty @[simp] theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by ext exact false_and_iff _ #align set.empty_prod Set.empty_prod @[simp, mfld_simps] theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by ext exact true_and_iff _ #align set.univ_prod_univ Set.univ_prod_univ theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq] #align set.univ_prod Set.univ_prod
Mathlib/Data/Set/Prod.lean
104
104
theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by
simp [prod_eq]
0.84375
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector α n) (ys : Vector β n) @[simp] theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ x s.snd let r₁ := f₁ r₂.snd y s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) : map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
76
84
theorem mapAccumr₂_mapAccumr_right (f₁ : α → γ → σ₁ → σ₁ × ζ) (f₂ : β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr f₂ ys s₂).snd s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ y s.snd let r₁ := f₁ x r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
0.84375
import Mathlib.Algebra.ContinuedFractions.Translations #align_import algebra.continued_fractions.continuants_recurrence from "leanprover-community/mathlib"@"5f11361a98ae4acd77f5c1837686f6f0102cdc25" namespace GeneralizedContinuedFraction variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K] theorem continuantsAux_recurrence {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp) (nth_conts_aux_eq : g.continuantsAux n = ppred) (succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) : g.continuantsAux (n + 2) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by simp [*, continuantsAux, nextContinuants, nextDenominator, nextNumerator] #align generalized_continued_fraction.continuants_aux_recurrence GeneralizedContinuedFraction.continuantsAux_recurrence theorem continuants_recurrenceAux {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp) (nth_conts_aux_eq : g.continuantsAux n = ppred) (succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) : g.continuants (n + 1) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by simp [nth_cont_eq_succ_nth_cont_aux, continuantsAux_recurrence nth_s_eq nth_conts_aux_eq succ_nth_conts_aux_eq] #align generalized_continued_fraction.continuants_recurrence_aux GeneralizedContinuedFraction.continuants_recurrenceAux theorem continuants_recurrence {gp ppred pred : Pair K} (succ_nth_s_eq : g.s.get? (n + 1) = some gp) (nth_conts_eq : g.continuants n = ppred) (succ_nth_conts_eq : g.continuants (n + 1) = pred) : g.continuants (n + 2) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by rw [nth_cont_eq_succ_nth_cont_aux] at nth_conts_eq succ_nth_conts_eq exact continuants_recurrenceAux succ_nth_s_eq nth_conts_eq succ_nth_conts_eq #align generalized_continued_fraction.continuants_recurrence GeneralizedContinuedFraction.continuants_recurrence theorem numerators_recurrence {gp : Pair K} {ppredA predA : K} (succ_nth_s_eq : g.s.get? (n + 1) = some gp) (nth_num_eq : g.numerators n = ppredA) (succ_nth_num_eq : g.numerators (n + 1) = predA) : g.numerators (n + 2) = gp.b * predA + gp.a * ppredA := by obtain ⟨ppredConts, nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants n = conts ∧ conts.a = ppredA := exists_conts_a_of_num nth_num_eq obtain ⟨predConts, succ_nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants (n + 1) = conts ∧ conts.a = predA := exists_conts_a_of_num succ_nth_num_eq rw [num_eq_conts_a, continuants_recurrence succ_nth_s_eq nth_conts_eq succ_nth_conts_eq] #align generalized_continued_fraction.numerators_recurrence GeneralizedContinuedFraction.numerators_recurrence
Mathlib/Algebra/ContinuedFractions/ContinuantsRecurrence.lean
63
72
theorem denominators_recurrence {gp : Pair K} {ppredB predB : K} (succ_nth_s_eq : g.s.get? (n + 1) = some gp) (nth_denom_eq : g.denominators n = ppredB) (succ_nth_denom_eq : g.denominators (n + 1) = predB) : g.denominators (n + 2) = gp.b * predB + gp.a * ppredB := by
obtain ⟨ppredConts, nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants n = conts ∧ conts.b = ppredB := exists_conts_b_of_denom nth_denom_eq obtain ⟨predConts, succ_nth_conts_eq, ⟨rfl⟩⟩ : ∃ conts, g.continuants (n + 1) = conts ∧ conts.b = predB := exists_conts_b_of_denom succ_nth_denom_eq rw [denom_eq_conts_b, continuants_recurrence succ_nth_s_eq nth_conts_eq succ_nth_conts_eq]
0.84375
import Mathlib.Data.Matrix.Basic variable {l m n o : Type*} universe u v w variable {R : Type*} {α : Type v} {β : Type w} namespace Matrix def col (w : m → α) : Matrix m Unit α := of fun x _ => w x #align matrix.col Matrix.col -- TODO: set as an equation lemma for `col`, see mathlib4#3024 @[simp] theorem col_apply (w : m → α) (i j) : col w i j = w i := rfl #align matrix.col_apply Matrix.col_apply def row (v : n → α) : Matrix Unit n α := of fun _ y => v y #align matrix.row Matrix.row -- TODO: set as an equation lemma for `row`, see mathlib4#3024 @[simp] theorem row_apply (v : n → α) (i j) : row v i j = v j := rfl #align matrix.row_apply Matrix.row_apply theorem col_injective : Function.Injective (col : (m → α) → _) := fun _x _y h => funext fun i => congr_fun₂ h i () @[simp] theorem col_inj {v w : m → α} : col v = col w ↔ v = w := col_injective.eq_iff @[simp] theorem col_zero [Zero α] : col (0 : m → α) = 0 := rfl @[simp] theorem col_eq_zero [Zero α] (v : m → α) : col v = 0 ↔ v = 0 := col_inj @[simp] theorem col_add [Add α] (v w : m → α) : col (v + w) = col v + col w := by ext rfl #align matrix.col_add Matrix.col_add @[simp] theorem col_smul [SMul R α] (x : R) (v : m → α) : col (x • v) = x • col v := by ext rfl #align matrix.col_smul Matrix.col_smul theorem row_injective : Function.Injective (row : (n → α) → _) := fun _x _y h => funext fun j => congr_fun₂ h () j @[simp] theorem row_inj {v w : n → α} : row v = row w ↔ v = w := row_injective.eq_iff @[simp] theorem row_zero [Zero α] : row (0 : n → α) = 0 := rfl @[simp] theorem row_eq_zero [Zero α] (v : n → α) : row v = 0 ↔ v = 0 := row_inj @[simp] theorem row_add [Add α] (v w : m → α) : row (v + w) = row v + row w := by ext rfl #align matrix.row_add Matrix.row_add @[simp] theorem row_smul [SMul R α] (x : R) (v : m → α) : row (x • v) = x • row v := by ext rfl #align matrix.row_smul Matrix.row_smul @[simp] theorem transpose_col (v : m → α) : (Matrix.col v)ᵀ = Matrix.row v := by ext rfl #align matrix.transpose_col Matrix.transpose_col @[simp] theorem transpose_row (v : m → α) : (Matrix.row v)ᵀ = Matrix.col v := by ext rfl #align matrix.transpose_row Matrix.transpose_row @[simp] theorem conjTranspose_col [Star α] (v : m → α) : (col v)ᴴ = row (star v) := by ext rfl #align matrix.conj_transpose_col Matrix.conjTranspose_col @[simp] theorem conjTranspose_row [Star α] (v : m → α) : (row v)ᴴ = col (star v) := by ext rfl #align matrix.conj_transpose_row Matrix.conjTranspose_row theorem row_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) : Matrix.row (v ᵥ* M) = Matrix.row v * M := by ext rfl #align matrix.row_vec_mul Matrix.row_vecMul
Mathlib/Data/Matrix/RowCol.lean
123
126
theorem col_vecMul [Fintype m] [NonUnitalNonAssocSemiring α] (M : Matrix m n α) (v : m → α) : Matrix.col (v ᵥ* M) = (Matrix.row v * M)ᵀ := by
ext rfl
0.84375
import Mathlib.Order.Cover import Mathlib.Order.Interval.Finset.Defs #align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d" assert_not_exists MonoidWithZero assert_not_exists Finset.sum open Function OrderDual open FinsetInterval variable {ι α : Type*} namespace Finset section Preorder variable [Preorder α] section LocallyFiniteOrder variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α} @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc] #align finset.nonempty_Icc Finset.nonempty_Icc @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico] #align finset.nonempty_Ico Finset.nonempty_Ico @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc] #align finset.nonempty_Ioc Finset.nonempty_Ioc -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp] theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo] #align finset.nonempty_Ioo Finset.nonempty_Ioo @[simp] theorem Icc_eq_empty_iff : Icc a b = ∅ ↔ ¬a ≤ b := by rw [← coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff] #align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff @[simp] theorem Ico_eq_empty_iff : Ico a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff] #align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff @[simp] theorem Ioc_eq_empty_iff : Ioc a b = ∅ ↔ ¬a < b := by rw [← coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff] #align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff -- TODO: This is nonsense. A locally finite order is never densely ordered @[simp]
Mathlib/Order/Interval/Finset/Basic.lean
94
95
theorem Ioo_eq_empty_iff [DenselyOrdered α] : Ioo a b = ∅ ↔ ¬a < b := by
rw [← coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
0.84375
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.mixedEmbedding open NumberField NumberField.InfinitePlace FiniteDimensional Finset local notation "E" K => ({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ) noncomputable def _root_.NumberField.mixedEmbedding : K →+* (E K) := RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop) (Pi.ringHom fun w => w.val.embedding) instance [NumberField K] : Nontrivial (E K) := by obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K)) obtain hw | hw := w.isReal_or_isComplex · have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_left · have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩ exact nontrivial_prod_right protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank ℚ K := by classical rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const, card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul, mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K ℂ, Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)] theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] : Function.Injective (NumberField.mixedEmbedding K) := by exact RingHom.injective _ noncomputable section norm open scoped Classical variable {K} def normAtPlace (w : InfinitePlace K) : (E K) →*₀ ℝ where toFun x := if hw : IsReal w then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, not_isReal_iff_isComplex.mp hw⟩‖ map_zero' := by simp map_one' := by simp map_mul' x y := by split_ifs <;> simp
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
259
262
theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) : 0 ≤ normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] split_ifs <;> exact norm_nonneg _
0.84375
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector α n) (ys : Vector β n) @[simp] theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ x s.snd let r₁ := f₁ r₂.snd y s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) : map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr_right (f₁ : α → γ → σ₁ → σ₁ × ζ) (f₂ : β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr f₂ ys s₂).snd s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ y s.snd let r₁ := f₁ x r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_right (f₁ : α → γ → ζ) (f₂ : β → γ) : map₂ f₁ xs (map f₂ ys) = map₂ (fun x y => f₁ x (f₂ y)) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr_mapAccumr₂ (f₁ : γ → σ₁ → σ₁ × ζ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr f₁ (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y s => let r₂ := f₂ x y s.snd let r₁ := f₁ r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map_map₂ (f₁ : γ → ζ) (f₂ : α → β → γ) : map f₁ (map₂ f₂ xs ys) = map₂ (fun x y => f₁ <| f₂ x y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_left_left (f₁ : γ → α → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd xs s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd x s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_left_right (f₁ : γ → β → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd ys s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd y s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_right_left (f₁ : α → γ → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ x r₂.snd s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
145
154
theorem mapAccumr₂_mapAccumr₂_right_right (f₁ : β → γ → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ ys (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ y r₂.snd s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
0.84375
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Binary variable (xs : Vector α n) (ys : Vector β n) @[simp] theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ x s.snd let r₁ := f₁ r₂.snd y s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) : map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr_right (f₁ : α → γ → σ₁ → σ₁ × ζ) (f₂ : β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ xs (mapAccumr f₂ ys s₂).snd s₁) = let m := (mapAccumr₂ (fun x y s => let r₂ := f₂ y s.snd let r₁ := f₁ x r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂)) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map₂_map_right (f₁ : α → γ → ζ) (f₂ : β → γ) : map₂ f₁ xs (map f₂ ys) = map₂ (fun x y => f₁ x (f₂ y)) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr_mapAccumr₂ (f₁ : γ → σ₁ → σ₁ × ζ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr f₁ (mapAccumr₂ f₂ xs ys s₂).snd s₁) = let m := mapAccumr₂ (fun x y s => let r₂ := f₂ x y s.snd let r₁ := f₁ r₂.snd s.fst ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp] theorem map_map₂ (f₁ : γ → ζ) (f₂ : α → β → γ) : map f₁ (map₂ f₂ xs ys) = map₂ (fun x y => f₁ <| f₂ x y) xs ys := by induction xs, ys using Vector.revInductionOn₂ <;> simp_all @[simp] theorem mapAccumr₂_mapAccumr₂_left_left (f₁ : γ → α → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd xs s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd x s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all @[simp]
Mathlib/Data/Vector/MapLemmas.lean
120
130
theorem mapAccumr₂_mapAccumr₂_left_right (f₁ : γ → β → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) : (mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd ys s₁) = let m := mapAccumr₂ (fun x y (s₁, s₂) => let r₂ := f₂ x y s₂ let r₁ := f₁ r₂.snd y s₁ ((r₁.fst, r₂.fst), r₁.snd) ) xs ys (s₁, s₂) (m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
0.84375
import Mathlib.Analysis.Complex.Basic import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle #align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" open Set noncomputable section namespace Complex theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re := ⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im := ⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im theorem isOpenMap_re : IsOpenMap re := isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj #align complex.is_open_map_re Complex.isOpenMap_re theorem isOpenMap_im : IsOpenMap im := isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj #align complex.is_open_map_im Complex.isOpenMap_im theorem quotientMap_re : QuotientMap re := isHomeomorphicTrivialFiberBundle_re.quotientMap_proj #align complex.quotient_map_re Complex.quotientMap_re theorem quotientMap_im : QuotientMap im := isHomeomorphicTrivialFiberBundle_im.quotientMap_proj #align complex.quotient_map_im Complex.quotientMap_im theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s := (isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm #align complex.interior_preimage_re Complex.interior_preimage_re theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s := (isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm #align complex.interior_preimage_im Complex.interior_preimage_im theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s := (isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm #align complex.closure_preimage_re Complex.closure_preimage_re theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s := (isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm #align complex.closure_preimage_im Complex.closure_preimage_im theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s := (isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm #align complex.frontier_preimage_re Complex.frontier_preimage_re theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s := (isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm #align complex.frontier_preimage_im Complex.frontier_preimage_im @[simp] theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by simpa only [interior_Iic] using interior_preimage_re (Iic a) #align complex.interior_set_of_re_le Complex.interior_setOf_re_le @[simp]
Mathlib/Analysis/Complex/ReImTopology.lean
99
100
theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by
simpa only [interior_Iic] using interior_preimage_im (Iic a)
0.84375
import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.Normed.Group.AddTorsor #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Set open scoped RealInnerProductSpace variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] noncomputable section namespace AffineSubspace variable {c c₁ c₂ p₁ p₂ : P} def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P := .comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <| (LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace theorem mem_perpBisector_iff_inner_eq_zero' : c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 := Iff.rfl theorem mem_perpBisector_iff_inner_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 := inner_eq_zero_symm theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc] simp theorem mem_perpBisector_pointReflection_iff_inner_eq_zero : c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right, Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero, ← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev] theorem midpoint_mem_perpBisector (p₁ p₂ : P) : midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by simp [mem_perpBisector_iff_inner_eq_zero] theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty := ⟨_, midpoint_mem_perpBisector _ _⟩ @[simp] theorem direction_perpBisector (p₁ p₂ : P) : (perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by erw [perpBisector, comap_symm, map_direction, Submodule.map_id, Submodule.toAffineSubspace_direction] ext x exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm theorem mem_perpBisector_iff_inner_eq_inner : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left]; simp theorem mem_perpBisector_iff_inner_eq : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left, sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq, dist_eq_norm_vsub' V, div_eq_inv_mul] theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff, vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right, neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
Mathlib/Geometry/Euclidean/PerpBisector.lean
97
98
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
0.84375
import Mathlib.Probability.Kernel.MeasurableIntegral import Mathlib.MeasureTheory.Integral.SetIntegral #align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113" open MeasureTheory ProbabilityTheory open scoped MeasureTheory ENNReal NNReal namespace ProbabilityTheory.kernel variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} variable {κ : kernel α β} {f : α → β → ℝ≥0∞} noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) : kernel α β := @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf => (⟨fun a => (κ a).withDensity (f a), by refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [withDensity_apply _ hs] exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0 #align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity
Mathlib/Probability/Kernel/WithDensity.lean
56
57
theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ] (hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by
classical exact dif_neg hf
0.84375
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section Real variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} theorem toReal_add (ha : a ≠ ∞) (hb : b ≠ ∞) : (a + b).toReal = a.toReal + b.toReal := by lift a to ℝ≥0 using ha lift b to ℝ≥0 using hb rfl #align ennreal.to_real_add ENNReal.toReal_add theorem toReal_sub_of_le {a b : ℝ≥0∞} (h : b ≤ a) (ha : a ≠ ∞) : (a - b).toReal = a.toReal - b.toReal := by lift b to ℝ≥0 using ne_top_of_le_ne_top ha h lift a to ℝ≥0 using ha simp only [← ENNReal.coe_sub, ENNReal.coe_toReal, NNReal.coe_sub (ENNReal.coe_le_coe.mp h)] #align ennreal.to_real_sub_of_le ENNReal.toReal_sub_of_le theorem le_toReal_sub {a b : ℝ≥0∞} (hb : b ≠ ∞) : a.toReal - b.toReal ≤ (a - b).toReal := by lift b to ℝ≥0 using hb induction a · simp · simp only [← coe_sub, NNReal.sub_def, Real.coe_toNNReal', coe_toReal] exact le_max_left _ _ #align ennreal.le_to_real_sub ENNReal.le_toReal_sub theorem toReal_add_le : (a + b).toReal ≤ a.toReal + b.toReal := if ha : a = ∞ then by simp only [ha, top_add, top_toReal, zero_add, toReal_nonneg] else if hb : b = ∞ then by simp only [hb, add_top, top_toReal, add_zero, toReal_nonneg] else le_of_eq (toReal_add ha hb) #align ennreal.to_real_add_le ENNReal.toReal_add_le theorem ofReal_add {p q : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) : ENNReal.ofReal (p + q) = ENNReal.ofReal p + ENNReal.ofReal q := by rw [ENNReal.ofReal, ENNReal.ofReal, ENNReal.ofReal, ← coe_add, coe_inj, Real.toNNReal_add hp hq] #align ennreal.of_real_add ENNReal.ofReal_add theorem ofReal_add_le {p q : ℝ} : ENNReal.ofReal (p + q) ≤ ENNReal.ofReal p + ENNReal.ofReal q := coe_le_coe.2 Real.toNNReal_add_le #align ennreal.of_real_add_le ENNReal.ofReal_add_le @[simp] theorem toReal_le_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal ≤ b.toReal ↔ a ≤ b := by lift a to ℝ≥0 using ha lift b to ℝ≥0 using hb norm_cast #align ennreal.to_real_le_to_real ENNReal.toReal_le_toReal @[gcongr] theorem toReal_mono (hb : b ≠ ∞) (h : a ≤ b) : a.toReal ≤ b.toReal := (toReal_le_toReal (ne_top_of_le_ne_top hb h) hb).2 h #align ennreal.to_real_mono ENNReal.toReal_mono -- Porting note (#10756): new lemma
Mathlib/Data/ENNReal/Real.lean
88
91
theorem toReal_mono' (h : a ≤ b) (ht : b = ∞ → a = ∞) : a.toReal ≤ b.toReal := by
rcases eq_or_ne a ∞ with rfl | ha · exact toReal_nonneg · exact toReal_mono (mt ht ha) h
0.84375
import Mathlib.Data.Finsupp.Multiset import Mathlib.Data.Nat.GCD.BigOperators import Mathlib.Data.Nat.PrimeFin import Mathlib.NumberTheory.Padics.PadicVal import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" -- Workaround for lean4#2038 attribute [-instance] instBEqNat open Nat Finset List Finsupp namespace Nat variable {a b m n p : ℕ} def factorization (n : ℕ) : ℕ →₀ ℕ where support := n.primeFactors toFun p := if p.Prime then padicValNat p n else 0 mem_support_toFun := by simp [not_or]; aesop #align nat.factorization Nat.factorization @[simp] lemma support_factorization (n : ℕ) : (factorization n).support = n.primeFactors := rfl theorem factorization_def (n : ℕ) {p : ℕ} (pp : p.Prime) : n.factorization p = padicValNat p n := by simpa [factorization] using absurd pp #align nat.factorization_def Nat.factorization_def @[simp] theorem factors_count_eq {n p : ℕ} : n.factors.count p = n.factorization p := by rcases n.eq_zero_or_pos with (rfl | hn0) · simp [factorization, count] if pp : p.Prime then ?_ else rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)] simp [factorization, pp] simp only [factorization_def _ pp] apply _root_.le_antisymm · rw [le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] exact List.le_count_iff_replicate_sublist.mp le_rfl |>.subperm · rw [← lt_add_one_iff, lt_iff_not_ge, ge_iff_le, le_padicValNat_iff_replicate_subperm_factors pp hn0.ne'] intro h have := h.count_le p simp at this #align nat.factors_count_eq Nat.factors_count_eq
Mathlib/Data/Nat/Factorization/Basic.lean
84
87
theorem factorization_eq_factors_multiset (n : ℕ) : n.factorization = Multiset.toFinsupp (n.factors : Multiset ℕ) := by
ext p simp
0.84375
import Mathlib.MeasureTheory.Integral.Lebesgue open Set hiding restrict restrict_apply open Filter ENNReal NNReal MeasureTheory.Measure namespace MeasureTheory variable {α : Type*} {m0 : MeasurableSpace α} {μ : Measure α} noncomputable def Measure.withDensity {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : Measure α := Measure.ofMeasurable (fun s _ => ∫⁻ a in s, f a ∂μ) (by simp) fun s hs hd => lintegral_iUnion hs hd _ #align measure_theory.measure.with_density MeasureTheory.Measure.withDensity @[simp] theorem withDensity_apply (f : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s) : μ.withDensity f s = ∫⁻ a in s, f a ∂μ := Measure.ofMeasurable_apply s hs #align measure_theory.with_density_apply MeasureTheory.withDensity_apply theorem withDensity_apply_le (f : α → ℝ≥0∞) (s : Set α) : ∫⁻ a in s, f a ∂μ ≤ μ.withDensity f s := by let t := toMeasurable (μ.withDensity f) s calc ∫⁻ a in s, f a ∂μ ≤ ∫⁻ a in t, f a ∂μ := lintegral_mono_set (subset_toMeasurable (withDensity μ f) s) _ = μ.withDensity f t := (withDensity_apply f (measurableSet_toMeasurable (withDensity μ f) s)).symm _ = μ.withDensity f s := measure_toMeasurable s theorem withDensity_apply' [SFinite μ] (f : α → ℝ≥0∞) (s : Set α) : μ.withDensity f s = ∫⁻ a in s, f a ∂μ := by apply le_antisymm ?_ (withDensity_apply_le f s) let t := toMeasurable μ s calc μ.withDensity f s ≤ μ.withDensity f t := measure_mono (subset_toMeasurable μ s) _ = ∫⁻ a in t, f a ∂μ := withDensity_apply f (measurableSet_toMeasurable μ s) _ = ∫⁻ a in s, f a ∂μ := by congr 1; exact restrict_toMeasurable_of_sFinite s @[simp] lemma withDensity_zero_left (f : α → ℝ≥0∞) : (0 : Measure α).withDensity f = 0 := by ext s hs rw [withDensity_apply _ hs] simp theorem withDensity_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : μ.withDensity f = μ.withDensity g := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] exact lintegral_congr_ae (ae_restrict_of_ae h) #align measure_theory.with_density_congr_ae MeasureTheory.withDensity_congr_ae lemma withDensity_mono {f g : α → ℝ≥0∞} (hfg : f ≤ᵐ[μ] g) : μ.withDensity f ≤ μ.withDensity g := by refine le_iff.2 fun s hs ↦ ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] refine set_lintegral_mono_ae' hs ?_ filter_upwards [hfg] with x h_le using fun _ ↦ h_le
Mathlib/MeasureTheory/Measure/WithDensity.lean
97
102
theorem withDensity_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) : μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by
refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs, ← lintegral_add_left hf] simp only [Pi.add_apply]
0.84375
import Mathlib.Init.Logic import Mathlib.Init.Function import Mathlib.Init.Algebra.Classes import Batteries.Util.LibraryNote import Batteries.Tactic.Lint.Basic #align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" #align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db" open Function attribute [local instance 10] Classical.propDecidable open Function alias Membership.mem.ne_of_not_mem := ne_of_mem_of_not_mem alias Membership.mem.ne_of_not_mem' := ne_of_mem_of_not_mem' #align has_mem.mem.ne_of_not_mem Membership.mem.ne_of_not_mem #align has_mem.mem.ne_of_not_mem' Membership.mem.ne_of_not_mem' section Quantifiers set_option autoImplicit true in -- @[elab_as_elim] -- FIXME noncomputable def Exists.classicalRecOn {p : α → Prop} (h : ∃ a, p a) {C} (H : ∀ a, p a → C) : C := H (Classical.choose h) (Classical.choose_spec h) #align exists.classical_rec_on Exists.classicalRecOn section BoundedQuantifiers variable {α : Sort*} {r p q : α → Prop} {P Q : ∀ x, p x → Prop} {b : Prop} theorem bex_def : (∃ (x : _) (_ : p x), q x) ↔ ∃ x, p x ∧ q x := ⟨fun ⟨x, px, qx⟩ ↦ ⟨x, px, qx⟩, fun ⟨x, px, qx⟩ ↦ ⟨x, px, qx⟩⟩ #align bex_def bex_def theorem BEx.elim {b : Prop} : (∃ x h, P x h) → (∀ a h, P a h → b) → b | ⟨a, h₁, h₂⟩, h' => h' a h₁ h₂ #align bex.elim BEx.elim theorem BEx.intro (a : α) (h₁ : p a) (h₂ : P a h₁) : ∃ (x : _) (h : p x), P x h := ⟨a, h₁, h₂⟩ #align bex.intro BEx.intro #align ball_congr forall₂_congr #align bex_congr exists₂_congr @[deprecated exists_eq_left (since := "2024-04-06")]
Mathlib/Logic/Basic.lean
1,092
1,093
theorem bex_eq_left {a : α} : (∃ (x : _) (_ : x = a), p x) ↔ p a := by
simp only [exists_prop, exists_eq_left]
0.84375
import Mathlib.Data.Set.Subsingleton import Mathlib.Order.WithBot #align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29" universe u v open Function Set namespace Set variable {α β γ : Type*} {ι ι' : Sort*} section Preimage variable {f : α → β} {g : β → γ} @[simp] theorem preimage_empty : f ⁻¹' ∅ = ∅ := rfl #align set.preimage_empty Set.preimage_empty theorem preimage_congr {f g : α → β} {s : Set β} (h : ∀ x : α, f x = g x) : f ⁻¹' s = g ⁻¹' s := by congr with x simp [h] #align set.preimage_congr Set.preimage_congr @[gcongr] theorem preimage_mono {s t : Set β} (h : s ⊆ t) : f ⁻¹' s ⊆ f ⁻¹' t := fun _ hx => h hx #align set.preimage_mono Set.preimage_mono @[simp, mfld_simps] theorem preimage_univ : f ⁻¹' univ = univ := rfl #align set.preimage_univ Set.preimage_univ theorem subset_preimage_univ {s : Set α} : s ⊆ f ⁻¹' univ := subset_univ _ #align set.subset_preimage_univ Set.subset_preimage_univ @[simp, mfld_simps] theorem preimage_inter {s t : Set β} : f ⁻¹' (s ∩ t) = f ⁻¹' s ∩ f ⁻¹' t := rfl #align set.preimage_inter Set.preimage_inter @[simp] theorem preimage_union {s t : Set β} : f ⁻¹' (s ∪ t) = f ⁻¹' s ∪ f ⁻¹' t := rfl #align set.preimage_union Set.preimage_union @[simp] theorem preimage_compl {s : Set β} : f ⁻¹' sᶜ = (f ⁻¹' s)ᶜ := rfl #align set.preimage_compl Set.preimage_compl @[simp] theorem preimage_diff (f : α → β) (s t : Set β) : f ⁻¹' (s \ t) = f ⁻¹' s \ f ⁻¹' t := rfl #align set.preimage_diff Set.preimage_diff open scoped symmDiff in @[simp] lemma preimage_symmDiff {f : α → β} (s t : Set β) : f ⁻¹' (s ∆ t) = (f ⁻¹' s) ∆ (f ⁻¹' t) := rfl #align set.preimage_symm_diff Set.preimage_symmDiff @[simp] theorem preimage_ite (f : α → β) (s t₁ t₂ : Set β) : f ⁻¹' s.ite t₁ t₂ = (f ⁻¹' s).ite (f ⁻¹' t₁) (f ⁻¹' t₂) := rfl #align set.preimage_ite Set.preimage_ite @[simp] theorem preimage_setOf_eq {p : α → Prop} {f : β → α} : f ⁻¹' { a | p a } = { a | p (f a) } := rfl #align set.preimage_set_of_eq Set.preimage_setOf_eq @[simp] theorem preimage_id_eq : preimage (id : α → α) = id := rfl #align set.preimage_id_eq Set.preimage_id_eq @[mfld_simps] theorem preimage_id {s : Set α} : id ⁻¹' s = s := rfl #align set.preimage_id Set.preimage_id @[simp, mfld_simps] theorem preimage_id' {s : Set α} : (fun x => x) ⁻¹' s = s := rfl #align set.preimage_id' Set.preimage_id' @[simp] theorem preimage_const_of_mem {b : β} {s : Set β} (h : b ∈ s) : (fun _ : α => b) ⁻¹' s = univ := eq_univ_of_forall fun _ => h #align set.preimage_const_of_mem Set.preimage_const_of_mem @[simp] theorem preimage_const_of_not_mem {b : β} {s : Set β} (h : b ∉ s) : (fun _ : α => b) ⁻¹' s = ∅ := eq_empty_of_subset_empty fun _ hx => h hx #align set.preimage_const_of_not_mem Set.preimage_const_of_not_mem theorem preimage_const (b : β) (s : Set β) [Decidable (b ∈ s)] : (fun _ : α => b) ⁻¹' s = if b ∈ s then univ else ∅ := by split_ifs with hb exacts [preimage_const_of_mem hb, preimage_const_of_not_mem hb] #align set.preimage_const Set.preimage_const lemma exists_eq_const_of_preimage_singleton [Nonempty β] {f : α → β} (hf : ∀ b : β, f ⁻¹' {b} = ∅ ∨ f ⁻¹' {b} = univ) : ∃ b, f = const α b := by rcases em (∃ b, f ⁻¹' {b} = univ) with ⟨b, hb⟩ | hf' · exact ⟨b, funext fun x ↦ eq_univ_iff_forall.1 hb x⟩ · have : ∀ x b, f x ≠ b := fun x b ↦ eq_empty_iff_forall_not_mem.1 ((hf b).resolve_right fun h ↦ hf' ⟨b, h⟩) x exact ⟨Classical.arbitrary β, funext fun x ↦ absurd rfl (this x _)⟩ theorem preimage_comp {s : Set γ} : g ∘ f ⁻¹' s = f ⁻¹' (g ⁻¹' s) := rfl #align set.preimage_comp Set.preimage_comp theorem preimage_comp_eq : preimage (g ∘ f) = preimage f ∘ preimage g := rfl #align set.preimage_comp_eq Set.preimage_comp_eq
Mathlib/Data/Set/Image.lean
157
159
theorem preimage_iterate_eq {f : α → α} {n : ℕ} : Set.preimage f^[n] = (Set.preimage f)^[n] := by
induction' n with n ih; · simp rw [iterate_succ, iterate_succ', preimage_comp_eq, ih]
0.84375
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Data.Nat.Cast.Order import Mathlib.Tactic.Common #align_import data.nat.cast.field from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829" namespace Nat variable {α : Type*} @[simp] theorem cast_div [DivisionSemiring α] {m n : ℕ} (n_dvd : n ∣ m) (hn : (n : α) ≠ 0) : ((m / n : ℕ) : α) = m / n := by rcases n_dvd with ⟨k, rfl⟩ have : n ≠ 0 := by rintro rfl; simp at hn rw [Nat.mul_div_cancel_left _ this.bot_lt, mul_comm n, cast_mul, mul_div_cancel_right₀ _ hn] #align nat.cast_div Nat.cast_div theorem cast_div_div_div_cancel_right [DivisionSemiring α] [CharZero α] {m n d : ℕ} (hn : d ∣ n) (hm : d ∣ m) : (↑(m / d) : α) / (↑(n / d) : α) = (m : α) / n := by rcases eq_or_ne d 0 with (rfl | hd); · simp [Nat.zero_dvd.1 hm] replace hd : (d : α) ≠ 0 := by norm_cast rw [cast_div hm, cast_div hn, div_div_div_cancel_right _ hd] <;> exact hd #align nat.cast_div_div_div_cancel_right Nat.cast_div_div_div_cancel_right section LinearOrderedSemifield variable [LinearOrderedSemifield α] lemma cast_inv_le_one : ∀ n : ℕ, (n⁻¹ : α) ≤ 1 | 0 => by simp | n + 1 => inv_le_one $ by simp [Nat.cast_nonneg] theorem cast_div_le {m n : ℕ} : ((m / n : ℕ) : α) ≤ m / n := by cases n · rw [cast_zero, div_zero, Nat.div_zero, cast_zero] rw [le_div_iff, ← Nat.cast_mul, @Nat.cast_le] · exact Nat.div_mul_le_self m _ · exact Nat.cast_pos.2 (Nat.succ_pos _) #align nat.cast_div_le Nat.cast_div_le theorem inv_pos_of_nat {n : ℕ} : 0 < ((n : α) + 1)⁻¹ := inv_pos.2 <| add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one #align nat.inv_pos_of_nat Nat.inv_pos_of_nat
Mathlib/Data/Nat/Cast/Field.lean
65
67
theorem one_div_pos_of_nat {n : ℕ} : 0 < 1 / ((n : α) + 1) := by
rw [one_div] exact inv_pos_of_nat
0.84375
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Comp import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars #align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set open ContinuousLinearMap (smulRight smulRight_one_eq_iff) variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} section Composition variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F] [IsScalarTower 𝕜 𝕜' F] {s' t' : Set 𝕜'} {h : 𝕜 → 𝕜'} {h₁ : 𝕜 → 𝕜} {h₂ : 𝕜' → 𝕜'} {h' h₂' : 𝕜'} {h₁' : 𝕜} {g₁ : 𝕜' → F} {g₁' : F} {L' : Filter 𝕜'} {y : 𝕜'} (x) theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter g₁ g₁' (h x) L') (hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by simpa using ((hg.restrictScalars 𝕜).comp x hh hL).hasDerivAtFilter #align has_deriv_at_filter.scomp HasDerivAtFilter.scomp
Mathlib/Analysis/Calculus/Deriv/Comp.lean
80
83
theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter g₁ g₁' y L') (hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') : HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by
rw [hy] at hg; exact hg.scomp x hh hL
0.84375
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]
Mathlib/Data/Finset/Card.lean
69
69
theorem card_mono : Monotone (@card α) := by
apply card_le_card
0.84375
import Mathlib.Algebra.Order.Ring.Nat #align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b" namespace Nat def dist (n m : ℕ) := n - m + (m - n) #align nat.dist Nat.dist -- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet. #noalign nat.dist.def theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm] #align nat.dist_comm Nat.dist_comm @[simp] theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self] #align nat.dist_self Nat.dist_self theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m := have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h have : n ≤ m := tsub_eq_zero_iff_le.mp this have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h have : m ≤ n := tsub_eq_zero_iff_le.mp this le_antisymm ‹n ≤ m› ‹m ≤ n› #align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by rw [h, dist_self] #align nat.dist_eq_zero Nat.dist_eq_zero theorem dist_eq_sub_of_le {n m : ℕ} (h : n ≤ m) : dist n m = m - n := by rw [dist, tsub_eq_zero_iff_le.mpr h, zero_add] #align nat.dist_eq_sub_of_le Nat.dist_eq_sub_of_le
Mathlib/Data/Nat/Dist.lean
49
50
theorem dist_eq_sub_of_le_right {n m : ℕ} (h : m ≤ n) : dist n m = n - m := by
rw [dist_comm]; apply dist_eq_sub_of_le h
0.84375
import Mathlib.Control.Applicative import Mathlib.Control.Traversable.Basic import Mathlib.Data.List.Forall2 import Mathlib.Data.Set.Functor #align_import control.traversable.instances from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" universe u v section Option open Functor variable {F G : Type u → Type u} variable [Applicative F] [Applicative G] variable [LawfulApplicative F] [LawfulApplicative G] theorem Option.id_traverse {α} (x : Option α) : Option.traverse (pure : α → Id α) x = x := by cases x <;> rfl #align option.id_traverse Option.id_traverse
Mathlib/Control/Traversable/Instances.lean
35
38
theorem Option.comp_traverse {α β γ} (f : β → F γ) (g : α → G β) (x : Option α) : Option.traverse (Comp.mk ∘ (f <$> ·) ∘ g) x = Comp.mk (Option.traverse f <$> Option.traverse g x) := by
cases x <;> simp! [functor_norm] <;> rfl
0.84375
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp]
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
64
64
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by
rw [logb, logb, log_abs]
0.84375
import Mathlib.Topology.MetricSpace.ProperSpace import Mathlib.Topology.MetricSpace.Cauchy open Set Filter Bornology open scoped ENNReal Uniformity Topology Pointwise universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] namespace Metric #align metric.bounded Bornology.IsBounded section Bounded variable {x : α} {s t : Set α} {r : ℝ} #noalign metric.bounded_iff_is_bounded #align metric.bounded_empty Bornology.isBounded_empty #align metric.bounded_iff_mem_bounded Bornology.isBounded_iff_forall_mem #align metric.bounded.mono Bornology.IsBounded.subset theorem isBounded_closedBall : IsBounded (closedBall x r) := isBounded_iff.2 ⟨r + r, fun y hy z hz => calc dist y z ≤ dist y x + dist z x := dist_triangle_right _ _ _ _ ≤ r + r := add_le_add hy hz⟩ #align metric.bounded_closed_ball Metric.isBounded_closedBall theorem isBounded_ball : IsBounded (ball x r) := isBounded_closedBall.subset ball_subset_closedBall #align metric.bounded_ball Metric.isBounded_ball theorem isBounded_sphere : IsBounded (sphere x r) := isBounded_closedBall.subset sphere_subset_closedBall #align metric.bounded_sphere Metric.isBounded_sphere theorem isBounded_iff_subset_closedBall (c : α) : IsBounded s ↔ ∃ r, s ⊆ closedBall c r := ⟨fun h ↦ (isBounded_iff.1 (h.insert c)).imp fun _r hr _x hx ↦ hr (.inr hx) (mem_insert _ _), fun ⟨_r, hr⟩ ↦ isBounded_closedBall.subset hr⟩ #align metric.bounded_iff_subset_ball Metric.isBounded_iff_subset_closedBall theorem _root_.Bornology.IsBounded.subset_closedBall (h : IsBounded s) (c : α) : ∃ r, s ⊆ closedBall c r := (isBounded_iff_subset_closedBall c).1 h #align metric.bounded.subset_ball Bornology.IsBounded.subset_closedBall theorem _root_.Bornology.IsBounded.subset_ball_lt (h : IsBounded s) (a : ℝ) (c : α) : ∃ r, a < r ∧ s ⊆ ball c r := let ⟨r, hr⟩ := h.subset_closedBall c ⟨max r a + 1, (le_max_right _ _).trans_lt (lt_add_one _), hr.trans <| closedBall_subset_ball <| (le_max_left _ _).trans_lt (lt_add_one _)⟩ theorem _root_.Bornology.IsBounded.subset_ball (h : IsBounded s) (c : α) : ∃ r, s ⊆ ball c r := (h.subset_ball_lt 0 c).imp fun _ ↦ And.right theorem isBounded_iff_subset_ball (c : α) : IsBounded s ↔ ∃ r, s ⊆ ball c r := ⟨(IsBounded.subset_ball · c), fun ⟨_r, hr⟩ ↦ isBounded_ball.subset hr⟩ theorem _root_.Bornology.IsBounded.subset_closedBall_lt (h : IsBounded s) (a : ℝ) (c : α) : ∃ r, a < r ∧ s ⊆ closedBall c r := let ⟨r, har, hr⟩ := h.subset_ball_lt a c ⟨r, har, hr.trans ball_subset_closedBall⟩ #align metric.bounded.subset_ball_lt Bornology.IsBounded.subset_closedBall_lt theorem isBounded_closure_of_isBounded (h : IsBounded s) : IsBounded (closure s) := let ⟨C, h⟩ := isBounded_iff.1 h isBounded_iff.2 ⟨C, fun _a ha _b hb => isClosed_Iic.closure_subset <| map_mem_closure₂ continuous_dist ha hb h⟩ #align metric.bounded_closure_of_bounded Metric.isBounded_closure_of_isBounded protected theorem _root_.Bornology.IsBounded.closure (h : IsBounded s) : IsBounded (closure s) := isBounded_closure_of_isBounded h #align metric.bounded.closure Bornology.IsBounded.closure @[simp] theorem isBounded_closure_iff : IsBounded (closure s) ↔ IsBounded s := ⟨fun h => h.subset subset_closure, fun h => h.closure⟩ #align metric.bounded_closure_iff Metric.isBounded_closure_iff #align metric.bounded_union Bornology.isBounded_union #align metric.bounded.union Bornology.IsBounded.union #align metric.bounded_bUnion Bornology.isBounded_biUnion #align metric.bounded.prod Bornology.IsBounded.prod theorem hasBasis_cobounded_compl_closedBall (c : α) : (cobounded α).HasBasis (fun _ ↦ True) (fun r ↦ (closedBall c r)ᶜ) := ⟨compl_surjective.forall.2 fun _ ↦ (isBounded_iff_subset_closedBall c).trans <| by simp⟩ theorem hasBasis_cobounded_compl_ball (c : α) : (cobounded α).HasBasis (fun _ ↦ True) (fun r ↦ (ball c r)ᶜ) := ⟨compl_surjective.forall.2 fun _ ↦ (isBounded_iff_subset_ball c).trans <| by simp⟩ @[simp] theorem comap_dist_right_atTop (c : α) : comap (dist · c) atTop = cobounded α := (atTop_basis.comap _).eq_of_same_basis <| by simpa only [compl_def, mem_ball, not_lt] using hasBasis_cobounded_compl_ball c @[simp] theorem comap_dist_left_atTop (c : α) : comap (dist c) atTop = cobounded α := by simpa only [dist_comm _ c] using comap_dist_right_atTop c @[simp] theorem tendsto_dist_right_atTop_iff (c : α) {f : β → α} {l : Filter β} : Tendsto (fun x ↦ dist (f x) c) l atTop ↔ Tendsto f l (cobounded α) := by rw [← comap_dist_right_atTop c, tendsto_comap_iff, Function.comp_def] @[simp]
Mathlib/Topology/MetricSpace/Bounded.lean
142
144
theorem tendsto_dist_left_atTop_iff (c : α) {f : β → α} {l : Filter β} : Tendsto (fun x ↦ dist c (f x)) l atTop ↔ Tendsto f l (cobounded α) := by
simp only [dist_comm c, tendsto_dist_right_atTop_iff]
0.84375
import Mathlib.Geometry.RingedSpace.PresheafedSpace.Gluing import Mathlib.AlgebraicGeometry.OpenImmersion #align_import algebraic_geometry.gluing from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" set_option linter.uppercaseLean3 false noncomputable section universe u open TopologicalSpace CategoryTheory Opposite open CategoryTheory.Limits AlgebraicGeometry.PresheafedSpace open CategoryTheory.GlueData namespace AlgebraicGeometry namespace Scheme -- Porting note(#5171): @[nolint has_nonempty_instance]; linter not ported yet structure GlueData extends CategoryTheory.GlueData Scheme where f_open : ∀ i j, IsOpenImmersion (f i j) #align algebraic_geometry.Scheme.glue_data AlgebraicGeometry.Scheme.GlueData attribute [instance] GlueData.f_open namespace OpenCover variable {X : Scheme.{u}} (𝒰 : OpenCover.{u} X) def gluedCoverT' (x y z : 𝒰.J) : pullback (pullback.fst : pullback (𝒰.map x) (𝒰.map y) ⟶ _) (pullback.fst : pullback (𝒰.map x) (𝒰.map z) ⟶ _) ⟶ pullback (pullback.fst : pullback (𝒰.map y) (𝒰.map z) ⟶ _) (pullback.fst : pullback (𝒰.map y) (𝒰.map x) ⟶ _) := by refine (pullbackRightPullbackFstIso _ _ _).hom ≫ ?_ refine ?_ ≫ (pullbackSymmetry _ _).hom refine ?_ ≫ (pullbackRightPullbackFstIso _ _ _).inv refine pullback.map _ _ _ _ (pullbackSymmetry _ _).hom (𝟙 _) (𝟙 _) ?_ ?_ · simp [pullback.condition] · simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t' AlgebraicGeometry.Scheme.OpenCover.gluedCoverT' @[simp, reassoc] theorem gluedCoverT'_fst_fst (x y z : 𝒰.J) : 𝒰.gluedCoverT' x y z ≫ pullback.fst ≫ pullback.fst = pullback.fst ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_fst AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_fst @[simp, reassoc] theorem gluedCoverT'_fst_snd (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.fst ≫ pullback.snd = pullback.snd ≫ pullback.snd := by delta gluedCoverT'; simp #align algebraic_geometry.Scheme.open_cover.glued_cover_t'_fst_snd AlgebraicGeometry.Scheme.OpenCover.gluedCoverT'_fst_snd @[simp, reassoc]
Mathlib/AlgebraicGeometry/Gluing.lean
308
310
theorem gluedCoverT'_snd_fst (x y z : 𝒰.J) : gluedCoverT' 𝒰 x y z ≫ pullback.snd ≫ pullback.fst = pullback.fst ≫ pullback.snd := by
delta gluedCoverT'; simp
0.84375
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp] theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop] #align list.rdrop_nil List.rdrop_nil @[simp] theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop] #align list.rdrop_zero List.rdrop_zero theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by rw [rdrop] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · simp [take_append] · simp [take_append_eq_append_take, IH] #align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse @[simp] theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by simp [rdrop_eq_reverse_drop_reverse] #align list.rdrop_concat_succ List.rdrop_concat_succ def rtake : List α := l.drop (l.length - n) #align list.rtake List.rtake @[simp]
Mathlib/Data/List/DropRight.lean
74
74
theorem rtake_nil : rtake ([] : List α) n = [] := by
simp [rtake]
0.84375
import Mathlib.Logic.Function.Basic import Mathlib.Logic.Relator import Mathlib.Init.Data.Quot import Mathlib.Tactic.Cases import Mathlib.Tactic.Use import Mathlib.Tactic.MkIffOfInductiveProp import Mathlib.Tactic.SimpRw #align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" open Function variable {α β γ δ ε ζ : Type*} namespace Relation section Comp variable {r : α → β → Prop} {p : β → γ → Prop} {q : γ → δ → Prop} def Comp (r : α → β → Prop) (p : β → γ → Prop) (a : α) (c : γ) : Prop := ∃ b, r a b ∧ p b c #align relation.comp Relation.Comp @[inherit_doc] local infixr:80 " ∘r " => Relation.Comp theorem comp_eq : r ∘r (· = ·) = r := funext fun _ ↦ funext fun b ↦ propext <| Iff.intro (fun ⟨_, h, Eq⟩ ↦ Eq ▸ h) fun h ↦ ⟨b, h, rfl⟩ #align relation.comp_eq Relation.comp_eq theorem eq_comp : (· = ·) ∘r r = r := funext fun a ↦ funext fun _ ↦ propext <| Iff.intro (fun ⟨_, Eq, h⟩ ↦ Eq.symm ▸ h) fun h ↦ ⟨a, rfl, h⟩ #align relation.eq_comp Relation.eq_comp theorem iff_comp {r : Prop → α → Prop} : (· ↔ ·) ∘r r = r := by have : (· ↔ ·) = (· = ·) := by funext a b; exact iff_eq_eq rw [this, eq_comp] #align relation.iff_comp Relation.iff_comp
Mathlib/Logic/Relation.lean
154
156
theorem comp_iff {r : α → Prop → Prop} : r ∘r (· ↔ ·) = r := by
have : (· ↔ ·) = (· = ·) := by funext a b; exact iff_eq_eq rw [this, comp_eq]
0.84375
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 theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x := by simp_rw [hammingDist, ne_comm] #align hamming_dist_comm hammingDist_comm theorem hammingDist_triangle (x y z : ∀ i, β i) : hammingDist x z ≤ hammingDist x y + hammingDist y z := by classical unfold hammingDist refine le_trans (card_mono ?_) (card_union_le _ _) rw [← filter_or] exact monotone_filter_right _ fun i h ↦ (h.ne_or_ne _).imp_right Ne.symm #align hamming_dist_triangle hammingDist_triangle theorem hammingDist_triangle_left (x y z : ∀ i, β i) : hammingDist x y ≤ hammingDist z x + hammingDist z y := by rw [hammingDist_comm z] exact hammingDist_triangle _ _ _ #align hamming_dist_triangle_left hammingDist_triangle_left theorem hammingDist_triangle_right (x y z : ∀ i, β i) : hammingDist x y ≤ hammingDist x z + hammingDist y z := by rw [hammingDist_comm y] exact hammingDist_triangle _ _ _ #align hamming_dist_triangle_right hammingDist_triangle_right theorem swap_hammingDist : swap (@hammingDist _ β _ _) = hammingDist := by funext x y exact hammingDist_comm _ _ #align swap_hamming_dist swap_hammingDist theorem eq_of_hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 → x = y := by simp_rw [hammingDist, card_eq_zero, filter_eq_empty_iff, Classical.not_not, funext_iff, mem_univ, forall_true_left, imp_self] #align eq_of_hamming_dist_eq_zero eq_of_hammingDist_eq_zero @[simp] theorem hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 ↔ x = y := ⟨eq_of_hammingDist_eq_zero, fun H => by rw [H] exact hammingDist_self _⟩ #align hamming_dist_eq_zero hammingDist_eq_zero @[simp]
Mathlib/InformationTheory/Hamming.lean
106
107
theorem hamming_zero_eq_dist {x y : ∀ i, β i} : 0 = hammingDist x y ↔ x = y := by
rw [eq_comm, hammingDist_eq_zero]
0.84375
import Mathlib.Order.Filter.SmallSets import Mathlib.Tactic.Monotonicity import Mathlib.Topology.Compactness.Compact import Mathlib.Topology.NhdsSet import Mathlib.Algebra.Group.Defs #align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Set Filter Topology universe u v ua ub uc ud variable {α : Type ua} {β : Type ub} {γ : Type uc} {δ : Type ud} {ι : Sort*} def idRel {α : Type*} := { p : α × α | p.1 = p.2 } #align id_rel idRel @[simp] theorem mem_idRel {a b : α} : (a, b) ∈ @idRel α ↔ a = b := Iff.rfl #align mem_id_rel mem_idRel @[simp]
Mathlib/Topology/UniformSpace/Basic.lean
140
141
theorem idRel_subset {s : Set (α × α)} : idRel ⊆ s ↔ ∀ a, (a, a) ∈ s := by
simp [subset_def]
0.84375
import Mathlib.Order.RelClasses #align_import data.sigma.lex from "leanprover-community/mathlib"@"41cf0cc2f528dd40a8f2db167ea4fb37b8fde7f3" namespace PSigma variable {ι : Sort*} {α : ι → Sort*} {r r₁ r₂ : ι → ι → Prop} {s s₁ s₂ : ∀ i, α i → α i → Prop} theorem lex_iff {a b : Σ' i, α i} : Lex r s a b ↔ r a.1 b.1 ∨ ∃ h : a.1 = b.1, s b.1 (h.rec a.2) b.2 := by constructor · rintro (⟨a, b, hij⟩ | ⟨i, hab⟩) · exact Or.inl hij · exact Or.inr ⟨rfl, hab⟩ · obtain ⟨i, a⟩ := a obtain ⟨j, b⟩ := b dsimp only rintro (h | ⟨rfl, h⟩) · exact Lex.left _ _ h · exact Lex.right _ h #align psigma.lex_iff PSigma.lex_iff instance Lex.decidable (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) [DecidableEq ι] [DecidableRel r] [∀ i, DecidableRel (s i)] : DecidableRel (Lex r s) := fun _ _ => decidable_of_decidable_of_iff lex_iff.symm #align psigma.lex.decidable PSigma.Lex.decidable
Mathlib/Data/Sigma/Lex.lean
170
175
theorem Lex.mono {r₁ r₂ : ι → ι → Prop} {s₁ s₂ : ∀ i, α i → α i → Prop} (hr : ∀ a b, r₁ a b → r₂ a b) (hs : ∀ i a b, s₁ i a b → s₂ i a b) {a b : Σ' i, α i} (h : Lex r₁ s₁ a b) : Lex r₂ s₂ a b := by
obtain ⟨a, b, hij⟩ | ⟨i, hab⟩ := h · exact Lex.left _ _ (hr _ _ hij) · exact Lex.right _ (hs _ _ _ hab)
0.84375
import Mathlib.Analysis.Complex.Basic import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle #align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" open Set noncomputable section namespace Complex theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re := ⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im := ⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im theorem isOpenMap_re : IsOpenMap re := isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj #align complex.is_open_map_re Complex.isOpenMap_re theorem isOpenMap_im : IsOpenMap im := isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj #align complex.is_open_map_im Complex.isOpenMap_im theorem quotientMap_re : QuotientMap re := isHomeomorphicTrivialFiberBundle_re.quotientMap_proj #align complex.quotient_map_re Complex.quotientMap_re theorem quotientMap_im : QuotientMap im := isHomeomorphicTrivialFiberBundle_im.quotientMap_proj #align complex.quotient_map_im Complex.quotientMap_im theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s := (isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm #align complex.interior_preimage_re Complex.interior_preimage_re theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s := (isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm #align complex.interior_preimage_im Complex.interior_preimage_im theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s := (isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm #align complex.closure_preimage_re Complex.closure_preimage_re theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s := (isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm #align complex.closure_preimage_im Complex.closure_preimage_im theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s := (isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm #align complex.frontier_preimage_re Complex.frontier_preimage_re theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s := (isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm #align complex.frontier_preimage_im Complex.frontier_preimage_im @[simp] theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by simpa only [interior_Iic] using interior_preimage_re (Iic a) #align complex.interior_set_of_re_le Complex.interior_setOf_re_le @[simp] theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by simpa only [interior_Iic] using interior_preimage_im (Iic a) #align complex.interior_set_of_im_le Complex.interior_setOf_im_le @[simp]
Mathlib/Analysis/Complex/ReImTopology.lean
104
105
theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by
simpa only [interior_Ici] using interior_preimage_re (Ici a)
0.84375