Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | goals listlengths 0 224 | goals_before listlengths 0 220 |
|---|---|---|---|---|---|---|---|
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.AddTorsor
#align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {ι : Type*} {E P : Type*}
open Metric Set
open scoped Convex
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s t : Set E}
theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm :=
⟨hs, fun x _ y _ a b ha hb _ =>
calc
‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _
_ = a * ‖x‖ + b * ‖y‖ := by
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
#align convex_on_norm convexOn_norm
theorem convexOn_univ_norm : ConvexOn ℝ univ (norm : E → ℝ) :=
convexOn_norm convex_univ
#align convex_on_univ_norm convexOn_univ_norm
theorem convexOn_dist (z : E) (hs : Convex ℝ s) : ConvexOn ℝ s fun z' => dist z' z := by
simpa [dist_eq_norm, preimage_preimage] using
(convexOn_norm (hs.translate (-z))).comp_affineMap (AffineMap.id ℝ E - AffineMap.const ℝ E z)
#align convex_on_dist convexOn_dist
theorem convexOn_univ_dist (z : E) : ConvexOn ℝ univ fun z' => dist z' z :=
convexOn_dist z convex_univ
#align convex_on_univ_dist convexOn_univ_dist
theorem convex_ball (a : E) (r : ℝ) : Convex ℝ (Metric.ball a r) := by
simpa only [Metric.ball, sep_univ] using (convexOn_univ_dist a).convex_lt r
#align convex_ball convex_ball
theorem convex_closedBall (a : E) (r : ℝ) : Convex ℝ (Metric.closedBall a r) := by
simpa only [Metric.closedBall, sep_univ] using (convexOn_univ_dist a).convex_le r
#align convex_closed_ball convex_closedBall
theorem Convex.thickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (thickening δ s) := by
rw [← add_ball_zero]
exact hs.add (convex_ball 0 _)
#align convex.thickening Convex.thickening
theorem Convex.cthickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (cthickening δ s) := by
obtain hδ | hδ := le_total 0 δ
· rw [cthickening_eq_iInter_thickening hδ]
exact convex_iInter₂ fun _ _ => hs.thickening _
· rw [cthickening_of_nonpos hδ]
exact hs.closure
#align convex.cthickening Convex.cthickening
theorem convexHull_exists_dist_ge {s : Set E} {x : E} (hx : x ∈ convexHull ℝ s) (y : E) :
∃ x' ∈ s, dist x y ≤ dist x' y :=
(convexOn_dist y (convex_convexHull ℝ _)).exists_ge_of_mem_convexHull hx
#align convex_hull_exists_dist_ge convexHull_exists_dist_ge
theorem convexHull_exists_dist_ge2 {s t : Set E} {x y : E} (hx : x ∈ convexHull ℝ s)
(hy : y ∈ convexHull ℝ t) : ∃ x' ∈ s, ∃ y' ∈ t, dist x y ≤ dist x' y' := by
rcases convexHull_exists_dist_ge hx y with ⟨x', hx', Hx'⟩
rcases convexHull_exists_dist_ge hy x' with ⟨y', hy', Hy'⟩
use x', hx', y', hy'
exact le_trans Hx' (dist_comm y x' ▸ dist_comm y' x' ▸ Hy')
#align convex_hull_exists_dist_ge2 convexHull_exists_dist_ge2
@[simp]
theorem convexHull_ediam (s : Set E) : EMetric.diam (convexHull ℝ s) = EMetric.diam s := by
refine (EMetric.diam_le fun x hx y hy => ?_).antisymm (EMetric.diam_mono <| subset_convexHull ℝ s)
rcases convexHull_exists_dist_ge2 hx hy with ⟨x', hx', y', hy', H⟩
rw [edist_dist]
apply le_trans (ENNReal.ofReal_le_ofReal H)
rw [← edist_dist]
exact EMetric.edist_le_diam_of_mem hx' hy'
#align convex_hull_ediam convexHull_ediam
@[simp]
theorem convexHull_diam (s : Set E) : Metric.diam (convexHull ℝ s) = Metric.diam s := by
simp only [Metric.diam, convexHull_ediam]
#align convex_hull_diam convexHull_diam
@[simp]
| Mathlib/Analysis/Convex/Normed.lean | 119 | 121 | theorem isBounded_convexHull {s : Set E} :
Bornology.IsBounded (convexHull ℝ s) ↔ Bornology.IsBounded s := by |
simp only [Metric.isBounded_iff_ediam_ne_top, convexHull_ediam]
| [
" ‖a • x‖ + ‖b • y‖ = a * ‖x‖ + b * ‖y‖",
" ConvexOn ℝ s fun z' => dist z' z",
" Convex ℝ (ball a r)",
" Convex ℝ (closedBall a r)",
" Convex ℝ (Metric.thickening δ s)",
" Convex ℝ (s + ball 0 δ)",
" Convex ℝ (Metric.cthickening δ s)",
" Convex ℝ (⋂ ε, ⋂ (_ : δ < ε), Metric.thickening ε s)",
" Conve... | [
" ‖a • x‖ + ‖b • y‖ = a * ‖x‖ + b * ‖y‖",
" ConvexOn ℝ s fun z' => dist z' z",
" Convex ℝ (ball a r)",
" Convex ℝ (closedBall a r)",
" Convex ℝ (Metric.thickening δ s)",
" Convex ℝ (s + ball 0 δ)",
" Convex ℝ (Metric.cthickening δ s)",
" Convex ℝ (⋂ ε, ⋂ (_ : δ < ε), Metric.thickening ε s)",
" Conve... |
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.IsomorphismClasses
import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects
#align_import category_theory.limits.shapes.zero_morphisms from "leanprover-community/mathlib"@"f7707875544ef1f81b32cb68c79e0e24e45a0e76"
noncomputable section
universe v u
universe v' u'
open CategoryTheory
open CategoryTheory.Category
open scoped Classical
namespace CategoryTheory.Limits
variable (C : Type u) [Category.{v} C]
variable (D : Type u') [Category.{v'} D]
class HasZeroMorphisms where
[zero : ∀ X Y : C, Zero (X ⟶ Y)]
comp_zero : ∀ {X Y : C} (f : X ⟶ Y) (Z : C), f ≫ (0 : Y ⟶ Z) = (0 : X ⟶ Z) := by aesop_cat
zero_comp : ∀ (X : C) {Y Z : C} (f : Y ⟶ Z), (0 : X ⟶ Y) ≫ f = (0 : X ⟶ Z) := by aesop_cat
#align category_theory.limits.has_zero_morphisms CategoryTheory.Limits.HasZeroMorphisms
#align category_theory.limits.has_zero_morphisms.comp_zero' CategoryTheory.Limits.HasZeroMorphisms.comp_zero
#align category_theory.limits.has_zero_morphisms.zero_comp' CategoryTheory.Limits.HasZeroMorphisms.zero_comp
attribute [instance] HasZeroMorphisms.zero
variable {C}
@[simp]
theorem comp_zero [HasZeroMorphisms C] {X Y : C} {f : X ⟶ Y} {Z : C} :
f ≫ (0 : Y ⟶ Z) = (0 : X ⟶ Z) :=
HasZeroMorphisms.comp_zero f Z
#align category_theory.limits.comp_zero CategoryTheory.Limits.comp_zero
@[simp]
theorem zero_comp [HasZeroMorphisms C] {X : C} {Y Z : C} {f : Y ⟶ Z} :
(0 : X ⟶ Y) ≫ f = (0 : X ⟶ Z) :=
HasZeroMorphisms.zero_comp X f
#align category_theory.limits.zero_comp CategoryTheory.Limits.zero_comp
instance hasZeroMorphismsPEmpty : HasZeroMorphisms (Discrete PEmpty) where
zero := by aesop_cat
#align category_theory.limits.has_zero_morphisms_pempty CategoryTheory.Limits.hasZeroMorphismsPEmpty
instance hasZeroMorphismsPUnit : HasZeroMorphisms (Discrete PUnit) where
zero X Y := by repeat (constructor)
#align category_theory.limits.has_zero_morphisms_punit CategoryTheory.Limits.hasZeroMorphismsPUnit
open Opposite HasZeroMorphisms
instance hasZeroMorphismsOpposite [HasZeroMorphisms C] : HasZeroMorphisms Cᵒᵖ where
zero X Y := ⟨(0 : unop Y ⟶ unop X).op⟩
comp_zero f Z := congr_arg Quiver.Hom.op (HasZeroMorphisms.zero_comp (unop Z) f.unop)
zero_comp X {Y Z} (f : Y ⟶ Z) :=
congrArg Quiver.Hom.op (HasZeroMorphisms.comp_zero f.unop (unop X))
#align category_theory.limits.has_zero_morphisms_opposite CategoryTheory.Limits.hasZeroMorphismsOpposite
section
variable [HasZeroMorphisms C]
@[simp] lemma op_zero (X Y : C) : (0 : X ⟶ Y).op = 0 := rfl
#align category_theory.op_zero CategoryTheory.Limits.op_zero
@[simp] lemma unop_zero (X Y : Cᵒᵖ) : (0 : X ⟶ Y).unop = 0 := rfl
#align category_theory.unop_zero CategoryTheory.Limits.unop_zero
| Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean | 140 | 142 | theorem zero_of_comp_mono {X Y Z : C} {f : X ⟶ Y} (g : Y ⟶ Z) [Mono g] (h : f ≫ g = 0) : f = 0 := by |
rw [← zero_comp, cancel_mono] at h
exact h
| [] | [] |
import Mathlib.Algebra.BigOperators.Module
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Order.Filter.ModEq
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.List.TFAE
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.specific_limits.normed from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Set Function Filter Finset Metric Asymptotics
open scoped Classical
open Topology Nat uniformity NNReal ENNReal
variable {α : Type*} {β : Type*} {ι : Type*}
theorem tendsto_norm_atTop_atTop : Tendsto (norm : ℝ → ℝ) atTop atTop :=
tendsto_abs_atTop_atTop
#align tendsto_norm_at_top_at_top tendsto_norm_atTop_atTop
theorem summable_of_absolute_convergence_real {f : ℕ → ℝ} :
(∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f
| ⟨r, hr⟩ => by
refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩
· exact fun i ↦ norm_nonneg _
· simpa only using hr
#align summable_of_absolute_convergence_real summable_of_absolute_convergence_real
theorem tendsto_norm_zero' {𝕜 : Type*} [NormedAddCommGroup 𝕜] :
Tendsto (norm : 𝕜 → ℝ) (𝓝[≠] 0) (𝓝[>] 0) :=
tendsto_norm_zero.inf <| tendsto_principal_principal.2 fun _ hx ↦ norm_pos_iff.2 hx
#align tendsto_norm_zero' tendsto_norm_zero'
namespace NormedField
theorem tendsto_norm_inverse_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] :
Tendsto (fun x : 𝕜 ↦ ‖x⁻¹‖) (𝓝[≠] 0) atTop :=
(tendsto_inv_zero_atTop.comp tendsto_norm_zero').congr fun x ↦ (norm_inv x).symm
#align normed_field.tendsto_norm_inverse_nhds_within_0_at_top NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
| Mathlib/Analysis/SpecificLimits/Normed.lean | 62 | 68 | theorem tendsto_norm_zpow_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] {m : ℤ}
(hm : m < 0) :
Tendsto (fun x : 𝕜 ↦ ‖x ^ m‖) (𝓝[≠] 0) atTop := by |
rcases neg_surjective m with ⟨m, rfl⟩
rw [neg_lt_zero] at hm; lift m to ℕ using hm.le; rw [Int.natCast_pos] at hm
simp only [norm_pow, zpow_neg, zpow_natCast, ← inv_pow]
exact (tendsto_pow_atTop hm.ne').comp NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
| [
" Summable f",
" ∀ (i : ℕ), 0 ≤ ‖f i‖",
" Tendsto (fun n => ∑ i ∈ Finset.range n, ‖f i‖) atTop (𝓝 r)",
" Tendsto (fun x => ‖x ^ m‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-↑m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x⁻¹‖ ^ m) (𝓝[≠] 0) atTop"
] | [
" Summable f",
" ∀ (i : ℕ), 0 ≤ ‖f i‖",
" Tendsto (fun n => ∑ i ∈ Finset.range n, ‖f i‖) atTop (𝓝 r)"
] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply]
#align polynomial.taylor_zero Polynomial.taylor_zero
@[simp]
theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C]
#align polynomial.taylor_one Polynomial.taylor_one
@[simp]
theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
#align polynomial.taylor_monomial Polynomial.taylor_monomial
theorem taylor_coeff (n : ℕ) : (taylor r f).coeff n = (hasseDeriv n f).eval r :=
show (lcoeff R n).comp (taylor r) f = (leval r).comp (hasseDeriv n) f by
congr 1; clear! f; ext i
simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul,
hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i,
map_sum]
simp only [lcoeff_apply, ← C_eq_natCast, mul_assoc, ← C_pow, ← C_mul, coeff_mul_C,
(Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range]
split_ifs with h; · rfl
push_neg at h; rw [Nat.choose_eq_zero_of_lt h, Nat.cast_zero, mul_zero]
#align polynomial.taylor_coeff Polynomial.taylor_coeff
@[simp]
theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r := by
rw [taylor_coeff, hasseDeriv_zero, LinearMap.id_apply]
#align polynomial.taylor_coeff_zero Polynomial.taylor_coeff_zero
@[simp]
theorem taylor_coeff_one : (taylor r f).coeff 1 = f.derivative.eval r := by
rw [taylor_coeff, hasseDeriv_one]
#align polynomial.taylor_coeff_one Polynomial.taylor_coeff_one
@[simp]
theorem natDegree_taylor (p : R[X]) (r : R) : natDegree (taylor r p) = natDegree p := by
refine map_natDegree_eq_natDegree _ ?_
nontriviality R
intro n c c0
simp [taylor_monomial, natDegree_C_mul_eq_of_mul_ne_zero, natDegree_pow_X_add_C, c0]
#align polynomial.nat_degree_taylor Polynomial.natDegree_taylor
@[simp]
| Mathlib/Algebra/Polynomial/Taylor.lean | 106 | 107 | theorem taylor_mul {R} [CommSemiring R] (r : R) (p q : R[X]) :
taylor r (p * q) = taylor r p * taylor r q := by | simp only [taylor_apply, mul_comp]
| [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... | [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... |
import Mathlib.Algebra.Group.Semiconj.Defs
import Mathlib.Algebra.Group.Units
#align_import algebra.group.semiconj from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open scoped Int
variable {M G : Type*}
namespace SemiconjBy
section Monoid
variable [Monoid M]
@[to_additive "If `a` semiconjugates an additive unit `x` to an additive unit `y`, then it
semiconjugates `-x` to `-y`."]
theorem units_inv_right {a : M} {x y : Mˣ} (h : SemiconjBy a x y) : SemiconjBy a ↑x⁻¹ ↑y⁻¹ :=
calc
a * ↑x⁻¹ = ↑y⁻¹ * (y * a) * ↑x⁻¹ := by rw [Units.inv_mul_cancel_left]
_ = ↑y⁻¹ * a := by rw [← h.eq, mul_assoc, Units.mul_inv_cancel_right]
#align semiconj_by.units_inv_right SemiconjBy.units_inv_right
#align add_semiconj_by.add_units_neg_right AddSemiconjBy.addUnits_neg_right
@[to_additive (attr := simp)]
theorem units_inv_right_iff {a : M} {x y : Mˣ} : SemiconjBy a ↑x⁻¹ ↑y⁻¹ ↔ SemiconjBy a x y :=
⟨units_inv_right, units_inv_right⟩
#align semiconj_by.units_inv_right_iff SemiconjBy.units_inv_right_iff
#align add_semiconj_by.add_units_neg_right_iff AddSemiconjBy.addUnits_neg_right_iff
@[to_additive "If an additive unit `a` semiconjugates `x` to `y`, then `-a` semiconjugates `y` to
`x`."]
| Mathlib/Algebra/Group/Semiconj/Units.lean | 64 | 67 | theorem units_inv_symm_left {a : Mˣ} {x y : M} (h : SemiconjBy (↑a) x y) : SemiconjBy (↑a⁻¹) y x :=
calc
↑a⁻¹ * y = ↑a⁻¹ * (y * a * ↑a⁻¹) := by | rw [Units.mul_inv_cancel_right]
_ = x * ↑a⁻¹ := by rw [← h.eq, ← mul_assoc, Units.inv_mul_cancel_left]
| [
" a * ↑x⁻¹ = ↑y⁻¹ * (↑y * a) * ↑x⁻¹",
" ↑y⁻¹ * (↑y * a) * ↑x⁻¹ = ↑y⁻¹ * a",
" ↑a⁻¹ * y = ↑a⁻¹ * (y * ↑a * ↑a⁻¹)",
" ↑a⁻¹ * (y * ↑a * ↑a⁻¹) = x * ↑a⁻¹"
] | [
" a * ↑x⁻¹ = ↑y⁻¹ * (↑y * a) * ↑x⁻¹",
" ↑y⁻¹ * (↑y * a) * ↑x⁻¹ = ↑y⁻¹ * a"
] |
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.compression.uv from "leanprover-community/mathlib"@"6f8ab7de1c4b78a68ab8cf7dd83d549eb78a68a1"
open Finset
variable {α : Type*}
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
{ x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
rintro a ha b hb hab
have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
dsimp at hab
rw [hab]
rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm,
hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h
#align sup_sdiff_inj_on sup_sdiff_injOn
-- The namespace is here to distinguish from other compressions.
namespace UV
section GeneralizedBooleanAlgebra
variable [GeneralizedBooleanAlgebra α] [DecidableRel (@Disjoint α _ _)]
[DecidableRel ((· ≤ ·) : α → α → Prop)] {s : Finset α} {u v a b : α}
def compress (u v a : α) : α :=
if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a
#align uv.compress UV.compress
theorem compress_of_disjoint_of_le (hua : Disjoint u a) (hva : v ≤ a) :
compress u v a = (a ⊔ u) \ v :=
if_pos ⟨hua, hva⟩
#align uv.compress_of_disjoint_of_le UV.compress_of_disjoint_of_le
theorem compress_of_disjoint_of_le' (hva : Disjoint v a) (hua : u ≤ a) :
compress u v ((a ⊔ v) \ u) = a := by
rw [compress_of_disjoint_of_le disjoint_sdiff_self_right
(le_sdiff.2 ⟨(le_sup_right : v ≤ a ⊔ v), hva.mono_right hua⟩),
sdiff_sup_cancel (le_sup_of_le_left hua), hva.symm.sup_sdiff_cancel_right]
#align uv.compress_of_disjoint_of_le' UV.compress_of_disjoint_of_le'
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
unfold compress
split_ifs with h
· exact h.1.symm.sup_sdiff_cancel_right
· rfl
#align uv.compress_self UV.compress_self
@[simp]
theorem compress_sdiff_sdiff (a b : α) : compress (a \ b) (b \ a) b = a := by
refine (compress_of_disjoint_of_le disjoint_sdiff_self_left sdiff_le).trans ?_
rw [sup_sdiff_self_right, sup_sdiff, disjoint_sdiff_self_right.sdiff_eq_left, sup_eq_right]
exact sdiff_sdiff_le
#align uv.compress_sdiff_sdiff UV.compress_sdiff_sdiff
@[simp]
| Mathlib/Combinatorics/SetFamily/Compression/UV.lean | 115 | 120 | theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by |
unfold compress
split_ifs with h h'
· rw [le_sdiff_iff.1 h'.2, sdiff_bot, sdiff_bot, sup_assoc, sup_idem]
· rfl
· rfl
| [
" Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}",
" a = b",
" ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v",
" compress u v ((a ⊔ v) \\ u) = a",
" compress u u a = a",
" (if Disjoint u a ∧ u ≤ a then (a ⊔ u) \\ u else a) = a",
" (a ⊔ u) \\ u = a",
" a = a",
" compress (a \\ b) (b... | [
" Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}",
" a = b",
" ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v",
" compress u v ((a ⊔ v) \\ u) = a",
" compress u u a = a",
" (if Disjoint u a ∧ u ≤ a then (a ⊔ u) \\ u else a) = a",
" (a ⊔ u) \\ u = a",
" a = a",
" compress (a \\ b) (b... |
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : ℕ)
def divisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (ℕ × ℕ) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n ≠ 0) :
(Finset.range n).filter (· ∣ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
| Mathlib/NumberTheory/Divisors.lean | 84 | 86 | theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by |
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
| [
" filter (fun x => x ∣ n) (range n.succ) = n.divisors",
" a✝ ∈ filter (fun x => x ∣ n) (range n.succ) ↔ a✝ ∈ n.divisors",
" a✝ ∣ n → a✝ < n.succ → 1 ≤ a✝",
" filter (fun x => x ∣ n) (range n) = n.properDivisors",
" a✝ ∈ filter (fun x => x ∣ n) (range n) ↔ a✝ ∈ n.properDivisors",
" a✝ ∣ n → a✝ < n → 1 ≤ a✝... | [
" filter (fun x => x ∣ n) (range n.succ) = n.divisors",
" a✝ ∈ filter (fun x => x ∣ n) (range n.succ) ↔ a✝ ∈ n.divisors",
" a✝ ∣ n → a✝ < n.succ → 1 ≤ a✝",
" filter (fun x => x ∣ n) (range n) = n.properDivisors",
" a✝ ∈ filter (fun x => x ∣ n) (range n) ↔ a✝ ∈ n.properDivisors",
" a✝ ∣ n → a✝ < n → 1 ≤ a✝... |
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import data.polynomial.expand from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
universe u v w
open Polynomial
open Finset
namespace Polynomial
section CommSemiring
variable (R : Type u) [CommSemiring R] {S : Type v} [CommSemiring S] (p q : ℕ)
noncomputable def expand : R[X] →ₐ[R] R[X] :=
{ (eval₂RingHom C (X ^ p) : R[X] →+* R[X]) with commutes' := fun _ => eval₂_C _ _ }
#align polynomial.expand Polynomial.expand
theorem coe_expand : (expand R p : R[X] → R[X]) = eval₂ C (X ^ p) :=
rfl
#align polynomial.coe_expand Polynomial.coe_expand
variable {R}
theorem expand_eq_comp_X_pow {f : R[X]} : expand R p f = f.comp (X ^ p) := rfl
theorem expand_eq_sum {f : R[X]} : expand R p f = f.sum fun e a => C a * (X ^ p) ^ e := by
simp [expand, eval₂]
#align polynomial.expand_eq_sum Polynomial.expand_eq_sum
@[simp]
theorem expand_C (r : R) : expand R p (C r) = C r :=
eval₂_C _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_C Polynomial.expand_C
@[simp]
theorem expand_X : expand R p X = X ^ p :=
eval₂_X _ _
set_option linter.uppercaseLean3 false in
#align polynomial.expand_X Polynomial.expand_X
@[simp]
theorem expand_monomial (r : R) : expand R p (monomial q r) = monomial (q * p) r := by
simp_rw [← smul_X_eq_monomial, AlgHom.map_smul, AlgHom.map_pow, expand_X, mul_comm, pow_mul]
#align polynomial.expand_monomial Polynomial.expand_monomial
theorem expand_expand (f : R[X]) : expand R p (expand R q f) = expand R (p * q) f :=
Polynomial.induction_on f (fun r => by simp_rw [expand_C])
(fun f g ihf ihg => by simp_rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by
simp_rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, AlgHom.map_pow, expand_X, pow_mul]
#align polynomial.expand_expand Polynomial.expand_expand
theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f) :=
(expand_expand p q f).symm
#align polynomial.expand_mul Polynomial.expand_mul
@[simp]
theorem expand_zero (f : R[X]) : expand R 0 f = C (eval 1 f) := by simp [expand]
#align polynomial.expand_zero Polynomial.expand_zero
@[simp]
theorem expand_one (f : R[X]) : expand R 1 f = f :=
Polynomial.induction_on f (fun r => by rw [expand_C])
(fun f g ihf ihg => by rw [AlgHom.map_add, ihf, ihg]) fun n r _ => by
rw [AlgHom.map_mul, expand_C, AlgHom.map_pow, expand_X, pow_one]
#align polynomial.expand_one Polynomial.expand_one
theorem expand_pow (f : R[X]) : expand R (p ^ q) f = (expand R p)^[q] f :=
Nat.recOn q (by rw [pow_zero, expand_one, Function.iterate_zero, id]) fun n ih => by
rw [Function.iterate_succ_apply', pow_succ', expand_mul, ih]
#align polynomial.expand_pow Polynomial.expand_pow
theorem derivative_expand (f : R[X]) : Polynomial.derivative (expand R p f) =
expand R p (Polynomial.derivative f) * (p * (X ^ (p - 1) : R[X])) := by
rw [coe_expand, derivative_eval₂_C, derivative_pow, C_eq_natCast, derivative_X, mul_one]
#align polynomial.derivative_expand Polynomial.derivative_expand
theorem coeff_expand {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff n = if p ∣ n then f.coeff (n / p) else 0 := by
simp only [expand_eq_sum]
simp_rw [coeff_sum, ← pow_mul, C_mul_X_pow_eq_monomial, coeff_monomial, sum]
split_ifs with h
· rw [Finset.sum_eq_single (n / p), Nat.mul_div_cancel' h, if_pos rfl]
· intro b _ hb2
rw [if_neg]
intro hb3
apply hb2
rw [← hb3, Nat.mul_div_cancel_left b hp]
· intro hn
rw [not_mem_support_iff.1 hn]
split_ifs <;> rfl
· rw [Finset.sum_eq_zero]
intro k _
rw [if_neg]
exact fun hkn => h ⟨k, hkn.symm⟩
#align polynomial.coeff_expand Polynomial.coeff_expand
@[simp]
| Mathlib/Algebra/Polynomial/Expand.lean | 121 | 123 | theorem coeff_expand_mul {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff (n * p) = f.coeff n := by |
rw [coeff_expand hp, if_pos (dvd_mul_left _ _), Nat.mul_div_cancel _ hp]
| [
" (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e",
" (expand R p) ((monomial q) r) = (monomial (q * p)) r",
" (expand R p) ((expand R q) (C r)) = (expand R (p * q)) (C r)",
" (expand R p) ((expand R q) (f + g)) = (expand R (p * q)) (f + g)",
" (expand R p) ((expand R q) (C r * X ^ (n + 1))) = (expand R... | [
" (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e",
" (expand R p) ((monomial q) r) = (monomial (q * p)) r",
" (expand R p) ((expand R q) (C r)) = (expand R (p * q)) (C r)",
" (expand R p) ((expand R q) (f + g)) = (expand R (p * q)) (f + g)",
" (expand R p) ((expand R q) (C r * X ^ (n + 1))) = (expand R... |
import Mathlib.LinearAlgebra.Dual
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.contraction from "leanprover-community/mathlib"@"657df4339ae6ceada048c8a2980fb10e393143ec"
suppress_compilation
-- Porting note: universe metavariables behave oddly
universe w u v₁ v₂ v₃ v₄
variable {ι : Type w} (R : Type u) (M : Type v₁) (N : Type v₂)
(P : Type v₃) (Q : Type v₄)
-- Porting note: we need high priority for this to fire first; not the case in ML3
attribute [local ext high] TensorProduct.ext
section Contraction
open TensorProduct LinearMap Matrix Module
open TensorProduct
section CommSemiring
variable [CommSemiring R]
variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P] [AddCommMonoid Q]
variable [Module R M] [Module R N] [Module R P] [Module R Q]
variable [DecidableEq ι] [Fintype ι] (b : Basis ι R M)
-- Porting note: doesn't like implicit ring in the tensor product
def contractLeft : Module.Dual R M ⊗[R] M →ₗ[R] R :=
(uncurry _ _ _ _).toFun LinearMap.id
#align contract_left contractLeft
-- Porting note: doesn't like implicit ring in the tensor product
def contractRight : M ⊗[R] Module.Dual R M →ₗ[R] R :=
(uncurry _ _ _ _).toFun (LinearMap.flip LinearMap.id)
#align contract_right contractRight
-- Porting note: doesn't like implicit ring in the tensor product
def dualTensorHom : Module.Dual R M ⊗[R] N →ₗ[R] M →ₗ[R] N :=
let M' := Module.Dual R M
(uncurry R M' N (M →ₗ[R] N) : _ → M' ⊗ N →ₗ[R] M →ₗ[R] N) LinearMap.smulRightₗ
#align dual_tensor_hom dualTensorHom
variable {R M N P Q}
@[simp]
theorem contractLeft_apply (f : Module.Dual R M) (m : M) : contractLeft R M (f ⊗ₜ m) = f m :=
rfl
#align contract_left_apply contractLeft_apply
@[simp]
theorem contractRight_apply (f : Module.Dual R M) (m : M) : contractRight R M (m ⊗ₜ f) = f m :=
rfl
#align contract_right_apply contractRight_apply
@[simp]
theorem dualTensorHom_apply (f : Module.Dual R M) (m : M) (n : N) :
dualTensorHom R M N (f ⊗ₜ n) m = f m • n :=
rfl
#align dual_tensor_hom_apply dualTensorHom_apply
@[simp]
| Mathlib/LinearAlgebra/Contraction.lean | 85 | 92 | theorem transpose_dualTensorHom (f : Module.Dual R M) (m : M) :
Dual.transpose (R := R) (dualTensorHom R M M (f ⊗ₜ m)) =
dualTensorHom R _ _ (Dual.eval R M m ⊗ₜ f) := by |
ext f' m'
simp only [Dual.transpose_apply, coe_comp, Function.comp_apply, dualTensorHom_apply,
LinearMap.map_smulₛₗ, RingHom.id_apply, Algebra.id.smul_eq_mul, Dual.eval_apply,
LinearMap.smul_apply]
exact mul_comm _ _
| [
" Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m)) =\n (dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)",
" ((Dual.transpose ((dualTensorHom R M M) (f ⊗ₜ[R] m))) f') m' =\n (((dualTensorHom R (Dual R M) (Dual R M)) ((Dual.eval R M) m ⊗ₜ[R] f)) f') m'",
" f m' * f' m = f' m * f m'"
] | [] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Data.Matrix.Basis
import Mathlib.Data.Matrix.DMatrix
import Mathlib.RingTheory.MatrixAlgebra
#align_import ring_theory.polynomial_algebra from "leanprover-community/mathlib"@"565eb991e264d0db702722b4bde52ee5173c9950"
universe u v w
open Polynomial TensorProduct
open Algebra.TensorProduct (algHomOfLinearMapTensorProduct includeLeft)
noncomputable section
variable (R A : Type*)
variable [CommSemiring R]
variable [Semiring A] [Algebra R A]
namespace PolyEquivTensor
-- Porting note: was `@[simps apply_apply]`
@[simps! apply_apply]
def toFunBilinear : A →ₗ[A] R[X] →ₗ[R] A[X] :=
LinearMap.toSpanSingleton A _ (aeval (Polynomial.X : A[X])).toLinearMap
#align poly_equiv_tensor.to_fun_bilinear PolyEquivTensor.toFunBilinear
theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) :
toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by
simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum]
congr with i : 1
rw [← Algebra.smul_def, ← C_mul', mul_smul_comm, C_mul_X_pow_eq_monomial, ← Algebra.commutes,
← Algebra.smul_def, smul_monomial]
#align poly_equiv_tensor.to_fun_bilinear_apply_eq_sum PolyEquivTensor.toFunBilinear_apply_eq_sum
def toFunLinear : A ⊗[R] R[X] →ₗ[R] A[X] :=
TensorProduct.lift (toFunBilinear R A)
#align poly_equiv_tensor.to_fun_linear PolyEquivTensor.toFunLinear
@[simp]
theorem toFunLinear_tmul_apply (a : A) (p : R[X]) :
toFunLinear R A (a ⊗ₜ[R] p) = toFunBilinear R A a p :=
rfl
#align poly_equiv_tensor.to_fun_linear_tmul_apply PolyEquivTensor.toFunLinear_tmul_apply
-- We apparently need to provide the decidable instance here
-- in order to successfully rewrite by this lemma.
theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) :
ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 =
a * (algebraMap R A) (coeff p k) := by classical split_ifs <;> simp [*]
#align poly_equiv_tensor.to_fun_linear_mul_tmul_mul_aux_1 PolyEquivTensor.toFunLinear_mul_tmul_mul_aux_1
| Mathlib/RingTheory/PolynomialAlgebra.lean | 85 | 91 | theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) :
a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) =
(Finset.antidiagonal k).sum fun x =>
a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by |
simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum]
congr
simp_rw [Algebra.commutes (coeff p₂ _), coeff_mul, map_sum, RingHom.map_mul]
| [
" ((toFunBilinear R A) a) p = p.sum fun n r => (monomial n) (a * (algebraMap R A) r)",
" ∑ x ∈ p.support, a • ((algebraMap R A[X]) (p.coeff x) * X ^ x) =\n ∑ x ∈ p.support, (monomial x) (a * (algebraMap R A) (p.coeff x))",
" a • ((algebraMap R A[X]) (p.coeff i) * X ^ i) = (monomial i) (a * (algebraMap R A) (... | [
" ((toFunBilinear R A) a) p = p.sum fun n r => (monomial n) (a * (algebraMap R A) r)",
" ∑ x ∈ p.support, a • ((algebraMap R A[X]) (p.coeff x) * X ^ x) =\n ∑ x ∈ p.support, (monomial x) (a * (algebraMap R A) (p.coeff x))",
" a • ((algebraMap R A[X]) (p.coeff i) * X ^ i) = (monomial i) (a * (algebraMap R A) (... |
import Mathlib.Data.Matrix.Basis
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.Pi
#align_import linear_algebra.std_basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
namespace LinearMap
variable (R : Type*) {ι : Type*} [Semiring R] (φ : ι → Type*) [∀ i, AddCommMonoid (φ i)]
[∀ i, Module R (φ i)] [DecidableEq ι]
def stdBasis : ∀ i : ι, φ i →ₗ[R] ∀ i, φ i :=
single
#align linear_map.std_basis LinearMap.stdBasis
theorem stdBasis_apply (i : ι) (b : φ i) : stdBasis R φ i b = update (0 : (a : ι) → φ a) i b :=
rfl
#align linear_map.std_basis_apply LinearMap.stdBasis_apply
@[simp]
theorem stdBasis_apply' (i i' : ι) : (stdBasis R (fun _x : ι => R) i) 1 i' = ite (i = i') 1 0 := by
rw [LinearMap.stdBasis_apply, Function.update_apply, Pi.zero_apply]
congr 1; rw [eq_iff_iff, eq_comm]
#align linear_map.std_basis_apply' LinearMap.stdBasis_apply'
theorem coe_stdBasis (i : ι) : ⇑(stdBasis R φ i) = Pi.single i :=
rfl
#align linear_map.coe_std_basis LinearMap.coe_stdBasis
@[simp]
theorem stdBasis_same (i : ι) (b : φ i) : stdBasis R φ i b i = b :=
Pi.single_eq_same i b
#align linear_map.std_basis_same LinearMap.stdBasis_same
theorem stdBasis_ne (i j : ι) (h : j ≠ i) (b : φ i) : stdBasis R φ i b j = 0 :=
Pi.single_eq_of_ne h b
#align linear_map.std_basis_ne LinearMap.stdBasis_ne
theorem stdBasis_eq_pi_diag (i : ι) : stdBasis R φ i = pi (diag i) := by
ext x j
-- Porting note: made types explicit
convert (update_apply (R := R) (φ := φ) (ι := ι) 0 x i j _).symm
rfl
#align linear_map.std_basis_eq_pi_diag LinearMap.stdBasis_eq_pi_diag
theorem ker_stdBasis (i : ι) : ker (stdBasis R φ i) = ⊥ :=
ker_eq_bot_of_injective <| Pi.single_injective _ _
#align linear_map.ker_std_basis LinearMap.ker_stdBasis
theorem proj_comp_stdBasis (i j : ι) : (proj i).comp (stdBasis R φ j) = diag j i := by
rw [stdBasis_eq_pi_diag, proj_pi]
#align linear_map.proj_comp_std_basis LinearMap.proj_comp_stdBasis
theorem proj_stdBasis_same (i : ι) : (proj i).comp (stdBasis R φ i) = id :=
LinearMap.ext <| stdBasis_same R φ i
#align linear_map.proj_std_basis_same LinearMap.proj_stdBasis_same
theorem proj_stdBasis_ne (i j : ι) (h : i ≠ j) : (proj i).comp (stdBasis R φ j) = 0 :=
LinearMap.ext <| stdBasis_ne R φ _ _ h
#align linear_map.proj_std_basis_ne LinearMap.proj_stdBasis_ne
theorem iSup_range_stdBasis_le_iInf_ker_proj (I J : Set ι) (h : Disjoint I J) :
⨆ i ∈ I, range (stdBasis R φ i) ≤ ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) := by
refine iSup_le fun i => iSup_le fun hi => range_le_iff_comap.2 ?_
simp only [← ker_comp, eq_top_iff, SetLike.le_def, mem_ker, comap_iInf, mem_iInf]
rintro b - j hj
rw [proj_stdBasis_ne R φ j i, zero_apply]
rintro rfl
exact h.le_bot ⟨hi, hj⟩
#align linear_map.supr_range_std_basis_le_infi_ker_proj LinearMap.iSup_range_stdBasis_le_iInf_ker_proj
theorem iInf_ker_proj_le_iSup_range_stdBasis {I : Finset ι} {J : Set ι} (hu : Set.univ ⊆ ↑I ∪ J) :
⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) ≤ ⨆ i ∈ I, range (stdBasis R φ i) :=
SetLike.le_def.2
(by
intro b hb
simp only [mem_iInf, mem_ker, proj_apply] at hb
rw [←
show (∑ i ∈ I, stdBasis R φ i (b i)) = b by
ext i
rw [Finset.sum_apply, ← stdBasis_same R φ i (b i)]
refine Finset.sum_eq_single i (fun j _ ne => stdBasis_ne _ _ _ _ ne.symm _) ?_
intro hiI
rw [stdBasis_same]
exact hb _ ((hu trivial).resolve_left hiI)]
exact sum_mem_biSup fun i _ => mem_range_self (stdBasis R φ i) (b i))
#align linear_map.infi_ker_proj_le_supr_range_std_basis LinearMap.iInf_ker_proj_le_iSup_range_stdBasis
theorem iSup_range_stdBasis_eq_iInf_ker_proj {I J : Set ι} (hd : Disjoint I J)
(hu : Set.univ ⊆ I ∪ J) (hI : Set.Finite I) :
⨆ i ∈ I, range (stdBasis R φ i) = ⨅ i ∈ J, ker (proj i : (∀ i, φ i) →ₗ[R] φ i) := by
refine le_antisymm (iSup_range_stdBasis_le_iInf_ker_proj _ _ _ _ hd) ?_
have : Set.univ ⊆ ↑hI.toFinset ∪ J := by rwa [hI.coe_toFinset]
refine le_trans (iInf_ker_proj_le_iSup_range_stdBasis R φ this) (iSup_mono fun i => ?_)
rw [Set.Finite.mem_toFinset]
#align linear_map.supr_range_std_basis_eq_infi_ker_proj LinearMap.iSup_range_stdBasis_eq_iInf_ker_proj
| Mathlib/LinearAlgebra/StdBasis.lean | 132 | 137 | theorem iSup_range_stdBasis [Finite ι] : ⨆ i, range (stdBasis R φ i) = ⊤ := by |
cases nonempty_fintype ι
convert top_unique (iInf_emptyset.ge.trans <| iInf_ker_proj_le_iSup_range_stdBasis R φ _)
· rename_i i
exact ((@iSup_pos _ _ _ fun _ => range <| stdBasis R φ i) <| Finset.mem_univ i).symm
· rw [Finset.coe_univ, Set.union_empty]
| [
" (stdBasis R (fun _x => R) i) 1 i' = if i = i' then 1 else 0",
" (if i' = i then 1 else 0) = if i = i' then 1 else 0",
" (i' = i) = (i = i')",
" stdBasis R φ i = pi (diag i)",
" (stdBasis R φ i) x j = (pi (diag i)) x j",
" x = id x",
" proj i ∘ₗ stdBasis R φ j = diag j i",
" ⨆ i ∈ I, range (stdBasis ... | [
" (stdBasis R (fun _x => R) i) 1 i' = if i = i' then 1 else 0",
" (if i' = i then 1 else 0) = if i = i' then 1 else 0",
" (i' = i) = (i = i')",
" stdBasis R φ i = pi (diag i)",
" (stdBasis R φ i) x j = (pi (diag i)) x j",
" x = id x",
" proj i ∘ₗ stdBasis R φ j = diag j i",
" ⨆ i ∈ I, range (stdBasis ... |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Shift
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
variable
{𝕜 : Type*} [NontriviallyNormedField 𝕜]
{F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
{R : Type*} [Semiring R] [Module R F] [SMulCommClass 𝕜 R F] [ContinuousConstSMul R F]
{n : ℕ} {x : 𝕜} {s : Set 𝕜} (hx : x ∈ s) (h : UniqueDiffOn 𝕜 s) {f g : 𝕜 → F}
theorem iteratedDerivWithin_add (hf : ContDiffOn 𝕜 n f s) (hg : ContDiffOn 𝕜 n g s) :
iteratedDerivWithin n (f + g) s x =
iteratedDerivWithin n f s x + iteratedDerivWithin n g s x := by
simp_rw [iteratedDerivWithin, iteratedFDerivWithin_add_apply hf hg h hx,
ContinuousMultilinearMap.add_apply]
| Mathlib/Analysis/Calculus/IteratedDeriv/Lemmas.lean | 30 | 38 | theorem iteratedDerivWithin_congr (hfg : Set.EqOn f g s) :
Set.EqOn (iteratedDerivWithin n f s) (iteratedDerivWithin n g s) s := by |
induction n generalizing f g with
| zero => rwa [iteratedDerivWithin_zero]
| succ n IH =>
intro y hy
have : UniqueDiffWithinAt 𝕜 s y := h.uniqueDiffWithinAt hy
rw [iteratedDerivWithin_succ this, iteratedDerivWithin_succ this]
exact derivWithin_congr (IH hfg) (IH hfg hy)
| [
" iteratedDerivWithin n (f + g) s x = iteratedDerivWithin n f s x + iteratedDerivWithin n g s x",
" Set.EqOn (iteratedDerivWithin n f s) (iteratedDerivWithin n g s) s",
" Set.EqOn (iteratedDerivWithin 0 f s) (iteratedDerivWithin 0 g s) s",
" Set.EqOn (iteratedDerivWithin (n + 1) f s) (iteratedDerivWithin (n +... | [
" iteratedDerivWithin n (f + g) s x = iteratedDerivWithin n f s x + iteratedDerivWithin n g s x"
] |
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import data.multiset.lattice from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
namespace Multiset
variable {α : Type*}
section Inf
-- can be defined with just `[Top α]` where some lemmas hold without requiring `[OrderTop α]`
variable [SemilatticeInf α] [OrderTop α]
def inf (s : Multiset α) : α :=
s.fold (· ⊓ ·) ⊤
#align multiset.inf Multiset.inf
@[simp]
theorem inf_coe (l : List α) : inf (l : Multiset α) = l.foldr (· ⊓ ·) ⊤ :=
rfl
#align multiset.inf_coe Multiset.inf_coe
@[simp]
theorem inf_zero : (0 : Multiset α).inf = ⊤ :=
fold_zero _ _
#align multiset.inf_zero Multiset.inf_zero
@[simp]
theorem inf_cons (a : α) (s : Multiset α) : (a ::ₘ s).inf = a ⊓ s.inf :=
fold_cons_left _ _ _ _
#align multiset.inf_cons Multiset.inf_cons
@[simp]
theorem inf_singleton {a : α} : ({a} : Multiset α).inf = a := inf_top_eq _
#align multiset.inf_singleton Multiset.inf_singleton
@[simp]
theorem inf_add (s₁ s₂ : Multiset α) : (s₁ + s₂).inf = s₁.inf ⊓ s₂.inf :=
Eq.trans (by simp [inf]) (fold_add _ _ _ _ _)
#align multiset.inf_add Multiset.inf_add
@[simp]
theorem le_inf {s : Multiset α} {a : α} : a ≤ s.inf ↔ ∀ b ∈ s, a ≤ b :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and])
#align multiset.le_inf Multiset.le_inf
theorem inf_le {s : Multiset α} {a : α} (h : a ∈ s) : s.inf ≤ a :=
le_inf.1 le_rfl _ h
#align multiset.inf_le Multiset.inf_le
theorem inf_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₂.inf ≤ s₁.inf :=
le_inf.2 fun _ hb => inf_le (h hb)
#align multiset.inf_mono Multiset.inf_mono
variable [DecidableEq α]
@[simp]
theorem inf_dedup (s : Multiset α) : (dedup s).inf = s.inf :=
fold_dedup_idem _ _ _
#align multiset.inf_dedup Multiset.inf_dedup
@[simp]
theorem inf_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).inf = s₁.inf ⊓ s₂.inf := by
rw [← inf_dedup, dedup_ext.2, inf_dedup, inf_add]; simp
#align multiset.inf_ndunion Multiset.inf_ndunion
@[simp]
| Mathlib/Data/Multiset/Lattice.lean | 168 | 169 | theorem inf_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).inf = s₁.inf ⊓ s₂.inf := by |
rw [← inf_dedup, dedup_ext.2, inf_dedup, inf_add]; simp
| [
" (s₁ + s₂).inf = fold (fun x x_1 => x ⊓ x_1) (⊤ ⊓ ⊤) (s₁ + s₂)",
" a ≤ inf 0 ↔ ∀ b ∈ 0, a ≤ b",
" ∀ (a_1 : α) (s : Multiset α), (a ≤ s.inf ↔ ∀ b ∈ s, a ≤ b) → (a ≤ (a_1 ::ₘ s).inf ↔ ∀ b ∈ a_1 ::ₘ s, a ≤ b)",
" (s₁.ndunion s₂).inf = s₁.inf ⊓ s₂.inf",
" ∀ (a : α), a ∈ s₁.ndunion s₂ ↔ a ∈ s₁ + s₂",
" (s₁ ∪ ... | [
" (s₁ + s₂).inf = fold (fun x x_1 => x ⊓ x_1) (⊤ ⊓ ⊤) (s₁ + s₂)",
" a ≤ inf 0 ↔ ∀ b ∈ 0, a ≤ b",
" ∀ (a_1 : α) (s : Multiset α), (a ≤ s.inf ↔ ∀ b ∈ s, a ≤ b) → (a ≤ (a_1 ::ₘ s).inf ↔ ∀ b ∈ a_1 ::ₘ s, a ≤ b)",
" (s₁.ndunion s₂).inf = s₁.inf ⊓ s₂.inf",
" ∀ (a : α), a ∈ s₁.ndunion s₂ ↔ a ∈ s₁ + s₂"
] |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Analytic.CPolynomial
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open Filter Asymptotics
open scoped ENNReal
universe u v
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
section fderiv
variable {p : FormalMultilinearSeries 𝕜 E F} {r : ℝ≥0∞}
variable {f : E → F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p 1)) x := by
refine h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right ?_)
refine isLittleO_iff_exists_eq_mul.2 ⟨fun y => ‖y - (x, x)‖, ?_, EventuallyEq.rfl⟩
refine (continuous_id.sub continuous_const).norm.tendsto' _ _ ?_
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt 𝕜 f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt 𝕜 f x → DifferentiableAt 𝕜 f x
| ⟨_, hp⟩ => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt 𝕜 f x) : DifferentiableWithinAt 𝕜 f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv 𝕜 f x = continuousMultilinearCurryFin1 𝕜 E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn 𝕜 f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn 𝕜 f s) : DifferentiableOn 𝕜 f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (‖y‖₊ : ℝ≥0∞) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (‖y‖₊ : ℝ≥0∞) < r) :
fderiv 𝕜 f (x + y) = continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
| Mathlib/Analysis/Calculus/FDeriv/Analytic.lean | 91 | 101 | theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv 𝕜 f) p.derivSeries x r := by |
refine .congr (f := fun z ↦ continuousMultilinearCurryFin1 𝕜 E F (p.changeOrigin (z - x) 1)) ?_
fun z hz ↦ ?_
· refine continuousMultilinearCurryFin1 𝕜 E F
|>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall ?_
simpa using ((p.hasFPowerSeriesOnBall_changeOrigin 1
(h.r_pos.trans_le h.r_le)).mono h.r_pos h.r_le).comp_sub x
dsimp only
rw [← h.fderiv_eq, add_sub_cancel]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
| [
" HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕜 E F) (p 1)) x",
" (fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖) =o[nhds (x, x)] fun x => ‖x.1 - x.2‖",
" Tendsto (fun y => ‖y - (x, x)‖) (nhds (x, x)) (nhds 0)",
" ‖id (x, x) - (x, x)‖ = 0",
" HasFPowerSeriesOnBall (_root_.fderiv 𝕜 f) p.derivSeries x r",
... | [
" HasStrictFDerivAt f ((continuousMultilinearCurryFin1 𝕜 E F) (p 1)) x",
" (fun y => ‖y - (x, x)‖ * ‖y.1 - y.2‖) =o[nhds (x, x)] fun x => ‖x.1 - x.2‖",
" Tendsto (fun y => ‖y - (x, x)‖) (nhds (x, x)) (nhds 0)",
" ‖id (x, x) - (x, x)‖ = 0"
] |
import Mathlib.Algebra.Order.Field.Power
import Mathlib.Data.Int.LeastGreatest
import Mathlib.Data.Rat.Floor
import Mathlib.Data.NNRat.Defs
#align_import algebra.order.archimedean from "leanprover-community/mathlib"@"6f413f3f7330b94c92a5a27488fdc74e6d483a78"
open Int Set
variable {α : Type*}
class Archimedean (α) [OrderedAddCommMonoid α] : Prop where
arch : ∀ (x : α) {y : α}, 0 < y → ∃ n : ℕ, x ≤ n • y
#align archimedean Archimedean
instance OrderDual.archimedean [OrderedAddCommGroup α] [Archimedean α] : Archimedean αᵒᵈ :=
⟨fun x y hy =>
let ⟨n, hn⟩ := Archimedean.arch (-ofDual x) (neg_pos.2 hy)
⟨n, by rwa [neg_nsmul, neg_le_neg_iff] at hn⟩⟩
#align order_dual.archimedean OrderDual.archimedean
variable {M : Type*}
theorem exists_lt_nsmul [OrderedAddCommMonoid M] [Archimedean M]
[CovariantClass M M (· + ·) (· < ·)] {a : M} (ha : 0 < a) (b : M) :
∃ n : ℕ, b < n • a :=
let ⟨k, hk⟩ := Archimedean.arch b ha
⟨k + 1, hk.trans_lt <| nsmul_lt_nsmul_left ha k.lt_succ_self⟩
section LinearOrderedAddCommGroup
variable [LinearOrderedAddCommGroup α] [Archimedean α]
theorem existsUnique_zsmul_near_of_pos {a : α} (ha : 0 < a) (g : α) :
∃! k : ℤ, k • a ≤ g ∧ g < (k + 1) • a := by
let s : Set ℤ := { n : ℤ | n • a ≤ g }
obtain ⟨k, hk : -g ≤ k • a⟩ := Archimedean.arch (-g) ha
have h_ne : s.Nonempty := ⟨-k, by simpa [s] using neg_le_neg hk⟩
obtain ⟨k, hk⟩ := Archimedean.arch g ha
have h_bdd : ∀ n ∈ s, n ≤ (k : ℤ) := by
intro n hn
apply (zsmul_le_zsmul_iff ha).mp
rw [← natCast_zsmul] at hk
exact le_trans hn hk
obtain ⟨m, hm, hm'⟩ := Int.exists_greatest_of_bdd ⟨k, h_bdd⟩ h_ne
have hm'' : g < (m + 1) • a := by
contrapose! hm'
exact ⟨m + 1, hm', lt_add_one _⟩
refine ⟨m, ⟨hm, hm''⟩, fun n hn => (hm' n hn.1).antisymm <| Int.le_of_lt_add_one ?_⟩
rw [← zsmul_lt_zsmul_iff ha]
exact lt_of_le_of_lt hm hn.2
#align exists_unique_zsmul_near_of_pos existsUnique_zsmul_near_of_pos
| Mathlib/Algebra/Order/Archimedean.lean | 84 | 87 | theorem existsUnique_zsmul_near_of_pos' {a : α} (ha : 0 < a) (g : α) :
∃! k : ℤ, 0 ≤ g - k • a ∧ g - k • a < a := by |
simpa only [sub_nonneg, add_zsmul, one_zsmul, sub_lt_iff_lt_add'] using
existsUnique_zsmul_near_of_pos ha g
| [
" x ≤ n • y",
" ∃! k, k • a ≤ g ∧ g < (k + 1) • a",
" -↑k ∈ s",
" ∀ n ∈ s, n ≤ ↑k",
" n ≤ ↑k",
" n • a ≤ ↑k • a",
" g < (m + 1) • a",
" ∃ z ∈ s, m < z",
" m < n + 1",
" m • a < (n + 1) • a",
" ∃! k, 0 ≤ g - k • a ∧ g - k • a < a"
] | [
" x ≤ n • y",
" ∃! k, k • a ≤ g ∧ g < (k + 1) • a",
" -↑k ∈ s",
" ∀ n ∈ s, n ≤ ↑k",
" n ≤ ↑k",
" n • a ≤ ↑k • a",
" g < (m + 1) • a",
" ∃ z ∈ s, m < z",
" m < n + 1",
" m • a < (n + 1) • a"
] |
import Mathlib.Analysis.InnerProductSpace.Rayleigh
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Algebra.DirectSum.Decomposition
import Mathlib.LinearAlgebra.Eigenspace.Minpoly
#align_import analysis.inner_product_space.spectrum from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1"
variable {𝕜 : Type*} [RCLike 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y
open scoped ComplexConjugate
open Module.End
namespace LinearMap
namespace IsSymmetric
variable {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric)
theorem invariant_orthogonalComplement_eigenspace (μ : 𝕜) (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) :
T v ∈ (eigenspace T μ)ᗮ := by
intro w hw
have : T w = (μ : 𝕜) • w := by rwa [mem_eigenspace_iff] at hw
simp [← hT w, this, inner_smul_left, hv w hw]
#align linear_map.is_symmetric.invariant_orthogonal_eigenspace LinearMap.IsSymmetric.invariant_orthogonalComplement_eigenspace
theorem conj_eigenvalue_eq_self {μ : 𝕜} (hμ : HasEigenvalue T μ) : conj μ = μ := by
obtain ⟨v, hv₁, hv₂⟩ := hμ.exists_hasEigenvector
rw [mem_eigenspace_iff] at hv₁
simpa [hv₂, inner_smul_left, inner_smul_right, hv₁] using hT v v
#align linear_map.is_symmetric.conj_eigenvalue_eq_self LinearMap.IsSymmetric.conj_eigenvalue_eq_self
theorem orthogonalFamily_eigenspaces :
OrthogonalFamily 𝕜 (fun μ => eigenspace T μ) fun μ => (eigenspace T μ).subtypeₗᵢ := by
rintro μ ν hμν ⟨v, hv⟩ ⟨w, hw⟩
by_cases hv' : v = 0
· simp [hv']
have H := hT.conj_eigenvalue_eq_self (hasEigenvalue_of_hasEigenvector ⟨hv, hv'⟩)
rw [mem_eigenspace_iff] at hv hw
refine Or.resolve_left ?_ hμν.symm
simpa [inner_smul_left, inner_smul_right, hv, hw, H] using (hT v w).symm
#align linear_map.is_symmetric.orthogonal_family_eigenspaces LinearMap.IsSymmetric.orthogonalFamily_eigenspaces
theorem orthogonalFamily_eigenspaces' :
OrthogonalFamily 𝕜 (fun μ : Eigenvalues T => eigenspace T μ) fun μ =>
(eigenspace T μ).subtypeₗᵢ :=
hT.orthogonalFamily_eigenspaces.comp Subtype.coe_injective
#align linear_map.is_symmetric.orthogonal_family_eigenspaces' LinearMap.IsSymmetric.orthogonalFamily_eigenspaces'
| Mathlib/Analysis/InnerProductSpace/Spectrum.lean | 102 | 105 | theorem orthogonalComplement_iSup_eigenspaces_invariant ⦃v : E⦄ (hv : v ∈ (⨆ μ, eigenspace T μ)ᗮ) :
T v ∈ (⨆ μ, eigenspace T μ)ᗮ := by |
rw [← Submodule.iInf_orthogonal] at hv ⊢
exact T.iInf_invariant hT.invariant_orthogonalComplement_eigenspace v hv
| [
" T v ∈ (eigenspace T μ)ᗮ",
" ⟪w, T v⟫_𝕜 = 0",
" T w = μ • w",
" (starRingEnd 𝕜) μ = μ",
" OrthogonalFamily 𝕜 (fun μ => ↥(eigenspace T μ)) fun μ => (eigenspace T μ).subtypeₗᵢ",
" ⟪((fun μ => (eigenspace T μ).subtypeₗᵢ) μ) ⟨v, hv⟩, ((fun μ => (eigenspace T μ).subtypeₗᵢ) ν) ⟨w, hw⟩⟫_𝕜 = 0",
" ⟪((fun μ... | [
" T v ∈ (eigenspace T μ)ᗮ",
" ⟪w, T v⟫_𝕜 = 0",
" T w = μ • w",
" (starRingEnd 𝕜) μ = μ",
" OrthogonalFamily 𝕜 (fun μ => ↥(eigenspace T μ)) fun μ => (eigenspace T μ).subtypeₗᵢ",
" ⟪((fun μ => (eigenspace T μ).subtypeₗᵢ) μ) ⟨v, hv⟩, ((fun μ => (eigenspace T μ).subtypeₗᵢ) ν) ⟨w, hw⟩⟫_𝕜 = 0",
" ⟪((fun μ... |
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
variable {α E : Type*} {m m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α}
[NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {p : ℝ≥0∞}
section AeEqOfForallSetIntegralEq
theorem ae_const_le_iff_forall_lt_measure_zero {β} [LinearOrder β] [TopologicalSpace β]
[OrderTopology β] [FirstCountableTopology β] (f : α → β) (c : β) :
(∀ᵐ x ∂μ, c ≤ f x) ↔ ∀ b < c, μ {x | f x ≤ b} = 0 := by
rw [ae_iff]
push_neg
constructor
· intro h b hb
exact measure_mono_null (fun y hy => (lt_of_le_of_lt hy hb : _)) h
intro hc
by_cases h : ∀ b, c ≤ b
· have : {a : α | f a < c} = ∅ := by
apply Set.eq_empty_iff_forall_not_mem.2 fun x hx => ?_
exact (lt_irrefl _ (lt_of_lt_of_le hx (h (f x)))).elim
simp [this]
by_cases H : ¬IsLUB (Set.Iio c) c
· have : c ∈ upperBounds (Set.Iio c) := fun y hy => le_of_lt hy
obtain ⟨b, b_up, bc⟩ : ∃ b : β, b ∈ upperBounds (Set.Iio c) ∧ b < c := by
simpa [IsLUB, IsLeast, this, lowerBounds] using H
exact measure_mono_null (fun x hx => b_up hx) (hc b bc)
push_neg at H h
obtain ⟨u, _, u_lt, u_lim, -⟩ :
∃ u : ℕ → β,
StrictMono u ∧ (∀ n : ℕ, u n < c) ∧ Tendsto u atTop (𝓝 c) ∧ ∀ n : ℕ, u n ∈ Set.Iio c :=
H.exists_seq_strictMono_tendsto_of_not_mem (lt_irrefl c) h
have h_Union : {x | f x < c} = ⋃ n : ℕ, {x | f x ≤ u n} := by
ext1 x
simp_rw [Set.mem_iUnion, Set.mem_setOf_eq]
constructor <;> intro h
· obtain ⟨n, hn⟩ := ((tendsto_order.1 u_lim).1 _ h).exists; exact ⟨n, hn.le⟩
· obtain ⟨n, hn⟩ := h; exact hn.trans_lt (u_lt _)
rw [h_Union, measure_iUnion_null_iff]
intro n
exact hc _ (u_lt n)
#align measure_theory.ae_const_le_iff_forall_lt_measure_zero MeasureTheory.ae_const_le_iff_forall_lt_measure_zero
section Real
variable {f : α → ℝ}
theorem ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable (hfm : StronglyMeasurable f)
(hf : Integrable f μ) (hf_zero : ∀ s, MeasurableSet s → μ s < ∞ → 0 ≤ ∫ x in s, f x ∂μ) :
0 ≤ᵐ[μ] f := by
simp_rw [EventuallyLE, Pi.zero_apply]
rw [ae_const_le_iff_forall_lt_measure_zero]
intro b hb_neg
let s := {x | f x ≤ b}
have hs : MeasurableSet s := hfm.measurableSet_le stronglyMeasurable_const
have mus : μ s < ∞ := Integrable.measure_le_lt_top hf hb_neg
have h_int_gt : (∫ x in s, f x ∂μ) ≤ b * (μ s).toReal := by
have h_const_le : (∫ x in s, f x ∂μ) ≤ ∫ _ in s, b ∂μ := by
refine
setIntegral_mono_ae_restrict hf.integrableOn (integrableOn_const.mpr (Or.inr mus)) ?_
rw [EventuallyLE, ae_restrict_iff hs]
exact eventually_of_forall fun x hxs => hxs
rwa [setIntegral_const, smul_eq_mul, mul_comm] at h_const_le
by_contra h
refine (lt_self_iff_false (∫ x in s, f x ∂μ)).mp (h_int_gt.trans_lt ?_)
refine (mul_neg_iff.mpr (Or.inr ⟨hb_neg, ?_⟩)).trans_le ?_
swap
· exact hf_zero s hs mus
refine ENNReal.toReal_nonneg.lt_of_ne fun h_eq => h ?_
cases' (ENNReal.toReal_eq_zero_iff _).mp h_eq.symm with hμs_eq_zero hμs_eq_top
· exact hμs_eq_zero
· exact absurd hμs_eq_top mus.ne
#align measure_theory.ae_nonneg_of_forall_set_integral_nonneg_of_strongly_measurable MeasureTheory.ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable
@[deprecated (since := "2024-04-17")]
alias ae_nonneg_of_forall_set_integral_nonneg_of_stronglyMeasurable :=
ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable
| Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean | 291 | 302 | theorem ae_nonneg_of_forall_setIntegral_nonneg (hf : Integrable f μ)
(hf_zero : ∀ s, MeasurableSet s → μ s < ∞ → 0 ≤ ∫ x in s, f x ∂μ) : 0 ≤ᵐ[μ] f := by |
rcases hf.1 with ⟨f', hf'_meas, hf_ae⟩
have hf'_integrable : Integrable f' μ := Integrable.congr hf hf_ae
have hf'_zero : ∀ s, MeasurableSet s → μ s < ∞ → 0 ≤ ∫ x in s, f' x ∂μ := by
intro s hs h's
rw [setIntegral_congr_ae hs (hf_ae.mono fun x hx _ => hx.symm)]
exact hf_zero s hs h's
exact
(ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable hf'_meas hf'_integrable
hf'_zero).trans
hf_ae.symm.le
| [
" (∀ᵐ (x : α) ∂μ, c ≤ f x) ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | ¬c ≤ f a} = 0 ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | f a < c} = 0 ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | f a < c} = 0 → ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {x | f x ≤ b} = 0",
" (∀ b < c, μ {x | f x ≤ b} = 0) → μ {a | f a < c} = 0",... | [
" (∀ᵐ (x : α) ∂μ, c ≤ f x) ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | ¬c ≤ f a} = 0 ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | f a < c} = 0 ↔ ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {a | f a < c} = 0 → ∀ b < c, μ {x | f x ≤ b} = 0",
" μ {x | f x ≤ b} = 0",
" (∀ b < c, μ {x | f x ≤ b} = 0) → μ {a | f a < c} = 0",... |
import Mathlib.Data.ENNReal.Operations
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal
namespace ENNReal
noncomputable section Inv
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
protected theorem div_eq_inv_mul : a / b = b⁻¹ * a := by rw [div_eq_mul_inv, mul_comm]
#align ennreal.div_eq_inv_mul ENNReal.div_eq_inv_mul
@[simp] theorem inv_zero : (0 : ℝ≥0∞)⁻¹ = ∞ :=
show sInf { b : ℝ≥0∞ | 1 ≤ 0 * b } = ∞ by simp
#align ennreal.inv_zero ENNReal.inv_zero
@[simp] theorem inv_top : ∞⁻¹ = 0 :=
bot_unique <| le_of_forall_le_of_dense fun a (h : 0 < a) => sInf_le <| by simp [*, h.ne', top_mul]
#align ennreal.inv_top ENNReal.inv_top
theorem coe_inv_le : (↑r⁻¹ : ℝ≥0∞) ≤ (↑r)⁻¹ :=
le_sInf fun b (hb : 1 ≤ ↑r * b) =>
coe_le_iff.2 <| by
rintro b rfl
apply NNReal.inv_le_of_le_mul
rwa [← coe_mul, ← coe_one, coe_le_coe] at hb
#align ennreal.coe_inv_le ENNReal.coe_inv_le
@[simp, norm_cast]
theorem coe_inv (hr : r ≠ 0) : (↑r⁻¹ : ℝ≥0∞) = (↑r)⁻¹ :=
coe_inv_le.antisymm <| sInf_le <| mem_setOf.2 <| by rw [← coe_mul, mul_inv_cancel hr, coe_one]
#align ennreal.coe_inv ENNReal.coe_inv
@[norm_cast]
theorem coe_inv_two : ((2⁻¹ : ℝ≥0) : ℝ≥0∞) = 2⁻¹ := by rw [coe_inv _root_.two_ne_zero, coe_two]
#align ennreal.coe_inv_two ENNReal.coe_inv_two
@[simp, norm_cast]
theorem coe_div (hr : r ≠ 0) : (↑(p / r) : ℝ≥0∞) = p / r := by
rw [div_eq_mul_inv, div_eq_mul_inv, coe_mul, coe_inv hr]
#align ennreal.coe_div ENNReal.coe_div
lemma coe_div_le : ↑(p / r) ≤ (p / r : ℝ≥0∞) := by
simpa only [div_eq_mul_inv, coe_mul] using mul_le_mul_left' coe_inv_le _
theorem div_zero (h : a ≠ 0) : a / 0 = ∞ := by simp [div_eq_mul_inv, h]
#align ennreal.div_zero ENNReal.div_zero
instance : DivInvOneMonoid ℝ≥0∞ :=
{ inferInstanceAs (DivInvMonoid ℝ≥0∞) with
inv_one := by simpa only [coe_inv one_ne_zero, coe_one] using coe_inj.2 inv_one }
protected theorem inv_pow : ∀ {a : ℝ≥0∞} {n : ℕ}, (a ^ n)⁻¹ = a⁻¹ ^ n
| _, 0 => by simp only [pow_zero, inv_one]
| ⊤, n + 1 => by simp [top_pow]
| (a : ℝ≥0), n + 1 => by
rcases eq_or_ne a 0 with (rfl | ha)
· simp [top_pow]
· have := pow_ne_zero (n + 1) ha
norm_cast
rw [inv_pow]
#align ennreal.inv_pow ENNReal.inv_pow
protected theorem mul_inv_cancel (h0 : a ≠ 0) (ht : a ≠ ∞) : a * a⁻¹ = 1 := by
lift a to ℝ≥0 using ht
norm_cast at h0; norm_cast
exact mul_inv_cancel h0
#align ennreal.mul_inv_cancel ENNReal.mul_inv_cancel
protected theorem inv_mul_cancel (h0 : a ≠ 0) (ht : a ≠ ∞) : a⁻¹ * a = 1 :=
mul_comm a a⁻¹ ▸ ENNReal.mul_inv_cancel h0 ht
#align ennreal.inv_mul_cancel ENNReal.inv_mul_cancel
protected theorem div_mul_cancel (h0 : a ≠ 0) (hI : a ≠ ∞) : b / a * a = b := by
rw [div_eq_mul_inv, mul_assoc, ENNReal.inv_mul_cancel h0 hI, mul_one]
#align ennreal.div_mul_cancel ENNReal.div_mul_cancel
protected theorem mul_div_cancel' (h0 : a ≠ 0) (hI : a ≠ ∞) : a * (b / a) = b := by
rw [mul_comm, ENNReal.div_mul_cancel h0 hI]
#align ennreal.mul_div_cancel' ENNReal.mul_div_cancel'
-- Porting note: `simp only [div_eq_mul_inv, mul_comm, mul_assoc]` doesn't work in the following two
protected theorem mul_comm_div : a / b * c = a * (c / b) := by
simp only [div_eq_mul_inv, mul_right_comm, ← mul_assoc]
#align ennreal.mul_comm_div ENNReal.mul_comm_div
protected theorem mul_div_right_comm : a * b / c = a / c * b := by
simp only [div_eq_mul_inv, mul_right_comm]
#align ennreal.mul_div_right_comm ENNReal.mul_div_right_comm
instance : InvolutiveInv ℝ≥0∞ where
inv_inv a := by
by_cases a = 0 <;> cases a <;> simp_all [none_eq_top, some_eq_coe, -coe_inv, (coe_inv _).symm]
@[simp] protected lemma inv_eq_one : a⁻¹ = 1 ↔ a = 1 := by rw [← inv_inj, inv_inv, inv_one]
@[simp] theorem inv_eq_top : a⁻¹ = ∞ ↔ a = 0 := inv_zero ▸ inv_inj
#align ennreal.inv_eq_top ENNReal.inv_eq_top
| Mathlib/Data/ENNReal/Inv.lean | 133 | 133 | theorem inv_ne_top : a⁻¹ ≠ ∞ ↔ a ≠ 0 := by | simp
| [
" a / b = b⁻¹ * a",
" sInf {b | 1 ≤ 0 * b} = ⊤",
" a ∈ {b | 1 ≤ ⊤ * b}",
" ∀ (p : ℝ≥0), b = ↑p → r⁻¹ ≤ p",
" r⁻¹ ≤ b",
" 1 ≤ r * b",
" 1 ≤ ↑r * ↑r⁻¹",
" ↑2⁻¹ = 2⁻¹",
" ↑(p / r) = ↑p / ↑r",
" ↑(p / r) ≤ ↑p / ↑r",
" a / 0 = ⊤",
" 1⁻¹ = 1",
" (x✝ ^ 0)⁻¹ = x✝⁻¹ ^ 0",
" (⊤ ^ (n + 1))⁻¹ = ⊤⁻¹ ^ ... | [
" a / b = b⁻¹ * a",
" sInf {b | 1 ≤ 0 * b} = ⊤",
" a ∈ {b | 1 ≤ ⊤ * b}",
" ∀ (p : ℝ≥0), b = ↑p → r⁻¹ ≤ p",
" r⁻¹ ≤ b",
" 1 ≤ r * b",
" 1 ≤ ↑r * ↑r⁻¹",
" ↑2⁻¹ = 2⁻¹",
" ↑(p / r) = ↑p / ↑r",
" ↑(p / r) ≤ ↑p / ↑r",
" a / 0 = ⊤",
" 1⁻¹ = 1",
" (x✝ ^ 0)⁻¹ = x✝⁻¹ ^ 0",
" (⊤ ^ (n + 1))⁻¹ = ⊤⁻¹ ^ ... |
import Mathlib.Analysis.Quaternion
import Mathlib.Analysis.NormedSpace.Exponential
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series
#align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open scoped Quaternion Nat
open NormedSpace
namespace Quaternion
@[simp, norm_cast]
theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) :=
(map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm
#align quaternion.exp_coe Quaternion.exp_coe
theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) :
expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) =
↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
letI k : ℝ := ↑(2 * n)!
calc
k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2]
_ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_
_ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_
· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
push_cast
rfl
· rw [← coe_mul_eq_smul, div_eq_mul_inv]
norm_cast
ring_nf
theorem expSeries_odd_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) :
expSeries ℝ (Quaternion ℝ) (2 * n + 1) (fun _ => q) =
(((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) / ‖q‖) • q := by
rw [expSeries_apply_eq]
obtain rfl | hq0 := eq_or_ne q 0
· simp
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
have hqn := norm_ne_zero_iff.mpr hq0
let k : ℝ := ↑(2 * n + 1)!
calc
k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) := by rw [pow_succ, pow_mul, hq2]
_ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_
_ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_
· congr 1
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul]
norm_cast
· rw [smul_smul]
congr 1
simp_rw [pow_succ, mul_div_assoc, div_div_cancel_left' hqn]
ring
theorem hasSum_expSeries_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) {c s : ℝ}
(hc : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) c)
(hs : HasSum (fun n => (-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / (2 * n + 1)!) s) :
HasSum (fun n => expSeries ℝ (Quaternion ℝ) n fun _ => q) (↑c + (s / ‖q‖) • q) := by
replace hc := hasSum_coe.mpr hc
replace hs := (hs.div_const ‖q‖).smul_const q
refine HasSum.even_add_odd ?_ ?_
· convert hc using 1
ext n : 1
rw [expSeries_even_of_imaginary hq]
· convert hs using 1
ext n : 1
rw [expSeries_odd_of_imaginary hq]
#align quaternion.has_sum_exp_series_of_imaginary Quaternion.hasSum_expSeries_of_imaginary
theorem exp_of_re_eq_zero (q : Quaternion ℝ) (hq : q.re = 0) :
exp ℝ q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q := by
rw [exp_eq_tsum]
refine HasSum.tsum_eq ?_
simp_rw [← expSeries_apply_eq]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
#align quaternion.exp_of_re_eq_zero Quaternion.exp_of_re_eq_zero
theorem exp_eq (q : Quaternion ℝ) :
exp ℝ q = exp ℝ q.re • (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im) := by
rw [← exp_of_re_eq_zero q.im q.im_re, ← coe_mul_eq_smul, ← exp_coe, ← exp_add_of_commute,
re_add_im]
exact Algebra.commutes q.re (_ : ℍ[ℝ])
#align quaternion.exp_eq Quaternion.exp_eq
theorem re_exp (q : ℍ[ℝ]) : (exp ℝ q).re = exp ℝ q.re * Real.cos ‖q - q.re‖ := by simp [exp_eq]
#align quaternion.re_exp Quaternion.re_exp
theorem im_exp (q : ℍ[ℝ]) : (exp ℝ q).im = (exp ℝ q.re * (Real.sin ‖q.im‖ / ‖q.im‖)) • q.im := by
simp [exp_eq, smul_smul]
#align quaternion.im_exp Quaternion.im_exp
| Mathlib/Analysis/NormedSpace/QuaternionExponential.lean | 121 | 135 | theorem normSq_exp (q : ℍ[ℝ]) : normSq (exp ℝ q) = exp ℝ q.re ^ 2 :=
calc
normSq (exp ℝ q) =
normSq (exp ℝ q.re • (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im)) := by |
rw [exp_eq]
_ = exp ℝ q.re ^ 2 * normSq (↑(Real.cos ‖q.im‖) + (Real.sin ‖q.im‖ / ‖q.im‖) • q.im) := by
rw [normSq_smul]
_ = exp ℝ q.re ^ 2 * (Real.cos ‖q.im‖ ^ 2 + Real.sin ‖q.im‖ ^ 2) := by
congr 1
obtain hv | hv := eq_or_ne ‖q.im‖ 0
· simp [hv]
rw [normSq_add, normSq_smul, star_smul, coe_mul_eq_smul, smul_re, smul_re, star_re, im_re,
smul_zero, smul_zero, mul_zero, add_zero, div_pow, normSq_coe,
normSq_eq_norm_mul_self, ← sq, div_mul_cancel₀ _ (pow_ne_zero _ hv)]
_ = exp ℝ q.re ^ 2 := by rw [Real.cos_sq_add_sin_sq, mul_one]
| [
" ((expSeries ℝ ℍ (2 * n)) fun x => q) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)",
" (↑(2 * n)!)⁻¹ • q ^ (2 * n) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)",
" k⁻¹ • q ^ (2 * n) = k⁻¹ • (-↑(normSq q)) ^ n",
" k⁻¹ • (-↑(normSq q)) ^ n = k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n))",
" (-↑(normSq q)) ^ n = ↑((-1) ^ n * ‖... | [
" ((expSeries ℝ ℍ (2 * n)) fun x => q) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)",
" (↑(2 * n)!)⁻¹ • q ^ (2 * n) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)",
" k⁻¹ • q ^ (2 * n) = k⁻¹ • (-↑(normSq q)) ^ n",
" k⁻¹ • (-↑(normSq q)) ^ n = k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n))",
" (-↑(normSq q)) ^ n = ↑((-1) ^ n * ‖... |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
#align add_self_eq_zero add_self_eq_zero
set_option linter.deprecated false
@[simp]
theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 :=
add_self_eq_zero
#align bit0_eq_zero bit0_eq_zero
@[simp]
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm]
exact bit0_eq_zero
#align zero_eq_bit0 zero_eq_bit0
theorem bit0_ne_zero : bit0 a ≠ 0 ↔ a ≠ 0 :=
bit0_eq_zero.not
#align bit0_ne_zero bit0_ne_zero
theorem zero_ne_bit0 : 0 ≠ bit0 a ↔ a ≠ 0 :=
zero_eq_bit0.not
#align zero_ne_bit0 zero_ne_bit0
end
section
variable {R : Type*} [NonAssocRing R] [NoZeroDivisors R] [CharZero R]
@[simp] theorem neg_eq_self_iff {a : R} : -a = a ↔ a = 0 :=
neg_eq_iff_add_eq_zero.trans add_self_eq_zero
#align neg_eq_self_iff neg_eq_self_iff
@[simp] theorem eq_neg_self_iff {a : R} : a = -a ↔ a = 0 :=
eq_neg_iff_add_eq_zero.trans add_self_eq_zero
#align eq_neg_self_iff eq_neg_self_iff
theorem nat_mul_inj {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) : n = 0 ∨ a = b := by
rw [← sub_eq_zero, ← mul_sub, mul_eq_zero, sub_eq_zero] at h
exact mod_cast h
#align nat_mul_inj nat_mul_inj
theorem nat_mul_inj' {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) (w : n ≠ 0) : a = b := by
simpa [w] using nat_mul_inj h
#align nat_mul_inj' nat_mul_inj'
set_option linter.deprecated false
theorem bit0_injective : Function.Injective (bit0 : R → R) := fun a b h => by
dsimp [bit0] at h
simp only [(two_mul a).symm, (two_mul b).symm] at h
refine nat_mul_inj' ?_ two_ne_zero
exact mod_cast h
#align bit0_injective bit0_injective
theorem bit1_injective : Function.Injective (bit1 : R → R) := fun a b h => by
simp only [bit1, add_left_inj] at h
exact bit0_injective h
#align bit1_injective bit1_injective
@[simp]
theorem bit0_eq_bit0 {a b : R} : bit0 a = bit0 b ↔ a = b :=
bit0_injective.eq_iff
#align bit0_eq_bit0 bit0_eq_bit0
@[simp]
theorem bit1_eq_bit1 {a b : R} : bit1 a = bit1 b ↔ a = b :=
bit1_injective.eq_iff
#align bit1_eq_bit1 bit1_eq_bit1
@[simp]
| Mathlib/Algebra/CharZero/Lemmas.lean | 161 | 162 | theorem bit1_eq_one {a : R} : bit1 a = 1 ↔ a = 0 := by |
rw [show (1 : R) = bit1 0 by simp, bit1_eq_bit1]
| [
" 2 ≠ 0",
" a + a = 0 ↔ a = 0",
" 0 = bit0 a ↔ a = 0",
" bit0 a = 0 ↔ a = 0",
" n = 0 ∨ a = b",
" a = b",
" ↑2 * a = ↑2 * b",
" bit1 a = 1 ↔ a = 0",
" 1 = bit1 0"
] | [
" 2 ≠ 0",
" a + a = 0 ↔ a = 0",
" 0 = bit0 a ↔ a = 0",
" bit0 a = 0 ↔ a = 0",
" n = 0 ∨ a = b",
" a = b",
" ↑2 * a = ↑2 * b"
] |
import Mathlib.Algebra.Algebra.Equiv
import Mathlib.LinearAlgebra.Span
#align_import algebra.algebra.tower from "leanprover-community/mathlib"@"71150516f28d9826c7341f8815b31f7d8770c212"
open Pointwise
universe u v w u₁ v₁
variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁) (M : Type v₁)
namespace IsScalarTower
section Module
variable [CommSemiring R] [Semiring A] [Algebra R A]
variable [MulAction A M]
variable {R} {M}
theorem algebraMap_smul [SMul R M] [IsScalarTower R A M] (r : R) (x : M) :
algebraMap R A r • x = r • x := by
rw [Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]
#align is_scalar_tower.algebra_map_smul IsScalarTower.algebraMap_smul
variable {A} in
| Mathlib/Algebra/Algebra/Tower.lean | 94 | 96 | theorem of_algebraMap_smul [SMul R M] (h : ∀ (r : R) (x : M), algebraMap R A r • x = r • x) :
IsScalarTower R A M where
smul_assoc r a x := by | rw [Algebra.smul_def, mul_smul, h]
| [
" (algebraMap R A) r • x = r • x",
" (r • a) • x = r • a • x"
] | [
" (algebraMap R A) r • x = r • x"
] |
import Mathlib.RingTheory.Adjoin.FG
#align_import ring_theory.adjoin.tower from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Pointwise
universe u v w u₁
variable (R : Type u) (S : Type v) (A : Type w) (B : Type u₁)
namespace Algebra
theorem adjoin_restrictScalars (C D E : Type*) [CommSemiring C] [CommSemiring D] [CommSemiring E]
[Algebra C D] [Algebra C E] [Algebra D E] [IsScalarTower C D E] (S : Set E) :
(Algebra.adjoin D S).restrictScalars C =
(Algebra.adjoin ((⊤ : Subalgebra C D).map (IsScalarTower.toAlgHom C D E)) S).restrictScalars
C := by
suffices
Set.range (algebraMap D E) =
Set.range (algebraMap ((⊤ : Subalgebra C D).map (IsScalarTower.toAlgHom C D E)) E) by
ext x
change x ∈ Subsemiring.closure (_ ∪ S) ↔ x ∈ Subsemiring.closure (_ ∪ S)
rw [this]
ext x
constructor
· rintro ⟨y, hy⟩
exact ⟨⟨algebraMap D E y, ⟨y, ⟨Algebra.mem_top, rfl⟩⟩⟩, hy⟩
· rintro ⟨⟨y, ⟨z, ⟨h0, h1⟩⟩⟩, h2⟩
exact ⟨z, Eq.trans h1 h2⟩
#align algebra.adjoin_restrict_scalars Algebra.adjoin_restrictScalars
| Mathlib/RingTheory/Adjoin/Tower.lean | 49 | 58 | theorem adjoin_res_eq_adjoin_res (C D E F : Type*) [CommSemiring C] [CommSemiring D]
[CommSemiring E] [CommSemiring F] [Algebra C D] [Algebra C E] [Algebra C F] [Algebra D F]
[Algebra E F] [IsScalarTower C D F] [IsScalarTower C E F] {S : Set D} {T : Set E}
(hS : Algebra.adjoin C S = ⊤) (hT : Algebra.adjoin C T = ⊤) :
(Algebra.adjoin E (algebraMap D F '' S)).restrictScalars C =
(Algebra.adjoin D (algebraMap E F '' T)).restrictScalars C := by |
rw [adjoin_restrictScalars C E, adjoin_restrictScalars C D, ← hS, ← hT, ← Algebra.adjoin_image,
← Algebra.adjoin_image, ← AlgHom.coe_toRingHom, ← AlgHom.coe_toRingHom,
IsScalarTower.coe_toAlgHom, IsScalarTower.coe_toAlgHom, ← adjoin_union_eq_adjoin_adjoin, ←
adjoin_union_eq_adjoin_adjoin, Set.union_comm]
| [
" Subalgebra.restrictScalars C (adjoin D S) =\n Subalgebra.restrictScalars C (adjoin (↥(Subalgebra.map (IsScalarTower.toAlgHom C D E) ⊤)) S)",
" x ∈ Subalgebra.restrictScalars C (adjoin D S) ↔\n x ∈ Subalgebra.restrictScalars C (adjoin (↥(Subalgebra.map (IsScalarTower.toAlgHom C D E) ⊤)) S)",
" x ∈ Subsem... | [
" Subalgebra.restrictScalars C (adjoin D S) =\n Subalgebra.restrictScalars C (adjoin (↥(Subalgebra.map (IsScalarTower.toAlgHom C D E) ⊤)) S)",
" x ∈ Subalgebra.restrictScalars C (adjoin D S) ↔\n x ∈ Subalgebra.restrictScalars C (adjoin (↥(Subalgebra.map (IsScalarTower.toAlgHom C D E) ⊤)) S)",
" x ∈ Subsem... |
import Mathlib.MeasureTheory.Measure.NullMeasurable
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.Topology.Algebra.Order.LiminfLimsup
#align_import measure_theory.measure.measure_space from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set
open Filter hiding map
open Function MeasurableSpace
open scoped Classical symmDiff
open Topology Filter ENNReal NNReal Interval MeasureTheory
variable {α β γ δ ι R R' : Type*}
namespace MeasureTheory
section
variable {m : MeasurableSpace α} {μ μ₁ μ₂ : Measure α} {s s₁ s₂ t : Set α}
instance ae_isMeasurablyGenerated : IsMeasurablyGenerated (ae μ) :=
⟨fun _s hs =>
let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs
⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩
#align measure_theory.ae_is_measurably_generated MeasureTheory.ae_isMeasurablyGenerated
theorem ae_uIoc_iff [LinearOrder α] {a b : α} {P : α → Prop} :
(∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ x ∂μ, x ∈ Ioc b a → P x := by
simp only [uIoc_eq_union, mem_union, or_imp, eventually_and]
#align measure_theory.ae_uIoc_iff MeasureTheory.ae_uIoc_iff
theorem measure_union (hd : Disjoint s₁ s₂) (h : MeasurableSet s₂) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀ h.nullMeasurableSet hd.aedisjoint
#align measure_theory.measure_union MeasureTheory.measure_union
theorem measure_union' (hd : Disjoint s₁ s₂) (h : MeasurableSet s₁) : μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀' h.nullMeasurableSet hd.aedisjoint
#align measure_theory.measure_union' MeasureTheory.measure_union'
theorem measure_inter_add_diff (s : Set α) (ht : MeasurableSet t) : μ (s ∩ t) + μ (s \ t) = μ s :=
measure_inter_add_diff₀ _ ht.nullMeasurableSet
#align measure_theory.measure_inter_add_diff MeasureTheory.measure_inter_add_diff
theorem measure_diff_add_inter (s : Set α) (ht : MeasurableSet t) : μ (s \ t) + μ (s ∩ t) = μ s :=
(add_comm _ _).trans (measure_inter_add_diff s ht)
#align measure_theory.measure_diff_add_inter MeasureTheory.measure_diff_add_inter
theorem measure_union_add_inter (s : Set α) (ht : MeasurableSet t) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by
rw [← measure_inter_add_diff (s ∪ t) ht, Set.union_inter_cancel_right, union_diff_right, ←
measure_inter_add_diff s ht]
ac_rfl
#align measure_theory.measure_union_add_inter MeasureTheory.measure_union_add_inter
| Mathlib/MeasureTheory/Measure/MeasureSpace.lean | 135 | 137 | theorem measure_union_add_inter' (hs : MeasurableSet s) (t : Set α) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t := by |
rw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm]
| [
" (∀ᵐ (x : α) ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ (x : α) ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ (x : α) ∂μ, x ∈ Ioc b a → P x",
" μ (s ∪ t) + μ (s ∩ t) = μ s + μ t",
" μ t + μ (s \\ t) + μ (s ∩ t) = μ (s ∩ t) + μ (s \\ t) + μ t"
] | [
" (∀ᵐ (x : α) ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ (x : α) ∂μ, x ∈ Ioc a b → P x) ∧ ∀ᵐ (x : α) ∂μ, x ∈ Ioc b a → P x",
" μ (s ∪ t) + μ (s ∩ t) = μ s + μ t",
" μ t + μ (s \\ t) + μ (s ∩ t) = μ (s ∩ t) + μ (s \\ t) + μ t"
] |
import Mathlib.Data.Finset.Grade
import Mathlib.Order.Interval.Finset.Basic
#align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
variable {α β : Type*}
namespace Finset
section Decidable
variable [DecidableEq α] (s t : Finset α)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset α) where
finsetIcc s t := t.powerset.filter (s ⊆ ·)
finsetIco s t := t.ssubsets.filter (s ⊆ ·)
finsetIoc s t := t.powerset.filter (s ⊂ ·)
finsetIoo s t := t.ssubsets.filter (s ⊂ ·)
finset_mem_Icc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ico s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
finset_mem_Ioc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ioo s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s ⊆ ·) :=
rfl
#align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset
theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s ⊆ ·) :=
rfl
#align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets
theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s ⊂ ·) :=
rfl
#align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset
theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s ⊂ ·) :=
rfl
#align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets
theorem Iic_eq_powerset : Iic s = s.powerset :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iic_eq_powerset Finset.Iic_eq_powerset
theorem Iio_eq_ssubsets : Iio s = s.ssubsets :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets
variable {s t}
| Mathlib/Data/Finset/Interval.lean | 80 | 87 | theorem Icc_eq_image_powerset (h : s ⊆ t) : Icc s t = (t \ s).powerset.image (s ∪ ·) := by |
ext u
simp_rw [mem_Icc, mem_image, mem_powerset]
constructor
· rintro ⟨hs, ht⟩
exact ⟨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hs⟩
· rintro ⟨v, hv, rfl⟩
exact ⟨le_sup_left, union_subset h <| hv.trans sdiff_subset⟩
| [
" u ∈ (fun s t => filter (fun x => s ⊆ x) t.powerset) s t ↔ s ≤ u ∧ u ≤ t",
" u ⊆ t ∧ s ⊆ u ↔ s ≤ u ∧ u ≤ t",
" u ∈ (fun s t => filter (fun x => s ⊆ x) t.ssubsets) s t ↔ s ≤ u ∧ u < t",
" u ⊂ t ∧ s ⊆ u ↔ s ≤ u ∧ u < t",
" u ∈ (fun s t => filter (fun x => s ⊂ x) t.powerset) s t ↔ s < u ∧ u ≤ t",
" u ⊆ t ∧ ... | [
" u ∈ (fun s t => filter (fun x => s ⊆ x) t.powerset) s t ↔ s ≤ u ∧ u ≤ t",
" u ⊆ t ∧ s ⊆ u ↔ s ≤ u ∧ u ≤ t",
" u ∈ (fun s t => filter (fun x => s ⊆ x) t.ssubsets) s t ↔ s ≤ u ∧ u < t",
" u ⊂ t ∧ s ⊆ u ↔ s ≤ u ∧ u < t",
" u ∈ (fun s t => filter (fun x => s ⊂ x) t.powerset) s t ↔ s < u ∧ u ≤ t",
" u ⊆ t ∧ ... |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Fintype.Card
#align_import algebra.order.field.pi from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
variable {α ι : Type*} [LinearOrderedSemifield α]
| Mathlib/Algebra/Order/Field/Pi.lean | 21 | 31 | theorem Pi.exists_forall_pos_add_lt [ExistsAddOfLE α] [Finite ι] {x y : ι → α}
(h : ∀ i, x i < y i) : ∃ ε, 0 < ε ∧ ∀ i, x i + ε < y i := by |
cases nonempty_fintype ι
cases isEmpty_or_nonempty ι
· exact ⟨1, zero_lt_one, isEmptyElim⟩
choose ε hε hxε using fun i => exists_pos_add_of_lt' (h i)
obtain rfl : x + ε = y := funext hxε
have hε : 0 < Finset.univ.inf' Finset.univ_nonempty ε := (Finset.lt_inf'_iff _).2 fun i _ => hε _
exact
⟨_, half_pos hε, fun i =>
add_lt_add_left ((half_lt_self hε).trans_le <| Finset.inf'_le _ <| Finset.mem_univ _) _⟩
| [
" ∃ ε, 0 < ε ∧ ∀ (i : ι), x i + ε < y i",
" ∃ ε_1, 0 < ε_1 ∧ ∀ (i : ι), x i + ε_1 < (x + ε) i"
] | [] |
import Mathlib.Algebra.Order.Hom.Monoid
import Mathlib.SetTheory.Game.Ordinal
#align_import set_theory.surreal.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
universe u
namespace SetTheory
open scoped PGame
namespace PGame
def Numeric : PGame → Prop
| ⟨_, _, L, R⟩ => (∀ i j, L i < R j) ∧ (∀ i, Numeric (L i)) ∧ ∀ j, Numeric (R j)
#align pgame.numeric SetTheory.PGame.Numeric
theorem numeric_def {x : PGame} :
Numeric x ↔
(∀ i j, x.moveLeft i < x.moveRight j) ∧
(∀ i, Numeric (x.moveLeft i)) ∧ ∀ j, Numeric (x.moveRight j) := by
cases x; rfl
#align pgame.numeric_def SetTheory.PGame.numeric_def
namespace Numeric
theorem mk {x : PGame} (h₁ : ∀ i j, x.moveLeft i < x.moveRight j) (h₂ : ∀ i, Numeric (x.moveLeft i))
(h₃ : ∀ j, Numeric (x.moveRight j)) : Numeric x :=
numeric_def.2 ⟨h₁, h₂, h₃⟩
#align pgame.numeric.mk SetTheory.PGame.Numeric.mk
| Mathlib/SetTheory/Surreal/Basic.lean | 85 | 86 | theorem left_lt_right {x : PGame} (o : Numeric x) (i : x.LeftMoves) (j : x.RightMoves) :
x.moveLeft i < x.moveRight j := by | cases x; exact o.1 i j
| [
" x.Numeric ↔\n (∀ (i : x.LeftMoves) (j : x.RightMoves), x.moveLeft i < x.moveRight j) ∧\n (∀ (i : x.LeftMoves), (x.moveLeft i).Numeric) ∧ ∀ (j : x.RightMoves), (x.moveRight j).Numeric",
" (mk α✝ β✝ a✝¹ a✝).Numeric ↔\n (∀ (i : (mk α✝ β✝ a✝¹ a✝).LeftMoves) (j : (mk α✝ β✝ a✝¹ a✝).RightMoves),\n (m... | [
" x.Numeric ↔\n (∀ (i : x.LeftMoves) (j : x.RightMoves), x.moveLeft i < x.moveRight j) ∧\n (∀ (i : x.LeftMoves), (x.moveLeft i).Numeric) ∧ ∀ (j : x.RightMoves), (x.moveRight j).Numeric",
" (mk α✝ β✝ a✝¹ a✝).Numeric ↔\n (∀ (i : (mk α✝ β✝ a✝¹ a✝).LeftMoves) (j : (mk α✝ β✝ a✝¹ a✝).RightMoves),\n (m... |
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Topology.Algebra.OpenSubgroup
import Mathlib.Topology.Algebra.Ring.Basic
#align_import topology.algebra.nonarchimedean.basic from "leanprover-community/mathlib"@"83f81aea33931a1edb94ce0f32b9a5d484de6978"
open scoped Pointwise Topology
class NonarchimedeanAddGroup (G : Type*) [AddGroup G] [TopologicalSpace G] extends
TopologicalAddGroup G : Prop where
is_nonarchimedean : ∀ U ∈ 𝓝 (0 : G), ∃ V : OpenAddSubgroup G, (V : Set G) ⊆ U
#align nonarchimedean_add_group NonarchimedeanAddGroup
@[to_additive]
class NonarchimedeanGroup (G : Type*) [Group G] [TopologicalSpace G] extends TopologicalGroup G :
Prop where
is_nonarchimedean : ∀ U ∈ 𝓝 (1 : G), ∃ V : OpenSubgroup G, (V : Set G) ⊆ U
#align nonarchimedean_group NonarchimedeanGroup
class NonarchimedeanRing (R : Type*) [Ring R] [TopologicalSpace R] extends TopologicalRing R :
Prop where
is_nonarchimedean : ∀ U ∈ 𝓝 (0 : R), ∃ V : OpenAddSubgroup R, (V : Set R) ⊆ U
#align nonarchimedean_ring NonarchimedeanRing
-- see Note [lower instance priority]
instance (priority := 100) NonarchimedeanRing.to_nonarchimedeanAddGroup (R : Type*) [Ring R]
[TopologicalSpace R] [t : NonarchimedeanRing R] : NonarchimedeanAddGroup R :=
{ t with }
#align nonarchimedean_ring.to_nonarchimedean_add_group NonarchimedeanRing.to_nonarchimedeanAddGroup
namespace NonarchimedeanGroup
variable {G : Type*} [Group G] [TopologicalSpace G] [NonarchimedeanGroup G]
variable {H : Type*} [Group H] [TopologicalSpace H] [TopologicalGroup H]
variable {K : Type*} [Group K] [TopologicalSpace K] [NonarchimedeanGroup K]
@[to_additive]
theorem nonarchimedean_of_emb (f : G →* H) (emb : OpenEmbedding f) : NonarchimedeanGroup H :=
{ is_nonarchimedean := fun U hU =>
have h₁ : f ⁻¹' U ∈ 𝓝 (1 : G) := by
apply emb.continuous.tendsto
rwa [f.map_one]
let ⟨V, hV⟩ := is_nonarchimedean (f ⁻¹' U) h₁
⟨{ Subgroup.map f V with isOpen' := emb.isOpenMap _ V.isOpen }, Set.image_subset_iff.2 hV⟩ }
#align nonarchimedean_group.nonarchimedean_of_emb NonarchimedeanGroup.nonarchimedean_of_emb
#align nonarchimedean_add_group.nonarchimedean_of_emb NonarchimedeanAddGroup.nonarchimedean_of_emb
@[to_additive NonarchimedeanAddGroup.prod_subset "An open neighborhood of the identity in
the cartesian product of two nonarchimedean groups contains the cartesian product of
an open neighborhood in each group."]
| Mathlib/Topology/Algebra/Nonarchimedean/Basic.lean | 84 | 93 | theorem prod_subset {U} (hU : U ∈ 𝓝 (1 : G × K)) :
∃ (V : OpenSubgroup G) (W : OpenSubgroup K), (V : Set G) ×ˢ (W : Set K) ⊆ U := by |
erw [nhds_prod_eq, Filter.mem_prod_iff] at hU
rcases hU with ⟨U₁, hU₁, U₂, hU₂, h⟩
cases' is_nonarchimedean _ hU₁ with V hV
cases' is_nonarchimedean _ hU₂ with W hW
use V; use W
rw [Set.prod_subset_iff]
intro x hX y hY
exact Set.Subset.trans (Set.prod_mono hV hW) h (Set.mem_sep hX hY)
| [
" ⇑f ⁻¹' U ∈ 𝓝 1",
" U ∈ 𝓝 (f 1)",
" ∃ V W, ↑V ×ˢ ↑W ⊆ U",
" ∃ W, ↑V ×ˢ ↑W ⊆ U",
" ↑V ×ˢ ↑W ⊆ U",
" ∀ x ∈ ↑V, ∀ y ∈ ↑W, (x, y) ∈ U",
" (x, y) ∈ U"
] | [
" ⇑f ⁻¹' U ∈ 𝓝 1",
" U ∈ 𝓝 (f 1)"
] |
import Mathlib.SetTheory.Cardinal.Ordinal
#align_import set_theory.cardinal.continuum from "leanprover-community/mathlib"@"e08a42b2dd544cf11eba72e5fc7bf199d4349925"
namespace Cardinal
universe u v
open Cardinal
def continuum : Cardinal.{u} :=
2 ^ ℵ₀
#align cardinal.continuum Cardinal.continuum
scoped notation "𝔠" => Cardinal.continuum
@[simp]
theorem two_power_aleph0 : 2 ^ aleph0.{u} = continuum.{u} :=
rfl
#align cardinal.two_power_aleph_0 Cardinal.two_power_aleph0
@[simp]
theorem lift_continuum : lift.{v} 𝔠 = 𝔠 := by
rw [← two_power_aleph0, lift_two_power, lift_aleph0, two_power_aleph0]
#align cardinal.lift_continuum Cardinal.lift_continuum
@[simp]
theorem continuum_le_lift {c : Cardinal.{u}} : 𝔠 ≤ lift.{v} c ↔ 𝔠 ≤ c := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
#align cardinal.continuum_le_lift Cardinal.continuum_le_lift
@[simp]
theorem lift_le_continuum {c : Cardinal.{u}} : lift.{v} c ≤ 𝔠 ↔ c ≤ 𝔠 := by
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_le]
#align cardinal.lift_le_continuum Cardinal.lift_le_continuum
@[simp]
| Mathlib/SetTheory/Cardinal/Continuum.lean | 58 | 60 | theorem continuum_lt_lift {c : Cardinal.{u}} : 𝔠 < lift.{v} c ↔ 𝔠 < c := by |
-- Porting note: added explicit universes
rw [← lift_continuum.{u,v}, lift_lt]
| [
" lift.{v, u_1} 𝔠 = 𝔠",
" 𝔠 ≤ lift.{v, u} c ↔ 𝔠 ≤ c",
" lift.{v, u} c ≤ 𝔠 ↔ c ≤ 𝔠",
" 𝔠 < lift.{v, u} c ↔ 𝔠 < c"
] | [
" lift.{v, u_1} 𝔠 = 𝔠",
" 𝔠 ≤ lift.{v, u} c ↔ 𝔠 ≤ c",
" lift.{v, u} c ≤ 𝔠 ↔ c ≤ 𝔠"
] |
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.LinearAlgebra.Matrix.SesquilinearForm
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import linear_algebra.quadratic_form.basic from "leanprover-community/mathlib"@"d11f435d4e34a6cea0a1797d6b625b0c170be845"
universe u v w
variable {S T : Type*}
variable {R : Type*} {M N : Type*}
open LinearMap (BilinForm)
section Polar
variable [CommRing R] [AddCommGroup M]
namespace QuadraticForm
def polar (f : M → R) (x y : M) :=
f (x + y) - f x - f y
#align quadratic_form.polar QuadraticForm.polar
theorem polar_add (f g : M → R) (x y : M) : polar (f + g) x y = polar f x y + polar g x y := by
simp only [polar, Pi.add_apply]
abel
#align quadratic_form.polar_add QuadraticForm.polar_add
theorem polar_neg (f : M → R) (x y : M) : polar (-f) x y = -polar f x y := by
simp only [polar, Pi.neg_apply, sub_eq_add_neg, neg_add]
#align quadratic_form.polar_neg QuadraticForm.polar_neg
theorem polar_smul [Monoid S] [DistribMulAction S R] (f : M → R) (s : S) (x y : M) :
polar (s • f) x y = s • polar f x y := by simp only [polar, Pi.smul_apply, smul_sub]
#align quadratic_form.polar_smul QuadraticForm.polar_smul
theorem polar_comm (f : M → R) (x y : M) : polar f x y = polar f y x := by
rw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]
#align quadratic_form.polar_comm QuadraticForm.polar_comm
theorem polar_add_left_iff {f : M → R} {x x' y : M} :
polar f (x + x') y = polar f x y + polar f x' y ↔
f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x) := by
simp only [← add_assoc]
simp only [polar, sub_eq_iff_eq_add, eq_sub_iff_add_eq, sub_add_eq_add_sub, add_sub]
simp only [add_right_comm _ (f y) _, add_right_comm _ (f x') (f x)]
rw [add_comm y x, add_right_comm _ _ (f (x + y)), add_comm _ (f (x + y)),
add_right_comm (f (x + y)), add_left_inj]
#align quadratic_form.polar_add_left_iff QuadraticForm.polar_add_left_iff
| Mathlib/LinearAlgebra/QuadraticForm/Basic.lean | 126 | 129 | theorem polar_comp {F : Type*} [CommRing S] [FunLike F R S] [AddMonoidHomClass F R S]
(f : M → R) (g : F) (x y : M) :
polar (g ∘ f) x y = g (polar f x y) := by |
simp only [polar, Pi.smul_apply, Function.comp_apply, map_sub]
| [
" polar (f + g) x y = polar f x y + polar g x y",
" f (x + y) + g (x + y) - (f x + g x) - (f y + g y) = f (x + y) - f x - f y + (g (x + y) - g x - g y)",
" polar (-f) x y = -polar f x y",
" polar (s • f) x y = s • polar f x y",
" polar f x y = polar f y x",
" polar f (x + x') y = polar f x y + polar f x' ... | [
" polar (f + g) x y = polar f x y + polar g x y",
" f (x + y) + g (x + y) - (f x + g x) - (f y + g y) = f (x + y) - f x - f y + (g (x + y) - g x - g y)",
" polar (-f) x y = -polar f x y",
" polar (s • f) x y = s • polar f x y",
" polar f x y = polar f y x",
" polar f (x + x') y = polar f x y + polar f x' ... |
import Mathlib.Algebra.Module.Submodule.Lattice
import Mathlib.Order.Hom.CompleteLattice
namespace Submodule
variable (S : Type*) {R M : Type*} [Semiring R] [AddCommMonoid M] [Semiring S]
[Module S M] [Module R M] [SMul S R] [IsScalarTower S R M]
def restrictScalars (V : Submodule R M) : Submodule S M where
carrier := V
zero_mem' := V.zero_mem
smul_mem' c _ h := V.smul_of_tower_mem c h
add_mem' hx hy := V.add_mem hx hy
#align submodule.restrict_scalars Submodule.restrictScalars
@[simp]
theorem coe_restrictScalars (V : Submodule R M) : (V.restrictScalars S : Set M) = V :=
rfl
#align submodule.coe_restrict_scalars Submodule.coe_restrictScalars
@[simp]
theorem toAddSubmonoid_restrictScalars (V : Submodule R M) :
(V.restrictScalars S).toAddSubmonoid = V.toAddSubmonoid :=
rfl
@[simp]
theorem restrictScalars_mem (V : Submodule R M) (m : M) : m ∈ V.restrictScalars S ↔ m ∈ V :=
Iff.refl _
#align submodule.restrict_scalars_mem Submodule.restrictScalars_mem
@[simp]
theorem restrictScalars_self (V : Submodule R M) : V.restrictScalars R = V :=
SetLike.coe_injective rfl
#align submodule.restrict_scalars_self Submodule.restrictScalars_self
variable (R M)
theorem restrictScalars_injective :
Function.Injective (restrictScalars S : Submodule R M → Submodule S M) := fun _ _ h =>
ext <| Set.ext_iff.1 (SetLike.ext'_iff.1 h : _)
#align submodule.restrict_scalars_injective Submodule.restrictScalars_injective
@[simp]
theorem restrictScalars_inj {V₁ V₂ : Submodule R M} :
restrictScalars S V₁ = restrictScalars S V₂ ↔ V₁ = V₂ :=
(restrictScalars_injective S _ _).eq_iff
#align submodule.restrict_scalars_inj Submodule.restrictScalars_inj
instance restrictScalars.origModule (p : Submodule R M) : Module R (p.restrictScalars S) :=
(by infer_instance : Module R p)
#align submodule.restrict_scalars.orig_module Submodule.restrictScalars.origModule
instance restrictScalars.isScalarTower (p : Submodule R M) :
IsScalarTower S R (p.restrictScalars S) where
smul_assoc r s x := Subtype.ext <| smul_assoc r s (x : M)
#align submodule.restrict_scalars.is_scalar_tower Submodule.restrictScalars.isScalarTower
@[simps]
def restrictScalarsEmbedding : Submodule R M ↪o Submodule S M where
toFun := restrictScalars S
inj' := restrictScalars_injective S R M
map_rel_iff' := by simp [SetLike.le_def]
#align submodule.restrict_scalars_embedding Submodule.restrictScalarsEmbedding
#align submodule.restrict_scalars_embedding_apply Submodule.restrictScalarsEmbedding_apply
@[simps (config := { simpRhs := true })]
def restrictScalarsEquiv (p : Submodule R M) : p.restrictScalars S ≃ₗ[R] p :=
{ AddEquiv.refl p with
map_smul' := fun _ _ => rfl }
#align submodule.restrict_scalars_equiv Submodule.restrictScalarsEquiv
#align submodule.restrict_scalars_equiv_symm_apply Submodule.restrictScalarsEquiv_symm_apply
@[simp]
theorem restrictScalars_bot : restrictScalars S (⊥ : Submodule R M) = ⊥ :=
rfl
#align submodule.restrict_scalars_bot Submodule.restrictScalars_bot
@[simp]
| Mathlib/Algebra/Module/Submodule/RestrictScalars.lean | 106 | 107 | theorem restrictScalars_eq_bot_iff {p : Submodule R M} : restrictScalars S p = ⊥ ↔ p = ⊥ := by |
simp [SetLike.ext_iff]
| [
" Module R ↥p",
" ∀ {a b : Submodule R M},\n { toFun := restrictScalars S, inj' := ⋯ } a ≤ { toFun := restrictScalars S, inj' := ⋯ } b ↔ a ≤ b",
" restrictScalars S p = ⊥ ↔ p = ⊥"
] | [
" Module R ↥p",
" ∀ {a b : Submodule R M},\n { toFun := restrictScalars S, inj' := ⋯ } a ≤ { toFun := restrictScalars S, inj' := ⋯ } b ↔ a ≤ b"
] |
import Batteries.Data.DList
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Cases
#align_import data.dlist from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd"
universe u
#align dlist Batteries.DList
namespace Batteries.DList
open Function
variable {α : Type u}
#align dlist.of_list Batteries.DList.ofList
def lazy_ofList (l : Thunk (List α)) : DList α :=
⟨fun xs => l.get ++ xs, fun t => by simp⟩
#align dlist.lazy_of_list Batteries.DList.lazy_ofList
#align dlist.to_list Batteries.DList.toList
#align dlist.empty Batteries.DList.empty
#align dlist.singleton Batteries.DList.singleton
attribute [local simp] Function.comp
#align dlist.cons Batteries.DList.cons
#align dlist.concat Batteries.DList.push
#align dlist.append Batteries.DList.append
attribute [local simp] ofList toList empty singleton cons push append
theorem toList_ofList (l : List α) : DList.toList (DList.ofList l) = l := by
cases l; rfl; simp only [DList.toList, DList.ofList, List.cons_append, List.append_nil]
#align dlist.to_list_of_list Batteries.DList.toList_ofList
theorem ofList_toList (l : DList α) : DList.ofList (DList.toList l) = l := by
cases' l with app inv
simp only [ofList, toList, mk.injEq]
funext x
rw [(inv x)]
#align dlist.of_list_to_list Batteries.DList.ofList_toList
theorem toList_empty : toList (@empty α) = [] := by simp
#align dlist.to_list_empty Batteries.DList.toList_empty
| Mathlib/Data/DList/Defs.lean | 72 | 72 | theorem toList_singleton (x : α) : toList (singleton x) = [x] := by | simp
| [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (head✝ :: tail✝)).toList = head✝ :: tail✝",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... | [
" (fun xs => l.get ++ xs) t = (fun xs => l.get ++ xs) [] ++ t",
" (ofList l).toList = l",
" (ofList (head✝ :: tail✝)).toList = head✝ :: tail✝",
" ofList l.toList = l",
" ofList { apply := app, invariant := inv }.toList = { apply := app, invariant := inv }",
" (fun x => app [] ++ x) = app",
" app [] ++ x... |
import Batteries.Data.List.Lemmas
import Batteries.Data.Array.Basic
import Batteries.Tactic.SeqFocus
import Batteries.Util.ProofWanted
namespace Array
| .lake/packages/batteries/Batteries/Data/Array/Lemmas.lean | 14 | 29 | theorem forIn_eq_data_forIn [Monad m]
(as : Array α) (b : β) (f : α → β → m (ForInStep β)) :
forIn as b f = forIn as.data b f := by |
let rec loop : ∀ {i h b j}, j + i = as.size →
Array.forIn.loop as f i h b = forIn (as.data.drop j) b f
| 0, _, _, _, rfl => by rw [List.drop_length]; rfl
| i+1, _, _, j, ij => by
simp only [forIn.loop, Nat.add]
have j_eq : j = size as - 1 - i := by simp [← ij, ← Nat.add_assoc]
have : as.size - 1 - i < as.size := j_eq ▸ ij ▸ Nat.lt_succ_of_le (Nat.le_add_right ..)
have : as[size as - 1 - i] :: as.data.drop (j + 1) = as.data.drop j := by
rw [j_eq]; exact List.get_cons_drop _ ⟨_, this⟩
simp only [← this, List.forIn_cons]; congr; funext x; congr; funext b
rw [loop (i := i)]; rw [← ij, Nat.succ_add]; rfl
conv => lhs; simp only [forIn, Array.forIn]
rw [loop (Nat.zero_add _)]; rfl
| [
" forIn as b f = forIn as.data b f",
" forIn.loop as f 0 x✝¹ x✝ = forIn (List.drop as.data.length as.data) x✝ f",
" forIn.loop as f 0 x✝¹ x✝ = forIn [] x✝ f",
" forIn.loop as f (i + 1) x✝¹ x✝ = forIn (List.drop j as.data) x✝ f",
" (do\n let __do_lift ← f as[as.size - 1 - i] x✝\n match __do_lift wi... | [] |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_right_add_right Nat.gcd_mul_right_add_right
@[simp]
theorem gcd_mul_left_add_right (m n k : ℕ) : gcd m (m * k + n) = gcd m n := by simp [add_comm _ n]
#align nat.gcd_mul_left_add_right Nat.gcd_mul_left_add_right
@[simp]
theorem gcd_add_mul_right_left (m n k : ℕ) : gcd (m + k * n) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_right_right, gcd_comm]
#align nat.gcd_add_mul_right_left Nat.gcd_add_mul_right_left
@[simp]
theorem gcd_add_mul_left_left (m n k : ℕ) : gcd (m + n * k) n = gcd m n := by
rw [gcd_comm, gcd_add_mul_left_right, gcd_comm]
#align nat.gcd_add_mul_left_left Nat.gcd_add_mul_left_left
@[simp]
theorem gcd_mul_right_add_left (m n k : ℕ) : gcd (k * n + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_right_add_right, gcd_comm]
#align nat.gcd_mul_right_add_left Nat.gcd_mul_right_add_left
@[simp]
theorem gcd_mul_left_add_left (m n k : ℕ) : gcd (n * k + m) n = gcd m n := by
rw [gcd_comm, gcd_mul_left_add_right, gcd_comm]
#align nat.gcd_mul_left_add_left Nat.gcd_mul_left_add_left
@[simp]
theorem gcd_add_self_right (m n : ℕ) : gcd m (n + m) = gcd m n :=
Eq.trans (by rw [one_mul]) (gcd_add_mul_right_right m n 1)
#align nat.gcd_add_self_right Nat.gcd_add_self_right
@[simp]
theorem gcd_add_self_left (m n : ℕ) : gcd (m + n) n = gcd m n := by
rw [gcd_comm, gcd_add_self_right, gcd_comm]
#align nat.gcd_add_self_left Nat.gcd_add_self_left
@[simp]
theorem gcd_self_add_left (m n : ℕ) : gcd (m + n) m = gcd n m := by rw [add_comm, gcd_add_self_left]
#align nat.gcd_self_add_left Nat.gcd_self_add_left
@[simp]
theorem gcd_self_add_right (m n : ℕ) : gcd m (m + n) = gcd m n := by
rw [add_comm, gcd_add_self_right]
#align nat.gcd_self_add_right Nat.gcd_self_add_right
@[simp]
theorem gcd_sub_self_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) m = gcd n m := by
calc
gcd (n - m) m = gcd (n - m + m) m := by rw [← gcd_add_self_left (n - m) m]
_ = gcd n m := by rw [Nat.sub_add_cancel h]
@[simp]
theorem gcd_sub_self_right {m n : ℕ} (h : m ≤ n) : gcd m (n - m) = gcd m n := by
rw [gcd_comm, gcd_sub_self_left h, gcd_comm]
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 106 | 112 | theorem gcd_self_sub_left {m n : ℕ} (h : m ≤ n) : gcd (n - m) n = gcd m n := by |
have := Nat.sub_add_cancel h
rw [gcd_comm m n, ← this, gcd_add_self_left (n - m) m]
have : gcd (n - m) n = gcd (n - m) m := by
nth_rw 2 [← Nat.add_sub_cancel' h]
rw [gcd_add_self_right, gcd_comm]
convert this
| [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n",
" (m + k * n).gcd n = m.gcd n",
" (m + n * k).gcd n = m.gcd n",
" (k * n + m).gcd n = m.gcd n",
" (n * k + m).gcd n = m.gcd n",
" m.gcd (n + m) = m.gcd (n + 1 * m)",
" (m... | [
" m.gcd (n + k * m) = m.gcd n",
" m.gcd (n + m * k) = m.gcd n",
" m.gcd (k * m + n) = m.gcd n",
" m.gcd (m * k + n) = m.gcd n",
" (m + k * n).gcd n = m.gcd n",
" (m + n * k).gcd n = m.gcd n",
" (k * n + m).gcd n = m.gcd n",
" (n * k + m).gcd n = m.gcd n",
" m.gcd (n + m) = m.gcd (n + 1 * m)",
" (m... |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.LinearAlgebra.Dual
import Mathlib.LinearAlgebra.Contraction
import Mathlib.RingTheory.TensorProduct.Basic
#align_import representation_theory.basic from "leanprover-community/mathlib"@"c04bc6e93e23aa0182aba53661a2211e80b6feac"
open MonoidAlgebra (lift of)
open LinearMap
section
variable (k G V : Type*) [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V]
abbrev Representation :=
G →* V →ₗ[k] V
#align representation Representation
end
namespace Representation
section MonoidAlgebra
variable {k G V : Type*} [CommSemiring k] [Monoid G] [AddCommMonoid V] [Module k V]
variable (ρ : Representation k G V)
noncomputable def asAlgebraHom : MonoidAlgebra k G →ₐ[k] Module.End k V :=
(lift k G _) ρ
#align representation.as_algebra_hom Representation.asAlgebraHom
theorem asAlgebraHom_def : asAlgebraHom ρ = (lift k G _) ρ :=
rfl
#align representation.as_algebra_hom_def Representation.asAlgebraHom_def
@[simp]
theorem asAlgebraHom_single (g : G) (r : k) : asAlgebraHom ρ (Finsupp.single g r) = r • ρ g := by
simp only [asAlgebraHom_def, MonoidAlgebra.lift_single]
#align representation.as_algebra_hom_single Representation.asAlgebraHom_single
theorem asAlgebraHom_single_one (g : G) : asAlgebraHom ρ (Finsupp.single g 1) = ρ g := by simp
#align representation.as_algebra_hom_single_one Representation.asAlgebraHom_single_one
theorem asAlgebraHom_of (g : G) : asAlgebraHom ρ (of k G g) = ρ g := by
simp only [MonoidAlgebra.of_apply, asAlgebraHom_single, one_smul]
#align representation.as_algebra_hom_of Representation.asAlgebraHom_of
@[nolint unusedArguments]
def asModule (_ : Representation k G V) :=
V
#align representation.as_module Representation.asModule
-- Porting note: no derive handler
instance : AddCommMonoid (ρ.asModule) := inferInstanceAs <| AddCommMonoid V
instance : Inhabited ρ.asModule where
default := 0
noncomputable instance asModuleModule : Module (MonoidAlgebra k G) ρ.asModule :=
Module.compHom V (asAlgebraHom ρ).toRingHom
#align representation.as_module_module Representation.asModuleModule
-- Porting note: ρ.asModule doesn't unfold now
instance : Module k ρ.asModule := inferInstanceAs <| Module k V
def asModuleEquiv : ρ.asModule ≃+ V :=
AddEquiv.refl _
#align representation.as_module_equiv Representation.asModuleEquiv
@[simp]
theorem asModuleEquiv_map_smul (r : MonoidAlgebra k G) (x : ρ.asModule) :
ρ.asModuleEquiv (r • x) = ρ.asAlgebraHom r (ρ.asModuleEquiv x) :=
rfl
#align representation.as_module_equiv_map_smul Representation.asModuleEquiv_map_smul
@[simp]
| Mathlib/RepresentationTheory/Basic.lean | 159 | 162 | theorem asModuleEquiv_symm_map_smul (r : k) (x : V) :
ρ.asModuleEquiv.symm (r • x) = algebraMap k (MonoidAlgebra k G) r • ρ.asModuleEquiv.symm x := by |
apply_fun ρ.asModuleEquiv
simp
| [
" ρ.asAlgebraHom (Finsupp.single g r) = r • ρ g",
" ρ.asAlgebraHom (Finsupp.single g 1) = ρ g",
" ρ.asAlgebraHom ((of k G) g) = ρ g",
" ρ.asModuleEquiv.symm (r • x) = (algebraMap k (MonoidAlgebra k G)) r • ρ.asModuleEquiv.symm x",
" ρ.asModuleEquiv (ρ.asModuleEquiv.symm (r • x)) =\n ρ.asModuleEquiv ((alg... | [
" ρ.asAlgebraHom (Finsupp.single g r) = r • ρ g",
" ρ.asAlgebraHom (Finsupp.single g 1) = ρ g",
" ρ.asAlgebraHom ((of k G) g) = ρ g"
] |
import Mathlib.Data.List.Forall2
#align_import data.list.sections from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
open Nat Function
namespace List
variable {α β : Type*}
| Mathlib/Data/List/Sections.lean | 23 | 34 | theorem mem_sections {L : List (List α)} {f} : f ∈ sections L ↔ Forall₂ (· ∈ ·) f L := by |
refine ⟨fun h => ?_, fun h => ?_⟩
· induction L generalizing f
· cases mem_singleton.1 h
exact Forall₂.nil
simp only [sections, bind_eq_bind, mem_bind, mem_map] at h
rcases h with ⟨_, _, _, _, rfl⟩
simp only [*, forall₂_cons, true_and_iff]
· induction' h with a l f L al fL fs
· simp only [sections, mem_singleton]
simp only [sections, bind_eq_bind, mem_bind, mem_map]
exact ⟨f, fs, a, al, rfl⟩
| [
" f ∈ L.sections ↔ Forall₂ (fun x x_1 => x ∈ x_1) f L",
" Forall₂ (fun x x_1 => x ∈ x_1) f L",
" Forall₂ (fun x x_1 => x ∈ x_1) f []",
" Forall₂ (fun x x_1 => x ∈ x_1) [] []",
" Forall₂ (fun x x_1 => x ∈ x_1) f (head✝ :: tail✝)",
" Forall₂ (fun x x_1 => x ∈ x_1) (w✝ :: w✝¹) (head✝ :: tail✝)",
" f ∈ L.se... | [] |
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
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]
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_eq SimpleGraph.IsSRGWith.card_neighborFinset_union_eq
theorem IsSRGWith.card_neighborFinset_union_of_not_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(hne : v ≠ w) (ha : ¬G.Adj v w) :
(G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - μ := by
rw [← h.of_not_adj hne ha]
apply h.card_neighborFinset_union_eq
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_of_not_adj SimpleGraph.IsSRGWith.card_neighborFinset_union_of_not_adj
theorem IsSRGWith.card_neighborFinset_union_of_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(ha : G.Adj v w) : (G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - ℓ := by
rw [← h.of_adj v w ha]
apply h.card_neighborFinset_union_eq
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_of_adj SimpleGraph.IsSRGWith.card_neighborFinset_union_of_adj
theorem compl_neighborFinset_sdiff_inter_eq {v w : V} :
(G.neighborFinset v)ᶜ \ {v} ∩ ((G.neighborFinset w)ᶜ \ {w}) =
((G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ) \ ({w} ∪ {v}) := by
ext
rw [← not_iff_not]
simp [imp_iff_not_or, or_assoc, or_comm, or_left_comm]
#align simple_graph.compl_neighbor_finset_sdiff_inter_eq SimpleGraph.compl_neighborFinset_sdiff_inter_eq
theorem sdiff_compl_neighborFinset_inter_eq {v w : V} (h : G.Adj v w) :
((G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ) \ ({w} ∪ {v}) =
(G.neighborFinset v)ᶜ ∩ (G.neighborFinset w)ᶜ := by
ext
simp only [and_imp, mem_union, mem_sdiff, mem_compl, and_iff_left_iff_imp, mem_neighborFinset,
mem_inter, mem_singleton]
rintro hnv hnw (rfl | rfl)
· exact hnv h
· apply hnw
rwa [adj_comm]
#align simple_graph.sdiff_compl_neighbor_finset_inter_eq SimpleGraph.sdiff_compl_neighborFinset_inter_eq
| Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean | 137 | 140 | theorem IsSRGWith.compl_is_regular (h : G.IsSRGWith n k ℓ μ) :
Gᶜ.IsRegularOfDegree (n - k - 1) := by |
rw [← h.card, Nat.sub_sub, add_comm, ← Nat.sub_sub]
exact h.regular.compl
| [
" (fun v w => ¬⊥.Adj v w → Fintype.card ↑(⊥.commonNeighbors v w) = 0) v w",
" filter (fun x => x ∈ ⊥.commonNeighbors v w) univ = ∅",
" a✝ ∈ filter (fun x => x ∈ ⊥.commonNeighbors v w) univ ↔ a✝ ∈ ∅",
" Fintype.card ↑(⊤.commonNeighbors v w) = Fintype.card V - 2",
" v ≠ w",
" (G.neighborFinset v ∪ G.neighbo... | [
" (fun v w => ¬⊥.Adj v w → Fintype.card ↑(⊥.commonNeighbors v w) = 0) v w",
" filter (fun x => x ∈ ⊥.commonNeighbors v w) univ = ∅",
" a✝ ∈ filter (fun x => x ∈ ⊥.commonNeighbors v w) univ ↔ a✝ ∈ ∅",
" Fintype.card ↑(⊤.commonNeighbors v w) = Fintype.card V - 2",
" v ≠ w",
" (G.neighborFinset v ∪ G.neighbo... |
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.NaturalTransformation
import Mathlib.CategoryTheory.Monoidal.Opposite
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.CommSq
#align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44"
open CategoryTheory MonoidalCategory
universe v v₁ v₂ v₃ u u₁ u₂ u₃
namespace CategoryTheory
class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where
braiding : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X
braiding_naturality_right :
∀ (X : C) {Y Z : C} (f : Y ⟶ Z),
X ◁ f ≫ (braiding X Z).hom = (braiding X Y).hom ≫ f ▷ X := by
aesop_cat
braiding_naturality_left :
∀ {X Y : C} (f : X ⟶ Y) (Z : C),
f ▷ Z ≫ (braiding Y Z).hom = (braiding X Z).hom ≫ Z ◁ f := by
aesop_cat
hexagon_forward :
∀ X Y Z : C,
(α_ X Y Z).hom ≫ (braiding X (Y ⊗ Z)).hom ≫ (α_ Y Z X).hom =
((braiding X Y).hom ▷ Z) ≫ (α_ Y X Z).hom ≫ (Y ◁ (braiding X Z).hom) := by
aesop_cat
hexagon_reverse :
∀ X Y Z : C,
(α_ X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (α_ Z X Y).inv =
(X ◁ (braiding Y Z).hom) ≫ (α_ X Z Y).inv ≫ ((braiding X Z).hom ▷ Y) := by
aesop_cat
#align category_theory.braided_category CategoryTheory.BraidedCategory
attribute [reassoc (attr := simp)]
BraidedCategory.braiding_naturality_left
BraidedCategory.braiding_naturality_right
attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse
open Category
open MonoidalCategory
open BraidedCategory
@[inherit_doc]
notation "β_" => BraidedCategory.braiding
namespace BraidedCategory
variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C] [BraidedCategory.{v} C]
@[simp, reassoc]
theorem braiding_tensor_left (X Y Z : C) :
(β_ (X ⊗ Y) Z).hom =
(α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫
(β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom := by
apply (cancel_epi (α_ X Y Z).inv).1
apply (cancel_mono (α_ Z X Y).inv).1
simp [hexagon_reverse]
@[simp, reassoc]
theorem braiding_tensor_right (X Y Z : C) :
(β_ X (Y ⊗ Z)).hom =
(α_ X Y Z).inv ≫ (β_ X Y).hom ▷ Z ≫ (α_ Y X Z).hom ≫
Y ◁ (β_ X Z).hom ≫ (α_ Y Z X).inv := by
apply (cancel_epi (α_ X Y Z).hom).1
apply (cancel_mono (α_ Y Z X).hom).1
simp [hexagon_forward]
@[simp, reassoc]
theorem braiding_inv_tensor_left (X Y Z : C) :
(β_ (X ⊗ Y) Z).inv =
(α_ Z X Y).inv ≫ (β_ X Z).inv ▷ Y ≫ (α_ X Z Y).hom ≫
X ◁ (β_ Y Z).inv ≫ (α_ X Y Z).inv :=
eq_of_inv_eq_inv (by simp)
@[simp, reassoc]
theorem braiding_inv_tensor_right (X Y Z : C) :
(β_ X (Y ⊗ Z)).inv =
(α_ Y Z X).hom ≫ Y ◁ (β_ X Z).inv ≫ (α_ Y X Z).inv ≫
(β_ X Y).inv ▷ Z ≫ (α_ X Y Z).hom :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean | 125 | 128 | theorem braiding_naturality {X X' Y Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
(f ⊗ g) ≫ (braiding Y Y').hom = (braiding X X').hom ≫ (g ⊗ f) := by |
rw [tensorHom_def' f g, tensorHom_def g f]
simp_rw [Category.assoc, braiding_naturality_left, braiding_naturality_right_assoc]
| [
" (β_ (X ⊗ Y) Z).hom = (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom",
" (α_ X Y Z).inv ≫ (β_ (X ⊗ Y) Z).hom =\n (α_ X Y Z).inv ≫ (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom",
" ((α_ X Y Z).inv ≫ (β_ (X ⊗ Y) Z).hom) ≫ (α_ Z X... | [
" (β_ (X ⊗ Y) Z).hom = (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom",
" (α_ X Y Z).inv ≫ (β_ (X ⊗ Y) Z).hom =\n (α_ X Y Z).inv ≫ (α_ X Y Z).hom ≫ X ◁ (β_ Y Z).hom ≫ (α_ X Z Y).inv ≫ (β_ X Z).hom ▷ Y ≫ (α_ Z X Y).hom",
" ((α_ X Y Z).inv ≫ (β_ (X ⊗ Y) Z).hom) ≫ (α_ Z X... |
import Mathlib.Algebra.Algebra.Pi
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.RingTheory.Adjoin.Basic
#align_import data.polynomial.algebra_map from "leanprover-community/mathlib"@"e064a7bf82ad94c3c17b5128bbd860d1ec34874e"
noncomputable section
open Finset
open Polynomial
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {A : Type z} {A' B : Type*} {a b : R} {n : ℕ}
section CommSemiring
variable [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]
variable {p q r : R[X]}
instance algebraOfAlgebra : Algebra R A[X] where
smul_def' r p :=
toFinsupp_injective <| by
dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]
rw [toFinsupp_smul, toFinsupp_mul, toFinsupp_C]
exact Algebra.smul_def' _ _
commutes' r p :=
toFinsupp_injective <| by
dsimp only [RingHom.toFun_eq_coe, RingHom.comp_apply]
simp_rw [toFinsupp_mul, toFinsupp_C]
convert Algebra.commutes' r p.toFinsupp
toRingHom := C.comp (algebraMap R A)
#align polynomial.algebra_of_algebra Polynomial.algebraOfAlgebra
@[simp]
theorem algebraMap_apply (r : R) : algebraMap R A[X] r = C (algebraMap R A r) :=
rfl
#align polynomial.algebra_map_apply Polynomial.algebraMap_apply
@[simp]
theorem toFinsupp_algebraMap (r : R) : (algebraMap R A[X] r).toFinsupp = algebraMap R _ r :=
show toFinsupp (C (algebraMap _ _ r)) = _ by
rw [toFinsupp_C]
rfl
#align polynomial.to_finsupp_algebra_map Polynomial.toFinsupp_algebraMap
theorem ofFinsupp_algebraMap (r : R) : (⟨algebraMap R _ r⟩ : A[X]) = algebraMap R A[X] r :=
toFinsupp_injective (toFinsupp_algebraMap _).symm
#align polynomial.of_finsupp_algebra_map Polynomial.ofFinsupp_algebraMap
theorem C_eq_algebraMap (r : R) : C r = algebraMap R R[X] r :=
rfl
set_option linter.uppercaseLean3 false in
#align polynomial.C_eq_algebra_map Polynomial.C_eq_algebraMap
@[simp]
theorem algebraMap_eq : algebraMap R R[X] = C :=
rfl
@[simps! apply]
def CAlgHom : A →ₐ[R] A[X] where
toRingHom := C
commutes' _ := rfl
@[ext 1100]
theorem algHom_ext' {f g : A[X] →ₐ[R] B}
(hC : f.comp CAlgHom = g.comp CAlgHom)
(hX : f X = g X) : f = g :=
AlgHom.coe_ringHom_injective (ringHom_ext' (congr_arg AlgHom.toRingHom hC) hX)
#align polynomial.alg_hom_ext' Polynomial.algHom_ext'
variable (R)
open AddMonoidAlgebra in
@[simps!]
def toFinsuppIsoAlg : R[X] ≃ₐ[R] R[ℕ] :=
{ toFinsuppIso R with
commutes' := fun r => by
dsimp }
#align polynomial.to_finsupp_iso_alg Polynomial.toFinsuppIsoAlg
variable {R}
instance subalgebraNontrivial [Nontrivial A] : Nontrivial (Subalgebra R A[X]) :=
⟨⟨⊥, ⊤, by
rw [Ne, SetLike.ext_iff, not_forall]
refine ⟨X, ?_⟩
simp only [Algebra.mem_bot, not_exists, Set.mem_range, iff_true_iff, Algebra.mem_top,
algebraMap_apply, not_forall]
intro x
rw [ext_iff, not_forall]
refine ⟨1, ?_⟩
simp [coeff_C]⟩⟩
@[simp]
theorem algHom_eval₂_algebraMap {R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B]
[Algebra R A] [Algebra R B] (p : R[X]) (f : A →ₐ[R] B) (a : A) :
f (eval₂ (algebraMap R A) a p) = eval₂ (algebraMap R B) (f a) p := by
simp only [eval₂_eq_sum, sum_def]
simp only [f.map_sum, f.map_mul, f.map_pow, eq_intCast, map_intCast, AlgHom.commutes]
#align polynomial.alg_hom_eval₂_algebra_map Polynomial.algHom_eval₂_algebraMap
@[simp]
| Mathlib/Algebra/Polynomial/AlgebraMap.lean | 131 | 136 | theorem eval₂_algebraMap_X {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (p : R[X])
(f : R[X] →ₐ[R] A) : eval₂ (algebraMap R A) (f X) p = f p := by |
conv_rhs => rw [← Polynomial.sum_C_mul_X_pow_eq p]
simp only [eval₂_eq_sum, sum_def]
simp only [f.map_sum, f.map_mul, f.map_pow, eq_intCast, map_intCast]
simp [Polynomial.C_eq_algebraMap]
| [
" ((C.comp (algebraMap R A)) r * p).toFinsupp = (p * (C.comp (algebraMap R A)) r).toFinsupp",
" (C ((algebraMap R A) r) * p).toFinsupp = (p * C ((algebraMap R A) r)).toFinsupp",
" AddMonoidAlgebra.single 0 ((algebraMap R A) r) * p.toFinsupp =\n p.toFinsupp * AddMonoidAlgebra.single 0 ((algebraMap R A) r)",
... | [
" ((C.comp (algebraMap R A)) r * p).toFinsupp = (p * (C.comp (algebraMap R A)) r).toFinsupp",
" (C ((algebraMap R A) r) * p).toFinsupp = (p * C ((algebraMap R A) r)).toFinsupp",
" AddMonoidAlgebra.single 0 ((algebraMap R A) r) * p.toFinsupp =\n p.toFinsupp * AddMonoidAlgebra.single 0 ((algebraMap R A) r)",
... |
import Mathlib.Data.Fin.Tuple.Sort
import Mathlib.Order.WellFounded
#align_import data.fin.tuple.bubble_sort_induction from "leanprover-community/mathlib"@"bf2428c9486c407ca38b5b3fb10b87dad0bc99fa"
namespace Tuple
| Mathlib/Data/Fin/Tuple/BubbleSortInduction.lean | 34 | 44 | theorem bubble_sort_induction' {n : ℕ} {α : Type*} [LinearOrder α] {f : Fin n → α}
{P : (Fin n → α) → Prop} (hf : P f)
(h : ∀ (σ : Equiv.Perm (Fin n)) (i j : Fin n),
i < j → (f ∘ σ) j < (f ∘ σ) i → P (f ∘ σ) → P (f ∘ σ ∘ Equiv.swap i j)) :
P (f ∘ sort f) := by |
letI := @Preorder.lift _ (Lex (Fin n → α)) _ fun σ : Equiv.Perm (Fin n) => toLex (f ∘ σ)
refine
@WellFounded.induction_bot' _ _ _ (IsWellFounded.wf : WellFounded (· < ·))
(Equiv.refl _) (sort f) P (fun σ => f ∘ σ) (fun σ hσ hfσ => ?_) hf
obtain ⟨i, j, hij₁, hij₂⟩ := antitone_pair_of_not_sorted' hσ
exact ⟨σ * Equiv.swap i j, Pi.lex_desc hij₁.le hij₂, h σ i j hij₁ hij₂ hfσ⟩
| [
" P (f ∘ ⇑(sort f))",
" ∃ c < σ, P ((fun σ => f ∘ ⇑σ) c)"
] | [] |
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
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
#align topological_space.noetherian_space_tfae TopologicalSpace.noetherianSpace_TFAE
variable {α}
theorem noetherianSpace_iff_isCompact : NoetherianSpace α ↔ ∀ s : Set α, IsCompact s :=
(noetherianSpace_TFAE α).out 0 2
theorem NoetherianSpace.wellFounded_closeds [NoetherianSpace α] :
WellFounded fun s t : Closeds α => s < t :=
Iff.mp ((noetherianSpace_TFAE α).out 0 1) ‹_›
instance {α} : NoetherianSpace (CofiniteTopology α) := by
simp only [noetherianSpace_iff_isCompact, isCompact_iff_ultrafilter_le_nhds,
CofiniteTopology.nhds_eq, Ultrafilter.le_sup_iff, Filter.le_principal_iff]
intro s f hs
rcases f.le_cofinite_or_eq_pure with (hf | ⟨a, rfl⟩)
· rcases Filter.nonempty_of_mem hs with ⟨a, ha⟩
exact ⟨a, ha, Or.inr hf⟩
· exact ⟨a, hs, Or.inl le_rfl⟩
theorem noetherianSpace_of_surjective [NoetherianSpace α] (f : α → β) (hf : Continuous f)
(hf' : Function.Surjective f) : NoetherianSpace β :=
noetherianSpace_iff_isCompact.2 <| (Set.image_surjective.mpr hf').forall.2 fun s =>
(NoetherianSpace.isCompact s).image hf
#align topological_space.noetherian_space_of_surjective TopologicalSpace.noetherianSpace_of_surjective
theorem noetherianSpace_iff_of_homeomorph (f : α ≃ₜ β) : NoetherianSpace α ↔ NoetherianSpace β :=
⟨fun _ => noetherianSpace_of_surjective f f.continuous f.surjective,
fun _ => noetherianSpace_of_surjective f.symm f.symm.continuous f.symm.surjective⟩
#align topological_space.noetherian_space_iff_of_homeomorph TopologicalSpace.noetherianSpace_iff_of_homeomorph
theorem NoetherianSpace.range [NoetherianSpace α] (f : α → β) (hf : Continuous f) :
NoetherianSpace (Set.range f) :=
noetherianSpace_of_surjective (Set.rangeFactorization f) (hf.subtype_mk _)
Set.surjective_onto_range
#align topological_space.noetherian_space.range TopologicalSpace.NoetherianSpace.range
| Mathlib/Topology/NoetherianSpace.lean | 139 | 142 | theorem noetherianSpace_set_iff (s : Set α) :
NoetherianSpace s ↔ ∀ t, t ⊆ s → IsCompact t := by |
simp only [noetherianSpace_iff_isCompact, embedding_subtype_val.isCompact_iff,
Subtype.forall_set_subtype]
| [
" NoetherianSpace α ↔ ∀ (s : Opens α), IsCompact ↑s",
" (∀ (k : Opens α), CompleteLattice.IsCompactElement k) ↔ ∀ (s : Opens α), IsCompact ↑s",
" IsCompact s",
" ∃ t, s ⊆ ⋃ i ∈ t, U i",
" [NoetherianSpace α, WellFounded fun s t => s < t, ∀ (s : Set α), IsCompact s, ∀ (s : Opens α), IsCompact ↑s].TFAE",
" ... | [
" NoetherianSpace α ↔ ∀ (s : Opens α), IsCompact ↑s",
" (∀ (k : Opens α), CompleteLattice.IsCompactElement k) ↔ ∀ (s : Opens α), IsCompact ↑s",
" IsCompact s",
" ∃ t, s ⊆ ⋃ i ∈ t, U i",
" [NoetherianSpace α, WellFounded fun s t => s < t, ∀ (s : Set α), IsCompact s, ∀ (s : Opens α), IsCompact ↑s].TFAE",
" ... |
import Mathlib.Dynamics.Ergodic.MeasurePreserving
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Transvection
import Mathlib.MeasureTheory.Group.LIntegral
import Mathlib.MeasureTheory.Integral.Marginal
import Mathlib.MeasureTheory.Measure.Stieltjes
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
assert_not_exists MeasureTheory.integral
noncomputable section
open scoped Classical
open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
open ENNReal (ofReal)
open scoped ENNReal NNReal Topology
namespace Real
variable {ι : Type*} [Fintype ι]
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
⟨fun a =>
Eq.symm <|
Real.measure_ext_Ioo_rat fun p q => by
simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩
have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by
change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1
rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;>
simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero,
StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
conv_rhs =>
rw [addHaarMeasure_unique StieltjesFunction.id.measure
(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A]
simp only [volume, Basis.addHaar, one_smul]
#align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id
| Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean | 75 | 76 | theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by |
simp [volume_eq_stieltjes_id]
| [
" volume = StieltjesFunction.id.measure",
" StieltjesFunction.id.measure (Ioo ↑p ↑q) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo ↑p ↑q)",
" StieltjesFunction.id.measure ↑(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1",
" StieltjesFunction.id.measure (parallelepiped ⇑(stdOrthonorma... | [
" volume = StieltjesFunction.id.measure",
" StieltjesFunction.id.measure (Ioo ↑p ↑q) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo ↑p ↑q)",
" StieltjesFunction.id.measure ↑(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1",
" StieltjesFunction.id.measure (parallelepiped ⇑(stdOrthonorma... |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.TensorProduct.Tower
import Mathlib.RingTheory.Adjoin.Basic
import Mathlib.LinearAlgebra.DirectSum.Finsupp
#align_import ring_theory.tensor_product from "leanprover-community/mathlib"@"88fcdc3da43943f5b01925deddaa5bf0c0e85e4e"
suppress_compilation
open scoped TensorProduct
open TensorProduct
namespace LinearMap
open TensorProduct
section Semiring
variable {R A B M N P : Type*} [CommSemiring R]
variable [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P]
variable [Module R M] [Module R N] [Module R P]
variable (r : R) (f g : M →ₗ[R] N)
variable (A)
def baseChange (f : M →ₗ[R] N) : A ⊗[R] M →ₗ[A] A ⊗[R] N :=
AlgebraTensorModule.map (LinearMap.id : A →ₗ[A] A) f
#align linear_map.base_change LinearMap.baseChange
variable {A}
@[simp]
theorem baseChange_tmul (a : A) (x : M) : f.baseChange A (a ⊗ₜ x) = a ⊗ₜ f x :=
rfl
#align linear_map.base_change_tmul LinearMap.baseChange_tmul
theorem baseChange_eq_ltensor : (f.baseChange A : A ⊗ M → A ⊗ N) = f.lTensor A :=
rfl
#align linear_map.base_change_eq_ltensor LinearMap.baseChange_eq_ltensor
@[simp]
theorem baseChange_add : (f + g).baseChange A = f.baseChange A + g.baseChange A := by
ext
-- Porting note: added `-baseChange_tmul`
simp [baseChange_eq_ltensor, -baseChange_tmul]
#align linear_map.base_change_add LinearMap.baseChange_add
@[simp]
| Mathlib/RingTheory/TensorProduct/Basic.lean | 90 | 92 | theorem baseChange_zero : baseChange A (0 : M →ₗ[R] N) = 0 := by |
ext
simp [baseChange_eq_ltensor]
| [
" baseChange A (f + g) = baseChange A f + baseChange A g",
" ((AlgebraTensorModule.curry (baseChange A (f + g))) 1) x✝ =\n ((AlgebraTensorModule.curry (baseChange A f + baseChange A g)) 1) x✝",
" baseChange A 0 = 0",
" ((AlgebraTensorModule.curry (baseChange A 0)) 1) x✝ = ((AlgebraTensorModule.curry 0) 1) ... | [
" baseChange A (f + g) = baseChange A f + baseChange A g",
" ((AlgebraTensorModule.curry (baseChange A (f + g))) 1) x✝ =\n ((AlgebraTensorModule.curry (baseChange A f + baseChange A g)) 1) x✝"
] |
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Logic.Encodable.Lattice
noncomputable section
open Filter Finset Function Encodable
open scoped Topology
variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M}
variable {G : Type*} [CommGroup G] {g g' : G}
-- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead
section Nat
section Monoid
namespace HasProd
@[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge
to `m`."]
theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) :=
h.comp tendsto_finset_range
#align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat
@[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge
to `∑' i, f i`."]
theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) :=
tendsto_prod_nat h.hasProd
section tprod
variable [T2Space M] {α β γ : Type*}
section Encodable
variable [Encodable β]
@[to_additive "You can compute a sum over an encodable type by summing over the natural numbers and
taking a supremum. This is useful for outer measures."]
| Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean | 124 | 132 | theorem tprod_iSup_decode₂ [CompleteLattice α] (m : α → M) (m0 : m ⊥ = 1) (s : β → α) :
∏' i : ℕ, m (⨆ b ∈ decode₂ β i, s b) = ∏' b : β, m (s b) := by |
rw [← tprod_extend_one (@encode_injective β _)]
refine tprod_congr fun n ↦ ?_
rcases em (n ∈ Set.range (encode : β → ℕ)) with ⟨a, rfl⟩ | hn
· simp [encode_injective.extend_apply]
· rw [extend_apply' _ _ _ hn]
rw [← decode₂_ne_none_iff, ne_eq, not_not] at hn
simp [hn, m0]
| [
" ∏' (i : ℕ), m (⨆ b ∈ decode₂ β i, s b) = ∏' (b : β), m (s b)",
" ∏' (i : ℕ), m (⨆ b ∈ decode₂ β i, s b) = ∏' (y : ℕ), extend encode (fun b => m (s b)) 1 y",
" m (⨆ b ∈ decode₂ β n, s b) = extend encode (fun b => m (s b)) 1 n",
" m (⨆ b ∈ decode₂ β (encode a), s b) = extend encode (fun b => m (s b)) 1 (encod... | [] |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.schur_complement from "leanprover-community/mathlib"@"a176cb1219e300e85793d44583dede42377b51af"
variable {l m n α : Type*}
namespace Matrix
open scoped Matrix
section CommRing
variable [Fintype l] [Fintype m] [Fintype n]
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [CommRing α]
theorem fromBlocks_eq_of_invertible₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α)
(D : Matrix l n α) [Invertible A] :
fromBlocks A B C D =
fromBlocks 1 0 (C * ⅟ A) 1 * fromBlocks A 0 0 (D - C * ⅟ A * B) *
fromBlocks 1 (⅟ A * B) 0 1 := by
simp only [fromBlocks_multiply, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add,
Matrix.one_mul, Matrix.mul_one, invOf_mul_self, Matrix.mul_invOf_self_assoc,
Matrix.mul_invOf_mul_self_cancel, Matrix.mul_assoc, add_sub_cancel]
#align matrix.from_blocks_eq_of_invertible₁₁ Matrix.fromBlocks_eq_of_invertible₁₁
theorem fromBlocks_eq_of_invertible₂₂ (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
fromBlocks A B C D =
fromBlocks 1 (B * ⅟ D) 0 1 * fromBlocks (A - B * ⅟ D * C) 0 0 D *
fromBlocks 1 0 (⅟ D * C) 1 :=
(Matrix.reindex (Equiv.sumComm _ _) (Equiv.sumComm _ _)).injective <| by
simpa [reindex_apply, Equiv.sumComm_symm, ← submatrix_mul_equiv _ _ _ (Equiv.sumComm n m), ←
submatrix_mul_equiv _ _ _ (Equiv.sumComm n l), Equiv.sumComm_apply,
fromBlocks_submatrix_sum_swap_sum_swap] using fromBlocks_eq_of_invertible₁₁ D C B A
#align matrix.from_blocks_eq_of_invertible₂₂ Matrix.fromBlocks_eq_of_invertible₂₂
section Det
theorem det_fromBlocks₁₁ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible A] :
(Matrix.fromBlocks A B C D).det = det A * det (D - C * ⅟ A * B) := by
rw [fromBlocks_eq_of_invertible₁₁ (A := A), det_mul, det_mul, det_fromBlocks_zero₂₁,
det_fromBlocks_zero₂₁, det_fromBlocks_zero₁₂, det_one, det_one, one_mul, one_mul, mul_one]
#align matrix.det_from_blocks₁₁ Matrix.det_fromBlocks₁₁
@[simp]
theorem det_fromBlocks_one₁₁ (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) :
(Matrix.fromBlocks 1 B C D).det = det (D - C * B) := by
haveI : Invertible (1 : Matrix m m α) := invertibleOne
rw [det_fromBlocks₁₁, invOf_one, Matrix.mul_one, det_one, one_mul]
#align matrix.det_from_blocks_one₁₁ Matrix.det_fromBlocks_one₁₁
| Mathlib/LinearAlgebra/Matrix/SchurComplement.lean | 406 | 413 | theorem det_fromBlocks₂₂ (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
(D : Matrix n n α) [Invertible D] :
(Matrix.fromBlocks A B C D).det = det D * det (A - B * ⅟ D * C) := by |
have : fromBlocks A B C D =
(fromBlocks D C B A).submatrix (Equiv.sumComm _ _) (Equiv.sumComm _ _) := by
ext (i j)
cases i <;> cases j <;> rfl
rw [this, det_submatrix_equiv_self, det_fromBlocks₁₁]
| [
" A.fromBlocks B C D = fromBlocks 1 0 (C * ⅟A) 1 * A.fromBlocks 0 0 (D - C * ⅟A * B) * fromBlocks 1 (⅟A * B) 0 1",
" (reindex (Equiv.sumComm l n) (Equiv.sumComm m n)) (A.fromBlocks B C D) =\n (reindex (Equiv.sumComm l n) (Equiv.sumComm m n))\n (fromBlocks 1 (B * ⅟D) 0 1 * (A - B * ⅟D * C).fromBlocks 0 0 D... | [
" A.fromBlocks B C D = fromBlocks 1 0 (C * ⅟A) 1 * A.fromBlocks 0 0 (D - C * ⅟A * B) * fromBlocks 1 (⅟A * B) 0 1",
" (reindex (Equiv.sumComm l n) (Equiv.sumComm m n)) (A.fromBlocks B C D) =\n (reindex (Equiv.sumComm l n) (Equiv.sumComm m n))\n (fromBlocks 1 (B * ⅟D) 0 1 * (A - B * ⅟D * C).fromBlocks 0 0 D... |
import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Ring.Defs
#align_import algebra.euclidean_domain.defs from "leanprover-community/mathlib"@"ee7b9f9a9ac2a8d9f04ea39bbfe6b1a3be053b38"
universe u
class EuclideanDomain (R : Type u) extends CommRing R, Nontrivial R where
protected quotient : R → R → R
protected quotient_zero : ∀ a, quotient a 0 = 0
protected remainder : R → R → R
protected quotient_mul_add_remainder_eq : ∀ a b, b * quotient a b + remainder a b = a
protected r : R → R → Prop
r_wellFounded : WellFounded r
protected remainder_lt : ∀ (a) {b}, b ≠ 0 → r (remainder a b) b
mul_left_not_lt : ∀ (a) {b}, b ≠ 0 → ¬r (a * b) a
#align euclidean_domain EuclideanDomain
#align euclidean_domain.quotient EuclideanDomain.quotient
#align euclidean_domain.quotient_zero EuclideanDomain.quotient_zero
#align euclidean_domain.remainder EuclideanDomain.remainder
#align euclidean_domain.quotient_mul_add_remainder_eq EuclideanDomain.quotient_mul_add_remainder_eq
#align euclidean_domain.r EuclideanDomain.r
#align euclidean_domain.r_well_founded EuclideanDomain.r_wellFounded
#align euclidean_domain.remainder_lt EuclideanDomain.remainder_lt
#align euclidean_domain.mul_left_not_lt EuclideanDomain.mul_left_not_lt
namespace EuclideanDomain
variable {R : Type u} [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.r
local instance wellFoundedRelation : WellFoundedRelation R where
wf := r_wellFounded
-- see Note [lower instance priority]
instance (priority := 70) : Div R :=
⟨EuclideanDomain.quotient⟩
-- see Note [lower instance priority]
instance (priority := 70) : Mod R :=
⟨EuclideanDomain.remainder⟩
theorem div_add_mod (a b : R) : b * (a / b) + a % b = a :=
EuclideanDomain.quotient_mul_add_remainder_eq _ _
#align euclidean_domain.div_add_mod EuclideanDomain.div_add_mod
theorem mod_add_div (a b : R) : a % b + b * (a / b) = a :=
(add_comm _ _).trans (div_add_mod _ _)
#align euclidean_domain.mod_add_div EuclideanDomain.mod_add_div
theorem mod_add_div' (m k : R) : m % k + m / k * k = m := by
rw [mul_comm]
exact mod_add_div _ _
#align euclidean_domain.mod_add_div' EuclideanDomain.mod_add_div'
theorem div_add_mod' (m k : R) : m / k * k + m % k = m := by
rw [mul_comm]
exact div_add_mod _ _
#align euclidean_domain.div_add_mod' EuclideanDomain.div_add_mod'
theorem mod_eq_sub_mul_div {R : Type*} [EuclideanDomain R] (a b : R) : a % b = a - b * (a / b) :=
calc
a % b = b * (a / b) + a % b - b * (a / b) := (add_sub_cancel_left _ _).symm
_ = a - b * (a / b) := by rw [div_add_mod]
#align euclidean_domain.mod_eq_sub_mul_div EuclideanDomain.mod_eq_sub_mul_div
theorem mod_lt : ∀ (a) {b : R}, b ≠ 0 → a % b ≺ b :=
EuclideanDomain.remainder_lt
#align euclidean_domain.mod_lt EuclideanDomain.mod_lt
theorem mul_right_not_lt {a : R} (b) (h : a ≠ 0) : ¬a * b ≺ b := by
rw [mul_comm]
exact mul_left_not_lt b h
#align euclidean_domain.mul_right_not_lt EuclideanDomain.mul_right_not_lt
@[simp]
theorem mod_zero (a : R) : a % 0 = a := by simpa only [zero_mul, zero_add] using div_add_mod a 0
#align euclidean_domain.mod_zero EuclideanDomain.mod_zero
theorem lt_one (a : R) : a ≺ (1 : R) → a = 0 :=
haveI := Classical.dec
not_imp_not.1 fun h => by simpa only [one_mul] using mul_left_not_lt 1 h
#align euclidean_domain.lt_one EuclideanDomain.lt_one
theorem val_dvd_le : ∀ a b : R, b ∣ a → a ≠ 0 → ¬a ≺ b
| _, b, ⟨d, rfl⟩, ha => mul_left_not_lt b (mt (by rintro rfl; exact mul_zero _) ha)
#align euclidean_domain.val_dvd_le EuclideanDomain.val_dvd_le
@[simp]
theorem div_zero (a : R) : a / 0 = 0 :=
EuclideanDomain.quotient_zero a
#align euclidean_domain.div_zero EuclideanDomain.div_zero
section
open scoped Classical
@[elab_as_elim]
theorem GCD.induction {P : R → R → Prop} (a b : R) (H0 : ∀ x, P 0 x)
(H1 : ∀ a b, a ≠ 0 → P (b % a) a → P a b) : P a b :=
if a0 : a = 0 then by
-- Porting note: required for hygiene, the equation compiler introduces a dummy variable `x`
-- See https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/unnecessarily.20tombstoned.20argument/near/314573315
change P a b
exact a0.symm ▸ H0 b
else
have _ := mod_lt b a0
H1 _ _ a0 (GCD.induction (b % a) a H0 H1)
termination_by a
#align euclidean_domain.gcd.induction EuclideanDomain.GCD.induction
end
section GCD
variable [DecidableEq R]
def gcd (a b : R) : R :=
if a0 : a = 0 then b
else
have _ := mod_lt b a0
gcd (b % a) a
termination_by a
#align euclidean_domain.gcd EuclideanDomain.gcd
@[simp]
| Mathlib/Algebra/EuclideanDomain/Defs.lean | 209 | 211 | theorem gcd_zero_left (a : R) : gcd 0 a = a := by |
rw [gcd]
exact if_pos rfl
| [
" m % k + m / k * k = m",
" m % k + k * (m / k) = m",
" m / k * k + m % k = m",
" k * (m / k) + m % k = m",
" b * (a / b) + a % b - b * (a / b) = a - b * (a / b)",
" ¬a * b ≺ b",
" ¬b * a ≺ b",
" a % 0 = a",
" ¬a ≺ 1",
" d = 0 → b * d = 0",
" b * 0 = 0",
" P a b",
" gcd 0 a = a",
" (if a0 ... | [
" m % k + m / k * k = m",
" m % k + k * (m / k) = m",
" m / k * k + m % k = m",
" k * (m / k) + m % k = m",
" b * (a / b) + a % b - b * (a / b) = a - b * (a / b)",
" ¬a * b ≺ b",
" ¬b * a ≺ b",
" a % 0 = a",
" ¬a ≺ 1",
" d = 0 → b * d = 0",
" b * 0 = 0",
" P a b"
] |
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]
| Mathlib/RingTheory/Discriminant.lean | 136 | 139 | 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 _ _
| [
" discr A b = discr A (⇑f ∘ b)",
" (traceMatrix A b).det = discr A (⇑f ∘ b)",
" traceMatrix A b = traceMatrix A (⇑f ∘ b)",
" traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝",
" discr K ⇑b ≠ 0",
" (traceForm K L).Nondegenerate"
] | [
" discr A b = discr A (⇑f ∘ b)",
" (traceMatrix A b).det = discr A (⇑f ∘ b)",
" traceMatrix A b = traceMatrix A (⇑f ∘ b)",
" traceMatrix A b i✝ j✝ = traceMatrix A (⇑f ∘ b) i✝ j✝"
] |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.fin_range from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
universe u
namespace List
variable {α : Type u}
@[simp]
theorem map_coe_finRange (n : ℕ) : ((finRange n) : List (Fin n)).map (Fin.val) = List.range n := by
simp_rw [finRange, map_pmap, pmap_eq_map]
exact List.map_id _
#align list.map_coe_fin_range List.map_coe_finRange
theorem finRange_succ_eq_map (n : ℕ) : finRange n.succ = 0 :: (finRange n).map Fin.succ := by
apply map_injective_iff.mpr Fin.val_injective
rw [map_cons, map_coe_finRange, range_succ_eq_map, Fin.val_zero, ← map_coe_finRange, map_map,
map_map]
simp only [Function.comp, Fin.val_succ]
#align list.fin_range_succ_eq_map List.finRange_succ_eq_map
theorem finRange_succ (n : ℕ) :
finRange n.succ = (finRange n |>.map Fin.castSucc |>.concat (.last _)) := by
apply map_injective_iff.mpr Fin.val_injective
simp [range_succ, Function.comp_def]
-- Porting note: `map_nth_le` moved to `List.finRange_map_get` in Data.List.Range
theorem ofFn_eq_pmap {n} {f : Fin n → α} :
ofFn f = pmap (fun i hi => f ⟨i, hi⟩) (range n) fun _ => mem_range.1 := by
rw [pmap_eq_map_attach]
exact ext_get (by simp) fun i hi1 hi2 => by simp [get_ofFn f ⟨i, hi1⟩]
#align list.of_fn_eq_pmap List.ofFn_eq_pmap
theorem ofFn_id (n) : ofFn id = finRange n :=
ofFn_eq_pmap
#align list.of_fn_id List.ofFn_id
| Mathlib/Data/List/FinRange.lean | 54 | 55 | theorem ofFn_eq_map {n} {f : Fin n → α} : ofFn f = (finRange n).map f := by |
rw [← ofFn_id, map_ofFn, Function.comp_id]
| [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n",
" finRange n.succ = 0 :: map Fin.succ (finRange n)",
" map Fin.val (finRange n.succ) = map Fin.val (0 :: map Fin.succ (finRange n))",
" 0 :: map (Nat.succ ∘ Fin.val) (finRange n) = 0 :: map (Fin.val ∘ Fin.succ) (finRange n)",
... | [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n",
" finRange n.succ = 0 :: map Fin.succ (finRange n)",
" map Fin.val (finRange n.succ) = map Fin.val (0 :: map Fin.succ (finRange n))",
" 0 :: map (Nat.succ ∘ Fin.val) (finRange n) = 0 :: map (Fin.val ∘ Fin.succ) (finRange 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]
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Basic.lean | 116 | 119 | theorem primeSpectrumProd_symm_inl_asIdeal (x : PrimeSpectrum R) :
((primeSpectrumProd R S).symm <| Sum.inl x).asIdeal = Ideal.prod x.asIdeal ⊤ := by |
cases x
rfl
| [
" Function.Bijective (primeSpectrumProdOfSum R S)",
" Function.Injective (primeSpectrumProdOfSum R S)",
" Sum.inl { asIdeal := I, IsPrime := hI } = Sum.inl { asIdeal := I', IsPrime := hI' }",
" Sum.inl { asIdeal := I, IsPrime := hI } = Sum.inr { asIdeal := J', IsPrime := hJ' }",
" Sum.inr { asIdeal := J, Is... | [
" Function.Bijective (primeSpectrumProdOfSum R S)",
" Function.Injective (primeSpectrumProdOfSum R S)",
" Sum.inl { asIdeal := I, IsPrime := hI } = Sum.inl { asIdeal := I', IsPrime := hI' }",
" Sum.inl { asIdeal := I, IsPrime := hI } = Sum.inr { asIdeal := J', IsPrime := hJ' }",
" Sum.inr { asIdeal := J, Is... |
import Mathlib.Data.Set.Image
import Mathlib.Order.SuccPred.Relation
import Mathlib.Topology.Clopen
import Mathlib.Topology.Irreducible
#align_import topology.connected from "leanprover-community/mathlib"@"d101e93197bb5f6ea89bd7ba386b7f7dff1f3903"
open Set Function Topology TopologicalSpace Relation
open scoped Classical
universe u v
variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*} [TopologicalSpace α]
{s t u v : Set α}
section Preconnected
def IsPreconnected (s : Set α) : Prop :=
∀ u v : Set α, IsOpen u → IsOpen v → s ⊆ u ∪ v → (s ∩ u).Nonempty → (s ∩ v).Nonempty →
(s ∩ (u ∩ v)).Nonempty
#align is_preconnected IsPreconnected
def IsConnected (s : Set α) : Prop :=
s.Nonempty ∧ IsPreconnected s
#align is_connected IsConnected
theorem IsConnected.nonempty {s : Set α} (h : IsConnected s) : s.Nonempty :=
h.1
#align is_connected.nonempty IsConnected.nonempty
theorem IsConnected.isPreconnected {s : Set α} (h : IsConnected s) : IsPreconnected s :=
h.2
#align is_connected.is_preconnected IsConnected.isPreconnected
theorem IsPreirreducible.isPreconnected {s : Set α} (H : IsPreirreducible s) : IsPreconnected s :=
fun _ _ hu hv _ => H _ _ hu hv
#align is_preirreducible.is_preconnected IsPreirreducible.isPreconnected
theorem IsIrreducible.isConnected {s : Set α} (H : IsIrreducible s) : IsConnected s :=
⟨H.nonempty, H.isPreirreducible.isPreconnected⟩
#align is_irreducible.is_connected IsIrreducible.isConnected
theorem isPreconnected_empty : IsPreconnected (∅ : Set α) :=
isPreirreducible_empty.isPreconnected
#align is_preconnected_empty isPreconnected_empty
theorem isConnected_singleton {x} : IsConnected ({x} : Set α) :=
isIrreducible_singleton.isConnected
#align is_connected_singleton isConnected_singleton
theorem isPreconnected_singleton {x} : IsPreconnected ({x} : Set α) :=
isConnected_singleton.isPreconnected
#align is_preconnected_singleton isPreconnected_singleton
theorem Set.Subsingleton.isPreconnected {s : Set α} (hs : s.Subsingleton) : IsPreconnected s :=
hs.induction_on isPreconnected_empty fun _ => isPreconnected_singleton
#align set.subsingleton.is_preconnected Set.Subsingleton.isPreconnected
theorem isPreconnected_of_forall {s : Set α} (x : α)
(H : ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) : IsPreconnected s := by
rintro u v hu hv hs ⟨z, zs, zu⟩ ⟨y, ys, yv⟩
have xs : x ∈ s := by
rcases H y ys with ⟨t, ts, xt, -, -⟩
exact ts xt
-- Porting note (#11215): TODO: use `wlog xu : x ∈ u := hs xs using u v y z, v u z y`
cases hs xs with
| inl xu =>
rcases H y ys with ⟨t, ts, xt, yt, ht⟩
have := ht u v hu hv (ts.trans hs) ⟨x, xt, xu⟩ ⟨y, yt, yv⟩
exact this.imp fun z hz => ⟨ts hz.1, hz.2⟩
| inr xv =>
rcases H z zs with ⟨t, ts, xt, zt, ht⟩
have := ht v u hv hu (ts.trans <| by rwa [union_comm]) ⟨x, xt, xv⟩ ⟨z, zt, zu⟩
exact this.imp fun _ h => ⟨ts h.1, h.2.2, h.2.1⟩
#align is_preconnected_of_forall isPreconnected_of_forall
theorem isPreconnected_of_forall_pair {s : Set α}
(H : ∀ x ∈ s, ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) :
IsPreconnected s := by
rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩)
exacts [isPreconnected_empty, isPreconnected_of_forall x fun y => H x hx y]
#align is_preconnected_of_forall_pair isPreconnected_of_forall_pair
theorem isPreconnected_sUnion (x : α) (c : Set (Set α)) (H1 : ∀ s ∈ c, x ∈ s)
(H2 : ∀ s ∈ c, IsPreconnected s) : IsPreconnected (⋃₀ c) := by
apply isPreconnected_of_forall x
rintro y ⟨s, sc, ys⟩
exact ⟨s, subset_sUnion_of_mem sc, H1 s sc, ys, H2 s sc⟩
#align is_preconnected_sUnion isPreconnected_sUnion
theorem isPreconnected_iUnion {ι : Sort*} {s : ι → Set α} (h₁ : (⋂ i, s i).Nonempty)
(h₂ : ∀ i, IsPreconnected (s i)) : IsPreconnected (⋃ i, s i) :=
Exists.elim h₁ fun f hf => isPreconnected_sUnion f _ hf (forall_mem_range.2 h₂)
#align is_preconnected_Union isPreconnected_iUnion
theorem IsPreconnected.union (x : α) {s t : Set α} (H1 : x ∈ s) (H2 : x ∈ t) (H3 : IsPreconnected s)
(H4 : IsPreconnected t) : IsPreconnected (s ∪ t) :=
sUnion_pair s t ▸ isPreconnected_sUnion x {s, t} (by rintro r (rfl | rfl | h) <;> assumption)
(by rintro r (rfl | rfl | h) <;> assumption)
#align is_preconnected.union IsPreconnected.union
| Mathlib/Topology/Connected/Basic.lean | 142 | 145 | theorem IsPreconnected.union' {s t : Set α} (H : (s ∩ t).Nonempty) (hs : IsPreconnected s)
(ht : IsPreconnected t) : IsPreconnected (s ∪ t) := by |
rcases H with ⟨x, hxs, hxt⟩
exact hs.union x hxs hxt ht
| [
" IsPreconnected s",
" (s ∩ (u ∩ v)).Nonempty",
" x ∈ s",
" s ⊆ v ∪ u",
" IsPreconnected (⋃₀ c)",
" ∀ y ∈ ⋃₀ c, ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∀ s_1 ∈ {s, t}, x ∈ s_1",
" x ∈ r",
" x ∈ t",
" ∀ s_1 ∈ {s, t}, IsPreconnected s_1",
... | [
" IsPreconnected s",
" (s ∩ (u ∩ v)).Nonempty",
" x ∈ s",
" s ⊆ v ∪ u",
" IsPreconnected (⋃₀ c)",
" ∀ y ∈ ⋃₀ c, ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∃ t ⊆ ⋃₀ c, x ∈ t ∧ y ∈ t ∧ IsPreconnected t",
" ∀ s_1 ∈ {s, t}, x ∈ s_1",
" x ∈ r",
" x ∈ t",
" ∀ s_1 ∈ {s, t}, IsPreconnected s_1",
... |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.fin_range from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
universe u
namespace List
variable {α : Type u}
@[simp]
theorem map_coe_finRange (n : ℕ) : ((finRange n) : List (Fin n)).map (Fin.val) = List.range n := by
simp_rw [finRange, map_pmap, pmap_eq_map]
exact List.map_id _
#align list.map_coe_fin_range List.map_coe_finRange
| Mathlib/Data/List/FinRange.lean | 30 | 34 | theorem finRange_succ_eq_map (n : ℕ) : finRange n.succ = 0 :: (finRange n).map Fin.succ := by |
apply map_injective_iff.mpr Fin.val_injective
rw [map_cons, map_coe_finRange, range_succ_eq_map, Fin.val_zero, ← map_coe_finRange, map_map,
map_map]
simp only [Function.comp, Fin.val_succ]
| [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n",
" finRange n.succ = 0 :: map Fin.succ (finRange n)",
" map Fin.val (finRange n.succ) = map Fin.val (0 :: map Fin.succ (finRange n))",
" 0 :: map (Nat.succ ∘ Fin.val) (finRange n) = 0 :: map (Fin.val ∘ Fin.succ) (finRange n)"
] | [
" map Fin.val (finRange n) = range n",
" map (fun a => a) (range n) = range n"
] |
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Zip
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Infix
#align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u
variable {α : Type u}
open Nat Function
namespace List
theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by simp [rotate]
#align list.rotate_mod List.rotate_mod
@[simp]
theorem rotate_nil (n : ℕ) : ([] : List α).rotate n = [] := by simp [rotate]
#align list.rotate_nil List.rotate_nil
@[simp]
theorem rotate_zero (l : List α) : l.rotate 0 = l := by simp [rotate]
#align list.rotate_zero List.rotate_zero
-- Porting note: removing simp, simp can prove it
theorem rotate'_nil (n : ℕ) : ([] : List α).rotate' n = [] := by cases n <;> rfl
#align list.rotate'_nil List.rotate'_nil
@[simp]
| Mathlib/Data/List/Rotate.lean | 53 | 53 | theorem rotate'_zero (l : List α) : l.rotate' 0 = l := by | cases l <;> rfl
| [
" l.rotate (n % l.length) = l.rotate n",
" [].rotate n = []",
" l.rotate 0 = l",
" [].rotate' n = []",
" [].rotate' 0 = []",
" [].rotate' (n✝ + 1) = []",
" l.rotate' 0 = l",
" (head✝ :: tail✝).rotate' 0 = head✝ :: tail✝"
] | [
" l.rotate (n % l.length) = l.rotate n",
" [].rotate n = []",
" l.rotate 0 = l",
" [].rotate' n = []",
" [].rotate' 0 = []",
" [].rotate' (n✝ + 1) = []"
] |
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
| Mathlib/Data/List/TFAE.lean | 63 | 71 | 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⟩
| [
" [p].TFAE",
" a ∈ a :: l",
" (a ↔ b) ∧ l.TFAE → (a :: l).TFAE",
" a ↔ a",
" a ↔ q",
" p ↔ a",
" p ↔ q",
" (a :: a :: l).TFAE ↔ (a :: l).TFAE",
" (a :: b :: l).TFAE",
" [a, b].TFAE",
" (a :: b :: c :: l).TFAE",
" (a ↔ b) ∧ (b ↔ c) ∧ (c :: l).TFAE"
] | [
" [p].TFAE",
" a ∈ a :: l",
" (a ↔ b) ∧ l.TFAE → (a :: l).TFAE",
" a ↔ a",
" a ↔ q",
" p ↔ a",
" p ↔ q",
" (a :: a :: l).TFAE ↔ (a :: l).TFAE"
] |
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Localization.NumDen
import Mathlib.RingTheory.Polynomial.ScaleRoots
#align_import ring_theory.polynomial.rational_root from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c"
open scoped Polynomial
section ScaleRoots
variable {A K R S : Type*} [CommRing A] [Field K] [CommRing R] [CommRing S]
variable {M : Submonoid A} [Algebra A S] [IsLocalization M S] [Algebra A K] [IsFractionRing A K]
open Finsupp IsFractionRing IsLocalization Polynomial
theorem scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero {p : A[X]} {r : A} {s : M}
(hr : aeval (mk' S r s) p = 0) : aeval (algebraMap A S r) (scaleRoots p s) = 0 := by
convert scaleRoots_eval₂_eq_zero (algebraMap A S) hr
-- Porting note: added
funext
rw [aeval_def, mk'_spec' _ r s]
#align scale_roots_aeval_eq_zero_of_aeval_mk'_eq_zero scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero
variable [IsDomain A]
| Mathlib/RingTheory/Polynomial/RationalRoot.lean | 49 | 54 | theorem num_isRoot_scaleRoots_of_aeval_eq_zero [UniqueFactorizationMonoid A] {p : A[X]} {x : K}
(hr : aeval x p = 0) : IsRoot (scaleRoots p (den A x)) (num A x) := by |
apply isRoot_of_eval₂_map_eq_zero (IsFractionRing.injective A K)
refine scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero ?_
rw [mk'_num_den]
exact hr
| [
" (aeval ((algebraMap A S) r)) (p.scaleRoots ↑s) = 0",
" ⇑(aeval ((algebraMap A S) r)) = eval₂ (algebraMap A S) ((algebraMap A S) ↑s * mk' S r s)",
" (aeval ((algebraMap A S) r)) x✝ = eval₂ (algebraMap A S) ((algebraMap A S) ↑s * mk' S r s) x✝",
" (p.scaleRoots ↑(den A x)).IsRoot (num A x)",
" eval₂ (algebr... | [
" (aeval ((algebraMap A S) r)) (p.scaleRoots ↑s) = 0",
" ⇑(aeval ((algebraMap A S) r)) = eval₂ (algebraMap A S) ((algebraMap A S) ↑s * mk' S r s)",
" (aeval ((algebraMap A S) r)) x✝ = eval₂ (algebraMap A S) ((algebraMap A S) ↑s * mk' S r s) x✝"
] |
import Mathlib.Combinatorics.SetFamily.Shadow
#align_import combinatorics.set_family.compression.uv from "leanprover-community/mathlib"@"6f8ab7de1c4b78a68ab8cf7dd83d549eb78a68a1"
open Finset
variable {α : Type*}
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) :
{ x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
rintro a ha b hb hab
have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by
dsimp at hab
rw [hab]
rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm,
hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h
#align sup_sdiff_inj_on sup_sdiff_injOn
-- The namespace is here to distinguish from other compressions.
namespace UV
section GeneralizedBooleanAlgebra
variable [GeneralizedBooleanAlgebra α] [DecidableRel (@Disjoint α _ _)]
[DecidableRel ((· ≤ ·) : α → α → Prop)] {s : Finset α} {u v a b : α}
def compress (u v a : α) : α :=
if Disjoint u a ∧ v ≤ a then (a ⊔ u) \ v else a
#align uv.compress UV.compress
theorem compress_of_disjoint_of_le (hua : Disjoint u a) (hva : v ≤ a) :
compress u v a = (a ⊔ u) \ v :=
if_pos ⟨hua, hva⟩
#align uv.compress_of_disjoint_of_le UV.compress_of_disjoint_of_le
theorem compress_of_disjoint_of_le' (hva : Disjoint v a) (hua : u ≤ a) :
compress u v ((a ⊔ v) \ u) = a := by
rw [compress_of_disjoint_of_le disjoint_sdiff_self_right
(le_sdiff.2 ⟨(le_sup_right : v ≤ a ⊔ v), hva.mono_right hua⟩),
sdiff_sup_cancel (le_sup_of_le_left hua), hva.symm.sup_sdiff_cancel_right]
#align uv.compress_of_disjoint_of_le' UV.compress_of_disjoint_of_le'
@[simp]
theorem compress_self (u a : α) : compress u u a = a := by
unfold compress
split_ifs with h
· exact h.1.symm.sup_sdiff_cancel_right
· rfl
#align uv.compress_self UV.compress_self
@[simp]
theorem compress_sdiff_sdiff (a b : α) : compress (a \ b) (b \ a) b = a := by
refine (compress_of_disjoint_of_le disjoint_sdiff_self_left sdiff_le).trans ?_
rw [sup_sdiff_self_right, sup_sdiff, disjoint_sdiff_self_right.sdiff_eq_left, sup_eq_right]
exact sdiff_sdiff_le
#align uv.compress_sdiff_sdiff UV.compress_sdiff_sdiff
@[simp]
theorem compress_idem (u v a : α) : compress u v (compress u v a) = compress u v a := by
unfold compress
split_ifs with h h'
· rw [le_sdiff_iff.1 h'.2, sdiff_bot, sdiff_bot, sup_assoc, sup_idem]
· rfl
· rfl
#align uv.compress_idem UV.compress_idem
variable [DecidableEq α]
def compression (u v : α) (s : Finset α) :=
(s.filter (compress u v · ∈ s)) ∪ (s.image <| compress u v).filter (· ∉ s)
#align uv.compression UV.compression
@[inherit_doc]
scoped[FinsetFamily] notation "𝓒 " => UV.compression
open scoped FinsetFamily
def IsCompressed (u v : α) (s : Finset α) :=
𝓒 u v s = s
#align uv.is_compressed UV.IsCompressed
theorem compress_injOn : Set.InjOn (compress u v) ↑(s.filter (compress u v · ∉ s)) := by
intro a ha b hb hab
rw [mem_coe, mem_filter] at ha hb
rw [compress] at ha hab
split_ifs at ha hab with has
· rw [compress] at hb hab
split_ifs at hb hab with hbs
· exact sup_sdiff_injOn u v has hbs hab
· exact (hb.2 hb.1).elim
· exact (ha.2 ha.1).elim
#align uv.compress_inj_on UV.compress_injOn
theorem mem_compression :
a ∈ 𝓒 u v s ↔ a ∈ s ∧ compress u v a ∈ s ∨ a ∉ s ∧ ∃ b ∈ s, compress u v b = a := by
simp_rw [compression, mem_union, mem_filter, mem_image, and_comm]
#align uv.mem_compression UV.mem_compression
protected theorem IsCompressed.eq (h : IsCompressed u v s) : 𝓒 u v s = s := h
#align uv.is_compressed.eq UV.IsCompressed.eq
@[simp]
| Mathlib/Combinatorics/SetFamily/Compression/UV.lean | 165 | 173 | theorem compression_self (u : α) (s : Finset α) : 𝓒 u u s = s := by |
unfold compression
convert union_empty s
· ext a
rw [mem_filter, compress_self, and_self_iff]
· refine eq_empty_of_forall_not_mem fun a ha ↦ ?_
simp_rw [mem_filter, mem_image, compress_self] at ha
obtain ⟨⟨b, hb, rfl⟩, hb'⟩ := ha
exact hb' hb
| [
" Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}",
" a = b",
" ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v",
" compress u v ((a ⊔ v) \\ u) = a",
" compress u u a = a",
" (if Disjoint u a ∧ u ≤ a then (a ⊔ u) \\ u else a) = a",
" (a ⊔ u) \\ u = a",
" a = a",
" compress (a \\ b) (b... | [
" Set.InjOn (fun x => (x ⊔ u) \\ v) {x | Disjoint u x ∧ v ≤ x}",
" a = b",
" ((a ⊔ u) \\ v) \\ u ⊔ v = ((b ⊔ u) \\ v) \\ u ⊔ v",
" compress u v ((a ⊔ v) \\ u) = a",
" compress u u a = a",
" (if Disjoint u a ∧ u ≤ a then (a ⊔ u) \\ u else a) = a",
" (a ⊔ u) \\ u = a",
" a = a",
" compress (a \\ b) (b... |
import Mathlib.Topology.ContinuousFunction.Bounded
import Mathlib.Topology.UniformSpace.Compact
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.Sets.Compacts
import Mathlib.Analysis.Normed.Group.InfiniteSum
#align_import topology.continuous_function.compact from "leanprover-community/mathlib"@"d3af0609f6db8691dffdc3e1fb7feb7da72698f2"
noncomputable section
open scoped Classical
open Topology NNReal BoundedContinuousFunction
open Set Filter Metric
open BoundedContinuousFunction
namespace ContinuousMap
variable {α β E : Type*} [TopologicalSpace α] [CompactSpace α] [MetricSpace β]
[NormedAddCommGroup E]
section
variable (α β)
@[simps (config := .asFn)]
def equivBoundedOfCompact : C(α, β) ≃ (α →ᵇ β) :=
⟨mkOfCompact, BoundedContinuousFunction.toContinuousMap, fun f => by
ext
rfl, fun f => by
ext
rfl⟩
#align continuous_map.equiv_bounded_of_compact ContinuousMap.equivBoundedOfCompact
theorem uniformInducing_equivBoundedOfCompact : UniformInducing (equivBoundedOfCompact α β) :=
UniformInducing.mk'
(by
simp only [hasBasis_compactConvergenceUniformity.mem_iff, uniformity_basis_dist_le.mem_iff]
exact fun s =>
⟨fun ⟨⟨a, b⟩, ⟨_, ⟨ε, hε, hb⟩⟩, hs⟩ =>
⟨{ p | ∀ x, (p.1 x, p.2 x) ∈ b }, ⟨ε, hε, fun _ h x => hb ((dist_le hε.le).mp h x)⟩,
fun f g h => hs fun x _ => h x⟩,
fun ⟨_, ⟨ε, hε, ht⟩, hs⟩ =>
⟨⟨Set.univ, { p | dist p.1 p.2 ≤ ε }⟩, ⟨isCompact_univ, ⟨ε, hε, fun _ h => h⟩⟩,
fun ⟨f, g⟩ h => hs _ _ (ht ((dist_le hε.le).mpr fun x => h x (mem_univ x)))⟩⟩)
#align continuous_map.uniform_inducing_equiv_bounded_of_compact ContinuousMap.uniformInducing_equivBoundedOfCompact
theorem uniformEmbedding_equivBoundedOfCompact : UniformEmbedding (equivBoundedOfCompact α β) :=
{ uniformInducing_equivBoundedOfCompact α β with inj := (equivBoundedOfCompact α β).injective }
#align continuous_map.uniform_embedding_equiv_bounded_of_compact ContinuousMap.uniformEmbedding_equivBoundedOfCompact
-- Porting note: the following `simps` received a "maximum recursion depth" error
-- @[simps! (config := .asFn) apply symm_apply]
def addEquivBoundedOfCompact [AddMonoid β] [LipschitzAdd β] : C(α, β) ≃+ (α →ᵇ β) :=
({ toContinuousMapAddHom α β, (equivBoundedOfCompact α β).symm with } : (α →ᵇ β) ≃+ C(α, β)).symm
#align continuous_map.add_equiv_bounded_of_compact ContinuousMap.addEquivBoundedOfCompact
-- Porting note: added this `simp` lemma manually because of the `simps` error above
@[simp]
theorem addEquivBoundedOfCompact_symm_apply [AddMonoid β] [LipschitzAdd β] :
⇑((addEquivBoundedOfCompact α β).symm) = toContinuousMapAddHom α β :=
rfl
-- Porting note: added this `simp` lemma manually because of the `simps` error above
@[simp]
theorem addEquivBoundedOfCompact_apply [AddMonoid β] [LipschitzAdd β] :
⇑(addEquivBoundedOfCompact α β) = mkOfCompact :=
rfl
instance metricSpace : MetricSpace C(α, β) :=
(uniformEmbedding_equivBoundedOfCompact α β).comapMetricSpace _
#align continuous_map.metric_space ContinuousMap.metricSpace
@[simps! (config := .asFn) toEquiv apply symm_apply]
def isometryEquivBoundedOfCompact : C(α, β) ≃ᵢ (α →ᵇ β) where
isometry_toFun _ _ := rfl
toEquiv := equivBoundedOfCompact α β
#align continuous_map.isometry_equiv_bounded_of_compact ContinuousMap.isometryEquivBoundedOfCompact
end
@[simp]
theorem _root_.BoundedContinuousFunction.dist_mkOfCompact (f g : C(α, β)) :
dist (mkOfCompact f) (mkOfCompact g) = dist f g :=
rfl
#align bounded_continuous_function.dist_mk_of_compact BoundedContinuousFunction.dist_mkOfCompact
@[simp]
theorem _root_.BoundedContinuousFunction.dist_toContinuousMap (f g : α →ᵇ β) :
dist f.toContinuousMap g.toContinuousMap = dist f g :=
rfl
#align bounded_continuous_function.dist_to_continuous_map BoundedContinuousFunction.dist_toContinuousMap
open BoundedContinuousFunction
section
variable {f g : C(α, β)} {C : ℝ}
theorem dist_apply_le_dist (x : α) : dist (f x) (g x) ≤ dist f g := by
simp only [← dist_mkOfCompact, dist_coe_le_dist, ← mkOfCompact_apply]
#align continuous_map.dist_apply_le_dist ContinuousMap.dist_apply_le_dist
theorem dist_le (C0 : (0 : ℝ) ≤ C) : dist f g ≤ C ↔ ∀ x : α, dist (f x) (g x) ≤ C := by
simp only [← dist_mkOfCompact, BoundedContinuousFunction.dist_le C0, mkOfCompact_apply]
#align continuous_map.dist_le ContinuousMap.dist_le
theorem dist_le_iff_of_nonempty [Nonempty α] : dist f g ≤ C ↔ ∀ x, dist (f x) (g x) ≤ C := by
simp only [← dist_mkOfCompact, BoundedContinuousFunction.dist_le_iff_of_nonempty,
mkOfCompact_apply]
#align continuous_map.dist_le_iff_of_nonempty ContinuousMap.dist_le_iff_of_nonempty
| Mathlib/Topology/ContinuousFunction/Compact.lean | 146 | 147 | theorem dist_lt_iff_of_nonempty [Nonempty α] : dist f g < C ↔ ∀ x : α, dist (f x) (g x) < C := by |
simp only [← dist_mkOfCompact, dist_lt_iff_of_nonempty_compact, mkOfCompact_apply]
| [
" (mkOfCompact f).toContinuousMap = f",
" (mkOfCompact f).toContinuousMap a✝ = f a✝",
" mkOfCompact f.toContinuousMap = f",
" (mkOfCompact f.toContinuousMap) x✝ = f x✝",
" ∀ (s : Set (C(α, β) × C(α, β))),\n s ∈ uniformity C(α, β) ↔\n ∃ t ∈ uniformity (α →ᵇ β),\n ∀ (x y : C(α, β)), ((equivBoun... | [
" (mkOfCompact f).toContinuousMap = f",
" (mkOfCompact f).toContinuousMap a✝ = f a✝",
" mkOfCompact f.toContinuousMap = f",
" (mkOfCompact f.toContinuousMap) x✝ = f x✝",
" ∀ (s : Set (C(α, β) × C(α, β))),\n s ∈ uniformity C(α, β) ↔\n ∃ t ∈ uniformity (α →ᵇ β),\n ∀ (x y : C(α, β)), ((equivBoun... |
import Mathlib.Algebra.Group.Subgroup.Pointwise
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup
#align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R
attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun
local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ)
open Matrix.SpecialLinearGroup Matrix
variable (N : ℕ)
local notation "SLMOD(" N ")" =>
@Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N))
set_option linter.uppercaseLean3 false
@[simp]
theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) :
∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) :=
fun _ _ => rfl
#align SL_reduction_mod_hom_val SL_reduction_mod_hom_val
def Gamma (N : ℕ) : Subgroup SL(2, ℤ) :=
SLMOD(N).ker
#align Gamma Gamma
theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 :=
Iff.rfl
#align Gamma_mem' Gamma_mem'
@[simp]
| Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean | 56 | 66 | theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧
((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by |
rw [Gamma_mem']
constructor
· intro h
simp [← SL_reduction_mod_hom_val N γ, h]
· intro h
ext i j
rw [SL_reduction_mod_hom_val N γ]
fin_cases i <;> fin_cases j <;> simp only [h]
exacts [h.1, h.2.1, h.2.2.1, h.2.2.2]
| [
" γ ∈ Gamma N ↔ ↑(↑γ 0 0) = 1 ∧ ↑(↑γ 0 1) = 0 ∧ ↑(↑γ 1 0) = 0 ∧ ↑(↑γ 1 1) = 1",
" (SpecialLinearGroup.map (Int.castRingHom (ZMod N))) γ = 1 ↔\n ↑(↑γ 0 0) = 1 ∧ ↑(↑γ 0 1) = 0 ∧ ↑(↑γ 1 0) = 0 ∧ ↑(↑γ 1 1) = 1",
" (SpecialLinearGroup.map (Int.castRingHom (ZMod N))) γ = 1 →\n ↑(↑γ 0 0) = 1 ∧ ↑(↑γ 0 1) = 0 ∧ ↑(... | [] |
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : ℕ → Prop)
section Count
variable [DecidablePred p]
def count (n : ℕ) : ℕ :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : ℕ) : Fintype { i // i < n ∧ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : ℕ) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : ℕ) : count p n = Fintype.card { k : ℕ // k < n ∧ p k } := by
rw [count_eq_card_filter_range, ← Fintype.card_ofFinset, ← CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : ℕ) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n ↦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
theorem count_add (a b : ℕ) : count p (a + b) = count p a + count (fun k ↦ p (a + k)) b := by
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx ⟨c, _, rfl⟩
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
#align nat.count_add Nat.count_add
theorem count_add' (a b : ℕ) : count p (a + b) = count (fun k ↦ p (k + b)) a + count p b := by
rw [add_comm, count_add, add_comm]
simp_rw [add_comm b]
#align nat.count_add' Nat.count_add'
| Mathlib/Data/Nat/Count.lean | 91 | 91 | theorem count_one : count p 1 = if p 0 then 1 else 0 := by | simp [count_succ]
| [
" count p 0 = 0",
" Fintype { i // i < n ∧ p i }",
" ∀ (x : ℕ), x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x < n ∧ p x ↔ x ∈ fun x => x < n ∧ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... | [
" count p 0 = 0",
" Fintype { i // i < n ∧ p i }",
" ∀ (x : ℕ), x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x ∈ filter p (range n) ↔ x ∈ fun x => x < n ∧ p x",
" x < n ∧ p x ↔ x ∈ fun x => x < n ∧ p x",
" count p n = (filter p (range n)).card",
" (List.filter (fun b => decide (p b)) (List.rang... |
import Mathlib.Algebra.Module.Submodule.Lattice
import Mathlib.Order.Hom.CompleteLattice
namespace Submodule
variable (S : Type*) {R M : Type*} [Semiring R] [AddCommMonoid M] [Semiring S]
[Module S M] [Module R M] [SMul S R] [IsScalarTower S R M]
def restrictScalars (V : Submodule R M) : Submodule S M where
carrier := V
zero_mem' := V.zero_mem
smul_mem' c _ h := V.smul_of_tower_mem c h
add_mem' hx hy := V.add_mem hx hy
#align submodule.restrict_scalars Submodule.restrictScalars
@[simp]
theorem coe_restrictScalars (V : Submodule R M) : (V.restrictScalars S : Set M) = V :=
rfl
#align submodule.coe_restrict_scalars Submodule.coe_restrictScalars
@[simp]
theorem toAddSubmonoid_restrictScalars (V : Submodule R M) :
(V.restrictScalars S).toAddSubmonoid = V.toAddSubmonoid :=
rfl
@[simp]
theorem restrictScalars_mem (V : Submodule R M) (m : M) : m ∈ V.restrictScalars S ↔ m ∈ V :=
Iff.refl _
#align submodule.restrict_scalars_mem Submodule.restrictScalars_mem
@[simp]
theorem restrictScalars_self (V : Submodule R M) : V.restrictScalars R = V :=
SetLike.coe_injective rfl
#align submodule.restrict_scalars_self Submodule.restrictScalars_self
variable (R M)
theorem restrictScalars_injective :
Function.Injective (restrictScalars S : Submodule R M → Submodule S M) := fun _ _ h =>
ext <| Set.ext_iff.1 (SetLike.ext'_iff.1 h : _)
#align submodule.restrict_scalars_injective Submodule.restrictScalars_injective
@[simp]
theorem restrictScalars_inj {V₁ V₂ : Submodule R M} :
restrictScalars S V₁ = restrictScalars S V₂ ↔ V₁ = V₂ :=
(restrictScalars_injective S _ _).eq_iff
#align submodule.restrict_scalars_inj Submodule.restrictScalars_inj
instance restrictScalars.origModule (p : Submodule R M) : Module R (p.restrictScalars S) :=
(by infer_instance : Module R p)
#align submodule.restrict_scalars.orig_module Submodule.restrictScalars.origModule
instance restrictScalars.isScalarTower (p : Submodule R M) :
IsScalarTower S R (p.restrictScalars S) where
smul_assoc r s x := Subtype.ext <| smul_assoc r s (x : M)
#align submodule.restrict_scalars.is_scalar_tower Submodule.restrictScalars.isScalarTower
@[simps]
def restrictScalarsEmbedding : Submodule R M ↪o Submodule S M where
toFun := restrictScalars S
inj' := restrictScalars_injective S R M
map_rel_iff' := by simp [SetLike.le_def]
#align submodule.restrict_scalars_embedding Submodule.restrictScalarsEmbedding
#align submodule.restrict_scalars_embedding_apply Submodule.restrictScalarsEmbedding_apply
@[simps (config := { simpRhs := true })]
def restrictScalarsEquiv (p : Submodule R M) : p.restrictScalars S ≃ₗ[R] p :=
{ AddEquiv.refl p with
map_smul' := fun _ _ => rfl }
#align submodule.restrict_scalars_equiv Submodule.restrictScalarsEquiv
#align submodule.restrict_scalars_equiv_symm_apply Submodule.restrictScalarsEquiv_symm_apply
@[simp]
theorem restrictScalars_bot : restrictScalars S (⊥ : Submodule R M) = ⊥ :=
rfl
#align submodule.restrict_scalars_bot Submodule.restrictScalars_bot
@[simp]
theorem restrictScalars_eq_bot_iff {p : Submodule R M} : restrictScalars S p = ⊥ ↔ p = ⊥ := by
simp [SetLike.ext_iff]
#align submodule.restrict_scalars_eq_bot_iff Submodule.restrictScalars_eq_bot_iff
@[simp]
theorem restrictScalars_top : restrictScalars S (⊤ : Submodule R M) = ⊤ :=
rfl
#align submodule.restrict_scalars_top Submodule.restrictScalars_top
@[simp]
| Mathlib/Algebra/Module/Submodule/RestrictScalars.lean | 116 | 117 | theorem restrictScalars_eq_top_iff {p : Submodule R M} : restrictScalars S p = ⊤ ↔ p = ⊤ := by |
simp [SetLike.ext_iff]
| [
" Module R ↥p",
" ∀ {a b : Submodule R M},\n { toFun := restrictScalars S, inj' := ⋯ } a ≤ { toFun := restrictScalars S, inj' := ⋯ } b ↔ a ≤ b",
" restrictScalars S p = ⊥ ↔ p = ⊥",
" restrictScalars S p = ⊤ ↔ p = ⊤"
] | [
" Module R ↥p",
" ∀ {a b : Submodule R M},\n { toFun := restrictScalars S, inj' := ⋯ } a ≤ { toFun := restrictScalars S, inj' := ⋯ } b ↔ a ≤ b",
" restrictScalars S p = ⊥ ↔ p = ⊥"
] |
import Mathlib.NumberTheory.ModularForms.EisensteinSeries.UniformConvergence
import Mathlib.Analysis.Complex.UpperHalfPlane.Manifold
import Mathlib.Analysis.Complex.LocallyUniformLimit
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
noncomputable section
open ModularForm EisensteinSeries UpperHalfPlane Set Filter Function Complex Manifold
open scoped Topology BigOperators Nat Classical UpperHalfPlane
namespace EisensteinSeries
lemma div_linear_zpow_differentiableOn (k : ℤ) (a : Fin 2 → ℤ) :
DifferentiableOn ℂ (fun z : ℂ => 1 / (a 0 * z + a 1) ^ k) {z : ℂ | 0 < z.im} := by
rcases ne_or_eq a 0 with ha | rfl
· apply DifferentiableOn.div (differentiableOn_const 1)
· apply DifferentiableOn.zpow
· fun_prop
· left
exact fun z hz ↦ linear_ne_zero _ ⟨z, hz⟩
((comp_ne_zero_iff _ Int.cast_injective Int.cast_zero).mpr ha)
· exact fun z hz ↦ zpow_ne_zero k (linear_ne_zero (a ·)
⟨z, hz⟩ ((comp_ne_zero_iff _ Int.cast_injective Int.cast_zero).mpr ha))
· simp only [ Fin.isValue, Pi.zero_apply, Int.cast_zero, zero_mul, add_zero, one_div]
apply differentiableOn_const
lemma eisSummand_extension_differentiableOn (k : ℤ) (a : Fin 2 → ℤ) :
DifferentiableOn ℂ (↑ₕeisSummand k a) {z : ℂ | 0 < z.im} := by
apply DifferentiableOn.congr (div_linear_zpow_differentiableOn k a)
intro z hz
lift z to ℍ using hz
apply comp_ofComplex
| Mathlib/NumberTheory/ModularForms/EisensteinSeries/MDifferentiable.lean | 54 | 65 | theorem eisensteinSeries_SIF_MDifferentiable {k : ℤ} {N : ℕ} (hk : 3 ≤ k) (a : Fin 2 → ZMod N) :
MDifferentiable 𝓘(ℂ) 𝓘(ℂ) (eisensteinSeries_SIF a k) := by |
intro τ
suffices DifferentiableAt ℂ (↑ₕeisensteinSeries_SIF a k) τ.1 by
convert MDifferentiableAt.comp τ (DifferentiableAt.mdifferentiableAt this) τ.mdifferentiable_coe
exact funext fun z ↦ (comp_ofComplex (eisensteinSeries_SIF a k) z).symm
refine DifferentiableOn.differentiableAt ?_
((isOpen_lt continuous_const Complex.continuous_im).mem_nhds τ.2)
exact (eisensteinSeries_tendstoLocallyUniformlyOn hk a).differentiableOn
(eventually_of_forall fun s ↦ DifferentiableOn.sum
fun _ _ ↦ eisSummand_extension_differentiableOn _ _)
(isOpen_lt continuous_const continuous_im)
| [
" DifferentiableOn ℂ (fun z => 1 / (↑(a 0) * z + ↑(a 1)) ^ k) {z | 0 < z.im}",
" DifferentiableOn ℂ (fun x => (↑(a 0) * x + ↑(a 1)) ^ k) {z | 0 < z.im}",
" DifferentiableOn ℂ (fun x => ↑(a 0) * x + ↑(a 1)) {z | 0 < z.im}",
" (∀ x ∈ {z | 0 < z.im}, ↑(a 0) * x + ↑(a 1) ≠ 0) ∨ 0 ≤ k",
" ∀ x ∈ {z | 0 < z.im}, ↑... | [
" DifferentiableOn ℂ (fun z => 1 / (↑(a 0) * z + ↑(a 1)) ^ k) {z | 0 < z.im}",
" DifferentiableOn ℂ (fun x => (↑(a 0) * x + ↑(a 1)) ^ k) {z | 0 < z.im}",
" DifferentiableOn ℂ (fun x => ↑(a 0) * x + ↑(a 1)) {z | 0 < z.im}",
" (∀ x ∈ {z | 0 < z.im}, ↑(a 0) * x + ↑(a 1) ≠ 0) ∨ 0 ≤ k",
" ∀ x ∈ {z | 0 < z.im}, ↑... |
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.Exponent
import Mathlib.GroupTheory.Transfer
#align_import group_theory.schreier from "leanprover-community/mathlib"@"8350c34a64b9bc3fc64335df8006bffcadc7baa6"
open scoped Pointwise
namespace Subgroup
open MemRightTransversals
variable {G : Type*} [Group G] {H : Subgroup G} {R S : Set G}
theorem closure_mul_image_mul_eq_top
(hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R) (hS : closure S = ⊤) :
(closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹)) * R = ⊤ := by
let f : G → R := fun g => toFun hR g
let U : Set G := (R * S).image fun g => g * (f g : G)⁻¹
change (closure U : Set G) * R = ⊤
refine top_le_iff.mp fun g _ => ?_
refine closure_induction_right ?_ ?_ ?_ (eq_top_iff.mp hS (mem_top g))
· exact ⟨1, (closure U).one_mem, 1, hR1, one_mul 1⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s = u * (r * s * (f (r * s) : G)⁻¹) * f (r * s) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ?_) (f (r * s)).coe_prop
exact subset_closure ⟨r * s, Set.mul_mem_mul hr hs, rfl⟩
· rintro - - s hs ⟨u, hu, r, hr, rfl⟩
rw [show u * r * s⁻¹ = u * (f (r * s⁻¹) * s * r⁻¹)⁻¹ * f (r * s⁻¹) by group]
refine Set.mul_mem_mul ((closure U).mul_mem hu ((closure U).inv_mem ?_)) (f (r * s⁻¹)).2
refine subset_closure ⟨f (r * s⁻¹) * s, Set.mul_mem_mul (f (r * s⁻¹)).2 hs, ?_⟩
rw [mul_right_inj, inv_inj, ← Subtype.coe_mk r hr, ← Subtype.ext_iff, Subtype.coe_mk]
apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR (f (r * s⁻¹) * s)).unique
(mul_inv_toFun_mem hR (f (r * s⁻¹) * s))
rw [mul_assoc, ← inv_inv s, ← mul_inv_rev, inv_inv]
exact toFun_mul_inv_mem hR (r * s⁻¹)
#align subgroup.closure_mul_image_mul_eq_top Subgroup.closure_mul_image_mul_eq_top
theorem closure_mul_image_eq (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R)
(hS : closure S = ⊤) : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) = H := by
have hU : closure ((R * S).image fun g => g * (toFun hR g : G)⁻¹) ≤ H := by
rw [closure_le]
rintro - ⟨g, -, rfl⟩
exact mul_inv_toFun_mem hR g
refine le_antisymm hU fun h hh => ?_
obtain ⟨g, hg, r, hr, rfl⟩ :=
show h ∈ _ from eq_top_iff.mp (closure_mul_image_mul_eq_top hR hR1 hS) (mem_top h)
suffices (⟨r, hr⟩ : R) = (⟨1, hR1⟩ : R) by
simpa only [show r = 1 from Subtype.ext_iff.mp this, mul_one]
apply (mem_rightTransversals_iff_existsUnique_mul_inv_mem.mp hR r).unique
· rw [Subtype.coe_mk, mul_inv_self]
exact H.one_mem
· rw [Subtype.coe_mk, inv_one, mul_one]
exact (H.mul_mem_cancel_left (hU hg)).mp hh
#align subgroup.closure_mul_image_eq Subgroup.closure_mul_image_eq
| Mathlib/GroupTheory/Schreier.lean | 85 | 89 | theorem closure_mul_image_eq_top (hR : R ∈ rightTransversals (H : Set G)) (hR1 : (1 : G) ∈ R)
(hS : closure S = ⊤) : closure ((R * S).image fun g =>
⟨g * (toFun hR g : G)⁻¹, mul_inv_toFun_mem hR g⟩ : Set H) = ⊤ := by |
rw [eq_top_iff, ← map_subtype_le_map_subtype, MonoidHom.map_closure, Set.image_image]
exact (map_subtype_le ⊤).trans (ge_of_eq (closure_mul_image_eq hR hR1 hS))
| [
" ↑(closure ((fun g => g * (↑(toFun hR g))⁻¹) '' (R * S))) * R = ⊤",
" ↑(closure U) * R = ⊤",
" g ∈ ↑(closure U) * R",
" 1 ∈ ↑(closure U) * R",
" ∀ x ∈ closure S, ∀ y ∈ S, x ∈ ↑(closure U) * R → x * y ∈ ↑(closure U) * R",
" (fun x x_1 => x * x_1) u r * s ∈ ↑(closure U) * R",
" u * r * s = u * (r * s * (... | [
" ↑(closure ((fun g => g * (↑(toFun hR g))⁻¹) '' (R * S))) * R = ⊤",
" ↑(closure U) * R = ⊤",
" g ∈ ↑(closure U) * R",
" 1 ∈ ↑(closure U) * R",
" ∀ x ∈ closure S, ∀ y ∈ S, x ∈ ↑(closure U) * R → x * y ∈ ↑(closure U) * R",
" (fun x x_1 => x * x_1) u r * s ∈ ↑(closure U) * R",
" u * r * s = u * (r * s * (... |
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Covering.Besicovitch
import Mathlib.Tactic.AdaptationNote
#align_import measure_theory.covering.besicovitch_vector_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
universe u
open Metric Set FiniteDimensional MeasureTheory Filter Fin
open scoped ENNReal Topology
noncomputable section
namespace Besicovitch
variable {E : Type*} [NormedAddCommGroup E]
def multiplicity (E : Type*) [NormedAddCommGroup E] :=
sSup {N | ∃ s : Finset E, s.card = N ∧ (∀ c ∈ s, ‖c‖ ≤ 2) ∧ ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖}
#align besicovitch.multiplicity Besicovitch.multiplicity
section
variable [NormedSpace ℝ E] [FiniteDimensional ℝ E]
theorem card_le_of_separated (s : Finset E) (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
(h : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ 5 ^ finrank ℝ E := by
borelize E
let μ : Measure E := Measure.addHaar
let δ : ℝ := (1 : ℝ) / 2
let ρ : ℝ := (5 : ℝ) / 2
have ρpos : 0 < ρ := by norm_num
set A := ⋃ c ∈ s, ball (c : E) δ with hA
have D : Set.Pairwise (s : Set E) (Disjoint on fun c => ball (c : E) δ) := by
rintro c hc d hd hcd
apply ball_disjoint_ball
rw [dist_eq_norm]
convert h c hc d hd hcd
norm_num
have A_subset : A ⊆ ball (0 : E) ρ := by
refine iUnion₂_subset fun x hx => ?_
apply ball_subset_ball'
calc
δ + dist x 0 ≤ δ + 2 := by rw [dist_zero_right]; exact add_le_add le_rfl (hs x hx)
_ = 5 / 2 := by norm_num
have I :
(s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) ≤
ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) :=
calc
(s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) * μ (ball 0 1) = μ A := by
rw [hA, measure_biUnion_finset D fun c _ => measurableSet_ball]
have I : 0 < δ := by norm_num
simp only [div_pow, μ.addHaar_ball_of_pos _ I]
simp only [one_div, one_pow, Finset.sum_const, nsmul_eq_mul, mul_assoc]
_ ≤ μ (ball (0 : E) ρ) := measure_mono A_subset
_ = ENNReal.ofReal (ρ ^ finrank ℝ E) * μ (ball 0 1) := by
simp only [μ.addHaar_ball_of_pos _ ρpos]
have J : (s.card : ℝ≥0∞) * ENNReal.ofReal (δ ^ finrank ℝ E) ≤ ENNReal.ofReal (ρ ^ finrank ℝ E) :=
(ENNReal.mul_le_mul_right (measure_ball_pos _ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 I
have K : (s.card : ℝ) ≤ (5 : ℝ) ^ finrank ℝ E := by
have := ENNReal.toReal_le_of_le_ofReal (pow_nonneg ρpos.le _) J
simpa [ρ, δ, div_eq_mul_inv, mul_pow] using this
exact mod_cast K
#align besicovitch.card_le_of_separated Besicovitch.card_le_of_separated
theorem multiplicity_le : multiplicity E ≤ 5 ^ finrank ℝ E := by
apply csSup_le
· refine ⟨0, ⟨∅, by simp⟩⟩
· rintro _ ⟨s, ⟨rfl, h⟩⟩
exact Besicovitch.card_le_of_separated s h.1 h.2
#align besicovitch.multiplicity_le Besicovitch.multiplicity_le
theorem card_le_multiplicity {s : Finset E} (hs : ∀ c ∈ s, ‖c‖ ≤ 2)
(h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖) : s.card ≤ multiplicity E := by
apply le_csSup
· refine ⟨5 ^ finrank ℝ E, ?_⟩
rintro _ ⟨s, ⟨rfl, h⟩⟩
exact Besicovitch.card_le_of_separated s h.1 h.2
· simp only [mem_setOf_eq, Ne]
exact ⟨s, rfl, hs, h's⟩
#align besicovitch.card_le_multiplicity Besicovitch.card_le_multiplicity
variable (E)
| Mathlib/MeasureTheory/Covering/BesicovitchVectorSpace.lean | 174 | 246 | theorem exists_goodδ :
∃ δ : ℝ, 0 < δ ∧ δ < 1 ∧ ∀ s : Finset E, (∀ c ∈ s, ‖c‖ ≤ 2) →
(∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 - δ ≤ ‖c - d‖) → s.card ≤ multiplicity E := by |
classical
/- This follows from a compactness argument: otherwise, one could extract a converging
subsequence, to obtain a `1`-separated set in the ball of radius `2` with cardinality
`N = multiplicity E + 1`. To formalize this, we work with functions `Fin N → E`.
-/
by_contra! h
set N := multiplicity E + 1 with hN
have :
∀ δ : ℝ, 0 < δ → ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧
Pairwise fun i j => 1 - δ ≤ ‖f i - f j‖ := by
intro δ hδ
rcases lt_or_le δ 1 with (hδ' | hδ')
· rcases h δ hδ hδ' with ⟨s, hs, h's, s_card⟩
obtain ⟨f, f_inj, hfs⟩ : ∃ f : Fin N → E, Function.Injective f ∧ range f ⊆ ↑s := by
have : Fintype.card (Fin N) ≤ s.card := by simp only [Fintype.card_fin]; exact s_card
rcases Function.Embedding.exists_of_card_le_finset this with ⟨f, hf⟩
exact ⟨f, f.injective, hf⟩
simp only [range_subset_iff, Finset.mem_coe] at hfs
exact ⟨f, fun i => hs _ (hfs i), fun i j hij => h's _ (hfs i) _ (hfs j) (f_inj.ne hij)⟩
· exact
⟨fun _ => 0, by simp, fun i j _ => by
simpa only [norm_zero, sub_nonpos, sub_self]⟩
-- For `δ > 0`, `F δ` is a function from `fin N` to the ball of radius `2` for which two points
-- in the image are separated by `1 - δ`.
choose! F hF using this
-- Choose a converging subsequence when `δ → 0`.
have : ∃ f : Fin N → E, (∀ i : Fin N, ‖f i‖ ≤ 2) ∧ Pairwise fun i j => 1 ≤ ‖f i - f j‖ := by
obtain ⟨u, _, zero_lt_u, hu⟩ :
∃ u : ℕ → ℝ,
(∀ m n : ℕ, m < n → u n < u m) ∧ (∀ n : ℕ, 0 < u n) ∧ Filter.Tendsto u Filter.atTop (𝓝 0) :=
exists_seq_strictAnti_tendsto (0 : ℝ)
have A : ∀ n, F (u n) ∈ closedBall (0 : Fin N → E) 2 := by
intro n
simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closedBall, dist_zero_right,
(hF (u n) (zero_lt_u n)).left, forall_const]
obtain ⟨f, fmem, φ, φ_mono, hf⟩ :
∃ f ∈ closedBall (0 : Fin N → E) 2,
∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto ((F ∘ u) ∘ φ) atTop (𝓝 f) :=
IsCompact.tendsto_subseq (isCompact_closedBall _ _) A
refine ⟨f, fun i => ?_, fun i j hij => ?_⟩
· simp only [pi_norm_le_iff_of_nonneg zero_le_two, mem_closedBall, dist_zero_right] at fmem
exact fmem i
· have A : Tendsto (fun n => ‖F (u (φ n)) i - F (u (φ n)) j‖) atTop (𝓝 ‖f i - f j‖) :=
((hf.apply_nhds i).sub (hf.apply_nhds j)).norm
have B : Tendsto (fun n => 1 - u (φ n)) atTop (𝓝 (1 - 0)) :=
tendsto_const_nhds.sub (hu.comp φ_mono.tendsto_atTop)
rw [sub_zero] at B
exact le_of_tendsto_of_tendsto' B A fun n => (hF (u (φ n)) (zero_lt_u _)).2 hij
rcases this with ⟨f, hf, h'f⟩
-- the range of `f` contradicts the definition of `multiplicity E`.
have finj : Function.Injective f := by
intro i j hij
by_contra h
have : 1 ≤ ‖f i - f j‖ := h'f h
simp only [hij, norm_zero, sub_self] at this
exact lt_irrefl _ (this.trans_lt zero_lt_one)
let s := Finset.image f Finset.univ
have s_card : s.card = N := by rw [Finset.card_image_of_injective _ finj]; exact Finset.card_fin N
have hs : ∀ c ∈ s, ‖c‖ ≤ 2 := by
simp only [s, hf, forall_apply_eq_imp_iff, forall_const, forall_exists_index, Finset.mem_univ,
Finset.mem_image, true_and]
have h's : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → 1 ≤ ‖c - d‖ := by
simp only [s, forall_apply_eq_imp_iff, forall_exists_index, Finset.mem_univ, Finset.mem_image,
Ne, exists_true_left, forall_apply_eq_imp_iff, forall_true_left, true_and]
intro i j hij
have : i ≠ j := fun h => by rw [h] at hij; exact hij rfl
exact h'f this
have : s.card ≤ multiplicity E := card_le_multiplicity hs h's
rw [s_card, hN] at this
exact lt_irrefl _ ((Nat.lt_succ_self (multiplicity E)).trans_le this)
| [
" s.card ≤ 5 ^ finrank ℝ E",
" 0 < ρ",
" (↑s).Pairwise (Disjoint on fun c => ball c δ)",
" (Disjoint on fun c => ball c δ) c d",
" δ + δ ≤ dist c d",
" δ + δ ≤ ‖c - d‖",
" δ + δ = 1",
" A ⊆ ball 0 ρ",
" ball x δ ⊆ ball 0 ρ",
" δ + dist x 0 ≤ ρ",
" δ + dist x 0 ≤ δ + 2",
" δ + ‖x‖ ≤ δ + 2",
"... | [
" s.card ≤ 5 ^ finrank ℝ E",
" 0 < ρ",
" (↑s).Pairwise (Disjoint on fun c => ball c δ)",
" (Disjoint on fun c => ball c δ) c d",
" δ + δ ≤ dist c d",
" δ + δ ≤ ‖c - d‖",
" δ + δ = 1",
" A ⊆ ball 0 ρ",
" ball x δ ⊆ ball 0 ρ",
" δ + dist x 0 ≤ ρ",
" δ + dist x 0 ≤ δ + 2",
" δ + ‖x‖ ≤ δ + 2",
"... |
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Limits.Cones
#align_import category_theory.limits.is_limit from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da"
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Functor Opposite
namespace CategoryTheory.Limits
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
variable {J : Type u₁} [Category.{v₁} J] {K : Type u₂} [Category.{v₂} K]
variable {C : Type u₃} [Category.{v₃} C]
variable {F : J ⥤ C}
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure IsLimit (t : Cone F) where
lift : ∀ s : Cone F, s.pt ⟶ t.pt
fac : ∀ (s : Cone F) (j : J), lift s ≫ t.π.app j = s.π.app j := by aesop_cat
uniq : ∀ (s : Cone F) (m : s.pt ⟶ t.pt) (_ : ∀ j : J, m ≫ t.π.app j = s.π.app j), m = lift s := by
aesop_cat
#align category_theory.limits.is_limit CategoryTheory.Limits.IsLimit
#align category_theory.limits.is_limit.fac' CategoryTheory.Limits.IsLimit.fac
#align category_theory.limits.is_limit.uniq' CategoryTheory.Limits.IsLimit.uniq
-- Porting note (#10618): simp can prove this. Linter complains it still exists
attribute [-simp, nolint simpNF] IsLimit.mk.injEq
attribute [reassoc (attr := simp)] IsLimit.fac
namespace IsLimit
instance subsingleton {t : Cone F} : Subsingleton (IsLimit t) :=
⟨by intro P Q; cases P; cases Q; congr; aesop_cat⟩
#align category_theory.limits.is_limit.subsingleton CategoryTheory.Limits.IsLimit.subsingleton
def map {F G : J ⥤ C} (s : Cone F) {t : Cone G} (P : IsLimit t) (α : F ⟶ G) : s.pt ⟶ t.pt :=
P.lift ((Cones.postcompose α).obj s)
#align category_theory.limits.is_limit.map CategoryTheory.Limits.IsLimit.map
@[reassoc (attr := simp)]
theorem map_π {F G : J ⥤ C} (c : Cone F) {d : Cone G} (hd : IsLimit d) (α : F ⟶ G) (j : J) :
hd.map c α ≫ d.π.app j = c.π.app j ≫ α.app j :=
fac _ _ _
#align category_theory.limits.is_limit.map_π CategoryTheory.Limits.IsLimit.map_π
@[simp]
theorem lift_self {c : Cone F} (t : IsLimit c) : t.lift c = 𝟙 c.pt :=
(t.uniq _ _ fun _ => id_comp _).symm
#align category_theory.limits.is_limit.lift_self CategoryTheory.Limits.IsLimit.lift_self
-- Repackaging the definition in terms of cone morphisms.
@[simps]
def liftConeMorphism {t : Cone F} (h : IsLimit t) (s : Cone F) : s ⟶ t where hom := h.lift s
#align category_theory.limits.is_limit.lift_cone_morphism CategoryTheory.Limits.IsLimit.liftConeMorphism
| Mathlib/CategoryTheory/Limits/IsLimit.lean | 101 | 104 | theorem uniq_cone_morphism {s t : Cone F} (h : IsLimit t) {f f' : s ⟶ t} : f = f' :=
have : ∀ {g : s ⟶ t}, g = h.liftConeMorphism s := by |
intro g; apply ConeMorphism.ext; exact h.uniq _ _ g.w
this.trans this.symm
| [
" ∀ (a b : IsLimit t), a = b",
" P = Q",
" { lift := lift✝, fac := fac✝, uniq := uniq✝ } = Q",
" { lift := lift✝¹, fac := fac✝¹, uniq := uniq✝¹ } = { lift := lift✝, fac := fac✝, uniq := uniq✝ }",
" lift✝¹ = lift✝",
" ∀ {g : s ⟶ t}, g = h.liftConeMorphism s",
" g = h.liftConeMorphism s",
" g.hom = (h.l... | [
" ∀ (a b : IsLimit t), a = b",
" P = Q",
" { lift := lift✝, fac := fac✝, uniq := uniq✝ } = Q",
" { lift := lift✝¹, fac := fac✝¹, uniq := uniq✝¹ } = { lift := lift✝, fac := fac✝, uniq := uniq✝ }",
" lift✝¹ = lift✝"
] |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL2
#align_import measure_theory.function.conditional_expectation.condexp_L1 from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α β F F' G G' 𝕜 : Type*} {p : ℝ≥0∞} [RCLike 𝕜]
-- 𝕜 for ℝ or ℂ
-- F for a Lp submodule
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
-- F' for integrals on a Lp submodule
[NormedAddCommGroup F']
[NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F']
-- G for a Lp add_subgroup
[NormedAddCommGroup G]
-- G' for integrals on a Lp add_subgroup
[NormedAddCommGroup G']
[NormedSpace ℝ G'] [CompleteSpace G']
section CondexpInd
variable {m m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α} [NormedSpace ℝ G]
section CondexpIndL1Fin
set_option linter.uppercaseLean3 false
def condexpIndL1Fin (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hs : MeasurableSet s) (hμs : μ s ≠ ∞)
(x : G) : α →₁[μ] G :=
(integrable_condexpIndSMul hm hs hμs x).toL1 _
#align measure_theory.condexp_ind_L1_fin MeasureTheory.condexpIndL1Fin
theorem condexpIndL1Fin_ae_eq_condexpIndSMul (hm : m ≤ m0) [SigmaFinite (μ.trim hm)]
(hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x : G) :
condexpIndL1Fin hm hs hμs x =ᵐ[μ] condexpIndSMul hm hs hμs x :=
(integrable_condexpIndSMul hm hs hμs x).coeFn_toL1
#align measure_theory.condexp_ind_L1_fin_ae_eq_condexp_ind_smul MeasureTheory.condexpIndL1Fin_ae_eq_condexpIndSMul
variable {hm : m ≤ m0} [SigmaFinite (μ.trim hm)]
-- Porting note: this lemma fills the hole in `refine' (Memℒp.coeFn_toLp _) ...`
-- which is not automatically filled in Lean 4
private theorem q {hs : MeasurableSet s} {hμs : μ s ≠ ∞} {x : G} :
Memℒp (condexpIndSMul hm hs hμs x) 1 μ := by
rw [memℒp_one_iff_integrable]; apply integrable_condexpIndSMul
theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
condexpIndL1Fin hm hs hμs (x + y) =
condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y := by
ext1
refine (Memℒp.coeFn_toLp q).trans ?_
refine EventuallyEq.trans ?_ (Lp.coeFn_add _ _).symm
refine EventuallyEq.trans ?_
(EventuallyEq.add (Memℒp.coeFn_toLp q).symm (Memℒp.coeFn_toLp q).symm)
rw [condexpIndSMul_add]
refine (Lp.coeFn_add _ _).trans (eventually_of_forall fun a => ?_)
rfl
#align measure_theory.condexp_ind_L1_fin_add MeasureTheory.condexpIndL1Fin_add
theorem condexpIndL1Fin_smul (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (c : ℝ) (x : G) :
condexpIndL1Fin hm hs hμs (c • x) = c • condexpIndL1Fin hm hs hμs x := by
ext1
refine (Memℒp.coeFn_toLp q).trans ?_
refine EventuallyEq.trans ?_ (Lp.coeFn_smul _ _).symm
rw [condexpIndSMul_smul hs hμs c x]
refine (Lp.coeFn_smul _ _).trans ?_
refine (condexpIndL1Fin_ae_eq_condexpIndSMul hm hs hμs x).mono fun y hy => ?_
simp only [Pi.smul_apply, hy]
#align measure_theory.condexp_ind_L1_fin_smul MeasureTheory.condexpIndL1Fin_smul
theorem condexpIndL1Fin_smul' [NormedSpace ℝ F] [SMulCommClass ℝ 𝕜 F] (hs : MeasurableSet s)
(hμs : μ s ≠ ∞) (c : 𝕜) (x : F) :
condexpIndL1Fin hm hs hμs (c • x) = c • condexpIndL1Fin hm hs hμs x := by
ext1
refine (Memℒp.coeFn_toLp q).trans ?_
refine EventuallyEq.trans ?_ (Lp.coeFn_smul _ _).symm
rw [condexpIndSMul_smul' hs hμs c x]
refine (Lp.coeFn_smul _ _).trans ?_
refine (condexpIndL1Fin_ae_eq_condexpIndSMul hm hs hμs x).mono fun y hy => ?_
simp only [Pi.smul_apply, hy]
#align measure_theory.condexp_ind_L1_fin_smul' MeasureTheory.condexpIndL1Fin_smul'
| Mathlib/MeasureTheory/Function/ConditionalExpectation/CondexpL1.lean | 128 | 143 | theorem norm_condexpIndL1Fin_le (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x : G) :
‖condexpIndL1Fin hm hs hμs x‖ ≤ (μ s).toReal * ‖x‖ := by |
have : 0 ≤ ∫ a : α, ‖condexpIndL1Fin hm hs hμs x a‖ ∂μ := by positivity
rw [L1.norm_eq_integral_norm, ← ENNReal.toReal_ofReal (norm_nonneg x), ← ENNReal.toReal_mul, ←
ENNReal.toReal_ofReal this,
ENNReal.toReal_le_toReal ENNReal.ofReal_ne_top (ENNReal.mul_ne_top hμs ENNReal.ofReal_ne_top),
ofReal_integral_norm_eq_lintegral_nnnorm]
swap; · rw [← memℒp_one_iff_integrable]; exact Lp.memℒp _
have h_eq :
∫⁻ a, ‖condexpIndL1Fin hm hs hμs x a‖₊ ∂μ = ∫⁻ a, ‖condexpIndSMul hm hs hμs x a‖₊ ∂μ := by
refine lintegral_congr_ae ?_
refine (condexpIndL1Fin_ae_eq_condexpIndSMul hm hs hμs x).mono fun z hz => ?_
dsimp only
rw [hz]
rw [h_eq, ofReal_norm_eq_coe_nnnorm]
exact lintegral_nnnorm_condexpIndSMul_le hm hs hμs x
| [
" Memℒp (↑↑(condexpIndSMul hm hs hμs x)) 1 μ",
" Integrable (↑↑(condexpIndSMul hm hs hμs x)) μ",
" condexpIndL1Fin hm hs hμs (x + y) = condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y",
" ↑↑(condexpIndL1Fin hm hs hμs (x + y)) =ᶠ[ae μ] ↑↑(condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y)",
... | [
" Memℒp (↑↑(condexpIndSMul hm hs hμs x)) 1 μ",
" Integrable (↑↑(condexpIndSMul hm hs hμs x)) μ",
" condexpIndL1Fin hm hs hμs (x + y) = condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y",
" ↑↑(condexpIndL1Fin hm hs hμs (x + y)) =ᶠ[ae μ] ↑↑(condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y)",
... |
import Mathlib.Algebra.BigOperators.Group.Finset
#align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace Nat
variable {ι : Type*}
theorem coprime_list_prod_left_iff {l : List ℕ} {k : ℕ} :
Coprime l.prod k ↔ ∀ n ∈ l, Coprime n k := by
induction l <;> simp [Nat.coprime_mul_iff_left, *]
| Mathlib/Data/Nat/GCD/BigOperators.lean | 24 | 26 | theorem coprime_list_prod_right_iff {k : ℕ} {l : List ℕ} :
Coprime k l.prod ↔ ∀ n ∈ l, Coprime k n := by |
simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff]
| [
" l.prod.Coprime k ↔ ∀ n ∈ l, n.Coprime k",
" [].prod.Coprime k ↔ ∀ n ∈ [], n.Coprime k",
" (head✝ :: tail✝).prod.Coprime k ↔ ∀ n ∈ head✝ :: tail✝, n.Coprime k",
" k.Coprime l.prod ↔ ∀ n ∈ l, k.Coprime n"
] | [
" l.prod.Coprime k ↔ ∀ n ∈ l, n.Coprime k",
" [].prod.Coprime k ↔ ∀ n ∈ [], n.Coprime k",
" (head✝ :: tail✝).prod.Coprime k ↔ ∀ n ∈ head✝ :: tail✝, n.Coprime k"
] |
import Mathlib.Data.Set.Image
import Mathlib.Data.List.GetD
#align_import data.set.list from "leanprover-community/mathlib"@"2ec920d35348cb2d13ac0e1a2ad9df0fdf1a76b4"
open List
variable {α β : Type*} (l : List α)
namespace Set
| Mathlib/Data/Set/List.lean | 24 | 30 | theorem range_list_map (f : α → β) : range (map f) = { l | ∀ x ∈ l, x ∈ range f } := by |
refine antisymm (range_subset_iff.2 fun l => forall_mem_map_iff.2 fun y _ => mem_range_self _)
fun l hl => ?_
induction' l with a l ihl; · exact ⟨[], rfl⟩
rcases ihl fun x hx => hl x <| subset_cons _ _ hx with ⟨l, rfl⟩
rcases hl a (mem_cons_self _ _) with ⟨a, rfl⟩
exact ⟨a :: l, map_cons _ _ _⟩
| [
" range (map f) = {l | ∀ x ∈ l, x ∈ range f}",
" l ∈ range (map f)",
" [] ∈ range (map f)",
" a :: l ∈ range (map f)",
" a :: map f l ∈ range (map f)",
" f a :: map f l ∈ range (map f)"
] | [] |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
⟨⟨default, default, default, default⟩⟩
instance [Zero R] : Zero (Cubic R) :=
⟨⟨0, 0, 0, 0⟩⟩
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by
rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (∀ n > 3, P.toPoly.coeff n = 0) ∧ P.toPoly.coeff 3 = P.a ∧
P.toPoly.coeff 2 = P.b ∧ P.toPoly.coeff 1 = P.c ∧ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : ℕ} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [← coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 124 | 124 | theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by | rw [← coeff_eq_b, h, coeff_eq_b]
| [
" C w * (X - C x) * (X - C y) * (X - C z) =\n { a := w, b := w * -(x + y + z), c := w * (x * y + x * z + y * z), d := w * -(x * y * z) }.toPoly",
" C w * (X - C x) * (X - C y) * (X - C z) =\n C w * X ^ 3 + C w * -(C x + C y + C z) * X ^ 2 + C w * (C x * C y + C x * C z + C y * C z) * X +\n C w * -(C x ... | [
" C w * (X - C x) * (X - C y) * (X - C z) =\n { a := w, b := w * -(x + y + z), c := w * (x * y + x * z + y * z), d := w * -(x * y * z) }.toPoly",
" C w * (X - C x) * (X - C y) * (X - C z) =\n C w * X ^ 3 + C w * -(C x + C y + C z) * X ^ 2 + C w * (C x * C y + C x * C z + C y * C z) * X +\n C w * -(C x ... |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section NoZeroDivisors
variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]}
theorem irreducible_of_monic (hp : p.Monic) (hp1 : p ≠ 1) :
Irreducible p ↔ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1 := by
refine
⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h =>
⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg =>
(h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp
(isUnit_of_mul_eq_one f _)
(isUnit_of_mul_eq_one g _)⟩⟩
· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic]
· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic]
· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one,
mul_comm, ← hfg]
#align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic
theorem Monic.irreducible_iff_natDegree (hp : p.Monic) :
Irreducible p ↔
p ≠ 1 ∧ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = 0 := by
by_cases hp1 : p = 1; · simp [hp1]
rw [irreducible_of_monic hp hp1, and_iff_right hp1]
refine forall₄_congr fun a b ha hb => ?_
rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one]
#align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree
theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p ≠ 1 ∧
∀ f g : R[X], f.Monic → g.Monic → f * g = p → g.natDegree ∉ Ioc 0 (p.natDegree / 2) := by
simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two]
apply and_congr_right'
constructor <;> intro h f g hf hg he <;> subst he
· rw [hf.natDegree_mul hg, add_le_add_iff_right]
exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne'
· simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h
contrapose! h
obtain hl | hl := le_total f.natDegree g.natDegree
· exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩
· exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩
#align polynomial.monic.irreducible_iff_nat_degree' Polynomial.Monic.irreducible_iff_natDegree'
theorem Monic.irreducible_iff_lt_natDegree_lt {p : R[X]} (hp : p.Monic) (hp1 : p ≠ 1) :
Irreducible p ↔ ∀ q, Monic q → natDegree q ∈ Finset.Ioc 0 (natDegree p / 2) → ¬ q ∣ p := by
rw [hp.irreducible_iff_natDegree', and_iff_right hp1]
constructor
· rintro h g hg hdg ⟨f, rfl⟩
exact h f g (hg.of_mul_monic_left hp) hg (mul_comm f g) hdg
· rintro h f g - hg rfl hdg
exact h g hg hdg (dvd_mul_left g f)
| Mathlib/Algebra/Polynomial/RingDivision.lean | 293 | 316 | theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd : p.natDegree = 2) :
¬Irreducible p ↔ ∃ c₁ c₂, p.coeff 0 = c₁ * c₂ ∧ p.coeff 1 = c₁ + c₂ := by |
cases subsingleton_or_nontrivial R
· simp [natDegree_of_subsingleton] at hnd
rw [hm.irreducible_iff_natDegree', and_iff_right, hnd]
· push_neg
constructor
· rintro ⟨a, b, ha, hb, rfl, hdb⟩
simp only [zero_lt_two, Nat.div_self, ge_iff_le,
Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb
have hda := hnd
rw [ha.natDegree_mul hb, hdb] at hda
use a.coeff 0, b.coeff 0, mul_coeff_zero a b
simpa only [nextCoeff, hnd, add_right_cancel hda, hdb] using ha.nextCoeff_mul hb
· rintro ⟨c₁, c₂, hmul, hadd⟩
refine
⟨X + C c₁, X + C c₂, monic_X_add_C _, monic_X_add_C _, ?_, ?_⟩
· rw [p.as_sum_range_C_mul_X_pow, hnd, Finset.sum_range_succ, Finset.sum_range_succ,
Finset.sum_range_one, ← hnd, hm.coeff_natDegree, hnd, hmul, hadd, C_mul, C_add, C_1]
ring
· rw [mem_Ioc, natDegree_X_add_C _]
simp
· rintro rfl
simp [natDegree_one] at hnd
| [
" Irreducible p ↔ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1",
" (g * C f.leadingCoeff).Monic",
" (f * C g.leadingCoeff).Monic",
" g * C f.leadingCoeff * (f * C g.leadingCoeff) = p",
" Irreducible p ↔ p ≠ 1 ∧ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = ... | [
" Irreducible p ↔ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1",
" (g * C f.leadingCoeff).Monic",
" (f * C g.leadingCoeff).Monic",
" g * C f.leadingCoeff * (f * C g.leadingCoeff) = p",
" Irreducible p ↔ p ≠ 1 ∧ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = ... |
import Mathlib.Algebra.Order.CauSeq.Basic
#align_import data.real.cau_seq_completion from "leanprover-community/mathlib"@"cf4c49c445991489058260d75dae0ff2b1abca28"
namespace CauSeq.Completion
open CauSeq
section
variable {α : Type*} [LinearOrderedField α]
variable {β : Type*} [Ring β] (abv : β → α) [IsAbsoluteValue abv]
-- TODO: rename this to `CauSeq.Completion` instead of `CauSeq.Completion.Cauchy`.
def Cauchy :=
@Quotient (CauSeq _ abv) CauSeq.equiv
set_option linter.uppercaseLean3 false in
#align cau_seq.completion.Cauchy CauSeq.Completion.Cauchy
variable {abv}
def mk : CauSeq _ abv → Cauchy abv :=
Quotient.mk''
#align cau_seq.completion.mk CauSeq.Completion.mk
@[simp]
theorem mk_eq_mk (f : CauSeq _ abv) : @Eq (Cauchy abv) ⟦f⟧ (mk f) :=
rfl
#align cau_seq.completion.mk_eq_mk CauSeq.Completion.mk_eq_mk
theorem mk_eq {f g : CauSeq _ abv} : mk f = mk g ↔ f ≈ g :=
Quotient.eq
#align cau_seq.completion.mk_eq CauSeq.Completion.mk_eq
def ofRat (x : β) : Cauchy abv :=
mk (const abv x)
#align cau_seq.completion.of_rat CauSeq.Completion.ofRat
instance : Zero (Cauchy abv) :=
⟨ofRat 0⟩
instance : One (Cauchy abv) :=
⟨ofRat 1⟩
instance : Inhabited (Cauchy abv) :=
⟨0⟩
theorem ofRat_zero : (ofRat 0 : Cauchy abv) = 0 :=
rfl
#align cau_seq.completion.of_rat_zero CauSeq.Completion.ofRat_zero
theorem ofRat_one : (ofRat 1 : Cauchy abv) = 1 :=
rfl
#align cau_seq.completion.of_rat_one CauSeq.Completion.ofRat_one
@[simp]
| Mathlib/Algebra/Order/CauSeq/Completion.lean | 73 | 75 | theorem mk_eq_zero {f : CauSeq _ abv} : mk f = 0 ↔ LimZero f := by |
have : mk f = 0 ↔ LimZero (f - 0) := Quotient.eq
rwa [sub_zero] at this
| [
" mk f = 0 ↔ f.LimZero"
] | [] |
import Mathlib.Algebra.Quaternion
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Topology.Algebra.Algebra
#align_import analysis.quaternion from "leanprover-community/mathlib"@"07992a1d1f7a4176c6d3f160209608be4e198566"
@[inherit_doc] scoped[Quaternion] notation "ℍ" => Quaternion ℝ
open scoped RealInnerProductSpace
namespace Quaternion
instance : Inner ℝ ℍ :=
⟨fun a b => (a * star b).re⟩
theorem inner_self (a : ℍ) : ⟪a, a⟫ = normSq a :=
rfl
#align quaternion.inner_self Quaternion.inner_self
theorem inner_def (a b : ℍ) : ⟪a, b⟫ = (a * star b).re :=
rfl
#align quaternion.inner_def Quaternion.inner_def
noncomputable instance : NormedAddCommGroup ℍ :=
@InnerProductSpace.Core.toNormedAddCommGroup ℝ ℍ _ _ _
{ toInner := inferInstance
conj_symm := fun x y => by simp [inner_def, mul_comm]
nonneg_re := fun x => normSq_nonneg
definite := fun x => normSq_eq_zero.1
add_left := fun x y z => by simp only [inner_def, add_mul, add_re]
smul_left := fun x y r => by simp [inner_def] }
noncomputable instance : InnerProductSpace ℝ ℍ :=
InnerProductSpace.ofCore _
theorem normSq_eq_norm_mul_self (a : ℍ) : normSq a = ‖a‖ * ‖a‖ := by
rw [← inner_self, real_inner_self_eq_norm_mul_norm]
#align quaternion.norm_sq_eq_norm_sq Quaternion.normSq_eq_norm_mul_self
instance : NormOneClass ℍ :=
⟨by rw [norm_eq_sqrt_real_inner, inner_self, normSq.map_one, Real.sqrt_one]⟩
@[simp, norm_cast]
theorem norm_coe (a : ℝ) : ‖(a : ℍ)‖ = ‖a‖ := by
rw [norm_eq_sqrt_real_inner, inner_self, normSq_coe, Real.sqrt_sq_eq_abs, Real.norm_eq_abs]
#align quaternion.norm_coe Quaternion.norm_coe
@[simp, norm_cast]
theorem nnnorm_coe (a : ℝ) : ‖(a : ℍ)‖₊ = ‖a‖₊ :=
Subtype.ext <| norm_coe a
#align quaternion.nnnorm_coe Quaternion.nnnorm_coe
@[simp, nolint simpNF] -- Porting note (#10959): simp cannot prove this
| Mathlib/Analysis/Quaternion.lean | 83 | 84 | theorem norm_star (a : ℍ) : ‖star a‖ = ‖a‖ := by |
simp_rw [norm_eq_sqrt_real_inner, inner_self, normSq_star]
| [
" (starRingEnd ℝ) ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ",
" ⟪x + y, z⟫_ℝ = ⟪x, z⟫_ℝ + ⟪y, z⟫_ℝ",
" ⟪r • x, y⟫_ℝ = (starRingEnd ℝ) r * ⟪x, y⟫_ℝ",
" normSq a = ‖a‖ * ‖a‖",
" ‖1‖ = 1",
" ‖↑a‖ = ‖a‖",
" ‖star a‖ = ‖a‖"
] | [
" (starRingEnd ℝ) ⟪y, x⟫_ℝ = ⟪x, y⟫_ℝ",
" ⟪x + y, z⟫_ℝ = ⟪x, z⟫_ℝ + ⟪y, z⟫_ℝ",
" ⟪r • x, y⟫_ℝ = (starRingEnd ℝ) r * ⟪x, y⟫_ℝ",
" normSq a = ‖a‖ * ‖a‖",
" ‖1‖ = 1",
" ‖↑a‖ = ‖a‖"
] |
import Mathlib.Data.List.Chain
#align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
variable {α : Type*} (l : List α) (R : α → α → Prop) [DecidableRel R] {a b : α}
namespace List
@[simp]
theorem destutter'_nil : destutter' R a [] = [a] :=
rfl
#align list.destutter'_nil List.destutter'_nil
theorem destutter'_cons :
(b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l :=
rfl
#align list.destutter'_cons List.destutter'_cons
variable {R}
@[simp]
theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by
rw [destutter', if_pos h]
#align list.destutter'_cons_pos List.destutter'_cons_pos
@[simp]
theorem destutter'_cons_neg (h : ¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by
rw [destutter', if_neg h]
#align list.destutter'_cons_neg List.destutter'_cons_neg
variable (R)
@[simp]
theorem destutter'_singleton : [b].destutter' R a = if R a b then [a, b] else [a] := by
split_ifs with h <;> simp! [h]
#align list.destutter'_singleton List.destutter'_singleton
theorem destutter'_sublist (a) : l.destutter' R a <+ a :: l := by
induction' l with b l hl generalizing a
· simp
rw [destutter']
split_ifs
· exact Sublist.cons₂ a (hl b)
· exact (hl a).trans ((l.sublist_cons b).cons_cons a)
#align list.destutter'_sublist List.destutter'_sublist
| Mathlib/Data/List/Destutter.lean | 73 | 79 | theorem mem_destutter' (a) : a ∈ l.destutter' R a := by |
induction' l with b l hl
· simp
rw [destutter']
split_ifs
· simp
· assumption
| [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l",
" destutter' R a [b] = if R a b then [a, b] else [a]",
" destutter' R a [b] = [a, b]",
" destutter' R a [b] = [a]",
" destutter' R a l <+ a :: l",
" destutter' R a [] <+ [a]",
" destutter' R a (b :: l) <... | [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l",
" destutter' R a [b] = if R a b then [a, b] else [a]",
" destutter' R a [b] = [a, b]",
" destutter' R a [b] = [a]",
" destutter' R a l <+ a :: l",
" destutter' R a [] <+ [a]",
" destutter' R a (b :: l) <... |
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Defs
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
variable {α : Type*}
open Opposite
namespace Set
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
| Mathlib/Data/Set/Opposite.lean | 39 | 39 | theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by | rfl
| [
" { unop := a } ∈ s.op ↔ a ∈ s"
] | [] |
import Mathlib.Data.Finsupp.Defs
#align_import data.list.to_finsupp from "leanprover-community/mathlib"@"06a655b5fcfbda03502f9158bbf6c0f1400886f9"
namespace List
variable {M : Type*} [Zero M] (l : List M) [DecidablePred (getD l · 0 ≠ 0)] (n : ℕ)
def toFinsupp : ℕ →₀ M where
toFun i := getD l i 0
support := (Finset.range l.length).filter fun i => getD l i 0 ≠ 0
mem_support_toFun n := by
simp only [Ne, Finset.mem_filter, Finset.mem_range, and_iff_right_iff_imp]
contrapose!
exact getD_eq_default _ _
#align list.to_finsupp List.toFinsupp
@[norm_cast]
theorem coe_toFinsupp : (l.toFinsupp : ℕ → M) = (l.getD · 0) :=
rfl
#align list.coe_to_finsupp List.coe_toFinsupp
@[simp, norm_cast]
theorem toFinsupp_apply (i : ℕ) : (l.toFinsupp : ℕ → M) i = l.getD i 0 :=
rfl
#align list.to_finsupp_apply List.toFinsupp_apply
theorem toFinsupp_support :
l.toFinsupp.support = (Finset.range l.length).filter (getD l · 0 ≠ 0) :=
rfl
#align list.to_finsupp_support List.toFinsupp_support
theorem toFinsupp_apply_lt (hn : n < l.length) : l.toFinsupp n = l.get ⟨n, hn⟩ :=
getD_eq_get _ _ _
theorem toFinsupp_apply_fin (n : Fin l.length) : l.toFinsupp n = l.get n :=
getD_eq_get _ _ _
set_option linter.deprecated false in
@[deprecated (since := "2023-04-10")]
theorem toFinsupp_apply_lt' (hn : n < l.length) : l.toFinsupp n = l.nthLe n hn :=
getD_eq_get _ _ _
#align list.to_finsupp_apply_lt List.toFinsupp_apply_lt'
theorem toFinsupp_apply_le (hn : l.length ≤ n) : l.toFinsupp n = 0 :=
getD_eq_default _ _ hn
#align list.to_finsupp_apply_le List.toFinsupp_apply_le
@[simp]
theorem toFinsupp_nil [DecidablePred fun i => getD ([] : List M) i 0 ≠ 0] :
toFinsupp ([] : List M) = 0 := by
ext
simp
#align list.to_finsupp_nil List.toFinsupp_nil
theorem toFinsupp_singleton (x : M) [DecidablePred (getD [x] · 0 ≠ 0)] :
toFinsupp [x] = Finsupp.single 0 x := by
ext ⟨_ | i⟩ <;> simp [Finsupp.single_apply, (Nat.zero_lt_succ _).ne]
#align list.to_finsupp_singleton List.toFinsupp_singleton
@[simp]
theorem toFinsupp_cons_apply_zero (x : M) (xs : List M)
[DecidablePred (getD (x::xs) · 0 ≠ 0)] : (x::xs).toFinsupp 0 = x :=
rfl
#align list.to_finsupp_cons_apply_zero List.toFinsupp_cons_apply_zero
@[simp]
theorem toFinsupp_cons_apply_succ (x : M) (xs : List M) (n : ℕ)
[DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] :
(x::xs).toFinsupp n.succ = xs.toFinsupp n :=
rfl
#align list.to_finsupp_cons_apply_succ List.toFinsupp_cons_apply_succ
-- Porting note (#10756): new theorem
theorem toFinsupp_append {R : Type*} [AddZeroClass R] (l₁ l₂ : List R)
[DecidablePred (getD (l₁ ++ l₂) · 0 ≠ 0)] [DecidablePred (getD l₁ · 0 ≠ 0)]
[DecidablePred (getD l₂ · 0 ≠ 0)] :
toFinsupp (l₁ ++ l₂) =
toFinsupp l₁ + (toFinsupp l₂).embDomain (addLeftEmbedding l₁.length) := by
ext n
simp only [toFinsupp_apply, Finsupp.add_apply]
cases lt_or_le n l₁.length with
| inl h =>
rw [getD_append _ _ _ _ h, Finsupp.embDomain_notin_range, add_zero]
rintro ⟨k, rfl : length l₁ + k = n⟩
omega
| inr h =>
rcases Nat.exists_eq_add_of_le h with ⟨k, rfl⟩
rw [getD_append_right _ _ _ _ h, Nat.add_sub_cancel_left, getD_eq_default _ _ h, zero_add]
exact Eq.symm (Finsupp.embDomain_apply _ _ _)
theorem toFinsupp_cons_eq_single_add_embDomain {R : Type*} [AddZeroClass R] (x : R) (xs : List R)
[DecidablePred (getD (x::xs) · 0 ≠ 0)] [DecidablePred (getD xs · 0 ≠ 0)] :
toFinsupp (x::xs) =
Finsupp.single 0 x + (toFinsupp xs).embDomain ⟨Nat.succ, Nat.succ_injective⟩ := by
classical
convert toFinsupp_append [x] xs using 3
· exact (toFinsupp_singleton x).symm
· ext n
exact add_comm n 1
#align list.to_finsupp_cons_eq_single_add_emb_domain List.toFinsupp_cons_eq_single_add_embDomain
| Mathlib/Data/List/ToFinsupp.lean | 139 | 143 | theorem toFinsupp_concat_eq_toFinsupp_add_single {R : Type*} [AddZeroClass R] (x : R) (xs : List R)
[DecidablePred fun i => getD (xs ++ [x]) i 0 ≠ 0] [DecidablePred fun i => getD xs i 0 ≠ 0] :
toFinsupp (xs ++ [x]) = toFinsupp xs + Finsupp.single xs.length x := by |
classical rw [toFinsupp_append, toFinsupp_singleton, Finsupp.embDomain_single,
addLeftEmbedding_apply, add_zero]
| [
" n ∈ Finset.filter (fun i => l.getD i 0 ≠ 0) (Finset.range l.length) ↔ (fun i => l.getD i 0) n ≠ 0",
" ¬l.getD n 0 = 0 → n < l.length",
" l.length ≤ n → l.getD n 0 = 0",
" [].toFinsupp = 0",
" [].toFinsupp a✝ = 0 a✝",
" [x].toFinsupp = Finsupp.single 0 x",
" [x].toFinsupp 0 = (Finsupp.single 0 x) 0",
... | [
" n ∈ Finset.filter (fun i => l.getD i 0 ≠ 0) (Finset.range l.length) ↔ (fun i => l.getD i 0) n ≠ 0",
" ¬l.getD n 0 = 0 → n < l.length",
" l.length ≤ n → l.getD n 0 = 0",
" [].toFinsupp = 0",
" [].toFinsupp a✝ = 0 a✝",
" [x].toFinsupp = Finsupp.single 0 x",
" [x].toFinsupp 0 = (Finsupp.single 0 x) 0",
... |
import Mathlib.Algebra.Group.Nat
import Mathlib.Algebra.Order.Sub.Canonical
import Mathlib.Data.List.Perm
import Mathlib.Data.Set.List
import Mathlib.Init.Quot
import Mathlib.Order.Hom.Basic
#align_import data.multiset.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
universe v
open List Subtype Nat Function
variable {α : Type*} {β : Type v} {γ : Type*}
def Multiset.{u} (α : Type u) : Type u :=
Quotient (List.isSetoid α)
#align multiset Multiset
namespace Multiset
-- Porting note: new
@[coe]
def ofList : List α → Multiset α :=
Quot.mk _
instance : Coe (List α) (Multiset α) :=
⟨ofList⟩
@[simp]
theorem quot_mk_to_coe (l : List α) : @Eq (Multiset α) ⟦l⟧ l :=
rfl
#align multiset.quot_mk_to_coe Multiset.quot_mk_to_coe
@[simp]
theorem quot_mk_to_coe' (l : List α) : @Eq (Multiset α) (Quot.mk (· ≈ ·) l) l :=
rfl
#align multiset.quot_mk_to_coe' Multiset.quot_mk_to_coe'
@[simp]
theorem quot_mk_to_coe'' (l : List α) : @Eq (Multiset α) (Quot.mk Setoid.r l) l :=
rfl
#align multiset.quot_mk_to_coe'' Multiset.quot_mk_to_coe''
@[simp]
theorem coe_eq_coe {l₁ l₂ : List α} : (l₁ : Multiset α) = l₂ ↔ l₁ ~ l₂ :=
Quotient.eq
#align multiset.coe_eq_coe Multiset.coe_eq_coe
-- Porting note: new instance;
-- Porting note (#11215): TODO: move to better place
instance [DecidableEq α] (l₁ l₂ : List α) : Decidable (l₁ ≈ l₂) :=
inferInstanceAs (Decidable (l₁ ~ l₂))
-- Porting note: `Quotient.recOnSubsingleton₂ s₁ s₂` was in parens which broke elaboration
instance decidableEq [DecidableEq α] : DecidableEq (Multiset α)
| s₁, s₂ => Quotient.recOnSubsingleton₂ s₁ s₂ fun _ _ => decidable_of_iff' _ Quotient.eq
#align multiset.has_decidable_eq Multiset.decidableEq
protected
def sizeOf [SizeOf α] (s : Multiset α) : ℕ :=
(Quot.liftOn s SizeOf.sizeOf) fun _ _ => Perm.sizeOf_eq_sizeOf
#align multiset.sizeof Multiset.sizeOf
instance [SizeOf α] : SizeOf (Multiset α) :=
⟨Multiset.sizeOf⟩
protected def zero : Multiset α :=
@nil α
#align multiset.zero Multiset.zero
instance : Zero (Multiset α) :=
⟨Multiset.zero⟩
instance : EmptyCollection (Multiset α) :=
⟨0⟩
instance inhabitedMultiset : Inhabited (Multiset α) :=
⟨0⟩
#align multiset.inhabited_multiset Multiset.inhabitedMultiset
instance [IsEmpty α] : Unique (Multiset α) where
default := 0
uniq := by rintro ⟨_ | ⟨a, l⟩⟩; exacts [rfl, isEmptyElim a]
@[simp]
theorem coe_nil : (@nil α : Multiset α) = 0 :=
rfl
#align multiset.coe_nil Multiset.coe_nil
@[simp]
theorem empty_eq_zero : (∅ : Multiset α) = 0 :=
rfl
#align multiset.empty_eq_zero Multiset.empty_eq_zero
@[simp]
theorem coe_eq_zero (l : List α) : (l : Multiset α) = 0 ↔ l = [] :=
Iff.trans coe_eq_coe perm_nil
#align multiset.coe_eq_zero Multiset.coe_eq_zero
theorem coe_eq_zero_iff_isEmpty (l : List α) : (l : Multiset α) = 0 ↔ l.isEmpty :=
Iff.trans (coe_eq_zero l) isEmpty_iff_eq_nil.symm
#align multiset.coe_eq_zero_iff_empty Multiset.coe_eq_zero_iff_isEmpty
def cons (a : α) (s : Multiset α) : Multiset α :=
Quot.liftOn s (fun l => (a :: l : Multiset α)) fun _ _ p => Quot.sound (p.cons a)
#align multiset.cons Multiset.cons
@[inherit_doc Multiset.cons]
infixr:67 " ::ₘ " => Multiset.cons
instance : Insert α (Multiset α) :=
⟨cons⟩
@[simp]
theorem insert_eq_cons (a : α) (s : Multiset α) : insert a s = a ::ₘ s :=
rfl
#align multiset.insert_eq_cons Multiset.insert_eq_cons
@[simp]
theorem cons_coe (a : α) (l : List α) : (a ::ₘ l : Multiset α) = (a :: l : List α) :=
rfl
#align multiset.cons_coe Multiset.cons_coe
@[simp]
theorem cons_inj_left {a b : α} (s : Multiset α) : a ::ₘ s = b ::ₘ s ↔ a = b :=
⟨Quot.inductionOn s fun l e =>
have : [a] ++ l ~ [b] ++ l := Quotient.exact e
singleton_perm_singleton.1 <| (perm_append_right_iff _).1 this,
congr_arg (· ::ₘ _)⟩
#align multiset.cons_inj_left Multiset.cons_inj_left
@[simp]
| Mathlib/Data/Multiset/Basic.lean | 157 | 158 | theorem cons_inj_right (a : α) : ∀ {s t : Multiset α}, a ::ₘ s = a ::ₘ t ↔ s = t := by |
rintro ⟨l₁⟩ ⟨l₂⟩; simp
| [
" ∀ (a : Multiset α), a = default",
" Quot.mk Setoid.r (a :: l) = default",
" ∀ {s t : Multiset α}, a ::ₘ s = a ::ₘ t ↔ s = t",
" a ::ₘ Quot.mk Setoid.r l₁ = a ::ₘ Quot.mk Setoid.r l₂ ↔ Quot.mk Setoid.r l₁ = Quot.mk Setoid.r l₂"
] | [
" ∀ (a : Multiset α), a = default",
" Quot.mk Setoid.r (a :: l) = default"
] |
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
| Mathlib/Data/List/Intervals.lean | 130 | 132 | 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
| [
" Ico 0 n = range n",
" (Ico n m).length = m - n",
" (range' n (m - n)).length = m - n",
" Pairwise (fun x x_1 => x < x_1) (Ico n m)",
" Pairwise (fun x x_1 => x < x_1) (range' n (m - n))",
" (Ico n m).Nodup",
" (range' n (m - n)).Nodup",
" l ∈ Ico n m ↔ n ≤ l ∧ l < m",
" n ≤ l ∧ l < n + (m - n) ↔ n... | [
" Ico 0 n = range n",
" (Ico n m).length = m - n",
" (range' n (m - n)).length = m - n",
" Pairwise (fun x x_1 => x < x_1) (Ico n m)",
" Pairwise (fun x x_1 => x < x_1) (range' n (m - n))",
" (Ico n m).Nodup",
" (range' n (m - n)).Nodup",
" l ∈ Ico n m ↔ n ≤ l ∧ l < m",
" n ≤ l ∧ l < n + (m - n) ↔ n... |
import Mathlib.Data.Set.Card
import Mathlib.Order.Minimal
import Mathlib.Data.Matroid.Init
set_option autoImplicit true
open Set
def Matroid.ExchangeProperty {α : Type _} (P : Set α → Prop) : Prop :=
∀ X Y, P X → P Y → ∀ a ∈ X \ Y, ∃ b ∈ Y \ X, P (insert b (X \ {a}))
def Matroid.ExistsMaximalSubsetProperty {α : Type _} (P : Set α → Prop) (X : Set α) : Prop :=
∀ I, P I → I ⊆ X → (maximals (· ⊆ ·) {Y | P Y ∧ I ⊆ Y ∧ Y ⊆ X}).Nonempty
@[ext] structure Matroid (α : Type _) where
(E : Set α)
(Base : Set α → Prop)
(Indep : Set α → Prop)
(indep_iff' : ∀ ⦃I⦄, Indep I ↔ ∃ B, Base B ∧ I ⊆ B)
(exists_base : ∃ B, Base B)
(base_exchange : Matroid.ExchangeProperty Base)
(maximality : ∀ X, X ⊆ E → Matroid.ExistsMaximalSubsetProperty Indep X)
(subset_ground : ∀ B, Base B → B ⊆ E)
namespace Matroid
variable {α : Type*} {M : Matroid α}
protected class Finite (M : Matroid α) : Prop where
(ground_finite : M.E.Finite)
protected class Nonempty (M : Matroid α) : Prop where
(ground_nonempty : M.E.Nonempty)
theorem ground_nonempty (M : Matroid α) [M.Nonempty] : M.E.Nonempty :=
Nonempty.ground_nonempty
theorem ground_nonempty_iff (M : Matroid α) : M.E.Nonempty ↔ M.Nonempty :=
⟨fun h ↦ ⟨h⟩, fun ⟨h⟩ ↦ h⟩
theorem ground_finite (M : Matroid α) [M.Finite] : M.E.Finite :=
Finite.ground_finite
theorem set_finite (M : Matroid α) [M.Finite] (X : Set α) (hX : X ⊆ M.E := by aesop) : X.Finite :=
M.ground_finite.subset hX
instance finite_of_finite [Finite α] {M : Matroid α} : M.Finite :=
⟨Set.toFinite _⟩
class FiniteRk (M : Matroid α) : Prop where
exists_finite_base : ∃ B, M.Base B ∧ B.Finite
instance finiteRk_of_finite (M : Matroid α) [M.Finite] : FiniteRk M :=
⟨M.exists_base.imp (fun B hB ↦ ⟨hB, M.set_finite B (M.subset_ground _ hB)⟩)⟩
class InfiniteRk (M : Matroid α) : Prop where
exists_infinite_base : ∃ B, M.Base B ∧ B.Infinite
class RkPos (M : Matroid α) : Prop where
empty_not_base : ¬M.Base ∅
theorem rkPos_iff_empty_not_base : M.RkPos ↔ ¬M.Base ∅ :=
⟨fun ⟨h⟩ ↦ h, fun h ↦ ⟨h⟩⟩
section exchange
namespace ExchangeProperty
variable {Base : Set α → Prop} (exch : ExchangeProperty Base)
theorem antichain (hB : Base B) (hB' : Base B') (h : B ⊆ B') : B = B' :=
h.antisymm (fun x hx ↦ by_contra
(fun hxB ↦ let ⟨_, hy, _⟩ := exch B' B hB' hB x ⟨hx, hxB⟩; hy.2 <| h hy.1))
| Mathlib/Data/Matroid/Basic.lean | 268 | 286 | theorem encard_diff_le_aux (exch : ExchangeProperty Base) (hB₁ : Base B₁) (hB₂ : Base B₂) :
(B₁ \ B₂).encard ≤ (B₂ \ B₁).encard := by |
obtain (he | hinf | ⟨e, he, hcard⟩) :=
(B₂ \ B₁).eq_empty_or_encard_eq_top_or_encard_diff_singleton_lt
· rw [exch.antichain hB₂ hB₁ (diff_eq_empty.mp he)]
· exact le_top.trans_eq hinf.symm
obtain ⟨f, hf, hB'⟩ := exch B₂ B₁ hB₂ hB₁ e he
have : encard (insert f (B₂ \ {e}) \ B₁) < encard (B₂ \ B₁) := by
rw [insert_diff_of_mem _ hf.1, diff_diff_comm]; exact hcard
have hencard := encard_diff_le_aux exch hB₁ hB'
rw [insert_diff_of_mem _ hf.1, diff_diff_comm, ← union_singleton, ← diff_diff, diff_diff_right,
inter_singleton_eq_empty.mpr he.2, union_empty] at hencard
rw [← encard_diff_singleton_add_one he, ← encard_diff_singleton_add_one hf]
exact add_le_add_right hencard 1
termination_by (B₂ \ B₁).encard
| [
" (B₁ \\ B₂).encard ≤ (B₂ \\ B₁).encard",
" (insert f (B₂ \\ {e}) \\ B₁).encard < (B₂ \\ B₁).encard",
" ((B₂ \\ B₁) \\ {e}).encard < (B₂ \\ B₁).encard",
" ((B₁ \\ B₂) \\ {f}).encard + 1 ≤ ((B₂ \\ B₁) \\ {e}).encard + 1"
] | [] |
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
import Mathlib.CategoryTheory.Limits.Preserves.Limits
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v u₁ u₂
variable (C : Type u₁) [Category.{v} C] {C' : Type u₂} [Category.{v} C']
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
structure GlueData where
J : Type v
U : J → C
V : J × J → C
f : ∀ i j, V (i, j) ⟶ U i
f_mono : ∀ i j, Mono (f i j) := by infer_instance
f_hasPullback : ∀ i j k, HasPullback (f i j) (f i k) := by infer_instance
f_id : ∀ i, IsIso (f i i) := by infer_instance
t : ∀ i j, V (i, j) ⟶ V (j, i)
t_id : ∀ i, t i i = 𝟙 _
t' : ∀ i j k, pullback (f i j) (f i k) ⟶ pullback (f j k) (f j i)
t_fac : ∀ i j k, t' i j k ≫ pullback.snd = pullback.fst ≫ t i j
cocycle : ∀ i j k, t' i j k ≫ t' j k i ≫ t' k i j = 𝟙 _
#align category_theory.glue_data CategoryTheory.GlueData
attribute [simp] GlueData.t_id
attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback
attribute [reassoc] GlueData.t_fac GlueData.cocycle
namespace GlueData
variable {C}
variable (D : GlueData C)
@[simp]
theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by
have eq₁ := D.t_fac i i j
have eq₂ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _)
rw [D.t_id, Category.comp_id, eq₂] at eq₁
have eq₃ := (IsIso.eq_comp_inv (D.f i i)).mp eq₁
rw [Category.assoc, ← pullback.condition, ← Category.assoc] at eq₃
exact
Mono.right_cancellation _ _
((Mono.right_cancellation _ _ eq₃).trans (pullbackSymmetry_hom_comp_fst _ _).symm)
#align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij
theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii
theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd := by
rw [← Category.assoc, ← D.t_fac]
simp
#align category_theory.glue_data.t'_iji CategoryTheory.GlueData.t'_iji
@[reassoc, elementwise (attr := simp)]
theorem t_inv (i j : D.J) : D.t i j ≫ D.t j i = 𝟙 _ := by
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd ≫ inv pullback.fst := by simp
have := D.cocycle i j i
rw [D.t'_iij, D.t'_jii, D.t'_iji, fst_eq_snd_of_mono_eq, eq] at this
simp only [Category.assoc, IsIso.inv_hom_id_assoc] at this
rw [← IsIso.eq_inv_comp, ← Category.assoc, IsIso.comp_inv_eq] at this
simpa using this
#align category_theory.glue_data.t_inv CategoryTheory.GlueData.t_inv
| Mathlib/CategoryTheory/GlueData.lean | 108 | 111 | theorem t'_inv (i j k : D.J) :
D.t' i j k ≫ (pullbackSymmetry _ _).hom ≫ D.t' j i k ≫ (pullbackSymmetry _ _).hom = 𝟙 _ := by |
rw [← cancel_mono (pullback.fst : pullback (D.f i j) (D.f i k) ⟶ _)]
simp [t_fac, t_fac_assoc]
| [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd",
" D.t' j i i = (D.t' j i i ≫ pullback.snd) ≫ inv pullback.snd",
" D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd",
" D.t' i j i = (D.t' i j i ≫ pullback.snd) ≫ inv pullback.snd",
... | [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd",
" D.t' j i i = (D.t' j i i ≫ pullback.snd) ≫ inv pullback.snd",
" D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd",
" D.t' i j i = (D.t' i j i ≫ pullback.snd) ≫ inv pullback.snd",
... |
import Mathlib.Data.Int.Bitwise
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import linear_algebra.matrix.zpow from "leanprover-community/mathlib"@"03fda9112aa6708947da13944a19310684bfdfcb"
open Matrix
namespace Matrix
variable {n' : Type*} [DecidableEq n'] [Fintype n'] {R : Type*} [CommRing R]
local notation "M" => Matrix n' n' R
noncomputable instance : DivInvMonoid M :=
{ show Monoid M by infer_instance, show Inv M by infer_instance with }
section ZPow
open Int
@[simp]
theorem one_zpow : ∀ n : ℤ, (1 : M) ^ n = 1
| (n : ℕ) => by rw [zpow_natCast, one_pow]
| -[n+1] => by rw [zpow_negSucc, one_pow, inv_one]
#align matrix.one_zpow Matrix.one_zpow
theorem zero_zpow : ∀ z : ℤ, z ≠ 0 → (0 : M) ^ z = 0
| (n : ℕ), h => by
rw [zpow_natCast, zero_pow]
exact mod_cast h
| -[n+1], _ => by simp [zero_pow n.succ_ne_zero]
#align matrix.zero_zpow Matrix.zero_zpow
| Mathlib/LinearAlgebra/Matrix/ZPow.lean | 92 | 95 | theorem zero_zpow_eq (n : ℤ) : (0 : M) ^ n = if n = 0 then 1 else 0 := by |
split_ifs with h
· rw [h, zpow_zero]
· rw [zero_zpow _ h]
| [
" Monoid M",
" Inv M",
" 1 ^ ↑n = 1",
" 1 ^ -[n+1] = 1",
" 0 ^ ↑n = 0",
" n ≠ 0",
" 0 ^ -[n+1] = 0",
" 0 ^ n = if n = 0 then 1 else 0",
" 0 ^ n = 1",
" 0 ^ n = 0"
] | [
" Monoid M",
" Inv M",
" 1 ^ ↑n = 1",
" 1 ^ -[n+1] = 1",
" 0 ^ ↑n = 0",
" n ≠ 0",
" 0 ^ -[n+1] = 0"
] |
import Mathlib.Topology.Category.TopCat.Opens
import Mathlib.Data.Set.Subsingleton
#align_import topology.category.Top.open_nhds from "leanprover-community/mathlib"@"1ec4876214bf9f1ddfbf97ae4b0d777ebd5d6938"
open CategoryTheory TopologicalSpace Opposite
universe u
variable {X Y : TopCat.{u}} (f : X ⟶ Y)
namespace TopologicalSpace
def OpenNhds (x : X) :=
FullSubcategory fun U : Opens X => x ∈ U
#align topological_space.open_nhds TopologicalSpace.OpenNhds
namespace OpenNhds
instance partialOrder (x : X) : PartialOrder (OpenNhds x) where
le U V := U.1 ≤ V.1
le_refl _ := by dsimp [LE.le]; exact le_rfl
le_trans _ _ _ := by dsimp [LE.le]; exact le_trans
le_antisymm _ _ i j := FullSubcategory.ext _ _ <| le_antisymm i j
instance (x : X) : Lattice (OpenNhds x) :=
{ OpenNhds.partialOrder x with
inf := fun U V => ⟨U.1 ⊓ V.1, ⟨U.2, V.2⟩⟩
le_inf := fun U V W => @le_inf _ _ U.1.1 V.1.1 W.1.1
inf_le_left := fun U V => @inf_le_left _ _ U.1.1 V.1.1
inf_le_right := fun U V => @inf_le_right _ _ U.1.1 V.1.1
sup := fun U V => ⟨U.1 ⊔ V.1, Set.mem_union_left V.1.1 U.2⟩
sup_le := fun U V W => @sup_le _ _ U.1.1 V.1.1 W.1.1
le_sup_left := fun U V => @le_sup_left _ _ U.1.1 V.1.1
le_sup_right := fun U V => @le_sup_right _ _ U.1.1 V.1.1 }
instance (x : X) : OrderTop (OpenNhds x) where
top := ⟨⊤, trivial⟩
le_top _ := by dsimp [LE.le]; exact le_top
instance (x : X) : Inhabited (OpenNhds x) :=
⟨⊤⟩
instance openNhdsCategory (x : X) : Category.{u} (OpenNhds x) := inferInstance
#align topological_space.open_nhds.open_nhds_category TopologicalSpace.OpenNhds.openNhdsCategory
instance opensNhdsHomHasCoeToFun {x : X} {U V : OpenNhds x} : CoeFun (U ⟶ V) fun _ => U.1 → V.1 :=
⟨fun f x => ⟨x, f.le x.2⟩⟩
#align topological_space.open_nhds.opens_nhds_hom_has_coe_to_fun TopologicalSpace.OpenNhds.opensNhdsHomHasCoeToFun
def infLELeft {x : X} (U V : OpenNhds x) : U ⊓ V ⟶ U :=
homOfLE inf_le_left
#align topological_space.open_nhds.inf_le_left TopologicalSpace.OpenNhds.infLELeft
def infLERight {x : X} (U V : OpenNhds x) : U ⊓ V ⟶ V :=
homOfLE inf_le_right
#align topological_space.open_nhds.inf_le_right TopologicalSpace.OpenNhds.infLERight
def inclusion (x : X) : OpenNhds x ⥤ Opens X :=
fullSubcategoryInclusion _
#align topological_space.open_nhds.inclusion TopologicalSpace.OpenNhds.inclusion
@[simp]
theorem inclusion_obj (x : X) (U) (p) : (inclusion x).obj ⟨U, p⟩ = U :=
rfl
#align topological_space.open_nhds.inclusion_obj TopologicalSpace.OpenNhds.inclusion_obj
theorem openEmbedding {x : X} (U : OpenNhds x) : OpenEmbedding U.1.inclusion :=
U.1.openEmbedding
#align topological_space.open_nhds.open_embedding TopologicalSpace.OpenNhds.openEmbedding
def map (x : X) : OpenNhds (f x) ⥤ OpenNhds x where
obj U := ⟨(Opens.map f).obj U.1, U.2⟩
map i := (Opens.map f).map i
#align topological_space.open_nhds.map TopologicalSpace.OpenNhds.map
-- Porting note: Changed `⟨(Opens.map f).obj U, by tidy⟩` to `⟨(Opens.map f).obj U, q⟩`
@[simp]
theorem map_obj (x : X) (U) (q) : (map f x).obj ⟨U, q⟩ = ⟨(Opens.map f).obj U, q⟩ :=
rfl
#align topological_space.open_nhds.map_obj TopologicalSpace.OpenNhds.map_obj
@[simp]
theorem map_id_obj (x : X) (U) : (map (𝟙 X) x).obj U = U := rfl
#align topological_space.open_nhds.map_id_obj TopologicalSpace.OpenNhds.map_id_obj
@[simp]
theorem map_id_obj' (x : X) (U) (p) (q) : (map (𝟙 X) x).obj ⟨⟨U, p⟩, q⟩ = ⟨⟨U, p⟩, q⟩ :=
rfl
#align topological_space.open_nhds.map_id_obj' TopologicalSpace.OpenNhds.map_id_obj'
@[simp]
| Mathlib/Topology/Category/TopCat/OpenNhds.lean | 124 | 125 | theorem map_id_obj_unop (x : X) (U : (OpenNhds x)ᵒᵖ) : (map (𝟙 X) x).obj (unop U) = unop U := by |
simp
| [
" x✝ ≤ x✝",
" x✝.obj ≤ x✝.obj",
" x✝² ≤ x✝¹ → x✝¹ ≤ x✝ → x✝² ≤ x✝",
" x✝².obj ≤ x✝¹.obj → x✝¹.obj ≤ x✝.obj → x✝².obj ≤ x✝.obj",
" x✝ ≤ ⊤",
" x✝.obj ≤ ⊤",
" (map (𝟙 X) x).obj U.unop = U.unop"
] | [
" x✝ ≤ x✝",
" x✝.obj ≤ x✝.obj",
" x✝² ≤ x✝¹ → x✝¹ ≤ x✝ → x✝² ≤ x✝",
" x✝².obj ≤ x✝¹.obj → x✝¹.obj ≤ x✝.obj → x✝².obj ≤ x✝.obj",
" x✝ ≤ ⊤",
" x✝.obj ≤ ⊤"
] |
import Mathlib.Algebra.Group.Even
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.GroupWithZero.Hom
import Mathlib.Algebra.Group.Commute.Units
import Mathlib.Algebra.Group.Units.Hom
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Algebra.Ring.Units
#align_import algebra.associated from "leanprover-community/mathlib"@"2f3994e1b117b1e1da49bcfb67334f33460c3ce4"
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
section Prime
variable [CommMonoidWithZero α]
def Prime (p : α) : Prop :=
p ≠ 0 ∧ ¬IsUnit p ∧ ∀ a b, p ∣ a * b → p ∣ a ∨ p ∣ b
#align prime Prime
namespace Prime
variable {p : α} (hp : Prime p)
theorem ne_zero : p ≠ 0 :=
hp.1
#align prime.ne_zero Prime.ne_zero
theorem not_unit : ¬IsUnit p :=
hp.2.1
#align prime.not_unit Prime.not_unit
theorem not_dvd_one : ¬p ∣ 1 :=
mt (isUnit_of_dvd_one ·) hp.not_unit
#align prime.not_dvd_one Prime.not_dvd_one
theorem ne_one : p ≠ 1 := fun h => hp.2.1 (h.symm ▸ isUnit_one)
#align prime.ne_one Prime.ne_one
theorem dvd_or_dvd (hp : Prime p) {a b : α} (h : p ∣ a * b) : p ∣ a ∨ p ∣ b :=
hp.2.2 a b h
#align prime.dvd_or_dvd Prime.dvd_or_dvd
theorem dvd_mul {a b : α} : p ∣ a * b ↔ p ∣ a ∨ p ∣ b :=
⟨hp.dvd_or_dvd, (Or.elim · (dvd_mul_of_dvd_left · _) (dvd_mul_of_dvd_right · _))⟩
theorem isPrimal (hp : Prime p) : IsPrimal p := fun _a _b dvd ↦ (hp.dvd_or_dvd dvd).elim
(fun h ↦ ⟨p, 1, h, one_dvd _, (mul_one p).symm⟩) fun h ↦ ⟨1, p, one_dvd _, h, (one_mul p).symm⟩
theorem not_dvd_mul {a b : α} (ha : ¬ p ∣ a) (hb : ¬ p ∣ b) : ¬ p ∣ a * b :=
hp.dvd_mul.not.mpr <| not_or.mpr ⟨ha, hb⟩
| Mathlib/Algebra/Associated.lean | 77 | 86 | theorem dvd_of_dvd_pow (hp : Prime p) {a : α} {n : ℕ} (h : p ∣ a ^ n) : p ∣ a := by |
induction' n with n ih
· rw [pow_zero] at h
have := isUnit_of_dvd_one h
have := not_unit hp
contradiction
rw [pow_succ'] at h
cases' dvd_or_dvd hp h with dvd_a dvd_pow
· assumption
exact ih dvd_pow
| [
" p ∣ a"
] | [] |
import Mathlib.Topology.Algebra.InfiniteSum.Defs
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Topology.Algebra.Monoid
noncomputable section
open Filter Finset Function
open scoped Topology
variable {α β γ δ : Type*}
section HasProd
variable [CommMonoid α] [TopologicalSpace α]
variable {f g : β → α} {a b : α} {s : Finset β}
@[to_additive "Constant zero function has sum `0`"]
theorem hasProd_one : HasProd (fun _ ↦ 1 : β → α) 1 := by simp [HasProd, tendsto_const_nhds]
#align has_sum_zero hasSum_zero
@[to_additive]
theorem hasProd_empty [IsEmpty β] : HasProd f 1 := by
convert @hasProd_one α β _ _
#align has_sum_empty hasSum_empty
@[to_additive]
theorem multipliable_one : Multipliable (fun _ ↦ 1 : β → α) :=
hasProd_one.multipliable
#align summable_zero summable_zero
@[to_additive]
theorem multipliable_empty [IsEmpty β] : Multipliable f :=
hasProd_empty.multipliable
#align summable_empty summable_empty
@[to_additive]
theorem multipliable_congr (hfg : ∀ b, f b = g b) : Multipliable f ↔ Multipliable g :=
iff_of_eq (congr_arg Multipliable <| funext hfg)
#align summable_congr summable_congr
@[to_additive]
theorem Multipliable.congr (hf : Multipliable f) (hfg : ∀ b, f b = g b) : Multipliable g :=
(multipliable_congr hfg).mp hf
#align summable.congr Summable.congr
@[to_additive]
lemma HasProd.congr_fun (hf : HasProd f a) (h : ∀ x : β, g x = f x) : HasProd g a :=
(funext h : g = f) ▸ hf
@[to_additive]
theorem HasProd.hasProd_of_prod_eq {g : γ → α}
(h_eq : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' →
∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b)
(hf : HasProd g a) : HasProd f a :=
le_trans (map_atTop_finset_prod_le_of_prod_eq h_eq) hf
#align has_sum.has_sum_of_sum_eq HasSum.hasSum_of_sum_eq
@[to_additive]
theorem hasProd_iff_hasProd {g : γ → α}
(h₁ : ∀ u : Finset γ, ∃ v : Finset β, ∀ v', v ⊆ v' →
∃ u', u ⊆ u' ∧ ∏ x ∈ u', g x = ∏ b ∈ v', f b)
(h₂ : ∀ v : Finset β, ∃ u : Finset γ, ∀ u', u ⊆ u' →
∃ v', v ⊆ v' ∧ ∏ b ∈ v', f b = ∏ x ∈ u', g x) :
HasProd f a ↔ HasProd g a :=
⟨HasProd.hasProd_of_prod_eq h₂, HasProd.hasProd_of_prod_eq h₁⟩
#align has_sum_iff_has_sum hasSum_iff_hasSum
@[to_additive]
theorem Function.Injective.multipliable_iff {g : γ → β} (hg : Injective g)
(hf : ∀ x ∉ Set.range g, f x = 1) : Multipliable (f ∘ g) ↔ Multipliable f :=
exists_congr fun _ ↦ hg.hasProd_iff hf
#align function.injective.summable_iff Function.Injective.summable_iff
@[to_additive (attr := simp)] theorem hasProd_extend_one {g : β → γ} (hg : Injective g) :
HasProd (extend g f 1) a ↔ HasProd f a := by
rw [← hg.hasProd_iff, extend_comp hg]
exact extend_apply' _ _
@[to_additive (attr := simp)] theorem multipliable_extend_one {g : β → γ} (hg : Injective g) :
Multipliable (extend g f 1) ↔ Multipliable f :=
exists_congr fun _ ↦ hasProd_extend_one hg
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Basic.lean | 101 | 104 | theorem hasProd_subtype_iff_mulIndicator {s : Set β} :
HasProd (f ∘ (↑) : s → α) a ↔ HasProd (s.mulIndicator f) a := by |
rw [← Set.mulIndicator_range_comp, Subtype.range_coe,
hasProd_subtype_iff_of_mulSupport_subset Set.mulSupport_mulIndicator_subset]
| [
" HasProd (fun x => 1) 1",
" HasProd f 1",
" HasProd (extend g f 1) a ↔ HasProd f a",
" ∀ x ∉ Set.range g, extend g f 1 x = 1",
" HasProd (f ∘ Subtype.val) a ↔ HasProd (s.mulIndicator f) a"
] | [
" HasProd (fun x => 1) 1",
" HasProd f 1",
" HasProd (extend g f 1) a ↔ HasProd f a",
" ∀ x ∉ Set.range g, extend g f 1 x = 1"
] |
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
| Mathlib/Algebra/MvPolynomial/Variables.lean | 146 | 154 | 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
| [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = ∅",
" ((monomial s) r).vars = s.support",
" (C r).vars = ∅",
" (X n).vars = {n}",
" i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support",
" x v = 0",
" v ∈ f.vars",
" (p + q).vars ⊆ p.vars ∪ q.vars",
" x ∈ p.vars ∪ q.... | [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = ∅",
" ((monomial s) r).vars = s.support",
" (C r).vars = ∅",
" (X n).vars = {n}",
" i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support",
" x v = 0",
" v ∈ f.vars",
" (p + q).vars ⊆ p.vars ∪ q.vars",
" x ∈ p.vars ∪ q.... |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Fin
import Mathlib.GroupTheory.GroupAction.Pi
import Mathlib.Logic.Equiv.Fin
#align_import algebra.big_operators.fin from "leanprover-community/mathlib"@"cc5dd6244981976cc9da7afc4eee5682b037a013"
open Finset
variable {α : Type*} {β : Type*}
namespace Fin
@[to_additive]
theorem prod_ofFn [CommMonoid β] {n : ℕ} (f : Fin n → β) : (List.ofFn f).prod = ∏ i, f i := by
simp [prod_eq_multiset_prod]
#align fin.prod_of_fn Fin.prod_ofFn
#align fin.sum_of_fn Fin.sum_ofFn
@[to_additive]
theorem prod_univ_def [CommMonoid β] {n : ℕ} (f : Fin n → β) :
∏ i, f i = ((List.finRange n).map f).prod := by
rw [← List.ofFn_eq_map, prod_ofFn]
#align fin.prod_univ_def Fin.prod_univ_def
#align fin.sum_univ_def Fin.sum_univ_def
@[to_additive "A sum of a function `f : Fin 0 → β` is `0` because `Fin 0` is empty"]
theorem prod_univ_zero [CommMonoid β] (f : Fin 0 → β) : ∏ i, f i = 1 :=
rfl
#align fin.prod_univ_zero Fin.prod_univ_zero
#align fin.sum_univ_zero Fin.sum_univ_zero
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f x`, for some `x : Fin (n + 1)` plus the remaining product"]
theorem prod_univ_succAbove [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) (x : Fin (n + 1)) :
∏ i, f i = f x * ∏ i : Fin n, f (x.succAbove i) := by
rw [univ_succAbove, prod_cons, Finset.prod_map _ x.succAboveEmb]
rfl
#align fin.prod_univ_succ_above Fin.prod_univ_succAbove
#align fin.sum_univ_succ_above Fin.sum_univ_succAbove
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f 0` plus the remaining product"]
theorem prod_univ_succ [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) :
∏ i, f i = f 0 * ∏ i : Fin n, f i.succ :=
prod_univ_succAbove f 0
#align fin.prod_univ_succ Fin.prod_univ_succ
#align fin.sum_univ_succ Fin.sum_univ_succ
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f (Fin.last n)` plus the remaining sum"]
theorem prod_univ_castSucc [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) :
∏ i, f i = (∏ i : Fin n, f (Fin.castSucc i)) * f (last n) := by
simpa [mul_comm] using prod_univ_succAbove f (last n)
#align fin.prod_univ_cast_succ Fin.prod_univ_castSucc
#align fin.sum_univ_cast_succ Fin.sum_univ_castSucc
@[to_additive (attr := simp)]
theorem prod_univ_get [CommMonoid α] (l : List α) : ∏ i, l.get i = l.prod := by
simp [Finset.prod_eq_multiset_prod]
@[to_additive (attr := simp)]
| Mathlib/Algebra/BigOperators/Fin.lean | 101 | 103 | theorem prod_univ_get' [CommMonoid β] (l : List α) (f : α → β) :
∏ i, f (l.get i) = (l.map f).prod := by |
simp [Finset.prod_eq_multiset_prod]
| [
" (List.ofFn f).prod = ∏ i : Fin n, f i",
" ∏ i : Fin n, f i = (List.map f (List.finRange n)).prod",
" ∏ i : Fin (n + 1), f i = f x * ∏ i : Fin n, f (x.succAbove i)",
" f x * ∏ x_1 : Fin n, f (x.succAboveEmb x_1) = f x * ∏ i : Fin n, f (x.succAbove i)",
" ∏ i : Fin (n + 1), f i = (∏ i : Fin n, f i.castSucc)... | [
" (List.ofFn f).prod = ∏ i : Fin n, f i",
" ∏ i : Fin n, f i = (List.map f (List.finRange n)).prod",
" ∏ i : Fin (n + 1), f i = f x * ∏ i : Fin n, f (x.succAbove i)",
" f x * ∏ x_1 : Fin n, f (x.succAboveEmb x_1) = f x * ∏ i : Fin n, f (x.succAbove i)",
" ∏ i : Fin (n + 1), f i = (∏ i : Fin n, f i.castSucc)... |
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.average MeasureTheory.average
notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r
notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
#align measure_theory.average_zero MeasureTheory.average_zero
@[simp]
theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by
rw [average, smul_zero, integral_zero_measure]
#align measure_theory.average_zero_measure MeasureTheory.average_zero_measure
@[simp]
theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ :=
integral_neg f
#align measure_theory.average_neg MeasureTheory.average_neg
theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ :=
rfl
#align measure_theory.average_eq' MeasureTheory.average_eq'
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
#align measure_theory.average_eq MeasureTheory.average_eq
theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rw [average, measure_univ, inv_one, one_smul]
#align measure_theory.average_eq_integral MeasureTheory.average_eq_integral
@[simp]
theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) :
(μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, integral_zero_measure, average_zero_measure, smul_zero]
· rw [average_eq, smul_inv_smul₀]
refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne'
rwa [Ne, measure_univ_eq_zero]
#align measure_theory.measure_smul_average MeasureTheory.measure_smul_average
theorem setAverage_eq (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by rw [average_eq, restrict_apply_univ]
#align measure_theory.set_average_eq MeasureTheory.setAverage_eq
theorem setAverage_eq' (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [average_eq', restrict_apply_univ]
#align measure_theory.set_average_eq' MeasureTheory.setAverage_eq'
variable {μ}
theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by
simp only [average_eq, integral_congr_ae h]
#align measure_theory.average_congr MeasureTheory.average_congr
theorem setAverage_congr (h : s =ᵐ[μ] t) : ⨍ x in s, f x ∂μ = ⨍ x in t, f x ∂μ := by
simp only [setAverage_eq, setIntegral_congr_set_ae h, measure_congr h]
#align measure_theory.set_average_congr MeasureTheory.setAverage_congr
theorem setAverage_congr_fun (hs : MeasurableSet s) (h : ∀ᵐ x ∂μ, x ∈ s → f x = g x) :
⨍ x in s, f x ∂μ = ⨍ x in s, g x ∂μ := by simp only [average_eq, setIntegral_congr_ae hs h]
#align measure_theory.set_average_congr_fun MeasureTheory.setAverage_congr_fun
| Mathlib/MeasureTheory/Integral/Average.lean | 373 | 380 | theorem average_add_measure [IsFiniteMeasure μ] {ν : Measure α} [IsFiniteMeasure ν] {f : α → E}
(hμ : Integrable f μ) (hν : Integrable f ν) :
⨍ x, f x ∂(μ + ν) =
((μ univ).toReal / ((μ univ).toReal + (ν univ).toReal)) • ⨍ x, f x ∂μ +
((ν univ).toReal / ((μ univ).toReal + (ν univ).toReal)) • ⨍ x, f x ∂ν := by |
simp only [div_eq_inv_mul, mul_smul, measure_smul_average, ← smul_add,
← integral_add_measure hμ hν, ← ENNReal.toReal_add (measure_ne_top μ _) (measure_ne_top ν _)]
rw [average_eq, Measure.add_apply]
| [
" ⨍ (x : α), 0 ∂μ = 0",
" ⨍ (x : α), f x ∂0 = 0",
" ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ",
" ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal ≠ 0",
" μ univ ≠ 0",
" ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ... | [
" ⨍ (x : α), 0 ∂μ = 0",
" ⨍ (x : α), f x ∂0 = 0",
" ⨍ (x : α), f x ∂μ = (μ univ).toReal⁻¹ • ∫ (x : α), f x ∂μ",
" ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal • ⨍ (x : α), f x ∂μ = ∫ (x : α), f x ∂μ",
" (μ univ).toReal ≠ 0",
" μ univ ≠ 0",
" ⨍ (x : α) in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ (x ... |
import Mathlib.Data.Multiset.Nodup
#align_import data.multiset.sum from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Sum
namespace Multiset
variable {α β : Type*} (s : Multiset α) (t : Multiset β)
def disjSum : Multiset (Sum α β) :=
s.map inl + t.map inr
#align multiset.disj_sum Multiset.disjSum
@[simp]
theorem zero_disjSum : (0 : Multiset α).disjSum t = t.map inr :=
zero_add _
#align multiset.zero_disj_sum Multiset.zero_disjSum
@[simp]
theorem disjSum_zero : s.disjSum (0 : Multiset β) = s.map inl :=
add_zero _
#align multiset.disj_sum_zero Multiset.disjSum_zero
@[simp]
| Mathlib/Data/Multiset/Sum.lean | 44 | 45 | theorem card_disjSum : Multiset.card (s.disjSum t) = Multiset.card s + Multiset.card t := by |
rw [disjSum, card_add, card_map, card_map]
| [
" card (s.disjSum t) = card s + card t"
] | [] |
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Tactic.LinearCombination
#align_import ring_theory.polynomial.chebyshev from "leanprover-community/mathlib"@"d774451114d6045faeb6751c396bea1eb9058946"
namespace Polynomial.Chebyshev
set_option linter.uppercaseLean3 false -- `T` `U` `X`
open Polynomial
variable (R S : Type*) [CommRing R] [CommRing S]
-- Well-founded definitions are now irreducible by default;
-- as this was implemented before this change,
-- we just set it back to semireducible to avoid needing to change any proofs.
@[semireducible] noncomputable def T : ℤ → R[X]
| 0 => 1
| 1 => X
| (n : ℕ) + 2 => 2 * X * T (n + 1) - T n
| -((n : ℕ) + 1) => 2 * X * T (-n) - T (-n + 1)
termination_by n => Int.natAbs n + Int.natAbs (n - 1)
#align polynomial.chebyshev.T Polynomial.Chebyshev.T
@[elab_as_elim]
protected theorem induct (motive : ℤ → Prop)
(zero : motive 0)
(one : motive 1)
(add_two : ∀ (n : ℕ), motive (↑n + 1) → motive ↑n → motive (↑n + 2))
(neg_add_one : ∀ (n : ℕ), motive (-↑n) → motive (-↑n + 1) → motive (-↑n - 1)) :
∀ (a : ℤ), motive a :=
T.induct Unit motive zero one add_two fun n hn hnm => by
simpa only [Int.negSucc_eq, neg_add] using neg_add_one n hn hnm
@[simp]
theorem T_add_two : ∀ n, T R (n + 2) = 2 * X * T R (n + 1) - T R n
| (k : ℕ) => T.eq_3 R k
| -(k + 1 : ℕ) => by linear_combination (norm := (simp [Int.negSucc_eq]; ring_nf)) T.eq_4 R k
#align polynomial.chebyshev.T_add_two Polynomial.Chebyshev.T_add_two
theorem T_add_one (n : ℤ) : T R (n + 1) = 2 * X * T R n - T R (n - 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
theorem T_sub_two (n : ℤ) : T R (n - 2) = 2 * X * T R (n - 1) - T R n := by
linear_combination (norm := ring_nf) T_add_two R (n - 2)
theorem T_sub_one (n : ℤ) : T R (n - 1) = 2 * X * T R n - T R (n + 1) := by
linear_combination (norm := ring_nf) T_add_two R (n - 1)
theorem T_eq (n : ℤ) : T R n = 2 * X * T R (n - 1) - T R (n - 2) := by
linear_combination (norm := ring_nf) T_add_two R (n - 2)
#align polynomial.chebyshev.T_of_two_le Polynomial.Chebyshev.T_eq
@[simp]
theorem T_zero : T R 0 = 1 := rfl
#align polynomial.chebyshev.T_zero Polynomial.Chebyshev.T_zero
@[simp]
theorem T_one : T R 1 = X := rfl
#align polynomial.chebyshev.T_one Polynomial.Chebyshev.T_one
theorem T_neg_one : T R (-1) = X := (by ring : 2 * X * 1 - X = X)
theorem T_two : T R 2 = 2 * X ^ 2 - 1 := by
simpa [pow_two, mul_assoc] using T_add_two R 0
#align polynomial.chebyshev.T_two Polynomial.Chebyshev.T_two
@[simp]
theorem T_neg (n : ℤ) : T R (-n) = T R n := by
induction n using Polynomial.Chebyshev.induct with
| zero => rfl
| one => show 2 * X * 1 - X = X; ring
| add_two n ih1 ih2 =>
have h₁ := T_add_two R n
have h₂ := T_sub_two R (-n)
linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 - h₁ + h₂
| neg_add_one n ih1 ih2 =>
have h₁ := T_add_one R n
have h₂ := T_sub_one R (-n)
linear_combination (norm := ring_nf) (2 * (X:R[X])) * ih1 - ih2 + h₁ - h₂
| Mathlib/RingTheory/Polynomial/Chebyshev.lean | 131 | 132 | theorem T_natAbs (n : ℤ) : T R n.natAbs = T R n := by |
obtain h | h := Int.natAbs_eq n <;> nth_rw 2 [h]; simp
| [
" motive (Int.negSucc n)",
" T R (-↑(k + 1) + 2) = 2 * X * T R (-↑(k + 1) + 1) - T R (-↑(k + 1))",
" T R (-↑(k + 1) + 2) - (2 * X * T R (-↑(k + 1) + 1) - T R (-↑(k + 1))) -\n (T R (Int.negSucc k) - (2 * X * T R (-↑k) - T R (-↑k + 1))) =\n 0",
" T R (-1 + -↑k + 2) - (2 * X * T R (-↑k) - T R (-1 + -↑k))... | [
" motive (Int.negSucc n)",
" T R (-↑(k + 1) + 2) = 2 * X * T R (-↑(k + 1) + 1) - T R (-↑(k + 1))",
" T R (-↑(k + 1) + 2) - (2 * X * T R (-↑(k + 1) + 1) - T R (-↑(k + 1))) -\n (T R (Int.negSucc k) - (2 * X * T R (-↑k) - T R (-↑k + 1))) =\n 0",
" T R (-1 + -↑k + 2) - (2 * X * T R (-↑k) - T R (-1 + -↑k))... |
import Mathlib.ModelTheory.Substructures
#align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398"
open FirstOrder Set
namespace FirstOrder
namespace Language
open Structure
variable {L : Language} {M : Type*} [L.Structure M]
namespace Substructure
def FG (N : L.Substructure M) : Prop :=
∃ S : Finset M, closure L S = N
#align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG
theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N :=
⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by
rintro ⟨t', h, rfl⟩
rcases Finite.exists_finset_coe h with ⟨t, rfl⟩
exact ⟨t, rfl⟩⟩
#align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def
theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} :
N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by
rw [fg_def]
constructor
· rintro ⟨S, Sfin, hS⟩
obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding
exact ⟨n, f, hS⟩
· rintro ⟨n, s, hs⟩
exact ⟨range s, finite_range s, hs⟩
#align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family
theorem fg_bot : (⊥ : L.Substructure M).FG :=
⟨∅, by rw [Finset.coe_empty, closure_empty]⟩
#align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot
theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) :=
⟨hs.toFinset, by rw [hs.coe_toFinset]⟩
#align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure
theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) :=
fg_closure (finite_singleton x)
#align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton
theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG :=
let ⟨t₁, ht₁⟩ := fg_def.1 hN₁
let ⟨t₂, ht₂⟩ := fg_def.1 hN₂
fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩
#align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup
theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) :
(s.map f).FG :=
let ⟨t, ht⟩ := fg_def.1 hs
fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩
#align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map
| Mathlib/ModelTheory/FinitelyGenerated.lean | 87 | 98 | theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M}
(hs : (s.map f.toHom).FG) : s.FG := by |
rcases hs with ⟨t, h⟩
rw [fg_def]
refine ⟨f ⁻¹' t, t.finite_toSet.preimage f.injective.injOn, ?_⟩
have hf : Function.Injective f.toHom := f.injective
refine map_injective_of_injective hf ?_
rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
intro x hx
have h' := subset_closure (L := L) hx
rw [h] at h'
exact Hom.map_le_range h'
| [
" (∃ S, S.Finite ∧ (closure L).toFun S = N) → N.FG",
" ((closure L).toFun t').FG",
" ((closure L).toFun ↑t).FG",
" N.FG ↔ ∃ n s, (closure L).toFun (range s) = N",
" (∃ S, S.Finite ∧ (closure L).toFun S = N) ↔ ∃ n s, (closure L).toFun (range s) = N",
" (∃ S, S.Finite ∧ (closure L).toFun S = N) → ∃ n s, (cl... | [
" (∃ S, S.Finite ∧ (closure L).toFun S = N) → N.FG",
" ((closure L).toFun t').FG",
" ((closure L).toFun ↑t).FG",
" N.FG ↔ ∃ n s, (closure L).toFun (range s) = N",
" (∃ S, S.Finite ∧ (closure L).toFun S = N) ↔ ∃ n s, (closure L).toFun (range s) = N",
" (∃ S, S.Finite ∧ (closure L).toFun S = N) → ∃ n s, (cl... |
import Mathlib.Algebra.DirectLimit
import Mathlib.Algebra.CharP.Algebra
import Mathlib.FieldTheory.IsAlgClosed.Basic
import Mathlib.FieldTheory.SplittingField.Construction
#align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87"
universe u v w
noncomputable section
open scoped Classical Polynomial
open Polynomial
variable (k : Type u) [Field k]
namespace AlgebraicClosure
open MvPolynomial
abbrev MonicIrreducible : Type u :=
{ f : k[X] // Monic f ∧ Irreducible f }
#align algebraic_closure.monic_irreducible AlgebraicClosure.MonicIrreducible
def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k :=
Polynomial.eval₂ MvPolynomial.C (X f) f
set_option linter.uppercaseLean3 false in
#align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf
def spanEval : Ideal (MvPolynomial (MonicIrreducible k) k) :=
Ideal.span <| Set.range <| evalXSelf k
#align algebraic_closure.span_eval AlgebraicClosure.spanEval
def toSplittingField (s : Finset (MonicIrreducible k)) :
MvPolynomial (MonicIrreducible k) k →ₐ[k] SplittingField (∏ x ∈ s, x : k[X]) :=
MvPolynomial.aeval fun f =>
if hf : f ∈ s then
rootOfSplits _
((splits_prod_iff _ fun (j : MonicIrreducible k) _ => j.2.2.ne_zero).1
(SplittingField.splits _) f hf)
(mt isUnit_iff_degree_eq_zero.2 f.2.2.not_unit)
else 37
#align algebraic_closure.to_splitting_field AlgebraicClosure.toSplittingField
| Mathlib/FieldTheory/IsAlgClosed/AlgebraicClosure.lean | 77 | 81 | theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f ∈ s) :
toSplittingField k s (evalXSelf k f) = 0 := by |
rw [toSplittingField, evalXSelf, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom,
MvPolynomial.aeval_X, dif_pos hf, ← MvPolynomial.algebraMap_eq, AlgHom.comp_algebraMap]
exact map_rootOfSplits _ _ _
| [
" (toSplittingField k s) (evalXSelf k f) = 0",
" Polynomial.eval₂ (algebraMap k (∏ x ∈ s, ↑x).SplittingField)\n (rootOfSplits (algebraMap k (∏ x ∈ s, ↑x).SplittingField) ⋯ ⋯) ↑f =\n 0"
] | [] |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.AddTorsor
#align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {ι : Type*} {E P : Type*}
open Metric Set
open scoped Convex
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s t : Set E}
theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm :=
⟨hs, fun x _ y _ a b ha hb _ =>
calc
‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _
_ = a * ‖x‖ + b * ‖y‖ := by
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
#align convex_on_norm convexOn_norm
theorem convexOn_univ_norm : ConvexOn ℝ univ (norm : E → ℝ) :=
convexOn_norm convex_univ
#align convex_on_univ_norm convexOn_univ_norm
| Mathlib/Analysis/Convex/Normed.lean | 53 | 55 | theorem convexOn_dist (z : E) (hs : Convex ℝ s) : ConvexOn ℝ s fun z' => dist z' z := by |
simpa [dist_eq_norm, preimage_preimage] using
(convexOn_norm (hs.translate (-z))).comp_affineMap (AffineMap.id ℝ E - AffineMap.const ℝ E z)
| [
" ‖a • x‖ + ‖b • y‖ = a * ‖x‖ + b * ‖y‖",
" ConvexOn ℝ s fun z' => dist z' z"
] | [
" ‖a • x‖ + ‖b • y‖ = a * ‖x‖ + b * ‖y‖"
] |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Complex.Circle
import Mathlib.Analysis.InnerProductSpace.l2Space
import Mathlib.MeasureTheory.Function.ContinuousMapDense
import Mathlib.MeasureTheory.Function.L2Space
import Mathlib.MeasureTheory.Group.Integral
import Mathlib.MeasureTheory.Integral.Periodic
import Mathlib.Topology.ContinuousFunction.StoneWeierstrass
import Mathlib.MeasureTheory.Integral.FundThmCalculus
#align_import analysis.fourier.add_circle from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
open scoped ENNReal ComplexConjugate Real
open TopologicalSpace ContinuousMap MeasureTheory MeasureTheory.Measure Algebra Submodule Set
variable {T : ℝ}
open AddCircle
section Monomials
def fourier (n : ℤ) : C(AddCircle T, ℂ) where
toFun x := toCircle (n • x :)
continuous_toFun := continuous_induced_dom.comp <| continuous_toCircle.comp <| continuous_zsmul _
#align fourier fourier
@[simp]
theorem fourier_apply {n : ℤ} {x : AddCircle T} : fourier n x = toCircle (n • x :) :=
rfl
#align fourier_apply fourier_apply
-- @[simp] -- Porting note: simp normal form is `fourier_coe_apply'`
theorem fourier_coe_apply {n : ℤ} {x : ℝ} :
fourier n (x : AddCircle T) = Complex.exp (2 * π * Complex.I * n * x / T) := by
rw [fourier_apply, ← QuotientAddGroup.mk_zsmul, toCircle, Function.Periodic.lift_coe,
expMapCircle_apply, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_mul, zsmul_eq_mul,
Complex.ofReal_mul, Complex.ofReal_intCast]
norm_num
congr 1; ring
#align fourier_coe_apply fourier_coe_apply
@[simp]
theorem fourier_coe_apply' {n : ℤ} {x : ℝ} :
toCircle (n • (x : AddCircle T) :) = Complex.exp (2 * π * Complex.I * n * x / T) := by
rw [← fourier_apply]; exact fourier_coe_apply
-- @[simp] -- Porting note: simp normal form is `fourier_zero'`
theorem fourier_zero {x : AddCircle T} : fourier 0 x = 1 := by
induction x using QuotientAddGroup.induction_on'
simp only [fourier_coe_apply]
norm_num
#align fourier_zero fourier_zero
@[simp]
theorem fourier_zero' {x : AddCircle T} : @toCircle T 0 = (1 : ℂ) := by
have : fourier 0 x = @toCircle T 0 := by rw [fourier_apply, zero_smul]
rw [← this]; exact fourier_zero
-- @[simp] -- Porting note: simp normal form is *also* `fourier_zero'`
theorem fourier_eval_zero (n : ℤ) : fourier n (0 : AddCircle T) = 1 := by
rw [← QuotientAddGroup.mk_zero, fourier_coe_apply, Complex.ofReal_zero, mul_zero,
zero_div, Complex.exp_zero]
#align fourier_eval_zero fourier_eval_zero
-- @[simp] -- Porting note (#10618): simp can prove this
theorem fourier_one {x : AddCircle T} : fourier 1 x = toCircle x := by rw [fourier_apply, one_zsmul]
#align fourier_one fourier_one
-- @[simp] -- Porting note: simp normal form is `fourier_neg'`
theorem fourier_neg {n : ℤ} {x : AddCircle T} : fourier (-n) x = conj (fourier n x) := by
induction x using QuotientAddGroup.induction_on'
simp_rw [fourier_apply, toCircle]
rw [← QuotientAddGroup.mk_zsmul, ← QuotientAddGroup.mk_zsmul]
simp_rw [Function.Periodic.lift_coe, ← coe_inv_circle_eq_conj, ← expMapCircle_neg,
neg_smul, mul_neg]
#align fourier_neg fourier_neg
@[simp]
theorem fourier_neg' {n : ℤ} {x : AddCircle T} : @toCircle T (-(n • x)) = conj (fourier n x) := by
rw [← neg_smul, ← fourier_apply]; exact fourier_neg
-- @[simp] -- Porting note: simp normal form is `fourier_add'`
theorem fourier_add {m n : ℤ} {x : AddCircle T} : fourier (m+n) x = fourier m x * fourier n x := by
simp_rw [fourier_apply, add_zsmul, toCircle_add, coe_mul_unitSphere]
#align fourier_add fourier_add
@[simp]
| Mathlib/Analysis/Fourier/AddCircle.lean | 172 | 174 | theorem fourier_add' {m n : ℤ} {x : AddCircle T} :
toCircle ((m + n) • x :) = fourier m x * fourier n x := by |
rw [← fourier_apply]; exact fourier_add
| [
" (fourier n) ↑x = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" (↑2 * ↑π / ↑T * (↑n * ↑x) * Complex.I).exp = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" (2 * ↑π / ↑T * (↑n * ↑x) * Complex.I).exp = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" 2 * ↑π / ↑T * (↑n * ↑x) * Complex.I = 2 * ↑π * Complex.I * ↑n * ↑x / ↑... | [
" (fourier n) ↑x = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" (↑2 * ↑π / ↑T * (↑n * ↑x) * Complex.I).exp = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" (2 * ↑π / ↑T * (↑n * ↑x) * Complex.I).exp = (2 * ↑π * Complex.I * ↑n * ↑x / ↑T).exp",
" 2 * ↑π / ↑T * (↑n * ↑x) * Complex.I = 2 * ↑π * Complex.I * ↑n * ↑x / ↑... |
import Mathlib.Topology.IsLocalHomeomorph
import Mathlib.Topology.FiberBundle.Basic
#align_import topology.covering from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
open Bundle
variable {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] (f : E → X) (s : Set X)
def IsEvenlyCovered (x : X) (I : Type*) [TopologicalSpace I] :=
DiscreteTopology I ∧ ∃ t : Trivialization I f, x ∈ t.baseSet
#align is_evenly_covered IsEvenlyCovered
def IsCoveringMapOn :=
∀ x ∈ s, IsEvenlyCovered f x (f ⁻¹' {x})
#align is_covering_map_on IsCoveringMapOn
def IsCoveringMap :=
∀ x, IsEvenlyCovered f x (f ⁻¹' {x})
#align is_covering_map IsCoveringMap
variable {f}
| Mathlib/Topology/Covering.lean | 140 | 141 | theorem isCoveringMap_iff_isCoveringMapOn_univ : IsCoveringMap f ↔ IsCoveringMapOn f Set.univ := by |
simp only [IsCoveringMap, IsCoveringMapOn, Set.mem_univ, forall_true_left]
| [
" IsCoveringMap f ↔ IsCoveringMapOn f Set.univ"
] | [] |
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 TotalDegree
def totalDegree (p : MvPolynomial σ R) : ℕ :=
p.support.sup fun s => s.sum fun _ e => e
#align mv_polynomial.total_degree MvPolynomial.totalDegree
| Mathlib/Algebra/MvPolynomial/Degrees.lean | 358 | 362 | theorem totalDegree_eq (p : MvPolynomial σ R) :
p.totalDegree = p.support.sup fun m => Multiset.card (toMultiset m) := by |
rw [totalDegree]
congr; funext m
exact (Finsupp.card_toMultiset _).symm
| [
" p.totalDegree = p.support.sup fun m => Multiset.card (toMultiset m)",
" (p.support.sup fun s => s.sum fun x e => e) = p.support.sup fun m => Multiset.card (toMultiset m)",
" (fun s => s.sum fun x e => e) = fun m => Multiset.card (toMultiset m)",
" (m.sum fun x e => e) = Multiset.card (toMultiset m)"
] | [] |
import Mathlib.NumberTheory.LegendreSymbol.Basic
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.GaussSum
#align_import number_theory.legendre_symbol.quadratic_reciprocity from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Nat
section Values
variable {p : ℕ} [Fact p.Prime]
open ZMod
namespace legendreSym
variable (hp : p ≠ 2)
theorem at_two : legendreSym p 2 = χ₈ p := by
have : (2 : ZMod p) = (2 : ℤ) := by norm_cast
rw [legendreSym, ← this, quadraticChar_two ((ringChar_zmod_n p).substr hp), card p]
#align legendre_sym.at_two legendreSym.at_two
| Mathlib/NumberTheory/LegendreSymbol/QuadraticReciprocity.lean | 66 | 68 | theorem at_neg_two : legendreSym p (-2) = χ₈' p := by |
have : (-2 : ZMod p) = (-2 : ℤ) := by norm_cast
rw [legendreSym, ← this, quadraticChar_neg_two ((ringChar_zmod_n p).substr hp), card p]
| [
" legendreSym p 2 = χ₈ ↑p",
" 2 = ↑2",
" legendreSym p (-2) = χ₈' ↑p",
" -2 = ↑(-2)"
] | [
" legendreSym p 2 = χ₈ ↑p",
" 2 = ↑2"
] |
import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Ring.Defs
#align_import algebra.euclidean_domain.defs from "leanprover-community/mathlib"@"ee7b9f9a9ac2a8d9f04ea39bbfe6b1a3be053b38"
universe u
class EuclideanDomain (R : Type u) extends CommRing R, Nontrivial R where
protected quotient : R → R → R
protected quotient_zero : ∀ a, quotient a 0 = 0
protected remainder : R → R → R
protected quotient_mul_add_remainder_eq : ∀ a b, b * quotient a b + remainder a b = a
protected r : R → R → Prop
r_wellFounded : WellFounded r
protected remainder_lt : ∀ (a) {b}, b ≠ 0 → r (remainder a b) b
mul_left_not_lt : ∀ (a) {b}, b ≠ 0 → ¬r (a * b) a
#align euclidean_domain EuclideanDomain
#align euclidean_domain.quotient EuclideanDomain.quotient
#align euclidean_domain.quotient_zero EuclideanDomain.quotient_zero
#align euclidean_domain.remainder EuclideanDomain.remainder
#align euclidean_domain.quotient_mul_add_remainder_eq EuclideanDomain.quotient_mul_add_remainder_eq
#align euclidean_domain.r EuclideanDomain.r
#align euclidean_domain.r_well_founded EuclideanDomain.r_wellFounded
#align euclidean_domain.remainder_lt EuclideanDomain.remainder_lt
#align euclidean_domain.mul_left_not_lt EuclideanDomain.mul_left_not_lt
namespace EuclideanDomain
variable {R : Type u} [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.r
local instance wellFoundedRelation : WellFoundedRelation R where
wf := r_wellFounded
-- see Note [lower instance priority]
instance (priority := 70) : Div R :=
⟨EuclideanDomain.quotient⟩
-- see Note [lower instance priority]
instance (priority := 70) : Mod R :=
⟨EuclideanDomain.remainder⟩
theorem div_add_mod (a b : R) : b * (a / b) + a % b = a :=
EuclideanDomain.quotient_mul_add_remainder_eq _ _
#align euclidean_domain.div_add_mod EuclideanDomain.div_add_mod
theorem mod_add_div (a b : R) : a % b + b * (a / b) = a :=
(add_comm _ _).trans (div_add_mod _ _)
#align euclidean_domain.mod_add_div EuclideanDomain.mod_add_div
theorem mod_add_div' (m k : R) : m % k + m / k * k = m := by
rw [mul_comm]
exact mod_add_div _ _
#align euclidean_domain.mod_add_div' EuclideanDomain.mod_add_div'
theorem div_add_mod' (m k : R) : m / k * k + m % k = m := by
rw [mul_comm]
exact div_add_mod _ _
#align euclidean_domain.div_add_mod' EuclideanDomain.div_add_mod'
| Mathlib/Algebra/EuclideanDomain/Defs.lean | 141 | 144 | theorem mod_eq_sub_mul_div {R : Type*} [EuclideanDomain R] (a b : R) : a % b = a - b * (a / b) :=
calc
a % b = b * (a / b) + a % b - b * (a / b) := (add_sub_cancel_left _ _).symm
_ = a - b * (a / b) := by | rw [div_add_mod]
| [
" m % k + m / k * k = m",
" m % k + k * (m / k) = m",
" m / k * k + m % k = m",
" k * (m / k) + m % k = m",
" b * (a / b) + a % b - b * (a / b) = a - b * (a / b)"
] | [
" m % k + m / k * k = m",
" m % k + k * (m / k) = m",
" m / k * k + m % k = m",
" k * (m / k) + m % k = m"
] |
import Mathlib.CategoryTheory.EffectiveEpi.Comp
import Mathlib.Data.Fintype.Card
universe u
namespace CategoryTheory
open Limits
variable {C : Type*} [Category C]
noncomputable section Equivalence
variable {D : Type*} [Category D] (e : C ≌ D) {B : C}
variable {α : Type*} (X : α → C) (π : (a : α) → (X a ⟶ B)) [EffectiveEpiFamily X π]
| Mathlib/CategoryTheory/EffectiveEpi/Preserves.lean | 34 | 42 | theorem effectiveEpiFamilyStructOfEquivalence_aux {W : D} (ε : (a : α) → e.functor.obj (X a) ⟶ W)
(h : ∀ {Z : D} (a₁ a₂ : α) (g₁ : Z ⟶ e.functor.obj (X a₁)) (g₂ : Z ⟶ e.functor.obj (X a₂)),
g₁ ≫ e.functor.map (π a₁) = g₂ ≫ e.functor.map (π a₂) → g₁ ≫ ε a₁ = g₂ ≫ ε a₂)
{Z : C} (a₁ a₂ : α) (g₁ : Z ⟶ X a₁) (g₂ : Z ⟶ X a₂) (hg : g₁ ≫ π a₁ = g₂ ≫ π a₂) :
g₁ ≫ (fun a ↦ e.unit.app (X a) ≫ e.inverse.map (ε a)) a₁ =
g₂ ≫ (fun a ↦ e.unit.app (X a) ≫ e.inverse.map (ε a)) a₂ := by |
have := h a₁ a₂ (e.functor.map g₁) (e.functor.map g₂)
simp only [← Functor.map_comp, hg] at this
simpa using congrArg e.inverse.map (this (by trivial))
| [
" g₁ ≫ (fun a => e.unit.app (X a) ≫ e.inverse.map (ε a)) a₁ = g₂ ≫ (fun a => e.unit.app (X a) ≫ e.inverse.map (ε a)) a₂",
" True"
] | [] |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.LinearAlgebra.PiTensorProduct
universe uι u𝕜 uE uF
variable {ι : Type uι} [Fintype ι]
variable {𝕜 : Type u𝕜} [NontriviallyNormedField 𝕜]
variable {E : ι → Type uE} [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)]
variable {F : Type uF} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F]
open scoped TensorProduct
namespace PiTensorProduct
def projectiveSeminormAux : FreeAddMonoid (𝕜 × Π i, E i) → ℝ :=
List.sum ∘ (List.map (fun p ↦ ‖p.1‖ * ∏ i, ‖p.2 i‖))
theorem projectiveSeminormAux_nonneg (p : FreeAddMonoid (𝕜 × Π i, E i)) :
0 ≤ projectiveSeminormAux p := by
simp only [projectiveSeminormAux, Function.comp_apply]
refine List.sum_nonneg ?_
intro a
simp only [Multiset.map_coe, Multiset.mem_coe, List.mem_map, Prod.exists, forall_exists_index,
and_imp]
intro x m _ h
rw [← h]
exact mul_nonneg (norm_nonneg _) (Finset.prod_nonneg (fun _ _ ↦ norm_nonneg _))
theorem projectiveSeminormAux_add_le (p q : FreeAddMonoid (𝕜 × Π i, E i)) :
projectiveSeminormAux (p + q) ≤ projectiveSeminormAux p + projectiveSeminormAux q := by
simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, Multiset.sum_coe]
erw [List.map_append]
rw [List.sum_append]
rfl
| Mathlib/Analysis/NormedSpace/PiTensorProduct/ProjectiveSeminorm.lean | 73 | 82 | theorem projectiveSeminormAux_smul (p : FreeAddMonoid (𝕜 × Π i, E i)) (a : 𝕜) :
projectiveSeminormAux (List.map (fun (y : 𝕜 × Π i, E i) ↦ (a * y.1, y.2)) p) =
‖a‖ * projectiveSeminormAux p := by |
simp only [projectiveSeminormAux, Function.comp_apply, Multiset.map_coe, List.map_map,
Multiset.sum_coe]
rw [← smul_eq_mul, List.smul_sum, ← List.comp_map]
congr 2
ext x
simp only [Function.comp_apply, norm_mul, smul_eq_mul]
rw [mul_assoc]
| [
" 0 ≤ projectiveSeminormAux p",
" 0 ≤ (List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p).sum",
" ∀ x ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p, 0 ≤ x",
" a ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p → 0 ≤ a",
" ∀ (x : 𝕜) (x_1 : (i : ι) → E i), (x, x_1) ∈ p → ‖x‖ * ∏ x : ι, ‖x_1 x‖ = a → 0 ≤ a",
... | [
" 0 ≤ projectiveSeminormAux p",
" 0 ≤ (List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p).sum",
" ∀ x ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p, 0 ≤ x",
" a ∈ List.map (fun p => ‖p.1‖ * ∏ x : ι, ‖p.2 x‖) p → 0 ≤ a",
" ∀ (x : 𝕜) (x_1 : (i : ι) → E i), (x, x_1) ∈ p → ‖x‖ * ∏ x : ι, ‖x_1 x‖ = a → 0 ≤ a",
... |
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P,
VSub G P where
[nonempty : Nonempty P]
vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor
-- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet
attribute [instance 100] AddTorsor.nonempty
-- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet
--attribute [nolint dangerous_instance] AddTorsor.toVSub
-- Porting note(#12096): linter not ported yet
--@[nolint instance_priority]
instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where
vsub := Sub.sub
vsub_vadd' := sub_add_cancel
vadd_vsub' := add_sub_cancel_right
#align add_group_is_add_torsor addGroupIsAddTorsor
@[simp]
theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ :=
rfl
#align vsub_eq_sub vsub_eq_sub
section General
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
@[simp]
theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ :=
AddTorsor.vsub_vadd' p₁ p₂
#align vsub_vadd vsub_vadd
@[simp]
theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g :=
AddTorsor.vadd_vsub' g p
#align vadd_vsub vadd_vsub
| Mathlib/Algebra/AddTorsor.lean | 98 | 100 | theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by |
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
rw [← vadd_vsub g₁ p, h, vadd_vsub]
| [
" g₁ = g₂"
] | [] |
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]
| Mathlib/Data/Option/NAry.lean | 73 | 74 | theorem map₂_coe_right (f : α → β → γ) (a : Option α) (b : β) :
map₂ f a b = a.map fun a => f a b := by | cases a <;> rfl
| [
" map₂ f a b = Seq.seq (f <$> a) fun x => b",
" map₂ f none b = Seq.seq (f <$> none) fun x => b",
" map₂ f (some val✝) b = Seq.seq (f <$> some val✝) fun x => b",
" map₂ f a none = none",
" map₂ f none none = none",
" map₂ f (some val✝) none = none",
" map₂ f a (some b) = Option.map (fun a => f a b) a",
... | [
" map₂ f a b = Seq.seq (f <$> a) fun x => b",
" map₂ f none b = Seq.seq (f <$> none) fun x => b",
" map₂ f (some val✝) b = Seq.seq (f <$> some val✝) fun x => b",
" map₂ f a none = none",
" map₂ f none none = none",
" map₂ f (some val✝) none = none"
] |
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.projective_space.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable (K V : Type*) [DivisionRing K] [AddCommGroup V] [Module K V]
def projectivizationSetoid : Setoid { v : V // v ≠ 0 } :=
(MulAction.orbitRel Kˣ V).comap (↑)
#align projectivization_setoid projectivizationSetoid
def Projectivization := Quotient (projectivizationSetoid K V)
#align projectivization Projectivization
scoped[LinearAlgebra.Projectivization] notation "ℙ" => Projectivization
namespace Projectivization
open scoped LinearAlgebra.Projectivization
variable {V}
def mk (v : V) (hv : v ≠ 0) : ℙ K V :=
Quotient.mk'' ⟨v, hv⟩
#align projectivization.mk Projectivization.mk
def mk' (v : { v : V // v ≠ 0 }) : ℙ K V :=
Quotient.mk'' v
#align projectivization.mk' Projectivization.mk'
@[simp]
theorem mk'_eq_mk (v : { v : V // v ≠ 0 }) : mk' K v = mk K ↑v v.2 := rfl
#align projectivization.mk'_eq_mk Projectivization.mk'_eq_mk
instance [Nontrivial V] : Nonempty (ℙ K V) :=
let ⟨v, hv⟩ := exists_ne (0 : V)
⟨mk K v hv⟩
variable {K}
protected noncomputable def rep (v : ℙ K V) : V :=
v.out'
#align projectivization.rep Projectivization.rep
theorem rep_nonzero (v : ℙ K V) : v.rep ≠ 0 :=
v.out'.2
#align projectivization.rep_nonzero Projectivization.rep_nonzero
@[simp]
theorem mk_rep (v : ℙ K V) : mk K v.rep v.rep_nonzero = v := Quotient.out_eq' _
#align projectivization.mk_rep Projectivization.mk_rep
open FiniteDimensional
protected def submodule (v : ℙ K V) : Submodule K V :=
(Quotient.liftOn' v fun v => K ∙ (v : V)) <| by
rintro ⟨a, ha⟩ ⟨b, hb⟩ ⟨x, rfl : x • b = a⟩
exact Submodule.span_singleton_group_smul_eq _ x _
#align projectivization.submodule Projectivization.submodule
variable (K)
theorem mk_eq_mk_iff (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) :
mk K v hv = mk K w hw ↔ ∃ a : Kˣ, a • w = v :=
Quotient.eq''
#align projectivization.mk_eq_mk_iff Projectivization.mk_eq_mk_iff
theorem mk_eq_mk_iff' (v w : V) (hv : v ≠ 0) (hw : w ≠ 0) :
mk K v hv = mk K w hw ↔ ∃ a : K, a • w = v := by
rw [mk_eq_mk_iff K v w hv hw]
constructor
· rintro ⟨a, ha⟩
exact ⟨a, ha⟩
· rintro ⟨a, ha⟩
refine ⟨Units.mk0 a fun c => hv.symm ?_, ha⟩
rwa [c, zero_smul] at ha
#align projectivization.mk_eq_mk_iff' Projectivization.mk_eq_mk_iff'
theorem exists_smul_eq_mk_rep (v : V) (hv : v ≠ 0) : ∃ a : Kˣ, a • v = (mk K v hv).rep :=
(mk_eq_mk_iff K _ _ (rep_nonzero _) hv).1 (mk_rep _)
#align projectivization.exists_smul_eq_mk_rep Projectivization.exists_smul_eq_mk_rep
variable {K}
@[elab_as_elim]
theorem ind {P : ℙ K V → Prop} (h : ∀ (v : V) (h : v ≠ 0), P (mk K v h)) : ∀ p, P p :=
Quotient.ind' <| Subtype.rec <| h
#align projectivization.ind Projectivization.ind
@[simp]
theorem submodule_mk (v : V) (hv : v ≠ 0) : (mk K v hv).submodule = K ∙ v :=
rfl
#align projectivization.submodule_mk Projectivization.submodule_mk
theorem submodule_eq (v : ℙ K V) : v.submodule = K ∙ v.rep := by
conv_lhs => rw [← v.mk_rep]
rfl
#align projectivization.submodule_eq Projectivization.submodule_eq
| Mathlib/LinearAlgebra/Projectivization/Basic.lean | 142 | 144 | theorem finrank_submodule (v : ℙ K V) : finrank K v.submodule = 1 := by |
rw [submodule_eq]
exact finrank_span_singleton v.rep_nonzero
| [
" ∀ (a b : { v // v ≠ 0 }), Setoid.r a b → Submodule.span K {↑a} = Submodule.span K {↑b}",
" Submodule.span K {↑⟨x • b, ha⟩} = Submodule.span K {↑⟨b, hb⟩}",
" mk K v hv = mk K w hw ↔ ∃ a, a • w = v",
" (∃ a, a • w = v) ↔ ∃ a, a • w = v",
" (∃ a, a • w = v) → ∃ a, a • w = v",
" ∃ a, a • w = v",
" 0 = v",... | [
" ∀ (a b : { v // v ≠ 0 }), Setoid.r a b → Submodule.span K {↑a} = Submodule.span K {↑b}",
" Submodule.span K {↑⟨x • b, ha⟩} = Submodule.span K {↑⟨b, hb⟩}",
" mk K v hv = mk K w hw ↔ ∃ a, a • w = v",
" (∃ a, a • w = v) ↔ ∃ a, a • w = v",
" (∃ a, a • w = v) → ∃ a, a • w = v",
" ∃ a, a • w = v",
" 0 = v",... |
import Mathlib.Algebra.BigOperators.Module
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Order.Filter.ModEq
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Data.List.TFAE
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.specific_limits.normed from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Set Function Filter Finset Metric Asymptotics
open scoped Classical
open Topology Nat uniformity NNReal ENNReal
variable {α : Type*} {β : Type*} {ι : Type*}
theorem tendsto_norm_atTop_atTop : Tendsto (norm : ℝ → ℝ) atTop atTop :=
tendsto_abs_atTop_atTop
#align tendsto_norm_at_top_at_top tendsto_norm_atTop_atTop
theorem summable_of_absolute_convergence_real {f : ℕ → ℝ} :
(∃ r, Tendsto (fun n ↦ ∑ i ∈ range n, |f i|) atTop (𝓝 r)) → Summable f
| ⟨r, hr⟩ => by
refine .of_norm ⟨r, (hasSum_iff_tendsto_nat_of_nonneg ?_ _).2 ?_⟩
· exact fun i ↦ norm_nonneg _
· simpa only using hr
#align summable_of_absolute_convergence_real summable_of_absolute_convergence_real
theorem tendsto_norm_zero' {𝕜 : Type*} [NormedAddCommGroup 𝕜] :
Tendsto (norm : 𝕜 → ℝ) (𝓝[≠] 0) (𝓝[>] 0) :=
tendsto_norm_zero.inf <| tendsto_principal_principal.2 fun _ hx ↦ norm_pos_iff.2 hx
#align tendsto_norm_zero' tendsto_norm_zero'
namespace NormedField
theorem tendsto_norm_inverse_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] :
Tendsto (fun x : 𝕜 ↦ ‖x⁻¹‖) (𝓝[≠] 0) atTop :=
(tendsto_inv_zero_atTop.comp tendsto_norm_zero').congr fun x ↦ (norm_inv x).symm
#align normed_field.tendsto_norm_inverse_nhds_within_0_at_top NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
theorem tendsto_norm_zpow_nhdsWithin_0_atTop {𝕜 : Type*} [NormedDivisionRing 𝕜] {m : ℤ}
(hm : m < 0) :
Tendsto (fun x : 𝕜 ↦ ‖x ^ m‖) (𝓝[≠] 0) atTop := by
rcases neg_surjective m with ⟨m, rfl⟩
rw [neg_lt_zero] at hm; lift m to ℕ using hm.le; rw [Int.natCast_pos] at hm
simp only [norm_pow, zpow_neg, zpow_natCast, ← inv_pow]
exact (tendsto_pow_atTop hm.ne').comp NormedField.tendsto_norm_inverse_nhdsWithin_0_atTop
#align normed_field.tendsto_norm_zpow_nhds_within_0_at_top NormedField.tendsto_norm_zpow_nhdsWithin_0_atTop
theorem tendsto_zero_smul_of_tendsto_zero_of_bounded {ι 𝕜 𝔸 : Type*} [NormedDivisionRing 𝕜]
[NormedAddCommGroup 𝔸] [Module 𝕜 𝔸] [BoundedSMul 𝕜 𝔸] {l : Filter ι} {ε : ι → 𝕜} {f : ι → 𝔸}
(hε : Tendsto ε l (𝓝 0)) (hf : Filter.IsBoundedUnder (· ≤ ·) l (norm ∘ f)) :
Tendsto (ε • f) l (𝓝 0) := by
rw [← isLittleO_one_iff 𝕜] at hε ⊢
simpa using IsLittleO.smul_isBigO hε (hf.isBigO_const (one_ne_zero : (1 : 𝕜) ≠ 0))
#align normed_field.tendsto_zero_smul_of_tendsto_zero_of_bounded NormedField.tendsto_zero_smul_of_tendsto_zero_of_bounded
@[simp]
theorem continuousAt_zpow {𝕜 : Type*} [NontriviallyNormedField 𝕜] {m : ℤ} {x : 𝕜} :
ContinuousAt (fun x ↦ x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m := by
refine ⟨?_, continuousAt_zpow₀ _ _⟩
contrapose!; rintro ⟨rfl, hm⟩ hc
exact not_tendsto_atTop_of_tendsto_nhds (hc.tendsto.mono_left nhdsWithin_le_nhds).norm
(tendsto_norm_zpow_nhdsWithin_0_atTop hm)
#align normed_field.continuous_at_zpow NormedField.continuousAt_zpow
@[simp]
| Mathlib/Analysis/SpecificLimits/Normed.lean | 90 | 92 | theorem continuousAt_inv {𝕜 : Type*} [NontriviallyNormedField 𝕜] {x : 𝕜} :
ContinuousAt Inv.inv x ↔ x ≠ 0 := by |
simpa [(zero_lt_one' ℤ).not_le] using @continuousAt_zpow _ _ (-1) x
| [
" Summable f",
" ∀ (i : ℕ), 0 ≤ ‖f i‖",
" Tendsto (fun n => ∑ i ∈ Finset.range n, ‖f i‖) atTop (𝓝 r)",
" Tendsto (fun x => ‖x ^ m‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-↑m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x⁻¹‖ ^ m) (𝓝[≠] 0) atTop",
"... | [
" Summable f",
" ∀ (i : ℕ), 0 ≤ ‖f i‖",
" Tendsto (fun n => ∑ i ∈ Finset.range n, ‖f i‖) atTop (𝓝 r)",
" Tendsto (fun x => ‖x ^ m‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x ^ (-↑m)‖) (𝓝[≠] 0) atTop",
" Tendsto (fun x => ‖x⁻¹‖ ^ m) (𝓝[≠] 0) atTop",
"... |
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.MvPolynomial.Supported
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.RingTheory.Adjoin.Basic
import Mathlib.RingTheory.Algebraic
import Mathlib.RingTheory.MvPolynomial.Basic
#align_import ring_theory.algebraic_independent from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69"
noncomputable section
open Function Set Subalgebra MvPolynomial Algebra
open scoped Classical
universe x u v w
variable {ι : Type*} {ι' : Type*} (R : Type*) {K : Type*}
variable {A : Type*} {A' A'' : Type*} {V : Type u} {V' : Type*}
variable (x : ι → A)
variable [CommRing R] [CommRing A] [CommRing A'] [CommRing A'']
variable [Algebra R A] [Algebra R A'] [Algebra R A'']
variable {a b : R}
def AlgebraicIndependent : Prop :=
Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A)
#align algebraic_independent AlgebraicIndependent
variable {R} {x}
theorem algebraicIndependent_iff_ker_eq_bot :
AlgebraicIndependent R x ↔
RingHom.ker (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A).toRingHom = ⊥ :=
RingHom.injective_iff_ker_eq_bot _
#align algebraic_independent_iff_ker_eq_bot algebraicIndependent_iff_ker_eq_bot
theorem algebraicIndependent_iff :
AlgebraicIndependent R x ↔
∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 :=
injective_iff_map_eq_zero _
#align algebraic_independent_iff algebraicIndependent_iff
theorem AlgebraicIndependent.eq_zero_of_aeval_eq_zero (h : AlgebraicIndependent R x) :
∀ p : MvPolynomial ι R, MvPolynomial.aeval (x : ι → A) p = 0 → p = 0 :=
algebraicIndependent_iff.1 h
#align algebraic_independent.eq_zero_of_aeval_eq_zero AlgebraicIndependent.eq_zero_of_aeval_eq_zero
theorem algebraicIndependent_iff_injective_aeval :
AlgebraicIndependent R x ↔ Injective (MvPolynomial.aeval x : MvPolynomial ι R →ₐ[R] A) :=
Iff.rfl
#align algebraic_independent_iff_injective_aeval algebraicIndependent_iff_injective_aeval
@[simp]
| Mathlib/RingTheory/AlgebraicIndependent.lean | 90 | 96 | theorem algebraicIndependent_empty_type_iff [IsEmpty ι] :
AlgebraicIndependent R x ↔ Injective (algebraMap R A) := by |
have : aeval x = (Algebra.ofId R A).comp (@isEmptyAlgEquiv R ι _ _).toAlgHom := by
ext i
exact IsEmpty.elim' ‹IsEmpty ι› i
rw [AlgebraicIndependent, this, ← Injective.of_comp_iff' _ (@isEmptyAlgEquiv R ι _ _).bijective]
rfl
| [
" AlgebraicIndependent R x ↔ Injective ⇑(algebraMap R A)",
" aeval x = (ofId R A).comp ↑(isEmptyAlgEquiv R ι)",
" (aeval x) (X i) = ((ofId R A).comp ↑(isEmptyAlgEquiv R ι)) (X i)",
" Injective ⇑((ofId R A).comp ↑(isEmptyAlgEquiv R ι)) ↔ Injective (⇑(algebraMap R A) ∘ ⇑(isEmptyAlgEquiv R ι))"
] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.