Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
num_lines
int64
1
150
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.MeasureTheory.Measure.Haar.NormedSpace #align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb" open MeasureTheory Set Filter Asymptotics TopologicalSpace open Real open Complex hiding exp log abs_of_nonneg open scoped Topology noncomputable section section Defs variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] def MellinConvergent (f : ℝ → E) (s : ℂ) : Prop := IntegrableOn (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) (Ioi 0) #align mellin_convergent MellinConvergent theorem MellinConvergent.const_smul {f : ℝ → E} {s : ℂ} (hf : MellinConvergent f s) {𝕜 : Type*} [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) : MellinConvergent (fun t => c • f t) s := by simpa only [MellinConvergent, smul_comm] using hf.smul c #align mellin_convergent.const_smul MellinConvergent.const_smul theorem MellinConvergent.cpow_smul {f : ℝ → E} {s a : ℂ} : MellinConvergent (fun t => (t : ℂ) ^ a • f t) s ↔ MellinConvergent f (s + a) := by refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul] #align mellin_convergent.cpow_smul MellinConvergent.cpow_smul nonrec theorem MellinConvergent.div_const {f : ℝ → ℂ} {s : ℂ} (hf : MellinConvergent f s) (a : ℂ) : MellinConvergent (fun t => f t / a) s := by simpa only [MellinConvergent, smul_eq_mul, ← mul_div_assoc] using hf.div_const a #align mellin_convergent.div_const MellinConvergent.div_const theorem MellinConvergent.comp_mul_left {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : 0 < a) : MellinConvergent (fun t => f (a * t)) s ↔ MellinConvergent f s := by have := integrableOn_Ioi_comp_mul_left_iff (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) 0 ha rw [mul_zero] at this have h1 : EqOn (fun t : ℝ => (↑(a * t) : ℂ) ^ (s - 1) • f (a * t)) ((a : ℂ) ^ (s - 1) • fun t : ℝ => (t : ℂ) ^ (s - 1) • f (a * t)) (Ioi 0) := fun t ht ↦ by simp only [ofReal_mul, mul_cpow_ofReal_nonneg ha.le (le_of_lt ht), mul_smul, Pi.smul_apply] have h2 : (a : ℂ) ^ (s - 1) ≠ 0 := by rw [Ne, cpow_eq_zero_iff, not_and_or, ofReal_eq_zero] exact Or.inl ha.ne' rw [MellinConvergent, MellinConvergent, ← this, integrableOn_congr_fun h1 measurableSet_Ioi, IntegrableOn, IntegrableOn, integrable_smul_iff h2] #align mellin_convergent.comp_mul_left MellinConvergent.comp_mul_left theorem MellinConvergent.comp_rpow {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : a ≠ 0) : MellinConvergent (fun t => f (t ^ a)) s ↔ MellinConvergent f (s / a) := by refine Iff.trans ?_ (integrableOn_Ioi_comp_rpow_iff' _ ha) rw [MellinConvergent] refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi dsimp only [Pi.smul_apply] rw [← Complex.coe_smul (t ^ (a - 1)), ← mul_smul, ← cpow_mul_ofReal_nonneg (le_of_lt ht), ofReal_cpow (le_of_lt ht), ← cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt ht)), ofReal_sub, ofReal_one, mul_sub, mul_div_cancel₀ _ (ofReal_ne_zero.mpr ha), mul_one, add_comm, ← add_sub_assoc, sub_add_cancel] #align mellin_convergent.comp_rpow MellinConvergent.comp_rpow def Complex.VerticalIntegrable (f : ℂ → E) (σ : ℝ) (μ : Measure ℝ := by volume_tac) : Prop := Integrable (fun (y : ℝ) ↦ f (σ + y * I)) μ def mellin (f : ℝ → E) (s : ℂ) : E := ∫ t : ℝ in Ioi 0, (t : ℂ) ^ (s - 1) • f t #align mellin mellin def mellinInv (σ : ℝ) (f : ℂ → E) (x : ℝ) : E := (1 / (2 * π)) • ∫ y : ℝ, (x : ℂ) ^ (-(σ + y * I)) • f (σ + y * I) -- next few lemmas don't require convergence of the Mellin transform (they are just 0 = 0 otherwise) theorem mellin_cpow_smul (f : ℝ → E) (s a : ℂ) : mellin (fun t => (t : ℂ) ^ a • f t) s = mellin f (s + a) := by refine setIntegral_congr measurableSet_Ioi fun t ht => ?_ simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul] #align mellin_cpow_smul mellin_cpow_smul theorem mellin_const_smul (f : ℝ → E) (s : ℂ) {𝕜 : Type*} [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) : mellin (fun t => c • f t) s = c • mellin f s := by simp only [mellin, smul_comm, integral_smul] #align mellin_const_smul mellin_const_smul
Mathlib/Analysis/MellinTransform.lean
117
118
theorem mellin_div_const (f : ℝ → ℂ) (s a : ℂ) : mellin (fun t => f t / a) s = mellin f s / a := by
simp_rw [mellin, smul_eq_mul, ← mul_div_assoc, integral_div]
1
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]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
120
121
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]
1
import Mathlib.Algebra.GCDMonoid.Basic import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Int.GCD instance : GCDMonoid ℕ where gcd := Nat.gcd lcm := Nat.lcm gcd_dvd_left := Nat.gcd_dvd_left gcd_dvd_right := Nat.gcd_dvd_right dvd_gcd := Nat.dvd_gcd gcd_mul_lcm a b := by rw [Nat.gcd_mul_lcm]; rfl lcm_zero_left := Nat.lcm_zero_left lcm_zero_right := Nat.lcm_zero_right theorem gcd_eq_nat_gcd (m n : ℕ) : gcd m n = Nat.gcd m n := rfl #align gcd_eq_nat_gcd gcd_eq_nat_gcd theorem lcm_eq_nat_lcm (m n : ℕ) : lcm m n = Nat.lcm m n := rfl #align lcm_eq_nat_lcm lcm_eq_nat_lcm instance : NormalizedGCDMonoid ℕ := { (inferInstance : GCDMonoid ℕ), (inferInstance : NormalizationMonoid ℕ) with normalize_gcd := fun _ _ => normalize_eq _ normalize_lcm := fun _ _ => normalize_eq _ } namespace Int section NormalizationMonoid instance normalizationMonoid : NormalizationMonoid ℤ where normUnit a := if 0 ≤ a then 1 else -1 normUnit_zero := if_pos le_rfl normUnit_mul {a b} hna hnb := by cases' hna.lt_or_lt with ha ha <;> cases' hnb.lt_or_lt with hb hb <;> simp [mul_nonneg_iff, ha.le, ha.not_le, hb.le, hb.not_le] normUnit_coe_units u := (units_eq_one_or u).elim (fun eq => eq.symm ▸ if_pos zero_le_one) fun eq => eq.symm ▸ if_neg (not_le_of_gt <| show (-1 : ℤ) < 0 by decide) -- Porting note: added theorem normUnit_eq (z : ℤ) : normUnit z = if 0 ≤ z then 1 else -1 := rfl
Mathlib/Algebra/GCDMonoid/Nat.lean
67
68
theorem normalize_of_nonneg {z : ℤ} (h : 0 ≤ z) : normalize z = z := by
rw [normalize_apply, normUnit_eq, if_pos h, Units.val_one, mul_one]
1
import Mathlib.Data.Finset.Prod import Mathlib.Data.Sym.Basic import Mathlib.Data.Sym.Sym2.Init import Mathlib.Data.SetLike.Basic #align_import data.sym.sym2 from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1" assert_not_exists MonoidWithZero open Finset Function Sym universe u variable {α β γ : Type*} namespace Sym2 @[aesop (rule_sets := [Sym2]) [safe [constructors, cases], norm]] inductive Rel (α : Type u) : α × α → α × α → Prop | refl (x y : α) : Rel _ (x, y) (x, y) | swap (x y : α) : Rel _ (x, y) (y, x) #align sym2.rel Sym2.Rel #align sym2.rel.refl Sym2.Rel.refl #align sym2.rel.swap Sym2.Rel.swap attribute [refl] Rel.refl @[symm] theorem Rel.symm {x y : α × α} : Rel α x y → Rel α y x := by aesop (rule_sets := [Sym2]) #align sym2.rel.symm Sym2.Rel.symm @[trans] theorem Rel.trans {x y z : α × α} (a : Rel α x y) (b : Rel α y z) : Rel α x z := by aesop (rule_sets := [Sym2]) #align sym2.rel.trans Sym2.Rel.trans theorem Rel.is_equivalence : Equivalence (Rel α) := { refl := fun (x, y) ↦ Rel.refl x y, symm := Rel.symm, trans := Rel.trans } #align sym2.rel.is_equivalence Sym2.Rel.is_equivalence def Rel.setoid (α : Type u) : Setoid (α × α) := ⟨Rel α, Rel.is_equivalence⟩ #align sym2.rel.setoid Sym2.Rel.setoid @[simp] theorem rel_iff' {p q : α × α} : Rel α p q ↔ p = q ∨ p = q.swap := by aesop (rule_sets := [Sym2])
Mathlib/Data/Sym/Sym2.lean
91
92
theorem rel_iff {x y z w : α} : Rel α (x, y) (z, w) ↔ x = z ∧ y = w ∨ x = w ∧ y = z := by
simp
1
import Mathlib.MeasureTheory.Measure.Content import Mathlib.MeasureTheory.Group.Prod import Mathlib.Topology.Algebra.Group.Compact #align_import measure_theory.measure.haar.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Set Inv Function TopologicalSpace MeasurableSpace open scoped NNReal Classical ENNReal Pointwise Topology namespace MeasureTheory namespace Measure section Group variable {G : Type*} [Group G] namespace haar -- Porting note: Even in `noncomputable section`, a definition with `to_additive` require -- `noncomputable` to generate an additive definition. -- Please refer to leanprover/lean4#2077. @[to_additive addIndex "additive version of `MeasureTheory.Measure.haar.index`"] noncomputable def index (K V : Set G) : ℕ := sInf <| Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } #align measure_theory.measure.haar.index MeasureTheory.Measure.haar.index #align measure_theory.measure.haar.add_index MeasureTheory.Measure.haar.addIndex @[to_additive addIndex_empty] theorem index_empty {V : Set G} : index ∅ V = 0 := by simp only [index, Nat.sInf_eq_zero]; left; use ∅ simp only [Finset.card_empty, empty_subset, mem_setOf_eq, eq_self_iff_true, and_self_iff] #align measure_theory.measure.haar.index_empty MeasureTheory.Measure.haar.index_empty #align measure_theory.measure.haar.add_index_empty MeasureTheory.Measure.haar.addIndex_empty variable [TopologicalSpace G] @[to_additive "additive version of `MeasureTheory.Measure.haar.prehaar`"] noncomputable def prehaar (K₀ U : Set G) (K : Compacts G) : ℝ := (index (K : Set G) U : ℝ) / index K₀ U #align measure_theory.measure.haar.prehaar MeasureTheory.Measure.haar.prehaar #align measure_theory.measure.haar.add_prehaar MeasureTheory.Measure.haar.addPrehaar @[to_additive]
Mathlib/MeasureTheory/Measure/Haar/Basic.lean
122
123
theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by
rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div]
1
import Mathlib.Topology.Category.TopCat.Limits.Products #align_import topology.category.Top.limits.pullbacks from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" -- Porting note: every ML3 decl has an uppercase letter set_option linter.uppercaseLean3 false open TopologicalSpace open CategoryTheory open CategoryTheory.Limits universe v u w noncomputable section namespace TopCat variable {J : Type v} [SmallCategory J] section Pullback variable {X Y Z : TopCat.{u}} abbrev pullbackFst (f : X ⟶ Z) (g : Y ⟶ Z) : TopCat.of { p : X × Y // f p.1 = g p.2 } ⟶ X := ⟨Prod.fst ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_fst TopCat.pullbackFst lemma pullbackFst_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x) : pullbackFst f g x = x.1.1 := rfl abbrev pullbackSnd (f : X ⟶ Z) (g : Y ⟶ Z) : TopCat.of { p : X × Y // f p.1 = g p.2 } ⟶ Y := ⟨Prod.snd ∘ Subtype.val, by apply Continuous.comp <;> set_option tactic.skipAssignedInstances false in continuity⟩ #align Top.pullback_snd TopCat.pullbackSnd lemma pullbackSnd_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x) : pullbackSnd f g x = x.1.2 := rfl def pullbackCone (f : X ⟶ Z) (g : Y ⟶ Z) : PullbackCone f g := PullbackCone.mk (pullbackFst f g) (pullbackSnd f g) (by dsimp [pullbackFst, pullbackSnd, Function.comp_def] ext ⟨x, h⟩ -- Next 2 lines were -- `rw [comp_apply, ContinuousMap.coe_mk, comp_apply, ContinuousMap.coe_mk]` -- `exact h` before leanprover/lean4#2644 rw [comp_apply, comp_apply] congr!) #align Top.pullback_cone TopCat.pullbackCone def pullbackConeIsLimit (f : X ⟶ Z) (g : Y ⟶ Z) : IsLimit (pullbackCone f g) := PullbackCone.isLimitAux' _ (by intro S constructor; swap · exact { toFun := fun x => ⟨⟨S.fst x, S.snd x⟩, by simpa using ConcreteCategory.congr_hom S.condition x⟩ continuous_toFun := by apply Continuous.subtype_mk <| Continuous.prod_mk ?_ ?_ · exact (PullbackCone.fst S)|>.continuous_toFun · exact (PullbackCone.snd S)|>.continuous_toFun } refine ⟨?_, ?_, ?_⟩ · delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] · delta pullbackCone ext a -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [comp_apply, ContinuousMap.coe_mk] · intro m h₁ h₂ -- Porting note: used to be ext x apply ContinuousMap.ext; intro x apply Subtype.ext apply Prod.ext · simpa using ConcreteCategory.congr_hom h₁ x · simpa using ConcreteCategory.congr_hom h₂ x) #align Top.pullback_cone_is_limit TopCat.pullbackConeIsLimit def pullbackIsoProdSubtype (f : X ⟶ Z) (g : Y ⟶ Z) : pullback f g ≅ TopCat.of { p : X × Y // f p.1 = g p.2 } := (limit.isLimit _).conePointUniqueUpToIso (pullbackConeIsLimit f g) #align Top.pullback_iso_prod_subtype TopCat.pullbackIsoProdSubtype @[reassoc (attr := simp)] theorem pullbackIsoProdSubtype_inv_fst (f : X ⟶ Z) (g : Y ⟶ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.fst = pullbackFst f g := by simp [pullbackCone, pullbackIsoProdSubtype] #align Top.pullback_iso_prod_subtype_inv_fst TopCat.pullbackIsoProdSubtype_inv_fst theorem pullbackIsoProdSubtype_inv_fst_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x : { p : X × Y // f p.1 = g p.2 }) : (pullback.fst : pullback f g ⟶ _) ((pullbackIsoProdSubtype f g).inv x) = (x : X × Y).fst := ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_fst f g) x #align Top.pullback_iso_prod_subtype_inv_fst_apply TopCat.pullbackIsoProdSubtype_inv_fst_apply @[reassoc (attr := simp)] theorem pullbackIsoProdSubtype_inv_snd (f : X ⟶ Z) (g : Y ⟶ Z) : (pullbackIsoProdSubtype f g).inv ≫ pullback.snd = pullbackSnd f g := by simp [pullbackCone, pullbackIsoProdSubtype] #align Top.pullback_iso_prod_subtype_inv_snd TopCat.pullbackIsoProdSubtype_inv_snd theorem pullbackIsoProdSubtype_inv_snd_apply (f : X ⟶ Z) (g : Y ⟶ Z) (x : { p : X × Y // f p.1 = g p.2 }) : (pullback.snd : pullback f g ⟶ _) ((pullbackIsoProdSubtype f g).inv x) = (x : X × Y).snd := ConcreteCategory.congr_hom (pullbackIsoProdSubtype_inv_snd f g) x #align Top.pullback_iso_prod_subtype_inv_snd_apply TopCat.pullbackIsoProdSubtype_inv_snd_apply theorem pullbackIsoProdSubtype_hom_fst (f : X ⟶ Z) (g : Y ⟶ Z) : (pullbackIsoProdSubtype f g).hom ≫ pullbackFst f g = pullback.fst := by rw [← Iso.eq_inv_comp, pullbackIsoProdSubtype_inv_fst] #align Top.pullback_iso_prod_subtype_hom_fst TopCat.pullbackIsoProdSubtype_hom_fst
Mathlib/Topology/Category/TopCat/Limits/Pullbacks.lean
131
133
theorem pullbackIsoProdSubtype_hom_snd (f : X ⟶ Z) (g : Y ⟶ Z) : (pullbackIsoProdSubtype f g).hom ≫ pullbackSnd f g = pullback.snd := by
rw [← Iso.eq_inv_comp, pullbackIsoProdSubtype_inv_snd]
1
import Mathlib.Topology.Basic #align_import topology.nhds_set from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Filter Topology variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : Filter X} {s t s₁ s₂ t₁ t₂ : Set X} {x : X} theorem nhdsSet_diagonal (X) [TopologicalSpace (X × X)] : 𝓝ˢ (diagonal X) = ⨆ (x : X), 𝓝 (x, x) := by rw [nhdsSet, ← range_diag, ← range_comp] rfl #align nhds_set_diagonal nhdsSet_diagonal theorem mem_nhdsSet_iff_forall : s ∈ 𝓝ˢ t ↔ ∀ x : X, x ∈ t → s ∈ 𝓝 x := by simp_rw [nhdsSet, Filter.mem_sSup, forall_mem_image] #align mem_nhds_set_iff_forall mem_nhdsSet_iff_forall lemma nhdsSet_le : 𝓝ˢ s ≤ f ↔ ∀ x ∈ s, 𝓝 x ≤ f := by simp [nhdsSet] theorem bUnion_mem_nhdsSet {t : X → Set X} (h : ∀ x ∈ s, t x ∈ 𝓝 x) : (⋃ x ∈ s, t x) ∈ 𝓝ˢ s := mem_nhdsSet_iff_forall.2 fun x hx => mem_of_superset (h x hx) <| subset_iUnion₂ (s := fun x _ => t x) x hx -- Porting note: fails to find `s` #align bUnion_mem_nhds_set bUnion_mem_nhdsSet
Mathlib/Topology/NhdsSet.lean
52
53
theorem subset_interior_iff_mem_nhdsSet : s ⊆ interior t ↔ t ∈ 𝓝ˢ s := by
simp_rw [mem_nhdsSet_iff_forall, subset_interior_iff_nhds]
1
import Mathlib.Computability.Halting import Mathlib.Computability.TuringMachine import Mathlib.Data.Num.Lemmas import Mathlib.Tactic.DeriveFintype #align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" open Function (update) open Relation namespace Turing namespace ToPartrec inductive Code | zero' | succ | tail | cons : Code → Code → Code | comp : Code → Code → Code | case : Code → Code → Code | fix : Code → Code deriving DecidableEq, Inhabited #align turing.to_partrec.code Turing.ToPartrec.Code #align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero' #align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ #align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail #align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons #align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp #align turing.to_partrec.code.case Turing.ToPartrec.Code.case #align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix def Code.eval : Code → List ℕ →. List ℕ | Code.zero' => fun v => pure (0 :: v) | Code.succ => fun v => pure [v.headI.succ] | Code.tail => fun v => pure v.tail | Code.cons f fs => fun v => do let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) | Code.comp f g => fun v => g.eval v >>= f.eval | Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) | Code.fix f => PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail #align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval namespace Code @[simp] theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval] @[simp] theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval] @[simp] theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval] @[simp] theorem cons_eval (f fs) : (cons f fs).eval = fun v => do { let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) } := by simp [eval] @[simp] theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval] @[simp] theorem case_eval (f g) : (case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by simp [eval] @[simp] theorem fix_eval (f) : (fix f).eval = PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by simp [eval] def nil : Code := tail.comp succ #align turing.to_partrec.code.nil Turing.ToPartrec.Code.nil @[simp] theorem nil_eval (v) : nil.eval v = pure [] := by simp [nil] #align turing.to_partrec.code.nil_eval Turing.ToPartrec.Code.nil_eval def id : Code := tail.comp zero' #align turing.to_partrec.code.id Turing.ToPartrec.Code.id @[simp] theorem id_eval (v) : id.eval v = pure v := by simp [id] #align turing.to_partrec.code.id_eval Turing.ToPartrec.Code.id_eval def head : Code := cons id nil #align turing.to_partrec.code.head Turing.ToPartrec.Code.head @[simp]
Mathlib/Computability/TMToPartrec.lean
192
192
theorem head_eval (v) : head.eval v = pure [v.headI] := by
simp [head]
1
import Mathlib.Algebra.CharP.Invertible import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.normed_space.add_torsor from "leanprover-community/mathlib"@"837f72de63ad6cd96519cde5f1ffd5ed8d280ad0" noncomputable section open NNReal Topology open Filter variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P] [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] section NormedSpace variable {𝕜 : Type*} [NormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] open AffineMap theorem AffineSubspace.isClosed_direction_iff (s : AffineSubspace 𝕜 Q) : IsClosed (s.direction : Set W) ↔ IsClosed (s : Set Q) := by rcases s.eq_bot_or_nonempty with (rfl | ⟨x, hx⟩); · simp [isClosed_singleton] rw [← (IsometryEquiv.vaddConst x).toHomeomorph.symm.isClosed_image, AffineSubspace.coe_direction_eq_vsub_set_right hx] rfl #align affine_subspace.is_closed_direction_iff AffineSubspace.isClosed_direction_iff @[simp] theorem dist_center_homothety (p₁ p₂ : P) (c : 𝕜) : dist p₁ (homothety p₁ c p₂) = ‖c‖ * dist p₁ p₂ := by simp [homothety_def, norm_smul, ← dist_eq_norm_vsub, dist_comm] #align dist_center_homothety dist_center_homothety @[simp] theorem nndist_center_homothety (p₁ p₂ : P) (c : 𝕜) : nndist p₁ (homothety p₁ c p₂) = ‖c‖₊ * nndist p₁ p₂ := NNReal.eq <| dist_center_homothety _ _ _ #align nndist_center_homothety nndist_center_homothety @[simp] theorem dist_homothety_center (p₁ p₂ : P) (c : 𝕜) : dist (homothety p₁ c p₂) p₁ = ‖c‖ * dist p₁ p₂ := by rw [dist_comm, dist_center_homothety] #align dist_homothety_center dist_homothety_center @[simp] theorem nndist_homothety_center (p₁ p₂ : P) (c : 𝕜) : nndist (homothety p₁ c p₂) p₁ = ‖c‖₊ * nndist p₁ p₂ := NNReal.eq <| dist_homothety_center _ _ _ #align nndist_homothety_center nndist_homothety_center @[simp] theorem dist_lineMap_lineMap (p₁ p₂ : P) (c₁ c₂ : 𝕜) : dist (lineMap p₁ p₂ c₁) (lineMap p₁ p₂ c₂) = dist c₁ c₂ * dist p₁ p₂ := by rw [dist_comm p₁ p₂] simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right, ← sub_smul, norm_smul, vsub_eq_sub] #align dist_line_map_line_map dist_lineMap_lineMap @[simp] theorem nndist_lineMap_lineMap (p₁ p₂ : P) (c₁ c₂ : 𝕜) : nndist (lineMap p₁ p₂ c₁) (lineMap p₁ p₂ c₂) = nndist c₁ c₂ * nndist p₁ p₂ := NNReal.eq <| dist_lineMap_lineMap _ _ _ _ #align nndist_line_map_line_map nndist_lineMap_lineMap theorem lipschitzWith_lineMap (p₁ p₂ : P) : LipschitzWith (nndist p₁ p₂) (lineMap p₁ p₂ : 𝕜 → P) := LipschitzWith.of_dist_le_mul fun c₁ c₂ => ((dist_lineMap_lineMap p₁ p₂ c₁ c₂).trans (mul_comm _ _)).le #align lipschitz_with_line_map lipschitzWith_lineMap @[simp]
Mathlib/Analysis/NormedSpace/AddTorsor.lean
87
88
theorem dist_lineMap_left (p₁ p₂ : P) (c : 𝕜) : dist (lineMap p₁ p₂ c) p₁ = ‖c‖ * dist p₁ p₂ := by
simpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p₁ p₂ c 0
1
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Tactic.LinearCombination #align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946" namespace Polynomial.Chebyshev set_option linter.uppercaseLean3 false -- `T` `U` `X` open Polynomial variable (R S : Type*) [CommRing R] [CommRing S] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def T : ℤ → R[X] | 0 => 1 | 1 => X | (n : ℕ) + 2 => 2 * X * T (n + 1) - T n | -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.T Polynomial.Chebyshev.T @[elab_as_elim] protected theorem induct (motive : ℤ → Prop) (zero : motive 0) (one : motive 1) (add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2)) (neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) : ∀ (a : ℤ), motive a := T.induct Unit motive zero one add_two fun n hn hnm => by simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm @[simp] theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n | (k : ℕ) => T.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k #align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by linear_combination (norm := ring_nf) T_add_two R (n - 2) theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by linear_combination (norm := ring_nf) T_add_two R (n - 2) #align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq @[simp] theorem T_zero : T R 0 = 1 := rfl #align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero @[simp] theorem T_one : T R 1 = X := rfl #align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X)
Mathlib/RingTheory/Polynomial/Chebyshev.lean
113
114
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by
simpa [pow_two, mul_assoc] using T_add_two R 0
1
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic #align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Nat section Euler section Legendre open ZMod variable (p : ℕ) [Fact p.Prime] def legendreSym (a : ℤ) : ℤ := quadraticChar (ZMod p) a #align legendre_sym legendreSym namespace legendreSym theorem eq_pow (a : ℤ) : (legendreSym p a : ZMod p) = (a : ZMod p) ^ (p / 2) := by rcases eq_or_ne (ringChar (ZMod p)) 2 with hc | hc · by_cases ha : (a : ZMod p) = 0 · rw [legendreSym, ha, quadraticChar_zero, zero_pow (Nat.div_pos (@Fact.out p.Prime).two_le (succ_pos 1)).ne'] norm_cast · have := (ringChar_zmod_n p).symm.trans hc -- p = 2 subst p rw [legendreSym, quadraticChar_eq_one_of_char_two hc ha] revert ha push_cast generalize (a : ZMod 2) = b; fin_cases b · tauto · simp · convert quadraticChar_eq_pow_of_char_ne_two' hc (a : ZMod p) exact (card p).symm #align legendre_sym.eq_pow legendreSym.eq_pow theorem eq_one_or_neg_one {a : ℤ} (ha : (a : ZMod p) ≠ 0) : legendreSym p a = 1 ∨ legendreSym p a = -1 := quadraticChar_dichotomy ha #align legendre_sym.eq_one_or_neg_one legendreSym.eq_one_or_neg_one theorem eq_neg_one_iff_not_one {a : ℤ} (ha : (a : ZMod p) ≠ 0) : legendreSym p a = -1 ↔ ¬legendreSym p a = 1 := quadraticChar_eq_neg_one_iff_not_one ha #align legendre_sym.eq_neg_one_iff_not_one legendreSym.eq_neg_one_iff_not_one theorem eq_zero_iff (a : ℤ) : legendreSym p a = 0 ↔ (a : ZMod p) = 0 := quadraticChar_eq_zero_iff #align legendre_sym.eq_zero_iff legendreSym.eq_zero_iff @[simp] theorem at_zero : legendreSym p 0 = 0 := by rw [legendreSym, Int.cast_zero, MulChar.map_zero] #align legendre_sym.at_zero legendreSym.at_zero @[simp]
Mathlib/NumberTheory/LegendreSymbol/Basic.lean
156
156
theorem at_one : legendreSym p 1 = 1 := by
rw [legendreSym, Int.cast_one, MulChar.map_one]
1
import Mathlib.Algebra.BigOperators.Group.Multiset import Mathlib.Data.Multiset.Dedup #align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" assert_not_exists MonoidWithZero assert_not_exists MulAction universe v variable {α : Type*} {β : Type v} {γ δ : Type*} namespace Multiset def join : Multiset (Multiset α) → Multiset α := sum #align multiset.join Multiset.join theorem coe_join : ∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join | [] => rfl | l :: L => by exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L) #align multiset.coe_join Multiset.coe_join @[simp] theorem join_zero : @join α 0 = 0 := rfl #align multiset.join_zero Multiset.join_zero @[simp] theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S := sum_cons _ _ #align multiset.join_cons Multiset.join_cons @[simp] theorem join_add (S T) : @join α (S + T) = join S + join T := sum_add _ _ #align multiset.join_add Multiset.join_add @[simp] theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a := sum_singleton _ #align multiset.singleton_join Multiset.singleton_join @[simp] theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s := Multiset.induction_on S (by simp) <| by simp (config := { contextual := true }) [or_and_right, exists_or] #align multiset.mem_join Multiset.mem_join @[simp] theorem card_join (S) : card (@join α S) = sum (map card S) := Multiset.induction_on S (by simp) (by simp) #align multiset.card_join Multiset.card_join @[simp] theorem map_join (f : α → β) (S : Multiset (Multiset α)) : map f (join S) = join (map (map f) S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] @[to_additive (attr := simp)] theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} : prod (join S) = prod (map prod S) := by induction S using Multiset.induction with | empty => simp | cons _ _ ih => simp [ih] theorem rel_join {r : α → β → Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by induction h with | zero => simp | cons hab hst ih => simpa using hab.add ih #align multiset.rel_join Multiset.rel_join section Bind variable (a : α) (s t : Multiset α) (f g : α → Multiset β) def bind (s : Multiset α) (f : α → Multiset β) : Multiset β := (s.map f).join #align multiset.bind Multiset.bind @[simp] theorem coe_bind (l : List α) (f : α → List β) : (@bind α β l fun a => f a) = l.bind f := by rw [List.bind, ← coe_join, List.map_map] rfl #align multiset.coe_bind Multiset.coe_bind @[simp] theorem zero_bind : bind 0 f = 0 := rfl #align multiset.zero_bind Multiset.zero_bind @[simp]
Mathlib/Data/Multiset/Bind.lean
126
126
theorem cons_bind : (a ::ₘ s).bind f = f a + s.bind f := by
simp [bind]
1
import Mathlib.Data.Finset.Prod import Mathlib.Data.Set.Finite #align_import data.finset.n_ary from "leanprover-community/mathlib"@"eba7871095e834365616b5e43c8c7bb0b37058d0" open Function Set variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*} namespace Finset variable [DecidableEq α'] [DecidableEq β'] [DecidableEq γ] [DecidableEq γ'] [DecidableEq δ] [DecidableEq δ'] [DecidableEq ε] [DecidableEq ε'] {f f' : α → β → γ} {g g' : α → β → γ → δ} {s s' : Finset α} {t t' : Finset β} {u u' : Finset γ} {a a' : α} {b b' : β} {c : γ} def image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : Finset γ := (s ×ˢ t).image <| uncurry f #align finset.image₂ Finset.image₂ @[simp] theorem mem_image₂ : c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c := by simp [image₂, and_assoc] #align finset.mem_image₂ Finset.mem_image₂ @[simp, norm_cast] theorem coe_image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : (image₂ f s t : Set γ) = Set.image2 f s t := Set.ext fun _ => mem_image₂ #align finset.coe_image₂ Finset.coe_image₂ theorem card_image₂_le (f : α → β → γ) (s : Finset α) (t : Finset β) : (image₂ f s t).card ≤ s.card * t.card := card_image_le.trans_eq <| card_product _ _ #align finset.card_image₂_le Finset.card_image₂_le theorem card_image₂_iff : (image₂ f s t).card = s.card * t.card ↔ (s ×ˢ t : Set (α × β)).InjOn fun x => f x.1 x.2 := by rw [← card_product, ← coe_product] exact card_image_iff #align finset.card_image₂_iff Finset.card_image₂_iff theorem card_image₂ (hf : Injective2 f) (s : Finset α) (t : Finset β) : (image₂ f s t).card = s.card * t.card := (card_image_of_injective _ hf.uncurry).trans <| card_product _ _ #align finset.card_image₂ Finset.card_image₂ theorem mem_image₂_of_mem (ha : a ∈ s) (hb : b ∈ t) : f a b ∈ image₂ f s t := mem_image₂.2 ⟨a, ha, b, hb, rfl⟩ #align finset.mem_image₂_of_mem Finset.mem_image₂_of_mem
Mathlib/Data/Finset/NAry.lean
73
74
theorem mem_image₂_iff (hf : Injective2 f) : f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t := by
rw [← mem_coe, coe_image₂, mem_image2_iff hf, mem_coe, mem_coe]
1
import Mathlib.Analysis.NormedSpace.Multilinear.Basic import Mathlib.Analysis.NormedSpace.Units import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul #align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a" noncomputable section open Topology open Filter (Tendsto) open Metric ContinuousLinearMap variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends IsLinearMap 𝕜 f : Prop where bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖ #align is_bounded_linear_map IsBoundedLinearMap theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ) (h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f := ⟨hf, by_cases (fun (this : M ≤ 0) => ⟨1, zero_lt_one, fun x => (h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩) fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩ #align is_linear_map.with_bound IsLinearMap.with_bound theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f := { f.toLinearMap.isLinear with bound := f.bound } #align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap namespace IsBoundedLinearMap def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F := IsLinearMap.mk' _ h.toIsLinearMap #align is_bounded_linear_map.to_linear_map IsBoundedLinearMap.toLinearMap def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F := { toLinearMap f hf with cont := let ⟨C, _, hC⟩ := hf.bound AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC } #align is_bounded_linear_map.to_continuous_linear_map IsBoundedLinearMap.toContinuousLinearMap theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) := (0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl] #align is_bounded_linear_map.zero IsBoundedLinearMap.zero theorem id : IsBoundedLinearMap 𝕜 fun x : E => x := LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl] #align is_bounded_linear_map.id IsBoundedLinearMap.id theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_ rw [one_mul] exact le_max_left _ _ #align is_bounded_linear_map.fst IsBoundedLinearMap.fst theorem snd : IsBoundedLinearMap 𝕜 fun x : E × F => x.2 := by refine (LinearMap.snd 𝕜 E F).isLinear.with_bound 1 fun x => ?_ rw [one_mul] exact le_max_right _ _ #align is_bounded_linear_map.snd IsBoundedLinearMap.snd variable {f g : E → F} theorem smul (c : 𝕜) (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 (c • f) := let ⟨hlf, M, _, hM⟩ := hf (c • hlf.mk' f).isLinear.with_bound (‖c‖ * M) fun x => calc ‖c • f x‖ = ‖c‖ * ‖f x‖ := norm_smul c (f x) _ ≤ ‖c‖ * (M * ‖x‖) := mul_le_mul_of_nonneg_left (hM _) (norm_nonneg _) _ = ‖c‖ * M * ‖x‖ := (mul_assoc _ _ _).symm #align is_bounded_linear_map.smul IsBoundedLinearMap.smul theorem neg (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 fun e => -f e := by rw [show (fun e => -f e) = fun e => (-1 : 𝕜) • f e by funext; simp] exact smul (-1) hf #align is_bounded_linear_map.neg IsBoundedLinearMap.neg
Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean
144
151
theorem add (hf : IsBoundedLinearMap 𝕜 f) (hg : IsBoundedLinearMap 𝕜 g) : IsBoundedLinearMap 𝕜 fun e => f e + g e := let ⟨hlf, Mf, _, hMf⟩ := hf let ⟨hlg, Mg, _, hMg⟩ := hg (hlf.mk' _ + hlg.mk' _).isLinear.with_bound (Mf + Mg) fun x => calc ‖f x + g x‖ ≤ Mf * ‖x‖ + Mg * ‖x‖ := norm_add_le_of_le (hMf x) (hMg x) _ ≤ (Mf + Mg) * ‖x‖ := by
rw [add_mul]
1
import Mathlib.Combinatorics.SimpleGraph.Connectivity #align_import combinatorics.simple_graph.prod from "leanprover-community/mathlib"@"2985fa3c31a27274aed06c433510bc14b73d6488" variable {α β γ : Type*} namespace SimpleGraph -- Porting note: pruned variables to keep things out of local contexts, which -- can impact how generalization works, or what aesop does. variable {G : SimpleGraph α} {H : SimpleGraph β} def boxProd (G : SimpleGraph α) (H : SimpleGraph β) : SimpleGraph (α × β) where Adj x y := G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1 symm x y := by simp [and_comm, or_comm, eq_comm, adj_comm] loopless x := by simp #align simple_graph.box_prod SimpleGraph.boxProd infixl:70 " □ " => boxProd set_option autoImplicit true in @[simp] theorem boxProd_adj : (G □ H).Adj x y ↔ G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1 := Iff.rfl #align simple_graph.box_prod_adj SimpleGraph.boxProd_adj set_option autoImplicit true in --@[simp] Porting note (#10618): `simp` can prove
Mathlib/Combinatorics/SimpleGraph/Prod.lean
59
60
theorem boxProd_adj_left : (G □ H).Adj (a₁, b) (a₂, b) ↔ G.Adj a₁ a₂ := by
simp only [boxProd_adj, and_true, SimpleGraph.irrefl, false_and, or_false]
1
import Mathlib.Algebra.Group.Commute.Units import Mathlib.Algebra.Group.Int import Mathlib.Algebra.GroupWithZero.Semiconj import Mathlib.Data.Nat.GCD.Basic import Mathlib.Order.Bounds.Basic #align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47" namespace Nat def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ | 0, _, _, r', s', t' => (r', s', t') | succ k, s, t, r', s', t' => let q := r' / succ k xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t termination_by k => k decreasing_by exact mod_lt _ <| (succ_pos _).gt #align nat.xgcd_aux Nat.xgcdAux @[simp]
Mathlib/Data/Int/GCD.lean
48
48
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by
simp [xgcdAux]
1
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5" noncomputable section open scoped NNReal ENNReal Pointwise Topology open Inv Set Function MeasureTheory.Measure Filter open FiniteDimensional namespace MeasureTheory namespace Measure example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by infer_instance variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {s : Set E} theorem integral_comp_smul (f : E → F) (R : ℝ) : ∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by by_cases hF : CompleteSpace F; swap · simp [integral, hF] rcases eq_or_ne R 0 with (rfl | hR) · simp only [zero_smul, integral_const] rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE) · have : Subsingleton E := finrank_zero_iff.1 hE have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0] conv_rhs => rw [this] simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const] · have : Nontrivial E := finrank_pos_iff.1 hE simp only [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, ENNReal.top_toReal, zero_smul, inv_zero, abs_zero] · calc (∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ := (integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv f).symm _ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg] #align measure_theory.measure.integral_comp_smul MeasureTheory.Measure.integral_comp_smul theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} : ∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))] #align measure_theory.measure.integral_comp_smul_of_nonneg MeasureTheory.Measure.integral_comp_smul_of_nonneg
Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean
97
99
theorem integral_comp_inv_smul (f : E → F) (R : ℝ) : ∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv]
1
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.Data.Fintype.Card import Mathlib.GroupTheory.Perm.Basic #align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Equiv Finset namespace Equiv.Perm variable {α : Type*} section support section Set variable (p q : Perm α) theorem set_support_inv_eq : { x | p⁻¹ x ≠ x } = { x | p x ≠ x } := by ext x simp only [Set.mem_setOf_eq, Ne] rw [inv_def, symm_apply_eq, eq_comm] #align equiv.perm.set_support_inv_eq Equiv.Perm.set_support_inv_eq
Mathlib/GroupTheory/Perm/Support.lean
270
271
theorem set_support_apply_mem {p : Perm α} {a : α} : p a ∈ { x | p x ≠ x } ↔ a ∈ { x | p x ≠ x } := by
simp
1
import Mathlib.Algebra.Module.Equiv import Mathlib.Algebra.Module.Submodule.Basic import Mathlib.Algebra.PUnitInstances import Mathlib.Data.Set.Subsingleton #align_import algebra.module.submodule.lattice from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" universe v variable {R S M : Type*} section AddCommMonoid variable [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M] variable [SMul S R] [IsScalarTower S R M] variable {p q : Submodule R M} namespace Submodule instance : Bot (Submodule R M) := ⟨{ (⊥ : AddSubmonoid M) with carrier := {0} smul_mem' := by simp }⟩ instance inhabited' : Inhabited (Submodule R M) := ⟨⊥⟩ #align submodule.inhabited' Submodule.inhabited' @[simp] theorem bot_coe : ((⊥ : Submodule R M) : Set M) = {0} := rfl #align submodule.bot_coe Submodule.bot_coe @[simp] theorem bot_toAddSubmonoid : (⊥ : Submodule R M).toAddSubmonoid = ⊥ := rfl #align submodule.bot_to_add_submonoid Submodule.bot_toAddSubmonoid @[simp] lemma bot_toAddSubgroup {R M} [Ring R] [AddCommGroup M] [Module R M] : (⊥ : Submodule R M).toAddSubgroup = ⊥ := rfl variable (R) in @[simp] theorem mem_bot {x : M} : x ∈ (⊥ : Submodule R M) ↔ x = 0 := Set.mem_singleton_iff #align submodule.mem_bot Submodule.mem_bot instance uniqueBot : Unique (⊥ : Submodule R M) := ⟨inferInstance, fun x ↦ Subtype.ext <| (mem_bot R).1 x.mem⟩ #align submodule.unique_bot Submodule.uniqueBot instance : OrderBot (Submodule R M) where bot := ⊥ bot_le p x := by simp (config := { contextual := true }) [zero_mem] protected theorem eq_bot_iff (p : Submodule R M) : p = ⊥ ↔ ∀ x ∈ p, x = (0 : M) := ⟨fun h ↦ h.symm ▸ fun _ hx ↦ (mem_bot R).mp hx, fun h ↦ eq_bot_iff.mpr fun x hx ↦ (mem_bot R).mpr (h x hx)⟩ #align submodule.eq_bot_iff Submodule.eq_bot_iff @[ext high] protected theorem bot_ext (x y : (⊥ : Submodule R M)) : x = y := by rcases x with ⟨x, xm⟩; rcases y with ⟨y, ym⟩; congr rw [(Submodule.eq_bot_iff _).mp rfl x xm] rw [(Submodule.eq_bot_iff _).mp rfl y ym] #align submodule.bot_ext Submodule.bot_ext protected theorem ne_bot_iff (p : Submodule R M) : p ≠ ⊥ ↔ ∃ x ∈ p, x ≠ (0 : M) := by simp only [ne_eq, p.eq_bot_iff, not_forall, exists_prop] #align submodule.ne_bot_iff Submodule.ne_bot_iff theorem nonzero_mem_of_bot_lt {p : Submodule R M} (bot_lt : ⊥ < p) : ∃ a : p, a ≠ 0 := let ⟨b, hb₁, hb₂⟩ := p.ne_bot_iff.mp bot_lt.ne' ⟨⟨b, hb₁⟩, hb₂ ∘ congr_arg Subtype.val⟩ #align submodule.nonzero_mem_of_bot_lt Submodule.nonzero_mem_of_bot_lt theorem exists_mem_ne_zero_of_ne_bot {p : Submodule R M} (h : p ≠ ⊥) : ∃ b : M, b ∈ p ∧ b ≠ 0 := let ⟨b, hb₁, hb₂⟩ := p.ne_bot_iff.mp h ⟨b, hb₁, hb₂⟩ #align submodule.exists_mem_ne_zero_of_ne_bot Submodule.exists_mem_ne_zero_of_ne_bot -- FIXME: we default PUnit to PUnit.{1} here without the explicit universe annotation @[simps] def botEquivPUnit : (⊥ : Submodule R M) ≃ₗ[R] PUnit.{v+1} where toFun _ := PUnit.unit invFun _ := 0 map_add' _ _ := rfl map_smul' _ _ := rfl left_inv _ := Subsingleton.elim _ _ right_inv _ := rfl #align submodule.bot_equiv_punit Submodule.botEquivPUnit theorem subsingleton_iff_eq_bot : Subsingleton p ↔ p = ⊥ := by rw [subsingleton_iff, Submodule.eq_bot_iff] refine ⟨fun h x hx ↦ by simpa using h ⟨x, hx⟩ ⟨0, p.zero_mem⟩, fun h ⟨x, hx⟩ ⟨y, hy⟩ ↦ by simp [h x hx, h y hy]⟩ theorem eq_bot_of_subsingleton [Subsingleton p] : p = ⊥ := subsingleton_iff_eq_bot.mp inferInstance #align submodule.eq_bot_of_subsingleton Submodule.eq_bot_of_subsingleton
Mathlib/Algebra/Module/Submodule/Lattice.lean
131
132
theorem nontrivial_iff_ne_bot : Nontrivial p ↔ p ≠ ⊥ := by
rw [iff_not_comm, not_nontrivial_iff_subsingleton, subsingleton_iff_eq_bot]
1
import Mathlib.Data.Finset.Sum import Mathlib.Data.Sum.Order import Mathlib.Order.Interval.Finset.Defs #align_import data.sum.interval from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999" open Function Sum namespace Finset variable {α₁ α₂ β₁ β₂ γ₁ γ₂ : Type*} section SumLift₂ variable (f f₁ g₁ : α₁ → β₁ → Finset γ₁) (g f₂ g₂ : α₂ → β₂ → Finset γ₂) @[simp] def sumLift₂ : ∀ (_ : Sum α₁ α₂) (_ : Sum β₁ β₂), Finset (Sum γ₁ γ₂) | inl a, inl b => (f a b).map Embedding.inl | inl _, inr _ => ∅ | inr _, inl _ => ∅ | inr a, inr b => (g a b).map Embedding.inr #align finset.sum_lift₂ Finset.sumLift₂ variable {f f₁ g₁ g f₂ g₂} {a : Sum α₁ α₂} {b : Sum β₁ β₂} {c : Sum γ₁ γ₂} theorem mem_sumLift₂ : c ∈ sumLift₂ f g a b ↔ (∃ a₁ b₁ c₁, a = inl a₁ ∧ b = inl b₁ ∧ c = inl c₁ ∧ c₁ ∈ f a₁ b₁) ∨ ∃ a₂ b₂ c₂, a = inr a₂ ∧ b = inr b₂ ∧ c = inr c₂ ∧ c₂ ∈ g a₂ b₂ := by constructor · cases' a with a a <;> cases' b with b b · rw [sumLift₂, mem_map] rintro ⟨c, hc, rfl⟩ exact Or.inl ⟨a, b, c, rfl, rfl, rfl, hc⟩ · refine fun h ↦ (not_mem_empty _ h).elim · refine fun h ↦ (not_mem_empty _ h).elim · rw [sumLift₂, mem_map] rintro ⟨c, hc, rfl⟩ exact Or.inr ⟨a, b, c, rfl, rfl, rfl, hc⟩ · rintro (⟨a, b, c, rfl, rfl, rfl, h⟩ | ⟨a, b, c, rfl, rfl, rfl, h⟩) <;> exact mem_map_of_mem _ h #align finset.mem_sum_lift₂ Finset.mem_sumLift₂ theorem inl_mem_sumLift₂ {c₁ : γ₁} : inl c₁ ∈ sumLift₂ f g a b ↔ ∃ a₁ b₁, a = inl a₁ ∧ b = inl b₁ ∧ c₁ ∈ f a₁ b₁ := by rw [mem_sumLift₂, or_iff_left] · simp only [inl.injEq, exists_and_left, exists_eq_left'] rintro ⟨_, _, c₂, _, _, h, _⟩ exact inl_ne_inr h #align finset.inl_mem_sum_lift₂ Finset.inl_mem_sumLift₂ theorem inr_mem_sumLift₂ {c₂ : γ₂} : inr c₂ ∈ sumLift₂ f g a b ↔ ∃ a₂ b₂, a = inr a₂ ∧ b = inr b₂ ∧ c₂ ∈ g a₂ b₂ := by rw [mem_sumLift₂, or_iff_right] · simp only [inr.injEq, exists_and_left, exists_eq_left'] rintro ⟨_, _, c₂, _, _, h, _⟩ exact inr_ne_inl h #align finset.inr_mem_sum_lift₂ Finset.inr_mem_sumLift₂ theorem sumLift₂_eq_empty : sumLift₂ f g a b = ∅ ↔ (∀ a₁ b₁, a = inl a₁ → b = inl b₁ → f a₁ b₁ = ∅) ∧ ∀ a₂ b₂, a = inr a₂ → b = inr b₂ → g a₂ b₂ = ∅ := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · constructor <;> · rintro a b rfl rfl exact map_eq_empty.1 h cases a <;> cases b · exact map_eq_empty.2 (h.1 _ _ rfl rfl) · rfl · rfl · exact map_eq_empty.2 (h.2 _ _ rfl rfl) #align finset.sum_lift₂_eq_empty Finset.sumLift₂_eq_empty
Mathlib/Data/Sum/Interval.lean
91
95
theorem sumLift₂_nonempty : (sumLift₂ f g a b).Nonempty ↔ (∃ a₁ b₁, a = inl a₁ ∧ b = inl b₁ ∧ (f a₁ b₁).Nonempty) ∨ ∃ a₂ b₂, a = inr a₂ ∧ b = inr b₂ ∧ (g a₂ b₂).Nonempty := by
simp only [nonempty_iff_ne_empty, Ne, sumLift₂_eq_empty, not_and_or, not_forall, exists_prop]
1
import Mathlib.Algebra.ContinuedFractions.Basic import Mathlib.Algebra.GroupWithZero.Basic #align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction section WithDivisionRing variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K] theorem nth_cont_eq_succ_nth_cont_aux : g.continuants n = g.continuantsAux (n + 1) := rfl #align generalized_continued_fraction.nth_cont_eq_succ_nth_cont_aux GeneralizedContinuedFraction.nth_cont_eq_succ_nth_cont_aux theorem num_eq_conts_a : g.numerators n = (g.continuants n).a := rfl #align generalized_continued_fraction.num_eq_conts_a GeneralizedContinuedFraction.num_eq_conts_a theorem denom_eq_conts_b : g.denominators n = (g.continuants n).b := rfl #align generalized_continued_fraction.denom_eq_conts_b GeneralizedContinuedFraction.denom_eq_conts_b theorem convergent_eq_num_div_denom : g.convergents n = g.numerators n / g.denominators n := rfl #align generalized_continued_fraction.convergent_eq_num_div_denom GeneralizedContinuedFraction.convergent_eq_num_div_denom theorem convergent_eq_conts_a_div_conts_b : g.convergents n = (g.continuants n).a / (g.continuants n).b := rfl #align generalized_continued_fraction.convergent_eq_conts_a_div_conts_b GeneralizedContinuedFraction.convergent_eq_conts_a_div_conts_b theorem exists_conts_a_of_num {A : K} (nth_num_eq : g.numerators n = A) : ∃ conts, g.continuants n = conts ∧ conts.a = A := by simpa #align generalized_continued_fraction.exists_conts_a_of_num GeneralizedContinuedFraction.exists_conts_a_of_num theorem exists_conts_b_of_denom {B : K} (nth_denom_eq : g.denominators n = B) : ∃ conts, g.continuants n = conts ∧ conts.b = B := by simpa #align generalized_continued_fraction.exists_conts_b_of_denom GeneralizedContinuedFraction.exists_conts_b_of_denom @[simp] theorem zeroth_continuant_aux_eq_one_zero : g.continuantsAux 0 = ⟨1, 0⟩ := rfl #align generalized_continued_fraction.zeroth_continuant_aux_eq_one_zero GeneralizedContinuedFraction.zeroth_continuant_aux_eq_one_zero @[simp] theorem first_continuant_aux_eq_h_one : g.continuantsAux 1 = ⟨g.h, 1⟩ := rfl #align generalized_continued_fraction.first_continuant_aux_eq_h_one GeneralizedContinuedFraction.first_continuant_aux_eq_h_one @[simp] theorem zeroth_continuant_eq_h_one : g.continuants 0 = ⟨g.h, 1⟩ := rfl #align generalized_continued_fraction.zeroth_continuant_eq_h_one GeneralizedContinuedFraction.zeroth_continuant_eq_h_one @[simp] theorem zeroth_numerator_eq_h : g.numerators 0 = g.h := rfl #align generalized_continued_fraction.zeroth_numerator_eq_h GeneralizedContinuedFraction.zeroth_numerator_eq_h @[simp] theorem zeroth_denominator_eq_one : g.denominators 0 = 1 := rfl #align generalized_continued_fraction.zeroth_denominator_eq_one GeneralizedContinuedFraction.zeroth_denominator_eq_one @[simp] theorem zeroth_convergent_eq_h : g.convergents 0 = g.h := by simp [convergent_eq_num_div_denom, num_eq_conts_a, denom_eq_conts_b, div_one] #align generalized_continued_fraction.zeroth_convergent_eq_h GeneralizedContinuedFraction.zeroth_convergent_eq_h theorem second_continuant_aux_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.continuantsAux 2 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by simp [zeroth_s_eq, continuantsAux, nextContinuants, nextDenominator, nextNumerator] #align generalized_continued_fraction.second_continuant_aux_eq GeneralizedContinuedFraction.second_continuant_aux_eq theorem first_continuant_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.continuants 1 = ⟨gp.b * g.h + gp.a, gp.b⟩ := by simp [nth_cont_eq_succ_nth_cont_aux] -- Porting note (#10959): simp used to work here, but now it can't figure out that 1 + 1 = 2 convert second_continuant_aux_eq zeroth_s_eq #align generalized_continued_fraction.first_continuant_eq GeneralizedContinuedFraction.first_continuant_eq
Mathlib/Algebra/ContinuedFractions/Translations.lean
162
163
theorem first_numerator_eq {gp : Pair K} (zeroth_s_eq : g.s.get? 0 = some gp) : g.numerators 1 = gp.b * g.h + gp.a := by
simp [num_eq_conts_a, first_continuant_eq zeroth_s_eq]
1
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Deprecated.Submonoid #align_import deprecated.subgroup from "leanprover-community/mathlib"@"f93c11933efbc3c2f0299e47b8ff83e9b539cbf6" open Set Function variable {G : Type*} {H : Type*} {A : Type*} {a a₁ a₂ b c : G} section Group variable [Group G] [AddGroup A] structure IsAddSubgroup (s : Set A) extends IsAddSubmonoid s : Prop where neg_mem {a} : a ∈ s → -a ∈ s #align is_add_subgroup IsAddSubgroup @[to_additive] structure IsSubgroup (s : Set G) extends IsSubmonoid s : Prop where inv_mem {a} : a ∈ s → a⁻¹ ∈ s #align is_subgroup IsSubgroup @[to_additive]
Mathlib/Deprecated/Subgroup.lean
57
58
theorem IsSubgroup.div_mem {s : Set G} (hs : IsSubgroup s) {x y : G} (hx : x ∈ s) (hy : y ∈ s) : x / y ∈ s := by
simpa only [div_eq_mul_inv] using hs.mul_mem hx (hs.inv_mem hy)
1
import Mathlib.Algebra.Bounds import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Set open Pointwise variable {α : Type*} -- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice` -- due to simpNF problem between `sSup_xx` `csSup_xx`. section CompleteLattice variable [CompleteLattice α] section Group variable [Group α] [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] (s t : Set α) @[to_additive] theorem sSup_inv (s : Set α) : sSup s⁻¹ = (sInf s)⁻¹ := by rw [← image_inv, sSup_image] exact ((OrderIso.inv α).map_sInf _).symm #align Sup_inv sSup_inv #align Sup_neg sSup_neg @[to_additive] theorem sInf_inv (s : Set α) : sInf s⁻¹ = (sSup s)⁻¹ := by rw [← image_inv, sInf_image] exact ((OrderIso.inv α).map_sSup _).symm #align Inf_inv sInf_inv #align Inf_neg sInf_neg @[to_additive] theorem sSup_mul : sSup (s * t) = sSup s * sSup t := (sSup_image2_eq_sSup_sSup fun _ => (OrderIso.mulRight _).to_galoisConnection) fun _ => (OrderIso.mulLeft _).to_galoisConnection #align Sup_mul sSup_mul #align Sup_add sSup_add @[to_additive] theorem sInf_mul : sInf (s * t) = sInf s * sInf t := (sInf_image2_eq_sInf_sInf fun _ => (OrderIso.mulRight _).symm.to_galoisConnection) fun _ => (OrderIso.mulLeft _).symm.to_galoisConnection #align Inf_mul sInf_mul #align Inf_add sInf_add @[to_additive]
Mathlib/Algebra/Order/Pointwise.lean
89
89
theorem sSup_div : sSup (s / t) = sSup s / sInf t := by
simp_rw [div_eq_mul_inv, sSup_mul, sSup_inv]
1
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]
Mathlib/Data/List/DropRight.lean
47
47
theorem rdrop_nil : rdrop ([] : List α) n = [] := by
simp [rdrop]
1
import Mathlib.Topology.Metrizable.Basic import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Instances.Real def preCantorSet : ℕ → Set ℝ | 0 => Set.Icc 0 1 | n + 1 => (· / 3) '' preCantorSet n ∪ (fun x ↦ (2 + x) / 3) '' preCantorSet n @[simp] lemma preCantorSet_zero : preCantorSet 0 = Set.Icc 0 1 := rfl @[simp] lemma preCantorSet_succ (n : ℕ) : preCantorSet (n + 1) = (· / 3) '' preCantorSet n ∪ (fun x ↦ (2 + x) / 3) '' preCantorSet n := rfl def cantorSet : Set ℝ := ⋂ n, preCantorSet n lemma quarters_mem_preCantorSet (n : ℕ) : 1/4 ∈ preCantorSet n ∧ 3/4 ∈ preCantorSet n := by induction n with | zero => simp only [preCantorSet_zero, inv_nonneg] refine ⟨⟨ ?_, ?_⟩, ?_, ?_⟩ <;> norm_num | succ n ih => apply And.intro · -- goal: 1 / 4 ∈ preCantorSet (n + 1) -- follows by the inductive hyphothesis, since 3 / 4 ∈ preCantorSet n exact Or.inl ⟨3 / 4, ih.2, by norm_num⟩ · -- goal: 3 / 4 ∈ preCantorSet (n + 1) -- follows by the inductive hyphothesis, since 1 / 4 ∈ preCantorSet n exact Or.inr ⟨1 / 4, ih.1, by norm_num⟩ lemma quarter_mem_preCantorSet (n : ℕ) : 1/4 ∈ preCantorSet n := (quarters_mem_preCantorSet n).1 theorem quarter_mem_cantorSet : 1/4 ∈ cantorSet := Set.mem_iInter.mpr quarter_mem_preCantorSet lemma zero_mem_preCantorSet (n : ℕ) : 0 ∈ preCantorSet n := by induction n with | zero => simp [preCantorSet] | succ n ih => exact Or.inl ⟨0, ih, by simp only [zero_div]⟩
Mathlib/Topology/Instances/CantorSet.lean
75
75
theorem zero_mem_cantorSet : 0 ∈ cantorSet := by
simp [cantorSet, zero_mem_preCantorSet]
1
import Mathlib.NumberTheory.NumberField.Embeddings #align_import number_theory.number_field.units from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField noncomputable section open NumberField Units variable (K : Type*) [Field K] namespace NumberField.Units section coe instance : CoeHTC (𝓞 K)ˣ K := ⟨fun x => algebraMap _ K (Units.val x)⟩ theorem coe_injective : Function.Injective ((↑) : (𝓞 K)ˣ → K) := RingOfIntegers.coe_injective.comp Units.ext variable {K} theorem coe_coe (u : (𝓞 K)ˣ) : ((u : 𝓞 K) : K) = (u : K) := rfl theorem coe_mul (x y : (𝓞 K)ˣ) : ((x * y : (𝓞 K)ˣ) : K) = (x : K) * (y : K) := rfl
Mathlib/NumberTheory/NumberField/Units/Basic.lean
78
79
theorem coe_pow (x : (𝓞 K)ˣ) (n : ℕ) : ((x ^ n : (𝓞 K)ˣ) : K) = (x : K) ^ n := by
rw [← map_pow, ← val_pow_eq_pow_val]
1
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
Mathlib/Algebra/CharP/Two.lean
99
100
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]
1
import Mathlib.Analysis.SpecialFunctions.Complex.Log #align_import analysis.special_functions.pow.complex from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8" open scoped Classical open Real Topology Filter ComplexConjugate Finset Set namespace Complex noncomputable def cpow (x y : ℂ) : ℂ := if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) #align complex.cpow Complex.cpow noncomputable instance : Pow ℂ ℂ := ⟨cpow⟩ @[simp] theorem cpow_eq_pow (x y : ℂ) : cpow x y = x ^ y := rfl #align complex.cpow_eq_pow Complex.cpow_eq_pow theorem cpow_def (x y : ℂ) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := rfl #align complex.cpow_def Complex.cpow_def theorem cpow_def_of_ne_zero {x : ℂ} (hx : x ≠ 0) (y : ℂ) : x ^ y = exp (log x * y) := if_neg hx #align complex.cpow_def_of_ne_zero Complex.cpow_def_of_ne_zero @[simp]
Mathlib/Analysis/SpecialFunctions/Pow/Complex.lean
45
45
theorem cpow_zero (x : ℂ) : x ^ (0 : ℂ) = 1 := by
simp [cpow_def]
1
import Mathlib.Algebra.Ring.Semiconj import Mathlib.Algebra.Ring.Units import Mathlib.Algebra.Group.Commute.Defs import Mathlib.Data.Bracket #align_import algebra.ring.commute from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w x variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x} open Function namespace Commute @[simp] theorem add_right [Distrib R] {a b c : R} : Commute a b → Commute a c → Commute a (b + c) := SemiconjBy.add_right #align commute.add_right Commute.add_rightₓ -- for some reason mathport expected `Semiring` instead of `Distrib`? @[simp] theorem add_left [Distrib R] {a b c : R} : Commute a c → Commute b c → Commute (a + b) c := SemiconjBy.add_left #align commute.add_left Commute.add_leftₓ -- for some reason mathport expected `Semiring` instead of `Distrib`?
Mathlib/Algebra/Ring/Commute.lean
72
74
theorem mul_self_sub_mul_self_eq [NonUnitalNonAssocRing R] {a b : R} (h : Commute a b) : a * a - b * b = (a + b) * (a - b) := by
rw [add_mul, mul_sub, mul_sub, h.eq, sub_add_sub_cancel]
1
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.Dynamics.PeriodicPts import Mathlib.Data.Set.Pointwise.SMul namespace MulAction open Pointwise variable {α : Type*} variable {G : Type*} [Group G] [MulAction G α] variable {M : Type*} [Monoid M] [MulAction M α] section Pointwise @[to_additive "If a set `s : Set α` is in `fixedBy (Set α) g`, then all points of `s` will stay in `s` after being moved by `g`."]
Mathlib/GroupTheory/GroupAction/FixedPoints.lean
124
126
theorem set_mem_fixedBy_iff (s : Set α) (g : G) : s ∈ fixedBy (Set α) g ↔ ∀ x, g • x ∈ s ↔ x ∈ s := by
simp_rw [mem_fixedBy, ← eq_inv_smul_iff, Set.ext_iff, Set.mem_inv_smul_set_iff, Iff.comm]
1
import Mathlib.Data.Multiset.Bind #align_import data.multiset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset variable {α β : Type*} section Fold variable (op : α → α → α) [hc : Std.Commutative op] [ha : Std.Associative op] local notation a " * " b => op a b def fold : α → Multiset α → α := foldr op (left_comm _ hc.comm ha.assoc) #align multiset.fold Multiset.fold theorem fold_eq_foldr (b : α) (s : Multiset α) : fold op b s = foldr op (left_comm _ hc.comm ha.assoc) b s := rfl #align multiset.fold_eq_foldr Multiset.fold_eq_foldr @[simp] theorem coe_fold_r (b : α) (l : List α) : fold op b l = l.foldr op b := rfl #align multiset.coe_fold_r Multiset.coe_fold_r theorem coe_fold_l (b : α) (l : List α) : fold op b l = l.foldl op b := (coe_foldr_swap op _ b l).trans <| by simp [hc.comm] #align multiset.coe_fold_l Multiset.coe_fold_l theorem fold_eq_foldl (b : α) (s : Multiset α) : fold op b s = foldl op (right_comm _ hc.comm ha.assoc) b s := Quot.inductionOn s fun _ => coe_fold_l _ _ _ #align multiset.fold_eq_foldl Multiset.fold_eq_foldl @[simp] theorem fold_zero (b : α) : (0 : Multiset α).fold op b = b := rfl #align multiset.fold_zero Multiset.fold_zero @[simp] theorem fold_cons_left : ∀ (b a : α) (s : Multiset α), (a ::ₘ s).fold op b = a * s.fold op b := foldr_cons _ _ #align multiset.fold_cons_left Multiset.fold_cons_left theorem fold_cons_right (b a : α) (s : Multiset α) : (a ::ₘ s).fold op b = s.fold op b * a := by simp [hc.comm] #align multiset.fold_cons_right Multiset.fold_cons_right
Mathlib/Data/Multiset/Fold.lean
67
68
theorem fold_cons'_right (b a : α) (s : Multiset α) : (a ::ₘ s).fold op b = s.fold op (b * a) := by
rw [fold_eq_foldl, foldl_cons, ← fold_eq_foldl]
1
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]
Mathlib/GroupTheory/Coset.lean
111
112
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]
1
import Mathlib.Analysis.Normed.Group.Basic import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.AffineSpace.Midpoint #align_import analysis.normed.group.add_torsor from "leanprover-community/mathlib"@"837f72de63ad6cd96519cde5f1ffd5ed8d280ad0" noncomputable section open NNReal Topology open Filter class NormedAddTorsor (V : outParam Type*) (P : Type*) [SeminormedAddCommGroup V] [PseudoMetricSpace P] extends AddTorsor V P where dist_eq_norm' : ∀ x y : P, dist x y = ‖(x -ᵥ y : V)‖ #align normed_add_torsor NormedAddTorsor instance (priority := 100) NormedAddTorsor.toAddTorsor' {V P : Type*} [NormedAddCommGroup V] [MetricSpace P] [NormedAddTorsor V P] : AddTorsor V P := NormedAddTorsor.toAddTorsor #align normed_add_torsor.to_add_torsor' NormedAddTorsor.toAddTorsor' variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P] [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] instance (priority := 100) NormedAddTorsor.to_isometricVAdd : IsometricVAdd V P := ⟨fun c => Isometry.of_dist_eq fun x y => by -- porting note (#10745): was `simp [NormedAddTorsor.dist_eq_norm']` rw [NormedAddTorsor.dist_eq_norm', NormedAddTorsor.dist_eq_norm', vadd_vsub_vadd_cancel_left]⟩ #align normed_add_torsor.to_has_isometric_vadd NormedAddTorsor.to_isometricVAdd instance (priority := 100) SeminormedAddCommGroup.toNormedAddTorsor : NormedAddTorsor V V where dist_eq_norm' := dist_eq_norm #align seminormed_add_comm_group.to_normed_add_torsor SeminormedAddCommGroup.toNormedAddTorsor -- Because of the AddTorsor.nonempty instance. instance AffineSubspace.toNormedAddTorsor {R : Type*} [Ring R] [Module R V] (s : AffineSubspace R P) [Nonempty s] : NormedAddTorsor s.direction s := { AffineSubspace.toAddTorsor s with dist_eq_norm' := fun x y => NormedAddTorsor.dist_eq_norm' x.val y.val } #align affine_subspace.to_normed_add_torsor AffineSubspace.toNormedAddTorsor section variable (V W) theorem dist_eq_norm_vsub (x y : P) : dist x y = ‖x -ᵥ y‖ := NormedAddTorsor.dist_eq_norm' x y #align dist_eq_norm_vsub dist_eq_norm_vsub theorem nndist_eq_nnnorm_vsub (x y : P) : nndist x y = ‖x -ᵥ y‖₊ := NNReal.eq <| dist_eq_norm_vsub V x y #align nndist_eq_nnnorm_vsub nndist_eq_nnnorm_vsub theorem dist_eq_norm_vsub' (x y : P) : dist x y = ‖y -ᵥ x‖ := (dist_comm _ _).trans (dist_eq_norm_vsub _ _ _) #align dist_eq_norm_vsub' dist_eq_norm_vsub' theorem nndist_eq_nnnorm_vsub' (x y : P) : nndist x y = ‖y -ᵥ x‖₊ := NNReal.eq <| dist_eq_norm_vsub' V x y #align nndist_eq_nnnorm_vsub' nndist_eq_nnnorm_vsub' end theorem dist_vadd_cancel_left (v : V) (x y : P) : dist (v +ᵥ x) (v +ᵥ y) = dist x y := dist_vadd _ _ _ #align dist_vadd_cancel_left dist_vadd_cancel_left -- Porting note (#10756): new theorem theorem nndist_vadd_cancel_left (v : V) (x y : P) : nndist (v +ᵥ x) (v +ᵥ y) = nndist x y := NNReal.eq <| dist_vadd_cancel_left _ _ _ @[simp] theorem dist_vadd_cancel_right (v₁ v₂ : V) (x : P) : dist (v₁ +ᵥ x) (v₂ +ᵥ x) = dist v₁ v₂ := by rw [dist_eq_norm_vsub V, dist_eq_norm, vadd_vsub_vadd_cancel_right] #align dist_vadd_cancel_right dist_vadd_cancel_right @[simp] theorem nndist_vadd_cancel_right (v₁ v₂ : V) (x : P) : nndist (v₁ +ᵥ x) (v₂ +ᵥ x) = nndist v₁ v₂ := NNReal.eq <| dist_vadd_cancel_right _ _ _ #align nndist_vadd_cancel_right nndist_vadd_cancel_right @[simp] theorem dist_vadd_left (v : V) (x : P) : dist (v +ᵥ x) x = ‖v‖ := by -- porting note (#10745): was `simp [dist_eq_norm_vsub V _ x]` rw [dist_eq_norm_vsub V _ x, vadd_vsub] #align dist_vadd_left dist_vadd_left @[simp] theorem nndist_vadd_left (v : V) (x : P) : nndist (v +ᵥ x) x = ‖v‖₊ := NNReal.eq <| dist_vadd_left _ _ #align nndist_vadd_left nndist_vadd_left @[simp]
Mathlib/Analysis/Normed/Group/AddTorsor.lean
125
125
theorem dist_vadd_right (v : V) (x : P) : dist x (v +ᵥ x) = ‖v‖ := by
rw [dist_comm, dist_vadd_left]
1
import Batteries.Tactic.Init import Batteries.Tactic.Alias import Batteries.Tactic.Lint.Misc instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) := inferInstanceAs <| DecidablePred fun x => p (f x) @[deprecated] alias proofIrrel := proof_irrel theorem Function.id_def : @id α = fun x => x := rfl alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩ @[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') : (@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β} (hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) : f a b = g a b := congrFun (congrFun h _) _ theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) : f a b c = g a b c := congrFun₂ (congrFun h _) _ _ theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g := funext fun _ => funext <| h _ theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g := funext fun _ => funext₂ <| h _ theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a := ⟨congrFun, funext⟩ theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y := mt <| congrArg _ protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by subst h₁; subst h₂; rfl theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by rw [h]
.lake/packages/batteries/Batteries/Logic.lean
74
74
theorem Eq.congr_right {x y z : α} (h : x = y) : z = x ↔ z = y := by
rw [h]
1
import Mathlib.Topology.Algebra.UniformConvergence #align_import topology.algebra.module.strong_topology from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" open scoped Topology UniformConvergence section General variable {𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) {E E' F F' : Type*} [AddCommGroup E] [Module 𝕜₁ E] [AddCommGroup E'] [Module ℝ E'] [AddCommGroup F] [Module 𝕜₂ F] [AddCommGroup F'] [Module ℝ F'] [TopologicalSpace E] [TopologicalSpace E'] (F) @[nolint unusedArguments] def UniformConvergenceCLM [TopologicalSpace F] [TopologicalAddGroup F] (_ : Set (Set E)) := E →SL[σ] F namespace UniformConvergenceCLM instance instFunLike [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : FunLike (UniformConvergenceCLM σ F 𝔖) E F := ContinuousLinearMap.funLike instance instContinuousSemilinearMapClass [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : ContinuousSemilinearMapClass (UniformConvergenceCLM σ F 𝔖) σ E F := ContinuousLinearMap.continuousSemilinearMapClass instance instTopologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) : TopologicalSpace (UniformConvergenceCLM σ F 𝔖) := (@UniformOnFun.topologicalSpace E F (TopologicalAddGroup.toUniformSpace F) 𝔖).induced (DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F)) #align continuous_linear_map.strong_topology UniformConvergenceCLM.instTopologicalSpace theorem topologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : instTopologicalSpace σ F 𝔖 = TopologicalSpace.induced DFunLike.coe (UniformOnFun.topologicalSpace E F 𝔖) := by rw [instTopologicalSpace] congr exact UniformAddGroup.toUniformSpace_eq instance instUniformSpace [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : UniformSpace (UniformConvergenceCLM σ F 𝔖) := UniformSpace.replaceTopology ((UniformOnFun.uniformSpace E F 𝔖).comap (DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F))) (by rw [UniformConvergenceCLM.instTopologicalSpace, UniformAddGroup.toUniformSpace_eq]; rfl) #align continuous_linear_map.strong_uniformity UniformConvergenceCLM.instUniformSpace
Mathlib/Topology/Algebra/Module/StrongTopology.lean
113
115
theorem uniformSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) : instUniformSpace σ F 𝔖 = UniformSpace.comap DFunLike.coe (UniformOnFun.uniformSpace E F 𝔖) := by
rw [instUniformSpace, UniformSpace.replaceTopology_eq]
1
import Mathlib.Algebra.Group.Subgroup.MulOpposite import Mathlib.Algebra.Group.Submonoid.Pointwise import Mathlib.GroupTheory.GroupAction.ConjAct #align_import group_theory.subgroup.pointwise from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802" open Set open Pointwise variable {α G A S : Type*} @[to_additive (attr := simp, norm_cast)] theorem inv_coe_set [InvolutiveInv G] [SetLike S G] [InvMemClass S G] {H : S} : (H : Set G)⁻¹ = H := Set.ext fun _ => inv_mem_iff #align inv_coe_set inv_coe_set #align neg_coe_set neg_coe_set @[to_additive (attr := simp)] lemma smul_coe_set [Group G] [SetLike S G] [SubgroupClass S G] {s : S} {a : G} (ha : a ∈ s) : a • (s : Set G) = s := by ext; simp [Set.mem_smul_set_iff_inv_smul_mem, mul_mem_cancel_left, ha] @[to_additive (attr := simp)] lemma op_smul_coe_set [Group G] [SetLike S G] [SubgroupClass S G] {s : S} {a : G} (ha : a ∈ s) : MulOpposite.op a • (s : Set G) = s := by ext; simp [Set.mem_smul_set_iff_inv_smul_mem, mul_mem_cancel_right, ha] @[to_additive (attr := simp, norm_cast)] lemma coe_mul_coe [SetLike S G] [DivInvMonoid G] [SubgroupClass S G] (H : S) : H * H = (H : Set G) := by aesop (add simp mem_mul) @[to_additive (attr := simp, norm_cast)] lemma coe_div_coe [SetLike S G] [DivisionMonoid G] [SubgroupClass S G] (H : S) : H / H = (H : Set G) := by simp [div_eq_mul_inv] variable [Group G] [AddGroup A] {s : Set G} namespace Subgroup @[to_additive (attr := simp)] theorem inv_subset_closure (S : Set G) : S⁻¹ ⊆ closure S := fun s hs => by rw [SetLike.mem_coe, ← Subgroup.inv_mem_iff] exact subset_closure (mem_inv.mp hs) #align subgroup.inv_subset_closure Subgroup.inv_subset_closure #align add_subgroup.neg_subset_closure AddSubgroup.neg_subset_closure @[to_additive] theorem closure_toSubmonoid (S : Set G) : (closure S).toSubmonoid = Submonoid.closure (S ∪ S⁻¹) := by refine le_antisymm (fun x hx => ?_) (Submonoid.closure_le.2 ?_) · refine closure_induction hx (fun x hx => Submonoid.closure_mono subset_union_left (Submonoid.subset_closure hx)) (Submonoid.one_mem _) (fun x y hx hy => Submonoid.mul_mem _ hx hy) fun x hx => ?_ rwa [← Submonoid.mem_closure_inv, Set.union_inv, inv_inv, Set.union_comm] · simp only [true_and_iff, coe_toSubmonoid, union_subset_iff, subset_closure, inv_subset_closure] #align subgroup.closure_to_submonoid Subgroup.closure_toSubmonoid #align add_subgroup.closure_to_add_submonoid AddSubgroup.closure_toAddSubmonoid @[to_additive (attr := elab_as_elim) "For additive subgroups generated by a single element, see the simpler `zsmul_induction_left`."] theorem closure_induction_left {p : (x : G) → x ∈ closure s → Prop} (one : p 1 (one_mem _)) (mul_left : ∀ x (hx : x ∈ s), ∀ (y) hy, p y hy → p (x * y) (mul_mem (subset_closure hx) hy)) (mul_left_inv : ∀ x (hx : x ∈ s), ∀ (y) hy, p y hy → p (x⁻¹ * y) (mul_mem (inv_mem (subset_closure hx)) hy)) {x : G} (h : x ∈ closure s) : p x h := by revert h simp_rw [← mem_toSubmonoid, closure_toSubmonoid] at * intro h induction h using Submonoid.closure_induction_left with | one => exact one | mul_left x hx y hy ih => cases hx with | inl hx => exact mul_left _ hx _ hy ih | inr hx => simpa only [inv_inv] using mul_left_inv _ hx _ hy ih #align subgroup.closure_induction_left Subgroup.closure_induction_left #align add_subgroup.closure_induction_left AddSubgroup.closure_induction_left @[to_additive (attr := elab_as_elim) "For additive subgroups generated by a single element, see the simpler `zsmul_induction_right`."] theorem closure_induction_right {p : (x : G) → x ∈ closure s → Prop} (one : p 1 (one_mem _)) (mul_right : ∀ (x) hx, ∀ y (hy : y ∈ s), p x hx → p (x * y) (mul_mem hx (subset_closure hy))) (mul_right_inv : ∀ (x) hx, ∀ y (hy : y ∈ s), p x hx → p (x * y⁻¹) (mul_mem hx (inv_mem (subset_closure hy)))) {x : G} (h : x ∈ closure s) : p x h := closure_induction_left (s := MulOpposite.unop ⁻¹' s) (p := fun m hm => p m.unop <| by rwa [← op_closure] at hm) one (fun _x hx _y hy => mul_right _ _ _ hx) (fun _x hx _y hy => mul_right_inv _ _ _ hx) (by rwa [← op_closure]) #align subgroup.closure_induction_right Subgroup.closure_induction_right #align add_subgroup.closure_induction_right AddSubgroup.closure_induction_right @[to_additive (attr := simp)]
Mathlib/Algebra/Group/Subgroup/Pointwise.lean
125
126
theorem closure_inv (s : Set G) : closure s⁻¹ = closure s := by
simp only [← toSubmonoid_eq, closure_toSubmonoid, inv_inv, union_comm]
1
import Mathlib.Combinatorics.SimpleGraph.Dart import Mathlib.Data.FunLike.Fintype open Function namespace SimpleGraph variable {V W X : Type*} (G : SimpleGraph V) (G' : SimpleGraph W) {u v : V} protected def map (f : V ↪ W) (G : SimpleGraph V) : SimpleGraph W where Adj := Relation.Map G.Adj f f symm a b := by -- Porting note: `obviously` used to handle this rintro ⟨v, w, h, rfl, rfl⟩ use w, v, h.symm, rfl loopless a := by -- Porting note: `obviously` used to handle this rintro ⟨v, w, h, rfl, h'⟩ exact h.ne (f.injective h'.symm) #align simple_graph.map SimpleGraph.map instance instDecidableMapAdj {f : V ↪ W} {a b} [Decidable (Relation.Map G.Adj f f a b)] : Decidable ((G.map f).Adj a b) := ‹Decidable (Relation.Map G.Adj f f a b)› #align simple_graph.decidable_map SimpleGraph.instDecidableMapAdj @[simp] theorem map_adj (f : V ↪ W) (G : SimpleGraph V) (u v : W) : (G.map f).Adj u v ↔ ∃ u' v' : V, G.Adj u' v' ∧ f u' = u ∧ f v' = v := Iff.rfl #align simple_graph.map_adj SimpleGraph.map_adj lemma map_adj_apply {G : SimpleGraph V} {f : V ↪ W} {a b : V} : (G.map f).Adj (f a) (f b) ↔ G.Adj a b := by simp #align simple_graph.map_adj_apply SimpleGraph.map_adj_apply theorem map_monotone (f : V ↪ W) : Monotone (SimpleGraph.map f) := by rintro G G' h _ _ ⟨u, v, ha, rfl, rfl⟩ exact ⟨_, _, h ha, rfl, rfl⟩ #align simple_graph.map_monotone SimpleGraph.map_monotone @[simp] lemma map_id : G.map (Function.Embedding.refl _) = G := SimpleGraph.ext _ _ <| Relation.map_id_id _ #align simple_graph.map_id SimpleGraph.map_id @[simp] lemma map_map (f : V ↪ W) (g : W ↪ X) : (G.map f).map g = G.map (f.trans g) := SimpleGraph.ext _ _ <| Relation.map_map _ _ _ _ _ #align simple_graph.map_map SimpleGraph.map_map protected def comap (f : V → W) (G : SimpleGraph W) : SimpleGraph V where Adj u v := G.Adj (f u) (f v) symm _ _ h := h.symm loopless _ := G.loopless _ #align simple_graph.comap SimpleGraph.comap @[simp] lemma comap_adj {G : SimpleGraph W} {f : V → W} : (G.comap f).Adj u v ↔ G.Adj (f u) (f v) := Iff.rfl @[simp] lemma comap_id {G : SimpleGraph V} : G.comap id = G := SimpleGraph.ext _ _ rfl #align simple_graph.comap_id SimpleGraph.comap_id @[simp] lemma comap_comap {G : SimpleGraph X} (f : V → W) (g : W → X) : (G.comap g).comap f = G.comap (g ∘ f) := rfl #align simple_graph.comap_comap SimpleGraph.comap_comap instance instDecidableComapAdj (f : V → W) (G : SimpleGraph W) [DecidableRel G.Adj] : DecidableRel (G.comap f).Adj := fun _ _ ↦ ‹DecidableRel G.Adj› _ _ lemma comap_symm (G : SimpleGraph V) (e : V ≃ W) : G.comap e.symm.toEmbedding = G.map e.toEmbedding := by ext; simp only [Equiv.apply_eq_iff_eq_symm_apply, comap_adj, map_adj, Equiv.toEmbedding_apply, exists_eq_right_right, exists_eq_right] #align simple_graph.comap_symm SimpleGraph.comap_symm lemma map_symm (G : SimpleGraph W) (e : V ≃ W) : G.map e.symm.toEmbedding = G.comap e.toEmbedding := by rw [← comap_symm, e.symm_symm] #align simple_graph.map_symm SimpleGraph.map_symm theorem comap_monotone (f : V ↪ W) : Monotone (SimpleGraph.comap f) := by intro G G' h _ _ ha exact h ha #align simple_graph.comap_monotone SimpleGraph.comap_monotone @[simp] theorem comap_map_eq (f : V ↪ W) (G : SimpleGraph V) : (G.map f).comap f = G := by ext simp #align simple_graph.comap_map_eq SimpleGraph.comap_map_eq theorem leftInverse_comap_map (f : V ↪ W) : Function.LeftInverse (SimpleGraph.comap f) (SimpleGraph.map f) := comap_map_eq f #align simple_graph.left_inverse_comap_map SimpleGraph.leftInverse_comap_map theorem map_injective (f : V ↪ W) : Function.Injective (SimpleGraph.map f) := (leftInverse_comap_map f).injective #align simple_graph.map_injective SimpleGraph.map_injective theorem comap_surjective (f : V ↪ W) : Function.Surjective (SimpleGraph.comap f) := (leftInverse_comap_map f).surjective #align simple_graph.comap_surjective SimpleGraph.comap_surjective theorem map_le_iff_le_comap (f : V ↪ W) (G : SimpleGraph V) (G' : SimpleGraph W) : G.map f ≤ G' ↔ G ≤ G'.comap f := ⟨fun h u v ha => h ⟨_, _, ha, rfl, rfl⟩, by rintro h _ _ ⟨u, v, ha, rfl, rfl⟩ exact h ha⟩ #align simple_graph.map_le_iff_le_comap SimpleGraph.map_le_iff_le_comap
Mathlib/Combinatorics/SimpleGraph/Maps.lean
154
155
theorem map_comap_le (f : V ↪ W) (G : SimpleGraph W) : (G.comap f).map f ≤ G := by
rw [map_le_iff_le_comap]
1
import Mathlib.Data.Finset.Prod import Mathlib.Data.Set.Finite #align_import data.finset.n_ary from "leanprover-community/mathlib"@"eba7871095e834365616b5e43c8c7bb0b37058d0" open Function Set variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*} namespace Finset variable [DecidableEq α'] [DecidableEq β'] [DecidableEq γ] [DecidableEq γ'] [DecidableEq δ] [DecidableEq δ'] [DecidableEq ε] [DecidableEq ε'] {f f' : α → β → γ} {g g' : α → β → γ → δ} {s s' : Finset α} {t t' : Finset β} {u u' : Finset γ} {a a' : α} {b b' : β} {c : γ} def image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : Finset γ := (s ×ˢ t).image <| uncurry f #align finset.image₂ Finset.image₂ @[simp] theorem mem_image₂ : c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c := by simp [image₂, and_assoc] #align finset.mem_image₂ Finset.mem_image₂ @[simp, norm_cast] theorem coe_image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : (image₂ f s t : Set γ) = Set.image2 f s t := Set.ext fun _ => mem_image₂ #align finset.coe_image₂ Finset.coe_image₂ theorem card_image₂_le (f : α → β → γ) (s : Finset α) (t : Finset β) : (image₂ f s t).card ≤ s.card * t.card := card_image_le.trans_eq <| card_product _ _ #align finset.card_image₂_le Finset.card_image₂_le theorem card_image₂_iff : (image₂ f s t).card = s.card * t.card ↔ (s ×ˢ t : Set (α × β)).InjOn fun x => f x.1 x.2 := by rw [← card_product, ← coe_product] exact card_image_iff #align finset.card_image₂_iff Finset.card_image₂_iff theorem card_image₂ (hf : Injective2 f) (s : Finset α) (t : Finset β) : (image₂ f s t).card = s.card * t.card := (card_image_of_injective _ hf.uncurry).trans <| card_product _ _ #align finset.card_image₂ Finset.card_image₂ theorem mem_image₂_of_mem (ha : a ∈ s) (hb : b ∈ t) : f a b ∈ image₂ f s t := mem_image₂.2 ⟨a, ha, b, hb, rfl⟩ #align finset.mem_image₂_of_mem Finset.mem_image₂_of_mem theorem mem_image₂_iff (hf : Injective2 f) : f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t := by rw [← mem_coe, coe_image₂, mem_image2_iff hf, mem_coe, mem_coe] #align finset.mem_image₂_iff Finset.mem_image₂_iff theorem image₂_subset (hs : s ⊆ s') (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s' t' := by rw [← coe_subset, coe_image₂, coe_image₂] exact image2_subset hs ht #align finset.image₂_subset Finset.image₂_subset theorem image₂_subset_left (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s t' := image₂_subset Subset.rfl ht #align finset.image₂_subset_left Finset.image₂_subset_left theorem image₂_subset_right (hs : s ⊆ s') : image₂ f s t ⊆ image₂ f s' t := image₂_subset hs Subset.rfl #align finset.image₂_subset_right Finset.image₂_subset_right theorem image_subset_image₂_left (hb : b ∈ t) : s.image (fun a => f a b) ⊆ image₂ f s t := image_subset_iff.2 fun _ ha => mem_image₂_of_mem ha hb #align finset.image_subset_image₂_left Finset.image_subset_image₂_left theorem image_subset_image₂_right (ha : a ∈ s) : t.image (fun b => f a b) ⊆ image₂ f s t := image_subset_iff.2 fun _ => mem_image₂_of_mem ha #align finset.image_subset_image₂_right Finset.image_subset_image₂_right theorem forall_image₂_iff {p : γ → Prop} : (∀ z ∈ image₂ f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) := by simp_rw [← mem_coe, coe_image₂, forall_image2_iff] #align finset.forall_image₂_iff Finset.forall_image₂_iff @[simp] theorem image₂_subset_iff : image₂ f s t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, f x y ∈ u := forall_image₂_iff #align finset.image₂_subset_iff Finset.image₂_subset_iff
Mathlib/Data/Finset/NAry.lean
108
109
theorem image₂_subset_iff_left : image₂ f s t ⊆ u ↔ ∀ a ∈ s, (t.image fun b => f a b) ⊆ u := by
simp_rw [image₂_subset_iff, image_subset_iff]
1
import Mathlib.Init.Function #align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb" universe u open Function namespace Option variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ} def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ := a.bind fun a => b.map <| f a #align option.map₂ Option.map₂ theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) : map₂ f a b = f <$> a <*> b := by cases a <;> rfl #align option.map₂_def Option.map₂_def -- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl #align option.map₂_some_some Option.map₂_some_some theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl #align option.map₂_coe_coe Option.map₂_coe_coe @[simp] theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl #align option.map₂_none_left Option.map₂_none_left @[simp] theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl #align option.map₂_none_right Option.map₂_none_right @[simp] theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b := rfl #align option.map₂_coe_left Option.map₂_coe_left -- Porting note: This proof was `rfl` in Lean3, but now is not. @[simp] theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) : map₂ f a b = a.map fun a => f a b := by cases a <;> rfl #align option.map₂_coe_right Option.map₂_coe_right -- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal. theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by simp [map₂, bind_eq_some] #align option.mem_map₂_iff Option.mem_map₂_iff @[simp] theorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by cases a <;> cases b <;> simp #align option.map₂_eq_none_iff Option.map₂_eq_none_iff
Mathlib/Data/Option/NAry.lean
87
88
theorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) : map₂ f a b = map₂ (fun a b => f b a) b a := by
cases a <;> cases b <;> rfl
1
import Mathlib.MeasureTheory.Function.LpOrder #align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f" noncomputable section open scoped Classical open Topology ENNReal MeasureTheory NNReal open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory variable {α β γ δ : Type*} {m : MeasurableSpace α} {μ ν : Measure α} [MeasurableSpace δ] variable [NormedAddCommGroup β] variable [NormedAddCommGroup γ] namespace MeasureTheory theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [edist_eq_coe_nnnorm] #align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist theorem lintegral_norm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm] #align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist theorem lintegral_edist_triangle {f g h : α → β} (hf : AEStronglyMeasurable f μ) (hh : AEStronglyMeasurable h μ) : (∫⁻ a, edist (f a) (g a) ∂μ) ≤ (∫⁻ a, edist (f a) (h a) ∂μ) + ∫⁻ a, edist (g a) (h a) ∂μ := by rw [← lintegral_add_left' (hf.edist hh)] refine lintegral_mono fun a => ?_ apply edist_triangle_right #align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle theorem lintegral_nnnorm_zero : (∫⁻ _ : α, ‖(0 : β)‖₊ ∂μ) = 0 := by simp #align measure_theory.lintegral_nnnorm_zero MeasureTheory.lintegral_nnnorm_zero theorem lintegral_nnnorm_add_left {f : α → β} (hf : AEStronglyMeasurable f μ) (g : α → γ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_left' hf.ennnorm _ #align measure_theory.lintegral_nnnorm_add_left MeasureTheory.lintegral_nnnorm_add_left theorem lintegral_nnnorm_add_right (f : α → β) {g : α → γ} (hg : AEStronglyMeasurable g μ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_right' _ hg.ennnorm #align measure_theory.lintegral_nnnorm_add_right MeasureTheory.lintegral_nnnorm_add_right theorem lintegral_nnnorm_neg {f : α → β} : (∫⁻ a, ‖(-f) a‖₊ ∂μ) = ∫⁻ a, ‖f a‖₊ ∂μ := by simp only [Pi.neg_apply, nnnorm_neg] #align measure_theory.lintegral_nnnorm_neg MeasureTheory.lintegral_nnnorm_neg def HasFiniteIntegral {_ : MeasurableSpace α} (f : α → β) (μ : Measure α := by volume_tac) : Prop := (∫⁻ a, ‖f a‖₊ ∂μ) < ∞ #align measure_theory.has_finite_integral MeasureTheory.HasFiniteIntegral theorem hasFiniteIntegral_def {_ : MeasurableSpace α} (f : α → β) (μ : Measure α) : HasFiniteIntegral f μ ↔ ((∫⁻ a, ‖f a‖₊ ∂μ) < ∞) := Iff.rfl theorem hasFiniteIntegral_iff_norm (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ) < ∞ := by simp only [HasFiniteIntegral, ofReal_norm_eq_coe_nnnorm] #align measure_theory.has_finite_integral_iff_norm MeasureTheory.hasFiniteIntegral_iff_norm theorem hasFiniteIntegral_iff_edist (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, edist (f a) 0 ∂μ) < ∞ := by simp only [hasFiniteIntegral_iff_norm, edist_dist, dist_zero_right] #align measure_theory.has_finite_integral_iff_edist MeasureTheory.hasFiniteIntegral_iff_edist
Mathlib/MeasureTheory/Function/L1Space.lean
123
125
theorem hasFiniteIntegral_iff_ofReal {f : α → ℝ} (h : 0 ≤ᵐ[μ] f) : HasFiniteIntegral f μ ↔ (∫⁻ a, ENNReal.ofReal (f a) ∂μ) < ∞ := by
rw [HasFiniteIntegral, lintegral_nnnorm_eq_of_ae_nonneg h]
1
import Mathlib.CategoryTheory.EqToHom import Mathlib.CategoryTheory.Pi.Basic import Mathlib.Data.ULift #align_import category_theory.discrete_category from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768" namespace CategoryTheory -- morphism levels before object levels. See note [CategoryTheory universes]. universe v₁ v₂ v₃ u₁ u₁' u₂ u₃ -- This is intentionally a structure rather than a type synonym -- to enforce using `DiscreteEquiv` (or `Discrete.mk` and `Discrete.as`) to move between -- `Discrete α` and `α`. Otherwise there is too much API leakage. @[ext, aesop safe cases (rule_sets := [CategoryTheory])] structure Discrete (α : Type u₁) where as : α #align category_theory.discrete CategoryTheory.Discrete @[simp] theorem Discrete.mk_as {α : Type u₁} (X : Discrete α) : Discrete.mk X.as = X := by rfl #align category_theory.discrete.mk_as CategoryTheory.Discrete.mk_as @[simps] def discreteEquiv {α : Type u₁} : Discrete α ≃ α where toFun := Discrete.as invFun := Discrete.mk left_inv := by aesop_cat right_inv := by aesop_cat #align category_theory.discrete_equiv CategoryTheory.discreteEquiv instance {α : Type u₁} [DecidableEq α] : DecidableEq (Discrete α) := discreteEquiv.decidableEq instance discreteCategory (α : Type u₁) : SmallCategory (Discrete α) where Hom X Y := ULift (PLift (X.as = Y.as)) id X := ULift.up (PLift.up rfl) comp {X Y Z} g f := by cases X cases Y cases Z rcases f with ⟨⟨⟨⟩⟩⟩ exact g #align category_theory.discrete_category CategoryTheory.discreteCategory namespace Discrete variable {α : Type u₁} instance [Inhabited α] : Inhabited (Discrete α) := ⟨⟨default⟩⟩ instance [Subsingleton α] : Subsingleton (Discrete α) := ⟨by aesop_cat⟩ instance instSubsingletonDiscreteHom (X Y : Discrete α) : Subsingleton (X ⟶ Y) := show Subsingleton (ULift (PLift _)) from inferInstance macro "discrete_cases" : tactic => `(tactic| fail_if_no_progress casesm* Discrete _, (_ : Discrete _) ⟶ (_ : Discrete _), PLift _) open Lean Elab Tactic in def discreteCases : TacticM Unit := do evalTactic (← `(tactic| discrete_cases)) -- Porting note: -- investigate turning on either -- `attribute [aesop safe cases (rule_sets := [CategoryTheory])] Discrete` -- or -- `attribute [aesop safe tactic (rule_sets := [CategoryTheory])] discreteCases` -- globally. instance [Unique α] : Unique (Discrete α) := Unique.mk' (Discrete α) theorem eq_of_hom {X Y : Discrete α} (i : X ⟶ Y) : X.as = Y.as := i.down.down #align category_theory.discrete.eq_of_hom CategoryTheory.Discrete.eq_of_hom protected abbrev eqToHom {X Y : Discrete α} (h : X.as = Y.as) : X ⟶ Y := eqToHom (by aesop_cat) #align category_theory.discrete.eq_to_hom CategoryTheory.Discrete.eqToHom protected abbrev eqToIso {X Y : Discrete α} (h : X.as = Y.as) : X ≅ Y := eqToIso (by aesop_cat) #align category_theory.discrete.eq_to_iso CategoryTheory.Discrete.eqToIso abbrev eqToHom' {a b : α} (h : a = b) : Discrete.mk a ⟶ Discrete.mk b := Discrete.eqToHom h #align category_theory.discrete.eq_to_hom' CategoryTheory.Discrete.eqToHom' abbrev eqToIso' {a b : α} (h : a = b) : Discrete.mk a ≅ Discrete.mk b := Discrete.eqToIso h #align category_theory.discrete.eq_to_iso' CategoryTheory.Discrete.eqToIso' @[simp] theorem id_def (X : Discrete α) : ULift.up (PLift.up (Eq.refl X.as)) = 𝟙 X := rfl #align category_theory.discrete.id_def CategoryTheory.Discrete.id_def variable {C : Type u₂} [Category.{v₂} C] instance {I : Type u₁} {i j : Discrete I} (f : i ⟶ j) : IsIso f := ⟨⟨Discrete.eqToHom (eq_of_hom f).symm, by aesop_cat⟩⟩ attribute [local aesop safe tactic (rule_sets := [CategoryTheory])] CategoryTheory.Discrete.discreteCases def functor {I : Type u₁} (F : I → C) : Discrete I ⥤ C where obj := F ∘ Discrete.as map {X Y} f := by dsimp rcases f with ⟨⟨h⟩⟩ exact eqToHom (congrArg _ h) #align category_theory.discrete.functor CategoryTheory.Discrete.functor @[simp] theorem functor_obj {I : Type u₁} (F : I → C) (i : I) : (Discrete.functor F).obj (Discrete.mk i) = F i := rfl #align category_theory.discrete.functor_obj CategoryTheory.Discrete.functor_obj
Mathlib/CategoryTheory/DiscreteCategory.lean
186
187
theorem functor_map {I : Type u₁} (F : I → C) {i : Discrete I} (f : i ⟶ i) : (Discrete.functor F).map f = 𝟙 (F i.as) := by
aesop_cat
1
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.add from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L : Filter 𝕜} section Neg nonrec theorem HasDerivAtFilter.neg (h : HasDerivAtFilter f f' x L) : HasDerivAtFilter (fun x => -f x) (-f') x L := by simpa using h.neg.hasDerivAtFilter #align has_deriv_at_filter.neg HasDerivAtFilter.neg nonrec theorem HasDerivWithinAt.neg (h : HasDerivWithinAt f f' s x) : HasDerivWithinAt (fun x => -f x) (-f') s x := h.neg #align has_deriv_within_at.neg HasDerivWithinAt.neg nonrec theorem HasDerivAt.neg (h : HasDerivAt f f' x) : HasDerivAt (fun x => -f x) (-f') x := h.neg #align has_deriv_at.neg HasDerivAt.neg nonrec theorem HasStrictDerivAt.neg (h : HasStrictDerivAt f f' x) : HasStrictDerivAt (fun x => -f x) (-f') x := by simpa using h.neg.hasStrictDerivAt #align has_strict_deriv_at.neg HasStrictDerivAt.neg theorem derivWithin.neg (hxs : UniqueDiffWithinAt 𝕜 s x) : derivWithin (fun y => -f y) s x = -derivWithin f s x := by simp only [derivWithin, fderivWithin_neg hxs, ContinuousLinearMap.neg_apply] #align deriv_within.neg derivWithin.neg
Mathlib/Analysis/Calculus/Deriv/Add.lean
213
214
theorem deriv.neg : deriv (fun y => -f y) x = -deriv f x := by
simp only [deriv, fderiv_neg, ContinuousLinearMap.neg_apply]
1
import Mathlib.Algebra.Group.Defs import Mathlib.Control.Functor #align_import control.applicative from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" universe u v w section Lemmas open Function variable {F : Type u → Type v} variable [Applicative F] [LawfulApplicative F] variable {α β γ σ : Type u} theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) : f <$> x <*> g <$> y = ((· ∘ g) ∘ f) <$> x <*> y := by simp [flip, functor_norm] #align applicative.map_seq_map Applicative.map_seq_map
Mathlib/Control/Applicative.lean
36
37
theorem Applicative.pure_seq_eq_map' (f : α → β) : ((pure f : F (α → β)) <*> ·) = (f <$> ·) := by
ext; simp [functor_norm]
1
import Mathlib.Data.Finset.Card #align_import data.finset.option from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0" variable {α β : Type*} open Function namespace Finset def insertNone : Finset α ↪o Finset (Option α) := (OrderEmbedding.ofMapLEIff fun s => cons none (s.map Embedding.some) <| by simp) fun s t => by rw [le_iff_subset, cons_subset_cons, map_subset_map, le_iff_subset] #align finset.insert_none Finset.insertNone @[simp] theorem mem_insertNone {s : Finset α} : ∀ {o : Option α}, o ∈ insertNone s ↔ ∀ a ∈ o, a ∈ s | none => iff_of_true (Multiset.mem_cons_self _ _) fun a h => by cases h | some a => Multiset.mem_cons.trans <| by simp #align finset.mem_insert_none Finset.mem_insertNone lemma forall_mem_insertNone {s : Finset α} {p : Option α → Prop} : (∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p a := by simp [Option.forall] theorem some_mem_insertNone {s : Finset α} {a : α} : some a ∈ insertNone s ↔ a ∈ s := by simp #align finset.some_mem_insert_none Finset.some_mem_insertNone lemma none_mem_insertNone {s : Finset α} : none ∈ insertNone s := by simp @[aesop safe apply (rule_sets := [finsetNonempty])] lemma insertNone_nonempty {s : Finset α} : insertNone s |>.Nonempty := ⟨none, none_mem_insertNone⟩ @[simp] theorem card_insertNone (s : Finset α) : s.insertNone.card = s.card + 1 := by simp [insertNone] #align finset.card_insert_none Finset.card_insertNone def eraseNone : Finset (Option α) →o Finset α := (Finset.mapEmbedding (Equiv.optionIsSomeEquiv α).toEmbedding).toOrderHom.comp ⟨Finset.subtype _, subtype_mono⟩ #align finset.erase_none Finset.eraseNone @[simp]
Mathlib/Data/Finset/Option.lean
98
99
theorem mem_eraseNone {s : Finset (Option α)} {x : α} : x ∈ eraseNone s ↔ some x ∈ s := by
simp [eraseNone]
1
import Mathlib.MeasureTheory.Function.L1Space import Mathlib.Analysis.NormedSpace.IndicatorFunction #align_import measure_theory.integral.integrable_on from "leanprover-community/mathlib"@"8b8ba04e2f326f3f7cf24ad129beda58531ada61" noncomputable section open Set Filter TopologicalSpace MeasureTheory Function open scoped Classical Topology Interval Filter ENNReal MeasureTheory variable {α β E F : Type*} [MeasurableSpace α] section variable [TopologicalSpace β] {l l' : Filter α} {f g : α → β} {μ ν : Measure α} def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) := ∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s) #align strongly_measurable_at_filter StronglyMeasurableAtFilter @[simp] theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ := ⟨∅, mem_bot, by simp⟩ #align strongly_measurable_at_bot stronglyMeasurableAt_bot protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) : ∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s) := (eventually_smallSets' fun _ _ => AEStronglyMeasurable.mono_set).2 h #align strongly_measurable_at_filter.eventually StronglyMeasurableAtFilter.eventually protected theorem StronglyMeasurableAtFilter.filter_mono (h : StronglyMeasurableAtFilter f l μ) (h' : l' ≤ l) : StronglyMeasurableAtFilter f l' μ := let ⟨s, hsl, hs⟩ := h ⟨s, h' hsl, hs⟩ #align strongly_measurable_at_filter.filter_mono StronglyMeasurableAtFilter.filter_mono protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter (h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ := ⟨univ, univ_mem, by rwa [Measure.restrict_univ]⟩ #align measure_theory.ae_strongly_measurable.strongly_measurable_at_filter MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter theorem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem {s} (h : AEStronglyMeasurable f (μ.restrict s)) (hl : s ∈ l) : StronglyMeasurableAtFilter f l μ := ⟨s, hl, h⟩ #align ae_strongly_measurable.strongly_measurable_at_filter_of_mem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem protected theorem MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter (h : StronglyMeasurable f) : StronglyMeasurableAtFilter f l μ := h.aestronglyMeasurable.stronglyMeasurableAtFilter #align measure_theory.strongly_measurable.strongly_measurable_at_filter MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter end namespace MeasureTheory section NormedAddCommGroup theorem hasFiniteIntegral_restrict_of_bounded [NormedAddCommGroup E] {f : α → E} {s : Set α} {μ : Measure α} {C} (hs : μ s < ∞) (hf : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) : HasFiniteIntegral f (μ.restrict s) := haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rwa [Measure.restrict_apply_univ]⟩ hasFiniteIntegral_of_bounded hf #align measure_theory.has_finite_integral_restrict_of_bounded MeasureTheory.hasFiniteIntegral_restrict_of_bounded variable [NormedAddCommGroup E] {f g : α → E} {s t : Set α} {μ ν : Measure α} def IntegrableOn (f : α → E) (s : Set α) (μ : Measure α := by volume_tac) : Prop := Integrable f (μ.restrict s) #align measure_theory.integrable_on MeasureTheory.IntegrableOn theorem IntegrableOn.integrable (h : IntegrableOn f s μ) : Integrable f (μ.restrict s) := h #align measure_theory.integrable_on.integrable MeasureTheory.IntegrableOn.integrable @[simp]
Mathlib/MeasureTheory/Integral/IntegrableOn.lean
99
99
theorem integrableOn_empty : IntegrableOn f ∅ μ := by
simp [IntegrableOn, integrable_zero_measure]
1
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 theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div] #align real.inv_logb Real.inv_logb theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_mul h₁ h₂ #align real.inv_logb_mul_base Real.inv_logb_mul_base theorem inv_logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a / b) c)⁻¹ = (logb a c)⁻¹ - (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_div h₁ h₂ #align real.inv_logb_div_base Real.inv_logb_div_base theorem logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a * b) c = ((logb a c)⁻¹ + (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_mul_base h₁ h₂ c, inv_inv] #align real.logb_mul_base Real.logb_mul_base
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
101
102
theorem logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a / b) c = ((logb a c)⁻¹ - (logb b c)⁻¹)⁻¹ := by
rw [← inv_logb_div_base h₁ h₂ c, inv_inv]
1
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.FDeriv.Add #align_import analysis.calculus.deriv.add from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L : Filter 𝕜} section Sum variable {ι : Type*} {u : Finset ι} {A : ι → 𝕜 → F} {A' : ι → F}
Mathlib/Analysis/Calculus/Deriv/Add.lean
153
155
theorem HasDerivAtFilter.sum (h : ∀ i ∈ u, HasDerivAtFilter (A i) (A' i) x L) : HasDerivAtFilter (fun y => ∑ i ∈ u, A i y) (∑ i ∈ u, A' i) x L := by
simpa [ContinuousLinearMap.sum_apply] using (HasFDerivAtFilter.sum h).hasDerivAtFilter
1
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -φ := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : φ * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * φ = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : φ + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - φ = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = φ := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp]
Mathlib/Data/Real/GoldenRatio.lean
84
84
theorem gold_sub_goldConj : φ - ψ = √5 := by
ring
1
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ι α β : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm α} {p : α → Prop} {x y z : α} def SameCycle (f : Perm α) (x y : α) : Prop := ∃ i : ℤ, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm α) (x : α) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm α) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y → SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y → SameCycle f y z → SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm α) : Setoid α where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y → SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y → (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp]
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
132
133
theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by
rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm]
1
import Mathlib.MeasureTheory.Function.LpOrder #align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f" noncomputable section open scoped Classical open Topology ENNReal MeasureTheory NNReal open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory variable {α β γ δ : Type*} {m : MeasurableSpace α} {μ ν : Measure α} [MeasurableSpace δ] variable [NormedAddCommGroup β] variable [NormedAddCommGroup γ] namespace MeasureTheory theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [edist_eq_coe_nnnorm] #align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist theorem lintegral_norm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm] #align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist theorem lintegral_edist_triangle {f g h : α → β} (hf : AEStronglyMeasurable f μ) (hh : AEStronglyMeasurable h μ) : (∫⁻ a, edist (f a) (g a) ∂μ) ≤ (∫⁻ a, edist (f a) (h a) ∂μ) + ∫⁻ a, edist (g a) (h a) ∂μ := by rw [← lintegral_add_left' (hf.edist hh)] refine lintegral_mono fun a => ?_ apply edist_triangle_right #align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle theorem lintegral_nnnorm_zero : (∫⁻ _ : α, ‖(0 : β)‖₊ ∂μ) = 0 := by simp #align measure_theory.lintegral_nnnorm_zero MeasureTheory.lintegral_nnnorm_zero theorem lintegral_nnnorm_add_left {f : α → β} (hf : AEStronglyMeasurable f μ) (g : α → γ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_left' hf.ennnorm _ #align measure_theory.lintegral_nnnorm_add_left MeasureTheory.lintegral_nnnorm_add_left theorem lintegral_nnnorm_add_right (f : α → β) {g : α → γ} (hg : AEStronglyMeasurable g μ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_right' _ hg.ennnorm #align measure_theory.lintegral_nnnorm_add_right MeasureTheory.lintegral_nnnorm_add_right theorem lintegral_nnnorm_neg {f : α → β} : (∫⁻ a, ‖(-f) a‖₊ ∂μ) = ∫⁻ a, ‖f a‖₊ ∂μ := by simp only [Pi.neg_apply, nnnorm_neg] #align measure_theory.lintegral_nnnorm_neg MeasureTheory.lintegral_nnnorm_neg def HasFiniteIntegral {_ : MeasurableSpace α} (f : α → β) (μ : Measure α := by volume_tac) : Prop := (∫⁻ a, ‖f a‖₊ ∂μ) < ∞ #align measure_theory.has_finite_integral MeasureTheory.HasFiniteIntegral theorem hasFiniteIntegral_def {_ : MeasurableSpace α} (f : α → β) (μ : Measure α) : HasFiniteIntegral f μ ↔ ((∫⁻ a, ‖f a‖₊ ∂μ) < ∞) := Iff.rfl theorem hasFiniteIntegral_iff_norm (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ) < ∞ := by simp only [HasFiniteIntegral, ofReal_norm_eq_coe_nnnorm] #align measure_theory.has_finite_integral_iff_norm MeasureTheory.hasFiniteIntegral_iff_norm
Mathlib/MeasureTheory/Function/L1Space.lean
118
120
theorem hasFiniteIntegral_iff_edist (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, edist (f a) 0 ∂μ) < ∞ := by
simp only [hasFiniteIntegral_iff_norm, edist_dist, dist_zero_right]
1
import Mathlib.Order.Filter.Cofinite import Mathlib.Order.Hom.CompleteLattice #align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780" set_option autoImplicit true open Filter Set Function variable {α β γ ι ι' : Type*} namespace Filter section Relation def IsBounded (r : α → α → Prop) (f : Filter α) := ∃ b, ∀ᶠ x in f, r x b #align filter.is_bounded Filter.IsBounded def IsBoundedUnder (r : α → α → Prop) (f : Filter β) (u : β → α) := (map u f).IsBounded r #align filter.is_bounded_under Filter.IsBoundedUnder variable {r : α → α → Prop} {f g : Filter α} theorem isBounded_iff : f.IsBounded r ↔ ∃ s ∈ f.sets, ∃ b, s ⊆ { x | r x b } := Iff.intro (fun ⟨b, hb⟩ => ⟨{ a | r a b }, hb, b, Subset.refl _⟩) fun ⟨_, hs, b, hb⟩ => ⟨b, mem_of_superset hs hb⟩ #align filter.is_bounded_iff Filter.isBounded_iff theorem isBoundedUnder_of {f : Filter β} {u : β → α} : (∃ b, ∀ x, r (u x) b) → f.IsBoundedUnder r u | ⟨b, hb⟩ => ⟨b, show ∀ᶠ x in f, r (u x) b from eventually_of_forall hb⟩ #align filter.is_bounded_under_of Filter.isBoundedUnder_of theorem isBounded_bot : IsBounded r ⊥ ↔ Nonempty α := by simp [IsBounded, exists_true_iff_nonempty] #align filter.is_bounded_bot Filter.isBounded_bot theorem isBounded_top : IsBounded r ⊤ ↔ ∃ t, ∀ x, r x t := by simp [IsBounded, eq_univ_iff_forall] #align filter.is_bounded_top Filter.isBounded_top
Mathlib/Order/LiminfLimsup.lean
83
84
theorem isBounded_principal (s : Set α) : IsBounded r (𝓟 s) ↔ ∃ t, ∀ x ∈ s, r x t := by
simp [IsBounded, subset_def]
1
import Mathlib.Tactic.Ring.Basic import Mathlib.Tactic.TryThis import Mathlib.Tactic.Conv import Mathlib.Util.Qq set_option autoImplicit true -- In this file we would like to be able to use multi-character auto-implicits. set_option relaxedAutoImplicit true namespace Mathlib.Tactic open Lean hiding Rat open Qq Meta namespace RingNF open Ring inductive RingMode where | SOP | raw deriving Inhabited, BEq, Repr structure Config where red := TransparencyMode.reducible recursive := true mode := RingMode.SOP deriving Inhabited, BEq, Repr declare_config_elab elabConfig Config structure Context where ctx : Simp.Context simp : Simp.Result → SimpM Simp.Result abbrev M := ReaderT Context AtomM def rewrite (parent : Expr) (root := true) : M Simp.Result := fun nctx rctx s ↦ do let pre : Simp.Simproc := fun e => try guard <| root || parent != e -- recursion guard let e ← withReducible <| whnf e guard e.isApp -- all interesting ring expressions are applications let ⟨u, α, e⟩ ← inferTypeQ' e let sα ← synthInstanceQ (q(CommSemiring $α) : Q(Type u)) let c ← mkCache sα let ⟨a, _, pa⟩ ← match ← isAtomOrDerivable sα c e rctx s with | none => eval sα c e rctx s -- `none` indicates that `eval` will find something algebraic. | some none => failure -- No point rewriting atoms | some (some r) => pure r -- Nothing algebraic for `eval` to use, but `norm_num` simplifies. let r ← nctx.simp { expr := a, proof? := pa } if ← withReducible <| isDefEq r.expr e then return .done { expr := r.expr } pure (.done r) catch _ => pure <| .continue let post := Simp.postDefault #[] (·.1) <$> Simp.main parent nctx.ctx (methods := { pre, post }) variable [CommSemiring R] theorem add_assoc_rev (a b c : R) : a + (b + c) = a + b + c := (add_assoc ..).symm theorem mul_assoc_rev (a b c : R) : a * (b * c) = a * b * c := (mul_assoc ..).symm theorem mul_neg {R} [Ring R] (a b : R) : a * -b = -(a * b) := by simp theorem add_neg {R} [Ring R] (a b : R) : a + -b = a - b := (sub_eq_add_neg ..).symm theorem nat_rawCast_0 : (Nat.rawCast 0 : R) = 0 := by simp
Mathlib/Tactic/Ring/RingNF.lean
121
121
theorem nat_rawCast_1 : (Nat.rawCast 1 : R) = 1 := by
simp
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace List variable {α : Type*} def splitWrtCompositionAux : List α → List ℕ → List (List α) | _, [] => [] | l, n::ns => let (l₁, l₂) := l.splitAt n l₁::splitWrtCompositionAux l₂ ns #align list.split_wrt_composition_aux List.splitWrtCompositionAux def splitWrtComposition (l : List α) (c : Composition n) : List (List α) := splitWrtCompositionAux l c.blocks #align list.split_wrt_composition List.splitWrtComposition -- Porting note: can't refer to subeqn in Lean 4 this way, and seems to definitionally simp --attribute [local simp] splitWrtCompositionAux.equations._eqn_1 @[local simp]
Mathlib/Combinatorics/Enumerative/Composition.lean
647
649
theorem splitWrtCompositionAux_cons (l : List α) (n ns) : l.splitWrtCompositionAux (n::ns) = take n l::(drop n l).splitWrtCompositionAux ns := by
simp [splitWrtCompositionAux]
1
import Mathlib.CategoryTheory.Monoidal.Category import Mathlib.CategoryTheory.Adjunction.FullyFaithful import Mathlib.CategoryTheory.Products.Basic #align_import category_theory.monoidal.functor from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042" open CategoryTheory universe v₁ v₂ v₃ u₁ u₂ u₃ open CategoryTheory.Category open CategoryTheory.Functor namespace CategoryTheory section open MonoidalCategory variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] (D : Type u₂) [Category.{v₂} D] [MonoidalCategory.{v₂} D] -- The direction of `left_unitality` and `right_unitality` as simp lemmas may look strange: -- remember the rule of thumb that component indices of natural transformations -- "weigh more" than structural maps. -- (However by this argument `associativity` is currently stated backwards!) structure LaxMonoidalFunctor extends C ⥤ D where ε : 𝟙_ D ⟶ obj (𝟙_ C) μ : ∀ X Y : C, obj X ⊗ obj Y ⟶ obj (X ⊗ Y) μ_natural_left : ∀ {X Y : C} (f : X ⟶ Y) (X' : C), map f ▷ obj X' ≫ μ Y X' = μ X X' ≫ map (f ▷ X') := by aesop_cat μ_natural_right : ∀ {X Y : C} (X' : C) (f : X ⟶ Y) , obj X' ◁ map f ≫ μ X' Y = μ X' X ≫ map (X' ◁ f) := by aesop_cat associativity : ∀ X Y Z : C, μ X Y ▷ obj Z ≫ μ (X ⊗ Y) Z ≫ map (α_ X Y Z).hom = (α_ (obj X) (obj Y) (obj Z)).hom ≫ obj X ◁ μ Y Z ≫ μ X (Y ⊗ Z) := by aesop_cat -- unitality left_unitality : ∀ X : C, (λ_ (obj X)).hom = ε ▷ obj X ≫ μ (𝟙_ C) X ≫ map (λ_ X).hom := by aesop_cat right_unitality : ∀ X : C, (ρ_ (obj X)).hom = obj X ◁ ε ≫ μ X (𝟙_ C) ≫ map (ρ_ X).hom := by aesop_cat #align category_theory.lax_monoidal_functor CategoryTheory.LaxMonoidalFunctor -- Porting note (#11215): TODO: remove this configuration and use the default configuration. -- We keep this to be consistent with Lean 3. -- See also `initialize_simps_projections MonoidalFunctor` below. -- This may require waiting on https://github.com/leanprover-community/mathlib4/pull/2936 initialize_simps_projections LaxMonoidalFunctor (+toFunctor, -obj, -map) attribute [reassoc (attr := simp)] LaxMonoidalFunctor.μ_natural_left attribute [reassoc (attr := simp)] LaxMonoidalFunctor.μ_natural_right attribute [simp] LaxMonoidalFunctor.left_unitality attribute [simp] LaxMonoidalFunctor.right_unitality attribute [reassoc (attr := simp)] LaxMonoidalFunctor.associativity -- When `rewrite_search` lands, add @[search] attributes to -- LaxMonoidalFunctor.μ_natural LaxMonoidalFunctor.left_unitality -- LaxMonoidalFunctor.right_unitality LaxMonoidalFunctor.associativity section variable {C D} @[reassoc (attr := simp)]
Mathlib/CategoryTheory/Monoidal/Functor.lean
113
116
theorem LaxMonoidalFunctor.μ_natural (F : LaxMonoidalFunctor C D) {X Y X' Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') : (F.map f ⊗ F.map g) ≫ F.μ Y Y' = F.μ X X' ≫ F.map (f ⊗ g) := by
simp [tensorHom_def]
1
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]
Mathlib/SetTheory/Cardinal/Continuum.lean
83
83
theorem beth_one : beth 1 = 𝔠 := by
simpa using beth_succ 0
1
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Group.Measure import Mathlib.Topology.Constructions #align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable open scoped Classical Topology ENNReal universe u v variable {ι ι' : Type*} {α : ι → Type*} theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : IsPiSystem (pi univ '' pi univ C) := by rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i) #align is_pi_system.pi IsPiSystem.pi theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] : IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) := IsPiSystem.pi fun _ => isPiSystem_measurableSet #align is_pi_system_pi isPiSystem_pi namespace MeasureTheory variable [Fintype ι] {m : ∀ i, OuterMeasure (α i)} @[simp] def piPremeasure (m : ∀ i, OuterMeasure (α i)) (s : Set (∀ i, α i)) : ℝ≥0∞ := ∏ i, m i (eval i '' s) #align measure_theory.pi_premeasure MeasureTheory.piPremeasure
Mathlib/MeasureTheory/Constructions/Pi.lean
162
163
theorem piPremeasure_pi {s : ∀ i, Set (α i)} (hs : (pi univ s).Nonempty) : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by
simp [hs, piPremeasure]
1
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := ∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
42
44
theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by
rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one]
1
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal theorem Gamma_one_top : Gamma 1 = ⊤ := by ext simp [eq_iff_true_of_subsingleton] #align Gamma_one_top Gamma_one_top theorem Gamma_zero_bot : Gamma 0 = ⊥ := by ext simp only [Gamma_mem, coe_matrix_coe, Int.coe_castRingHom, map_apply, Int.cast_id, Subgroup.mem_bot] constructor · intro h ext i j fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] · intro h simp [h] #align Gamma_zero_bot Gamma_zero_bot lemma ModularGroup_T_pow_mem_Gamma (N M : ℤ) (hNM : N ∣ M) : (ModularGroup.T ^ M) ∈ _root_.Gamma (Int.natAbs N) := by simp only [Gamma_mem, Fin.isValue, ModularGroup.coe_T_zpow, of_apply, cons_val', cons_val_zero, empty_val', cons_val_fin_one, Int.cast_one, cons_val_one, head_cons, head_fin_const, Int.cast_zero, and_self, and_true, true_and] refine Iff.mpr (ZMod.intCast_zmod_eq_zero_iff_dvd M (Int.natAbs N)) ?_ simp only [Int.natCast_natAbs, abs_dvd, hNM] def Gamma0 (N : ℕ) : Subgroup SL(2, ℤ) where carrier := { g : SL(2, ℤ) | ((↑ₘg 1 0 : ℤ) : ZMod N) = 0 } one_mem' := by simp mul_mem' := by intro a b ha hb simp only [Set.mem_setOf_eq] have h := (Matrix.two_mul_expl a.1 b.1).2.2.1 simp only [coe_matrix_coe, coe_mul, Int.coe_castRingHom, map_apply, Set.mem_setOf_eq] at * rw [h] simp [ha, hb] inv_mem' := by intro a ha simp only [Set.mem_setOf_eq] rw [SL2_inv_expl a] simp only [cons_val_zero, cons_val_one, head_cons, coe_matrix_coe, coe_mk, Int.coe_castRingHom, map_apply, Int.cast_neg, neg_eq_zero, Set.mem_setOf_eq] at * exact ha #align Gamma0 Gamma0 @[simp] theorem Gamma0_mem (N : ℕ) (A : SL(2, ℤ)) : A ∈ Gamma0 N ↔ ((↑ₘA 1 0 : ℤ) : ZMod N) = 0 := Iff.rfl #align Gamma0_mem Gamma0_mem
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
125
125
theorem Gamma0_det (N : ℕ) (A : Gamma0 N) : (A.1.1.det : ZMod N) = 1 := by
simp [A.1.property]
1
import Mathlib.Combinatorics.SimpleGraph.Connectivity #align_import combinatorics.simple_graph.prod from "leanprover-community/mathlib"@"2985fa3c31a27274aed06c433510bc14b73d6488" variable {α β γ : Type*} namespace SimpleGraph -- Porting note: pruned variables to keep things out of local contexts, which -- can impact how generalization works, or what aesop does. variable {G : SimpleGraph α} {H : SimpleGraph β} def boxProd (G : SimpleGraph α) (H : SimpleGraph β) : SimpleGraph (α × β) where Adj x y := G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1 symm x y := by simp [and_comm, or_comm, eq_comm, adj_comm] loopless x := by simp #align simple_graph.box_prod SimpleGraph.boxProd infixl:70 " □ " => boxProd set_option autoImplicit true in @[simp] theorem boxProd_adj : (G □ H).Adj x y ↔ G.Adj x.1 y.1 ∧ x.2 = y.2 ∨ H.Adj x.2 y.2 ∧ x.1 = y.1 := Iff.rfl #align simple_graph.box_prod_adj SimpleGraph.boxProd_adj set_option autoImplicit true in --@[simp] Porting note (#10618): `simp` can prove theorem boxProd_adj_left : (G □ H).Adj (a₁, b) (a₂, b) ↔ G.Adj a₁ a₂ := by simp only [boxProd_adj, and_true, SimpleGraph.irrefl, false_and, or_false] #align simple_graph.box_prod_adj_left SimpleGraph.boxProd_adj_left set_option autoImplicit true in --@[simp] Porting note (#10618): `simp` can prove
Mathlib/Combinatorics/SimpleGraph/Prod.lean
65
66
theorem boxProd_adj_right : (G □ H).Adj (a, b₁) (a, b₂) ↔ H.Adj b₁ b₂ := by
simp only [boxProd_adj, SimpleGraph.irrefl, false_and, and_true, false_or]
1
import Mathlib.Data.Finset.Grade import Mathlib.Order.Interval.Finset.Basic #align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" variable {α β : Type*} namespace Finset section Decidable variable [DecidableEq α] (s t : Finset α) instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where finsetIcc s t := t.powerset.filter (s ⊆ ·) finsetIco s t := t.ssubsets.filter (s ⊆ ·) finsetIoc s t := t.powerset.filter (s ⊂ ·) finsetIoo s t := t.ssubsets.filter (s ⊂ ·) finset_mem_Icc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ico s t u := by rw [mem_filter, mem_ssubsets] exact and_comm finset_mem_Ioc s t u := by rw [mem_filter, mem_powerset] exact and_comm finset_mem_Ioo s t u := by rw [mem_filter, mem_ssubsets] exact and_comm theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) := rfl #align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) := rfl #align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) := rfl #align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) := rfl #align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets theorem Iic_eq_powerset : Iic s = s.powerset := filter_true_of_mem fun t _ => empty_subset t #align finset.Iic_eq_powerset Finset.Iic_eq_powerset theorem Iio_eq_ssubsets : Iio s = s.ssubsets := filter_true_of_mem fun t _ => empty_subset t #align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets variable {s t} theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by ext u simp_rw [mem_Icc, mem_image, mem_powerset] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩ #align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset theorem Ico_eq_image_ssubsets (h : s ⊆ t) : Ico s t = (t \ s).ssubsets.image (s ∪ ·) := by ext u simp_rw [mem_Ico, mem_image, mem_ssubsets] constructor · rintro ⟨hs, ht⟩ exact ⟨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hs⟩ · rintro ⟨v, hv, rfl⟩ exact ⟨le_sup_left, sup_lt_of_lt_sdiff_left hv h⟩ #align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets theorem card_Icc_finset (h : s ⊆ t) : (Icc s t).card = 2 ^ (t.card - s.card) := by rw [← card_sdiff h, ← card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff] rintro u hu v hv (huv : s ⊔ u = s ⊔ v) rw [mem_coe, mem_powerset] at hu hv rw [← (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, ← (disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv] #align finset.card_Icc_finset Finset.card_Icc_finset theorem card_Ico_finset (h : s ⊆ t) : (Ico s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ico_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ico_finset Finset.card_Ico_finset theorem card_Ioc_finset (h : s ⊆ t) : (Ioc s t).card = 2 ^ (t.card - s.card) - 1 := by rw [card_Ioc_eq_card_Icc_sub_one, card_Icc_finset h] #align finset.card_Ioc_finset Finset.card_Ioc_finset theorem card_Ioo_finset (h : s ⊆ t) : (Ioo s t).card = 2 ^ (t.card - s.card) - 2 := by rw [card_Ioo_eq_card_Icc_sub_two, card_Icc_finset h] #align finset.card_Ioo_finset Finset.card_Ioo_finset theorem card_Iic_finset : (Iic s).card = 2 ^ s.card := by rw [Iic_eq_powerset, card_powerset] #align finset.card_Iic_finset Finset.card_Iic_finset
Mathlib/Data/Finset/Interval.lean
129
130
theorem card_Iio_finset : (Iio s).card = 2 ^ s.card - 1 := by
rw [Iio_eq_ssubsets, ssubsets, card_erase_of_mem (mem_powerset_self _), card_powerset]
1
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : ℕ) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : ℕ := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length → ℕ := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun
Mathlib/Combinatorics/Enumerative/Composition.lean
160
161
theorem sum_blocksFun : ∑ i, c.blocksFun i = n := by
conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn]
1
import Mathlib.Algebra.Group.Prod #align_import data.nat.cast.prod from "leanprover-community/mathlib"@"ee0c179cd3c8a45aa5bffbf1b41d8dbede452865" assert_not_exists MonoidWithZero variable {α β : Type*} namespace Prod variable [AddMonoidWithOne α] [AddMonoidWithOne β] instance instAddMonoidWithOne : AddMonoidWithOne (α × β) := { Prod.instAddMonoid, @Prod.instOne α β _ _ with natCast := fun n => (n, n) natCast_zero := congr_arg₂ Prod.mk Nat.cast_zero Nat.cast_zero natCast_succ := fun _ => congr_arg₂ Prod.mk (Nat.cast_succ _) (Nat.cast_succ _) } @[simp]
Mathlib/Data/Nat/Cast/Prod.lean
29
29
theorem fst_natCast (n : ℕ) : (n : α × β).fst = n := by
induction n <;> simp [*]
1
import Mathlib.Algebra.Order.Ring.WithTop import Mathlib.Algebra.Order.Sub.WithTop import Mathlib.Data.Real.NNReal import Mathlib.Order.Interval.Set.WithBotTop #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Function Set NNReal variable {α : Type*} def ENNReal := WithTop ℝ≥0 deriving Zero, AddCommMonoidWithOne, SemilatticeSup, DistribLattice, Nontrivial #align ennreal ENNReal @[inherit_doc] scoped[ENNReal] notation "ℝ≥0∞" => ENNReal scoped[ENNReal] notation "∞" => (⊤ : ENNReal) namespace ENNReal instance : OrderBot ℝ≥0∞ := inferInstanceAs (OrderBot (WithTop ℝ≥0)) instance : BoundedOrder ℝ≥0∞ := inferInstanceAs (BoundedOrder (WithTop ℝ≥0)) instance : CharZero ℝ≥0∞ := inferInstanceAs (CharZero (WithTop ℝ≥0)) noncomputable instance : CanonicallyOrderedCommSemiring ℝ≥0∞ := inferInstanceAs (CanonicallyOrderedCommSemiring (WithTop ℝ≥0)) noncomputable instance : CompleteLinearOrder ℝ≥0∞ := inferInstanceAs (CompleteLinearOrder (WithTop ℝ≥0)) instance : DenselyOrdered ℝ≥0∞ := inferInstanceAs (DenselyOrdered (WithTop ℝ≥0)) noncomputable instance : CanonicallyLinearOrderedAddCommMonoid ℝ≥0∞ := inferInstanceAs (CanonicallyLinearOrderedAddCommMonoid (WithTop ℝ≥0)) noncomputable instance instSub : Sub ℝ≥0∞ := inferInstanceAs (Sub (WithTop ℝ≥0)) noncomputable instance : OrderedSub ℝ≥0∞ := inferInstanceAs (OrderedSub (WithTop ℝ≥0)) noncomputable instance : LinearOrderedAddCommMonoidWithTop ℝ≥0∞ := inferInstanceAs (LinearOrderedAddCommMonoidWithTop (WithTop ℝ≥0)) -- Porting note: rfc: redefine using pattern matching? noncomputable instance : Inv ℝ≥0∞ := ⟨fun a => sInf { b | 1 ≤ a * b }⟩ noncomputable instance : DivInvMonoid ℝ≥0∞ where variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} -- Porting note: are these 2 instances still required in Lean 4? instance covariantClass_mul_le : CovariantClass ℝ≥0∞ ℝ≥0∞ (· * ·) (· ≤ ·) := inferInstance #align ennreal.covariant_class_mul_le ENNReal.covariantClass_mul_le instance covariantClass_add_le : CovariantClass ℝ≥0∞ ℝ≥0∞ (· + ·) (· ≤ ·) := inferInstance #align ennreal.covariant_class_add_le ENNReal.covariantClass_add_le -- Porting note (#11215): TODO: add a `WithTop` instance and use it here noncomputable instance : LinearOrderedCommMonoidWithZero ℝ≥0∞ := { inferInstanceAs (LinearOrderedAddCommMonoidWithTop ℝ≥0∞), inferInstanceAs (CommSemiring ℝ≥0∞) with mul_le_mul_left := fun _ _ => mul_le_mul_left' zero_le_one := zero_le 1 } noncomputable instance : Unique (AddUnits ℝ≥0∞) where default := 0 uniq a := AddUnits.ext <| le_zero_iff.1 <| by rw [← a.add_neg]; exact le_self_add instance : Inhabited ℝ≥0∞ := ⟨0⟩ @[coe, match_pattern] def ofNNReal : ℝ≥0 → ℝ≥0∞ := WithTop.some instance : Coe ℝ≥0 ℝ≥0∞ := ⟨ofNNReal⟩ @[elab_as_elim, induction_eliminator, cases_eliminator] def recTopCoe {C : ℝ≥0∞ → Sort*} (top : C ∞) (coe : ∀ x : ℝ≥0, C x) (x : ℝ≥0∞) : C x := WithTop.recTopCoe top coe x instance canLift : CanLift ℝ≥0∞ ℝ≥0 ofNNReal (· ≠ ∞) := WithTop.canLift #align ennreal.can_lift ENNReal.canLift @[simp] theorem none_eq_top : (none : ℝ≥0∞) = ∞ := rfl #align ennreal.none_eq_top ENNReal.none_eq_top @[simp] theorem some_eq_coe (a : ℝ≥0) : (Option.some a : ℝ≥0∞) = (↑a : ℝ≥0∞) := rfl #align ennreal.some_eq_coe ENNReal.some_eq_coe @[simp] theorem some_eq_coe' (a : ℝ≥0) : (WithTop.some a : ℝ≥0∞) = (↑a : ℝ≥0∞) := rfl lemma coe_injective : Injective ((↑) : ℝ≥0 → ℝ≥0∞) := WithTop.coe_injective @[simp, norm_cast] lemma coe_inj : (p : ℝ≥0∞) = q ↔ p = q := coe_injective.eq_iff #align ennreal.coe_eq_coe ENNReal.coe_inj lemma coe_ne_coe : (p : ℝ≥0∞) ≠ q ↔ p ≠ q := coe_inj.not theorem range_coe' : range ofNNReal = Iio ∞ := WithTop.range_coe theorem range_coe : range ofNNReal = {∞}ᶜ := (isCompl_range_some_none ℝ≥0).symm.compl_eq.symm protected def toNNReal : ℝ≥0∞ → ℝ≥0 := WithTop.untop' 0 #align ennreal.to_nnreal ENNReal.toNNReal protected def toReal (a : ℝ≥0∞) : Real := a.toNNReal #align ennreal.to_real ENNReal.toReal protected noncomputable def ofReal (r : Real) : ℝ≥0∞ := r.toNNReal #align ennreal.of_real ENNReal.ofReal @[simp, norm_cast] theorem toNNReal_coe : (r : ℝ≥0∞).toNNReal = r := rfl #align ennreal.to_nnreal_coe ENNReal.toNNReal_coe @[simp] theorem coe_toNNReal : ∀ {a : ℝ≥0∞}, a ≠ ∞ → ↑a.toNNReal = a | ofNNReal _, _ => rfl | ⊤, h => (h rfl).elim #align ennreal.coe_to_nnreal ENNReal.coe_toNNReal @[simp]
Mathlib/Data/ENNReal/Basic.lean
212
213
theorem ofReal_toReal {a : ℝ≥0∞} (h : a ≠ ∞) : ENNReal.ofReal a.toReal = a := by
simp [ENNReal.toReal, ENNReal.ofReal, h]
1
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 FiniteCoproducts variable {α : Type w} [Finite α] (X : α → CompHaus) def finiteCoproduct : CompHaus := CompHaus.of <| Σ (a : α), X a def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X where toFun := fun x => ⟨a,x⟩ continuous_toFun := continuous_sigmaMk (σ := fun a => X a) def finiteCoproduct.desc {B : CompHaus} (e : (a : α) → (X a ⟶ B)) : finiteCoproduct X ⟶ B where toFun := fun ⟨a,x⟩ => e a x continuous_toFun := by apply continuous_sigma intro a; exact (e a).continuous @[reassoc (attr := simp)] lemma finiteCoproduct.ι_desc {B : CompHaus} (e : (a : α) → (X a ⟶ B)) (a : α) : finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl lemma finiteCoproduct.hom_ext {B : CompHaus} (f g : finiteCoproduct X ⟶ B) (h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by ext ⟨a,x⟩ specialize h a apply_fun (fun q => q x) at h exact h abbrev finiteCoproduct.cofan : Limits.Cofan X := Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X) def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) := mkCofanColimit _ (fun s ↦ desc _ fun a ↦ s.inj a) (fun _ _ ↦ ι_desc _ _ _) fun _ _ hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦ (DFunLike.ext _ _ fun t ↦ congrFun (congrArg DFunLike.coe (hm a)) t) section Iso noncomputable def coproductIsoCoproduct : finiteCoproduct X ≅ ∐ X := Limits.IsColimit.coconePointUniqueUpToIso (finiteCoproduct.isColimit X) (Limits.colimit.isColimit _)
Mathlib/Topology/Category/CompHaus/Limits.lean
205
207
theorem Sigma.ι_comp_toFiniteCoproduct (a : α) : (Limits.Sigma.ι X a) ≫ (coproductIsoCoproduct X).inv = finiteCoproduct.ι X a := by
simp [coproductIsoCoproduct]
1
import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Polynomial.Eval import Mathlib.GroupTheory.GroupAction.Ring #align_import data.polynomial.derivative from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Finset open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {A : Type z} {a b : R} {n : ℕ} section Derivative section Semiring variable [Semiring R] def derivative : R[X] →ₗ[R] R[X] where toFun p := p.sum fun n a => C (a * n) * X ^ (n - 1) map_add' p q := by dsimp only rw [sum_add_index] <;> simp only [add_mul, forall_const, RingHom.map_add, eq_self_iff_true, zero_mul, RingHom.map_zero] map_smul' a p := by dsimp; rw [sum_smul_index] <;> simp only [mul_sum, ← C_mul', mul_assoc, coeff_C_mul, RingHom.map_mul, forall_const, zero_mul, RingHom.map_zero, sum] #align polynomial.derivative Polynomial.derivative theorem derivative_apply (p : R[X]) : derivative p = p.sum fun n a => C (a * n) * X ^ (n - 1) := rfl #align polynomial.derivative_apply Polynomial.derivative_apply theorem coeff_derivative (p : R[X]) (n : ℕ) : coeff (derivative p) n = coeff p (n + 1) * (n + 1) := by rw [derivative_apply] simp only [coeff_X_pow, coeff_sum, coeff_C_mul] rw [sum, Finset.sum_eq_single (n + 1)] · simp only [Nat.add_succ_sub_one, add_zero, mul_one, if_true, eq_self_iff_true]; norm_cast · intro b cases b · intros rw [Nat.cast_zero, mul_zero, zero_mul] · intro _ H rw [Nat.add_one_sub_one, if_neg (mt (congr_arg Nat.succ) H.symm), mul_zero] · rw [if_pos (add_tsub_cancel_right n 1).symm, mul_one, Nat.cast_add, Nat.cast_one, mem_support_iff] intro h push_neg at h simp [h] #align polynomial.coeff_derivative Polynomial.coeff_derivative -- Porting note (#10618): removed `simp`: `simp` can prove it. theorem derivative_zero : derivative (0 : R[X]) = 0 := derivative.map_zero #align polynomial.derivative_zero Polynomial.derivative_zero theorem iterate_derivative_zero {k : ℕ} : derivative^[k] (0 : R[X]) = 0 := iterate_map_zero derivative k #align polynomial.iterate_derivative_zero Polynomial.iterate_derivative_zero @[simp] theorem derivative_monomial (a : R) (n : ℕ) : derivative (monomial n a) = monomial (n - 1) (a * n) := by rw [derivative_apply, sum_monomial_index, C_mul_X_pow_eq_monomial] simp #align polynomial.derivative_monomial Polynomial.derivative_monomial theorem derivative_C_mul_X (a : R) : derivative (C a * X) = C a := by simp [C_mul_X_eq_monomial, derivative_monomial, Nat.cast_one, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X Polynomial.derivative_C_mul_X theorem derivative_C_mul_X_pow (a : R) (n : ℕ) : derivative (C a * X ^ n) = C (a * n) * X ^ (n - 1) := by rw [C_mul_X_pow_eq_monomial, C_mul_X_pow_eq_monomial, derivative_monomial] set_option linter.uppercaseLean3 false in #align polynomial.derivative_C_mul_X_pow Polynomial.derivative_C_mul_X_pow
Mathlib/Algebra/Polynomial/Derivative.lean
103
104
theorem derivative_C_mul_X_sq (a : R) : derivative (C a * X ^ 2) = C (a * 2) * X := by
rw [derivative_C_mul_X_pow, Nat.cast_two, pow_one]
1
import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.Order.Monoid.Canonical.Defs import Mathlib.Data.Set.Function import Mathlib.Order.Interval.Set.Basic #align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9" namespace Set variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M) theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by refine ⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩ obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h) rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h exact ⟨a + c, h, by rw [add_right_comm]⟩ #align set.Ici_add_bij Set.Ici_add_bij theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) := by refine ⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h => ?_⟩ obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h exact ⟨a + c, h, by rw [add_right_comm]⟩ #align set.Ioi_add_bij Set.Ioi_add_bij theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) := by rw [← Ici_inter_Iic, ← Ici_inter_Iic] exact (Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx => le_of_add_le_add_right hx.2 #align set.Icc_add_bij Set.Icc_add_bij theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by rw [← Ioi_inter_Iio, ← Ioi_inter_Iio] exact (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx => lt_of_add_lt_add_right hx.2 #align set.Ioo_add_bij Set.Ioo_add_bij theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by rw [← Ioi_inter_Iic, ← Ioi_inter_Iic] exact (Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx => le_of_add_le_add_right hx.2 #align set.Ioc_add_bij Set.Ioc_add_bij theorem Ico_add_bij : BijOn (· + d) (Ico a b) (Ico (a + d) (b + d)) := by rw [← Ici_inter_Iio, ← Ici_inter_Iio] exact (Ici_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx => lt_of_add_lt_add_right hx.2 #align set.Ico_add_bij Set.Ico_add_bij @[simp] theorem image_add_const_Ici : (fun x => x + a) '' Ici b = Ici (b + a) := (Ici_add_bij _ _).image_eq #align set.image_add_const_Ici Set.image_add_const_Ici @[simp] theorem image_add_const_Ioi : (fun x => x + a) '' Ioi b = Ioi (b + a) := (Ioi_add_bij _ _).image_eq #align set.image_add_const_Ioi Set.image_add_const_Ioi @[simp] theorem image_add_const_Icc : (fun x => x + a) '' Icc b c = Icc (b + a) (c + a) := (Icc_add_bij _ _ _).image_eq #align set.image_add_const_Icc Set.image_add_const_Icc @[simp] theorem image_add_const_Ico : (fun x => x + a) '' Ico b c = Ico (b + a) (c + a) := (Ico_add_bij _ _ _).image_eq #align set.image_add_const_Ico Set.image_add_const_Ico @[simp] theorem image_add_const_Ioc : (fun x => x + a) '' Ioc b c = Ioc (b + a) (c + a) := (Ioc_add_bij _ _ _).image_eq #align set.image_add_const_Ioc Set.image_add_const_Ioc @[simp] theorem image_add_const_Ioo : (fun x => x + a) '' Ioo b c = Ioo (b + a) (c + a) := (Ioo_add_bij _ _ _).image_eq #align set.image_add_const_Ioo Set.image_add_const_Ioo @[simp] theorem image_const_add_Ici : (fun x => a + x) '' Ici b = Ici (a + b) := by simp only [add_comm a, image_add_const_Ici] #align set.image_const_add_Ici Set.image_const_add_Ici @[simp] theorem image_const_add_Ioi : (fun x => a + x) '' Ioi b = Ioi (a + b) := by simp only [add_comm a, image_add_const_Ioi] #align set.image_const_add_Ioi Set.image_const_add_Ioi @[simp]
Mathlib/Algebra/Order/Interval/Set/Monoid.lean
123
124
theorem image_const_add_Icc : (fun x => a + x) '' Icc b c = Icc (a + b) (a + c) := by
simp only [add_comm a, image_add_const_Icc]
1
import Mathlib.Tactic.FinCases import Mathlib.Data.Nat.Choose.Sum import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.Field.IsField #align_import ring_theory.ideal.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" universe u v w variable {α : Type u} {β : Type v} open Set Function open Pointwise abbrev Ideal (R : Type u) [Semiring R] := Submodule R R #align ideal Ideal @[mk_iff] class IsPrincipalIdealRing (R : Type u) [Semiring R] : Prop where principal : ∀ S : Ideal R, S.IsPrincipal #align is_principal_ideal_ring IsPrincipalIdealRing attribute [instance] IsPrincipalIdealRing.principal section Semiring namespace Ideal variable [Semiring α] (I : Ideal α) {a b : α} protected theorem zero_mem : (0 : α) ∈ I := Submodule.zero_mem I #align ideal.zero_mem Ideal.zero_mem protected theorem add_mem : a ∈ I → b ∈ I → a + b ∈ I := Submodule.add_mem I #align ideal.add_mem Ideal.add_mem variable (a) theorem mul_mem_left : b ∈ I → a * b ∈ I := Submodule.smul_mem I a #align ideal.mul_mem_left Ideal.mul_mem_left variable {a} @[ext] theorem ext {I J : Ideal α} (h : ∀ x, x ∈ I ↔ x ∈ J) : I = J := Submodule.ext h #align ideal.ext Ideal.ext theorem sum_mem (I : Ideal α) {ι : Type*} {t : Finset ι} {f : ι → α} : (∀ c ∈ t, f c ∈ I) → (∑ i ∈ t, f i) ∈ I := Submodule.sum_mem I #align ideal.sum_mem Ideal.sum_mem theorem eq_top_of_unit_mem (x y : α) (hx : x ∈ I) (h : y * x = 1) : I = ⊤ := eq_top_iff.2 fun z _ => calc z = z * (y * x) := by simp [h] _ = z * y * x := Eq.symm <| mul_assoc z y x _ ∈ I := I.mul_mem_left _ hx #align ideal.eq_top_of_unit_mem Ideal.eq_top_of_unit_mem theorem eq_top_of_isUnit_mem {x} (hx : x ∈ I) (h : IsUnit x) : I = ⊤ := let ⟨y, hy⟩ := h.exists_left_inv eq_top_of_unit_mem I x y hx hy #align ideal.eq_top_of_is_unit_mem Ideal.eq_top_of_isUnit_mem theorem eq_top_iff_one : I = ⊤ ↔ (1 : α) ∈ I := ⟨by rintro rfl; trivial, fun h => eq_top_of_unit_mem _ _ 1 h (by simp)⟩ #align ideal.eq_top_iff_one Ideal.eq_top_iff_one theorem ne_top_iff_one : I ≠ ⊤ ↔ (1 : α) ∉ I := not_congr I.eq_top_iff_one #align ideal.ne_top_iff_one Ideal.ne_top_iff_one @[simp] theorem unit_mul_mem_iff_mem {x y : α} (hy : IsUnit y) : y * x ∈ I ↔ x ∈ I := by refine ⟨fun h => ?_, fun h => I.mul_mem_left y h⟩ obtain ⟨y', hy'⟩ := hy.exists_left_inv have := I.mul_mem_left y' h rwa [← mul_assoc, hy', one_mul] at this #align ideal.unit_mul_mem_iff_mem Ideal.unit_mul_mem_iff_mem def span (s : Set α) : Ideal α := Submodule.span α s #align ideal.span Ideal.span @[simp] theorem submodule_span_eq {s : Set α} : Submodule.span α s = Ideal.span s := rfl #align ideal.submodule_span_eq Ideal.submodule_span_eq @[simp] theorem span_empty : span (∅ : Set α) = ⊥ := Submodule.span_empty #align ideal.span_empty Ideal.span_empty @[simp] theorem span_univ : span (Set.univ : Set α) = ⊤ := Submodule.span_univ #align ideal.span_univ Ideal.span_univ theorem span_union (s t : Set α) : span (s ∪ t) = span s ⊔ span t := Submodule.span_union _ _ #align ideal.span_union Ideal.span_union theorem span_iUnion {ι} (s : ι → Set α) : span (⋃ i, s i) = ⨆ i, span (s i) := Submodule.span_iUnion _ #align ideal.span_Union Ideal.span_iUnion theorem mem_span {s : Set α} (x) : x ∈ span s ↔ ∀ p : Ideal α, s ⊆ p → x ∈ p := mem_iInter₂ #align ideal.mem_span Ideal.mem_span theorem subset_span {s : Set α} : s ⊆ span s := Submodule.subset_span #align ideal.subset_span Ideal.subset_span theorem span_le {s : Set α} {I} : span s ≤ I ↔ s ⊆ I := Submodule.span_le #align ideal.span_le Ideal.span_le theorem span_mono {s t : Set α} : s ⊆ t → span s ≤ span t := Submodule.span_mono #align ideal.span_mono Ideal.span_mono @[simp] theorem span_eq : span (I : Set α) = I := Submodule.span_eq _ #align ideal.span_eq Ideal.span_eq @[simp] theorem span_singleton_one : span ({1} : Set α) = ⊤ := (eq_top_iff_one _).2 <| subset_span <| mem_singleton _ #align ideal.span_singleton_one Ideal.span_singleton_one
Mathlib/RingTheory/Ideal/Basic.lean
167
168
theorem isCompactElement_top : CompleteLattice.IsCompactElement (⊤ : Ideal α) := by
simpa only [← span_singleton_one] using Submodule.singleton_span_isCompactElement 1
1
import Mathlib.Logic.Function.Basic import Mathlib.Tactic.MkIffOfInductiveProp #align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" universe u v w x variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*} namespace Sum #align sum.forall Sum.forall #align sum.exists Sum.exists theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) : (∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by rw [← not_forall_not, forall_sum] simp theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj #align sum.inl_injective Sum.inl_injective theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj #align sum.inr_injective Sum.inr_injective 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 theorem eq_right_iff_getRight_eq {b : β} : x = inr b ↔ ∃ h, x.getRight h = b := by cases x <;> simp #align sum.get_left_eq_some_iff Sum.getLeft?_eq_some_iff #align sum.get_right_eq_some_iff Sum.getRight?_eq_some_iff theorem getLeft_eq_getLeft? (h₁ : x.isLeft) (h₂ : x.getLeft?.isSome) : x.getLeft h₁ = x.getLeft?.get h₂ := by simp [← getLeft?_eq_some_iff]
Mathlib/Data/Sum/Basic.lean
66
67
theorem getRight_eq_getRight? (h₁ : x.isRight) (h₂ : x.getRight?.isSome) : x.getRight h₁ = x.getRight?.get h₂ := by
simp [← getRight?_eq_some_iff]
1
import Mathlib.MeasureTheory.Measure.MeasureSpace open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function variable {R α β δ γ ι : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ] variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α} namespace Measure noncomputable def restrictₗ {m0 : MeasurableSpace α} (s : Set α) : Measure α →ₗ[ℝ≥0∞] Measure α := liftLinear (OuterMeasure.restrict s) fun μ s' hs' t => by suffices μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \ s') by simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc] exact le_toOuterMeasure_caratheodory _ _ hs' _ #align measure_theory.measure.restrictₗ MeasureTheory.Measure.restrictₗ noncomputable def restrict {_m0 : MeasurableSpace α} (μ : Measure α) (s : Set α) : Measure α := restrictₗ s μ #align measure_theory.measure.restrict MeasureTheory.Measure.restrict @[simp] theorem restrictₗ_apply {_m0 : MeasurableSpace α} (s : Set α) (μ : Measure α) : restrictₗ s μ = μ.restrict s := rfl #align measure_theory.measure.restrictₗ_apply MeasureTheory.Measure.restrictₗ_apply theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) : (μ.restrict s).toOuterMeasure = OuterMeasure.restrict s μ.toOuterMeasure := by simp_rw [restrict, restrictₗ, liftLinear, LinearMap.coe_mk, AddHom.coe_mk, toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, μ.trimmed] #align measure_theory.measure.restrict_to_outer_measure_eq_to_outer_measure_restrict MeasureTheory.Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict theorem restrict_apply₀ (ht : NullMeasurableSet t (μ.restrict s)) : μ.restrict s t = μ (t ∩ s) := by rw [← restrictₗ_apply, restrictₗ, liftLinear_apply₀ _ ht, OuterMeasure.restrict_apply, coe_toOuterMeasure] #align measure_theory.measure.restrict_apply₀ MeasureTheory.Measure.restrict_apply₀ @[simp] theorem restrict_apply (ht : MeasurableSet t) : μ.restrict s t = μ (t ∩ s) := restrict_apply₀ ht.nullMeasurableSet #align measure_theory.measure.restrict_apply MeasureTheory.Measure.restrict_apply theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s') (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' := Measure.le_iff.2 fun t ht => calc μ.restrict s t = μ (t ∩ s) := restrict_apply ht _ ≤ μ (t ∩ s') := (measure_mono_ae <| hs.mono fun _x hx ⟨hxt, hxs⟩ => ⟨hxt, hx hxs⟩) _ ≤ ν (t ∩ s') := le_iff'.1 hμν (t ∩ s') _ = ν.restrict s' t := (restrict_apply ht).symm #align measure_theory.measure.restrict_mono' MeasureTheory.Measure.restrict_mono' @[mono] theorem restrict_mono {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ (hs : s ⊆ s') ⦃μ ν : Measure α⦄ (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' := restrict_mono' (ae_of_all _ hs) hμν #align measure_theory.measure.restrict_mono MeasureTheory.Measure.restrict_mono theorem restrict_mono_ae (h : s ≤ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t := restrict_mono' h (le_refl μ) #align measure_theory.measure.restrict_mono_ae MeasureTheory.Measure.restrict_mono_ae theorem restrict_congr_set (h : s =ᵐ[μ] t) : μ.restrict s = μ.restrict t := le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le) #align measure_theory.measure.restrict_congr_set MeasureTheory.Measure.restrict_congr_set @[simp] theorem restrict_apply' (hs : MeasurableSet s) : μ.restrict s t = μ (t ∩ s) := by rw [← toOuterMeasure_apply, Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict hs, OuterMeasure.restrict_apply s t _, toOuterMeasure_apply] #align measure_theory.measure.restrict_apply' MeasureTheory.Measure.restrict_apply' theorem restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by rw [← restrict_congr_set hs.toMeasurable_ae_eq, restrict_apply' (measurableSet_toMeasurable _ _), measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)] #align measure_theory.measure.restrict_apply₀' MeasureTheory.Measure.restrict_apply₀' theorem restrict_le_self : μ.restrict s ≤ μ := Measure.le_iff.2 fun t ht => calc μ.restrict s t = μ (t ∩ s) := restrict_apply ht _ ≤ μ t := measure_mono inter_subset_left #align measure_theory.measure.restrict_le_self MeasureTheory.Measure.restrict_le_self variable (μ)
Mathlib/MeasureTheory/Measure/Restrict.lean
124
130
theorem restrict_eq_self (h : s ⊆ t) : μ.restrict t s = μ s := (le_iff'.1 restrict_le_self s).antisymm <| calc μ s ≤ μ (toMeasurable (μ.restrict t) s ∩ t) := measure_mono (subset_inter (subset_toMeasurable _ _) h) _ = μ.restrict t s := by
rw [← restrict_apply (measurableSet_toMeasurable _ _), measure_toMeasurable]
1
import Mathlib.Algebra.Algebra.Operations import Mathlib.Algebra.Algebra.Subalgebra.Prod import Mathlib.Algebra.Algebra.Subalgebra.Tower import Mathlib.LinearAlgebra.Basis import Mathlib.LinearAlgebra.Prod import Mathlib.LinearAlgebra.Finsupp import Mathlib.LinearAlgebra.Prod #align_import ring_theory.adjoin.basic from "leanprover-community/mathlib"@"a35ddf20601f85f78cd57e7f5b09ed528d71b7af" universe uR uS uA uB open Pointwise open Submodule Subsemiring variable {R : Type uR} {S : Type uS} {A : Type uA} {B : Type uB} namespace Algebra section Semiring variable [CommSemiring R] [CommSemiring S] [Semiring A] [Semiring B] variable [Algebra R S] [Algebra R A] [Algebra S A] [Algebra R B] [IsScalarTower R S A] variable {s t : Set A} @[aesop safe 20 apply (rule_sets := [SetLike])] theorem subset_adjoin : s ⊆ adjoin R s := Algebra.gc.le_u_l s #align algebra.subset_adjoin Algebra.subset_adjoin theorem adjoin_le {S : Subalgebra R A} (H : s ⊆ S) : adjoin R s ≤ S := Algebra.gc.l_le H #align algebra.adjoin_le Algebra.adjoin_le theorem adjoin_eq_sInf : adjoin R s = sInf { p : Subalgebra R A | s ⊆ p } := le_antisymm (le_sInf fun _ h => adjoin_le h) (sInf_le subset_adjoin) #align algebra.adjoin_eq_Inf Algebra.adjoin_eq_sInf theorem adjoin_le_iff {S : Subalgebra R A} : adjoin R s ≤ S ↔ s ⊆ S := Algebra.gc _ _ #align algebra.adjoin_le_iff Algebra.adjoin_le_iff theorem adjoin_mono (H : s ⊆ t) : adjoin R s ≤ adjoin R t := Algebra.gc.monotone_l H #align algebra.adjoin_mono Algebra.adjoin_mono theorem adjoin_eq_of_le (S : Subalgebra R A) (h₁ : s ⊆ S) (h₂ : S ≤ adjoin R s) : adjoin R s = S := le_antisymm (adjoin_le h₁) h₂ #align algebra.adjoin_eq_of_le Algebra.adjoin_eq_of_le theorem adjoin_eq (S : Subalgebra R A) : adjoin R ↑S = S := adjoin_eq_of_le _ (Set.Subset.refl _) subset_adjoin #align algebra.adjoin_eq Algebra.adjoin_eq theorem adjoin_iUnion {α : Type*} (s : α → Set A) : adjoin R (Set.iUnion s) = ⨆ i : α, adjoin R (s i) := (@Algebra.gc R A _ _ _).l_iSup #align algebra.adjoin_Union Algebra.adjoin_iUnion
Mathlib/RingTheory/Adjoin/Basic.lean
79
80
theorem adjoin_attach_biUnion [DecidableEq A] {α : Type*} {s : Finset α} (f : s → Finset A) : adjoin R (s.attach.biUnion f : Set A) = ⨆ x, adjoin R (f x) := by
simp [adjoin_iUnion]
1
import Mathlib.Algebra.BigOperators.Group.List import Mathlib.Data.List.OfFn import Mathlib.Data.Set.Pointwise.Basic #align_import data.set.pointwise.list_of_fn from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" namespace Set variable {F α β γ : Type*} variable [Monoid α] {s t : Set α} {a : α} {m n : ℕ} open Pointwise @[to_additive] theorem mem_prod_list_ofFn {a : α} {s : Fin n → Set α} : a ∈ (List.ofFn s).prod ↔ ∃ f : ∀ i : Fin n, s i, (List.ofFn fun i ↦ (f i : α)).prod = a := by induction' n with n ih generalizing a · simp_rw [List.ofFn_zero, List.prod_nil, Fin.exists_fin_zero_pi, eq_comm, Set.mem_one] · simp_rw [List.ofFn_succ, List.prod_cons, Fin.exists_fin_succ_pi, Fin.cons_zero, Fin.cons_succ, mem_mul, @ih, exists_exists_eq_and, SetCoe.exists, exists_prop] #align set.mem_prod_list_of_fn Set.mem_prod_list_ofFn #align set.mem_sum_list_of_fn Set.mem_sum_list_ofFn @[to_additive] theorem mem_list_prod {l : List (Set α)} {a : α} : a ∈ l.prod ↔ ∃ l' : List (Σs : Set α, ↥s), List.prod (l'.map fun x ↦ (Sigma.snd x : α)) = a ∧ l'.map Sigma.fst = l := by induction' l using List.ofFnRec with n f simp only [mem_prod_list_ofFn, List.exists_iff_exists_tuple, List.map_ofFn, Function.comp, List.ofFn_inj', Sigma.mk.inj_iff, and_left_comm, exists_and_left, exists_eq_left, heq_eq_eq] constructor · rintro ⟨fi, rfl⟩ exact ⟨fun i ↦ ⟨_, fi i⟩, rfl, rfl⟩ · rintro ⟨fi, rfl, rfl⟩ exact ⟨fun i ↦ _, rfl⟩ #align set.mem_list_prod Set.mem_list_prod #align set.mem_list_sum Set.mem_list_sum @[to_additive]
Mathlib/Data/Set/Pointwise/ListOfFn.lean
52
54
theorem mem_pow {a : α} {n : ℕ} : a ∈ s ^ n ↔ ∃ f : Fin n → s, (List.ofFn fun i ↦ (f i : α)).prod = a := by
rw [← mem_prod_list_ofFn, List.ofFn_const, List.prod_replicate]
1
import Mathlib.Algebra.Divisibility.Basic import Mathlib.Algebra.Group.Prod import Mathlib.Tactic.Common variable {ι G₁ G₂ : Type*} {G : ι → Type*} [Semigroup G₁] [Semigroup G₂] [∀ i, Semigroup (G i)] theorem prod_dvd_iff {x y : G₁ × G₂} : x ∣ y ↔ x.1 ∣ y.1 ∧ x.2 ∣ y.2 := by cases x; cases y simp only [dvd_def, Prod.exists, Prod.mk_mul_mk, Prod.mk.injEq, exists_and_left, exists_and_right, and_self, true_and] @[simp] theorem Prod.mk_dvd_mk {x₁ y₁ : G₁} {x₂ y₂ : G₂} : (x₁, x₂) ∣ (y₁, y₂) ↔ x₁ ∣ y₁ ∧ x₂ ∣ y₂ := prod_dvd_iff instance [DecompositionMonoid G₁] [DecompositionMonoid G₂] : DecompositionMonoid (G₁ × G₂) where primal a b c h := by simp_rw [prod_dvd_iff] at h ⊢ obtain ⟨a₁, a₁', h₁, h₁', eq₁⟩ := DecompositionMonoid.primal a.1 h.1 obtain ⟨a₂, a₂', h₂, h₂', eq₂⟩ := DecompositionMonoid.primal a.2 h.2 -- aesop works here exact ⟨(a₁, a₂), (a₁', a₂'), ⟨h₁, h₂⟩, ⟨h₁', h₂'⟩, Prod.ext eq₁ eq₂⟩
Mathlib/Algebra/Divisibility/Prod.lean
35
36
theorem pi_dvd_iff {x y : ∀ i, G i} : x ∣ y ↔ ∀ i, x i ∣ y i := by
simp_rw [dvd_def, Function.funext_iff, Classical.skolem]; rfl
1
import Mathlib.Computability.Halting import Mathlib.Computability.TuringMachine import Mathlib.Data.Num.Lemmas import Mathlib.Tactic.DeriveFintype #align_import computability.tm_to_partrec from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8" open Function (update) open Relation namespace Turing namespace ToPartrec inductive Code | zero' | succ | tail | cons : Code → Code → Code | comp : Code → Code → Code | case : Code → Code → Code | fix : Code → Code deriving DecidableEq, Inhabited #align turing.to_partrec.code Turing.ToPartrec.Code #align turing.to_partrec.code.zero' Turing.ToPartrec.Code.zero' #align turing.to_partrec.code.succ Turing.ToPartrec.Code.succ #align turing.to_partrec.code.tail Turing.ToPartrec.Code.tail #align turing.to_partrec.code.cons Turing.ToPartrec.Code.cons #align turing.to_partrec.code.comp Turing.ToPartrec.Code.comp #align turing.to_partrec.code.case Turing.ToPartrec.Code.case #align turing.to_partrec.code.fix Turing.ToPartrec.Code.fix def Code.eval : Code → List ℕ →. List ℕ | Code.zero' => fun v => pure (0 :: v) | Code.succ => fun v => pure [v.headI.succ] | Code.tail => fun v => pure v.tail | Code.cons f fs => fun v => do let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) | Code.comp f g => fun v => g.eval v >>= f.eval | Code.case f g => fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) | Code.fix f => PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail #align turing.to_partrec.code.eval Turing.ToPartrec.Code.eval namespace Code @[simp] theorem zero'_eval : zero'.eval = fun v => pure (0 :: v) := by simp [eval] @[simp] theorem succ_eval : succ.eval = fun v => pure [v.headI.succ] := by simp [eval] @[simp] theorem tail_eval : tail.eval = fun v => pure v.tail := by simp [eval] @[simp] theorem cons_eval (f fs) : (cons f fs).eval = fun v => do { let n ← Code.eval f v let ns ← Code.eval fs v pure (n.headI :: ns) } := by simp [eval] @[simp] theorem comp_eval (f g) : (comp f g).eval = fun v => g.eval v >>= f.eval := by simp [eval] @[simp] theorem case_eval (f g) : (case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y::v.tail) := by simp [eval] @[simp]
Mathlib/Computability/TMToPartrec.lean
163
166
theorem fix_eval (f) : (fix f).eval = PFun.fix fun v => (f.eval v).map fun v => if v.headI = 0 then Sum.inl v.tail else Sum.inr v.tail := by
simp [eval]
1
import Mathlib.Data.Multiset.Nodup import Mathlib.Data.List.NatAntidiagonal #align_import data.multiset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset namespace Nat def antidiagonal (n : ℕ) : Multiset (ℕ × ℕ) := List.Nat.antidiagonal n #align multiset.nat.antidiagonal Multiset.Nat.antidiagonal @[simp] theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by rw [antidiagonal, mem_coe, List.Nat.mem_antidiagonal] #align multiset.nat.mem_antidiagonal Multiset.Nat.mem_antidiagonal @[simp]
Mathlib/Data/Multiset/NatAntidiagonal.lean
42
43
theorem card_antidiagonal (n : ℕ) : card (antidiagonal n) = n + 1 := by
rw [antidiagonal, coe_card, List.Nat.length_antidiagonal]
1
import Mathlib.Analysis.PSeries import Mathlib.Data.Real.Pi.Wallis import Mathlib.Tactic.AdaptationNote #align_import analysis.special_functions.stirling from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open scoped Topology Real Nat Asymptotics open Finset Filter Nat Real namespace Stirling noncomputable def stirlingSeq (n : ℕ) : ℝ := n ! / (√(2 * n : ℝ) * (n / exp 1) ^ n) #align stirling.stirling_seq Stirling.stirlingSeq @[simp]
Mathlib/Analysis/SpecialFunctions/Stirling.lean
56
57
theorem stirlingSeq_zero : stirlingSeq 0 = 0 := by
rw [stirlingSeq, cast_zero, mul_zero, Real.sqrt_zero, zero_mul, div_zero]
1
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open Function Filter Set open scoped Topology namespace Real variable {x y : ℝ} -- @[pp_nodot] is no longer needed def arsinh (x : ℝ) := log (x + √(1 + x ^ 2)) #align real.arsinh Real.arsinh theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by apply exp_log rw [← neg_lt_iff_pos_add'] apply lt_sqrt_of_sq_lt simp #align real.exp_arsinh Real.exp_arsinh @[simp]
Mathlib/Analysis/SpecialFunctions/Arsinh.lean
65
65
theorem arsinh_zero : arsinh 0 = 0 := by
simp [arsinh]
1
import Mathlib.Topology.Algebra.Module.WeakDual import Mathlib.Analysis.Normed.Field.Basic import Mathlib.Analysis.LocallyConvex.WithSeminorms #align_import analysis.locally_convex.weak_dual from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {𝕜 E F ι : Type*} open Topology section BilinForm namespace LinearMap variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F] def toSeminorm (f : E →ₗ[𝕜] 𝕜) : Seminorm 𝕜 E := (normSeminorm 𝕜 𝕜).comp f #align linear_map.to_seminorm LinearMap.toSeminorm theorem coe_toSeminorm {f : E →ₗ[𝕜] 𝕜} : ⇑f.toSeminorm = fun x => ‖f x‖ := rfl #align linear_map.coe_to_seminorm LinearMap.coe_toSeminorm @[simp] theorem toSeminorm_apply {f : E →ₗ[𝕜] 𝕜} {x : E} : f.toSeminorm x = ‖f x‖ := rfl #align linear_map.to_seminorm_apply LinearMap.toSeminorm_apply
Mathlib/Analysis/LocallyConvex/WeakDual.lean
68
70
theorem toSeminorm_ball_zero {f : E →ₗ[𝕜] 𝕜} {r : ℝ} : Seminorm.ball f.toSeminorm 0 r = { x : E | ‖f x‖ < r } := by
simp only [Seminorm.ball_zero_eq, toSeminorm_apply]
1
import Mathlib.Algebra.Algebra.Spectrum import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.RingTheory.Nilpotent.Basic #align_import linear_algebra.eigenspace.basic from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w namespace Module namespace End open FiniteDimensional Set variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M] [Field K] [AddCommGroup V] [Module K V] def eigenspace (f : End R M) (μ : R) : Submodule R M := LinearMap.ker (f - algebraMap R (End R M) μ) #align module.End.eigenspace Module.End.eigenspace @[simp] theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by simp [eigenspace] #align module.End.eigenspace_zero Module.End.eigenspace_zero def HasEigenvector (f : End R M) (μ : R) (x : M) : Prop := x ∈ eigenspace f μ ∧ x ≠ 0 #align module.End.has_eigenvector Module.End.HasEigenvector def HasEigenvalue (f : End R M) (a : R) : Prop := eigenspace f a ≠ ⊥ #align module.End.has_eigenvalue Module.End.HasEigenvalue def Eigenvalues (f : End R M) : Type _ := { μ : R // f.HasEigenvalue μ } #align module.End.eigenvalues Module.End.Eigenvalues @[coe] def Eigenvalues.val (f : Module.End R M) : Eigenvalues f → R := Subtype.val instance Eigenvalues.instCoeOut {f : Module.End R M} : CoeOut (Eigenvalues f) R where coe := Eigenvalues.val f instance Eigenvalues.instDecidableEq [DecidableEq R] (f : Module.End R M) : DecidableEq (Eigenvalues f) := inferInstanceAs (DecidableEq (Subtype (fun x : R => HasEigenvalue f x))) theorem hasEigenvalue_of_hasEigenvector {f : End R M} {μ : R} {x : M} (h : HasEigenvector f μ x) : HasEigenvalue f μ := by rw [HasEigenvalue, Submodule.ne_bot_iff] use x; exact h #align module.End.has_eigenvalue_of_has_eigenvector Module.End.hasEigenvalue_of_hasEigenvector
Mathlib/LinearAlgebra/Eigenspace/Basic.lean
104
105
theorem mem_eigenspace_iff {f : End R M} {μ : R} {x : M} : x ∈ eigenspace f μ ↔ f x = μ • x := by
rw [eigenspace, LinearMap.mem_ker, LinearMap.sub_apply, algebraMap_end_apply, sub_eq_zero]
1
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Banach import Mathlib.LinearAlgebra.SesquilinearForm #align_import analysis.inner_product_space.symmetric from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open RCLike open ComplexConjugate variable {𝕜 E E' F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearMap def IsSymmetric (T : E →ₗ[𝕜] E) : Prop := ∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫ #align linear_map.is_symmetric LinearMap.IsSymmetric
Mathlib/Analysis/InnerProductSpace/Symmetric.lean
71
72
theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) : conj ⟪T x, y⟫ = ⟪T y, x⟫ := by
rw [hT x y, inner_conj_symm]
1
import Mathlib.Analysis.Complex.UpperHalfPlane.Topology import Mathlib.Analysis.SpecialFunctions.Arsinh import Mathlib.Geometry.Euclidean.Inversion.Basic #align_import analysis.complex.upper_half_plane.metric from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c" noncomputable section open scoped UpperHalfPlane ComplexConjugate NNReal Topology MatrixGroups open Set Metric Filter Real variable {z w : ℍ} {r R : ℝ} namespace UpperHalfPlane instance : Dist ℍ := ⟨fun z w => 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im)))⟩ theorem dist_eq (z w : ℍ) : dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im))) := rfl #align upper_half_plane.dist_eq UpperHalfPlane.dist_eq theorem sinh_half_dist (z w : ℍ) : sinh (dist z w / 2) = dist (z : ℂ) w / (2 * √(z.im * w.im)) := by rw [dist_eq, mul_div_cancel_left₀ (arsinh _) two_ne_zero, sinh_arsinh] #align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist theorem cosh_half_dist (z w : ℍ) : cosh (dist z w / 2) = dist (z : ℂ) (conj (w : ℂ)) / (2 * √(z.im * w.im)) := by rw [← sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt] · congr 1 simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj, Complex.conj_conj, Complex.mul_re, Complex.conj_re, Complex.conj_im, coe_im] ring all_goals positivity #align upper_half_plane.cosh_half_dist UpperHalfPlane.cosh_half_dist theorem tanh_half_dist (z w : ℍ) : tanh (dist z w / 2) = dist (z : ℂ) w / dist (z : ℂ) (conj ↑w) := by rw [tanh_eq_sinh_div_cosh, sinh_half_dist, cosh_half_dist, div_div_div_comm, div_self, div_one] positivity #align upper_half_plane.tanh_half_dist UpperHalfPlane.tanh_half_dist theorem exp_half_dist (z w : ℍ) : exp (dist z w / 2) = (dist (z : ℂ) w + dist (z : ℂ) (conj ↑w)) / (2 * √(z.im * w.im)) := by rw [← sinh_add_cosh, sinh_half_dist, cosh_half_dist, add_div] #align upper_half_plane.exp_half_dist UpperHalfPlane.exp_half_dist theorem cosh_dist (z w : ℍ) : cosh (dist z w) = 1 + dist (z : ℂ) w ^ 2 / (2 * z.im * w.im) := by rw [dist_eq, cosh_two_mul, cosh_sq', add_assoc, ← two_mul, sinh_arsinh, div_pow, mul_pow, sq_sqrt, sq (2 : ℝ), mul_assoc, ← mul_div_assoc, mul_assoc, mul_div_mul_left] <;> positivity #align upper_half_plane.cosh_dist UpperHalfPlane.cosh_dist theorem sinh_half_dist_add_dist (a b c : ℍ) : sinh ((dist a b + dist b c) / 2) = (dist (a : ℂ) b * dist (c : ℂ) (conj ↑b) + dist (b : ℂ) c * dist (a : ℂ) (conj ↑b)) / (2 * √(a.im * c.im) * dist (b : ℂ) (conj ↑b)) := by simp only [add_div _ _ (2 : ℝ), sinh_add, sinh_half_dist, cosh_half_dist, div_mul_div_comm] rw [← add_div, Complex.dist_self_conj, coe_im, abs_of_pos b.im_pos, mul_comm (dist (b : ℂ) _), dist_comm (b : ℂ), Complex.dist_conj_comm, mul_mul_mul_comm, mul_mul_mul_comm _ _ _ b.im] congr 2 rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (√a.im), mul_mul_mul_comm, mul_self_sqrt, mul_comm] <;> exact (im_pos _).le #align upper_half_plane.sinh_half_dist_add_dist UpperHalfPlane.sinh_half_dist_add_dist protected theorem dist_comm (z w : ℍ) : dist z w = dist w z := by simp only [dist_eq, dist_comm (z : ℂ), mul_comm] #align upper_half_plane.dist_comm UpperHalfPlane.dist_comm
Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean
91
93
theorem dist_le_iff_le_sinh : dist z w ≤ r ↔ dist (z : ℂ) w / (2 * √(z.im * w.im)) ≤ sinh (r / 2) := by
rw [← div_le_div_right (zero_lt_two' ℝ), ← sinh_le_sinh, sinh_half_dist]
1
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.BigOperators.Ring.Finset import Mathlib.Algebra.Order.Field.Basic import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Ring.Opposite import Mathlib.Tactic.Abel #align_import algebra.geom_sum from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" -- Porting note: corrected type in the description of `geom_sum₂_Ico` (in the doc string only). universe u variable {α : Type u} open Finset MulOpposite section Semiring variable [Semiring α] theorem geom_sum_succ {x : α} {n : ℕ} : ∑ i ∈ range (n + 1), x ^ i = (x * ∑ i ∈ range n, x ^ i) + 1 := by simp only [mul_sum, ← pow_succ', sum_range_succ', pow_zero] #align geom_sum_succ geom_sum_succ theorem geom_sum_succ' {x : α} {n : ℕ} : ∑ i ∈ range (n + 1), x ^ i = x ^ n + ∑ i ∈ range n, x ^ i := (sum_range_succ _ _).trans (add_comm _ _) #align geom_sum_succ' geom_sum_succ' theorem geom_sum_zero (x : α) : ∑ i ∈ range 0, x ^ i = 0 := rfl #align geom_sum_zero geom_sum_zero theorem geom_sum_one (x : α) : ∑ i ∈ range 1, x ^ i = 1 := by simp [geom_sum_succ'] #align geom_sum_one geom_sum_one @[simp]
Mathlib/Algebra/GeomSum.lean
64
64
theorem geom_sum_two {x : α} : ∑ i ∈ range 2, x ^ i = x + 1 := by
simp [geom_sum_succ']
1
import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section lcm def lcm (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.lcm 1 f #align finset.lcm Finset.lcm variable {s s₁ s₂ : Finset β} {f : β → α} theorem lcm_def : s.lcm f = (s.1.map f).lcm := rfl #align finset.lcm_def Finset.lcm_def @[simp] theorem lcm_empty : (∅ : Finset β).lcm f = 1 := fold_empty #align finset.lcm_empty Finset.lcm_empty @[simp] theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by apply Iff.trans Multiset.lcm_dvd simp only [Multiset.mem_map, and_imp, exists_imp] exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩ #align finset.lcm_dvd_iff Finset.lcm_dvd_iff theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a := lcm_dvd_iff.2 #align finset.lcm_dvd Finset.lcm_dvd theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f := lcm_dvd_iff.1 dvd_rfl _ hb #align finset.dvd_lcm Finset.dvd_lcm @[simp] theorem lcm_insert [DecidableEq β] {b : β} : (insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by by_cases h : b ∈ s · rw [insert_eq_of_mem h, (lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)] apply fold_insert h #align finset.lcm_insert Finset.lcm_insert @[simp] theorem lcm_singleton {b : β} : ({b} : Finset β).lcm f = normalize (f b) := Multiset.lcm_singleton #align finset.lcm_singleton Finset.lcm_singleton -- Porting note: Priority changed for `simpNF` @[simp 1100] theorem normalize_lcm : normalize (s.lcm f) = s.lcm f := by simp [lcm_def] #align finset.normalize_lcm Finset.normalize_lcm theorem lcm_union [DecidableEq β] : (s₁ ∪ s₂).lcm f = GCDMonoid.lcm (s₁.lcm f) (s₂.lcm f) := Finset.induction_on s₁ (by rw [empty_union, lcm_empty, lcm_one_left, normalize_lcm]) fun a s _ ih ↦ by rw [insert_union, lcm_insert, lcm_insert, ih, lcm_assoc] #align finset.lcm_union Finset.lcm_union theorem lcm_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) : s₁.lcm f = s₂.lcm g := by subst hs exact Finset.fold_congr hfg #align finset.lcm_congr Finset.lcm_congr theorem lcm_mono_fun {g : β → α} (h : ∀ b ∈ s, f b ∣ g b) : s.lcm f ∣ s.lcm g := lcm_dvd fun b hb ↦ (h b hb).trans (dvd_lcm hb) #align finset.lcm_mono_fun Finset.lcm_mono_fun theorem lcm_mono (h : s₁ ⊆ s₂) : s₁.lcm f ∣ s₂.lcm f := lcm_dvd fun _ hb ↦ dvd_lcm (h hb) #align finset.lcm_mono Finset.lcm_mono
Mathlib/Algebra/GCDMonoid/Finset.lean
114
116
theorem lcm_image [DecidableEq β] {g : γ → β} (s : Finset γ) : (s.image g).lcm f = s.lcm (f ∘ g) := by
classical induction' s using Finset.induction with c s _ ih <;> simp [*]
1
import Mathlib.Algebra.Polynomial.Splits #align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222" noncomputable section @[ext] structure Cubic (R : Type*) where (a b c d : R) #align cubic Cubic namespace Cubic open Cubic Polynomial open Polynomial variable {R S F K : Type*} instance [Inhabited R] : Inhabited (Cubic R) := ⟨⟨default, default, default, default⟩⟩ instance [Zero R] : Zero (Cubic R) := ⟨⟨0, 0, 0, 0⟩⟩ section Basic variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R] def toPoly (P : Cubic R) : R[X] := C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d #align cubic.to_poly Cubic.toPoly theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} : C w * (X - C x) * (X - C y) * (X - C z) = toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by simp only [toPoly, C_neg, C_add, C_mul] ring1 set_option linter.uppercaseLean3 false in #align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq theorem prod_X_sub_C_eq [CommRing S] {x y z : S} : (X - C x) * (X - C y) * (X - C z) = toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul] set_option linter.uppercaseLean3 false in #align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq section Coeff private theorem coeffs : (∀ n > 3, P.toPoly.coeff n = 0) ∧ P.toPoly.coeff 3 = P.a ∧ P.toPoly.coeff 2 = P.b ∧ P.toPoly.coeff 1 = P.c ∧ P.toPoly.coeff 0 = P.d := by simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow] set_option tactic.skipAssignedInstances false in norm_num intro n hn repeat' rw [if_neg] any_goals linarith only [hn] repeat' rw [zero_add] @[simp] theorem coeff_eq_zero {n : ℕ} (hn : 3 < n) : P.toPoly.coeff n = 0 := coeffs.1 n hn #align cubic.coeff_eq_zero Cubic.coeff_eq_zero @[simp] theorem coeff_eq_a : P.toPoly.coeff 3 = P.a := coeffs.2.1 #align cubic.coeff_eq_a Cubic.coeff_eq_a @[simp] theorem coeff_eq_b : P.toPoly.coeff 2 = P.b := coeffs.2.2.1 #align cubic.coeff_eq_b Cubic.coeff_eq_b @[simp] theorem coeff_eq_c : P.toPoly.coeff 1 = P.c := coeffs.2.2.2.1 #align cubic.coeff_eq_c Cubic.coeff_eq_c @[simp] theorem coeff_eq_d : P.toPoly.coeff 0 = P.d := coeffs.2.2.2.2 #align cubic.coeff_eq_d Cubic.coeff_eq_d
Mathlib/Algebra/CubicDiscriminant.lean
121
121
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by
rw [← coeff_eq_a, h, coeff_eq_a]
1
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 theorem factorization_eq_factors_multiset (n : ℕ) : n.factorization = Multiset.toFinsupp (n.factors : Multiset ℕ) := by ext p simp #align nat.factorization_eq_factors_multiset Nat.factorization_eq_factors_multiset theorem multiplicity_eq_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) : multiplicity p n = n.factorization p := by simp [factorization, pp, padicValNat_def' pp.ne_one hn.bot_lt] #align nat.multiplicity_eq_factorization Nat.multiplicity_eq_factorization @[simp] theorem factorization_prod_pow_eq_self {n : ℕ} (hn : n ≠ 0) : n.factorization.prod (· ^ ·) = n := by rw [factorization_eq_factors_multiset n] simp only [← prod_toMultiset, factorization, Multiset.prod_coe, Multiset.toFinsupp_toMultiset] exact prod_factors hn #align nat.factorization_prod_pow_eq_self Nat.factorization_prod_pow_eq_self theorem eq_of_factorization_eq {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) (h : ∀ p : ℕ, a.factorization p = b.factorization p) : a = b := eq_of_perm_factors ha hb (by simpa only [List.perm_iff_count, factors_count_eq] using h) #align nat.eq_of_factorization_eq Nat.eq_of_factorization_eq theorem factorization_inj : Set.InjOn factorization { x : ℕ | x ≠ 0 } := fun a ha b hb h => eq_of_factorization_eq ha hb fun p => by simp [h] #align nat.factorization_inj Nat.factorization_inj @[simp] theorem factorization_zero : factorization 0 = 0 := by ext; simp [factorization] #align nat.factorization_zero Nat.factorization_zero @[simp] theorem factorization_one : factorization 1 = 0 := by ext; simp [factorization] #align nat.factorization_one Nat.factorization_one #noalign nat.support_factorization #align nat.factor_iff_mem_factorization Nat.mem_primeFactors_iff_mem_factors #align nat.prime_of_mem_factorization Nat.prime_of_mem_primeFactors #align nat.pos_of_mem_factorization Nat.pos_of_mem_primeFactors #align nat.le_of_mem_factorization Nat.le_of_mem_primeFactors
Mathlib/Data/Nat/Factorization/Basic.lean
133
135
theorem factorization_eq_zero_iff (n p : ℕ) : n.factorization p = 0 ↔ ¬p.Prime ∨ ¬p ∣ n ∨ n = 0 := by
simp_rw [← not_mem_support_iff, support_factorization, mem_primeFactors, not_and_or, not_ne_iff]
1
import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.NormedSpace.ProdLp import Mathlib.Topology.Instances.TrivSqZeroExt #align_import analysis.normed_space.triv_sq_zero_ext from "leanprover-community/mathlib"@"88a563b158f59f2983cfad685664da95502e8cdd" variable (𝕜 : Type*) {S R M : Type*} local notation "tsze" => TrivSqZeroExt open NormedSpace -- For `exp`. namespace TrivSqZeroExt section Topology noncomputable section Seminormed section Ring variable [SeminormedCommRing S] [SeminormedRing R] [SeminormedAddCommGroup M] variable [Algebra S R] [Module S M] [Module R M] [Module Rᵐᵒᵖ M] variable [BoundedSMul S R] [BoundedSMul S M] [BoundedSMul R M] [BoundedSMul Rᵐᵒᵖ M] variable [SMulCommClass R Rᵐᵒᵖ M] [IsScalarTower S R M] [IsScalarTower S Rᵐᵒᵖ M] instance instL1SeminormedAddCommGroup : SeminormedAddCommGroup (tsze R M) := inferInstanceAs <| SeminormedAddCommGroup (WithLp 1 <| R × M) example : (TrivSqZeroExt.instUniformSpace : UniformSpace (tsze R M)) = PseudoMetricSpace.toUniformSpace := rfl theorem norm_def (x : tsze R M) : ‖x‖ = ‖fst x‖ + ‖snd x‖ := by rw [WithLp.prod_norm_eq_add (by norm_num)] simp only [ENNReal.one_toReal, Real.rpow_one, div_one] rfl
Mathlib/Analysis/NormedSpace/TrivSqZeroExt.lean
219
220
theorem nnnorm_def (x : tsze R M) : ‖x‖₊ = ‖fst x‖₊ + ‖snd x‖₊ := by
ext; simp [norm_def]
1
import Mathlib.Algebra.Group.Hom.Defs import Mathlib.Algebra.Group.Units #align_import algebra.hom.units from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered open Function universe u v w namespace Units variable {α : Type*} {M : Type u} {N : Type v} {P : Type w} [Monoid M] [Monoid N] [Monoid P] @[to_additive "The additive homomorphism on `AddUnit`s induced by an `AddMonoidHom`."] def map (f : M →* N) : Mˣ →* Nˣ := MonoidHom.mk' (fun u => ⟨f u.val, f u.inv, by rw [← f.map_mul, u.val_inv, f.map_one], by rw [← f.map_mul, u.inv_val, f.map_one]⟩) fun x y => ext (f.map_mul x y) #align units.map Units.map #align add_units.map AddUnits.map @[to_additive (attr := simp)] theorem coe_map (f : M →* N) (x : Mˣ) : ↑(map f x) = f x := rfl #align units.coe_map Units.coe_map #align add_units.coe_map AddUnits.coe_map @[to_additive (attr := simp)] theorem coe_map_inv (f : M →* N) (u : Mˣ) : ↑(map f u)⁻¹ = f ↑u⁻¹ := rfl #align units.coe_map_inv Units.coe_map_inv #align add_units.coe_map_neg AddUnits.coe_map_neg @[to_additive (attr := simp)] theorem map_comp (f : M →* N) (g : N →* P) : map (g.comp f) = (map g).comp (map f) := rfl #align units.map_comp Units.map_comp #align add_units.map_comp AddUnits.map_comp @[to_additive] lemma map_injective {f : M →* N} (hf : Function.Injective f) : Function.Injective (map f) := fun _ _ e => ext (hf (congr_arg val e)) variable (M) @[to_additive (attr := simp)] theorem map_id : map (MonoidHom.id M) = MonoidHom.id Mˣ := by ext; rfl #align units.map_id Units.map_id #align add_units.map_id AddUnits.map_id @[to_additive "Coercion `AddUnits M → M` as an AddMonoid homomorphism."] def coeHom : Mˣ →* M where toFun := Units.val; map_one' := val_one; map_mul' := val_mul #align units.coe_hom Units.coeHom #align add_units.coe_hom AddUnits.coeHom variable {M} @[to_additive (attr := simp)] theorem coeHom_apply (x : Mˣ) : coeHom M x = ↑x := rfl #align units.coe_hom_apply Units.coeHom_apply #align add_units.coe_hom_apply AddUnits.coeHom_apply @[to_additive "If a map `g : M → AddUnits N` agrees with a homomorphism `f : M →+ N`, then this map is an AddMonoid homomorphism too."] def liftRight (f : M →* N) (g : M → Nˣ) (h : ∀ x, ↑(g x) = f x) : M →* Nˣ where toFun := g map_one' := by ext; rw [h 1]; exact f.map_one map_mul' x y := Units.ext <| by simp only [h, val_mul, f.map_mul] #align units.lift_right Units.liftRight #align add_units.lift_right AddUnits.liftRight @[to_additive (attr := simp)] theorem coe_liftRight {f : M →* N} {g : M → Nˣ} (h : ∀ x, ↑(g x) = f x) (x) : (liftRight f g h x : N) = f x := h x #align units.coe_lift_right Units.coe_liftRight #align add_units.coe_lift_right AddUnits.coe_liftRight @[to_additive (attr := simp)] theorem mul_liftRight_inv {f : M →* N} {g : M → Nˣ} (h : ∀ x, ↑(g x) = f x) (x) : f x * ↑(liftRight f g h x)⁻¹ = 1 := by rw [Units.mul_inv_eq_iff_eq_mul, one_mul, coe_liftRight] #align units.mul_lift_right_inv Units.mul_liftRight_inv #align add_units.add_lift_right_neg AddUnits.add_liftRight_neg @[to_additive (attr := simp)]
Mathlib/Algebra/Group/Units/Hom.lean
157
159
theorem liftRight_inv_mul {f : M →* N} {g : M → Nˣ} (h : ∀ x, ↑(g x) = f x) (x) : ↑(liftRight f g h x)⁻¹ * f x = 1 := by
rw [Units.inv_mul_eq_iff_eq_mul, mul_one, coe_liftRight]
1
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] theorem preimage_coe_Ico : (some : α → WithTop α) ⁻¹' Ico a b = Ico a b := by simp [← Ici_inter_Iio] #align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico @[simp] theorem preimage_coe_Ioc : (some : α → WithTop α) ⁻¹' Ioc a b = Ioc a b := by simp [← Ioi_inter_Iic] #align with_top.preimage_coe_Ioc WithTop.preimage_coe_Ioc @[simp] theorem preimage_coe_Ioo : (some : α → WithTop α) ⁻¹' Ioo a b = Ioo a b := by simp [← Ioi_inter_Iio] #align with_top.preimage_coe_Ioo WithTop.preimage_coe_Ioo @[simp]
Mathlib/Order/Interval/Set/WithBotTop.lean
75
76
theorem preimage_coe_Iio_top : (some : α → WithTop α) ⁻¹' Iio ⊤ = univ := by
rw [← range_coe, preimage_range]
1
import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Data.Finset.Sym import Mathlib.Data.Matrix.Basic #align_import combinatorics.simple_graph.inc_matrix from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Finset Matrix SimpleGraph Sym2 open Matrix namespace SimpleGraph variable (R : Type*) {α : Type*} (G : SimpleGraph α) noncomputable def incMatrix [Zero R] [One R] : Matrix α (Sym2 α) R := fun a => (G.incidenceSet a).indicator 1 #align simple_graph.inc_matrix SimpleGraph.incMatrix variable {R} theorem incMatrix_apply [Zero R] [One R] {a : α} {e : Sym2 α} : G.incMatrix R a e = (G.incidenceSet a).indicator 1 e := rfl #align simple_graph.inc_matrix_apply SimpleGraph.incMatrix_apply theorem incMatrix_apply' [Zero R] [One R] [DecidableEq α] [DecidableRel G.Adj] {a : α} {e : Sym2 α} : G.incMatrix R a e = if e ∈ G.incidenceSet a then 1 else 0 := by unfold incMatrix Set.indicator convert rfl #align simple_graph.inc_matrix_apply' SimpleGraph.incMatrix_apply' section NonAssocSemiring variable [Fintype (Sym2 α)] [NonAssocSemiring R] {a b : α} {e : Sym2 α}
Mathlib/Combinatorics/SimpleGraph/IncMatrix.lean
121
123
theorem sum_incMatrix_apply [Fintype (neighborSet G a)] : ∑ e, G.incMatrix R a e = G.degree a := by
classical simp [incMatrix_apply', sum_boole, Set.filter_mem_univ_eq_toFinset]
1
import Mathlib.MeasureTheory.Measure.MeasureSpace import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic #align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Topology ENNReal MeasureTheory open Set Function Filter namespace MeasureTheory namespace Measure section Basic variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y] [T2Space Y] (μ ν : Measure X) class IsOpenPosMeasure : Prop where open_pos : ∀ U : Set X, IsOpen U → U.Nonempty → μ U ≠ 0 #align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure variable [IsOpenPosMeasure μ] {s U F : Set X} {x : X} theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : μ U ≠ 0 := IsOpenPosMeasure.open_pos U hU hne #align is_open.measure_ne_zero IsOpen.measure_ne_zero theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < μ U := (hU.measure_ne_zero μ hne).bot_lt #align is_open.measure_pos IsOpen.measure_pos instance (priority := 100) [Nonempty X] : NeZero μ := ⟨measure_univ_pos.mp <| isOpen_univ.measure_pos μ univ_nonempty⟩ theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < μ U ↔ U.Nonempty := ⟨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm ▸ measure_empty, hU.measure_pos μ⟩ #align is_open.measure_pos_iff IsOpen.measure_pos_iff theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := by simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using not_congr (hU.measure_pos_iff μ) #align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < μ s := (isOpen_interior.measure_pos μ h).trans_le (measure_mono interior_subset) #align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior theorem measure_pos_of_mem_nhds (h : s ∈ 𝓝 x) : 0 < μ s := measure_pos_of_nonempty_interior _ ⟨x, mem_interior_iff_mem_nhds.2 h⟩ #align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds theorem isOpenPosMeasure_smul {c : ℝ≥0∞} (h : c ≠ 0) : IsOpenPosMeasure (c • μ) := ⟨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero μ Une)⟩ #align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul variable {μ ν} protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : μ ≪ ν) : IsOpenPosMeasure ν := ⟨fun _U ho hne h₀ => ho.measure_ne_zero μ hne (h h₀)⟩ #align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure theorem _root_.LE.le.isOpenPosMeasure (h : μ ≤ ν) : IsOpenPosMeasure ν := h.absolutelyContinuous.isOpenPosMeasure #align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) : μ U = 0 ↔ U = ∅ := ⟨fun h ↦ (hU.measure_eq_zero_iff μ).mp h, fun h ↦ by simp [h]⟩
Mathlib/MeasureTheory/Measure/OpenPos.lean
88
90
theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) : U =ᵐ[μ] (∅ : Set X) ↔ U = ∅ := by
rw [ae_eq_empty, hU.measure_zero_iff_eq_empty]
1
import Mathlib.Data.Matrix.Basic import Mathlib.Data.PEquiv #align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" namespace PEquiv open Matrix universe u v variable {k l m n : Type*} variable {α : Type v} open Matrix def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α := of fun i j => if j ∈ f i then (1 : α) else 0 #align pequiv.to_matrix PEquiv.toMatrix -- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024 @[simp] theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) : toMatrix f i j = if j ∈ f i then (1 : α) else 0 := rfl #align pequiv.to_matrix_apply PEquiv.toMatrix_apply theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α) (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f i with fi · simp [h] · rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm] #align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by ext simp only [transpose, mem_iff_mem f, toMatrix_apply] congr #align pequiv.to_matrix_symm PEquiv.toMatrix_symm @[simp] theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] : ((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by ext simp [toMatrix_apply, one_apply] #align pequiv.to_matrix_refl PEquiv.toMatrix_refl theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n) (i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f.symm j with fj · simp [h, ← f.eq_some_iff] · rw [Finset.sum_eq_single fj] · simp [h, ← f.eq_some_iff] · rintro b - n simp [h, ← f.eq_some_iff, n.symm] · simp #align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m) (M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by ext i j rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id] #align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n) (M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm := Matrix.ext fun i j => by rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply, Matrix.submatrix_apply, id] #align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m) (g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix := by ext i j rw [mul_matrix_apply] dsimp [toMatrix, PEquiv.trans] cases f i <;> simp #align pequiv.to_matrix_trans PEquiv.toMatrix_trans @[simp] theorem toMatrix_bot [DecidableEq n] [Zero α] [One α] : ((⊥ : PEquiv m n).toMatrix : Matrix m n α) = 0 := rfl #align pequiv.to_matrix_bot PEquiv.toMatrix_bot theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] : Function.Injective (@toMatrix m n α _ _ _) := by classical intro f g refine not_imp_not.1 ?_ simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp] intro i hi use i cases' hf : f i with fi · cases' hg : g i with gi -- Porting note: was `cc` · rw [hf, hg] at hi exact (hi rfl).elim · use gi simp · use fi simp [hf.symm, Ne.symm hi] #align pequiv.to_matrix_injective PEquiv.toMatrix_injective theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) : (Equiv.swap i j).toPEquiv.toMatrix = (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix + (single j i).toMatrix := by ext dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply] split_ifs <;> simp_all #align pequiv.to_matrix_swap PEquiv.toMatrix_swap @[simp] theorem single_mul_single [Fintype n] [DecidableEq k] [DecidableEq m] [DecidableEq n] [Semiring α] (a : m) (b : n) (c : k) : ((single a b).toMatrix : Matrix _ _ α) * (single b c).toMatrix = (single a c).toMatrix := by rw [← toMatrix_trans, single_trans_single] #align pequiv.single_mul_single PEquiv.single_mul_single
Mathlib/Data/Matrix/PEquiv.lean
158
161
theorem single_mul_single_of_ne [Fintype n] [DecidableEq n] [DecidableEq k] [DecidableEq m] [Semiring α] {b₁ b₂ : n} (hb : b₁ ≠ b₂) (a : m) (c : k) : (single a b₁).toMatrix * (single b₂ c).toMatrix = (0 : Matrix _ _ α) := by
rw [← toMatrix_trans, single_trans_single_of_ne hb, toMatrix_bot]
1
import Batteries.Data.DList import Mathlib.Mathport.Rename import Mathlib.Tactic.Cases #align_import data.dlist from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd" universe u #align dlist Batteries.DList namespace Batteries.DList open Function variable {α : Type u} #align dlist.of_list Batteries.DList.ofList def lazy_ofList (l : Thunk (List α)) : DList α := ⟨fun xs => l.get ++ xs, fun t => by simp⟩ #align dlist.lazy_of_list Batteries.DList.lazy_ofList #align dlist.to_list Batteries.DList.toList #align dlist.empty Batteries.DList.empty #align dlist.singleton Batteries.DList.singleton attribute [local simp] Function.comp #align dlist.cons Batteries.DList.cons #align dlist.concat Batteries.DList.push #align dlist.append Batteries.DList.append attribute [local simp] ofList toList empty singleton cons push append
Mathlib/Data/DList/Defs.lean
58
59
theorem toList_ofList (l : List α) : DList.toList (DList.ofList l) = l := by
cases l; rfl; simp only [DList.toList, DList.ofList, List.cons_append, List.append_nil]
1
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_left₀ OrderIso.mulLeft₀ #align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply #align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_right₀ OrderIso.mulRight₀ #align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply #align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc] #align le_div_iff' le_div_iff' theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b := ⟨fun h => calc a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm] _ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le , fun h => calc a / b = a * (1 / b) := div_eq_mul_one_div a b _ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le _ = c * b / b := (div_eq_mul_one_div (c * b) b).symm _ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl ⟩ #align div_le_iff div_le_iff theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb] #align div_le_iff' div_le_iff' lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by rw [div_le_iff hb, div_le_iff' hc] theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b := lt_iff_lt_of_le_iff_le <| div_le_iff hc #align lt_div_iff lt_div_iff theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by rw [mul_comm, lt_div_iff hc] #align lt_div_iff' lt_div_iff' theorem div_lt_iff (hc : 0 < c) : b / c < a ↔ b < a * c := lt_iff_lt_of_le_iff_le (le_div_iff hc) #align div_lt_iff div_lt_iff theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by rw [mul_comm, div_lt_iff hc] #align div_lt_iff' div_lt_iff' lemma div_lt_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b < c ↔ a / c < b := by rw [div_lt_iff hb, div_lt_iff' hc] theorem inv_mul_le_iff (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_le_iff' h #align inv_mul_le_iff inv_mul_le_iff theorem inv_mul_le_iff' (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ c * b := by rw [inv_mul_le_iff h, mul_comm] #align inv_mul_le_iff' inv_mul_le_iff' theorem mul_inv_le_iff (h : 0 < b) : a * b⁻¹ ≤ c ↔ a ≤ b * c := by rw [mul_comm, inv_mul_le_iff h] #align mul_inv_le_iff mul_inv_le_iff theorem mul_inv_le_iff' (h : 0 < b) : a * b⁻¹ ≤ c ↔ a ≤ c * b := by rw [mul_comm, inv_mul_le_iff' h] #align mul_inv_le_iff' mul_inv_le_iff' theorem div_self_le_one (a : α) : a / a ≤ 1 := if h : a = 0 then by simp [h] else by simp [h] #align div_self_le_one div_self_le_one theorem inv_mul_lt_iff (h : 0 < b) : b⁻¹ * a < c ↔ a < b * c := by rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div] exact div_lt_iff' h #align inv_mul_lt_iff inv_mul_lt_iff
Mathlib/Algebra/Order/Field/Basic.lean
122
122
theorem inv_mul_lt_iff' (h : 0 < b) : b⁻¹ * a < c ↔ a < c * b := by
rw [inv_mul_lt_iff h, mul_comm]
1
import Mathlib.MeasureTheory.Integral.Bochner import Mathlib.MeasureTheory.Group.Measure #align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f" namespace MeasureTheory open Measure TopologicalSpace open scoped ENNReal variable {𝕜 M α G E F : Type*} [MeasurableSpace G] variable [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] variable {μ : Measure G} {f : G → E} {g : G} section MeasurableMul variable [Group G] [MeasurableMul G] @[to_additive "Translating a function by left-addition does not change its integral with respect to a left-invariant measure."] -- Porting note: was `@[simp]` theorem integral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → E) (g : G) : (∫ x, f (g * x) ∂μ) = ∫ x, f x ∂μ := by have h_mul : MeasurableEmbedding fun x => g * x := (MeasurableEquiv.mulLeft g).measurableEmbedding rw [← h_mul.integral_map, map_mul_left_eq_self] #align measure_theory.integral_mul_left_eq_self MeasureTheory.integral_mul_left_eq_self #align measure_theory.integral_add_left_eq_self MeasureTheory.integral_add_left_eq_self @[to_additive "Translating a function by right-addition does not change its integral with respect to a right-invariant measure."] -- Porting note: was `@[simp]` theorem integral_mul_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) : (∫ x, f (x * g) ∂μ) = ∫ x, f x ∂μ := by have h_mul : MeasurableEmbedding fun x => x * g := (MeasurableEquiv.mulRight g).measurableEmbedding rw [← h_mul.integral_map, map_mul_right_eq_self] #align measure_theory.integral_mul_right_eq_self MeasureTheory.integral_mul_right_eq_self #align measure_theory.integral_add_right_eq_self MeasureTheory.integral_add_right_eq_self @[to_additive] -- Porting note: was `@[simp]` theorem integral_div_right_eq_self [IsMulRightInvariant μ] (f : G → E) (g : G) : (∫ x, f (x / g) ∂μ) = ∫ x, f x ∂μ := by simp_rw [div_eq_mul_inv] -- Porting note: was `simp_rw` rw [integral_mul_right_eq_self f g⁻¹] #align measure_theory.integral_div_right_eq_self MeasureTheory.integral_div_right_eq_self #align measure_theory.integral_sub_right_eq_self MeasureTheory.integral_sub_right_eq_self @[to_additive "If some left-translate of a function negates it, then the integral of the function with respect to a left-invariant measure is 0."]
Mathlib/MeasureTheory/Group/Integral.lean
92
94
theorem integral_eq_zero_of_mul_left_eq_neg [IsMulLeftInvariant μ] (hf' : ∀ x, f (g * x) = -f x) : ∫ x, f x ∂μ = 0 := by
simp_rw [← self_eq_neg ℝ E, ← integral_neg, ← hf', integral_mul_left_eq_self]
1
import Mathlib.Algebra.Order.Ring.Abs #align_import data.int.order.units from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" namespace Int
Mathlib/Data/Int/Order/Units.lean
17
18
theorem isUnit_iff_abs_eq {x : ℤ} : IsUnit x ↔ abs x = 1 := by
rw [isUnit_iff_natAbs_eq, abs_eq_natAbs, ← Int.ofNat_one, natCast_inj]
1
import Mathlib.SetTheory.Ordinal.Arithmetic import Mathlib.SetTheory.Ordinal.Exponential #align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b" noncomputable section universe u open List namespace Ordinal @[elab_as_elim] noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o := fun o ↦ by by_cases h : o = 0 · rw [h]; exact H0 · exact H o h (CNFRec _ H0 H (o % b ^ log b o)) termination_by o => o decreasing_by exact mod_opow_log_lt_self b h set_option linter.uppercaseLean3 false in #align ordinal.CNF_rec Ordinal.CNFRec @[simp] theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by rw [CNFRec, dif_pos rfl] rfl set_option linter.uppercaseLean3 false in #align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
Mathlib/SetTheory/Ordinal/CantorNormalForm.lean
62
64
theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0) (H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by
rw [CNFRec, dif_neg ho]
1
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α} {s t : Set α} namespace MeasureTheory section NormedAddCommGroup variable (μ) variable {f g : α → E} noncomputable def average (f : α → E) := ∫ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.average MeasureTheory.average notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r @[simp] theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero] #align measure_theory.average_zero MeasureTheory.average_zero @[simp] theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by rw [average, smul_zero, integral_zero_measure] #align measure_theory.average_zero_measure MeasureTheory.average_zero_measure @[simp] theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ := integral_neg f #align measure_theory.average_neg MeasureTheory.average_neg theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ := rfl #align measure_theory.average_eq' MeasureTheory.average_eq'
Mathlib/MeasureTheory/Integral/Average.lean
332
333
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
1
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Multiset.Powerset #align_import data.finset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Finset open Function Multiset variable {α : Type*} {s t : Finset α} section powersetCard variable {n} {s t : Finset α} def powersetCard (n : ℕ) (s : Finset α) : Finset (Finset α) := ⟨((s.1.powersetCard n).pmap Finset.mk) fun _t h => nodup_of_le (mem_powersetCard.1 h).1 s.2, s.2.powersetCard.pmap fun _a _ha _b _hb => congr_arg Finset.val⟩ #align finset.powerset_len Finset.powersetCard @[simp] lemma mem_powersetCard : s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n := by cases s; simp [powersetCard, val_le_iff.symm] #align finset.mem_powerset_len Finset.mem_powersetCard @[simp] theorem powersetCard_mono {n} {s t : Finset α} (h : s ⊆ t) : powersetCard n s ⊆ powersetCard n t := fun _u h' => mem_powersetCard.2 <| And.imp (fun h₂ => Subset.trans h₂ h) id (mem_powersetCard.1 h') #align finset.powerset_len_mono Finset.powersetCard_mono @[simp] theorem card_powersetCard (n : ℕ) (s : Finset α) : card (powersetCard n s) = Nat.choose (card s) n := (card_pmap _ _ _).trans (Multiset.card_powersetCard n s.1) #align finset.card_powerset_len Finset.card_powersetCard @[simp] theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by ext; rw [mem_powersetCard, mem_singleton, card_eq_zero] refine ⟨fun h => h.2, fun h => by rw [h] exact ⟨empty_subset s, rfl⟩⟩ #align finset.powerset_len_zero Finset.powersetCard_zero lemma powersetCard_empty_subsingleton (n : ℕ) : (powersetCard n (∅ : Finset α) : Set $ Finset α).Subsingleton := by simp [Set.Subsingleton, subset_empty] @[simp]
Mathlib/Data/Finset/Powerset.lean
233
235
theorem map_val_val_powersetCard (s : Finset α) (i : ℕ) : (s.powersetCard i).val.map Finset.val = s.1.powersetCard i := by
simp [Finset.powersetCard, map_pmap, pmap_eq_map, map_id']
1
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv #align_import linear_algebra.affine_space.midpoint from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open AffineMap AffineEquiv section variable (R : Type*) {V V' P P' : Type*} [Ring R] [Invertible (2 : R)] [AddCommGroup V] [Module R V] [AddTorsor V P] [AddCommGroup V'] [Module R V'] [AddTorsor V' P'] def midpoint (x y : P) : P := lineMap x y (⅟ 2 : R) #align midpoint midpoint variable {R} {x y z : P} @[simp] theorem AffineMap.map_midpoint (f : P →ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_map.map_midpoint AffineMap.map_midpoint @[simp] theorem AffineEquiv.map_midpoint (f : P ≃ᵃ[R] P') (a b : P) : f (midpoint R a b) = midpoint R (f a) (f b) := f.apply_lineMap a b _ #align affine_equiv.map_midpoint AffineEquiv.map_midpoint theorem AffineEquiv.pointReflection_midpoint_left (x y : P) : pointReflection R (midpoint R x y) x = y := by rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd] #align affine_equiv.point_reflection_midpoint_left AffineEquiv.pointReflection_midpoint_left @[simp] -- Porting note: added variant with `Equiv.pointReflection` for `simp` theorem Equiv.pointReflection_midpoint_left (x y : P) : (Equiv.pointReflection (midpoint R x y)) x = y := by rw [midpoint, pointReflection_apply, lineMap_apply, vadd_vsub, vadd_vadd, ← add_smul, ← two_mul, mul_invOf_self, one_smul, vsub_vadd]
Mathlib/LinearAlgebra/AffineSpace/Midpoint.lean
73
74
theorem midpoint_comm (x y : P) : midpoint R x y = midpoint R y x := by
rw [midpoint, ← lineMap_apply_one_sub, one_sub_invOf_two, midpoint]
1
import Mathlib.Order.Filter.Prod #align_import order.filter.n_ary from "leanprover-community/mathlib"@"78f647f8517f021d839a7553d5dc97e79b508dea" open Function Set open Filter namespace Filter variable {α α' β β' γ γ' δ δ' ε ε' : Type*} {m : α → β → γ} {f f₁ f₂ : Filter α} {g g₁ g₂ : Filter β} {h h₁ h₂ : Filter γ} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {u : Set γ} {v : Set δ} {a : α} {b : β} {c : γ} def map₂ (m : α → β → γ) (f : Filter α) (g : Filter β) : Filter γ := ((f ×ˢ g).map (uncurry m)).copy { s | ∃ u ∈ f, ∃ v ∈ g, image2 m u v ⊆ s } fun _ ↦ by simp only [mem_map, mem_prod_iff, image2_subset_iff, prod_subset_iff]; rfl #align filter.map₂ Filter.map₂ @[simp 900] theorem mem_map₂_iff : u ∈ map₂ m f g ↔ ∃ s ∈ f, ∃ t ∈ g, image2 m s t ⊆ u := Iff.rfl #align filter.mem_map₂_iff Filter.mem_map₂_iff theorem image2_mem_map₂ (hs : s ∈ f) (ht : t ∈ g) : image2 m s t ∈ map₂ m f g := ⟨_, hs, _, ht, Subset.rfl⟩ #align filter.image2_mem_map₂ Filter.image2_mem_map₂
Mathlib/Order/Filter/NAry.lean
53
55
theorem map_prod_eq_map₂ (m : α → β → γ) (f : Filter α) (g : Filter β) : Filter.map (fun p : α × β => m p.1 p.2) (f ×ˢ g) = map₂ m f g := by
rw [map₂, copy_eq, uncurry_def]
1
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Tactic.LinearCombination #align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946" namespace Polynomial.Chebyshev set_option linter.uppercaseLean3 false -- `T` `U` `X` open Polynomial variable (R S : Type*) [CommRing R] [CommRing S] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def T : ℤ → R[X] | 0 => 1 | 1 => X | (n : ℕ) + 2 => 2 * X * T (n + 1) - T n | -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.T Polynomial.Chebyshev.T @[elab_as_elim] protected theorem induct (motive : ℤ → Prop) (zero : motive 0) (one : motive 1) (add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2)) (neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) : ∀ (a : ℤ), motive a := T.induct Unit motive zero one add_two fun n hn hnm => by simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm @[simp] theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n | (k : ℕ) => T.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k #align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by linear_combination (norm := ring_nf) T_add_two R (n - 2) theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by linear_combination (norm := ring_nf) T_add_two R (n - 1) theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by linear_combination (norm := ring_nf) T_add_two R (n - 2) #align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq @[simp] theorem T_zero : T R 0 = 1 := rfl #align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero @[simp] theorem T_one : T R 1 = X := rfl #align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X) theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by simpa [pow_two, mul_assoc] using T_add_two R 0 #align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two @[simp] theorem T_neg (n : ℤ) : T R (-n) = T R n := by induction n using Polynomial.Chebyshev.induct with | zero => rfl | one => show 2 * X * 1 - X = X; ring | add_two n ih1 ih2 => have h₁ := T_add_two R n have h₂ := T_sub_two R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 - h₁ + h₂ | neg_add_one n ih1 ih2 => have h₁ := T_add_one R n have h₂ := T_sub_one R (-n) linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 + h₁ - h₂ theorem T_natAbs (n : ℤ) : T R n.natAbs = T R n := by obtain h | h := Int.natAbs_eq n <;> nth_rw 2 [h]; simp theorem T_neg_two : T R (-2) = 2 * X ^ 2 - 1 := by simp [T_two] -- Well-founded definitions are now irreducible by default; -- as this was implemented before this change, -- we just set it back to semireducible to avoid needing to change any proofs. @[semireducible] noncomputable def U : ℤ → R[X] | 0 => 1 | 1 => 2 * X | (n : ℕ) + 2 => 2 * X * U (n + 1) - U n | -((n : ℕ) + 1) => 2 * X * U (-n) - U (-n + 1) termination_by n => Int.natAbs n + Int.natAbs (n - 1) #align polynomial.chebyshev.U Polynomial.Chebyshev.U @[simp] theorem U_add_two : ∀ n, U R (n + 2) = 2 * X * U R (n + 1) - U R n | (k : ℕ) => U.eq_3 R k | -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) U.eq_4 R k theorem U_add_one (n : ℤ) : U R (n + 1) = 2 * X * U R n - U R (n - 1) := by linear_combination (norm := ring_nf) U_add_two R (n - 1)
Mathlib/RingTheory/Polynomial/Chebyshev.lean
156
157
theorem U_sub_two (n : ℤ) : U R (n - 2) = 2 * X * U R (n - 1) - U R n := by
linear_combination (norm := ring_nf) U_add_two R (n - 2)
1