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.Data.Int.Order.Units
import Mathlib.Data.ZMod.IntUnitsPower
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.LinearAlgebra.DirectSum.TensorProduct
import Mathlib.Algebra.DirectSum.Algebra
suppress_compilation
open scoped TensorProduct DirectSum
variable {R ΞΉ A B : Type*}
namespace TensorProduct
variable [CommSemiring ΞΉ] [Module ΞΉ (Additive β€Λ£)] [DecidableEq ΞΉ]
variable (π : ΞΉ β Type*) (β¬ : ΞΉ β Type*)
variable [CommRing R]
variable [β i, AddCommGroup (π i)] [β i, AddCommGroup (β¬ i)]
variable [β i, Module R (π i)] [β i, Module R (β¬ i)]
variable [DirectSum.GRing π] [DirectSum.GRing β¬]
variable [DirectSum.GAlgebra R π] [DirectSum.GAlgebra R β¬]
-- this helps with performance
instance (i : ΞΉ Γ ΞΉ) : Module R (π (Prod.fst i) β[R] β¬ (Prod.snd i)) :=
TensorProduct.leftModule
open DirectSum (lof)
variable (R)
section gradedComm
local notation "πβ¬" => (fun i : ΞΉ Γ ΞΉ => π (Prod.fst i) β[R] β¬ (Prod.snd i))
local notation "β¬π" => (fun i : ΞΉ Γ ΞΉ => β¬ (Prod.fst i) β[R] π (Prod.snd i))
def gradedCommAux : DirectSum _ πβ¬ ββ[R] DirectSum _ β¬π := by
refine DirectSum.toModule R _ _ fun i => ?_
have o := DirectSum.lof R _ β¬π i.swap
have s : β€Λ£ := ((-1 : β€Λ£)^(i.1* i.2 : ΞΉ) : β€Λ£)
exact (s β’ o) ββ (TensorProduct.comm R _ _).toLinearMap
@[simp]
theorem gradedCommAux_lof_tmul (i j : ΞΉ) (a : π i) (b : β¬ j) :
gradedCommAux R π β¬ (lof R _ πβ¬ (i, j) (a ββ b)) =
(-1 : β€Λ£)^(j * i) β’ lof R _ β¬π (j, i) (b ββ a) := by
rw [gradedCommAux]
dsimp
simp [mul_comm i j]
@[simp]
theorem gradedCommAux_comp_gradedCommAux :
gradedCommAux R π β¬ ββ gradedCommAux R β¬ π = LinearMap.id := by
ext i a b
dsimp
rw [gradedCommAux_lof_tmul, LinearMap.map_smul_of_tower, gradedCommAux_lof_tmul, smul_smul,
mul_comm i.2 i.1, Int.units_mul_self, one_smul]
def gradedComm :
(β¨ i, π i) β[R] (β¨ i, β¬ i) ββ[R] (β¨ i, β¬ i) β[R] (β¨ i, π i) := by
refine TensorProduct.directSum R R π β¬ βͺβ«β ?_ βͺβ«β (TensorProduct.directSum R R β¬ π).symm
exact LinearEquiv.ofLinear (gradedCommAux _ _ _) (gradedCommAux _ _ _)
(gradedCommAux_comp_gradedCommAux _ _ _) (gradedCommAux_comp_gradedCommAux _ _ _)
@[simp]
theorem gradedComm_symm : (gradedComm R π β¬).symm = gradedComm R β¬ π := by
rw [gradedComm, gradedComm, LinearEquiv.trans_symm, LinearEquiv.symm_symm]
ext
rfl
theorem gradedComm_of_tmul_of (i j : ΞΉ) (a : π i) (b : β¬ j) :
gradedComm R π β¬ (lof R _ π i a ββ lof R _ β¬ j b) =
(-1 : β€Λ£)^(j * i) β’ (lof R _ β¬ _ b ββ lof R _ π _ a) := by
rw [gradedComm]
dsimp only [LinearEquiv.trans_apply, LinearEquiv.ofLinear_apply]
rw [TensorProduct.directSum_lof_tmul_lof, gradedCommAux_lof_tmul, Units.smul_def,
-- Note: #8386 specialized `map_smul` to `LinearEquiv.map_smul` to avoid timeouts.
zsmul_eq_smul_cast R, LinearEquiv.map_smul, TensorProduct.directSum_symm_lof_tmul,
β zsmul_eq_smul_cast, β Units.smul_def]
| Mathlib/LinearAlgebra/TensorProduct/Graded/External.lean | 126 | 135 | theorem gradedComm_tmul_of_zero (a : β¨ i, π i) (b : β¬ 0) :
gradedComm R π β¬ (a ββ lof R _ β¬ 0 b) = lof R _ β¬ _ b ββ a := by |
suffices
(gradedComm R π β¬).toLinearMap ββ
(TensorProduct.mk R (β¨ i, π i) (β¨ i, β¬ i)).flip (lof R _ β¬ 0 b) =
TensorProduct.mk R _ _ (lof R _ β¬ 0 b) from
DFunLike.congr_fun this a
ext i a
dsimp
rw [gradedComm_of_tmul_of, zero_mul, uzpow_zero, one_smul]
| [
" (β¨ (i : ΞΉ Γ ΞΉ), π i.1 β[R] β¬ i.2) ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" π i.1 β[R] β¬ i.2 ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" (gradedCommAux R π β¬) ((lof R (ΞΉ Γ ΞΉ) (fun i => π i.1 β[R] β¬ i.2) (i, j)) (a ββ[R] b)) =\n (-1) ^ (j * i) β’ (lof R (ΞΉ Γ ΞΉ) (fun i => β¬ i.1 β[R] π i.2) (j, i)) (b ββ[... | [
" (β¨ (i : ΞΉ Γ ΞΉ), π i.1 β[R] β¬ i.2) ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" π i.1 β[R] β¬ i.2 ββ[R] β¨ (i : ΞΉ Γ ΞΉ), β¬ i.1 β[R] π i.2",
" (gradedCommAux R π β¬) ((lof R (ΞΉ Γ ΞΉ) (fun i => π i.1 β[R] β¬ i.2) (i, j)) (a ββ[R] b)) =\n (-1) ^ (j * i) β’ (lof R (ΞΉ Γ ΞΉ) (fun i => β¬ i.1 β[R] π i.2) (j, i)) (b ββ[... |
import Mathlib.Algebra.Bounds
import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Set
open Pointwise
variable {Ξ± : Type*}
-- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice`
-- due to simpNF problem between `sSup_xx` `csSup_xx`.
section CompleteLattice
variable [CompleteLattice Ξ±]
namespace LinearOrderedField
variable {K : Type*} [LinearOrderedField K] {a b r : K} (hr : 0 < r)
open Set
theorem smul_Ioo : r β’ Ioo a b = Ioo (r β’ a) (r β’ b) := by
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Ioo]
constructor
Β· rintro β¨a, β¨a_h_left_left, a_h_left_rightβ©, rflβ©
constructor
Β· exact (mul_lt_mul_left hr).mpr a_h_left_left
Β· exact (mul_lt_mul_left hr).mpr a_h_left_right
Β· rintro β¨a_left, a_rightβ©
use x / r
refine β¨β¨(lt_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_rightβ©, ?_β©
rw [mul_div_cancelβ _ (ne_of_gt hr)]
#align linear_ordered_field.smul_Ioo LinearOrderedField.smul_Ioo
theorem smul_Icc : r β’ Icc a b = Icc (r β’ a) (r β’ b) := by
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Icc]
constructor
Β· rintro β¨a, β¨a_h_left_left, a_h_left_rightβ©, rflβ©
constructor
Β· exact (mul_le_mul_left hr).mpr a_h_left_left
Β· exact (mul_le_mul_left hr).mpr a_h_left_right
Β· rintro β¨a_left, a_rightβ©
use x / r
refine β¨β¨(le_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_rightβ©, ?_β©
rw [mul_div_cancelβ _ (ne_of_gt hr)]
#align linear_ordered_field.smul_Icc LinearOrderedField.smul_Icc
theorem smul_Ico : r β’ Ico a b = Ico (r β’ a) (r β’ b) := by
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Ico]
constructor
Β· rintro β¨a, β¨a_h_left_left, a_h_left_rightβ©, rflβ©
constructor
Β· exact (mul_le_mul_left hr).mpr a_h_left_left
Β· exact (mul_lt_mul_left hr).mpr a_h_left_right
Β· rintro β¨a_left, a_rightβ©
use x / r
refine β¨β¨(le_div_iff' hr).mpr a_left, (div_lt_iff' hr).mpr a_rightβ©, ?_β©
rw [mul_div_cancelβ _ (ne_of_gt hr)]
#align linear_ordered_field.smul_Ico LinearOrderedField.smul_Ico
| Mathlib/Algebra/Order/Pointwise.lean | 225 | 236 | theorem smul_Ioc : r β’ Ioc a b = Ioc (r β’ a) (r β’ b) := by |
ext x
simp only [mem_smul_set, smul_eq_mul, mem_Ioc]
constructor
Β· rintro β¨a, β¨a_h_left_left, a_h_left_rightβ©, rflβ©
constructor
Β· exact (mul_lt_mul_left hr).mpr a_h_left_left
Β· exact (mul_le_mul_left hr).mpr a_h_left_right
Β· rintro β¨a_left, a_rightβ©
use x / r
refine β¨β¨(lt_div_iff' hr).mpr a_left, (div_le_iff' hr).mpr a_rightβ©, ?_β©
rw [mul_div_cancelβ _ (ne_of_gt hr)]
| [
" r β’ Ioo a b = Ioo (r β’ a) (r β’ b)",
" x β r β’ Ioo a b β x β Ioo (r β’ a) (r β’ b)",
" (β y, (a < y β§ y < b) β§ r * y = x) β r * a < x β§ x < r * b",
" (β y, (a < y β§ y < b) β§ r * y = x) β r * a < x β§ x < r * b",
" r * aβ < r * a β§ r * a < r * b",
" r * aβ < r * a",
" r * a < r * b",
" r * a < x β§ x < r ... | [
" r β’ Ioo a b = Ioo (r β’ a) (r β’ b)",
" x β r β’ Ioo a b β x β Ioo (r β’ a) (r β’ b)",
" (β y, (a < y β§ y < b) β§ r * y = x) β r * a < x β§ x < r * b",
" (β y, (a < y β§ y < b) β§ r * y = x) β r * a < x β§ x < r * b",
" r * aβ < r * a β§ r * a < r * b",
" r * aβ < r * a",
" r * a < r * b",
" r * a < x β§ x < r ... |
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
#align_import linear_algebra.clifford_algebra.star from "leanprover-community/mathlib"@"4d66277cfec381260ba05c68f9ae6ce2a118031d"
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
namespace CliffordAlgebra
instance instStarRing : StarRing (CliffordAlgebra Q) where
star x := reverse (involute x)
star_involutive x := by
simp only [reverse_involute_commute.eq, reverse_reverse, involute_involute]
star_mul x y := by simp only [map_mul, reverse.map_mul]
star_add x y := by simp only [map_add]
theorem star_def (x : CliffordAlgebra Q) : star x = reverse (involute x) :=
rfl
#align clifford_algebra.star_def CliffordAlgebra.star_def
theorem star_def' (x : CliffordAlgebra Q) : star x = involute (reverse x) :=
reverse_involute _
#align clifford_algebra.star_def' CliffordAlgebra.star_def'
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Star.lean | 50 | 50 | theorem star_ΞΉ (m : M) : star (ΞΉ Q m) = -ΞΉ Q m := by | rw [star_def, involute_ΞΉ, map_neg, reverse_ΞΉ]
| [
" star (star x) = x",
" star (x * y) = star y * star x",
" star (x + y) = star x + star y",
" star ((ΞΉ Q) m) = -(ΞΉ Q) m"
] | [
" star (star x) = x",
" star (x * y) = star y * star x",
" star (x + y) = star x + star y",
" star ((ΞΉ Q) m) = -(ΞΉ Q) m"
] |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Analysis.InnerProductSpace.l2Space
import Mathlib.MeasureTheory.Function.ContinuousMapDense
import Mathlib.MeasureTheory.Function.L2Space
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.Periodic
import Mathlib.Topology.ContinuousFunction.StoneWeierstrass
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
open scoped ENNReal ComplexConjugate Real
open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set
variable {T : β}
open AddCircle
section Monomials
def fourier (n : β€) : C(AddCircle T, β) where
toFun x := toCircle (n β’ x :)
continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _
#align fourier fourier
@[simp]
theorem fourier_apply {n : β€} {x : AddCircle T} : fourier n x = toCircle (n β’ x :) :=
rfl
#align fourier_apply fourier_apply
-- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'`
| Mathlib/Analysis/Fourier/AddCircle.lean | 117 | 123 | theorem fourier_coe_apply {n : β€} {x : β} :
fourier n (x : AddCircle T) = Complex.exp (2 * Ο * Complex.I * n * x / T) := by |
rw [fourier_apply, β QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe,
expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul,
Complex.ofReal_mul, Complex.ofReal_intCast]
norm_num
congr 1; ring
| [
" (fourier n) βx = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (β2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" (2 * βΟ / βT * (βn * βx) * Complex.I).exp = (2 * βΟ * Complex.I * βn * βx / βT).exp",
" 2 * βΟ / βT * (βn * βx) * Complex.I = 2 * βΟ * Complex.I * βn * βx / β... | [
" (fourier n) βx = (2 * βΟ * Complex.I * βn * βx / βT).exp"
] |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {ΞΈ : β} : cos ΞΈ = 0 β β k : β€, ΞΈ = (2 * k + 1) * Ο / 2 := by
have h : (exp (ΞΈ * I) + exp (-ΞΈ * I)) / 2 = 0 β exp (2 * ΞΈ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (ΞΈ * I) + exp (-ΞΈ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, β div_eq_iff (exp_ne_zero _), β exp_sub]
ring_nf
rw [cos, h, β exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {ΞΈ : β} : cos ΞΈ β 0 β β k : β€, ΞΈ β (2 * k + 1) * Ο / 2 := by
rw [β not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {ΞΈ : β} : sin ΞΈ = 0 β β k : β€, ΞΈ = k * Ο := by
rw [β Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
Β· rintro β¨k, hkβ©
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
Β· rintro β¨k, rflβ©
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 60 | 61 | theorem sin_ne_zero_iff {ΞΈ : β} : sin ΞΈ β 0 β β k : β€, ΞΈ β k * Ο := by |
rw [β not_exists, not_iff_not, sin_eq_zero_iff]
| [
" ΞΈ.cos = 0 β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" (cexp (ΞΈ * I) + cexp (-ΞΈ * I)) / 2 = 0 β cexp (2 * ΞΈ * I) = -1",
" cexp (ΞΈ * I - -ΞΈ * I) = -1 β cexp (2 * ΞΈ * I) = -1",
" (β n, 2 * I * ΞΈ = βΟ * I + βn * (2 * βΟ * I)) β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" 2 * I * ΞΈ = βΟ * I + βx * (2 * βΟ * I) β ΞΈ = (2 * βx +... | [
" ΞΈ.cos = 0 β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" (cexp (ΞΈ * I) + cexp (-ΞΈ * I)) / 2 = 0 β cexp (2 * ΞΈ * I) = -1",
" cexp (ΞΈ * I - -ΞΈ * I) = -1 β cexp (2 * ΞΈ * I) = -1",
" (β n, 2 * I * ΞΈ = βΟ * I + βn * (2 * βΟ * I)) β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" 2 * I * ΞΈ = βΟ * I + βx * (2 * βΟ * I) β ΞΈ = (2 * βx +... |
import Mathlib.Algebra.IsPrimePow
import Mathlib.Algebra.Squarefree.Basic
import Mathlib.Order.Hom.Bounded
import Mathlib.Algebra.GCDMonoid.Basic
#align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {M : Type*} [CancelCommMonoidWithZero M]
theorem Associates.isAtom_iff {p : Associates M} (hβ : p β 0) : IsAtom p β Irreducible p :=
β¨fun hp =>
β¨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h =>
(hp.le_iff.mp β¨_, hβ©).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha =>
Or.inr
(show IsUnit b by
rw [ha] at h
apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) hβ)β©,
fun hp =>
β¨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1,
fun b β¨β¨a, habβ©, hbβ© =>
(hp.isUnit_or_isUnit hab).casesOn
(fun hb => show b = β₯ by rwa [Associates.isUnit_iff_eq_one, β Associates.bot_eq_one] at hb)
fun ha =>
absurd
(show p β£ b from
β¨(ha.unitβ»ΒΉ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]β©)
hbβ©β©
#align associates.is_atom_iff Associates.isAtom_iff
open UniqueFactorizationMonoid multiplicity Irreducible Associates
namespace DivisorChain
theorem exists_chain_of_prime_pow {p : Associates M} {n : β} (hn : n β 0) (hp : Prime p) :
β c : Fin (n + 1) β Associates M,
c 1 = p β§ StrictMono c β§ β {r : Associates M}, r β€ p ^ n β β i, r = c i := by
refine β¨fun i => p ^ (i : β), ?_, fun n m h => ?_, @fun y => β¨fun h => ?_, ?_β©β©
Β· dsimp only
rw [Fin.val_one', Nat.mod_eq_of_lt, pow_one]
exact Nat.lt_succ_of_le (Nat.one_le_iff_ne_zero.mpr hn)
Β· exact Associates.dvdNotUnit_iff_lt.mp
β¨pow_ne_zero n hp.ne_zero, p ^ (m - n : β),
not_isUnit_of_not_isUnit_dvd hp.not_unit (dvd_pow dvd_rfl (Nat.sub_pos_of_lt h).ne'),
(pow_mul_pow_sub p h.le).symmβ©
Β· obtain β¨i, i_le, hiβ© := (dvd_prime_pow hp n).1 h
rw [associated_iff_eq] at hi
exact β¨β¨i, Nat.lt_succ_of_le i_leβ©, hiβ©
Β· rintro β¨i, rflβ©
exact β¨p ^ (n - i : β), (pow_mul_pow_sub p (Nat.succ_le_succ_iff.mp i.2)).symmβ©
#align divisor_chain.exists_chain_of_prime_pow DivisorChain.exists_chain_of_prime_pow
theorem element_of_chain_not_isUnit_of_index_ne_zero {n : β} {i : Fin (n + 1)} (i_pos : i β 0)
{c : Fin (n + 1) β Associates M} (hβ : StrictMono c) : Β¬IsUnit (c i) :=
DvdNotUnit.not_unit
(Associates.dvdNotUnit_iff_lt.2
(hβ <| show (0 : Fin (n + 1)) < i from Fin.pos_iff_ne_zero.mpr i_pos))
#align divisor_chain.element_of_chain_not_is_unit_of_index_ne_zero DivisorChain.element_of_chain_not_isUnit_of_index_ne_zero
theorem first_of_chain_isUnit {q : Associates M} {n : β} {c : Fin (n + 1) β Associates M}
(hβ : StrictMono c) (hβ : β {r}, r β€ q β β i, r = c i) : IsUnit (c 0) := by
obtain β¨i, hrβ© := hβ.mp Associates.one_le
rw [Associates.isUnit_iff_eq_one, β Associates.le_one_iff, hr]
exact hβ.monotone (Fin.zero_le i)
#align divisor_chain.first_of_chain_is_unit DivisorChain.first_of_chain_isUnit
| Mathlib/RingTheory/ChainOfDivisors.lean | 99 | 108 | theorem second_of_chain_is_irreducible {q : Associates M} {n : β} (hn : n β 0)
{c : Fin (n + 1) β Associates M} (hβ : StrictMono c) (hβ : β {r}, r β€ q β β i, r = c i)
(hq : q β 0) : Irreducible (c 1) := by |
cases' n with n; Β· contradiction
refine (Associates.isAtom_iff (ne_zero_of_dvd_ne_zero hq (hβ.2 β¨1, rflβ©))).mp β¨?_, fun b hb => ?_β©
Β· exact ne_bot_of_gt (hβ (show (0 : Fin (n + 2)) < 1 from Fin.one_pos))
obtain β¨β¨i, hiβ©, rflβ© := hβ.1 (hb.le.trans (hβ.2 β¨1, rflβ©))
cases i
Β· exact (Associates.isUnit_iff_eq_one _).mp (first_of_chain_isUnit hβ @hβ)
Β· simpa [Fin.lt_iff_val_lt_val] using hβ.lt_iff_lt.mp hb
| [
" Β¬IsUnit p",
" IsUnit b",
" Associated (p * b) p",
"M : Type u_1\ninstβ : CancelCommMonoidWithZero M\np : Associates M\nhβ : p β 0\nhp : IsAtom p\na b : Associates M\nh : p = p * b\nha : a = p\n| p",
" p β β₯",
" b = β₯",
" b = p * βha.unitβ»ΒΉ",
" β c, c 1 = p β§ StrictMono c β§ β {r : Associates M}, r β€ ... | [
" Β¬IsUnit p",
" IsUnit b",
" Associated (p * b) p",
"M : Type u_1\ninstβ : CancelCommMonoidWithZero M\np : Associates M\nhβ : p β 0\nhp : IsAtom p\na b : Associates M\nh : p = p * b\nha : a = p\n| p",
" p β β₯",
" b = β₯",
" b = p * βha.unitβ»ΒΉ",
" β c, c 1 = p β§ StrictMono c β§ β {r : Associates M}, r β€ ... |
import Mathlib.FieldTheory.RatFunc.Defs
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u v
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
variable {K : Type u}
namespace RatFunc
section Field
variable [CommRing K]
protected irreducible_def zero : RatFunc K :=
β¨0β©
#align ratfunc.zero RatFunc.zero
instance : Zero (RatFunc K) :=
β¨RatFunc.zeroβ©
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]`
-- that does not close the goal
theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by
simp only [Zero.zero, OfNat.ofNat, RatFunc.zero]
#align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero
protected irreducible_def add : RatFunc K β RatFunc K β RatFunc K
| β¨pβ©, β¨qβ© => β¨p + qβ©
#align ratfunc.add RatFunc.add
instance : Add (RatFunc K) :=
β¨RatFunc.addβ©
-- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]`
-- that does not close the goal
theorem ofFractionRing_add (p q : FractionRing K[X]) :
ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by
simp only [HAdd.hAdd, Add.add, RatFunc.add]
#align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add
protected irreducible_def sub : RatFunc K β RatFunc K β RatFunc K
| β¨pβ©, β¨qβ© => β¨p - qβ©
#align ratfunc.sub RatFunc.sub
instance : Sub (RatFunc K) :=
β¨RatFunc.subβ©
-- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]`
-- that does not close the goal
theorem ofFractionRing_sub (p q : FractionRing K[X]) :
ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by
simp only [Sub.sub, HSub.hSub, RatFunc.sub]
#align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub
protected irreducible_def neg : RatFunc K β RatFunc K
| β¨pβ© => β¨-pβ©
#align ratfunc.neg RatFunc.neg
instance : Neg (RatFunc K) :=
β¨RatFunc.negβ©
theorem ofFractionRing_neg (p : FractionRing K[X]) :
ofFractionRing (-p) = -ofFractionRing p := by simp only [Neg.neg, RatFunc.neg]
#align ratfunc.of_fraction_ring_neg RatFunc.ofFractionRing_neg
protected irreducible_def one : RatFunc K :=
β¨1β©
#align ratfunc.one RatFunc.one
instance : One (RatFunc K) :=
β¨RatFunc.oneβ©
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [one_def]`
-- that does not close the goal
| Mathlib/FieldTheory/RatFunc/Basic.lean | 131 | 132 | theorem ofFractionRing_one : (ofFractionRing 1 : RatFunc K) = 1 := by |
simp only [One.one, OfNat.ofNat, RatFunc.one]
| [
" { toFractionRing := 0 } = 0",
" { toFractionRing := p + q } = { toFractionRing := p } + { toFractionRing := q }",
" { toFractionRing := p - q } = { toFractionRing := p } - { toFractionRing := q }",
" { toFractionRing := -p } = -{ toFractionRing := p }",
" { toFractionRing := 1 } = 1"
] | [
" { toFractionRing := 0 } = 0",
" { toFractionRing := p + q } = { toFractionRing := p } + { toFractionRing := q }",
" { toFractionRing := p - q } = { toFractionRing := p } - { toFractionRing := q }",
" { toFractionRing := -p } = -{ toFractionRing := p }",
" { toFractionRing := 1 } = 1"
] |
import Mathlib.Algebra.Group.Commutator
import Mathlib.Algebra.Group.Subgroup.Finite
import Mathlib.Data.Bracket
import Mathlib.GroupTheory.Subgroup.Centralizer
import Mathlib.Tactic.Group
#align_import group_theory.commutator from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
variable {G G' F : Type*} [Group G] [Group G'] [FunLike F G G'] [MonoidHomClass F G G']
variable (f : F) {gβ gβ gβ g : G}
theorem commutatorElement_eq_one_iff_mul_comm : β
gβ, gββ = 1 β gβ * gβ = gβ * gβ := by
rw [commutatorElement_def, mul_inv_eq_one, mul_inv_eq_iff_eq_mul]
#align commutator_element_eq_one_iff_mul_comm commutatorElement_eq_one_iff_mul_comm
theorem commutatorElement_eq_one_iff_commute : β
gβ, gββ = 1 β Commute gβ gβ :=
commutatorElement_eq_one_iff_mul_comm
#align commutator_element_eq_one_iff_commute commutatorElement_eq_one_iff_commute
theorem Commute.commutator_eq (h : Commute gβ gβ) : β
gβ, gββ = 1 :=
commutatorElement_eq_one_iff_commute.mpr h
#align commute.commutator_eq Commute.commutator_eq
variable (gβ gβ gβ g)
@[simp]
theorem commutatorElement_one_right : β
g, (1 : G)β = 1 :=
(Commute.one_right g).commutator_eq
#align commutator_element_one_right commutatorElement_one_right
@[simp]
theorem commutatorElement_one_left : β
(1 : G), gβ = 1 :=
(Commute.one_left g).commutator_eq
#align commutator_element_one_left commutatorElement_one_left
@[simp]
theorem commutatorElement_self : β
g, gβ = 1 :=
(Commute.refl g).commutator_eq
#align commutator_element_self commutatorElement_self
@[simp]
theorem commutatorElement_inv : β
gβ, gβββ»ΒΉ = β
gβ, gββ := by
simp_rw [commutatorElement_def, mul_inv_rev, inv_inv, mul_assoc]
#align commutator_element_inv commutatorElement_inv
| Mathlib/GroupTheory/Commutator.lean | 65 | 66 | theorem map_commutatorElement : (f β
gβ, gββ : G') = β
f gβ, f gββ := by |
simp_rw [commutatorElement_def, map_mul f, map_inv f]
| [
" β
gβ, gββ = 1 β gβ * gβ = gβ * gβ",
" β
gβ, gβββ»ΒΉ = β
gβ, gββ",
" f β
gβ, gββ = β
f gβ, f gββ"
] | [
" β
gβ, gββ = 1 β gβ * gβ = gβ * gβ",
" β
gβ, gβββ»ΒΉ = β
gβ, gββ",
" f β
gβ, gββ = β
f gβ, f gββ"
] |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Field.Rat
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Field.Rat
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.lym from "leanprover-community/mathlib"@"861a26926586cd46ff80264d121cdb6fa0e35cc1"
open Finset Nat
open FinsetFamily
variable {π Ξ± : Type*} [LinearOrderedField π]
namespace Finset
section LocalLYM
variable [DecidableEq Ξ±] [Fintype Ξ±]
{π : Finset (Finset Ξ±)} {r : β}
| Mathlib/Combinatorics/SetFamily/LYM.lean | 65 | 87 | theorem card_mul_le_card_shadow_mul (hπ : (π : Set (Finset Ξ±)).Sized r) :
π.card * r β€ (β π).card * (Fintype.card Ξ± - r + 1) := by |
let i : DecidableRel ((Β· β Β·) : Finset Ξ± β Finset Ξ± β Prop) := fun _ _ => Classical.dec _
refine card_mul_le_card_mul' (Β· β Β·) (fun s hs => ?_) (fun s hs => ?_)
Β· rw [β hπ hs, β card_image_of_injOn s.erase_injOn]
refine card_le_card ?_
simp_rw [image_subset_iff, mem_bipartiteBelow]
exact fun a ha => β¨erase_mem_shadow hs ha, erase_subset _ _β©
refine le_trans ?_ tsub_tsub_le_tsub_add
rw [β (Set.Sized.shadow hπ) hs, β card_compl, β card_image_of_injOn (insert_inj_on' _)]
refine card_le_card fun t ht => ?_
-- Porting note: commented out the following line
-- infer_instance
rw [mem_bipartiteAbove] at ht
have : β
β π := by
rw [β mem_coe, hπ.empty_mem_iff, coe_eq_singleton]
rintro rfl
rw [shadow_singleton_empty] at hs
exact not_mem_empty s hs
have h := exists_eq_insert_iff.2 β¨ht.2, by
rw [(sized_shadow_iff this).1 (Set.Sized.shadow hπ) ht.1, (Set.Sized.shadow hπ) hs]β©
rcases h with β¨a, ha, rflβ©
exact mem_image_of_mem _ (mem_compl.2 ha)
| [
" π.card * r β€ (β π).card * (Fintype.card Ξ± - r + 1)",
" r β€ (bipartiteBelow (fun x x_1 => x β x_1) (β π) s).card",
" (image s.erase s).card β€ (bipartiteBelow (fun x x_1 => x β x_1) (β π) s).card",
" image s.erase s β bipartiteBelow (fun x x_1 => x β x_1) (β π) s",
" β x β s, s.erase x β β π β§ s.erase... | [
" π.card * r β€ (β π).card * (Fintype.card Ξ± - r + 1)"
] |
import Mathlib.Data.Multiset.Sum
import Mathlib.Data.Finset.Card
#align_import data.finset.sum from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999"
open Function Multiset Sum
namespace Finset
variable {Ξ± Ξ² : Type*} (s : Finset Ξ±) (t : Finset Ξ²)
def disjSum : Finset (Sum Ξ± Ξ²) :=
β¨s.1.disjSum t.1, s.2.disjSum t.2β©
#align finset.disj_sum Finset.disjSum
@[simp]
theorem val_disjSum : (s.disjSum t).1 = s.1.disjSum t.1 :=
rfl
#align finset.val_disj_sum Finset.val_disjSum
@[simp]
theorem empty_disjSum : (β
: Finset Ξ±).disjSum t = t.map Embedding.inr :=
val_inj.1 <| Multiset.zero_disjSum _
#align finset.empty_disj_sum Finset.empty_disjSum
@[simp]
theorem disjSum_empty : s.disjSum (β
: Finset Ξ²) = s.map Embedding.inl :=
val_inj.1 <| Multiset.disjSum_zero _
#align finset.disj_sum_empty Finset.disjSum_empty
@[simp]
theorem card_disjSum : (s.disjSum t).card = s.card + t.card :=
Multiset.card_disjSum _ _
#align finset.card_disj_sum Finset.card_disjSum
| Mathlib/Data/Finset/Sum.lean | 54 | 56 | theorem disjoint_map_inl_map_inr : Disjoint (s.map Embedding.inl) (t.map Embedding.inr) := by |
simp_rw [disjoint_left, mem_map]
rintro x β¨a, _, rflβ© β¨b, _, β¨β©β©
| [
" _root_.Disjoint (map Embedding.inl s) (map Embedding.inr t)",
" β β¦a : Ξ± β Ξ²β¦, (β a_1 β s, Embedding.inl a_1 = a) β Β¬β a_2 β t, Embedding.inr a_2 = a"
] | [
" _root_.Disjoint (map Embedding.inl s) (map Embedding.inr t)"
] |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import algebra.gcd_monoid.multiset from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
namespace Multiset
variable {Ξ± : Type*} [CancelCommMonoidWithZero Ξ±] [NormalizedGCDMonoid Ξ±]
section gcd
def gcd (s : Multiset Ξ±) : Ξ± :=
s.fold GCDMonoid.gcd 0
#align multiset.gcd Multiset.gcd
@[simp]
theorem gcd_zero : (0 : Multiset Ξ±).gcd = 0 :=
fold_zero _ _
#align multiset.gcd_zero Multiset.gcd_zero
@[simp]
theorem gcd_cons (a : Ξ±) (s : Multiset Ξ±) : (a ::β s).gcd = GCDMonoid.gcd a s.gcd :=
fold_cons_left _ _ _ _
#align multiset.gcd_cons Multiset.gcd_cons
@[simp]
theorem gcd_singleton {a : Ξ±} : ({a} : Multiset Ξ±).gcd = normalize a :=
(fold_singleton _ _ _).trans <| gcd_zero_right _
#align multiset.gcd_singleton Multiset.gcd_singleton
@[simp]
theorem gcd_add (sβ sβ : Multiset Ξ±) : (sβ + sβ).gcd = GCDMonoid.gcd sβ.gcd sβ.gcd :=
Eq.trans (by simp [gcd]) (fold_add _ _ _ _ _)
#align multiset.gcd_add Multiset.gcd_add
theorem dvd_gcd {s : Multiset Ξ±} {a : Ξ±} : a β£ s.gcd β β b β s, a β£ b :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and, dvd_gcd_iff])
#align multiset.dvd_gcd Multiset.dvd_gcd
theorem gcd_dvd {s : Multiset Ξ±} {a : Ξ±} (h : a β s) : s.gcd β£ a :=
dvd_gcd.1 dvd_rfl _ h
#align multiset.gcd_dvd Multiset.gcd_dvd
theorem gcd_mono {sβ sβ : Multiset Ξ±} (h : sβ β sβ) : sβ.gcd β£ sβ.gcd :=
dvd_gcd.2 fun _ hb β¦ gcd_dvd (h hb)
#align multiset.gcd_mono Multiset.gcd_mono
@[simp 1100]
theorem normalize_gcd (s : Multiset Ξ±) : normalize s.gcd = s.gcd :=
Multiset.induction_on s (by simp) fun a s _ β¦ by simp
#align multiset.normalize_gcd Multiset.normalize_gcd
theorem gcd_eq_zero_iff (s : Multiset Ξ±) : s.gcd = 0 β β x : Ξ±, x β s β x = 0 := by
constructor
Β· intro h x hx
apply eq_zero_of_zero_dvd
rw [β h]
apply gcd_dvd hx
Β· refine s.induction_on ?_ ?_
Β· simp
intro a s sgcd h
simp [h a (mem_cons_self a s), sgcd fun x hx β¦ h x (mem_cons_of_mem hx)]
#align multiset.gcd_eq_zero_iff Multiset.gcd_eq_zero_iff
theorem gcd_map_mul (a : Ξ±) (s : Multiset Ξ±) : (s.map (a * Β·)).gcd = normalize a * s.gcd := by
refine s.induction_on ?_ fun b s ih β¦ ?_
Β· simp_rw [map_zero, gcd_zero, mul_zero]
Β· simp_rw [map_cons, gcd_cons, β gcd_mul_left]
rw [ih]
apply ((normalize_associated a).mul_right _).gcd_eq_right
#align multiset.gcd_map_mul Multiset.gcd_map_mul
section
variable [DecidableEq Ξ±]
@[simp]
theorem gcd_dedup (s : Multiset Ξ±) : (dedup s).gcd = s.gcd :=
Multiset.induction_on s (by simp) fun a s IH β¦ by
by_cases h : a β s <;> simp [IH, h]
unfold gcd
rw [β cons_erase h, fold_cons_left, β gcd_assoc, gcd_same]
apply (associated_normalize _).gcd_eq_left
#align multiset.gcd_dedup Multiset.gcd_dedup
@[simp]
theorem gcd_ndunion (sβ sβ : Multiset Ξ±) : (ndunion sβ sβ).gcd = GCDMonoid.gcd sβ.gcd sβ.gcd := by
rw [β gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add]
simp
#align multiset.gcd_ndunion Multiset.gcd_ndunion
@[simp]
theorem gcd_union (sβ sβ : Multiset Ξ±) : (sβ βͺ sβ).gcd = GCDMonoid.gcd sβ.gcd sβ.gcd := by
rw [β gcd_dedup, dedup_ext.2, gcd_dedup, gcd_add]
simp
#align multiset.gcd_union Multiset.gcd_union
@[simp]
| Mathlib/Algebra/GCDMonoid/Multiset.lean | 219 | 221 | theorem gcd_ndinsert (a : Ξ±) (s : Multiset Ξ±) : (ndinsert a s).gcd = GCDMonoid.gcd a s.gcd := by |
rw [β gcd_dedup, dedup_ext.2, gcd_dedup, gcd_cons]
simp
| [
" (sβ + sβ).gcd = fold GCDMonoid.gcd (GCDMonoid.gcd 0 0) (sβ + sβ)",
" a β£ gcd 0 β β b β 0, a β£ b",
" β (a_1 : Ξ±) (s : Multiset Ξ±), (a β£ s.gcd β β b β s, a β£ b) β (a β£ (a_1 ::β s).gcd β β b β a_1 ::β s, a β£ b)",
" normalize (gcd 0) = gcd 0",
" normalize (a ::β s).gcd = (a ::β s).gcd",
" s.gcd = 0 β β x β ... | [
" (sβ + sβ).gcd = fold GCDMonoid.gcd (GCDMonoid.gcd 0 0) (sβ + sβ)",
" a β£ gcd 0 β β b β 0, a β£ b",
" β (a_1 : Ξ±) (s : Multiset Ξ±), (a β£ s.gcd β β b β s, a β£ b) β (a β£ (a_1 ::β s).gcd β β b β a_1 ::β s, a β£ b)",
" normalize (gcd 0) = gcd 0",
" normalize (a ::β s).gcd = (a ::β s).gcd",
" s.gcd = 0 β β x β ... |
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Measure.Haar.Quotient
import Mathlib.MeasureTheory.Constructions.Polish
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Topology.Algebra.Order.Floor
#align_import measure_theory.integral.periodic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Function MeasureTheory MeasureTheory.Measure TopologicalSpace AddSubgroup intervalIntegral
open scoped MeasureTheory NNReal ENNReal
@[measurability]
protected theorem AddCircle.measurable_mk' {a : β} :
Measurable (Ξ² := AddCircle a) ((β) : β β AddCircle a) :=
Continuous.measurable <| AddCircle.continuous_mk' a
#align add_circle.measurable_mk' AddCircle.measurable_mk'
theorem isAddFundamentalDomain_Ioc {T : β} (hT : 0 < T) (t : β)
(ΞΌ : Measure β := by volume_tac) :
IsAddFundamentalDomain (AddSubgroup.zmultiples T) (Ioc t (t + T)) ΞΌ := by
refine IsAddFundamentalDomain.mk' measurableSet_Ioc.nullMeasurableSet fun x => ?_
have : Bijective (codRestrict (fun n : β€ => n β’ T) (AddSubgroup.zmultiples T) _) :=
(Equiv.ofInjective (fun n : β€ => n β’ T) (zsmul_strictMono_left hT).injective).bijective
refine this.existsUnique_iff.2 ?_
simpa only [add_comm x] using existsUnique_add_zsmul_mem_Ioc hT x t
#align is_add_fundamental_domain_Ioc isAddFundamentalDomain_Ioc
theorem isAddFundamentalDomain_Ioc' {T : β} (hT : 0 < T) (t : β) (ΞΌ : Measure β := by volume_tac) :
IsAddFundamentalDomain (AddSubgroup.op <| .zmultiples T) (Ioc t (t + T)) ΞΌ := by
refine IsAddFundamentalDomain.mk' measurableSet_Ioc.nullMeasurableSet fun x => ?_
have : Bijective (codRestrict (fun n : β€ => n β’ T) (AddSubgroup.zmultiples T) _) :=
(Equiv.ofInjective (fun n : β€ => n β’ T) (zsmul_strictMono_left hT).injective).bijective
refine (AddSubgroup.equivOp _).bijective.comp this |>.existsUnique_iff.2 ?_
simpa using existsUnique_add_zsmul_mem_Ioc hT x t
#align is_add_fundamental_domain_Ioc' isAddFundamentalDomain_Ioc'
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E]
namespace Function
namespace Periodic
variable {f : β β E} {T : β}
| Mathlib/MeasureTheory/Integral/Periodic.lean | 256 | 262 | theorem intervalIntegral_add_eq_of_pos (hf : Periodic f T) (hT : 0 < T) (t s : β) :
β« x in t..t + T, f x = β« x in s..s + T, f x := by |
simp only [integral_of_le, hT.le, le_add_iff_nonneg_right]
haveI : VAddInvariantMeasure (AddSubgroup.zmultiples T) β volume :=
β¨fun c s _ => measure_preimage_add _ _ _β©
apply IsAddFundamentalDomain.setIntegral_eq (G := AddSubgroup.zmultiples T)
exacts [isAddFundamentalDomain_Ioc hT t, isAddFundamentalDomain_Ioc hT s, hf.map_vadd_zmultiples]
| [
" IsAddFundamentalDomain (β₯(zmultiples T)) (Ioc t (t + T)) ΞΌ",
" β! g, g +α΅₯ x β Ioc t (t + T)",
" β! x_1, codRestrict (fun n => n β’ T) β(zmultiples T) β― x_1 +α΅₯ x β Ioc t (t + T)",
" IsAddFundamentalDomain (β₯(zmultiples T).op) (Ioc t (t + T)) ΞΌ",
" β! x_1, (β(zmultiples T).equivOp β codRestrict (fun n => n β’... | [
" IsAddFundamentalDomain (β₯(zmultiples T)) (Ioc t (t + T)) ΞΌ",
" β! g, g +α΅₯ x β Ioc t (t + T)",
" β! x_1, codRestrict (fun n => n β’ T) β(zmultiples T) β― x_1 +α΅₯ x β Ioc t (t + T)",
" IsAddFundamentalDomain (β₯(zmultiples T).op) (Ioc t (t + T)) ΞΌ",
" β! x_1, (β(zmultiples T).equivOp β codRestrict (fun n => n β’... |
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
| Mathlib/Analysis/SpecialFunctions/Pow/Continuity.lean | 53 | 62 | 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
| [
" (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.Data.Vector.Basic
import Mathlib.Data.List.Zip
#align_import data.vector.zip from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
namespace Vector
section ZipWith
variable {Ξ± Ξ² Ξ³ : Type*} {n : β} (f : Ξ± β Ξ² β Ξ³)
def zipWith : Vector Ξ± n β Vector Ξ² n β Vector Ξ³ n := fun x y => β¨List.zipWith f x.1 y.1, by simpβ©
#align vector.zip_with Vector.zipWith
@[simp]
theorem zipWith_toList (x : Vector Ξ± n) (y : Vector Ξ² n) :
(Vector.zipWith f x y).toList = List.zipWith f x.toList y.toList :=
rfl
#align vector.zip_with_to_list Vector.zipWith_toList
@[simp]
| Mathlib/Data/Vector/Zip.lean | 33 | 36 | theorem zipWith_get (x : Vector Ξ± n) (y : Vector Ξ² n) (i) :
(Vector.zipWith f x y).get i = f (x.get i) (y.get i) := by |
dsimp only [Vector.zipWith, Vector.get]
simp only [List.get_zipWith, Fin.cast]
| [
" (List.zipWith f βx βy).length = n",
" (zipWith f x y).get i = f (x.get i) (y.get i)",
" (List.zipWith f βx βy).get (Fin.cast β― i) = f ((βx).get (Fin.cast β― i)) ((βy).get (Fin.cast β― i))"
] | [
" (List.zipWith f βx βy).length = n",
" (zipWith f x y).get i = f (x.get i) (y.get i)"
] |
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Finset.Sum
import Mathlib.Logic.Embedding.Set
#align_import data.fintype.sum from "leanprover-community/mathlib"@"6623e6af705e97002a9054c1c05a980180276fc1"
universe u v
variable {Ξ± Ξ² : Type*}
open Finset
instance (Ξ± : Type u) (Ξ² : Type v) [Fintype Ξ±] [Fintype Ξ²] : Fintype (Sum Ξ± Ξ²) where
elems := univ.disjSum univ
complete := by rintro (_ | _) <;> simp
@[simp]
theorem Finset.univ_disjSum_univ {Ξ± Ξ² : Type*} [Fintype Ξ±] [Fintype Ξ²] :
univ.disjSum univ = (univ : Finset (Sum Ξ± Ξ²)) :=
rfl
#align finset.univ_disj_sum_univ Finset.univ_disjSum_univ
@[simp]
theorem Fintype.card_sum [Fintype Ξ±] [Fintype Ξ²] :
Fintype.card (Sum Ξ± Ξ²) = Fintype.card Ξ± + Fintype.card Ξ² :=
card_disjSum _ _
#align fintype.card_sum Fintype.card_sum
def fintypeOfFintypeNe (a : Ξ±) (h : Fintype { b // b β a }) : Fintype Ξ± :=
Fintype.ofBijective (Sum.elim ((β) : { b // b = a } β Ξ±) ((β) : { b // b β a } β Ξ±)) <| by
classical exact (Equiv.sumCompl (Β· = a)).bijective
#align fintype_of_fintype_ne fintypeOfFintypeNe
theorem image_subtype_ne_univ_eq_image_erase [Fintype Ξ±] [DecidableEq Ξ²] (k : Ξ²) (b : Ξ± β Ξ²) :
image (fun i : { a // b a β k } => b βi) univ = (image b univ).erase k := by
apply subset_antisymm
Β· rw [image_subset_iff]
intro i _
apply mem_erase_of_ne_of_mem i.2 (mem_image_of_mem _ (mem_univ _))
Β· intro i hi
rw [mem_image]
rcases mem_image.1 (erase_subset _ _ hi) with β¨a, _, haβ©
subst ha
exact β¨β¨a, ne_of_mem_erase hiβ©, mem_univ _, rflβ©
#align image_subtype_ne_univ_eq_image_erase image_subtype_ne_univ_eq_image_erase
theorem image_subtype_univ_ssubset_image_univ [Fintype Ξ±] [DecidableEq Ξ²] (k : Ξ²) (b : Ξ± β Ξ²)
(hk : k β Finset.image b univ) (p : Ξ² β Prop) [DecidablePred p] (hp : Β¬p k) :
image (fun i : { a // p (b a) } => b βi) univ β image b univ := by
constructor
Β· intro x hx
rcases mem_image.1 hx with β¨y, _, hyβ©
exact hy βΈ mem_image_of_mem b (mem_univ (y : Ξ±))
Β· intro h
rw [mem_image] at hk
rcases hk with β¨k', _, hk'β©
subst hk'
have := h (mem_image_of_mem b (mem_univ k'))
rw [mem_image] at this
rcases this with β¨j, _, hj'β©
exact hp (hj' βΈ j.2)
#align image_subtype_univ_ssubset_image_univ image_subtype_univ_ssubset_image_univ
theorem Finset.exists_equiv_extend_of_card_eq [Fintype Ξ±] [DecidableEq Ξ²] {t : Finset Ξ²}
(hΞ±t : Fintype.card Ξ± = t.card) {s : Finset Ξ±} {f : Ξ± β Ξ²} (hfst : Finset.image f s β t)
(hfs : Set.InjOn f s) : β g : Ξ± β t, β i β s, (g i : Ξ²) = f i := by
classical
induction' s using Finset.induction with a s has H generalizing f
Β· obtain β¨eβ© : Nonempty (Ξ± β β₯t) := by rwa [β Fintype.card_eq, Fintype.card_coe]
use e
simp
have hfst' : Finset.image f s β t := (Finset.image_mono _ (s.subset_insert a)).trans hfst
have hfs' : Set.InjOn f s := hfs.mono (s.subset_insert a)
obtain β¨g', hg'β© := H hfst' hfs'
have hfat : f a β t := hfst (mem_image_of_mem _ (s.mem_insert_self a))
use g'.trans (Equiv.swap (β¨f a, hfatβ© : t) (g' a))
simp_rw [mem_insert]
rintro i (rfl | hi)
Β· simp
rw [Equiv.trans_apply, Equiv.swap_apply_of_ne_of_ne, hg' _ hi]
Β· exact
ne_of_apply_ne Subtype.val
(ne_of_eq_of_ne (hg' _ hi) <|
hfs.ne (subset_insert _ _ hi) (mem_insert_self _ _) <| ne_of_mem_of_not_mem hi has)
Β· exact g'.injective.ne (ne_of_mem_of_not_mem hi has)
#align finset.exists_equiv_extend_of_card_eq Finset.exists_equiv_extend_of_card_eq
| Mathlib/Data/Fintype/Sum.lean | 105 | 115 | theorem Set.MapsTo.exists_equiv_extend_of_card_eq [Fintype Ξ±] {t : Finset Ξ²}
(hΞ±t : Fintype.card Ξ± = t.card) {s : Set Ξ±} {f : Ξ± β Ξ²} (hfst : s.MapsTo f t)
(hfs : Set.InjOn f s) : β g : Ξ± β t, β i β s, (g i : Ξ²) = f i := by |
classical
let s' : Finset Ξ± := s.toFinset
have hfst' : s'.image f β t := by simpa [s', β Finset.coe_subset] using hfst
have hfs' : Set.InjOn f s' := by simpa [s'] using hfs
obtain β¨g, hgβ© := Finset.exists_equiv_extend_of_card_eq hΞ±t hfst' hfs'
refine β¨g, fun i hi => ?_β©
apply hg
simpa [s'] using hi
| [
" β (x : Ξ± β Ξ²), x β univ.disjSum univ",
" Sum.inl valβ β univ.disjSum univ",
" Sum.inr valβ β univ.disjSum univ",
" Function.Bijective (Sum.elim Subtype.val Subtype.val)",
" image (fun i => b βi) univ = (image b univ).erase k",
" image (fun i => b βi) univ β (image b univ).erase k",
" β x β univ, b βx ... | [
" β (x : Ξ± β Ξ²), x β univ.disjSum univ",
" Sum.inl valβ β univ.disjSum univ",
" Sum.inr valβ β univ.disjSum univ",
" Function.Bijective (Sum.elim Subtype.val Subtype.val)",
" image (fun i => b βi) univ = (image b univ).erase k",
" image (fun i => b βi) univ β (image b univ).erase k",
" β x β univ, b βx ... |
import Mathlib.Analysis.Calculus.Deriv.Slope
import Mathlib.Analysis.Calculus.Deriv.Inv
#align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped Classical Topology Filter
open Function Set Filter
variable {π E : Type*} [NontriviallyNormedField π] [NormedAddCommGroup E] [NormedSpace π E]
noncomputable def dslope (f : π β E) (a : π) : π β E :=
update (slope f a) a (deriv f a)
#align dslope dslope
@[simp]
theorem dslope_same (f : π β E) (a : π) : dslope f a a = deriv f a :=
update_same _ _ _
#align dslope_same dslope_same
variable {f : π β E} {a b : π} {s : Set π}
theorem dslope_of_ne (f : π β E) (h : b β a) : dslope f a b = slope f a b :=
update_noteq h _ _
#align dslope_of_ne dslope_of_ne
theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
(f : E βL[π] F) (g : π β E) (a b : π) (H : a = b β DifferentiableAt π g a) :
dslope (f β g) a b = f (dslope g a b) := by
rcases eq_or_ne b a with (rfl | hne)
Β· simp only [dslope_same]
exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv
Β· simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b
#align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp
theorem eqOn_dslope_slope (f : π β E) (a : π) : EqOn (dslope f a) (slope f a) {a}αΆ := fun _ =>
dslope_of_ne f
#align eq_on_dslope_slope eqOn_dslope_slope
theorem dslope_eventuallyEq_slope_of_ne (f : π β E) (h : b β a) : dslope f a =αΆ [π b] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h)
#align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne
theorem dslope_eventuallyEq_slope_punctured_nhds (f : π β E) : dslope f a =αΆ [π[β ] a] slope f a :=
(eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin
#align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds
@[simp]
theorem sub_smul_dslope (f : π β E) (a b : π) : (b - a) β’ dslope f a b = f b - f a := by
rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *]
#align sub_smul_dslope sub_smul_dslope
| Mathlib/Analysis/Calculus/Dslope.lean | 72 | 74 | theorem dslope_sub_smul_of_ne (f : π β E) (h : b β a) :
dslope (fun x => (x - a) β’ f x) a b = f b := by |
rw [dslope_of_ne _ h, slope_sub_smul _ h.symm]
| [
" dslope (βf β g) a b = f (dslope g a b)",
" dslope (βf β g) b b = f (dslope g b b)",
" deriv (βf β g) b = f (deriv g b)",
" (b - a) β’ dslope f a b = f b - f a",
" (b - b) β’ dslope f b b = f b - f b",
" dslope (fun x => (x - a) β’ f x) a b = f b"
] | [
" dslope (βf β g) a b = f (dslope g a b)",
" dslope (βf β g) b b = f (dslope g b b)",
" deriv (βf β g) b = f (deriv g b)",
" (b - a) β’ dslope f a b = f b - f a",
" (b - b) β’ dslope f b b = f b - f b",
" dslope (fun x => (x - a) β’ f x) a b = f b"
] |
import Mathlib.NumberTheory.ModularForms.SlashInvariantForms
import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups
noncomputable section
open ModularForm UpperHalfPlane Complex Matrix
open scoped MatrixGroups
namespace EisensteinSeries
variable (N : β) (a : Fin 2 β ZMod N)
variable {N a}
section eisSummand
def eisSummand (k : β€) (v : Fin 2 β β€) (z : β) : β := 1 / (v 0 * z.1 + v 1) ^ k
| Mathlib/NumberTheory/ModularForms/EisensteinSeries/Basic.lean | 92 | 100 | theorem eisSummand_SL2_apply (k : β€) (i : (Fin 2 β β€)) (A : SL(2, β€)) (z : β) :
eisSummand k i (A β’ z) = (z.denom A) ^ k * eisSummand k (i α΅₯* A) z := by |
simp only [eisSummand, specialLinearGroup_apply, algebraMap_int_eq, eq_intCast, ofReal_intCast,
one_div, vecMul, vec2_dotProduct, Int.cast_add, Int.cast_mul]
have h (a b c d u v : β) (hc : c * z + d β 0) : ((u * ((a * z + b) / (c * z + d)) + v) ^ k)β»ΒΉ =
(c * z + d) ^ k * (((u * a + v * c) * z + (u * b + v * d)) ^ k)β»ΒΉ := by
field_simp [hc]
ring_nf
apply h (hc := z.denom_ne_zero A)
| [
" eisSummand k i (A β’ z) = denom (βA) z ^ k * eisSummand k (i α΅₯* βA) z",
" ((β(i 0) * β(UpperHalfPlane.mk ((β(ββA 0 0) * βz + β(ββA 0 1)) / (β(ββA 1 0) * βz + β(ββA 1 1))) β―) + β(i 1)) ^ k)β»ΒΉ =\n denom (βA) z ^ k *\n (((β(i 0) * β(βA 0 0) + β(i 1) * β(βA 1 0)) * βz + (β(i 0) * β(βA 0 1) + β(i 1) * β(βA 1 ... | [
" eisSummand k i (A β’ z) = denom (βA) z ^ k * eisSummand k (i α΅₯* βA) z"
] |
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
variable {R : Type*} [CommRing R] [IsDomain R]
section NormalizedGCDMonoid
variable [NormalizedGCDMonoid R]
def content (p : R[X]) : R :=
p.support.gcd p.coeff
#align polynomial.content Polynomial.content
theorem content_dvd_coeff {p : R[X]} (n : β) : p.content β£ p.coeff n := by
by_cases h : n β p.support
Β· apply Finset.gcd_dvd h
rw [mem_support_iff, Classical.not_not] at h
rw [h]
apply dvd_zero
#align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff
@[simp]
theorem content_C {r : R} : (C r).content = normalize r := by
rw [content]
by_cases h0 : r = 0
Β· simp [h0]
have h : (C r).support = {0} := support_monomial _ h0
simp [h]
set_option linter.uppercaseLean3 false in
#align polynomial.content_C Polynomial.content_C
@[simp]
theorem content_zero : content (0 : R[X]) = 0 := by rw [β C_0, content_C, normalize_zero]
#align polynomial.content_zero Polynomial.content_zero
@[simp]
theorem content_one : content (1 : R[X]) = 1 := by rw [β C_1, content_C, normalize_one]
#align polynomial.content_one Polynomial.content_one
theorem content_X_mul {p : R[X]} : content (X * p) = content p := by
rw [content, content, Finset.gcd_def, Finset.gcd_def]
refine congr rfl ?_
have h : (X * p).support = p.support.map β¨Nat.succ, Nat.succ_injectiveβ© := by
ext a
simp only [exists_prop, Finset.mem_map, Function.Embedding.coeFn_mk, Ne, mem_support_iff]
cases' a with a
Β· simp [coeff_X_mul_zero, Nat.succ_ne_zero]
rw [mul_comm, coeff_mul_X]
constructor
Β· intro h
use a
Β· rintro β¨b, β¨h1, h2β©β©
rw [β Nat.succ_injective h2]
apply h1
rw [h]
simp only [Finset.map_val, Function.comp_apply, Function.Embedding.coeFn_mk, Multiset.map_map]
refine congr (congr rfl ?_) rfl
ext a
rw [mul_comm]
simp [coeff_mul_X]
set_option linter.uppercaseLean3 false in
#align polynomial.content_X_mul Polynomial.content_X_mul
@[simp]
theorem content_X_pow {k : β} : content ((X : R[X]) ^ k) = 1 := by
induction' k with k hi
Β· simp
rw [pow_succ', content_X_mul, hi]
set_option linter.uppercaseLean3 false in
#align polynomial.content_X_pow Polynomial.content_X_pow
@[simp]
theorem content_X : content (X : R[X]) = 1 := by rw [β mul_one X, content_X_mul, content_one]
set_option linter.uppercaseLean3 false in
#align polynomial.content_X Polynomial.content_X
theorem content_C_mul (r : R) (p : R[X]) : (C r * p).content = normalize r * p.content := by
by_cases h0 : r = 0; Β· simp [h0]
rw [content]; rw [content]; rw [β Finset.gcd_mul_left]
refine congr (congr rfl ?_) ?_ <;> ext <;> simp [h0, mem_support_iff]
set_option linter.uppercaseLean3 false in
#align polynomial.content_C_mul Polynomial.content_C_mul
@[simp]
theorem content_monomial {r : R} {k : β} : content (monomial k r) = normalize r := by
rw [β C_mul_X_pow_eq_monomial, content_C_mul, content_X_pow, mul_one]
#align polynomial.content_monomial Polynomial.content_monomial
| Mathlib/RingTheory/Polynomial/Content.lean | 158 | 168 | theorem content_eq_zero_iff {p : R[X]} : content p = 0 β p = 0 := by |
rw [content, Finset.gcd_eq_zero_iff]
constructor <;> intro h
Β· ext n
by_cases h0 : n β p.support
Β· rw [h n h0, coeff_zero]
Β· rw [mem_support_iff] at h0
push_neg at h0
simp [h0]
Β· intro x
simp [h]
| [
" p.content β£ p.coeff n",
" p.content β£ 0",
" (C r).content = normalize r",
" (C r).support.gcd (C r).coeff = normalize r",
" content 0 = 0",
" content 1 = 1",
" (X * p).content = p.content",
" (Multiset.map (X * p).coeff (X * p).support.val).gcd = (Multiset.map p.coeff p.support.val).gcd",
" Multis... | [
" p.content β£ p.coeff n",
" p.content β£ 0",
" (C r).content = normalize r",
" (C r).support.gcd (C r).coeff = normalize r",
" content 0 = 0",
" content 1 = 1",
" (X * p).content = p.content",
" (Multiset.map (X * p).coeff (X * p).support.val).gcd = (Multiset.map p.coeff p.support.val).gcd",
" Multis... |
import Mathlib.LinearAlgebra.FreeModule.IdealQuotient
import Mathlib.RingTheory.Norm
#align_import linear_algebra.free_module.norm from "leanprover-community/mathlib"@"90b0d53ee6ffa910e5c2a977ce7e2fc704647974"
open Ideal Polynomial
open scoped Polynomial
variable {R S ΞΉ : Type*} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [CommRing S]
[IsDomain S] [Algebra R S]
section CommRing
variable (F : Type*) [CommRing F] [Algebra F R] [Algebra F S] [IsScalarTower F R S]
| Mathlib/LinearAlgebra/FreeModule/Norm.lean | 30 | 50 | theorem associated_norm_prod_smith [Fintype ΞΉ] (b : Basis ΞΉ R S) {f : S} (hf : f β 0) :
Associated (Algebra.norm R f) (β i, smithCoeffs b _ (span_singleton_eq_bot.not.2 hf) i) := by |
have hI := span_singleton_eq_bot.not.2 hf
let b' := ringBasis b (span {f}) hI
classical
rw [β Matrix.det_diagonal, β LinearMap.det_toLin b']
let e :=
(b'.equiv ((span {f}).selfBasis b hI) <| Equiv.refl _).trans
((LinearEquiv.coord S S f hf).restrictScalars R)
refine (LinearMap.associated_det_of_eq_comp e _ _ ?_).symm
dsimp only [e, LinearEquiv.trans_apply]
simp_rw [β LinearEquiv.coe_toLinearMap, β LinearMap.comp_apply, β LinearMap.ext_iff]
refine b'.ext fun i => ?_
simp_rw [LinearMap.comp_apply, LinearEquiv.coe_toLinearMap, Matrix.toLin_apply, Basis.repr_self,
Finsupp.single_eq_pi_single, Matrix.diagonal_mulVec_single, Pi.single_apply, ite_smul,
zero_smul, Finset.sum_ite_eq', mul_one, if_pos (Finset.mem_univ _), b'.equiv_apply]
change _ = f * _
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [mul_comm, β smul_eq_mul, LinearEquiv.restrictScalars_apply, LinearEquiv.coord_apply_smul,
Ideal.selfBasis_def]
rfl
| [
" Associated ((Algebra.norm R) f) (β i : ΞΉ, smithCoeffs b (span {f}) β― i)",
" Associated ((Algebra.norm R) f)\n (LinearMap.det ((Matrix.toLin b' b') (Matrix.diagonal fun i => smithCoeffs b (span {f}) β― i)))",
" β (x : S),\n ((Matrix.toLin b' b') (Matrix.diagonal fun i => smithCoeffs b (span {f}) β― i)) x =... | [
" Associated ((Algebra.norm R) f) (β i : ΞΉ, smithCoeffs b (span {f}) β― i)"
] |
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 TypeclassesLeftRightLT
variable [LT Ξ±] [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· < Β·)] [CovariantClass Ξ± Ξ± (swap (Β· * Β·)) (Β· < Β·)]
{a b c d : Ξ±}
@[to_additive (attr := simp)]
theorem inv_lt_inv_iff : aβ»ΒΉ < bβ»ΒΉ β b < a := by
rw [β mul_lt_mul_iff_left a, β mul_lt_mul_iff_right b]
simp
#align inv_lt_inv_iff inv_lt_inv_iff
#align neg_lt_neg_iff neg_lt_neg_iff
@[to_additive neg_lt]
theorem inv_lt' : aβ»ΒΉ < b β bβ»ΒΉ < a := by rw [β inv_lt_inv_iff, inv_inv]
#align inv_lt' inv_lt'
#align neg_lt neg_lt
@[to_additive lt_neg]
| Mathlib/Algebra/Order/Group/Defs.lean | 394 | 394 | theorem lt_inv' : a < bβ»ΒΉ β b < aβ»ΒΉ := by | rw [β inv_lt_inv_iff, inv_inv]
| [
" b β€ c",
" aβ»ΒΉ < bβ»ΒΉ β b < a",
" a * aβ»ΒΉ * b < a * bβ»ΒΉ * b β b < a",
" aβ»ΒΉ < b β bβ»ΒΉ < a",
" a < bβ»ΒΉ β b < aβ»ΒΉ"
] | [
" b β€ c",
" aβ»ΒΉ < bβ»ΒΉ β b < a",
" a * aβ»ΒΉ * b < a * bβ»ΒΉ * b β b < a",
" aβ»ΒΉ < b β bβ»ΒΉ < a",
" a < bβ»ΒΉ β b < aβ»ΒΉ"
] |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Data.Set.Function
#align_import analysis.sum_integral_comparisons from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set MeasureTheory.MeasureSpace
variable {xβ : β} {a b : β} {f : β β β}
theorem AntitoneOn.integral_le_sum (hf : AntitoneOn f (Icc xβ (xβ + a))) :
(β« x in xβ..xβ + a, f x) β€ β i β Finset.range a, f (xβ + i) := by
have hint : β k : β, k < a β IntervalIntegrable f volume (xβ + k) (xβ + (k + 1 : β)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
Β· apply Icc_subset_Icc
Β· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
Β· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
Β· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
β« x in xβ..xβ + a, f x = β i β Finset.range a, β« x in xβ + i..xβ + (i + 1 : β), f x := by
convert (intervalIntegral.sum_integral_adjacent_intervals hint).symm
simp only [Nat.cast_zero, add_zero]
_ β€ β i β Finset.range a, β« _ in xβ + i..xβ + (i + 1 : β), f (xβ + i) := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i < a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (hint _ ia) (by simp) fun x hx => ?_
apply hf _ _ hx.1
Β· simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, Nat.cast_nonneg, add_le_add_iff_left,
Nat.cast_le, and_self_iff]
Β· refine mem_Icc.2 β¨le_trans (by simp) hx.1, le_trans hx.2 ?_β©
simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt ia]
_ = β i β Finset.range a, f (xβ + i) := by simp
#align antitone_on.integral_le_sum AntitoneOn.integral_le_sum
theorem AntitoneOn.integral_le_sum_Ico (hab : a β€ b) (hf : AntitoneOn f (Set.Icc a b)) :
(β« x in a..b, f x) β€ β x β Finset.Ico a b, f x := by
rw [(Nat.sub_add_cancel hab).symm, Nat.cast_add]
conv =>
congr
congr
Β· skip
Β· skip
rw [add_comm]
Β· skip
Β· skip
congr
congr
rw [β zero_add a]
rw [β Finset.sum_Ico_add, Nat.Ico_zero_eq_range]
conv =>
rhs
congr
Β· skip
ext
rw [Nat.cast_add]
apply AntitoneOn.integral_le_sum
simp only [hf, hab, Nat.cast_sub, add_sub_cancel]
#align antitone_on.integral_le_sum_Ico AntitoneOn.integral_le_sum_Ico
| Mathlib/Analysis/SumIntegralComparisons.lean | 98 | 123 | theorem AntitoneOn.sum_le_integral (hf : AntitoneOn f (Icc xβ (xβ + a))) :
(β i β Finset.range a, f (xβ + (i + 1 : β))) β€ β« x in xβ..xβ + a, f x := by |
have hint : β k : β, k < a β IntervalIntegrable f volume (xβ + k) (xβ + (k + 1 : β)) := by
intro k hk
refine (hf.mono ?_).intervalIntegrable
rw [uIcc_of_le]
Β· apply Icc_subset_Icc
Β· simp only [le_add_iff_nonneg_right, Nat.cast_nonneg]
Β· simp only [add_le_add_iff_left, Nat.cast_le, Nat.succ_le_of_lt hk]
Β· simp only [add_le_add_iff_left, Nat.cast_le, Nat.le_succ]
calc
(β i β Finset.range a, f (xβ + (i + 1 : β))) =
β i β Finset.range a, β« _ in xβ + i..xβ + (i + 1 : β), f (xβ + (i + 1 : β)) := by simp
_ β€ β i β Finset.range a, β« x in xβ + i..xβ + (i + 1 : β), f x := by
apply Finset.sum_le_sum fun i hi => ?_
have ia : i + 1 β€ a := Finset.mem_range.1 hi
refine intervalIntegral.integral_mono_on (by simp) (by simp) (hint _ ia) fun x hx => ?_
apply hf _ _ hx.2
Β· refine mem_Icc.2 β¨le_trans ((le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _)) hx.1,
le_trans hx.2 ?_β©
simp only [Nat.cast_le, add_le_add_iff_left, ia]
Β· refine mem_Icc.2 β¨(le_add_iff_nonneg_right _).2 (Nat.cast_nonneg _), ?_β©
simp only [add_le_add_iff_left, Nat.cast_le, ia]
_ = β« x in xβ..xβ + a, f x := by
convert intervalIntegral.sum_integral_adjacent_intervals hint
simp only [Nat.cast_zero, add_zero]
| [
" β« (x : β) in xβ..xβ + βa, f x β€ β i β Finset.range a, f (xβ + βi)",
" β k < a, IntervalIntegrable f volume (xβ + βk) (xβ + β(k + 1))",
" IntervalIntegrable f volume (xβ + βk) (xβ + β(k + 1))",
" uIcc (xβ + βk) (xβ + β(k + 1)) β Icc xβ (xβ + βa)",
" Icc (xβ + βk) (xβ + β(k + 1)) β Icc xβ (xβ + βa)",
" xβ... | [
" β« (x : β) in xβ..xβ + βa, f x β€ β i β Finset.range a, f (xβ + βi)",
" β k < a, IntervalIntegrable f volume (xβ + βk) (xβ + β(k + 1))",
" IntervalIntegrable f volume (xβ + βk) (xβ + β(k + 1))",
" uIcc (xβ + βk) (xβ + β(k + 1)) β Icc xβ (xβ + βa)",
" Icc (xβ + βk) (xβ + β(k + 1)) β Icc xβ (xβ + βa)",
" xβ... |
import Mathlib.Algebra.Group.Embedding
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Finset.Union
#align_import data.finset.image from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
-- TODO
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
assert_not_exists MulAction
variable {Ξ± Ξ² Ξ³ : Type*}
open Multiset
open Function
namespace Finset
section Map
open Function
def map (f : Ξ± βͺ Ξ²) (s : Finset Ξ±) : Finset Ξ² :=
β¨s.1.map f, s.2.map f.2β©
#align finset.map Finset.map
@[simp]
theorem map_val (f : Ξ± βͺ Ξ²) (s : Finset Ξ±) : (map f s).1 = s.1.map f :=
rfl
#align finset.map_val Finset.map_val
@[simp]
theorem map_empty (f : Ξ± βͺ Ξ²) : (β
: Finset Ξ±).map f = β
:=
rfl
#align finset.map_empty Finset.map_empty
variable {f : Ξ± βͺ Ξ²} {s : Finset Ξ±}
@[simp]
theorem mem_map {b : Ξ²} : b β s.map f β β a β s, f a = b :=
Multiset.mem_map
#align finset.mem_map Finset.mem_map
-- Porting note: Higher priority to apply before `mem_map`.
@[simp 1100]
theorem mem_map_equiv {f : Ξ± β Ξ²} {b : Ξ²} : b β s.map f.toEmbedding β f.symm b β s := by
rw [mem_map]
exact
β¨by
rintro β¨a, H, rflβ©
simpa, fun h => β¨_, h, by simpβ©β©
#align finset.mem_map_equiv Finset.mem_map_equiv
-- The simpNF linter says that the LHS can be simplified via `Finset.mem_map`.
-- However this is a higher priority lemma.
-- https://github.com/leanprover/std4/issues/207
@[simp 1100, nolint simpNF]
theorem mem_map' (f : Ξ± βͺ Ξ²) {a} {s : Finset Ξ±} : f a β s.map f β a β s :=
mem_map_of_injective f.2
#align finset.mem_map' Finset.mem_map'
theorem mem_map_of_mem (f : Ξ± βͺ Ξ²) {a} {s : Finset Ξ±} : a β s β f a β s.map f :=
(mem_map' _).2
#align finset.mem_map_of_mem Finset.mem_map_of_mem
theorem forall_mem_map {f : Ξ± βͺ Ξ²} {s : Finset Ξ±} {p : β a, a β s.map f β Prop} :
(β y (H : y β s.map f), p y H) β β x (H : x β s), p (f x) (mem_map_of_mem _ H) :=
β¨fun h y hy => h (f y) (mem_map_of_mem _ hy),
fun h x hx => by
obtain β¨y, hy, rflβ© := mem_map.1 hx
exact h _ hyβ©
#align finset.forall_mem_map Finset.forall_mem_map
theorem apply_coe_mem_map (f : Ξ± βͺ Ξ²) (s : Finset Ξ±) (x : s) : f x β s.map f :=
mem_map_of_mem f x.prop
#align finset.apply_coe_mem_map Finset.apply_coe_mem_map
@[simp, norm_cast]
theorem coe_map (f : Ξ± βͺ Ξ²) (s : Finset Ξ±) : (s.map f : Set Ξ²) = f '' s :=
Set.ext (by simp only [mem_coe, mem_map, Set.mem_image, implies_true])
#align finset.coe_map Finset.coe_map
theorem coe_map_subset_range (f : Ξ± βͺ Ξ²) (s : Finset Ξ±) : (s.map f : Set Ξ²) β Set.range f :=
calc
β(s.map f) = f '' s := coe_map f s
_ β Set.range f := Set.image_subset_range f βs
#align finset.coe_map_subset_range Finset.coe_map_subset_range
theorem map_perm {Ο : Equiv.Perm Ξ±} (hs : { a | Ο a β a } β s) : s.map (Ο : Ξ± βͺ Ξ±) = s :=
coe_injective <| (coe_map _ _).trans <| Set.image_perm hs
#align finset.map_perm Finset.map_perm
theorem map_toFinset [DecidableEq Ξ±] [DecidableEq Ξ²] {s : Multiset Ξ±} :
s.toFinset.map f = (s.map f).toFinset :=
ext fun _ => by simp only [mem_map, Multiset.mem_map, exists_prop, Multiset.mem_toFinset]
#align finset.map_to_finset Finset.map_toFinset
@[simp]
theorem map_refl : s.map (Embedding.refl _) = s :=
ext fun _ => by simpa only [mem_map, exists_prop] using exists_eq_right
#align finset.map_refl Finset.map_refl
@[simp]
| Mathlib/Data/Finset/Image.lean | 141 | 144 | theorem map_cast_heq {Ξ± Ξ²} (h : Ξ± = Ξ²) (s : Finset Ξ±) :
HEq (s.map (Equiv.cast h).toEmbedding) s := by |
subst h
simp
| [
" b β map f.toEmbedding s β f.symm b β s",
" (β a β s, f.toEmbedding a = b) β f.symm b β s",
" (β a β s, f.toEmbedding a = b) β f.symm b β s",
" f.symm (f.toEmbedding a) β s",
" f.toEmbedding (f.symm b) = b",
" p x hx",
" p (f y) hx",
" β (x : Ξ²), x β β(map f s) β x β βf '' βs",
" xβ β map f s.toFin... | [
" b β map f.toEmbedding s β f.symm b β s",
" (β a β s, f.toEmbedding a = b) β f.symm b β s",
" (β a β s, f.toEmbedding a = b) β f.symm b β s",
" f.symm (f.toEmbedding a) β s",
" f.toEmbedding (f.symm b) = b",
" p x hx",
" p (f y) hx",
" β (x : Ξ²), x β β(map f s) β x β βf '' βs",
" xβ β map f s.toFin... |
import Mathlib.Algebra.Module.PID
import Mathlib.Data.ZMod.Quotient
#align_import group_theory.finite_abelian from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
open scoped DirectSum
private def directSumNeZeroMulHom {ΞΉ : Type} [DecidableEq ΞΉ] (p : ΞΉ β β) (n : ΞΉ β β) :
(β¨ i : {i // n i β 0}, ZMod (p i ^ n i)) β+ β¨ i, ZMod (p i ^ n i) :=
DirectSum.toAddMonoid fun i β¦ DirectSum.of (fun i β¦ ZMod (p i ^ n i)) i
private def directSumNeZeroMulEquiv (ΞΉ : Type) [DecidableEq ΞΉ] (p : ΞΉ β β) (n : ΞΉ β β) :
(β¨ i : {i // n i β 0}, ZMod (p i ^ n i)) β+ β¨ i, ZMod (p i ^ n i) where
toFun := directSumNeZeroMulHom p n
invFun := DirectSum.toAddMonoid fun i β¦
if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i β 0} β¦ ZMod (p j ^ n j)) β¨i, hβ©
left_inv x := by
induction' x using DirectSum.induction_on with i x x y hx hy
Β· simp
Β· rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,
dif_neg i.prop]
Β· rw [map_add, map_add, hx, hy]
right_inv x := by
induction' x using DirectSum.induction_on with i x x y hx hy
Β· rw [map_zero, map_zero]
Β· rw [DirectSum.toAddMonoid_of]
split_ifs with h
Β· simp [(ZMod.subsingleton_iff.2 $ by rw [h, pow_zero]).elim x 0]
Β· simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]
Β· rw [map_add, map_add, hx, hy]
map_add' := map_add (directSumNeZeroMulHom p n)
universe u
variable (G : Type u)
namespace AddCommGroup
variable [AddCommGroup G]
| Mathlib/GroupTheory/FiniteAbelian.lean | 114 | 126 | theorem equiv_free_prod_directSum_zmod [hG : AddGroup.FG G] :
β (n : β) (ΞΉ : Type) (_ : Fintype ΞΉ) (p : ΞΉ β β) (_ : β i, Nat.Prime <| p i) (e : ΞΉ β β),
Nonempty <| G β+ (Fin n ββ β€) Γ β¨ i : ΞΉ, ZMod (p i ^ e i) := by |
obtain β¨n, ΞΉ, fΞΉ, p, hp, e, β¨fβ©β© :=
@Module.equiv_free_prod_directSum _ _ _ _ _ _ _ (Module.Finite.iff_addGroup_fg.mpr hG)
refine β¨n, ΞΉ, fΞΉ, fun i => (p i).natAbs, fun i => ?_, e, β¨?_β©β©
Β· rw [β Int.prime_iff_natAbs_prime, β irreducible_iff_prime]; exact hp i
exact
f.toAddEquiv.trans
((AddEquiv.refl _).prodCongr <|
DFinsupp.mapRange.addEquiv fun i =>
((Int.quotientSpanEquivZMod _).trans <|
ZMod.ringEquivCongr <| (p i).natAbs_pow _).toAddEquiv)
| [
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p βj ^ n βj)) β¨i, hβ©)\n ((directSumNeZeroMulHom p n) x) =\n x",
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p βj ^ n βj)) β¨i, hβ©)\n ((directSumNeZeroMulHom p n) 0) =... | [
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p βj ^ n βj)) β¨i, hβ©)\n ((directSumNeZeroMulHom p n) x) =\n x",
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p βj ^ n βj)) β¨i, hβ©)\n ((directSumNeZeroMulHom p n) 0) =... |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : β}
(h : ((β k : β€, x β (2 * k + 1) * Ο / 2) β§ β l : β€, y β (2 * l + 1) * Ο / 2) β¨
(β k : β€, x = (2 * k + 1) * Ο / 2) β§ β l : β€, y = (2 * l + 1) * Ο / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [β Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : β) (y : β) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : β}
(h : (β k : β€, x β (2 * k + 1) * Ο / 2) β§ β l : β€, y β (2 * l + 1) * Ο / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
theorem tan_two_mul {x : β} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by
have := @Complex.tan_two_mul x
norm_cast at *
#align real.tan_two_mul Real.tan_two_mul
theorem tan_int_mul_pi_div_two (n : β€) : tan (n * Ο / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align real.tan_int_mul_pi_div_two Real.tan_int_mul_pi_div_two
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 56 | 60 | theorem continuousOn_tan : ContinuousOn tan {x | cos x β 0} := by |
suffices ContinuousOn (fun x => sin x / cos x) {x | cos x β 0} by
have h_eq : (fun x => sin x / cos x) = tan := by ext1 x; rw [tan_eq_sin_div_cos]
rwa [h_eq] at this
exact continuousOn_sin.div continuousOn_cos fun x => id
| [
" (x + y).tan = (x.tan + y.tan) / (1 - x.tan * y.tan)",
" ((β (k : β€), βx β (2 * βk + 1) * βΟ / 2) β§ β (l : β€), βy β (2 * βl + 1) * βΟ / 2) β¨\n (β k, βx = (2 * βk + 1) * βΟ / 2) β§ β l, βy = (2 * βl + 1) * βΟ / 2",
" βx = (2 * βaβ + 1) * βΟ / 2 β x = (2 * βaβ + 1) * Ο / 2",
" βy = (2 * βaβ + 1) * βΟ / 2 β y... | [
" (x + y).tan = (x.tan + y.tan) / (1 - x.tan * y.tan)",
" ((β (k : β€), βx β (2 * βk + 1) * βΟ / 2) β§ β (l : β€), βy β (2 * βl + 1) * βΟ / 2) β¨\n (β k, βx = (2 * βk + 1) * βΟ / 2) β§ β l, βy = (2 * βl + 1) * βΟ / 2",
" βx = (2 * βaβ + 1) * βΟ / 2 β x = (2 * βaβ + 1) * Ο / 2",
" βy = (2 * βaβ + 1) * βΟ / 2 β y... |
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {Ξ± : Type*} {Ξ² : Type v} {Ξ³ Ξ΄ : Type*}
namespace Multiset
def join : Multiset (Multiset Ξ±) β Multiset Ξ± :=
sum
#align multiset.join Multiset.join
theorem coe_join :
β L : List (List Ξ±), join (L.map ((β) : List Ξ± β Multiset Ξ±) : Multiset (Multiset Ξ±)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset Ξ± => βl + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join Ξ± 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join Ξ± (s ::β S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join Ξ± (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset Ξ±)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a β @join Ξ± S β β s β S, a β s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join Ξ± S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
theorem map_join (f : Ξ± β Ξ²) (S : Multiset (Multiset Ξ±)) :
map f (join S) = join (map (map f) S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
@[to_additive (attr := simp)]
theorem prod_join [CommMonoid Ξ±] {S : Multiset (Multiset Ξ±)} :
prod (join S) = prod (map prod S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
theorem rel_join {r : Ξ± β Ξ² β Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by
induction h with
| zero => simp
| cons hab hst ih => simpa using hab.add ih
#align multiset.rel_join Multiset.rel_join
section Bind
variable (a : Ξ±) (s t : Multiset Ξ±) (f g : Ξ± β Multiset Ξ²)
def bind (s : Multiset Ξ±) (f : Ξ± β Multiset Ξ²) : Multiset Ξ² :=
(s.map f).join
#align multiset.bind Multiset.bind
@[simp]
theorem coe_bind (l : List Ξ±) (f : Ξ± β List Ξ²) : (@bind Ξ± Ξ² l fun a => f a) = l.bind f := by
rw [List.bind, β coe_join, List.map_map]
rfl
#align multiset.coe_bind Multiset.coe_bind
@[simp]
theorem zero_bind : bind 0 f = 0 :=
rfl
#align multiset.zero_bind Multiset.zero_bind
@[simp]
theorem cons_bind : (a ::β s).bind f = f a + s.bind f := by simp [bind]
#align multiset.cons_bind Multiset.cons_bind
@[simp]
theorem singleton_bind : bind {a} f = f a := by simp [bind]
#align multiset.singleton_bind Multiset.singleton_bind
@[simp]
theorem add_bind : (s + t).bind f = s.bind f + t.bind f := by simp [bind]
#align multiset.add_bind Multiset.add_bind
@[simp]
theorem bind_zero : s.bind (fun _ => 0 : Ξ± β Multiset Ξ²) = 0 := by simp [bind, join, nsmul_zero]
#align multiset.bind_zero Multiset.bind_zero
@[simp]
| Mathlib/Data/Multiset/Bind.lean | 142 | 142 | theorem bind_add : (s.bind fun a => f a + g a) = s.bind f + s.bind g := by | simp [bind, join]
| [
" (β(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.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Logic.Function.Iterate
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Zify
#align_import data.nat.fib from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
namespace Nat
-- Porting note: Lean cannot find pp_nodot at the time of this port.
-- @[pp_nodot]
def fib (n : β) : β :=
((fun p : β Γ β => (p.snd, p.fst + p.snd))^[n] (0, 1)).fst
#align nat.fib Nat.fib
@[simp]
theorem fib_zero : fib 0 = 0 :=
rfl
#align nat.fib_zero Nat.fib_zero
@[simp]
theorem fib_one : fib 1 = 1 :=
rfl
#align nat.fib_one Nat.fib_one
@[simp]
theorem fib_two : fib 2 = 1 :=
rfl
#align nat.fib_two Nat.fib_two
theorem fib_add_two {n : β} : fib (n + 2) = fib n + fib (n + 1) := by
simp [fib, Function.iterate_succ_apply']
#align nat.fib_add_two Nat.fib_add_two
lemma fib_add_one : β {n}, n β 0 β fib (n + 1) = fib (n - 1) + fib n
| _n + 1, _ => fib_add_two
theorem fib_le_fib_succ {n : β} : fib n β€ fib (n + 1) := by cases n <;> simp [fib_add_two]
#align nat.fib_le_fib_succ Nat.fib_le_fib_succ
@[mono]
theorem fib_mono : Monotone fib :=
monotone_nat_of_le_succ fun _ => fib_le_fib_succ
#align nat.fib_mono Nat.fib_mono
@[simp] lemma fib_eq_zero : β {n}, fib n = 0 β n = 0
| 0 => Iff.rfl
| 1 => Iff.rfl
| n + 2 => by simp [fib_add_two, fib_eq_zero]
@[simp] lemma fib_pos {n : β} : 0 < fib n β 0 < n := by simp [pos_iff_ne_zero]
#align nat.fib_pos Nat.fib_pos
theorem fib_add_two_sub_fib_add_one {n : β} : fib (n + 2) - fib (n + 1) = fib n := by
rw [fib_add_two, add_tsub_cancel_right]
#align nat.fib_add_two_sub_fib_add_one Nat.fib_add_two_sub_fib_add_one
theorem fib_lt_fib_succ {n : β} (hn : 2 β€ n) : fib n < fib (n + 1) := by
rcases exists_add_of_le hn with β¨n, rflβ©
rw [β tsub_pos_iff_lt, add_comm 2, add_right_comm, fib_add_two, add_tsub_cancel_right, fib_pos]
exact succ_pos n
#align nat.fib_lt_fib_succ Nat.fib_lt_fib_succ
theorem fib_add_two_strictMono : StrictMono fun n => fib (n + 2) := by
refine strictMono_nat_of_lt_succ fun n => ?_
rw [add_right_comm]
exact fib_lt_fib_succ (self_le_add_left _ _)
#align nat.fib_add_two_strict_mono Nat.fib_add_two_strictMono
lemma fib_strictMonoOn : StrictMonoOn fib (Set.Ici 2)
| _m + 2, _, _n + 2, _, hmn => fib_add_two_strictMono <| lt_of_add_lt_add_right hmn
lemma fib_lt_fib {m : β} (hm : 2 β€ m) : β {n}, fib m < fib n β m < n
| 0 => by simp [hm]
| 1 => by simp [hm]
| n + 2 => fib_strictMonoOn.lt_iff_lt hm <| by simp
theorem le_fib_self {n : β} (five_le_n : 5 β€ n) : n β€ fib n := by
induction' five_le_n with n five_le_n IH
Β·-- 5 β€ fib 5
rfl
Β· -- n + 1 β€ fib (n + 1) for 5 β€ n
rw [succ_le_iff]
calc
n β€ fib n := IH
_ < fib (n + 1) := fib_lt_fib_succ (le_trans (by decide) five_le_n)
#align nat.le_fib_self Nat.le_fib_self
lemma le_fib_add_one : β n, n β€ fib n + 1
| 0 => zero_le_one
| 1 => one_le_two
| 2 => le_rfl
| 3 => le_rfl
| 4 => le_rfl
| _n + 5 => (le_fib_self le_add_self).trans <| le_succ _
theorem fib_coprime_fib_succ (n : β) : Nat.Coprime (fib n) (fib (n + 1)) := by
induction' n with n ih
Β· simp
Β· rw [fib_add_two]
simp only [coprime_add_self_right]
simp [Coprime, ih.symm]
#align nat.fib_coprime_fib_succ Nat.fib_coprime_fib_succ
theorem fib_add (m n : β) : fib (m + n + 1) = fib m * fib n + fib (m + 1) * fib (n + 1) := by
induction' n with n ih generalizing m
Β· simp
Β· specialize ih (m + 1)
rw [add_assoc m 1 n, add_comm 1 n] at ih
simp only [fib_add_two, succ_eq_add_one, ih]
ring
#align nat.fib_add Nat.fib_add
| Mathlib/Data/Nat/Fib/Basic.lean | 174 | 179 | theorem fib_two_mul (n : β) : fib (2 * n) = fib n * (2 * fib (n + 1) - fib n) := by |
cases n
Β· simp
Β· rw [two_mul, β add_assoc, fib_add, fib_add_two, two_mul]
simp only [β add_assoc, add_tsub_cancel_right]
ring
| [
" (n + 2).fib = n.fib + (n + 1).fib",
" n.fib β€ (n + 1).fib",
" fib 0 β€ (0 + 1).fib",
" (nβ + 1).fib β€ (nβ + 1 + 1).fib",
" (n + 2).fib = 0 β n + 2 = 0",
" 0 < n.fib β 0 < n",
" (n + 2).fib - (n + 1).fib = n.fib",
" n.fib < (n + 1).fib",
" (2 + n).fib < (2 + n + 1).fib",
" 0 < n + 1",
" StrictMo... | [
" (n + 2).fib = n.fib + (n + 1).fib",
" n.fib β€ (n + 1).fib",
" fib 0 β€ (0 + 1).fib",
" (nβ + 1).fib β€ (nβ + 1 + 1).fib",
" (n + 2).fib = 0 β n + 2 = 0",
" 0 < n.fib β 0 < n",
" (n + 2).fib - (n + 1).fib = n.fib",
" n.fib < (n + 1).fib",
" (2 + n).fib < (2 + n + 1).fib",
" 0 < n + 1",
" StrictMo... |
import Mathlib.LinearAlgebra.TensorProduct.Basic
import Mathlib.RingTheory.Finiteness
open scoped TensorProduct
open Submodule
variable {R M N : Type*}
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N]
variable {Mβ Mβ : Submodule R M} {Nβ Nβ : Submodule R N}
namespace TensorProduct
theorem exists_multiset (x : M β[R] N) :
β S : Multiset (M Γ N), x = (S.map fun i β¦ i.1 ββ[R] i.2).sum := by
induction x using TensorProduct.induction_on with
| zero => exact β¨0, by simpβ©
| tmul x y => exact β¨{(x, y)}, by simpβ©
| add x y hx hy =>
obtain β¨Sx, hxβ© := hx
obtain β¨Sy, hyβ© := hy
exact β¨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]β©
theorem exists_finsupp_left (x : M β[R] N) :
β S : M ββ N, x = S.sum fun m n β¦ m ββ[R] n := by
induction x using TensorProduct.induction_on with
| zero => exact β¨0, by simpβ©
| tmul x y => exact β¨Finsupp.single x y, by simpβ©
| add x y hx hy =>
obtain β¨Sx, hxβ© := hx
obtain β¨Sy, hyβ© := hy
use Sx + Sy
rw [hx, hy]
exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm
theorem exists_finsupp_right (x : M β[R] N) :
β S : N ββ M, x = S.sum fun n m β¦ m ββ[R] n := by
obtain β¨S, hβ© := exists_finsupp_left (TensorProduct.comm R M N x)
refine β¨S, (TensorProduct.comm R M N).injective ?_β©
simp_rw [h, Finsupp.sum, map_sum, comm_tmul]
theorem exists_finset (x : M β[R] N) :
β S : Finset (M Γ N), x = S.sum fun i β¦ i.1 ββ[R] i.2 := by
obtain β¨S, hβ© := exists_finsupp_left x
use S.graph
rw [h, Finsupp.sum]
apply Finset.sum_nbij' (fun m β¦ β¨m, S mβ©) Prod.fst <;> simp
theorem exists_finite_submodule_of_finite (s : Set (M β[R] N)) (hs : s.Finite) :
β (M' : Submodule R M) (N' : Submodule R N), Module.Finite R M' β§ Module.Finite R N' β§
s β LinearMap.range (mapIncl M' N') := by
simp_rw [Module.Finite.iff_fg]
refine hs.induction_on β¨_, _, fg_bot, fg_bot, Set.empty_subset _β© ?_
rintro a s - - β¨M', N', hM', hN', hβ©
refine TensorProduct.induction_on a ?_ (fun x y β¦ ?_) fun x y hx hy β¦ ?_
Β· exact β¨M', N', hM', hN', Set.insert_subset (zero_mem _) hβ©
Β· refine β¨_, _, hM'.sup (fg_span_singleton x),
hN'.sup (fg_span_singleton y), Set.insert_subset ?_ fun z hz β¦ ?_β©
Β· exact β¨β¨x, mem_sup_right (mem_span_singleton_self x)β© ββ
β¨y, mem_sup_right (mem_span_singleton_self y)β©, rflβ©
Β· exact range_mapIncl_mono le_sup_left le_sup_left (h hz)
Β· obtain β¨Mβ', Nβ', hMβ', hNβ', hββ© := hx
obtain β¨Mβ', Nβ', hMβ', hNβ', hββ© := hy
refine β¨_, _, hMβ'.sup hMβ', hNβ'.sup hNβ', Set.insert_subset (add_mem ?_ ?_) fun z hz β¦ ?_β©
Β· exact range_mapIncl_mono le_sup_left le_sup_left (hβ (Set.mem_insert x s))
Β· exact range_mapIncl_mono le_sup_right le_sup_right (hβ (Set.mem_insert y s))
Β· exact range_mapIncl_mono le_sup_left le_sup_left (hβ (Set.subset_insert x s hz))
| Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean | 121 | 126 | theorem exists_finite_submodule_left_of_finite (s : Set (M β[R] N)) (hs : s.Finite) :
β M' : Submodule R M, Module.Finite R M' β§ s β LinearMap.range (M'.subtype.rTensor N) := by |
obtain β¨M', _, hfin, _, hβ© := exists_finite_submodule_of_finite s hs
refine β¨M', hfin, ?_β©
rw [mapIncl, β LinearMap.rTensor_comp_lTensor] at h
exact h.trans (LinearMap.range_comp_le_range _ _)
| [
" β S, x = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" β S, 0 = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" 0 = (Multiset.map (fun i => i.1 ββ[R] i.2) 0).sum",
" β S, x ββ[R] y = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" x ββ[R] y = (Multiset.map (fun i => i.1 ββ[R] i.2) {(x, y)}).sum",
... | [
" β S, x = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" β S, 0 = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" 0 = (Multiset.map (fun i => i.1 ββ[R] i.2) 0).sum",
" β S, x ββ[R] y = (Multiset.map (fun i => i.1 ββ[R] i.2) S).sum",
" x ββ[R] y = (Multiset.map (fun i => i.1 ββ[R] i.2) {(x, y)}).sum",
... |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Int.ModEq
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Log
import Mathlib.Data.List.Indexes
import Mathlib.Data.List.Palindrome
import Mathlib.Tactic.IntervalCases
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
#align_import data.nat.digits from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
namespace Nat
variable {n : β}
def digitsAux0 : β β List β
| 0 => []
| n + 1 => [n + 1]
#align nat.digits_aux_0 Nat.digitsAux0
def digitsAux1 (n : β) : List β :=
List.replicate n 1
#align nat.digits_aux_1 Nat.digitsAux1
def digitsAux (b : β) (h : 2 β€ b) : β β List β
| 0 => []
| n + 1 =>
((n + 1) % b) :: digitsAux b h ((n + 1) / b)
decreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h
#align nat.digits_aux Nat.digitsAux
@[simp]
theorem digitsAux_zero (b : β) (h : 2 β€ b) : digitsAux b h 0 = [] := by rw [digitsAux]
#align nat.digits_aux_zero Nat.digitsAux_zero
theorem digitsAux_def (b : β) (h : 2 β€ b) (n : β) (w : 0 < n) :
digitsAux b h n = (n % b) :: digitsAux b h (n / b) := by
cases n
Β· cases w
Β· rw [digitsAux]
#align nat.digits_aux_def Nat.digitsAux_def
def digits : β β β β List β
| 0 => digitsAux0
| 1 => digitsAux1
| b + 2 => digitsAux (b + 2) (by norm_num)
#align nat.digits Nat.digits
@[simp]
theorem digits_zero (b : β) : digits b 0 = [] := by
rcases b with (_ | β¨_ | β¨_β©β©) <;> simp [digits, digitsAux0, digitsAux1]
#align nat.digits_zero Nat.digits_zero
-- @[simp] -- Porting note (#10618): simp can prove this
theorem digits_zero_zero : digits 0 0 = [] :=
rfl
#align nat.digits_zero_zero Nat.digits_zero_zero
@[simp]
theorem digits_zero_succ (n : β) : digits 0 n.succ = [n + 1] :=
rfl
#align nat.digits_zero_succ Nat.digits_zero_succ
theorem digits_zero_succ' : β {n : β}, n β 0 β digits 0 n = [n]
| 0, h => (h rfl).elim
| _ + 1, _ => rfl
#align nat.digits_zero_succ' Nat.digits_zero_succ'
@[simp]
theorem digits_one (n : β) : digits 1 n = List.replicate n 1 :=
rfl
#align nat.digits_one Nat.digits_one
-- @[simp] -- Porting note (#10685): dsimp can prove this
theorem digits_one_succ (n : β) : digits 1 (n + 1) = 1 :: digits 1 n :=
rfl
#align nat.digits_one_succ Nat.digits_one_succ
theorem digits_add_two_add_one (b n : β) :
digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2)) := by
simp [digits, digitsAux_def]
#align nat.digits_add_two_add_one Nat.digits_add_two_add_one
@[simp]
lemma digits_of_two_le_of_pos {b : β} (hb : 2 β€ b) (hn : 0 < n) :
Nat.digits b n = n % b :: Nat.digits b (n / b) := by
rw [Nat.eq_add_of_sub_eq hb rfl, Nat.eq_add_of_sub_eq hn rfl, Nat.digits_add_two_add_one]
theorem digits_def' :
β {b : β} (_ : 1 < b) {n : β} (_ : 0 < n), digits b n = (n % b) :: digits b (n / b)
| 0, h => absurd h (by decide)
| 1, h => absurd h (by decide)
| b + 2, _ => digitsAux_def _ (by simp) _
#align nat.digits_def' Nat.digits_def'
@[simp]
| Mathlib/Data/Nat/Digits.lean | 137 | 140 | theorem digits_of_lt (b x : β) (hx : x β 0) (hxb : x < b) : digits b x = [x] := by |
rcases exists_eq_succ_of_ne_zero hx with β¨x, rflβ©
rcases Nat.exists_eq_add_of_le' ((Nat.le_add_left 1 x).trans_lt hxb) with β¨b, rflβ©
rw [digits_add_two_add_one, div_eq_of_lt hxb, digits_zero, mod_eq_of_lt hxb]
| [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 ((n + 1) / b) n.succ",
" b.digitsAux h 0 = []",
" b.digitsAux h n = n % b :: b.digitsAux h (n / b)",
" b.digitsAux h 0 = 0 % b :: b.digitsAux h (0 / b)",
" b.digitsAux h (nβ + 1) = (nβ + 1) % b :: b.digitsAux h ((nβ + 1) / b)",
" 2 β€ b + 2",
" ... | [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 ((n + 1) / b) n.succ",
" b.digitsAux h 0 = []",
" b.digitsAux h n = n % b :: b.digitsAux h (n / b)",
" b.digitsAux h 0 = 0 % b :: b.digitsAux h (0 / b)",
" b.digitsAux h (nβ + 1) = (nβ + 1) % b :: b.digitsAux h ((nβ + 1) / b)",
" 2 β€ b + 2",
" ... |
import Mathlib.Data.Set.Prod
#align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654"
open Function
namespace Set
variable {Ξ± Ξ±' Ξ² Ξ²' Ξ³ Ξ³' Ξ΄ Ξ΄' Ξ΅ Ξ΅' ΞΆ ΞΆ' Ξ½ : Type*} {f f' : Ξ± β Ξ² β Ξ³} {g g' : Ξ± β Ξ² β Ξ³ β Ξ΄}
variable {s s' : Set Ξ±} {t t' : Set Ξ²} {u u' : Set Ξ³} {v : Set Ξ΄} {a a' : Ξ±} {b b' : Ξ²} {c c' : Ξ³}
{d d' : Ξ΄}
theorem mem_image2_iff (hf : Injective2 f) : f a b β image2 f s t β a β s β§ b β t :=
β¨by
rintro β¨a', ha', b', hb', hβ©
rcases hf h with β¨rfl, rflβ©
exact β¨ha', hb'β©, fun β¨ha, hbβ© => mem_image2_of_mem ha hbβ©
#align set.mem_image2_iff Set.mem_image2_iff
theorem image2_subset (hs : s β s') (ht : t β t') : image2 f s t β image2 f s' t' := by
rintro _ β¨a, ha, b, hb, rflβ©
exact mem_image2_of_mem (hs ha) (ht hb)
#align set.image2_subset Set.image2_subset
theorem image2_subset_left (ht : t β t') : image2 f s t β image2 f s t' :=
image2_subset Subset.rfl ht
#align set.image2_subset_left Set.image2_subset_left
theorem image2_subset_right (hs : s β s') : image2 f s t β image2 f s' t :=
image2_subset hs Subset.rfl
#align set.image2_subset_right Set.image2_subset_right
theorem image_subset_image2_left (hb : b β t) : (fun a => f a b) '' s β image2 f s t :=
forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb
#align set.image_subset_image2_left Set.image_subset_image2_left
theorem image_subset_image2_right (ha : a β s) : f a '' t β image2 f s t :=
forall_mem_image.2 fun _ => mem_image2_of_mem ha
#align set.image_subset_image2_right Set.image_subset_image2_right
theorem forall_image2_iff {p : Ξ³ β Prop} :
(β z β image2 f s t, p z) β β x β s, β y β t, p (f x y) :=
β¨fun h x hx y hy => h _ β¨x, hx, y, hy, rflβ©, fun h _ β¨x, hx, y, hy, hzβ© => hz βΈ h x hx y hyβ©
#align set.forall_image2_iff Set.forall_image2_iff
@[simp]
theorem image2_subset_iff {u : Set Ξ³} : image2 f s t β u β β x β s, β y β t, f x y β u :=
forall_image2_iff
#align set.image2_subset_iff Set.image2_subset_iff
| Mathlib/Data/Set/NAry.lean | 68 | 69 | theorem image2_subset_iff_left : image2 f s t β u β β a β s, (fun b => f a b) '' t β u := by |
simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage]
| [
" f a b β image2 f s t β a β s β§ b β t",
" a β s β§ b β t",
" a' β s β§ b' β t",
" image2 f s t β image2 f s' t'",
" f a b β image2 f s' t'",
" image2 f s t β u β β a β s, (fun b => f a b) '' t β u"
] | [
" f a b β image2 f s t β a β s β§ b β t",
" a β s β§ b β t",
" a' β s β§ b' β t",
" image2 f s t β image2 f s' t'",
" f a b β image2 f s' t'",
" image2 f s t β u β β a β s, (fun b => f a b) '' t β u"
] |
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
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
#align list.duplicate_cons_iff List.duplicate_cons_iff
theorem Duplicate.of_duplicate_cons {y : Ξ±} (h : x β+ y :: l) (hx : x β y) : x β+ l := by
simpa [duplicate_cons_iff, hx.symm] using h
#align list.duplicate.of_duplicate_cons List.Duplicate.of_duplicate_cons
theorem duplicate_cons_iff_of_ne {y : Ξ±} (hne : x β y) : x β+ y :: l β x β+ l := by
simp [duplicate_cons_iff, hne.symm]
#align list.duplicate_cons_iff_of_ne List.duplicate_cons_iff_of_ne
theorem Duplicate.mono_sublist {l' : List Ξ±} (hx : x β+ l) (h : l <+ l') : x β+ l' := by
induction' h with lβ lβ y _ IH lβ lβ y h IH
Β· exact hx
Β· exact (IH hx).duplicate_cons _
Β· rw [duplicate_cons_iff] at hx β’
rcases hx with (β¨rfl, hxβ© | hx)
Β· simp [h.subset hx]
Β· simp [IH hx]
#align list.duplicate.mono_sublist List.Duplicate.mono_sublist
theorem duplicate_iff_sublist : x β+ l β [x, x] <+ l := by
induction' l with y l IH
Β· simp
Β· by_cases hx : x = y
Β· simp [hx, cons_sublist_cons, singleton_sublist]
Β· rw [duplicate_cons_iff_of_ne hx, IH]
refine β¨sublist_cons_of_sublist y, fun h => ?_β©
cases h
Β· assumption
Β· contradiction
#align list.duplicate_iff_sublist List.duplicate_iff_sublist
theorem nodup_iff_forall_not_duplicate : Nodup l β β x : Ξ±, Β¬x β+ l := by
simp_rw [nodup_iff_sublist, duplicate_iff_sublist]
#align list.nodup_iff_forall_not_duplicate List.nodup_iff_forall_not_duplicate
theorem exists_duplicate_iff_not_nodup : (β x : Ξ±, x β+ l) β Β¬Nodup l := by
simp [nodup_iff_forall_not_duplicate]
#align list.exists_duplicate_iff_not_nodup List.exists_duplicate_iff_not_nodup
theorem Duplicate.not_nodup (h : x β+ l) : Β¬Nodup l := fun H =>
nodup_iff_forall_not_duplicate.mp H _ h
#align list.duplicate.not_nodup List.Duplicate.not_nodup
| Mathlib/Data/List/Duplicate.lean | 141 | 142 | theorem duplicate_iff_two_le_count [DecidableEq Ξ±] : x β+ l β 2 β€ count x l := by |
simp [duplicate_iff_sublist, le_count_iff_replicate_sublist]
| [
" 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 β+ y :: l β x β+ l",
" x β+ l'",
" x β+ []",
" x β+ y ... | [
" 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 β+ y :: l β x β+ l",
" x β+ l'",
" x β+ []",
" x β+ y ... |
import Mathlib.RingTheory.RingHomProperties
import Mathlib.RingTheory.IntegralClosure
#align_import ring_theory.ring_hom.integral from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
namespace RingHom
open scoped TensorProduct
open TensorProduct Algebra.TensorProduct
theorem isIntegral_stableUnderComposition : StableUnderComposition fun f => f.IsIntegral := by
introv R hf hg; exact hf.trans _ _ hg
#align ring_hom.is_integral_stable_under_composition RingHom.isIntegral_stableUnderComposition
| Mathlib/RingTheory/RingHom/Integral.lean | 28 | 32 | theorem isIntegral_respectsIso : RespectsIso fun f => f.IsIntegral := by |
apply isIntegral_stableUnderComposition.respectsIso
introv x
rw [β e.apply_symm_apply x]
apply RingHom.isIntegralElem_map
| [
" StableUnderComposition fun {R S} [CommRing R] [CommRing S] f => f.IsIntegral",
" (g.comp f).IsIntegral",
" RespectsIso fun {R S} [CommRing R] [CommRing S] f => f.IsIntegral",
" β {R S : Type u_1} [inst : CommRing R] [inst_1 : CommRing S] (e : R β+* S), e.toRingHom.IsIntegral",
" e.toRingHom.IsIntegralElem... | [
" StableUnderComposition fun {R S} [CommRing R] [CommRing S] f => f.IsIntegral",
" (g.comp f).IsIntegral",
" RespectsIso fun {R S} [CommRing R] [CommRing S] f => f.IsIntegral"
] |
import Mathlib.Algebra.BigOperators.Group.Finset
#align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace Nat
variable {ΞΉ : Type*}
| Mathlib/Data/Nat/GCD/BigOperators.lean | 20 | 22 | theorem coprime_list_prod_left_iff {l : List β} {k : β} :
Coprime l.prod k β β n β l, Coprime n k := by |
induction l <;> simp [Nat.coprime_mul_iff_left, *]
| [
" l.prod.Coprime k β β n β l, n.Coprime k",
" [].prod.Coprime k β β n β [], n.Coprime k",
" (headβ :: tailβ).prod.Coprime k β β n β headβ :: tailβ, n.Coprime k"
] | [
" l.prod.Coprime k β β n β l, n.Coprime k"
] |
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
noncomputable section
open scoped Classical
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
namespace Real
variable {ΞΉ : Type*} [Fintype ΞΉ]
theorem volume_eq_stieltjes_id : (volume : Measure β) = StieltjesFunction.id.measure := by
haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
β¨fun a =>
Eq.symm <|
Real.measure_ext_Ioo_rat fun p q => by
simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
StieltjesFunction.id_apply, id, preimage_const_add_Ioo]β©
have A : StieltjesFunction.id.measure (stdOrthonormalBasis β β).toBasis.parallelepiped = 1 := by
change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis β β)) = 1
rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis β β) with (H | H) <;>
simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero,
StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
conv_rhs =>
rw [addHaarMeasure_unique StieltjesFunction.id.measure
(stdOrthonormalBasis β β).toBasis.parallelepiped, A]
simp only [volume, Basis.addHaar, one_smul]
#align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id
theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by
simp [volume_eq_stieltjes_id]
#align real.volume_val Real.volume_val
@[simp]
theorem volume_Ico {a b : β} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val]
#align real.volume_Ico Real.volume_Ico
@[simp]
theorem volume_Icc {a b : β} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val]
#align real.volume_Icc Real.volume_Icc
@[simp]
theorem volume_Ioo {a b : β} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val]
#align real.volume_Ioo Real.volume_Ioo
@[simp]
theorem volume_Ioc {a b : β} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val]
#align real.volume_Ioc Real.volume_Ioc
-- @[simp] -- Porting note (#10618): simp can prove this
theorem volume_singleton {a : β} : volume ({a} : Set β) = 0 := by simp [volume_val]
#align real.volume_singleton Real.volume_singleton
-- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628
theorem volume_univ : volume (univ : Set β) = β :=
ENNReal.eq_top_of_forall_nnreal_le fun r =>
calc
(r : ββ₯0β) = volume (Icc (0 : β) r) := by simp
_ β€ volume univ := measure_mono (subset_univ _)
#align real.volume_univ Real.volume_univ
@[simp]
theorem volume_ball (a r : β) : volume (Metric.ball a r) = ofReal (2 * r) := by
rw [ball_eq_Ioo, volume_Ioo, β sub_add, add_sub_cancel_left, two_mul]
#align real.volume_ball Real.volume_ball
@[simp]
theorem volume_closedBall (a r : β) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
rw [closedBall_eq_Icc, volume_Icc, β sub_add, add_sub_cancel_left, two_mul]
#align real.volume_closed_ball Real.volume_closedBall
@[simp]
theorem volume_emetric_ball (a : β) (r : ββ₯0β) : volume (EMetric.ball a r) = 2 * r := by
rcases eq_or_ne r β with (rfl | hr)
Β· rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add]
Β· lift r to ββ₯0 using hr
rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, β NNReal.coe_add,
ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
#align real.volume_emetric_ball Real.volume_emetric_ball
@[simp]
theorem volume_emetric_closedBall (a : β) (r : ββ₯0β) : volume (EMetric.closedBall a r) = 2 * r := by
rcases eq_or_ne r β with (rfl | hr)
Β· rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add]
Β· lift r to ββ₯0 using hr
rw [Metric.emetric_closedBall_nnreal, volume_closedBall, two_mul, β NNReal.coe_add,
ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
#align real.volume_emetric_closed_ball Real.volume_emetric_closedBall
instance noAtoms_volume : NoAtoms (volume : Measure β) :=
β¨fun _ => volume_singletonβ©
#align real.has_no_atoms_volume Real.noAtoms_volume
@[simp]
theorem volume_interval {a b : β} : volume (uIcc a b) = ofReal |b - a| := by
rw [β Icc_min_max, volume_Icc, max_sub_min_eq_abs]
#align real.volume_interval Real.volume_interval
@[simp]
| Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | 145 | 150 | theorem volume_Ioi {a : β} : volume (Ioi a) = β :=
top_unique <|
le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n =>
calc
(n : ββ₯0β) = volume (Ioo a (a + n)) := by | simp
_ β€ volume (Ioi a) := measure_mono Ioo_subset_Ioi_self
| [
" volume = StieltjesFunction.id.measure",
" StieltjesFunction.id.measure (Ioo βp βq) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo βp βq)",
" StieltjesFunction.id.measure β(stdOrthonormalBasis β β).toBasis.parallelepiped = 1",
" StieltjesFunction.id.measure (parallelepiped β(stdOrthonorma... | [
" volume = StieltjesFunction.id.measure",
" StieltjesFunction.id.measure (Ioo βp βq) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo βp βq)",
" StieltjesFunction.id.measure β(stdOrthonormalBasis β β).toBasis.parallelepiped = 1",
" StieltjesFunction.id.measure (parallelepiped β(stdOrthonorma... |
import Mathlib.Probability.Kernel.MeasurableIntegral
#align_import probability.kernel.composition from "leanprover-community/mathlib"@"3b92d54a05ee592aa2c6181a4e76b1bb7cc45d0b"
open MeasureTheory
open scoped ENNReal
namespace ProbabilityTheory
namespace kernel
variable {Ξ± Ξ² ΞΉ : Type*} {mΞ± : MeasurableSpace Ξ±} {mΞ² : MeasurableSpace Ξ²}
section CompositionProduct
variable {Ξ³ : Type*} {mΞ³ : MeasurableSpace Ξ³} {s : Set (Ξ² Γ Ξ³)}
noncomputable def compProdFun (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ Ξ²) Ξ³) (a : Ξ±) (s : Set (Ξ² Γ Ξ³)) :
ββ₯0β :=
β«β» b, Ξ· (a, b) {c | (b, c) β s} βΞΊ a
#align probability_theory.kernel.comp_prod_fun ProbabilityTheory.kernel.compProdFun
theorem compProdFun_empty (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ Ξ²) Ξ³) (a : Ξ±) :
compProdFun ΞΊ Ξ· a β
= 0 := by
simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty,
MeasureTheory.lintegral_const, zero_mul]
#align probability_theory.kernel.comp_prod_fun_empty ProbabilityTheory.kernel.compProdFun_empty
theorem compProdFun_iUnion (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ Ξ²) Ξ³) [IsSFiniteKernel Ξ·] (a : Ξ±)
(f : β β Set (Ξ² Γ Ξ³)) (hf_meas : β i, MeasurableSet (f i))
(hf_disj : Pairwise (Disjoint on f)) :
compProdFun ΞΊ Ξ· a (β i, f i) = β' i, compProdFun ΞΊ Ξ· a (f i) := by
have h_Union :
(fun b => Ξ· (a, b) {c : Ξ³ | (b, c) β β i, f i}) = fun b =>
Ξ· (a, b) (β i, {c : Ξ³ | (b, c) β f i}) := by
ext1 b
congr with c
simp only [Set.mem_iUnion, Set.iSup_eq_iUnion, Set.mem_setOf_eq]
rw [compProdFun, h_Union]
have h_tsum :
(fun b => Ξ· (a, b) (β i, {c : Ξ³ | (b, c) β f i})) = fun b =>
β' i, Ξ· (a, b) {c : Ξ³ | (b, c) β f i} := by
ext1 b
rw [measure_iUnion]
Β· intro i j hij s hsi hsj c hcs
have hbci : {(b, c)} β f i := by rw [Set.singleton_subset_iff]; exact hsi hcs
have hbcj : {(b, c)} β f j := by rw [Set.singleton_subset_iff]; exact hsj hcs
simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff,
Set.mem_empty_iff_false] using hf_disj hij hbci hbcj
Β· -- Porting note: behavior of `@` changed relative to lean 3, was
-- exact fun i => (@measurable_prod_mk_left Ξ² Ξ³ _ _ b) _ (hf_meas i)
exact fun i => (@measurable_prod_mk_left Ξ² Ξ³ _ _ b) (hf_meas i)
rw [h_tsum, lintegral_tsum]
Β· rfl
Β· intro i
have hm : MeasurableSet {p : (Ξ± Γ Ξ²) Γ Ξ³ | (p.1.2, p.2) β f i} :=
measurable_fst.snd.prod_mk measurable_snd (hf_meas i)
exact ((measurable_kernel_prod_mk_left hm).comp measurable_prod_mk_left).aemeasurable
#align probability_theory.kernel.comp_prod_fun_Union ProbabilityTheory.kernel.compProdFun_iUnion
theorem compProdFun_tsum_right (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ Ξ²) Ξ³) [IsSFiniteKernel Ξ·] (a : Ξ±)
(hs : MeasurableSet s) : compProdFun ΞΊ Ξ· a s = β' n, compProdFun ΞΊ (seq Ξ· n) a s := by
simp_rw [compProdFun, (measure_sum_seq Ξ· _).symm]
have :
β«β» b, Measure.sum (fun n => seq Ξ· n (a, b)) {c : Ξ³ | (b, c) β s} βΞΊ a =
β«β» b, β' n, seq Ξ· n (a, b) {c : Ξ³ | (b, c) β s} βΞΊ a := by
congr
ext1 b
rw [Measure.sum_apply]
exact measurable_prod_mk_left hs
rw [this, lintegral_tsum]
exact fun n => ((measurable_kernel_prod_mk_left (ΞΊ := (seq Ξ· n))
((measurable_fst.snd.prod_mk measurable_snd) hs)).comp measurable_prod_mk_left).aemeasurable
#align probability_theory.kernel.comp_prod_fun_tsum_right ProbabilityTheory.kernel.compProdFun_tsum_right
| Mathlib/Probability/Kernel/Composition.lean | 146 | 148 | theorem compProdFun_tsum_left (ΞΊ : kernel Ξ± Ξ²) (Ξ· : kernel (Ξ± Γ Ξ²) Ξ³) [IsSFiniteKernel ΞΊ] (a : Ξ±)
(s : Set (Ξ² Γ Ξ³)) : compProdFun ΞΊ Ξ· a s = β' n, compProdFun (seq ΞΊ n) Ξ· a s := by |
simp_rw [compProdFun, (measure_sum_seq ΞΊ _).symm, lintegral_sum_measure]
| [
" compProdFun ΞΊ Ξ· a β
= 0",
" compProdFun ΞΊ Ξ· a (β i, f i) = β' (i : β), compProdFun ΞΊ Ξ· a (f i)",
" (fun b => (Ξ· (a, b)) {c | (b, c) β β i, f i}) = fun b => (Ξ· (a, b)) (β i, {c | (b, c) β f i})",
" (Ξ· (a, b)) {c | (b, c) β β i, f i} = (Ξ· (a, b)) (β i, {c | (b, c) β f i})",
" c β {c | (b, c) β β i, f i} β c... | [
" compProdFun ΞΊ Ξ· a β
= 0",
" compProdFun ΞΊ Ξ· a (β i, f i) = β' (i : β), compProdFun ΞΊ Ξ· a (f i)",
" (fun b => (Ξ· (a, b)) {c | (b, c) β β i, f i}) = fun b => (Ξ· (a, b)) (β i, {c | (b, c) β f i})",
" (Ξ· (a, b)) {c | (b, c) β β i, f i} = (Ξ· (a, b)) (β i, {c | (b, c) β f i})",
" c β {c | (b, c) β β i, f i} β c... |
import Mathlib.CategoryTheory.EffectiveEpi.Preserves
import Mathlib.CategoryTheory.EffectiveEpi.Coproduct
import Mathlib.CategoryTheory.Extensive
import Mathlib.CategoryTheory.Limits.Preserves.Finite
namespace CategoryTheory
open Limits
variable {C : Type*} [Category C] [FinitaryPreExtensive C]
| Mathlib/CategoryTheory/EffectiveEpi/Extensive.lean | 24 | 29 | theorem effectiveEpi_desc_iff_effectiveEpiFamily {Ξ± : Type} [Finite Ξ±]
{B : C} (X : Ξ± β C) (Ο : (a : Ξ±) β X a βΆ B) :
EffectiveEpi (Sigma.desc Ο) β EffectiveEpiFamily X Ο := by |
exact β¨fun h β¦ β¨β¨@effectiveEpiFamilyStructOfEffectiveEpiDesc _ _ _ _ X Ο _ h _ _ (fun g β¦
(FinitaryPreExtensive.sigma_desc_iso (fun a β¦ Sigma.ΞΉ X a) g inferInstance).epi_of_iso)β©β©,
fun _ β¦ inferInstanceβ©
| [
" EffectiveEpi (Sigma.desc Ο) β EffectiveEpiFamily X Ο"
] | [
" EffectiveEpi (Sigma.desc Ο) β EffectiveEpiFamily X Ο"
] |
import Batteries.Data.DList
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Cases
#align_import data.dlist from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd"
universe u
#align dlist Batteries.DList
namespace Batteries.DList
open Function
variable {Ξ± : Type u}
#align dlist.of_list Batteries.DList.ofList
def lazy_ofList (l : Thunk (List Ξ±)) : DList Ξ± :=
β¨fun xs => l.get ++ xs, fun t => by simpβ©
#align dlist.lazy_of_list Batteries.DList.lazy_ofList
#align dlist.to_list Batteries.DList.toList
#align dlist.empty Batteries.DList.empty
#align dlist.singleton Batteries.DList.singleton
attribute [local simp] Function.comp
#align dlist.cons Batteries.DList.cons
#align dlist.concat Batteries.DList.push
#align dlist.append Batteries.DList.append
attribute [local simp] ofList toList empty singleton cons push append
theorem toList_ofList (l : List Ξ±) : DList.toList (DList.ofList l) = l := by
cases l; rfl; simp only [DList.toList, DList.ofList, List.cons_append, List.append_nil]
#align dlist.to_list_of_list Batteries.DList.toList_ofList
theorem ofList_toList (l : DList Ξ±) : DList.ofList (DList.toList l) = l := by
cases' l with app inv
simp only [ofList, toList, mk.injEq]
funext x
rw [(inv x)]
#align dlist.of_list_to_list Batteries.DList.ofList_toList
theorem toList_empty : toList (@empty Ξ±) = [] := by simp
#align dlist.to_list_empty Batteries.DList.toList_empty
theorem toList_singleton (x : Ξ±) : toList (singleton x) = [x] := by simp
#align dlist.to_list_singleton Batteries.DList.toList_singleton
theorem toList_append (lβ lβ : DList Ξ±) : toList (lβ ++ lβ) = toList lβ ++ toList lβ :=
show toList (DList.append lβ lβ) = toList lβ ++ toList lβ by
cases' lβ with _ lβ_invariant; cases' lβ; simp; rw [lβ_invariant]
#align dlist.to_list_append Batteries.DList.toList_append
theorem toList_cons (x : Ξ±) (l : DList Ξ±) : toList (cons x l) = x :: toList l := by
cases l; simp
#align dlist.to_list_cons Batteries.DList.toList_cons
| Mathlib/Data/DList/Defs.lean | 84 | 85 | theorem toList_push (x : Ξ±) (l : DList Ξ±) : toList (push l x) = toList l ++ [x] := by |
cases' l with _ l_invariant; simp; rw [l_invariant]
| [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (headβ :: tailβ)).toList = headβ :: tailβ",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... | [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (headβ :: tailβ)).toList = headβ :: tailβ",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... |
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.Tactic.ComputeDegree
#align_import linear_algebra.matrix.polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
set_option linter.uppercaseLean3 false
open Matrix Polynomial
variable {n Ξ± : Type*} [DecidableEq n] [Fintype n] [CommRing Ξ±]
open Polynomial Matrix Equiv.Perm
namespace Polynomial
theorem natDegree_det_X_add_C_le (A B : Matrix n n Ξ±) :
natDegree (det ((X : Ξ±[X]) β’ A.map C + B.map C : Matrix n n Ξ±[X])) β€ Fintype.card n := by
rw [det_apply]
refine (natDegree_sum_le _ _).trans ?_
refine Multiset.max_le_of_forall_le _ _ ?_
simp only [forall_apply_eq_imp_iff, true_and_iff, Function.comp_apply, Multiset.map_map,
Multiset.mem_map, exists_imp, Finset.mem_univ_val]
intro g
calc
natDegree (sign g β’ β i : n, (X β’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) β€
natDegree (β i : n, (X β’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) := by
cases' Int.units_eq_one_or (sign g) with sg sg
Β· rw [sg, one_smul]
Β· rw [sg, Units.neg_smul, one_smul, natDegree_neg]
_ β€ β i : n, natDegree (((X : Ξ±[X]) β’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i) :=
(natDegree_prod_le (Finset.univ : Finset n) fun i : n =>
(X β’ A.map C + B.map C : Matrix n n Ξ±[X]) (g i) i)
_ β€ Finset.univ.card β’ 1 := (Finset.sum_le_card_nsmul _ _ 1 fun (i : n) _ => ?_)
_ β€ Fintype.card n := by simp [mul_one, Algebra.id.smul_eq_mul, Finset.card_univ]
dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul]
compute_degree
#align polynomial.nat_degree_det_X_add_C_le Polynomial.natDegree_det_X_add_C_le
theorem coeff_det_X_add_C_zero (A B : Matrix n n Ξ±) :
coeff (det ((X : Ξ±[X]) β’ A.map C + B.map C)) 0 = det B := by
rw [det_apply, finset_sum_coeff, det_apply]
refine Finset.sum_congr rfl ?_
rintro g -
convert coeff_smul (R := Ξ±) (sign g) _ 0
rw [coeff_zero_prod]
refine Finset.prod_congr rfl ?_
simp
#align polynomial.coeff_det_X_add_C_zero Polynomial.coeff_det_X_add_C_zero
| Mathlib/LinearAlgebra/Matrix/Polynomial.lean | 73 | 86 | theorem coeff_det_X_add_C_card (A B : Matrix n n Ξ±) :
coeff (det ((X : Ξ±[X]) β’ A.map C + B.map C)) (Fintype.card n) = det A := by |
rw [det_apply, det_apply, finset_sum_coeff]
refine Finset.sum_congr rfl ?_
simp only [Algebra.id.smul_eq_mul, Finset.mem_univ, RingHom.mapMatrix_apply, forall_true_left,
map_apply, Pi.smul_apply]
intro g
convert coeff_smul (R := Ξ±) (sign g) _ _
rw [β mul_one (Fintype.card n)]
convert (coeff_prod_of_natDegree_le (R := Ξ±) _ _ _ _).symm
Β· simp [coeff_C]
Β· rintro p -
dsimp only [add_apply, smul_apply, map_apply, smul_eq_mul]
compute_degree
| [
" (X β’ A.map βC + B.map βC).det.natDegree β€ Fintype.card n",
" (β Ο : Equiv.Perm n, sign Ο β’ β i : n, (X β’ A.map βC + B.map βC) (Ο i) i).natDegree β€ Fintype.card n",
" Finset.fold max 0 (natDegree β fun Ο => sign Ο β’ β i : n, (X β’ A.map βC + B.map βC) (Ο i) i) Finset.univ β€\n Fintype.card n",
" β x β Multi... | [
" (X β’ A.map βC + B.map βC).det.natDegree β€ Fintype.card n",
" (β Ο : Equiv.Perm n, sign Ο β’ β i : n, (X β’ A.map βC + B.map βC) (Ο i) i).natDegree β€ Fintype.card n",
" Finset.fold max 0 (natDegree β fun Ο => sign Ο β’ β i : n, (X β’ A.map βC + B.map βC) (Ο i) i) Finset.univ β€\n Fintype.card n",
" β x β Multi... |
import Mathlib.Topology.MetricSpace.PseudoMetric
#align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
open Set Filter Bornology
open scoped NNReal Uniformity
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {X ΞΉ : Type*}
variable [PseudoMetricSpace Ξ±]
class MetricSpace (Ξ± : Type u) extends PseudoMetricSpace Ξ± : Type u where
eq_of_dist_eq_zero : β {x y : Ξ±}, dist x y = 0 β x = y
#align metric_space MetricSpace
@[ext]
theorem MetricSpace.ext {Ξ± : Type*} {m m' : MetricSpace Ξ±} (h : m.toDist = m'.toDist) :
m = m' := by
cases m; cases m'; congr; ext1; assumption
#align metric_space.ext MetricSpace.ext
def MetricSpace.ofDistTopology {Ξ± : Type u} [TopologicalSpace Ξ±] (dist : Ξ± β Ξ± β β)
(dist_self : β x : Ξ±, dist x x = 0) (dist_comm : β x y : Ξ±, dist x y = dist y x)
(dist_triangle : β x y z : Ξ±, dist x z β€ dist x y + dist y z)
(H : β s : Set Ξ±, IsOpen s β β x β s, β Ξ΅ > 0, β y, dist x y < Ξ΅ β y β s)
(eq_of_dist_eq_zero : β x y : Ξ±, dist x y = 0 β x = y) : MetricSpace Ξ± :=
{ PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with
eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ }
#align metric_space.of_dist_topology MetricSpace.ofDistTopology
variable {Ξ³ : Type w} [MetricSpace Ξ³]
theorem eq_of_dist_eq_zero {x y : Ξ³} : dist x y = 0 β x = y :=
MetricSpace.eq_of_dist_eq_zero
#align eq_of_dist_eq_zero eq_of_dist_eq_zero
@[simp]
theorem dist_eq_zero {x y : Ξ³} : dist x y = 0 β x = y :=
Iff.intro eq_of_dist_eq_zero fun this => this βΈ dist_self _
#align dist_eq_zero dist_eq_zero
@[simp]
theorem zero_eq_dist {x y : Ξ³} : 0 = dist x y β x = y := by rw [eq_comm, dist_eq_zero]
#align zero_eq_dist zero_eq_dist
theorem dist_ne_zero {x y : Ξ³} : dist x y β 0 β x β y := by
simpa only [not_iff_not] using dist_eq_zero
#align dist_ne_zero dist_ne_zero
@[simp]
theorem dist_le_zero {x y : Ξ³} : dist x y β€ 0 β x = y := by
simpa [le_antisymm_iff, dist_nonneg] using @dist_eq_zero _ _ x y
#align dist_le_zero dist_le_zero
@[simp]
theorem dist_pos {x y : Ξ³} : 0 < dist x y β x β y := by
simpa only [not_le] using not_congr dist_le_zero
#align dist_pos dist_pos
theorem eq_of_forall_dist_le {x y : Ξ³} (h : β Ξ΅ > 0, dist x y β€ Ξ΅) : x = y :=
eq_of_dist_eq_zero (eq_of_le_of_forall_le_of_dense dist_nonneg h)
#align eq_of_forall_dist_le eq_of_forall_dist_le
theorem eq_of_nndist_eq_zero {x y : Ξ³} : nndist x y = 0 β x = y := by
simp only [β NNReal.eq_iff, β dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero]
#align eq_of_nndist_eq_zero eq_of_nndist_eq_zero
@[simp]
theorem nndist_eq_zero {x y : Ξ³} : nndist x y = 0 β x = y := by
simp only [β NNReal.eq_iff, β dist_nndist, imp_self, NNReal.coe_zero, dist_eq_zero]
#align nndist_eq_zero nndist_eq_zero
@[simp]
| Mathlib/Topology/MetricSpace/Basic.lean | 107 | 108 | theorem zero_eq_nndist {x y : Ξ³} : 0 = nndist x y β x = y := by |
simp only [β NNReal.eq_iff, β dist_nndist, imp_self, NNReal.coe_zero, zero_eq_dist]
| [
" m = m'",
" mk eq_of_dist_eq_zeroβ = m'",
" mk eq_of_dist_eq_zeroβΒΉ = mk eq_of_dist_eq_zeroβ",
" toPseudoMetricSpaceβΒΉ = toPseudoMetricSpaceβ",
" PseudoMetricSpace.toDist = PseudoMetricSpace.toDist",
" 0 = dist x y β x = y",
" dist x y β 0 β x β y",
" dist x y β€ 0 β x = y",
" 0 < dist x y β x β y",... | [
" m = m'",
" mk eq_of_dist_eq_zeroβ = m'",
" mk eq_of_dist_eq_zeroβΒΉ = mk eq_of_dist_eq_zeroβ",
" toPseudoMetricSpaceβΒΉ = toPseudoMetricSpaceβ",
" PseudoMetricSpace.toDist = PseudoMetricSpace.toDist",
" 0 = dist x y β x = y",
" dist x y β 0 β x β y",
" dist x y β€ 0 β x = y",
" 0 < dist x y β x β y",... |
import Mathlib.Analysis.SpecialFunctions.Bernstein
import Mathlib.Topology.Algebra.Algebra
#align_import topology.continuous_function.weierstrass from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
open ContinuousMap Filter
open scoped unitInterval
theorem polynomialFunctions_closure_eq_top' : (polynomialFunctions I).topologicalClosure = β€ := by
rw [eq_top_iff]
rintro f -
refine Filter.Frequently.mem_closure ?_
refine Filter.Tendsto.frequently (bernsteinApproximation_uniform f) ?_
apply frequently_of_forall
intro n
simp only [SetLike.mem_coe]
apply Subalgebra.sum_mem
rintro n -
apply Subalgebra.smul_mem
dsimp [bernstein, polynomialFunctions]
simp
#align polynomial_functions_closure_eq_top' polynomialFunctions_closure_eq_top'
theorem polynomialFunctions_closure_eq_top (a b : β) :
(polynomialFunctions (Set.Icc a b)).topologicalClosure = β€ := by
cases' lt_or_le a b with h h
-- (Otherwise it's easy; we'll deal with that later.)
Β· -- We can pullback continuous functions on `[a,b]` to continuous functions on `[0,1]`,
-- by precomposing with an affine map.
let W : C(Set.Icc a b, β) ββ[β] C(I, β) :=
compRightAlgHom β β (iccHomeoI a b h).symm.toContinuousMap
-- This operation is itself a homeomorphism
-- (with respect to the norm topologies on continuous functions).
let W' : C(Set.Icc a b, β) ββ C(I, β) := compRightHomeomorph β (iccHomeoI a b h).symm
have w : (W : C(Set.Icc a b, β) β C(I, β)) = W' := rfl
-- Thus we take the statement of the Weierstrass approximation theorem for `[0,1]`,
have p := polynomialFunctions_closure_eq_top'
-- and pullback both sides, obtaining an equation between subalgebras of `C([a,b], β)`.
apply_fun fun s => s.comap W at p
simp only [Algebra.comap_top] at p
-- Since the pullback operation is continuous, it commutes with taking `topologicalClosure`,
rw [Subalgebra.topologicalClosure_comap_homeomorph _ W W' w] at p
-- and precomposing with an affine map takes polynomial functions to polynomial functions.
rw [polynomialFunctions.comap_compRightAlgHom_iccHomeoI] at p
-- π
exact p
Β· -- Otherwise, `b β€ a`, and the interval is a subsingleton,
have : Subsingleton (Set.Icc a b) := (Set.subsingleton_Icc_of_ge h).coe_sort
apply Subsingleton.elim
#align polynomial_functions_closure_eq_top polynomialFunctions_closure_eq_top
theorem continuousMap_mem_polynomialFunctions_closure (a b : β) (f : C(Set.Icc a b, β)) :
f β (polynomialFunctions (Set.Icc a b)).topologicalClosure := by
rw [polynomialFunctions_closure_eq_top _ _]
simp
#align continuous_map_mem_polynomial_functions_closure continuousMap_mem_polynomialFunctions_closure
open scoped Polynomial
| Mathlib/Topology/ContinuousFunction/Weierstrass.lean | 99 | 105 | theorem exists_polynomial_near_continuousMap (a b : β) (f : C(Set.Icc a b, β)) (Ξ΅ : β)
(pos : 0 < Ξ΅) : β p : β[X], βp.toContinuousMapOn _ - fβ < Ξ΅ := by |
have w := mem_closure_iff_frequently.mp (continuousMap_mem_polynomialFunctions_closure _ _ f)
rw [Metric.nhds_basis_ball.frequently_iff] at w
obtain β¨-, H, β¨m, β¨-, rflβ©β©β© := w Ξ΅ pos
rw [Metric.mem_ball, dist_eq_norm] at H
exact β¨m, Hβ©
| [
" (polynomialFunctions I).topologicalClosure = β€",
" β€ β€ (polynomialFunctions I).topologicalClosure",
" f β (polynomialFunctions I).topologicalClosure",
" βαΆ (x : C(βI, β)) in nhds f, x β β(polynomialFunctions I)",
" βαΆ (x : β) in atTop, bernsteinApproximation x f β β(polynomialFunctions I)",
" β (x : β),... | [
" (polynomialFunctions I).topologicalClosure = β€",
" β€ β€ (polynomialFunctions I).topologicalClosure",
" f β (polynomialFunctions I).topologicalClosure",
" βαΆ (x : C(βI, β)) in nhds f, x β β(polynomialFunctions I)",
" βαΆ (x : β) in atTop, bernsteinApproximation x f β β(polynomialFunctions I)",
" β (x : β),... |
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Data.Finset.Basic
import Mathlib.Order.Interval.Finset.Defs
open Function
namespace Finset
class HasAntidiagonal (A : Type*) [AddMonoid A] where
antidiagonal : A β Finset (A Γ A)
mem_antidiagonal {n} {a} : a β antidiagonal n β a.fst + a.snd = n
export HasAntidiagonal (antidiagonal mem_antidiagonal)
attribute [simp] mem_antidiagonal
variable {A : Type*}
instance [AddMonoid A] : Subsingleton (HasAntidiagonal A) :=
β¨by
rintro β¨a, haβ© β¨b, hbβ©
congr with n xy
rw [ha, hb]β©
-- The goal of this lemma is to allow to rewrite antidiagonal
-- when the decidability instances obsucate Lean
lemma hasAntidiagonal_congr (A : Type*) [AddMonoid A]
[H1 : HasAntidiagonal A] [H2 : HasAntidiagonal A] :
H1.antidiagonal = H2.antidiagonal := by congr!; apply Subsingleton.elim
theorem swap_mem_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} {xy : A Γ A}:
xy.swap β antidiagonal n β xy β antidiagonal n := by
simp [add_comm]
@[simp] theorem map_prodComm_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} :
(antidiagonal n).map (Equiv.prodComm A A) = antidiagonal n :=
Finset.ext fun β¨a, bβ© => by simp [add_comm]
@[simp] theorem map_swap_antidiagonal [AddCommMonoid A] [HasAntidiagonal A] {n : A} :
(antidiagonal n).map β¨Prod.swap, Prod.swap_injectiveβ© = antidiagonal n :=
map_prodComm_antidiagonal
#align finset.nat.map_swap_antidiagonal Finset.map_swap_antidiagonal
section CanonicallyOrderedAddCommMonoid
variable [CanonicallyOrderedAddCommMonoid A] [HasAntidiagonal A]
@[simp]
theorem antidiagonal_zero : antidiagonal (0 : A) = {(0, 0)} := by
ext β¨x, yβ©
simp
theorem antidiagonal.fst_le {n : A} {kl : A Γ A} (hlk : kl β antidiagonal n) : kl.1 β€ n := by
rw [le_iff_exists_add]
use kl.2
rwa [mem_antidiagonal, eq_comm] at hlk
#align finset.nat.antidiagonal.fst_le Finset.antidiagonal.fst_le
| Mathlib/Data/Finset/Antidiagonal.lean | 141 | 144 | theorem antidiagonal.snd_le {n : A} {kl : A Γ A} (hlk : kl β antidiagonal n) : kl.2 β€ n := by |
rw [le_iff_exists_add]
use kl.1
rwa [mem_antidiagonal, eq_comm, add_comm] at hlk
| [
" β (a b : HasAntidiagonal A), a = b",
" { antidiagonal := a, mem_antidiagonal := ha } = { antidiagonal := b, mem_antidiagonal := hb }",
" xy β a n β xy β b n",
" antidiagonal = antidiagonal",
" H1 = H2",
" xy.swap β antidiagonal n β xy β antidiagonal n",
" (a, b) β map (Equiv.prodComm A A).toEmbedding ... | [
" β (a b : HasAntidiagonal A), a = b",
" { antidiagonal := a, mem_antidiagonal := ha } = { antidiagonal := b, mem_antidiagonal := hb }",
" xy β a n β xy β b n",
" antidiagonal = antidiagonal",
" H1 = H2",
" xy.swap β antidiagonal n β xy β antidiagonal n",
" (a, b) β map (Equiv.prodComm A A).toEmbedding ... |
import Mathlib.MeasureTheory.Integral.SetToL1
#align_import measure_theory.integral.bochner from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
assert_not_exists Differentiable
noncomputable section
open scoped Topology NNReal ENNReal MeasureTheory
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {Ξ± E F π : Type*}
section WeightedSMul
open ContinuousLinearMap
variable [NormedAddCommGroup F] [NormedSpace β F] {m : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±}
def weightedSMul {_ : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (s : Set Ξ±) : F βL[β] F :=
(ΞΌ s).toReal β’ ContinuousLinearMap.id β F
#align measure_theory.weighted_smul MeasureTheory.weightedSMul
theorem weightedSMul_apply {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (s : Set Ξ±) (x : F) :
weightedSMul ΞΌ s x = (ΞΌ s).toReal β’ x := by simp [weightedSMul]
#align measure_theory.weighted_smul_apply MeasureTheory.weightedSMul_apply
@[simp]
theorem weightedSMul_zero_measure {m : MeasurableSpace Ξ±} :
weightedSMul (0 : Measure Ξ±) = (0 : Set Ξ± β F βL[β] F) := by ext1; simp [weightedSMul]
#align measure_theory.weighted_smul_zero_measure MeasureTheory.weightedSMul_zero_measure
@[simp]
theorem weightedSMul_empty {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) :
weightedSMul ΞΌ β
= (0 : F βL[β] F) := by ext1 x; rw [weightedSMul_apply]; simp
#align measure_theory.weighted_smul_empty MeasureTheory.weightedSMul_empty
theorem weightedSMul_add_measure {m : MeasurableSpace Ξ±} (ΞΌ Ξ½ : Measure Ξ±) {s : Set Ξ±}
(hΞΌs : ΞΌ s β β) (hΞ½s : Ξ½ s β β) :
(weightedSMul (ΞΌ + Ξ½) s : F βL[β] F) = weightedSMul ΞΌ s + weightedSMul Ξ½ s := by
ext1 x
push_cast
simp_rw [Pi.add_apply, weightedSMul_apply]
push_cast
rw [Pi.add_apply, ENNReal.toReal_add hΞΌs hΞ½s, add_smul]
#align measure_theory.weighted_smul_add_measure MeasureTheory.weightedSMul_add_measure
theorem weightedSMul_smul_measure {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) (c : ββ₯0β) {s : Set Ξ±} :
(weightedSMul (c β’ ΞΌ) s : F βL[β] F) = c.toReal β’ weightedSMul ΞΌ s := by
ext1 x
push_cast
simp_rw [Pi.smul_apply, weightedSMul_apply]
push_cast
simp_rw [Pi.smul_apply, smul_eq_mul, toReal_mul, smul_smul]
#align measure_theory.weighted_smul_smul_measure MeasureTheory.weightedSMul_smul_measure
theorem weightedSMul_congr (s t : Set Ξ±) (hst : ΞΌ s = ΞΌ t) :
(weightedSMul ΞΌ s : F βL[β] F) = weightedSMul ΞΌ t := by
ext1 x; simp_rw [weightedSMul_apply]; congr 2
#align measure_theory.weighted_smul_congr MeasureTheory.weightedSMul_congr
| Mathlib/MeasureTheory/Integral/Bochner.lean | 209 | 210 | theorem weightedSMul_null {s : Set Ξ±} (h_zero : ΞΌ s = 0) : (weightedSMul ΞΌ s : F βL[β] F) = 0 := by |
ext1 x; rw [weightedSMul_apply, h_zero]; simp
| [
" (weightedSMul ΞΌ s) x = (ΞΌ s).toReal β’ x",
" weightedSMul 0 = 0",
" weightedSMul 0 xβ = 0 xβ",
" weightedSMul ΞΌ β
= 0",
" (weightedSMul ΞΌ β
) x = 0 x",
" (ΞΌ β
).toReal β’ x = 0 x",
" weightedSMul (ΞΌ + Ξ½) s = weightedSMul ΞΌ s + weightedSMul Ξ½ s",
" (weightedSMul (ΞΌ + Ξ½) s) x = (weightedSMul ΞΌ s + weighte... | [
" (weightedSMul ΞΌ s) x = (ΞΌ s).toReal β’ x",
" weightedSMul 0 = 0",
" weightedSMul 0 xβ = 0 xβ",
" weightedSMul ΞΌ β
= 0",
" (weightedSMul ΞΌ β
) x = 0 x",
" (ΞΌ β
).toReal β’ x = 0 x",
" weightedSMul (ΞΌ + Ξ½) s = weightedSMul ΞΌ s + weightedSMul Ξ½ s",
" (weightedSMul (ΞΌ + Ξ½) s) x = (weightedSMul ΞΌ s + weighte... |
import Mathlib.Analysis.SpecialFunctions.Exponential
#align_import analysis.special_functions.trigonometric.series from "leanprover-community/mathlib"@"ccf84e0d918668460a34aa19d02fe2e0e2286da0"
open NormedSpace
open scoped Nat
section SinCos
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Series.lean | 32 | 46 | theorem Complex.hasSum_cos' (z : β) :
HasSum (fun n : β => (z * Complex.I) ^ (2 * n) / β(2 * n)!) (Complex.cos z) := by |
rw [Complex.cos, Complex.exp_eq_exp_β]
have := ((expSeries_div_hasSum_exp β (z * Complex.I)).add
(expSeries_div_hasSum_exp β (-z * Complex.I))).div_const 2
replace := (Nat.divModEquiv 2).symm.hasSum_iff.mpr this
dsimp [Function.comp_def] at this
simp_rw [β mul_comm 2 _] at this
refine this.prod_fiberwise fun k => ?_
dsimp only
convert hasSum_fintype (_ : Fin 2 β β) using 1
rw [Fin.sum_univ_two]
simp_rw [Fin.val_zero, Fin.val_one, add_zero, pow_succ, pow_mul, mul_pow, neg_sq, β two_mul,
neg_mul, mul_neg, neg_div, add_right_neg, zero_div, add_zero,
mul_div_cancel_leftβ _ (two_ne_zero : (2 : β) β 0)]
| [
" HasSum (fun n => (z * I) ^ (2 * n) / β(2 * n)!) z.cos",
" HasSum (fun n => (z * I) ^ (2 * n) / β(2 * n)!) ((NormedSpace.exp β (z * I) + NormedSpace.exp β (-z * I)) / 2)",
" HasSum\n (fun c =>\n ((z * I) ^ (2 * (k, c).1 + β(k, c).2) / β(2 * (k, c).1 + β(k, c).2)! +\n (-z * I) ^ (2 * (k, c).1 +... | [
" HasSum (fun n => (z * I) ^ (2 * n) / β(2 * n)!) z.cos"
] |
import Mathlib.SetTheory.Ordinal.Arithmetic
import Mathlib.Tactic.TFAE
import Mathlib.Topology.Order.Monotone
#align_import set_theory.ordinal.topology from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da"
noncomputable section
universe u v
open Cardinal Order Topology
namespace Ordinal
variable {s : Set Ordinal.{u}} {a : Ordinal.{u}}
instance : TopologicalSpace Ordinal.{u} := Preorder.topology Ordinal.{u}
instance : OrderTopology Ordinal.{u} := β¨rflβ©
| Mathlib/SetTheory/Ordinal/Topology.lean | 41 | 53 | theorem isOpen_singleton_iff : IsOpen ({a} : Set Ordinal) β Β¬IsLimit a := by |
refine β¨fun h β¨hβ, hsuccβ© => ?_, fun ha => ?_β©
Β· obtain β¨b, c, hbc, hbc'β© :=
(mem_nhds_iff_exists_Ioo_subset' β¨0, Ordinal.pos_iff_ne_zero.2 hββ© β¨_, lt_succ aβ©).1
(h.mem_nhds rfl)
have hba := hsucc b hbc.1
exact hba.ne (hbc' β¨lt_succ b, hba.trans hbc.2β©)
Β· rcases zero_or_succ_or_limit a with (rfl | β¨b, rflβ© | ha')
Β· rw [β bot_eq_zero, β Set.Iic_bot, β Iio_succ]
exact isOpen_Iio
Β· rw [β Set.Icc_self, Icc_succ_left, β Ioo_succ_right]
exact isOpen_Ioo
Β· exact (ha ha').elim
| [
" IsOpen {a} β Β¬a.IsLimit",
" False",
" IsOpen {a}",
" IsOpen {0}",
" IsOpen (Set.Iio (succ β₯))",
" IsOpen {succ b}",
" IsOpen (Set.Ioo b (succ (succ b)))"
] | [
" IsOpen {a} β Β¬a.IsLimit"
] |
import Mathlib.Data.Finset.Image
import Mathlib.Data.List.FinRange
#align_import data.fintype.basic from "leanprover-community/mathlib"@"d78597269638367c3863d40d45108f52207e03cf"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
open Function
open Nat
universe u v
variable {Ξ± Ξ² Ξ³ : Type*}
class Fintype (Ξ± : Type*) where
elems : Finset Ξ±
complete : β x : Ξ±, x β elems
#align fintype Fintype
namespace Finset
variable [Fintype Ξ±] {s t : Finset Ξ±}
def univ : Finset Ξ± :=
@Fintype.elems Ξ± _
#align finset.univ Finset.univ
@[simp]
theorem mem_univ (x : Ξ±) : x β (univ : Finset Ξ±) :=
Fintype.complete x
#align finset.mem_univ Finset.mem_univ
-- Porting note: removing @[simp], simp can prove it
theorem mem_univ_val : β x, x β (univ : Finset Ξ±).1 :=
mem_univ
#align finset.mem_univ_val Finset.mem_univ_val
theorem eq_univ_iff_forall : s = univ β β x, x β s := by simp [ext_iff]
#align finset.eq_univ_iff_forall Finset.eq_univ_iff_forall
theorem eq_univ_of_forall : (β x, x β s) β s = univ :=
eq_univ_iff_forall.2
#align finset.eq_univ_of_forall Finset.eq_univ_of_forall
@[simp, norm_cast]
| Mathlib/Data/Fintype/Basic.lean | 92 | 92 | theorem coe_univ : β(univ : Finset Ξ±) = (Set.univ : Set Ξ±) := by | ext; simp
| [
" s = univ β β (x : Ξ±), x β s",
" βuniv = Set.univ",
" xβ β βuniv β xβ β Set.univ"
] | [
" s = univ β β (x : Ξ±), x β s",
" βuniv = Set.univ"
] |
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Algebra.Group.Basic
#align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u
open Nat
namespace Int
variable {R : Type u} [AddGroupWithOne R]
@[simp, norm_cast squash]
theorem cast_negSucc (n : β) : (-[n+1] : R) = -(n + 1 : β) :=
AddGroupWithOne.intCast_negSucc n
#align int.cast_neg_succ_of_nat Int.cast_negSuccβ
-- expected `n` to be implicit, and `HasLiftT`
@[simp, norm_cast]
theorem cast_zero : ((0 : β€) : R) = 0 :=
(AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero
#align int.cast_zero Int.cast_zeroβ
-- type had `HasLiftT`
-- This lemma competes with `Int.ofNat_eq_natCast` to come later
@[simp high, nolint simpNF, norm_cast]
theorem cast_natCast (n : β) : ((n : β€) : R) = n :=
AddGroupWithOne.intCast_ofNat _
#align int.cast_coe_nat Int.cast_natCastβ
-- expected `n` to be implicit, and `HasLiftT`
#align int.cast_of_nat Int.cast_natCastβ
-- See note [no_index around OfNat.ofNat]
@[simp, norm_cast]
| Mathlib/Data/Int/Cast/Basic.lean | 74 | 76 | theorem cast_ofNat (n : β) [n.AtLeastTwo] :
((no_index (OfNat.ofNat n) : β€) : R) = OfNat.ofNat n := by |
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
| [
" β(OfNat.ofNat n) = OfNat.ofNat n"
] | [
" β(OfNat.ofNat n) = OfNat.ofNat n"
] |
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
open scoped ENNReal
namespace MeasureTheory
variable {Ξ± E : Type*} {m0 : MeasurableSpace Ξ±} [NormedAddCommGroup E]
{p : ββ₯0β} (ΞΌ : Measure Ξ±) {f : Ξ± β E}
| Mathlib/MeasureTheory/Function/LpSeminorm/ChebyshevMarkov.lean | 23 | 28 | theorem pow_mul_meas_ge_le_snorm (hp_ne_zero : p β 0) (hp_ne_top : p β β)
(hf : AEStronglyMeasurable f ΞΌ) (Ξ΅ : ββ₯0β) :
(Ξ΅ * ΞΌ { x | Ξ΅ β€ (βf xββ : ββ₯0β) ^ p.toReal }) ^ (1 / p.toReal) β€ snorm f p ΞΌ := by |
rw [snorm_eq_lintegral_rpow_nnnorm hp_ne_zero hp_ne_top]
gcongr
exact mul_meas_ge_le_lintegralβ (hf.ennnorm.pow_const _) Ξ΅
| [
" (Ξ΅ * ΞΌ {x | Ξ΅ β€ ββf xββ ^ p.toReal}) ^ (1 / p.toReal) β€ snorm f p ΞΌ",
" (Ξ΅ * ΞΌ {x | Ξ΅ β€ ββf xββ ^ p.toReal}) ^ (1 / p.toReal) β€ (β«β» (x : Ξ±), ββf xββ ^ p.toReal βΞΌ) ^ (1 / p.toReal)",
" Ξ΅ * ΞΌ {x | Ξ΅ β€ ββf xββ ^ p.toReal} β€ β«β» (x : Ξ±), ββf xββ ^ p.toReal βΞΌ"
] | [
" (Ξ΅ * ΞΌ {x | Ξ΅ β€ ββf xββ ^ p.toReal}) ^ (1 / p.toReal) β€ snorm f p ΞΌ"
] |
import Mathlib.SetTheory.Cardinal.Ordinal
#align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925"
namespace Cardinal
universe u v
open Cardinal
def continuum : Cardinal.{u} :=
2 ^ β΅β
#align cardinal.continuum Cardinal.continuum
scoped notation "π " => Cardinal.continuum
@[simp]
theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} :=
rfl
#align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0
@[simp]
theorem lift_continuum : lift.{v} π = π := by
rw [β two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0]
#align cardinal.lift_continuum Cardinal.lift_continuum
@[simp]
theorem continuum_le_lift {c : Cardinal.{u}} : π β€ lift.{v} c β π β€ c := by
-- Porting note: added explicit universes
rw [β lift_continuum.{u,v}, lift_le]
#align cardinal.continuum_le_lift Cardinal.continuum_le_lift
@[simp]
theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c β€ π β c β€ π := by
-- Porting note: added explicit universes
rw [β lift_continuum.{u,v}, lift_le]
#align cardinal.lift_le_continuum Cardinal.lift_le_continuum
@[simp]
theorem continuum_lt_lift {c : Cardinal.{u}} : π < lift.{v} c β π < c := by
-- Porting note: added explicit universes
rw [β lift_continuum.{u,v}, lift_lt]
#align cardinal.continuum_lt_lift Cardinal.continuum_lt_lift
@[simp]
| Mathlib/SetTheory/Cardinal/Continuum.lean | 64 | 66 | theorem lift_lt_continuum {c : Cardinal.{u}} : lift.{v} c < π β c < π := by |
-- Porting note: added explicit universes
rw [β lift_continuum.{u,v}, lift_lt]
| [
" lift.{v, u_1} π = π ",
" π β€ lift.{v, u} c β π β€ c",
" lift.{v, u} c β€ π β c β€ π ",
" π < lift.{v, u} c β π < c",
" lift.{v, u} c < π β c < π "
] | [
" lift.{v, u_1} π = π ",
" π β€ lift.{v, u} c β π β€ c",
" lift.{v, u} c β€ π β c β€ π ",
" π < lift.{v, u} c β π < c",
" lift.{v, u} c < π β c < π "
] |
import Mathlib.Probability.Variance
import Mathlib.MeasureTheory.Function.UniformIntegrable
#align_import probability.ident_distrib from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open MeasureTheory Filter Finset
noncomputable section
open scoped Topology MeasureTheory ENNReal NNReal
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} [MeasurableSpace Ξ±] [MeasurableSpace Ξ²] [MeasurableSpace Ξ³]
[MeasurableSpace Ξ΄]
namespace ProbabilityTheory
structure IdentDistrib (f : Ξ± β Ξ³) (g : Ξ² β Ξ³)
(ΞΌ : Measure Ξ± := by volume_tac)
(Ξ½ : Measure Ξ² := by volume_tac) : Prop where
aemeasurable_fst : AEMeasurable f ΞΌ
aemeasurable_snd : AEMeasurable g Ξ½
map_eq : Measure.map f ΞΌ = Measure.map g Ξ½
#align probability_theory.ident_distrib ProbabilityTheory.IdentDistrib
section UniformIntegrable
open TopologicalSpace
variable {E : Type*} [MeasurableSpace E] [NormedAddCommGroup E] [BorelSpace E]
{ΞΌ : Measure Ξ±} [IsFiniteMeasure ΞΌ]
| Mathlib/Probability/IdentDistrib.lean | 326 | 348 | theorem Memβp.uniformIntegrable_of_identDistrib_aux {ΞΉ : Type*} {f : ΞΉ β Ξ± β E} {j : ΞΉ} {p : ββ₯0β}
(hp : 1 β€ p) (hp' : p β β) (hβp : Memβp (f j) p ΞΌ) (hfmeas : β i, StronglyMeasurable (f i))
(hf : β i, IdentDistrib (f i) (f j) ΞΌ ΞΌ) : UniformIntegrable f p ΞΌ := by |
refine uniformIntegrable_of' hp hp' hfmeas fun Ξ΅ hΞ΅ => ?_
by_cases hΞΉ : Nonempty ΞΉ
swap; Β· exact β¨0, fun i => False.elim (hΞΉ <| Nonempty.intro i)β©
obtain β¨C, hCβ, hCββ© := hβp.snorm_indicator_norm_ge_pos_le (hfmeas _) hΞ΅
refine β¨β¨C, hCβ.leβ©, fun i => le_trans (le_of_eq ?_) hCββ©
have : {x | (β¨C, hCβ.leβ© : ββ₯0) β€ βf i xββ} = {x | C β€ βf i xβ} := by
ext x
simp_rw [β norm_toNNReal]
exact Real.le_toNNReal_iff_coe_le (norm_nonneg _)
rw [this, β snorm_norm, β snorm_norm (Set.indicator _ _)]
simp_rw [norm_indicator_eq_indicator_norm, coe_nnnorm]
let F : E β β := (fun x : E => if (β¨C, hCβ.leβ© : ββ₯0) β€ βxββ then βxβ else 0)
have F_meas : Measurable F := by
apply measurable_norm.indicator (measurableSet_le measurable_const measurable_nnnorm)
have : β k, (fun x β¦ Set.indicator {x | C β€ βf k xβ} (fun a β¦ βf k aβ) x) = F β f k := by
intro k
ext x
simp only [Set.indicator, Set.mem_setOf_eq]; norm_cast
rw [this, this, β snorm_map_measure F_meas.aestronglyMeasurable (hf i).aemeasurable_fst,
(hf i).map_eq, snorm_map_measure F_meas.aestronglyMeasurable (hf j).aemeasurable_fst]
| [
" UniformIntegrable f p ΞΌ",
" β C, β (i : ΞΉ), snorm ({x | C β€ βf i xββ}.indicator (f i)) p ΞΌ β€ ENNReal.ofReal Ξ΅",
" snorm ({x | β¨C, β―β© β€ βf i xββ}.indicator (f i)) p ΞΌ = snorm ({x | C β€ ββf j xββ}.indicator (f j)) p ΞΌ",
" {x | β¨C, β―β© β€ βf i xββ} = {x | C β€ βf i xβ}",
" x β {x | β¨C, β―β© β€ βf i xββ} β x β {x |... | [
" UniformIntegrable f p ΞΌ"
] |
import Mathlib.Topology.Order.Basic
import Mathlib.Data.Set.Pointwise.Basic
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {Ξ± Ξ² Ξ³ : Type*}
section LinearOrder
variable [TopologicalSpace Ξ±] [LinearOrder Ξ±]
section OrderTopology
variable [OrderTopology Ξ±]
open List in
theorem TFAE_mem_nhdsWithin_Ioi {a b : Ξ±} (hab : a < b) (s : Set Ξ±) :
TFAE [s β π[>] a,
s β π[Ioc a b] a,
s β π[Ioo a b] a,
β u β Ioc a b, Ioo a u β s,
β u β Ioi a, Ioo a u β s] := by
tfae_have 1 β 2
Β· rw [nhdsWithin_Ioc_eq_nhdsWithin_Ioi hab]
tfae_have 1 β 3
Β· rw [nhdsWithin_Ioo_eq_nhdsWithin_Ioi hab]
tfae_have 4 β 5
Β· exact fun β¨u, umem, huβ© => β¨u, umem.1, huβ©
tfae_have 5 β 1
Β· rintro β¨u, hau, huβ©
exact mem_of_superset (Ioo_mem_nhdsWithin_Ioi β¨le_refl a, hauβ©) hu
tfae_have 1 β 4
Β· intro h
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.1 h with β¨v, va, hvβ©
rcases exists_Ico_subset_of_mem_nhds' va hab with β¨u, au, huβ©
exact β¨u, au, fun x hx => hv β¨hu β¨le_of_lt hx.1, hx.2β©, hx.1β©β©
tfae_finish
#align tfae_mem_nhds_within_Ioi TFAE_mem_nhdsWithin_Ioi
theorem mem_nhdsWithin_Ioi_iff_exists_mem_Ioc_Ioo_subset {a u' : Ξ±} {s : Set Ξ±} (hu' : a < u') :
s β π[>] a β β u β Ioc a u', Ioo a u β s :=
(TFAE_mem_nhdsWithin_Ioi hu' s).out 0 3
#align mem_nhds_within_Ioi_iff_exists_mem_Ioc_Ioo_subset mem_nhdsWithin_Ioi_iff_exists_mem_Ioc_Ioo_subset
theorem mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' {a u' : Ξ±} {s : Set Ξ±} (hu' : a < u') :
s β π[>] a β β u β Ioi a, Ioo a u β s :=
(TFAE_mem_nhdsWithin_Ioi hu' s).out 0 4
#align mem_nhds_within_Ioi_iff_exists_Ioo_subset' mem_nhdsWithin_Ioi_iff_exists_Ioo_subset'
theorem nhdsWithin_Ioi_basis' {a : Ξ±} (h : β b, a < b) : (π[>] a).HasBasis (a < Β·) (Ioo a) :=
let β¨_, hβ© := h
β¨fun _ => mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' hβ©
lemma nhdsWithin_Ioi_basis [NoMaxOrder Ξ±] (a : Ξ±) : (π[>] a).HasBasis (a < Β·) (Ioo a) :=
nhdsWithin_Ioi_basis' <| exists_gt a
theorem nhdsWithin_Ioi_eq_bot_iff {a : Ξ±} : π[>] a = β₯ β IsTop a β¨ β b, a β b := by
by_cases ha : IsTop a
Β· simp [ha, ha.isMax.Ioi_eq]
Β· simp only [ha, false_or]
rw [isTop_iff_isMax, not_isMax_iff] at ha
simp only [(nhdsWithin_Ioi_basis' ha).eq_bot_iff, covBy_iff_Ioo_eq]
theorem mem_nhdsWithin_Ioi_iff_exists_Ioo_subset [NoMaxOrder Ξ±] {a : Ξ±} {s : Set Ξ±} :
s β π[>] a β β u β Ioi a, Ioo a u β s :=
let β¨_u', hu'β© := exists_gt a
mem_nhdsWithin_Ioi_iff_exists_Ioo_subset' hu'
#align mem_nhds_within_Ioi_iff_exists_Ioo_subset mem_nhdsWithin_Ioi_iff_exists_Ioo_subset
theorem countable_setOf_isolated_right [SecondCountableTopology Ξ±] :
{ x : Ξ± | π[>] x = β₯ }.Countable := by
simp only [nhdsWithin_Ioi_eq_bot_iff, setOf_or]
exact (subsingleton_isTop Ξ±).countable.union countable_setOf_covBy_right
theorem countable_setOf_isolated_left [SecondCountableTopology Ξ±] :
{ x : Ξ± | π[<] x = β₯ }.Countable :=
countable_setOf_isolated_right (Ξ± := Ξ±α΅α΅)
theorem mem_nhdsWithin_Ioi_iff_exists_Ioc_subset [NoMaxOrder Ξ±] [DenselyOrdered Ξ±] {a : Ξ±}
{s : Set Ξ±} : s β π[>] a β β u β Ioi a, Ioc a u β s := by
rw [mem_nhdsWithin_Ioi_iff_exists_Ioo_subset]
constructor
Β· rintro β¨u, au, asβ©
rcases exists_between au with β¨v, hvβ©
exact β¨v, hv.1, fun x hx => as β¨hx.1, lt_of_le_of_lt hx.2 hv.2β©β©
Β· rintro β¨u, au, asβ©
exact β¨u, au, Subset.trans Ioo_subset_Ioc_self asβ©
#align mem_nhds_within_Ioi_iff_exists_Ioc_subset mem_nhdsWithin_Ioi_iff_exists_Ioc_subset
open List in
| Mathlib/Topology/Order/LeftRightNhds.lean | 131 | 138 | theorem TFAE_mem_nhdsWithin_Iio {a b : Ξ±} (h : a < b) (s : Set Ξ±) :
TFAE [s β π[<] b,-- 0 : `s` is a neighborhood of `b` within `(-β, b)`
s β π[Ico a b] b,-- 1 : `s` is a neighborhood of `b` within `[a, b)`
s β π[Ioo a b] b,-- 2 : `s` is a neighborhood of `b` within `(a, b)`
β l β Ico a b, Ioo l b β s,-- 3 : `s` includes `(l, b)` for some `l β [a, b)`
β l β Iio b, Ioo l b β s] := by | -- 4 : `s` includes `(l, b)` for some `l < b`
simpa only [exists_prop, OrderDual.exists, dual_Ioi, dual_Ioc, dual_Ioo] using
TFAE_mem_nhdsWithin_Ioi h.dual (ofDual β»ΒΉ' s)
| [
" [s β π[>] a, s β π[Ioc a b] a, s β π[Ioo a b] a, β u β Ioc a b, Ioo a u β s, β u β Ioi a, Ioo a u β s].TFAE",
" s β π[>] a β s β π[Ioc a b] a",
" s β π[>] a β s β π[Ioo a b] a",
" (β u β Ioc a b, Ioo a u β s) β β u β Ioi a, Ioo a u β s",
" (β u β Ioi a, Ioo a u β s) β s β π[>] a",
" s β π[>] a"... | [
" [s β π[>] a, s β π[Ioc a b] a, s β π[Ioo a b] a, β u β Ioc a b, Ioo a u β s, β u β Ioi a, Ioo a u β s].TFAE",
" s β π[>] a β s β π[Ioc a b] a",
" s β π[>] a β s β π[Ioo a b] a",
" (β u β Ioc a b, Ioo a u β s) β β u β Ioi a, Ioo a u β s",
" (β u β Ioi a, Ioo a u β s) β s β π[>] a",
" s β π[>] a"... |
import Mathlib.Order.Filter.Lift
import Mathlib.Order.Filter.AtTopBot
#align_import order.filter.small_sets from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
open Filter
open Filter Set
variable {Ξ± Ξ² : Type*} {ΞΉ : Sort*}
namespace Filter
variable {l l' la : Filter Ξ±} {lb : Filter Ξ²}
def smallSets (l : Filter Ξ±) : Filter (Set Ξ±) :=
l.lift' powerset
#align filter.small_sets Filter.smallSets
| Mathlib/Order/Filter/SmallSets.lean | 40 | 42 | theorem smallSets_eq_generate {f : Filter Ξ±} : f.smallSets = generate (powerset '' f.sets) := by |
simp_rw [generate_eq_biInf, smallSets, iInf_image]
rfl
| [
" f.smallSets = generate (powerset '' f.sets)",
" f.lift' powerset = β¨
b β f.sets, π (π« b)"
] | [
" f.smallSets = generate (powerset '' f.sets)"
] |
import Mathlib.Data.PFunctor.Multivariate.W
import Mathlib.Data.QPF.Multivariate.Basic
#align_import data.qpf.multivariate.constructions.fix from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
universe u v
namespace MvQPF
open TypeVec
open MvFunctor (LiftP LiftR)
open MvFunctor
variable {n : β} {F : TypeVec.{u} (n + 1) β Type u} [MvFunctor F] [q : MvQPF F]
def recF {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β Ξ²) : q.P.W Ξ± β Ξ² :=
q.P.wRec fun a f' _f rec => g (abs β¨a, splitFun f' recβ©)
set_option linter.uppercaseLean3 false in
#align mvqpf.recF MvQPF.recF
theorem recF_eq {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β Ξ²) (a : q.P.A)
(f' : q.P.drop.B a βΉ Ξ±) (f : q.P.last.B a β q.P.W Ξ±) :
recF g (q.P.wMk a f' f) = g (abs β¨a, splitFun f' (recF g β f)β©) := by
rw [recF, MvPFunctor.wRec_eq]; rfl
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq MvQPF.recF_eq
theorem recF_eq' {Ξ± : TypeVec n} {Ξ² : Type u} (g : F (Ξ±.append1 Ξ²) β Ξ²) (x : q.P.W Ξ±) :
recF g x = g (abs (appendFun id (recF g) <$$> q.P.wDest' x)) := by
apply q.P.w_cases _ x
intro a f' f
rw [recF_eq, q.P.wDest'_wMk, MvPFunctor.map_eq, appendFun_comp_splitFun, TypeVec.id_comp]
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq' MvQPF.recF_eq'
inductive WEquiv {Ξ± : TypeVec n} : q.P.W Ξ± β q.P.W Ξ± β Prop
| ind (a : q.P.A) (f' : q.P.drop.B a βΉ Ξ±) (fβ fβ : q.P.last.B a β q.P.W Ξ±) :
(β x, WEquiv (fβ x) (fβ x)) β WEquiv (q.P.wMk a f' fβ) (q.P.wMk a f' fβ)
| abs (aβ : q.P.A) (f'β : q.P.drop.B aβ βΉ Ξ±) (fβ : q.P.last.B aβ β q.P.W Ξ±) (aβ : q.P.A)
(f'β : q.P.drop.B aβ βΉ Ξ±) (fβ : q.P.last.B aβ β q.P.W Ξ±) :
abs β¨aβ, q.P.appendContents f'β fββ© = abs β¨aβ, q.P.appendContents f'β fββ© β
WEquiv (q.P.wMk aβ f'β fβ) (q.P.wMk aβ f'β fβ)
| trans (u v w : q.P.W Ξ±) : WEquiv u v β WEquiv v w β WEquiv u w
set_option linter.uppercaseLean3 false in
#align mvqpf.Wequiv MvQPF.WEquiv
theorem recF_eq_of_wEquiv (Ξ± : TypeVec n) {Ξ² : Type u} (u : F (Ξ±.append1 Ξ²) β Ξ²) (x y : q.P.W Ξ±) :
WEquiv x y β recF u x = recF u y := by
apply q.P.w_cases _ x
intro aβ f'β fβ
apply q.P.w_cases _ y
intro aβ f'β fβ
intro h
-- Porting note: induction on h doesn't work.
refine @WEquiv.recOn _ _ _ _ _ (fun a a' _ β¦ recF u a = recF u a') _ _ h ?_ ?_ ?_
Β· intros a f' fβ fβ _h ih; simp only [recF_eq, Function.comp]
congr; funext; congr; funext; apply ih
Β· intros aβ f'β fβ aβ f'β fβ h; simp only [recF_eq', abs_map, MvPFunctor.wDest'_wMk, h]
Β· intros x y z _eβ _eβ ihβ ihβ; exact Eq.trans ihβ ihβ
set_option linter.uppercaseLean3 false in
#align mvqpf.recF_eq_of_Wequiv MvQPF.recF_eq_of_wEquiv
theorem wEquiv.abs' {Ξ± : TypeVec n} (x y : q.P.W Ξ±)
(h : MvQPF.abs (q.P.wDest' x) = MvQPF.abs (q.P.wDest' y)) :
WEquiv x y := by
revert h
apply q.P.w_cases _ x
intro aβ f'β fβ
apply q.P.w_cases _ y
intro aβ f'β fβ
apply WEquiv.abs
set_option linter.uppercaseLean3 false in
#align mvqpf.Wequiv.abs' MvQPF.wEquiv.abs'
| Mathlib/Data/QPF/Multivariate/Constructions/Fix.lean | 120 | 121 | theorem wEquiv.refl {Ξ± : TypeVec n} (x : q.P.W Ξ±) : WEquiv x x := by |
apply q.P.w_cases _ x; intro a f' f; exact WEquiv.abs a f' f a f' f rfl
| [
" recF g ((P F).wMk a f' f) = g (abs β¨a, splitFun f' (recF g β f)β©)",
" g (abs β¨a, splitFun f' fun i => (P F).wRec (fun a f' _f rec => g (abs β¨a, splitFun f' recβ©)) (f i)β©) =\n g (abs β¨a, splitFun f' (((P F).wRec fun a f' _f rec => g (abs β¨a, splitFun f' recβ©)) β f)β©)",
" recF g x = g (abs ((TypeVec.id ::: r... | [
" recF g ((P F).wMk a f' f) = g (abs β¨a, splitFun f' (recF g β f)β©)",
" g (abs β¨a, splitFun f' fun i => (P F).wRec (fun a f' _f rec => g (abs β¨a, splitFun f' recβ©)) (f i)β©) =\n g (abs β¨a, splitFun f' (((P F).wRec fun a f' _f rec => g (abs β¨a, splitFun f' recβ©)) β f)β©)",
" recF g x = g (abs ((TypeVec.id ::: r... |
import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import measure_theory.measure.haar.of_basis from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d"
open Set TopologicalSpace MeasureTheory MeasureTheory.Measure FiniteDimensional
open scoped Pointwise
noncomputable section
variable {ΞΉ ΞΉ' E F : Type*}
section Fintype
variable [Fintype ΞΉ] [Fintype ΞΉ']
section AddCommGroup
variable [AddCommGroup E] [Module β E] [AddCommGroup F] [Module β F]
def parallelepiped (v : ΞΉ β E) : Set E :=
(fun t : ΞΉ β β => β i, t i β’ v i) '' Icc 0 1
#align parallelepiped parallelepiped
theorem mem_parallelepiped_iff (v : ΞΉ β E) (x : E) :
x β parallelepiped v β β t β Icc (0 : ΞΉ β β) 1, x = β i, t i β’ v i := by
simp [parallelepiped, eq_comm]
#align mem_parallelepiped_iff mem_parallelepiped_iff
theorem parallelepiped_basis_eq (b : Basis ΞΉ β E) :
parallelepiped b = {x | β i, b.repr x i β Set.Icc 0 1} := by
classical
ext x
simp_rw [mem_parallelepiped_iff, mem_setOf_eq, b.ext_elem_iff, _root_.map_sum,
_root_.map_smul, Finset.sum_apply', Basis.repr_self, Finsupp.smul_single, smul_eq_mul,
mul_one, Finsupp.single_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true, mem_Icc,
Pi.le_def, Pi.zero_apply, Pi.one_apply, β forall_and]
aesop
theorem image_parallelepiped (f : E ββ[β] F) (v : ΞΉ β E) :
f '' parallelepiped v = parallelepiped (f β v) := by
simp only [parallelepiped, β image_comp]
congr 1 with t
simp only [Function.comp_apply, _root_.map_sum, LinearMap.map_smulββ, RingHom.id_apply]
#align image_parallelepiped image_parallelepiped
@[simp]
theorem parallelepiped_comp_equiv (v : ΞΉ β E) (e : ΞΉ' β ΞΉ) :
parallelepiped (v β e) = parallelepiped v := by
simp only [parallelepiped]
let K : (ΞΉ' β β) β (ΞΉ β β) := Equiv.piCongrLeft' (fun _a : ΞΉ' => β) e
have : Icc (0 : ΞΉ β β) 1 = K '' Icc (0 : ΞΉ' β β) 1 := by
rw [β Equiv.preimage_eq_iff_eq_image]
ext x
simp only [K, mem_preimage, mem_Icc, Pi.le_def, Pi.zero_apply, Equiv.piCongrLeft'_apply,
Pi.one_apply]
refine
β¨fun h => β¨fun i => ?_, fun i => ?_β©, fun h =>
β¨fun i => h.1 (e.symm i), fun i => h.2 (e.symm i)β©β©
Β· simpa only [Equiv.symm_apply_apply] using h.1 (e i)
Β· simpa only [Equiv.symm_apply_apply] using h.2 (e i)
rw [this, β image_comp]
congr 1 with x
have := fun z : ΞΉ' β β => e.symm.sum_comp fun i => z i β’ v (e i)
simp_rw [Equiv.apply_symm_apply] at this
simp_rw [Function.comp_apply, mem_image, mem_Icc, K, Equiv.piCongrLeft'_apply, this]
#align parallelepiped_comp_equiv parallelepiped_comp_equiv
-- The parallelepiped associated to an orthonormal basis of `β` is either `[0, 1]` or `[-1, 0]`.
| Mathlib/MeasureTheory/Measure/Haar/OfBasis.lean | 98 | 125 | theorem parallelepiped_orthonormalBasis_one_dim (b : OrthonormalBasis ΞΉ β β) :
parallelepiped b = Icc 0 1 β¨ parallelepiped b = Icc (-1) 0 := by |
have e : ΞΉ β Fin 1 := by
apply Fintype.equivFinOfCardEq
simp only [β finrank_eq_card_basis b.toBasis, finrank_self]
have B : parallelepiped (b.reindex e) = parallelepiped b := by
convert parallelepiped_comp_equiv b e.symm
ext i
simp only [OrthonormalBasis.coe_reindex]
rw [β B]
let F : β β Fin 1 β β := fun t => fun _i => t
have A : Icc (0 : Fin 1 β β) 1 = F '' Icc (0 : β) 1 := by
apply Subset.antisymm
Β· intro x hx
refine β¨x 0, β¨hx.1 0, hx.2 0β©, ?_β©
ext j
simp only [Subsingleton.elim j 0]
Β· rintro x β¨y, hy, rflβ©
exact β¨fun _j => hy.1, fun _j => hy.2β©
rcases orthonormalBasis_one_dim (b.reindex e) with (H | H)
Β· left
simp_rw [parallelepiped, H, A, Algebra.id.smul_eq_mul, mul_one]
simp only [Finset.univ_unique, Fin.default_eq_zero, smul_eq_mul, mul_one, Finset.sum_singleton,
β image_comp, Function.comp_apply, image_id', ge_iff_le, zero_le_one, not_true, gt_iff_lt]
Β· right
simp_rw [H, parallelepiped, Algebra.id.smul_eq_mul, A]
simp only [F, Finset.univ_unique, Fin.default_eq_zero, mul_neg, mul_one, Finset.sum_neg_distrib,
Finset.sum_singleton, β image_comp, Function.comp, image_neg, preimage_neg_Icc, neg_zero]
| [
" x β parallelepiped v β β t β Icc 0 1, x = β i : ΞΉ, t i β’ v i",
" parallelepiped βb = {x | β (i : ΞΉ), (b.repr x) i β Icc 0 1}",
" x β parallelepiped βb β x β {x | β (i : ΞΉ), (b.repr x) i β Icc 0 1}",
" (β t, β (x_1 : ΞΉ), (0 β€ t x_1 β§ t x_1 β€ 1) β§ (b.repr x) x_1 = t x_1) β β (i : ΞΉ), 0 β€ (b.repr x) i β§ (b.rep... | [
" x β parallelepiped v β β t β Icc 0 1, x = β i : ΞΉ, t i β’ v i",
" parallelepiped βb = {x | β (i : ΞΉ), (b.repr x) i β Icc 0 1}",
" x β parallelepiped βb β x β {x | β (i : ΞΉ), (b.repr x) i β Icc 0 1}",
" (β t, β (x_1 : ΞΉ), (0 β€ t x_1 β§ t x_1 β€ 1) β§ (b.repr x) x_1 = t x_1) β β (i : ΞΉ), 0 β€ (b.repr x) i β§ (b.rep... |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ΞΉ π E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : β β E) (ΞΌ : Measure β) (a b : β) : Prop :=
IntegrableOn f (Ioc a b) ΞΌ β§ IntegrableOn f (Ioc b a) ΞΌ
#align interval_integrable IntervalIntegrable
section
variable {f : β β E} {a b : β} {ΞΌ : Measure β}
theorem intervalIntegrable_iff : IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ξ a b) ΞΌ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f ΞΌ a b) : IntegrableOn f (Ξ a b) ΞΌ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioc a b) ΞΌ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
theorem intervalIntegrable_iff' [NoAtoms ΞΌ] :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (uIcc a b) ΞΌ := by
rw [intervalIntegrable_iff, β Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff' intervalIntegrable_iff'
theorem intervalIntegrable_iff_integrableOn_Icc_of_le {f : β β E} {a b : β} (hab : a β€ b)
{ΞΌ : Measure β} [NoAtoms ΞΌ] : IntervalIntegrable f ΞΌ a b β IntegrableOn f (Icc a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff_integrable_Icc_of_le intervalIntegrable_iff_integrableOn_Icc_of_le
theorem intervalIntegrable_iff_integrableOn_Ico_of_le [NoAtoms ΞΌ] (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ico a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ico]
theorem intervalIntegrable_iff_integrableOn_Ioo_of_le [NoAtoms ΞΌ] (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioo a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioo]
theorem MeasureTheory.Integrable.intervalIntegrable (hf : Integrable f ΞΌ) :
IntervalIntegrable f ΞΌ a b :=
β¨hf.integrableOn, hf.integrableOnβ©
#align measure_theory.integrable.interval_integrable MeasureTheory.Integrable.intervalIntegrable
theorem MeasureTheory.IntegrableOn.intervalIntegrable (hf : IntegrableOn f [[a, b]] ΞΌ) :
IntervalIntegrable f ΞΌ a b :=
β¨MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc),
MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc')β©
#align measure_theory.integrable_on.interval_integrable MeasureTheory.IntegrableOn.intervalIntegrable
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 129 | 131 | theorem intervalIntegrable_const_iff {c : E} :
IntervalIntegrable (fun _ => c) ΞΌ a b β c = 0 β¨ ΞΌ (Ξ a b) < β := by |
simp only [intervalIntegrable_iff, integrableOn_const]
| [
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ξ a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioc a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f [[a, b]] ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Icc a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ico a b) ΞΌ",
" Interva... | [
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ξ a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioc a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f [[a, b]] ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Icc a b) ΞΌ",
" IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ico a b) ΞΌ",
" Interva... |
import Mathlib.Dynamics.Ergodic.AddCircle
import Mathlib.MeasureTheory.Covering.LiminfLimsup
#align_import number_theory.well_approximable from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Set Filter Function Metric MeasureTheory
open scoped MeasureTheory Topology Pointwise
@[to_additive "In a seminormed additive group `A`, given `n : β` and `Ξ΄ : β`,
`approxAddOrderOf A n Ξ΄` is the set of elements within a distance `Ξ΄` of a point of order `n`."]
def approxOrderOf (A : Type*) [SeminormedGroup A] (n : β) (Ξ΄ : β) : Set A :=
thickening Ξ΄ {y | orderOf y = n}
#align approx_order_of approxOrderOf
#align approx_add_order_of approxAddOrderOf
@[to_additive mem_approx_add_orderOf_iff]
theorem mem_approxOrderOf_iff {A : Type*} [SeminormedGroup A] {n : β} {Ξ΄ : β} {a : A} :
a β approxOrderOf A n Ξ΄ β β b : A, orderOf b = n β§ a β ball b Ξ΄ := by
simp only [approxOrderOf, thickening_eq_biUnion_ball, mem_iUnionβ, mem_setOf_eq, exists_prop]
#align mem_approx_order_of_iff mem_approxOrderOf_iff
#align mem_approx_add_order_of_iff mem_approx_add_orderOf_iff
@[to_additive addWellApproximable "In a seminormed additive group `A`, given a sequence of
distances `Ξ΄β, Ξ΄β, ...`, `addWellApproximable A Ξ΄` is the limsup as `n β β` of the sets
`approxAddOrderOf A n Ξ΄β`. Thus, it is the set of points that lie in infinitely many of the sets
`approxAddOrderOf A n Ξ΄β`."]
def wellApproximable (A : Type*) [SeminormedGroup A] (Ξ΄ : β β β) : Set A :=
blimsup (fun n => approxOrderOf A n (Ξ΄ n)) atTop fun n => 0 < n
#align well_approximable wellApproximable
#align add_well_approximable addWellApproximable
@[to_additive mem_add_wellApproximable_iff]
theorem mem_wellApproximable_iff {A : Type*} [SeminormedGroup A] {Ξ΄ : β β β} {a : A} :
a β wellApproximable A Ξ΄ β
a β blimsup (fun n => approxOrderOf A n (Ξ΄ n)) atTop fun n => 0 < n :=
Iff.rfl
#align mem_well_approximable_iff mem_wellApproximable_iff
#align mem_add_well_approximable_iff mem_add_wellApproximable_iff
namespace approxOrderOf
variable {A : Type*} [SeminormedCommGroup A] {a : A} {m n : β} (Ξ΄ : β)
@[to_additive]
| Mathlib/NumberTheory/WellApproximable.lean | 108 | 116 | theorem image_pow_subset_of_coprime (hm : 0 < m) (hmn : n.Coprime m) :
(fun (y : A) => y ^ m) '' approxOrderOf A n Ξ΄ β approxOrderOf A n (m * Ξ΄) := by |
rintro - β¨a, ha, rflβ©
obtain β¨b, hb, habβ© := mem_approxOrderOf_iff.mp ha
replace hb : b ^ m β {u : A | orderOf u = n} := by
rw [β hb] at hmn β’; exact hmn.orderOf_pow
apply ball_subset_thickening hb ((m : β) β’ Ξ΄)
convert pow_mem_ball hm hab using 1
simp only [nsmul_eq_mul, Algebra.id.smul_eq_mul]
| [
" a β approxOrderOf A n Ξ΄ β β b, orderOf b = n β§ a β ball b Ξ΄",
" (fun y => y ^ m) '' approxOrderOf A n Ξ΄ β approxOrderOf A n (βm * Ξ΄)",
" (fun y => y ^ m) a β approxOrderOf A n (βm * Ξ΄)",
" b ^ m β {u | orderOf u = n}",
" b ^ m β {u | orderOf u = orderOf b}",
" (fun y => y ^ m) a β ball (b ^ m) (βm β’ Ξ΄)"... | [
" a β approxOrderOf A n Ξ΄ β β b, orderOf b = n β§ a β ball b Ξ΄",
" (fun y => y ^ m) '' approxOrderOf A n Ξ΄ β approxOrderOf A n (βm * Ξ΄)"
] |
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : π L β* π K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (π L) L : (π L) β* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : π L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : π L) :
(algebraMap (π K) (π L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : π K) :
algebraMap _ K (norm K (algebraMap (π K) (π L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : π K) :
norm K (algebraMap (π K) (π L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : π L} : IsUnit (norm K x) β IsUnit x := by
classical
refine β¨fun hx => ?_, IsUnit.map _β©
replace hx : IsUnit (algebraMap (π K) (π L) <| norm K x) := hx.map (algebraMap (π K) <| π L)
refine @isUnit_of_mul_isUnit_right (π L) _
β¨(univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x,
prod_mem fun Ο _ => x.2.map (Ο : L β+* L).toIntAlgHomβ© _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x) *
β Ο β {(AlgEquiv.refl : L ββ[K] L)}, Ο x = _
Β· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
Β· rw [prod_sdiff <| subset_univ _, β norm_eq_prod_automorphisms, coe_algebraMap_norm]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
theorem dvd_norm [IsGalois K L] (x : π L) : x β£ algebraMap (π K) (π L) (norm K x) := by
classical
have hint :
IsIntegral β€ (β Ο β univ.erase (AlgEquiv.refl : L ββ[K] L), Ο x) :=
IsIntegral.prod _ (fun Ο _ =>
((RingOfIntegers.isIntegral_coe x).map Ο))
refine β¨β¨_, hintβ©, ?_β©
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [β Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
#align ring_of_integers.dvd_norm RingOfIntegers.dvd_norm
variable (F : Type*) [Field F] [Algebra K F] [IsSeparable K F] [FiniteDimensional K F]
theorem norm_norm [IsSeparable K L] [Algebra F L] [IsSeparable F L] [FiniteDimensional F L]
[IsScalarTower K F L] (x : π L) : norm K (norm F x) = norm K x := by
rw [RingOfIntegers.ext_iff, coe_norm, coe_norm, coe_norm, Algebra.norm_norm]
#align ring_of_integers.norm_norm RingOfIntegers.norm_norm
variable {F}
| Mathlib/NumberTheory/NumberField/Norm.lean | 111 | 126 | theorem isUnit_norm [CharZero K] {x : π F} : IsUnit (norm K x) β IsUnit x := by |
letI : Algebra K (AlgebraicClosure K) := AlgebraicClosure.instAlgebra K
let L := normalClosure K F (AlgebraicClosure F)
haveI : FiniteDimensional F L := FiniteDimensional.right K F L
haveI : IsAlgClosure K (AlgebraicClosure F) :=
IsAlgClosure.ofAlgebraic K F (AlgebraicClosure F)
haveI : IsGalois F L := IsGalois.tower_top_of_isGalois K F L
calc
IsUnit (norm K x) β IsUnit ((norm K) x ^ finrank F L) :=
(isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)).symm
_ β IsUnit (norm K (algebraMap (π F) (π L) x)) := by
rw [β norm_norm K F (algebraMap (π F) (π L) x), norm_algebraMap F _, map_pow]
_ β IsUnit (algebraMap (π F) (π L) x) := isUnit_norm_of_isGalois K
_ β IsUnit (norm F (algebraMap (π F) (π L) x)) := (isUnit_norm_of_isGalois F).symm
_ β IsUnit (x ^ finrank F L) := (congr_arg IsUnit (norm_algebraMap F _)).to_iff
_ β IsUnit x := isUnit_pow_iff (pos_iff_ne_zero.mp finrank_pos)
| [
" (norm K) ((algebraMap (π K) (π L)) x) = x ^ finrank K L",
" IsUnit ((norm K) x) β IsUnit x",
" IsUnit x",
" IsUnit (β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * x)",
" β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * x = (algebraMap (π K) (π L)) ((norm K) x)",
" β(β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * ... | [
" (norm K) ((algebraMap (π K) (π L)) x) = x ^ finrank K L",
" IsUnit ((norm K) x) β IsUnit x",
" IsUnit x",
" IsUnit (β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * x)",
" β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * x = (algebraMap (π K) (π L)) ((norm K) x)",
" β(β¨β Ο β univ \\ {AlgEquiv.refl}, Ο βx, β―β© * ... |
import Mathlib.Topology.MetricSpace.Isometry
#align_import topology.metric_space.gluing from "leanprover-community/mathlib"@"e1a7bdeb4fd826b7e71d130d34988f0a2d26a177"
noncomputable section
universe u v w
open Function Set Uniformity Topology
namespace Metric
--section
section InductiveLimit
open Nat
variable {X : β β Type u} [β n, MetricSpace (X n)] {f : β n, X n β X (n + 1)}
def inductiveLimitDist (f : β n, X n β X (n + 1)) (x y : Ξ£n, X n) : β :=
dist (leRecOn (le_max_left x.1 y.1) (f _) x.2 : X (max x.1 y.1))
(leRecOn (le_max_right x.1 y.1) (f _) y.2 : X (max x.1 y.1))
#align metric.inductive_limit_dist Metric.inductiveLimitDist
theorem inductiveLimitDist_eq_dist (I : β n, Isometry (f n)) (x y : Ξ£n, X n) :
β m (hx : x.1 β€ m) (hy : y.1 β€ m), inductiveLimitDist f x y =
dist (leRecOn hx (f _) x.2 : X m) (leRecOn hy (f _) y.2 : X m)
| 0, hx, hy => by
cases' x with i x; cases' y with j y
obtain rfl : i = 0 := nonpos_iff_eq_zero.1 hx
obtain rfl : j = 0 := nonpos_iff_eq_zero.1 hy
rfl
| (m + 1), hx, hy => by
by_cases h : max x.1 y.1 = (m + 1)
Β· generalize m + 1 = m' at *
subst m'
rfl
Β· have : max x.1 y.1 β€ succ m := by simp [hx, hy]
have : max x.1 y.1 β€ m := by simpa [h] using of_le_succ this
have xm : x.1 β€ m := le_trans (le_max_left _ _) this
have ym : y.1 β€ m := le_trans (le_max_right _ _) this
rw [leRecOn_succ xm, leRecOn_succ ym, (I m).dist_eq]
exact inductiveLimitDist_eq_dist I x y m xm ym
#align metric.inductive_limit_dist_eq_dist Metric.inductiveLimitDist_eq_dist
def inductivePremetric (I : β n, Isometry (f n)) : PseudoMetricSpace (Ξ£n, X n) where
dist := inductiveLimitDist f
dist_self x := by simp [dist, inductiveLimitDist]
dist_comm x y := by
let m := max x.1 y.1
have hx : x.1 β€ m := le_max_left _ _
have hy : y.1 β€ m := le_max_right _ _
unfold dist; simp only
rw [inductiveLimitDist_eq_dist I x y m hx hy, inductiveLimitDist_eq_dist I y x m hy hx,
dist_comm]
dist_triangle x y z := by
let m := max (max x.1 y.1) z.1
have hx : x.1 β€ m := le_trans (le_max_left _ _) (le_max_left _ _)
have hy : y.1 β€ m := le_trans (le_max_right _ _) (le_max_left _ _)
have hz : z.1 β€ m := le_max_right _ _
calc
inductiveLimitDist f x z = dist (leRecOn hx (f _) x.2 : X m) (leRecOn hz (f _) z.2 : X m) :=
inductiveLimitDist_eq_dist I x z m hx hz
_ β€ dist (leRecOn hx (f _) x.2 : X m) (leRecOn hy (f _) y.2 : X m) +
dist (leRecOn hy (f _) y.2 : X m) (leRecOn hz (f _) z.2 : X m) :=
(dist_triangle _ _ _)
_ = inductiveLimitDist f x y + inductiveLimitDist f y z := by
rw [inductiveLimitDist_eq_dist I x y m hx hy, inductiveLimitDist_eq_dist I y z m hy hz]
edist_dist _ _ := by exact ENNReal.coe_nnreal_eq _
#align metric.inductive_premetric Metric.inductivePremetric
attribute [local instance] inductivePremetric
def InductiveLimit (I : β n, Isometry (f n)) : Type _ :=
@SeparationQuotient _ (inductivePremetric I).toUniformSpace.toTopologicalSpace
#align metric.inductive_limit Metric.InductiveLimit
set_option autoImplicit true in
instance : MetricSpace (InductiveLimit (f := f) I) :=
inferInstanceAs <| MetricSpace <|
@SeparationQuotient _ (inductivePremetric I).toUniformSpace.toTopologicalSpace
def toInductiveLimit (I : β n, Isometry (f n)) (n : β) (x : X n) : Metric.InductiveLimit I :=
Quotient.mk'' (Sigma.mk n x)
#align metric.to_inductive_limit Metric.toInductiveLimit
instance (I : β n, Isometry (f n)) [Inhabited (X 0)] : Inhabited (InductiveLimit I) :=
β¨toInductiveLimit _ 0 defaultβ©
theorem toInductiveLimit_isometry (I : β n, Isometry (f n)) (n : β) :
Isometry (toInductiveLimit I n) :=
Isometry.of_dist_eq fun x y => by
change inductiveLimitDist f β¨n, xβ© β¨n, yβ© = dist x y
rw [inductiveLimitDist_eq_dist I β¨n, xβ© β¨n, yβ© n (le_refl n) (le_refl n), leRecOn_self,
leRecOn_self]
#align metric.to_inductive_limit_isometry Metric.toInductiveLimit_isometry
| Mathlib/Topology/MetricSpace/Gluing.lean | 648 | 658 | theorem toInductiveLimit_commute (I : β n, Isometry (f n)) (n : β) :
toInductiveLimit I n.succ β f n = toInductiveLimit I n := by |
let h := inductivePremetric I
let _ := h.toUniformSpace.toTopologicalSpace
funext x
simp only [comp, toInductiveLimit]
refine SeparationQuotient.mk_eq_mk.2 (Metric.inseparable_iff.2 ?_)
show inductiveLimitDist f β¨n.succ, f n xβ© β¨n, xβ© = 0
rw [inductiveLimitDist_eq_dist I β¨n.succ, f n xβ© β¨n, xβ© n.succ, leRecOn_self,
leRecOn_succ, leRecOn_self, dist_self]
exact le_succ _
| [
" inductiveLimitDist f x y = dist (leRecOn hx (fun {k} => f k) x.snd) (leRecOn hy (fun {k} => f k) y.snd)",
" inductiveLimitDist f β¨i, xβ© y = dist (leRecOn hx (fun {k} => f k) β¨i, xβ©.snd) (leRecOn hy (fun {k} => f k) y.snd)",
" inductiveLimitDist f β¨i, xβ© β¨j, yβ© =\n dist (leRecOn hx (fun {k} => f k) β¨i, xβ©.s... | [
" inductiveLimitDist f x y = dist (leRecOn hx (fun {k} => f k) x.snd) (leRecOn hy (fun {k} => f k) y.snd)",
" inductiveLimitDist f β¨i, xβ© y = dist (leRecOn hx (fun {k} => f k) β¨i, xβ©.snd) (leRecOn hy (fun {k} => f k) y.snd)",
" inductiveLimitDist f β¨i, xβ© β¨j, yβ© =\n dist (leRecOn hx (fun {k} => f k) β¨i, xβ©.s... |
import Mathlib.Analysis.Normed.Group.Basic
#align_import information_theory.hamming from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
section HammingDistNorm
open Finset Function
variable {Ξ± ΞΉ : Type*} {Ξ² : ΞΉ β Type*} [Fintype ΞΉ] [β i, DecidableEq (Ξ² i)]
variable {Ξ³ : ΞΉ β Type*} [β i, DecidableEq (Ξ³ i)]
def hammingDist (x y : β i, Ξ² i) : β :=
(univ.filter fun i => x i β y i).card
#align hamming_dist hammingDist
@[simp]
theorem hammingDist_self (x : β i, Ξ² i) : hammingDist x x = 0 := by
rw [hammingDist, card_eq_zero, filter_eq_empty_iff]
exact fun _ _ H => H rfl
#align hamming_dist_self hammingDist_self
theorem hammingDist_nonneg {x y : β i, Ξ² i} : 0 β€ hammingDist x y :=
zero_le _
#align hamming_dist_nonneg hammingDist_nonneg
| Mathlib/InformationTheory/Hamming.lean | 56 | 57 | theorem hammingDist_comm (x y : β i, Ξ² i) : hammingDist x y = hammingDist y x := by |
simp_rw [hammingDist, ne_comm]
| [
" hammingDist x x = 0",
" β β¦x_1 : ΞΉβ¦, x_1 β univ β Β¬x x_1 β x x_1",
" hammingDist x y = hammingDist y x"
] | [
" hammingDist x x = 0",
" β β¦x_1 : ΞΉβ¦, x_1 β univ β Β¬x x_1 β x x_1",
" hammingDist x y = hammingDist y x"
] |
import Mathlib.Control.Bifunctor
import Mathlib.Logic.Equiv.Defs
#align_import logic.equiv.functor from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f"
universe u v w
variable {Ξ± Ξ² : Type u}
open Equiv
namespace Functor
variable (f : Type u β Type v) [Functor f] [LawfulFunctor f]
def mapEquiv (h : Ξ± β Ξ²) : f Ξ± β f Ξ² where
toFun := map h
invFun := map h.symm
left_inv x := by simp [map_map]
right_inv x := by simp [map_map]
#align functor.map_equiv Functor.mapEquiv
@[simp]
theorem mapEquiv_apply (h : Ξ± β Ξ²) (x : f Ξ±) : (mapEquiv f h : f Ξ± β f Ξ²) x = map h x :=
rfl
#align functor.map_equiv_apply Functor.mapEquiv_apply
@[simp]
theorem mapEquiv_symm_apply (h : Ξ± β Ξ²) (y : f Ξ²) :
(mapEquiv f h : f Ξ± β f Ξ²).symm y = map h.symm y :=
rfl
#align functor.map_equiv_symm_apply Functor.mapEquiv_symm_apply
@[simp]
| Mathlib/Logic/Equiv/Functor.lean | 57 | 60 | theorem mapEquiv_refl : mapEquiv f (Equiv.refl Ξ±) = Equiv.refl (f Ξ±) := by |
ext x
simp only [mapEquiv_apply, refl_apply]
exact LawfulFunctor.id_map x
| [
" βh.symm <$> βh <$> x = x",
" βh <$> βh.symm <$> x = x",
" mapEquiv f (Equiv.refl Ξ±) = Equiv.refl (f Ξ±)",
" (mapEquiv f (Equiv.refl Ξ±)) x = (Equiv.refl (f Ξ±)) x",
" β(Equiv.refl Ξ±) <$> x = x"
] | [
" βh.symm <$> βh <$> x = x",
" βh <$> βh.symm <$> x = x",
" mapEquiv f (Equiv.refl Ξ±) = Equiv.refl (f Ξ±)"
] |
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {Ξ± Ξ² : Type*} [LinearOrder Ξ±]
open Function
namespace Set
def projIci (a x : Ξ±) : Ici a := β¨max a x, le_max_left _ _β©
#align set.proj_Ici Set.projIci
def projIic (b x : Ξ±) : Iic b := β¨min b x, min_le_left _ _β©
#align set.proj_Iic Set.projIic
def projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : Icc a b :=
β¨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)β©
#align set.proj_Icc Set.projIcc
variable {a b : Ξ±} (h : a β€ b) {x : Ξ±}
@[norm_cast]
theorem coe_projIci (a x : Ξ±) : (projIci a x : Ξ±) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : Ξ±) : (projIic b x : Ξ±) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : (projIcc a b h x : Ξ±) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x β€ a) : projIci a x = β¨a, le_rflβ© := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b β€ x) : projIic b x = β¨b, le_rflβ© := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
theorem projIcc_of_le_left (hx : x β€ a) : projIcc a b h x = β¨a, left_mem_Icc.2 hβ© := by
simp [projIcc, hx, hx.trans h]
#align set.proj_Icc_of_le_left Set.projIcc_of_le_left
theorem projIcc_of_right_le (hx : b β€ x) : projIcc a b h x = β¨b, right_mem_Icc.2 hβ© := by
simp [projIcc, hx, h]
#align set.proj_Icc_of_right_le Set.projIcc_of_right_le
@[simp]
theorem projIci_self (a : Ξ±) : projIci a a = β¨a, le_rflβ© := projIci_of_le le_rfl
#align set.proj_Ici_self Set.projIci_self
@[simp]
theorem projIic_self (b : Ξ±) : projIic b b = β¨b, le_rflβ© := projIic_of_le le_rfl
#align set.proj_Iic_self Set.projIic_self
@[simp]
theorem projIcc_left : projIcc a b h a = β¨a, left_mem_Icc.2 hβ© :=
projIcc_of_le_left h le_rfl
#align set.proj_Icc_left Set.projIcc_left
@[simp]
theorem projIcc_right : projIcc a b h b = β¨b, right_mem_Icc.2 hβ© :=
projIcc_of_right_le h le_rfl
#align set.proj_Icc_right Set.projIcc_right
theorem projIci_eq_self : projIci a x = β¨a, le_rflβ© β x β€ a := by simp [projIci, Subtype.ext_iff]
#align set.proj_Ici_eq_self Set.projIci_eq_self
theorem projIic_eq_self : projIic b x = β¨b, le_rflβ© β b β€ x := by simp [projIic, Subtype.ext_iff]
#align set.proj_Iic_eq_self Set.projIic_eq_self
theorem projIcc_eq_left (h : a < b) : projIcc a b h.le x = β¨a, left_mem_Icc.mpr h.leβ© β x β€ a := by
simp [projIcc, Subtype.ext_iff, h.not_le]
#align set.proj_Icc_eq_left Set.projIcc_eq_left
theorem projIcc_eq_right (h : a < b) : projIcc a b h.le x = β¨b, right_mem_Icc.2 h.leβ© β b β€ x := by
simp [projIcc, Subtype.ext_iff, max_min_distrib_left, h.le, h.not_le]
#align set.proj_Icc_eq_right Set.projIcc_eq_right
| Mathlib/Order/Interval/Set/ProjIcc.lean | 113 | 113 | theorem projIci_of_mem (hx : x β Ici a) : projIci a x = β¨x, hxβ© := by | simpa [projIci]
| [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©",
" projIci a x = β¨a, β―β© β x β€ a",
" projIic b x = β¨b, β―β© β b β€ x",
" projIcc a b β― x = β¨a, β―β© β x β€ a",
" projIcc a b β― x = β¨b, β―β© β b β€ x",
" projIci a x = β¨x, hxβ©"
] | [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©",
" projIci a x = β¨a, β―β© β x β€ a",
" projIic b x = β¨b, β―β© β b β€ x",
" projIcc a b β― x = β¨a, β―β© β x β€ a",
" projIcc a b β― x = β¨b, β―β© β b β€ x",
" projIci a x = β¨x, hxβ©"
] |
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.RingTheory.Localization.AsSubring
#align_import algebraic_geometry.prime_spectrum.maximal from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
noncomputable section
open scoped Classical
universe u v
variable (R : Type u) [CommRing R]
@[ext]
structure MaximalSpectrum where
asIdeal : Ideal R
IsMaximal : asIdeal.IsMaximal
#align maximal_spectrum MaximalSpectrum
attribute [instance] MaximalSpectrum.IsMaximal
variable {R}
namespace MaximalSpectrum
instance [Nontrivial R] : Nonempty <| MaximalSpectrum R :=
let β¨I, hIβ© := Ideal.exists_maximal R
β¨β¨I, hIβ©β©
def toPrimeSpectrum (x : MaximalSpectrum R) : PrimeSpectrum R :=
β¨x.asIdeal, x.IsMaximal.isPrimeβ©
#align maximal_spectrum.to_prime_spectrum MaximalSpectrum.toPrimeSpectrum
theorem toPrimeSpectrum_injective : (@toPrimeSpectrum R _).Injective := fun β¨_, _β© β¨_, _β© h => by
simpa only [MaximalSpectrum.mk.injEq] using (PrimeSpectrum.ext_iff _ _).mp h
#align maximal_spectrum.to_prime_spectrum_injective MaximalSpectrum.toPrimeSpectrum_injective
open PrimeSpectrum Set
theorem toPrimeSpectrum_range :
Set.range (@toPrimeSpectrum R _) = { x | IsClosed ({x} : Set <| PrimeSpectrum R) } := by
simp only [isClosed_singleton_iff_isMaximal]
ext β¨x, _β©
exact β¨fun β¨y, hyβ© => hy βΈ y.IsMaximal, fun hx => β¨β¨x, hxβ©, rflβ©β©
#align maximal_spectrum.to_prime_spectrum_range MaximalSpectrum.toPrimeSpectrum_range
instance zariskiTopology : TopologicalSpace <| MaximalSpectrum R :=
PrimeSpectrum.zariskiTopology.induced toPrimeSpectrum
#align maximal_spectrum.zariski_topology MaximalSpectrum.zariskiTopology
instance : T1Space <| MaximalSpectrum R :=
β¨fun x => isClosed_induced_iff.mpr
β¨{toPrimeSpectrum x}, (isClosed_singleton_iff_isMaximal _).mpr x.IsMaximal, by
simpa only [β image_singleton] using preimage_image_eq {x} toPrimeSpectrum_injectiveβ©β©
theorem toPrimeSpectrum_continuous : Continuous <| @toPrimeSpectrum R _ :=
continuous_induced_dom
#align maximal_spectrum.to_prime_spectrum_continuous MaximalSpectrum.toPrimeSpectrum_continuous
variable (R)
variable [IsDomain R] (K : Type v) [Field K] [Algebra R K] [IsFractionRing R K]
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Maximal.lean | 92 | 117 | theorem iInf_localization_eq_bot : (β¨
v : MaximalSpectrum R,
Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = β₯ := by |
ext x
rw [Algebra.mem_bot, Algebra.mem_iInf]
constructor
Β· contrapose
intro hrange hlocal
let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
have hdenom : (1 : R) β denom := by
intro hdenom
rcases Submodule.mem_span_singleton.mp
(Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with β¨y, hyβ©
exact hrange β¨y, by rw [β mul_one <| algebraMap R K y, β Algebra.smul_def, hy, one_smul]β©
rcases denom.exists_le_maximal fun h => (h βΈ hdenom) Submodule.mem_top with β¨max, hmax, hleβ©
rcases hlocal β¨max, hmaxβ© with β¨n, d, hd, rflβ©
apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _)
intro _ hy
rcases Submodule.mem_span_singleton.mp hy with β¨y, rflβ©
exact Submodule.mem_span_singleton.mpr β¨y * n, by
rw [Algebra.smul_def, mul_one, map_mul, smul_comm, Algebra.smul_def, Algebra.smul_def,
mul_comm <| algebraMap R K d,
inv_mul_cancel_rightβ <|
(map_ne_zero_iff _ <| NoZeroSMulDivisors.algebraMap_injective R K).mpr fun h =>
(h βΈ hd) max.zero_mem]β©
Β· rintro β¨y, rflβ© β¨v, hvβ©
exact β¨y, 1, v.ne_top_iff_one.mp hv.ne_top, by rw [map_one, inv_one, mul_one]β©
| [
" { asIdeal := asIdealβΒΉ, IsMaximal := IsMaximalβΒΉ } = { asIdeal := asIdealβ, IsMaximal := IsMaximalβ }",
" range toPrimeSpectrum = {x | IsClosed {x}}",
" range toPrimeSpectrum = {x | x.asIdeal.IsMaximal}",
" { asIdeal := x, IsPrime := IsPrimeβ } β range toPrimeSpectrum β\n { asIdeal := x, IsPrime := IsPri... | [
" { asIdeal := asIdealβΒΉ, IsMaximal := IsMaximalβΒΉ } = { asIdeal := asIdealβ, IsMaximal := IsMaximalβ }",
" range toPrimeSpectrum = {x | IsClosed {x}}",
" range toPrimeSpectrum = {x | x.asIdeal.IsMaximal}",
" { asIdeal := x, IsPrime := IsPrimeβ } β range toPrimeSpectrum β\n { asIdeal := x, IsPrime := IsPri... |
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.GaloisConnection
import Mathlib.Order.Hom.Basic
#align_import order.hom.order from "leanprover-community/mathlib"@"ba2245edf0c8bb155f1569fd9b9492a9b384cde6"
namespace OrderHom
variable {Ξ± Ξ² : Type*}
section Preorder
variable [Preorder Ξ±]
instance [SemilatticeSup Ξ²] : Sup (Ξ± βo Ξ²) where
sup f g := β¨fun a => f a β g a, f.mono.sup g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_sup [SemilatticeSup Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeSup Ξ²] : SemilatticeSup (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)) with
sup := Sup.sup
le_sup_left := fun _ _ _ => le_sup_left
le_sup_right := fun _ _ _ => le_sup_right
sup_le := fun _ _ _ hβ hβ x => sup_le (hβ x) (hβ x) }
instance [SemilatticeInf Ξ²] : Inf (Ξ± βo Ξ²) where
inf f g := β¨fun a => f a β g a, f.mono.inf g.monoβ©
-- Porting note: this is the lemma that could have been generated by `@[simps]` on the
--above instance but with a nicer name
@[simp] lemma coe_inf [SemilatticeInf Ξ²] (f g : Ξ± βo Ξ²) :
((f β g : Ξ± βo Ξ²) : Ξ± β Ξ²) = (f : Ξ± β Ξ²) β g := rfl
instance [SemilatticeInf Ξ²] : SemilatticeInf (Ξ± βo Ξ²) :=
{ (_ : PartialOrder (Ξ± βo Ξ²)), (dualIso Ξ± Ξ²).symm.toGaloisInsertion.liftSemilatticeInf with
inf := (Β· β Β·) }
instance lattice [Lattice Ξ²] : Lattice (Ξ± βo Ξ²) :=
{ (_ : SemilatticeSup (Ξ± βo Ξ²)), (_ : SemilatticeInf (Ξ± βo Ξ²)) with }
@[simps]
instance [Preorder Ξ²] [OrderBot Ξ²] : Bot (Ξ± βo Ξ²) where
bot := const Ξ± β₯
instance orderBot [Preorder Ξ²] [OrderBot Ξ²] : OrderBot (Ξ± βo Ξ²) where
bot := β₯
bot_le _ _ := bot_le
@[simps]
instance instTopOrderHom [Preorder Ξ²] [OrderTop Ξ²] : Top (Ξ± βo Ξ²) where
top := const Ξ± β€
instance orderTop [Preorder Ξ²] [OrderTop Ξ²] : OrderTop (Ξ± βo Ξ²) where
top := β€
le_top _ _ := le_top
instance [CompleteLattice Ξ²] : InfSet (Ξ± βo Ξ²) where
sInf s := β¨fun x => β¨
f β s, (f : _) x, fun _ _ h => iInfβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sInf_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sInf s x = β¨
f β s, (f : _) x :=
rfl
#align order_hom.Inf_apply OrderHom.sInf_apply
theorem iInf_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨
i, f i) x = β¨
i, f i x :=
(sInf_apply _ _).trans iInf_range
#align order_hom.infi_apply OrderHom.iInf_apply
@[simp, norm_cast]
theorem coe_iInf {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨
i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨
i, (f i : Ξ± β Ξ²) := by
funext x; simp [iInf_apply]
#align order_hom.coe_infi OrderHom.coe_iInf
instance [CompleteLattice Ξ²] : SupSet (Ξ± βo Ξ²) where
sSup s := β¨fun x => β¨ f β s, (f : _) x, fun _ _ h => iSupβ_mono fun f _ => f.mono hβ©
@[simp]
theorem sSup_apply [CompleteLattice Ξ²] (s : Set (Ξ± βo Ξ²)) (x : Ξ±) :
sSup s x = β¨ f β s, (f : _) x :=
rfl
#align order_hom.Sup_apply OrderHom.sSup_apply
theorem iSup_apply {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) (x : Ξ±) :
(β¨ i, f i) x = β¨ i, f i x :=
(sSup_apply _ _).trans iSup_range
#align order_hom.supr_apply OrderHom.iSup_apply
@[simp, norm_cast]
theorem coe_iSup {ΞΉ : Sort*} [CompleteLattice Ξ²] (f : ΞΉ β Ξ± βo Ξ²) :
((β¨ i, f i : Ξ± βo Ξ²) : Ξ± β Ξ²) = β¨ i, (f i : Ξ± β Ξ²) := by
funext x; simp [iSup_apply]
#align order_hom.coe_supr OrderHom.coe_iSup
instance [CompleteLattice Ξ²] : CompleteLattice (Ξ± βo Ξ²) :=
{ (_ : Lattice (Ξ± βo Ξ²)), OrderHom.orderTop, OrderHom.orderBot with
-- sSup := SupSet.sSup -- Porting note: removed, unnecessary?
-- Porting note: Added `by apply`, was `fun s f hf x => le_iSup_of_le f (le_iSup _ hf)`
le_sSup := fun s f hf x => le_iSup_of_le f (by apply le_iSup _ hf)
sSup_le := fun s f hf x => iSupβ_le fun g hg => hf g hg x
--inf := sInf -- Porting note: removed, unnecessary?
le_sInf := fun s f hf x => le_iInfβ fun g hg => hf g hg x
sInf_le := fun s f hf x => iInf_le_of_le f (iInf_le _ hf)
}
| Mathlib/Order/Hom/Order.lean | 133 | 154 | theorem iterate_sup_le_sup_iff {Ξ± : Type*} [SemilatticeSup Ξ±] (f : Ξ± βo Ξ±) :
(β nβ nβ aβ aβ, f^[nβ + nβ] (aβ β aβ) β€ f^[nβ] aβ β f^[nβ] aβ) β
β aβ aβ, f (aβ β aβ) β€ f aβ β aβ := by |
constructor <;> intro h
Β· exact h 1 0
Β· intro nβ nβ aβ aβ
have h' : β n aβ aβ, f^[n] (aβ β aβ) β€ f^[n] aβ β aβ := by
intro n
induction' n with n ih <;> intro aβ aβ
Β· rfl
Β· calc
f^[n + 1] (aβ β aβ) = f^[n] (f (aβ β aβ)) := Function.iterate_succ_apply f n _
_ β€ f^[n] (f aβ β aβ) := f.mono.iterate n (h aβ aβ)
_ β€ f^[n] (f aβ) β aβ := ih _ _
_ = f^[n + 1] aβ β aβ := by rw [β Function.iterate_succ_apply]
calc
f^[nβ + nβ] (aβ β aβ) = f^[nβ] (f^[nβ] (aβ β aβ)) :=
Function.iterate_add_apply f nβ nβ _
_ = f^[nβ] (f^[nβ] (aβ β aβ)) := by rw [sup_comm]
_ β€ f^[nβ] (f^[nβ] aβ β aβ) := f.mono.iterate nβ (h' nβ _ _)
_ = f^[nβ] (aβ β f^[nβ] aβ) := by rw [sup_comm]
_ β€ f^[nβ] aβ β f^[nβ] aβ := h' nβ aβ _
| [
" β(β¨
i, f i) = β¨
i, β(f i)",
" (β¨
i, f i) x = (β¨
i, β(f i)) x",
" β(β¨ i, f i) = β¨ i, β(f i)",
" (β¨ i, f i) x = (β¨ i, β(f i)) x",
" f.toFun x β€ β¨ (_ : f β s), f x",
" (β (nβ nβ : β) (aβ aβ : Ξ±), (βf)^[nβ + nβ] (aβ β aβ) β€ (βf)^[nβ] aβ β (βf)^[nβ] aβ) β\n β (aβ aβ : Ξ±), f (aβ β aβ) β€ f aβ β aβ",
" (β ... | [
" β(β¨
i, f i) = β¨
i, β(f i)",
" (β¨
i, f i) x = (β¨
i, β(f i)) x",
" β(β¨ i, f i) = β¨ i, β(f i)",
" (β¨ i, f i) x = (β¨ i, β(f i)) x",
" f.toFun x β€ β¨ (_ : f β s), f x",
" (β (nβ nβ : β) (aβ aβ : Ξ±), (βf)^[nβ + nβ] (aβ β aβ) β€ (βf)^[nβ] aβ β (βf)^[nβ] aβ) β\n β (aβ aβ : Ξ±), f (aβ β aβ) β€ f aβ β aβ"
] |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section deriv
variable {ΞΉ : Type*} {l : Filter ΞΉ} {π : Type*} [RCLike π] {G : Type*} [NormedAddCommGroup G]
[NormedSpace π G] {f : ΞΉ β π β G} {g : π β G} {f' : ΞΉ β π β G} {g' : π β G} {x : π}
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 455 | 474 | theorem UniformCauchySeqOnFilter.one_smulRight {l' : Filter π}
(hf' : UniformCauchySeqOnFilter f' l l') :
UniformCauchySeqOnFilter (fun n => fun z => (1 : π βL[π] π).smulRight (f' n z)) l l' := by |
-- The tricky part of this proof is that operator norms are written in terms of `β€` whereas
-- metrics are written in terms of `<`. So we need to shrink `Ξ΅` utilizing the archimedean
-- property of `β`
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero,
Metric.tendstoUniformlyOnFilter_iff] at hf' β’
intro Ξ΅ hΞ΅
obtain β¨q, hq, hq'β© := exists_between hΞ΅.lt
apply (hf' q hq).mono
intro n hn
refine lt_of_le_of_lt ?_ hq'
simp only [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn β’
refine ContinuousLinearMap.opNorm_le_bound _ hq.le ?_
intro z
simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply,
ContinuousLinearMap.one_apply]
rw [β smul_sub, norm_smul, mul_comm]
gcongr
| [
" UniformCauchySeqOnFilter (fun n z => ContinuousLinearMap.smulRight 1 (f' n z)) l l'",
" β Ξ΅ > 0,\n βαΆ (n : (ΞΉ Γ ΞΉ) Γ π) in (l ΓΛ’ l) ΓΛ’ l',\n dist (0 n.2) (ContinuousLinearMap.smulRight 1 (f' n.1.1 n.2) - ContinuousLinearMap.smulRight 1 (f' n.1.2 n.2)) < Ξ΅",
" βαΆ (n : (ΞΉ Γ ΞΉ) Γ π) in (l ΓΛ’ l) ΓΛ’ l',\... | [
" UniformCauchySeqOnFilter (fun n z => ContinuousLinearMap.smulRight 1 (f' n z)) l l'"
] |
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals
import Mathlib.Analysis.Calculus.ParametricIntegral
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
#align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb"
open MeasureTheory Set Filter Asymptotics TopologicalSpace
open Real
open Complex hiding exp log abs_of_nonneg
open scoped Topology
noncomputable section
variable {E : Type*} [NormedAddCommGroup E]
section MellinDiff
theorem isBigO_rpow_top_log_smul [NormedSpace β E] {a b : β} {f : β β E} (hab : b < a)
(hf : f =O[atTop] (Β· ^ (-a))) :
(fun t : β => log t β’ f t) =O[atTop] (Β· ^ (-b)) := by
refine
((isLittleO_log_rpow_atTop (sub_pos.mpr hab)).isBigO.smul hf).congr'
(eventually_of_forall fun t => by rfl)
((eventually_gt_atTop 0).mp (eventually_of_forall fun t ht => ?_))
simp only
rw [smul_eq_mul, β rpow_add ht, β sub_eq_add_neg, sub_eq_add_neg a, add_sub_cancel_left]
set_option linter.uppercaseLean3 false in
#align is_O_rpow_top_log_smul isBigO_rpow_top_log_smul
| Mathlib/Analysis/MellinTransform.lean | 317 | 332 | theorem isBigO_rpow_zero_log_smul [NormedSpace β E] {a b : β} {f : β β E} (hab : a < b)
(hf : f =O[π[>] 0] (Β· ^ (-a))) :
(fun t : β => log t β’ f t) =O[π[>] 0] (Β· ^ (-b)) := by |
have : log =o[π[>] 0] fun t : β => t ^ (a - b) := by
refine ((isLittleO_log_rpow_atTop (sub_pos.mpr hab)).neg_left.comp_tendsto
tendsto_inv_zero_atTop).congr'
(eventually_nhdsWithin_iff.mpr <| eventually_of_forall fun t ht => ?_)
(eventually_nhdsWithin_iff.mpr <| eventually_of_forall fun t ht => ?_)
Β· simp_rw [Function.comp_apply, β one_div, log_div one_ne_zero (ne_of_gt ht), Real.log_one,
zero_sub, neg_neg]
Β· simp_rw [Function.comp_apply, inv_rpow (le_of_lt ht), β rpow_neg (le_of_lt ht), neg_sub]
refine (this.isBigO.smul hf).congr' (eventually_of_forall fun t => by rfl)
(eventually_nhdsWithin_iff.mpr (eventually_of_forall fun t ht => ?_))
simp_rw [smul_eq_mul, β rpow_add ht]
congr 1
abel
| [
" (fun t => t.log β’ f t) =O[atTop] fun x => x ^ (-b)",
" (fun x => x.log β’ f x) t = (fun t => t.log β’ f t) t",
" (fun x => x ^ (a - b) β’ x ^ (-a)) t = (fun x => x ^ (-b)) t",
" t ^ (a - b) β’ t ^ (-a) = t ^ (-b)",
" (fun t => t.log β’ f t) =O[π[>] 0] fun x => x ^ (-b)",
" log =o[π[>] 0] fun t => t ^ (a - ... | [
" (fun t => t.log β’ f t) =O[atTop] fun x => x ^ (-b)",
" (fun x => x.log β’ f x) t = (fun t => t.log β’ f t) t",
" (fun x => x ^ (a - b) β’ x ^ (-a)) t = (fun x => x ^ (-b)) t",
" t ^ (a - b) β’ t ^ (-a) = t ^ (-b)",
" (fun t => t.log β’ f t) =O[π[>] 0] fun x => x ^ (-b)"
] |
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
| Mathlib/Algebra/Lie/Free.lean | 95 | 96 | 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
| [
" 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 + b) (a + c)",
" Rel R X (b + a) (c + a)",
" Rel R X (-a) (-b)",
" Rel R X (a - b) (a - c)"
] |
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.IsomorphismClasses
import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects
#align_import category_theory.limits.shapes.zero_morphisms from "leanprover-community/mathlib"@"f7707875544ef1f81b32cb68c79e0e24e45a0e76"
noncomputable section
universe v u
universe v' u'
open CategoryTheory
open CategoryTheory.Category
open scoped Classical
namespace CategoryTheory.Limits
variable (C : Type u) [Category.{v} C]
variable (D : Type u') [Category.{v'} D]
class HasZeroMorphisms where
[zero : β X Y : C, Zero (X βΆ Y)]
comp_zero : β {X Y : C} (f : X βΆ Y) (Z : C), f β« (0 : Y βΆ Z) = (0 : X βΆ Z) := by aesop_cat
zero_comp : β (X : C) {Y Z : C} (f : Y βΆ Z), (0 : X βΆ Y) β« f = (0 : X βΆ Z) := by aesop_cat
#align category_theory.limits.has_zero_morphisms CategoryTheory.Limits.HasZeroMorphisms
#align category_theory.limits.has_zero_morphisms.comp_zero' CategoryTheory.Limits.HasZeroMorphisms.comp_zero
#align category_theory.limits.has_zero_morphisms.zero_comp' CategoryTheory.Limits.HasZeroMorphisms.zero_comp
attribute [instance] HasZeroMorphisms.zero
variable {C}
@[simp]
theorem comp_zero [HasZeroMorphisms C] {X Y : C} {f : X βΆ Y} {Z : C} :
f β« (0 : Y βΆ Z) = (0 : X βΆ Z) :=
HasZeroMorphisms.comp_zero f Z
#align category_theory.limits.comp_zero CategoryTheory.Limits.comp_zero
@[simp]
theorem zero_comp [HasZeroMorphisms C] {X : C} {Y Z : C} {f : Y βΆ Z} :
(0 : X βΆ Y) β« f = (0 : X βΆ Z) :=
HasZeroMorphisms.zero_comp X f
#align category_theory.limits.zero_comp CategoryTheory.Limits.zero_comp
instance hasZeroMorphismsPEmpty : HasZeroMorphisms (Discrete PEmpty) where
zero := by aesop_cat
#align category_theory.limits.has_zero_morphisms_pempty CategoryTheory.Limits.hasZeroMorphismsPEmpty
instance hasZeroMorphismsPUnit : HasZeroMorphisms (Discrete PUnit) where
zero X Y := by repeat (constructor)
#align category_theory.limits.has_zero_morphisms_punit CategoryTheory.Limits.hasZeroMorphismsPUnit
namespace HasZeroMorphisms
private theorem ext_aux (I J : HasZeroMorphisms C)
(w : β X Y : C, (I.zero X Y).zero = (J.zero X Y).zero) : I = J := by
have : I.zero = J.zero := by
funext X Y
specialize w X Y
apply congrArg Zero.mk w
cases I; cases J
congr
Β· apply proof_irrel_heq
Β· apply proof_irrel_heq
-- Porting note: private def; no align
| Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean | 106 | 113 | theorem ext (I J : HasZeroMorphisms C) : I = J := by |
apply ext_aux
intro X Y
have : (I.zero X Y).zero β« (J.zero Y Y).zero = (I.zero X Y).zero := by
apply I.zero_comp X (J.zero Y Y).zero
have that : (I.zero X Y).zero β« (J.zero Y Y).zero = (J.zero X Y).zero := by
apply J.comp_zero (I.zero X Y).zero Y
rw [β this, β that]
| [] | [] |
import Mathlib.LinearAlgebra.Dual
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec"
suppress_compilation
-- Porting note: universe metavariables behave oddly
universe w u vβ vβ vβ vβ
variable {ΞΉ : Type w} (R : Type u) (M : Type vβ) (N : Type vβ)
(P : Type vβ) (Q : Type vβ)
-- Porting note: we need high priority for this to fire first; not the case in ML3
attribute [local ext high] TensorProduct.ext
section Contraction
open TensorProduct LinearMap Matrix Module
open TensorProduct
section CommSemiring
variable [CommSemiring R]
variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q]
variable [Module R M] [Module R N] [Module R P] [Module R Q]
variable [DecidableEq ΞΉ] [Fintype ΞΉ] (b : Basis ΞΉ R M)
-- Porting note: doesn't like implicit ring in the tensor product
def contractLeft : Module.Dual R M β[R] M ββ[R] R :=
(uncurry _ _ _ _).toFun LinearMap.id
#align contract_left contractLeft
-- Porting note: doesn't like implicit ring in the tensor product
def contractRight : M β[R] Module.Dual R M ββ[R] R :=
(uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id)
#align contract_right contractRight
-- Porting note: doesn't like implicit ring in the tensor product
def dualTensorHom : Module.Dual R M β[R] N ββ[R] M ββ[R] N :=
let M' := Module.Dual R M
(uncurry R M' N (M ββ[R] N) : _ β M' β N ββ[R] M ββ[R] N) LinearMap.smulRightβ
#align dual_tensor_hom dualTensorHom
variable {R M N P Q}
@[simp]
theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ββ m) = f m :=
rfl
#align contract_left_apply contractLeft_apply
@[simp]
theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ββ f) = f m :=
rfl
#align contract_right_apply contractRight_apply
@[simp]
theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) :
dualTensorHom R M N (f ββ n) m = f m β’ n :=
rfl
#align dual_tensor_hom_apply dualTensorHom_apply
@[simp]
theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) :
Dual.transpose (R := R) (dualTensorHom R M M (f ββ m)) =
dualTensorHom R _ _ (Dual.eval R M m ββ f) := by
ext f' m'
simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply,
LinearMap.map_smulββ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply,
LinearMap.smul_apply]
exact mul_comm _ _
#align transpose_dual_tensor_hom transpose_dualTensorHom
@[simp]
theorem dualTensorHom_prodMap_zero (f : Module.Dual R M) (p : P) :
((dualTensorHom R M P) (f ββ[R] p)).prodMap (0 : N ββ[R] Q) =
dualTensorHom R (M Γ N) (P Γ Q) ((f ββ fst R M N) ββ inl R P Q p) := by
ext <;>
simp only [coe_comp, coe_inl, Function.comp_apply, prodMap_apply, dualTensorHom_apply,
fst_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
#align dual_tensor_hom_prod_map_zero dualTensorHom_prodMap_zero
@[simp]
| Mathlib/LinearAlgebra/Contraction.lean | 105 | 110 | theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) :
(0 : M ββ[R] P).prodMap ((dualTensorHom R N Q) (g ββ[R] q)) =
dualTensorHom R (M Γ N) (P Γ Q) ((g ββ snd R M N) ββ inr R P Q q) := by |
ext <;>
simp only [coe_comp, coe_inr, Function.comp_apply, prodMap_apply, dualTensorHom_apply,
snd_apply, Prod.smul_mk, LinearMap.zero_apply, smul_zero]
| [
" Dual.transpose ((dualTensorHom R M M) (f ββ[R] m)) =\n (dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ββ[R] f)",
" ((Dual.transpose ((dualTensorHom R M M) (f ββ[R] m))) f') m' =\n (((dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ββ[R] f)) f') m'",
" f m' * f' m = f' m * f m'",
... | [
" Dual.transpose ((dualTensorHom R M M) (f ββ[R] m)) =\n (dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ββ[R] f)",
" ((Dual.transpose ((dualTensorHom R M M) (f ββ[R] m))) f') m' =\n (((dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ββ[R] f)) f') m'",
" f m' * f' m = f' m * f m'",
... |
import Mathlib.Data.Set.Image
#align_import order.directed from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
open Function
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {ΞΉ : Sort w} (r r' s : Ξ± β Ξ± β Prop)
local infixl:50 " βΌ " => r
def Directed (f : ΞΉ β Ξ±) :=
β x y, β z, f x βΌ f z β§ f y βΌ f z
#align directed Directed
def DirectedOn (s : Set Ξ±) :=
β x β s, β y β s, β z β s, x βΌ z β§ y βΌ z
#align directed_on DirectedOn
variable {r r'}
theorem directedOn_iff_directed {s} : @DirectedOn Ξ± r s β Directed r (Subtype.val : s β Ξ±) := by
simp only [DirectedOn, Directed, Subtype.exists, exists_and_left, exists_prop, Subtype.forall]
exact forallβ_congr fun x _ => by simp [And.comm, and_assoc]
#align directed_on_iff_directed directedOn_iff_directed
alias β¨DirectedOn.directed_val, _β© := directedOn_iff_directed
#align directed_on.directed_coe DirectedOn.directed_val
theorem directedOn_range {f : ΞΉ β Ξ±} : Directed r f β DirectedOn r (Set.range f) := by
simp_rw [Directed, DirectedOn, Set.forall_mem_range, Set.exists_range_iff]
#align directed_on_range directedOn_range
-- Porting note: This alias was misplaced in `order/compactly_generated.lean` in mathlib3
alias β¨Directed.directedOn_range, _β© := directedOn_range
#align directed.directed_on_range Directed.directedOn_range
-- Porting note: `attribute [protected]` doesn't work
-- attribute [protected] Directed.directedOn_range
| Mathlib/Order/Directed.lean | 77 | 80 | theorem directedOn_image {s : Set Ξ²} {f : Ξ² β Ξ±} :
DirectedOn r (f '' s) β DirectedOn (f β»ΒΉ'o r) s := by |
simp only [DirectedOn, Set.mem_image, exists_exists_and_eq_and, forall_exists_index, and_imp,
forall_apply_eq_imp_iffβ, Order.Preimage]
| [
" DirectedOn r s β Directed r Subtype.val",
" (β x β s, β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1 β s, β a_2, r a a_2 β§ a_2 β s β§ r a_1 a_2",
" (β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1, r x a_1 β§ a_1 β s β§ r a a_1",
" Directed r f β DirectedOn r (Set.range f)",
" DirectedOn r (f '' s) β Di... | [
" DirectedOn r s β Directed r Subtype.val",
" (β x β s, β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1 β s, β a_2, r a a_2 β§ a_2 β s β§ r a_1 a_2",
" (β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1, r x a_1 β§ a_1 β s β§ r a a_1",
" Directed r f β DirectedOn r (Set.range f)",
" DirectedOn r (f '' s) β Di... |
import Mathlib.Data.Fintype.Basic
import Mathlib.ModelTheory.Substructures
#align_import model_theory.elementary_maps from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open FirstOrder
namespace FirstOrder
namespace Language
open Structure
variable (L : Language) (M : Type*) (N : Type*) {P : Type*} {Q : Type*}
variable [L.Structure M] [L.Structure N] [L.Structure P] [L.Structure Q]
structure ElementaryEmbedding where
toFun : M β N
-- Porting note:
-- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
-- but that isn't currently sufficient.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
-- If that can be improved, we should change this to `by aesop` and remove the proofs below.
map_formula' :
β β¦nβ¦ (Ο : L.Formula (Fin n)) (x : Fin n β M), Ο.Realize (toFun β x) β Ο.Realize x := by
intros; trivial
#align first_order.language.elementary_embedding FirstOrder.Language.ElementaryEmbedding
#align first_order.language.elementary_embedding.to_fun FirstOrder.Language.ElementaryEmbedding.toFun
#align first_order.language.elementary_embedding.map_formula' FirstOrder.Language.ElementaryEmbedding.map_formula'
@[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " βͺβ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
variable {L} {M} {N}
variable (L) (M)
abbrev elementaryDiagram : L[[M]].Theory :=
L[[M]].completeTheory M
#align first_order.language.elementary_diagram FirstOrder.Language.elementaryDiagram
@[simps]
def ElementaryEmbedding.ofModelsElementaryDiagram (N : Type*) [L.Structure N] [L[[M]].Structure N]
[(lhomWithConstants L M).IsExpansionOn N] [N β¨ L.elementaryDiagram M] : M βͺβ[L] N :=
β¨((β) : L[[M]].Constants β N) β Sum.inr, fun n Ο x => by
refine
_root_.trans ?_
((realize_iff_of_model_completeTheory M N
(((L.lhomWithConstants M).onBoundedFormula Ο).subst
(Constants.term β Sum.inr β x)).alls).trans
?_)
Β· simp_rw [Sentence.Realize, BoundedFormula.realize_alls, BoundedFormula.realize_subst,
LHom.realize_onBoundedFormula, Formula.Realize, Unique.forall_iff, Function.comp,
Term.realize_constants]
Β· simp_rw [Sentence.Realize, BoundedFormula.realize_alls, BoundedFormula.realize_subst,
LHom.realize_onBoundedFormula, Formula.Realize, Unique.forall_iff]
rflβ©
#align first_order.language.elementary_embedding.of_models_elementary_diagram FirstOrder.Language.ElementaryEmbedding.ofModelsElementaryDiagram
variable {L M}
namespace Embedding
| Mathlib/ModelTheory/ElementaryMaps.lean | 272 | 302 | theorem isElementary_of_exists (f : M βͺ[L] N)
(htv :
β (n : β) (Ο : L.BoundedFormula Empty (n + 1)) (x : Fin n β M) (a : N),
Ο.Realize default (Fin.snoc (f β x) a : _ β N) β
β b : M, Ο.Realize default (Fin.snoc (f β x) (f b) : _ β N)) :
β {n} (Ο : L.Formula (Fin n)) (x : Fin n β M), Ο.Realize (f β x) β Ο.Realize x := by |
suffices h : β (n : β) (Ο : L.BoundedFormula Empty n) (xs : Fin n β M),
Ο.Realize (f β default) (f β xs) β Ο.Realize default xs by
intro n Ο x
exact Ο.realize_relabel_sum_inr.symm.trans (_root_.trans (h n _ _) Ο.realize_relabel_sum_inr)
refine fun n Ο => Ο.recOn ?_ ?_ ?_ ?_ ?_
Β· exact fun {_} _ => Iff.rfl
Β· intros
simp [BoundedFormula.Realize, β Sum.comp_elim, Embedding.realize_term]
Β· intros
simp only [BoundedFormula.Realize, β Sum.comp_elim, realize_term]
erw [map_rel f]
Β· intro _ _ _ ih1 ih2 _
simp [ih1, ih2]
Β· intro n Ο ih xs
simp only [BoundedFormula.realize_all]
refine β¨fun h a => ?_, ?_β©
Β· rw [β ih, Fin.comp_snoc]
exact h (f a)
Β· contrapose!
rintro β¨a, haβ©
obtain β¨b, hbβ© := htv n Ο.not xs a (by
rw [BoundedFormula.realize_not, β Unique.eq_default (f β default)]
exact ha)
refine β¨b, fun h => hb (Eq.mp ?_ ((ih _).2 h))β©
rw [Unique.eq_default (f β default), Fin.comp_snoc]
| [
" Ο.Realize ((constantMap β Sum.inr) β x) β Ο.Realize x",
" Ο.Realize ((constantMap β Sum.inr) β x) β\n N β¨ (((L.lhomWithConstants M).onBoundedFormula Ο).subst (Constants.term β Sum.inr β x)).alls",
" M β¨ (((L.lhomWithConstants M).onBoundedFormula Ο).subst (Constants.term β Sum.inr β x)).alls β Ο.Realize x",... | [
" Ο.Realize ((constantMap β Sum.inr) β x) β Ο.Realize x",
" Ο.Realize ((constantMap β Sum.inr) β x) β\n N β¨ (((L.lhomWithConstants M).onBoundedFormula Ο).subst (Constants.term β Sum.inr β x)).alls",
" M β¨ (((L.lhomWithConstants M).onBoundedFormula Ο).subst (Constants.term β Sum.inr β x)).alls β Ο.Realize x",... |
import Mathlib.ModelTheory.Substructures
#align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398"
open FirstOrder Set
namespace FirstOrder
namespace Language
open Structure
variable {L : Language} {M : Type*} [L.Structure M]
namespace Substructure
def FG (N : L.Substructure M) : Prop :=
β S : Finset M, closure L S = N
#align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG
theorem fg_def {N : L.Substructure M} : N.FG β β S : Set M, S.Finite β§ closure L S = N :=
β¨fun β¨t, hβ© => β¨_, Finset.finite_toSet t, hβ©, by
rintro β¨t', h, rflβ©
rcases Finite.exists_finset_coe h with β¨t, rflβ©
exact β¨t, rflβ©β©
#align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def
theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} :
N.FG β β (n : β) (s : Fin n β M), closure L (range s) = N := by
rw [fg_def]
constructor
Β· rintro β¨S, Sfin, hSβ©
obtain β¨n, f, rflβ© := Sfin.fin_embedding
exact β¨n, f, hSβ©
Β· rintro β¨n, s, hsβ©
exact β¨range s, finite_range s, hsβ©
#align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family
theorem fg_bot : (β₯ : L.Substructure M).FG :=
β¨β
, by rw [Finset.coe_empty, closure_empty]β©
#align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot
theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) :=
β¨hs.toFinset, by rw [hs.coe_toFinset]β©
#align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure
theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) :=
fg_closure (finite_singleton x)
#align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton
theorem FG.sup {Nβ Nβ : L.Substructure M} (hNβ : Nβ.FG) (hNβ : Nβ.FG) : (Nβ β Nβ).FG :=
let β¨tβ, htββ© := fg_def.1 hNβ
let β¨tβ, htββ© := fg_def.1 hNβ
fg_def.2 β¨tβ βͺ tβ, htβ.1.union htβ.1, by rw [closure_union, htβ.2, htβ.2]β©
#align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup
theorem FG.map {N : Type*} [L.Structure N] (f : M β[L] N) {s : L.Substructure M} (hs : s.FG) :
(s.map f).FG :=
let β¨t, htβ© := fg_def.1 hs
fg_def.2 β¨f '' t, ht.1.image _, by rw [closure_image, ht.2]β©
#align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map
theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M βͺ[L] N) {s : L.Substructure M}
(hs : (s.map f.toHom).FG) : s.FG := by
rcases hs with β¨t, hβ©
rw [fg_def]
refine β¨f β»ΒΉ' t, t.finite_toSet.preimage f.injective.injOn, ?_β©
have hf : Function.Injective f.toHom := f.injective
refine map_injective_of_injective hf ?_
rw [β h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
intro x hx
have h' := subset_closure (L := L) hx
rw [h] at h'
exact Hom.map_le_range h'
#align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding
def CG (N : L.Substructure M) : Prop :=
β S : Set M, S.Countable β§ closure L S = N
#align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG
theorem cg_def {N : L.Substructure M} : N.CG β β S : Set M, S.Countable β§ closure L S = N :=
Iff.refl _
#align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def
theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by
obtain β¨s, hf, rflβ© := fg_def.1 h
exact β¨s, hf.countable, rflβ©
#align first_order.language.substructure.fg.cg FirstOrder.Language.Substructure.FG.cg
| Mathlib/ModelTheory/FinitelyGenerated.lean | 116 | 135 | theorem cg_iff_empty_or_exists_nat_generating_family {N : L.Substructure M} :
N.CG β N = (β
: Set M) β¨ β s : β β M, closure L (range s) = N := by |
rw [cg_def]
constructor
Β· rintro β¨S, Scount, hSβ©
rcases eq_empty_or_nonempty (N : Set M) with h | h
Β· exact Or.intro_left _ h
obtain β¨f, h'β© :=
(Scount.union (Set.countable_singleton h.some)).exists_eq_range
(singleton_nonempty h.some).inr
refine Or.intro_right _ β¨f, ?_β©
rw [β h', closure_union, hS, sup_eq_left, closure_le]
exact singleton_subset_iff.2 h.some_mem
Β· intro h
cases' h with h h
Β· refine β¨β
, countable_empty, closure_eq_of_le (empty_subset _) ?_β©
rw [β SetLike.coe_subset_coe, h]
exact empty_subset _
Β· obtain β¨f, rflβ© := h
exact β¨range f, countable_range _, rflβ©
| [
" (β S, S.Finite β§ (closure L).toFun S = N) β N.FG",
" ((closure L).toFun t').FG",
" ((closure L).toFun βt).FG",
" N.FG β β n s, (closure L).toFun (range s) = N",
" (β S, S.Finite β§ (closure L).toFun S = N) β β n s, (closure L).toFun (range s) = N",
" (β S, S.Finite β§ (closure L).toFun S = N) β β n s, (cl... | [
" (β S, S.Finite β§ (closure L).toFun S = N) β N.FG",
" ((closure L).toFun t').FG",
" ((closure L).toFun βt).FG",
" N.FG β β n s, (closure L).toFun (range s) = N",
" (β S, S.Finite β§ (closure L).toFun S = N) β β n s, (closure L).toFun (range s) = N",
" (β S, S.Finite β§ (closure L).toFun S = N) β β n s, (cl... |
import Mathlib.Algebra.Group.Pi.Lemmas
import Mathlib.Topology.Algebra.Monoid
import Mathlib.Topology.Homeomorph
#align_import topology.algebra.group_with_zero from "leanprover-community/mathlib"@"c10e724be91096453ee3db13862b9fb9a992fef2"
open Topology Filter Function
variable {Ξ± Ξ² Gβ : Type*}
section DivConst
variable [DivInvMonoid Gβ] [TopologicalSpace Gβ] [ContinuousMul Gβ] {f : Ξ± β Gβ} {s : Set Ξ±}
{l : Filter Ξ±}
theorem Filter.Tendsto.div_const {x : Gβ} (hf : Tendsto f l (π x)) (y : Gβ) :
Tendsto (fun a => f a / y) l (π (x / y)) := by
simpa only [div_eq_mul_inv] using hf.mul tendsto_const_nhds
#align filter.tendsto.div_const Filter.Tendsto.div_const
variable [TopologicalSpace Ξ±]
nonrec theorem ContinuousAt.div_const {a : Ξ±} (hf : ContinuousAt f a) (y : Gβ) :
ContinuousAt (fun x => f x / y) a :=
hf.div_const y
#align continuous_at.div_const ContinuousAt.div_const
nonrec theorem ContinuousWithinAt.div_const {a} (hf : ContinuousWithinAt f s a) (y : Gβ) :
ContinuousWithinAt (fun x => f x / y) s a :=
hf.div_const _
#align continuous_within_at.div_const ContinuousWithinAt.div_const
theorem ContinuousOn.div_const (hf : ContinuousOn f s) (y : Gβ) :
ContinuousOn (fun x => f x / y) s := by
simpa only [div_eq_mul_inv] using hf.mul continuousOn_const
#align continuous_on.div_const ContinuousOn.div_const
@[continuity]
| Mathlib/Topology/Algebra/GroupWithZero.lean | 75 | 76 | theorem Continuous.div_const (hf : Continuous f) (y : Gβ) : Continuous fun x => f x / y := by |
simpa only [div_eq_mul_inv] using hf.mul continuous_const
| [
" Tendsto (fun a => f a / y) l (π (x / y))",
" ContinuousOn (fun x => f x / y) s",
" Continuous fun x => f x / y"
] | [
" Tendsto (fun a => f a / y) l (π (x / y))",
" ContinuousOn (fun x => f x / y) s",
" Continuous fun x => f x / y"
] |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin π s t = convexJoin π t s :=
(iUnionβ_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : sβ β sβ) (ht : tβ β tβ) : convexJoin π sβ tβ β convexJoin π sβ tβ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : sβ β sβ) : convexJoin π sβ t β convexJoin π sβ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : tβ β tβ) : convexJoin π s tβ β convexJoin π s tβ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin π β
t = β
:= by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin π s β
= β
:= by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin π {x} t = β y β t, segment π x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 70 | 71 | theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin π s {y} = β x β s, segment π x y := by | simp [convexJoin]
| [
" x β convexJoin π s t β β a β s, β b β t, x β segment π a b",
" β iβ β t, β iβ β s, segment π iβ iβ = convexJoin π t s",
" convexJoin π β
t = β
",
" convexJoin π s β
= β
",
" convexJoin π {x} t = β y β t, segment π x y",
" convexJoin π s {y} = β x β s, segment π x y"
] | [
" x β convexJoin π s t β β a β s, β b β t, x β segment π a b",
" β iβ β t, β iβ β s, segment π iβ iβ = convexJoin π t s",
" convexJoin π β
t = β
",
" convexJoin π s β
= β
",
" convexJoin π {x} t = β y β t, segment π x y",
" convexJoin π s {y} = β x β s, segment π x y"
] |
import Mathlib.Probability.Variance
import Mathlib.MeasureTheory.Function.UniformIntegrable
#align_import probability.ident_distrib from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open MeasureTheory Filter Finset
noncomputable section
open scoped Topology MeasureTheory ENNReal NNReal
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} [MeasurableSpace Ξ±] [MeasurableSpace Ξ²] [MeasurableSpace Ξ³]
[MeasurableSpace Ξ΄]
namespace ProbabilityTheory
structure IdentDistrib (f : Ξ± β Ξ³) (g : Ξ² β Ξ³)
(ΞΌ : Measure Ξ± := by volume_tac)
(Ξ½ : Measure Ξ² := by volume_tac) : Prop where
aemeasurable_fst : AEMeasurable f ΞΌ
aemeasurable_snd : AEMeasurable g Ξ½
map_eq : Measure.map f ΞΌ = Measure.map g Ξ½
#align probability_theory.ident_distrib ProbabilityTheory.IdentDistrib
namespace IdentDistrib
open TopologicalSpace
variable {ΞΌ : Measure Ξ±} {Ξ½ : Measure Ξ²} {f : Ξ± β Ξ³} {g : Ξ² β Ξ³}
protected theorem refl (hf : AEMeasurable f ΞΌ) : IdentDistrib f f ΞΌ ΞΌ :=
{ aemeasurable_fst := hf
aemeasurable_snd := hf
map_eq := rfl }
#align probability_theory.ident_distrib.refl ProbabilityTheory.IdentDistrib.refl
protected theorem symm (h : IdentDistrib f g ΞΌ Ξ½) : IdentDistrib g f Ξ½ ΞΌ :=
{ aemeasurable_fst := h.aemeasurable_snd
aemeasurable_snd := h.aemeasurable_fst
map_eq := h.map_eq.symm }
#align probability_theory.ident_distrib.symm ProbabilityTheory.IdentDistrib.symm
protected theorem trans {Ο : Measure Ξ΄} {h : Ξ΄ β Ξ³} (hβ : IdentDistrib f g ΞΌ Ξ½)
(hβ : IdentDistrib g h Ξ½ Ο) : IdentDistrib f h ΞΌ Ο :=
{ aemeasurable_fst := hβ.aemeasurable_fst
aemeasurable_snd := hβ.aemeasurable_snd
map_eq := hβ.map_eq.trans hβ.map_eq }
#align probability_theory.ident_distrib.trans ProbabilityTheory.IdentDistrib.trans
protected theorem comp_of_aemeasurable {u : Ξ³ β Ξ΄} (h : IdentDistrib f g ΞΌ Ξ½)
(hu : AEMeasurable u (Measure.map f ΞΌ)) : IdentDistrib (u β f) (u β g) ΞΌ Ξ½ :=
{ aemeasurable_fst := hu.comp_aemeasurable h.aemeasurable_fst
aemeasurable_snd := by rw [h.map_eq] at hu; exact hu.comp_aemeasurable h.aemeasurable_snd
map_eq := by
rw [β AEMeasurable.map_map_of_aemeasurable hu h.aemeasurable_fst, β
AEMeasurable.map_map_of_aemeasurable _ h.aemeasurable_snd, h.map_eq]
rwa [β h.map_eq] }
#align probability_theory.ident_distrib.comp_of_ae_measurable ProbabilityTheory.IdentDistrib.comp_of_aemeasurable
protected theorem comp {u : Ξ³ β Ξ΄} (h : IdentDistrib f g ΞΌ Ξ½) (hu : Measurable u) :
IdentDistrib (u β f) (u β g) ΞΌ Ξ½ :=
h.comp_of_aemeasurable hu.aemeasurable
#align probability_theory.ident_distrib.comp ProbabilityTheory.IdentDistrib.comp
protected theorem of_ae_eq {g : Ξ± β Ξ³} (hf : AEMeasurable f ΞΌ) (heq : f =α΅[ΞΌ] g) :
IdentDistrib f g ΞΌ ΞΌ :=
{ aemeasurable_fst := hf
aemeasurable_snd := hf.congr heq
map_eq := Measure.map_congr heq }
#align probability_theory.ident_distrib.of_ae_eq ProbabilityTheory.IdentDistrib.of_ae_eq
lemma _root_.MeasureTheory.AEMeasurable.identDistrib_mk
(hf : AEMeasurable f ΞΌ) : IdentDistrib f (hf.mk f) ΞΌ ΞΌ :=
IdentDistrib.of_ae_eq hf hf.ae_eq_mk
lemma _root_.MeasureTheory.AEStronglyMeasurable.identDistrib_mk
[TopologicalSpace Ξ³] [PseudoMetrizableSpace Ξ³] [BorelSpace Ξ³]
(hf : AEStronglyMeasurable f ΞΌ) : IdentDistrib f (hf.mk f) ΞΌ ΞΌ :=
IdentDistrib.of_ae_eq hf.aemeasurable hf.ae_eq_mk
| Mathlib/Probability/IdentDistrib.lean | 132 | 135 | theorem measure_mem_eq (h : IdentDistrib f g ΞΌ Ξ½) {s : Set Ξ³} (hs : MeasurableSet s) :
ΞΌ (f β»ΒΉ' s) = Ξ½ (g β»ΒΉ' s) := by |
rw [β Measure.map_apply_of_aemeasurable h.aemeasurable_fst hs, β
Measure.map_apply_of_aemeasurable h.aemeasurable_snd hs, h.map_eq]
| [
" AEMeasurable (u β g) Ξ½",
" Measure.map (u β f) ΞΌ = Measure.map (u β g) Ξ½",
" AEMeasurable u (Measure.map g Ξ½)",
" ΞΌ (f β»ΒΉ' s) = Ξ½ (g β»ΒΉ' s)"
] | [
" AEMeasurable (u β g) Ξ½",
" Measure.map (u β f) ΞΌ = Measure.map (u β g) Ξ½",
" AEMeasurable u (Measure.map g Ξ½)",
" ΞΌ (f β»ΒΉ' s) = Ξ½ (g β»ΒΉ' s)"
] |
import Mathlib.Algebra.Module.Zlattice.Basic
import Mathlib.NumberTheory.NumberField.Embeddings
import Mathlib.NumberTheory.NumberField.FractionalIdeal
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional Finset
local notation "E" K =>
({w : InfinitePlace K // IsReal w} β β) Γ ({w : InfinitePlace K // IsComplex w} β β)
noncomputable def _root_.NumberField.mixedEmbedding : K β+* (E K) :=
RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop)
(Pi.ringHom fun w => w.val.embedding)
instance [NumberField K] : Nontrivial (E K) := by
obtain β¨wβ© := (inferInstance : Nonempty (InfinitePlace K))
obtain hw | hw := w.isReal_or_isComplex
Β· have : Nonempty {w : InfinitePlace K // IsReal w} := β¨β¨w, hwβ©β©
exact nontrivial_prod_left
Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := β¨β¨w, hwβ©β©
exact nontrivial_prod_right
protected theorem finrank [NumberField K] : finrank β (E K) = finrank β K := by
classical
rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const,
card_univ, β NrRealPlaces, β NrComplexPlaces, β card_real_embeddings, Algebra.id.smul_eq_mul,
mul_comm, β card_complex_embeddings, β NumberField.Embeddings.card K β,
Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)]
theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] :
Function.Injective (NumberField.mixedEmbedding K) := by
exact RingHom.injective _
noncomputable section norm
open scoped Classical
variable {K}
def normAtPlace (w : InfinitePlace K) : (E K) β*β β where
toFun x := if hw : IsReal w then βx.1 β¨w, hwβ©β else βx.2 β¨w, not_isReal_iff_isComplex.mp hwβ©β
map_zero' := by simp
map_one' := by simp
map_mul' x y := by split_ifs <;> simp
theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) :
0 β€ normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_nonneg _
theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) :
normAtPlace w (- x) = normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> simp
theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) :
normAtPlace w (x + y) β€ normAtPlace w x + normAtPlace w y := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_add_le _ _
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean | 274 | 279 | theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : β) :
normAtPlace w (c β’ x) = |c| * normAtPlace w x := by |
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs
Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs]
Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
| [
" Nontrivial (({ w // w.IsReal } β β) Γ ({ w // w.IsComplex } β β))",
" finrank β (({ w // w.IsReal } β β) Γ ({ w // w.IsComplex } β β)) = finrank β K",
" Function.Injective β(mixedEmbedding K)",
" (fun x => if hw : w.IsReal then βx.1 β¨w, hwβ©β else βx.2 β¨w, β―β©β) 0 = 0",
" { toFun := fun x => if hw : w.IsRea... | [
" Nontrivial (({ w // w.IsReal } β β) Γ ({ w // w.IsComplex } β β))",
" finrank β (({ w // w.IsReal } β β) Γ ({ w // w.IsComplex } β β)) = finrank β K",
" Function.Injective β(mixedEmbedding K)",
" (fun x => if hw : w.IsReal then βx.1 β¨w, hwβ©β else βx.2 β¨w, β―β©β) 0 = 0",
" { toFun := fun x => if hw : w.IsRea... |
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
noncomputable section
open scoped Manifold
open Bundle Set Topology
section SpecificFunctions
variable {π : Type*} [NontriviallyNormedField π] {E : Type*} [NormedAddCommGroup E]
[NormedSpace π E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners π E H) {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners π E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace π E'']
{H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners π E'' H'') {M'' : Type*}
[TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
variable {s : Set M} {x : M}
section Prod
theorem hasMFDerivAt_fst (x : M Γ M') :
HasMFDerivAt (I.prod I') I Prod.fst x
(ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2)) := by
refine β¨continuous_fst.continuousAt, ?_β©
have :
βαΆ y in π[range (I.prod I')] extChartAt (I.prod I') x x,
(extChartAt I x.1 β Prod.fst β (extChartAt (I.prod I') x).symm) y = y.1 := by
filter_upwards [extChartAt_target_mem_nhdsWithin (I.prod I') x] with y hy
rw [extChartAt_prod] at hy
exact (extChartAt I x.1).right_inv hy.1
apply HasFDerivWithinAt.congr_of_eventuallyEq hasFDerivWithinAt_fst this
-- Porting note: next line was `simp only [mfld_simps]`
exact (extChartAt I x.1).right_inv <| (extChartAt I x.1).map_source (mem_extChartAt_source _ _)
#align has_mfderiv_at_fst hasMFDerivAt_fst
theorem hasMFDerivWithinAt_fst (s : Set (M Γ M')) (x : M Γ M') :
HasMFDerivWithinAt (I.prod I') I Prod.fst s x
(ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2)) :=
(hasMFDerivAt_fst I I' x).hasMFDerivWithinAt
#align has_mfderiv_within_at_fst hasMFDerivWithinAt_fst
theorem mdifferentiableAt_fst {x : M Γ M'} : MDifferentiableAt (I.prod I') I Prod.fst x :=
(hasMFDerivAt_fst I I' x).mdifferentiableAt
#align mdifferentiable_at_fst mdifferentiableAt_fst
theorem mdifferentiableWithinAt_fst {s : Set (M Γ M')} {x : M Γ M'} :
MDifferentiableWithinAt (I.prod I') I Prod.fst s x :=
(mdifferentiableAt_fst I I').mdifferentiableWithinAt
#align mdifferentiable_within_at_fst mdifferentiableWithinAt_fst
theorem mdifferentiable_fst : MDifferentiable (I.prod I') I (Prod.fst : M Γ M' β M) := fun _ =>
mdifferentiableAt_fst I I'
#align mdifferentiable_fst mdifferentiable_fst
theorem mdifferentiableOn_fst {s : Set (M Γ M')} : MDifferentiableOn (I.prod I') I Prod.fst s :=
(mdifferentiable_fst I I').mdifferentiableOn
#align mdifferentiable_on_fst mdifferentiableOn_fst
@[simp, mfld_simps]
theorem mfderiv_fst {x : M Γ M'} :
mfderiv (I.prod I') I Prod.fst x =
ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2) :=
(hasMFDerivAt_fst I I' x).mfderiv
#align mfderiv_fst mfderiv_fst
theorem mfderivWithin_fst {s : Set (M Γ M')} {x : M Γ M'}
(hxs : UniqueMDiffWithinAt (I.prod I') s x) :
mfderivWithin (I.prod I') I Prod.fst s x =
ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2) := by
rw [MDifferentiable.mfderivWithin (mdifferentiableAt_fst I I') hxs]; exact mfderiv_fst I I'
#align mfderiv_within_fst mfderivWithin_fst
@[simp, mfld_simps]
| Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean | 285 | 288 | theorem tangentMap_prod_fst {p : TangentBundle (I.prod I') (M Γ M')} :
tangentMap (I.prod I') I Prod.fst p = β¨p.proj.1, p.2.1β© := by |
-- Porting note: `rfl` wasn't needed
simp [tangentMap]; rfl
| [
" HasMFDerivAt (I.prod I') I Prod.fst x (ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2))",
" HasFDerivWithinAt (writtenInExtChartAt (I.prod I') I x Prod.fst)\n (ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2)) (range β(I.prod I'))\n (β(extChartAt (I.prod I') x) x... | [
" HasMFDerivAt (I.prod I') I Prod.fst x (ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2))",
" HasFDerivWithinAt (writtenInExtChartAt (I.prod I') I x Prod.fst)\n (ContinuousLinearMap.fst π (TangentSpace I x.1) (TangentSpace I' x.2)) (range β(I.prod I'))\n (β(extChartAt (I.prod I') x) x... |
import Mathlib.Data.Set.Lattice
import Mathlib.Init.Set
import Mathlib.Control.Basic
import Mathlib.Lean.Expr.ExtraRecognizers
#align_import data.set.functor from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u
open Function
namespace Set
variable {Ξ± Ξ² : Type u} {s : Set Ξ±} {f : Ξ± β Set Ξ²} {g : Set (Ξ± β Ξ²)}
protected def monad : Monad.{u} Set where
pure a := {a}
bind s f := β i β s, f i
seq s t := Set.seq s (t ())
map := Set.image
instance : CoeHead (Set s) (Set Ξ±) := β¨fun t => (Subtype.val '' t)β©
| Mathlib/Data/Set/Functor.lean | 135 | 139 | theorem coe_eq_image_val (t : Set s) :
@Lean.Internal.coeM Set s Ξ± _ Set.monad t = (t : Set Ξ±) := by |
change β (x β t), {x.1} = _
ext
simp
| [
" Lean.Internal.coeM t = Subtype.val '' t",
" β x β t, {βx} = Subtype.val '' t",
" xβ β β x β t, {βx} β xβ β Subtype.val '' t"
] | [
" Lean.Internal.coeM t = Subtype.val '' t"
] |
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Pow
import Mathlib.Algebra.Ring.Int
#align_import algebra.order.field.power from "leanprover-community/mathlib"@"acb3d204d4ee883eb686f45d486a2a6811a01329"
variable {Ξ± : Type*}
open Function Int
section LinearOrderedField
variable [LinearOrderedField Ξ±] {a b c d : Ξ±} {n : β€}
#noalign zpow_bit0_nonneg
#noalign zpow_bit0_pos
#noalign zpow_bit0_pos_iff
#noalign zpow_bit1_neg_iff
#noalign zpow_bit1_nonneg_iff
#noalign zpow_bit1_nonpos_iff
#noalign zpow_bit1_pos_iff
protected theorem Even.zpow_nonneg (hn : Even n) (a : Ξ±) : 0 β€ a ^ n := by
obtain β¨k, rflβ© := hn; rw [zpow_add' (by simp [em'])]; exact mul_self_nonneg _
#align even.zpow_nonneg Even.zpow_nonneg
lemma zpow_two_nonneg (a : Ξ±) : 0 β€ a ^ (2 : β€) := even_two.zpow_nonneg _
#align zpow_two_nonneg zpow_two_nonneg
lemma zpow_neg_two_nonneg (a : Ξ±) : 0 β€ a ^ (-2 : β€) := even_neg_two.zpow_nonneg _
#align zpow_neg_two_nonneg zpow_neg_two_nonneg
protected lemma Even.zpow_pos (hn : Even n) (ha : a β 0) : 0 < a ^ n :=
(hn.zpow_nonneg _).lt_of_ne' (zpow_ne_zero _ ha)
#align even.zpow_pos Even.zpow_pos
lemma zpow_two_pos_of_ne_zero (ha : a β 0) : 0 < a ^ (2 : β€) := even_two.zpow_pos ha
#align zpow_two_pos_of_ne_zero zpow_two_pos_of_ne_zero
theorem Even.zpow_pos_iff (hn : Even n) (h : n β 0) : 0 < a ^ n β a β 0 := by
obtain β¨k, rflβ© := hn
rw [zpow_add' (by simp [em']), mul_self_pos, zpow_ne_zero_iff (by simpa using h)]
#align even.zpow_pos_iff Even.zpow_pos_iff
| Mathlib/Algebra/Order/Field/Power.lean | 155 | 159 | theorem Odd.zpow_neg_iff (hn : Odd n) : a ^ n < 0 β a < 0 := by |
refine β¨lt_imp_lt_of_le_imp_le (zpow_nonneg Β· _), fun ha β¦ ?_β©
obtain β¨k, rflβ© := hn
rw [zpow_add_oneβ ha.ne]
exact mul_neg_of_pos_of_neg (Even.zpow_pos (even_two_mul _) ha.ne) ha
| [
" 0 β€ a ^ n",
" 0 β€ a ^ (k + k)",
" a β 0 β¨ k + k β 0 β¨ k = 0 β§ k = 0",
" 0 β€ a ^ k * a ^ k",
" 0 < a ^ n β a β 0",
" 0 < a ^ (k + k) β a β 0",
" k β 0",
" a ^ n < 0 β a < 0",
" a ^ n < 0",
" a ^ (2 * k + 1) < 0",
" a ^ (2 * k) * a < 0"
] | [
" 0 β€ a ^ n",
" 0 β€ a ^ (k + k)",
" a β 0 β¨ k + k β 0 β¨ k = 0 β§ k = 0",
" 0 β€ a ^ k * a ^ k",
" 0 < a ^ n β a β 0",
" 0 < a ^ (k + k) β a β 0",
" k β 0",
" a ^ n < 0 β a < 0"
] |
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace β F]
open Filter Set Metric ContinuousLinearMap
open scoped Topology
attribute [local mono] Set.prod_mono
theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E β F} {s : Set E} {x : E} {f' : E βL[β] F}
(f_diff : DifferentiableOn β f s) (s_conv : Convex β s) (s_open : IsOpen s)
(f_cont : β y β closure s, ContinuousWithinAt f s y)
(h : Tendsto (fun y => fderiv β f y) (π[s] x) (π f')) :
HasFDerivWithinAt f f' (closure s) x := by
classical
-- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
-- statement is empty otherwise
by_cases hx : x β closure s
Β· rw [β closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
push_neg at hx
rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff]
intro Ξ΅ Ξ΅_pos
obtain β¨Ξ΄, Ξ΄_pos, hΞ΄β© : β Ξ΄ > 0, β y β s, dist y x < Ξ΄ β βfderiv β f y - f'β < Ξ΅ := by
simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h Ξ΅ Ξ΅_pos
set B := ball x Ξ΄
suffices β y β B β© closure s, βf y - f x - (f' y - f' x)β β€ Ξ΅ * βy - xβ from
mem_nhdsWithin_iff.2 β¨Ξ΄, Ξ΄_pos, fun y hy => by simpa using this y hyβ©
suffices
β p : E Γ E,
p β closure ((B β© s) ΓΛ’ (B β© s)) β βf p.2 - f p.1 - (f' p.2 - f' p.1)β β€ Ξ΅ * βp.2 - p.1β by
rw [closure_prod_eq] at this
intro y y_in
apply this β¨x, yβ©
have : B β© closure s β closure (B β© s) := isOpen_ball.inter_closure
exact β¨this β¨mem_ball_self Ξ΄_pos, hxβ©, this y_inβ©
have key : β p : E Γ E, p β (B β© s) ΓΛ’ (B β© s) β
βf p.2 - f p.1 - (f' p.2 - f' p.1)β β€ Ξ΅ * βp.2 - p.1β := by
rintro β¨u, vβ© β¨u_in, v_inβ©
have conv : Convex β (B β© s) := (convex_ball _ _).inter s_conv
have diff : DifferentiableOn β f (B β© s) := f_diff.mono inter_subset_right
have bound : β z β B β© s, βfderivWithin β f (B β© s) z - f'β β€ Ξ΅ := by
intro z z_in
have h := hΞ΄ z
have : fderivWithin β f (B β© s) z = fderiv β f z := by
have op : IsOpen (B β© s) := isOpen_ball.inter s_open
rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)]
exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in)
rw [β this] at h
exact le_of_lt (h z_in.2 z_in.1)
simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in
rintro β¨u, vβ© uv_in
have f_cont' : β y β closure s, ContinuousWithinAt (f - βf') s y := by
intro y y_in
exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt
refine ContinuousWithinAt.closure_le uv_in ?_ ?_ key
all_goals
-- common start for both continuity proofs
have : (B β© s) ΓΛ’ (B β© s) β s ΓΛ’ s := by mono <;> exact inter_subset_right
obtain β¨u_in, v_inβ© : u β closure s β§ v β closure s := by
simpa [closure_prod_eq] using closure_mono this uv_in
apply ContinuousWithinAt.mono _ this
simp only [ContinuousWithinAt]
Β· rw [nhdsWithin_prod_eq]
have : β u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
simp only [this]
exact
Tendsto.comp continuous_norm.continuousAt
((Tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
Tendsto.comp (f_cont' u u_in) tendsto_fst)
Β· apply tendsto_nhdsWithin_of_tendsto_nhds
rw [nhds_prod_eq]
exact
tendsto_const_nhds.mul
(Tendsto.comp continuous_norm.continuousAt <| tendsto_snd.sub tendsto_fst)
#align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
| Mathlib/Analysis/Calculus/FDeriv/Extend.lean | 111 | 140 | theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set β} {e : E} {a : β} {f : β β E}
(f_diff : DifferentiableOn β f s) (f_lim : ContinuousWithinAt f s a) (hs : s β π[>] a)
(f_lim' : Tendsto (fun x => deriv f x) (π[>] a) (π e)) : HasDerivWithinAt f e (Ici a) a := by |
/- This is a specialization of `has_fderiv_at_boundary_of_tendsto_fderiv`. To be in the setting of
this theorem, we need to work on an open interval with closure contained in `s βͺ {a}`, that we
call `t = (a, b)`. Then, we check all the assumptions of this theorem and we apply it. -/
obtain β¨b, ab : a < b, sab : Ioc a b β sβ© := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hs
let t := Ioo a b
have ts : t β s := Subset.trans Ioo_subset_Ioc_self sab
have t_diff : DifferentiableOn β f t := f_diff.mono ts
have t_conv : Convex β t := convex_Ioo a b
have t_open : IsOpen t := isOpen_Ioo
have t_closure : closure t = Icc a b := closure_Ioo ab.ne
have t_cont : β y β closure t, ContinuousWithinAt f t y := by
rw [t_closure]
intro y hy
by_cases h : y = a
Β· rw [h]; exact f_lim.mono ts
Β· have : y β s := sab β¨lt_of_le_of_ne hy.1 (Ne.symm h), hy.2β©
exact (f_diff.continuousOn y this).mono ts
have t_diff' : Tendsto (fun x => fderiv β f x) (π[t] a) (π (smulRight (1 : β βL[β] β) e)) := by
simp only [deriv_fderiv.symm]
exact Tendsto.comp
(isBoundedBilinearMap_smulRight : IsBoundedBilinearMap β _).continuous_right.continuousAt
(tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim')
-- now we can apply `has_fderiv_at_boundary_of_differentiable`
have : HasDerivWithinAt f e (Icc a b) a := by
rw [hasDerivWithinAt_iff_hasFDerivWithinAt, β t_closure]
exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
exact this.mono_of_mem (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
| [
" HasFDerivWithinAt f f' (closure s) x",
" β β¦c : ββ¦, 0 < c β βαΆ (x_1 : E) in π[closure s] x, βf x_1 - f x - f' (x_1 - x)β β€ c * βx_1 - xβ",
" βαΆ (x_1 : E) in π[closure s] x, βf x_1 - f x - f' (x_1 - x)β β€ Ξ΅ * βx_1 - xβ",
" β Ξ΄ > 0, β y β s, dist y x < Ξ΄ β βfderiv β f y - f'β < Ξ΅",
" y β {x_1 | (fun x_2 =... | [
" HasFDerivWithinAt f f' (closure s) x",
" β β¦c : ββ¦, 0 < c β βαΆ (x_1 : E) in π[closure s] x, βf x_1 - f x - f' (x_1 - x)β β€ c * βx_1 - xβ",
" βαΆ (x_1 : E) in π[closure s] x, βf x_1 - f x - f' (x_1 - x)β β€ Ξ΅ * βx_1 - xβ",
" β Ξ΄ > 0, β y β s, dist y x < Ξ΄ β βfderiv β f y - f'β < Ξ΅",
" y β {x_1 | (fun x_2 =... |
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.Order.Filter.Pointwise
import Mathlib.Topology.Algebra.MulAction
import Mathlib.Algebra.BigOperators.Pi
import Mathlib.Topology.ContinuousFunction.Basic
import Mathlib.Algebra.Group.ULift
#align_import topology.algebra.monoid from "leanprover-community/mathlib"@"1ac8d4304efba9d03fa720d06516fac845aa5353"
universe u v
open scoped Classical
open Set Filter TopologicalSpace
open scoped Classical
open Topology Pointwise
variable {ΞΉ Ξ± M N X : Type*} [TopologicalSpace X]
@[to_additive (attr := continuity, fun_prop)]
theorem continuous_one [TopologicalSpace M] [One M] : Continuous (1 : X β M) :=
@continuous_const _ _ _ _ 1
#align continuous_one continuous_one
#align continuous_zero continuous_zero
class ContinuousAdd (M : Type u) [TopologicalSpace M] [Add M] : Prop where
continuous_add : Continuous fun p : M Γ M => p.1 + p.2
#align has_continuous_add ContinuousAdd
@[to_additive]
class ContinuousMul (M : Type u) [TopologicalSpace M] [Mul M] : Prop where
continuous_mul : Continuous fun p : M Γ M => p.1 * p.2
#align has_continuous_mul ContinuousMul
section ContinuousMul
variable [TopologicalSpace M] [Mul M] [ContinuousMul M]
@[to_additive]
instance : ContinuousMul Mα΅α΅ :=
βΉContinuousMul MβΊ
@[to_additive (attr := continuity)]
theorem continuous_mul : Continuous fun p : M Γ M => p.1 * p.2 :=
ContinuousMul.continuous_mul
#align continuous_mul continuous_mul
#align continuous_add continuous_add
@[to_additive]
instance : ContinuousMul (ULift.{u} M) := by
constructor
apply continuous_uLift_up.comp
exact continuous_mul.compβ (continuous_uLift_down.comp continuous_fst)
(continuous_uLift_down.comp continuous_snd)
@[to_additive]
instance ContinuousMul.to_continuousSMul : ContinuousSMul M M :=
β¨continuous_mulβ©
#align has_continuous_mul.to_has_continuous_smul ContinuousMul.to_continuousSMul
#align has_continuous_add.to_has_continuous_vadd ContinuousAdd.to_continuousVAdd
@[to_additive]
instance ContinuousMul.to_continuousSMul_op : ContinuousSMul Mα΅α΅α΅ M :=
β¨show Continuous ((fun p : M Γ M => p.1 * p.2) β Prod.swap β Prod.map MulOpposite.unop id) from
continuous_mul.comp <|
continuous_swap.comp <| Continuous.prod_map MulOpposite.continuous_unop continuous_idβ©
#align has_continuous_mul.to_has_continuous_smul_op ContinuousMul.to_continuousSMul_op
#align has_continuous_add.to_has_continuous_vadd_op ContinuousAdd.to_continuousVAdd_op
@[to_additive (attr := continuity, fun_prop)]
theorem Continuous.mul {f g : X β M} (hf : Continuous f) (hg : Continuous g) :
Continuous fun x => f x * g x :=
continuous_mul.comp (hf.prod_mk hg : _)
#align continuous.mul Continuous.mul
#align continuous.add Continuous.add
@[to_additive (attr := continuity)]
theorem continuous_mul_left (a : M) : Continuous fun b : M => a * b :=
continuous_const.mul continuous_id
#align continuous_mul_left continuous_mul_left
#align continuous_add_left continuous_add_left
@[to_additive (attr := continuity)]
theorem continuous_mul_right (a : M) : Continuous fun b : M => b * a :=
continuous_id.mul continuous_const
#align continuous_mul_right continuous_mul_right
#align continuous_add_right continuous_add_right
@[to_additive (attr := fun_prop)]
theorem ContinuousOn.mul {f g : X β M} {s : Set X} (hf : ContinuousOn f s) (hg : ContinuousOn g s) :
ContinuousOn (fun x => f x * g x) s :=
(continuous_mul.comp_continuousOn (hf.prod hg) : _)
#align continuous_on.mul ContinuousOn.mul
#align continuous_on.add ContinuousOn.add
@[to_additive]
theorem tendsto_mul {a b : M} : Tendsto (fun p : M Γ M => p.fst * p.snd) (π (a, b)) (π (a * b)) :=
continuous_iff_continuousAt.mp ContinuousMul.continuous_mul (a, b)
#align tendsto_mul tendsto_mul
#align tendsto_add tendsto_add
@[to_additive]
theorem Filter.Tendsto.mul {f g : Ξ± β M} {x : Filter Ξ±} {a b : M} (hf : Tendsto f x (π a))
(hg : Tendsto g x (π b)) : Tendsto (fun x => f x * g x) x (π (a * b)) :=
tendsto_mul.comp (hf.prod_mk_nhds hg)
#align filter.tendsto.mul Filter.Tendsto.mul
#align filter.tendsto.add Filter.Tendsto.add
@[to_additive]
theorem Filter.Tendsto.const_mul (b : M) {c : M} {f : Ξ± β M} {l : Filter Ξ±}
(h : Tendsto (fun k : Ξ± => f k) l (π c)) : Tendsto (fun k : Ξ± => b * f k) l (π (b * c)) :=
tendsto_const_nhds.mul h
#align filter.tendsto.const_mul Filter.Tendsto.const_mul
#align filter.tendsto.const_add Filter.Tendsto.const_add
@[to_additive]
theorem Filter.Tendsto.mul_const (b : M) {c : M} {f : Ξ± β M} {l : Filter Ξ±}
(h : Tendsto (fun k : Ξ± => f k) l (π c)) : Tendsto (fun k : Ξ± => f k * b) l (π (c * b)) :=
h.mul tendsto_const_nhds
#align filter.tendsto.mul_const Filter.Tendsto.mul_const
#align filter.tendsto.add_const Filter.Tendsto.add_const
@[to_additive]
| Mathlib/Topology/Algebra/Monoid.lean | 150 | 152 | theorem le_nhds_mul (a b : M) : π a * π b β€ π (a * b) := by |
rw [β mapβ_mul, β map_uncurry_prod, β nhds_prod_eq]
exact continuous_mul.tendsto _
| [
" ContinuousMul (ULift.{u, u_3} M)",
" Continuous fun p => p.1 * p.2",
" Continuous fun p => p.1.down * p.2.down",
" π a * π b β€ π (a * b)",
" map (Function.uncurry fun x x_1 => x * x_1) (π (a, b)) β€ π (a * b)"
] | [
" ContinuousMul (ULift.{u, u_3} M)",
" Continuous fun p => p.1 * p.2",
" Continuous fun p => p.1.down * p.2.down",
" π a * π b β€ π (a * b)"
] |
import Mathlib.Algebra.Group.NatPowAssoc
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Induction
import Mathlib.Algebra.Polynomial.Eval
namespace Polynomial
section MulActionWithZero
variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β]
[MulActionWithZero R S] (x : S)
def smul_pow : β β R β S := fun n r => r β’ x^n
irreducible_def smeval : S := p.sum (smul_pow x)
theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def]
@[simp]
theorem smeval_C : (C r).smeval x = r β’ x ^ 0 := by
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index]
@[simp]
| Mathlib/Algebra/Polynomial/Smeval.lean | 61 | 63 | theorem smeval_monomial (n : β) :
(monomial n r).smeval x = r β’ x ^ n := by |
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index]
| [
" p.smeval x = p.sum (smul_pow x)",
" (C r).smeval x = r β’ x ^ 0",
" ((monomial n) r).smeval x = r β’ x ^ n"
] | [
" p.smeval x = p.sum (smul_pow x)",
" (C r).smeval x = r β’ x ^ 0",
" ((monomial n) r).smeval x = r β’ x ^ n"
] |
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
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
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.factors_normalized_Moore_complex_P_infty AlgebraicTopology.DoldKan.factors_normalizedMooreComplex_PInfty
@[simps!]
def PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] βΆ N[X] :=
ChainComplex.ofHom _ _ _ _ _ _
(fun n => factorThru _ _ (factors_normalizedMooreComplex_PInfty n)) fun n => by
rw [β cancel_mono (NormalizedMooreComplex.objX X n).arrow, assoc, assoc, factorThru_arrow,
β inclusionOfMooreComplexMap_f, β normalizedMooreComplex_objD,
β (inclusionOfMooreComplexMap X).comm (n + 1) n, inclusionOfMooreComplexMap_f,
factorThru_arrow_assoc, β alternatingFaceMapComplex_obj_d]
exact PInfty.comm (n + 1) n
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex
@[reassoc (attr := simp)]
theorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :
PInftyToNormalizedMooreComplex X β« inclusionOfMooreComplexMap X = PInfty := by aesop_cat
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex_comp_inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap
@[reassoc (attr := simp)]
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 83 | 86 | theorem PInftyToNormalizedMooreComplex_naturality {X Y : SimplicialObject A} (f : X βΆ Y) :
AlternatingFaceMapComplex.map f β« PInftyToNormalizedMooreComplex Y =
PInftyToNormalizedMooreComplex X β« NormalizedMooreComplex.map f := by |
aesop_cat
| [
" (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)",
" (NormalizedMooreComplex.objX X 0).Factors (PInfty.f 0)",
" (No... |
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]
theorem ack_succ_zero (m : β) : ack (m + 1) 0 = ack m 1 := by rw [ack]
#align ack_succ_zero ack_succ_zero
@[simp]
| Mathlib/Computability/Ackermann.lean | 78 | 78 | theorem ack_succ_succ (m n : β) : ack (m + 1) (n + 1) = ack m (ack (m + 1) n) := by | rw [ack]
| [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1",
" ack (m + 1) (n + 1) = ack m (ack (m + 1) n)"
] | [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1",
" ack (m + 1) (n + 1) = ack m (ack (m + 1) n)"
] |
import Mathlib.Data.Fin.VecNotation
import Mathlib.SetTheory.Cardinal.Basic
#align_import model_theory.basic from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
set_option autoImplicit true
universe u v u' v' w w'
open Cardinal
open Cardinal
namespace FirstOrder
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
structure Language where
Functions : β β Type u
Relations : β β Type v
#align first_order.language FirstOrder.Language
--@[simp]
def Sequenceβ (aβ aβ aβ : Type u) : β β Type u
| 0 => aβ
| 1 => aβ
| 2 => aβ
| _ => PEmpty
#align first_order.sequenceβ FirstOrder.Sequenceβ
namespace Sequenceβ
variable (aβ aβ aβ : Type u)
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 0) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 1) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance inhabitedβ [h : Inhabited aβ] : Inhabited (Sequenceβ aβ aβ aβ 2) :=
h
#align first_order.sequenceβ.inhabitedβ FirstOrder.Sequenceβ.inhabitedβ
instance {n : β} : IsEmpty (Sequenceβ aβ aβ aβ (n + 3)) := inferInstanceAs (IsEmpty PEmpty)
@[simp]
| Mathlib/ModelTheory/Basic.lean | 95 | 100 | theorem lift_mk {i : β} :
Cardinal.lift.{v,u} #(Sequenceβ aβ aβ aβ i)
= #(Sequenceβ (ULift.{v,u} aβ) (ULift.{v,u} aβ) (ULift.{v,u} aβ) i) := by |
rcases i with (_ | _ | _ | i) <;>
simp only [Sequenceβ, mk_uLift, Nat.succ_ne_zero, IsEmpty.forall_iff, Nat.succ.injEq,
add_eq_zero, OfNat.ofNat_ne_zero, and_false, one_ne_zero, mk_eq_zero, lift_zero]
| [
" lift.{v, u} #(Sequenceβ aβ aβ aβ i) = #(Sequenceβ (ULift.{v, u} aβ) (ULift.{v, u} aβ) (ULift.{v, u} aβ) i)",
" lift.{v, u} #(Sequenceβ aβ aβ aβ 0) = #(Sequenceβ (ULift.{v, u} aβ) (ULift.{v, u} aβ) (ULift.{v, u} aβ) 0)",
" lift.{v, u} #(Sequenceβ aβ aβ aβ (0 + 1)) = #(Sequenceβ (ULift.{v, u} aβ) (ULift.{v, u} ... | [
" lift.{v, u} #(Sequenceβ aβ aβ aβ i) = #(Sequenceβ (ULift.{v, u} aβ) (ULift.{v, u} aβ) (ULift.{v, u} aβ) i)"
] |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.function.simple_func from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
noncomputable section
open Set hiding restrict restrict_apply
open Filter ENNReal
open Function (support)
open scoped Classical
open Topology NNReal ENNReal MeasureTheory
namespace MeasureTheory
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*}
structure SimpleFunc.{u, v} (Ξ± : Type u) [MeasurableSpace Ξ±] (Ξ² : Type v) where
toFun : Ξ± β Ξ²
measurableSet_fiber' : β x, MeasurableSet (toFun β»ΒΉ' {x})
finite_range' : (Set.range toFun).Finite
#align measure_theory.simple_func MeasureTheory.SimpleFunc
#align measure_theory.simple_func.to_fun MeasureTheory.SimpleFunc.toFun
#align measure_theory.simple_func.measurable_set_fiber' MeasureTheory.SimpleFunc.measurableSet_fiber'
#align measure_theory.simple_func.finite_range' MeasureTheory.SimpleFunc.finite_range'
local infixr:25 " ββ " => SimpleFunc
namespace SimpleFunc
section Measurable
variable [MeasurableSpace Ξ±]
attribute [coe] toFun
instance instCoeFun : CoeFun (Ξ± ββ Ξ²) fun _ => Ξ± β Ξ² :=
β¨toFunβ©
#align measure_theory.simple_func.has_coe_to_fun MeasureTheory.SimpleFunc.instCoeFun
theorem coe_injective β¦f g : Ξ± ββ Ξ²β¦ (H : (f : Ξ± β Ξ²) = g) : f = g := by
cases f; cases g; congr
#align measure_theory.simple_func.coe_injective MeasureTheory.SimpleFunc.coe_injective
@[ext]
theorem ext {f g : Ξ± ββ Ξ²} (H : β a, f a = g a) : f = g :=
coe_injective <| funext H
#align measure_theory.simple_func.ext MeasureTheory.SimpleFunc.ext
theorem finite_range (f : Ξ± ββ Ξ²) : (Set.range f).Finite :=
f.finite_range'
#align measure_theory.simple_func.finite_range MeasureTheory.SimpleFunc.finite_range
theorem measurableSet_fiber (f : Ξ± ββ Ξ²) (x : Ξ²) : MeasurableSet (f β»ΒΉ' {x}) :=
f.measurableSet_fiber' x
#align measure_theory.simple_func.measurable_set_fiber MeasureTheory.SimpleFunc.measurableSet_fiber
-- @[simp] -- Porting note (#10618): simp can prove this
theorem apply_mk (f : Ξ± β Ξ²) (h h') (x : Ξ±) : SimpleFunc.mk f h h' x = f x :=
rfl
#align measure_theory.simple_func.apply_mk MeasureTheory.SimpleFunc.apply_mk
def ofFinite [Finite Ξ±] [MeasurableSingletonClass Ξ±] (f : Ξ± β Ξ²) : Ξ± ββ Ξ² where
toFun := f
measurableSet_fiber' x := (toFinite (f β»ΒΉ' {x})).measurableSet
finite_range' := Set.finite_range f
@[deprecated (since := "2024-02-05")] alias ofFintype := ofFinite
def ofIsEmpty [IsEmpty Ξ±] : Ξ± ββ Ξ² := ofFinite isEmptyElim
#align measure_theory.simple_func.of_is_empty MeasureTheory.SimpleFunc.ofIsEmpty
protected def range (f : Ξ± ββ Ξ²) : Finset Ξ² :=
f.finite_range.toFinset
#align measure_theory.simple_func.range MeasureTheory.SimpleFunc.range
@[simp]
theorem mem_range {f : Ξ± ββ Ξ²} {b} : b β f.range β b β range f :=
Finite.mem_toFinset _
#align measure_theory.simple_func.mem_range MeasureTheory.SimpleFunc.mem_range
theorem mem_range_self (f : Ξ± ββ Ξ²) (x : Ξ±) : f x β f.range :=
mem_range.2 β¨x, rflβ©
#align measure_theory.simple_func.mem_range_self MeasureTheory.SimpleFunc.mem_range_self
@[simp]
theorem coe_range (f : Ξ± ββ Ξ²) : (βf.range : Set Ξ²) = Set.range f :=
f.finite_range.coe_toFinset
#align measure_theory.simple_func.coe_range MeasureTheory.SimpleFunc.coe_range
theorem mem_range_of_measure_ne_zero {f : Ξ± ββ Ξ²} {x : Ξ²} {ΞΌ : Measure Ξ±} (H : ΞΌ (f β»ΒΉ' {x}) β 0) :
x β f.range :=
let β¨a, haβ© := nonempty_of_measure_ne_zero H
mem_range.2 β¨a, haβ©
#align measure_theory.simple_func.mem_range_of_measure_ne_zero MeasureTheory.SimpleFunc.mem_range_of_measure_ne_zero
theorem forall_mem_range {f : Ξ± ββ Ξ²} {p : Ξ² β Prop} : (β y β f.range, p y) β β x, p (f x) := by
simp only [mem_range, Set.forall_mem_range]
#align measure_theory.simple_func.forall_mem_range MeasureTheory.SimpleFunc.forall_mem_range
| Mathlib/MeasureTheory/Function/SimpleFunc.lean | 129 | 130 | theorem exists_range_iff {f : Ξ± ββ Ξ²} {p : Ξ² β Prop} : (β y β f.range, p y) β β x, p (f x) := by |
simpa only [mem_range, exists_prop] using Set.exists_range_iff
| [
" f = g",
" { toFun := toFunβ, measurableSet_fiber' := measurableSet_fiber'β, finite_range' := finite_range'β } = g",
" { toFun := toFunβΒΉ, measurableSet_fiber' := measurableSet_fiber'βΒΉ, finite_range' := finite_range'βΒΉ } =\n { toFun := toFunβ, measurableSet_fiber' := measurableSet_fiber'β, finite_range' :=... | [
" f = g",
" { toFun := toFunβ, measurableSet_fiber' := measurableSet_fiber'β, finite_range' := finite_range'β } = g",
" { toFun := toFunβΒΉ, measurableSet_fiber' := measurableSet_fiber'βΒΉ, finite_range' := finite_range'βΒΉ } =\n { toFun := toFunβ, measurableSet_fiber' := measurableSet_fiber'β, finite_range' :=... |
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
noncomputable section
open scoped Manifold
open Bundle Set Topology
section SpecificFunctions
variable {π : Type*} [NontriviallyNormedField π] {E : Type*} [NormedAddCommGroup E]
[NormedSpace π E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners π E H) {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners π E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace π E'']
{H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners π E'' H'') {M'' : Type*}
[TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
variable {s : Set M} {x : M}
section Const
variable {c : M'}
| Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean | 184 | 187 | theorem hasMFDerivAt_const (c : M') (x : M) :
HasMFDerivAt I I' (fun _ : M => c) x (0 : TangentSpace I x βL[π] TangentSpace I' c) := by |
refine β¨continuous_const.continuousAt, ?_β©
simp only [writtenInExtChartAt, (Β· β Β·), hasFDerivWithinAt_const]
| [
" HasMFDerivAt I I' (fun x => c) x 0",
" HasFDerivWithinAt (writtenInExtChartAt I I' x fun x => c) 0 (range βI) (β(extChartAt I x) x)"
] | [
" HasMFDerivAt I I' (fun x => c) x 0"
] |
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
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
#align nat.count_add Nat.count_add
theorem count_add' (a b : β) : count p (a + b) = count (fun k β¦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
theorem count_one : count p 1 = if p 0 then 1 else 0 := by simp [count_succ]
#align nat.count_one Nat.count_one
theorem count_succ' (n : β) :
count p (n + 1) = count (fun k β¦ p (k + 1)) n + if p 0 then 1 else 0 := by
rw [count_add', count_one]
#align nat.count_succ' Nat.count_succ'
variable {p}
@[simp]
theorem count_lt_count_succ_iff {n : β} : count p n < count p (n + 1) β p n := by
by_cases h : p n <;> simp [count_succ, h]
#align nat.count_lt_count_succ_iff Nat.count_lt_count_succ_iff
theorem count_succ_eq_succ_count_iff {n : β} : count p (n + 1) = count p n + 1 β p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_succ_count_iff Nat.count_succ_eq_succ_count_iff
theorem count_succ_eq_count_iff {n : β} : count p (n + 1) = count p n β Β¬p n := by
by_cases h : p n <;> simp [h, count_succ]
#align nat.count_succ_eq_count_iff Nat.count_succ_eq_count_iff
alias β¨_, count_succ_eq_succ_countβ© := count_succ_eq_succ_count_iff
#align nat.count_succ_eq_succ_count Nat.count_succ_eq_succ_count
alias β¨_, count_succ_eq_countβ© := count_succ_eq_count_iff
#align nat.count_succ_eq_count Nat.count_succ_eq_count
theorem count_le_cardinal (n : β) : (count p n : Cardinal) β€ Cardinal.mk { k | p k } := by
rw [count_eq_card_fintype, β Cardinal.mk_fintype]
exact Cardinal.mk_subtype_mono fun x hx β¦ hx.2
#align nat.count_le_cardinal Nat.count_le_cardinal
theorem lt_of_count_lt_count {a b : β} (h : count p a < count p b) : a < b :=
(count_monotone p).reflect_lt h
#align nat.lt_of_count_lt_count Nat.lt_of_count_lt_count
theorem count_strict_mono {m n : β} (hm : p m) (hmn : m < n) : count p m < count p n :=
(count_lt_count_succ_iff.2 hm).trans_le <| count_monotone _ (Nat.succ_le_iff.2 hmn)
#align nat.count_strict_mono Nat.count_strict_mono
| Mathlib/Data/Nat/Count.lean | 133 | 137 | theorem count_injective {m n : β} (hm : p m) (hn : p n) (heq : count p m = count p n) : m = n := by |
by_contra! h : m β n
wlog hmn : m < n
Β· exact this hn hm heq.symm h.symm (h.lt_or_lt.resolve_left hmn)
Β· simpa [heq] using count_strict_mono hm hmn
| [
" 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.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : β) : β :=
if x β€ 0 then 0 else exp (-xβ»ΒΉ)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : β} (hx : x β€ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 53 | 54 | theorem pos_of_pos {x : β} (hx : 0 < x) : 0 < expNegInvGlue x := by |
simp [expNegInvGlue, not_le.2 hx, exp_pos]
| [
" expNegInvGlue x = 0",
" 0 < expNegInvGlue x"
] | [
" expNegInvGlue x = 0",
" 0 < expNegInvGlue x"
] |
import Mathlib.Topology.Order
#align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d"
open Set Filter Function
open TopologicalSpace Topology Filter
variable {X : Type*} {Y : Type*} {Z : Type*} {ΞΉ : Type*} {f : X β Y} {g : Y β Z}
section OpenMap
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
namespace IsOpenMap
protected theorem id : IsOpenMap (@id X) := fun s hs => by rwa [image_id]
#align is_open_map.id IsOpenMap.id
protected theorem comp (hg : IsOpenMap g) (hf : IsOpenMap f) :
IsOpenMap (g β f) := fun s hs => by rw [image_comp]; exact hg _ (hf _ hs)
#align is_open_map.comp IsOpenMap.comp
| Mathlib/Topology/Maps.lean | 338 | 340 | theorem isOpen_range (hf : IsOpenMap f) : IsOpen (range f) := by |
rw [β image_univ]
exact hf _ isOpen_univ
| [
" IsOpen (id '' s)",
" IsOpen (g β f '' s)",
" IsOpen (g '' (f '' s))",
" IsOpen (range f)",
" IsOpen (f '' univ)"
] | [
" IsOpen (id '' s)",
" IsOpen (g β f '' s)",
" IsOpen (g '' (f '' s))",
" IsOpen (range f)"
] |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.ZMod.Basic
#align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open MvPolynomial
open Finset hiding map
open Finsupp (single)
--attribute [-simp] coe_evalβ_hom
variable (p : β)
variable (R : Type*) [CommRing R] [DecidableEq R]
noncomputable def wittPolynomial (n : β) : MvPolynomial β R :=
β i β range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i)
#align witt_polynomial wittPolynomial
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : β) :
wittPolynomial p R n = β i β range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl
rintro i -
rw [monomial_eq, Finsupp.prod_single_index]
rw [pow_zero]
set_option linter.uppercaseLean3 false in
#align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow
-- Notation with ring of coefficients explicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W_" => wittPolynomial p
-- Notation with ring of coefficients implicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W" => wittPolynomial p _
open Witt
open MvPolynomial
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map_wittPolynomial (f : R β+* S) (n : β) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial]
refine sum_congr rfl fun i _ => ?_
rw [map_monomial, RingHom.map_pow, map_natCast]
#align map_witt_polynomial map_wittPolynomial
variable (R)
@[simp]
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : β) :
constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial]
rw [sum_eq_zero]
rintro i _
rw [if_neg]
rw [Finsupp.single_eq_zero]
exact ne_of_gt (pow_pos hp.1.pos _)
#align constant_coeff_witt_polynomial constantCoeff_wittPolynomial
@[simp]
theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
#align witt_polynomial_zero wittPolynomial_zero
@[simp]
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton,
one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
#align witt_polynomial_one wittPolynomial_one
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 146 | 148 | theorem aeval_wittPolynomial {A : Type*} [CommRing A] [Algebra R A] (f : β β A) (n : β) :
aeval f (W_ R n) = β i β range (n + 1), (p : A) ^ i * f i ^ p ^ (n - i) := by |
simp [wittPolynomial, AlgHom.map_sum, aeval_monomial, Finsupp.prod_single_index]
| [
" wittPolynomial p R n = β i β range (n + 1), C (βp ^ i) * X i ^ p ^ (n - i)",
" β x β range (n + 1), (monomial (single x (p ^ (n - x)))) (βp ^ x) = C (βp ^ x) * X x ^ p ^ (n - x)",
" (monomial (single i (p ^ (n - i)))) (βp ^ i) = C (βp ^ i) * X i ^ p ^ (n - i)",
" X i ^ 0 = 1",
" (map f) (W_ R n) = W_ S n"... | [
" wittPolynomial p R n = β i β range (n + 1), C (βp ^ i) * X i ^ p ^ (n - i)",
" β x β range (n + 1), (monomial (single x (p ^ (n - x)))) (βp ^ x) = C (βp ^ x) * X x ^ p ^ (n - x)",
" (monomial (single i (p ^ (n - i)))) (βp ^ i) = C (βp ^ i) * X i ^ p ^ (n - i)",
" X i ^ 0 = 1",
" (map f) (W_ R n) = W_ S n"... |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Finset.NatAntidiagonal
#align_import algebra.big_operators.nat_antidiagonal from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
variable {M N : Type*} [CommMonoid M] [AddCommMonoid N]
namespace Finset
namespace Nat
theorem prod_antidiagonal_succ {n : β} {f : β Γ β β M} :
(β p β antidiagonal (n + 1), f p)
= f (0, n + 1) * β p β antidiagonal n, f (p.1 + 1, p.2) := by
rw [antidiagonal_succ, prod_cons, prod_map]; rfl
#align finset.nat.prod_antidiagonal_succ Finset.Nat.prod_antidiagonal_succ
theorem sum_antidiagonal_succ {n : β} {f : β Γ β β N} :
(β p β antidiagonal (n + 1), f p) = f (0, n + 1) + β p β antidiagonal n, f (p.1 + 1, p.2) :=
@prod_antidiagonal_succ (Multiplicative N) _ _ _
#align finset.nat.sum_antidiagonal_succ Finset.Nat.sum_antidiagonal_succ
@[to_additive]
theorem prod_antidiagonal_swap {n : β} {f : β Γ β β M} :
β p β antidiagonal n, f p.swap = β p β antidiagonal n, f p := by
conv_lhs => rw [β map_swap_antidiagonal, Finset.prod_map]
rfl
#align finset.nat.prod_antidiagonal_swap Finset.Nat.prod_antidiagonal_swap
#align finset.nat.sum_antidiagonal_swap Finset.Nat.sum_antidiagonal_swap
| Mathlib/Algebra/BigOperators/NatAntidiagonal.lean | 42 | 45 | theorem prod_antidiagonal_succ' {n : β} {f : β Γ β β M} : (β p β antidiagonal (n + 1), f p) =
f (n + 1, 0) * β p β antidiagonal n, f (p.1, p.2 + 1) := by |
rw [β prod_antidiagonal_swap, prod_antidiagonal_succ, β prod_antidiagonal_swap]
rfl
| [
" β p β antidiagonal (n + 1), f p = f (0, n + 1) * β p β antidiagonal n, f (p.1 + 1, p.2)",
" f (0, n + 1) *\n β x β antidiagonal n,\n f (({ toFun := Nat.succ, inj' := Nat.succ_injective }.prodMap (Function.Embedding.refl β)) x) =\n f (0, n + 1) * β p β antidiagonal n, f (p.1 + 1, p.2)",
" β p β ... | [
" β p β antidiagonal (n + 1), f p = f (0, n + 1) * β p β antidiagonal n, f (p.1 + 1, p.2)",
" f (0, n + 1) *\n β x β antidiagonal n,\n f (({ toFun := Nat.succ, inj' := Nat.succ_injective }.prodMap (Function.Embedding.refl β)) x) =\n f (0, n + 1) * β p β antidiagonal n, f (p.1 + 1, p.2)",
" β p β ... |
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Option.Basic
import Mathlib.Data.List.Defs
import Mathlib.Init.Data.List.Basic
import Mathlib.Init.Data.List.Instances
import Mathlib.Init.Data.List.Lemmas
import Mathlib.Logic.Unique
import Mathlib.Order.Basic
import Mathlib.Tactic.Common
#align_import data.list.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
assert_not_exists Set.range
assert_not_exists GroupWithZero
assert_not_exists Ring
open Function
open Nat hiding one_pos
namespace List
universe u v w
variable {ΞΉ : Type*} {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {lβ lβ : List Ξ±}
-- Porting note: Delete this attribute
-- attribute [inline] List.head!
instance uniqueOfIsEmpty [IsEmpty Ξ±] : Unique (List Ξ±) :=
{ instInhabitedList with
uniq := fun l =>
match l with
| [] => rfl
| a :: _ => isEmptyElim a }
#align list.unique_of_is_empty List.uniqueOfIsEmpty
instance : Std.LawfulIdentity (Ξ± := List Ξ±) Append.append [] where
left_id := nil_append
right_id := append_nil
instance : Std.Associative (Ξ± := List Ξ±) Append.append where
assoc := append_assoc
#align list.cons_ne_nil List.cons_ne_nil
#align list.cons_ne_self List.cons_ne_self
#align list.head_eq_of_cons_eq List.head_eq_of_cons_eqβ -- implicits order
#align list.tail_eq_of_cons_eq List.tail_eq_of_cons_eqβ -- implicits order
@[simp] theorem cons_injective {a : Ξ±} : Injective (cons a) := fun _ _ => tail_eq_of_cons_eq
#align list.cons_injective List.cons_injective
#align list.cons_inj List.cons_inj
#align list.cons_eq_cons List.cons_eq_cons
theorem singleton_injective : Injective fun a : Ξ± => [a] := fun _ _ h => (cons_eq_cons.1 h).1
#align list.singleton_injective List.singleton_injective
theorem singleton_inj {a b : Ξ±} : [a] = [b] β a = b :=
singleton_injective.eq_iff
#align list.singleton_inj List.singleton_inj
#align list.exists_cons_of_ne_nil List.exists_cons_of_ne_nil
theorem set_of_mem_cons (l : List Ξ±) (a : Ξ±) : { x | x β a :: l } = insert a { x | x β l } :=
Set.ext fun _ => mem_cons
#align list.set_of_mem_cons List.set_of_mem_cons
#align list.mem_singleton_self List.mem_singleton_self
#align list.eq_of_mem_singleton List.eq_of_mem_singleton
#align list.mem_singleton List.mem_singleton
#align list.mem_of_mem_cons_of_mem List.mem_of_mem_cons_of_mem
theorem _root_.Decidable.List.eq_or_ne_mem_of_mem [DecidableEq Ξ±]
{a b : Ξ±} {l : List Ξ±} (h : a β b :: l) : a = b β¨ a β b β§ a β l := by
by_cases hab : a = b
Β· exact Or.inl hab
Β· exact ((List.mem_cons.1 h).elim Or.inl (fun h => Or.inr β¨hab, hβ©))
#align decidable.list.eq_or_ne_mem_of_mem Decidable.List.eq_or_ne_mem_of_mem
#align list.eq_or_ne_mem_of_mem List.eq_or_ne_mem_of_mem
#align list.not_mem_append List.not_mem_append
#align list.ne_nil_of_mem List.ne_nil_of_mem
lemma mem_pair {a b c : Ξ±} : a β [b, c] β a = b β¨ a = c := by
rw [mem_cons, mem_singleton]
@[deprecated (since := "2024-03-23")] alias mem_split := append_of_mem
#align list.mem_split List.append_of_mem
#align list.mem_of_ne_of_mem List.mem_of_ne_of_mem
#align list.ne_of_not_mem_cons List.ne_of_not_mem_cons
#align list.not_mem_of_not_mem_cons List.not_mem_of_not_mem_cons
#align list.not_mem_cons_of_ne_of_not_mem List.not_mem_cons_of_ne_of_not_mem
#align list.ne_and_not_mem_of_not_mem_cons List.ne_and_not_mem_of_not_mem_cons
#align list.mem_map List.mem_map
#align list.exists_of_mem_map List.exists_of_mem_map
#align list.mem_map_of_mem List.mem_map_of_memβ -- implicits order
-- The simpNF linter says that the LHS can be simplified via `List.mem_map`.
-- However this is a higher priority lemma.
-- https://github.com/leanprover/std4/issues/207
@[simp 1100, nolint simpNF]
theorem mem_map_of_injective {f : Ξ± β Ξ²} (H : Injective f) {a : Ξ±} {l : List Ξ±} :
f a β map f l β a β l :=
β¨fun m => let β¨_, m', eβ© := exists_of_mem_map m; H e βΈ m', mem_map_of_mem _β©
#align list.mem_map_of_injective List.mem_map_of_injective
@[simp]
theorem _root_.Function.Involutive.exists_mem_and_apply_eq_iff {f : Ξ± β Ξ±}
(hf : Function.Involutive f) (x : Ξ±) (l : List Ξ±) : (β y : Ξ±, y β l β§ f y = x) β f x β l :=
β¨by rintro β¨y, h, rflβ©; rwa [hf y], fun h => β¨f x, h, hf _β©β©
#align function.involutive.exists_mem_and_apply_eq_iff Function.Involutive.exists_mem_and_apply_eq_iff
| Mathlib/Data/List/Basic.lean | 137 | 138 | theorem mem_map_of_involutive {f : Ξ± β Ξ±} (hf : Involutive f) {a : Ξ±} {l : List Ξ±} :
a β map f l β f a β l := by | rw [mem_map, hf.exists_mem_and_apply_eq_iff]
| [
" a = b β¨ a β b β§ a β l",
" a β [b, c] β a = b β¨ a = c",
" (β y, y β l β§ f y = x) β f x β l",
" f (f y) β l",
" a β map f l β f a β l"
] | [
" a = b β¨ a β b β§ a β l",
" a β [b, c] β a = b β¨ a = c",
" (β y, y β l β§ f y = x) β f x β l",
" f (f y) β l",
" a β map f l β f a β l"
] |
import Mathlib.Data.Set.Prod
import Mathlib.Logic.Function.Conjugate
#align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207"
variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ : Sort*} {Ο : Ξ± β Type*}
open Equiv Equiv.Perm Function
namespace Set
section restrict
def restrict (s : Set Ξ±) (f : β a : Ξ±, Ο a) : β a : s, Ο a := fun x => f x
#align set.restrict Set.restrict
theorem restrict_eq (f : Ξ± β Ξ²) (s : Set Ξ±) : s.restrict f = f β Subtype.val :=
rfl
#align set.restrict_eq Set.restrict_eq
@[simp]
theorem restrict_apply (f : Ξ± β Ξ²) (s : Set Ξ±) (x : s) : s.restrict f x = f x :=
rfl
#align set.restrict_apply Set.restrict_apply
theorem restrict_eq_iff {f : β a, Ο a} {s : Set Ξ±} {g : β a : s, Ο a} :
restrict s f = g β β (a) (ha : a β s), f a = g β¨a, haβ© :=
funext_iff.trans Subtype.forall
#align set.restrict_eq_iff Set.restrict_eq_iff
theorem eq_restrict_iff {s : Set Ξ±} {f : β a : s, Ο a} {g : β a, Ο a} :
f = restrict s g β β (a) (ha : a β s), f β¨a, haβ© = g a :=
funext_iff.trans Subtype.forall
#align set.eq_restrict_iff Set.eq_restrict_iff
@[simp]
theorem range_restrict (f : Ξ± β Ξ²) (s : Set Ξ±) : Set.range (s.restrict f) = f '' s :=
(range_comp _ _).trans <| congr_arg (f '' Β·) Subtype.range_coe
#align set.range_restrict Set.range_restrict
theorem image_restrict (f : Ξ± β Ξ²) (s t : Set Ξ±) :
s.restrict f '' (Subtype.val β»ΒΉ' t) = f '' (t β© s) := by
rw [restrict_eq, image_comp, image_preimage_eq_inter_range, Subtype.range_coe]
#align set.image_restrict Set.image_restrict
@[simp]
theorem restrict_dite {s : Set Ξ±} [β x, Decidable (x β s)] (f : β a β s, Ξ²)
(g : β a β s, Ξ²) :
(s.restrict fun a => if h : a β s then f a h else g a h) = (fun a : s => f a a.2) :=
funext fun a => dif_pos a.2
#align set.restrict_dite Set.restrict_dite
@[simp]
theorem restrict_dite_compl {s : Set Ξ±} [β x, Decidable (x β s)] (f : β a β s, Ξ²)
(g : β a β s, Ξ²) :
(sαΆ.restrict fun a => if h : a β s then f a h else g a h) = (fun a : (sαΆ : Set Ξ±) => g a a.2) :=
funext fun a => dif_neg a.2
#align set.restrict_dite_compl Set.restrict_dite_compl
@[simp]
theorem restrict_ite (f g : Ξ± β Ξ²) (s : Set Ξ±) [β x, Decidable (x β s)] :
(s.restrict fun a => if a β s then f a else g a) = s.restrict f :=
restrict_dite _ _
#align set.restrict_ite Set.restrict_ite
@[simp]
theorem restrict_ite_compl (f g : Ξ± β Ξ²) (s : Set Ξ±) [β x, Decidable (x β s)] :
(sαΆ.restrict fun a => if a β s then f a else g a) = sαΆ.restrict g :=
restrict_dite_compl _ _
#align set.restrict_ite_compl Set.restrict_ite_compl
@[simp]
theorem restrict_piecewise (f g : Ξ± β Ξ²) (s : Set Ξ±) [β x, Decidable (x β s)] :
s.restrict (piecewise s f g) = s.restrict f :=
restrict_ite _ _ _
#align set.restrict_piecewise Set.restrict_piecewise
@[simp]
theorem restrict_piecewise_compl (f g : Ξ± β Ξ²) (s : Set Ξ±) [β x, Decidable (x β s)] :
sαΆ.restrict (piecewise s f g) = sαΆ.restrict g :=
restrict_ite_compl _ _ _
#align set.restrict_piecewise_compl Set.restrict_piecewise_compl
theorem restrict_extend_range (f : Ξ± β Ξ²) (g : Ξ± β Ξ³) (g' : Ξ² β Ξ³) :
(range f).restrict (extend f g g') = fun x => g x.coe_prop.choose := by
classical
exact restrict_dite _ _
#align set.restrict_extend_range Set.restrict_extend_range
@[simp]
theorem restrict_extend_compl_range (f : Ξ± β Ξ²) (g : Ξ± β Ξ³) (g' : Ξ² β Ξ³) :
(range f)αΆ.restrict (extend f g g') = g' β Subtype.val := by
classical
exact restrict_dite_compl _ _
#align set.restrict_extend_compl_range Set.restrict_extend_compl_range
theorem range_extend_subset (f : Ξ± β Ξ²) (g : Ξ± β Ξ³) (g' : Ξ² β Ξ³) :
range (extend f g g') β range g βͺ g' '' (range f)αΆ := by
classical
rintro _ β¨y, rflβ©
rw [extend_def]
split_ifs with h
exacts [Or.inl (mem_range_self _), Or.inr (mem_image_of_mem _ h)]
#align set.range_extend_subset Set.range_extend_subset
| Mathlib/Data/Set/Function.lean | 139 | 143 | theorem range_extend {f : Ξ± β Ξ²} (hf : Injective f) (g : Ξ± β Ξ³) (g' : Ξ² β Ξ³) :
range (extend f g g') = range g βͺ g' '' (range f)αΆ := by |
refine (range_extend_subset _ _ _).antisymm ?_
rintro z (β¨x, rflβ© | β¨y, hy, rflβ©)
exacts [β¨f x, hf.extend_apply _ _ _β©, β¨y, extend_apply' _ _ _ hyβ©]
| [
" s.restrict f '' (Subtype.val β»ΒΉ' t) = f '' (t β© s)",
" (range f).restrict (extend f g g') = fun x => g (Exists.choose β―)",
" (range f)αΆ.restrict (extend f g g') = g' β Subtype.val",
" range (extend f g g') β range g βͺ g' '' (range f)αΆ",
" extend f g g' y β range g βͺ g' '' (range f)αΆ",
" (if h : β a, f a... | [
" s.restrict f '' (Subtype.val β»ΒΉ' t) = f '' (t β© s)",
" (range f).restrict (extend f g g') = fun x => g (Exists.choose β―)",
" (range f)αΆ.restrict (extend f g g') = g' β Subtype.val",
" range (extend f g g') β range g βͺ g' '' (range f)αΆ",
" extend f g g' y β range g βͺ g' '' (range f)αΆ",
" (if h : β a, f a... |
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
#align_import data.prod.basic from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
@[simp]
theorem Prod.map_apply (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : Prod.map f g p = (f p.1, g p.2) := rfl
#align prod_map Prod.map_apply
@[deprecated (since := "2024-05-08")] alias Prod_map := Prod.map_apply
namespace Prod
@[simp]
theorem mk.eta : β {p : Ξ± Γ Ξ²}, (p.1, p.2) = p
| (_, _) => rfl
@[simp]
theorem Β«forallΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun h a b β¦ h (a, b), fun h β¨a, bβ© β¦ h a bβ©
#align prod.forall Prod.forall
@[simp]
theorem Β«existsΒ» {p : Ξ± Γ Ξ² β Prop} : (β x, p x) β β a b, p (a, b) :=
β¨fun β¨β¨a, bβ©, hβ© β¦ β¨a, b, hβ©, fun β¨a, b, hβ© β¦ β¨β¨a, bβ©, hβ©β©
#align prod.exists Prod.exists
theorem forall' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.forall
#align prod.forall' Prod.forall'
theorem exists' {p : Ξ± β Ξ² β Prop} : (β x : Ξ± Γ Ξ², p x.1 x.2) β β a b, p a b :=
Prod.exists
#align prod.exists' Prod.exists'
@[simp]
theorem snd_comp_mk (x : Ξ±) : Prod.snd β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = id :=
rfl
#align prod.snd_comp_mk Prod.snd_comp_mk
@[simp]
theorem fst_comp_mk (x : Ξ±) : Prod.fst β (Prod.mk x : Ξ² β Ξ± Γ Ξ²) = Function.const Ξ² x :=
rfl
#align prod.fst_comp_mk Prod.fst_comp_mk
@[simp, mfld_simps]
theorem map_mk (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (a : Ξ±) (b : Ξ²) : map f g (a, b) = (f a, g b) :=
rfl
#align prod.map_mk Prod.map_mk
theorem map_fst (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).1 = f p.1 :=
rfl
#align prod.map_fst Prod.map_fst
theorem map_snd (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) (p : Ξ± Γ Ξ²) : (map f g p).2 = g p.2 :=
rfl
#align prod.map_snd Prod.map_snd
theorem map_fst' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.fst β map f g = f β Prod.fst :=
funext <| map_fst f g
#align prod.map_fst' Prod.map_fst'
theorem map_snd' (f : Ξ± β Ξ³) (g : Ξ² β Ξ΄) : Prod.snd β map f g = g β Prod.snd :=
funext <| map_snd f g
#align prod.map_snd' Prod.map_snd'
theorem map_comp_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) :
Prod.map g g' β Prod.map f f' = Prod.map (g β f) (g' β f') :=
rfl
#align prod.map_comp_map Prod.map_comp_map
theorem map_map {Ξ΅ ΞΆ : Type*} (f : Ξ± β Ξ²) (f' : Ξ³ β Ξ΄) (g : Ξ² β Ξ΅) (g' : Ξ΄ β ΞΆ) (x : Ξ± Γ Ξ³) :
Prod.map g g' (Prod.map f f' x) = Prod.map (g β f) (g' β f') x :=
rfl
#align prod.map_map Prod.map_map
-- Porting note: mathlib3 proof uses `by cc` for the mpr direction
-- Porting note: `@[simp]` tag removed because auto-generated `mk.injEq` simplifies LHS
-- @[simp]
theorem mk.inj_iff {aβ aβ : Ξ±} {bβ bβ : Ξ²} : (aβ, bβ) = (aβ, bβ) β aβ = aβ β§ bβ = bβ :=
Iff.of_eq (mk.injEq _ _ _ _)
#align prod.mk.inj_iff Prod.mk.inj_iff
theorem mk.inj_left {Ξ± Ξ² : Type*} (a : Ξ±) : Function.Injective (Prod.mk a : Ξ² β Ξ± Γ Ξ²) := by
intro bβ bβ h
simpa only [true_and, Prod.mk.inj_iff, eq_self_iff_true] using h
#align prod.mk.inj_left Prod.mk.inj_left
theorem mk.inj_right {Ξ± Ξ² : Type*} (b : Ξ²) :
Function.Injective (fun a β¦ Prod.mk a b : Ξ± β Ξ± Γ Ξ²) := by
intro bβ bβ h
simpa only [and_true, eq_self_iff_true, mk.inj_iff] using h
#align prod.mk.inj_right Prod.mk.inj_right
lemma mk_inj_left {a : Ξ±} {bβ bβ : Ξ²} : (a, bβ) = (a, bβ) β bβ = bβ := (mk.inj_left _).eq_iff
#align prod.mk_inj_left Prod.mk_inj_left
lemma mk_inj_right {aβ aβ : Ξ±} {b : Ξ²} : (aβ, b) = (aβ, b) β aβ = aβ := (mk.inj_right _).eq_iff
#align prod.mk_inj_right Prod.mk_inj_right
| Mathlib/Data/Prod/Basic.lean | 122 | 123 | theorem ext_iff {p q : Ξ± Γ Ξ²} : p = q β p.1 = q.1 β§ p.2 = q.2 := by |
rw [mk.inj_iff]
| [
" Function.Injective (mk a)",
" bβ = bβ",
" Function.Injective fun a => (a, b)",
" p = q β p.fst = q.fst β§ p.snd = q.snd"
] | [
" Function.Injective (mk a)",
" bβ = bβ",
" Function.Injective fun a => (a, b)",
" p = q β p.fst = q.fst β§ p.snd = q.snd"
] |
import Mathlib.Data.Finsupp.Basic
import Mathlib.Data.Finsupp.Order
#align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Finset
variable {Ξ± Ξ² ΞΉ : Type*}
namespace Finsupp
def toMultiset : (Ξ± ββ β) β+ Multiset Ξ± where
toFun f := Finsupp.sum f fun a n => n β’ {a}
-- Porting note: times out if h is not specified
map_add' _f _g := sum_add_index' (h := fun a n => n β’ ({a} : Multiset Ξ±))
(fun _ β¦ zero_nsmul _) (fun _ β¦ add_nsmul _)
map_zero' := sum_zero_index
theorem toMultiset_zero : toMultiset (0 : Ξ± ββ β) = 0 :=
rfl
#align finsupp.to_multiset_zero Finsupp.toMultiset_zero
theorem toMultiset_add (m n : Ξ± ββ β) : toMultiset (m + n) = toMultiset m + toMultiset n :=
toMultiset.map_add m n
#align finsupp.to_multiset_add Finsupp.toMultiset_add
theorem toMultiset_apply (f : Ξ± ββ β) : toMultiset f = f.sum fun a n => n β’ {a} :=
rfl
#align finsupp.to_multiset_apply Finsupp.toMultiset_apply
@[simp]
theorem toMultiset_single (a : Ξ±) (n : β) : toMultiset (single a n) = n β’ {a} := by
rw [toMultiset_apply, sum_single_index]; apply zero_nsmul
#align finsupp.to_multiset_single Finsupp.toMultiset_single
theorem toMultiset_sum {f : ΞΉ β Ξ± ββ β} (s : Finset ΞΉ) :
Finsupp.toMultiset (β i β s, f i) = β i β s, Finsupp.toMultiset (f i) :=
map_sum Finsupp.toMultiset _ _
#align finsupp.to_multiset_sum Finsupp.toMultiset_sum
| Mathlib/Data/Finsupp/Multiset.lean | 61 | 63 | theorem toMultiset_sum_single (s : Finset ΞΉ) (n : β) :
Finsupp.toMultiset (β i β s, single i n) = n β’ s.val := by |
simp_rw [toMultiset_sum, Finsupp.toMultiset_single, sum_nsmul, sum_multiset_singleton]
| [
" toMultiset (single a n) = n β’ {a}",
" 0 β’ {a} = 0",
" toMultiset (β i β s, single i n) = n β’ s.val"
] | [
" toMultiset (single a n) = n β’ {a}",
" 0 β’ {a} = 0",
" toMultiset (β i β s, single i n) = n β’ s.val"
] |
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {Ο Ο : Type*} {r : R} {e : β} {n m : Ο} {s : Ο ββ β}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial Ο R}
section Vars
def vars (p : MvPolynomial Ο R) : Finset Ο :=
letI := Classical.decEq Ο
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq Ο] (p : MvPolynomial Ο R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial Ο R).vars = β
:= by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r β 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial Ο R).vars = β
:= by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial Ο R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' β)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : Ο) : i β p.vars β β d β p.support, i β d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial Ο R} {x : Ο ββ β} (H : x β f.support)
{v : Ο} (h : v β vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr β¨x, H, Finsupp.mem_support_iff.mpr hβ©
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq Ο] (p q : MvPolynomial Ο R) :
(p + q).vars β p.vars βͺ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx β’
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
| Mathlib/Algebra/MvPolynomial/Variables.lean | 115 | 119 | theorem vars_add_of_disjoint [DecidableEq Ο] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars βͺ q.vars := by |
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx β’
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
| [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = β
",
" ((monomial s) r).vars = s.support",
" (C r).vars = β
",
" (X n).vars = {n}",
" i β p.vars β β d β p.support, i β d.support",
" x v = 0",
" v β f.vars",
" (p + q).vars β p.vars βͺ q.vars",
" x β p.vars βͺ q.... | [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = β
",
" ((monomial s) r).vars = s.support",
" (C r).vars = β
",
" (X n).vars = {n}",
" i β p.vars β β d β p.support, i β d.support",
" x v = 0",
" v β f.vars",
" (p + q).vars β p.vars βͺ q.vars",
" x β p.vars βͺ q.... |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
theorem Ici_add_bij : BijOn (Β· + d) (Ici a) (Ici (a + d)) := by
refine
β¨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_β©
obtain β¨c, rflβ© := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact β¨a + c, h, by rw [add_right_comm]β©
#align set.Ici_add_bij Set.Ici_add_bij
theorem Ioi_add_bij : BijOn (Β· + d) (Ioi a) (Ioi (a + d)) := by
refine
β¨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h =>
?_β©
obtain β¨c, rflβ© := exists_add_of_le (mem_Ioi.mp h).le
rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h
exact β¨a + c, h, by rw [add_right_comm]β©
#align set.Ioi_add_bij Set.Ioi_add_bij
theorem Icc_add_bij : BijOn (Β· + d) (Icc a b) (Icc (a + d) (b + d)) := by
rw [β Ici_inter_Iic, β Ici_inter_Iic]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Icc_add_bij Set.Icc_add_bij
theorem Ioo_add_bij : BijOn (Β· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by
rw [β Ioi_inter_Iio, β Ioi_inter_Iio]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ioo_add_bij Set.Ioo_add_bij
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 58 | 62 | theorem Ioc_add_bij : BijOn (Β· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by |
rw [β Ioi_inter_Iic, β Ioi_inter_Iic]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
| [
" BijOn (fun x => x + d) (Ici a) (Ici (a + d))",
" xβ β (fun x => x + d) '' Ici a",
" a + d + c β (fun x => x + d) '' Ici a",
" (fun x => x + d) (a + c) = a + d + c",
" BijOn (fun x => x + d) (Ioi a) (Ioi (a + d))",
" xβ β (fun x => x + d) '' Ioi a",
" a + d + c β (fun x => x + d) '' Ioi a",
" BijOn (... | [
" BijOn (fun x => x + d) (Ici a) (Ici (a + d))",
" xβ β (fun x => x + d) '' Ici a",
" a + d + c β (fun x => x + d) '' Ici a",
" (fun x => x + d) (a + c) = a + d + c",
" BijOn (fun x => x + d) (Ioi a) (Ioi (a + d))",
" xβ β (fun x => x + d) '' Ioi a",
" a + d + c β (fun x => x + d) '' Ioi a",
" BijOn (... |
import Mathlib.Data.DFinsupp.Basic
import Mathlib.Data.Finset.Pointwise
import Mathlib.LinearAlgebra.Basis.VectorSpace
#align_import algebra.group.unique_prods from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
@[to_additive
"Let `G` be a Type with addition, let `A B : Finset G` be finite subsets and
let `a0 b0 : G` be two elements. `UniqueAdd A B a0 b0` asserts `a0 + b0` can be written in at
most one way as a sum of an element from `A` and an element from `B`."]
def UniqueMul {G} [Mul G] (A B : Finset G) (a0 b0 : G) : Prop :=
β β¦a bβ¦, a β A β b β B β a * b = a0 * b0 β a = a0 β§ b = b0
#align unique_mul UniqueMul
#align unique_add UniqueAdd
namespace UniqueMul
variable {G H : Type*} [Mul G] [Mul H] {A B : Finset G} {a0 b0 : G}
@[to_additive (attr := nontriviality, simp)]
| Mathlib/Algebra/Group/UniqueProds.lean | 67 | 68 | theorem of_subsingleton [Subsingleton G] : UniqueMul A B a0 b0 := by |
simp [UniqueMul, eq_iff_true_of_subsingleton]
| [
" UniqueMul A B a0 b0"
] | [
" UniqueMul A B a0 b0"
] |
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Tactic.ByContra
import Mathlib.Topology.Algebra.Polynomial
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Analysis.Complex.Arg
#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
namespace Polynomial
open Finset Nat
@[simp]
theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : β} [hn : Fact p.Prime] :
eval 1 (cyclotomic p R) = p := by
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum,
Finset.card_range, smul_one_eq_cast]
#align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime
-- @[simp] -- Porting note (#10618): simp already proves this
theorem evalβ_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R β+* S) {p : β}
[Fact p.Prime] : evalβ f 1 (cyclotomic p R) = p := by simp
#align polynomial.evalβ_one_cyclotomic_prime Polynomial.evalβ_one_cyclotomic_prime
@[simp]
theorem eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : β} (k : β)
[hn : Fact p.Prime] : eval 1 (cyclotomic (p ^ (k + 1)) R) = p := by
simp only [cyclotomic_prime_pow_eq_geom_sum hn.out, eval_X, one_pow, Finset.sum_const, eval_pow,
eval_finset_sum, Finset.card_range, smul_one_eq_cast]
#align polynomial.eval_one_cyclotomic_prime_pow Polynomial.eval_one_cyclotomic_prime_pow
-- @[simp] -- Porting note (#10618): simp already proves this
theorem evalβ_one_cyclotomic_prime_pow {R S : Type*} [CommRing R] [Semiring S] (f : R β+* S)
{p : β} (k : β) [Fact p.Prime] : evalβ f 1 (cyclotomic (p ^ (k + 1)) R) = p := by simp
#align polynomial.evalβ_one_cyclotomic_prime_pow Polynomial.evalβ_one_cyclotomic_prime_pow
private theorem cyclotomic_neg_one_pos {n : β} (hn : 2 < n) {R} [LinearOrderedCommRing R] :
0 < eval (-1 : R) (cyclotomic n R) := by
haveI := NeZero.of_gt hn
rw [β map_cyclotomic_int, β Int.cast_one, β Int.cast_neg, eval_intCast_map, Int.coe_castRingHom,
Int.cast_pos]
suffices 0 < eval (β(-1 : β€)) (cyclotomic n β) by
rw [β map_cyclotomic_int n β, eval_intCast_map, Int.coe_castRingHom] at this
simpa only [Int.cast_pos] using this
simp only [Int.cast_one, Int.cast_neg]
have h0 := cyclotomic_coeff_zero β hn.le
rw [coeff_zero_eq_eval_zero] at h0
by_contra! hx
have := intermediate_value_univ (-1) 0 (cyclotomic n β).continuous
obtain β¨y, hy : IsRoot _ yβ© := this (show (0 : β) β Set.Icc _ _ by simpa [h0] using hx)
rw [@isRoot_cyclotomic_iff] at hy
rw [hy.eq_orderOf] at hn
exact hn.not_le LinearOrderedRing.orderOf_le_two
| Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean | 70 | 111 | theorem cyclotomic_pos {n : β} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x : R) :
0 < eval x (cyclotomic n R) := by |
induction' n using Nat.strong_induction_on with n ih
have hn' : 0 < n := pos_of_gt hn
have hn'' : 1 < n := one_lt_two.trans hn
have := prod_cyclotomic_eq_geom_sum hn' R
apply_fun eval x at this
rw [β cons_self_properDivisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons,
eval_mul, eval_geom_sum] at this
rcases lt_trichotomy 0 (β i β Finset.range n, x ^ i) with (h | h | h)
Β· apply pos_of_mul_pos_left
Β· rwa [this]
rw [eval_prod]
refine Finset.prod_nonneg fun i hi => ?_
simp only [Finset.mem_erase, mem_properDivisors] at hi
rw [geom_sum_pos_iff hn'.ne'] at h
cases' h with hk hx
Β· refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 ?_)).le <;> rintro rfl
Β· exact hn'.ne' (zero_dvd_iff.mp hi.2.1)
Β· exact even_iff_not_odd.mp (even_iff_two_dvd.mpr hi.2.1) hk
Β· rcases eq_or_ne i 2 with (rfl | hk)
Β· simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using hx.le
refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 hk)).le
rintro rfl
exact hn'.ne' <| zero_dvd_iff.mp hi.2.1
Β· rw [eq_comm, geom_sum_eq_zero_iff_neg_one hn'.ne'] at h
exact h.1.symm βΈ cyclotomic_neg_one_pos hn
Β· apply pos_of_mul_neg_left
Β· rwa [this]
rw [geom_sum_neg_iff hn'.ne'] at h
have h2 : 2 β n.properDivisors.erase 1 := by
rw [Finset.mem_erase, mem_properDivisors]
exact β¨by decide, even_iff_two_dvd.mp h.1, hnβ©
rw [eval_prod, β Finset.prod_erase_mul _ _ h2]
apply mul_nonpos_of_nonneg_of_nonpos
Β· refine Finset.prod_nonneg fun i hi => le_of_lt ?_
simp only [Finset.mem_erase, mem_properDivisors] at hi
refine ih _ hi.2.2.2 (Nat.two_lt_of_ne ?_ hi.2.1 hi.1)
rintro rfl
rw [zero_dvd_iff] at hi
exact hn'.ne' hi.2.2.1
Β· simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using h.right.le
| [
" eval 1 (cyclotomic p R) = βp",
" evalβ f 1 (cyclotomic p R) = βp",
" eval 1 (cyclotomic (p ^ (k + 1)) R) = βp",
" evalβ f 1 (cyclotomic (p ^ (k + 1)) R) = βp",
" 0 < eval (-1) (cyclotomic n R)",
" 0 < eval (β(-1)) (cyclotomic n β€)",
" 0 < eval (β(-1)) (cyclotomic n β)",
" 0 < eval (-1) (cyclotomic n... | [
" eval 1 (cyclotomic p R) = βp",
" evalβ f 1 (cyclotomic p R) = βp",
" eval 1 (cyclotomic (p ^ (k + 1)) R) = βp",
" evalβ f 1 (cyclotomic (p ^ (k + 1)) R) = βp",
" 0 < eval (-1) (cyclotomic n R)",
" 0 < eval (β(-1)) (cyclotomic n β€)",
" 0 < eval (β(-1)) (cyclotomic n β)",
" 0 < eval (-1) (cyclotomic n... |
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Functor.EpiMono
#align_import category_theory.adjunction.evaluation from "leanprover-community/mathlib"@"937c692d73f5130c7fecd3fd32e81419f4e04eb7"
namespace CategoryTheory
open CategoryTheory.Limits
universe vβ vβ uβ uβ
variable {C : Type uβ} [Category.{vβ} C] (D : Type uβ) [Category.{vβ} D]
noncomputable section
section
variable [β a b : C, HasCoproductsOfShape (a βΆ b) D]
@[simps]
def evaluationLeftAdjoint (c : C) : D β₯€ C β₯€ D where
obj d :=
{ obj := fun t => β fun _ : c βΆ t => d
map := fun f => Sigma.desc fun g => (Sigma.ΞΉ fun _ => d) <| g β« f}
map {_ dβ} f :=
{ app := fun e => Sigma.desc fun h => f β« Sigma.ΞΉ (fun _ => dβ) h
naturality := by
intros
dsimp
ext
simp }
#align category_theory.evaluation_left_adjoint CategoryTheory.evaluationLeftAdjoint
@[simps! unit_app counit_app_app]
def evaluationAdjunctionRight (c : C) : evaluationLeftAdjoint D c β£ (evaluation _ _).obj c :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun d F =>
{ toFun := fun f => Sigma.ΞΉ (fun _ => d) (π _) β« f.app c
invFun := fun f =>
{ app := fun e => Sigma.desc fun h => f β« F.map h
naturality := by
intros
dsimp
ext
simp }
left_inv := by
intro f
ext x
dsimp
ext g
simp only [colimit.ΞΉ_desc, Cofan.mk_ΞΉ_app, Category.assoc, β f.naturality,
evaluationLeftAdjoint_obj_map, colimit.ΞΉ_desc_assoc,
Discrete.functor_obj, Cofan.mk_pt, Discrete.natTrans_app, Category.id_comp]
right_inv := fun f => by
dsimp
simp }
-- This used to be automatic before leanprover/lean4#2644
homEquiv_naturality_right := by intros; dsimp; simp }
#align category_theory.evaluation_adjunction_right CategoryTheory.evaluationAdjunctionRight
instance evaluationIsRightAdjoint (c : C) : ((evaluation _ D).obj c).IsRightAdjoint :=
β¨_, β¨evaluationAdjunctionRight _ _β©β©
#align category_theory.evaluation_is_right_adjoint CategoryTheory.evaluationIsRightAdjoint
theorem NatTrans.mono_iff_mono_app {F G : C β₯€ D} (Ξ· : F βΆ G) : Mono Ξ· β β c, Mono (Ξ·.app c) := by
constructor
Β· intro h c
exact (inferInstance : Mono (((evaluation _ _).obj c).map Ξ·))
Β· intro _
apply NatTrans.mono_of_mono_app
#align category_theory.nat_trans.mono_iff_mono_app CategoryTheory.NatTrans.mono_iff_mono_app
end
section
variable [β a b : C, HasProductsOfShape (a βΆ b) D]
@[simps]
def evaluationRightAdjoint (c : C) : D β₯€ C β₯€ D where
obj d :=
{ obj := fun t => βαΆ fun _ : t βΆ c => d
map := fun f => Pi.lift fun g => Pi.Ο _ <| f β« g }
map f :=
{ app := fun t => Pi.lift fun g => Pi.Ο _ g β« f
naturality := by
intros
dsimp
ext
simp }
#align category_theory.evaluation_right_adjoint CategoryTheory.evaluationRightAdjoint
@[simps! unit_app_app counit_app]
def evaluationAdjunctionLeft (c : C) : (evaluation _ _).obj c β£ evaluationRightAdjoint D c :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun F d =>
{ toFun := fun f =>
{ app := fun t => Pi.lift fun g => F.map g β« f
naturality := by
intros
dsimp
ext
simp }
invFun := fun f => f.app _ β« Pi.Ο _ (π _)
left_inv := fun f => by
dsimp
simp
right_inv := by
intro f
ext x
dsimp
ext g
simp only [Discrete.functor_obj, NatTrans.naturality_assoc,
evaluationRightAdjoint_obj_obj, evaluationRightAdjoint_obj_map, limit.lift_Ο,
Fan.mk_pt, Fan.mk_Ο_app, Discrete.natTrans_app, Category.comp_id] } }
#align category_theory.evaluation_adjunction_left CategoryTheory.evaluationAdjunctionLeft
instance evaluationIsLeftAdjoint (c : C) : ((evaluation _ D).obj c).IsLeftAdjoint :=
β¨_, β¨evaluationAdjunctionLeft _ _β©β©
#align category_theory.evaluation_is_left_adjoint CategoryTheory.evaluationIsLeftAdjoint
| Mathlib/CategoryTheory/Adjunction/Evaluation.lean | 140 | 145 | theorem NatTrans.epi_iff_epi_app {F G : C β₯€ D} (Ξ· : F βΆ G) : Epi Ξ· β β c, Epi (Ξ·.app c) := by |
constructor
Β· intro h c
exact (inferInstance : Epi (((evaluation _ _).obj c).map Ξ·))
Β· intros
apply NatTrans.epi_of_epi_app
| [
" β β¦X Y : Cβ¦ (f_1 : X βΆ Y),\n ((fun d =>\n { obj := fun t => β fun x => d, map := fun {X Y} f => Sigma.desc fun g => Sigma.ΞΉ (fun x => d) (g β« f),\n map_id := β―, map_comp := β― })\n xβ).map\n f_1 β«\n (fun e => Sigma.desc fun h => f β« Sigma.ΞΉ (fun x => ... | [
" β β¦X Y : Cβ¦ (f_1 : X βΆ Y),\n ((fun d =>\n { obj := fun t => β fun x => d, map := fun {X Y} f => Sigma.desc fun g => Sigma.ΞΉ (fun x => d) (g β« f),\n map_id := β―, map_comp := β― })\n xβ).map\n f_1 β«\n (fun e => Sigma.desc fun h => f β« Sigma.ΞΉ (fun x => ... |
import Mathlib.Algebra.ContinuedFractions.ContinuantsRecurrence
import Mathlib.Algebra.ContinuedFractions.TerminatedStable
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Ring
#align_import algebra.continued_fractions.convergents_equiv from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
variable {K : Type*} {n : β}
namespace GeneralizedContinuedFraction
variable {g : GeneralizedContinuedFraction K} {s : Stream'.Seq <| Pair K}
section Squash
section WithDivisionRing
variable [DivisionRing K]
def squashSeq (s : Stream'.Seq <| Pair K) (n : β) : Stream'.Seq (Pair K) :=
match Prod.mk (s.get? n) (s.get? (n + 1)) with
| β¨some gp_n, some gp_succ_nβ© =>
Stream'.Seq.nats.zipWith
-- return the squashed value at position `n`; otherwise, do nothing.
(fun n' gp => if n' = n then β¨gp_n.a, gp_n.b + gp_succ_n.a / gp_succ_n.bβ© else gp) s
| _ => s
#align generalized_continued_fraction.squash_seq GeneralizedContinuedFraction.squashSeq
theorem squashSeq_eq_self_of_terminated (terminated_at_succ_n : s.TerminatedAt (n + 1)) :
squashSeq s n = s := by
change s.get? (n + 1) = none at terminated_at_succ_n
cases s_nth_eq : s.get? n <;> simp only [*, squashSeq]
#align generalized_continued_fraction.squash_seq_eq_self_of_terminated GeneralizedContinuedFraction.squashSeq_eq_self_of_terminated
theorem squashSeq_nth_of_not_terminated {gp_n gp_succ_n : Pair K} (s_nth_eq : s.get? n = some gp_n)
(s_succ_nth_eq : s.get? (n + 1) = some gp_succ_n) :
(squashSeq s n).get? n = some β¨gp_n.a, gp_n.b + gp_succ_n.a / gp_succ_n.bβ© := by
simp [*, squashSeq]
#align generalized_continued_fraction.squash_seq_nth_of_not_terminated GeneralizedContinuedFraction.squashSeq_nth_of_not_terminated
theorem squashSeq_nth_of_lt {m : β} (m_lt_n : m < n) : (squashSeq s n).get? m = s.get? m := by
cases s_succ_nth_eq : s.get? (n + 1) with
| none => rw [squashSeq_eq_self_of_terminated s_succ_nth_eq]
| some =>
obtain β¨gp_n, s_nth_eqβ© : β gp_n, s.get? n = some gp_n :=
s.ge_stable n.le_succ s_succ_nth_eq
obtain β¨gp_m, s_mth_eqβ© : β gp_m, s.get? m = some gp_m :=
s.ge_stable (le_of_lt m_lt_n) s_nth_eq
simp [*, squashSeq, m_lt_n.ne]
#align generalized_continued_fraction.squash_seq_nth_of_lt GeneralizedContinuedFraction.squashSeq_nth_of_lt
theorem squashSeq_succ_n_tail_eq_squashSeq_tail_n :
(squashSeq s (n + 1)).tail = squashSeq s.tail n := by
cases s_succ_succ_nth_eq : s.get? (n + 2) with
| none =>
cases s_succ_nth_eq : s.get? (n + 1) <;>
simp only [squashSeq, Stream'.Seq.get?_tail, s_succ_nth_eq, s_succ_succ_nth_eq]
| some gp_succ_succ_n =>
obtain β¨gp_succ_n, s_succ_nth_eqβ© : β gp_succ_n, s.get? (n + 1) = some gp_succ_n :=
s.ge_stable (n + 1).le_succ s_succ_succ_nth_eq
-- apply extensionality with `m` and continue by cases `m = n`.
ext1 m
cases' Decidable.em (m = n) with m_eq_n m_ne_n
Β· simp [*, squashSeq]
Β· cases s_succ_mth_eq : s.get? (m + 1)
Β· simp only [*, squashSeq, Stream'.Seq.get?_tail, Stream'.Seq.get?_zipWith,
Option.mapβ_none_right]
Β· simp [*, squashSeq]
#align generalized_continued_fraction.squash_seq_succ_n_tail_eq_squash_seq_tail_n GeneralizedContinuedFraction.squashSeq_succ_n_tail_eq_squashSeq_tail_n
| Mathlib/Algebra/ContinuedFractions/ConvergentsEquiv.lean | 155 | 181 | theorem succ_succ_nth_convergent'_aux_eq_succ_nth_convergent'_aux_squashSeq :
convergents'Aux s (n + 2) = convergents'Aux (squashSeq s n) (n + 1) := by |
cases s_succ_nth_eq : s.get? <| n + 1 with
| none =>
rw [squashSeq_eq_self_of_terminated s_succ_nth_eq,
convergents'Aux_stable_step_of_terminated s_succ_nth_eq]
| some gp_succ_n =>
induction n generalizing s gp_succ_n with
| zero =>
obtain β¨gp_head, s_head_eqβ© : β gp_head, s.head = some gp_head :=
s.ge_stable zero_le_one s_succ_nth_eq
have : (squashSeq s 0).head = some β¨gp_head.a, gp_head.b + gp_succ_n.a / gp_succ_n.bβ© :=
squashSeq_nth_of_not_terminated s_head_eq s_succ_nth_eq
simp_all [convergents'Aux, Stream'.Seq.head, Stream'.Seq.get?_tail]
| succ m IH =>
obtain β¨gp_head, s_head_eqβ© : β gp_head, s.head = some gp_head :=
s.ge_stable (m + 2).zero_le s_succ_nth_eq
suffices
gp_head.a / (gp_head.b + convergents'Aux s.tail (m + 2)) =
convergents'Aux (squashSeq s (m + 1)) (m + 2)
by simpa only [convergents'Aux, s_head_eq]
have : convergents'Aux s.tail (m + 2) = convergents'Aux (squashSeq s.tail m) (m + 1) := by
refine IH gp_succ_n ?_
simpa [Stream'.Seq.get?_tail] using s_succ_nth_eq
have : (squashSeq s (m + 1)).head = some gp_head :=
(squashSeq_nth_of_lt m.succ_pos).trans s_head_eq
simp_all [convergents'Aux, squashSeq_succ_n_tail_eq_squashSeq_tail_n]
| [
" squashSeq s n = s",
" (squashSeq s n).get? n = some { a := gp_n.a, b := gp_n.b + gp_succ_n.a / gp_succ_n.b }",
" (squashSeq s n).get? m = s.get? m",
" (squashSeq s (n + 1)).tail = squashSeq s.tail n",
" (squashSeq s (n + 1)).tail.get? m = (squashSeq s.tail n).get? m",
" convergents'Aux s (n + 2) = conve... | [
" squashSeq s n = s",
" (squashSeq s n).get? n = some { a := gp_n.a, b := gp_n.b + gp_succ_n.a / gp_succ_n.b }",
" (squashSeq s n).get? m = s.get? m",
" (squashSeq s (n + 1)).tail = squashSeq s.tail n",
" (squashSeq s (n + 1)).tail.get? m = (squashSeq s.tail n).get? m",
" convergents'Aux s (n + 2) = conve... |
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.Eval
#align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd"
namespace Polynomial
open Polynomial Finsupp Finset
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] {f : R[X]}
def revAtFun (N i : β) : β :=
ite (i β€ N) (N - i) i
#align polynomial.rev_at_fun Polynomial.revAtFun
theorem revAtFun_invol {N i : β} : revAtFun N (revAtFun N i) = i := by
unfold revAtFun
split_ifs with h j
Β· exact tsub_tsub_cancel_of_le h
Β· exfalso
apply j
exact Nat.sub_le N i
Β· rfl
#align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol
| Mathlib/Algebra/Polynomial/Reverse.lean | 50 | 52 | theorem revAtFun_inj {N : β} : Function.Injective (revAtFun N) := by |
intro a b hab
rw [β @revAtFun_invol N a, hab, revAtFun_invol]
| [
" revAtFun N (revAtFun N i) = i",
" (if (if i β€ N then N - i else i) β€ N then N - if i β€ N then N - i else i else if i β€ N then N - i else i) = i",
" N - (N - i) = i",
" N - i = i",
" False",
" N - i β€ N",
" i = i",
" Function.Injective (revAtFun N)",
" a = b"
] | [
" revAtFun N (revAtFun N i) = i",
" (if (if i β€ N then N - i else i) β€ N then N - if i β€ N then N - i else i else if i β€ N then N - i else i) = i",
" N - (N - i) = i",
" N - i = i",
" False",
" N - i β€ N",
" i = i",
" Function.Injective (revAtFun N)"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.