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 | meta_tactic_error bool 2 classes |
|---|---|---|---|---|---|---|
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
#align_import data.sigma.basic from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
open Function
section Sigma
variable {α α₁ α₂ : Type*} {β : α → Type*} {β₁ : α₁ → Type*} {β₂ : α₂ → Type*}
namespace Sigma
instance instInhabitedSigma [Inhabited α] [Inhabited (β default)] : Inhabited (Sigma β) :=
⟨⟨default, default⟩⟩
instance instDecidableEqSigma [h₁ : DecidableEq α] [h₂ : ∀ a, DecidableEq (β a)] :
DecidableEq (Sigma β)
| ⟨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 ↦ Sigma.noConfusion h fun _ e₂ ↦ n <| eq_of_heq e₂
| _, _, _, _, isFalse n => isFalse fun h ↦ Sigma.noConfusion h fun e₁ _ ↦ n e₁
-- sometimes the built-in injectivity support does not work
@[simp] -- @[nolint simpNF]
theorem mk.inj_iff {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} :
Sigma.mk a₁ b₁ = ⟨a₂, b₂⟩ ↔ a₁ = a₂ ∧ HEq b₁ b₂ :=
⟨fun h ↦ by cases h; simp,
fun ⟨h₁, h₂⟩ ↦ by subst h₁; rw [eq_of_heq h₂]⟩
#align sigma.mk.inj_iff Sigma.mk.inj_iff
@[simp]
theorem eta : ∀ x : Σa, β a, Sigma.mk x.1 x.2 = x
| ⟨_, _⟩ => rfl
#align sigma.eta Sigma.eta
#align sigma.ext Sigma.ext
| Mathlib/Data/Sigma/Basic.lean | 70 | 71 | theorem ext_iff {x₀ x₁ : Sigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ HEq x₀.2 x₁.2 := by |
cases x₀; cases x₁; exact Sigma.mk.inj_iff
| false |
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Logic.Encodable.Lattice
noncomputable section
open Filter Finset Function Encodable
open scoped Topology
variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M}
variable {G : Type*} [CommGroup G] {g g' : G}
-- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead
section Nat
section Monoid
namespace HasProd
@[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge
to `m`."]
theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) :=
h.comp tendsto_finset_range
#align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat
@[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge
to `∑' i, f i`."]
theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) :=
tendsto_prod_nat h.hasProd
namespace Multipliable
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean | 88 | 92 | theorem hasProd_iff_tendsto_nat [T2Space M] {f : ℕ → M} (hf : Multipliable f) :
HasProd f m ↔ Tendsto (fun n : ℕ ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := by |
refine ⟨fun h ↦ h.tendsto_prod_nat, fun h ↦ ?_⟩
rw [tendsto_nhds_unique h hf.hasProd.tendsto_prod_nat]
exact hf.hasProd
| false |
import Mathlib.LinearAlgebra.Dual
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec"
suppress_compilation
-- Porting note: universe metavariables behave oddly
universe w u v₁ v₂ v₃ v₄
variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂)
(P : Type v₃) (Q : Type v₄)
-- Porting note: we need high priority for this to fire first; not the case in ML3
attribute [local ext high] TensorProduct.ext
section Contraction
open TensorProduct LinearMap Matrix Module
open TensorProduct
section CommSemiring
variable [CommSemiring R]
variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q]
variable [Module R M] [Module R N] [Module R P] [Module R Q]
variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M)
-- Porting note: doesn't like implicit ring in the tensor product
def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R :=
(uncurry _ _ _ _).toFun LinearMap.id
#align contract_left contractLeft
-- Porting note: doesn't like implicit ring in the tensor product
def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R :=
(uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id)
#align contract_right contractRight
-- Porting note: doesn't like implicit ring in the tensor product
def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N :=
let M' := Module.Dual R M
(uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ
#align dual_tensor_hom dualTensorHom
variable {R M N P Q}
@[simp]
theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m :=
rfl
#align contract_left_apply contractLeft_apply
@[simp]
theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m :=
rfl
#align contract_right_apply contractRight_apply
@[simp]
theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) :
dualTensorHom R M N (f ⊗ₜ n) m = f m • n :=
rfl
#align dual_tensor_hom_apply dualTensorHom_apply
@[simp]
theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) :
Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) =
dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by
ext f' m'
simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply,
LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply,
LinearMap.smul_apply]
exact mul_comm _ _
#align transpose_dual_tensor_hom transpose_dualTensorHom
@[simp]
theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) :
((dualTensorHom R M P) (f ⊗ₜ[R] p)).prodMap (0 : N →ₗ[R] Q) =
dualTensorHom R (M × N) (P × Q) ((f ∘ₗ fst R M N) ⊗ₜ inl R P Q p) := by
ext <;>
simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply,
fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
#align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero
@[simp]
theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) :
(0 : M →ₗ[R] P).prodMap ((dualTensorHom R N Q) (g ⊗ₜ[R] q)) =
dualTensorHom R (M × N) (P × Q) ((g ∘ₗ snd R M N) ⊗ₜ inr R P Q q) := by
ext <;>
simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply,
snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
#align zero_prod_map_dual_tensor_hom zero_prodMap_dualTensorHom
| Mathlib/LinearAlgebra/Contraction.lean | 113 | 118 | theorem map_dualTensorHom (f : Module.Dual R M) (p : P) (g : Module.Dual R N) (q : Q) :
TensorProduct.map (dualTensorHom R M P (f ⊗ₜ[R] p)) (dualTensorHom R N Q (g ⊗ₜ[R] q)) =
dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] p ⊗ₜ[R] q) := by |
ext m n
simp only [compr₂_apply, mk_apply, map_tmul, dualTensorHom_apply, dualDistrib_apply, ←
smul_tmul_smul]
| true |
import Mathlib.MeasureTheory.Measure.VectorMeasure
import Mathlib.MeasureTheory.Function.AEEqOfIntegral
#align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1"
noncomputable section
open scoped Classical MeasureTheory NNReal ENNReal
variable {α β : Type*} {m : MeasurableSpace α}
namespace MeasureTheory
open TopologicalSpace
variable {μ ν : Measure α}
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E :=
if hf : Integrable f μ then
{ measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0
empty' := by simp
not_measurable' := fun s hs => if_neg hs
m_iUnion' := fun s hs₁ hs₂ => by
dsimp only
convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n
· rw [if_pos (hs₁ n)]
· rw [if_pos (MeasurableSet.iUnion hs₁)] }
else 0
#align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ
open Measure
variable {f g : α → E}
theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) :
μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs
#align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply
@[simp]
theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by
ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp
#align measure_theory.with_densityᵥ_zero MeasureTheory.withDensityᵥ_zero
@[simp]
theorem withDensityᵥ_neg : μ.withDensityᵥ (-f) = -μ.withDensityᵥ f := by
by_cases hf : Integrable f μ
· ext1 i hi
rw [VectorMeasure.neg_apply, withDensityᵥ_apply hf hi, ← integral_neg,
withDensityᵥ_apply hf.neg hi]
rfl
· rw [withDensityᵥ, withDensityᵥ, dif_neg hf, dif_neg, neg_zero]
rwa [integrable_neg_iff]
#align measure_theory.with_densityᵥ_neg MeasureTheory.withDensityᵥ_neg
theorem withDensityᵥ_neg' : (μ.withDensityᵥ fun x => -f x) = -μ.withDensityᵥ f :=
withDensityᵥ_neg
#align measure_theory.with_densityᵥ_neg' MeasureTheory.withDensityᵥ_neg'
@[simp]
theorem withDensityᵥ_add (hf : Integrable f μ) (hg : Integrable g μ) :
μ.withDensityᵥ (f + g) = μ.withDensityᵥ f + μ.withDensityᵥ g := by
ext1 i hi
rw [withDensityᵥ_apply (hf.add hg) hi, VectorMeasure.add_apply, withDensityᵥ_apply hf hi,
withDensityᵥ_apply hg hi]
simp_rw [Pi.add_apply]
rw [integral_add] <;> rw [← integrableOn_univ]
· exact hf.integrableOn.restrict MeasurableSet.univ
· exact hg.integrableOn.restrict MeasurableSet.univ
#align measure_theory.with_densityᵥ_add MeasureTheory.withDensityᵥ_add
theorem withDensityᵥ_add' (hf : Integrable f μ) (hg : Integrable g μ) :
(μ.withDensityᵥ fun x => f x + g x) = μ.withDensityᵥ f + μ.withDensityᵥ g :=
withDensityᵥ_add hf hg
#align measure_theory.with_densityᵥ_add' MeasureTheory.withDensityᵥ_add'
@[simp]
theorem withDensityᵥ_sub (hf : Integrable f μ) (hg : Integrable g μ) :
μ.withDensityᵥ (f - g) = μ.withDensityᵥ f - μ.withDensityᵥ g := by
rw [sub_eq_add_neg, sub_eq_add_neg, withDensityᵥ_add hf hg.neg, withDensityᵥ_neg]
#align measure_theory.with_densityᵥ_sub MeasureTheory.withDensityᵥ_sub
theorem withDensityᵥ_sub' (hf : Integrable f μ) (hg : Integrable g μ) :
(μ.withDensityᵥ fun x => f x - g x) = μ.withDensityᵥ f - μ.withDensityᵥ g :=
withDensityᵥ_sub hf hg
#align measure_theory.with_densityᵥ_sub' MeasureTheory.withDensityᵥ_sub'
@[simp]
| Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean | 112 | 122 | theorem withDensityᵥ_smul {𝕜 : Type*} [NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E]
[SMulCommClass ℝ 𝕜 E] (f : α → E) (r : 𝕜) : μ.withDensityᵥ (r • f) = r • μ.withDensityᵥ f := by |
by_cases hf : Integrable f μ
· ext1 i hi
rw [withDensityᵥ_apply (hf.smul r) hi, VectorMeasure.smul_apply, withDensityᵥ_apply hf hi, ←
integral_smul r f]
rfl
· by_cases hr : r = 0
· rw [hr, zero_smul, zero_smul, withDensityᵥ_zero]
· rw [withDensityᵥ, withDensityᵥ, dif_neg hf, dif_neg, smul_zero]
rwa [integrable_smul_iff hr f]
| false |
import Mathlib.Topology.Order.ProjIcc
import Mathlib.Topology.ContinuousFunction.Ordered
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.UnitInterval
#align_import topology.homotopy.basic from "leanprover-community/mathlib"@"11c53f174270aa43140c0b26dabce5fc4a253e80"
noncomputable section
universe u v w x
variable {F : Type*} {X : Type u} {Y : Type v} {Z : Type w} {Z' : Type x} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [TopologicalSpace Z']
open unitInterval
namespace ContinuousMap
structure Homotopy (f₀ f₁ : C(X, Y)) extends C(I × X, Y) where
map_zero_left : ∀ x, toFun (0, x) = f₀ x
map_one_left : ∀ x, toFun (1, x) = f₁ x
#align continuous_map.homotopy ContinuousMap.Homotopy
section
class HomotopyLike {X Y : outParam Type*} [TopologicalSpace X] [TopologicalSpace Y]
(F : Type*) (f₀ f₁ : outParam <| C(X, Y)) [FunLike F (I × X) Y]
extends ContinuousMapClass F (I × X) Y : Prop where
map_zero_left (f : F) : ∀ x, f (0, x) = f₀ x
map_one_left (f : F) : ∀ x, f (1, x) = f₁ x
#align continuous_map.homotopy_like ContinuousMap.HomotopyLike
end
namespace Homotopy
section
variable {f₀ f₁ : C(X, Y)}
instance instFunLike : FunLike (Homotopy f₀ f₁) (I × X) Y where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : HomotopyLike (Homotopy f₀ f₁) f₀ f₁ where
map_continuous f := f.continuous_toFun
map_zero_left f := f.map_zero_left
map_one_left f := f.map_one_left
@[ext]
theorem ext {F G : Homotopy f₀ f₁} (h : ∀ x, F x = G x) : F = G :=
DFunLike.ext _ _ h
#align continuous_map.homotopy.ext ContinuousMap.Homotopy.ext
def Simps.apply (F : Homotopy f₀ f₁) : I × X → Y :=
F
#align continuous_map.homotopy.simps.apply ContinuousMap.Homotopy.Simps.apply
initialize_simps_projections Homotopy (toFun → apply, -toContinuousMap)
protected theorem continuous (F : Homotopy f₀ f₁) : Continuous F :=
F.continuous_toFun
#align continuous_map.homotopy.continuous ContinuousMap.Homotopy.continuous
@[simp]
theorem apply_zero (F : Homotopy f₀ f₁) (x : X) : F (0, x) = f₀ x :=
F.map_zero_left x
#align continuous_map.homotopy.apply_zero ContinuousMap.Homotopy.apply_zero
@[simp]
theorem apply_one (F : Homotopy f₀ f₁) (x : X) : F (1, x) = f₁ x :=
F.map_one_left x
#align continuous_map.homotopy.apply_one ContinuousMap.Homotopy.apply_one
@[simp]
theorem coe_toContinuousMap (F : Homotopy f₀ f₁) : ⇑F.toContinuousMap = F :=
rfl
#align continuous_map.homotopy.coe_to_continuous_map ContinuousMap.Homotopy.coe_toContinuousMap
def curry (F : Homotopy f₀ f₁) : C(I, C(X, Y)) :=
F.toContinuousMap.curry
#align continuous_map.homotopy.curry ContinuousMap.Homotopy.curry
@[simp]
theorem curry_apply (F : Homotopy f₀ f₁) (t : I) (x : X) : F.curry t x = F (t, x) :=
rfl
#align continuous_map.homotopy.curry_apply ContinuousMap.Homotopy.curry_apply
def extend (F : Homotopy f₀ f₁) : C(ℝ, C(X, Y)) :=
F.curry.IccExtend zero_le_one
#align continuous_map.homotopy.extend ContinuousMap.Homotopy.extend
theorem extend_apply_of_le_zero (F : Homotopy f₀ f₁) {t : ℝ} (ht : t ≤ 0) (x : X) :
F.extend t x = f₀ x := by
rw [← F.apply_zero]
exact ContinuousMap.congr_fun (Set.IccExtend_of_le_left (zero_le_one' ℝ) F.curry ht) x
#align continuous_map.homotopy.extend_apply_of_le_zero ContinuousMap.Homotopy.extend_apply_of_le_zero
| Mathlib/Topology/Homotopy/Basic.lean | 172 | 175 | theorem extend_apply_of_one_le (F : Homotopy f₀ f₁) {t : ℝ} (ht : 1 ≤ t) (x : X) :
F.extend t x = f₁ x := by |
rw [← F.apply_one]
exact ContinuousMap.congr_fun (Set.IccExtend_of_right_le (zero_le_one' ℝ) F.curry ht) x
| false |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z ≠ 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
theorem Int.sq_ne_two_mod_four (z : ℤ) : z * z % 4 ≠ 2 := by
suffices ¬z * z % (4 : ℕ) = 2 % (4 : ℕ) by exact this
rw [← ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
#align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four
noncomputable section
open scoped Classical
def PythagoreanTriple (x y z : ℤ) : Prop :=
x * x + y * y = z * z
#align pythagorean_triple PythagoreanTriple
theorem pythagoreanTriple_comm {x y z : ℤ} : PythagoreanTriple x y z ↔ PythagoreanTriple y x z := by
delta PythagoreanTriple
rw [add_comm]
#align pythagorean_triple_comm pythagoreanTriple_comm
| Mathlib/NumberTheory/PythagoreanTriples.lean | 60 | 61 | theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by |
simp only [PythagoreanTriple, zero_mul, zero_add]
| false |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Analysis.InnerProductSpace.l2Space
import Mathlib.MeasureTheory.Function.ContinuousMapDense
import Mathlib.MeasureTheory.Function.L2Space
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.Periodic
import Mathlib.Topology.ContinuousFunction.StoneWeierstrass
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
open scoped ENNReal ComplexConjugate Real
open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set
variable {T : ℝ}
open AddCircle
section Monomials
def fourier (n : ℤ) : C(AddCircle T, ℂ) where
toFun x := toCircle (n • x :)
continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _
#align fourier fourier
@[simp]
theorem fourier_apply {n : ℤ} {x : AddCircle T} : fourier n x = toCircle (n • x :) :=
rfl
#align fourier_apply fourier_apply
-- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'`
theorem fourier_coe_apply {n : ℤ} {x : ℝ} :
fourier n (x : AddCircle T) = Complex.exp (2 * π * Complex.I * n * x / T) := by
rw [fourier_apply, ← QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe,
expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul,
Complex.ofReal_mul, Complex.ofReal_intCast]
norm_num
congr 1; ring
#align fourier_coe_apply fourier_coe_apply
@[simp]
theorem fourier_coe_apply' {n : ℤ} {x : ℝ} :
toCircle (n • (x : AddCircle T) :) = Complex.exp (2 * π * Complex.I * n * x / T) := by
rw [← fourier_apply]; exact fourier_coe_apply
-- @[simp] -- Porting note: simp normal form is `fourier_zero'`
theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by
induction x using QuotientAddGroup.induction_on'
simp only [fourier_coe_apply]
norm_num
#align fourier_zero fourier_zero
@[simp]
| Mathlib/Analysis/Fourier/AddCircle.lean | 139 | 141 | theorem fourier_zero' {x : AddCircle T} : @toCircle T 0 = (1 : ℂ) := by |
have : fourier 0 x = @toCircle T 0 := by rw [fourier_apply, zero_smul]
rw [← this]; exact fourier_zero
| false |
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
| Mathlib/Analysis/BoundedVariation.lean | 107 | 124 | 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
| false |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
#align add_self_eq_zero add_self_eq_zero
set_option linter.deprecated false
@[simp]
theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 :=
add_self_eq_zero
#align bit0_eq_zero bit0_eq_zero
@[simp]
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm]
exact bit0_eq_zero
#align zero_eq_bit0 zero_eq_bit0
theorem bit0_ne_zero : bit0 a ≠ 0 ↔ a ≠ 0 :=
bit0_eq_zero.not
#align bit0_ne_zero bit0_ne_zero
theorem zero_ne_bit0 : 0 ≠ bit0 a ↔ a ≠ 0 :=
zero_eq_bit0.not
#align zero_ne_bit0 zero_ne_bit0
end
section
variable {R : Type*} [NonAssocRing R] [NoZeroDivisors R] [CharZero R]
@[simp] theorem neg_eq_self_iff {a : R} : -a = a ↔ a = 0 :=
neg_eq_iff_add_eq_zero.trans add_self_eq_zero
#align neg_eq_self_iff neg_eq_self_iff
@[simp] theorem eq_neg_self_iff {a : R} : a = -a ↔ a = 0 :=
eq_neg_iff_add_eq_zero.trans add_self_eq_zero
#align eq_neg_self_iff eq_neg_self_iff
theorem nat_mul_inj {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) : n = 0 ∨ a = b := by
rw [← sub_eq_zero, ← mul_sub, mul_eq_zero, sub_eq_zero] at h
exact mod_cast h
#align nat_mul_inj nat_mul_inj
theorem nat_mul_inj' {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) (w : n ≠ 0) : a = b := by
simpa [w] using nat_mul_inj h
#align nat_mul_inj' nat_mul_inj'
set_option linter.deprecated false
theorem bit0_injective : Function.Injective (bit0 : R → R) := fun a b h => by
dsimp [bit0] at h
simp only [(two_mul a).symm, (two_mul b).symm] at h
refine nat_mul_inj' ?_ two_ne_zero
exact mod_cast h
#align bit0_injective bit0_injective
theorem bit1_injective : Function.Injective (bit1 : R → R) := fun a b h => by
simp only [bit1, add_left_inj] at h
exact bit0_injective h
#align bit1_injective bit1_injective
@[simp]
theorem bit0_eq_bit0 {a b : R} : bit0 a = bit0 b ↔ a = b :=
bit0_injective.eq_iff
#align bit0_eq_bit0 bit0_eq_bit0
@[simp]
theorem bit1_eq_bit1 {a b : R} : bit1 a = bit1 b ↔ a = b :=
bit1_injective.eq_iff
#align bit1_eq_bit1 bit1_eq_bit1
@[simp]
theorem bit1_eq_one {a : R} : bit1 a = 1 ↔ a = 0 := by
rw [show (1 : R) = bit1 0 by simp, bit1_eq_bit1]
#align bit1_eq_one bit1_eq_one
@[simp]
theorem one_eq_bit1 {a : R} : 1 = bit1 a ↔ a = 0 := by
rw [eq_comm]
exact bit1_eq_one
#align one_eq_bit1 one_eq_bit1
end
section
variable {R : Type*} [DivisionRing R] [CharZero R]
@[simp] lemma half_add_self (a : R) : (a + a) / 2 = a := by
rw [← mul_two, mul_div_cancel_right₀ a two_ne_zero]
#align half_add_self half_add_self
@[simp]
theorem add_halves' (a : R) : a / 2 + a / 2 = a := by rw [← add_div, half_add_self]
#align add_halves' add_halves'
| Mathlib/Algebra/CharZero/Lemmas.lean | 185 | 185 | theorem sub_half (a : R) : a - a / 2 = a / 2 := by | rw [sub_eq_iff_eq_add, add_halves']
| false |
import Mathlib.NumberTheory.LegendreSymbol.Basic
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.GaussSum
#align_import number_theory.legendre_symbol.quadratic_reciprocity from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Nat
section Values
variable {p : ℕ} [Fact p.Prime]
open ZMod
section Reciprocity
variable {p q : ℕ} [Fact p.Prime] [Fact q.Prime]
namespace legendreSym
open ZMod
| Mathlib/NumberTheory/LegendreSymbol/QuadraticReciprocity.lean | 121 | 133 | theorem quadratic_reciprocity (hp : p ≠ 2) (hq : q ≠ 2) (hpq : p ≠ q) :
legendreSym q p * legendreSym p q = (-1) ^ (p / 2 * (q / 2)) := by |
have hp₁ := (Prime.eq_two_or_odd <| @Fact.out p.Prime _).resolve_left hp
have hq₁ := (Prime.eq_two_or_odd <| @Fact.out q.Prime _).resolve_left hq
have hq₂ : ringChar (ZMod q) ≠ 2 := (ringChar_zmod_n q).substr hq
have h :=
quadraticChar_odd_prime ((ringChar_zmod_n p).substr hp) hq ((ringChar_zmod_n p).substr hpq)
rw [card p] at h
have nc : ∀ n r : ℕ, ((n : ℤ) : ZMod r) = n := fun n r => by norm_cast
have nc' : (((-1) ^ (p / 2) : ℤ) : ZMod q) = (-1) ^ (p / 2) := by norm_cast
rw [legendreSym, legendreSym, nc, nc, h, map_mul, mul_rotate', mul_comm (p / 2), ← pow_two,
quadraticChar_sq_one (prime_ne_zero q p hpq.symm), mul_one, pow_mul, χ₄_eq_neg_one_pow hp₁, nc',
map_pow, quadraticChar_neg_one hq₂, card q, χ₄_eq_neg_one_pow hq₁]
| false |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
#align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 93 | 98 | theorem differentiableWithinAt_arcsin_Iic {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by |
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩
rw [← neg_neg x, ← image_neg_Ici] at h
have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg
simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
| false |
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀
#align euclidean_domain.mul_div_cancel mul_div_cancel_right₀
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a :=
⟨fun h => by
rw [← div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun ⟨c, e⟩ => by
rw [e, ← add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
· simp only [b0, zero_mul]
· rw [mul_div_cancel_left₀ _ b0]⟩
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by
rw [← dvd_add_right (h.mul_right _), div_add_mod]
#align euclidean_domain.dvd_mod_iff EuclideanDomain.dvd_mod_iff
@[simp]
theorem mod_one (a : R) : a % 1 = 0 :=
mod_eq_zero.2 (one_dvd _)
#align euclidean_domain.mod_one EuclideanDomain.mod_one
@[simp]
theorem zero_mod (b : R) : 0 % b = 0 :=
mod_eq_zero.2 (dvd_zero _)
#align euclidean_domain.zero_mod EuclideanDomain.zero_mod
@[simp]
theorem zero_div {a : R} : 0 / a = 0 :=
by_cases (fun a0 : a = 0 => a0.symm ▸ div_zero 0) fun a0 => by
simpa only [zero_mul] using mul_div_cancel_right₀ 0 a0
#align euclidean_domain.zero_div EuclideanDomain.zero_div
@[simp]
theorem div_self {a : R} (a0 : a ≠ 0) : a / a = 1 := by
simpa only [one_mul] using mul_div_cancel_right₀ 1 a0
#align euclidean_domain.div_self EuclideanDomain.div_self
theorem eq_div_of_mul_eq_left {a b c : R} (hb : b ≠ 0) (h : a * b = c) : a = c / b := by
rw [← h, mul_div_cancel_right₀ _ hb]
#align euclidean_domain.eq_div_of_mul_eq_left EuclideanDomain.eq_div_of_mul_eq_left
theorem eq_div_of_mul_eq_right {a b c : R} (ha : a ≠ 0) (h : a * b = c) : b = c / a := by
rw [← h, mul_div_cancel_left₀ _ ha]
#align euclidean_domain.eq_div_of_mul_eq_right EuclideanDomain.eq_div_of_mul_eq_right
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 96 | 101 | theorem mul_div_assoc (x : R) {y z : R} (h : z ∣ y) : x * y / z = x * (y / z) := by |
by_cases hz : z = 0
· subst hz
rw [div_zero, div_zero, mul_zero]
rcases h with ⟨p, rfl⟩
rw [mul_div_cancel_left₀ _ hz, mul_left_comm, mul_div_cancel_left₀ _ hz]
| false |
import Mathlib.Data.DFinsupp.Basic
import Mathlib.Data.Finset.Pointwise
import Mathlib.LinearAlgebra.Basis.VectorSpace
#align_import algebra.group.unique_prods from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
@[to_additive
"Let `G` be a Type with addition, let `A B : Finset G` be finite subsets and
let `a0 b0 : G` be two elements. `UniqueAdd A B a0 b0` asserts `a0 + b0` can be written in at
most one way as a sum of an element from `A` and an element from `B`."]
def UniqueMul {G} [Mul G] (A B : Finset G) (a0 b0 : G) : Prop :=
∀ ⦃a b⦄, a ∈ A → b ∈ B → a * b = a0 * b0 → a = a0 ∧ b = b0
#align unique_mul UniqueMul
#align unique_add UniqueAdd
namespace UniqueMul
variable {G H : Type*} [Mul G] [Mul H] {A B : Finset G} {a0 b0 : G}
@[to_additive (attr := nontriviality, simp)]
theorem of_subsingleton [Subsingleton G] : UniqueMul A B a0 b0 := by
simp [UniqueMul, eq_iff_true_of_subsingleton]
@[to_additive]
| Mathlib/Algebra/Group/UniqueProds.lean | 71 | 75 | theorem of_card_le_one (hA : A.Nonempty) (hB : B.Nonempty) (hA1 : A.card ≤ 1) (hB1 : B.card ≤ 1) :
∃ a ∈ A, ∃ b ∈ B, UniqueMul A B a b := by |
rw [Finset.card_le_one_iff] at hA1 hB1
obtain ⟨a, ha⟩ := hA; obtain ⟨b, hb⟩ := hB
exact ⟨a, ha, b, hb, fun _ _ ha' hb' _ ↦ ⟨hA1 ha' ha, hB1 hb' hb⟩⟩
| false |
import Mathlib.Data.List.Lattice
import Mathlib.Data.List.Range
import Mathlib.Data.Bool.Basic
#align_import data.list.intervals from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open Nat
namespace List
def Ico (n m : ℕ) : List ℕ :=
range' n (m - n)
#align list.Ico List.Ico
namespace Ico
theorem zero_bot (n : ℕ) : Ico 0 n = range n := by rw [Ico, Nat.sub_zero, range_eq_range']
#align list.Ico.zero_bot List.Ico.zero_bot
@[simp]
theorem length (n m : ℕ) : length (Ico n m) = m - n := by
dsimp [Ico]
simp [length_range', autoParam]
#align list.Ico.length List.Ico.length
| Mathlib/Data/List/Intervals.lean | 51 | 53 | theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) := by |
dsimp [Ico]
simp [pairwise_lt_range', autoParam]
| true |
import Mathlib.CategoryTheory.LiftingProperties.Basic
import Mathlib.CategoryTheory.Adjunction.Basic
#align_import category_theory.lifting_properties.adjunction from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
namespace CategoryTheory
open Category
variable {C D : Type*} [Category C] [Category D] {G : C ⥤ D} {F : D ⥤ C}
namespace CommSq
section
variable {A B : C} {X Y : D} {i : A ⟶ B} {p : X ⟶ Y} {u : G.obj A ⟶ X} {v : G.obj B ⟶ Y}
(sq : CommSq u (G.map i) p v) (adj : G ⊣ F)
theorem right_adjoint : CommSq (adj.homEquiv _ _ u) i (F.map p) (adj.homEquiv _ _ v) :=
⟨by
simp only [Adjunction.homEquiv_unit, assoc, ← F.map_comp, sq.w]
rw [F.map_comp, Adjunction.unit_naturality_assoc]⟩
#align category_theory.comm_sq.right_adjoint CategoryTheory.CommSq.right_adjoint
def rightAdjointLiftStructEquiv : sq.LiftStruct ≃ (sq.right_adjoint adj).LiftStruct where
toFun l :=
{ l := adj.homEquiv _ _ l.l
fac_left := by rw [← adj.homEquiv_naturality_left, l.fac_left]
fac_right := by rw [← Adjunction.homEquiv_naturality_right, l.fac_right] }
invFun l :=
{ l := (adj.homEquiv _ _).symm l.l
fac_left := by
rw [← Adjunction.homEquiv_naturality_left_symm, l.fac_left]
apply (adj.homEquiv _ _).left_inv
fac_right := by
rw [← Adjunction.homEquiv_naturality_right_symm, l.fac_right]
apply (adj.homEquiv _ _).left_inv }
left_inv := by aesop_cat
right_inv := by aesop_cat
#align category_theory.comm_sq.right_adjoint_lift_struct_equiv CategoryTheory.CommSq.rightAdjointLiftStructEquiv
| Mathlib/CategoryTheory/LiftingProperties/Adjunction.lean | 66 | 68 | theorem right_adjoint_hasLift_iff : HasLift (sq.right_adjoint adj) ↔ HasLift sq := by |
simp only [HasLift.iff]
exact Equiv.nonempty_congr (sq.rightAdjointLiftStructEquiv adj).symm
| false |
import Mathlib.Analysis.InnerProductSpace.Orthogonal
import Mathlib.Analysis.Normed.Group.AddTorsor
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Set
open scoped RealInnerProductSpace
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
| Mathlib/Geometry/Euclidean/PerpBisector.lean | 97 | 98 | theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by |
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
| false |
import Mathlib.Analysis.Calculus.ContDiff.RCLike
import Mathlib.MeasureTheory.Measure.Hausdorff
#align_import topology.metric_space.hausdorff_dimension from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
open scoped MeasureTheory ENNReal NNReal Topology
open MeasureTheory MeasureTheory.Measure Set TopologicalSpace FiniteDimensional Filter
variable {ι X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
@[irreducible] noncomputable def dimH (s : Set X) : ℝ≥0∞ := by
borelize X; exact ⨆ (d : ℝ≥0) (_ : @hausdorffMeasure X _ _ ⟨rfl⟩ d s = ∞), d
set_option linter.uppercaseLean3 false in
#align dimH dimH
section Measurable
variable [MeasurableSpace X] [BorelSpace X]
| Mathlib/Topology/MetricSpace/HausdorffDimension.lean | 110 | 111 | theorem dimH_def (s : Set X) : dimH s = ⨆ (d : ℝ≥0) (_ : μH[d] s = ∞), (d : ℝ≥0∞) := by |
borelize X; rw [dimH]
| false |
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set
open Pointwise Topology
variable {𝕜 E : Type*}
variable [NormedField 𝕜]
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
conv_lhs => rw [← inv_smul_smul₀ hc x]
simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀]
#align smul_ball smul_ball
theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by
rw [_root_.smul_ball hc, smul_zero, mul_one]
#align smul_unit_ball smul_unitBall
theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) :
c • sphere x r = sphere (c • x) (‖c‖ * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
conv_lhs => rw [← inv_smul_smul₀ hc x]
simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne',
mul_comm r]
#align smul_sphere' smul_sphere'
| Mathlib/Analysis/NormedSpace/Pointwise.lean | 104 | 106 | theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) :
c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by |
simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc]
| false |
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.Topology.Constructions
#align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable
open scoped Classical Topology ENNReal
universe u v
variable {ι ι' : Type*} {α : ι → Type*}
| Mathlib/MeasureTheory/Constructions/Pi.lean | 69 | 73 | theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) :
IsPiSystem (pi univ '' pi univ C) := by |
rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst
rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst
exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i)
| true |
import Mathlib.MeasureTheory.Decomposition.SignedHahn
import Mathlib.MeasureTheory.Measure.MutuallySingular
#align_import measure_theory.decomposition.jordan from "leanprover-community/mathlib"@"70a4f2197832bceab57d7f41379b2592d1110570"
noncomputable section
open scoped Classical MeasureTheory ENNReal NNReal
variable {α β : Type*} [MeasurableSpace α]
namespace MeasureTheory
@[ext]
structure JordanDecomposition (α : Type*) [MeasurableSpace α] where
(posPart negPart : Measure α)
[posPart_finite : IsFiniteMeasure posPart]
[negPart_finite : IsFiniteMeasure negPart]
mutuallySingular : posPart ⟂ₘ negPart
#align measure_theory.jordan_decomposition MeasureTheory.JordanDecomposition
#align measure_theory.jordan_decomposition.pos_part MeasureTheory.JordanDecomposition.posPart
#align measure_theory.jordan_decomposition.neg_part MeasureTheory.JordanDecomposition.negPart
#align measure_theory.jordan_decomposition.pos_part_finite MeasureTheory.JordanDecomposition.posPart_finite
#align measure_theory.jordan_decomposition.neg_part_finite MeasureTheory.JordanDecomposition.negPart_finite
#align measure_theory.jordan_decomposition.mutually_singular MeasureTheory.JordanDecomposition.mutuallySingular
attribute [instance] JordanDecomposition.posPart_finite
attribute [instance] JordanDecomposition.negPart_finite
namespace JordanDecomposition
open Measure VectorMeasure
variable (j : JordanDecomposition α)
instance instZero : Zero (JordanDecomposition α) where zero := ⟨0, 0, MutuallySingular.zero_right⟩
#align measure_theory.jordan_decomposition.has_zero MeasureTheory.JordanDecomposition.instZero
instance instInhabited : Inhabited (JordanDecomposition α) where default := 0
#align measure_theory.jordan_decomposition.inhabited MeasureTheory.JordanDecomposition.instInhabited
instance instInvolutiveNeg : InvolutiveNeg (JordanDecomposition α) where
neg j := ⟨j.negPart, j.posPart, j.mutuallySingular.symm⟩
neg_neg _ := JordanDecomposition.ext _ _ rfl rfl
#align measure_theory.jordan_decomposition.has_involutive_neg MeasureTheory.JordanDecomposition.instInvolutiveNeg
instance instSMul : SMul ℝ≥0 (JordanDecomposition α) where
smul r j :=
⟨r • j.posPart, r • j.negPart,
MutuallySingular.smul _ (MutuallySingular.smul _ j.mutuallySingular.symm).symm⟩
#align measure_theory.jordan_decomposition.has_smul MeasureTheory.JordanDecomposition.instSMul
instance instSMulReal : SMul ℝ (JordanDecomposition α) where
smul r j := if 0 ≤ r then r.toNNReal • j else -((-r).toNNReal • j)
#align measure_theory.jordan_decomposition.has_smul_real MeasureTheory.JordanDecomposition.instSMulReal
@[simp]
theorem zero_posPart : (0 : JordanDecomposition α).posPart = 0 :=
rfl
#align measure_theory.jordan_decomposition.zero_pos_part MeasureTheory.JordanDecomposition.zero_posPart
@[simp]
theorem zero_negPart : (0 : JordanDecomposition α).negPart = 0 :=
rfl
#align measure_theory.jordan_decomposition.zero_neg_part MeasureTheory.JordanDecomposition.zero_negPart
@[simp]
theorem neg_posPart : (-j).posPart = j.negPart :=
rfl
#align measure_theory.jordan_decomposition.neg_pos_part MeasureTheory.JordanDecomposition.neg_posPart
@[simp]
theorem neg_negPart : (-j).negPart = j.posPart :=
rfl
#align measure_theory.jordan_decomposition.neg_neg_part MeasureTheory.JordanDecomposition.neg_negPart
@[simp]
theorem smul_posPart (r : ℝ≥0) : (r • j).posPart = r • j.posPart :=
rfl
#align measure_theory.jordan_decomposition.smul_pos_part MeasureTheory.JordanDecomposition.smul_posPart
@[simp]
theorem smul_negPart (r : ℝ≥0) : (r • j).negPart = r • j.negPart :=
rfl
#align measure_theory.jordan_decomposition.smul_neg_part MeasureTheory.JordanDecomposition.smul_negPart
theorem real_smul_def (r : ℝ) (j : JordanDecomposition α) :
r • j = if 0 ≤ r then r.toNNReal • j else -((-r).toNNReal • j) :=
rfl
#align measure_theory.jordan_decomposition.real_smul_def MeasureTheory.JordanDecomposition.real_smul_def
@[simp]
theorem coe_smul (r : ℝ≥0) : (r : ℝ) • j = r • j := by
-- Porting note: replaced `show`
rw [real_smul_def, if_pos (NNReal.coe_nonneg r), Real.toNNReal_coe]
#align measure_theory.jordan_decomposition.coe_smul MeasureTheory.JordanDecomposition.coe_smul
theorem real_smul_nonneg (r : ℝ) (hr : 0 ≤ r) : r • j = r.toNNReal • j :=
dif_pos hr
#align measure_theory.jordan_decomposition.real_smul_nonneg MeasureTheory.JordanDecomposition.real_smul_nonneg
theorem real_smul_neg (r : ℝ) (hr : r < 0) : r • j = -((-r).toNNReal • j) :=
dif_neg (not_le.2 hr)
#align measure_theory.jordan_decomposition.real_smul_neg MeasureTheory.JordanDecomposition.real_smul_neg
theorem real_smul_posPart_nonneg (r : ℝ) (hr : 0 ≤ r) :
(r • j).posPart = r.toNNReal • j.posPart := by
rw [real_smul_def, ← smul_posPart, if_pos hr]
#align measure_theory.jordan_decomposition.real_smul_pos_part_nonneg MeasureTheory.JordanDecomposition.real_smul_posPart_nonneg
theorem real_smul_negPart_nonneg (r : ℝ) (hr : 0 ≤ r) :
(r • j).negPart = r.toNNReal • j.negPart := by
rw [real_smul_def, ← smul_negPart, if_pos hr]
#align measure_theory.jordan_decomposition.real_smul_neg_part_nonneg MeasureTheory.JordanDecomposition.real_smul_negPart_nonneg
| Mathlib/MeasureTheory/Decomposition/Jordan.lean | 158 | 160 | theorem real_smul_posPart_neg (r : ℝ) (hr : r < 0) :
(r • j).posPart = (-r).toNNReal • j.negPart := by |
rw [real_smul_def, ← smul_negPart, if_neg (not_le.2 hr), neg_posPart]
| false |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.MvPowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Finset (antidiagonal mem_antidiagonal)
def PowerSeries (R : Type*) :=
MvPowerSeries Unit R
#align power_series PowerSeries
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section
-- Porting note: not available in Lean 4
-- local reducible PowerSeries
scoped notation:9000 R "⟦X⟧" => PowerSeries R
instance [Inhabited R] : Inhabited R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Zero R] : Zero R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddMonoid R] : AddMonoid R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddGroup R] : AddGroup R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Semiring R] : Semiring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [CommSemiring R] : CommSemiring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Ring R] : Ring R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [CommRing R] : CommRing R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance [Nontrivial R] : Nontrivial R⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S]
[IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ :=
Pi.isScalarTower
instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by
dsimp only [PowerSeries]
infer_instance
end
section Semiring
variable (R) [Semiring R]
def coeff (n : ℕ) : R⟦X⟧ →ₗ[R] R :=
MvPowerSeries.coeff R (single () n)
#align power_series.coeff PowerSeries.coeff
def monomial (n : ℕ) : R →ₗ[R] R⟦X⟧ :=
MvPowerSeries.monomial R (single () n)
#align power_series.monomial PowerSeries.monomial
variable {R}
theorem coeff_def {s : Unit →₀ ℕ} {n : ℕ} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by
erw [coeff, ← h, ← Finsupp.unique_single s]
#align power_series.coeff_def PowerSeries.coeff_def
@[ext]
theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ :=
MvPowerSeries.ext fun n => by
rw [← coeff_def]
· apply h
rfl
#align power_series.ext PowerSeries.ext
theorem ext_iff {φ ψ : R⟦X⟧} : φ = ψ ↔ ∀ n, coeff R n φ = coeff R n ψ :=
⟨fun h n => congr_arg (coeff R n) h, ext⟩
#align power_series.ext_iff PowerSeries.ext_iff
instance [Subsingleton R] : Subsingleton R⟦X⟧ := by
simp only [subsingleton_iff, ext_iff]
exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _
def mk {R} (f : ℕ → R) : R⟦X⟧ := fun s => f (s ())
#align power_series.mk PowerSeries.mk
@[simp]
theorem coeff_mk (n : ℕ) (f : ℕ → R) : coeff R n (mk f) = f n :=
congr_arg f Finsupp.single_eq_same
#align power_series.coeff_mk PowerSeries.coeff_mk
theorem coeff_monomial (m n : ℕ) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 :=
calc
coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _
_ = if m = n then a else 0 := by simp only [Finsupp.unique_single_eq_iff]
#align power_series.coeff_monomial PowerSeries.coeff_monomial
theorem monomial_eq_mk (n : ℕ) (a : R) : monomial R n a = mk fun m => if m = n then a else 0 :=
ext fun m => by rw [coeff_monomial, coeff_mk]
#align power_series.monomial_eq_mk PowerSeries.monomial_eq_mk
@[simp]
theorem coeff_monomial_same (n : ℕ) (a : R) : coeff R n (monomial R n a) = a :=
MvPowerSeries.coeff_monomial_same _ _
#align power_series.coeff_monomial_same PowerSeries.coeff_monomial_same
@[simp]
theorem coeff_comp_monomial (n : ℕ) : (coeff R n).comp (monomial R n) = LinearMap.id :=
LinearMap.ext <| coeff_monomial_same n
#align power_series.coeff_comp_monomial PowerSeries.coeff_comp_monomial
variable (R)
def constantCoeff : R⟦X⟧ →+* R :=
MvPowerSeries.constantCoeff Unit R
#align power_series.constant_coeff PowerSeries.constantCoeff
def C : R →+* R⟦X⟧ :=
MvPowerSeries.C Unit R
set_option linter.uppercaseLean3 false in
#align power_series.C PowerSeries.C
variable {R}
def X : R⟦X⟧ :=
MvPowerSeries.X ()
set_option linter.uppercaseLean3 false in
#align power_series.X PowerSeries.X
theorem commute_X (φ : R⟦X⟧) : Commute φ X :=
MvPowerSeries.commute_X _ _
set_option linter.uppercaseLean3 false in
#align power_series.commute_X PowerSeries.commute_X
@[simp]
| Mathlib/RingTheory/PowerSeries/Basic.lean | 229 | 231 | theorem coeff_zero_eq_constantCoeff : ⇑(coeff R 0) = constantCoeff R := by |
rw [coeff, Finsupp.single_zero]
rfl
| true |
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [← comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) :
factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C)
@[simp]
theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A ⟶ B) g w = 0 := by
ext
simp
#align image_to_kernel_zero_left imageToKernel_zero_left
theorem imageToKernel_zero_right [HasImages V] {w} :
imageToKernel f (0 : B ⟶ C) w =
(imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by
ext
simp
#align image_to_kernel_zero_right imageToKernel_zero_right
section
variable [HasKernels V] [HasImages V]
theorem imageToKernel_comp_right {D : V} (h : C ⟶ D) (w : f ≫ g = 0) :
imageToKernel f (g ≫ h) (by simp [reassoc_of% w]) =
imageToKernel f g w ≫ Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by
ext
simp
#align image_to_kernel_comp_right imageToKernel_comp_right
theorem imageToKernel_comp_left {Z : V} (h : Z ⟶ A) (w : f ≫ g = 0) :
imageToKernel (h ≫ f) g (by simp [w]) =
Subobject.ofLE _ _ (imageSubobject_comp_le h f) ≫ imageToKernel f g w := by
ext
simp
#align image_to_kernel_comp_left imageToKernel_comp_left
@[simp]
| Mathlib/Algebra/Homology/ImageToKernel.lean | 127 | 132 | theorem imageToKernel_comp_mono {D : V} (h : C ⟶ D) [Mono h] (w) :
imageToKernel f (g ≫ h) w =
imageToKernel f g ((cancel_mono h).mp (by simpa using w : (f ≫ g) ≫ h = 0 ≫ h)) ≫
(Subobject.isoOfEq _ _ (kernelSubobject_comp_mono g h)).inv := by |
ext
simp
| false |
import Mathlib.Data.Fintype.Option
import Mathlib.Data.Fintype.Perm
import Mathlib.Data.Fintype.Prod
import Mathlib.GroupTheory.Perm.Sign
import Mathlib.Logic.Equiv.Option
#align_import group_theory.perm.option from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open Equiv
@[simp]
theorem Equiv.optionCongr_one {α : Type*} : (1 : Perm α).optionCongr = 1 :=
Equiv.optionCongr_refl
#align equiv.option_congr_one Equiv.optionCongr_one
@[simp]
theorem Equiv.optionCongr_swap {α : Type*} [DecidableEq α] (x y : α) :
optionCongr (swap x y) = swap (some x) (some y) := by
ext (_ | i)
· simp [swap_apply_of_ne_of_ne]
· by_cases hx : i = x
· simp only [hx, optionCongr_apply, Option.map_some', swap_apply_left, Option.mem_def,
Option.some.injEq]
by_cases hy : i = y <;> simp [hx, hy, swap_apply_of_ne_of_ne]
#align equiv.option_congr_swap Equiv.optionCongr_swap
@[simp]
theorem Equiv.optionCongr_sign {α : Type*} [DecidableEq α] [Fintype α] (e : Perm α) :
Perm.sign e.optionCongr = Perm.sign e := by
refine Perm.swap_induction_on e ?_ ?_
· simp [Perm.one_def]
· intro f x y hne h
simp [h, hne, Perm.mul_def, ← Equiv.optionCongr_trans]
#align equiv.option_congr_sign Equiv.optionCongr_sign
@[simp]
theorem map_equiv_removeNone {α : Type*} [DecidableEq α] (σ : Perm (Option α)) :
(removeNone σ).optionCongr = swap none (σ none) * σ := by
ext1 x
have : Option.map (⇑(removeNone σ)) x = (swap none (σ none)) (σ x) := by
cases' x with x
· simp
· cases h : σ (some _)
· simp [removeNone_none _ h]
· have hn : σ (some x) ≠ none := by simp [h]
have hσn : σ (some x) ≠ σ none := σ.injective.ne (by simp)
simp [removeNone_some _ ⟨_, h⟩, ← h, swap_apply_of_ne_of_ne hn hσn]
simpa using this
#align map_equiv_remove_none map_equiv_removeNone
@[simps]
def Equiv.Perm.decomposeOption {α : Type*} [DecidableEq α] :
Perm (Option α) ≃ Option α × Perm α where
toFun σ := (σ none, removeNone σ)
invFun i := swap none i.1 * i.2.optionCongr
left_inv σ := by simp
right_inv := fun ⟨x, σ⟩ => by
have : removeNone (swap none x * σ.optionCongr) = σ :=
Equiv.optionCongr_injective (by simp [← mul_assoc])
simp [← Perm.eq_inv_iff_eq, this]
#align equiv.perm.decompose_option Equiv.Perm.decomposeOption
theorem Equiv.Perm.decomposeOption_symm_of_none_apply {α : Type*} [DecidableEq α] (e : Perm α)
(i : Option α) : Equiv.Perm.decomposeOption.symm (none, e) i = i.map e := by simp
#align equiv.perm.decompose_option_symm_of_none_apply Equiv.Perm.decomposeOption_symm_of_none_apply
| Mathlib/GroupTheory/Perm/Option.lean | 80 | 81 | theorem Equiv.Perm.decomposeOption_symm_sign {α : Type*} [DecidableEq α] [Fintype α] (e : Perm α) :
Perm.sign (Equiv.Perm.decomposeOption.symm (none, e)) = Perm.sign e := by | simp
| false |
import Mathlib.Data.Set.Finite
import Mathlib.GroupTheory.GroupAction.FixedPoints
import Mathlib.GroupTheory.Perm.Support
open Equiv List MulAction Pointwise Set Subgroup
variable {G α : Type*} [Group G] [MulAction G α] [DecidableEq α]
theorem finite_compl_fixedBy_closure_iff {S : Set G} :
(∀ g ∈ closure S, (fixedBy α g)ᶜ.Finite) ↔ ∀ g ∈ S, (fixedBy α g)ᶜ.Finite :=
⟨fun h g hg ↦ h g (subset_closure hg), fun h g hg ↦ by
refine closure_induction hg h (by simp) (fun g g' hg hg' ↦ (hg.union hg').subset ?_) (by simp)
simp_rw [← compl_inter, compl_subset_compl, fixedBy_mul]⟩
theorem finite_compl_fixedBy_swap {x y : α} : (fixedBy α (swap x y))ᶜ.Finite :=
Set.Finite.subset (s := {x, y}) (by simp)
(compl_subset_comm.mp fun z h ↦ by apply swap_apply_of_ne_of_ne <;> rintro rfl <;> simp at h)
theorem Equiv.Perm.IsSwap.finite_compl_fixedBy {σ : Perm α} (h : σ.IsSwap) :
(fixedBy α σ)ᶜ.Finite := by
obtain ⟨x, y, -, rfl⟩ := h
exact finite_compl_fixedBy_swap
-- this result cannot be moved to Perm/Basic since Perm/Basic is not allowed to import Submonoid
theorem SubmonoidClass.swap_mem_trans {a b c : α} {C} [SetLike C (Perm α)]
[SubmonoidClass C (Perm α)] (M : C) (hab : swap a b ∈ M) (hbc : swap b c ∈ M) :
swap a c ∈ M := by
obtain rfl | hab' := eq_or_ne a b
· exact hbc
obtain rfl | hac := eq_or_ne a c
· exact swap_self a ▸ one_mem M
rw [swap_comm, ← swap_mul_swap_mul_swap hab' hac]
exact mul_mem (mul_mem hbc hab) hbc
theorem exists_smul_not_mem_of_subset_orbit_closure (S : Set G) (T : Set α) {a : α}
(hS : ∀ g ∈ S, g⁻¹ ∈ S) (subset : T ⊆ orbit (closure S) a) (not_mem : a ∉ T)
(nonempty : T.Nonempty) : ∃ σ ∈ S, ∃ a ∈ T, σ • a ∉ T := by
have key0 : ¬ closure S ≤ stabilizer G T := by
have ⟨b, hb⟩ := nonempty
obtain ⟨σ, rfl⟩ := subset hb
contrapose! not_mem with h
exact smul_mem_smul_set_iff.mp ((h σ.2).symm ▸ hb)
contrapose! key0
refine (closure_le _).mpr fun σ hσ ↦ ?_
simp_rw [SetLike.mem_coe, mem_stabilizer_iff, Set.ext_iff, mem_smul_set_iff_inv_smul_mem]
exact fun a ↦ ⟨fun h ↦ smul_inv_smul σ a ▸ key0 σ hσ (σ⁻¹ • a) h, key0 σ⁻¹ (hS σ hσ) a⟩
| Mathlib/GroupTheory/Perm/ClosureSwap.lean | 74 | 88 | theorem swap_mem_closure_isSwap {S : Set (Perm α)} (hS : ∀ f ∈ S, f.IsSwap) {x y : α} :
swap x y ∈ closure S ↔ x ∈ orbit (closure S) y := by |
refine ⟨fun h ↦ ⟨⟨swap x y, h⟩, swap_apply_right x y⟩, fun hf ↦ ?_⟩
by_contra h
have := exists_smul_not_mem_of_subset_orbit_closure S {x | swap x y ∈ closure S}
(fun f hf ↦ ?_) (fun z hz ↦ ?_) h ⟨y, ?_⟩
· obtain ⟨σ, hσ, a, ha, hσa⟩ := this
obtain ⟨z, w, hzw, rfl⟩ := hS σ hσ
have := ne_of_mem_of_not_mem ha hσa
rw [Perm.smul_def, ne_comm, swap_apply_ne_self_iff, and_iff_right hzw] at this
refine hσa (SubmonoidClass.swap_mem_trans (closure S) ?_ ha)
obtain rfl | rfl := this <;> simpa [swap_comm] using subset_closure hσ
· obtain ⟨x, y, -, rfl⟩ := hS f hf; rwa [swap_inv]
· exact orbit_eq_iff.mpr hf ▸ ⟨⟨swap z y, hz⟩, swap_apply_right z y⟩
· rw [mem_setOf, swap_self]; apply one_mem
| false |
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.NormedSpace.WithLp
open Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal
noncomputable section
variable (p : ℝ≥0∞) (𝕜 α β : Type*)
namespace WithLp
section DistNorm
section EDist
variable [EDist α] [EDist β]
open scoped Classical in
instance instProdEDist : EDist (WithLp p (α × β)) where
edist f g :=
if _hp : p = 0 then
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1)
else if p = ∞ then
edist f.fst g.fst ⊔ edist f.snd g.snd
else
(edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal)
variable {p α β}
variable (x y : WithLp p (α × β)) (x' : α × β)
@[simp]
theorem prod_edist_eq_card (f g : WithLp 0 (α × β)) :
edist f g =
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) := by
convert if_pos rfl
theorem prod_edist_eq_add (hp : 0 < p.toReal) (f g : WithLp p (α × β)) :
edist f g = (edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal) :=
let hp' := ENNReal.toReal_pos_iff.mp hp
(if_neg hp'.1.ne').trans (if_neg hp'.2.ne)
| Mathlib/Analysis/NormedSpace/ProdLp.lean | 171 | 174 | theorem prod_edist_eq_sup (f g : WithLp ∞ (α × β)) :
edist f g = edist f.fst g.fst ⊔ edist f.snd g.snd := by |
dsimp [edist]
exact if_neg ENNReal.top_ne_zero
| true |
import Mathlib.Analysis.Normed.Group.Basic
#align_import information_theory.hamming from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
section HammingDistNorm
open Finset Function
variable {α ι : Type*} {β : ι → Type*} [Fintype ι] [∀ i, DecidableEq (β i)]
variable {γ : ι → Type*} [∀ i, DecidableEq (γ i)]
def hammingDist (x y : ∀ i, β i) : ℕ :=
(univ.filter fun i => x i ≠ y i).card
#align hamming_dist hammingDist
@[simp]
theorem hammingDist_self (x : ∀ i, β i) : hammingDist x x = 0 := by
rw [hammingDist, card_eq_zero, filter_eq_empty_iff]
exact fun _ _ H => H rfl
#align hamming_dist_self hammingDist_self
theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y :=
zero_le _
#align hamming_dist_nonneg hammingDist_nonneg
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x := by
simp_rw [hammingDist, ne_comm]
#align hamming_dist_comm hammingDist_comm
theorem hammingDist_triangle (x y z : ∀ i, β i) :
hammingDist x z ≤ hammingDist x y + hammingDist y z := by
classical
unfold hammingDist
refine le_trans (card_mono ?_) (card_union_le _ _)
rw [← filter_or]
exact monotone_filter_right _ fun i h ↦ (h.ne_or_ne _).imp_right Ne.symm
#align hamming_dist_triangle hammingDist_triangle
theorem hammingDist_triangle_left (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist z x + hammingDist z y := by
rw [hammingDist_comm z]
exact hammingDist_triangle _ _ _
#align hamming_dist_triangle_left hammingDist_triangle_left
| Mathlib/InformationTheory/Hamming.lean | 78 | 81 | theorem hammingDist_triangle_right (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist x z + hammingDist y z := by |
rw [hammingDist_comm y]
exact hammingDist_triangle _ _ _
| false |
import Mathlib.Data.Set.Image
import Mathlib.Data.SProd
#align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Function
namespace Set
section Prod
variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β}
theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) :
(s ×ˢ t).Subsingleton := fun _x hx _y hy ↦
Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2)
noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] :
DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable
#align set.decidable_mem_prod Set.decidableMemProd
@[gcongr]
theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ :=
fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩
#align set.prod_mono Set.prod_mono
@[gcongr]
theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t :=
prod_mono hs Subset.rfl
#align set.prod_mono_left Set.prod_mono_left
@[gcongr]
theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ :=
prod_mono Subset.rfl ht
#align set.prod_mono_right Set.prod_mono_right
@[simp]
theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ :=
⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩
#align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self
@[simp]
theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ :=
and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self
#align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self
theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P :=
⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩
#align set.prod_subset_iff Set.prod_subset_iff
theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) :=
prod_subset_iff
#align set.forall_prod_set Set.forall_prod_set
theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by
simp [and_assoc]
#align set.exists_prod_set Set.exists_prod_set
@[simp]
theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by
ext
exact and_false_iff _
#align set.prod_empty Set.prod_empty
@[simp]
theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by
ext
exact false_and_iff _
#align set.empty_prod Set.empty_prod
@[simp, mfld_simps]
theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by
ext
exact true_and_iff _
#align set.univ_prod_univ Set.univ_prod_univ
theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq]
#align set.univ_prod Set.univ_prod
theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by simp [prod_eq]
#align set.prod_univ Set.prod_univ
@[simp] lemma prod_eq_univ [Nonempty α] [Nonempty β] : s ×ˢ t = univ ↔ s = univ ∧ t = univ := by
simp [eq_univ_iff_forall, forall_and]
@[simp]
theorem singleton_prod : ({a} : Set α) ×ˢ t = Prod.mk a '' t := by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align set.singleton_prod Set.singleton_prod
@[simp]
theorem prod_singleton : s ×ˢ ({b} : Set β) = (fun a => (a, b)) '' s := by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align set.prod_singleton Set.prod_singleton
theorem singleton_prod_singleton : ({a} : Set α) ×ˢ ({b} : Set β) = {(a, b)} := by simp
#align set.singleton_prod_singleton Set.singleton_prod_singleton
@[simp]
theorem union_prod : (s₁ ∪ s₂) ×ˢ t = s₁ ×ˢ t ∪ s₂ ×ˢ t := by
ext ⟨x, y⟩
simp [or_and_right]
#align set.union_prod Set.union_prod
@[simp]
theorem prod_union : s ×ˢ (t₁ ∪ t₂) = s ×ˢ t₁ ∪ s ×ˢ t₂ := by
ext ⟨x, y⟩
simp [and_or_left]
#align set.prod_union Set.prod_union
theorem inter_prod : (s₁ ∩ s₂) ×ˢ t = s₁ ×ˢ t ∩ s₂ ×ˢ t := by
ext ⟨x, y⟩
simp only [← and_and_right, mem_inter_iff, mem_prod]
#align set.inter_prod Set.inter_prod
| Mathlib/Data/Set/Prod.lean | 142 | 144 | theorem prod_inter : s ×ˢ (t₁ ∩ t₂) = s ×ˢ t₁ ∩ s ×ˢ t₂ := by |
ext ⟨x, y⟩
simp only [← and_and_left, mem_inter_iff, mem_prod]
| false |
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.Topology.Algebra.Order.LiminfLimsup
#align_import analysis.normed_space.lp_space from "leanprover-community/mathlib"@"de83b43717abe353f425855fcf0cedf9ea0fe8a4"
noncomputable section
open scoped NNReal ENNReal Function
variable {α : Type*} {E : α → Type*} {p q : ℝ≥0∞} [∀ i, NormedAddCommGroup (E i)]
def Memℓp (f : ∀ i, E i) (p : ℝ≥0∞) : Prop :=
if p = 0 then Set.Finite { i | f i ≠ 0 }
else if p = ∞ then BddAbove (Set.range fun i => ‖f i‖)
else Summable fun i => ‖f i‖ ^ p.toReal
#align mem_ℓp Memℓp
| Mathlib/Analysis/NormedSpace/lpSpace.lean | 81 | 83 | theorem memℓp_zero_iff {f : ∀ i, E i} : Memℓp f 0 ↔ Set.Finite { i | f i ≠ 0 } := by |
dsimp [Memℓp]
rw [if_pos rfl]
| false |
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
-- Well-founded definitions are now irreducible by default;
-- as this was implemented before this change,
-- we just set it back to semireducible to avoid needing to change any proofs.
@[semireducible] noncomputable def T : ℤ → R[X]
| 0 => 1
| 1 => X
| (n : ℕ) + 2 => 2 * X * T (n + 1) - T n
| -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1)
termination_by n => Int.natAbs n + Int.natAbs (n - 1)
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[elab_as_elim]
protected theorem induct (motive : ℤ → Prop)
(zero : motive 0)
(one : motive 1)
(add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2))
(neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) :
∀ (a : ℤ), motive a :=
T.induct Unit motive zero one add_two fun n hn hnm => by
simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm
@[simp]
theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n
| (k : ℕ) => T.eq_3 R k
| -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by
linear_combination (norm := ring_nf) T_add_two R (n - 2)
theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
linear_combination (norm := ring_nf) T_add_two R (n - 2)
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X)
| Mathlib/RingTheory/Polynomial/Chebyshev.lean | 113 | 114 | theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by |
simpa [pow_two, mul_assoc] using T_add_two R 0
| true |
import Mathlib.MeasureTheory.Measure.Doubling
import Mathlib.MeasureTheory.Covering.Vitali
import Mathlib.MeasureTheory.Covering.Differentiation
#align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655"
noncomputable section
open Set Filter Metric MeasureTheory TopologicalSpace
open scoped NNReal Topology
namespace IsUnifLocDoublingMeasure
variable {α : Type*} [MetricSpace α] [MeasurableSpace α] (μ : Measure α)
[IsUnifLocDoublingMeasure μ]
section
variable [SecondCountableTopology α] [BorelSpace α] [IsLocallyFiniteMeasure μ]
open scoped Topology
irreducible_def vitaliFamily (K : ℝ) : VitaliFamily μ := by
let R := scalingScaleOf μ (max (4 * K + 3) 3)
have Rpos : 0 < R := scalingScaleOf_pos _ _
have A : ∀ x : α, ∃ᶠ r in 𝓝[>] (0 : ℝ),
μ (closedBall x (3 * r)) ≤ scalingConstantOf μ (max (4 * K + 3) 3) * μ (closedBall x r) := by
intro x
apply frequently_iff.2 fun {U} hU => ?_
obtain ⟨ε, εpos, hε⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU
refine ⟨min ε R, hε ⟨lt_min εpos Rpos, min_le_left _ _⟩, ?_⟩
exact measure_mul_le_scalingConstantOf_mul μ
⟨zero_lt_three, le_max_right _ _⟩ (min_le_right _ _)
exact (Vitali.vitaliFamily μ (scalingConstantOf μ (max (4 * K + 3) 3)) A).enlarge (R / 4)
(by linarith)
#align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily
theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : ℝ} {x y : α} {r : ℝ} (h : dist x y ≤ K * r)
(rpos : 0 < r) : closedBall y r ∈ (vitaliFamily μ K).setsAt x := by
let R := scalingScaleOf μ (max (4 * K + 3) 3)
simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq,
isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall,
measurableSet_closedBall]
by_cases H : closedBall y r ⊆ closedBall x (R / 4)
swap; · exact Or.inr H
left
rcases le_or_lt r R with (hr | hr)
· refine ⟨(K + 1) * r, ?_⟩
constructor
· apply closedBall_subset_closedBall'
rw [dist_comm]
linarith
· have I1 : closedBall x (3 * ((K + 1) * r)) ⊆ closedBall y ((4 * K + 3) * r) := by
apply closedBall_subset_closedBall'
linarith
have I2 : closedBall y ((4 * K + 3) * r) ⊆ closedBall y (max (4 * K + 3) 3 * r) := by
apply closedBall_subset_closedBall
exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le
apply (measure_mono (I1.trans I2)).trans
exact measure_mul_le_scalingConstantOf_mul _
⟨zero_lt_three.trans_le (le_max_right _ _), le_rfl⟩ hr
· refine ⟨R / 4, H, ?_⟩
have : closedBall x (3 * (R / 4)) ⊆ closedBall y r := by
apply closedBall_subset_closedBall'
have A : y ∈ closedBall y r := mem_closedBall_self rpos.le
have B := mem_closedBall'.1 (H A)
linarith
apply (measure_mono this).trans _
refine le_mul_of_one_le_left (zero_le _) ?_
exact ENNReal.one_le_coe_iff.2 (le_max_right _ _)
#align is_unif_loc_doubling_measure.closed_ball_mem_vitali_family_of_dist_le_mul IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul
| Mathlib/MeasureTheory/Covering/DensityTheorem.lean | 112 | 132 | theorem tendsto_closedBall_filterAt {K : ℝ} {x : α} {ι : Type*} {l : Filter ι} (w : ι → α)
(δ : ι → ℝ) (δlim : Tendsto δ l (𝓝[>] 0)) (xmem : ∀ᶠ j in l, x ∈ closedBall (w j) (K * δ j)) :
Tendsto (fun j => closedBall (w j) (δ j)) l ((vitaliFamily μ K).filterAt x) := by |
refine (vitaliFamily μ K).tendsto_filterAt_iff.mpr ⟨?_, fun ε hε => ?_⟩
· filter_upwards [xmem, δlim self_mem_nhdsWithin] with j hj h'j
exact closedBall_mem_vitaliFamily_of_dist_le_mul μ hj h'j
· rcases l.eq_or_neBot with rfl | h
· simp
have hK : 0 ≤ K := by
rcases (xmem.and (δlim self_mem_nhdsWithin)).exists with ⟨j, hj, h'j⟩
have : 0 ≤ K * δ j := nonempty_closedBall.1 ⟨x, hj⟩
exact (mul_nonneg_iff_left_nonneg_of_pos (mem_Ioi.1 h'j)).1 this
have δpos := eventually_mem_of_tendsto_nhdsWithin δlim
replace δlim := tendsto_nhds_of_tendsto_nhdsWithin δlim
replace hK : 0 < K + 1 := by linarith
apply (((Metric.tendsto_nhds.mp δlim _ (div_pos hε hK)).and δpos).and xmem).mono
rintro j ⟨⟨hjε, hj₀ : 0 < δ j⟩, hx⟩ y hy
replace hjε : (K + 1) * δ j < ε := by
simpa [abs_eq_self.mpr hj₀.le] using (lt_div_iff' hK).mp hjε
simp only [mem_closedBall] at hx hy ⊢
linarith [dist_triangle_right y x (w j)]
| false |
import Mathlib.LinearAlgebra.DFinsupp
import Mathlib.LinearAlgebra.StdBasis
#align_import linear_algebra.finsupp_vector_space from "leanprover-community/mathlib"@"59628387770d82eb6f6dd7b7107308aa2509ec95"
noncomputable section
open Set LinearMap Submodule
open scoped Cardinal
universe u v w
namespace Finsupp
namespace Basis
variable {R M n : Type*}
variable [DecidableEq n]
variable [Semiring R] [AddCommMonoid M] [Module R M]
theorem _root_.Finset.sum_single_ite [Fintype n] (a : R) (i : n) :
(∑ x : n, Finsupp.single x (if i = x then a else 0)) = Finsupp.single i a := by
simp only [apply_ite (Finsupp.single _), Finsupp.single_zero, Finset.sum_ite_eq,
if_pos (Finset.mem_univ _)]
#align finset.sum_single_ite Finset.sum_single_ite
| Mathlib/LinearAlgebra/FinsuppVectorSpace.lean | 167 | 170 | theorem equivFun_symm_stdBasis [Finite n] (b : Basis n R M) (i : n) :
b.equivFun.symm (LinearMap.stdBasis R (fun _ => R) i 1) = b i := by |
cases nonempty_fintype n
simp
| false |
import Mathlib.CategoryTheory.Equivalence
#align_import algebraic_topology.dold_kan.compatibility from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category
namespace AlgebraicTopology
namespace DoldKan
namespace Compatibility
variable {A A' B B' : Type*} [Category A] [Category A'] [Category B] [Category B'] (eA : A ≌ A')
(eB : B ≌ B') (e' : A' ≌ B') {F : A ⥤ B'} (hF : eA.functor ⋙ e'.functor ≅ F) {G : B ⥤ A}
(hG : eB.functor ⋙ e'.inverse ≅ G ⋙ eA.functor)
@[simps! functor inverse unitIso_hom_app]
def equivalence₀ : A ≌ B' :=
eA.trans e'
#align algebraic_topology.dold_kan.compatibility.equivalence₀ AlgebraicTopology.DoldKan.Compatibility.equivalence₀
variable {eA} {e'}
@[simps! functor]
def equivalence₁ : A ≌ B' := (equivalence₀ eA e').changeFunctor hF
#align algebraic_topology.dold_kan.compatibility.equivalence₁ AlgebraicTopology.DoldKan.Compatibility.equivalence₁
theorem equivalence₁_inverse : (equivalence₁ hF).inverse = e'.inverse ⋙ eA.inverse :=
rfl
#align algebraic_topology.dold_kan.compatibility.equivalence₁_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₁_inverse
@[simps!]
def equivalence₁CounitIso : (e'.inverse ⋙ eA.inverse) ⋙ F ≅ 𝟭 B' :=
calc
(e'.inverse ⋙ eA.inverse) ⋙ F ≅ (e'.inverse ⋙ eA.inverse) ⋙ eA.functor ⋙ e'.functor :=
isoWhiskerLeft _ hF.symm
_ ≅ e'.inverse ⋙ (eA.inverse ⋙ eA.functor) ⋙ e'.functor := Iso.refl _
_ ≅ e'.inverse ⋙ 𝟭 _ ⋙ e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)
_ ≅ e'.inverse ⋙ e'.functor := Iso.refl _
_ ≅ 𝟭 B' := e'.counitIso
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso
theorem equivalence₁CounitIso_eq : (equivalence₁ hF).counitIso = equivalence₁CounitIso hF := by
ext Y
simp [equivalence₁, equivalence₀]
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso_eq
@[simps!]
def equivalence₁UnitIso : 𝟭 A ≅ F ⋙ e'.inverse ⋙ eA.inverse :=
calc
𝟭 A ≅ eA.functor ⋙ eA.inverse := eA.unitIso
_ ≅ eA.functor ⋙ 𝟭 A' ⋙ eA.inverse := Iso.refl _
_ ≅ eA.functor ⋙ (e'.functor ⋙ e'.inverse) ⋙ eA.inverse :=
isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)
_ ≅ (eA.functor ⋙ e'.functor) ⋙ e'.inverse ⋙ eA.inverse := Iso.refl _
_ ≅ F ⋙ e'.inverse ⋙ eA.inverse := isoWhiskerRight hF _
#align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso
| Mathlib/AlgebraicTopology/DoldKan/Compatibility.lean | 103 | 105 | theorem equivalence₁UnitIso_eq : (equivalence₁ hF).unitIso = equivalence₁UnitIso hF := by |
ext X
simp [equivalence₁]
| true |
import Mathlib.Topology.Algebra.UniformConvergence
#align_import topology.algebra.equicontinuity from "leanprover-community/mathlib"@"01ad394a11bf06b950232720cf7e8fc6b22f0d6a"
open Function
open UniformConvergence
@[to_additive]
theorem equicontinuous_of_equicontinuousAt_one {ι G M hom : Type*} [TopologicalSpace G]
[UniformSpace M] [Group G] [Group M] [TopologicalGroup G] [UniformGroup M]
[FunLike hom G M] [MonoidHomClass hom G M] (F : ι → hom)
(hf : EquicontinuousAt ((↑) ∘ F) (1 : G)) :
Equicontinuous ((↑) ∘ F) := by
rw [equicontinuous_iff_continuous]
rw [equicontinuousAt_iff_continuousAt] at hf
let φ : G →* (ι →ᵤ M) :=
{ toFun := swap ((↑) ∘ F)
map_one' := by dsimp [UniformFun]; ext; exact map_one _
map_mul' := fun a b => by dsimp [UniformFun]; ext; exact map_mul _ _ _ }
exact continuous_of_continuousAt_one φ hf
#align equicontinuous_of_equicontinuous_at_one equicontinuous_of_equicontinuousAt_one
#align equicontinuous_of_equicontinuous_at_zero equicontinuous_of_equicontinuousAt_zero
@[to_additive]
| Mathlib/Topology/Algebra/Equicontinuity.lean | 36 | 47 | theorem uniformEquicontinuous_of_equicontinuousAt_one {ι G M hom : Type*} [UniformSpace G]
[UniformSpace M] [Group G] [Group M] [UniformGroup G] [UniformGroup M]
[FunLike hom G M] [MonoidHomClass hom G M]
(F : ι → hom) (hf : EquicontinuousAt ((↑) ∘ F) (1 : G)) :
UniformEquicontinuous ((↑) ∘ F) := by |
rw [uniformEquicontinuous_iff_uniformContinuous]
rw [equicontinuousAt_iff_continuousAt] at hf
let φ : G →* (ι →ᵤ M) :=
{ toFun := swap ((↑) ∘ F)
map_one' := by dsimp [UniformFun]; ext; exact map_one _
map_mul' := fun a b => by dsimp [UniformFun]; ext; exact map_mul _ _ _ }
exact uniformContinuous_of_continuousAt_one φ hf
| false |
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.MkIffOfInductiveProp
#align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
universe u v w x
variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*}
namespace Sum
#align sum.forall Sum.forall
#align sum.exists Sum.exists
theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) :
(∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by
rw [← not_forall_not, forall_sum]
simp
theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj
#align sum.inl_injective Sum.inl_injective
theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj
#align sum.inr_injective Sum.inr_injective
theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i))
{x y : α ⊕ β} (h : x = y) :
@Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl
section get
#align sum.is_left Sum.isLeft
#align sum.is_right Sum.isRight
#align sum.get_left Sum.getLeft?
#align sum.get_right Sum.getRight?
variable {x y : Sum α β}
#align sum.get_left_eq_none_iff Sum.getLeft?_eq_none_iff
#align sum.get_right_eq_none_iff Sum.getRight?_eq_none_iff
theorem eq_left_iff_getLeft_eq {a : α} : x = inl a ↔ ∃ h, x.getLeft h = a := by
cases x <;> simp
| Mathlib/Data/Sum/Basic.lean | 57 | 58 | theorem eq_right_iff_getRight_eq {b : β} : x = inr b ↔ ∃ h, x.getRight h = b := by |
cases x <;> simp
| false |
import Mathlib.Topology.Separation
#align_import topology.sober from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open Set
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β]
section genericPoint
def IsGenericPoint (x : α) (S : Set α) : Prop :=
closure ({x} : Set α) = S
#align is_generic_point IsGenericPoint
theorem isGenericPoint_def {x : α} {S : Set α} : IsGenericPoint x S ↔ closure ({x} : Set α) = S :=
Iff.rfl
#align is_generic_point_def isGenericPoint_def
theorem IsGenericPoint.def {x : α} {S : Set α} (h : IsGenericPoint x S) :
closure ({x} : Set α) = S :=
h
#align is_generic_point.def IsGenericPoint.def
theorem isGenericPoint_closure {x : α} : IsGenericPoint x (closure ({x} : Set α)) :=
refl _
#align is_generic_point_closure isGenericPoint_closure
variable {x y : α} {S U Z : Set α}
theorem isGenericPoint_iff_specializes : IsGenericPoint x S ↔ ∀ y, x ⤳ y ↔ y ∈ S := by
simp only [specializes_iff_mem_closure, IsGenericPoint, Set.ext_iff]
#align is_generic_point_iff_specializes isGenericPoint_iff_specializes
section Sober
@[mk_iff]
class QuasiSober (α : Type*) [TopologicalSpace α] : Prop where
sober : ∀ {S : Set α}, IsIrreducible S → IsClosed S → ∃ x, IsGenericPoint x S
#align quasi_sober QuasiSober
noncomputable def IsIrreducible.genericPoint [QuasiSober α] {S : Set α} (hS : IsIrreducible S) :
α :=
(QuasiSober.sober hS.closure isClosed_closure).choose
#align is_irreducible.generic_point IsIrreducible.genericPoint
theorem IsIrreducible.genericPoint_spec [QuasiSober α] {S : Set α} (hS : IsIrreducible S) :
IsGenericPoint hS.genericPoint (closure S) :=
(QuasiSober.sober hS.closure isClosed_closure).choose_spec
#align is_irreducible.generic_point_spec IsIrreducible.genericPoint_spec
@[simp]
theorem IsIrreducible.genericPoint_closure_eq [QuasiSober α] {S : Set α} (hS : IsIrreducible S) :
closure ({hS.genericPoint} : Set α) = closure S :=
hS.genericPoint_spec
#align is_irreducible.generic_point_closure_eq IsIrreducible.genericPoint_closure_eq
variable (α)
noncomputable def genericPoint [QuasiSober α] [IrreducibleSpace α] : α :=
(IrreducibleSpace.isIrreducible_univ α).genericPoint
#align generic_point genericPoint
| Mathlib/Topology/Sober.lean | 148 | 150 | theorem genericPoint_spec [QuasiSober α] [IrreducibleSpace α] :
IsGenericPoint (genericPoint α) ⊤ := by |
simpa using (IrreducibleSpace.isIrreducible_univ α).genericPoint_spec
| false |
import Mathlib.Algebra.MonoidAlgebra.Division
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Order.Interval.Finset.Nat
#align_import data.polynomial.inductions from "leanprover-community/mathlib"@"57e09a1296bfb4330ddf6624f1028ba186117d82"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ}
section Semiring
variable [Semiring R] {p q : R[X]}
def divX (p : R[X]) : R[X] :=
⟨AddMonoidAlgebra.divOf p.toFinsupp 1⟩
set_option linter.uppercaseLean3 false in
#align polynomial.div_X Polynomial.divX
@[simp]
theorem coeff_divX : (divX p).coeff n = p.coeff (n + 1) := by
rw [add_comm]; cases p; rfl
set_option linter.uppercaseLean3 false in
#align polynomial.coeff_div_X Polynomial.coeff_divX
theorem divX_mul_X_add (p : R[X]) : divX p * X + C (p.coeff 0) = p :=
ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X]
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_mul_X_add Polynomial.divX_mul_X_add
@[simp]
theorem X_mul_divX_add (p : R[X]) : X * divX p + C (p.coeff 0) = p :=
ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X]
@[simp]
theorem divX_C (a : R) : divX (C a) = 0 :=
ext fun n => by simp [coeff_divX, coeff_C, Finsupp.single_eq_of_ne _]
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_C Polynomial.divX_C
theorem divX_eq_zero_iff : divX p = 0 ↔ p = C (p.coeff 0) :=
⟨fun h => by simpa [eq_comm, h] using divX_mul_X_add p, fun h => by rw [h, divX_C]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_eq_zero_iff Polynomial.divX_eq_zero_iff
theorem divX_add : divX (p + q) = divX p + divX q :=
ext <| by simp
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_add Polynomial.divX_add
@[simp]
theorem divX_zero : divX (0 : R[X]) = 0 := leadingCoeff_eq_zero.mp rfl
@[simp]
theorem divX_one : divX (1 : R[X]) = 0 := by
ext
simpa only [coeff_divX, coeff_zero] using coeff_one
@[simp]
| Mathlib/Algebra/Polynomial/Inductions.lean | 84 | 86 | theorem divX_C_mul : divX (C a * p) = C a * divX p := by |
ext
simp
| true |
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace PosNum
variable {α : Type*}
@[simp, norm_cast]
theorem cast_one [One α] [Add α] : ((1 : PosNum) : α) = 1 :=
rfl
#align pos_num.cast_one PosNum.cast_one
@[simp]
theorem cast_one' [One α] [Add α] : (PosNum.one : α) = 1 :=
rfl
#align pos_num.cast_one' PosNum.cast_one'
@[simp, norm_cast]
theorem cast_bit0 [One α] [Add α] (n : PosNum) : (n.bit0 : α) = _root_.bit0 (n : α) :=
rfl
#align pos_num.cast_bit0 PosNum.cast_bit0
@[simp, norm_cast]
theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = _root_.bit1 (n : α) :=
rfl
#align pos_num.cast_bit1 PosNum.cast_bit1
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| 1 => Nat.cast_one
| bit0 p => (Nat.cast_bit0 _).trans <| congr_arg _root_.bit0 p.cast_to_nat
| bit1 p => (Nat.cast_bit1 _).trans <| congr_arg _root_.bit1 p.cast_to_nat
#align pos_num.cast_to_nat PosNum.cast_to_nat
@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
| 1 => rfl
| bit0 p => rfl
| bit1 p =>
(congr_arg _root_.bit0 (succ_to_nat p)).trans <|
show ↑p + 1 + ↑p + 1 = ↑p + ↑p + 1 + 1 by simp [add_left_comm]
#align pos_num.succ_to_nat PosNum.succ_to_nat
| Mathlib/Data/Num/Lemmas.lean | 81 | 81 | theorem one_add (n : PosNum) : 1 + n = succ n := by | cases n <;> rfl
| false |
import Mathlib.Geometry.Manifold.Sheaf.Smooth
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
noncomputable section
universe u
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
{EM : Type*} [NormedAddCommGroup EM] [NormedSpace 𝕜 EM]
{HM : Type*} [TopologicalSpace HM] (IM : ModelWithCorners 𝕜 EM HM)
{M : Type u} [TopologicalSpace M] [ChartedSpace HM M]
open AlgebraicGeometry Manifold TopologicalSpace Topology
| Mathlib/Geometry/Manifold/Sheaf/LocallyRingedSpace.lean | 43 | 98 | theorem smoothSheafCommRing.isUnit_stalk_iff {x : M}
(f : (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf.stalk x) :
IsUnit f ↔ f ∉ RingHom.ker (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) := by |
constructor
· rintro ⟨⟨f, g, hf, hg⟩, rfl⟩ (h' : smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x f = 0)
simpa [h'] using congr_arg (smoothSheafCommRing.eval IM 𝓘(𝕜) M 𝕜 x) hf
· let S := (smoothSheafCommRing IM 𝓘(𝕜) M 𝕜).presheaf
-- Suppose that `f`, in the stalk at `x`, is nonzero at `x`
rintro (hf : _ ≠ 0)
-- Represent `f` as the germ of some function (also called `f`) on an open neighbourhood `U` of
-- `x`, which is nonzero at `x`
obtain ⟨U : Opens M, hxU, f : C^∞⟮IM, U; 𝓘(𝕜), 𝕜⟯, rfl⟩ := S.germ_exist x f
have hf' : f ⟨x, hxU⟩ ≠ 0 := by
convert hf
exact (smoothSheafCommRing.eval_germ U ⟨x, hxU⟩ f).symm
-- In fact, by continuity, `f` is nonzero on a neighbourhood `V` of `x`
have H : ∀ᶠ (z : U) in 𝓝 ⟨x, hxU⟩, f z ≠ 0 := f.2.continuous.continuousAt.eventually_ne hf'
rw [eventually_nhds_iff] at H
obtain ⟨V₀, hV₀f, hV₀, hxV₀⟩ := H
let V : Opens M := ⟨Subtype.val '' V₀, U.2.isOpenMap_subtype_val V₀ hV₀⟩
have hUV : V ≤ U := Subtype.coe_image_subset (U : Set M) V₀
have hV : V₀ = Set.range (Set.inclusion hUV) := by
convert (Set.range_inclusion hUV).symm
ext y
show _ ↔ y ∈ Subtype.val ⁻¹' (Subtype.val '' V₀)
rw [Set.preimage_image_eq _ Subtype.coe_injective]
clear_value V
subst hV
have hxV : x ∈ (V : Set M) := by
obtain ⟨x₀, hxx₀⟩ := hxV₀
convert x₀.2
exact congr_arg Subtype.val hxx₀.symm
have hVf : ∀ y : V, f (Set.inclusion hUV y) ≠ 0 :=
fun y ↦ hV₀f (Set.inclusion hUV y) (Set.mem_range_self y)
-- Let `g` be the pointwise inverse of `f` on `V`, which is smooth since `f` is nonzero there
let g : C^∞⟮IM, V; 𝓘(𝕜), 𝕜⟯ := ⟨(f ∘ Set.inclusion hUV)⁻¹, ?_⟩
-- The germ of `g` is inverse to the germ of `f`, so `f` is a unit
· refine ⟨⟨S.germ ⟨x, hxV⟩ (SmoothMap.restrictRingHom IM 𝓘(𝕜) 𝕜 hUV f), S.germ ⟨x, hxV⟩ g,
?_, ?_⟩, S.germ_res_apply hUV.hom ⟨x, hxV⟩ f⟩
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply mul_inv_cancel
exact hVf y
· rw [← map_mul]
-- Qualified the name to avoid Lean not finding a `OneHomClass` #8386
convert RingHom.map_one _
apply Subtype.ext
ext y
apply inv_mul_cancel
exact hVf y
· intro y
exact ((contDiffAt_inv _ (hVf y)).contMDiffAt).comp y
(f.smooth.comp (smooth_inclusion hUV)).smoothAt
| false |
import Mathlib.Order.Lattice
import Mathlib.Data.List.Sort
import Mathlib.Logic.Equiv.Fin
import Mathlib.Logic.Equiv.Functor
import Mathlib.Data.Fintype.Card
import Mathlib.Order.RelSeries
#align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada"
universe u
open Set RelSeries
class JordanHolderLattice (X : Type u) [Lattice X] where
IsMaximal : X → X → Prop
lt_of_isMaximal : ∀ {x y}, IsMaximal x y → x < y
sup_eq_of_isMaximal : ∀ {x y z}, IsMaximal x z → IsMaximal y z → x ≠ y → x ⊔ y = z
isMaximal_inf_left_of_isMaximal_sup :
∀ {x y}, IsMaximal x (x ⊔ y) → IsMaximal y (x ⊔ y) → IsMaximal (x ⊓ y) x
Iso : X × X → X × X → Prop
iso_symm : ∀ {x y}, Iso x y → Iso y x
iso_trans : ∀ {x y z}, Iso x y → Iso y z → Iso x z
second_iso : ∀ {x y}, IsMaximal x (x ⊔ y) → Iso (x, x ⊔ y) (x ⊓ y, y)
#align jordan_holder_lattice JordanHolderLattice
open JordanHolderLattice
attribute [symm] iso_symm
attribute [trans] iso_trans
abbrev CompositionSeries (X : Type u) [Lattice X] [JordanHolderLattice X] : Type u :=
RelSeries (IsMaximal (X := X))
#align composition_series CompositionSeries
namespace CompositionSeries
variable {X : Type u} [Lattice X] [JordanHolderLattice X]
#noalign composition_series.has_coe_to_fun
#align composition_series.has_inhabited RelSeries.instInhabited
#align composition_series.step RelSeries.membership
theorem lt_succ (s : CompositionSeries X) (i : Fin s.length) :
s (Fin.castSucc i) < s (Fin.succ i) :=
lt_of_isMaximal (s.step _)
#align composition_series.lt_succ CompositionSeries.lt_succ
protected theorem strictMono (s : CompositionSeries X) : StrictMono s :=
Fin.strictMono_iff_lt_succ.2 s.lt_succ
#align composition_series.strict_mono CompositionSeries.strictMono
protected theorem injective (s : CompositionSeries X) : Function.Injective s :=
s.strictMono.injective
#align composition_series.injective CompositionSeries.injective
@[simp]
protected theorem inj (s : CompositionSeries X) {i j : Fin s.length.succ} : s i = s j ↔ i = j :=
s.injective.eq_iff
#align composition_series.inj CompositionSeries.inj
#align composition_series.has_mem RelSeries.membership
#align composition_series.mem_def RelSeries.mem_def
| Mathlib/Order/JordanHolder.lean | 173 | 177 | theorem total {s : CompositionSeries X} {x y : X} (hx : x ∈ s) (hy : y ∈ s) : x ≤ y ∨ y ≤ x := by |
rcases Set.mem_range.1 hx with ⟨i, rfl⟩
rcases Set.mem_range.1 hy with ⟨j, rfl⟩
rw [s.strictMono.le_iff_le, s.strictMono.le_iff_le]
exact le_total i j
| true |
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.Sets.Closeds
open Function Set Filter TopologicalSpace
open scoped Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [CompactSpace Y]
| Mathlib/Topology/ClopenBox.lean | 36 | 44 | theorem TopologicalSpace.Clopens.exists_prod_subset (W : Clopens (X × Y)) {a : X × Y} (h : a ∈ W) :
∃ U : Clopens X, a.1 ∈ U ∧ ∃ V : Clopens Y, a.2 ∈ V ∧ U ×ˢ V ≤ W := by |
have hp : Continuous (fun y : Y ↦ (a.1, y)) := Continuous.Prod.mk _
let V : Set Y := {y | (a.1, y) ∈ W}
have hV : IsCompact V := (W.2.1.preimage hp).isCompact
let U : Set X := {x | MapsTo (Prod.mk x) V W}
have hUV : U ×ˢ V ⊆ W := fun ⟨_, _⟩ hw ↦ hw.1 hw.2
exact ⟨⟨U, (ContinuousMap.isClopen_setOf_mapsTo hV W.2).preimage
(ContinuousMap.id (X × Y)).curry.2⟩, by simp [U, V, MapsTo], ⟨V, W.2.preimage hp⟩, h, hUV⟩
| false |
import Mathlib.Order.Interval.Finset.Nat
#align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
assert_not_exists MonoidWithZero
open Finset Fin Function
namespace Fin
variable (n : ℕ)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) :=
OrderIso.locallyFiniteOrder Fin.orderIsoSubtype
instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) :=
OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype
instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n)
| 0 => IsEmpty.toLocallyFiniteOrderTop
| _ + 1 => inferInstance
variable {n} (a b : Fin n)
theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n :=
rfl
#align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype
theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n :=
rfl
#align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype
theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n :=
rfl
#align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype
theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n :=
rfl
#align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype
theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl
#align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype
@[simp]
theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by
simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc
@[simp]
theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by
simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico
@[simp]
theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by
simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right]
#align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc
@[simp]
theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by
simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map]
#align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo
@[simp]
theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b :=
map_valEmbedding_Icc _ _
#align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a := by
rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map]
#align fin.card_Icc Fin.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map]
#align fin.card_Ico Fin.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a := by
rw [← Nat.card_Ioc, ← map_valEmbedding_Ioc, card_map]
#align fin.card_Ioc Fin.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 := by
rw [← Nat.card_Ioo, ← map_valEmbedding_Ioo, card_map]
#align fin.card_Ioo Fin.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 := by
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
#align fin.card_uIcc Fin.card_uIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [← card_Icc, Fintype.card_ofFinset]
#align fin.card_fintype_Icc Fin.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [← card_Ico, Fintype.card_ofFinset]
#align fin.card_fintype_Ico Fin.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [← card_Ioc, Fintype.card_ofFinset]
#align fin.card_fintype_Ioc Fin.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Fin.lean | 148 | 149 | theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by |
rw [← card_Ioo, Fintype.card_ofFinset]
| false |
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
| false |
import Mathlib.CategoryTheory.Sites.Sieves
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.Order.Copy
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.sites.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe v₁ u₁ v u
namespace CategoryTheory
open CategoryTheory Category
variable (C : Type u) [Category.{v} C]
structure GrothendieckTopology where
sieves : ∀ X : C, Set (Sieve X)
top_mem' : ∀ X, ⊤ ∈ sieves X
pullback_stable' : ∀ ⦃X Y : C⦄ ⦃S : Sieve X⦄ (f : Y ⟶ X), S ∈ sieves X → S.pullback f ∈ sieves Y
transitive' :
∀ ⦃X⦄ ⦃S : Sieve X⦄ (_ : S ∈ sieves X) (R : Sieve X),
(∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ sieves Y) → R ∈ sieves X
#align category_theory.grothendieck_topology CategoryTheory.GrothendieckTopology
namespace GrothendieckTopology
instance : CoeFun (GrothendieckTopology C) fun _ => ∀ X : C, Set (Sieve X) :=
⟨sieves⟩
variable {C}
variable {X Y : C} {S R : Sieve X}
variable (J : GrothendieckTopology C)
@[ext]
theorem ext {J₁ J₂ : GrothendieckTopology C} (h : (J₁ : ∀ X : C, Set (Sieve X)) = J₂) :
J₁ = J₂ := by
cases J₁
cases J₂
congr
#align category_theory.grothendieck_topology.ext CategoryTheory.GrothendieckTopology.ext
@[simp]
theorem top_mem (X : C) : ⊤ ∈ J X :=
J.top_mem' X
#align category_theory.grothendieck_topology.top_mem CategoryTheory.GrothendieckTopology.top_mem
@[simp]
theorem pullback_stable (f : Y ⟶ X) (hS : S ∈ J X) : S.pullback f ∈ J Y :=
J.pullback_stable' f hS
#align category_theory.grothendieck_topology.pullback_stable CategoryTheory.GrothendieckTopology.pullback_stable
theorem transitive (hS : S ∈ J X) (R : Sieve X) (h : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → R.pullback f ∈ J Y) :
R ∈ J X :=
J.transitive' hS R h
#align category_theory.grothendieck_topology.transitive CategoryTheory.GrothendieckTopology.transitive
theorem covering_of_eq_top : S = ⊤ → S ∈ J X := fun h => h.symm ▸ J.top_mem X
#align category_theory.grothendieck_topology.covering_of_eq_top CategoryTheory.GrothendieckTopology.covering_of_eq_top
theorem superset_covering (Hss : S ≤ R) (sjx : S ∈ J X) : R ∈ J X := by
apply J.transitive sjx R fun Y f hf => _
intros Y f hf
apply covering_of_eq_top
rw [← top_le_iff, ← S.pullback_eq_top_of_mem hf]
apply Sieve.pullback_monotone _ Hss
#align category_theory.grothendieck_topology.superset_covering CategoryTheory.GrothendieckTopology.superset_covering
theorem intersection_covering (rj : R ∈ J X) (sj : S ∈ J X) : R ⊓ S ∈ J X := by
apply J.transitive rj _ fun Y f Hf => _
intros Y f hf
rw [Sieve.pullback_inter, R.pullback_eq_top_of_mem hf]
simp [sj]
#align category_theory.grothendieck_topology.intersection_covering CategoryTheory.GrothendieckTopology.intersection_covering
@[simp]
theorem intersection_covering_iff : R ⊓ S ∈ J X ↔ R ∈ J X ∧ S ∈ J X :=
⟨fun h => ⟨J.superset_covering inf_le_left h, J.superset_covering inf_le_right h⟩, fun t =>
intersection_covering _ t.1 t.2⟩
#align category_theory.grothendieck_topology.intersection_covering_iff CategoryTheory.GrothendieckTopology.intersection_covering_iff
theorem bind_covering {S : Sieve X} {R : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, S f → Sieve Y} (hS : S ∈ J X)
(hR : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄ (H : S f), R H ∈ J Y) : Sieve.bind S R ∈ J X :=
J.transitive hS _ fun _ f hf => superset_covering J (Sieve.le_pullback_bind S R f hf) (hR hf)
#align category_theory.grothendieck_topology.bind_covering CategoryTheory.GrothendieckTopology.bind_covering
def Covers (S : Sieve X) (f : Y ⟶ X) : Prop :=
S.pullback f ∈ J Y
#align category_theory.grothendieck_topology.covers CategoryTheory.GrothendieckTopology.Covers
theorem covers_iff (S : Sieve X) (f : Y ⟶ X) : J.Covers S f ↔ S.pullback f ∈ J Y :=
Iff.rfl
#align category_theory.grothendieck_topology.covers_iff CategoryTheory.GrothendieckTopology.covers_iff
| Mathlib/CategoryTheory/Sites/Grothendieck.lean | 187 | 187 | theorem covering_iff_covers_id (S : Sieve X) : S ∈ J X ↔ J.Covers S (𝟙 X) := by | simp [covers_iff]
| true |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Module.Torsion
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v v' u₁' w w'
variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum
variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁]
variable [Module R M] [Module R M'] [Module R M₁]
section Finsupp
variable (R M M')
variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M']
open Module.Free
@[simp]
theorem rank_finsupp (ι : Type w) :
Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by
obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma,
Cardinal.sum_const]
#align rank_finsupp rank_finsupp
theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by
simp [rank_finsupp]
#align rank_finsupp' rank_finsupp'
-- Porting note, this should not be `@[simp]`, as simp can prove it.
-- @[simp]
theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by
simp [rank_finsupp]
#align rank_finsupp_self rank_finsupp_self
theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp
#align rank_finsupp_self' rank_finsupp_self'
@[simp]
theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)]
[∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] :
Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by
let B i := chooseBasis R (M i)
let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i
simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank'']
#align rank_direct_sum rank_directSum
@[simp]
theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) =
Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by
cases nonempty_fintype m
cases nonempty_fintype n
have h := (Matrix.stdBasis R m n).mk_eq_rank
rw [← lift_lift.{max v w u, max v w}, lift_inj] at h
simpa using h.symm
#align rank_matrix rank_matrix
@[simp high]
theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by
rw [rank_matrix, lift_mul, lift_umax.{v, u}]
#align rank_matrix' rank_matrix'
-- @[simp] -- Porting note (#10618): simp can prove this
theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = #m * #n := by simp
#align rank_matrix'' rank_matrix''
variable [Module.Finite R M] [Module.Finite R M']
open Fintype
namespace FiniteDimensional
@[simp]
theorem finrank_finsupp {ι : Type v} [Fintype ι] : finrank R (ι →₀ M) = card ι * finrank R M := by
rw [finrank, finrank, rank_finsupp, ← mk_toNat_eq_card, toNat_mul, toNat_lift, toNat_lift]
@[simp]
theorem finrank_finsupp_self {ι : Type v} [Fintype ι] : finrank R (ι →₀ R) = card ι := by
rw [finrank, rank_finsupp_self, ← mk_toNat_eq_card, toNat_lift]
#align finite_dimensional.finrank_finsupp FiniteDimensional.finrank_finsupp_self
@[simp]
| Mathlib/LinearAlgebra/Dimension/Constructions.lean | 241 | 246 | theorem finrank_directSum {ι : Type v} [Fintype ι] (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)]
[∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] [∀ i : ι, Module.Finite R (M i)] :
finrank R (⨁ i, M i) = ∑ i, finrank R (M i) := by |
letI := nontrivial_of_invariantBasisNumber R
simp only [finrank, fun i => rank_eq_card_chooseBasisIndex R (M i), rank_directSum, ← mk_sigma,
mk_toNat_eq_card, card_sigma]
| false |
import Mathlib.Combinatorics.SetFamily.HarrisKleitman
import Mathlib.Combinatorics.SetFamily.Intersecting
#align_import combinatorics.set_family.kleitman from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Finset
open Fintype (card)
variable {ι α : Type*} [Fintype α] [DecidableEq α] [Nonempty α]
| Mathlib/Combinatorics/SetFamily/Kleitman.lean | 37 | 85 | theorem Finset.card_biUnion_le_of_intersecting (s : Finset ι) (f : ι → Finset (Finset α))
(hf : ∀ i ∈ s, (f i : Set (Finset α)).Intersecting) :
(s.biUnion f).card ≤ 2 ^ Fintype.card α - 2 ^ (Fintype.card α - s.card) := by |
have : DecidableEq ι := by
classical
infer_instance
obtain hs | hs := le_total (Fintype.card α) s.card
· rw [tsub_eq_zero_of_le hs, pow_zero]
refine (card_le_card <| biUnion_subset.2 fun i hi a ha ↦
mem_compl.2 <| not_mem_singleton.2 <| (hf _ hi).ne_bot ha).trans_eq ?_
rw [card_compl, Fintype.card_finset, card_singleton]
induction' s using Finset.cons_induction with i s hi ih generalizing f
· simp
set f' : ι → Finset (Finset α) :=
fun j ↦ if hj : j ∈ cons i s hi then (hf j hj).exists_card_eq.choose else ∅
have hf₁ : ∀ j, j ∈ cons i s hi → f j ⊆ f' j ∧ 2 * (f' j).card =
2 ^ Fintype.card α ∧ (f' j : Set (Finset α)).Intersecting := by
rintro j hj
simp_rw [f', dif_pos hj, ← Fintype.card_finset]
exact Classical.choose_spec (hf j hj).exists_card_eq
have hf₂ : ∀ j, j ∈ cons i s hi → IsUpperSet (f' j : Set (Finset α)) := by
refine fun j hj ↦ (hf₁ _ hj).2.2.isUpperSet' ((hf₁ _ hj).2.2.is_max_iff_card_eq.2 ?_)
rw [Fintype.card_finset]
exact (hf₁ _ hj).2.1
refine (card_le_card <| biUnion_mono fun j hj ↦ (hf₁ _ hj).1).trans ?_
nth_rw 1 [cons_eq_insert i]
rw [biUnion_insert]
refine (card_mono <| @le_sup_sdiff _ _ _ <| f' i).trans ((card_union_le _ _).trans ?_)
rw [union_sdiff_left, sdiff_eq_inter_compl]
refine le_of_mul_le_mul_left ?_ (pow_pos (zero_lt_two' ℕ) <| Fintype.card α + 1)
rw [pow_succ, mul_add, mul_assoc, mul_comm _ 2, mul_assoc]
refine (add_le_add
((mul_le_mul_left <| pow_pos (zero_lt_two' ℕ) _).2
(hf₁ _ <| mem_cons_self _ _).2.2.card_le) <|
(mul_le_mul_left <| zero_lt_two' ℕ).2 <| IsUpperSet.card_inter_le_finset ?_ ?_).trans ?_
· rw [coe_biUnion]
exact isUpperSet_iUnion₂ fun i hi ↦ hf₂ _ <| subset_cons _ hi
· rw [coe_compl]
exact (hf₂ _ <| mem_cons_self _ _).compl
rw [mul_tsub, card_compl, Fintype.card_finset, mul_left_comm, mul_tsub,
(hf₁ _ <| mem_cons_self _ _).2.1, two_mul, add_tsub_cancel_left, ← mul_tsub, ← mul_two,
mul_assoc, ← add_mul, mul_comm]
refine mul_le_mul_left' ?_ _
refine (add_le_add_left
(ih _ (fun i hi ↦ (hf₁ _ <| subset_cons _ hi).2.2)
((card_le_card <| subset_cons _).trans hs)) _).trans ?_
rw [mul_tsub, two_mul, ← pow_succ',
← add_tsub_assoc_of_le (pow_le_pow_right' (one_le_two : (1 : ℕ) ≤ 2) tsub_le_self),
tsub_add_eq_add_tsub hs, card_cons, add_tsub_add_eq_tsub_right]
| false |
import Mathlib.Control.Functor.Multivariate
import Mathlib.Data.PFunctor.Univariate.Basic
#align_import data.pfunctor.multivariate.basic from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d"
universe u v
open MvFunctor
@[pp_with_univ]
structure MvPFunctor (n : ℕ) where
A : Type u
B : A → TypeVec.{u} n
#align mvpfunctor MvPFunctor
namespace MvPFunctor
open MvFunctor (LiftP LiftR)
variable {n m : ℕ} (P : MvPFunctor.{u} n)
@[coe]
def Obj (α : TypeVec.{u} n) : Type u :=
Σ a : P.A, P.B a ⟹ α
#align mvpfunctor.obj MvPFunctor.Obj
instance : CoeFun (MvPFunctor.{u} n) (fun _ => TypeVec.{u} n → Type u) where
coe := Obj
def map {α β : TypeVec n} (f : α ⟹ β) : P α → P β := fun ⟨a, g⟩ => ⟨a, TypeVec.comp f g⟩
#align mvpfunctor.map MvPFunctor.map
instance : Inhabited (MvPFunctor n) :=
⟨⟨default, default⟩⟩
instance Obj.inhabited {α : TypeVec n} [Inhabited P.A] [∀ i, Inhabited (α i)] :
Inhabited (P α) :=
⟨⟨default, fun _ _ => default⟩⟩
#align mvpfunctor.obj.inhabited MvPFunctor.Obj.inhabited
instance : MvFunctor.{u} P.Obj :=
⟨@MvPFunctor.map n P⟩
theorem map_eq {α β : TypeVec n} (g : α ⟹ β) (a : P.A) (f : P.B a ⟹ α) :
@MvFunctor.map _ P.Obj _ _ _ g ⟨a, f⟩ = ⟨a, g ⊚ f⟩ :=
rfl
#align mvpfunctor.map_eq MvPFunctor.map_eq
theorem id_map {α : TypeVec n} : ∀ x : P α, TypeVec.id <$$> x = x
| ⟨_, _⟩ => rfl
#align mvpfunctor.id_map MvPFunctor.id_map
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) :
∀ x : P α, (g ⊚ f) <$$> x = g <$$> f <$$> x
| ⟨_, _⟩ => rfl
#align mvpfunctor.comp_map MvPFunctor.comp_map
instance : LawfulMvFunctor.{u} P.Obj where
id_map := @id_map _ P
comp_map := @comp_map _ P
def const (n : ℕ) (A : Type u) : MvPFunctor n :=
{ A
B := fun _ _ => PEmpty }
#align mvpfunctor.const MvPFunctor.const
def comp (P : MvPFunctor.{u} n) (Q : Fin2 n → MvPFunctor.{u} m) : MvPFunctor m where
A := Σ a₂ : P.1, ∀ i, P.2 a₂ i → (Q i).1
B a i := Σ(j : _) (b : P.2 a.1 j), (Q j).2 (a.snd j b) i
#align mvpfunctor.comp MvPFunctor.comp
variable {P} {Q : Fin2 n → MvPFunctor.{u} m} {α β : TypeVec.{u} m}
def comp.mk (x : P (fun i => Q i α)) : comp P Q α :=
⟨⟨x.1, fun _ a => (x.2 _ a).1⟩, fun i a => (x.snd a.fst a.snd.fst).snd i a.snd.snd⟩
#align mvpfunctor.comp.mk MvPFunctor.comp.mk
def comp.get (x : comp P Q α) : P (fun i => Q i α) :=
⟨x.1.1, fun i a => ⟨x.fst.snd i a, fun (j : Fin2 m) (b : (Q i).B _ j) => x.snd j ⟨i, ⟨a, b⟩⟩⟩⟩
#align mvpfunctor.comp.get MvPFunctor.comp.get
theorem comp.get_map (f : α ⟹ β) (x : comp P Q α) :
comp.get (f <$$> x) = (fun i (x : Q i α) => f <$$> x) <$$> comp.get x := by
rfl
#align mvpfunctor.comp.get_map MvPFunctor.comp.get_map
@[simp]
theorem comp.get_mk (x : P (fun i => Q i α)) : comp.get (comp.mk x) = x := by
rfl
#align mvpfunctor.comp.get_mk MvPFunctor.comp.get_mk
@[simp]
theorem comp.mk_get (x : comp P Q α) : comp.mk (comp.get x) = x := by
rfl
#align mvpfunctor.comp.mk_get MvPFunctor.comp.mk_get
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : P α) :
LiftP p x ↔ ∃ a f, x = ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor
· rintro ⟨y, hy⟩
cases' h : y with a f
refine ⟨a, fun i j => (f i j).val, ?_, fun i j => (f i j).property⟩
rw [← hy, h, map_eq]
rfl
rintro ⟨a, f, xeq, pf⟩
use ⟨a, fun i j => ⟨f i j, pf i j⟩⟩
rw [xeq]; rfl
#align mvpfunctor.liftp_iff MvPFunctor.liftP_iff
| Mathlib/Data/PFunctor/Multivariate/Basic.lean | 173 | 179 | theorem liftP_iff' {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (a : P.A) (f : P.B a ⟹ α) :
@LiftP.{u} _ P.Obj _ α p ⟨a, f⟩ ↔ ∀ i x, p (f i x) := by |
simp only [liftP_iff, Sigma.mk.inj_iff]; constructor
· rintro ⟨_, _, ⟨⟩, _⟩
assumption
· intro
repeat' first |constructor|assumption
| false |
import Mathlib.CategoryTheory.Preadditive.Injective
import Mathlib.Algebra.Category.ModuleCat.EpiMono
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.Logic.Equiv.TransferInstance
#align_import algebra.module.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946"
noncomputable section
universe u v v'
variable (R : Type u) [Ring R] (Q : Type v) [AddCommGroup Q] [Module R Q]
@[mk_iff] class Module.Injective : Prop where
out : ∀ ⦃X Y : Type v⦄ [AddCommGroup X] [AddCommGroup Y] [Module R X] [Module R Y]
(f : X →ₗ[R] Y) (_ : Function.Injective f) (g : X →ₗ[R] Q),
∃ h : Y →ₗ[R] Q, ∀ x, h (f x) = g x
#align module.injective Module.Injective
theorem Module.injective_object_of_injective_module [inj : Module.Injective R Q] :
CategoryTheory.Injective (ModuleCat.of R Q) where
factors g f m :=
have ⟨l, h⟩ := inj.out f ((ModuleCat.mono_iff_injective f).mp m) g
⟨l, LinearMap.ext h⟩
#align module.injective_object_of_injective_module Module.injective_object_of_injective_module
theorem Module.injective_module_of_injective_object
[inj : CategoryTheory.Injective <| ModuleCat.of R Q] :
Module.Injective R Q where
out X Y _ _ _ _ f hf g := by
have : CategoryTheory.Mono (ModuleCat.ofHom f) := (ModuleCat.mono_iff_injective _).mpr hf
obtain ⟨l, rfl⟩ := inj.factors (ModuleCat.ofHom g) (ModuleCat.ofHom f)
exact ⟨l, fun _ ↦ rfl⟩
#align module.injective_module_of_injective_object Module.injective_module_of_injective_object
theorem Module.injective_iff_injective_object :
Module.Injective R Q ↔
CategoryTheory.Injective (ModuleCat.of R Q) :=
⟨fun _ => injective_object_of_injective_module R Q,
fun _ => injective_module_of_injective_object R Q⟩
#align module.injective_iff_injective_object Module.injective_iff_injective_object
def Module.Baer : Prop :=
∀ (I : Ideal R) (g : I →ₗ[R] Q), ∃ g' : R →ₗ[R] Q, ∀ (x : R) (mem : x ∈ I), g' x = g ⟨x, mem⟩
set_option linter.uppercaseLean3 false in
#align module.Baer Module.Baer
namespace Module.Baer
variable {R Q} {M N : Type*} [AddCommGroup M] [AddCommGroup N]
variable [Module R M] [Module R N] (i : M →ₗ[R] N) (f : M →ₗ[R] Q)
structure ExtensionOf extends LinearPMap R N Q where
le : LinearMap.range i ≤ domain
is_extension : ∀ m : M, f m = toLinearPMap ⟨i m, le ⟨m, rfl⟩⟩
set_option linter.uppercaseLean3 false in
#align module.Baer.extension_of Module.Baer.ExtensionOf
section Ext
variable {i f}
@[ext]
| Mathlib/Algebra/Module/Injective.lean | 112 | 119 | theorem ExtensionOf.ext {a b : ExtensionOf i f} (domain_eq : a.domain = b.domain)
(to_fun_eq :
∀ ⦃x : a.domain⦄ ⦃y : b.domain⦄, (x : N) = y → a.toLinearPMap x = b.toLinearPMap y) :
a = b := by |
rcases a with ⟨a, a_le, e1⟩
rcases b with ⟨b, b_le, e2⟩
congr
exact LinearPMap.ext domain_eq to_fun_eq
| false |
import Mathlib.Topology.Algebra.UniformConvergence
#align_import topology.algebra.module.strong_topology from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
open scoped Topology UniformConvergence
section General
variable {𝕜₁ 𝕜₂ : Type*} [NormedField 𝕜₁] [NormedField 𝕜₂] (σ : 𝕜₁ →+* 𝕜₂) {E E' F F' : Type*}
[AddCommGroup E] [Module 𝕜₁ E] [AddCommGroup E'] [Module ℝ E'] [AddCommGroup F] [Module 𝕜₂ F]
[AddCommGroup F'] [Module ℝ F'] [TopologicalSpace E] [TopologicalSpace E'] (F)
@[nolint unusedArguments]
def UniformConvergenceCLM [TopologicalSpace F] [TopologicalAddGroup F] (_ : Set (Set E)) :=
E →SL[σ] F
namespace UniformConvergenceCLM
instance instFunLike [TopologicalSpace F] [TopologicalAddGroup F]
(𝔖 : Set (Set E)) : FunLike (UniformConvergenceCLM σ F 𝔖) E F :=
ContinuousLinearMap.funLike
instance instContinuousSemilinearMapClass [TopologicalSpace F] [TopologicalAddGroup F]
(𝔖 : Set (Set E)) : ContinuousSemilinearMapClass (UniformConvergenceCLM σ F 𝔖) σ E F :=
ContinuousLinearMap.continuousSemilinearMapClass
instance instTopologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] (𝔖 : Set (Set E)) :
TopologicalSpace (UniformConvergenceCLM σ F 𝔖) :=
(@UniformOnFun.topologicalSpace E F (TopologicalAddGroup.toUniformSpace F) 𝔖).induced
(DFunLike.coe : (UniformConvergenceCLM σ F 𝔖) → (E →ᵤ[𝔖] F))
#align continuous_linear_map.strong_topology UniformConvergenceCLM.instTopologicalSpace
| Mathlib/Topology/Algebra/Module/StrongTopology.lean | 96 | 101 | theorem topologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (𝔖 : Set (Set E)) :
instTopologicalSpace σ F 𝔖 = TopologicalSpace.induced DFunLike.coe
(UniformOnFun.topologicalSpace E F 𝔖) := by |
rw [instTopologicalSpace]
congr
exact UniformAddGroup.toUniformSpace_eq
| false |
import Mathlib.Algebra.Homology.ImageToKernel
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.CategoryTheory.GradedObject
#align_import algebra.homology.homology from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
variable {c : ComplexShape ι} (C : HomologicalComplex V c)
open scoped Classical
open ZeroObject
noncomputable section
namespace HomologicalComplex
section Cycles
variable [HasKernels V]
abbrev cycles' (i : ι) : Subobject (C.X i) :=
kernelSubobject (C.dFrom i)
#align homological_complex.cycles HomologicalComplex.cycles'
theorem cycles'_eq_kernelSubobject {i j : ι} (r : c.Rel i j) :
C.cycles' i = kernelSubobject (C.d i j) :=
C.kernel_from_eq_kernel r
#align homological_complex.cycles_eq_kernel_subobject HomologicalComplex.cycles'_eq_kernelSubobject
def cycles'IsoKernel {i j : ι} (r : c.Rel i j) : (C.cycles' i : V) ≅ kernel (C.d i j) :=
Subobject.isoOfEq _ _ (C.cycles'_eq_kernelSubobject r) ≪≫ kernelSubobjectIso (C.d i j)
#align homological_complex.cycles_iso_kernel HomologicalComplex.cycles'IsoKernel
| Mathlib/Algebra/Homology/Homology.lean | 68 | 71 | theorem cycles_eq_top {i} (h : ¬c.Rel i (c.next i)) : C.cycles' i = ⊤ := by |
rw [eq_top_iff]
apply le_kernelSubobject
rw [C.dFrom_eq_zero h, comp_zero]
| false |
import Mathlib.MeasureTheory.Measure.Typeclasses
#align_import measure_theory.decomposition.unsigned_hahn from "leanprover-community/mathlib"@"0f1becb755b3d008b242c622e248a70556ad19e6"
open Set Filter
open scoped Classical
open Topology ENNReal
namespace MeasureTheory
variable {α : Type*} [MeasurableSpace α] {μ ν : Measure α}
| Mathlib/MeasureTheory/Decomposition/UnsignedHahn.lean | 37 | 176 | theorem hahn_decomposition [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
∃ s,
MeasurableSet s ∧
(∀ t, MeasurableSet t → t ⊆ s → ν t ≤ μ t) ∧ ∀ t, MeasurableSet t → t ⊆ sᶜ → μ t ≤ ν t := by |
let d : Set α → ℝ := fun s => ((μ s).toNNReal : ℝ) - (ν s).toNNReal
let c : Set ℝ := d '' { s | MeasurableSet s }
let γ : ℝ := sSup c
have hμ : ∀ s, μ s ≠ ∞ := measure_ne_top μ
have hν : ∀ s, ν s ≠ ∞ := measure_ne_top ν
have to_nnreal_μ : ∀ s, ((μ s).toNNReal : ℝ≥0∞) = μ s := fun s => ENNReal.coe_toNNReal <| hμ _
have to_nnreal_ν : ∀ s, ((ν s).toNNReal : ℝ≥0∞) = ν s := fun s => ENNReal.coe_toNNReal <| hν _
have d_split : ∀ s t, MeasurableSet s → MeasurableSet t → d s = d (s \ t) + d (s ∩ t) := by
intro s t _hs ht
dsimp only [d]
rw [← measure_inter_add_diff s ht, ← measure_inter_add_diff s ht,
ENNReal.toNNReal_add (hμ _) (hμ _), ENNReal.toNNReal_add (hν _) (hν _), NNReal.coe_add,
NNReal.coe_add]
simp only [sub_eq_add_neg, neg_add]
abel
have d_Union :
∀ s : ℕ → Set α, Monotone s → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋃ n, s n))) := by
intro s hm
refine Tendsto.sub ?_ ?_ <;>
refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal ?_).comp <| tendsto_measure_iUnion hm
· exact hμ _
· exact hν _
have d_Inter :
∀ s : ℕ → Set α,
(∀ n, MeasurableSet (s n)) →
(∀ n m, n ≤ m → s m ⊆ s n) → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋂ n, s n))) := by
intro s hs hm
refine Tendsto.sub ?_ ?_ <;>
refine
NNReal.tendsto_coe.2 <|
(ENNReal.tendsto_toNNReal <| ?_).comp <| tendsto_measure_iInter hs hm ?_
exacts [hμ _, ⟨0, hμ _⟩, hν _, ⟨0, hν _⟩]
have bdd_c : BddAbove c := by
use (μ univ).toNNReal
rintro r ⟨s, _hs, rfl⟩
refine le_trans (sub_le_self _ <| NNReal.coe_nonneg _) ?_
rw [NNReal.coe_le_coe, ← ENNReal.coe_le_coe, to_nnreal_μ, to_nnreal_μ]
exact measure_mono (subset_univ _)
have c_nonempty : c.Nonempty := Nonempty.image _ ⟨_, MeasurableSet.empty⟩
have d_le_γ : ∀ s, MeasurableSet s → d s ≤ γ := fun s hs => le_csSup bdd_c ⟨s, hs, rfl⟩
have : ∀ n : ℕ, ∃ s : Set α, MeasurableSet s ∧ γ - (1 / 2) ^ n < d s := by
intro n
have : γ - (1 / 2) ^ n < γ := sub_lt_self γ (pow_pos (half_pos zero_lt_one) n)
rcases exists_lt_of_lt_csSup c_nonempty this with ⟨r, ⟨s, hs, rfl⟩, hlt⟩
exact ⟨s, hs, hlt⟩
rcases Classical.axiom_of_choice this with ⟨e, he⟩
change ℕ → Set α at e
have he₁ : ∀ n, MeasurableSet (e n) := fun n => (he n).1
have he₂ : ∀ n, γ - (1 / 2) ^ n < d (e n) := fun n => (he n).2
let f : ℕ → ℕ → Set α := fun n m => (Finset.Ico n (m + 1)).inf e
have hf : ∀ n m, MeasurableSet (f n m) := by
intro n m
simp only [f, Finset.inf_eq_iInf]
exact MeasurableSet.biInter (to_countable _) fun i _ => he₁ _
have f_subset_f : ∀ {a b c d}, a ≤ b → c ≤ d → f a d ⊆ f b c := by
intro a b c d hab hcd
simp_rw [f, Finset.inf_eq_iInf]
exact biInter_subset_biInter_left (Finset.Ico_subset_Ico hab <| Nat.succ_le_succ hcd)
have f_succ : ∀ n m, n ≤ m → f n (m + 1) = f n m ∩ e (m + 1) := by
intro n m hnm
have : n ≤ m + 1 := le_of_lt (Nat.succ_le_succ hnm)
simp_rw [f, Nat.Ico_succ_right_eq_insert_Ico this, Finset.inf_insert, Set.inter_comm]
rfl
have le_d_f : ∀ n m, m ≤ n → γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n ≤ d (f m n) := by
intro n m h
refine Nat.le_induction ?_ ?_ n h
· have := he₂ m
simp_rw [f, Nat.Ico_succ_singleton, Finset.inf_singleton]
linarith
· intro n (hmn : m ≤ n) ih
have : γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) ≤ γ + d (f m (n + 1)) := by
calc
γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) =
γ + (γ - 2 * (1 / 2) ^ m + ((1 / 2) ^ n - (1 / 2) ^ (n + 1))) := by
rw [pow_succ, mul_one_div, _root_.sub_half]
_ = γ - (1 / 2) ^ (n + 1) + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n) := by
simp only [sub_eq_add_neg]; abel
_ ≤ d (e (n + 1)) + d (f m n) := add_le_add (le_of_lt <| he₂ _) ih
_ ≤ d (e (n + 1)) + d (f m n \ e (n + 1)) + d (f m (n + 1)) := by
rw [f_succ _ _ hmn, d_split (f m n) (e (n + 1)) (hf _ _) (he₁ _), add_assoc]
_ = d (e (n + 1) ∪ f m n) + d (f m (n + 1)) := by
rw [d_split (e (n + 1) ∪ f m n) (e (n + 1)), union_diff_left, union_inter_cancel_left]
· abel
· exact (he₁ _).union (hf _ _)
· exact he₁ _
_ ≤ γ + d (f m (n + 1)) := add_le_add_right (d_le_γ _ <| (he₁ _).union (hf _ _)) _
exact (add_le_add_iff_left γ).1 this
let s := ⋃ m, ⋂ n, f m n
have γ_le_d_s : γ ≤ d s := by
have hγ : Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 γ) := by
suffices Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 (γ - 2 * 0)) by
simpa only [mul_zero, tsub_zero]
exact
tendsto_const_nhds.sub <|
tendsto_const_nhds.mul <|
tendsto_pow_atTop_nhds_zero_of_lt_one (le_of_lt <| half_pos <| zero_lt_one)
(half_lt_self zero_lt_one)
have hd : Tendsto (fun m => d (⋂ n, f m n)) atTop (𝓝 (d (⋃ m, ⋂ n, f m n))) := by
refine d_Union _ ?_
exact fun n m hnm =>
subset_iInter fun i => Subset.trans (iInter_subset (f n) i) <| f_subset_f hnm <| le_rfl
refine le_of_tendsto_of_tendsto' hγ hd fun m => ?_
have : Tendsto (fun n => d (f m n)) atTop (𝓝 (d (⋂ n, f m n))) := by
refine d_Inter _ ?_ ?_
· intro n
exact hf _ _
· intro n m hnm
exact f_subset_f le_rfl hnm
refine ge_of_tendsto this (eventually_atTop.2 ⟨m, fun n hmn => ?_⟩)
change γ - 2 * (1 / 2) ^ m ≤ d (f m n)
refine le_trans ?_ (le_d_f _ _ hmn)
exact le_add_of_le_of_nonneg le_rfl (pow_nonneg (le_of_lt <| half_pos <| zero_lt_one) _)
have hs : MeasurableSet s := MeasurableSet.iUnion fun n => MeasurableSet.iInter fun m => hf _ _
refine ⟨s, hs, ?_, ?_⟩
· intro t ht hts
have : 0 ≤ d t :=
(add_le_add_iff_left γ).1 <|
calc
γ + 0 ≤ d s := by rw [add_zero]; exact γ_le_d_s
_ = d (s \ t) + d t := by rw [d_split _ _ hs ht, inter_eq_self_of_subset_right hts]
_ ≤ γ + d t := add_le_add (d_le_γ _ (hs.diff ht)) le_rfl
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, le_sub_iff_add_le, zero_add] using this
· intro t ht hts
have : d t ≤ 0 :=
(add_le_add_iff_left γ).1 <|
calc
γ + d t ≤ d s + d t := by gcongr
_ = d (s ∪ t) := by
rw [d_split _ _ (hs.union ht) ht, union_diff_right, union_inter_cancel_right,
(subset_compl_iff_disjoint_left.1 hts).sdiff_eq_left]
_ ≤ γ + 0 := by rw [add_zero]; exact d_le_γ _ (hs.union ht)
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, sub_le_iff_le_add, zero_add] using this
| false |
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
theorem nthLe_range'_1 {n m} (i) (H : i < (range' n m).length) :
nthLe (range' n m) i H = n + i := by simp
#align list.nth_le_range' List.nthLe_range'_1
#align list.range'_concat List.range'_concat
#align list.range_core List.range.loop
#align list.range_core_range' List.range_loop_range'
#align list.range_eq_range' List.range_eq_range'
#align list.range_succ_eq_map List.range_succ_eq_map
#align list.range'_eq_map_range List.range'_eq_map_range
#align list.length_range List.length_range
#align list.range_eq_nil List.range_eq_nil
theorem pairwise_lt_range (n : ℕ) : Pairwise (· < ·) (range n) := by
simp (config := {decide := true}) only [range_eq_range', pairwise_lt_range']
#align list.pairwise_lt_range List.pairwise_lt_range
theorem pairwise_le_range (n : ℕ) : Pairwise (· ≤ ·) (range n) :=
Pairwise.imp (@le_of_lt ℕ _) (pairwise_lt_range _)
#align list.pairwise_le_range List.pairwise_le_range
theorem take_range (m n : ℕ) : take m (range n) = range (min m n) := by
apply List.ext_get
· simp
· simp (config := { contextual := true }) [← get_take, Nat.lt_min]
| Mathlib/Data/List/Range.lean | 92 | 93 | theorem nodup_range (n : ℕ) : Nodup (range n) := by |
simp (config := {decide := true}) only [range_eq_range', nodup_range']
| false |
import Mathlib.Data.Stream.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Init.Data.List.Basic
import Mathlib.Data.List.Basic
#align_import data.stream.init from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
set_option autoImplicit true
open Nat Function Option
namespace Stream'
variable {α : Type u} {β : Type v} {δ : Type w}
instance [Inhabited α] : Inhabited (Stream' α) :=
⟨Stream'.const default⟩
protected theorem eta (s : Stream' α) : (head s::tail s) = s :=
funext fun i => by cases i <;> rfl
#align stream.eta Stream'.eta
@[ext]
protected theorem ext {s₁ s₂ : Stream' α} : (∀ n, get s₁ n = get s₂ n) → s₁ = s₂ :=
fun h => funext h
#align stream.ext Stream'.ext
@[simp]
theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a :=
rfl
#align stream.nth_zero_cons Stream'.get_zero_cons
@[simp]
theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a :=
rfl
#align stream.head_cons Stream'.head_cons
@[simp]
theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s :=
rfl
#align stream.tail_cons Stream'.tail_cons
@[simp]
theorem get_drop (n m : Nat) (s : Stream' α) : get (drop m s) n = get s (n + m) :=
rfl
#align stream.nth_drop Stream'.get_drop
theorem tail_eq_drop (s : Stream' α) : tail s = drop 1 s :=
rfl
#align stream.tail_eq_drop Stream'.tail_eq_drop
@[simp]
theorem drop_drop (n m : Nat) (s : Stream' α) : drop n (drop m s) = drop (n + m) s := by
ext; simp [Nat.add_assoc]
#align stream.drop_drop Stream'.drop_drop
@[simp] theorem get_tail {s : Stream' α} : s.tail.get n = s.get (n + 1) := rfl
@[simp] theorem tail_drop' {s : Stream' α} : tail (drop i s) = s.drop (i+1) := by
ext; simp [Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
@[simp] theorem drop_tail' {s : Stream' α} : drop i (tail s) = s.drop (i+1) := rfl
theorem tail_drop (n : Nat) (s : Stream' α) : tail (drop n s) = drop n (tail s) := by simp
#align stream.tail_drop Stream'.tail_drop
theorem get_succ (n : Nat) (s : Stream' α) : get s (succ n) = get (tail s) n :=
rfl
#align stream.nth_succ Stream'.get_succ
@[simp]
theorem get_succ_cons (n : Nat) (s : Stream' α) (x : α) : get (x::s) n.succ = get s n :=
rfl
#align stream.nth_succ_cons Stream'.get_succ_cons
@[simp] theorem drop_zero {s : Stream' α} : s.drop 0 = s := rfl
theorem drop_succ (n : Nat) (s : Stream' α) : drop (succ n) s = drop n (tail s) :=
rfl
#align stream.drop_succ Stream'.drop_succ
theorem head_drop (a : Stream' α) (n : ℕ) : (a.drop n).head = a.get n := by simp
#align stream.head_drop Stream'.head_drop
theorem cons_injective2 : Function.Injective2 (cons : α → Stream' α → Stream' α) := fun x y s t h =>
⟨by rw [← get_zero_cons x s, h, get_zero_cons],
Stream'.ext fun n => by rw [← get_succ_cons n _ x, h, get_succ_cons]⟩
#align stream.cons_injective2 Stream'.cons_injective2
theorem cons_injective_left (s : Stream' α) : Function.Injective fun x => cons x s :=
cons_injective2.left _
#align stream.cons_injective_left Stream'.cons_injective_left
theorem cons_injective_right (x : α) : Function.Injective (cons x) :=
cons_injective2.right _
#align stream.cons_injective_right Stream'.cons_injective_right
theorem all_def (p : α → Prop) (s : Stream' α) : All p s = ∀ n, p (get s n) :=
rfl
#align stream.all_def Stream'.all_def
theorem any_def (p : α → Prop) (s : Stream' α) : Any p s = ∃ n, p (get s n) :=
rfl
#align stream.any_def Stream'.any_def
@[simp]
theorem mem_cons (a : α) (s : Stream' α) : a ∈ a::s :=
Exists.intro 0 rfl
#align stream.mem_cons Stream'.mem_cons
theorem mem_cons_of_mem {a : α} {s : Stream' α} (b : α) : a ∈ s → a ∈ b::s := fun ⟨n, h⟩ =>
Exists.intro (succ n) (by rw [get_succ, tail_cons, h])
#align stream.mem_cons_of_mem Stream'.mem_cons_of_mem
theorem eq_or_mem_of_mem_cons {a b : α} {s : Stream' α} : (a ∈ b::s) → a = b ∨ a ∈ s :=
fun ⟨n, h⟩ => by
cases' n with n'
· left
exact h
· right
rw [get_succ, tail_cons] at h
exact ⟨n', h⟩
#align stream.eq_or_mem_of_mem_cons Stream'.eq_or_mem_of_mem_cons
theorem mem_of_get_eq {n : Nat} {s : Stream' α} {a : α} : a = get s n → a ∈ s := fun h =>
Exists.intro n h
#align stream.mem_of_nth_eq Stream'.mem_of_get_eq
@[simp]
theorem mem_const (a : α) : a ∈ const a :=
Exists.intro 0 rfl
#align stream.mem_const Stream'.mem_const
| Mathlib/Data/Stream/Init.lean | 240 | 242 | theorem const_eq (a : α) : const a = a::const a := by |
apply Stream'.ext; intro n
cases n <;> rfl
| false |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Filter Asymptotics Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv iteratedDeriv
def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F :=
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv_within iteratedDerivWithin
variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜}
theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by
ext x
rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ]
#align iterated_deriv_within_univ iteratedDerivWithin_univ
theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x =
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
#align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} :
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m =
(∏ i, m i) • iteratedDerivWithin n f s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ]
simp
#align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin :
‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
#align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin
@[simp]
theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by
ext x
simp [iteratedDerivWithin]
#align iterated_deriv_within_zero iteratedDerivWithin_zero
@[simp]
theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) :
iteratedDerivWithin 1 f s x = derivWithin f s x := by
simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl
#align iterated_deriv_within_one iteratedDerivWithin_one
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 128 | 134 | theorem contDiffOn_of_continuousOn_differentiableOn_deriv {n : ℕ∞}
(Hcont : ∀ m : ℕ, (m : ℕ∞) ≤ n → ContinuousOn (fun x => iteratedDerivWithin m f s x) s)
(Hdiff : ∀ m : ℕ, (m : ℕ∞) < n → DifferentiableOn 𝕜 (fun x => iteratedDerivWithin m f s x) s) :
ContDiffOn 𝕜 n f s := by |
apply contDiffOn_of_continuousOn_differentiableOn
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_continuousOn_iff]
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
| true |
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import data.multiset.lattice from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
namespace Multiset
variable {α : Type*}
section Sup
-- can be defined with just `[Bot α]` where some lemmas hold without requiring `[OrderBot α]`
variable [SemilatticeSup α] [OrderBot α]
def sup (s : Multiset α) : α :=
s.fold (· ⊔ ·) ⊥
#align multiset.sup Multiset.sup
@[simp]
theorem sup_coe (l : List α) : sup (l : Multiset α) = l.foldr (· ⊔ ·) ⊥ :=
rfl
#align multiset.sup_coe Multiset.sup_coe
@[simp]
theorem sup_zero : (0 : Multiset α).sup = ⊥ :=
fold_zero _ _
#align multiset.sup_zero Multiset.sup_zero
@[simp]
theorem sup_cons (a : α) (s : Multiset α) : (a ::ₘ s).sup = a ⊔ s.sup :=
fold_cons_left _ _ _ _
#align multiset.sup_cons Multiset.sup_cons
@[simp]
theorem sup_singleton {a : α} : ({a} : Multiset α).sup = a := sup_bot_eq _
#align multiset.sup_singleton Multiset.sup_singleton
@[simp]
theorem sup_add (s₁ s₂ : Multiset α) : (s₁ + s₂).sup = s₁.sup ⊔ s₂.sup :=
Eq.trans (by simp [sup]) (fold_add _ _ _ _ _)
#align multiset.sup_add Multiset.sup_add
@[simp]
theorem sup_le {s : Multiset α} {a : α} : s.sup ≤ a ↔ ∀ b ∈ s, b ≤ a :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and])
#align multiset.sup_le Multiset.sup_le
theorem le_sup {s : Multiset α} {a : α} (h : a ∈ s) : a ≤ s.sup :=
sup_le.1 le_rfl _ h
#align multiset.le_sup Multiset.le_sup
theorem sup_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₁.sup ≤ s₂.sup :=
sup_le.2 fun _ hb => le_sup (h hb)
#align multiset.sup_mono Multiset.sup_mono
variable [DecidableEq α]
@[simp]
theorem sup_dedup (s : Multiset α) : (dedup s).sup = s.sup :=
fold_dedup_idem _ _ _
#align multiset.sup_dedup Multiset.sup_dedup
@[simp]
theorem sup_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).sup = s₁.sup ⊔ s₂.sup := by
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_add]; simp
#align multiset.sup_ndunion Multiset.sup_ndunion
@[simp]
theorem sup_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).sup = s₁.sup ⊔ s₂.sup := by
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_add]; simp
#align multiset.sup_union Multiset.sup_union
@[simp]
theorem sup_ndinsert (a : α) (s : Multiset α) : (ndinsert a s).sup = a ⊔ s.sup := by
rw [← sup_dedup, dedup_ext.2, sup_dedup, sup_cons]; simp
#align multiset.sup_ndinsert Multiset.sup_ndinsert
| Mathlib/Data/Multiset/Lattice.lean | 93 | 99 | theorem nodup_sup_iff {α : Type*} [DecidableEq α] {m : Multiset (Multiset α)} :
m.sup.Nodup ↔ ∀ a : Multiset α, a ∈ m → a.Nodup := by |
-- Porting note: this was originally `apply m.induction_on`, which failed due to
-- `failed to elaborate eliminator, expected type is not available`
induction' m using Multiset.induction_on with _ _ h
· simp
· simp [h]
| false |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {α : Type*} [DecidableEq α]
def nextOr : ∀ (_ : List α) (_ _ : α), α
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : α) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : α) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List α) (x y d : α) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
| Mathlib/Data/List/Cycle.lean | 54 | 58 | theorem nextOr_cons_of_ne (xs : List α) (y x d : α) (h : x ≠ y) :
nextOr (y :: xs) x d = nextOr xs x d := by |
cases' xs with z zs
· rfl
· exact if_neg h
| false |
import Mathlib.Analysis.Convex.Side
import Mathlib.Geometry.Euclidean.Angle.Oriented.Rotation
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.oriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open FiniteDimensional Complex
open scoped Affine EuclideanGeometry Real RealInnerProductSpace ComplexConjugate
namespace EuclideanGeometry
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P] [hd2 : Fact (finrank ℝ V = 2)] [Module.Oriented ℝ V (Fin 2)]
abbrev o := @Module.Oriented.positiveOrientation
def oangle (p₁ p₂ p₃ : P) : Real.Angle :=
o.oangle (p₁ -ᵥ p₂) (p₃ -ᵥ p₂)
#align euclidean_geometry.oangle EuclideanGeometry.oangle
@[inherit_doc] scoped notation "∡" => EuclideanGeometry.oangle
theorem continuousAt_oangle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) :
ContinuousAt (fun y : P × P × P => ∡ y.1 y.2.1 y.2.2) x := by
let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1)
have hf1 : (f x).1 ≠ 0 := by simp [hx12]
have hf2 : (f x).2 ≠ 0 := by simp [hx32]
exact (o.continuousAt_oangle hf1 hf2).comp ((continuous_fst.vsub continuous_snd.fst).prod_mk
(continuous_snd.snd.vsub continuous_snd.fst)).continuousAt
#align euclidean_geometry.continuous_at_oangle EuclideanGeometry.continuousAt_oangle
@[simp]
theorem oangle_self_left (p₁ p₂ : P) : ∡ p₁ p₁ p₂ = 0 := by simp [oangle]
#align euclidean_geometry.oangle_self_left EuclideanGeometry.oangle_self_left
@[simp]
theorem oangle_self_right (p₁ p₂ : P) : ∡ p₁ p₂ p₂ = 0 := by simp [oangle]
#align euclidean_geometry.oangle_self_right EuclideanGeometry.oangle_self_right
@[simp]
theorem oangle_self_left_right (p₁ p₂ : P) : ∡ p₁ p₂ p₁ = 0 :=
o.oangle_self _
#align euclidean_geometry.oangle_self_left_right EuclideanGeometry.oangle_self_left_right
theorem left_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₁ ≠ p₂ := by
rw [← @vsub_ne_zero V]; exact o.left_ne_zero_of_oangle_ne_zero h
#align euclidean_geometry.left_ne_of_oangle_ne_zero EuclideanGeometry.left_ne_of_oangle_ne_zero
| Mathlib/Geometry/Euclidean/Angle/Oriented/Affine.lean | 80 | 81 | theorem right_ne_of_oangle_ne_zero {p₁ p₂ p₃ : P} (h : ∡ p₁ p₂ p₃ ≠ 0) : p₃ ≠ p₂ := by |
rw [← @vsub_ne_zero V]; exact o.right_ne_zero_of_oangle_ne_zero h
| true |
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
noncomputable section
open scoped Manifold
open Bundle Set Topology
section SpecificFunctions
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
{H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*}
[TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
variable {s : Set M} {x : M}
section id
theorem hasMFDerivAt_id (x : M) :
HasMFDerivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) := by
refine ⟨continuousAt_id, ?_⟩
have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = y := by
apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x)
mfld_set_tac
apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this
simp only [mfld_simps]
#align has_mfderiv_at_id hasMFDerivAt_id
theorem hasMFDerivWithinAt_id (s : Set M) (x : M) :
HasMFDerivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
(hasMFDerivAt_id I x).hasMFDerivWithinAt
#align has_mfderiv_within_at_id hasMFDerivWithinAt_id
theorem mdifferentiableAt_id : MDifferentiableAt I I (@id M) x :=
(hasMFDerivAt_id I x).mdifferentiableAt
#align mdifferentiable_at_id mdifferentiableAt_id
theorem mdifferentiableWithinAt_id : MDifferentiableWithinAt I I (@id M) s x :=
(mdifferentiableAt_id I).mdifferentiableWithinAt
#align mdifferentiable_within_at_id mdifferentiableWithinAt_id
theorem mdifferentiable_id : MDifferentiable I I (@id M) := fun _ => mdifferentiableAt_id I
#align mdifferentiable_id mdifferentiable_id
theorem mdifferentiableOn_id : MDifferentiableOn I I (@id M) s :=
(mdifferentiable_id I).mdifferentiableOn
#align mdifferentiable_on_id mdifferentiableOn_id
@[simp, mfld_simps]
theorem mfderiv_id : mfderiv I I (@id M) x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
HasMFDerivAt.mfderiv (hasMFDerivAt_id I x)
#align mfderiv_id mfderiv_id
theorem mfderivWithin_id (hxs : UniqueMDiffWithinAt I s x) :
mfderivWithin I I (@id M) s x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
rw [MDifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs]
exact mfderiv_id I
#align mfderiv_within_id mfderivWithin_id
@[simp, mfld_simps]
theorem tangentMap_id : tangentMap I I (id : M → M) = id := by ext1 ⟨x, v⟩; simp [tangentMap]
#align tangent_map_id tangentMap_id
| Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean | 167 | 172 | theorem tangentMapWithin_id {p : TangentBundle I M} (hs : UniqueMDiffWithinAt I s p.proj) :
tangentMapWithin I I (id : M → M) s p = p := by |
simp only [tangentMapWithin, id]
rw [mfderivWithin_id]
· rcases p with ⟨⟩; rfl
· exact hs
| false |
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]
theorem flag_zero (b : Basis (Fin n) R M) : b.flag 0 = ⊥ := by simp [flag]
@[simp]
| Mathlib/LinearAlgebra/Basis/Flag.lean | 35 | 36 | theorem flag_last (b : Basis (Fin n) R M) : b.flag (.last n) = ⊤ := by |
simp [flag, Fin.castSucc_lt_last]
| false |
import Mathlib.Order.CompleteLattice
import Mathlib.Order.GaloisConnection
import Mathlib.Data.Set.Lattice
import Mathlib.Tactic.AdaptationNote
#align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
variable {α β γ : Type*}
def Rel (α β : Type*) :=
α → β → Prop -- deriving CompleteLattice, Inhabited
#align rel Rel
-- Porting note: `deriving` above doesn't work.
instance : CompleteLattice (Rel α β) := show CompleteLattice (α → β → Prop) from inferInstance
instance : Inhabited (Rel α β) := show Inhabited (α → β → Prop) from inferInstance
namespace Rel
variable (r : Rel α β)
-- Porting note: required for later theorems.
@[ext] theorem ext {r s : Rel α β} : (∀ a, r a = s a) → r = s := funext
def inv : Rel β α :=
flip r
#align rel.inv Rel.inv
theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
Iff.rfl
#align rel.inv_def Rel.inv_def
theorem inv_inv : inv (inv r) = r := by
ext x y
rfl
#align rel.inv_inv Rel.inv_inv
def dom := { x | ∃ y, r x y }
#align rel.dom Rel.dom
theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩
#align rel.dom_mono Rel.dom_mono
def codom := { y | ∃ x, r x y }
#align rel.codom Rel.codom
theorem codom_inv : r.inv.codom = r.dom := by
ext x
rfl
#align rel.codom_inv Rel.codom_inv
theorem dom_inv : r.inv.dom = r.codom := by
ext x
rfl
#align rel.dom_inv Rel.dom_inv
def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y ∧ s y z
#align rel.comp Rel.comp
-- Porting note: the original `∘` syntax can't be overloaded here, lean considers it ambiguous.
local infixr:90 " • " => Rel.comp
theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) :
(r • s) • t = r • (s • t) := by
unfold comp; ext (x w); constructor
· rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
· rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
#align rel.comp_assoc Rel.comp_assoc
@[simp]
theorem comp_right_id (r : Rel α β) : r • @Eq β = r := by
unfold comp
ext y
simp
#align rel.comp_right_id Rel.comp_right_id
@[simp]
theorem comp_left_id (r : Rel α β) : @Eq α • r = r := by
unfold comp
ext x
simp
#align rel.comp_left_id Rel.comp_left_id
@[simp]
theorem comp_right_bot (r : Rel α β) : r • (⊥ : Rel β γ) = ⊥ := by
ext x y
simp [comp, Bot.bot]
@[simp]
theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥ := by
ext x y
simp [comp, Bot.bot]
@[simp]
| Mathlib/Data/Rel.lean | 136 | 138 | theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = fun x _ ↦ x ∈ r.dom := by |
ext x z
simp [comp, Top.top, dom]
| false |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
noncomputable section
open scoped Classical Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section Prod
section HasDeriv
variable {ι : Type*} [DecidableEq ι] {𝔸' : Type*} [NormedCommRing 𝔸'] [NormedAlgebra 𝕜 𝔸']
{u : Finset ι} {f : ι → 𝕜 → 𝔸'} {f' : ι → 𝔸'}
theorem HasDerivAt.finset_prod (hf : ∀ i ∈ u, HasDerivAt (f i) (f' i) x) :
HasDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivAt)).hasDerivAt
theorem HasDerivWithinAt.finset_prod (hf : ∀ i ∈ u, HasDerivWithinAt (f i) (f' i) s x) :
HasDerivWithinAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) s x := by
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasFDerivWithinAt.finset_prod (fun i hi ↦ (hf i hi).hasFDerivWithinAt)).hasDerivWithinAt
| Mathlib/Analysis/Calculus/Deriv/Mul.lean | 346 | 349 | theorem HasStrictDerivAt.finset_prod (hf : ∀ i ∈ u, HasStrictDerivAt (f i) (f' i) x) :
HasStrictDerivAt (∏ i ∈ u, f i ·) (∑ i ∈ u, (∏ j ∈ u.erase i, f j x) • f' i) x := by |
simpa [ContinuousLinearMap.sum_apply, ContinuousLinearMap.smul_apply] using
(HasStrictFDerivAt.finset_prod (fun i hi ↦ (hf i hi).hasStrictFDerivAt)).hasStrictDerivAt
| false |
import Mathlib.CategoryTheory.Monoidal.Category
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
import Mathlib.CategoryTheory.Products.Basic
#align_import category_theory.monoidal.functor from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042"
open CategoryTheory
universe v₁ v₂ v₃ u₁ u₂ u₃
open CategoryTheory.Category
open CategoryTheory.Functor
namespace CategoryTheory
section
open MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] (D : Type u₂) [Category.{v₂} D]
[MonoidalCategory.{v₂} D]
-- The direction of `left_unitality` and `right_unitality` as simp lemmas may look strange:
-- remember the rule of thumb that component indices of natural transformations
-- "weigh more" than structural maps.
-- (However by this argument `associativity` is currently stated backwards!)
structure LaxMonoidalFunctor extends C ⥤ D where
ε : 𝟙_ D ⟶ obj (𝟙_ C)
μ : ∀ X Y : C, obj X ⊗ obj Y ⟶ obj (X ⊗ Y)
μ_natural_left :
∀ {X Y : C} (f : X ⟶ Y) (X' : C),
map f ▷ obj X' ≫ μ Y X' = μ X X' ≫ map (f ▷ X') := by
aesop_cat
μ_natural_right :
∀ {X Y : C} (X' : C) (f : X ⟶ Y) ,
obj X' ◁ map f ≫ μ X' Y = μ X' X ≫ map (X' ◁ f) := by
aesop_cat
associativity :
∀ X Y Z : C,
μ X Y ▷ obj Z ≫ μ (X ⊗ Y) Z ≫ map (α_ X Y Z).hom =
(α_ (obj X) (obj Y) (obj Z)).hom ≫ obj X ◁ μ Y Z ≫ μ X (Y ⊗ Z) := by
aesop_cat
-- unitality
left_unitality : ∀ X : C, (λ_ (obj X)).hom = ε ▷ obj X ≫ μ (𝟙_ C) X ≫ map (λ_ X).hom := by
aesop_cat
right_unitality : ∀ X : C, (ρ_ (obj X)).hom = obj X ◁ ε ≫ μ X (𝟙_ C) ≫ map (ρ_ X).hom := by
aesop_cat
#align category_theory.lax_monoidal_functor CategoryTheory.LaxMonoidalFunctor
-- Porting note (#11215): TODO: remove this configuration and use the default configuration.
-- We keep this to be consistent with Lean 3.
-- See also `initialize_simps_projections MonoidalFunctor` below.
-- This may require waiting on https://github.com/leanprover-community/mathlib4/pull/2936
initialize_simps_projections LaxMonoidalFunctor (+toFunctor, -obj, -map)
attribute [reassoc (attr := simp)] LaxMonoidalFunctor.μ_natural_left
attribute [reassoc (attr := simp)] LaxMonoidalFunctor.μ_natural_right
attribute [simp] LaxMonoidalFunctor.left_unitality
attribute [simp] LaxMonoidalFunctor.right_unitality
attribute [reassoc (attr := simp)] LaxMonoidalFunctor.associativity
-- When `rewrite_search` lands, add @[search] attributes to
-- LaxMonoidalFunctor.μ_natural LaxMonoidalFunctor.left_unitality
-- LaxMonoidalFunctor.right_unitality LaxMonoidalFunctor.associativity
section
variable {C D}
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Monoidal/Functor.lean | 113 | 116 | theorem LaxMonoidalFunctor.μ_natural (F : LaxMonoidalFunctor C D) {X Y X' Y' : C}
(f : X ⟶ Y) (g : X' ⟶ Y') :
(F.map f ⊗ F.map g) ≫ F.μ Y Y' = F.μ X X' ≫ F.map (f ⊗ g) := by |
simp [tensorHom_def]
| false |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Topology.Algebra.InfiniteSum.Order
import Mathlib.Topology.Instances.Real
import Mathlib.Topology.Instances.ENNReal
#align_import topology.algebra.infinite_sum.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Filter Finset NNReal Topology
variable {α β : Type*} [PseudoMetricSpace α] {f : ℕ → α} {a : α}
theorem cauchySeq_of_dist_le_of_summable (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) : CauchySeq f := by
lift d to ℕ → ℝ≥0 using fun n ↦ dist_nonneg.trans (hf n)
apply cauchySeq_of_edist_le_of_summable d (α := α) (f := f)
· exact_mod_cast hf
· exact_mod_cast hd
#align cauchy_seq_of_dist_le_of_summable cauchySeq_of_dist_le_of_summable
theorem cauchySeq_of_summable_dist (h : Summable fun n ↦ dist (f n) (f n.succ)) : CauchySeq f :=
cauchySeq_of_dist_le_of_summable _ (fun _ ↦ le_rfl) h
#align cauchy_seq_of_summable_dist cauchySeq_of_summable_dist
theorem dist_le_tsum_of_dist_le_of_tendsto (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) :
dist (f n) a ≤ ∑' m, d (n + m) := by
refine le_of_tendsto (tendsto_const_nhds.dist ha) (eventually_atTop.2 ⟨n, fun m hnm ↦ ?_⟩)
refine le_trans (dist_le_Ico_sum_of_dist_le hnm fun _ _ ↦ hf _) ?_
rw [sum_Ico_eq_sum_range]
refine sum_le_tsum (range _) (fun _ _ ↦ le_trans dist_nonneg (hf _)) ?_
exact hd.comp_injective (add_right_injective n)
#align dist_le_tsum_of_dist_le_of_tendsto dist_le_tsum_of_dist_le_of_tendsto
| Mathlib/Topology/Algebra/InfiniteSum/Real.lean | 49 | 51 | theorem dist_le_tsum_of_dist_le_of_tendsto₀ (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ tsum d := by |
simpa only [zero_add] using dist_le_tsum_of_dist_le_of_tendsto d hf hd ha 0
| false |
import Mathlib.MeasureTheory.Measure.Dirac
set_option autoImplicit true
open Set
open scoped ENNReal Classical
variable [MeasurableSpace α] [MeasurableSpace β] {s : Set α}
noncomputable section
namespace MeasureTheory.Measure
def count : Measure α :=
sum dirac
#align measure_theory.measure.count MeasureTheory.Measure.count
theorem le_count_apply : ∑' _ : s, (1 : ℝ≥0∞) ≤ count s :=
calc
(∑' _ : s, 1 : ℝ≥0∞) = ∑' i, indicator s 1 i := tsum_subtype s 1
_ ≤ ∑' i, dirac i s := ENNReal.tsum_le_tsum fun _ => le_dirac_apply
_ ≤ count s := le_sum_apply _ _
#align measure_theory.measure.le_count_apply MeasureTheory.Measure.le_count_apply
theorem count_apply (hs : MeasurableSet s) : count s = ∑' i : s, 1 := by
simp only [count, sum_apply, hs, dirac_apply', ← tsum_subtype s (1 : α → ℝ≥0∞), Pi.one_apply]
#align measure_theory.measure.count_apply MeasureTheory.Measure.count_apply
-- @[simp] -- Porting note (#10618): simp can prove this
theorem count_empty : count (∅ : Set α) = 0 := by rw [count_apply MeasurableSet.empty, tsum_empty]
#align measure_theory.measure.count_empty MeasureTheory.Measure.count_empty
@[simp]
theorem count_apply_finset' {s : Finset α} (s_mble : MeasurableSet (s : Set α)) :
count (↑s : Set α) = s.card :=
calc
count (↑s : Set α) = ∑' i : (↑s : Set α), 1 := count_apply s_mble
_ = ∑ i ∈ s, 1 := s.tsum_subtype 1
_ = s.card := by simp
#align measure_theory.measure.count_apply_finset' MeasureTheory.Measure.count_apply_finset'
@[simp]
theorem count_apply_finset [MeasurableSingletonClass α] (s : Finset α) :
count (↑s : Set α) = s.card :=
count_apply_finset' s.measurableSet
#align measure_theory.measure.count_apply_finset MeasureTheory.Measure.count_apply_finset
theorem count_apply_finite' {s : Set α} (s_fin : s.Finite) (s_mble : MeasurableSet s) :
count s = s_fin.toFinset.card := by
simp [←
@count_apply_finset' _ _ s_fin.toFinset (by simpa only [Finite.coe_toFinset] using s_mble)]
#align measure_theory.measure.count_apply_finite' MeasureTheory.Measure.count_apply_finite'
| Mathlib/MeasureTheory/Measure/Count.lean | 68 | 69 | theorem count_apply_finite [MeasurableSingletonClass α] (s : Set α) (hs : s.Finite) :
count s = hs.toFinset.card := by | rw [← count_apply_finset, Finite.coe_toFinset]
| true |
import Mathlib.Analysis.NormedSpace.IndicatorFunction
import Mathlib.MeasureTheory.Function.EssSup
import Mathlib.MeasureTheory.Function.AEEqFun
import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
noncomputable section
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory Filter
open scoped NNReal ENNReal Topology
variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
namespace MeasureTheory
section ℒp
section ℒpSpaceDefinition
def snorm' {_ : MeasurableSpace α} (f : α → F) (q : ℝ) (μ : Measure α) : ℝ≥0∞ :=
(∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q)
#align measure_theory.snorm' MeasureTheory.snorm'
def snormEssSup {_ : MeasurableSpace α} (f : α → F) (μ : Measure α) :=
essSup (fun x => (‖f x‖₊ : ℝ≥0∞)) μ
#align measure_theory.snorm_ess_sup MeasureTheory.snormEssSup
def snorm {_ : MeasurableSpace α} (f : α → F) (p : ℝ≥0∞) (μ : Measure α) : ℝ≥0∞ :=
if p = 0 then 0 else if p = ∞ then snormEssSup f μ else snorm' f (ENNReal.toReal p) μ
#align measure_theory.snorm MeasureTheory.snorm
theorem snorm_eq_snorm' (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} :
snorm f p μ = snorm' f (ENNReal.toReal p) μ := by simp [snorm, hp_ne_zero, hp_ne_top]
#align measure_theory.snorm_eq_snorm' MeasureTheory.snorm_eq_snorm'
theorem snorm_eq_lintegral_rpow_nnnorm (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) {f : α → F} :
snorm f p μ = (∫⁻ x, (‖f x‖₊ : ℝ≥0∞) ^ p.toReal ∂μ) ^ (1 / p.toReal) := by
rw [snorm_eq_snorm' hp_ne_zero hp_ne_top, snorm']
#align measure_theory.snorm_eq_lintegral_rpow_nnnorm MeasureTheory.snorm_eq_lintegral_rpow_nnnorm
| Mathlib/MeasureTheory/Function/LpSeminorm/Basic.lean | 96 | 98 | theorem snorm_one_eq_lintegral_nnnorm {f : α → F} : snorm f 1 μ = ∫⁻ x, ‖f x‖₊ ∂μ := by |
simp_rw [snorm_eq_lintegral_rpow_nnnorm one_ne_zero ENNReal.coe_ne_top, ENNReal.one_toReal,
one_div_one, ENNReal.rpow_one]
| true |
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Order.Filter.Subsingleton
open Set
variable {α β γ δ : Type*} {l : Filter α} {f : α → β}
namespace Filter
def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton
theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
(h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y :=
(h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image]
theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α}
{x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) :
EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) :=
h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦
⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩
lemma eventuallyConst_iff_tendsto [Nonempty β] :
EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) :=
subsingleton_iff_exists_le_pure
alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto
theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l :=
have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩
theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] :
EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c :=
subsingleton_iff_exists_singleton_mem
alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq
| Mathlib/Order/Filter/EventuallyConst.lean | 57 | 59 | theorem eventuallyConst_pred' {p : α → Prop} :
EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by |
simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff]
| false |
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Geometry.Euclidean.Angle.Oriented.Basic
#align_import geometry.euclidean.angle.oriented.rotation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open FiniteDimensional Complex
open scoped Real RealInnerProductSpace ComplexConjugate
namespace Orientation
attribute [local instance] Complex.finrank_real_complex_fact
variable {V V' : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup V']
variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V']
variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2))
local notation "J" => o.rightAngleRotation
def rotationAux (θ : Real.Angle) : V →ₗᵢ[ℝ] V :=
LinearMap.isometryOfInner
(Real.Angle.cos θ • LinearMap.id +
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
intro x y
simp only [RCLike.conj_to_real, id, LinearMap.smul_apply, LinearMap.add_apply,
LinearMap.id_coe, LinearEquiv.coe_coe, LinearIsometryEquiv.coe_toLinearEquiv,
Orientation.areaForm_rightAngleRotation_left, Orientation.inner_rightAngleRotation_left,
Orientation.inner_rightAngleRotation_right, inner_add_left, inner_smul_left,
inner_add_right, inner_smul_right]
linear_combination inner (𝕜 := ℝ) x y * θ.cos_sq_add_sin_sq)
#align orientation.rotation_aux Orientation.rotationAux
@[simp]
theorem rotationAux_apply (θ : Real.Angle) (x : V) :
o.rotationAux θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_aux_apply Orientation.rotationAux_apply
def rotation (θ : Real.Angle) : V ≃ₗᵢ[ℝ] V :=
LinearIsometryEquiv.ofLinearIsometry (o.rotationAux θ)
(Real.Angle.cos θ • LinearMap.id -
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_smul, map_sub, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, ← mul_smul, add_smul,
smul_add, smul_neg, smul_sub, mul_comm, sq]
abel
· simp)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_add, map_smul, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply,
add_smul, smul_neg, smul_sub, smul_smul]
ring_nf
abel
· simp)
#align orientation.rotation Orientation.rotation
theorem rotation_apply (θ : Real.Angle) (x : V) :
o.rotation θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_apply Orientation.rotation_apply
theorem rotation_symm_apply (θ : Real.Angle) (x : V) :
(o.rotation θ).symm x = Real.Angle.cos θ • x - Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_symm_apply Orientation.rotation_symm_apply
theorem rotation_eq_matrix_toLin (θ : Real.Angle) {x : V} (hx : x ≠ 0) :
(o.rotation θ).toLinearMap =
Matrix.toLin (o.basisRightAngleRotation x hx) (o.basisRightAngleRotation x hx)
!![θ.cos, -θ.sin; θ.sin, θ.cos] := by
apply (o.basisRightAngleRotation x hx).ext
intro i
fin_cases i
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ]
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ, add_comm]
#align orientation.rotation_eq_matrix_to_lin Orientation.rotation_eq_matrix_toLin
@[simp]
theorem det_rotation (θ : Real.Angle) : LinearMap.det (o.rotation θ).toLinearMap = 1 := by
haveI : Nontrivial V :=
FiniteDimensional.nontrivial_of_finrank_eq_succ (@Fact.out (finrank ℝ V = 2) _)
obtain ⟨x, hx⟩ : ∃ x, x ≠ (0 : V) := exists_ne (0 : V)
rw [o.rotation_eq_matrix_toLin θ hx]
simpa [sq] using θ.cos_sq_add_sin_sq
#align orientation.det_rotation Orientation.det_rotation
@[simp]
theorem linearEquiv_det_rotation (θ : Real.Angle) :
LinearEquiv.det (o.rotation θ).toLinearEquiv = 1 :=
Units.ext <| by
-- Porting note: Lean can't see through `LinearEquiv.coe_det` and needed the rewrite
-- in mathlib3 this was just `units.ext <| o.det_rotation θ`
simpa only [LinearEquiv.coe_det, Units.val_one] using o.det_rotation θ
#align orientation.linear_equiv_det_rotation Orientation.linearEquiv_det_rotation
@[simp]
theorem rotation_symm (θ : Real.Angle) : (o.rotation θ).symm = o.rotation (-θ) := by
ext; simp [o.rotation_apply, o.rotation_symm_apply, sub_eq_add_neg]
#align orientation.rotation_symm Orientation.rotation_symm
@[simp]
theorem rotation_zero : o.rotation 0 = LinearIsometryEquiv.refl ℝ V := by ext; simp [rotation]
#align orientation.rotation_zero Orientation.rotation_zero
@[simp]
| Mathlib/Geometry/Euclidean/Angle/Oriented/Rotation.lean | 145 | 147 | theorem rotation_pi : o.rotation π = LinearIsometryEquiv.neg ℝ := by |
ext x
simp [rotation]
| true |
import Mathlib.Data.List.Basic
#align_import data.bool.all_any from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {α : Type*} {p : α → Prop} [DecidablePred p] {l : List α} {a : α}
namespace List
-- Porting note: in Batteries
#align list.all_nil List.all_nil
#align list.all_cons List.all_consₓ
| Mathlib/Data/Bool/AllAny.lean | 27 | 30 | theorem all_iff_forall {p : α → Bool} : all l p ↔ ∀ a ∈ l, p a := by |
induction' l with a l ih
· exact iff_of_true rfl (forall_mem_nil _)
simp only [all_cons, Bool.and_eq_true_iff, ih, forall_mem_cons]
| false |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4