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 220 |
|---|---|---|---|---|---|---|---|
import Mathlib.Analysis.Fourier.AddCircle
import Mathlib.Analysis.Fourier.FourierTransform
import Mathlib.Analysis.PSeries
import Mathlib.Analysis.Distribution.SchwartzSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
#align_import analysis.fourier.poisson_summation from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Function hiding comp_apply
open Set hiding restrict_apply
open Complex hiding abs_of_nonneg
open Real
open TopologicalSpace Filter MeasureTheory Asymptotics
open scoped Real Filter FourierTransform
open ContinuousMap
theorem Real.fourierCoeff_tsum_comp_add {f : C(ℝ, ℂ)}
(hf : ∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp (ContinuousMap.addRight n)).restrict K‖)
(m : ℤ) : fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m = 𝓕 f m := by
-- NB: This proof can be shortened somewhat by telescoping together some of the steps in the calc
-- block, but I think it's more legible this way. We start with preliminaries about the integrand.
let e : C(ℝ, ℂ) := (fourier (-m)).comp ⟨((↑) : ℝ → UnitAddCircle), continuous_quotient_mk'⟩
have neK : ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖(e * g).restrict K‖ = ‖g.restrict K‖ := by
have (x : ℝ) : ‖e x‖ = 1 := abs_coe_circle (AddCircle.toCircle (-m • x))
intro K g
simp_rw [norm_eq_iSup_norm, restrict_apply, mul_apply, norm_mul, this, one_mul]
have eadd : ∀ (n : ℤ), e.comp (ContinuousMap.addRight n) = e := by
intro n; ext1 x
have : Periodic e 1 := Periodic.comp (fun x => AddCircle.coe_add_period 1 x) (fourier (-m))
simpa only [mul_one] using this.int_mul n x
-- Now the main argument. First unwind some definitions.
calc
fourierCoeff (Periodic.lift <| f.periodic_tsum_comp_add_zsmul 1) m =
∫ x in (0 : ℝ)..1, e x * (∑' n : ℤ, f.comp (ContinuousMap.addRight n)) x := by
simp_rw [fourierCoeff_eq_intervalIntegral _ m 0, div_one, one_smul, zero_add, e, comp_apply,
coe_mk, Periodic.lift_coe, zsmul_one, smul_eq_mul]
-- Transform sum in C(ℝ, ℂ) evaluated at x into pointwise sum of values.
_ = ∫ x in (0:ℝ)..1, ∑' n : ℤ, (e * f.comp (ContinuousMap.addRight n)) x := by
simp_rw [coe_mul, Pi.mul_apply,
← ContinuousMap.tsum_apply (summable_of_locally_summable_norm hf), tsum_mul_left]
-- Swap sum and integral.
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f.comp (ContinuousMap.addRight n)) x := by
refine (intervalIntegral.tsum_intervalIntegral_eq_of_summable_norm ?_).symm
convert hf ⟨uIcc 0 1, isCompact_uIcc⟩ using 1
exact funext fun n => neK _ _
_ = ∑' n : ℤ, ∫ x in (0:ℝ)..1, (e * f).comp (ContinuousMap.addRight n) x := by
simp only [ContinuousMap.comp_apply, mul_comp] at eadd ⊢
simp_rw [eadd]
-- Rearrange sum of interval integrals into an integral over `ℝ`.
_ = ∫ x, e x * f x := by
suffices Integrable (e * f) from this.hasSum_intervalIntegral_comp_add_int.tsum_eq
apply integrable_of_summable_norm_Icc
convert hf ⟨Icc 0 1, isCompact_Icc⟩ using 1
simp_rw [mul_comp] at eadd ⊢
simp_rw [eadd]
exact funext fun n => neK ⟨Icc 0 1, isCompact_Icc⟩ _
-- Minor tidying to finish
_ = 𝓕 f m := by
rw [fourierIntegral_real_eq_integral_exp_smul]
congr 1 with x : 1
rw [smul_eq_mul, comp_apply, coe_mk, coe_mk, ContinuousMap.toFun_eq_coe, fourier_coe_apply]
congr 2
push_cast
ring
#align real.fourier_coeff_tsum_comp_add Real.fourierCoeff_tsum_comp_add
theorem Real.tsum_eq_tsum_fourierIntegral {f : C(ℝ, ℂ)}
(h_norm :
∀ K : Compacts ℝ, Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict K‖)
(h_sum : Summable fun n : ℤ => 𝓕 f n) (x : ℝ) :
∑' n : ℤ, f (x + n) = ∑' n : ℤ, 𝓕 f n * fourier n (x : UnitAddCircle) := by
let F : C(UnitAddCircle, ℂ) :=
⟨(f.periodic_tsum_comp_add_zsmul 1).lift, continuous_coinduced_dom.mpr (map_continuous _)⟩
have : Summable (fourierCoeff F) := by
convert h_sum
exact Real.fourierCoeff_tsum_comp_add h_norm _
convert (has_pointwise_sum_fourier_series_of_summable this x).tsum_eq.symm using 1
· simpa only [F, coe_mk, ← QuotientAddGroup.mk_zero, Periodic.lift_coe, zsmul_one, comp_apply,
coe_addRight, zero_add]
using (hasSum_apply (summable_of_locally_summable_norm h_norm).hasSum x).tsum_eq
· simp_rw [← Real.fourierCoeff_tsum_comp_add h_norm, smul_eq_mul, F, coe_mk]
#align real.tsum_eq_tsum_fourier_integral Real.tsum_eq_tsum_fourierIntegral
section RpowDecay
variable {E : Type*} [NormedAddCommGroup E]
| Mathlib/Analysis/Fourier/PoissonSummation.lean | 131 | 157 | theorem isBigO_norm_Icc_restrict_atTop {f : C(ℝ, E)} {b : ℝ} (hb : 0 < b)
(hf : f =O[atTop] fun x : ℝ => |x| ^ (-b)) (R S : ℝ) :
(fun x : ℝ => ‖f.restrict (Icc (x + R) (x + S))‖) =O[atTop] fun x : ℝ => |x| ^ (-b) := by |
-- First establish an explicit estimate on decay of inverse powers.
-- This is logically independent of the rest of the proof, but of no mathematical interest in
-- itself, so it is proved in-line rather than being formulated as a separate lemma.
have claim : ∀ x : ℝ, max 0 (-2 * R) < x → ∀ y : ℝ, x + R ≤ y →
y ^ (-b) ≤ (1 / 2) ^ (-b) * x ^ (-b) := fun x hx y hy ↦ by
rw [max_lt_iff] at hx
obtain ⟨hx1, hx2⟩ := hx
rw [← mul_rpow] <;> try positivity
apply rpow_le_rpow_of_nonpos <;> linarith
-- Now the main proof.
obtain ⟨c, hc, hc'⟩ := hf.exists_pos
simp only [IsBigO, IsBigOWith, eventually_atTop] at hc' ⊢
obtain ⟨d, hd⟩ := hc'
refine ⟨c * (1 / 2) ^ (-b), ⟨max (1 + max 0 (-2 * R)) (d - R), fun x hx => ?_⟩⟩
rw [ge_iff_le, max_le_iff] at hx
have hx' : max 0 (-2 * R) < x := by linarith
rw [max_lt_iff] at hx'
rw [norm_norm, ContinuousMap.norm_le _ (by positivity)]
refine fun y => (hd y.1 (by linarith [hx.1, y.2.1])).trans ?_
have A : ∀ x : ℝ, 0 ≤ |x| ^ (-b) := fun x => by positivity
rw [mul_assoc, mul_le_mul_left hc, norm_of_nonneg (A _), norm_of_nonneg (A _)]
convert claim x (by linarith only [hx.1]) y.1 y.2.1
· apply abs_of_nonneg; linarith [y.2.1]
· exact abs_of_pos hx'.1
| [
" fourierCoeff ⋯.lift m = 𝓕 ⇑f ↑m",
" ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖",
" ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖",
" ∀ (n : ℤ), e.comp (ContinuousMap.addRight ↑n) = e",
" e.comp (ContinuousMap.addRigh... | [
" fourierCoeff ⋯.lift m = 𝓕 ⇑f ↑m",
" ∀ (K : Compacts ℝ) (g : C(ℝ, ℂ)), ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖",
" ‖ContinuousMap.restrict (↑K) (e * g)‖ = ‖ContinuousMap.restrict (↑K) g‖",
" ∀ (n : ℤ), e.comp (ContinuousMap.addRight ↑n) = e",
" e.comp (ContinuousMap.addRigh... |
import Mathlib.Data.ENNReal.Inv
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
section Real
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
theorem toReal_add (ha : a ≠ ∞) (hb : b ≠ ∞) : (a + b).toReal = a.toReal + b.toReal := by
lift a to ℝ≥0 using ha
lift b to ℝ≥0 using hb
rfl
#align ennreal.to_real_add ENNReal.toReal_add
theorem toReal_sub_of_le {a b : ℝ≥0∞} (h : b ≤ a) (ha : a ≠ ∞) :
(a - b).toReal = a.toReal - b.toReal := by
lift b to ℝ≥0 using ne_top_of_le_ne_top ha h
lift a to ℝ≥0 using ha
simp only [← ENNReal.coe_sub, ENNReal.coe_toReal, NNReal.coe_sub (ENNReal.coe_le_coe.mp h)]
#align ennreal.to_real_sub_of_le ENNReal.toReal_sub_of_le
theorem le_toReal_sub {a b : ℝ≥0∞} (hb : b ≠ ∞) : a.toReal - b.toReal ≤ (a - b).toReal := by
lift b to ℝ≥0 using hb
induction a
· simp
· simp only [← coe_sub, NNReal.sub_def, Real.coe_toNNReal', coe_toReal]
exact le_max_left _ _
#align ennreal.le_to_real_sub ENNReal.le_toReal_sub
theorem toReal_add_le : (a + b).toReal ≤ a.toReal + b.toReal :=
if ha : a = ∞ then by simp only [ha, top_add, top_toReal, zero_add, toReal_nonneg]
else
if hb : b = ∞ then by simp only [hb, add_top, top_toReal, add_zero, toReal_nonneg]
else le_of_eq (toReal_add ha hb)
#align ennreal.to_real_add_le ENNReal.toReal_add_le
theorem ofReal_add {p q : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) :
ENNReal.ofReal (p + q) = ENNReal.ofReal p + ENNReal.ofReal q := by
rw [ENNReal.ofReal, ENNReal.ofReal, ENNReal.ofReal, ← coe_add, coe_inj,
Real.toNNReal_add hp hq]
#align ennreal.of_real_add ENNReal.ofReal_add
theorem ofReal_add_le {p q : ℝ} : ENNReal.ofReal (p + q) ≤ ENNReal.ofReal p + ENNReal.ofReal q :=
coe_le_coe.2 Real.toNNReal_add_le
#align ennreal.of_real_add_le ENNReal.ofReal_add_le
@[simp]
theorem toReal_le_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal ≤ b.toReal ↔ a ≤ b := by
lift a to ℝ≥0 using ha
lift b to ℝ≥0 using hb
norm_cast
#align ennreal.to_real_le_to_real ENNReal.toReal_le_toReal
@[gcongr]
theorem toReal_mono (hb : b ≠ ∞) (h : a ≤ b) : a.toReal ≤ b.toReal :=
(toReal_le_toReal (ne_top_of_le_ne_top hb h) hb).2 h
#align ennreal.to_real_mono ENNReal.toReal_mono
-- Porting note (#10756): new lemma
theorem toReal_mono' (h : a ≤ b) (ht : b = ∞ → a = ∞) : a.toReal ≤ b.toReal := by
rcases eq_or_ne a ∞ with rfl | ha
· exact toReal_nonneg
· exact toReal_mono (mt ht ha) h
@[simp]
| Mathlib/Data/ENNReal/Real.lean | 94 | 97 | theorem toReal_lt_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal < b.toReal ↔ a < b := by |
lift a to ℝ≥0 using ha
lift b to ℝ≥0 using hb
norm_cast
| [
" (a + b).toReal = a.toReal + b.toReal",
" (↑a + b).toReal = (↑a).toReal + b.toReal",
" (↑a + ↑b).toReal = (↑a).toReal + (↑b).toReal",
" (a - b).toReal = a.toReal - b.toReal",
" (a - ↑b).toReal = a.toReal - (↑b).toReal",
" (↑a - ↑b).toReal = (↑a).toReal - (↑b).toReal",
" a.toReal - b.toReal ≤ (a - b).to... | [
" (a + b).toReal = a.toReal + b.toReal",
" (↑a + b).toReal = (↑a).toReal + b.toReal",
" (↑a + ↑b).toReal = (↑a).toReal + (↑b).toReal",
" (a - b).toReal = a.toReal - b.toReal",
" (a - ↑b).toReal = a.toReal - (↑b).toReal",
" (↑a - ↑b).toReal = (↑a).toReal - (↑b).toReal",
" a.toReal - b.toReal ≤ (a - b).to... |
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.CliffordAlgebra.Even
import Mathlib.LinearAlgebra.QuadraticForm.Prod
import Mathlib.Tactic.LiftLets
#align_import linear_algebra.clifford_algebra.even_equiv from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace CliffordAlgebra
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable (Q : QuadraticForm R M)
namespace EquivEven
abbrev Q' : QuadraticForm R (M × R) :=
Q.prod <| -@QuadraticForm.sq R _
set_option linter.uppercaseLean3 false in
#align clifford_algebra.equiv_even.Q' CliffordAlgebra.EquivEven.Q'
theorem Q'_apply (m : M × R) : Q' Q m = Q m.1 - m.2 * m.2 :=
(sub_eq_add_neg _ _).symm
set_option linter.uppercaseLean3 false in
#align clifford_algebra.equiv_even.Q'_apply CliffordAlgebra.EquivEven.Q'_apply
def e0 : CliffordAlgebra (Q' Q) :=
ι (Q' Q) (0, 1)
#align clifford_algebra.equiv_even.e0 CliffordAlgebra.EquivEven.e0
def v : M →ₗ[R] CliffordAlgebra (Q' Q) :=
ι (Q' Q) ∘ₗ LinearMap.inl _ _ _
#align clifford_algebra.equiv_even.v CliffordAlgebra.EquivEven.v
theorem ι_eq_v_add_smul_e0 (m : M) (r : R) : ι (Q' Q) (m, r) = v Q m + r • e0 Q := by
rw [e0, v, LinearMap.comp_apply, LinearMap.inl_apply, ← LinearMap.map_smul, Prod.smul_mk,
smul_zero, smul_eq_mul, mul_one, ← LinearMap.map_add, Prod.mk_add_mk, zero_add, add_zero]
#align clifford_algebra.equiv_even.ι_eq_v_add_smul_e0 CliffordAlgebra.EquivEven.ι_eq_v_add_smul_e0
theorem e0_mul_e0 : e0 Q * e0 Q = -1 :=
(ι_sq_scalar _ _).trans <| by simp
#align clifford_algebra.equiv_even.e0_mul_e0 CliffordAlgebra.EquivEven.e0_mul_e0
theorem v_sq_scalar (m : M) : v Q m * v Q m = algebraMap _ _ (Q m) :=
(ι_sq_scalar _ _).trans <| by simp
#align clifford_algebra.equiv_even.v_sq_scalar CliffordAlgebra.EquivEven.v_sq_scalar
| Mathlib/LinearAlgebra/CliffordAlgebra/EvenEquiv.lean | 82 | 86 | theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by |
refine neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans ?_)
dsimp [QuadraticForm.polar]
simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
add_sub_cancel_right, sub_self, map_zero, zero_sub]
| [
" (ι (Q' Q)) (m, r) = (v Q) m + r • e0 Q",
" (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) (0, 1)) = -1",
" (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) ((LinearMap.inl R M R) m)) =\n (algebraMap R (CliffordAlgebra (Q' Q))) (Q m)",
" -(e0 Q * (v Q) m) = (v Q) m * e0 Q",
" (algebraMap R (CliffordAlge... | [
" (ι (Q' Q)) (m, r) = (v Q) m + r • e0 Q",
" (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) (0, 1)) = -1",
" (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) ((LinearMap.inl R M R) m)) =\n (algebraMap R (CliffordAlgebra (Q' Q))) (Q m)"
] |
import Mathlib.Data.ENNReal.Inv
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
section iInf
variable {ι : Sort*} {f g : ι → ℝ≥0∞}
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by
cases isEmpty_or_nonempty ι
· rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty]
· lift f to ι → ℝ≥0 using hf
simp_rw [← coe_iInf, toNNReal_coe]
#align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf
theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf)
#align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf
theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by
lift f to ι → ℝ≥0 using hf
simp_rw [toNNReal_coe]
by_cases h : BddAbove (range f)
· rw [← coe_iSup h, toNNReal_coe]
· rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal]
#align ennreal.to_nnreal_supr ENNReal.toNNReal_iSup
theorem toNNReal_sSup (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sSup s).toNNReal = sSup (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sSup_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sSup_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iSup hf)
#align ennreal.to_nnreal_Sup ENNReal.toNNReal_sSup
theorem toReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toReal = ⨅ i, (f i).toReal := by
simp only [ENNReal.toReal, toNNReal_iInf hf, NNReal.coe_iInf]
#align ennreal.to_real_infi ENNReal.toReal_iInf
theorem toReal_sInf (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toReal = sInf (ENNReal.toReal '' s) := by
simp only [ENNReal.toReal, toNNReal_sInf s hf, NNReal.coe_sInf, Set.image_image]
#align ennreal.to_real_Inf ENNReal.toReal_sInf
theorem toReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toReal = ⨆ i, (f i).toReal := by
simp only [ENNReal.toReal, toNNReal_iSup hf, NNReal.coe_iSup]
#align ennreal.to_real_supr ENNReal.toReal_iSup
| Mathlib/Data/ENNReal/Real.lean | 585 | 587 | theorem toReal_sSup (s : Set ℝ≥0∞) (hf : ∀ r ∈ s, r ≠ ∞) :
(sSup s).toReal = sSup (ENNReal.toReal '' s) := by |
simp only [ENNReal.toReal, toNNReal_sSup s hf, NNReal.coe_sSup, Set.image_image]
| [
" (iInf f).toNNReal = ⨅ i, (f i).toNNReal",
" (⨅ i, ↑(f i)).toNNReal = ⨅ i, ((fun i => ↑(f i)) i).toNNReal",
" (sInf s).toNNReal = sInf (ENNReal.toNNReal '' s)",
" (iSup f).toNNReal = ⨆ i, (f i).toNNReal",
" (⨆ i, ↑(f i)).toNNReal = ⨆ i, ((fun i => ↑(f i)) i).toNNReal",
" (⨆ i, ↑(f i)).toNNReal = ⨆ i, f i... | [
" (iInf f).toNNReal = ⨅ i, (f i).toNNReal",
" (⨅ i, ↑(f i)).toNNReal = ⨅ i, ((fun i => ↑(f i)) i).toNNReal",
" (sInf s).toNNReal = sInf (ENNReal.toNNReal '' s)",
" (iSup f).toNNReal = ⨆ i, (f i).toNNReal",
" (⨆ i, ↑(f i)).toNNReal = ⨆ i, ((fun i => ↑(f i)) i).toNNReal",
" (⨆ i, ↑(f i)).toNNReal = ⨆ i, f i... |
import Mathlib.Dynamics.BirkhoffSum.Basic
import Mathlib.Algebra.Module.Basic
open Finset
section birkhoffAverage
variable (R : Type*) {α M : Type*} [DivisionSemiring R] [AddCommMonoid M] [Module R M]
def birkhoffAverage (f : α → α) (g : α → M) (n : ℕ) (x : α) : M := (n : R)⁻¹ • birkhoffSum f g n x
theorem birkhoffAverage_zero (f : α → α) (g : α → M) (x : α) :
birkhoffAverage R f g 0 x = 0 := by simp [birkhoffAverage]
@[simp] theorem birkhoffAverage_zero' (f : α → α) (g : α → M) : birkhoffAverage R f g 0 = 0 :=
funext <| birkhoffAverage_zero _ _ _
theorem birkhoffAverage_one (f : α → α) (g : α → M) (x : α) :
birkhoffAverage R f g 1 x = g x := by simp [birkhoffAverage]
@[simp]
theorem birkhoffAverage_one' (f : α → α) (g : α → M) : birkhoffAverage R f g 1 = g :=
funext <| birkhoffAverage_one R f g
| Mathlib/Dynamics/BirkhoffSum/Average.lean | 57 | 61 | theorem map_birkhoffAverage (S : Type*) {F N : Type*}
[DivisionSemiring S] [AddCommMonoid N] [Module S N] [FunLike F M N]
[AddMonoidHomClass F M N] (g' : F) (f : α → α) (g : α → M) (n : ℕ) (x : α) :
g' (birkhoffAverage R f g n x) = birkhoffAverage S f (g' ∘ g) n x := by |
simp only [birkhoffAverage, map_inv_natCast_smul g' R S, map_birkhoffSum]
| [
" birkhoffAverage R f g 0 x = 0",
" birkhoffAverage R f g 1 x = g x",
" g' (birkhoffAverage R f g n x) = birkhoffAverage S f (⇑g' ∘ g) n x"
] | [
" birkhoffAverage R f g 0 x = 0",
" birkhoffAverage R f g 1 x = g x"
] |
import Mathlib.Topology.Order.IsLUB
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {α β γ : Type*}
section DenselyOrdered
variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α}
{s : Set α}
theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
· rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
#align closure_Ioi' closure_Ioi'
@[simp]
theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
#align closure_Ioi closure_Ioi
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (α := αᵒᵈ) h
#align closure_Iio' closure_Iio'
@[simp]
theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
#align closure_Iio closure_Iio
@[simp]
theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
· cases' hab.lt_or_lt with hab hab
· rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩
· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
#align closure_Ioo closure_Ioo
@[simp]
theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
#align closure_Ioc closure_Ioc
@[simp]
theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
#align closure_Ico closure_Ico
@[simp]
| Mathlib/Topology/Order/DenselyOrdered.lean | 83 | 84 | theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by |
rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
| [
" closure (Ioi a) = Ici a",
" closure (Ioi a) ⊆ Ici a",
" Ici a ⊆ closure (Ioi a)",
" a ∈ closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) ⊆ Icc a b",
" Icc a b ⊆ closure (Ioo a b)",
" {a, b} ⊆ closure (Ioo a b)",
" a ∈ closure (Ioo a b) ∧ b ∈ closure (Ioo a b)",
" ∅ ⊆ closure... | [
" closure (Ioi a) = Ici a",
" closure (Ioi a) ⊆ Ici a",
" Ici a ⊆ closure (Ioi a)",
" a ∈ closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) ⊆ Icc a b",
" Icc a b ⊆ closure (Ioo a b)",
" {a, b} ⊆ closure (Ioo a b)",
" a ∈ closure (Ioo a b) ∧ b ∈ closure (Ioo a b)",
" ∅ ⊆ closure... |
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c"
variable {ι : Type*} [Fintype ι]
variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R)
variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤)
open Polynomial Matrix
def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M :=
(LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap
#align pi_to_module.from_matrix PiToModule.fromMatrix
theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) :
PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) :=
rfl
#align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply
theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) :
PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by
rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single]
simp_rw [mul_one]
#align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one
def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M :=
LinearMap.lcomp _ _ (Fintype.total R R b)
#align pi_to_module.from_End PiToModule.fromEnd
theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) :
PiToModule.fromEnd R b f w = f (Fintype.total R R b w) :=
rfl
#align pi_to_module.from_End_apply PiToModule.fromEnd_apply
theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) :
PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by
rw [PiToModule.fromEnd_apply]
congr
convert Fintype.total_apply_single (S := R) R b i (1 : R)
rw [one_smul]
#align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one
| Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean | 68 | 75 | theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) :
Function.Injective (PiToModule.fromEnd R b) := by |
intro x y e
ext m
obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by
rw [(Fintype.range_total R b).trans hb]
exact Submodule.mem_top
exact (LinearMap.congr_fun e m : _)
| [
" ((fromMatrix R b) A) (Pi.single j 1) = ∑ i : ι, A i j • b i",
" ∑ i : ι, (fun i => A i j * 1) i • b i = ∑ i : ι, A i j • b i",
" ((fromEnd R b) f) (Pi.single i 1) = f (b i)",
" f (((Fintype.total R R) b) (Pi.single i 1)) = f (b i)",
" ((Fintype.total R R) b) (Pi.single i 1) = b i",
" b i = 1 • b i",
"... | [
" ((fromMatrix R b) A) (Pi.single j 1) = ∑ i : ι, A i j • b i",
" ∑ i : ι, (fun i => A i j * 1) i • b i = ∑ i : ι, A i j • b i",
" ((fromEnd R b) f) (Pi.single i 1) = f (b i)",
" f (((Fintype.total R R) b) (Pi.single i 1)) = f (b i)",
" ((Fintype.total R R) b) (Pi.single i 1) = b i",
" b i = 1 • b i"
] |
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Fintype.BigOperators
#align_import data.sign from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
-- Porting note (#11081): cannot automatically derive Fintype, added manually
inductive SignType
| zero
| neg
| pos
deriving DecidableEq, Inhabited
#align sign_type SignType
-- Porting note: these lemmas are autogenerated by the inductive definition and are not
-- in simple form due to the below `x_eq_x` lemmas
attribute [nolint simpNF] SignType.zero.sizeOf_spec
attribute [nolint simpNF] SignType.neg.sizeOf_spec
attribute [nolint simpNF] SignType.pos.sizeOf_spec
namespace SignType
-- Porting note: Added Fintype SignType manually
instance : Fintype SignType :=
Fintype.ofMultiset (zero :: neg :: pos :: List.nil) (fun x ↦ by cases x <;> simp)
instance : Zero SignType :=
⟨zero⟩
instance : One SignType :=
⟨pos⟩
instance : Neg SignType :=
⟨fun s =>
match s with
| neg => pos
| zero => zero
| pos => neg⟩
@[simp]
theorem zero_eq_zero : zero = 0 :=
rfl
#align sign_type.zero_eq_zero SignType.zero_eq_zero
@[simp]
theorem neg_eq_neg_one : neg = -1 :=
rfl
#align sign_type.neg_eq_neg_one SignType.neg_eq_neg_one
@[simp]
theorem pos_eq_one : pos = 1 :=
rfl
#align sign_type.pos_eq_one SignType.pos_eq_one
instance : Mul SignType :=
⟨fun x y =>
match x with
| neg => -y
| zero => zero
| pos => y⟩
protected inductive LE : SignType → SignType → Prop
| of_neg (a) : SignType.LE neg a
| zero : SignType.LE zero zero
| of_pos (a) : SignType.LE a pos
#align sign_type.le SignType.LE
instance : LE SignType :=
⟨SignType.LE⟩
instance LE.decidableRel : DecidableRel SignType.LE := fun a b => by
cases a <;> cases b <;> first | exact isTrue (by constructor)| exact isFalse (by rintro ⟨_⟩)
instance decidableEq : DecidableEq SignType := fun a b => by
cases a <;> cases b <;> first | exact isTrue (by constructor)| exact isFalse (by rintro ⟨_⟩)
private lemma mul_comm : ∀ (a b : SignType), a * b = b * a := by rintro ⟨⟩ ⟨⟩ <;> rfl
private lemma mul_assoc : ∀ (a b c : SignType), (a * b) * c = a * (b * c) := by
rintro ⟨⟩ ⟨⟩ ⟨⟩ <;> rfl
instance : CommGroupWithZero SignType where
zero := 0
one := 1
mul := (· * ·)
inv := id
mul_zero a := by cases a <;> rfl
zero_mul a := by cases a <;> rfl
mul_one a := by cases a <;> rfl
one_mul a := by cases a <;> rfl
mul_inv_cancel a ha := by cases a <;> trivial
mul_comm := mul_comm
mul_assoc := mul_assoc
exists_pair_ne := ⟨0, 1, by rintro ⟨_⟩⟩
inv_zero := rfl
private lemma le_antisymm (a b : SignType) (_ : a ≤ b) (_: b ≤ a) : a = b := by
cases a <;> cases b <;> trivial
private lemma le_trans (a b c : SignType) (_ : a ≤ b) (_: b ≤ c) : a ≤ c := by
cases a <;> cases b <;> cases c <;> tauto
instance : LinearOrder SignType where
le := (· ≤ ·)
le_refl a := by cases a <;> constructor
le_total a b := by cases a <;> cases b <;> first | left; constructor | right; constructor
le_antisymm := le_antisymm
le_trans := le_trans
decidableLE := LE.decidableRel
decidableEq := SignType.decidableEq
instance : BoundedOrder SignType where
top := 1
le_top := LE.of_pos
bot := -1
bot_le := LE.of_neg
instance : HasDistribNeg SignType :=
{ neg_neg := fun x => by cases x <;> rfl
neg_mul := fun x y => by cases x <;> cases y <;> rfl
mul_neg := fun x y => by cases x <;> cases y <;> rfl }
def fin3Equiv : SignType ≃* Fin 3 where
toFun a :=
match a with
| 0 => ⟨0, by simp⟩
| 1 => ⟨1, by simp⟩
| -1 => ⟨2, by simp⟩
invFun a :=
match a with
| ⟨0, _⟩ => 0
| ⟨1, _⟩ => 1
| ⟨2, _⟩ => -1
left_inv a := by cases a <;> rfl
right_inv a :=
match a with
| ⟨0, _⟩ => by simp
| ⟨1, _⟩ => by simp
| ⟨2, _⟩ => by simp
map_mul' a b := by
cases a <;> cases b <;> rfl
#align sign_type.fin3_equiv SignType.fin3Equiv
section CaseBashing
-- Porting note: a lot of these thms used to use decide! which is not implemented yet
theorem nonneg_iff {a : SignType} : 0 ≤ a ↔ a = 0 ∨ a = 1 := by cases a <;> decide
#align sign_type.nonneg_iff SignType.nonneg_iff
theorem nonneg_iff_ne_neg_one {a : SignType} : 0 ≤ a ↔ a ≠ -1 := by cases a <;> decide
#align sign_type.nonneg_iff_ne_neg_one SignType.nonneg_iff_ne_neg_one
theorem neg_one_lt_iff {a : SignType} : -1 < a ↔ 0 ≤ a := by cases a <;> decide
#align sign_type.neg_one_lt_iff SignType.neg_one_lt_iff
| Mathlib/Data/Sign.lean | 171 | 171 | theorem nonpos_iff {a : SignType} : a ≤ 0 ↔ a = -1 ∨ a = 0 := by | cases a <;> decide
| [
" x ∈ ↑[zero, neg, pos]",
" zero ∈ ↑[zero, neg, pos]",
" neg ∈ ↑[zero, neg, pos]",
" pos ∈ ↑[zero, neg, pos]",
" Decidable (a.LE b)",
" Decidable (SignType.zero.LE b)",
" Decidable (neg.LE b)",
" Decidable (pos.LE b)",
" Decidable (SignType.zero.LE SignType.zero)",
" SignType.zero.LE SignType.zero... | [
" x ∈ ↑[zero, neg, pos]",
" zero ∈ ↑[zero, neg, pos]",
" neg ∈ ↑[zero, neg, pos]",
" pos ∈ ↑[zero, neg, pos]",
" Decidable (a.LE b)",
" Decidable (SignType.zero.LE b)",
" Decidable (neg.LE b)",
" Decidable (pos.LE b)",
" Decidable (SignType.zero.LE SignType.zero)",
" SignType.zero.LE SignType.zero... |
import Mathlib.Topology.ContinuousFunction.Basic
#align_import topology.continuous_function.cocompact_map from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
universe u v w
open Filter Set
structure CocompactMap (α : Type u) (β : Type v) [TopologicalSpace α] [TopologicalSpace β] extends
ContinuousMap α β : Type max u v where
cocompact_tendsto' : Tendsto toFun (cocompact α) (cocompact β)
#align cocompact_map CocompactMap
section
class CocompactMapClass (F : Type*) (α β : outParam Type*) [TopologicalSpace α]
[TopologicalSpace β] [FunLike F α β] extends ContinuousMapClass F α β : Prop where
cocompact_tendsto (f : F) : Tendsto f (cocompact α) (cocompact β)
#align cocompact_map_class CocompactMapClass
end
export CocompactMapClass (cocompact_tendsto)
namespace CocompactMap
section Basics
variable {α β γ δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ]
[TopologicalSpace δ]
instance : FunLike (CocompactMap α β) α β where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : CocompactMapClass (CocompactMap α β) α β where
map_continuous f := f.continuous_toFun
cocompact_tendsto f := f.cocompact_tendsto'
@[simp]
theorem coe_toContinuousMap {f : CocompactMap α β} : (f.toContinuousMap : α → β) = f :=
rfl
#align cocompact_map.coe_to_continuous_fun CocompactMap.coe_toContinuousMap
@[ext]
theorem ext {f g : CocompactMap α β} (h : ∀ x, f x = g x) : f = g :=
DFunLike.ext _ _ h
#align cocompact_map.ext CocompactMap.ext
protected def copy (f : CocompactMap α β) (f' : α → β) (h : f' = f) : CocompactMap α β where
toFun := f'
continuous_toFun := by
rw [h]
exact f.continuous_toFun
cocompact_tendsto' := by
simp_rw [h]
exact f.cocompact_tendsto'
#align cocompact_map.copy CocompactMap.copy
@[simp]
theorem coe_copy (f : CocompactMap α β) (f' : α → β) (h : f' = f) : ⇑(f.copy f' h) = f' :=
rfl
#align cocompact_map.coe_copy CocompactMap.coe_copy
theorem copy_eq (f : CocompactMap α β) (f' : α → β) (h : f' = f) : f.copy f' h = f :=
DFunLike.ext' h
#align cocompact_map.copy_eq CocompactMap.copy_eq
@[simp]
theorem coe_mk (f : C(α, β)) (h : Tendsto f (cocompact α) (cocompact β)) :
⇑(⟨f, h⟩ : CocompactMap α β) = f :=
rfl
#align cocompact_map.coe_mk CocompactMap.coe_mk
section
variable (α)
protected def id : CocompactMap α α :=
⟨ContinuousMap.id _, tendsto_id⟩
#align cocompact_map.id CocompactMap.id
@[simp]
theorem coe_id : ⇑(CocompactMap.id α) = id :=
rfl
#align cocompact_map.coe_id CocompactMap.coe_id
end
instance : Inhabited (CocompactMap α α) :=
⟨CocompactMap.id α⟩
def comp (f : CocompactMap β γ) (g : CocompactMap α β) : CocompactMap α γ :=
⟨f.toContinuousMap.comp g, (cocompact_tendsto f).comp (cocompact_tendsto g)⟩
#align cocompact_map.comp CocompactMap.comp
@[simp]
theorem coe_comp (f : CocompactMap β γ) (g : CocompactMap α β) : ⇑(comp f g) = f ∘ g :=
rfl
#align cocompact_map.coe_comp CocompactMap.coe_comp
@[simp]
theorem comp_apply (f : CocompactMap β γ) (g : CocompactMap α β) (a : α) : comp f g a = f (g a) :=
rfl
#align cocompact_map.comp_apply CocompactMap.comp_apply
@[simp]
theorem comp_assoc (f : CocompactMap γ δ) (g : CocompactMap β γ) (h : CocompactMap α β) :
(f.comp g).comp h = f.comp (g.comp h) :=
rfl
#align cocompact_map.comp_assoc CocompactMap.comp_assoc
@[simp]
theorem id_comp (f : CocompactMap α β) : (CocompactMap.id _).comp f = f :=
ext fun _ => rfl
#align cocompact_map.id_comp CocompactMap.id_comp
@[simp]
theorem comp_id (f : CocompactMap α β) : f.comp (CocompactMap.id _) = f :=
ext fun _ => rfl
#align cocompact_map.comp_id CocompactMap.comp_id
theorem tendsto_of_forall_preimage {f : α → β} (h : ∀ s, IsCompact s → IsCompact (f ⁻¹' s)) :
Tendsto f (cocompact α) (cocompact β) := fun s hs =>
match mem_cocompact.mp hs with
| ⟨t, ht, hts⟩ =>
mem_map.mpr (mem_cocompact.mpr ⟨f ⁻¹' t, h t ht, by simpa using preimage_mono hts⟩)
#align cocompact_map.tendsto_of_forall_preimage CocompactMap.tendsto_of_forall_preimage
| Mathlib/Topology/ContinuousFunction/CocompactMap.lean | 185 | 195 | theorem isCompact_preimage [T2Space β] (f : CocompactMap α β) ⦃s : Set β⦄ (hs : IsCompact s) :
IsCompact (f ⁻¹' s) := by |
obtain ⟨t, ht, hts⟩ :=
mem_cocompact'.mp
(by
simpa only [preimage_image_preimage, preimage_compl] using
mem_map.mp
(cocompact_tendsto f <|
mem_cocompact.mpr ⟨s, hs, compl_subset_compl.mpr (image_preimage_subset f _)⟩))
exact
ht.of_isClosed_subset (hs.isClosed.preimage <| map_continuous f) (by simpa using hts)
| [
" f = g",
" { toFun := toFun✝, continuous_toFun := continuous_toFun✝, cocompact_tendsto' := cocompact_tendsto'✝ } = g",
" { toFun := toFun✝¹, continuous_toFun := continuous_toFun✝¹, cocompact_tendsto' := cocompact_tendsto'✝¹ } =\n { toFun := toFun✝, continuous_toFun := continuous_toFun✝, cocompact_tendsto' :... | [
" f = g",
" { toFun := toFun✝, continuous_toFun := continuous_toFun✝, cocompact_tendsto' := cocompact_tendsto'✝ } = g",
" { toFun := toFun✝¹, continuous_toFun := continuous_toFun✝¹, cocompact_tendsto' := cocompact_tendsto'✝¹ } =\n { toFun := toFun✝, continuous_toFun := continuous_toFun✝, cocompact_tendsto' :... |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.LinearAlgebra.Vandermonde
import Mathlib.RingTheory.Polynomial.Basic
#align_import linear_algebra.lagrange from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Polynomial
section PolynomialDetermination
namespace Polynomial
variable {R : Type*} [CommRing R] [IsDomain R] {f g : R[X]}
section Finset
open Function Fintype
variable (s : Finset R)
theorem eq_zero_of_degree_lt_of_eval_finset_eq_zero (degree_f_lt : f.degree < s.card)
(eval_f : ∀ x ∈ s, f.eval x = 0) : f = 0 := by
rw [← mem_degreeLT] at degree_f_lt
simp_rw [eval_eq_sum_degreeLTEquiv degree_f_lt] at eval_f
rw [← degreeLTEquiv_eq_zero_iff_eq_zero degree_f_lt]
exact
Matrix.eq_zero_of_forall_index_sum_mul_pow_eq_zero
(Injective.comp (Embedding.subtype _).inj' (equivFinOfCardEq (card_coe _)).symm.injective)
fun _ => eval_f _ (Finset.coe_mem _)
#align polynomial.eq_zero_of_degree_lt_of_eval_finset_eq_zero Polynomial.eq_zero_of_degree_lt_of_eval_finset_eq_zero
theorem eq_of_degree_sub_lt_of_eval_finset_eq (degree_fg_lt : (f - g).degree < s.card)
(eval_fg : ∀ x ∈ s, f.eval x = g.eval x) : f = g := by
rw [← sub_eq_zero]
refine eq_zero_of_degree_lt_of_eval_finset_eq_zero _ degree_fg_lt ?_
simp_rw [eval_sub, sub_eq_zero]
exact eval_fg
#align polynomial.eq_of_degree_sub_lt_of_eval_finset_eq Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq
| Mathlib/LinearAlgebra/Lagrange.lean | 63 | 67 | theorem eq_of_degrees_lt_of_eval_finset_eq (degree_f_lt : f.degree < s.card)
(degree_g_lt : g.degree < s.card) (eval_fg : ∀ x ∈ s, f.eval x = g.eval x) : f = g := by |
rw [← mem_degreeLT] at degree_f_lt degree_g_lt
refine eq_of_degree_sub_lt_of_eval_finset_eq _ ?_ eval_fg
rw [← mem_degreeLT]; exact Submodule.sub_mem _ degree_f_lt degree_g_lt
| [
" f = 0",
" (degreeLTEquiv R s.card) ⟨f, degree_f_lt⟩ = 0",
" f = g",
" f - g = 0",
" ∀ x ∈ s, eval x (f - g) = 0",
" ∀ x ∈ s, eval x f = eval x g",
" (f - g).degree < ↑s.card",
" f - g ∈ degreeLT R s.card"
] | [
" f = 0",
" (degreeLTEquiv R s.card) ⟨f, degree_f_lt⟩ = 0",
" f = g",
" f - g = 0",
" ∀ x ∈ s, eval x (f - g) = 0",
" ∀ x ∈ s, eval x f = eval x g"
] |
import Mathlib.Data.ENNReal.Basic
import Mathlib.Topology.ContinuousFunction.Bounded
import Mathlib.Topology.MetricSpace.Thickening
#align_import topology.metric_space.thickened_indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical
open NNReal ENNReal Topology BoundedContinuousFunction
open NNReal ENNReal Set Metric EMetric Filter
noncomputable section thickenedIndicator
variable {α : Type*} [PseudoEMetricSpace α]
def thickenedIndicatorAux (δ : ℝ) (E : Set α) : α → ℝ≥0∞ :=
fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ
#align thickened_indicator_aux thickenedIndicatorAux
theorem continuous_thickenedIndicatorAux {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) :
Continuous (thickenedIndicatorAux δ E) := by
unfold thickenedIndicatorAux
let f := fun x : α => (⟨1, infEdist x E / ENNReal.ofReal δ⟩ : ℝ≥0 × ℝ≥0∞)
let sub := fun p : ℝ≥0 × ℝ≥0∞ => (p.1 : ℝ≥0∞) - p.2
rw [show (fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ) = sub ∘ f by rfl]
apply (@ENNReal.continuous_nnreal_sub 1).comp
apply (ENNReal.continuous_div_const (ENNReal.ofReal δ) _).comp continuous_infEdist
set_option tactic.skipAssignedInstances false in norm_num [δ_pos]
#align continuous_thickened_indicator_aux continuous_thickenedIndicatorAux
theorem thickenedIndicatorAux_le_one (δ : ℝ) (E : Set α) (x : α) :
thickenedIndicatorAux δ E x ≤ 1 := by
apply @tsub_le_self _ _ _ _ (1 : ℝ≥0∞)
#align thickened_indicator_aux_le_one thickenedIndicatorAux_le_one
theorem thickenedIndicatorAux_lt_top {δ : ℝ} {E : Set α} {x : α} :
thickenedIndicatorAux δ E x < ∞ :=
lt_of_le_of_lt (thickenedIndicatorAux_le_one _ _ _) one_lt_top
#align thickened_indicator_aux_lt_top thickenedIndicatorAux_lt_top
theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) :
thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E := by
simp (config := { unfoldPartialApp := true }) only [thickenedIndicatorAux, infEdist_closure]
#align thickened_indicator_aux_closure_eq thickenedIndicatorAux_closure_eq
theorem thickenedIndicatorAux_one (δ : ℝ) (E : Set α) {x : α} (x_in_E : x ∈ E) :
thickenedIndicatorAux δ E x = 1 := by
simp [thickenedIndicatorAux, infEdist_zero_of_mem x_in_E, tsub_zero]
#align thickened_indicator_aux_one thickenedIndicatorAux_one
theorem thickenedIndicatorAux_one_of_mem_closure (δ : ℝ) (E : Set α) {x : α}
(x_mem : x ∈ closure E) : thickenedIndicatorAux δ E x = 1 := by
rw [← thickenedIndicatorAux_closure_eq, thickenedIndicatorAux_one δ (closure E) x_mem]
#align thickened_indicator_aux_one_of_mem_closure thickenedIndicatorAux_one_of_mem_closure
theorem thickenedIndicatorAux_zero {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) {x : α}
(x_out : x ∉ thickening δ E) : thickenedIndicatorAux δ E x = 0 := by
rw [thickening, mem_setOf_eq, not_lt] at x_out
unfold thickenedIndicatorAux
apply le_antisymm _ bot_le
have key := tsub_le_tsub
(@rfl _ (1 : ℝ≥0∞)).le (ENNReal.div_le_div x_out (@rfl _ (ENNReal.ofReal δ : ℝ≥0∞)).le)
rw [ENNReal.div_self (ne_of_gt (ENNReal.ofReal_pos.mpr δ_pos)) ofReal_ne_top] at key
simpa using key
#align thickened_indicator_aux_zero thickenedIndicatorAux_zero
theorem thickenedIndicatorAux_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) :
thickenedIndicatorAux δ₁ E ≤ thickenedIndicatorAux δ₂ E :=
fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div rfl.le (ofReal_le_ofReal hle))
#align thickened_indicator_aux_mono thickenedIndicatorAux_mono
| Mathlib/Topology/MetricSpace/ThickenedIndicator.lean | 110 | 115 | theorem indicator_le_thickenedIndicatorAux (δ : ℝ) (E : Set α) :
(E.indicator fun _ => (1 : ℝ≥0∞)) ≤ thickenedIndicatorAux δ E := by |
intro a
by_cases h : a ∈ E
· simp only [h, indicator_of_mem, thickenedIndicatorAux_one δ E h, le_refl]
· simp only [h, indicator_of_not_mem, not_false_iff, zero_le]
| [
" Continuous (thickenedIndicatorAux δ E)",
" Continuous fun x => 1 - infEdist x E / ENNReal.ofReal δ",
" (fun x => 1 - infEdist x E / ENNReal.ofReal δ) = sub ∘ f",
" Continuous (sub ∘ f)",
" Continuous fun x => (f x).2",
" ENNReal.ofReal δ ≠ 0",
" thickenedIndicatorAux δ E x ≤ 1",
" thickenedIndicator... | [
" Continuous (thickenedIndicatorAux δ E)",
" Continuous fun x => 1 - infEdist x E / ENNReal.ofReal δ",
" (fun x => 1 - infEdist x E / ENNReal.ofReal δ) = sub ∘ f",
" Continuous (sub ∘ f)",
" Continuous fun x => (f x).2",
" ENNReal.ofReal δ ≠ 0",
" thickenedIndicatorAux δ E x ≤ 1",
" thickenedIndicator... |
import Mathlib.CategoryTheory.Sites.DenseSubsite
#align_import category_theory.sites.induced_topology from "leanprover-community/mathlib"@"ba43124c37cfe0009bbfc57505f9503ae0e8c1af"
namespace CategoryTheory
universe v u
open Limits Opposite Presieve
section
variable {C : Type*} [Category C] {D : Type*} [Category D] {G : C ⥤ D}
variable {J : GrothendieckTopology C} {K : GrothendieckTopology D}
variable (A : Type v) [Category.{u} A]
-- variables (A) [full G] [faithful G]
def LocallyCoverDense (K : GrothendieckTopology D) (G : C ⥤ D) : Prop :=
∀ ⦃X : C⦄ (T : K (G.obj X)), (T.val.functorPullback G).functorPushforward G ∈ K (G.obj X)
#align category_theory.locally_cover_dense CategoryTheory.LocallyCoverDense
namespace LocallyCoverDense
variable [G.Full] [G.Faithful] (Hld : LocallyCoverDense K G)
| Mathlib/CategoryTheory/Sites/InducedTopology.lean | 59 | 65 | theorem pushforward_cover_iff_cover_pullback {X : C} (S : Sieve X) :
K _ (S.functorPushforward G) ↔ ∃ T : K (G.obj X), T.val.functorPullback G = S := by |
constructor
· intro hS
exact ⟨⟨_, hS⟩, (Sieve.fullyFaithfulFunctorGaloisCoinsertion G X).u_l_eq S⟩
· rintro ⟨T, rfl⟩
exact Hld T
| [
" K.sieves (G.obj X) (Sieve.functorPushforward G S) ↔ ∃ T, Sieve.functorPullback G ↑T = S",
" K.sieves (G.obj X) (Sieve.functorPushforward G S) → ∃ T, Sieve.functorPullback G ↑T = S",
" ∃ T, Sieve.functorPullback G ↑T = S",
" (∃ T, Sieve.functorPullback G ↑T = S) → K.sieves (G.obj X) (Sieve.functorPushforward... | [] |
import Mathlib.Topology.Bases
import Mathlib.Order.Filter.CountableInter
import Mathlib.Topology.Compactness.SigmaCompact
open Set Filter Topology TopologicalSpace
universe u v
variable {X : Type u} {Y : Type v} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
section Lindelof
def IsLindelof (s : Set X) :=
∀ ⦃f⦄ [NeBot f] [CountableInterFilter f], f ≤ 𝓟 s → ∃ x ∈ s, ClusterPt x f
theorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f]
(hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) : sᶜ ∈ f := by
contrapose! hf
simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢
exact hs inf_le_right
| Mathlib/Topology/Compactness/Lindelof.lean | 60 | 64 | theorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X}
[CountableInterFilter f] (hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by |
refine hs.compl_mem_sets fun x hx ↦ ?_
rw [← disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left]
exact hf x hx
| [
" sᶜ ∈ f",
" ∃ x ∈ s, sᶜ ∉ 𝓝 x ⊓ f",
" ∃ x ∈ s, (𝓝 x ⊓ (f ⊓ 𝓟 s)).NeBot",
" sᶜ ∈ 𝓝 x ⊓ f",
" ∃ i ∈ 𝓝 x ⊓ 𝓟 s, (id i)ᶜ ∈ f"
] | [
" sᶜ ∈ f",
" ∃ x ∈ s, sᶜ ∉ 𝓝 x ⊓ f",
" ∃ x ∈ s, (𝓝 x ⊓ (f ⊓ 𝓟 s)).NeBot"
] |
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section Disjoint
def Disjoint (f g : Perm α) :=
∀ x, f x = x ∨ g x = x
#align equiv.perm.disjoint Equiv.Perm.Disjoint
variable {f g h : Perm α}
@[symm]
theorem Disjoint.symm : Disjoint f g → Disjoint g f := by simp only [Disjoint, or_comm, imp_self]
#align equiv.perm.disjoint.symm Equiv.Perm.Disjoint.symm
theorem Disjoint.symmetric : Symmetric (@Disjoint α) := fun _ _ => Disjoint.symm
#align equiv.perm.disjoint.symmetric Equiv.Perm.Disjoint.symmetric
instance : IsSymm (Perm α) Disjoint :=
⟨Disjoint.symmetric⟩
theorem disjoint_comm : Disjoint f g ↔ Disjoint g f :=
⟨Disjoint.symm, Disjoint.symm⟩
#align equiv.perm.disjoint_comm Equiv.Perm.disjoint_comm
theorem Disjoint.commute (h : Disjoint f g) : Commute f g :=
Equiv.ext fun x =>
(h x).elim
(fun hf =>
(h (g x)).elim (fun hg => by simp [mul_apply, hf, hg]) fun hg => by
simp [mul_apply, hf, g.injective hg])
fun hg =>
(h (f x)).elim (fun hf => by simp [mul_apply, f.injective hf, hg]) fun hf => by
simp [mul_apply, hf, hg]
#align equiv.perm.disjoint.commute Equiv.Perm.Disjoint.commute
@[simp]
theorem disjoint_one_left (f : Perm α) : Disjoint 1 f := fun _ => Or.inl rfl
#align equiv.perm.disjoint_one_left Equiv.Perm.disjoint_one_left
@[simp]
theorem disjoint_one_right (f : Perm α) : Disjoint f 1 := fun _ => Or.inr rfl
#align equiv.perm.disjoint_one_right Equiv.Perm.disjoint_one_right
theorem disjoint_iff_eq_or_eq : Disjoint f g ↔ ∀ x : α, f x = x ∨ g x = x :=
Iff.rfl
#align equiv.perm.disjoint_iff_eq_or_eq Equiv.Perm.disjoint_iff_eq_or_eq
@[simp]
theorem disjoint_refl_iff : Disjoint f f ↔ f = 1 := by
refine ⟨fun h => ?_, fun h => h.symm ▸ disjoint_one_left 1⟩
ext x
cases' h x with hx hx <;> simp [hx]
#align equiv.perm.disjoint_refl_iff Equiv.Perm.disjoint_refl_iff
theorem Disjoint.inv_left (h : Disjoint f g) : Disjoint f⁻¹ g := by
intro x
rw [inv_eq_iff_eq, eq_comm]
exact h x
#align equiv.perm.disjoint.inv_left Equiv.Perm.Disjoint.inv_left
theorem Disjoint.inv_right (h : Disjoint f g) : Disjoint f g⁻¹ :=
h.symm.inv_left.symm
#align equiv.perm.disjoint.inv_right Equiv.Perm.Disjoint.inv_right
@[simp]
theorem disjoint_inv_left_iff : Disjoint f⁻¹ g ↔ Disjoint f g := by
refine ⟨fun h => ?_, Disjoint.inv_left⟩
convert h.inv_left
#align equiv.perm.disjoint_inv_left_iff Equiv.Perm.disjoint_inv_left_iff
@[simp]
| Mathlib/GroupTheory/Perm/Support.lean | 110 | 111 | theorem disjoint_inv_right_iff : Disjoint f g⁻¹ ↔ Disjoint f g := by |
rw [disjoint_comm, disjoint_inv_left_iff, disjoint_comm]
| [
" f.Disjoint g → g.Disjoint f",
" (f * g) x = (g * f) x",
" f.Disjoint f ↔ f = 1",
" f = 1",
" f x = 1 x",
" f⁻¹.Disjoint g",
" f⁻¹ x = x ∨ g x = x",
" f x = x ∨ g x = x",
" f⁻¹.Disjoint g ↔ f.Disjoint g",
" f.Disjoint g",
" f.Disjoint g⁻¹ ↔ f.Disjoint g"
] | [
" f.Disjoint g → g.Disjoint f",
" (f * g) x = (g * f) x",
" f.Disjoint f ↔ f = 1",
" f = 1",
" f x = 1 x",
" f⁻¹.Disjoint g",
" f⁻¹ x = x ∨ g x = x",
" f x = x ∨ g x = x",
" f⁻¹.Disjoint g ↔ f.Disjoint g",
" f.Disjoint g"
] |
import Mathlib.Data.Int.Interval
import Mathlib.RingTheory.Binomial
import Mathlib.RingTheory.HahnSeries.PowerSeries
import Mathlib.RingTheory.HahnSeries.Summable
import Mathlib.FieldTheory.RatFunc.AsPolynomial
import Mathlib.RingTheory.Localization.FractionRing
#align_import ring_theory.laurent_series from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
universe u
open scoped Classical
open HahnSeries Polynomial
noncomputable section
abbrev LaurentSeries (R : Type u) [Zero R] :=
HahnSeries ℤ R
#align laurent_series LaurentSeries
variable {R : Type*}
namespace LaurentSeries
section Semiring
variable [Semiring R]
instance : Coe (PowerSeries R) (LaurentSeries R) :=
⟨HahnSeries.ofPowerSeries ℤ R⟩
#noalign laurent_series.coe_power_series
@[simp]
| Mathlib/RingTheory/LaurentSeries.lean | 87 | 89 | theorem coeff_coe_powerSeries (x : PowerSeries R) (n : ℕ) :
HahnSeries.coeff (x : LaurentSeries R) n = PowerSeries.coeff R n x := by |
rw [ofPowerSeries_apply_coeff]
| [
" ((ofPowerSeries ℤ R) x).coeff ↑n = (PowerSeries.coeff R n) x"
] | [] |
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Algebra.Group.Basic
open scoped Topology Pointwise
open MulAction Set Function
variable {G X : Type*} [TopologicalSpace G] [TopologicalSpace X]
[Group G] [TopologicalGroup G] [MulAction G X]
[SigmaCompactSpace G] [BaireSpace X] [T2Space X]
[ContinuousSMul G X] [IsPretransitive G X]
@[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a
Baire space. Then the orbit map is open around zero. It follows in
`isOpenMap_vadd_of_sigmaCompact` that it is open around any point."]
theorem smul_singleton_mem_nhds_of_sigmaCompact
{U : Set G} (hU : U ∈ 𝓝 1) (x : X) : U • {x} ∈ 𝓝 x := by
obtain ⟨V, V_mem, V_closed, V_symm, VU⟩ : ∃ V ∈ 𝓝 (1 : G), IsClosed V ∧ V⁻¹ = V ∧ V * V ⊆ U :=
exists_closed_nhds_one_inv_eq_mul_subset hU
obtain ⟨s, s_count, hs⟩ : ∃ (s : Set G), s.Countable ∧ ⋃ g ∈ s, g • V = univ := by
apply countable_cover_nhds_of_sigma_compact (fun g ↦ ?_)
convert smul_mem_nhds g V_mem
simp only [smul_eq_mul, mul_one]
let K : ℕ → Set G := compactCovering G
let F : ℕ × s → Set X := fun p ↦ (K p.1 ∩ (p.2 : G) • V) • ({x} : Set X)
obtain ⟨⟨n, ⟨g, hg⟩⟩, hi⟩ : ∃ i, (interior (F i)).Nonempty := by
have : Nonempty X := ⟨x⟩
have : Encodable s := Countable.toEncodable s_count
apply nonempty_interior_of_iUnion_of_closed
· rintro ⟨n, ⟨g, hg⟩⟩
apply IsCompact.isClosed
suffices H : IsCompact ((fun (g : G) ↦ g • x) '' (K n ∩ g • V)) by
simpa only [F, smul_singleton] using H
apply IsCompact.image
· exact (isCompact_compactCovering G n).inter_right (V_closed.smul g)
· exact continuous_id.smul continuous_const
· apply eq_univ_iff_forall.2 (fun y ↦ ?_)
obtain ⟨h, rfl⟩ : ∃ h, h • x = y := exists_smul_eq G x y
obtain ⟨n, hn⟩ : ∃ n, h ∈ K n := exists_mem_compactCovering h
obtain ⟨g, gs, hg⟩ : ∃ g ∈ s, h ∈ g • V := exists_set_mem_of_union_eq_top s _ hs _
simp only [F, smul_singleton, mem_iUnion, mem_image, mem_inter_iff, Prod.exists,
Subtype.exists, exists_prop]
exact ⟨n, g, gs, h, ⟨hn, hg⟩, rfl⟩
have I : (interior ((g • V) • {x})).Nonempty := by
apply hi.mono
apply interior_mono
exact smul_subset_smul_right inter_subset_right
obtain ⟨y, hy⟩ : (interior (V • ({x} : Set X))).Nonempty := by
rw [smul_assoc, interior_smul] at I
exact smul_set_nonempty.1 I
obtain ⟨g', hg', rfl⟩ : ∃ g' ∈ V, g' • x = y := by simpa using interior_subset hy
have J : (g' ⁻¹ • V) • {x} ∈ 𝓝 x := by
apply mem_interior_iff_mem_nhds.1
rwa [smul_assoc, interior_smul, mem_inv_smul_set_iff]
have : (g'⁻¹ • V) • {x} ⊆ U • ({x} : Set X) := by
apply smul_subset_smul_right
apply Subset.trans (smul_set_subset_smul (inv_mem_inv.2 hg')) ?_
rw [V_symm]
exact VU
exact Filter.mem_of_superset J this
@[to_additive "Consider a sigma-compact additive group acting continuously and transitively on a
Baire space. Then the orbit map is open. This is a version of the open mapping theorem, valid
notably for the action of a sigma-compact locally compact group on a locally compact space."]
| Mathlib/Topology/Algebra/Group/OpenMapping.lean | 96 | 107 | theorem isOpenMap_smul_of_sigmaCompact (x : X) : IsOpenMap (fun (g : G) ↦ g • x) := by |
/- We have already proved the theorem around the basepoint of the orbit, in
`smul_singleton_mem_nhds_of_sigmaCompact`. The general statement follows around an arbitrary
point by changing basepoints. -/
simp_rw [isOpenMap_iff_nhds_le, Filter.le_map_iff]
intro g U hU
have : (· • x) = (· • (g • x)) ∘ (· * g⁻¹) := by
ext g
simp [smul_smul]
rw [this, image_comp, ← smul_singleton]
apply smul_singleton_mem_nhds_of_sigmaCompact
simpa using isOpenMap_mul_right g⁻¹ |>.image_mem_nhds hU
| [
" U • {x} ∈ 𝓝 x",
" ∃ s, s.Countable ∧ ⋃ g ∈ s, g • V = univ",
" g • V ∈ 𝓝 g",
" g = g • 1",
" ∃ i, (interior (F i)).Nonempty",
" ∀ (i : ℕ × ↑s), IsClosed (F i)",
" IsClosed (F (n, ⟨g, hg⟩))",
" IsCompact (F (n, ⟨g, hg⟩))",
" IsCompact ((fun g => g • x) '' (K n ∩ g • V))",
" IsCompact (K n ∩ g •... | [
" U • {x} ∈ 𝓝 x",
" ∃ s, s.Countable ∧ ⋃ g ∈ s, g • V = univ",
" g • V ∈ 𝓝 g",
" g = g • 1",
" ∃ i, (interior (F i)).Nonempty",
" ∀ (i : ℕ × ↑s), IsClosed (F i)",
" IsClosed (F (n, ⟨g, hg⟩))",
" IsCompact (F (n, ⟨g, hg⟩))",
" IsCompact ((fun g => g • x) '' (K n ∩ g • V))",
" IsCompact (K n ∩ g •... |
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
| Mathlib/Order/Interval/Set/ProjIcc.lean | 77 | 78 | theorem projIcc_of_right_le (hx : b ≤ x) : projIcc a b h x = ⟨b, right_mem_Icc.2 h⟩ := by |
simp [projIcc, hx, h]
| [
" projIcc a b h x = ⟨a, ⋯⟩",
" projIcc a b h x = ⟨b, ⋯⟩"
] | [
" projIcc a b h x = ⟨a, ⋯⟩"
] |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Normed.Field.InfiniteSum
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.normed_space.exponential from "leanprover-community/mathlib"@"62748956a1ece9b26b33243e2e3a2852176666f5"
namespace NormedSpace
open Filter RCLike ContinuousMultilinearMap NormedField Asymptotics
open scoped Nat Topology ENNReal
section TopologicalAlgebra
variable (𝕂 𝔸 : Type*) [Field 𝕂] [Ring 𝔸] [Algebra 𝕂 𝔸] [TopologicalSpace 𝔸] [TopologicalRing 𝔸]
def expSeries : FormalMultilinearSeries 𝕂 𝔸 𝔸 := fun n =>
(n !⁻¹ : 𝕂) • ContinuousMultilinearMap.mkPiAlgebraFin 𝕂 n 𝔸
#align exp_series NormedSpace.expSeries
variable {𝔸}
noncomputable def exp (x : 𝔸) : 𝔸 :=
(expSeries 𝕂 𝔸).sum x
#align exp NormedSpace.exp
variable {𝕂}
theorem expSeries_apply_eq (x : 𝔸) (n : ℕ) :
(expSeries 𝕂 𝔸 n fun _ => x) = (n !⁻¹ : 𝕂) • x ^ n := by simp [expSeries]
#align exp_series_apply_eq NormedSpace.expSeries_apply_eq
theorem expSeries_apply_eq' (x : 𝔸) :
(fun n => expSeries 𝕂 𝔸 n fun _ => x) = fun n => (n !⁻¹ : 𝕂) • x ^ n :=
funext (expSeries_apply_eq x)
#align exp_series_apply_eq' NormedSpace.expSeries_apply_eq'
theorem expSeries_sum_eq (x : 𝔸) : (expSeries 𝕂 𝔸).sum x = ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n :=
tsum_congr fun n => expSeries_apply_eq x n
#align exp_series_sum_eq NormedSpace.expSeries_sum_eq
theorem exp_eq_tsum : exp 𝕂 = fun x : 𝔸 => ∑' n : ℕ, (n !⁻¹ : 𝕂) • x ^ n :=
funext expSeries_sum_eq
#align exp_eq_tsum NormedSpace.exp_eq_tsum
theorem expSeries_apply_zero (n : ℕ) :
(expSeries 𝕂 𝔸 n fun _ => (0 : 𝔸)) = Pi.single (f := fun _ => 𝔸) 0 1 n := by
rw [expSeries_apply_eq]
cases' n with n
· rw [pow_zero, Nat.factorial_zero, Nat.cast_one, inv_one, one_smul, Pi.single_eq_same]
· rw [zero_pow (Nat.succ_ne_zero _), smul_zero, Pi.single_eq_of_ne n.succ_ne_zero]
#align exp_series_apply_zero NormedSpace.expSeries_apply_zero
@[simp]
theorem exp_zero : exp 𝕂 (0 : 𝔸) = 1 := by
simp_rw [exp_eq_tsum, ← expSeries_apply_eq, expSeries_apply_zero, tsum_pi_single]
#align exp_zero NormedSpace.exp_zero
@[simp]
theorem exp_op [T2Space 𝔸] (x : 𝔸) : exp 𝕂 (MulOpposite.op x) = MulOpposite.op (exp 𝕂 x) := by
simp_rw [exp, expSeries_sum_eq, ← MulOpposite.op_pow, ← MulOpposite.op_smul, tsum_op]
#align exp_op NormedSpace.exp_op
@[simp]
theorem exp_unop [T2Space 𝔸] (x : 𝔸ᵐᵒᵖ) :
exp 𝕂 (MulOpposite.unop x) = MulOpposite.unop (exp 𝕂 x) := by
simp_rw [exp, expSeries_sum_eq, ← MulOpposite.unop_pow, ← MulOpposite.unop_smul, tsum_unop]
#align exp_unop NormedSpace.exp_unop
| Mathlib/Analysis/NormedSpace/Exponential.lean | 160 | 162 | theorem star_exp [T2Space 𝔸] [StarRing 𝔸] [ContinuousStar 𝔸] (x : 𝔸) :
star (exp 𝕂 x) = exp 𝕂 (star x) := by |
simp_rw [exp_eq_tsum, ← star_pow, ← star_inv_natCast_smul, ← tsum_star]
| [
" ((expSeries 𝕂 𝔸 n) fun x_1 => x) = (↑n !)⁻¹ • x ^ n",
" ((expSeries 𝕂 𝔸 n) fun x => 0) = Pi.single 0 1 n",
" (↑n !)⁻¹ • 0 ^ n = Pi.single 0 1 n",
" (↑0!)⁻¹ • 0 ^ 0 = Pi.single 0 1 0",
" (↑(n + 1)!)⁻¹ • 0 ^ (n + 1) = Pi.single 0 1 (n + 1)",
" exp 𝕂 0 = 1",
" exp 𝕂 (MulOpposite.op x) = MulOpposite... | [
" ((expSeries 𝕂 𝔸 n) fun x_1 => x) = (↑n !)⁻¹ • x ^ n",
" ((expSeries 𝕂 𝔸 n) fun x => 0) = Pi.single 0 1 n",
" (↑n !)⁻¹ • 0 ^ n = Pi.single 0 1 n",
" (↑0!)⁻¹ • 0 ^ 0 = Pi.single 0 1 0",
" (↑(n + 1)!)⁻¹ • 0 ^ (n + 1) = Pi.single 0 1 (n + 1)",
" exp 𝕂 0 = 1",
" exp 𝕂 (MulOpposite.op x) = MulOpposite... |
import Mathlib.Order.Filter.Partial
import Mathlib.Topology.Basic
#align_import topology.partial from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Filter
open Topology
variable {X Y : Type*} [TopologicalSpace X]
theorem rtendsto_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.core s ∈ l :=
all_mem_nhds_filter _ _ (fun _s _t => id) _
#align rtendsto_nhds rtendsto_nhds
| Mathlib/Topology/Partial.lean | 30 | 34 | theorem rtendsto'_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto' r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.preimage s ∈ l := by |
rw [rtendsto'_def]
apply all_mem_nhds_filter
apply Rel.preimage_mono
| [
" RTendsto' r l (𝓝 x) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" (∀ s ∈ 𝓝 x, r.preimage s ∈ l) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" ∀ (s t : Set X), s ⊆ t → r.preimage s ⊆ r.preimage t"
] | [] |
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.OfChosenFiniteProducts.Basic
#align_import category_theory.monoidal.of_chosen_finite_products.symmetric from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4"
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] {X Y : C}
open CategoryTheory.Limits
variable (𝒯 : LimitCone (Functor.empty.{0} C))
variable (ℬ : ∀ X Y : C, LimitCone (pair X Y))
open MonoidalOfChosenFiniteProducts
namespace MonoidalOfChosenFiniteProducts
open MonoidalCategory
| Mathlib/CategoryTheory/Monoidal/OfChosenFiniteProducts/Symmetric.lean | 34 | 39 | theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
tensorHom ℬ f g ≫ (Limits.BinaryFan.braiding (ℬ Y Y').isLimit (ℬ Y' Y).isLimit).hom =
(Limits.BinaryFan.braiding (ℬ X X').isLimit (ℬ X' X).isLimit).hom ≫ tensorHom ℬ g f := by |
dsimp [tensorHom, Limits.BinaryFan.braiding]
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨⟨⟩⟩ <;> · dsimp [Limits.IsLimit.conePointUniqueUpToIso]; simp
| [
" tensorHom ℬ f g ≫ (BinaryFan.braiding (ℬ Y Y').isLimit (ℬ Y' Y).isLimit).hom =\n (BinaryFan.braiding (ℬ X X').isLimit (ℬ X' X).isLimit).hom ≫ tensorHom ℬ g f",
" (ℬ Y Y').isLimit.lift (BinaryFan.mk (BinaryFan.fst (ℬ X X').cone ≫ f) (BinaryFan.snd (ℬ X X').cone ≫ g)) ≫\n ((ℬ Y Y').isLimit.conePointUnique... | [] |
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.Topology.TietzeExtension
import Mathlib.Analysis.NormedSpace.HomeomorphBall
import Mathlib.Analysis.NormedSpace.RCLike
universe u u₁ v w
-- this is not an instance because Lean cannot determine `𝕜`.
theorem TietzeExtension.of_tvs (𝕜 : Type v) [NontriviallyNormedField 𝕜] {E : Type w}
[AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousSMul 𝕜 E]
[T2Space E] [FiniteDimensional 𝕜 E] [CompleteSpace 𝕜] [TietzeExtension.{u, v} 𝕜] :
TietzeExtension.{u, w} E :=
Basis.ofVectorSpace 𝕜 E |>.equivFun.toContinuousLinearEquiv.toHomeomorph |> .of_homeo
instance Complex.instTietzeExtension : TietzeExtension ℂ :=
TietzeExtension.of_tvs ℝ
instance (priority := 900) RCLike.instTietzeExtension {𝕜 : Type*} [RCLike 𝕜] :
TietzeExtension 𝕜 := TietzeExtension.of_tvs ℝ
instance RCLike.instTietzeExtensionTVS {𝕜 : Type v} [RCLike 𝕜] {E : Type w}
[AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E]
[ContinuousSMul 𝕜 E] [T2Space E] [FiniteDimensional 𝕜 E] :
TietzeExtension.{u, w} E :=
TietzeExtension.of_tvs 𝕜
instance Set.instTietzeExtensionUnitBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] :
TietzeExtension.{u, w} (Metric.ball (0 : E) 1) :=
have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
.of_homeo Homeomorph.unitBall.symm
instance Set.instTietzeExtensionUnitClosedBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] :
TietzeExtension.{u, w} (Metric.closedBall (0 : E) 1) := by
have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
have : IsScalarTower ℝ 𝕜 E := Real.isScalarTower
-- I didn't find this retract in Mathlib.
let g : E → E := fun x ↦ ‖x‖⁻¹ • x
classical
suffices this : Continuous (piecewise (Metric.closedBall 0 1) id g) by
refine .of_retract ⟨Subtype.val, by continuity⟩ ⟨_, this.codRestrict fun x ↦ ?_⟩ ?_
· by_cases hx : x ∈ Metric.closedBall 0 1
· simpa [piecewise_eq_of_mem (hi := hx)] using hx
· simp only [g, piecewise_eq_of_not_mem (hi := hx), RCLike.real_smul_eq_coe_smul (K := 𝕜)]
by_cases hx' : x = 0 <;> simp [hx']
· ext x
simp [piecewise_eq_of_mem (hi := x.property)]
refine continuous_piecewise (fun x hx ↦ ?_) continuousOn_id ?_
· replace hx : ‖x‖ = 1 := by simpa [frontier_closedBall (0 : E) one_ne_zero] using hx
simp [g, hx]
· refine continuousOn_id.norm.inv₀ ?_ |>.smul continuousOn_id
simp only [closure_compl, interior_closedBall (0 : E) one_ne_zero, mem_compl_iff,
Metric.mem_ball, dist_zero_right, not_lt, id_eq, ne_eq, norm_eq_zero]
exact fun x hx ↦ norm_pos_iff.mp <| one_pos.trans_le hx
theorem Metric.instTietzeExtensionBall {𝕜 : Type v} [RCLike 𝕜] {E : Type w}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] {r : ℝ} (hr : 0 < r) :
TietzeExtension.{u, w} (Metric.ball (0 : E) r) :=
have : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 E
.of_homeo <| show (Metric.ball (0 : E) r) ≃ₜ (Metric.ball (0 : E) 1) from
PartialHomeomorph.unitBallBall (0 : E) r hr |>.toHomeomorphSourceTarget.symm
theorem Metric.instTietzeExtensionClosedBall (𝕜 : Type v) [RCLike 𝕜] {E : Type w}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E] (y : E) {r : ℝ} (hr : 0 < r) :
TietzeExtension.{u, w} (Metric.closedBall y r) :=
.of_homeo <| by
show (Metric.closedBall y r) ≃ₜ (Metric.closedBall (0 : E) 1)
symm
apply (DilationEquiv.smulTorsor y (k := (r : 𝕜)) <| by exact_mod_cast hr.ne').toHomeomorph.sets
ext x
simp only [mem_closedBall, dist_zero_right, DilationEquiv.coe_toHomeomorph, Set.mem_preimage,
DilationEquiv.smulTorsor_apply, vadd_eq_add, dist_add_self_left, norm_smul,
RCLike.norm_ofReal, abs_of_nonneg hr.le]
exact (mul_le_iff_le_one_right hr).symm
variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s)
variable (𝕜 : Type v) [RCLike 𝕜] [TietzeExtension.{u, v} 𝕜]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] [FiniteDimensional 𝕜 E]
namespace BoundedContinuousFunction
| Mathlib/Analysis/Complex/Tietze.lean | 105 | 118 | theorem exists_norm_eq_restrict_eq (f : s →ᵇ E) :
∃ g : X →ᵇ E, ‖g‖ = ‖f‖ ∧ g.restrict s = f := by |
by_cases hf : ‖f‖ = 0; · exact ⟨0, by aesop⟩
have := Metric.instTietzeExtensionClosedBall.{u, v} 𝕜 (0 : E) (by aesop : 0 < ‖f‖)
have hf' x : f x ∈ Metric.closedBall 0 ‖f‖ := by simpa using f.norm_coe_le_norm x
obtain ⟨g, hg_mem, hg⟩ := (f : C(s, E)).exists_forall_mem_restrict_eq hs hf'
simp only [Metric.mem_closedBall, dist_zero_right] at hg_mem
let g' : X →ᵇ E := .ofNormedAddCommGroup g (map_continuous g) ‖f‖ hg_mem
refine ⟨g', ?_, by ext x; congrm($(hg) x)⟩
apply le_antisymm ((g'.norm_le <| by positivity).mpr hg_mem)
refine (f.norm_le <| by positivity).mpr fun x ↦ ?_
have hx : f x = g' x := by simpa using congr($(hg) x).symm
rw [hx]
exact g'.norm_le (norm_nonneg g') |>.mp le_rfl x
| [
" TietzeExtension ↑(Metric.closedBall 0 1)",
" Continuous Subtype.val",
" (Metric.closedBall 0 1).piecewise id g x ∈ Metric.closedBall 0 1",
" ↑‖x‖⁻¹ • x ∈ Metric.closedBall 0 1",
" { toFun := codRestrict ((Metric.closedBall 0 1).piecewise id g) (Metric.closedBall 0 1) ⋯,\n continuous_toFun := ⋯ }.... | [
" TietzeExtension ↑(Metric.closedBall 0 1)",
" Continuous Subtype.val",
" (Metric.closedBall 0 1).piecewise id g x ∈ Metric.closedBall 0 1",
" ↑‖x‖⁻¹ • x ∈ Metric.closedBall 0 1",
" { toFun := codRestrict ((Metric.closedBall 0 1).piecewise id g) (Metric.closedBall 0 1) ⋯,\n continuous_toFun := ⋯ }.... |
import Mathlib.Analysis.Complex.UpperHalfPlane.Topology
import Mathlib.Analysis.SpecialFunctions.Arsinh
import Mathlib.Geometry.Euclidean.Inversion.Basic
#align_import analysis.complex.upper_half_plane.metric from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
noncomputable section
open scoped UpperHalfPlane ComplexConjugate NNReal Topology MatrixGroups
open Set Metric Filter Real
variable {z w : ℍ} {r R : ℝ}
namespace UpperHalfPlane
instance : Dist ℍ :=
⟨fun z w => 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im)))⟩
theorem dist_eq (z w : ℍ) : dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * √(z.im * w.im))) :=
rfl
#align upper_half_plane.dist_eq UpperHalfPlane.dist_eq
theorem sinh_half_dist (z w : ℍ) :
sinh (dist z w / 2) = dist (z : ℂ) w / (2 * √(z.im * w.im)) := by
rw [dist_eq, mul_div_cancel_left₀ (arsinh _) two_ne_zero, sinh_arsinh]
#align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist
theorem cosh_half_dist (z w : ℍ) :
cosh (dist z w / 2) = dist (z : ℂ) (conj (w : ℂ)) / (2 * √(z.im * w.im)) := by
rw [← sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt]
· congr 1
simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj,
Complex.conj_conj, Complex.mul_re, Complex.conj_re, Complex.conj_im, coe_im]
ring
all_goals positivity
#align upper_half_plane.cosh_half_dist UpperHalfPlane.cosh_half_dist
| Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean | 60 | 63 | theorem tanh_half_dist (z w : ℍ) :
tanh (dist z w / 2) = dist (z : ℂ) w / dist (z : ℂ) (conj ↑w) := by |
rw [tanh_eq_sinh_div_cosh, sinh_half_dist, cosh_half_dist, div_div_div_comm, div_self, div_one]
positivity
| [
" (dist z w / 2).sinh = dist ↑z ↑w / (2 * √(z.im * w.im))",
" (dist z w / 2).cosh = dist (↑z) ((starRingEnd ℂ) ↑w) / (2 * √(z.im * w.im))",
" (2 ^ 2 * (z.im * w.im) + dist ↑z ↑w ^ 2) / (2 ^ 2 * (z.im * w.im)) =\n dist (↑z) ((starRingEnd ℂ) ↑w) ^ 2 / (2 ^ 2 * (z.im * w.im))",
" 2 ^ 2 * (z.im * w.im) + dist ... | [
" (dist z w / 2).sinh = dist ↑z ↑w / (2 * √(z.im * w.im))",
" (dist z w / 2).cosh = dist (↑z) ((starRingEnd ℂ) ↑w) / (2 * √(z.im * w.im))",
" (2 ^ 2 * (z.im * w.im) + dist ↑z ↑w ^ 2) / (2 ^ 2 * (z.im * w.im)) =\n dist (↑z) ((starRingEnd ℂ) ↑w) ^ 2 / (2 ^ 2 * (z.im * w.im))",
" 2 ^ 2 * (z.im * w.im) + dist ... |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Interval.Set.IsoIoo
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.UrysohnsBounded
#align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
section TietzeExtensionClass
universe u u₁ u₂ v w
-- TODO: define *absolute retracts* and then prove they satisfy Tietze extension.
-- Then make instances of that instead and remove this class.
class TietzeExtension (Y : Type v) [TopologicalSpace Y] : Prop where
exists_restrict_eq' {X : Type u} [TopologicalSpace X] [NormalSpace X] (s : Set X)
(hs : IsClosed s) (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f
variable {X₁ : Type u₁} [TopologicalSpace X₁]
variable {X : Type u} [TopologicalSpace X] [NormalSpace X] {s : Set X} (hs : IsClosed s)
variable {e : X₁ → X} (he : ClosedEmbedding e)
variable {Y : Type v} [TopologicalSpace Y] [TietzeExtension.{u, v} Y]
theorem ContinuousMap.exists_restrict_eq (f : C(s, Y)) : ∃ (g : C(X, Y)), g.restrict s = f :=
TietzeExtension.exists_restrict_eq' s hs f
#align continuous_map.exists_restrict_eq_of_closed ContinuousMap.exists_restrict_eq
theorem ContinuousMap.exists_extension (f : C(X₁, Y)) :
∃ (g : C(X, Y)), g.comp ⟨e, he.continuous⟩ = f := by
let e' : X₁ ≃ₜ Set.range e := Homeomorph.ofEmbedding _ he.toEmbedding
obtain ⟨g, hg⟩ := (f.comp e'.symm).exists_restrict_eq he.isClosed_range
exact ⟨g, by ext x; simpa using congr($(hg) ⟨e' x, x, rfl⟩)⟩
theorem ContinuousMap.exists_extension' (f : C(X₁, Y)) : ∃ (g : C(X, Y)), g ∘ e = f :=
f.exists_extension he |>.imp fun g hg ↦ by ext x; congrm($(hg) x)
#align continuous_map.exists_extension_of_closed_embedding ContinuousMap.exists_extension'
theorem ContinuousMap.exists_forall_mem_restrict_eq {Y : Type v} [TopologicalSpace Y] (f : C(s, Y))
{t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] :
∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.restrict s = f := by
obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_restrict_eq hs
exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩
theorem ContinuousMap.exists_extension_forall_mem {Y : Type v} [TopologicalSpace Y] (f : C(X₁, Y))
{t : Set Y} (hf : ∀ x, f x ∈ t) [ht : TietzeExtension.{u, v} t] :
∃ (g : C(X, Y)), (∀ x, g x ∈ t) ∧ g.comp ⟨e, he.continuous⟩ = f := by
obtain ⟨g, hg⟩ := mk _ (map_continuous f |>.codRestrict hf) |>.exists_extension he
exact ⟨comp ⟨Subtype.val, by continuity⟩ g, by simp, by ext x; congrm(($(hg) x : Y))⟩
instance Pi.instTietzeExtension {ι : Type*} {Y : ι → Type v} [∀ i, TopologicalSpace (Y i)]
[∀ i, TietzeExtension (Y i)] : TietzeExtension (∀ i, Y i) where
exists_restrict_eq' s hs f := by
obtain ⟨g', hg'⟩ := Classical.skolem.mp <| fun i ↦
ContinuousMap.exists_restrict_eq hs (ContinuousMap.piEquiv _ _ |>.symm f i)
exact ⟨ContinuousMap.piEquiv _ _ g', by ext x i; congrm($(hg' i) x)⟩
instance Prod.instTietzeExtension {Y : Type v} {Z : Type w} [TopologicalSpace Y]
[TietzeExtension.{u, v} Y] [TopologicalSpace Z] [TietzeExtension.{u, w} Z] :
TietzeExtension (Y × Z) where
exists_restrict_eq' s hs f := by
obtain ⟨g₁, hg₁⟩ := (ContinuousMap.fst.comp f).exists_restrict_eq hs
obtain ⟨g₂, hg₂⟩ := (ContinuousMap.snd.comp f).exists_restrict_eq hs
exact ⟨g₁.prodMk g₂, by ext1 x; congrm(($(hg₁) x), $(hg₂) x)⟩
instance Unique.instTietzeExtension {Y : Type v} [TopologicalSpace Y] [Unique Y] :
TietzeExtension.{u, v} Y where
exists_restrict_eq' _ _ f := ⟨.const _ default, by ext x; exact Subsingleton.elim _ _⟩
| Mathlib/Topology/TietzeExtension.lean | 134 | 143 | theorem TietzeExtension.of_retract {Y : Type v} {Z : Type w} [TopologicalSpace Y]
[TopologicalSpace Z] [TietzeExtension.{u, w} Z] (ι : C(Y, Z)) (r : C(Z, Y))
(h : r.comp ι = .id Y) : TietzeExtension.{u, v} Y where
exists_restrict_eq' s hs f := by |
obtain ⟨g, hg⟩ := (ι.comp f).exists_restrict_eq hs
use r.comp g
ext1 x
have := congr(r.comp $(hg))
rw [← r.comp_assoc ι, h, f.id_comp] at this
congrm($this x)
| [
" ∃ g, g.comp { toFun := e, continuous_toFun := ⋯ } = f",
" g.comp { toFun := e, continuous_toFun := ⋯ } = f",
" (g.comp { toFun := e, continuous_toFun := ⋯ }) x = f x",
" ⇑g ∘ e = ⇑f",
" (⇑g ∘ e) x = f x",
" ∃ g, (∀ (x : X), g x ∈ t) ∧ restrict s g = f",
" Continuous Subtype.val",
" ∀ (x : X), ({ toF... | [
" ∃ g, g.comp { toFun := e, continuous_toFun := ⋯ } = f",
" g.comp { toFun := e, continuous_toFun := ⋯ } = f",
" (g.comp { toFun := e, continuous_toFun := ⋯ }) x = f x",
" ⇑g ∘ e = ⇑f",
" (⇑g ∘ e) x = f x",
" ∃ g, (∀ (x : X), g x ∈ t) ∧ restrict s g = f",
" Continuous Subtype.val",
" ∀ (x : X), ({ toF... |
import Mathlib.Algebra.Group.Defs
#align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
universe u
variable {α : Type u}
class Invertible [Mul α] [One α] (a : α) : Type u where
invOf : α
invOf_mul_self : invOf * a = 1
mul_invOf_self : a * invOf = 1
#align invertible Invertible
prefix:max
"⅟" =>-- This notation has the same precedence as `Inv.inv`.
Invertible.invOf
@[simp]
theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 :=
Invertible.invOf_mul_self
#align inv_of_mul_self invOf_mul_self
@[simp]
theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 :=
Invertible.mul_invOf_self
#align mul_inv_of_self mul_invOf_self
@[simp]
theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by
rw [← mul_assoc, invOf_mul_self, one_mul]
#align inv_of_mul_self_assoc invOf_mul_self_assoc
@[simp]
theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
#align mul_inv_of_self_assoc mul_invOf_self_assoc
@[simp]
theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by
simp [mul_assoc]
theorem mul_invOf_mul_self_cancel [Monoid α] (a b : α) [Invertible b] : a * ⅟ b * b = a := by
simp [mul_assoc]
#align mul_inv_of_mul_self_cancel mul_invOf_mul_self_cancel
@[simp]
theorem mul_mul_invOf_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * b * ⅟ b = a := by
simp [mul_assoc]
theorem mul_mul_invOf_self_cancel [Monoid α] (a b : α) [Invertible b] : a * b * ⅟ b = a := by
simp [mul_assoc]
#align mul_mul_inv_of_self_cancel mul_mul_invOf_self_cancel
theorem invOf_eq_right_inv [Monoid α] {a b : α} [Invertible a] (hac : a * b = 1) : ⅟ a = b :=
left_inv_eq_right_inv (invOf_mul_self _) hac
#align inv_of_eq_right_inv invOf_eq_right_inv
theorem invOf_eq_left_inv [Monoid α] {a b : α} [Invertible a] (hac : b * a = 1) : ⅟ a = b :=
(left_inv_eq_right_inv hac (mul_invOf_self _)).symm
#align inv_of_eq_left_inv invOf_eq_left_inv
theorem invertible_unique {α : Type u} [Monoid α] (a b : α) [Invertible a] [Invertible b]
(h : a = b) : ⅟ a = ⅟ b := by
apply invOf_eq_right_inv
rw [h, mul_invOf_self]
#align invertible_unique invertible_unique
instance Invertible.subsingleton [Monoid α] (a : α) : Subsingleton (Invertible a) :=
⟨fun ⟨b, hba, hab⟩ ⟨c, _, hac⟩ => by
congr
exact left_inv_eq_right_inv hba hac⟩
#align invertible.subsingleton Invertible.subsingleton
@[congr]
| Mathlib/Algebra/Group/Invertible/Defs.lean | 170 | 171 | theorem Invertible.congr [Monoid α] (a b : α) [Invertible a] [Invertible b] (h : a = b) :
⅟a = ⅟b := by | subst h; congr; apply Subsingleton.allEq
| [
" ⅟a * (a * b) = b",
" a * (⅟a * b) = b",
" a * ⅟b * b = a",
" a * b * ⅟b = a",
" ⅟a = ⅟b",
" a * ⅟b = 1",
" { invOf := b, invOf_mul_self := hba, mul_invOf_self := hab } =\n { invOf := c, invOf_mul_self := invOf_mul_self✝, mul_invOf_self := hac }",
" b = c",
" ⅟a = ⅟a",
" inst✝¹ = inst✝"
] | [
" ⅟a * (a * b) = b",
" a * (⅟a * b) = b",
" a * ⅟b * b = a",
" a * b * ⅟b = a",
" ⅟a = ⅟b",
" a * ⅟b = 1",
" { invOf := b, invOf_mul_self := hba, mul_invOf_self := hab } =\n { invOf := c, invOf_mul_self := invOf_mul_self✝, mul_invOf_self := hac }",
" b = c"
] |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.MeasureTheory.Function.LpSeminorm.ChebyshevMarkov
import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp
import Mathlib.MeasureTheory.Function.LpSeminorm.TriangleInequality
import Mathlib.MeasureTheory.Measure.OpenPos
import Mathlib.Topology.ContinuousFunction.Compact
import Mathlib.Order.Filter.IndicatorFunction
#align_import measure_theory.function.lp_space from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
noncomputable section
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory Filter
open scoped NNReal ENNReal Topology MeasureTheory Uniformity
variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
namespace MeasureTheory
@[simp]
theorem snorm_aeeqFun {α E : Type*} [MeasurableSpace α] {μ : Measure α} [NormedAddCommGroup E]
{p : ℝ≥0∞} {f : α → E} (hf : AEStronglyMeasurable f μ) :
snorm (AEEqFun.mk f hf) p μ = snorm f p μ :=
snorm_congr_ae (AEEqFun.coeFn_mk _ _)
#align measure_theory.snorm_ae_eq_fun MeasureTheory.snorm_aeeqFun
theorem Memℒp.snorm_mk_lt_top {α E : Type*} [MeasurableSpace α] {μ : Measure α}
[NormedAddCommGroup E] {p : ℝ≥0∞} {f : α → E} (hfp : Memℒp f p μ) :
snorm (AEEqFun.mk f hfp.1) p μ < ∞ := by simp [hfp.2]
#align measure_theory.mem_ℒp.snorm_mk_lt_top MeasureTheory.Memℒp.snorm_mk_lt_top
def Lp {α} (E : Type*) {m : MeasurableSpace α} [NormedAddCommGroup E] (p : ℝ≥0∞)
(μ : Measure α := by volume_tac) : AddSubgroup (α →ₘ[μ] E) where
carrier := { f | snorm f p μ < ∞ }
zero_mem' := by simp [snorm_congr_ae AEEqFun.coeFn_zero, snorm_zero]
add_mem' {f g} hf hg := by
simp [snorm_congr_ae (AEEqFun.coeFn_add f g),
snorm_add_lt_top ⟨f.aestronglyMeasurable, hf⟩ ⟨g.aestronglyMeasurable, hg⟩]
neg_mem' {f} hf := by rwa [Set.mem_setOf_eq, snorm_congr_ae (AEEqFun.coeFn_neg f), snorm_neg]
#align measure_theory.Lp MeasureTheory.Lp
-- Porting note: calling the first argument `α` breaks the `(α := ·)` notation
scoped notation:25 α' " →₁[" μ "] " E => MeasureTheory.Lp (α := α') E 1 μ
scoped notation:25 α' " →₂[" μ "] " E => MeasureTheory.Lp (α := α') E 2 μ
namespace Lp
instance instCoeFun : CoeFun (Lp E p μ) (fun _ => α → E) :=
⟨fun f => ((f : α →ₘ[μ] E) : α → E)⟩
#align measure_theory.Lp.has_coe_to_fun MeasureTheory.Lp.instCoeFun
@[ext high]
theorem ext {f g : Lp E p μ} (h : f =ᵐ[μ] g) : f = g := by
cases f
cases g
simp only [Subtype.mk_eq_mk]
exact AEEqFun.ext h
#align measure_theory.Lp.ext MeasureTheory.Lp.ext
theorem ext_iff {f g : Lp E p μ} : f = g ↔ f =ᵐ[μ] g :=
⟨fun h => by rw [h], fun h => ext h⟩
#align measure_theory.Lp.ext_iff MeasureTheory.Lp.ext_iff
theorem mem_Lp_iff_snorm_lt_top {f : α →ₘ[μ] E} : f ∈ Lp E p μ ↔ snorm f p μ < ∞ := Iff.rfl
#align measure_theory.Lp.mem_Lp_iff_snorm_lt_top MeasureTheory.Lp.mem_Lp_iff_snorm_lt_top
| Mathlib/MeasureTheory/Function/LpSpace.lean | 177 | 178 | theorem mem_Lp_iff_memℒp {f : α →ₘ[μ] E} : f ∈ Lp E p μ ↔ Memℒp f p μ := by |
simp [mem_Lp_iff_snorm_lt_top, Memℒp, f.stronglyMeasurable.aestronglyMeasurable]
| [
" snorm (↑(AEEqFun.mk f ⋯)) p μ < ⊤",
" f + g ∈ {f | snorm (↑f) p μ < ⊤}",
" 0 ∈ { carrier := {f | snorm (↑f) p μ < ⊤}, add_mem' := ⋯ }.carrier",
" -f ∈ { carrier := {f | snorm (↑f) p μ < ⊤}, add_mem' := ⋯, zero_mem' := ⋯ }.carrier",
" f = g",
" ⟨val✝, property✝⟩ = g",
" ⟨val✝¹, property✝¹⟩ = ⟨val✝, pro... | [
" snorm (↑(AEEqFun.mk f ⋯)) p μ < ⊤",
" f + g ∈ {f | snorm (↑f) p μ < ⊤}",
" 0 ∈ { carrier := {f | snorm (↑f) p μ < ⊤}, add_mem' := ⋯ }.carrier",
" -f ∈ { carrier := {f | snorm (↑f) p μ < ⊤}, add_mem' := ⋯, zero_mem' := ⋯ }.carrier",
" f = g",
" ⟨val✝, property✝⟩ = g",
" ⟨val✝¹, property✝¹⟩ = ⟨val✝, pro... |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right
@[simp]
theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right
@[simp]
theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_right_right, gcd_comm]
#align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left
@[simp]
theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_left_right, gcd_comm]
#align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left
@[simp]
theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_right_add_right, gcd_comm]
#align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left
@[simp]
theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
#align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left
@[simp]
theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n :=
Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1)
#align nat.gcd_add_self_right Nat.gcd_add_self_right
@[simp]
theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by
rw [gcd_comm, gcd_add_self_right, gcd_comm]
#align nat.gcd_add_self_left Nat.gcd_add_self_left
@[simp]
theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by rw [add_comm, gcd_add_self_left]
#align nat.gcd_self_add_left Nat.gcd_self_add_left
@[simp]
theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
rw [add_comm, gcd_add_self_right]
#align nat.gcd_self_add_right Nat.gcd_self_add_right
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 96 | 99 | theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by |
calc
gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
_ = gcd n m := by rw [Nat.sub_add_cancel h]
| [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n",
" (m + k * n).gcd n = m.gcd n",
" (m + n * k).gcd n = m.gcd n",
" (k * n + m).gcd n = m.gcd n",
" (n * k + m).gcd n = m.gcd n",
" m.gcd (n + m) = m.gcd (n + 1 * m)",
" (m... | [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n",
" (m + k * n).gcd n = m.gcd n",
" (m + n * k).gcd n = m.gcd n",
" (k * n + m).gcd n = m.gcd n",
" (n * k + m).gcd n = m.gcd n",
" m.gcd (n + m) = m.gcd (n + 1 * m)",
" (m... |
import Mathlib.Probability.Kernel.MeasurableIntegral
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113"
open MeasureTheory ProbabilityTheory
open scoped MeasureTheory ENNReal NNReal
namespace ProbabilityTheory.kernel
variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
variable {κ : kernel α β} {f : α → β → ℝ≥0∞}
noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) :
kernel α β :=
@dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf =>
(⟨fun a => (κ a).withDensity (f a),
by
refine Measure.measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [withDensity_apply _ hs]
exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0
#align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity
theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ]
(hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by classical exact dif_neg hf
#align probability_theory.kernel.with_density_of_not_measurable ProbabilityTheory.kernel.withDensity_of_not_measurable
protected theorem withDensity_apply (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) :
withDensity κ f a = (κ a).withDensity (f a) := by
classical
rw [withDensity, dif_pos hf]
rfl
#align probability_theory.kernel.with_density_apply ProbabilityTheory.kernel.withDensity_apply
protected theorem withDensity_apply' (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) (s : Set β) :
withDensity κ f a s = ∫⁻ b in s, f a b ∂κ a := by
rw [kernel.withDensity_apply κ hf, withDensity_apply' _ s]
#align probability_theory.kernel.with_density_apply' ProbabilityTheory.kernel.withDensity_apply'
nonrec lemma withDensity_congr_ae (κ : kernel α β) [IsSFiniteKernel κ] {f g : α → β → ℝ≥0∞}
(hf : Measurable (Function.uncurry f)) (hg : Measurable (Function.uncurry g))
(hfg : ∀ a, f a =ᵐ[κ a] g a) :
withDensity κ f = withDensity κ g := by
ext a
rw [kernel.withDensity_apply _ hf,kernel.withDensity_apply _ hg, withDensity_congr_ae (hfg a)]
nonrec lemma withDensity_absolutelyContinuous [IsSFiniteKernel κ]
(f : α → β → ℝ≥0∞) (a : α) :
kernel.withDensity κ f a ≪ κ a := by
by_cases hf : Measurable (Function.uncurry f)
· rw [kernel.withDensity_apply _ hf]
exact withDensity_absolutelyContinuous _ _
· rw [withDensity_of_not_measurable _ hf]
simp [Measure.AbsolutelyContinuous.zero]
@[simp]
lemma withDensity_one (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ 1 = κ := by
ext; rw [kernel.withDensity_apply _ measurable_const]; simp
@[simp]
lemma withDensity_one' (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ (fun _ _ ↦ 1) = κ := kernel.withDensity_one _
@[simp]
lemma withDensity_zero (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ 0 = 0 := by
ext; rw [kernel.withDensity_apply _ measurable_const]; simp
@[simp]
lemma withDensity_zero' (κ : kernel α β) [IsSFiniteKernel κ] :
kernel.withDensity κ (fun _ _ ↦ 0) = 0 := kernel.withDensity_zero _
theorem lintegral_withDensity (κ : kernel α β) [IsSFiniteKernel κ]
(hf : Measurable (Function.uncurry f)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) :
∫⁻ b, g b ∂withDensity κ f a = ∫⁻ b, f a b * g b ∂κ a := by
rw [kernel.withDensity_apply _ hf,
lintegral_withDensity_eq_lintegral_mul _ (Measurable.of_uncurry_left hf) hg]
simp_rw [Pi.mul_apply]
#align probability_theory.kernel.lintegral_with_density ProbabilityTheory.kernel.lintegral_withDensity
theorem integral_withDensity {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{f : β → E} [IsSFiniteKernel κ] {a : α} {g : α → β → ℝ≥0}
(hg : Measurable (Function.uncurry g)) :
∫ b, f b ∂withDensity κ (fun a b => g a b) a = ∫ b, g a b • f b ∂κ a := by
rw [kernel.withDensity_apply, integral_withDensity_eq_integral_smul]
· exact Measurable.of_uncurry_left hg
· exact measurable_coe_nnreal_ennreal.comp hg
#align probability_theory.kernel.integral_with_density ProbabilityTheory.kernel.integral_withDensity
theorem withDensity_add_left (κ η : kernel α β) [IsSFiniteKernel κ] [IsSFiniteKernel η]
(f : α → β → ℝ≥0∞) : withDensity (κ + η) f = withDensity κ f + withDensity η f := by
by_cases hf : Measurable (Function.uncurry f)
· ext a s
simp only [kernel.withDensity_apply _ hf, coeFn_add, Pi.add_apply, withDensity_add_measure,
Measure.add_apply]
· simp_rw [withDensity_of_not_measurable _ hf]
rw [zero_add]
#align probability_theory.kernel.with_density_add_left ProbabilityTheory.kernel.withDensity_add_left
| Mathlib/Probability/Kernel/WithDensity.lean | 135 | 144 | theorem withDensity_kernel_sum [Countable ι] (κ : ι → kernel α β) (hκ : ∀ i, IsSFiniteKernel (κ i))
(f : α → β → ℝ≥0∞) :
@withDensity _ _ _ _ (kernel.sum κ) (isSFiniteKernel_sum hκ) f =
kernel.sum fun i => withDensity (κ i) f := by |
by_cases hf : Measurable (Function.uncurry f)
· ext1 a
simp_rw [sum_apply, kernel.withDensity_apply _ hf, sum_apply,
withDensity_sum (fun n => κ n a) (f a)]
· simp_rw [withDensity_of_not_measurable _ hf]
exact sum_zero.symm
| [
" (fun a => (κ a).withDensity (f a)) ∈ kernel α β",
" Measurable fun b => ((κ b).withDensity (f b)) s",
" Measurable fun b => ∫⁻ (a : β) in s, f b a ∂κ b",
" withDensity κ f = 0",
" (withDensity κ f) a = (κ a).withDensity (f a)",
" ⟨fun a => (κ a).withDensity (f a), ⋯⟩ a = (κ a).withDensity (f a)",
" ((... | [
" (fun a => (κ a).withDensity (f a)) ∈ kernel α β",
" Measurable fun b => ((κ b).withDensity (f b)) s",
" Measurable fun b => ∫⁻ (a : β) in s, f b a ∂κ b",
" withDensity κ f = 0",
" (withDensity κ f) a = (κ a).withDensity (f a)",
" ⟨fun a => (κ a).withDensity (f a), ⋯⟩ a = (κ a).withDensity (f a)",
" ((... |
import Mathlib.Data.ZMod.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Tactic.IntervalCases
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.GroupTheory.SpecificGroups.Cyclic
#align_import group_theory.specific_groups.quaternion from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
inductive QuaternionGroup (n : ℕ) : Type
| a : ZMod (2 * n) → QuaternionGroup n
| xa : ZMod (2 * n) → QuaternionGroup n
deriving DecidableEq
#align quaternion_group QuaternionGroup
namespace QuaternionGroup
variable {n : ℕ}
private def mul : QuaternionGroup n → QuaternionGroup n → QuaternionGroup n
| a i, a j => a (i + j)
| a i, xa j => xa (j - i)
| xa i, a j => xa (i + j)
| xa i, xa j => a (n + j - i)
private def one : QuaternionGroup n :=
a 0
instance : Inhabited (QuaternionGroup n) :=
⟨one⟩
private def inv : QuaternionGroup n → QuaternionGroup n
| a i => a (-i)
| xa i => xa (n + i)
instance : Group (QuaternionGroup n) where
mul := mul
mul_assoc := by
rintro (i | i) (j | j) (k | k) <;> simp only [(· * ·), mul] <;> ring_nf
congr
calc
-(n : ZMod (2 * n)) = 0 - n := by rw [zero_sub]
_ = 2 * n - n := by norm_cast; simp
_ = n := by ring
one := one
one_mul := by
rintro (i | i)
· exact congr_arg a (zero_add i)
· exact congr_arg xa (sub_zero i)
mul_one := by
rintro (i | i)
· exact congr_arg a (add_zero i)
· exact congr_arg xa (add_zero i)
inv := inv
mul_left_inv := by
rintro (i | i)
· exact congr_arg a (neg_add_self i)
· exact congr_arg a (sub_self (n + i))
@[simp]
theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) :=
rfl
#align quaternion_group.a_mul_a QuaternionGroup.a_mul_a
@[simp]
theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) :=
rfl
#align quaternion_group.a_mul_xa QuaternionGroup.a_mul_xa
@[simp]
theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) :=
rfl
#align quaternion_group.xa_mul_a QuaternionGroup.xa_mul_a
@[simp]
theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) :=
rfl
#align quaternion_group.xa_mul_xa QuaternionGroup.xa_mul_xa
theorem one_def : (1 : QuaternionGroup n) = a 0 :=
rfl
#align quaternion_group.one_def QuaternionGroup.one_def
private def fintypeHelper : Sum (ZMod (2 * n)) (ZMod (2 * n)) ≃ QuaternionGroup n where
invFun i :=
match i with
| a j => Sum.inl j
| xa j => Sum.inr j
toFun i :=
match i with
| Sum.inl j => a j
| Sum.inr j => xa j
left_inv := by rintro (x | x) <;> rfl
right_inv := by rintro (x | x) <;> rfl
def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 where
toFun i :=
-- Porting note: Originally `QuaternionGroup.recOn i DihedralGroup.r DihedralGroup.sr`
match i with
| a j => DihedralGroup.r j
| xa j => DihedralGroup.sr j
invFun i :=
match i with
| DihedralGroup.r j => a j
| DihedralGroup.sr j => xa j
left_inv := by rintro (k | k) <;> rfl
right_inv := by rintro (k | k) <;> rfl
map_mul' := by rintro (k | k) (l | l) <;> simp
#align quaternion_group.quaternion_group_zero_equiv_dihedral_group_zero QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero
instance [NeZero n] : Fintype (QuaternionGroup n) :=
Fintype.ofEquiv _ fintypeHelper
instance : Nontrivial (QuaternionGroup n) :=
⟨⟨a 0, xa 0, by revert n; simp⟩⟩ -- Porting note: `revert n; simp` was `decide`
theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n := by
rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul]
ring
#align quaternion_group.card QuaternionGroup.card
@[simp]
theorem a_one_pow (k : ℕ) : (a 1 : QuaternionGroup n) ^ k = a k := by
induction' k with k IH
· rw [Nat.cast_zero]; rfl
· rw [pow_succ, IH, a_mul_a]
congr 1
norm_cast
#align quaternion_group.a_one_pow QuaternionGroup.a_one_pow
-- @[simp] -- Porting note: simp changes this to `a 0 = 1`, so this is no longer a good simp lemma.
theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 := by
rw [a_one_pow, one_def]
congr 1
exact ZMod.natCast_self _
#align quaternion_group.a_one_pow_n QuaternionGroup.a_one_pow_n
@[simp]
| Mathlib/GroupTheory/SpecificGroups/Quaternion.lean | 196 | 196 | theorem xa_sq (i : ZMod (2 * n)) : xa i ^ 2 = a n := by | simp [sq]
| [
" ∀ (a b c : QuaternionGroup n), a * b * c = a * (b * c)",
" a i * a j * a k = a i * (a j * a k)",
" a i * a j * xa k = a i * (a j * xa k)",
" a i * xa j * a k = a i * (xa j * a k)",
" a i * xa j * xa k = a i * (xa j * xa k)",
" xa i * a j * a k = xa i * (a j * a k)",
" xa i * a j * xa k = xa i * (a j *... | [
" ∀ (a b c : QuaternionGroup n), a * b * c = a * (b * c)",
" a i * a j * a k = a i * (a j * a k)",
" a i * a j * xa k = a i * (a j * xa k)",
" a i * xa j * a k = a i * (xa j * a k)",
" a i * xa j * xa k = a i * (xa j * xa k)",
" xa i * a j * a k = xa i * (a j * a k)",
" xa i * a j * xa k = xa i * (a j *... |
import Mathlib.Algebra.Polynomial.Eval
#align_import data.polynomial.degree.lemmas from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
noncomputable section
open Polynomial
open Finsupp Finset
namespace Polynomial
universe u v w
variable {R : Type u} {S : Type v} {ι : Type w} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
section Degree
theorem natDegree_comp_le : natDegree (p.comp q) ≤ natDegree p * natDegree q :=
letI := Classical.decEq R
if h0 : p.comp q = 0 then by rw [h0, natDegree_zero]; exact Nat.zero_le _
else
WithBot.coe_le_coe.1 <|
calc
↑(natDegree (p.comp q)) = degree (p.comp q) := (degree_eq_natDegree h0).symm
_ = _ := congr_arg degree comp_eq_sum_left
_ ≤ _ := degree_sum_le _ _
_ ≤ _ :=
Finset.sup_le fun n hn =>
calc
degree (C (coeff p n) * q ^ n) ≤ degree (C (coeff p n)) + degree (q ^ n) :=
degree_mul_le _ _
_ ≤ natDegree (C (coeff p n)) + n • degree q :=
(add_le_add degree_le_natDegree (degree_pow_le _ _))
_ ≤ natDegree (C (coeff p n)) + n • ↑(natDegree q) :=
(add_le_add_left (nsmul_le_nsmul_right (@degree_le_natDegree _ _ q) n) _)
_ = (n * natDegree q : ℕ) := by
rw [natDegree_C, Nat.cast_zero, zero_add, nsmul_eq_mul];
simp
_ ≤ (natDegree p * natDegree q : ℕ) :=
WithBot.coe_le_coe.2 <|
mul_le_mul_of_nonneg_right (le_natDegree_of_ne_zero (mem_support_iff.1 hn))
(Nat.zero_le _)
#align polynomial.nat_degree_comp_le Polynomial.natDegree_comp_le
theorem degree_pos_of_root {p : R[X]} (hp : p ≠ 0) (h : IsRoot p a) : 0 < degree p :=
lt_of_not_ge fun hlt => by
have := eq_C_of_degree_le_zero hlt
rw [IsRoot, this, eval_C] at h
simp only [h, RingHom.map_zero] at this
exact hp this
#align polynomial.degree_pos_of_root Polynomial.degree_pos_of_root
theorem natDegree_le_iff_coeff_eq_zero : p.natDegree ≤ n ↔ ∀ N : ℕ, n < N → p.coeff N = 0 := by
simp_rw [natDegree_le_iff_degree_le, degree_le_iff_coeff_zero, Nat.cast_lt]
#align polynomial.nat_degree_le_iff_coeff_eq_zero Polynomial.natDegree_le_iff_coeff_eq_zero
theorem natDegree_add_le_iff_left {n : ℕ} (p q : R[X]) (qn : q.natDegree ≤ n) :
(p + q).natDegree ≤ n ↔ p.natDegree ≤ n := by
refine ⟨fun h => ?_, fun h => natDegree_add_le_of_degree_le h qn⟩
refine natDegree_le_iff_coeff_eq_zero.mpr fun m hm => ?_
convert natDegree_le_iff_coeff_eq_zero.mp h m hm using 1
rw [coeff_add, natDegree_le_iff_coeff_eq_zero.mp qn _ hm, add_zero]
#align polynomial.nat_degree_add_le_iff_left Polynomial.natDegree_add_le_iff_left
theorem natDegree_add_le_iff_right {n : ℕ} (p q : R[X]) (pn : p.natDegree ≤ n) :
(p + q).natDegree ≤ n ↔ q.natDegree ≤ n := by
rw [add_comm]
exact natDegree_add_le_iff_left _ _ pn
#align polynomial.nat_degree_add_le_iff_right Polynomial.natDegree_add_le_iff_right
theorem natDegree_C_mul_le (a : R) (f : R[X]) : (C a * f).natDegree ≤ f.natDegree :=
calc
(C a * f).natDegree ≤ (C a).natDegree + f.natDegree := natDegree_mul_le
_ = 0 + f.natDegree := by rw [natDegree_C a]
_ = f.natDegree := zero_add _
set_option linter.uppercaseLean3 false in
#align polynomial.nat_degree_C_mul_le Polynomial.natDegree_C_mul_le
theorem natDegree_mul_C_le (f : R[X]) (a : R) : (f * C a).natDegree ≤ f.natDegree :=
calc
(f * C a).natDegree ≤ f.natDegree + (C a).natDegree := natDegree_mul_le
_ = f.natDegree + 0 := by rw [natDegree_C a]
_ = f.natDegree := add_zero _
set_option linter.uppercaseLean3 false in
#align polynomial.nat_degree_mul_C_le Polynomial.natDegree_mul_C_le
theorem eq_natDegree_of_le_mem_support (pn : p.natDegree ≤ n) (ns : n ∈ p.support) :
p.natDegree = n :=
le_antisymm pn (le_natDegree_of_mem_supp _ ns)
#align polynomial.eq_nat_degree_of_le_mem_support Polynomial.eq_natDegree_of_le_mem_support
theorem natDegree_C_mul_eq_of_mul_eq_one {ai : R} (au : ai * a = 1) :
(C a * p).natDegree = p.natDegree :=
le_antisymm (natDegree_C_mul_le a p)
(calc
p.natDegree = (1 * p).natDegree := by nth_rw 1 [← one_mul p]
_ = (C ai * (C a * p)).natDegree := by rw [← C_1, ← au, RingHom.map_mul, ← mul_assoc]
_ ≤ (C a * p).natDegree := natDegree_C_mul_le ai (C a * p))
set_option linter.uppercaseLean3 false in
#align polynomial.nat_degree_C_mul_eq_of_mul_eq_one Polynomial.natDegree_C_mul_eq_of_mul_eq_one
| Mathlib/Algebra/Polynomial/Degree/Lemmas.lean | 121 | 127 | theorem natDegree_mul_C_eq_of_mul_eq_one {ai : R} (au : a * ai = 1) :
(p * C a).natDegree = p.natDegree :=
le_antisymm (natDegree_mul_C_le p a)
(calc
p.natDegree = (p * 1).natDegree := by | nth_rw 1 [← mul_one p]
_ = (p * C a * C ai).natDegree := by rw [← C_1, ← au, RingHom.map_mul, ← mul_assoc]
_ ≤ (p * C a).natDegree := natDegree_mul_C_le (p * C a) ai)
| [
" (p.comp q).natDegree ≤ p.natDegree * q.natDegree",
" 0 ≤ p.natDegree * q.natDegree",
" ↑(C (p.coeff n)).natDegree + n • ↑q.natDegree = ↑(n * q.natDegree)",
" ↑n * ↑q.natDegree = ↑(n * q.natDegree)",
" False",
" p.natDegree ≤ n ↔ ∀ (N : ℕ), n < N → p.coeff N = 0",
" (p + q).natDegree ≤ n ↔ p.natDegree ... | [
" (p.comp q).natDegree ≤ p.natDegree * q.natDegree",
" 0 ≤ p.natDegree * q.natDegree",
" ↑(C (p.coeff n)).natDegree + n • ↑q.natDegree = ↑(n * q.natDegree)",
" ↑n * ↑q.natDegree = ↑(n * q.natDegree)",
" False",
" p.natDegree ≤ n ↔ ∀ (N : ℕ), n < N → p.coeff N = 0",
" (p + q).natDegree ≤ n ↔ p.natDegree ... |
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.Aut
import Mathlib.Data.ZMod.Defs
import Mathlib.Tactic.Ring
#align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
open MulOpposite
universe u v
class Shelf (α : Type u) where
act : α → α → α
self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z)
#align shelf Shelf
class UnitalShelf (α : Type u) extends Shelf α, One α :=
(one_act : ∀ a : α, act 1 a = a)
(act_one : ∀ a : α, act a 1 = a)
#align unital_shelf UnitalShelf
@[ext]
structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where
toFun : S₁ → S₂
map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y)
#align shelf_hom ShelfHom
#align shelf_hom.ext_iff ShelfHom.ext_iff
#align shelf_hom.ext ShelfHom.ext
class Rack (α : Type u) extends Shelf α where
invAct : α → α → α
left_inv : ∀ x, Function.LeftInverse (invAct x) (act x)
right_inv : ∀ x, Function.RightInverse (invAct x) (act x)
#align rack Rack
scoped[Quandles] infixr:65 " ◃ " => Shelf.act
scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct
scoped[Quandles] infixr:25 " →◃ " => ShelfHom
open Quandles
namespace Rack
variable {R : Type*} [Rack R]
-- Porting note: No longer a need for `Rack.self_distrib`
export Shelf (self_distrib)
-- porting note, changed name to `act'` to not conflict with `Shelf.act`
def act' (x : R) : R ≃ R where
toFun := Shelf.act x
invFun := invAct x
left_inv := left_inv x
right_inv := right_inv x
#align rack.act Rack.act'
@[simp]
theorem act'_apply (x y : R) : act' x y = x ◃ y :=
rfl
#align rack.act_apply Rack.act'_apply
@[simp]
theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y :=
rfl
#align rack.act_symm_apply Rack.act'_symm_apply
@[simp]
theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y :=
rfl
#align rack.inv_act_apply Rack.invAct_apply
@[simp]
theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y :=
left_inv x y
#align rack.inv_act_act_eq Rack.invAct_act_eq
@[simp]
theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y :=
right_inv x y
#align rack.act_inv_act_eq Rack.act_invAct_eq
theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by
constructor
· apply (act' x).injective
rintro rfl
rfl
#align rack.left_cancel Rack.left_cancel
theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by
constructor
· apply (act' x).symm.injective
rintro rfl
rfl
#align rack.left_cancel_inv Rack.left_cancel_inv
theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by
rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib]
repeat' rw [right_inv]
#align rack.self_distrib_inv Rack.self_distrib_inv
| Mathlib/Algebra/Quandle.lean | 251 | 253 | theorem ad_conj {R : Type*} [Rack R] (x y : R) : act' (x ◃ y) = act' x * act' y * (act' x)⁻¹ := by |
rw [eq_mul_inv_iff_mul_eq]; ext z
apply self_distrib.symm
| [
" x ◃ y = x ◃ y' ↔ y = y'",
" x ◃ y = x ◃ y' → y = y'",
" y = y' → x ◃ y = x ◃ y'",
" x ◃ y = x ◃ y",
" x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'",
" x ◃⁻¹ y = x ◃⁻¹ y' → y = y'",
" y = y' → x ◃⁻¹ y = x ◃⁻¹ y'",
" x ◃⁻¹ y = x ◃⁻¹ y",
" x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z",
" (x ◃ x ◃⁻¹ y) ◃ x ◃ x ◃⁻¹ y ◃⁻¹ z ... | [
" x ◃ y = x ◃ y' ↔ y = y'",
" x ◃ y = x ◃ y' → y = y'",
" y = y' → x ◃ y = x ◃ y'",
" x ◃ y = x ◃ y",
" x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'",
" x ◃⁻¹ y = x ◃⁻¹ y' → y = y'",
" y = y' → x ◃⁻¹ y = x ◃⁻¹ y'",
" x ◃⁻¹ y = x ◃⁻¹ y",
" x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z",
" (x ◃ x ◃⁻¹ y) ◃ x ◃ x ◃⁻¹ y ◃⁻¹ z ... |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.Instances.NNReal
#align_import analysis.normed.group.infinite_sum from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Topology NNReal
open Finset Filter Metric
variable {ι α E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} :
(CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔
∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by
rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff]
· simp only [ball_zero_eq, Set.mem_setOf_eq]
· rintro s t hst ⟨s', hs'⟩
exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩
#align cauchy_seq_finset_iff_vanishing_norm cauchySeq_finset_iff_vanishing_norm
theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι → E} :
Summable f ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm]
#align summable_iff_vanishing_norm summable_iff_vanishing_norm
theorem cauchySeq_finset_of_norm_bounded_eventually {f : ι → E} {g : ι → ℝ} (hg : Summable g)
(h : ∀ᶠ i in cofinite, ‖f i‖ ≤ g i) : CauchySeq fun s => ∑ i ∈ s, f i := by
refine cauchySeq_finset_iff_vanishing_norm.2 fun ε hε => ?_
rcases summable_iff_vanishing_norm.1 hg ε hε with ⟨s, hs⟩
classical
refine ⟨s ∪ h.toFinset, fun t ht => ?_⟩
have : ∀ i ∈ t, ‖f i‖ ≤ g i := by
intro i hi
simp only [disjoint_left, mem_union, not_or, h.mem_toFinset, Set.mem_compl_iff,
Classical.not_not] at ht
exact (ht hi).2
calc
‖∑ i ∈ t, f i‖ ≤ ∑ i ∈ t, g i := norm_sum_le_of_le _ this
_ ≤ ‖∑ i ∈ t, g i‖ := le_abs_self _
_ < ε := hs _ (ht.mono_right le_sup_left)
#align cauchy_seq_finset_of_norm_bounded_eventually cauchySeq_finset_of_norm_bounded_eventually
theorem cauchySeq_finset_of_norm_bounded {f : ι → E} (g : ι → ℝ) (hg : Summable g)
(h : ∀ i, ‖f i‖ ≤ g i) : CauchySeq fun s : Finset ι => ∑ i ∈ s, f i :=
cauchySeq_finset_of_norm_bounded_eventually hg <| eventually_of_forall h
#align cauchy_seq_finset_of_norm_bounded cauchySeq_finset_of_norm_bounded
theorem cauchySeq_range_of_norm_bounded {f : ℕ → E} (g : ℕ → ℝ)
(hg : CauchySeq fun n => ∑ i ∈ range n, g i) (hf : ∀ i, ‖f i‖ ≤ g i) :
CauchySeq fun n => ∑ i ∈ range n, f i := by
refine Metric.cauchySeq_iff'.2 fun ε hε => ?_
refine (Metric.cauchySeq_iff'.1 hg ε hε).imp fun N hg n hn => ?_
specialize hg n hn
rw [dist_eq_norm, ← sum_Ico_eq_sub _ hn] at hg ⊢
calc
‖∑ k ∈ Ico N n, f k‖ ≤ ∑ k ∈ _, ‖f k‖ := norm_sum_le _ _
_ ≤ ∑ k ∈ _, g k := sum_le_sum fun x _ => hf x
_ ≤ ‖∑ k ∈ _, g k‖ := le_abs_self _
_ < ε := hg
#align cauchy_seq_range_of_norm_bounded cauchySeq_range_of_norm_bounded
theorem cauchySeq_finset_of_summable_norm {f : ι → E} (hf : Summable fun a => ‖f a‖) :
CauchySeq fun s : Finset ι => ∑ a ∈ s, f a :=
cauchySeq_finset_of_norm_bounded _ hf fun _i => le_rfl
#align cauchy_seq_finset_of_summable_norm cauchySeq_finset_of_summable_norm
theorem hasSum_of_subseq_of_summable {f : ι → E} (hf : Summable fun a => ‖f a‖) {s : α → Finset ι}
{p : Filter α} [NeBot p] (hs : Tendsto s p atTop) {a : E}
(ha : Tendsto (fun b => ∑ i ∈ s b, f i) p (𝓝 a)) : HasSum f a :=
tendsto_nhds_of_cauchySeq_of_subseq (cauchySeq_finset_of_summable_norm hf) hs ha
#align has_sum_of_subseq_of_summable hasSum_of_subseq_of_summable
theorem hasSum_iff_tendsto_nat_of_summable_norm {f : ℕ → E} {a : E} (hf : Summable fun i => ‖f i‖) :
HasSum f a ↔ Tendsto (fun n : ℕ => ∑ i ∈ range n, f i) atTop (𝓝 a) :=
⟨fun h => h.tendsto_sum_nat, fun h => hasSum_of_subseq_of_summable hf tendsto_finset_range h⟩
#align has_sum_iff_tendsto_nat_of_summable_norm hasSum_iff_tendsto_nat_of_summable_norm
| Mathlib/Analysis/Normed/Group/InfiniteSum.lean | 113 | 116 | theorem Summable.of_norm_bounded [CompleteSpace E] {f : ι → E} (g : ι → ℝ) (hg : Summable g)
(h : ∀ i, ‖f i‖ ≤ g i) : Summable f := by |
rw [summable_iff_cauchySeq_finset]
exact cauchySeq_finset_of_norm_bounded g hg h
| [
" (CauchySeq fun s => ∑ i ∈ s, f i) ↔ ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" (∀ (i : ℝ), 0 < i → ∃ s, ∀ (t : Finset ι), Disjoint t s → ∑ b ∈ t, f b ∈ ball 0 i) ↔\n ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" ∀ ⦃s t : Set E⦄,\n s ⊆ t →\n (∃ s_1,... | [
" (CauchySeq fun s => ∑ i ∈ s, f i) ↔ ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" (∀ (i : ℝ), 0 < i → ∃ s, ∀ (t : Finset ι), Disjoint t s → ∑ b ∈ t, f b ∈ ball 0 i) ↔\n ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" ∀ ⦃s t : Set E⦄,\n s ⊆ t →\n (∃ s_1,... |
import Mathlib.MeasureTheory.Measure.Haar.Basic
import Mathlib.Analysis.NormedSpace.FiniteDimension
import Mathlib.MeasureTheory.Measure.Haar.Unique
open MeasureTheory Measure Set
open scoped ENNReal
variable {𝕜 E F : Type*}
[NontriviallyNormedField 𝕜] [CompleteSpace 𝕜]
[NormedAddCommGroup E] [MeasurableSpace E] [BorelSpace E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [MeasurableSpace F] [BorelSpace F] [NormedSpace 𝕜 F] {L : E →ₗ[𝕜] F}
{μ : Measure E} {ν : Measure F}
[IsAddHaarMeasure μ] [IsAddHaarMeasure ν]
variable [LocallyCompactSpace E]
variable (L μ ν)
theorem LinearMap.exists_map_addHaar_eq_smul_addHaar' (h : Function.Surjective L) :
∃ (c : ℝ≥0∞), 0 < c ∧ c < ∞ ∧ μ.map L = (c * addHaar (univ : Set (LinearMap.ker L))) • ν := by
have : ProperSpace E := .of_locallyCompactSpace 𝕜
have : FiniteDimensional 𝕜 E := .of_locallyCompactSpace 𝕜
have : ProperSpace F := by
rcases subsingleton_or_nontrivial E with hE|hE
· have : Subsingleton F := Function.Surjective.subsingleton h
infer_instance
· have : ProperSpace 𝕜 := .of_locallyCompact_module 𝕜 E
have : FiniteDimensional 𝕜 F := Module.Finite.of_surjective L h
exact FiniteDimensional.proper 𝕜 F
let S : Submodule 𝕜 E := LinearMap.ker L
obtain ⟨T, hT⟩ : ∃ T : Submodule 𝕜 E, IsCompl S T := Submodule.exists_isCompl S
let M : (S × T) ≃ₗ[𝕜] E := Submodule.prodEquivOfIsCompl S T hT
have M_cont : Continuous M.symm := LinearMap.continuous_of_finiteDimensional _
let P : S × T →ₗ[𝕜] T := LinearMap.snd 𝕜 S T
have P_cont : Continuous P := LinearMap.continuous_of_finiteDimensional _
have I : Function.Bijective (LinearMap.domRestrict L T) :=
⟨LinearMap.injective_domRestrict_iff.2 (IsCompl.inf_eq_bot hT.symm),
(LinearMap.surjective_domRestrict_iff h).2 hT.symm.sup_eq_top⟩
let L' : T ≃ₗ[𝕜] F := LinearEquiv.ofBijective (LinearMap.domRestrict L T) I
have L'_cont : Continuous L' := LinearMap.continuous_of_finiteDimensional _
have A : L = (L' : T →ₗ[𝕜] F).comp (P.comp (M.symm : E →ₗ[𝕜] (S × T))) := by
ext x
obtain ⟨y, z, hyz⟩ : ∃ (y : S) (z : T), M.symm x = (y, z) := ⟨_, _, rfl⟩
have : x = M (y, z) := by
rw [← hyz]; simp only [LinearEquiv.apply_symm_apply]
simp [L', P, M, this]
have I : μ.map L = ((μ.map M.symm).map P).map L' := by
rw [Measure.map_map, Measure.map_map, A]
· rfl
· exact L'_cont.measurable.comp P_cont.measurable
· exact M_cont.measurable
· exact L'_cont.measurable
· exact P_cont.measurable
let μS : Measure S := addHaar
let μT : Measure T := addHaar
obtain ⟨c₀, c₀_pos, c₀_fin, h₀⟩ :
∃ c₀ : ℝ≥0∞, c₀ ≠ 0 ∧ c₀ ≠ ∞ ∧ μ.map M.symm = c₀ • μS.prod μT := by
have : IsAddHaarMeasure (μ.map M.symm) :=
M.toContinuousLinearEquiv.symm.isAddHaarMeasure_map μ
refine ⟨addHaarScalarFactor (μ.map M.symm) (μS.prod μT), ?_, ENNReal.coe_ne_top,
isAddLeftInvariant_eq_smul _ _⟩
simpa only [ne_eq, ENNReal.coe_eq_zero] using
(addHaarScalarFactor_pos_of_isAddHaarMeasure (μ.map M.symm) (μS.prod μT)).ne'
have J : (μS.prod μT).map P = (μS univ) • μT := map_snd_prod
obtain ⟨c₁, c₁_pos, c₁_fin, h₁⟩ : ∃ c₁ : ℝ≥0∞, c₁ ≠ 0 ∧ c₁ ≠ ∞ ∧ μT.map L' = c₁ • ν := by
have : IsAddHaarMeasure (μT.map L') :=
L'.toContinuousLinearEquiv.isAddHaarMeasure_map μT
refine ⟨addHaarScalarFactor (μT.map L') ν, ?_, ENNReal.coe_ne_top,
isAddLeftInvariant_eq_smul _ _⟩
simpa only [ne_eq, ENNReal.coe_eq_zero] using
(addHaarScalarFactor_pos_of_isAddHaarMeasure (μT.map L') ν).ne'
refine ⟨c₀ * c₁, by simp [pos_iff_ne_zero, c₀_pos, c₁_pos], ENNReal.mul_lt_top c₀_fin c₁_fin, ?_⟩
simp only [I, h₀, Measure.map_smul, J, smul_smul, h₁]
rw [mul_assoc, mul_comm _ c₁, ← mul_assoc]
| Mathlib/MeasureTheory/Measure/Haar/Disintegration.lean | 106 | 109 | theorem LinearMap.exists_map_addHaar_eq_smul_addHaar (h : Function.Surjective L) :
∃ (c : ℝ≥0∞), 0 < c ∧ μ.map L = c • ν := by |
rcases L.exists_map_addHaar_eq_smul_addHaar' μ ν h with ⟨c, c_pos, -, hc⟩
exact ⟨_, by simp [c_pos, NeZero.ne addHaar], hc⟩
| [
" ∃ c, 0 < c ∧ c < ⊤ ∧ map (⇑L) μ = (c * addHaar univ) • ν",
" ProperSpace F",
" L = ↑L' ∘ₗ P ∘ₗ ↑M.symm",
" L x = (↑L' ∘ₗ P ∘ₗ ↑M.symm) x",
" x = M (y, z)",
" x = M (M.symm x)",
" map (⇑L) μ = map (⇑L') (map (⇑P) (map (⇑M.symm) μ))",
" map (⇑(↑L' ∘ₗ P ∘ₗ ↑M.symm)) μ = map ((⇑L' ∘ ⇑P) ∘ ⇑M.symm) μ",
... | [
" ∃ c, 0 < c ∧ c < ⊤ ∧ map (⇑L) μ = (c * addHaar univ) • ν",
" ProperSpace F",
" L = ↑L' ∘ₗ P ∘ₗ ↑M.symm",
" L x = (↑L' ∘ₗ P ∘ₗ ↑M.symm) x",
" x = M (y, z)",
" x = M (M.symm x)",
" map (⇑L) μ = map (⇑L') (map (⇑P) (map (⇑M.symm) μ))",
" map (⇑(↑L' ∘ₗ P ∘ₗ ↑M.symm)) μ = map ((⇑L' ∘ ⇑P) ∘ ⇑M.symm) μ",
... |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section CommRing
variable [CommRing R]
theorem le_rootMultiplicity_iff {p : R[X]} (p0 : p ≠ 0) {a : R} {n : ℕ} :
n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p := by
classical
rw [rootMultiplicity_eq_nat_find_of_nonzero p0, @Nat.le_find_iff _ (_)]
simp_rw [Classical.not_not]
refine ⟨fun h => ?_, fun h m hm => (pow_dvd_pow _ hm).trans h⟩
cases' n with n;
· rw [pow_zero]
apply one_dvd;
· exact h n n.lt_succ_self
#align polynomial.le_root_multiplicity_iff Polynomial.le_rootMultiplicity_iff
theorem rootMultiplicity_le_iff {p : R[X]} (p0 : p ≠ 0) (a : R) (n : ℕ) :
rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣ p := by
rw [← (le_rootMultiplicity_iff p0).not, not_le, Nat.lt_add_one_iff]
#align polynomial.root_multiplicity_le_iff Polynomial.rootMultiplicity_le_iff
| Mathlib/Algebra/Polynomial/RingDivision.lean | 444 | 445 | theorem pow_rootMultiplicity_not_dvd {p : R[X]} (p0 : p ≠ 0) (a : R) :
¬(X - C a) ^ (rootMultiplicity a p + 1) ∣ p := by | rw [← rootMultiplicity_le_iff p0]
| [
" n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p",
" (∀ m < n, ¬¬(X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p",
" (∀ m < n, (X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p",
" (X - C a) ^ n ∣ p",
" (X - C a) ^ 0 ∣ p",
" 1 ∣ p",
" (X - C a) ^ (n + 1) ∣ p",
" rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣... | [
" n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p",
" (∀ m < n, ¬¬(X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p",
" (∀ m < n, (X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p",
" (X - C a) ^ n ∣ p",
" (X - C a) ^ 0 ∣ p",
" 1 ∣ p",
" (X - C a) ^ (n + 1) ∣ p",
" rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣... |
import Mathlib.RingTheory.FractionalIdeal.Basic
import Mathlib.RingTheory.Ideal.Norm
namespace FractionalIdeal
open scoped Pointwise nonZeroDivisors
variable {R : Type*} [CommRing R] [IsDedekindDomain R] [Module.Free ℤ R] [Module.Finite ℤ R]
variable {K : Type*} [CommRing K] [Algebra R K] [IsFractionRing R K]
theorem absNorm_div_norm_eq_absNorm_div_norm {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
(Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den:R)| =
(Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [div_eq_div_iff]
· replace h := congr_arg (I.den • ·) h
have h' := congr_arg (a • ·) (den_mul_self_eq_num I)
dsimp only at h h'
rw [smul_comm] at h
rw [h, Submonoid.smul_def, Submonoid.smul_def, ← Submodule.ideal_span_singleton_smul,
← Submodule.ideal_span_singleton_smul, ← Submodule.map_smul'', ← Submodule.map_smul'',
(LinearMap.map_injective ?_).eq_iff, smul_eq_mul, smul_eq_mul] at h'
· simp_rw [← Int.cast_natAbs, ← Nat.cast_mul, ← Ideal.absNorm_span_singleton]
rw [← _root_.map_mul, ← _root_.map_mul, mul_comm, ← h', mul_comm]
· exact LinearMap.ker_eq_bot.mpr (IsFractionRing.injective R K)
all_goals simpa [Algebra.norm_eq_zero_iff] using nonZeroDivisors.coe_ne_zero _
noncomputable def absNorm : FractionalIdeal R⁰ K →*₀ ℚ where
toFun I := (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)|
map_zero' := by
dsimp only
rw [num_zero_eq, Submodule.zero_eq_bot, Ideal.absNorm_bot, Nat.cast_zero, zero_div]
exact IsFractionRing.injective R K
map_one' := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm 1 ⊤ (by simp [Submodule.one_eq_range]),
Ideal.absNorm_top, Nat.cast_one, OneMemClass.coe_one, _root_.map_one, abs_one, Int.cast_one,
one_div_one]
map_mul' I J := by
dsimp only
rw [absNorm_div_norm_eq_absNorm_div_norm (I.den * J.den) (I.num * J.num) (by
have : Algebra.linearMap R K = (IsScalarTower.toAlgHom R R K).toLinearMap := rfl
rw [coe_mul, this, Submodule.map_mul, ← this, ← den_mul_self_eq_num, ← den_mul_self_eq_num]
exact Submodule.mul_smul_mul_eq_smul_mul_smul _ _ _ _),
Submonoid.coe_mul, _root_.map_mul, _root_.map_mul, Nat.cast_mul, div_mul_div_comm,
Int.cast_abs, Int.cast_abs, Int.cast_abs, ← abs_mul, Int.cast_mul]
theorem absNorm_eq (I : FractionalIdeal R⁰ K) :
absNorm I = (Ideal.absNorm I.num : ℚ) / |Algebra.norm ℤ (I.den : R)| := rfl
theorem absNorm_eq' {I : FractionalIdeal R⁰ K} (a : R⁰) (I₀ : Ideal R)
(h : a • (I : Submodule R K) = Submodule.map (Algebra.linearMap R K) I₀) :
absNorm I = (Ideal.absNorm I₀ : ℚ) / |Algebra.norm ℤ (a:R)| := by
rw [absNorm, ← absNorm_div_norm_eq_absNorm_div_norm a I₀ h, MonoidWithZeroHom.coe_mk,
ZeroHom.coe_mk]
| Mathlib/RingTheory/FractionalIdeal/Norm.lean | 84 | 84 | theorem absNorm_nonneg (I : FractionalIdeal R⁰ K) : 0 ≤ absNorm I := by | dsimp [absNorm]; positivity
| [
" ↑(Ideal.absNorm I.num) / ↑|(Algebra.norm ℤ) ↑I.den| = ↑(Ideal.absNorm I₀) / ↑|(Algebra.norm ℤ) ↑a|",
" ↑(Ideal.absNorm I.num) * ↑|(Algebra.norm ℤ) ↑a| = ↑(Ideal.absNorm I₀) * ↑|(Algebra.norm ℤ) ↑I.den|",
" ↑(Ideal.absNorm I.num * Ideal.absNorm (Ideal.span {↑a})) = ↑(Ideal.absNorm I₀ * Ideal.absNorm (Ideal.spa... | [
" ↑(Ideal.absNorm I.num) / ↑|(Algebra.norm ℤ) ↑I.den| = ↑(Ideal.absNorm I₀) / ↑|(Algebra.norm ℤ) ↑a|",
" ↑(Ideal.absNorm I.num) * ↑|(Algebra.norm ℤ) ↑a| = ↑(Ideal.absNorm I₀) * ↑|(Algebra.norm ℤ) ↑I.den|",
" ↑(Ideal.absNorm I.num * Ideal.absNorm (Ideal.span {↑a})) = ↑(Ideal.absNorm I₀ * Ideal.absNorm (Ideal.spa... |
import Mathlib.Algebra.Group.Fin
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import linear_algebra.matrix.circulant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
variable {α β m n R : Type*}
namespace Matrix
open Function
open Matrix
def circulant [Sub n] (v : n → α) : Matrix n n α :=
of fun i j => v (i - j)
#align matrix.circulant Matrix.circulant
-- TODO: set as an equation lemma for `circulant`, see mathlib4#3024
@[simp]
theorem circulant_apply [Sub n] (v : n → α) (i j) : circulant v i j = v (i - j) := rfl
#align matrix.circulant_apply Matrix.circulant_apply
theorem circulant_col_zero_eq [AddGroup n] (v : n → α) (i : n) : circulant v i 0 = v i :=
congr_arg v (sub_zero _)
#align matrix.circulant_col_zero_eq Matrix.circulant_col_zero_eq
theorem circulant_injective [AddGroup n] : Injective (circulant : (n → α) → Matrix n n α) := by
intro v w h
ext k
rw [← circulant_col_zero_eq v, ← circulant_col_zero_eq w, h]
#align matrix.circulant_injective Matrix.circulant_injective
theorem Fin.circulant_injective : ∀ n, Injective fun v : Fin n → α => circulant v
| 0 => by simp [Injective]
| n + 1 => Matrix.circulant_injective
#align matrix.fin.circulant_injective Matrix.Fin.circulant_injective
@[simp]
theorem circulant_inj [AddGroup n] {v w : n → α} : circulant v = circulant w ↔ v = w :=
circulant_injective.eq_iff
#align matrix.circulant_inj Matrix.circulant_inj
@[simp]
theorem Fin.circulant_inj {n} {v w : Fin n → α} : circulant v = circulant w ↔ v = w :=
(Fin.circulant_injective n).eq_iff
#align matrix.fin.circulant_inj Matrix.Fin.circulant_inj
theorem transpose_circulant [AddGroup n] (v : n → α) :
(circulant v)ᵀ = circulant fun i => v (-i) := by ext; simp
#align matrix.transpose_circulant Matrix.transpose_circulant
theorem conjTranspose_circulant [Star α] [AddGroup n] (v : n → α) :
(circulant v)ᴴ = circulant (star fun i => v (-i)) := by ext; simp
#align matrix.conj_transpose_circulant Matrix.conjTranspose_circulant
theorem Fin.transpose_circulant : ∀ {n} (v : Fin n → α), (circulant v)ᵀ = circulant fun i => v (-i)
| 0 => by simp [Injective, eq_iff_true_of_subsingleton]
| n + 1 => Matrix.transpose_circulant
#align matrix.fin.transpose_circulant Matrix.Fin.transpose_circulant
theorem Fin.conjTranspose_circulant [Star α] :
∀ {n} (v : Fin n → α), (circulant v)ᴴ = circulant (star fun i => v (-i))
| 0 => by simp [Injective, eq_iff_true_of_subsingleton]
| n + 1 => Matrix.conjTranspose_circulant
#align matrix.fin.conj_transpose_circulant Matrix.Fin.conjTranspose_circulant
theorem map_circulant [Sub n] (v : n → α) (f : α → β) :
(circulant v).map f = circulant fun i => f (v i) :=
ext fun _ _ => rfl
#align matrix.map_circulant Matrix.map_circulant
theorem circulant_neg [Neg α] [Sub n] (v : n → α) : circulant (-v) = -circulant v :=
ext fun _ _ => rfl
#align matrix.circulant_neg Matrix.circulant_neg
@[simp]
theorem circulant_zero (α n) [Zero α] [Sub n] : circulant 0 = (0 : Matrix n n α) :=
ext fun _ _ => rfl
#align matrix.circulant_zero Matrix.circulant_zero
theorem circulant_add [Add α] [Sub n] (v w : n → α) :
circulant (v + w) = circulant v + circulant w :=
ext fun _ _ => rfl
#align matrix.circulant_add Matrix.circulant_add
theorem circulant_sub [Sub α] [Sub n] (v w : n → α) :
circulant (v - w) = circulant v - circulant w :=
ext fun _ _ => rfl
#align matrix.circulant_sub Matrix.circulant_sub
| Mathlib/LinearAlgebra/Matrix/Circulant.lean | 126 | 132 | theorem circulant_mul [Semiring α] [Fintype n] [AddGroup n] (v w : n → α) :
circulant v * circulant w = circulant (circulant v *ᵥ w) := by |
ext i j
simp only [mul_apply, mulVec, circulant_apply, dotProduct]
refine Fintype.sum_equiv (Equiv.subRight j) _ _ ?_
intro x
simp only [Equiv.subRight_apply, sub_sub_sub_cancel_right]
| [
" Injective circulant",
" v = w",
" v k = w k",
" Injective fun v => circulant v",
" (circulant v)ᵀ = circulant fun i => v (-i)",
" (circulant v)ᵀ i✝ j✝ = circulant (fun i => v (-i)) i✝ j✝",
" (circulant v)ᴴ = circulant (star fun i => v (-i))",
" (circulant v)ᴴ i✝ j✝ = circulant (star fun i => v (-i))... | [
" Injective circulant",
" v = w",
" v k = w k",
" Injective fun v => circulant v",
" (circulant v)ᵀ = circulant fun i => v (-i)",
" (circulant v)ᵀ i✝ j✝ = circulant (fun i => v (-i)) i✝ j✝",
" (circulant v)ᴴ = circulant (star fun i => v (-i))",
" (circulant v)ᴴ i✝ j✝ = circulant (star fun i => v (-i))... |
import Mathlib.Topology.Bases
import Mathlib.Topology.DenseEmbedding
#align_import topology.stone_cech from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
noncomputable section
open Filter Set
open Topology
universe u v
section Ultrafilter
def ultrafilterBasis (α : Type u) : Set (Set (Ultrafilter α)) :=
range fun s : Set α => { u | s ∈ u }
#align ultrafilter_basis ultrafilterBasis
variable {α : Type u}
instance Ultrafilter.topologicalSpace : TopologicalSpace (Ultrafilter α) :=
TopologicalSpace.generateFrom (ultrafilterBasis α)
#align ultrafilter.topological_space Ultrafilter.topologicalSpace
theorem ultrafilterBasis_is_basis : TopologicalSpace.IsTopologicalBasis (ultrafilterBasis α) :=
⟨by
rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ u ⟨ua, ub⟩
refine ⟨_, ⟨a ∩ b, rfl⟩, inter_mem ua ub, fun v hv => ⟨?_, ?_⟩⟩ <;> apply mem_of_superset hv <;>
simp [inter_subset_right],
eq_univ_of_univ_subset <| subset_sUnion_of_mem <| ⟨univ, eq_univ_of_forall fun u => univ_mem⟩,
rfl⟩
#align ultrafilter_basis_is_basis ultrafilterBasis_is_basis
theorem ultrafilter_isOpen_basic (s : Set α) : IsOpen { u : Ultrafilter α | s ∈ u } :=
ultrafilterBasis_is_basis.isOpen ⟨s, rfl⟩
#align ultrafilter_is_open_basic ultrafilter_isOpen_basic
theorem ultrafilter_isClosed_basic (s : Set α) : IsClosed { u : Ultrafilter α | s ∈ u } := by
rw [← isOpen_compl_iff]
convert ultrafilter_isOpen_basic sᶜ using 1
ext u
exact Ultrafilter.compl_mem_iff_not_mem.symm
#align ultrafilter_is_closed_basic ultrafilter_isClosed_basic
theorem ultrafilter_converges_iff {u : Ultrafilter (Ultrafilter α)} {x : Ultrafilter α} :
↑u ≤ 𝓝 x ↔ x = joinM u := by
rw [eq_comm, ← Ultrafilter.coe_le_coe]
change ↑u ≤ 𝓝 x ↔ ∀ s ∈ x, { v : Ultrafilter α | s ∈ v } ∈ u
simp only [TopologicalSpace.nhds_generateFrom, le_iInf_iff, ultrafilterBasis, le_principal_iff,
mem_setOf_eq]
constructor
· intro h a ha
exact h _ ⟨ha, a, rfl⟩
· rintro h a ⟨xi, a, rfl⟩
exact h _ xi
#align ultrafilter_converges_iff ultrafilter_converges_iff
instance ultrafilter_compact : CompactSpace (Ultrafilter α) :=
⟨isCompact_iff_ultrafilter_le_nhds.mpr fun f _ =>
⟨joinM f, trivial, ultrafilter_converges_iff.mpr rfl⟩⟩
#align ultrafilter_compact ultrafilter_compact
instance Ultrafilter.t2Space : T2Space (Ultrafilter α) :=
t2_iff_ultrafilter.mpr @fun x y f fx fy =>
have hx : x = joinM f := ultrafilter_converges_iff.mp fx
have hy : y = joinM f := ultrafilter_converges_iff.mp fy
hx.trans hy.symm
#align ultrafilter.t2_space Ultrafilter.t2Space
instance : TotallyDisconnectedSpace (Ultrafilter α) := by
rw [totallyDisconnectedSpace_iff_connectedComponent_singleton]
intro A
simp only [Set.eq_singleton_iff_unique_mem, mem_connectedComponent, true_and_iff]
intro B hB
rw [← Ultrafilter.coe_le_coe]
intro s hs
rw [connectedComponent_eq_iInter_isClopen, Set.mem_iInter] at hB
let Z := { F : Ultrafilter α | s ∈ F }
have hZ : IsClopen Z := ⟨ultrafilter_isClosed_basic s, ultrafilter_isOpen_basic s⟩
exact hB ⟨Z, hZ, hs⟩
@[simp] theorem Ultrafilter.tendsto_pure_self (b : Ultrafilter α) : Tendsto pure b (𝓝 b) := by
rw [Tendsto, ← coe_map, ultrafilter_converges_iff]
ext s
change s ∈ b ↔ {t | s ∈ t} ∈ map pure b
simp_rw [mem_map, preimage_setOf_eq, mem_pure, setOf_mem_eq]
theorem ultrafilter_comap_pure_nhds (b : Ultrafilter α) : comap pure (𝓝 b) ≤ b := by
rw [TopologicalSpace.nhds_generateFrom]
simp only [comap_iInf, comap_principal]
intro s hs
rw [← le_principal_iff]
refine iInf_le_of_le { u | s ∈ u } ?_
refine iInf_le_of_le ⟨hs, ⟨s, rfl⟩⟩ ?_
exact principal_mono.2 fun a => id
#align ultrafilter_comap_pure_nhds ultrafilter_comap_pure_nhds
section Embedding
| Mathlib/Topology/StoneCech.lean | 122 | 126 | theorem ultrafilter_pure_injective : Function.Injective (pure : α → Ultrafilter α) := by |
intro x y h
have : {x} ∈ (pure x : Ultrafilter α) := singleton_mem_pure
rw [h] at this
exact (mem_singleton_iff.mp (mem_pure.mp this)).symm
| [
" ∀ t₁ ∈ ultrafilterBasis α, ∀ t₂ ∈ ultrafilterBasis α, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ ultrafilterBasis α, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂",
" ∃ t₃ ∈ ultrafilterBasis α, u ∈ t₃ ∧ t₃ ⊆ (fun s => {u | s ∈ u}) a ∩ (fun s => {u | s ∈ u}) b",
" v ∈ (fun s => {u | s ∈ u}) a",
" v ∈ (fun s => {u | s ∈ u}) b",
" a ∩ b ⊆ a",
" a ∩ b... | [
" ∀ t₁ ∈ ultrafilterBasis α, ∀ t₂ ∈ ultrafilterBasis α, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ ultrafilterBasis α, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂",
" ∃ t₃ ∈ ultrafilterBasis α, u ∈ t₃ ∧ t₃ ⊆ (fun s => {u | s ∈ u}) a ∩ (fun s => {u | s ∈ u}) b",
" v ∈ (fun s => {u | s ∈ u}) a",
" v ∈ (fun s => {u | s ∈ u}) b",
" a ∩ b ⊆ a",
" a ∩ b... |
import Mathlib.Combinatorics.Hall.Finite
import Mathlib.CategoryTheory.CofilteredSystem
import Mathlib.Data.Rel
#align_import combinatorics.hall.basic from "leanprover-community/mathlib"@"8195826f5c428fc283510bc67303dd4472d78498"
open Finset CategoryTheory
universe u v
def hallMatchingsOn {ι : Type u} {α : Type v} (t : ι → Finset α) (ι' : Finset ι) :=
{ f : ι' → α | Function.Injective f ∧ ∀ x, f x ∈ t x }
#align hall_matchings_on hallMatchingsOn
def hallMatchingsOn.restrict {ι : Type u} {α : Type v} (t : ι → Finset α) {ι' ι'' : Finset ι}
(h : ι' ⊆ ι'') (f : hallMatchingsOn t ι'') : hallMatchingsOn t ι' := by
refine ⟨fun i => f.val ⟨i, h i.property⟩, ?_⟩
cases' f.property with hinj hc
refine ⟨?_, fun i => hc ⟨i, h i.property⟩⟩
rintro ⟨i, hi⟩ ⟨j, hj⟩ hh
simpa only [Subtype.mk_eq_mk] using hinj hh
#align hall_matchings_on.restrict hallMatchingsOn.restrict
| Mathlib/Combinatorics/Hall/Basic.lean | 77 | 86 | theorem hallMatchingsOn.nonempty {ι : Type u} {α : Type v} [DecidableEq α] (t : ι → Finset α)
(h : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (ι' : Finset ι) :
Nonempty (hallMatchingsOn t ι') := by |
classical
refine ⟨Classical.indefiniteDescription _ ?_⟩
apply (all_card_le_biUnion_card_iff_existsInjective' fun i : ι' => t i).mp
intro s'
convert h (s'.image (↑)) using 1
· simp only [card_image_of_injective s' Subtype.coe_injective]
· rw [image_biUnion]
| [
" ↑(hallMatchingsOn t ι')",
" (fun i => ↑f ⟨↑i, ⋯⟩) ∈ hallMatchingsOn t ι'",
" Function.Injective fun i => ↑f ⟨↑i, ⋯⟩",
" ⟨i, hi⟩ = ⟨j, hj⟩",
" Nonempty ↑(hallMatchingsOn t ι')",
" ∃ x, x ∈ hallMatchingsOn t ι'",
" ∀ (s : Finset { x // x ∈ ι' }), s.card ≤ (s.biUnion fun i => t ↑i).card",
" s'.card ≤ (... | [
" ↑(hallMatchingsOn t ι')",
" (fun i => ↑f ⟨↑i, ⋯⟩) ∈ hallMatchingsOn t ι'",
" Function.Injective fun i => ↑f ⟨↑i, ⋯⟩",
" ⟨i, hi⟩ = ⟨j, hj⟩"
] |
import Mathlib.Probability.ConditionalProbability
import Mathlib.MeasureTheory.Measure.Count
#align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4"
noncomputable section
open ProbabilityTheory
open MeasureTheory MeasurableSpace
namespace ProbabilityTheory
variable {Ω : Type*} [MeasurableSpace Ω]
def condCount (s : Set Ω) : Measure Ω :=
Measure.count[|s]
#align probability_theory.cond_count ProbabilityTheory.condCount
@[simp]
theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount]
#align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas
theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp
#align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty
theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by
by_contra hs'
simp [condCount, cond, Measure.count_apply_infinite hs'] at h
#align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero
theorem condCount_univ [Fintype Ω] {s : Set Ω} :
condCount Set.univ s = Measure.count s / Fintype.card Ω := by
rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter]
congr
rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)]
· simp [Finset.card_univ]
· exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ
#align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ
variable [MeasurableSingletonClass Ω]
theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) :
IsProbabilityMeasure (condCount s) :=
{ measure_univ := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel]
· exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h
· exact (Measure.count_apply_lt_top.2 hs).ne }
#align probability_theory.cond_count_is_probability_measure ProbabilityTheory.condCount_isProbabilityMeasure
theorem condCount_singleton (ω : Ω) (t : Set Ω) [Decidable (ω ∈ t)] :
condCount {ω} t = if ω ∈ t then 1 else 0 := by
rw [condCount, cond_apply _ (measurableSet_singleton ω), Measure.count_singleton, inv_one,
one_mul]
split_ifs
· rw [(by simpa : ({ω} : Set Ω) ∩ t = {ω}), Measure.count_singleton]
· rw [(by simpa : ({ω} : Set Ω) ∩ t = ∅), Measure.count_empty]
#align probability_theory.cond_count_singleton ProbabilityTheory.condCount_singleton
variable {s t u : Set Ω}
theorem condCount_inter_self (hs : s.Finite) : condCount s (s ∩ t) = condCount s t := by
rw [condCount, cond_inter_self _ hs.measurableSet]
#align probability_theory.cond_count_inter_self ProbabilityTheory.condCount_inter_self
theorem condCount_self (hs : s.Finite) (hs' : s.Nonempty) : condCount s s = 1 := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_self, ENNReal.inv_mul_cancel]
· exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h
· exact (Measure.count_apply_lt_top.2 hs).ne
#align probability_theory.cond_count_self ProbabilityTheory.condCount_self
theorem condCount_eq_one_of (hs : s.Finite) (hs' : s.Nonempty) (ht : s ⊆ t) :
condCount s t = 1 := by
haveI := condCount_isProbabilityMeasure hs hs'
refine eq_of_le_of_not_lt prob_le_one ?_
rw [not_lt, ← condCount_self hs hs']
exact measure_mono ht
#align probability_theory.cond_count_eq_one_of ProbabilityTheory.condCount_eq_one_of
theorem pred_true_of_condCount_eq_one (h : condCount s t = 1) : s ⊆ t := by
have hsf := finite_of_condCount_ne_zero (by rw [h]; exact one_ne_zero)
rw [condCount, cond_apply _ hsf.measurableSet, mul_comm] at h
replace h := ENNReal.eq_inv_of_mul_eq_one_left h
rw [inv_inv, Measure.count_apply_finite _ hsf, Measure.count_apply_finite _ (hsf.inter_of_left _),
Nat.cast_inj] at h
suffices s ∩ t = s by exact this ▸ fun x hx => hx.2
rw [← @Set.Finite.toFinset_inj _ _ _ (hsf.inter_of_left _) hsf]
exact Finset.eq_of_subset_of_card_le (Set.Finite.toFinset_mono s.inter_subset_left) h.ge
#align probability_theory.pred_true_of_cond_count_eq_one ProbabilityTheory.pred_true_of_condCount_eq_one
theorem condCount_eq_zero_iff (hs : s.Finite) : condCount s t = 0 ↔ s ∩ t = ∅ := by
simp [condCount, cond_apply _ hs.measurableSet, Measure.count_apply_eq_top, Set.not_infinite.2 hs,
Measure.count_apply_finite _ (hs.inter_of_left _)]
#align probability_theory.cond_count_eq_zero_iff ProbabilityTheory.condCount_eq_zero_iff
theorem condCount_of_univ (hs : s.Finite) (hs' : s.Nonempty) : condCount s Set.univ = 1 :=
condCount_eq_one_of hs hs' s.subset_univ
#align probability_theory.cond_count_of_univ ProbabilityTheory.condCount_of_univ
| Mathlib/Probability/CondCount.lean | 138 | 148 | theorem condCount_inter (hs : s.Finite) :
condCount s (t ∩ u) = condCount (s ∩ t) u * condCount s t := by |
by_cases hst : s ∩ t = ∅
· rw [hst, condCount_empty_meas, Measure.coe_zero, Pi.zero_apply, zero_mul,
condCount_eq_zero_iff hs, ← Set.inter_assoc, hst, Set.empty_inter]
rw [condCount, condCount, cond_apply _ hs.measurableSet, cond_apply _ hs.measurableSet,
cond_apply _ (hs.inter_of_left _).measurableSet, mul_comm _ (Measure.count (s ∩ t)),
← mul_assoc, mul_comm _ (Measure.count (s ∩ t)), ← mul_assoc, ENNReal.mul_inv_cancel, one_mul,
mul_comm, Set.inter_assoc]
· rwa [← Measure.count_eq_zero_iff] at hst
· exact (Measure.count_apply_lt_top.2 <| hs.inter_of_left _).ne
| [
" condCount ∅ = 0",
" (condCount s) ∅ = 0",
" s.Finite",
" False",
" (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count Set.univ = ↑(Fintype.card Ω)",
" ∑ x : Ω, 1 = ↑(Fintype.card Ω)",
" M... | [
" condCount ∅ = 0",
" (condCount s) ∅ = 0",
" s.Finite",
" False",
" (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count Set.univ = ↑(Fintype.card Ω)",
" ∑ x : Ω, 1 = ↑(Fintype.card Ω)",
" M... |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Order.Ring.Rat
import Mathlib.Data.Rat.Lemmas
import Mathlib.Data.Int.Sqrt
#align_import data.rat.sqrt from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb"
namespace Rat
-- @[pp_nodot] porting note: unknown attribute
def sqrt (q : ℚ) : ℚ := mkRat (Int.sqrt q.num) (Nat.sqrt q.den)
#align rat.sqrt Rat.sqrt
| Mathlib/Data/Rat/Sqrt.lean | 30 | 31 | theorem sqrt_eq (q : ℚ) : Rat.sqrt (q * q) = |q| := by |
rw [sqrt, mul_self_num, mul_self_den, Int.sqrt_eq, Nat.sqrt_eq, abs_def, divInt_ofNat]
| [
" (q * q).sqrt = |q|"
] | [] |
import Mathlib.Data.Set.Function
import Mathlib.Analysis.BoundedVariation
#align_import analysis.constant_speed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped NNReal ENNReal
open Set MeasureTheory Classical
variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
variable (f : ℝ → E) (s : Set ℝ) (l : ℝ≥0)
def HasConstantSpeedOnWith :=
∀ ⦃x⦄ (_ : x ∈ s) ⦃y⦄ (_ : y ∈ s), eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (l * (y - x))
#align has_constant_speed_on_with HasConstantSpeedOnWith
variable {f s l}
theorem HasConstantSpeedOnWith.hasLocallyBoundedVariationOn (h : HasConstantSpeedOnWith f s l) :
LocallyBoundedVariationOn f s := fun x y hx hy => by
simp only [BoundedVariationOn, h hx hy, Ne, ENNReal.ofReal_ne_top, not_false_iff]
#align has_constant_speed_on_with.has_locally_bounded_variation_on HasConstantSpeedOnWith.hasLocallyBoundedVariationOn
| Mathlib/Analysis/ConstantSpeed.lean | 64 | 68 | theorem hasConstantSpeedOnWith_of_subsingleton (f : ℝ → E) {s : Set ℝ} (hs : s.Subsingleton)
(l : ℝ≥0) : HasConstantSpeedOnWith f s l := by |
rintro x hx y hy; cases hs hx hy
rw [eVariationOn.subsingleton f (fun y hy z hz => hs hy.1 hz.1 : (s ∩ Icc x x).Subsingleton)]
simp only [sub_self, mul_zero, ENNReal.ofReal_zero]
| [
" BoundedVariationOn f (s ∩ Icc x y)",
" HasConstantSpeedOnWith f s l",
" eVariationOn f (s ∩ Icc x y) = ENNReal.ofReal (↑l * (y - x))",
" eVariationOn f (s ∩ Icc x x) = ENNReal.ofReal (↑l * (x - x))",
" 0 = ENNReal.ofReal (↑l * (x - x))"
] | [
" BoundedVariationOn f (s ∩ Icc x y)"
] |
import Mathlib.Data.List.Forall2
#align_import data.list.zip from "leanprover-community/mathlib"@"134625f523e737f650a6ea7f0c82a6177e45e622"
-- Make sure we don't import algebra
assert_not_exists Monoid
universe u
open Nat
namespace List
variable {α : Type u} {β γ δ ε : Type*}
#align list.zip_with_cons_cons List.zipWith_cons_cons
#align list.zip_cons_cons List.zip_cons_cons
#align list.zip_with_nil_left List.zipWith_nil_left
#align list.zip_with_nil_right List.zipWith_nil_right
#align list.zip_with_eq_nil_iff List.zipWith_eq_nil_iff
#align list.zip_nil_left List.zip_nil_left
#align list.zip_nil_right List.zip_nil_right
@[simp]
theorem zip_swap : ∀ (l₁ : List α) (l₂ : List β), (zip l₁ l₂).map Prod.swap = zip l₂ l₁
| [], l₂ => zip_nil_right.symm
| l₁, [] => by rw [zip_nil_right]; rfl
| a :: l₁, b :: l₂ => by
simp only [zip_cons_cons, map_cons, zip_swap l₁ l₂, Prod.swap_prod_mk]
#align list.zip_swap List.zip_swap
#align list.length_zip_with List.length_zipWith
#align list.length_zip List.length_zip
theorem forall_zipWith {f : α → β → γ} {p : γ → Prop} :
∀ {l₁ : List α} {l₂ : List β}, length l₁ = length l₂ →
(Forall p (zipWith f l₁ l₂) ↔ Forall₂ (fun x y => p (f x y)) l₁ l₂)
| [], [], _ => by simp
| a :: l₁, b :: l₂, h => by
simp only [length_cons, succ_inj'] at h
simp [forall_zipWith h]
#align list.all₂_zip_with List.forall_zipWith
theorem lt_length_left_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β}
(h : i < (zipWith f l l').length) : i < l.length := by rw [length_zipWith] at h; omega
#align list.lt_length_left_of_zip_with List.lt_length_left_of_zipWith
theorem lt_length_right_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β}
(h : i < (zipWith f l l').length) : i < l'.length := by rw [length_zipWith] at h; omega
#align list.lt_length_right_of_zip_with List.lt_length_right_of_zipWith
theorem lt_length_left_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) :
i < l.length :=
lt_length_left_of_zipWith h
#align list.lt_length_left_of_zip List.lt_length_left_of_zip
theorem lt_length_right_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) :
i < l'.length :=
lt_length_right_of_zipWith h
#align list.lt_length_right_of_zip List.lt_length_right_of_zip
#align list.zip_append List.zip_append
#align list.zip_map List.zip_map
#align list.zip_map_left List.zip_map_left
#align list.zip_map_right List.zip_map_right
#align list.zip_with_map List.zipWith_map
#align list.zip_with_map_left List.zipWith_map_left
#align list.zip_with_map_right List.zipWith_map_right
#align list.zip_map' List.zip_map'
#align list.map_zip_with List.map_zipWith
theorem mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂
| _ :: l₁, _ :: l₂, h => by
cases' h with _ _ _ h
· simp
· have := mem_zip h
exact ⟨Mem.tail _ this.1, Mem.tail _ this.2⟩
#align list.mem_zip List.mem_zip
#align list.map_fst_zip List.map_fst_zip
#align list.map_snd_zip List.map_snd_zip
#align list.unzip_nil List.unzip_nil
#align list.unzip_cons List.unzip_cons
theorem unzip_eq_map : ∀ l : List (α × β), unzip l = (l.map Prod.fst, l.map Prod.snd)
| [] => rfl
| (a, b) :: l => by simp only [unzip_cons, map_cons, unzip_eq_map l]
#align list.unzip_eq_map List.unzip_eq_map
theorem unzip_left (l : List (α × β)) : (unzip l).1 = l.map Prod.fst := by simp only [unzip_eq_map]
#align list.unzip_left List.unzip_left
theorem unzip_right (l : List (α × β)) : (unzip l).2 = l.map Prod.snd := by simp only [unzip_eq_map]
#align list.unzip_right List.unzip_right
theorem unzip_swap (l : List (α × β)) : unzip (l.map Prod.swap) = (unzip l).swap := by
simp only [unzip_eq_map, map_map]
rfl
#align list.unzip_swap List.unzip_swap
theorem zip_unzip : ∀ l : List (α × β), zip (unzip l).1 (unzip l).2 = l
| [] => rfl
| (a, b) :: l => by simp only [unzip_cons, zip_cons_cons, zip_unzip l]
#align list.zip_unzip List.zip_unzip
theorem unzip_zip_left :
∀ {l₁ : List α} {l₂ : List β}, length l₁ ≤ length l₂ → (unzip (zip l₁ l₂)).1 = l₁
| [], l₂, _ => rfl
| l₁, [], h => by rw [eq_nil_of_length_eq_zero (Nat.eq_zero_of_le_zero h)]; rfl
| a :: l₁, b :: l₂, h => by
simp only [zip_cons_cons, unzip_cons, unzip_zip_left (le_of_succ_le_succ h)]
#align list.unzip_zip_left List.unzip_zip_left
| Mathlib/Data/List/Zip.lean | 133 | 134 | theorem unzip_zip_right {l₁ : List α} {l₂ : List β} (h : length l₂ ≤ length l₁) :
(unzip (zip l₁ l₂)).2 = l₂ := by | rw [← zip_swap, unzip_swap]; exact unzip_zip_left h
| [
" map Prod.swap (l₁.zip []) = [].zip l₁",
" map Prod.swap [] = [].zip l₁",
" map Prod.swap ((a :: l₁).zip (b :: l₂)) = (b :: l₂).zip (a :: l₁)",
" Forall p (zipWith f [] []) ↔ Forall₂ (fun x y => p (f x y)) [] []",
" Forall p (zipWith f (a :: l₁) (b :: l₂)) ↔ Forall₂ (fun x y => p (f x y)) (a :: l₁) (b :: l... | [
" map Prod.swap (l₁.zip []) = [].zip l₁",
" map Prod.swap [] = [].zip l₁",
" map Prod.swap ((a :: l₁).zip (b :: l₂)) = (b :: l₂).zip (a :: l₁)",
" Forall p (zipWith f [] []) ↔ Forall₂ (fun x y => p (f x y)) [] []",
" Forall p (zipWith f (a :: l₁) (b :: l₂)) ↔ Forall₂ (fun x y => p (f x y)) (a :: l₁) (b :: l... |
import Mathlib.Algebra.GCDMonoid.Multiset
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.List.Rotate
import Mathlib.GroupTheory.Perm.Cycle.Factors
import Mathlib.GroupTheory.Perm.Closure
import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.Tactic.NormNum.GCD
#align_import group_theory.perm.cycle.type from "leanprover-community/mathlib"@"47adfab39a11a072db552f47594bf8ed2cf8a722"
namespace Equiv.Perm
open Equiv List Multiset
variable {α : Type*} [Fintype α]
section CycleType
variable [DecidableEq α]
def cycleType (σ : Perm α) : Multiset ℕ :=
σ.cycleFactorsFinset.1.map (Finset.card ∘ support)
#align equiv.perm.cycle_type Equiv.Perm.cycleType
theorem cycleType_def (σ : Perm α) :
σ.cycleType = σ.cycleFactorsFinset.1.map (Finset.card ∘ support) :=
rfl
#align equiv.perm.cycle_type_def Equiv.Perm.cycleType_def
theorem cycleType_eq' {σ : Perm α} (s : Finset (Perm α)) (h1 : ∀ f : Perm α, f ∈ s → f.IsCycle)
(h2 : (s : Set (Perm α)).Pairwise Disjoint)
(h0 : s.noncommProd id (h2.imp fun _ _ => Disjoint.commute) = σ) :
σ.cycleType = s.1.map (Finset.card ∘ support) := by
rw [cycleType_def]
congr
rw [cycleFactorsFinset_eq_finset]
exact ⟨h1, h2, h0⟩
#align equiv.perm.cycle_type_eq' Equiv.Perm.cycleType_eq'
theorem cycleType_eq {σ : Perm α} (l : List (Perm α)) (h0 : l.prod = σ)
(h1 : ∀ σ : Perm α, σ ∈ l → σ.IsCycle) (h2 : l.Pairwise Disjoint) :
σ.cycleType = l.map (Finset.card ∘ support) := by
have hl : l.Nodup := nodup_of_pairwise_disjoint_cycles h1 h2
rw [cycleType_eq' l.toFinset]
· simp [List.dedup_eq_self.mpr hl, (· ∘ ·)]
· simpa using h1
· simpa [hl] using h2
· simp [hl, h0]
#align equiv.perm.cycle_type_eq Equiv.Perm.cycleType_eq
@[simp] -- Porting note: new attr
| Mathlib/GroupTheory/Perm/Cycle/Type.lean | 79 | 80 | theorem cycleType_eq_zero {σ : Perm α} : σ.cycleType = 0 ↔ σ = 1 := by |
simp [cycleType_def, cycleFactorsFinset_eq_empty_iff]
| [
" σ.cycleType = Multiset.map (Finset.card ∘ support) s.val",
" Multiset.map (Finset.card ∘ support) σ.cycleFactorsFinset.val = Multiset.map (Finset.card ∘ support) s.val",
" σ.cycleFactorsFinset = s",
" (∀ f ∈ s, f.IsCycle) ∧ ∃ (h : (↑s).Pairwise Disjoint), s.noncommProd id ⋯ = σ",
" σ.cycleType = ↑(List.ma... | [
" σ.cycleType = Multiset.map (Finset.card ∘ support) s.val",
" Multiset.map (Finset.card ∘ support) σ.cycleFactorsFinset.val = Multiset.map (Finset.card ∘ support) s.val",
" σ.cycleFactorsFinset = s",
" (∀ f ∈ s, f.IsCycle) ∧ ∃ (h : (↑s).Pairwise Disjoint), s.noncommProd id ⋯ = σ",
" σ.cycleType = ↑(List.ma... |
import Mathlib.Combinatorics.SimpleGraph.Subgraph
import Mathlib.Data.List.Rotate
#align_import combinatorics.simple_graph.connectivity from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4"
open Function
universe u v w
namespace SimpleGraph
variable {V : Type u} {V' : Type v} {V'' : Type w}
variable (G : SimpleGraph V) (G' : SimpleGraph V') (G'' : SimpleGraph V'')
inductive Walk : V → V → Type u
| nil {u : V} : Walk u u
| cons {u v w : V} (h : G.Adj u v) (p : Walk v w) : Walk u w
deriving DecidableEq
#align simple_graph.walk SimpleGraph.Walk
attribute [refl] Walk.nil
@[simps]
instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v) := ⟨Walk.nil⟩
#align simple_graph.walk.inhabited SimpleGraph.Walk.instInhabited
@[match_pattern, reducible]
def Adj.toWalk {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Walk u v :=
Walk.cons h Walk.nil
#align simple_graph.adj.to_walk SimpleGraph.Adj.toWalk
namespace Walk
variable {G}
@[match_pattern]
abbrev nil' (u : V) : G.Walk u u := Walk.nil
#align simple_graph.walk.nil' SimpleGraph.Walk.nil'
@[match_pattern]
abbrev cons' (u v w : V) (h : G.Adj u v) (p : G.Walk v w) : G.Walk u w := Walk.cons h p
#align simple_graph.walk.cons' SimpleGraph.Walk.cons'
protected def copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : G.Walk u' v' :=
hu ▸ hv ▸ p
#align simple_graph.walk.copy SimpleGraph.Walk.copy
@[simp]
theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl
#align simple_graph.walk.copy_rfl_rfl SimpleGraph.Walk.copy_rfl_rfl
@[simp]
theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v)
(hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :
(p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by
subst_vars
rfl
#align simple_graph.walk.copy_copy SimpleGraph.Walk.copy_copy
@[simp]
theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = Walk.nil := by
subst_vars
rfl
#align simple_graph.walk.copy_nil SimpleGraph.Walk.copy_nil
| Mathlib/Combinatorics/SimpleGraph/Connectivity.lean | 146 | 149 | theorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') :
(Walk.cons h p).copy hu hw = Walk.cons (hu ▸ h) (p.copy rfl hw) := by |
subst_vars
rfl
| [
" (p.copy hu hv).copy hu' hv' = p.copy ⋯ ⋯",
" (p.copy ⋯ ⋯).copy ⋯ ⋯ = p.copy ⋯ ⋯",
" nil.copy hu hu = nil",
" nil.copy ⋯ ⋯ = nil",
" (cons h p).copy hu hw = cons ⋯ (p.copy ⋯ hw)",
" (cons h p).copy ⋯ ⋯ = cons ⋯ (p.copy ⋯ ⋯)"
] | [
" (p.copy hu hv).copy hu' hv' = p.copy ⋯ ⋯",
" (p.copy ⋯ ⋯).copy ⋯ ⋯ = p.copy ⋯ ⋯",
" nil.copy hu hu = nil",
" nil.copy ⋯ ⋯ = nil"
] |
import Mathlib.Algebra.Order.Group.PiLex
import Mathlib.Data.DFinsupp.Order
import Mathlib.Data.DFinsupp.NeLocus
import Mathlib.Order.WellFoundedSet
#align_import data.dfinsupp.lex from "leanprover-community/mathlib"@"dde670c9a3f503647fd5bfdf1037bad526d3397a"
variable {ι : Type*} {α : ι → Type*}
namespace DFinsupp
section Zero
variable [∀ i, Zero (α i)]
protected def Lex (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop) (x y : Π₀ i, α i) : Prop :=
Pi.Lex r (s _) x y
#align dfinsupp.lex DFinsupp.Lex
-- Porting note: Added `_root_` to match more closely with Lean 3. Also updated `s`'s type.
theorem _root_.Pi.lex_eq_dfinsupp_lex {r : ι → ι → Prop} {s : ∀ i, α i → α i → Prop}
(a b : Π₀ i, α i) : Pi.Lex r (s _) (a : ∀ i, α i) b = DFinsupp.Lex r s a b :=
rfl
#align pi.lex_eq_dfinsupp_lex Pi.lex_eq_dfinsupp_lex
-- Porting note: Updated `s`'s type.
theorem lex_def {r : ι → ι → Prop} {s : ∀ i, α i → α i → Prop} {a b : Π₀ i, α i} :
DFinsupp.Lex r s a b ↔ ∃ j, (∀ d, r d j → a d = b d) ∧ s j (a j) (b j) :=
Iff.rfl
#align dfinsupp.lex_def DFinsupp.lex_def
instance [LT ι] [∀ i, LT (α i)] : LT (Lex (Π₀ i, α i)) :=
⟨fun f g ↦ DFinsupp.Lex (· < ·) (fun _ ↦ (· < ·)) (ofLex f) (ofLex g)⟩
| Mathlib/Data/DFinsupp/Lex.lean | 51 | 58 | theorem lex_lt_of_lt_of_preorder [∀ i, Preorder (α i)] (r) [IsStrictOrder ι r] {x y : Π₀ i, α i}
(hlt : x < y) : ∃ i, (∀ j, r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i := by |
obtain ⟨hle, j, hlt⟩ := Pi.lt_def.1 hlt
classical
have : (x.neLocus y : Set ι).WellFoundedOn r := (x.neLocus y).finite_toSet.wellFoundedOn
obtain ⟨i, hi, hl⟩ := this.has_min { i | x i < y i } ⟨⟨j, mem_neLocus.2 hlt.ne⟩, hlt⟩
refine ⟨i, fun k hk ↦ ⟨hle k, ?_⟩, hi⟩
exact of_not_not fun h ↦ hl ⟨k, mem_neLocus.2 (ne_of_not_le h).symm⟩ ((hle k).lt_of_not_le h) hk
| [
" ∃ i, (∀ (j : ι), r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i",
" y k ≤ x k"
] | [] |
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integral
#align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"d35b4ff446f1421bd551fafa4b8efd98ac3ac408"
open scoped nonZeroDivisors Polynomial
open Polynomial
abbrev IsIntegrallyClosedIn (R A : Type*) [CommRing R] [CommRing A] [Algebra R A] :=
IsIntegralClosure R R A
abbrev IsIntegrallyClosed (R : Type*) [CommRing R] := IsIntegrallyClosedIn R (FractionRing R)
#align is_integrally_closed IsIntegrallyClosed
section Iff
variable {R : Type*} [CommRing R]
variable {A B : Type*} [CommRing A] [CommRing B] [Algebra R A] [Algebra R B]
theorem AlgHom.isIntegrallyClosedIn (f : A →ₐ[R] B) (hf : Function.Injective f) :
IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A := by
rintro ⟨inj, cl⟩
refine ⟨Function.Injective.of_comp (f := f) ?_, fun hx => ?_, ?_⟩
· convert inj
aesop
· obtain ⟨y, fx_eq⟩ := cl.mp ((isIntegral_algHom_iff f hf).mpr hx)
aesop
· rintro ⟨y, rfl⟩
apply (isIntegral_algHom_iff f hf).mp
aesop
theorem AlgEquiv.isIntegrallyClosedIn (e : A ≃ₐ[R] B) :
IsIntegrallyClosedIn R A ↔ IsIntegrallyClosedIn R B :=
⟨AlgHom.isIntegrallyClosedIn e.symm e.symm.injective, AlgHom.isIntegrallyClosedIn e e.injective⟩
variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
theorem isIntegrallyClosed_iff_isIntegrallyClosedIn :
IsIntegrallyClosed R ↔ IsIntegrallyClosedIn R K :=
(IsLocalization.algEquiv R⁰ _ _).isIntegrallyClosedIn
theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K :=
isIntegrallyClosed_iff_isIntegrallyClosedIn K
#align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
| Mathlib/RingTheory/IntegrallyClosed.lean | 110 | 120 | theorem isIntegrallyClosedIn_iff {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] :
IsIntegrallyClosedIn R A ↔
Function.Injective (algebraMap R A) ∧
∀ {x : A}, IsIntegral R x → ∃ y, algebraMap R A y = x := by |
constructor
· rintro ⟨_, cl⟩
aesop
· rintro ⟨inj, cl⟩
refine ⟨inj, by aesop, ?_⟩
rintro ⟨y, rfl⟩
apply isIntegral_algebraMap
| [
" IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A",
" IsIntegrallyClosedIn R A",
" Function.Injective (⇑f ∘ ⇑(algebraMap R A))",
" ⇑f ∘ ⇑(algebraMap R A) = ⇑(algebraMap R B)",
" ∃ y, (algebraMap R A) y = x✝",
" (∃ y, (algebraMap R A) y = x✝) → IsIntegral R x✝",
" IsIntegral R ((algebraMap R A) y)",
... | [
" IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A",
" IsIntegrallyClosedIn R A",
" Function.Injective (⇑f ∘ ⇑(algebraMap R A))",
" ⇑f ∘ ⇑(algebraMap R A) = ⇑(algebraMap R B)",
" ∃ y, (algebraMap R A) y = x✝",
" (∃ y, (algebraMap R A) y = x✝) → IsIntegral R x✝",
" IsIntegral R ((algebraMap R A) y)",
... |
import Mathlib.Order.Monotone.Union
import Mathlib.Algebra.Order.Group.Instances
#align_import order.monotone.odd from "leanprover-community/mathlib"@"9116dd6709f303dcf781632e15fdef382b0fc579"
open Set
variable {G H : Type*} [LinearOrderedAddCommGroup G] [OrderedAddCommGroup H]
| Mathlib/Order/Monotone/Odd.lean | 26 | 30 | theorem strictMono_of_odd_strictMonoOn_nonneg {f : G → H} (h₁ : ∀ x, f (-x) = -f x)
(h₂ : StrictMonoOn f (Ici 0)) : StrictMono f := by |
refine StrictMonoOn.Iic_union_Ici (fun x hx y hy hxy => neg_lt_neg_iff.1 ?_) h₂
rw [← h₁, ← h₁]
exact h₂ (neg_nonneg.2 hy) (neg_nonneg.2 hx) (neg_lt_neg hxy)
| [
" StrictMono f",
" -f y < -f x",
" f (-y) < f (-x)"
] | [] |
import Mathlib.Data.List.Infix
#align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
-- Make sure we don't import algebra
assert_not_exists Monoid
variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ)
namespace List
def rdrop : List α :=
l.take (l.length - n)
#align list.rdrop List.rdrop
@[simp]
theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop]
#align list.rdrop_nil List.rdrop_nil
@[simp]
theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop]
#align list.rdrop_zero List.rdrop_zero
theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by
rw [rdrop]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· simp [take_append]
· simp [take_append_eq_append_take, IH]
#align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse
@[simp]
theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by
simp [rdrop_eq_reverse_drop_reverse]
#align list.rdrop_concat_succ List.rdrop_concat_succ
def rtake : List α :=
l.drop (l.length - n)
#align list.rtake List.rtake
@[simp]
theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake]
#align list.rtake_nil List.rtake_nil
@[simp]
theorem rtake_zero : rtake l 0 = [] := by simp [rtake]
#align list.rtake_zero List.rtake_zero
| Mathlib/Data/List/DropRight.lean | 81 | 87 | theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by |
rw [rtake]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· exact drop_length _
· simp [drop_append_eq_append_drop, IH]
| [
" [].rdrop n = []",
" l.rdrop 0 = l",
" l.rdrop n = (drop n l.reverse).reverse",
" take (l.length - n) l = (drop n l.reverse).reverse",
" take ([].length - n) [] = (drop n [].reverse).reverse",
" take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse",
" take ((xs ++ [x]).lengt... | [
" [].rdrop n = []",
" l.rdrop 0 = l",
" l.rdrop n = (drop n l.reverse).reverse",
" take (l.length - n) l = (drop n l.reverse).reverse",
" take ([].length - n) [] = (drop n [].reverse).reverse",
" take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse",
" take ((xs ++ [x]).lengt... |
import Mathlib.Data.ENNReal.Basic
import Mathlib.Topology.ContinuousFunction.Bounded
import Mathlib.Topology.MetricSpace.Thickening
#align_import topology.metric_space.thickened_indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical
open NNReal ENNReal Topology BoundedContinuousFunction
open NNReal ENNReal Set Metric EMetric Filter
noncomputable section thickenedIndicator
variable {α : Type*} [PseudoEMetricSpace α]
def thickenedIndicatorAux (δ : ℝ) (E : Set α) : α → ℝ≥0∞ :=
fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ
#align thickened_indicator_aux thickenedIndicatorAux
theorem continuous_thickenedIndicatorAux {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) :
Continuous (thickenedIndicatorAux δ E) := by
unfold thickenedIndicatorAux
let f := fun x : α => (⟨1, infEdist x E / ENNReal.ofReal δ⟩ : ℝ≥0 × ℝ≥0∞)
let sub := fun p : ℝ≥0 × ℝ≥0∞ => (p.1 : ℝ≥0∞) - p.2
rw [show (fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ) = sub ∘ f by rfl]
apply (@ENNReal.continuous_nnreal_sub 1).comp
apply (ENNReal.continuous_div_const (ENNReal.ofReal δ) _).comp continuous_infEdist
set_option tactic.skipAssignedInstances false in norm_num [δ_pos]
#align continuous_thickened_indicator_aux continuous_thickenedIndicatorAux
theorem thickenedIndicatorAux_le_one (δ : ℝ) (E : Set α) (x : α) :
thickenedIndicatorAux δ E x ≤ 1 := by
apply @tsub_le_self _ _ _ _ (1 : ℝ≥0∞)
#align thickened_indicator_aux_le_one thickenedIndicatorAux_le_one
theorem thickenedIndicatorAux_lt_top {δ : ℝ} {E : Set α} {x : α} :
thickenedIndicatorAux δ E x < ∞ :=
lt_of_le_of_lt (thickenedIndicatorAux_le_one _ _ _) one_lt_top
#align thickened_indicator_aux_lt_top thickenedIndicatorAux_lt_top
theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) :
thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E := by
simp (config := { unfoldPartialApp := true }) only [thickenedIndicatorAux, infEdist_closure]
#align thickened_indicator_aux_closure_eq thickenedIndicatorAux_closure_eq
theorem thickenedIndicatorAux_one (δ : ℝ) (E : Set α) {x : α} (x_in_E : x ∈ E) :
thickenedIndicatorAux δ E x = 1 := by
simp [thickenedIndicatorAux, infEdist_zero_of_mem x_in_E, tsub_zero]
#align thickened_indicator_aux_one thickenedIndicatorAux_one
theorem thickenedIndicatorAux_one_of_mem_closure (δ : ℝ) (E : Set α) {x : α}
(x_mem : x ∈ closure E) : thickenedIndicatorAux δ E x = 1 := by
rw [← thickenedIndicatorAux_closure_eq, thickenedIndicatorAux_one δ (closure E) x_mem]
#align thickened_indicator_aux_one_of_mem_closure thickenedIndicatorAux_one_of_mem_closure
theorem thickenedIndicatorAux_zero {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) {x : α}
(x_out : x ∉ thickening δ E) : thickenedIndicatorAux δ E x = 0 := by
rw [thickening, mem_setOf_eq, not_lt] at x_out
unfold thickenedIndicatorAux
apply le_antisymm _ bot_le
have key := tsub_le_tsub
(@rfl _ (1 : ℝ≥0∞)).le (ENNReal.div_le_div x_out (@rfl _ (ENNReal.ofReal δ : ℝ≥0∞)).le)
rw [ENNReal.div_self (ne_of_gt (ENNReal.ofReal_pos.mpr δ_pos)) ofReal_ne_top] at key
simpa using key
#align thickened_indicator_aux_zero thickenedIndicatorAux_zero
theorem thickenedIndicatorAux_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) :
thickenedIndicatorAux δ₁ E ≤ thickenedIndicatorAux δ₂ E :=
fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div rfl.le (ofReal_le_ofReal hle))
#align thickened_indicator_aux_mono thickenedIndicatorAux_mono
theorem indicator_le_thickenedIndicatorAux (δ : ℝ) (E : Set α) :
(E.indicator fun _ => (1 : ℝ≥0∞)) ≤ thickenedIndicatorAux δ E := by
intro a
by_cases h : a ∈ E
· simp only [h, indicator_of_mem, thickenedIndicatorAux_one δ E h, le_refl]
· simp only [h, indicator_of_not_mem, not_false_iff, zero_le]
#align indicator_le_thickened_indicator_aux indicator_le_thickenedIndicatorAux
theorem thickenedIndicatorAux_subset (δ : ℝ) {E₁ E₂ : Set α} (subset : E₁ ⊆ E₂) :
thickenedIndicatorAux δ E₁ ≤ thickenedIndicatorAux δ E₂ :=
fun _ => tsub_le_tsub (@rfl ℝ≥0∞ 1).le (ENNReal.div_le_div (infEdist_anti subset) rfl.le)
#align thickened_indicator_aux_subset thickenedIndicatorAux_subset
| Mathlib/Topology/MetricSpace/ThickenedIndicator.lean | 130 | 153 | theorem thickenedIndicatorAux_tendsto_indicator_closure {δseq : ℕ → ℝ}
(δseq_lim : Tendsto δseq atTop (𝓝 0)) (E : Set α) :
Tendsto (fun n => thickenedIndicatorAux (δseq n) E) atTop
(𝓝 (indicator (closure E) fun _ => (1 : ℝ≥0∞))) := by |
rw [tendsto_pi_nhds]
intro x
by_cases x_mem_closure : x ∈ closure E
· simp_rw [thickenedIndicatorAux_one_of_mem_closure _ E x_mem_closure]
rw [show (indicator (closure E) fun _ => (1 : ℝ≥0∞)) x = 1 by
simp only [x_mem_closure, indicator_of_mem]]
exact tendsto_const_nhds
· rw [show (closure E).indicator (fun _ => (1 : ℝ≥0∞)) x = 0 by
simp only [x_mem_closure, indicator_of_not_mem, not_false_iff]]
rcases exists_real_pos_lt_infEdist_of_not_mem_closure x_mem_closure with ⟨ε, ⟨ε_pos, ε_lt⟩⟩
rw [Metric.tendsto_nhds] at δseq_lim
specialize δseq_lim ε ε_pos
simp only [dist_zero_right, Real.norm_eq_abs, eventually_atTop, ge_iff_le] at δseq_lim
rcases δseq_lim with ⟨N, hN⟩
apply @tendsto_atTop_of_eventually_const _ _ _ _ _ _ _ N
intro n n_large
have key : x ∉ thickening ε E := by simpa only [thickening, mem_setOf_eq, not_lt] using ε_lt.le
refine le_antisymm ?_ bot_le
apply (thickenedIndicatorAux_mono (lt_of_abs_lt (hN n n_large)).le E x).trans
exact (thickenedIndicatorAux_zero ε_pos E key).le
| [
" Continuous (thickenedIndicatorAux δ E)",
" Continuous fun x => 1 - infEdist x E / ENNReal.ofReal δ",
" (fun x => 1 - infEdist x E / ENNReal.ofReal δ) = sub ∘ f",
" Continuous (sub ∘ f)",
" Continuous fun x => (f x).2",
" ENNReal.ofReal δ ≠ 0",
" thickenedIndicatorAux δ E x ≤ 1",
" thickenedIndicator... | [
" Continuous (thickenedIndicatorAux δ E)",
" Continuous fun x => 1 - infEdist x E / ENNReal.ofReal δ",
" (fun x => 1 - infEdist x E / ENNReal.ofReal δ) = sub ∘ f",
" Continuous (sub ∘ f)",
" Continuous fun x => (f x).2",
" ENNReal.ofReal δ ≠ 0",
" thickenedIndicatorAux δ E x ≤ 1",
" thickenedIndicator... |
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04"
namespace Set
variable {α β : Type*} {s t : Set α}
noncomputable def encard (s : Set α) : ℕ∞ := PartENat.withTopEquiv (PartENat.card s)
@[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s := by
rw [encard, encard, PartENat.card_congr (Equiv.Set.univ ↑s)]
theorem encard_univ (α : Type*) :
encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) := by
rw [encard, PartENat.card_congr (Equiv.Set.univ α)]
theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by
have := h.fintype
rw [encard, PartENat.card_eq_coe_fintype_card,
PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card]
theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card := by
have h := toFinite s
rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset]
theorem encard_coe_eq_coe_finsetCard (s : Finset α) : encard (s : Set α) = s.card := by
rw [Finite.encard_eq_coe_toFinset_card (Finset.finite_toSet s)]; simp
theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ := by
have := h.to_subtype
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.withTopEquiv_symm_top, PartENat.card_eq_top_of_infinite]
@[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ := by
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.withTopEquiv_symm_zero, PartENat.card_eq_zero_iff_empty, isEmpty_subtype,
eq_empty_iff_forall_not_mem]
@[simp] theorem encard_empty : (∅ : Set α).encard = 0 := by
rw [encard_eq_zero]
theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty := by
rwa [nonempty_iff_ne_empty, Ne, ← encard_eq_zero]
theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty := by
rw [ne_eq, encard_eq_zero, nonempty_iff_ne_empty]
@[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty := by
rw [pos_iff_ne_zero, encard_ne_zero]
@[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 := by
rw [encard, ← PartENat.withTopEquiv.symm.injective.eq_iff, Equiv.symm_apply_apply,
PartENat.card_eq_coe_fintype_card, Fintype.card_ofSubsingleton, Nat.cast_one]; rfl
theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard := by
classical
have e := (Equiv.Set.union (by rwa [subset_empty_iff, ← disjoint_iff_inter_eq_empty])).symm
simp [encard, ← PartENat.card_congr e, PartENat.card_sum, PartENat.withTopEquiv]
theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 := by
rw [← union_singleton, encard_union_eq (by simpa), encard_singleton]
theorem Finite.encard_lt_top (h : s.Finite) : s.encard < ⊤ := by
refine h.induction_on (by simp) ?_
rintro a t hat _ ht'
rw [encard_insert_of_not_mem hat]
exact lt_tsub_iff_right.1 ht'
theorem Finite.encard_eq_coe (h : s.Finite) : s.encard = ENat.toNat s.encard :=
(ENat.coe_toNat h.encard_lt_top.ne).symm
theorem Finite.exists_encard_eq_coe (h : s.Finite) : ∃ (n : ℕ), s.encard = n :=
⟨_, h.encard_eq_coe⟩
@[simp] theorem encard_lt_top_iff : s.encard < ⊤ ↔ s.Finite :=
⟨fun h ↦ by_contra fun h' ↦ h.ne (Infinite.encard_eq h'), Finite.encard_lt_top⟩
@[simp] theorem encard_eq_top_iff : s.encard = ⊤ ↔ s.Infinite := by
rw [← not_iff_not, ← Ne, ← lt_top_iff_ne_top, encard_lt_top_iff, not_infinite]
theorem encard_ne_top_iff : s.encard ≠ ⊤ ↔ s.Finite := by
simp
theorem finite_of_encard_le_coe {k : ℕ} (h : s.encard ≤ k) : s.Finite := by
rw [← encard_lt_top_iff]; exact h.trans_lt (WithTop.coe_lt_top _)
theorem finite_of_encard_eq_coe {k : ℕ} (h : s.encard = k) : s.Finite :=
finite_of_encard_le_coe h.le
theorem encard_le_coe_iff {k : ℕ} : s.encard ≤ k ↔ s.Finite ∧ ∃ (n₀ : ℕ), s.encard = n₀ ∧ n₀ ≤ k :=
⟨fun h ↦ ⟨finite_of_encard_le_coe h, by rwa [ENat.le_coe_iff] at h⟩,
fun ⟨_,⟨n₀,hs, hle⟩⟩ ↦ by rwa [hs, Nat.cast_le]⟩
section SmallSets
| Mathlib/Data/Set/Card.lean | 286 | 288 | theorem encard_pair {x y : α} (hne : x ≠ y) : ({x, y} : Set α).encard = 2 := by |
rw [encard_insert_of_not_mem (by simpa), ← one_add_one_eq_two,
WithTop.add_right_cancel_iff WithTop.one_ne_top, encard_singleton]
| [
" univ.encard = s.encard",
" univ.encard = PartENat.withTopEquiv (PartENat.card α)",
" s.encard = ↑h.toFinset.card",
" s.encard = ↑s.toFinset.card",
" (↑s).encard = ↑s.card",
" ↑⋯.toFinset.card = ↑s.card",
" s.encard = ⊤",
" s.encard = 0 ↔ s = ∅",
" ∅.encard = 0",
" s.Nonempty",
" s.encard ≠ 0 ↔... | [
" univ.encard = s.encard",
" univ.encard = PartENat.withTopEquiv (PartENat.card α)",
" s.encard = ↑h.toFinset.card",
" s.encard = ↑s.toFinset.card",
" (↑s).encard = ↑s.card",
" ↑⋯.toFinset.card = ↑s.card",
" s.encard = ⊤",
" s.encard = 0 ↔ s = ∅",
" ∅.encard = 0",
" s.Nonempty",
" s.encard ≠ 0 ↔... |
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]
| Mathlib/Data/Finset/Antidiagonal.lean | 131 | 133 | theorem antidiagonal_zero : antidiagonal (0 : A) = {(0, 0)} := by |
ext ⟨x, y⟩
simp
| [
" ∀ (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.Geometry.Euclidean.Inversion.Basic
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Tactic.AdaptationNote
open Metric Function AffineMap Set AffineSubspace
open scoped Topology RealInnerProductSpace
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [InnerProductSpace ℝ F]
open EuclideanGeometry
namespace EuclideanGeometry
variable {a b c d x y z : F} {r R : ℝ}
| Mathlib/Geometry/Euclidean/Inversion/Calculus.lean | 87 | 108 | theorem hasFDerivAt_inversion (hx : x ≠ c) :
HasFDerivAt (inversion c R)
((R / dist x c) ^ 2 • (reflection (ℝ ∙ (x - c))ᗮ : F →L[ℝ] F)) x := by |
rcases add_left_surjective c x with ⟨x, rfl⟩
have : HasFDerivAt (inversion c R) (?_ : F →L[ℝ] F) (c + x) := by
#adaptation_note /-- nightly-2024-03-16: simp was
simp (config := { unfoldPartialApp := true }) only [inversion] -/
simp only [inversion_def]
simp_rw [dist_eq_norm, div_pow, div_eq_mul_inv]
have A := (hasFDerivAt_id (𝕜 := ℝ) (c + x)).sub_const c
have B := ((hasDerivAt_inv <| by simpa using hx).comp_hasFDerivAt _ A.norm_sq).const_mul
(R ^ 2)
exact (B.smul A).add_const c
refine this.congr_fderiv (LinearMap.ext_on_codisjoint
(Submodule.isCompl_orthogonal_of_completeSpace (K := ℝ ∙ x)).codisjoint
(LinearMap.eqOn_span' ?_) fun y hy ↦ ?_)
· have : ((‖x‖ ^ 2) ^ 2)⁻¹ * (‖x‖ ^ 2) = (‖x‖ ^ 2)⁻¹ := by
rw [← div_eq_inv_mul, sq (‖x‖ ^ 2), div_self_mul_self']
simp [reflection_orthogonalComplement_singleton_eq_neg, real_inner_self_eq_norm_sq,
two_mul, this, div_eq_mul_inv, mul_add, add_smul, mul_pow]
· simp [Submodule.mem_orthogonal_singleton_iff_inner_right.1 hy,
reflection_mem_subspace_eq_self hy, div_eq_mul_inv, mul_pow]
| [
" HasFDerivAt (inversion c R)\n ((R / dist x c) ^ 2 •\n ↑{ toLinearEquiv := (reflection (Submodule.span ℝ {x - c})ᗮ).toLinearEquiv, continuous_toFun := ⋯,\n continuous_invFun := ⋯ })\n x",
" HasFDerivAt (inversion c R)\n ((R / dist ((fun x => c + x) x) c) ^ 2 •\n ↑{ toLinearEquiv := (r... | [] |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.SpecificLimits.Normed
#align_import analysis.normed.group.controlled_closure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Finset
open Topology
variable {G : Type*} [NormedAddCommGroup G] [CompleteSpace G]
variable {H : Type*} [NormedAddCommGroup H]
| Mathlib/Analysis/Normed/Group/ControlledClosure.lean | 32 | 106 | theorem controlled_closure_of_complete {f : NormedAddGroupHom G H} {K : AddSubgroup H} {C ε : ℝ}
(hC : 0 < C) (hε : 0 < ε) (hyp : f.SurjectiveOnWith K C) :
f.SurjectiveOnWith K.topologicalClosure (C + ε) := by |
rintro (h : H) (h_in : h ∈ K.topologicalClosure)
-- We first get rid of the easy case where `h = 0`.
by_cases hyp_h : h = 0
· rw [hyp_h]
use 0
simp
/- The desired preimage will be constructed as the sum of a series. Convergence of
the series will be guaranteed by completeness of `G`. We first write `h` as the sum
of a sequence `v` of elements of `K` which starts close to `h` and then quickly goes to zero.
The sequence `b` below quantifies this. -/
set b : ℕ → ℝ := fun i => (1 / 2) ^ i * (ε * ‖h‖ / 2) / C
have b_pos (i) : 0 < b i := by field_simp [b, hC, hyp_h]
obtain
⟨v : ℕ → H, lim_v : Tendsto (fun n : ℕ => ∑ k ∈ range (n + 1), v k) atTop (𝓝 h), v_in :
∀ n, v n ∈ K, hv₀ : ‖v 0 - h‖ < b 0, hv : ∀ n > 0, ‖v n‖ < b n⟩ :=
controlled_sum_of_mem_closure h_in b_pos
/- The controlled surjectivity assumption on `f` allows to build preimages `u n` for all
elements `v n` of the `v` sequence. -/
have : ∀ n, ∃ m' : G, f m' = v n ∧ ‖m'‖ ≤ C * ‖v n‖ := fun n : ℕ => hyp (v n) (v_in n)
choose u hu hnorm_u using this
/- The desired series `s` is then obtained by summing `u`. We then check our choice of
`b` ensures `s` is Cauchy. -/
set s : ℕ → G := fun n => ∑ k ∈ range (n + 1), u k
have : CauchySeq s := by
apply NormedAddCommGroup.cauchy_series_of_le_geometric'' (by norm_num) one_half_lt_one
· rintro n (hn : n ≥ 1)
calc
‖u n‖ ≤ C * ‖v n‖ := hnorm_u n
_ ≤ C * b n := by gcongr; exact (hv _ <| Nat.succ_le_iff.mp hn).le
_ = (1 / 2) ^ n * (ε * ‖h‖ / 2) := by simp [mul_div_cancel₀ _ hC.ne.symm]
_ = ε * ‖h‖ / 2 * (1 / 2) ^ n := mul_comm _ _
-- We now show that the limit `g` of `s` is the desired preimage.
obtain ⟨g : G, hg⟩ := cauchySeq_tendsto_of_complete this
refine ⟨g, ?_, ?_⟩
· -- We indeed get a preimage. First note:
have : f ∘ s = fun n => ∑ k ∈ range (n + 1), v k := by
ext n
simp [s, map_sum, hu]
/- In the above equality, the left-hand-side converges to `f g` by continuity of `f` and
definition of `g` while the right-hand-side converges to `h` by construction of `v` so
`g` is indeed a preimage of `h`. -/
rw [← this] at lim_v
exact tendsto_nhds_unique ((f.continuous.tendsto g).comp hg) lim_v
· -- Then we need to estimate the norm of `g`, using our careful choice of `b`.
suffices ∀ n, ‖s n‖ ≤ (C + ε) * ‖h‖ from
le_of_tendsto' (continuous_norm.continuousAt.tendsto.comp hg) this
intro n
have hnorm₀ : ‖u 0‖ ≤ C * b 0 + C * ‖h‖ := by
have :=
calc
‖v 0‖ ≤ ‖h‖ + ‖v 0 - h‖ := norm_le_insert' _ _
_ ≤ ‖h‖ + b 0 := by gcongr
calc
‖u 0‖ ≤ C * ‖v 0‖ := hnorm_u 0
_ ≤ C * (‖h‖ + b 0) := by gcongr
_ = C * b 0 + C * ‖h‖ := by rw [add_comm, mul_add]
have : (∑ k ∈ range (n + 1), C * b k) ≤ ε * ‖h‖ :=
calc (∑ k ∈ range (n + 1), C * b k)
_ = (∑ k ∈ range (n + 1), (1 / 2 : ℝ) ^ k) * (ε * ‖h‖ / 2) := by
simp only [mul_div_cancel₀ _ hC.ne.symm, ← sum_mul]
_ ≤ 2 * (ε * ‖h‖ / 2) := by gcongr; apply sum_geometric_two_le
_ = ε * ‖h‖ := mul_div_cancel₀ _ two_ne_zero
calc
‖s n‖ ≤ ∑ k ∈ range (n + 1), ‖u k‖ := norm_sum_le _ _
_ = (∑ k ∈ range n, ‖u (k + 1)‖) + ‖u 0‖ := sum_range_succ' _ _
_ ≤ (∑ k ∈ range n, C * ‖v (k + 1)‖) + ‖u 0‖ := by gcongr; apply hnorm_u
_ ≤ (∑ k ∈ range n, C * b (k + 1)) + (C * b 0 + C * ‖h‖) := by
gcongr with k; exact (hv _ k.succ_pos).le
_ = (∑ k ∈ range (n + 1), C * b k) + C * ‖h‖ := by rw [← add_assoc, sum_range_succ']
_ ≤ (C + ε) * ‖h‖ := by
rw [add_comm, add_mul]
apply add_le_add_left this
| [
" f.SurjectiveOnWith K.topologicalClosure (C + ε)",
" ∃ g, f g = h ∧ ‖g‖ ≤ (C + ε) * ‖h‖",
" ∃ g, f g = 0 ∧ ‖g‖ ≤ (C + ε) * ‖0‖",
" f 0 = 0 ∧ ‖0‖ ≤ (C + ε) * ‖0‖",
" 0 < b i",
" CauchySeq s",
" 0 < 1 / 2",
" ∀ n ≥ ?m.19377, ‖u n‖ ≤ ?m.19375 * (1 / 2) ^ n",
" ‖u n‖ ≤ ?m.19375 * (1 / 2) ^ n",
" C * ... | [] |
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Geometry.Euclidean.Angle.Oriented.Basic
#align_import geometry.euclidean.angle.oriented.rotation from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open FiniteDimensional Complex
open scoped Real RealInnerProductSpace ComplexConjugate
namespace Orientation
attribute [local instance] Complex.finrank_real_complex_fact
variable {V V' : Type*}
variable [NormedAddCommGroup V] [NormedAddCommGroup V']
variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V']
variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2))
local notation "J" => o.rightAngleRotation
def rotationAux (θ : Real.Angle) : V →ₗᵢ[ℝ] V :=
LinearMap.isometryOfInner
(Real.Angle.cos θ • LinearMap.id +
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
intro x y
simp only [RCLike.conj_to_real, id, LinearMap.smul_apply, LinearMap.add_apply,
LinearMap.id_coe, LinearEquiv.coe_coe, LinearIsometryEquiv.coe_toLinearEquiv,
Orientation.areaForm_rightAngleRotation_left, Orientation.inner_rightAngleRotation_left,
Orientation.inner_rightAngleRotation_right, inner_add_left, inner_smul_left,
inner_add_right, inner_smul_right]
linear_combination inner (𝕜 := ℝ) x y * θ.cos_sq_add_sin_sq)
#align orientation.rotation_aux Orientation.rotationAux
@[simp]
theorem rotationAux_apply (θ : Real.Angle) (x : V) :
o.rotationAux θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_aux_apply Orientation.rotationAux_apply
def rotation (θ : Real.Angle) : V ≃ₗᵢ[ℝ] V :=
LinearIsometryEquiv.ofLinearIsometry (o.rotationAux θ)
(Real.Angle.cos θ • LinearMap.id -
Real.Angle.sin θ • (LinearIsometryEquiv.toLinearEquiv J).toLinearMap)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_smul, map_sub, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply, ← mul_smul, add_smul,
smul_add, smul_neg, smul_sub, mul_comm, sq]
abel
· simp)
(by
ext x
convert congr_arg (fun t : ℝ => t • x) θ.cos_sq_add_sin_sq using 1
· simp only [o.rightAngleRotation_rightAngleRotation, o.rotationAux_apply,
Function.comp_apply, id, LinearEquiv.coe_coe, LinearIsometry.coe_toLinearMap,
LinearIsometryEquiv.coe_toLinearEquiv, map_add, map_smul, LinearMap.coe_comp,
LinearMap.id_coe, LinearMap.smul_apply, LinearMap.sub_apply,
add_smul, smul_neg, smul_sub, smul_smul]
ring_nf
abel
· simp)
#align orientation.rotation Orientation.rotation
theorem rotation_apply (θ : Real.Angle) (x : V) :
o.rotation θ x = Real.Angle.cos θ • x + Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_apply Orientation.rotation_apply
theorem rotation_symm_apply (θ : Real.Angle) (x : V) :
(o.rotation θ).symm x = Real.Angle.cos θ • x - Real.Angle.sin θ • J x :=
rfl
#align orientation.rotation_symm_apply Orientation.rotation_symm_apply
theorem rotation_eq_matrix_toLin (θ : Real.Angle) {x : V} (hx : x ≠ 0) :
(o.rotation θ).toLinearMap =
Matrix.toLin (o.basisRightAngleRotation x hx) (o.basisRightAngleRotation x hx)
!![θ.cos, -θ.sin; θ.sin, θ.cos] := by
apply (o.basisRightAngleRotation x hx).ext
intro i
fin_cases i
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ]
· rw [Matrix.toLin_self]
simp [rotation_apply, Fin.sum_univ_succ, add_comm]
#align orientation.rotation_eq_matrix_to_lin Orientation.rotation_eq_matrix_toLin
@[simp]
theorem det_rotation (θ : Real.Angle) : LinearMap.det (o.rotation θ).toLinearMap = 1 := by
haveI : Nontrivial V :=
FiniteDimensional.nontrivial_of_finrank_eq_succ (@Fact.out (finrank ℝ V = 2) _)
obtain ⟨x, hx⟩ : ∃ x, x ≠ (0 : V) := exists_ne (0 : V)
rw [o.rotation_eq_matrix_toLin θ hx]
simpa [sq] using θ.cos_sq_add_sin_sq
#align orientation.det_rotation Orientation.det_rotation
@[simp]
theorem linearEquiv_det_rotation (θ : Real.Angle) :
LinearEquiv.det (o.rotation θ).toLinearEquiv = 1 :=
Units.ext <| by
-- Porting note: Lean can't see through `LinearEquiv.coe_det` and needed the rewrite
-- in mathlib3 this was just `units.ext <| o.det_rotation θ`
simpa only [LinearEquiv.coe_det, Units.val_one] using o.det_rotation θ
#align orientation.linear_equiv_det_rotation Orientation.linearEquiv_det_rotation
@[simp]
theorem rotation_symm (θ : Real.Angle) : (o.rotation θ).symm = o.rotation (-θ) := by
ext; simp [o.rotation_apply, o.rotation_symm_apply, sub_eq_add_neg]
#align orientation.rotation_symm Orientation.rotation_symm
@[simp]
theorem rotation_zero : o.rotation 0 = LinearIsometryEquiv.refl ℝ V := by ext; simp [rotation]
#align orientation.rotation_zero Orientation.rotation_zero
@[simp]
| Mathlib/Geometry/Euclidean/Angle/Oriented/Rotation.lean | 145 | 147 | theorem rotation_pi : o.rotation π = LinearIsometryEquiv.neg ℝ := by |
ext x
simp [rotation]
| [
" ∀ (x y : V),\n ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) y⟫_ℝ =\n ⟪x, y⟫_ℝ",
" ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.r... | [
" ∀ (x y : V),\n ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) y⟫_ℝ =\n ⟪x, y⟫_ℝ",
" ⟪(θ.cos • LinearMap.id + θ.sin • ↑o.rightAngleRotation.toLinearEquiv) x,\n (θ.cos • LinearMap.id + θ.sin • ↑o.r... |
import Mathlib.Algebra.Quaternion
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.quaternion from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566"
@[inherit_doc] scoped[Quaternion] notation "ℍ" => Quaternion ℝ
open scoped RealInnerProductSpace
namespace Quaternion
instance : Inner ℝ ℍ :=
⟨fun a b => (a * star b).re⟩
theorem inner_self (a : ℍ) : ⟪a, a⟫ = normSq a :=
rfl
#align quaternion.inner_self Quaternion.inner_self
theorem inner_def (a b : ℍ) : ⟪a, b⟫ = (a * star b).re :=
rfl
#align quaternion.inner_def Quaternion.inner_def
noncomputable instance : NormedAddCommGroup ℍ :=
@InnerProductSpace.Core.toNormedAddCommGroup ℝ ℍ _ _ _
{ toInner := inferInstance
conj_symm := fun x y => by simp [inner_def, mul_comm]
nonneg_re := fun x => normSq_nonneg
definite := fun x => normSq_eq_zero.1
add_left := fun x y z => by simp only [inner_def, add_mul, add_re]
smul_left := fun x y r => by simp [inner_def] }
noncomputable instance : InnerProductSpace ℝ ℍ :=
InnerProductSpace.ofCore _
theorem normSq_eq_norm_mul_self (a : ℍ) : normSq a = ‖a‖ * ‖a‖ := by
rw [← inner_self, real_inner_self_eq_norm_mul_norm]
#align quaternion.norm_sq_eq_norm_sq Quaternion.normSq_eq_norm_mul_self
instance : NormOneClass ℍ :=
⟨by rw [norm_eq_sqrt_real_inner, inner_self, normSq.map_one, Real.sqrt_one]⟩
@[simp, norm_cast]
theorem norm_coe (a : ℝ) : ‖(a : ℍ)‖ = ‖a‖ := by
rw [norm_eq_sqrt_real_inner, inner_self, normSq_coe, Real.sqrt_sq_eq_abs, Real.norm_eq_abs]
#align quaternion.norm_coe Quaternion.norm_coe
@[simp, norm_cast]
theorem nnnorm_coe (a : ℝ) : ‖(a : ℍ)‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_coe a
#align quaternion.nnnorm_coe Quaternion.nnnorm_coe
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem norm_star (a : ℍ) : ‖star a‖ = ‖a‖ := by
simp_rw [norm_eq_sqrt_real_inner, inner_self, normSq_star]
#align quaternion.norm_star Quaternion.norm_star
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
theorem nnnorm_star (a : ℍ) : ‖star a‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_star a
#align quaternion.nnnorm_star Quaternion.nnnorm_star
noncomputable instance : NormedDivisionRing ℍ where
dist_eq _ _ := rfl
norm_mul' a b := by
simp only [norm_eq_sqrt_real_inner, inner_self, normSq.map_mul]
exact Real.sqrt_mul normSq_nonneg _
-- Porting note: added `noncomputable`
noncomputable instance : NormedAlgebra ℝ ℍ where
norm_smul_le := norm_smul_le
toAlgebra := Quaternion.algebra
instance : CstarRing ℍ where
norm_star_mul_self {x} := (norm_mul _ _).trans <| congr_arg (· * ‖x‖) (norm_star x)
@[coe] def coeComplex (z : ℂ) : ℍ := ⟨z.re, z.im, 0, 0⟩
instance : Coe ℂ ℍ := ⟨coeComplex⟩
@[simp, norm_cast]
theorem coeComplex_re (z : ℂ) : (z : ℍ).re = z.re :=
rfl
#align quaternion.coe_complex_re Quaternion.coeComplex_re
@[simp, norm_cast]
theorem coeComplex_imI (z : ℂ) : (z : ℍ).imI = z.im :=
rfl
#align quaternion.coe_complex_im_i Quaternion.coeComplex_imI
@[simp, norm_cast]
theorem coeComplex_imJ (z : ℂ) : (z : ℍ).imJ = 0 :=
rfl
#align quaternion.coe_complex_im_j Quaternion.coeComplex_imJ
@[simp, norm_cast]
theorem coeComplex_imK (z : ℂ) : (z : ℍ).imK = 0 :=
rfl
#align quaternion.coe_complex_im_k Quaternion.coeComplex_imK
@[simp, norm_cast]
theorem coeComplex_add (z w : ℂ) : ↑(z + w) = (z + w : ℍ) := by ext <;> simp
#align quaternion.coe_complex_add Quaternion.coeComplex_add
@[simp, norm_cast]
| Mathlib/Analysis/Quaternion.lean | 136 | 136 | theorem coeComplex_mul (z w : ℂ) : ↑(z * w) = (z * w : ℍ) := by | ext <;> simp
| [
" (starRingEnd ℝ) ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ",
" ⟪x + y, z⟫_ℝ = ⟪x, z⟫_ℝ + ⟪y, z⟫_ℝ",
" ⟪r • x, y⟫_ℝ = (starRingEnd ℝ) r * ⟪x, y⟫_ℝ",
" normSq a = ‖a‖ * ‖a‖",
" ‖1‖ = 1",
" ‖↑a‖ = ‖a‖",
" ‖star a‖ = ‖a‖",
" ‖a * b‖ = ‖a‖ * ‖b‖",
" √(normSq a * normSq b) = √(normSq a) * √(normSq b)",
" ↑(z + w) = ↑z + ↑w"... | [
" (starRingEnd ℝ) ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ",
" ⟪x + y, z⟫_ℝ = ⟪x, z⟫_ℝ + ⟪y, z⟫_ℝ",
" ⟪r • x, y⟫_ℝ = (starRingEnd ℝ) r * ⟪x, y⟫_ℝ",
" normSq a = ‖a‖ * ‖a‖",
" ‖1‖ = 1",
" ‖↑a‖ = ‖a‖",
" ‖star a‖ = ‖a‖",
" ‖a * b‖ = ‖a‖ * ‖b‖",
" √(normSq a * normSq b) = √(normSq a) * √(normSq b)",
" ↑(z + w) = ↑z + ↑w"... |
import Mathlib.Control.Functor
import Mathlib.Tactic.Common
#align_import control.bifunctor from "leanprover-community/mathlib"@"dc1525fb3ef6eb4348fb1749c302d8abc303d34a"
universe u₀ u₁ u₂ v₀ v₁ v₂
open Function
class Bifunctor (F : Type u₀ → Type u₁ → Type u₂) where
bimap : ∀ {α α' β β'}, (α → α') → (β → β') → F α β → F α' β'
#align bifunctor Bifunctor
export Bifunctor (bimap)
class LawfulBifunctor (F : Type u₀ → Type u₁ → Type u₂) [Bifunctor F] : Prop where
id_bimap : ∀ {α β} (x : F α β), bimap id id x = x
bimap_bimap :
∀ {α₀ α₁ α₂ β₀ β₁ β₂} (f : α₀ → α₁) (f' : α₁ → α₂) (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α₀ β₀),
bimap f' g' (bimap f g x) = bimap (f' ∘ f) (g' ∘ g) x
#align is_lawful_bifunctor LawfulBifunctor
export LawfulBifunctor (id_bimap bimap_bimap)
attribute [higher_order bimap_id_id] id_bimap
#align is_lawful_bifunctor.bimap_id_id LawfulBifunctor.bimap_id_id
attribute [higher_order bimap_comp_bimap] bimap_bimap
#align is_lawful_bifunctor.bimap_comp_bimap LawfulBifunctor.bimap_comp_bimap
export LawfulBifunctor (bimap_id_id bimap_comp_bimap)
variable {F : Type u₀ → Type u₁ → Type u₂} [Bifunctor F]
namespace Bifunctor
abbrev fst {α α' β} (f : α → α') : F α β → F α' β :=
bimap f id
#align bifunctor.fst Bifunctor.fst
abbrev snd {α β β'} (f : β → β') : F α β → F α β' :=
bimap id f
#align bifunctor.snd Bifunctor.snd
variable [LawfulBifunctor F]
@[higher_order fst_id]
theorem id_fst : ∀ {α β} (x : F α β), fst id x = x :=
@id_bimap _ _ _
#align bifunctor.id_fst Bifunctor.id_fst
#align bifunctor.fst_id Bifunctor.fst_id
@[higher_order snd_id]
theorem id_snd : ∀ {α β} (x : F α β), snd id x = x :=
@id_bimap _ _ _
#align bifunctor.id_snd Bifunctor.id_snd
#align bifunctor.snd_id Bifunctor.snd_id
@[higher_order fst_comp_fst]
theorem comp_fst {α₀ α₁ α₂ β} (f : α₀ → α₁) (f' : α₁ → α₂) (x : F α₀ β) :
fst f' (fst f x) = fst (f' ∘ f) x := by simp [fst, bimap_bimap]
#align bifunctor.comp_fst Bifunctor.comp_fst
#align bifunctor.fst_comp_fst Bifunctor.fst_comp_fst
@[higher_order fst_comp_snd]
theorem fst_snd {α₀ α₁ β₀ β₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) :
fst f (snd f' x) = bimap f f' x := by simp [fst, bimap_bimap]
#align bifunctor.fst_snd Bifunctor.fst_snd
#align bifunctor.fst_comp_snd Bifunctor.fst_comp_snd
@[higher_order snd_comp_fst]
| Mathlib/Control/Bifunctor.lean | 98 | 99 | theorem snd_fst {α₀ α₁ β₀ β₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) :
snd f' (fst f x) = bimap f f' x := by | simp [snd, bimap_bimap]
| [
" fst f' (fst f x) = fst (f' ∘ f) x",
" fst f (snd f' x) = bimap f f' x",
" snd f' (fst f x) = bimap f f' x"
] | [
" fst f' (fst f x) = fst (f' ∘ f) x",
" fst f (snd f' x) = bimap f f' x"
] |
import Mathlib.LinearAlgebra.TensorAlgebra.Basic
import Mathlib.LinearAlgebra.TensorPower
#align_import linear_algebra.tensor_algebra.to_tensor_power from "leanprover-community/mathlib"@"d97a0c9f7a7efe6d76d652c5a6b7c9c634b70e0a"
suppress_compilation
open scoped DirectSum TensorProduct
variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
namespace TensorPower
def toTensorAlgebra {n} : ⨂[R]^n M →ₗ[R] TensorAlgebra R M :=
PiTensorProduct.lift (TensorAlgebra.tprod R M n)
#align tensor_power.to_tensor_algebra TensorPower.toTensorAlgebra
@[simp]
theorem toTensorAlgebra_tprod {n} (x : Fin n → M) :
TensorPower.toTensorAlgebra (PiTensorProduct.tprod R x) = TensorAlgebra.tprod R M n x :=
PiTensorProduct.lift.tprod _
#align tensor_power.to_tensor_algebra_tprod TensorPower.toTensorAlgebra_tprod
@[simp]
theorem toTensorAlgebra_gOne :
TensorPower.toTensorAlgebra (@GradedMonoid.GOne.one _ (fun n => ⨂[R]^n M) _ _) = 1 :=
TensorPower.toTensorAlgebra_tprod _
#align tensor_power.to_tensor_algebra_ghas_one TensorPower.toTensorAlgebra_gOne
@[simp]
theorem toTensorAlgebra_gMul {i j} (a : (⨂[R]^i) M) (b : (⨂[R]^j) M) :
TensorPower.toTensorAlgebra (@GradedMonoid.GMul.mul _ (fun n => ⨂[R]^n M) _ _ _ _ a b) =
TensorPower.toTensorAlgebra a * TensorPower.toTensorAlgebra b := by
-- change `a` and `b` to `tprod R a` and `tprod R b`
rw [TensorPower.gMul_eq_coe_linearMap, ← LinearMap.compr₂_apply, ← @LinearMap.mul_apply' R, ←
LinearMap.compl₂_apply, ← LinearMap.comp_apply]
refine LinearMap.congr_fun (LinearMap.congr_fun ?_ a) b
clear! a b
ext (a b)
-- Porting note: pulled the next two lines out of the long `simp only` below.
simp only [LinearMap.compMultilinearMap_apply]
rw [LinearMap.compr₂_apply, ← gMul_eq_coe_linearMap]
simp only [LinearMap.compr₂_apply, LinearMap.mul_apply', LinearMap.compl₂_apply,
LinearMap.comp_apply, LinearMap.compMultilinearMap_apply, PiTensorProduct.lift.tprod,
TensorPower.tprod_mul_tprod, TensorPower.toTensorAlgebra_tprod, TensorAlgebra.tprod_apply, ←
gMul_eq_coe_linearMap]
refine Eq.trans ?_ List.prod_append
congr
-- Porting note: `erw` for `Function.comp`
erw [← List.map_ofFn _ (TensorAlgebra.ι R), ← List.map_ofFn _ (TensorAlgebra.ι R), ←
List.map_ofFn _ (TensorAlgebra.ι R), ← List.map_append, List.ofFn_fin_append]
#align tensor_power.to_tensor_algebra_ghas_mul TensorPower.toTensorAlgebra_gMul
@[simp]
| Mathlib/LinearAlgebra/TensorAlgebra/ToTensorPower.lean | 68 | 72 | theorem toTensorAlgebra_galgebra_toFun (r : R) :
TensorPower.toTensorAlgebra (DirectSum.GAlgebra.toFun (R := R) (A := fun n => ⨂[R]^n M) r) =
algebraMap _ _ r := by |
rw [TensorPower.galgebra_toFun_def, TensorPower.algebraMap₀_eq_smul_one, LinearMap.map_smul,
TensorPower.toTensorAlgebra_gOne, Algebra.algebraMap_eq_smul_one]
| [
" toTensorAlgebra (GradedMonoid.GMul.mul a b) = toTensorAlgebra a * toTensorAlgebra b",
" ((((TensorProduct.mk R (⨂[R]^i M) (⨂[R]^j M)).compr₂ ↑mulEquiv).compr₂ toTensorAlgebra) a) b =\n (((LinearMap.mul R (TensorAlgebra R M)).compl₂ toTensorAlgebra ∘ₗ toTensorAlgebra) a) b",
" ((TensorProduct.mk R (⨂[R]^i M... | [
" toTensorAlgebra (GradedMonoid.GMul.mul a b) = toTensorAlgebra a * toTensorAlgebra b",
" ((((TensorProduct.mk R (⨂[R]^i M) (⨂[R]^j M)).compr₂ ↑mulEquiv).compr₂ toTensorAlgebra) a) b =\n (((LinearMap.mul R (TensorAlgebra R M)).compl₂ toTensorAlgebra ∘ₗ toTensorAlgebra) a) b",
" ((TensorProduct.mk R (⨂[R]^i M... |
import Mathlib.CategoryTheory.Category.Grpd
import Mathlib.CategoryTheory.Groupoid
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Homotopy.Path
import Mathlib.Data.Set.Subsingleton
#align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042"
open CategoryTheory
universe u v
variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y]
variable {x₀ x₁ : X}
noncomputable section
open unitInterval
namespace Path
namespace Homotopy
section
def reflTransSymmAux (x : I × I) : ℝ :=
if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2)
#align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux
@[continuity]
theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by
refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_
· continuity
· continuity
· continuity
· continuity
intro x hx
norm_num [hx, mul_assoc]
#align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux
| Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean | 56 | 79 | theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by |
dsimp only [reflTransSymmAux]
split_ifs
· constructor
· apply mul_nonneg
· apply mul_nonneg
· unit_interval
· norm_num
· unit_interval
· rw [mul_assoc]
apply mul_le_one
· unit_interval
· apply mul_nonneg
· norm_num
· unit_interval
· linarith
· constructor
· apply mul_nonneg
· unit_interval
linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· apply mul_le_one
· unit_interval
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
| [
" Continuous reflTransSymmAux",
" Continuous fun x => ↑x.2",
" Continuous fun x => 1 / 2",
" Continuous fun x => ↑x.1 * 2 * ↑x.2",
" Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)",
" ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ref... | [
" Continuous reflTransSymmAux",
" Continuous fun x => ↑x.2",
" Continuous fun x => 1 / 2",
" Continuous fun x => ↑x.1 * 2 * ↑x.2",
" Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)",
" ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)"
] |
import Mathlib.Algebra.CharP.Basic
import Mathlib.Algebra.CharP.Algebra
import Mathlib.Data.Nat.Prime
#align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe u
variable (R : Type u)
section Semiring
variable [Semiring R]
class inductive ExpChar (R : Type u) [Semiring R] : ℕ → Prop
| zero [CharZero R] : ExpChar R 1
| prime {q : ℕ} (hprime : q.Prime) [hchar : CharP R q] : ExpChar R q
#align exp_char ExpChar
#align exp_char.prime ExpChar.prime
instance expChar_prime (p) [CharP R p] [Fact p.Prime] : ExpChar R p := ExpChar.prime Fact.out
instance expChar_zero [CharZero R] : ExpChar R 1 := ExpChar.zero
instance (S : Type*) [Semiring S] (p) [ExpChar R p] [ExpChar S p] : ExpChar (R × S) p := by
obtain hp | ⟨hp⟩ := ‹ExpChar R p›
· have := Prod.charZero_of_left R S; exact .zero
obtain _ | _ := ‹ExpChar S p›
· exact (Nat.not_prime_one hp).elim
· have := Prod.charP R S p; exact .prime hp
variable {R} in
theorem ExpChar.eq {p q : ℕ} (hp : ExpChar R p) (hq : ExpChar R q) : p = q := by
cases' hp with hp _ hp' hp
· cases' hq with hq _ hq' hq
exacts [rfl, False.elim (Nat.not_prime_zero (CharP.eq R hq (CharP.ofCharZero R) ▸ hq'))]
· cases' hq with hq _ hq' hq
exacts [False.elim (Nat.not_prime_zero (CharP.eq R hp (CharP.ofCharZero R) ▸ hp')),
CharP.eq R hp hq]
theorem ExpChar.congr {p : ℕ} (q : ℕ) [hq : ExpChar R q] (h : q = p) : ExpChar R p := h ▸ hq
noncomputable def ringExpChar (R : Type*) [NonAssocSemiring R] : ℕ := max (ringChar R) 1
theorem ringExpChar.eq (q : ℕ) [h : ExpChar R q] : ringExpChar R = q := by
cases' h with _ _ h _
· haveI := CharP.ofCharZero R
rw [ringExpChar, ringChar.eq R 0]; rfl
rw [ringExpChar, ringChar.eq R q]
exact Nat.max_eq_left h.one_lt.le
@[simp]
theorem ringExpChar.eq_one (R : Type*) [NonAssocSemiring R] [CharZero R] : ringExpChar R = 1 := by
rw [ringExpChar, ringChar.eq_zero, max_eq_right zero_le_one]
theorem expChar_one_of_char_zero (q : ℕ) [hp : CharP R 0] [hq : ExpChar R q] : q = 1 := by
cases' hq with q hq_one hq_prime hq_hchar
· rfl
· exact False.elim <| hq_prime.ne_zero <| hq_hchar.eq R hp
#align exp_char_one_of_char_zero expChar_one_of_char_zero
theorem char_eq_expChar_iff (p q : ℕ) [hp : CharP R p] [hq : ExpChar R q] : p = q ↔ p.Prime := by
cases' hq with q hq_one hq_prime hq_hchar
· rw [(CharP.eq R hp inferInstance : p = 0)]
decide
· exact ⟨fun hpq => hpq.symm ▸ hq_prime, fun _ => CharP.eq R hp hq_hchar⟩
#align char_eq_exp_char_iff char_eq_expChar_iff
section Nontrivial
variable [Nontrivial R]
theorem char_zero_of_expChar_one (p : ℕ) [hp : CharP R p] [hq : ExpChar R 1] : p = 0 := by
cases hq
· exact CharP.eq R hp inferInstance
· exact False.elim (CharP.char_ne_one R 1 rfl)
#align char_zero_of_exp_char_one char_zero_of_expChar_one
-- This could be an instance, but there are no `ExpChar R 1` instances in mathlib.
theorem charZero_of_expChar_one' [hq : ExpChar R 1] : CharZero R := by
cases hq
· assumption
· exact False.elim (CharP.char_ne_one R 1 rfl)
#align char_zero_of_exp_char_one' charZero_of_expChar_one'
theorem expChar_one_iff_char_zero (p q : ℕ) [CharP R p] [ExpChar R q] : q = 1 ↔ p = 0 := by
constructor
· rintro rfl
exact char_zero_of_expChar_one R p
· rintro rfl
exact expChar_one_of_char_zero R q
#align exp_char_one_iff_char_zero expChar_one_iff_char_zero
section NoZeroDivisors
variable [NoZeroDivisors R]
| Mathlib/Algebra/CharP/ExpChar.lean | 133 | 136 | theorem char_prime_of_ne_zero {p : ℕ} [hp : CharP R p] (p_ne_zero : p ≠ 0) : Nat.Prime p := by |
cases' CharP.char_is_prime_or_zero R p with h h
· exact h
· contradiction
| [
" ExpChar (R × S) p",
" ExpChar (R × S) 1",
" p = q",
" 1 = q",
" ringExpChar R = q",
" ringExpChar R = 1",
" max 0 1 = 1",
" max q 1 = q",
" q = 1",
" 1 = 1",
" p = q ↔ p.Prime",
" p = 1 ↔ p.Prime",
" 0 = 1 ↔ Nat.Prime 0",
" p = 0",
" CharZero R",
" q = 1 ↔ p = 0",
" q = 1 → p = 0",... | [
" ExpChar (R × S) p",
" ExpChar (R × S) 1",
" p = q",
" 1 = q",
" ringExpChar R = q",
" ringExpChar R = 1",
" max 0 1 = 1",
" max q 1 = q",
" q = 1",
" 1 = 1",
" p = q ↔ p.Prime",
" p = 1 ↔ p.Prime",
" 0 = 1 ↔ Nat.Prime 0",
" p = 0",
" CharZero R",
" q = 1 ↔ p = 0",
" q = 1 → p = 0",... |
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
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
#align polynomial.coeff_det_X_add_C_card Polynomial.coeff_det_X_add_C_card
| Mathlib/LinearAlgebra/Matrix/Polynomial.lean | 89 | 102 | theorem leadingCoeff_det_X_one_add_C (A : Matrix n n α) :
leadingCoeff (det ((X : α[X]) • (1 : Matrix n n α[X]) + A.map C)) = 1 := by |
cases subsingleton_or_nontrivial α
· simp [eq_iff_true_of_subsingleton]
rw [← @det_one n, ← coeff_det_X_add_C_card _ A, leadingCoeff]
simp only [Matrix.map_one, C_eq_zero, RingHom.map_one]
rcases (natDegree_det_X_add_C_le 1 A).eq_or_lt with h | h
· simp only [RingHom.map_one, Matrix.map_one, C_eq_zero] at h
rw [h]
· -- contradiction. we have a hypothesis that the degree is less than |n|
-- but we know that coeff _ n = 1
have H := coeff_eq_zero_of_natDegree_lt h
rw [coeff_det_X_add_C_card] at H
simp at H
| [
" (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.Algebra.Algebra.Operations
import Mathlib.Data.Fintype.Lattice
import Mathlib.RingTheory.Coprime.Lemmas
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
assert_not_exists Basis -- See `RingTheory.Ideal.Basis`
assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations`
universe u v w x
open Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {M' F G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
⟨Submodule.map₂ (LinearMap.lsmul R M)⟩
#align submodule.has_smul' Submodule.hasSMul'
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
variable (R M) in
def _root_.Module.annihilator : Ideal R := LinearMap.ker (LinearMap.lsmul R M)
theorem _root_.Module.mem_annihilator {r} : r ∈ Module.annihilator R M ↔ ∀ m : M, r • m = 0 :=
⟨fun h ↦ (congr($h ·)), (LinearMap.ext ·)⟩
theorem _root_.LinearMap.annihilator_le_of_injective (f : M →ₗ[R] M') (hf : Function.Injective f) :
Module.annihilator R M' ≤ Module.annihilator R M := fun x h ↦ by
rw [Module.mem_annihilator] at h ⊢; exact fun m ↦ hf (by rw [map_smul, h, f.map_zero])
theorem _root_.LinearMap.annihilator_le_of_surjective (f : M →ₗ[R] M')
(hf : Function.Surjective f) : Module.annihilator R M ≤ Module.annihilator R M' := fun x h ↦ by
rw [Module.mem_annihilator] at h ⊢
intro m; obtain ⟨m, rfl⟩ := hf m
rw [← map_smul, h, f.map_zero]
theorem _root_.LinearEquiv.annihilator_eq (e : M ≃ₗ[R] M') :
Module.annihilator R M = Module.annihilator R M' :=
(e.annihilator_le_of_surjective e.surjective).antisymm (e.annihilator_le_of_injective e.injective)
abbrev annihilator (N : Submodule R M) : Ideal R :=
Module.annihilator R N
#align submodule.annihilator Submodule.annihilator
theorem annihilator_top : (⊤ : Submodule R M).annihilator = Module.annihilator R M :=
topEquiv.annihilator_eq
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = (0 : M) := by
simp_rw [annihilator, Module.mem_annihilator, Subtype.forall, Subtype.ext_iff]; rfl
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r ∈ N.annihilator ↔ N ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) ⊥ :=
mem_annihilator.trans ⟨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hn⟩
#align submodule.mem_annihilator' Submodule.mem_annihilator'
| Mathlib/RingTheory/Ideal/Operations.lean | 82 | 96 | theorem mem_annihilator_span (s : Set M) (r : R) :
r ∈ (Submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 := by |
rw [Submodule.mem_annihilator]
constructor
· intro h n
exact h _ (Submodule.subset_span n.prop)
· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
· intro x hx
exact h ⟨x, hx⟩
· exact smul_zero _
· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
· intro a x hx
rw [smul_comm, hx, smul_zero]
| [
" x ∈ Module.annihilator R M",
" ∀ (m : M), x • m = 0",
" f (x • m) = f 0",
" x ∈ Module.annihilator R M'",
" ∀ (m : M'), x • m = 0",
" x • m = 0",
" x • f m = 0",
" r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = 0",
" (∀ (a : M) (b : a ∈ N), ↑(r • ⟨a, b⟩) = ↑0) ↔ ∀ n ∈ N, r • n = 0",
" r ∈ (span R s).annih... | [
" x ∈ Module.annihilator R M",
" ∀ (m : M), x • m = 0",
" f (x • m) = f 0",
" x ∈ Module.annihilator R M'",
" ∀ (m : M'), x • m = 0",
" x • m = 0",
" x • f m = 0",
" r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = 0",
" (∀ (a : M) (b : a ∈ N), ↑(r • ⟨a, b⟩) = ↑0) ↔ ∀ n ∈ N, r • n = 0"
] |
import Mathlib.Topology.Algebra.InfiniteSum.Defs
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Topology.Algebra.Monoid
noncomputable section
open Filter Finset Function
open scoped Topology
variable {α β γ δ : Type*}
section HasProd
variable [CommMonoid α] [TopologicalSpace α]
variable {f g : β → α} {a b : α} {s : Finset β}
@[to_additive "Constant zero function has sum `0`"]
theorem hasProd_one : HasProd (fun _ ↦ 1 : β → α) 1 := by simp [HasProd, tendsto_const_nhds]
#align has_sum_zero hasSum_zero
@[to_additive]
theorem hasProd_empty [IsEmpty β] : HasProd f 1 := by
convert @hasProd_one α β _ _
#align has_sum_empty hasSum_empty
@[to_additive]
theorem multipliable_one : Multipliable (fun _ ↦ 1 : β → α) :=
hasProd_one.multipliable
#align summable_zero summable_zero
@[to_additive]
theorem multipliable_empty [IsEmpty β] : Multipliable f :=
hasProd_empty.multipliable
#align summable_empty summable_empty
@[to_additive]
theorem multipliable_congr (hfg : ∀ b, f b = g b) : Multipliable f ↔ Multipliable g :=
iff_of_eq (congr_arg Multipliable <| funext hfg)
#align summable_congr summable_congr
@[to_additive]
theorem Multipliable.congr (hf : Multipliable f) (hfg : ∀ b, f b = g b) : Multipliable g :=
(multipliable_congr hfg).mp hf
#align summable.congr Summable.congr
@[to_additive]
lemma HasProd.congr_fun (hf : HasProd f a) (h : ∀ x : β, g x = f x) : HasProd g a :=
(funext h : g = f) ▸ hf
@[to_additive]
theorem HasProd.hasProd_of_prod_eq {g : γ → α}
(h_eq : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' →
∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b)
(hf : HasProd g a) : HasProd f a :=
le_trans (map_atTop_finset_prod_le_of_prod_eq h_eq) hf
#align has_sum.has_sum_of_sum_eq HasSum.hasSum_of_sum_eq
@[to_additive]
theorem hasProd_iff_hasProd {g : γ → α}
(h₁ : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' →
∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b)
(h₂ : ∀ v : Finset β, ∃ u : Finset γ, ∀ u', u ⊆ u' →
∃ v', v ⊆ v' ∧ ∏ b ∈ v', f b = ∏ x ∈ u', g x) :
HasProd f a ↔ HasProd g a :=
⟨HasProd.hasProd_of_prod_eq h₂, HasProd.hasProd_of_prod_eq h₁⟩
#align has_sum_iff_has_sum hasSum_iff_hasSum
@[to_additive]
theorem Function.Injective.multipliable_iff {g : γ → β} (hg : Injective g)
(hf : ∀ x ∉ Set.range g, f x = 1) : Multipliable (f ∘ g) ↔ Multipliable f :=
exists_congr fun _ ↦ hg.hasProd_iff hf
#align function.injective.summable_iff Function.Injective.summable_iff
@[to_additive (attr := simp)] theorem hasProd_extend_one {g : β → γ} (hg : Injective g) :
HasProd (extend g f 1) a ↔ HasProd f a := by
rw [← hg.hasProd_iff, extend_comp hg]
exact extend_apply' _ _
@[to_additive (attr := simp)] theorem multipliable_extend_one {g : β → γ} (hg : Injective g) :
Multipliable (extend g f 1) ↔ Multipliable f :=
exists_congr fun _ ↦ hasProd_extend_one hg
@[to_additive]
theorem hasProd_subtype_iff_mulIndicator {s : Set β} :
HasProd (f ∘ (↑) : s → α) a ↔ HasProd (s.mulIndicator f) a := by
rw [← Set.mulIndicator_range_comp, Subtype.range_coe,
hasProd_subtype_iff_of_mulSupport_subset Set.mulSupport_mulIndicator_subset]
#align has_sum_subtype_iff_indicator hasSum_subtype_iff_indicator
@[to_additive]
theorem multipliable_subtype_iff_mulIndicator {s : Set β} :
Multipliable (f ∘ (↑) : s → α) ↔ Multipliable (s.mulIndicator f) :=
exists_congr fun _ ↦ hasProd_subtype_iff_mulIndicator
#align summable_subtype_iff_indicator summable_subtype_iff_indicator
@[to_additive (attr := simp)]
theorem hasProd_subtype_mulSupport : HasProd (f ∘ (↑) : mulSupport f → α) a ↔ HasProd f a :=
hasProd_subtype_iff_of_mulSupport_subset <| Set.Subset.refl _
#align has_sum_subtype_support hasSum_subtype_support
@[to_additive]
protected theorem Finset.multipliable (s : Finset β) (f : β → α) :
Multipliable (f ∘ (↑) : (↑s : Set β) → α) :=
(s.hasProd f).multipliable
#align finset.summable Finset.summable
@[to_additive]
protected theorem Set.Finite.multipliable {s : Set β} (hs : s.Finite) (f : β → α) :
Multipliable (f ∘ (↑) : s → α) := by
have := hs.toFinset.multipliable f
rwa [hs.coe_toFinset] at this
#align set.finite.summable Set.Finite.summable
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Basic.lean | 132 | 133 | theorem multipliable_of_finite_mulSupport (h : (mulSupport f).Finite) : Multipliable f := by |
apply multipliable_of_ne_finset_one (s := h.toFinset); simp
| [
" HasProd (fun x => 1) 1",
" HasProd f 1",
" HasProd (extend g f 1) a ↔ HasProd f a",
" ∀ x ∉ Set.range g, extend g f 1 x = 1",
" HasProd (f ∘ Subtype.val) a ↔ HasProd (s.mulIndicator f) a",
" Multipliable (f ∘ Subtype.val)",
" Multipliable f",
" ∀ b ∉ h.toFinset, f b = 1"
] | [
" HasProd (fun x => 1) 1",
" HasProd f 1",
" HasProd (extend g f 1) a ↔ HasProd f a",
" ∀ x ∉ Set.range g, extend g f 1 x = 1",
" HasProd (f ∘ Subtype.val) a ↔ HasProd (s.mulIndicator f) a",
" Multipliable (f ∘ Subtype.val)"
] |
import Mathlib.LinearAlgebra.Prod
#align_import linear_algebra.linear_pmap from "leanprover-community/mathlib"@"8b981918a93bc45a8600de608cde7944a80d92b9"
universe u v w
structure LinearPMap (R : Type u) [Ring R] (E : Type v) [AddCommGroup E] [Module R E] (F : Type w)
[AddCommGroup F] [Module R F] where
domain : Submodule R E
toFun : domain →ₗ[R] F
#align linear_pmap LinearPMap
@[inherit_doc] notation:25 E " →ₗ.[" R:25 "] " F:0 => LinearPMap R E F
variable {R : Type*} [Ring R] {E : Type*} [AddCommGroup E] [Module R E] {F : Type*}
[AddCommGroup F] [Module R F] {G : Type*} [AddCommGroup G] [Module R G]
namespace LinearPMap
open Submodule
-- Porting note: A new definition underlying a coercion `↑`.
@[coe]
def toFun' (f : E →ₗ.[R] F) : f.domain → F := f.toFun
instance : CoeFun (E →ₗ.[R] F) fun f : E →ₗ.[R] F => f.domain → F :=
⟨toFun'⟩
@[simp]
theorem toFun_eq_coe (f : E →ₗ.[R] F) (x : f.domain) : f.toFun x = f x :=
rfl
#align linear_pmap.to_fun_eq_coe LinearPMap.toFun_eq_coe
@[ext]
| Mathlib/LinearAlgebra/LinearPMap.lean | 64 | 70 | theorem ext {f g : E →ₗ.[R] F} (h : f.domain = g.domain)
(h' : ∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y) : f = g := by |
rcases f with ⟨f_dom, f⟩
rcases g with ⟨g_dom, g⟩
obtain rfl : f_dom = g_dom := h
obtain rfl : f = g := LinearMap.ext fun x => h' rfl
rfl
| [
" f = g",
" { domain := f_dom, toFun := f } = g",
" { domain := f_dom, toFun := f } = { domain := g_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := f }"
] | [] |
import Mathlib.Analysis.Convex.Slope
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Tactic.LinearCombination
#align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
open Real Set NNReal
theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by
apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ
rintro x y z - - hxy hyz
trans exp y
· have h1 : 0 < y - x := by linarith
have h2 : x - y < 0 := by linarith
rw [div_lt_iff h1]
calc
exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf
_ = exp y * (1 - exp (x - y)) := by ring
_ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne]
_ = exp y * (y - x) := by ring
· have h1 : 0 < z - y := by linarith
rw [lt_div_iff h1]
calc
exp y * (z - y) < exp y * (exp (z - y) - 1) := by
gcongr _ * ?_
linarith [add_one_lt_exp h1.ne']
_ = exp (z - y) * exp y - exp y := by ring
_ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl
#align strict_convex_on_exp strictConvexOn_exp
theorem convexOn_exp : ConvexOn ℝ univ exp :=
strictConvexOn_exp.convexOn
#align convex_on_exp convexOn_exp
theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ))
intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz
have hy : 0 < y := hx.trans hxy
trans y⁻¹
· have h : 0 < z - y := by linarith
rw [div_lt_iff h]
have hyz' : 0 < z / y := by positivity
have hyz'' : z / y ≠ 1 := by
contrapose! h
rw [div_eq_one_iff_eq hy.ne'] at h
simp [h]
calc
log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
_ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz''
_ = y⁻¹ * (z - y) := by field_simp
· have h : 0 < y - x := by linarith
rw [lt_div_iff h]
have hxy' : 0 < x / y := by positivity
have hxy'' : x / y ≠ 1 := by
contrapose! h
rw [div_eq_one_iff_eq hy.ne'] at h
simp [h]
calc
y⁻¹ * (y - x) = 1 - x / y := by field_simp
_ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy'']
_ = -(log x - log y) := by rw [log_div hx.ne' hy.ne']
_ = log y - log x := by ring
#align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) :
1 + p * s < (1 + s) ^ p := by
have hp' : 0 < p := zero_lt_one.trans hp
rcases eq_or_lt_of_le hs with rfl | hs
· rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add]
have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs
rcases le_or_lt (1 + p * s) 0 with hs2 | hs2
· exact hs2.trans_lt (rpow_pos_of_pos hs1 _)
have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp
have hs4 : 1 + p * s ≠ 1 := by
contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs'
rw [rpow_def_of_pos hs1, ← exp_log hs2]
apply exp_strictMono
cases' lt_or_gt_of_ne hs' with hs' hs'
· rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs']
convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1
· rw [add_sub_cancel_left, log_one, sub_zero]
· rw [add_sub_cancel_left, div_div, log_one, sub_zero]
· apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp)
· rw [← div_lt_iff hp', ← div_lt_div_right hs']
convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1
· rw [add_sub_cancel_left, div_div, log_one, sub_zero]
· rw [add_sub_cancel_left, log_one, sub_zero]
· apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp)
#align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) :
1 + p * s ≤ (1 + s) ^ p := by
rcases eq_or_lt_of_le hp with (rfl | hp)
· simp
by_cases hs' : s = 0
· simp [hs']
exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
#align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
| Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean | 138 | 163 | theorem rpow_one_add_lt_one_add_mul_self {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp1 : 0 < p)
(hp2 : p < 1) : (1 + s) ^ p < 1 + p * s := by |
rcases eq_or_lt_of_le hs with rfl | hs
· rwa [add_right_neg, zero_rpow hp1.ne', mul_neg_one, lt_add_neg_iff_add_lt, zero_add]
have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs
have hs2 : 0 < 1 + p * s := by
rw [← neg_lt_iff_pos_add']
rcases lt_or_gt_of_ne hs' with h | h
· exact hs.trans (lt_mul_of_lt_one_left h hp2)
· exact neg_one_lt_zero.trans (mul_pos hp1 h)
have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp
have hs4 : 1 + p * s ≠ 1 := by
contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp1.ne', false_or] at hs'
rw [rpow_def_of_pos hs1, ← exp_log hs2]
apply exp_strictMono
cases' lt_or_gt_of_ne hs' with hs' hs'
· rw [← lt_div_iff hp1, ← div_lt_div_right_of_neg hs']
convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1
· rw [add_sub_cancel_left, div_div, log_one, sub_zero]
· rw [add_sub_cancel_left, log_one, sub_zero]
· apply add_lt_add_left (lt_mul_of_lt_one_left hs' hp2)
· rw [← lt_div_iff hp1, ← div_lt_div_right hs']
convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1
· rw [add_sub_cancel_left, log_one, sub_zero]
· rw [add_sub_cancel_left, div_div, log_one, sub_zero]
· apply add_lt_add_left (mul_lt_of_lt_one_left hs' hp2)
| [
" StrictConvexOn ℝ univ rexp",
" ∀ {x y z : ℝ}, x ∈ univ → z ∈ univ → x < y → y < z → (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)",
" (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)",
" (rexp y - rexp x) / (y - x) < rexp y",
" 0 < y - x",
" x - y < 0",
" rexp y - rexp x < rexp y ... | [
" StrictConvexOn ℝ univ rexp",
" ∀ {x y z : ℝ}, x ∈ univ → z ∈ univ → x < y → y < z → (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)",
" (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)",
" (rexp y - rexp x) / (y - x) < rexp y",
" 0 < y - x",
" x - y < 0",
" rexp y - rexp x < rexp y ... |
import Mathlib.Algebra.CharP.Defs
import Mathlib.RingTheory.Multiplicity
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section OrderBasic
open multiplicity
variable [Semiring R] {φ : R⟦X⟧}
| Mathlib/RingTheory/PowerSeries/Order.lean | 47 | 51 | theorem exists_coeff_ne_zero_iff_ne_zero : (∃ n : ℕ, coeff R n φ ≠ 0) ↔ φ ≠ 0 := by |
refine not_iff_not.mp ?_
push_neg
-- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386?
simp [PowerSeries.ext_iff, (coeff R _).map_zero]
| [
" (∃ n, (coeff R n) φ ≠ 0) ↔ φ ≠ 0",
" (¬∃ n, (coeff R n) φ ≠ 0) ↔ ¬φ ≠ 0",
" (∀ (n : ℕ), (coeff R n) φ = 0) ↔ φ = 0"
] | [] |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.Data.ZMod.Quotient
import Mathlib.RingTheory.DedekindDomain.AdicValuation
#align_import ring_theory.dedekind_domain.selmer_group from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973"
set_option quotPrecheck false
local notation K "/" n => Kˣ ⧸ (powMonoidHom n : Kˣ →* Kˣ).range
namespace IsDedekindDomain
noncomputable section
open scoped Classical DiscreteValuation nonZeroDivisors
universe u v
variable {R : Type u} [CommRing R] [IsDedekindDomain R] {K : Type v} [Field K]
[Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R)
namespace HeightOneSpectrum
def valuationOfNeZeroToFun (x : Kˣ) : Multiplicative ℤ :=
let hx := IsLocalization.sec R⁰ (x : K)
Multiplicative.ofAdd <|
(-(Associates.mk v.asIdeal).count (Associates.mk <| Ideal.span {hx.fst}).factors : ℤ) -
(-(Associates.mk v.asIdeal).count (Associates.mk <| Ideal.span {(hx.snd : R)}).factors : ℤ)
#align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_to_fun IsDedekindDomain.HeightOneSpectrum.valuationOfNeZeroToFun
@[simp]
theorem valuationOfNeZeroToFun_eq (x : Kˣ) :
(v.valuationOfNeZeroToFun x : ℤₘ₀) = v.valuation (x : K) := by
rw [show v.valuation (x : K) = _ * _ by rfl]
rw [Units.val_inv_eq_inv_val]
change _ = ite _ _ _ * (ite _ _ _)⁻¹
simp_rw [IsLocalization.toLocalizationMap_sec, SubmonoidClass.coe_subtype,
if_neg <| IsLocalization.sec_fst_ne_zero le_rfl x.ne_zero,
if_neg (nonZeroDivisors.coe_ne_zero _),
valuationOfNeZeroToFun, ofAdd_sub, ofAdd_neg, div_inv_eq_mul, WithZero.coe_mul,
WithZero.coe_inv, inv_inv]
#align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_to_fun_eq IsDedekindDomain.HeightOneSpectrum.valuationOfNeZeroToFun_eq
def valuationOfNeZero : Kˣ →* Multiplicative ℤ where
toFun := v.valuationOfNeZeroToFun
map_one' := by rw [← WithZero.coe_inj, valuationOfNeZeroToFun_eq]; exact map_one _
map_mul' _ _ := by
rw [← WithZero.coe_inj, WithZero.coe_mul]
simp only [valuationOfNeZeroToFun_eq]; exact map_mul _ _ _
#align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero IsDedekindDomain.HeightOneSpectrum.valuationOfNeZero
@[simp]
theorem valuationOfNeZero_eq (x : Kˣ) : (v.valuationOfNeZero x : ℤₘ₀) = v.valuation (x : K) :=
valuationOfNeZeroToFun_eq v x
#align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_eq IsDedekindDomain.HeightOneSpectrum.valuationOfNeZero_eq
@[simp]
theorem valuation_of_unit_eq (x : Rˣ) :
v.valuationOfNeZero (Units.map (algebraMap R K : R →* K) x) = 1 := by
rw [← WithZero.coe_inj, valuationOfNeZero_eq, Units.coe_map, eq_iff_le_not_lt]
constructor
· exact v.valuation_le_one x
· cases' x with x _ hx _
change ¬v.valuation (algebraMap R K x) < 1
apply_fun v.intValuation at hx
rw [map_one, map_mul] at hx
rw [not_lt, ← hx, ← mul_one <| v.valuation _, valuation_of_algebraMap,
mul_le_mul_left₀ <| left_ne_zero_of_mul_eq_one hx]
exact v.int_valuation_le_one _
#align is_dedekind_domain.height_one_spectrum.valuation_of_unit_eq IsDedekindDomain.HeightOneSpectrum.valuation_of_unit_eq
-- Porting note: invalid attribute 'semireducible', declaration is in an imported module
-- attribute [local semireducible] MulOpposite
def valuationOfNeZeroMod (n : ℕ) : (K/n) →* Multiplicative (ZMod n) :=
(Int.quotientZMultiplesNatEquivZMod n).toMultiplicative.toMonoidHom.comp <|
QuotientGroup.map (powMonoidHom n : Kˣ →* Kˣ).range
(AddSubgroup.toSubgroup (AddSubgroup.zmultiples (n : ℤ)))
v.valuationOfNeZero
(by
rintro _ ⟨x, rfl⟩
exact
⟨v.valuationOfNeZero x, by simp only [powMonoidHom_apply, map_pow, Int.toAdd_pow]; rfl⟩)
#align is_dedekind_domain.height_one_spectrum.valuation_of_ne_zero_mod IsDedekindDomain.HeightOneSpectrum.valuationOfNeZeroMod
@[simp]
| Mathlib/RingTheory/DedekindDomain/SelmerGroup.lean | 150 | 155 | theorem valuation_of_unit_mod_eq (n : ℕ) (x : Rˣ) :
v.valuationOfNeZeroMod n (Units.map (algebraMap R K : R →* K) x : K/n) = 1 := by |
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [valuationOfNeZeroMod, MonoidHom.comp_apply, ← QuotientGroup.coe_mk',
QuotientGroup.map_mk' (G := Kˣ) (N := MonoidHom.range (powMonoidHom n)),
valuation_of_unit_eq, QuotientGroup.mk_one, map_one]
| [
" ↑(v.valuationOfNeZeroToFun x) = v.valuation ↑x",
" v.valuation ↑x = ?m.4479 * ?m.4482",
" ↑(v.valuationOfNeZeroToFun x) =\n ↑v.intValuation.toMonoidWithZeroHom ((IsLocalization.toLocalizationMap R⁰ K).sec ↑x).1 *\n ↑((IsUnit.liftRight ((↑v.intValuation.toMonoidWithZeroHom).restrict R⁰) ⋯)\n ... | [
" ↑(v.valuationOfNeZeroToFun x) = v.valuation ↑x",
" v.valuation ↑x = ?m.4479 * ?m.4482",
" ↑(v.valuationOfNeZeroToFun x) =\n ↑v.intValuation.toMonoidWithZeroHom ((IsLocalization.toLocalizationMap R⁰ K).sec ↑x).1 *\n ↑((IsUnit.liftRight ((↑v.intValuation.toMonoidWithZeroHom).restrict R⁰) ⋯)\n ... |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
#align catalan_succ catalan_succ
theorem catalan_succ' (n : ℕ) :
catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2 := by
rw [catalan_succ, Nat.sum_antidiagonal_eq_sum_range_succ (fun x y => catalan x * catalan y) n,
sum_range]
#align catalan_succ' catalan_succ'
@[simp]
theorem catalan_one : catalan 1 = 1 := by simp [catalan_succ]
#align catalan_one catalan_one
private def gosperCatalan (n j : ℕ) : ℚ :=
Nat.centralBinom j * Nat.centralBinom (n - j) * (2 * j - n) / (2 * n * (n + 1))
private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1) := by
have l₁ : (i : ℚ) + 1 ≠ 0 := by norm_cast
have l₂ : (n : ℚ) - i + 1 ≠ 0 := by norm_cast
have h₁ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (i + 1))) l₁).symm
have h₂ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (n - i + 1))) l₂).symm
have h₃ : ((i : ℚ) + 1) * (i + 1).centralBinom = 2 * (2 * i + 1) * i.centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ i
have h₄ :
((n : ℚ) - i + 1) * (n - i + 1).centralBinom = 2 * (2 * (n - i) + 1) * (n - i).centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ (n - i)
simp only [gosperCatalan]
push_cast
rw [show n + 1 - i = n - i + 1 by rw [Nat.add_comm (n - i) 1, ← (Nat.add_sub_assoc h 1),
add_comm]]
rw [h₁, h₂, h₃, h₄]
field_simp
ring
private theorem gosper_catalan_sub_eq_central_binom_div (n : ℕ) : gosperCatalan (n + 1) (n + 1) -
gosperCatalan (n + 1) 0 = Nat.centralBinom (n + 1) / (n + 2) := by
have : (n : ℚ) + 1 ≠ 0 := by norm_cast
have : (n : ℚ) + 1 + 1 ≠ 0 := by norm_cast
have h : (n : ℚ) + 2 ≠ 0 := by norm_cast
simp only [gosperCatalan, Nat.sub_zero, Nat.centralBinom_zero, Nat.sub_self]
field_simp
ring
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 116 | 137 | theorem catalan_eq_centralBinom_div (n : ℕ) : catalan n = n.centralBinom / (n + 1) := by |
suffices (catalan n : ℚ) = Nat.centralBinom n / (n + 1) by
have h := Nat.succ_dvd_centralBinom n
exact mod_cast this
induction' n using Nat.case_strong_induction_on with d hd
· simp
· simp_rw [catalan_succ, Nat.cast_sum, Nat.cast_mul]
trans (∑ i : Fin d.succ, Nat.centralBinom i / (i + 1) *
(Nat.centralBinom (d - i) / (d - i + 1)) : ℚ)
· congr
ext1 x
have m_le_d : x.val ≤ d := by apply Nat.le_of_lt_succ; apply x.2
have d_minus_x_le_d : (d - x.val) ≤ d := tsub_le_self
rw [hd _ m_le_d, hd _ d_minus_x_le_d]
norm_cast
· trans (∑ i : Fin d.succ, (gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i))
· refine sum_congr rfl fun i _ => ?_
rw [gosper_trick i.is_le, mul_div]
· rw [← sum_range fun i => gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i,
sum_range_sub, Nat.succ_eq_add_one]
rw [gosper_catalan_sub_eq_central_binom_div d]
norm_cast
| [
" catalan 0 = 1",
" catalan (n + 1) = ∑ i : Fin n.succ, catalan ↑i * catalan (n - ↑i)",
" catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2",
" catalan 1 = 1",
" gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =\n ↑i.centralBinom / (↑i + 1) * ↑(n - i).centralBinom / (↑n - ↑i + ... | [
" catalan 0 = 1",
" catalan (n + 1) = ∑ i : Fin n.succ, catalan ↑i * catalan (n - ↑i)",
" catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2",
" catalan 1 = 1",
" gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =\n ↑i.centralBinom / (↑i + 1) * ↑(n - i).centralBinom / (↑n - ↑i + ... |
import Mathlib.Data.Set.Image
import Mathlib.Order.SuccPred.Relation
import Mathlib.Topology.Clopen
import Mathlib.Topology.Irreducible
#align_import topology.connected from "leanprover-community/mathlib"@"d101e93197bb5f6ea89bd7ba386b7f7dff1f3903"
open Set Function Topology TopologicalSpace Relation
open scoped Classical
universe u v
variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*} [TopologicalSpace α]
{s t u v : Set α}
section Preconnected
def IsPreconnected (s : Set α) : Prop :=
∀ u v : Set α, IsOpen u → IsOpen v → s ⊆ u ∪ v → (s ∩ u).Nonempty → (s ∩ v).Nonempty →
(s ∩ (u ∩ v)).Nonempty
#align is_preconnected IsPreconnected
def IsConnected (s : Set α) : Prop :=
s.Nonempty ∧ IsPreconnected s
#align is_connected IsConnected
theorem IsConnected.nonempty {s : Set α} (h : IsConnected s) : s.Nonempty :=
h.1
#align is_connected.nonempty IsConnected.nonempty
theorem IsConnected.isPreconnected {s : Set α} (h : IsConnected s) : IsPreconnected s :=
h.2
#align is_connected.is_preconnected IsConnected.isPreconnected
theorem IsPreirreducible.isPreconnected {s : Set α} (H : IsPreirreducible s) : IsPreconnected s :=
fun _ _ hu hv _ => H _ _ hu hv
#align is_preirreducible.is_preconnected IsPreirreducible.isPreconnected
theorem IsIrreducible.isConnected {s : Set α} (H : IsIrreducible s) : IsConnected s :=
⟨H.nonempty, H.isPreirreducible.isPreconnected⟩
#align is_irreducible.is_connected IsIrreducible.isConnected
theorem isPreconnected_empty : IsPreconnected (∅ : Set α) :=
isPreirreducible_empty.isPreconnected
#align is_preconnected_empty isPreconnected_empty
theorem isConnected_singleton {x} : IsConnected ({x} : Set α) :=
isIrreducible_singleton.isConnected
#align is_connected_singleton isConnected_singleton
theorem isPreconnected_singleton {x} : IsPreconnected ({x} : Set α) :=
isConnected_singleton.isPreconnected
#align is_preconnected_singleton isPreconnected_singleton
theorem Set.Subsingleton.isPreconnected {s : Set α} (hs : s.Subsingleton) : IsPreconnected s :=
hs.induction_on isPreconnected_empty fun _ => isPreconnected_singleton
#align set.subsingleton.is_preconnected Set.Subsingleton.isPreconnected
theorem isPreconnected_of_forall {s : Set α} (x : α)
(H : ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) : IsPreconnected s := by
rintro u v hu hv hs ⟨z, zs, zu⟩ ⟨y, ys, yv⟩
have xs : x ∈ s := by
rcases H y ys with ⟨t, ts, xt, -, -⟩
exact ts xt
-- Porting note (#11215): TODO: use `wlog xu : x ∈ u := hs xs using u v y z, v u z y`
cases hs xs with
| inl xu =>
rcases H y ys with ⟨t, ts, xt, yt, ht⟩
have := ht u v hu hv (ts.trans hs) ⟨x, xt, xu⟩ ⟨y, yt, yv⟩
exact this.imp fun z hz => ⟨ts hz.1, hz.2⟩
| inr xv =>
rcases H z zs with ⟨t, ts, xt, zt, ht⟩
have := ht v u hv hu (ts.trans <| by rwa [union_comm]) ⟨x, xt, xv⟩ ⟨z, zt, zu⟩
exact this.imp fun _ h => ⟨ts h.1, h.2.2, h.2.1⟩
#align is_preconnected_of_forall isPreconnected_of_forall
theorem isPreconnected_of_forall_pair {s : Set α}
(H : ∀ x ∈ s, ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) :
IsPreconnected s := by
rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
exacts [isPreconnected_empty, isPreconnected_of_forall x fun y => H x hx y]
#align is_preconnected_of_forall_pair isPreconnected_of_forall_pair
theorem isPreconnected_sUnion (x : α) (c : Set (Set α)) (H1 : ∀ s ∈ c, x ∈ s)
(H2 : ∀ s ∈ c, IsPreconnected s) : IsPreconnected (⋃₀ c) := by
apply isPreconnected_of_forall x
rintro y ⟨s, sc, ys⟩
exact ⟨s, subset_sUnion_of_mem sc, H1 s sc, ys, H2 s sc⟩
#align is_preconnected_sUnion isPreconnected_sUnion
theorem isPreconnected_iUnion {ι : Sort*} {s : ι → Set α} (h₁ : (⋂ i, s i).Nonempty)
(h₂ : ∀ i, IsPreconnected (s i)) : IsPreconnected (⋃ i, s i) :=
Exists.elim h₁ fun f hf => isPreconnected_sUnion f _ hf (forall_mem_range.2 h₂)
#align is_preconnected_Union isPreconnected_iUnion
theorem IsPreconnected.union (x : α) {s t : Set α} (H1 : x ∈ s) (H2 : x ∈ t) (H3 : IsPreconnected s)
(H4 : IsPreconnected t) : IsPreconnected (s ∪ t) :=
sUnion_pair s t ▸ isPreconnected_sUnion x {s, t} (by rintro r (rfl | rfl | h) <;> assumption)
(by rintro r (rfl | rfl | h) <;> assumption)
#align is_preconnected.union IsPreconnected.union
theorem IsPreconnected.union' {s t : Set α} (H : (s ∩ t).Nonempty) (hs : IsPreconnected s)
(ht : IsPreconnected t) : IsPreconnected (s ∪ t) := by
rcases H with ⟨x, hxs, hxt⟩
exact hs.union x hxs hxt ht
#align is_preconnected.union' IsPreconnected.union'
| Mathlib/Topology/Connected/Basic.lean | 148 | 153 | theorem IsConnected.union {s t : Set α} (H : (s ∩ t).Nonempty) (Hs : IsConnected s)
(Ht : IsConnected t) : IsConnected (s ∪ t) := by |
rcases H with ⟨x, hx⟩
refine ⟨⟨x, mem_union_left t (mem_of_mem_inter_left hx)⟩, ?_⟩
exact Hs.isPreconnected.union x (mem_of_mem_inter_left hx) (mem_of_mem_inter_right hx)
Ht.isPreconnected
| [
" IsPreconnected s",
" (s ∩ (u ∩ v)).Nonempty",
" x ∈ s",
" s ⊆ v ∪ u",
" IsPreconnected (⋃₀ c)",
" ∀ y ∈ ⋃₀ c, ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∀ s_1 ∈ {s, t}, x ∈ s_1",
" x ∈ r",
" x ∈ t",
" ∀ s_1 ∈ {s, t}, IsPreconnected s_1",
... | [
" IsPreconnected s",
" (s ∩ (u ∩ v)).Nonempty",
" x ∈ s",
" s ⊆ v ∪ u",
" IsPreconnected (⋃₀ c)",
" ∀ y ∈ ⋃₀ c, ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∀ s_1 ∈ {s, t}, x ∈ s_1",
" x ∈ r",
" x ∈ t",
" ∀ s_1 ∈ {s, t}, IsPreconnected s_1",
... |
import Mathlib.Algebra.Homology.Homotopy
import Mathlib.Algebra.Category.ModuleCat.Abelian
import Mathlib.Algebra.Category.ModuleCat.Subobject
import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory
#align_import algebra.homology.Module from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Limits HomologicalComplex
variable {R : Type v} [Ring R]
variable {ι : Type*} {c : ComplexShape ι} {C D : HomologicalComplex (ModuleCat.{u} R) c}
namespace ModuleCat
| Mathlib/Algebra/Homology/ModuleCat.lean | 37 | 49 | theorem homology'_ext {L M N K : ModuleCat.{u} R} {f : L ⟶ M} {g : M ⟶ N} (w : f ≫ g = 0)
{h k : homology' f g w ⟶ K}
(w :
∀ x : LinearMap.ker g,
h (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x)) =
k (cokernel.π (imageToKernel _ _ w) (toKernelSubobject x))) :
h = k := by |
refine Concrete.cokernel_funext fun n => ?_
-- Porting note: as `equiv_rw` was not ported, it was replaced by `Equiv.surjective`
-- Gosh it would be nice if `equiv_rw` could directly use an isomorphism, or an enriched `≃`.
obtain ⟨n, rfl⟩ := (kernelSubobjectIso g ≪≫
ModuleCat.kernelIsoKer g).toLinearEquiv.toEquiv.symm.surjective n
exact w n
| [
" h = k",
" h ((cokernel.π (imageToKernel f g w✝)) n) = k ((cokernel.π (imageToKernel f g w✝)) n)",
" h ((cokernel.π (imageToKernel f g w✝)) ((kernelSubobjectIso g ≪≫ kernelIsoKer g).toLinearEquiv.toEquiv.symm n)) =\n k ((cokernel.π (imageToKernel f g w✝)) ((kernelSubobjectIso g ≪≫ kernelIsoKer g).toLinearEq... | [] |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Module.Torsion
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v v' u₁' w w'
variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum
variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁]
variable [Module R M] [Module R M'] [Module R M₁]
section Finsupp
variable (R M M')
variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M']
open Module.Free
@[simp]
theorem rank_finsupp (ι : Type w) :
Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by
obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma,
Cardinal.sum_const]
#align rank_finsupp rank_finsupp
theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by
simp [rank_finsupp]
#align rank_finsupp' rank_finsupp'
-- Porting note, this should not be `@[simp]`, as simp can prove it.
-- @[simp]
theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by
simp [rank_finsupp]
#align rank_finsupp_self rank_finsupp_self
theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp
#align rank_finsupp_self' rank_finsupp_self'
@[simp]
theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)]
[∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] :
Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by
let B i := chooseBasis R (M i)
let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i
simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank'']
#align rank_direct_sum rank_directSum
@[simp]
theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) =
Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by
cases nonempty_fintype m
cases nonempty_fintype n
have h := (Matrix.stdBasis R m n).mk_eq_rank
rw [← lift_lift.{max v w u, max v w}, lift_inj] at h
simpa using h.symm
#align rank_matrix rank_matrix
@[simp high]
theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by
rw [rank_matrix, lift_mul, lift_umax.{v, u}]
#align rank_matrix' rank_matrix'
-- @[simp] -- Porting note (#10618): simp can prove this
theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = #m * #n := by simp
#align rank_matrix'' rank_matrix''
variable [Module.Finite R M] [Module.Finite R M']
open Fintype
namespace FiniteDimensional
@[simp]
theorem finrank_finsupp {ι : Type v} [Fintype ι] : finrank R (ι →₀ M) = card ι * finrank R M := by
rw [finrank, finrank, rank_finsupp, ← mk_toNat_eq_card, toNat_mul, toNat_lift, toNat_lift]
@[simp]
| Mathlib/LinearAlgebra/Dimension/Constructions.lean | 235 | 236 | theorem finrank_finsupp_self {ι : Type v} [Fintype ι] : finrank R (ι →₀ R) = card ι := by |
rw [finrank, rank_finsupp_self, ← mk_toNat_eq_card, toNat_lift]
| [
" Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)",
" Module.rank R (ι →₀ M) = #ι * Module.rank R M",
" Module.rank R (ι →₀ R) = lift.{u, w} #ι",
" Module.rank R (ι →₀ R) = #ι",
" Module.rank R (⨁ (i : ι), M i) = sum fun i => Module.rank R (M i)",
" Module.rank R (Matrix m n R) = l... | [
" Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)",
" Module.rank R (ι →₀ M) = #ι * Module.rank R M",
" Module.rank R (ι →₀ R) = lift.{u, w} #ι",
" Module.rank R (ι →₀ R) = #ι",
" Module.rank R (⨁ (i : ι), M i) = sum fun i => Module.rank R (M i)",
" Module.rank R (Matrix m n R) = l... |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΓToStalk (x : X) : Γ.obj (op X) ⟶ X.presheaf.stalk x :=
X.presheaf.germ (⟨x, trivial⟩ : (⊤ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Γ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΓToStalk
def toΓSpecFun : X → PrimeSpectrum (Γ.obj (op X)) := fun x =>
comap (X.ΓToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΓSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Γ.obj (op X)) (x : X) :
r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit (X.ΓToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
theorem toΓSpec_preim_basicOpen_eq (r : Γ.obj (op X)) :
X.toΓSpecFun ⁻¹' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΓSpec_preim_basicOpen_eq
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 91 | 95 | theorem toΓSpec_continuous : Continuous X.toΓSpecFun := by |
rw [isTopologicalBasis_basic_opens.continuous_iff]
rintro _ ⟨r, rfl⟩
erw [X.toΓSpec_preim_basicOpen_eq r]
exact (X.toRingedSpace.basicOpen r).2
| [
" r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)",
" X.toΓSpecFun ⁻¹' (basicOpen r).carrier = (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ IsUnit ((X.toRingedSpace.... | [
" r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)",
" X.toΓSpecFun ⁻¹' (basicOpen r).carrier = (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ IsUnit ((X.toRingedSpace.... |
import Mathlib.Analysis.NormedSpace.Spectrum
import Mathlib.Topology.ContinuousFunction.NonUnitalFunctionalCalculus
import Mathlib.Topology.ContinuousFunction.StoneWeierstrass
section UniqueUnital
section NNReal
open NNReal
variable {X : Type*} [TopologicalSpace X]
variable {A : Type*} [TopologicalSpace A] [Ring A] [StarRing A] [Algebra ℝ A] [TopologicalRing A]
section UniqueNonUnital
section RCLike
variable {𝕜 A : Type*} [RCLike 𝕜]
open NonUnitalStarAlgebra in
| Mathlib/Topology/ContinuousFunction/UniqueCFC.lean | 207 | 218 | theorem RCLike.uniqueNonUnitalContinuousFunctionalCalculus_of_compactSpace_quasispectrum
[TopologicalSpace A] [T2Space A] [NonUnitalRing A] [StarRing A] [Module 𝕜 A]
[IsScalarTower 𝕜 A A] [SMulCommClass 𝕜 A A] [h : ∀ a : A, CompactSpace (quasispectrum 𝕜 a)] :
UniqueNonUnitalContinuousFunctionalCalculus 𝕜 A where
eq_of_continuous_of_map_id s hs _inst h0 φ ψ hφ hψ h := by |
rw [DFunLike.ext'_iff, ← Set.eqOn_univ, ← (ContinuousMapZero.adjoin_id_dense h0).closure_eq]
refine Set.EqOn.closure (fun f hf ↦ ?_) hφ hψ
rw [← NonUnitalStarAlgHom.mem_equalizer]
apply adjoin_le ?_ hf
rw [Set.singleton_subset_iff]
exact h
compactSpace_quasispectrum := h
| [
" φ = ψ",
" Set.EqOn (⇑φ) (⇑ψ) (closure ↑(adjoin 𝕜 {ContinuousMapZero.id h0}))",
" φ f = ψ f",
" f ∈ NonUnitalStarAlgHom.equalizer φ ψ",
" {ContinuousMapZero.id h0} ⊆ ↑(NonUnitalStarAlgHom.equalizer φ ψ)",
" ContinuousMapZero.id h0 ∈ ↑(NonUnitalStarAlgHom.equalizer φ ψ)"
] | [] |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.NormedSpace.BallAction
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Geometry.Manifold.Algebra.LieGroup
import Mathlib.Geometry.Manifold.Instances.Real
import Mathlib.Geometry.Manifold.MFDeriv.Basic
#align_import geometry.manifold.instances.sphere from "leanprover-community/mathlib"@"0dc4079202c28226b2841a51eb6d3cc2135bb80f"
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
noncomputable section
open Metric FiniteDimensional Function
open scoped Manifold
section SmoothManifold
| Mathlib/Geometry/Manifold/Instances/Sphere.lean | 385 | 386 | theorem sphere_ext_iff (u v : sphere (0 : E) 1) : u = v ↔ ⟪(u : E), v⟫_ℝ = 1 := by |
simp [Subtype.ext_iff, inner_eq_one_iff_of_norm_one]
| [
" u = v ↔ ⟪↑u, ↑v⟫_ℝ = 1"
] | [] |
import Mathlib.Topology.Category.Profinite.Basic
import Mathlib.Topology.LocallyConstant.Basic
import Mathlib.Topology.DiscreteQuotient
import Mathlib.Topology.Category.TopCat.Limits.Cofiltered
import Mathlib.Topology.Category.TopCat.Limits.Konig
#align_import topology.category.Profinite.cofiltered_limit from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1"
namespace Profinite
open scoped Classical
open CategoryTheory
open CategoryTheory.Limits
-- This was a global instance prior to #13170. We may experiment with removing it.
attribute [local instance] ConcreteCategory.instFunLike
universe u v
variable {J : Type v} [SmallCategory J] [IsCofiltered J] {F : J ⥤ Profinite.{max u v}} (C : Cone F)
theorem exists_isClopen_of_cofiltered {U : Set C.pt} (hC : IsLimit C) (hU : IsClopen U) :
∃ (j : J) (V : Set (F.obj j)), IsClopen V ∧ U = C.π.app j ⁻¹' V := by
-- First, we have the topological basis of the cofiltered limit obtained by pulling back
-- clopen sets from the factors in the limit. By continuity, all such sets are again clopen.
have hB := TopCat.isTopologicalBasis_cofiltered_limit.{u, v} (F ⋙ Profinite.toTopCat)
(Profinite.toTopCat.mapCone C) (isLimitOfPreserves _ hC) (fun j => {W | IsClopen W}) ?_
(fun i => isClopen_univ) (fun i U1 U2 hU1 hU2 => hU1.inter hU2) ?_
rotate_left
· intro i
change TopologicalSpace.IsTopologicalBasis {W : Set (F.obj i) | IsClopen W}
apply isTopologicalBasis_isClopen
· rintro i j f V (hV : IsClopen _)
exact ⟨hV.1.preimage ((F ⋙ toTopCat).map f).continuous,
hV.2.preimage ((F ⋙ toTopCat).map f).continuous⟩
-- Porting note: `<;> continuity` fails
-- Using this, since `U` is open, we can write `U` as a union of clopen sets all of which
-- are preimages of clopens from the factors in the limit.
obtain ⟨S, hS, h⟩ := hB.open_eq_sUnion hU.2
clear hB
let j : S → J := fun s => (hS s.2).choose
let V : ∀ s : S, Set (F.obj (j s)) := fun s => (hS s.2).choose_spec.choose
have hV : ∀ s : S, IsClopen (V s) ∧ s.1 = C.π.app (j s) ⁻¹' V s := fun s =>
(hS s.2).choose_spec.choose_spec
-- Since `U` is also closed, hence compact, it is covered by finitely many of the
-- clopens constructed in the previous step.
have hUo : ∀ (i : ↑S), IsOpen ((fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i) := by
intro s
exact (hV s).1.2.preimage (C.π.app (j s)).continuous
have hsU : U ⊆ ⋃ (i : ↑S), (fun s ↦ (forget Profinite).map (C.π.app (j s)) ⁻¹' V s) i := by
dsimp only
rw [h]
rintro x ⟨T, hT, hx⟩
refine ⟨_, ⟨⟨T, hT⟩, rfl⟩, ?_⟩
dsimp only [forget_map_eq_coe]
rwa [← (hV ⟨T, hT⟩).2]
have := hU.1.isCompact.elim_finite_subcover (fun s : S => C.π.app (j s) ⁻¹' V s) hUo hsU
-- Porting note: same remark as after `hB`
-- We thus obtain a finite set `G : Finset J` and a clopen set of `F.obj j` for each
-- `j ∈ G` such that `U` is the union of the preimages of these clopen sets.
obtain ⟨G, hG⟩ := this
-- Since `J` is cofiltered, we can find a single `j0` dominating all the `j ∈ G`.
-- Pulling back all of the sets from the previous step to `F.obj j0` and taking a union,
-- we obtain a clopen set in `F.obj j0` which works.
obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists (G.image j)
let f : ∀ s ∈ G, j0 ⟶ j s := fun s hs => (hj0 (Finset.mem_image.mpr ⟨s, hs, rfl⟩)).some
let W : S → Set (F.obj j0) := fun s => if hs : s ∈ G then F.map (f s hs) ⁻¹' V s else Set.univ
-- Conclude, using the `j0` and the clopen set of `F.obj j0` obtained above.
refine ⟨j0, ⋃ (s : S) (_ : s ∈ G), W s, ?_, ?_⟩
· apply isClopen_biUnion_finset
intro s hs
dsimp [W]
rw [dif_pos hs]
exact ⟨(hV s).1.1.preimage (F.map _).continuous, (hV s).1.2.preimage (F.map _).continuous⟩
· ext x
constructor
· intro hx
simp_rw [W, Set.preimage_iUnion, Set.mem_iUnion]
obtain ⟨_, ⟨s, rfl⟩, _, ⟨hs, rfl⟩, hh⟩ := hG hx
refine ⟨s, hs, ?_⟩
rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, ← Functor.map_comp, C.w]
· intro hx
simp_rw [W, Set.preimage_iUnion, Set.mem_iUnion] at hx
obtain ⟨s, hs, hx⟩ := hx
rw [h]
refine ⟨s.1, s.2, ?_⟩
rw [(hV s).2]
rwa [dif_pos hs, ← Set.preimage_comp, ← Profinite.coe_comp, ← Functor.map_comp, C.w] at hx
set_option linter.uppercaseLean3 false in
#align Profinite.exists_clopen_of_cofiltered Profinite.exists_isClopen_of_cofiltered
| Mathlib/Topology/Category/Profinite/CofilteredLimit.lean | 116 | 126 | theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by |
let U := f ⁻¹' {0}
have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
use j, LocallyConstant.ofIsClopen hV
apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
simp only [Fin.isValue, Functor.const_obj_obj, LocallyConstant.coe_comap, Set.preimage_comp,
LocallyConstant.ofIsClopen_fiber_zero]
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← h]
| [
" ∃ j V, IsClopen V ∧ U = ⇑(C.π.app j) ⁻¹' V",
" ∀ (i j : J) (f : i ⟶ j),\n ∀ V ∈ (fun j => {W | IsClopen W}) j, ⇑((F ⋙ toTopCat).map f) ⁻¹' V ∈ (fun j => {W | IsClopen W}) i",
" ∀ (j : J), TopologicalSpace.IsTopologicalBasis ((fun j => {W | IsClopen W}) j)",
" TopologicalSpace.IsTopologicalBasis ((fun j =... | [
" ∃ j V, IsClopen V ∧ U = ⇑(C.π.app j) ⁻¹' V",
" ∀ (i j : J) (f : i ⟶ j),\n ∀ V ∈ (fun j => {W | IsClopen W}) j, ⇑((F ⋙ toTopCat).map f) ⁻¹' V ∈ (fun j => {W | IsClopen W}) i",
" ∀ (j : J), TopologicalSpace.IsTopologicalBasis ((fun j => {W | IsClopen W}) j)",
" TopologicalSpace.IsTopologicalBasis ((fun j =... |
import Mathlib.Data.ZMod.Basic
import Mathlib.Algebra.Group.Nat
import Mathlib.Tactic.IntervalCases
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.GroupTheory.SpecificGroups.Cyclic
#align_import group_theory.specific_groups.quaternion from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
inductive QuaternionGroup (n : ℕ) : Type
| a : ZMod (2 * n) → QuaternionGroup n
| xa : ZMod (2 * n) → QuaternionGroup n
deriving DecidableEq
#align quaternion_group QuaternionGroup
namespace QuaternionGroup
variable {n : ℕ}
private def mul : QuaternionGroup n → QuaternionGroup n → QuaternionGroup n
| a i, a j => a (i + j)
| a i, xa j => xa (j - i)
| xa i, a j => xa (i + j)
| xa i, xa j => a (n + j - i)
private def one : QuaternionGroup n :=
a 0
instance : Inhabited (QuaternionGroup n) :=
⟨one⟩
private def inv : QuaternionGroup n → QuaternionGroup n
| a i => a (-i)
| xa i => xa (n + i)
instance : Group (QuaternionGroup n) where
mul := mul
mul_assoc := by
rintro (i | i) (j | j) (k | k) <;> simp only [(· * ·), mul] <;> ring_nf
congr
calc
-(n : ZMod (2 * n)) = 0 - n := by rw [zero_sub]
_ = 2 * n - n := by norm_cast; simp
_ = n := by ring
one := one
one_mul := by
rintro (i | i)
· exact congr_arg a (zero_add i)
· exact congr_arg xa (sub_zero i)
mul_one := by
rintro (i | i)
· exact congr_arg a (add_zero i)
· exact congr_arg xa (add_zero i)
inv := inv
mul_left_inv := by
rintro (i | i)
· exact congr_arg a (neg_add_self i)
· exact congr_arg a (sub_self (n + i))
@[simp]
theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) :=
rfl
#align quaternion_group.a_mul_a QuaternionGroup.a_mul_a
@[simp]
theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) :=
rfl
#align quaternion_group.a_mul_xa QuaternionGroup.a_mul_xa
@[simp]
theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) :=
rfl
#align quaternion_group.xa_mul_a QuaternionGroup.xa_mul_a
@[simp]
theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) :=
rfl
#align quaternion_group.xa_mul_xa QuaternionGroup.xa_mul_xa
theorem one_def : (1 : QuaternionGroup n) = a 0 :=
rfl
#align quaternion_group.one_def QuaternionGroup.one_def
private def fintypeHelper : Sum (ZMod (2 * n)) (ZMod (2 * n)) ≃ QuaternionGroup n where
invFun i :=
match i with
| a j => Sum.inl j
| xa j => Sum.inr j
toFun i :=
match i with
| Sum.inl j => a j
| Sum.inr j => xa j
left_inv := by rintro (x | x) <;> rfl
right_inv := by rintro (x | x) <;> rfl
def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 where
toFun i :=
-- Porting note: Originally `QuaternionGroup.recOn i DihedralGroup.r DihedralGroup.sr`
match i with
| a j => DihedralGroup.r j
| xa j => DihedralGroup.sr j
invFun i :=
match i with
| DihedralGroup.r j => a j
| DihedralGroup.sr j => xa j
left_inv := by rintro (k | k) <;> rfl
right_inv := by rintro (k | k) <;> rfl
map_mul' := by rintro (k | k) (l | l) <;> simp
#align quaternion_group.quaternion_group_zero_equiv_dihedral_group_zero QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero
instance [NeZero n] : Fintype (QuaternionGroup n) :=
Fintype.ofEquiv _ fintypeHelper
instance : Nontrivial (QuaternionGroup n) :=
⟨⟨a 0, xa 0, by revert n; simp⟩⟩ -- Porting note: `revert n; simp` was `decide`
theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n := by
rw [← Fintype.card_eq.mpr ⟨fintypeHelper⟩, Fintype.card_sum, ZMod.card, two_mul]
ring
#align quaternion_group.card QuaternionGroup.card
@[simp]
theorem a_one_pow (k : ℕ) : (a 1 : QuaternionGroup n) ^ k = a k := by
induction' k with k IH
· rw [Nat.cast_zero]; rfl
· rw [pow_succ, IH, a_mul_a]
congr 1
norm_cast
#align quaternion_group.a_one_pow QuaternionGroup.a_one_pow
-- @[simp] -- Porting note: simp changes this to `a 0 = 1`, so this is no longer a good simp lemma.
theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 := by
rw [a_one_pow, one_def]
congr 1
exact ZMod.natCast_self _
#align quaternion_group.a_one_pow_n QuaternionGroup.a_one_pow_n
@[simp]
theorem xa_sq (i : ZMod (2 * n)) : xa i ^ 2 = a n := by simp [sq]
#align quaternion_group.xa_sq QuaternionGroup.xa_sq
@[simp]
theorem xa_pow_four (i : ZMod (2 * n)) : xa i ^ 4 = 1 := by
rw [pow_succ, pow_succ, sq, xa_mul_xa, a_mul_xa, xa_mul_xa,
add_sub_cancel_right, add_sub_assoc, sub_sub_cancel]
norm_cast
rw [← two_mul]
simp [one_def]
#align quaternion_group.xa_pow_four QuaternionGroup.xa_pow_four
@[simp]
| Mathlib/GroupTheory/SpecificGroups/Quaternion.lean | 211 | 222 | theorem orderOf_xa [NeZero n] (i : ZMod (2 * n)) : orderOf (xa i) = 4 := by |
change _ = 2 ^ 2
haveI : Fact (Nat.Prime 2) := Fact.mk Nat.prime_two
apply orderOf_eq_prime_pow
· intro h
simp only [pow_one, xa_sq] at h
injection h with h'
apply_fun ZMod.val at h'
apply_fun (· / n) at h'
simp only [ZMod.val_natCast, ZMod.val_zero, Nat.zero_div, Nat.mod_mul_left_div_self,
Nat.div_self (NeZero.pos n)] at h'
· norm_num
| [
" ∀ (a b c : QuaternionGroup n), a * b * c = a * (b * c)",
" a i * a j * a k = a i * (a j * a k)",
" a i * a j * xa k = a i * (a j * xa k)",
" a i * xa j * a k = a i * (xa j * a k)",
" a i * xa j * xa k = a i * (xa j * xa k)",
" xa i * a j * a k = xa i * (a j * a k)",
" xa i * a j * xa k = xa i * (a j *... | [
" ∀ (a b c : QuaternionGroup n), a * b * c = a * (b * c)",
" a i * a j * a k = a i * (a j * a k)",
" a i * a j * xa k = a i * (a j * xa k)",
" a i * xa j * a k = a i * (xa j * a k)",
" a i * xa j * xa k = a i * (xa j * xa k)",
" xa i * a j * a k = xa i * (a j * a k)",
" xa i * a j * xa k = xa i * (a j *... |
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
noncomputable section
open scoped Classical
def Fermat42 (a b c : ℤ) : Prop :=
a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : ℤ} : Fermat42 a b c ↔ Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
theorem mul {a b c k : ℤ} (hk0 : k ≠ 0) :
Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c) := by
delta Fermat42
constructor
· intro f42
constructor
· exact mul_ne_zero hk0 f42.1
constructor
· exact mul_ne_zero hk0 f42.2.1
· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
· intro f42
constructor
· exact right_ne_zero_of_mul f42.1
constructor
· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
#align fermat_42.mul Fermat42.mul
theorem ne_zero {a b c : ℤ} (h : Fermat42 a b c) : c ≠ 0 := by
apply ne_zero_pow two_ne_zero _; apply ne_of_gt
rw [← h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)]
exact
add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1))
#align fermat_42.ne_zero Fermat42.ne_zero
def Minimal (a b c : ℤ) : Prop :=
Fermat42 a b c ∧ ∀ a1 b1 c1 : ℤ, Fermat42 a1 b1 c1 → Int.natAbs c ≤ Int.natAbs c1
#align fermat_42.minimal Fermat42.Minimal
theorem exists_minimal {a b c : ℤ} (h : Fermat42 a b c) : ∃ a0 b0 c0, Minimal a0 b0 c0 := by
let S : Set ℕ := { n | ∃ s : ℤ × ℤ × ℤ, Fermat42 s.1 s.2.1 s.2.2 ∧ n = Int.natAbs s.2.2 }
have S_nonempty : S.Nonempty := by
use Int.natAbs c
rw [Set.mem_setOf_eq]
use ⟨a, ⟨b, c⟩⟩
let m : ℕ := Nat.find S_nonempty
have m_mem : m ∈ S := Nat.find_spec S_nonempty
rcases m_mem with ⟨s0, hs0, hs1⟩
use s0.1, s0.2.1, s0.2.2, hs0
intro a1 b1 c1 h1
rw [← hs1]
apply Nat.find_min'
use ⟨a1, ⟨b1, c1⟩⟩
#align fermat_42.exists_minimal Fermat42.exists_minimal
| Mathlib/NumberTheory/FLT/Four.lean | 89 | 105 | theorem coprime_of_minimal {a b c : ℤ} (h : Minimal a b c) : IsCoprime a b := by |
apply Int.gcd_eq_one_iff_coprime.mp
by_contra hab
obtain ⟨p, hp, hpa, hpb⟩ := Nat.Prime.not_coprime_iff_dvd.mp hab
obtain ⟨a1, rfl⟩ := Int.natCast_dvd.mpr hpa
obtain ⟨b1, rfl⟩ := Int.natCast_dvd.mpr hpb
have hpc : (p : ℤ) ^ 2 ∣ c := by
rw [← Int.pow_dvd_pow_iff two_ne_zero, ← h.1.2.2]
apply Dvd.intro (a1 ^ 4 + b1 ^ 4)
ring
obtain ⟨c1, rfl⟩ := hpc
have hf : Fermat42 a1 b1 c1 :=
(Fermat42.mul (Int.natCast_ne_zero.mpr (Nat.Prime.ne_zero hp))).mpr h.1
apply Nat.le_lt_asymm (h.2 _ _ _ hf)
rw [Int.natAbs_mul, lt_mul_iff_one_lt_left, Int.natAbs_pow, Int.natAbs_ofNat]
· exact Nat.one_lt_pow two_ne_zero (Nat.Prime.one_lt hp)
· exact Nat.pos_of_ne_zero (Int.natAbs_ne_zero.2 (ne_zero hf))
| [
" Fermat42 a b c ↔ Fermat42 b a c",
" a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2 ↔ b ≠ 0 ∧ a ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2",
" a ≠ 0 ∧ b ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2 ↔ b ≠ 0 ∧ a ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2",
" Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c)",
" a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2 ↔ k * a ≠ ... | [
" Fermat42 a b c ↔ Fermat42 b a c",
" a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2 ↔ b ≠ 0 ∧ a ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2",
" a ≠ 0 ∧ b ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2 ↔ b ≠ 0 ∧ a ≠ 0 ∧ b ^ 4 + a ^ 4 = c ^ 2",
" Fermat42 a b c ↔ Fermat42 (k * a) (k * b) (k ^ 2 * c)",
" a ≠ 0 ∧ b ≠ 0 ∧ a ^ 4 + b ^ 4 = c ^ 2 ↔ k * a ≠ ... |
import Mathlib.LinearAlgebra.Ray
import Mathlib.LinearAlgebra.Determinant
#align_import linear_algebra.orientation from "leanprover-community/mathlib"@"0c1d80f5a86b36c1db32e021e8d19ae7809d5b79"
noncomputable section
section OrderedCommSemiring
variable (R : Type*) [StrictOrderedCommSemiring R]
variable (M : Type*) [AddCommMonoid M] [Module R M]
variable {N : Type*} [AddCommMonoid N] [Module R N]
variable (ι ι' : Type*)
abbrev Orientation := Module.Ray R (M [⋀^ι]→ₗ[R] R)
#align orientation Orientation
class Module.Oriented where
positiveOrientation : Orientation R M ι
#align module.oriented Module.Oriented
export Module.Oriented (positiveOrientation)
variable {R M}
def Orientation.map (e : M ≃ₗ[R] N) : Orientation R M ι ≃ Orientation R N ι :=
Module.Ray.map <| AlternatingMap.domLCongr R R ι R e
#align orientation.map Orientation.map
@[simp]
theorem Orientation.map_apply (e : M ≃ₗ[R] N) (v : M [⋀^ι]→ₗ[R] R) (hv : v ≠ 0) :
Orientation.map ι e (rayOfNeZero _ v hv) =
rayOfNeZero _ (v.compLinearMap e.symm) (mt (v.compLinearEquiv_eq_zero_iff e.symm).mp hv) :=
rfl
#align orientation.map_apply Orientation.map_apply
@[simp]
| Mathlib/LinearAlgebra/Orientation.lean | 74 | 75 | theorem Orientation.map_refl : (Orientation.map ι <| LinearEquiv.refl R M) = Equiv.refl _ := by |
rw [Orientation.map, AlternatingMap.domLCongr_refl, Module.Ray.map_refl]
| [
" map ι (LinearEquiv.refl R M) = Equiv.refl (Orientation R M ι)"
] | [] |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
⟨⟨default, default, default, default⟩⟩
instance [Zero R] : Zero (Cubic R) :=
⟨⟨0, 0, 0, 0⟩⟩
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by
rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (∀ n > 3, P.toPoly.coeff n = 0) ∧ P.toPoly.coeff 3 = P.a ∧
P.toPoly.coeff 2 = P.b ∧ P.toPoly.coeff 1 = P.c ∧ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : ℕ} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [← coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [← coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [← coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 130 | 130 | theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by | rw [← coeff_eq_d, h, coeff_eq_d]
| [
" C w * (X - C x) * (X - C y) * (X - C z) =\n { a := w, b := w * -(x + y + z), c := w * (x * y + x * z + y * z), d := w * -(x * y * z) }.toPoly",
" C w * (X - C x) * (X - C y) * (X - C z) =\n C w * X ^ 3 + C w * -(C x + C y + C z) * X ^ 2 + C w * (C x * C y + C x * C z + C y * C z) * X +\n C w * -(C x ... | [
" C w * (X - C x) * (X - C y) * (X - C z) =\n { a := w, b := w * -(x + y + z), c := w * (x * y + x * z + y * z), d := w * -(x * y * z) }.toPoly",
" C w * (X - C x) * (X - C y) * (X - C z) =\n C w * X ^ 3 + C w * -(C x + C y + C z) * X ^ 2 + C w * (C x * C y + C x * C z + C y * C z) * X +\n C w * -(C x ... |
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
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]
#align aeval_witt_polynomial aeval_wittPolynomial
@[simp]
theorem wittPolynomial_zmod_self (n : ℕ) :
W_ (ZMod (p ^ (n + 1))) (n + 1) = expand p (W_ (ZMod (p ^ (n + 1))) n) := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow]
rw [sum_range_succ, ← Nat.cast_pow, CharP.cast_eq_zero (ZMod (p ^ (n + 1))) (p ^ (n + 1)), C_0,
zero_mul, add_zero, AlgHom.map_sum, sum_congr rfl]
intro k hk
rw [AlgHom.map_mul, AlgHom.map_pow, expand_X, algHom_C, ← pow_mul, ← pow_succ']
congr
rw [mem_range] at hk
rw [add_comm, add_tsub_assoc_of_le (Nat.lt_succ_iff.mp hk), ← add_comm]
#align witt_polynomial_zmod_self wittPolynomial_zmod_self
end
noncomputable def xInTermsOfW [Invertible (p : R)] : ℕ → MvPolynomial ℕ R
| n => (X n - ∑ i : Fin n,
C ((p : R) ^ (i : ℕ)) * xInTermsOfW i ^ p ^ (n - (i : ℕ))) * C ((⅟ p : R) ^ n)
set_option linter.uppercaseLean3 false in
#align X_in_terms_of_W xInTermsOfW
theorem xInTermsOfW_eq [Invertible (p : R)] {n : ℕ} : xInTermsOfW p R n =
(X n - ∑ i ∈ range n, C ((p: R) ^ i) * xInTermsOfW p R i ^ p ^ (n - i)) * C ((⅟p : R) ^ n) := by
rw [xInTermsOfW, ← Fin.sum_univ_eq_sum_range]
set_option linter.uppercaseLean3 false in
#align X_in_terms_of_W_eq xInTermsOfW_eq
@[simp]
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 218 | 234 | theorem constantCoeff_xInTermsOfW [hp : Fact p.Prime] [Invertible (p : R)] (n : ℕ) :
constantCoeff (xInTermsOfW p R n) = 0 := by |
apply Nat.strongInductionOn n; clear n
intro n IH
rw [xInTermsOfW_eq, mul_comm, RingHom.map_mul, RingHom.map_sub, map_sum, constantCoeff_C,
constantCoeff_X, zero_sub, mul_neg, neg_eq_zero]
-- Porting note: here, we should be able to do `rw [sum_eq_zero]`, but the goal that
-- is created is not what we expect, and the sum is not replaced by zero...
-- is it a bug in `rw` tactic?
refine Eq.trans (?_ : _ = ((⅟↑p : R) ^ n)* 0) (mul_zero _)
congr 1
rw [sum_eq_zero]
intro m H
rw [mem_range] at H
simp only [RingHom.map_mul, RingHom.map_pow, map_natCast, IH m H]
rw [zero_pow, mul_zero]
exact pow_ne_zero _ hp.1.ne_zero
| [
" 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.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by simp [toList]
set_option linter.deprecated false in
@[deprecated get_toList (since := "2024-05-08")]
theorem nthLe_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).nthLe n hn = (p ^ n) x := by simp [toList]
#align equiv.perm.nth_le_to_list Equiv.Perm.nthLe_toList
set_option linter.deprecated false in
@[deprecated toList_get_zero (since := "2024-05-08")]
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 259 | 260 | theorem toList_nthLe_zero (h : x ∈ p.support) :
(toList p x).nthLe 0 (length_toList_pos_of_mem_support _ _ h) = x := by | simp [toList]
| [
" toList 1 x = []",
" p.toList x = [] ↔ x ∉ p.support",
" (p.toList x).length = (p.cycleOf x).support.card",
" p.toList x ≠ [y]",
" False",
" 2 ≤ (p.toList x).length ↔ x ∈ p.support",
" (p.toList x).get ⟨n, hn⟩ = (p ^ n) x",
" (p.toList x).get ⟨0, ⋯⟩ = x",
" (p.toList x).nthLe n hn = (p ^ n) x",
"... | [
" toList 1 x = []",
" p.toList x = [] ↔ x ∉ p.support",
" (p.toList x).length = (p.cycleOf x).support.card",
" p.toList x ≠ [y]",
" False",
" 2 ≤ (p.toList x).length ↔ x ∈ p.support",
" (p.toList x).get ⟨n, hn⟩ = (p ^ n) x",
" (p.toList x).get ⟨0, ⋯⟩ = x",
" (p.toList x).nthLe n hn = (p ^ n) x"
] |
import Mathlib.MeasureTheory.PiSystem
import Mathlib.Order.OmegaCompletePartialOrder
import Mathlib.Topology.Constructions
import Mathlib.MeasureTheory.MeasurableSpace.Basic
open Set
namespace MeasureTheory
variable {ι : Type _} {α : ι → Type _}
section cylinder
def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) :=
(fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S
@[simp]
theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) :
f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S :=
mem_preimage
@[simp]
theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by
rw [cylinder, preimage_empty]
@[simp]
theorem cylinder_univ (s : Finset ι) : cylinder s (univ : Set (∀ i : s, α i)) = univ := by
rw [cylinder, preimage_univ]
@[simp]
theorem cylinder_eq_empty_iff [h_nonempty : Nonempty (∀ i, α i)] (s : Finset ι)
(S : Set (∀ i : s, α i)) :
cylinder s S = ∅ ↔ S = ∅ := by
refine ⟨fun h ↦ ?_, fun h ↦ by (rw [h]; exact cylinder_empty _)⟩
by_contra hS
rw [← Ne, ← nonempty_iff_ne_empty] at hS
let f := hS.some
have hf : f ∈ S := hS.choose_spec
classical
let f' : ∀ i, α i := fun i ↦ if hi : i ∈ s then f ⟨i, hi⟩ else h_nonempty.some i
have hf' : f' ∈ cylinder s S := by
rw [mem_cylinder]
simpa only [f', Finset.coe_mem, dif_pos]
rw [h] at hf'
exact not_mem_empty _ hf'
theorem inter_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∩ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∩
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_inter_iff, mem_cylinder, mem_setOf_eq]; rfl
theorem inter_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∩ cylinder s S₂ = cylinder s (S₁ ∩ S₂) := by
classical rw [inter_cylinder]; rfl
theorem union_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∪ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∪
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_union, mem_cylinder, mem_setOf_eq]; rfl
theorem union_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∪ cylinder s S₂ = cylinder s (S₁ ∪ S₂) := by
classical rw [union_cylinder]; rfl
theorem compl_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) :
(cylinder s S)ᶜ = cylinder s (Sᶜ) := by
ext1 f; simp only [mem_compl_iff, mem_cylinder]
theorem diff_cylinder_same (s : Finset ι) (S T : Set (∀ i : s, α i)) :
cylinder s S \ cylinder s T = cylinder s (S \ T) := by
ext1 f; simp only [mem_diff, mem_cylinder]
theorem eq_of_cylinder_eq_of_subset [h_nonempty : Nonempty (∀ i, α i)] {I J : Finset ι}
{S : Set (∀ i : I, α i)} {T : Set (∀ i : J, α i)} (h_eq : cylinder I S = cylinder J T)
(hJI : J ⊆ I) :
S = (fun f : ∀ i : I, α i ↦ fun j : J ↦ f ⟨j, hJI j.prop⟩) ⁻¹' T := by
rw [Set.ext_iff] at h_eq
simp only [mem_cylinder] at h_eq
ext1 f
simp only [mem_preimage]
classical
specialize h_eq fun i ↦ if hi : i ∈ I then f ⟨i, hi⟩ else h_nonempty.some i
have h_mem : ∀ j : J, ↑j ∈ I := fun j ↦ hJI j.prop
simp only [Finset.coe_mem, dite_true, h_mem] at h_eq
exact h_eq
theorem cylinder_eq_cylinder_union [DecidableEq ι] (I : Finset ι) (S : Set (∀ i : I, α i))
(J : Finset ι) :
cylinder I S =
cylinder (I ∪ J) ((fun f ↦ fun j : I ↦ f ⟨j, Finset.mem_union_left J j.prop⟩) ⁻¹' S) := by
ext1 f; simp only [mem_cylinder, mem_preimage]
| Mathlib/MeasureTheory/Constructions/Cylinders.lean | 237 | 244 | theorem disjoint_cylinder_iff [Nonempty (∀ i, α i)] {s t : Finset ι} {S : Set (∀ i : s, α i)}
{T : Set (∀ i : t, α i)} [DecidableEq ι] :
Disjoint (cylinder s S) (cylinder t T) ↔
Disjoint
((fun f : ∀ i : (s ∪ t : Finset ι), α i
↦ fun j : s ↦ f ⟨j, Finset.mem_union_left t j.prop⟩) ⁻¹' S)
((fun f ↦ fun j : t ↦ f ⟨j, Finset.mem_union_right s j.prop⟩) ⁻¹' T) := by |
simp_rw [Set.disjoint_iff, subset_empty_iff, inter_cylinder, cylinder_eq_empty_iff]
| [
" cylinder s ∅ = ∅",
" cylinder s univ = univ",
" cylinder s S = ∅ ↔ S = ∅",
" cylinder s S = ∅",
" S = ∅",
" False",
" f' ∈ cylinder s S",
" (fun i => f' ↑i) ∈ S",
" cylinder s₁ S₁ ∩ cylinder s₂ S₂ = cylinder (s₁ ∪ s₂) ((fun f j => f ⟨↑j, ⋯⟩) ⁻¹' S₁ ∩ (fun f j => f ⟨↑j, ⋯⟩) ⁻¹' S₂)",
" f ∈ cylind... | [
" cylinder s ∅ = ∅",
" cylinder s univ = univ",
" cylinder s S = ∅ ↔ S = ∅",
" cylinder s S = ∅",
" S = ∅",
" False",
" f' ∈ cylinder s S",
" (fun i => f' ↑i) ∈ S",
" cylinder s₁ S₁ ∩ cylinder s₂ S₂ = cylinder (s₁ ∪ s₂) ((fun f j => f ⟨↑j, ⋯⟩) ⁻¹' S₁ ∩ (fun f j => f ⟨↑j, ⋯⟩) ⁻¹' S₂)",
" f ∈ cylind... |
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) :=
Pi.seminormedAddCommGroup
#align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup
attribute [local instance] Matrix.seminormedAddCommGroup
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl
lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) :
‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by
simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def]
-- Porting note (#10756): new theorem (along with all the uses of this lemma below)
theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl
theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by
simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr]
#align matrix.norm_le_iff Matrix.norm_le_iff
theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
#align matrix.nnnorm_le_iff Matrix.nnnorm_le_iff
theorem norm_lt_iff {r : ℝ} (hr : 0 < r) {A : Matrix m n α} : ‖A‖ < r ↔ ∀ i j, ‖A i j‖ < r := by
simp_rw [norm_def, pi_norm_lt_iff hr]
#align matrix.norm_lt_iff Matrix.norm_lt_iff
theorem nnnorm_lt_iff {r : ℝ≥0} (hr : 0 < r) {A : Matrix m n α} :
‖A‖₊ < r ↔ ∀ i j, ‖A i j‖₊ < r := by
simp_rw [nnnorm_def, pi_nnnorm_lt_iff hr]
#align matrix.nnnorm_lt_iff Matrix.nnnorm_lt_iff
theorem norm_entry_le_entrywise_sup_norm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖ ≤ ‖A‖ :=
(norm_le_pi_norm (A i) j).trans (norm_le_pi_norm A i)
#align matrix.norm_entry_le_entrywise_sup_norm Matrix.norm_entry_le_entrywise_sup_norm
theorem nnnorm_entry_le_entrywise_sup_nnnorm (A : Matrix m n α) {i : m} {j : n} : ‖A i j‖₊ ≤ ‖A‖₊ :=
(nnnorm_le_pi_nnnorm (A i) j).trans (nnnorm_le_pi_nnnorm A i)
#align matrix.nnnorm_entry_le_entrywise_sup_nnnorm Matrix.nnnorm_entry_le_entrywise_sup_nnnorm
@[simp]
theorem nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by
simp only [nnnorm_def, Pi.nnnorm_def, Matrix.map_apply, hf]
#align matrix.nnnorm_map_eq Matrix.nnnorm_map_eq
@[simp]
theorem norm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖ = ‖a‖) : ‖A.map f‖ = ‖A‖ :=
(congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_map_eq A f fun a => Subtype.ext <| hf a : _)
#align matrix.norm_map_eq Matrix.norm_map_eq
@[simp]
theorem nnnorm_transpose (A : Matrix m n α) : ‖Aᵀ‖₊ = ‖A‖₊ :=
Finset.sup_comm _ _ _
#align matrix.nnnorm_transpose Matrix.nnnorm_transpose
@[simp]
theorem norm_transpose (A : Matrix m n α) : ‖Aᵀ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_transpose A
#align matrix.norm_transpose Matrix.norm_transpose
@[simp]
theorem nnnorm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) :
‖Aᴴ‖₊ = ‖A‖₊ :=
(nnnorm_map_eq _ _ nnnorm_star).trans A.nnnorm_transpose
#align matrix.nnnorm_conj_transpose Matrix.nnnorm_conjTranspose
@[simp]
theorem norm_conjTranspose [StarAddMonoid α] [NormedStarGroup α] (A : Matrix m n α) : ‖Aᴴ‖ = ‖A‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_conjTranspose A
#align matrix.norm_conj_transpose Matrix.norm_conjTranspose
instance [StarAddMonoid α] [NormedStarGroup α] : NormedStarGroup (Matrix m m α) :=
⟨norm_conjTranspose⟩
@[simp]
theorem nnnorm_col (v : m → α) : ‖col v‖₊ = ‖v‖₊ := by
simp [nnnorm_def, Pi.nnnorm_def]
#align matrix.nnnorm_col Matrix.nnnorm_col
@[simp]
theorem norm_col (v : m → α) : ‖col v‖ = ‖v‖ :=
congr_arg ((↑) : ℝ≥0 → ℝ) <| nnnorm_col v
#align matrix.norm_col Matrix.norm_col
@[simp]
| Mathlib/Analysis/Matrix.lean | 161 | 162 | theorem nnnorm_row (v : n → α) : ‖row v‖₊ = ‖v‖₊ := by |
simp [nnnorm_def, Pi.nnnorm_def]
| [
" ‖A‖ = ↑(Finset.univ.sup fun i => Finset.univ.sup fun j => ‖A i j‖₊)",
" ‖A‖ ≤ r ↔ ∀ (i : m) (j : n), ‖A i j‖ ≤ r",
" ‖A‖₊ ≤ r ↔ ∀ (i : m) (j : n), ‖A i j‖₊ ≤ r",
" ‖A‖ < r ↔ ∀ (i : m) (j : n), ‖A i j‖ < r",
" ‖A‖₊ < r ↔ ∀ (i : m) (j : n), ‖A i j‖₊ < r",
" ‖A.map f‖₊ = ‖A‖₊",
" ‖col v‖₊ = ‖v‖₊",
" ‖r... | [
" ‖A‖ = ↑(Finset.univ.sup fun i => Finset.univ.sup fun j => ‖A i j‖₊)",
" ‖A‖ ≤ r ↔ ∀ (i : m) (j : n), ‖A i j‖ ≤ r",
" ‖A‖₊ ≤ r ↔ ∀ (i : m) (j : n), ‖A i j‖₊ ≤ r",
" ‖A‖ < r ↔ ∀ (i : m) (j : n), ‖A i j‖ < r",
" ‖A‖₊ < r ↔ ∀ (i : m) (j : n), ‖A i j‖₊ < r",
" ‖A.map f‖₊ = ‖A‖₊",
" ‖col v‖₊ = ‖v‖₊"
] |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.LinearAlgebra.Matrix.Block
#align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0"
open Finset Submodule FiniteDimensional
variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)]
attribute [local instance] IsWellOrder.toHasWellFounded
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E :=
f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n)
termination_by n
decreasing_by exact mem_Iio.1 i.2
#align gram_schmidt gramSchmidt
theorem gramSchmidt_def (f : ι → E) (n : ι) :
gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by
rw [← sum_attach, attach_eq_univ, gramSchmidt]
#align gram_schmidt_def gramSchmidt_def
theorem gramSchmidt_def' (f : ι → E) (n : ι) :
f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by
rw [gramSchmidt_def, sub_add_cancel]
#align gram_schmidt_def' gramSchmidt_def'
theorem gramSchmidt_def'' (f : ι → E) (n : ι) :
f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n,
(⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by
convert gramSchmidt_def' 𝕜 f n
rw [orthogonalProjection_singleton, RCLike.ofReal_pow]
#align gram_schmidt_def'' gramSchmidt_def''
@[simp]
theorem gramSchmidt_zero {ι : Type*} [LinearOrder ι] [LocallyFiniteOrder ι] [OrderBot ι]
[IsWellOrder ι (· < ·)] (f : ι → E) : gramSchmidt 𝕜 f ⊥ = f ⊥ := by
rw [gramSchmidt_def, Iio_eq_Ico, Finset.Ico_self, Finset.sum_empty, sub_zero]
#align gram_schmidt_zero gramSchmidt_zero
theorem gramSchmidt_orthogonal (f : ι → E) {a b : ι} (h₀ : a ≠ b) :
⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := by
suffices ∀ a b : ι, a < b → ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 by
cases' h₀.lt_or_lt with ha hb
· exact this _ _ ha
· rw [inner_eq_zero_symm]
exact this _ _ hb
clear h₀ a b
intro a b h₀
revert a
apply wellFounded_lt.induction b
intro b ih a h₀
simp only [gramSchmidt_def 𝕜 f b, inner_sub_right, inner_sum, orthogonalProjection_singleton,
inner_smul_right]
rw [Finset.sum_eq_single_of_mem a (Finset.mem_Iio.mpr h₀)]
· by_cases h : gramSchmidt 𝕜 f a = 0
· simp only [h, inner_zero_left, zero_div, zero_mul, sub_zero]
· rw [RCLike.ofReal_pow, ← inner_self_eq_norm_sq_to_K, div_mul_cancel₀, sub_self]
rwa [inner_self_ne_zero]
intro i hi hia
simp only [mul_eq_zero, div_eq_zero_iff, inner_self_eq_zero]
right
cases' hia.lt_or_lt with hia₁ hia₂
· rw [inner_eq_zero_symm]
exact ih a h₀ i hia₁
· exact ih i (mem_Iio.1 hi) a hia₂
#align gram_schmidt_orthogonal gramSchmidt_orthogonal
theorem gramSchmidt_pairwise_orthogonal (f : ι → E) :
Pairwise fun a b => ⟪gramSchmidt 𝕜 f a, gramSchmidt 𝕜 f b⟫ = 0 := fun _ _ =>
gramSchmidt_orthogonal 𝕜 f
#align gram_schmidt_pairwise_orthogonal gramSchmidt_pairwise_orthogonal
theorem gramSchmidt_inv_triangular (v : ι → E) {i j : ι} (hij : i < j) :
⟪gramSchmidt 𝕜 v j, v i⟫ = 0 := by
rw [gramSchmidt_def'' 𝕜 v]
simp only [inner_add_right, inner_sum, inner_smul_right]
set b : ι → E := gramSchmidt 𝕜 v
convert zero_add (0 : 𝕜)
· exact gramSchmidt_orthogonal 𝕜 v hij.ne'
apply Finset.sum_eq_zero
rintro k hki'
have hki : k < i := by simpa using hki'
have : ⟪b j, b k⟫ = 0 := gramSchmidt_orthogonal 𝕜 v (hki.trans hij).ne'
simp [this]
#align gram_schmidt_inv_triangular gramSchmidt_inv_triangular
open Submodule Set Order
| Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean | 133 | 139 | theorem mem_span_gramSchmidt (f : ι → E) {i j : ι} (hij : i ≤ j) :
f i ∈ span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j) := by |
rw [gramSchmidt_def' 𝕜 f i]
simp_rw [orthogonalProjection_singleton]
exact Submodule.add_mem _ (subset_span <| mem_image_of_mem _ hij)
(Submodule.sum_mem _ fun k hk => smul_mem (span 𝕜 (gramSchmidt 𝕜 f '' Set.Iic j)) _ <|
subset_span <| mem_image_of_mem (gramSchmidt 𝕜 f) <| (Finset.mem_Iio.1 hk).le.trans hij)
| [
" (invImage (fun x => x) IsWellOrder.toHasWellFounded).1 (↑i) n",
" gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, ↑((orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i})) (f n))",
" f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, ↑((orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i})) (f n))",
" f n = gramSchmidt 𝕜 f n + ∑... | [
" (invImage (fun x => x) IsWellOrder.toHasWellFounded).1 (↑i) n",
" gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, ↑((orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i})) (f n))",
" f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, ↑((orthogonalProjection (span 𝕜 {gramSchmidt 𝕜 f i})) (f n))",
" f n = gramSchmidt 𝕜 f n + ∑... |
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Rat.Encodable
import Mathlib.Topology.GDelta
#align_import topology.instances.irrational from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Filter Metric
open Filter Topology
protected theorem IsGδ.setOf_irrational : IsGδ { x | Irrational x } :=
(countable_range _).isGδ_compl
set_option linter.uppercaseLean3 false in
#align is_Gδ_irrational IsGδ.setOf_irrational
@[deprecated (since := "2024-02-15")] alias isGδ_irrational := IsGδ.setOf_irrational
| Mathlib/Topology/Instances/Irrational.lean | 45 | 51 | theorem dense_irrational : Dense { x : ℝ | Irrational x } := by |
refine Real.isTopologicalBasis_Ioo_rat.dense_iff.2 ?_
simp only [gt_iff_lt, Rat.cast_lt, not_lt, ge_iff_le, Rat.cast_le, mem_iUnion, mem_singleton_iff,
exists_prop, forall_exists_index, and_imp]
rintro _ a b hlt rfl _
rw [inter_comm]
exact exists_irrational_btwn (Rat.cast_lt.2 hlt)
| [
" Dense {x | Irrational x}",
" ∀ o ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}, o.Nonempty → (o ∩ {x | Irrational x}).Nonempty",
" ∀ (o : Set ℝ) (x x_1 : ℚ), x < x_1 → o = Ioo ↑x ↑x_1 → o.Nonempty → (o ∩ {x | Irrational x}).Nonempty",
" (Ioo ↑a ↑b ∩ {x | Irrational x}).Nonempty",
" ({x | Irrational x} ∩ Ioo ↑a ↑... | [] |
import Mathlib.Data.Multiset.Basic
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
open List Nat
namespace Multiset
-- range
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
| Mathlib/Data/Multiset/Range.lean | 34 | 35 | theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by |
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
| [
" range n.succ = n ::ₘ range n",
" ↑[n] + ↑(List.range n) = n ::ₘ range n"
] | [] |
import Mathlib.Analysis.Convex.Function
import Mathlib.Analysis.Convex.StrictConvexSpace
import Mathlib.MeasureTheory.Function.AEEqOfIntegral
import Mathlib.MeasureTheory.Integral.Average
#align_import analysis.convex.integral from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ : Measure α}
{s : Set E} {t : Set α} {f : α → E} {g : E → ℝ} {C : ℝ}
theorem Convex.integral_mem [IsProbabilityMeasure μ] (hs : Convex ℝ s) (hsc : IsClosed s)
(hf : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (∫ x, f x ∂μ) ∈ s := by
borelize E
rcases hfi.aestronglyMeasurable with ⟨g, hgm, hfg⟩
haveI : SeparableSpace (range g ∩ s : Set E) :=
(hgm.isSeparable_range.mono inter_subset_left).separableSpace
obtain ⟨y₀, h₀⟩ : (range g ∩ s).Nonempty := by
rcases (hf.and hfg).exists with ⟨x₀, h₀⟩
exact ⟨f x₀, by simp only [h₀.2, mem_range_self], h₀.1⟩
rw [integral_congr_ae hfg]; rw [integrable_congr hfg] at hfi
have hg : ∀ᵐ x ∂μ, g x ∈ closure (range g ∩ s) := by
filter_upwards [hfg.rw (fun _ y => y ∈ s) hf] with x hx
apply subset_closure
exact ⟨mem_range_self _, hx⟩
set G : ℕ → SimpleFunc α E := SimpleFunc.approxOn _ hgm.measurable (range g ∩ s) y₀ h₀
have : Tendsto (fun n => (G n).integral μ) atTop (𝓝 <| ∫ x, g x ∂μ) :=
tendsto_integral_approxOn_of_measurable hfi _ hg _ (integrable_const _)
refine hsc.mem_of_tendsto this (eventually_of_forall fun n => hs.sum_mem ?_ ?_ ?_)
· exact fun _ _ => ENNReal.toReal_nonneg
· rw [← ENNReal.toReal_sum, (G n).sum_range_measure_preimage_singleton, measure_univ,
ENNReal.one_toReal]
exact fun _ _ => measure_ne_top _ _
· simp only [SimpleFunc.mem_range, forall_mem_range]
intro x
apply (range g).inter_subset_right
exact SimpleFunc.approxOn_mem hgm.measurable h₀ _ _
#align convex.integral_mem Convex.integral_mem
theorem Convex.average_mem [IsFiniteMeasure μ] [NeZero μ] (hs : Convex ℝ s) (hsc : IsClosed s)
(hfs : ∀ᵐ x ∂μ, f x ∈ s) (hfi : Integrable f μ) : (⨍ x, f x ∂μ) ∈ s := by
refine hs.integral_mem hsc (ae_mono' ?_ hfs) hfi.to_average
exact AbsolutelyContinuous.smul (refl _) _
#align convex.average_mem Convex.average_mem
theorem Convex.set_average_mem (hs : Convex ℝ s) (hsc : IsClosed s) (h0 : μ t ≠ 0) (ht : μ t ≠ ∞)
(hfs : ∀ᵐ x ∂μ.restrict t, f x ∈ s) (hfi : IntegrableOn f t μ) : (⨍ x in t, f x ∂μ) ∈ s :=
have := Fact.mk ht.lt_top
have := NeZero.mk h0
hs.average_mem hsc hfs hfi
#align convex.set_average_mem Convex.set_average_mem
theorem Convex.set_average_mem_closure (hs : Convex ℝ s) (h0 : μ t ≠ 0) (ht : μ t ≠ ∞)
(hfs : ∀ᵐ x ∂μ.restrict t, f x ∈ s) (hfi : IntegrableOn f t μ) :
(⨍ x in t, f x ∂μ) ∈ closure s :=
hs.closure.set_average_mem isClosed_closure h0 ht (hfs.mono fun _ hx => subset_closure hx) hfi
#align convex.set_average_mem_closure Convex.set_average_mem_closure
| Mathlib/Analysis/Convex/Integral.lean | 112 | 119 | theorem ConvexOn.average_mem_epigraph [IsFiniteMeasure μ] [NeZero μ] (hg : ConvexOn ℝ s g)
(hgc : ContinuousOn g s) (hsc : IsClosed s) (hfs : ∀ᵐ x ∂μ, f x ∈ s)
(hfi : Integrable f μ) (hgi : Integrable (g ∘ f) μ) :
(⨍ x, f x ∂μ, ⨍ x, g (f x) ∂μ) ∈ {p : E × ℝ | p.1 ∈ s ∧ g p.1 ≤ p.2} := by |
have ht_mem : ∀ᵐ x ∂μ, (f x, g (f x)) ∈ {p : E × ℝ | p.1 ∈ s ∧ g p.1 ≤ p.2} :=
hfs.mono fun x hx => ⟨hx, le_rfl⟩
exact average_pair hfi hgi ▸
hg.convex_epigraph.average_mem (hsc.epigraph hgc) ht_mem (hfi.prod_mk hgi)
| [
" ∫ (x : α), f x ∂μ ∈ s",
" (range g ∩ s).Nonempty",
" f x₀ ∈ range g",
" ∫ (a : α), g a ∂μ ∈ s",
" ∀ᵐ (x : α) ∂μ, g x ∈ closure (range g ∩ s)",
" g x ∈ closure (range g ∩ s)",
" g x ∈ range g ∩ s",
" ∀ i ∈ (G n).range, 0 ≤ (μ (↑(G n) ⁻¹' {i})).toReal",
" ∑ i ∈ (G n).range, (μ (↑(G n) ⁻¹' {i})).toRe... | [
" ∫ (x : α), f x ∂μ ∈ s",
" (range g ∩ s).Nonempty",
" f x₀ ∈ range g",
" ∫ (a : α), g a ∂μ ∈ s",
" ∀ᵐ (x : α) ∂μ, g x ∈ closure (range g ∩ s)",
" g x ∈ closure (range g ∩ s)",
" g x ∈ range g ∩ s",
" ∀ i ∈ (G n).range, 0 ≤ (μ (↑(G n) ⁻¹' {i})).toReal",
" ∑ i ∈ (G n).range, (μ (↑(G n) ⁻¹' {i})).toRe... |
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set
open Pointwise Topology
variable {𝕜 E : Type*}
variable [NormedField 𝕜]
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
| Mathlib/Analysis/NormedSpace/Pointwise.lean | 84 | 88 | theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by |
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
conv_lhs => rw [← inv_smul_smul₀ hc x]
simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀]
| [
" c • ball x r = ball (c • x) (‖c‖ * r)",
" y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
" c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
"𝕜 : Type u_1\nE : Type u_2\ninst✝² : NormedField 𝕜\ninst✝¹ : SeminormedAddCommGroup E\ninst✝ : NormedSpace 𝕜 E\nc : 𝕜\nhc : c ≠ 0\nx : E\nr : ℝ\ny : E\n| c⁻¹ • y... | [] |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right
@[simp]
theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 53 | 54 | theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by |
rw [gcd_comm, gcd_add_mul_right_right, gcd_comm]
| [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n",
" (m + k * n).gcd n = m.gcd n"
] | [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n"
] |
import Batteries.Data.List.Lemmas
namespace List
universe u v
variable {α : Type u} {β : Type v}
@[simp] theorem eraseIdx_zero (l : List α) : eraseIdx l 0 = tail l := by cases l <;> rfl
theorem eraseIdx_eq_take_drop_succ :
∀ (l : List α) (i : Nat), l.eraseIdx i = l.take i ++ l.drop (i + 1)
| nil, _ => by simp
| a::l, 0 => by simp
| a::l, i + 1 => by simp [eraseIdx_eq_take_drop_succ l i]
theorem eraseIdx_sublist : ∀ (l : List α) (k : Nat), eraseIdx l k <+ l
| [], _ => by simp
| a::l, 0 => by simp
| a::l, k + 1 => by simp [eraseIdx_sublist l k]
theorem eraseIdx_subset (l : List α) (k : Nat) : eraseIdx l k ⊆ l := (eraseIdx_sublist l k).subset
@[simp]
theorem eraseIdx_eq_self : ∀ {l : List α} {k : Nat}, eraseIdx l k = l ↔ length l ≤ k
| [], _ => by simp
| a::l, 0 => by simp [(cons_ne_self _ _).symm]
| a::l, k + 1 => by simp [eraseIdx_eq_self]
alias ⟨_, eraseIdx_of_length_le⟩ := eraseIdx_eq_self
| .lake/packages/batteries/Batteries/Data/List/EraseIdx.lean | 43 | 47 | theorem eraseIdx_append_of_lt_length {l : List α} {k : Nat} (hk : k < length l) (l' : List α) :
eraseIdx (l ++ l') k = eraseIdx l k ++ l' := by |
rw [eraseIdx_eq_take_drop_succ, take_append_of_le_length, drop_append_of_le_length,
eraseIdx_eq_take_drop_succ, append_assoc]
all_goals omega
| [
" l.eraseIdx 0 = l.tail",
" [].eraseIdx 0 = [].tail",
" (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail",
" [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []",
" (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)",
" (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::... | [
" l.eraseIdx 0 = l.tail",
" [].eraseIdx 0 = [].tail",
" (head✝ :: tail✝).eraseIdx 0 = (head✝ :: tail✝).tail",
" [].eraseIdx x✝ = take x✝ [] ++ drop (x✝ + 1) []",
" (a :: l).eraseIdx 0 = take 0 (a :: l) ++ drop (0 + 1) (a :: l)",
" (a :: l).eraseIdx (i + 1) = take (i + 1) (a :: l) ++ drop (i + 1 + 1) (a ::... |
import Mathlib.Init.Algebra.Classes
import Mathlib.Logic.Nontrivial.Basic
import Mathlib.Order.BoundedOrder
import Mathlib.Data.Option.NAry
import Mathlib.Tactic.Lift
import Mathlib.Data.Option.Basic
#align_import order.with_bot from "leanprover-community/mathlib"@"0111834459f5d7400215223ea95ae38a1265a907"
variable {α β γ δ : Type*}
def WithBot (α : Type*) :=
Option α
#align with_bot WithBot
namespace WithBot
variable {a b : α}
instance [Repr α] : Repr (WithBot α) :=
⟨fun o _ =>
match o with
| none => "⊥"
| some a => "↑" ++ repr a⟩
@[coe, match_pattern] def some : α → WithBot α :=
Option.some
-- Porting note: changed this from `CoeTC` to `Coe` but I am not 100% confident that's correct.
instance coe : Coe α (WithBot α) :=
⟨some⟩
instance bot : Bot (WithBot α) :=
⟨none⟩
instance inhabited : Inhabited (WithBot α) :=
⟨⊥⟩
instance nontrivial [Nonempty α] : Nontrivial (WithBot α) :=
Option.nontrivial
open Function
theorem coe_injective : Injective ((↑) : α → WithBot α) :=
Option.some_injective _
#align with_bot.coe_injective WithBot.coe_injective
@[simp, norm_cast]
theorem coe_inj : (a : WithBot α) = b ↔ a = b :=
Option.some_inj
#align with_bot.coe_inj WithBot.coe_inj
protected theorem «forall» {p : WithBot α → Prop} : (∀ x, p x) ↔ p ⊥ ∧ ∀ x : α, p x :=
Option.forall
#align with_bot.forall WithBot.forall
protected theorem «exists» {p : WithBot α → Prop} : (∃ x, p x) ↔ p ⊥ ∨ ∃ x : α, p x :=
Option.exists
#align with_bot.exists WithBot.exists
theorem none_eq_bot : (none : WithBot α) = (⊥ : WithBot α) :=
rfl
#align with_bot.none_eq_bot WithBot.none_eq_bot
theorem some_eq_coe (a : α) : (Option.some a : WithBot α) = (↑a : WithBot α) :=
rfl
#align with_bot.some_eq_coe WithBot.some_eq_coe
@[simp]
theorem bot_ne_coe : ⊥ ≠ (a : WithBot α) :=
nofun
#align with_bot.bot_ne_coe WithBot.bot_ne_coe
@[simp]
theorem coe_ne_bot : (a : WithBot α) ≠ ⊥ :=
nofun
#align with_bot.coe_ne_bot WithBot.coe_ne_bot
@[elab_as_elim, induction_eliminator, cases_eliminator]
def recBotCoe {C : WithBot α → Sort*} (bot : C ⊥) (coe : ∀ a : α, C a) : ∀ n : WithBot α, C n
| ⊥ => bot
| (a : α) => coe a
#align with_bot.rec_bot_coe WithBot.recBotCoe
@[simp]
theorem recBotCoe_bot {C : WithBot α → Sort*} (d : C ⊥) (f : ∀ a : α, C a) :
@recBotCoe _ C d f ⊥ = d :=
rfl
#align with_bot.rec_bot_coe_bot WithBot.recBotCoe_bot
@[simp]
theorem recBotCoe_coe {C : WithBot α → Sort*} (d : C ⊥) (f : ∀ a : α, C a) (x : α) :
@recBotCoe _ C d f ↑x = f x :=
rfl
#align with_bot.rec_bot_coe_coe WithBot.recBotCoe_coe
def unbot' (d : α) (x : WithBot α) : α :=
recBotCoe d id x
#align with_bot.unbot' WithBot.unbot'
@[simp]
theorem unbot'_bot {α} (d : α) : unbot' d ⊥ = d :=
rfl
#align with_bot.unbot'_bot WithBot.unbot'_bot
@[simp]
theorem unbot'_coe {α} (d x : α) : unbot' d x = x :=
rfl
#align with_bot.unbot'_coe WithBot.unbot'_coe
theorem coe_eq_coe : (a : WithBot α) = b ↔ a = b := coe_inj
#align with_bot.coe_eq_coe WithBot.coe_eq_coe
theorem unbot'_eq_iff {d y : α} {x : WithBot α} : unbot' d x = y ↔ x = y ∨ x = ⊥ ∧ y = d := by
induction x <;> simp [@eq_comm _ d]
#align with_bot.unbot'_eq_iff WithBot.unbot'_eq_iff
@[simp] theorem unbot'_eq_self_iff {d : α} {x : WithBot α} : unbot' d x = d ↔ x = d ∨ x = ⊥ := by
simp [unbot'_eq_iff]
#align with_bot.unbot'_eq_self_iff WithBot.unbot'_eq_self_iff
| Mathlib/Order/WithBot.lean | 143 | 145 | theorem unbot'_eq_unbot'_iff {d : α} {x y : WithBot α} :
unbot' d x = unbot' d y ↔ x = y ∨ x = d ∧ y = ⊥ ∨ x = ⊥ ∧ y = d := by |
induction y <;> simp [unbot'_eq_iff, or_comm]
| [
" unbot' d x = y ↔ x = ↑y ∨ x = ⊥ ∧ y = d",
" unbot' d ⊥ = y ↔ ⊥ = ↑y ∨ ⊥ = ⊥ ∧ y = d",
" unbot' d ↑a✝ = y ↔ ↑a✝ = ↑y ∨ ↑a✝ = ⊥ ∧ y = d",
" unbot' d x = d ↔ x = ↑d ∨ x = ⊥",
" unbot' d x = unbot' d y ↔ x = y ∨ x = ↑d ∧ y = ⊥ ∨ x = ⊥ ∧ y = ↑d",
" unbot' d x = unbot' d ⊥ ↔ x = ⊥ ∨ x = ↑d ∧ ⊥ = ⊥ ∨ x = ⊥ ∧ ⊥... | [
" unbot' d x = y ↔ x = ↑y ∨ x = ⊥ ∧ y = d",
" unbot' d ⊥ = y ↔ ⊥ = ↑y ∨ ⊥ = ⊥ ∧ y = d",
" unbot' d ↑a✝ = y ↔ ↑a✝ = ↑y ∨ ↑a✝ = ⊥ ∧ y = d",
" unbot' d x = d ↔ x = ↑d ∨ x = ⊥"
] |
import Mathlib.LinearAlgebra.CliffordAlgebra.Fold
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
#align_import linear_algebra.exterior_algebra.of_alternating from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
variable {R M N N' : Type*}
variable [CommRing R] [AddCommGroup M] [AddCommGroup N] [AddCommGroup N']
variable [Module R M] [Module R N] [Module R N']
-- This instance can't be found where it's needed if we don't remind lean that it exists.
instance AlternatingMap.instModuleAddCommGroup {ι : Type*} :
Module R (M [⋀^ι]→ₗ[R] N) := by
infer_instance
#align alternating_map.module_add_comm_group AlternatingMap.instModuleAddCommGroup
namespace ExteriorAlgebra
open CliffordAlgebra hiding ι
def liftAlternating : (∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N := by
suffices
(∀ i, M [⋀^Fin i]→ₗ[R] N) →ₗ[R]
ExteriorAlgebra R M →ₗ[R] ∀ i, M [⋀^Fin i]→ₗ[R] N by
refine LinearMap.compr₂ this ?_
refine (LinearEquiv.toLinearMap ?_).comp (LinearMap.proj 0)
exact AlternatingMap.constLinearEquivOfIsEmpty.symm
refine CliffordAlgebra.foldl _ ?_ ?_
· refine
LinearMap.mk₂ R (fun m f i => (f i.succ).curryLeft m) (fun m₁ m₂ f => ?_) (fun c m f => ?_)
(fun m f₁ f₂ => ?_) fun c m f => ?_
all_goals
ext i : 1
simp only [map_smul, map_add, Pi.add_apply, Pi.smul_apply, AlternatingMap.curryLeft_add,
AlternatingMap.curryLeft_smul, map_add, map_smul, LinearMap.add_apply, LinearMap.smul_apply]
· -- when applied twice with the same `m`, this recursive step produces 0
intro m x
dsimp only [LinearMap.mk₂_apply, QuadraticForm.coeFn_zero, Pi.zero_apply]
simp_rw [zero_smul]
ext i : 1
exact AlternatingMap.curryLeft_same _ _
#align exterior_algebra.lift_alternating ExteriorAlgebra.liftAlternating
@[simp]
theorem liftAlternating_ι (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m) = f 1 ![m] := by
dsimp [liftAlternating]
rw [foldl_ι, LinearMap.mk₂_apply, AlternatingMap.curryLeft_apply_apply]
congr
-- Porting note: In Lean 3, `congr` could use the `[Subsingleton (Fin 0 → M)]` instance to finish
-- the proof. Here, the instance can be synthesized but `congr` does not use it so the following
-- line is provided.
rw [Matrix.zero_empty]
#align exterior_algebra.lift_alternating_ι ExteriorAlgebra.liftAlternating_ι
theorem liftAlternating_ι_mul (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) (m : M)
(x : ExteriorAlgebra R M) :
liftAlternating (R := R) (M := M) (N := N) f (ι R m * x) =
liftAlternating (R := R) (M := M) (N := N) (fun i => (f i.succ).curryLeft m) x := by
dsimp [liftAlternating]
rw [foldl_mul, foldl_ι]
rfl
#align exterior_algebra.lift_alternating_ι_mul ExteriorAlgebra.liftAlternating_ι_mul
@[simp]
| Mathlib/LinearAlgebra/ExteriorAlgebra/OfAlternating.lean | 89 | 92 | theorem liftAlternating_one (f : ∀ i, M [⋀^Fin i]→ₗ[R] N) :
liftAlternating (R := R) (M := M) (N := N) f (1 : ExteriorAlgebra R M) = f 0 0 := by |
dsimp [liftAlternating]
rw [foldl_one]
| [
" Module R (M [⋀^ι]→ₗ[R] N)",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] N",
" M [⋀^Fin 0]→ₗ[R] N ≃ₗ[R] N",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] (i : ℕ) → M [⋀^Fin i]→ₗ[R] N",
" M →ₗ[R] ((i : ℕ) → M [⋀^Fin i]→ₗ[R]... | [
" Module R (M [⋀^ι]→ₗ[R] N)",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] N",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] N",
" M [⋀^Fin 0]→ₗ[R] N ≃ₗ[R] N",
" ((i : ℕ) → M [⋀^Fin i]→ₗ[R] N) →ₗ[R] ExteriorAlgebra R M →ₗ[R] (i : ℕ) → M [⋀^Fin i]→ₗ[R] N",
" M →ₗ[R] ((i : ℕ) → M [⋀^Fin i]→ₗ[R]... |
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.Algebra.Polynomial.RingDivision
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
universe u v
variable (K : Type u)
structure RatFunc [CommRing K] : Type u where ofFractionRing ::
toFractionRing : FractionRing K[X]
#align ratfunc RatFunc
#align ratfunc.of_fraction_ring RatFunc.ofFractionRing
#align ratfunc.to_fraction_ring RatFunc.toFractionRing
namespace RatFunc
section CommRing
variable {K}
variable [CommRing K]
section Rec
theorem ofFractionRing_injective : Function.Injective (ofFractionRing : _ → RatFunc K) :=
fun _ _ => ofFractionRing.inj
#align ratfunc.of_fraction_ring_injective RatFunc.ofFractionRing_injective
theorem toFractionRing_injective : Function.Injective (toFractionRing : _ → FractionRing K[X])
-- Porting note: the `xy` input was `rfl` and then there was no need for the `subst`
| ⟨x⟩, ⟨y⟩, xy => by subst xy; rfl
#align ratfunc.to_fraction_ring_injective RatFunc.toFractionRing_injective
protected irreducible_def liftOn {P : Sort v} (x : RatFunc K) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
P := by
refine Localization.liftOn (toFractionRing x) (fun p q => f p q) ?_
intros p p' q q' h
exact H q.2 q'.2 (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
-- Porting note: the definition above was as follows
-- (-- Fix timeout by manipulating elaboration order
-- fun p q => f p q)
-- fun p p' q q' h => by
-- exact H q.2 q'.2
-- (let ⟨⟨c, hc⟩, mul_eq⟩ := Localization.r_iff_exists.mp h
-- mul_cancel_left_coe_nonZeroDivisors.mp mul_eq)
#align ratfunc.lift_on RatFunc.liftOn
theorem liftOn_ofFractionRing_mk {P : Sort v} (n : K[X]) (d : K[X]⁰) (f : K[X] → K[X] → P)
(H : ∀ {p q p' q'} (_hq : q ∈ K[X]⁰) (_hq' : q' ∈ K[X]⁰), q' * p = q * p' → f p q = f p' q') :
RatFunc.liftOn (ofFractionRing (Localization.mk n d)) f @H = f n d := by
rw [RatFunc.liftOn]
exact Localization.liftOn_mk _ _ _ _
#align ratfunc.lift_on_of_fraction_ring_mk RatFunc.liftOn_ofFractionRing_mk
theorem liftOn_condition_of_liftOn'_condition {P : Sort v} {f : K[X] → K[X] → P}
(H : ∀ {p q a} (hq : q ≠ 0) (_ha : a ≠ 0), f (a * p) (a * q) = f p q) ⦃p q p' q' : K[X]⦄
(hq : q ≠ 0) (hq' : q' ≠ 0) (h : q' * p = q * p') : f p q = f p' q' :=
calc
f p q = f (q' * p) (q' * q) := (H hq hq').symm
_ = f (q * p') (q * q') := by rw [h, mul_comm q']
_ = f p' q' := H hq' hq
#align ratfunc.lift_on_condition_of_lift_on'_condition RatFunc.liftOn_condition_of_liftOn'_condition
section IsDomain
variable [IsDomain K]
protected irreducible_def mk (p q : K[X]) : RatFunc K :=
ofFractionRing (algebraMap _ _ p / algebraMap _ _ q)
#align ratfunc.mk RatFunc.mk
| Mathlib/FieldTheory/RatFunc/Defs.lean | 154 | 155 | theorem mk_eq_div' (p q : K[X]) :
RatFunc.mk p q = ofFractionRing (algebraMap _ _ p / algebraMap _ _ q) := by | rw [RatFunc.mk]
| [
" { toFractionRing := x } = { toFractionRing := y }",
" { toFractionRing := x } = { toFractionRing := { toFractionRing := x }.toFractionRing }",
" P",
" ∀ {a c : K[X]} {b d : ↥K[X]⁰},\n (Localization.r K[X]⁰) (a, b) (c, d) → (fun p q => f p ↑q) a b = (fun p q => f p ↑q) c d",
" (fun p q => f p ↑q) p q = ... | [
" { toFractionRing := x } = { toFractionRing := y }",
" { toFractionRing := x } = { toFractionRing := { toFractionRing := x }.toFractionRing }",
" P",
" ∀ {a c : K[X]} {b d : ↥K[X]⁰},\n (Localization.r K[X]⁰) (a, b) (c, d) → (fun p q => f p ↑q) a b = (fun p q => f p ↑q) c d",
" (fun p q => f p ↑q) p q = ... |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
#align ring_quot.rel.add_right RingQuot.Rel.add_right
theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) :
Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h]
#align ring_quot.rel.neg RingQuot.Rel.neg
theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) :
Rel r (a - c) (b - c) := by simp only [sub_eq_add_neg, h.add_left]
#align ring_quot.rel.sub_left RingQuot.Rel.sub_left
theorem Rel.sub_right {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) :
Rel r (a - b) (a - c) := by simp only [sub_eq_add_neg, h.neg.add_right]
#align ring_quot.rel.sub_right RingQuot.Rel.sub_right
| Mathlib/Algebra/RingQuot.lean | 79 | 80 | theorem Rel.smul {r : A → A → Prop} (k : S) ⦃a b : A⦄ (h : Rel r a b) : Rel r (k • a) (k • b) := by |
simp only [Algebra.smul_def, Rel.mul_right h]
| [
" Rel r (a + b) (a + c)",
" Rel r (b + a) (c + a)",
" Rel r (-a) (-b)",
" Rel r (a - c) (b - c)",
" Rel r (a - b) (a - c)",
" Rel r (k • a) (k • b)"
] | [
" Rel r (a + b) (a + c)",
" Rel r (b + a) (c + a)",
" Rel r (-a) (-b)",
" Rel r (a - c) (b - c)",
" Rel r (a - b) (a - c)"
] |
import Mathlib.Data.ENat.Lattice
import Mathlib.Order.OrderIsoNat
import Mathlib.Tactic.TFAE
#align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
open List hiding le_antisymm
open OrderDual
universe u v
variable {α β : Type*}
namespace Set
section LT
variable [LT α] [LT β] (s t : Set α)
def subchain : Set (List α) :=
{ l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s }
#align set.subchain Set.subchain
@[simp] -- porting note: new `simp`
theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩
#align set.nil_mem_subchain Set.nil_mem_subchain
variable {s} {l : List α} {a : α}
theorem cons_mem_subchain_iff :
(a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by
simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm,
and_assoc]
#align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff
@[simp] -- Porting note (#10756): new lemma + `simp`
theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff]
instance : Nonempty s.subchain :=
⟨⟨[], s.nil_mem_subchain⟩⟩
variable (s)
noncomputable def chainHeight : ℕ∞ :=
⨆ l ∈ s.subchain, length l
#align set.chain_height Set.chainHeight
theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length :=
iSup_subtype'
#align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
∃ l ∈ s.subchain, length l = n := by
rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
rw [chainHeight_eq_iSup_subtype] at ha
· obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
· rw [ENat.iSup_coe_lt_top] at ha
obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha
refine
⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| ?_⟩
rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype]
#align set.exists_chain_of_le_chain_height Set.exists_chain_of_le_chainHeight
theorem le_chainHeight_TFAE (n : ℕ) :
TFAE [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, length l = n, ∃ l ∈ s.subchain, n ≤ length l] := by
tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight
tfae_have 2 → 3; · rintro ⟨l, hls, he⟩; exact ⟨l, hls, he.ge⟩
tfae_have 3 → 1; · rintro ⟨l, hs, hn⟩; exact le_iSup₂_of_le l hs (WithTop.coe_le_coe.2 hn)
tfae_finish
#align set.le_chain_height_tfae Set.le_chainHeight_TFAE
variable {s t}
theorem le_chainHeight_iff {n : ℕ} : ↑n ≤ s.chainHeight ↔ ∃ l ∈ s.subchain, length l = n :=
(le_chainHeight_TFAE s n).out 0 1
#align set.le_chain_height_iff Set.le_chainHeight_iff
theorem length_le_chainHeight_of_mem_subchain (hl : l ∈ s.subchain) : ↑l.length ≤ s.chainHeight :=
le_chainHeight_iff.mpr ⟨l, hl, rfl⟩
#align set.length_le_chain_height_of_mem_subchain Set.length_le_chainHeight_of_mem_subchain
theorem chainHeight_eq_top_iff : s.chainHeight = ⊤ ↔ ∀ n, ∃ l ∈ s.subchain, length l = n := by
refine ⟨fun h n ↦ le_chainHeight_iff.1 (le_top.trans_eq h.symm), fun h ↦ ?_⟩
contrapose! h; obtain ⟨n, hn⟩ := WithTop.ne_top_iff_exists.1 h
exact ⟨n + 1, fun l hs ↦ (Nat.lt_succ_iff.2 <| Nat.cast_le.1 <|
(length_le_chainHeight_of_mem_subchain hs).trans_eq hn.symm).ne⟩
#align set.chain_height_eq_top_iff Set.chainHeight_eq_top_iff
@[simp]
| Mathlib/Order/Height.lean | 135 | 138 | theorem one_le_chainHeight_iff : 1 ≤ s.chainHeight ↔ s.Nonempty := by |
rw [← Nat.cast_one, Set.le_chainHeight_iff]
simp only [length_eq_one, @and_comm (_ ∈ _), @eq_comm _ _ [_], exists_exists_eq_and,
singleton_mem_subchain_iff, Set.Nonempty]
| [
" a :: l ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b",
" [a] ∈ s.subchain ↔ a ∈ s",
" ∃ l ∈ s.subchain, l.length = n",
" n ≤ l.length",
" [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, l.length = n, ∃ l ∈ s.subchain, n ≤ l.length].TFAE",
" ↑n ≤ s.chainHeight → ∃ l ∈ s.subchain, l.length = n",
"... | [
" a :: l ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b",
" [a] ∈ s.subchain ↔ a ∈ s",
" ∃ l ∈ s.subchain, l.length = n",
" n ≤ l.length",
" [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, l.length = n, ∃ l ∈ s.subchain, n ≤ l.length].TFAE",
" ↑n ≤ s.chainHeight → ∃ l ∈ s.subchain, l.length = n",
"... |
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
noncomputable section
open scoped Classical
variable {α β γ : Type*}
def Finite.equivFin (α : Type*) [Finite α] : α ≃ Fin (Nat.card α) := by
have := (Finite.exists_equiv_fin α).choose_spec.some
rwa [Nat.card_eq_of_equiv_fin this]
#align finite.equiv_fin Finite.equivFin
def Finite.equivFinOfCardEq [Finite α] {n : ℕ} (h : Nat.card α = n) : α ≃ Fin n := by
subst h
apply Finite.equivFin
#align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq
theorem Nat.card_eq (α : Type*) :
Nat.card α = if h : Finite α then @Fintype.card α (Fintype.ofFinite α) else 0 := by
cases finite_or_infinite α
· letI := Fintype.ofFinite α
simp only [*, Nat.card_eq_fintype_card, dif_pos]
· simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false]
#align nat.card_eq Nat.card_eq
theorem Finite.card_pos_iff [Finite α] : 0 < Nat.card α ↔ Nonempty α := by
haveI := Fintype.ofFinite α
rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff]
#align finite.card_pos_iff Finite.card_pos_iff
theorem Finite.card_pos [Finite α] [h : Nonempty α] : 0 < Nat.card α :=
Finite.card_pos_iff.mpr h
#align finite.card_pos Finite.card_pos
namespace Finite
theorem cast_card_eq_mk {α : Type*} [Finite α] : ↑(Nat.card α) = Cardinal.mk α :=
Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite α)
#align finite.cast_card_eq_mk Finite.cast_card_eq_mk
theorem card_eq [Finite α] [Finite β] : Nat.card α = Nat.card β ↔ Nonempty (α ≃ β) := by
haveI := Fintype.ofFinite α
haveI := Fintype.ofFinite β
simp only [Nat.card_eq_fintype_card, Fintype.card_eq]
#align finite.card_eq Finite.card_eq
| Mathlib/Data/Finite/Card.lean | 78 | 80 | theorem card_le_one_iff_subsingleton [Finite α] : Nat.card α ≤ 1 ↔ Subsingleton α := by |
haveI := Fintype.ofFinite α
simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton]
| [
" α ≃ Fin (Nat.card α)",
" α ≃ Fin n",
" Nat.card α = if h : Finite α then Fintype.card α else 0",
" 0 < Nat.card α ↔ Nonempty α",
" Nat.card α = Nat.card β ↔ Nonempty (α ≃ β)",
" Nat.card α ≤ 1 ↔ Subsingleton α"
] | [
" α ≃ Fin (Nat.card α)",
" α ≃ Fin n",
" Nat.card α = if h : Finite α then Fintype.card α else 0",
" 0 < Nat.card α ↔ Nonempty α",
" Nat.card α = Nat.card β ↔ Nonempty (α ≃ β)"
] |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Semiring
variable (S : Type u) [Semiring S]
noncomputable def ascPochhammer : ℕ → S[X]
| 0 => 1
| n + 1 => X * (ascPochhammer n).comp (X + 1)
#align pochhammer ascPochhammer
@[simp]
theorem ascPochhammer_zero : ascPochhammer S 0 = 1 :=
rfl
#align pochhammer_zero ascPochhammer_zero
@[simp]
theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer]
#align pochhammer_one ascPochhammer_one
theorem ascPochhammer_succ_left (n : ℕ) :
ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by
rw [ascPochhammer]
#align pochhammer_succ_left ascPochhammer_succ_left
theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] :
Monic <| ascPochhammer S n := by
induction' n with n hn
· simp
· have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1
rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul,
leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn,
monic_X, one_mul, one_mul, this, one_pow]
section
variable {S} {T : Type v} [Semiring T]
@[simp]
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) :
(ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih
· simp
· simp [ih, ascPochhammer_succ_left, map_comp]
#align pochhammer_map ascPochhammer_map
theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) :
(ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by
rw [← ascPochhammer_map f]
exact eval_map f t
theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S]
(x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x =
(ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by
rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S),
← map_comp, eval_map]
end
@[simp, norm_cast]
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 104 | 107 | theorem ascPochhammer_eval_cast (n k : ℕ) :
(((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by |
rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S),
eval₂_at_natCast,Nat.cast_id]
| [
" ascPochhammer S 1 = X",
" ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)",
" (ascPochhammer S n).Monic",
" (ascPochhammer S 0).Monic",
" (ascPochhammer S (n + 1)).Monic",
" map f (ascPochhammer S n) = ascPochhammer T n",
" map f (ascPochhammer S 0) = ascPochhammer T 0",
" map f (ascP... | [
" ascPochhammer S 1 = X",
" ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)",
" (ascPochhammer S n).Monic",
" (ascPochhammer S 0).Monic",
" (ascPochhammer S (n + 1)).Monic",
" map f (ascPochhammer S n) = ascPochhammer T n",
" map f (ascPochhammer S 0) = ascPochhammer T 0",
" map f (ascP... |
import Mathlib.Analysis.Complex.Circle
import Mathlib.Analysis.NormedSpace.BallAction
#align_import analysis.complex.unit_disc.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Set Function Metric
noncomputable section
local notation "conj'" => starRingEnd ℂ
namespace Complex
def UnitDisc : Type :=
ball (0 : ℂ) 1 deriving TopologicalSpace
#align complex.unit_disc Complex.UnitDisc
@[inherit_doc] scoped[UnitDisc] notation "𝔻" => Complex.UnitDisc
open UnitDisc
namespace UnitDisc
instance instCommSemigroup : CommSemigroup UnitDisc := by unfold UnitDisc; infer_instance
instance instHasDistribNeg : HasDistribNeg UnitDisc := by unfold UnitDisc; infer_instance
instance instCoe : Coe UnitDisc ℂ := ⟨Subtype.val⟩
theorem coe_injective : Injective ((↑) : 𝔻 → ℂ) :=
Subtype.coe_injective
#align complex.unit_disc.coe_injective Complex.UnitDisc.coe_injective
theorem abs_lt_one (z : 𝔻) : abs (z : ℂ) < 1 :=
mem_ball_zero_iff.1 z.2
#align complex.unit_disc.abs_lt_one Complex.UnitDisc.abs_lt_one
theorem abs_ne_one (z : 𝔻) : abs (z : ℂ) ≠ 1 :=
z.abs_lt_one.ne
#align complex.unit_disc.abs_ne_one Complex.UnitDisc.abs_ne_one
| Mathlib/Analysis/Complex/UnitDisc/Basic.lean | 53 | 55 | theorem normSq_lt_one (z : 𝔻) : normSq z < 1 := by |
convert (Real.sqrt_lt' one_pos).1 z.abs_lt_one
exact (one_pow 2).symm
| [
" CommSemigroup 𝔻",
" CommSemigroup ↑(ball 0 1)",
" HasDistribNeg 𝔻",
" HasDistribNeg ↑(ball 0 1)",
" normSq ↑z < 1",
" 1 = 1 ^ 2"
] | [
" CommSemigroup 𝔻",
" CommSemigroup ↑(ball 0 1)",
" HasDistribNeg 𝔻",
" HasDistribNeg ↑(ball 0 1)"
] |
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.Data.Set.MemPartition
import Mathlib.Order.Filter.CountableSeparatingOn
open Set MeasureTheory
namespace MeasurableSpace
variable {α β : Type*}
class CountablyGenerated (α : Type*) [m : MeasurableSpace α] : Prop where
isCountablyGenerated : ∃ b : Set (Set α), b.Countable ∧ m = generateFrom b
#align measurable_space.countably_generated MeasurableSpace.CountablyGenerated
def countableGeneratingSet (α : Type*) [MeasurableSpace α] [h : CountablyGenerated α] :
Set (Set α) :=
insert ∅ h.isCountablyGenerated.choose
lemma countable_countableGeneratingSet [MeasurableSpace α] [h : CountablyGenerated α] :
Set.Countable (countableGeneratingSet α) :=
Countable.insert _ h.isCountablyGenerated.choose_spec.1
lemma generateFrom_countableGeneratingSet [m : MeasurableSpace α] [h : CountablyGenerated α] :
generateFrom (countableGeneratingSet α) = m :=
(generateFrom_insert_empty _).trans <| h.isCountablyGenerated.choose_spec.2.symm
lemma empty_mem_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
∅ ∈ countableGeneratingSet α := mem_insert _ _
lemma nonempty_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
Set.Nonempty (countableGeneratingSet α) :=
⟨∅, mem_insert _ _⟩
lemma measurableSet_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α]
{s : Set α} (hs : s ∈ countableGeneratingSet α) :
MeasurableSet s := by
rw [← generateFrom_countableGeneratingSet (α := α)]
exact measurableSet_generateFrom hs
def natGeneratingSequence (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : ℕ → (Set α) :=
enumerateCountable (countable_countableGeneratingSet (α := α)) ∅
lemma generateFrom_natGeneratingSequence (α : Type*) [m : MeasurableSpace α]
[CountablyGenerated α] : generateFrom (range (natGeneratingSequence _)) = m := by
rw [natGeneratingSequence, range_enumerateCountable_of_mem _ empty_mem_countableGeneratingSet,
generateFrom_countableGeneratingSet]
lemma measurableSet_natGeneratingSequence [MeasurableSpace α] [CountablyGenerated α] (n : ℕ) :
MeasurableSet (natGeneratingSequence α n) :=
measurableSet_countableGeneratingSet $ Set.enumerateCountable_mem _
empty_mem_countableGeneratingSet n
| Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean | 96 | 101 | theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
@CountablyGenerated α (.comap f m) := by |
rcases h with ⟨⟨b, hbc, rfl⟩⟩
rw [comap_generateFrom]
letI := generateFrom (preimage f '' b)
exact ⟨_, hbc.image _, rfl⟩
| [
" MeasurableSet s",
" generateFrom (range (natGeneratingSequence α)) = m",
" CountablyGenerated α"
] | [
" MeasurableSet s",
" generateFrom (range (natGeneratingSequence α)) = m"
] |
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Algebra.Ring.Subring.Pointwise
import Mathlib.RingTheory.Adjoin.Basic
#align_import algebra.algebra.subalgebra.pointwise from "leanprover-community/mathlib"@"b2c707cd190a58ea0565c86695a19e99ccecc215"
namespace Subalgebra
section Pointwise
variable {R : Type*} {A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
| Mathlib/Algebra/Algebra/Subalgebra/Pointwise.lean | 27 | 32 | theorem mul_toSubmodule_le (S T : Subalgebra R A) :
(Subalgebra.toSubmodule S)* (Subalgebra.toSubmodule T) ≤ Subalgebra.toSubmodule (S ⊔ T) := by |
rw [Submodule.mul_le]
intro y hy z hz
show y * z ∈ S ⊔ T
exact mul_mem (Algebra.mem_sup_left hy) (Algebra.mem_sup_right hz)
| [
" toSubmodule S * toSubmodule T ≤ toSubmodule (S ⊔ T)",
" ∀ m ∈ toSubmodule S, ∀ n ∈ toSubmodule T, m * n ∈ toSubmodule (S ⊔ T)",
" y * z ∈ toSubmodule (S ⊔ T)",
" y * z ∈ S ⊔ T"
] | [] |
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.MeasureTheory.Function.SimpleFuncDense
#align_import measure_theory.function.simple_func_dense_lp from "leanprover-community/mathlib"@"5a2df4cd59cb31e97a516d4603a14bed5c2f9425"
noncomputable section
set_option linter.uppercaseLean3 false
open Set Function Filter TopologicalSpace ENNReal EMetric Finset
open scoped Classical Topology ENNReal MeasureTheory
variable {α β ι E F 𝕜 : Type*}
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
section Lp
variable [MeasurableSpace β] [MeasurableSpace E] [NormedAddCommGroup E] [NormedAddCommGroup F]
{q : ℝ} {p : ℝ≥0∞}
theorem nnnorm_approxOn_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E}
{y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) :
‖approxOn f hf s y₀ h₀ n x - f x‖₊ ≤ ‖f x - y₀‖₊ := by
have := edist_approxOn_le hf h₀ x n
rw [edist_comm y₀] at this
simp only [edist_nndist, nndist_eq_nnnorm] at this
exact mod_cast this
#align measure_theory.simple_func.nnnorm_approx_on_le MeasureTheory.SimpleFunc.nnnorm_approxOn_le
theorem norm_approxOn_y₀_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E}
{y₀ : E} (h₀ : y₀ ∈ s) [SeparableSpace s] (x : β) (n : ℕ) :
‖approxOn f hf s y₀ h₀ n x - y₀‖ ≤ ‖f x - y₀‖ + ‖f x - y₀‖ := by
have := edist_approxOn_y0_le hf h₀ x n
repeat rw [edist_comm y₀, edist_eq_coe_nnnorm_sub] at this
exact mod_cast this
#align measure_theory.simple_func.norm_approx_on_y₀_le MeasureTheory.SimpleFunc.norm_approxOn_y₀_le
| Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean | 85 | 90 | theorem norm_approxOn_zero_le [OpensMeasurableSpace E] {f : β → E} (hf : Measurable f) {s : Set E}
(h₀ : (0 : E) ∈ s) [SeparableSpace s] (x : β) (n : ℕ) :
‖approxOn f hf s 0 h₀ n x‖ ≤ ‖f x‖ + ‖f x‖ := by |
have := edist_approxOn_y0_le hf h₀ x n
simp [edist_comm (0 : E), edist_eq_coe_nnnorm] at this
exact mod_cast this
| [
" ‖↑(approxOn f hf s y₀ h₀ n) x - f x‖₊ ≤ ‖f x - y₀‖₊",
" ‖↑(approxOn f hf s y₀ h₀ n) x - y₀‖ ≤ ‖f x - y₀‖ + ‖f x - y₀‖",
" ‖↑(approxOn f hf s 0 h₀ n) x‖ ≤ ‖f x‖ + ‖f x‖"
] | [
" ‖↑(approxOn f hf s y₀ h₀ n) x - f x‖₊ ≤ ‖f x - y₀‖₊",
" ‖↑(approxOn f hf s y₀ h₀ n) x - y₀‖ ≤ ‖f x - y₀‖ + ‖f x - y₀‖"
] |
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Int
import Mathlib.Algebra.GroupWithZero.Semiconj
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.int.gcd from "leanprover-community/mathlib"@"47a1a73351de8dd6c8d3d32b569c8e434b03ca47"
namespace Nat
def xgcdAux : ℕ → ℤ → ℤ → ℕ → ℤ → ℤ → ℕ × ℤ × ℤ
| 0, _, _, r', s', t' => (r', s', t')
| succ k, s, t, r', s', t' =>
let q := r' / succ k
xgcdAux (r' % succ k) (s' - q * s) (t' - q * t) (succ k) s t
termination_by k => k
decreasing_by exact mod_lt _ <| (succ_pos _).gt
#align nat.xgcd_aux Nat.xgcdAux
@[simp]
theorem xgcd_zero_left {s t r' s' t'} : xgcdAux 0 s t r' s' t' = (r', s', t') := by simp [xgcdAux]
#align nat.xgcd_zero_left Nat.xgcd_zero_left
theorem xgcdAux_rec {r s t r' s' t'} (h : 0 < r) :
xgcdAux r s t r' s' t' = xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t := by
obtain ⟨r, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h.ne'
simp [xgcdAux]
#align nat.xgcd_aux_rec Nat.xgcdAux_rec
def xgcd (x y : ℕ) : ℤ × ℤ :=
(xgcdAux x 1 0 y 0 1).2
#align nat.xgcd Nat.xgcd
def gcdA (x y : ℕ) : ℤ :=
(xgcd x y).1
#align nat.gcd_a Nat.gcdA
def gcdB (x y : ℕ) : ℤ :=
(xgcd x y).2
#align nat.gcd_b Nat.gcdB
@[simp]
theorem gcdA_zero_left {s : ℕ} : gcdA 0 s = 0 := by
unfold gcdA
rw [xgcd, xgcd_zero_left]
#align nat.gcd_a_zero_left Nat.gcdA_zero_left
@[simp]
theorem gcdB_zero_left {s : ℕ} : gcdB 0 s = 1 := by
unfold gcdB
rw [xgcd, xgcd_zero_left]
#align nat.gcd_b_zero_left Nat.gcdB_zero_left
@[simp]
theorem gcdA_zero_right {s : ℕ} (h : s ≠ 0) : gcdA s 0 = 1 := by
unfold gcdA xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
#align nat.gcd_a_zero_right Nat.gcdA_zero_right
@[simp]
| Mathlib/Data/Int/GCD.lean | 94 | 98 | theorem gcdB_zero_right {s : ℕ} (h : s ≠ 0) : gcdB s 0 = 0 := by |
unfold gcdB xgcd
obtain ⟨s, rfl⟩ := Nat.exists_eq_succ_of_ne_zero h
rw [xgcdAux]
simp
| [
" (invImage\n (fun x =>\n PSigma.casesOn x fun a a_1 =>\n PSigma.casesOn a_1 fun a_2 a_3 =>\n PSigma.casesOn a_3 fun a_4 a_5 => PSigma.casesOn a_5 fun a_6 a_7 => PSigma.casesOn a_7 fun a_8 a_9 => a)\n instWellFoundedRelationOfSizeOf).1\n ⟨r' % k.succ, ⟨s' - ↑q * s, ... | [
" (invImage\n (fun x =>\n PSigma.casesOn x fun a a_1 =>\n PSigma.casesOn a_1 fun a_2 a_3 =>\n PSigma.casesOn a_3 fun a_4 a_5 => PSigma.casesOn a_5 fun a_6 a_7 => PSigma.casesOn a_7 fun a_8 a_9 => a)\n instWellFoundedRelationOfSizeOf).1\n ⟨r' % k.succ, ⟨s' - ↑q * s, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.