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.Pow.Complex
import Qq
#align_import analysis.special_functions.pow.real from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real ComplexConjugate
open Finset Set
namespace Real
variable {x y z : ℝ}
noncomputable def rpow (x y : ℝ) :=
((x : ℂ) ^ (y : ℂ)).re
#align real.rpow Real.rpow
noncomputable instance : Pow ℝ ℝ := ⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x y : ℝ) : rpow x y = x ^ y := rfl
#align real.rpow_eq_pow Real.rpow_eq_pow
theorem rpow_def (x y : ℝ) : x ^ y = ((x : ℂ) ^ (y : ℂ)).re := rfl
#align real.rpow_def Real.rpow_def
theorem rpow_def_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) :
x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := by
simp only [rpow_def, Complex.cpow_def]; split_ifs <;>
simp_all [(Complex.ofReal_log hx).symm, -Complex.ofReal_mul, -RCLike.ofReal_mul,
(Complex.ofReal_mul _ _).symm, Complex.exp_ofReal_re, Complex.ofReal_eq_zero]
#align real.rpow_def_of_nonneg Real.rpow_def_of_nonneg
theorem rpow_def_of_pos {x : ℝ} (hx : 0 < x) (y : ℝ) : x ^ y = exp (log x * y) := by
rw [rpow_def_of_nonneg (le_of_lt hx), if_neg (ne_of_gt hx)]
#align real.rpow_def_of_pos Real.rpow_def_of_pos
theorem exp_mul (x y : ℝ) : exp (x * y) = exp x ^ y := by rw [rpow_def_of_pos (exp_pos _), log_exp]
#align real.exp_mul Real.exp_mul
@[simp, norm_cast]
theorem rpow_intCast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n := by
simp only [rpow_def, ← Complex.ofReal_zpow, Complex.cpow_intCast, Complex.ofReal_intCast,
Complex.ofReal_re]
#align real.rpow_int_cast Real.rpow_intCast
@[deprecated (since := "2024-04-17")]
alias rpow_int_cast := rpow_intCast
@[simp, norm_cast]
theorem rpow_natCast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n := by simpa using rpow_intCast x n
#align real.rpow_nat_cast Real.rpow_natCast
@[deprecated (since := "2024-04-17")]
alias rpow_nat_cast := rpow_natCast
@[simp]
theorem exp_one_rpow (x : ℝ) : exp 1 ^ x = exp x := by rw [← exp_mul, one_mul]
#align real.exp_one_rpow Real.exp_one_rpow
@[simp] lemma exp_one_pow (n : ℕ) : exp 1 ^ n = exp n := by rw [← rpow_natCast, exp_one_rpow]
theorem rpow_eq_zero_iff_of_nonneg (hx : 0 ≤ x) : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
simp only [rpow_def_of_nonneg hx]
split_ifs <;> simp [*, exp_ne_zero]
#align real.rpow_eq_zero_iff_of_nonneg Real.rpow_eq_zero_iff_of_nonneg
@[simp]
lemma rpow_eq_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y = 0 ↔ x = 0 := by
simp [rpow_eq_zero_iff_of_nonneg, *]
@[simp]
lemma rpow_ne_zero (hx : 0 ≤ x) (hy : y ≠ 0) : x ^ y ≠ 0 ↔ x ≠ 0 :=
Real.rpow_eq_zero hx hy |>.not
open Real
theorem rpow_def_of_neg {x : ℝ} (hx : x < 0) (y : ℝ) : x ^ y = exp (log x * y) * cos (y * π) := by
rw [rpow_def, Complex.cpow_def, if_neg]
· have : Complex.log x * y = ↑(log (-x) * y) + ↑(y * π) * Complex.I := by
simp only [Complex.log, abs_of_neg hx, Complex.arg_ofReal_of_neg hx, Complex.abs_ofReal,
Complex.ofReal_mul]
ring
rw [this, Complex.exp_add_mul_I, ← Complex.ofReal_exp, ← Complex.ofReal_cos, ←
Complex.ofReal_sin, mul_add, ← Complex.ofReal_mul, ← mul_assoc, ← Complex.ofReal_mul,
Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im,
Real.log_neg_eq_log]
ring
· rw [Complex.ofReal_eq_zero]
exact ne_of_lt hx
#align real.rpow_def_of_neg Real.rpow_def_of_neg
| Mathlib/Analysis/SpecialFunctions/Pow/Real.lean | 115 | 117 | theorem rpow_def_of_nonpos {x : ℝ} (hx : x ≤ 0) (y : ℝ) :
x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) * cos (y * π) := by |
split_ifs with h <;> simp [rpow_def, *]; exact rpow_def_of_neg (lt_of_le_of_ne hx h) _
| 1 |
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5"
noncomputable section
open scoped NNReal ENNReal Pointwise Topology
open Inv Set Function MeasureTheory.Measure Filter
open FiniteDimensional
namespace MeasureTheory
namespace Measure
example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by
infer_instance
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E]
[FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
variable {s : Set E}
theorem integral_comp_smul (f : E → F) (R : ℝ) :
∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
by_cases hF : CompleteSpace F; swap
· simp [integral, hF]
rcases eq_or_ne R 0 with (rfl | hR)
· simp only [zero_smul, integral_const]
rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE)
· have : Subsingleton E := finrank_zero_iff.1 hE
have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0]
conv_rhs => rw [this]
simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const]
· have : Nontrivial E := finrank_pos_iff.1 hE
simp only [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, ENNReal.top_toReal, zero_smul,
inv_zero, abs_zero]
· calc
(∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ :=
(integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv
f).symm
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg]
#align measure_theory.measure.integral_comp_smul MeasureTheory.Measure.integral_comp_smul
theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} :
∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))]
#align measure_theory.measure.integral_comp_smul_of_nonneg MeasureTheory.Measure.integral_comp_smul_of_nonneg
theorem integral_comp_inv_smul (f : E → F) (R : ℝ) :
∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv]
#align measure_theory.measure.integral_comp_inv_smul MeasureTheory.Measure.integral_comp_inv_smul
| Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean | 105 | 107 | theorem integral_comp_inv_smul_of_nonneg (f : E → F) {R : ℝ} (hR : 0 ≤ R) :
∫ x, f (R⁻¹ • x) ∂μ = R ^ finrank ℝ E • ∫ x, f x ∂μ := by |
rw [integral_comp_inv_smul μ f R, abs_of_nonneg (pow_nonneg hR _)]
| 1 |
import Mathlib.CategoryTheory.Idempotents.Basic
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Equivalence
#align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f"
noncomputable section
open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators
namespace CategoryTheory
variable (C : Type*) [Category C]
namespace Idempotents
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Karoubi where
X : C
p : X ⟶ X
idem : p ≫ p = p := by aesop_cat
#align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi
namespace Karoubi
variable {C}
attribute [reassoc (attr := simp)] idem
@[ext]
theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) :
P = Q := by
cases P
cases Q
dsimp at h_X h_p
subst h_X
simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p
#align category_theory.idempotents.karoubi.ext CategoryTheory.Idempotents.Karoubi.ext
@[ext]
structure Hom (P Q : Karoubi C) where
f : P.X ⟶ Q.X
comm : f = P.p ≫ f ≫ Q.p := by aesop_cat
#align category_theory.idempotents.karoubi.hom CategoryTheory.Idempotents.Karoubi.Hom
instance [Preadditive C] (P Q : Karoubi C) : Inhabited (Hom P Q) :=
⟨⟨0, by rw [zero_comp, comp_zero]⟩⟩
@[reassoc (attr := simp)]
theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by rw [f.comm, ← assoc, P.idem]
#align category_theory.idempotents.karoubi.p_comp CategoryTheory.Idempotents.Karoubi.p_comp
@[reassoc (attr := simp)]
theorem comp_p {P Q : Karoubi C} (f : Hom P Q) : f.f ≫ Q.p = f.f := by
rw [f.comm, assoc, assoc, Q.idem]
#align category_theory.idempotents.karoubi.comp_p CategoryTheory.Idempotents.Karoubi.comp_p
@[reassoc]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 94 | 94 | theorem p_comm {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f ≫ Q.p := by | rw [p_comp, comp_p]
| 1 |
import Mathlib.Control.EquivFunctor
import Mathlib.CategoryTheory.Groupoid
import Mathlib.CategoryTheory.Whiskering
import Mathlib.CategoryTheory.Types
#align_import category_theory.core from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
namespace CategoryTheory
universe v₁ v₂ u₁ u₂
-- morphism levels before object levels. See note [CategoryTheory universes].
-- Porting note(#5171): linter not yet ported
-- @[nolint has_nonempty_instance]
def Core (C : Type u₁) := C
#align category_theory.core CategoryTheory.Core
variable {C : Type u₁} [Category.{v₁} C]
instance coreCategory : Groupoid.{v₁} (Core C) where
Hom (X Y : C) := X ≅ Y
id (X : C) := Iso.refl X
comp f g := Iso.trans f g
inv {X Y} f := Iso.symm f
#align category_theory.core_category CategoryTheory.coreCategory
namespace Core
@[simp]
| Mathlib/CategoryTheory/Core.lean | 52 | 53 | theorem id_hom (X : C) : Iso.hom (coreCategory.id X) = @CategoryStruct.id C _ X := by |
rfl
| 1 |
import Mathlib.ModelTheory.Syntax
import Mathlib.ModelTheory.Semantics
import Mathlib.Algebra.Ring.Equiv
variable {α : Type*}
namespace FirstOrder
open FirstOrder
inductive ringFunc : ℕ → Type
| add : ringFunc 2
| mul : ringFunc 2
| neg : ringFunc 1
| zero : ringFunc 0
| one : ringFunc 0
deriving DecidableEq
def Language.ring : Language :=
{ Functions := ringFunc
Relations := fun _ => Empty }
namespace Ring
open ringFunc Language
instance (n : ℕ) : DecidableEq (Language.ring.Functions n) := by
dsimp [Language.ring]; infer_instance
instance (n : ℕ) : DecidableEq (Language.ring.Relations n) := by
dsimp [Language.ring]; infer_instance
abbrev addFunc : Language.ring.Functions 2 := add
abbrev mulFunc : Language.ring.Functions 2 := mul
abbrev negFunc : Language.ring.Functions 1 := neg
abbrev zeroFunc : Language.ring.Functions 0 := zero
abbrev oneFunc : Language.ring.Functions 0 := one
instance (α : Type*) : Zero (Language.ring.Term α) :=
{ zero := Constants.term zeroFunc }
theorem zero_def (α : Type*) : (0 : Language.ring.Term α) = Constants.term zeroFunc := rfl
instance (α : Type*) : One (Language.ring.Term α) :=
{ one := Constants.term oneFunc }
theorem one_def (α : Type*) : (1 : Language.ring.Term α) = Constants.term oneFunc := rfl
instance (α : Type*) : Add (Language.ring.Term α) :=
{ add := addFunc.apply₂ }
theorem add_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
t₁ + t₂ = addFunc.apply₂ t₁ t₂ := rfl
instance (α : Type*) : Mul (Language.ring.Term α) :=
{ mul := mulFunc.apply₂ }
theorem mul_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
t₁ * t₂ = mulFunc.apply₂ t₁ t₂ := rfl
instance (α : Type*) : Neg (Language.ring.Term α) :=
{ neg := negFunc.apply₁ }
theorem neg_def (α : Type*) (t : Language.ring.Term α) :
-t = negFunc.apply₁ t := rfl
instance : Fintype Language.ring.Symbols :=
⟨⟨Multiset.ofList
[Sum.inl ⟨2, .add⟩,
Sum.inl ⟨2, .mul⟩,
Sum.inl ⟨1, .neg⟩,
Sum.inl ⟨0, .zero⟩,
Sum.inl ⟨0, .one⟩], by
dsimp [Language.Symbols]; decide⟩, by
intro x
dsimp [Language.Symbols]
rcases x with ⟨_, f⟩ | ⟨_, f⟩
· cases f <;> decide
· cases f ⟩
@[simp]
theorem card_ring : card Language.ring = 5 := by
have : Fintype.card Language.ring.Symbols = 5 := rfl
simp [Language.card, this]
open Language ring Structure
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
extends Language.ring.Structure R where
funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
funMap_neg : ∀ x, funMap negFunc x = -x 0
funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
open CompatibleRing
attribute [simp] funMap_add funMap_mul funMap_neg funMap_zero funMap_one
section
variable {R : Type*} [Add R] [Mul R] [Neg R] [One R] [Zero R] [CompatibleRing R]
@[simp]
theorem realize_add (x y : ring.Term α) (v : α → R) :
Term.realize v (x + y) = Term.realize v x + Term.realize v y := by
simp [add_def, funMap_add]
@[simp]
theorem realize_mul (x y : ring.Term α) (v : α → R) :
Term.realize v (x * y) = Term.realize v x * Term.realize v y := by
simp [mul_def, funMap_mul]
@[simp]
theorem realize_neg (x : ring.Term α) (v : α → R) :
Term.realize v (-x) = -Term.realize v x := by
simp [neg_def, funMap_neg]
@[simp]
| Mathlib/ModelTheory/Algebra/Ring/Basic.lean | 195 | 196 | theorem realize_zero (v : α → R) : Term.realize v (0 : ring.Term α) = 0 := by |
simp [zero_def, funMap_zero, constantMap]
| 1 |
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.Monotone
import Mathlib.Data.Set.Function
import Mathlib.Algebra.Group.Basic
import Mathlib.Tactic.WLOG
#align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped NNReal ENNReal Topology UniformConvergence
open Set MeasureTheory Filter
-- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context
variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
noncomputable def eVariationOn (f : α → E) (s : Set α) : ℝ≥0∞ :=
⨆ p : ℕ × { u : ℕ → α // Monotone u ∧ ∀ i, u i ∈ s },
∑ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i))
#align evariation_on eVariationOn
def BoundedVariationOn (f : α → E) (s : Set α) :=
eVariationOn f s ≠ ∞
#align has_bounded_variation_on BoundedVariationOn
def LocallyBoundedVariationOn (f : α → E) (s : Set α) :=
∀ a b, a ∈ s → b ∈ s → BoundedVariationOn f (s ∩ Icc a b)
#align has_locally_bounded_variation_on LocallyBoundedVariationOn
namespace eVariationOn
theorem nonempty_monotone_mem {s : Set α} (hs : s.Nonempty) :
Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ s } := by
obtain ⟨x, hx⟩ := hs
exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩
#align evariation_on.nonempty_monotone_mem eVariationOn.nonempty_monotone_mem
theorem eq_of_edist_zero_on {f f' : α → E} {s : Set α} (h : ∀ ⦃x⦄, x ∈ s → edist (f x) (f' x) = 0) :
eVariationOn f s = eVariationOn f' s := by
dsimp only [eVariationOn]
congr 1 with p : 1
congr 1 with i : 1
rw [edist_congr_right (h <| p.snd.prop.2 (i + 1)), edist_congr_left (h <| p.snd.prop.2 i)]
#align evariation_on.eq_of_edist_zero_on eVariationOn.eq_of_edist_zero_on
theorem eq_of_eqOn {f f' : α → E} {s : Set α} (h : EqOn f f' s) :
eVariationOn f s = eVariationOn f' s :=
eq_of_edist_zero_on fun x xs => by rw [h xs, edist_self]
#align evariation_on.eq_of_eq_on eVariationOn.eq_of_eqOn
theorem sum_le (f : α → E) {s : Set α} (n : ℕ) {u : ℕ → α} (hu : Monotone u) (us : ∀ i, u i ∈ s) :
(∑ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s :=
le_iSup_of_le ⟨n, u, hu, us⟩ le_rfl
#align evariation_on.sum_le eVariationOn.sum_le
theorem sum_le_of_monotoneOn_Icc (f : α → E) {s : Set α} {m n : ℕ} {u : ℕ → α}
(hu : MonotoneOn u (Icc m n)) (us : ∀ i ∈ Icc m n, u i ∈ s) :
(∑ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s := by
rcases le_total n m with hnm | hmn
· simp [Finset.Ico_eq_empty_of_le hnm]
let π := projIcc m n hmn
let v i := u (π i)
calc
∑ i ∈ Finset.Ico m n, edist (f (u (i + 1))) (f (u i))
= ∑ i ∈ Finset.Ico m n, edist (f (v (i + 1))) (f (v i)) :=
Finset.sum_congr rfl fun i hi ↦ by
rw [Finset.mem_Ico] at hi
simp only [v, π, projIcc_of_mem hmn ⟨hi.1, hi.2.le⟩,
projIcc_of_mem hmn ⟨hi.1.trans i.le_succ, hi.2⟩]
_ ≤ ∑ i ∈ Finset.range n, edist (f (v (i + 1))) (f (v i)) :=
Finset.sum_mono_set _ (Nat.Iio_eq_range ▸ Finset.Ico_subset_Iio_self)
_ ≤ eVariationOn f s :=
sum_le _ _ (fun i j h ↦ hu (π i).2 (π j).2 (monotone_projIcc hmn h)) fun i ↦ us _ (π i).2
#align evariation_on.sum_le_of_monotone_on_Icc eVariationOn.sum_le_of_monotoneOn_Icc
| Mathlib/Analysis/BoundedVariation.lean | 127 | 130 | theorem sum_le_of_monotoneOn_Iic (f : α → E) {s : Set α} {n : ℕ} {u : ℕ → α}
(hu : MonotoneOn u (Iic n)) (us : ∀ i ≤ n, u i ∈ s) :
(∑ i ∈ Finset.range n, edist (f (u (i + 1))) (f (u i))) ≤ eVariationOn f s := by |
simpa using sum_le_of_monotoneOn_Icc f (m := 0) (hu.mono Icc_subset_Iic_self) fun i hi ↦ us i hi.2
| 1 |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.GroupTheory.FreeAbelianGroup
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
#align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
noncomputable section
variable {X : Type*}
def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ :=
FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ)
#align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp
def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X :=
Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x)
#align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup
open Finsupp FreeAbelianGroup
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) :
Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) =
(smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
ext
simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul,
toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
#align finsupp.to_free_abelian_group_comp_single_add_hom Finsupp.toFreeAbelianGroup_comp_singleAddHom
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
ext x y; simp only [AddMonoidHom.id_comp]
rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom]
simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply,
one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply]
#align free_abelian_group.to_finsupp_comp_to_free_abelian_group FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp :
toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by
ext
rw [toFreeAbelianGroup, toFinsupp, AddMonoidHom.comp_apply, lift.of,
liftAddHom_apply_single, AddMonoidHom.flip_apply, smulAddHom_apply, one_smul,
AddMonoidHom.id_apply]
#align finsupp.to_free_abelian_group_comp_to_finsupp Finsupp.toFreeAbelianGroup_comp_toFinsupp
@[simp]
theorem Finsupp.toFreeAbelianGroup_toFinsupp {X} (x : FreeAbelianGroup X) :
Finsupp.toFreeAbelianGroup (FreeAbelianGroup.toFinsupp x) = x := by
rw [← AddMonoidHom.comp_apply, Finsupp.toFreeAbelianGroup_comp_toFinsupp, AddMonoidHom.id_apply]
#align finsupp.to_free_abelian_group_to_finsupp Finsupp.toFreeAbelianGroup_toFinsupp
namespace FreeAbelianGroup
open Finsupp
@[simp]
theorem toFinsupp_of (x : X) : toFinsupp (of x) = Finsupp.single x 1 := by
simp only [toFinsupp, lift.of]
#align free_abelian_group.to_finsupp_of FreeAbelianGroup.toFinsupp_of
@[simp]
| Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean | 87 | 89 | theorem toFinsupp_toFreeAbelianGroup (f : X →₀ ℤ) :
FreeAbelianGroup.toFinsupp (Finsupp.toFreeAbelianGroup f) = f := by |
rw [← AddMonoidHom.comp_apply, toFinsupp_comp_toFreeAbelianGroup, AddMonoidHom.id_apply]
| 1 |
import Mathlib.Data.Finset.Lattice
#align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
variable {α : Type*} [DecidableEq α] {𝒜 ℬ : Finset (Finset α)} {s : Finset α} {a : α}
namespace Finset
def nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) :=
𝒜.filter fun s => a ∉ s
#align finset.non_member_subfamily Finset.nonMemberSubfamily
def memberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) :=
(𝒜.filter fun s => a ∈ s).image fun s => erase s a
#align finset.member_subfamily Finset.memberSubfamily
@[simp]
theorem mem_nonMemberSubfamily : s ∈ 𝒜.nonMemberSubfamily a ↔ s ∈ 𝒜 ∧ a ∉ s := by
simp [nonMemberSubfamily]
#align finset.mem_non_member_subfamily Finset.mem_nonMemberSubfamily
@[simp]
theorem mem_memberSubfamily : s ∈ 𝒜.memberSubfamily a ↔ insert a s ∈ 𝒜 ∧ a ∉ s := by
simp_rw [memberSubfamily, mem_image, mem_filter]
refine ⟨?_, fun h => ⟨insert a s, ⟨h.1, by simp⟩, erase_insert h.2⟩⟩
rintro ⟨s, ⟨hs1, hs2⟩, rfl⟩
rw [insert_erase hs2]
exact ⟨hs1, not_mem_erase _ _⟩
#align finset.mem_member_subfamily Finset.mem_memberSubfamily
theorem nonMemberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) :
(𝒜 ∩ ℬ).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a ∩ ℬ.nonMemberSubfamily a :=
filter_inter_distrib _ _ _
#align finset.non_member_subfamily_inter Finset.nonMemberSubfamily_inter
theorem memberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) :
(𝒜 ∩ ℬ).memberSubfamily a = 𝒜.memberSubfamily a ∩ ℬ.memberSubfamily a := by
unfold memberSubfamily
rw [filter_inter_distrib, image_inter_of_injOn _ _ ((erase_injOn' _).mono _)]
simp
#align finset.member_subfamily_inter Finset.memberSubfamily_inter
theorem nonMemberSubfamily_union (a : α) (𝒜 ℬ : Finset (Finset α)) :
(𝒜 ∪ ℬ).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a ∪ ℬ.nonMemberSubfamily a :=
filter_union _ _ _
#align finset.non_member_subfamily_union Finset.nonMemberSubfamily_union
| Mathlib/Combinatorics/SetFamily/Compression/Down.lean | 86 | 88 | theorem memberSubfamily_union (a : α) (𝒜 ℬ : Finset (Finset α)) :
(𝒜 ∪ ℬ).memberSubfamily a = 𝒜.memberSubfamily a ∪ ℬ.memberSubfamily a := by |
simp_rw [memberSubfamily, filter_union, image_union]
| 1 |
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Data.PNat.Defs
#align_import data.pnat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
open Finset Function PNat
namespace PNat
variable (a b : ℕ+)
instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ+ := Subtype.instLocallyFiniteOrder _
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Icc_eq_finset_subtype PNat.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ico_eq_finset_subtype PNat.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ioc_eq_finset_subtype PNat.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).subtype fun n : ℕ => 0 < n :=
rfl
#align pnat.Ioo_eq_finset_subtype PNat.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).subtype fun n : ℕ => 0 < n := rfl
#align pnat.uIcc_eq_finset_subtype PNat.uIcc_eq_finset_subtype
theorem map_subtype_embedding_Icc : (Icc a b).map (Embedding.subtype _) = Icc ↑a ↑b :=
Finset.map_subtype_embedding_Icc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Icc PNat.map_subtype_embedding_Icc
theorem map_subtype_embedding_Ico : (Ico a b).map (Embedding.subtype _) = Ico ↑a ↑b :=
Finset.map_subtype_embedding_Ico _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ico PNat.map_subtype_embedding_Ico
theorem map_subtype_embedding_Ioc : (Ioc a b).map (Embedding.subtype _) = Ioc ↑a ↑b :=
Finset.map_subtype_embedding_Ioc _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ioc PNat.map_subtype_embedding_Ioc
theorem map_subtype_embedding_Ioo : (Ioo a b).map (Embedding.subtype _) = Ioo ↑a ↑b :=
Finset.map_subtype_embedding_Ioo _ _ _ fun _c _ _x hx _ hc _ => hc.trans_le hx
#align pnat.map_subtype_embedding_Ioo PNat.map_subtype_embedding_Ioo
theorem map_subtype_embedding_uIcc : (uIcc a b).map (Embedding.subtype _) = uIcc ↑a ↑b :=
map_subtype_embedding_Icc _ _
#align pnat.map_subtype_embedding_uIcc PNat.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc]
-- Porting note: I had to change this to `erw` *and* provide the proof, yuck.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
rw [card_map]
#align pnat.card_Icc PNat.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico]
-- Porting note: I had to change this to `erw` *and* provide the proof, yuck.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
rw [card_map]
#align pnat.card_Ico PNat.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [← Nat.card_Ioc]
-- Porting note: I had to change this to `erw` *and* provide the proof, yuck.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
rw [card_map]
#align pnat.card_Ioc PNat.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo]
-- Porting note: I had to change this to `erw` *and* provide the proof, yuck.
-- https://github.com/leanprover-community/mathlib4/issues/5164
erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
rw [card_map]
#align pnat.card_Ioo PNat.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
#align pnat.card_uIcc PNat.card_uIcc
-- Porting note: `simpNF` says `simp` can prove this
theorem card_fintype_Icc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [← card_Icc, Fintype.card_ofFinset]
#align pnat.card_fintype_Icc PNat.card_fintype_Icc
-- Porting note: `simpNF` says `simp` can prove this
| Mathlib/Data/PNat/Interval.lean | 113 | 114 | theorem card_fintype_Ico : Fintype.card (Set.Ico a b) = b - a := by |
rw [← card_Ico, Fintype.card_ofFinset]
| 1 |
import Mathlib.AlgebraicGeometry.Spec
import Mathlib.Algebra.Category.Ring.Constructions
import Mathlib.CategoryTheory.Elementwise
#align_import algebraic_geometry.Scheme from "leanprover-community/mathlib"@"88474d1b5af6d37c2ab728b757771bced7f5194c"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
universe u
noncomputable section
open TopologicalSpace
open CategoryTheory
open TopCat
open Opposite
namespace AlgebraicGeometry
structure Scheme extends LocallyRingedSpace where
local_affine :
∀ x : toLocallyRingedSpace,
∃ (U : OpenNhds x) (R : CommRingCat),
Nonempty
(toLocallyRingedSpace.restrict U.openEmbedding ≅ Spec.toLocallyRingedSpace.obj (op R))
#align algebraic_geometry.Scheme AlgebraicGeometry.Scheme
namespace Scheme
-- @[nolint has_nonempty_instance] -- Porting note(#5171): linter not ported yet
def Hom (X Y : Scheme) : Type* :=
X.toLocallyRingedSpace ⟶ Y.toLocallyRingedSpace
#align algebraic_geometry.Scheme.hom AlgebraicGeometry.Scheme.Hom
instance : Category Scheme :=
{ InducedCategory.category Scheme.toLocallyRingedSpace with Hom := Hom }
-- porting note (#10688): added to ease automation
@[continuity]
lemma Hom.continuous {X Y : Scheme} (f : X ⟶ Y) : Continuous f.1.base := f.1.base.2
protected abbrev sheaf (X : Scheme) :=
X.toSheafedSpace.sheaf
#align algebraic_geometry.Scheme.sheaf AlgebraicGeometry.Scheme.sheaf
instance : CoeSort Scheme Type* where
coe X := X.carrier
@[simps!]
def forgetToLocallyRingedSpace : Scheme ⥤ LocallyRingedSpace :=
inducedFunctor _
-- deriving Full, Faithful -- Porting note: no delta derive handler, see https://github.com/leanprover-community/mathlib4/issues/5020
#align algebraic_geometry.Scheme.forget_to_LocallyRingedSpace AlgebraicGeometry.Scheme.forgetToLocallyRingedSpace
@[simps!]
def fullyFaithfulForgetToLocallyRingedSpace :
forgetToLocallyRingedSpace.FullyFaithful :=
fullyFaithfulInducedFunctor _
instance : forgetToLocallyRingedSpace.Full :=
InducedCategory.full _
instance : forgetToLocallyRingedSpace.Faithful :=
InducedCategory.faithful _
@[simps!]
def forgetToTop : Scheme ⥤ TopCat :=
Scheme.forgetToLocallyRingedSpace ⋙ LocallyRingedSpace.forgetToTop
#align algebraic_geometry.Scheme.forget_to_Top AlgebraicGeometry.Scheme.forgetToTop
-- Porting note: Lean seems not able to find this coercion any more
instance hasCoeToTopCat : CoeOut Scheme TopCat where
coe X := X.carrier
-- Porting note: added this unification hint just in case
unif_hint forgetToTop_obj_eq_coe (X : Scheme) where ⊢
forgetToTop.obj X ≟ (X : TopCat)
@[simp]
theorem id_val_base (X : Scheme) : (𝟙 X : _).1.base = 𝟙 _ :=
rfl
#align algebraic_geometry.Scheme.id_val_base AlgebraicGeometry.Scheme.id_val_base
@[simp]
theorem id_app {X : Scheme} (U : (Opens X.carrier)ᵒᵖ) :
(𝟙 X : _).val.c.app U =
X.presheaf.map (eqToHom (by induction' U with U; cases U; rfl)) :=
PresheafedSpace.id_c_app X.toPresheafedSpace U
#align algebraic_geometry.Scheme.id_app AlgebraicGeometry.Scheme.id_app
@[reassoc]
theorem comp_val {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).val = f.val ≫ g.val :=
rfl
#align algebraic_geometry.Scheme.comp_val AlgebraicGeometry.Scheme.comp_val
@[simp, reassoc] -- reassoc lemma does not need `simp`
theorem comp_coeBase {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g).val.base = f.val.base ≫ g.val.base :=
rfl
#align algebraic_geometry.Scheme.comp_coe_base AlgebraicGeometry.Scheme.comp_coeBase
-- Porting note: removed elementwise attribute, as generated lemmas were trivial.
@[reassoc]
theorem comp_val_base {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g).val.base = f.val.base ≫ g.val.base :=
rfl
#align algebraic_geometry.Scheme.comp_val_base AlgebraicGeometry.Scheme.comp_val_base
theorem comp_val_base_apply {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) (x : X) :
(f ≫ g).val.base x = g.val.base (f.val.base x) := by
simp
#align algebraic_geometry.Scheme.comp_val_base_apply AlgebraicGeometry.Scheme.comp_val_base_apply
@[simp, reassoc] -- reassoc lemma does not need `simp`
theorem comp_val_c_app {X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) (U) :
(f ≫ g).val.c.app U = g.val.c.app U ≫ f.val.c.app _ :=
rfl
#align algebraic_geometry.Scheme.comp_val_c_app AlgebraicGeometry.Scheme.comp_val_c_app
| Mathlib/AlgebraicGeometry/Scheme.lean | 155 | 157 | theorem congr_app {X Y : Scheme} {f g : X ⟶ Y} (e : f = g) (U) :
f.val.c.app U = g.val.c.app U ≫ X.presheaf.map (eqToHom (by subst e; rfl)) := by |
subst e; dsimp; simp
| 1 |
import Mathlib.Algebra.Homology.Single
#align_import algebra.homology.augment from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open CategoryTheory Limits HomologicalComplex
universe v u
variable {V : Type u} [Category.{v} V]
namespace ChainComplex
@[simps]
def truncate [HasZeroMorphisms V] : ChainComplex V ℕ ⥤ ChainComplex V ℕ where
obj C :=
{ X := fun i => C.X (i + 1)
d := fun i j => C.d (i + 1) (j + 1)
shape := fun i j w => C.shape _ _ <| by simpa }
map f := { f := fun i => f.f (i + 1) }
#align chain_complex.truncate ChainComplex.truncate
def truncateTo [HasZeroObject V] [HasZeroMorphisms V] (C : ChainComplex V ℕ) :
truncate.obj C ⟶ (single₀ V).obj (C.X 0) :=
(toSingle₀Equiv (truncate.obj C) (C.X 0)).symm ⟨C.d 1 0, by aesop⟩
#align chain_complex.truncate_to ChainComplex.truncateTo
-- PROJECT when `V` is abelian (but not generally?)
-- `[∀ n, Exact (C.d (n+2) (n+1)) (C.d (n+1) n)] [Epi (C.d 1 0)]` iff `QuasiIso (C.truncate_to)`
variable [HasZeroMorphisms V]
def augment (C : ChainComplex V ℕ) {X : V} (f : C.X 0 ⟶ X) (w : C.d 1 0 ≫ f = 0) :
ChainComplex V ℕ where
X | 0 => X
| i + 1 => C.X i
d | 1, 0 => f
| i + 1, j + 1 => C.d i j
| _, _ => 0
shape
| 1, 0, h => absurd rfl h
| i + 2, 0, _ => rfl
| 0, _, _ => rfl
| i + 1, j + 1, h => by
simp only; exact C.shape i j (Nat.succ_ne_succ.1 h)
d_comp_d'
| _, _, 0, rfl, rfl => w
| _, _, k + 1, rfl, rfl => C.d_comp_d _ _ _
#align chain_complex.augment ChainComplex.augment
@[simp]
theorem augment_X_zero (C : ChainComplex V ℕ) {X : V} (f : C.X 0 ⟶ X) (w : C.d 1 0 ≫ f = 0) :
(augment C f w).X 0 = X :=
rfl
set_option linter.uppercaseLean3 false in
#align chain_complex.augment_X_zero ChainComplex.augment_X_zero
@[simp]
theorem augment_X_succ (C : ChainComplex V ℕ) {X : V} (f : C.X 0 ⟶ X) (w : C.d 1 0 ≫ f = 0)
(i : ℕ) : (augment C f w).X (i + 1) = C.X i :=
rfl
set_option linter.uppercaseLean3 false in
#align chain_complex.augment_X_succ ChainComplex.augment_X_succ
@[simp]
theorem augment_d_one_zero (C : ChainComplex V ℕ) {X : V} (f : C.X 0 ⟶ X) (w : C.d 1 0 ≫ f = 0) :
(augment C f w).d 1 0 = f :=
rfl
#align chain_complex.augment_d_one_zero ChainComplex.augment_d_one_zero
@[simp]
| Mathlib/Algebra/Homology/Augment.lean | 92 | 94 | theorem augment_d_succ_succ (C : ChainComplex V ℕ) {X : V} (f : C.X 0 ⟶ X) (w : C.d 1 0 ≫ f = 0)
(i j : ℕ) : (augment C f w).d (i + 1) (j + 1) = C.d i j := by |
cases i <;> rfl
| 1 |
import Mathlib.Algebra.EuclideanDomain.Instances
import Mathlib.RingTheory.Ideal.Colon
import Mathlib.RingTheory.UniqueFactorizationDomain
#align_import ring_theory.principal_ideal_domain from "leanprover-community/mathlib"@"6010cf523816335f7bae7f8584cb2edaace73940"
universe u v
variable {R : Type u} {M : Type v}
open Set Function
open Submodule
section
variable [Ring R] [AddCommGroup M] [Module R M]
instance bot_isPrincipal : (⊥ : Submodule R M).IsPrincipal :=
⟨⟨0, by simp⟩⟩
#align bot_is_principal bot_isPrincipal
instance top_isPrincipal : (⊤ : Submodule R R).IsPrincipal :=
⟨⟨1, Ideal.span_singleton_one.symm⟩⟩
#align top_is_principal top_isPrincipal
variable (R)
class IsBezout : Prop where
isPrincipal_of_FG : ∀ I : Ideal R, I.FG → I.IsPrincipal
#align is_bezout IsBezout
instance (priority := 100) IsBezout.of_isPrincipalIdealRing [IsPrincipalIdealRing R] : IsBezout R :=
⟨fun I _ => IsPrincipalIdealRing.principal I⟩
#align is_bezout.of_is_principal_ideal_ring IsBezout.of_isPrincipalIdealRing
instance (priority := 100) DivisionRing.isPrincipalIdealRing (K : Type u) [DivisionRing K] :
IsPrincipalIdealRing K where
principal S := by
rcases Ideal.eq_bot_or_top S with (rfl | rfl)
· apply bot_isPrincipal
· apply top_isPrincipal
#align division_ring.is_principal_ideal_ring DivisionRing.isPrincipalIdealRing
end
namespace Submodule.IsPrincipal
variable [AddCommGroup M]
section Ring
variable [Ring R] [Module R M]
noncomputable def generator (S : Submodule R M) [S.IsPrincipal] : M :=
Classical.choose (principal S)
#align submodule.is_principal.generator Submodule.IsPrincipal.generator
theorem span_singleton_generator (S : Submodule R M) [S.IsPrincipal] : span R {generator S} = S :=
Eq.symm (Classical.choose_spec (principal S))
#align submodule.is_principal.span_singleton_generator Submodule.IsPrincipal.span_singleton_generator
@[simp]
theorem _root_.Ideal.span_singleton_generator (I : Ideal R) [I.IsPrincipal] :
Ideal.span ({generator I} : Set R) = I :=
Eq.symm (Classical.choose_spec (principal I))
#align ideal.span_singleton_generator Ideal.span_singleton_generator
@[simp]
theorem generator_mem (S : Submodule R M) [S.IsPrincipal] : generator S ∈ S := by
conv_rhs => rw [← span_singleton_generator S]
exact subset_span (mem_singleton _)
#align submodule.is_principal.generator_mem Submodule.IsPrincipal.generator_mem
| Mathlib/RingTheory/PrincipalIdealDomain.lean | 109 | 111 | theorem mem_iff_eq_smul_generator (S : Submodule R M) [S.IsPrincipal] {x : M} :
x ∈ S ↔ ∃ s : R, x = s • generator S := by |
simp_rw [@eq_comm _ x, ← mem_span_singleton, span_singleton_generator]
| 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
theorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = map₂ (fun a b => f b a) b a := by cases a <;> cases b <;> rfl
#align option.map₂_swap Option.map₂_swap
theorem map_map₂ (f : α → β → γ) (g : γ → δ) :
(map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by cases a <;> cases b <;> rfl
#align option.map_map₂ Option.map_map₂
theorem map₂_map_left (f : γ → β → δ) (g : α → γ) :
map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by cases a <;> rfl
#align option.map₂_map_left Option.map₂_map_left
theorem map₂_map_right (f : α → γ → δ) (g : β → γ) :
map₂ f a (b.map g) = map₂ (fun a b => f a (g b)) a b := by cases b <;> rfl
#align option.map₂_map_right Option.map₂_map_right
@[simp]
theorem map₂_curry (f : α × β → γ) (a : Option α) (b : Option β) :
map₂ (curry f) a b = Option.map f (map₂ Prod.mk a b) := (map_map₂ _ _).symm
#align option.map₂_curry Option.map₂_curry
@[simp]
| Mathlib/Data/Option/NAry.lean | 109 | 110 | theorem map_uncurry (f : α → β → γ) (x : Option (α × β)) :
x.map (uncurry f) = map₂ f (x.map Prod.fst) (x.map Prod.snd) := by | cases x <;> rfl
| 1 |
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
import Mathlib.RepresentationTheory.GroupCohomology.Basic
import Mathlib.RepresentationTheory.Invariants
universe v u
noncomputable section
open CategoryTheory Limits Representation
variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G)
namespace groupCohomology
section IsCocycle
section
variable {G A : Type*} [Mul G] [AddCommGroup A] [SMul G A]
def IsOneCocycle (f : G → A) : Prop := ∀ g h : G, f (g * h) = g • f h + f g
def IsTwoCocycle (f : G × G → A) : Prop :=
∀ g h j : G, f (g * h, j) + f (g, h) = g • (f (h, j)) + f (g, h * j)
end
section
variable {G A : Type*} [Monoid G] [AddCommGroup A] [MulAction G A]
| Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean | 401 | 403 | theorem map_one_of_isOneCocycle {f : G → A} (hf : IsOneCocycle f) :
f 1 = 0 := by |
simpa only [mul_one, one_smul, self_eq_add_right] using hf 1 1
| 1 |
import Mathlib.Algebra.PUnitInstances
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Ring
import Mathlib.Order.Hom.Lattice
#align_import algebra.ring.boolean_ring from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped symmDiff
variable {α β γ : Type*}
class BooleanRing (α) extends Ring α where
mul_self : ∀ a : α, a * a = a
#align boolean_ring BooleanRing
section BooleanRing
variable [BooleanRing α] (a b : α)
instance : Std.IdempotentOp (α := α) (· * ·) :=
⟨BooleanRing.mul_self⟩
@[simp]
theorem mul_self : a * a = a :=
BooleanRing.mul_self _
#align mul_self mul_self
@[simp]
theorem add_self : a + a = 0 := by
have : a + a = a + a + (a + a) :=
calc
a + a = (a + a) * (a + a) := by rw [mul_self]
_ = a * a + a * a + (a * a + a * a) := by rw [add_mul, mul_add]
_ = a + a + (a + a) := by rw [mul_self]
rwa [self_eq_add_left] at this
#align add_self add_self
@[simp]
theorem neg_eq : -a = a :=
calc
-a = -a + 0 := by rw [add_zero]
_ = -a + -a + a := by rw [← neg_add_self, add_assoc]
_ = a := by rw [add_self, zero_add]
#align neg_eq neg_eq
theorem add_eq_zero' : a + b = 0 ↔ a = b :=
calc
a + b = 0 ↔ a = -b := add_eq_zero_iff_eq_neg
_ ↔ a = b := by rw [neg_eq]
#align add_eq_zero' add_eq_zero'
@[simp]
theorem mul_add_mul : a * b + b * a = 0 := by
have : a + b = a + b + (a * b + b * a) :=
calc
a + b = (a + b) * (a + b) := by rw [mul_self]
_ = a * a + a * b + (b * a + b * b) := by rw [add_mul, mul_add, mul_add]
_ = a + a * b + (b * a + b) := by simp only [mul_self]
_ = a + b + (a * b + b * a) := by abel
rwa [self_eq_add_right] at this
#align mul_add_mul mul_add_mul
@[simp]
| Mathlib/Algebra/Ring/BooleanRing.lean | 101 | 101 | theorem sub_eq_add : a - b = a + b := by | rw [sub_eq_add_neg, add_right_inj, neg_eq]
| 1 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : ℕ)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 114 | 115 | theorem card_Ioc : (Ioc a b).card = b - a := by |
rw [← Nat.card_Ioc, ← map_valEmbedding_Ioc, card_map]
| 1 |
import Mathlib.CategoryTheory.EqToHom
#align_import category_theory.sums.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace CategoryTheory
universe v₁ u₁
-- morphism levels before object levels. See note [category_theory universes].
open Sum
section
variable (C : Type u₁) [Category.{v₁} C] (D : Type u₁) [Category.{v₁} D]
instance sum : Category.{v₁} (Sum C D) where
Hom X Y :=
match X, Y with
| inl X, inl Y => X ⟶ Y
| inl _, inr _ => PEmpty
| inr _, inl _ => PEmpty
| inr X, inr Y => X ⟶ Y
id X :=
match X with
| inl X => 𝟙 X
| inr X => 𝟙 X
comp {X Y Z} f g :=
match X, Y, Z, f, g with
| inl X, inl Y, inl Z, f, g => f ≫ g
| inr X, inr Y, inr Z, f, g => f ≫ g
assoc {W X Y Z} f g h :=
match X, Y, Z, W with
| inl X, inl Y, inl Z, inl W => Category.assoc f g h
| inr X, inr Y, inr Z, inr W => Category.assoc f g h
#align category_theory.sum CategoryTheory.sum
@[aesop norm -10 destruct (rule_sets := [CategoryTheory])]
| Mathlib/CategoryTheory/Sums/Basic.lean | 62 | 63 | theorem hom_inl_inr_false {X : C} {Y : D} (f : Sum.inl X ⟶ Sum.inr Y) : False := by |
cases f
| 1 |
import Mathlib.CategoryTheory.NatTrans
import Mathlib.CategoryTheory.Iso
#align_import category_theory.functor.category from "leanprover-community/mathlib"@"63721b2c3eba6c325ecf8ae8cca27155a4f6306f"
namespace CategoryTheory
-- declare the `v`'s first; see note [CategoryTheory universes].
universe v₁ v₂ v₃ u₁ u₂ u₃
open NatTrans Category CategoryTheory.Functor
variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D]
attribute [local simp] vcomp_app
variable {C D} {E : Type u₃} [Category.{v₃} E]
variable {F G H I : C ⥤ D}
instance Functor.category : Category.{max u₁ v₂} (C ⥤ D) where
Hom F G := NatTrans F G
id F := NatTrans.id F
comp α β := vcomp α β
#align category_theory.functor.category CategoryTheory.Functor.category
namespace NatTrans
-- Porting note: the behaviour of `ext` has changed here.
-- We need to provide a copy of the `NatTrans.ext` lemma,
-- written in terms of `F ⟶ G` rather than `NatTrans F G`,
-- or `ext` will not retrieve it from the cache.
@[ext]
theorem ext' {α β : F ⟶ G} (w : α.app = β.app) : α = β := NatTrans.ext _ _ w
@[simp]
theorem vcomp_eq_comp (α : F ⟶ G) (β : G ⟶ H) : vcomp α β = α ≫ β := rfl
#align category_theory.nat_trans.vcomp_eq_comp CategoryTheory.NatTrans.vcomp_eq_comp
theorem vcomp_app' (α : F ⟶ G) (β : G ⟶ H) (X : C) : (α ≫ β).app X = α.app X ≫ β.app X := rfl
#align category_theory.nat_trans.vcomp_app' CategoryTheory.NatTrans.vcomp_app'
theorem congr_app {α β : F ⟶ G} (h : α = β) (X : C) : α.app X = β.app X := by rw [h]
#align category_theory.nat_trans.congr_app CategoryTheory.NatTrans.congr_app
@[simp]
theorem id_app (F : C ⥤ D) (X : C) : (𝟙 F : F ⟶ F).app X = 𝟙 (F.obj X) := rfl
#align category_theory.nat_trans.id_app CategoryTheory.NatTrans.id_app
@[simp]
theorem comp_app {F G H : C ⥤ D} (α : F ⟶ G) (β : G ⟶ H) (X : C) :
(α ≫ β).app X = α.app X ≫ β.app X := rfl
#align category_theory.nat_trans.comp_app CategoryTheory.NatTrans.comp_app
attribute [reassoc] comp_app
@[reassoc]
theorem app_naturality {F G : C ⥤ D ⥤ E} (T : F ⟶ G) (X : C) {Y Z : D} (f : Y ⟶ Z) :
(F.obj X).map f ≫ (T.app X).app Z = (T.app X).app Y ≫ (G.obj X).map f :=
(T.app X).naturality f
#align category_theory.nat_trans.app_naturality CategoryTheory.NatTrans.app_naturality
@[reassoc]
theorem naturality_app {F G : C ⥤ D ⥤ E} (T : F ⟶ G) (Z : D) {X Y : C} (f : X ⟶ Y) :
(F.map f).app Z ≫ (T.app Y).app Z = (T.app X).app Z ≫ (G.map f).app Z :=
congr_fun (congr_arg app (T.naturality f)) Z
#align category_theory.nat_trans.naturality_app CategoryTheory.NatTrans.naturality_app
theorem mono_of_mono_app (α : F ⟶ G) [∀ X : C, Mono (α.app X)] : Mono α :=
⟨fun g h eq => by
ext X
rw [← cancel_mono (α.app X), ← comp_app, eq, comp_app]⟩
#align category_theory.nat_trans.mono_of_mono_app CategoryTheory.NatTrans.mono_of_mono_app
theorem epi_of_epi_app (α : F ⟶ G) [∀ X : C, Epi (α.app X)] : Epi α :=
⟨fun g h eq => by
ext X
rw [← cancel_epi (α.app X), ← comp_app, eq, comp_app]⟩
#align category_theory.nat_trans.epi_of_epi_app CategoryTheory.NatTrans.epi_of_epi_app
@[simps]
def hcomp {H I : D ⥤ E} (α : F ⟶ G) (β : H ⟶ I) : F ⋙ H ⟶ G ⋙ I where
app := fun X : C => β.app (F.obj X) ≫ I.map (α.app X)
naturality X Y f := by
rw [Functor.comp_map, Functor.comp_map, ← assoc, naturality, assoc, ← map_comp I, naturality,
map_comp, assoc]
#align category_theory.nat_trans.hcomp CategoryTheory.NatTrans.hcomp
#align category_theory.nat_trans.hcomp_app CategoryTheory.NatTrans.hcomp_app
infixl:80 " ◫ " => hcomp
theorem hcomp_id_app {H : D ⥤ E} (α : F ⟶ G) (X : C) : (α ◫ 𝟙 H).app X = H.map (α.app X) := by
simp
#align category_theory.nat_trans.hcomp_id_app CategoryTheory.NatTrans.hcomp_id_app
| Mathlib/CategoryTheory/Functor/Category.lean | 125 | 125 | theorem id_hcomp_app {H : E ⥤ C} (α : F ⟶ G) (X : E) : (𝟙 H ◫ α).app X = α.app _ := by | simp
| 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
| Mathlib/Data/Sum/Basic.lean | 54 | 55 | theorem eq_left_iff_getLeft_eq {a : α} : x = inl a ↔ ∃ h, x.getLeft h = a := by |
cases x <;> simp
| 1 |
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
#align_import category_theory.limits.preserves.shapes.images from "leanprover-community/mathlib"@"fc78e3c190c72a109699385da6be2725e88df841"
noncomputable section
namespace CategoryTheory
namespace PreservesImage
open CategoryTheory
open CategoryTheory.Limits
universe u₁ u₂ v₁ v₂
variable {A : Type u₁} {B : Type u₂} [Category.{v₁} A] [Category.{v₂} B]
variable [HasEqualizers A] [HasImages A]
variable [StrongEpiCategory B] [HasImages B]
variable (L : A ⥤ B)
variable [∀ {X Y Z : A} (f : X ⟶ Z) (g : Y ⟶ Z), PreservesLimit (cospan f g) L]
variable [∀ {X Y Z : A} (f : X ⟶ Y) (g : X ⟶ Z), PreservesColimit (span f g) L]
@[simps!]
def iso {X Y : A} (f : X ⟶ Y) : image (L.map f) ≅ L.obj (image f) :=
let aux1 : StrongEpiMonoFactorisation (L.map f) :=
{ I := L.obj (Limits.image f)
m := L.map <| Limits.image.ι _
m_mono := preserves_mono_of_preservesLimit _ _
e := L.map <| factorThruImage _
e_strong_epi := @strongEpi_of_epi B _ _ _ _ _ (preserves_epi_of_preservesColimit L _)
fac := by rw [← L.map_comp, Limits.image.fac] }
IsImage.isoExt (Image.isImage (L.map f)) aux1.toMonoIsImage
#align category_theory.preserves_image.iso CategoryTheory.PreservesImage.iso
@[reassoc]
theorem factorThruImage_comp_hom {X Y : A} (f : X ⟶ Y) :
factorThruImage (L.map f) ≫ (iso L f).hom = L.map (factorThruImage f) := by simp
#align category_theory.preserves_image.factor_thru_image_comp_hom CategoryTheory.PreservesImage.factorThruImage_comp_hom
@[reassoc]
theorem hom_comp_map_image_ι {X Y : A} (f : X ⟶ Y) :
(iso L f).hom ≫ L.map (image.ι f) = image.ι (L.map f) := by rw [iso_hom, image.lift_fac]
#align category_theory.preserves_image.hom_comp_map_image_ι CategoryTheory.PreservesImage.hom_comp_map_image_ι
@[reassoc]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Images.lean | 62 | 63 | theorem inv_comp_image_ι_map {X Y : A} (f : X ⟶ Y) :
(iso L f).inv ≫ image.ι (L.map f) = L.map (image.ι f) := by | simp
| 1 |
import Mathlib.Data.Part
import Mathlib.Data.Rel
#align_import data.pfun from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open Function
def PFun (α β : Type*) :=
α → Part β
#align pfun PFun
infixr:25 " →. " => PFun
namespace PFun
variable {α β γ δ ε ι : Type*}
instance inhabited : Inhabited (α →. β) :=
⟨fun _ => Part.none⟩
#align pfun.inhabited PFun.inhabited
def Dom (f : α →. β) : Set α :=
{ a | (f a).Dom }
#align pfun.dom PFun.Dom
@[simp]
theorem mem_dom (f : α →. β) (x : α) : x ∈ Dom f ↔ ∃ y, y ∈ f x := by simp [Dom, Part.dom_iff_mem]
#align pfun.mem_dom PFun.mem_dom
@[simp]
theorem dom_mk (p : α → Prop) (f : ∀ a, p a → β) : (PFun.Dom fun x => ⟨p x, f x⟩) = { x | p x } :=
rfl
#align pfun.dom_mk PFun.dom_mk
theorem dom_eq (f : α →. β) : Dom f = { x | ∃ y, y ∈ f x } :=
Set.ext (mem_dom f)
#align pfun.dom_eq PFun.dom_eq
def fn (f : α →. β) (a : α) : Dom f a → β :=
(f a).get
#align pfun.fn PFun.fn
@[simp]
theorem fn_apply (f : α →. β) (a : α) : f.fn a = (f a).get :=
rfl
#align pfun.fn_apply PFun.fn_apply
def evalOpt (f : α →. β) [D : DecidablePred (· ∈ Dom f)] (x : α) : Option β :=
@Part.toOption _ _ (D x)
#align pfun.eval_opt PFun.evalOpt
theorem ext' {f g : α →. β} (H1 : ∀ a, a ∈ Dom f ↔ a ∈ Dom g) (H2 : ∀ a p q, f.fn a p = g.fn a q) :
f = g :=
funext fun a => Part.ext' (H1 a) (H2 a)
#align pfun.ext' PFun.ext'
theorem ext {f g : α →. β} (H : ∀ a b, b ∈ f a ↔ b ∈ g a) : f = g :=
funext fun a => Part.ext (H a)
#align pfun.ext PFun.ext
def asSubtype (f : α →. β) (s : f.Dom) : β :=
f.fn s s.2
#align pfun.as_subtype PFun.asSubtype
def equivSubtype : (α →. β) ≃ Σp : α → Prop, Subtype p → β :=
⟨fun f => ⟨fun a => (f a).Dom, asSubtype f⟩, fun f x => ⟨f.1 x, fun h => f.2 ⟨x, h⟩⟩, fun f =>
funext fun a => Part.eta _, fun ⟨p, f⟩ => by dsimp; congr⟩
#align pfun.equiv_subtype PFun.equivSubtype
theorem asSubtype_eq_of_mem {f : α →. β} {x : α} {y : β} (fxy : y ∈ f x) (domx : x ∈ f.Dom) :
f.asSubtype ⟨x, domx⟩ = y :=
Part.mem_unique (Part.get_mem _) fxy
#align pfun.as_subtype_eq_of_mem PFun.asSubtype_eq_of_mem
@[coe]
protected def lift (f : α → β) : α →. β := fun a => Part.some (f a)
#align pfun.lift PFun.lift
instance coe : Coe (α → β) (α →. β) :=
⟨PFun.lift⟩
#align pfun.has_coe PFun.coe
@[simp]
theorem coe_val (f : α → β) (a : α) : (f : α →. β) a = Part.some (f a) :=
rfl
#align pfun.coe_val PFun.coe_val
@[simp]
theorem dom_coe (f : α → β) : (f : α →. β).Dom = Set.univ :=
rfl
#align pfun.dom_coe PFun.dom_coe
theorem lift_injective : Injective (PFun.lift : (α → β) → α →. β) := fun _ _ h =>
funext fun a => Part.some_injective <| congr_fun h a
#align pfun.coe_injective PFun.lift_injective
def graph (f : α →. β) : Set (α × β) :=
{ p | p.2 ∈ f p.1 }
#align pfun.graph PFun.graph
def graph' (f : α →. β) : Rel α β := fun x y => y ∈ f x
#align pfun.graph' PFun.graph'
def ran (f : α →. β) : Set β :=
{ b | ∃ a, b ∈ f a }
#align pfun.ran PFun.ran
def restrict (f : α →. β) {p : Set α} (H : p ⊆ f.Dom) : α →. β := fun x =>
(f x).restrict (x ∈ p) (@H x)
#align pfun.restrict PFun.restrict
@[simp]
theorem mem_restrict {f : α →. β} {s : Set α} (h : s ⊆ f.Dom) (a : α) (b : β) :
b ∈ f.restrict h a ↔ a ∈ s ∧ b ∈ f a := by simp [restrict]
#align pfun.mem_restrict PFun.mem_restrict
def res (f : α → β) (s : Set α) : α →. β :=
(PFun.lift f).restrict s.subset_univ
#align pfun.res PFun.res
| Mathlib/Data/PFun.lean | 189 | 190 | theorem mem_res (f : α → β) (s : Set α) (a : α) (b : β) : b ∈ res f s a ↔ a ∈ s ∧ f a = b := by |
simp [res, @eq_comm _ b]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
#align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section CompositionVector
open ContinuousLinearMap
variable {l : F → E} {l' : F →L[𝕜] E} {y : F}
variable (x)
theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt
#align has_fderiv_within_at.comp_has_deriv_within_at HasFDerivWithinAt.comp_hasDerivWithinAt
theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F}
(hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst
theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x))
(hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ∘ f) (l' f') s x :=
hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _)
#align has_fderiv_at.comp_has_deriv_within_at HasFDerivAt.comp_hasDerivWithinAt
theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y)
(hf : HasDerivWithinAt f f' s x) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf
theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ∘ f) (l' f') x :=
hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt
#align has_fderiv_at.comp_has_deriv_at HasFDerivAt.comp_hasDerivAt
theorem HasFDerivAt.comp_hasDerivAt_of_eq
(hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) :
HasDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasDerivAt x hf
theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x))
(hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ∘ f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt
#align has_strict_fderiv_at.comp_has_strict_deriv_at HasStrictFDerivAt.comp_hasStrictDerivAt
theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y)
(hf : HasStrictDerivAt f f' x) (hy : y = f x) :
HasStrictDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
theorem fderivWithin.comp_derivWithin {t : Set F} (hl : DifferentiableWithinAt 𝕜 l t (f x))
(hf : DifferentiableWithinAt 𝕜 f s x) (hs : MapsTo f s t) (hxs : UniqueDiffWithinAt 𝕜 s x) :
derivWithin (l ∘ f) s x = (fderivWithin 𝕜 l t (f x) : F → E) (derivWithin f s x) :=
(hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf.hasDerivWithinAt hs).derivWithin hxs
#align fderiv_within.comp_deriv_within fderivWithin.comp_derivWithin
theorem fderivWithin.comp_derivWithin_of_eq {t : Set F} (hl : DifferentiableWithinAt 𝕜 l t y)
(hf : DifferentiableWithinAt 𝕜 f s x) (hs : MapsTo f s t) (hxs : UniqueDiffWithinAt 𝕜 s x)
(hy : y = f x) :
derivWithin (l ∘ f) s x = (fderivWithin 𝕜 l t (f x) : F → E) (derivWithin f s x) := by
rw [hy] at hl; exact fderivWithin.comp_derivWithin x hl hf hs hxs
theorem fderiv.comp_deriv (hl : DifferentiableAt 𝕜 l (f x)) (hf : DifferentiableAt 𝕜 f x) :
deriv (l ∘ f) x = (fderiv 𝕜 l (f x) : F → E) (deriv f x) :=
(hl.hasFDerivAt.comp_hasDerivAt x hf.hasDerivAt).deriv
#align fderiv.comp_deriv fderiv.comp_deriv
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 415 | 418 | theorem fderiv.comp_deriv_of_eq (hl : DifferentiableAt 𝕜 l y) (hf : DifferentiableAt 𝕜 f x)
(hy : y = f x) :
deriv (l ∘ f) x = (fderiv 𝕜 l (f x) : F → E) (deriv f x) := by |
rw [hy] at hl; exact fderiv.comp_deriv x hl hf
| 1 |
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax
#align_import algebra.order.group.min_max from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
section
variable {α : Type*} [Group α] [LinearOrder α] [CovariantClass α α (· * ·) (· ≤ ·)]
-- TODO: This duplicates `oneLePart_div_leOnePart`
@[to_additive (attr := simp)]
theorem max_one_div_max_inv_one_eq_self (a : α) : max a 1 / max a⁻¹ 1 = a := by
rcases le_total a 1 with (h | h) <;> simp [h]
#align max_one_div_max_inv_one_eq_self max_one_div_max_inv_one_eq_self
#align max_zero_sub_max_neg_zero_eq_self max_zero_sub_max_neg_zero_eq_self
alias max_zero_sub_eq_self := max_zero_sub_max_neg_zero_eq_self
#align max_zero_sub_eq_self max_zero_sub_eq_self
@[to_additive]
lemma max_inv_one (a : α) : max a⁻¹ 1 = a⁻¹ * max a 1 := by
rw [eq_inv_mul_iff_mul_eq, ← eq_div_iff_mul_eq', max_one_div_max_inv_one_eq_self]
end
section LinearOrderedCommGroup
variable {α : Type*} [LinearOrderedCommGroup α] {a b c : α}
@[to_additive min_neg_neg]
theorem min_inv_inv' (a b : α) : min a⁻¹ b⁻¹ = (max a b)⁻¹ :=
Eq.symm <| (@Monotone.map_max α αᵒᵈ _ _ Inv.inv a b) fun _ _ =>
-- Porting note: Explicit `α` necessary to infer `CovariantClass` instance
(@inv_le_inv_iff α _ _ _).mpr
#align min_inv_inv' min_inv_inv'
#align min_neg_neg min_neg_neg
@[to_additive max_neg_neg]
theorem max_inv_inv' (a b : α) : max a⁻¹ b⁻¹ = (min a b)⁻¹ :=
Eq.symm <| (@Monotone.map_min α αᵒᵈ _ _ Inv.inv a b) fun _ _ =>
-- Porting note: Explicit `α` necessary to infer `CovariantClass` instance
(@inv_le_inv_iff α _ _ _).mpr
#align max_inv_inv' max_inv_inv'
#align max_neg_neg max_neg_neg
@[to_additive min_sub_sub_right]
theorem min_div_div_right' (a b c : α) : min (a / c) (b / c) = min a b / c := by
simpa only [div_eq_mul_inv] using min_mul_mul_right a b c⁻¹
#align min_div_div_right' min_div_div_right'
#align min_sub_sub_right min_sub_sub_right
@[to_additive max_sub_sub_right]
theorem max_div_div_right' (a b c : α) : max (a / c) (b / c) = max a b / c := by
simpa only [div_eq_mul_inv] using max_mul_mul_right a b c⁻¹
#align max_div_div_right' max_div_div_right'
#align max_sub_sub_right max_sub_sub_right
@[to_additive min_sub_sub_left]
| Mathlib/Algebra/Order/Group/MinMax.lean | 69 | 70 | theorem min_div_div_left' (a b c : α) : min (a / b) (a / c) = a / max b c := by |
simp only [div_eq_mul_inv, min_mul_mul_left, min_inv_inv']
| 1 |
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.RingTheory.Ideal.Quotient
#align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24"
open Submodule
open Polynomial
variable {R : Type*} [Ring R]
variable {A : Type*} [CommRing A]
variable {M : Type*} [AddCommGroup M] [Module R M] (U U₁ U₂ : Submodule R M)
variable {x x₁ x₂ y y₁ y₂ z z₁ z₂ : M}
variable {N : Type*} [AddCommGroup N] [Module R N] (V V₁ V₂ : Submodule R N)
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
def SModEq (x y : M) : Prop :=
(Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y
#align smodeq SModEq
notation:50 x " ≡ " y " [SMOD " N "]" => SModEq N x y
variable {U U₁ U₂}
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
protected theorem SModEq.def :
x ≡ y [SMOD U] ↔ (Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y :=
Iff.rfl
#align smodeq.def SModEq.def
namespace SModEq
theorem sub_mem : x ≡ y [SMOD U] ↔ x - y ∈ U := by rw [SModEq.def, Submodule.Quotient.eq]
#align smodeq.sub_mem SModEq.sub_mem
@[simp]
theorem top : x ≡ y [SMOD (⊤ : Submodule R M)] :=
(Submodule.Quotient.eq ⊤).2 mem_top
#align smodeq.top SModEq.top
@[simp]
| Mathlib/LinearAlgebra/SModEq.lean | 53 | 54 | theorem bot : x ≡ y [SMOD (⊥ : Submodule R M)] ↔ x = y := by |
rw [SModEq.def, Submodule.Quotient.eq, mem_bot, sub_eq_zero]
| 1 |
import Mathlib.Topology.Constructions
#align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
open Set Filter Function Topology Filter
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
variable [TopologicalSpace α]
@[simp]
theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a :=
bind_inf_principal.trans <| congr_arg₂ _ nhds_bind_nhds rfl
#align nhds_bind_nhds_within nhds_bind_nhdsWithin
@[simp]
theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x :=
Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x }
#align eventually_nhds_nhds_within eventually_nhds_nhdsWithin
theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x :=
eventually_inf_principal
#align eventually_nhds_within_iff eventually_nhdsWithin_iff
theorem frequently_nhdsWithin_iff {z : α} {s : Set α} {p : α → Prop} :
(∃ᶠ x in 𝓝[s] z, p x) ↔ ∃ᶠ x in 𝓝 z, p x ∧ x ∈ s :=
frequently_inf_principal.trans <| by simp only [and_comm]
#align frequently_nhds_within_iff frequently_nhdsWithin_iff
| Mathlib/Topology/ContinuousOn.lean | 57 | 59 | theorem mem_closure_ne_iff_frequently_within {z : α} {s : Set α} :
z ∈ closure (s \ {z}) ↔ ∃ᶠ x in 𝓝[≠] z, x ∈ s := by |
simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff]
| 1 |
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Topology.Instances.ENNReal
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Filter
open scoped Topology NNReal
variable {α β F : Type*} [NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
theorem tendstoUniformlyOn_tsum {f : α → β → F} (hu : Summable u) {s : Set β}
(hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) :
TendstoUniformlyOn (fun t : Finset α => fun x => ∑ n ∈ t, f n x) (fun x => ∑' n, f n x) atTop
s := by
refine tendstoUniformlyOn_iff.2 fun ε εpos => ?_
filter_upwards [(tendsto_order.1 (tendsto_tsum_compl_atTop_zero u)).2 _ εpos] with t ht x hx
have A : Summable fun n => ‖f n x‖ :=
.of_nonneg_of_le (fun _ ↦ norm_nonneg _) (fun n => hfu n x hx) hu
rw [dist_eq_norm, ← sum_add_tsum_subtype_compl A.of_norm t, add_sub_cancel_left]
apply lt_of_le_of_lt _ ht
apply (norm_tsum_le_tsum_norm (A.subtype _)).trans
exact tsum_le_tsum (fun n => hfu _ _ hx) (A.subtype _) (hu.subtype _)
#align tendsto_uniformly_on_tsum tendstoUniformlyOn_tsum
theorem tendstoUniformlyOn_tsum_nat {f : ℕ → β → F} {u : ℕ → ℝ} (hu : Summable u) {s : Set β}
(hfu : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n) :
TendstoUniformlyOn (fun N => fun x => ∑ n ∈ Finset.range N, f n x) (fun x => ∑' n, f n x) atTop
s :=
fun v hv => tendsto_finset_range.eventually (tendstoUniformlyOn_tsum hu hfu v hv)
#align tendsto_uniformly_on_tsum_nat tendstoUniformlyOn_tsum_nat
| Mathlib/Analysis/NormedSpace/FunctionSeries.lean | 53 | 56 | theorem tendstoUniformly_tsum {f : α → β → F} (hu : Summable u) (hfu : ∀ n x, ‖f n x‖ ≤ u n) :
TendstoUniformly (fun t : Finset α => fun x => ∑ n ∈ t, f n x)
(fun x => ∑' n, f n x) atTop := by |
rw [← tendstoUniformlyOn_univ]; exact tendstoUniformlyOn_tsum hu fun n x _ => hfu n x
| 1 |
import Mathlib.LinearAlgebra.Quotient
import Mathlib.RingTheory.Congruence
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.Tactic.FinCases
#align_import ring_theory.ideal.quotient from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69"
universe u v w
namespace Ideal
open Set
variable {R : Type u} [CommRing R] (I : Ideal R) {a b : R}
variable {S : Type v}
-- Note that at present `Ideal` means a left-ideal,
-- so this quotient is only useful in a commutative ring.
-- We should develop quotients by two-sided ideals as well.
@[instance] abbrev instHasQuotient : HasQuotient R (Ideal R) :=
Submodule.hasQuotient
namespace Quotient
variable {I} {x y : R}
instance one (I : Ideal R) : One (R ⧸ I) :=
⟨Submodule.Quotient.mk 1⟩
#align ideal.quotient.has_one Ideal.Quotient.one
protected def ringCon (I : Ideal R) : RingCon R :=
{ QuotientAddGroup.con I.toAddSubgroup with
mul' := fun {a₁ b₁ a₂ b₂} h₁ h₂ => by
rw [Submodule.quotientRel_r_def] at h₁ h₂ ⊢
have F := I.add_mem (I.mul_mem_left a₂ h₁) (I.mul_mem_right b₁ h₂)
have : a₁ * a₂ - b₁ * b₂ = a₂ * (a₁ - b₁) + (a₂ - b₂) * b₁ := by
rw [mul_sub, sub_mul, sub_add_sub_cancel, mul_comm, mul_comm b₁]
rwa [← this] at F }
#align ideal.quotient.ring_con Ideal.Quotient.ringCon
instance commRing (I : Ideal R) : CommRing (R ⧸ I) :=
inferInstanceAs (CommRing (Quotient.ringCon I).Quotient)
#align ideal.quotient.comm_ring Ideal.Quotient.commRing
-- Sanity test to make sure no diamonds have emerged in `commRing`
example : (commRing I).toAddCommGroup = Submodule.Quotient.addCommGroup I := rfl
-- this instance is harder to find than the one via `Algebra α (R ⧸ I)`, so use a lower priority
instance (priority := 100) isScalarTower_right {α} [SMul α R] [IsScalarTower α R R] :
IsScalarTower α (R ⧸ I) (R ⧸ I) :=
(Quotient.ringCon I).isScalarTower_right
#align ideal.quotient.is_scalar_tower_right Ideal.Quotient.isScalarTower_right
instance smulCommClass {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass α R R] :
SMulCommClass α (R ⧸ I) (R ⧸ I) :=
(Quotient.ringCon I).smulCommClass
#align ideal.quotient.smul_comm_class Ideal.Quotient.smulCommClass
instance smulCommClass' {α} [SMul α R] [IsScalarTower α R R] [SMulCommClass R α R] :
SMulCommClass (R ⧸ I) α (R ⧸ I) :=
(Quotient.ringCon I).smulCommClass'
#align ideal.quotient.smul_comm_class' Ideal.Quotient.smulCommClass'
def mk (I : Ideal R) : R →+* R ⧸ I where
toFun a := Submodule.Quotient.mk a
map_zero' := rfl
map_one' := rfl
map_mul' _ _ := rfl
map_add' _ _ := rfl
#align ideal.quotient.mk Ideal.Quotient.mk
instance {I : Ideal R} : Coe R (R ⧸ I) :=
⟨Ideal.Quotient.mk I⟩
@[ext 1100]
theorem ringHom_ext [NonAssocSemiring S] ⦃f g : R ⧸ I →+* S⦄ (h : f.comp (mk I) = g.comp (mk I)) :
f = g :=
RingHom.ext fun x => Quotient.inductionOn' x <| (RingHom.congr_fun h : _)
#align ideal.quotient.ring_hom_ext Ideal.Quotient.ringHom_ext
instance inhabited : Inhabited (R ⧸ I) :=
⟨mk I 37⟩
#align ideal.quotient.inhabited Ideal.Quotient.inhabited
protected theorem eq : mk I x = mk I y ↔ x - y ∈ I :=
Submodule.Quotient.eq I
#align ideal.quotient.eq Ideal.Quotient.eq
@[simp]
theorem mk_eq_mk (x : R) : (Submodule.Quotient.mk x : R ⧸ I) = mk I x := rfl
#align ideal.quotient.mk_eq_mk Ideal.Quotient.mk_eq_mk
theorem eq_zero_iff_mem {I : Ideal R} : mk I a = 0 ↔ a ∈ I :=
Submodule.Quotient.mk_eq_zero _
#align ideal.quotient.eq_zero_iff_mem Ideal.Quotient.eq_zero_iff_mem
theorem eq_zero_iff_dvd (x y : R) : Ideal.Quotient.mk (Ideal.span ({x} : Set R)) y = 0 ↔ x ∣ y := by
rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.mem_span_singleton]
@[simp]
lemma mk_singleton_self (x : R) : mk (Ideal.span {x}) x = 0 := by
rw [eq_zero_iff_dvd]
-- Porting note (#10756): new theorem
| Mathlib/RingTheory/Ideal/Quotient.lean | 137 | 138 | theorem mk_eq_mk_iff_sub_mem (x y : R) : mk I x = mk I y ↔ x - y ∈ I := by |
rw [← eq_zero_iff_mem, map_sub, sub_eq_zero]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
#align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section Composition
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F]
[IsScalarTower 𝕜 𝕜' F] {s' t' : Set 𝕜'} {h : 𝕜 → 𝕜'} {h₁ : 𝕜 → 𝕜} {h₂ : 𝕜' → 𝕜'} {h' h₂' : 𝕜'}
{h₁' : 𝕜} {g₁ : 𝕜' → F} {g₁' : F} {L' : Filter 𝕜'} {y : 𝕜'} (x)
theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter g₁ g₁' (h x) L')
(hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') :
HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by
simpa using ((hg.restrictScalars 𝕜).comp x hh hL).hasDerivAtFilter
#align has_deriv_at_filter.scomp HasDerivAtFilter.scomp
theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter g₁ g₁' y L')
(hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') :
HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by
rw [hy] at hg; exact hg.scomp x hh hL
theorem HasDerivWithinAt.scomp_hasDerivAt (hg : HasDerivWithinAt g₁ g₁' s' (h x))
(hh : HasDerivAt h h' x) (hs : ∀ x, h x ∈ s') : HasDerivAt (g₁ ∘ h) (h' • g₁') x :=
hg.scomp x hh <| tendsto_inf.2 ⟨hh.continuousAt, tendsto_principal.2 <| eventually_of_forall hs⟩
#align has_deriv_within_at.scomp_has_deriv_at HasDerivWithinAt.scomp_hasDerivAt
theorem HasDerivWithinAt.scomp_hasDerivAt_of_eq (hg : HasDerivWithinAt g₁ g₁' s' y)
(hh : HasDerivAt h h' x) (hs : ∀ x, h x ∈ s') (hy : y = h x) :
HasDerivAt (g₁ ∘ h) (h' • g₁') x := by
rw [hy] at hg; exact hg.scomp_hasDerivAt x hh hs
nonrec theorem HasDerivWithinAt.scomp (hg : HasDerivWithinAt g₁ g₁' t' (h x))
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') :
HasDerivWithinAt (g₁ ∘ h) (h' • g₁') s x :=
hg.scomp x hh <| hh.continuousWithinAt.tendsto_nhdsWithin hst
#align has_deriv_within_at.scomp HasDerivWithinAt.scomp
theorem HasDerivWithinAt.scomp_of_eq (hg : HasDerivWithinAt g₁ g₁' t' y)
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') (hy : y = h x) :
HasDerivWithinAt (g₁ ∘ h) (h' • g₁') s x := by
rw [hy] at hg; exact hg.scomp x hh hst
nonrec theorem HasDerivAt.scomp (hg : HasDerivAt g₁ g₁' (h x)) (hh : HasDerivAt h h' x) :
HasDerivAt (g₁ ∘ h) (h' • g₁') x :=
hg.scomp x hh hh.continuousAt
#align has_deriv_at.scomp HasDerivAt.scomp
theorem HasDerivAt.scomp_of_eq
(hg : HasDerivAt g₁ g₁' y) (hh : HasDerivAt h h' x) (hy : y = h x) :
HasDerivAt (g₁ ∘ h) (h' • g₁') x := by
rw [hy] at hg; exact hg.scomp x hh
theorem HasStrictDerivAt.scomp (hg : HasStrictDerivAt g₁ g₁' (h x)) (hh : HasStrictDerivAt h h' x) :
HasStrictDerivAt (g₁ ∘ h) (h' • g₁') x := by
simpa using ((hg.restrictScalars 𝕜).comp x hh).hasStrictDerivAt
#align has_strict_deriv_at.scomp HasStrictDerivAt.scomp
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 123 | 126 | theorem HasStrictDerivAt.scomp_of_eq
(hg : HasStrictDerivAt g₁ g₁' y) (hh : HasStrictDerivAt h h' x) (hy : y = h x) :
HasStrictDerivAt (g₁ ∘ h) (h' • g₁') x := by |
rw [hy] at hg; exact hg.scomp x hh
| 1 |
import Mathlib.Data.Set.Prod
#align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654"
open Function
namespace Set
variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*} {f f' : α → β → γ} {g g' : α → β → γ → δ}
variable {s s' : Set α} {t t' : Set β} {u u' : Set γ} {v : Set δ} {a a' : α} {b b' : β} {c c' : γ}
{d d' : δ}
theorem mem_image2_iff (hf : Injective2 f) : f a b ∈ image2 f s t ↔ a ∈ s ∧ b ∈ t :=
⟨by
rintro ⟨a', ha', b', hb', h⟩
rcases hf h with ⟨rfl, rfl⟩
exact ⟨ha', hb'⟩, fun ⟨ha, hb⟩ => mem_image2_of_mem ha hb⟩
#align set.mem_image2_iff Set.mem_image2_iff
theorem image2_subset (hs : s ⊆ s') (ht : t ⊆ t') : image2 f s t ⊆ image2 f s' t' := by
rintro _ ⟨a, ha, b, hb, rfl⟩
exact mem_image2_of_mem (hs ha) (ht hb)
#align set.image2_subset Set.image2_subset
theorem image2_subset_left (ht : t ⊆ t') : image2 f s t ⊆ image2 f s t' :=
image2_subset Subset.rfl ht
#align set.image2_subset_left Set.image2_subset_left
theorem image2_subset_right (hs : s ⊆ s') : image2 f s t ⊆ image2 f s' t :=
image2_subset hs Subset.rfl
#align set.image2_subset_right Set.image2_subset_right
theorem image_subset_image2_left (hb : b ∈ t) : (fun a => f a b) '' s ⊆ image2 f s t :=
forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb
#align set.image_subset_image2_left Set.image_subset_image2_left
theorem image_subset_image2_right (ha : a ∈ s) : f a '' t ⊆ image2 f s t :=
forall_mem_image.2 fun _ => mem_image2_of_mem ha
#align set.image_subset_image2_right Set.image_subset_image2_right
theorem forall_image2_iff {p : γ → Prop} :
(∀ z ∈ image2 f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) :=
⟨fun h x hx y hy => h _ ⟨x, hx, y, hy, rfl⟩, fun h _ ⟨x, hx, y, hy, hz⟩ => hz ▸ h x hx y hy⟩
#align set.forall_image2_iff Set.forall_image2_iff
@[simp]
theorem image2_subset_iff {u : Set γ} : image2 f s t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, f x y ∈ u :=
forall_image2_iff
#align set.image2_subset_iff Set.image2_subset_iff
theorem image2_subset_iff_left : image2 f s t ⊆ u ↔ ∀ a ∈ s, (fun b => f a b) '' t ⊆ u := by
simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage]
#align set.image2_subset_iff_left Set.image2_subset_iff_left
| Mathlib/Data/Set/NAry.lean | 72 | 73 | theorem image2_subset_iff_right : image2 f s t ⊆ u ↔ ∀ b ∈ t, (fun a => f a b) '' s ⊆ u := by |
simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage, @forall₂_swap α]
| 1 |
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.Topology.Algebra.Field
import Mathlib.Topology.Algebra.Order.Group
#align_import topology.algebra.order.field from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Set Filter TopologicalSpace Function
open scoped Pointwise Topology
open OrderDual (toDual ofDual)
theorem TopologicalRing.of_norm {R 𝕜 : Type*} [NonUnitalNonAssocRing R] [LinearOrderedField 𝕜]
[TopologicalSpace R] [TopologicalAddGroup R] (norm : R → 𝕜)
(norm_nonneg : ∀ x, 0 ≤ norm x) (norm_mul_le : ∀ x y, norm (x * y) ≤ norm x * norm y)
(nhds_basis : (𝓝 (0 : R)).HasBasis ((0 : 𝕜) < ·) (fun ε ↦ { x | norm x < ε })) :
TopologicalRing R := by
have h0 : ∀ f : R → R, ∀ c ≥ (0 : 𝕜), (∀ x, norm (f x) ≤ c * norm x) →
Tendsto f (𝓝 0) (𝓝 0) := by
refine fun f c c0 hf ↦ (nhds_basis.tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_
rcases exists_pos_mul_lt ε0 c with ⟨δ, δ0, hδ⟩
refine ⟨δ, δ0, fun x hx ↦ (hf _).trans_lt ?_⟩
exact (mul_le_mul_of_nonneg_left (le_of_lt hx) c0).trans_lt hδ
apply TopologicalRing.of_addGroup_of_nhds_zero
case hmul =>
refine ((nhds_basis.prod nhds_basis).tendsto_iff nhds_basis).2 fun ε ε0 ↦ ?_
refine ⟨(1, ε), ⟨one_pos, ε0⟩, fun (x, y) ⟨hx, hy⟩ => ?_⟩
simp only [sub_zero] at *
calc norm (x * y) ≤ norm x * norm y := norm_mul_le _ _
_ < ε := mul_lt_of_le_one_of_lt_of_nonneg hx.le hy (norm_nonneg _)
case hmul_left => exact fun x => h0 _ (norm x) (norm_nonneg _) (norm_mul_le x)
case hmul_right =>
exact fun y => h0 (· * y) (norm y) (norm_nonneg y) fun x =>
(norm_mul_le x y).trans_eq (mul_comm _ _)
variable {𝕜 α : Type*} [LinearOrderedField 𝕜] [TopologicalSpace 𝕜] [OrderTopology 𝕜]
{l : Filter α} {f g : α → 𝕜}
-- see Note [lower instance priority]
instance (priority := 100) LinearOrderedField.topologicalRing : TopologicalRing 𝕜 :=
.of_norm abs abs_nonneg (fun _ _ ↦ (abs_mul _ _).le) <| by
simpa using nhds_basis_abs_sub_lt (0 : 𝕜)
theorem Filter.Tendsto.atTop_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atTop)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by
refine tendsto_atTop_mono' _ ?_ (hf.atTop_mul_const (half_pos hC))
filter_upwards [hg.eventually (lt_mem_nhds (half_lt_self hC)), hf.eventually_ge_atTop 0]
with x hg hf using mul_le_mul_of_nonneg_left hg.le hf
#align filter.tendsto.at_top_mul Filter.Tendsto.atTop_mul
theorem Filter.Tendsto.mul_atTop {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atTop := by
simpa only [mul_comm] using hg.atTop_mul hC hf
#align filter.tendsto.mul_at_top Filter.Tendsto.mul_atTop
theorem Filter.Tendsto.atTop_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atTop)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by
have := hf.atTop_mul (neg_pos.2 hC) hg.neg
simpa only [(· ∘ ·), neg_mul_eq_mul_neg, neg_neg] using tendsto_neg_atTop_atBot.comp this
#align filter.tendsto.at_top_mul_neg Filter.Tendsto.atTop_mul_neg
theorem Filter.Tendsto.neg_mul_atTop {C : 𝕜} (hC : C < 0) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atTop) : Tendsto (fun x => f x * g x) l atBot := by
simpa only [mul_comm] using hg.atTop_mul_neg hC hf
#align filter.tendsto.neg_mul_at_top Filter.Tendsto.neg_mul_atTop
theorem Filter.Tendsto.atBot_mul {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l atBot)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atBot := by
have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul hC hg
simpa [(· ∘ ·)] using tendsto_neg_atTop_atBot.comp this
#align filter.tendsto.at_bot_mul Filter.Tendsto.atBot_mul
theorem Filter.Tendsto.atBot_mul_neg {C : 𝕜} (hC : C < 0) (hf : Tendsto f l atBot)
(hg : Tendsto g l (𝓝 C)) : Tendsto (fun x => f x * g x) l atTop := by
have := (tendsto_neg_atBot_atTop.comp hf).atTop_mul_neg hC hg
simpa [(· ∘ ·)] using tendsto_neg_atBot_atTop.comp this
#align filter.tendsto.at_bot_mul_neg Filter.Tendsto.atBot_mul_neg
| Mathlib/Topology/Algebra/Order/Field.lean | 110 | 112 | theorem Filter.Tendsto.mul_atBot {C : 𝕜} (hC : 0 < C) (hf : Tendsto f l (𝓝 C))
(hg : Tendsto g l atBot) : Tendsto (fun x => f x * g x) l atBot := by |
simpa only [mul_comm] using hg.atBot_mul hC hf
| 1 |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Normed.Field.InfiniteSum
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5"
namespace NormedSpace
open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics
open scoped Nat Topology ENNReal
section TopologicalAlgebra
variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸]
def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n =>
(n !⁻¹ : 𝕂) • ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸
#align exp_series NormedSpace.expSeries
variable {𝔸}
noncomputable def exp (x : 𝔸) : 𝔸 :=
(expSeries 𝕂 𝔸).sum x
#align exp NormedSpace.exp
variable {𝕂}
| Mathlib/Analysis/NormedSpace/Exponential.lean | 119 | 120 | theorem expSeries_apply_eq (x : 𝔸) (n : ℕ) :
(expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) • x ^ n := by | simp [expSeries]
| 1 |
import Mathlib.MeasureTheory.Constructions.Prod.Integral
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.torus_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
variable {n : ℕ}
variable {E : Type*} [NormedAddCommGroup E]
noncomputable section
open Complex Set MeasureTheory Function Filter TopologicalSpace
open scoped Real
-- Porting note: notation copied from `./DivergenceTheorem`
local macro:arg t:term:max noWs "ⁿ⁺¹" : term => `(Fin (n + 1) → $t)
local macro:arg t:term:max noWs "ⁿ" : term => `(Fin n → $t)
local macro:arg t:term:max noWs "⁰" : term => `(Fin 0 → $t)
local macro:arg t:term:max noWs "¹" : term => `(Fin 1 → $t)
def torusMap (c : ℂⁿ) (R : ℝⁿ) : ℝⁿ → ℂⁿ := fun θ i => c i + R i * exp (θ i * I)
#align torus_map torusMap
theorem torusMap_sub_center (c : ℂⁿ) (R : ℝⁿ) (θ : ℝⁿ) : torusMap c R θ - c = torusMap 0 R θ := by
ext1 i; simp [torusMap]
#align torus_map_sub_center torusMap_sub_center
theorem torusMap_eq_center_iff {c : ℂⁿ} {R : ℝⁿ} {θ : ℝⁿ} : torusMap c R θ = c ↔ R = 0 := by
simp [funext_iff, torusMap, exp_ne_zero]
#align torus_map_eq_center_iff torusMap_eq_center_iff
@[simp]
theorem torusMap_zero_radius (c : ℂⁿ) : torusMap c 0 = const ℝⁿ c :=
funext fun _ ↦ torusMap_eq_center_iff.2 rfl
#align torus_map_zero_radius torusMap_zero_radius
def TorusIntegrable (f : ℂⁿ → E) (c : ℂⁿ) (R : ℝⁿ) : Prop :=
IntegrableOn (fun θ : ℝⁿ => f (torusMap c R θ)) (Icc (0 : ℝⁿ) fun _ => 2 * π) volume
#align torus_integrable TorusIntegrable
namespace TorusIntegrable
-- Porting note (#11215): TODO: restore notation; `neg`, `add` etc fail if I use notation here
variable {f g : (Fin n → ℂ) → E} {c : Fin n → ℂ} {R : Fin n → ℝ}
| Mathlib/MeasureTheory/Integral/TorusIntegral.lean | 113 | 114 | theorem torusIntegrable_const (a : E) (c : ℂⁿ) (R : ℝⁿ) : TorusIntegrable (fun _ => a) c R := by |
simp [TorusIntegrable, measure_Icc_lt_top]
| 1 |
import Mathlib.Geometry.RingedSpace.PresheafedSpace
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.Topology.Sheaves.Stalks
#align_import algebraic_geometry.stalks from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
noncomputable section
universe v u v' u'
open Opposite CategoryTheory CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits
AlgebraicGeometry TopologicalSpace
variable {C : Type u} [Category.{v} C] [HasColimits C]
-- Porting note: no tidy tactic
-- attribute [local tidy] tactic.auto_cases_opens
-- this could be replaced by
-- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens
-- but it doesn't appear to be needed here.
open TopCat.Presheaf
namespace AlgebraicGeometry.PresheafedSpace
abbrev stalk (X : PresheafedSpace C) (x : X) : C :=
X.presheaf.stalk x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk AlgebraicGeometry.PresheafedSpace.stalk
def stalkMap {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (x : X) :
Y.stalk (α.base x) ⟶ X.stalk x :=
(stalkFunctor C (α.base x)).map α.c ≫ X.presheaf.stalkPushforward C α.base x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map AlgebraicGeometry.PresheafedSpace.stalkMap
@[elementwise, reassoc]
theorem stalkMap_germ {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (U : Opens Y)
(x : (Opens.map α.base).obj U) :
Y.presheaf.germ ⟨α.base x.1, x.2⟩ ≫ stalkMap α ↑x = α.c.app (op U) ≫ X.presheaf.germ x := by
rw [stalkMap, stalkFunctor_map_germ_assoc, stalkPushforward_germ]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map_germ AlgebraicGeometry.PresheafedSpace.stalkMap_germ
@[simp, elementwise, reassoc]
theorem stalkMap_germ' {X Y : PresheafedSpace.{_, _, v} C}
(α : X ⟶ Y) (U : Opens Y) (x : X) (hx : α.base x ∈ U) :
Y.presheaf.germ ⟨α.base x, hx⟩ ≫ stalkMap α x = α.c.app (op U) ≫
X.presheaf.germ (U := (Opens.map α.base).obj U) ⟨x, hx⟩ :=
PresheafedSpace.stalkMap_germ α U ⟨x, hx⟩
section Restrict
def restrictStalkIso {U : TopCat} (X : PresheafedSpace.{_, _, v} C) {f : U ⟶ (X : TopCat.{v})}
(h : OpenEmbedding f) (x : U) : (X.restrict h).stalk x ≅ X.stalk (f x) :=
haveI := initial_of_adjunction (h.isOpenMap.adjunctionNhds x)
Final.colimitIso (h.isOpenMap.functorNhds x).op ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf)
-- As a left adjoint, the functor `h.is_open_map.functor_nhds x` is initial.
-- Typeclass resolution knows that the opposite of an initial functor is final. The result
-- follows from the general fact that postcomposing with a final functor doesn't change colimits.
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso AlgebraicGeometry.PresheafedSpace.restrictStalkIso
-- Porting note (#11119): removed `simp` attribute, for left hand side is not in simple normal form.
@[elementwise, reassoc]
theorem restrictStalkIso_hom_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
(X.restrict h).presheaf.germ ⟨x, hx⟩ ≫ (restrictStalkIso X h x).hom =
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ :=
colimit.ι_pre ((OpenNhds.inclusion (f x)).op ⋙ X.presheaf) (h.isOpenMap.functorNhds x).op
(op ⟨V, hx⟩)
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.restrict_stalk_iso_hom_eq_germ AlgebraicGeometry.PresheafedSpace.restrictStalkIso_hom_eq_germ
-- We intentionally leave `simp` off the lemmas generated by `elementwise` and `reassoc`,
-- as the simpNF linter claims they never apply.
@[simp, elementwise, reassoc]
| Mathlib/Geometry/RingedSpace/Stalks.lean | 99 | 104 | theorem restrictStalkIso_inv_eq_germ {U : TopCat} (X : PresheafedSpace.{_, _, v} C)
{f : U ⟶ (X : TopCat.{v})} (h : OpenEmbedding f) (V : Opens U) (x : U) (hx : x ∈ V) :
X.presheaf.germ ⟨f x, show f x ∈ h.isOpenMap.functor.obj V from ⟨x, hx, rfl⟩⟩ ≫
(restrictStalkIso X h x).inv =
(X.restrict h).presheaf.germ ⟨x, hx⟩ := by |
rw [← restrictStalkIso_hom_eq_germ, Category.assoc, Iso.hom_inv_id, Category.comp_id]
| 1 |
import Batteries.Data.UnionFind.Basic
namespace Batteries.UnionFind
@[simp] theorem arr_empty : empty.arr = #[] := rfl
@[simp] theorem parent_empty : empty.parent a = a := rfl
@[simp] theorem rank_empty : empty.rank a = 0 := rfl
@[simp] theorem rootD_empty : empty.rootD a = a := rfl
@[simp] theorem arr_push {m : UnionFind} : m.push.arr = m.arr.push ⟨m.arr.size, 0⟩ := rfl
@[simp] theorem parentD_push {arr : Array UFNode} :
parentD (arr.push ⟨arr.size, 0⟩) a = parentD arr a := by
simp [parentD]; split <;> split <;> try simp [Array.get_push, *]
· next h1 h2 =>
simp [Nat.lt_succ] at h1 h2
exact Nat.le_antisymm h2 h1
· next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2)
@[simp] theorem parent_push {m : UnionFind} : m.push.parent a = m.parent a := by simp [parent]
@[simp] theorem rankD_push {arr : Array UFNode} :
rankD (arr.push ⟨arr.size, 0⟩) a = rankD arr a := by
simp [rankD]; split <;> split <;> try simp [Array.get_push, *]
next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2)
@[simp] theorem rank_push {m : UnionFind} : m.push.rank a = m.rank a := by simp [rank]
@[simp] theorem rankMax_push {m : UnionFind} : m.push.rankMax = m.rankMax := by simp [rankMax]
@[simp] theorem root_push {self : UnionFind} : self.push.rootD x = self.rootD x :=
rootD_ext fun _ => parent_push
@[simp] theorem arr_link : (link self x y yroot).arr = linkAux self.arr x y := rfl
theorem parentD_linkAux {self} {x y : Fin self.size} :
parentD (linkAux self x y) i =
if x.1 = y then
parentD self i
else
if (self.get y).rank < (self.get x).rank then
if y = i then x else parentD self i
else
if x = i then y else parentD self i := by
dsimp only [linkAux]; split <;> [rfl; split] <;> [rw [parentD_set]; split] <;> rw [parentD_set]
split <;> [(subst i; rwa [if_neg, parentD_eq]); rw [parentD_set]]
theorem parent_link {self} {x y : Fin self.size} (yroot) {i} :
(link self x y yroot).parent i =
if x.1 = y then
self.parent i
else
if self.rank y < self.rank x then
if y = i then x else self.parent i
else
if x = i then y else self.parent i := by
simp [rankD_eq]; exact parentD_linkAux
theorem root_link {self : UnionFind} {x y : Fin self.size}
(xroot : self.parent x = x) (yroot : self.parent y = y) :
∃ r, (r = x ∨ r = y) ∧ ∀ i,
(link self x y yroot).rootD i =
if self.rootD i = x ∨ self.rootD i = y then r.1 else self.rootD i := by
if h : x.1 = y then
refine ⟨x, .inl rfl, fun i => ?_⟩
rw [rootD_ext (m2 := self) (fun _ => by rw [parent_link, if_pos h])]
split <;> [obtain _ | _ := ‹_› <;> simp [*]; rfl]
else
have {x y : Fin self.size}
(xroot : self.parent x = x) (yroot : self.parent y = y) {m : UnionFind}
(hm : ∀ i, m.parent i = if y = i then x.1 else self.parent i) :
∃ r, (r = x ∨ r = y) ∧ ∀ i,
m.rootD i = if self.rootD i = x ∨ self.rootD i = y then r.1 else self.rootD i := by
let rec go (i) :
m.rootD i = if self.rootD i = x ∨ self.rootD i = y then x.1 else self.rootD i := by
if h : m.parent i = i then
rw [rootD_eq_self.2 h]; rw [hm i] at h; split at h
· rw [if_pos, h]; simp [← h, rootD_eq_self, xroot]
· rw [rootD_eq_self.2 ‹_›]; split <;> [skip; rfl]
next h' => exact h'.resolve_right (Ne.symm ‹_›)
else
have _ := Nat.sub_lt_sub_left (m.lt_rankMax i) (m.rank_lt h)
rw [← rootD_parent, go (m.parent i)]
rw [hm i]; split <;> [subst i; rw [rootD_parent]]
simp [rootD_eq_self.2 xroot, rootD_eq_self.2 yroot]
termination_by m.rankMax - m.rank i
exact ⟨x, .inl rfl, go⟩
if hr : self.rank y < self.rank x then
exact this xroot yroot fun i => by simp [parent_link, h, hr]
else
simpa (config := {singlePass := true}) [or_comm] using
this yroot xroot fun i => by simp [parent_link, h, hr]
nonrec theorem Equiv.rfl : Equiv self a a := rfl
theorem Equiv.symm : Equiv self a b → Equiv self b a := .symm
theorem Equiv.trans : Equiv self a b → Equiv self b c → Equiv self a c := .trans
@[simp] theorem equiv_empty : Equiv empty a b ↔ a = b := by simp [Equiv]
@[simp] theorem equiv_push : Equiv self.push a b ↔ Equiv self a b := by simp [Equiv]
@[simp] theorem equiv_rootD : Equiv self (self.rootD a) a := by simp [Equiv, rootD_rootD]
@[simp] theorem equiv_rootD_l : Equiv self (self.rootD a) b ↔ Equiv self a b := by
simp [Equiv, rootD_rootD]
@[simp] theorem equiv_rootD_r : Equiv self a (self.rootD b) ↔ Equiv self a b := by
simp [Equiv, rootD_rootD]
| .lake/packages/batteries/Batteries/Data/UnionFind/Lemmas.lean | 113 | 113 | theorem equiv_find : Equiv (self.find x).1 a b ↔ Equiv self a b := by | simp [Equiv, find_root_1]
| 1 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 43 | 44 | theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by |
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
| 1 |
import Mathlib.Algebra.Order.Field.Power
import Mathlib.Data.Int.LeastGreatest
import Mathlib.Data.Rat.Floor
import Mathlib.Data.NNRat.Defs
#align_import algebra.order.archimedean from "leanprover-community/mathlib"@"6f413f3f7330b94c92a5a27488fdc74e6d483a78"
open Int Set
variable {α : Type*}
class Archimedean (α) [OrderedAddCommMonoid α] : Prop where
arch : ∀ (x : α) {y : α}, 0 < y → ∃ n : ℕ, x ≤ n • y
#align archimedean Archimedean
instance OrderDual.archimedean [OrderedAddCommGroup α] [Archimedean α] : Archimedean αᵒᵈ :=
⟨fun x y hy =>
let ⟨n, hn⟩ := Archimedean.arch (-ofDual x) (neg_pos.2 hy)
⟨n, by rwa [neg_nsmul, neg_le_neg_iff] at hn⟩⟩
#align order_dual.archimedean OrderDual.archimedean
variable {M : Type*}
theorem exists_lt_nsmul [OrderedAddCommMonoid M] [Archimedean M]
[CovariantClass M M (· + ·) (· < ·)] {a : M} (ha : 0 < a) (b : M) :
∃ n : ℕ, b < n • a :=
let ⟨k, hk⟩ := Archimedean.arch b ha
⟨k + 1, hk.trans_lt <| nsmul_lt_nsmul_left ha k.lt_succ_self⟩
theorem exists_nat_ge [OrderedSemiring α] [Archimedean α] (x : α) : ∃ n : ℕ, x ≤ n := by
nontriviality α
exact (Archimedean.arch x one_pos).imp fun n h => by rwa [← nsmul_one]
#align exists_nat_ge exists_nat_ge
instance (priority := 100) [OrderedSemiring α] [Archimedean α] : IsDirected α (· ≤ ·) :=
⟨fun x y ↦
let ⟨m, hm⟩ := exists_nat_ge x; let ⟨n, hn⟩ := exists_nat_ge y
let ⟨k, hmk, hnk⟩ := exists_ge_ge m n
⟨k, hm.trans <| Nat.mono_cast hmk, hn.trans <| Nat.mono_cast hnk⟩⟩
section StrictOrderedSemiring
variable [StrictOrderedSemiring α] [Archimedean α] {y : α}
lemma exists_nat_gt (x : α) : ∃ n : ℕ, x < n :=
(exists_lt_nsmul zero_lt_one x).imp fun n hn ↦ by rwa [← nsmul_one]
#align exists_nat_gt exists_nat_gt
| Mathlib/Algebra/Order/Archimedean.lean | 138 | 148 | theorem add_one_pow_unbounded_of_pos (x : α) (hy : 0 < y) : ∃ n : ℕ, x < (y + 1) ^ n :=
have : 0 ≤ 1 + y := add_nonneg zero_le_one hy.le
(Archimedean.arch x hy).imp fun n h ↦
calc
x ≤ n • y := h
_ = n * y := nsmul_eq_mul _ _
_ < 1 + n * y := lt_one_add _
_ ≤ (1 + y) ^ n :=
one_add_mul_le_pow' (mul_nonneg hy.le hy.le) (mul_nonneg this this)
(add_nonneg zero_le_two hy.le) _
_ = (y + 1) ^ n := by | rw [add_comm]
| 1 |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {α : Type u}
class Invertible [Mul α] [One α] (a : α) : Type u where
invOf : α
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"⅟" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid α] (a b : α) [Invertible b] : a * ⅟ b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
theorem mul_mul_invOf_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * b * ⅟ b = a := by
simp [mul_assoc]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 144 | 145 | theorem mul_mul_invOf_self_cancel [Monoid α] (a b : α) [Invertible b] : a * b * ⅟ b = a := by |
simp [mul_assoc]
| 1 |
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {α β G M : Type*}
@[to_additive]
instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩
#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
attribute [local simp] mul_assoc sub_eq_add_neg
section DivInvMonoid
variable [DivInvMonoid G] {a b c : G}
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem inv_eq_one_div (x : G) : x⁻¹ = 1 / x := by rw [div_eq_mul_inv, one_mul]
#align inv_eq_one_div inv_eq_one_div
#align neg_eq_zero_sub neg_eq_zero_sub
@[to_additive]
theorem mul_one_div (x y : G) : x * (1 / y) = x / y := by
rw [div_eq_mul_inv, one_mul, div_eq_mul_inv]
#align mul_one_div mul_one_div
#align add_zero_sub add_zero_sub
@[to_additive]
theorem mul_div_assoc (a b c : G) : a * b / c = a * (b / c) := by
rw [div_eq_mul_inv, div_eq_mul_inv, mul_assoc _ _ _]
#align mul_div_assoc mul_div_assoc
#align add_sub_assoc add_sub_assoc
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem mul_div_assoc' (a b c : G) : a * (b / c) = a * b / c :=
(mul_div_assoc _ _ _).symm
#align mul_div_assoc' mul_div_assoc'
#align add_sub_assoc' add_sub_assoc'
@[to_additive (attr := simp)]
theorem one_div (a : G) : 1 / a = a⁻¹ :=
(inv_eq_one_div a).symm
#align one_div one_div
#align zero_sub zero_sub
@[to_additive]
theorem mul_div (a b c : G) : a * (b / c) = a * b / c := by simp only [mul_assoc, div_eq_mul_inv]
#align mul_div mul_div
#align add_sub add_sub
@[to_additive]
| Mathlib/Algebra/Group/Basic.lean | 479 | 479 | theorem div_eq_mul_one_div (a b : G) : a / b = a * (1 / b) := by | rw [div_eq_mul_inv, one_div]
| 1 |
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u
open MvFunctor
class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where
P : MvPFunctor.{u} n
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p
#align mvqpf MvQPF
namespace MvQPF
variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F]
open MvFunctor (LiftP LiftR)
protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align mvqpf.id_map MvQPF.id_map
@[simp]
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) (x : F α) :
(g ⊚ f) <$$> x = g <$$> f <$$> x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
#align mvqpf.comp_map MvQPF.comp_map
instance (priority := 100) lawfulMvFunctor : LawfulMvFunctor F where
id_map := @MvQPF.id_map n F _ _
comp_map := @comp_map n F _ _
#align mvqpf.is_lawful_mvfunctor MvQPF.lawfulMvFunctor
-- Lifting predicates and relations
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : F α) :
LiftP p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i j => (f i j).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]; rfl
intro i j
apply (f i j).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i j => ⟨f i j, h₁ i j⟩⟩
rw [← abs_map, h₀]; rfl
#align mvqpf.liftp_iff MvQPF.liftP_iff
theorem liftR_iff {α : TypeVec n} (r : ∀ {i}, α i → α i → Prop) (x y : F α) :
LiftR r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i j, r (f₀ i j) (f₁ i j) := by
constructor
· rintro ⟨u, xeq, yeq⟩
cases' h : repr u with a f
use a, fun i j => (f i j).val.fst, fun i j => (f i j).val.snd
constructor
· rw [← xeq, ← abs_repr u, h, ← abs_map]; rfl
constructor
· rw [← yeq, ← abs_repr u, h, ← abs_map]; rfl
intro i j
exact (f i j).property
rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
use abs ⟨a, fun i j => ⟨(f₀ i j, f₁ i j), h i j⟩⟩
dsimp; constructor
· rw [xeq, ← abs_map]; rfl
rw [yeq, ← abs_map]; rfl
#align mvqpf.liftr_iff MvQPF.liftR_iff
open Set
open MvFunctor (LiftP LiftR)
theorem mem_supp {α : TypeVec n} (x : F α) (i) (u : α i) :
u ∈ supp x i ↔ ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ := by
rw [supp]; dsimp; constructor
· intro h a f haf
have : LiftP (fun i u => u ∈ f i '' univ) x := by
rw [liftP_iff]
refine ⟨a, f, haf.symm, ?_⟩
intro i u
exact mem_image_of_mem _ (mem_univ _)
exact h this
intro h p; rw [liftP_iff]
rintro ⟨a, f, xeq, h'⟩
rcases h a f xeq.symm with ⟨i, _, hi⟩
rw [← hi]; apply h'
#align mvqpf.mem_supp MvQPF.mem_supp
| Mathlib/Data/QPF/Multivariate/Basic.lean | 180 | 181 | theorem supp_eq {α : TypeVec n} {i} (x : F α) :
supp x i = { u | ∀ a f, abs ⟨a, f⟩ = x → u ∈ f i '' univ } := by | ext; apply mem_supp
| 1 |
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Data.List.Cycle
import Mathlib.Data.Nat.Prime
import Mathlib.Data.PNat.Basic
import Mathlib.Dynamics.FixedPoints.Basic
import Mathlib.GroupTheory.GroupAction.Group
#align_import dynamics.periodic_pts from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
open Set
namespace Function
open Function (Commute)
variable {α : Type*} {β : Type*} {f fa : α → α} {fb : β → β} {x y : α} {m n : ℕ}
def IsPeriodicPt (f : α → α) (n : ℕ) (x : α) :=
IsFixedPt f^[n] x
#align function.is_periodic_pt Function.IsPeriodicPt
theorem IsFixedPt.isPeriodicPt (hf : IsFixedPt f x) (n : ℕ) : IsPeriodicPt f n x :=
hf.iterate n
#align function.is_fixed_pt.is_periodic_pt Function.IsFixedPt.isPeriodicPt
theorem is_periodic_id (n : ℕ) (x : α) : IsPeriodicPt id n x :=
(isFixedPt_id x).isPeriodicPt n
#align function.is_periodic_id Function.is_periodic_id
theorem isPeriodicPt_zero (f : α → α) (x : α) : IsPeriodicPt f 0 x :=
isFixedPt_id x
#align function.is_periodic_pt_zero Function.isPeriodicPt_zero
namespace IsPeriodicPt
instance [DecidableEq α] {f : α → α} {n : ℕ} {x : α} : Decidable (IsPeriodicPt f n x) :=
IsFixedPt.decidable
protected theorem isFixedPt (hf : IsPeriodicPt f n x) : IsFixedPt f^[n] x :=
hf
#align function.is_periodic_pt.is_fixed_pt Function.IsPeriodicPt.isFixedPt
protected theorem map (hx : IsPeriodicPt fa n x) {g : α → β} (hg : Semiconj g fa fb) :
IsPeriodicPt fb n (g x) :=
IsFixedPt.map hx (hg.iterate_right n)
#align function.is_periodic_pt.map Function.IsPeriodicPt.map
theorem apply_iterate (hx : IsPeriodicPt f n x) (m : ℕ) : IsPeriodicPt f n (f^[m] x) :=
hx.map <| Commute.iterate_self f m
#align function.is_periodic_pt.apply_iterate Function.IsPeriodicPt.apply_iterate
protected theorem apply (hx : IsPeriodicPt f n x) : IsPeriodicPt f n (f x) :=
hx.apply_iterate 1
#align function.is_periodic_pt.apply Function.IsPeriodicPt.apply
protected theorem add (hn : IsPeriodicPt f n x) (hm : IsPeriodicPt f m x) :
IsPeriodicPt f (n + m) x := by
rw [IsPeriodicPt, iterate_add]
exact hn.comp hm
#align function.is_periodic_pt.add Function.IsPeriodicPt.add
theorem left_of_add (hn : IsPeriodicPt f (n + m) x) (hm : IsPeriodicPt f m x) :
IsPeriodicPt f n x := by
rw [IsPeriodicPt, iterate_add] at hn
exact hn.left_of_comp hm
#align function.is_periodic_pt.left_of_add Function.IsPeriodicPt.left_of_add
theorem right_of_add (hn : IsPeriodicPt f (n + m) x) (hm : IsPeriodicPt f n x) :
IsPeriodicPt f m x := by
rw [add_comm] at hn
exact hn.left_of_add hm
#align function.is_periodic_pt.right_of_add Function.IsPeriodicPt.right_of_add
protected theorem sub (hm : IsPeriodicPt f m x) (hn : IsPeriodicPt f n x) :
IsPeriodicPt f (m - n) x := by
rcases le_total n m with h | h
· refine left_of_add ?_ hn
rwa [tsub_add_cancel_of_le h]
· rw [tsub_eq_zero_iff_le.mpr h]
apply isPeriodicPt_zero
#align function.is_periodic_pt.sub Function.IsPeriodicPt.sub
protected theorem mul_const (hm : IsPeriodicPt f m x) (n : ℕ) : IsPeriodicPt f (m * n) x := by
simp only [IsPeriodicPt, iterate_mul, hm.isFixedPt.iterate n]
#align function.is_periodic_pt.mul_const Function.IsPeriodicPt.mul_const
protected theorem const_mul (hm : IsPeriodicPt f m x) (n : ℕ) : IsPeriodicPt f (n * m) x := by
simp only [mul_comm n, hm.mul_const n]
#align function.is_periodic_pt.const_mul Function.IsPeriodicPt.const_mul
theorem trans_dvd (hm : IsPeriodicPt f m x) {n : ℕ} (hn : m ∣ n) : IsPeriodicPt f n x :=
let ⟨k, hk⟩ := hn
hk.symm ▸ hm.mul_const k
#align function.is_periodic_pt.trans_dvd Function.IsPeriodicPt.trans_dvd
protected theorem iterate (hf : IsPeriodicPt f n x) (m : ℕ) : IsPeriodicPt f^[m] n x := by
rw [IsPeriodicPt, ← iterate_mul, mul_comm, iterate_mul]
exact hf.isFixedPt.iterate m
#align function.is_periodic_pt.iterate Function.IsPeriodicPt.iterate
theorem comp {g : α → α} (hco : Commute f g) (hf : IsPeriodicPt f n x) (hg : IsPeriodicPt g n x) :
IsPeriodicPt (f ∘ g) n x := by
rw [IsPeriodicPt, hco.comp_iterate]
exact IsFixedPt.comp hf hg
#align function.is_periodic_pt.comp Function.IsPeriodicPt.comp
theorem comp_lcm {g : α → α} (hco : Commute f g) (hf : IsPeriodicPt f m x)
(hg : IsPeriodicPt g n x) : IsPeriodicPt (f ∘ g) (Nat.lcm m n) x :=
(hf.trans_dvd <| Nat.dvd_lcm_left _ _).comp hco (hg.trans_dvd <| Nat.dvd_lcm_right _ _)
#align function.is_periodic_pt.comp_lcm Function.IsPeriodicPt.comp_lcm
theorem left_of_comp {g : α → α} (hco : Commute f g) (hfg : IsPeriodicPt (f ∘ g) n x)
(hg : IsPeriodicPt g n x) : IsPeriodicPt f n x := by
rw [IsPeriodicPt, hco.comp_iterate] at hfg
exact hfg.left_of_comp hg
#align function.is_periodic_pt.left_of_comp Function.IsPeriodicPt.left_of_comp
| Mathlib/Dynamics/PeriodicPts.lean | 162 | 163 | theorem iterate_mod_apply (h : IsPeriodicPt f n x) (m : ℕ) : f^[m % n] x = f^[m] x := by |
conv_rhs => rw [← Nat.mod_add_div m n, iterate_add_apply, (h.mul_const _).eq]
| 1 |
import Mathlib.Algebra.CharP.Defs
import Mathlib.Algebra.FreeAlgebra
import Mathlib.RingTheory.Localization.FractionRing
#align_import algebra.char_p.algebra from "leanprover-community/mathlib"@"96782a2d6dcded92116d8ac9ae48efb41d46a27c"
| Mathlib/Algebra/CharP/Algebra.lean | 34 | 37 | theorem charP_of_injective_ringHom {R A : Type*} [NonAssocSemiring R] [NonAssocSemiring A]
{f : R →+* A} (h : Function.Injective f) (p : ℕ) [CharP R p] : CharP A p where
cast_eq_zero_iff' x := by |
rw [← CharP.cast_eq_zero_iff R p x, ← map_natCast f x, map_eq_zero_iff f h]
| 1 |
import Mathlib.Logic.Basic
import Mathlib.Tactic.Convert
import Mathlib.Tactic.SplitIfs
#align_import logic.lemmas from "leanprover-community/mathlib"@"2ed7e4aec72395b6a7c3ac4ac7873a7a43ead17c"
protected alias ⟨HEq.eq, Eq.heq⟩ := heq_iff_eq
#align heq.eq HEq.eq
#align eq.heq Eq.heq
variable {α : Sort*} {p q r : Prop} [Decidable p] [Decidable q] {a b c : α}
theorem dite_dite_distrib_left {a : p → α} {b : ¬p → q → α} {c : ¬p → ¬q → α} :
(dite p a fun hp ↦ dite q (b hp) (c hp)) =
dite q (fun hq ↦ (dite p a) fun hp ↦ b hp hq) fun hq ↦ (dite p a) fun hp ↦ c hp hq := by
split_ifs <;> rfl
#align dite_dite_distrib_left dite_dite_distrib_left
| Mathlib/Logic/Lemmas.lean | 34 | 37 | theorem dite_dite_distrib_right {a : p → q → α} {b : p → ¬q → α} {c : ¬p → α} :
dite p (fun hp ↦ dite q (a hp) (b hp)) c =
dite q (fun hq ↦ dite p (fun hp ↦ a hp hq) c) fun hq ↦ dite p (fun hp ↦ b hp hq) c := by |
split_ifs <;> rfl
| 1 |
import Mathlib.Algebra.Order.Ring.Nat
#align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b"
namespace Nat
def dist (n m : ℕ) :=
n - m + (m - n)
#align nat.dist Nat.dist
-- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet.
#noalign nat.dist.def
| Mathlib/Data/Nat/Dist.lean | 27 | 27 | theorem dist_comm (n m : ℕ) : dist n m = dist m n := by | simp [dist, add_comm]
| 1 |
import Mathlib.CategoryTheory.Limits.HasLimits
import Mathlib.CategoryTheory.Limits.Shapes.Equalizers
#align_import category_theory.limits.shapes.wide_equalizers from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace CategoryTheory.Limits
open CategoryTheory
universe w v u u₂
variable {J : Type w}
inductive WalkingParallelFamily (J : Type w) : Type w
| zero : WalkingParallelFamily J
| one : WalkingParallelFamily J
#align category_theory.limits.walking_parallel_family CategoryTheory.Limits.WalkingParallelFamily
open WalkingParallelFamily
instance : DecidableEq (WalkingParallelFamily J)
| zero, zero => isTrue rfl
| zero, one => isFalse fun t => WalkingParallelFamily.noConfusion t
| one, zero => isFalse fun t => WalkingParallelFamily.noConfusion t
| one, one => isTrue rfl
instance : Inhabited (WalkingParallelFamily J) :=
⟨zero⟩
inductive WalkingParallelFamily.Hom (J : Type w) :
WalkingParallelFamily J → WalkingParallelFamily J → Type w
| id : ∀ X : WalkingParallelFamily.{w} J, WalkingParallelFamily.Hom J X X
| line : J → WalkingParallelFamily.Hom J zero one
deriving DecidableEq
#align
category_theory.limits.walking_parallel_family.hom
CategoryTheory.Limits.WalkingParallelFamily.Hom
instance (J : Type v) : Inhabited (WalkingParallelFamily.Hom J zero zero) where default := Hom.id _
open WalkingParallelFamily.Hom
def WalkingParallelFamily.Hom.comp :
∀ {X Y Z : WalkingParallelFamily J} (_ : WalkingParallelFamily.Hom J X Y)
(_ : WalkingParallelFamily.Hom J Y Z), WalkingParallelFamily.Hom J X Z
| _, _, _, id _, h => h
| _, _, _, line j, id one => line j
#align
category_theory.limits.walking_parallel_family.hom.comp
CategoryTheory.Limits.WalkingParallelFamily.Hom.comp
-- attribute [local tidy] tactic.case_bash Porting note: no tidy, no local
instance WalkingParallelFamily.category : SmallCategory (WalkingParallelFamily J) where
Hom := WalkingParallelFamily.Hom J
id := WalkingParallelFamily.Hom.id
comp := WalkingParallelFamily.Hom.comp
assoc f g h := by cases f <;> cases g <;> cases h <;> aesop_cat
comp_id f := by cases f <;> aesop_cat
#align
category_theory.limits.walking_parallel_family.category
CategoryTheory.Limits.WalkingParallelFamily.category
@[simp]
theorem WalkingParallelFamily.hom_id (X : WalkingParallelFamily J) :
WalkingParallelFamily.Hom.id X = 𝟙 X :=
rfl
#align
category_theory.limits.walking_parallel_family.hom_id
CategoryTheory.Limits.WalkingParallelFamily.hom_id
variable {C : Type u} [Category.{v} C]
variable {X Y : C} (f : J → (X ⟶ Y))
def parallelFamily : WalkingParallelFamily J ⥤ C where
obj x := WalkingParallelFamily.casesOn x X Y
map {x y} h :=
match x, y, h with
| _, _, Hom.id _ => 𝟙 _
| _, _, line j => f j
map_comp := by
rintro _ _ _ ⟨⟩ ⟨⟩ <;>
· aesop_cat
#align category_theory.limits.parallel_family CategoryTheory.Limits.parallelFamily
@[simp]
theorem parallelFamily_obj_zero : (parallelFamily f).obj zero = X :=
rfl
#align category_theory.limits.parallel_family_obj_zero CategoryTheory.Limits.parallelFamily_obj_zero
@[simp]
theorem parallelFamily_obj_one : (parallelFamily f).obj one = Y :=
rfl
#align category_theory.limits.parallel_family_obj_one CategoryTheory.Limits.parallelFamily_obj_one
@[simp]
theorem parallelFamily_map_left {j : J} : (parallelFamily f).map (line j) = f j :=
rfl
#align
category_theory.limits.parallel_family_map_left
CategoryTheory.Limits.parallelFamily_map_left
@[simps!]
def diagramIsoParallelFamily (F : WalkingParallelFamily J ⥤ C) :
F ≅ parallelFamily fun j => F.map (line j) :=
NatIso.ofComponents (fun j => eqToIso <| by cases j <;> aesop_cat) <| by
rintro _ _ (_|_) <;> aesop_cat
#align
category_theory.limits.diagram_iso_parallel_family
CategoryTheory.Limits.diagramIsoParallelFamily
@[simps!]
def walkingParallelFamilyEquivWalkingParallelPair :
WalkingParallelFamily.{w} (ULift Bool) ≌ WalkingParallelPair where
functor :=
parallelFamily fun p => cond p.down WalkingParallelPairHom.left WalkingParallelPairHom.right
inverse := parallelPair (line (ULift.up true)) (line (ULift.up false))
unitIso := NatIso.ofComponents (fun X => eqToIso (by cases X <;> rfl)) (by
rintro _ _ (_|⟨_|_⟩) <;> aesop_cat)
counitIso := NatIso.ofComponents (fun X => eqToIso (by cases X <;> rfl)) (by
rintro _ _ (_|_|_) <;> aesop_cat)
functor_unitIso_comp := by rintro (_|_) <;> aesop_cat
#align
category_theory.limits.walking_parallel_family_equiv_walking_parallel_pair
CategoryTheory.Limits.walkingParallelFamilyEquivWalkingParallelPair
abbrev Trident :=
Cone (parallelFamily f)
#align category_theory.limits.trident CategoryTheory.Limits.Trident
abbrev Cotrident :=
Cocone (parallelFamily f)
#align category_theory.limits.cotrident CategoryTheory.Limits.Cotrident
variable {f}
abbrev Trident.ι (t : Trident f) :=
t.π.app zero
#align category_theory.limits.trident.ι CategoryTheory.Limits.Trident.ι
abbrev Cotrident.π (t : Cotrident f) :=
t.ι.app one
#align category_theory.limits.cotrident.π CategoryTheory.Limits.Cotrident.π
@[simp]
theorem Trident.ι_eq_app_zero (t : Trident f) : t.ι = t.π.app zero :=
rfl
#align category_theory.limits.trident.ι_eq_app_zero CategoryTheory.Limits.Trident.ι_eq_app_zero
@[simp]
theorem Cotrident.π_eq_app_one (t : Cotrident f) : t.π = t.ι.app one :=
rfl
#align category_theory.limits.cotrident.π_eq_app_one CategoryTheory.Limits.Cotrident.π_eq_app_one
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Limits/Shapes/WideEqualizers.lean | 218 | 219 | theorem Trident.app_zero (s : Trident f) (j : J) : s.π.app zero ≫ f j = s.π.app one := by |
rw [← s.w (line j), parallelFamily_map_left]
| 1 |
import Mathlib.Algebra.ContinuedFractions.Computation.Basic
import Mathlib.Algebra.ContinuedFractions.Translations
#align_import algebra.continued_fractions.computation.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
-- Fix a discrete linear ordered floor field and a value `v`.
variable {K : Type*} [LinearOrderedField K] [FloorRing K] {v : K}
section Head
@[simp]
theorem IntFractPair.seq1_fst_eq_of : (IntFractPair.seq1 v).fst = IntFractPair.of v :=
rfl
#align generalized_continued_fraction.int_fract_pair.seq1_fst_eq_of GeneralizedContinuedFraction.IntFractPair.seq1_fst_eq_of
theorem of_h_eq_intFractPair_seq1_fst_b : (of v).h = (IntFractPair.seq1 v).fst.b := by
cases aux_seq_eq : IntFractPair.seq1 v
simp [of, aux_seq_eq]
#align generalized_continued_fraction.of_h_eq_int_fract_pair_seq1_fst_b GeneralizedContinuedFraction.of_h_eq_intFractPair_seq1_fst_b
@[simp]
| Mathlib/Algebra/ContinuedFractions/Computation/Translations.lean | 170 | 171 | theorem of_h_eq_floor : (of v).h = ⌊v⌋ := by |
simp [of_h_eq_intFractPair_seq1_fst_b, IntFractPair.of]
| 1 |
import Mathlib.Algebra.Order.Group.Nat
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Support
#align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace List
variable {α β : Type*}
section FormPerm
variable [DecidableEq α] (l : List α)
open Equiv Equiv.Perm
def formPerm : Equiv.Perm α :=
(zipWith Equiv.swap l l.tail).prod
#align list.form_perm List.formPerm
@[simp]
theorem formPerm_nil : formPerm ([] : List α) = 1 :=
rfl
#align list.form_perm_nil List.formPerm_nil
@[simp]
theorem formPerm_singleton (x : α) : formPerm [x] = 1 :=
rfl
#align list.form_perm_singleton List.formPerm_singleton
@[simp]
theorem formPerm_cons_cons (x y : α) (l : List α) :
formPerm (x :: y :: l) = swap x y * formPerm (y :: l) :=
prod_cons
#align list.form_perm_cons_cons List.formPerm_cons_cons
theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y :=
rfl
#align list.form_perm_pair List.formPerm_pair
theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α},
(zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l'
| [], _, _ => by simp
| _, [], _ => by simp
| a::l, b::l', x => fun hx ↦
if h : (zipWith swap l l').prod x = x then
(eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp
(by rintro rfl; exact .head _) (by rintro rfl; exact .head _)
else
(mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _)
theorem zipWith_swap_prod_support' (l l' : List α) :
{ x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by
simpa using mem_or_mem_of_zipWith_swap_prod_ne h
#align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support'
theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) :
(zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by
intro x hx
have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx
simpa using zipWith_swap_prod_support' _ _ hx'
#align list.zip_with_swap_prod_support List.zipWith_swap_prod_support
theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by
refine (zipWith_swap_prod_support' l l.tail).trans ?_
simpa [Finset.subset_iff] using tail_subset l
#align list.support_form_perm_le' List.support_formPerm_le'
theorem support_formPerm_le [Fintype α] : support (formPerm l) ≤ l.toFinset := by
intro x hx
have hx' : x ∈ { x | formPerm l x ≠ x } := by simpa using hx
simpa using support_formPerm_le' _ hx'
#align list.support_form_perm_le List.support_formPerm_le
variable {l} {x : α}
| Mathlib/GroupTheory/Perm/List.lean | 108 | 109 | theorem mem_of_formPerm_apply_ne (h : l.formPerm x ≠ x) : x ∈ l := by |
simpa [or_iff_left_of_imp mem_of_mem_tail] using mem_or_mem_of_zipWith_swap_prod_ne h
| 1 |
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d"
open NormedField Set
open scoped Pointwise Topology NNReal
noncomputable section
variable {𝕜 E F : Type*}
section AddCommGroup
variable [AddCommGroup E] [Module ℝ E]
def gauge (s : Set E) (x : E) : ℝ :=
sInf { r : ℝ | 0 < r ∧ x ∈ r • s }
#align gauge gauge
variable {s t : Set E} {x : E} {a : ℝ}
theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) :=
rfl
#align gauge_def gauge_def
theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by
congrm sInf {r | ?_}
exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _
#align gauge_def' gauge_def'
private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } :=
⟨0, fun _ hr => hr.1.le⟩
theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) :
{ r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty :=
let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos
⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩
#align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty
theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ =>
csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩
#align gauge_mono gauge_mono
theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) :
∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by
obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h
exact ⟨b, hb, hba, hx⟩
#align exists_lt_of_gauge_lt exists_lt_of_gauge_lt
@[simp]
theorem gauge_zero : gauge s 0 = 0 := by
rw [gauge_def']
by_cases h : (0 : E) ∈ s
· simp only [smul_zero, sep_true, h, csInf_Ioi]
· simp only [smul_zero, sep_false, h, Real.sInf_empty]
#align gauge_zero gauge_zero
@[simp]
theorem gauge_zero' : gauge (0 : Set E) = 0 := by
ext x
rw [gauge_def']
obtain rfl | hx := eq_or_ne x 0
· simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero]
· simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero]
convert Real.sInf_empty
exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx
#align gauge_zero' gauge_zero'
@[simp]
theorem gauge_empty : gauge (∅ : Set E) = 0 := by
ext
simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false]
#align gauge_empty gauge_empty
theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by
obtain rfl | rfl := subset_singleton_iff_eq.1 h
exacts [gauge_empty, gauge_zero']
#align gauge_of_subset_zero gauge_of_subset_zero
theorem gauge_nonneg (x : E) : 0 ≤ gauge s x :=
Real.sInf_nonneg _ fun _ hx => hx.1.le
#align gauge_nonneg gauge_nonneg
theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by
have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩
simp_rw [gauge_def', smul_neg, this]
#align gauge_neg gauge_neg
theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by
simp_rw [gauge_def', smul_neg, neg_mem_neg]
#align gauge_neg_set_neg gauge_neg_set_neg
| Mathlib/Analysis/Convex/Gauge.lean | 138 | 139 | theorem gauge_neg_set_eq_gauge_neg (x : E) : gauge (-s) x = gauge s (-x) := by |
rw [← gauge_neg_set_neg, neg_neg]
| 1 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
#align rat.denom_dvd Rat.den_dvd
theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by
obtain rfl | hn := eq_or_ne n 0
· simp [qdf]
have : q.num * d = n * ↑q.den := by
refine (divInt_eq_iff ?_ hd).mp ?_
· exact Int.natCast_ne_zero.mpr (Rat.den_nz _)
· rwa [num_divInt_den]
have hqdn : q.num ∣ n := by
rw [qdf]
exact Rat.num_dvd _ hd
refine ⟨n / q.num, ?_, ?_⟩
· rw [Int.ediv_mul_cancel hqdn]
· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this
rw [qdf]
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
#align rat.num_denom_mk Rat.num_den_mk
#noalign rat.mk_pnat_num
#noalign rat.mk_pnat_denom
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
rw [← Int.div_eq_ediv_of_dvd] <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this]
#align rat.num_mk Rat.num_mk
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
if_neg (Nat.cast_add_one_ne_zero _), this]
#align rat.denom_mk Rat.den_mk
#noalign rat.mk_pnat_denom_dvd
theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den := by
rw [add_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.add_denom_dvd Rat.add_den_dvd
theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den := by
rw [mul_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.mul_denom_dvd Rat.mul_den_dvd
theorem mul_num (q₁ q₂ : ℚ) :
(q₁ * q₂).num = q₁.num * q₂.num / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by
rw [mul_def, normalize_eq]
#align rat.mul_num Rat.mul_num
| Mathlib/Data/Rat/Lemmas.lean | 98 | 101 | theorem mul_den (q₁ q₂ : ℚ) :
(q₁ * q₂).den =
q₁.den * q₂.den / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by |
rw [mul_def, normalize_eq]
| 1 |
import Mathlib.Order.Interval.Set.Monotone
import Mathlib.Probability.Process.HittingTime
import Mathlib.Probability.Martingale.Basic
import Mathlib.Tactic.AdaptationNote
#align_import probability.martingale.upcrossing from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory Topology
namespace MeasureTheory
variable {Ω ι : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω}
noncomputable def lowerCrossingTimeAux [Preorder ι] [InfSet ι] (a : ℝ) (f : ι → Ω → ℝ) (c N : ι) :
Ω → ι :=
hitting f (Set.Iic a) c N
#align measure_theory.lower_crossing_time_aux MeasureTheory.lowerCrossingTimeAux
noncomputable def upperCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
(N : ι) : ℕ → Ω → ι
| 0 => ⊥
| n + 1 => fun ω =>
hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω
#align measure_theory.upper_crossing_time MeasureTheory.upperCrossingTime
noncomputable def lowerCrossingTime [Preorder ι] [OrderBot ι] [InfSet ι] (a b : ℝ) (f : ι → Ω → ℝ)
(N : ι) (n : ℕ) : Ω → ι := fun ω => hitting f (Set.Iic a) (upperCrossingTime a b f N n ω) N ω
#align measure_theory.lower_crossing_time MeasureTheory.lowerCrossingTime
section
variable [Preorder ι] [OrderBot ι] [InfSet ι]
variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
@[simp]
theorem upperCrossingTime_zero : upperCrossingTime a b f N 0 = ⊥ :=
rfl
#align measure_theory.upper_crossing_time_zero MeasureTheory.upperCrossingTime_zero
@[simp]
theorem lowerCrossingTime_zero : lowerCrossingTime a b f N 0 = hitting f (Set.Iic a) ⊥ N :=
rfl
#align measure_theory.lower_crossing_time_zero MeasureTheory.lowerCrossingTime_zero
theorem upperCrossingTime_succ : upperCrossingTime a b f N (n + 1) ω =
hitting f (Set.Ici b) (lowerCrossingTimeAux a f (upperCrossingTime a b f N n ω) N ω) N ω := by
rw [upperCrossingTime]
#align measure_theory.upper_crossing_time_succ MeasureTheory.upperCrossingTime_succ
theorem upperCrossingTime_succ_eq (ω : Ω) : upperCrossingTime a b f N (n + 1) ω =
hitting f (Set.Ici b) (lowerCrossingTime a b f N n ω) N ω := by
simp only [upperCrossingTime_succ]
rfl
#align measure_theory.upper_crossing_time_succ_eq MeasureTheory.upperCrossingTime_succ_eq
end
section ConditionallyCompleteLinearOrderBot
variable [ConditionallyCompleteLinearOrderBot ι]
variable {a b : ℝ} {f : ι → Ω → ℝ} {N : ι} {n m : ℕ} {ω : Ω}
theorem upperCrossingTime_le : upperCrossingTime a b f N n ω ≤ N := by
cases n
· simp only [upperCrossingTime_zero, Pi.bot_apply, bot_le, Nat.zero_eq]
· simp only [upperCrossingTime_succ, hitting_le]
#align measure_theory.upper_crossing_time_le MeasureTheory.upperCrossingTime_le
@[simp]
theorem upperCrossingTime_zero' : upperCrossingTime a b f ⊥ n ω = ⊥ :=
eq_bot_iff.2 upperCrossingTime_le
#align measure_theory.upper_crossing_time_zero' MeasureTheory.upperCrossingTime_zero'
| Mathlib/Probability/Martingale/Upcrossing.lean | 197 | 198 | theorem lowerCrossingTime_le : lowerCrossingTime a b f N n ω ≤ N := by |
simp only [lowerCrossingTime, hitting_le ω]
| 1 |
import Mathlib.Algebra.Algebra.Unitization
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
suppress_compilation
variable (𝕜 A : Type*) [NontriviallyNormedField 𝕜] [NonUnitalNormedRing A]
variable [NormedSpace 𝕜 A] [IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A]
open ContinuousLinearMap
namespace Unitization
def splitMul : Unitization 𝕜 A →ₐ[𝕜] 𝕜 × (A →L[𝕜] A) :=
(lift 0).prod (lift <| NonUnitalAlgHom.Lmul 𝕜 A)
variable {𝕜 A}
@[simp]
theorem splitMul_apply (x : Unitization 𝕜 A) :
splitMul 𝕜 A x = (x.fst, algebraMap 𝕜 (A →L[𝕜] A) x.fst + mul 𝕜 A x.snd) :=
show (x.fst + 0, _) = (x.fst, _) by rw [add_zero]; rfl
theorem splitMul_injective_of_clm_mul_injective
(h : Function.Injective (mul 𝕜 A)) :
Function.Injective (splitMul 𝕜 A) := by
rw [injective_iff_map_eq_zero]
intro x hx
induction x
rw [map_add] at hx
simp only [splitMul_apply, fst_inl, snd_inl, map_zero, add_zero, fst_inr, snd_inr,
zero_add, Prod.mk_add_mk, Prod.mk_eq_zero] at hx
obtain ⟨rfl, hx⟩ := hx
simp only [map_zero, zero_add, inl_zero] at hx ⊢
rw [← map_zero (mul 𝕜 A)] at hx
rw [h hx, inr_zero]
variable [RegularNormedAlgebra 𝕜 A]
variable (𝕜 A)
theorem splitMul_injective : Function.Injective (splitMul 𝕜 A) :=
splitMul_injective_of_clm_mul_injective (isometry_mul 𝕜 A).injective
variable {𝕜 A}
section Aux
noncomputable abbrev normedRingAux : NormedRing (Unitization 𝕜 A) :=
NormedRing.induced (Unitization 𝕜 A) (𝕜 × (A →L[𝕜] A)) (splitMul 𝕜 A) (splitMul_injective 𝕜 A)
attribute [local instance] Unitization.normedRingAux
noncomputable abbrev normedAlgebraAux : NormedAlgebra 𝕜 (Unitization 𝕜 A) :=
NormedAlgebra.induced 𝕜 (Unitization 𝕜 A) (𝕜 × (A →L[𝕜] A)) (splitMul 𝕜 A)
attribute [local instance] Unitization.normedAlgebraAux
theorem norm_def (x : Unitization 𝕜 A) : ‖x‖ = ‖splitMul 𝕜 A x‖ :=
rfl
theorem nnnorm_def (x : Unitization 𝕜 A) : ‖x‖₊ = ‖splitMul 𝕜 A x‖₊ :=
rfl
| Mathlib/Analysis/NormedSpace/Unitization.lean | 139 | 141 | theorem norm_eq_sup (x : Unitization 𝕜 A) :
‖x‖ = ‖x.fst‖ ⊔ ‖algebraMap 𝕜 (A →L[𝕜] A) x.fst + mul 𝕜 A x.snd‖ := by |
rw [norm_def, splitMul_apply, Prod.norm_def, sup_eq_max]
| 1 |
import Mathlib.MeasureTheory.OuterMeasure.OfFunction
import Mathlib.MeasureTheory.PiSystem
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
namespace OuterMeasure
section CaratheodoryMeasurable
universe u
variable {α : Type u} (m : OuterMeasure α)
attribute [local simp] Set.inter_comm Set.inter_left_comm Set.inter_assoc
variable {s s₁ s₂ : Set α}
def IsCaratheodory (s : Set α) : Prop :=
∀ t, m t = m (t ∩ s) + m (t \ s)
#align measure_theory.outer_measure.is_caratheodory MeasureTheory.OuterMeasure.IsCaratheodory
theorem isCaratheodory_iff_le' {s : Set α} :
IsCaratheodory m s ↔ ∀ t, m (t ∩ s) + m (t \ s) ≤ m t :=
forall_congr' fun _ => le_antisymm_iff.trans <| and_iff_right <| measure_le_inter_add_diff _ _ _
#align measure_theory.outer_measure.is_caratheodory_iff_le' MeasureTheory.OuterMeasure.isCaratheodory_iff_le'
@[simp]
| Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean | 62 | 62 | theorem isCaratheodory_empty : IsCaratheodory m ∅ := by | simp [IsCaratheodory, m.empty, diff_empty]
| 1 |
import Mathlib.Analysis.Calculus.BumpFunction.Basic
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Function Filter Set Metric MeasureTheory FiniteDimensional Measure
open scoped Topology
namespace ContDiffBump
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E]
[MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} {μ : Measure E}
protected def normed (μ : Measure E) : E → ℝ := fun x => f x / ∫ x, f x ∂μ
#align cont_diff_bump.normed ContDiffBump.normed
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ :=
rfl
#align cont_diff_bump.normed_def ContDiffBump.normed_def
theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x :=
div_nonneg f.nonneg <| integral_nonneg f.nonneg'
#align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed
theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ) :=
f.contDiff.div_const _
#align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed
theorem continuous_normed : Continuous (f.normed μ) :=
f.continuous.div_const _
#align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed
theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by
simp_rw [f.normed_def, f.sub]
#align cont_diff_bump.normed_sub ContDiffBump.normed_sub
theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed μ (-x) = f.normed μ x := by
simp_rw [f.normed_def, f.neg]
#align cont_diff_bump.normed_neg ContDiffBump.normed_neg
variable [BorelSpace E] [FiniteDimensional ℝ E] [IsLocallyFiniteMeasure μ]
protected theorem integrable : Integrable f μ :=
f.continuous.integrable_of_hasCompactSupport f.hasCompactSupport
#align cont_diff_bump.integrable ContDiffBump.integrable
protected theorem integrable_normed : Integrable (f.normed μ) μ :=
f.integrable.div_const _
#align cont_diff_bump.integrable_normed ContDiffBump.integrable_normed
variable [μ.IsOpenPosMeasure]
theorem integral_pos : 0 < ∫ x, f x ∂μ := by
refine (integral_pos_iff_support_of_nonneg f.nonneg' f.integrable).mpr ?_
rw [f.support_eq]
exact measure_ball_pos μ c f.rOut_pos
#align cont_diff_bump.integral_pos ContDiffBump.integral_pos
theorem integral_normed : ∫ x, f.normed μ x ∂μ = 1 := by
simp_rw [ContDiffBump.normed, div_eq_mul_inv, mul_comm (f _), ← smul_eq_mul, integral_smul]
exact inv_mul_cancel f.integral_pos.ne'
#align cont_diff_bump.integral_normed ContDiffBump.integral_normed
theorem support_normed_eq : Function.support (f.normed μ) = Metric.ball c f.rOut := by
unfold ContDiffBump.normed
rw [support_div, f.support_eq, support_const f.integral_pos.ne', inter_univ]
#align cont_diff_bump.support_normed_eq ContDiffBump.support_normed_eq
theorem tsupport_normed_eq : tsupport (f.normed μ) = Metric.closedBall c f.rOut := by
rw [tsupport, f.support_normed_eq, closure_ball _ f.rOut_pos.ne']
#align cont_diff_bump.tsupport_normed_eq ContDiffBump.tsupport_normed_eq
theorem hasCompactSupport_normed : HasCompactSupport (f.normed μ) := by
simp only [HasCompactSupport, f.tsupport_normed_eq (μ := μ), isCompact_closedBall]
#align cont_diff_bump.has_compact_support_normed ContDiffBump.hasCompactSupport_normed
theorem tendsto_support_normed_smallSets {ι} {φ : ι → ContDiffBump c} {l : Filter ι}
(hφ : Tendsto (fun i => (φ i).rOut) l (𝓝 0)) :
Tendsto (fun i => Function.support fun x => (φ i).normed μ x) l (𝓝 c).smallSets := by
simp_rw [NormedAddCommGroup.tendsto_nhds_zero, Real.norm_eq_abs,
abs_eq_self.mpr (φ _).rOut_pos.le] at hφ
rw [nhds_basis_ball.smallSets.tendsto_right_iff]
refine fun ε hε ↦ (hφ ε hε).mono fun i hi ↦ ?_
rw [(φ i).support_normed_eq]
exact ball_subset_ball hi.le
#align cont_diff_bump.tendsto_support_normed_small_sets ContDiffBump.tendsto_support_normed_smallSets
variable (μ)
| Mathlib/Analysis/Calculus/BumpFunction/Normed.lean | 106 | 108 | theorem integral_normed_smul {X} [NormedAddCommGroup X] [NormedSpace ℝ X]
[CompleteSpace X] (z : X) : ∫ x, f.normed μ x • z ∂μ = z := by |
simp_rw [integral_smul_const, f.integral_normed (μ := μ), one_smul]
| 1 |
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
#align affine_basis.to_matrix_self AffineBasis.toMatrix_self
variable {ι' : Type*}
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 55 | 56 | theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by |
simp
| 1 |
import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Preadditive.Opposite
import Mathlib.CategoryTheory.Limits.Opposites
#align_import category_theory.abelian.opposite from "leanprover-community/mathlib"@"a5ff45a1c92c278b03b52459a620cfd9c49ebc80"
noncomputable section
namespace CategoryTheory
open CategoryTheory.Limits
variable (C : Type*) [Category C] [Abelian C]
-- Porting note: these local instances do not seem to be necessary
--attribute [local instance]
-- hasFiniteLimits_of_hasEqualizers_and_finite_products
-- hasFiniteColimits_of_hasCoequalizers_and_finite_coproducts
-- Abelian.hasFiniteBiproducts
instance : Abelian Cᵒᵖ := by
-- Porting note: priorities of `Abelian.has_kernels` and `Abelian.has_cokernels` have
-- been set to 90 in `Abelian.Basic` in order to prevent a timeout here
exact {
normalMonoOfMono := fun f => normalMonoOfNormalEpiUnop _ (normalEpiOfEpi f.unop)
normalEpiOfEpi := fun f => normalEpiOfNormalMonoUnop _ (normalMonoOfMono f.unop) }
section
variable {C}
variable {X Y : C} (f : X ⟶ Y) {A B : Cᵒᵖ} (g : A ⟶ B)
-- TODO: Generalize (this will work whenever f has a cokernel)
-- (The abelian case is probably sufficient for most applications.)
@[simps]
def kernelOpUnop : (kernel f.op).unop ≅ cokernel f where
hom := (kernel.lift f.op (cokernel.π f).op <| by simp [← op_comp]).unop
inv :=
cokernel.desc f (kernel.ι f.op).unop <| by
rw [← f.unop_op, ← unop_comp, f.unop_op]
simp
hom_inv_id := by
rw [← unop_id, ← (cokernel.desc f _ _).unop_op, ← unop_comp]
congr 1
ext
simp [← op_comp]
inv_hom_id := by
ext
simp [← unop_comp]
#align category_theory.kernel_op_unop CategoryTheory.kernelOpUnop
-- TODO: Generalize (this will work whenever f has a kernel)
-- (The abelian case is probably sufficient for most applications.)
@[simps]
def cokernelOpUnop : (cokernel f.op).unop ≅ kernel f where
hom :=
kernel.lift f (cokernel.π f.op).unop <| by
rw [← f.unop_op, ← unop_comp, f.unop_op]
simp
inv := (cokernel.desc f.op (kernel.ι f).op <| by simp [← op_comp]).unop
hom_inv_id := by
rw [← unop_id, ← (kernel.lift f _ _).unop_op, ← unop_comp]
congr 1
ext
simp [← op_comp]
inv_hom_id := by
ext
simp [← unop_comp]
#align category_theory.cokernel_op_unop CategoryTheory.cokernelOpUnop
@[simps!]
def kernelUnopOp : Opposite.op (kernel g.unop) ≅ cokernel g :=
(cokernelOpUnop g.unop).op
#align category_theory.kernel_unop_op CategoryTheory.kernelUnopOp
@[simps!]
def cokernelUnopOp : Opposite.op (cokernel g.unop) ≅ kernel g :=
(kernelOpUnop g.unop).op
#align category_theory.cokernel_unop_op CategoryTheory.cokernelUnopOp
| Mathlib/CategoryTheory/Abelian/Opposite.lean | 95 | 98 | theorem cokernel.π_op :
(cokernel.π f.op).unop =
(cokernelOpUnop f).hom ≫ kernel.ι f ≫ eqToHom (Opposite.unop_op _).symm := by |
simp [cokernelOpUnop]
| 1 |
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Zip
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Infix
#align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u
variable {α : Type u}
open Nat Function
namespace List
| Mathlib/Data/List/Rotate.lean | 37 | 37 | theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by | simp [rotate]
| 1 |
import Mathlib.Probability.ProbabilityMassFunction.Monad
#align_import probability.probability_mass_function.constructions from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d"
universe u
namespace PMF
noncomputable section
variable {α β γ : Type*}
open scoped Classical
open NNReal ENNReal
section Map
def map (f : α → β) (p : PMF α) : PMF β :=
bind p (pure ∘ f)
#align pmf.map PMF.map
variable (f : α → β) (p : PMF α) (b : β)
theorem monad_map_eq_map {α β : Type u} (f : α → β) (p : PMF α) : f <$> p = p.map f := rfl
#align pmf.monad_map_eq_map PMF.monad_map_eq_map
@[simp]
theorem map_apply : (map f p) b = ∑' a, if b = f a then p a else 0 := by simp [map]
#align pmf.map_apply PMF.map_apply
@[simp]
theorem support_map : (map f p).support = f '' p.support :=
Set.ext fun b => by simp [map, @eq_comm β b]
#align pmf.support_map PMF.support_map
theorem mem_support_map_iff : b ∈ (map f p).support ↔ ∃ a ∈ p.support, f a = b := by simp
#align pmf.mem_support_map_iff PMF.mem_support_map_iff
theorem bind_pure_comp : bind p (pure ∘ f) = map f p := rfl
#align pmf.bind_pure_comp PMF.bind_pure_comp
theorem map_id : map id p = p :=
bind_pure _
#align pmf.map_id PMF.map_id
theorem map_comp (g : β → γ) : (p.map f).map g = p.map (g ∘ f) := by simp [map, Function.comp]
#align pmf.map_comp PMF.map_comp
theorem pure_map (a : α) : (pure a).map f = pure (f a) :=
pure_bind _ _
#align pmf.pure_map PMF.pure_map
theorem map_bind (q : α → PMF β) (f : β → γ) : (p.bind q).map f = p.bind fun a => (q a).map f :=
bind_bind _ _ _
#align pmf.map_bind PMF.map_bind
@[simp]
theorem bind_map (p : PMF α) (f : α → β) (q : β → PMF γ) : (p.map f).bind q = p.bind (q ∘ f) :=
(bind_bind _ _ _).trans (congr_arg _ (funext fun _ => pure_bind _ _))
#align pmf.bind_map PMF.bind_map
@[simp]
theorem map_const : p.map (Function.const α b) = pure b := by
simp only [map, Function.comp, bind_const, Function.const]
#align pmf.map_const PMF.map_const
instance : LawfulFunctor PMF where
map_const := rfl
id_map := bind_pure
comp_map _ _ _ := (map_comp _ _ _).symm
instance : LawfulMonad PMF := LawfulMonad.mk'
(bind_pure_comp := fun f x => rfl)
(id_map := id_map)
(pure_bind := pure_bind)
(bind_assoc := bind_bind)
section OfFinset
def ofFinset (f : α → ℝ≥0∞) (s : Finset α) (h : ∑ a ∈ s, f a = 1)
(h' : ∀ (a) (_ : a ∉ s), f a = 0) : PMF α :=
⟨f, h ▸ hasSum_sum_of_ne_finset_zero h'⟩
#align pmf.of_finset PMF.ofFinset
variable {f : α → ℝ≥0∞} {s : Finset α} (h : ∑ a ∈ s, f a = 1) (h' : ∀ (a) (_ : a ∉ s), f a = 0)
@[simp]
theorem ofFinset_apply (a : α) : ofFinset f s h h' a = f a := rfl
#align pmf.of_finset_apply PMF.ofFinset_apply
@[simp]
theorem support_ofFinset : (ofFinset f s h h').support = ↑s ∩ Function.support f :=
Set.ext fun a => by simpa [mem_support_iff] using mt (h' a)
#align pmf.support_of_finset PMF.support_ofFinset
| Mathlib/Probability/ProbabilityMassFunction/Constructions.lean | 172 | 173 | theorem mem_support_ofFinset_iff (a : α) : a ∈ (ofFinset f s h h').support ↔ a ∈ s ∧ f a ≠ 0 := by |
simp
| 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]
theorem prehaar_empty (K₀ : PositiveCompacts G) {U : Set G} : prehaar (K₀ : Set G) U ⊥ = 0 := by
rw [prehaar, Compacts.coe_bot, index_empty, Nat.cast_zero, zero_div]
#align measure_theory.measure.haar.prehaar_empty MeasureTheory.Measure.haar.prehaar_empty
#align measure_theory.measure.haar.add_prehaar_empty MeasureTheory.Measure.haar.addPrehaar_empty
@[to_additive]
theorem prehaar_nonneg (K₀ : PositiveCompacts G) {U : Set G} (K : Compacts G) :
0 ≤ prehaar (K₀ : Set G) U K := by apply div_nonneg <;> norm_cast <;> apply zero_le
#align measure_theory.measure.haar.prehaar_nonneg MeasureTheory.Measure.haar.prehaar_nonneg
#align measure_theory.measure.haar.add_prehaar_nonneg MeasureTheory.Measure.haar.addPrehaar_nonneg
@[to_additive "additive version of `MeasureTheory.Measure.haar.haarProduct`"]
def haarProduct (K₀ : Set G) : Set (Compacts G → ℝ) :=
pi univ fun K => Icc 0 <| index (K : Set G) K₀
#align measure_theory.measure.haar.haar_product MeasureTheory.Measure.haar.haarProduct
#align measure_theory.measure.haar.add_haar_product MeasureTheory.Measure.haar.addHaarProduct
@[to_additive (attr := simp)]
theorem mem_prehaar_empty {K₀ : Set G} {f : Compacts G → ℝ} :
f ∈ haarProduct K₀ ↔ ∀ K : Compacts G, f K ∈ Icc (0 : ℝ) (index (K : Set G) K₀) := by
simp only [haarProduct, Set.pi, forall_prop_of_true, mem_univ, mem_setOf_eq]
#align measure_theory.measure.haar.mem_prehaar_empty MeasureTheory.Measure.haar.mem_prehaar_empty
#align measure_theory.measure.haar.mem_add_prehaar_empty MeasureTheory.Measure.haar.mem_addPrehaar_empty
@[to_additive "additive version of `MeasureTheory.Measure.haar.clPrehaar`"]
def clPrehaar (K₀ : Set G) (V : OpenNhdsOf (1 : G)) : Set (Compacts G → ℝ) :=
closure <| prehaar K₀ '' { U : Set G | U ⊆ V.1 ∧ IsOpen U ∧ (1 : G) ∈ U }
#align measure_theory.measure.haar.cl_prehaar MeasureTheory.Measure.haar.clPrehaar
#align measure_theory.measure.haar.cl_add_prehaar MeasureTheory.Measure.haar.clAddPrehaar
variable [TopologicalGroup G]
@[to_additive addIndex_defined
"If `K` is compact and `V` has nonempty interior, then the index `(K : V)` is well-defined, there is
a finite set `t` satisfying the desired properties."]
theorem index_defined {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) :
∃ n : ℕ, n ∈ Finset.card '' { t : Finset G | K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V } := by
rcases compact_covered_by_mul_left_translates hK hV with ⟨t, ht⟩; exact ⟨t.card, t, ht, rfl⟩
#align measure_theory.measure.haar.index_defined MeasureTheory.Measure.haar.index_defined
#align measure_theory.measure.haar.add_index_defined MeasureTheory.Measure.haar.addIndex_defined
@[to_additive addIndex_elim]
| Mathlib/MeasureTheory/Measure/Haar/Basic.lean | 178 | 180 | theorem index_elim {K V : Set G} (hK : IsCompact K) (hV : (interior V).Nonempty) :
∃ t : Finset G, (K ⊆ ⋃ g ∈ t, (fun h => g * h) ⁻¹' V) ∧ Finset.card t = index K V := by |
have := Nat.sInf_mem (index_defined hK hV); rwa [mem_image] at this
| 1 |
import Mathlib.Init.Logic
import Mathlib.Init.Function
import Mathlib.Init.Algebra.Classes
import Batteries.Util.LibraryNote
import Batteries.Tactic.Lint.Basic
#align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
#align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db"
open Function
attribute [local instance 10] Classical.propDecidable
open Function
alias Membership.mem.ne_of_not_mem := ne_of_mem_of_not_mem
alias Membership.mem.ne_of_not_mem' := ne_of_mem_of_not_mem'
#align has_mem.mem.ne_of_not_mem Membership.mem.ne_of_not_mem
#align has_mem.mem.ne_of_not_mem' Membership.mem.ne_of_not_mem'
section Equality
-- todo: change name
theorem forall_cond_comm {α} {s : α → Prop} {p : α → α → Prop} :
(∀ a, s a → ∀ b, s b → p a b) ↔ ∀ a b, s a → s b → p a b :=
⟨fun h a b ha hb ↦ h a ha b hb, fun h a ha b hb ↦ h a b ha hb⟩
#align ball_cond_comm forall_cond_comm
theorem forall_mem_comm {α β} [Membership α β] {s : β} {p : α → α → Prop} :
(∀ a (_ : a ∈ s) b (_ : b ∈ s), p a b) ↔ ∀ a b, a ∈ s → b ∈ s → p a b :=
forall_cond_comm
#align ball_mem_comm forall_mem_comm
@[deprecated (since := "2024-03-23")] alias ball_cond_comm := forall_cond_comm
@[deprecated (since := "2024-03-23")] alias ball_mem_comm := forall_mem_comm
#align ne_of_apply_ne ne_of_apply_ne
lemma ne_of_eq_of_ne {α : Sort*} {a b c : α} (h₁ : a = b) (h₂ : b ≠ c) : a ≠ c := h₁.symm ▸ h₂
lemma ne_of_ne_of_eq {α : Sort*} {a b c : α} (h₁ : a ≠ b) (h₂ : b = c) : a ≠ c := h₂ ▸ h₁
alias Eq.trans_ne := ne_of_eq_of_ne
alias Ne.trans_eq := ne_of_ne_of_eq
#align eq.trans_ne Eq.trans_ne
#align ne.trans_eq Ne.trans_eq
theorem eq_equivalence {α : Sort*} : Equivalence (@Eq α) :=
⟨Eq.refl, @Eq.symm _, @Eq.trans _⟩
#align eq_equivalence eq_equivalence
-- These were migrated to Batteries but the `@[simp]` attributes were (mysteriously?) removed.
attribute [simp] eq_mp_eq_cast eq_mpr_eq_cast
#align eq_mp_eq_cast eq_mp_eq_cast
#align eq_mpr_eq_cast eq_mpr_eq_cast
#align cast_cast cast_cast
-- @[simp] -- FIXME simp ignores proof rewrites
theorem congr_refl_left {α β : Sort*} (f : α → β) {a b : α} (h : a = b) :
congr (Eq.refl f) h = congr_arg f h := rfl
#align congr_refl_left congr_refl_left
-- @[simp] -- FIXME simp ignores proof rewrites
theorem congr_refl_right {α β : Sort*} {f g : α → β} (h : f = g) (a : α) :
congr h (Eq.refl a) = congr_fun h a := rfl
#align congr_refl_right congr_refl_right
-- @[simp] -- FIXME simp ignores proof rewrites
theorem congr_arg_refl {α β : Sort*} (f : α → β) (a : α) :
congr_arg f (Eq.refl a) = Eq.refl (f a) :=
rfl
#align congr_arg_refl congr_arg_refl
-- @[simp] -- FIXME simp ignores proof rewrites
theorem congr_fun_rfl {α β : Sort*} (f : α → β) (a : α) : congr_fun (Eq.refl f) a = Eq.refl (f a) :=
rfl
#align congr_fun_rfl congr_fun_rfl
-- @[simp] -- FIXME simp ignores proof rewrites
theorem congr_fun_congr_arg {α β γ : Sort*} (f : α → β → γ) {a a' : α} (p : a = a') (b : β) :
congr_fun (congr_arg f p) b = congr_arg (fun a ↦ f a b) p := rfl
#align congr_fun_congr_arg congr_fun_congr_arg
#align heq_of_cast_eq heq_of_cast_eq
#align cast_eq_iff_heq cast_eq_iff_heq
theorem Eq.rec_eq_cast {α : Sort _} {P : α → Sort _} {x y : α} (h : x = y) (z : P x) :
h ▸ z = cast (congr_arg P h) z := by induction h; rfl
-- Porting note (#10756): new theorem. More general version of `eqRec_heq`
theorem eqRec_heq' {α : Sort*} {a' : α} {motive : (a : α) → a' = a → Sort*}
(p : motive a' (rfl : a' = a')) {a : α} (t : a' = a) :
HEq (@Eq.rec α a' motive p a t) p := by
subst t; rfl
set_option autoImplicit true in
theorem rec_heq_of_heq {C : α → Sort*} {x : C a} {y : β} (e : a = b) (h : HEq x y) :
HEq (e ▸ x) y := by subst e; exact h
#align rec_heq_of_heq rec_heq_of_heq
set_option autoImplicit true in
theorem rec_heq_iff_heq {C : α → Sort*} {x : C a} {y : β} {e : a = b} :
HEq (e ▸ x) y ↔ HEq x y := by subst e; rfl
#align rec_heq_iff_heq rec_heq_iff_heq
set_option autoImplicit true in
| Mathlib/Logic/Basic.lean | 611 | 612 | theorem heq_rec_iff_heq {C : α → Sort*} {x : β} {y : C a} {e : a = b} :
HEq x (e ▸ y) ↔ HEq x y := by | subst e; rfl
| 1 |
import Mathlib.Algebra.Quaternion
import Mathlib.Tactic.Ring
#align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d"
open Quaternion
namespace QuaternionAlgebra
structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ c₂ : R) where
(i j k : A)
i_mul_i : i * i = c₁ • (1 : A)
j_mul_j : j * j = c₂ • (1 : A)
i_mul_j : i * j = k
j_mul_i : j * i = -k
#align quaternion_algebra.basis QuaternionAlgebra.Basis
variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B]
variable {c₁ c₂ : R}
namespace Basis
@[ext]
protected theorem ext ⦃q₁ q₂ : Basis A c₁ c₂⦄ (hi : q₁.i = q₂.i) (hj : q₁.j = q₂.j) : q₁ = q₂ := by
cases q₁; rename_i q₁_i_mul_j _
cases q₂; rename_i q₂_i_mul_j _
congr
rw [← q₁_i_mul_j, ← q₂_i_mul_j]
congr
#align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext
variable (R)
@[simps i j k]
protected def self : Basis ℍ[R,c₁,c₂] c₁ c₂ where
i := ⟨0, 1, 0, 0⟩
i_mul_i := by ext <;> simp
j := ⟨0, 0, 1, 0⟩
j_mul_j := by ext <;> simp
k := ⟨0, 0, 0, 1⟩
i_mul_j := by ext <;> simp
j_mul_i := by ext <;> simp
#align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self
variable {R}
instance : Inhabited (Basis ℍ[R,c₁,c₂] c₁ c₂) :=
⟨Basis.self R⟩
variable (q : Basis A c₁ c₂)
attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i
@[simp]
theorem i_mul_k : q.i * q.k = c₁ • q.j := by
rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul]
#align quaternion_algebra.basis.i_mul_k QuaternionAlgebra.Basis.i_mul_k
@[simp]
| Mathlib/Algebra/QuaternionBasis.lean | 89 | 90 | theorem k_mul_i : q.k * q.i = -c₁ • q.j := by |
rw [← i_mul_j, mul_assoc, j_mul_i, mul_neg, i_mul_k, neg_smul]
| 1 |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 225 | 225 | theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by | simp [toList]
| 1 |
import Mathlib.Data.Vector.Basic
import Mathlib.Data.Vector.Snoc
set_option autoImplicit true
namespace Vector
section Fold
section Binary
variable (xs : Vector α n) (ys : Vector β n)
@[simp]
theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) :
(mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁)
= let m := (mapAccumr₂ (fun x y s =>
let r₂ := f₂ x s.snd
let r₁ := f₁ r₂.snd y s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs ys (s₁, s₂))
(m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
@[simp]
| Mathlib/Data/Vector/MapLemmas.lean | 71 | 73 | theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) :
map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by |
induction xs, ys using Vector.revInductionOn₂ <;> simp_all
| 1 |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : ℕ)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [← Nat.card_Ioc, ← map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [← card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 136 | 137 | theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by |
rw [← card_Ico, Fintype.card_ofFinset]
| 1 |
import Mathlib.Data.ENNReal.Inv
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
section iInf
variable {ι : Sort*} {f g : ι → ℝ≥0∞}
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by
cases isEmpty_or_nonempty ι
· rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty]
· lift f to ι → ℝ≥0 using hf
simp_rw [← coe_iInf, toNNReal_coe]
#align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf
theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf)
#align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf
theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by
lift f to ι → ℝ≥0 using hf
simp_rw [toNNReal_coe]
by_cases h : BddAbove (range f)
· rw [← coe_iSup h, toNNReal_coe]
· rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal]
#align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup
theorem toNNReal_sSup (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf)
#align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup
theorem toReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toReal = ⨅ i, (f i).toReal := by
simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf]
#align ennreal.to_real_infi ENNReal.toReal_iInf
| Mathlib/Data/ENNReal/Real.lean | 576 | 578 | theorem toReal_sInf (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toReal = sInf (ENNReal.toReal '' s) := by |
simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image]
| 1 |
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Init.Order.Defs
set_option autoImplicit true
structure UFModel (n) where
parent : Fin n → Fin n
rank : Nat → Nat
rank_lt : ∀ i, (parent i).1 ≠ i → rank i < rank (parent i)
structure UFNode (α : Type*) where
parent : Nat
value : α
rank : Nat
inductive UFModel.Agrees (arr : Array α) (f : α → β) : ∀ {n}, (Fin n → β) → Prop
| mk : Agrees arr f fun i ↦ f (arr.get i)
namespace UFModel.Agrees
theorem mk' {arr : Array α} {f : α → β} {n} {g : Fin n → β} (e : n = arr.size)
(H : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = g ⟨i, h₂⟩) : Agrees arr f g := by
cases e
have : (fun i ↦ f (arr.get i)) = g := by funext ⟨i, h⟩; apply H
cases this; constructor
| Mathlib/Data/UnionFind.lean | 79 | 80 | theorem size_eq {arr : Array α} {m : Fin n → β} (H : Agrees arr f m) : n = arr.size := by |
cases H; rfl
| 1 |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n α : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing α]
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α)
(D : Matrix l n α) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * ⅟ A) 1 * fromBlocks A 0 0 (D - C * ⅟ A * B) *
fromBlocks 1 (⅟ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁
theorem fromBlocks_eq_of_invertible₂₂ (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * ⅟ D) 0 1 * fromBlocks (A - B * ⅟ D * C) 0 0 D *
fromBlocks 1 0 (⅟ D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ←
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A
#align matrix.from_blocks_eq_of_invertible₂₂ Matrix.fromBlocks_eq_of_invertible₂₂
section Det
theorem det_fromBlocks₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible A] :
(Matrix.fromBlocks A B C D).det = det A * det (D - C * ⅟ A * B) := by
rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁,
det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one]
#align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁
@[simp]
theorem det_fromBlocks_one₁₁ (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) :
(Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by
haveI : Invertible (1 : Matrix m m α) := invertibleOne
rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁
theorem det_fromBlocks₂₂ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
(Matrix.fromBlocks A B C D).det = det D * det (A - B * ⅟ D * C) := by
have : fromBlocks A B C D =
(fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by
ext (i j)
cases i <;> cases j <;> rfl
rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁]
#align matrix.det_from_blocks₂₂ Matrix.det_fromBlocks₂₂
@[simp]
theorem det_fromBlocks_one₂₂ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) :
(Matrix.fromBlocks A B C 1).det = det (A - B * C) := by
haveI : Invertible (1 : Matrix n n α) := invertibleOne
rw [det_fromBlocks₂₂, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_one₂₂ Matrix.det_fromBlocks_one₂₂
theorem det_one_add_mul_comm (A : Matrix m n α) (B : Matrix n m α) :
det (1 + A * B) = det (1 + B * A) :=
calc
det (1 + A * B) = det (fromBlocks 1 (-A) B 1) := by
rw [det_fromBlocks_one₂₂, Matrix.neg_mul, sub_neg_eq_add]
_ = det (1 + B * A) := by rw [det_fromBlocks_one₁₁, Matrix.mul_neg, sub_neg_eq_add]
#align matrix.det_one_add_mul_comm Matrix.det_one_add_mul_comm
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 434 | 435 | theorem det_mul_add_one_comm (A : Matrix m n α) (B : Matrix n m α) :
det (A * B + 1) = det (B * A + 1) := by | rw [add_comm, det_one_add_mul_comm, add_comm]
| 1 |
import Mathlib.Computability.DFA
import Mathlib.Data.Fintype.Powerset
#align_import computability.NFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
open Set
open Computability
universe u v
-- Porting note: Required as `NFA` is used in mathlib3
set_option linter.uppercaseLean3 false
structure NFA (α : Type u) (σ : Type v) where
step : σ → α → Set σ
start : Set σ
accept : Set σ
#align NFA NFA
variable {α : Type u} {σ σ' : Type v} (M : NFA α σ)
namespace NFA
instance : Inhabited (NFA α σ) :=
⟨NFA.mk (fun _ _ => ∅) ∅ ∅⟩
def stepSet (S : Set σ) (a : α) : Set σ :=
⋃ s ∈ S, M.step s a
#align NFA.step_set NFA.stepSet
theorem mem_stepSet (s : σ) (S : Set σ) (a : α) : s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a := by
simp [stepSet]
#align NFA.mem_step_set NFA.mem_stepSet
@[simp]
theorem stepSet_empty (a : α) : M.stepSet ∅ a = ∅ := by simp [stepSet]
#align NFA.step_set_empty NFA.stepSet_empty
def evalFrom (start : Set σ) : List α → Set σ :=
List.foldl M.stepSet start
#align NFA.eval_from NFA.evalFrom
@[simp]
theorem evalFrom_nil (S : Set σ) : M.evalFrom S [] = S :=
rfl
#align NFA.eval_from_nil NFA.evalFrom_nil
@[simp]
theorem evalFrom_singleton (S : Set σ) (a : α) : M.evalFrom S [a] = M.stepSet S a :=
rfl
#align NFA.eval_from_singleton NFA.evalFrom_singleton
@[simp]
theorem evalFrom_append_singleton (S : Set σ) (x : List α) (a : α) :
M.evalFrom S (x ++ [a]) = M.stepSet (M.evalFrom S x) a := by
simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
#align NFA.eval_from_append_singleton NFA.evalFrom_append_singleton
def eval : List α → Set σ :=
M.evalFrom M.start
#align NFA.eval NFA.eval
@[simp]
theorem eval_nil : M.eval [] = M.start :=
rfl
#align NFA.eval_nil NFA.eval_nil
@[simp]
theorem eval_singleton (a : α) : M.eval [a] = M.stepSet M.start a :=
rfl
#align NFA.eval_singleton NFA.eval_singleton
@[simp]
theorem eval_append_singleton (x : List α) (a : α) : M.eval (x ++ [a]) = M.stepSet (M.eval x) a :=
evalFrom_append_singleton _ _ _ _
#align NFA.eval_append_singleton NFA.eval_append_singleton
def accepts : Language α := {x | ∃ S ∈ M.accept, S ∈ M.eval x}
#align NFA.accepts NFA.accepts
| Mathlib/Computability/NFA.lean | 108 | 109 | theorem mem_accepts {x : List α} : x ∈ M.accepts ↔ ∃ S ∈ M.accept, S ∈ M.evalFrom M.start x := by |
rfl
| 1 |
import Mathlib.Algebra.Order.Ring.Nat
#align_import data.nat.dist from "leanprover-community/mathlib"@"d50b12ae8e2bd910d08a94823976adae9825718b"
namespace Nat
def dist (n m : ℕ) :=
n - m + (m - n)
#align nat.dist Nat.dist
-- Should be aligned to `Nat.dist.eq_def`, but that is generated on demand and isn't present yet.
#noalign nat.dist.def
theorem dist_comm (n m : ℕ) : dist n m = dist m n := by simp [dist, add_comm]
#align nat.dist_comm Nat.dist_comm
@[simp]
theorem dist_self (n : ℕ) : dist n n = 0 := by simp [dist, tsub_self]
#align nat.dist_self Nat.dist_self
theorem eq_of_dist_eq_zero {n m : ℕ} (h : dist n m = 0) : n = m :=
have : n - m = 0 := Nat.eq_zero_of_add_eq_zero_right h
have : n ≤ m := tsub_eq_zero_iff_le.mp this
have : m - n = 0 := Nat.eq_zero_of_add_eq_zero_left h
have : m ≤ n := tsub_eq_zero_iff_le.mp this
le_antisymm ‹n ≤ m› ‹m ≤ n›
#align nat.eq_of_dist_eq_zero Nat.eq_of_dist_eq_zero
| Mathlib/Data/Nat/Dist.lean | 42 | 42 | theorem dist_eq_zero {n m : ℕ} (h : n = m) : dist n m = 0 := by | rw [h, dist_self]
| 1 |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Dual
import Mathlib.Data.Fin.FlagRange
open Set Submodule
namespace Basis
section Semiring
variable {R M : Type*} [Semiring R] [AddCommMonoid M] [Module R M] {n : ℕ}
def flag (b : Basis (Fin n) R M) (k : Fin (n + 1)) : Submodule R M :=
.span R <| b '' {i | i.castSucc < k}
@[simp]
| Mathlib/LinearAlgebra/Basis/Flag.lean | 32 | 32 | theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥ := by | simp [flag]
| 1 |
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
import Qq
#align_import analysis.special_functions.pow.real from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real ComplexConjugate
open Finset Set
namespace Real
variable {x y z : ℝ}
noncomputable def rpow (x y : ℝ) :=
((x : ℂ) ^ (y : ℂ)).re
#align real.rpow Real.rpow
noncomputable instance : Pow ℝ ℝ := ⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x y : ℝ) : rpow x y = x ^ y := rfl
#align real.rpow_eq_pow Real.rpow_eq_pow
theorem rpow_def (x y : ℝ) : x ^ y = ((x : ℂ) ^ (y : ℂ)).re := rfl
#align real.rpow_def Real.rpow_def
theorem rpow_def_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) :
x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) := by
simp only [rpow_def, Complex.cpow_def]; split_ifs <;>
simp_all [(Complex.ofReal_log hx).symm, -Complex.ofReal_mul, -RCLike.ofReal_mul,
(Complex.ofReal_mul _ _).symm, Complex.exp_ofReal_re, Complex.ofReal_eq_zero]
#align real.rpow_def_of_nonneg Real.rpow_def_of_nonneg
| Mathlib/Analysis/SpecialFunctions/Pow/Real.lean | 56 | 57 | theorem rpow_def_of_pos {x : ℝ} (hx : 0 < x) (y : ℝ) : x ^ y = exp (log x * y) := by |
rw [rpow_def_of_nonneg (le_of_lt hx), if_neg (ne_of_gt hx)]
| 1 |
import Mathlib.Analysis.BoxIntegral.Partition.Split
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.box_integral.partition.additive from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open scoped Classical
open Function Set
namespace BoxIntegral
variable {ι M : Type*} {n : ℕ}
structure BoxAdditiveMap (ι M : Type*) [AddCommMonoid M] (I : WithTop (Box ι)) where
toFun : Box ι → M
sum_partition_boxes' : ∀ J : Box ι, ↑J ≤ I → ∀ π : Prepartition J, π.IsPartition →
∑ Ji ∈ π.boxes, toFun Ji = toFun J
#align box_integral.box_additive_map BoxIntegral.BoxAdditiveMap
scoped notation:25 ι " →ᵇᵃ " M => BoxIntegral.BoxAdditiveMap ι M ⊤
@[inherit_doc] scoped notation:25 ι " →ᵇᵃ[" I "] " M => BoxIntegral.BoxAdditiveMap ι M I
namespace BoxAdditiveMap
open Box Prepartition Finset
variable {N : Type*} [AddCommMonoid M] [AddCommMonoid N] {I₀ : WithTop (Box ι)} {I J : Box ι}
{i : ι}
instance : FunLike (ι →ᵇᵃ[I₀] M) (Box ι) M where
coe := toFun
coe_injective' f g h := by cases f; cases g; congr
initialize_simps_projections BoxIntegral.BoxAdditiveMap (toFun → apply)
#noalign box_integral.box_additive_map.to_fun_eq_coe
@[simp]
theorem coe_mk (f h) : ⇑(mk f h : ι →ᵇᵃ[I₀] M) = f := rfl
#align box_integral.box_additive_map.coe_mk BoxIntegral.BoxAdditiveMap.coe_mk
theorem coe_injective : Injective fun (f : ι →ᵇᵃ[I₀] M) x => f x :=
DFunLike.coe_injective
#align box_integral.box_additive_map.coe_injective BoxIntegral.BoxAdditiveMap.coe_injective
-- Porting note (#10618): was @[simp], now can be proved by `simp`
theorem coe_inj {f g : ι →ᵇᵃ[I₀] M} : (f : Box ι → M) = g ↔ f = g := DFunLike.coe_fn_eq
#align box_integral.box_additive_map.coe_inj BoxIntegral.BoxAdditiveMap.coe_inj
theorem sum_partition_boxes (f : ι →ᵇᵃ[I₀] M) (hI : ↑I ≤ I₀) {π : Prepartition I}
(h : π.IsPartition) : ∑ J ∈ π.boxes, f J = f I :=
f.sum_partition_boxes' I hI π h
#align box_integral.box_additive_map.sum_partition_boxes BoxIntegral.BoxAdditiveMap.sum_partition_boxes
@[simps (config := .asFn)]
instance : Zero (ι →ᵇᵃ[I₀] M) :=
⟨⟨0, fun _ _ _ _ => sum_const_zero⟩⟩
instance : Inhabited (ι →ᵇᵃ[I₀] M) :=
⟨0⟩
instance : Add (ι →ᵇᵃ[I₀] M) :=
⟨fun f g =>
⟨f + g, fun I hI π hπ => by
simp only [Pi.add_apply, sum_add_distrib, sum_partition_boxes _ hI hπ]⟩⟩
instance {R} [Monoid R] [DistribMulAction R M] : SMul R (ι →ᵇᵃ[I₀] M) :=
⟨fun r f =>
⟨r • (f : Box ι → M), fun I hI π hπ => by
simp only [Pi.smul_apply, ← smul_sum, sum_partition_boxes _ hI hπ]⟩⟩
instance : AddCommMonoid (ι →ᵇᵃ[I₀] M) :=
Function.Injective.addCommMonoid _ coe_injective rfl (fun _ _ => rfl) fun _ _ => rfl
@[simp]
| Mathlib/Analysis/BoxIntegral/Partition/Additive.lean | 113 | 115 | theorem map_split_add (f : ι →ᵇᵃ[I₀] M) (hI : ↑I ≤ I₀) (i : ι) (x : ℝ) :
(I.splitLower i x).elim' 0 f + (I.splitUpper i x).elim' 0 f = f I := by |
rw [← f.sum_partition_boxes hI (isPartitionSplit I i x), sum_split_boxes]
| 1 |
import Mathlib.Algebra.Algebra.Prod
import Mathlib.Algebra.Algebra.Subalgebra.Basic
#align_import algebra.algebra.subalgebra.basic from "leanprover-community/mathlib"@"b915e9392ecb2a861e1e766f0e1df6ac481188ca"
namespace Subalgebra
open Algebra
variable {R A B : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
variable (S : Subalgebra R A) (S₁ : Subalgebra R B)
def prod : Subalgebra R (A × B) :=
{ S.toSubsemiring.prod S₁.toSubsemiring with
carrier := S ×ˢ S₁
algebraMap_mem' := fun _ => ⟨algebraMap_mem _ _, algebraMap_mem _ _⟩ }
#align subalgebra.prod Subalgebra.prod
@[simp]
theorem coe_prod : (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ (S₁ : Set B) :=
rfl
#align subalgebra.coe_prod Subalgebra.coe_prod
open Subalgebra in
theorem prod_toSubmodule : toSubmodule (S.prod S₁) = (toSubmodule S).prod (toSubmodule S₁) := rfl
#align subalgebra.prod_to_submodule Subalgebra.prod_toSubmodule
@[simp]
theorem mem_prod {S : Subalgebra R A} {S₁ : Subalgebra R B} {x : A × B} :
x ∈ prod S S₁ ↔ x.1 ∈ S ∧ x.2 ∈ S₁ := Set.mem_prod
#align subalgebra.mem_prod Subalgebra.mem_prod
@[simp]
| Mathlib/Algebra/Algebra/Subalgebra/Prod.lean | 51 | 51 | theorem prod_top : (prod ⊤ ⊤ : Subalgebra R (A × B)) = ⊤ := by | ext; simp
| 1 |
import Mathlib.GroupTheory.CoprodI
import Mathlib.GroupTheory.Coprod.Basic
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.GroupTheory.Complement
namespace Monoid
open CoprodI Subgroup Coprod Function List
variable {ι : Type*} {G : ι → Type*} {H : Type*} {K : Type*} [Monoid K]
def PushoutI.con [∀ i, Monoid (G i)] [Monoid H] (φ : ∀ i, H →* G i) :
Con (Coprod (CoprodI G) H) :=
conGen (fun x y : Coprod (CoprodI G) H =>
∃ i x', x = inl (of (φ i x')) ∧ y = inr x')
def PushoutI [∀ i, Monoid (G i)] [Monoid H] (φ : ∀ i, H →* G i) : Type _ :=
(PushoutI.con φ).Quotient
namespace PushoutI
section Monoid
variable [∀ i, Monoid (G i)] [Monoid H] {φ : ∀ i, H →* G i}
protected instance mul : Mul (PushoutI φ) := by
delta PushoutI; infer_instance
protected instance one : One (PushoutI φ) := by
delta PushoutI; infer_instance
instance monoid : Monoid (PushoutI φ) :=
{ Con.monoid _ with
toMul := PushoutI.mul
toOne := PushoutI.one }
def of (i : ι) : G i →* PushoutI φ :=
(Con.mk' _).comp <| inl.comp CoprodI.of
variable (φ) in
def base : H →* PushoutI φ :=
(Con.mk' _).comp inr
theorem of_comp_eq_base (i : ι) : (of i).comp (φ i) = (base φ) := by
ext x
apply (Con.eq _).2
refine ConGen.Rel.of _ _ ?_
simp only [MonoidHom.comp_apply, Set.mem_iUnion, Set.mem_range]
exact ⟨_, _, rfl, rfl⟩
variable (φ) in
| Mathlib/GroupTheory/PushoutI.lean | 96 | 97 | theorem of_apply_eq_base (i : ι) (x : H) : of i (φ i x) = base φ x := by |
rw [← MonoidHom.comp_apply, of_comp_eq_base]
| 1 |
import Mathlib.Data.List.Chain
import Mathlib.Data.List.Enum
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Pairwise
import Mathlib.Data.List.Zip
#align_import data.list.range from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
set_option autoImplicit true
universe u
open Nat
namespace List
variable {α : Type u}
@[simp] theorem range'_one {step} : range' s 1 step = [s] := rfl
#align list.length_range' List.length_range'
#align list.range'_eq_nil List.range'_eq_nil
#align list.mem_range' List.mem_range'_1
#align list.map_add_range' List.map_add_range'
#align list.map_sub_range' List.map_sub_range'
#align list.chain_succ_range' List.chain_succ_range'
#align list.chain_lt_range' List.chain_lt_range'
theorem pairwise_lt_range' : ∀ s n (step := 1) (_ : 0 < step := by simp),
Pairwise (· < ·) (range' s n step)
| _, 0, _, _ => Pairwise.nil
| s, n + 1, _, h => chain_iff_pairwise.1 (chain_lt_range' s n h)
#align list.pairwise_lt_range' List.pairwise_lt_range'
theorem nodup_range' (s n : ℕ) (step := 1) (h : 0 < step := by simp) : Nodup (range' s n step) :=
(pairwise_lt_range' s n step h).imp _root_.ne_of_lt
#align list.nodup_range' List.nodup_range'
#align list.range'_append List.range'_append
#align list.range'_sublist_right List.range'_sublist_right
#align list.range'_subset_right List.range'_subset_right
#align list.nth_range' List.get?_range'
set_option linter.deprecated false in
@[simp]
theorem nthLe_range' {n m step} (i) (H : i < (range' n m step).length) :
nthLe (range' n m step) i H = n + step * i := get_range' i H
set_option linter.deprecated false in
| Mathlib/Data/List/Range.lean | 66 | 67 | theorem nthLe_range'_1 {n m} (i) (H : i < (range' n m).length) :
nthLe (range' n m) i H = n + i := by | simp
| 1 |
import Mathlib.Data.List.Nodup
#align_import data.prod.tprod from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
open List Function
universe u v
variable {ι : Type u} {α : ι → Type v} {i j : ι} {l : List ι} {f : ∀ i, α i}
namespace List
variable (α)
abbrev TProd (l : List ι) : Type v :=
l.foldr (fun i β => α i × β) PUnit
#align list.tprod List.TProd
variable {α}
namespace TProd
open List
protected def mk : ∀ (l : List ι) (_f : ∀ i, α i), TProd α l
| [] => fun _ => PUnit.unit
| i :: is => fun f => (f i, TProd.mk is f)
#align list.tprod.mk List.TProd.mk
instance [∀ i, Inhabited (α i)] : Inhabited (TProd α l) :=
⟨TProd.mk l default⟩
@[simp]
theorem fst_mk (i : ι) (l : List ι) (f : ∀ i, α i) : (TProd.mk (i :: l) f).1 = f i :=
rfl
#align list.tprod.fst_mk List.TProd.fst_mk
@[simp]
theorem snd_mk (i : ι) (l : List ι) (f : ∀ i, α i) :
(TProd.mk.{u,v} (i :: l) f).2 = TProd.mk.{u,v} l f :=
rfl
#align list.tprod.snd_mk List.TProd.snd_mk
variable [DecidableEq ι]
protected def elim : ∀ {l : List ι} (_ : TProd α l) {i : ι} (_ : i ∈ l), α i
| i :: is, v, j, hj =>
if hji : j = i then by
subst hji
exact v.1
else TProd.elim v.2 ((List.mem_cons.mp hj).resolve_left hji)
#align list.tprod.elim List.TProd.elim
@[simp]
theorem elim_self (v : TProd α (i :: l)) : v.elim (l.mem_cons_self i) = v.1 := by simp [TProd.elim]
#align list.tprod.elim_self List.TProd.elim_self
@[simp]
| Mathlib/Data/Prod/TProd.lean | 94 | 95 | theorem elim_of_ne (hj : j ∈ i :: l) (hji : j ≠ i) (v : TProd α (i :: l)) :
v.elim hj = TProd.elim v.2 ((List.mem_cons.mp hj).resolve_left hji) := by | simp [TProd.elim, hji]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
noncomputable section
open scoped Classical Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
namespace ContinuousLinearMap
variable {B : E →L[𝕜] F →L[𝕜] G} {u : 𝕜 → E} {v : 𝕜 → F} {u' : E} {v' : F}
theorem hasDerivWithinAt_of_bilinear
(hu : HasDerivWithinAt u u' s x) (hv : HasDerivWithinAt v v' s x) :
HasDerivWithinAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) s x := by
simpa using (B.hasFDerivWithinAt_of_bilinear
hu.hasFDerivWithinAt hv.hasFDerivWithinAt).hasDerivWithinAt
| Mathlib/Analysis/Calculus/Deriv/Mul.lean | 58 | 60 | theorem hasDerivAt_of_bilinear (hu : HasDerivAt u u' x) (hv : HasDerivAt v v' x) :
HasDerivAt (fun x ↦ B (u x) (v x)) (B (u x) v' + B u' (v x)) x := by |
simpa using (B.hasFDerivAt_of_bilinear hu.hasFDerivAt hv.hasFDerivAt).hasDerivAt
| 1 |
import Mathlib.SetTheory.Ordinal.Arithmetic
import Mathlib.SetTheory.Ordinal.Exponential
#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
noncomputable section
universe u
open List
namespace Ordinal
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o := fun o ↦ by
by_cases h : o = 0
· rw [h]; exact H0
· exact H o h (CNFRec _ H0 H (o % b ^ log b o))
termination_by o => o
decreasing_by exact mod_opow_log_lt_self b h
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec Ordinal.CNFRec
@[simp]
theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by
rw [CNFRec, dif_pos rfl]
rfl
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) :
@CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by rw [CNFRec, dif_neg ho]
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_pos Ordinal.CNFRec_pos
-- Porting note: unknown attribute @[pp_nodot]
def CNF (b o : Ordinal) : List (Ordinal × Ordinal) :=
CNFRec b [] (fun o _ho IH ↦ (log b o, o / b ^ log b o)::IH) o
set_option linter.uppercaseLean3 false in
#align ordinal.CNF Ordinal.CNF
@[simp]
theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
CNFRec_zero b _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_zero Ordinal.CNF_zero
theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) :
CNF b o = (log b o, o / b ^ log b o)::CNF b (o % b ^ log b o) :=
CNFRec_pos b ho _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero
| Mathlib/SetTheory/Ordinal/CantorNormalForm.lean | 93 | 93 | theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by | simp [CNF_ne_zero ho]
| 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
| Mathlib/MeasureTheory/Function/L1Space.lean | 66 | 67 | theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) :
∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by | simp only [edist_eq_coe_nnnorm]
| 1 |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Commute.Defs
import Mathlib.Algebra.Ring.Defs
import Mathlib.Data.Subtype
import Mathlib.Order.Notation
#align_import algebra.ring.idempotents from "leanprover-community/mathlib"@"655994e298904d7e5bbd1e18c95defd7b543eb94"
variable {M N S M₀ M₁ R G G₀ : Type*}
variable [Mul M] [Monoid N] [Semigroup S] [MulZeroClass M₀] [MulOneClass M₁] [NonAssocRing R]
[Group G] [CancelMonoidWithZero G₀]
def IsIdempotentElem (p : M) : Prop :=
p * p = p
#align is_idempotent_elem IsIdempotentElem
namespace IsIdempotentElem
theorem of_isIdempotent [Std.IdempotentOp (α := M) (· * ·)] (a : M) : IsIdempotentElem a :=
Std.IdempotentOp.idempotent a
#align is_idempotent_elem.of_is_idempotent IsIdempotentElem.of_isIdempotent
theorem eq {p : M} (h : IsIdempotentElem p) : p * p = p :=
h
#align is_idempotent_elem.eq IsIdempotentElem.eq
theorem mul_of_commute {p q : S} (h : Commute p q) (h₁ : IsIdempotentElem p)
(h₂ : IsIdempotentElem q) : IsIdempotentElem (p * q) := by
rw [IsIdempotentElem, mul_assoc, ← mul_assoc q, ← h.eq, mul_assoc p, h₂.eq, ← mul_assoc, h₁.eq]
#align is_idempotent_elem.mul_of_commute IsIdempotentElem.mul_of_commute
theorem zero : IsIdempotentElem (0 : M₀) :=
mul_zero _
#align is_idempotent_elem.zero IsIdempotentElem.zero
theorem one : IsIdempotentElem (1 : M₁) :=
mul_one _
#align is_idempotent_elem.one IsIdempotentElem.one
| Mathlib/Algebra/Ring/Idempotents.lean | 66 | 67 | theorem one_sub {p : R} (h : IsIdempotentElem p) : IsIdempotentElem (1 - p) := by |
rw [IsIdempotentElem, mul_sub, mul_one, sub_mul, one_mul, h.eq, sub_self, sub_zero]
| 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]
theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by
rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm]
#align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right
@[simp]
theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by
rw [← sameCycle_apply_left, apply_inv_self]
#align equiv.perm.same_cycle_inv_apply_left Equiv.Perm.sameCycle_inv_apply_left
@[simp]
| Mathlib/GroupTheory/Perm/Cycle/Basic.lean | 142 | 143 | theorem sameCycle_inv_apply_right : SameCycle f x (f⁻¹ y) ↔ SameCycle f x y := by |
rw [← sameCycle_apply_right, apply_inv_self]
| 1 |
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Tactic.GCongr
#align_import order.filter.archimedean from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {α R : Type*}
open Filter Set Function
@[simp]
theorem Nat.comap_cast_atTop [StrictOrderedSemiring R] [Archimedean R] :
comap ((↑) : ℕ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge
#align nat.comap_coe_at_top Nat.comap_cast_atTop
theorem tendsto_natCast_atTop_iff [StrictOrderedSemiring R] [Archimedean R] {f : α → ℕ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop :=
tendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge
#align tendsto_coe_nat_at_top_iff tendsto_natCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_iff := tendsto_natCast_atTop_iff
theorem tendsto_natCast_atTop_atTop [OrderedSemiring R] [Archimedean R] :
Tendsto ((↑) : ℕ → R) atTop atTop :=
Nat.mono_cast.tendsto_atTop_atTop exists_nat_ge
#align tendsto_coe_nat_at_top_at_top tendsto_natCast_atTop_atTop
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_atTop := tendsto_natCast_atTop_atTop
theorem Filter.Eventually.natCast_atTop [OrderedSemiring R] [Archimedean R] {p : R → Prop}
(h : ∀ᶠ (x:R) in atTop, p x) : ∀ᶠ (n:ℕ) in atTop, p n :=
tendsto_natCast_atTop_atTop.eventually h
@[deprecated (since := "2024-04-17")]
alias Filter.Eventually.nat_cast_atTop := Filter.Eventually.natCast_atTop
@[simp] theorem Int.comap_cast_atTop [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge r; ⟨n, mod_cast hn⟩
#align int.comap_coe_at_top Int.comap_cast_atTop
@[simp]
theorem Int.comap_cast_atBot [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atBot = atBot :=
comap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge (-r)
⟨-n, by simpa [neg_le] using hn⟩
#align int.comap_coe_at_bot Int.comap_cast_atBot
theorem tendsto_intCast_atTop_iff [StrictOrderedRing R] [Archimedean R] {f : α → ℤ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop := by
rw [← @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl
#align tendsto_coe_int_at_top_iff tendsto_intCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_int_cast_atTop_iff := tendsto_intCast_atTop_iff
| Mathlib/Order/Filter/Archimedean.lean | 77 | 79 | theorem tendsto_intCast_atBot_iff [StrictOrderedRing R] [Archimedean R] {f : α → ℤ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atBot ↔ Tendsto f l atBot := by |
rw [← @Int.comap_cast_atBot R, tendsto_comap_iff]; rfl
| 1 |
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
import Mathlib.Analysis.InnerProductSpace.ConformalLinearMap
#align_import analysis.calculus.conformal.inner_product from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
variable {E F : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable [InnerProductSpace ℝ E] [InnerProductSpace ℝ F]
open RealInnerProductSpace
| Mathlib/Analysis/Calculus/Conformal/InnerProduct.lean | 29 | 31 | theorem conformalAt_iff' {f : E → F} {x : E} : ConformalAt f x ↔
∃ c : ℝ, 0 < c ∧ ∀ u v : E, ⟪fderiv ℝ f x u, fderiv ℝ f x v⟫ = c * ⟪u, v⟫ := by |
rw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]
| 1 |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : ℕ → Prop)
section Count
variable [DecidablePred p]
def count (n : ℕ) : ℕ :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : ℕ) : Fintype { i // i < n ∧ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : ℕ) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : ℕ) : count p n = Fintype.card { k : ℕ // k < n ∧ p k } := by
rw [count_eq_card_filter_range, ← Fintype.card_ofFinset, ← CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
| Mathlib/Data/Nat/Count.lean | 65 | 66 | theorem count_succ (n : ℕ) : count p (n + 1) = count p n + if p n then 1 else 0 := by |
split_ifs with h <;> simp [count, List.range_succ, h]
| 1 |
import Mathlib.Combinatorics.Quiver.Path
import Mathlib.Combinatorics.Quiver.Push
#align_import combinatorics.quiver.symmetric from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
universe v u w v'
namespace Quiver
-- Porting note: no hasNonemptyInstance linter yet
def Symmetrify (V : Type*) := V
#align quiver.symmetrify Quiver.Symmetrify
instance symmetrifyQuiver (V : Type u) [Quiver V] : Quiver (Symmetrify V) :=
⟨fun a b : V ↦ Sum (a ⟶ b) (b ⟶ a)⟩
variable (U V W : Type*) [Quiver.{u + 1} U] [Quiver.{v + 1} V] [Quiver.{w + 1} W]
class HasReverse where
reverse' : ∀ {a b : V}, (a ⟶ b) → (b ⟶ a)
#align quiver.has_reverse Quiver.HasReverse
def reverse {V} [Quiver.{v + 1} V] [HasReverse V] {a b : V} : (a ⟶ b) → (b ⟶ a) :=
HasReverse.reverse'
#align quiver.reverse Quiver.reverse
class HasInvolutiveReverse extends HasReverse V where
inv' : ∀ {a b : V} (f : a ⟶ b), reverse (reverse f) = f
#align quiver.has_involutive_reverse Quiver.HasInvolutiveReverse
variable {U V W}
@[simp]
| Mathlib/Combinatorics/Quiver/Symmetric.lean | 61 | 62 | theorem reverse_reverse [h : HasInvolutiveReverse V] {a b : V} (f : a ⟶ b) :
reverse (reverse f) = f := by | apply h.inv'
| 1 |
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5"
noncomputable section
open scoped NNReal ENNReal Pointwise Topology
open Inv Set Function MeasureTheory.Measure Filter
open FiniteDimensional
namespace MeasureTheory
namespace Measure
example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by
infer_instance
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E]
[FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
variable {s : Set E}
theorem integral_comp_smul (f : E → F) (R : ℝ) :
∫ x, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
by_cases hF : CompleteSpace F; swap
· simp [integral, hF]
rcases eq_or_ne R 0 with (rfl | hR)
· simp only [zero_smul, integral_const]
rcases Nat.eq_zero_or_pos (finrank ℝ E) with (hE | hE)
· have : Subsingleton E := finrank_zero_iff.1 hE
have : f = fun _ => f 0 := by ext x; rw [Subsingleton.elim x 0]
conv_rhs => rw [this]
simp only [hE, pow_zero, inv_one, abs_one, one_smul, integral_const]
· have : Nontrivial E := finrank_pos_iff.1 hE
simp only [zero_pow hE.ne', measure_univ_of_isAddLeftInvariant, ENNReal.top_toReal, zero_smul,
inv_zero, abs_zero]
· calc
(∫ x, f (R • x) ∂μ) = ∫ y, f y ∂Measure.map (fun x => R • x) μ :=
(integral_map_equiv (Homeomorph.smul (isUnit_iff_ne_zero.2 hR).unit).toMeasurableEquiv
f).symm
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ x, f x ∂μ := by
simp only [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg]
#align measure_theory.measure.integral_comp_smul MeasureTheory.Measure.integral_comp_smul
theorem integral_comp_smul_of_nonneg (f : E → F) (R : ℝ) {hR : 0 ≤ R} :
∫ x, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R, abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR _))]
#align measure_theory.measure.integral_comp_smul_of_nonneg MeasureTheory.Measure.integral_comp_smul_of_nonneg
theorem integral_comp_inv_smul (f : E → F) (R : ℝ) :
∫ x, f (R⁻¹ • x) ∂μ = |R ^ finrank ℝ E| • ∫ x, f x ∂μ := by
rw [integral_comp_smul μ f R⁻¹, inv_pow, inv_inv]
#align measure_theory.measure.integral_comp_inv_smul MeasureTheory.Measure.integral_comp_inv_smul
theorem integral_comp_inv_smul_of_nonneg (f : E → F) {R : ℝ} (hR : 0 ≤ R) :
∫ x, f (R⁻¹ • x) ∂μ = R ^ finrank ℝ E • ∫ x, f x ∂μ := by
rw [integral_comp_inv_smul μ f R, abs_of_nonneg (pow_nonneg hR _)]
#align measure_theory.measure.integral_comp_inv_smul_of_nonneg MeasureTheory.Measure.integral_comp_inv_smul_of_nonneg
theorem setIntegral_comp_smul (f : E → F) {R : ℝ} (s : Set E) (hR : R ≠ 0) :
∫ x in s, f (R • x) ∂μ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by
let e : E ≃ᵐ E := (Homeomorph.smul (Units.mk0 R hR)).toMeasurableEquiv
calc
∫ x in s, f (R • x) ∂μ
= ∫ x in e ⁻¹' (e.symm ⁻¹' s), f (e x) ∂μ := by simp [← preimage_comp]; rfl
_ = ∫ y in e.symm ⁻¹' s, f y ∂map (fun x ↦ R • x) μ := (setIntegral_map_equiv _ _ _).symm
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ y in e.symm ⁻¹' s, f y ∂μ := by
simp [map_addHaar_smul μ hR, integral_smul_measure, ENNReal.toReal_ofReal, abs_nonneg]
_ = |(R ^ finrank ℝ E)⁻¹| • ∫ x in R • s, f x ∂μ := by
congr
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hR]
rfl
@[deprecated (since := "2024-04-17")]
alias set_integral_comp_smul := setIntegral_comp_smul
theorem setIntegral_comp_smul_of_pos (f : E → F) {R : ℝ} (s : Set E) (hR : 0 < R) :
∫ x in s, f (R • x) ∂μ = (R ^ finrank ℝ E)⁻¹ • ∫ x in R • s, f x ∂μ := by
rw [setIntegral_comp_smul μ f s hR.ne', abs_of_nonneg (inv_nonneg.2 (pow_nonneg hR.le _))]
@[deprecated (since := "2024-04-17")]
alias set_integral_comp_smul_of_pos := setIntegral_comp_smul_of_pos
| Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean | 135 | 137 | theorem integral_comp_mul_left (g : ℝ → F) (a : ℝ) :
(∫ x : ℝ, g (a * x)) = |a⁻¹| • ∫ y : ℝ, g y := by |
simp_rw [← smul_eq_mul, Measure.integral_comp_smul, FiniteDimensional.finrank_self, pow_one]
| 1 |
import Mathlib.Analysis.NormedSpace.BoundedLinearMaps
import Mathlib.Topology.FiberBundle.Basic
#align_import topology.vector_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
noncomputable section
open scoped Classical
open Bundle Set
open scoped Topology
variable (R : Type*) {B : Type*} (F : Type*) (E : B → Type*)
section TopologicalVectorSpace
variable {F E}
variable [Semiring R] [TopologicalSpace F] [TopologicalSpace B]
protected class Pretrivialization.IsLinear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)]
[∀ x, Module R (E x)] (e : Pretrivialization F (π F E)) : Prop where
linear : ∀ b ∈ e.baseSet, IsLinearMap R fun x : E b => (e ⟨b, x⟩).2
#align pretrivialization.is_linear Pretrivialization.IsLinear
namespace Pretrivialization
variable (e : Pretrivialization F (π F E)) {x : TotalSpace F E} {b : B} {y : E b}
theorem linear [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
[e.IsLinear R] {b : B} (hb : b ∈ e.baseSet) :
IsLinearMap R fun x : E b => (e ⟨b, x⟩).2 :=
Pretrivialization.IsLinear.linear b hb
#align pretrivialization.linear Pretrivialization.linear
variable [AddCommMonoid F] [Module R F] [∀ x, AddCommMonoid (E x)] [∀ x, Module R (E x)]
@[simps!]
protected def symmₗ (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : F →ₗ[R] E b := by
refine IsLinearMap.mk' (e.symm b) ?_
by_cases hb : b ∈ e.baseSet
· exact (((e.linear R hb).mk' _).inverse (e.symm b) (e.symm_apply_apply_mk hb) fun v ↦
congr_arg Prod.snd <| e.apply_mk_symm hb v).isLinear
· rw [e.coe_symm_of_not_mem hb]
exact (0 : F →ₗ[R] E b).isLinear
#align pretrivialization.symmₗ Pretrivialization.symmₗ
@[simps (config := .asFn)]
def linearEquivAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) (hb : b ∈ e.baseSet) :
E b ≃ₗ[R] F where
toFun y := (e ⟨b, y⟩).2
invFun := e.symm b
left_inv := e.symm_apply_apply_mk hb
right_inv v := by simp_rw [e.apply_mk_symm hb v]
map_add' v w := (e.linear R hb).map_add v w
map_smul' c v := (e.linear R hb).map_smul c v
#align pretrivialization.linear_equiv_at Pretrivialization.linearEquivAt
protected def linearMapAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) : E b →ₗ[R] F :=
if hb : b ∈ e.baseSet then e.linearEquivAt R b hb else 0
#align pretrivialization.linear_map_at Pretrivialization.linearMapAt
variable {R}
theorem coe_linearMapAt (e : Pretrivialization F (π F E)) [e.IsLinear R] (b : B) :
⇑(e.linearMapAt R b) = fun y => if b ∈ e.baseSet then (e ⟨b, y⟩).2 else 0 := by
rw [Pretrivialization.linearMapAt]
split_ifs <;> rfl
#align pretrivialization.coe_linear_map_at Pretrivialization.coe_linearMapAt
theorem coe_linearMapAt_of_mem (e : Pretrivialization F (π F E)) [e.IsLinear R] {b : B}
(hb : b ∈ e.baseSet) : ⇑(e.linearMapAt R b) = fun y => (e ⟨b, y⟩).2 := by
simp_rw [coe_linearMapAt, if_pos hb]
#align pretrivialization.coe_linear_map_at_of_mem Pretrivialization.coe_linearMapAt_of_mem
| Mathlib/Topology/VectorBundle/Basic.lean | 131 | 133 | theorem linearMapAt_apply (e : Pretrivialization F (π F E)) [e.IsLinear R] {b : B} (y : E b) :
e.linearMapAt R b y = if b ∈ e.baseSet then (e ⟨b, y⟩).2 else 0 := by |
rw [coe_linearMapAt]
| 1 |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionMonoid
variable [DivisionMonoid K] [HasDistribNeg K] {a b : K}
theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 :=
have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul]
Eq.symm (eq_one_div_of_mul_eq_one_right this)
#align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) :=
calc
1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul]
_ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev]
_ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one]
_ = -(1 / a) := by rw [mul_neg, mul_one]
#align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div
theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) :=
calc
b / -a = b * (1 / -a) := by rw [← inv_eq_one_div, division_def]
_ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div]
_ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg]
_ = -(b / a) := by rw [mul_one_div]
#align div_neg_eq_neg_div div_neg_eq_neg_div
theorem neg_div (a b : K) : -b / a = -(b / a) := by
rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul]
#align neg_div neg_div
@[field_simps]
| Mathlib/Algebra/Field/Basic.lean | 122 | 122 | theorem neg_div' (a b : K) : -(b / a) = -b / a := by | simp [neg_div]
| 1 |
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.ZornAtoms
#align_import order.filter.ultrafilter from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
universe u v
variable {α : Type u} {β : Type v} {γ : Type*}
open Set Filter Function
open scoped Classical
open Filter
instance : IsAtomic (Filter α) :=
IsAtomic.of_isChain_bounded fun c hc hne hb =>
⟨sInf c, (sInf_neBot_of_directed' hne (show IsChain (· ≥ ·) c from hc.symm).directedOn hb).ne,
fun _ hx => sInf_le hx⟩
structure Ultrafilter (α : Type*) extends Filter α where
protected neBot' : NeBot toFilter
protected le_of_le : ∀ g, Filter.NeBot g → g ≤ toFilter → toFilter ≤ g
#align ultrafilter Ultrafilter
namespace Ultrafilter
variable {f g : Ultrafilter α} {s t : Set α} {p q : α → Prop}
attribute [coe] Ultrafilter.toFilter
instance : CoeTC (Ultrafilter α) (Filter α) :=
⟨Ultrafilter.toFilter⟩
instance : Membership (Set α) (Ultrafilter α) :=
⟨fun s f => s ∈ (f : Filter α)⟩
theorem unique (f : Ultrafilter α) {g : Filter α} (h : g ≤ f) (hne : NeBot g := by infer_instance) :
g = f :=
le_antisymm h <| f.le_of_le g hne h
#align ultrafilter.unique Ultrafilter.unique
instance neBot (f : Ultrafilter α) : NeBot (f : Filter α) :=
f.neBot'
#align ultrafilter.ne_bot Ultrafilter.neBot
protected theorem isAtom (f : Ultrafilter α) : IsAtom (f : Filter α) :=
⟨f.neBot.ne, fun _ hgf => by_contra fun hg => hgf.ne <| f.unique hgf.le ⟨hg⟩⟩
#align ultrafilter.is_atom Ultrafilter.isAtom
@[simp, norm_cast]
theorem mem_coe : s ∈ (f : Filter α) ↔ s ∈ f :=
Iff.rfl
#align ultrafilter.mem_coe Ultrafilter.mem_coe
theorem coe_injective : Injective ((↑) : Ultrafilter α → Filter α)
| ⟨f, h₁, h₂⟩, ⟨g, _, _⟩, _ => by congr
#align ultrafilter.coe_injective Ultrafilter.coe_injective
theorem eq_of_le {f g : Ultrafilter α} (h : (f : Filter α) ≤ g) : f = g :=
coe_injective (g.unique h)
#align ultrafilter.eq_of_le Ultrafilter.eq_of_le
@[simp, norm_cast]
theorem coe_le_coe {f g : Ultrafilter α} : (f : Filter α) ≤ g ↔ f = g :=
⟨fun h => eq_of_le h, fun h => h ▸ le_rfl⟩
#align ultrafilter.coe_le_coe Ultrafilter.coe_le_coe
@[simp, norm_cast]
theorem coe_inj : (f : Filter α) = g ↔ f = g :=
coe_injective.eq_iff
#align ultrafilter.coe_inj Ultrafilter.coe_inj
@[ext]
theorem ext ⦃f g : Ultrafilter α⦄ (h : ∀ s, s ∈ f ↔ s ∈ g) : f = g :=
coe_injective <| Filter.ext h
#align ultrafilter.ext Ultrafilter.ext
theorem le_of_inf_neBot (f : Ultrafilter α) {g : Filter α} (hg : NeBot (↑f ⊓ g)) : ↑f ≤ g :=
le_of_inf_eq (f.unique inf_le_left hg)
#align ultrafilter.le_of_inf_ne_bot Ultrafilter.le_of_inf_neBot
theorem le_of_inf_neBot' (f : Ultrafilter α) {g : Filter α} (hg : NeBot (g ⊓ f)) : ↑f ≤ g :=
f.le_of_inf_neBot <| by rwa [inf_comm]
#align ultrafilter.le_of_inf_ne_bot' Ultrafilter.le_of_inf_neBot'
theorem inf_neBot_iff {f : Ultrafilter α} {g : Filter α} : NeBot (↑f ⊓ g) ↔ ↑f ≤ g :=
⟨le_of_inf_neBot f, fun h => (inf_of_le_left h).symm ▸ f.neBot⟩
#align ultrafilter.inf_ne_bot_iff Ultrafilter.inf_neBot_iff
| Mathlib/Order/Filter/Ultrafilter.lean | 115 | 116 | theorem disjoint_iff_not_le {f : Ultrafilter α} {g : Filter α} : Disjoint (↑f) g ↔ ¬↑f ≤ g := by |
rw [← inf_neBot_iff, neBot_iff, Ne, not_not, disjoint_iff]
| 1 |
import Mathlib.Analysis.Calculus.FDeriv.Basic
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
#align_import analysis.calculus.deriv.basic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
noncomputable section
open scoped Classical Topology Filter ENNReal NNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def HasDerivAtFilter (f : 𝕜 → F) (f' : F) (x : 𝕜) (L : Filter 𝕜) :=
HasFDerivAtFilter f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x L
#align has_deriv_at_filter HasDerivAtFilter
def HasDerivWithinAt (f : 𝕜 → F) (f' : F) (s : Set 𝕜) (x : 𝕜) :=
HasDerivAtFilter f f' x (𝓝[s] x)
#align has_deriv_within_at HasDerivWithinAt
def HasDerivAt (f : 𝕜 → F) (f' : F) (x : 𝕜) :=
HasDerivAtFilter f f' x (𝓝 x)
#align has_deriv_at HasDerivAt
def HasStrictDerivAt (f : 𝕜 → F) (f' : F) (x : 𝕜) :=
HasStrictFDerivAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') x
#align has_strict_deriv_at HasStrictDerivAt
def derivWithin (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) :=
fderivWithin 𝕜 f s x 1
#align deriv_within derivWithin
def deriv (f : 𝕜 → F) (x : 𝕜) :=
fderiv 𝕜 f x 1
#align deriv deriv
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
theorem hasFDerivAtFilter_iff_hasDerivAtFilter {f' : 𝕜 →L[𝕜] F} :
HasFDerivAtFilter f f' x L ↔ HasDerivAtFilter f (f' 1) x L := by simp [HasDerivAtFilter]
#align has_fderiv_at_filter_iff_has_deriv_at_filter hasFDerivAtFilter_iff_hasDerivAtFilter
theorem HasFDerivAtFilter.hasDerivAtFilter {f' : 𝕜 →L[𝕜] F} :
HasFDerivAtFilter f f' x L → HasDerivAtFilter f (f' 1) x L :=
hasFDerivAtFilter_iff_hasDerivAtFilter.mp
#align has_fderiv_at_filter.has_deriv_at_filter HasFDerivAtFilter.hasDerivAtFilter
theorem hasFDerivWithinAt_iff_hasDerivWithinAt {f' : 𝕜 →L[𝕜] F} :
HasFDerivWithinAt f f' s x ↔ HasDerivWithinAt f (f' 1) s x :=
hasFDerivAtFilter_iff_hasDerivAtFilter
#align has_fderiv_within_at_iff_has_deriv_within_at hasFDerivWithinAt_iff_hasDerivWithinAt
theorem hasDerivWithinAt_iff_hasFDerivWithinAt {f' : F} :
HasDerivWithinAt f f' s x ↔ HasFDerivWithinAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') s x :=
Iff.rfl
#align has_deriv_within_at_iff_has_fderiv_within_at hasDerivWithinAt_iff_hasFDerivWithinAt
theorem HasFDerivWithinAt.hasDerivWithinAt {f' : 𝕜 →L[𝕜] F} :
HasFDerivWithinAt f f' s x → HasDerivWithinAt f (f' 1) s x :=
hasFDerivWithinAt_iff_hasDerivWithinAt.mp
#align has_fderiv_within_at.has_deriv_within_at HasFDerivWithinAt.hasDerivWithinAt
theorem HasDerivWithinAt.hasFDerivWithinAt {f' : F} :
HasDerivWithinAt f f' s x → HasFDerivWithinAt f (smulRight (1 : 𝕜 →L[𝕜] 𝕜) f') s x :=
hasDerivWithinAt_iff_hasFDerivWithinAt.mp
#align has_deriv_within_at.has_fderiv_within_at HasDerivWithinAt.hasFDerivWithinAt
theorem hasFDerivAt_iff_hasDerivAt {f' : 𝕜 →L[𝕜] F} : HasFDerivAt f f' x ↔ HasDerivAt f (f' 1) x :=
hasFDerivAtFilter_iff_hasDerivAtFilter
#align has_fderiv_at_iff_has_deriv_at hasFDerivAt_iff_hasDerivAt
theorem HasFDerivAt.hasDerivAt {f' : 𝕜 →L[𝕜] F} : HasFDerivAt f f' x → HasDerivAt f (f' 1) x :=
hasFDerivAt_iff_hasDerivAt.mp
#align has_fderiv_at.has_deriv_at HasFDerivAt.hasDerivAt
| Mathlib/Analysis/Calculus/Deriv/Basic.lean | 201 | 203 | theorem hasStrictFDerivAt_iff_hasStrictDerivAt {f' : 𝕜 →L[𝕜] F} :
HasStrictFDerivAt f f' x ↔ HasStrictDerivAt f (f' 1) x := by |
simp [HasStrictDerivAt, HasStrictFDerivAt]
| 1 |
import Mathlib.Topology.ContinuousOn
#align_import topology.algebra.order.left_right from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Topology
section TopologicalSpace
variable {α β : Type*} [TopologicalSpace α] [LinearOrder α] [TopologicalSpace β]
theorem nhds_left_sup_nhds_right (a : α) : 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ici, nhdsWithin_univ]
#align nhds_left_sup_nhds_right nhds_left_sup_nhds_right
| Mathlib/Topology/Order/LeftRight.lean | 115 | 116 | theorem nhds_left'_sup_nhds_right (a : α) : 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a := by |
rw [← nhdsWithin_union, Iio_union_Ici, nhdsWithin_univ]
| 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
theorem subset_interior_iff_mem_nhdsSet : s ⊆ interior t ↔ t ∈ 𝓝ˢ s := by
simp_rw [mem_nhdsSet_iff_forall, subset_interior_iff_nhds]
#align subset_interior_iff_mem_nhds_set subset_interior_iff_mem_nhdsSet
theorem disjoint_principal_nhdsSet : Disjoint (𝓟 s) (𝓝ˢ t) ↔ Disjoint (closure s) t := by
rw [disjoint_principal_left, ← subset_interior_iff_mem_nhdsSet, interior_compl,
subset_compl_iff_disjoint_left]
| Mathlib/Topology/NhdsSet.lean | 60 | 61 | theorem disjoint_nhdsSet_principal : Disjoint (𝓝ˢ s) (𝓟 t) ↔ Disjoint s (closure t) := by |
rw [disjoint_comm, disjoint_principal_nhdsSet, disjoint_comm]
| 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]
| Mathlib/Data/Finset/Option.lean | 87 | 87 | theorem card_insertNone (s : Finset α) : s.insertNone.card = s.card + 1 := by | simp [insertNone]
| 1 |
import Mathlib.LinearAlgebra.Quotient
import Mathlib.Algebra.Category.ModuleCat.Basic
#align_import algebra.category.Module.epi_mono from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u
open CategoryTheory
namespace ModuleCat
variable {R : Type u} [Ring R] {X Y : ModuleCat.{v} R} (f : X ⟶ Y)
variable {M : Type v} [AddCommGroup M] [Module R M]
theorem ker_eq_bot_of_mono [Mono f] : LinearMap.ker f = ⊥ :=
LinearMap.ker_eq_bot_of_cancel fun u v => (@cancel_mono _ _ _ _ _ f _ (↟u) (↟v)).1
set_option linter.uppercaseLean3 false in
#align Module.ker_eq_bot_of_mono ModuleCat.ker_eq_bot_of_mono
theorem range_eq_top_of_epi [Epi f] : LinearMap.range f = ⊤ :=
LinearMap.range_eq_top_of_cancel fun u v => (@cancel_epi _ _ _ _ _ f _ (↟u) (↟v)).1
set_option linter.uppercaseLean3 false in
#align Module.range_eq_top_of_epi ModuleCat.range_eq_top_of_epi
theorem mono_iff_ker_eq_bot : Mono f ↔ LinearMap.ker f = ⊥ :=
⟨fun hf => ker_eq_bot_of_mono _, fun hf =>
ConcreteCategory.mono_of_injective _ <| by convert LinearMap.ker_eq_bot.1 hf⟩
set_option linter.uppercaseLean3 false in
#align Module.mono_iff_ker_eq_bot ModuleCat.mono_iff_ker_eq_bot
theorem mono_iff_injective : Mono f ↔ Function.Injective f := by
rw [mono_iff_ker_eq_bot, LinearMap.ker_eq_bot]
set_option linter.uppercaseLean3 false in
#align Module.mono_iff_injective ModuleCat.mono_iff_injective
theorem epi_iff_range_eq_top : Epi f ↔ LinearMap.range f = ⊤ :=
⟨fun _ => range_eq_top_of_epi _, fun hf =>
ConcreteCategory.epi_of_surjective _ <| LinearMap.range_eq_top.1 hf⟩
set_option linter.uppercaseLean3 false in
#align Module.epi_iff_range_eq_top ModuleCat.epi_iff_range_eq_top
| Mathlib/Algebra/Category/ModuleCat/EpiMono.lean | 55 | 56 | theorem epi_iff_surjective : Epi f ↔ Function.Surjective f := by |
rw [epi_iff_range_eq_top, LinearMap.range_eq_top]
| 1 |
import Mathlib.Algebra.IsPrimePow
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import number_theory.von_mangoldt from "leanprover-community/mathlib"@"c946d6097a6925ad16d7ec55677bbc977f9846de"
namespace ArithmeticFunction
open Finset Nat
open scoped ArithmeticFunction
noncomputable def log : ArithmeticFunction ℝ :=
⟨fun n => Real.log n, by simp⟩
#align nat.arithmetic_function.log ArithmeticFunction.log
@[simp]
theorem log_apply {n : ℕ} : log n = Real.log n :=
rfl
#align nat.arithmetic_function.log_apply ArithmeticFunction.log_apply
noncomputable def vonMangoldt : ArithmeticFunction ℝ :=
⟨fun n => if IsPrimePow n then Real.log (minFac n) else 0, if_neg not_isPrimePow_zero⟩
#align nat.arithmetic_function.von_mangoldt ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction] notation "Λ" => ArithmeticFunction.vonMangoldt
@[inherit_doc] scoped[ArithmeticFunction.vonMangoldt] notation "Λ" =>
ArithmeticFunction.vonMangoldt
theorem vonMangoldt_apply {n : ℕ} : Λ n = if IsPrimePow n then Real.log (minFac n) else 0 :=
rfl
#align nat.arithmetic_function.von_mangoldt_apply ArithmeticFunction.vonMangoldt_apply
@[simp]
theorem vonMangoldt_apply_one : Λ 1 = 0 := by simp [vonMangoldt_apply]
#align nat.arithmetic_function.von_mangoldt_apply_one ArithmeticFunction.vonMangoldt_apply_one
@[simp]
theorem vonMangoldt_nonneg {n : ℕ} : 0 ≤ Λ n := by
rw [vonMangoldt_apply]
split_ifs
· exact Real.log_nonneg (one_le_cast.2 (Nat.minFac_pos n))
rfl
#align nat.arithmetic_function.von_mangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg
theorem vonMangoldt_apply_pow {n k : ℕ} (hk : k ≠ 0) : Λ (n ^ k) = Λ n := by
simp only [vonMangoldt_apply, isPrimePow_pow_iff hk, pow_minFac hk]
#align nat.arithmetic_function.von_mangoldt_apply_pow ArithmeticFunction.vonMangoldt_apply_pow
| Mathlib/NumberTheory/VonMangoldt.lean | 94 | 95 | theorem vonMangoldt_apply_prime {p : ℕ} (hp : p.Prime) : Λ p = Real.log p := by |
rw [vonMangoldt_apply, Prime.minFac_eq hp, if_pos hp.prime.isPrimePow]
| 1 |
import Mathlib.RingTheory.WittVector.Frobenius
import Mathlib.RingTheory.WittVector.Verschiebung
import Mathlib.RingTheory.WittVector.MulP
#align_import ring_theory.witt_vector.identities from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c"
namespace WittVector
variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R]
-- type as `\bbW`
local notation "𝕎" => WittVector p
noncomputable section
-- Porting note: `ghost_calc` failure: `simp only []` and the manual instances had to be added.
theorem frobenius_verschiebung (x : 𝕎 R) : frobenius (verschiebung x) = x * p := by
have : IsPoly p fun {R} [CommRing R] x ↦ frobenius (verschiebung x) :=
IsPoly.comp (hg := frobenius_isPoly p) (hf := verschiebung_isPoly)
have : IsPoly p fun {R} [CommRing R] x ↦ x * p := mulN_isPoly p p
ghost_calc x
ghost_simp [mul_comm]
#align witt_vector.frobenius_verschiebung WittVector.frobenius_verschiebung
| Mathlib/RingTheory/WittVector/Identities.lean | 51 | 52 | theorem verschiebung_zmod (x : 𝕎 (ZMod p)) : verschiebung x = x * p := by |
rw [← frobenius_verschiebung, frobenius_zmodp]
| 1 |
import Mathlib.Topology.Separation
import Mathlib.Algebra.BigOperators.Finprod
#align_import topology.algebra.infinite_sum.basic from "leanprover-community/mathlib"@"3b52265189f3fb43aa631edffce5d060fafaf82f"
noncomputable section
open Filter Function
open scoped Topology
variable {α β γ : Type*}
section HasProd
variable [CommMonoid α] [TopologicalSpace α]
@[to_additive "Infinite sum on a topological monoid
The `atTop` filter on `Finset β` is the limit of all finite sets towards the entire type. So we sum
up bigger and bigger sets. This sum operation is invariant under reordering. In particular,
the function `ℕ → ℝ` sending `n` to `(-1)^n / (n+1)` does not have a
sum for this definition, but a series which is absolutely convergent will have the correct sum.
This is based on Mario Carneiro's
[infinite sum `df-tsms` in Metamath](http://us.metamath.org/mpeuni/df-tsms.html).
For the definition and many statements, `α` does not need to be a topological monoid. We only add
this assumption later, for the lemmas where it is relevant."]
def HasProd (f : β → α) (a : α) : Prop :=
Tendsto (fun s : Finset β ↦ ∏ b ∈ s, f b) atTop (𝓝 a)
#align has_sum HasSum
@[to_additive "`Summable f` means that `f` has some (infinite) sum. Use `tsum` to get the value."]
def Multipliable (f : β → α) : Prop :=
∃ a, HasProd f a
#align summable Summable
open scoped Classical in
@[to_additive "`∑' i, f i` is the sum of `f` it exists, or 0 otherwise."]
noncomputable irreducible_def tprod {β} (f : β → α) :=
if h : Multipliable f then
if (mulSupport f).Finite then finprod f
else h.choose
else 1
#align tsum tsum
-- see Note [operator precedence of big operators]
@[inherit_doc tprod]
notation3 "∏' "(...)", "r:67:(scoped f => tprod f) => r
@[inherit_doc tsum]
notation3 "∑' "(...)", "r:67:(scoped f => tsum f) => r
variable {f g : β → α} {a b : α} {s : Finset β}
@[to_additive]
theorem HasProd.multipliable (h : HasProd f a) : Multipliable f :=
⟨a, h⟩
#align has_sum.summable HasSum.summable
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Defs.lean | 124 | 125 | theorem tprod_eq_one_of_not_multipliable (h : ¬Multipliable f) : ∏' b, f b = 1 := by |
simp [tprod_def, h]
| 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]
| Mathlib/Data/Sym/Sym2.lean | 88 | 89 | theorem rel_iff' {p q : α × α} : Rel α p q ↔ p = q ∨ p = q.swap := by |
aesop (rule_sets := [Sym2])
| 1 |
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜']
variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G}
variable {f' : α → E'} {g' : α → F'} {k' : α → G'}
variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''}
variable {l l' : Filter α}
section Defs
irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
#align asymptotics.is_O_with Asymptotics.IsBigOWith
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 89 | 89 | theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by | rw [IsBigOWith_def]
| 1 |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
#align_import data.sigma.basic from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
open Function
namespace PSigma
variable {α : Sort*} {β : α → Sort*}
def elim {γ} (f : ∀ a, β a → γ) (a : PSigma β) : γ :=
PSigma.casesOn a f
#align psigma.elim PSigma.elim
@[simp]
theorem elim_val {γ} (f : ∀ a, β a → γ) (a b) : PSigma.elim f ⟨a, b⟩ = f a b :=
rfl
#align psigma.elim_val PSigma.elim_val
instance [Inhabited α] [Inhabited (β default)] : Inhabited (PSigma β) :=
⟨⟨default, default⟩⟩
instance decidableEq [h₁ : DecidableEq α] [h₂ : ∀ a, DecidableEq (β a)] : DecidableEq (PSigma β)
| ⟨a₁, b₁⟩, ⟨a₂, b₂⟩ =>
match a₁, b₁, a₂, b₂, h₁ a₁ a₂ with
| _, b₁, _, b₂, isTrue (Eq.refl _) =>
match b₁, b₂, h₂ _ b₁ b₂ with
| _, _, isTrue (Eq.refl _) => isTrue rfl
| _, _, isFalse n => isFalse fun h ↦ PSigma.noConfusion h fun _ e₂ ↦ n <| eq_of_heq e₂
| _, _, _, _, isFalse n => isFalse fun h ↦ PSigma.noConfusion h fun e₁ _ ↦ n e₁
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/porting.20data.2Esigma.2Ebasic/near/304855864
-- for an explanation of why this is currently needed. It generates `PSigma.mk.inj`.
-- This could be done elsewhere.
gen_injective_theorems% PSigma
theorem mk.inj_iff {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} :
@PSigma.mk α β a₁ b₁ = @PSigma.mk α β a₂ b₂ ↔ a₁ = a₂ ∧ HEq b₁ b₂ :=
(Iff.intro PSigma.mk.inj) fun ⟨h₁, h₂⟩ ↦
match a₁, a₂, b₁, b₂, h₁, h₂ with
| _, _, _, _, Eq.refl _, HEq.refl _ => rfl
#align psigma.mk.inj_iff PSigma.mk.inj_iff
#align psigma.ext PSigma.ext
| Mathlib/Data/Sigma/Basic.lean | 273 | 274 | theorem ext_iff {x₀ x₁ : PSigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ HEq x₀.2 x₁.2 := by |
cases x₀; cases x₁; exact PSigma.mk.inj_iff
| 1 |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.Nondegenerate
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.ToLin
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
#align_import linear_algebra.matrix.to_linear_equiv from "leanprover-community/mathlib"@"e42cfdb03b7902f8787a1eb552cb8f77766b45b9"
variable {n : Type*} [Fintype n]
namespace Matrix
section LinearEquiv
open LinearMap
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
section Nondegenerate
open Matrix
theorem exists_mulVec_eq_zero_iff_aux {K : Type*} [DecidableEq n] [Field K] {M : Matrix n n K} :
(∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 := by
constructor
· rintro ⟨v, hv, mul_eq⟩
contrapose! hv
exact eq_zero_of_mulVec_eq_zero hv mul_eq
· contrapose!
intro h
have : Function.Injective (Matrix.toLin' M) := by
simpa only [← LinearMap.ker_eq_bot, ker_toLin'_eq_bot_iff, not_imp_not] using h
have :
M *
LinearMap.toMatrix'
((LinearEquiv.ofInjectiveEndo (Matrix.toLin' M) this).symm : (n → K) →ₗ[K] n → K) =
1 := by
refine Matrix.toLin'.injective (LinearMap.ext fun v => ?_)
rw [Matrix.toLin'_mul, Matrix.toLin'_one, Matrix.toLin'_toMatrix', LinearMap.comp_apply]
exact (LinearEquiv.ofInjectiveEndo (Matrix.toLin' M) this).apply_symm_apply v
exact Matrix.det_ne_zero_of_right_inverse this
#align matrix.exists_mul_vec_eq_zero_iff_aux Matrix.exists_mulVec_eq_zero_iff_aux
theorem exists_mulVec_eq_zero_iff' {A : Type*} (K : Type*) [DecidableEq n] [CommRing A]
[Nontrivial A] [Field K] [Algebra A K] [IsFractionRing A K] {M : Matrix n n A} :
(∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 := by
have : (∃ v ≠ 0, (algebraMap A K).mapMatrix M *ᵥ v = 0) ↔ _ :=
exists_mulVec_eq_zero_iff_aux
rw [← RingHom.map_det, IsFractionRing.to_map_eq_zero_iff] at this
refine Iff.trans ?_ this; constructor <;> rintro ⟨v, hv, mul_eq⟩
· refine ⟨fun i => algebraMap _ _ (v i), mt (fun h => funext fun i => ?_) hv, ?_⟩
· exact IsFractionRing.to_map_eq_zero_iff.mp (congr_fun h i)
· ext i
refine (RingHom.map_mulVec _ _ _ i).symm.trans ?_
rw [mul_eq, Pi.zero_apply, RingHom.map_zero, Pi.zero_apply]
· letI := Classical.decEq K
obtain ⟨⟨b, hb⟩, ba_eq⟩ :=
IsLocalization.exist_integer_multiples_of_finset (nonZeroDivisors A) (Finset.univ.image v)
choose f hf using ba_eq
refine
⟨fun i => f _ (Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩),
mt (fun h => funext fun i => ?_) hv, ?_⟩
· have := congr_arg (algebraMap A K) (congr_fun h i)
rw [hf, Subtype.coe_mk, Pi.zero_apply, RingHom.map_zero, Algebra.smul_def, mul_eq_zero,
IsFractionRing.to_map_eq_zero_iff] at this
exact this.resolve_left (nonZeroDivisors.ne_zero hb)
· ext i
refine IsFractionRing.injective A K ?_
calc
algebraMap A K ((M *ᵥ (fun i : n => f (v i) _)) i) =
((algebraMap A K).mapMatrix M *ᵥ algebraMap _ K b • v) i := ?_
_ = 0 := ?_
_ = algebraMap A K 0 := (RingHom.map_zero _).symm
· simp_rw [RingHom.map_mulVec, mulVec, dotProduct, Function.comp_apply, hf,
RingHom.mapMatrix_apply, Pi.smul_apply, smul_eq_mul, Algebra.smul_def]
· rw [mulVec_smul, mul_eq, Pi.smul_apply, Pi.zero_apply, smul_zero]
#align matrix.exists_mul_vec_eq_zero_iff' Matrix.exists_mulVec_eq_zero_iff'
theorem exists_mulVec_eq_zero_iff {A : Type*} [DecidableEq n] [CommRing A] [IsDomain A]
{M : Matrix n n A} : (∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 :=
exists_mulVec_eq_zero_iff' (FractionRing A)
#align matrix.exists_mul_vec_eq_zero_iff Matrix.exists_mulVec_eq_zero_iff
| Mathlib/LinearAlgebra/Matrix/ToLinearEquiv.lean | 175 | 177 | theorem exists_vecMul_eq_zero_iff {A : Type*} [DecidableEq n] [CommRing A] [IsDomain A]
{M : Matrix n n A} : (∃ v ≠ 0, v ᵥ* M = 0) ↔ M.det = 0 := by |
simpa only [← M.det_transpose, ← mulVec_transpose] using exists_mulVec_eq_zero_iff
| 1 |
import Mathlib.Analysis.Complex.Basic
import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle
#align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
open Set
noncomputable section
namespace Complex
theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re :=
⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re
theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im :=
⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im
theorem isOpenMap_re : IsOpenMap re :=
isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj
#align complex.is_open_map_re Complex.isOpenMap_re
theorem isOpenMap_im : IsOpenMap im :=
isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj
#align complex.is_open_map_im Complex.isOpenMap_im
theorem quotientMap_re : QuotientMap re :=
isHomeomorphicTrivialFiberBundle_re.quotientMap_proj
#align complex.quotient_map_re Complex.quotientMap_re
theorem quotientMap_im : QuotientMap im :=
isHomeomorphicTrivialFiberBundle_im.quotientMap_proj
#align complex.quotient_map_im Complex.quotientMap_im
theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s :=
(isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm
#align complex.interior_preimage_re Complex.interior_preimage_re
theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s :=
(isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm
#align complex.interior_preimage_im Complex.interior_preimage_im
theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s :=
(isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm
#align complex.closure_preimage_re Complex.closure_preimage_re
theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s :=
(isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm
#align complex.closure_preimage_im Complex.closure_preimage_im
theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s :=
(isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm
#align complex.frontier_preimage_re Complex.frontier_preimage_re
theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s :=
(isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm
#align complex.frontier_preimage_im Complex.frontier_preimage_im
@[simp]
theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by
simpa only [interior_Iic] using interior_preimage_re (Iic a)
#align complex.interior_set_of_re_le Complex.interior_setOf_re_le
@[simp]
theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by
simpa only [interior_Iic] using interior_preimage_im (Iic a)
#align complex.interior_set_of_im_le Complex.interior_setOf_im_le
@[simp]
theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by
simpa only [interior_Ici] using interior_preimage_re (Ici a)
#align complex.interior_set_of_le_re Complex.interior_setOf_le_re
@[simp]
theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by
simpa only [interior_Ici] using interior_preimage_im (Ici a)
#align complex.interior_set_of_le_im Complex.interior_setOf_le_im
@[simp]
theorem closure_setOf_re_lt (a : ℝ) : closure { z : ℂ | z.re < a } = { z | z.re ≤ a } := by
simpa only [closure_Iio] using closure_preimage_re (Iio a)
#align complex.closure_set_of_re_lt Complex.closure_setOf_re_lt
@[simp]
theorem closure_setOf_im_lt (a : ℝ) : closure { z : ℂ | z.im < a } = { z | z.im ≤ a } := by
simpa only [closure_Iio] using closure_preimage_im (Iio a)
#align complex.closure_set_of_im_lt Complex.closure_setOf_im_lt
@[simp]
theorem closure_setOf_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re } := by
simpa only [closure_Ioi] using closure_preimage_re (Ioi a)
#align complex.closure_set_of_lt_re Complex.closure_setOf_lt_re
@[simp]
theorem closure_setOf_lt_im (a : ℝ) : closure { z : ℂ | a < z.im } = { z | a ≤ z.im } := by
simpa only [closure_Ioi] using closure_preimage_im (Ioi a)
#align complex.closure_set_of_lt_im Complex.closure_setOf_lt_im
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 134 | 135 | theorem frontier_setOf_re_le (a : ℝ) : frontier { z : ℂ | z.re ≤ a } = { z | z.re = a } := by |
simpa only [frontier_Iic] using frontier_preimage_re (Iic a)
| 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.