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 | goals listlengths 0 224 | goals_before listlengths 0 221 |
|---|---|---|---|---|---|---|---|
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 68 | 69 | theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by |
rw [catalan]
| [
" catalan 0 = 1",
" catalan (n + 1) = ∑ i : Fin n.succ, catalan ↑i * catalan (n - ↑i)"
] | [
" catalan 0 = 1",
" catalan (n + 1) = ∑ i : Fin n.succ, catalan ↑i * catalan (n - ↑i)"
] |
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open scoped Classical MeasureTheory NNReal ENNReal
open TopologicalSpace MeasureTheory.Measure
noncomputable section
namespace MeasureTheory
variable {Ω E : Type*} [MeasurableSpace E]
class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) : Prop where
pdf' : AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ
#align measure_theory.has_pdf MeasureTheory.HasPDF
def pdf {_ : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω) (μ : Measure E := by volume_tac) :
E → ℝ≥0∞ :=
(map X ℙ).rnDeriv μ
#align measure_theory.pdf MeasureTheory.pdf
theorem pdf_def {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E} :
pdf X ℙ μ = (map X ℙ).rnDeriv μ := rfl
theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
{X : Ω → E} (hX : ¬AEMeasurable X ℙ) : pdf X ℙ μ =ᵐ[μ] 0 := by
rw [pdf_def, map_of_not_aemeasurable hX]
exact rnDeriv_zero μ
#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_of_not_aemeasurable
theorem pdf_of_not_haveLebesgueDecomposition {_ : MeasurableSpace Ω} {ℙ : Measure Ω}
{μ : Measure E} {X : Ω → E} (h : ¬(map X ℙ).HaveLebesgueDecomposition μ) : pdf X ℙ μ = 0 :=
rnDeriv_of_not_haveLebesgueDecomposition h
theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
(X : Ω → E) (h : ¬pdf X ℙ μ =ᵐ[μ] 0) : AEMeasurable X ℙ := by
contrapose! h
exact pdf_of_not_aemeasurable h
#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.aemeasurable_of_pdf_ne_zero
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
refine ⟨?_, ?_, hac⟩
· exact aemeasurable_of_pdf_ne_zero X hpdf
· contrapose! hpdf
have := pdf_of_not_haveLebesgueDecomposition hpdf
filter_upwards using congrFun this
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
@[measurability]
| Mathlib/Probability/Density.lean | 168 | 170 | theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by | volume_tac) : Measurable (pdf X ℙ μ) := by
exact measurable_rnDeriv _ _
| [
" pdf X ℙ μ =ᶠ[ae μ] 0",
" rnDeriv 0 μ =ᶠ[ae μ] 0",
" AEMeasurable X ℙ",
" HasPDF X ℙ μ",
" (map X ℙ).HaveLebesgueDecomposition μ",
" Measurable (pdf X ℙ μ)"
] | [
" pdf X ℙ μ =ᶠ[ae μ] 0",
" rnDeriv 0 μ =ᶠ[ae μ] 0",
" AEMeasurable X ℙ",
" HasPDF X ℙ μ",
" (map X ℙ).HaveLebesgueDecomposition μ"
] |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.RCLike.Basic
open Set Algebra Filter
open scoped Topology
variable (𝕜 : Type*) [RCLike 𝕜]
| Mathlib/Analysis/SpecificLimits/RCLike.lean | 19 | 22 | theorem RCLike.tendsto_inverse_atTop_nhds_zero_nat :
Tendsto (fun n : ℕ => (n : 𝕜)⁻¹) atTop (𝓝 0) := by |
convert tendsto_algebraMap_inverse_atTop_nhds_zero_nat 𝕜
simp
| [
" Tendsto (fun n => (↑n)⁻¹) atTop (𝓝 0)",
" (↑x✝)⁻¹ = (⇑(algebraMap ℝ 𝕜) ∘ fun n => (↑n)⁻¹) x✝"
] | [
" Tendsto (fun n => (↑n)⁻¹) atTop (𝓝 0)"
] |
import Mathlib.AlgebraicTopology.DoldKan.FunctorN
#align_import algebraic_topology.dold_kan.normalized from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Subobject CategoryTheory.Idempotents DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
universe v
variable {A : Type*} [Category A] [Abelian A] {X : SimplicialObject A}
theorem HigherFacesVanish.inclusionOfMooreComplexMap (n : ℕ) :
HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1)) := fun j _ => by
dsimp [AlgebraicTopology.inclusionOfMooreComplexMap, NormalizedMooreComplex.objX]
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ j
(by simp only [Finset.mem_univ])), assoc, kernelSubobject_arrow_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.higher_faces_vanish.inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.HigherFacesVanish.inclusionOfMooreComplexMap
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 52 | 59 | theorem factors_normalizedMooreComplex_PInfty (n : ℕ) :
Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n) := by |
rcases n with _|n
· apply top_factors
· rw [PInfty_f, NormalizedMooreComplex.objX, finset_inf_factors]
intro i _
apply kernelSubobject_factors
exact (HigherFacesVanish.of_P (n + 1) n) i le_add_self
| [
" (AlgebraicTopology.inclusionOfMooreComplexMap X).f (n + 1) ≫ X.δ j.succ = 0",
" (Finset.univ.inf fun k => kernelSubobject (X.δ k.succ)).arrow ≫ X.δ j.succ = 0",
" j ∈ Finset.univ",
" (NormalizedMooreComplex.objX X n).Factors (PInfty.f n)",
" (NormalizedMooreComplex.objX X 0).Factors (PInfty.f 0)",
" (No... | [
" (AlgebraicTopology.inclusionOfMooreComplexMap X).f (n + 1) ≫ X.δ j.succ = 0",
" (Finset.univ.inf fun k => kernelSubobject (X.δ k.succ)).arrow ≫ X.δ j.succ = 0",
" j ∈ Finset.univ",
" (NormalizedMooreComplex.objX X n).Factors (PInfty.f n)"
] |
import Mathlib.Algebra.Group.Hom.Defs
#align_import algebra.group.ext from "leanprover-community/mathlib"@"e574b1a4e891376b0ef974b926da39e05da12a06"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
@[to_additive (attr := ext)]
theorem Monoid.ext {M : Type u} ⦃m₁ m₂ : Monoid M⦄
(h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M)) :
m₁ = m₂ := by
have : m₁.toMulOneClass = m₂.toMulOneClass := MulOneClass.ext h_mul
have h₁ : m₁.one = m₂.one := congr_arg (·.one) this
let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
@MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
(fun x y => congr_fun (congr_fun h_mul x) y)
have : m₁.npow = m₂.npow := by
ext n x
exact @MonoidHom.map_pow M M m₁ m₂ f x n
rcases m₁ with @⟨@⟨⟨_⟩⟩, ⟨_⟩⟩
rcases m₂ with @⟨@⟨⟨_⟩⟩, ⟨_⟩⟩
congr
#align monoid.ext Monoid.ext
#align add_monoid.ext AddMonoid.ext
@[to_additive]
theorem CommMonoid.toMonoid_injective {M : Type u} :
Function.Injective (@CommMonoid.toMonoid M) := by
rintro ⟨⟩ ⟨⟩ h
congr
#align comm_monoid.to_monoid_injective CommMonoid.toMonoid_injective
#align add_comm_monoid.to_add_monoid_injective AddCommMonoid.toAddMonoid_injective
@[to_additive (attr := ext)]
theorem CommMonoid.ext {M : Type*} ⦃m₁ m₂ : CommMonoid M⦄
(h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M)) : m₁ = m₂ :=
CommMonoid.toMonoid_injective <| Monoid.ext h_mul
#align comm_monoid.ext CommMonoid.ext
#align add_comm_monoid.ext AddCommMonoid.ext
@[to_additive]
| Mathlib/Algebra/Group/Ext.lean | 71 | 74 | theorem LeftCancelMonoid.toMonoid_injective {M : Type u} :
Function.Injective (@LeftCancelMonoid.toMonoid M) := by |
rintro @⟨@⟨⟩⟩ @⟨@⟨⟩⟩ h
congr <;> injection h
| [
" m₁ = m₂",
" Monoid.npow = Monoid.npow",
" Monoid.npow n x = Monoid.npow n x",
" mk one_mul✝ mul_one✝ npow✝ npow_zero✝ npow_succ✝ = m₂",
" mk one_mul✝¹ mul_one✝¹ npow✝¹ npow_zero✝¹ npow_succ✝¹ = mk one_mul✝ mul_one✝ npow✝ npow_zero✝ npow_succ✝",
" Injective (@toMonoid M)",
" mk mul_comm✝¹ = mk mul_comm... | [
" m₁ = m₂",
" Monoid.npow = Monoid.npow",
" Monoid.npow n x = Monoid.npow n x",
" mk one_mul✝ mul_one✝ npow✝ npow_zero✝ npow_succ✝ = m₂",
" mk one_mul✝¹ mul_one✝¹ npow✝¹ npow_zero✝¹ npow_succ✝¹ = mk one_mul✝ mul_one✝ npow✝ npow_zero✝ npow_succ✝",
" Injective (@toMonoid M)",
" mk mul_comm✝¹ = mk mul_comm... |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
open CategoryTheory
namespace ModuleCat
variable {ι ι' R : Type*} [Ring R] {S : ShortComplex (ModuleCat R)}
(hS : S.Exact) (hS' : S.ShortExact) {v : ι → S.X₁}
open CategoryTheory Submodule Set
section LinearIndependent
variable (hv : LinearIndependent R v) {u : ι ⊕ ι' → S.X₂}
(hw : LinearIndependent R (S.g ∘ u ∘ Sum.inr))
(hm : Mono S.f) (huv : u ∘ Sum.inl = S.f ∘ v)
| Mathlib/Algebra/Category/ModuleCat/Free.lean | 44 | 49 | theorem disjoint_span_sum : Disjoint (span R (range (u ∘ Sum.inl)))
(span R (range (u ∘ Sum.inr))) := by |
rw [huv, disjoint_comm]
refine Disjoint.mono_right (span_mono (range_comp_subset_range _ _)) ?_
rw [← LinearMap.range_coe, span_eq (LinearMap.range S.f), hS.moduleCat_range_eq_ker]
exact range_ker_disjoint hw
| [
" Disjoint (span R (range (u ∘ Sum.inl))) (span R (range (u ∘ Sum.inr)))",
" Disjoint (span R (range (u ∘ Sum.inr))) (span R (range (⇑S.f ∘ v)))",
" Disjoint (span R (range (u ∘ Sum.inr))) (span R (range ⇑S.f))",
" Disjoint (span R (range (u ∘ Sum.inr))) (LinearMap.ker S.g)"
] | [
" Disjoint (span R (range (u ∘ Sum.inl))) (span R (range (u ∘ Sum.inr)))"
] |
import Mathlib.Data.Finsupp.Encodable
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Span
import Mathlib.Data.Set.Countable
#align_import linear_algebra.finsupp from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Set LinearMap Submodule
namespace Finsupp
variable {α : Type*} {M : Type*} {N : Type*} {P : Type*} {R : Type*} {S : Type*}
variable [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M]
variable [AddCommMonoid N] [Module R N]
variable [AddCommMonoid P] [Module R P]
def lsingle (a : α) : M →ₗ[R] α →₀ M :=
{ Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm }
#align finsupp.lsingle Finsupp.lsingle
theorem lhom_ext ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a b, φ (single a b) = ψ (single a b)) : φ = ψ :=
LinearMap.toAddMonoidHom_injective <| addHom_ext h
#align finsupp.lhom_ext Finsupp.lhom_ext
-- Porting note: The priority should be higher than `LinearMap.ext`.
@[ext high]
theorem lhom_ext' ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a, φ.comp (lsingle a) = ψ.comp (lsingle a)) :
φ = ψ :=
lhom_ext fun a => LinearMap.congr_fun (h a)
#align finsupp.lhom_ext' Finsupp.lhom_ext'
def lapply (a : α) : (α →₀ M) →ₗ[R] M :=
{ Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl }
#align finsupp.lapply Finsupp.lapply
@[simps]
def lcoeFun : (α →₀ M) →ₗ[R] α → M where
toFun := (⇑)
map_add' x y := by
ext
simp
map_smul' x y := by
ext
simp
#align finsupp.lcoe_fun Finsupp.lcoeFun
@[simp]
theorem lsingle_apply (a : α) (b : M) : (lsingle a : M →ₗ[R] α →₀ M) b = single a b :=
rfl
#align finsupp.lsingle_apply Finsupp.lsingle_apply
@[simp]
theorem lapply_apply (a : α) (f : α →₀ M) : (lapply a : (α →₀ M) →ₗ[R] M) f = f a :=
rfl
#align finsupp.lapply_apply Finsupp.lapply_apply
@[simp]
theorem lapply_comp_lsingle_same (a : α) : lapply a ∘ₗ lsingle a = (.id : M →ₗ[R] M) := by ext; simp
@[simp]
| Mathlib/LinearAlgebra/Finsupp.lean | 237 | 238 | theorem lapply_comp_lsingle_of_ne (a a' : α) (h : a ≠ a') :
lapply a ∘ₗ lsingle a' = (0 : M →ₗ[R] M) := by | ext; simp [h.symm]
| [
" ⇑(x + y) = ⇑x + ⇑y",
" (x + y) x✝ = (⇑x + ⇑y) x✝",
" { toFun := DFunLike.coe, map_add' := ⋯ }.toFun (x • y) =\n (RingHom.id R) x • { toFun := DFunLike.coe, map_add' := ⋯ }.toFun y",
" { toFun := DFunLike.coe, map_add' := ⋯ }.toFun (x • y) x✝ =\n ((RingHom.id R) x • { toFun := DFunLike.coe, map_add' :=... | [
" ⇑(x + y) = ⇑x + ⇑y",
" (x + y) x✝ = (⇑x + ⇑y) x✝",
" { toFun := DFunLike.coe, map_add' := ⋯ }.toFun (x • y) =\n (RingHom.id R) x • { toFun := DFunLike.coe, map_add' := ⋯ }.toFun y",
" { toFun := DFunLike.coe, map_add' := ⋯ }.toFun (x • y) x✝ =\n ((RingHom.id R) x • { toFun := DFunLike.coe, map_add' :=... |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
simp [disjoint_def]
#align linear_map.disjoint_ker LinearMap.disjoint_ker
theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
#align linear_map.ker_eq_bot' LinearMap.ker_eq_bot'
theorem ker_eq_bot_of_inverse {τ₂₁ : R₂ →+* R} [RingHomInvPair τ₁₂ τ₂₁] {f : M →ₛₗ[τ₁₂] M₂}
{g : M₂ →ₛₗ[τ₂₁] M} (h : (g.comp f : M →ₗ[R] M) = id) : ker f = ⊥ :=
ker_eq_bot'.2 fun m hm => by rw [← id_apply (R := R) m, ← h, comp_apply, hm, g.map_zero]
#align linear_map.ker_eq_bot_of_inverse LinearMap.ker_eq_bot_of_inverse
theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} :
p ≤ ker f ↔ map f p = ⊥ := by rw [ker, eq_bot_iff, map_le_iff_le_comap]
#align linear_map.le_ker_iff_map LinearMap.le_ker_iff_map
| Mathlib/Algebra/Module/Submodule/Ker.lean | 125 | 126 | theorem ker_codRestrict {τ₂₁ : R₂ →+* R} (p : Submodule R M) (f : M₂ →ₛₗ[τ₂₁] M) (hf) :
ker (codRestrict p f hf) = ker f := by | rw [ker, comap_codRestrict, Submodule.map_bot]; rfl
| [
" ker f ≤ ker (g.comp f)",
" ker f ≤ comap f (ker g)",
" ker f ⊔ ker g ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (g ∘ₗ f)",
" x ∈ comap f p",
" Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0",
" ker f = ⊥ ↔ ∀ (m : M), f m = 0 → m = 0",
" m = 0",
" p ≤ ker f ↔ map f p = ⊥",
" ker (co... | [
" ker f ≤ ker (g.comp f)",
" ker f ≤ comap f (ker g)",
" ker f ⊔ ker g ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (g ∘ₗ f)",
" x ∈ comap f p",
" Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0",
" ker f = ⊥ ↔ ∀ (m : M), f m = 0 → m = 0",
" m = 0",
" p ≤ ker f ↔ map f p = ⊥",
" ker (co... |
import Mathlib.Algebra.Ring.Int
import Mathlib.SetTheory.Game.PGame
import Mathlib.Tactic.Abel
#align_import set_theory.game.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
-- Porting note: many definitions here are noncomputable as the compiler does not support PGame.rec
noncomputable section
namespace SetTheory
open Function PGame
open PGame
universe u
-- Porting note: moved the setoid instance to PGame.lean
abbrev Game :=
Quotient PGame.setoid
#align game SetTheory.Game
namespace Game
-- Porting note (#11445): added this definition
instance : Neg Game where
neg := Quot.map Neg.neg <| fun _ _ => (neg_equiv_neg_iff).2
instance : Zero Game where zero := ⟦0⟧
instance : Add Game where
add := Quotient.map₂ HAdd.hAdd <| fun _ _ hx _ _ hy => PGame.add_congr hx hy
instance instAddCommGroupWithOneGame : AddCommGroupWithOne Game where
zero := ⟦0⟧
one := ⟦1⟧
add_zero := by
rintro ⟨x⟩
exact Quot.sound (add_zero_equiv x)
zero_add := by
rintro ⟨x⟩
exact Quot.sound (zero_add_equiv x)
add_assoc := by
rintro ⟨x⟩ ⟨y⟩ ⟨z⟩
exact Quot.sound add_assoc_equiv
add_left_neg := Quotient.ind <| fun x => Quot.sound (add_left_neg_equiv x)
add_comm := by
rintro ⟨x⟩ ⟨y⟩
exact Quot.sound add_comm_equiv
nsmul := nsmulRec
zsmul := zsmulRec
instance : Inhabited Game :=
⟨0⟩
instance instPartialOrderGame : PartialOrder Game where
le := Quotient.lift₂ (· ≤ ·) fun x₁ y₁ x₂ y₂ hx hy => propext (le_congr hx hy)
le_refl := by
rintro ⟨x⟩
exact le_refl x
le_trans := by
rintro ⟨x⟩ ⟨y⟩ ⟨z⟩
exact @le_trans _ _ x y z
le_antisymm := by
rintro ⟨x⟩ ⟨y⟩ h₁ h₂
apply Quot.sound
exact ⟨h₁, h₂⟩
lt := Quotient.lift₂ (· < ·) fun x₁ y₁ x₂ y₂ hx hy => propext (lt_congr hx hy)
lt_iff_le_not_le := by
rintro ⟨x⟩ ⟨y⟩
exact @lt_iff_le_not_le _ _ x y
def LF : Game → Game → Prop :=
Quotient.lift₂ PGame.LF fun _ _ _ _ hx hy => propext (lf_congr hx hy)
#align game.lf SetTheory.Game.LF
local infixl:50 " ⧏ " => LF
@[simp]
| Mathlib/SetTheory/Game/Basic.lean | 111 | 113 | theorem not_le : ∀ {x y : Game}, ¬x ≤ y ↔ y ⧏ x := by |
rintro ⟨x⟩ ⟨y⟩
exact PGame.not_le
| [
" ∀ (a b c : Game), a + b + c = a + (b + c)",
" Quot.mk Setoid.r x + Quot.mk Setoid.r y + Quot.mk Setoid.r z =\n Quot.mk Setoid.r x + (Quot.mk Setoid.r y + Quot.mk Setoid.r z)",
" ∀ (a : Game), 0 + a = a",
" 0 + Quot.mk Setoid.r x = Quot.mk Setoid.r x",
" ∀ (a : Game), a + 0 = a",
" Quot.mk Setoid.r x ... | [
" ∀ (a b c : Game), a + b + c = a + (b + c)",
" Quot.mk Setoid.r x + Quot.mk Setoid.r y + Quot.mk Setoid.r z =\n Quot.mk Setoid.r x + (Quot.mk Setoid.r y + Quot.mk Setoid.r z)",
" ∀ (a : Game), 0 + a = a",
" 0 + Quot.mk Setoid.r x = Quot.mk Setoid.r x",
" ∀ (a : Game), a + 0 = a",
" Quot.mk Setoid.r x ... |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Kernel
variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f]
abbrev kernelSubobject : Subobject X :=
Subobject.mk (kernel.ι f)
#align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject
def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f :=
Subobject.underlyingIso (kernel.ι f)
#align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow :
(kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by
simp [kernelSubobjectIso]
#align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow' :
(kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f := by
simp [kernelSubobjectIso]
#align category_theory.limits.kernel_subobject_arrow' CategoryTheory.Limits.kernelSubobject_arrow'
@[reassoc (attr := simp), elementwise (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 110 | 112 | theorem kernelSubobject_arrow_comp : (kernelSubobject f).arrow ≫ f = 0 := by |
rw [← kernelSubobject_arrow]
simp only [Category.assoc, kernel.condition, comp_zero]
| [
" (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow",
" (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f",
" (kernelSubobject f).arrow ≫ f = 0",
" ((kernelSubobjectIso f).hom ≫ kernel.ι f) ≫ f = 0"
] | [
" (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow",
" (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f",
" (kernelSubobject f).arrow ≫ f = 0"
] |
import Mathlib.Topology.Algebra.InfiniteSum.Constructions
import Mathlib.Topology.Algebra.Module.Basic
#align_import topology.algebra.infinite_sum.module from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
variable {α β γ δ : Type*}
open Filter Finset Function
variable {ι κ R R₂ M M₂ : Type*}
section HasSum
-- Results in this section hold for continuous additive monoid homomorphisms or equivalences but we
-- don't have bundled continuous additive homomorphisms.
variable [Semiring R] [Semiring R₂] [AddCommMonoid M] [Module R M] [AddCommMonoid M₂] [Module R₂ M₂]
[TopologicalSpace M] [TopologicalSpace M₂] {σ : R →+* R₂} {σ' : R₂ →+* R} [RingHomInvPair σ σ']
[RingHomInvPair σ' σ]
protected theorem ContinuousLinearMap.hasSum {f : ι → M} (φ : M →SL[σ] M₂) {x : M}
(hf : HasSum f x) : HasSum (fun b : ι ↦ φ (f b)) (φ x) := by
simpa only using hf.map φ.toLinearMap.toAddMonoidHom φ.continuous
#align continuous_linear_map.has_sum ContinuousLinearMap.hasSum
alias HasSum.mapL := ContinuousLinearMap.hasSum
set_option linter.uppercaseLean3 false in
#align has_sum.mapL HasSum.mapL
protected theorem ContinuousLinearMap.summable {f : ι → M} (φ : M →SL[σ] M₂) (hf : Summable f) :
Summable fun b : ι ↦ φ (f b) :=
(hf.hasSum.mapL φ).summable
#align continuous_linear_map.summable ContinuousLinearMap.summable
alias Summable.mapL := ContinuousLinearMap.summable
set_option linter.uppercaseLean3 false in
#align summable.mapL Summable.mapL
protected theorem ContinuousLinearMap.map_tsum [T2Space M₂] {f : ι → M} (φ : M →SL[σ] M₂)
(hf : Summable f) : φ (∑' z, f z) = ∑' z, φ (f z) :=
(hf.hasSum.mapL φ).tsum_eq.symm
#align continuous_linear_map.map_tsum ContinuousLinearMap.map_tsum
protected theorem ContinuousLinearEquiv.hasSum {f : ι → M} (e : M ≃SL[σ] M₂) {y : M₂} :
HasSum (fun b : ι ↦ e (f b)) y ↔ HasSum f (e.symm y) :=
⟨fun h ↦ by simpa only [e.symm.coe_coe, e.symm_apply_apply] using h.mapL (e.symm : M₂ →SL[σ'] M),
fun h ↦ by simpa only [e.coe_coe, e.apply_symm_apply] using (e : M →SL[σ] M₂).hasSum h⟩
#align continuous_linear_equiv.has_sum ContinuousLinearEquiv.hasSum
protected theorem ContinuousLinearEquiv.hasSum' {f : ι → M} (e : M ≃SL[σ] M₂) {x : M} :
HasSum (fun b : ι ↦ e (f b)) (e x) ↔ HasSum f x := by
rw [e.hasSum, ContinuousLinearEquiv.symm_apply_apply]
#align continuous_linear_equiv.has_sum' ContinuousLinearEquiv.hasSum'
protected theorem ContinuousLinearEquiv.summable {f : ι → M} (e : M ≃SL[σ] M₂) :
(Summable fun b : ι ↦ e (f b)) ↔ Summable f :=
⟨fun hf ↦ (e.hasSum.1 hf.hasSum).summable, (e : M →SL[σ] M₂).summable⟩
#align continuous_linear_equiv.summable ContinuousLinearEquiv.summable
| Mathlib/Topology/Algebra/InfiniteSum/Module.lean | 167 | 178 | theorem ContinuousLinearEquiv.tsum_eq_iff [T2Space M] [T2Space M₂] {f : ι → M} (e : M ≃SL[σ] M₂)
{y : M₂} : (∑' z, e (f z)) = y ↔ ∑' z, f z = e.symm y := by |
by_cases hf : Summable f
· exact
⟨fun h ↦ (e.hasSum.mp ((e.summable.mpr hf).hasSum_iff.mpr h)).tsum_eq, fun h ↦
(e.hasSum.mpr (hf.hasSum_iff.mpr h)).tsum_eq⟩
· have hf' : ¬Summable fun z ↦ e (f z) := fun h ↦ hf (e.summable.mp h)
rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable hf']
refine ⟨?_, fun H ↦ ?_⟩
· rintro rfl
simp
· simpa using congr_arg (fun z ↦ e z) H
| [
" HasSum (fun b => φ (f b)) (φ x)",
" HasSum f (e.symm y)",
" HasSum (fun b => e (f b)) y",
" HasSum (fun b => e (f b)) (e x) ↔ HasSum f x",
" ∑' (z : ι), e (f z) = y ↔ ∑' (z : ι), f z = e.symm y",
" 0 = y ↔ 0 = e.symm y",
" 0 = y → 0 = e.symm y",
" 0 = e.symm 0",
" 0 = y"
] | [
" HasSum (fun b => φ (f b)) (φ x)",
" HasSum f (e.symm y)",
" HasSum (fun b => e (f b)) y",
" HasSum (fun b => e (f b)) (e x) ↔ HasSum f x",
" ∑' (z : ι), e (f z) = y ↔ ∑' (z : ι), f z = e.symm y"
] |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 78 | 79 | theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by |
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
| [
" ⇑e ⁻¹' Iic b = Iic (e.symm b)",
" x ∈ ⇑e ⁻¹' Iic b ↔ x ∈ Iic (e.symm b)",
" ⇑e ⁻¹' Ici b = Ici (e.symm b)",
" x ∈ ⇑e ⁻¹' Ici b ↔ x ∈ Ici (e.symm b)",
" ⇑e ⁻¹' Iio b = Iio (e.symm b)",
" x ∈ ⇑e ⁻¹' Iio b ↔ x ∈ Iio (e.symm b)",
" ⇑e ⁻¹' Ioi b = Ioi (e.symm b)",
" x ∈ ⇑e ⁻¹' Ioi b ↔ x ∈ Ioi (e.symm b)"... | [
" ⇑e ⁻¹' Iic b = Iic (e.symm b)",
" x ∈ ⇑e ⁻¹' Iic b ↔ x ∈ Iic (e.symm b)",
" ⇑e ⁻¹' Ici b = Ici (e.symm b)",
" x ∈ ⇑e ⁻¹' Ici b ↔ x ∈ Ici (e.symm b)",
" ⇑e ⁻¹' Iio b = Iio (e.symm b)",
" x ∈ ⇑e ⁻¹' Iio b ↔ x ∈ Iio (e.symm b)",
" ⇑e ⁻¹' Ioi b = Ioi (e.symm b)",
" x ∈ ⇑e ⁻¹' Ioi b ↔ x ∈ Ioi (e.symm b)"... |
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Tactic.Linarith
#align_import combinatorics.simple_graph.acyclic from "leanprover-community/mathlib"@"b07688016d62f81d14508ff339ea3415558d6353"
universe u v
namespace SimpleGraph
open Walk
variable {V : Type u} (G : SimpleGraph V)
def IsAcyclic : Prop := ∀ ⦃v : V⦄ (c : G.Walk v v), ¬c.IsCycle
#align simple_graph.is_acyclic SimpleGraph.IsAcyclic
@[mk_iff]
structure IsTree : Prop where
protected isConnected : G.Connected
protected IsAcyclic : G.IsAcyclic
#align simple_graph.is_tree SimpleGraph.IsTree
variable {G}
@[simp] lemma isAcyclic_bot : IsAcyclic (⊥ : SimpleGraph V) := fun _a _w hw ↦ hw.ne_bot rfl
theorem isAcyclic_iff_forall_adj_isBridge :
G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w) := by
simp_rw [isBridge_iff_adj_and_forall_cycle_not_mem]
constructor
· intro ha v w hvw
apply And.intro hvw
intro u p hp
cases ha p hp
· rintro hb v (_ | ⟨ha, p⟩) hp
· exact hp.not_of_nil
· apply (hb ha).2 _ hp
rw [Walk.edges_cons]
apply List.mem_cons_self
#align simple_graph.is_acyclic_iff_forall_adj_is_bridge SimpleGraph.isAcyclic_iff_forall_adj_isBridge
theorem isAcyclic_iff_forall_edge_isBridge :
G.IsAcyclic ↔ ∀ ⦃e⦄, e ∈ (G.edgeSet) → G.IsBridge e := by
simp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]
#align simple_graph.is_acyclic_iff_forall_edge_is_bridge SimpleGraph.isAcyclic_iff_forall_edge_isBridge
theorem IsAcyclic.path_unique {G : SimpleGraph V} (h : G.IsAcyclic) {v w : V} (p q : G.Path v w) :
p = q := by
obtain ⟨p, hp⟩ := p
obtain ⟨q, hq⟩ := q
rw [Subtype.mk.injEq]
induction p with
| nil =>
cases (Walk.isPath_iff_eq_nil _).mp hq
rfl
| cons ph p ih =>
rw [isAcyclic_iff_forall_adj_isBridge] at h
specialize h ph
rw [isBridge_iff_adj_and_forall_walk_mem_edges] at h
replace h := h.2 (q.append p.reverse)
simp only [Walk.edges_append, Walk.edges_reverse, List.mem_append, List.mem_reverse] at h
cases' h with h h
· cases q with
| nil => simp [Walk.isPath_def] at hp
| cons _ q =>
rw [Walk.cons_isPath_iff] at hp hq
simp only [Walk.edges_cons, List.mem_cons, Sym2.eq_iff, true_and] at h
rcases h with (⟨h, rfl⟩ | ⟨rfl, rfl⟩) | h
· cases ih hp.1 q hq.1
rfl
· simp at hq
· exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hq.2
· rw [Walk.cons_isPath_iff] at hp
exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hp.2
#align simple_graph.is_acyclic.path_unique SimpleGraph.IsAcyclic.path_unique
| Mathlib/Combinatorics/SimpleGraph/Acyclic.lean | 118 | 127 | theorem isAcyclic_of_path_unique (h : ∀ (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by |
intro v c hc
simp only [Walk.isCycle_def, Ne] at hc
cases c with
| nil => cases hc.2.1 rfl
| cons ha c' =>
simp only [Walk.cons_isTrail_iff, Walk.support_cons, List.tail_cons, true_and_iff] at hc
specialize h _ _ ⟨c', by simp only [Walk.isPath_def, hc.2]⟩ (Path.singleton ha.symm)
rw [Path.singleton, Subtype.mk.injEq] at h
simp [h] at hc
| [
" G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w)",
" G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.Adj v w ∧ ∀ ⦃u : V⦄ (p : G.Walk u u), p.IsCycle → s(v, w) ∉ p.edges",
" G.IsAcyclic → ∀ ⦃v w : V⦄, G.Adj v w → G.Adj v w ∧ ∀ ⦃u : V⦄ (p : G.Walk u u), p.IsCycle → s(v, w) ∉ p.edges",
" G.Adj v w ∧ ∀ ⦃u : V... | [
" G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w)",
" G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.Adj v w ∧ ∀ ⦃u : V⦄ (p : G.Walk u u), p.IsCycle → s(v, w) ∉ p.edges",
" G.IsAcyclic → ∀ ⦃v w : V⦄, G.Adj v w → G.Adj v w ∧ ∀ ⦃u : V⦄ (p : G.Walk u u), p.IsCycle → s(v, w) ∉ p.edges",
" G.Adj v w ∧ ∀ ⦃u : V... |
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.Norm
#align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
open scoped Matrix
open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField
namespace Algebra
variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι]
variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C]
section Discr
-- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in
-- mathlib3.
noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B]
[Fintype ι] (b : ι → B) := (traceMatrix A b).det
#align algebra.discr Algebra.discr
theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl
variable {A C} in
theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) :
Algebra.discr A b = Algebra.discr A (f ∘ b) := by
rw [discr_def]; congr; ext
simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv]
#align algebra.discr_def Algebra.discr_def
variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι']
section Basic
@[simp]
theorem discr_reindex (b : Basis ι A B) (f : ι ≃ ι') : discr A (b ∘ ⇑f.symm) = discr A b := by
classical rw [← Basis.coe_reindex, discr_def, traceMatrix_reindex, det_reindex_self, ← discr_def]
#align algebra.discr_reindex Algebra.discr_reindex
| Mathlib/RingTheory/Discriminant.lean | 93 | 106 | theorem discr_zero_of_not_linearIndependent [IsDomain A] {b : ι → B}
(hli : ¬LinearIndependent A b) : discr A b = 0 := by |
classical
obtain ⟨g, hg, i, hi⟩ := Fintype.not_linearIndependent_iff.1 hli
have : (traceMatrix A b) *ᵥ g = 0 := by
ext i
have : ∀ j, (trace A B) (b i * b j) * g j = (trace A B) (g j • b j * b i) := by
intro j;
simp [mul_comm]
simp only [mulVec, dotProduct, traceMatrix_apply, Pi.zero_apply, traceForm_apply, fun j =>
this j, ← map_sum, ← sum_mul, hg, zero_mul, LinearMap.map_zero]
by_contra h
rw [discr_def] at h
simp [Matrix.eq_zero_of_mulVec_eq_zero h this] at hi
| [
" discr A b = discr A (⇑f ∘ b)",
" (traceMatrix A b).det = discr A (⇑f ∘ b)",
" traceMatrix A b = traceMatrix A (⇑f ∘ b)",
" traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝",
" discr A (⇑b ∘ ⇑f.symm) = discr A ⇑b",
" discr A b = 0",
" traceMatrix A b *ᵥ g = 0",
" (traceMatrix A b *ᵥ g) i = 0 i",
... | [
" discr A b = discr A (⇑f ∘ b)",
" (traceMatrix A b).det = discr A (⇑f ∘ b)",
" traceMatrix A b = traceMatrix A (⇑f ∘ b)",
" traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝",
" discr A (⇑b ∘ ⇑f.symm) = discr A ⇑b",
" discr A b = 0"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
#align_import analysis.special_functions.pow.continuity from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate
open Filter Finset Set
section CpowLimits
open Complex
variable {α : Type*}
theorem zero_cpow_eq_nhds {b : ℂ} (hb : b ≠ 0) : (fun x : ℂ => (0 : ℂ) ^ x) =ᶠ[𝓝 b] 0 := by
suffices ∀ᶠ x : ℂ in 𝓝 b, x ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [zero_cpow hx, Pi.zero_apply]
exact IsOpen.eventually_mem isOpen_ne hb
#align zero_cpow_eq_nhds zero_cpow_eq_nhds
theorem cpow_eq_nhds {a b : ℂ} (ha : a ≠ 0) :
(fun x => x ^ b) =ᶠ[𝓝 a] fun x => exp (log x * b) := by
suffices ∀ᶠ x : ℂ in 𝓝 a, x ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
exact IsOpen.eventually_mem isOpen_ne ha
#align cpow_eq_nhds cpow_eq_nhds
theorem cpow_eq_nhds' {p : ℂ × ℂ} (hp_fst : p.fst ≠ 0) :
(fun x => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) := by
suffices ∀ᶠ x : ℂ × ℂ in 𝓝 p, x.1 ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
refine IsOpen.eventually_mem ?_ hp_fst
change IsOpen { x : ℂ × ℂ | x.1 = 0 }ᶜ
rw [isOpen_compl_iff]
exact isClosed_eq continuous_fst continuous_const
#align cpow_eq_nhds' cpow_eq_nhds'
-- Continuity of `fun x => a ^ x`: union of these two lemmas is optimal.
theorem continuousAt_const_cpow {a b : ℂ} (ha : a ≠ 0) : ContinuousAt (fun x : ℂ => a ^ x) b := by
have cpow_eq : (fun x : ℂ => a ^ x) = fun x => exp (log a * x) := by
ext1 b
rw [cpow_def_of_ne_zero ha]
rw [cpow_eq]
exact continuous_exp.continuousAt.comp (ContinuousAt.mul continuousAt_const continuousAt_id)
#align continuous_at_const_cpow continuousAt_const_cpow
theorem continuousAt_const_cpow' {a b : ℂ} (h : b ≠ 0) : ContinuousAt (fun x : ℂ => a ^ x) b := by
by_cases ha : a = 0
· rw [ha, continuousAt_congr (zero_cpow_eq_nhds h)]
exact continuousAt_const
· exact continuousAt_const_cpow ha
#align continuous_at_const_cpow' continuousAt_const_cpow'
| Mathlib/Analysis/SpecialFunctions/Pow/Continuity.lean | 84 | 91 | theorem continuousAt_cpow {p : ℂ × ℂ} (hp_fst : p.fst ∈ slitPlane) :
ContinuousAt (fun x : ℂ × ℂ => x.1 ^ x.2) p := by |
rw [continuousAt_congr (cpow_eq_nhds' <| slitPlane_ne_zero hp_fst)]
refine continuous_exp.continuousAt.comp ?_
exact
ContinuousAt.mul
(ContinuousAt.comp (continuousAt_clog hp_fst) continuous_fst.continuousAt)
continuous_snd.continuousAt
| [
" (fun x => 0 ^ x) =ᶠ[𝓝 b] 0",
" (fun x => 0 ^ x) x = 0 x",
" 0 ^ x = OfNat.ofNat 0 x",
" ∀ᶠ (x : ℂ) in 𝓝 b, x ≠ 0",
" (fun x => x ^ b) =ᶠ[𝓝 a] fun x => cexp (x.log * b)",
" (fun x => x ^ b) x = (fun x => cexp (x.log * b)) x",
" x ^ b = cexp (x.log * b)",
" ∀ᶠ (x : ℂ) in 𝓝 a, x ≠ 0",
" (fun x =>... | [
" (fun x => 0 ^ x) =ᶠ[𝓝 b] 0",
" (fun x => 0 ^ x) x = 0 x",
" 0 ^ x = OfNat.ofNat 0 x",
" ∀ᶠ (x : ℂ) in 𝓝 b, x ≠ 0",
" (fun x => x ^ b) =ᶠ[𝓝 a] fun x => cexp (x.log * b)",
" (fun x => x ^ b) x = (fun x => cexp (x.log * b)) x",
" x ^ b = cexp (x.log * b)",
" ∀ᶠ (x : ℂ) in 𝓝 a, x ≠ 0",
" (fun x =>... |
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.matrix.basis from "leanprover-community/mathlib"@"6c263e4bfc2e6714de30f22178b4d0ca4d149a76"
noncomputable section
open LinearMap Matrix Set Submodule
open Matrix
section BasisToMatrix
variable {ι ι' κ κ' : Type*}
variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
variable {R₂ M₂ : Type*} [CommRing R₂] [AddCommGroup M₂] [Module R₂ M₂]
open Function Matrix
def Basis.toMatrix (e : Basis ι R M) (v : ι' → M) : Matrix ι ι' R := fun i j => e.repr (v j) i
#align basis.to_matrix Basis.toMatrix
variable (e : Basis ι R M) (v : ι' → M) (i : ι) (j : ι')
namespace Basis
theorem toMatrix_apply : e.toMatrix v i j = e.repr (v j) i :=
rfl
#align basis.to_matrix_apply Basis.toMatrix_apply
theorem toMatrix_transpose_apply : (e.toMatrix v)ᵀ j = e.repr (v j) :=
funext fun _ => rfl
#align basis.to_matrix_transpose_apply Basis.toMatrix_transpose_apply
theorem toMatrix_eq_toMatrix_constr [Fintype ι] [DecidableEq ι] (v : ι → M) :
e.toMatrix v = LinearMap.toMatrix e e (e.constr ℕ v) := by
ext
rw [Basis.toMatrix_apply, LinearMap.toMatrix_apply, Basis.constr_basis]
#align basis.to_matrix_eq_to_matrix_constr Basis.toMatrix_eq_toMatrix_constr
-- TODO (maybe) Adjust the definition of `Basis.toMatrix` to eliminate the transpose.
theorem coePiBasisFun.toMatrix_eq_transpose [Finite ι] :
((Pi.basisFun R ι).toMatrix : Matrix ι ι R → Matrix ι ι R) = Matrix.transpose := by
ext M i j
rfl
#align basis.coe_pi_basis_fun.to_matrix_eq_transpose Basis.coePiBasisFun.toMatrix_eq_transpose
@[simp]
theorem toMatrix_self [DecidableEq ι] : e.toMatrix e = 1 := by
unfold Basis.toMatrix
ext i j
simp [Basis.equivFun, Matrix.one_apply, Finsupp.single_apply, eq_comm]
#align basis.to_matrix_self Basis.toMatrix_self
| Mathlib/LinearAlgebra/Matrix/Basis.lean | 86 | 92 | theorem toMatrix_update [DecidableEq ι'] (x : M) :
e.toMatrix (Function.update v j x) = Matrix.updateColumn (e.toMatrix v) j (e.repr x) := by |
ext i' k
rw [Basis.toMatrix, Matrix.updateColumn_apply, e.toMatrix_apply]
split_ifs with h
· rw [h, update_same j x v]
· rw [update_noteq h]
| [
" e.toMatrix v = (LinearMap.toMatrix e e) ((e.constr ℕ) v)",
" e.toMatrix v i✝ j✝ = (LinearMap.toMatrix e e) ((e.constr ℕ) v) i✝ j✝",
" (Pi.basisFun R ι).toMatrix = transpose",
" (Pi.basisFun R ι).toMatrix M i j = Mᵀ i j",
" e.toMatrix ⇑e = 1",
" (fun i j => (e.repr (e j)) i) = 1",
" (e.repr (e j)) i = ... | [
" e.toMatrix v = (LinearMap.toMatrix e e) ((e.constr ℕ) v)",
" e.toMatrix v i✝ j✝ = (LinearMap.toMatrix e e) ((e.constr ℕ) v) i✝ j✝",
" (Pi.basisFun R ι).toMatrix = transpose",
" (Pi.basisFun R ι).toMatrix M i j = Mᵀ i j",
" e.toMatrix ⇑e = 1",
" (fun i j => (e.repr (e j)) i) = 1",
" (e.repr (e j)) i = ... |
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section Infsep
open ENNReal
open Set Function
noncomputable def infsep [EDist α] (s : Set α) : ℝ :=
ENNReal.toReal s.einfsep
#align set.infsep Set.infsep
section EDist
variable [EDist α] {x y : α} {s : Set α}
| Mathlib/Topology/MetricSpace/Infsep.lean | 332 | 333 | theorem infsep_zero : s.infsep = 0 ↔ s.einfsep = 0 ∨ s.einfsep = ∞ := by |
rw [infsep, ENNReal.toReal_eq_zero_iff]
| [
" s.infsep = 0 ↔ s.einfsep = 0 ∨ s.einfsep = ⊤"
] | [
" s.infsep = 0 ↔ s.einfsep = 0 ∨ s.einfsep = ⊤"
] |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 248 | 249 | theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by | simp [toList]
| [
" toList 1 x = []",
" p.toList x = [] ↔ x ∉ p.support",
" (p.toList x).length = (p.cycleOf x).support.card",
" p.toList x ≠ [y]",
" False",
" 2 ≤ (p.toList x).length ↔ x ∈ p.support",
" (p.toList x).get ⟨n, hn⟩ = (p ^ n) x",
" (p.toList x).get ⟨0, ⋯⟩ = x"
] | [
" toList 1 x = []",
" p.toList x = [] ↔ x ∉ p.support",
" (p.toList x).length = (p.cycleOf x).support.card",
" p.toList x ≠ [y]",
" False",
" 2 ≤ (p.toList x).length ↔ x ∈ p.support",
" (p.toList x).get ⟨n, hn⟩ = (p ^ n) x",
" (p.toList x).get ⟨0, ⋯⟩ = x"
] |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
simp [disjoint_def]
#align linear_map.disjoint_ker LinearMap.disjoint_ker
| Mathlib/Algebra/Module/Submodule/Ker.lean | 112 | 113 | theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by |
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
| [
" ker f ≤ ker (g.comp f)",
" ker f ≤ comap f (ker g)",
" ker f ⊔ ker g ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (g ∘ₗ f)",
" x ∈ comap f p",
" Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0",
" ker f = ⊥ ↔ ∀ (m : M), f m = 0 → m = 0"
] | [
" ker f ≤ ker (g.comp f)",
" ker f ≤ comap f (ker g)",
" ker f ⊔ ker g ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (f ∘ₗ g)",
" ker f ≤ ker (g ∘ₗ f)",
" x ∈ comap f p",
" Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0",
" ker f = ⊥ ↔ ∀ (m : M), f m = 0 → m = 0"
] |
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section DescFactorial
def descFactorial (n : ℕ) : ℕ → ℕ
| 0 => 1
| k + 1 => (n - k) * descFactorial n k
#align nat.desc_factorial Nat.descFactorial
@[simp]
theorem descFactorial_zero (n : ℕ) : n.descFactorial 0 = 1 :=
rfl
#align nat.desc_factorial_zero Nat.descFactorial_zero
@[simp]
theorem descFactorial_succ (n k : ℕ) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k :=
rfl
#align nat.desc_factorial_succ Nat.descFactorial_succ
theorem zero_descFactorial_succ (k : ℕ) : (0 : ℕ).descFactorial (k + 1) = 0 := by
rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul]
#align nat.zero_desc_factorial_succ Nat.zero_descFactorial_succ
| Mathlib/Data/Nat/Factorial/Basic.lean | 344 | 344 | theorem descFactorial_one (n : ℕ) : n.descFactorial 1 = n := by | simp
| [
" descFactorial 0 (k + 1) = 0",
" n.descFactorial 1 = n"
] | [
" descFactorial 0 (k + 1) = 0",
" n.descFactorial 1 = n"
] |
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.RingTheory.PolynomialAlgebra
#align_import linear_algebra.matrix.charpoly.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
universe u v w
namespace Matrix
open Finset Matrix Polynomial
variable {R S : Type*} [CommRing R] [CommRing S]
variable {m n : Type*} [DecidableEq m] [DecidableEq n] [Fintype m] [Fintype n]
variable (M₁₁ : Matrix m m R) (M₁₂ : Matrix m n R) (M₂₁ : Matrix n m R) (M₂₂ M : Matrix n n R)
variable (i j : n)
def charmatrix (M : Matrix n n R) : Matrix n n R[X] :=
Matrix.scalar n (X : R[X]) - (C : R →+* R[X]).mapMatrix M
#align charmatrix Matrix.charmatrix
theorem charmatrix_apply :
charmatrix M i j = (Matrix.diagonal fun _ : n => X) i j - C (M i j) :=
rfl
#align charmatrix_apply Matrix.charmatrix_apply
@[simp]
theorem charmatrix_apply_eq : charmatrix M i i = (X : R[X]) - C (M i i) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, map_apply,
diagonal_apply_eq]
#align charmatrix_apply_eq Matrix.charmatrix_apply_eq
@[simp]
theorem charmatrix_apply_ne (h : i ≠ j) : charmatrix M i j = -C (M i j) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, diagonal_apply_ne _ h,
map_apply, sub_eq_neg_self]
#align charmatrix_apply_ne Matrix.charmatrix_apply_ne
| Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean | 67 | 76 | theorem matPolyEquiv_charmatrix : matPolyEquiv (charmatrix M) = X - C M := by |
ext k i j
simp only [matPolyEquiv_coeff_apply, coeff_sub, Pi.sub_apply]
by_cases h : i = j
· subst h
rw [charmatrix_apply_eq, coeff_sub]
simp only [coeff_X, coeff_C]
split_ifs <;> simp
· rw [charmatrix_apply_ne _ _ _ h, coeff_X, coeff_neg, coeff_C, coeff_C]
split_ifs <;> simp [h]
| [
" M.charmatrix i i = X - C (M i i)",
" M.charmatrix i j = -C (M i j)",
" matPolyEquiv M.charmatrix = X - C M",
" (matPolyEquiv M.charmatrix).coeff k i j = (X - C M).coeff k i j",
" (M.charmatrix i j).coeff k = (X.coeff k - (C M).coeff k) i j",
" (M.charmatrix i i).coeff k = (X.coeff k - (C M).coeff k) i i... | [
" M.charmatrix i i = X - C (M i i)",
" M.charmatrix i j = -C (M i j)",
" matPolyEquiv M.charmatrix = X - C M"
] |
import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.normed.ring.seminorm from "leanprover-community/mathlib"@"7ea604785a41a0681eac70c5a82372493dbefc68"
open NNReal
variable {F R S : Type*} (x y : R) (r : ℝ)
structure RingSeminorm (R : Type*) [NonUnitalNonAssocRing R] extends AddGroupSeminorm R where
mul_le' : ∀ x y : R, toFun (x * y) ≤ toFun x * toFun y
#align ring_seminorm RingSeminorm
structure RingNorm (R : Type*) [NonUnitalNonAssocRing R] extends RingSeminorm R, AddGroupNorm R
#align ring_norm RingNorm
structure MulRingSeminorm (R : Type*) [NonAssocRing R] extends AddGroupSeminorm R,
MonoidWithZeroHom R ℝ
#align mul_ring_seminorm MulRingSeminorm
structure MulRingNorm (R : Type*) [NonAssocRing R] extends MulRingSeminorm R, AddGroupNorm R
#align mul_ring_norm MulRingNorm
attribute [nolint docBlame]
RingSeminorm.toAddGroupSeminorm RingNorm.toAddGroupNorm RingNorm.toRingSeminorm
MulRingSeminorm.toAddGroupSeminorm MulRingSeminorm.toMonoidWithZeroHom
MulRingNorm.toAddGroupNorm MulRingNorm.toMulRingSeminorm
namespace RingSeminorm
section NonUnitalRing
variable [NonUnitalRing R]
instance funLike : FunLike (RingSeminorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance ringSeminormClass : RingSeminormClass (RingSeminorm R) R ℝ where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_mul_le_mul f := f.mul_le'
map_neg_eq_map f := f.neg'
#align ring_seminorm.ring_seminorm_class RingSeminorm.ringSeminormClass
@[simp]
theorem toFun_eq_coe (p : RingSeminorm R) : (p.toAddGroupSeminorm : R → ℝ) = p :=
rfl
#align ring_seminorm.to_fun_eq_coe RingSeminorm.toFun_eq_coe
@[ext]
theorem ext {p q : RingSeminorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
#align ring_seminorm.ext RingSeminorm.ext
instance : Zero (RingSeminorm R) :=
⟨{ AddGroupSeminorm.instZeroAddGroupSeminorm.zero with mul_le' :=
fun _ _ => (zero_mul _).ge }⟩
theorem eq_zero_iff {p : RingSeminorm R} : p = 0 ↔ ∀ x, p x = 0 :=
DFunLike.ext_iff
#align ring_seminorm.eq_zero_iff RingSeminorm.eq_zero_iff
| Mathlib/Analysis/Normed/Ring/Seminorm.lean | 116 | 116 | theorem ne_zero_iff {p : RingSeminorm R} : p ≠ 0 ↔ ∃ x, p x ≠ 0 := by | simp [eq_zero_iff]
| [
" f = g",
" { toAddGroupSeminorm := toAddGroupSeminorm✝, mul_le' := mul_le'✝ } = g",
" { toAddGroupSeminorm := toAddGroupSeminorm✝¹, mul_le' := mul_le'✝¹ } =\n { toAddGroupSeminorm := toAddGroupSeminorm✝, mul_le' := mul_le'✝ }",
" toAddGroupSeminorm✝¹ = toAddGroupSeminorm✝",
" toAddGroupSeminorm✝¹ x = to... | [
" f = g",
" { toAddGroupSeminorm := toAddGroupSeminorm✝, mul_le' := mul_le'✝ } = g",
" { toAddGroupSeminorm := toAddGroupSeminorm✝¹, mul_le' := mul_le'✝¹ } =\n { toAddGroupSeminorm := toAddGroupSeminorm✝, mul_le' := mul_le'✝ }",
" toAddGroupSeminorm✝¹ = toAddGroupSeminorm✝",
" toAddGroupSeminorm✝¹ x = to... |
import Mathlib.Order.Cover
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.GaloisConnection
#align_import order.modular_lattice from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open Set
variable {α : Type*}
class IsWeakUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy_covBy {a b : α} : a ⊓ b ⋖ a → a ⊓ b ⋖ b → a ⋖ a ⊔ b
#align is_weak_upper_modular_lattice IsWeakUpperModularLattice
class IsWeakLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_covBy_sup {a b : α} : a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ a
#align is_weak_lower_modular_lattice IsWeakLowerModularLattice
class IsUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy {a b : α} : a ⊓ b ⋖ a → b ⋖ a ⊔ b
#align is_upper_modular_lattice IsUpperModularLattice
class IsLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_sup {a b : α} : a ⋖ a ⊔ b → a ⊓ b ⋖ b
#align is_lower_modular_lattice IsLowerModularLattice
class IsModularLattice (α : Type*) [Lattice α] : Prop where
sup_inf_le_assoc_of_le : ∀ {x : α} (y : α) {z : α}, x ≤ z → (x ⊔ y) ⊓ z ≤ x ⊔ y ⊓ z
#align is_modular_lattice IsModularLattice
section UpperModular
variable [Lattice α] [IsUpperModularLattice α] {a b : α}
theorem covBy_sup_of_inf_covBy_left : a ⊓ b ⋖ a → b ⋖ a ⊔ b :=
IsUpperModularLattice.covBy_sup_of_inf_covBy
#align covby_sup_of_inf_covby_left covBy_sup_of_inf_covBy_left
| Mathlib/Order/ModularLattice.lean | 151 | 153 | theorem covBy_sup_of_inf_covBy_right : a ⊓ b ⋖ b → a ⋖ a ⊔ b := by |
rw [sup_comm, inf_comm]
exact covBy_sup_of_inf_covBy_left
| [
" a ⊓ b ⋖ b → a ⋖ a ⊔ b",
" b ⊓ a ⋖ b → a ⋖ b ⊔ a"
] | [
" a ⊓ b ⋖ b → a ⋖ a ⊔ b"
] |
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {α : Type*} {β : Type v} {γ δ : Type*}
namespace Multiset
def join : Multiset (Multiset α) → Multiset α :=
sum
#align multiset.join Multiset.join
theorem coe_join :
∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join α 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join α (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join α S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
| Mathlib/Data/Multiset/Bind.lean | 82 | 86 | theorem map_join (f : α → β) (S : Multiset (Multiset α)) :
map f (join S) = join (map (map f) S) := by |
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
| [
" (↑(List.map ofList (l :: L))).join = ↑(l :: L).join",
" a ∈ join 0 ↔ ∃ s ∈ 0, a ∈ s",
" ∀ (a_1 : Multiset α) (s : Multiset (Multiset α)),\n (a ∈ s.join ↔ ∃ s_1 ∈ s, a ∈ s_1) → (a ∈ (a_1 ::ₘ s).join ↔ ∃ s_1 ∈ a_1 ::ₘ s, a ∈ s_1)",
" card (join 0) = (map (⇑card) 0).sum",
" ∀ (a : Multiset α) (s : Multise... | [
" (↑(List.map ofList (l :: L))).join = ↑(l :: L).join",
" a ∈ join 0 ↔ ∃ s ∈ 0, a ∈ s",
" ∀ (a_1 : Multiset α) (s : Multiset (Multiset α)),\n (a ∈ s.join ↔ ∃ s_1 ∈ s, a ∈ s_1) → (a ∈ (a_1 ::ₘ s).join ↔ ∃ s_1 ∈ a_1 ::ₘ s, a ∈ s_1)",
" card (join 0) = (map (⇑card) 0).sum",
" ∀ (a : Multiset α) (s : Multise... |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
#align real.logb_neg_eq_logb Real.logb_neg_eq_logb
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 72 | 73 | theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by |
simp_rw [logb, log_mul hx hy, add_div]
| [
" b.logb 0 = 0",
" b.logb 1 = 0",
" False",
" b.logb |x| = b.logb x",
" b.logb (-x) = b.logb x",
" b.logb (x * y) = b.logb x + b.logb y"
] | [
" b.logb 0 = 0",
" b.logb 1 = 0",
" False",
" b.logb |x| = b.logb x",
" b.logb (-x) = b.logb x",
" b.logb (x * y) = b.logb x + b.logb y"
] |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.Rat.Denumerable
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.SetTheory.Cardinal.Continuum
#align_import data.real.cardinality from "leanprover-community/mathlib"@"7e7aaccf9b0182576cabdde36cf1b5ad3585b70d"
open Nat Set
open Cardinal
noncomputable section
namespace Cardinal
variable {c : ℝ} {f g : ℕ → Bool} {n : ℕ}
def cantorFunctionAux (c : ℝ) (f : ℕ → Bool) (n : ℕ) : ℝ :=
cond (f n) (c ^ n) 0
#align cardinal.cantor_function_aux Cardinal.cantorFunctionAux
@[simp]
theorem cantorFunctionAux_true (h : f n = true) : cantorFunctionAux c f n = c ^ n := by
simp [cantorFunctionAux, h]
#align cardinal.cantor_function_aux_tt Cardinal.cantorFunctionAux_true
@[simp]
theorem cantorFunctionAux_false (h : f n = false) : cantorFunctionAux c f n = 0 := by
simp [cantorFunctionAux, h]
#align cardinal.cantor_function_aux_ff Cardinal.cantorFunctionAux_false
theorem cantorFunctionAux_nonneg (h : 0 ≤ c) : 0 ≤ cantorFunctionAux c f n := by
cases h' : f n <;> simp [h']
apply pow_nonneg h
#align cardinal.cantor_function_aux_nonneg Cardinal.cantorFunctionAux_nonneg
theorem cantorFunctionAux_eq (h : f n = g n) :
cantorFunctionAux c f n = cantorFunctionAux c g n := by simp [cantorFunctionAux, h]
#align cardinal.cantor_function_aux_eq Cardinal.cantorFunctionAux_eq
| Mathlib/Data/Real/Cardinality.lean | 82 | 83 | theorem cantorFunctionAux_zero (f : ℕ → Bool) : cantorFunctionAux c f 0 = cond (f 0) 1 0 := by |
cases h : f 0 <;> simp [h]
| [
" cantorFunctionAux c f n = c ^ n",
" cantorFunctionAux c f n = 0",
" 0 ≤ cantorFunctionAux c f n",
" 0 ≤ c ^ n",
" cantorFunctionAux c f n = cantorFunctionAux c g n",
" cantorFunctionAux c f 0 = bif f 0 then 1 else 0",
" cantorFunctionAux c f 0 = bif false then 1 else 0",
" cantorFunctionAux c f 0 = ... | [
" cantorFunctionAux c f n = c ^ n",
" cantorFunctionAux c f n = 0",
" 0 ≤ cantorFunctionAux c f n",
" 0 ≤ c ^ n",
" cantorFunctionAux c f n = cantorFunctionAux c g n",
" cantorFunctionAux c f 0 = bif f 0 then 1 else 0"
] |
import Mathlib.Analysis.Normed.Order.Lattice
import Mathlib.MeasureTheory.Function.LpSpace
#align_import measure_theory.function.lp_order from "leanprover-community/mathlib"@"5dc275ec639221ca4d5f56938eb966f6ad9bc89f"
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory
open scoped ENNReal
variable {α E : Type*} {m : MeasurableSpace α} {μ : Measure α} {p : ℝ≥0∞}
namespace MeasureTheory
namespace Lp
section Order
variable [NormedLatticeAddCommGroup E]
theorem coeFn_le (f g : Lp E p μ) : f ≤ᵐ[μ] g ↔ f ≤ g := by
rw [← Subtype.coe_le_coe, ← AEEqFun.coeFn_le]
#align measure_theory.Lp.coe_fn_le MeasureTheory.Lp.coeFn_le
| Mathlib/MeasureTheory/Function/LpOrder.lean | 45 | 50 | theorem coeFn_nonneg (f : Lp E p μ) : 0 ≤ᵐ[μ] f ↔ 0 ≤ f := by |
rw [← coeFn_le]
have h0 := Lp.coeFn_zero E p μ
constructor <;> intro h <;> filter_upwards [h, h0] with _ _ h2
· rwa [h2]
· rwa [← h2]
| [
" ↑↑f ≤ᶠ[ae μ] ↑↑g ↔ f ≤ g",
" 0 ≤ᶠ[ae μ] ↑↑f ↔ 0 ≤ f",
" 0 ≤ᶠ[ae μ] ↑↑f ↔ ↑↑0 ≤ᶠ[ae μ] ↑↑f",
" 0 ≤ᶠ[ae μ] ↑↑f → ↑↑0 ≤ᶠ[ae μ] ↑↑f",
" ↑↑0 ≤ᶠ[ae μ] ↑↑f → 0 ≤ᶠ[ae μ] ↑↑f",
" ↑↑0 ≤ᶠ[ae μ] ↑↑f",
" 0 ≤ᶠ[ae μ] ↑↑f",
" ↑↑0 a✝¹ ≤ ↑↑f a✝¹",
" OfNat.ofNat 0 a✝¹ ≤ ↑↑f a✝¹"
] | [
" ↑↑f ≤ᶠ[ae μ] ↑↑g ↔ f ≤ g",
" 0 ≤ᶠ[ae μ] ↑↑f ↔ 0 ≤ f"
] |
import Mathlib.CategoryTheory.Idempotents.Basic
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Equivalence
#align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f"
noncomputable section
open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators
namespace CategoryTheory
variable (C : Type*) [Category C]
namespace Idempotents
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Karoubi where
X : C
p : X ⟶ X
idem : p ≫ p = p := by aesop_cat
#align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi
namespace Karoubi
variable {C}
attribute [reassoc (attr := simp)] idem
@[ext]
theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) :
P = Q := by
cases P
cases Q
dsimp at h_X h_p
subst h_X
simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p
#align category_theory.idempotents.karoubi.ext CategoryTheory.Idempotents.Karoubi.ext
@[ext]
structure Hom (P Q : Karoubi C) where
f : P.X ⟶ Q.X
comm : f = P.p ≫ f ≫ Q.p := by aesop_cat
#align category_theory.idempotents.karoubi.hom CategoryTheory.Idempotents.Karoubi.Hom
instance [Preadditive C] (P Q : Karoubi C) : Inhabited (Hom P Q) :=
⟨⟨0, by rw [zero_comp, comp_zero]⟩⟩
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 85 | 85 | theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by | rw [f.comm, ← assoc, P.idem]
| [
" P = Q",
" { X := X✝, p := p✝, idem := idem✝ } = Q",
" { X := X✝¹, p := p✝¹, idem := idem✝¹ } = { X := X✝, p := p✝, idem := idem✝ }",
" { X := X✝, p := p✝¹, idem := idem✝¹ } = { X := X✝, p := p✝, idem := idem✝ }",
" 0 = P.p ≫ 0 ≫ Q.p",
" P.p ≫ f.f = f.f"
] | [
" P = Q",
" { X := X✝, p := p✝, idem := idem✝ } = Q",
" { X := X✝¹, p := p✝¹, idem := idem✝¹ } = { X := X✝, p := p✝, idem := idem✝ }",
" { X := X✝, p := p✝¹, idem := idem✝¹ } = { X := X✝, p := p✝, idem := idem✝ }",
" 0 = P.p ≫ 0 ≫ Q.p",
" P.p ≫ f.f = f.f"
] |
import Mathlib.Algebra.Group.Indicator
import Mathlib.Data.Finset.Piecewise
import Mathlib.Data.Finset.Preimage
#align_import algebra.big_operators.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
-- TODO
-- assert_not_exists AddCommMonoidWithOne
assert_not_exists MonoidWithZero
assert_not_exists MulAction
variable {ι κ α β γ : Type*}
open Fin Function
namespace Finset
@[to_additive "`∑ x ∈ s, f x` is the sum of `f x` as `x` ranges over the elements
of the finite set `s`."]
protected def prod [CommMonoid β] (s : Finset α) (f : α → β) : β :=
(s.1.map f).prod
#align finset.prod Finset.prod
#align finset.sum Finset.sum
@[to_additive (attr := simp)]
theorem prod_mk [CommMonoid β] (s : Multiset α) (hs : s.Nodup) (f : α → β) :
(⟨s, hs⟩ : Finset α).prod f = (s.map f).prod :=
rfl
#align finset.prod_mk Finset.prod_mk
#align finset.sum_mk Finset.sum_mk
@[to_additive (attr := simp)]
| Mathlib/Algebra/BigOperators/Group/Finset.lean | 67 | 68 | theorem prod_val [CommMonoid α] (s : Finset α) : s.1.prod = s.prod id := by |
rw [Finset.prod, Multiset.map_id]
| [
" s.val.prod = s.prod id"
] | [
" s.val.prod = s.prod id"
] |
import Mathlib.Data.List.Basic
#align_import data.list.palindrome from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {α β : Type*}
namespace List
inductive Palindrome : List α → Prop
| nil : Palindrome []
| singleton : ∀ x, Palindrome [x]
| cons_concat : ∀ (x) {l}, Palindrome l → Palindrome (x :: (l ++ [x]))
#align list.palindrome List.Palindrome
namespace Palindrome
variable {l : List α}
| Mathlib/Data/List/Palindrome.lean | 50 | 52 | theorem reverse_eq {l : List α} (p : Palindrome l) : reverse l = l := by |
induction p <;> try (exact rfl)
simpa
| [
" l.reverse = l",
" [].reverse = []",
" [x✝].reverse = [x✝]",
" (x✝ :: (l✝ ++ [x✝])).reverse = x✝ :: (l✝ ++ [x✝])"
] | [
" l.reverse = l"
] |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField α] {a : α}
@[simp]
theorem preimage_mul_const_Iio (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
theorem preimage_mul_const_Ioo (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by simp [← Ioi_inter_Iio, h]
#align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo
@[simp]
theorem preimage_mul_const_Ioc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c) := by simp [← Ioi_inter_Iic, h]
#align set.preimage_mul_const_Ioc Set.preimage_mul_const_Ioc
@[simp]
theorem preimage_mul_const_Ico (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c) := by simp [← Ici_inter_Iio, h]
#align set.preimage_mul_const_Ico Set.preimage_mul_const_Ico
@[simp]
theorem preimage_mul_const_Icc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c) := by simp [← Ici_inter_Iic, h]
#align set.preimage_mul_const_Icc Set.preimage_mul_const_Icc
@[simp]
theorem preimage_mul_const_Iio_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iio a = Ioi (a / c) :=
ext fun _x => (div_lt_iff_of_neg h).symm
#align set.preimage_mul_const_Iio_of_neg Set.preimage_mul_const_Iio_of_neg
@[simp]
theorem preimage_mul_const_Ioi_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioi a = Iio (a / c) :=
ext fun _x => (lt_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ioi_of_neg Set.preimage_mul_const_Ioi_of_neg
@[simp]
theorem preimage_mul_const_Iic_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iic a = Ici (a / c) :=
ext fun _x => (div_le_iff_of_neg h).symm
#align set.preimage_mul_const_Iic_of_neg Set.preimage_mul_const_Iic_of_neg
@[simp]
theorem preimage_mul_const_Ici_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ici a = Iic (a / c) :=
ext fun _x => (le_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ici_of_neg Set.preimage_mul_const_Ici_of_neg
@[simp]
theorem preimage_mul_const_Ioo_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c) := by simp [← Ioi_inter_Iio, h, inter_comm]
#align set.preimage_mul_const_Ioo_of_neg Set.preimage_mul_const_Ioo_of_neg
@[simp]
theorem preimage_mul_const_Ioc_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioc a b = Ico (b / c) (a / c) := by
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm]
#align set.preimage_mul_const_Ioc_of_neg Set.preimage_mul_const_Ioc_of_neg
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 674 | 676 | theorem preimage_mul_const_Ico_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ico a b = Ioc (b / c) (a / c) := by |
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, h, inter_comm]
| [
" (fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c)",
" (fun x => x * c) ⁻¹' Ioc a b ... | [
" (fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c)",
" (fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c)",
" (fun x => x * c) ⁻¹' Ioc a b ... |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : ℕ → Prop)
section Count
variable [DecidablePred p]
def count (n : ℕ) : ℕ :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : ℕ) : Fintype { i // i < n ∧ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : ℕ) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : ℕ) : count p n = Fintype.card { k : ℕ // k < n ∧ p k } := by
rw [count_eq_card_filter_range, ← Fintype.card_ofFinset, ← CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : ℕ) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n ↦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
| Mathlib/Data/Nat/Count.lean | 74 | 83 | theorem count_add (a b : ℕ) : count p (a + b) = count p a + count (fun k ↦ p (a + k)) b := by |
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx ⟨c, _, rfl⟩
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
| [
" count p 0 = 0",
" Fintype { i // i < n ∧ p i }",
" ∀ (x : ℕ), x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x < n ∧ p x ↔ x ∈ fun x => x < n ∧ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... | [
" count p 0 = 0",
" Fintype { i // i < n ∧ p i }",
" ∀ (x : ℕ), x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x < n ∧ p x ↔ x ∈ fun x => x < n ∧ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.specific_limits.floor_pow from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Finset
open Topology
| Mathlib/Analysis/SpecificLimits/FloorPow.lean | 28 | 182 | theorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : ℕ → ℝ) (l : ℝ)
(hmono : Monotone u)
(hlim : ∀ a : ℝ, 1 < a → ∃ c : ℕ → ℕ, (∀ᶠ n in atTop, (c (n + 1) : ℝ) ≤ a * c n) ∧
Tendsto c atTop atTop ∧ Tendsto (fun n => u (c n) / c n) atTop (𝓝 l)) :
Tendsto (fun n => u n / n) atTop (𝓝 l) := by |
/- To check the result up to some `ε > 0`, we use a sequence `c` for which the ratio
`c (N+1) / c N` is bounded by `1 + ε`. Sandwiching a given `n` between two consecutive values of
`c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)`
and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable
to the limit `l` up to `1 + ε`.
We give a version of this proof by clearing out denominators first, to avoid discussing the sign
of different quantities. -/
have lnonneg : 0 ≤ l := by
rcases hlim 2 one_lt_two with ⟨c, _, ctop, clim⟩
have : Tendsto (fun n => u 0 / c n) atTop (𝓝 0) :=
tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop)
apply le_of_tendsto_of_tendsto' this clim fun n => ?_
gcongr
exact hmono (zero_le _)
have A : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, u n - n * l ≤ ε * (1 + ε + l) * n := by
intro ε εpos
rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩
have L : ∀ᶠ n in atTop, u (c n) - c n * l ≤ ε * c n := by
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ,
Asymptotics.isLittleO_iff] at clim
filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'
have cnpos : 0 < c n := cnpos'
calc
u (c n) - c n * l = (u (c n) / c n - l) * c n := by
simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, field_simps]
_ ≤ ε * c n := by
gcongr
refine (le_abs_self _).trans ?_
simpa using hn
obtain ⟨a, ha⟩ :
∃ a : ℕ, ∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ u (c b) - c b * l ≤ ε * c b :=
eventually_atTop.1 (cgrowth.and L)
let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)
filter_upwards [Ici_mem_atTop M] with n hn
have exN : ∃ N, n < c N := by
rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩
exact ⟨N, by linarith only [hN]⟩
let N := Nat.find exN
have ncN : n < c N := Nat.find_spec exN
have aN : a + 1 ≤ N := by
by_contra! h
have cNM : c N ≤ M := by
apply le_max'
apply mem_image_of_mem
exact mem_range.2 h
exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)
have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN
have cNn : c (N - 1) ≤ n := by
have : N - 1 < N := Nat.pred_lt Npos.ne'
simpa only [not_lt] using Nat.find_min exN this
have IcN : (c N : ℝ) ≤ (1 + ε) * c (N - 1) := by
have A : a ≤ N - 1 := by
apply @Nat.le_of_add_le_add_right a 1 (N - 1)
rw [Nat.sub_add_cancel Npos]
exact aN
have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
have := (ha _ A).1
rwa [B] at this
calc
u n - n * l ≤ u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le
_ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring
_ ≤ ε * c N + ε * c (N - 1) * l := by
gcongr
· exact (ha N (a.le_succ.trans aN)).2
· linarith only [IcN]
_ ≤ ε * ((1 + ε) * c (N - 1)) + ε * c (N - 1) * l := by gcongr
_ = ε * (1 + ε + l) * c (N - 1) := by ring
_ ≤ ε * (1 + ε + l) * n := by gcongr
have B : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in atTop, (n : ℝ) * l - u n ≤ ε * (1 + l) * n := by
intro ε εpos
rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩
have L : ∀ᶠ n : ℕ in atTop, (c n : ℝ) * l - u (c n) ≤ ε * c n := by
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ,
Asymptotics.isLittleO_iff] at clim
filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'
have cnpos : 0 < c n := cnpos'
calc
(c n : ℝ) * l - u (c n) = -(u (c n) / c n - l) * c n := by
simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, neg_sub, field_simps]
_ ≤ ε * c n := by
gcongr
refine le_trans (neg_le_abs _) ?_
simpa using hn
obtain ⟨a, ha⟩ :
∃ a : ℕ,
∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ (c b : ℝ) * l - u (c b) ≤ ε * c b :=
eventually_atTop.1 (cgrowth.and L)
let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)
filter_upwards [Ici_mem_atTop M] with n hn
have exN : ∃ N, n < c N := by
rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩
exact ⟨N, by linarith only [hN]⟩
let N := Nat.find exN
have ncN : n < c N := Nat.find_spec exN
have aN : a + 1 ≤ N := by
by_contra! h
have cNM : c N ≤ M := by
apply le_max'
apply mem_image_of_mem
exact mem_range.2 h
exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)
have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN
have aN' : a ≤ N - 1 := by
apply @Nat.le_of_add_le_add_right a 1 (N - 1)
rw [Nat.sub_add_cancel Npos]
exact aN
have cNn : c (N - 1) ≤ n := by
have : N - 1 < N := Nat.pred_lt Npos.ne'
simpa only [not_lt] using Nat.find_min exN this
calc
(n : ℝ) * l - u n ≤ c N * l - u (c (N - 1)) := by
gcongr
exact hmono cNn
_ ≤ (1 + ε) * c (N - 1) * l - u (c (N - 1)) := by
gcongr
have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
simpa [B] using (ha _ aN').1
_ = c (N - 1) * l - u (c (N - 1)) + ε * c (N - 1) * l := by ring
_ ≤ ε * c (N - 1) + ε * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl
_ = ε * (1 + l) * c (N - 1) := by ring
_ ≤ ε * (1 + l) * n := by gcongr
refine tendsto_order.2 ⟨fun d hd => ?_, fun d hd => ?_⟩
· obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, d + ε * (1 + l) < l ∧ 0 < ε := by
have L : Tendsto (fun ε => d + ε * (1 + l)) (𝓝[>] 0) (𝓝 (d + 0 * (1 + l))) := by
apply Tendsto.mono_left _ nhdsWithin_le_nhds
exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds)
simp only [zero_mul, add_zero] at L
exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists
filter_upwards [B ε εpos, Ioi_mem_atTop 0] with n hn npos
simp_rw [div_eq_inv_mul]
calc
d < (n : ℝ)⁻¹ * n * (l - ε * (1 + l)) := by
rw [inv_mul_cancel, one_mul]
· linarith only [hε]
· exact Nat.cast_ne_zero.2 (ne_of_gt npos)
_ = (n : ℝ)⁻¹ * (n * l - ε * (1 + l) * n) := by ring
_ ≤ (n : ℝ)⁻¹ * u n := by gcongr; linarith only [hn]
· obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, l + ε * (1 + ε + l) < d ∧ 0 < ε := by
have L : Tendsto (fun ε => l + ε * (1 + ε + l)) (𝓝[>] 0) (𝓝 (l + 0 * (1 + 0 + l))) := by
apply Tendsto.mono_left _ nhdsWithin_le_nhds
exact
tendsto_const_nhds.add
(tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds))
simp only [zero_mul, add_zero] at L
exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists
filter_upwards [A ε εpos, Ioi_mem_atTop 0] with n hn (npos : 0 < n)
calc
u n / n ≤ (n * l + ε * (1 + ε + l) * n) / n := by gcongr; linarith only [hn]
_ = (l + ε * (1 + ε + l)) := by field_simp; ring
_ < d := hε
| [
" Tendsto (fun n => u n / ↑n) atTop (𝓝 l)",
" 0 ≤ l",
" u 0 / ↑(c n) ≤ u (c n) / ↑(c n)",
" u 0 ≤ u (c n)",
" ∀ (ε : ℝ), 0 < ε → ∀ᶠ (n : ℕ) in atTop, u n - ↑n * l ≤ ε * (1 + ε + l) * ↑n",
" ∀ᶠ (n : ℕ) in atTop, u n - ↑n * l ≤ ε * (1 + ε + l) * ↑n",
" ∀ᶠ (n : ℕ) in atTop, u (c n) - ↑(c n) * l ≤ ε * ↑(c ... | [
" Tendsto (fun n => u n / ↑n) atTop (𝓝 l)"
] |
import Mathlib.Algebra.Quaternion
import Mathlib.Tactic.Ring
#align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d"
open Quaternion
namespace QuaternionAlgebra
structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ c₂ : R) where
(i j k : A)
i_mul_i : i * i = c₁ • (1 : A)
j_mul_j : j * j = c₂ • (1 : A)
i_mul_j : i * j = k
j_mul_i : j * i = -k
#align quaternion_algebra.basis QuaternionAlgebra.Basis
variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B]
variable {c₁ c₂ : R}
namespace Basis
@[ext]
protected theorem ext ⦃q₁ q₂ : Basis A c₁ c₂⦄ (hi : q₁.i = q₂.i) (hj : q₁.j = q₂.j) : q₁ = q₂ := by
cases q₁; rename_i q₁_i_mul_j _
cases q₂; rename_i q₂_i_mul_j _
congr
rw [← q₁_i_mul_j, ← q₂_i_mul_j]
congr
#align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext
variable (R)
@[simps i j k]
protected def self : Basis ℍ[R,c₁,c₂] c₁ c₂ where
i := ⟨0, 1, 0, 0⟩
i_mul_i := by ext <;> simp
j := ⟨0, 0, 1, 0⟩
j_mul_j := by ext <;> simp
k := ⟨0, 0, 0, 1⟩
i_mul_j := by ext <;> simp
j_mul_i := by ext <;> simp
#align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self
variable {R}
instance : Inhabited (Basis ℍ[R,c₁,c₂] c₁ c₂) :=
⟨Basis.self R⟩
variable (q : Basis A c₁ c₂)
attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i
@[simp]
| Mathlib/Algebra/QuaternionBasis.lean | 84 | 85 | theorem i_mul_k : q.i * q.k = c₁ • q.j := by |
rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul]
| [
" q₁ = q₂",
" { i := i✝, j := j✝, k := k✝, i_mul_i := i_mul_i✝, j_mul_j := j_mul_j✝, i_mul_j := i_mul_j✝, j_mul_i := j_mul_i✝ } = q₂",
" { i := i✝, j := j✝, k := k✝, i_mul_i := i_mul_i✝, j_mul_j := j_mul_j✝, i_mul_j := q₁_i_mul_j, j_mul_i := j_mul_i✝ } =\n q₂",
" { i := i✝¹, j := j✝¹, k := k✝¹, i_mul_i := ... | [
" q₁ = q₂",
" { i := i✝, j := j✝, k := k✝, i_mul_i := i_mul_i✝, j_mul_j := j_mul_j✝, i_mul_j := i_mul_j✝, j_mul_i := j_mul_i✝ } = q₂",
" { i := i✝, j := j✝, k := k✝, i_mul_i := i_mul_i✝, j_mul_j := j_mul_j✝, i_mul_j := q₁_i_mul_j, j_mul_i := j_mul_i✝ } =\n q₂",
" { i := i✝¹, j := j✝¹, k := k✝¹, i_mul_i := ... |
import Mathlib.Algebra.Field.Opposite
import Mathlib.Algebra.Group.Subgroup.ZPowers
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Ring.NegOnePow
import Mathlib.Algebra.Order.Archimedean
import Mathlib.GroupTheory.Coset
#align_import algebra.periodic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
variable {α β γ : Type*} {f g : α → β} {c c₁ c₂ x : α}
open Set
namespace Function
@[simp]
def Periodic [Add α] (f : α → β) (c : α) : Prop :=
∀ x : α, f (x + c) = f x
#align function.periodic Function.Periodic
protected theorem Periodic.funext [Add α] (h : Periodic f c) : (fun x => f (x + c)) = f :=
funext h
#align function.periodic.funext Function.Periodic.funext
protected theorem Periodic.comp [Add α] (h : Periodic f c) (g : β → γ) : Periodic (g ∘ f) c := by
simp_all
#align function.periodic.comp Function.Periodic.comp
theorem Periodic.comp_addHom [Add α] [Add γ] (h : Periodic f c) (g : AddHom γ α) (g_inv : α → γ)
(hg : RightInverse g_inv g) : Periodic (f ∘ g) (g_inv c) := fun x => by
simp only [hg c, h (g x), map_add, comp_apply]
#align function.periodic.comp_add_hom Function.Periodic.comp_addHom
@[to_additive]
protected theorem Periodic.mul [Add α] [Mul β] (hf : Periodic f c) (hg : Periodic g c) :
Periodic (f * g) c := by simp_all
#align function.periodic.mul Function.Periodic.mul
#align function.periodic.add Function.Periodic.add
@[to_additive]
protected theorem Periodic.div [Add α] [Div β] (hf : Periodic f c) (hg : Periodic g c) :
Periodic (f / g) c := by simp_all
#align function.periodic.div Function.Periodic.div
#align function.periodic.sub Function.Periodic.sub
@[to_additive]
| Mathlib/Algebra/Periodic.lean | 77 | 82 | theorem _root_.List.periodic_prod [Add α] [Monoid β] (l : List (α → β))
(hl : ∀ f ∈ l, Periodic f c) : Periodic l.prod c := by |
induction' l with g l ih hl
· simp
· rw [List.forall_mem_cons] at hl
simpa only [List.prod_cons] using hl.1.mul (ih hl.2)
| [
" Periodic (g ∘ f) c",
" (f ∘ ⇑g) (x + g_inv c) = (f ∘ ⇑g) x",
" Periodic (f * g) c",
" Periodic (f / g) c",
" Periodic l.prod c",
" Periodic [].prod c",
" Periodic (g :: l).prod c"
] | [
" Periodic (g ∘ f) c",
" (f ∘ ⇑g) (x + g_inv c) = (f ∘ ⇑g) x",
" Periodic (f * g) c",
" Periodic (f / g) c",
" Periodic l.prod c"
] |
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 48 | 50 | theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by |
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
| [
" b.toMatrix ⇑b = 1",
" b.toMatrix (⇑b) i j = 1 i j"
] | [
" b.toMatrix ⇑b = 1"
] |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Fintype.Card
#align_import data.multiset.fintype from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d"
variable {α : Type*} [DecidableEq α] {m : Multiset α}
def Multiset.ToType (m : Multiset α) : Type _ := (x : α) × Fin (m.count x)
#align multiset.to_type Multiset.ToType
instance : CoeSort (Multiset α) (Type _) := ⟨Multiset.ToType⟩
example : DecidableEq m := inferInstanceAs <| DecidableEq ((x : α) × Fin (m.count x))
-- Porting note: syntactic equality
#noalign multiset.coe_sort_eq
@[reducible, match_pattern]
def Multiset.mkToType (m : Multiset α) (x : α) (i : Fin (m.count x)) : m :=
⟨x, i⟩
#align multiset.mk_to_type Multiset.mkToType
instance instCoeSortMultisetType.instCoeOutToType : CoeOut m α :=
⟨fun x ↦ x.1⟩
#align multiset.has_coe_to_sort.has_coe instCoeSortMultisetType.instCoeOutToTypeₓ
-- Porting note: syntactic equality
#noalign multiset.fst_coe_eq_coe
-- Syntactic equality
#noalign multiset.coe_eq
-- @[simp] -- Porting note (#10685): dsimp can prove this
theorem Multiset.coe_mk {x : α} {i : Fin (m.count x)} : ↑(m.mkToType x i) = x :=
rfl
#align multiset.coe_mk Multiset.coe_mk
@[simp] lemma Multiset.coe_mem {x : m} : ↑x ∈ m := Multiset.count_pos.mp (by have := x.2.2; omega)
#align multiset.coe_mem Multiset.coe_mem
@[simp]
protected theorem Multiset.forall_coe (p : m → Prop) :
(∀ x : m, p x) ↔ ∀ (x : α) (i : Fin (m.count x)), p ⟨x, i⟩ :=
Sigma.forall
#align multiset.forall_coe Multiset.forall_coe
@[simp]
protected theorem Multiset.exists_coe (p : m → Prop) :
(∃ x : m, p x) ↔ ∃ (x : α) (i : Fin (m.count x)), p ⟨x, i⟩ :=
Sigma.exists
#align multiset.exists_coe Multiset.exists_coe
instance : Fintype { p : α × ℕ | p.2 < m.count p.1 } :=
Fintype.ofFinset
(m.toFinset.biUnion fun x ↦ (Finset.range (m.count x)).map ⟨Prod.mk x, Prod.mk.inj_left x⟩)
(by
rintro ⟨x, i⟩
simp only [Finset.mem_biUnion, Multiset.mem_toFinset, Finset.mem_map, Finset.mem_range,
Function.Embedding.coeFn_mk, Prod.mk.inj_iff, Set.mem_setOf_eq]
simp only [← and_assoc, exists_eq_right, and_iff_right_iff_imp]
exact fun h ↦ Multiset.count_pos.mp (by omega))
def Multiset.toEnumFinset (m : Multiset α) : Finset (α × ℕ) :=
{ p : α × ℕ | p.2 < m.count p.1 }.toFinset
#align multiset.to_enum_finset Multiset.toEnumFinset
@[simp]
theorem Multiset.mem_toEnumFinset (m : Multiset α) (p : α × ℕ) :
p ∈ m.toEnumFinset ↔ p.2 < m.count p.1 :=
Set.mem_toFinset
#align multiset.mem_to_enum_finset Multiset.mem_toEnumFinset
theorem Multiset.mem_of_mem_toEnumFinset {p : α × ℕ} (h : p ∈ m.toEnumFinset) : p.1 ∈ m :=
have := (m.mem_toEnumFinset p).mp h; Multiset.count_pos.mp (by omega)
#align multiset.mem_of_mem_to_enum_finset Multiset.mem_of_mem_toEnumFinset
@[mono]
theorem Multiset.toEnumFinset_mono {m₁ m₂ : Multiset α} (h : m₁ ≤ m₂) :
m₁.toEnumFinset ⊆ m₂.toEnumFinset := by
intro p
simp only [Multiset.mem_toEnumFinset]
exact gt_of_ge_of_gt (Multiset.le_iff_count.mp h p.1)
#align multiset.to_enum_finset_mono Multiset.toEnumFinset_mono
@[simp]
| Mathlib/Data/Multiset/Fintype.lean | 130 | 141 | theorem Multiset.toEnumFinset_subset_iff {m₁ m₂ : Multiset α} :
m₁.toEnumFinset ⊆ m₂.toEnumFinset ↔ m₁ ≤ m₂ := by |
refine ⟨fun h ↦ ?_, Multiset.toEnumFinset_mono⟩
rw [Multiset.le_iff_count]
intro x
by_cases hx : x ∈ m₁
· apply Nat.le_of_pred_lt
have : (x, m₁.count x - 1) ∈ m₁.toEnumFinset := by
rw [Multiset.mem_toEnumFinset]
exact Nat.pred_lt (ne_of_gt (Multiset.count_pos.mpr hx))
simpa only [Multiset.mem_toEnumFinset] using h this
· simp [hx]
| [
" 0 < count x.fst m",
" ∀ (x : α × ℕ),\n (x ∈ m.toFinset.biUnion fun x => Finset.map { toFun := Prod.mk x, inj' := ⋯ } (Finset.range (Multiset.count x m))) ↔\n x ∈ {p | p.2 < Multiset.count p.1 m}",
" ((x, i) ∈\n m.toFinset.biUnion fun x => Finset.map { toFun := Prod.mk x, inj' := ⋯ } (Finset.range... | [
" 0 < count x.fst m",
" ∀ (x : α × ℕ),\n (x ∈ m.toFinset.biUnion fun x => Finset.map { toFun := Prod.mk x, inj' := ⋯ } (Finset.range (Multiset.count x m))) ↔\n x ∈ {p | p.2 < Multiset.count p.1 m}",
" ((x, i) ∈\n m.toFinset.biUnion fun x => Finset.map { toFun := Prod.mk x, inj' := ⋯ } (Finset.range... |
import Mathlib.Algebra.Polynomial.Module.AEval
#align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
universe u v
open Polynomial BigOperators
@[nolint unusedArguments]
def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M
#align polynomial_module PolynomialModule
variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R)
-- Porting note: stated instead of deriving
noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited
noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup
variable {M}
variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M]
namespace PolynomialModule
@[nolint unusedArguments]
noncomputable instance : Module S (PolynomialModule R M) :=
Finsupp.module ℕ M
instance instFunLike : FunLike (PolynomialModule R M) ℕ M :=
Finsupp.instFunLike
instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M :=
Finsupp.instCoeFun
theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 :=
Finsupp.zero_apply
theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a :=
Finsupp.add_apply g₁ g₂ a
noncomputable def single (i : ℕ) : M →+ PolynomialModule R M :=
Finsupp.singleAddHom i
#align polynomial_module.single PolynomialModule.single
theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.single_apply PolynomialModule.single_apply
noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M :=
Finsupp.lsingle i
#align polynomial_module.lsingle PolynomialModule.lsingle
theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply
theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m :=
(lsingle R i).map_smul r m
#align polynomial_module.single_smul PolynomialModule.single_smul
variable {R}
theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0)
(hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f :=
Finsupp.induction_linear f h0 hadd hsingle
#align polynomial_module.induction_linear PolynomialModule.induction_linear
noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) :=
inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ)))
#align polynomial_module.polynomial_module PolynomialModule.polynomialModule
lemma smul_def (f : R[X]) (m : PolynomialModule R M) :
f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by
rfl
instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] :
IsScalarTower S R (PolynomialModule R M) :=
Finsupp.isScalarTower _ _
instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M]
[IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by
haveI : IsScalarTower R R[X] (PolynomialModule R M) :=
inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ
constructor
intro x y z
rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc]
#align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower'
@[simp]
theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) :
monomial i r • single R j m = single R (i + j) (r • m) := by
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply,
Module.algebraMap_end_apply, smul_def]
induction i generalizing r j m with
| zero =>
rw [Function.iterate_zero, zero_add]
exact Finsupp.smul_single r j m
| succ n hn =>
rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn]
congr 2
rw [Nat.one_add]
exact Finsupp.mapDomain_single
#align polynomial_module.monomial_smul_single PolynomialModule.monomial_smul_single
@[simp]
theorem monomial_smul_apply (i : ℕ) (r : R) (g : PolynomialModule R M) (n : ℕ) :
(monomial i r • g) n = ite (i ≤ n) (r • g (n - i)) 0 := by
induction' g using PolynomialModule.induction_linear with p q hp hq
· simp only [smul_zero, zero_apply, ite_self]
· simp only [smul_add, add_apply, hp, hq]
split_ifs
exacts [rfl, zero_add 0]
· rw [monomial_smul_single, single_apply, single_apply, smul_ite, smul_zero, ← ite_and]
congr
rw [eq_iff_iff]
constructor
· rintro rfl
simp
· rintro ⟨e, rfl⟩
rw [add_comm, tsub_add_cancel_of_le e]
#align polynomial_module.monomial_smul_apply PolynomialModule.monomial_smul_apply
@[simp]
| Mathlib/Algebra/Polynomial/Module/Basic.lean | 157 | 169 | theorem smul_single_apply (i : ℕ) (f : R[X]) (m : M) (n : ℕ) :
(f • single R i m) n = ite (i ≤ n) (f.coeff (n - i) • m) 0 := by |
induction' f using Polynomial.induction_on' with p q hp hq
· rw [add_smul, Finsupp.add_apply, hp, hq, coeff_add, add_smul]
split_ifs
exacts [rfl, zero_add 0]
· rw [monomial_smul_single, single_apply, coeff_monomial, ite_smul, zero_smul]
by_cases h : i ≤ n
· simp_rw [eq_tsub_iff_add_eq_of_le h, if_pos h]
· rw [if_neg h, ite_eq_right_iff]
intro e
exfalso
linarith
| [
" f • m = ((aeval (Finsupp.lmapDomain M R Nat.succ)) f) m",
" IsScalarTower S R[X] (PolynomialModule R M)",
" ∀ (x : S) (y : R[X]) (z : PolynomialModule R M), (x • y) • z = x • y • z",
" (x • y) • z = x • y • z",
" (monomial i) r • (single R j) m = (single R (i + j)) (r • m)",
" r • (⇑(Finsupp.lmapDomain ... | [
" f • m = ((aeval (Finsupp.lmapDomain M R Nat.succ)) f) m",
" IsScalarTower S R[X] (PolynomialModule R M)",
" ∀ (x : S) (y : R[X]) (z : PolynomialModule R M), (x • y) • z = x • y • z",
" (x • y) • z = x • y • z",
" (monomial i) r • (single R j) m = (single R (i + j)) (r • m)",
" r • (⇑(Finsupp.lmapDomain ... |
import Mathlib.Data.Analysis.Filter
import Mathlib.Topology.Bases
import Mathlib.Topology.LocallyFinite
#align_import data.analysis.topology from "leanprover-community/mathlib"@"55d771df074d0dd020139ee1cd4b95521422df9f"
open Set
open Filter hiding Realizer
open Topology
structure Ctop (α σ : Type*) where
f : σ → Set α
top : α → σ
top_mem : ∀ x : α, x ∈ f (top x)
inter : ∀ (a b) (x : α), x ∈ f a ∩ f b → σ
inter_mem : ∀ a b x h, x ∈ f (inter a b x h)
inter_sub : ∀ a b x h, f (inter a b x h) ⊆ f a ∩ f b
#align ctop Ctop
variable {α : Type*} {β : Type*} {σ : Type*} {τ : Type*}
instance : Inhabited (Ctop α (Set α)) :=
⟨{ f := id
top := singleton
top_mem := mem_singleton
inter := fun s t _ _ ↦ s ∩ t
inter_mem := fun _s _t _a ↦ id
inter_sub := fun _s _t _a _ha ↦ Subset.rfl }⟩
namespace Ctop
section
variable (F : Ctop α σ)
instance : CoeFun (Ctop α σ) fun _ ↦ σ → Set α :=
⟨Ctop.f⟩
-- @[simp] -- Porting note (#10685): dsimp can prove this
theorem coe_mk (f T h₁ I h₂ h₃ a) : (@Ctop.mk α σ f T h₁ I h₂ h₃) a = f a := rfl
#align ctop.coe_mk Ctop.coe_mk
def ofEquiv (E : σ ≃ τ) : Ctop α σ → Ctop α τ
| ⟨f, T, h₁, I, h₂, h₃⟩ =>
{ f := fun a ↦ f (E.symm a)
top := fun x ↦ E (T x)
top_mem := fun x ↦ by simpa using h₁ x
inter := fun a b x h ↦ E (I (E.symm a) (E.symm b) x h)
inter_mem := fun a b x h ↦ by simpa using h₂ (E.symm a) (E.symm b) x h
inter_sub := fun a b x h ↦ by simpa using h₃ (E.symm a) (E.symm b) x h }
#align ctop.of_equiv Ctop.ofEquiv
@[simp]
| Mathlib/Data/Analysis/Topology.lean | 79 | 80 | theorem ofEquiv_val (E : σ ≃ τ) (F : Ctop α σ) (a : τ) : F.ofEquiv E a = F (E.symm a) := by |
cases F; rfl
| [
" x ∈ (fun a => f (E.symm a)) ((fun x => E (T x)) x)",
" x ∈ (fun a => f (E.symm a)) ((fun a b x h => E (I (E.symm a) (E.symm b) x h)) a b x h)",
" (fun a => f (E.symm a)) ((fun a b x h => E (I (E.symm a) (E.symm b) x h)) a b x h) ⊆\n (fun a => f (E.symm a)) a ∩ (fun a => f (E.symm a)) b",
" (ofEquiv E F).... | [
" x ∈ (fun a => f (E.symm a)) ((fun x => E (T x)) x)",
" x ∈ (fun a => f (E.symm a)) ((fun a b x h => E (I (E.symm a) (E.symm b) x h)) a b x h)",
" (fun a => f (E.symm a)) ((fun a b x h => E (I (E.symm a) (E.symm b) x h)) a b x h) ⊆\n (fun a => f (E.symm a)) a ∩ (fun a => f (E.symm a)) b",
" (ofEquiv E F).... |
import Mathlib.Data.Fintype.Basic
import Mathlib.GroupTheory.Perm.Sign
import Mathlib.Logic.Equiv.Defs
#align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f"
section Fintype
variable {α β : Type*} [Fintype α] [DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β)
def Function.Embedding.toEquivRange : α ≃ Set.range f :=
⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩
#align function.embedding.to_equiv_range Function.Embedding.toEquivRange
@[simp]
theorem Function.Embedding.toEquivRange_apply (a : α) :
f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ :=
rfl
#align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply
@[simp]
theorem Function.Embedding.toEquivRange_symm_apply_self (a : α) :
f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq]
#align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self
theorem Function.Embedding.toEquivRange_eq_ofInjective :
f.toEquivRange = Equiv.ofInjective f f.injective := by
ext
simp
#align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective
def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm β :=
e.extendDomain f.toEquivRange
#align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding
@[simp]
| Mathlib/Logic/Equiv/Fintype.lean | 72 | 75 | theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : α) :
e.viaFintypeEmbedding f (f a) = f (e a) := by |
rw [Equiv.Perm.viaFintypeEmbedding]
convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a
| [
" f.invOfMemRange ((fun a => ⟨f a, ⋯⟩) x✝) = x✝",
" (fun a => ⟨f a, ⋯⟩) (f.invOfMemRange x✝) = x✝",
" f.toEquivRange.symm ⟨f a, ⋯⟩ = a",
" f.toEquivRange = Equiv.ofInjective ⇑f ⋯",
" ↑(f.toEquivRange x✝) = ↑((Equiv.ofInjective ⇑f ⋯) x✝)",
" (e.viaFintypeEmbedding f) (f a) = f (e a)",
" (e.extendDomain f... | [
" f.invOfMemRange ((fun a => ⟨f a, ⋯⟩) x✝) = x✝",
" (fun a => ⟨f a, ⋯⟩) (f.invOfMemRange x✝) = x✝",
" f.toEquivRange.symm ⟨f a, ⋯⟩ = a",
" f.toEquivRange = Equiv.ofInjective ⇑f ⋯",
" ↑(f.toEquivRange x✝) = ↑((Equiv.ofInjective ⇑f ⋯) x✝)",
" (e.viaFintypeEmbedding f) (f a) = f (e a)"
] |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.average MeasureTheory.average
notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r
notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
#align measure_theory.average_zero MeasureTheory.average_zero
@[simp]
theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by
rw [average, smul_zero, integral_zero_measure]
#align measure_theory.average_zero_measure MeasureTheory.average_zero_measure
@[simp]
theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ :=
integral_neg f
#align measure_theory.average_neg MeasureTheory.average_neg
theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ :=
rfl
#align measure_theory.average_eq' MeasureTheory.average_eq'
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
#align measure_theory.average_eq MeasureTheory.average_eq
theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rw [average, measure_univ, inv_one, one_smul]
#align measure_theory.average_eq_integral MeasureTheory.average_eq_integral
@[simp]
theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) :
(μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, integral_zero_measure, average_zero_measure, smul_zero]
· rw [average_eq, smul_inv_smul₀]
refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne'
rwa [Ne, measure_univ_eq_zero]
#align measure_theory.measure_smul_average MeasureTheory.measure_smul_average
theorem setAverage_eq (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by rw [average_eq, restrict_apply_univ]
#align measure_theory.set_average_eq MeasureTheory.setAverage_eq
theorem setAverage_eq' (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [average_eq', restrict_apply_univ]
#align measure_theory.set_average_eq' MeasureTheory.setAverage_eq'
variable {μ}
| Mathlib/MeasureTheory/Integral/Average.lean | 361 | 362 | theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by |
simp only [average_eq, integral_congr_ae h]
| [
" ⨍ (x : α), 0 ∂μ = 0",
" ⨍ (x : α), f x ∂0 = 0",
" ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ",
" ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal ≠ 0",
" μ univ ≠ 0",
" ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ... | [
" ⨍ (x : α), 0 ∂μ = 0",
" ⨍ (x : α), f x ∂0 = 0",
" ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ",
" ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal ≠ 0",
" μ univ ≠ 0",
" ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ... |
import Mathlib.Algebra.Polynomial.Splits
import Mathlib.RingTheory.Adjoin.Basic
import Mathlib.RingTheory.AdjoinRoot
#align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
noncomputable section
open Polynomial
section Embeddings
variable (F : Type*) [Field F]
open AdjoinRoot in
def AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly {R : Type*} [CommRing R] [Algebra F R] (x : R) :
Algebra.adjoin F ({x} : Set R) ≃ₐ[F] AdjoinRoot (minpoly F x) :=
AlgEquiv.symm <| AlgEquiv.ofBijective (Minpoly.toAdjoin F x) <| by
refine ⟨(injective_iff_map_eq_zero _).2 fun P₁ hP₁ ↦ ?_, Minpoly.toAdjoin.surjective F x⟩
obtain ⟨P, rfl⟩ := mk_surjective P₁
refine AdjoinRoot.mk_eq_zero.mpr (minpoly.dvd F x ?_)
rwa [Minpoly.toAdjoin_apply', liftHom_mk, ← Subalgebra.coe_eq_zero, aeval_subalgebra_coe] at hP₁
#align alg_equiv.adjoin_singleton_equiv_adjoin_root_minpoly AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly
noncomputable def Algebra.adjoin.liftSingleton {S T : Type*}
[CommRing S] [CommRing T] [Algebra F S] [Algebra F T]
(x : S) (y : T) (h : aeval y (minpoly F x) = 0) :
Algebra.adjoin F {x} →ₐ[F] T :=
(AdjoinRoot.liftHom _ y h).comp (AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly F x).toAlgHom
open Finset
| Mathlib/RingTheory/Adjoin/Field.lean | 56 | 81 | theorem Polynomial.lift_of_splits {F K L : Type*} [Field F] [Field K] [Field L] [Algebra F K]
[Algebra F L] (s : Finset K) : (∀ x ∈ s, IsIntegral F x ∧
Splits (algebraMap F L) (minpoly F x)) → Nonempty (Algebra.adjoin F (s : Set K) →ₐ[F] L) := by |
classical
refine Finset.induction_on s (fun _ ↦ ?_) fun a s _ ih H ↦ ?_
· rw [coe_empty, Algebra.adjoin_empty]
exact ⟨(Algebra.ofId F L).comp (Algebra.botEquiv F K)⟩
rw [forall_mem_insert] at H
rcases H with ⟨⟨H1, H2⟩, H3⟩
cases' ih H3 with f
choose H3 _ using H3
rw [coe_insert, Set.insert_eq, Set.union_comm, Algebra.adjoin_union_eq_adjoin_adjoin]
set Ks := Algebra.adjoin F (s : Set K)
haveI : FiniteDimensional F Ks := ((Submodule.fg_iff_finiteDimensional _).1
(fg_adjoin_of_finite s.finite_toSet H3)).of_subalgebra_toSubmodule
letI := fieldOfFiniteDimensional F Ks
letI := (f : Ks →+* L).toAlgebra
have H5 : IsIntegral Ks a := H1.tower_top
have H6 : (minpoly Ks a).Splits (algebraMap Ks L) := by
refine splits_of_splits_of_dvd _ ((minpoly.monic H1).map (algebraMap F Ks)).ne_zero
((splits_map_iff _ _).2 ?_) (minpoly.dvd _ _ ?_)
· rw [← IsScalarTower.algebraMap_eq]
exact H2
· rw [Polynomial.aeval_map_algebraMap, minpoly.aeval]
obtain ⟨y, hy⟩ := Polynomial.exists_root_of_splits _ H6 (minpoly.degree_pos H5).ne'
exact ⟨Subalgebra.ofRestrictScalars F _ <| Algebra.adjoin.liftSingleton Ks a y hy⟩
| [
" Function.Bijective ⇑(Minpoly.toAdjoin F x)",
" P₁ = 0",
" (AdjoinRoot.mk (minpoly F x)) P = 0",
" (aeval x) P = 0",
" (∀ x ∈ s, IsIntegral F x ∧ Splits (algebraMap F L) (minpoly F x)) → Nonempty (↥(Algebra.adjoin F ↑s) →ₐ[F] L)",
" Nonempty (↥(Algebra.adjoin F ↑∅) →ₐ[F] L)",
" Nonempty (↥⊥ →ₐ[F] L)",
... | [
" Function.Bijective ⇑(Minpoly.toAdjoin F x)",
" P₁ = 0",
" (AdjoinRoot.mk (minpoly F x)) P = 0",
" (aeval x) P = 0",
" (∀ x ∈ s, IsIntegral F x ∧ Splits (algebraMap F L) (minpoly F x)) → Nonempty (↥(Algebra.adjoin F ↑s) →ₐ[F] L)"
] |
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜']
variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G}
variable {f' : α → E'} {g' : α → F'} {k' : α → G'}
variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''}
variable {l l' : Filter α}
section Defs
irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
#align asymptotics.is_O_with Asymptotics.IsBigOWith
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by rw [IsBigOWith_def]
#align asymptotics.is_O_with_iff Asymptotics.isBigOWith_iff
alias ⟨IsBigOWith.bound, IsBigOWith.of_bound⟩ := isBigOWith_iff
#align asymptotics.is_O_with.bound Asymptotics.IsBigOWith.bound
#align asymptotics.is_O_with.of_bound Asymptotics.IsBigOWith.of_bound
irreducible_def IsBigO (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∃ c : ℝ, IsBigOWith c l f g
#align asymptotics.is_O Asymptotics.IsBigO
@[inherit_doc]
notation:100 f " =O[" l "] " g:100 => IsBigO l f g
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by rw [IsBigO_def]
#align asymptotics.is_O_iff_is_O_with Asymptotics.isBigO_iff_isBigOWith
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by
simp only [IsBigO_def, IsBigOWith_def]
#align asymptotics.is_O_iff Asymptotics.isBigO_iff
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 118 | 132 | theorem isBigO_iff' {g : α → E'''} :
f =O[l] g ↔ ∃ c > 0, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by |
refine ⟨fun h => ?mp, fun h => ?mpr⟩
case mp =>
rw [isBigO_iff] at h
obtain ⟨c, hc⟩ := h
refine ⟨max c 1, zero_lt_one.trans_le (le_max_right _ _), ?_⟩
filter_upwards [hc] with x hx
apply hx.trans
gcongr
exact le_max_left _ _
case mpr =>
rw [isBigO_iff]
obtain ⟨c, ⟨_, hc⟩⟩ := h
exact ⟨c, hc⟩
| [
" IsBigOWith c l f g ↔ ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" f =O[l] g ↔ ∃ c, IsBigOWith c l f g",
" f =O[l] g ↔ ∃ c, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" f =O[l] g ↔ ∃ c > 0, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" f =O[l] g",
" ∃ c > 0, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" ∀ᶠ (x : α) in l, ‖f x‖ ≤... | [
" IsBigOWith c l f g ↔ ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" f =O[l] g ↔ ∃ c, IsBigOWith c l f g",
" f =O[l] g ↔ ∃ c, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖",
" f =O[l] g ↔ ∃ c > 0, ∀ᶠ (x : α) in l, ‖f x‖ ≤ c * ‖g x‖"
] |
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
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]
#align mem_ℓp_zero_iff memℓp_zero_iff
theorem memℓp_zero {f : ∀ i, E i} (hf : Set.Finite { i | f i ≠ 0 }) : Memℓp f 0 :=
memℓp_zero_iff.2 hf
#align mem_ℓp_zero memℓp_zero
| Mathlib/Analysis/NormedSpace/lpSpace.lean | 90 | 92 | theorem memℓp_infty_iff {f : ∀ i, E i} : Memℓp f ∞ ↔ BddAbove (Set.range fun i => ‖f i‖) := by |
dsimp [Memℓp]
rw [if_neg ENNReal.top_ne_zero, if_pos rfl]
| [
" Memℓp f 0 ↔ {i | f i ≠ 0}.Finite",
" (if 0 = 0 then {i | ¬f i = 0}.Finite\n else if 0 = ⊤ then BddAbove (Set.range fun i => ‖f i‖) else Summable fun i => ‖f i‖ ^ 0) ↔\n {i | ¬f i = 0}.Finite",
" Memℓp f ⊤ ↔ BddAbove (Set.range fun i => ‖f i‖)",
" (if ⊤ = 0 then {i | ¬f i = 0}.Finite\n else if ⊤ = ⊤... | [
" Memℓp f 0 ↔ {i | f i ≠ 0}.Finite",
" (if 0 = 0 then {i | ¬f i = 0}.Finite\n else if 0 = ⊤ then BddAbove (Set.range fun i => ‖f i‖) else Summable fun i => ‖f i‖ ^ 0) ↔\n {i | ¬f i = 0}.Finite",
" Memℓp f ⊤ ↔ BddAbove (Set.range fun i => ‖f i‖)"
] |
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Init.Order.Defs
set_option autoImplicit true
structure UFModel (n) where
parent : Fin n → Fin n
rank : Nat → Nat
rank_lt : ∀ i, (parent i).1 ≠ i → rank i < rank (parent i)
structure UFNode (α : Type*) where
parent : Nat
value : α
rank : Nat
inductive UFModel.Agrees (arr : Array α) (f : α → β) : ∀ {n}, (Fin n → β) → Prop
| mk : Agrees arr f fun i ↦ f (arr.get i)
namespace UFModel.Agrees
theorem mk' {arr : Array α} {f : α → β} {n} {g : Fin n → β} (e : n = arr.size)
(H : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = g ⟨i, h₂⟩) : Agrees arr f g := by
cases e
have : (fun i ↦ f (arr.get i)) = g := by funext ⟨i, h⟩; apply H
cases this; constructor
theorem size_eq {arr : Array α} {m : Fin n → β} (H : Agrees arr f m) : n = arr.size := by
cases H; rfl
theorem get_eq {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m) :
∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩ := by
cases H; exact fun i h _ ↦ rfl
theorem get_eq' {arr : Array α} {m : Fin arr.size → β} (H : Agrees arr f m)
(i) : f (arr.get i) = m i := H.get_eq ..
theorem empty {f : α → β} {g : Fin 0 → β} : Agrees #[] f g := mk' rfl nofun
| Mathlib/Data/UnionFind.lean | 91 | 101 | theorem push {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m)
(k) (hk : k = n + 1) (x) (m' : Fin k → β)
(hm₁ : ∀ (i : Fin k) (h : i < n), m' i = m ⟨i, h⟩)
(hm₂ : ∀ (h : n < k), f x = m' ⟨n, h⟩) : Agrees (arr.push x) f m' := by |
cases H
have : k = (arr.push x).size := by simp [hk]
refine mk' this fun i h₁ h₂ ↦ ?_
simp [Array.get_push]; split <;> (rename_i h; simp at hm₁ ⊢)
· rw [← hm₁ ⟨i, h₂⟩]; assumption
· cases show i = arr.size by apply Nat.le_antisymm <;> simp_all [Nat.lt_succ]
rw [hm₂]
| [
" Agrees arr f g",
" (fun i => f (arr.get i)) = g",
" f (arr.get ⟨i, h⟩) = g ⟨i, h⟩",
" Agrees arr f fun i => f (arr.get i)",
" n = arr.size",
" arr.size = arr.size",
" ∀ (i : ℕ) (h₁ : i < arr.size) (h₂ : i < n), f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩",
" ∀ (i : ℕ) (h₁ h₂ : i < arr.size), f (arr.get ⟨i, h₁⟩)... | [
" Agrees arr f g",
" (fun i => f (arr.get i)) = g",
" f (arr.get ⟨i, h⟩) = g ⟨i, h⟩",
" Agrees arr f fun i => f (arr.get i)",
" n = arr.size",
" arr.size = arr.size",
" ∀ (i : ℕ) (h₁ : i < arr.size) (h₂ : i < n), f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩",
" ∀ (i : ℕ) (h₁ h₂ : i < arr.size), f (arr.get ⟨i, h₁⟩)... |
import Mathlib.Algebra.Group.Prod
import Mathlib.Order.Cover
#align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
assert_not_exists MonoidWithZero
open Set
namespace Function
variable {α β A B M N P G : Type*}
section One
variable [One M] [One N] [One P]
@[to_additive "`support` of a function is the set of points `x` such that `f x ≠ 0`."]
def mulSupport (f : α → M) : Set α := {x | f x ≠ 1}
#align function.mul_support Function.mulSupport
#align function.support Function.support
@[to_additive]
theorem mulSupport_eq_preimage (f : α → M) : mulSupport f = f ⁻¹' {1}ᶜ :=
rfl
#align function.mul_support_eq_preimage Function.mulSupport_eq_preimage
#align function.support_eq_preimage Function.support_eq_preimage
@[to_additive]
theorem nmem_mulSupport {f : α → M} {x : α} : x ∉ mulSupport f ↔ f x = 1 :=
not_not
#align function.nmem_mul_support Function.nmem_mulSupport
#align function.nmem_support Function.nmem_support
@[to_additive]
theorem compl_mulSupport {f : α → M} : (mulSupport f)ᶜ = { x | f x = 1 } :=
ext fun _ => nmem_mulSupport
#align function.compl_mul_support Function.compl_mulSupport
#align function.compl_support Function.compl_support
@[to_additive (attr := simp)]
theorem mem_mulSupport {f : α → M} {x : α} : x ∈ mulSupport f ↔ f x ≠ 1 :=
Iff.rfl
#align function.mem_mul_support Function.mem_mulSupport
#align function.mem_support Function.mem_support
@[to_additive (attr := simp)]
theorem mulSupport_subset_iff {f : α → M} {s : Set α} : mulSupport f ⊆ s ↔ ∀ x, f x ≠ 1 → x ∈ s :=
Iff.rfl
#align function.mul_support_subset_iff Function.mulSupport_subset_iff
#align function.support_subset_iff Function.support_subset_iff
@[to_additive]
theorem mulSupport_subset_iff' {f : α → M} {s : Set α} :
mulSupport f ⊆ s ↔ ∀ x ∉ s, f x = 1 :=
forall_congr' fun _ => not_imp_comm
#align function.mul_support_subset_iff' Function.mulSupport_subset_iff'
#align function.support_subset_iff' Function.support_subset_iff'
@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1 := by
simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def,
not_imp_comm, and_comm, forall_and]
#align function.mul_support_eq_iff Function.mulSupport_eq_iff
#align function.support_eq_iff Function.support_eq_iff
@[to_additive]
theorem ext_iff_mulSupport {f g : α → M} :
f = g ↔ f.mulSupport = g.mulSupport ∧ ∀ x ∈ f.mulSupport, f x = g x :=
⟨fun h ↦ h ▸ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, h₂⟩ ↦ funext fun x ↦ by
if hx : x ∈ f.mulSupport then exact h₂ x hx
else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩
@[to_additive]
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
mulSupport (update f x y) = insert x (mulSupport f) := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
| Mathlib/Algebra/Group/Support.lean | 93 | 95 | theorem mulSupport_update_one [DecidableEq α] (f : α → M) (x : α) :
mulSupport (update f x 1) = mulSupport f \ {x} := by |
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
| [
" mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a ∈ mulSupport (update f x y) ↔ a ∈ insert x (mulSupport f)",
" a ∈ mulSupport (update f a y) ↔ a ∈ insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... | [
" mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a ∈ mulSupport (update f x y) ↔ a ∈ insert x (mulSupport f)",
" a ∈ mulSupport (update f a y) ↔ a ∈ insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... |
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.Module.Basic
import Mathlib.Algebra.Regular.SMul
import Mathlib.Data.Finset.Preimage
import Mathlib.Data.Rat.BigOperators
import Mathlib.GroupTheory.GroupAction.Hom
import Mathlib.Data.Set.Subsingleton
#align_import data.finsupp.basic from "leanprover-community/mathlib"@"f69db8cecc668e2d5894d7e9bfc491da60db3b9f"
noncomputable section
open Finset Function
variable {α β γ ι M M' N P G H R S : Type*}
namespace Finsupp
section Graph
variable [Zero M]
def graph (f : α →₀ M) : Finset (α × M) :=
f.support.map ⟨fun a => Prod.mk a (f a), fun _ _ h => (Prod.mk.inj h).1⟩
#align finsupp.graph Finsupp.graph
| Mathlib/Data/Finsupp/Basic.lean | 68 | 74 | theorem mk_mem_graph_iff {a : α} {m : M} {f : α →₀ M} : (a, m) ∈ f.graph ↔ f a = m ∧ m ≠ 0 := by |
simp_rw [graph, mem_map, mem_support_iff]
constructor
· rintro ⟨b, ha, rfl, -⟩
exact ⟨rfl, ha⟩
· rintro ⟨rfl, ha⟩
exact ⟨a, ha, rfl⟩
| [
" (a, m) ∈ f.graph ↔ f a = m ∧ m ≠ 0",
" (∃ a_1, f a_1 ≠ 0 ∧ { toFun := fun a => (a, f a), inj' := ⋯ } a_1 = (a, m)) ↔ f a = m ∧ m ≠ 0",
" (∃ a_1, f a_1 ≠ 0 ∧ { toFun := fun a => (a, f a), inj' := ⋯ } a_1 = (a, m)) → f a = m ∧ m ≠ 0",
" f a = f a ∧ f a ≠ 0",
" f a = m ∧ m ≠ 0 → ∃ a_2, f a_2 ≠ 0 ∧ { toFun :=... | [
" (a, m) ∈ f.graph ↔ f a = m ∧ m ≠ 0"
] |
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.GroupTheory.GroupAction.Hom
open Set Pointwise
theorem MulAction.smul_bijective_of_is_unit
{M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) :
Function.Bijective (fun (a : α) ↦ m • a) := by
lift m to Mˣ using hm
rw [Function.bijective_iff_has_inverse]
use fun a ↦ m⁻¹ • a
constructor
· intro x; simp [← Units.smul_def]
· intro x; simp [← Units.smul_def]
variable {R S : Type*} (M M₁ M₂ N : Type*)
variable [Monoid R] [Monoid S] (σ : R → S)
variable [MulAction R M] [MulAction S N] [MulAction R M₁] [MulAction R M₂]
variable {F : Type*} (h : F)
section MulActionSemiHomClass
variable [FunLike F M N] [MulActionSemiHomClass F σ M N]
(c : R) (s : Set M) (t : Set N)
-- @[simp] -- In #8386, the `simp_nf` linter complains:
-- "Left-hand side does not simplify, when using the simp lemma on itself."
-- For now we will have to manually add `image_smul_setₛₗ _` to the `simp` argument list.
-- TODO: when lean4#3107 is fixed, mark this as `@[simp]`.
theorem image_smul_setₛₗ :
h '' (c • s) = σ c • h '' s := by
simp only [← image_smul, image_image, map_smulₛₗ h]
#align image_smul_setₛₗ image_smul_setₛₗ
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 64 | 67 | theorem smul_preimage_set_leₛₗ :
c • h ⁻¹' t ⊆ h ⁻¹' (σ c • t) := by |
rintro x ⟨y, hy, rfl⟩
exact ⟨h y, hy, by rw [map_smulₛₗ]⟩
| [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... | [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Tactic.Ring
#align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
def hyperoperation : ℕ → ℕ → ℕ → ℕ
| 0, _, k => k + 1
| 1, m, 0 => m
| 2, _, 0 => 0
| _ + 3, _, 0 => 1
| n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k)
#align hyperoperation hyperoperation
-- Basic hyperoperation lemmas
@[simp]
theorem hyperoperation_zero (m : ℕ) : hyperoperation 0 m = Nat.succ :=
funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one]
#align hyperoperation_zero hyperoperation_zero
theorem hyperoperation_ge_three_eq_one (n m : ℕ) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
#align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
theorem hyperoperation_recursion (n m k : ℕ) :
hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by
rw [hyperoperation]
#align hyperoperation_recursion hyperoperation_recursion
-- Interesting hyperoperation lemmas
@[simp]
| Mathlib/Data/Nat/Hyperoperation.lean | 60 | 65 | theorem hyperoperation_one : hyperoperation 1 = (· + ·) := by |
ext m k
induction' k with bn bih
· rw [Nat.add_zero m, hyperoperation]
· rw [hyperoperation_recursion, bih, hyperoperation_zero]
exact Nat.add_assoc m bn 1
| [
" hyperoperation 0 m k = k.succ",
" hyperoperation (n + 3) m 0 = 1",
" hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k)",
" hyperoperation 1 = fun x x_1 => x + x_1",
" hyperoperation 1 m k = m + k",
" hyperoperation 1 m 0 = m + 0",
" hyperoperation 1 m (bn + 1) = m + (b... | [
" hyperoperation 0 m k = k.succ",
" hyperoperation (n + 3) m 0 = 1",
" hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k)",
" hyperoperation 1 = fun x x_1 => x + x_1"
] |
import Mathlib.Algebra.Group.Subsemigroup.Basic
#align_import group_theory.subsemigroup.membership from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff"
assert_not_exists MonoidWithZero
variable {ι : Sort*} {M A B : Type*}
section NonAssoc
variable [Mul M]
open Set
namespace Subsemigroup
-- TODO: this section can be generalized to `[MulMemClass B M] [CompleteLattice B]`
-- such that `complete_lattice.le` coincides with `set_like.le`
@[to_additive]
theorem mem_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) {x : M} :
(x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx ↦ closure_induction hx (fun y hy ↦ mem_iUnion.mp hy) ?_
rintro x y ⟨i, hi⟩ ⟨j, hj⟩
rcases hS i j with ⟨k, hki, hkj⟩
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
#align subsemigroup.mem_supr_of_directed Subsemigroup.mem_iSup_of_directed
#align add_subsemigroup.mem_supr_of_directed AddSubsemigroup.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) :
((⨆ i, S i : Subsemigroup M) : Set M) = ⋃ i, S i :=
Set.ext fun x => by simp [mem_iSup_of_directed hS]
#align subsemigroup.coe_supr_of_directed Subsemigroup.coe_iSup_of_directed
#align add_subsemigroup.coe_supr_of_directed AddSubsemigroup.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) {x : M} :
x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
simp only [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk,
exists_prop]
#align subsemigroup.mem_Sup_of_directed_on Subsemigroup.mem_sSup_of_directed_on
#align add_subsemigroup.mem_Sup_of_directed_on AddSubsemigroup.mem_sSup_of_directed_on
@[to_additive]
theorem coe_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) :
(↑(sSup S) : Set M) = ⋃ s ∈ S, ↑s :=
Set.ext fun x => by simp [mem_sSup_of_directed_on hS]
#align subsemigroup.coe_Sup_of_directed_on Subsemigroup.coe_sSup_of_directed_on
#align add_subsemigroup.coe_Sup_of_directed_on AddSubsemigroup.coe_sSup_of_directed_on
@[to_additive]
theorem mem_sup_left {S T : Subsemigroup M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T := by
have : S ≤ S ⊔ T := le_sup_left
tauto
#align subsemigroup.mem_sup_left Subsemigroup.mem_sup_left
#align add_subsemigroup.mem_sup_left AddSubsemigroup.mem_sup_left
@[to_additive]
| Mathlib/Algebra/Group/Subsemigroup/Membership.lean | 89 | 91 | theorem mem_sup_right {S T : Subsemigroup M} : ∀ {x : M}, x ∈ T → x ∈ S ⊔ T := by |
have : T ≤ S ⊔ T := le_sup_right
tauto
| [
" x ∈ ⨆ i, S i ↔ ∃ i, x ∈ S i",
" x ∈ ⨆ i, S i → ∃ i, x ∈ S i",
" x ∈ closure (⋃ i, ↑(S i)) → ∃ i, x ∈ S i",
" ∀ (x y : M), (∃ i, x ∈ S i) → (∃ i, y ∈ S i) → ∃ i, x * y ∈ S i",
" ∃ i, x * y ∈ S i",
" x ∈ ↑(⨆ i, S i) ↔ x ∈ ⋃ i, ↑(S i)",
" x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s",
" x ∈ ↑(sSup S) ↔ x ∈ ⋃ s ∈ S, ↑s"... | [
" x ∈ ⨆ i, S i ↔ ∃ i, x ∈ S i",
" x ∈ ⨆ i, S i → ∃ i, x ∈ S i",
" x ∈ closure (⋃ i, ↑(S i)) → ∃ i, x ∈ S i",
" ∀ (x y : M), (∃ i, x ∈ S i) → (∃ i, y ∈ S i) → ∃ i, x * y ∈ S i",
" ∃ i, x * y ∈ S i",
" x ∈ ↑(⨆ i, S i) ↔ x ∈ ⋃ i, ↑(S i)",
" x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s",
" x ∈ ↑(sSup S) ↔ x ∈ ⋃ s ∈ S, ↑s"... |
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Data.ENat.Lattice
import Mathlib.Data.Part
import Mathlib.Tactic.NormNum
#align_import data.nat.part_enat from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
open Part hiding some
def PartENat : Type :=
Part ℕ
#align part_enat PartENat
namespace PartENat
@[coe]
def some : ℕ → PartENat :=
Part.some
#align part_enat.some PartENat.some
instance : Zero PartENat :=
⟨some 0⟩
instance : Inhabited PartENat :=
⟨0⟩
instance : One PartENat :=
⟨some 1⟩
instance : Add PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => get x h.1 + get y h.2⟩⟩
instance (n : ℕ) : Decidable (some n).Dom :=
isTrue trivial
@[simp]
theorem dom_some (x : ℕ) : (some x).Dom :=
trivial
#align part_enat.dom_some PartENat.dom_some
instance addCommMonoid : AddCommMonoid PartENat where
add := (· + ·)
zero := 0
add_comm x y := Part.ext' and_comm fun _ _ => add_comm _ _
zero_add x := Part.ext' (true_and_iff _) fun _ _ => zero_add _
add_zero x := Part.ext' (and_true_iff _) fun _ _ => add_zero _
add_assoc x y z := Part.ext' and_assoc fun _ _ => add_assoc _ _ _
nsmul := nsmulRec
instance : AddCommMonoidWithOne PartENat :=
{ PartENat.addCommMonoid with
one := 1
natCast := some
natCast_zero := rfl
natCast_succ := fun _ => Part.ext' (true_and_iff _).symm fun _ _ => rfl }
theorem some_eq_natCast (n : ℕ) : some n = n :=
rfl
#align part_enat.some_eq_coe PartENat.some_eq_natCast
instance : CharZero PartENat where
cast_injective := Part.some_injective
theorem natCast_inj {x y : ℕ} : (x : PartENat) = y ↔ x = y :=
Nat.cast_inj
#align part_enat.coe_inj PartENat.natCast_inj
@[simp]
theorem dom_natCast (x : ℕ) : (x : PartENat).Dom :=
trivial
#align part_enat.dom_coe PartENat.dom_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem dom_ofNat (x : ℕ) [x.AtLeastTwo] : (no_index (OfNat.ofNat x : PartENat)).Dom :=
trivial
@[simp]
theorem dom_zero : (0 : PartENat).Dom :=
trivial
@[simp]
theorem dom_one : (1 : PartENat).Dom :=
trivial
instance : CanLift PartENat ℕ (↑) Dom :=
⟨fun n hn => ⟨n.get hn, Part.some_get _⟩⟩
instance : LE PartENat :=
⟨fun x y => ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy⟩
instance : Top PartENat :=
⟨none⟩
instance : Bot PartENat :=
⟨0⟩
instance : Sup PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => x.get h.1 ⊔ y.get h.2⟩⟩
theorem le_def (x y : PartENat) :
x ≤ y ↔ ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy :=
Iff.rfl
#align part_enat.le_def PartENat.le_def
@[elab_as_elim]
protected theorem casesOn' {P : PartENat → Prop} :
∀ a : PartENat, P ⊤ → (∀ n : ℕ, P (some n)) → P a :=
Part.induction_on
#align part_enat.cases_on' PartENat.casesOn'
@[elab_as_elim]
protected theorem casesOn {P : PartENat → Prop} : ∀ a : PartENat, P ⊤ → (∀ n : ℕ, P n) → P a := by
exact PartENat.casesOn'
#align part_enat.cases_on PartENat.casesOn
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem top_add (x : PartENat) : ⊤ + x = ⊤ :=
Part.ext' (false_and_iff _) fun h => h.left.elim
#align part_enat.top_add PartENat.top_add
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem add_top (x : PartENat) : x + ⊤ = ⊤ := by rw [add_comm, top_add]
#align part_enat.add_top PartENat.add_top
@[simp]
theorem natCast_get {x : PartENat} (h : x.Dom) : (x.get h : PartENat) = x := by
exact Part.ext' (iff_of_true trivial h) fun _ _ => rfl
#align part_enat.coe_get PartENat.natCast_get
@[simp, norm_cast]
theorem get_natCast' (x : ℕ) (h : (x : PartENat).Dom) : get (x : PartENat) h = x := by
rw [← natCast_inj, natCast_get]
#align part_enat.get_coe' PartENat.get_natCast'
theorem get_natCast {x : ℕ} : get (x : PartENat) (dom_natCast x) = x :=
get_natCast' _ _
#align part_enat.get_coe PartENat.get_natCast
| Mathlib/Data/Nat/PartENat.lean | 192 | 194 | theorem coe_add_get {x : ℕ} {y : PartENat} (h : ((x : PartENat) + y).Dom) :
get ((x : PartENat) + y) h = x + get y h.2 := by |
rfl
| [
" ∀ (a : PartENat), P ⊤ → (∀ (n : ℕ), P ↑n) → P a",
" x + ⊤ = ⊤",
" ↑(x.get h) = x",
" (↑x).get h = x",
" (↑x + y).get h = x + y.get ⋯"
] | [
" ∀ (a : PartENat), P ⊤ → (∀ (n : ℕ), P ↑n) → P a",
" x + ⊤ = ⊤",
" ↑(x.get h) = x",
" (↑x).get h = x",
" (↑x + y).get h = x + y.get ⋯"
] |
import Mathlib.Data.Set.Image
import Mathlib.Data.Set.Lattice
#align_import data.set.sigma from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f"
namespace Set
variable {ι ι' : Type*} {α β : ι → Type*} {s s₁ s₂ : Set ι} {t t₁ t₂ : ∀ i, Set (α i)}
{u : Set (Σ i, α i)} {x : Σ i, α i} {i j : ι} {a : α i}
@[simp]
theorem range_sigmaMk (i : ι) : range (Sigma.mk i : α i → Sigma α) = Sigma.fst ⁻¹' {i} := by
apply Subset.antisymm
· rintro _ ⟨b, rfl⟩
simp
· rintro ⟨x, y⟩ (rfl | _)
exact mem_range_self y
#align set.range_sigma_mk Set.range_sigmaMk
theorem preimage_image_sigmaMk_of_ne (h : i ≠ j) (s : Set (α j)) :
Sigma.mk i ⁻¹' (Sigma.mk j '' s) = ∅ := by
ext x
simp [h.symm]
#align set.preimage_image_sigma_mk_of_ne Set.preimage_image_sigmaMk_of_ne
theorem image_sigmaMk_preimage_sigmaMap_subset {β : ι' → Type*} (f : ι → ι')
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) ⊆ Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) :=
image_subset_iff.2 fun x hx ↦ ⟨g i x, hx, rfl⟩
#align set.image_sigma_mk_preimage_sigma_map_subset Set.image_sigmaMk_preimage_sigmaMap_subset
| Mathlib/Data/Set/Sigma.lean | 43 | 50 | theorem image_sigmaMk_preimage_sigmaMap {β : ι' → Type*} {f : ι → ι'} (hf : Function.Injective f)
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) = Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) := by |
refine (image_sigmaMk_preimage_sigmaMap_subset f g i s).antisymm ?_
rintro ⟨j, x⟩ ⟨y, hys, hxy⟩
simp only [hf.eq_iff, Sigma.map, Sigma.ext_iff] at hxy
rcases hxy with ⟨rfl, hxy⟩; rw [heq_iff_eq] at hxy; subst y
exact ⟨x, hys, rfl⟩
| [
" range (Sigma.mk i) = Sigma.fst ⁻¹' {i}",
" range (Sigma.mk i) ⊆ Sigma.fst ⁻¹' {i}",
" ⟨i, b⟩ ∈ Sigma.fst ⁻¹' {i}",
" Sigma.fst ⁻¹' {i} ⊆ range (Sigma.mk i)",
" ⟨x, y⟩ ∈ range (Sigma.mk ⟨x, y⟩.fst)",
" Sigma.mk i ⁻¹' (Sigma.mk j '' s) = ∅",
" x ∈ Sigma.mk i ⁻¹' (Sigma.mk j '' s) ↔ x ∈ ∅",
" Sigma.mk ... | [
" range (Sigma.mk i) = Sigma.fst ⁻¹' {i}",
" range (Sigma.mk i) ⊆ Sigma.fst ⁻¹' {i}",
" ⟨i, b⟩ ∈ Sigma.fst ⁻¹' {i}",
" Sigma.fst ⁻¹' {i} ⊆ range (Sigma.mk i)",
" ⟨x, y⟩ ∈ range (Sigma.mk ⟨x, y⟩.fst)",
" Sigma.mk i ⁻¹' (Sigma.mk j '' s) = ∅",
" x ∈ Sigma.mk i ⁻¹' (Sigma.mk j '' s) ↔ x ∈ ∅",
" Sigma.mk ... |
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Set.Finite
#align_import data.finset.n_ary from "leanprover-community/mathlib"@"eba7871095e834365616b5e43c8c7bb0b37058d0"
open Function Set
variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*}
namespace Finset
variable [DecidableEq α'] [DecidableEq β'] [DecidableEq γ] [DecidableEq γ'] [DecidableEq δ]
[DecidableEq δ'] [DecidableEq ε] [DecidableEq ε'] {f f' : α → β → γ} {g g' : α → β → γ → δ}
{s s' : Finset α} {t t' : Finset β} {u u' : Finset γ} {a a' : α} {b b' : β} {c : γ}
def image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : Finset γ :=
(s ×ˢ t).image <| uncurry f
#align finset.image₂ Finset.image₂
@[simp]
theorem mem_image₂ : c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c := by
simp [image₂, and_assoc]
#align finset.mem_image₂ Finset.mem_image₂
@[simp, norm_cast]
theorem coe_image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) :
(image₂ f s t : Set γ) = Set.image2 f s t :=
Set.ext fun _ => mem_image₂
#align finset.coe_image₂ Finset.coe_image₂
theorem card_image₂_le (f : α → β → γ) (s : Finset α) (t : Finset β) :
(image₂ f s t).card ≤ s.card * t.card :=
card_image_le.trans_eq <| card_product _ _
#align finset.card_image₂_le Finset.card_image₂_le
theorem card_image₂_iff :
(image₂ f s t).card = s.card * t.card ↔ (s ×ˢ t : Set (α × β)).InjOn fun x => f x.1 x.2 := by
rw [← card_product, ← coe_product]
exact card_image_iff
#align finset.card_image₂_iff Finset.card_image₂_iff
theorem card_image₂ (hf : Injective2 f) (s : Finset α) (t : Finset β) :
(image₂ f s t).card = s.card * t.card :=
(card_image_of_injective _ hf.uncurry).trans <| card_product _ _
#align finset.card_image₂ Finset.card_image₂
theorem mem_image₂_of_mem (ha : a ∈ s) (hb : b ∈ t) : f a b ∈ image₂ f s t :=
mem_image₂.2 ⟨a, ha, b, hb, rfl⟩
#align finset.mem_image₂_of_mem Finset.mem_image₂_of_mem
theorem mem_image₂_iff (hf : Injective2 f) : f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t := by
rw [← mem_coe, coe_image₂, mem_image2_iff hf, mem_coe, mem_coe]
#align finset.mem_image₂_iff Finset.mem_image₂_iff
theorem image₂_subset (hs : s ⊆ s') (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s' t' := by
rw [← coe_subset, coe_image₂, coe_image₂]
exact image2_subset hs ht
#align finset.image₂_subset Finset.image₂_subset
theorem image₂_subset_left (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s t' :=
image₂_subset Subset.rfl ht
#align finset.image₂_subset_left Finset.image₂_subset_left
theorem image₂_subset_right (hs : s ⊆ s') : image₂ f s t ⊆ image₂ f s' t :=
image₂_subset hs Subset.rfl
#align finset.image₂_subset_right Finset.image₂_subset_right
theorem image_subset_image₂_left (hb : b ∈ t) : s.image (fun a => f a b) ⊆ image₂ f s t :=
image_subset_iff.2 fun _ ha => mem_image₂_of_mem ha hb
#align finset.image_subset_image₂_left Finset.image_subset_image₂_left
theorem image_subset_image₂_right (ha : a ∈ s) : t.image (fun b => f a b) ⊆ image₂ f s t :=
image_subset_iff.2 fun _ => mem_image₂_of_mem ha
#align finset.image_subset_image₂_right Finset.image_subset_image₂_right
| Mathlib/Data/Finset/NAry.lean | 98 | 100 | theorem forall_image₂_iff {p : γ → Prop} :
(∀ z ∈ image₂ f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) := by |
simp_rw [← mem_coe, coe_image₂, forall_image2_iff]
| [
" c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c",
" (image₂ f s t).card = s.card * t.card ↔ InjOn (fun x => f x.1 x.2) (↑s ×ˢ ↑t)",
" (image₂ f s t).card = (s ×ˢ t).card ↔ InjOn (fun x => f x.1 x.2) ↑(s ×ˢ t)",
" f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t",
" image₂ f s t ⊆ image₂ f s' t'",
" image2 f ↑s ↑t ⊆ ... | [
" c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c",
" (image₂ f s t).card = s.card * t.card ↔ InjOn (fun x => f x.1 x.2) (↑s ×ˢ ↑t)",
" (image₂ f s t).card = (s ×ˢ t).card ↔ InjOn (fun x => f x.1 x.2) ↑(s ×ˢ t)",
" f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t",
" image₂ f s t ⊆ image₂ f s' t'",
" image2 f ↑s ↑t ⊆ ... |
import Mathlib.Topology.Constructions
import Mathlib.Topology.Separation
open Set Filter Function Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y}
section codiscrete_filter
| Mathlib/Topology/DiscreteSubset.lean | 83 | 92 | theorem isClosed_and_discrete_iff {S : Set X} :
IsClosed S ∧ DiscreteTopology S ↔ ∀ x, Disjoint (𝓝[≠] x) (𝓟 S) := by |
rw [discreteTopology_subtype_iff, isClosed_iff_clusterPt, ← forall_and]
congrm (∀ x, ?_)
rw [← not_imp_not, clusterPt_iff_not_disjoint, not_not, ← disjoint_iff]
constructor <;> intro H
· by_cases hx : x ∈ S
exacts [H.2 hx, (H.1 hx).mono_left nhdsWithin_le_nhds]
· refine ⟨fun hx ↦ ?_, fun _ ↦ H⟩
simpa [disjoint_iff, nhdsWithin, inf_assoc, hx] using H
| [
" IsClosed S ∧ DiscreteTopology ↑S ↔ ∀ (x : X), Disjoint (𝓝[≠] x) (𝓟 S)",
" (∀ (x : X), (ClusterPt x (𝓟 S) → x ∈ S) ∧ (x ∈ S → 𝓝[≠] x ⊓ 𝓟 S = ⊥)) ↔ ∀ (x : X), Disjoint (𝓝[≠] x) (𝓟 S)",
" (ClusterPt x (𝓟 S) → x ∈ S) ∧ (x ∈ S → 𝓝[≠] x ⊓ 𝓟 S = ⊥) ↔ Disjoint (𝓝[≠] x) (𝓟 S)",
" (x ∉ S → Disjoint (𝓝 x)... | [
" IsClosed S ∧ DiscreteTopology ↑S ↔ ∀ (x : X), Disjoint (𝓝[≠] x) (𝓟 S)"
] |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
#align real.cosh_arsinh Real.cosh_arsinh
theorem sinh_surjective : Surjective sinh :=
LeftInverse.surjective sinh_arsinh
#align real.sinh_surjective Real.sinh_surjective
theorem sinh_bijective : Bijective sinh :=
⟨sinh_injective, sinh_surjective⟩
#align real.sinh_bijective Real.sinh_bijective
@[simp]
theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x :=
rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x
#align real.arsinh_sinh Real.arsinh_sinh
@[simps]
def sinhEquiv : ℝ ≃ ℝ where
toFun := sinh
invFun := arsinh
left_inv := arsinh_sinh
right_inv := sinh_arsinh
#align real.sinh_equiv Real.sinhEquiv
@[simps! (config := .asFn)]
def sinhOrderIso : ℝ ≃o ℝ where
toEquiv := sinhEquiv
map_rel_iff' := @sinh_le_sinh
#align real.sinh_order_iso Real.sinhOrderIso
@[simps! (config := .asFn)]
def sinhHomeomorph : ℝ ≃ₜ ℝ :=
sinhOrderIso.toHomeomorph
#align real.sinh_homeomorph Real.sinhHomeomorph
theorem arsinh_bijective : Bijective arsinh :=
sinhEquiv.symm.bijective
#align real.arsinh_bijective Real.arsinh_bijective
theorem arsinh_injective : Injective arsinh :=
sinhEquiv.symm.injective
#align real.arsinh_injective Real.arsinh_injective
theorem arsinh_surjective : Surjective arsinh :=
sinhEquiv.symm.surjective
#align real.arsinh_surjective Real.arsinh_surjective
theorem arsinh_strictMono : StrictMono arsinh :=
sinhOrderIso.symm.strictMono
#align real.arsinh_strict_mono Real.arsinh_strictMono
@[simp]
theorem arsinh_inj : arsinh x = arsinh y ↔ x = y :=
arsinh_injective.eq_iff
#align real.arsinh_inj Real.arsinh_inj
@[simp]
theorem arsinh_le_arsinh : arsinh x ≤ arsinh y ↔ x ≤ y :=
sinhOrderIso.symm.le_iff_le
#align real.arsinh_le_arsinh Real.arsinh_le_arsinh
@[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh
@[simp]
theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y :=
sinhOrderIso.symm.lt_iff_lt
#align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh
@[simp]
theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 :=
arsinh_injective.eq_iff' arsinh_zero
#align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 164 | 164 | theorem arsinh_nonneg_iff : 0 ≤ arsinh x ↔ 0 ≤ x := by | rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
| [
" rexp x.arsinh = x + √(1 + x ^ 2)",
" 0 < x + √(1 + x ^ 2)",
" -x < √(1 + x ^ 2)",
" (-x) ^ 2 < 1 + x ^ 2",
" arsinh 0 = 0",
" (-x).arsinh = -x.arsinh",
" -x + √(1 + (-x) ^ 2) = (x + √(1 + x ^ 2))⁻¹",
" (-x + √(1 + (-x) ^ 2)) * (x + √(1 + x ^ 2)) = 1",
" 0 ≤ 1 + x ^ 2",
" x.arsinh.sinh = x",
" ... | [
" rexp x.arsinh = x + √(1 + x ^ 2)",
" 0 < x + √(1 + x ^ 2)",
" -x < √(1 + x ^ 2)",
" (-x) ^ 2 < 1 + x ^ 2",
" arsinh 0 = 0",
" (-x).arsinh = -x.arsinh",
" -x + √(1 + (-x) ^ 2) = (x + √(1 + x ^ 2))⁻¹",
" (-x + √(1 + (-x) ^ 2)) * (x + √(1 + x ^ 2)) = 1",
" 0 ≤ 1 + x ^ 2",
" x.arsinh.sinh = x",
" ... |
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
| [
" HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x",
" 1 - x ^ 2 < 0",
" HasStrictDerivAt arcsin 0 x ∧ ContDiffAt ℝ ⊤ arcsin x",
" 0 < 1 - x ^ 2",
" HasStrictDerivAt arcsin x.arcsin.cos⁻¹ x ∧ ContDiffAt ℝ ⊤ arcsin x",
" HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x",
" HasDe... | [
" HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x",
" 1 - x ^ 2 < 0",
" HasStrictDerivAt arcsin 0 x ∧ ContDiffAt ℝ ⊤ arcsin x",
" 0 < 1 - x ^ 2",
" HasStrictDerivAt arcsin x.arcsin.cos⁻¹ x ∧ ContDiffAt ℝ ⊤ arcsin x",
" HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x",
" HasDe... |
import Mathlib.Data.DFinsupp.Lex
import Mathlib.Order.GameAdd
import Mathlib.Order.Antisymmetrization
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Tactic.AdaptationNote
#align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa"
variable {ι : Type*} {α : ι → Type*}
namespace DFinsupp
open Relation Prod
section Zero
variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop)
| Mathlib/Data/DFinsupp/WellFounded.lean | 69 | 98 | theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] :
Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s)
fun x => piecewise x.2.1 x.2.2 x.1 := by |
rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩
simp_rw [piecewise_apply] at hs hr
split_ifs at hs with hp
· refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩,
.fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq]
· simp only [if_pos hj]
· split_ifs with hi
· rwa [hr i hi, if_pos hp] at hs
· assumption
· ext1 j
simp only [piecewise_apply, Set.mem_setOf_eq]
split_ifs with h₁ h₂ <;> try rfl
· rw [hr j h₂, if_pos (h₁ h₂)]
· rw [Classical.not_imp] at h₁
rw [hr j h₁.1, if_neg h₁.2]
· refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩,
.snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq]
· exact if_pos hj
· split_ifs with hi
· rwa [hr i hi, if_neg hp] at hs
· assumption
· ext1 j
simp only [piecewise_apply, Set.mem_setOf_eq]
split_ifs with h₁ h₂ <;> try rfl
· rw [hr j h₁.1, if_pos h₁.2]
· rw [hr j h₂, if_neg]
simpa [h₂] using h₁
| [
" Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x =>\n x.2.1.piecewise x.2.2 x.1",
" ∃ a',\n InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd a' (p, x₁, x₂) ∧\n (fun x => x.2.1.piecewise x.2.2 x.1) a' = x",
" (x₁.piecewise x {j | r j i}) j... | [
" Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s) fun x =>\n x.2.1.piecewise x.2.2 x.1"
] |
import Mathlib.Data.List.Nodup
#align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {α : Type*}
namespace List
inductive Duplicate (x : α) : List α → Prop
| cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l)
| cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l)
#align list.duplicate List.Duplicate
local infixl:50 " ∈+ " => List.Duplicate
variable {l : List α} {x : α}
theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l :=
Duplicate.cons_mem h
#align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self
theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l :=
Duplicate.cons_duplicate h
#align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons
theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by
induction' h with l' _ y l' _ hm
· exact mem_cons_self _ _
· exact mem_cons_of_mem _ hm
#align list.duplicate.mem List.Duplicate.mem
theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by
cases' h with _ h _ _ h
· exact h
· exact h.mem
#align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self
@[simp]
theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l :=
⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩
#align list.duplicate_cons_self_iff List.duplicate_cons_self_iff
theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem)
#align list.duplicate.ne_nil List.Duplicate.ne_nil
@[simp]
theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl
#align list.not_duplicate_nil List.not_duplicate_nil
theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by
induction' h with l' h z l' h _
· simp [ne_nil_of_mem h]
· simp [ne_nil_of_mem h.mem]
#align list.duplicate.ne_singleton List.Duplicate.ne_singleton
@[simp]
theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl
#align list.not_duplicate_singleton List.not_duplicate_singleton
theorem Duplicate.elim_nil (h : x ∈+ []) : False :=
not_duplicate_nil x h
#align list.duplicate.elim_nil List.Duplicate.elim_nil
theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False :=
not_duplicate_singleton x y h
#align list.duplicate.elim_singleton List.Duplicate.elim_singleton
| Mathlib/Data/List/Duplicate.lean | 88 | 95 | theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by |
refine ⟨fun h => ?_, fun h => ?_⟩
· cases' h with _ hm _ _ hm
· exact Or.inl ⟨rfl, hm⟩
· exact Or.inr hm
· rcases h with (⟨rfl | h⟩ | h)
· simpa
· exact h.cons_duplicate
| [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l",
" y = x ∧ x ∈ l ∨ x ∈+ l",
" x = x ∧ x ∈ l ∨ x ∈+ l",
" x ∈+ y :: l",
" x ∈+ x :: l"
] | [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l"
] |
import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
#align_import analysis.special_functions.gamma.bohr_mollerup from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
set_option linter.uppercaseLean3 false
noncomputable section
open Filter Set MeasureTheory
open scoped Nat ENNReal Topology Real
namespace Real
section Convexity
| Mathlib/Analysis/SpecialFunctions/Gamma/BohrMollerup.lean | 106 | 161 | theorem Gamma_mul_add_mul_le_rpow_Gamma_mul_rpow_Gamma {s t a b : ℝ} (hs : 0 < s) (ht : 0 < t)
(ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) :
Gamma (a * s + b * t) ≤ Gamma s ^ a * Gamma t ^ b := by |
-- We will apply Hölder's inequality, for the conjugate exponents `p = 1 / a`
-- and `q = 1 / b`, to the functions `f a s` and `f b t`, where `f` is as follows:
let f : ℝ → ℝ → ℝ → ℝ := fun c u x => exp (-c * x) * x ^ (c * (u - 1))
have e : IsConjExponent (1 / a) (1 / b) := Real.isConjExponent_one_div ha hb hab
have hab' : b = 1 - a := by linarith
have hst : 0 < a * s + b * t := add_pos (mul_pos ha hs) (mul_pos hb ht)
-- some properties of f:
have posf : ∀ c u x : ℝ, x ∈ Ioi (0 : ℝ) → 0 ≤ f c u x := fun c u x hx =>
mul_nonneg (exp_pos _).le (rpow_pos_of_pos hx _).le
have posf' : ∀ c u : ℝ, ∀ᵐ x : ℝ ∂volume.restrict (Ioi 0), 0 ≤ f c u x := fun c u =>
(ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ (posf c u))
have fpow :
∀ {c x : ℝ} (_ : 0 < c) (u : ℝ) (_ : 0 < x), exp (-x) * x ^ (u - 1) = f c u x ^ (1 / c) := by
intro c x hc u hx
dsimp only [f]
rw [mul_rpow (exp_pos _).le ((rpow_nonneg hx.le) _), ← exp_mul, ← rpow_mul hx.le]
congr 2 <;> field_simp [hc.ne']; ring
-- show `f c u` is in `ℒp` for `p = 1/c`:
have f_mem_Lp :
∀ {c u : ℝ} (hc : 0 < c) (hu : 0 < u),
Memℒp (f c u) (ENNReal.ofReal (1 / c)) (volume.restrict (Ioi 0)) := by
intro c u hc hu
have A : ENNReal.ofReal (1 / c) ≠ 0 := by
rwa [Ne, ENNReal.ofReal_eq_zero, not_le, one_div_pos]
have B : ENNReal.ofReal (1 / c) ≠ ∞ := ENNReal.ofReal_ne_top
rw [← memℒp_norm_rpow_iff _ A B, ENNReal.toReal_ofReal (one_div_nonneg.mpr hc.le),
ENNReal.div_self A B, memℒp_one_iff_integrable]
· apply Integrable.congr (GammaIntegral_convergent hu)
refine eventuallyEq_of_mem (self_mem_ae_restrict measurableSet_Ioi) fun x hx => ?_
dsimp only
rw [fpow hc u hx]
congr 1
exact (norm_of_nonneg (posf _ _ x hx)).symm
· refine ContinuousOn.aestronglyMeasurable ?_ measurableSet_Ioi
refine (Continuous.continuousOn ?_).mul (ContinuousAt.continuousOn fun x hx => ?_)
· exact continuous_exp.comp (continuous_const.mul continuous_id')
· exact continuousAt_rpow_const _ _ (Or.inl (mem_Ioi.mp hx).ne')
-- now apply Hölder:
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst]
convert
MeasureTheory.integral_mul_le_Lp_mul_Lq_of_nonneg e (posf' a s) (posf' b t) (f_mem_Lp ha hs)
(f_mem_Lp hb ht) using
1
· refine setIntegral_congr measurableSet_Ioi fun x hx => ?_
dsimp only
have A : exp (-x) = exp (-a * x) * exp (-b * x) := by
rw [← exp_add, ← add_mul, ← neg_add, hab, neg_one_mul]
have B : x ^ (a * s + b * t - 1) = x ^ (a * (s - 1)) * x ^ (b * (t - 1)) := by
rw [← rpow_add hx, hab']; congr 1; ring
rw [A, B]
ring
· rw [one_div_one_div, one_div_one_div]
congr 2 <;> exact setIntegral_congr measurableSet_Ioi fun x hx => fpow (by assumption) _ hx
| [
" (a * s + b * t).Gamma ≤ s.Gamma ^ a * t.Gamma ^ b",
" b = 1 - a",
" ∀ {c x : ℝ}, 0 < c → ∀ (u : ℝ), 0 < x → rexp (-x) * x ^ (u - 1) = f c u x ^ (1 / c)",
" rexp (-x) * x ^ (u - 1) = f c u x ^ (1 / c)",
" rexp (-x) * x ^ (u - 1) = (rexp (-c * x) * x ^ (c * (u - 1))) ^ (1 / c)",
" rexp (-x) * x ^ (u - 1) ... | [
" (a * s + b * t).Gamma ≤ s.Gamma ^ a * t.Gamma ^ b"
] |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 57 | 58 | theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by |
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
| [
" x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2"
] | [
" x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2"
] |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.GroupTheory.GroupAction.Units
import Mathlib.Logic.Basic
import Mathlib.Tactic.Ring
#align_import ring_theory.coprime.basic from "leanprover-community/mathlib"@"a95b16cbade0f938fc24abd05412bde1e84bab9b"
universe u v
section CommSemiring
variable {R : Type u} [CommSemiring R] (x y z : R)
def IsCoprime : Prop :=
∃ a b, a * x + b * y = 1
#align is_coprime IsCoprime
variable {x y z}
@[symm]
theorem IsCoprime.symm (H : IsCoprime x y) : IsCoprime y x :=
let ⟨a, b, H⟩ := H
⟨b, a, by rw [add_comm, H]⟩
#align is_coprime.symm IsCoprime.symm
theorem isCoprime_comm : IsCoprime x y ↔ IsCoprime y x :=
⟨IsCoprime.symm, IsCoprime.symm⟩
#align is_coprime_comm isCoprime_comm
theorem isCoprime_self : IsCoprime x x ↔ IsUnit x :=
⟨fun ⟨a, b, h⟩ => isUnit_of_mul_eq_one x (a + b) <| by rwa [mul_comm, add_mul], fun h =>
let ⟨b, hb⟩ := isUnit_iff_exists_inv'.1 h
⟨b, 0, by rwa [zero_mul, add_zero]⟩⟩
#align is_coprime_self isCoprime_self
theorem isCoprime_zero_left : IsCoprime 0 x ↔ IsUnit x :=
⟨fun ⟨a, b, H⟩ => isUnit_of_mul_eq_one x b <| by rwa [mul_zero, zero_add, mul_comm] at H, fun H =>
let ⟨b, hb⟩ := isUnit_iff_exists_inv'.1 H
⟨1, b, by rwa [one_mul, zero_add]⟩⟩
#align is_coprime_zero_left isCoprime_zero_left
theorem isCoprime_zero_right : IsCoprime x 0 ↔ IsUnit x :=
isCoprime_comm.trans isCoprime_zero_left
#align is_coprime_zero_right isCoprime_zero_right
theorem not_isCoprime_zero_zero [Nontrivial R] : ¬IsCoprime (0 : R) 0 :=
mt isCoprime_zero_right.mp not_isUnit_zero
#align not_coprime_zero_zero not_isCoprime_zero_zero
lemma IsCoprime.intCast {R : Type*} [CommRing R] {a b : ℤ} (h : IsCoprime a b) :
IsCoprime (a : R) (b : R) := by
rcases h with ⟨u, v, H⟩
use u, v
rw_mod_cast [H]
exact Int.cast_one
| Mathlib/RingTheory/Coprime/Basic.lean | 84 | 86 | theorem IsCoprime.ne_zero [Nontrivial R] {p : Fin 2 → R} (h : IsCoprime (p 0) (p 1)) : p ≠ 0 := by |
rintro rfl
exact not_isCoprime_zero_zero h
| [
" b * y + a * x = 1",
" x * (a + b) = 1",
" b * x + 0 * x = 1",
" x * b = 1",
" 1 * 0 + b * x = 1",
" IsCoprime ↑a ↑b",
" ↑u * ↑a + ↑v * ↑b = 1",
" ↑1 = 1",
" p ≠ 0",
" False"
] | [
" b * y + a * x = 1",
" x * (a + b) = 1",
" b * x + 0 * x = 1",
" x * b = 1",
" 1 * 0 + b * x = 1",
" IsCoprime ↑a ↑b",
" ↑u * ↑a + ↑v * ↑b = 1",
" ↑1 = 1",
" p ≠ 0"
] |
import Mathlib.Data.Finset.Fin
import Mathlib.Data.Int.Order.Units
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.GroupTheory.Perm.Support
import Mathlib.Logic.Equiv.Fintype
#align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u v
open Equiv Function Fintype Finset
variable {α : Type u} {β : Type v}
-- An example on how to determine the order of an element of a finite group.
example : orderOf (-1 : ℤˣ) = 2 :=
orderOf_eq_prime (Int.units_sq _) (by decide)
namespace Equiv.Perm
theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α}
(hy : y ∈ s) : f⁻¹ y ∈ s := by
have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx :=
Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha)
(fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge
obtain ⟨y2, hy2, heq⟩ := h0 y hy
convert hy2
rw [heq]
simp only [inv_apply_self]
#align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset
| Mathlib/GroupTheory/Perm/Finite.lean | 68 | 75 | theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) :
Set.MapsTo (f⁻¹ : _) s s := by |
cases nonempty_fintype s
exact fun x hx =>
Set.mem_toFinset.mp <|
perm_inv_on_of_perm_on_finset
(fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha)))
(Set.mem_toFinset.mpr hx)
| [
" -1 ≠ 1",
" f⁻¹ y ∈ s",
" f⁻¹ y = y2",
" f⁻¹ ((fun i x => f i) y2 hy2) = y2",
" Set.MapsTo (⇑f⁻¹) s s"
] | [
" -1 ≠ 1",
" f⁻¹ y ∈ s",
" f⁻¹ y = y2",
" f⁻¹ ((fun i x => f i) y2 hy2) = y2",
" Set.MapsTo (⇑f⁻¹) s s"
] |
import Mathlib.CategoryTheory.Opposites
#align_import category_theory.eq_to_hom from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe v₁ v₂ v₃ u₁ u₂ u₃
-- morphism levels before object levels. See note [CategoryTheory universes].
namespace CategoryTheory
open Opposite
variable {C : Type u₁} [Category.{v₁} C]
def eqToHom {X Y : C} (p : X = Y) : X ⟶ Y := by rw [p]; exact 𝟙 _
#align category_theory.eq_to_hom CategoryTheory.eqToHom
@[simp]
theorem eqToHom_refl (X : C) (p : X = X) : eqToHom p = 𝟙 X :=
rfl
#align category_theory.eq_to_hom_refl CategoryTheory.eqToHom_refl
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/EqToHom.lean | 52 | 56 | theorem eqToHom_trans {X Y Z : C} (p : X = Y) (q : Y = Z) :
eqToHom p ≫ eqToHom q = eqToHom (p.trans q) := by |
cases p
cases q
simp
| [
" X ⟶ Y",
" Y ⟶ Y",
" eqToHom p ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom ⋯ = eqToHom ⋯"
] | [
" X ⟶ Y",
" Y ⟶ Y",
" eqToHom p ≫ eqToHom q = eqToHom ⋯"
] |
import Mathlib.MeasureTheory.Measure.Lebesgue.Complex
import Mathlib.MeasureTheory.Integral.DivergenceTheorem
import Mathlib.MeasureTheory.Integral.CircleIntegral
import Mathlib.Analysis.Calculus.Dslope
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Complex.ReImTopology
import Mathlib.Analysis.Calculus.DiffContOnCl
import Mathlib.Analysis.Calculus.FDeriv.Analytic
import Mathlib.Data.Real.Cardinality
#align_import analysis.complex.cauchy_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open TopologicalSpace Set MeasureTheory intervalIntegral Metric Filter Function
open scoped Interval Real NNReal ENNReal Topology
noncomputable section
universe u
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E]
namespace Complex
| Mathlib/Analysis/Complex/CauchyIntegral.lean | 166 | 203 | theorem integral_boundary_rect_of_hasFDerivAt_real_off_countable (f : ℂ → E) (f' : ℂ → ℂ →L[ℝ] E)
(z w : ℂ) (s : Set ℂ) (hs : s.Countable)
(Hc : ContinuousOn f ([[z.re, w.re]] ×ℂ [[z.im, w.im]]))
(Hd : ∀ x ∈ Ioo (min z.re w.re) (max z.re w.re) ×ℂ Ioo (min z.im w.im) (max z.im w.im) \ s,
HasFDerivAt f (f' x) x)
(Hi : IntegrableOn (fun z => I • f' z 1 - f' z I) ([[z.re, w.re]] ×ℂ [[z.im, w.im]])) :
(∫ x : ℝ in z.re..w.re, f (x + z.im * I)) - (∫ x : ℝ in z.re..w.re, f (x + w.im * I)) +
I • (∫ y : ℝ in z.im..w.im, f (re w + y * I)) -
I • ∫ y : ℝ in z.im..w.im, f (re z + y * I) =
∫ x : ℝ in z.re..w.re, ∫ y : ℝ in z.im..w.im, I • f' (x + y * I) 1 - f' (x + y * I) I := by |
set e : (ℝ × ℝ) ≃L[ℝ] ℂ := equivRealProdCLM.symm
have he : ∀ x y : ℝ, ↑x + ↑y * I = e (x, y) := fun x y => (mk_eq_add_mul_I x y).symm
have he₁ : e (1, 0) = 1 := rfl; have he₂ : e (0, 1) = I := rfl
simp only [he] at *
set F : ℝ × ℝ → E := f ∘ e
set F' : ℝ × ℝ → ℝ × ℝ →L[ℝ] E := fun p => (f' (e p)).comp (e : ℝ × ℝ →L[ℝ] ℂ)
have hF' : ∀ p : ℝ × ℝ, (-(I • F' p)) (1, 0) + F' p (0, 1) = -(I • f' (e p) 1 - f' (e p) I) := by
rintro ⟨x, y⟩
simp only [F', ContinuousLinearMap.neg_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, he₁, he₂, neg_add_eq_sub,
neg_sub]
set R : Set (ℝ × ℝ) := [[z.re, w.re]] ×ˢ [[w.im, z.im]]
set t : Set (ℝ × ℝ) := e ⁻¹' s
rw [uIcc_comm z.im] at Hc Hi; rw [min_comm z.im, max_comm z.im] at Hd
have hR : e ⁻¹' ([[z.re, w.re]] ×ℂ [[w.im, z.im]]) = R := rfl
have htc : ContinuousOn F R := Hc.comp e.continuousOn hR.ge
have htd :
∀ p ∈ Ioo (min z.re w.re) (max z.re w.re) ×ˢ Ioo (min w.im z.im) (max w.im z.im) \ t,
HasFDerivAt F (F' p) p :=
fun p hp => (Hd (e p) hp).comp p e.hasFDerivAt
simp_rw [← intervalIntegral.integral_smul, intervalIntegral.integral_symm w.im z.im, ←
intervalIntegral.integral_neg, ← hF']
refine (integral2_divergence_prod_of_hasFDerivWithinAt_off_countable (fun p => -(I • F p)) F
(fun p => -(I • F' p)) F' z.re w.im w.re z.im t (hs.preimage e.injective)
(htc.const_smul _).neg htc (fun p hp => ((htd p hp).const_smul I).neg) htd ?_).symm
rw [← (volume_preserving_equiv_real_prod.symm _).integrableOn_comp_preimage
(MeasurableEquiv.measurableEmbedding _)] at Hi
simpa only [hF'] using Hi.neg
| [
" (((∫ (x : ℝ) in z.re..w.re, f (↑x + ↑z.im * I)) - ∫ (x : ℝ) in z.re..w.re, f (↑x + ↑w.im * I)) +\n I • ∫ (y : ℝ) in z.im..w.im, f (↑w.re + ↑y * I)) -\n I • ∫ (y : ℝ) in z.im..w.im, f (↑z.re + ↑y * I) =\n ∫ (x : ℝ) in z.re..w.re, ∫ (y : ℝ) in z.im..w.im, I • (f' (↑x + ↑y * I)) 1 - (f' (↑x + ↑y * I))... | [
" (((∫ (x : ℝ) in z.re..w.re, f (↑x + ↑z.im * I)) - ∫ (x : ℝ) in z.re..w.re, f (↑x + ↑w.im * I)) +\n I • ∫ (y : ℝ) in z.im..w.im, f (↑w.re + ↑y * I)) -\n I • ∫ (y : ℝ) in z.im..w.im, f (↑z.re + ↑y * I) =\n ∫ (x : ℝ) in z.re..w.re, ∫ (y : ℝ) in z.im..w.im, I • (f' (↑x + ↑y * I)) 1 - (f' (↑x + ↑y * I))... |
import Mathlib.Topology.Algebra.Valuation
import Mathlib.Topology.Algebra.WithZeroTopology
import Mathlib.Topology.Algebra.UniformField
#align_import topology.algebra.valued_field from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064"
open Filter Set
open Topology
section DivisionRing
variable {K : Type*} [DivisionRing K] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀]
section ValuationTopologicalDivisionRing
section InversionEstimate
variable (v : Valuation K Γ₀)
-- The following is the main technical lemma ensuring that inversion is continuous
-- in the topology induced by a valuation on a division ring (i.e. the next instance)
-- and the fact that a valued field is completable
-- [BouAC, VI.5.1 Lemme 1]
| Mathlib/Topology/Algebra/ValuedField.lean | 51 | 72 | theorem Valuation.inversion_estimate {x y : K} {γ : Γ₀ˣ} (y_ne : y ≠ 0)
(h : v (x - y) < min (γ * (v y * v y)) (v y)) : v (x⁻¹ - y⁻¹) < γ := by |
have hyp1 : v (x - y) < γ * (v y * v y) := lt_of_lt_of_le h (min_le_left _ _)
have hyp1' : v (x - y) * (v y * v y)⁻¹ < γ := mul_inv_lt_of_lt_mul₀ hyp1
have hyp2 : v (x - y) < v y := lt_of_lt_of_le h (min_le_right _ _)
have key : v x = v y := Valuation.map_eq_of_sub_lt v hyp2
have x_ne : x ≠ 0 := by
intro h
apply y_ne
rw [h, v.map_zero] at key
exact v.zero_iff.1 key.symm
have decomp : x⁻¹ - y⁻¹ = x⁻¹ * (y - x) * y⁻¹ := by
rw [mul_sub_left_distrib, sub_mul, mul_assoc, show y * y⁻¹ = 1 from mul_inv_cancel y_ne,
show x⁻¹ * x = 1 from inv_mul_cancel x_ne, mul_one, one_mul]
calc
v (x⁻¹ - y⁻¹) = v (x⁻¹ * (y - x) * y⁻¹) := by rw [decomp]
_ = v x⁻¹ * (v <| y - x) * v y⁻¹ := by repeat' rw [Valuation.map_mul]
_ = (v x)⁻¹ * (v <| y - x) * (v y)⁻¹ := by rw [map_inv₀, map_inv₀]
_ = (v <| y - x) * (v y * v y)⁻¹ := by rw [mul_assoc, mul_comm, key, mul_assoc, mul_inv_rev]
_ = (v <| y - x) * (v y * v y)⁻¹ := rfl
_ = (v <| x - y) * (v y * v y)⁻¹ := by rw [Valuation.map_sub_swap]
_ < γ := hyp1'
| [
" v (x⁻¹ - y⁻¹) < ↑γ",
" x ≠ 0",
" False",
" y = 0",
" x⁻¹ - y⁻¹ = x⁻¹ * (y - x) * y⁻¹",
" v (x⁻¹ - y⁻¹) = v (x⁻¹ * (y - x) * y⁻¹)",
" v (x⁻¹ * (y - x) * y⁻¹) = v x⁻¹ * v (y - x) * v y⁻¹",
" v (x⁻¹ * (y - x)) * v y⁻¹ = v x⁻¹ * v (y - x) * v y⁻¹",
" v x⁻¹ * v (y - x) * v y⁻¹ = (v x)⁻¹ * v (y - x) * (... | [
" v (x⁻¹ - y⁻¹) < ↑γ"
] |
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Data.ZMod.Algebra
#align_import ring_theory.polynomial.cyclotomic.expand from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472"
namespace Polynomial
@[simp]
theorem cyclotomic_expand_eq_cyclotomic_mul {p n : ℕ} (hp : Nat.Prime p) (hdiv : ¬p ∣ n)
(R : Type*) [CommRing R] :
expand R p (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R := by
rcases Nat.eq_zero_or_pos n with (rfl | hnpos)
· simp
haveI := NeZero.of_pos hnpos
suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ by
rw [← map_cyclotomic_int, ← map_expand, this, Polynomial.map_mul, map_cyclotomic_int,
map_cyclotomic]
refine eq_of_monic_of_dvd_of_natDegree_le ((cyclotomic.monic _ ℤ).mul (cyclotomic.monic _ ℤ))
((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_
· refine (IsPrimitive.Int.dvd_iff_map_cast_dvd_map_cast _ _
(IsPrimitive.mul (cyclotomic.isPrimitive (n * p) ℤ) (cyclotomic.isPrimitive n ℤ))
((cyclotomic.monic n ℤ).expand hp.pos).isPrimitive).2 ?_
rw [Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic_int, map_expand, map_cyclotomic_int]
refine IsCoprime.mul_dvd (cyclotomic.isCoprime_rat fun h => ?_) ?_ ?_
· replace h : n * p = n * 1 := by simp [h]
exact Nat.Prime.ne_one hp (mul_left_cancel₀ hnpos.ne' h)
· have hpos : 0 < n * p := mul_pos hnpos hp.pos
have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne'
rw [cyclotomic_eq_minpoly_rat hprim hpos]
refine minpoly.dvd ℚ _ ?_
rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def,
@isRoot_cyclotomic_iff]
convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n)
rw [Nat.mul_div_cancel _ (Nat.Prime.pos hp)]
· have hprim := Complex.isPrimitiveRoot_exp _ hnpos.ne.symm
rw [cyclotomic_eq_minpoly_rat hprim hnpos]
refine minpoly.dvd ℚ _ ?_
rw [aeval_def, ← eval_map, map_expand, expand_eval, ← IsRoot.def, ←
cyclotomic_eq_minpoly_rat hprim hnpos, map_cyclotomic, @isRoot_cyclotomic_iff]
exact IsPrimitiveRoot.pow_of_prime hprim hp hdiv
· rw [natDegree_expand, natDegree_cyclotomic,
natDegree_mul (cyclotomic_ne_zero _ ℤ) (cyclotomic_ne_zero _ ℤ), natDegree_cyclotomic,
natDegree_cyclotomic, mul_comm n,
Nat.totient_mul ((Nat.Prime.coprime_iff_not_dvd hp).2 hdiv), Nat.totient_prime hp,
mul_comm (p - 1), ← Nat.mul_succ, Nat.sub_one, Nat.succ_pred_eq_of_pos hp.pos]
#align polynomial.cyclotomic_expand_eq_cyclotomic_mul Polynomial.cyclotomic_expand_eq_cyclotomic_mul
@[simp]
| Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean | 78 | 96 | theorem cyclotomic_expand_eq_cyclotomic {p n : ℕ} (hp : Nat.Prime p) (hdiv : p ∣ n) (R : Type*)
[CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R := by |
rcases n.eq_zero_or_pos with (rfl | hzero)
· simp
haveI := NeZero.of_pos hzero
suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ by
rw [← map_cyclotomic_int, ← map_expand, this, map_cyclotomic_int]
refine eq_of_monic_of_dvd_of_natDegree_le (cyclotomic.monic _ ℤ)
((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_
· have hpos := Nat.mul_pos hzero hp.pos
have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne.symm
rw [cyclotomic_eq_minpoly hprim hpos]
refine minpoly.isIntegrallyClosed_dvd (hprim.isIntegral hpos) ?_
rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def,
@isRoot_cyclotomic_iff]
convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n)
rw [Nat.mul_div_cancel _ hp.pos]
· rw [natDegree_expand, natDegree_cyclotomic, natDegree_cyclotomic, mul_comm n,
Nat.totient_mul_of_prime_of_dvd hp hdiv, mul_comm]
| [
" (expand R p) (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R",
" (expand R p) (cyclotomic 0 R) = cyclotomic (0 * p) R * cyclotomic 0 R",
" (expand ℤ p) (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ",
" cyclotomic (n * p) ℤ * cyclotomic n ℤ ∣ (expand ℤ p) (cyclotomic n ℤ)",
" map (Int.c... | [
" (expand R p) (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R",
" (expand R p) (cyclotomic 0 R) = cyclotomic (0 * p) R * cyclotomic 0 R",
" (expand ℤ p) (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ",
" cyclotomic (n * p) ℤ * cyclotomic n ℤ ∣ (expand ℤ p) (cyclotomic n ℤ)",
" map (Int.c... |
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.Nat.Factorial.Cast
#align_import data.nat.choose.cast from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496"
open Nat
variable (K : Type*) [DivisionRing K] [CharZero K]
namespace Nat
theorem cast_choose {a b : ℕ} (h : a ≤ b) : (b.choose a : K) = b ! / (a ! * (b - a)!) := by
have : ∀ {n : ℕ}, (n ! : K) ≠ 0 := Nat.cast_ne_zero.2 (factorial_ne_zero _)
rw [eq_div_iff_mul_eq (mul_ne_zero this this)]
rw_mod_cast [← mul_assoc, choose_mul_factorial_mul_factorial h]
#align nat.cast_choose Nat.cast_choose
| Mathlib/Data/Nat/Choose/Cast.lean | 31 | 32 | theorem cast_add_choose {a b : ℕ} : ((a + b).choose a : K) = (a + b)! / (a ! * b !) := by |
rw [cast_choose K (_root_.le_add_right le_rfl), add_tsub_cancel_left]
| [
" ↑(b.choose a) = ↑b ! / (↑a ! * ↑(b - a)!)",
" ↑(b.choose a) * (↑a ! * ↑(b - a)!) = ↑b !",
" ↑((a + b).choose a) = ↑(a + b)! / (↑a ! * ↑b !)"
] | [
" ↑(b.choose a) = ↑b ! / (↑a ! * ↑(b - a)!)",
" ↑(b.choose a) * (↑a ! * ↑(b - a)!) = ↑b !",
" ↑((a + b).choose a) = ↑(a + b)! / (↑a ! * ↑b !)"
] |
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.Topology.NoetherianSpace
#align_import algebraic_geometry.prime_spectrum.noetherian from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
namespace PrimeSpectrum
open Submodule
variable (R : Type u) [CommRing R] [IsNoetherianRing R]
variable {A : Type u} [CommRing A] [IsDomain A] [IsNoetherianRing A]
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean | 27 | 54 | theorem exists_primeSpectrum_prod_le (I : Ideal R) :
∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I := by |
-- Porting note: Need to specify `P` explicitly
refine IsNoetherian.induction
(P := fun I => ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I)
(fun (M : Ideal R) hgt => ?_) I
by_cases h_prM : M.IsPrime
· use {⟨M, h_prM⟩}
rw [Multiset.map_singleton, Multiset.prod_singleton]
by_cases htop : M = ⊤
· rw [htop]
exact ⟨0, le_top⟩
have lt_add : ∀ z ∉ M, M < M + span R {z} := by
intro z hz
refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_
rw [m_eq]
exact Ideal.mem_sup_right (mem_span_singleton_self z)
obtain ⟨x, hx, y, hy, hxy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left htop
obtain ⟨Wx, h_Wx⟩ := hgt (M + span R {x}) (lt_add _ hx)
obtain ⟨Wy, h_Wy⟩ := hgt (M + span R {y}) (lt_add _ hy)
use Wx + Wy
rw [Multiset.map_add, Multiset.prod_add]
apply le_trans (Submodule.mul_le_mul h_Wx h_Wy)
rw [add_mul]
apply sup_le (show M * (M + span R {y}) ≤ M from Ideal.mul_le_right)
rw [mul_add]
apply sup_le (show span R {x} * M ≤ M from Ideal.mul_le_left)
rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem]
| [
" ∃ Z, (Multiset.map asIdeal Z).prod ≤ I",
" (fun I => ∃ Z, (Multiset.map asIdeal Z).prod ≤ I) M",
" (Multiset.map asIdeal {{ asIdeal := M, IsPrime := h_prM }}).prod ≤ M",
" (fun I => ∃ Z, (Multiset.map asIdeal Z).prod ≤ I) ⊤",
" ∀ z ∉ M, M < M + span R {z}",
" M < M + span R {z}",
" z ∈ M",
" z ∈ M +... | [
" ∃ Z, (Multiset.map asIdeal Z).prod ≤ I"
] |
import Mathlib.Algebra.Group.Subgroup.Finite
import Mathlib.Algebra.Group.Subgroup.Pointwise
import Mathlib.GroupTheory.Congruence.Basic
import Mathlib.GroupTheory.Coset
#align_import group_theory.quotient_group from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Function
open scoped Pointwise
universe u v w x
namespace QuotientGroup
variable {G : Type u} [Group G] (N : Subgroup G) [nN : N.Normal] {H : Type v} [Group H]
{M : Type x} [Monoid M]
@[to_additive "The additive congruence relation generated by a normal additive subgroup."]
protected def con : Con G where
toSetoid := leftRel N
mul' := @fun a b c d hab hcd => by
rw [leftRel_eq] at hab hcd ⊢
dsimp only
calc
(a * c)⁻¹ * (b * d) = c⁻¹ * (a⁻¹ * b) * c⁻¹⁻¹ * (c⁻¹ * d) := by
simp only [mul_inv_rev, mul_assoc, inv_mul_cancel_left]
_ ∈ N := N.mul_mem (nN.conj_mem _ hab _) hcd
#align quotient_group.con QuotientGroup.con
#align quotient_add_group.con QuotientAddGroup.con
@[to_additive]
instance Quotient.group : Group (G ⧸ N) :=
(QuotientGroup.con N).group
#align quotient_group.quotient.group QuotientGroup.Quotient.group
#align quotient_add_group.quotient.add_group QuotientAddGroup.Quotient.addGroup
@[to_additive "The additive group homomorphism from `G` to `G/N`."]
def mk' : G →* G ⧸ N :=
MonoidHom.mk' QuotientGroup.mk fun _ _ => rfl
#align quotient_group.mk' QuotientGroup.mk'
#align quotient_add_group.mk' QuotientAddGroup.mk'
@[to_additive (attr := simp)]
theorem coe_mk' : (mk' N : G → G ⧸ N) = mk :=
rfl
#align quotient_group.coe_mk' QuotientGroup.coe_mk'
#align quotient_add_group.coe_mk' QuotientAddGroup.coe_mk'
@[to_additive (attr := simp)]
theorem mk'_apply (x : G) : mk' N x = x :=
rfl
#align quotient_group.mk'_apply QuotientGroup.mk'_apply
#align quotient_add_group.mk'_apply QuotientAddGroup.mk'_apply
@[to_additive]
theorem mk'_surjective : Surjective <| mk' N :=
@mk_surjective _ _ N
#align quotient_group.mk'_surjective QuotientGroup.mk'_surjective
#align quotient_add_group.mk'_surjective QuotientAddGroup.mk'_surjective
@[to_additive]
theorem mk'_eq_mk' {x y : G} : mk' N x = mk' N y ↔ ∃ z ∈ N, x * z = y :=
QuotientGroup.eq'.trans <| by
simp only [← _root_.eq_inv_mul_iff_mul_eq, exists_prop, exists_eq_right]
#align quotient_group.mk'_eq_mk' QuotientGroup.mk'_eq_mk'
#align quotient_add_group.mk'_eq_mk' QuotientAddGroup.mk'_eq_mk'
open scoped Pointwise in
@[to_additive]
theorem sound (U : Set (G ⧸ N)) (g : N.op) :
g • (mk' N) ⁻¹' U = (mk' N) ⁻¹' U := by
ext x
simp only [Set.mem_preimage, Set.mem_smul_set_iff_inv_smul_mem]
congr! 1
exact Quotient.sound ⟨g⁻¹, rfl⟩
@[to_additive (attr := ext 1100) "Two `AddMonoidHom`s from an additive quotient group are equal if
their compositions with `AddQuotientGroup.mk'` are equal.
See note [partially-applied ext lemmas]. "]
theorem monoidHom_ext ⦃f g : G ⧸ N →* M⦄ (h : f.comp (mk' N) = g.comp (mk' N)) : f = g :=
MonoidHom.ext fun x => QuotientGroup.induction_on x <| (DFunLike.congr_fun h : _)
#align quotient_group.monoid_hom_ext QuotientGroup.monoidHom_ext
#align quotient_add_group.add_monoid_hom_ext QuotientAddGroup.addMonoidHom_ext
@[to_additive (attr := simp)]
| Mathlib/GroupTheory/QuotientGroup.lean | 129 | 131 | theorem eq_one_iff {N : Subgroup G} [nN : N.Normal] (x : G) : (x : G ⧸ N) = 1 ↔ x ∈ N := by |
refine QuotientGroup.eq.trans ?_
rw [mul_one, Subgroup.inv_mem_iff]
| [
" Setoid.r (a * c) (b * d)",
" (fun x y => x⁻¹ * y ∈ N) (a * c) (b * d)",
" (a * c)⁻¹ * (b * d) ∈ N",
" (a * c)⁻¹ * (b * d) = c⁻¹ * (a⁻¹ * b) * c⁻¹⁻¹ * (c⁻¹ * d)",
" x⁻¹ * y ∈ N ↔ ∃ z ∈ N, x * z = y",
" g • ⇑(mk' N) ⁻¹' U = ⇑(mk' N) ⁻¹' U",
" x ∈ g • ⇑(mk' N) ⁻¹' U ↔ x ∈ ⇑(mk' N) ⁻¹' U",
" (mk' N) (g⁻... | [
" Setoid.r (a * c) (b * d)",
" (fun x y => x⁻¹ * y ∈ N) (a * c) (b * d)",
" (a * c)⁻¹ * (b * d) ∈ N",
" (a * c)⁻¹ * (b * d) = c⁻¹ * (a⁻¹ * b) * c⁻¹⁻¹ * (c⁻¹ * d)",
" x⁻¹ * y ∈ N ↔ ∃ z ∈ N, x * z = y",
" g • ⇑(mk' N) ⁻¹' U = ⇑(mk' N) ⁻¹' U",
" x ∈ g • ⇑(mk' N) ⁻¹' U ↔ x ∈ ⇑(mk' N) ⁻¹' U",
" (mk' N) (g⁻... |
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section DescFactorial
def descFactorial (n : ℕ) : ℕ → ℕ
| 0 => 1
| k + 1 => (n - k) * descFactorial n k
#align nat.desc_factorial Nat.descFactorial
@[simp]
theorem descFactorial_zero (n : ℕ) : n.descFactorial 0 = 1 :=
rfl
#align nat.desc_factorial_zero Nat.descFactorial_zero
@[simp]
theorem descFactorial_succ (n k : ℕ) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k :=
rfl
#align nat.desc_factorial_succ Nat.descFactorial_succ
| Mathlib/Data/Nat/Factorial/Basic.lean | 340 | 341 | theorem zero_descFactorial_succ (k : ℕ) : (0 : ℕ).descFactorial (k + 1) = 0 := by |
rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul]
| [
" descFactorial 0 (k + 1) = 0"
] | [
" descFactorial 0 (k + 1) = 0"
] |
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
| Mathlib/Data/Real/GoldenRatio.lean | 51 | 53 | theorem inv_goldConj : ψ⁻¹ = -φ := by |
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
| [
" φ⁻¹ = -ψ",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" ψ⁻¹ = -φ",
" -ψ = φ⁻¹"
] | [
" φ⁻¹ = -ψ",
" 0 < 1",
" 0 < 5",
" 2 * 2 = 5 - 1",
" ψ⁻¹ = -φ"
] |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesLeftLE
variable [LE α] [CovariantClass α α (· * ·) (· ≤ ·)] {a b c d : α}
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by
rw [← mul_le_mul_iff_left a]
simp
#align left.inv_le_one_iff Left.inv_le_one_iff
#align left.neg_nonpos_iff Left.neg_nonpos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1 := by
rw [← mul_le_mul_iff_left a]
simp
#align left.one_le_inv_iff Left.one_le_inv_iff
#align left.nonneg_neg_iff Left.nonneg_neg_iff
@[to_additive (attr := simp)]
theorem le_inv_mul_iff_mul_le : b ≤ a⁻¹ * c ↔ a * b ≤ c := by
rw [← mul_le_mul_iff_left a]
simp
#align le_inv_mul_iff_mul_le le_inv_mul_iff_mul_le
#align le_neg_add_iff_add_le le_neg_add_iff_add_le
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 120 | 121 | theorem inv_mul_le_iff_le_mul : b⁻¹ * a ≤ c ↔ a ≤ b * c := by |
rw [← mul_le_mul_iff_left b, mul_inv_cancel_left]
| [
" b ≤ c",
" a⁻¹ ≤ 1 ↔ 1 ≤ a",
" a * a⁻¹ ≤ a * 1 ↔ 1 ≤ a",
" 1 ≤ a⁻¹ ↔ a ≤ 1",
" a * 1 ≤ a * a⁻¹ ↔ a ≤ 1",
" b ≤ a⁻¹ * c ↔ a * b ≤ c",
" a * b ≤ a * (a⁻¹ * c) ↔ a * b ≤ c",
" b⁻¹ * a ≤ c ↔ a ≤ b * c"
] | [
" b ≤ c",
" a⁻¹ ≤ 1 ↔ 1 ≤ a",
" a * a⁻¹ ≤ a * 1 ↔ 1 ≤ a",
" 1 ≤ a⁻¹ ↔ a ≤ 1",
" a * 1 ≤ a * a⁻¹ ↔ a ≤ 1",
" b ≤ a⁻¹ * c ↔ a * b ≤ c",
" a * b ≤ a * (a⁻¹ * c) ↔ a * b ≤ c",
" b⁻¹ * a ≤ c ↔ a ≤ b * c"
] |
import Batteries.Data.Sum.Basic
import Batteries.Logic
open Function
namespace Sum
@[simp] protected theorem «forall» {p : α ⊕ β → Prop} :
(∀ x, p x) ↔ (∀ a, p (inl a)) ∧ ∀ b, p (inr b) :=
⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, h₂⟩ => Sum.rec h₁ h₂⟩
@[simp] protected theorem «exists» {p : α ⊕ β → Prop} :
(∃ x, p x) ↔ (∃ a, p (inl a)) ∨ ∃ b, p (inr b) :=
⟨ fun
| ⟨inl a, h⟩ => Or.inl ⟨a, h⟩
| ⟨inr b, h⟩ => Or.inr ⟨b, h⟩,
fun
| Or.inl ⟨a, h⟩ => ⟨inl a, h⟩
| Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩
theorem forall_sum {γ : α ⊕ β → Sort _} (p : (∀ ab, γ ab) → Prop) :
(∀ fab, p fab) ↔ (∀ fa fb, p (Sum.rec fa fb)) := by
refine ⟨fun h fa fb => h _, fun h fab => ?_⟩
have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by
ext ab; cases ab <;> rfl
rw [h1]; exact h _ _
section get
@[simp] theorem inl_getLeft : ∀ (x : α ⊕ β) (h : x.isLeft), inl (x.getLeft h) = x
| inl _, _ => rfl
@[simp] theorem inr_getRight : ∀ (x : α ⊕ β) (h : x.isRight), inr (x.getRight h) = x
| inr _, _ => rfl
@[simp] theorem getLeft?_eq_none_iff {x : α ⊕ β} : x.getLeft? = none ↔ x.isRight := by
cases x <;> simp only [getLeft?, isRight, eq_self_iff_true]
@[simp] theorem getRight?_eq_none_iff {x : α ⊕ β} : x.getRight? = none ↔ x.isLeft := by
cases x <;> simp only [getRight?, isLeft, eq_self_iff_true]
theorem eq_left_getLeft_of_isLeft : ∀ {x : α ⊕ β} (h : x.isLeft), x = inl (x.getLeft h)
| inl _, _ => rfl
@[simp] theorem getLeft_eq_iff (h : x.isLeft) : x.getLeft h = a ↔ x = inl a := by
cases x <;> simp at h ⊢
theorem eq_right_getRight_of_isRight : ∀ {x : α ⊕ β} (h : x.isRight), x = inr (x.getRight h)
| inr _, _ => rfl
@[simp] theorem getRight_eq_iff (h : x.isRight) : x.getRight h = b ↔ x = inr b := by
cases x <;> simp at h ⊢
@[simp] theorem getLeft?_eq_some_iff : x.getLeft? = some a ↔ x = inl a := by
cases x <;> simp only [getLeft?, Option.some.injEq, inl.injEq]
@[simp] theorem getRight?_eq_some_iff : x.getRight? = some b ↔ x = inr b := by
cases x <;> simp only [getRight?, Option.some.injEq, inr.injEq]
@[simp] theorem bnot_isLeft (x : α ⊕ β) : !x.isLeft = x.isRight := by cases x <;> rfl
@[simp] theorem isLeft_eq_false {x : α ⊕ β} : x.isLeft = false ↔ x.isRight := by cases x <;> simp
theorem not_isLeft {x : α ⊕ β} : ¬x.isLeft ↔ x.isRight := by simp
@[simp] theorem bnot_isRight (x : α ⊕ β) : !x.isRight = x.isLeft := by cases x <;> rfl
@[simp] theorem isRight_eq_false {x : α ⊕ β} : x.isRight = false ↔ x.isLeft := by cases x <;> simp
| .lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean | 81 | 81 | theorem not_isRight {x : α ⊕ β} : ¬x.isRight ↔ x.isLeft := by | simp
| [
" (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t",
" p fab",
" fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t",
" fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab",
" fab (inl val✝) = rec ... | [
" (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t",
" p fab",
" fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t",
" fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab",
" fab (inl val✝) = rec ... |
import Mathlib.Algebra.Lie.Matrix
import Mathlib.LinearAlgebra.Matrix.SesquilinearForm
import Mathlib.Tactic.NoncommRing
#align_import algebra.lie.skew_adjoint from "leanprover-community/mathlib"@"075b3f7d19b9da85a0b54b3e33055a74fc388dec"
universe u v w w₁
section SkewAdjointMatrices
open scoped Matrix
variable {R : Type u} {n : Type w} [CommRing R] [DecidableEq n] [Fintype n]
variable (J : Matrix n n R)
theorem Matrix.lie_transpose (A B : Matrix n n R) : ⁅A, B⁆ᵀ = ⁅Bᵀ, Aᵀ⁆ :=
show (A * B - B * A)ᵀ = Bᵀ * Aᵀ - Aᵀ * Bᵀ by simp
#align matrix.lie_transpose Matrix.lie_transpose
-- Porting note: Changed `(A B)` to `{A B}` for convenience in `skewAdjointMatricesLieSubalgebra`
theorem Matrix.isSkewAdjoint_bracket {A B : Matrix n n R} (hA : A ∈ skewAdjointMatricesSubmodule J)
(hB : B ∈ skewAdjointMatricesSubmodule J) : ⁅A, B⁆ ∈ skewAdjointMatricesSubmodule J := by
simp only [mem_skewAdjointMatricesSubmodule] at *
change ⁅A, B⁆ᵀ * J = J * (-⁅A, B⁆)
change Aᵀ * J = J * (-A) at hA
change Bᵀ * J = J * (-B) at hB
rw [Matrix.lie_transpose, LieRing.of_associative_ring_bracket,
LieRing.of_associative_ring_bracket, sub_mul, mul_assoc, mul_assoc, hA, hB, ← mul_assoc,
← mul_assoc, hA, hB]
noncomm_ring
#align matrix.is_skew_adjoint_bracket Matrix.isSkewAdjoint_bracket
def skewAdjointMatricesLieSubalgebra : LieSubalgebra R (Matrix n n R) :=
{ skewAdjointMatricesSubmodule J with
lie_mem' := J.isSkewAdjoint_bracket }
#align skew_adjoint_matrices_lie_subalgebra skewAdjointMatricesLieSubalgebra
@[simp]
theorem mem_skewAdjointMatricesLieSubalgebra (A : Matrix n n R) :
A ∈ skewAdjointMatricesLieSubalgebra J ↔ A ∈ skewAdjointMatricesSubmodule J :=
Iff.rfl
#align mem_skew_adjoint_matrices_lie_subalgebra mem_skewAdjointMatricesLieSubalgebra
def skewAdjointMatricesLieSubalgebraEquiv (P : Matrix n n R) (h : Invertible P) :
skewAdjointMatricesLieSubalgebra J ≃ₗ⁅R⁆ skewAdjointMatricesLieSubalgebra (Pᵀ * J * P) :=
LieEquiv.ofSubalgebras _ _ (P.lieConj h).symm <| by
ext A
suffices P.lieConj h A ∈ skewAdjointMatricesSubmodule J ↔
A ∈ skewAdjointMatricesSubmodule (Pᵀ * J * P) by
simp only [LieSubalgebra.mem_coe, Submodule.mem_map_equiv, LieSubalgebra.mem_map_submodule,
LinearEquiv.coe_coe]
exact this
simp [Matrix.IsSkewAdjoint, J.isAdjointPair_equiv _ _ P (isUnit_of_invertible P)]
#align skew_adjoint_matrices_lie_subalgebra_equiv skewAdjointMatricesLieSubalgebraEquiv
-- TODO(mathlib4#6607): fix elaboration so annotation on `A` isn't needed
theorem skewAdjointMatricesLieSubalgebraEquiv_apply (P : Matrix n n R) (h : Invertible P)
(A : skewAdjointMatricesLieSubalgebra J) :
↑(skewAdjointMatricesLieSubalgebraEquiv J P h A) = P⁻¹ * (A : Matrix n n R) * P := by
simp [skewAdjointMatricesLieSubalgebraEquiv]
#align skew_adjoint_matrices_lie_subalgebra_equiv_apply skewAdjointMatricesLieSubalgebraEquiv_apply
def skewAdjointMatricesLieSubalgebraEquivTranspose {m : Type w} [DecidableEq m] [Fintype m]
(e : Matrix n n R ≃ₐ[R] Matrix m m R) (h : ∀ A, (e A)ᵀ = e Aᵀ) :
skewAdjointMatricesLieSubalgebra J ≃ₗ⁅R⁆ skewAdjointMatricesLieSubalgebra (e J) :=
LieEquiv.ofSubalgebras _ _ e.toLieEquiv <| by
ext A
suffices J.IsSkewAdjoint (e.symm A) ↔ (e J).IsSkewAdjoint A by
-- Porting note: Originally `simpa [this]`
simpa [- LieSubalgebra.mem_map, LieSubalgebra.mem_map_submodule]
simp only [Matrix.IsSkewAdjoint, Matrix.IsAdjointPair, ← h,
← Function.Injective.eq_iff e.injective, map_mul, AlgEquiv.apply_symm_apply, map_neg]
#align skew_adjoint_matrices_lie_subalgebra_equiv_transpose skewAdjointMatricesLieSubalgebraEquivTranspose
@[simp]
theorem skewAdjointMatricesLieSubalgebraEquivTranspose_apply {m : Type w} [DecidableEq m]
[Fintype m] (e : Matrix n n R ≃ₐ[R] Matrix m m R) (h : ∀ A, (e A)ᵀ = e Aᵀ)
(A : skewAdjointMatricesLieSubalgebra J) :
(skewAdjointMatricesLieSubalgebraEquivTranspose J e h A : Matrix m m R) = e A :=
rfl
#align skew_adjoint_matrices_lie_subalgebra_equiv_transpose_apply skewAdjointMatricesLieSubalgebraEquivTranspose_apply
| Mathlib/Algebra/Lie/SkewAdjoint.lean | 170 | 176 | theorem mem_skewAdjointMatricesLieSubalgebra_unit_smul (u : Rˣ) (J A : Matrix n n R) :
A ∈ skewAdjointMatricesLieSubalgebra (u • J) ↔ A ∈ skewAdjointMatricesLieSubalgebra J := by |
change A ∈ skewAdjointMatricesSubmodule (u • J) ↔ A ∈ skewAdjointMatricesSubmodule J
simp only [mem_skewAdjointMatricesSubmodule, Matrix.IsSkewAdjoint, Matrix.IsAdjointPair]
constructor <;> intro h
· simpa using congr_arg (fun B => u⁻¹ • B) h
· simp [h]
| [
" (A * B - B * A)ᵀ = Bᵀ * Aᵀ - Aᵀ * Bᵀ",
" ⁅A, B⁆ ∈ skewAdjointMatricesSubmodule J",
" J.IsSkewAdjoint ⁅A, B⁆",
" ⁅A, B⁆ᵀ * J = J * -⁅A, B⁆",
" J * -B * -A - J * -A * -B = J * -(A * B - B * A)",
" LieSubalgebra.map (P.lieConj h).symm.toLieHom (skewAdjointMatricesLieSubalgebra J) =\n skewAdjointMatrices... | [
" (A * B - B * A)ᵀ = Bᵀ * Aᵀ - Aᵀ * Bᵀ",
" ⁅A, B⁆ ∈ skewAdjointMatricesSubmodule J",
" J.IsSkewAdjoint ⁅A, B⁆",
" ⁅A, B⁆ᵀ * J = J * -⁅A, B⁆",
" J * -B * -A - J * -A * -B = J * -(A * B - B * A)",
" LieSubalgebra.map (P.lieConj h).symm.toLieHom (skewAdjointMatricesLieSubalgebra J) =\n skewAdjointMatrices... |
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Computability.Primrec
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Linarith
#align_import computability.ackermann from "leanprover-community/mathlib"@"9b2660e1b25419042c8da10bf411aa3c67f14383"
open Nat
def ack : ℕ → ℕ → ℕ
| 0, n => n + 1
| m + 1, 0 => ack m 1
| m + 1, n + 1 => ack m (ack (m + 1) n)
#align ack ack
@[simp]
theorem ack_zero (n : ℕ) : ack 0 n = n + 1 := by rw [ack]
#align ack_zero ack_zero
@[simp]
| Mathlib/Computability/Ackermann.lean | 74 | 74 | theorem ack_succ_zero (m : ℕ) : ack (m + 1) 0 = ack m 1 := by | rw [ack]
| [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1"
] | [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1"
] |
import Mathlib.Algebra.Group.Prod
import Mathlib.Order.Cover
#align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
assert_not_exists MonoidWithZero
open Set
namespace Function
variable {α β A B M N P G : Type*}
section One
variable [One M] [One N] [One P]
@[to_additive "`support` of a function is the set of points `x` such that `f x ≠ 0`."]
def mulSupport (f : α → M) : Set α := {x | f x ≠ 1}
#align function.mul_support Function.mulSupport
#align function.support Function.support
@[to_additive]
theorem mulSupport_eq_preimage (f : α → M) : mulSupport f = f ⁻¹' {1}ᶜ :=
rfl
#align function.mul_support_eq_preimage Function.mulSupport_eq_preimage
#align function.support_eq_preimage Function.support_eq_preimage
@[to_additive]
theorem nmem_mulSupport {f : α → M} {x : α} : x ∉ mulSupport f ↔ f x = 1 :=
not_not
#align function.nmem_mul_support Function.nmem_mulSupport
#align function.nmem_support Function.nmem_support
@[to_additive]
theorem compl_mulSupport {f : α → M} : (mulSupport f)ᶜ = { x | f x = 1 } :=
ext fun _ => nmem_mulSupport
#align function.compl_mul_support Function.compl_mulSupport
#align function.compl_support Function.compl_support
@[to_additive (attr := simp)]
theorem mem_mulSupport {f : α → M} {x : α} : x ∈ mulSupport f ↔ f x ≠ 1 :=
Iff.rfl
#align function.mem_mul_support Function.mem_mulSupport
#align function.mem_support Function.mem_support
@[to_additive (attr := simp)]
theorem mulSupport_subset_iff {f : α → M} {s : Set α} : mulSupport f ⊆ s ↔ ∀ x, f x ≠ 1 → x ∈ s :=
Iff.rfl
#align function.mul_support_subset_iff Function.mulSupport_subset_iff
#align function.support_subset_iff Function.support_subset_iff
@[to_additive]
theorem mulSupport_subset_iff' {f : α → M} {s : Set α} :
mulSupport f ⊆ s ↔ ∀ x ∉ s, f x = 1 :=
forall_congr' fun _ => not_imp_comm
#align function.mul_support_subset_iff' Function.mulSupport_subset_iff'
#align function.support_subset_iff' Function.support_subset_iff'
@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1 := by
simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def,
not_imp_comm, and_comm, forall_and]
#align function.mul_support_eq_iff Function.mulSupport_eq_iff
#align function.support_eq_iff Function.support_eq_iff
@[to_additive]
theorem ext_iff_mulSupport {f g : α → M} :
f = g ↔ f.mulSupport = g.mulSupport ∧ ∀ x ∈ f.mulSupport, f x = g x :=
⟨fun h ↦ h ▸ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, h₂⟩ ↦ funext fun x ↦ by
if hx : x ∈ f.mulSupport then exact h₂ x hx
else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩
@[to_additive]
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
mulSupport (update f x y) = insert x (mulSupport f) := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
theorem mulSupport_update_one [DecidableEq α] (f : α → M) (x : α) :
mulSupport (update f x 1) = mulSupport f \ {x} := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
| Mathlib/Algebra/Group/Support.lean | 98 | 100 | theorem mulSupport_update_eq_ite [DecidableEq α] [DecidableEq M] (f : α → M) (x : α) (y : M) :
mulSupport (update f x y) = if y = 1 then mulSupport f \ {x} else insert x (mulSupport f) := by |
rcases eq_or_ne y 1 with rfl | hy <;> simp [mulSupport_update_one, mulSupport_update_of_ne_one, *]
| [
" mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a ∈ mulSupport (update f x y) ↔ a ∈ insert x (mulSupport f)",
" a ∈ mulSupport (update f a y) ↔ a ∈ insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... | [
" mulSupport f = s ↔ (∀ x ∈ s, f x ≠ 1) ∧ ∀ x ∉ s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a ∈ mulSupport (update f x y) ↔ a ∈ insert x (mulSupport f)",
" a ∈ mulSupport (update f a y) ↔ a ∈ insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... |
import Mathlib.Analysis.SpecialFunctions.Complex.Log
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
namespace Complex
open Polynomial Real
open scoped Nat Real
theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) :
IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by
rw [IsPrimitiveRoot.iff_def]
simp only [← exp_nat_mul, exp_eq_one_iff]
have hn0 : (n : ℂ) ≠ 0 := mod_cast h0
constructor
· use i
field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)]
· simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff,
mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps]
norm_cast
rintro l k hk
conv_rhs at hk => rw [mul_comm, ← mul_assoc]
have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero]
field_simp [hz] at hk
norm_cast at hk
have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left
exact hi.symm.dvd_of_dvd_mul_left this
#align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
simpa only [Nat.cast_one, one_div] using
isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left
#align complex.is_primitive_root_exp Complex.isPrimitiveRoot_exp
| Mathlib/RingTheory/RootsOfUnity/Complex.lean | 58 | 69 | theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) :
IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ := by |
have hn0 : (n : ℂ) ≠ 0 := mod_cast hn
constructor; swap
· rintro ⟨i, -, hi, rfl⟩; exact isPrimitiveRoot_exp_of_coprime i n hn hi
intro h
obtain ⟨i, hi, rfl⟩ :=
(isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one (Nat.pos_of_ne_zero hn)
refine ⟨i, hi, ((isPrimitiveRoot_exp n hn).pow_iff_coprime (Nat.pos_of_ne_zero hn) i).mp h, ?_⟩
rw [← exp_nat_mul]
congr 1
field_simp [hn0, mul_comm (i : ℂ)]
| [
" IsPrimitiveRoot (cexp (2 * ↑π * I * (↑i / ↑n))) n",
" cexp (2 * ↑π * I * (↑i / ↑n)) ^ n = 1 ∧ ∀ (l : ℕ), cexp (2 * ↑π * I * (↑i / ↑n)) ^ l = 1 → n ∣ l",
" (∃ n_1, ↑n * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) ∧\n ∀ (l : ℕ), (∃ n_1, ↑l * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) → n ∣ l",
" ∃... | [
" IsPrimitiveRoot (cexp (2 * ↑π * I * (↑i / ↑n))) n",
" cexp (2 * ↑π * I * (↑i / ↑n)) ^ n = 1 ∧ ∀ (l : ℕ), cexp (2 * ↑π * I * (↑i / ↑n)) ^ l = 1 → n ∣ l",
" (∃ n_1, ↑n * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) ∧\n ∀ (l : ℕ), (∃ n_1, ↑l * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) → n ∣ l",
" ∃... |
import Mathlib.Algebra.Order.Ring.Int
#align_import data.int.least_greatest from "leanprover-community/mathlib"@"3342d1b2178381196f818146ff79bc0e7ccd9e2d"
namespace Int
def leastOfBdd {P : ℤ → Prop} [DecidablePred P] (b : ℤ) (Hb : ∀ z : ℤ, P z → b ≤ z)
(Hinh : ∃ z : ℤ, P z) : { lb : ℤ // P lb ∧ ∀ z : ℤ, P z → lb ≤ z } :=
have EX : ∃ n : ℕ, P (b + n) :=
let ⟨elt, Helt⟩ := Hinh
match elt, le.dest (Hb _ Helt), Helt with
| _, ⟨n, rfl⟩, Hn => ⟨n, Hn⟩
⟨b + (Nat.find EX : ℤ), Nat.find_spec EX, fun z h =>
match z, le.dest (Hb _ h), h with
| _, ⟨_, rfl⟩, h => add_le_add_left (Int.ofNat_le.2 <| Nat.find_min' _ h) _⟩
#align int.least_of_bdd Int.leastOfBdd
theorem exists_least_of_bdd
{P : ℤ → Prop}
(Hbdd : ∃ b : ℤ , ∀ z : ℤ , P z → b ≤ z)
(Hinh : ∃ z : ℤ , P z) : ∃ lb : ℤ , P lb ∧ ∀ z : ℤ , P z → lb ≤ z := by
classical
let ⟨b , Hb⟩ := Hbdd
let ⟨lb , H⟩ := leastOfBdd b Hb Hinh
exact ⟨lb , H⟩
#align int.exists_least_of_bdd Int.exists_least_of_bdd
| Mathlib/Data/Int/LeastGreatest.lean | 71 | 76 | theorem coe_leastOfBdd_eq {P : ℤ → Prop} [DecidablePred P] {b b' : ℤ} (Hb : ∀ z : ℤ, P z → b ≤ z)
(Hb' : ∀ z : ℤ, P z → b' ≤ z) (Hinh : ∃ z : ℤ, P z) :
(leastOfBdd b Hb Hinh : ℤ) = leastOfBdd b' Hb' Hinh := by |
rcases leastOfBdd b Hb Hinh with ⟨n, hn, h2n⟩
rcases leastOfBdd b' Hb' Hinh with ⟨n', hn', h2n'⟩
exact le_antisymm (h2n _ hn') (h2n' _ hn)
| [
" ∃ lb, P lb ∧ ∀ (z : ℤ), P z → lb ≤ z",
" ↑(b.leastOfBdd Hb Hinh) = ↑(b'.leastOfBdd Hb' Hinh)",
" ↑⟨n, ⋯⟩ = ↑(b'.leastOfBdd Hb' Hinh)",
" ↑⟨n, ⋯⟩ = ↑⟨n', ⋯⟩"
] | [
" ∃ lb, P lb ∧ ∀ (z : ℤ), P z → lb ≤ z",
" ↑(b.leastOfBdd Hb Hinh) = ↑(b'.leastOfBdd Hb' Hinh)"
] |
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
variable [TopologicalSpace α] [SecondCountableTopology α]
namespace MeasureTheory
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 58 | 62 | theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)]
(hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g)
(hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by |
refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
| [
" IntegrableAtFilter f l μ",
" ∀ᵐ (a : α) ∂μ.restrict s, ‖f a‖ ≤ ‖C * ‖g a‖‖",
" ‖f x‖ ≤ ‖C * ‖g x‖‖",
" Integrable f μ",
" IntegrableAtFilter f ⊤ μ",
" StronglyMeasurableAtFilter f (cocompact α) μ"
] | [
" IntegrableAtFilter f l μ",
" ∀ᵐ (a : α) ∂μ.restrict s, ‖f a‖ ≤ ‖C * ‖g a‖‖",
" ‖f x‖ ≤ ‖C * ‖g x‖‖",
" Integrable f μ",
" IntegrableAtFilter f ⊤ μ"
] |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
set_option linter.uppercaseLean3 false
noncomputable section
open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter
open scoped NNReal ENNReal MeasureTheory
namespace MeasureTheory
section
variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F]
theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by
simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top
#align measure_theory.mem_ℒp.integrable_sq MeasureTheory.Memℒp.integrable_sq
theorem memℒp_two_iff_integrable_sq_norm {f : α → F} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ := by
rw [← memℒp_one_iff_integrable]
convert (memℒp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm
· simp
· rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top]
#align measure_theory.mem_ℒp_two_iff_integrable_sq_norm MeasureTheory.memℒp_two_iff_integrable_sq_norm
theorem memℒp_two_iff_integrable_sq {f : α → ℝ} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ := by
convert memℒp_two_iff_integrable_sq_norm hf using 3
simp
#align measure_theory.mem_ℒp_two_iff_integrable_sq MeasureTheory.memℒp_two_iff_integrable_sq
end
namespace L2
variable {α E F 𝕜 : Type*} [RCLike 𝕜] [MeasurableSpace α] {μ : Measure α} [NormedAddCommGroup E]
[InnerProductSpace 𝕜 E] [NormedAddCommGroup F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
theorem snorm_rpow_two_norm_lt_top (f : Lp F 2 μ) : snorm (fun x => ‖f x‖ ^ (2 : ℝ)) 1 μ < ∞ := by
have h_two : ENNReal.ofReal (2 : ℝ) = 2 := by simp [zero_le_one]
rw [snorm_norm_rpow f zero_lt_two, one_mul, h_two]
exact ENNReal.rpow_lt_top_of_nonneg zero_le_two (Lp.snorm_ne_top f)
#align measure_theory.L2.snorm_rpow_two_norm_lt_top MeasureTheory.L2.snorm_rpow_two_norm_lt_top
| Mathlib/MeasureTheory/Function/L2Space.lean | 124 | 140 | theorem snorm_inner_lt_top (f g : α →₂[μ] E) : snorm (fun x : α => ⟪f x, g x⟫) 1 μ < ∞ := by |
have h : ∀ x, ‖⟪f x, g x⟫‖ ≤ ‖‖f x‖ ^ (2 : ℝ) + ‖g x‖ ^ (2 : ℝ)‖ := by
intro x
rw [← @Nat.cast_two ℝ, Real.rpow_natCast, Real.rpow_natCast]
calc
‖⟪f x, g x⟫‖ ≤ ‖f x‖ * ‖g x‖ := norm_inner_le_norm _ _
_ ≤ 2 * ‖f x‖ * ‖g x‖ :=
(mul_le_mul_of_nonneg_right (le_mul_of_one_le_left (norm_nonneg _) one_le_two)
(norm_nonneg _))
-- TODO(kmill): the type ascription is getting around an elaboration error
_ ≤ ‖(‖f x‖ ^ 2 + ‖g x‖ ^ 2 : ℝ)‖ := (two_mul_le_add_sq _ _).trans (le_abs_self _)
refine (snorm_mono_ae (ae_of_all _ h)).trans_lt ((snorm_add_le ?_ ?_ le_rfl).trans_lt ?_)
· exact ((Lp.aestronglyMeasurable f).norm.aemeasurable.pow_const _).aestronglyMeasurable
· exact ((Lp.aestronglyMeasurable g).norm.aemeasurable.pow_const _).aestronglyMeasurable
rw [ENNReal.add_lt_top]
exact ⟨snorm_rpow_two_norm_lt_top f, snorm_rpow_two_norm_lt_top g⟩
| [
" Integrable (fun x => f x ^ 2) μ",
" Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ",
" Memℒp f 2 μ ↔ Memℒp (fun x => ‖f x‖ ^ 2) 1 μ",
" ‖f x✝‖ ^ 2 = ‖f x✝‖ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ",
" f x✝ ^ 2 = ‖f x✝‖ ^ 2",
" snorm (fun x => ‖↑↑f x‖ ^ 2) 1... | [
" Integrable (fun x => f x ^ 2) μ",
" Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ",
" Memℒp f 2 μ ↔ Memℒp (fun x => ‖f x‖ ^ 2) 1 μ",
" ‖f x✝‖ ^ 2 = ‖f x✝‖ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ",
" f x✝ ^ 2 = ‖f x✝‖ ^ 2",
" snorm (fun x => ‖↑↑f x‖ ^ 2) 1... |
import Mathlib.MeasureTheory.OuterMeasure.Caratheodory
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
open OuterMeasure
section Extend
variable {α : Type*} {P : α → Prop}
variable (m : ∀ s : α, P s → ℝ≥0∞)
def extend (s : α) : ℝ≥0∞ :=
⨅ h : P s, m s h
#align measure_theory.extend MeasureTheory.extend
theorem extend_eq {s : α} (h : P s) : extend m s = m s h := by simp [extend, h]
#align measure_theory.extend_eq MeasureTheory.extend_eq
theorem extend_eq_top {s : α} (h : ¬P s) : extend m s = ∞ := by simp [extend, h]
#align measure_theory.extend_eq_top MeasureTheory.extend_eq_top
| Mathlib/MeasureTheory/OuterMeasure/Induced.lean | 55 | 62 | theorem smul_extend {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
[NoZeroSMulDivisors R ℝ≥0∞] {c : R} (hc : c ≠ 0) :
c • extend m = extend fun s h => c • m s h := by |
ext1 s
dsimp [extend]
by_cases h : P s
· simp [h]
· simp [h, ENNReal.smul_top, hc]
| [
" extend m s = m s h",
" extend m s = ⊤",
" c • extend m = extend fun s h => c • m s h",
" (c • extend m) s = extend (fun s h => c • m s h) s",
" c • ⨅ (h : P s), m s h = ⨅ (h : P s), c • m s h"
] | [
" extend m s = m s h",
" extend m s = ⊤",
" c • extend m = extend fun s h => c • m s h"
] |
import Mathlib.GroupTheory.GroupAction.Prod
import Mathlib.Algebra.Ring.Int
import Mathlib.Data.Nat.Cast.Basic
assert_not_exists DenselyOrdered
variable {M : Type*}
class NatPowAssoc (M : Type*) [MulOneClass M] [Pow M ℕ] : Prop where
protected npow_add : ∀ (k n: ℕ) (x : M), x ^ (k + n) = x ^ k * x ^ n
protected npow_zero : ∀ (x : M), x ^ 0 = 1
protected npow_one : ∀ (x : M), x ^ 1 = x
section MulOneClass
variable [MulOneClass M] [Pow M ℕ] [NatPowAssoc M]
theorem npow_add (k n : ℕ) (x : M) : x ^ (k + n) = x ^ k * x ^ n :=
NatPowAssoc.npow_add k n x
@[simp]
theorem npow_zero (x : M) : x ^ 0 = 1 :=
NatPowAssoc.npow_zero x
@[simp]
theorem npow_one (x : M) : x ^ 1 = x :=
NatPowAssoc.npow_one x
theorem npow_mul_assoc (k m n : ℕ) (x : M) :
(x ^ k * x ^ m) * x ^ n = x ^ k * (x ^ m * x ^ n) := by
simp only [← npow_add, add_assoc]
theorem npow_mul_comm (m n : ℕ) (x : M) :
x ^ m * x ^ n = x ^ n * x ^ m := by simp only [← npow_add, add_comm]
theorem npow_mul (x : M) (m n : ℕ) : x ^ (m * n) = (x ^ m) ^ n := by
induction n with
| zero => rw [npow_zero, Nat.mul_zero, npow_zero]
| succ n ih => rw [mul_add, npow_add, ih, mul_one, npow_add, npow_one]
| Mathlib/Algebra/Group/NatPowAssoc.lean | 77 | 79 | theorem npow_mul' (x : M) (m n : ℕ) : x ^ (m * n) = (x ^ n) ^ m := by |
rw [mul_comm]
exact npow_mul x n m
| [
" x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)",
" x ^ m * x ^ n = x ^ n * x ^ m",
" x ^ (m * n) = (x ^ m) ^ n",
" x ^ (m * 0) = (x ^ m) ^ 0",
" x ^ (m * (n + 1)) = (x ^ m) ^ (n + 1)",
" x ^ (m * n) = (x ^ n) ^ m",
" x ^ (n * m) = (x ^ n) ^ m"
] | [
" x ^ k * x ^ m * x ^ n = x ^ k * (x ^ m * x ^ n)",
" x ^ m * x ^ n = x ^ n * x ^ m",
" x ^ (m * n) = (x ^ m) ^ n",
" x ^ (m * 0) = (x ^ m) ^ 0",
" x ^ (m * (n + 1)) = (x ^ m) ^ (n + 1)",
" x ^ (m * n) = (x ^ n) ^ m"
] |
import Mathlib.Algebra.MvPolynomial.Rename
#align_import data.mv_polynomial.comap from "leanprover-community/mathlib"@"aba31c938d3243cc671be7091b28a1e0814647ee"
namespace MvPolynomial
variable {σ : Type*} {τ : Type*} {υ : Type*} {R : Type*} [CommSemiring R]
noncomputable def comap (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) : (τ → R) → σ → R :=
fun x i => aeval x (f (X i))
#align mv_polynomial.comap MvPolynomial.comap
@[simp]
theorem comap_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) (x : τ → R) (i : σ) :
comap f x i = aeval x (f (X i)) :=
rfl
#align mv_polynomial.comap_apply MvPolynomial.comap_apply
@[simp]
theorem comap_id_apply (x : σ → R) : comap (AlgHom.id R (MvPolynomial σ R)) x = x := by
funext i
simp only [comap, AlgHom.id_apply, id, aeval_X]
#align mv_polynomial.comap_id_apply MvPolynomial.comap_id_apply
variable (σ R)
theorem comap_id : comap (AlgHom.id R (MvPolynomial σ R)) = id := by
funext x
exact comap_id_apply x
#align mv_polynomial.comap_id MvPolynomial.comap_id
variable {σ R}
theorem comap_comp_apply (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R)
(g : MvPolynomial τ R →ₐ[R] MvPolynomial υ R) (x : υ → R) :
comap (g.comp f) x = comap f (comap g x) := by
funext i
trans aeval x (aeval (fun i => g (X i)) (f (X i)))
· apply eval₂Hom_congr rfl rfl
rw [AlgHom.comp_apply]
suffices g = aeval fun i => g (X i) by rw [← this]
exact aeval_unique g
· simp only [comap, aeval_eq_eval₂Hom, map_eval₂Hom, AlgHom.comp_apply]
refine eval₂Hom_congr ?_ rfl rfl
ext r
apply aeval_C
#align mv_polynomial.comap_comp_apply MvPolynomial.comap_comp_apply
| Mathlib/Algebra/MvPolynomial/Comap.lean | 77 | 80 | theorem comap_comp (f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R)
(g : MvPolynomial τ R →ₐ[R] MvPolynomial υ R) : comap (g.comp f) = comap f ∘ comap g := by |
funext x
exact comap_comp_apply _ _ _
| [
" comap (AlgHom.id R (MvPolynomial σ R)) x = x",
" comap (AlgHom.id R (MvPolynomial σ R)) x i = x i",
" comap (AlgHom.id R (MvPolynomial σ R)) = id",
" comap (AlgHom.id R (MvPolynomial σ R)) x = id x",
" comap (g.comp f) x = comap f (comap g x)",
" comap (g.comp f) x i = comap f (comap g x) i",
" comap ... | [
" comap (AlgHom.id R (MvPolynomial σ R)) x = x",
" comap (AlgHom.id R (MvPolynomial σ R)) x i = x i",
" comap (AlgHom.id R (MvPolynomial σ R)) = id",
" comap (AlgHom.id R (MvPolynomial σ R)) x = id x",
" comap (g.comp f) x = comap f (comap g x)",
" comap (g.comp f) x i = comap f (comap g x) i",
" comap ... |
import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.NonUnitalNonAssocAlgebra
import Mathlib.Algebra.Lie.UniversalEnveloping
import Mathlib.GroupTheory.GroupAction.Ring
#align_import algebra.lie.free from "leanprover-community/mathlib"@"841ac1a3d9162bf51c6327812ecb6e5e71883ac4"
universe u v w
noncomputable section
variable (R : Type u) (X : Type v) [CommRing R]
local notation "lib" => FreeNonUnitalNonAssocAlgebra
local notation "lib.lift" => FreeNonUnitalNonAssocAlgebra.lift
local notation "lib.of" => FreeNonUnitalNonAssocAlgebra.of
local notation "lib.lift_of_apply" => FreeNonUnitalNonAssocAlgebra.lift_of_apply
local notation "lib.lift_comp_of" => FreeNonUnitalNonAssocAlgebra.lift_comp_of
namespace FreeLieAlgebra
inductive Rel : lib R X → lib R X → Prop
| lie_self (a : lib R X) : Rel (a * a) 0
| leibniz_lie (a b c : lib R X) : Rel (a * (b * c)) (a * b * c + b * (a * c))
| smul (t : R) {a b : lib R X} : Rel a b → Rel (t • a) (t • b)
| add_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a + c) (b + c)
| mul_left (a : lib R X) {b c : lib R X} : Rel b c → Rel (a * b) (a * c)
| mul_right {a b : lib R X} (c : lib R X) : Rel a b → Rel (a * c) (b * c)
#align free_lie_algebra.rel FreeLieAlgebra.Rel
variable {R X}
theorem Rel.addLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a + b) (a + c) := by
rw [add_comm _ b, add_comm _ c]; exact h.add_right _
#align free_lie_algebra.rel.add_left FreeLieAlgebra.Rel.addLeft
theorem Rel.neg {a b : lib R X} (h : Rel R X a b) : Rel R X (-a) (-b) := by
simpa only [neg_one_smul] using h.smul (-1)
#align free_lie_algebra.rel.neg FreeLieAlgebra.Rel.neg
theorem Rel.subLeft (a : lib R X) {b c : lib R X} (h : Rel R X b c) : Rel R X (a - b) (a - c) := by
simpa only [sub_eq_add_neg] using h.neg.addLeft a
#align free_lie_algebra.rel.sub_left FreeLieAlgebra.Rel.subLeft
| Mathlib/Algebra/Lie/Free.lean | 99 | 100 | theorem Rel.subRight {a b : lib R X} (c : lib R X) (h : Rel R X a b) : Rel R X (a - c) (b - c) := by |
simpa only [sub_eq_add_neg] using h.add_right (-c)
| [
" Rel R X (a + b) (a + c)",
" Rel R X (b + a) (c + a)",
" Rel R X (-a) (-b)",
" Rel R X (a - b) (a - c)",
" Rel R X (a - c) (b - c)"
] | [
" Rel R X (a + b) (a + c)",
" Rel R X (b + a) (c + a)",
" Rel R X (-a) (-b)",
" Rel R X (a - b) (a - c)",
" Rel R X (a - c) (b - c)"
] |
import Batteries.Data.Fin.Basic
namespace Fin
attribute [norm_cast] val_last
protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x :=
Fin.ext_iff.trans Nat.le_antisymm_iff
protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y :=
Fin.le_antisymm_iff.2 ⟨h1, h2⟩
@[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl
@[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn ..
@[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go]
@[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ :=
Array.getElem_ofFn ..
@[simp] theorem length_list (n) : (list n).length = n := by simp [list]
@[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by
cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk]
@[simp] theorem list_zero : list 0 = [] := by simp [list]
theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by
apply List.ext_get; simp; intro i; cases i <;> simp
theorem list_succ_last (n) : list (n+1) = (list n).map castSucc ++ [last n] := by
rw [list_succ]
induction n with
| zero => rfl
| succ n ih =>
rw [list_succ, List.map_cons castSucc, ih]
simp [Function.comp_def, succ_castSucc]
| .lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean | 49 | 55 | theorem list_reverse (n) : (list n).reverse = (list n).map rev := by |
induction n with
| zero => rfl
| succ n ih =>
conv => lhs; rw [list_succ_last]
conv => rhs; rw [list_succ]
simp [List.reverse_map, ih, Function.comp_def, rev_succ]
| [
" enum 0 = #[]",
" (list n).length = n",
" (list n).get i = cast ⋯ i",
" (list n).get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" (enum n).data.get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" list 0 = []",
" list (n + 1) = 0 :: List.map succ (list n)",
" ∀ (n_1 : Nat) (h₁ : n_1 < (list (n + 1)).length) (h₂ ... | [
" enum 0 = #[]",
" (list n).length = n",
" (list n).get i = cast ⋯ i",
" (list n).get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" (enum n).data.get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" list 0 = []",
" list (n + 1) = 0 :: List.map succ (list n)",
" ∀ (n_1 : Nat) (h₁ : n_1 < (list (n + 1)).length) (h₂ ... |
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.Aut
import Mathlib.Data.ZMod.Defs
import Mathlib.Tactic.Ring
#align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
open MulOpposite
universe u v
class Shelf (α : Type u) where
act : α → α → α
self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z)
#align shelf Shelf
class UnitalShelf (α : Type u) extends Shelf α, One α :=
(one_act : ∀ a : α, act 1 a = a)
(act_one : ∀ a : α, act a 1 = a)
#align unital_shelf UnitalShelf
@[ext]
structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where
toFun : S₁ → S₂
map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y)
#align shelf_hom ShelfHom
#align shelf_hom.ext_iff ShelfHom.ext_iff
#align shelf_hom.ext ShelfHom.ext
class Rack (α : Type u) extends Shelf α where
invAct : α → α → α
left_inv : ∀ x, Function.LeftInverse (invAct x) (act x)
right_inv : ∀ x, Function.RightInverse (invAct x) (act x)
#align rack Rack
scoped[Quandles] infixr:65 " ◃ " => Shelf.act
scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct
scoped[Quandles] infixr:25 " →◃ " => ShelfHom
open Quandles
namespace Rack
variable {R : Type*} [Rack R]
-- Porting note: No longer a need for `Rack.self_distrib`
export Shelf (self_distrib)
-- porting note, changed name to `act'` to not conflict with `Shelf.act`
def act' (x : R) : R ≃ R where
toFun := Shelf.act x
invFun := invAct x
left_inv := left_inv x
right_inv := right_inv x
#align rack.act Rack.act'
@[simp]
theorem act'_apply (x y : R) : act' x y = x ◃ y :=
rfl
#align rack.act_apply Rack.act'_apply
@[simp]
theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y :=
rfl
#align rack.act_symm_apply Rack.act'_symm_apply
@[simp]
theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y :=
rfl
#align rack.inv_act_apply Rack.invAct_apply
@[simp]
theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y :=
left_inv x y
#align rack.inv_act_act_eq Rack.invAct_act_eq
@[simp]
theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y :=
right_inv x y
#align rack.act_inv_act_eq Rack.act_invAct_eq
theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by
constructor
· apply (act' x).injective
rintro rfl
rfl
#align rack.left_cancel Rack.left_cancel
theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by
constructor
· apply (act' x).symm.injective
rintro rfl
rfl
#align rack.left_cancel_inv Rack.left_cancel_inv
theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by
rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib]
repeat' rw [right_inv]
#align rack.self_distrib_inv Rack.self_distrib_inv
theorem ad_conj {R : Type*} [Rack R] (x y : R) : act' (x ◃ y) = act' x * act' y * (act' x)⁻¹ := by
rw [eq_mul_inv_iff_mul_eq]; ext z
apply self_distrib.symm
#align rack.ad_conj Rack.ad_conj
instance oppositeRack : Rack Rᵐᵒᵖ where
act x y := op (invAct (unop x) (unop y))
self_distrib := by
intro x y z
induction x using MulOpposite.rec'
induction y using MulOpposite.rec'
induction z using MulOpposite.rec'
simp only [op_inj, unop_op, op_unop]
rw [self_distrib_inv]
invAct x y := op (Shelf.act (unop x) (unop y))
left_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp
right_inv := MulOpposite.rec' fun x => MulOpposite.rec' fun y => by simp
#align rack.opposite_rack Rack.oppositeRack
@[simp]
theorem op_act_op_eq {x y : R} : op x ◃ op y = op (x ◃⁻¹ y) :=
rfl
#align rack.op_act_op_eq Rack.op_act_op_eq
@[simp]
theorem op_invAct_op_eq {x y : R} : op x ◃⁻¹ op y = op (x ◃ y) :=
rfl
#align rack.op_inv_act_op_eq Rack.op_invAct_op_eq
@[simp]
| Mathlib/Algebra/Quandle.lean | 283 | 283 | theorem self_act_act_eq {x y : R} : (x ◃ x) ◃ y = x ◃ y := by | rw [← right_inv x y, ← self_distrib]
| [
" x ◃ y = x ◃ y' ↔ y = y'",
" x ◃ y = x ◃ y' → y = y'",
" y = y' → x ◃ y = x ◃ y'",
" x ◃ y = x ◃ y",
" x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'",
" x ◃⁻¹ y = x ◃⁻¹ y' → y = y'",
" y = y' → x ◃⁻¹ y = x ◃⁻¹ y'",
" x ◃⁻¹ y = x ◃⁻¹ y",
" x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z",
" (x ◃ x ◃⁻¹ y) ◃ x ◃ x ◃⁻¹ y ◃⁻¹ z ... | [
" x ◃ y = x ◃ y' ↔ y = y'",
" x ◃ y = x ◃ y' → y = y'",
" y = y' → x ◃ y = x ◃ y'",
" x ◃ y = x ◃ y",
" x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'",
" x ◃⁻¹ y = x ◃⁻¹ y' → y = y'",
" y = y' → x ◃⁻¹ y = x ◃⁻¹ y'",
" x ◃⁻¹ y = x ◃⁻¹ y",
" x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z",
" (x ◃ x ◃⁻¹ y) ◃ x ◃ x ◃⁻¹ y ◃⁻¹ z ... |
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {R₁ : Type*} [CommRing R₁] [IsDomain R₁] [Algebra R₁ K] [IsFractionRing R₁ K]
variable {I J : FractionalIdeal R₁⁰ K}
noncomputable instance : Inv (FractionalIdeal R₁⁰ K) := ⟨fun I => 1 / I⟩
theorem inv_eq : I⁻¹ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal R₁⁰ K)⁻¹ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal R₁⁰ K} (h : J ≠ 0) :
J⁻¹ = ⟨(1 : FractionalIdeal R₁⁰ K) / J, fractional_div_of_nonzero h⟩ := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal R₁⁰ K} (h : J ≠ 0) :
(↑J⁻¹ : Submodule R₁ K) = IsLocalization.coeSubmodule K ⊤ / (J : Submodule R₁ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I ≠ 0) {x : K} : x ∈ I⁻¹ ↔ ∀ y ∈ I, x * y ∈ (1 : FractionalIdeal R₁⁰ K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
theorem inv_anti_mono (hI : I ≠ 0) (hJ : J ≠ 0) (hIJ : I ≤ J) : J⁻¹ ≤ I⁻¹ := by
-- Porting note: in Lean3, introducing `x` would just give `x ∈ J⁻¹ → x ∈ I⁻¹`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
#align fractional_ideal.inv_anti_mono FractionalIdeal.inv_anti_mono
theorem le_self_mul_inv {I : FractionalIdeal R₁⁰ K} (hI : I ≤ (1 : FractionalIdeal R₁⁰ K)) :
I ≤ I * I⁻¹ :=
le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_inv FractionalIdeal.le_self_mul_inv
variable (K)
theorem coe_ideal_le_self_mul_inv (I : Ideal R₁) :
(I : FractionalIdeal R₁⁰ K) ≤ I * (I : FractionalIdeal R₁⁰ K)⁻¹ :=
le_self_mul_inv coeIdeal_le_one
#align fractional_ideal.coe_ideal_le_self_mul_inv FractionalIdeal.coe_ideal_le_self_mul_inv
theorem right_inverse_eq (I J : FractionalIdeal R₁⁰ K) (h : I * J = 1) : J = I⁻¹ := by
have hI : I ≠ 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1 from
congr_arg Units.inv <| @Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [← h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.right_inverse_eq FractionalIdeal.right_inverse_eq
theorem mul_inv_cancel_iff {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ ∃ J, I * J = 1 :=
⟨fun h => ⟨I⁻¹, h⟩, fun ⟨J, hJ⟩ => by rwa [← right_inverse_eq K I J hJ]⟩
#align fractional_ideal.mul_inv_cancel_iff FractionalIdeal.mul_inv_cancel_iff
theorem mul_inv_cancel_iff_isUnit {I : FractionalIdeal R₁⁰ K} : I * I⁻¹ = 1 ↔ IsUnit I :=
(mul_inv_cancel_iff K).trans isUnit_iff_exists_inv.symm
#align fractional_ideal.mul_inv_cancel_iff_is_unit FractionalIdeal.mul_inv_cancel_iff_isUnit
variable {K' : Type*} [Field K'] [Algebra R₁ K'] [IsFractionRing R₁ K']
@[simp]
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 136 | 137 | theorem map_inv (I : FractionalIdeal R₁⁰ K) (h : K ≃ₐ[R₁] K') :
I⁻¹.map (h : K →ₐ[R₁] K') = (I.map h)⁻¹ := by | rw [inv_eq, map_div, map_one, inv_eq]
| [
" ↑J⁻¹ = IsLocalization.coeSubmodule K ⊤ / ↑J",
" J⁻¹ ≤ I⁻¹",
" x ∈ (fun a => ↑a) J⁻¹ → x ∈ (fun a => ↑a) I⁻¹",
" (∀ y ∈ J, x * y ∈ 1) → ∀ y ∈ I, x * y ∈ 1",
" J = I⁻¹",
" I * (1 / I) = 1",
" I * (1 / I) ≤ 1",
" ∀ i ∈ I, ∀ j ∈ 1 / I, i * j ∈ 1",
" x * y ∈ 1",
" y * x ∈ 1",
" 1 ≤ I * (1 / I)",
... | [
" ↑J⁻¹ = IsLocalization.coeSubmodule K ⊤ / ↑J",
" J⁻¹ ≤ I⁻¹",
" x ∈ (fun a => ↑a) J⁻¹ → x ∈ (fun a => ↑a) I⁻¹",
" (∀ y ∈ J, x * y ∈ 1) → ∀ y ∈ I, x * y ∈ 1",
" J = I⁻¹",
" I * (1 / I) = 1",
" I * (1 / I) ≤ 1",
" ∀ i ∈ I, ∀ j ∈ 1 / I, i * j ∈ 1",
" x * y ∈ 1",
" y * x ∈ 1",
" 1 ≤ I * (1 / I)",
... |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Data.Set.Function
#align_import data.set.intervals.surj_on from "leanprover-community/mathlib"@"a59dad53320b73ef180174aae867addd707ef00e"
variable {α : Type*} {β : Type*} [LinearOrder α] [PartialOrder β] {f : α → β}
open Set Function
open OrderDual (toDual)
theorem surjOn_Ioo_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
(a b : α) : SurjOn f (Ioo a b) (Ioo (f a) (f b)) := by
intro p hp
rcases h_surj p with ⟨x, rfl⟩
refine ⟨x, mem_Ioo.2 ?_, rfl⟩
contrapose! hp
exact fun h => h.2.not_le (h_mono <| hp <| h_mono.reflect_lt h.1)
#align surj_on_Ioo_of_monotone_surjective surjOn_Ioo_of_monotone_surjective
theorem surjOn_Ico_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
(a b : α) : SurjOn f (Ico a b) (Ico (f a) (f b)) := by
obtain hab | hab := lt_or_le a b
· intro p hp
rcases eq_left_or_mem_Ioo_of_mem_Ico hp with (rfl | hp')
· exact mem_image_of_mem f (left_mem_Ico.mpr hab)
· have := surjOn_Ioo_of_monotone_surjective h_mono h_surj a b hp'
exact image_subset f Ioo_subset_Ico_self this
· rw [Ico_eq_empty (h_mono hab).not_lt]
exact surjOn_empty f _
#align surj_on_Ico_of_monotone_surjective surjOn_Ico_of_monotone_surjective
theorem surjOn_Ioc_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
(a b : α) : SurjOn f (Ioc a b) (Ioc (f a) (f b)) := by
simpa using surjOn_Ico_of_monotone_surjective h_mono.dual h_surj (toDual b) (toDual a)
#align surj_on_Ioc_of_monotone_surjective surjOn_Ioc_of_monotone_surjective
-- to see that the hypothesis `a ≤ b` is necessary, consider a constant function
| Mathlib/Order/Interval/Set/SurjOn.lean | 53 | 60 | theorem surjOn_Icc_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
{a b : α} (hab : a ≤ b) : SurjOn f (Icc a b) (Icc (f a) (f b)) := by |
intro p hp
rcases eq_endpoints_or_mem_Ioo_of_mem_Icc hp with (rfl | rfl | hp')
· exact ⟨a, left_mem_Icc.mpr hab, rfl⟩
· exact ⟨b, right_mem_Icc.mpr hab, rfl⟩
· have := surjOn_Ioo_of_monotone_surjective h_mono h_surj a b hp'
exact image_subset f Ioo_subset_Icc_self this
| [
" SurjOn f (Ioo a b) (Ioo (f a) (f b))",
" p ∈ f '' Ioo a b",
" f x ∈ f '' Ioo a b",
" a < x ∧ x < b",
" f x ∉ Ioo (f a) (f b)",
" SurjOn f (Ico a b) (Ico (f a) (f b))",
" p ∈ f '' Ico a b",
" f a ∈ f '' Ico a b",
" SurjOn f (Ico a b) ∅",
" SurjOn f (Ioc a b) (Ioc (f a) (f b))",
" SurjOn f (Icc ... | [
" SurjOn f (Ioo a b) (Ioo (f a) (f b))",
" p ∈ f '' Ioo a b",
" f x ∈ f '' Ioo a b",
" a < x ∧ x < b",
" f x ∉ Ioo (f a) (f b)",
" SurjOn f (Ico a b) (Ico (f a) (f b))",
" p ∈ f '' Ico a b",
" f a ∈ f '' Ico a b",
" SurjOn f (Ico a b) ∅",
" SurjOn f (Ioc a b) (Ioc (f a) (f b))",
" SurjOn f (Icc ... |
import Mathlib.LinearAlgebra.FinsuppVectorSpace
import Mathlib.LinearAlgebra.Matrix.Basis
import Mathlib.LinearAlgebra.Matrix.Nondegenerate
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv
import Mathlib.LinearAlgebra.SesquilinearForm
import Mathlib.LinearAlgebra.Basis.Bilinear
#align_import linear_algebra.matrix.sesquilinear_form from "leanprover-community/mathlib"@"84582d2872fb47c0c17eec7382dc097c9ec7137a"
variable {R R₁ R₂ M M₁ M₂ M₁' M₂' n m n' m' ι : Type*}
open Finset LinearMap Matrix
open Matrix
section AuxToLinearMap
variable [CommSemiring R] [Semiring R₁] [Semiring R₂]
variable [Fintype n] [Fintype m]
variable (σ₁ : R₁ →+* R) (σ₂ : R₂ →+* R)
def Matrix.toLinearMap₂'Aux (f : Matrix n m R) : (n → R₁) →ₛₗ[σ₁] (m → R₂) →ₛₗ[σ₂] R :=
-- Porting note: we don't seem to have `∑ i j` as valid notation yet
mk₂'ₛₗ σ₁ σ₂ (fun (v : n → R₁) (w : m → R₂) => ∑ i, ∑ j, σ₁ (v i) * f i j * σ₂ (w j))
(fun _ _ _ => by simp only [Pi.add_apply, map_add, add_mul, sum_add_distrib])
(fun _ _ _ => by simp only [Pi.smul_apply, smul_eq_mul, RingHom.map_mul, mul_assoc, mul_sum])
(fun _ _ _ => by simp only [Pi.add_apply, map_add, mul_add, sum_add_distrib]) fun _ _ _ => by
simp only [Pi.smul_apply, smul_eq_mul, RingHom.map_mul, mul_assoc, mul_left_comm, mul_sum]
#align matrix.to_linear_map₂'_aux Matrix.toLinearMap₂'Aux
variable [DecidableEq n] [DecidableEq m]
| Mathlib/LinearAlgebra/Matrix/SesquilinearForm.lean | 66 | 74 | theorem Matrix.toLinearMap₂'Aux_stdBasis (f : Matrix n m R) (i : n) (j : m) :
f.toLinearMap₂'Aux σ₁ σ₂ (LinearMap.stdBasis R₁ (fun _ => R₁) i 1)
(LinearMap.stdBasis R₂ (fun _ => R₂) j 1) = f i j := by |
rw [Matrix.toLinearMap₂'Aux, mk₂'ₛₗ_apply]
have : (∑ i', ∑ j', (if i = i' then 1 else 0) * f i' j' * if j = j' then 1 else 0) = f i j := by
simp_rw [mul_assoc, ← Finset.mul_sum]
simp only [boole_mul, Finset.sum_ite_eq, Finset.mem_univ, if_true, mul_comm (f _ _)]
rw [← this]
exact Finset.sum_congr rfl fun _ _ => Finset.sum_congr rfl fun _ _ => by simp
| [
" (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) (x✝² + x✝¹) x✝ =\n (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) x✝² x✝ +\n (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) x✝¹ x✝",
" (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) (x✝² • x✝¹) x✝ =\n σ₁ x✝... | [
" (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) (x✝² + x✝¹) x✝ =\n (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) x✝² x✝ +\n (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) x✝¹ x✝",
" (fun v w => ∑ i : n, ∑ j : m, σ₁ (v i) * f i j * σ₂ (w j)) (x✝² • x✝¹) x✝ =\n σ₁ x✝... |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section OrderedAddCommGroup
variable [OrderedAddCommGroup α] (a b c : α)
@[simp]
theorem preimage_const_add_Ici : (fun x => a + x) ⁻¹' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add'.symm
#align set.preimage_const_add_Ici Set.preimage_const_add_Ici
@[simp]
theorem preimage_const_add_Ioi : (fun x => a + x) ⁻¹' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add'.symm
#align set.preimage_const_add_Ioi Set.preimage_const_add_Ioi
@[simp]
theorem preimage_const_add_Iic : (fun x => a + x) ⁻¹' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le'.symm
#align set.preimage_const_add_Iic Set.preimage_const_add_Iic
@[simp]
theorem preimage_const_add_Iio : (fun x => a + x) ⁻¹' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt'.symm
#align set.preimage_const_add_Iio Set.preimage_const_add_Iio
@[simp]
theorem preimage_const_add_Icc : (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a) := by
simp [← Ici_inter_Iic]
#align set.preimage_const_add_Icc Set.preimage_const_add_Icc
@[simp]
theorem preimage_const_add_Ico : (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a) := by
simp [← Ici_inter_Iio]
#align set.preimage_const_add_Ico Set.preimage_const_add_Ico
@[simp]
theorem preimage_const_add_Ioc : (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by
simp [← Ioi_inter_Iic]
#align set.preimage_const_add_Ioc Set.preimage_const_add_Ioc
@[simp]
theorem preimage_const_add_Ioo : (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a) := by
simp [← Ioi_inter_Iio]
#align set.preimage_const_add_Ioo Set.preimage_const_add_Ioo
@[simp]
theorem preimage_add_const_Ici : (fun x => x + a) ⁻¹' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add.symm
#align set.preimage_add_const_Ici Set.preimage_add_const_Ici
@[simp]
theorem preimage_add_const_Ioi : (fun x => x + a) ⁻¹' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add.symm
#align set.preimage_add_const_Ioi Set.preimage_add_const_Ioi
@[simp]
theorem preimage_add_const_Iic : (fun x => x + a) ⁻¹' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le.symm
#align set.preimage_add_const_Iic Set.preimage_add_const_Iic
@[simp]
theorem preimage_add_const_Iio : (fun x => x + a) ⁻¹' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt.symm
#align set.preimage_add_const_Iio Set.preimage_add_const_Iio
@[simp]
theorem preimage_add_const_Icc : (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a) := by
simp [← Ici_inter_Iic]
#align set.preimage_add_const_Icc Set.preimage_add_const_Icc
@[simp]
theorem preimage_add_const_Ico : (fun x => x + a) ⁻¹' Ico b c = Ico (b - a) (c - a) := by
simp [← Ici_inter_Iio]
#align set.preimage_add_const_Ico Set.preimage_add_const_Ico
@[simp]
theorem preimage_add_const_Ioc : (fun x => x + a) ⁻¹' Ioc b c = Ioc (b - a) (c - a) := by
simp [← Ioi_inter_Iic]
#align set.preimage_add_const_Ioc Set.preimage_add_const_Ioc
@[simp]
theorem preimage_add_const_Ioo : (fun x => x + a) ⁻¹' Ioo b c = Ioo (b - a) (c - a) := by
simp [← Ioi_inter_Iio]
#align set.preimage_add_const_Ioo Set.preimage_add_const_Ioo
@[simp]
theorem preimage_neg_Ici : -Ici a = Iic (-a) :=
ext fun _x => le_neg
#align set.preimage_neg_Ici Set.preimage_neg_Ici
@[simp]
theorem preimage_neg_Iic : -Iic a = Ici (-a) :=
ext fun _x => neg_le
#align set.preimage_neg_Iic Set.preimage_neg_Iic
@[simp]
theorem preimage_neg_Ioi : -Ioi a = Iio (-a) :=
ext fun _x => lt_neg
#align set.preimage_neg_Ioi Set.preimage_neg_Ioi
@[simp]
theorem preimage_neg_Iio : -Iio a = Ioi (-a) :=
ext fun _x => neg_lt
#align set.preimage_neg_Iio Set.preimage_neg_Iio
@[simp]
theorem preimage_neg_Icc : -Icc a b = Icc (-b) (-a) := by simp [← Ici_inter_Iic, inter_comm]
#align set.preimage_neg_Icc Set.preimage_neg_Icc
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 241 | 242 | theorem preimage_neg_Ico : -Ico a b = Ioc (-b) (-a) := by |
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, inter_comm]
| [
" (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a)",
" (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a)",
" (fun x => x + a) ⁻¹' Ico b c ... | [
" (fun x => a + x) ⁻¹' Icc b c = Icc (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ico b c = Ico (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ioc b c = Ioc (b - a) (c - a)",
" (fun x => a + x) ⁻¹' Ioo b c = Ioo (b - a) (c - a)",
" (fun x => x + a) ⁻¹' Icc b c = Icc (b - a) (c - a)",
" (fun x => x + a) ⁻¹' Ico b c ... |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 64 | 64 | theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by | rw [logb, logb, log_abs]
| [
" b.logb 0 = 0",
" b.logb 1 = 0",
" False",
" b.logb |x| = b.logb x"
] | [
" b.logb 0 = 0",
" b.logb 1 = 0",
" False",
" b.logb |x| = b.logb x"
] |
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.Topology.Algebra.Nonarchimedean.Bases
import Mathlib.Topology.Algebra.UniformRing
#align_import topology.algebra.nonarchimedean.adic_topology from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R : Type*} [CommRing R]
open Set TopologicalAddGroup Submodule Filter
open Topology Pointwise
namespace Ideal
| Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean | 54 | 73 | theorem adic_basis (I : Ideal R) : SubmodulesRingBasis fun n : ℕ => (I ^ n • ⊤ : Ideal R) :=
{ inter := by |
suffices ∀ i j : ℕ, ∃ k, I ^ k ≤ I ^ i ∧ I ^ k ≤ I ^ j by
simpa only [smul_eq_mul, mul_top, Algebra.id.map_eq_id, map_id, le_inf_iff] using this
intro i j
exact ⟨max i j, pow_le_pow_right (le_max_left i j), pow_le_pow_right (le_max_right i j)⟩
leftMul := by
suffices ∀ (a : R) (i : ℕ), ∃ j : ℕ, a • I ^ j ≤ I ^ i by
simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this
intro r n
use n
rintro a ⟨x, hx, rfl⟩
exact (I ^ n).smul_mem r hx
mul := by
suffices ∀ i : ℕ, ∃ j : ℕ, (↑(I ^ j) * ↑(I ^ j) : Set R) ⊆ (↑(I ^ i) : Set R) by
simpa only [smul_top_eq_map, Algebra.id.map_eq_id, map_id] using this
intro n
use n
rintro a ⟨x, _hx, b, hb, rfl⟩
exact (I ^ n).smul_mem x hb }
| [
" ∀ (i j : ℕ), ∃ k, I ^ k • ⊤ ≤ I ^ i • ⊤ ⊓ I ^ j • ⊤",
" ∀ (i j : ℕ), ∃ k, I ^ k ≤ I ^ i ∧ I ^ k ≤ I ^ j",
" ∃ k, I ^ k ≤ I ^ i ∧ I ^ k ≤ I ^ j",
" ∀ (a : R) (i : ℕ), ∃ j, a • I ^ j • ⊤ ≤ I ^ i • ⊤",
" ∀ (a : R) (i : ℕ), ∃ j, a • I ^ j ≤ I ^ i",
" ∃ j, r • I ^ j ≤ I ^ n",
" r • I ^ n ≤ I ^ n",
" (Dis... | [
" ∀ (i j : ℕ), ∃ k, I ^ k • ⊤ ≤ I ^ i • ⊤ ⊓ I ^ j • ⊤"
] |
import Mathlib.Control.Monad.Basic
import Mathlib.Control.Monad.Writer
import Mathlib.Init.Control.Lawful
#align_import control.monad.cont from "leanprover-community/mathlib"@"d6814c584384ddf2825ff038e868451a7c956f31"
universe u v w u₀ u₁ v₀ v₁
structure MonadCont.Label (α : Type w) (m : Type u → Type v) (β : Type u) where
apply : α → m β
#align monad_cont.label MonadCont.Label
def MonadCont.goto {α β} {m : Type u → Type v} (f : MonadCont.Label α m β) (x : α) :=
f.apply x
#align monad_cont.goto MonadCont.goto
class MonadCont (m : Type u → Type v) where
callCC : ∀ {α β}, (MonadCont.Label α m β → m α) → m α
#align monad_cont MonadCont
open MonadCont
class LawfulMonadCont (m : Type u → Type v) [Monad m] [MonadCont m]
extends LawfulMonad m : Prop where
callCC_bind_right {α ω γ} (cmd : m α) (next : Label ω m γ → α → m ω) :
(callCC fun f => cmd >>= next f) = cmd >>= fun x => callCC fun f => next f x
callCC_bind_left {α} (β) (x : α) (dead : Label α m β → β → m α) :
(callCC fun f : Label α m β => goto f x >>= dead f) = pure x
callCC_dummy {α β} (dummy : m α) : (callCC fun _ : Label α m β => dummy) = dummy
#align is_lawful_monad_cont LawfulMonadCont
export LawfulMonadCont (callCC_bind_right callCC_bind_left callCC_dummy)
def ContT (r : Type u) (m : Type u → Type v) (α : Type w) :=
(α → m r) → m r
#align cont_t ContT
abbrev Cont (r : Type u) (α : Type w) :=
ContT r id α
#align cont Cont
variable {m : Type u → Type v} [Monad m]
def ExceptT.mkLabel {α β ε} : Label (Except.{u, u} ε α) m β → Label α (ExceptT ε m) β
| ⟨f⟩ => ⟨fun a => monadLift <| f (Except.ok a)⟩
#align except_t.mk_label ExceptTₓ.mkLabel
theorem ExceptT.goto_mkLabel {α β ε : Type _} (x : Label (Except.{u, u} ε α) m β) (i : α) :
goto (ExceptT.mkLabel x) i = ExceptT.mk (Except.ok <$> goto x (Except.ok i)) := by
cases x; rfl
#align except_t.goto_mk_label ExceptTₓ.goto_mkLabel
nonrec def ExceptT.callCC {ε} [MonadCont m] {α β : Type _}
(f : Label α (ExceptT ε m) β → ExceptT ε m α) : ExceptT ε m α :=
ExceptT.mk (callCC fun x : Label _ m β => ExceptT.run <| f (ExceptT.mkLabel x))
#align except_t.call_cc ExceptTₓ.callCC
instance {ε} [MonadCont m] : MonadCont (ExceptT ε m) where
callCC := ExceptT.callCC
instance {ε} [MonadCont m] [LawfulMonadCont m] : LawfulMonadCont (ExceptT ε m) where
callCC_bind_right := by
intros; simp only [callCC, ExceptT.callCC, ExceptT.run_bind, callCC_bind_right]; ext
dsimp
congr with ⟨⟩ <;> simp [ExceptT.bindCont, @callCC_dummy m _]
callCC_bind_left := by
intros
simp only [callCC, ExceptT.callCC, ExceptT.goto_mkLabel, map_eq_bind_pure_comp, Function.comp,
ExceptT.run_bind, ExceptT.run_mk, bind_assoc, pure_bind, @callCC_bind_left m _]
ext; rfl
callCC_dummy := by intros; simp only [callCC, ExceptT.callCC, @callCC_dummy m _]; ext; rfl
def OptionT.mkLabel {α β} : Label (Option.{u} α) m β → Label α (OptionT m) β
| ⟨f⟩ => ⟨fun a => monadLift <| f (some a)⟩
#align option_t.mk_label OptionTₓ.mkLabel
theorem OptionT.goto_mkLabel {α β : Type _} (x : Label (Option.{u} α) m β) (i : α) :
goto (OptionT.mkLabel x) i = OptionT.mk (goto x (some i) >>= fun a => pure (some a)) :=
rfl
#align option_t.goto_mk_label OptionTₓ.goto_mkLabel
nonrec def OptionT.callCC [MonadCont m] {α β : Type _} (f : Label α (OptionT m) β → OptionT m α) :
OptionT m α :=
OptionT.mk (callCC fun x : Label _ m β => OptionT.run <| f (OptionT.mkLabel x) : m (Option α))
#align option_t.call_cc OptionTₓ.callCC
instance [MonadCont m] : MonadCont (OptionT m) where
callCC := OptionT.callCC
instance [MonadCont m] [LawfulMonadCont m] : LawfulMonadCont (OptionT m) where
callCC_bind_right := by
intros; simp only [callCC, OptionT.callCC, OptionT.run_bind, callCC_bind_right]; ext
dsimp
congr with ⟨⟩ <;> simp [@callCC_dummy m _]
callCC_bind_left := by
intros;
simp only [callCC, OptionT.callCC, OptionT.goto_mkLabel, OptionT.run_bind, OptionT.run_mk,
bind_assoc, pure_bind, @callCC_bind_left m _]
ext; rfl
callCC_dummy := by intros; simp only [callCC, OptionT.callCC, @callCC_dummy m _]; ext; rfl
def WriterT.mkLabel {α β ω} [EmptyCollection ω] : Label (α × ω) m β → Label α (WriterT ω m) β
| ⟨f⟩ => ⟨fun a => monadLift <| f (a, ∅)⟩
def WriterT.mkLabel' {α β ω} [Monoid ω] : Label (α × ω) m β → Label α (WriterT ω m) β
| ⟨f⟩ => ⟨fun a => monadLift <| f (a, 1)⟩
#align writer_t.mk_label WriterTₓ.mkLabel'
| Mathlib/Control/Monad/Cont.lean | 193 | 194 | theorem WriterT.goto_mkLabel {α β ω : Type _} [EmptyCollection ω] (x : Label (α × ω) m β) (i : α) :
goto (WriterT.mkLabel x) i = monadLift (goto x (i, ∅)) := by | cases x; rfl
| [
" goto (mkLabel x) i = mk (Except.ok <$> goto x (Except.ok i))",
" goto (mkLabel { apply := apply✝ }) i = mk (Except.ok <$> goto { apply := apply✝ } (Except.ok i))",
" ∀ {α ω γ : Type u} (cmd : ExceptT ε m α) (next : Label ω (ExceptT ε m) γ → α → ExceptT ε m ω),\n (callCC fun f => cmd >>= next f) = do\n ... | [
" goto (mkLabel x) i = mk (Except.ok <$> goto x (Except.ok i))",
" goto (mkLabel { apply := apply✝ }) i = mk (Except.ok <$> goto { apply := apply✝ } (Except.ok i))",
" ∀ {α ω γ : Type u} (cmd : ExceptT ε m α) (next : Label ω (ExceptT ε m) γ → α → ExceptT ε m ω),\n (callCC fun f => cmd >>= next f) = do\n ... |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Kernel
variable [HasZeroMorphisms C] (f : X ⟶ Y) [HasKernel f]
abbrev kernelSubobject : Subobject X :=
Subobject.mk (kernel.ι f)
#align category_theory.limits.kernel_subobject CategoryTheory.Limits.kernelSubobject
def kernelSubobjectIso : (kernelSubobject f : C) ≅ kernel f :=
Subobject.underlyingIso (kernel.ι f)
#align category_theory.limits.kernel_subobject_iso CategoryTheory.Limits.kernelSubobjectIso
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem kernelSubobject_arrow :
(kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow := by
simp [kernelSubobjectIso]
#align category_theory.limits.kernel_subobject_arrow CategoryTheory.Limits.kernelSubobject_arrow
@[reassoc (attr := simp), elementwise (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 104 | 106 | theorem kernelSubobject_arrow' :
(kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f := by |
simp [kernelSubobjectIso]
| [
" (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow",
" (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f"
] | [
" (kernelSubobjectIso f).hom ≫ kernel.ι f = (kernelSubobject f).arrow",
" (kernelSubobjectIso f).inv ≫ (kernelSubobject f).arrow = kernel.ι f"
] |
import Mathlib.RingTheory.Ideal.Cotangent
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.Valuation.ValuationRing
import Mathlib.RingTheory.Nakayama
#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
open scoped DiscreteValuation
open LocalRing FiniteDimensional
| Mathlib/RingTheory/DiscreteValuationRing/TFAE.lean | 37 | 89 | theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
(h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
∃ n : ℕ, I = maximalIdeal R ^ n := by |
by_cases h : IsField R;
· exact ⟨0, by simp [letI := h.toField; (eq_bot_or_eq_top I).resolve_left hI]⟩
classical
obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
by_cases hI' : I = ⊤
· use 0; rw [pow_zero, hI', Ideal.one_eq_top]
have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
(SetLike.ext_iff.mp hx r).trans Ideal.mem_span_singleton
have : x ≠ 0 := by
rintro rfl
apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
simp [hx]
have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r := by
intro r hr₁ hr₂
obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
have : ∀ b ∈ f, Associated x b := by
intro b hb
exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
clear hr₁ hr₂ hf₁
induction' f using Multiset.induction with fa fs fh
· exact (hf₂ rfl).elim
rcases eq_or_ne fs ∅ with (rfl | hf')
· use 1
rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
exact this _ (Multiset.mem_cons_self _ _)
· obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
use n + 1
rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
have : ∃ n : ℕ, x ^ n ∈ I := by
obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
by_contra! h; apply hI; rw [eq_bot_iff]; exact h
obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
use n
rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
use Nat.find this
apply le_antisymm
· change ∀ s ∈ I, s ∈ _
by_contra! hI''
obtain ⟨s, hs₁, hs₂⟩ := hI''
apply hs₂
by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
apply Ideal.pow_mem_pow
exact (H _).mpr (dvd_refl _)
· rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
exact Nat.find_spec this
| [
" ∃ n, I = maximalIdeal R ^ n",
" I = maximalIdeal R ^ 0",
" x ≠ 0",
" False",
" maximalIdeal R = ⊥",
" ∀ (r : R), r ≠ 0 → r ∈ nonunits R → ∃ n, Associated (x ^ n) r",
" ∃ n, Associated (x ^ n) r",
" ∃ n, Associated (x ^ n) f.prod",
" ∀ b ∈ f, Associated x b",
" Associated x b",
" ∃ n, Associate... | [
" ∃ n, I = maximalIdeal R ^ n"
] |
import Mathlib.Logic.Pairwise
import Mathlib.Logic.Relation
import Mathlib.Data.List.Basic
#align_import data.list.pairwise from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open Nat Function
namespace List
variable {α β : Type*} {R S T : α → α → Prop} {a : α} {l : List α}
mk_iff_of_inductive_prop List.Pairwise List.pairwise_iff
#align list.pairwise_iff List.pairwise_iff
#align list.pairwise.nil List.Pairwise.nil
#align list.pairwise.cons List.Pairwise.cons
#align list.rel_of_pairwise_cons List.rel_of_pairwise_cons
#align list.pairwise.of_cons List.Pairwise.of_cons
#align list.pairwise.tail List.Pairwise.tail
#align list.pairwise.drop List.Pairwise.drop
#align list.pairwise.imp_of_mem List.Pairwise.imp_of_mem
#align list.pairwise.imp List.Pairwise.impₓ -- Implicits Order
#align list.pairwise_and_iff List.pairwise_and_iff
#align list.pairwise.and List.Pairwise.and
#align list.pairwise.imp₂ List.Pairwise.imp₂
#align list.pairwise.iff_of_mem List.Pairwise.iff_of_mem
#align list.pairwise.iff List.Pairwise.iff
#align list.pairwise_of_forall List.pairwise_of_forall
#align list.pairwise.and_mem List.Pairwise.and_mem
#align list.pairwise.imp_mem List.Pairwise.imp_mem
#align list.pairwise.sublist List.Pairwise.sublistₓ -- Implicits order
#align list.pairwise.forall_of_forall_of_flip List.Pairwise.forall_of_forall_of_flip
theorem Pairwise.forall_of_forall (H : Symmetric R) (H₁ : ∀ x ∈ l, R x x) (H₂ : l.Pairwise R) :
∀ ⦃x⦄, x ∈ l → ∀ ⦃y⦄, y ∈ l → R x y :=
H₂.forall_of_forall_of_flip H₁ <| by rwa [H.flip_eq]
#align list.pairwise.forall_of_forall List.Pairwise.forall_of_forall
| Mathlib/Data/List/Pairwise.lean | 81 | 86 | theorem Pairwise.forall (hR : Symmetric R) (hl : l.Pairwise R) :
∀ ⦃a⦄, a ∈ l → ∀ ⦃b⦄, b ∈ l → a ≠ b → R a b := by |
apply Pairwise.forall_of_forall
· exact fun a b h hne => hR (h hne.symm)
· exact fun _ _ hx => (hx rfl).elim
· exact hl.imp (@fun a b h _ => by exact h)
| [
" Pairwise (flip fun x => R x) l",
" ∀ ⦃a : α⦄, a ∈ l → ∀ ⦃b : α⦄, b ∈ l → a ≠ b → R a b",
" Symmetric fun x y => x ≠ y → R x y",
" ∀ (x : α), x ∈ l → x ≠ x → R x x",
" Pairwise (fun x y => x ≠ y → R x y) l",
" R a b"
] | [
" Pairwise (flip fun x => R x) l",
" ∀ ⦃a : α⦄, a ∈ l → ∀ ⦃b : α⦄, b ∈ l → a ≠ b → R a b"
] |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
section
variable {ι : Type*} [Fintype ι]
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)]
[∀ i, NormedSpace 𝕜 (E i)] :
IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G =>
p.1.prod p.2 where
map_add p₁ p₂ := by ext : 1; rfl
map_smul c p := by ext : 1; rfl
bound := by
refine ⟨1, zero_lt_one, fun p ↦ ?_⟩
rw [one_mul]
apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _
intro m
rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff]
constructor
· exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity)
· exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity)
#align is_bounded_linear_map_prod_multilinear isBoundedLinearMap_prod_multilinear
theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G →L[𝕜] E) :
IsBoundedLinearMap 𝕜 fun f : ContinuousMultilinearMap 𝕜 (fun _ : ι => E) F =>
f.compContinuousLinearMap fun _ => g := by
refine
IsLinearMap.with_bound
⟨fun f₁ f₂ => by ext; rfl,
fun c f => by ext; rfl⟩
(‖g‖ ^ Fintype.card ι) fun f => ?_
apply ContinuousMultilinearMap.opNorm_le_bound _ _ _
· apply_rules [mul_nonneg, pow_nonneg, norm_nonneg]
intro m
calc
‖f (g ∘ m)‖ ≤ ‖f‖ * ∏ i, ‖g (m i)‖ := f.le_opNorm _
_ ≤ ‖f‖ * ∏ i, ‖g‖ * ‖m i‖ := by
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
exact Finset.prod_le_prod (fun i _ => norm_nonneg _) fun i _ => g.le_opNorm _
_ = ‖g‖ ^ Fintype.card ι * ‖f‖ * ∏ i, ‖m i‖ := by
simp only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ]
ring
#align is_bounded_linear_map_continuous_multilinear_map_comp_linear isBoundedLinearMap_continuousMultilinearMap_comp_linear
end
section BilinearMap
namespace ContinuousLinearMap
variable {R : Type*}
variable {𝕜₂ 𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NontriviallyNormedField 𝕜₂]
variable {M : Type*} [TopologicalSpace M]
variable {σ₁₂ : 𝕜 →+* 𝕜₂}
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜₂ G'] [NormedSpace 𝕜' G']
variable [SMulCommClass 𝕜₂ 𝕜' G']
section Semiring
variable [Semiring R] [AddCommMonoid M] [Module R M] {ρ₁₂ : R →+* 𝕜'}
theorem map_add₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x x' : M) (y : F) :
f (x + x') y = f x y + f x' y := by rw [f.map_add, add_apply]
#align continuous_linear_map.map_add₂ ContinuousLinearMap.map_add₂
theorem map_zero₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (y : F) : f 0 y = 0 := by
rw [f.map_zero, zero_apply]
#align continuous_linear_map.map_zero₂ ContinuousLinearMap.map_zero₂
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 293 | 294 | theorem map_smulₛₗ₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (c : R) (x : M) (y : F) :
f (c • x) y = ρ₁₂ c • f x y := by | rw [f.map_smulₛₗ, smul_apply]
| [
" (p₁ + p₂).1.prod (p₁ + p₂).2 = p₁.1.prod p₁.2 + p₂.1.prod p₂.2",
" ((p₁ + p₂).1.prod (p₁ + p₂).2) x✝ = (p₁.1.prod p₁.2 + p₂.1.prod p₂.2) x✝",
" (c • p).1.prod (c • p).2 = c • p.1.prod p.2",
" ((c • p).1.prod (c • p).2) x✝ = (c • p.1.prod p.2) x✝",
" ∃ M, 0 < M ∧ ∀ (x : ContinuousMultilinearMap 𝕜 E F × Co... | [
" (p₁ + p₂).1.prod (p₁ + p₂).2 = p₁.1.prod p₁.2 + p₂.1.prod p₂.2",
" ((p₁ + p₂).1.prod (p₁ + p₂).2) x✝ = (p₁.1.prod p₁.2 + p₂.1.prod p₂.2) x✝",
" (c • p).1.prod (c • p).2 = c • p.1.prod p.2",
" ((c • p).1.prod (c • p).2) x✝ = (c • p.1.prod p.2) x✝",
" ∃ M, 0 < M ∧ ∀ (x : ContinuousMultilinearMap 𝕜 E F × Co... |
import Mathlib.Data.Set.Lattice
import Mathlib.Data.Set.Pairwise.Basic
#align_import data.set.pairwise.lattice from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d"
open Function Set Order
variable {α β γ ι ι' : Type*} {κ : Sort*} {r p q : α → α → Prop}
section Pairwise
variable {f g : ι → α} {s t u : Set α} {a b : α}
namespace Set
| Mathlib/Data/Set/Pairwise/Lattice.lean | 27 | 36 | theorem pairwise_iUnion {f : κ → Set α} (h : Directed (· ⊆ ·) f) :
(⋃ n, f n).Pairwise r ↔ ∀ n, (f n).Pairwise r := by |
constructor
· intro H n
exact Pairwise.mono (subset_iUnion _ _) H
· intro H i hi j hj hij
rcases mem_iUnion.1 hi with ⟨m, hm⟩
rcases mem_iUnion.1 hj with ⟨n, hn⟩
rcases h m n with ⟨p, mp, np⟩
exact H p (mp hm) (np hn) hij
| [
" (⋃ n, f n).Pairwise r ↔ ∀ (n : κ), (f n).Pairwise r",
" (⋃ n, f n).Pairwise r → ∀ (n : κ), (f n).Pairwise r",
" (f n).Pairwise r",
" (∀ (n : κ), (f n).Pairwise r) → (⋃ n, f n).Pairwise r",
" r i j"
] | [
" (⋃ n, f n).Pairwise r ↔ ∀ (n : κ), (f n).Pairwise r"
] |
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.LinearAlgebra.SesquilinearForm
#align_import analysis.inner_product_space.orthogonal from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {𝕜 E F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
namespace Submodule
variable (K : Submodule 𝕜 E)
def orthogonal : Submodule 𝕜 E where
carrier := { v | ∀ u ∈ K, ⟪u, v⟫ = 0 }
zero_mem' _ _ := inner_zero_right _
add_mem' hx hy u hu := by rw [inner_add_right, hx u hu, hy u hu, add_zero]
smul_mem' c x hx u hu := by rw [inner_smul_right, hx u hu, mul_zero]
#align submodule.orthogonal Submodule.orthogonal
@[inherit_doc]
notation:1200 K "ᗮ" => orthogonal K
theorem mem_orthogonal (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪u, v⟫ = 0 :=
Iff.rfl
#align submodule.mem_orthogonal Submodule.mem_orthogonal
theorem mem_orthogonal' (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫ = 0 := by
simp_rw [mem_orthogonal, inner_eq_zero_symm]
#align submodule.mem_orthogonal' Submodule.mem_orthogonal'
variable {K}
theorem inner_right_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪u, v⟫ = 0 :=
(K.mem_orthogonal v).1 hv u hu
#align submodule.inner_right_of_mem_orthogonal Submodule.inner_right_of_mem_orthogonal
theorem inner_left_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪v, u⟫ = 0 := by
rw [inner_eq_zero_symm]; exact inner_right_of_mem_orthogonal hu hv
#align submodule.inner_left_of_mem_orthogonal Submodule.inner_left_of_mem_orthogonal
theorem mem_orthogonal_singleton_iff_inner_right {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪u, v⟫ = 0 := by
refine ⟨inner_right_of_mem_orthogonal (mem_span_singleton_self u), ?_⟩
intro hv w hw
rw [mem_span_singleton] at hw
obtain ⟨c, rfl⟩ := hw
simp [inner_smul_left, hv]
#align submodule.mem_orthogonal_singleton_iff_inner_right Submodule.mem_orthogonal_singleton_iff_inner_right
theorem mem_orthogonal_singleton_iff_inner_left {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪v, u⟫ = 0 := by
rw [mem_orthogonal_singleton_iff_inner_right, inner_eq_zero_symm]
#align submodule.mem_orthogonal_singleton_iff_inner_left Submodule.mem_orthogonal_singleton_iff_inner_left
theorem sub_mem_orthogonal_of_inner_left {x y : E} (h : ∀ v : K, ⟪x, v⟫ = ⟪y, v⟫) : x - y ∈ Kᗮ := by
rw [mem_orthogonal']
intro u hu
rw [inner_sub_left, sub_eq_zero]
exact h ⟨u, hu⟩
#align submodule.sub_mem_orthogonal_of_inner_left Submodule.sub_mem_orthogonal_of_inner_left
| Mathlib/Analysis/InnerProductSpace/Orthogonal.lean | 93 | 97 | theorem sub_mem_orthogonal_of_inner_right {x y : E} (h : ∀ v : K, ⟪(v : E), x⟫ = ⟪(v : E), y⟫) :
x - y ∈ Kᗮ := by |
intro u hu
rw [inner_sub_right, sub_eq_zero]
exact h ⟨u, hu⟩
| [
" ⟪u, a✝ + b✝⟫_𝕜 = 0",
" ⟪u, c • x⟫_𝕜 = 0",
" v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫_𝕜 = 0",
" ⟪v, u⟫_𝕜 = 0",
" ⟪u, v⟫_𝕜 = 0",
" v ∈ (span 𝕜 {u})ᗮ ↔ ⟪u, v⟫_𝕜 = 0",
" ⟪u, v⟫_𝕜 = 0 → v ∈ (span 𝕜 {u})ᗮ",
" ⟪w, v⟫_𝕜 = 0",
" ⟪c • u, v⟫_𝕜 = 0",
" v ∈ (span 𝕜 {u})ᗮ ↔ ⟪v, u⟫_𝕜 = 0",
" x - y ∈ Kᗮ",
" ∀ ... | [
" ⟪u, a✝ + b✝⟫_𝕜 = 0",
" ⟪u, c • x⟫_𝕜 = 0",
" v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫_𝕜 = 0",
" ⟪v, u⟫_𝕜 = 0",
" ⟪u, v⟫_𝕜 = 0",
" v ∈ (span 𝕜 {u})ᗮ ↔ ⟪u, v⟫_𝕜 = 0",
" ⟪u, v⟫_𝕜 = 0 → v ∈ (span 𝕜 {u})ᗮ",
" ⟪w, v⟫_𝕜 = 0",
" ⟪c • u, v⟫_𝕜 = 0",
" v ∈ (span 𝕜 {u})ᗮ ↔ ⟪v, u⟫_𝕜 = 0",
" x - y ∈ Kᗮ",
" ∀ ... |
import Mathlib.MeasureTheory.Group.GeometryOfNumbers
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
import Mathlib.NumberTheory.NumberField.CanonicalEmbedding.Basic
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional
local notation "E" K =>
({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ)
section convexBodyLT
open Metric NNReal
variable (f : InfinitePlace K → ℝ≥0)
abbrev convexBodyLT : Set (E K) :=
(Set.univ.pi (fun w : { w : InfinitePlace K // IsReal w } => ball 0 (f w))) ×ˢ
(Set.univ.pi (fun w : { w : InfinitePlace K // IsComplex w } => ball 0 (f w)))
theorem convexBodyLT_mem {x : K} :
mixedEmbedding K x ∈ (convexBodyLT K f) ↔ ∀ w : InfinitePlace K, w x < f w := by
simp_rw [mixedEmbedding, RingHom.prod_apply, Set.mem_prod, Set.mem_pi, Set.mem_univ,
forall_true_left, mem_ball_zero_iff, Pi.ringHom_apply, ← Complex.norm_real,
embedding_of_isReal_apply, Subtype.forall, ← forall₂_or_left, ← not_isReal_iff_isComplex, em,
forall_true_left, norm_embedding_eq]
theorem convexBodyLT_neg_mem (x : E K) (hx : x ∈ (convexBodyLT K f)) :
-x ∈ (convexBodyLT K f) := by
simp only [Set.mem_prod, Prod.fst_neg, Set.mem_pi, Set.mem_univ, Pi.neg_apply,
mem_ball_zero_iff, norm_neg, Real.norm_eq_abs, forall_true_left, Subtype.forall,
Prod.snd_neg, Complex.norm_eq_abs] at hx ⊢
exact hx
theorem convexBodyLT_convex : Convex ℝ (convexBodyLT K f) :=
Convex.prod (convex_pi (fun _ _ => convex_ball _ _)) (convex_pi (fun _ _ => convex_ball _ _))
open Fintype MeasureTheory MeasureTheory.Measure ENNReal
open scoped Classical
variable [NumberField K]
instance : IsAddHaarMeasure (volume : Measure (E K)) := prod.instIsAddHaarMeasure volume volume
instance : NoAtoms (volume : Measure (E K)) := by
obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K))
by_cases hw : IsReal w
· exact @prod.instNoAtoms_fst _ _ _ _ volume volume _ (pi_noAtoms ⟨w, hw⟩)
· exact @prod.instNoAtoms_snd _ _ _ _ volume volume _
(pi_noAtoms ⟨w, not_isReal_iff_isComplex.mp hw⟩)
noncomputable abbrev convexBodyLTFactor : ℝ≥0 :=
(2 : ℝ≥0) ^ NrRealPlaces K * NNReal.pi ^ NrComplexPlaces K
theorem convexBodyLTFactor_ne_zero : convexBodyLTFactor K ≠ 0 :=
mul_ne_zero (pow_ne_zero _ two_ne_zero) (pow_ne_zero _ pi_ne_zero)
theorem one_le_convexBodyLTFactor : 1 ≤ convexBodyLTFactor K :=
one_le_mul₀ (one_le_pow_of_one_le one_le_two _)
(one_le_pow_of_one_le (le_trans one_le_two Real.two_le_pi) _)
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/ConvexBody.lean | 108 | 130 | theorem convexBodyLT_volume :
volume (convexBodyLT K f) = (convexBodyLTFactor K) * ∏ w, (f w) ^ (mult w) := by |
calc
_ = (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (2 * (f x.val))) *
∏ x : {w // InfinitePlace.IsComplex w}, ENNReal.ofReal (f x.val) ^ 2 * NNReal.pi := by
simp_rw [volume_eq_prod, prod_prod, volume_pi, pi_pi, Real.volume_ball, Complex.volume_ball]
_ = ((2:ℝ≥0) ^ NrRealPlaces K * (∏ x : {w // InfinitePlace.IsReal w}, ENNReal.ofReal (f x.val)))
* ((∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2) *
NNReal.pi ^ NrComplexPlaces K) := by
simp_rw [ofReal_mul (by norm_num : 0 ≤ (2 : ℝ)), Finset.prod_mul_distrib, Finset.prod_const,
Finset.card_univ, ofReal_ofNat, ofReal_coe_nnreal, coe_ofNat]
_ = (convexBodyLTFactor K) * ((∏ x : {w // InfinitePlace.IsReal w}, .ofReal (f x.val)) *
(∏ x : {w // IsComplex w}, ENNReal.ofReal (f x.val) ^ 2)) := by
simp_rw [convexBodyLTFactor, coe_mul, ENNReal.coe_pow]
ring
_ = (convexBodyLTFactor K) * ∏ w, (f w) ^ (mult w) := by
simp_rw [mult, pow_ite, pow_one, Finset.prod_ite, ofReal_coe_nnreal, not_isReal_iff_isComplex,
coe_mul, coe_finset_prod, ENNReal.coe_pow]
congr 2
· refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞))).symm
exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and]
· refine (Finset.prod_subtype (Finset.univ.filter _) ?_ (fun w => (f w : ℝ≥0∞) ^ 2)).symm
exact fun _ => by simp only [Finset.mem_univ, forall_true_left, Finset.mem_filter, true_and]
| [
" (mixedEmbedding K) x ∈ convexBodyLT K f ↔ ∀ (w : InfinitePlace K), w x < ↑(f w)",
" -x ∈ convexBodyLT K f",
" (∀ (a : InfinitePlace K) (b : a.IsReal), |x.1 ⟨a, b⟩| < ↑(f a)) ∧\n ∀ (a : InfinitePlace K) (b : a.IsComplex), Complex.abs (x.2 ⟨a, b⟩) < ↑(f a)",
" NoAtoms volume",
" volume (convexBodyLT K f)... | [
" (mixedEmbedding K) x ∈ convexBodyLT K f ↔ ∀ (w : InfinitePlace K), w x < ↑(f w)",
" -x ∈ convexBodyLT K f",
" (∀ (a : InfinitePlace K) (b : a.IsReal), |x.1 ⟨a, b⟩| < ↑(f a)) ∧\n ∀ (a : InfinitePlace K) (b : a.IsComplex), Complex.abs (x.2 ⟨a, b⟩) < ↑(f a)",
" NoAtoms volume",
" volume (convexBodyLT K f)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.