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 |
|---|---|---|---|---|---|
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section EDist
variable [EDist α] {x y : α} {s t : Set α}
theorem le_einfsep_iff {d} :
d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by
simp_rw [einfsep, le_iInf_iff]
#align set.le_einfsep_iff Set.le_einfsep_iff
theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by
simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop]
#align set.einfsep_zero Set.einfsep_zero
| Mathlib/Topology/MetricSpace/Infsep.lean | 59 | 61 | theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by |
rw [pos_iff_ne_zero, Ne, einfsep_zero]
simp only [not_forall, not_exists, not_lt, exists_prop, not_and]
|
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Range
#align_import data.list.nat_antidiagonal from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open List Function Nat
namespace List
namespace Nat
def antidiagonal (n : ℕ) : List (ℕ × ℕ) :=
(range (n + 1)).map fun i ↦ (i, n - i)
#align list.nat.antidiagonal List.Nat.antidiagonal
@[simp]
theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by
rw [antidiagonal, mem_map]; constructor
· rintro ⟨i, hi, rfl⟩
rw [mem_range, Nat.lt_succ_iff] at hi
exact Nat.add_sub_cancel' hi
· rintro rfl
refine ⟨x.fst, ?_, ?_⟩
· rw [mem_range]
omega
· exact Prod.ext rfl (by simp only [Nat.add_sub_cancel_left])
#align list.nat.mem_antidiagonal List.Nat.mem_antidiagonal
@[simp]
theorem length_antidiagonal (n : ℕ) : (antidiagonal n).length = n + 1 := by
rw [antidiagonal, length_map, length_range]
#align list.nat.length_antidiagonal List.Nat.length_antidiagonal
@[simp]
theorem antidiagonal_zero : antidiagonal 0 = [(0, 0)] :=
rfl
#align list.nat.antidiagonal_zero List.Nat.antidiagonal_zero
theorem nodup_antidiagonal (n : ℕ) : Nodup (antidiagonal n) :=
(nodup_range _).map ((@LeftInverse.injective ℕ (ℕ × ℕ) Prod.fst fun i ↦ (i, n - i)) fun _ ↦ rfl)
#align list.nat.nodup_antidiagonal List.Nat.nodup_antidiagonal
@[simp]
theorem antidiagonal_succ {n : ℕ} :
antidiagonal (n + 1) = (0, n + 1) :: (antidiagonal n).map (Prod.map Nat.succ id) := by
simp only [antidiagonal, range_succ_eq_map, map_cons, true_and_iff, Nat.add_succ_sub_one,
Nat.add_zero, id, eq_self_iff_true, Nat.sub_zero, map_map, Prod.map_mk]
apply congr rfl (congr rfl _)
ext; simp
#align list.nat.antidiagonal_succ List.Nat.antidiagonal_succ
| Mathlib/Data/List/NatAntidiagonal.lean | 76 | 82 | theorem antidiagonal_succ' {n : ℕ} :
antidiagonal (n + 1) = (antidiagonal n).map (Prod.map id Nat.succ) ++ [(n + 1, 0)] := by |
simp only [antidiagonal, range_succ, Nat.add_sub_cancel_left, map_append, append_assoc,
Nat.sub_self, singleton_append, map_map, map]
congr 1
apply map_congr
simp (config := { contextual := true }) [le_of_lt, Nat.succ_eq_add_one, Nat.sub_add_comm]
|
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
| Mathlib/Topology/MetricSpace/ThickenedIndicator.lean | 84 | 86 | 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]
|
import Mathlib.Geometry.Manifold.ContMDiff.Basic
open Set Function Filter ChartedSpace SmoothManifoldWithCorners
open scoped Topology Manifold
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a manifold `M''` over the pair `(E'', H'')`.
{E'' : Type*}
[NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
-- declare a smooth manifold `N` over the pair `(F, G)`.
{F : Type*}
[NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*} [TopologicalSpace G]
{J : ModelWithCorners 𝕜 F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
[SmoothManifoldWithCorners J N]
-- declare a smooth manifold `N'` over the pair `(F', G')`.
{F' : Type*}
[NormedAddCommGroup F'] [NormedSpace 𝕜 F'] {G' : Type*} [TopologicalSpace G']
{J' : ModelWithCorners 𝕜 F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
[SmoothManifoldWithCorners J' N']
-- F₁, F₂, F₃, F₄ are normed spaces
{F₁ : Type*}
[NormedAddCommGroup F₁] [NormedSpace 𝕜 F₁] {F₂ : Type*} [NormedAddCommGroup F₂]
[NormedSpace 𝕜 F₂] {F₃ : Type*} [NormedAddCommGroup F₃] [NormedSpace 𝕜 F₃] {F₄ : Type*}
[NormedAddCommGroup F₄] [NormedSpace 𝕜 F₄]
-- declare functions, sets, points and smoothness indices
{e : PartialHomeomorph M H}
{e' : PartialHomeomorph M' H'} {f f₁ : M → M'} {s s₁ t : Set M} {x : M} {m n : ℕ∞}
variable {I I'}
section Projections
| Mathlib/Geometry/Manifold/ContMDiff/Product.lean | 149 | 162 | theorem contMDiffWithinAt_fst {s : Set (M × N)} {p : M × N} :
ContMDiffWithinAt (I.prod J) I n Prod.fst s p := by |
/- porting note: `simp` fails to apply lemmas to `ModelProd`. Was
rw [contMDiffWithinAt_iff']
refine' ⟨continuousWithinAt_fst, _⟩
refine' contDiffWithinAt_fst.congr (fun y hy => _) _
· simp only [mfld_simps] at hy
simp only [hy, mfld_simps]
· simp only [mfld_simps]
-/
rw [contMDiffWithinAt_iff']
refine ⟨continuousWithinAt_fst, contDiffWithinAt_fst.congr (fun y hy => ?_) ?_⟩
· exact (extChartAt I p.1).right_inv ⟨hy.1.1.1, hy.1.2.1⟩
· exact (extChartAt I p.1).right_inv <| (extChartAt I p.1).map_source (mem_extChartAt_source _ _)
|
import Mathlib.RingTheory.AdicCompletion.Basic
import Mathlib.Algebra.Module.Torsion
open Submodule
variable {R : Type*} [CommRing R] (I : Ideal R)
variable {M : Type*} [AddCommGroup M] [Module R M]
namespace AdicCompletion
attribute [-simp] smul_eq_mul Algebra.id.smul_eq_mul
@[local simp]
theorem transitionMap_ideal_mk {m n : ℕ} (hmn : m ≤ n) (x : R) :
transitionMap I R hmn (Ideal.Quotient.mk (I ^ n • ⊤ : Ideal R) x) =
Ideal.Quotient.mk (I ^ m • ⊤ : Ideal R) x :=
rfl
@[local simp]
theorem transitionMap_map_one {m n : ℕ} (hmn : m ≤ n) : transitionMap I R hmn 1 = 1 :=
rfl
@[local simp]
theorem transitionMap_map_mul {m n : ℕ} (hmn : m ≤ n) (x y : R ⧸ (I ^ n • ⊤ : Ideal R)) :
transitionMap I R hmn (x * y) = transitionMap I R hmn x * transitionMap I R hmn y :=
Quotient.inductionOn₂' x y (fun _ _ ↦ rfl)
def transitionMapₐ {m n : ℕ} (hmn : m ≤ n) :
R ⧸ (I ^ n • ⊤ : Ideal R) →ₐ[R] R ⧸ (I ^ m • ⊤ : Ideal R) :=
AlgHom.ofLinearMap (transitionMap I R hmn) rfl (transitionMap_map_mul I hmn)
def subalgebra : Subalgebra R (∀ n, R ⧸ (I ^ n • ⊤ : Ideal R)) :=
Submodule.toSubalgebra (submodule I R) (fun _ ↦ by simp)
(fun x y hx hy m n hmn ↦ by simp [hx hmn, hy hmn])
def subring : Subring (∀ n, R ⧸ (I ^ n • ⊤ : Ideal R)) :=
Subalgebra.toSubring (subalgebra I)
instance : CommRing (AdicCompletion I R) :=
inferInstanceAs <| CommRing (subring I)
instance : Algebra R (AdicCompletion I R) :=
inferInstanceAs <| Algebra R (subalgebra I)
@[simp]
theorem val_one (n : ℕ) : (1 : AdicCompletion I R).val n = 1 :=
rfl
@[simp]
theorem val_mul (n : ℕ) (x y : AdicCompletion I R) : (x * y).val n = x.val n * y.val n :=
rfl
def evalₐ (n : ℕ) : AdicCompletion I R →ₐ[R] R ⧸ I ^ n :=
have h : (I ^ n • ⊤ : Ideal R) = I ^ n := by ext x; simp
AlgHom.comp
(Ideal.quotientEquivAlgOfEq R h)
(AlgHom.ofLinearMap (eval I R n) rfl (fun _ _ ↦ rfl))
@[simp]
| Mathlib/RingTheory/AdicCompletion/Algebra.lean | 87 | 89 | theorem evalₐ_mk (n : ℕ) (x : AdicCauchySequence I R) :
evalₐ I n (mk I R x) = Ideal.Quotient.mk (I ^ n) (x.val n) := by |
simp [evalₐ]
|
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Nat.Choose.Vandermonde
import Mathlib.Tactic.FieldSimp
#align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
noncomputable section
namespace Polynomial
open Nat Polynomial
open Function
variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X])
def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] :=
lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k)
#align polynomial.hasse_deriv Polynomial.hasseDeriv
theorem hasseDeriv_apply :
hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by
dsimp [hasseDeriv]
congr; ext; congr
apply nsmul_eq_mul
#align polynomial.hasse_deriv_apply Polynomial.hasseDeriv_apply
| Mathlib/Algebra/Polynomial/HasseDeriv.lean | 67 | 80 | theorem hasseDeriv_coeff (n : ℕ) :
(hasseDeriv k f).coeff n = (n + k).choose k * f.coeff (n + k) := by |
rw [hasseDeriv_apply, coeff_sum, sum_def, Finset.sum_eq_single (n + k), coeff_monomial]
· simp only [if_true, add_tsub_cancel_right, eq_self_iff_true]
· intro i _hi hink
rw [coeff_monomial]
by_cases hik : i < k
· simp only [Nat.choose_eq_zero_of_lt hik, ite_self, Nat.cast_zero, zero_mul]
· push_neg at hik
rw [if_neg]
contrapose! hink
exact (tsub_eq_iff_eq_add_of_le hik).mp hink
· intro h
simp only [not_mem_support_iff.mp h, monomial_zero_right, mul_zero, coeff_zero]
|
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Degree.Lemmas
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 Trunc
variable [Semiring R]
open Finset Nat
def trunc (n : ℕ) (φ : R⟦X⟧) : R[X] :=
∑ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m φ)
#align power_series.trunc PowerSeries.trunc
theorem coeff_trunc (m) (n) (φ : R⟦X⟧) :
(trunc n φ).coeff m = if m < n then coeff R m φ else 0 := by
simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff]
#align power_series.coeff_trunc PowerSeries.coeff_trunc
@[simp]
theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 :=
Polynomial.ext fun m => by
rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero]
split_ifs <;> rfl
#align power_series.trunc_zero PowerSeries.trunc_zero
@[simp]
theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_one, Polynomial.coeff_one]
split_ifs with h _ h'
· rfl
· rfl
· subst h'; simp at h
· rfl
#align power_series.trunc_one PowerSeries.trunc_one
@[simp]
theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_C, Polynomial.coeff_C]
split_ifs with H <;> first |rfl|try simp_all
set_option linter.uppercaseLean3 false in
#align power_series.trunc_C PowerSeries.trunc_C
@[simp]
theorem trunc_add (n) (φ ψ : R⟦X⟧) : trunc n (φ + ψ) = trunc n φ + trunc n ψ :=
Polynomial.ext fun m => by
simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add]
split_ifs with H
· rfl
· rw [zero_add]
#align power_series.trunc_add PowerSeries.trunc_add
theorem trunc_succ (f : R⟦X⟧) (n : ℕ) :
trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by
rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range]
| Mathlib/RingTheory/PowerSeries/Trunc.lean | 88 | 95 | theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by |
rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero]
intros
rw [coeff_trunc]
split_ifs with h
· rw [lt_succ, ← not_lt] at h
contradiction
· rfl
|
import Mathlib.RingTheory.AdjoinRoot
import Mathlib.FieldTheory.Minpoly.Field
import Mathlib.RingTheory.Polynomial.GaussLemma
#align_import field_theory.minpoly.is_integrally_closed from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Classical Polynomial
open Polynomial Set Function minpoly
namespace minpoly
variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain R] [Algebra R S]
section
variable (K L : Type*) [Field K] [Algebra R K] [IsFractionRing R K] [CommRing L] [Nontrivial L]
[Algebra R L] [Algebra S L] [Algebra K L] [IsScalarTower R K L] [IsScalarTower R S L]
variable [IsIntegrallyClosed R]
theorem isIntegrallyClosed_eq_field_fractions [IsDomain S] {s : S} (hs : IsIntegral R s) :
minpoly K (algebraMap S L s) = (minpoly R s).map (algebraMap R K) := by
refine (eq_of_irreducible_of_monic ?_ ?_ ?_).symm
· exact ((monic hs).irreducible_iff_irreducible_map_fraction_map).1 (irreducible hs)
· rw [aeval_map_algebraMap, aeval_algebraMap_apply, aeval, map_zero]
· exact (monic hs).map _
#align minpoly.is_integrally_closed_eq_field_fractions minpoly.isIntegrallyClosed_eq_field_fractions
theorem isIntegrallyClosed_eq_field_fractions' [IsDomain S] [Algebra K S] [IsScalarTower R K S]
{s : S} (hs : IsIntegral R s) : minpoly K s = (minpoly R s).map (algebraMap R K) := by
let L := FractionRing S
rw [← isIntegrallyClosed_eq_field_fractions K L hs, algebraMap_eq (IsFractionRing.injective S L)]
#align minpoly.is_integrally_closed_eq_field_fractions' minpoly.isIntegrallyClosed_eq_field_fractions'
end
variable [IsDomain S] [NoZeroSMulDivisors R S]
variable [IsIntegrallyClosed R]
theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]}
(hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by
let K := FractionRing R
let L := FractionRing S
let _ : Algebra K L := FractionRing.liftAlgebra R L
have := FractionRing.isScalarTower_liftAlgebra R L
have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by
rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div]
· refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_
· rw [← map_aeval_eq_aeval_map, hp, map_zero]
rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
apply dvd_mul_of_dvd_left
rw [isIntegrallyClosed_eq_field_fractions K L hs]
exact Monic.map _ (minpoly.monic hs)
rw [isIntegrallyClosed_eq_field_fractions _ _ hs,
map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this
rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)]
exact Polynomial.eq_zero_of_dvd_of_degree_lt this (degree_modByMonic_lt p <| minpoly.monic hs)
#align minpoly.is_integrally_closed_dvd minpoly.isIntegrallyClosed_dvd
theorem isIntegrallyClosed_dvd_iff {s : S} (hs : IsIntegral R s) (p : R[X]) :
Polynomial.aeval s p = 0 ↔ minpoly R s ∣ p :=
⟨fun hp => isIntegrallyClosed_dvd hs hp, fun hp => by
simpa only [RingHom.mem_ker, RingHom.coe_comp, coe_evalRingHom, coe_mapRingHom,
Function.comp_apply, eval_map, ← aeval_def] using
aeval_eq_zero_of_dvd_aeval_eq_zero hp (minpoly.aeval R s)⟩
#align minpoly.is_integrally_closed_dvd_iff minpoly.isIntegrallyClosed_dvd_iff
| Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean | 103 | 108 | theorem ker_eval {s : S} (hs : IsIntegral R s) :
RingHom.ker ((Polynomial.aeval s).toRingHom : R[X] →+* S) =
Ideal.span ({minpoly R s} : Set R[X]) := by |
ext p
simp_rw [RingHom.mem_ker, AlgHom.toRingHom_eq_coe, AlgHom.coe_toRingHom,
isIntegrallyClosed_dvd_iff hs, ← Ideal.mem_span_singleton]
|
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Hom.Lattice
#align_import order.hom.complete_lattice from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function OrderDual Set
variable {F α β γ δ : Type*} {ι : Sort*} {κ : ι → Sort*}
-- Porting note: mathport made this & sInfHom into "SupHomCat" and "InfHomCat".
structure sSupHom (α β : Type*) [SupSet α] [SupSet β] where
toFun : α → β
map_sSup' (s : Set α) : toFun (sSup s) = sSup (toFun '' s)
#align Sup_hom sSupHom
structure sInfHom (α β : Type*) [InfSet α] [InfSet β] where
toFun : α → β
map_sInf' (s : Set α) : toFun (sInf s) = sInf (toFun '' s)
#align Inf_hom sInfHom
structure FrameHom (α β : Type*) [CompleteLattice α] [CompleteLattice β] extends
InfTopHom α β where
map_sSup' (s : Set α) : toFun (sSup s) = sSup (toFun '' s)
#align frame_hom FrameHom
structure CompleteLatticeHom (α β : Type*) [CompleteLattice α] [CompleteLattice β] extends
sInfHom α β where
map_sSup' (s : Set α) : toFun (sSup s) = sSup (toFun '' s)
#align complete_lattice_hom CompleteLatticeHom
section
-- Porting note: mathport made this & InfHomClass into "SupHomClassCat" and "InfHomClassCat".
class sSupHomClass (F α β : Type*) [SupSet α] [SupSet β] [FunLike F α β] : Prop where
map_sSup (f : F) (s : Set α) : f (sSup s) = sSup (f '' s)
#align Sup_hom_class sSupHomClass
class sInfHomClass (F α β : Type*) [InfSet α] [InfSet β] [FunLike F α β] : Prop where
map_sInf (f : F) (s : Set α) : f (sInf s) = sInf (f '' s)
#align Inf_hom_class sInfHomClass
class FrameHomClass (F α β : Type*) [CompleteLattice α] [CompleteLattice β] [FunLike F α β]
extends InfTopHomClass F α β : Prop where
map_sSup (f : F) (s : Set α) : f (sSup s) = sSup (f '' s)
#align frame_hom_class FrameHomClass
class CompleteLatticeHomClass (F α β : Type*) [CompleteLattice α] [CompleteLattice β]
[FunLike F α β] extends sInfHomClass F α β : Prop where
map_sSup (f : F) (s : Set α) : f (sSup s) = sSup (f '' s)
#align complete_lattice_hom_class CompleteLatticeHomClass
end
export sSupHomClass (map_sSup)
export sInfHomClass (map_sInf)
attribute [simp] map_sSup map_sInf
section Hom
variable [FunLike F α β]
@[simp] theorem map_iSup [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ι → α) :
f (⨆ i, g i) = ⨆ i, f (g i) := by simp [iSup, ← Set.range_comp, Function.comp]
#align map_supr map_iSup
| Mathlib/Order/Hom/CompleteLattice.lean | 134 | 135 | theorem map_iSup₂ [SupSet α] [SupSet β] [sSupHomClass F α β] (f : F) (g : ∀ i, κ i → α) :
f (⨆ (i) (j), g i j) = ⨆ (i) (j), f (g i j) := by | simp_rw [map_iSup]
|
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Filter Asymptotics Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv iteratedDeriv
def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F :=
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv_within iteratedDerivWithin
variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜}
theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by
ext x
rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ]
#align iterated_deriv_within_univ iteratedDerivWithin_univ
theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x =
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
#align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} :
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m =
(∏ i, m i) • iteratedDerivWithin n f s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ]
simp
#align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin :
‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
#align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin
@[simp]
theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by
ext x
simp [iteratedDerivWithin]
#align iterated_deriv_within_zero iteratedDerivWithin_zero
@[simp]
theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) :
iteratedDerivWithin 1 f s x = derivWithin f s x := by
simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl
#align iterated_deriv_within_one iteratedDerivWithin_one
theorem contDiffOn_of_continuousOn_differentiableOn_deriv {n : ℕ∞}
(Hcont : ∀ m : ℕ, (m : ℕ∞) ≤ n → ContinuousOn (fun x => iteratedDerivWithin m f s x) s)
(Hdiff : ∀ m : ℕ, (m : ℕ∞) < n → DifferentiableOn 𝕜 (fun x => iteratedDerivWithin m f s x) s) :
ContDiffOn 𝕜 n f s := by
apply contDiffOn_of_continuousOn_differentiableOn
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_continuousOn_iff]
· simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
#align cont_diff_on_of_continuous_on_differentiable_on_deriv contDiffOn_of_continuousOn_differentiableOn_deriv
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 142 | 146 | theorem contDiffOn_of_differentiableOn_deriv {n : ℕ∞}
(h : ∀ m : ℕ, (m : ℕ∞) ≤ n → DifferentiableOn 𝕜 (iteratedDerivWithin m f s) s) :
ContDiffOn 𝕜 n f s := by |
apply contDiffOn_of_differentiableOn
simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
|
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SimpleGraph.AdjMatrix
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.simple_graph.strongly_regular from "leanprover-community/mathlib"@"2b35fc7bea4640cb75e477e83f32fbd538920822"
open Finset
universe u
namespace SimpleGraph
variable {V : Type u} [Fintype V] [DecidableEq V]
variable (G : SimpleGraph V) [DecidableRel G.Adj]
structure IsSRGWith (n k ℓ μ : ℕ) : Prop where
card : Fintype.card V = n
regular : G.IsRegularOfDegree k
of_adj : ∀ v w : V, G.Adj v w → Fintype.card (G.commonNeighbors v w) = ℓ
of_not_adj : Pairwise fun v w => ¬G.Adj v w → Fintype.card (G.commonNeighbors v w) = μ
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with SimpleGraph.IsSRGWith
variable {G} {n k ℓ μ : ℕ}
theorem bot_strongly_regular : (⊥ : SimpleGraph V).IsSRGWith (Fintype.card V) 0 ℓ 0 where
card := rfl
regular := bot_degree
of_adj := fun v w h => h.elim
of_not_adj := fun v w _h => by
simp only [card_eq_zero, Fintype.card_ofFinset, forall_true_left, not_false_iff, bot_adj]
ext
simp [mem_commonNeighbors]
#align simple_graph.bot_strongly_regular SimpleGraph.bot_strongly_regular
theorem IsSRGWith.top :
(⊤ : SimpleGraph V).IsSRGWith (Fintype.card V) (Fintype.card V - 1) (Fintype.card V - 2) μ where
card := rfl
regular := IsRegularOfDegree.top
of_adj := fun v w h => by
rw [card_commonNeighbors_top]
exact h
of_not_adj := fun v w h h' => False.elim (h' ((top_adj v w).2 h))
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.top SimpleGraph.IsSRGWith.top
| Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean | 84 | 95 | theorem IsSRGWith.card_neighborFinset_union_eq {v w : V} (h : G.IsSRGWith n k ℓ μ) :
(G.neighborFinset v ∪ G.neighborFinset w).card =
2 * k - Fintype.card (G.commonNeighbors v w) := by |
apply Nat.add_right_cancel (m := Fintype.card (G.commonNeighbors v w))
rw [Nat.sub_add_cancel, ← Set.toFinset_card]
-- Porting note: Set.toFinset_inter needs workaround to use unification to solve for one of the
-- instance arguments:
· simp [commonNeighbors, @Set.toFinset_inter _ _ _ _ _ _ (_),
← neighborFinset_def, Finset.card_union_add_card_inter, card_neighborFinset_eq_degree,
h.regular.degree_eq, two_mul]
· apply le_trans (card_commonNeighbors_le_degree_left _ _ _)
simp [h.regular.degree_eq, two_mul]
|
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f"
namespace PowerSeries
section Field
variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A']
open Nat
def exp : PowerSeries A :=
mk fun n => algebraMap ℚ A (1 / n !)
#align power_series.exp PowerSeries.exp
def sin : PowerSeries A :=
mk fun n => if Even n then 0 else algebraMap ℚ A ((-1) ^ (n / 2) / n !)
#align power_series.sin PowerSeries.sin
def cos : PowerSeries A :=
mk fun n => if Even n then algebraMap ℚ A ((-1) ^ (n / 2) / n !) else 0
#align power_series.cos PowerSeries.cos
variable {A A'} [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A'] (n : ℕ) (f : A →+* A')
@[simp]
theorem coeff_exp : coeff A n (exp A) = algebraMap ℚ A (1 / n !) :=
coeff_mk _ _
#align power_series.coeff_exp PowerSeries.coeff_exp
@[simp]
theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp]
simp
#align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp
set_option linter.deprecated false in
@[simp]
theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by
rw [sin, coeff_mk, if_pos (even_bit0 n)]
#align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0
set_option linter.deprecated false in
@[simp]
| Mathlib/RingTheory/PowerSeries/WellKnown.lean | 187 | 189 | theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by |
rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow,
map_neg, map_one, coeff_exp]
|
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
#align order_iso.image_Iio OrderIso.image_Iio
@[simp]
theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) :=
e.dual.image_Iio a
#align order_iso.image_Ioi OrderIso.image_Ioi
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 88 | 89 | theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by |
rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm]
|
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
#align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
set_option linter.uppercaseLean3 false
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set
open Real
namespace Asymptotics
variable {α : Type*} {r c : ℝ} {l : Filter α} {f g : α → ℝ}
| Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean | 259 | 266 | theorem IsBigOWith.rpow (h : IsBigOWith c l f g) (hc : 0 ≤ c) (hr : 0 ≤ r) (hg : 0 ≤ᶠ[l] g) :
IsBigOWith (c ^ r) l (fun x => f x ^ r) fun x => g x ^ r := by |
apply IsBigOWith.of_bound
filter_upwards [hg, h.bound] with x hgx hx
calc
|f x ^ r| ≤ |f x| ^ r := abs_rpow_le_abs_rpow _ _
_ ≤ (c * |g x|) ^ r := rpow_le_rpow (abs_nonneg _) hx hr
_ = c ^ r * |g x ^ r| := by rw [mul_rpow hc (abs_nonneg _), abs_rpow_of_nonneg hgx]
|
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.NormedSpace.Dual
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.ae_eq_of_integral from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open MeasureTheory TopologicalSpace NormedSpace Filter
open scoped ENNReal NNReal MeasureTheory Topology
namespace MeasureTheory
section AeEqOfForall
variable {α E 𝕜 : Type*} {m : MeasurableSpace α} {μ : Measure α} [RCLike 𝕜]
theorem ae_eq_zero_of_forall_inner [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
[SecondCountableTopology E] {f : α → E} (hf : ∀ c : E, (fun x => (inner c (f x) : 𝕜)) =ᵐ[μ] 0) :
f =ᵐ[μ] 0 := by
let s := denseSeq E
have hs : DenseRange s := denseRange_denseSeq E
have hf' : ∀ᵐ x ∂μ, ∀ n : ℕ, inner (s n) (f x) = (0 : 𝕜) := ae_all_iff.mpr fun n => hf (s n)
refine hf'.mono fun x hx => ?_
rw [Pi.zero_apply, ← @inner_self_eq_zero 𝕜]
have h_closed : IsClosed {c : E | inner c (f x) = (0 : 𝕜)} :=
isClosed_eq (continuous_id.inner continuous_const) continuous_const
exact @isClosed_property ℕ E _ s (fun c => inner c (f x) = (0 : 𝕜)) hs h_closed (fun n => hx n) _
#align measure_theory.ae_eq_zero_of_forall_inner MeasureTheory.ae_eq_zero_of_forall_inner
local notation "⟪" x ", " y "⟫" => y x
variable (𝕜)
| Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean | 74 | 106 | theorem ae_eq_zero_of_forall_dual_of_isSeparable [NormedAddCommGroup E] [NormedSpace 𝕜 E]
{t : Set E} (ht : TopologicalSpace.IsSeparable t) {f : α → E}
(hf : ∀ c : Dual 𝕜 E, (fun x => ⟪f x, c⟫) =ᵐ[μ] 0) (h't : ∀ᵐ x ∂μ, f x ∈ t) : f =ᵐ[μ] 0 := by |
rcases ht with ⟨d, d_count, hd⟩
haveI : Encodable d := d_count.toEncodable
have : ∀ x : d, ∃ g : E →L[𝕜] 𝕜, ‖g‖ ≤ 1 ∧ g x = ‖(x : E)‖ :=
fun x => exists_dual_vector'' 𝕜 (x : E)
choose s hs using this
have A : ∀ a : E, a ∈ t → (∀ x, ⟪a, s x⟫ = (0 : 𝕜)) → a = 0 := by
intro a hat ha
contrapose! ha
have a_pos : 0 < ‖a‖ := by simp only [ha, norm_pos_iff, Ne, not_false_iff]
have a_mem : a ∈ closure d := hd hat
obtain ⟨x, hx⟩ : ∃ x : d, dist a x < ‖a‖ / 2 := by
rcases Metric.mem_closure_iff.1 a_mem (‖a‖ / 2) (half_pos a_pos) with ⟨x, h'x, hx⟩
exact ⟨⟨x, h'x⟩, hx⟩
use x
have I : ‖a‖ / 2 < ‖(x : E)‖ := by
have : ‖a‖ ≤ ‖(x : E)‖ + ‖a - x‖ := norm_le_insert' _ _
have : ‖a - x‖ < ‖a‖ / 2 := by rwa [dist_eq_norm] at hx
linarith
intro h
apply lt_irrefl ‖s x x‖
calc
‖s x x‖ = ‖s x (x - a)‖ := by simp only [h, sub_zero, ContinuousLinearMap.map_sub]
_ ≤ 1 * ‖(x : E) - a‖ := ContinuousLinearMap.le_of_opNorm_le _ (hs x).1 _
_ < ‖a‖ / 2 := by rw [one_mul]; rwa [dist_eq_norm'] at hx
_ < ‖(x : E)‖ := I
_ = ‖s x x‖ := by rw [(hs x).2, RCLike.norm_coe_norm]
have hfs : ∀ y : d, ∀ᵐ x ∂μ, ⟪f x, s y⟫ = (0 : 𝕜) := fun y => hf (s y)
have hf' : ∀ᵐ x ∂μ, ∀ y : d, ⟪f x, s y⟫ = (0 : 𝕜) := by rwa [ae_all_iff]
filter_upwards [hf', h't] with x hx h'x
exact A (f x) h'x hx
|
import Mathlib.Algebra.MonoidAlgebra.Division
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Order.Interval.Finset.Nat
#align_import data.polynomial.inductions from "leanprover-community/mathlib"@"57e09a1296bfb4330ddf6624f1028ba186117d82"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {a b : R} {n : ℕ}
section Semiring
variable [Semiring R] {p q : R[X]}
def divX (p : R[X]) : R[X] :=
⟨AddMonoidAlgebra.divOf p.toFinsupp 1⟩
set_option linter.uppercaseLean3 false in
#align polynomial.div_X Polynomial.divX
@[simp]
theorem coeff_divX : (divX p).coeff n = p.coeff (n + 1) := by
rw [add_comm]; cases p; rfl
set_option linter.uppercaseLean3 false in
#align polynomial.coeff_div_X Polynomial.coeff_divX
theorem divX_mul_X_add (p : R[X]) : divX p * X + C (p.coeff 0) = p :=
ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X]
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_mul_X_add Polynomial.divX_mul_X_add
@[simp]
theorem X_mul_divX_add (p : R[X]) : X * divX p + C (p.coeff 0) = p :=
ext <| by rintro ⟨_ | _⟩ <;> simp [coeff_C, Nat.succ_ne_zero, coeff_mul_X]
@[simp]
theorem divX_C (a : R) : divX (C a) = 0 :=
ext fun n => by simp [coeff_divX, coeff_C, Finsupp.single_eq_of_ne _]
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_C Polynomial.divX_C
theorem divX_eq_zero_iff : divX p = 0 ↔ p = C (p.coeff 0) :=
⟨fun h => by simpa [eq_comm, h] using divX_mul_X_add p, fun h => by rw [h, divX_C]⟩
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_eq_zero_iff Polynomial.divX_eq_zero_iff
theorem divX_add : divX (p + q) = divX p + divX q :=
ext <| by simp
set_option linter.uppercaseLean3 false in
#align polynomial.div_X_add Polynomial.divX_add
@[simp]
theorem divX_zero : divX (0 : R[X]) = 0 := leadingCoeff_eq_zero.mp rfl
@[simp]
theorem divX_one : divX (1 : R[X]) = 0 := by
ext
simpa only [coeff_divX, coeff_zero] using coeff_one
@[simp]
theorem divX_C_mul : divX (C a * p) = C a * divX p := by
ext
simp
theorem divX_X_pow : divX (X ^ n : R[X]) = if (n = 0) then 0 else X ^ (n - 1) := by
cases n
· simp
· ext n
simp [coeff_X_pow]
noncomputable
def divX_hom : R[X] →+ R[X] :=
{ toFun := divX
map_zero' := divX_zero
map_add' := fun _ _ => divX_add }
@[simp] theorem divX_hom_toFun : divX_hom p = divX p := rfl
theorem natDegree_divX_eq_natDegree_tsub_one : p.divX.natDegree = p.natDegree - 1 := by
apply map_natDegree_eq_sub (φ := divX_hom)
· intro f
simpa [divX_hom, divX_eq_zero_iff] using eq_C_of_natDegree_eq_zero
· intros n c c0
rw [← C_mul_X_pow_eq_monomial, divX_hom_toFun, divX_C_mul, divX_X_pow]
split_ifs with n0
· simp [n0]
· exact natDegree_C_mul_X_pow (n - 1) c c0
theorem natDegree_divX_le : p.divX.natDegree ≤ p.natDegree :=
natDegree_divX_eq_natDegree_tsub_one.trans_le (Nat.pred_le _)
| Mathlib/Algebra/Polynomial/Inductions.lean | 116 | 117 | theorem divX_C_mul_X_pow : divX (C a * X ^ n) = if n = 0 then 0 else C a * X ^ (n - 1) := by |
simp only [divX_C_mul, divX_X_pow, mul_ite, mul_zero]
|
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section ENNReal
variable (μ) {f g : α → ℝ≥0∞}
noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.laverage MeasureTheory.laverage
notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r
notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r
notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r
notation3 (prettyPrint := false)
"⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r
@[simp]
theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero]
#align measure_theory.laverage_zero MeasureTheory.laverage_zero
@[simp]
theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage]
#align measure_theory.laverage_zero_measure MeasureTheory.laverage_zero_measure
theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl
#align measure_theory.laverage_eq' MeasureTheory.laverage_eq'
| Mathlib/MeasureTheory/Integral/Average.lean | 118 | 119 | theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by |
rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul]
|
import Mathlib.NumberTheory.ModularForms.JacobiTheta.TwoVariable
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic
#align_import number_theory.modular_forms.jacobi_theta.basic from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf"
open Complex Real Asymptotics Filter Topology
open scoped Real UpperHalfPlane
noncomputable def jacobiTheta (τ : ℂ) : ℂ := ∑' n : ℤ, cexp (π * I * (n : ℂ) ^ 2 * τ)
#align jacobi_theta jacobiTheta
lemma jacobiTheta_eq_jacobiTheta₂ (τ : ℂ) : jacobiTheta τ = jacobiTheta₂ 0 τ :=
tsum_congr (by simp [jacobiTheta₂_term])
theorem jacobiTheta_two_add (τ : ℂ) : jacobiTheta (2 + τ) = jacobiTheta τ := by
simp_rw [jacobiTheta_eq_jacobiTheta₂, add_comm, jacobiTheta₂_add_right]
#align jacobi_theta_two_add jacobiTheta_two_add
theorem jacobiTheta_T_sq_smul (τ : ℍ) : jacobiTheta (ModularGroup.T ^ 2 • τ :) = jacobiTheta τ := by
suffices (ModularGroup.T ^ 2 • τ :) = (2 : ℂ) + ↑τ by simp_rw [this, jacobiTheta_two_add]
have : ModularGroup.T ^ (2 : ℕ) = ModularGroup.T ^ (2 : ℤ) := rfl
simp_rw [this, UpperHalfPlane.modular_T_zpow_smul, UpperHalfPlane.coe_vadd]
norm_cast
set_option linter.uppercaseLean3 false in
#align jacobi_theta_T_sq_smul jacobiTheta_T_sq_smul
| Mathlib/NumberTheory/ModularForms/JacobiTheta/OneVariable.lean | 45 | 54 | theorem jacobiTheta_S_smul (τ : ℍ) :
jacobiTheta ↑(ModularGroup.S • τ) = (-I * τ) ^ (1 / 2 : ℂ) * jacobiTheta τ := by |
have h0 : (τ : ℂ) ≠ 0 := ne_of_apply_ne im (zero_im.symm ▸ ne_of_gt τ.2)
have h1 : (-I * τ) ^ (1 / 2 : ℂ) ≠ 0 := by
rw [Ne, cpow_eq_zero_iff, not_and_or]
exact Or.inl <| mul_ne_zero (neg_ne_zero.mpr I_ne_zero) h0
simp_rw [UpperHalfPlane.modular_S_smul, jacobiTheta_eq_jacobiTheta₂]
conv_rhs => erw [← ofReal_zero, jacobiTheta₂_functional_equation 0 τ]
rw [zero_pow two_ne_zero, mul_zero, zero_div, Complex.exp_zero, mul_one, ← mul_assoc, mul_one_div,
div_self h1, one_mul, UpperHalfPlane.coe_mk, inv_neg, neg_div, one_div]
|
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Tactic.FinCases
#align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Affine
namespace Finset
variable (k : Type*) {V : Type*} {P : Type*} [DivisionRing k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P] {ι : Type*} (s : Finset ι) {ι₂ : Type*} (s₂ : Finset ι₂)
def centroidWeights : ι → k :=
Function.const ι (card s : k)⁻¹
#align finset.centroid_weights Finset.centroidWeights
@[simp]
theorem centroidWeights_apply (i : ι) : s.centroidWeights k i = (card s : k)⁻¹ :=
rfl
#align finset.centroid_weights_apply Finset.centroidWeights_apply
theorem centroidWeights_eq_const : s.centroidWeights k = Function.const ι (card s : k)⁻¹ :=
rfl
#align finset.centroid_weights_eq_const Finset.centroidWeights_eq_const
variable {k}
| Mathlib/LinearAlgebra/AffineSpace/Combination.lean | 796 | 797 | theorem sum_centroidWeights_eq_one_of_cast_card_ne_zero (h : (card s : k) ≠ 0) :
∑ i ∈ s, s.centroidWeights k i = 1 := by | simp [h]
|
import Mathlib.RingTheory.Ideal.Maps
#align_import ring_theory.ideal.prod from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
variable {R : Type u} {S : Type v} [Semiring R] [Semiring S] (I I' : Ideal R) (J J' : Ideal S)
namespace Ideal
def prod : Ideal (R × S) where
carrier := { x | x.fst ∈ I ∧ x.snd ∈ J }
zero_mem' := by simp
add_mem' := by
rintro ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ ⟨ha₁, ha₂⟩ ⟨hb₁, hb₂⟩
exact ⟨I.add_mem ha₁ hb₁, J.add_mem ha₂ hb₂⟩
smul_mem' := by
rintro ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ ⟨hb₁, hb₂⟩
exact ⟨I.mul_mem_left _ hb₁, J.mul_mem_left _ hb₂⟩
#align ideal.prod Ideal.prod
@[simp]
theorem mem_prod {r : R} {s : S} : (⟨r, s⟩ : R × S) ∈ prod I J ↔ r ∈ I ∧ s ∈ J :=
Iff.rfl
#align ideal.mem_prod Ideal.mem_prod
@[simp]
theorem prod_top_top : prod (⊤ : Ideal R) (⊤ : Ideal S) = ⊤ :=
Ideal.ext <| by simp
#align ideal.prod_top_top Ideal.prod_top_top
theorem ideal_prod_eq (I : Ideal (R × S)) :
I = Ideal.prod (map (RingHom.fst R S) I : Ideal R) (map (RingHom.snd R S) I) := by
apply Ideal.ext
rintro ⟨r, s⟩
rw [mem_prod, mem_map_iff_of_surjective (RingHom.fst R S) Prod.fst_surjective,
mem_map_iff_of_surjective (RingHom.snd R S) Prod.snd_surjective]
refine ⟨fun h => ⟨⟨_, ⟨h, rfl⟩⟩, ⟨_, ⟨h, rfl⟩⟩⟩, ?_⟩
rintro ⟨⟨⟨r, s'⟩, ⟨h₁, rfl⟩⟩, ⟨⟨r', s⟩, ⟨h₂, rfl⟩⟩⟩
simpa using I.add_mem (I.mul_mem_left (1, 0) h₁) (I.mul_mem_left (0, 1) h₂)
#align ideal.ideal_prod_eq Ideal.ideal_prod_eq
@[simp]
theorem map_fst_prod (I : Ideal R) (J : Ideal S) : map (RingHom.fst R S) (prod I J) = I := by
ext x
rw [mem_map_iff_of_surjective (RingHom.fst R S) Prod.fst_surjective]
exact
⟨by
rintro ⟨x, ⟨h, rfl⟩⟩
exact h.1, fun h => ⟨⟨x, 0⟩, ⟨⟨h, Ideal.zero_mem _⟩, rfl⟩⟩⟩
#align ideal.map_fst_prod Ideal.map_fst_prod
@[simp]
| Mathlib/RingTheory/Ideal/Prod.lean | 72 | 78 | theorem map_snd_prod (I : Ideal R) (J : Ideal S) : map (RingHom.snd R S) (prod I J) = J := by |
ext x
rw [mem_map_iff_of_surjective (RingHom.snd R S) Prod.snd_surjective]
exact
⟨by
rintro ⟨x, ⟨h, rfl⟩⟩
exact h.2, fun h => ⟨⟨0, x⟩, ⟨⟨Ideal.zero_mem _, h⟩, rfl⟩⟩⟩
|
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Bicategory.Coherence
namespace CategoryTheory
namespace Bicategory
open Category
open scoped Bicategory
open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp)
universe w v u
variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a ⟶ b} {g : b ⟶ a}
def leftZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) :=
η ▷ f ⊗≫ f ◁ ε
def rightZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) :=
g ◁ η ⊗≫ ε ▷ g
theorem rightZigzag_idempotent_of_left_triangle
(η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) (h : leftZigzag η ε = (λ_ _).hom ≫ (ρ_ _).inv) :
rightZigzag η ε ⊗≫ rightZigzag η ε = rightZigzag η ε := by
dsimp only [rightZigzag]
calc
_ = g ◁ η ⊗≫ ((ε ▷ g ▷ 𝟙 a) ≫ (𝟙 b ≫ g) ◁ η) ⊗≫ ε ▷ g := by
simp [bicategoricalComp]; coherence
_ = 𝟙 _ ⊗≫ g ◁ (η ▷ 𝟙 a ≫ (f ≫ g) ◁ η) ⊗≫ (ε ▷ (g ≫ f) ≫ 𝟙 b ◁ ε) ▷ g ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; simp [bicategoricalComp]; coherence
_ = g ◁ η ⊗≫ g ◁ leftZigzag η ε ▷ g ⊗≫ ε ▷ g := by
rw [← whisker_exchange, ← whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence
_ = g ◁ η ⊗≫ ε ▷ g := by
rw [h]; simp [bicategoricalComp]; coherence
structure Adjunction (f : a ⟶ b) (g : b ⟶ a) where
unit : 𝟙 a ⟶ f ≫ g
counit : g ≫ f ⟶ 𝟙 b
left_triangle : leftZigzag unit counit = (λ_ _).hom ≫ (ρ_ _).inv := by aesop_cat
right_triangle : rightZigzag unit counit = (ρ_ _).hom ≫ (λ_ _).inv := by aesop_cat
@[inherit_doc] scoped infixr:15 " ⊣ " => Bicategory.Adjunction
namespace Adjunction
attribute [simp] left_triangle right_triangle
attribute [local simp] leftZigzag rightZigzag
def id (a : B) : 𝟙 a ⊣ 𝟙 a where
unit := (ρ_ _).inv
counit := (ρ_ _).hom
left_triangle := by dsimp; coherence
right_triangle := by dsimp; coherence
instance : Inhabited (Adjunction (𝟙 a) (𝟙 a)) :=
⟨id a⟩
section Composition
variable {f₁ : a ⟶ b} {g₁ : b ⟶ a} {f₂ : b ⟶ c} {g₂ : c ⟶ b}
@[simp]
def compUnit (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) : 𝟙 a ⟶ (f₁ ≫ f₂) ≫ g₂ ≫ g₁ :=
adj₁.unit ⊗≫ f₁ ◁ adj₂.unit ▷ g₁ ⊗≫ 𝟙 _
@[simp]
def compCounit (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) : (g₂ ≫ g₁) ≫ f₁ ≫ f₂ ⟶ 𝟙 c :=
𝟙 _ ⊗≫ g₂ ◁ adj₁.counit ▷ f₂ ⊗≫ adj₂.counit
theorem comp_left_triangle_aux (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) :
leftZigzag (compUnit adj₁ adj₂) (compCounit adj₁ adj₂) = (λ_ _).hom ≫ (ρ_ _).inv := by
calc
_ = 𝟙 _ ⊗≫
adj₁.unit ▷ (f₁ ≫ f₂) ⊗≫
f₁ ◁ (adj₂.unit ▷ (g₁ ≫ f₁) ≫ (f₂ ≫ g₂) ◁ adj₁.counit) ▷ f₂ ⊗≫
(f₁ ≫ f₂) ◁ adj₂.counit ⊗≫ 𝟙 _ := by
simp [bicategoricalComp]; coherence
_ = 𝟙 _ ⊗≫
(leftZigzag adj₁.unit adj₁.counit) ▷ f₂ ⊗≫
f₁ ◁ (leftZigzag adj₂.unit adj₂.counit) ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; simp [bicategoricalComp]; coherence
_ = _ := by
simp_rw [left_triangle]; simp [bicategoricalComp]
| Mathlib/CategoryTheory/Bicategory/Adjunction.lean | 151 | 164 | theorem comp_right_triangle_aux (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) :
rightZigzag (compUnit adj₁ adj₂) (compCounit adj₁ adj₂) = (ρ_ _).hom ≫ (λ_ _).inv := by |
calc
_ = 𝟙 _ ⊗≫
(g₂ ≫ g₁) ◁ adj₁.unit ⊗≫
g₂ ◁ ((g₁ ≫ f₁) ◁ adj₂.unit ≫ adj₁.counit ▷ (f₂ ≫ g₂)) ▷ g₁ ⊗≫
adj₂.counit ▷ (g₂ ≫ g₁) ⊗≫ 𝟙 _ := by
simp [bicategoricalComp]; coherence
_ = 𝟙 _ ⊗≫
g₂ ◁ (rightZigzag adj₁.unit adj₁.counit) ⊗≫
(rightZigzag adj₂.unit adj₂.counit) ▷ g₁ ⊗≫ 𝟙 _ := by
rw [whisker_exchange]; simp [bicategoricalComp]; coherence
_ = _ := by
simp_rw [right_triangle]; simp [bicategoricalComp]
|
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
theorem inv_goldConj : ψ⁻¹ = -φ := by
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
#align inv_gold_conj inv_goldConj
@[simp]
theorem gold_mul_goldConj : φ * ψ = -1 := by
field_simp
rw [← sq_sub_sq]
norm_num
#align gold_mul_gold_conj gold_mul_goldConj
@[simp]
| Mathlib/Data/Real/GoldenRatio.lean | 64 | 66 | theorem goldConj_mul_gold : ψ * φ = -1 := by |
rw [mul_comm]
exact gold_mul_goldConj
|
import Mathlib.FieldTheory.RatFunc.Defs
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u v
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
variable {K : Type u}
namespace RatFunc
section Field
variable [CommRing K]
protected irreducible_def zero : RatFunc K :=
⟨0⟩
#align ratfunc.zero RatFunc.zero
instance : Zero (RatFunc K) :=
⟨RatFunc.zero⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]`
-- that does not close the goal
theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by
simp only [Zero.zero, OfNat.ofNat, RatFunc.zero]
#align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero
protected irreducible_def add : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p + q⟩
#align ratfunc.add RatFunc.add
instance : Add (RatFunc K) :=
⟨RatFunc.add⟩
-- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]`
-- that does not close the goal
theorem ofFractionRing_add (p q : FractionRing K[X]) :
ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by
simp only [HAdd.hAdd, Add.add, RatFunc.add]
#align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add
protected irreducible_def sub : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p - q⟩
#align ratfunc.sub RatFunc.sub
instance : Sub (RatFunc K) :=
⟨RatFunc.sub⟩
-- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]`
-- that does not close the goal
theorem ofFractionRing_sub (p q : FractionRing K[X]) :
ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by
simp only [Sub.sub, HSub.hSub, RatFunc.sub]
#align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub
protected irreducible_def neg : RatFunc K → RatFunc K
| ⟨p⟩ => ⟨-p⟩
#align ratfunc.neg RatFunc.neg
instance : Neg (RatFunc K) :=
⟨RatFunc.neg⟩
theorem ofFractionRing_neg (p : FractionRing K[X]) :
ofFractionRing (-p) = -ofFractionRing p := by simp only [Neg.neg, RatFunc.neg]
#align ratfunc.of_fraction_ring_neg RatFunc.ofFractionRing_neg
protected irreducible_def one : RatFunc K :=
⟨1⟩
#align ratfunc.one RatFunc.one
instance : One (RatFunc K) :=
⟨RatFunc.one⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [one_def]`
-- that does not close the goal
theorem ofFractionRing_one : (ofFractionRing 1 : RatFunc K) = 1 := by
simp only [One.one, OfNat.ofNat, RatFunc.one]
#align ratfunc.of_fraction_ring_one RatFunc.ofFractionRing_one
protected irreducible_def mul : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p * q⟩
#align ratfunc.mul RatFunc.mul
instance : Mul (RatFunc K) :=
⟨RatFunc.mul⟩
-- Porting note: added `HMul.hMul`. using `simp?` produces `simp only [mul_def]`
-- that does not close the goal
| Mathlib/FieldTheory/RatFunc/Basic.lean | 145 | 147 | theorem ofFractionRing_mul (p q : FractionRing K[X]) :
ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q := by |
simp only [Mul.mul, HMul.hMul, RatFunc.mul]
|
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Algebra.MvPolynomial.Polynomial
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.RingTheory.Polynomial.Basic
#align_import data.mv_polynomial.funext from "leanprover-community/mathlib"@"0b89934139d3be96f9dab477f10c20f9f93da580"
namespace MvPolynomial
variable {R : Type*} [CommRing R] [IsDomain R] [Infinite R]
private theorem funext_fin {n : ℕ} {p : MvPolynomial (Fin n) R}
(h : ∀ x : Fin n → R, eval x p = 0) : p = 0 := by
induction' n with n ih
· apply (MvPolynomial.isEmptyRingEquiv R (Fin 0)).injective
rw [RingEquiv.map_zero]
convert h finZeroElim
· apply (finSuccEquiv R n).injective
simp only [AlgEquiv.map_zero]
refine Polynomial.funext fun q => ?_
rw [Polynomial.eval_zero]
apply ih fun x => ?_
calc _ = _ := eval_polynomial_eval_finSuccEquiv p _
_ = 0 := h _
| Mathlib/Algebra/MvPolynomial/Funext.lean | 46 | 59 | theorem funext {σ : Type*} {p q : MvPolynomial σ R} (h : ∀ x : σ → R, eval x p = eval x q) :
p = q := by |
suffices ∀ p, (∀ x : σ → R, eval x p = 0) → p = 0 by
rw [← sub_eq_zero, this (p - q)]
simp only [h, RingHom.map_sub, forall_const, sub_self]
clear h p q
intro p h
obtain ⟨n, f, hf, p, rfl⟩ := exists_fin_rename p
suffices p = 0 by rw [this, AlgHom.map_zero]
apply funext_fin
intro x
classical
convert h (Function.extend f x 0)
simp only [eval, eval₂Hom_rename, Function.extend_comp hf]
|
import Mathlib.Data.Set.Prod
import Mathlib.Logic.Function.Conjugate
#align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207"
variable {α β γ : Type*} {ι : Sort*} {π : α → Type*}
open Equiv Equiv.Perm Function
namespace Set
section Order
variable {s : Set α} {f₁ f₂ : α → β} [Preorder α] [Preorder β]
theorem _root_.MonotoneOn.congr (h₁ : MonotoneOn f₁ s) (h : s.EqOn f₁ f₂) : MonotoneOn f₂ s := by
intro a ha b hb hab
rw [← h ha, ← h hb]
exact h₁ ha hb hab
#align monotone_on.congr MonotoneOn.congr
theorem _root_.AntitoneOn.congr (h₁ : AntitoneOn f₁ s) (h : s.EqOn f₁ f₂) : AntitoneOn f₂ s :=
h₁.dual_right.congr h
#align antitone_on.congr AntitoneOn.congr
| Mathlib/Data/Set/Function.lean | 274 | 278 | theorem _root_.StrictMonoOn.congr (h₁ : StrictMonoOn f₁ s) (h : s.EqOn f₁ f₂) :
StrictMonoOn f₂ s := by |
intro a ha b hb hab
rw [← h ha, ← h hb]
exact h₁ ha hb hab
|
import Mathlib.Algebra.Module.Equiv
import Mathlib.Algebra.Module.Hom
import Mathlib.Algebra.Module.Prod
import Mathlib.Algebra.Module.Submodule.Range
import Mathlib.Data.Set.Finite
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Tactic.Abel
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*} {R₄ : Type*}
variable {S : Type*}
variable {K : Type*} {K₂ : Type*}
variable {M : Type*} {M' : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*} {M₄ : Type*}
variable {N : Type*} {N₂ : Type*}
variable {ι : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearEquiv
section AddCommMonoid
#align linear_equiv.map_sum map_sumₓ
section
variable [Semiring R] [Semiring R₂] [Semiring R₃] [Semiring R₄]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃] [AddCommMonoid M₄]
variable {module_M : Module R M} {module_M₂ : Module R₂ M₂} {module_M₃ : Module R₃ M₃}
variable {σ₁₂ : R →+* R₂} {σ₂₁ : R₂ →+* R}
variable {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃} [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable {σ₃₂ : R₃ →+* R₂}
variable {re₁₂ : RingHomInvPair σ₁₂ σ₂₁} {re₂₁ : RingHomInvPair σ₂₁ σ₁₂}
variable {re₂₃ : RingHomInvPair σ₂₃ σ₃₂} {re₃₂ : RingHomInvPair σ₃₂ σ₂₃}
variable (f : M →ₛₗ[σ₁₂] M₂) (g : M₂ →ₛₗ[σ₂₁] M) (e : M ≃ₛₗ[σ₁₂] M₂) (h : M₂ →ₛₗ[σ₂₃] M₃)
variable (e'' : M₂ ≃ₛₗ[σ₂₃] M₃)
variable (p q : Submodule R M)
def ofEq (h : p = q) : p ≃ₗ[R] q :=
{ Equiv.Set.ofEq (congr_arg _ h) with
map_smul' := fun _ _ => rfl
map_add' := fun _ _ => rfl }
#align linear_equiv.of_eq LinearEquiv.ofEq
variable {p q}
@[simp]
theorem coe_ofEq_apply (h : p = q) (x : p) : (ofEq p q h x : M) = x :=
rfl
#align linear_equiv.coe_of_eq_apply LinearEquiv.coe_ofEq_apply
@[simp]
theorem ofEq_symm (h : p = q) : (ofEq p q h).symm = ofEq q p h.symm :=
rfl
#align linear_equiv.of_eq_symm LinearEquiv.ofEq_symm
@[simp]
theorem ofEq_rfl : ofEq p p rfl = LinearEquiv.refl R p := by ext; rfl
#align linear_equiv.of_eq_rfl LinearEquiv.ofEq_rfl
def ofSubmodules (p : Submodule R M) (q : Submodule R₂ M₂) (h : p.map (e : M →ₛₗ[σ₁₂] M₂) = q) :
p ≃ₛₗ[σ₁₂] q :=
(e.submoduleMap p).trans (LinearEquiv.ofEq _ _ h)
#align linear_equiv.of_submodules LinearEquiv.ofSubmodules
@[simp]
theorem ofSubmodules_apply {p : Submodule R M} {q : Submodule R₂ M₂} (h : p.map ↑e = q) (x : p) :
↑(e.ofSubmodules p q h x) = e x :=
rfl
#align linear_equiv.of_submodules_apply LinearEquiv.ofSubmodules_apply
@[simp]
theorem ofSubmodules_symm_apply {p : Submodule R M} {q : Submodule R₂ M₂} (h : p.map ↑e = q)
(x : q) : ↑((e.ofSubmodules p q h).symm x) = e.symm x :=
rfl
#align linear_equiv.of_submodules_symm_apply LinearEquiv.ofSubmodules_symm_apply
def ofSubmodule' [Module R M] [Module R₂ M₂] (f : M ≃ₛₗ[σ₁₂] M₂) (U : Submodule R₂ M₂) :
U.comap (f : M →ₛₗ[σ₁₂] M₂) ≃ₛₗ[σ₁₂] U :=
(f.symm.ofSubmodules _ _ f.symm.map_eq_comap).symm
#align linear_equiv.of_submodule' LinearEquiv.ofSubmodule'
| Mathlib/LinearAlgebra/Basic.lean | 169 | 173 | theorem ofSubmodule'_toLinearMap [Module R M] [Module R₂ M₂] (f : M ≃ₛₗ[σ₁₂] M₂)
(U : Submodule R₂ M₂) :
(f.ofSubmodule' U).toLinearMap = (f.toLinearMap.domRestrict _).codRestrict _ Subtype.prop := by |
ext
rfl
|
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 Ring
variable (R : Type u) [Ring R]
noncomputable def descPochhammer : ℕ → R[X]
| 0 => 1
| n + 1 => X * (descPochhammer n).comp (X - 1)
@[simp]
theorem descPochhammer_zero : descPochhammer R 0 = 1 :=
rfl
@[simp]
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 256 | 256 | theorem descPochhammer_one : descPochhammer R 1 = X := by | simp [descPochhammer]
|
import Mathlib.NumberTheory.Liouville.Basic
#align_import number_theory.liouville.liouville_number from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
noncomputable section
open scoped Nat
open Real Finset
def liouvilleNumber (m : ℝ) : ℝ :=
∑' i : ℕ, 1 / m ^ i !
#align liouville_number liouvilleNumber
namespace LiouvilleNumber
def partialSum (m : ℝ) (k : ℕ) : ℝ :=
∑ i ∈ range (k + 1), 1 / m ^ i !
#align liouville_number.partial_sum LiouvilleNumber.partialSum
def remainder (m : ℝ) (k : ℕ) : ℝ :=
∑' i, 1 / m ^ (i + (k + 1))!
#align liouville_number.remainder LiouvilleNumber.remainder
protected theorem summable {m : ℝ} (hm : 1 < m) : Summable fun i : ℕ => 1 / m ^ i ! :=
summable_one_div_pow_of_le hm Nat.self_le_factorial
#align liouville_number.summable LiouvilleNumber.summable
theorem remainder_summable {m : ℝ} (hm : 1 < m) (k : ℕ) :
Summable fun i : ℕ => 1 / m ^ (i + (k + 1))! := by
convert (summable_nat_add_iff (k + 1)).2 (LiouvilleNumber.summable hm)
#align liouville_number.remainder_summable LiouvilleNumber.remainder_summable
theorem remainder_pos {m : ℝ} (hm : 1 < m) (k : ℕ) : 0 < remainder m k :=
tsum_pos (remainder_summable hm k) (fun _ => by positivity) 0 (by positivity)
#align liouville_number.remainder_pos LiouvilleNumber.remainder_pos
theorem partialSum_succ (m : ℝ) (n : ℕ) :
partialSum m (n + 1) = partialSum m n + 1 / m ^ (n + 1)! :=
sum_range_succ _ _
#align liouville_number.partial_sum_succ LiouvilleNumber.partialSum_succ
theorem partialSum_add_remainder {m : ℝ} (hm : 1 < m) (k : ℕ) :
partialSum m k + remainder m k = liouvilleNumber m :=
sum_add_tsum_nat_add _ (LiouvilleNumber.summable hm)
#align liouville_number.partial_sum_add_remainder LiouvilleNumber.partialSum_add_remainder
theorem remainder_lt' (n : ℕ) {m : ℝ} (m1 : 1 < m) :
remainder m n < (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) :=
-- two useful inequalities
have m0 : 0 < m := zero_lt_one.trans m1
have mi : 1 / m < 1 := (div_lt_one m0).mpr m1
-- to show the strict inequality between these series, we prove that:
calc
(∑' i, 1 / m ^ (i + (n + 1))!) < ∑' i, 1 / m ^ (i + (n + 1)!) :=
-- 1. the second series dominates the first
tsum_lt_tsum (fun b => one_div_pow_le_one_div_pow_of_le m1.le
(b.add_factorial_succ_le_factorial_add_succ n))
-- 2. the term with index `i = 2` of the first series is strictly smaller than
-- the corresponding term of the second series
(one_div_pow_strictAnti m1 (n.add_factorial_succ_lt_factorial_add_succ (i := 2) le_rfl))
-- 3. the first series is summable
(remainder_summable m1 n)
-- 4. the second series is summable, since its terms grow quickly
(summable_one_div_pow_of_le m1 fun j => le_self_add)
-- split the sum in the exponent and massage
_ = ∑' i : ℕ, (1 / m) ^ i * (1 / m ^ (n + 1)!) := by
simp only [pow_add, one_div, mul_inv, inv_pow]
-- factor the constant `(1 / m ^ (n + 1)!)` out of the series
_ = (∑' i, (1 / m) ^ i) * (1 / m ^ (n + 1)!) := tsum_mul_right
-- the series is the geometric series
_ = (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) := by rw [tsum_geometric_of_lt_one (by positivity) mi]
#align liouville_number.remainder_lt' LiouvilleNumber.remainder_lt'
| Mathlib/NumberTheory/Liouville/LiouvilleNumber.lean | 137 | 160 | theorem aux_calc (n : ℕ) {m : ℝ} (hm : 2 ≤ m) :
(1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) ≤ 1 / (m ^ n !) ^ n :=
calc
(1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) ≤ 2 * (1 / m ^ (n + 1)!) :=
-- the second factors coincide (and are non-negative),
-- the first factors satisfy the inequality `sub_one_div_inv_le_two`
mul_le_mul_of_nonneg_right (sub_one_div_inv_le_two hm) (by positivity)
_ = 2 / m ^ (n + 1)! := mul_one_div 2 _
_ = 2 / m ^ (n ! * (n + 1)) := (congr_arg (2 / ·) (congr_arg (Pow.pow m) (mul_comm _ _)))
_ ≤ 1 / m ^ (n ! * n) := by |
-- [NB: in this block, I do not follow the brace convention for subgoals -- I wait until
-- I solve all extraneous goals at once with `exact pow_pos (zero_lt_two.trans_le hm) _`.]
-- Clear denominators and massage*
apply (div_le_div_iff _ _).mpr
focus
conv_rhs => rw [one_mul, mul_add, pow_add, mul_one, pow_mul, mul_comm, ← pow_mul]
-- the second factors coincide, so we prove the inequality of the first factors*
refine (mul_le_mul_right ?_).mpr ?_
-- solve all the inequalities `0 < m ^ ??`
any_goals exact pow_pos (zero_lt_two.trans_le hm) _
-- `2 ≤ m ^ n!` is a consequence of monotonicity of exponentiation at `2 ≤ m`.
exact _root_.trans (_root_.trans hm (pow_one _).symm.le)
(pow_right_mono (one_le_two.trans hm) n.factorial_pos)
_ = 1 / (m ^ n !) ^ n := congr_arg (1 / ·) (pow_mul m n ! n)
|
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.Ideal.Prod
import Mathlib.RingTheory.Ideal.MinimalPrime
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.Topology.Sets.Closeds
import Mathlib.Topology.Sober
#align_import algebraic_geometry.prime_spectrum.basic from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
noncomputable section
open scoped Classical
universe u v
variable (R : Type u) (S : Type v)
@[ext]
structure PrimeSpectrum [CommSemiring R] where
asIdeal : Ideal R
IsPrime : asIdeal.IsPrime
#align prime_spectrum PrimeSpectrum
attribute [instance] PrimeSpectrum.IsPrime
namespace PrimeSpectrum
section CommSemiRing
variable [CommSemiring R] [CommSemiring S]
variable {R S}
instance [Nontrivial R] : Nonempty <| PrimeSpectrum R :=
let ⟨I, hI⟩ := Ideal.exists_maximal R
⟨⟨I, hI.isPrime⟩⟩
instance [Subsingleton R] : IsEmpty (PrimeSpectrum R) :=
⟨fun x ↦ x.IsPrime.ne_top <| SetLike.ext' <| Subsingleton.eq_univ_of_nonempty x.asIdeal.nonempty⟩
#noalign prime_spectrum.punit
variable (R S)
@[simp]
def primeSpectrumProdOfSum : Sum (PrimeSpectrum R) (PrimeSpectrum S) → PrimeSpectrum (R × S)
| Sum.inl ⟨I, _⟩ => ⟨Ideal.prod I ⊤, Ideal.isPrime_ideal_prod_top⟩
| Sum.inr ⟨J, _⟩ => ⟨Ideal.prod ⊤ J, Ideal.isPrime_ideal_prod_top'⟩
#align prime_spectrum.prime_spectrum_prod_of_sum PrimeSpectrum.primeSpectrumProdOfSum
noncomputable def primeSpectrumProd :
PrimeSpectrum (R × S) ≃ Sum (PrimeSpectrum R) (PrimeSpectrum S) :=
Equiv.symm <|
Equiv.ofBijective (primeSpectrumProdOfSum R S) (by
constructor
· rintro (⟨I, hI⟩ | ⟨J, hJ⟩) (⟨I', hI'⟩ | ⟨J', hJ'⟩) h <;>
simp only [mk.injEq, Ideal.prod.ext_iff, primeSpectrumProdOfSum] at h
· simp only [h]
· exact False.elim (hI.ne_top h.left)
· exact False.elim (hJ.ne_top h.right)
· simp only [h]
· rintro ⟨I, hI⟩
rcases (Ideal.ideal_prod_prime I).mp hI with (⟨p, ⟨hp, rfl⟩⟩ | ⟨p, ⟨hp, rfl⟩⟩)
· exact ⟨Sum.inl ⟨p, hp⟩, rfl⟩
· exact ⟨Sum.inr ⟨p, hp⟩, rfl⟩)
#align prime_spectrum.prime_spectrum_prod PrimeSpectrum.primeSpectrumProd
variable {R S}
@[simp]
theorem primeSpectrumProd_symm_inl_asIdeal (x : PrimeSpectrum R) :
((primeSpectrumProd R S).symm <| Sum.inl x).asIdeal = Ideal.prod x.asIdeal ⊤ := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inl_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inl_asIdeal
@[simp]
theorem primeSpectrumProd_symm_inr_asIdeal (x : PrimeSpectrum S) :
((primeSpectrumProd R S).symm <| Sum.inr x).asIdeal = Ideal.prod ⊤ x.asIdeal := by
cases x
rfl
#align prime_spectrum.prime_spectrum_prod_symm_inr_as_ideal PrimeSpectrum.primeSpectrumProd_symm_inr_asIdeal
def zeroLocus (s : Set R) : Set (PrimeSpectrum R) :=
{ x | s ⊆ x.asIdeal }
#align prime_spectrum.zero_locus PrimeSpectrum.zeroLocus
@[simp]
theorem mem_zeroLocus (x : PrimeSpectrum R) (s : Set R) : x ∈ zeroLocus s ↔ s ⊆ x.asIdeal :=
Iff.rfl
#align prime_spectrum.mem_zero_locus PrimeSpectrum.mem_zeroLocus
@[simp]
theorem zeroLocus_span (s : Set R) : zeroLocus (Ideal.span s : Set R) = zeroLocus s := by
ext x
exact (Submodule.gi R R).gc s x.asIdeal
#align prime_spectrum.zero_locus_span PrimeSpectrum.zeroLocus_span
def vanishingIdeal (t : Set (PrimeSpectrum R)) : Ideal R :=
⨅ (x : PrimeSpectrum R) (_ : x ∈ t), x.asIdeal
#align prime_spectrum.vanishing_ideal PrimeSpectrum.vanishingIdeal
theorem coe_vanishingIdeal (t : Set (PrimeSpectrum R)) :
(vanishingIdeal t : Set R) = { f : R | ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal } := by
ext f
rw [vanishingIdeal, SetLike.mem_coe, Submodule.mem_iInf]
apply forall_congr'; intro x
rw [Submodule.mem_iInf]
#align prime_spectrum.coe_vanishing_ideal PrimeSpectrum.coe_vanishingIdeal
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Basic.lean | 172 | 174 | theorem mem_vanishingIdeal (t : Set (PrimeSpectrum R)) (f : R) :
f ∈ vanishingIdeal t ↔ ∀ x : PrimeSpectrum R, x ∈ t → f ∈ x.asIdeal := by |
rw [← SetLike.mem_coe, coe_vanishingIdeal, Set.mem_setOf_eq]
|
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "ℤ[i]" => GaussianInt
namespace GaussianInt
instance : Repr ℤ[i] :=
⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩
instance instCommRing : CommRing ℤ[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : ℤ[i] →+* ℂ :=
Zsqrtd.lift ⟨I, by simp⟩
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe ℤ[i] ℂ :=
⟨toComplex⟩
theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
@[simp]
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 135 | 137 | theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by |
rw [toComplex_def₂, toComplex_def₂]
exact congr_arg₂ _ rfl (Int.cast_neg _)
|
import Mathlib.Algebra.Group.Even
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Algebra.Order.Sub.Defs
#align_import algebra.order.sub.canonical from "leanprover-community/mathlib"@"62a5626868683c104774de8d85b9855234ac807c"
variable {α : Type*}
section ExistsAddOfLE
variable [AddCommSemigroup α] [PartialOrder α] [ExistsAddOfLE α]
[CovariantClass α α (· + ·) (· ≤ ·)] [Sub α] [OrderedSub α] {a b c d : α}
@[simp]
theorem add_tsub_cancel_of_le (h : a ≤ b) : a + (b - a) = b := by
refine le_antisymm ?_ le_add_tsub
obtain ⟨c, rfl⟩ := exists_add_of_le h
exact add_le_add_left add_tsub_le_left a
#align add_tsub_cancel_of_le add_tsub_cancel_of_le
theorem tsub_add_cancel_of_le (h : a ≤ b) : b - a + a = b := by
rw [add_comm]
exact add_tsub_cancel_of_le h
#align tsub_add_cancel_of_le tsub_add_cancel_of_le
theorem add_le_of_le_tsub_right_of_le (h : b ≤ c) (h2 : a ≤ c - b) : a + b ≤ c :=
(add_le_add_right h2 b).trans_eq <| tsub_add_cancel_of_le h
#align add_le_of_le_tsub_right_of_le add_le_of_le_tsub_right_of_le
theorem add_le_of_le_tsub_left_of_le (h : a ≤ c) (h2 : b ≤ c - a) : a + b ≤ c :=
(add_le_add_left h2 a).trans_eq <| add_tsub_cancel_of_le h
#align add_le_of_le_tsub_left_of_le add_le_of_le_tsub_left_of_le
theorem tsub_le_tsub_iff_right (h : c ≤ b) : a - c ≤ b - c ↔ a ≤ b := by
rw [tsub_le_iff_right, tsub_add_cancel_of_le h]
#align tsub_le_tsub_iff_right tsub_le_tsub_iff_right
theorem tsub_left_inj (h1 : c ≤ a) (h2 : c ≤ b) : a - c = b - c ↔ a = b := by
simp_rw [le_antisymm_iff, tsub_le_tsub_iff_right h1, tsub_le_tsub_iff_right h2]
#align tsub_left_inj tsub_left_inj
theorem tsub_inj_left (h₁ : a ≤ b) (h₂ : a ≤ c) : b - a = c - a → b = c :=
(tsub_left_inj h₁ h₂).1
#align tsub_inj_left tsub_inj_left
theorem lt_of_tsub_lt_tsub_right_of_le (h : c ≤ b) (h2 : a - c < b - c) : a < b := by
refine ((tsub_le_tsub_iff_right h).mp h2.le).lt_of_ne ?_
rintro rfl
exact h2.false
#align lt_of_tsub_lt_tsub_right_of_le lt_of_tsub_lt_tsub_right_of_le
theorem tsub_add_tsub_cancel (hab : b ≤ a) (hcb : c ≤ b) : a - b + (b - c) = a - c := by
convert tsub_add_cancel_of_le (tsub_le_tsub_right hab c) using 2
rw [tsub_tsub, add_tsub_cancel_of_le hcb]
#align tsub_add_tsub_cancel tsub_add_tsub_cancel
| Mathlib/Algebra/Order/Sub/Canonical.lean | 68 | 69 | theorem tsub_tsub_tsub_cancel_right (h : c ≤ b) : a - c - (b - c) = a - b := by |
rw [tsub_tsub, add_tsub_cancel_of_le h]
|
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
#align_import category_theory.limits.preserves.shapes.images from "leanprover-community/mathlib"@"fc78e3c190c72a109699385da6be2725e88df841"
noncomputable section
namespace CategoryTheory
namespace PreservesImage
open CategoryTheory
open CategoryTheory.Limits
universe u₁ u₂ v₁ v₂
variable {A : Type u₁} {B : Type u₂} [Category.{v₁} A] [Category.{v₂} B]
variable [HasEqualizers A] [HasImages A]
variable [StrongEpiCategory B] [HasImages B]
variable (L : A ⥤ B)
variable [∀ {X Y Z : A} (f : X ⟶ Z) (g : Y ⟶ Z), PreservesLimit (cospan f g) L]
variable [∀ {X Y Z : A} (f : X ⟶ Y) (g : X ⟶ Z), PreservesColimit (span f g) L]
@[simps!]
def iso {X Y : A} (f : X ⟶ Y) : image (L.map f) ≅ L.obj (image f) :=
let aux1 : StrongEpiMonoFactorisation (L.map f) :=
{ I := L.obj (Limits.image f)
m := L.map <| Limits.image.ι _
m_mono := preserves_mono_of_preservesLimit _ _
e := L.map <| factorThruImage _
e_strong_epi := @strongEpi_of_epi B _ _ _ _ _ (preserves_epi_of_preservesColimit L _)
fac := by rw [← L.map_comp, Limits.image.fac] }
IsImage.isoExt (Image.isImage (L.map f)) aux1.toMonoIsImage
#align category_theory.preserves_image.iso CategoryTheory.PreservesImage.iso
@[reassoc]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Images.lean | 52 | 53 | theorem factorThruImage_comp_hom {X Y : A} (f : X ⟶ Y) :
factorThruImage (L.map f) ≫ (iso L f).hom = L.map (factorThruImage f) := by | simp
|
import Mathlib.Data.Finsupp.Defs
#align_import data.finsupp.ne_locus from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {α M N P : Type*}
namespace Finsupp
variable [DecidableEq α]
section NHasZero
variable [DecidableEq N] [Zero N] (f g : α →₀ N)
def neLocus (f g : α →₀ N) : Finset α :=
(f.support ∪ g.support).filter fun x => f x ≠ g x
#align finsupp.ne_locus Finsupp.neLocus
@[simp]
| Mathlib/Data/Finsupp/NeLocus.lean | 42 | 44 | theorem mem_neLocus {f g : α →₀ N} {a : α} : a ∈ f.neLocus g ↔ f a ≠ g a := by |
simpa only [neLocus, Finset.mem_filter, Finset.mem_union, mem_support_iff,
and_iff_right_iff_imp] using Ne.ne_or_ne _
|
import Mathlib.LinearAlgebra.Isomorphisms
import Mathlib.LinearAlgebra.Projection
import Mathlib.Order.JordanHolder
import Mathlib.Order.CompactlyGenerated.Intervals
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import ring_theory.simple_module from "leanprover-community/mathlib"@"cce7f68a7eaadadf74c82bbac20721cdc03a1cc1"
variable {ι : Type*} (R S : Type*) [Ring R] [Ring S] (M : Type*) [AddCommGroup M] [Module R M]
abbrev IsSimpleModule :=
IsSimpleOrder (Submodule R M)
#align is_simple_module IsSimpleModule
abbrev IsSemisimpleModule :=
ComplementedLattice (Submodule R M)
#align is_semisimple_module IsSemisimpleModule
abbrev IsSemisimpleRing := IsSemisimpleModule R R
theorem RingEquiv.isSemisimpleRing (e : R ≃+* S) [IsSemisimpleRing R] : IsSemisimpleRing S :=
(Submodule.orderIsoMapComap e.toSemilinearEquiv).complementedLattice
-- Making this an instance causes the linter to complain of "dangerous instances"
theorem IsSimpleModule.nontrivial [IsSimpleModule R M] : Nontrivial M :=
⟨⟨0, by
have h : (⊥ : Submodule R M) ≠ ⊤ := bot_ne_top
contrapose! h
ext x
simp [Submodule.mem_bot, Submodule.mem_top, h x]⟩⟩
#align is_simple_module.nontrivial IsSimpleModule.nontrivial
variable {m : Submodule R M} {N : Type*} [AddCommGroup N] [Module R N] {R S M}
theorem LinearMap.isSimpleModule_iff_of_bijective [Module S N] {σ : R →+* S} [RingHomSurjective σ]
(l : M →ₛₗ[σ] N) (hl : Function.Bijective l) : IsSimpleModule R M ↔ IsSimpleModule S N :=
(Submodule.orderIsoMapComapOfBijective l hl).isSimpleOrder_iff
theorem IsSimpleModule.congr (l : M ≃ₗ[R] N) [IsSimpleModule R N] : IsSimpleModule R M :=
(Submodule.orderIsoMapComap l).isSimpleOrder
#align is_simple_module.congr IsSimpleModule.congr
| Mathlib/RingTheory/SimpleModule.lean | 86 | 88 | theorem isSimpleModule_iff_isAtom : IsSimpleModule R m ↔ IsAtom m := by |
rw [← Set.isSimpleOrder_Iic_iff_isAtom]
exact m.mapIic.isSimpleOrder_iff
|
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [← comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) :
factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C)
@[simp]
theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A ⟶ B) g w = 0 := by
ext
simp
#align image_to_kernel_zero_left imageToKernel_zero_left
theorem imageToKernel_zero_right [HasImages V] {w} :
imageToKernel f (0 : B ⟶ C) w =
(imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by
ext
simp
#align image_to_kernel_zero_right imageToKernel_zero_right
section
variable [HasKernels V] [HasImages V]
theorem imageToKernel_comp_right {D : V} (h : C ⟶ D) (w : f ≫ g = 0) :
imageToKernel f (g ≫ h) (by simp [reassoc_of% w]) =
imageToKernel f g w ≫ Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by
ext
simp
#align image_to_kernel_comp_right imageToKernel_comp_right
| Mathlib/Algebra/Homology/ImageToKernel.lean | 119 | 123 | theorem imageToKernel_comp_left {Z : V} (h : Z ⟶ A) (w : f ≫ g = 0) :
imageToKernel (h ≫ f) g (by simp [w]) =
Subobject.ofLE _ _ (imageSubobject_comp_le h f) ≫ imageToKernel f g w := by |
ext
simp
|
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.Norm
#align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
open scoped Matrix
open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField
namespace Algebra
variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι]
variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C]
section Discr
-- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in
-- mathlib3.
noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B]
[Fintype ι] (b : ι → B) := (traceMatrix A b).det
#align algebra.discr Algebra.discr
theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl
variable {A C} in
theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) :
Algebra.discr A b = Algebra.discr A (f ∘ b) := by
rw [discr_def]; congr; ext
simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv]
#align algebra.discr_def Algebra.discr_def
variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι']
section Field
variable (K : Type u) {L : Type v} (E : Type z) [Field K] [Field L] [Field E]
variable [Algebra K L] [Algebra K E]
variable [Module.Finite K L] [IsAlgClosed E]
theorem discr_not_zero_of_basis [IsSeparable K L] (b : Basis ι K L) :
discr K b ≠ 0 := by
rw [discr_def, traceMatrix_of_basis, ← LinearMap.BilinForm.nondegenerate_iff_det_ne_zero]
exact traceForm_nondegenerate _ _
#align algebra.discr_not_zero_of_basis Algebra.discr_not_zero_of_basis
theorem discr_isUnit_of_basis [IsSeparable K L] (b : Basis ι K L) : IsUnit (discr K b) :=
IsUnit.mk0 _ (discr_not_zero_of_basis _ _)
#align algebra.discr_is_unit_of_basis Algebra.discr_isUnit_of_basis
variable (b : ι → L) (pb : PowerBasis K L)
theorem discr_eq_det_embeddingsMatrixReindex_pow_two [IsSeparable K L] (e : ι ≃ (L →ₐ[K] E)) :
algebraMap K E (discr K b) = (embeddingsMatrixReindex K E b e).det ^ 2 := by
rw [discr_def, RingHom.map_det, RingHom.mapMatrix_apply,
traceMatrix_eq_embeddingsMatrixReindex_mul_trans, det_mul, det_transpose, pow_two]
#align algebra.discr_eq_det_embeddings_matrix_reindex_pow_two Algebra.discr_eq_det_embeddingsMatrixReindex_pow_two
| Mathlib/RingTheory/Discriminant.lean | 161 | 167 | theorem discr_powerBasis_eq_prod (e : Fin pb.dim ≃ (L →ₐ[K] E)) [IsSeparable K L] :
algebraMap K E (discr K pb.basis) =
∏ i : Fin pb.dim, ∏ j ∈ Ioi i, (e j pb.gen - e i pb.gen) ^ 2 := by |
rw [discr_eq_det_embeddingsMatrixReindex_pow_two K E pb.basis e,
embeddingsMatrixReindex_eq_vandermonde, det_transpose, det_vandermonde, ← prod_pow]
congr; ext i
rw [← prod_pow]
|
import Mathlib.LinearAlgebra.Dimension.Finrank
import Mathlib.LinearAlgebra.InvariantBasisNumber
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v w w'
variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M]
variable {ι : Type w} {ι' : Type w'}
open Cardinal Basis Submodule Function Set
attribute [local instance] nontrivial_of_invariantBasisNumber
section StrongRankCondition
variable [StrongRankCondition R]
open Submodule
-- An auxiliary lemma for `linearIndependent_le_span'`,
-- with the additional assumption that the linearly independent family is finite.
theorem linearIndependent_le_span_aux' {ι : Type*} [Fintype ι] (v : ι → M)
(i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) :
Fintype.card ι ≤ Fintype.card w := by
-- We construct an injective linear map `(ι → R) →ₗ[R] (w → R)`,
-- by thinking of `f : ι → R` as a linear combination of the finite family `v`,
-- and expressing that (using the axiom of choice) as a linear combination over `w`.
-- We can do this linearly by constructing the map on a basis.
fapply card_le_of_injective' R
· apply Finsupp.total
exact fun i => Span.repr R w ⟨v i, s (mem_range_self i)⟩
· intro f g h
apply_fun Finsupp.total w M R (↑) at h
simp only [Finsupp.total_total, Submodule.coe_mk, Span.finsupp_total_repr] at h
rw [← sub_eq_zero, ← LinearMap.map_sub] at h
exact sub_eq_zero.mp (linearIndependent_iff.mp i _ h)
#align linear_independent_le_span_aux' linearIndependent_le_span_aux'
lemma LinearIndependent.finite_of_le_span_finite {ι : Type*} (v : ι → M) (i : LinearIndependent R v)
(w : Set M) [Finite w] (s : range v ≤ span R w) : Finite ι :=
letI := Fintype.ofFinite w
Fintype.finite <| fintypeOfFinsetCardLe (Fintype.card w) fun t => by
let v' := fun x : (t : Set ι) => v x
have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective
have s' : range v' ≤ span R w := (range_comp_subset_range _ _).trans s
simpa using linearIndependent_le_span_aux' v' i' w s'
#align linear_independent_fintype_of_le_span_fintype LinearIndependent.finite_of_le_span_finite
theorem linearIndependent_le_span' {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M)
[Fintype w] (s : range v ≤ span R w) : #ι ≤ Fintype.card w := by
haveI : Finite ι := i.finite_of_le_span_finite v w s
letI := Fintype.ofFinite ι
rw [Cardinal.mk_fintype]
simp only [Cardinal.natCast_le]
exact linearIndependent_le_span_aux' v i w s
#align linear_independent_le_span' linearIndependent_le_span'
theorem linearIndependent_le_span {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M)
[Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by
apply linearIndependent_le_span' v i w
rw [s]
exact le_top
#align linear_independent_le_span linearIndependent_le_span
theorem linearIndependent_le_span_finset {ι : Type*} (v : ι → M) (i : LinearIndependent R v)
(w : Finset M) (s : span R (w : Set M) = ⊤) : #ι ≤ w.card := by
simpa only [Finset.coe_sort_coe, Fintype.card_coe] using linearIndependent_le_span v i w s
#align linear_independent_le_span_finset linearIndependent_le_span_finset
| Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean | 244 | 258 | theorem linearIndependent_le_infinite_basis {ι : Type w} (b : Basis ι R M) [Infinite ι] {κ : Type w}
(v : κ → M) (i : LinearIndependent R v) : #κ ≤ #ι := by |
classical
by_contra h
rw [not_le, ← Cardinal.mk_finset_of_infinite ι] at h
let Φ := fun k : κ => (b.repr (v k)).support
obtain ⟨s, w : Infinite ↑(Φ ⁻¹' {s})⟩ := Cardinal.exists_infinite_fiber Φ h (by infer_instance)
let v' := fun k : Φ ⁻¹' {s} => v k
have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective
have w' : Finite (Φ ⁻¹' {s}) := by
apply i'.finite_of_le_span_finite v' (s.image b)
rintro m ⟨⟨p, ⟨rfl⟩⟩, rfl⟩
simp only [SetLike.mem_coe, Subtype.coe_mk, Finset.coe_image]
apply Basis.mem_span_repr_support
exact w.false
|
import Mathlib.MeasureTheory.Function.ConditionalExpectation.Basic
#align_import measure_theory.function.conditional_expectation.indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α 𝕜 E : Type*} {m m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] {μ : Measure α} {f : α → E} {s : Set α}
theorem condexp_ae_eq_restrict_zero (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict s] 0) :
μ[f|m] =ᵐ[μ.restrict s] 0 := by
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm]; rfl
by_cases hμm : SigmaFinite (μ.trim hm)
swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm]; rfl
haveI : SigmaFinite (μ.trim hm) := hμm
have : SigmaFinite ((μ.restrict s).trim hm) := by
rw [← restrict_trim hm _ hs]
exact Restrict.sigmaFinite _ s
by_cases hf_int : Integrable f μ
swap; · rw [condexp_undef hf_int]
refine ae_eq_of_forall_setIntegral_eq_of_sigmaFinite' hm ?_ ?_ ?_ ?_ ?_
· exact fun t _ _ => integrable_condexp.integrableOn.integrableOn
· exact fun t _ _ => (integrable_zero _ _ _).integrableOn
· intro t ht _
rw [Measure.restrict_restrict (hm _ ht), setIntegral_condexp hm hf_int (ht.inter hs), ←
Measure.restrict_restrict (hm _ ht)]
refine setIntegral_congr_ae (hm _ ht) ?_
filter_upwards [hf] with x hx _ using hx
· exact stronglyMeasurable_condexp.aeStronglyMeasurable'
· exact stronglyMeasurable_zero.aeStronglyMeasurable'
#align measure_theory.condexp_ae_eq_restrict_zero MeasureTheory.condexp_ae_eq_restrict_zero
theorem condexp_indicator_aux (hs : MeasurableSet[m] s) (hf : f =ᵐ[μ.restrict sᶜ] 0) :
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl
have hsf_zero : ∀ g : α → E, g =ᵐ[μ.restrict sᶜ] 0 → s.indicator g =ᵐ[μ] g := fun g =>
indicator_ae_eq_of_restrict_compl_ae_eq_zero (hm _ hs)
refine ((hsf_zero (μ[f|m]) (condexp_ae_eq_restrict_zero hs.compl hf)).trans ?_).symm
exact condexp_congr_ae (hsf_zero f hf).symm
#align measure_theory.condexp_indicator_aux MeasureTheory.condexp_indicator_aux
theorem condexp_indicator (hf_int : Integrable f μ) (hs : MeasurableSet[m] s) :
μ[s.indicator f|m] =ᵐ[μ] s.indicator (μ[f|m]) := by
by_cases hm : m ≤ m0
swap; · simp_rw [condexp_of_not_le hm, Set.indicator_zero']; rfl
by_cases hμm : SigmaFinite (μ.trim hm)
swap; · simp_rw [condexp_of_not_sigmaFinite hm hμm, Set.indicator_zero']; rfl
haveI : SigmaFinite (μ.trim hm) := hμm
-- use `have` to perform what should be the first calc step because of an error I don't
-- understand
have : s.indicator (μ[f|m]) =ᵐ[μ] s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) := by
rw [Set.indicator_self_add_compl s f]
refine (this.trans ?_).symm
calc
s.indicator (μ[s.indicator f + sᶜ.indicator f|m]) =ᵐ[μ]
s.indicator (μ[s.indicator f|m] + μ[sᶜ.indicator f|m]) := by
have : μ[s.indicator f + sᶜ.indicator f|m] =ᵐ[μ] μ[s.indicator f|m] + μ[sᶜ.indicator f|m] :=
condexp_add (hf_int.indicator (hm _ hs)) (hf_int.indicator (hm _ hs.compl))
filter_upwards [this] with x hx
classical rw [Set.indicator_apply, Set.indicator_apply, hx]
_ = s.indicator (μ[s.indicator f|m]) + s.indicator (μ[sᶜ.indicator f|m]) :=
(s.indicator_add' _ _)
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) +
s.indicator (sᶜ.indicator (μ[sᶜ.indicator f|m])) := by
refine Filter.EventuallyEq.rfl.add ?_
have : sᶜ.indicator (μ[sᶜ.indicator f|m]) =ᵐ[μ] μ[sᶜ.indicator f|m] := by
refine (condexp_indicator_aux hs.compl ?_).symm.trans ?_
· exact indicator_ae_eq_restrict_compl (hm _ hs.compl)
· rw [Set.indicator_indicator, Set.inter_self]
filter_upwards [this] with x hx
by_cases hxs : x ∈ s
· simp only [hx, hxs, Set.indicator_of_mem]
· simp only [hxs, Set.indicator_of_not_mem, not_false_iff]
_ =ᵐ[μ] s.indicator (μ[s.indicator f|m]) := by
rw [Set.indicator_indicator, Set.inter_compl_self, Set.indicator_empty', add_zero]
_ =ᵐ[μ] μ[s.indicator f|m] := by
refine (condexp_indicator_aux hs ?_).symm.trans ?_
· exact indicator_ae_eq_restrict_compl (hm _ hs)
· rw [Set.indicator_indicator, Set.inter_self]
#align measure_theory.condexp_indicator MeasureTheory.condexp_indicator
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Indicator.lean | 115 | 140 | theorem condexp_restrict_ae_eq_restrict (hm : m ≤ m0) [SigmaFinite (μ.trim hm)]
(hs_m : MeasurableSet[m] s) (hf_int : Integrable f μ) :
(μ.restrict s)[f|m] =ᵐ[μ.restrict s] μ[f|m] := by |
have : SigmaFinite ((μ.restrict s).trim hm) := by rw [← restrict_trim hm _ hs_m]; infer_instance
rw [ae_eq_restrict_iff_indicator_ae_eq (hm _ hs_m)]
refine EventuallyEq.trans ?_ (condexp_indicator hf_int hs_m)
refine ae_eq_condexp_of_forall_setIntegral_eq hm (hf_int.indicator (hm _ hs_m)) ?_ ?_ ?_
· intro t ht _
rw [← integrable_indicator_iff (hm _ ht), Set.indicator_indicator, Set.inter_comm, ←
Set.indicator_indicator]
suffices h_int_restrict : Integrable (t.indicator ((μ.restrict s)[f|m])) (μ.restrict s) by
rw [integrable_indicator_iff (hm _ hs_m), IntegrableOn]
rw [integrable_indicator_iff (hm _ ht), IntegrableOn] at h_int_restrict ⊢
exact h_int_restrict
exact integrable_condexp.indicator (hm _ ht)
· intro t ht _
calc
∫ x in t, s.indicator ((μ.restrict s)[f|m]) x ∂μ =
∫ x in t, ((μ.restrict s)[f|m]) x ∂μ.restrict s := by
rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m),
Measure.restrict_restrict (hm _ ht), Set.inter_comm]
_ = ∫ x in t, f x ∂μ.restrict s := setIntegral_condexp hm hf_int.integrableOn ht
_ = ∫ x in t, s.indicator f x ∂μ := by
rw [integral_indicator (hm _ hs_m), Measure.restrict_restrict (hm _ hs_m),
Measure.restrict_restrict (hm _ ht), Set.inter_comm]
· exact (stronglyMeasurable_condexp.indicator hs_m).aeStronglyMeasurable'
|
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
{v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).vars ⊆ p.vars ∪ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars ∪ q.vars := by
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
#align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint
section Mul
theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by
simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset]
exact Multiset.subset_of_le (degrees_mul φ ψ)
#align mv_polynomial.vars_mul MvPolynomial.vars_mul
@[simp]
theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ :=
vars_C
#align mv_polynomial.vars_one MvPolynomial.vars_one
| Mathlib/Algebra/MvPolynomial/Variables.lean | 134 | 140 | theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by |
classical
induction' n with n ih
· simp
· rw [pow_succ']
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset (Finset.Subset.refl _) ih
|
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Cardinality
#align_import data.complex.cardinality from "leanprover-community/mathlib"@"1c4e18434eeb5546b212e830b2b39de6a83c473c"
-- Porting note: the lemmas `mk_complex` and `mk_univ_complex` should be in the namespace `Cardinal`
-- like their real counterparts.
open Cardinal Set
open Cardinal
@[simp]
theorem mk_complex : #ℂ = 𝔠 := by
rw [mk_congr Complex.equivRealProd, mk_prod, lift_id, mk_real, continuum_mul_self]
#align mk_complex mk_complex
-- @[simp] -- Porting note (#10618): simp can prove this
theorem mk_univ_complex : #(Set.univ : Set ℂ) = 𝔠 := by rw [mk_univ, mk_complex]
#align mk_univ_complex mk_univ_complex
| Mathlib/Data/Complex/Cardinality.lean | 35 | 37 | theorem not_countable_complex : ¬(Set.univ : Set ℂ).Countable := by |
rw [← le_aleph0_iff_set_countable, not_le, mk_univ_complex]
apply cantor
|
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.Order.UpperLower.Basic
#align_import algebra.order.upper_lower from "leanprover-community/mathlib"@"c0c52abb75074ed8b73a948341f50521fbf43b4c"
open Function Set
open Pointwise
section OrderedCommGroup
variable {α : Type*} [OrderedCommGroup α] {s t : Set α} {a : α}
@[to_additive]
theorem IsUpperSet.smul (hs : IsUpperSet s) : IsUpperSet (a • s) := hs.image <| OrderIso.mulLeft _
#align is_upper_set.smul IsUpperSet.smul
#align is_upper_set.vadd IsUpperSet.vadd
@[to_additive]
theorem IsLowerSet.smul (hs : IsLowerSet s) : IsLowerSet (a • s) := hs.image <| OrderIso.mulLeft _
#align is_lower_set.smul IsLowerSet.smul
#align is_lower_set.vadd IsLowerSet.vadd
@[to_additive]
theorem Set.OrdConnected.smul (hs : s.OrdConnected) : (a • s).OrdConnected := by
rw [← hs.upperClosure_inter_lowerClosure, smul_set_inter]
exact (upperClosure _).upper.smul.ordConnected.inter (lowerClosure _).lower.smul.ordConnected
#align set.ord_connected.smul Set.OrdConnected.smul
#align set.ord_connected.vadd Set.OrdConnected.vadd
@[to_additive]
theorem IsUpperSet.mul_left (ht : IsUpperSet t) : IsUpperSet (s * t) := by
rw [← smul_eq_mul, ← Set.iUnion_smul_set]
exact isUpperSet_iUnion₂ fun x _ ↦ ht.smul
#align is_upper_set.mul_left IsUpperSet.mul_left
#align is_upper_set.add_left IsUpperSet.add_left
@[to_additive]
theorem IsUpperSet.mul_right (hs : IsUpperSet s) : IsUpperSet (s * t) := by
rw [mul_comm]
exact hs.mul_left
#align is_upper_set.mul_right IsUpperSet.mul_right
#align is_upper_set.add_right IsUpperSet.add_right
@[to_additive]
theorem IsLowerSet.mul_left (ht : IsLowerSet t) : IsLowerSet (s * t) := ht.toDual.mul_left
#align is_lower_set.mul_left IsLowerSet.mul_left
#align is_lower_set.add_left IsLowerSet.add_left
@[to_additive]
theorem IsLowerSet.mul_right (hs : IsLowerSet s) : IsLowerSet (s * t) := hs.toDual.mul_right
#align is_lower_set.mul_right IsLowerSet.mul_right
#align is_lower_set.add_right IsLowerSet.add_right
@[to_additive]
theorem IsUpperSet.inv (hs : IsUpperSet s) : IsLowerSet s⁻¹ := fun _ _ h ↦ hs <| inv_le_inv' h
#align is_upper_set.inv IsUpperSet.inv
#align is_upper_set.neg IsUpperSet.neg
@[to_additive]
theorem IsLowerSet.inv (hs : IsLowerSet s) : IsUpperSet s⁻¹ := fun _ _ h ↦ hs <| inv_le_inv' h
#align is_lower_set.inv IsLowerSet.inv
#align is_lower_set.neg IsLowerSet.neg
@[to_additive]
theorem IsUpperSet.div_left (ht : IsUpperSet t) : IsLowerSet (s / t) := by
rw [div_eq_mul_inv]
exact ht.inv.mul_left
#align is_upper_set.div_left IsUpperSet.div_left
#align is_upper_set.sub_left IsUpperSet.sub_left
@[to_additive]
| Mathlib/Algebra/Order/UpperLower.lean | 104 | 106 | theorem IsUpperSet.div_right (hs : IsUpperSet s) : IsUpperSet (s / t) := by |
rw [div_eq_mul_inv]
exact hs.mul_right
|
import Mathlib.Analysis.NormedSpace.AddTorsorBases
#align_import analysis.convex.intrinsic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open AffineSubspace Set
open scoped Pointwise
variable {𝕜 V W Q P : Type*}
section AddTorsor
variable (𝕜) [Ring 𝕜] [AddCommGroup V] [Module 𝕜 V] [TopologicalSpace P] [AddTorsor V P]
{s t : Set P} {x : P}
def intrinsicInterior (s : Set P) : Set P :=
(↑) '' interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_interior intrinsicInterior
def intrinsicFrontier (s : Set P) : Set P :=
(↑) '' frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_frontier intrinsicFrontier
def intrinsicClosure (s : Set P) : Set P :=
(↑) '' closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_closure intrinsicClosure
variable {𝕜}
@[simp]
theorem mem_intrinsicInterior :
x ∈ intrinsicInterior 𝕜 s ↔ ∃ y, y ∈ interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_interior mem_intrinsicInterior
@[simp]
theorem mem_intrinsicFrontier :
x ∈ intrinsicFrontier 𝕜 s ↔ ∃ y, y ∈ frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_frontier mem_intrinsicFrontier
@[simp]
theorem mem_intrinsicClosure :
x ∈ intrinsicClosure 𝕜 s ↔ ∃ y, y ∈ closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_closure mem_intrinsicClosure
theorem intrinsicInterior_subset : intrinsicInterior 𝕜 s ⊆ s :=
image_subset_iff.2 interior_subset
#align intrinsic_interior_subset intrinsicInterior_subset
theorem intrinsicFrontier_subset (hs : IsClosed s) : intrinsicFrontier 𝕜 s ⊆ s :=
image_subset_iff.2 (hs.preimage continuous_induced_dom).frontier_subset
#align intrinsic_frontier_subset intrinsicFrontier_subset
theorem intrinsicFrontier_subset_intrinsicClosure : intrinsicFrontier 𝕜 s ⊆ intrinsicClosure 𝕜 s :=
image_subset _ frontier_subset_closure
#align intrinsic_frontier_subset_intrinsic_closure intrinsicFrontier_subset_intrinsicClosure
theorem subset_intrinsicClosure : s ⊆ intrinsicClosure 𝕜 s :=
fun x hx => ⟨⟨x, subset_affineSpan _ _ hx⟩, subset_closure hx, rfl⟩
#align subset_intrinsic_closure subset_intrinsicClosure
@[simp]
| Mathlib/Analysis/Convex/Intrinsic.lean | 112 | 112 | theorem intrinsicInterior_empty : intrinsicInterior 𝕜 (∅ : Set P) = ∅ := by | simp [intrinsicInterior]
|
import Mathlib.Topology.MetricSpace.HausdorffDistance
#align_import topology.metric_space.hausdorff_distance from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
noncomputable section
open NNReal ENNReal Topology Set Filter Bornology
universe u v w
variable {ι : Sort*} {α : Type u} {β : Type v}
namespace Metric
section Thickening
variable [PseudoEMetricSpace α] {δ : ℝ} {s : Set α} {x : α}
open EMetric
def thickening (δ : ℝ) (E : Set α) : Set α :=
{ x : α | infEdist x E < ENNReal.ofReal δ }
#align metric.thickening Metric.thickening
theorem mem_thickening_iff_infEdist_lt : x ∈ thickening δ s ↔ infEdist x s < ENNReal.ofReal δ :=
Iff.rfl
#align metric.mem_thickening_iff_inf_edist_lt Metric.mem_thickening_iff_infEdist_lt
lemma eventually_not_mem_thickening_of_infEdist_pos {E : Set α} {x : α} (h : x ∉ closure E) :
∀ᶠ δ in 𝓝 (0 : ℝ), x ∉ Metric.thickening δ E := by
obtain ⟨ε, ⟨ε_pos, ε_lt⟩⟩ := exists_real_pos_lt_infEdist_of_not_mem_closure h
filter_upwards [eventually_lt_nhds ε_pos] with δ hδ
simp only [thickening, mem_setOf_eq, not_lt]
exact (ENNReal.ofReal_le_ofReal hδ.le).trans ε_lt.le
theorem thickening_eq_preimage_infEdist (δ : ℝ) (E : Set α) :
thickening δ E = (infEdist · E) ⁻¹' Iio (ENNReal.ofReal δ) :=
rfl
#align metric.thickening_eq_preimage_inf_edist Metric.thickening_eq_preimage_infEdist
theorem isOpen_thickening {δ : ℝ} {E : Set α} : IsOpen (thickening δ E) :=
Continuous.isOpen_preimage continuous_infEdist _ isOpen_Iio
#align metric.is_open_thickening Metric.isOpen_thickening
@[simp]
theorem thickening_empty (δ : ℝ) : thickening δ (∅ : Set α) = ∅ := by
simp only [thickening, setOf_false, infEdist_empty, not_top_lt]
#align metric.thickening_empty Metric.thickening_empty
theorem thickening_of_nonpos (hδ : δ ≤ 0) (s : Set α) : thickening δ s = ∅ :=
eq_empty_of_forall_not_mem fun _ => ((ENNReal.ofReal_of_nonpos hδ).trans_le bot_le).not_lt
#align metric.thickening_of_nonpos Metric.thickening_of_nonpos
theorem thickening_mono {δ₁ δ₂ : ℝ} (hle : δ₁ ≤ δ₂) (E : Set α) :
thickening δ₁ E ⊆ thickening δ₂ E :=
preimage_mono (Iio_subset_Iio (ENNReal.ofReal_le_ofReal hle))
#align metric.thickening_mono Metric.thickening_mono
theorem thickening_subset_of_subset (δ : ℝ) {E₁ E₂ : Set α} (h : E₁ ⊆ E₂) :
thickening δ E₁ ⊆ thickening δ E₂ := fun _ hx => lt_of_le_of_lt (infEdist_anti h) hx
#align metric.thickening_subset_of_subset Metric.thickening_subset_of_subset
theorem mem_thickening_iff_exists_edist_lt {δ : ℝ} (E : Set α) (x : α) :
x ∈ thickening δ E ↔ ∃ z ∈ E, edist x z < ENNReal.ofReal δ :=
infEdist_lt_iff
#align metric.mem_thickening_iff_exists_edist_lt Metric.mem_thickening_iff_exists_edist_lt
theorem frontier_thickening_subset (E : Set α) {δ : ℝ} :
frontier (thickening δ E) ⊆ { x : α | infEdist x E = ENNReal.ofReal δ } :=
frontier_lt_subset_eq continuous_infEdist continuous_const
#align metric.frontier_thickening_subset Metric.frontier_thickening_subset
theorem frontier_thickening_disjoint (A : Set α) :
Pairwise (Disjoint on fun r : ℝ => frontier (thickening r A)) := by
refine (pairwise_disjoint_on _).2 fun r₁ r₂ hr => ?_
rcases le_total r₁ 0 with h₁ | h₁
· simp [thickening_of_nonpos h₁]
refine ((disjoint_singleton.2 fun h => hr.ne ?_).preimage _).mono (frontier_thickening_subset _)
(frontier_thickening_subset _)
apply_fun ENNReal.toReal at h
rwa [ENNReal.toReal_ofReal h₁, ENNReal.toReal_ofReal (h₁.trans hr.le)] at h
#align metric.frontier_thickening_disjoint Metric.frontier_thickening_disjoint
lemma subset_compl_thickening_compl_thickening_self (δ : ℝ) (E : Set α) :
E ⊆ (thickening δ (thickening δ E)ᶜ)ᶜ := by
intro x x_in_E
simp only [thickening, mem_compl_iff, mem_setOf_eq, not_lt]
apply EMetric.le_infEdist.mpr fun y hy ↦ ?_
simp only [mem_compl_iff, mem_setOf_eq, not_lt] at hy
simpa only [edist_comm] using le_trans hy <| EMetric.infEdist_le_edist_of_mem x_in_E
lemma thickening_compl_thickening_self_subset_compl (δ : ℝ) (E : Set α) :
thickening δ (thickening δ E)ᶜ ⊆ Eᶜ := by
apply compl_subset_compl.mp
simpa only [compl_compl] using subset_compl_thickening_compl_thickening_self δ E
variable {X : Type u} [PseudoMetricSpace X]
-- Porting note (#10756): new lemma
theorem mem_thickening_iff_infDist_lt {E : Set X} {x : X} (h : E.Nonempty) :
x ∈ thickening δ E ↔ infDist x E < δ :=
lt_ofReal_iff_toReal_lt (infEdist_ne_top h)
| Mathlib/Topology/MetricSpace/Thickening.lean | 151 | 154 | theorem mem_thickening_iff {E : Set X} {x : X} : x ∈ thickening δ E ↔ ∃ z ∈ E, dist x z < δ := by |
have key_iff : ∀ z : X, edist x z < ENNReal.ofReal δ ↔ dist x z < δ := fun z ↦ by
rw [dist_edist, lt_ofReal_iff_toReal_lt (edist_ne_top _ _)]
simp_rw [mem_thickening_iff_exists_edist_lt, key_iff]
|
import Mathlib.Order.Interval.Multiset
#align_import data.nat.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
-- TODO
-- assert_not_exists Ring
open Finset Nat
variable (a b c : ℕ)
namespace Nat
instance instLocallyFiniteOrder : LocallyFiniteOrder ℕ where
finsetIcc a b := ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩
finsetIco a b := ⟨List.range' a (b - a), List.nodup_range' _ _⟩
finsetIoc a b := ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩
finsetIoo a b := ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩
finset_mem_Icc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ico a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioc a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
finset_mem_Ioo a b x := by rw [Finset.mem_mk, Multiset.mem_coe, List.mem_range'_1]; omega
theorem Icc_eq_range' : Icc a b = ⟨List.range' a (b + 1 - a), List.nodup_range' _ _⟩ :=
rfl
#align nat.Icc_eq_range' Nat.Icc_eq_range'
theorem Ico_eq_range' : Ico a b = ⟨List.range' a (b - a), List.nodup_range' _ _⟩ :=
rfl
#align nat.Ico_eq_range' Nat.Ico_eq_range'
theorem Ioc_eq_range' : Ioc a b = ⟨List.range' (a + 1) (b - a), List.nodup_range' _ _⟩ :=
rfl
#align nat.Ioc_eq_range' Nat.Ioc_eq_range'
theorem Ioo_eq_range' : Ioo a b = ⟨List.range' (a + 1) (b - a - 1), List.nodup_range' _ _⟩ :=
rfl
#align nat.Ioo_eq_range' Nat.Ioo_eq_range'
theorem uIcc_eq_range' :
uIcc a b = ⟨List.range' (min a b) (max a b + 1 - min a b), List.nodup_range' _ _⟩ := rfl
#align nat.uIcc_eq_range' Nat.uIcc_eq_range'
theorem Iio_eq_range : Iio = range := by
ext b x
rw [mem_Iio, mem_range]
#align nat.Iio_eq_range Nat.Iio_eq_range
@[simp]
theorem Ico_zero_eq_range : Ico 0 = range := by rw [← Nat.bot_eq_zero, ← Iio_eq_Ico, Iio_eq_range]
#align nat.Ico_zero_eq_range Nat.Ico_zero_eq_range
lemma range_eq_Icc_zero_sub_one (n : ℕ) (hn : n ≠ 0): range n = Icc 0 (n - 1) := by
ext b
simp_all only [mem_Icc, zero_le, true_and, mem_range]
exact lt_iff_le_pred (zero_lt_of_ne_zero hn)
theorem _root_.Finset.range_eq_Ico : range = Ico 0 :=
Ico_zero_eq_range.symm
#align finset.range_eq_Ico Finset.range_eq_Ico
@[simp]
theorem card_Icc : (Icc a b).card = b + 1 - a :=
List.length_range' _ _ _
#align nat.card_Icc Nat.card_Icc
@[simp]
theorem card_Ico : (Ico a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ico Nat.card_Ico
@[simp]
theorem card_Ioc : (Ioc a b).card = b - a :=
List.length_range' _ _ _
#align nat.card_Ioc Nat.card_Ioc
@[simp]
theorem card_Ioo : (Ioo a b).card = b - a - 1 :=
List.length_range' _ _ _
#align nat.card_Ioo Nat.card_Ioo
@[simp]
theorem card_uIcc : (uIcc a b).card = (b - a : ℤ).natAbs + 1 :=
(card_Icc _ _).trans $ by rw [← Int.natCast_inj, sup_eq_max, inf_eq_min, Int.ofNat_sub] <;> omega
#align nat.card_uIcc Nat.card_uIcc
@[simp]
lemma card_Iic : (Iic b).card = b + 1 := by rw [Iic_eq_Icc, card_Icc, Nat.bot_eq_zero, Nat.sub_zero]
#align nat.card_Iic Nat.card_Iic
@[simp]
theorem card_Iio : (Iio b).card = b := by rw [Iio_eq_Ico, card_Ico, Nat.bot_eq_zero, Nat.sub_zero]
#align nat.card_Iio Nat.card_Iio
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIcc : Fintype.card (Set.Icc a b) = b + 1 - a := by
rw [Fintype.card_ofFinset, card_Icc]
#align nat.card_fintype_Icc Nat.card_fintypeIcc
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIco : Fintype.card (Set.Ico a b) = b - a := by
rw [Fintype.card_ofFinset, card_Ico]
#align nat.card_fintype_Ico Nat.card_fintypeIco
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem card_fintypeIoc : Fintype.card (Set.Ioc a b) = b - a := by
rw [Fintype.card_ofFinset, card_Ioc]
#align nat.card_fintype_Ioc Nat.card_fintypeIoc
-- Porting note (#10618): simp can prove this
-- @[simp]
| Mathlib/Order/Interval/Finset/Nat.lean | 132 | 133 | theorem card_fintypeIoo : Fintype.card (Set.Ioo a b) = b - a - 1 := by |
rw [Fintype.card_ofFinset, card_Ioo]
|
import Mathlib.CategoryTheory.Sites.Canonical
import Mathlib.CategoryTheory.Sites.Coherent.Basic
import Mathlib.CategoryTheory.Sites.EffectiveEpimorphic
namespace CategoryTheory
variable {C : Type*} [Category C] [Precoherent C]
universe w in
lemma isSheaf_coherent (P : Cᵒᵖ ⥤ Type w) :
Presieve.IsSheaf (coherentTopology C) P ↔
(∀ (B : C) (α : Type) [Finite α] (X : α → C) (π : (a : α) → (X a ⟶ B)),
EffectiveEpiFamily X π → (Presieve.ofArrows X π).IsSheafFor P) := by
constructor
· intro hP B α _ X π h
simp only [coherentTopology, Presieve.isSheaf_coverage] at hP
apply hP
exact ⟨α, inferInstance, X, π, rfl, h⟩
· intro h
simp only [coherentTopology, Presieve.isSheaf_coverage]
rintro B S ⟨α, _, X, π, rfl, hS⟩
exact h _ _ _ _ hS
namespace coherentTopology
| Mathlib/CategoryTheory/Sites/Coherent/CoherentSheaves.lean | 44 | 58 | theorem isSheaf_yoneda_obj (W : C) : Presieve.IsSheaf (coherentTopology C) (yoneda.obj W) := by |
rw [isSheaf_coherent]
intro X α _ Y π H
have h_colim := isColimitOfEffectiveEpiFamilyStruct Y π H.effectiveEpiFamily.some
rw [← Sieve.generateFamily_eq] at h_colim
intro x hx
let x_ext := Presieve.FamilyOfElements.sieveExtend x
have hx_ext := Presieve.FamilyOfElements.Compatible.sieveExtend hx
let S := Sieve.generate (Presieve.ofArrows Y π)
obtain ⟨t, t_amalg, t_uniq⟩ : ∃! t, x_ext.IsAmalgamation t :=
(Sieve.forallYonedaIsSheaf_iff_colimit S).mpr ⟨h_colim⟩ W x_ext hx_ext
refine ⟨t, ?_, ?_⟩
· convert Presieve.isAmalgamation_restrict (Sieve.le_generate (Presieve.ofArrows Y π)) _ _ t_amalg
exact (Presieve.restrict_extend hx).symm
· exact fun y hy ↦ t_uniq y <| Presieve.isAmalgamation_sieveExtend x y hy
|
import Aesop
import Mathlib.Algebra.Group.Defs
import Mathlib.Data.Nat.Defs
import Mathlib.Data.Int.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Cases
import Mathlib.Tactic.SimpRw
import Mathlib.Tactic.SplitIfs
#align_import algebra.group.basic from "leanprover-community/mathlib"@"a07d750983b94c530ab69a726862c2ab6802b38c"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {α β G M : Type*}
@[to_additive]
instance CommMagma.to_isCommutative [CommMagma G] : Std.Commutative (α := G) (· * ·) := ⟨mul_comm⟩
#align comm_semigroup.to_is_commutative CommMagma.to_isCommutative
#align add_comm_semigroup.to_is_commutative AddCommMagma.to_isCommutative
attribute [local simp] mul_assoc sub_eq_add_neg
section DivInvMonoid
variable [DivInvMonoid G] {a b c : G}
@[to_additive, field_simps] -- The attributes are out of order on purpose
theorem inv_eq_one_div (x : G) : x⁻¹ = 1 / x := by rw [div_eq_mul_inv, one_mul]
#align inv_eq_one_div inv_eq_one_div
#align neg_eq_zero_sub neg_eq_zero_sub
@[to_additive]
| Mathlib/Algebra/Group/Basic.lean | 450 | 451 | theorem mul_one_div (x y : G) : x * (1 / y) = x / y := by |
rw [div_eq_mul_inv, one_mul, div_eq_mul_inv]
|
import Mathlib.Data.Finset.Image
#align_import data.finset.card from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
assert_not_exists MonoidWithZero
-- TODO: After a lot more work,
-- assert_not_exists OrderedCommMonoid
open Function Multiset Nat
variable {α β R : Type*}
namespace Finset
variable {s t : Finset α} {a b : α}
def card (s : Finset α) : ℕ :=
Multiset.card s.1
#align finset.card Finset.card
theorem card_def (s : Finset α) : s.card = Multiset.card s.1 :=
rfl
#align finset.card_def Finset.card_def
@[simp] lemma card_val (s : Finset α) : Multiset.card s.1 = s.card := rfl
#align finset.card_val Finset.card_val
@[simp]
theorem card_mk {m nodup} : (⟨m, nodup⟩ : Finset α).card = Multiset.card m :=
rfl
#align finset.card_mk Finset.card_mk
@[simp]
theorem card_empty : card (∅ : Finset α) = 0 :=
rfl
#align finset.card_empty Finset.card_empty
@[gcongr]
theorem card_le_card : s ⊆ t → s.card ≤ t.card :=
Multiset.card_le_card ∘ val_le_iff.mpr
#align finset.card_le_of_subset Finset.card_le_card
@[mono]
theorem card_mono : Monotone (@card α) := by apply card_le_card
#align finset.card_mono Finset.card_mono
@[simp] lemma card_eq_zero : s.card = 0 ↔ s = ∅ := card_eq_zero.trans val_eq_zero
lemma card_ne_zero : s.card ≠ 0 ↔ s.Nonempty := card_eq_zero.ne.trans nonempty_iff_ne_empty.symm
lemma card_pos : 0 < s.card ↔ s.Nonempty := Nat.pos_iff_ne_zero.trans card_ne_zero
#align finset.card_eq_zero Finset.card_eq_zero
#align finset.card_pos Finset.card_pos
alias ⟨_, Nonempty.card_pos⟩ := card_pos
alias ⟨_, Nonempty.card_ne_zero⟩ := card_ne_zero
#align finset.nonempty.card_pos Finset.Nonempty.card_pos
theorem card_ne_zero_of_mem (h : a ∈ s) : s.card ≠ 0 :=
(not_congr card_eq_zero).2 <| ne_empty_of_mem h
#align finset.card_ne_zero_of_mem Finset.card_ne_zero_of_mem
@[simp]
theorem card_singleton (a : α) : card ({a} : Finset α) = 1 :=
Multiset.card_singleton _
#align finset.card_singleton Finset.card_singleton
| Mathlib/Data/Finset/Card.lean | 91 | 94 | theorem card_singleton_inter [DecidableEq α] : ({a} ∩ s).card ≤ 1 := by |
cases' Finset.decidableMem a s with h h
· simp [Finset.singleton_inter_of_not_mem h]
· simp [Finset.singleton_inter_of_mem h]
|
import Mathlib.Data.List.Count
import Mathlib.Data.List.Dedup
import Mathlib.Data.List.InsertNth
import Mathlib.Data.List.Lattice
import Mathlib.Data.List.Permutation
import Mathlib.Data.Nat.Factorial.Basic
#align_import data.list.perm from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
-- Make sure we don't import algebra
assert_not_exists Monoid
open Nat
namespace List
variable {α β : Type*} {l l₁ l₂ : List α} {a : α}
#align list.perm List.Perm
instance : Trans (@List.Perm α) (@List.Perm α) List.Perm where
trans := @List.Perm.trans α
open Perm (swap)
attribute [refl] Perm.refl
#align list.perm.refl List.Perm.refl
lemma perm_rfl : l ~ l := Perm.refl _
-- Porting note: used rec_on in mathlib3; lean4 eqn compiler still doesn't like it
attribute [symm] Perm.symm
#align list.perm.symm List.Perm.symm
#align list.perm_comm List.perm_comm
#align list.perm.swap' List.Perm.swap'
attribute [trans] Perm.trans
#align list.perm.eqv List.Perm.eqv
#align list.is_setoid List.isSetoid
#align list.perm.mem_iff List.Perm.mem_iff
#align list.perm.subset List.Perm.subset
theorem Perm.subset_congr_left {l₁ l₂ l₃ : List α} (h : l₁ ~ l₂) : l₁ ⊆ l₃ ↔ l₂ ⊆ l₃ :=
⟨h.symm.subset.trans, h.subset.trans⟩
#align list.perm.subset_congr_left List.Perm.subset_congr_left
theorem Perm.subset_congr_right {l₁ l₂ l₃ : List α} (h : l₁ ~ l₂) : l₃ ⊆ l₁ ↔ l₃ ⊆ l₂ :=
⟨fun h' => h'.trans h.subset, fun h' => h'.trans h.symm.subset⟩
#align list.perm.subset_congr_right List.Perm.subset_congr_right
#align list.perm.append_right List.Perm.append_right
#align list.perm.append_left List.Perm.append_left
#align list.perm.append List.Perm.append
#align list.perm.append_cons List.Perm.append_cons
#align list.perm_middle List.perm_middle
#align list.perm_append_singleton List.perm_append_singleton
#align list.perm_append_comm List.perm_append_comm
#align list.concat_perm List.concat_perm
#align list.perm.length_eq List.Perm.length_eq
#align list.perm.eq_nil List.Perm.eq_nil
#align list.perm.nil_eq List.Perm.nil_eq
#align list.perm_nil List.perm_nil
#align list.nil_perm List.nil_perm
#align list.not_perm_nil_cons List.not_perm_nil_cons
#align list.reverse_perm List.reverse_perm
#align list.perm_cons_append_cons List.perm_cons_append_cons
#align list.perm_replicate List.perm_replicate
#align list.replicate_perm List.replicate_perm
#align list.perm_singleton List.perm_singleton
#align list.singleton_perm List.singleton_perm
#align list.singleton_perm_singleton List.singleton_perm_singleton
#align list.perm_cons_erase List.perm_cons_erase
#align list.perm_induction_on List.Perm.recOnSwap'
-- Porting note: used to be @[congr]
#align list.perm.filter_map List.Perm.filterMap
-- Porting note: used to be @[congr]
#align list.perm.map List.Perm.map
#align list.perm.pmap List.Perm.pmap
#align list.perm.filter List.Perm.filter
#align list.filter_append_perm List.filter_append_perm
#align list.exists_perm_sublist List.exists_perm_sublist
#align list.perm.sizeof_eq_sizeof List.Perm.sizeOf_eq_sizeOf
section Rel
open Relator
variable {γ : Type*} {δ : Type*} {r : α → β → Prop} {p : γ → δ → Prop}
local infixr:80 " ∘r " => Relation.Comp
theorem perm_comp_perm : (Perm ∘r Perm : List α → List α → Prop) = Perm := by
funext a c; apply propext
constructor
· exact fun ⟨b, hab, hba⟩ => Perm.trans hab hba
· exact fun h => ⟨a, Perm.refl a, h⟩
#align list.perm_comp_perm List.perm_comp_perm
theorem perm_comp_forall₂ {l u v} (hlu : Perm l u) (huv : Forall₂ r u v) :
(Forall₂ r ∘r Perm) l v := by
induction hlu generalizing v with
| nil => cases huv; exact ⟨[], Forall₂.nil, Perm.nil⟩
| cons u _hlu ih =>
cases' huv with _ b _ v hab huv'
rcases ih huv' with ⟨l₂, h₁₂, h₂₃⟩
exact ⟨b :: l₂, Forall₂.cons hab h₁₂, h₂₃.cons _⟩
| swap a₁ a₂ h₂₃ =>
cases' huv with _ b₁ _ l₂ h₁ hr₂₃
cases' hr₂₃ with _ b₂ _ l₂ h₂ h₁₂
exact ⟨b₂ :: b₁ :: l₂, Forall₂.cons h₂ (Forall₂.cons h₁ h₁₂), Perm.swap _ _ _⟩
| trans _ _ ih₁ ih₂ =>
rcases ih₂ huv with ⟨lb₂, hab₂, h₂₃⟩
rcases ih₁ hab₂ with ⟨lb₁, hab₁, h₁₂⟩
exact ⟨lb₁, hab₁, Perm.trans h₁₂ h₂₃⟩
#align list.perm_comp_forall₂ List.perm_comp_forall₂
| Mathlib/Data/List/Perm.lean | 167 | 175 | theorem forall₂_comp_perm_eq_perm_comp_forall₂ : Forall₂ r ∘r Perm = Perm ∘r Forall₂ r := by |
funext l₁ l₃; apply propext
constructor
· intro h
rcases h with ⟨l₂, h₁₂, h₂₃⟩
have : Forall₂ (flip r) l₂ l₁ := h₁₂.flip
rcases perm_comp_forall₂ h₂₃.symm this with ⟨l', h₁, h₂⟩
exact ⟨l', h₂.symm, h₁.flip⟩
· exact fun ⟨l₂, h₁₂, h₂₃⟩ => perm_comp_forall₂ h₁₂ h₂₃
|
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Set.Pointwise.Iterate
import Mathlib.Dynamics.Ergodic.Ergodic
import Mathlib.MeasureTheory.Covering.DensityTheorem
import Mathlib.MeasureTheory.Group.AddCircle
import Mathlib.MeasureTheory.Measure.Haar.Unique
#align_import dynamics.ergodic.add_circle from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655"
open Set Function MeasureTheory MeasureTheory.Measure Filter Metric
open scoped MeasureTheory NNReal ENNReal Topology Pointwise
namespace AddCircle
variable {T : ℝ} [hT : Fact (0 < T)]
theorem ae_empty_or_univ_of_forall_vadd_ae_eq_self {s : Set <| AddCircle T}
(hs : NullMeasurableSet s volume) {ι : Type*} {l : Filter ι} [l.NeBot] {u : ι → AddCircle T}
(hu₁ : ∀ i, (u i +ᵥ s : Set _) =ᵐ[volume] s) (hu₂ : Tendsto (addOrderOf ∘ u) l atTop) :
s =ᵐ[volume] (∅ : Set <| AddCircle T) ∨ s =ᵐ[volume] univ := by
set μ := (volume : Measure <| AddCircle T)
set n : ι → ℕ := addOrderOf ∘ u
have hT₀ : 0 < T := hT.out
have hT₁ : ENNReal.ofReal T ≠ 0 := by simpa
rw [ae_eq_empty, ae_eq_univ_iff_measure_eq hs, AddCircle.measure_univ]
rcases eq_or_ne (μ s) 0 with h | h; · exact Or.inl h
right
obtain ⟨d, -, hd⟩ : ∃ d, d ∈ s ∧ ∀ {ι'} {l : Filter ι'} (w : ι' → AddCircle T) (δ : ι' → ℝ),
Tendsto δ l (𝓝[>] 0) → (∀ᶠ j in l, d ∈ closedBall (w j) (1 * δ j)) →
Tendsto (fun j => μ (s ∩ closedBall (w j) (δ j)) / μ (closedBall (w j) (δ j))) l (𝓝 1) :=
exists_mem_of_measure_ne_zero_of_ae h
(IsUnifLocDoublingMeasure.ae_tendsto_measure_inter_div μ s 1)
let I : ι → Set (AddCircle T) := fun j => closedBall d (T / (2 * ↑(n j)))
replace hd : Tendsto (fun j => μ (s ∩ I j) / μ (I j)) l (𝓝 1) := by
let δ : ι → ℝ := fun j => T / (2 * ↑(n j))
have hδ₀ : ∀ᶠ j in l, 0 < δ j :=
(hu₂.eventually_gt_atTop 0).mono fun j hj => div_pos hT₀ <| by positivity
have hδ₁ : Tendsto δ l (𝓝[>] 0) := by
refine tendsto_nhdsWithin_iff.mpr ⟨?_, hδ₀⟩
replace hu₂ : Tendsto (fun j => T⁻¹ * 2 * n j) l atTop :=
(tendsto_natCast_atTop_iff.mpr hu₂).const_mul_atTop (by positivity : 0 < T⁻¹ * 2)
convert hu₂.inv_tendsto_atTop
ext j
simp only [δ, Pi.inv_apply, mul_inv_rev, inv_inv, div_eq_inv_mul, ← mul_assoc]
have hw : ∀ᶠ j in l, d ∈ closedBall d (1 * δ j) := hδ₀.mono fun j hj => by
simp only [comp_apply, one_mul, mem_closedBall, dist_self]
apply hj.le
exact hd _ δ hδ₁ hw
suffices ∀ᶠ j in l, μ (s ∩ I j) / μ (I j) = μ s / ENNReal.ofReal T by
replace hd := hd.congr' this
rwa [tendsto_const_nhds_iff, ENNReal.div_eq_one_iff hT₁ ENNReal.ofReal_ne_top] at hd
refine (hu₂.eventually_gt_atTop 0).mono fun j hj => ?_
have : addOrderOf (u j) = n j := rfl
have huj : IsOfFinAddOrder (u j) := addOrderOf_pos_iff.mp hj
have huj' : 1 ≤ (↑(n j) : ℝ) := by norm_cast
have hI₀ : μ (I j) ≠ 0 := (measure_closedBall_pos _ d <| by positivity).ne.symm
have hI₁ : μ (I j) ≠ ⊤ := measure_ne_top _ _
have hI₂ : μ (I j) * ↑(n j) = ENNReal.ofReal T := by
rw [volume_closedBall, mul_div, mul_div_mul_left T _ two_ne_zero,
min_eq_right (div_le_self hT₀.le huj'), mul_comm, ← nsmul_eq_mul, ← ENNReal.ofReal_nsmul,
nsmul_eq_mul, mul_div_cancel₀]
exact Nat.cast_ne_zero.mpr hj.ne'
rw [ENNReal.div_eq_div_iff hT₁ ENNReal.ofReal_ne_top hI₀ hI₁,
volume_of_add_preimage_eq s _ (u j) d huj (hu₁ j) closedBall_ae_eq_ball, nsmul_eq_mul, ←
mul_assoc, this, hI₂]
#align add_circle.ae_empty_or_univ_of_forall_vadd_ae_eq_self AddCircle.ae_empty_or_univ_of_forall_vadd_ae_eq_self
| Mathlib/Dynamics/Ergodic/AddCircle.lean | 104 | 120 | theorem ergodic_zsmul {n : ℤ} (hn : 1 < |n|) : Ergodic fun y : AddCircle T => n • y :=
{ measurePreserving_zsmul volume (abs_pos.mp <| lt_trans zero_lt_one hn) with
ae_empty_or_univ := fun s hs hs' => by
let u : ℕ → AddCircle T := fun j => ↑((↑1 : ℝ) / ↑(n.natAbs ^ j) * T)
replace hn : 1 < n.natAbs := by | rwa [Int.abs_eq_natAbs, Nat.one_lt_cast] at hn
have hu₀ : ∀ j, addOrderOf (u j) = n.natAbs ^ j := fun j => by
convert addOrderOf_div_of_gcd_eq_one (p := T) (m := 1)
(pow_pos (pos_of_gt hn) j) (gcd_one_left _)
norm_cast
have hnu : ∀ j, n ^ j • u j = 0 := fun j => by
rw [← addOrderOf_dvd_iff_zsmul_eq_zero, hu₀, Int.natCast_pow, Int.natCast_natAbs, ← abs_pow,
abs_dvd]
have hu₁ : ∀ j, (u j +ᵥ s : Set _) =ᵐ[volume] s := fun j => by
rw [vadd_eq_self_of_preimage_zsmul_eq_self hs' (hnu j)]
have hu₂ : Tendsto (fun j => addOrderOf <| u j) atTop atTop := by
simp_rw [hu₀]; exact Nat.tendsto_pow_atTop_atTop_of_one_lt hn
exact ae_empty_or_univ_of_forall_vadd_ae_eq_self hs.nullMeasurableSet hu₁ hu₂ }
|
import Mathlib.Init.Function
#align_import data.option.n_ary from "leanprover-community/mathlib"@"995b47e555f1b6297c7cf16855f1023e355219fb"
universe u
open Function
namespace Option
variable {α β γ δ : Type*} {f : α → β → γ} {a : Option α} {b : Option β} {c : Option γ}
def map₂ (f : α → β → γ) (a : Option α) (b : Option β) : Option γ :=
a.bind fun a => b.map <| f a
#align option.map₂ Option.map₂
theorem map₂_def {α β γ : Type u} (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = f <$> a <*> b := by
cases a <;> rfl
#align option.map₂_def Option.map₂_def
-- Porting note (#10618): In Lean3, was `@[simp]` but now `simp` can prove it
theorem map₂_some_some (f : α → β → γ) (a : α) (b : β) : map₂ f (some a) (some b) = f a b := rfl
#align option.map₂_some_some Option.map₂_some_some
theorem map₂_coe_coe (f : α → β → γ) (a : α) (b : β) : map₂ f a b = f a b := rfl
#align option.map₂_coe_coe Option.map₂_coe_coe
@[simp]
theorem map₂_none_left (f : α → β → γ) (b : Option β) : map₂ f none b = none := rfl
#align option.map₂_none_left Option.map₂_none_left
@[simp]
theorem map₂_none_right (f : α → β → γ) (a : Option α) : map₂ f a none = none := by cases a <;> rfl
#align option.map₂_none_right Option.map₂_none_right
@[simp]
theorem map₂_coe_left (f : α → β → γ) (a : α) (b : Option β) : map₂ f a b = b.map fun b => f a b :=
rfl
#align option.map₂_coe_left Option.map₂_coe_left
-- Porting note: This proof was `rfl` in Lean3, but now is not.
@[simp]
theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :
map₂ f a b = a.map fun a => f a b := by cases a <;> rfl
#align option.map₂_coe_right Option.map₂_coe_right
-- Porting note: Removed the `@[simp]` tag as membership of an `Option` is no-longer simp-normal.
theorem mem_map₂_iff {c : γ} : c ∈ map₂ f a b ↔ ∃ a' b', a' ∈ a ∧ b' ∈ b ∧ f a' b' = c := by
simp [map₂, bind_eq_some]
#align option.mem_map₂_iff Option.mem_map₂_iff
@[simp]
theorem map₂_eq_none_iff : map₂ f a b = none ↔ a = none ∨ b = none := by
cases a <;> cases b <;> simp
#align option.map₂_eq_none_iff Option.map₂_eq_none_iff
theorem map₂_swap (f : α → β → γ) (a : Option α) (b : Option β) :
map₂ f a b = map₂ (fun a b => f b a) b a := by cases a <;> cases b <;> rfl
#align option.map₂_swap Option.map₂_swap
theorem map_map₂ (f : α → β → γ) (g : γ → δ) :
(map₂ f a b).map g = map₂ (fun a b => g (f a b)) a b := by cases a <;> cases b <;> rfl
#align option.map_map₂ Option.map_map₂
theorem map₂_map_left (f : γ → β → δ) (g : α → γ) :
map₂ f (a.map g) b = map₂ (fun a b => f (g a) b) a b := by cases a <;> rfl
#align option.map₂_map_left Option.map₂_map_left
theorem map₂_map_right (f : α → γ → δ) (g : β → γ) :
map₂ f a (b.map g) = map₂ (fun a b => f a (g b)) a b := by cases b <;> rfl
#align option.map₂_map_right Option.map₂_map_right
@[simp]
theorem map₂_curry (f : α × β → γ) (a : Option α) (b : Option β) :
map₂ (curry f) a b = Option.map f (map₂ Prod.mk a b) := (map_map₂ _ _).symm
#align option.map₂_curry Option.map₂_curry
@[simp]
theorem map_uncurry (f : α → β → γ) (x : Option (α × β)) :
x.map (uncurry f) = map₂ f (x.map Prod.fst) (x.map Prod.snd) := by cases x <;> rfl
#align option.map_uncurry Option.map_uncurry
variable {α' β' δ' ε ε' : Type*}
theorem map₂_assoc {f : δ → γ → ε} {g : α → β → δ} {f' : α → ε' → ε} {g' : β → γ → ε'}
(h_assoc : ∀ a b c, f (g a b) c = f' a (g' b c)) :
map₂ f (map₂ g a b) c = map₂ f' a (map₂ g' b c) := by
cases a <;> cases b <;> cases c <;> simp [h_assoc]
#align option.map₂_assoc Option.map₂_assoc
| Mathlib/Data/Option/NAry.lean | 130 | 131 | theorem map₂_comm {g : β → α → γ} (h_comm : ∀ a b, f a b = g b a) : map₂ f a b = map₂ g b a := by |
cases a <;> cases b <;> simp [h_comm]
|
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Iterate
import Mathlib.Order.SemiconjSup
import Mathlib.Tactic.Monotonicity
import Mathlib.Topology.Order.MonotoneContinuity
#align_import dynamics.circle.rotation_number.translation_number from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical
open Filter Set Int Topology
open Function hiding Commute
structure CircleDeg1Lift extends ℝ →o ℝ : Type where
map_add_one' : ∀ x, toFun (x + 1) = toFun x + 1
#align circle_deg1_lift CircleDeg1Lift
namespace CircleDeg1Lift
instance : FunLike CircleDeg1Lift ℝ ℝ where
coe f := f.toFun
coe_injective' | ⟨⟨_, _⟩, _⟩, ⟨⟨_, _⟩, _⟩, rfl => rfl
instance : OrderHomClass CircleDeg1Lift ℝ ℝ where
map_rel f _ _ h := f.monotone' h
@[simp] theorem coe_mk (f h) : ⇑(mk f h) = f := rfl
#align circle_deg1_lift.coe_mk CircleDeg1Lift.coe_mk
variable (f g : CircleDeg1Lift)
@[simp] theorem coe_toOrderHom : ⇑f.toOrderHom = f := rfl
protected theorem monotone : Monotone f := f.monotone'
#align circle_deg1_lift.monotone CircleDeg1Lift.monotone
@[mono] theorem mono {x y} (h : x ≤ y) : f x ≤ f y := f.monotone h
#align circle_deg1_lift.mono CircleDeg1Lift.mono
theorem strictMono_iff_injective : StrictMono f ↔ Injective f :=
f.monotone.strictMono_iff_injective
#align circle_deg1_lift.strict_mono_iff_injective CircleDeg1Lift.strictMono_iff_injective
@[simp]
theorem map_add_one : ∀ x, f (x + 1) = f x + 1 :=
f.map_add_one'
#align circle_deg1_lift.map_add_one CircleDeg1Lift.map_add_one
@[simp]
| Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean | 167 | 167 | theorem map_one_add (x : ℝ) : f (1 + x) = 1 + f x := by | rw [add_comm, map_add_one, add_comm 1]
|
import Mathlib.Analysis.MeanInequalities
import Mathlib.Analysis.NormedSpace.WithLp
open Real Set Filter RCLike Bornology Uniformity Topology NNReal ENNReal
noncomputable section
variable (p : ℝ≥0∞) (𝕜 α β : Type*)
namespace WithLp
section DistNorm
section EDist
variable [EDist α] [EDist β]
open scoped Classical in
instance instProdEDist : EDist (WithLp p (α × β)) where
edist f g :=
if _hp : p = 0 then
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1)
else if p = ∞ then
edist f.fst g.fst ⊔ edist f.snd g.snd
else
(edist f.fst g.fst ^ p.toReal + edist f.snd g.snd ^ p.toReal) ^ (1 / p.toReal)
variable {p α β}
variable (x y : WithLp p (α × β)) (x' : α × β)
@[simp]
| Mathlib/Analysis/NormedSpace/ProdLp.lean | 161 | 164 | theorem prod_edist_eq_card (f g : WithLp 0 (α × β)) :
edist f g =
(if edist f.fst g.fst = 0 then 0 else 1) + (if edist f.snd g.snd = 0 then 0 else 1) := by |
convert if_pos rfl
|
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ι α : Type*}
namespace Finset
section Preorder
variable [Preorder α]
section LocallyFiniteOrder
variable [LocallyFiniteOrder α] {a a₁ a₂ b b₁ b₂ c x : α}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty ↔ a ≤ b := by
rw [← coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty ↔ a < b := by
rw [← coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
| Mathlib/Order/Interval/Finset/Basic.lean | 73 | 74 | theorem nonempty_Ioo [DenselyOrdered α] : (Ioo a b).Nonempty ↔ a < b := by |
rw [← coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
|
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Data.List.Chain
#align_import data.bool.count from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
namespace List
@[simp]
theorem count_not_add_count (l : List Bool) (b : Bool) : count (!b) l + count b l = length l := by
-- Porting note: Proof re-written
-- Old proof: simp only [length_eq_countP_add_countP (Eq (!b)), Bool.not_not_eq, count]
simp only [length_eq_countP_add_countP (· == !b), count, add_right_inj]
suffices (fun x => x == b) = (fun a => decide ¬(a == !b) = true) by rw [this]
ext x; cases x <;> cases b <;> rfl
#align list.count_bnot_add_count List.count_not_add_count
@[simp]
theorem count_add_count_not (l : List Bool) (b : Bool) : count b l + count (!b) l = length l := by
rw [add_comm, count_not_add_count]
#align list.count_add_count_bnot List.count_add_count_not
@[simp]
theorem count_false_add_count_true (l : List Bool) : count false l + count true l = length l :=
count_not_add_count l true
#align list.count_ff_add_count_tt List.count_false_add_count_true
@[simp]
theorem count_true_add_count_false (l : List Bool) : count true l + count false l = length l :=
count_not_add_count l false
#align list.count_tt_add_count_ff List.count_true_add_count_false
theorem Chain.count_not :
∀ {b : Bool} {l : List Bool}, Chain (· ≠ ·) b l → count (!b) l = count b l + length l % 2
| b, [], _h => rfl
| b, x :: l, h => by
obtain rfl : b = !x := Bool.eq_not_iff.2 (rel_of_chain_cons h)
rw [Bool.not_not, count_cons_self, count_cons_of_ne x.not_ne_self,
Chain.count_not (chain_of_chain_cons h), length, add_assoc, Nat.mod_two_add_succ_mod_two]
#align list.chain.count_bnot List.Chain.count_not
namespace Chain'
variable {l : List Bool}
| Mathlib/Data/Bool/Count.lean | 60 | 71 | theorem count_not_eq_count (hl : Chain' (· ≠ ·) l) (h2 : Even (length l)) (b : Bool) :
count (!b) l = count b l := by |
cases' l with x l
· rfl
rw [length_cons, Nat.even_add_one, Nat.not_even_iff] at h2
suffices count (!x) (x :: l) = count x (x :: l) by
-- Porting note: old proof is
-- cases b <;> cases x <;> try exact this;
cases b <;> cases x <;>
revert this <;> simp only [Bool.not_false, Bool.not_true] <;> intro this <;>
(try exact this) <;> exact this.symm
rw [count_cons_of_ne x.not_ne_self, hl.count_not, h2, count_cons_self]
|
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
import Mathlib.Analysis.Calculus.FDeriv.Extend
import Mathlib.Analysis.Calculus.Deriv.Prod
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.pow.deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Real Topology NNReal ENNReal Filter
open Filter
namespace Real
variable {x y z : ℝ}
theorem hasStrictFDerivAt_rpow_of_pos (p : ℝ × ℝ) (hp : 0 < p.1) :
HasStrictFDerivAt (fun x : ℝ × ℝ => x.1 ^ x.2)
((p.2 * p.1 ^ (p.2 - 1)) • ContinuousLinearMap.fst ℝ ℝ ℝ +
(p.1 ^ p.2 * log p.1) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by
have : (fun x : ℝ × ℝ => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) :=
(continuousAt_fst.eventually (lt_mem_nhds hp)).mono fun p hp => rpow_def_of_pos hp _
refine HasStrictFDerivAt.congr_of_eventuallyEq ?_ this.symm
convert ((hasStrictFDerivAt_fst.log hp.ne').mul hasStrictFDerivAt_snd).exp using 1
rw [rpow_sub_one hp.ne', ← rpow_def_of_pos hp, smul_add, smul_smul, mul_div_left_comm,
div_eq_mul_inv, smul_smul, smul_smul, mul_assoc, add_comm]
#align real.has_strict_fderiv_at_rpow_of_pos Real.hasStrictFDerivAt_rpow_of_pos
theorem hasStrictFDerivAt_rpow_of_neg (p : ℝ × ℝ) (hp : p.1 < 0) :
HasStrictFDerivAt (fun x : ℝ × ℝ => x.1 ^ x.2)
((p.2 * p.1 ^ (p.2 - 1)) • ContinuousLinearMap.fst ℝ ℝ ℝ +
(p.1 ^ p.2 * log p.1 - exp (log p.1 * p.2) * sin (p.2 * π) * π) •
ContinuousLinearMap.snd ℝ ℝ ℝ) p := by
have : (fun x : ℝ × ℝ => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) * cos (x.2 * π) :=
(continuousAt_fst.eventually (gt_mem_nhds hp)).mono fun p hp => rpow_def_of_neg hp _
refine HasStrictFDerivAt.congr_of_eventuallyEq ?_ this.symm
convert ((hasStrictFDerivAt_fst.log hp.ne).mul hasStrictFDerivAt_snd).exp.mul
(hasStrictFDerivAt_snd.mul_const π).cos using 1
simp_rw [rpow_sub_one hp.ne, smul_add, ← add_assoc, smul_smul, ← add_smul, ← mul_assoc,
mul_comm (cos _), ← rpow_def_of_neg hp]
rw [div_eq_mul_inv, add_comm]; congr 2 <;> ring
#align real.has_strict_fderiv_at_rpow_of_neg Real.hasStrictFDerivAt_rpow_of_neg
theorem contDiffAt_rpow_of_ne (p : ℝ × ℝ) (hp : p.1 ≠ 0) {n : ℕ∞} :
ContDiffAt ℝ n (fun p : ℝ × ℝ => p.1 ^ p.2) p := by
cases' hp.lt_or_lt with hneg hpos
exacts
[(((contDiffAt_fst.log hneg.ne).mul contDiffAt_snd).exp.mul
(contDiffAt_snd.mul contDiffAt_const).cos).congr_of_eventuallyEq
((continuousAt_fst.eventually (gt_mem_nhds hneg)).mono fun p hp => rpow_def_of_neg hp _),
((contDiffAt_fst.log hpos.ne').mul contDiffAt_snd).exp.congr_of_eventuallyEq
((continuousAt_fst.eventually (lt_mem_nhds hpos)).mono fun p hp => rpow_def_of_pos hp _)]
#align real.cont_diff_at_rpow_of_ne Real.contDiffAt_rpow_of_ne
theorem differentiableAt_rpow_of_ne (p : ℝ × ℝ) (hp : p.1 ≠ 0) :
DifferentiableAt ℝ (fun p : ℝ × ℝ => p.1 ^ p.2) p :=
(contDiffAt_rpow_of_ne p hp).differentiableAt le_rfl
#align real.differentiable_at_rpow_of_ne Real.differentiableAt_rpow_of_ne
theorem _root_.HasStrictDerivAt.rpow {f g : ℝ → ℝ} {f' g' : ℝ} (hf : HasStrictDerivAt f f' x)
(hg : HasStrictDerivAt g g' x) (h : 0 < f x) : HasStrictDerivAt (fun x => f x ^ g x)
(f' * g x * f x ^ (g x - 1) + g' * f x ^ g x * Real.log (f x)) x := by
convert (hasStrictFDerivAt_rpow_of_pos ((fun x => (f x, g x)) x) h).comp_hasStrictDerivAt x
(hf.prod hg) using 1
simp [mul_assoc, mul_comm, mul_left_comm]
#align has_strict_deriv_at.rpow HasStrictDerivAt.rpow
theorem hasStrictDerivAt_rpow_const_of_ne {x : ℝ} (hx : x ≠ 0) (p : ℝ) :
HasStrictDerivAt (fun x => x ^ p) (p * x ^ (p - 1)) x := by
cases' hx.lt_or_lt with hx hx
· have := (hasStrictFDerivAt_rpow_of_neg (x, p) hx).comp_hasStrictDerivAt x
((hasStrictDerivAt_id x).prod (hasStrictDerivAt_const _ _))
convert this using 1; simp
· simpa using (hasStrictDerivAt_id x).rpow (hasStrictDerivAt_const x p) hx
#align real.has_strict_deriv_at_rpow_const_of_ne Real.hasStrictDerivAt_rpow_const_of_ne
| Mathlib/Analysis/SpecialFunctions/Pow/Deriv.lean | 338 | 340 | theorem hasStrictDerivAt_const_rpow {a : ℝ} (ha : 0 < a) (x : ℝ) :
HasStrictDerivAt (fun x => a ^ x) (a ^ x * log a) x := by |
simpa using (hasStrictDerivAt_const _ _).rpow (hasStrictDerivAt_id x) ha
|
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Data.ENat.Lattice
import Mathlib.Data.Part
import Mathlib.Tactic.NormNum
#align_import data.nat.part_enat from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
open Part hiding some
def PartENat : Type :=
Part ℕ
#align part_enat PartENat
namespace PartENat
@[coe]
def some : ℕ → PartENat :=
Part.some
#align part_enat.some PartENat.some
instance : Zero PartENat :=
⟨some 0⟩
instance : Inhabited PartENat :=
⟨0⟩
instance : One PartENat :=
⟨some 1⟩
instance : Add PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => get x h.1 + get y h.2⟩⟩
instance (n : ℕ) : Decidable (some n).Dom :=
isTrue trivial
@[simp]
theorem dom_some (x : ℕ) : (some x).Dom :=
trivial
#align part_enat.dom_some PartENat.dom_some
instance addCommMonoid : AddCommMonoid PartENat where
add := (· + ·)
zero := 0
add_comm x y := Part.ext' and_comm fun _ _ => add_comm _ _
zero_add x := Part.ext' (true_and_iff _) fun _ _ => zero_add _
add_zero x := Part.ext' (and_true_iff _) fun _ _ => add_zero _
add_assoc x y z := Part.ext' and_assoc fun _ _ => add_assoc _ _ _
nsmul := nsmulRec
instance : AddCommMonoidWithOne PartENat :=
{ PartENat.addCommMonoid with
one := 1
natCast := some
natCast_zero := rfl
natCast_succ := fun _ => Part.ext' (true_and_iff _).symm fun _ _ => rfl }
theorem some_eq_natCast (n : ℕ) : some n = n :=
rfl
#align part_enat.some_eq_coe PartENat.some_eq_natCast
instance : CharZero PartENat where
cast_injective := Part.some_injective
theorem natCast_inj {x y : ℕ} : (x : PartENat) = y ↔ x = y :=
Nat.cast_inj
#align part_enat.coe_inj PartENat.natCast_inj
@[simp]
theorem dom_natCast (x : ℕ) : (x : PartENat).Dom :=
trivial
#align part_enat.dom_coe PartENat.dom_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem dom_ofNat (x : ℕ) [x.AtLeastTwo] : (no_index (OfNat.ofNat x : PartENat)).Dom :=
trivial
@[simp]
theorem dom_zero : (0 : PartENat).Dom :=
trivial
@[simp]
theorem dom_one : (1 : PartENat).Dom :=
trivial
instance : CanLift PartENat ℕ (↑) Dom :=
⟨fun n hn => ⟨n.get hn, Part.some_get _⟩⟩
instance : LE PartENat :=
⟨fun x y => ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy⟩
instance : Top PartENat :=
⟨none⟩
instance : Bot PartENat :=
⟨0⟩
instance : Sup PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => x.get h.1 ⊔ y.get h.2⟩⟩
theorem le_def (x y : PartENat) :
x ≤ y ↔ ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy :=
Iff.rfl
#align part_enat.le_def PartENat.le_def
@[elab_as_elim]
protected theorem casesOn' {P : PartENat → Prop} :
∀ a : PartENat, P ⊤ → (∀ n : ℕ, P (some n)) → P a :=
Part.induction_on
#align part_enat.cases_on' PartENat.casesOn'
@[elab_as_elim]
protected theorem casesOn {P : PartENat → Prop} : ∀ a : PartENat, P ⊤ → (∀ n : ℕ, P n) → P a := by
exact PartENat.casesOn'
#align part_enat.cases_on PartENat.casesOn
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem top_add (x : PartENat) : ⊤ + x = ⊤ :=
Part.ext' (false_and_iff _) fun h => h.left.elim
#align part_enat.top_add PartENat.top_add
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem add_top (x : PartENat) : x + ⊤ = ⊤ := by rw [add_comm, top_add]
#align part_enat.add_top PartENat.add_top
@[simp]
| Mathlib/Data/Nat/PartENat.lean | 179 | 180 | theorem natCast_get {x : PartENat} (h : x.Dom) : (x.get h : PartENat) = x := by |
exact Part.ext' (iff_of_true trivial h) fun _ _ => rfl
|
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Data.Nat.GCD.BigOperators
import Mathlib.Data.Nat.PrimeFin
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Order.Interval.Finset.Nat
#align_import data.nat.factorization.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
-- Workaround for lean4#2038
attribute [-instance] instBEqNat
open Nat Finset List Finsupp
namespace Nat
variable {a b m n p : ℕ}
def factorization (n : ℕ) : ℕ →₀ ℕ where
support := n.primeFactors
toFun p := if p.Prime then padicValNat p n else 0
mem_support_toFun := by simp [not_or]; aesop
#align nat.factorization Nat.factorization
@[simp] lemma support_factorization (n : ℕ) : (factorization n).support = n.primeFactors := rfl
theorem factorization_def (n : ℕ) {p : ℕ} (pp : p.Prime) : n.factorization p = padicValNat p n := by
simpa [factorization] using absurd pp
#align nat.factorization_def Nat.factorization_def
@[simp]
theorem factors_count_eq {n p : ℕ} : n.factors.count p = n.factorization p := by
rcases n.eq_zero_or_pos with (rfl | hn0)
· simp [factorization, count]
if pp : p.Prime then ?_ else
rw [count_eq_zero_of_not_mem (mt prime_of_mem_factors pp)]
simp [factorization, pp]
simp only [factorization_def _ pp]
apply _root_.le_antisymm
· rw [le_padicValNat_iff_replicate_subperm_factors pp hn0.ne']
exact List.le_count_iff_replicate_sublist.mp le_rfl |>.subperm
· rw [← lt_add_one_iff, lt_iff_not_ge, ge_iff_le,
le_padicValNat_iff_replicate_subperm_factors pp hn0.ne']
intro h
have := h.count_le p
simp at this
#align nat.factors_count_eq Nat.factors_count_eq
theorem factorization_eq_factors_multiset (n : ℕ) :
n.factorization = Multiset.toFinsupp (n.factors : Multiset ℕ) := by
ext p
simp
#align nat.factorization_eq_factors_multiset Nat.factorization_eq_factors_multiset
theorem multiplicity_eq_factorization {n p : ℕ} (pp : p.Prime) (hn : n ≠ 0) :
multiplicity p n = n.factorization p := by
simp [factorization, pp, padicValNat_def' pp.ne_one hn.bot_lt]
#align nat.multiplicity_eq_factorization Nat.multiplicity_eq_factorization
@[simp]
theorem factorization_prod_pow_eq_self {n : ℕ} (hn : n ≠ 0) : n.factorization.prod (· ^ ·) = n := by
rw [factorization_eq_factors_multiset n]
simp only [← prod_toMultiset, factorization, Multiset.prod_coe, Multiset.toFinsupp_toMultiset]
exact prod_factors hn
#align nat.factorization_prod_pow_eq_self Nat.factorization_prod_pow_eq_self
theorem eq_of_factorization_eq {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0)
(h : ∀ p : ℕ, a.factorization p = b.factorization p) : a = b :=
eq_of_perm_factors ha hb (by simpa only [List.perm_iff_count, factors_count_eq] using h)
#align nat.eq_of_factorization_eq Nat.eq_of_factorization_eq
theorem factorization_inj : Set.InjOn factorization { x : ℕ | x ≠ 0 } := fun a ha b hb h =>
eq_of_factorization_eq ha hb fun p => by simp [h]
#align nat.factorization_inj Nat.factorization_inj
@[simp]
| Mathlib/Data/Nat/Factorization/Basic.lean | 116 | 116 | theorem factorization_zero : factorization 0 = 0 := by | ext; simp [factorization]
|
import Mathlib.Data.Vector.Basic
import Mathlib.Data.Vector.Snoc
set_option autoImplicit true
namespace Vector
section Fold
section Binary
variable (xs : Vector α n) (ys : Vector β n)
@[simp]
theorem mapAccumr₂_mapAccumr_left (f₁ : γ → β → σ₁ → σ₁ × ζ) (f₂ : α → σ₂ → σ₂ × γ) :
(mapAccumr₂ f₁ (mapAccumr f₂ xs s₂).snd ys s₁)
= let m := (mapAccumr₂ (fun x y s =>
let r₂ := f₂ x s.snd
let r₁ := f₁ r₂.snd y s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs ys (s₁, s₂))
(m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
@[simp]
theorem map₂_map_left (f₁ : γ → β → ζ) (f₂ : α → γ) :
map₂ f₁ (map f₂ xs) ys = map₂ (fun x y => f₁ (f₂ x) y) xs ys := by
induction xs, ys using Vector.revInductionOn₂ <;> simp_all
@[simp]
theorem mapAccumr₂_mapAccumr_right (f₁ : α → γ → σ₁ → σ₁ × ζ) (f₂ : β → σ₂ → σ₂ × γ) :
(mapAccumr₂ f₁ xs (mapAccumr f₂ ys s₂).snd s₁)
= let m := (mapAccumr₂ (fun x y s =>
let r₂ := f₂ y s.snd
let r₁ := f₁ x r₂.snd s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs ys (s₁, s₂))
(m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
@[simp]
theorem map₂_map_right (f₁ : α → γ → ζ) (f₂ : β → γ) :
map₂ f₁ xs (map f₂ ys) = map₂ (fun x y => f₁ x (f₂ y)) xs ys := by
induction xs, ys using Vector.revInductionOn₂ <;> simp_all
@[simp]
theorem mapAccumr_mapAccumr₂ (f₁ : γ → σ₁ → σ₁ × ζ) (f₂ : α → β → σ₂ → σ₂ × γ) :
(mapAccumr f₁ (mapAccumr₂ f₂ xs ys s₂).snd s₁)
= let m := mapAccumr₂ (fun x y s =>
let r₂ := f₂ x y s.snd
let r₁ := f₁ r₂.snd s.fst
((r₁.fst, r₂.fst), r₁.snd)
) xs ys (s₁, s₂)
(m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
@[simp]
theorem map_map₂ (f₁ : γ → ζ) (f₂ : α → β → γ) :
map f₁ (map₂ f₂ xs ys) = map₂ (fun x y => f₁ <| f₂ x y) xs ys := by
induction xs, ys using Vector.revInductionOn₂ <;> simp_all
@[simp]
theorem mapAccumr₂_mapAccumr₂_left_left (f₁ : γ → α → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) :
(mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd xs s₁)
= let m := mapAccumr₂ (fun x y (s₁, s₂) =>
let r₂ := f₂ x y s₂
let r₁ := f₁ r₂.snd x s₁
((r₁.fst, r₂.fst), r₁.snd)
)
xs ys (s₁, s₂)
(m.fst.fst, m.snd) := by
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
@[simp]
| Mathlib/Data/Vector/MapLemmas.lean | 120 | 130 | theorem mapAccumr₂_mapAccumr₂_left_right
(f₁ : γ → β → σ₁ → σ₁ × φ) (f₂ : α → β → σ₂ → σ₂ × γ) :
(mapAccumr₂ f₁ (mapAccumr₂ f₂ xs ys s₂).snd ys s₁)
= let m := mapAccumr₂ (fun x y (s₁, s₂) =>
let r₂ := f₂ x y s₂
let r₁ := f₁ r₂.snd y s₁
((r₁.fst, r₂.fst), r₁.snd)
)
xs ys (s₁, s₂)
(m.fst.fst, m.snd) := by |
induction xs, ys using Vector.revInductionOn₂ generalizing s₁ s₂ <;> simp_all
|
namespace Nat
@[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1
instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1))
theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl
theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id
theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans
theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩
theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by
let t := dvd_gcd (Nat.dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t
theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n :=
H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm])
theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n :=
have H1 : Coprime (gcd (k * m) n) k := by
rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right]
Nat.dvd_antisymm
(dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _))
(gcd_dvd_gcd_mul_left _ _ _)
theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by
rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m]
theorem Coprime.gcd_mul_left_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (k * n) = gcd m n := by
rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n]
theorem Coprime.gcd_mul_right_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (n * k) = gcd m n := by
rw [Nat.mul_comm n k, H.gcd_mul_left_cancel_right n]
| .lake/packages/batteries/Batteries/Data/Nat/Gcd.lean | 57 | 59 | theorem coprime_div_gcd_div_gcd
(H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) := by |
rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H]
|
import Mathlib.Analysis.Complex.Basic
import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle
#align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
open Set
noncomputable section
namespace Complex
theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re :=
⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re
theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im :=
⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩
#align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im
theorem isOpenMap_re : IsOpenMap re :=
isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj
#align complex.is_open_map_re Complex.isOpenMap_re
theorem isOpenMap_im : IsOpenMap im :=
isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj
#align complex.is_open_map_im Complex.isOpenMap_im
theorem quotientMap_re : QuotientMap re :=
isHomeomorphicTrivialFiberBundle_re.quotientMap_proj
#align complex.quotient_map_re Complex.quotientMap_re
theorem quotientMap_im : QuotientMap im :=
isHomeomorphicTrivialFiberBundle_im.quotientMap_proj
#align complex.quotient_map_im Complex.quotientMap_im
theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s :=
(isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm
#align complex.interior_preimage_re Complex.interior_preimage_re
theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s :=
(isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm
#align complex.interior_preimage_im Complex.interior_preimage_im
theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s :=
(isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm
#align complex.closure_preimage_re Complex.closure_preimage_re
theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s :=
(isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm
#align complex.closure_preimage_im Complex.closure_preimage_im
theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s :=
(isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm
#align complex.frontier_preimage_re Complex.frontier_preimage_re
theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s :=
(isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm
#align complex.frontier_preimage_im Complex.frontier_preimage_im
@[simp]
theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by
simpa only [interior_Iic] using interior_preimage_re (Iic a)
#align complex.interior_set_of_re_le Complex.interior_setOf_re_le
@[simp]
| Mathlib/Analysis/Complex/ReImTopology.lean | 99 | 100 | theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by |
simpa only [interior_Iic] using interior_preimage_im (Iic a)
|
import Mathlib.MeasureTheory.Integral.Lebesgue
open Set hiding restrict restrict_apply
open Filter ENNReal NNReal MeasureTheory.Measure
namespace MeasureTheory
variable {α : Type*} {m0 : MeasurableSpace α} {μ : Measure α}
noncomputable
def Measure.withDensity {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : Measure α :=
Measure.ofMeasurable (fun s _ => ∫⁻ a in s, f a ∂μ) (by simp) fun s hs hd =>
lintegral_iUnion hs hd _
#align measure_theory.measure.with_density MeasureTheory.Measure.withDensity
@[simp]
theorem withDensity_apply (f : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s) :
μ.withDensity f s = ∫⁻ a in s, f a ∂μ :=
Measure.ofMeasurable_apply s hs
#align measure_theory.with_density_apply MeasureTheory.withDensity_apply
theorem withDensity_apply_le (f : α → ℝ≥0∞) (s : Set α) :
∫⁻ a in s, f a ∂μ ≤ μ.withDensity f s := by
let t := toMeasurable (μ.withDensity f) s
calc
∫⁻ a in s, f a ∂μ ≤ ∫⁻ a in t, f a ∂μ :=
lintegral_mono_set (subset_toMeasurable (withDensity μ f) s)
_ = μ.withDensity f t :=
(withDensity_apply f (measurableSet_toMeasurable (withDensity μ f) s)).symm
_ = μ.withDensity f s := measure_toMeasurable s
theorem withDensity_apply' [SFinite μ] (f : α → ℝ≥0∞) (s : Set α) :
μ.withDensity f s = ∫⁻ a in s, f a ∂μ := by
apply le_antisymm ?_ (withDensity_apply_le f s)
let t := toMeasurable μ s
calc
μ.withDensity f s ≤ μ.withDensity f t := measure_mono (subset_toMeasurable μ s)
_ = ∫⁻ a in t, f a ∂μ := withDensity_apply f (measurableSet_toMeasurable μ s)
_ = ∫⁻ a in s, f a ∂μ := by congr 1; exact restrict_toMeasurable_of_sFinite s
@[simp]
lemma withDensity_zero_left (f : α → ℝ≥0∞) : (0 : Measure α).withDensity f = 0 := by
ext s hs
rw [withDensity_apply _ hs]
simp
theorem withDensity_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) :
μ.withDensity f = μ.withDensity g := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
exact lintegral_congr_ae (ae_restrict_of_ae h)
#align measure_theory.with_density_congr_ae MeasureTheory.withDensity_congr_ae
lemma withDensity_mono {f g : α → ℝ≥0∞} (hfg : f ≤ᵐ[μ] g) :
μ.withDensity f ≤ μ.withDensity g := by
refine le_iff.2 fun s hs ↦ ?_
rw [withDensity_apply _ hs, withDensity_apply _ hs]
refine set_lintegral_mono_ae' hs ?_
filter_upwards [hfg] with x h_le using fun _ ↦ h_le
theorem withDensity_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) :
μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs,
← lintegral_add_left hf]
simp only [Pi.add_apply]
#align measure_theory.with_density_add_left MeasureTheory.withDensity_add_left
theorem withDensity_add_right (f : α → ℝ≥0∞) {g : α → ℝ≥0∞} (hg : Measurable g) :
μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by
simpa only [add_comm] using withDensity_add_left hg f
#align measure_theory.with_density_add_right MeasureTheory.withDensity_add_right
theorem withDensity_add_measure {m : MeasurableSpace α} (μ ν : Measure α) (f : α → ℝ≥0∞) :
(μ + ν).withDensity f = μ.withDensity f + ν.withDensity f := by
ext1 s hs
simp only [withDensity_apply f hs, restrict_add, lintegral_add_measure, Measure.add_apply]
#align measure_theory.with_density_add_measure MeasureTheory.withDensity_add_measure
theorem withDensity_sum {ι : Type*} {m : MeasurableSpace α} (μ : ι → Measure α) (f : α → ℝ≥0∞) :
(sum μ).withDensity f = sum fun n => (μ n).withDensity f := by
ext1 s hs
simp_rw [sum_apply _ hs, withDensity_apply f hs, restrict_sum μ hs, lintegral_sum_measure]
#align measure_theory.with_density_sum MeasureTheory.withDensity_sum
| Mathlib/MeasureTheory/Measure/WithDensity.lean | 122 | 127 | theorem withDensity_smul (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : Measurable f) :
μ.withDensity (r • f) = r • μ.withDensity f := by |
refine Measure.ext fun s hs => ?_
rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs,
smul_eq_mul, ← lintegral_const_mul r hf]
simp only [Pi.smul_apply, smul_eq_mul]
|
import Mathlib.Topology.Sets.Closeds
#align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
variable (α β : Type*) [TopologicalSpace α] [TopologicalSpace β]
namespace TopologicalSpace
@[mk_iff]
class NoetherianSpace : Prop where
wellFounded_opens : WellFounded ((· > ·) : Opens α → Opens α → Prop)
#align topological_space.noetherian_space TopologicalSpace.NoetherianSpace
theorem noetherianSpace_iff_opens : NoetherianSpace α ↔ ∀ s : Opens α, IsCompact (s : Set α) := by
rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact,
CompleteLattice.isSupFiniteCompact_iff_all_elements_compact]
exact forall_congr' Opens.isCompactElement_iff
#align topological_space.noetherian_space_iff_opens TopologicalSpace.noetherianSpace_iff_opens
instance (priority := 100) NoetherianSpace.compactSpace [h : NoetherianSpace α] : CompactSpace α :=
⟨(noetherianSpace_iff_opens α).mp h ⊤⟩
#align topological_space.noetherian_space.compact_space TopologicalSpace.NoetherianSpace.compactSpace
variable {α β}
protected theorem NoetherianSpace.isCompact [NoetherianSpace α] (s : Set α) : IsCompact s := by
refine isCompact_iff_finite_subcover.2 fun U hUo hs => ?_
rcases ((noetherianSpace_iff_opens α).mp ‹_› ⟨⋃ i, U i, isOpen_iUnion hUo⟩).elim_finite_subcover U
hUo Set.Subset.rfl with ⟨t, ht⟩
exact ⟨t, hs.trans ht⟩
#align topological_space.noetherian_space.is_compact TopologicalSpace.NoetherianSpace.isCompact
-- Porting note: fixed NS
protected theorem _root_.Inducing.noetherianSpace [NoetherianSpace α] {i : β → α}
(hi : Inducing i) : NoetherianSpace β :=
(noetherianSpace_iff_opens _).2 fun _ => hi.isCompact_iff.2 (NoetherianSpace.isCompact _)
#align topological_space.inducing.noetherian_space Inducing.noetherianSpace
instance NoetherianSpace.set [NoetherianSpace α] (s : Set α) : NoetherianSpace s :=
inducing_subtype_val.noetherianSpace
#align topological_space.noetherian_space.set TopologicalSpace.NoetherianSpace.set
variable (α)
open List in
| Mathlib/Topology/NoetherianSpace.lean | 87 | 101 | theorem noetherianSpace_TFAE :
TFAE [NoetherianSpace α,
WellFounded fun s t : Closeds α => s < t,
∀ s : Set α, IsCompact s,
∀ s : Opens α, IsCompact (s : Set α)] := by |
tfae_have 1 ↔ 2
· refine (noetherianSpace_iff α).trans (Opens.compl_bijective.2.wellFounded_iff ?_)
exact (@OrderIso.compl (Set α)).lt_iff_lt.symm
tfae_have 1 ↔ 4
· exact noetherianSpace_iff_opens α
tfae_have 1 → 3
· exact @NoetherianSpace.isCompact α _
tfae_have 3 → 4
· exact fun h s => h s
tfae_finish
|
import Mathlib.Mathport.Rename
set_option autoImplicit true
namespace Thunk
#align thunk.mk Thunk.mk
-- Porting note: Added `Thunk.ext` to get `ext` tactic to work.
@[ext]
| Mathlib/Lean/Thunk.lean | 20 | 24 | theorem ext {α : Type u} {a b : Thunk α} (eq : a.get = b.get) : a = b := by |
have ⟨_⟩ := a
have ⟨_⟩ := b
congr
exact funext fun _ ↦ eq
|
import Mathlib.Algebra.ContinuedFractions.Computation.ApproximationCorollaries
import Mathlib.Algebra.ContinuedFractions.Computation.Translations
import Mathlib.Data.Real.Irrational
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.Basic
#align_import number_theory.diophantine_approximation from "leanprover-community/mathlib"@"e25a317463bd37d88e33da164465d8c47922b1cd"
namespace Real
section Dirichlet
open Finset Int
| Mathlib/NumberTheory/DiophantineApproximation.lean | 93 | 132 | theorem exists_int_int_abs_mul_sub_le (ξ : ℝ) {n : ℕ} (n_pos : 0 < n) :
∃ j k : ℤ, 0 < k ∧ k ≤ n ∧ |↑k * ξ - j| ≤ 1 / (n + 1) := by |
let f : ℤ → ℤ := fun m => ⌊fract (ξ * m) * (n + 1)⌋
have hn : 0 < (n : ℝ) + 1 := mod_cast Nat.succ_pos _
have hfu := fun m : ℤ => mul_lt_of_lt_one_left hn <| fract_lt_one (ξ * ↑m)
conv in |_| ≤ _ => rw [mul_comm, le_div_iff hn, ← abs_of_pos hn, ← abs_mul]
let D := Icc (0 : ℤ) n
by_cases H : ∃ m ∈ D, f m = n
· obtain ⟨m, hm, hf⟩ := H
have hf' : ((n : ℤ) : ℝ) ≤ fract (ξ * m) * (n + 1) := hf ▸ floor_le (fract (ξ * m) * (n + 1))
have hm₀ : 0 < m := by
have hf₀ : f 0 = 0 := by
-- Porting note: was
-- simp only [floor_eq_zero_iff, algebraMap.coe_zero, mul_zero, fract_zero,
-- zero_mul, Set.left_mem_Ico, zero_lt_one]
simp only [f, cast_zero, mul_zero, fract_zero, zero_mul, floor_zero]
refine Ne.lt_of_le (fun h => n_pos.ne ?_) (mem_Icc.mp hm).1
exact mod_cast hf₀.symm.trans (h.symm ▸ hf : f 0 = n)
refine ⟨⌊ξ * m⌋ + 1, m, hm₀, (mem_Icc.mp hm).2, ?_⟩
rw [cast_add, ← sub_sub, sub_mul, cast_one, one_mul, abs_le]
refine
⟨le_sub_iff_add_le.mpr ?_, sub_le_iff_le_add.mpr <| le_of_lt <| (hfu m).trans <| lt_one_add _⟩
simpa only [neg_add_cancel_comm_assoc] using hf'
· -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5127): added `not_and`
simp_rw [not_exists, not_and] at H
have hD : (Ico (0 : ℤ) n).card < D.card := by rw [card_Icc, card_Ico]; exact lt_add_one n
have hfu' : ∀ m, f m ≤ n := fun m => lt_add_one_iff.mp (floor_lt.mpr (mod_cast hfu m))
have hwd : ∀ m : ℤ, m ∈ D → f m ∈ Ico (0 : ℤ) n := fun x hx =>
mem_Ico.mpr
⟨floor_nonneg.mpr (mul_nonneg (fract_nonneg (ξ * x)) hn.le), Ne.lt_of_le (H x hx) (hfu' x)⟩
obtain ⟨x, hx, y, hy, x_lt_y, hxy⟩ : ∃ x ∈ D, ∃ y ∈ D, x < y ∧ f x = f y := by
obtain ⟨x, hx, y, hy, x_ne_y, hxy⟩ := exists_ne_map_eq_of_card_lt_of_maps_to hD hwd
rcases lt_trichotomy x y with (h | h | h)
exacts [⟨x, hx, y, hy, h, hxy⟩, False.elim (x_ne_y h), ⟨y, hy, x, hx, h, hxy.symm⟩]
refine
⟨⌊ξ * y⌋ - ⌊ξ * x⌋, y - x, sub_pos_of_lt x_lt_y,
sub_le_iff_le_add.mpr <| le_add_of_le_of_nonneg (mem_Icc.mp hy).2 (mem_Icc.mp hx).1, ?_⟩
convert_to |fract (ξ * y) * (n + 1) - fract (ξ * x) * (n + 1)| ≤ 1
· congr; push_cast; simp only [fract]; ring
exact (abs_sub_lt_one_of_floor_eq_floor hxy.symm).le
|
import Mathlib.CategoryTheory.Comma.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Yoneda
import Mathlib.Data.Set.Lattice
import Mathlib.Order.CompleteLattice
#align_import category_theory.sites.sieves from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a"
universe v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory
open Category Limits
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D)
variable {X Y Z : C} (f : Y ⟶ X)
def Presieve (X : C) :=
∀ ⦃Y⦄, Set (Y ⟶ X)-- deriving CompleteLattice
#align category_theory.presieve CategoryTheory.Presieve
instance : CompleteLattice (Presieve X) := by
dsimp [Presieve]
infer_instance
namespace Presieve
noncomputable instance : Inhabited (Presieve X) :=
⟨⊤⟩
abbrev category {X : C} (P : Presieve X) :=
FullSubcategory fun f : Over X => P f.hom
abbrev categoryMk {X : C} (P : Presieve X) {Y : C} (f : Y ⟶ X) (hf : P f) : P.category :=
⟨Over.mk f, hf⟩
abbrev diagram (S : Presieve X) : S.category ⥤ C :=
fullSubcategoryInclusion _ ⋙ Over.forget X
#align category_theory.presieve.diagram CategoryTheory.Presieve.diagram
abbrev cocone (S : Presieve X) : Cocone S.diagram :=
(Over.forgetCocone X).whisker (fullSubcategoryInclusion _)
#align category_theory.presieve.cocone CategoryTheory.Presieve.cocone
def bind (S : Presieve X) (R : ∀ ⦃Y⦄ ⦃f : Y ⟶ X⦄, S f → Presieve Y) : Presieve X := fun Z h =>
∃ (Y : C) (g : Z ⟶ Y) (f : Y ⟶ X) (H : S f), R H g ∧ g ≫ f = h
#align category_theory.presieve.bind CategoryTheory.Presieve.bind
@[simp]
theorem bind_comp {S : Presieve X} {R : ∀ ⦃Y : C⦄ ⦃f : Y ⟶ X⦄, S f → Presieve Y} {g : Z ⟶ Y}
(h₁ : S f) (h₂ : R h₁ g) : bind S R (g ≫ f) :=
⟨_, _, _, h₁, h₂, rfl⟩
#align category_theory.presieve.bind_comp CategoryTheory.Presieve.bind_comp
-- Porting note: it seems the definition of `Presieve` must be unfolded in order to define
-- this inductive type, it was thus renamed `singleton'`
-- Note we can't make this into `HasSingleton` because of the out-param.
inductive singleton' : ⦃Y : C⦄ → (Y ⟶ X) → Prop
| mk : singleton' f
def singleton : Presieve X := singleton' f
lemma singleton.mk {f : Y ⟶ X} : singleton f f := singleton'.mk
#align category_theory.presieve.singleton CategoryTheory.Presieve.singleton
@[simp]
theorem singleton_eq_iff_domain (f g : Y ⟶ X) : singleton f g ↔ f = g := by
constructor
· rintro ⟨a, rfl⟩
rfl
· rintro rfl
apply singleton.mk
#align category_theory.presieve.singleton_eq_iff_domain CategoryTheory.Presieve.singleton_eq_iff_domain
theorem singleton_self : singleton f f :=
singleton.mk
#align category_theory.presieve.singleton_self CategoryTheory.Presieve.singleton_self
inductive pullbackArrows [HasPullbacks C] (R : Presieve X) : Presieve Y
| mk (Z : C) (h : Z ⟶ X) : R h → pullbackArrows _ (pullback.snd : pullback h f ⟶ Y)
#align category_theory.presieve.pullback_arrows CategoryTheory.Presieve.pullbackArrows
theorem pullback_singleton [HasPullbacks C] (g : Z ⟶ X) :
pullbackArrows f (singleton g) = singleton (pullback.snd : pullback g f ⟶ _) := by
funext W
ext h
constructor
· rintro ⟨W, _, _, _⟩
exact singleton.mk
· rintro ⟨_⟩
exact pullbackArrows.mk Z g singleton.mk
#align category_theory.presieve.pullback_singleton CategoryTheory.Presieve.pullback_singleton
inductive ofArrows {ι : Type*} (Y : ι → C) (f : ∀ i, Y i ⟶ X) : Presieve X
| mk (i : ι) : ofArrows _ _ (f i)
#align category_theory.presieve.of_arrows CategoryTheory.Presieve.ofArrows
theorem ofArrows_pUnit : (ofArrows _ fun _ : PUnit => f) = singleton f := by
funext Y
ext g
constructor
· rintro ⟨_⟩
apply singleton.mk
· rintro ⟨_⟩
exact ofArrows.mk PUnit.unit
#align category_theory.presieve.of_arrows_punit CategoryTheory.Presieve.ofArrows_pUnit
theorem ofArrows_pullback [HasPullbacks C] {ι : Type*} (Z : ι → C) (g : ∀ i : ι, Z i ⟶ X) :
(ofArrows (fun i => pullback (g i) f) fun i => pullback.snd) =
pullbackArrows f (ofArrows Z g) := by
funext T
ext h
constructor
· rintro ⟨hk⟩
exact pullbackArrows.mk _ _ (ofArrows.mk hk)
· rintro ⟨W, k, hk₁⟩
cases' hk₁ with i hi
apply ofArrows.mk
#align category_theory.presieve.of_arrows_pullback CategoryTheory.Presieve.ofArrows_pullback
| Mathlib/CategoryTheory/Sites/Sieves.lean | 164 | 176 | theorem ofArrows_bind {ι : Type*} (Z : ι → C) (g : ∀ i : ι, Z i ⟶ X)
(j : ∀ ⦃Y⦄ (f : Y ⟶ X), ofArrows Z g f → Type*) (W : ∀ ⦃Y⦄ (f : Y ⟶ X) (H), j f H → C)
(k : ∀ ⦃Y⦄ (f : Y ⟶ X) (H i), W f H i ⟶ Y) :
((ofArrows Z g).bind fun Y f H => ofArrows (W f H) (k f H)) =
ofArrows (fun i : Σi, j _ (ofArrows.mk i) => W (g i.1) _ i.2) fun ij =>
k (g ij.1) _ ij.2 ≫ g ij.1 := by |
funext Y
ext f
constructor
· rintro ⟨_, _, _, ⟨i⟩, ⟨i'⟩, rfl⟩
exact ofArrows.mk (Sigma.mk _ _)
· rintro ⟨i⟩
exact bind_comp _ (ofArrows.mk _) (ofArrows.mk _)
|
import Mathlib.Data.List.Lattice
import Mathlib.Data.List.Range
import Mathlib.Data.Bool.Basic
#align_import data.list.intervals from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open Nat
namespace List
def Ico (n m : ℕ) : List ℕ :=
range' n (m - n)
#align list.Ico List.Ico
namespace Ico
theorem zero_bot (n : ℕ) : Ico 0 n = range n := by rw [Ico, Nat.sub_zero, range_eq_range']
#align list.Ico.zero_bot List.Ico.zero_bot
@[simp]
theorem length (n m : ℕ) : length (Ico n m) = m - n := by
dsimp [Ico]
simp [length_range', autoParam]
#align list.Ico.length List.Ico.length
theorem pairwise_lt (n m : ℕ) : Pairwise (· < ·) (Ico n m) := by
dsimp [Ico]
simp [pairwise_lt_range', autoParam]
#align list.Ico.pairwise_lt List.Ico.pairwise_lt
theorem nodup (n m : ℕ) : Nodup (Ico n m) := by
dsimp [Ico]
simp [nodup_range', autoParam]
#align list.Ico.nodup List.Ico.nodup
@[simp]
theorem mem {n m l : ℕ} : l ∈ Ico n m ↔ n ≤ l ∧ l < m := by
suffices n ≤ l ∧ l < n + (m - n) ↔ n ≤ l ∧ l < m by simp [Ico, this]
rcases le_total n m with hnm | hmn
· rw [Nat.add_sub_cancel' hnm]
· rw [Nat.sub_eq_zero_iff_le.mpr hmn, Nat.add_zero]
exact
and_congr_right fun hnl =>
Iff.intro (fun hln => (not_le_of_gt hln hnl).elim) fun hlm => lt_of_lt_of_le hlm hmn
#align list.Ico.mem List.Ico.mem
theorem eq_nil_of_le {n m : ℕ} (h : m ≤ n) : Ico n m = [] := by
simp [Ico, Nat.sub_eq_zero_iff_le.mpr h]
#align list.Ico.eq_nil_of_le List.Ico.eq_nil_of_le
theorem map_add (n m k : ℕ) : (Ico n m).map (k + ·) = Ico (n + k) (m + k) := by
rw [Ico, Ico, map_add_range', Nat.add_sub_add_right m k, Nat.add_comm n k]
#align list.Ico.map_add List.Ico.map_add
theorem map_sub (n m k : ℕ) (h₁ : k ≤ n) :
((Ico n m).map fun x => x - k) = Ico (n - k) (m - k) := by
rw [Ico, Ico, Nat.sub_sub_sub_cancel_right h₁, map_sub_range' _ _ _ h₁]
#align list.Ico.map_sub List.Ico.map_sub
@[simp]
theorem self_empty {n : ℕ} : Ico n n = [] :=
eq_nil_of_le (le_refl n)
#align list.Ico.self_empty List.Ico.self_empty
@[simp]
theorem eq_empty_iff {n m : ℕ} : Ico n m = [] ↔ m ≤ n :=
Iff.intro (fun h => Nat.sub_eq_zero_iff_le.mp <| by rw [← length, h, List.length]) eq_nil_of_le
#align list.Ico.eq_empty_iff List.Ico.eq_empty_iff
theorem append_consecutive {n m l : ℕ} (hnm : n ≤ m) (hml : m ≤ l) :
Ico n m ++ Ico m l = Ico n l := by
dsimp only [Ico]
convert range'_append n (m-n) (l-m) 1 using 2
· rw [Nat.one_mul, Nat.add_sub_cancel' hnm]
· rw [Nat.sub_add_sub_cancel hml hnm]
#align list.Ico.append_consecutive List.Ico.append_consecutive
@[simp]
theorem inter_consecutive (n m l : ℕ) : Ico n m ∩ Ico m l = [] := by
apply eq_nil_iff_forall_not_mem.2
intro a
simp only [and_imp, not_and, not_lt, List.mem_inter_iff, List.Ico.mem]
intro _ h₂ h₃
exfalso
exact not_lt_of_ge h₃ h₂
#align list.Ico.inter_consecutive List.Ico.inter_consecutive
@[simp]
theorem bagInter_consecutive (n m l : Nat) :
@List.bagInter ℕ instBEqOfDecidableEq (Ico n m) (Ico m l) = [] :=
(bagInter_nil_iff_inter_nil _ _).2 (by convert inter_consecutive n m l)
#align list.Ico.bag_inter_consecutive List.Ico.bagInter_consecutive
@[simp]
theorem succ_singleton {n : ℕ} : Ico n (n + 1) = [n] := by
dsimp [Ico]
simp [range', Nat.add_sub_cancel_left]
#align list.Ico.succ_singleton List.Ico.succ_singleton
theorem succ_top {n m : ℕ} (h : n ≤ m) : Ico n (m + 1) = Ico n m ++ [m] := by
rwa [← succ_singleton, append_consecutive]
exact Nat.le_succ _
#align list.Ico.succ_top List.Ico.succ_top
theorem eq_cons {n m : ℕ} (h : n < m) : Ico n m = n :: Ico (n + 1) m := by
rw [← append_consecutive (Nat.le_succ n) h, succ_singleton]
rfl
#align list.Ico.eq_cons List.Ico.eq_cons
@[simp]
theorem pred_singleton {m : ℕ} (h : 0 < m) : Ico (m - 1) m = [m - 1] := by
dsimp [Ico]
rw [Nat.sub_sub_self (succ_le_of_lt h)]
simp [← Nat.one_eq_succ_zero]
#align list.Ico.pred_singleton List.Ico.pred_singleton
| Mathlib/Data/List/Intervals.lean | 143 | 148 | theorem chain'_succ (n m : ℕ) : Chain' (fun a b => b = succ a) (Ico n m) := by |
by_cases h : n < m
· rw [eq_cons h]
exact chain_succ_range' _ _ 1
· rw [eq_nil_of_le (le_of_not_gt h)]
trivial
|
import Mathlib.MeasureTheory.Integral.IntegrableOn
#align_import measure_theory.function.locally_integrable from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
open MeasureTheory MeasureTheory.Measure Set Function TopologicalSpace Bornology
open scoped Topology Interval ENNReal
variable {X Y E F R : Type*} [MeasurableSpace X] [TopologicalSpace X]
variable [MeasurableSpace Y] [TopologicalSpace Y]
variable [NormedAddCommGroup E] [NormedAddCommGroup F] {f g : X → E} {μ : Measure X} {s : Set X}
namespace MeasureTheory
section LocallyIntegrableOn
def LocallyIntegrableOn (f : X → E) (s : Set X) (μ : Measure X := by volume_tac) : Prop :=
∀ x : X, x ∈ s → IntegrableAtFilter f (𝓝[s] x) μ
#align measure_theory.locally_integrable_on MeasureTheory.LocallyIntegrableOn
theorem LocallyIntegrableOn.mono_set (hf : LocallyIntegrableOn f s μ) {t : Set X}
(hst : t ⊆ s) : LocallyIntegrableOn f t μ := fun x hx =>
(hf x <| hst hx).filter_mono (nhdsWithin_mono x hst)
#align measure_theory.locally_integrable_on.mono MeasureTheory.LocallyIntegrableOn.mono_set
theorem LocallyIntegrableOn.norm (hf : LocallyIntegrableOn f s μ) :
LocallyIntegrableOn (fun x => ‖f x‖) s μ := fun t ht =>
let ⟨U, hU_nhd, hU_int⟩ := hf t ht
⟨U, hU_nhd, hU_int.norm⟩
#align measure_theory.locally_integrable_on.norm MeasureTheory.LocallyIntegrableOn.norm
| Mathlib/MeasureTheory/Function/LocallyIntegrable.lean | 57 | 62 | theorem LocallyIntegrableOn.mono (hf : LocallyIntegrableOn f s μ) {g : X → F}
(hg : AEStronglyMeasurable g μ) (h : ∀ᵐ x ∂μ, ‖g x‖ ≤ ‖f x‖) :
LocallyIntegrableOn g s μ := by |
intro x hx
rcases hf x hx with ⟨t, t_mem, ht⟩
exact ⟨t, t_mem, Integrable.mono ht hg.restrict (ae_restrict_of_ae h)⟩
|
import Mathlib.MeasureTheory.Measure.GiryMonad
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.MeasureTheory.Integral.Lebesgue
import Mathlib.MeasureTheory.Measure.OpenPos
#align_import measure_theory.constructions.prod.basic from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
noncomputable section
open scoped Classical
open Topology ENNReal MeasureTheory
open Set Function Real ENNReal
open MeasureTheory MeasurableSpace MeasureTheory.Measure
open TopologicalSpace hiding generateFrom
open Filter hiding prod_eq map
variable {α α' β β' γ E : Type*}
theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C)
(hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) := by
rintro _ ⟨s₁, hs₁, t₁, ht₁, rfl⟩ _ ⟨s₂, hs₂, t₂, ht₂, rfl⟩ hst
rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst
exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
#align is_pi_system.prod IsPiSystem.prod
theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C)
(hD : IsCountablySpanning D) : IsCountablySpanning (image2 (· ×ˢ ·) C D) := by
rcases hC, hD with ⟨⟨s, h1s, h2s⟩, t, h1t, h2t⟩
refine ⟨fun n => s n.unpair.1 ×ˢ t n.unpair.2, fun n => mem_image2_of_mem (h1s _) (h1t _), ?_⟩
rw [iUnion_unpair_prod, h2s, h2t, univ_prod_univ]
#align is_countably_spanning.prod IsCountablySpanning.prod
variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β']
variable [MeasurableSpace γ]
variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ}
variable [NormedAddCommGroup E]
theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C)
(hD : IsCountablySpanning D) :
@Prod.instMeasurableSpace _ _ (generateFrom C) (generateFrom D) =
generateFrom (image2 (· ×ˢ ·) C D) := by
apply le_antisymm
· refine sup_le ?_ ?_ <;> rw [comap_generateFrom] <;> apply generateFrom_le <;>
rintro _ ⟨s, hs, rfl⟩
· rcases hD with ⟨t, h1t, h2t⟩
rw [← prod_univ, ← h2t, prod_iUnion]
apply MeasurableSet.iUnion
intro n
apply measurableSet_generateFrom
exact ⟨s, hs, t n, h1t n, rfl⟩
· rcases hC with ⟨t, h1t, h2t⟩
rw [← univ_prod, ← h2t, iUnion_prod_const]
apply MeasurableSet.iUnion
rintro n
apply measurableSet_generateFrom
exact mem_image2_of_mem (h1t n) hs
· apply generateFrom_le
rintro _ ⟨s, hs, t, ht, rfl⟩
dsimp only
rw [prod_eq]
apply (measurable_fst _).inter (measurable_snd _)
· exact measurableSet_generateFrom hs
· exact measurableSet_generateFrom ht
#align generate_from_prod_eq generateFrom_prod_eq
| Mathlib/MeasureTheory/Constructions/Prod/Basic.lean | 132 | 135 | theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generateFrom C = ‹_›)
(hD : generateFrom D = ‹_›) (h2C : IsCountablySpanning C) (h2D : IsCountablySpanning D) :
generateFrom (image2 (· ×ˢ ·) C D) = Prod.instMeasurableSpace := by |
rw [← hC, ← hD, generateFrom_prod_eq h2C h2D]
|
import Mathlib.Data.Option.Basic
import Mathlib.Data.Set.Basic
#align_import data.pequiv from "leanprover-community/mathlib"@"7c3269ca3fa4c0c19e4d127cd7151edbdbf99ed4"
universe u v w x
structure PEquiv (α : Type u) (β : Type v) where
toFun : α → Option β
invFun : β → Option α
inv : ∀ (a : α) (b : β), a ∈ invFun b ↔ b ∈ toFun a
#align pequiv PEquiv
infixr:25 " ≃. " => PEquiv
namespace PEquiv
variable {α : Type u} {β : Type v} {γ : Type w} {δ : Type x}
open Function Option
instance : FunLike (α ≃. β) α (Option β) :=
{ coe := toFun
coe_injective' := by
rintro ⟨f₁, f₂, hf⟩ ⟨g₁, g₂, hg⟩ (rfl : f₁ = g₁)
congr with y x
simp only [hf, hg] }
@[simp] theorem coe_mk (f₁ : α → Option β) (f₂ h) : (mk f₁ f₂ h : α → Option β) = f₁ :=
rfl
theorem coe_mk_apply (f₁ : α → Option β) (f₂ : β → Option α) (h) (x : α) :
(PEquiv.mk f₁ f₂ h : α → Option β) x = f₁ x :=
rfl
#align pequiv.coe_mk_apply PEquiv.coe_mk_apply
@[ext] theorem ext {f g : α ≃. β} (h : ∀ x, f x = g x) : f = g :=
DFunLike.ext f g h
#align pequiv.ext PEquiv.ext
theorem ext_iff {f g : α ≃. β} : f = g ↔ ∀ x, f x = g x :=
DFunLike.ext_iff
#align pequiv.ext_iff PEquiv.ext_iff
@[refl]
protected def refl (α : Type*) : α ≃. α where
toFun := some
invFun := some
inv _ _ := eq_comm
#align pequiv.refl PEquiv.refl
@[symm]
protected def symm (f : α ≃. β) : β ≃. α where
toFun := f.2
invFun := f.1
inv _ _ := (f.inv _ _).symm
#align pequiv.symm PEquiv.symm
theorem mem_iff_mem (f : α ≃. β) : ∀ {a : α} {b : β}, a ∈ f.symm b ↔ b ∈ f a :=
f.3 _ _
#align pequiv.mem_iff_mem PEquiv.mem_iff_mem
theorem eq_some_iff (f : α ≃. β) : ∀ {a : α} {b : β}, f.symm b = some a ↔ f a = some b :=
f.3 _ _
#align pequiv.eq_some_iff PEquiv.eq_some_iff
@[trans]
protected def trans (f : α ≃. β) (g : β ≃. γ) :
α ≃. γ where
toFun a := (f a).bind g
invFun a := (g.symm a).bind f.symm
inv a b := by simp_all [and_comm, eq_some_iff f, eq_some_iff g, bind_eq_some]
#align pequiv.trans PEquiv.trans
@[simp]
theorem refl_apply (a : α) : PEquiv.refl α a = some a :=
rfl
#align pequiv.refl_apply PEquiv.refl_apply
@[simp]
theorem symm_refl : (PEquiv.refl α).symm = PEquiv.refl α :=
rfl
#align pequiv.symm_refl PEquiv.symm_refl
@[simp]
theorem symm_symm (f : α ≃. β) : f.symm.symm = f := by cases f; rfl
#align pequiv.symm_symm PEquiv.symm_symm
theorem symm_bijective : Function.Bijective (PEquiv.symm : (α ≃. β) → β ≃. α) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
theorem symm_injective : Function.Injective (@PEquiv.symm α β) :=
symm_bijective.injective
#align pequiv.symm_injective PEquiv.symm_injective
theorem trans_assoc (f : α ≃. β) (g : β ≃. γ) (h : γ ≃. δ) :
(f.trans g).trans h = f.trans (g.trans h) :=
ext fun _ => Option.bind_assoc _ _ _
#align pequiv.trans_assoc PEquiv.trans_assoc
theorem mem_trans (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) :
c ∈ f.trans g a ↔ ∃ b, b ∈ f a ∧ c ∈ g b :=
Option.bind_eq_some'
#align pequiv.mem_trans PEquiv.mem_trans
theorem trans_eq_some (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ) :
f.trans g a = some c ↔ ∃ b, f a = some b ∧ g b = some c :=
Option.bind_eq_some'
#align pequiv.trans_eq_some PEquiv.trans_eq_some
theorem trans_eq_none (f : α ≃. β) (g : β ≃. γ) (a : α) :
f.trans g a = none ↔ ∀ b c, b ∉ f a ∨ c ∉ g b := by
simp only [eq_none_iff_forall_not_mem, mem_trans, imp_iff_not_or.symm]
push_neg
exact forall_swap
#align pequiv.trans_eq_none PEquiv.trans_eq_none
@[simp]
| Mathlib/Data/PEquiv.lean | 169 | 170 | theorem refl_trans (f : α ≃. β) : (PEquiv.refl α).trans f = f := by |
ext; dsimp [PEquiv.trans]; rfl
|
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Set Fin Filter Function
open scoped NNReal Topology
section Real
variable {n : ℕ∞} {𝕂 : Type*} [RCLike 𝕂] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕂 E']
{F' : Type*} [NormedAddCommGroup F'] [NormedSpace 𝕂 F']
theorem HasFTaylorSeriesUpToOn.hasStrictFDerivAt {s : Set E'} {f : E' → F'} {x : E'}
{p : E' → FormalMultilinearSeries 𝕂 E' F'} (hf : HasFTaylorSeriesUpToOn n f p s) (hn : 1 ≤ n)
(hs : s ∈ 𝓝 x) : HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕂 E' F') (p x 1)) x :=
hasStrictFDerivAt_of_hasFDerivAt_of_continuousAt (hf.eventually_hasFDerivAt hn hs) <|
(continuousMultilinearCurryFin1 𝕂 E' F').continuousAt.comp <| (hf.cont 1 hn).continuousAt hs
#align has_ftaylor_series_up_to_on.has_strict_fderiv_at HasFTaylorSeriesUpToOn.hasStrictFDerivAt
| Mathlib/Analysis/Calculus/ContDiff/RCLike.lean | 43 | 49 | theorem ContDiffAt.hasStrictFDerivAt' {f : E' → F'} {f' : E' →L[𝕂] F'} {x : E'}
(hf : ContDiffAt 𝕂 n f x) (hf' : HasFDerivAt f f' x) (hn : 1 ≤ n) :
HasStrictFDerivAt f f' x := by |
rcases hf 1 hn with ⟨u, H, p, hp⟩
simp only [nhdsWithin_univ, mem_univ, insert_eq_of_mem] at H
have := hp.hasStrictFDerivAt le_rfl H
rwa [hf'.unique this.hasFDerivAt]
|
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.StrongTopology
#align_import analysis.normed_space.compact_operator from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Function Set Filter Bornology Metric Pointwise Topology
def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂]
(f : M₁ → M₂) : Prop :=
∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁)
#align is_compact_operator IsCompactOperator
theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁]
[TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) :=
⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩
#align is_compact_operator_zero isCompactOperator_zero
section Characterizations
section
variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂} {M₁ M₂ : Type*}
[TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂]
theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K :=
⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ =>
⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_image_subset_compact isCompactOperator_iff_exists_mem_nhds_image_subset_compact
theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by
rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact]
exact
⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩,
fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_is_compact_closure_image isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image
end
section Continuous
variable {𝕜₁ 𝕜₂ : Type*} [NontriviallyNormedField 𝕜₁] [NontriviallyNormedField 𝕜₂]
{σ₁₂ : 𝕜₁ →+* 𝕜₂} [RingHomIsometric σ₁₂] {M₁ M₂ : Type*} [TopologicalSpace M₁] [AddCommGroup M₁]
[TopologicalSpace M₂] [AddCommGroup M₂] [Module 𝕜₁ M₁] [Module 𝕜₂ M₂] [TopologicalAddGroup M₁]
[ContinuousConstSMul 𝕜₁ M₁] [TopologicalAddGroup M₂] [ContinuousSMul 𝕜₂ M₂]
@[continuity]
| Mathlib/Analysis/NormedSpace/CompactOperator.lean | 336 | 365 | theorem IsCompactOperator.continuous {f : M₁ →ₛₗ[σ₁₂] M₂} (hf : IsCompactOperator f) :
Continuous f := by |
letI : UniformSpace M₂ := TopologicalAddGroup.toUniformSpace _
haveI : UniformAddGroup M₂ := comm_topologicalAddGroup_is_uniform
-- Since `f` is linear, we only need to show that it is continuous at zero.
-- Let `U` be a neighborhood of `0` in `M₂`.
refine continuous_of_continuousAt_zero f fun U hU => ?_
rw [map_zero] at hU
-- The compactness of `f` gives us a compact set `K : Set M₂` such that `f ⁻¹' K` is a
-- neighborhood of `0` in `M₁`.
rcases hf with ⟨K, hK, hKf⟩
-- But any compact set is totally bounded, hence Von-Neumann bounded. Thus, `K` absorbs `U`.
-- This gives `r > 0` such that `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
rcases (hK.totallyBounded.isVonNBounded 𝕜₂ hU).exists_pos with ⟨r, hr, hrU⟩
-- Choose `c : 𝕜₂` with `r < ‖c‖`.
rcases NormedField.exists_lt_norm 𝕜₁ r with ⟨c, hc⟩
have hcnz : c ≠ 0 := ne_zero_of_norm_ne_zero (hr.trans hc).ne.symm
-- We have `f ⁻¹' ((σ₁₂ c⁻¹) • K) = c⁻¹ • f ⁻¹' K ∈ 𝓝 0`. Thus, showing that
-- `(σ₁₂ c⁻¹) • K ⊆ U` is enough to deduce that `f ⁻¹' U ∈ 𝓝 0`.
suffices (σ₁₂ <| c⁻¹) • K ⊆ U by
refine mem_of_superset ?_ this
have : IsUnit c⁻¹ := hcnz.isUnit.inv
rwa [mem_map, preimage_smul_setₛₗ _ _ _ f this, set_smul_mem_nhds_zero_iff (inv_ne_zero hcnz)]
-- Since `σ₁₂ c⁻¹` = `(σ₁₂ c)⁻¹`, we have to prove that `K ⊆ σ₁₂ c • U`.
rw [map_inv₀, ← subset_set_smul_iff₀ ((map_ne_zero σ₁₂).mpr hcnz)]
-- But `σ₁₂` is isometric, so `‖σ₁₂ c‖ = ‖c‖ > r`, which concludes the argument since
-- `∀ a : 𝕜₂, r ≤ ‖a‖ → K ⊆ a • U`.
refine hrU (σ₁₂ c) ?_
rw [RingHomIsometric.is_iso]
exact hc.le
|
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Monic
#align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
open Polynomial
noncomputable section
namespace Polynomial
universe u v w
section Semiring
variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S}
def lifts (f : R →+* S) : Subsemiring S[X] :=
RingHom.rangeS (mapRingHom f)
#align polynomial.lifts Polynomial.lifts
theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by
simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS]
#align polynomial.mem_lifts Polynomial.mem_lifts
theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range
theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by
simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS]
#align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS
| Mathlib/Algebra/Polynomial/Lifts.lean | 73 | 75 | theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by |
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f]
rfl
|
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Degrees
def degrees (p : MvPolynomial σ R) : Multiset σ :=
letI := Classical.decEq σ
p.support.sup fun s : σ →₀ ℕ => toMultiset s
#align mv_polynomial.degrees MvPolynomial.degrees
theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) :
p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl
#align mv_polynomial.degrees_def MvPolynomial.degrees_def
| Mathlib/Algebra/MvPolynomial/Degrees.lean | 88 | 92 | theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by |
classical
refine (supDegree_single s a).trans_le ?_
split_ifs
exacts [bot_le, le_rfl]
|
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
#align rel.mem_interedges_iff Rel.mem_interedges_iff
theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b :=
mem_interedges_iff
#align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff
@[simp]
theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by
rw [interedges, Finset.empty_product, filter_empty]
#align rel.interedges_empty_left Rel.interedges_empty_left
theorem interedges_mono (hs : s₂ ⊆ s₁) (ht : t₂ ⊆ t₁) : interedges r s₂ t₂ ⊆ interedges r s₁ t₁ :=
fun x ↦ by
simp_rw [mem_interedges_iff]
exact fun h ↦ ⟨hs h.1, ht h.2.1, h.2.2⟩
#align rel.interedges_mono Rel.interedges_mono
variable (r)
theorem card_interedges_add_card_interedges_compl (s : Finset α) (t : Finset β) :
(interedges r s t).card + (interedges (fun x y ↦ ¬r x y) s t).card = s.card * t.card := by
classical
rw [← card_product, interedges, interedges, ← card_union_of_disjoint, filter_union_filter_neg_eq]
exact disjoint_filter.2 fun _ _ ↦ Classical.not_not.2
#align rel.card_interedges_add_card_interedges_compl Rel.card_interedges_add_card_interedges_compl
theorem interedges_disjoint_left {s s' : Finset α} (hs : Disjoint s s') (t : Finset β) :
Disjoint (interedges r s t) (interedges r s' t) := by
rw [Finset.disjoint_left] at hs ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact hs hx.1 hy.1
#align rel.interedges_disjoint_left Rel.interedges_disjoint_left
theorem interedges_disjoint_right (s : Finset α) {t t' : Finset β} (ht : Disjoint t t') :
Disjoint (interedges r s t) (interedges r s t') := by
rw [Finset.disjoint_left] at ht ⊢
intro _ hx hy
rw [mem_interedges_iff] at hx hy
exact ht hx.2.1 hy.2.1
#align rel.interedges_disjoint_right Rel.interedges_disjoint_right
theorem card_interedges_le_mul (s : Finset α) (t : Finset β) :
(interedges r s t).card ≤ s.card * t.card :=
(card_filter_le _ _).trans (card_product _ _).le
#align rel.card_interedges_le_mul Rel.card_interedges_le_mul
theorem edgeDensity_nonneg (s : Finset α) (t : Finset β) : 0 ≤ edgeDensity r s t := by
apply div_nonneg <;> exact mod_cast Nat.zero_le _
#align rel.edge_density_nonneg Rel.edgeDensity_nonneg
theorem edgeDensity_le_one (s : Finset α) (t : Finset β) : edgeDensity r s t ≤ 1 := by
apply div_le_one_of_le
· exact mod_cast card_interedges_le_mul r s t
· exact mod_cast Nat.zero_le _
#align rel.edge_density_le_one Rel.edgeDensity_le_one
theorem edgeDensity_add_edgeDensity_compl (hs : s.Nonempty) (ht : t.Nonempty) :
edgeDensity r s t + edgeDensity (fun x y ↦ ¬r x y) s t = 1 := by
rw [edgeDensity, edgeDensity, div_add_div_same, div_eq_one_iff_eq]
· exact mod_cast card_interedges_add_card_interedges_compl r s t
· exact mod_cast (mul_pos hs.card_pos ht.card_pos).ne'
#align rel.edge_density_add_edge_density_compl Rel.edgeDensity_add_edgeDensity_compl
@[simp]
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 154 | 155 | theorem edgeDensity_empty_left (t : Finset β) : edgeDensity r ∅ t = 0 := by |
rw [edgeDensity, Finset.card_empty, Nat.cast_zero, zero_mul, div_zero]
|
import Mathlib.CategoryTheory.Adjunction.Basic
open CategoryTheory
variable {C D : Type*} [Category C] [Category D]
namespace CategoryTheory.Adjunction
@[simps]
def natTransEquiv {F F' : C ⥤ D} {G G' : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G') :
(G ⟶ G') ≃ (F' ⟶ F) where
toFun f := {
app := fun X ↦ F'.map ((adj1.unit ≫ whiskerLeft F f).app X) ≫ adj2.counit.app _
naturality := by
intro X Y g
simp only [← Category.assoc, ← Functor.map_comp]
erw [(adj1.unit ≫ (whiskerLeft F f)).naturality]
simp
}
invFun f := {
app := fun X ↦ adj2.unit.app (G.obj X) ≫ G'.map (f.app (G.obj X) ≫ adj1.counit.app X)
naturality := by
intro X Y g
erw [← adj2.unit_naturality_assoc]
simp only [← Functor.map_comp]
simp
}
left_inv f := by
ext X
simp only [Functor.comp_obj, NatTrans.comp_app, Functor.id_obj, whiskerLeft_app,
Functor.map_comp, Category.assoc, unit_naturality_assoc, right_triangle_components_assoc]
erw [← f.naturality (adj1.counit.app X), ← Category.assoc]
simp
right_inv f := by
ext
simp
@[simp]
lemma natTransEquiv_id {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) :
natTransEquiv adj adj (𝟙 _) = 𝟙 _ := by ext; simp
@[simp]
lemma natTransEquiv_id_symm {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) :
(natTransEquiv adj adj).symm (𝟙 _) = 𝟙 _ := by ext; simp
@[simp]
lemma natTransEquiv_comp {F F' F'' : C ⥤ D} {G G' G'' : D ⥤ C}
(adj1 : F ⊣ G) (adj2 : F' ⊣ G') (adj3 : F'' ⊣ G'') (f : G ⟶ G') (g : G' ⟶ G'') :
natTransEquiv adj2 adj3 g ≫ natTransEquiv adj1 adj2 f = natTransEquiv adj1 adj3 (f ≫ g) := by
apply (natTransEquiv adj1 adj3).symm.injective
ext X
simp only [natTransEquiv_symm_apply_app, Functor.comp_obj, NatTrans.comp_app,
natTransEquiv_apply_app, Functor.id_obj, whiskerLeft_app, Functor.map_comp, Category.assoc,
unit_naturality_assoc, right_triangle_components_assoc, Equiv.symm_apply_apply,
← g.naturality_assoc, ← g.naturality]
simp only [← Category.assoc, unit_naturality, Functor.comp_obj, right_triangle_components,
Category.comp_id, ← f.naturality, Category.id_comp]
@[simp]
lemma natTransEquiv_comp_symm {F F' F'' : C ⥤ D} {G G' G'' : D ⥤ C}
(adj1 : F ⊣ G) (adj2 : F' ⊣ G') (adj3 : F'' ⊣ G'') (f : F' ⟶ F) (g : F'' ⟶ F') :
(natTransEquiv adj1 adj2).symm f ≫ (natTransEquiv adj2 adj3).symm g =
(natTransEquiv adj1 adj3).symm (g ≫ f) := by
apply (natTransEquiv adj1 adj3).injective
ext
simp
@[simps]
def natIsoEquiv {F F' : C ⥤ D} {G G' : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G') :
(G ≅ G') ≃ (F' ≅ F) where
toFun i := {
hom := natTransEquiv adj1 adj2 i.hom
inv := natTransEquiv adj2 adj1 i.inv
}
invFun i := {
hom := (natTransEquiv adj1 adj2).symm i.hom
inv := (natTransEquiv adj2 adj1).symm i.inv }
left_inv i := by simp
right_inv i := by simp
def leftAdjointUniq {F F' : C ⥤ D} {G : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G) : F ≅ F' :=
(natIsoEquiv adj1 adj2 (Iso.refl _)).symm
#align category_theory.adjunction.left_adjoint_uniq CategoryTheory.Adjunction.leftAdjointUniq
-- Porting note (#10618): removed simp as simp can prove this
| Mathlib/CategoryTheory/Adjunction/Unique.lean | 117 | 119 | theorem homEquiv_leftAdjointUniq_hom_app {F F' : C ⥤ D} {G : D ⥤ C} (adj1 : F ⊣ G) (adj2 : F' ⊣ G)
(x : C) : adj1.homEquiv _ _ ((leftAdjointUniq adj1 adj2).hom.app x) = adj2.unit.app x := by |
simp [leftAdjointUniq]
|
import Mathlib.CategoryTheory.Iso
import Mathlib.CategoryTheory.Functor.Category
import Mathlib.CategoryTheory.EqToHom
#align_import category_theory.comma from "leanprover-community/mathlib"@"8a318021995877a44630c898d0b2bc376fceef3b"
namespace CategoryTheory
open Category
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe v₁ v₂ v₃ v₄ v₅ u₁ u₂ u₃ u₄ u₅
variable {A : Type u₁} [Category.{v₁} A]
variable {B : Type u₂} [Category.{v₂} B]
variable {T : Type u₃} [Category.{v₃} T]
variable {A' B' T' : Type*} [Category A'] [Category B'] [Category T']
structure Comma (L : A ⥤ T) (R : B ⥤ T) : Type max u₁ u₂ v₃ where
left : A
right : B
hom : L.obj left ⟶ R.obj right
#align category_theory.comma CategoryTheory.Comma
-- Satisfying the inhabited linter
instance Comma.inhabited [Inhabited T] : Inhabited (Comma (𝟭 T) (𝟭 T)) where
default :=
{ left := default
right := default
hom := 𝟙 default }
#align category_theory.comma.inhabited CategoryTheory.Comma.inhabited
variable {L : A ⥤ T} {R : B ⥤ T}
@[ext]
structure CommaMorphism (X Y : Comma L R) where
left : X.left ⟶ Y.left
right : X.right ⟶ Y.right
w : L.map left ≫ Y.hom = X.hom ≫ R.map right := by aesop_cat
#align category_theory.comma_morphism CategoryTheory.CommaMorphism
-- Satisfying the inhabited linter
instance CommaMorphism.inhabited [Inhabited (Comma L R)] :
Inhabited (CommaMorphism (default : Comma L R) default) :=
⟨{ left := 𝟙 _, right := 𝟙 _}⟩
#align category_theory.comma_morphism.inhabited CategoryTheory.CommaMorphism.inhabited
attribute [reassoc (attr := simp)] CommaMorphism.w
instance commaCategory : Category (Comma L R) where
Hom X Y := CommaMorphism X Y
id X :=
{ left := 𝟙 X.left
right := 𝟙 X.right }
comp f g :=
{ left := f.left ≫ g.left
right := f.right ≫ g.right }
#align category_theory.comma_category CategoryTheory.commaCategory
namespace Comma
section
variable {X Y Z : Comma L R} {f : X ⟶ Y} {g : Y ⟶ Z}
-- Porting note: this lemma was added because `CommaMorphism.ext`
-- was not triggered automatically
@[ext]
lemma hom_ext (f g : X ⟶ Y) (h₁ : f.left = g.left) (h₂ : f.right = g.right) : f = g :=
CommaMorphism.ext _ _ h₁ h₂
@[simp]
theorem id_left : (𝟙 X : CommaMorphism X X).left = 𝟙 X.left :=
rfl
#align category_theory.comma.id_left CategoryTheory.Comma.id_left
@[simp]
theorem id_right : (𝟙 X : CommaMorphism X X).right = 𝟙 X.right :=
rfl
#align category_theory.comma.id_right CategoryTheory.Comma.id_right
@[simp]
theorem comp_left : (f ≫ g).left = f.left ≫ g.left :=
rfl
#align category_theory.comma.comp_left CategoryTheory.Comma.comp_left
@[simp]
theorem comp_right : (f ≫ g).right = f.right ≫ g.right :=
rfl
#align category_theory.comma.comp_right CategoryTheory.Comma.comp_right
end
variable (L) (R)
@[simps]
def fst : Comma L R ⥤ A where
obj X := X.left
map f := f.left
#align category_theory.comma.fst CategoryTheory.Comma.fst
@[simps]
def snd : Comma L R ⥤ B where
obj X := X.right
map f := f.right
#align category_theory.comma.snd CategoryTheory.Comma.snd
@[simps]
def natTrans : fst L R ⋙ L ⟶ snd L R ⋙ R where app X := X.hom
#align category_theory.comma.nat_trans CategoryTheory.Comma.natTrans
@[simp]
theorem eqToHom_left (X Y : Comma L R) (H : X = Y) :
CommaMorphism.left (eqToHom H) = eqToHom (by cases H; rfl) := by
cases H
rfl
#align category_theory.comma.eq_to_hom_left CategoryTheory.Comma.eqToHom_left
@[simp]
| Mathlib/CategoryTheory/Comma/Basic.lean | 173 | 176 | theorem eqToHom_right (X Y : Comma L R) (H : X = Y) :
CommaMorphism.right (eqToHom H) = eqToHom (by cases H; rfl) := by |
cases H
rfl
|
import Mathlib.Data.Vector.Basic
set_option autoImplicit true
namespace Vector
def snoc : Vector α n → α → Vector α (n+1) :=
fun xs x => append xs (x ::ᵥ Vector.nil)
section Simp
variable (xs : Vector α n)
@[simp]
theorem snoc_cons : (x ::ᵥ xs).snoc y = x ::ᵥ (xs.snoc y) :=
rfl
@[simp]
theorem snoc_nil : (nil.snoc x) = x ::ᵥ nil :=
rfl
@[simp]
| Mathlib/Data/Vector/Snoc.lean | 42 | 45 | theorem reverse_cons : reverse (x ::ᵥ xs) = (reverse xs).snoc x := by |
cases xs
simp only [reverse, cons, toList_mk, List.reverse_cons, snoc]
congr
|
import Mathlib.Algebra.Algebra.Quasispectrum
import Mathlib.FieldTheory.IsAlgClosed.Spectrum
import Mathlib.Analysis.Complex.Liouville
import Mathlib.Analysis.Complex.Polynomial
import Mathlib.Analysis.Analytic.RadiusLiminf
import Mathlib.Topology.Algebra.Module.CharacterSpace
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.NormedSpace.UnitizationL1
#align_import analysis.normed_space.spectrum from "leanprover-community/mathlib"@"d608fc5d4e69d4cc21885913fb573a88b0deb521"
open scoped ENNReal NNReal
open NormedSpace -- For `NormedSpace.exp`.
noncomputable def spectralRadius (𝕜 : Type*) {A : Type*} [NormedField 𝕜] [Ring A] [Algebra 𝕜 A]
(a : A) : ℝ≥0∞ :=
⨆ k ∈ spectrum 𝕜 a, ‖k‖₊
#align spectral_radius spectralRadius
variable {𝕜 : Type*} {A : Type*}
namespace spectrum
section SpectrumCompact
open Filter
variable [NormedField 𝕜] [NormedRing A] [NormedAlgebra 𝕜 A]
local notation "σ" => spectrum 𝕜
local notation "ρ" => resolventSet 𝕜
local notation "↑ₐ" => algebraMap 𝕜 A
@[simp]
theorem SpectralRadius.of_subsingleton [Subsingleton A] (a : A) : spectralRadius 𝕜 a = 0 := by
simp [spectralRadius]
#align spectrum.spectral_radius.of_subsingleton spectrum.SpectralRadius.of_subsingleton
@[simp]
theorem spectralRadius_zero : spectralRadius 𝕜 (0 : A) = 0 := by
nontriviality A
simp [spectralRadius]
#align spectrum.spectral_radius_zero spectrum.spectralRadius_zero
theorem mem_resolventSet_of_spectralRadius_lt {a : A} {k : 𝕜} (h : spectralRadius 𝕜 a < ‖k‖₊) :
k ∈ ρ a :=
Classical.not_not.mp fun hn => h.not_le <| le_iSup₂ (α := ℝ≥0∞) k hn
#align spectrum.mem_resolvent_set_of_spectral_radius_lt spectrum.mem_resolventSet_of_spectralRadius_lt
variable [CompleteSpace A]
theorem isOpen_resolventSet (a : A) : IsOpen (ρ a) :=
Units.isOpen.preimage ((continuous_algebraMap 𝕜 A).sub continuous_const)
#align spectrum.is_open_resolvent_set spectrum.isOpen_resolventSet
protected theorem isClosed (a : A) : IsClosed (σ a) :=
(isOpen_resolventSet a).isClosed_compl
#align spectrum.is_closed spectrum.isClosed
theorem mem_resolventSet_of_norm_lt_mul {a : A} {k : 𝕜} (h : ‖a‖ * ‖(1 : A)‖ < ‖k‖) : k ∈ ρ a := by
rw [resolventSet, Set.mem_setOf_eq, Algebra.algebraMap_eq_smul_one]
nontriviality A
have hk : k ≠ 0 :=
ne_zero_of_norm_ne_zero ((mul_nonneg (norm_nonneg _) (norm_nonneg _)).trans_lt h).ne'
letI ku := Units.map ↑ₐ.toMonoidHom (Units.mk0 k hk)
rw [← inv_inv ‖(1 : A)‖,
mul_inv_lt_iff (inv_pos.2 <| norm_pos_iff.2 (one_ne_zero : (1 : A) ≠ 0))] at h
have hku : ‖-a‖ < ‖(↑ku⁻¹ : A)‖⁻¹ := by simpa [ku, norm_algebraMap] using h
simpa [ku, sub_eq_add_neg, Algebra.algebraMap_eq_smul_one] using (ku.add (-a) hku).isUnit
#align spectrum.mem_resolvent_set_of_norm_lt_mul spectrum.mem_resolventSet_of_norm_lt_mul
theorem mem_resolventSet_of_norm_lt [NormOneClass A] {a : A} {k : 𝕜} (h : ‖a‖ < ‖k‖) : k ∈ ρ a :=
mem_resolventSet_of_norm_lt_mul (by rwa [norm_one, mul_one])
#align spectrum.mem_resolvent_set_of_norm_lt spectrum.mem_resolventSet_of_norm_lt
theorem norm_le_norm_mul_of_mem {a : A} {k : 𝕜} (hk : k ∈ σ a) : ‖k‖ ≤ ‖a‖ * ‖(1 : A)‖ :=
le_of_not_lt <| mt mem_resolventSet_of_norm_lt_mul hk
#align spectrum.norm_le_norm_mul_of_mem spectrum.norm_le_norm_mul_of_mem
theorem norm_le_norm_of_mem [NormOneClass A] {a : A} {k : 𝕜} (hk : k ∈ σ a) : ‖k‖ ≤ ‖a‖ :=
le_of_not_lt <| mt mem_resolventSet_of_norm_lt hk
#align spectrum.norm_le_norm_of_mem spectrum.norm_le_norm_of_mem
theorem subset_closedBall_norm_mul (a : A) : σ a ⊆ Metric.closedBall (0 : 𝕜) (‖a‖ * ‖(1 : A)‖) :=
fun k hk => by simp [norm_le_norm_mul_of_mem hk]
#align spectrum.subset_closed_ball_norm_mul spectrum.subset_closedBall_norm_mul
theorem subset_closedBall_norm [NormOneClass A] (a : A) : σ a ⊆ Metric.closedBall (0 : 𝕜) ‖a‖ :=
fun k hk => by simp [norm_le_norm_of_mem hk]
#align spectrum.subset_closed_ball_norm spectrum.subset_closedBall_norm
theorem isBounded (a : A) : Bornology.IsBounded (σ a) :=
Metric.isBounded_closedBall.subset (subset_closedBall_norm_mul a)
#align spectrum.is_bounded spectrum.isBounded
protected theorem isCompact [ProperSpace 𝕜] (a : A) : IsCompact (σ a) :=
Metric.isCompact_of_isClosed_isBounded (spectrum.isClosed a) (isBounded a)
#align spectrum.is_compact spectrum.isCompact
instance instCompactSpace [ProperSpace 𝕜] (a : A) : CompactSpace (spectrum 𝕜 a) :=
isCompact_iff_compactSpace.mp <| spectrum.isCompact a
instance instCompactSpaceNNReal {A : Type*} [NormedRing A] [NormedAlgebra ℝ A]
(a : A) [CompactSpace (spectrum ℝ a)] : CompactSpace (spectrum ℝ≥0 a) := by
rw [← isCompact_iff_compactSpace] at *
rw [← preimage_algebraMap ℝ]
exact closedEmbedding_subtype_val isClosed_nonneg |>.isCompact_preimage <| by assumption
| Mathlib/Analysis/NormedSpace/Spectrum.lean | 176 | 178 | theorem spectralRadius_le_nnnorm [NormOneClass A] (a : A) : spectralRadius 𝕜 a ≤ ‖a‖₊ := by |
refine iSup₂_le fun k hk => ?_
exact mod_cast norm_le_norm_of_mem hk
|
import Mathlib.Data.Finset.Sum
import Mathlib.Data.Sum.Order
import Mathlib.Order.Interval.Finset.Defs
#align_import data.sum.interval from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999"
open Function Sum
namespace Finset
variable {α₁ α₂ β₁ β₂ γ₁ γ₂ : Type*}
section SumLift₂
variable (f f₁ g₁ : α₁ → β₁ → Finset γ₁) (g f₂ g₂ : α₂ → β₂ → Finset γ₂)
@[simp]
def sumLift₂ : ∀ (_ : Sum α₁ α₂) (_ : Sum β₁ β₂), Finset (Sum γ₁ γ₂)
| inl a, inl b => (f a b).map Embedding.inl
| inl _, inr _ => ∅
| inr _, inl _ => ∅
| inr a, inr b => (g a b).map Embedding.inr
#align finset.sum_lift₂ Finset.sumLift₂
variable {f f₁ g₁ g f₂ g₂} {a : Sum α₁ α₂} {b : Sum β₁ β₂} {c : Sum γ₁ γ₂}
| Mathlib/Data/Sum/Interval.lean | 43 | 57 | theorem mem_sumLift₂ :
c ∈ sumLift₂ f g a b ↔
(∃ a₁ b₁ c₁, a = inl a₁ ∧ b = inl b₁ ∧ c = inl c₁ ∧ c₁ ∈ f a₁ b₁) ∨
∃ a₂ b₂ c₂, a = inr a₂ ∧ b = inr b₂ ∧ c = inr c₂ ∧ c₂ ∈ g a₂ b₂ := by |
constructor
· cases' a with a a <;> cases' b with b b
· rw [sumLift₂, mem_map]
rintro ⟨c, hc, rfl⟩
exact Or.inl ⟨a, b, c, rfl, rfl, rfl, hc⟩
· refine fun h ↦ (not_mem_empty _ h).elim
· refine fun h ↦ (not_mem_empty _ h).elim
· rw [sumLift₂, mem_map]
rintro ⟨c, hc, rfl⟩
exact Or.inr ⟨a, b, c, rfl, rfl, rfl, hc⟩
· rintro (⟨a, b, c, rfl, rfl, rfl, h⟩ | ⟨a, b, c, rfl, rfl, rfl, h⟩) <;> exact mem_map_of_mem _ h
|
import Mathlib.Data.List.Join
#align_import data.list.permutation from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
-- Make sure we don't import algebra
assert_not_exists Monoid
open Nat
variable {α β : Type*}
namespace List
theorem permutationsAux2_fst (t : α) (ts : List α) (r : List β) :
∀ (ys : List α) (f : List α → β), (permutationsAux2 t ts r ys f).1 = ys ++ ts
| [], f => rfl
| y :: ys, f => by simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_fst List.permutationsAux2_fst
@[simp]
theorem permutationsAux2_snd_nil (t : α) (ts : List α) (r : List β) (f : List α → β) :
(permutationsAux2 t ts r [] f).2 = r :=
rfl
#align list.permutations_aux2_snd_nil List.permutationsAux2_snd_nil
@[simp]
theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α)
(f : List α → β) :
(permutationsAux2 t ts r (y :: ys) f).2 =
f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2 := by
simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_snd_cons List.permutationsAux2_snd_cons
theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
(permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
induction ys generalizing f <;> simp [*]
#align list.permutations_aux2_append List.permutationsAux2_append
theorem permutationsAux2_comp_append {t : α} {ts ys : List α} {r : List β} (f : List α → β) :
((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by
induction' ys with ys_hd _ ys_ih generalizing f
· simp
· simp [ys_ih fun xs => f (ys_hd :: xs)]
#align list.permutations_aux2_comp_append List.permutationsAux2_comp_append
theorem map_permutationsAux2' {α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
(r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
map g' (permutationsAux2 t ts r ys f).2 =
(permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
induction' ys with ys_hd _ ys_ih generalizing f f'
· simp
· simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
rw [ys_ih, permutationsAux2_fst]
· refine ⟨?_, rfl⟩
simp only [← map_cons, ← map_append]; apply H
· intro a; apply H
#align list.map_permutations_aux2' List.map_permutationsAux2'
theorem map_permutationsAux2 (t : α) (ts : List α) (ys : List α) (f : List α → β) :
(permutationsAux2 t ts [] ys id).2.map f = (permutationsAux2 t ts [] ys f).2 := by
rw [map_permutationsAux2' id, map_id, map_id]
· rfl
simp
#align list.map_permutations_aux2 List.map_permutationsAux2
theorem permutationsAux2_snd_eq (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
(permutationsAux2 t ts r ys f).2 =
((permutationsAux2 t [] [] ys id).2.map fun x => f (x ++ ts)) ++ r := by
rw [← permutationsAux2_append, map_permutationsAux2, permutationsAux2_comp_append]
#align list.permutations_aux2_snd_eq List.permutationsAux2_snd_eq
theorem map_map_permutationsAux2 {α'} (g : α → α') (t : α) (ts ys : List α) :
map (map g) (permutationsAux2 t ts [] ys id).2 =
(permutationsAux2 (g t) (map g ts) [] (map g ys) id).2 :=
map_permutationsAux2' _ _ _ _ _ _ _ _ fun _ => rfl
#align list.map_map_permutations_aux2 List.map_map_permutationsAux2
theorem map_map_permutations'Aux (f : α → β) (t : α) (ts : List α) :
map (map f) (permutations'Aux t ts) = permutations'Aux (f t) (map f ts) := by
induction' ts with a ts ih
· rfl
· simp only [permutations'Aux, map_cons, map_map, ← ih, cons.injEq, true_and, Function.comp_def]
#align list.map_map_permutations'_aux List.map_map_permutations'Aux
| Mathlib/Data/List/Permutation.lean | 140 | 146 | theorem permutations'Aux_eq_permutationsAux2 (t : α) (ts : List α) :
permutations'Aux t ts = (permutationsAux2 t [] [ts ++ [t]] ts id).2 := by |
induction' ts with a ts ih; · rfl
simp only [permutations'Aux, ih, cons_append, permutationsAux2_snd_cons, append_nil, id_eq,
cons.injEq, true_and]
simp (config := { singlePass := true }) only [← permutationsAux2_append]
simp [map_permutationsAux2]
|
import Mathlib.Algebra.Order.Nonneg.Ring
import Mathlib.Algebra.Order.Ring.Rat
import Mathlib.Data.Int.Lemmas
#align_import data.rat.nnrat from "leanprover-community/mathlib"@"b3f4f007a962e3787aa0f3b5c7942a1317f7d88e"
open Function
deriving instance CanonicallyOrderedCommSemiring for NNRat
deriving instance CanonicallyLinearOrderedAddCommMonoid for NNRat
deriving instance Sub for NNRat
deriving instance Inhabited for NNRat
-- TODO: `deriving instance OrderedSub for NNRat` doesn't work yet, so we add the instance manually
instance NNRat.instOrderedSub : OrderedSub ℚ≥0 := Nonneg.orderedSub
namespace NNRat
variable {α : Type*} {p q : ℚ≥0}
@[simp] lemma val_eq_cast (q : ℚ≥0) : q.1 = q := rfl
#align nnrat.val_eq_coe NNRat.val_eq_cast
instance canLift : CanLift ℚ ℚ≥0 (↑) fun q ↦ 0 ≤ q where
prf q hq := ⟨⟨q, hq⟩, rfl⟩
#align nnrat.can_lift NNRat.canLift
@[ext]
theorem ext : (p : ℚ) = (q : ℚ) → p = q :=
Subtype.ext
#align nnrat.ext NNRat.ext
protected theorem coe_injective : Injective ((↑) : ℚ≥0 → ℚ) :=
Subtype.coe_injective
#align nnrat.coe_injective NNRat.coe_injective
@[simp, norm_cast]
theorem coe_inj : (p : ℚ) = q ↔ p = q :=
Subtype.coe_inj
#align nnrat.coe_inj NNRat.coe_inj
theorem ext_iff : p = q ↔ (p : ℚ) = q :=
Subtype.ext_iff
#align nnrat.ext_iff NNRat.ext_iff
theorem ne_iff {x y : ℚ≥0} : (x : ℚ) ≠ (y : ℚ) ↔ x ≠ y :=
NNRat.coe_inj.not
#align nnrat.ne_iff NNRat.ne_iff
-- TODO: We have to write `NNRat.cast` explicitly, else the statement picks up `Subtype.val` instead
@[simp, norm_cast] lemma coe_mk (q : ℚ) (hq) : NNRat.cast ⟨q, hq⟩ = q := rfl
#align nnrat.coe_mk NNRat.coe_mk
lemma «forall» {p : ℚ≥0 → Prop} : (∀ q, p q) ↔ ∀ q hq, p ⟨q, hq⟩ := Subtype.forall
lemma «exists» {p : ℚ≥0 → Prop} : (∃ q, p q) ↔ ∃ q hq, p ⟨q, hq⟩ := Subtype.exists
def _root_.Rat.toNNRat (q : ℚ) : ℚ≥0 :=
⟨max q 0, le_max_right _ _⟩
#align rat.to_nnrat Rat.toNNRat
theorem _root_.Rat.coe_toNNRat (q : ℚ) (hq : 0 ≤ q) : (q.toNNRat : ℚ) = q :=
max_eq_left hq
#align rat.coe_to_nnrat Rat.coe_toNNRat
theorem _root_.Rat.le_coe_toNNRat (q : ℚ) : q ≤ q.toNNRat :=
le_max_left _ _
#align rat.le_coe_to_nnrat Rat.le_coe_toNNRat
open Rat (toNNRat)
@[simp]
theorem coe_nonneg (q : ℚ≥0) : (0 : ℚ) ≤ q :=
q.2
#align nnrat.coe_nonneg NNRat.coe_nonneg
-- eligible for dsimp
@[simp, nolint simpNF, norm_cast] lemma coe_zero : ((0 : ℚ≥0) : ℚ) = 0 := rfl
#align nnrat.coe_zero NNRat.coe_zero
-- eligible for dsimp
@[simp, nolint simpNF, norm_cast] lemma coe_one : ((1 : ℚ≥0) : ℚ) = 1 := rfl
#align nnrat.coe_one NNRat.coe_one
@[simp, norm_cast]
theorem coe_add (p q : ℚ≥0) : ((p + q : ℚ≥0) : ℚ) = p + q :=
rfl
#align nnrat.coe_add NNRat.coe_add
@[simp, norm_cast]
theorem coe_mul (p q : ℚ≥0) : ((p * q : ℚ≥0) : ℚ) = p * q :=
rfl
#align nnrat.coe_mul NNRat.coe_mul
-- eligible for dsimp
@[simp, nolint simpNF, norm_cast] lemma coe_pow (q : ℚ≥0) (n : ℕ) : (↑(q ^ n) : ℚ) = (q : ℚ) ^ n :=
rfl
#align nnrat.coe_pow NNRat.coe_pow
@[simp] lemma num_pow (q : ℚ≥0) (n : ℕ) : (q ^ n).num = q.num ^ n := by simp [num, Int.natAbs_pow]
@[simp] lemma den_pow (q : ℚ≥0) (n : ℕ) : (q ^ n).den = q.den ^ n := rfl
-- Porting note: `bit0` `bit1` are deprecated, so remove these theorems.
#noalign nnrat.coe_bit0
#noalign nnrat.coe_bit1
@[simp, norm_cast]
theorem coe_sub (h : q ≤ p) : ((p - q : ℚ≥0) : ℚ) = p - q :=
max_eq_left <| le_sub_comm.2 <| by rwa [sub_zero]
#align nnrat.coe_sub NNRat.coe_sub
@[simp]
| Mathlib/Data/NNRat/Defs.lean | 142 | 142 | theorem coe_eq_zero : (q : ℚ) = 0 ↔ q = 0 := by | norm_cast
|
import Mathlib.LinearAlgebra.TensorProduct.Basic
import Mathlib.RingTheory.Finiteness
open scoped TensorProduct
open Submodule
variable {R M N : Type*}
variable [CommSemiring R] [AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module R N]
variable {M₁ M₂ : Submodule R M} {N₁ N₂ : Submodule R N}
namespace TensorProduct
theorem exists_multiset (x : M ⊗[R] N) :
∃ S : Multiset (M × N), x = (S.map fun i ↦ i.1 ⊗ₜ[R] i.2).sum := by
induction x using TensorProduct.induction_on with
| zero => exact ⟨0, by simp⟩
| tmul x y => exact ⟨{(x, y)}, by simp⟩
| add x y hx hy =>
obtain ⟨Sx, hx⟩ := hx
obtain ⟨Sy, hy⟩ := hy
exact ⟨Sx + Sy, by rw [Multiset.map_add, Multiset.sum_add, hx, hy]⟩
| Mathlib/LinearAlgebra/TensorProduct/Finiteness.lean | 65 | 75 | theorem exists_finsupp_left (x : M ⊗[R] N) :
∃ S : M →₀ N, x = S.sum fun m n ↦ m ⊗ₜ[R] n := by |
induction x using TensorProduct.induction_on with
| zero => exact ⟨0, by simp⟩
| tmul x y => exact ⟨Finsupp.single x y, by simp⟩
| add x y hx hy =>
obtain ⟨Sx, hx⟩ := hx
obtain ⟨Sy, hy⟩ := hy
use Sx + Sy
rw [hx, hy]
exact (Finsupp.sum_add_index' (by simp) TensorProduct.tmul_add).symm
|
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products
import Mathlib.CategoryTheory.Limits.ConcreteCategory
import Mathlib.CategoryTheory.Limits.Shapes.Types
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
universe w v u t r
namespace CategoryTheory.Limits.Concrete
attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort
variable {C : Type u} [Category.{v} C]
section Products
section WidePullback
variable [ConcreteCategory.{max w v} C]
open WidePullback
open WidePullbackShape
| Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean | 227 | 234 | theorem widePullback_ext {B : C} {ι : Type w} {X : ι → C} (f : ∀ j : ι, X j ⟶ B)
[HasWidePullback B X f] [PreservesLimit (wideCospan B X f) (forget C)]
(x y : ↑(widePullback B X f)) (h₀ : base f x = base f y) (h : ∀ j, π f j x = π f j y) :
x = y := by |
apply Concrete.limit_ext
rintro (_ | j)
· exact h₀
· apply h
|
import Mathlib.Data.PNat.Basic
#align_import data.pnat.find from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
namespace PNat
variable {p q : ℕ+ → Prop} [DecidablePred p] [DecidablePred q] (h : ∃ n, p n)
instance decidablePredExistsNat : DecidablePred fun n' : ℕ => ∃ (n : ℕ+) (_ : n' = n), p n :=
fun n' =>
decidable_of_iff' (∃ h : 0 < n', p ⟨n', h⟩) <|
Subtype.exists.trans <| by
simp_rw [mk_coe, @exists_comm (_ < _) (_ = _), exists_prop, exists_eq_left']
#align pnat.decidable_pred_exists_nat PNat.decidablePredExistsNat
protected def findX : { n // p n ∧ ∀ m : ℕ+, m < n → ¬p m } := by
have : ∃ (n' : ℕ) (n : ℕ+) (_ : n' = n), p n := Exists.elim h fun n hn => ⟨n, n, rfl, hn⟩
have n := Nat.findX this
refine ⟨⟨n, ?_⟩, ?_, fun m hm pm => ?_⟩
· obtain ⟨n', hn', -⟩ := n.prop.1
rw [hn']
exact n'.prop
· obtain ⟨n', hn', pn'⟩ := n.prop.1
simpa [hn', Subtype.coe_eta] using pn'
· exact n.prop.2 m hm ⟨m, rfl, pm⟩
#align pnat.find_x PNat.findX
protected def find : ℕ+ :=
PNat.findX h
#align pnat.find PNat.find
protected theorem find_spec : p (PNat.find h) :=
(PNat.findX h).prop.left
#align pnat.find_spec PNat.find_spec
protected theorem find_min : ∀ {m : ℕ+}, m < PNat.find h → ¬p m :=
@(PNat.findX h).prop.right
#align pnat.find_min PNat.find_min
protected theorem find_min' {m : ℕ+} (hm : p m) : PNat.find h ≤ m :=
le_of_not_lt fun l => PNat.find_min h l hm
#align pnat.find_min' PNat.find_min'
variable {n m : ℕ+}
theorem find_eq_iff : PNat.find h = m ↔ p m ∧ ∀ n < m, ¬p n := by
constructor
· rintro rfl
exact ⟨PNat.find_spec h, fun _ => PNat.find_min h⟩
· rintro ⟨hm, hlt⟩
exact le_antisymm (PNat.find_min' h hm) (not_lt.1 <| imp_not_comm.1 (hlt _) <| PNat.find_spec h)
#align pnat.find_eq_iff PNat.find_eq_iff
@[simp]
theorem find_lt_iff (n : ℕ+) : PNat.find h < n ↔ ∃ m < n, p m :=
⟨fun h2 => ⟨PNat.find h, h2, PNat.find_spec h⟩, fun ⟨_, hmn, hm⟩ =>
(PNat.find_min' h hm).trans_lt hmn⟩
#align pnat.find_lt_iff PNat.find_lt_iff
@[simp]
| Mathlib/Data/PNat/Find.lean | 86 | 87 | theorem find_le_iff (n : ℕ+) : PNat.find h ≤ n ↔ ∃ m ≤ n, p m := by |
simp only [exists_prop, ← lt_add_one_iff, find_lt_iff]
|
import Mathlib.Topology.EMetricSpace.Basic
#align_import topology.metric_space.metric_separated from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
open EMetric Set
noncomputable section
def IsMetricSeparated {X : Type*} [EMetricSpace X] (s t : Set X) :=
∃ r, r ≠ 0 ∧ ∀ x ∈ s, ∀ y ∈ t, r ≤ edist x y
#align is_metric_separated IsMetricSeparated
namespace IsMetricSeparated
variable {X : Type*} [EMetricSpace X] {s t : Set X} {x y : X}
@[symm]
theorem symm (h : IsMetricSeparated s t) : IsMetricSeparated t s :=
let ⟨r, r0, hr⟩ := h
⟨r, r0, fun y hy x hx => edist_comm x y ▸ hr x hx y hy⟩
#align is_metric_separated.symm IsMetricSeparated.symm
theorem comm : IsMetricSeparated s t ↔ IsMetricSeparated t s :=
⟨symm, symm⟩
#align is_metric_separated.comm IsMetricSeparated.comm
@[simp]
theorem empty_left (s : Set X) : IsMetricSeparated ∅ s :=
⟨1, one_ne_zero, fun _x => False.elim⟩
#align is_metric_separated.empty_left IsMetricSeparated.empty_left
@[simp]
theorem empty_right (s : Set X) : IsMetricSeparated s ∅ :=
(empty_left s).symm
#align is_metric_separated.empty_right IsMetricSeparated.empty_right
protected theorem disjoint (h : IsMetricSeparated s t) : Disjoint s t :=
let ⟨r, r0, hr⟩ := h
Set.disjoint_left.mpr fun x hx1 hx2 => r0 <| by simpa using hr x hx1 x hx2
#align is_metric_separated.disjoint IsMetricSeparated.disjoint
theorem subset_compl_right (h : IsMetricSeparated s t) : s ⊆ tᶜ := fun _ hs ht =>
h.disjoint.le_bot ⟨hs, ht⟩
#align is_metric_separated.subset_compl_right IsMetricSeparated.subset_compl_right
@[mono]
theorem mono {s' t'} (hs : s ⊆ s') (ht : t ⊆ t') :
IsMetricSeparated s' t' → IsMetricSeparated s t := fun ⟨r, r0, hr⟩ =>
⟨r, r0, fun x hx y hy => hr x (hs hx) y (ht hy)⟩
#align is_metric_separated.mono IsMetricSeparated.mono
theorem mono_left {s'} (h' : IsMetricSeparated s' t) (hs : s ⊆ s') : IsMetricSeparated s t :=
h'.mono hs Subset.rfl
#align is_metric_separated.mono_left IsMetricSeparated.mono_left
theorem mono_right {t'} (h' : IsMetricSeparated s t') (ht : t ⊆ t') : IsMetricSeparated s t :=
h'.mono Subset.rfl ht
#align is_metric_separated.mono_right IsMetricSeparated.mono_right
theorem union_left {s'} (h : IsMetricSeparated s t) (h' : IsMetricSeparated s' t) :
IsMetricSeparated (s ∪ s') t := by
rcases h, h' with ⟨⟨r, r0, hr⟩, ⟨r', r0', hr'⟩⟩
refine ⟨min r r', ?_, fun x hx y hy => hx.elim ?_ ?_⟩
· rw [← pos_iff_ne_zero] at r0 r0' ⊢
exact lt_min r0 r0'
· exact fun hx => (min_le_left _ _).trans (hr _ hx _ hy)
· exact fun hx => (min_le_right _ _).trans (hr' _ hx _ hy)
#align is_metric_separated.union_left IsMetricSeparated.union_left
@[simp]
theorem union_left_iff {s'} :
IsMetricSeparated (s ∪ s') t ↔ IsMetricSeparated s t ∧ IsMetricSeparated s' t :=
⟨fun h => ⟨h.mono_left subset_union_left, h.mono_left subset_union_right⟩, fun h =>
h.1.union_left h.2⟩
#align is_metric_separated.union_left_iff IsMetricSeparated.union_left_iff
theorem union_right {t'} (h : IsMetricSeparated s t) (h' : IsMetricSeparated s t') :
IsMetricSeparated s (t ∪ t') :=
(h.symm.union_left h'.symm).symm
#align is_metric_separated.union_right IsMetricSeparated.union_right
@[simp]
theorem union_right_iff {t'} :
IsMetricSeparated s (t ∪ t') ↔ IsMetricSeparated s t ∧ IsMetricSeparated s t' :=
comm.trans <| union_left_iff.trans <| and_congr comm comm
#align is_metric_separated.union_right_iff IsMetricSeparated.union_right_iff
theorem finite_iUnion_left_iff {ι : Type*} {I : Set ι} (hI : I.Finite) {s : ι → Set X}
{t : Set X} : IsMetricSeparated (⋃ i ∈ I, s i) t ↔ ∀ i ∈ I, IsMetricSeparated (s i) t := by
refine Finite.induction_on hI (by simp) @fun i I _ _ hI => ?_
rw [biUnion_insert, forall_mem_insert, union_left_iff, hI]
#align is_metric_separated.finite_Union_left_iff IsMetricSeparated.finite_iUnion_left_iff
alias ⟨_, finite_iUnion_left⟩ := finite_iUnion_left_iff
#align is_metric_separated.finite_Union_left IsMetricSeparated.finite_iUnion_left
| Mathlib/Topology/MetricSpace/MetricSeparated.lean | 115 | 117 | theorem finite_iUnion_right_iff {ι : Type*} {I : Set ι} (hI : I.Finite) {s : Set X}
{t : ι → Set X} : IsMetricSeparated s (⋃ i ∈ I, t i) ↔ ∀ i ∈ I, IsMetricSeparated s (t i) := by |
simpa only [@comm _ _ s] using finite_iUnion_left_iff hI
|
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u v w
variable {ι : Sort u} {α : Type v} {β : Type w}
open Set
open OrderDual (toDual)
namespace Set
section UnionIxx
variable [LinearOrder α] {s : Set α} {a : α} {f : ι → α}
| Mathlib/Order/Interval/Set/Disjoint.lean | 201 | 205 | theorem IsGLB.biUnion_Ioi_eq (h : IsGLB s a) : ⋃ x ∈ s, Ioi x = Ioi a := by |
refine (iUnion₂_subset fun x hx => ?_).antisymm fun x hx => ?_
· exact Ioi_subset_Ioi (h.1 hx)
· rcases h.exists_between hx with ⟨y, hys, _, hyx⟩
exact mem_biUnion hys hyx
|
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Ring.Regular
import Mathlib.Tactic.Common
#align_import algebra.gcd_monoid.basic from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
variable {α : Type*}
-- Porting note: mathlib3 had a `@[protect_proj]` here, but adding `protected` to all the fields
-- adds unnecessary clutter to later code
class NormalizationMonoid (α : Type*) [CancelCommMonoidWithZero α] where
normUnit : α → αˣ
normUnit_zero : normUnit 0 = 1
normUnit_mul : ∀ {a b}, a ≠ 0 → b ≠ 0 → normUnit (a * b) = normUnit a * normUnit b
normUnit_coe_units : ∀ u : αˣ, normUnit u = u⁻¹
#align normalization_monoid NormalizationMonoid
export NormalizationMonoid (normUnit normUnit_zero normUnit_mul normUnit_coe_units)
attribute [simp] normUnit_coe_units normUnit_zero normUnit_mul
section NormalizationMonoid
variable [CancelCommMonoidWithZero α] [NormalizationMonoid α]
@[simp]
theorem normUnit_one : normUnit (1 : α) = 1 :=
normUnit_coe_units 1
#align norm_unit_one normUnit_one
-- Porting note (#11083): quite slow. Improve performance?
def normalize : α →*₀ α where
toFun x := x * normUnit x
map_zero' := by
simp only [normUnit_zero]
exact mul_one (0:α)
map_one' := by dsimp only; rw [normUnit_one, one_mul]; rfl
map_mul' x y :=
(by_cases fun hx : x = 0 => by dsimp only; rw [hx, zero_mul, zero_mul, zero_mul]) fun hx =>
(by_cases fun hy : y = 0 => by dsimp only; rw [hy, mul_zero, zero_mul, mul_zero]) fun hy => by
simp only [normUnit_mul hx hy, Units.val_mul]; simp only [mul_assoc, mul_left_comm y]
#align normalize normalize
theorem associated_normalize (x : α) : Associated x (normalize x) :=
⟨_, rfl⟩
#align associated_normalize associated_normalize
theorem normalize_associated (x : α) : Associated (normalize x) x :=
(associated_normalize _).symm
#align normalize_associated normalize_associated
theorem associated_normalize_iff {x y : α} : Associated x (normalize y) ↔ Associated x y :=
⟨fun h => h.trans (normalize_associated y), fun h => h.trans (associated_normalize y)⟩
#align associated_normalize_iff associated_normalize_iff
theorem normalize_associated_iff {x y : α} : Associated (normalize x) y ↔ Associated x y :=
⟨fun h => (associated_normalize _).trans h, fun h => (normalize_associated _).trans h⟩
#align normalize_associated_iff normalize_associated_iff
theorem Associates.mk_normalize (x : α) : Associates.mk (normalize x) = Associates.mk x :=
Associates.mk_eq_mk_iff_associated.2 (normalize_associated _)
#align associates.mk_normalize Associates.mk_normalize
@[simp]
theorem normalize_apply (x : α) : normalize x = x * normUnit x :=
rfl
#align normalize_apply normalize_apply
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_zero : normalize (0 : α) = 0 :=
normalize.map_zero
#align normalize_zero normalize_zero
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_one : normalize (1 : α) = 1 :=
normalize.map_one
#align normalize_one normalize_one
theorem normalize_coe_units (u : αˣ) : normalize (u : α) = 1 := by simp
#align normalize_coe_units normalize_coe_units
theorem normalize_eq_zero {x : α} : normalize x = 0 ↔ x = 0 :=
⟨fun hx => (associated_zero_iff_eq_zero x).1 <| hx ▸ associated_normalize _, by
rintro rfl; exact normalize_zero⟩
#align normalize_eq_zero normalize_eq_zero
theorem normalize_eq_one {x : α} : normalize x = 1 ↔ IsUnit x :=
⟨fun hx => isUnit_iff_exists_inv.2 ⟨_, hx⟩, fun ⟨u, hu⟩ => hu ▸ normalize_coe_units u⟩
#align normalize_eq_one normalize_eq_one
-- Porting note (#11083): quite slow. Improve performance?
@[simp]
| Mathlib/Algebra/GCDMonoid/Basic.lean | 162 | 166 | theorem normUnit_mul_normUnit (a : α) : normUnit (a * normUnit a) = 1 := by |
nontriviality α using Subsingleton.elim a 0
obtain rfl | h := eq_or_ne a 0
· rw [normUnit_zero, zero_mul, normUnit_zero]
· rw [normUnit_mul h (Units.ne_zero _), normUnit_coe_units, mul_inv_eq_one]
|
import Mathlib.AlgebraicGeometry.AffineScheme
import Mathlib.AlgebraicGeometry.Pullbacks
import Mathlib.CategoryTheory.MorphismProperty.Limits
import Mathlib.Data.List.TFAE
#align_import algebraic_geometry.morphisms.basic from "leanprover-community/mathlib"@"434e2fd21c1900747afc6d13d8be7f4eedba7218"
set_option linter.uppercaseLean3 false
universe u
open TopologicalSpace CategoryTheory CategoryTheory.Limits Opposite
noncomputable section
namespace AlgebraicGeometry
def AffineTargetMorphismProperty :=
∀ ⦃X Y : Scheme⦄ (_ : X ⟶ Y) [IsAffine Y], Prop
#align algebraic_geometry.affine_target_morphism_property AlgebraicGeometry.AffineTargetMorphismProperty
protected def Scheme.isIso : MorphismProperty Scheme :=
@IsIso Scheme _
#align algebraic_geometry.Scheme.is_iso AlgebraicGeometry.Scheme.isIso
protected def Scheme.affineTargetIsIso : AffineTargetMorphismProperty := fun _ _ f _ => IsIso f
#align algebraic_geometry.Scheme.affine_target_is_iso AlgebraicGeometry.Scheme.affineTargetIsIso
instance : Inhabited AffineTargetMorphismProperty := ⟨Scheme.affineTargetIsIso⟩
def AffineTargetMorphismProperty.toProperty (P : AffineTargetMorphismProperty) :
MorphismProperty Scheme := fun _ _ f => ∃ h, @P _ _ f h
#align algebraic_geometry.affine_target_morphism_property.to_property AlgebraicGeometry.AffineTargetMorphismProperty.toProperty
theorem AffineTargetMorphismProperty.toProperty_apply (P : AffineTargetMorphismProperty)
{X Y : Scheme} (f : X ⟶ Y) [i : IsAffine Y] : P.toProperty f ↔ P f := by
delta AffineTargetMorphismProperty.toProperty; simp [*]
#align algebraic_geometry.affine_target_morphism_property.to_property_apply AlgebraicGeometry.AffineTargetMorphismProperty.toProperty_apply
| Mathlib/AlgebraicGeometry/Morphisms/Basic.lean | 99 | 101 | theorem affine_cancel_left_isIso {P : AffineTargetMorphismProperty} (hP : P.toProperty.RespectsIso)
{X Y Z : Scheme} (f : X ⟶ Y) (g : Y ⟶ Z) [IsIso f] [IsAffine Z] : P (f ≫ g) ↔ P g := by |
rw [← P.toProperty_apply, ← P.toProperty_apply, hP.cancel_left_isIso]
|
import Batteries.Data.List.Lemmas
import Batteries.Tactic.Classical
import Mathlib.Tactic.TypeStar
import Mathlib.Mathport.Rename
#align_import data.list.tfae from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
namespace List
def TFAE (l : List Prop) : Prop :=
∀ x ∈ l, ∀ y ∈ l, x ↔ y
#align list.tfae List.TFAE
theorem tfae_nil : TFAE [] :=
forall_mem_nil _
#align list.tfae_nil List.tfae_nil
@[simp]
theorem tfae_singleton (p) : TFAE [p] := by simp [TFAE, -eq_iff_iff]
#align list.tfae_singleton List.tfae_singleton
theorem tfae_cons_of_mem {a b} {l : List Prop} (h : b ∈ l) : TFAE (a :: l) ↔ (a ↔ b) ∧ TFAE l :=
⟨fun H => ⟨H a (by simp) b (Mem.tail a h),
fun p hp q hq => H _ (Mem.tail a hp) _ (Mem.tail a hq)⟩,
by
rintro ⟨ab, H⟩ p (_ | ⟨_, hp⟩) q (_ | ⟨_, hq⟩)
· rfl
· exact ab.trans (H _ h _ hq)
· exact (ab.trans (H _ h _ hp)).symm
· exact H _ hp _ hq⟩
#align list.tfae_cons_of_mem List.tfae_cons_of_mem
theorem tfae_cons_cons {a b} {l : List Prop} : TFAE (a :: b :: l) ↔ (a ↔ b) ∧ TFAE (b :: l) :=
tfae_cons_of_mem (Mem.head _)
#align list.tfae_cons_cons List.tfae_cons_cons
@[simp]
theorem tfae_cons_self {a} {l : List Prop} : TFAE (a :: a :: l) ↔ TFAE (a :: l) := by
simp [tfae_cons_cons]
theorem tfae_of_forall (b : Prop) (l : List Prop) (h : ∀ a ∈ l, a ↔ b) : TFAE l :=
fun _a₁ h₁ _a₂ h₂ => (h _ h₁).trans (h _ h₂).symm
#align list.tfae_of_forall List.tfae_of_forall
theorem tfae_of_cycle {a b} {l : List Prop} (h_chain : List.Chain (· → ·) a (b :: l))
(h_last : getLastD l b → a) : TFAE (a :: b :: l) := by
induction l generalizing a b with
| nil => simp_all [tfae_cons_cons, iff_def]
| cons c l IH =>
simp only [tfae_cons_cons, getLastD_cons, tfae_singleton, and_true, chain_cons, Chain.nil] at *
rcases h_chain with ⟨ab, ⟨bc, ch⟩⟩
have := IH ⟨bc, ch⟩ (ab ∘ h_last)
exact ⟨⟨ab, h_last ∘ (this.2 c (.head _) _ (getLastD_mem_cons _ _)).1 ∘ bc⟩, this⟩
#align list.tfae_of_cycle List.tfae_of_cycle
theorem TFAE.out {l} (h : TFAE l) (n₁ n₂) {a b} (h₁ : List.get? l n₁ = some a := by rfl)
(h₂ : List.get? l n₂ = some b := by rfl) : a ↔ b :=
h _ (List.get?_mem h₁) _ (List.get?_mem h₂)
#align list.tfae.out List.TFAE.out
| Mathlib/Data/List/TFAE.lean | 91 | 96 | theorem forall_tfae {α : Type*} (l : List (α → Prop)) (H : ∀ a : α, (l.map (fun p ↦ p a)).TFAE) :
(l.map (fun p ↦ ∀ a, p a)).TFAE := by |
simp only [TFAE, List.forall_mem_map_iff]
intros p₁ hp₁ p₂ hp₂
exact forall_congr' fun a ↦ H a (p₁ a) (mem_map_of_mem (fun p ↦ p a) hp₁)
(p₂ a) (mem_map_of_mem (fun p ↦ p a) hp₂)
|
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Polynomial.Degree.Lemmas
#align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448"
noncomputable section
open Polynomial
open Polynomial Finset
namespace Polynomial
variable {R : Type*} [Semiring R] {f : R[X]}
def eraseLead (f : R[X]) : R[X] :=
Polynomial.erase f.natDegree f
#align polynomial.erase_lead Polynomial.eraseLead
section EraseLead
theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by
simp only [eraseLead, support_erase]
#align polynomial.erase_lead_support Polynomial.eraseLead_support
| Mathlib/Algebra/Polynomial/EraseLead.lean | 46 | 48 | theorem eraseLead_coeff (i : ℕ) :
f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by |
simp only [eraseLead, coeff_erase]
|
import Mathlib.Algebra.Algebra.Subalgebra.Unitization
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.StarSubalgebra
import Mathlib.Topology.ContinuousFunction.ContinuousMapZero
import Mathlib.Topology.ContinuousFunction.Weierstrass
#align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb"
noncomputable section
namespace ContinuousMap
variable {X : Type*} [TopologicalSpace X] [CompactSpace X]
open scoped Polynomial
def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where
toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩
#align continuous_map.attach_bound ContinuousMap.attachBound
@[simp]
theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x :=
rfl
#align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe
theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) :
(g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound =
Polynomial.aeval f g := by
ext
simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe,
Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe,
Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply]
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [ContinuousMap.attachBound_apply_coe]
#align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound
theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) :
(g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by
rw [polynomial_comp_attachBound]
apply SetLike.coe_mem
#align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem
theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A)
(p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem,
have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure :=
continuousMap_mem_polynomialFunctions_closure _ _ p
-- and so there are polynomials arbitrarily close.
have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure
-- To prove `p.comp (attachBound f)` is in the closure of `A`,
-- we show there are elements of `A` arbitrarily close.
apply mem_closure_iff_frequently.mpr
-- To show that, we pull back the polynomials close to `p`,
refine
((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt
p).tendsto.frequently_map
_ ?_ frequently_mem_polynomials
-- but need to show that those pullbacks are actually in `A`.
rintro _ ⟨g, ⟨-, rfl⟩⟩
simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply,
Polynomial.toContinuousMapOnAlgHom_apply]
apply polynomial_comp_attachBound_mem
#align continuous_map.comp_attach_bound_mem_closure ContinuousMap.comp_attachBound_mem_closure
theorem abs_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) :
|(f : C(X, ℝ))| ∈ A.topologicalClosure := by
let f' := attachBound (f : C(X, ℝ))
let abs : C(Set.Icc (-‖f‖) ‖f‖, ℝ) := { toFun := fun x : Set.Icc (-‖f‖) ‖f‖ => |(x : ℝ)| }
change abs.comp f' ∈ A.topologicalClosure
apply comp_attachBound_mem_closure
#align continuous_map.abs_mem_subalgebra_closure ContinuousMap.abs_mem_subalgebra_closure
theorem inf_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) :
(f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A.topologicalClosure := by
rw [inf_eq_half_smul_add_sub_abs_sub' ℝ]
refine
A.topologicalClosure.smul_mem
(A.topologicalClosure.sub_mem
(A.topologicalClosure.add_mem (A.le_topologicalClosure f.property)
(A.le_topologicalClosure g.property))
?_)
_
exact mod_cast abs_mem_subalgebra_closure A _
#align continuous_map.inf_mem_subalgebra_closure ContinuousMap.inf_mem_subalgebra_closure
theorem inf_mem_closed_subalgebra (A : Subalgebra ℝ C(X, ℝ)) (h : IsClosed (A : Set C(X, ℝ)))
(f g : A) : (f : C(X, ℝ)) ⊓ (g : C(X, ℝ)) ∈ A := by
convert inf_mem_subalgebra_closure A f g
apply SetLike.ext'
symm
erw [closure_eq_iff_isClosed]
exact h
#align continuous_map.inf_mem_closed_subalgebra ContinuousMap.inf_mem_closed_subalgebra
| Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean | 146 | 156 | theorem sup_mem_subalgebra_closure (A : Subalgebra ℝ C(X, ℝ)) (f g : A) :
(f : C(X, ℝ)) ⊔ (g : C(X, ℝ)) ∈ A.topologicalClosure := by |
rw [sup_eq_half_smul_add_add_abs_sub' ℝ]
refine
A.topologicalClosure.smul_mem
(A.topologicalClosure.add_mem
(A.topologicalClosure.add_mem (A.le_topologicalClosure f.property)
(A.le_topologicalClosure g.property))
?_)
_
exact mod_cast abs_mem_subalgebra_closure A _
|
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Fintype.Vector
import Mathlib.Data.Multiset.Sym
#align_import data.finset.sym from "leanprover-community/mathlib"@"02ba8949f486ebecf93fe7460f1ed0564b5e442c"
namespace Finset
variable {α : Type*}
@[simps]
protected def sym2 (s : Finset α) : Finset (Sym2 α) := ⟨s.1.sym2, s.2.sym2⟩
#align finset.sym2 Finset.sym2
section
variable {s t : Finset α} {a b : α}
| Mathlib/Data/Finset/Sym.lean | 46 | 47 | theorem mk_mem_sym2_iff : s(a, b) ∈ s.sym2 ↔ a ∈ s ∧ b ∈ s := by |
rw [mem_mk, sym2_val, Multiset.mk_mem_sym2_iff, mem_mk, mem_mk]
|
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 47 | 50 | theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by |
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
|
import Mathlib.Analysis.Calculus.BumpFunction.Basic
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Function Filter Set Metric MeasureTheory FiniteDimensional Measure
open scoped Topology
namespace ContDiffBump
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [HasContDiffBump E]
[MeasurableSpace E] {c : E} (f : ContDiffBump c) {x : E} {n : ℕ∞} {μ : Measure E}
protected def normed (μ : Measure E) : E → ℝ := fun x => f x / ∫ x, f x ∂μ
#align cont_diff_bump.normed ContDiffBump.normed
theorem normed_def {μ : Measure E} (x : E) : f.normed μ x = f x / ∫ x, f x ∂μ :=
rfl
#align cont_diff_bump.normed_def ContDiffBump.normed_def
theorem nonneg_normed (x : E) : 0 ≤ f.normed μ x :=
div_nonneg f.nonneg <| integral_nonneg f.nonneg'
#align cont_diff_bump.nonneg_normed ContDiffBump.nonneg_normed
theorem contDiff_normed {n : ℕ∞} : ContDiff ℝ n (f.normed μ) :=
f.contDiff.div_const _
#align cont_diff_bump.cont_diff_normed ContDiffBump.contDiff_normed
theorem continuous_normed : Continuous (f.normed μ) :=
f.continuous.div_const _
#align cont_diff_bump.continuous_normed ContDiffBump.continuous_normed
theorem normed_sub (x : E) : f.normed μ (c - x) = f.normed μ (c + x) := by
simp_rw [f.normed_def, f.sub]
#align cont_diff_bump.normed_sub ContDiffBump.normed_sub
| Mathlib/Analysis/Calculus/BumpFunction/Normed.lean | 53 | 54 | theorem normed_neg (f : ContDiffBump (0 : E)) (x : E) : f.normed μ (-x) = f.normed μ x := by |
simp_rw [f.normed_def, f.neg]
|
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Filter Asymptotics Set
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
(iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv iteratedDeriv
def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F :=
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1
#align iterated_deriv_within iteratedDerivWithin
variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜}
theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by
ext x
rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ]
#align iterated_deriv_within_univ iteratedDerivWithin_univ
theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x =
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 :=
rfl
#align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin
theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s =
(ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by
ext x; rfl
#align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_eq_equiv_comp :
iteratedFDerivWithin 𝕜 n f s =
ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm,
Function.id_comp]
#align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp
theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} :
(iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m =
(∏ i, m i) • iteratedDerivWithin n f s x := by
rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ]
simp
#align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod
| Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean | 107 | 109 | theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin :
‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by |
rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map]
|
import Mathlib.Analysis.Calculus.Deriv.Add
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v
open Filter Set
open scoped Topology Classical
section Module
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → ℝ} {a : E} {f' : E →L[ℝ] ℝ}
def posTangentConeAt (s : Set E) (x : E) : Set E :=
{ y : E | ∃ (c : ℕ → ℝ) (d : ℕ → E), (∀ᶠ n in atTop, x + d n ∈ s) ∧
Tendsto c atTop atTop ∧ Tendsto (fun n => c n • d n) atTop (𝓝 y) }
#align pos_tangent_cone_at posTangentConeAt
theorem posTangentConeAt_mono : Monotone fun s => posTangentConeAt s a := by
rintro s t hst y ⟨c, d, hd, hc, hcd⟩
exact ⟨c, d, mem_of_superset hd fun h hn => hst hn, hc, hcd⟩
#align pos_tangent_cone_at_mono posTangentConeAt_mono
theorem mem_posTangentConeAt_of_segment_subset {s : Set E} {x y : E} (h : segment ℝ x y ⊆ s) :
y - x ∈ posTangentConeAt s x := by
let c := fun n : ℕ => (2 : ℝ) ^ n
let d := fun n : ℕ => (c n)⁻¹ • (y - x)
refine ⟨c, d, Filter.univ_mem' fun n => h ?_, tendsto_pow_atTop_atTop_of_one_lt one_lt_two, ?_⟩
· show x + d n ∈ segment ℝ x y
rw [segment_eq_image']
refine ⟨(c n)⁻¹, ⟨?_, ?_⟩, rfl⟩
exacts [inv_nonneg.2 (pow_nonneg zero_le_two _), inv_le_one (one_le_pow_of_one_le one_le_two _)]
· show Tendsto (fun n => c n • d n) atTop (𝓝 (y - x))
exact tendsto_const_nhds.congr fun n ↦ (smul_inv_smul₀ (pow_ne_zero _ two_ne_zero) _).symm
#align mem_pos_tangent_cone_at_of_segment_subset mem_posTangentConeAt_of_segment_subset
| Mathlib/Analysis/Calculus/LocalExtr/Basic.lean | 99 | 101 | theorem mem_posTangentConeAt_of_segment_subset' {s : Set E} {x y : E}
(h : segment ℝ x (x + y) ⊆ s) : y ∈ posTangentConeAt s x := by |
simpa only [add_sub_cancel_left] using mem_posTangentConeAt_of_segment_subset h
|
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀
#align euclidean_domain.mul_div_cancel mul_div_cancel_right₀
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a :=
⟨fun h => by
rw [← div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun ⟨c, e⟩ => by
rw [e, ← add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
· simp only [b0, zero_mul]
· rw [mul_div_cancel_left₀ _ b0]⟩
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by
rw [← dvd_add_right (h.mul_right _), div_add_mod]
#align euclidean_domain.dvd_mod_iff EuclideanDomain.dvd_mod_iff
@[simp]
theorem mod_one (a : R) : a % 1 = 0 :=
mod_eq_zero.2 (one_dvd _)
#align euclidean_domain.mod_one EuclideanDomain.mod_one
@[simp]
theorem zero_mod (b : R) : 0 % b = 0 :=
mod_eq_zero.2 (dvd_zero _)
#align euclidean_domain.zero_mod EuclideanDomain.zero_mod
@[simp]
theorem zero_div {a : R} : 0 / a = 0 :=
by_cases (fun a0 : a = 0 => a0.symm ▸ div_zero 0) fun a0 => by
simpa only [zero_mul] using mul_div_cancel_right₀ 0 a0
#align euclidean_domain.zero_div EuclideanDomain.zero_div
@[simp]
theorem div_self {a : R} (a0 : a ≠ 0) : a / a = 1 := by
simpa only [one_mul] using mul_div_cancel_right₀ 1 a0
#align euclidean_domain.div_self EuclideanDomain.div_self
theorem eq_div_of_mul_eq_left {a b c : R} (hb : b ≠ 0) (h : a * b = c) : a = c / b := by
rw [← h, mul_div_cancel_right₀ _ hb]
#align euclidean_domain.eq_div_of_mul_eq_left EuclideanDomain.eq_div_of_mul_eq_left
theorem eq_div_of_mul_eq_right {a b c : R} (ha : a ≠ 0) (h : a * b = c) : b = c / a := by
rw [← h, mul_div_cancel_left₀ _ ha]
#align euclidean_domain.eq_div_of_mul_eq_right EuclideanDomain.eq_div_of_mul_eq_right
theorem mul_div_assoc (x : R) {y z : R} (h : z ∣ y) : x * y / z = x * (y / z) := by
by_cases hz : z = 0
· subst hz
rw [div_zero, div_zero, mul_zero]
rcases h with ⟨p, rfl⟩
rw [mul_div_cancel_left₀ _ hz, mul_left_comm, mul_div_cancel_left₀ _ hz]
#align euclidean_domain.mul_div_assoc EuclideanDomain.mul_div_assoc
protected theorem mul_div_cancel' {a b : R} (hb : b ≠ 0) (hab : b ∣ a) : b * (a / b) = a := by
rw [← mul_div_assoc _ hab, mul_div_cancel_left₀ _ hb]
#align euclidean_domain.mul_div_cancel' EuclideanDomain.mul_div_cancel'
-- This generalizes `Int.div_one`, see note [simp-normal form]
@[simp]
theorem div_one (p : R) : p / 1 = p :=
(EuclideanDomain.eq_div_of_mul_eq_left (one_ne_zero' R) (mul_one p)).symm
#align euclidean_domain.div_one EuclideanDomain.div_one
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 114 | 120 | theorem div_dvd_of_dvd {p q : R} (hpq : q ∣ p) : p / q ∣ p := by |
by_cases hq : q = 0
· rw [hq, zero_dvd_iff] at hpq
rw [hpq]
exact dvd_zero _
use q
rw [mul_comm, ← EuclideanDomain.mul_div_assoc _ hpq, mul_comm, mul_div_cancel_right₀ _ hq]
|
import Mathlib.CategoryTheory.Sites.Coherent.RegularSheaves
namespace CategoryTheory.regularTopology
open Limits
variable {C : Type*} [Category C] [Preregular C] {X : C}
| Mathlib/CategoryTheory/Sites/Coherent/RegularTopology.lean | 30 | 41 | theorem mem_sieves_of_hasEffectiveEpi (S : Sieve X) :
(∃ (Y : C) (π : Y ⟶ X), EffectiveEpi π ∧ S.arrows π) → (S ∈ (regularTopology C).sieves X) := by |
rintro ⟨Y, π, h⟩
have h_le : Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun _ ↦ π)) ≤ S := by
rw [Sieve.sets_iff_generate (Presieve.ofArrows _ _) S]
apply Presieve.le_of_factorsThru_sieve (Presieve.ofArrows _ _) S _
intro W g f
refine ⟨W, 𝟙 W, ?_⟩
cases f
exact ⟨π, ⟨h.2, Category.id_comp π⟩⟩
apply Coverage.saturate_of_superset (regularCoverage C) h_le
exact Coverage.saturate.of X _ ⟨Y, π, rfl, h.1⟩
|
import Mathlib.Data.Finset.Sum
import Mathlib.Data.Sum.Order
import Mathlib.Order.Interval.Finset.Defs
#align_import data.sum.interval from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999"
open Function Sum
namespace Finset
variable {α₁ α₂ β₁ β₂ γ₁ γ₂ : Type*}
section SumLift₂
variable (f f₁ g₁ : α₁ → β₁ → Finset γ₁) (g f₂ g₂ : α₂ → β₂ → Finset γ₂)
@[simp]
def sumLift₂ : ∀ (_ : Sum α₁ α₂) (_ : Sum β₁ β₂), Finset (Sum γ₁ γ₂)
| inl a, inl b => (f a b).map Embedding.inl
| inl _, inr _ => ∅
| inr _, inl _ => ∅
| inr a, inr b => (g a b).map Embedding.inr
#align finset.sum_lift₂ Finset.sumLift₂
variable {f f₁ g₁ g f₂ g₂} {a : Sum α₁ α₂} {b : Sum β₁ β₂} {c : Sum γ₁ γ₂}
theorem mem_sumLift₂ :
c ∈ sumLift₂ f g a b ↔
(∃ a₁ b₁ c₁, a = inl a₁ ∧ b = inl b₁ ∧ c = inl c₁ ∧ c₁ ∈ f a₁ b₁) ∨
∃ a₂ b₂ c₂, a = inr a₂ ∧ b = inr b₂ ∧ c = inr c₂ ∧ c₂ ∈ g a₂ b₂ := by
constructor
· cases' a with a a <;> cases' b with b b
· rw [sumLift₂, mem_map]
rintro ⟨c, hc, rfl⟩
exact Or.inl ⟨a, b, c, rfl, rfl, rfl, hc⟩
· refine fun h ↦ (not_mem_empty _ h).elim
· refine fun h ↦ (not_mem_empty _ h).elim
· rw [sumLift₂, mem_map]
rintro ⟨c, hc, rfl⟩
exact Or.inr ⟨a, b, c, rfl, rfl, rfl, hc⟩
· rintro (⟨a, b, c, rfl, rfl, rfl, h⟩ | ⟨a, b, c, rfl, rfl, rfl, h⟩) <;> exact mem_map_of_mem _ h
#align finset.mem_sum_lift₂ Finset.mem_sumLift₂
| Mathlib/Data/Sum/Interval.lean | 60 | 65 | theorem inl_mem_sumLift₂ {c₁ : γ₁} :
inl c₁ ∈ sumLift₂ f g a b ↔ ∃ a₁ b₁, a = inl a₁ ∧ b = inl b₁ ∧ c₁ ∈ f a₁ b₁ := by |
rw [mem_sumLift₂, or_iff_left]
· simp only [inl.injEq, exists_and_left, exists_eq_left']
rintro ⟨_, _, c₂, _, _, h, _⟩
exact inl_ne_inr h
|
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
{v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).vars ⊆ p.vars ∪ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars ∪ q.vars := by
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
#align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint
section Mul
theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by
simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset]
exact Multiset.subset_of_le (degrees_mul φ ψ)
#align mv_polynomial.vars_mul MvPolynomial.vars_mul
@[simp]
theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ :=
vars_C
#align mv_polynomial.vars_one MvPolynomial.vars_one
theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by
classical
induction' n with n ih
· simp
· rw [pow_succ']
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset (Finset.Subset.refl _) ih
#align mv_polynomial.vars_pow MvPolynomial.vars_pow
theorem vars_prod {ι : Type*} [DecidableEq σ] {s : Finset ι} (f : ι → MvPolynomial σ R) :
(∏ i ∈ s, f i).vars ⊆ s.biUnion fun i => (f i).vars := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert hs hsub =>
simp only [hs, Finset.biUnion_insert, Finset.prod_insert, not_false_iff]
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset_union (Finset.Subset.refl _) hsub
#align mv_polynomial.vars_prod MvPolynomial.vars_prod
section Map
variable [CommSemiring S] (f : R →+* S)
variable (p)
theorem vars_map : (map f p).vars ⊆ p.vars := by classical simp [vars_def, degrees_map]
#align mv_polynomial.vars_map MvPolynomial.vars_map
variable {f}
| Mathlib/Algebra/MvPolynomial/Variables.lean | 222 | 223 | theorem vars_map_of_injective (hf : Injective f) : (map f p).vars = p.vars := by |
simp [vars, degrees_map_of_injective _ hf]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.