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.Algebra.Algebra.Spectrum
import Mathlib.LinearAlgebra.GeneralLinearGroup
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.RingTheory.Nilpotent.Basic
#align_import linear_algebra.eigenspace.basic from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1"
universe u v w
namespace Module
namespace End
open FiniteDimensional Set
variable {K R : Type v} {V M : Type w} [CommRing R] [AddCommGroup M] [Module R M] [Field K]
[AddCommGroup V] [Module K V]
def eigenspace (f : End R M) (μ : R) : Submodule R M :=
LinearMap.ker (f - algebraMap R (End R M) μ)
#align module.End.eigenspace Module.End.eigenspace
@[simp]
theorem eigenspace_zero (f : End R M) : f.eigenspace 0 = LinearMap.ker f := by simp [eigenspace]
#align module.End.eigenspace_zero Module.End.eigenspace_zero
def HasEigenvector (f : End R M) (μ : R) (x : M) : Prop :=
x ∈ eigenspace f μ ∧ x ≠ 0
#align module.End.has_eigenvector Module.End.HasEigenvector
def HasEigenvalue (f : End R M) (a : R) : Prop :=
eigenspace f a ≠ ⊥
#align module.End.has_eigenvalue Module.End.HasEigenvalue
def Eigenvalues (f : End R M) : Type _ :=
{ μ : R // f.HasEigenvalue μ }
#align module.End.eigenvalues Module.End.Eigenvalues
@[coe]
def Eigenvalues.val (f : Module.End R M) : Eigenvalues f → R := Subtype.val
instance Eigenvalues.instCoeOut {f : Module.End R M} : CoeOut (Eigenvalues f) R where
coe := Eigenvalues.val f
instance Eigenvalues.instDecidableEq [DecidableEq R] (f : Module.End R M) :
DecidableEq (Eigenvalues f) :=
inferInstanceAs (DecidableEq (Subtype (fun x : R => HasEigenvalue f x)))
theorem hasEigenvalue_of_hasEigenvector {f : End R M} {μ : R} {x : M} (h : HasEigenvector f μ x) :
HasEigenvalue f μ := by
rw [HasEigenvalue, Submodule.ne_bot_iff]
use x; exact h
#align module.End.has_eigenvalue_of_has_eigenvector Module.End.hasEigenvalue_of_hasEigenvector
theorem mem_eigenspace_iff {f : End R M} {μ : R} {x : M} : x ∈ eigenspace f μ ↔ f x = μ • x := by
rw [eigenspace, LinearMap.mem_ker, LinearMap.sub_apply, algebraMap_end_apply, sub_eq_zero]
#align module.End.mem_eigenspace_iff Module.End.mem_eigenspace_iff
theorem HasEigenvector.apply_eq_smul {f : End R M} {μ : R} {x : M} (hx : f.HasEigenvector μ x) :
f x = μ • x :=
mem_eigenspace_iff.mp hx.1
#align module.End.has_eigenvector.apply_eq_smul Module.End.HasEigenvector.apply_eq_smul
theorem HasEigenvector.pow_apply {f : End R M} {μ : R} {v : M} (hv : f.HasEigenvector μ v) (n : ℕ) :
(f ^ n) v = μ ^ n • v := by
induction n <;> simp [*, pow_succ f, hv.apply_eq_smul, smul_smul, pow_succ' μ]
theorem HasEigenvalue.exists_hasEigenvector {f : End R M} {μ : R} (hμ : f.HasEigenvalue μ) :
∃ v, f.HasEigenvector μ v :=
Submodule.exists_mem_ne_zero_of_ne_bot hμ
#align module.End.has_eigenvalue.exists_has_eigenvector Module.End.HasEigenvalue.exists_hasEigenvector
lemma HasEigenvalue.pow {f : End R M} {μ : R} (h : f.HasEigenvalue μ) (n : ℕ) :
(f ^ n).HasEigenvalue (μ ^ n) := by
rw [HasEigenvalue, Submodule.ne_bot_iff]
obtain ⟨m : M, hm⟩ := h.exists_hasEigenvector
exact ⟨m, by simpa [mem_eigenspace_iff] using hm.pow_apply n, hm.2⟩
lemma HasEigenvalue.isNilpotent_of_isNilpotent [NoZeroSMulDivisors R M] {f : End R M}
(hfn : IsNilpotent f) {μ : R} (hf : f.HasEigenvalue μ) :
IsNilpotent μ := by
obtain ⟨m : M, hm⟩ := hf.exists_hasEigenvector
obtain ⟨n : ℕ, hn : f ^ n = 0⟩ := hfn
exact ⟨n, by simpa [hn, hm.2, eq_comm (a := (0 : M))] using hm.pow_apply n⟩
theorem HasEigenvalue.mem_spectrum {f : End R M} {μ : R} (hμ : HasEigenvalue f μ) :
μ ∈ spectrum R f := by
refine spectrum.mem_iff.mpr fun h_unit => ?_
set f' := LinearMap.GeneralLinearGroup.toLinearEquiv h_unit.unit
rcases hμ.exists_hasEigenvector with ⟨v, hv⟩
refine hv.2 ((LinearMap.ker_eq_bot'.mp f'.ker) v (?_ : μ • v - f v = 0))
rw [hv.apply_eq_smul, sub_self]
#align module.End.mem_spectrum_of_has_eigenvalue Module.End.HasEigenvalue.mem_spectrum
theorem hasEigenvalue_iff_mem_spectrum [FiniteDimensional K V] {f : End K V} {μ : K} :
f.HasEigenvalue μ ↔ μ ∈ spectrum K f := by
rw [spectrum.mem_iff, IsUnit.sub_iff, LinearMap.isUnit_iff_ker_eq_bot, HasEigenvalue, eigenspace]
#align module.End.has_eigenvalue_iff_mem_spectrum Module.End.hasEigenvalue_iff_mem_spectrum
alias ⟨_, HasEigenvalue.of_mem_spectrum⟩ := hasEigenvalue_iff_mem_spectrum
| Mathlib/LinearAlgebra/Eigenspace/Basic.lean | 154 | 163 | theorem eigenspace_div (f : End K V) (a b : K) (hb : b ≠ 0) :
eigenspace f (a / b) = LinearMap.ker (b • f - algebraMap K (End K V) a) :=
calc
eigenspace f (a / b) = eigenspace f (b⁻¹ * a) := by | rw [div_eq_mul_inv, mul_comm]
_ = LinearMap.ker (f - (b⁻¹ * a) • LinearMap.id) := by rw [eigenspace]; rfl
_ = LinearMap.ker (f - b⁻¹ • a • LinearMap.id) := by rw [smul_smul]
_ = LinearMap.ker (f - b⁻¹ • algebraMap K (End K V) a) := rfl
_ = LinearMap.ker (b • (f - b⁻¹ • algebraMap K (End K V) a)) := by
rw [LinearMap.ker_smul _ b hb]
_ = LinearMap.ker (b • f - algebraMap K (End K V) a) := by rw [smul_sub, smul_inv_smul₀ hb]
| [
" f.eigenspace 0 = LinearMap.ker f",
" f.HasEigenvalue μ",
" ∃ x ∈ f.eigenspace μ, x ≠ 0",
" x ∈ f.eigenspace μ ∧ x ≠ 0",
" x ∈ f.eigenspace μ ↔ f x = μ • x",
" (f ^ n) v = μ ^ n • v",
" (f ^ 0) v = μ ^ 0 • v",
" (f ^ (n✝ + 1)) v = μ ^ (n✝ + 1) • v",
" (f ^ n).HasEigenvalue (μ ^ n)",
" ∃ x ∈ (f ^ ... | [
" f.eigenspace 0 = LinearMap.ker f",
" f.HasEigenvalue μ",
" ∃ x ∈ f.eigenspace μ, x ≠ 0",
" x ∈ f.eigenspace μ ∧ x ≠ 0",
" x ∈ f.eigenspace μ ↔ f x = μ • x",
" (f ^ n) v = μ ^ n • v",
" (f ^ 0) v = μ ^ 0 • v",
" (f ^ (n✝ + 1)) v = μ ^ (n✝ + 1) • v",
" (f ^ n).HasEigenvalue (μ ^ n)",
" ∃ x ∈ (f ^ ... |
import Mathlib.MeasureTheory.MeasurableSpace.Defs
import Mathlib.SetTheory.Cardinal.Cofinality
import Mathlib.SetTheory.Cardinal.Continuum
#align_import measure_theory.card_measurable_space from "leanprover-community/mathlib"@"f2b108e8e97ba393f22bf794989984ddcc1da89b"
universe u
variable {α : Type u}
open Cardinal Set
-- Porting note: fix universe below, not here
local notation "ω₁" => (WellOrder.α <| Quotient.out <| Cardinal.ord (aleph 1 : Cardinal))
namespace MeasurableSpace
def generateMeasurableRec (s : Set (Set α)) : (ω₁ : Type u) → Set (Set α)
| i =>
let S := ⋃ j : Iio i, generateMeasurableRec s (j.1)
s ∪ {∅} ∪ compl '' S ∪ Set.range fun f : ℕ → S => ⋃ n, (f n).1
termination_by i => i
decreasing_by exact j.2
#align measurable_space.generate_measurable_rec MeasurableSpace.generateMeasurableRec
theorem self_subset_generateMeasurableRec (s : Set (Set α)) (i : ω₁) :
s ⊆ generateMeasurableRec s i := by
unfold generateMeasurableRec
apply_rules [subset_union_of_subset_left]
exact subset_rfl
#align measurable_space.self_subset_generate_measurable_rec MeasurableSpace.self_subset_generateMeasurableRec
theorem empty_mem_generateMeasurableRec (s : Set (Set α)) (i : ω₁) :
∅ ∈ generateMeasurableRec s i := by
unfold generateMeasurableRec
exact mem_union_left _ (mem_union_left _ (mem_union_right _ (mem_singleton ∅)))
#align measurable_space.empty_mem_generate_measurable_rec MeasurableSpace.empty_mem_generateMeasurableRec
| Mathlib/MeasureTheory/MeasurableSpace/Card.lean | 68 | 71 | theorem compl_mem_generateMeasurableRec {s : Set (Set α)} {i j : ω₁} (h : j < i) {t : Set α}
(ht : t ∈ generateMeasurableRec s j) : tᶜ ∈ generateMeasurableRec s i := by |
unfold generateMeasurableRec
exact mem_union_left _ (mem_union_right _ ⟨t, mem_iUnion.2 ⟨⟨j, h⟩, ht⟩, rfl⟩)
| [
" (invImage (fun x => x) (hasWellFoundedOut (aleph 1).ord)).1 (↑j) a✝",
" s ⊆ generateMeasurableRec s i",
" s ⊆\n let i := i;\n let S := ⋃ j, generateMeasurableRec s ↑j;\n s ∪ {∅} ∪ compl '' S ∪ range fun f => ⋃ n, ↑(f n)",
" s ⊆ s",
" ∅ ∈ generateMeasurableRec s i",
" ∅ ∈\n let i := i;\n l... | [
" (invImage (fun x => x) (hasWellFoundedOut (aleph 1).ord)).1 (↑j) a✝",
" s ⊆ generateMeasurableRec s i",
" s ⊆\n let i := i;\n let S := ⋃ j, generateMeasurableRec s ↑j;\n s ∪ {∅} ∪ compl '' S ∪ range fun f => ⋃ n, ↑(f n)",
" s ⊆ s",
" ∅ ∈ generateMeasurableRec s i",
" ∅ ∈\n let i := i;\n l... |
import Mathlib.CategoryTheory.NatIso
import Mathlib.Logic.Equiv.Defs
#align_import category_theory.functor.fully_faithful from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D]
namespace Functor
class Full (F : C ⥤ D) : Prop where
map_surjective {X Y : C} : Function.Surjective (F.map (X := X) (Y := Y))
#align category_theory.full CategoryTheory.Functor.Full
class Faithful (F : C ⥤ D) : Prop where
map_injective : ∀ {X Y : C}, Function.Injective (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) := by
aesop_cat
#align category_theory.faithful CategoryTheory.Functor.Faithful
#align category_theory.faithful.map_injective CategoryTheory.Functor.Faithful.map_injective
variable {X Y : C}
theorem map_injective (F : C ⥤ D) [Faithful F] :
Function.Injective <| (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) :=
Faithful.map_injective
#align category_theory.functor.map_injective CategoryTheory.Functor.map_injective
lemma map_injective_iff (F : C ⥤ D) [Faithful F] {X Y : C} (f g : X ⟶ Y) :
F.map f = F.map g ↔ f = g :=
⟨fun h => F.map_injective h, fun h => by rw [h]⟩
theorem mapIso_injective (F : C ⥤ D) [Faithful F] :
Function.Injective <| (F.mapIso : (X ≅ Y) → (F.obj X ≅ F.obj Y)) := fun _ _ h =>
Iso.ext (map_injective F (congr_arg Iso.hom h : _))
#align category_theory.functor.map_iso_injective CategoryTheory.Functor.mapIso_injective
theorem map_surjective (F : C ⥤ D) [Full F] :
Function.Surjective (F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)) :=
Full.map_surjective
#align category_theory.functor.map_surjective CategoryTheory.Functor.map_surjective
noncomputable def preimage (F : C ⥤ D) [Full F] (f : F.obj X ⟶ F.obj Y) : X ⟶ Y :=
(F.map_surjective f).choose
#align category_theory.functor.preimage CategoryTheory.Functor.preimage
@[simp]
theorem map_preimage (F : C ⥤ D) [Full F] {X Y : C} (f : F.obj X ⟶ F.obj Y) :
F.map (preimage F f) = f :=
(F.map_surjective f).choose_spec
#align category_theory.functor.image_preimage CategoryTheory.Functor.map_preimage
variable {F : C ⥤ D} [Full F] [F.Faithful] {X Y Z : C}
@[simp]
theorem preimage_id : F.preimage (𝟙 (F.obj X)) = 𝟙 X :=
F.map_injective (by simp)
#align category_theory.preimage_id CategoryTheory.Functor.preimage_id
@[simp]
theorem preimage_comp (f : F.obj X ⟶ F.obj Y) (g : F.obj Y ⟶ F.obj Z) :
F.preimage (f ≫ g) = F.preimage f ≫ F.preimage g :=
F.map_injective (by simp)
#align category_theory.preimage_comp CategoryTheory.Functor.preimage_comp
@[simp]
theorem preimage_map (f : X ⟶ Y) : F.preimage (F.map f) = f :=
F.map_injective (by simp)
#align category_theory.preimage_map CategoryTheory.Functor.preimage_map
variable (F)
@[simps]
noncomputable def preimageIso (f : F.obj X ≅ F.obj Y) :
X ≅ Y where
hom := F.preimage f.hom
inv := F.preimage f.inv
hom_inv_id := F.map_injective (by simp)
inv_hom_id := F.map_injective (by simp)
#align category_theory.functor.preimage_iso CategoryTheory.Functor.preimageIso
#align category_theory.functor.preimage_iso_inv CategoryTheory.Functor.preimageIso_inv
#align category_theory.functor.preimage_iso_hom CategoryTheory.Functor.preimageIso_hom
@[simp]
| Mathlib/CategoryTheory/Functor/FullyFaithful.lean | 125 | 127 | theorem preimageIso_mapIso (f : X ≅ Y) : F.preimageIso (F.mapIso f) = f := by |
ext
simp
| [
" F.map f = F.map g",
" F.map (F.preimage (𝟙 (F.obj X))) = F.map (𝟙 X)",
" F.map (F.preimage (f ≫ g)) = F.map (F.preimage f ≫ F.preimage g)",
" F.map (F.preimage (F.map f)) = F.map f",
" F.map (F.preimage f.hom ≫ F.preimage f.inv) = F.map (𝟙 X)",
" F.map (F.preimage f.inv ≫ F.preimage f.hom) = F.map (�... | [
" F.map f = F.map g",
" F.map (F.preimage (𝟙 (F.obj X))) = F.map (𝟙 X)",
" F.map (F.preimage (f ≫ g)) = F.map (F.preimage f ≫ F.preimage g)",
" F.map (F.preimage (F.map f)) = F.map f",
" F.map (F.preimage f.hom ≫ F.preimage f.inv) = F.map (𝟙 X)",
" F.map (F.preimage f.inv ≫ F.preimage f.hom) = F.map (�... |
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
#align_import category_theory.limits.shapes.strict_initial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u
namespace CategoryTheory
namespace Limits
open Category
variable (C : Type u) [Category.{v} C]
section StrictTerminal
class HasStrictTerminalObjects : Prop where
out : ∀ {I A : C} (f : I ⟶ A), IsTerminal I → IsIso f
#align category_theory.limits.has_strict_terminal_objects CategoryTheory.Limits.HasStrictTerminalObjects
variable {C}
section
variable [HasStrictTerminalObjects C] {I : C}
theorem IsTerminal.isIso_from (hI : IsTerminal I) {A : C} (f : I ⟶ A) : IsIso f :=
HasStrictTerminalObjects.out f hI
#align category_theory.limits.is_terminal.is_iso_from CategoryTheory.Limits.IsTerminal.isIso_from
| Mathlib/CategoryTheory/Limits/Shapes/StrictInitial.lean | 192 | 195 | theorem IsTerminal.strict_hom_ext (hI : IsTerminal I) {A : C} (f g : I ⟶ A) : f = g := by |
haveI := hI.isIso_from f
haveI := hI.isIso_from g
exact eq_of_inv_eq_inv (hI.hom_ext (inv f) (inv g))
| [
" f = g"
] | [] |
import Mathlib.Data.Countable.Basic
import Mathlib.Logic.Encodable.Basic
import Mathlib.Order.SuccPred.Basic
import Mathlib.Order.Interval.Finset.Defs
#align_import order.succ_pred.linear_locally_finite from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9"
open Order
variable {ι : Type*} [LinearOrder ι]
namespace LinearLocallyFiniteOrder
noncomputable def succFn (i : ι) : ι :=
(exists_glb_Ioi i).choose
#align linear_locally_finite_order.succ_fn LinearLocallyFiniteOrder.succFn
theorem succFn_spec (i : ι) : IsGLB (Set.Ioi i) (succFn i) :=
(exists_glb_Ioi i).choose_spec
#align linear_locally_finite_order.succ_fn_spec LinearLocallyFiniteOrder.succFn_spec
theorem le_succFn (i : ι) : i ≤ succFn i := by
rw [le_isGLB_iff (succFn_spec i), mem_lowerBounds]
exact fun x hx ↦ le_of_lt hx
#align linear_locally_finite_order.le_succ_fn LinearLocallyFiniteOrder.le_succFn
theorem isGLB_Ioc_of_isGLB_Ioi {i j k : ι} (hij_lt : i < j) (h : IsGLB (Set.Ioi i) k) :
IsGLB (Set.Ioc i j) k := by
simp_rw [IsGLB, IsGreatest, mem_upperBounds, mem_lowerBounds] at h ⊢
refine ⟨fun x hx ↦ h.1 x hx.1, fun x hx ↦ h.2 x ?_⟩
intro y hy
rcases le_or_lt y j with h_le | h_lt
· exact hx y ⟨hy, h_le⟩
· exact le_trans (hx j ⟨hij_lt, le_rfl⟩) h_lt.le
#align linear_locally_finite_order.is_glb_Ioc_of_is_glb_Ioi LinearLocallyFiniteOrder.isGLB_Ioc_of_isGLB_Ioi
theorem isMax_of_succFn_le [LocallyFiniteOrder ι] (i : ι) (hi : succFn i ≤ i) : IsMax i := by
refine fun j _ ↦ not_lt.mp fun hij_lt ↦ ?_
have h_succFn_eq : succFn i = i := le_antisymm hi (le_succFn i)
have h_glb : IsGLB (Finset.Ioc i j : Set ι) i := by
rw [Finset.coe_Ioc]
have h := succFn_spec i
rw [h_succFn_eq] at h
exact isGLB_Ioc_of_isGLB_Ioi hij_lt h
have hi_mem : i ∈ Finset.Ioc i j := by
refine Finset.isGLB_mem _ h_glb ?_
exact ⟨_, Finset.mem_Ioc.mpr ⟨hij_lt, le_rfl⟩⟩
rw [Finset.mem_Ioc] at hi_mem
exact lt_irrefl i hi_mem.1
#align linear_locally_finite_order.is_max_of_succ_fn_le LinearLocallyFiniteOrder.isMax_of_succFn_le
theorem succFn_le_of_lt (i j : ι) (hij : i < j) : succFn i ≤ j := by
have h := succFn_spec i
rw [IsGLB, IsGreatest, mem_lowerBounds] at h
exact h.1 j hij
#align linear_locally_finite_order.succ_fn_le_of_lt LinearLocallyFiniteOrder.succFn_le_of_lt
| Mathlib/Order/SuccPred/LinearLocallyFinite.lean | 108 | 112 | theorem le_of_lt_succFn (j i : ι) (hij : j < succFn i) : j ≤ i := by |
rw [lt_isGLB_iff (succFn_spec i)] at hij
obtain ⟨k, hk_lb, hk⟩ := hij
rw [mem_lowerBounds] at hk_lb
exact not_lt.mp fun hi_lt_j ↦ not_le.mpr hk (hk_lb j hi_lt_j)
| [
" i ≤ succFn i",
" ∀ x ∈ Set.Ioi i, i ≤ x",
" IsGLB (Set.Ioc i j) k",
" (∀ x ∈ Set.Ioc i j, k ≤ x) ∧ ∀ (x : ι), (∀ x_1 ∈ Set.Ioc i j, x ≤ x_1) → x ≤ k",
" ∀ x_1 ∈ Set.Ioi i, x ≤ x_1",
" x ≤ y",
" IsMax i",
" False",
" IsGLB (↑(Finset.Ioc i j)) i",
" IsGLB (Set.Ioc i j) i",
" i ∈ Finset.Ioc i j",... | [
" i ≤ succFn i",
" ∀ x ∈ Set.Ioi i, i ≤ x",
" IsGLB (Set.Ioc i j) k",
" (∀ x ∈ Set.Ioc i j, k ≤ x) ∧ ∀ (x : ι), (∀ x_1 ∈ Set.Ioc i j, x ≤ x_1) → x ≤ k",
" ∀ x_1 ∈ Set.Ioi i, x ≤ x_1",
" x ≤ y",
" IsMax i",
" False",
" IsGLB (↑(Finset.Ioc i j)) i",
" IsGLB (Set.Ioc i j) i",
" i ∈ Finset.Ioc i j",... |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Polynomial.Degree.Lemmas
#align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448"
noncomputable section
open Polynomial
open Polynomial Finset
namespace Polynomial
variable {R : Type*} [Semiring R] {f : R[X]}
def eraseLead (f : R[X]) : R[X] :=
Polynomial.erase f.natDegree f
#align polynomial.erase_lead Polynomial.eraseLead
section EraseLead
theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by
simp only [eraseLead, support_erase]
#align polynomial.erase_lead_support Polynomial.eraseLead_support
theorem eraseLead_coeff (i : ℕ) :
f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by
simp only [eraseLead, coeff_erase]
#align polynomial.erase_lead_coeff Polynomial.eraseLead_coeff
@[simp]
theorem eraseLead_coeff_natDegree : f.eraseLead.coeff f.natDegree = 0 := by simp [eraseLead_coeff]
#align polynomial.erase_lead_coeff_nat_degree Polynomial.eraseLead_coeff_natDegree
theorem eraseLead_coeff_of_ne (i : ℕ) (hi : i ≠ f.natDegree) : f.eraseLead.coeff i = f.coeff i := by
simp [eraseLead_coeff, hi]
#align polynomial.erase_lead_coeff_of_ne Polynomial.eraseLead_coeff_of_ne
@[simp]
theorem eraseLead_zero : eraseLead (0 : R[X]) = 0 := by simp only [eraseLead, erase_zero]
#align polynomial.erase_lead_zero Polynomial.eraseLead_zero
@[simp]
theorem eraseLead_add_monomial_natDegree_leadingCoeff (f : R[X]) :
f.eraseLead + monomial f.natDegree f.leadingCoeff = f :=
(add_comm _ _).trans (f.monomial_add_erase _)
#align polynomial.erase_lead_add_monomial_nat_degree_leading_coeff Polynomial.eraseLead_add_monomial_natDegree_leadingCoeff
@[simp]
theorem eraseLead_add_C_mul_X_pow (f : R[X]) :
f.eraseLead + C f.leadingCoeff * X ^ f.natDegree = f := by
rw [C_mul_X_pow_eq_monomial, eraseLead_add_monomial_natDegree_leadingCoeff]
set_option linter.uppercaseLean3 false in
#align polynomial.erase_lead_add_C_mul_X_pow Polynomial.eraseLead_add_C_mul_X_pow
@[simp]
theorem self_sub_monomial_natDegree_leadingCoeff {R : Type*} [Ring R] (f : R[X]) :
f - monomial f.natDegree f.leadingCoeff = f.eraseLead :=
(eq_sub_iff_add_eq.mpr (eraseLead_add_monomial_natDegree_leadingCoeff f)).symm
#align polynomial.self_sub_monomial_nat_degree_leading_coeff Polynomial.self_sub_monomial_natDegree_leadingCoeff
@[simp]
theorem self_sub_C_mul_X_pow {R : Type*} [Ring R] (f : R[X]) :
f - C f.leadingCoeff * X ^ f.natDegree = f.eraseLead := by
rw [C_mul_X_pow_eq_monomial, self_sub_monomial_natDegree_leadingCoeff]
set_option linter.uppercaseLean3 false in
#align polynomial.self_sub_C_mul_X_pow Polynomial.self_sub_C_mul_X_pow
theorem eraseLead_ne_zero (f0 : 2 ≤ f.support.card) : eraseLead f ≠ 0 := by
rw [Ne, ← card_support_eq_zero, eraseLead_support]
exact
(zero_lt_one.trans_le <| (tsub_le_tsub_right f0 1).trans Finset.pred_card_le_card_erase).ne.symm
#align polynomial.erase_lead_ne_zero Polynomial.eraseLead_ne_zero
theorem lt_natDegree_of_mem_eraseLead_support {a : ℕ} (h : a ∈ (eraseLead f).support) :
a < f.natDegree := by
rw [eraseLead_support, mem_erase] at h
exact (le_natDegree_of_mem_supp a h.2).lt_of_ne h.1
#align polynomial.lt_nat_degree_of_mem_erase_lead_support Polynomial.lt_natDegree_of_mem_eraseLead_support
theorem ne_natDegree_of_mem_eraseLead_support {a : ℕ} (h : a ∈ (eraseLead f).support) :
a ≠ f.natDegree :=
(lt_natDegree_of_mem_eraseLead_support h).ne
#align polynomial.ne_nat_degree_of_mem_erase_lead_support Polynomial.ne_natDegree_of_mem_eraseLead_support
theorem natDegree_not_mem_eraseLead_support : f.natDegree ∉ (eraseLead f).support := fun h =>
ne_natDegree_of_mem_eraseLead_support h rfl
#align polynomial.nat_degree_not_mem_erase_lead_support Polynomial.natDegree_not_mem_eraseLead_support
theorem eraseLead_support_card_lt (h : f ≠ 0) : (eraseLead f).support.card < f.support.card := by
rw [eraseLead_support]
exact card_lt_card (erase_ssubset <| natDegree_mem_support_of_nonzero h)
#align polynomial.erase_lead_support_card_lt Polynomial.eraseLead_support_card_lt
| Mathlib/Algebra/Polynomial/EraseLead.lean | 115 | 124 | theorem card_support_eraseLead_add_one (h : f ≠ 0) :
f.eraseLead.support.card + 1 = f.support.card := by |
set c := f.support.card with hc
cases h₁ : c
case zero =>
by_contra
exact h (card_support_eq_zero.mp h₁)
case succ =>
rw [eraseLead_support, card_erase_of_mem (natDegree_mem_support_of_nonzero h), ← hc, h₁]
rfl
| [
" f.eraseLead.support = f.support.erase f.natDegree",
" f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i",
" f.eraseLead.coeff f.natDegree = 0",
" f.eraseLead.coeff i = f.coeff i",
" eraseLead 0 = 0",
" f.eraseLead + C f.leadingCoeff * X ^ f.natDegree = f",
" f - C f.leadingCoeff * X ^ f.n... | [
" f.eraseLead.support = f.support.erase f.natDegree",
" f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i",
" f.eraseLead.coeff f.natDegree = 0",
" f.eraseLead.coeff i = f.coeff i",
" eraseLead 0 = 0",
" f.eraseLead + C f.leadingCoeff * X ^ f.natDegree = f",
" f - C f.leadingCoeff * X ^ f.n... |
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀
#align euclidean_domain.mul_div_cancel mul_div_cancel_right₀
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a :=
⟨fun h => by
rw [← div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun ⟨c, e⟩ => by
rw [e, ← add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
· simp only [b0, zero_mul]
· rw [mul_div_cancel_left₀ _ b0]⟩
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 63 | 64 | theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by |
rw [← dvd_add_right (h.mul_right _), div_add_mod]
| [
" a * b / b = a",
" a - a * b / b = 0",
" False",
" b ∣ a",
" b ∣ b * (a / b)",
" a % b = 0",
" b * c = b * (b * c / b)",
" c ∣ a % b ↔ c ∣ a"
] | [
" a * b / b = a",
" a - a * b / b = 0",
" False",
" b ∣ a",
" b ∣ b * (a / b)",
" a % b = 0",
" b * c = b * (b * c / b)"
] |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Int.ModEq
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Log
import Mathlib.Data.List.Indexes
import Mathlib.Data.List.Palindrome
import Mathlib.Tactic.IntervalCases
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
#align_import data.nat.digits from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
namespace Nat
variable {n : ℕ}
def digitsAux0 : ℕ → List ℕ
| 0 => []
| n + 1 => [n + 1]
#align nat.digits_aux_0 Nat.digitsAux0
def digitsAux1 (n : ℕ) : List ℕ :=
List.replicate n 1
#align nat.digits_aux_1 Nat.digitsAux1
def digitsAux (b : ℕ) (h : 2 ≤ b) : ℕ → List ℕ
| 0 => []
| n + 1 =>
((n + 1) % b) :: digitsAux b h ((n + 1) / b)
decreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h
#align nat.digits_aux Nat.digitsAux
@[simp]
| Mathlib/Data/Nat/Digits.lean | 60 | 60 | theorem digitsAux_zero (b : ℕ) (h : 2 ≤ b) : digitsAux b h 0 = [] := by | rw [digitsAux]
| [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 ((n + 1) / b) n.succ",
" b.digitsAux h 0 = []"
] | [
" (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 ((n + 1) / b) n.succ"
] |
import Mathlib.CategoryTheory.Limits.Types
import Mathlib.CategoryTheory.IsConnected
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.CategoryTheory.Conj
universe w v u
namespace CategoryTheory.Limits.Types
variable (C : Type u) [Category.{v} C]
def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1}
@[simps]
def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where
pt := PUnit
ι := { app := fun X => id }
noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where
desc s := s.ι.app Classical.ofNonempty
fac s j := by
ext ⟨⟩
apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit)
intros X Y f
exact congrFun (s.ι.naturality f).symm PUnit.unit
uniq s m h := by
ext ⟨⟩
simp [← h Classical.ofNonempty]
instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) :=
⟨_, isColimitPUnitCocone _⟩
instance instSubsingletonColimitPUnit
[IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] :
Subsingleton (colimit (constPUnitFunctor.{w} C)) where
allEq a b := by
obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a
obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b
apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit)
exact fun c d f => colimit_sound f rfl
noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] :
colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j)
(h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with
| rel _ _ h => exact Zigzag.of_hom <| Exists.choose h
| refl _ => exact Zigzag.refl _
| symm _ _ _ ih => exact zigzag_symmetric ih
| trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit
[HasColimit (constPUnitFunctor.{w} C)] :
IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩
have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance
refine zigzag_isConnected <| fun c d => ?_
refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_
exact colimit_eq <| h.toEquiv.injective rfl
| Mathlib/CategoryTheory/Limits/IsConnected.lean | 106 | 112 | theorem isConnected_iff_isColimit_pUnitCocone :
IsConnected C ↔ Nonempty (IsColimit (pUnitCocone.{w} C)) := by |
refine ⟨fun inst => ⟨isColimitPUnitCocone C⟩, fun ⟨h⟩ => ?_⟩
let colimitCocone : ColimitCocone (constPUnitFunctor C) := ⟨pUnitCocone.{w} C, h⟩
have : HasColimit (constPUnitFunctor.{w} C) := ⟨⟨colimitCocone⟩⟩
simp only [isConnected_iff_colimit_constPUnitFunctor_iso_pUnit.{w} C]
exact ⟨colimit.isoColimitCocone colimitCocone⟩
| [
" (pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s = s.ι.app j",
" ((pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s) PUnit.unit = s.ι.app j PUnit.unit",
" ∀ (j₁ j₂ : C), (j₁ ⟶ j₂) → s.ι.app j₁ PUnit.unit = s.ι.app j₂ PUnit.unit",
" s.ι.app X PUnit.unit = s.ι.app Y PUnit.... | [
" (pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s = s.ι.app j",
" ((pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s) PUnit.unit = s.ι.app j PUnit.unit",
" ∀ (j₁ j₂ : C), (j₁ ⟶ j₂) → s.ι.app j₁ PUnit.unit = s.ι.app j₂ PUnit.unit",
" s.ι.app X PUnit.unit = s.ι.app Y PUnit.... |
import Mathlib.Algebra.Regular.Basic
import Mathlib.LinearAlgebra.Matrix.MvPolynomial
import Mathlib.LinearAlgebra.Matrix.Polynomial
import Mathlib.RingTheory.Polynomial.Basic
#align_import linear_algebra.matrix.adjugate from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a"
namespace Matrix
universe u v w
variable {m : Type u} {n : Type v} {α : Type w}
variable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m] [CommRing α]
open Matrix Polynomial Equiv Equiv.Perm Finset
section Cramer
variable (A : Matrix n n α) (b : n → α)
def cramerMap (i : n) : α :=
(A.updateColumn i b).det
#align matrix.cramer_map Matrix.cramerMap
theorem cramerMap_is_linear (i : n) : IsLinearMap α fun b => cramerMap A b i :=
{ map_add := det_updateColumn_add _ _
map_smul := det_updateColumn_smul _ _ }
#align matrix.cramer_map_is_linear Matrix.cramerMap_is_linear
theorem cramer_is_linear : IsLinearMap α (cramerMap A) := by
constructor <;> intros <;> ext i
· apply (cramerMap_is_linear A i).1
· apply (cramerMap_is_linear A i).2
#align matrix.cramer_is_linear Matrix.cramer_is_linear
def cramer (A : Matrix n n α) : (n → α) →ₗ[α] (n → α) :=
IsLinearMap.mk' (cramerMap A) (cramer_is_linear A)
#align matrix.cramer Matrix.cramer
theorem cramer_apply (i : n) : cramer A b i = (A.updateColumn i b).det :=
rfl
#align matrix.cramer_apply Matrix.cramer_apply
theorem cramer_transpose_apply (i : n) : cramer Aᵀ b i = (A.updateRow i b).det := by
rw [cramer_apply, updateColumn_transpose, det_transpose]
#align matrix.cramer_transpose_apply Matrix.cramer_transpose_apply
theorem cramer_transpose_row_self (i : n) : Aᵀ.cramer (A i) = Pi.single i A.det := by
ext j
rw [cramer_apply, Pi.single_apply]
split_ifs with h
· -- i = j: this entry should be `A.det`
subst h
simp only [updateColumn_transpose, det_transpose, updateRow_eq_self]
· -- i ≠ j: this entry should be 0
rw [updateColumn_transpose, det_transpose]
apply det_zero_of_row_eq h
rw [updateRow_self, updateRow_ne (Ne.symm h)]
#align matrix.cramer_transpose_row_self Matrix.cramer_transpose_row_self
theorem cramer_row_self (i : n) (h : ∀ j, b j = A j i) : A.cramer b = Pi.single i A.det := by
rw [← transpose_transpose A, det_transpose]
convert cramer_transpose_row_self Aᵀ i
exact funext h
#align matrix.cramer_row_self Matrix.cramer_row_self
@[simp]
theorem cramer_one : cramer (1 : Matrix n n α) = 1 := by
-- Porting note: was `ext i j`
refine LinearMap.pi_ext' (fun (i : n) => LinearMap.ext_ring (funext (fun (j : n) => ?_)))
convert congr_fun (cramer_row_self (1 : Matrix n n α) (Pi.single i 1) i _) j
· simp
· intro j
rw [Matrix.one_eq_pi_single, Pi.single_comm]
#align matrix.cramer_one Matrix.cramer_one
theorem cramer_smul (r : α) (A : Matrix n n α) :
cramer (r • A) = r ^ (Fintype.card n - 1) • cramer A :=
LinearMap.ext fun _ => funext fun _ => det_updateColumn_smul' _ _ _ _
#align matrix.cramer_smul Matrix.cramer_smul
@[simp]
theorem cramer_subsingleton_apply [Subsingleton n] (A : Matrix n n α) (b : n → α) (i : n) :
cramer A b i = b i := by rw [cramer_apply, det_eq_elem_of_subsingleton _ i, updateColumn_self]
#align matrix.cramer_subsingleton_apply Matrix.cramer_subsingleton_apply
| Mathlib/LinearAlgebra/Matrix/Adjugate.lean | 145 | 150 | theorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n α) = 0 := by |
ext i j
obtain ⟨j', hj'⟩ : ∃ j', j' ≠ j := exists_ne j
apply det_eq_zero_of_column_eq_zero j'
intro j''
simp [updateColumn_ne hj']
| [
" IsLinearMap α A.cramerMap",
" ∀ (x y : n → α), A.cramerMap (x + y) = A.cramerMap x + A.cramerMap y",
" ∀ (c : α) (x : n → α), A.cramerMap (c • x) = c • A.cramerMap x",
" A.cramerMap (x✝ + y✝) = A.cramerMap x✝ + A.cramerMap y✝",
" A.cramerMap (c✝ • x✝) = c✝ • A.cramerMap x✝",
" A.cramerMap (x✝ + y✝) i = ... | [
" IsLinearMap α A.cramerMap",
" ∀ (x y : n → α), A.cramerMap (x + y) = A.cramerMap x + A.cramerMap y",
" ∀ (c : α) (x : n → α), A.cramerMap (c • x) = c • A.cramerMap x",
" A.cramerMap (x✝ + y✝) = A.cramerMap x✝ + A.cramerMap y✝",
" A.cramerMap (c✝ • x✝) = c✝ • A.cramerMap x✝",
" A.cramerMap (x✝ + y✝) i = ... |
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d"
open NormedField Set
open scoped Pointwise Topology NNReal
noncomputable section
variable {𝕜 E F : Type*}
section AddCommGroup
variable [AddCommGroup E] [Module ℝ E]
def gauge (s : Set E) (x : E) : ℝ :=
sInf { r : ℝ | 0 < r ∧ x ∈ r • s }
#align gauge gauge
variable {s t : Set E} {x : E} {a : ℝ}
theorem gauge_def : gauge s x = sInf ({ r ∈ Set.Ioi (0 : ℝ) | x ∈ r • s }) :=
rfl
#align gauge_def gauge_def
theorem gauge_def' : gauge s x = sInf {r ∈ Set.Ioi (0 : ℝ) | r⁻¹ • x ∈ s} := by
congrm sInf {r | ?_}
exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_mem₀ hr.ne' _ _
#align gauge_def' gauge_def'
private theorem gauge_set_bddBelow : BddBelow { r : ℝ | 0 < r ∧ x ∈ r • s } :=
⟨0, fun _ hr => hr.1.le⟩
theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent ℝ s) :
{ r : ℝ | 0 < r ∧ x ∈ r • s }.Nonempty :=
let ⟨r, hr₁, hr₂⟩ := (absorbs x).exists_pos
⟨r, hr₁, hr₂ r (Real.norm_of_nonneg hr₁.le).ge rfl⟩
#align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty
theorem gauge_mono (hs : Absorbent ℝ s) (h : s ⊆ t) : gauge t ≤ gauge s := fun _ =>
csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => ⟨hr.1, smul_set_mono h hr.2⟩
#align gauge_mono gauge_mono
theorem exists_lt_of_gauge_lt (absorbs : Absorbent ℝ s) (h : gauge s x < a) :
∃ b, 0 < b ∧ b < a ∧ x ∈ b • s := by
obtain ⟨b, ⟨hb, hx⟩, hba⟩ := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h
exact ⟨b, hb, hba, hx⟩
#align exists_lt_of_gauge_lt exists_lt_of_gauge_lt
@[simp]
theorem gauge_zero : gauge s 0 = 0 := by
rw [gauge_def']
by_cases h : (0 : E) ∈ s
· simp only [smul_zero, sep_true, h, csInf_Ioi]
· simp only [smul_zero, sep_false, h, Real.sInf_empty]
#align gauge_zero gauge_zero
@[simp]
theorem gauge_zero' : gauge (0 : Set E) = 0 := by
ext x
rw [gauge_def']
obtain rfl | hx := eq_or_ne x 0
· simp only [csInf_Ioi, mem_zero, Pi.zero_apply, eq_self_iff_true, sep_true, smul_zero]
· simp only [mem_zero, Pi.zero_apply, inv_eq_zero, smul_eq_zero]
convert Real.sInf_empty
exact eq_empty_iff_forall_not_mem.2 fun r hr => hr.2.elim (ne_of_gt hr.1) hx
#align gauge_zero' gauge_zero'
@[simp]
theorem gauge_empty : gauge (∅ : Set E) = 0 := by
ext
simp only [gauge_def', Real.sInf_empty, mem_empty_iff_false, Pi.zero_apply, sep_false]
#align gauge_empty gauge_empty
theorem gauge_of_subset_zero (h : s ⊆ 0) : gauge s = 0 := by
obtain rfl | rfl := subset_singleton_iff_eq.1 h
exacts [gauge_empty, gauge_zero']
#align gauge_of_subset_zero gauge_of_subset_zero
theorem gauge_nonneg (x : E) : 0 ≤ gauge s x :=
Real.sInf_nonneg _ fun _ hx => hx.1.le
#align gauge_nonneg gauge_nonneg
theorem gauge_neg (symmetric : ∀ x ∈ s, -x ∈ s) (x : E) : gauge s (-x) = gauge s x := by
have : ∀ x, -x ∈ s ↔ x ∈ s := fun x => ⟨fun h => by simpa using symmetric _ h, symmetric x⟩
simp_rw [gauge_def', smul_neg, this]
#align gauge_neg gauge_neg
| Mathlib/Analysis/Convex/Gauge.lean | 134 | 135 | theorem gauge_neg_set_neg (x : E) : gauge (-s) (-x) = gauge s x := by |
simp_rw [gauge_def', smul_neg, neg_mem_neg]
| [
" gauge s x = sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s}",
" 0 < r ∧ x ∈ r • s ↔ r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s",
" ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s",
" gauge s 0 = 0",
" sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • 0 ∈ s} = 0",
" gauge 0 = 0",
" gauge 0 x = 0 x",
" sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ 0} = 0 x",
" sInf {r | r ∈ Ioi 0 ∧ ... | [
" gauge s x = sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s}",
" 0 < r ∧ x ∈ r • s ↔ r ∈ Ioi 0 ∧ r⁻¹ • x ∈ s",
" ∃ b, 0 < b ∧ b < a ∧ x ∈ b • s",
" gauge s 0 = 0",
" sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • 0 ∈ s} = 0",
" gauge 0 = 0",
" gauge 0 x = 0 x",
" sInf {r | r ∈ Ioi 0 ∧ r⁻¹ • x ∈ 0} = 0 x",
" sInf {r | r ∈ Ioi 0 ∧ ... |
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.Eval
#align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd"
namespace Polynomial
open Polynomial Finsupp Finset
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] {f : R[X]}
def revAtFun (N i : ℕ) : ℕ :=
ite (i ≤ N) (N - i) i
#align polynomial.rev_at_fun Polynomial.revAtFun
theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by
unfold revAtFun
split_ifs with h j
· exact tsub_tsub_cancel_of_le h
· exfalso
apply j
exact Nat.sub_le N i
· rfl
#align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol
theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by
intro a b hab
rw [← @revAtFun_invol N a, hab, revAtFun_invol]
#align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj
def revAt (N : ℕ) : Function.Embedding ℕ ℕ where
toFun i := ite (i ≤ N) (N - i) i
inj' := revAtFun_inj
#align polynomial.rev_at Polynomial.revAt
@[simp]
theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i :=
rfl
#align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq
@[simp]
theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i :=
revAtFun_invol
#align polynomial.rev_at_invol Polynomial.revAt_invol
@[simp]
theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i :=
if_pos H
#align polynomial.rev_at_le Polynomial.revAt_le
lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h]
theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) :
revAt (N + O) (n + o) = revAt N n + revAt O o := by
rcases Nat.le.dest hn with ⟨n', rfl⟩
rcases Nat.le.dest ho with ⟨o', rfl⟩
repeat' rw [revAt_le (le_add_right rfl.le)]
rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)]
repeat' rw [add_tsub_cancel_left]
#align polynomial.rev_at_add Polynomial.revAt_add
-- @[simp] -- Porting note (#10618): simp can prove this
theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp
#align polynomial.rev_at_zero Polynomial.revAt_zero
noncomputable def reflect (N : ℕ) : R[X] → R[X]
| ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩
#align polynomial.reflect Polynomial.reflect
| Mathlib/Algebra/Polynomial/Reverse.lean | 105 | 109 | theorem reflect_support (N : ℕ) (f : R[X]) :
(reflect N f).support = Finset.image (revAt N) f.support := by |
rcases f with ⟨⟩
ext1
simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image]
| [
" revAtFun N (revAtFun N i) = i",
" (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i",
" N - (N - i) = i",
" N - i = i",
" False",
" N - i ≤ N",
" i = i",
" Function.Injective (revAtFun N)",
" a = b",
" (revAt N) i = i",
" (revAt (N + ... | [
" revAtFun N (revAtFun N i) = i",
" (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i",
" N - (N - i) = i",
" N - i = i",
" False",
" N - i ≤ N",
" i = i",
" Function.Injective (revAtFun N)",
" a = b",
" (revAt N) i = i",
" (revAt (N + ... |
import Mathlib.Algebra.Algebra.Subalgebra.Operations
import Mathlib.Algebra.Ring.Fin
import Mathlib.RingTheory.Ideal.Quotient
#align_import ring_theory.ideal.quotient_operations from "leanprover-community/mathlib"@"b88d81c84530450a8989e918608e5960f015e6c8"
universe u v w
namespace Ideal
open Function RingHom
variable {R : Type u} {S : Type v} {F : Type w} [CommRing R] [Semiring S]
@[simp]
theorem map_quotient_self (I : Ideal R) : map (Quotient.mk I) I = ⊥ :=
eq_bot_iff.2 <|
Ideal.map_le_iff_le_comap.2 fun _ hx =>
(Submodule.mem_bot (R ⧸ I)).2 <| Ideal.Quotient.eq_zero_iff_mem.2 hx
#align ideal.map_quotient_self Ideal.map_quotient_self
@[simp]
theorem mk_ker {I : Ideal R} : ker (Quotient.mk I) = I := by
ext
rw [ker, mem_comap, Submodule.mem_bot, Quotient.eq_zero_iff_mem]
#align ideal.mk_ker Ideal.mk_ker
theorem map_mk_eq_bot_of_le {I J : Ideal R} (h : I ≤ J) : I.map (Quotient.mk J) = ⊥ := by
rw [map_eq_bot_iff_le_ker, mk_ker]
exact h
#align ideal.map_mk_eq_bot_of_le Ideal.map_mk_eq_bot_of_le
theorem ker_quotient_lift {I : Ideal R} (f : R →+* S)
(H : I ≤ ker f) :
ker (Ideal.Quotient.lift I f H) = f.ker.map (Quotient.mk I) := by
apply Ideal.ext
intro x
constructor
· intro hx
obtain ⟨y, hy⟩ := Quotient.mk_surjective x
rw [mem_ker, ← hy, Ideal.Quotient.lift_mk, ← mem_ker] at hx
rw [← hy, mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective]
exact ⟨y, hx, rfl⟩
· intro hx
rw [mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective] at hx
obtain ⟨y, hy⟩ := hx
rw [mem_ker, ← hy.right, Ideal.Quotient.lift_mk]
exact hy.left
#align ideal.ker_quotient_lift Ideal.ker_quotient_lift
lemma injective_lift_iff {I : Ideal R} {f : R →+* S} (H : ∀ (a : R), a ∈ I → f a = 0) :
Injective (Quotient.lift I f H) ↔ ker f = I := by
rw [injective_iff_ker_eq_bot, ker_quotient_lift, map_eq_bot_iff_le_ker, mk_ker]
constructor
· exact fun h ↦ le_antisymm h H
· rintro rfl; rfl
lemma ker_Pi_Quotient_mk {ι : Type*} (I : ι → Ideal R) :
ker (Pi.ringHom fun i : ι ↦ Quotient.mk (I i)) = ⨅ i, I i := by
simp [Pi.ker_ringHom, mk_ker]
@[simp]
theorem bot_quotient_isMaximal_iff (I : Ideal R) : (⊥ : Ideal (R ⧸ I)).IsMaximal ↔ I.IsMaximal :=
⟨fun hI =>
mk_ker (I := I) ▸
comap_isMaximal_of_surjective (Quotient.mk I) Quotient.mk_surjective (K := ⊥) (H := hI),
fun hI => by
letI := Quotient.field I
exact bot_isMaximal⟩
#align ideal.bot_quotient_is_maximal_iff Ideal.bot_quotient_isMaximal_iff
@[simp]
theorem mem_quotient_iff_mem_sup {I J : Ideal R} {x : R} :
Quotient.mk I x ∈ J.map (Quotient.mk I) ↔ x ∈ J ⊔ I := by
rw [← mem_comap, comap_map_of_surjective (Quotient.mk I) Quotient.mk_surjective, ←
ker_eq_comap_bot, mk_ker]
#align ideal.mem_quotient_iff_mem_sup Ideal.mem_quotient_iff_mem_sup
| Mathlib/RingTheory/Ideal/QuotientOperations.lean | 189 | 191 | theorem mem_quotient_iff_mem {I J : Ideal R} (hIJ : I ≤ J) {x : R} :
Quotient.mk I x ∈ J.map (Quotient.mk I) ↔ x ∈ J := by |
rw [mem_quotient_iff_mem_sup, sup_eq_left.mpr hIJ]
| [
" ker (Quotient.mk I) = I",
" x✝ ∈ ker (Quotient.mk I) ↔ x✝ ∈ I",
" map (Quotient.mk J) I = ⊥",
" I ≤ J",
" ker (Quotient.lift I f H) = map (Quotient.mk I) (ker f)",
" ∀ (x : R ⧸ I), x ∈ ker (Quotient.lift I f H) ↔ x ∈ map (Quotient.mk I) (ker f)",
" x ∈ ker (Quotient.lift I f H) ↔ x ∈ map (Quotient.mk ... | [
" ker (Quotient.mk I) = I",
" x✝ ∈ ker (Quotient.mk I) ↔ x✝ ∈ I",
" map (Quotient.mk J) I = ⊥",
" I ≤ J",
" ker (Quotient.lift I f H) = map (Quotient.mk I) (ker f)",
" ∀ (x : R ⧸ I), x ∈ ker (Quotient.lift I f H) ↔ x ∈ map (Quotient.mk I) (ker f)",
" x ∈ ker (Quotient.lift I f H) ↔ x ∈ map (Quotient.mk ... |
import Mathlib.Analysis.Calculus.ContDiff.Bounds
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.LineDeriv.Basic
import Mathlib.Analysis.LocallyConvex.WithSeminorms
import Mathlib.Analysis.Normed.Group.ZeroAtInfty
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
import Mathlib.Topology.Algebra.UniformFilterBasis
import Mathlib.Tactic.MoveAdd
#align_import analysis.schwartz_space from "leanprover-community/mathlib"@"e137999b2c6f2be388f4cd3bbf8523de1910cd2b"
noncomputable section
open scoped Nat NNReal
variable {𝕜 𝕜' D E F G V : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
variable [NormedAddCommGroup F] [NormedSpace ℝ F]
variable (E F)
structure SchwartzMap where
toFun : E → F
smooth' : ContDiff ℝ ⊤ toFun
decay' : ∀ k n : ℕ, ∃ C : ℝ, ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n toFun x‖ ≤ C
#align schwartz_map SchwartzMap
scoped[SchwartzMap] notation "𝓢(" E ", " F ")" => SchwartzMap E F
variable {E F}
namespace SchwartzMap
-- Porting note: removed
-- instance : Coe 𝓢(E, F) (E → F) := ⟨toFun⟩
instance instFunLike : FunLike 𝓢(E, F) E F where
coe f := f.toFun
coe_injective' f g h := by cases f; cases g; congr
#align schwartz_map.fun_like SchwartzMap.instFunLike
instance instCoeFun : CoeFun 𝓢(E, F) fun _ => E → F :=
DFunLike.hasCoeToFun
#align schwartz_map.has_coe_to_fun SchwartzMap.instCoeFun
theorem decay (f : 𝓢(E, F)) (k n : ℕ) :
∃ C : ℝ, 0 < C ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ C := by
rcases f.decay' k n with ⟨C, hC⟩
exact ⟨max C 1, by positivity, fun x => (hC x).trans (le_max_left _ _)⟩
#align schwartz_map.decay SchwartzMap.decay
theorem smooth (f : 𝓢(E, F)) (n : ℕ∞) : ContDiff ℝ n f :=
f.smooth'.of_le le_top
#align schwartz_map.smooth SchwartzMap.smooth
@[continuity]
protected theorem continuous (f : 𝓢(E, F)) : Continuous f :=
(f.smooth 0).continuous
#align schwartz_map.continuous SchwartzMap.continuous
instance instContinuousMapClass : ContinuousMapClass 𝓢(E, F) E F where
map_continuous := SchwartzMap.continuous
protected theorem differentiable (f : 𝓢(E, F)) : Differentiable ℝ f :=
(f.smooth 1).differentiable rfl.le
#align schwartz_map.differentiable SchwartzMap.differentiable
protected theorem differentiableAt (f : 𝓢(E, F)) {x : E} : DifferentiableAt ℝ f x :=
f.differentiable.differentiableAt
#align schwartz_map.differentiable_at SchwartzMap.differentiableAt
@[ext]
theorem ext {f g : 𝓢(E, F)} (h : ∀ x, (f : E → F) x = g x) : f = g :=
DFunLike.ext f g h
#align schwartz_map.ext SchwartzMap.ext
section Aux
theorem bounds_nonempty (k n : ℕ) (f : 𝓢(E, F)) :
∃ c : ℝ, c ∈ { c : ℝ | 0 ≤ c ∧ ∀ x : E, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } :=
let ⟨M, hMp, hMb⟩ := f.decay k n
⟨M, le_of_lt hMp, hMb⟩
#align schwartz_map.bounds_nonempty SchwartzMap.bounds_nonempty
theorem bounds_bddBelow (k n : ℕ) (f : 𝓢(E, F)) :
BddBelow { c | 0 ≤ c ∧ ∀ x, ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ ≤ c } :=
⟨0, fun _ ⟨hn, _⟩ => hn⟩
#align schwartz_map.bounds_bdd_below SchwartzMap.bounds_bddBelow
theorem decay_add_le_aux (k n : ℕ) (f g : 𝓢(E, F)) (x : E) :
‖x‖ ^ k * ‖iteratedFDeriv ℝ n ((f : E → F) + (g : E → F)) x‖ ≤
‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ + ‖x‖ ^ k * ‖iteratedFDeriv ℝ n g x‖ := by
rw [← mul_add]
refine mul_le_mul_of_nonneg_left ?_ (by positivity)
rw [iteratedFDeriv_add_apply (f.smooth _) (g.smooth _)]
exact norm_add_le _ _
#align schwartz_map.decay_add_le_aux SchwartzMap.decay_add_le_aux
| Mathlib/Analysis/Distribution/SchwartzSpace.lean | 203 | 205 | theorem decay_neg_aux (k n : ℕ) (f : 𝓢(E, F)) (x : E) :
‖x‖ ^ k * ‖iteratedFDeriv ℝ n (-f : E → F) x‖ = ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖ := by |
rw [iteratedFDeriv_neg_apply, norm_neg]
| [
" f = g",
" { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ } = g",
" { toFun := toFun✝¹, smooth' := smooth'✝¹, decay' := decay'✝¹ } =\n { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ }",
" ∃ C, 0 < C ∧ ∀ (x : E), ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ C",
" 0 < max C 1",
" ‖x‖ ^ ... | [
" f = g",
" { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ } = g",
" { toFun := toFun✝¹, smooth' := smooth'✝¹, decay' := decay'✝¹ } =\n { toFun := toFun✝, smooth' := smooth'✝, decay' := decay'✝ }",
" ∃ C, 0 < C ∧ ∀ (x : E), ‖x‖ ^ k * ‖iteratedFDeriv ℝ n (⇑f) x‖ ≤ C",
" 0 < max C 1",
" ‖x‖ ^ ... |
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.RingTheory.Ideal.LocalRing
import Mathlib.RingTheory.Valuation.PrimeMultiplicity
import Mathlib.RingTheory.AdicCompletion.Basic
#align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68"
open scoped Classical
universe u
open Ideal LocalRing
class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R]
extends IsPrincipalIdealRing R, LocalRing R : Prop where
not_a_field' : maximalIdeal R ≠ ⊥
#align discrete_valuation_ring DiscreteValuationRing
namespace DiscreteValuationRing
variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R]
theorem not_a_field : maximalIdeal R ≠ ⊥ :=
not_a_field'
#align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field
theorem not_isField : ¬IsField R :=
LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R)
#align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField
variable {R}
open PrincipalIdealRing
theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R]
(ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by
have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ
refine ⟨h2, ?_⟩
intro a b hab
by_contra! h
obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h
rw [h, mem_span_singleton'] at ha hb
rcases ha with ⟨a, rfl⟩
rcases hb with ⟨b, rfl⟩
rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab
apply hϖ
apply eq_zero_of_mul_eq_self_right _ hab.symm
exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩)
#align discrete_valuation_ring.irreducible_of_span_eq_maximal_ideal DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal
theorem irreducible_iff_uniformizer (ϖ : R) : Irreducible ϖ ↔ maximalIdeal R = Ideal.span {ϖ} :=
⟨fun hϖ => (eq_maximalIdeal (isMaximal_of_irreducible hϖ)).symm,
fun h => irreducible_of_span_eq_maximalIdeal ϖ
(fun e => not_a_field R <| by rwa [h, span_singleton_eq_bot]) h⟩
#align discrete_valuation_ring.irreducible_iff_uniformizer DiscreteValuationRing.irreducible_iff_uniformizer
theorem _root_.Irreducible.maximalIdeal_eq {ϖ : R} (h : Irreducible ϖ) :
maximalIdeal R = Ideal.span {ϖ} :=
(irreducible_iff_uniformizer _).mp h
#align irreducible.maximal_ideal_eq Irreducible.maximalIdeal_eq
variable (R)
| Mathlib/RingTheory/DiscreteValuationRing/Basic.lean | 107 | 109 | theorem exists_irreducible : ∃ ϖ : R, Irreducible ϖ := by |
simp_rw [irreducible_iff_uniformizer]
exact (IsPrincipalIdealRing.principal <| maximalIdeal R).principal
| [
" Irreducible ϖ",
" ∀ (a b : R), ϖ = a * b → IsUnit a ∨ IsUnit b",
" IsUnit a ∨ IsUnit b",
" False",
" a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b))",
" ϖ = 0",
" ϖ * (a * b) ≠ 1",
" maximalIdeal R = ⊥",
" ∃ ϖ, Irreducible ϖ",
" ∃ ϖ, maximalIdeal R = span {ϖ}"
] | [
" Irreducible ϖ",
" ∀ (a b : R), ϖ = a * b → IsUnit a ∨ IsUnit b",
" IsUnit a ∨ IsUnit b",
" False",
" a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b))",
" ϖ = 0",
" ϖ * (a * b) ≠ 1",
" maximalIdeal R = ⊥"
] |
import Mathlib.Data.Matrix.Block
import Mathlib.Data.Matrix.Notation
import Mathlib.LinearAlgebra.StdBasis
import Mathlib.RingTheory.AlgebraTower
import Mathlib.Algebra.Algebra.Subalgebra.Tower
#align_import linear_algebra.matrix.to_lin from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6"
noncomputable section
open LinearMap Matrix Set Submodule
section ToMatrixRight
variable {R : Type*} [Semiring R]
variable {l m n : Type*}
def Matrix.vecMulLinear [Fintype m] (M : Matrix m n R) : (m → R) →ₗ[R] n → R where
toFun x := x ᵥ* M
map_add' _ _ := funext fun _ ↦ add_dotProduct _ _ _
map_smul' _ _ := funext fun _ ↦ smul_dotProduct _ _ _
#align matrix.vec_mul_linear Matrix.vecMulLinear
@[simp] theorem Matrix.vecMulLinear_apply [Fintype m] (M : Matrix m n R) (x : m → R) :
M.vecMulLinear x = x ᵥ* M := rfl
theorem Matrix.coe_vecMulLinear [Fintype m] (M : Matrix m n R) :
(M.vecMulLinear : _ → _) = M.vecMul := rfl
variable [Fintype m] [DecidableEq m]
@[simp]
| Mathlib/LinearAlgebra/Matrix/ToLin.lean | 91 | 99 | theorem Matrix.vecMul_stdBasis (M : Matrix m n R) (i j) :
(LinearMap.stdBasis R (fun _ ↦ R) i 1 ᵥ* M) j = M i j := by |
have : (∑ i', (if i = i' then 1 else 0) * M i' j) = M i j := by
simp_rw [boole_mul, Finset.sum_ite_eq, Finset.mem_univ, if_true]
simp only [vecMul, dotProduct]
convert this
split_ifs with h <;> simp only [stdBasis_apply]
· rw [h, Function.update_same]
· rw [Function.update_noteq (Ne.symm h), Pi.zero_apply]
| [
" ((LinearMap.stdBasis R (fun x => R) i) 1 ᵥ* M) j = M i j",
" ∑ i' : m, (if i = i' then 1 else 0) * M i' j = M i j",
" ∑ x : m, (LinearMap.stdBasis R (fun x => R) i) 1 x * M x j = M i j",
" (LinearMap.stdBasis R (fun x => R) i) 1 x✝ = if i = x✝ then 1 else 0",
" (LinearMap.stdBasis R (fun x => R) i) 1 x✝ =... | [] |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Module.Pi
#align_import data.holor from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
universe u
open List
def HolorIndex (ds : List ℕ) : Type :=
{ is : List ℕ // Forall₂ (· < ·) is ds }
#align holor_index HolorIndex
namespace HolorIndex
variable {ds₁ ds₂ ds₃ : List ℕ}
def take : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₁
| ds, is => ⟨List.take (length ds) is.1, forall₂_take_append is.1 ds ds₂ is.2⟩
#align holor_index.take HolorIndex.take
def drop : ∀ {ds₁ : List ℕ}, HolorIndex (ds₁ ++ ds₂) → HolorIndex ds₂
| ds, is => ⟨List.drop (length ds) is.1, forall₂_drop_append is.1 ds ds₂ is.2⟩
#align holor_index.drop HolorIndex.drop
| Mathlib/Data/Holor.lean | 58 | 59 | theorem cast_type (is : List ℕ) (eq : ds₁ = ds₂) (h : Forall₂ (· < ·) is ds₁) :
(cast (congr_arg HolorIndex eq) ⟨is, h⟩).val = is := by | subst eq; rfl
| [
" ↑(cast ⋯ ⟨is, h⟩) = is"
] | [] |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Polynomial.Degree.Lemmas
#align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448"
noncomputable section
open Polynomial
open Polynomial Finset
namespace Polynomial
variable {R : Type*} [Semiring R] {f : R[X]}
def eraseLead (f : R[X]) : R[X] :=
Polynomial.erase f.natDegree f
#align polynomial.erase_lead Polynomial.eraseLead
section EraseLead
theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by
simp only [eraseLead, support_erase]
#align polynomial.erase_lead_support Polynomial.eraseLead_support
theorem eraseLead_coeff (i : ℕ) :
f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by
simp only [eraseLead, coeff_erase]
#align polynomial.erase_lead_coeff Polynomial.eraseLead_coeff
@[simp]
theorem eraseLead_coeff_natDegree : f.eraseLead.coeff f.natDegree = 0 := by simp [eraseLead_coeff]
#align polynomial.erase_lead_coeff_nat_degree Polynomial.eraseLead_coeff_natDegree
theorem eraseLead_coeff_of_ne (i : ℕ) (hi : i ≠ f.natDegree) : f.eraseLead.coeff i = f.coeff i := by
simp [eraseLead_coeff, hi]
#align polynomial.erase_lead_coeff_of_ne Polynomial.eraseLead_coeff_of_ne
@[simp]
| Mathlib/Algebra/Polynomial/EraseLead.lean | 60 | 60 | theorem eraseLead_zero : eraseLead (0 : R[X]) = 0 := by | simp only [eraseLead, erase_zero]
| [
" f.eraseLead.support = f.support.erase f.natDegree",
" f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i",
" f.eraseLead.coeff f.natDegree = 0",
" f.eraseLead.coeff i = f.coeff i",
" eraseLead 0 = 0"
] | [
" f.eraseLead.support = f.support.erase f.natDegree",
" f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i",
" f.eraseLead.coeff f.natDegree = 0",
" f.eraseLead.coeff i = f.coeff i"
] |
import Mathlib.Data.List.Infix
#align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
-- Make sure we don't import algebra
assert_not_exists Monoid
variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ)
namespace List
def rdrop : List α :=
l.take (l.length - n)
#align list.rdrop List.rdrop
@[simp]
theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop]
#align list.rdrop_nil List.rdrop_nil
@[simp]
theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop]
#align list.rdrop_zero List.rdrop_zero
theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by
rw [rdrop]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· simp [take_append]
· simp [take_append_eq_append_take, IH]
#align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse
@[simp]
theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by
simp [rdrop_eq_reverse_drop_reverse]
#align list.rdrop_concat_succ List.rdrop_concat_succ
def rtake : List α :=
l.drop (l.length - n)
#align list.rtake List.rtake
@[simp]
theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake]
#align list.rtake_nil List.rtake_nil
@[simp]
theorem rtake_zero : rtake l 0 = [] := by simp [rtake]
#align list.rtake_zero List.rtake_zero
theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by
rw [rtake]
induction' l using List.reverseRecOn with xs x IH generalizing n
· simp
· cases n
· exact drop_length _
· simp [drop_append_eq_append_drop, IH]
#align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse
@[simp]
| Mathlib/Data/List/DropRight.lean | 91 | 92 | theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by |
simp [rtake_eq_reverse_take_reverse]
| [
" [].rdrop n = []",
" l.rdrop 0 = l",
" l.rdrop n = (drop n l.reverse).reverse",
" take (l.length - n) l = (drop n l.reverse).reverse",
" take ([].length - n) [] = (drop n [].reverse).reverse",
" take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse",
" take ((xs ++ [x]).lengt... | [
" [].rdrop n = []",
" l.rdrop 0 = l",
" l.rdrop n = (drop n l.reverse).reverse",
" take (l.length - n) l = (drop n l.reverse).reverse",
" take ([].length - n) [] = (drop n [].reverse).reverse",
" take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse",
" take ((xs ++ [x]).lengt... |
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.normed_space.enorm from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
noncomputable section
attribute [local instance] Classical.propDecidable
open ENNReal
structure ENorm (𝕜 : Type*) (V : Type*) [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] where
toFun : V → ℝ≥0∞
eq_zero' : ∀ x, toFun x = 0 → x = 0
map_add_le' : ∀ x y : V, toFun (x + y) ≤ toFun x + toFun y
map_smul_le' : ∀ (c : 𝕜) (x : V), toFun (c • x) ≤ ‖c‖₊ * toFun x
#align enorm ENorm
namespace ENorm
variable {𝕜 : Type*} {V : Type*} [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] (e : ENorm 𝕜 V)
-- Porting note: added to appease norm_cast complaints
attribute [coe] ENorm.toFun
instance : CoeFun (ENorm 𝕜 V) fun _ => V → ℝ≥0∞ :=
⟨ENorm.toFun⟩
theorem coeFn_injective : Function.Injective ((↑) : ENorm 𝕜 V → V → ℝ≥0∞) := fun e₁ e₂ h => by
cases e₁
cases e₂
congr
#align enorm.coe_fn_injective ENorm.coeFn_injective
@[ext]
theorem ext {e₁ e₂ : ENorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂ :=
coeFn_injective <| funext h
#align enorm.ext ENorm.ext
theorem ext_iff {e₁ e₂ : ENorm 𝕜 V} : e₁ = e₂ ↔ ∀ x, e₁ x = e₂ x :=
⟨fun h _ => h ▸ rfl, ext⟩
#align enorm.ext_iff ENorm.ext_iff
@[simp, norm_cast]
theorem coe_inj {e₁ e₂ : ENorm 𝕜 V} : (e₁ : V → ℝ≥0∞) = e₂ ↔ e₁ = e₂ :=
coeFn_injective.eq_iff
#align enorm.coe_inj ENorm.coe_inj
@[simp]
theorem map_smul (c : 𝕜) (x : V) : e (c • x) = ‖c‖₊ * e x := by
apply le_antisymm (e.map_smul_le' c x)
by_cases hc : c = 0
· simp [hc]
calc
(‖c‖₊ : ℝ≥0∞) * e x = ‖c‖₊ * e (c⁻¹ • c • x) := by rw [inv_smul_smul₀ hc]
_ ≤ ‖c‖₊ * (‖c⁻¹‖₊ * e (c • x)) := mul_le_mul_left' (e.map_smul_le' _ _) _
_ = e (c • x) := by
rw [← mul_assoc, nnnorm_inv, ENNReal.coe_inv, ENNReal.mul_inv_cancel _ ENNReal.coe_ne_top,
one_mul]
<;> simp [hc]
#align enorm.map_smul ENorm.map_smul
@[simp]
theorem map_zero : e 0 = 0 := by
rw [← zero_smul 𝕜 (0 : V), e.map_smul]
norm_num
#align enorm.map_zero ENorm.map_zero
@[simp]
theorem eq_zero_iff {x : V} : e x = 0 ↔ x = 0 :=
⟨e.eq_zero' x, fun h => h.symm ▸ e.map_zero⟩
#align enorm.eq_zero_iff ENorm.eq_zero_iff
@[simp]
theorem map_neg (x : V) : e (-x) = e x :=
calc
e (-x) = ‖(-1 : 𝕜)‖₊ * e x := by rw [← map_smul, neg_one_smul]
_ = e x := by simp
#align enorm.map_neg ENorm.map_neg
| Mathlib/Analysis/NormedSpace/ENorm.lean | 113 | 113 | theorem map_sub_rev (x y : V) : e (x - y) = e (y - x) := by | rw [← neg_sub, e.map_neg]
| [
" e₁ = e₂",
" { toFun := toFun✝, eq_zero' := eq_zero'✝, map_add_le' := map_add_le'✝, map_smul_le' := map_smul_le'✝ } = e₂",
" { toFun := toFun✝¹, eq_zero' := eq_zero'✝¹, map_add_le' := map_add_le'✝¹, map_smul_le' := map_smul_le'✝¹ } =\n { toFun := toFun✝, eq_zero' := eq_zero'✝, map_add_le' := map_add_le'✝, m... | [
" e₁ = e₂",
" { toFun := toFun✝, eq_zero' := eq_zero'✝, map_add_le' := map_add_le'✝, map_smul_le' := map_smul_le'✝ } = e₂",
" { toFun := toFun✝¹, eq_zero' := eq_zero'✝¹, map_add_le' := map_add_le'✝¹, map_smul_le' := map_smul_le'✝¹ } =\n { toFun := toFun✝, eq_zero' := eq_zero'✝, map_add_le' := map_add_le'✝, m... |
import Mathlib.Data.Nat.Lattice
import Mathlib.Logic.Denumerable
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.Hom.Basic
import Mathlib.Data.Set.Subsingleton
#align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
variable {α : Type*}
namespace RelEmbedding
variable {r : α → α → Prop} [IsStrictOrder α r]
def natLT (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) : ((· < ·) : ℕ → ℕ → Prop) ↪r r :=
ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H
#align rel_embedding.nat_lt RelEmbedding.natLT
@[simp]
theorem coe_natLT {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} : ⇑(natLT f H) = f :=
rfl
#align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT
def natGT (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((· > ·) : ℕ → ℕ → Prop) ↪r r :=
haveI := IsStrictOrder.swap r
RelEmbedding.swap (natLT f H)
#align rel_embedding.nat_gt RelEmbedding.natGT
@[simp]
theorem coe_natGT {f : ℕ → α} {H : ∀ n : ℕ, r (f (n + 1)) (f n)} : ⇑(natGT f H) = f :=
rfl
#align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT
theorem exists_not_acc_lt_of_not_acc {a : α} {r} (h : ¬Acc r a) : ∃ b, ¬Acc r b ∧ r b a := by
contrapose! h
refine ⟨_, fun b hr => ?_⟩
by_contra hb
exact h b hb hr
#align rel_embedding.exists_not_acc_lt_of_not_acc RelEmbedding.exists_not_acc_lt_of_not_acc
| Mathlib/Order/OrderIsoNat.lean | 66 | 81 | theorem acc_iff_no_decreasing_seq {x} :
Acc r x ↔ IsEmpty { f : ((· > ·) : ℕ → ℕ → Prop) ↪r r // x ∈ Set.range f } := by |
constructor
· refine fun h => h.recOn fun x _ IH => ?_
constructor
rintro ⟨f, k, hf⟩
exact IsEmpty.elim' (IH (f (k + 1)) (hf ▸ f.map_rel_iff.2 (lt_add_one k))) ⟨f, _, rfl⟩
· have : ∀ x : { a // ¬Acc r a }, ∃ y : { a // ¬Acc r a }, r y.1 x.1 := by
rintro ⟨x, hx⟩
cases exists_not_acc_lt_of_not_acc hx with
| intro w h => exact ⟨⟨w, h.1⟩, h.2⟩
choose f h using this
refine fun E =>
by_contradiction fun hx => E.elim' ⟨natGT (fun n => (f^[n] ⟨x, hx⟩).1) fun n => ?_, 0, rfl⟩
simp only [Function.iterate_succ']
apply h
| [
" ∃ b, ¬Acc r b ∧ r b a",
" Acc r a",
" Acc r b",
" False",
" Acc r x ↔ IsEmpty { f // x ∈ Set.range ⇑f }",
" Acc r x → IsEmpty { f // x ∈ Set.range ⇑f }",
" IsEmpty { f // x ∈ Set.range ⇑f }",
" { f // x ∈ Set.range ⇑f } → False",
" IsEmpty { f // x ∈ Set.range ⇑f } → Acc r x",
" ∀ (x : { a // ¬A... | [
" ∃ b, ¬Acc r b ∧ r b a",
" Acc r a",
" Acc r b",
" False"
] |
import Mathlib.RepresentationTheory.Rep
import Mathlib.Algebra.Category.FGModuleCat.Limits
import Mathlib.CategoryTheory.Preadditive.Schur
import Mathlib.RepresentationTheory.Basic
#align_import representation_theory.fdRep from "leanprover-community/mathlib"@"19a70dceb9dff0994b92d2dd049de7d84d28112b"
suppress_compilation
universe u
open CategoryTheory
open CategoryTheory.Limits
set_option linter.uppercaseLean3 false -- `FdRep`
abbrev FdRep (k G : Type u) [Field k] [Monoid G] :=
Action (FGModuleCat.{u} k) (MonCat.of G)
#align fdRep FdRep
namespace FdRep
variable {k G : Type u} [Field k] [Monoid G]
-- Porting note: `@[derive]` didn't work for `FdRep`. Add the 4 instances here.
instance : LargeCategory (FdRep k G) := inferInstance
instance : ConcreteCategory (FdRep k G) := inferInstance
instance : Preadditive (FdRep k G) := inferInstance
instance : HasFiniteLimits (FdRep k G) := inferInstance
instance : Linear k (FdRep k G) := by infer_instance
instance : CoeSort (FdRep k G) (Type u) :=
ConcreteCategory.hasCoeToSort _
instance (V : FdRep k G) : AddCommGroup V := by
change AddCommGroup ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance
instance (V : FdRep k G) : Module k V := by
change Module k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj; infer_instance
instance (V : FdRep k G) : FiniteDimensional k V := by
change FiniteDimensional k ((forget₂ (FdRep k G) (FGModuleCat k)).obj V); infer_instance
instance (V W : FdRep k G) : FiniteDimensional k (V ⟶ W) :=
FiniteDimensional.of_injective ((forget₂ (FdRep k G) (FGModuleCat k)).mapLinearMap k)
(Functor.map_injective (forget₂ (FdRep k G) (FGModuleCat k)))
def ρ (V : FdRep k G) : G →* V →ₗ[k] V :=
Action.ρ V
#align fdRep.ρ FdRep.ρ
def isoToLinearEquiv {V W : FdRep k G} (i : V ≅ W) : V ≃ₗ[k] W :=
FGModuleCat.isoToLinearEquiv ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i)
#align fdRep.iso_to_linear_equiv FdRep.isoToLinearEquiv
theorem Iso.conj_ρ {V W : FdRep k G} (i : V ≅ W) (g : G) :
W.ρ g = (FdRep.isoToLinearEquiv i).conj (V.ρ g) := by
-- Porting note: Changed `rw` to `erw`
erw [FdRep.isoToLinearEquiv, ← FGModuleCat.Iso.conj_eq_conj, Iso.conj_apply]
rw [Iso.eq_inv_comp ((Action.forget (FGModuleCat k) (MonCat.of G)).mapIso i)]
exact (i.hom.comm g).symm
#align fdRep.iso.conj_ρ FdRep.Iso.conj_ρ
@[simps ρ]
def of {V : Type u} [AddCommGroup V] [Module k V] [FiniteDimensional k V]
(ρ : Representation k G V) : FdRep k G :=
⟨FGModuleCat.of k V, ρ⟩
#align fdRep.of FdRep.of
instance : HasForget₂ (FdRep k G) (Rep k G) where
forget₂ := (forget₂ (FGModuleCat k) (ModuleCat k)).mapAction (MonCat.of G)
| Mathlib/RepresentationTheory/FdRep.lean | 113 | 114 | theorem forget₂_ρ (V : FdRep k G) : ((forget₂ (FdRep k G) (Rep k G)).obj V).ρ = V.ρ := by |
ext g v; rfl
| [
" Linear k (FdRep k G)",
" AddCommGroup (CoeSort.coe V)",
" AddCommGroup ↑((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj",
" Module k (CoeSort.coe V)",
" Module k ↑((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj",
" FiniteDimensional k (CoeSort.coe V)",
" FiniteDimensional k ↑((forget₂ (FdRep k G) ... | [
" Linear k (FdRep k G)",
" AddCommGroup (CoeSort.coe V)",
" AddCommGroup ↑((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj",
" Module k (CoeSort.coe V)",
" Module k ↑((forget₂ (FdRep k G) (FGModuleCat k)).obj V).obj",
" FiniteDimensional k (CoeSort.coe V)",
" FiniteDimensional k ↑((forget₂ (FdRep k G) ... |
import Mathlib.Algebra.Module.PID
import Mathlib.Data.ZMod.Quotient
#align_import group_theory.finite_abelian from "leanprover-community/mathlib"@"879155bff5af618b9062cbb2915347dafd749ad6"
open scoped DirectSum
private def directSumNeZeroMulHom {ι : Type} [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :
(⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) →+ ⨁ i, ZMod (p i ^ n i) :=
DirectSum.toAddMonoid fun i ↦ DirectSum.of (fun i ↦ ZMod (p i ^ n i)) i
private def directSumNeZeroMulEquiv (ι : Type) [DecidableEq ι] (p : ι → ℕ) (n : ι → ℕ) :
(⨁ i : {i // n i ≠ 0}, ZMod (p i ^ n i)) ≃+ ⨁ i, ZMod (p i ^ n i) where
toFun := directSumNeZeroMulHom p n
invFun := DirectSum.toAddMonoid fun i ↦
if h : n i = 0 then 0 else DirectSum.of (fun j : {i // n i ≠ 0} ↦ ZMod (p j ^ n j)) ⟨i, h⟩
left_inv x := by
induction' x using DirectSum.induction_on with i x x y hx hy
· simp
· rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of, DirectSum.toAddMonoid_of,
dif_neg i.prop]
· rw [map_add, map_add, hx, hy]
right_inv x := by
induction' x using DirectSum.induction_on with i x x y hx hy
· rw [map_zero, map_zero]
· rw [DirectSum.toAddMonoid_of]
split_ifs with h
· simp [(ZMod.subsingleton_iff.2 $ by rw [h, pow_zero]).elim x 0]
· simp_rw [directSumNeZeroMulHom, DirectSum.toAddMonoid_of]
· rw [map_add, map_add, hx, hy]
map_add' := map_add (directSumNeZeroMulHom p n)
universe u
namespace Module
variable (M : Type u)
| Mathlib/GroupTheory/FiniteAbelian.lean | 91 | 100 | theorem finite_of_fg_torsion [AddCommGroup M] [Module ℤ M] [Module.Finite ℤ M]
(hM : Module.IsTorsion ℤ M) : _root_.Finite M := by |
rcases Module.equiv_directSum_of_isTorsion hM with ⟨ι, _, p, h, e, ⟨l⟩⟩
haveI : ∀ i : ι, NeZero (p i ^ e i).natAbs := fun i =>
⟨Int.natAbs_ne_zero.mpr <| pow_ne_zero (e i) (h i).ne_zero⟩
haveI : ∀ i : ι, _root_.Finite <| ℤ ⧸ Submodule.span ℤ {p i ^ e i} := fun i =>
Finite.of_equiv _ (p i ^ e i).quotientSpanEquivZMod.symm.toEquiv
haveI : _root_.Finite (⨁ i, ℤ ⧸ (Submodule.span ℤ {p i ^ e i} : Submodule ℤ ℤ)) :=
Finite.of_equiv _ DFinsupp.equivFunOnFintype.symm
exact Finite.of_equiv _ l.symm.toEquiv
| [
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p ↑j ^ n ↑j)) ⟨i, h⟩)\n ((directSumNeZeroMulHom p n) x) =\n x",
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p ↑j ^ n ↑j)) ⟨i, h⟩)\n ((directSumNeZeroMulHom p n) 0) =... | [
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p ↑j ^ n ↑j)) ⟨i, h⟩)\n ((directSumNeZeroMulHom p n) x) =\n x",
" (DirectSum.toAddMonoid fun i => if h : n i = 0 then 0 else DirectSum.of (fun j => ZMod (p ↑j ^ n ↑j)) ⟨i, h⟩)\n ((directSumNeZeroMulHom p n) 0) =... |
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
import Mathlib.RepresentationTheory.GroupCohomology.Basic
import Mathlib.RepresentationTheory.Invariants
universe v u
noncomputable section
open CategoryTheory Limits Representation
variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G)
namespace groupCohomology
section IsMulCocycle
section
variable {G M : Type*} [Mul G] [CommGroup M] [SMul G M]
def IsMulOneCocycle (f : G → M) : Prop := ∀ g h : G, f (g * h) = g • f h * f g
def IsMulTwoCocycle (f : G × G → M) : Prop :=
∀ g h j : G, f (g * h, j) * f (g, h) = g • (f (h, j)) * f (g, h * j)
end
section
variable {G M : Type*} [Monoid G] [CommGroup M] [MulAction G M]
theorem map_one_of_isMulOneCocycle {f : G → M} (hf : IsMulOneCocycle f) :
f 1 = 1 := by
simpa only [mul_one, one_smul, self_eq_mul_right] using hf 1 1
theorem map_one_fst_of_isMulTwoCocycle {f : G × G → M} (hf : IsMulTwoCocycle f) (g : G) :
f (1, g) = f (1, 1) := by
simpa only [one_smul, one_mul, mul_one, mul_right_inj] using (hf 1 1 g).symm
| Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean | 532 | 534 | theorem map_one_snd_of_isMulTwoCocycle {f : G × G → M} (hf : IsMulTwoCocycle f) (g : G) :
f (g, 1) = g • f (1, 1) := by |
simpa only [mul_one, mul_left_inj] using hf g 1 1
| [
" f 1 = 1",
" f (1, g) = f (1, 1)",
" f (g, 1) = g • f (1, 1)"
] | [
" f 1 = 1",
" f (1, g) = f (1, 1)"
] |
import Mathlib.Data.List.Basic
namespace List
variable {α β : Type*}
@[simp]
theorem reduceOption_cons_of_some (x : α) (l : List (Option α)) :
reduceOption (some x :: l) = x :: l.reduceOption := by
simp only [reduceOption, filterMap, id, eq_self_iff_true, and_self_iff]
#align list.reduce_option_cons_of_some List.reduceOption_cons_of_some
@[simp]
| Mathlib/Data/List/ReduceOption.lean | 25 | 26 | theorem reduceOption_cons_of_none (l : List (Option α)) :
reduceOption (none :: l) = l.reduceOption := by | simp only [reduceOption, filterMap, id]
| [
" (some x :: l).reduceOption = x :: l.reduceOption",
" (none :: l).reduceOption = l.reduceOption"
] | [
" (some x :: l).reduceOption = x :: l.reduceOption"
] |
import Mathlib.RingTheory.OrzechProperty
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import linear_algebra.invariant_basis_number from "leanprover-community/mathlib"@"5fd3186f1ec30a75d5f65732e3ce5e623382556f"
noncomputable section
open Function
universe u v w
section
variable (R : Type u) [Semiring R]
@[mk_iff]
class StrongRankCondition : Prop where
le_of_fin_injective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Injective f → n ≤ m
#align strong_rank_condition StrongRankCondition
theorem le_of_fin_injective [StrongRankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Injective f → n ≤ m :=
StrongRankCondition.le_of_fin_injective f
#align le_of_fin_injective le_of_fin_injective
theorem strongRankCondition_iff_succ :
StrongRankCondition R ↔
∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Function.Injective f := by
refine ⟨fun h n => fun f hf => ?_, fun h => ⟨@fun n m f hf => ?_⟩⟩
· letI : StrongRankCondition R := h
exact Nat.not_succ_le_self n (le_of_fin_injective R f hf)
· by_contra H
exact
h m (f.comp (Function.ExtendByZero.linearMap R (Fin.castLE (not_le.1 H))))
(hf.comp (Function.extend_injective (Fin.strictMono_castLE _).injective _))
#align strong_rank_condition_iff_succ strongRankCondition_iff_succ
instance (priority := 100) strongRankCondition_of_orzechProperty
[Nontrivial R] [OrzechProperty R] : StrongRankCondition R := by
refine (strongRankCondition_iff_succ R).2 fun n i hi ↦ ?_
let f : (Fin (n + 1) → R) →ₗ[R] Fin n → R := {
toFun := fun x ↦ x ∘ Fin.castSucc
map_add' := fun _ _ ↦ rfl
map_smul' := fun _ _ ↦ rfl
}
have h : (0 : Fin (n + 1) → R) = update (0 : Fin (n + 1) → R) (Fin.last n) 1 := by
apply OrzechProperty.injective_of_surjective_of_injective i f hi
(Fin.castSucc_injective _).surjective_comp_right
ext m
simp [f, update_apply, (Fin.castSucc_lt_last m).ne]
simpa using congr_fun h (Fin.last n)
theorem card_le_of_injective [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_injective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).injective.comp i).comp (LinearEquiv.injective P))
#align card_le_of_injective card_le_of_injective
theorem card_le_of_injective' [StrongRankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Injective f) : Fintype.card α ≤ Fintype.card β := by
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_injective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.injective.comp i).comp Q.injective)
#align card_le_of_injective' card_le_of_injective'
class RankCondition : Prop where
le_of_fin_surjective : ∀ {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R), Surjective f → m ≤ n
#align rank_condition RankCondition
theorem le_of_fin_surjective [RankCondition R] {n m : ℕ} (f : (Fin n → R) →ₗ[R] Fin m → R) :
Surjective f → m ≤ n :=
RankCondition.le_of_fin_surjective f
#align le_of_fin_surjective le_of_fin_surjective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 188 | 194 | theorem card_le_of_surjective [RankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α → R) →ₗ[R] β → R) (i : Surjective f) : Fintype.card β ≤ Fintype.card α := by |
let P := LinearEquiv.funCongrLeft R R (Fintype.equivFin α)
let Q := LinearEquiv.funCongrLeft R R (Fintype.equivFin β)
exact
le_of_fin_surjective R ((Q.symm.toLinearMap.comp f).comp P.toLinearMap)
(((LinearEquiv.symm Q).surjective.comp i).comp (LinearEquiv.surjective P))
| [
" StrongRankCondition R ↔ ∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Injective ⇑f",
" False",
" n ≤ m",
" StrongRankCondition R",
" 0 = update 0 (Fin.last n) 1",
" f 0 = f (update 0 (Fin.last n) 1)",
" f 0 m = f (update 0 (Fin.last n) 1) m",
" Fintype.card α ≤ Fintype.card β",
" Fintype.car... | [
" StrongRankCondition R ↔ ∀ (n : ℕ) (f : (Fin (n + 1) → R) →ₗ[R] Fin n → R), ¬Injective ⇑f",
" False",
" n ≤ m",
" StrongRankCondition R",
" 0 = update 0 (Fin.last n) 1",
" f 0 = f (update 0 (Fin.last n) 1)",
" f 0 m = f (update 0 (Fin.last n) 1) m",
" Fintype.card α ≤ Fintype.card β"
] |
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
#align_import algebra.order.monoid.min_max from "leanprover-community/mathlib"@"de87d5053a9fe5cbde723172c0fb7e27e7436473"
open Function
variable {α β : Type*}
section CovariantClassMulLe
variable [LinearOrder α]
section Mul
variable [Mul α]
@[to_additive]
theorem lt_or_lt_of_mul_lt_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· ≤ ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ < a₂ * b₂ → a₁ < a₂ ∨ b₁ < b₂ := by
contrapose!
exact fun h => mul_le_mul' h.1 h.2
#align lt_or_lt_of_mul_lt_mul lt_or_lt_of_mul_lt_mul
#align lt_or_lt_of_add_lt_add lt_or_lt_of_add_lt_add
@[to_additive]
| Mathlib/Algebra/Order/Monoid/Unbundled/MinMax.lean | 99 | 103 | theorem le_or_lt_of_mul_le_mul [CovariantClass α α (· * ·) (· ≤ ·)]
[CovariantClass α α (Function.swap (· * ·)) (· < ·)] {a₁ a₂ b₁ b₂ : α} :
a₁ * b₁ ≤ a₂ * b₂ → a₁ ≤ a₂ ∨ b₁ < b₂ := by |
contrapose!
exact fun h => mul_lt_mul_of_lt_of_le h.1 h.2
| [
" a₁ * b₁ < a₂ * b₂ → a₁ < a₂ ∨ b₁ < b₂",
" a₂ ≤ a₁ ∧ b₂ ≤ b₁ → a₂ * b₂ ≤ a₁ * b₁",
" a₁ * b₁ ≤ a₂ * b₂ → a₁ ≤ a₂ ∨ b₁ < b₂",
" a₂ < a₁ ∧ b₂ ≤ b₁ → a₂ * b₂ < a₁ * b₁"
] | [
" a₁ * b₁ < a₂ * b₂ → a₁ < a₂ ∨ b₁ < b₂",
" a₂ ≤ a₁ ∧ b₂ ≤ b₁ → a₂ * b₂ ≤ a₁ * b₁"
] |
import Mathlib.Data.Finsupp.Basic
import Mathlib.Data.Finsupp.Order
#align_import data.finsupp.multiset from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Finset
variable {α β ι : Type*}
namespace Finsupp
def toMultiset : (α →₀ ℕ) →+ Multiset α where
toFun f := Finsupp.sum f fun a n => n • {a}
-- Porting note: times out if h is not specified
map_add' _f _g := sum_add_index' (h := fun a n => n • ({a} : Multiset α))
(fun _ ↦ zero_nsmul _) (fun _ ↦ add_nsmul _)
map_zero' := sum_zero_index
theorem toMultiset_zero : toMultiset (0 : α →₀ ℕ) = 0 :=
rfl
#align finsupp.to_multiset_zero Finsupp.toMultiset_zero
theorem toMultiset_add (m n : α →₀ ℕ) : toMultiset (m + n) = toMultiset m + toMultiset n :=
toMultiset.map_add m n
#align finsupp.to_multiset_add Finsupp.toMultiset_add
theorem toMultiset_apply (f : α →₀ ℕ) : toMultiset f = f.sum fun a n => n • {a} :=
rfl
#align finsupp.to_multiset_apply Finsupp.toMultiset_apply
@[simp]
theorem toMultiset_single (a : α) (n : ℕ) : toMultiset (single a n) = n • {a} := by
rw [toMultiset_apply, sum_single_index]; apply zero_nsmul
#align finsupp.to_multiset_single Finsupp.toMultiset_single
theorem toMultiset_sum {f : ι → α →₀ ℕ} (s : Finset ι) :
Finsupp.toMultiset (∑ i ∈ s, f i) = ∑ i ∈ s, Finsupp.toMultiset (f i) :=
map_sum Finsupp.toMultiset _ _
#align finsupp.to_multiset_sum Finsupp.toMultiset_sum
theorem toMultiset_sum_single (s : Finset ι) (n : ℕ) :
Finsupp.toMultiset (∑ i ∈ s, single i n) = n • s.val := by
simp_rw [toMultiset_sum, Finsupp.toMultiset_single, sum_nsmul, sum_multiset_singleton]
#align finsupp.to_multiset_sum_single Finsupp.toMultiset_sum_single
@[simp]
theorem card_toMultiset (f : α →₀ ℕ) : Multiset.card (toMultiset f) = f.sum fun _ => id := by
simp [toMultiset_apply, map_finsupp_sum, Function.id_def]
#align finsupp.card_to_multiset Finsupp.card_toMultiset
theorem toMultiset_map (f : α →₀ ℕ) (g : α → β) :
f.toMultiset.map g = toMultiset (f.mapDomain g) := by
refine f.induction ?_ ?_
· rw [toMultiset_zero, Multiset.map_zero, mapDomain_zero, toMultiset_zero]
· intro a n f _ _ ih
rw [toMultiset_add, Multiset.map_add, ih, mapDomain_add, mapDomain_single,
toMultiset_single, toMultiset_add, toMultiset_single, ← Multiset.coe_mapAddMonoidHom,
(Multiset.mapAddMonoidHom g).map_nsmul]
rfl
#align finsupp.to_multiset_map Finsupp.toMultiset_map
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
f.toMultiset.prod = f.prod fun a n => a ^ n := by
refine f.induction ?_ ?_
· rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index]
· intro a n f _ _ ih
rw [toMultiset_add, Multiset.prod_add, ih, toMultiset_single, Multiset.prod_nsmul,
Finsupp.prod_add_index' pow_zero pow_add, Finsupp.prod_single_index, Multiset.prod_singleton]
exact pow_zero a
#align finsupp.prod_to_multiset Finsupp.prod_toMultiset
@[simp]
| Mathlib/Data/Finsupp/Multiset.lean | 94 | 101 | theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by |
refine f.induction ?_ ?_
· rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
· intro a n f ha hn ih
rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq,
support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton]
refine Disjoint.mono_left support_single_subset ?_
rwa [Finset.disjoint_singleton_left]
| [
" toMultiset (single a n) = n • {a}",
" 0 • {a} = 0",
" toMultiset (∑ i ∈ s, single i n) = n • s.val",
" Multiset.card (toMultiset f) = f.sum fun x => id",
" Multiset.map g (toMultiset f) = toMultiset (mapDomain g f)",
" Multiset.map g (toMultiset 0) = toMultiset (mapDomain g 0)",
" ∀ (a : α) (b : ℕ) (f... | [
" toMultiset (single a n) = n • {a}",
" 0 • {a} = 0",
" toMultiset (∑ i ∈ s, single i n) = n • s.val",
" Multiset.card (toMultiset f) = f.sum fun x => id",
" Multiset.map g (toMultiset f) = toMultiset (mapDomain g f)",
" Multiset.map g (toMultiset 0) = toMultiset (mapDomain g 0)",
" ∀ (a : α) (b : ℕ) (f... |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Inner
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.l2_space from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
set_option linter.uppercaseLean3 false
noncomputable section
open TopologicalSpace MeasureTheory MeasureTheory.Lp Filter
open scoped NNReal ENNReal MeasureTheory
namespace MeasureTheory
section
variable {α F : Type*} {m : MeasurableSpace α} {μ : Measure α} [NormedAddCommGroup F]
theorem Memℒp.integrable_sq {f : α → ℝ} (h : Memℒp f 2 μ) : Integrable (fun x => f x ^ 2) μ := by
simpa [← memℒp_one_iff_integrable] using h.norm_rpow two_ne_zero ENNReal.two_ne_top
#align measure_theory.mem_ℒp.integrable_sq MeasureTheory.Memℒp.integrable_sq
theorem memℒp_two_iff_integrable_sq_norm {f : α → F} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ := by
rw [← memℒp_one_iff_integrable]
convert (memℒp_norm_rpow_iff hf two_ne_zero ENNReal.two_ne_top).symm
· simp
· rw [div_eq_mul_inv, ENNReal.mul_inv_cancel two_ne_zero ENNReal.two_ne_top]
#align measure_theory.mem_ℒp_two_iff_integrable_sq_norm MeasureTheory.memℒp_two_iff_integrable_sq_norm
theorem memℒp_two_iff_integrable_sq {f : α → ℝ} (hf : AEStronglyMeasurable f μ) :
Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ := by
convert memℒp_two_iff_integrable_sq_norm hf using 3
simp
#align measure_theory.mem_ℒp_two_iff_integrable_sq MeasureTheory.memℒp_two_iff_integrable_sq
end
section InnerProductSpace
variable {α : Type*} {m : MeasurableSpace α} {p : ℝ≥0∞} {μ : Measure α}
variable {E 𝕜 : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y
theorem Memℒp.const_inner (c : E) {f : α → E} (hf : Memℒp f p μ) : Memℒp (fun a => ⟪c, f a⟫) p μ :=
hf.of_le_mul (AEStronglyMeasurable.inner aestronglyMeasurable_const hf.1)
(eventually_of_forall fun _ => norm_inner_le_norm _ _)
#align measure_theory.mem_ℒp.const_inner MeasureTheory.Memℒp.const_inner
theorem Memℒp.inner_const {f : α → E} (hf : Memℒp f p μ) (c : E) : Memℒp (fun a => ⟪f a, c⟫) p μ :=
hf.of_le_mul (AEStronglyMeasurable.inner hf.1 aestronglyMeasurable_const)
(eventually_of_forall fun x => by rw [mul_comm]; exact norm_inner_le_norm _ _)
#align measure_theory.mem_ℒp.inner_const MeasureTheory.Memℒp.inner_const
variable {f : α → E}
theorem Integrable.const_inner (c : E) (hf : Integrable f μ) :
Integrable (fun x => ⟪c, f x⟫) μ := by
rw [← memℒp_one_iff_integrable] at hf ⊢; exact hf.const_inner c
#align measure_theory.integrable.const_inner MeasureTheory.Integrable.const_inner
theorem Integrable.inner_const (hf : Integrable f μ) (c : E) :
Integrable (fun x => ⟪f x, c⟫) μ := by
rw [← memℒp_one_iff_integrable] at hf ⊢; exact hf.inner_const c
#align measure_theory.integrable.inner_const MeasureTheory.Integrable.inner_const
variable [CompleteSpace E] [NormedSpace ℝ E]
theorem _root_.integral_inner {f : α → E} (hf : Integrable f μ) (c : E) :
∫ x, ⟪c, f x⟫ ∂μ = ⟪c, ∫ x, f x ∂μ⟫ :=
((innerSL 𝕜 c).restrictScalars ℝ).integral_comp_comm hf
#align integral_inner integral_inner
variable (𝕜)
-- variable binder update doesn't work for lemmas which refer to `𝕜` only via the notation
-- Porting note: removed because it causes ambiguity in the lemma below
-- local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y
| Mathlib/MeasureTheory/Function/L2Space.lean | 104 | 106 | theorem _root_.integral_eq_zero_of_forall_integral_inner_eq_zero (f : α → E) (hf : Integrable f μ)
(hf_int : ∀ c : E, ∫ x, ⟪c, f x⟫ ∂μ = 0) : ∫ x, f x ∂μ = 0 := by |
specialize hf_int (∫ x, f x ∂μ); rwa [integral_inner hf, inner_self_eq_zero] at hf_int
| [
" Integrable (fun x => f x ^ 2) μ",
" Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ",
" Memℒp f 2 μ ↔ Memℒp (fun x => ‖f x‖ ^ 2) 1 μ",
" ‖f x✝‖ ^ 2 = ‖f x✝‖ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ",
" f x✝ ^ 2 = ‖f x✝‖ ^ 2",
" ‖⟪f x, c⟫_𝕜‖ ≤ ?m.10094 * ‖f ... | [
" Integrable (fun x => f x ^ 2) μ",
" Memℒp f 2 μ ↔ Integrable (fun x => ‖f x‖ ^ 2) μ",
" Memℒp f 2 μ ↔ Memℒp (fun x => ‖f x‖ ^ 2) 1 μ",
" ‖f x✝‖ ^ 2 = ‖f x✝‖ ^ ENNReal.toReal 2",
" 1 = 2 / 2",
" Memℒp f 2 μ ↔ Integrable (fun x => f x ^ 2) μ",
" f x✝ ^ 2 = ‖f x✝‖ ^ 2",
" ‖⟪f x, c⟫_𝕜‖ ≤ ?m.10094 * ‖f ... |
import Mathlib.Data.Fin.Fin2
import Mathlib.Data.PFun
import Mathlib.Data.Vector3
import Mathlib.NumberTheory.PellMatiyasevic
#align_import number_theory.dioph from "leanprover-community/mathlib"@"a66d07e27d5b5b8ac1147cacfe353478e5c14002"
open Fin2 Function Nat Sum
local infixr:67 " ::ₒ " => Option.elim'
local infixr:65 " ⊗ " => Sum.elim
universe u
section Polynomials
variable {α β γ : Type*}
inductive IsPoly : ((α → ℕ) → ℤ) → Prop
| proj : ∀ i, IsPoly fun x : α → ℕ => x i
| const : ∀ n : ℤ, IsPoly fun _ : α → ℕ => n
| sub : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x - g x
| mul : ∀ {f g : (α → ℕ) → ℤ}, IsPoly f → IsPoly g → IsPoly fun x => f x * g x
#align is_poly IsPoly
| Mathlib/NumberTheory/Dioph.lean | 85 | 86 | theorem IsPoly.neg {f : (α → ℕ) → ℤ} : IsPoly f → IsPoly (-f) := by |
rw [← zero_sub]; exact (IsPoly.const 0).sub
| [
" IsPoly f → IsPoly (-f)",
" IsPoly f → IsPoly (0 - f)"
] | [] |
import Mathlib.CategoryTheory.Sites.InducedTopology
import Mathlib.CategoryTheory.Sites.LocallyBijective
import Mathlib.CategoryTheory.Sites.PreservesLocallyBijective
import Mathlib.CategoryTheory.Sites.Whiskering
universe u
namespace CategoryTheory
open Functor Limits GrothendieckTopology
variable {C : Type*} [Category C] (J : GrothendieckTopology C)
variable {D : Type*} [Category D] (K : GrothendieckTopology D) (e : C ≌ D) (G : D ⥤ C)
variable (A : Type*) [Category A]
namespace Equivalence
| Mathlib/CategoryTheory/Sites/Equivalence.lean | 51 | 65 | theorem locallyCoverDense : LocallyCoverDense J e.inverse := by |
intro X T
convert T.prop
ext Z f
constructor
· rintro ⟨_, _, g', hg, rfl⟩
exact T.val.downward_closed hg g'
· intro hf
refine ⟨e.functor.obj Z, (Adjunction.homEquiv e.toAdjunction _ _).symm f, e.unit.app Z, ?_, ?_⟩
· simp only [Adjunction.homEquiv_counit, Functor.id_obj, Equivalence.toAdjunction_counit,
Sieve.functorPullback_apply, Presieve.functorPullback_mem, Functor.map_comp,
Equivalence.inv_fun_map, Functor.comp_obj, Category.assoc, Equivalence.unit_inverse_comp,
Category.comp_id]
exact T.val.downward_closed hf _
· simp
| [
" LocallyCoverDense J e.inverse",
" Sieve.functorPushforward e.inverse (Sieve.functorPullback e.inverse ↑T) ∈ J.sieves (e.inverse.obj X)",
" Sieve.functorPushforward e.inverse (Sieve.functorPullback e.inverse ↑T) = ↑T",
" (Sieve.functorPushforward e.inverse (Sieve.functorPullback e.inverse ↑T)).arrows f ↔ (↑T... | [] |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Data.ENat.Basic
#align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
noncomputable section
open Function Polynomial Finsupp Finset
open scoped Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
def trailingDegree (p : R[X]) : ℕ∞ :=
p.support.min
#align polynomial.trailing_degree Polynomial.trailingDegree
theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q :=
InvImage.wf trailingDegree wellFounded_lt
#align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf
def natTrailingDegree (p : R[X]) : ℕ :=
(trailingDegree p).getD 0
#align polynomial.nat_trailing_degree Polynomial.natTrailingDegree
def trailingCoeff (p : R[X]) : R :=
coeff p (natTrailingDegree p)
#align polynomial.trailing_coeff Polynomial.trailingCoeff
def TrailingMonic (p : R[X]) :=
trailingCoeff p = (1 : R)
#align polynomial.trailing_monic Polynomial.TrailingMonic
theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 :=
Iff.rfl
#align polynomial.trailing_monic.def Polynomial.TrailingMonic.def
instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) :=
inferInstanceAs <| Decidable (trailingCoeff p = (1 : R))
#align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable
@[simp]
theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 :=
hp
#align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff
@[simp]
theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ :=
rfl
#align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero
@[simp]
theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 :=
rfl
#align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero
@[simp]
theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero
theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 :=
⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩
#align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top
| Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean | 102 | 108 | theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) :
trailingDegree p = (natTrailingDegree p : ℕ∞) := by |
let ⟨n, hn⟩ :=
not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp))
have hn : trailingDegree p = n := Classical.not_not.1 hn
rw [natTrailingDegree, hn]
rfl
| [
" p.trailingDegree = ⊤",
" p.trailingDegree = ↑p.natTrailingDegree",
" ↑n = ↑(Option.getD (↑n) 0)"
] | [
" p.trailingDegree = ⊤"
] |
import Mathlib.Data.Set.Finite
import Mathlib.Order.Partition.Finpartition
#align_import data.setoid.partition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
namespace Setoid
variable {α : Type*}
theorem eq_of_mem_eqv_class {c : Set (Set α)} (H : ∀ a, ∃! b ∈ c, a ∈ b) {x b b'}
(hc : b ∈ c) (hb : x ∈ b) (hc' : b' ∈ c) (hb' : x ∈ b') : b = b' :=
(H x).unique ⟨hc, hb⟩ ⟨hc', hb'⟩
#align setoid.eq_of_mem_eqv_class Setoid.eq_of_mem_eqv_class
def mkClasses (c : Set (Set α)) (H : ∀ a, ∃! b ∈ c, a ∈ b) : Setoid α where
r x y := ∀ s ∈ c, x ∈ s → y ∈ s
iseqv.refl := fun _ _ _ hx => hx
iseqv.symm := fun {x _y} h s hs hy => by
obtain ⟨t, ⟨ht, hx⟩, _⟩ := H x
rwa [eq_of_mem_eqv_class H hs hy ht (h t ht hx)]
iseqv.trans := fun {_x y z} h1 h2 s hs hx => h2 s hs (h1 s hs hx)
#align setoid.mk_classes Setoid.mkClasses
def classes (r : Setoid α) : Set (Set α) :=
{ s | ∃ y, s = { x | r.Rel x y } }
#align setoid.classes Setoid.classes
theorem mem_classes (r : Setoid α) (y) : { x | r.Rel x y } ∈ r.classes :=
⟨y, rfl⟩
#align setoid.mem_classes Setoid.mem_classes
theorem classes_ker_subset_fiber_set {β : Type*} (f : α → β) :
(Setoid.ker f).classes ⊆ Set.range fun y => { x | f x = y } := by
rintro s ⟨x, rfl⟩
rw [Set.mem_range]
exact ⟨f x, rfl⟩
#align setoid.classes_ker_subset_fiber_set Setoid.classes_ker_subset_fiber_set
theorem finite_classes_ker {α β : Type*} [Finite β] (f : α → β) : (Setoid.ker f).classes.Finite :=
(Set.finite_range _).subset <| classes_ker_subset_fiber_set f
#align setoid.finite_classes_ker Setoid.finite_classes_ker
theorem card_classes_ker_le {α β : Type*} [Fintype β] (f : α → β)
[Fintype (Setoid.ker f).classes] : Fintype.card (Setoid.ker f).classes ≤ Fintype.card β := by
classical exact
le_trans (Set.card_le_card (classes_ker_subset_fiber_set f)) (Fintype.card_range_le _)
#align setoid.card_classes_ker_le Setoid.card_classes_ker_le
theorem eq_iff_classes_eq {r₁ r₂ : Setoid α} :
r₁ = r₂ ↔ ∀ x, { y | r₁.Rel x y } = { y | r₂.Rel x y } :=
⟨fun h _x => h ▸ rfl, fun h => ext' fun x => Set.ext_iff.1 <| h x⟩
#align setoid.eq_iff_classes_eq Setoid.eq_iff_classes_eq
theorem rel_iff_exists_classes (r : Setoid α) {x y} : r.Rel x y ↔ ∃ c ∈ r.classes, x ∈ c ∧ y ∈ c :=
⟨fun h => ⟨_, r.mem_classes y, h, r.refl' y⟩, fun ⟨c, ⟨z, hz⟩, hx, hy⟩ => by
subst c
exact r.trans' hx (r.symm' hy)⟩
#align setoid.rel_iff_exists_classes Setoid.rel_iff_exists_classes
theorem classes_inj {r₁ r₂ : Setoid α} : r₁ = r₂ ↔ r₁.classes = r₂.classes :=
⟨fun h => h ▸ rfl, fun h => ext' fun a b => by simp only [rel_iff_exists_classes, exists_prop, h]⟩
#align setoid.classes_inj Setoid.classes_inj
theorem empty_not_mem_classes {r : Setoid α} : ∅ ∉ r.classes := fun ⟨y, hy⟩ =>
Set.not_mem_empty y <| hy.symm ▸ r.refl' y
#align setoid.empty_not_mem_classes Setoid.empty_not_mem_classes
theorem classes_eqv_classes {r : Setoid α} (a) : ∃! b ∈ r.classes, a ∈ b :=
ExistsUnique.intro { x | r.Rel x a } ⟨r.mem_classes a, r.refl' _⟩ <| by
rintro y ⟨⟨_, rfl⟩, ha⟩
ext x
exact ⟨fun hx => r.trans' hx (r.symm' ha), fun hx => r.trans' hx ha⟩
#align setoid.classes_eqv_classes Setoid.classes_eqv_classes
theorem eq_of_mem_classes {r : Setoid α} {x b} (hc : b ∈ r.classes) (hb : x ∈ b) {b'}
(hc' : b' ∈ r.classes) (hb' : x ∈ b') : b = b' :=
eq_of_mem_eqv_class classes_eqv_classes hc hb hc' hb'
#align setoid.eq_of_mem_classes Setoid.eq_of_mem_classes
| Mathlib/Data/Setoid/Partition.lean | 122 | 130 | theorem eq_eqv_class_of_mem {c : Set (Set α)} (H : ∀ a, ∃! b ∈ c, a ∈ b) {s y}
(hs : s ∈ c) (hy : y ∈ s) : s = { x | (mkClasses c H).Rel x y } := by |
ext x
constructor
· intro hx _s' hs' hx'
rwa [eq_of_mem_eqv_class H hs' hx' hs hx]
· intro hx
obtain ⟨b', ⟨hc, hb'⟩, _⟩ := H x
rwa [eq_of_mem_eqv_class H hs hy hc (hx b' hc hb')]
| [
" x ∈ s",
" (ker f).classes ⊆ Set.range fun y => {x | f x = y}",
" {x_1 | (ker f).Rel x_1 x} ∈ Set.range fun y => {x | f x = y}",
" ∃ y, {x | f x = y} = {x_1 | (ker f).Rel x_1 x}",
" Fintype.card ↑(ker f).classes ≤ Fintype.card β",
" r.Rel x y",
" r₁.Rel a b ↔ r₂.Rel a b",
" ∀ (y : Set α), y ∈ r.class... | [
" x ∈ s",
" (ker f).classes ⊆ Set.range fun y => {x | f x = y}",
" {x_1 | (ker f).Rel x_1 x} ∈ Set.range fun y => {x | f x = y}",
" ∃ y, {x | f x = y} = {x_1 | (ker f).Rel x_1 x}",
" Fintype.card ↑(ker f).classes ≤ Fintype.card β",
" r.Rel x y",
" r₁.Rel a b ↔ r₂.Rel a b",
" ∀ (y : Set α), y ∈ r.class... |
import Batteries.Tactic.Init
import Batteries.Tactic.Alias
import Batteries.Tactic.Lint.Misc
instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) :=
inferInstanceAs <| DecidablePred fun x => p (f x)
@[deprecated] alias proofIrrel := proof_irrel
theorem Function.id_def : @id α = fun x => x := rfl
alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists
protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall
theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩
@[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') :
(@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl
theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β}
(hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl
theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) :
f a b = g a b :=
congrFun (congrFun h _) _
theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) :
f a b c = g a b c :=
congrFun₂ (congrFun h _) _ _
theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _}
{f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g :=
funext fun _ => funext <| h _
theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _}
{f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g :=
funext fun _ => funext₂ <| h _
theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a :=
⟨congrFun, funext⟩
theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y :=
mt <| congrArg _
protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by
subst h₁; subst h₂; rfl
| .lake/packages/batteries/Batteries/Logic.lean | 72 | 72 | theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by | rw [h]
| [
" h ▸ y = y",
" ⋯ ▸ y = y",
" f x y = f x' y'",
" f x y = f x y",
" x₁ = x₂ ↔ y₁ = y₂",
" x₁ = x₂ ↔ x₁ = y₂",
" x₁ = x₂ ↔ x₁ = x₂",
" x = z ↔ y = z"
] | [
" h ▸ y = y",
" ⋯ ▸ y = y",
" f x y = f x' y'",
" f x y = f x y",
" x₁ = x₂ ↔ y₁ = y₂",
" x₁ = x₂ ↔ x₁ = y₂",
" x₁ = x₂ ↔ x₁ = x₂"
] |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.GroupWithZero.Units.Equiv
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Tactic.Positivity.Core
#align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd"
open Function OrderDual
variable {ι α β : Type*}
section LinearOrderedSemifield
variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ}
@[simps! (config := { simpRhs := true })]
def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α :=
{ Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha }
#align order_iso.mul_left₀ OrderIso.mulLeft₀
#align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply
#align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply
@[simps! (config := { simpRhs := true })]
def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α :=
{ Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha }
#align order_iso.mul_right₀ OrderIso.mulRight₀
#align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply
#align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply
theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b :=
⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h =>
calc
a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm
_ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le
_ = b / c := (div_eq_mul_one_div b c).symm
⟩
#align le_div_iff le_div_iff
theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc]
#align le_div_iff' le_div_iff'
theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b :=
⟨fun h =>
calc
a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm]
_ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le
,
fun h =>
calc
a / b = a * (1 / b) := div_eq_mul_one_div a b
_ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le
_ = c * b / b := (div_eq_mul_one_div (c * b) b).symm
_ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl
⟩
#align div_le_iff div_le_iff
theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb]
#align div_le_iff' div_le_iff'
lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by
rw [div_le_iff hb, div_le_iff' hc]
theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b :=
lt_iff_lt_of_le_iff_le <| div_le_iff hc
#align lt_div_iff lt_div_iff
theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by rw [mul_comm, lt_div_iff hc]
#align lt_div_iff' lt_div_iff'
theorem div_lt_iff (hc : 0 < c) : b / c < a ↔ b < a * c :=
lt_iff_lt_of_le_iff_le (le_div_iff hc)
#align div_lt_iff div_lt_iff
theorem div_lt_iff' (hc : 0 < c) : b / c < a ↔ b < c * a := by rw [mul_comm, div_lt_iff hc]
#align div_lt_iff' div_lt_iff'
lemma div_lt_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b < c ↔ a / c < b := by
rw [div_lt_iff hb, div_lt_iff' hc]
theorem inv_mul_le_iff (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ b * c := by
rw [inv_eq_one_div, mul_comm, ← div_eq_mul_one_div]
exact div_le_iff' h
#align inv_mul_le_iff inv_mul_le_iff
| Mathlib/Algebra/Order/Field/Basic.lean | 104 | 104 | theorem inv_mul_le_iff' (h : 0 < b) : b⁻¹ * a ≤ c ↔ a ≤ c * b := by | rw [inv_mul_le_iff h, mul_comm]
| [
" a ≤ b / c ↔ c * a ≤ b",
" a = a / b * b",
" c * b / b = c",
" a / b ≤ c ↔ a ≤ b * c",
" a / b ≤ c ↔ a / c ≤ b",
" a < b / c ↔ c * a < b",
" b / c < a ↔ b < c * a",
" a / b < c ↔ a / c < b",
" b⁻¹ * a ≤ c ↔ a ≤ b * c",
" b⁻¹ * a ≤ c ↔ a ≤ c * b"
] | [
" a ≤ b / c ↔ c * a ≤ b",
" a = a / b * b",
" c * b / b = c",
" a / b ≤ c ↔ a ≤ b * c",
" a / b ≤ c ↔ a / c ≤ b",
" a < b / c ↔ c * a < b",
" b / c < a ↔ b < c * a",
" a / b < c ↔ a / c < b",
" b⁻¹ * a ≤ c ↔ a ≤ b * c"
] |
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic
import Mathlib.Analysis.Convex.Contractible
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.Convex.Complex
import Mathlib.Analysis.Complex.ReImTopology
import Mathlib.Topology.Homotopy.Contractible
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.complex.upper_half_plane.topology from "leanprover-community/mathlib"@"57f9349f2fe19d2de7207e99b0341808d977cdcf"
noncomputable section
open Set Filter Function TopologicalSpace Complex
open scoped Filter Topology UpperHalfPlane
namespace UpperHalfPlane
instance : TopologicalSpace ℍ :=
instTopologicalSpaceSubtype
theorem openEmbedding_coe : OpenEmbedding ((↑) : ℍ → ℂ) :=
IsOpen.openEmbedding_subtype_val <| isOpen_lt continuous_const Complex.continuous_im
#align upper_half_plane.open_embedding_coe UpperHalfPlane.openEmbedding_coe
theorem embedding_coe : Embedding ((↑) : ℍ → ℂ) :=
embedding_subtype_val
#align upper_half_plane.embedding_coe UpperHalfPlane.embedding_coe
theorem continuous_coe : Continuous ((↑) : ℍ → ℂ) :=
embedding_coe.continuous
#align upper_half_plane.continuous_coe UpperHalfPlane.continuous_coe
theorem continuous_re : Continuous re :=
Complex.continuous_re.comp continuous_coe
#align upper_half_plane.continuous_re UpperHalfPlane.continuous_re
theorem continuous_im : Continuous im :=
Complex.continuous_im.comp continuous_coe
#align upper_half_plane.continuous_im UpperHalfPlane.continuous_im
instance : SecondCountableTopology ℍ :=
TopologicalSpace.Subtype.secondCountableTopology _
instance : T3Space ℍ := Subtype.t3Space
instance : T4Space ℍ := inferInstance
instance : ContractibleSpace ℍ :=
(convex_halfspace_im_gt 0).contractibleSpace ⟨I, one_pos.trans_eq I_im.symm⟩
instance : LocPathConnectedSpace ℍ :=
locPathConnected_of_isOpen <| isOpen_lt continuous_const Complex.continuous_im
instance : NoncompactSpace ℍ := by
refine ⟨fun h => ?_⟩
have : IsCompact (Complex.im ⁻¹' Ioi 0) := isCompact_iff_isCompact_univ.2 h
replace := this.isClosed.closure_eq
rw [closure_preimage_im, closure_Ioi, Set.ext_iff] at this
exact absurd ((this 0).1 (@left_mem_Ici ℝ _ 0)) (@lt_irrefl ℝ _ 0)
instance : LocallyCompactSpace ℍ :=
openEmbedding_coe.locallyCompactSpace
section strips
def verticalStrip (A B : ℝ) := {z : ℍ | |z.re| ≤ A ∧ B ≤ z.im}
theorem mem_verticalStrip_iff (A B : ℝ) (z : ℍ) : z ∈ verticalStrip A B ↔ |z.re| ≤ A ∧ B ≤ z.im :=
Iff.rfl
@[gcongr]
lemma verticalStrip_mono {A B A' B' : ℝ} (hA : A ≤ A') (hB : B' ≤ B) :
verticalStrip A B ⊆ verticalStrip A' B' := by
rintro z ⟨hzre, hzim⟩
exact ⟨hzre.trans hA, hB.trans hzim⟩
@[gcongr]
lemma verticalStrip_mono_left {A A'} (h : A ≤ A') (B) : verticalStrip A B ⊆ verticalStrip A' B :=
verticalStrip_mono h le_rfl
@[gcongr]
lemma verticalStrip_anti_right (A) {B B'} (h : B' ≤ B) : verticalStrip A B ⊆ verticalStrip A B' :=
verticalStrip_mono le_rfl h
lemma subset_verticalStrip_of_isCompact {K : Set ℍ} (hK : IsCompact K) :
∃ A B : ℝ, 0 < B ∧ K ⊆ verticalStrip A B := by
rcases K.eq_empty_or_nonempty with rfl | hne
· exact ⟨1, 1, Real.zero_lt_one, empty_subset _⟩
obtain ⟨u, _, hu⟩ := hK.exists_isMaxOn hne (_root_.continuous_abs.comp continuous_re).continuousOn
obtain ⟨v, _, hv⟩ := hK.exists_isMinOn hne continuous_im.continuousOn
exact ⟨|re u|, im v, v.im_pos, fun k hk ↦ ⟨isMaxOn_iff.mp hu _ hk, isMinOn_iff.mp hv _ hk⟩⟩
| Mathlib/Analysis/Complex/UpperHalfPlane/Topology.lean | 109 | 124 | theorem ModularGroup_T_zpow_mem_verticalStrip (z : ℍ) {N : ℕ} (hn : 0 < N) :
∃ n : ℤ, ModularGroup.T ^ (N * n) • z ∈ verticalStrip N z.im := by |
let n := Int.floor (z.re/N)
use -n
rw [modular_T_zpow_smul z (N * -n)]
refine ⟨?_, (by simp only [mul_neg, Int.cast_neg, Int.cast_mul, Int.cast_natCast, vadd_im,
le_refl])⟩
have h : (N * (-n : ℝ) +ᵥ z).re = -N * Int.floor (z.re / N) + z.re := by
simp only [Int.cast_natCast, mul_neg, vadd_re, neg_mul]
norm_cast at *
rw [h, add_comm]
simp only [neg_mul, Int.cast_neg, Int.cast_mul, Int.cast_natCast, ge_iff_le]
have hnn : (0 : ℝ) < (N : ℝ) := by norm_cast at *
have h2 : z.re + -(N * n) = z.re - n * N := by ring
rw [h2, abs_eq_self.2 (Int.sub_floor_div_mul_nonneg (z.re : ℝ) hnn)]
apply (Int.sub_floor_div_mul_lt (z.re : ℝ) hnn).le
| [
" NoncompactSpace ℍ",
" False",
" verticalStrip A B ⊆ verticalStrip A' B'",
" z ∈ verticalStrip A' B'",
" ∃ A B, 0 < B ∧ K ⊆ verticalStrip A B",
" ∃ A B, 0 < B ∧ ∅ ⊆ verticalStrip A B",
" ∃ n, ModularGroup.T ^ (↑N * n) • z ∈ verticalStrip (↑N) z.im",
" ModularGroup.T ^ (↑N * -n) • z ∈ verticalStrip (↑... | [
" NoncompactSpace ℍ",
" False",
" verticalStrip A B ⊆ verticalStrip A' B'",
" z ∈ verticalStrip A' B'",
" ∃ A B, 0 < B ∧ K ⊆ verticalStrip A B",
" ∃ A B, 0 < B ∧ ∅ ⊆ verticalStrip A B"
] |
import Mathlib.Data.Finsupp.Defs
#align_import data.finsupp.ne_locus from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {α M N P : Type*}
namespace Finsupp
variable [DecidableEq α]
section NHasZero
variable [DecidableEq N] [Zero N] (f g : α →₀ N)
def neLocus (f g : α →₀ N) : Finset α :=
(f.support ∪ g.support).filter fun x => f x ≠ g x
#align finsupp.ne_locus Finsupp.neLocus
@[simp]
theorem mem_neLocus {f g : α →₀ N} {a : α} : a ∈ f.neLocus g ↔ f a ≠ g a := by
simpa only [neLocus, Finset.mem_filter, Finset.mem_union, mem_support_iff,
and_iff_right_iff_imp] using Ne.ne_or_ne _
#align finsupp.mem_ne_locus Finsupp.mem_neLocus
theorem not_mem_neLocus {f g : α →₀ N} {a : α} : a ∉ f.neLocus g ↔ f a = g a :=
mem_neLocus.not.trans not_ne_iff
#align finsupp.not_mem_ne_locus Finsupp.not_mem_neLocus
@[simp]
theorem coe_neLocus : ↑(f.neLocus g) = { x | f x ≠ g x } := by
ext
exact mem_neLocus
#align finsupp.coe_ne_locus Finsupp.coe_neLocus
@[simp]
theorem neLocus_eq_empty {f g : α →₀ N} : f.neLocus g = ∅ ↔ f = g :=
⟨fun h =>
ext fun a => not_not.mp (mem_neLocus.not.mp (Finset.eq_empty_iff_forall_not_mem.mp h a)),
fun h => h ▸ by simp only [neLocus, Ne, eq_self_iff_true, not_true, Finset.filter_False]⟩
#align finsupp.ne_locus_eq_empty Finsupp.neLocus_eq_empty
@[simp]
theorem nonempty_neLocus_iff {f g : α →₀ N} : (f.neLocus g).Nonempty ↔ f ≠ g :=
Finset.nonempty_iff_ne_empty.trans neLocus_eq_empty.not
#align finsupp.nonempty_ne_locus_iff Finsupp.nonempty_neLocus_iff
| Mathlib/Data/Finsupp/NeLocus.lean | 69 | 70 | theorem neLocus_comm : f.neLocus g = g.neLocus f := by |
simp_rw [neLocus, Finset.union_comm, ne_comm]
| [
" a ∈ f.neLocus g ↔ f a ≠ g a",
" ↑(f.neLocus g) = {x | f x ≠ g x}",
" x✝ ∈ ↑(f.neLocus g) ↔ x✝ ∈ {x | f x ≠ g x}",
" f.neLocus f = ∅",
" f.neLocus g = g.neLocus f"
] | [
" a ∈ f.neLocus g ↔ f a ≠ g a",
" ↑(f.neLocus g) = {x | f x ≠ g x}",
" x✝ ∈ ↑(f.neLocus g) ↔ x✝ ∈ {x | f x ≠ g x}",
" f.neLocus f = ∅"
] |
import Mathlib.RingTheory.Ideal.Maps
#align_import ring_theory.ideal.prod from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
variable {R : Type u} {S : Type v} [Semiring R] [Semiring S] (I I' : Ideal R) (J J' : Ideal S)
namespace Ideal
def prod : Ideal (R × S) where
carrier := { x | x.fst ∈ I ∧ x.snd ∈ J }
zero_mem' := by simp
add_mem' := by
rintro ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ ⟨ha₁, ha₂⟩ ⟨hb₁, hb₂⟩
exact ⟨I.add_mem ha₁ hb₁, J.add_mem ha₂ hb₂⟩
smul_mem' := by
rintro ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ ⟨hb₁, hb₂⟩
exact ⟨I.mul_mem_left _ hb₁, J.mul_mem_left _ hb₂⟩
#align ideal.prod Ideal.prod
@[simp]
theorem mem_prod {r : R} {s : S} : (⟨r, s⟩ : R × S) ∈ prod I J ↔ r ∈ I ∧ s ∈ J :=
Iff.rfl
#align ideal.mem_prod Ideal.mem_prod
@[simp]
theorem prod_top_top : prod (⊤ : Ideal R) (⊤ : Ideal S) = ⊤ :=
Ideal.ext <| by simp
#align ideal.prod_top_top Ideal.prod_top_top
| Mathlib/RingTheory/Ideal/Prod.lean | 50 | 58 | theorem ideal_prod_eq (I : Ideal (R × S)) :
I = Ideal.prod (map (RingHom.fst R S) I : Ideal R) (map (RingHom.snd R S) I) := by |
apply Ideal.ext
rintro ⟨r, s⟩
rw [mem_prod, mem_map_iff_of_surjective (RingHom.fst R S) Prod.fst_surjective,
mem_map_iff_of_surjective (RingHom.snd R S) Prod.snd_surjective]
refine ⟨fun h => ⟨⟨_, ⟨h, rfl⟩⟩, ⟨_, ⟨h, rfl⟩⟩⟩, ?_⟩
rintro ⟨⟨⟨r, s'⟩, ⟨h₁, rfl⟩⟩, ⟨⟨r', s⟩, ⟨h₂, rfl⟩⟩⟩
simpa using I.add_mem (I.mul_mem_left (1, 0) h₁) (I.mul_mem_left (0, 1) h₂)
| [
" ∀ {a b : R × S}, a ∈ {x | x.1 ∈ I ∧ x.2 ∈ J} → b ∈ {x | x.1 ∈ I ∧ x.2 ∈ J} → a + b ∈ {x | x.1 ∈ I ∧ x.2 ∈ J}",
" (a₁, a₂) + (b₁, b₂) ∈ {x | x.1 ∈ I ∧ x.2 ∈ J}",
" 0 ∈ { carrier := {x | x.1 ∈ I ∧ x.2 ∈ J}, add_mem' := ⋯ }.carrier",
" ∀ (c : R × S) {x : R × S},\n x ∈ { carrier := {x | x.1 ∈ I ∧ x.2 ∈ J}, a... | [
" ∀ {a b : R × S}, a ∈ {x | x.1 ∈ I ∧ x.2 ∈ J} → b ∈ {x | x.1 ∈ I ∧ x.2 ∈ J} → a + b ∈ {x | x.1 ∈ I ∧ x.2 ∈ J}",
" (a₁, a₂) + (b₁, b₂) ∈ {x | x.1 ∈ I ∧ x.2 ∈ J}",
" 0 ∈ { carrier := {x | x.1 ∈ I ∧ x.2 ∈ J}, add_mem' := ⋯ }.carrier",
" ∀ (c : R × S) {x : R × S},\n x ∈ { carrier := {x | x.1 ∈ I ∧ x.2 ∈ J}, a... |
import Mathlib.Analysis.Convex.Body
import Mathlib.Analysis.Convex.Measure
import Mathlib.MeasureTheory.Group.FundamentalDomain
#align_import measure_theory.group.geometry_of_numbers from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
namespace MeasureTheory
open ENNReal FiniteDimensional MeasureTheory MeasureTheory.Measure Set Filter
open scoped Pointwise NNReal
variable {E L : Type*} [MeasurableSpace E] {μ : Measure E} {F s : Set E}
| Mathlib/MeasureTheory/Group/GeometryOfNumbers.lean | 50 | 58 | theorem exists_pair_mem_lattice_not_disjoint_vadd [AddCommGroup L] [Countable L] [AddAction L E]
[MeasurableSpace L] [MeasurableVAdd L E] [VAddInvariantMeasure L E μ]
(fund : IsAddFundamentalDomain L F μ) (hS : NullMeasurableSet s μ) (h : μ F < μ s) :
∃ x y : L, x ≠ y ∧ ¬Disjoint (x +ᵥ s) (y +ᵥ s) := by |
contrapose! h
exact ((fund.measure_eq_tsum _).trans (measure_iUnion₀
(Pairwise.mono h fun i j hij => (hij.mono inf_le_left inf_le_left).aedisjoint)
fun _ => (hS.vadd _).inter fund.nullMeasurableSet).symm).trans_le
(measure_mono <| Set.iUnion_subset fun _ => Set.inter_subset_right)
| [
" ∃ x y, x ≠ y ∧ ¬Disjoint (x +ᵥ s) (y +ᵥ s)",
" μ s ≤ μ F"
] | [] |
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.FieldTheory.IsAlgClosed.Basic
#align_import linear_algebra.matrix.charpoly.eigs from "leanprover-community/mathlib"@"48dc6abe71248bd6f4bffc9703dc87bdd4e37d0b"
variable {n : Type*} [Fintype n] [DecidableEq n]
variable {R : Type*} [Field R]
variable {A : Matrix n n R}
open Matrix Polynomial
open scoped Matrix
namespace Matrix
theorem det_eq_prod_roots_charpoly_of_splits (hAps : A.charpoly.Splits (RingHom.id R)) :
A.det = (Matrix.charpoly A).roots.prod := by
rw [det_eq_sign_charpoly_coeff, ← charpoly_natDegree_eq_dim A,
Polynomial.prod_roots_eq_coeff_zero_of_monic_of_split A.charpoly_monic hAps, ← mul_assoc,
← pow_two, pow_right_comm, neg_one_sq, one_pow, one_mul]
#align matrix.det_eq_prod_roots_charpoly_of_splits Matrix.det_eq_prod_roots_charpoly_of_splits
| Mathlib/LinearAlgebra/Matrix/Charpoly/Eigs.lean | 67 | 75 | theorem trace_eq_sum_roots_charpoly_of_splits (hAps : A.charpoly.Splits (RingHom.id R)) :
A.trace = (Matrix.charpoly A).roots.sum := by |
cases' isEmpty_or_nonempty n with h
· rw [Matrix.trace, Fintype.sum_empty, Matrix.charpoly,
det_eq_one_of_card_eq_zero (Fintype.card_eq_zero_iff.2 h), Polynomial.roots_one,
Multiset.empty_eq_zero, Multiset.sum_zero]
· rw [trace_eq_neg_charpoly_coeff, neg_eq_iff_eq_neg,
← Polynomial.sum_roots_eq_nextCoeff_of_monic_of_split A.charpoly_monic hAps, nextCoeff,
charpoly_natDegree_eq_dim, if_neg (Fintype.card_ne_zero : Fintype.card n ≠ 0)]
| [
" A.det = A.charpoly.roots.prod",
" A.trace = A.charpoly.roots.sum"
] | [
" A.det = A.charpoly.roots.prod"
] |
import Mathlib.Data.Stream.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Init.Data.List.Basic
import Mathlib.Data.List.Basic
#align_import data.stream.init from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
set_option autoImplicit true
open Nat Function Option
namespace Stream'
variable {α : Type u} {β : Type v} {δ : Type w}
instance [Inhabited α] : Inhabited (Stream' α) :=
⟨Stream'.const default⟩
protected theorem eta (s : Stream' α) : (head s::tail s) = s :=
funext fun i => by cases i <;> rfl
#align stream.eta Stream'.eta
@[ext]
protected theorem ext {s₁ s₂ : Stream' α} : (∀ n, get s₁ n = get s₂ n) → s₁ = s₂ :=
fun h => funext h
#align stream.ext Stream'.ext
@[simp]
theorem get_zero_cons (a : α) (s : Stream' α) : get (a::s) 0 = a :=
rfl
#align stream.nth_zero_cons Stream'.get_zero_cons
@[simp]
theorem head_cons (a : α) (s : Stream' α) : head (a::s) = a :=
rfl
#align stream.head_cons Stream'.head_cons
@[simp]
theorem tail_cons (a : α) (s : Stream' α) : tail (a::s) = s :=
rfl
#align stream.tail_cons Stream'.tail_cons
@[simp]
theorem get_drop (n m : Nat) (s : Stream' α) : get (drop m s) n = get s (n + m) :=
rfl
#align stream.nth_drop Stream'.get_drop
theorem tail_eq_drop (s : Stream' α) : tail s = drop 1 s :=
rfl
#align stream.tail_eq_drop Stream'.tail_eq_drop
@[simp]
theorem drop_drop (n m : Nat) (s : Stream' α) : drop n (drop m s) = drop (n + m) s := by
ext; simp [Nat.add_assoc]
#align stream.drop_drop Stream'.drop_drop
@[simp] theorem get_tail {s : Stream' α} : s.tail.get n = s.get (n + 1) := rfl
@[simp] theorem tail_drop' {s : Stream' α} : tail (drop i s) = s.drop (i+1) := by
ext; simp [Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
@[simp] theorem drop_tail' {s : Stream' α} : drop i (tail s) = s.drop (i+1) := rfl
theorem tail_drop (n : Nat) (s : Stream' α) : tail (drop n s) = drop n (tail s) := by simp
#align stream.tail_drop Stream'.tail_drop
theorem get_succ (n : Nat) (s : Stream' α) : get s (succ n) = get (tail s) n :=
rfl
#align stream.nth_succ Stream'.get_succ
@[simp]
theorem get_succ_cons (n : Nat) (s : Stream' α) (x : α) : get (x::s) n.succ = get s n :=
rfl
#align stream.nth_succ_cons Stream'.get_succ_cons
@[simp] theorem drop_zero {s : Stream' α} : s.drop 0 = s := rfl
theorem drop_succ (n : Nat) (s : Stream' α) : drop (succ n) s = drop n (tail s) :=
rfl
#align stream.drop_succ Stream'.drop_succ
theorem head_drop (a : Stream' α) (n : ℕ) : (a.drop n).head = a.get n := by simp
#align stream.head_drop Stream'.head_drop
theorem cons_injective2 : Function.Injective2 (cons : α → Stream' α → Stream' α) := fun x y s t h =>
⟨by rw [← get_zero_cons x s, h, get_zero_cons],
Stream'.ext fun n => by rw [← get_succ_cons n _ x, h, get_succ_cons]⟩
#align stream.cons_injective2 Stream'.cons_injective2
theorem cons_injective_left (s : Stream' α) : Function.Injective fun x => cons x s :=
cons_injective2.left _
#align stream.cons_injective_left Stream'.cons_injective_left
theorem cons_injective_right (x : α) : Function.Injective (cons x) :=
cons_injective2.right _
#align stream.cons_injective_right Stream'.cons_injective_right
theorem all_def (p : α → Prop) (s : Stream' α) : All p s = ∀ n, p (get s n) :=
rfl
#align stream.all_def Stream'.all_def
theorem any_def (p : α → Prop) (s : Stream' α) : Any p s = ∃ n, p (get s n) :=
rfl
#align stream.any_def Stream'.any_def
@[simp]
theorem mem_cons (a : α) (s : Stream' α) : a ∈ a::s :=
Exists.intro 0 rfl
#align stream.mem_cons Stream'.mem_cons
theorem mem_cons_of_mem {a : α} {s : Stream' α} (b : α) : a ∈ s → a ∈ b::s := fun ⟨n, h⟩ =>
Exists.intro (succ n) (by rw [get_succ, tail_cons, h])
#align stream.mem_cons_of_mem Stream'.mem_cons_of_mem
theorem eq_or_mem_of_mem_cons {a b : α} {s : Stream' α} : (a ∈ b::s) → a = b ∨ a ∈ s :=
fun ⟨n, h⟩ => by
cases' n with n'
· left
exact h
· right
rw [get_succ, tail_cons] at h
exact ⟨n', h⟩
#align stream.eq_or_mem_of_mem_cons Stream'.eq_or_mem_of_mem_cons
theorem mem_of_get_eq {n : Nat} {s : Stream' α} {a : α} : a = get s n → a ∈ s := fun h =>
Exists.intro n h
#align stream.mem_of_nth_eq Stream'.mem_of_get_eq
section Map
variable (f : α → β)
theorem drop_map (n : Nat) (s : Stream' α) : drop n (map f s) = map f (drop n s) :=
Stream'.ext fun _ => rfl
#align stream.drop_map Stream'.drop_map
@[simp]
theorem get_map (n : Nat) (s : Stream' α) : get (map f s) n = f (get s n) :=
rfl
#align stream.nth_map Stream'.get_map
theorem tail_map (s : Stream' α) : tail (map f s) = map f (tail s) := rfl
#align stream.tail_map Stream'.tail_map
@[simp]
theorem head_map (s : Stream' α) : head (map f s) = f (head s) :=
rfl
#align stream.head_map Stream'.head_map
| Mathlib/Data/Stream/Init.lean | 162 | 163 | theorem map_eq (s : Stream' α) : map f s = f (head s)::map f (tail s) := by |
rw [← Stream'.eta (map f s), tail_map, head_map]
| [
" (s.head :: s.tail) i = s i",
" (s.head :: s.tail) 0 = s 0",
" (s.head :: s.tail) (n✝ + 1) = s (n✝ + 1)",
" drop n (drop m s) = drop (n + m) s",
" (drop n (drop m s)).get n✝ = (drop (n + m) s).get n✝",
" (drop i s).tail = drop (i + 1) s",
" (drop i s).tail.get n✝ = (drop (i + 1) s).get n✝",
" (drop n... | [
" (s.head :: s.tail) i = s i",
" (s.head :: s.tail) 0 = s 0",
" (s.head :: s.tail) (n✝ + 1) = s (n✝ + 1)",
" drop n (drop m s) = drop (n + m) s",
" (drop n (drop m s)).get n✝ = (drop (n + m) s).get n✝",
" (drop i s).tail = drop (i + 1) s",
" (drop i s).tail.get n✝ = (drop (i + 1) s).get n✝",
" (drop n... |
import Mathlib.Combinatorics.SimpleGraph.Coloring
#align_import combinatorics.simple_graph.partition from "leanprover-community/mathlib"@"2303b3e299f1c75b07bceaaac130ce23044d1386"
universe u v
namespace SimpleGraph
variable {V : Type u} (G : SimpleGraph V)
structure Partition where
parts : Set (Set V)
isPartition : Setoid.IsPartition parts
independent : ∀ s ∈ parts, IsAntichain G.Adj s
#align simple_graph.partition SimpleGraph.Partition
def Partition.PartsCardLe {G : SimpleGraph V} (P : G.Partition) (n : ℕ) : Prop :=
∃ h : P.parts.Finite, h.toFinset.card ≤ n
#align simple_graph.partition.parts_card_le SimpleGraph.Partition.PartsCardLe
def Partitionable (n : ℕ) : Prop := ∃ P : G.Partition, P.PartsCardLe n
#align simple_graph.partitionable SimpleGraph.Partitionable
namespace Partition
variable {G} (P : G.Partition)
def partOfVertex (v : V) : Set V := Classical.choose (P.isPartition.2 v)
#align simple_graph.partition.part_of_vertex SimpleGraph.Partition.partOfVertex
theorem partOfVertex_mem (v : V) : P.partOfVertex v ∈ P.parts := by
obtain ⟨h, -⟩ := (P.isPartition.2 v).choose_spec.1
exact h
#align simple_graph.partition.part_of_vertex_mem SimpleGraph.Partition.partOfVertex_mem
theorem mem_partOfVertex (v : V) : v ∈ P.partOfVertex v := by
obtain ⟨⟨_, h⟩, _⟩ := (P.isPartition.2 v).choose_spec
exact h
#align simple_graph.partition.mem_part_of_vertex SimpleGraph.Partition.mem_partOfVertex
| Mathlib/Combinatorics/SimpleGraph/Partition.lean | 98 | 102 | theorem partOfVertex_ne_of_adj {v w : V} (h : G.Adj v w) : P.partOfVertex v ≠ P.partOfVertex w := by |
intro hn
have hw := P.mem_partOfVertex w
rw [← hn] at hw
exact P.independent _ (P.partOfVertex_mem v) (P.mem_partOfVertex v) hw (G.ne_of_adj h) h
| [
" P.partOfVertex v ∈ P.parts",
" v ∈ P.partOfVertex v",
" P.partOfVertex v ≠ P.partOfVertex w",
" False"
] | [
" P.partOfVertex v ∈ P.parts",
" v ∈ P.partOfVertex v"
] |
import Mathlib.Algebra.Order.Group.Defs
import Mathlib.Algebra.Order.Monoid.WithTop
#align_import algebra.order.group.with_top from "leanprover-community/mathlib"@"f178c0e25af359f6cbc72a96a243efd3b12423a3"
namespace WithTop
variable {α : Type*}
namespace LinearOrderedAddCommGroup
variable [LinearOrderedAddCommGroup α] {a b c d : α}
instance instNeg : Neg (WithTop α) where neg := Option.map fun a : α => -a
protected def sub : ∀ _ _ : WithTop α, WithTop α
| _, ⊤ => ⊤
| ⊤, (x : α) => ⊤
| (x : α), (y : α) => (x - y : α)
instance instSub : Sub (WithTop α) where sub := WithTop.LinearOrderedAddCommGroup.sub
@[simp, norm_cast]
theorem coe_neg (a : α) : ((-a : α) : WithTop α) = -a :=
rfl
#align with_top.coe_neg WithTop.LinearOrderedAddCommGroup.coe_neg
@[simp]
theorem neg_top : -(⊤ : WithTop α) = ⊤ := rfl
@[simp, norm_cast]
theorem coe_sub {a b : α} : (↑(a - b) : WithTop α) = ↑a - ↑b := rfl
@[simp]
| Mathlib/Algebra/Order/Group/WithTop.lean | 61 | 62 | theorem top_sub {a : WithTop α} : (⊤ : WithTop α) - a = ⊤ := by |
cases a <;> rfl
| [
" ⊤ - a = ⊤",
" ⊤ - ⊤ = ⊤",
" ⊤ - ↑a✝ = ⊤"
] | [] |
import Mathlib.Probability.ConditionalProbability
import Mathlib.MeasureTheory.Measure.Count
#align_import probability.cond_count from "leanprover-community/mathlib"@"117e93f82b5f959f8193857370109935291f0cc4"
noncomputable section
open ProbabilityTheory
open MeasureTheory MeasurableSpace
namespace ProbabilityTheory
variable {Ω : Type*} [MeasurableSpace Ω]
def condCount (s : Set Ω) : Measure Ω :=
Measure.count[|s]
#align probability_theory.cond_count ProbabilityTheory.condCount
@[simp]
theorem condCount_empty_meas : (condCount ∅ : Measure Ω) = 0 := by simp [condCount]
#align probability_theory.cond_count_empty_meas ProbabilityTheory.condCount_empty_meas
theorem condCount_empty {s : Set Ω} : condCount s ∅ = 0 := by simp
#align probability_theory.cond_count_empty ProbabilityTheory.condCount_empty
theorem finite_of_condCount_ne_zero {s t : Set Ω} (h : condCount s t ≠ 0) : s.Finite := by
by_contra hs'
simp [condCount, cond, Measure.count_apply_infinite hs'] at h
#align probability_theory.finite_of_cond_count_ne_zero ProbabilityTheory.finite_of_condCount_ne_zero
theorem condCount_univ [Fintype Ω] {s : Set Ω} :
condCount Set.univ s = Measure.count s / Fintype.card Ω := by
rw [condCount, cond_apply _ MeasurableSet.univ, ← ENNReal.div_eq_inv_mul, Set.univ_inter]
congr
rw [← Finset.coe_univ, Measure.count_apply, Finset.univ.tsum_subtype' fun _ => (1 : ENNReal)]
· simp [Finset.card_univ]
· exact (@Finset.coe_univ Ω _).symm ▸ MeasurableSet.univ
#align probability_theory.cond_count_univ ProbabilityTheory.condCount_univ
variable [MeasurableSingletonClass Ω]
theorem condCount_isProbabilityMeasure {s : Set Ω} (hs : s.Finite) (hs' : s.Nonempty) :
IsProbabilityMeasure (condCount s) :=
{ measure_univ := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_univ, ENNReal.inv_mul_cancel]
· exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h
· exact (Measure.count_apply_lt_top.2 hs).ne }
#align probability_theory.cond_count_is_probability_measure ProbabilityTheory.condCount_isProbabilityMeasure
theorem condCount_singleton (ω : Ω) (t : Set Ω) [Decidable (ω ∈ t)] :
condCount {ω} t = if ω ∈ t then 1 else 0 := by
rw [condCount, cond_apply _ (measurableSet_singleton ω), Measure.count_singleton, inv_one,
one_mul]
split_ifs
· rw [(by simpa : ({ω} : Set Ω) ∩ t = {ω}), Measure.count_singleton]
· rw [(by simpa : ({ω} : Set Ω) ∩ t = ∅), Measure.count_empty]
#align probability_theory.cond_count_singleton ProbabilityTheory.condCount_singleton
variable {s t u : Set Ω}
theorem condCount_inter_self (hs : s.Finite) : condCount s (s ∩ t) = condCount s t := by
rw [condCount, cond_inter_self _ hs.measurableSet]
#align probability_theory.cond_count_inter_self ProbabilityTheory.condCount_inter_self
theorem condCount_self (hs : s.Finite) (hs' : s.Nonempty) : condCount s s = 1 := by
rw [condCount, cond_apply _ hs.measurableSet, Set.inter_self, ENNReal.inv_mul_cancel]
· exact fun h => hs'.ne_empty <| Measure.empty_of_count_eq_zero h
· exact (Measure.count_apply_lt_top.2 hs).ne
#align probability_theory.cond_count_self ProbabilityTheory.condCount_self
| Mathlib/Probability/CondCount.lean | 110 | 115 | theorem condCount_eq_one_of (hs : s.Finite) (hs' : s.Nonempty) (ht : s ⊆ t) :
condCount s t = 1 := by |
haveI := condCount_isProbabilityMeasure hs hs'
refine eq_of_le_of_not_lt prob_le_one ?_
rw [not_lt, ← condCount_self hs hs']
exact measure_mono ht
| [
" condCount ∅ = 0",
" (condCount s) ∅ = 0",
" s.Finite",
" False",
" (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count Set.univ = ↑(Fintype.card Ω)",
" ∑ x : Ω, 1 = ↑(Fintype.card Ω)",
" M... | [
" condCount ∅ = 0",
" (condCount s) ∅ = 0",
" s.Finite",
" False",
" (condCount Set.univ) s = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count s / Measure.count Set.univ = Measure.count s / ↑(Fintype.card Ω)",
" Measure.count Set.univ = ↑(Fintype.card Ω)",
" ∑ x : Ω, 1 = ↑(Fintype.card Ω)",
" M... |
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
import Mathlib.RepresentationTheory.GroupCohomology.Basic
import Mathlib.RepresentationTheory.Invariants
universe v u
noncomputable section
open CategoryTheory Limits Representation
variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G)
namespace groupCohomology
section Differentials
@[simps]
def dZero : A →ₗ[k] G → A where
toFun m g := A.ρ g m - m
map_add' x y := funext fun g => by simp only [map_add, add_sub_add_comm]; rfl
map_smul' r x := funext fun g => by dsimp; rw [map_smul, smul_sub]
| Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean | 100 | 103 | theorem dZero_ker_eq_invariants : LinearMap.ker (dZero A) = invariants A.ρ := by |
ext x
simp only [LinearMap.mem_ker, mem_invariants, ← @sub_eq_zero _ _ _ x, Function.funext_iff]
rfl
| [
" (fun m g => (A.ρ g) m - m) (x + y) g = ((fun m g => (A.ρ g) m - m) x + (fun m g => (A.ρ g) m - m) y) g",
" (A.ρ g) x - x + ((A.ρ g) y - y) = ((fun g => (A.ρ g) x - x) + fun g => (A.ρ g) y - y) g",
" { toFun := fun m g => (A.ρ g) m - m, map_add' := ⋯ }.toFun (r • x) g =\n ((RingHom.id k) r • { toFun := fun ... | [
" (fun m g => (A.ρ g) m - m) (x + y) g = ((fun m g => (A.ρ g) m - m) x + (fun m g => (A.ρ g) m - m) y) g",
" (A.ρ g) x - x + ((A.ρ g) y - y) = ((fun g => (A.ρ g) x - x) + fun g => (A.ρ g) y - y) g",
" { toFun := fun m g => (A.ρ g) m - m, map_add' := ⋯ }.toFun (r • x) g =\n ((RingHom.id k) r • { toFun := fun ... |
import Batteries.Tactic.Lint.Basic
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Order.ZeroLEOne
import Mathlib.Data.Nat.Cast.Order
import Mathlib.Init.Data.Int.Order
set_option autoImplicit true
namespace Linarith
theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a
theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by
simp [*]
| Mathlib/Tactic/Linarith/Lemmas.lean | 30 | 31 | theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by |
simp [*]
| [
" a + b = 0",
" a + b ≤ 0"
] | [
" a + b = 0"
] |
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section EDist
variable [EDist α] {x y : α} {s t : Set α}
theorem le_einfsep_iff {d} :
d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by
simp_rw [einfsep, le_iInf_iff]
#align set.le_einfsep_iff Set.le_einfsep_iff
theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by
simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop]
#align set.einfsep_zero Set.einfsep_zero
theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by
rw [pos_iff_ne_zero, Ne, einfsep_zero]
simp only [not_forall, not_exists, not_lt, exists_prop, not_and]
#align set.einfsep_pos Set.einfsep_pos
theorem einfsep_top :
s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by
simp_rw [einfsep, iInf_eq_top]
#align set.einfsep_top Set.einfsep_top
theorem einfsep_lt_top :
s.einfsep < ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < ∞ := by
simp_rw [einfsep, iInf_lt_iff, exists_prop]
#align set.einfsep_lt_top Set.einfsep_lt_top
theorem einfsep_ne_top :
s.einfsep ≠ ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y ≠ ∞ := by
simp_rw [← lt_top_iff_ne_top, einfsep_lt_top]
#align set.einfsep_ne_top Set.einfsep_ne_top
theorem einfsep_lt_iff {d} :
s.einfsep < d ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < d := by
simp_rw [einfsep, iInf_lt_iff, exists_prop]
#align set.einfsep_lt_iff Set.einfsep_lt_iff
theorem nontrivial_of_einfsep_lt_top (hs : s.einfsep < ∞) : s.Nontrivial := by
rcases einfsep_lt_top.1 hs with ⟨_, hx, _, hy, hxy, _⟩
exact ⟨_, hx, _, hy, hxy⟩
#align set.nontrivial_of_einfsep_lt_top Set.nontrivial_of_einfsep_lt_top
theorem nontrivial_of_einfsep_ne_top (hs : s.einfsep ≠ ∞) : s.Nontrivial :=
nontrivial_of_einfsep_lt_top (lt_top_iff_ne_top.mpr hs)
#align set.nontrivial_of_einfsep_ne_top Set.nontrivial_of_einfsep_ne_top
theorem Subsingleton.einfsep (hs : s.Subsingleton) : s.einfsep = ∞ := by
rw [einfsep_top]
exact fun _ hx _ hy hxy => (hxy <| hs hx hy).elim
#align set.subsingleton.einfsep Set.Subsingleton.einfsep
| Mathlib/Topology/MetricSpace/Infsep.lean | 98 | 100 | theorem le_einfsep_image_iff {d} {f : β → α} {s : Set β} : d ≤ einfsep (f '' s)
↔ ∀ x ∈ s, ∀ y ∈ s, f x ≠ f y → d ≤ edist (f x) (f y) := by |
simp_rw [le_einfsep_iff, forall_mem_image]
| [
" d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y",
" s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C",
" 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" (¬∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C) ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" s... | [
" d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y",
" s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C",
" 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" (¬∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C) ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" s... |
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
#align affine_basis.to_matrix_self AffineBasis.toMatrix_self
variable {ι' : Type*}
theorem toMatrix_row_sum_one [Fintype ι] (q : ι' → P) (i : ι') : ∑ j, b.toMatrix q i j = 1 := by
simp
#align affine_basis.to_matrix_row_sum_one AffineBasis.toMatrix_row_sum_one
theorem affineIndependent_of_toMatrix_right_inv [Fintype ι] [Finite ι'] [DecidableEq ι']
(p : ι' → P) {A : Matrix ι ι' k} (hA : b.toMatrix p * A = 1) : AffineIndependent k p := by
cases nonempty_fintype ι'
rw [affineIndependent_iff_eq_of_fintype_affineCombination_eq]
intro w₁ w₂ hw₁ hw₂ hweq
have hweq' : w₁ ᵥ* b.toMatrix p = w₂ ᵥ* b.toMatrix p := by
ext j
change (∑ i, w₁ i • b.coord j (p i)) = ∑ i, w₂ i • b.coord j (p i)
-- Porting note: Added `u` because `∘` was causing trouble
have u : (fun i => b.coord j (p i)) = b.coord j ∘ p := by simp only [(· ∘ ·)]
rw [← Finset.univ.affineCombination_eq_linear_combination _ _ hw₁,
← Finset.univ.affineCombination_eq_linear_combination _ _ hw₂, u,
← Finset.univ.map_affineCombination p w₁ hw₁, ← Finset.univ.map_affineCombination p w₂ hw₂,
hweq]
replace hweq' := congr_arg (fun w => w ᵥ* A) hweq'
simpa only [Matrix.vecMul_vecMul, hA, Matrix.vecMul_one] using hweq'
#align affine_basis.affine_independent_of_to_matrix_right_inv AffineBasis.affineIndependent_of_toMatrix_right_inv
theorem affineSpan_eq_top_of_toMatrix_left_inv [Finite ι] [Fintype ι'] [DecidableEq ι]
[Nontrivial k] (p : ι' → P) {A : Matrix ι ι' k} (hA : A * b.toMatrix p = 1) :
affineSpan k (range p) = ⊤ := by
cases nonempty_fintype ι
suffices ∀ i, b i ∈ affineSpan k (range p) by
rw [eq_top_iff, ← b.tot, affineSpan_le]
rintro q ⟨i, rfl⟩
exact this i
intro i
have hAi : ∑ j, A i j = 1 := by
calc
∑ j, A i j = ∑ j, A i j * ∑ l, b.toMatrix p j l := by simp
_ = ∑ j, ∑ l, A i j * b.toMatrix p j l := by simp_rw [Finset.mul_sum]
_ = ∑ l, ∑ j, A i j * b.toMatrix p j l := by rw [Finset.sum_comm]
_ = ∑ l, (A * b.toMatrix p) i l := rfl
_ = 1 := by simp [hA, Matrix.one_apply, Finset.filter_eq]
have hbi : b i = Finset.univ.affineCombination k p (A i) := by
apply b.ext_elem
intro j
rw [b.coord_apply, Finset.univ.map_affineCombination _ _ hAi,
Finset.univ.affineCombination_eq_linear_combination _ _ hAi]
change _ = (A * b.toMatrix p) i j
simp_rw [hA, Matrix.one_apply, @eq_comm _ i j]
rw [hbi]
exact affineCombination_mem_affineSpan hAi p
#align affine_basis.affine_span_eq_top_of_to_matrix_left_inv AffineBasis.affineSpan_eq_top_of_toMatrix_left_inv
variable [Fintype ι] (b₂ : AffineBasis ι k P)
@[simp]
theorem toMatrix_vecMul_coords (x : P) : b₂.coords x ᵥ* b.toMatrix b₂ = b.coords x := by
ext j
change _ = b.coord j x
conv_rhs => rw [← b₂.affineCombination_coord_eq_self x]
rw [Finset.map_affineCombination _ _ _ (b₂.sum_coord_apply_eq_one x)]
simp [Matrix.vecMul, Matrix.dotProduct, toMatrix_apply, coords]
#align affine_basis.to_matrix_vec_mul_coords AffineBasis.toMatrix_vecMul_coords
variable [DecidableEq ι]
theorem toMatrix_mul_toMatrix : b.toMatrix b₂ * b₂.toMatrix b = 1 := by
ext l m
change (b.coords (b₂ l) ᵥ* b₂.toMatrix b) m = _
rw [toMatrix_vecMul_coords, coords_apply, ← toMatrix_apply, toMatrix_self]
#align affine_basis.to_matrix_mul_to_matrix AffineBasis.toMatrix_mul_toMatrix
theorem isUnit_toMatrix : IsUnit (b.toMatrix b₂) :=
⟨{ val := b.toMatrix b₂
inv := b₂.toMatrix b
val_inv := b.toMatrix_mul_toMatrix b₂
inv_val := b₂.toMatrix_mul_toMatrix b }, rfl⟩
#align affine_basis.is_unit_to_matrix AffineBasis.isUnit_toMatrix
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 137 | 146 | theorem isUnit_toMatrix_iff [Nontrivial k] (p : ι → P) :
IsUnit (b.toMatrix p) ↔ AffineIndependent k p ∧ affineSpan k (range p) = ⊤ := by |
constructor
· rintro ⟨⟨B, A, hA, hA'⟩, rfl : B = b.toMatrix p⟩
exact ⟨b.affineIndependent_of_toMatrix_right_inv p hA,
b.affineSpan_eq_top_of_toMatrix_left_inv p hA'⟩
· rintro ⟨h_tot, h_ind⟩
let b' : AffineBasis ι k P := ⟨p, h_tot, h_ind⟩
change IsUnit (b.toMatrix b')
exact b.isUnit_toMatrix b'
| [
" b.toMatrix ⇑b = 1",
" b.toMatrix (⇑b) i j = 1 i j",
" ∑ j : ι, b.toMatrix q i j = 1",
" AffineIndependent k p",
" ∀ (w1 w2 : ι' → k),\n ∑ i : ι', w1 i = 1 →\n ∑ i : ι', w2 i = 1 →\n (Finset.affineCombination k Finset.univ p) w1 = (Finset.affineCombination k Finset.univ p) w2 → w1 = w2",
"... | [
" b.toMatrix ⇑b = 1",
" b.toMatrix (⇑b) i j = 1 i j",
" ∑ j : ι, b.toMatrix q i j = 1",
" AffineIndependent k p",
" ∀ (w1 w2 : ι' → k),\n ∑ i : ι', w1 i = 1 →\n ∑ i : ι', w2 i = 1 →\n (Finset.affineCombination k Finset.univ p) w1 = (Finset.affineCombination k Finset.univ p) w2 → w1 = w2",
"... |
import Mathlib.Data.Fintype.Basic
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Tactic.Zify
import Mathlib.Data.Nat.Totient
#align_import number_theory.lucas_primality from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
| Mathlib/NumberTheory/LucasPrimality.lean | 42 | 63 | theorem lucas_primality (p : ℕ) (a : ZMod p) (ha : a ^ (p - 1) = 1)
(hd : ∀ q : ℕ, q.Prime → q ∣ p - 1 → a ^ ((p - 1) / q) ≠ 1) : p.Prime := by |
have h0 : p ≠ 0 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have h1 : p ≠ 1 := by
rintro ⟨⟩
exact hd 2 Nat.prime_two (dvd_zero _) (pow_zero _)
have hp1 : 1 < p := lt_of_le_of_ne h0.bot_lt h1.symm
have order_of_a : orderOf a = p - 1 := by
apply orderOf_eq_of_pow_and_pow_div_prime _ ha hd
exact tsub_pos_of_lt hp1
haveI : NeZero p := ⟨h0⟩
rw [Nat.prime_iff_card_units]
-- Prove cardinality of `Units` of `ZMod p` is both `≤ p-1` and `≥ p-1`
refine le_antisymm (Nat.card_units_zmod_lt_sub_one hp1) ?_
have hp' : p - 2 + 1 = p - 1 := tsub_add_eq_add_tsub hp1
let a' : (ZMod p)ˣ := Units.mkOfMulEqOne a (a ^ (p - 2)) (by rw [← pow_succ', hp', ha])
calc
p - 1 = orderOf a := order_of_a.symm
_ = orderOf a' := (orderOf_injective (Units.coeHom (ZMod p)) Units.ext a')
_ ≤ Fintype.card (ZMod p)ˣ := orderOf_le_card_univ
| [
" p.Prime",
" p ≠ 0",
" False",
" p ≠ 1",
" orderOf a = p - 1",
" 0 < p - 1",
" Fintype.card (ZMod p)ˣ = p - 1",
" p - 1 ≤ Fintype.card (ZMod p)ˣ",
" a * a ^ (p - 2) = 1"
] | [] |
namespace Nat
@[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1
instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1))
theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl
theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id
theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans
theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩
theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by
let t := dvd_gcd (Nat.dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t
theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n :=
H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm])
theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n :=
have H1 : Coprime (gcd (k * m) n) k := by
rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right]
Nat.dvd_antisymm
(dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _))
(gcd_dvd_gcd_mul_left _ _ _)
theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by
rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m]
theorem Coprime.gcd_mul_left_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (k * n) = gcd m n := by
rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n]
theorem Coprime.gcd_mul_right_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (n * k) = gcd m n := by
rw [Nat.mul_comm n k, H.gcd_mul_left_cancel_right n]
theorem coprime_div_gcd_div_gcd
(H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) := by
rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H]
theorem not_coprime_of_dvd_of_dvd (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) : ¬ Coprime m n :=
fun co => Nat.not_le_of_gt dgt1 <| Nat.le_of_dvd Nat.zero_lt_one <| by
rw [← co.gcd_eq_one]; exact dvd_gcd Hm Hn
theorem exists_coprime (m n : Nat) :
∃ m' n', Coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n := by
cases eq_zero_or_pos (gcd m n) with
| inl h0 =>
rw [gcd_eq_zero_iff] at h0
refine ⟨1, 1, gcd_one_left 1, ?_⟩
simp [h0]
| inr hpos =>
exact ⟨_, _, coprime_div_gcd_div_gcd hpos,
(Nat.div_mul_cancel (gcd_dvd_left m n)).symm,
(Nat.div_mul_cancel (gcd_dvd_right m n)).symm⟩
theorem exists_coprime' (H : 0 < gcd m n) :
∃ g m' n', 0 < g ∧ Coprime m' n' ∧ m = m' * g ∧ n = n' * g :=
let ⟨m', n', h⟩ := exists_coprime m n; ⟨_, m', n', H, h⟩
theorem Coprime.mul (H1 : Coprime m k) (H2 : Coprime n k) : Coprime (m * n) k :=
(H1.gcd_mul_left_cancel n).trans H2
theorem Coprime.mul_right (H1 : Coprime k m) (H2 : Coprime k n) : Coprime k (m * n) :=
(H1.symm.mul H2.symm).symm
| .lake/packages/batteries/Batteries/Data/Nat/Gcd.lean | 87 | 91 | theorem Coprime.coprime_dvd_left (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n := by |
apply eq_one_of_dvd_one
rw [Coprime] at H2
have := Nat.gcd_dvd_gcd_of_dvd_left n H1
rwa [← H2]
| [
" k ∣ m",
" k ∣ n * m",
" ((k * m).gcd n).Coprime k",
" (m * k).gcd n = m.gcd n",
" m.gcd (k * n) = m.gcd n",
" m.gcd (n * k) = m.gcd n",
" (m / m.gcd n).Coprime (n / m.gcd n)",
" d ∣ 1",
" d ∣ m.gcd n",
" ∃ m' n', m'.Coprime n' ∧ m = m' * m.gcd n ∧ n = n' * m.gcd n",
" m = 1 * m.gcd n ∧ n = 1 *... | [
" k ∣ m",
" k ∣ n * m",
" ((k * m).gcd n).Coprime k",
" (m * k).gcd n = m.gcd n",
" m.gcd (k * n) = m.gcd n",
" m.gcd (n * k) = m.gcd n",
" (m / m.gcd n).Coprime (n / m.gcd n)",
" d ∣ 1",
" d ∣ m.gcd n",
" ∃ m' n', m'.Coprime n' ∧ m = m' * m.gcd n ∧ n = n' * m.gcd n",
" m = 1 * m.gcd n ∧ n = 1 *... |
import Mathlib.CategoryTheory.Balanced
import Mathlib.CategoryTheory.LiftingProperties.Basic
#align_import category_theory.limits.shapes.strong_epi from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
variable {P Q : C}
class StrongEpi (f : P ⟶ Q) : Prop where
epi : Epi f
llp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Mono z], HasLiftingProperty f z
#align category_theory.strong_epi CategoryTheory.StrongEpi
#align category_theory.strong_epi.epi CategoryTheory.StrongEpi.epi
theorem StrongEpi.mk' {f : P ⟶ Q} [Epi f]
(hf : ∀ (X Y : C) (z : X ⟶ Y)
(_ : Mono z) (u : P ⟶ X) (v : Q ⟶ Y) (sq : CommSq u f z v), sq.HasLift) :
StrongEpi f :=
{ epi := inferInstance
llp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ }
#align category_theory.strong_epi.mk' CategoryTheory.StrongEpi.mk'
class StrongMono (f : P ⟶ Q) : Prop where
mono : Mono f
rlp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Epi z], HasLiftingProperty z f
#align category_theory.strong_mono CategoryTheory.StrongMono
theorem StrongMono.mk' {f : P ⟶ Q} [Mono f]
(hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Epi z) (u : X ⟶ P)
(v : Y ⟶ Q) (sq : CommSq u z f v), sq.HasLift) : StrongMono f where
mono := inferInstance
rlp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩
#align category_theory.strong_mono.mk' CategoryTheory.StrongMono.mk'
attribute [instance 100] StrongEpi.llp
attribute [instance 100] StrongMono.rlp
instance (priority := 100) epi_of_strongEpi (f : P ⟶ Q) [StrongEpi f] : Epi f :=
StrongEpi.epi
#align category_theory.epi_of_strong_epi CategoryTheory.epi_of_strongEpi
instance (priority := 100) mono_of_strongMono (f : P ⟶ Q) [StrongMono f] : Mono f :=
StrongMono.mono
#align category_theory.mono_of_strong_mono CategoryTheory.mono_of_strongMono
section
variable {R : C} (f : P ⟶ Q) (g : Q ⟶ R)
theorem strongEpi_comp [StrongEpi f] [StrongEpi g] : StrongEpi (f ≫ g) :=
{ epi := epi_comp _ _
llp := by
intros
infer_instance }
#align category_theory.strong_epi_comp CategoryTheory.strongEpi_comp
theorem strongMono_comp [StrongMono f] [StrongMono g] : StrongMono (f ≫ g) :=
{ mono := mono_comp _ _
rlp := by
intros
infer_instance }
#align category_theory.strong_mono_comp CategoryTheory.strongMono_comp
theorem strongEpi_of_strongEpi [StrongEpi (f ≫ g)] : StrongEpi g :=
{ epi := epi_of_epi f g
llp := fun {X Y} z _ => by
constructor
intro u v sq
have h₀ : (f ≫ u) ≫ z = (f ≫ g) ≫ v := by simp only [Category.assoc, sq.w]
exact
CommSq.HasLift.mk'
⟨(CommSq.mk h₀).lift, by
simp only [← cancel_mono z, Category.assoc, CommSq.fac_right, sq.w], by simp⟩ }
#align category_theory.strong_epi_of_strong_epi CategoryTheory.strongEpi_of_strongEpi
theorem strongMono_of_strongMono [StrongMono (f ≫ g)] : StrongMono f :=
{ mono := mono_of_mono f g
rlp := fun {X Y} z => by
intros
constructor
intro u v sq
have h₀ : u ≫ f ≫ g = z ≫ v ≫ g := by
rw [← Category.assoc, eq_whisker sq.w, Category.assoc]
exact CommSq.HasLift.mk' ⟨(CommSq.mk h₀).lift, by simp, by simp [← cancel_epi z, sq.w]⟩ }
#align category_theory.strong_mono_of_strong_mono CategoryTheory.strongMono_of_strongMono
instance (priority := 100) strongEpi_of_isIso [IsIso f] : StrongEpi f where
epi := by infer_instance
llp {X Y} z := HasLiftingProperty.of_left_iso _ _
#align category_theory.strong_epi_of_is_iso CategoryTheory.strongEpi_of_isIso
instance (priority := 100) strongMono_of_isIso [IsIso f] : StrongMono f where
mono := by infer_instance
rlp {X Y} z := HasLiftingProperty.of_right_iso _ _
#align category_theory.strong_mono_of_is_iso CategoryTheory.strongMono_of_isIso
theorem StrongEpi.of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
(e : Arrow.mk f ≅ Arrow.mk g) [h : StrongEpi f] : StrongEpi g :=
{ epi := by
rw [Arrow.iso_w' e]
haveI := epi_comp f e.hom.right
apply epi_comp
llp := fun {X Y} z => by
intro
apply HasLiftingProperty.of_arrow_iso_left e z }
#align category_theory.strong_epi.of_arrow_iso CategoryTheory.StrongEpi.of_arrow_iso
theorem StrongMono.of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
(e : Arrow.mk f ≅ Arrow.mk g) [h : StrongMono f] : StrongMono g :=
{ mono := by
rw [Arrow.iso_w' e]
haveI := mono_comp f e.hom.right
apply mono_comp
rlp := fun {X Y} z => by
intro
apply HasLiftingProperty.of_arrow_iso_right z e }
#align category_theory.strong_mono.of_arrow_iso CategoryTheory.StrongMono.of_arrow_iso
| Mathlib/CategoryTheory/Limits/Shapes/StrongEpi.lean | 172 | 175 | theorem StrongEpi.iff_of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
(e : Arrow.mk f ≅ Arrow.mk g) : StrongEpi f ↔ StrongEpi g := by |
constructor <;> intro
exacts [StrongEpi.of_arrow_iso e, StrongEpi.of_arrow_iso e.symm]
| [
" ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Mono z], HasLiftingProperty (f ≫ g) z",
" HasLiftingProperty (f ≫ g) z✝",
" ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Epi z], HasLiftingProperty z (f ≫ g)",
" HasLiftingProperty z✝ (f ≫ g)",
" HasLiftingProperty g z",
" ∀ {f : Q ⟶ X} {g_1 : R ⟶ Y} (sq : CommSq f g z g_1), sq.HasLif... | [
" ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Mono z], HasLiftingProperty (f ≫ g) z",
" HasLiftingProperty (f ≫ g) z✝",
" ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [inst : Epi z], HasLiftingProperty z (f ≫ g)",
" HasLiftingProperty z✝ (f ≫ g)",
" HasLiftingProperty g z",
" ∀ {f : Q ⟶ X} {g_1 : R ⟶ Y} (sq : CommSq f g z g_1), sq.HasLif... |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Semiring
variable (S : Type u) [Semiring S]
noncomputable def ascPochhammer : ℕ → S[X]
| 0 => 1
| n + 1 => X * (ascPochhammer n).comp (X + 1)
#align pochhammer ascPochhammer
@[simp]
theorem ascPochhammer_zero : ascPochhammer S 0 = 1 :=
rfl
#align pochhammer_zero ascPochhammer_zero
@[simp]
theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer]
#align pochhammer_one ascPochhammer_one
theorem ascPochhammer_succ_left (n : ℕ) :
ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by
rw [ascPochhammer]
#align pochhammer_succ_left ascPochhammer_succ_left
theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] :
Monic <| ascPochhammer S n := by
induction' n with n hn
· simp
· have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1
rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul,
leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn,
monic_X, one_mul, one_mul, this, one_pow]
section
variable {S} {T : Type v} [Semiring T]
@[simp]
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) :
(ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih
· simp
· simp [ih, ascPochhammer_succ_left, map_comp]
#align pochhammer_map ascPochhammer_map
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 90 | 93 | theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) :
(ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by |
rw [← ascPochhammer_map f]
exact eval_map f t
| [
" ascPochhammer S 1 = X",
" ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)",
" (ascPochhammer S n).Monic",
" (ascPochhammer S 0).Monic",
" (ascPochhammer S (n + 1)).Monic",
" map f (ascPochhammer S n) = ascPochhammer T n",
" map f (ascPochhammer S 0) = ascPochhammer T 0",
" map f (ascP... | [
" ascPochhammer S 1 = X",
" ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)",
" (ascPochhammer S n).Monic",
" (ascPochhammer S 0).Monic",
" (ascPochhammer S (n + 1)).Monic",
" map f (ascPochhammer S n) = ascPochhammer T n",
" map f (ascPochhammer S 0) = ascPochhammer T 0",
" map f (ascP... |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Topology.Algebra.InfiniteSum.Order
import Mathlib.Topology.Instances.Real
import Mathlib.Topology.Instances.ENNReal
#align_import topology.algebra.infinite_sum.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Filter Finset NNReal Topology
variable {α β : Type*} [PseudoMetricSpace α] {f : ℕ → α} {a : α}
theorem cauchySeq_of_dist_le_of_summable (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) : CauchySeq f := by
lift d to ℕ → ℝ≥0 using fun n ↦ dist_nonneg.trans (hf n)
apply cauchySeq_of_edist_le_of_summable d (α := α) (f := f)
· exact_mod_cast hf
· exact_mod_cast hd
#align cauchy_seq_of_dist_le_of_summable cauchySeq_of_dist_le_of_summable
theorem cauchySeq_of_summable_dist (h : Summable fun n ↦ dist (f n) (f n.succ)) : CauchySeq f :=
cauchySeq_of_dist_le_of_summable _ (fun _ ↦ le_rfl) h
#align cauchy_seq_of_summable_dist cauchySeq_of_summable_dist
theorem dist_le_tsum_of_dist_le_of_tendsto (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) {a : α} (ha : Tendsto f atTop (𝓝 a)) (n : ℕ) :
dist (f n) a ≤ ∑' m, d (n + m) := by
refine le_of_tendsto (tendsto_const_nhds.dist ha) (eventually_atTop.2 ⟨n, fun m hnm ↦ ?_⟩)
refine le_trans (dist_le_Ico_sum_of_dist_le hnm fun _ _ ↦ hf _) ?_
rw [sum_Ico_eq_sum_range]
refine sum_le_tsum (range _) (fun _ _ ↦ le_trans dist_nonneg (hf _)) ?_
exact hd.comp_injective (add_right_injective n)
#align dist_le_tsum_of_dist_le_of_tendsto dist_le_tsum_of_dist_le_of_tendsto
theorem dist_le_tsum_of_dist_le_of_tendsto₀ (d : ℕ → ℝ) (hf : ∀ n, dist (f n) (f n.succ) ≤ d n)
(hd : Summable d) (ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ tsum d := by
simpa only [zero_add] using dist_le_tsum_of_dist_le_of_tendsto d hf hd ha 0
#align dist_le_tsum_of_dist_le_of_tendsto₀ dist_le_tsum_of_dist_le_of_tendsto₀
theorem dist_le_tsum_dist_of_tendsto (h : Summable fun n ↦ dist (f n) (f n.succ))
(ha : Tendsto f atTop (𝓝 a)) (n) : dist (f n) a ≤ ∑' m, dist (f (n + m)) (f (n + m).succ) :=
show dist (f n) a ≤ ∑' m, (fun x ↦ dist (f x) (f x.succ)) (n + m) from
dist_le_tsum_of_dist_le_of_tendsto (fun n ↦ dist (f n) (f n.succ)) (fun _ ↦ le_rfl) h ha n
#align dist_le_tsum_dist_of_tendsto dist_le_tsum_dist_of_tendsto
theorem dist_le_tsum_dist_of_tendsto₀ (h : Summable fun n ↦ dist (f n) (f n.succ))
(ha : Tendsto f atTop (𝓝 a)) : dist (f 0) a ≤ ∑' n, dist (f n) (f n.succ) := by
simpa only [zero_add] using dist_le_tsum_dist_of_tendsto h ha 0
#align dist_le_tsum_dist_of_tendsto₀ dist_le_tsum_dist_of_tendsto₀
section summable
theorem not_summable_iff_tendsto_nat_atTop_of_nonneg {f : ℕ → ℝ} (hf : ∀ n, 0 ≤ f n) :
¬Summable f ↔ Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by
lift f to ℕ → ℝ≥0 using hf
exact mod_cast NNReal.not_summable_iff_tendsto_nat_atTop
#align not_summable_iff_tendsto_nat_at_top_of_nonneg not_summable_iff_tendsto_nat_atTop_of_nonneg
theorem summable_iff_not_tendsto_nat_atTop_of_nonneg {f : ℕ → ℝ} (hf : ∀ n, 0 ≤ f n) :
Summable f ↔ ¬Tendsto (fun n : ℕ => ∑ i ∈ Finset.range n, f i) atTop atTop := by
rw [← not_iff_not, Classical.not_not, not_summable_iff_tendsto_nat_atTop_of_nonneg hf]
#align summable_iff_not_tendsto_nat_at_top_of_nonneg summable_iff_not_tendsto_nat_atTop_of_nonneg
| Mathlib/Topology/Algebra/InfiniteSum/Real.lean | 78 | 81 | theorem summable_sigma_of_nonneg {β : α → Type*} {f : (Σ x, β x) → ℝ} (hf : ∀ x, 0 ≤ f x) :
Summable f ↔ (∀ x, Summable fun y => f ⟨x, y⟩) ∧ Summable fun x => ∑' y, f ⟨x, y⟩ := by |
lift f to (Σx, β x) → ℝ≥0 using hf
exact mod_cast NNReal.summable_sigma
| [
" CauchySeq f",
" ∀ (n : ℕ), edist (f n) (f n.succ) ≤ ↑(d n)",
" Summable d",
" dist (f n) a ≤ ∑' (m : ℕ), d (n + m)",
" dist (f n) (f m) ≤ ∑' (m : ℕ), d (n + m)",
" ∑ i ∈ Ico n m, d i ≤ ∑' (m : ℕ), d (n + m)",
" ∑ k ∈ range (m - n), d (n + k) ≤ ∑' (m : ℕ), d (n + m)",
" Summable fun k => d (n + k)",
... | [
" CauchySeq f",
" ∀ (n : ℕ), edist (f n) (f n.succ) ≤ ↑(d n)",
" Summable d",
" dist (f n) a ≤ ∑' (m : ℕ), d (n + m)",
" dist (f n) (f m) ≤ ∑' (m : ℕ), d (n + m)",
" ∑ i ∈ Ico n m, d i ≤ ∑' (m : ℕ), d (n + m)",
" ∑ k ∈ range (m - n), d (n + k) ≤ ∑' (m : ℕ), d (n + m)",
" Summable fun k => d (n + k)",
... |
import Mathlib.MeasureTheory.Function.SimpleFunc
import Mathlib.MeasureTheory.Constructions.BorelSpace.Metrizable
#align_import measure_theory.function.simple_func_dense from "leanprover-community/mathlib"@"7317149f12f55affbc900fc873d0d422485122b9"
open Set Function Filter TopologicalSpace ENNReal EMetric Finset
open scoped Classical
open Topology ENNReal MeasureTheory
variable {α β ι E F 𝕜 : Type*}
noncomputable section
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
variable [MeasurableSpace α] [PseudoEMetricSpace α] [OpensMeasurableSpace α]
noncomputable def nearestPtInd (e : ℕ → α) : ℕ → α →ₛ ℕ
| 0 => const α 0
| N + 1 =>
piecewise (⋂ k ≤ N, { x | edist (e (N + 1)) x < edist (e k) x })
(MeasurableSet.iInter fun _ =>
MeasurableSet.iInter fun _ =>
measurableSet_lt measurable_edist_right measurable_edist_right)
(const α <| N + 1) (nearestPtInd e N)
#align measure_theory.simple_func.nearest_pt_ind MeasureTheory.SimpleFunc.nearestPtInd
noncomputable def nearestPt (e : ℕ → α) (N : ℕ) : α →ₛ α :=
(nearestPtInd e N).map e
#align measure_theory.simple_func.nearest_pt MeasureTheory.SimpleFunc.nearestPt
@[simp]
theorem nearestPtInd_zero (e : ℕ → α) : nearestPtInd e 0 = const α 0 :=
rfl
#align measure_theory.simple_func.nearest_pt_ind_zero MeasureTheory.SimpleFunc.nearestPtInd_zero
@[simp]
theorem nearestPt_zero (e : ℕ → α) : nearestPt e 0 = const α (e 0) :=
rfl
#align measure_theory.simple_func.nearest_pt_zero MeasureTheory.SimpleFunc.nearestPt_zero
| Mathlib/MeasureTheory/Function/SimpleFuncDense.lean | 87 | 92 | theorem nearestPtInd_succ (e : ℕ → α) (N : ℕ) (x : α) :
nearestPtInd e (N + 1) x =
if ∀ k ≤ N, edist (e (N + 1)) x < edist (e k) x then N + 1 else nearestPtInd e N x := by |
simp only [nearestPtInd, coe_piecewise, Set.piecewise]
congr
simp
| [
" ↑(nearestPtInd e (N + 1)) x = if ∀ k ≤ N, edist (e (N + 1)) x < edist (e k) x then N + 1 else ↑(nearestPtInd e N) x",
" (if x ∈ ⋂ k, ⋂ (_ : k ≤ N), {x | edist (e (N + 1)) x < edist (e k) x} then ↑(const α (N + 1)) x\n else ↑(nearestPtInd e N) x) =\n if ∀ k ≤ N, edist (e (N + 1)) x < edist (e k) x then N +... | [] |
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
universe u v
open Function Set Cardinal
variable {R} {M M₁ M₂ M₃ : Type u} {M' : Type v} [Ring R]
variable [AddCommGroup M] [AddCommGroup M₁] [AddCommGroup M₂] [AddCommGroup M₃] [AddCommGroup M']
variable [Module R M] [Module R M₁] [Module R M₂] [Module R M₃] [Module R M']
@[pp_with_univ]
class HasRankNullity (R : Type v) [inst : Ring R] : Prop where
exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M],
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val
rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M),
Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M
variable [HasRankNullity.{u} R]
lemma rank_quotient_add_rank (N : Submodule R M) :
Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M :=
HasRankNullity.rank_quotient_add_rank N
#align rank_quotient_add_rank rank_quotient_add_rank
variable (R M) in
lemma exists_set_linearIndependent :
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val :=
HasRankNullity.exists_set_linearIndependent M
variable (R) in
instance (priority := 100) : Nontrivial R := by
refine (subsingleton_or_nontrivial R).resolve_left fun H ↦ ?_
have := rank_quotient_add_rank (R := R) (M := PUnit) ⊥
simp [one_add_one_eq_two] at this
theorem lift_rank_range_add_rank_ker (f : M →ₗ[R] M') :
lift.{u} (Module.rank R (LinearMap.range f)) + lift.{v} (Module.rank R (LinearMap.ker f)) =
lift.{v} (Module.rank R M) := by
haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p)
rw [← f.quotKerEquivRange.lift_rank_eq, ← lift_add, rank_quotient_add_rank]
theorem rank_range_add_rank_ker (f : M →ₗ[R] M₁) :
Module.rank R (LinearMap.range f) + Module.rank R (LinearMap.ker f) = Module.rank R M := by
haveI := fun p : Submodule R M => Classical.decEq (M ⧸ p)
rw [← f.quotKerEquivRange.rank_eq, rank_quotient_add_rank]
#align rank_range_add_rank_ker rank_range_add_rank_ker
theorem lift_rank_eq_of_surjective {f : M →ₗ[R] M'} (h : Surjective f) :
lift.{v} (Module.rank R M) =
lift.{u} (Module.rank R M') + lift.{v} (Module.rank R (LinearMap.ker f)) := by
rw [← lift_rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
| Mathlib/LinearAlgebra/Dimension/RankNullity.lean | 86 | 88 | theorem rank_eq_of_surjective {f : M →ₗ[R] M₁} (h : Surjective f) :
Module.rank R M = Module.rank R M₁ + Module.rank R (LinearMap.ker f) := by |
rw [← rank_range_add_rank_ker f, ← rank_range_of_surjective f h]
| [
" Nontrivial R",
" False",
" lift.{u, v} (Module.rank R ↥(LinearMap.range f)) + lift.{v, u} (Module.rank R ↥(LinearMap.ker f)) =\n lift.{v, u} (Module.rank R M)",
" Module.rank R ↥(LinearMap.range f) + Module.rank R ↥(LinearMap.ker f) = Module.rank R M",
" lift.{v, u} (Module.rank R M) = lift.{u, v} (Mod... | [
" Nontrivial R",
" False",
" lift.{u, v} (Module.rank R ↥(LinearMap.range f)) + lift.{v, u} (Module.rank R ↥(LinearMap.ker f)) =\n lift.{v, u} (Module.rank R M)",
" Module.rank R ↥(LinearMap.range f) + Module.rank R ↥(LinearMap.ker f) = Module.rank R M",
" lift.{v, u} (Module.rank R M) = lift.{u, v} (Mod... |
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Set.Sigma
#align_import data.finset.sigma from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Multiset
variable {ι : Type*}
namespace Finset
section Sigma
variable {α : ι → Type*} {β : Type*} (s s₁ s₂ : Finset ι) (t t₁ t₂ : ∀ i, Finset (α i))
protected def sigma : Finset (Σi, α i) :=
⟨_, s.nodup.sigma fun i => (t i).nodup⟩
#align finset.sigma Finset.sigma
variable {s s₁ s₂ t t₁ t₂}
@[simp]
theorem mem_sigma {a : Σi, α i} : a ∈ s.sigma t ↔ a.1 ∈ s ∧ a.2 ∈ t a.1 :=
Multiset.mem_sigma
#align finset.mem_sigma Finset.mem_sigma
@[simp, norm_cast]
theorem coe_sigma (s : Finset ι) (t : ∀ i, Finset (α i)) :
(s.sigma t : Set (Σ i, α i)) = (s : Set ι).sigma fun i ↦ (t i : Set (α i)) :=
Set.ext fun _ => mem_sigma
#align finset.coe_sigma Finset.coe_sigma
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem sigma_nonempty : (s.sigma t).Nonempty ↔ ∃ i ∈ s, (t i).Nonempty := by simp [Finset.Nonempty]
#align finset.sigma_nonempty Finset.sigma_nonempty
@[simp]
theorem sigma_eq_empty : s.sigma t = ∅ ↔ ∀ i ∈ s, t i = ∅ := by
simp only [← not_nonempty_iff_eq_empty, sigma_nonempty, not_exists, not_and]
#align finset.sigma_eq_empty Finset.sigma_eq_empty
@[mono]
theorem sigma_mono (hs : s₁ ⊆ s₂) (ht : ∀ i, t₁ i ⊆ t₂ i) : s₁.sigma t₁ ⊆ s₂.sigma t₂ :=
fun ⟨i, _⟩ h =>
let ⟨hi, ha⟩ := mem_sigma.1 h
mem_sigma.2 ⟨hs hi, ht i ha⟩
#align finset.sigma_mono Finset.sigma_mono
| Mathlib/Data/Finset/Sigma.lean | 75 | 81 | theorem pairwiseDisjoint_map_sigmaMk :
(s : Set ι).PairwiseDisjoint fun i => (t i).map (Embedding.sigmaMk i) := by |
intro i _ j _ hij
rw [Function.onFun, disjoint_left]
simp_rw [mem_map, Function.Embedding.sigmaMk_apply]
rintro _ ⟨y, _, rfl⟩ ⟨z, _, hz'⟩
exact hij (congr_arg Sigma.fst hz'.symm)
| [
" (s.sigma t).Nonempty ↔ ∃ i ∈ s, (t i).Nonempty",
" s.sigma t = ∅ ↔ ∀ i ∈ s, t i = ∅",
" (↑s).PairwiseDisjoint fun i => map (Embedding.sigmaMk i) (t i)",
" (_root_.Disjoint on fun i => map (Embedding.sigmaMk i) (t i)) i j",
" ∀ ⦃a : (x : ι) × α x⦄, a ∈ map (Embedding.sigmaMk i) (t i) → a ∉ map (Embedding.s... | [
" (s.sigma t).Nonempty ↔ ∃ i ∈ s, (t i).Nonempty",
" s.sigma t = ∅ ↔ ∀ i ∈ s, t i = ∅"
] |
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]
| Mathlib/CategoryTheory/GlueData.lean | 77 | 85 | 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)
| [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom"
] | [] |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic
import Mathlib.Analysis.NormedSpace.AffineIsometry
#align_import geometry.euclidean.angle.unoriented.affine from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open Real RealInnerProductSpace
namespace EuclideanGeometry
open InnerProductGeometry
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P] {p p₀ p₁ p₂ : P}
nonrec def angle (p1 p2 p3 : P) : ℝ :=
angle (p1 -ᵥ p2 : V) (p3 -ᵥ p2)
#align euclidean_geometry.angle EuclideanGeometry.angle
@[inherit_doc] scoped notation "∠" => EuclideanGeometry.angle
theorem continuousAt_angle {x : P × P × P} (hx12 : x.1 ≠ x.2.1) (hx32 : x.2.2 ≠ x.2.1) :
ContinuousAt (fun y : P × P × P => ∠ y.1 y.2.1 y.2.2) x := by
let f : P × P × P → V × V := fun y => (y.1 -ᵥ y.2.1, y.2.2 -ᵥ y.2.1)
have hf1 : (f x).1 ≠ 0 := by simp [hx12]
have hf2 : (f x).2 ≠ 0 := by simp [hx32]
exact (InnerProductGeometry.continuousAt_angle hf1 hf2).comp
((continuous_fst.vsub continuous_snd.fst).prod_mk
(continuous_snd.snd.vsub continuous_snd.fst)).continuousAt
#align euclidean_geometry.continuous_at_angle EuclideanGeometry.continuousAt_angle
@[simp]
theorem _root_.AffineIsometry.angle_map {V₂ P₂ : Type*} [NormedAddCommGroup V₂]
[InnerProductSpace ℝ V₂] [MetricSpace P₂] [NormedAddTorsor V₂ P₂]
(f : P →ᵃⁱ[ℝ] P₂) (p₁ p₂ p₃ : P) : ∠ (f p₁) (f p₂) (f p₃) = ∠ p₁ p₂ p₃ := by
simp_rw [angle, ← AffineIsometry.map_vsub, LinearIsometry.angle_map]
#align affine_isometry.angle_map AffineIsometry.angle_map
@[simp, norm_cast]
theorem _root_.AffineSubspace.angle_coe {s : AffineSubspace ℝ P} (p₁ p₂ p₃ : s) :
haveI : Nonempty s := ⟨p₁⟩
∠ (p₁ : P) (p₂ : P) (p₃ : P) = ∠ p₁ p₂ p₃ :=
haveI : Nonempty s := ⟨p₁⟩
s.subtypeₐᵢ.angle_map p₁ p₂ p₃
#align affine_subspace.angle_coe AffineSubspace.angle_coe
@[simp]
theorem angle_const_vadd (v : V) (p₁ p₂ p₃ : P) : ∠ (v +ᵥ p₁) (v +ᵥ p₂) (v +ᵥ p₃) = ∠ p₁ p₂ p₃ :=
(AffineIsometryEquiv.constVAdd ℝ P v).toAffineIsometry.angle_map _ _ _
#align euclidean_geometry.angle_const_vadd EuclideanGeometry.angle_const_vadd
@[simp]
theorem angle_vadd_const (v₁ v₂ v₃ : V) (p : P) : ∠ (v₁ +ᵥ p) (v₂ +ᵥ p) (v₃ +ᵥ p) = ∠ v₁ v₂ v₃ :=
(AffineIsometryEquiv.vaddConst ℝ p).toAffineIsometry.angle_map _ _ _
#align euclidean_geometry.angle_vadd_const EuclideanGeometry.angle_vadd_const
@[simp]
theorem angle_const_vsub (p p₁ p₂ p₃ : P) : ∠ (p -ᵥ p₁) (p -ᵥ p₂) (p -ᵥ p₃) = ∠ p₁ p₂ p₃ :=
(AffineIsometryEquiv.constVSub ℝ p).toAffineIsometry.angle_map _ _ _
#align euclidean_geometry.angle_const_vsub EuclideanGeometry.angle_const_vsub
@[simp]
theorem angle_vsub_const (p₁ p₂ p₃ p : P) : ∠ (p₁ -ᵥ p) (p₂ -ᵥ p) (p₃ -ᵥ p) = ∠ p₁ p₂ p₃ :=
(AffineIsometryEquiv.vaddConst ℝ p).symm.toAffineIsometry.angle_map _ _ _
#align euclidean_geometry.angle_vsub_const EuclideanGeometry.angle_vsub_const
@[simp]
theorem angle_add_const (v₁ v₂ v₃ : V) (v : V) : ∠ (v₁ + v) (v₂ + v) (v₃ + v) = ∠ v₁ v₂ v₃ :=
angle_vadd_const _ _ _ _
#align euclidean_geometry.angle_add_const EuclideanGeometry.angle_add_const
@[simp]
theorem angle_const_add (v : V) (v₁ v₂ v₃ : V) : ∠ (v + v₁) (v + v₂) (v + v₃) = ∠ v₁ v₂ v₃ :=
angle_const_vadd _ _ _ _
#align euclidean_geometry.angle_const_add EuclideanGeometry.angle_const_add
@[simp]
theorem angle_sub_const (v₁ v₂ v₃ : V) (v : V) : ∠ (v₁ - v) (v₂ - v) (v₃ - v) = ∠ v₁ v₂ v₃ := by
simpa only [vsub_eq_sub] using angle_vsub_const v₁ v₂ v₃ v
#align euclidean_geometry.angle_sub_const EuclideanGeometry.angle_sub_const
@[simp]
theorem angle_const_sub (v : V) (v₁ v₂ v₃ : V) : ∠ (v - v₁) (v - v₂) (v - v₃) = ∠ v₁ v₂ v₃ := by
simpa only [vsub_eq_sub] using angle_const_vsub v v₁ v₂ v₃
#align euclidean_geometry.angle_const_sub EuclideanGeometry.angle_const_sub
@[simp]
| Mathlib/Geometry/Euclidean/Angle/Unoriented/Affine.lean | 125 | 126 | theorem angle_neg (v₁ v₂ v₃ : V) : ∠ (-v₁) (-v₂) (-v₃) = ∠ v₁ v₂ v₃ := by |
simpa only [zero_sub] using angle_const_sub 0 v₁ v₂ v₃
| [
" ContinuousAt (fun y => ∠ y.1 y.2.1 y.2.2) x",
" (f x).1 ≠ 0",
" (f x).2 ≠ 0",
" ∠ (f p₁) (f p₂) (f p₃) = ∠ p₁ p₂ p₃",
" ∠ (v₁ - v) (v₂ - v) (v₃ - v) = ∠ v₁ v₂ v₃",
" ∠ (v - v₁) (v - v₂) (v - v₃) = ∠ v₁ v₂ v₃",
" ∠ (-v₁) (-v₂) (-v₃) = ∠ v₁ v₂ v₃"
] | [
" ContinuousAt (fun y => ∠ y.1 y.2.1 y.2.2) x",
" (f x).1 ≠ 0",
" (f x).2 ≠ 0",
" ∠ (f p₁) (f p₂) (f p₃) = ∠ p₁ p₂ p₃",
" ∠ (v₁ - v) (v₂ - v) (v₃ - v) = ∠ v₁ v₂ v₃",
" ∠ (v - v₁) (v - v₂) (v - v₃) = ∠ v₁ v₂ v₃"
] |
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction
variable {R M : Type*}
variable [CommRing R] [AddCommGroup M] [Module R M] {Q : QuadraticForm R M}
namespace CliffordAlgebra
variable (Q)
def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where
invOf := ι Q (⅟ (Q m) • m)
invOf_mul_self := by
rw [map_smul, smul_mul_assoc, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one]
mul_invOf_self := by
rw [map_smul, mul_smul_comm, ι_sq_scalar, Algebra.smul_def, ← map_mul, invOf_mul_self, map_one]
#align clifford_algebra.invertible_ι_of_invertible CliffordAlgebra.invertibleιOfInvertible
theorem invOf_ι (m : M) [Invertible (Q m)] [Invertible (ι Q m)] :
⅟ (ι Q m) = ι Q (⅟ (Q m) • m) := by
letI := invertibleιOfInvertible Q m
convert (rfl : ⅟ (ι Q m) = _)
#align clifford_algebra.inv_of_ι CliffordAlgebra.invOf_ι
theorem isUnit_ι_of_isUnit {m : M} (h : IsUnit (Q m)) : IsUnit (ι Q m) := by
cases h.nonempty_invertible
letI := invertibleιOfInvertible Q m
exact isUnit_of_invertible (ι Q m)
#align clifford_algebra.is_unit_ι_of_is_unit CliffordAlgebra.isUnit_ι_of_isUnit
| Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean | 44 | 47 | theorem ι_mul_ι_mul_invOf_ι (a b : M) [Invertible (ι Q a)] [Invertible (Q a)] :
ι Q a * ι Q b * ⅟ (ι Q a) = ι Q ((⅟ (Q a) * QuadraticForm.polar Q a b) • a - b) := by |
rw [invOf_ι, map_smul, mul_smul_comm, ι_mul_ι_mul_ι, ← map_smul, smul_sub, smul_smul, smul_smul,
invOf_mul_self, one_smul]
| [
" (ι Q) (⅟(Q m) • m) * (ι Q) m = 1",
" (ι Q) m * (ι Q) (⅟(Q m) • m) = 1",
" ⅟((ι Q) m) = (ι Q) (⅟(Q m) • m)",
" IsUnit ((ι Q) m)",
" (ι Q) a * (ι Q) b * ⅟((ι Q) a) = (ι Q) ((⅟(Q a) * QuadraticForm.polar (⇑Q) a b) • a - b)"
] | [
" (ι Q) (⅟(Q m) • m) * (ι Q) m = 1",
" (ι Q) m * (ι Q) (⅟(Q m) • m) = 1",
" ⅟((ι Q) m) = (ι Q) (⅟(Q m) • m)",
" IsUnit ((ι Q) m)"
] |
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.Monotone
import Mathlib.Data.Set.Function
import Mathlib.Algebra.Group.Basic
import Mathlib.Tactic.WLOG
#align_import analysis.bounded_variation from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
open scoped NNReal ENNReal Topology UniformConvergence
open Set MeasureTheory Filter
-- Porting note: sectioned variables because a `wlog` was broken due to extra variables in context
variable {α : Type*} [LinearOrder α] {E : Type*} [PseudoEMetricSpace E]
noncomputable def eVariationOn (f : α → E) (s : Set α) : ℝ≥0∞ :=
⨆ p : ℕ × { u : ℕ → α // Monotone u ∧ ∀ i, u i ∈ s },
∑ i ∈ Finset.range p.1, edist (f (p.2.1 (i + 1))) (f (p.2.1 i))
#align evariation_on eVariationOn
def BoundedVariationOn (f : α → E) (s : Set α) :=
eVariationOn f s ≠ ∞
#align has_bounded_variation_on BoundedVariationOn
def LocallyBoundedVariationOn (f : α → E) (s : Set α) :=
∀ a b, a ∈ s → b ∈ s → BoundedVariationOn f (s ∩ Icc a b)
#align has_locally_bounded_variation_on LocallyBoundedVariationOn
namespace eVariationOn
| Mathlib/Analysis/BoundedVariation.lean | 83 | 86 | theorem nonempty_monotone_mem {s : Set α} (hs : s.Nonempty) :
Nonempty { u // Monotone u ∧ ∀ i : ℕ, u i ∈ s } := by |
obtain ⟨x, hx⟩ := hs
exact ⟨⟨fun _ => x, fun i j _ => le_rfl, fun _ => hx⟩⟩
| [
" Nonempty { u // Monotone u ∧ ∀ (i : ℕ), u i ∈ s }"
] | [] |
import Mathlib.Topology.Defs.Sequences
import Mathlib.Topology.UniformSpace.Cauchy
#align_import topology.sequences from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Function Filter TopologicalSpace Bornology
open scoped Topology Uniformity
variable {X Y : Type*}
section TopologicalSpace
variable [TopologicalSpace X] [TopologicalSpace Y]
theorem subset_seqClosure {s : Set X} : s ⊆ seqClosure s := fun p hp =>
⟨const ℕ p, fun _ => hp, tendsto_const_nhds⟩
#align subset_seq_closure subset_seqClosure
theorem seqClosure_subset_closure {s : Set X} : seqClosure s ⊆ closure s := fun _p ⟨_x, xM, xp⟩ =>
mem_closure_of_tendsto xp (univ_mem' xM)
#align seq_closure_subset_closure seqClosure_subset_closure
theorem IsSeqClosed.seqClosure_eq {s : Set X} (hs : IsSeqClosed s) : seqClosure s = s :=
Subset.antisymm (fun _p ⟨_x, hx, hp⟩ => hs hx hp) subset_seqClosure
#align is_seq_closed.seq_closure_eq IsSeqClosed.seqClosure_eq
theorem isSeqClosed_of_seqClosure_eq {s : Set X} (hs : seqClosure s = s) : IsSeqClosed s :=
fun x _p hxs hxp => hs ▸ ⟨x, hxs, hxp⟩
#align is_seq_closed_of_seq_closure_eq isSeqClosed_of_seqClosure_eq
theorem isSeqClosed_iff {s : Set X} : IsSeqClosed s ↔ seqClosure s = s :=
⟨IsSeqClosed.seqClosure_eq, isSeqClosed_of_seqClosure_eq⟩
#align is_seq_closed_iff isSeqClosed_iff
protected theorem IsClosed.isSeqClosed {s : Set X} (hc : IsClosed s) : IsSeqClosed s :=
fun _u _x hu hx => hc.mem_of_tendsto hx (eventually_of_forall hu)
#align is_closed.is_seq_closed IsClosed.isSeqClosed
theorem seqClosure_eq_closure [FrechetUrysohnSpace X] (s : Set X) : seqClosure s = closure s :=
seqClosure_subset_closure.antisymm <| FrechetUrysohnSpace.closure_subset_seqClosure s
#align seq_closure_eq_closure seqClosure_eq_closure
theorem mem_closure_iff_seq_limit [FrechetUrysohnSpace X] {s : Set X} {a : X} :
a ∈ closure s ↔ ∃ x : ℕ → X, (∀ n : ℕ, x n ∈ s) ∧ Tendsto x atTop (𝓝 a) := by
rw [← seqClosure_eq_closure]
rfl
#align mem_closure_iff_seq_limit mem_closure_iff_seq_limit
theorem tendsto_nhds_iff_seq_tendsto [FrechetUrysohnSpace X] {f : X → Y} {a : X} {b : Y} :
Tendsto f (𝓝 a) (𝓝 b) ↔ ∀ u : ℕ → X, Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 b) := by
refine
⟨fun hf u hu => hf.comp hu, fun h =>
((nhds_basis_closeds _).tendsto_iff (nhds_basis_closeds _)).2 ?_⟩
rintro s ⟨hbs, hsc⟩
refine ⟨closure (f ⁻¹' s), ⟨mt ?_ hbs, isClosed_closure⟩, fun x => mt fun hx => subset_closure hx⟩
rw [← seqClosure_eq_closure]
rintro ⟨u, hus, hu⟩
exact hsc.mem_of_tendsto (h u hu) (eventually_of_forall hus)
#align tendsto_nhds_iff_seq_tendsto tendsto_nhds_iff_seq_tendsto
| Mathlib/Topology/Sequences.lean | 139 | 151 | theorem FrechetUrysohnSpace.of_seq_tendsto_imp_tendsto
(h : ∀ (f : X → Prop) (a : X),
(∀ u : ℕ → X, Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 (f a))) → ContinuousAt f a) :
FrechetUrysohnSpace X := by |
refine ⟨fun s x hcx => ?_⟩
by_cases hx : x ∈ s;
· exact subset_seqClosure hx
· obtain ⟨u, hux, hus⟩ : ∃ u : ℕ → X, Tendsto u atTop (𝓝 x) ∧ ∃ᶠ x in atTop, u x ∈ s := by
simpa only [ContinuousAt, hx, tendsto_nhds_true, (· ∘ ·), ← not_frequently, exists_prop,
← mem_closure_iff_frequently, hcx, imp_false, not_forall, not_not, not_false_eq_true,
not_true_eq_false] using h (· ∉ s) x
rcases extraction_of_frequently_atTop hus with ⟨φ, φ_mono, hφ⟩
exact ⟨u ∘ φ, hφ, hux.comp φ_mono.tendsto_atTop⟩
| [
" a ∈ closure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)",
" a ∈ seqClosure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)",
" Tendsto f (𝓝 a) (𝓝 b) ↔ ∀ (u : ℕ → X), Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 b)",
" ∀ (ib : Set Y), b ∉ ib ∧ IsClosed ib → ∃ ia, (a ∉ ia ∧ IsClosed ... | [
" a ∈ closure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)",
" a ∈ seqClosure s ↔ ∃ x, (∀ (n : ℕ), x n ∈ s) ∧ Tendsto x atTop (𝓝 a)",
" Tendsto f (𝓝 a) (𝓝 b) ↔ ∀ (u : ℕ → X), Tendsto u atTop (𝓝 a) → Tendsto (f ∘ u) atTop (𝓝 b)",
" ∀ (ib : Set Y), b ∉ ib ∧ IsClosed ib → ∃ ia, (a ∉ ia ∧ IsClosed ... |
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'`
| Mathlib/Analysis/Fourier/AddCircle.lean | 144 | 146 | 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]
| [
" (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.Data.Sigma.Basic
import Mathlib.Algebra.Order.Ring.Nat
#align_import set_theory.lists from "leanprover-community/mathlib"@"497d1e06409995dd8ec95301fa8d8f3480187f4c"
variable {α : Type*}
inductive Lists'.{u} (α : Type u) : Bool → Type u
| atom : α → Lists' α false
| nil : Lists' α true
| cons' {b} : Lists' α b → Lists' α true → Lists' α true
deriving DecidableEq
#align lists' Lists'
compile_inductive% Lists'
def Lists (α : Type*) :=
Σb, Lists' α b
#align lists Lists
namespace Lists'
instance [Inhabited α] : ∀ b, Inhabited (Lists' α b)
| true => ⟨nil⟩
| false => ⟨atom default⟩
def cons : Lists α → Lists' α true → Lists' α true
| ⟨_, a⟩, l => cons' a l
#align lists'.cons Lists'.cons
@[simp]
def toList : ∀ {b}, Lists' α b → List (Lists α)
| _, atom _ => []
| _, nil => []
| _, cons' a l => ⟨_, a⟩ :: l.toList
#align lists'.to_list Lists'.toList
-- Porting note (#10618): removed @[simp]
-- simp can prove this: by simp only [@Lists'.toList, @Sigma.eta]
theorem toList_cons (a : Lists α) (l) : toList (cons a l) = a :: l.toList := by simp
#align lists'.to_list_cons Lists'.toList_cons
@[simp]
def ofList : List (Lists α) → Lists' α true
| [] => nil
| a :: l => cons a (ofList l)
#align lists'.of_list Lists'.ofList
@[simp]
theorem to_ofList (l : List (Lists α)) : toList (ofList l) = l := by induction l <;> simp [*]
#align lists'.to_of_list Lists'.to_ofList
@[simp]
| Mathlib/SetTheory/Lists.lean | 103 | 120 | theorem of_toList : ∀ l : Lists' α true, ofList (toList l) = l :=
suffices
∀ (b) (h : true = b) (l : Lists' α b),
let l' : Lists' α true := by | rw [h]; exact l
ofList (toList l') = l'
from this _ rfl
fun b h l => by
induction l with
| atom => cases h
-- Porting note: case nil was not covered.
| nil => simp
| cons' b a _ IH =>
intro l'
-- Porting note: Previous code was:
-- change l' with cons' a l
--
-- This can be removed.
simpa [cons, l'] using IH rfl
| [
" (cons a l).toList = a :: l.toList",
" (ofList l).toList = l",
" (ofList []).toList = []",
" (ofList (head✝ :: tail✝)).toList = head✝ :: tail✝",
" Lists' α true",
" Lists' α b",
" let l' := ⋯.mpr l;\n ofList l'.toList = l'",
" let l' := ⋯.mpr (atom a✝);\n ofList l'.toList = l'",
" let l' := ⋯.mpr... | [
" (cons a l).toList = a :: l.toList",
" (ofList l).toList = l",
" (ofList []).toList = []",
" (ofList (head✝ :: tail✝)).toList = head✝ :: tail✝"
] |
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.Nondegenerate
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.ToLin
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
#align_import linear_algebra.matrix.to_linear_equiv from "leanprover-community/mathlib"@"e42cfdb03b7902f8787a1eb552cb8f77766b45b9"
variable {n : Type*} [Fintype n]
namespace Matrix
section LinearEquiv
open LinearMap
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
section Nondegenerate
open Matrix
theorem exists_mulVec_eq_zero_iff_aux {K : Type*} [DecidableEq n] [Field K] {M : Matrix n n K} :
(∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 := by
constructor
· rintro ⟨v, hv, mul_eq⟩
contrapose! hv
exact eq_zero_of_mulVec_eq_zero hv mul_eq
· contrapose!
intro h
have : Function.Injective (Matrix.toLin' M) := by
simpa only [← LinearMap.ker_eq_bot, ker_toLin'_eq_bot_iff, not_imp_not] using h
have :
M *
LinearMap.toMatrix'
((LinearEquiv.ofInjectiveEndo (Matrix.toLin' M) this).symm : (n → K) →ₗ[K] n → K) =
1 := by
refine Matrix.toLin'.injective (LinearMap.ext fun v => ?_)
rw [Matrix.toLin'_mul, Matrix.toLin'_one, Matrix.toLin'_toMatrix', LinearMap.comp_apply]
exact (LinearEquiv.ofInjectiveEndo (Matrix.toLin' M) this).apply_symm_apply v
exact Matrix.det_ne_zero_of_right_inverse this
#align matrix.exists_mul_vec_eq_zero_iff_aux Matrix.exists_mulVec_eq_zero_iff_aux
theorem exists_mulVec_eq_zero_iff' {A : Type*} (K : Type*) [DecidableEq n] [CommRing A]
[Nontrivial A] [Field K] [Algebra A K] [IsFractionRing A K] {M : Matrix n n A} :
(∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 := by
have : (∃ v ≠ 0, (algebraMap A K).mapMatrix M *ᵥ v = 0) ↔ _ :=
exists_mulVec_eq_zero_iff_aux
rw [← RingHom.map_det, IsFractionRing.to_map_eq_zero_iff] at this
refine Iff.trans ?_ this; constructor <;> rintro ⟨v, hv, mul_eq⟩
· refine ⟨fun i => algebraMap _ _ (v i), mt (fun h => funext fun i => ?_) hv, ?_⟩
· exact IsFractionRing.to_map_eq_zero_iff.mp (congr_fun h i)
· ext i
refine (RingHom.map_mulVec _ _ _ i).symm.trans ?_
rw [mul_eq, Pi.zero_apply, RingHom.map_zero, Pi.zero_apply]
· letI := Classical.decEq K
obtain ⟨⟨b, hb⟩, ba_eq⟩ :=
IsLocalization.exist_integer_multiples_of_finset (nonZeroDivisors A) (Finset.univ.image v)
choose f hf using ba_eq
refine
⟨fun i => f _ (Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩),
mt (fun h => funext fun i => ?_) hv, ?_⟩
· have := congr_arg (algebraMap A K) (congr_fun h i)
rw [hf, Subtype.coe_mk, Pi.zero_apply, RingHom.map_zero, Algebra.smul_def, mul_eq_zero,
IsFractionRing.to_map_eq_zero_iff] at this
exact this.resolve_left (nonZeroDivisors.ne_zero hb)
· ext i
refine IsFractionRing.injective A K ?_
calc
algebraMap A K ((M *ᵥ (fun i : n => f (v i) _)) i) =
((algebraMap A K).mapMatrix M *ᵥ algebraMap _ K b • v) i := ?_
_ = 0 := ?_
_ = algebraMap A K 0 := (RingHom.map_zero _).symm
· simp_rw [RingHom.map_mulVec, mulVec, dotProduct, Function.comp_apply, hf,
RingHom.mapMatrix_apply, Pi.smul_apply, smul_eq_mul, Algebra.smul_def]
· rw [mulVec_smul, mul_eq, Pi.smul_apply, Pi.zero_apply, smul_zero]
#align matrix.exists_mul_vec_eq_zero_iff' Matrix.exists_mulVec_eq_zero_iff'
theorem exists_mulVec_eq_zero_iff {A : Type*} [DecidableEq n] [CommRing A] [IsDomain A]
{M : Matrix n n A} : (∃ v ≠ 0, M *ᵥ v = 0) ↔ M.det = 0 :=
exists_mulVec_eq_zero_iff' (FractionRing A)
#align matrix.exists_mul_vec_eq_zero_iff Matrix.exists_mulVec_eq_zero_iff
theorem exists_vecMul_eq_zero_iff {A : Type*} [DecidableEq n] [CommRing A] [IsDomain A]
{M : Matrix n n A} : (∃ v ≠ 0, v ᵥ* M = 0) ↔ M.det = 0 := by
simpa only [← M.det_transpose, ← mulVec_transpose] using exists_mulVec_eq_zero_iff
#align matrix.exists_vec_mul_eq_zero_iff Matrix.exists_vecMul_eq_zero_iff
| Mathlib/LinearAlgebra/Matrix/ToLinearEquiv.lean | 180 | 190 | theorem nondegenerate_iff_det_ne_zero {A : Type*} [DecidableEq n] [CommRing A] [IsDomain A]
{M : Matrix n n A} : Nondegenerate M ↔ M.det ≠ 0 := by |
rw [ne_eq, ← exists_vecMul_eq_zero_iff]
push_neg
constructor
· intro hM v hv hMv
obtain ⟨w, hwMv⟩ := hM.exists_not_ortho_of_ne_zero hv
simp [dotProduct_mulVec, hMv, zero_dotProduct, ne_eq, not_true] at hwMv
· intro h v hv
refine not_imp_not.mp (h v) (funext fun i => ?_)
simpa only [dotProduct_mulVec, dotProduct_single, mul_one] using hv (Pi.single i 1)
| [
" (∃ v, v ≠ 0 ∧ M *ᵥ v = 0) ↔ M.det = 0",
" (∃ v, v ≠ 0 ∧ M *ᵥ v = 0) → M.det = 0",
" M.det = 0",
" v = 0",
" M.det = 0 → ∃ v, v ≠ 0 ∧ M *ᵥ v = 0",
" (∀ (v : n → K), v ≠ 0 → M *ᵥ v ≠ 0) → M.det ≠ 0",
" M.det ≠ 0",
" Function.Injective ⇑(toLin' M)",
" M * toMatrix' ↑(LinearEquiv.ofInjectiveEndo (toLi... | [
" (∃ v, v ≠ 0 ∧ M *ᵥ v = 0) ↔ M.det = 0",
" (∃ v, v ≠ 0 ∧ M *ᵥ v = 0) → M.det = 0",
" M.det = 0",
" v = 0",
" M.det = 0 → ∃ v, v ≠ 0 ∧ M *ᵥ v = 0",
" (∀ (v : n → K), v ≠ 0 → M *ᵥ v ≠ 0) → M.det ≠ 0",
" M.det ≠ 0",
" Function.Injective ⇑(toLin' M)",
" M * toMatrix' ↑(LinearEquiv.ofInjectiveEndo (toLi... |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Data.Int.GCD
instance : GCDMonoid ℕ where
gcd := Nat.gcd
lcm := Nat.lcm
gcd_dvd_left := Nat.gcd_dvd_left
gcd_dvd_right := Nat.gcd_dvd_right
dvd_gcd := Nat.dvd_gcd
gcd_mul_lcm a b := by rw [Nat.gcd_mul_lcm]; rfl
lcm_zero_left := Nat.lcm_zero_left
lcm_zero_right := Nat.lcm_zero_right
theorem gcd_eq_nat_gcd (m n : ℕ) : gcd m n = Nat.gcd m n :=
rfl
#align gcd_eq_nat_gcd gcd_eq_nat_gcd
theorem lcm_eq_nat_lcm (m n : ℕ) : lcm m n = Nat.lcm m n :=
rfl
#align lcm_eq_nat_lcm lcm_eq_nat_lcm
instance : NormalizedGCDMonoid ℕ :=
{ (inferInstance : GCDMonoid ℕ),
(inferInstance : NormalizationMonoid ℕ) with
normalize_gcd := fun _ _ => normalize_eq _
normalize_lcm := fun _ _ => normalize_eq _ }
namespace Int
section NormalizationMonoid
instance normalizationMonoid : NormalizationMonoid ℤ where
normUnit a := if 0 ≤ a then 1 else -1
normUnit_zero := if_pos le_rfl
normUnit_mul {a b} hna hnb := by
cases' hna.lt_or_lt with ha ha <;> cases' hnb.lt_or_lt with hb hb <;>
simp [mul_nonneg_iff, ha.le, ha.not_le, hb.le, hb.not_le]
normUnit_coe_units u :=
(units_eq_one_or u).elim (fun eq => eq.symm ▸ if_pos zero_le_one) fun eq =>
eq.symm ▸ if_neg (not_le_of_gt <| show (-1 : ℤ) < 0 by decide)
-- Porting note: added
theorem normUnit_eq (z : ℤ) : normUnit z = if 0 ≤ z then 1 else -1 := rfl
theorem normalize_of_nonneg {z : ℤ} (h : 0 ≤ z) : normalize z = z := by
rw [normalize_apply, normUnit_eq, if_pos h, Units.val_one, mul_one]
#align int.normalize_of_nonneg Int.normalize_of_nonneg
theorem normalize_of_nonpos {z : ℤ} (h : z ≤ 0) : normalize z = -z := by
obtain rfl | h := h.eq_or_lt
· simp
· rw [normalize_apply, normUnit_eq, if_neg (not_le_of_gt h), Units.val_neg, Units.val_one,
mul_neg_one]
#align int.normalize_of_nonpos Int.normalize_of_nonpos
theorem normalize_coe_nat (n : ℕ) : normalize (n : ℤ) = n :=
normalize_of_nonneg (ofNat_le_ofNat_of_le <| Nat.zero_le n)
#align int.normalize_coe_nat Int.normalize_coe_nat
| Mathlib/Algebra/GCDMonoid/Nat.lean | 82 | 83 | theorem abs_eq_normalize (z : ℤ) : |z| = normalize z := by |
cases le_total 0 z <;> simp [-normalize_apply, normalize_of_nonneg, normalize_of_nonpos, *]
| [
" Associated (a.gcd b * a.lcm b) (a * b)",
" Associated (a * b) (a * b)",
" (fun a => if 0 ≤ a then 1 else -1) (a * b) =\n (fun a => if 0 ≤ a then 1 else -1) a * (fun a => if 0 ≤ a then 1 else -1) b",
" -1 < 0",
" normalize z = z",
" normalize z = -z",
" normalize 0 = -0",
" |z| = normalize z"
] | [
" Associated (a.gcd b * a.lcm b) (a * b)",
" Associated (a * b) (a * b)",
" (fun a => if 0 ≤ a then 1 else -1) (a * b) =\n (fun a => if 0 ≤ a then 1 else -1) a * (fun a => if 0 ≤ a then 1 else -1) b",
" -1 < 0",
" normalize z = z",
" normalize z = -z",
" normalize 0 = -0"
] |
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.Algebra.GradedMonoid
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous
import Mathlib.Algebra.Polynomial.Roots
#align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
namespace MvPolynomial
variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*}
def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i
theorem weightedDegree_one (d : σ →₀ ℕ) :
weightedDegree 1 d = degree d := by
simp [weightedDegree, degree, Finsupp.total, Finsupp.sum]
def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) :=
IsWeightedHomogeneous 1 φ n
#align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous
variable [CommSemiring R]
theorem weightedTotalDegree_one (φ : MvPolynomial σ R) :
weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by
simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe,
Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe,
id, Algebra.id.smul_eq_mul, mul_one]
variable (σ R)
def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where
carrier := { x | x.IsHomogeneous n }
smul_mem' r a ha c hc := by
rw [coeff_smul] at hc
apply ha
intro h
apply hc
rw [h]
exact smul_zero r
zero_mem' d hd := False.elim (hd <| coeff_zero _)
add_mem' {a b} ha hb c hc := by
rw [coeff_add] at hc
obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by
contrapose! hc
simp only [hc, add_zero]
· exact ha h
· exact hb h
#align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule
@[simp]
lemma weightedHomogeneousSubmodule_one (n : ℕ) :
weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl
variable {σ R}
@[simp]
theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) :
p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl
#align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule
variable (σ R)
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by
simp_rw [← weightedDegree_one]
exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
#align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported
variable {σ R}
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) :=
weightedHomogeneousSubmodule_mul 1 m n
#align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul
section
variable [CommSemiring R]
| Mathlib/RingTheory/MvPolynomial/Homogeneous.lean | 116 | 119 | theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) :
IsHomogeneous (monomial d r) n := by |
simp_rw [← weightedDegree_one] at hn
exact isWeightedHomogeneous_monomial 1 d r hn
| [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 φ = φ.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a ≠ 0 ∨ coeff c b ≠ 0",
" coeff c a + coeff c b = 0",
" coeff c a ≠ 0",
" False",
" r • coeff c a = 0",
" r • 0 = 0",
" homogeneousSubmodule σ R n = Finsupp.supported R R {d | deg... | [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 φ = φ.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a ≠ 0 ∨ coeff c b ≠ 0",
" coeff c a + coeff c b = 0",
" coeff c a ≠ 0",
" False",
" r • coeff c a = 0",
" r • 0 = 0",
" homogeneousSubmodule σ R n = Finsupp.supported R R {d | deg... |
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c"
variable {ι : Type*} [Fintype ι]
variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R)
variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤)
open Polynomial Matrix
def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M :=
(LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap
#align pi_to_module.from_matrix PiToModule.fromMatrix
theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) :
PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) :=
rfl
#align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply
| Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean | 43 | 46 | theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) :
PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by |
rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single]
simp_rw [mul_one]
| [
" ((fromMatrix R b) A) (Pi.single j 1) = ∑ i : ι, A i j • b i",
" ∑ i : ι, (fun i => A i j * 1) i • b i = ∑ i : ι, A i j • b i"
] | [] |
import Mathlib.Topology.Order.ProjIcc
import Mathlib.Topology.ContinuousFunction.Ordered
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.UnitInterval
#align_import topology.homotopy.basic from "leanprover-community/mathlib"@"11c53f174270aa43140c0b26dabce5fc4a253e80"
noncomputable section
universe u v w x
variable {F : Type*} {X : Type u} {Y : Type v} {Z : Type w} {Z' : Type x} {ι : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [TopologicalSpace Z']
open unitInterval
namespace ContinuousMap
structure Homotopy (f₀ f₁ : C(X, Y)) extends C(I × X, Y) where
map_zero_left : ∀ x, toFun (0, x) = f₀ x
map_one_left : ∀ x, toFun (1, x) = f₁ x
#align continuous_map.homotopy ContinuousMap.Homotopy
section
class HomotopyLike {X Y : outParam Type*} [TopologicalSpace X] [TopologicalSpace Y]
(F : Type*) (f₀ f₁ : outParam <| C(X, Y)) [FunLike F (I × X) Y]
extends ContinuousMapClass F (I × X) Y : Prop where
map_zero_left (f : F) : ∀ x, f (0, x) = f₀ x
map_one_left (f : F) : ∀ x, f (1, x) = f₁ x
#align continuous_map.homotopy_like ContinuousMap.HomotopyLike
end
namespace Homotopy
section
variable {f₀ f₁ : C(X, Y)}
instance instFunLike : FunLike (Homotopy f₀ f₁) (I × X) Y where
coe f := f.toFun
coe_injective' f g h := by
obtain ⟨⟨_, _⟩, _⟩ := f
obtain ⟨⟨_, _⟩, _⟩ := g
congr
instance : HomotopyLike (Homotopy f₀ f₁) f₀ f₁ where
map_continuous f := f.continuous_toFun
map_zero_left f := f.map_zero_left
map_one_left f := f.map_one_left
@[ext]
theorem ext {F G : Homotopy f₀ f₁} (h : ∀ x, F x = G x) : F = G :=
DFunLike.ext _ _ h
#align continuous_map.homotopy.ext ContinuousMap.Homotopy.ext
def Simps.apply (F : Homotopy f₀ f₁) : I × X → Y :=
F
#align continuous_map.homotopy.simps.apply ContinuousMap.Homotopy.Simps.apply
initialize_simps_projections Homotopy (toFun → apply, -toContinuousMap)
protected theorem continuous (F : Homotopy f₀ f₁) : Continuous F :=
F.continuous_toFun
#align continuous_map.homotopy.continuous ContinuousMap.Homotopy.continuous
@[simp]
theorem apply_zero (F : Homotopy f₀ f₁) (x : X) : F (0, x) = f₀ x :=
F.map_zero_left x
#align continuous_map.homotopy.apply_zero ContinuousMap.Homotopy.apply_zero
@[simp]
theorem apply_one (F : Homotopy f₀ f₁) (x : X) : F (1, x) = f₁ x :=
F.map_one_left x
#align continuous_map.homotopy.apply_one ContinuousMap.Homotopy.apply_one
@[simp]
theorem coe_toContinuousMap (F : Homotopy f₀ f₁) : ⇑F.toContinuousMap = F :=
rfl
#align continuous_map.homotopy.coe_to_continuous_map ContinuousMap.Homotopy.coe_toContinuousMap
def curry (F : Homotopy f₀ f₁) : C(I, C(X, Y)) :=
F.toContinuousMap.curry
#align continuous_map.homotopy.curry ContinuousMap.Homotopy.curry
@[simp]
theorem curry_apply (F : Homotopy f₀ f₁) (t : I) (x : X) : F.curry t x = F (t, x) :=
rfl
#align continuous_map.homotopy.curry_apply ContinuousMap.Homotopy.curry_apply
def extend (F : Homotopy f₀ f₁) : C(ℝ, C(X, Y)) :=
F.curry.IccExtend zero_le_one
#align continuous_map.homotopy.extend ContinuousMap.Homotopy.extend
| Mathlib/Topology/Homotopy/Basic.lean | 166 | 169 | theorem extend_apply_of_le_zero (F : Homotopy f₀ f₁) {t : ℝ} (ht : t ≤ 0) (x : X) :
F.extend t x = f₀ x := by |
rw [← F.apply_zero]
exact ContinuousMap.congr_fun (Set.IccExtend_of_le_left (zero_le_one' ℝ) F.curry ht) x
| [
" f = g",
" { toFun := toFun✝, continuous_toFun := continuous_toFun✝, map_zero_left := map_zero_left✝,\n map_one_left := map_one_left✝ } =\n g",
" { toFun := toFun✝¹, continuous_toFun := continuous_toFun✝¹, map_zero_left := map_zero_left✝¹,\n map_one_left := map_one_left✝¹ } =\n { toFun := toFun... | [
" f = g",
" { toFun := toFun✝, continuous_toFun := continuous_toFun✝, map_zero_left := map_zero_left✝,\n map_one_left := map_one_left✝ } =\n g",
" { toFun := toFun✝¹, continuous_toFun := continuous_toFun✝¹, map_zero_left := map_zero_left✝¹,\n map_one_left := map_one_left✝¹ } =\n { toFun := toFun... |
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
| Mathlib/Data/List/Intervals.lean | 76 | 77 | 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]
| [
" 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.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
namespace Matrix
universe u u' v
variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v}
open Matrix Equiv Equiv.Perm Finset
section Inv
variable [Fintype n] [DecidableEq n] [CommRing α]
variable (A : Matrix n n α) (B : Matrix n n α)
theorem isUnit_det_transpose (h : IsUnit A.det) : IsUnit Aᵀ.det := by
rw [det_transpose]
exact h
#align matrix.is_unit_det_transpose Matrix.isUnit_det_transpose
noncomputable instance inv : Inv (Matrix n n α) :=
⟨fun A => Ring.inverse A.det • A.adjugate⟩
theorem inv_def (A : Matrix n n α) : A⁻¹ = Ring.inverse A.det • A.adjugate :=
rfl
#align matrix.inv_def Matrix.inv_def
theorem nonsing_inv_apply_not_isUnit (h : ¬IsUnit A.det) : A⁻¹ = 0 := by
rw [inv_def, Ring.inverse_non_unit _ h, zero_smul]
#align matrix.nonsing_inv_apply_not_is_unit Matrix.nonsing_inv_apply_not_isUnit
| Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean | 225 | 226 | theorem nonsing_inv_apply (h : IsUnit A.det) : A⁻¹ = (↑h.unit⁻¹ : α) • A.adjugate := by |
rw [inv_def, ← Ring.inverse_unit h.unit, IsUnit.unit_spec]
| [
" IsUnit Aᵀ.det",
" IsUnit A.det",
" A⁻¹ = 0",
" A⁻¹ = ↑h.unit⁻¹ • A.adjugate"
] | [
" IsUnit Aᵀ.det",
" IsUnit A.det",
" A⁻¹ = 0"
] |
import Mathlib.Geometry.Manifold.MFDeriv.FDeriv
noncomputable section
open scoped Manifold
open Bundle Set Topology
section SpecificFunctions
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E'']
{H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*}
[TopologicalSpace M''] [ChartedSpace H'' M''] [SmoothManifoldWithCorners I'' M'']
variable {s : Set M} {x : M}
section id
theorem hasMFDerivAt_id (x : M) :
HasMFDerivAt I I (@id M) x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) := by
refine ⟨continuousAt_id, ?_⟩
have : ∀ᶠ y in 𝓝[range I] (extChartAt I x) x, (extChartAt I x ∘ (extChartAt I x).symm) y = y := by
apply Filter.mem_of_superset (extChartAt_target_mem_nhdsWithin I x)
mfld_set_tac
apply HasFDerivWithinAt.congr_of_eventuallyEq (hasFDerivWithinAt_id _ _) this
simp only [mfld_simps]
#align has_mfderiv_at_id hasMFDerivAt_id
theorem hasMFDerivWithinAt_id (s : Set M) (x : M) :
HasMFDerivWithinAt I I (@id M) s x (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) :=
(hasMFDerivAt_id I x).hasMFDerivWithinAt
#align has_mfderiv_within_at_id hasMFDerivWithinAt_id
theorem mdifferentiableAt_id : MDifferentiableAt I I (@id M) x :=
(hasMFDerivAt_id I x).mdifferentiableAt
#align mdifferentiable_at_id mdifferentiableAt_id
theorem mdifferentiableWithinAt_id : MDifferentiableWithinAt I I (@id M) s x :=
(mdifferentiableAt_id I).mdifferentiableWithinAt
#align mdifferentiable_within_at_id mdifferentiableWithinAt_id
theorem mdifferentiable_id : MDifferentiable I I (@id M) := fun _ => mdifferentiableAt_id I
#align mdifferentiable_id mdifferentiable_id
theorem mdifferentiableOn_id : MDifferentiableOn I I (@id M) s :=
(mdifferentiable_id I).mdifferentiableOn
#align mdifferentiable_on_id mdifferentiableOn_id
@[simp, mfld_simps]
theorem mfderiv_id : mfderiv I I (@id M) x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) :=
HasMFDerivAt.mfderiv (hasMFDerivAt_id I x)
#align mfderiv_id mfderiv_id
theorem mfderivWithin_id (hxs : UniqueMDiffWithinAt I s x) :
mfderivWithin I I (@id M) s x = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
rw [MDifferentiable.mfderivWithin (mdifferentiableAt_id I) hxs]
exact mfderiv_id I
#align mfderiv_within_id mfderivWithin_id
@[simp, mfld_simps]
| Mathlib/Geometry/Manifold/MFDeriv/SpecificFunctions.lean | 164 | 164 | theorem tangentMap_id : tangentMap I I (id : M → M) = id := by | ext1 ⟨x, v⟩; simp [tangentMap]
| [
" HasMFDerivAt I I id x (ContinuousLinearMap.id 𝕜 (TangentSpace I x))",
" HasFDerivWithinAt (writtenInExtChartAt I I x id) (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) (range ↑I)\n (↑(extChartAt I x) x)",
" ∀ᶠ (y : E) in 𝓝[range ↑I] ↑(extChartAt I x) x, (↑(extChartAt I x) ∘ ↑(extChartAt I x).symm) y = y"... | [
" HasMFDerivAt I I id x (ContinuousLinearMap.id 𝕜 (TangentSpace I x))",
" HasFDerivWithinAt (writtenInExtChartAt I I x id) (ContinuousLinearMap.id 𝕜 (TangentSpace I x)) (range ↑I)\n (↑(extChartAt I x) x)",
" ∀ᶠ (y : E) in 𝓝[range ↑I] ↑(extChartAt I x) x, (↑(extChartAt I x) ∘ ↑(extChartAt I x).symm) y = y"... |
import Mathlib.Order.Filter.Partial
import Mathlib.Topology.Basic
#align_import topology.partial from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Filter
open Topology
variable {X Y : Type*} [TopologicalSpace X]
theorem rtendsto_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.core s ∈ l :=
all_mem_nhds_filter _ _ (fun _s _t => id) _
#align rtendsto_nhds rtendsto_nhds
theorem rtendsto'_nhds {r : Rel Y X} {l : Filter Y} {x : X} :
RTendsto' r l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → r.preimage s ∈ l := by
rw [rtendsto'_def]
apply all_mem_nhds_filter
apply Rel.preimage_mono
#align rtendsto'_nhds rtendsto'_nhds
theorem ptendsto_nhds {f : Y →. X} {l : Filter Y} {x : X} :
PTendsto f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.core s ∈ l :=
rtendsto_nhds
#align ptendsto_nhds ptendsto_nhds
theorem ptendsto'_nhds {f : Y →. X} {l : Filter Y} {x : X} :
PTendsto' f l (𝓝 x) ↔ ∀ s, IsOpen s → x ∈ s → f.preimage s ∈ l :=
rtendsto'_nhds
#align ptendsto'_nhds ptendsto'_nhds
variable [TopologicalSpace Y]
def PContinuous (f : X →. Y) :=
∀ s, IsOpen s → IsOpen (f.preimage s)
#align pcontinuous PContinuous
| Mathlib/Topology/Partial.lean | 57 | 58 | theorem open_dom_of_pcontinuous {f : X →. Y} (h : PContinuous f) : IsOpen f.Dom := by |
rw [← PFun.preimage_univ]; exact h _ isOpen_univ
| [
" RTendsto' r l (𝓝 x) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" (∀ s ∈ 𝓝 x, r.preimage s ∈ l) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" ∀ (s t : Set X), s ⊆ t → r.preimage s ⊆ r.preimage t",
" IsOpen f.Dom",
" IsOpen (f.preimage Set.univ)"
] | [
" RTendsto' r l (𝓝 x) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" (∀ s ∈ 𝓝 x, r.preimage s ∈ l) ↔ ∀ (s : Set X), IsOpen s → x ∈ s → r.preimage s ∈ l",
" ∀ (s t : Set X), s ⊆ t → r.preimage s ⊆ r.preimage t"
] |
import Mathlib.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 [Semiring R] [NoZeroDivisors R] {p q : R[X]}
instance : NoZeroDivisors R[X] where
eq_zero_or_eq_zero_of_mul_eq_zero h := by
rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero]
refine eq_zero_or_eq_zero_of_mul_eq_zero ?_
rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq),
Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
#align polynomial.nat_degree_mul Polynomial.natDegree_mul
theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by
by_cases hp : p = 0
· rw [hp, zero_mul, trailingDegree_zero, top_add]
by_cases hq : q = 0
· rw [hq, mul_zero, trailingDegree_zero, add_top]
· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq,
trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq]
apply WithTop.coe_add
#align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul
@[simp]
theorem natDegree_pow (p : R[X]) (n : ℕ) : natDegree (p ^ n) = n * natDegree p := by
classical
obtain rfl | hp := eq_or_ne p 0
· obtain rfl | hn := eq_or_ne n 0 <;> simp [*]
exact natDegree_pow' $ by
rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp
#align polynomial.nat_degree_pow Polynomial.natDegree_pow
theorem degree_le_mul_left (p : R[X]) (hq : q ≠ 0) : degree p ≤ degree (p * q) := by
classical
exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl]
else by
rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq];
exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _)
#align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left
theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q ≠ 0) : p.natDegree ≤ q.natDegree := by
rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2
rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _
#align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd
theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q ≠ 0) : degree p ≤ degree q := by
rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2
exact degree_le_mul_left p h2.2
#align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd
theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (h₂ : degree q < degree p) :
q = 0 := by
by_contra hc
exact (lt_iff_not_ge _ _).mp h₂ (degree_le_of_dvd h₁ hc)
#align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt
theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (h₂ : natDegree q < natDegree p) :
q = 0 := by
by_contra hc
exact (lt_iff_not_ge _ _).mp h₂ (natDegree_le_of_dvd h₁ hc)
#align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt
theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q ≠ 0) (hl : q.degree < p.degree) : ¬p ∣ q := by
by_contra hcontra
exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl)
#align polynomial.not_dvd_of_degree_lt Polynomial.not_dvd_of_degree_lt
| Mathlib/Algebra/Polynomial/RingDivision.lean | 183 | 186 | theorem not_dvd_of_natDegree_lt {p q : R[X]} (h0 : q ≠ 0) (hl : q.natDegree < p.natDegree) :
¬p ∣ q := by |
by_contra hcontra
exact h0 (eq_zero_of_dvd_of_natDegree_lt hcontra hl)
| [
" a✝ = 0 ∨ b✝ = 0",
" a✝.leadingCoeff = 0 ∨ b✝.leadingCoeff = 0",
" a✝.leadingCoeff * b✝.leadingCoeff = 0",
" (p * q).natDegree = p.natDegree + q.natDegree",
" (p * q).trailingDegree = p.trailingDegree + q.trailingDegree",
" ↑(p.natTrailingDegree + q.natTrailingDegree) = ↑p.natTrailingDegree + ↑q.natTrail... | [
" a✝ = 0 ∨ b✝ = 0",
" a✝.leadingCoeff = 0 ∨ b✝.leadingCoeff = 0",
" a✝.leadingCoeff * b✝.leadingCoeff = 0",
" (p * q).natDegree = p.natDegree + q.natDegree",
" (p * q).trailingDegree = p.trailingDegree + q.trailingDegree",
" ↑(p.natTrailingDegree + q.natTrailingDegree) = ↑p.natTrailingDegree + ↑q.natTrail... |
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.finset_ops from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
namespace Multiset
open List
variable {α : Type*} [DecidableEq α] {s : Multiset α}
def ndinsert (a : α) (s : Multiset α) : Multiset α :=
Quot.liftOn s (fun l => (l.insert a : Multiset α)) fun _ _ p => Quot.sound (p.insert a)
#align multiset.ndinsert Multiset.ndinsert
@[simp]
theorem coe_ndinsert (a : α) (l : List α) : ndinsert a l = (insert a l : List α) :=
rfl
#align multiset.coe_ndinsert Multiset.coe_ndinsert
@[simp, nolint simpNF] -- Porting note (#10675): dsimp can not prove this
theorem ndinsert_zero (a : α) : ndinsert a 0 = {a} :=
rfl
#align multiset.ndinsert_zero Multiset.ndinsert_zero
@[simp]
theorem ndinsert_of_mem {a : α} {s : Multiset α} : a ∈ s → ndinsert a s = s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_mem h
#align multiset.ndinsert_of_mem Multiset.ndinsert_of_mem
@[simp]
theorem ndinsert_of_not_mem {a : α} {s : Multiset α} : a ∉ s → ndinsert a s = a ::ₘ s :=
Quot.inductionOn s fun _ h => congr_arg ((↑) : List α → Multiset α) <| insert_of_not_mem h
#align multiset.ndinsert_of_not_mem Multiset.ndinsert_of_not_mem
@[simp]
theorem mem_ndinsert {a b : α} {s : Multiset α} : a ∈ ndinsert b s ↔ a = b ∨ a ∈ s :=
Quot.inductionOn s fun _ => mem_insert_iff
#align multiset.mem_ndinsert Multiset.mem_ndinsert
@[simp]
theorem le_ndinsert_self (a : α) (s : Multiset α) : s ≤ ndinsert a s :=
Quot.inductionOn s fun _ => (sublist_insert _ _).subperm
#align multiset.le_ndinsert_self Multiset.le_ndinsert_self
-- Porting note: removing @[simp], simp can prove it
theorem mem_ndinsert_self (a : α) (s : Multiset α) : a ∈ ndinsert a s :=
mem_ndinsert.2 (Or.inl rfl)
#align multiset.mem_ndinsert_self Multiset.mem_ndinsert_self
theorem mem_ndinsert_of_mem {a b : α} {s : Multiset α} (h : a ∈ s) : a ∈ ndinsert b s :=
mem_ndinsert.2 (Or.inr h)
#align multiset.mem_ndinsert_of_mem Multiset.mem_ndinsert_of_mem
@[simp]
| Mathlib/Data/Multiset/FinsetOps.lean | 74 | 75 | theorem length_ndinsert_of_mem {a : α} {s : Multiset α} (h : a ∈ s) :
card (ndinsert a s) = card s := by | simp [h]
| [
" card (ndinsert a s) = card s"
] | [] |
import Mathlib.Algebra.Group.Defs
import Mathlib.Algebra.GroupWithZero.Defs
import Mathlib.Data.Int.Cast.Defs
import Mathlib.Tactic.Spread
import Mathlib.Util.AssertExists
#align_import algebra.ring.defs from "leanprover-community/mathlib"@"76de8ae01554c3b37d66544866659ff174e66e1f"
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x}
open Function
class Distrib (R : Type*) extends Mul R, Add R where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align distrib Distrib
class LeftDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
#align left_distrib_class LeftDistribClass
class RightDistribClass (R : Type*) [Mul R] [Add R] : Prop where
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
#align right_distrib_class RightDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.leftDistribClass (R : Type*) [Distrib R] : LeftDistribClass R :=
⟨Distrib.left_distrib⟩
#align distrib.left_distrib_class Distrib.leftDistribClass
-- see Note [lower instance priority]
instance (priority := 100) Distrib.rightDistribClass (R : Type*) [Distrib R] :
RightDistribClass R :=
⟨Distrib.right_distrib⟩
#align distrib.right_distrib_class Distrib.rightDistribClass
theorem left_distrib [Mul R] [Add R] [LeftDistribClass R] (a b c : R) :
a * (b + c) = a * b + a * c :=
LeftDistribClass.left_distrib a b c
#align left_distrib left_distrib
alias mul_add := left_distrib
#align mul_add mul_add
theorem right_distrib [Mul R] [Add R] [RightDistribClass R] (a b c : R) :
(a + b) * c = a * c + b * c :=
RightDistribClass.right_distrib a b c
#align right_distrib right_distrib
alias add_mul := right_distrib
#align add_mul add_mul
| Mathlib/Algebra/Ring/Defs.lean | 94 | 95 | theorem distrib_three_right [Mul R] [Add R] [RightDistribClass R] (a b c d : R) :
(a + b + c) * d = a * d + b * d + c * d := by | simp [right_distrib]
| [
" (a + b + c) * d = a * d + b * d + c * d"
] | [] |
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Localization.AtPrime
import Mathlib.Order.Minimal
#align_import ring_theory.ideal.minimal_prime from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
section
variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R)
protected def Ideal.minimalPrimes : Set (Ideal R) :=
minimals (· ≤ ·) { p | p.IsPrime ∧ I ≤ p }
#align ideal.minimal_primes Ideal.minimalPrimes
variable (R) in
def minimalPrimes : Set (Ideal R) :=
Ideal.minimalPrimes ⊥
#align minimal_primes minimalPrimes
lemma minimalPrimes_eq_minimals : minimalPrimes R = minimals (· ≤ ·) (setOf Ideal.IsPrime) :=
congr_arg (minimals (· ≤ ·)) (by simp)
variable {I J}
theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by
suffices
∃ m ∈ { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ OrderDual.ofDual p },
OrderDual.toDual J ≤ m ∧ ∀ z ∈ { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ p }, m ≤ z → z = m by
obtain ⟨p, h₁, h₂, h₃⟩ := this
simp_rw [← @eq_comm _ p] at h₃
exact ⟨p, ⟨h₁, fun a b c => le_of_eq (h₃ a b c)⟩, h₂⟩
apply zorn_nonempty_partialOrder₀
swap
· refine ⟨show J.IsPrime by infer_instance, e⟩
rintro (c : Set (Ideal R)) hc hc' J' hJ'
refine
⟨OrderDual.toDual (sInf c),
⟨Ideal.sInf_isPrime_of_isChain ⟨J', hJ'⟩ hc'.symm fun x hx => (hc hx).1, ?_⟩, ?_⟩
· rw [OrderDual.ofDual_toDual, le_sInf_iff]
exact fun _ hx => (hc hx).2
· rintro z hz
rw [OrderDual.le_toDual]
exact sInf_le hz
#align ideal.exists_minimal_primes_le Ideal.exists_minimalPrimes_le
@[simp]
theorem Ideal.radical_minimalPrimes : I.radical.minimalPrimes = I.minimalPrimes := by
rw [Ideal.minimalPrimes, Ideal.minimalPrimes]
ext p
refine ⟨?_, ?_⟩ <;> rintro ⟨⟨a, ha⟩, b⟩
· refine ⟨⟨a, a.radical_le_iff.1 ha⟩, ?_⟩
simp only [Set.mem_setOf_eq, and_imp] at *
exact fun _ h2 h3 h4 => b h2 (h2.radical_le_iff.2 h3) h4
· refine ⟨⟨a, a.radical_le_iff.2 ha⟩, ?_⟩
simp only [Set.mem_setOf_eq, and_imp] at *
exact fun _ h2 h3 h4 => b h2 (h2.radical_le_iff.1 h3) h4
#align ideal.radical_minimal_primes Ideal.radical_minimalPrimes
@[simp]
theorem Ideal.sInf_minimalPrimes : sInf I.minimalPrimes = I.radical := by
rw [I.radical_eq_sInf]
apply le_antisymm
· intro x hx
rw [Ideal.mem_sInf] at hx ⊢
rintro J ⟨e, hJ⟩
obtain ⟨p, hp, hp'⟩ := Ideal.exists_minimalPrimes_le e
exact hp' (hx hp)
· apply sInf_le_sInf _
intro I hI
exact hI.1.symm
#align ideal.Inf_minimal_primes Ideal.sInf_minimalPrimes
| Mathlib/RingTheory/Ideal/MinimalPrime.lean | 104 | 125 | theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S}
(hf : Function.Injective f) (p) (H : p ∈ minimalPrimes R) :
∃ p' : Ideal S, p'.IsPrime ∧ p'.comap f = p := by |
have := H.1.1
have : Nontrivial (Localization (Submonoid.map f p.primeCompl)) := by
refine ⟨⟨1, 0, ?_⟩⟩
convert (IsLocalization.map_injective_of_injective p.primeCompl (Localization.AtPrime p)
(Localization <| p.primeCompl.map f) hf).ne one_ne_zero
· rw [map_one]
· rw [map_zero]
obtain ⟨M, hM⟩ := Ideal.exists_maximal (Localization (Submonoid.map f p.primeCompl))
refine ⟨M.comap (algebraMap S <| Localization (Submonoid.map f p.primeCompl)), inferInstance, ?_⟩
rw [Ideal.comap_comap, ← @IsLocalization.map_comp _ _ _ _ _ _ _ _ Localization.isLocalization
_ _ _ _ p.primeCompl.le_comap_map _ Localization.isLocalization,
← Ideal.comap_comap]
suffices _ ≤ p by exact this.antisymm (H.2 ⟨inferInstance, bot_le⟩ this)
intro x hx
by_contra h
apply hM.ne_top
apply M.eq_top_of_isUnit_mem hx
apply IsUnit.map
apply IsLocalization.map_units _ (show p.primeCompl from ⟨x, h⟩)
| [
" {p | p.IsPrime ∧ ⊥ ≤ p} = setOf Ideal.IsPrime",
" ∃ p ∈ I.minimalPrimes, p ≤ J",
" ∃ m ∈ {p | IsPrime p ∧ I ≤ OrderDual.ofDual p}, OrderDual.toDual J ≤ m ∧ ∀ z ∈ {p | IsPrime p ∧ I ≤ p}, m ≤ z → z = m",
" OrderDual.toDual J ∈ {p | IsPrime p ∧ I ≤ OrderDual.ofDual p}",
" J.IsPrime",
" ∀ c ⊆ {p | IsPrime ... | [
" {p | p.IsPrime ∧ ⊥ ≤ p} = setOf Ideal.IsPrime",
" ∃ p ∈ I.minimalPrimes, p ≤ J",
" ∃ m ∈ {p | IsPrime p ∧ I ≤ OrderDual.ofDual p}, OrderDual.toDual J ≤ m ∧ ∀ z ∈ {p | IsPrime p ∧ I ≤ p}, m ≤ z → z = m",
" OrderDual.toDual J ∈ {p | IsPrime p ∧ I ≤ OrderDual.ofDual p}",
" J.IsPrime",
" ∀ c ⊆ {p | IsPrime ... |
import Mathlib.MeasureTheory.Decomposition.SignedLebesgue
import Mathlib.MeasureTheory.Measure.WithDensityVectorMeasure
#align_import measure_theory.decomposition.radon_nikodym from "leanprover-community/mathlib"@"fc75855907eaa8ff39791039710f567f37d4556f"
noncomputable section
open scoped Classical MeasureTheory NNReal ENNReal
variable {α β : Type*} {m : MeasurableSpace α}
namespace MeasureTheory
namespace Measure
| Mathlib/MeasureTheory/Decomposition/RadonNikodym.lean | 56 | 66 | theorem withDensity_rnDeriv_eq (μ ν : Measure α) [HaveLebesgueDecomposition μ ν] (h : μ ≪ ν) :
ν.withDensity (rnDeriv μ ν) = μ := by |
suffices μ.singularPart ν = 0 by
conv_rhs => rw [haveLebesgueDecomposition_add μ ν, this, zero_add]
suffices μ.singularPart ν Set.univ = 0 by simpa using this
have h_sing := mutuallySingular_singularPart μ ν
rw [← measure_add_measure_compl h_sing.measurableSet_nullSet]
simp only [MutuallySingular.measure_nullSet, zero_add]
refine le_antisymm ?_ (zero_le _)
refine (singularPart_le μ ν ?_ ).trans_eq ?_
exact h h_sing.measure_compl_nullSet
| [
" ν.withDensity (μ.rnDeriv ν) = μ",
"α : Type u_1\nβ : Type u_2\nm : MeasurableSpace α\nμ ν : Measure α\ninst✝ : μ.HaveLebesgueDecomposition ν\nh : μ ≪ ν\nthis : μ.singularPart ν = 0\n| μ",
" μ.singularPart ν = 0",
" (μ.singularPart ν) Set.univ = 0",
" (μ.singularPart ν) h_sing.nullSet + (μ.singularPart ν) ... | [] |
import Mathlib.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
assert_not_exists Absorbs
noncomputable section
namespace Complex
variable {z : ℂ}
open ComplexConjugate Topology Filter
instance : Norm ℂ :=
⟨abs⟩
@[simp]
theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z :=
rfl
#align complex.norm_eq_abs Complex.norm_eq_abs
lemma norm_I : ‖I‖ = 1 := abs_I
theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I
instance instNormedAddCommGroup : NormedAddCommGroup ℂ :=
AddGroupNorm.toNormedAddCommGroup
{ abs with
map_zero' := map_zero abs
neg' := abs.map_neg
eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 }
instance : NormedField ℂ where
dist_eq _ _ := rfl
norm_mul' := map_mul abs
instance : DenselyNormedField ℂ where
lt_norm_lt r₁ r₂ h₀ hr :=
let ⟨x, h⟩ := exists_between hr
⟨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]⟩
instance {R : Type*} [NormedField R] [NormedAlgebra R ℝ] : NormedAlgebra R ℂ where
norm_smul_le r x := by
rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs,
norm_algebraMap']
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℂ E]
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace ℝ E :=
NormedSpace.restrictScalars ℝ ℂ E
#align normed_space.complex_to_real NormedSpace.complexToReal
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A]
[NormedAlgebra ℂ A] : NormedAlgebra ℝ A :=
NormedAlgebra.restrictScalars ℝ ℂ A
theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) :=
rfl
#align complex.dist_eq Complex.dist_eq
theorem dist_eq_re_im (z w : ℂ) : dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
rw [sq, sq]
rfl
#align complex.dist_eq_re_im Complex.dist_eq_re_im
@[simp]
theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) :
dist (mk x₁ y₁) (mk x₂ y₂) = √((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) :=
dist_eq_re_im _ _
#align complex.dist_mk Complex.dist_mk
theorem dist_of_re_eq {z w : ℂ} (h : z.re = w.re) : dist z w = dist z.im w.im := by
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq]
#align complex.dist_of_re_eq Complex.dist_of_re_eq
theorem nndist_of_re_eq {z w : ℂ} (h : z.re = w.re) : nndist z w = nndist z.im w.im :=
NNReal.eq <| dist_of_re_eq h
#align complex.nndist_of_re_eq Complex.nndist_of_re_eq
| Mathlib/Analysis/Complex/Basic.lean | 121 | 122 | theorem edist_of_re_eq {z w : ℂ} (h : z.re = w.re) : edist z w = edist z.im w.im := by |
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
| [
" ‖cexp (↑t * I)‖ = 1",
" r₁ < ‖↑x‖ ∧ ‖↑x‖ < r₂",
" ‖r • x‖ ≤ ‖r‖ * ‖x‖",
" dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)",
" dist z w = √((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))",
" dist z w = dist z.im w.im",
" edist z w = edist z.im w.im"
] | [
" ‖cexp (↑t * I)‖ = 1",
" r₁ < ‖↑x‖ ∧ ‖↑x‖ < r₂",
" ‖r • x‖ ≤ ‖r‖ * ‖x‖",
" dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)",
" dist z w = √((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))",
" dist z w = dist z.im w.im"
] |
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section EDist
variable [EDist α] {x y : α} {s t : Set α}
theorem le_einfsep_iff {d} :
d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by
simp_rw [einfsep, le_iInf_iff]
#align set.le_einfsep_iff Set.le_einfsep_iff
theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by
simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop]
#align set.einfsep_zero Set.einfsep_zero
theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by
rw [pos_iff_ne_zero, Ne, einfsep_zero]
simp only [not_forall, not_exists, not_lt, exists_prop, not_and]
#align set.einfsep_pos Set.einfsep_pos
theorem einfsep_top :
s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by
simp_rw [einfsep, iInf_eq_top]
#align set.einfsep_top Set.einfsep_top
| Mathlib/Topology/MetricSpace/Infsep.lean | 69 | 71 | theorem einfsep_lt_top :
s.einfsep < ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < ∞ := by |
simp_rw [einfsep, iInf_lt_iff, exists_prop]
| [
" d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y",
" s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C",
" 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" (¬∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C) ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" s... | [
" d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y",
" s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C",
" 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" (¬∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C) ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y",
" s... |
import Mathlib.Algebra.Group.Units.Equiv
import Mathlib.CategoryTheory.Endomorphism
#align_import category_theory.conj from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
universe v u
namespace CategoryTheory
namespace Iso
variable {C : Type u} [Category.{v} C]
def homCongr {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) : (X ⟶ Y) ≃ (X₁ ⟶ Y₁) where
toFun f := α.inv ≫ f ≫ β.hom
invFun f := α.hom ≫ f ≫ β.inv
left_inv f :=
show α.hom ≫ (α.inv ≫ f ≫ β.hom) ≫ β.inv = f by
rw [Category.assoc, Category.assoc, β.hom_inv_id, α.hom_inv_id_assoc, Category.comp_id]
right_inv f :=
show α.inv ≫ (α.hom ≫ f ≫ β.inv) ≫ β.hom = f by
rw [Category.assoc, Category.assoc, β.inv_hom_id, α.inv_hom_id_assoc, Category.comp_id]
#align category_theory.iso.hom_congr CategoryTheory.Iso.homCongr
-- @[simp, nolint simpNF] Porting note (#10675): dsimp can not prove this
@[simp]
theorem homCongr_apply {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (f : X ⟶ Y) :
α.homCongr β f = α.inv ≫ f ≫ β.hom := by
rfl
#align category_theory.iso.hom_congr_apply CategoryTheory.Iso.homCongr_apply
theorem homCongr_comp {X Y Z X₁ Y₁ Z₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (γ : Z ≅ Z₁) (f : X ⟶ Y)
(g : Y ⟶ Z) : α.homCongr γ (f ≫ g) = α.homCongr β f ≫ β.homCongr γ g := by simp
#align category_theory.iso.hom_congr_comp CategoryTheory.Iso.homCongr_comp
| Mathlib/CategoryTheory/Conj.lean | 60 | 60 | theorem homCongr_refl {X Y : C} (f : X ⟶ Y) : (Iso.refl X).homCongr (Iso.refl Y) f = f := by | simp
| [
" α.hom ≫ (α.inv ≫ f ≫ β.hom) ≫ β.inv = f",
" α.inv ≫ (α.hom ≫ f ≫ β.inv) ≫ β.hom = f",
" (α.homCongr β) f = α.inv ≫ f ≫ β.hom",
" (α.homCongr γ) (f ≫ g) = (α.homCongr β) f ≫ (β.homCongr γ) g",
" ((refl X).homCongr (refl Y)) f = f"
] | [
" α.hom ≫ (α.inv ≫ f ≫ β.hom) ≫ β.inv = f",
" α.inv ≫ (α.hom ≫ f ≫ β.inv) ≫ β.hom = f",
" (α.homCongr β) f = α.inv ≫ f ≫ β.hom",
" (α.homCongr γ) (f ≫ g) = (α.homCongr β) f ≫ (β.homCongr γ) g"
] |
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Data.Finset.Fold
import Mathlib.Data.Finset.Option
import Mathlib.Data.Finset.Pi
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Multiset.Lattice
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Hom.Lattice
import Mathlib.Order.Nat
#align_import data.finset.lattice from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
open Function Multiset OrderDual
variable {F α β γ ι κ : Type*}
namespace Finset
section Sup
-- TODO: define with just `[Bot α]` where some lemmas hold without requiring `[OrderBot α]`
variable [SemilatticeSup α] [OrderBot α]
def sup (s : Finset β) (f : β → α) : α :=
s.fold (· ⊔ ·) ⊥ f
#align finset.sup Finset.sup
variable {s s₁ s₂ : Finset β} {f g : β → α} {a : α}
theorem sup_def : s.sup f = (s.1.map f).sup :=
rfl
#align finset.sup_def Finset.sup_def
@[simp]
theorem sup_empty : (∅ : Finset β).sup f = ⊥ :=
fold_empty
#align finset.sup_empty Finset.sup_empty
@[simp]
theorem sup_cons {b : β} (h : b ∉ s) : (cons b s h).sup f = f b ⊔ s.sup f :=
fold_cons h
#align finset.sup_cons Finset.sup_cons
@[simp]
theorem sup_insert [DecidableEq β] {b : β} : (insert b s : Finset β).sup f = f b ⊔ s.sup f :=
fold_insert_idem
#align finset.sup_insert Finset.sup_insert
@[simp]
theorem sup_image [DecidableEq β] (s : Finset γ) (f : γ → β) (g : β → α) :
(s.image f).sup g = s.sup (g ∘ f) :=
fold_image_idem
#align finset.sup_image Finset.sup_image
@[simp]
theorem sup_map (s : Finset γ) (f : γ ↪ β) (g : β → α) : (s.map f).sup g = s.sup (g ∘ f) :=
fold_map
#align finset.sup_map Finset.sup_map
@[simp]
theorem sup_singleton {b : β} : ({b} : Finset β).sup f = f b :=
Multiset.sup_singleton
#align finset.sup_singleton Finset.sup_singleton
theorem sup_sup : s.sup (f ⊔ g) = s.sup f ⊔ s.sup g := by
induction s using Finset.cons_induction with
| empty => rw [sup_empty, sup_empty, sup_empty, bot_sup_eq]
| cons _ _ _ ih =>
rw [sup_cons, sup_cons, sup_cons, ih]
exact sup_sup_sup_comm _ _ _ _
#align finset.sup_sup Finset.sup_sup
theorem sup_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) :
s₁.sup f = s₂.sup g := by
subst hs
exact Finset.fold_congr hfg
#align finset.sup_congr Finset.sup_congr
@[simp]
theorem _root_.map_finset_sup [SemilatticeSup β] [OrderBot β]
[FunLike F α β] [SupBotHomClass F α β]
(f : F) (s : Finset ι) (g : ι → α) : f (s.sup g) = s.sup (f ∘ g) :=
Finset.cons_induction_on s (map_bot f) fun i s _ h => by
rw [sup_cons, sup_cons, map_sup, h, Function.comp_apply]
#align map_finset_sup map_finset_sup
@[simp]
protected theorem sup_le_iff {a : α} : s.sup f ≤ a ↔ ∀ b ∈ s, f b ≤ a := by
apply Iff.trans Multiset.sup_le
simp only [Multiset.mem_map, and_imp, exists_imp]
exact ⟨fun k b hb => k _ _ hb rfl, fun k a' b hb h => h ▸ k _ hb⟩
#align finset.sup_le_iff Finset.sup_le_iff
protected alias ⟨_, sup_le⟩ := Finset.sup_le_iff
#align finset.sup_le Finset.sup_le
theorem sup_const_le : (s.sup fun _ => a) ≤ a :=
Finset.sup_le fun _ _ => le_rfl
#align finset.sup_const_le Finset.sup_const_le
theorem le_sup {b : β} (hb : b ∈ s) : f b ≤ s.sup f :=
Finset.sup_le_iff.1 le_rfl _ hb
#align finset.le_sup Finset.le_sup
theorem le_sup_of_le {b : β} (hb : b ∈ s) (h : a ≤ f b) : a ≤ s.sup f := h.trans <| le_sup hb
#align finset.le_sup_of_le Finset.le_sup_of_le
theorem sup_union [DecidableEq β] : (s₁ ∪ s₂).sup f = s₁.sup f ⊔ s₂.sup f :=
eq_of_forall_ge_iff fun c => by simp [or_imp, forall_and]
#align finset.sup_union Finset.sup_union
@[simp]
theorem sup_biUnion [DecidableEq β] (s : Finset γ) (t : γ → Finset β) :
(s.biUnion t).sup f = s.sup fun x => (t x).sup f :=
eq_of_forall_ge_iff fun c => by simp [@forall_swap _ β]
#align finset.sup_bUnion Finset.sup_biUnion
theorem sup_const {s : Finset β} (h : s.Nonempty) (c : α) : (s.sup fun _ => c) = c :=
eq_of_forall_ge_iff (fun _ => Finset.sup_le_iff.trans h.forall_const)
#align finset.sup_const Finset.sup_const
@[simp]
| Mathlib/Data/Finset/Lattice.lean | 140 | 143 | theorem sup_bot (s : Finset β) : (s.sup fun _ => ⊥) = (⊥ : α) := by |
obtain rfl | hs := s.eq_empty_or_nonempty
· exact sup_empty
· exact sup_const hs _
| [
" s.sup (f ⊔ g) = s.sup f ⊔ s.sup g",
" ∅.sup (f ⊔ g) = ∅.sup f ⊔ ∅.sup g",
" (cons a✝ s✝ h✝).sup (f ⊔ g) = (cons a✝ s✝ h✝).sup f ⊔ (cons a✝ s✝ h✝).sup g",
" (f ⊔ g) a✝ ⊔ (s✝.sup f ⊔ s✝.sup g) = f a✝ ⊔ s✝.sup f ⊔ (g a✝ ⊔ s✝.sup g)",
" s₁.sup f = s₂.sup g",
" s₁.sup f = s₁.sup g",
" f ((cons i s x✝).sup ... | [
" s.sup (f ⊔ g) = s.sup f ⊔ s.sup g",
" ∅.sup (f ⊔ g) = ∅.sup f ⊔ ∅.sup g",
" (cons a✝ s✝ h✝).sup (f ⊔ g) = (cons a✝ s✝ h✝).sup f ⊔ (cons a✝ s✝ h✝).sup g",
" (f ⊔ g) a✝ ⊔ (s✝.sup f ⊔ s✝.sup g) = f a✝ ⊔ s✝.sup f ⊔ (g a✝ ⊔ s✝.sup g)",
" s₁.sup f = s₂.sup g",
" s₁.sup f = s₁.sup g",
" f ((cons i s x✝).sup ... |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.Group.Submonoid.Basic
import Mathlib.Deprecated.Group
#align_import deprecated.submonoid from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
variable {M : Type*} [Monoid M] {s : Set M}
variable {A : Type*} [AddMonoid A] {t : Set A}
structure IsAddSubmonoid (s : Set A) : Prop where
zero_mem : (0 : A) ∈ s
add_mem {a b} : a ∈ s → b ∈ s → a + b ∈ s
#align is_add_submonoid IsAddSubmonoid
@[to_additive]
structure IsSubmonoid (s : Set M) : Prop where
one_mem : (1 : M) ∈ s
mul_mem {a b} : a ∈ s → b ∈ s → a * b ∈ s
#align is_submonoid IsSubmonoid
theorem Additive.isAddSubmonoid {s : Set M} :
IsSubmonoid s → @IsAddSubmonoid (Additive M) _ s
| ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩
#align additive.is_add_submonoid Additive.isAddSubmonoid
theorem Additive.isAddSubmonoid_iff {s : Set M} :
@IsAddSubmonoid (Additive M) _ s ↔ IsSubmonoid s :=
⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Additive.isAddSubmonoid⟩
#align additive.is_add_submonoid_iff Additive.isAddSubmonoid_iff
theorem Multiplicative.isSubmonoid {s : Set A} :
IsAddSubmonoid s → @IsSubmonoid (Multiplicative A) _ s
| ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩
#align multiplicative.is_submonoid Multiplicative.isSubmonoid
theorem Multiplicative.isSubmonoid_iff {s : Set A} :
@IsSubmonoid (Multiplicative A) _ s ↔ IsAddSubmonoid s :=
⟨fun ⟨h₁, h₂⟩ => ⟨h₁, @h₂⟩, Multiplicative.isSubmonoid⟩
#align multiplicative.is_submonoid_iff Multiplicative.isSubmonoid_iff
@[to_additive
"The intersection of two `AddSubmonoid`s of an `AddMonoid` `M` is an `AddSubmonoid` of M."]
theorem IsSubmonoid.inter {s₁ s₂ : Set M} (is₁ : IsSubmonoid s₁) (is₂ : IsSubmonoid s₂) :
IsSubmonoid (s₁ ∩ s₂) :=
{ one_mem := ⟨is₁.one_mem, is₂.one_mem⟩
mul_mem := @fun _ _ hx hy => ⟨is₁.mul_mem hx.1 hy.1, is₂.mul_mem hx.2 hy.2⟩ }
#align is_submonoid.inter IsSubmonoid.inter
#align is_add_submonoid.inter IsAddSubmonoid.inter
@[to_additive
"The intersection of an indexed set of `AddSubmonoid`s of an `AddMonoid` `M` is
an `AddSubmonoid` of `M`."]
theorem IsSubmonoid.iInter {ι : Sort*} {s : ι → Set M} (h : ∀ y : ι, IsSubmonoid (s y)) :
IsSubmonoid (Set.iInter s) :=
{ one_mem := Set.mem_iInter.2 fun y => (h y).one_mem
mul_mem := fun h₁ h₂ =>
Set.mem_iInter.2 fun y => (h y).mul_mem (Set.mem_iInter.1 h₁ y) (Set.mem_iInter.1 h₂ y) }
#align is_submonoid.Inter IsSubmonoid.iInter
#align is_add_submonoid.Inter IsAddSubmonoid.iInter
@[to_additive
"The union of an indexed, directed, nonempty set of `AddSubmonoid`s of an `AddMonoid` `M`
is an `AddSubmonoid` of `M`. "]
theorem isSubmonoid_iUnion_of_directed {ι : Type*} [hι : Nonempty ι] {s : ι → Set M}
(hs : ∀ i, IsSubmonoid (s i)) (Directed : ∀ i j, ∃ k, s i ⊆ s k ∧ s j ⊆ s k) :
IsSubmonoid (⋃ i, s i) :=
{ one_mem :=
let ⟨i⟩ := hι
Set.mem_iUnion.2 ⟨i, (hs i).one_mem⟩
mul_mem := fun ha hb =>
let ⟨i, hi⟩ := Set.mem_iUnion.1 ha
let ⟨j, hj⟩ := Set.mem_iUnion.1 hb
let ⟨k, hk⟩ := Directed i j
Set.mem_iUnion.2 ⟨k, (hs k).mul_mem (hk.1 hi) (hk.2 hj)⟩ }
#align is_submonoid_Union_of_directed isSubmonoid_iUnion_of_directed
#align is_add_submonoid_Union_of_directed isAddSubmonoid_iUnion_of_directed
namespace IsSubmonoid
@[to_additive
"The sum of a list of elements of an `AddSubmonoid` is an element of the `AddSubmonoid`."]
theorem list_prod_mem (hs : IsSubmonoid s) : ∀ {l : List M}, (∀ x ∈ l, x ∈ s) → l.prod ∈ s
| [], _ => hs.one_mem
| a :: l, h =>
suffices a * l.prod ∈ s by simpa
have : a ∈ s ∧ ∀ x ∈ l, x ∈ s := by simpa using h
hs.mul_mem this.1 (list_prod_mem hs this.2)
#align is_submonoid.list_prod_mem IsSubmonoid.list_prod_mem
#align is_add_submonoid.list_sum_mem IsAddSubmonoid.list_sum_mem
@[to_additive
"The sum of a multiset of elements of an `AddSubmonoid` of an `AddCommMonoid`
is an element of the `AddSubmonoid`. "]
| Mathlib/Deprecated/Submonoid.lean | 246 | 250 | theorem multiset_prod_mem {M} [CommMonoid M] {s : Set M} (hs : IsSubmonoid s) (m : Multiset M) :
(∀ a ∈ m, a ∈ s) → m.prod ∈ s := by |
refine Quotient.inductionOn m fun l hl => ?_
rw [Multiset.quot_mk_to_coe, Multiset.prod_coe]
exact list_prod_mem hs hl
| [
" a ∈ s ∧ ∀ x ∈ l, x ∈ s",
" (a :: l).prod ∈ s",
" (∀ a ∈ m, a ∈ s) → m.prod ∈ s",
" Multiset.prod ⟦l⟧ ∈ s",
" l.prod ∈ s"
] | [
" a ∈ s ∧ ∀ x ∈ l, x ∈ s",
" (a :: l).prod ∈ s"
] |
import Mathlib.Data.List.Basic
namespace List
variable {α β : Type*}
#align list.length_enum_from List.enumFrom_length
#align list.length_enum List.enum_length
@[simp]
theorem get?_enumFrom :
∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a)
| n, [], m => rfl
| n, a :: l, 0 => rfl
| n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl
#align list.enum_from_nth List.get?_enumFrom
@[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom
@[simp]
theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by
rw [enum, get?_enumFrom, Nat.zero_add]
#align list.enum_nth List.get?_enum
@[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum
@[simp]
theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l
| _, [] => rfl
| _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _)
#align list.enum_from_map_snd List.enumFrom_map_snd
@[simp]
theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l :=
enumFrom_map_snd _ _
#align list.enum_map_snd List.enum_map_snd
@[simp]
theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) :
(l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by
simp [get_eq_get?]
#align list.nth_le_enum_from List.get_enumFrom
@[simp]
theorem get_enum (l : List α) (i : Fin l.enum.length) :
l.enum.get i = (i.1, l.get (i.cast enum_length)) := by
simp [enum]
#align list.nth_le_enum List.get_enum
theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} :
(n + i, x) ∈ enumFrom n l ↔ l.get? i = x := by
simp [mem_iff_get?]
theorem mk_mem_enumFrom_iff_le_and_get?_sub {n i : ℕ} {x : α} {l : List α} :
(i, x) ∈ enumFrom n l ↔ n ≤ i ∧ l.get? (i - n) = x := by
if h : n ≤ i then
rcases Nat.exists_eq_add_of_le h with ⟨i, rfl⟩
simp [mk_add_mem_enumFrom_iff_get?, Nat.add_sub_cancel_left]
else
have : ∀ k, n + k ≠ i := by rintro k rfl; simp at h
simp [h, mem_iff_get?, this]
theorem mk_mem_enum_iff_get? {i : ℕ} {x : α} {l : List α} : (i, x) ∈ enum l ↔ l.get? i = x := by
simp [enum, mk_mem_enumFrom_iff_le_and_get?_sub]
theorem mem_enum_iff_get? {x : ℕ × α} {l : List α} : x ∈ enum l ↔ l.get? x.1 = x.2 :=
mk_mem_enum_iff_get?
theorem le_fst_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) :
n ≤ x.1 :=
(mk_mem_enumFrom_iff_le_and_get?_sub.1 h).1
theorem fst_lt_add_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) :
x.1 < n + length l := by
rcases mem_iff_get.1 h with ⟨i, rfl⟩
simpa using i.is_lt
theorem fst_lt_of_mem_enum {x : ℕ × α} {l : List α} (h : x ∈ enum l) : x.1 < length l := by
simpa using fst_lt_add_of_mem_enumFrom h
theorem snd_mem_of_mem_enumFrom {x : ℕ × α} {n : ℕ} {l : List α} (h : x ∈ enumFrom n l) : x.2 ∈ l :=
enumFrom_map_snd n l ▸ mem_map_of_mem _ h
theorem snd_mem_of_mem_enum {x : ℕ × α} {l : List α} (h : x ∈ enum l) : x.2 ∈ l :=
snd_mem_of_mem_enumFrom h
theorem mem_enumFrom {x : α} {i j : ℕ} (xs : List α) (h : (i, x) ∈ xs.enumFrom j) :
j ≤ i ∧ i < j + xs.length ∧ x ∈ xs :=
⟨le_fst_of_mem_enumFrom h, fst_lt_add_of_mem_enumFrom h, snd_mem_of_mem_enumFrom h⟩
#align list.mem_enum_from List.mem_enumFrom
@[simp]
theorem enum_nil : enum ([] : List α) = [] :=
rfl
#align list.enum_nil List.enum_nil
#align list.enum_from_nil List.enumFrom_nil
#align list.enum_from_cons List.enumFrom_cons
@[simp]
theorem enum_cons (x : α) (xs : List α) : enum (x :: xs) = (0, x) :: enumFrom 1 xs :=
rfl
#align list.enum_cons List.enum_cons
@[simp]
theorem enumFrom_singleton (x : α) (n : ℕ) : enumFrom n [x] = [(n, x)] :=
rfl
#align list.enum_from_singleton List.enumFrom_singleton
@[simp]
theorem enum_singleton (x : α) : enum [x] = [(0, x)] :=
rfl
#align list.enum_singleton List.enum_singleton
theorem enumFrom_append (xs ys : List α) (n : ℕ) :
enumFrom n (xs ++ ys) = enumFrom n xs ++ enumFrom (n + xs.length) ys := by
induction' xs with x xs IH generalizing ys n
· simp
· rw [cons_append, enumFrom_cons, IH, ← cons_append, ← enumFrom_cons, length, Nat.add_right_comm,
Nat.add_assoc]
#align list.enum_from_append List.enumFrom_append
| Mathlib/Data/List/Enum.lean | 132 | 133 | theorem enum_append (xs ys : List α) : enum (xs ++ ys) = enum xs ++ enumFrom xs.length ys := by |
simp [enum, enumFrom_append]
| [
" Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))",
" Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))",
" l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)",
" (enumFrom n l)... | [
" Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))",
" Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))",
" l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)",
" (enumFrom n l)... |
import Mathlib.AlgebraicTopology.DoldKan.PInfty
#align_import algebraic_topology.dold_kan.decomposition from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Preadditive
Opposite Simplicial
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] {X X' : SimplicialObject C}
| Mathlib/AlgebraicTopology/DoldKan/Decomposition.lean | 52 | 81 | theorem decomposition_Q (n q : ℕ) :
((Q q).f (n + 1) : X _[n + 1] ⟶ X _[n + 1]) =
∑ i ∈ Finset.filter (fun i : Fin (n + 1) => (i : ℕ) < q) Finset.univ,
(P i).f (n + 1) ≫ X.δ i.rev.succ ≫ X.σ (Fin.rev i) := by |
induction' q with q hq
· simp only [Nat.zero_eq, Q_zero, HomologicalComplex.zero_f_apply, Nat.not_lt_zero,
Finset.filter_False, Finset.sum_empty]
· by_cases hqn : q + 1 ≤ n + 1
swap
· rw [Q_is_eventually_constant (show n + 1 ≤ q by omega), hq]
congr 1
ext ⟨x, hx⟩
simp only [Nat.succ_eq_add_one, Finset.mem_filter, Finset.mem_univ, true_and]
omega
· cases' Nat.le.dest (Nat.succ_le_succ_iff.mp hqn) with a ha
rw [Q_succ, HomologicalComplex.sub_f_apply, HomologicalComplex.comp_f, hq]
symm
conv_rhs => rw [sub_eq_add_neg, add_comm]
let q' : Fin (n + 1) := ⟨q, Nat.succ_le_iff.mp hqn⟩
rw [← @Finset.add_sum_erase _ _ _ _ _ _ q' (by simp)]
congr
· have hnaq' : n = a + q := by omega
simp only [Fin.val_mk, (HigherFacesVanish.of_P q n).comp_Hσ_eq hnaq',
q'.rev_eq hnaq', neg_neg]
rfl
· ext ⟨i, hi⟩
simp only [q', Nat.succ_eq_add_one, Nat.lt_succ_iff_lt_or_eq, Finset.mem_univ,
forall_true_left, Finset.mem_filter, lt_self_iff_false, or_true, and_self, not_true,
Finset.mem_erase, ne_eq, Fin.mk.injEq, true_and]
aesop
| [
" (Q q).f (n + 1) = ∑ i ∈ Finset.filter (fun i => ↑i < q) Finset.univ, (P ↑i).f (n + 1) ≫ X.δ i.rev.succ ≫ X.σ i.rev",
" (Q 0).f (n + 1) = ∑ i ∈ Finset.filter (fun i => ↑i < 0) Finset.univ, (P ↑i).f (n + 1) ≫ X.δ i.rev.succ ≫ X.σ i.rev",
" (Q (q + 1)).f (n + 1) =\n ∑ i ∈ Finset.filter (fun i => ↑i < q + 1) F... | [] |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.Algebra.Polynomial.Lifts
import Mathlib.GroupTheory.MonoidLocalization
import Mathlib.RingTheory.Algebraic
import Mathlib.RingTheory.Ideal.LocalRing
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
#align_import ring_theory.localization.integral from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
variable {R : Type*} [CommRing R] (M : Submonoid R) {S : Type*} [CommRing S]
variable [Algebra R S] {P : Type*} [CommRing P]
open Polynomial
namespace IsLocalization
section IntegerNormalization
open Polynomial
variable [IsLocalization M S]
open scoped Classical
noncomputable def coeffIntegerNormalization (p : S[X]) (i : ℕ) : R :=
if hi : i ∈ p.support then
Classical.choose
(Classical.choose_spec (exist_integer_multiples_of_finset M (p.support.image p.coeff))
(p.coeff i) (Finset.mem_image.mpr ⟨i, hi, rfl⟩))
else 0
#align is_localization.coeff_integer_normalization IsLocalization.coeffIntegerNormalization
theorem coeffIntegerNormalization_of_not_mem_support (p : S[X]) (i : ℕ) (h : coeff p i = 0) :
coeffIntegerNormalization M p i = 0 := by
simp only [coeffIntegerNormalization, h, mem_support_iff, eq_self_iff_true, not_true, Ne,
dif_neg, not_false_iff]
#align is_localization.coeff_integer_normalization_of_not_mem_support IsLocalization.coeffIntegerNormalization_of_not_mem_support
theorem coeffIntegerNormalization_mem_support (p : S[X]) (i : ℕ)
(h : coeffIntegerNormalization M p i ≠ 0) : i ∈ p.support := by
contrapose h
rw [Ne, Classical.not_not, coeffIntegerNormalization, dif_neg h]
#align is_localization.coeff_integer_normalization_mem_support IsLocalization.coeffIntegerNormalization_mem_support
noncomputable def integerNormalization (p : S[X]) : R[X] :=
∑ i ∈ p.support, monomial i (coeffIntegerNormalization M p i)
#align is_localization.integer_normalization IsLocalization.integerNormalization
@[simp]
theorem integerNormalization_coeff (p : S[X]) (i : ℕ) :
(integerNormalization M p).coeff i = coeffIntegerNormalization M p i := by
simp (config := { contextual := true }) [integerNormalization, coeff_monomial,
coeffIntegerNormalization_of_not_mem_support]
#align is_localization.integer_normalization_coeff IsLocalization.integerNormalization_coeff
theorem integerNormalization_spec (p : S[X]) :
∃ b : M, ∀ i, algebraMap R S ((integerNormalization M p).coeff i) = (b : R) • p.coeff i := by
use Classical.choose (exist_integer_multiples_of_finset M (p.support.image p.coeff))
intro i
rw [integerNormalization_coeff, coeffIntegerNormalization]
split_ifs with hi
· exact
Classical.choose_spec
(Classical.choose_spec (exist_integer_multiples_of_finset M (p.support.image p.coeff))
(p.coeff i) (Finset.mem_image.mpr ⟨i, hi, rfl⟩))
· rw [RingHom.map_zero, not_mem_support_iff.mp hi, smul_zero]
-- Porting note: was `convert (smul_zero _).symm, ...`
#align is_localization.integer_normalization_spec IsLocalization.integerNormalization_spec
theorem integerNormalization_map_to_map (p : S[X]) :
∃ b : M, (integerNormalization M p).map (algebraMap R S) = (b : R) • p :=
let ⟨b, hb⟩ := integerNormalization_spec M p
⟨b,
Polynomial.ext fun i => by
rw [coeff_map, coeff_smul]
exact hb i⟩
#align is_localization.integer_normalization_map_to_map IsLocalization.integerNormalization_map_to_map
variable {R' : Type*} [CommRing R']
theorem integerNormalization_eval₂_eq_zero (g : S →+* R') (p : S[X]) {x : R'}
(hx : eval₂ g x p = 0) : eval₂ (g.comp (algebraMap R S)) x (integerNormalization M p) = 0 :=
let ⟨b, hb⟩ := integerNormalization_map_to_map M p
_root_.trans (eval₂_map (algebraMap R S) g x).symm
(by rw [hb, ← IsScalarTower.algebraMap_smul S (b : R) p, eval₂_smul, hx, mul_zero])
#align is_localization.integer_normalization_eval₂_eq_zero IsLocalization.integerNormalization_eval₂_eq_zero
| Mathlib/RingTheory/Localization/Integral.lean | 112 | 115 | theorem integerNormalization_aeval_eq_zero [Algebra R R'] [Algebra S R'] [IsScalarTower R S R']
(p : S[X]) {x : R'} (hx : aeval x p = 0) : aeval x (integerNormalization M p) = 0 := by |
rw [aeval_def, IsScalarTower.algebraMap_eq R S R',
integerNormalization_eval₂_eq_zero _ (algebraMap _ _) _ hx]
| [
" coeffIntegerNormalization M p i = 0",
" i ∈ p.support",
" ¬coeffIntegerNormalization M p i ≠ 0",
" (integerNormalization M p).coeff i = coeffIntegerNormalization M p i",
" ∃ b, ∀ (i : ℕ), (algebraMap R S) ((integerNormalization M p).coeff i) = ↑b • p.coeff i",
" ∀ (i : ℕ), (algebraMap R S) ((integerNorm... | [
" coeffIntegerNormalization M p i = 0",
" i ∈ p.support",
" ¬coeffIntegerNormalization M p i ≠ 0",
" (integerNormalization M p).coeff i = coeffIntegerNormalization M p i",
" ∃ b, ∀ (i : ℕ), (algebraMap R S) ((integerNormalization M p).coeff i) = ↑b • p.coeff i",
" ∀ (i : ℕ), (algebraMap R S) ((integerNorm... |
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.Data.Multiset.FinsetOps
import Mathlib.Data.Multiset.Fold
#align_import algebra.gcd_monoid.multiset from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
namespace Multiset
variable {α : Type*} [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section lcm
def lcm (s : Multiset α) : α :=
s.fold GCDMonoid.lcm 1
#align multiset.lcm Multiset.lcm
@[simp]
theorem lcm_zero : (0 : Multiset α).lcm = 1 :=
fold_zero _ _
#align multiset.lcm_zero Multiset.lcm_zero
@[simp]
theorem lcm_cons (a : α) (s : Multiset α) : (a ::ₘ s).lcm = GCDMonoid.lcm a s.lcm :=
fold_cons_left _ _ _ _
#align multiset.lcm_cons Multiset.lcm_cons
@[simp]
theorem lcm_singleton {a : α} : ({a} : Multiset α).lcm = normalize a :=
(fold_singleton _ _ _).trans <| lcm_one_right _
#align multiset.lcm_singleton Multiset.lcm_singleton
@[simp]
theorem lcm_add (s₁ s₂ : Multiset α) : (s₁ + s₂).lcm = GCDMonoid.lcm s₁.lcm s₂.lcm :=
Eq.trans (by simp [lcm]) (fold_add _ _ _ _ _)
#align multiset.lcm_add Multiset.lcm_add
theorem lcm_dvd {s : Multiset α} {a : α} : s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [or_imp, forall_and, lcm_dvd_iff])
#align multiset.lcm_dvd Multiset.lcm_dvd
theorem dvd_lcm {s : Multiset α} {a : α} (h : a ∈ s) : a ∣ s.lcm :=
lcm_dvd.1 dvd_rfl _ h
#align multiset.dvd_lcm Multiset.dvd_lcm
theorem lcm_mono {s₁ s₂ : Multiset α} (h : s₁ ⊆ s₂) : s₁.lcm ∣ s₂.lcm :=
lcm_dvd.2 fun _ hb ↦ dvd_lcm (h hb)
#align multiset.lcm_mono Multiset.lcm_mono
@[simp 1100]
theorem normalize_lcm (s : Multiset α) : normalize s.lcm = s.lcm :=
Multiset.induction_on s (by simp) fun a s _ ↦ by simp
#align multiset.normalize_lcm Multiset.normalize_lcm
@[simp]
nonrec theorem lcm_eq_zero_iff [Nontrivial α] (s : Multiset α) : s.lcm = 0 ↔ (0 : α) ∈ s := by
induction' s using Multiset.induction_on with a s ihs
· simp only [lcm_zero, one_ne_zero, not_mem_zero]
· simp only [mem_cons, lcm_cons, lcm_eq_zero_iff, ihs, @eq_comm _ a]
#align multiset.lcm_eq_zero_iff Multiset.lcm_eq_zero_iff
variable [DecidableEq α]
@[simp]
theorem lcm_dedup (s : Multiset α) : (dedup s).lcm = s.lcm :=
Multiset.induction_on s (by simp) fun a s IH ↦ by
by_cases h : a ∈ s <;> simp [IH, h]
unfold lcm
rw [← cons_erase h, fold_cons_left, ← lcm_assoc, lcm_same]
apply lcm_eq_of_associated_left (associated_normalize _)
#align multiset.lcm_dedup Multiset.lcm_dedup
@[simp]
theorem lcm_ndunion (s₁ s₂ : Multiset α) : (ndunion s₁ s₂).lcm = GCDMonoid.lcm s₁.lcm s₂.lcm := by
rw [← lcm_dedup, dedup_ext.2, lcm_dedup, lcm_add]
simp
#align multiset.lcm_ndunion Multiset.lcm_ndunion
@[simp]
| Mathlib/Algebra/GCDMonoid/Multiset.lean | 110 | 112 | theorem lcm_union (s₁ s₂ : Multiset α) : (s₁ ∪ s₂).lcm = GCDMonoid.lcm s₁.lcm s₂.lcm := by |
rw [← lcm_dedup, dedup_ext.2, lcm_dedup, lcm_add]
simp
| [
" (s₁ + s₂).lcm = fold GCDMonoid.lcm (GCDMonoid.lcm 1 1) (s₁ + s₂)",
" lcm 0 ∣ a ↔ ∀ b ∈ 0, b ∣ a",
" ∀ (a_1 : α) (s : Multiset α), (s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a) → ((a_1 ::ₘ s).lcm ∣ a ↔ ∀ b ∈ a_1 ::ₘ s, b ∣ a)",
" normalize (lcm 0) = lcm 0",
" normalize (a ::ₘ s).lcm = (a ::ₘ s).lcm",
" s.lcm = 0 ↔ 0 ∈ s"... | [
" (s₁ + s₂).lcm = fold GCDMonoid.lcm (GCDMonoid.lcm 1 1) (s₁ + s₂)",
" lcm 0 ∣ a ↔ ∀ b ∈ 0, b ∣ a",
" ∀ (a_1 : α) (s : Multiset α), (s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a) → ((a_1 ::ₘ s).lcm ∣ a ↔ ∀ b ∈ a_1 ::ₘ s, b ∣ a)",
" normalize (lcm 0) = lcm 0",
" normalize (a ::ₘ s).lcm = (a ::ₘ s).lcm",
" s.lcm = 0 ↔ 0 ∈ s"... |
import Mathlib.Topology.Sets.Opens
#align_import topology.local_at_target from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Set Filter
open Topology Filter
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
variable {s : Set β} {ι : Type*} {U : ι → Opens β} (hU : iSup U = ⊤)
theorem Set.restrictPreimage_inducing (s : Set β) (h : Inducing f) :
Inducing (s.restrictPreimage f) := by
simp_rw [← inducing_subtype_val.of_comp_iff, inducing_iff_nhds, restrictPreimage,
MapsTo.coe_restrict, restrict_eq, ← @Filter.comap_comap _ _ _ _ _ f, Function.comp_apply] at h ⊢
intro a
rw [← h, ← inducing_subtype_val.nhds_eq_comap]
#align set.restrict_preimage_inducing Set.restrictPreimage_inducing
alias Inducing.restrictPreimage := Set.restrictPreimage_inducing
#align inducing.restrict_preimage Inducing.restrictPreimage
theorem Set.restrictPreimage_embedding (s : Set β) (h : Embedding f) :
Embedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s, h.2.restrictPreimage s⟩
#align set.restrict_preimage_embedding Set.restrictPreimage_embedding
alias Embedding.restrictPreimage := Set.restrictPreimage_embedding
#align embedding.restrict_preimage Embedding.restrictPreimage
theorem Set.restrictPreimage_openEmbedding (s : Set β) (h : OpenEmbedding f) :
OpenEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ continuous_subtype_val.isOpen_preimage _ h.isOpen_range⟩
#align set.restrict_preimage_open_embedding Set.restrictPreimage_openEmbedding
alias OpenEmbedding.restrictPreimage := Set.restrictPreimage_openEmbedding
#align open_embedding.restrict_preimage OpenEmbedding.restrictPreimage
theorem Set.restrictPreimage_closedEmbedding (s : Set β) (h : ClosedEmbedding f) :
ClosedEmbedding (s.restrictPreimage f) :=
⟨h.1.restrictPreimage s,
(s.range_restrictPreimage f).symm ▸ inducing_subtype_val.isClosed_preimage _ h.isClosed_range⟩
#align set.restrict_preimage_closed_embedding Set.restrictPreimage_closedEmbedding
alias ClosedEmbedding.restrictPreimage := Set.restrictPreimage_closedEmbedding
#align closed_embedding.restrict_preimage ClosedEmbedding.restrictPreimage
theorem IsClosedMap.restrictPreimage (H : IsClosedMap f) (s : Set β) :
IsClosedMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsClosed u → Subtype.val ⁻¹' u = t →
∃ v, IsClosed v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isClosed_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isClosedMap (s : Set β) (H : IsClosedMap f) :
IsClosedMap (s.restrictPreimage f) := H.restrictPreimage s
theorem IsOpenMap.restrictPreimage (H : IsOpenMap f) (s : Set β) :
IsOpenMap (s.restrictPreimage f) := by
intro t
suffices ∀ u, IsOpen u → Subtype.val ⁻¹' u = t →
∃ v, IsOpen v ∧ Subtype.val ⁻¹' v = s.restrictPreimage f '' t by
simpa [isOpen_induced_iff]
exact fun u hu e => ⟨f '' u, H u hu, by simp [← e, image_restrictPreimage]⟩
@[deprecated (since := "2024-04-02")]
theorem Set.restrictPreimage_isOpenMap (s : Set β) (H : IsOpenMap f) :
IsOpenMap (s.restrictPreimage f) := H.restrictPreimage s
theorem isOpen_iff_inter_of_iSup_eq_top (s : Set β) : IsOpen s ↔ ∀ i, IsOpen (s ∩ U i) := by
constructor
· exact fun H i => H.inter (U i).2
· intro H
have : ⋃ i, (U i : Set β) = Set.univ := by
convert congr_arg (SetLike.coe) hU
simp
rw [← s.inter_univ, ← this, Set.inter_iUnion]
exact isOpen_iUnion H
#align is_open_iff_inter_of_supr_eq_top isOpen_iff_inter_of_iSup_eq_top
| Mathlib/Topology/LocalAtTarget.lean | 101 | 108 | theorem isOpen_iff_coe_preimage_of_iSup_eq_top (s : Set β) :
IsOpen s ↔ ∀ i, IsOpen ((↑) ⁻¹' s : Set (U i)) := by |
-- Porting note: rewrote to avoid ´simp´ issues
rw [isOpen_iff_inter_of_iSup_eq_top hU s]
refine forall_congr' fun i => ?_
rw [(U _).2.openEmbedding_subtype_val.open_iff_image_open]
erw [Set.image_preimage_eq_inter_range]
rw [Subtype.range_coe, Opens.carrier_eq_coe]
| [
" Inducing (s.restrictPreimage f)",
" ∀ (x : ↑(f ⁻¹' s)), 𝓝 x = comap Subtype.val (comap f (𝓝 (f ↑x)))",
" 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a)))",
" IsClosedMap (s.restrictPreimage f)",
" IsClosed t → IsClosed (s.restrictPreimage f '' t)",
" ∀ (u : Set α), IsClosed u → Subtype.val ⁻¹' u = t → ∃... | [
" Inducing (s.restrictPreimage f)",
" ∀ (x : ↑(f ⁻¹' s)), 𝓝 x = comap Subtype.val (comap f (𝓝 (f ↑x)))",
" 𝓝 a = comap Subtype.val (comap f (𝓝 (f ↑a)))",
" IsClosedMap (s.restrictPreimage f)",
" IsClosed t → IsClosed (s.restrictPreimage f '' t)",
" ∀ (u : Set α), IsClosed u → Subtype.val ⁻¹' u = t → ∃... |
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Relator
import Mathlib.Init.Data.Quot
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Use
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.SimpRw
#align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Function
variable {α β γ δ ε ζ : Type*}
namespace Relation
variable {r : α → α → Prop} {a b c d : α}
@[mk_iff ReflTransGen.cases_tail_iff]
inductive ReflTransGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflTransGen r a a
| tail {b c} : ReflTransGen r a b → r b c → ReflTransGen r a c
#align relation.refl_trans_gen Relation.ReflTransGen
#align relation.refl_trans_gen.cases_tail_iff Relation.ReflTransGen.cases_tail_iff
attribute [refl] ReflTransGen.refl
@[mk_iff]
inductive ReflGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflGen r a a
| single {b} : r a b → ReflGen r a b
#align relation.refl_gen Relation.ReflGen
#align relation.refl_gen_iff Relation.reflGen_iff
@[mk_iff]
inductive TransGen (r : α → α → Prop) (a : α) : α → Prop
| single {b} : r a b → TransGen r a b
| tail {b c} : TransGen r a b → r b c → TransGen r a c
#align relation.trans_gen Relation.TransGen
#align relation.trans_gen_iff Relation.transGen_iff
attribute [refl] ReflGen.refl
namespace ReflTransGen
@[trans]
theorem trans (hab : ReflTransGen r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by
induction hbc with
| refl => assumption
| tail _ hcd hac => exact hac.tail hcd
#align relation.refl_trans_gen.trans Relation.ReflTransGen.trans
theorem single (hab : r a b) : ReflTransGen r a b :=
refl.tail hab
#align relation.refl_trans_gen.single Relation.ReflTransGen.single
theorem head (hab : r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by
induction hbc with
| refl => exact refl.tail hab
| tail _ hcd hac => exact hac.tail hcd
#align relation.refl_trans_gen.head Relation.ReflTransGen.head
theorem symmetric (h : Symmetric r) : Symmetric (ReflTransGen r) := by
intro x y h
induction' h with z w _ b c
· rfl
· apply Relation.ReflTransGen.head (h b) c
#align relation.refl_trans_gen.symmetric Relation.ReflTransGen.symmetric
theorem cases_tail : ReflTransGen r a b → b = a ∨ ∃ c, ReflTransGen r a c ∧ r c b :=
(cases_tail_iff r a b).1
#align relation.refl_trans_gen.cases_tail Relation.ReflTransGen.cases_tail
@[elab_as_elim]
theorem head_induction_on {P : ∀ a : α, ReflTransGen r a b → Prop} {a : α} (h : ReflTransGen r a b)
(refl : P b refl)
(head : ∀ {a c} (h' : r a c) (h : ReflTransGen r c b), P c h → P a (h.head h')) : P a h := by
induction h with
| refl => exact refl
| @tail b c _ hbc ih =>
apply ih
· exact head hbc _ refl
· exact fun h1 h2 ↦ head h1 (h2.tail hbc)
#align relation.refl_trans_gen.head_induction_on Relation.ReflTransGen.head_induction_on
@[elab_as_elim]
| Mathlib/Logic/Relation.lean | 336 | 342 | theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
(h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
(ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
P (h₁.trans h₂)) : P h := by |
induction h with
| refl => exact ih₁ a
| tail hab hbc ih => exact ih₃ hab (single hbc) ih (ih₂ hbc)
| [
" ReflTransGen r a c",
" ReflTransGen r a b",
" ReflTransGen r a c✝",
" Symmetric (ReflTransGen r)",
" ReflTransGen r y x",
" ReflTransGen r x x",
" ReflTransGen r w x",
" P a h",
" P a ⋯",
" P b ⋯",
" ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 b), P c_1 ⋯ → P a ⋯",
" P h",
" P ⋯"
... | [
" ReflTransGen r a c",
" ReflTransGen r a b",
" ReflTransGen r a c✝",
" Symmetric (ReflTransGen r)",
" ReflTransGen r y x",
" ReflTransGen r x x",
" ReflTransGen r w x",
" P a h",
" P a ⋯",
" P b ⋯",
" ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 b), P c_1 ⋯ → P a ⋯"
] |
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Adjunction.Reflective
#align_import algebraic_geometry.Gamma_Spec_adjunction from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open PrimeSpectrum
namespace AlgebraicGeometry
open Opposite
open CategoryTheory
open StructureSheaf
open Spec (structureSheaf)
open TopologicalSpace
open AlgebraicGeometry.LocallyRingedSpace
open TopCat.Presheaf
open TopCat.Presheaf.SheafCondition
namespace LocallyRingedSpace
variable (X : LocallyRingedSpace.{u})
def ΓToStalk (x : X) : Γ.obj (op X) ⟶ X.presheaf.stalk x :=
X.presheaf.germ (⟨x, trivial⟩ : (⊤ : Opens X))
#align algebraic_geometry.LocallyRingedSpace.Γ_to_stalk AlgebraicGeometry.LocallyRingedSpace.ΓToStalk
def toΓSpecFun : X → PrimeSpectrum (Γ.obj (op X)) := fun x =>
comap (X.ΓToStalk x) (LocalRing.closedPoint (X.presheaf.stalk x))
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_fun AlgebraicGeometry.LocallyRingedSpace.toΓSpecFun
theorem not_mem_prime_iff_unit_in_stalk (r : Γ.obj (op X)) (x : X) :
r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit (X.ΓToStalk x r) := by
erw [LocalRing.mem_maximalIdeal, Classical.not_not]
#align algebraic_geometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk AlgebraicGeometry.LocallyRingedSpace.not_mem_prime_iff_unit_in_stalk
theorem toΓSpec_preim_basicOpen_eq (r : Γ.obj (op X)) :
X.toΓSpecFun ⁻¹' (basicOpen r).1 = (X.toRingedSpace.basicOpen r).1 := by
ext
erw [X.toRingedSpace.mem_top_basicOpen]; apply not_mem_prime_iff_unit_in_stalk
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_preim_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΓSpec_preim_basicOpen_eq
theorem toΓSpec_continuous : Continuous X.toΓSpecFun := by
rw [isTopologicalBasis_basic_opens.continuous_iff]
rintro _ ⟨r, rfl⟩
erw [X.toΓSpec_preim_basicOpen_eq r]
exact (X.toRingedSpace.basicOpen r).2
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_continuous AlgebraicGeometry.LocallyRingedSpace.toΓSpec_continuous
@[simps]
def toΓSpecBase : X.toTopCat ⟶ Spec.topObj (Γ.obj (op X)) where
toFun := X.toΓSpecFun
continuous_toFun := X.toΓSpec_continuous
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_base AlgebraicGeometry.LocallyRingedSpace.toΓSpecBase
-- These lemmas have always been bad (#7657), but lean4#2644 made `simp` start noticing
attribute [nolint simpNF] AlgebraicGeometry.LocallyRingedSpace.toΓSpecBase_apply
variable (r : Γ.obj (op X))
abbrev toΓSpecMapBasicOpen : Opens X :=
(Opens.map X.toΓSpecBase).obj (basicOpen r)
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toΓSpecMapBasicOpen
theorem toΓSpecMapBasicOpen_eq : X.toΓSpecMapBasicOpen r = X.toRingedSpace.basicOpen r :=
Opens.ext (X.toΓSpec_preim_basicOpen_eq r)
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_map_basic_open_eq AlgebraicGeometry.LocallyRingedSpace.toΓSpecMapBasicOpen_eq
abbrev toToΓSpecMapBasicOpen :
X.presheaf.obj (op ⊤) ⟶ X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r) :=
X.presheaf.map (X.toΓSpecMapBasicOpen r).leTop.op
#align algebraic_geometry.LocallyRingedSpace.to_to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.toToΓSpecMapBasicOpen
theorem isUnit_res_toΓSpecMapBasicOpen : IsUnit (X.toToΓSpecMapBasicOpen r r) := by
convert
(X.presheaf.map <| (eqToHom <| X.toΓSpecMapBasicOpen_eq r).op).isUnit_map
(X.toRingedSpace.isUnit_res_basicOpen r)
-- Porting note: `rw [comp_apply]` to `erw [comp_apply]`
erw [← comp_apply, ← Functor.map_comp]
congr
#align algebraic_geometry.LocallyRingedSpace.is_unit_res_to_Γ_Spec_map_basic_open AlgebraicGeometry.LocallyRingedSpace.isUnit_res_toΓSpecMapBasicOpen
def toΓSpecCApp :
(structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r) :=
IsLocalization.Away.lift r (isUnit_res_toΓSpecMapBasicOpen _ r)
#align algebraic_geometry.LocallyRingedSpace.to_Γ_Spec_c_app AlgebraicGeometry.LocallyRingedSpace.toΓSpecCApp
| Mathlib/AlgebraicGeometry/GammaSpecAdjunction.lean | 146 | 160 | theorem toΓSpecCApp_iff
(f :
(structureSheaf <| Γ.obj <| op X).val.obj (op <| basicOpen r) ⟶
X.presheaf.obj (op <| X.toΓSpecMapBasicOpen r)) :
toOpen _ (basicOpen r) ≫ f = X.toToΓSpecMapBasicOpen r ↔ f = X.toΓSpecCApp r := by |
-- Porting Note: Type class problem got stuck in `IsLocalization.Away.AwayMap.lift_comp`
-- created instance manually. This replaces the `pick_goal` tactics
have loc_inst := IsLocalization.to_basicOpen (Γ.obj (op X)) r
rw [← @IsLocalization.Away.AwayMap.lift_comp _ _ _ _ _ _ _ r loc_inst _
(X.isUnit_res_toΓSpecMapBasicOpen r)]
--pick_goal 5; exact is_localization.to_basic_open _ r
constructor
· intro h
exact IsLocalization.ringHom_ext (Submonoid.powers r) h
apply congr_arg
| [
" r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)",
" X.toΓSpecFun ⁻¹' (basicOpen r).carrier = (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ IsUnit ((X.toRingedSpace.... | [
" r ∉ (X.toΓSpecFun x).asIdeal ↔ IsUnit ((X.ΓToStalk x) r)",
" X.toΓSpecFun ⁻¹' (basicOpen r).carrier = (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ x✝ ∈ (X.toRingedSpace.basicOpen r).carrier",
" x✝ ∈ X.toΓSpecFun ⁻¹' (basicOpen r).carrier ↔ IsUnit ((X.toRingedSpace.... |
import Mathlib.Data.Set.Lattice
import Mathlib.Data.Set.Pairwise.Basic
#align_import data.set.pairwise.lattice from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d"
open Function Set Order
variable {α β γ ι ι' : Type*} {κ : Sort*} {r p q : α → α → Prop}
section Pairwise
variable {f g : ι → α} {s t u : Set α} {a b : α}
namespace Set
section CompleteLattice
variable [CompleteLattice α] {s : Set ι} {t : Set ι'}
| Mathlib/Data/Set/Pairwise/Lattice.lean | 72 | 84 | theorem PairwiseDisjoint.biUnion {s : Set ι'} {g : ι' → Set ι} {f : ι → α}
(hs : s.PairwiseDisjoint fun i' : ι' => ⨆ i ∈ g i', f i)
(hg : ∀ i ∈ s, (g i).PairwiseDisjoint f) : (⋃ i ∈ s, g i).PairwiseDisjoint f := by |
rintro a ha b hb hab
simp_rw [Set.mem_iUnion] at ha hb
obtain ⟨c, hc, ha⟩ := ha
obtain ⟨d, hd, hb⟩ := hb
obtain hcd | hcd := eq_or_ne (g c) (g d)
· exact hg d hd (hcd.subst ha) hb hab
-- Porting note: the elaborator couldn't figure out `f` here.
· exact (hs hc hd <| ne_of_apply_ne _ hcd).mono
(le_iSup₂ (f := fun i (_ : i ∈ g c) => f i) a ha)
(le_iSup₂ (f := fun i (_ : i ∈ g d) => f i) b hb)
| [
" (⋃ i ∈ s, g i).PairwiseDisjoint f",
" (Disjoint on f) a b"
] | [] |
import Mathlib.Data.Finset.Card
#align_import data.finset.option from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
variable {α β : Type*}
open Function
namespace Finset
def insertNone : Finset α ↪o Finset (Option α) :=
(OrderEmbedding.ofMapLEIff fun s => cons none (s.map Embedding.some) <| by simp) fun s t => by
rw [le_iff_subset, cons_subset_cons, map_subset_map, le_iff_subset]
#align finset.insert_none Finset.insertNone
@[simp]
theorem mem_insertNone {s : Finset α} : ∀ {o : Option α}, o ∈ insertNone s ↔ ∀ a ∈ o, a ∈ s
| none => iff_of_true (Multiset.mem_cons_self _ _) fun a h => by cases h
| some a => Multiset.mem_cons.trans <| by simp
#align finset.mem_insert_none Finset.mem_insertNone
lemma forall_mem_insertNone {s : Finset α} {p : Option α → Prop} :
(∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p a := by simp [Option.forall]
| Mathlib/Data/Finset/Option.lean | 78 | 78 | theorem some_mem_insertNone {s : Finset α} {a : α} : some a ∈ insertNone s ↔ a ∈ s := by | simp
| [
" none ∉ map Embedding.some s",
" cons none (map Embedding.some s) ⋯ ≤ cons none (map Embedding.some t) ⋯ ↔ s ≤ t",
" a ∈ s",
" some a = none ∨ some a ∈ (map Embedding.some s).val ↔ ∀ a_1 ∈ some a, a_1 ∈ s",
" (∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p (some a)",
" some a ∈ insertNone s ↔ a ∈ s"
] | [
" none ∉ map Embedding.some s",
" cons none (map Embedding.some s) ⋯ ≤ cons none (map Embedding.some t) ⋯ ↔ s ≤ t",
" a ∈ s",
" some a = none ∨ some a ∈ (map Embedding.some s).val ↔ ∀ a_1 ∈ some a, a_1 ∈ s",
" (∀ a ∈ insertNone s, p a) ↔ p none ∧ ∀ a ∈ s, p (some a)"
] |
import Mathlib.Algebra.ContinuedFractions.Computation.Basic
import Mathlib.Algebra.ContinuedFractions.Translations
#align_import algebra.continued_fractions.computation.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
-- Fix a discrete linear ordered floor field and a value `v`.
variable {K : Type*} [LinearOrderedField K] [FloorRing K] {v : K}
namespace IntFractPair
theorem stream_zero (v : K) : IntFractPair.stream v 0 = some (IntFractPair.of v) :=
rfl
#align generalized_continued_fraction.int_fract_pair.stream_zero GeneralizedContinuedFraction.IntFractPair.stream_zero
variable {n : ℕ}
theorem stream_eq_none_of_fr_eq_zero {ifp_n : IntFractPair K}
(stream_nth_eq : IntFractPair.stream v n = some ifp_n) (nth_fr_eq_zero : ifp_n.fr = 0) :
IntFractPair.stream v (n + 1) = none := by
cases' ifp_n with _ fr
change fr = 0 at nth_fr_eq_zero
simp [IntFractPair.stream, stream_nth_eq, nth_fr_eq_zero]
#align generalized_continued_fraction.int_fract_pair.stream_eq_none_of_fr_eq_zero GeneralizedContinuedFraction.IntFractPair.stream_eq_none_of_fr_eq_zero
| Mathlib/Algebra/ContinuedFractions/Computation/Translations.lean | 77 | 81 | theorem succ_nth_stream_eq_none_iff :
IntFractPair.stream v (n + 1) = none ↔
IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0 := by |
rw [IntFractPair.stream]
cases IntFractPair.stream v n <;> simp [imp_false]
| [
" IntFractPair.stream v (n + 1) = none",
" IntFractPair.stream v (n + 1) = none ↔\n IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0",
" ((IntFractPair.stream v n).bind fun ap_n => if ap_n.fr = 0 then none else some (IntFractPair.of ap_n.fr⁻¹)) = none ↔\n IntFractPai... | [
" IntFractPair.stream v (n + 1) = none"
] |
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
{v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).vars ⊆ p.vars ∪ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars ∪ q.vars := by
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
#align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint
section Mul
theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by
simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset]
exact Multiset.subset_of_le (degrees_mul φ ψ)
#align mv_polynomial.vars_mul MvPolynomial.vars_mul
@[simp]
theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ :=
vars_C
#align mv_polynomial.vars_one MvPolynomial.vars_one
theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by
classical
induction' n with n ih
· simp
· rw [pow_succ']
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset (Finset.Subset.refl _) ih
#align mv_polynomial.vars_pow MvPolynomial.vars_pow
theorem vars_prod {ι : Type*} [DecidableEq σ] {s : Finset ι} (f : ι → MvPolynomial σ R) :
(∏ i ∈ s, f i).vars ⊆ s.biUnion fun i => (f i).vars := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert hs hsub =>
simp only [hs, Finset.biUnion_insert, Finset.prod_insert, not_false_iff]
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset_union (Finset.Subset.refl _) hsub
#align mv_polynomial.vars_prod MvPolynomial.vars_prod
section EvalVars
variable [CommSemiring S]
| Mathlib/Algebra/MvPolynomial/Variables.lean | 248 | 274 | theorem eval₂Hom_eq_constantCoeff_of_vars (f : R →+* S) {g : σ → S} {p : MvPolynomial σ R}
(hp : ∀ i ∈ p.vars, g i = 0) : eval₂Hom f g p = f (constantCoeff p) := by |
conv_lhs => rw [p.as_sum]
simp only [map_sum, eval₂Hom_monomial]
by_cases h0 : constantCoeff p = 0
on_goal 1 =>
rw [h0, f.map_zero, Finset.sum_eq_zero]
intro d hd
on_goal 2 =>
rw [Finset.sum_eq_single (0 : σ →₀ ℕ)]
· rw [Finsupp.prod_zero_index, mul_one]
rfl
on_goal 1 => intro d hd hd0
on_goal 3 =>
rw [constantCoeff_eq, coeff, ← Ne, ← Finsupp.mem_support_iff] at h0
intro
contradiction
repeat'
obtain ⟨i, hi⟩ : Finset.Nonempty (Finsupp.support d) := by
rw [constantCoeff_eq, coeff, ← Finsupp.not_mem_support_iff] at h0
rw [Finset.nonempty_iff_ne_empty, Ne, Finsupp.support_eq_empty]
rintro rfl
contradiction
rw [Finsupp.prod, Finset.prod_eq_zero hi, mul_zero]
rw [hp, zero_pow (Finsupp.mem_support_iff.1 hi)]
rw [mem_vars]
exact ⟨d, hd, hi⟩
| [
" 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.MeasureTheory.Function.ConditionalExpectation.CondexpL1
#align_import measure_theory.function.conditional_expectation.basic from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e"
open TopologicalSpace MeasureTheory.Lp Filter
open scoped ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α F F' 𝕜 : 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']
open scoped Classical
variable {m m0 : MeasurableSpace α} {μ : Measure α} {f g : α → F'} {s : Set α}
noncomputable irreducible_def condexp (m : MeasurableSpace α) {m0 : MeasurableSpace α}
(μ : Measure α) (f : α → F') : α → F' :=
if hm : m ≤ m0 then
if h : SigmaFinite (μ.trim hm) ∧ Integrable f μ then
if StronglyMeasurable[m] f then f
else (@aestronglyMeasurable'_condexpL1 _ _ _ _ _ m m0 μ hm h.1 _).mk
(@condexpL1 _ _ _ _ _ _ _ hm μ h.1 f)
else 0
else 0
#align measure_theory.condexp MeasureTheory.condexp
-- We define notation `μ[f|m]` for the conditional expectation of `f` with respect to `m`.
scoped notation μ "[" f "|" m "]" => MeasureTheory.condexp m μ f
theorem condexp_of_not_le (hm_not : ¬m ≤ m0) : μ[f|m] = 0 := by rw [condexp, dif_neg hm_not]
#align measure_theory.condexp_of_not_le MeasureTheory.condexp_of_not_le
theorem condexp_of_not_sigmaFinite (hm : m ≤ m0) (hμm_not : ¬SigmaFinite (μ.trim hm)) :
μ[f|m] = 0 := by rw [condexp, dif_pos hm, dif_neg]; push_neg; exact fun h => absurd h hμm_not
#align measure_theory.condexp_of_not_sigma_finite MeasureTheory.condexp_of_not_sigmaFinite
| Mathlib/MeasureTheory/Function/ConditionalExpectation/Basic.lean | 113 | 123 | theorem condexp_of_sigmaFinite (hm : m ≤ m0) [hμm : SigmaFinite (μ.trim hm)] :
μ[f|m] =
if Integrable f μ then
if StronglyMeasurable[m] f then f
else aestronglyMeasurable'_condexpL1.mk (condexpL1 hm μ f)
else 0 := by |
rw [condexp, dif_pos hm]
simp only [hμm, Ne, true_and_iff]
by_cases hf : Integrable f μ
· rw [dif_pos hf, if_pos hf]
· rw [dif_neg hf, if_neg hf]
| [
" μ[f|m] = 0",
" ¬(SigmaFinite (μ.trim hm) ∧ Integrable f μ)",
" SigmaFinite (μ.trim hm) → ¬Integrable f μ",
" μ[f|m] =\n if Integrable f μ then if StronglyMeasurable f then f else AEStronglyMeasurable'.mk ↑↑(condexpL1 hm μ f) ⋯ else 0",
" (if h : SigmaFinite (μ.trim hm) ∧ Integrable f μ then\n if S... | [
" μ[f|m] = 0",
" ¬(SigmaFinite (μ.trim hm) ∧ Integrable f μ)",
" SigmaFinite (μ.trim hm) → ¬Integrable f μ"
] |
import Mathlib.Analysis.Convex.Cone.Basic
import Mathlib.Analysis.InnerProductSpace.Projection
#align_import analysis.convex.cone.dual from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open Set LinearMap
open scoped Classical
open Pointwise
variable {𝕜 E F G : Type*}
section Dual
variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (s t : Set H)
open RealInnerProductSpace
def Set.innerDualCone (s : Set H) : ConvexCone ℝ H where
carrier := { y | ∀ x ∈ s, 0 ≤ ⟪x, y⟫ }
smul_mem' c hc y hy x hx := by
rw [real_inner_smul_right]
exact mul_nonneg hc.le (hy x hx)
add_mem' u hu v hv x hx := by
rw [inner_add_right]
exact add_nonneg (hu x hx) (hv x hx)
#align set.inner_dual_cone Set.innerDualCone
@[simp]
theorem mem_innerDualCone (y : H) (s : Set H) : y ∈ s.innerDualCone ↔ ∀ x ∈ s, 0 ≤ ⟪x, y⟫ :=
Iff.rfl
#align mem_inner_dual_cone mem_innerDualCone
@[simp]
theorem innerDualCone_empty : (∅ : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ _ => False.elim
#align inner_dual_cone_empty innerDualCone_empty
@[simp]
theorem innerDualCone_zero : (0 : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ y (hy : y = 0) => hy.symm ▸ (inner_zero_left _).ge
#align inner_dual_cone_zero innerDualCone_zero
@[simp]
theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by
suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by
apply SetLike.coe_injective
exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩
exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _)
#align inner_dual_cone_univ innerDualCone_univ
theorem innerDualCone_le_innerDualCone (h : t ⊆ s) : s.innerDualCone ≤ t.innerDualCone :=
fun _ hy x hx => hy x (h hx)
#align inner_dual_cone_le_inner_dual_cone innerDualCone_le_innerDualCone
theorem pointed_innerDualCone : s.innerDualCone.Pointed := fun x _ => by rw [inner_zero_right]
#align pointed_inner_dual_cone pointed_innerDualCone
theorem innerDualCone_singleton (x : H) :
({x} : Set H).innerDualCone = (ConvexCone.positive ℝ ℝ).comap (innerₛₗ ℝ x) :=
ConvexCone.ext fun _ => forall_eq
#align inner_dual_cone_singleton innerDualCone_singleton
theorem innerDualCone_union (s t : Set H) :
(s ∪ t).innerDualCone = s.innerDualCone ⊓ t.innerDualCone :=
le_antisymm (le_inf (fun _ hx _ hy => hx _ <| Or.inl hy) fun _ hx _ hy => hx _ <| Or.inr hy)
fun _ hx _ => Or.rec (hx.1 _) (hx.2 _)
#align inner_dual_cone_union innerDualCone_union
theorem innerDualCone_insert (x : H) (s : Set H) :
(insert x s).innerDualCone = Set.innerDualCone {x} ⊓ s.innerDualCone := by
rw [insert_eq, innerDualCone_union]
#align inner_dual_cone_insert innerDualCone_insert
theorem innerDualCone_iUnion {ι : Sort*} (f : ι → Set H) :
(⋃ i, f i).innerDualCone = ⨅ i, (f i).innerDualCone := by
refine le_antisymm (le_iInf fun i x hx y hy => hx _ <| mem_iUnion_of_mem _ hy) ?_
intro x hx y hy
rw [ConvexCone.mem_iInf] at hx
obtain ⟨j, hj⟩ := mem_iUnion.mp hy
exact hx _ _ hj
#align inner_dual_cone_Union innerDualCone_iUnion
theorem innerDualCone_sUnion (S : Set (Set H)) :
(⋃₀ S).innerDualCone = sInf (Set.innerDualCone '' S) := by
simp_rw [sInf_image, sUnion_eq_biUnion, innerDualCone_iUnion]
#align inner_dual_cone_sUnion innerDualCone_sUnion
theorem innerDualCone_eq_iInter_innerDualCone_singleton :
(s.innerDualCone : Set H) = ⋂ i : s, (({↑i} : Set H).innerDualCone : Set H) := by
rw [← ConvexCone.coe_iInf, ← innerDualCone_iUnion, iUnion_of_singleton_coe]
#align inner_dual_cone_eq_Inter_inner_dual_cone_singleton innerDualCone_eq_iInter_innerDualCone_singleton
| Mathlib/Analysis/Convex/Cone/InnerDual.lean | 130 | 140 | theorem isClosed_innerDualCone : IsClosed (s.innerDualCone : Set H) := by |
-- reduce the problem to showing that dual cone of a singleton `{x}` is closed
rw [innerDualCone_eq_iInter_innerDualCone_singleton]
apply isClosed_iInter
intro x
-- the dual cone of a singleton `{x}` is the preimage of `[0, ∞)` under `inner x`
have h : ({↑x} : Set H).innerDualCone = (inner x : H → ℝ) ⁻¹' Set.Ici 0 := by
rw [innerDualCone_singleton, ConvexCone.coe_comap, ConvexCone.coe_positive, innerₛₗ_apply_coe]
-- the preimage is closed as `inner x` is continuous and `[0, ∞)` is closed
rw [h]
exact isClosed_Ici.preimage (continuous_const.inner continuous_id')
| [
" 0 ≤ ⟪x, c • y⟫_ℝ",
" 0 ≤ c * ⟪x, y⟫_ℝ",
" 0 ≤ ⟪x, u + v⟫_ℝ",
" 0 ≤ ⟪x, u⟫_ℝ + ⟪x, v⟫_ℝ",
" univ.innerDualCone = 0",
" ↑univ.innerDualCone = ↑0",
" ∀ x ∈ univ.innerDualCone, x = 0",
" x = 0",
" 0 ≤ ⟪x, 0⟫_ℝ",
" (insert x s).innerDualCone = {x}.innerDualCone ⊓ s.innerDualCone",
" (⋃ i, f i).inne... | [
" 0 ≤ ⟪x, c • y⟫_ℝ",
" 0 ≤ c * ⟪x, y⟫_ℝ",
" 0 ≤ ⟪x, u + v⟫_ℝ",
" 0 ≤ ⟪x, u⟫_ℝ + ⟪x, v⟫_ℝ",
" univ.innerDualCone = 0",
" ↑univ.innerDualCone = ↑0",
" ∀ x ∈ univ.innerDualCone, x = 0",
" x = 0",
" 0 ≤ ⟪x, 0⟫_ℝ",
" (insert x s).innerDualCone = {x}.innerDualCone ⊓ s.innerDualCone",
" (⋃ i, f i).inne... |
import Mathlib.LinearAlgebra.Basis.VectorSpace
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.SetTheory.Cardinal.Subfield
import Mathlib.LinearAlgebra.Dimension.RankNullity
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u₀ u v v' v'' u₁' w w'
variable {K R : Type u} {V V₁ V₂ V₃ : Type v} {V' V'₁ : Type v'} {V'' : Type v''}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set
section Module
section Basis
open FiniteDimensional
variable [DivisionRing K] [AddCommGroup V] [Module K V]
theorem linearIndependent_of_top_le_span_of_card_eq_finrank {ι : Type*} [Fintype ι] {b : ι → V}
(spans : ⊤ ≤ span K (Set.range b)) (card_eq : Fintype.card ι = finrank K V) :
LinearIndependent K b :=
linearIndependent_iff'.mpr fun s g dependent i i_mem_s => by
classical
by_contra gx_ne_zero
-- We'll derive a contradiction by showing `b '' (univ \ {i})` of cardinality `n - 1`
-- spans a vector space of dimension `n`.
refine not_le_of_gt (span_lt_top_of_card_lt_finrank
(show (b '' (Set.univ \ {i})).toFinset.card < finrank K V from ?_)) ?_
· calc
(b '' (Set.univ \ {i})).toFinset.card = ((Set.univ \ {i}).toFinset.image b).card := by
rw [Set.toFinset_card, Fintype.card_ofFinset]
_ ≤ (Set.univ \ {i}).toFinset.card := Finset.card_image_le
_ = (Finset.univ.erase i).card := (congr_arg Finset.card (Finset.ext (by simp [and_comm])))
_ < Finset.univ.card := Finset.card_erase_lt_of_mem (Finset.mem_univ i)
_ = finrank K V := card_eq
-- We already have that `b '' univ` spans the whole space,
-- so we only need to show that the span of `b '' (univ \ {i})` contains each `b j`.
refine spans.trans (span_le.mpr ?_)
rintro _ ⟨j, rfl, rfl⟩
-- The case that `j ≠ i` is easy because `b j ∈ b '' (univ \ {i})`.
by_cases j_eq : j = i
swap
· refine subset_span ⟨j, (Set.mem_diff _).mpr ⟨Set.mem_univ _, ?_⟩, rfl⟩
exact mt Set.mem_singleton_iff.mp j_eq
-- To show `b i ∈ span (b '' (univ \ {i}))`, we use that it's a weighted sum
-- of the other `b j`s.
rw [j_eq, SetLike.mem_coe, show b i = -((g i)⁻¹ • (s.erase i).sum fun j => g j • b j) from _]
· refine neg_mem (smul_mem _ _ (sum_mem fun k hk => ?_))
obtain ⟨k_ne_i, _⟩ := Finset.mem_erase.mp hk
refine smul_mem _ _ (subset_span ⟨k, ?_, rfl⟩)
simp_all only [Set.mem_univ, Set.mem_diff, Set.mem_singleton_iff, and_self, not_false_eq_true]
-- To show `b i` is a weighted sum of the other `b j`s, we'll rewrite this sum
-- to have the form of the assumption `dependent`.
apply eq_neg_of_add_eq_zero_left
calc
(b i + (g i)⁻¹ • (s.erase i).sum fun j => g j • b j) =
(g i)⁻¹ • (g i • b i + (s.erase i).sum fun j => g j • b j) := by
rw [smul_add, ← mul_smul, inv_mul_cancel gx_ne_zero, one_smul]
_ = (g i)⁻¹ • (0 : V) := congr_arg _ ?_
_ = 0 := smul_zero _
-- And then it's just a bit of manipulation with finite sums.
rwa [← Finset.insert_erase i_mem_s, Finset.sum_insert (Finset.not_mem_erase _ _)] at dependent
#align linear_independent_of_top_le_span_of_card_eq_finrank linearIndependent_of_top_le_span_of_card_eq_finrank
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
constructor
· intro h
exact (finrank_span_eq_card h).symm
· intro hc
let f := Submodule.subtype (span K (Set.range b))
let b' : ι → span K (Set.range b) := fun i =>
⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
have hs : ⊤ ≤ span K (Set.range b') := by
intro x
have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f
have hf : f '' Set.range b' = Set.range b := by
ext x
simp [f, Set.mem_image, Set.mem_range]
rw [hf] at h
have hx : (x : V) ∈ span K (Set.range b) := x.property
conv at hx =>
arg 2
rw [h]
simpa [f, mem_map] using hx
have hi : LinearMap.ker f = ⊥ := ker_subtype _
convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi
#align linear_independent_iff_card_eq_finrank_span linearIndependent_iff_card_eq_finrank_span
| Mathlib/LinearAlgebra/Dimension/DivisionRing.lean | 196 | 198 | theorem linearIndependent_iff_card_le_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
LinearIndependent K b ↔ Fintype.card ι ≤ (Set.range b).finrank K := by |
rw [linearIndependent_iff_card_eq_finrank_span, (finrank_range_le_card _).le_iff_eq]
| [
" g i = 0",
" False",
" (b '' (Set.univ \\ {i})).toFinset.card < finrank K V",
" (b '' (Set.univ \\ {i})).toFinset.card = (Finset.image b (Set.univ \\ {i}).toFinset).card",
" ∀ (a : ι), a ∈ (Set.univ \\ {i}).toFinset ↔ a ∈ Finset.univ.erase i",
" ⊤ ≤ span K (b '' (Set.univ \\ {i}))",
" range b ⊆ ↑(span ... | [
" g i = 0",
" False",
" (b '' (Set.univ \\ {i})).toFinset.card < finrank K V",
" (b '' (Set.univ \\ {i})).toFinset.card = (Finset.image b (Set.univ \\ {i}).toFinset).card",
" ∀ (a : ι), a ∈ (Set.univ \\ {i}).toFinset ↔ a ∈ Finset.univ.erase i",
" ⊤ ≤ span K (b '' (Set.univ \\ {i}))",
" range b ⊆ ↑(span ... |
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {α : Type*} {β : Type v} {γ δ : Type*}
namespace Multiset
def join : Multiset (Multiset α) → Multiset α :=
sum
#align multiset.join Multiset.join
theorem coe_join :
∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join α 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join α (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join α S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
theorem map_join (f : α → β) (S : Multiset (Multiset α)) :
map f (join S) = join (map (map f) S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
@[to_additive (attr := simp)]
theorem prod_join [CommMonoid α] {S : Multiset (Multiset α)} :
prod (join S) = prod (map prod S) := by
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
theorem rel_join {r : α → β → Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by
induction h with
| zero => simp
| cons hab hst ih => simpa using hab.add ih
#align multiset.rel_join Multiset.rel_join
section Bind
variable (a : α) (s t : Multiset α) (f g : α → Multiset β)
def bind (s : Multiset α) (f : α → Multiset β) : Multiset β :=
(s.map f).join
#align multiset.bind Multiset.bind
@[simp]
theorem coe_bind (l : List α) (f : α → List β) : (@bind α β l fun a => f a) = l.bind f := by
rw [List.bind, ← coe_join, List.map_map]
rfl
#align multiset.coe_bind Multiset.coe_bind
@[simp]
theorem zero_bind : bind 0 f = 0 :=
rfl
#align multiset.zero_bind Multiset.zero_bind
@[simp]
theorem cons_bind : (a ::ₘ s).bind f = f a + s.bind f := by simp [bind]
#align multiset.cons_bind Multiset.cons_bind
@[simp]
theorem singleton_bind : bind {a} f = f a := by simp [bind]
#align multiset.singleton_bind Multiset.singleton_bind
@[simp]
theorem add_bind : (s + t).bind f = s.bind f + t.bind f := by simp [bind]
#align multiset.add_bind Multiset.add_bind
@[simp]
theorem bind_zero : s.bind (fun _ => 0 : α → Multiset β) = 0 := by simp [bind, join, nsmul_zero]
#align multiset.bind_zero Multiset.bind_zero
@[simp]
theorem bind_add : (s.bind fun a => f a + g a) = s.bind f + s.bind g := by simp [bind, join]
#align multiset.bind_add Multiset.bind_add
@[simp]
theorem bind_cons (f : α → β) (g : α → Multiset β) :
(s.bind fun a => f a ::ₘ g a) = map f s + s.bind g :=
Multiset.induction_on s (by simp)
(by simp (config := { contextual := true }) [add_comm, add_left_comm, add_assoc])
#align multiset.bind_cons Multiset.bind_cons
@[simp]
theorem bind_singleton (f : α → β) : (s.bind fun x => ({f x} : Multiset β)) = map f s :=
Multiset.induction_on s (by rw [zero_bind, map_zero]) (by simp [singleton_add])
#align multiset.bind_singleton Multiset.bind_singleton
@[simp]
theorem mem_bind {b s} {f : α → Multiset β} : b ∈ bind s f ↔ ∃ a ∈ s, b ∈ f a := by
simp [bind]
#align multiset.mem_bind Multiset.mem_bind
@[simp]
theorem card_bind : card (s.bind f) = (s.map (card ∘ f)).sum := by simp [bind]
#align multiset.card_bind Multiset.card_bind
theorem bind_congr {f g : α → Multiset β} {m : Multiset α} :
(∀ a ∈ m, f a = g a) → bind m f = bind m g := by simp (config := { contextual := true }) [bind]
#align multiset.bind_congr Multiset.bind_congr
| Mathlib/Data/Multiset/Bind.lean | 170 | 174 | theorem bind_hcongr {β' : Type v} {m : Multiset α} {f : α → Multiset β} {f' : α → Multiset β'}
(h : β = β') (hf : ∀ a ∈ m, HEq (f a) (f' a)) : HEq (bind m f) (bind m f') := by |
subst h
simp only [heq_eq_eq] at hf
simp [bind_congr hf]
| [
" (↑(List.map ofList (l :: L))).join = ↑(l :: L).join",
" a ∈ join 0 ↔ ∃ s ∈ 0, a ∈ s",
" ∀ (a_1 : Multiset α) (s : Multiset (Multiset α)),\n (a ∈ s.join ↔ ∃ s_1 ∈ s, a ∈ s_1) → (a ∈ (a_1 ::ₘ s).join ↔ ∃ s_1 ∈ a_1 ::ₘ s, a ∈ s_1)",
" card (join 0) = (map (⇑card) 0).sum",
" ∀ (a : Multiset α) (s : Multise... | [
" (↑(List.map ofList (l :: L))).join = ↑(l :: L).join",
" a ∈ join 0 ↔ ∃ s ∈ 0, a ∈ s",
" ∀ (a_1 : Multiset α) (s : Multiset (Multiset α)),\n (a ∈ s.join ↔ ∃ s_1 ∈ s, a ∈ s_1) → (a ∈ (a_1 ::ₘ s).join ↔ ∃ s_1 ∈ a_1 ::ₘ s, a ∈ s_1)",
" card (join 0) = (map (⇑card) 0).sum",
" ∀ (a : Multiset α) (s : Multise... |
import Mathlib.CategoryTheory.Category.Grpd
import Mathlib.CategoryTheory.Groupoid
import Mathlib.Topology.Category.TopCat.Basic
import Mathlib.Topology.Homotopy.Path
import Mathlib.Data.Set.Subsingleton
#align_import algebraic_topology.fundamental_groupoid.basic from "leanprover-community/mathlib"@"3d7987cda72abc473c7cdbbb075170e9ac620042"
open CategoryTheory
universe u v
variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y]
variable {x₀ x₁ : X}
noncomputable section
open unitInterval
namespace Path
namespace Homotopy
section
def reflTransSymmAux (x : I × I) : ℝ :=
if (x.2 : ℝ) ≤ 1 / 2 then x.1 * 2 * x.2 else x.1 * (2 - 2 * x.2)
#align path.homotopy.refl_trans_symm_aux Path.Homotopy.reflTransSymmAux
@[continuity]
theorem continuous_reflTransSymmAux : Continuous reflTransSymmAux := by
refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_
· continuity
· continuity
· continuity
· continuity
intro x hx
norm_num [hx, mul_assoc]
#align path.homotopy.continuous_refl_trans_symm_aux Path.Homotopy.continuous_reflTransSymmAux
theorem reflTransSymmAux_mem_I (x : I × I) : reflTransSymmAux x ∈ I := by
dsimp only [reflTransSymmAux]
split_ifs
· constructor
· apply mul_nonneg
· apply mul_nonneg
· unit_interval
· norm_num
· unit_interval
· rw [mul_assoc]
apply mul_le_one
· unit_interval
· apply mul_nonneg
· norm_num
· unit_interval
· linarith
· constructor
· apply mul_nonneg
· unit_interval
linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· apply mul_le_one
· unit_interval
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
· linarith [unitInterval.nonneg x.2, unitInterval.le_one x.2]
set_option linter.uppercaseLean3 false in
#align path.homotopy.refl_trans_symm_aux_mem_I Path.Homotopy.reflTransSymmAux_mem_I
def reflTransSymm (p : Path x₀ x₁) : Homotopy (Path.refl x₀) (p.trans p.symm) where
toFun x := p ⟨reflTransSymmAux x, reflTransSymmAux_mem_I x⟩
continuous_toFun := by continuity
map_zero_left := by simp [reflTransSymmAux]
map_one_left x := by
dsimp only [reflTransSymmAux, Path.coe_toContinuousMap, Path.trans]
change _ = ite _ _ _
split_ifs with h
· rw [Path.extend, Set.IccExtend_of_mem]
· norm_num
· rw [unitInterval.mul_pos_mem_iff zero_lt_two]
exact ⟨unitInterval.nonneg x, h⟩
· rw [Path.symm, Path.extend, Set.IccExtend_of_mem]
· simp only [Set.Icc.coe_one, one_mul, coe_mk_mk, Function.comp_apply]
congr 1
ext
norm_num [sub_sub_eq_add_sub]
· rw [unitInterval.two_mul_sub_one_mem_iff]
exact ⟨(not_le.1 h).le, unitInterval.le_one x⟩
prop' t x hx := by
simp only [Set.mem_singleton_iff, Set.mem_insert_iff] at hx
simp only [ContinuousMap.coe_mk, coe_toContinuousMap, Path.refl_apply]
cases hx with
| inl hx
| inr hx =>
set_option tactic.skipAssignedInstances false in
rw [hx]
norm_num [reflTransSymmAux]
#align path.homotopy.refl_trans_symm Path.Homotopy.reflTransSymm
def reflSymmTrans (p : Path x₀ x₁) : Homotopy (Path.refl x₁) (p.symm.trans p) :=
(reflTransSymm p.symm).cast rfl <| congr_arg _ (Path.symm_symm _)
#align path.homotopy.refl_symm_trans Path.Homotopy.reflSymmTrans
end
section Assoc
def transAssocReparamAux (t : I) : ℝ :=
if (t : ℝ) ≤ 1 / 4 then 2 * t else if (t : ℝ) ≤ 1 / 2 then t + 1 / 4 else 1 / 2 * (t + 1)
#align path.homotopy.trans_assoc_reparam_aux Path.Homotopy.transAssocReparamAux
@[continuity]
theorem continuous_transAssocReparamAux : Continuous transAssocReparamAux := by
refine continuous_if_le ?_ ?_ (Continuous.continuousOn ?_)
(continuous_if_le ?_ ?_
(Continuous.continuousOn ?_) (Continuous.continuousOn ?_) ?_).continuousOn
?_ <;>
[continuity; continuity; continuity; continuity; continuity; continuity; continuity; skip;
skip] <;>
· intro x hx
set_option tactic.skipAssignedInstances false in norm_num [hx]
#align path.homotopy.continuous_trans_assoc_reparam_aux Path.Homotopy.continuous_transAssocReparamAux
theorem transAssocReparamAux_mem_I (t : I) : transAssocReparamAux t ∈ I := by
unfold transAssocReparamAux
split_ifs <;> constructor <;> linarith [unitInterval.le_one t, unitInterval.nonneg t]
set_option linter.uppercaseLean3 false in
#align path.homotopy.trans_assoc_reparam_aux_mem_I Path.Homotopy.transAssocReparamAux_mem_I
theorem transAssocReparamAux_zero : transAssocReparamAux 0 = 0 := by
set_option tactic.skipAssignedInstances false in norm_num [transAssocReparamAux]
#align path.homotopy.trans_assoc_reparam_aux_zero Path.Homotopy.transAssocReparamAux_zero
theorem transAssocReparamAux_one : transAssocReparamAux 1 = 1 := by
set_option tactic.skipAssignedInstances false in norm_num [transAssocReparamAux]
#align path.homotopy.trans_assoc_reparam_aux_one Path.Homotopy.transAssocReparamAux_one
| Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean | 214 | 253 | theorem trans_assoc_reparam {x₀ x₁ x₂ x₃ : X} (p : Path x₀ x₁) (q : Path x₁ x₂) (r : Path x₂ x₃) :
(p.trans q).trans r =
(p.trans (q.trans r)).reparam
(fun t => ⟨transAssocReparamAux t, transAssocReparamAux_mem_I t⟩) (by continuity)
(Subtype.ext transAssocReparamAux_zero) (Subtype.ext transAssocReparamAux_one) := by |
ext x
simp only [transAssocReparamAux, Path.trans_apply, mul_inv_cancel_left₀, not_le,
Function.comp_apply, Ne, not_false_iff, bit0_eq_zero, one_ne_zero, mul_ite, Subtype.coe_mk,
Path.coe_reparam]
-- TODO: why does split_ifs not reduce the ifs??????
split_ifs with h₁ h₂ h₃ h₄ h₅
· rfl
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· have h : 2 * (2 * (x : ℝ)) - 1 = 2 * (2 * (↑x + 1 / 4) - 1) := by linarith
simp [h₂, h₁, h, dif_neg (show ¬False from id), dif_pos True.intro, if_false, if_true]
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· exfalso
linarith
· congr
ring
| [
" Continuous reflTransSymmAux",
" Continuous fun x => ↑x.2",
" Continuous fun x => 1 / 2",
" Continuous fun x => ↑x.1 * 2 * ↑x.2",
" Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)",
" ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ref... | [
" Continuous reflTransSymmAux",
" Continuous fun x => ↑x.2",
" Continuous fun x => 1 / 2",
" Continuous fun x => ↑x.1 * 2 * ↑x.2",
" Continuous fun x => ↑x.1 * (2 - 2 * ↑x.2)",
" ∀ (x : ↑I × ↑I), ↑x.2 = 1 / 2 → ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ↑x.1 * 2 * ↑x.2 = ↑x.1 * (2 - 2 * ↑x.2)",
" ref... |
import Mathlib.Analysis.BoxIntegral.Box.Basic
import Mathlib.Analysis.SpecificLimits.Basic
#align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Finset Function Filter Metric Classical Topology Filter ENNReal
noncomputable section
namespace BoxIntegral
namespace Box
variable {ι : Type*} {I J : Box ι}
def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where
lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower
upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2
lower_lt_upper i := by
dsimp only [Set.piecewise]
split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper]
#align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox
theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} :
y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by
simp only [splitCenterBox, mem_def, ← forall_and]
refine forall_congr' fun i ↦ ?_
dsimp only [Set.piecewise]
split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt]
exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩,
fun H ↦ ⟨H.2, H.1.2⟩⟩,
⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩,
fun H ↦ ⟨H.1.1, H.2⟩⟩]
#align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox
theorem splitCenterBox_le (I : Box ι) (s : Set ι) : I.splitCenterBox s ≤ I :=
fun _ hx ↦ (mem_splitCenterBox.1 hx).1
#align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le
| Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean | 69 | 75 | theorem disjoint_splitCenterBox (I : Box ι) {s t : Set ι} (h : s ≠ t) :
Disjoint (I.splitCenterBox s : Set (ι → ℝ)) (I.splitCenterBox t) := by |
rw [disjoint_iff_inf_le]
rintro y ⟨hs, ht⟩; apply h
ext i
rw [mem_coe, mem_splitCenterBox] at hs ht
rw [← hs.2, ← ht.2]
| [
" s.piecewise (fun i => (I.lower i + I.upper i) / 2) I.lower i <\n s.piecewise I.upper (fun i => (I.lower i + I.upper i) / 2) i",
" (if i ∈ s then (I.lower i + I.upper i) / 2 else I.lower i) < if i ∈ s then I.upper i else (I.lower i + I.upper i) / 2",
" (I.lower i + I.upper i) / 2 < I.upper i",
" I.lower i... | [
" s.piecewise (fun i => (I.lower i + I.upper i) / 2) I.lower i <\n s.piecewise I.upper (fun i => (I.lower i + I.upper i) / 2) i",
" (if i ∈ s then (I.lower i + I.upper i) / 2 else I.lower i) < if i ∈ s then I.upper i else (I.lower i + I.upper i) / 2",
" (I.lower i + I.upper i) / 2 < I.upper i",
" I.lower i... |
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
#align_import linear_algebra.affine_space.pointwise from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840"
open Affine Pointwise
open Set
namespace AffineSubspace
variable {k : Type*} [Ring k]
variable {V P V₁ P₁ V₂ P₂ : Type*}
variable [AddCommGroup V] [Module k V] [AffineSpace V P]
variable [AddCommGroup V₁] [Module k V₁] [AddTorsor V₁ P₁]
variable [AddCommGroup V₂] [Module k V₂] [AddTorsor V₂ P₂]
protected def pointwiseAddAction : AddAction V (AffineSubspace k P) where
vadd x S := S.map (AffineEquiv.constVAdd k P x)
zero_vadd p := ((congr_arg fun f => p.map f) <| AffineMap.ext <| zero_vadd _).trans p.map_id
add_vadd _ _ p :=
((congr_arg fun f => p.map f) <| AffineMap.ext <| add_vadd _ _).trans (p.map_map _ _).symm
#align affine_subspace.pointwise_add_action AffineSubspace.pointwiseAddAction
scoped[Pointwise] attribute [instance] AffineSubspace.pointwiseAddAction
open Pointwise
-- Porting note (#10756): new theorem
theorem pointwise_vadd_eq_map (v : V) (s : AffineSubspace k P) :
v +ᵥ s = s.map (AffineEquiv.constVAdd k P v) :=
rfl
@[simp]
theorem coe_pointwise_vadd (v : V) (s : AffineSubspace k P) :
((v +ᵥ s : AffineSubspace k P) : Set P) = v +ᵥ (s : Set P) :=
rfl
#align affine_subspace.coe_pointwise_vadd AffineSubspace.coe_pointwise_vadd
theorem vadd_mem_pointwise_vadd_iff {v : V} {s : AffineSubspace k P} {p : P} :
v +ᵥ p ∈ v +ᵥ s ↔ p ∈ s :=
vadd_mem_vadd_set_iff
#align affine_subspace.vadd_mem_pointwise_vadd_iff AffineSubspace.vadd_mem_pointwise_vadd_iff
theorem pointwise_vadd_bot (v : V) : v +ᵥ (⊥ : AffineSubspace k P) = ⊥ := by
ext; simp [pointwise_vadd_eq_map, map_bot]
#align affine_subspace.pointwise_vadd_bot AffineSubspace.pointwise_vadd_bot
theorem pointwise_vadd_direction (v : V) (s : AffineSubspace k P) :
(v +ᵥ s).direction = s.direction := by
rw [pointwise_vadd_eq_map, map_direction]
exact Submodule.map_id _
#align affine_subspace.pointwise_vadd_direction AffineSubspace.pointwise_vadd_direction
theorem pointwise_vadd_span (v : V) (s : Set P) : v +ᵥ affineSpan k s = affineSpan k (v +ᵥ s) :=
map_span _ s
#align affine_subspace.pointwise_vadd_span AffineSubspace.pointwise_vadd_span
| Mathlib/LinearAlgebra/AffineSpace/Pointwise.lean | 74 | 79 | theorem map_pointwise_vadd (f : P₁ →ᵃ[k] P₂) (v : V₁) (s : AffineSubspace k P₁) :
(v +ᵥ s).map f = f.linear v +ᵥ s.map f := by |
erw [pointwise_vadd_eq_map, pointwise_vadd_eq_map, map_map, map_map]
congr 1
ext
exact f.map_vadd _ _
| [
" v +ᵥ ⊥ = ⊥",
" x✝ ∈ v +ᵥ ⊥ ↔ x✝ ∈ ⊥",
" (v +ᵥ s).direction = s.direction",
" Submodule.map (↑(AffineEquiv.constVAdd k P v)).linear s.direction = s.direction",
" map f (v +ᵥ s) = f.linear v +ᵥ map f s",
" map (f.comp ↑(AffineEquiv.constVAdd k P₁ v)) s = map ((↑(AffineEquiv.constVAdd k P₂ (f.linear v))).c... | [
" v +ᵥ ⊥ = ⊥",
" x✝ ∈ v +ᵥ ⊥ ↔ x✝ ∈ ⊥",
" (v +ᵥ s).direction = s.direction",
" Submodule.map (↑(AffineEquiv.constVAdd k P v)).linear s.direction = s.direction"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.