Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.57k | proof stringlengths 5 7.36k | hint bool 2 classes |
|---|---|---|---|---|---|---|
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
calc
cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm
_ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos]
_ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)]
_ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm
_ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)]
constructor <;> · rintro ⟨k, rfl⟩; use -k; simp
_ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm
#align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff
theorem sin_eq_sin_iff {x y : ℂ} :
sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by
simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add]
refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring
#align complex.sin_eq_sin_iff Complex.sin_eq_sin_iff
theorem cos_eq_one_iff {x : ℂ} : cos x = 1 ↔ ∃ k : ℤ, k * (2 * π) = x := by
rw [← cos_zero, eq_comm, cos_eq_cos_iff]
simp [mul_assoc, mul_left_comm, eq_comm]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 114 | 116 | theorem cos_eq_neg_one_iff {x : ℂ} : cos x = -1 ↔ ∃ k : ℤ, π + k * (2 * π) = x := by |
rw [← neg_eq_iff_eq_neg, ← cos_sub_pi, cos_eq_one_iff]
simp only [eq_sub_iff_add_eq']
| false |
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.NormedSpace.Banach
import Mathlib.LinearAlgebra.SesquilinearForm
#align_import analysis.inner_product_space.symmetric from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open RCLike
open ComplexConjugate
variable {𝕜 E E' F G : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F]
variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G]
variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E']
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
namespace LinearMap
def IsSymmetric (T : E →ₗ[𝕜] E) : Prop :=
∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫
#align linear_map.is_symmetric LinearMap.IsSymmetric
theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) :
conj ⟪T x, y⟫ = ⟪T y, x⟫ := by rw [hT x y, inner_conj_symm]
#align linear_map.is_symmetric.conj_inner_sym LinearMap.IsSymmetric.conj_inner_sym
@[simp]
theorem IsSymmetric.apply_clm {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x y : E) :
⟪T x, y⟫ = ⟪x, T y⟫ :=
hT x y
#align linear_map.is_symmetric.apply_clm LinearMap.IsSymmetric.apply_clm
theorem isSymmetric_zero : (0 : E →ₗ[𝕜] E).IsSymmetric := fun x y =>
(inner_zero_right x : ⟪x, 0⟫ = 0).symm ▸ (inner_zero_left y : ⟪0, y⟫ = 0)
#align linear_map.is_symmetric_zero LinearMap.isSymmetric_zero
theorem isSymmetric_id : (LinearMap.id : E →ₗ[𝕜] E).IsSymmetric := fun _ _ => rfl
#align linear_map.is_symmetric_id LinearMap.isSymmetric_id
theorem IsSymmetric.add {T S : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (hS : S.IsSymmetric) :
(T + S).IsSymmetric := by
intro x y
rw [LinearMap.add_apply, inner_add_left, hT x y, hS x y, ← inner_add_right]
rfl
#align linear_map.is_symmetric.add LinearMap.IsSymmetric.add
| Mathlib/Analysis/InnerProductSpace/Symmetric.lean | 97 | 110 | theorem IsSymmetric.continuous [CompleteSpace E] {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) :
Continuous T := by |
-- We prove it by using the closed graph theorem
refine T.continuous_of_seq_closed_graph fun u x y hu hTu => ?_
rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜]
have hlhs : ∀ k : ℕ, ⟪T (u k) - T x, y - T x⟫ = ⟪u k - x, T (y - T x)⟫ := by
intro k
rw [← T.map_sub, hT]
refine tendsto_nhds_unique ((hTu.sub_const _).inner tendsto_const_nhds) ?_
simp_rw [Function.comp_apply, hlhs]
rw [← inner_zero_left (T (y - T x))]
refine Filter.Tendsto.inner ?_ tendsto_const_nhds
rw [← sub_self x]
exact hu.sub_const _
| false |
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.PEquiv
#align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
namespace PEquiv
open Matrix
universe u v
variable {k l m n : Type*}
variable {α : Type v}
open Matrix
def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α :=
of fun i j => if j ∈ f i then (1 : α) else 0
#align pequiv.to_matrix PEquiv.toMatrix
-- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024
@[simp]
theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) :
toMatrix f i j = if j ∈ f i then (1 : α) else 0 :=
rfl
#align pequiv.to_matrix_apply PEquiv.toMatrix_apply
theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α)
(i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f i with fi
· simp [h]
· rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm]
#align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply
theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
(f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by
ext
simp only [transpose, mem_iff_mem f, toMatrix_apply]
congr
#align pequiv.to_matrix_symm PEquiv.toMatrix_symm
@[simp]
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] :
((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by
ext
simp [toMatrix_apply, one_apply]
#align pequiv.to_matrix_refl PEquiv.toMatrix_refl
theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n)
(i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f.symm j with fj
· simp [h, ← f.eq_some_iff]
· rw [Finset.sum_eq_single fj]
· simp [h, ← f.eq_some_iff]
· rintro b - n
simp [h, ← f.eq_some_iff, n.symm]
· simp
#align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply
theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m)
(M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by
ext i j
rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id]
#align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix
theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n)
(M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm :=
Matrix.ext fun i j => by
rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply,
Matrix.submatrix_apply, id]
#align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix
theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m)
(g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix := by
ext i j
rw [mul_matrix_apply]
dsimp [toMatrix, PEquiv.trans]
cases f i <;> simp
#align pequiv.to_matrix_trans PEquiv.toMatrix_trans
@[simp]
theorem toMatrix_bot [DecidableEq n] [Zero α] [One α] :
((⊥ : PEquiv m n).toMatrix : Matrix m n α) = 0 :=
rfl
#align pequiv.to_matrix_bot PEquiv.toMatrix_bot
| Mathlib/Data/Matrix/PEquiv.lean | 123 | 139 | theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
Function.Injective (@toMatrix m n α _ _ _) := by |
classical
intro f g
refine not_imp_not.1 ?_
simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
intro i hi
use i
cases' hf : f i with fi
· cases' hg : g i with gi
-- Porting note: was `cc`
· rw [hf, hg] at hi
exact (hi rfl).elim
· use gi
simp
· use fi
simp [hf.symm, Ne.symm hi]
| false |
import Mathlib.Algebra.Lie.Subalgebra
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.Artinian
#align_import algebra.lie.submodule from "leanprover-community/mathlib"@"9822b65bfc4ac74537d77ae318d27df1df662471"
universe u v w w₁ w₂
section LieSubmodule
variable (R : Type u) (L : Type v) (M : Type w)
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
structure LieSubmodule extends Submodule R M where
lie_mem : ∀ {x : L} {m : M}, m ∈ carrier → ⁅x, m⁆ ∈ carrier
#align lie_submodule LieSubmodule
attribute [nolint docBlame] LieSubmodule.toSubmodule
attribute [coe] LieSubmodule.toSubmodule
namespace LieSubmodule
variable {R L M}
variable (N N' : LieSubmodule R L M)
instance : SetLike (LieSubmodule R L M) M where
coe s := s.carrier
coe_injective' N O h := by cases N; cases O; congr; exact SetLike.coe_injective' h
instance : AddSubgroupClass (LieSubmodule R L M) M where
add_mem {N} _ _ := N.add_mem'
zero_mem N := N.zero_mem'
neg_mem {N} x hx := show -x ∈ N.toSubmodule from neg_mem hx
instance instSMulMemClass : SMulMemClass (LieSubmodule R L M) R M where
smul_mem {s} c _ h := s.smul_mem' c h
instance : Zero (LieSubmodule R L M) :=
⟨{ (0 : Submodule R M) with
lie_mem := fun {x m} h ↦ by rw [(Submodule.mem_bot R).1 h]; apply lie_zero }⟩
instance : Inhabited (LieSubmodule R L M) :=
⟨0⟩
instance coeSubmodule : CoeOut (LieSubmodule R L M) (Submodule R M) :=
⟨toSubmodule⟩
#align lie_submodule.coe_submodule LieSubmodule.coeSubmodule
-- Syntactic tautology
#noalign lie_submodule.to_submodule_eq_coe
@[norm_cast]
theorem coe_toSubmodule : ((N : Submodule R M) : Set M) = N :=
rfl
#align lie_submodule.coe_to_submodule LieSubmodule.coe_toSubmodule
-- Porting note (#10618): `simp` can prove this after `mem_coeSubmodule` is added to the simp set,
-- but `dsimp` can't.
@[simp, nolint simpNF]
theorem mem_carrier {x : M} : x ∈ N.carrier ↔ x ∈ (N : Set M) :=
Iff.rfl
#align lie_submodule.mem_carrier LieSubmodule.mem_carrier
theorem mem_mk_iff (S : Set M) (h₁ h₂ h₃ h₄) {x : M} :
x ∈ (⟨⟨⟨⟨S, h₁⟩, h₂⟩, h₃⟩, h₄⟩ : LieSubmodule R L M) ↔ x ∈ S :=
Iff.rfl
#align lie_submodule.mem_mk_iff LieSubmodule.mem_mk_iff
@[simp]
theorem mem_mk_iff' (p : Submodule R M) (h) {x : M} :
x ∈ (⟨p, h⟩ : LieSubmodule R L M) ↔ x ∈ p :=
Iff.rfl
@[simp]
theorem mem_coeSubmodule {x : M} : x ∈ (N : Submodule R M) ↔ x ∈ N :=
Iff.rfl
#align lie_submodule.mem_coe_submodule LieSubmodule.mem_coeSubmodule
theorem mem_coe {x : M} : x ∈ (N : Set M) ↔ x ∈ N :=
Iff.rfl
#align lie_submodule.mem_coe LieSubmodule.mem_coe
@[simp]
protected theorem zero_mem : (0 : M) ∈ N :=
zero_mem N
#align lie_submodule.zero_mem LieSubmodule.zero_mem
-- Porting note (#10618): @[simp] can prove this
theorem mk_eq_zero {x} (h : x ∈ N) : (⟨x, h⟩ : N) = 0 ↔ x = 0 :=
Subtype.ext_iff_val
#align lie_submodule.mk_eq_zero LieSubmodule.mk_eq_zero
@[simp]
theorem coe_toSet_mk (S : Set M) (h₁ h₂ h₃ h₄) :
((⟨⟨⟨⟨S, h₁⟩, h₂⟩, h₃⟩, h₄⟩ : LieSubmodule R L M) : Set M) = S :=
rfl
#align lie_submodule.coe_to_set_mk LieSubmodule.coe_toSet_mk
| Mathlib/Algebra/Lie/Submodule.lean | 132 | 133 | theorem coe_toSubmodule_mk (p : Submodule R M) (h) :
(({ p with lie_mem := h } : LieSubmodule R L M) : Submodule R M) = p := by | cases p; rfl
| false |
import Mathlib.ModelTheory.Substructures
#align_import model_theory.finitely_generated from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398"
open FirstOrder Set
namespace FirstOrder
namespace Language
open Structure
variable {L : Language} {M : Type*} [L.Structure M]
namespace Substructure
def FG (N : L.Substructure M) : Prop :=
∃ S : Finset M, closure L S = N
#align first_order.language.substructure.fg FirstOrder.Language.Substructure.FG
theorem fg_def {N : L.Substructure M} : N.FG ↔ ∃ S : Set M, S.Finite ∧ closure L S = N :=
⟨fun ⟨t, h⟩ => ⟨_, Finset.finite_toSet t, h⟩, by
rintro ⟨t', h, rfl⟩
rcases Finite.exists_finset_coe h with ⟨t, rfl⟩
exact ⟨t, rfl⟩⟩
#align first_order.language.substructure.fg_def FirstOrder.Language.Substructure.fg_def
theorem fg_iff_exists_fin_generating_family {N : L.Substructure M} :
N.FG ↔ ∃ (n : ℕ) (s : Fin n → M), closure L (range s) = N := by
rw [fg_def]
constructor
· rintro ⟨S, Sfin, hS⟩
obtain ⟨n, f, rfl⟩ := Sfin.fin_embedding
exact ⟨n, f, hS⟩
· rintro ⟨n, s, hs⟩
exact ⟨range s, finite_range s, hs⟩
#align first_order.language.substructure.fg_iff_exists_fin_generating_family FirstOrder.Language.Substructure.fg_iff_exists_fin_generating_family
theorem fg_bot : (⊥ : L.Substructure M).FG :=
⟨∅, by rw [Finset.coe_empty, closure_empty]⟩
#align first_order.language.substructure.fg_bot FirstOrder.Language.Substructure.fg_bot
theorem fg_closure {s : Set M} (hs : s.Finite) : FG (closure L s) :=
⟨hs.toFinset, by rw [hs.coe_toFinset]⟩
#align first_order.language.substructure.fg_closure FirstOrder.Language.Substructure.fg_closure
theorem fg_closure_singleton (x : M) : FG (closure L ({x} : Set M)) :=
fg_closure (finite_singleton x)
#align first_order.language.substructure.fg_closure_singleton FirstOrder.Language.Substructure.fg_closure_singleton
theorem FG.sup {N₁ N₂ : L.Substructure M} (hN₁ : N₁.FG) (hN₂ : N₂.FG) : (N₁ ⊔ N₂).FG :=
let ⟨t₁, ht₁⟩ := fg_def.1 hN₁
let ⟨t₂, ht₂⟩ := fg_def.1 hN₂
fg_def.2 ⟨t₁ ∪ t₂, ht₁.1.union ht₂.1, by rw [closure_union, ht₁.2, ht₂.2]⟩
#align first_order.language.substructure.fg.sup FirstOrder.Language.Substructure.FG.sup
theorem FG.map {N : Type*} [L.Structure N] (f : M →[L] N) {s : L.Substructure M} (hs : s.FG) :
(s.map f).FG :=
let ⟨t, ht⟩ := fg_def.1 hs
fg_def.2 ⟨f '' t, ht.1.image _, by rw [closure_image, ht.2]⟩
#align first_order.language.substructure.fg.map FirstOrder.Language.Substructure.FG.map
theorem FG.of_map_embedding {N : Type*} [L.Structure N] (f : M ↪[L] N) {s : L.Substructure M}
(hs : (s.map f.toHom).FG) : s.FG := by
rcases hs with ⟨t, h⟩
rw [fg_def]
refine ⟨f ⁻¹' t, t.finite_toSet.preimage f.injective.injOn, ?_⟩
have hf : Function.Injective f.toHom := f.injective
refine map_injective_of_injective hf ?_
rw [← h, map_closure, Embedding.coe_toHom, image_preimage_eq_of_subset]
intro x hx
have h' := subset_closure (L := L) hx
rw [h] at h'
exact Hom.map_le_range h'
#align first_order.language.substructure.fg.of_map_embedding FirstOrder.Language.Substructure.FG.of_map_embedding
def CG (N : L.Substructure M) : Prop :=
∃ S : Set M, S.Countable ∧ closure L S = N
#align first_order.language.substructure.cg FirstOrder.Language.Substructure.CG
theorem cg_def {N : L.Substructure M} : N.CG ↔ ∃ S : Set M, S.Countable ∧ closure L S = N :=
Iff.refl _
#align first_order.language.substructure.cg_def FirstOrder.Language.Substructure.cg_def
| Mathlib/ModelTheory/FinitelyGenerated.lean | 111 | 113 | theorem FG.cg {N : L.Substructure M} (h : N.FG) : N.CG := by |
obtain ⟨s, hf, rfl⟩ := fg_def.1 h
exact ⟨s, hf.countable, rfl⟩
| false |
import Mathlib.NumberTheory.Cyclotomic.Discriminant
import Mathlib.RingTheory.Polynomial.Eisenstein.IsIntegral
import Mathlib.RingTheory.Ideal.Norm
#align_import number_theory.cyclotomic.rat from "leanprover-community/mathlib"@"b353176c24d96c23f0ce1cc63efc3f55019702d9"
universe u
open Algebra IsCyclotomicExtension Polynomial NumberField
open scoped Cyclotomic Nat
variable {p : ℕ+} {k : ℕ} {K : Type u} [Field K] [CharZero K] {ζ : K} [hp : Fact (p : ℕ).Prime]
namespace IsCyclotomicExtension.Rat
theorem discr_prime_pow_ne_two' [IsCyclotomicExtension {p ^ (k + 1)} ℚ K]
(hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))) (hk : p ^ (k + 1) ≠ 2) :
discr ℚ (hζ.subOnePowerBasis ℚ).basis =
(-1) ^ ((p ^ (k + 1) : ℕ).totient / 2) * p ^ ((p : ℕ) ^ k * ((p - 1) * (k + 1) - 1)) := by
rw [← discr_prime_pow_ne_two hζ (cyclotomic.irreducible_rat (p ^ (k + 1)).pos) hk]
exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm
#align is_cyclotomic_extension.rat.discr_prime_pow_ne_two' IsCyclotomicExtension.Rat.discr_prime_pow_ne_two'
theorem discr_odd_prime' [IsCyclotomicExtension {p} ℚ K] (hζ : IsPrimitiveRoot ζ p) (hodd : p ≠ 2) :
discr ℚ (hζ.subOnePowerBasis ℚ).basis = (-1) ^ (((p : ℕ) - 1) / 2) * p ^ ((p : ℕ) - 2) := by
rw [← discr_odd_prime hζ (cyclotomic.irreducible_rat hp.out.pos) hodd]
exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm
#align is_cyclotomic_extension.rat.discr_odd_prime' IsCyclotomicExtension.Rat.discr_odd_prime'
| Mathlib/NumberTheory/Cyclotomic/Rat.lean | 55 | 59 | theorem discr_prime_pow' [IsCyclotomicExtension {p ^ k} ℚ K] (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) :
discr ℚ (hζ.subOnePowerBasis ℚ).basis =
(-1) ^ ((p ^ k : ℕ).totient / 2) * p ^ ((p : ℕ) ^ (k - 1) * ((p - 1) * k - 1)) := by |
rw [← discr_prime_pow hζ (cyclotomic.irreducible_rat (p ^ k).pos)]
exact hζ.discr_zeta_eq_discr_zeta_sub_one.symm
| false |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {α ι F : Type*} [FunLike F (Set α) ℝ≥0∞] [OuterMeasureClass F α]
{μ : F} {s t : Set α}
@[simp]
theorem measure_empty : μ ∅ = 0 := OuterMeasureClass.measure_empty μ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s ⊆ t) : μ s ≤ μ t :=
OuterMeasureClass.measure_mono μ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s ⊆ t) (ht : μ t = 0) : μ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s ⊆ t) (hs : μ s ≠ 0) : 0 < μ t :=
hs.bot_lt.trans_le (measure_mono h)
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 63 | 69 | theorem measure_iUnion_le [Countable ι] (s : ι → Set α) : μ (⋃ i, s i) ≤ ∑' i, μ (s i) := by |
refine rel_iSup_tsum μ measure_empty (· ≤ ·) (fun t ↦ ?_) _
calc
μ (⋃ i, t i) = μ (⋃ i, disjointed t i) := by rw [iUnion_disjointed]
_ ≤ ∑' i, μ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ ≤ ∑' i, μ (t i) := by gcongr; apply disjointed_subset
| false |
import Mathlib.Algebra.Category.GroupCat.EquivalenceGroupAddGroup
import Mathlib.GroupTheory.QuotientGroup
#align_import algebra.category.Group.epi_mono from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open scoped Pointwise
universe u v
namespace MonoidHom
open QuotientGroup
variable {A : Type u} {B : Type v}
section
variable [Group A] [Group B]
@[to_additive]
| Mathlib/Algebra/Category/GroupCat/EpiMono.lean | 35 | 36 | theorem ker_eq_bot_of_cancel {f : A →* B} (h : ∀ u v : f.ker →* A, f.comp u = f.comp v → u = v) :
f.ker = ⊥ := by | simpa using _root_.congr_arg range (h f.ker.subtype 1 (by aesop_cat))
| false |
import Mathlib.Analysis.NormedSpace.AddTorsorBases
#align_import analysis.convex.intrinsic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open AffineSubspace Set
open scoped Pointwise
variable {𝕜 V W Q P : Type*}
section AddTorsor
variable (𝕜) [Ring 𝕜] [AddCommGroup V] [Module 𝕜 V] [TopologicalSpace P] [AddTorsor V P]
{s t : Set P} {x : P}
def intrinsicInterior (s : Set P) : Set P :=
(↑) '' interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_interior intrinsicInterior
def intrinsicFrontier (s : Set P) : Set P :=
(↑) '' frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_frontier intrinsicFrontier
def intrinsicClosure (s : Set P) : Set P :=
(↑) '' closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s)
#align intrinsic_closure intrinsicClosure
variable {𝕜}
@[simp]
theorem mem_intrinsicInterior :
x ∈ intrinsicInterior 𝕜 s ↔ ∃ y, y ∈ interior ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_interior mem_intrinsicInterior
@[simp]
theorem mem_intrinsicFrontier :
x ∈ intrinsicFrontier 𝕜 s ↔ ∃ y, y ∈ frontier ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_frontier mem_intrinsicFrontier
@[simp]
theorem mem_intrinsicClosure :
x ∈ intrinsicClosure 𝕜 s ↔ ∃ y, y ∈ closure ((↑) ⁻¹' s : Set <| affineSpan 𝕜 s) ∧ ↑y = x :=
mem_image _ _ _
#align mem_intrinsic_closure mem_intrinsicClosure
theorem intrinsicInterior_subset : intrinsicInterior 𝕜 s ⊆ s :=
image_subset_iff.2 interior_subset
#align intrinsic_interior_subset intrinsicInterior_subset
theorem intrinsicFrontier_subset (hs : IsClosed s) : intrinsicFrontier 𝕜 s ⊆ s :=
image_subset_iff.2 (hs.preimage continuous_induced_dom).frontier_subset
#align intrinsic_frontier_subset intrinsicFrontier_subset
theorem intrinsicFrontier_subset_intrinsicClosure : intrinsicFrontier 𝕜 s ⊆ intrinsicClosure 𝕜 s :=
image_subset _ frontier_subset_closure
#align intrinsic_frontier_subset_intrinsic_closure intrinsicFrontier_subset_intrinsicClosure
theorem subset_intrinsicClosure : s ⊆ intrinsicClosure 𝕜 s :=
fun x hx => ⟨⟨x, subset_affineSpan _ _ hx⟩, subset_closure hx, rfl⟩
#align subset_intrinsic_closure subset_intrinsicClosure
@[simp]
theorem intrinsicInterior_empty : intrinsicInterior 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicInterior]
#align intrinsic_interior_empty intrinsicInterior_empty
@[simp]
theorem intrinsicFrontier_empty : intrinsicFrontier 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicFrontier]
#align intrinsic_frontier_empty intrinsicFrontier_empty
@[simp]
theorem intrinsicClosure_empty : intrinsicClosure 𝕜 (∅ : Set P) = ∅ := by simp [intrinsicClosure]
#align intrinsic_closure_empty intrinsicClosure_empty
@[simp]
theorem intrinsicClosure_nonempty : (intrinsicClosure 𝕜 s).Nonempty ↔ s.Nonempty :=
⟨by simp_rw [nonempty_iff_ne_empty]; rintro h rfl; exact h intrinsicClosure_empty,
Nonempty.mono subset_intrinsicClosure⟩
#align intrinsic_closure_nonempty intrinsicClosure_nonempty
alias ⟨Set.Nonempty.ofIntrinsicClosure, Set.Nonempty.intrinsicClosure⟩ := intrinsicClosure_nonempty
#align set.nonempty.of_intrinsic_closure Set.Nonempty.ofIntrinsicClosure
#align set.nonempty.intrinsic_closure Set.Nonempty.intrinsicClosure
--attribute [protected] Set.Nonempty.intrinsicClosure -- Porting note: removed
@[simp]
theorem intrinsicInterior_singleton (x : P) : intrinsicInterior 𝕜 ({x} : Set P) = {x} := by
simpa only [intrinsicInterior, preimage_coe_affineSpan_singleton, interior_univ, image_univ,
Subtype.range_coe] using coe_affineSpan_singleton _ _ _
#align intrinsic_interior_singleton intrinsicInterior_singleton
@[simp]
| Mathlib/Analysis/Convex/Intrinsic.lean | 142 | 143 | theorem intrinsicFrontier_singleton (x : P) : intrinsicFrontier 𝕜 ({x} : Set P) = ∅ := by |
rw [intrinsicFrontier, preimage_coe_affineSpan_singleton, frontier_univ, image_empty]
| false |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.deriv.add from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L : Filter 𝕜}
section Add
nonrec theorem HasDerivAtFilter.add (hf : HasDerivAtFilter f f' x L)
(hg : HasDerivAtFilter g g' x L) : HasDerivAtFilter (fun y => f y + g y) (f' + g') x L := by
simpa using (hf.add hg).hasDerivAtFilter
#align has_deriv_at_filter.add HasDerivAtFilter.add
nonrec theorem HasStrictDerivAt.add (hf : HasStrictDerivAt f f' x) (hg : HasStrictDerivAt g g' x) :
HasStrictDerivAt (fun y => f y + g y) (f' + g') x := by simpa using (hf.add hg).hasStrictDerivAt
#align has_strict_deriv_at.add HasStrictDerivAt.add
nonrec theorem HasDerivWithinAt.add (hf : HasDerivWithinAt f f' s x)
(hg : HasDerivWithinAt g g' s x) : HasDerivWithinAt (fun y => f y + g y) (f' + g') s x :=
hf.add hg
#align has_deriv_within_at.add HasDerivWithinAt.add
nonrec theorem HasDerivAt.add (hf : HasDerivAt f f' x) (hg : HasDerivAt g g' x) :
HasDerivAt (fun x => f x + g x) (f' + g') x :=
hf.add hg
#align has_deriv_at.add HasDerivAt.add
theorem derivWithin_add (hxs : UniqueDiffWithinAt 𝕜 s x) (hf : DifferentiableWithinAt 𝕜 f s x)
(hg : DifferentiableWithinAt 𝕜 g s x) :
derivWithin (fun y => f y + g y) s x = derivWithin f s x + derivWithin g s x :=
(hf.hasDerivWithinAt.add hg.hasDerivWithinAt).derivWithin hxs
#align deriv_within_add derivWithin_add
@[simp]
theorem deriv_add (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) :
deriv (fun y => f y + g y) x = deriv f x + deriv g x :=
(hf.hasDerivAt.add hg.hasDerivAt).deriv
#align deriv_add deriv_add
-- Porting note (#10756): new theorem
theorem HasStrictDerivAt.add_const (c : F) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (fun y ↦ f y + c) f' x :=
add_zero f' ▸ hf.add (hasStrictDerivAt_const x c)
theorem HasDerivAtFilter.add_const (hf : HasDerivAtFilter f f' x L) (c : F) :
HasDerivAtFilter (fun y => f y + c) f' x L :=
add_zero f' ▸ hf.add (hasDerivAtFilter_const x L c)
#align has_deriv_at_filter.add_const HasDerivAtFilter.add_const
nonrec theorem HasDerivWithinAt.add_const (hf : HasDerivWithinAt f f' s x) (c : F) :
HasDerivWithinAt (fun y => f y + c) f' s x :=
hf.add_const c
#align has_deriv_within_at.add_const HasDerivWithinAt.add_const
nonrec theorem HasDerivAt.add_const (hf : HasDerivAt f f' x) (c : F) :
HasDerivAt (fun x => f x + c) f' x :=
hf.add_const c
#align has_deriv_at.add_const HasDerivAt.add_const
| Mathlib/Analysis/Calculus/Deriv/Add.lean | 97 | 99 | theorem derivWithin_add_const (hxs : UniqueDiffWithinAt 𝕜 s x) (c : F) :
derivWithin (fun y => f y + c) s x = derivWithin f s x := by |
simp only [derivWithin, fderivWithin_add_const hxs]
| false |
import Mathlib.Algebra.BigOperators.Pi
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Data.Finsupp.Fin
import Mathlib.Data.Finsupp.Indicator
#align_import algebra.big_operators.finsupp from "leanprover-community/mathlib"@"842328d9df7e96fd90fc424e115679c15fb23a71"
noncomputable section
open Finset Function
variable {α ι γ A B C : Type*} [AddCommMonoid A] [AddCommMonoid B] [AddCommMonoid C]
variable {t : ι → A → C} (h0 : ∀ i, t i 0 = 0) (h1 : ∀ i x y, t i (x + y) = t i x + t i y)
variable {s : Finset α} {f : α → ι →₀ A} (i : ι)
variable (g : ι →₀ A) (k : ι → A → γ → B) (x : γ)
variable {β M M' N P G H R S : Type*}
namespace Finsupp
section SumProd
@[to_additive "`sum f g` is the sum of `g a (f a)` over the support of `f`. "]
def prod [Zero M] [CommMonoid N] (f : α →₀ M) (g : α → M → N) : N :=
∏ a ∈ f.support, g a (f a)
#align finsupp.prod Finsupp.prod
#align finsupp.sum Finsupp.sum
variable [Zero M] [Zero M'] [CommMonoid N]
@[to_additive]
| Mathlib/Algebra/BigOperators/Finsupp.lean | 54 | 57 | theorem prod_of_support_subset (f : α →₀ M) {s : Finset α} (hs : f.support ⊆ s) (g : α → M → N)
(h : ∀ i ∈ s, g i 0 = 1) : f.prod g = ∏ x ∈ s, g x (f x) := by |
refine Finset.prod_subset hs fun x hxs hx => h x hxs ▸ (congr_arg (g x) ?_)
exact not_mem_support_iff.1 hx
| false |
import Mathlib.Data.List.Sublists
import Mathlib.Data.Multiset.Bind
#align_import data.multiset.powerset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Multiset
open List
variable {α : Type*}
-- Porting note (#11215): TODO: Write a more efficient version
def powersetAux (l : List α) : List (Multiset α) :=
(sublists l).map (↑)
#align multiset.powerset_aux Multiset.powersetAux
theorem powersetAux_eq_map_coe {l : List α} : powersetAux l = (sublists l).map (↑) :=
rfl
#align multiset.powerset_aux_eq_map_coe Multiset.powersetAux_eq_map_coe
@[simp]
theorem mem_powersetAux {l : List α} {s} : s ∈ powersetAux l ↔ s ≤ ↑l :=
Quotient.inductionOn s <| by simp [powersetAux_eq_map_coe, Subperm, and_comm]
#align multiset.mem_powerset_aux Multiset.mem_powersetAux
def powersetAux' (l : List α) : List (Multiset α) :=
(sublists' l).map (↑)
#align multiset.powerset_aux' Multiset.powersetAux'
theorem powersetAux_perm_powersetAux' {l : List α} : powersetAux l ~ powersetAux' l := by
rw [powersetAux_eq_map_coe]; exact (sublists_perm_sublists' _).map _
#align multiset.powerset_aux_perm_powerset_aux' Multiset.powersetAux_perm_powersetAux'
@[simp]
theorem powersetAux'_nil : powersetAux' (@nil α) = [0] :=
rfl
#align multiset.powerset_aux'_nil Multiset.powersetAux'_nil
@[simp]
| Mathlib/Data/Multiset/Powerset.lean | 55 | 57 | theorem powersetAux'_cons (a : α) (l : List α) :
powersetAux' (a :: l) = powersetAux' l ++ List.map (cons a) (powersetAux' l) := by |
simp only [powersetAux', sublists'_cons, map_append, List.map_map, append_cancel_left_eq]; rfl
| false |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds
#align_import data.real.pi.bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973"
-- Porting note: needed to add a lot of type ascriptions for lean to interpret numbers as reals.
open scoped Real
namespace Real
theorem pi_gt_sqrtTwoAddSeries (n : ℕ) :
(2 : ℝ) ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) < π := by
have : √(2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) * (2 : ℝ) ^ (n + 2) < π := by
rw [← lt_div_iff, ← sin_pi_over_two_pow_succ]
focus
apply sin_lt
apply div_pos pi_pos
all_goals apply pow_pos; norm_num
apply lt_of_le_of_lt (le_of_eq _) this
rw [pow_succ' _ (n + 1), ← mul_assoc, div_mul_cancel₀, mul_comm]; norm_num
#align real.pi_gt_sqrt_two_add_series Real.pi_gt_sqrtTwoAddSeries
theorem pi_lt_sqrtTwoAddSeries (n : ℕ) :
π < (2 : ℝ) ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) + 1 / (4 : ℝ) ^ n := by
have : π <
(√(2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) + (1 : ℝ) / ((2 : ℝ) ^ n) ^ 3 / 4) *
(2 : ℝ) ^ (n + 2) := by
rw [← div_lt_iff (by norm_num), ← sin_pi_over_two_pow_succ]
refine lt_of_lt_of_le (lt_add_of_sub_right_lt (sin_gt_sub_cube ?_ ?_)) ?_
· apply div_pos pi_pos; apply pow_pos; norm_num
· rw [div_le_iff']
· refine le_trans pi_le_four ?_
simp only [show (4 : ℝ) = (2 : ℝ) ^ 2 by norm_num, mul_one]
apply pow_le_pow_right (by norm_num)
apply le_add_of_nonneg_left; apply Nat.zero_le
· apply pow_pos; norm_num
apply add_le_add_left; rw [div_le_div_right (by norm_num)]
rw [le_div_iff (by norm_num), ← mul_pow]
refine le_trans ?_ (le_of_eq (one_pow 3)); apply pow_le_pow_left
· apply le_of_lt; apply mul_pos
· apply div_pos pi_pos; apply pow_pos; norm_num
· apply pow_pos; norm_num
· rw [← le_div_iff (by norm_num)]
refine le_trans ((div_le_div_right ?_).mpr pi_le_four) ?_
· apply pow_pos; norm_num
· simp only [pow_succ', ← div_div, one_div]
-- Porting note: removed `convert le_rfl`
norm_num
apply lt_of_lt_of_le this (le_of_eq _); rw [add_mul]; congr 1
· ring
simp only [show (4 : ℝ) = 2 ^ 2 by norm_num, ← pow_mul, div_div, ← pow_add]
rw [one_div, one_div, inv_mul_eq_iff_eq_mul₀, eq_comm, mul_inv_eq_iff_eq_mul₀, ← pow_add]
· rw [add_assoc, Nat.mul_succ, add_comm, add_comm n, add_assoc, mul_comm n]
all_goals norm_num
#align real.pi_lt_sqrt_two_add_series Real.pi_lt_sqrtTwoAddSeries
theorem pi_lower_bound_start (n : ℕ) {a}
(h : sqrtTwoAddSeries ((0 : ℕ) / (1 : ℕ)) n ≤ (2 : ℝ) - (a / (2 : ℝ) ^ (n + 1)) ^ 2) :
a < π := by
refine lt_of_le_of_lt ?_ (pi_gt_sqrtTwoAddSeries n); rw [mul_comm]
refine (div_le_iff (pow_pos (by norm_num) _ : (0 : ℝ) < _)).mp (le_sqrt_of_sq_le ?_)
rwa [le_sub_comm, show (0 : ℝ) = (0 : ℕ) / (1 : ℕ) by rw [Nat.cast_zero, zero_div]]
#align real.pi_lower_bound_start Real.pi_lower_bound_start
theorem sqrtTwoAddSeries_step_up (c d : ℕ) {a b n : ℕ} {z : ℝ} (hz : sqrtTwoAddSeries (c / d) n ≤ z)
(hb : 0 < b) (hd : 0 < d) (h : (2 * b + a) * d ^ 2 ≤ c ^ 2 * b) :
sqrtTwoAddSeries (a / b) (n + 1) ≤ z := by
refine le_trans ?_ hz; rw [sqrtTwoAddSeries_succ]; apply sqrtTwoAddSeries_monotone_left
have hb' : 0 < (b : ℝ) := Nat.cast_pos.2 hb
have hd' : 0 < (d : ℝ) := Nat.cast_pos.2 hd
rw [sqrt_le_left (div_nonneg c.cast_nonneg d.cast_nonneg), div_pow,
add_div_eq_mul_add_div _ _ (ne_of_gt hb'), div_le_div_iff hb' (pow_pos hd' _)]
exact mod_cast h
#align real.sqrt_two_add_series_step_up Real.sqrtTwoAddSeries_step_up
| Mathlib/Data/Real/Pi/Bounds.lean | 128 | 136 | theorem pi_upper_bound_start (n : ℕ) {a}
(h : (2 : ℝ) - ((a - 1 / (4 : ℝ) ^ n) / (2 : ℝ) ^ (n + 1)) ^ 2 ≤
sqrtTwoAddSeries ((0 : ℕ) / (1 : ℕ)) n)
(h₂ : (1 : ℝ) / (4 : ℝ) ^ n ≤ a) : π < a := by |
refine lt_of_lt_of_le (pi_lt_sqrtTwoAddSeries n) ?_
rw [← le_sub_iff_add_le, ← le_div_iff', sqrt_le_left, sub_le_comm]
· rwa [Nat.cast_zero, zero_div] at h
· exact div_nonneg (sub_nonneg.2 h₂) (pow_nonneg (le_of_lt zero_lt_two) _)
· exact pow_pos zero_lt_two _
| false |
import Mathlib.LinearAlgebra.Dimension.Finrank
import Mathlib.LinearAlgebra.InvariantBasisNumber
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v w w'
variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M]
variable {ι : Type w} {ι' : Type w'}
open Cardinal Basis Submodule Function Set
attribute [local instance] nontrivial_of_invariantBasisNumber
section StrongRankCondition
variable [StrongRankCondition R]
open Submodule
-- An auxiliary lemma for `linearIndependent_le_span'`,
-- with the additional assumption that the linearly independent family is finite.
theorem linearIndependent_le_span_aux' {ι : Type*} [Fintype ι] (v : ι → M)
(i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) :
Fintype.card ι ≤ Fintype.card w := by
-- We construct an injective linear map `(ι → R) →ₗ[R] (w → R)`,
-- by thinking of `f : ι → R` as a linear combination of the finite family `v`,
-- and expressing that (using the axiom of choice) as a linear combination over `w`.
-- We can do this linearly by constructing the map on a basis.
fapply card_le_of_injective' R
· apply Finsupp.total
exact fun i => Span.repr R w ⟨v i, s (mem_range_self i)⟩
· intro f g h
apply_fun Finsupp.total w M R (↑) at h
simp only [Finsupp.total_total, Submodule.coe_mk, Span.finsupp_total_repr] at h
rw [← sub_eq_zero, ← LinearMap.map_sub] at h
exact sub_eq_zero.mp (linearIndependent_iff.mp i _ h)
#align linear_independent_le_span_aux' linearIndependent_le_span_aux'
lemma LinearIndependent.finite_of_le_span_finite {ι : Type*} (v : ι → M) (i : LinearIndependent R v)
(w : Set M) [Finite w] (s : range v ≤ span R w) : Finite ι :=
letI := Fintype.ofFinite w
Fintype.finite <| fintypeOfFinsetCardLe (Fintype.card w) fun t => by
let v' := fun x : (t : Set ι) => v x
have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective
have s' : range v' ≤ span R w := (range_comp_subset_range _ _).trans s
simpa using linearIndependent_le_span_aux' v' i' w s'
#align linear_independent_fintype_of_le_span_fintype LinearIndependent.finite_of_le_span_finite
| Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean | 214 | 220 | theorem linearIndependent_le_span' {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M)
[Fintype w] (s : range v ≤ span R w) : #ι ≤ Fintype.card w := by |
haveI : Finite ι := i.finite_of_le_span_finite v w s
letI := Fintype.ofFinite ι
rw [Cardinal.mk_fintype]
simp only [Cardinal.natCast_le]
exact linearIndependent_le_span_aux' v i w s
| false |
import Mathlib.MeasureTheory.Function.SimpleFuncDenseLp
#align_import measure_theory.integral.set_to_l1 from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology NNReal ENNReal MeasureTheory Pointwise
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {α E F F' G 𝕜 : Type*} {p : ℝ≥0∞} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup F'] [NormedSpace ℝ F']
[NormedAddCommGroup G] {m : MeasurableSpace α} {μ : Measure α}
local infixr:25 " →ₛ " => SimpleFunc
open Finset
section FinMeasAdditive
def FinMeasAdditive {β} [AddMonoid β] {_ : MeasurableSpace α} (μ : Measure α) (T : Set α → β) :
Prop :=
∀ s t, MeasurableSet s → MeasurableSet t → μ s ≠ ∞ → μ t ≠ ∞ → s ∩ t = ∅ → T (s ∪ t) = T s + T t
#align measure_theory.fin_meas_additive MeasureTheory.FinMeasAdditive
namespace FinMeasAdditive
variable {β : Type*} [AddCommMonoid β] {T T' : Set α → β}
theorem zero : FinMeasAdditive μ (0 : Set α → β) := fun s t _ _ _ _ _ => by simp
#align measure_theory.fin_meas_additive.zero MeasureTheory.FinMeasAdditive.zero
| Mathlib/MeasureTheory/Integral/SetToL1.lean | 105 | 109 | theorem add (hT : FinMeasAdditive μ T) (hT' : FinMeasAdditive μ T') :
FinMeasAdditive μ (T + T') := by |
intro s t hs ht hμs hμt hst
simp only [hT s t hs ht hμs hμt hst, hT' s t hs ht hμs hμt hst, Pi.add_apply]
abel
| false |
import Mathlib.Analysis.NormedSpace.Star.GelfandDuality
import Mathlib.Topology.Algebra.StarSubalgebra
#align_import analysis.normed_space.star.continuous_functional_calculus from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
open scoped Pointwise ENNReal NNReal ComplexOrder
open WeakDual WeakDual.CharacterSpace elementalStarAlgebra
variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A]
variable [StarRing A] [CstarRing A] [StarModule ℂ A]
instance {R A : Type*} [CommRing R] [StarRing R] [NormedRing A] [Algebra R A] [StarRing A]
[ContinuousStar A] [StarModule R A] (a : A) [IsStarNormal a] :
NormedCommRing (elementalStarAlgebra R a) :=
{ SubringClass.toNormedRing (elementalStarAlgebra R a) with
mul_comm := mul_comm }
-- Porting note: these hack instances no longer seem to be necessary
#noalign elemental_star_algebra.complex.normed_algebra
variable [CompleteSpace A] (a : A) [IsStarNormal a] (S : StarSubalgebra ℂ A)
| Mathlib/Analysis/NormedSpace/Star/ContinuousFunctionalCalculus.lean | 81 | 94 | theorem spectrum_star_mul_self_of_isStarNormal :
spectrum ℂ (star a * a) ⊆ Set.Icc (0 : ℂ) ‖star a * a‖ := by |
-- this instance should be found automatically, but without providing it Lean goes on a wild
-- goose chase when trying to apply `spectrum.gelfandTransform_eq`.
--letI := elementalStarAlgebra.Complex.normedAlgebra a
rcases subsingleton_or_nontrivial A with ⟨⟩
· simp only [spectrum.of_subsingleton, Set.empty_subset]
· set a' : elementalStarAlgebra ℂ a := ⟨a, self_mem ℂ a⟩
refine (spectrum.subset_starSubalgebra (star a' * a')).trans ?_
rw [← spectrum.gelfandTransform_eq (star a' * a'), ContinuousMap.spectrum_eq_range]
rintro - ⟨φ, rfl⟩
rw [gelfandTransform_apply_apply ℂ _ (star a' * a') φ, map_mul φ, map_star φ]
rw [Complex.eq_coe_norm_of_nonneg (star_mul_self_nonneg _), ← map_star, ← map_mul]
exact ⟨by positivity, Complex.real_le_real.2 (AlgHom.norm_apply_le_self φ (star a' * a'))⟩
| false |
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Combinatorics.Enumerative.Composition
#align_import analysis.analytic.composition from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
variable {𝕜 : Type*} {E F G H : Type*}
open Filter List
open scoped Topology Classical NNReal ENNReal
section Topological
variable [CommRing 𝕜] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G]
variable [Module 𝕜 E] [Module 𝕜 F] [Module 𝕜 G]
variable [TopologicalSpace E] [TopologicalSpace F] [TopologicalSpace G]
namespace FormalMultilinearSeries
variable [TopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]
variable [TopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]
variable [TopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]
def applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n) :
(Fin n → E) → Fin c.length → F := fun v i => p (c.blocksFun i) (v ∘ c.embedding i)
#align formal_multilinear_series.apply_composition FormalMultilinearSeries.applyComposition
theorem applyComposition_ones (p : FormalMultilinearSeries 𝕜 E F) (n : ℕ) :
p.applyComposition (Composition.ones n) = fun v i =>
p 1 fun _ => v (Fin.castLE (Composition.length_le _) i) := by
funext v i
apply p.congr (Composition.ones_blocksFun _ _)
intro j hjn hj1
obtain rfl : j = 0 := by omega
refine congr_arg v ?_
rw [Fin.ext_iff, Fin.coe_castLE, Composition.ones_embedding, Fin.val_mk]
#align formal_multilinear_series.apply_composition_ones FormalMultilinearSeries.applyComposition_ones
theorem applyComposition_single (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (hn : 0 < n)
(v : Fin n → E) : p.applyComposition (Composition.single n hn) v = fun _j => p n v := by
ext j
refine p.congr (by simp) fun i hi1 hi2 => ?_
dsimp
congr 1
convert Composition.single_embedding hn ⟨i, hi2⟩ using 1
cases' j with j_val j_property
have : j_val = 0 := le_bot_iff.1 (Nat.lt_succ_iff.1 j_property)
congr!
simp
#align formal_multilinear_series.apply_composition_single FormalMultilinearSeries.applyComposition_single
@[simp]
theorem removeZero_applyComposition (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ}
(c : Composition n) : p.removeZero.applyComposition c = p.applyComposition c := by
ext v i
simp [applyComposition, zero_lt_one.trans_le (c.one_le_blocksFun i), removeZero_of_pos]
#align formal_multilinear_series.remove_zero_apply_composition FormalMultilinearSeries.removeZero_applyComposition
theorem applyComposition_update (p : FormalMultilinearSeries 𝕜 E F) {n : ℕ} (c : Composition n)
(j : Fin n) (v : Fin n → E) (z : E) :
p.applyComposition c (Function.update v j z) =
Function.update (p.applyComposition c v) (c.index j)
(p (c.blocksFun (c.index j))
(Function.update (v ∘ c.embedding (c.index j)) (c.invEmbedding j) z)) := by
ext k
by_cases h : k = c.index j
· rw [h]
let r : Fin (c.blocksFun (c.index j)) → Fin n := c.embedding (c.index j)
simp only [Function.update_same]
change p (c.blocksFun (c.index j)) (Function.update v j z ∘ r) = _
let j' := c.invEmbedding j
suffices B : Function.update v j z ∘ r = Function.update (v ∘ r) j' z by rw [B]
suffices C : Function.update v (r j') z ∘ r = Function.update (v ∘ r) j' z by
convert C; exact (c.embedding_comp_inv j).symm
exact Function.update_comp_eq_of_injective _ (c.embedding _).injective _ _
· simp only [h, Function.update_eq_self, Function.update_noteq, Ne, not_false_iff]
let r : Fin (c.blocksFun k) → Fin n := c.embedding k
change p (c.blocksFun k) (Function.update v j z ∘ r) = p (c.blocksFun k) (v ∘ r)
suffices B : Function.update v j z ∘ r = v ∘ r by rw [B]
apply Function.update_comp_eq_of_not_mem_range
rwa [c.mem_range_embedding_iff']
#align formal_multilinear_series.apply_composition_update FormalMultilinearSeries.applyComposition_update
@[simp]
| Mathlib/Analysis/Analytic/Composition.lean | 166 | 169 | theorem compContinuousLinearMap_applyComposition {n : ℕ} (p : FormalMultilinearSeries 𝕜 F G)
(f : E →L[𝕜] F) (c : Composition n) (v : Fin n → E) :
(p.compContinuousLinearMap f).applyComposition c v = p.applyComposition c (f ∘ v) := by |
simp (config := {unfoldPartialApp := true}) [applyComposition]; rfl
| false |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Ring
variable (R : Type u) [Ring R]
noncomputable def descPochhammer : ℕ → R[X]
| 0 => 1
| n + 1 => X * (descPochhammer n).comp (X - 1)
@[simp]
theorem descPochhammer_zero : descPochhammer R 0 = 1 :=
rfl
@[simp]
theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer]
theorem descPochhammer_succ_left (n : ℕ) :
descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by
rw [descPochhammer]
theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] :
Monic <| descPochhammer R n := by
induction' n with n hn
· simp
· have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1
have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R)
rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X,
one_mul, one_mul, h, one_pow]
section
variable {R} {T : Type v} [Ring T]
@[simp]
theorem descPochhammer_map (f : R →+* T) (n : ℕ) :
(descPochhammer R n).map f = descPochhammer T n := by
induction' n with n ih
· simp
· simp [ih, descPochhammer_succ_left, map_comp]
end
@[simp, norm_cast]
theorem descPochhammer_eval_cast (n : ℕ) (k : ℤ) :
(((descPochhammer ℤ n).eval k : ℤ) : R) = ((descPochhammer R n).eval k : R) := by
rw [← descPochhammer_map (algebraMap ℤ R), eval_map, ← eq_intCast (algebraMap ℤ R)]
simp only [algebraMap_int_eq, eq_intCast, eval₂_at_intCast, Nat.cast_id, eq_natCast, Int.cast_id]
theorem descPochhammer_eval_zero {n : ℕ} :
(descPochhammer R n).eval 0 = if n = 0 then 1 else 0 := by
cases n
· simp
· simp [X_mul, Nat.succ_ne_zero, descPochhammer_succ_left]
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 295 | 295 | theorem descPochhammer_zero_eval_zero : (descPochhammer R 0).eval 0 = 1 := by | simp
| false |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Int.GCD
import Mathlib.RingTheory.Coprime.Basic
#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
universe u v
section IsCoprime
variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
section
theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by
constructor
· rintro ⟨a, b, h⟩
have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm]
exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩)
· rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one]
intro h
exact ⟨_, _, h⟩
theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by
rw [Int.isCoprime_iff_gcd_eq_one, Int.gcd_natCast_natCast]
#align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
#align is_coprime.nat_coprime IsCoprime.nat_coprime
#align nat.coprime.is_coprime Nat.Coprime.isCoprime
theorem Nat.Coprime.cast {R : Type*} [CommRing R] {a b : ℕ} (h : Nat.Coprime a b) :
IsCoprime (a : R) (b : R) := by
rw [← isCoprime_iff_coprime] at h
rw [← Int.cast_natCast a, ← Int.cast_natCast b]
exact IsCoprime.intCast h
theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
(h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
IsCoprime.ne_zero_or_ne_zero (R := A) <| by
simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i ∈ t, s i) x := by
classical
refine Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ ?_
rw [Finset.prod_insert hbt]
rw [Finset.forall_mem_insert] at H
exact H.1.mul_left (ih H.2)
#align is_coprime.prod_left IsCoprime.prod_left
theorem IsCoprime.prod_right : (∀ i ∈ t, IsCoprime x (s i)) → IsCoprime x (∏ i ∈ t, s i) := by
simpa only [isCoprime_comm] using IsCoprime.prod_left (R := R)
#align is_coprime.prod_right IsCoprime.prod_right
theorem IsCoprime.prod_left_iff : IsCoprime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, IsCoprime (s i) x := by
classical
refine Finset.induction_on t (iff_of_true isCoprime_one_left fun _ ↦ by simp) fun b t hbt ih ↦ ?_
rw [Finset.prod_insert hbt, IsCoprime.mul_left_iff, ih, Finset.forall_mem_insert]
#align is_coprime.prod_left_iff IsCoprime.prod_left_iff
| Mathlib/RingTheory/Coprime/Lemmas.lean | 79 | 80 | theorem IsCoprime.prod_right_iff : IsCoprime x (∏ i ∈ t, s i) ↔ ∀ i ∈ t, IsCoprime x (s i) := by |
simpa only [isCoprime_comm] using IsCoprime.prod_left_iff (R := R)
| false |
import Mathlib.FieldTheory.RatFunc.Defs
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u v
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
variable {K : Type u}
namespace RatFunc
section Field
variable [CommRing K]
protected irreducible_def zero : RatFunc K :=
⟨0⟩
#align ratfunc.zero RatFunc.zero
instance : Zero (RatFunc K) :=
⟨RatFunc.zero⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]`
-- that does not close the goal
theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by
simp only [Zero.zero, OfNat.ofNat, RatFunc.zero]
#align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero
protected irreducible_def add : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p + q⟩
#align ratfunc.add RatFunc.add
instance : Add (RatFunc K) :=
⟨RatFunc.add⟩
-- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]`
-- that does not close the goal
theorem ofFractionRing_add (p q : FractionRing K[X]) :
ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by
simp only [HAdd.hAdd, Add.add, RatFunc.add]
#align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add
protected irreducible_def sub : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p - q⟩
#align ratfunc.sub RatFunc.sub
instance : Sub (RatFunc K) :=
⟨RatFunc.sub⟩
-- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]`
-- that does not close the goal
theorem ofFractionRing_sub (p q : FractionRing K[X]) :
ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by
simp only [Sub.sub, HSub.hSub, RatFunc.sub]
#align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub
protected irreducible_def neg : RatFunc K → RatFunc K
| ⟨p⟩ => ⟨-p⟩
#align ratfunc.neg RatFunc.neg
instance : Neg (RatFunc K) :=
⟨RatFunc.neg⟩
theorem ofFractionRing_neg (p : FractionRing K[X]) :
ofFractionRing (-p) = -ofFractionRing p := by simp only [Neg.neg, RatFunc.neg]
#align ratfunc.of_fraction_ring_neg RatFunc.ofFractionRing_neg
protected irreducible_def one : RatFunc K :=
⟨1⟩
#align ratfunc.one RatFunc.one
instance : One (RatFunc K) :=
⟨RatFunc.one⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [one_def]`
-- that does not close the goal
theorem ofFractionRing_one : (ofFractionRing 1 : RatFunc K) = 1 := by
simp only [One.one, OfNat.ofNat, RatFunc.one]
#align ratfunc.of_fraction_ring_one RatFunc.ofFractionRing_one
protected irreducible_def mul : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p * q⟩
#align ratfunc.mul RatFunc.mul
instance : Mul (RatFunc K) :=
⟨RatFunc.mul⟩
-- Porting note: added `HMul.hMul`. using `simp?` produces `simp only [mul_def]`
-- that does not close the goal
theorem ofFractionRing_mul (p q : FractionRing K[X]) :
ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q := by
simp only [Mul.mul, HMul.hMul, RatFunc.mul]
#align ratfunc.of_fraction_ring_mul RatFunc.ofFractionRing_mul
section SMul
variable {R : Type*}
protected irreducible_def smul [SMul R (FractionRing K[X])] : R → RatFunc K → RatFunc K
| r, ⟨p⟩ => ⟨r • p⟩
#align ratfunc.smul RatFunc.smul
-- cannot reproduce
--@[nolint fails_quickly] -- Porting note: `linter 'fails_quickly' not found`
instance [SMul R (FractionRing K[X])] : SMul R (RatFunc K) :=
⟨RatFunc.smul⟩
-- Porting note: added `SMul.hSMul`. using `simp?` produces `simp only [smul_def]`
-- that does not close the goal
theorem ofFractionRing_smul [SMul R (FractionRing K[X])] (c : R) (p : FractionRing K[X]) :
ofFractionRing (c • p) = c • ofFractionRing p := by
simp only [SMul.smul, HSMul.hSMul, RatFunc.smul]
#align ratfunc.of_fraction_ring_smul RatFunc.ofFractionRing_smul
theorem toFractionRing_smul [SMul R (FractionRing K[X])] (c : R) (p : RatFunc K) :
toFractionRing (c • p) = c • toFractionRing p := by
cases p
rw [← ofFractionRing_smul]
#align ratfunc.to_fraction_ring_smul RatFunc.toFractionRing_smul
theorem smul_eq_C_smul (x : RatFunc K) (r : K) : r • x = Polynomial.C r • x := by
cases' x with x
-- Porting note: had to specify the induction principle manually
induction x using Localization.induction_on
rw [← ofFractionRing_smul, ← ofFractionRing_smul, Localization.smul_mk,
Localization.smul_mk, smul_eq_mul, Polynomial.smul_eq_C_mul]
set_option linter.uppercaseLean3 false in
#align ratfunc.smul_eq_C_smul RatFunc.smul_eq_C_smul
section IsDomain
variable [IsDomain K]
variable [Monoid R] [DistribMulAction R K[X]]
variable [IsScalarTower R K[X] K[X]]
| Mathlib/FieldTheory/RatFunc/Basic.lean | 235 | 239 | theorem mk_smul (c : R) (p q : K[X]) : RatFunc.mk (c • p) q = c • RatFunc.mk p q := by |
by_cases hq : q = 0
· rw [hq, mk_zero, mk_zero, ← ofFractionRing_smul, smul_zero]
· rw [mk_eq_localization_mk _ hq, mk_eq_localization_mk _ hq, ← Localization.smul_mk, ←
ofFractionRing_smul]
| false |
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.ordinal from "leanprover-community/mathlib"@"b90e72c7eebbe8de7c8293a80208ea2ba135c834"
universe u
open SetTheory PGame
open scoped NaturalOps PGame
namespace Ordinal
noncomputable def toPGame : Ordinal.{u} → PGame.{u}
| o =>
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
⟨o.out.α, PEmpty, fun x =>
have := Ordinal.typein_lt_self x
(typein (· < ·) x).toPGame,
PEmpty.elim⟩
termination_by x => x
#align ordinal.to_pgame Ordinal.toPGame
@[nolint unusedHavesSuffices]
theorem toPGame_def (o : Ordinal) :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
o.toPGame = ⟨o.out.α, PEmpty, fun x => (typein (· < ·) x).toPGame, PEmpty.elim⟩ := by
rw [toPGame]
#align ordinal.to_pgame_def Ordinal.toPGame_def
@[simp, nolint unusedHavesSuffices]
theorem toPGame_leftMoves (o : Ordinal) : o.toPGame.LeftMoves = o.out.α := by
rw [toPGame, LeftMoves]
#align ordinal.to_pgame_left_moves Ordinal.toPGame_leftMoves
@[simp, nolint unusedHavesSuffices]
theorem toPGame_rightMoves (o : Ordinal) : o.toPGame.RightMoves = PEmpty := by
rw [toPGame, RightMoves]
#align ordinal.to_pgame_right_moves Ordinal.toPGame_rightMoves
instance isEmpty_zero_toPGame_leftMoves : IsEmpty (toPGame 0).LeftMoves := by
rw [toPGame_leftMoves]; infer_instance
#align ordinal.is_empty_zero_to_pgame_left_moves Ordinal.isEmpty_zero_toPGame_leftMoves
instance isEmpty_toPGame_rightMoves (o : Ordinal) : IsEmpty o.toPGame.RightMoves := by
rw [toPGame_rightMoves]; infer_instance
#align ordinal.is_empty_to_pgame_right_moves Ordinal.isEmpty_toPGame_rightMoves
noncomputable def toLeftMovesToPGame {o : Ordinal} : Set.Iio o ≃ o.toPGame.LeftMoves :=
(enumIsoOut o).toEquiv.trans (Equiv.cast (toPGame_leftMoves o).symm)
#align ordinal.to_left_moves_to_pgame Ordinal.toLeftMovesToPGame
@[simp]
theorem toLeftMovesToPGame_symm_lt {o : Ordinal} (i : o.toPGame.LeftMoves) :
↑(toLeftMovesToPGame.symm i) < o :=
(toLeftMovesToPGame.symm i).prop
#align ordinal.to_left_moves_to_pgame_symm_lt Ordinal.toLeftMovesToPGame_symm_lt
@[nolint unusedHavesSuffices]
theorem toPGame_moveLeft_hEq {o : Ordinal} :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
HEq o.toPGame.moveLeft fun x : o.out.α => (typein (· < ·) x).toPGame := by
rw [toPGame]
rfl
#align ordinal.to_pgame_move_left_heq Ordinal.toPGame_moveLeft_hEq
@[simp]
theorem toPGame_moveLeft' {o : Ordinal} (i) :
o.toPGame.moveLeft i = (toLeftMovesToPGame.symm i).val.toPGame :=
(congr_heq toPGame_moveLeft_hEq.symm (cast_heq _ i)).symm
#align ordinal.to_pgame_move_left' Ordinal.toPGame_moveLeft'
| Mathlib/SetTheory/Game/Ordinal.lean | 96 | 97 | theorem toPGame_moveLeft {o : Ordinal} (i) :
o.toPGame.moveLeft (toLeftMovesToPGame i) = i.val.toPGame := by | simp
| false |
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Calculus.FDeriv.Linear
import Mathlib.Analysis.Calculus.FDeriv.Comp
#align_import analysis.calculus.fderiv.equiv from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
namespace ContinuousLinearEquiv
variable (iso : E ≃L[𝕜] F)
@[fun_prop]
protected theorem hasStrictFDerivAt : HasStrictFDerivAt iso (iso : E →L[𝕜] F) x :=
iso.toContinuousLinearMap.hasStrictFDerivAt
#align continuous_linear_equiv.has_strict_fderiv_at ContinuousLinearEquiv.hasStrictFDerivAt
@[fun_prop]
protected theorem hasFDerivWithinAt : HasFDerivWithinAt iso (iso : E →L[𝕜] F) s x :=
iso.toContinuousLinearMap.hasFDerivWithinAt
#align continuous_linear_equiv.has_fderiv_within_at ContinuousLinearEquiv.hasFDerivWithinAt
@[fun_prop]
protected theorem hasFDerivAt : HasFDerivAt iso (iso : E →L[𝕜] F) x :=
iso.toContinuousLinearMap.hasFDerivAtFilter
#align continuous_linear_equiv.has_fderiv_at ContinuousLinearEquiv.hasFDerivAt
@[fun_prop]
protected theorem differentiableAt : DifferentiableAt 𝕜 iso x :=
iso.hasFDerivAt.differentiableAt
#align continuous_linear_equiv.differentiable_at ContinuousLinearEquiv.differentiableAt
@[fun_prop]
protected theorem differentiableWithinAt : DifferentiableWithinAt 𝕜 iso s x :=
iso.differentiableAt.differentiableWithinAt
#align continuous_linear_equiv.differentiable_within_at ContinuousLinearEquiv.differentiableWithinAt
protected theorem fderiv : fderiv 𝕜 iso x = iso :=
iso.hasFDerivAt.fderiv
#align continuous_linear_equiv.fderiv ContinuousLinearEquiv.fderiv
protected theorem fderivWithin (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 iso s x = iso :=
iso.toContinuousLinearMap.fderivWithin hxs
#align continuous_linear_equiv.fderiv_within ContinuousLinearEquiv.fderivWithin
@[fun_prop]
protected theorem differentiable : Differentiable 𝕜 iso := fun _ => iso.differentiableAt
#align continuous_linear_equiv.differentiable ContinuousLinearEquiv.differentiable
@[fun_prop]
protected theorem differentiableOn : DifferentiableOn 𝕜 iso s :=
iso.differentiable.differentiableOn
#align continuous_linear_equiv.differentiable_on ContinuousLinearEquiv.differentiableOn
theorem comp_differentiableWithinAt_iff {f : G → E} {s : Set G} {x : G} :
DifferentiableWithinAt 𝕜 (iso ∘ f) s x ↔ DifferentiableWithinAt 𝕜 f s x := by
refine
⟨fun H => ?_, fun H => iso.differentiable.differentiableAt.comp_differentiableWithinAt x H⟩
have : DifferentiableWithinAt 𝕜 (iso.symm ∘ iso ∘ f) s x :=
iso.symm.differentiable.differentiableAt.comp_differentiableWithinAt x H
rwa [← Function.comp.assoc iso.symm iso f, iso.symm_comp_self] at this
#align continuous_linear_equiv.comp_differentiable_within_at_iff ContinuousLinearEquiv.comp_differentiableWithinAt_iff
theorem comp_differentiableAt_iff {f : G → E} {x : G} :
DifferentiableAt 𝕜 (iso ∘ f) x ↔ DifferentiableAt 𝕜 f x := by
rw [← differentiableWithinAt_univ, ← differentiableWithinAt_univ,
iso.comp_differentiableWithinAt_iff]
#align continuous_linear_equiv.comp_differentiable_at_iff ContinuousLinearEquiv.comp_differentiableAt_iff
theorem comp_differentiableOn_iff {f : G → E} {s : Set G} :
DifferentiableOn 𝕜 (iso ∘ f) s ↔ DifferentiableOn 𝕜 f s := by
rw [DifferentiableOn, DifferentiableOn]
simp only [iso.comp_differentiableWithinAt_iff]
#align continuous_linear_equiv.comp_differentiable_on_iff ContinuousLinearEquiv.comp_differentiableOn_iff
theorem comp_differentiable_iff {f : G → E} : Differentiable 𝕜 (iso ∘ f) ↔ Differentiable 𝕜 f := by
rw [← differentiableOn_univ, ← differentiableOn_univ]
exact iso.comp_differentiableOn_iff
#align continuous_linear_equiv.comp_differentiable_iff ContinuousLinearEquiv.comp_differentiable_iff
| Mathlib/Analysis/Calculus/FDeriv/Equiv.lean | 121 | 130 | theorem comp_hasFDerivWithinAt_iff {f : G → E} {s : Set G} {x : G} {f' : G →L[𝕜] E} :
HasFDerivWithinAt (iso ∘ f) ((iso : E →L[𝕜] F).comp f') s x ↔ HasFDerivWithinAt f f' s x := by |
refine ⟨fun H => ?_, fun H => iso.hasFDerivAt.comp_hasFDerivWithinAt x H⟩
have A : f = iso.symm ∘ iso ∘ f := by
rw [← Function.comp.assoc, iso.symm_comp_self]
rfl
have B : f' = (iso.symm : F →L[𝕜] E).comp ((iso : E →L[𝕜] F).comp f') := by
rw [← ContinuousLinearMap.comp_assoc, iso.coe_symm_comp_coe, ContinuousLinearMap.id_comp]
rw [A, B]
exact iso.symm.hasFDerivAt.comp_hasFDerivWithinAt x H
| false |
import Mathlib.Data.Set.Equitable
import Mathlib.Logic.Equiv.Fin
import Mathlib.Order.Partition.Finpartition
#align_import order.partition.equipartition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
open Finset Fintype
namespace Finpartition
variable {α : Type*} [DecidableEq α] {s t : Finset α} (P : Finpartition s)
def IsEquipartition : Prop :=
(P.parts : Set (Finset α)).EquitableOn card
#align finpartition.is_equipartition Finpartition.IsEquipartition
theorem isEquipartition_iff_card_parts_eq_average :
P.IsEquipartition ↔
∀ a : Finset α,
a ∈ P.parts → a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1 := by
simp_rw [IsEquipartition, Finset.equitableOn_iff, P.sum_card_parts]
#align finpartition.is_equipartition_iff_card_parts_eq_average Finpartition.isEquipartition_iff_card_parts_eq_average
variable {P}
lemma not_isEquipartition :
¬P.IsEquipartition ↔ ∃ a ∈ P.parts, ∃ b ∈ P.parts, b.card + 1 < a.card :=
Set.not_equitableOn
theorem _root_.Set.Subsingleton.isEquipartition (h : (P.parts : Set (Finset α)).Subsingleton) :
P.IsEquipartition :=
Set.Subsingleton.equitableOn h _
#align finpartition.set.subsingleton.is_equipartition Set.Subsingleton.isEquipartition
theorem IsEquipartition.card_parts_eq_average (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ∨ t.card = s.card / P.parts.card + 1 :=
P.isEquipartition_iff_card_parts_eq_average.1 hP _ ht
#align finpartition.is_equipartition.card_parts_eq_average Finpartition.IsEquipartition.card_parts_eq_average
theorem IsEquipartition.card_part_eq_average_iff (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1 := by
have a := hP.card_parts_eq_average ht
have b : ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1) := by
by_contra h; exact absurd (h.1 ▸ h.2) (lt_add_one _).ne
tauto
theorem IsEquipartition.average_le_card_part (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
s.card / P.parts.card ≤ t.card := by
rw [← P.sum_card_parts]
exact Finset.EquitableOn.le hP ht
#align finpartition.is_equipartition.average_le_card_part Finpartition.IsEquipartition.average_le_card_part
theorem IsEquipartition.card_part_le_average_add_one (hP : P.IsEquipartition) (ht : t ∈ P.parts) :
t.card ≤ s.card / P.parts.card + 1 := by
rw [← P.sum_card_parts]
exact Finset.EquitableOn.le_add_one hP ht
#align finpartition.is_equipartition.card_part_le_average_add_one Finpartition.IsEquipartition.card_part_le_average_add_one
theorem IsEquipartition.filter_ne_average_add_one_eq_average (hP : P.IsEquipartition) :
P.parts.filter (fun p ↦ ¬p.card = s.card / P.parts.card + 1) =
P.parts.filter (fun p ↦ p.card = s.card / P.parts.card) := by
ext p
simp only [mem_filter, and_congr_right_iff]
exact fun hp ↦ (hP.card_part_eq_average_iff hp).symm
theorem IsEquipartition.card_large_parts_eq_mod (hP : P.IsEquipartition) :
(P.parts.filter fun p ↦ p.card = s.card / P.parts.card + 1).card = s.card % P.parts.card := by
have z := P.sum_card_parts
rw [← sum_filter_add_sum_filter_not (s := P.parts)
(p := fun x ↦ x.card = s.card / P.parts.card + 1),
hP.filter_ne_average_add_one_eq_average,
sum_const_nat (m := s.card / P.parts.card + 1) (by simp),
sum_const_nat (m := s.card / P.parts.card) (by simp),
← hP.filter_ne_average_add_one_eq_average,
mul_add, add_comm, ← add_assoc, ← add_mul, mul_one, add_comm (Finset.card _),
filter_card_add_filter_neg_card_eq_card, add_comm] at z
rw [← add_left_inj, Nat.mod_add_div, z]
theorem IsEquipartition.card_small_parts_eq_mod (hP : P.IsEquipartition) :
(P.parts.filter fun p ↦ p.card = s.card / P.parts.card).card =
P.parts.card - s.card % P.parts.card := by
conv_rhs =>
arg 1
rw [← filter_card_add_filter_neg_card_eq_card (p := fun p ↦ p.card = s.card / P.parts.card + 1)]
rw [hP.card_large_parts_eq_mod, add_tsub_cancel_left, hP.filter_ne_average_add_one_eq_average]
| Mathlib/Order/Partition/Equipartition.lean | 114 | 134 | theorem IsEquipartition.exists_partsEquiv (hP : P.IsEquipartition) :
∃ f : P.parts ≃ Fin P.parts.card,
∀ t, t.1.card = s.card / P.parts.card + 1 ↔ f t < s.card % P.parts.card := by |
let el := (P.parts.filter fun p ↦ p.card = s.card / P.parts.card + 1).equivFin
let es := (P.parts.filter fun p ↦ p.card = s.card / P.parts.card).equivFin
simp_rw [mem_filter, hP.card_large_parts_eq_mod] at el
simp_rw [mem_filter, hP.card_small_parts_eq_mod] at es
let sneg : { x // x ∈ P.parts ∧ ¬x.card = s.card / P.parts.card + 1 } ≃
{ x // x ∈ P.parts ∧ x.card = s.card / P.parts.card } := by
apply (Equiv.refl _).subtypeEquiv
simp only [Equiv.refl_apply, and_congr_right_iff]
exact fun _ ha ↦ by rw [hP.card_part_eq_average_iff ha, ne_eq]
replace el : { x : P.parts // x.1.card = s.card / P.parts.card + 1 } ≃
Fin (s.card % P.parts.card) := (Equiv.Set.sep ..).symm.trans el
replace es : { x : P.parts // ¬x.1.card = s.card / P.parts.card + 1 } ≃
Fin (P.parts.card - s.card % P.parts.card) := (Equiv.Set.sep ..).symm.trans (sneg.trans es)
let f := (Equiv.sumCompl _).symm.trans ((el.sumCongr es).trans finSumFinEquiv)
use f.trans (finCongr (Nat.add_sub_of_le P.card_mod_card_parts_le))
intro ⟨p, _⟩
simp_rw [f, Equiv.trans_apply, Equiv.sumCongr_apply, finCongr_apply, Fin.coe_cast]
by_cases hc : p.card = s.card / P.parts.card + 1 <;> simp [hc]
| false |
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Directed
#align_import data.set.Union_lift from "leanprover-community/mathlib"@"5a4ea8453f128345f73cc656e80a49de2a54f481"
variable {α : Type*} {ι β : Sort _}
namespace Set
section UnionLift
@[nolint unusedArguments]
noncomputable def iUnionLift (S : ι → Set α) (f : ∀ i, S i → β)
(_ : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩) (T : Set α)
(hT : T ⊆ iUnion S) (x : T) : β :=
let i := Classical.indefiniteDescription _ (mem_iUnion.1 (hT x.prop))
f i ⟨x, i.prop⟩
#align set.Union_lift Set.iUnionLift
variable {S : ι → Set α} {f : ∀ i, S i → β}
{hf : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩} {T : Set α}
{hT : T ⊆ iUnion S} (hT' : T = iUnion S)
@[simp]
theorem iUnionLift_mk {i : ι} (x : S i) (hx : (x : α) ∈ T) :
iUnionLift S f hf T hT ⟨x, hx⟩ = f i x := hf _ i x _ _
#align set.Union_lift_mk Set.iUnionLift_mk
@[simp]
theorem iUnionLift_inclusion {i : ι} (x : S i) (h : S i ⊆ T) :
iUnionLift S f hf T hT (Set.inclusion h x) = f i x :=
iUnionLift_mk x _
#align set.Union_lift_inclusion Set.iUnionLift_inclusion
theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) :
iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by cases' x with x hx; exact hf _ _ _ _ _
#align set.Union_lift_of_mem Set.iUnionLift_of_mem
theorem preimage_iUnionLift (t : Set β) :
iUnionLift S f hf T hT ⁻¹' t =
inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by
ext x
simp only [mem_preimage, mem_iUnion, mem_image]
constructor
· rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
rwa [iUnionLift_of_mem x hi] at h
· rintro ⟨i, ⟨y, hi⟩, h, hxy⟩
obtain rfl : y = x := congr_arg Subtype.val hxy
rwa [iUnionLift_of_mem x hi]
theorem iUnionLift_const (c : T) (ci : ∀ i, S i) (hci : ∀ i, (ci i : α) = c) (cβ : β)
(h : ∀ i, f i (ci i) = cβ) : iUnionLift S f hf T hT c = cβ := by
let ⟨i, hi⟩ := Set.mem_iUnion.1 (hT c.prop)
have : ci i = ⟨c, hi⟩ := Subtype.ext (hci i)
rw [iUnionLift_of_mem _ hi, ← this, h]
#align set.Union_lift_const Set.iUnionLift_const
| Mathlib/Data/Set/UnionLift.lean | 107 | 120 | theorem iUnionLift_unary (u : T → T) (ui : ∀ i, S i → S i)
(hui :
∀ (i) (x : S i),
u (Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) x) =
Set.inclusion (show S i ⊆ T from hT'.symm ▸ Set.subset_iUnion S i) (ui i x))
(uβ : β → β) (h : ∀ (i) (x : S i), f i (ui i x) = uβ (f i x)) (x : T) :
iUnionLift S f hf T (le_of_eq hT') (u x) = uβ (iUnionLift S f hf T (le_of_eq hT') x) := by |
subst hT'
cases' Set.mem_iUnion.1 x.prop with i hi
rw [iUnionLift_of_mem x hi, ← h i]
have : x = Set.inclusion (Set.subset_iUnion S i) ⟨x, hi⟩ := by
cases x
rfl
conv_lhs => rw [this, hui, iUnionLift_inclusion]
| false |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Algebra.SMulWithZero
import Mathlib.Data.Nat.PartENat
import Mathlib.Tactic.Linarith
#align_import ring_theory.multiplicity from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
variable {α β : Type*}
open Nat Part
def multiplicity [Monoid α] [DecidableRel ((· ∣ ·) : α → α → Prop)] (a b : α) : PartENat :=
PartENat.find fun n => ¬a ^ (n + 1) ∣ b
#align multiplicity multiplicity
namespace multiplicity
section Monoid
variable [Monoid α] [Monoid β]
abbrev Finite (a b : α) : Prop :=
∃ n : ℕ, ¬a ^ (n + 1) ∣ b
#align multiplicity.finite multiplicity.Finite
theorem finite_iff_dom [DecidableRel ((· ∣ ·) : α → α → Prop)] {a b : α} :
Finite a b ↔ (multiplicity a b).Dom :=
Iff.rfl
#align multiplicity.finite_iff_dom multiplicity.finite_iff_dom
theorem finite_def {a b : α} : Finite a b ↔ ∃ n : ℕ, ¬a ^ (n + 1) ∣ b :=
Iff.rfl
#align multiplicity.finite_def multiplicity.finite_def
theorem not_dvd_one_of_finite_one_right {a : α} : Finite a 1 → ¬a ∣ 1 := fun ⟨n, hn⟩ ⟨d, hd⟩ =>
hn ⟨d ^ (n + 1), (pow_mul_pow_eq_one (n + 1) hd.symm).symm⟩
#align multiplicity.not_dvd_one_of_finite_one_right multiplicity.not_dvd_one_of_finite_one_right
@[norm_cast]
theorem Int.natCast_multiplicity (a b : ℕ) : multiplicity (a : ℤ) (b : ℤ) = multiplicity a b := by
apply Part.ext'
· rw [← @finite_iff_dom ℕ, @finite_def ℕ, ← @finite_iff_dom ℤ, @finite_def ℤ]
norm_cast
· intro h1 h2
apply _root_.le_antisymm <;>
· apply Nat.find_mono
norm_cast
simp
#align multiplicity.int.coe_nat_multiplicity multiplicity.Int.natCast_multiplicity
@[deprecated (since := "2024-04-05")] alias Int.coe_nat_multiplicity := Int.natCast_multiplicity
theorem not_finite_iff_forall {a b : α} : ¬Finite a b ↔ ∀ n : ℕ, a ^ n ∣ b :=
⟨fun h n =>
Nat.casesOn n
(by
rw [_root_.pow_zero]
exact one_dvd _)
(by simpa [Finite, Classical.not_not] using h),
by simp [Finite, multiplicity, Classical.not_not]; tauto⟩
#align multiplicity.not_finite_iff_forall multiplicity.not_finite_iff_forall
theorem not_unit_of_finite {a b : α} (h : Finite a b) : ¬IsUnit a :=
let ⟨n, hn⟩ := h
hn ∘ IsUnit.dvd ∘ IsUnit.pow (n + 1)
#align multiplicity.not_unit_of_finite multiplicity.not_unit_of_finite
theorem finite_of_finite_mul_right {a b c : α} : Finite a (b * c) → Finite a b := fun ⟨n, hn⟩ =>
⟨n, fun h => hn (h.trans (dvd_mul_right _ _))⟩
#align multiplicity.finite_of_finite_mul_right multiplicity.finite_of_finite_mul_right
variable [DecidableRel ((· ∣ ·) : α → α → Prop)] [DecidableRel ((· ∣ ·) : β → β → Prop)]
| Mathlib/RingTheory/Multiplicity.lean | 99 | 107 | theorem pow_dvd_of_le_multiplicity {a b : α} {k : ℕ} :
(k : PartENat) ≤ multiplicity a b → a ^ k ∣ b := by |
rw [← PartENat.some_eq_natCast]
exact
Nat.casesOn k
(fun _ => by
rw [_root_.pow_zero]
exact one_dvd _)
fun k ⟨_, h₂⟩ => by_contradiction fun hk => Nat.find_min _ (lt_of_succ_le (h₂ ⟨k, hk⟩)) hk
| false |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.ZMod.Basic
#align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
open MvPolynomial
open Finset hiding map
open Finsupp (single)
--attribute [-simp] coe_eval₂_hom
variable (p : ℕ)
variable (R : Type*) [CommRing R] [DecidableEq R]
noncomputable def wittPolynomial (n : ℕ) : MvPolynomial ℕ R :=
∑ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i)
#align witt_polynomial wittPolynomial
theorem wittPolynomial_eq_sum_C_mul_X_pow (n : ℕ) :
wittPolynomial p R n = ∑ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by
apply sum_congr rfl
rintro i -
rw [monomial_eq, Finsupp.prod_single_index]
rw [pow_zero]
set_option linter.uppercaseLean3 false in
#align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow
-- Notation with ring of coefficients explicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W_" => wittPolynomial p
-- Notation with ring of coefficients implicit
set_option quotPrecheck false in
@[inherit_doc]
scoped[Witt] notation "W" => wittPolynomial p _
open Witt
open MvPolynomial
section
variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map_wittPolynomial (f : R →+* S) (n : ℕ) : map f (W n) = W n := by
rw [wittPolynomial, map_sum, wittPolynomial]
refine sum_congr rfl fun i _ => ?_
rw [map_monomial, RingHom.map_pow, map_natCast]
#align map_witt_polynomial map_wittPolynomial
variable (R)
@[simp]
theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : ℕ) :
constantCoeff (wittPolynomial p R n) = 0 := by
simp only [wittPolynomial, map_sum, constantCoeff_monomial]
rw [sum_eq_zero]
rintro i _
rw [if_neg]
rw [Finsupp.single_eq_zero]
exact ne_of_gt (pow_pos hp.1.pos _)
#align constant_coeff_witt_polynomial constantCoeff_wittPolynomial
@[simp]
| Mathlib/RingTheory/WittVector/WittPolynomial.lean | 136 | 137 | theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by |
simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self]
| false |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.Data.Nat.Factorial.BigOperators
import Mathlib.Data.Fin.VecNotation
import Mathlib.Data.Finset.Sym
import Mathlib.Data.Finsupp.Multiset
#align_import data.nat.choose.multinomial from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
open Finset
open scoped Nat
namespace Nat
variable {α : Type*} (s : Finset α) (f : α → ℕ) {a b : α} (n : ℕ)
def multinomial : ℕ :=
(∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)!
#align nat.multinomial Nat.multinomial
theorem multinomial_pos : 0 < multinomial s f :=
Nat.div_pos (le_of_dvd (factorial_pos _) (prod_factorial_dvd_factorial_sum s f))
(prod_factorial_pos s f)
#align nat.multinomial_pos Nat.multinomial_pos
theorem multinomial_spec : (∏ i ∈ s, (f i)!) * multinomial s f = (∑ i ∈ s, f i)! :=
Nat.mul_div_cancel' (prod_factorial_dvd_factorial_sum s f)
#align nat.multinomial_spec Nat.multinomial_spec
@[simp] lemma multinomial_empty : multinomial ∅ f = 1 := by simp [multinomial]
#align nat.multinomial_nil Nat.multinomial_empty
@[deprecated (since := "2024-06-01")] alias multinomial_nil := multinomial_empty
variable {s f}
lemma multinomial_cons (ha : a ∉ s) (f : α → ℕ) :
multinomial (s.cons a ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by
rw [multinomial, Nat.div_eq_iff_eq_mul_left _ (prod_factorial_dvd_factorial_sum _ _), prod_cons,
multinomial, mul_assoc, mul_left_comm _ (f a)!,
Nat.div_mul_cancel (prod_factorial_dvd_factorial_sum _ _), ← mul_assoc, Nat.choose_symm_add,
Nat.add_choose_mul_factorial_mul_factorial, Finset.sum_cons]
positivity
lemma multinomial_insert [DecidableEq α] (ha : a ∉ s) (f : α → ℕ) :
multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * multinomial s f := by
rw [← cons_eq_insert _ _ ha, multinomial_cons]
#align nat.multinomial_insert Nat.multinomial_insert
@[simp] lemma multinomial_singleton (a : α) (f : α → ℕ) : multinomial {a} f = 1 := by
rw [← cons_empty, multinomial_cons]; simp
#align nat.multinomial_singleton Nat.multinomial_singleton
@[simp]
theorem multinomial_insert_one [DecidableEq α] (h : a ∉ s) (h₁ : f a = 1) :
multinomial (insert a s) f = (s.sum f).succ * multinomial s f := by
simp only [multinomial, one_mul, factorial]
rw [Finset.sum_insert h, Finset.prod_insert h, h₁, add_comm, ← succ_eq_add_one, factorial_succ]
simp only [factorial_one, one_mul, Function.comp_apply, factorial, mul_one, ← one_eq_succ_zero]
rw [Nat.mul_div_assoc _ (prod_factorial_dvd_factorial_sum _ _)]
#align nat.multinomial_insert_one Nat.multinomial_insert_one
theorem multinomial_congr {f g : α → ℕ} (h : ∀ a ∈ s, f a = g a) :
multinomial s f = multinomial s g := by
simp only [multinomial]; congr 1
· rw [Finset.sum_congr rfl h]
· exact Finset.prod_congr rfl fun a ha => by rw [h a ha]
#align nat.multinomial_congr Nat.multinomial_congr
theorem binomial_eq [DecidableEq α] (h : a ≠ b) :
multinomial {a, b} f = (f a + f b)! / ((f a)! * (f b)!) := by
simp [multinomial, Finset.sum_pair h, Finset.prod_pair h]
#align nat.binomial_eq Nat.binomial_eq
theorem binomial_eq_choose [DecidableEq α] (h : a ≠ b) :
multinomial {a, b} f = (f a + f b).choose (f a) := by
simp [binomial_eq h, choose_eq_factorial_div_factorial (Nat.le_add_right _ _)]
#align nat.binomial_eq_choose Nat.binomial_eq_choose
theorem binomial_spec [DecidableEq α] (hab : a ≠ b) :
(f a)! * (f b)! * multinomial {a, b} f = (f a + f b)! := by
simpa [Finset.sum_pair hab, Finset.prod_pair hab] using multinomial_spec {a, b} f
#align nat.binomial_spec Nat.binomial_spec
@[simp]
theorem binomial_one [DecidableEq α] (h : a ≠ b) (h₁ : f a = 1) :
multinomial {a, b} f = (f b).succ := by
simp [multinomial_insert_one (Finset.not_mem_singleton.mpr h) h₁]
#align nat.binomial_one Nat.binomial_one
theorem binomial_succ_succ [DecidableEq α] (h : a ≠ b) :
multinomial {a, b} (Function.update (Function.update f a (f a).succ) b (f b).succ) =
multinomial {a, b} (Function.update f a (f a).succ) +
multinomial {a, b} (Function.update f b (f b).succ) := by
simp only [binomial_eq_choose, Function.update_apply,
h, Ne, ite_true, ite_false, not_false_eq_true]
rw [if_neg h.symm]
rw [add_succ, choose_succ_succ, succ_add_eq_add_succ]
ring
#align nat.binomial_succ_succ Nat.binomial_succ_succ
theorem succ_mul_binomial [DecidableEq α] (h : a ≠ b) :
(f a + f b).succ * multinomial {a, b} f =
(f a).succ * multinomial {a, b} (Function.update f a (f a).succ) := by
rw [binomial_eq_choose h, binomial_eq_choose h, mul_comm (f a).succ, Function.update_same,
Function.update_noteq (ne_comm.mp h)]
rw [succ_mul_choose_eq (f a + f b) (f a), succ_add (f a) (f b)]
#align nat.succ_mul_binomial Nat.succ_mul_binomial
| Mathlib/Data/Nat/Choose/Multinomial.lean | 145 | 148 | theorem multinomial_univ_two (a b : ℕ) :
multinomial Finset.univ ![a, b] = (a + b)! / (a ! * b !) := by |
rw [multinomial, Fin.sum_univ_two, Fin.prod_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one,
Matrix.head_cons]
| false |
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.Data.Finset.Pointwise
#align_import algebra.monoid_algebra.support from "leanprover-community/mathlib"@"16749fc4661828cba18cd0f4e3c5eb66a8e80598"
open scoped Pointwise
universe u₁ u₂ u₃
namespace MonoidAlgebra
open Finset Finsupp
variable {k : Type u₁} {G : Type u₂} [Semiring k]
theorem support_mul [Mul G] [DecidableEq G] (a b : MonoidAlgebra k G) :
(a * b).support ⊆ a.support * b.support := by
rw [MonoidAlgebra.mul_def]
exact support_sum.trans <| biUnion_subset.2 fun _x hx ↦
support_sum.trans <| biUnion_subset.2 fun _y hy ↦
support_single_subset.trans <| singleton_subset_iff.2 <| mem_image₂_of_mem hx hy
#align monoid_algebra.support_mul MonoidAlgebra.support_mul
theorem support_single_mul_subset [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) (r : k) (a : G) :
(single a r * f : MonoidAlgebra k G).support ⊆ Finset.image (a * ·) f.support :=
(support_mul _ _).trans <| (Finset.image₂_subset_right support_single_subset).trans <| by
rw [Finset.image₂_singleton_left]
#align monoid_algebra.support_single_mul_subset MonoidAlgebra.support_single_mul_subset
theorem support_mul_single_subset [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) (r : k) (a : G) :
(f * single a r).support ⊆ Finset.image (· * a) f.support :=
(support_mul _ _).trans <| (Finset.image₂_subset_left support_single_subset).trans <| by
rw [Finset.image₂_singleton_right]
#align monoid_algebra.support_mul_single_subset MonoidAlgebra.support_mul_single_subset
| Mathlib/Algebra/MonoidAlgebra/Support.lean | 45 | 52 | theorem support_single_mul_eq_image [DecidableEq G] [Mul G] (f : MonoidAlgebra k G) {r : k}
(hr : ∀ y, r * y = 0 ↔ y = 0) {x : G} (lx : IsLeftRegular x) :
(single x r * f : MonoidAlgebra k G).support = Finset.image (x * ·) f.support := by |
refine subset_antisymm (support_single_mul_subset f _ _) fun y hy => ?_
obtain ⟨y, yf, rfl⟩ : ∃ a : G, a ∈ f.support ∧ x * a = y := by
simpa only [Finset.mem_image, exists_prop] using hy
simp only [mul_apply, mem_support_iff.mp yf, hr, mem_support_iff, sum_single_index,
Finsupp.sum_ite_eq', Ne, not_false_iff, if_true, zero_mul, ite_self, sum_zero, lx.eq_iff]
| false |
import Mathlib.Algebra.Ring.Defs
import Mathlib.Algebra.Group.Ext
local macro:max "local_hAdd[" type:term ", " inst:term "]" : term =>
`(term| (letI := $inst; HAdd.hAdd : $type → $type → $type))
local macro:max "local_hMul[" type:term ", " inst:term "]" : term =>
`(term| (letI := $inst; HMul.hMul : $type → $type → $type))
universe u
variable {R : Type u}
@[ext] theorem AddMonoidWithOne.ext ⦃inst₁ inst₂ : AddMonoidWithOne R⦄
(h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂])
(h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one : R)) :
inst₁ = inst₂ := by
have h_monoid : inst₁.toAddMonoid = inst₂.toAddMonoid := by ext : 1; exact h_add
have h_zero' : inst₁.toZero = inst₂.toZero := congrArg (·.toZero) h_monoid
have h_one' : inst₁.toOne = inst₂.toOne :=
congrArg One.mk h_one
have h_natCast : inst₁.toNatCast.natCast = inst₂.toNatCast.natCast := by
funext n; induction n with
| zero => rewrite [inst₁.natCast_zero, inst₂.natCast_zero]
exact congrArg (@Zero.zero R) h_zero'
| succ n h => rw [inst₁.natCast_succ, inst₂.natCast_succ, h_add]
exact congrArg₂ _ h h_one
rcases inst₁ with @⟨⟨⟩⟩; rcases inst₂ with @⟨⟨⟩⟩
congr
theorem AddCommMonoidWithOne.toAddMonoidWithOne_injective :
Function.Injective (@AddCommMonoidWithOne.toAddMonoidWithOne R) := by
rintro ⟨⟩ ⟨⟩ _; congr
@[ext] theorem AddCommMonoidWithOne.ext ⦃inst₁ inst₂ : AddCommMonoidWithOne R⦄
(h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂])
(h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one : R)) :
inst₁ = inst₂ :=
AddCommMonoidWithOne.toAddMonoidWithOne_injective <|
AddMonoidWithOne.ext h_add h_one
@[ext] theorem AddGroupWithOne.ext ⦃inst₁ inst₂ : AddGroupWithOne R⦄
(h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂])
(h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one)) :
inst₁ = inst₂ := by
have : inst₁.toAddMonoidWithOne = inst₂.toAddMonoidWithOne :=
AddMonoidWithOne.ext h_add h_one
have : inst₁.toNatCast = inst₂.toNatCast := congrArg (·.toNatCast) this
have h_group : inst₁.toAddGroup = inst₂.toAddGroup := by ext : 1; exact h_add
-- Extract equality of necessary substructures from h_group
injection h_group with h_group; injection h_group
have : inst₁.toIntCast.intCast = inst₂.toIntCast.intCast := by
funext n; cases n with
| ofNat n => rewrite [Int.ofNat_eq_coe, inst₁.intCast_ofNat, inst₂.intCast_ofNat]; congr
| negSucc n => rewrite [inst₁.intCast_negSucc, inst₂.intCast_negSucc]; congr
rcases inst₁ with @⟨⟨⟩⟩; rcases inst₂ with @⟨⟨⟩⟩
congr
@[ext] theorem AddCommGroupWithOne.ext ⦃inst₁ inst₂ : AddCommGroupWithOne R⦄
(h_add : local_hAdd[R, inst₁] = local_hAdd[R, inst₂])
(h_one : (letI := inst₁; One.one : R) = (letI := inst₂; One.one)) :
inst₁ = inst₂ := by
have : inst₁.toAddCommGroup = inst₂.toAddCommGroup :=
AddCommGroup.ext h_add
have : inst₁.toAddGroupWithOne = inst₂.toAddGroupWithOne :=
AddGroupWithOne.ext h_add h_one
injection this with _ h_addMonoidWithOne; injection h_addMonoidWithOne
cases inst₁; cases inst₂
congr
namespace NonUnitalCommSemiring
| Mathlib/Algebra/Ring/Ext.lean | 427 | 429 | theorem toNonUnitalSemiring_injective :
Function.Injective (@toNonUnitalSemiring R) := by |
rintro ⟨⟩ ⟨⟩ _; congr
| false |
import Mathlib.GroupTheory.Solvable
import Mathlib.FieldTheory.PolynomialGaloisGroup
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial IntermediateField
open Polynomial IntermediateField
section AbelRuffini
variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E]
theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance
#align gal_zero_is_solvable gal_zero_isSolvable
theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance
#align gal_one_is_solvable gal_one_isSolvable
theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_C_is_solvable gal_C_isSolvable
theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_is_solvable gal_X_isSolvable
theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable
theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by infer_instance
set_option linter.uppercaseLean3 false in
#align gal_X_pow_is_solvable gal_X_pow_isSolvable
theorem gal_mul_isSolvable {p q : F[X]} (_ : IsSolvable p.Gal) (_ : IsSolvable q.Gal) :
IsSolvable (p * q).Gal :=
solvable_of_solvable_injective (Gal.restrictProd_injective p q)
#align gal_mul_is_solvable gal_mul_isSolvable
| Mathlib/FieldTheory/AbelRuffini.lean | 66 | 72 | theorem gal_prod_isSolvable {s : Multiset F[X]} (hs : ∀ p ∈ s, IsSolvable (Gal p)) :
IsSolvable s.prod.Gal := by |
apply Multiset.induction_on' s
· exact gal_one_isSolvable
· intro p t hps _ ht
rw [Multiset.insert_eq_cons, Multiset.prod_cons]
exact gal_mul_isSolvable (hs p hps) ht
| false |
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.monoid from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
namespace Set
variable {M : Type*} [OrderedCancelAddCommMonoid M] [ExistsAddOfLE M] (a b c d : M)
theorem Ici_add_bij : BijOn (· + d) (Ici a) (Ici (a + d)) := by
refine
⟨fun x h => add_le_add_right (mem_Ici.mp h) _, (add_left_injective d).injOn, fun _ h => ?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ici.mp h)
rw [mem_Ici, add_right_comm, add_le_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ici_add_bij Set.Ici_add_bij
theorem Ioi_add_bij : BijOn (· + d) (Ioi a) (Ioi (a + d)) := by
refine
⟨fun x h => add_lt_add_right (mem_Ioi.mp h) _, fun _ _ _ _ h => add_right_cancel h, fun _ h =>
?_⟩
obtain ⟨c, rfl⟩ := exists_add_of_le (mem_Ioi.mp h).le
rw [mem_Ioi, add_right_comm, add_lt_add_iff_right] at h
exact ⟨a + c, h, by rw [add_right_comm]⟩
#align set.Ioi_add_bij Set.Ioi_add_bij
theorem Icc_add_bij : BijOn (· + d) (Icc a b) (Icc (a + d) (b + d)) := by
rw [← Ici_inter_Iic, ← Ici_inter_Iic]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Icc_add_bij Set.Icc_add_bij
theorem Ioo_add_bij : BijOn (· + d) (Ioo a b) (Ioo (a + d) (b + d)) := by
rw [← Ioi_inter_Iio, ← Ioi_inter_Iio]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ioo_add_bij Set.Ioo_add_bij
theorem Ioc_add_bij : BijOn (· + d) (Ioc a b) (Ioc (a + d) (b + d)) := by
rw [← Ioi_inter_Iic, ← Ioi_inter_Iic]
exact
(Ioi_add_bij a d).inter_mapsTo (fun x hx => add_le_add_right hx _) fun x hx =>
le_of_add_le_add_right hx.2
#align set.Ioc_add_bij Set.Ioc_add_bij
theorem Ico_add_bij : BijOn (· + d) (Ico a b) (Ico (a + d) (b + d)) := by
rw [← Ici_inter_Iio, ← Ici_inter_Iio]
exact
(Ici_add_bij a d).inter_mapsTo (fun x hx => add_lt_add_right hx _) fun x hx =>
lt_of_add_lt_add_right hx.2
#align set.Ico_add_bij Set.Ico_add_bij
@[simp]
theorem image_add_const_Ici : (fun x => x + a) '' Ici b = Ici (b + a) :=
(Ici_add_bij _ _).image_eq
#align set.image_add_const_Ici Set.image_add_const_Ici
@[simp]
theorem image_add_const_Ioi : (fun x => x + a) '' Ioi b = Ioi (b + a) :=
(Ioi_add_bij _ _).image_eq
#align set.image_add_const_Ioi Set.image_add_const_Ioi
@[simp]
theorem image_add_const_Icc : (fun x => x + a) '' Icc b c = Icc (b + a) (c + a) :=
(Icc_add_bij _ _ _).image_eq
#align set.image_add_const_Icc Set.image_add_const_Icc
@[simp]
theorem image_add_const_Ico : (fun x => x + a) '' Ico b c = Ico (b + a) (c + a) :=
(Ico_add_bij _ _ _).image_eq
#align set.image_add_const_Ico Set.image_add_const_Ico
@[simp]
theorem image_add_const_Ioc : (fun x => x + a) '' Ioc b c = Ioc (b + a) (c + a) :=
(Ioc_add_bij _ _ _).image_eq
#align set.image_add_const_Ioc Set.image_add_const_Ioc
@[simp]
theorem image_add_const_Ioo : (fun x => x + a) '' Ioo b c = Ioo (b + a) (c + a) :=
(Ioo_add_bij _ _ _).image_eq
#align set.image_add_const_Ioo Set.image_add_const_Ioo
@[simp]
theorem image_const_add_Ici : (fun x => a + x) '' Ici b = Ici (a + b) := by
simp only [add_comm a, image_add_const_Ici]
#align set.image_const_add_Ici Set.image_const_add_Ici
@[simp]
theorem image_const_add_Ioi : (fun x => a + x) '' Ioi b = Ioi (a + b) := by
simp only [add_comm a, image_add_const_Ioi]
#align set.image_const_add_Ioi Set.image_const_add_Ioi
@[simp]
theorem image_const_add_Icc : (fun x => a + x) '' Icc b c = Icc (a + b) (a + c) := by
simp only [add_comm a, image_add_const_Icc]
#align set.image_const_add_Icc Set.image_const_add_Icc
@[simp]
theorem image_const_add_Ico : (fun x => a + x) '' Ico b c = Ico (a + b) (a + c) := by
simp only [add_comm a, image_add_const_Ico]
#align set.image_const_add_Ico Set.image_const_add_Ico
@[simp]
| Mathlib/Algebra/Order/Interval/Set/Monoid.lean | 133 | 134 | theorem image_const_add_Ioc : (fun x => a + x) '' Ioc b c = Ioc (a + b) (a + c) := by |
simp only [add_comm a, image_add_const_Ioc]
| false |
import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
import Mathlib.Analysis.Complex.CauchyIntegral
import Mathlib.MeasureTheory.Integral.Pi
import Mathlib.Analysis.Fourier.FourierTransform
open Real Set MeasureTheory Filter Asymptotics intervalIntegral
open scoped Real Topology FourierTransform RealInnerProductSpace
open Complex hiding exp continuous_exp abs_of_nonneg sq_abs
noncomputable section
namespace GaussianFourier
variable {b : ℂ}
def verticalIntegral (b : ℂ) (c T : ℝ) : ℂ :=
∫ y : ℝ in (0 : ℝ)..c, I * (cexp (-b * (T + y * I) ^ 2) - cexp (-b * (T - y * I) ^ 2))
#align gaussian_fourier.vertical_integral GaussianFourier.verticalIntegral
theorem norm_cexp_neg_mul_sq_add_mul_I (b : ℂ) (c T : ℝ) :
‖cexp (-b * (T + c * I) ^ 2)‖ = exp (-(b.re * T ^ 2 - 2 * b.im * c * T - b.re * c ^ 2)) := by
rw [Complex.norm_eq_abs, Complex.abs_exp, neg_mul, neg_re, ← re_add_im b]
simp only [sq, re_add_im, mul_re, mul_im, add_re, add_im, ofReal_re, ofReal_im, I_re, I_im]
ring_nf
set_option linter.uppercaseLean3 false in
#align gaussian_fourier.norm_cexp_neg_mul_sq_add_mul_I GaussianFourier.norm_cexp_neg_mul_sq_add_mul_I
theorem norm_cexp_neg_mul_sq_add_mul_I' (hb : b.re ≠ 0) (c T : ℝ) :
‖cexp (-b * (T + c * I) ^ 2)‖ =
exp (-(b.re * (T - b.im * c / b.re) ^ 2 - c ^ 2 * (b.im ^ 2 / b.re + b.re))) := by
have :
b.re * T ^ 2 - 2 * b.im * c * T - b.re * c ^ 2 =
b.re * (T - b.im * c / b.re) ^ 2 - c ^ 2 * (b.im ^ 2 / b.re + b.re) := by
field_simp; ring
rw [norm_cexp_neg_mul_sq_add_mul_I, this]
set_option linter.uppercaseLean3 false in
#align gaussian_fourier.norm_cexp_neg_mul_sq_add_mul_I' GaussianFourier.norm_cexp_neg_mul_sq_add_mul_I'
theorem verticalIntegral_norm_le (hb : 0 < b.re) (c : ℝ) {T : ℝ} (hT : 0 ≤ T) :
‖verticalIntegral b c T‖ ≤
(2 : ℝ) * |c| * exp (-(b.re * T ^ 2 - (2 : ℝ) * |b.im| * |c| * T - b.re * c ^ 2)) := by
-- first get uniform bound for integrand
have vert_norm_bound :
∀ {T : ℝ},
0 ≤ T →
∀ {c y : ℝ},
|y| ≤ |c| →
‖cexp (-b * (T + y * I) ^ 2)‖ ≤
exp (-(b.re * T ^ 2 - (2 : ℝ) * |b.im| * |c| * T - b.re * c ^ 2)) := by
intro T hT c y hy
rw [norm_cexp_neg_mul_sq_add_mul_I b]
gcongr exp (- (_ - ?_ * _ - _ * ?_))
· (conv_lhs => rw [mul_assoc]); (conv_rhs => rw [mul_assoc])
gcongr _ * ?_
refine (le_abs_self _).trans ?_
rw [abs_mul]
gcongr
· rwa [sq_le_sq]
-- now main proof
apply (intervalIntegral.norm_integral_le_of_norm_le_const _).trans
pick_goal 1
· rw [sub_zero]
conv_lhs => simp only [mul_comm _ |c|]
conv_rhs =>
conv =>
congr
rw [mul_comm]
rw [mul_assoc]
· intro y hy
have absy : |y| ≤ |c| := by
rcases le_or_lt 0 c with (h | h)
· rw [uIoc_of_le h] at hy
rw [abs_of_nonneg h, abs_of_pos hy.1]
exact hy.2
· rw [uIoc_of_lt h] at hy
rw [abs_of_neg h, abs_of_nonpos hy.2, neg_le_neg_iff]
exact hy.1.le
rw [norm_mul, Complex.norm_eq_abs, abs_I, one_mul, two_mul]
refine (norm_sub_le _ _).trans (add_le_add (vert_norm_bound hT absy) ?_)
rw [← abs_neg y] at absy
simpa only [neg_mul, ofReal_neg] using vert_norm_bound hT absy
#align gaussian_fourier.vertical_integral_norm_le GaussianFourier.verticalIntegral_norm_le
theorem tendsto_verticalIntegral (hb : 0 < b.re) (c : ℝ) :
Tendsto (verticalIntegral b c) atTop (𝓝 0) := by
-- complete proof using squeeze theorem:
rw [tendsto_zero_iff_norm_tendsto_zero]
refine
tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds ?_
(eventually_of_forall fun _ => norm_nonneg _)
((eventually_ge_atTop (0 : ℝ)).mp
(eventually_of_forall fun T hT => verticalIntegral_norm_le hb c hT))
rw [(by ring : 0 = 2 * |c| * 0)]
refine (tendsto_exp_atBot.comp (tendsto_neg_atTop_atBot.comp ?_)).const_mul _
apply tendsto_atTop_add_const_right
simp_rw [sq, ← mul_assoc, ← sub_mul]
refine Tendsto.atTop_mul_atTop (tendsto_atTop_add_const_right _ _ ?_) tendsto_id
exact (tendsto_const_mul_atTop_of_pos hb).mpr tendsto_id
#align gaussian_fourier.tendsto_vertical_integral GaussianFourier.tendsto_verticalIntegral
| Mathlib/Analysis/SpecialFunctions/Gaussian/FourierTransform.lean | 132 | 145 | theorem integrable_cexp_neg_mul_sq_add_real_mul_I (hb : 0 < b.re) (c : ℝ) :
Integrable fun x : ℝ => cexp (-b * (x + c * I) ^ 2) := by |
refine
⟨(Complex.continuous_exp.comp
(continuous_const.mul
((continuous_ofReal.add continuous_const).pow 2))).aestronglyMeasurable,
?_⟩
rw [← hasFiniteIntegral_norm_iff]
simp_rw [norm_cexp_neg_mul_sq_add_mul_I' hb.ne', neg_sub _ (c ^ 2 * _),
sub_eq_add_neg _ (b.re * _), Real.exp_add]
suffices Integrable fun x : ℝ => exp (-(b.re * x ^ 2)) by
exact (Integrable.comp_sub_right this (b.im * c / b.re)).hasFiniteIntegral.const_mul _
simp_rw [← neg_mul]
apply integrable_exp_neg_mul_sq hb
| false |
import Mathlib.Analysis.InnerProductSpace.Dual
#align_import analysis.inner_product_space.lax_milgram from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open RCLike LinearMap ContinuousLinearMap InnerProductSpace
open LinearMap (ker range)
open RealInnerProductSpace NNReal
universe u
namespace IsCoercive
variable {V : Type u} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [CompleteSpace V]
variable {B : V →L[ℝ] V →L[ℝ] ℝ}
local postfix:1024 "♯" => @continuousLinearMapOfBilin ℝ V _ _ _ _
| Mathlib/Analysis/InnerProductSpace/LaxMilgram.lean | 51 | 62 | theorem bounded_below (coercive : IsCoercive B) : ∃ C, 0 < C ∧ ∀ v, C * ‖v‖ ≤ ‖B♯ v‖ := by |
rcases coercive with ⟨C, C_ge_0, coercivity⟩
refine ⟨C, C_ge_0, ?_⟩
intro v
by_cases h : 0 < ‖v‖
· refine (mul_le_mul_right h).mp ?_
calc
C * ‖v‖ * ‖v‖ ≤ B v v := coercivity v
_ = ⟪B♯ v, v⟫_ℝ := (continuousLinearMapOfBilin_apply B v v).symm
_ ≤ ‖B♯ v‖ * ‖v‖ := real_inner_le_norm (B♯ v) v
· have : v = 0 := by simpa using h
simp [this]
| false |
import Mathlib.Logic.Equiv.Option
import Mathlib.Order.RelIso.Basic
import Mathlib.Order.Disjoint
import Mathlib.Order.WithBot
import Mathlib.Tactic.Monotonicity.Attr
import Mathlib.Util.AssertExists
#align_import order.hom.basic from "leanprover-community/mathlib"@"62a5626868683c104774de8d85b9855234ac807c"
open OrderDual
variable {F α β γ δ : Type*}
structure OrderHom (α β : Type*) [Preorder α] [Preorder β] where
toFun : α → β
monotone' : Monotone toFun
#align order_hom OrderHom
infixr:25 " →o " => OrderHom
abbrev OrderEmbedding (α β : Type*) [LE α] [LE β] :=
@RelEmbedding α β (· ≤ ·) (· ≤ ·)
#align order_embedding OrderEmbedding
infixl:25 " ↪o " => OrderEmbedding
abbrev OrderIso (α β : Type*) [LE α] [LE β] :=
@RelIso α β (· ≤ ·) (· ≤ ·)
#align order_iso OrderIso
infixl:25 " ≃o " => OrderIso
section
abbrev OrderHomClass (F : Type*) (α β : outParam Type*) [LE α] [LE β] [FunLike F α β] :=
RelHomClass F ((· ≤ ·) : α → α → Prop) ((· ≤ ·) : β → β → Prop)
#align order_hom_class OrderHomClass
class OrderIsoClass (F α β : Type*) [LE α] [LE β] [EquivLike F α β] : Prop where
map_le_map_iff (f : F) {a b : α} : f a ≤ f b ↔ a ≤ b
#align order_iso_class OrderIsoClass
end
export OrderIsoClass (map_le_map_iff)
attribute [simp] map_le_map_iff
@[coe]
def OrderIsoClass.toOrderIso [LE α] [LE β] [EquivLike F α β] [OrderIsoClass F α β] (f : F) :
α ≃o β :=
{ EquivLike.toEquiv f with map_rel_iff' := map_le_map_iff f }
instance [LE α] [LE β] [EquivLike F α β] [OrderIsoClass F α β] : CoeTC F (α ≃o β) :=
⟨OrderIsoClass.toOrderIso⟩
-- See note [lower instance priority]
instance (priority := 100) OrderIsoClass.toOrderHomClass [LE α] [LE β]
[EquivLike F α β] [OrderIsoClass F α β] : OrderHomClass F α β :=
{ EquivLike.toEmbeddingLike (E := F) with
map_rel := fun f _ _ => (map_le_map_iff f).2 }
#align order_iso_class.to_order_hom_class OrderIsoClass.toOrderHomClass
section OrderIsoClass
def RelEmbedding.orderEmbeddingOfLTEmbedding [PartialOrder α] [PartialOrder β]
(f : ((· < ·) : α → α → Prop) ↪r ((· < ·) : β → β → Prop)) : α ↪o β :=
{ f with
map_rel_iff' := by
intros
simp [le_iff_lt_or_eq, f.map_rel_iff, f.injective.eq_iff] }
#align rel_embedding.order_embedding_of_lt_embedding RelEmbedding.orderEmbeddingOfLTEmbedding
@[simp]
theorem RelEmbedding.orderEmbeddingOfLTEmbedding_apply [PartialOrder α] [PartialOrder β]
{f : ((· < ·) : α → α → Prop) ↪r ((· < ·) : β → β → Prop)} {x : α} :
RelEmbedding.orderEmbeddingOfLTEmbedding f x = f x :=
rfl
#align rel_embedding.order_embedding_of_lt_embedding_apply RelEmbedding.orderEmbeddingOfLTEmbedding_apply
protected def OrderIso.dual [LE α] [LE β] (f : α ≃o β) : αᵒᵈ ≃o βᵒᵈ :=
⟨f.toEquiv, f.map_rel_iff⟩
#align order_iso.dual OrderIso.dual
section LatticeIsos
| Mathlib/Order/Hom/Basic.lean | 1,235 | 1,239 | theorem OrderIso.map_bot' [LE α] [PartialOrder β] (f : α ≃o β) {x : α} {y : β} (hx : ∀ x', x ≤ x')
(hy : ∀ y', y ≤ y') : f x = y := by |
refine le_antisymm ?_ (hy _)
rw [← f.apply_symm_apply y, f.map_rel_iff]
apply hx
| false |
import Mathlib.Data.Finset.Sigma
import Mathlib.Data.Finset.Pairwise
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Fintype.Basic
import Mathlib.Order.CompleteLatticeIntervals
#align_import order.sup_indep from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d"
variable {α β ι ι' : Type*}
namespace Finset
section Lattice
variable [Lattice α] [OrderBot α]
def SupIndep (s : Finset ι) (f : ι → α) : Prop :=
∀ ⦃t⦄, t ⊆ s → ∀ ⦃i⦄, i ∈ s → i ∉ t → Disjoint (f i) (t.sup f)
#align finset.sup_indep Finset.SupIndep
variable {s t : Finset ι} {f : ι → α} {i : ι}
instance [DecidableEq ι] [DecidableEq α] : Decidable (SupIndep s f) := by
refine @Finset.decidableForallOfDecidableSubsets _ _ _ (?_)
rintro t -
refine @Finset.decidableDforallFinset _ _ _ (?_)
rintro i -
have : Decidable (Disjoint (f i) (sup t f)) := decidable_of_iff' (_ = ⊥) disjoint_iff
infer_instance
theorem SupIndep.subset (ht : t.SupIndep f) (h : s ⊆ t) : s.SupIndep f := fun _ hu _ hi =>
ht (hu.trans h) (h hi)
#align finset.sup_indep.subset Finset.SupIndep.subset
@[simp]
theorem supIndep_empty (f : ι → α) : (∅ : Finset ι).SupIndep f := fun _ _ a ha =>
(not_mem_empty a ha).elim
#align finset.sup_indep_empty Finset.supIndep_empty
theorem supIndep_singleton (i : ι) (f : ι → α) : ({i} : Finset ι).SupIndep f :=
fun s hs j hji hj => by
rw [eq_empty_of_ssubset_singleton ⟨hs, fun h => hj (h hji)⟩, sup_empty]
exact disjoint_bot_right
#align finset.sup_indep_singleton Finset.supIndep_singleton
theorem SupIndep.pairwiseDisjoint (hs : s.SupIndep f) : (s : Set ι).PairwiseDisjoint f :=
fun _ ha _ hb hab =>
sup_singleton.subst <| hs (singleton_subset_iff.2 hb) ha <| not_mem_singleton.2 hab
#align finset.sup_indep.pairwise_disjoint Finset.SupIndep.pairwiseDisjoint
theorem SupIndep.le_sup_iff (hs : s.SupIndep f) (hts : t ⊆ s) (hi : i ∈ s) (hf : ∀ i, f i ≠ ⊥) :
f i ≤ t.sup f ↔ i ∈ t := by
refine ⟨fun h => ?_, le_sup⟩
by_contra hit
exact hf i (disjoint_self.1 <| (hs hts hi hit).mono_right h)
#align finset.sup_indep.le_sup_iff Finset.SupIndep.le_sup_iff
theorem supIndep_iff_disjoint_erase [DecidableEq ι] :
s.SupIndep f ↔ ∀ i ∈ s, Disjoint (f i) ((s.erase i).sup f) :=
⟨fun hs _ hi => hs (erase_subset _ _) hi (not_mem_erase _ _), fun hs _ ht i hi hit =>
(hs i hi).mono_right (sup_mono fun _ hj => mem_erase.2 ⟨ne_of_mem_of_not_mem hj hit, ht hj⟩)⟩
#align finset.sup_indep_iff_disjoint_erase Finset.supIndep_iff_disjoint_erase
theorem SupIndep.image [DecidableEq ι] {s : Finset ι'} {g : ι' → ι} (hs : s.SupIndep (f ∘ g)) :
(s.image g).SupIndep f := by
intro t ht i hi hit
rw [mem_image] at hi
obtain ⟨i, hi, rfl⟩ := hi
haveI : DecidableEq ι' := Classical.decEq _
suffices hts : t ⊆ (s.erase i).image g by
refine (supIndep_iff_disjoint_erase.1 hs i hi).mono_right ((sup_mono hts).trans ?_)
rw [sup_image]
rintro j hjt
obtain ⟨j, hj, rfl⟩ := mem_image.1 (ht hjt)
exact mem_image_of_mem _ (mem_erase.2 ⟨ne_of_apply_ne g (ne_of_mem_of_not_mem hjt hit), hj⟩)
#align finset.sup_indep.image Finset.SupIndep.image
theorem supIndep_map {s : Finset ι'} {g : ι' ↪ ι} : (s.map g).SupIndep f ↔ s.SupIndep (f ∘ g) := by
refine ⟨fun hs t ht i hi hit => ?_, fun hs => ?_⟩
· rw [← sup_map]
exact hs (map_subset_map.2 ht) ((mem_map' _).2 hi) (by rwa [mem_map'])
· classical
rw [map_eq_image]
exact hs.image
#align finset.sup_indep_map Finset.supIndep_map
@[simp]
theorem supIndep_pair [DecidableEq ι] {i j : ι} (hij : i ≠ j) :
({i, j} : Finset ι).SupIndep f ↔ Disjoint (f i) (f j) :=
⟨fun h => h.pairwiseDisjoint (by simp) (by simp) hij,
fun h => by
rw [supIndep_iff_disjoint_erase]
intro k hk
rw [Finset.mem_insert, Finset.mem_singleton] at hk
obtain rfl | rfl := hk
· convert h using 1
rw [Finset.erase_insert, Finset.sup_singleton]
simpa using hij
· convert h.symm using 1
have : ({i, k} : Finset ι).erase k = {i} := by
ext
rw [mem_erase, mem_insert, mem_singleton, mem_singleton, and_or_left, Ne,
not_and_self_iff, or_false_iff, and_iff_right_of_imp]
rintro rfl
exact hij
rw [this, Finset.sup_singleton]⟩
#align finset.sup_indep_pair Finset.supIndep_pair
| Mathlib/Order/SupIndep.lean | 151 | 154 | theorem supIndep_univ_bool (f : Bool → α) :
(Finset.univ : Finset Bool).SupIndep f ↔ Disjoint (f false) (f true) :=
haveI : true ≠ false := by | simp only [Ne, not_false_iff]
(supIndep_pair this).trans disjoint_comm
| false |
import Mathlib.Analysis.BoxIntegral.Partition.Filter
import Mathlib.Analysis.BoxIntegral.Partition.Measure
import Mathlib.Topology.UniformSpace.Compact
import Mathlib.Init.Data.Bool.Lemmas
#align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical Topology NNReal Filter Uniformity BoxIntegral
open Set Finset Function Filter Metric BoxIntegral.IntegrationParams
noncomputable section
namespace BoxIntegral
universe u v w
variable {ι : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F] {I J : Box ι} {π : TaggedPrepartition I}
open TaggedPrepartition
local notation "ℝⁿ" => ι → ℝ
def integralSum (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I) : F :=
∑ J ∈ π.boxes, vol J (f (π.tag J))
#align box_integral.integral_sum BoxIntegral.integralSum
theorem integralSum_biUnionTagged (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : Prepartition I)
(πi : ∀ J, TaggedPrepartition J) :
integralSum f vol (π.biUnionTagged πi) = ∑ J ∈ π.boxes, integralSum f vol (πi J) := by
refine (π.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_
rw [π.tag_biUnionTagged hJ hJ']
#align box_integral.integral_sum_bUnion_tagged BoxIntegral.integralSum_biUnionTagged
theorem integralSum_biUnion_partition (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F)
(π : TaggedPrepartition I) (πi : ∀ J, Prepartition J) (hπi : ∀ J ∈ π, (πi J).IsPartition) :
integralSum f vol (π.biUnionPrepartition πi) = integralSum f vol π := by
refine (π.sum_biUnion_boxes _ _).trans (sum_congr rfl fun J hJ => ?_)
calc
(∑ J' ∈ (πi J).boxes, vol J' (f (π.tag <| π.toPrepartition.biUnionIndex πi J'))) =
∑ J' ∈ (πi J).boxes, vol J' (f (π.tag J)) :=
sum_congr rfl fun J' hJ' => by rw [Prepartition.biUnionIndex_of_mem _ hJ hJ']
_ = vol J (f (π.tag J)) :=
(vol.map ⟨⟨fun g : E →L[ℝ] F => g (f (π.tag J)), rfl⟩, fun _ _ => rfl⟩).sum_partition_boxes
le_top (hπi J hJ)
#align box_integral.integral_sum_bUnion_partition BoxIntegral.integralSum_biUnion_partition
theorem integralSum_inf_partition (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) (π : TaggedPrepartition I)
{π' : Prepartition I} (h : π'.IsPartition) :
integralSum f vol (π.infPrepartition π') = integralSum f vol π :=
integralSum_biUnion_partition f vol π _ fun _J hJ => h.restrict (Prepartition.le_of_mem _ hJ)
#align box_integral.integral_sum_inf_partition BoxIntegral.integralSum_inf_partition
theorem integralSum_fiberwise {α} (g : Box ι → α) (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F)
(π : TaggedPrepartition I) :
(∑ y ∈ π.boxes.image g, integralSum f vol (π.filter (g · = y))) = integralSum f vol π :=
π.sum_fiberwise g fun J => vol J (f <| π.tag J)
#align box_integral.integral_sum_fiberwise BoxIntegral.integralSum_fiberwise
theorem integralSum_sub_partitions (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F)
{π₁ π₂ : TaggedPrepartition I} (h₁ : π₁.IsPartition) (h₂ : π₂.IsPartition) :
integralSum f vol π₁ - integralSum f vol π₂ =
∑ J ∈ (π₁.toPrepartition ⊓ π₂.toPrepartition).boxes,
(vol J (f <| (π₁.infPrepartition π₂.toPrepartition).tag J) -
vol J (f <| (π₂.infPrepartition π₁.toPrepartition).tag J)) := by
rw [← integralSum_inf_partition f vol π₁ h₂, ← integralSum_inf_partition f vol π₂ h₁,
integralSum, integralSum, Finset.sum_sub_distrib]
simp only [infPrepartition_toPrepartition, inf_comm]
#align box_integral.integral_sum_sub_partitions BoxIntegral.integralSum_sub_partitions
@[simp]
| Mathlib/Analysis/BoxIntegral/Basic.lean | 127 | 133 | theorem integralSum_disjUnion (f : ℝⁿ → E) (vol : ι →ᵇᵃ E →L[ℝ] F) {π₁ π₂ : TaggedPrepartition I}
(h : Disjoint π₁.iUnion π₂.iUnion) :
integralSum f vol (π₁.disjUnion π₂ h) = integralSum f vol π₁ + integralSum f vol π₂ := by |
refine (Prepartition.sum_disj_union_boxes h _).trans
(congr_arg₂ (· + ·) (sum_congr rfl fun J hJ => ?_) (sum_congr rfl fun J hJ => ?_))
· rw [disjUnion_tag_of_mem_left _ hJ]
· rw [disjUnion_tag_of_mem_right _ hJ]
| false |
import Mathlib.Data.Finsupp.Lex
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Order.GameAdd
#align_import logic.hydra from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace Relation
open Multiset Prod
variable {α : Type*}
def CutExpand (r : α → α → Prop) (s' s : Multiset α) : Prop :=
∃ (t : Multiset α) (a : α), (∀ a' ∈ t, r a' a) ∧ s' + {a} = s + t
#align relation.cut_expand Relation.CutExpand
variable {r : α → α → Prop}
| Mathlib/Logic/Hydra.lean | 62 | 74 | theorem cutExpand_le_invImage_lex [DecidableEq α] [IsIrrefl α r] :
CutExpand r ≤ InvImage (Finsupp.Lex (rᶜ ⊓ (· ≠ ·)) (· < ·)) toFinsupp := by |
rintro s t ⟨u, a, hr, he⟩
replace hr := fun a' ↦ mt (hr a')
classical
refine ⟨a, fun b h ↦ ?_, ?_⟩ <;> simp_rw [toFinsupp_apply]
· apply_fun count b at he
simpa only [count_add, count_singleton, if_neg h.2, add_zero, count_eq_zero.2 (hr b h.1)]
using he
· apply_fun count a at he
simp only [count_add, count_singleton_self, count_eq_zero.2 (hr _ (irrefl_of r a)),
add_zero] at he
exact he ▸ Nat.lt_succ_self _
| false |
import Mathlib.Analysis.SpecialFunctions.Complex.Arg
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Complex
open Set Filter Bornology
open scoped Real Topology ComplexConjugate
-- Porting note: @[pp_nodot] does not exist in mathlib4
noncomputable def log (x : ℂ) : ℂ :=
x.abs.log + arg x * I
#align complex.log Complex.log
theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log]
#align complex.log_re Complex.log_re
theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log]
#align complex.log_im Complex.log_im
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by simp only [log_im, neg_pi_lt_arg]
#align complex.neg_pi_lt_log_im Complex.neg_pi_lt_log_im
theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by simp only [log_im, arg_le_pi]
#align complex.log_im_le_pi Complex.log_im_le_pi
theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by
rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp,
Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc,
mul_div_cancel₀ _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
#align complex.exp_log Complex.exp_log
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
Set.ext fun x =>
⟨by
rintro ⟨x, rfl⟩
exact exp_ne_zero x, fun hx => ⟨log x, exp_log hx⟩⟩
#align complex.range_exp Complex.range_exp
theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp,
arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im]
#align complex.log_exp Complex.log_exp
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im)
(hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by
rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy]
#align complex.exp_inj_of_neg_pi_lt_of_le_pi Complex.exp_inj_of_neg_pi_lt_of_le_pi
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
(by rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx])
#align complex.of_real_log Complex.ofReal_log
@[simp, norm_cast]
lemma natCast_log {n : ℕ} : Real.log n = log n := ofReal_natCast n ▸ ofReal_log n.cast_nonneg
@[simp]
lemma ofNat_log {n : ℕ} [n.AtLeastTwo] :
Real.log (no_index (OfNat.ofNat n)) = log (OfNat.ofNat n) :=
natCast_log
theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by simp [log_re]
#align complex.log_of_real_re Complex.log_ofReal_re
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
log (r * x) = Real.log r + log x := by
replace hx := Complex.abs.ne_zero_iff.mpr hx
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
ofReal_add, add_assoc]
#align complex.log_of_real_mul Complex.log_ofReal_mul
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) :
log (x * r) = Real.log r + log x := by rw [mul_comm, log_ofReal_mul hr hx]
#align complex.log_mul_of_real Complex.log_mul_ofReal
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
Real.log_mul (abs.ne_zero hx₀) (abs.ne_zero hy₀), true_and]
alias ⟨_, log_mul⟩ := log_mul_eq_add_log_iff
@[simp]
theorem log_zero : log 0 = 0 := by simp [log]
#align complex.log_zero Complex.log_zero
@[simp]
theorem log_one : log 1 = 0 := by simp [log]
#align complex.log_one Complex.log_one
theorem log_neg_one : log (-1) = π * I := by simp [log]
#align complex.log_neg_one Complex.log_neg_one
| Mathlib/Analysis/SpecialFunctions/Complex/Log.lean | 116 | 116 | theorem log_I : log I = π / 2 * I := by | simp [log]
| false |
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped NNReal Matrix
namespace Matrix
variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n]
section LinfLinf
protected def normedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) :=
Pi.normedAddCommGroup
#align matrix.normed_add_comm_group Matrix.normedAddCommGroup
section frobenius
open scoped Matrix
@[local instance]
def frobeniusSeminormedAddCommGroup [SeminormedAddCommGroup α] :
SeminormedAddCommGroup (Matrix m n α) :=
inferInstanceAs (SeminormedAddCommGroup (PiLp 2 fun _i : m => PiLp 2 fun _j : n => α))
#align matrix.frobenius_seminormed_add_comm_group Matrix.frobeniusSeminormedAddCommGroup
@[local instance]
def frobeniusNormedAddCommGroup [NormedAddCommGroup α] : NormedAddCommGroup (Matrix m n α) :=
(by infer_instance : NormedAddCommGroup (PiLp 2 fun i : m => PiLp 2 fun j : n => α))
#align matrix.frobenius_normed_add_comm_group Matrix.frobeniusNormedAddCommGroup
@[local instance]
theorem frobeniusBoundedSMul [SeminormedRing R] [SeminormedAddCommGroup α] [Module R α]
[BoundedSMul R α] :
BoundedSMul R (Matrix m n α) :=
(by infer_instance : BoundedSMul R (PiLp 2 fun i : m => PiLp 2 fun j : n => α))
@[local instance]
def frobeniusNormedSpace [NormedField R] [SeminormedAddCommGroup α] [NormedSpace R α] :
NormedSpace R (Matrix m n α) :=
(by infer_instance : NormedSpace R (PiLp 2 fun i : m => PiLp 2 fun j : n => α))
#align matrix.frobenius_normed_space Matrix.frobeniusNormedSpace
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β]
theorem frobenius_nnnorm_def (A : Matrix m n α) :
‖A‖₊ = (∑ i, ∑ j, ‖A i j‖₊ ^ (2 : ℝ)) ^ (1 / 2 : ℝ) := by
-- Porting note: added, along with `WithLp.equiv_symm_pi_apply` below
change ‖(WithLp.equiv 2 _).symm fun i => (WithLp.equiv 2 _).symm fun j => A i j‖₊ = _
simp_rw [PiLp.nnnorm_eq_of_L2, NNReal.sq_sqrt, NNReal.sqrt_eq_rpow, NNReal.rpow_two,
WithLp.equiv_symm_pi_apply]
#align matrix.frobenius_nnnorm_def Matrix.frobenius_nnnorm_def
theorem frobenius_norm_def (A : Matrix m n α) :
‖A‖ = (∑ i, ∑ j, ‖A i j‖ ^ (2 : ℝ)) ^ (1 / 2 : ℝ) :=
(congr_arg ((↑) : ℝ≥0 → ℝ) (frobenius_nnnorm_def A)).trans <| by simp [NNReal.coe_sum]
#align matrix.frobenius_norm_def Matrix.frobenius_norm_def
@[simp]
| Mathlib/Analysis/Matrix.lean | 574 | 575 | theorem frobenius_nnnorm_map_eq (A : Matrix m n α) (f : α → β) (hf : ∀ a, ‖f a‖₊ = ‖a‖₊) :
‖A.map f‖₊ = ‖A‖₊ := by | simp_rw [frobenius_nnnorm_def, Matrix.map_apply, hf]
| false |
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
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))
#align card_le_of_surjective card_le_of_surjective
| Mathlib/LinearAlgebra/InvariantBasisNumber.lean | 197 | 203 | theorem card_le_of_surjective' [RankCondition R] {α β : Type*} [Fintype α] [Fintype β]
(f : (α →₀ R) →ₗ[R] β →₀ R) (i : Surjective f) : Fintype.card β ≤ Fintype.card α := by |
let P := Finsupp.linearEquivFunOnFinite R R β
let Q := (Finsupp.linearEquivFunOnFinite R R α).symm
exact
card_le_of_surjective R ((P.toLinearMap.comp f).comp Q.toLinearMap)
((P.surjective.comp i).comp Q.surjective)
| false |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.LinearAlgebra.FreeModule.PID
import Mathlib.LinearAlgebra.Matrix.AbsoluteValue
import Mathlib.NumberTheory.ClassNumber.AdmissibleAbsoluteValue
import Mathlib.RingTheory.ClassGroup
import Mathlib.RingTheory.DedekindDomain.IntegralClosure
import Mathlib.RingTheory.Norm
#align_import number_theory.class_number.finite from "leanprover-community/mathlib"@"ea0bcd84221246c801a6f8fbe8a4372f6d04b176"
open scoped nonZeroDivisors
namespace ClassGroup
open Ring
section EuclideanDomain
variable {R S : Type*} (K L : Type*) [EuclideanDomain R] [CommRing S] [IsDomain S]
variable [Field K] [Field L]
variable [Algebra R K] [IsFractionRing R K]
variable [Algebra K L] [FiniteDimensional K L] [IsSeparable K L]
variable [algRL : Algebra R L] [IsScalarTower R K L]
variable [Algebra R S] [Algebra S L]
variable [ist : IsScalarTower R S L] [iic : IsIntegralClosure S R L]
variable (abv : AbsoluteValue R ℤ)
variable {ι : Type*} [DecidableEq ι] [Fintype ι] (bS : Basis ι R S)
noncomputable def normBound : ℤ :=
let n := Fintype.card ι
let i : ι := Nonempty.some bS.index_nonempty
let m : ℤ :=
Finset.max'
(Finset.univ.image fun ijk : ι × ι × ι =>
abv (Algebra.leftMulMatrix bS (bS ijk.1) ijk.2.1 ijk.2.2))
⟨_, Finset.mem_image.mpr ⟨⟨i, i, i⟩, Finset.mem_univ _, rfl⟩⟩
Nat.factorial n • (n • m) ^ n
#align class_group.norm_bound ClassGroup.normBound
theorem normBound_pos : 0 < normBound abv bS := by
obtain ⟨i, j, k, hijk⟩ : ∃ i j k, Algebra.leftMulMatrix bS (bS i) j k ≠ 0 := by
by_contra! h
obtain ⟨i⟩ := bS.index_nonempty
apply bS.ne_zero i
apply
(injective_iff_map_eq_zero (Algebra.leftMulMatrix bS)).mp (Algebra.leftMulMatrix_injective bS)
ext j k
simp [h, DMatrix.zero_apply]
simp only [normBound, Algebra.smul_def, eq_natCast]
apply mul_pos (Int.natCast_pos.mpr (Nat.factorial_pos _))
refine pow_pos (mul_pos (Int.natCast_pos.mpr (Fintype.card_pos_iff.mpr ⟨i⟩)) ?_) _
refine lt_of_lt_of_le (abv.pos hijk) (Finset.le_max' _ _ ?_)
exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
#align class_group.norm_bound_pos ClassGroup.normBound_pos
theorem norm_le (a : S) {y : ℤ} (hy : ∀ k, abv (bS.repr a k) ≤ y) :
abv (Algebra.norm R a) ≤ normBound abv bS * y ^ Fintype.card ι := by
conv_lhs => rw [← bS.sum_repr a]
rw [Algebra.norm_apply, ← LinearMap.det_toMatrix bS]
simp only [Algebra.norm_apply, AlgHom.map_sum, AlgHom.map_smul, map_sum,
map_smul, Algebra.toMatrix_lmul_eq, normBound, smul_mul_assoc, ← mul_pow]
convert Matrix.det_sum_smul_le Finset.univ _ hy using 3
· rw [Finset.card_univ, smul_mul_assoc, mul_comm]
· intro i j k
apply Finset.le_max'
exact Finset.mem_image.mpr ⟨⟨i, j, k⟩, Finset.mem_univ _, rfl⟩
#align class_group.norm_le ClassGroup.norm_le
theorem norm_lt {T : Type*} [LinearOrderedRing T] (a : S) {y : T}
(hy : ∀ k, (abv (bS.repr a k) : T) < y) :
(abv (Algebra.norm R a) : T) < normBound abv bS * y ^ Fintype.card ι := by
obtain ⟨i⟩ := bS.index_nonempty
have him : (Finset.univ.image fun k => abv (bS.repr a k)).Nonempty :=
⟨_, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩⟩
set y' : ℤ := Finset.max' _ him with y'_def
have hy' : ∀ k, abv (bS.repr a k) ≤ y' := by
intro k
exact @Finset.le_max' ℤ _ _ _ (Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩)
have : (y' : T) < y := by
rw [y'_def, ←
Finset.max'_image (show Monotone (_ : ℤ → T) from fun x y h => Int.cast_le.mpr h)]
apply (Finset.max'_lt_iff _ (him.image _)).mpr
simp only [Finset.mem_image, exists_prop]
rintro _ ⟨x, ⟨k, -, rfl⟩, rfl⟩
exact hy k
have y'_nonneg : 0 ≤ y' := le_trans (abv.nonneg _) (hy' i)
apply (Int.cast_le.mpr (norm_le abv bS a hy')).trans_lt
simp only [Int.cast_mul, Int.cast_pow]
apply mul_lt_mul' le_rfl
· exact pow_lt_pow_left this (Int.cast_nonneg.mpr y'_nonneg) (@Fintype.card_ne_zero _ _ ⟨i⟩)
· exact pow_nonneg (Int.cast_nonneg.mpr y'_nonneg) _
· exact Int.cast_pos.mpr (normBound_pos abv bS)
#align class_group.norm_lt ClassGroup.norm_lt
| Mathlib/NumberTheory/ClassNumber/Finite.lean | 119 | 135 | theorem exists_min (I : (Ideal S)⁰) :
∃ b ∈ (I : Ideal S),
b ≠ 0 ∧ ∀ c ∈ (I : Ideal S), abv (Algebra.norm R c) < abv (Algebra.norm R b) → c =
(0 : S) := by |
obtain ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩, min⟩ := @Int.exists_least_of_bdd
(fun a => ∃ b ∈ (I : Ideal S), b ≠ (0 : S) ∧ abv (Algebra.norm R b) = a)
(by
use 0
rintro _ ⟨b, _, _, rfl⟩
apply abv.nonneg)
(by
obtain ⟨b, b_mem, b_ne_zero⟩ := (I : Ideal S).ne_bot_iff.mp (nonZeroDivisors.coe_ne_zero I)
exact ⟨_, ⟨b, b_mem, b_ne_zero, rfl⟩⟩)
refine ⟨b, b_mem, b_ne_zero, ?_⟩
intro c hc lt
contrapose! lt with c_ne_zero
exact min _ ⟨c, hc, c_ne_zero, rfl⟩
| false |
import Mathlib.Probability.Martingale.Basic
#align_import probability.martingale.centering from "leanprover-community/mathlib"@"bea6c853b6edbd15e9d0941825abd04d77933ed0"
open TopologicalSpace Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory
namespace MeasureTheory
variable {Ω E : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E]
[NormedSpace ℝ E] [CompleteSpace E] {f : ℕ → Ω → E} {ℱ : Filtration ℕ m0} {n : ℕ}
noncomputable def predictablePart {m0 : MeasurableSpace Ω} (f : ℕ → Ω → E) (ℱ : Filtration ℕ m0)
(μ : Measure Ω) : ℕ → Ω → E := fun n => ∑ i ∈ Finset.range n, μ[f (i + 1) - f i|ℱ i]
#align measure_theory.predictable_part MeasureTheory.predictablePart
@[simp]
| Mathlib/Probability/Martingale/Centering.lean | 50 | 51 | theorem predictablePart_zero : predictablePart f ℱ μ 0 = 0 := by |
simp_rw [predictablePart, Finset.range_zero, Finset.sum_empty]
| false |
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Tactic.FinCases
#align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Affine
namespace Finset
theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by
ext x
fin_cases x <;> simp
#align finset.univ_fin2 Finset.univ_fin2
variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [S : AffineSpace V P]
variable {ι : Type*} (s : Finset ι)
variable {ι₂ : Type*} (s₂ : Finset ι₂)
def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V :=
∑ i ∈ s, (LinearMap.proj i : (ι → k) →ₗ[k] k).smulRight (p i -ᵥ b)
#align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint
@[simp]
theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) :
s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b) := by
simp [weightedVSubOfPoint, LinearMap.sum_apply]
#align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply
@[simp (high)]
theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) :
s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b) := by
rw [weightedVSubOfPoint_apply, sum_smul]
#align finset.weighted_vsub_of_point_apply_const Finset.weightedVSubOfPoint_apply_const
theorem weightedVSubOfPoint_congr {w₁ w₂ : ι → k} (hw : ∀ i ∈ s, w₁ i = w₂ i) {p₁ p₂ : ι → P}
(hp : ∀ i ∈ s, p₁ i = p₂ i) (b : P) :
s.weightedVSubOfPoint p₁ b w₁ = s.weightedVSubOfPoint p₂ b w₂ := by
simp_rw [weightedVSubOfPoint_apply]
refine sum_congr rfl fun i hi => ?_
rw [hw i hi, hp i hi]
#align finset.weighted_vsub_of_point_congr Finset.weightedVSubOfPoint_congr
theorem weightedVSubOfPoint_eq_of_weights_eq (p : ι → P) (j : ι) (w₁ w₂ : ι → k)
(hw : ∀ i, i ≠ j → w₁ i = w₂ i) :
s.weightedVSubOfPoint p (p j) w₁ = s.weightedVSubOfPoint p (p j) w₂ := by
simp only [Finset.weightedVSubOfPoint_apply]
congr
ext i
rcases eq_or_ne i j with h | h
· simp [h]
· simp [hw i h]
#align finset.weighted_vsub_of_point_eq_of_weights_eq Finset.weightedVSubOfPoint_eq_of_weights_eq
theorem weightedVSubOfPoint_eq_of_sum_eq_zero (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 0)
(b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w = s.weightedVSubOfPoint p b₂ w := by
apply eq_of_sub_eq_zero
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_sub_distrib]
conv_lhs =>
congr
· skip
· ext
rw [← smul_sub, vsub_sub_vsub_cancel_left]
rw [← sum_smul, h, zero_smul]
#align finset.weighted_vsub_of_point_eq_of_sum_eq_zero Finset.weightedVSubOfPoint_eq_of_sum_eq_zero
theorem weightedVSubOfPoint_vadd_eq_of_sum_eq_one (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 1)
(b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w +ᵥ b₁ = s.weightedVSubOfPoint p b₂ w +ᵥ b₂ := by
erw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← @vsub_eq_zero_iff_eq V,
vadd_vsub_assoc, vsub_vadd_eq_vsub_sub, ← add_sub_assoc, add_comm, add_sub_assoc, ←
sum_sub_distrib]
conv_lhs =>
congr
· skip
· congr
· skip
· ext
rw [← smul_sub, vsub_sub_vsub_cancel_left]
rw [← sum_smul, h, one_smul, vsub_add_vsub_cancel, vsub_self]
#align finset.weighted_vsub_of_point_vadd_eq_of_sum_eq_one Finset.weightedVSubOfPoint_vadd_eq_of_sum_eq_one
@[simp (high)]
theorem weightedVSubOfPoint_erase [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) :
(s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply]
apply sum_erase
rw [vsub_self, smul_zero]
#align finset.weighted_vsub_of_point_erase Finset.weightedVSubOfPoint_erase
@[simp (high)]
| Mathlib/LinearAlgebra/AffineSpace/Combination.lean | 151 | 155 | theorem weightedVSubOfPoint_insert [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) :
(insert i s).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by |
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply]
apply sum_insert_zero
rw [vsub_self, smul_zero]
| false |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h ⊢
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h ⊢
cases b; · exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
| Mathlib/Data/Nat/Size.lean | 107 | 116 | theorem lt_size_self (n : ℕ) : n < 2 ^ size n := by |
rw [← one_shiftLeft]
have : ∀ {n}, n = 0 → n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
· apply this rfl
intro b n IH
by_cases h : bit b n = 0
· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
| false |
import Mathlib.Topology.Separation
import Mathlib.Topology.NoetherianSpace
#align_import topology.quasi_separated from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8"
open TopologicalSpace
variable {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] {f : α → β}
def IsQuasiSeparated (s : Set α) : Prop :=
∀ U V : Set α, U ⊆ s → IsOpen U → IsCompact U → V ⊆ s → IsOpen V → IsCompact V → IsCompact (U ∩ V)
#align is_quasi_separated IsQuasiSeparated
@[mk_iff]
class QuasiSeparatedSpace (α : Type*) [TopologicalSpace α] : Prop where
inter_isCompact :
∀ U V : Set α, IsOpen U → IsCompact U → IsOpen V → IsCompact V → IsCompact (U ∩ V)
#align quasi_separated_space QuasiSeparatedSpace
| Mathlib/Topology/QuasiSeparated.lean | 53 | 56 | theorem isQuasiSeparated_univ_iff {α : Type*} [TopologicalSpace α] :
IsQuasiSeparated (Set.univ : Set α) ↔ QuasiSeparatedSpace α := by |
rw [quasiSeparatedSpace_iff]
simp [IsQuasiSeparated]
| false |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Algebra.Ring.Rat
import Mathlib.Data.PNat.Defs
#align_import data.rat.lemmas from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
namespace Rat
open Rat
theorem num_dvd (a) {b : ℤ} (b0 : b ≠ 0) : (a /. b).num ∣ a := by
cases' e : a /. b with n d h c
rw [Rat.mk'_eq_divInt, divInt_eq_iff b0 (mod_cast h)] at e
refine Int.natAbs_dvd.1 <| Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <|
c.dvd_of_dvd_mul_right ?_
have := congr_arg Int.natAbs e
simp only [Int.natAbs_mul, Int.natAbs_ofNat] at this; simp [this]
#align rat.num_dvd Rat.num_dvd
theorem den_dvd (a b : ℤ) : ((a /. b).den : ℤ) ∣ b := by
by_cases b0 : b = 0; · simp [b0]
cases' e : a /. b with n d h c
rw [mk'_eq_divInt, divInt_eq_iff b0 (ne_of_gt (Int.natCast_pos.2 (Nat.pos_of_ne_zero h)))] at e
refine Int.dvd_natAbs.1 <| Int.natCast_dvd_natCast.2 <| c.symm.dvd_of_dvd_mul_left ?_
rw [← Int.natAbs_mul, ← Int.natCast_dvd_natCast, Int.dvd_natAbs, ← e]; simp
#align rat.denom_dvd Rat.den_dvd
theorem num_den_mk {q : ℚ} {n d : ℤ} (hd : d ≠ 0) (qdf : q = n /. d) :
∃ c : ℤ, n = c * q.num ∧ d = c * q.den := by
obtain rfl | hn := eq_or_ne n 0
· simp [qdf]
have : q.num * d = n * ↑q.den := by
refine (divInt_eq_iff ?_ hd).mp ?_
· exact Int.natCast_ne_zero.mpr (Rat.den_nz _)
· rwa [num_divInt_den]
have hqdn : q.num ∣ n := by
rw [qdf]
exact Rat.num_dvd _ hd
refine ⟨n / q.num, ?_, ?_⟩
· rw [Int.ediv_mul_cancel hqdn]
· refine Int.eq_mul_div_of_mul_eq_mul_of_dvd_left ?_ hqdn this
rw [qdf]
exact Rat.num_ne_zero.2 ((divInt_ne_zero hd).mpr hn)
#align rat.num_denom_mk Rat.num_den_mk
#noalign rat.mk_pnat_num
#noalign rat.mk_pnat_denom
theorem num_mk (n d : ℤ) : (n /. d).num = d.sign * n / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
rw [← Int.div_eq_ediv_of_dvd] <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
Int.zero_ediv, Int.ofNat_dvd_left, Nat.gcd_dvd_left, this]
#align rat.num_mk Rat.num_mk
theorem den_mk (n d : ℤ) : (n /. d).den = if d = 0 then 1 else d.natAbs / n.gcd d := by
have (m : ℕ) : Int.natAbs (m + 1) = m + 1 := by
rw [← Nat.cast_one, ← Nat.cast_add, Int.natAbs_cast]
rcases d with ((_ | _) | _) <;>
simp [divInt, mkRat, Rat.normalize, Nat.succPNat, Int.sign, Int.gcd,
if_neg (Nat.cast_add_one_ne_zero _), this]
#align rat.denom_mk Rat.den_mk
#noalign rat.mk_pnat_denom_dvd
theorem add_den_dvd (q₁ q₂ : ℚ) : (q₁ + q₂).den ∣ q₁.den * q₂.den := by
rw [add_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.add_denom_dvd Rat.add_den_dvd
theorem mul_den_dvd (q₁ q₂ : ℚ) : (q₁ * q₂).den ∣ q₁.den * q₂.den := by
rw [mul_def, normalize_eq]
apply Nat.div_dvd_of_dvd
apply Nat.gcd_dvd_right
#align rat.mul_denom_dvd Rat.mul_den_dvd
theorem mul_num (q₁ q₂ : ℚ) :
(q₁ * q₂).num = q₁.num * q₂.num / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by
rw [mul_def, normalize_eq]
#align rat.mul_num Rat.mul_num
theorem mul_den (q₁ q₂ : ℚ) :
(q₁ * q₂).den =
q₁.den * q₂.den / Nat.gcd (q₁.num * q₂.num).natAbs (q₁.den * q₂.den) := by
rw [mul_def, normalize_eq]
#align rat.mul_denom Rat.mul_den
theorem mul_self_num (q : ℚ) : (q * q).num = q.num * q.num := by
rw [mul_num, Int.natAbs_mul, Nat.Coprime.gcd_eq_one, Int.ofNat_one, Int.ediv_one]
exact (q.reduced.mul_right q.reduced).mul (q.reduced.mul_right q.reduced)
#align rat.mul_self_num Rat.mul_self_num
| Mathlib/Data/Rat/Lemmas.lean | 109 | 111 | theorem mul_self_den (q : ℚ) : (q * q).den = q.den * q.den := by |
rw [Rat.mul_den, Int.natAbs_mul, Nat.Coprime.gcd_eq_one, Nat.div_one]
exact (q.reduced.mul_right q.reduced).mul (q.reduced.mul_right q.reduced)
| false |
import Mathlib.CategoryTheory.Category.Cat
import Mathlib.CategoryTheory.Elements
#align_import category_theory.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe u
namespace CategoryTheory
variable {C D : Type*} [Category C] [Category D]
variable (F : C ⥤ Cat)
-- Porting note(#5171): no such linter yet
-- @[nolint has_nonempty_instance]
structure Grothendieck where
base : C
fiber : F.obj base
#align category_theory.grothendieck CategoryTheory.Grothendieck
namespace Grothendieck
variable {F}
structure Hom (X Y : Grothendieck F) where
base : X.base ⟶ Y.base
fiber : (F.map base).obj X.fiber ⟶ Y.fiber
#align category_theory.grothendieck.hom CategoryTheory.Grothendieck.Hom
@[ext]
| Mathlib/CategoryTheory/Grothendieck.lean | 78 | 83 | theorem ext {X Y : Grothendieck F} (f g : Hom X Y) (w_base : f.base = g.base)
(w_fiber : eqToHom (by rw [w_base]) ≫ f.fiber = g.fiber) : f = g := by |
cases f; cases g
congr
dsimp at w_base
aesop_cat
| false |
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.IsomorphismClasses
import Mathlib.CategoryTheory.Thin
#align_import category_theory.skeletal from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
universe v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory
open Category
variable (C : Type u₁) [Category.{v₁} C]
variable (D : Type u₂) [Category.{v₂} D]
variable {E : Type u₃} [Category.{v₃} E]
def Skeletal : Prop :=
∀ ⦃X Y : C⦄, IsIsomorphic X Y → X = Y
#align category_theory.skeletal CategoryTheory.Skeletal
structure IsSkeletonOf (F : D ⥤ C) : Prop where
skel : Skeletal D
eqv : F.IsEquivalence := by infer_instance
#align category_theory.is_skeleton_of CategoryTheory.IsSkeletonOf
attribute [local instance] isIsomorphicSetoid
variable {C D}
theorem Functor.eq_of_iso {F₁ F₂ : D ⥤ C} [Quiver.IsThin C] (hC : Skeletal C) (hF : F₁ ≅ F₂) :
F₁ = F₂ :=
Functor.ext (fun X => hC ⟨hF.app X⟩) fun _ _ _ => Subsingleton.elim _ _
#align category_theory.functor.eq_of_iso CategoryTheory.Functor.eq_of_iso
theorem functor_skeletal [Quiver.IsThin C] (hC : Skeletal C) : Skeletal (D ⥤ C) := fun _ _ h =>
h.elim (Functor.eq_of_iso hC)
#align category_theory.functor_skeletal CategoryTheory.functor_skeletal
variable (C D)
def Skeleton : Type u₁ := InducedCategory C Quotient.out
#align category_theory.skeleton CategoryTheory.Skeleton
instance [Inhabited C] : Inhabited (Skeleton C) :=
⟨⟦default⟧⟩
-- Porting note: previously `Skeleton` used `deriving Category`
noncomputable instance : Category (Skeleton C) := by
apply InducedCategory.category
@[simps!]
noncomputable def fromSkeleton : Skeleton C ⥤ C :=
inducedFunctor _
#align category_theory.from_skeleton CategoryTheory.fromSkeleton
-- Porting note: previously `fromSkeleton` used `deriving Faithful, Full`
noncomputable instance : (fromSkeleton C).Full := by
apply InducedCategory.full
noncomputable instance : (fromSkeleton C).Faithful := by
apply InducedCategory.faithful
instance : (fromSkeleton C).EssSurj where mem_essImage X := ⟨Quotient.mk' X, Quotient.mk_out X⟩
-- Porting note: named this instance
noncomputable instance fromSkeleton.isEquivalence : (fromSkeleton C).IsEquivalence where
noncomputable def skeletonEquivalence : Skeleton C ≌ C :=
(fromSkeleton C).asEquivalence
#align category_theory.skeleton_equivalence CategoryTheory.skeletonEquivalence
| Mathlib/CategoryTheory/Skeletal.lean | 108 | 111 | theorem skeleton_skeletal : Skeletal (Skeleton C) := by |
rintro X Y ⟨h⟩
have : X.out ≈ Y.out := ⟨(fromSkeleton C).mapIso h⟩
simpa using Quotient.sound this
| false |
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
| Mathlib/Algebra/Polynomial/EraseLead.lean | 55 | 56 | theorem eraseLead_coeff_of_ne (i : ℕ) (hi : i ≠ f.natDegree) : f.eraseLead.coeff i = f.coeff i := by |
simp [eraseLead_coeff, hi]
| false |
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Nat.GCD.BigOperators
namespace Nat
variable {ι : Type*}
lemma modEq_list_prod_iff {a b} {l : List ℕ} (co : l.Pairwise Coprime) :
a ≡ b [MOD l.prod] ↔ ∀ i, a ≡ b [MOD l.get i] := by
induction' l with m l ih
· simp [modEq_one]
· have : Coprime m l.prod := coprime_list_prod_right_iff.mpr (List.pairwise_cons.mp co).1
simp only [List.prod_cons, ← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co),
List.length_cons]
constructor
· rintro ⟨h0, hs⟩ i
cases i using Fin.cases <;> simp [h0, hs]
· intro h; exact ⟨h 0, fun i => h i.succ⟩
lemma modEq_list_prod_iff' {a b} {s : ι → ℕ} {l : List ι} (co : l.Pairwise (Coprime on s)) :
a ≡ b [MOD (l.map s).prod] ↔ ∀ i ∈ l, a ≡ b [MOD s i] := by
induction' l with i l ih
· simp [modEq_one]
· have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
simp [← modEq_and_modEq_iff_modEq_mul this, ih (List.Pairwise.of_cons co)]
variable (a s : ι → ℕ)
def chineseRemainderOfList : (l : List ι) → l.Pairwise (Coprime on s) →
{ k // ∀ i ∈ l, k ≡ a i [MOD s i] }
| [], _ => ⟨0, by simp⟩
| i :: l, co => by
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
have ih := chineseRemainderOfList l co.of_cons
have k := chineseRemainder this (a i) ih
use k
simp only [List.mem_cons, forall_eq_or_imp, k.prop.1, true_and]
intro j hj
exact ((modEq_list_prod_iff' co.of_cons).mp k.prop.2 j hj).trans (ih.prop j hj)
@[simp] theorem chineseRemainderOfList_nil :
(chineseRemainderOfList a s [] List.Pairwise.nil : ℕ) = 0 := rfl
theorem chineseRemainderOfList_lt_prod (l : List ι)
(co : l.Pairwise (Coprime on s)) (hs : ∀ i ∈ l, s i ≠ 0) :
chineseRemainderOfList a s l co < (l.map s).prod := by
cases l with
| nil => simp
| cons i l =>
simp only [chineseRemainderOfList, List.map_cons, List.prod_cons]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
refine chineseRemainder_lt_mul this (a i) (chineseRemainderOfList a s l co.of_cons)
(hs i (List.mem_cons_self _ l)) ?_
simp only [ne_eq, List.prod_eq_zero_iff, List.mem_map, not_exists, not_and]
intro j hj
exact hs j (List.mem_cons_of_mem _ hj)
theorem chineseRemainderOfList_modEq_unique (l : List ι)
(co : l.Pairwise (Coprime on s)) {z} (hz : ∀ i ∈ l, z ≡ a i [MOD s i]) :
z ≡ chineseRemainderOfList a s l co [MOD (l.map s).prod] := by
induction' l with i l ih
· simp [modEq_one]
· simp only [List.map_cons, List.prod_cons, chineseRemainderOfList]
have : Coprime (s i) (l.map s).prod := by
simp only [coprime_list_prod_right_iff, List.mem_map, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intro j hj
exact (List.pairwise_cons.mp co).1 j hj
exact chineseRemainder_modEq_unique this
(hz i (List.mem_cons_self _ _)) (ih co.of_cons (fun j hj => hz j (List.mem_cons_of_mem _ hj)))
| Mathlib/Data/Nat/ChineseRemainder.lean | 107 | 118 | theorem chineseRemainderOfList_perm {l l' : List ι} (hl : l.Perm l')
(hs : ∀ i ∈ l, s i ≠ 0) (co : l.Pairwise (Coprime on s)) :
(chineseRemainderOfList a s l co : ℕ) =
chineseRemainderOfList a s l' (co.perm hl coprime_comm.mpr) := by |
let z := chineseRemainderOfList a s l' (co.perm hl coprime_comm.mpr)
have hlp : (l.map s).prod = (l'.map s).prod := List.Perm.prod_eq (List.Perm.map s hl)
exact (chineseRemainderOfList_modEq_unique a s l co (z := z)
(fun i hi => z.prop i (hl.symm.mem_iff.mpr hi))).symm.eq_of_lt_of_lt
(chineseRemainderOfList_lt_prod _ _ _ _ hs)
(by rw [hlp]
exact chineseRemainderOfList_lt_prod _ _ _ _
(by simpa [List.Perm.mem_iff hl.symm] using hs))
| false |
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff
import Mathlib.FieldTheory.Finite.Basic
import Mathlib.Data.Matrix.CharP
#align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70"
noncomputable section
open Polynomial Matrix
open scoped Polynomial
variable {n : Type*} [DecidableEq n] [Fintype n]
@[simp]
theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) :
(M ^ Fintype.card K).charpoly = M.charpoly := by
cases (isEmpty_or_nonempty n).symm
· cases' CharP.exists K with p hp; letI := hp
rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩
haveI : Fact p.Prime := ⟨hp⟩
dsimp at hk; rw [hk]
apply (frobenius_inj K[X] p).iterate k
repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk]
rw [← FiniteField.expand_card]
unfold charpoly
rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow]
apply congr_arg det
refine matPolyEquiv.injective ?_
rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow]
· exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _)
· exact (C M).commute_X
· exact congr_arg _ (Subsingleton.elim _ _)
#align finite_field.matrix.charpoly_pow_card FiniteField.Matrix.charpoly_pow_card
@[simp]
theorem ZMod.charpoly_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) :
(M ^ p).charpoly = M.charpoly := by
have h := FiniteField.Matrix.charpoly_pow_card M
rwa [ZMod.card] at h
#align zmod.charpoly_pow_card ZMod.charpoly_pow_card
| Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean | 53 | 58 | theorem FiniteField.trace_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) :
trace (M ^ Fintype.card K) = trace M ^ Fintype.card K := by |
cases isEmpty_or_nonempty n
· simp [Matrix.trace]
rw [Matrix.trace_eq_neg_charpoly_coeff, Matrix.trace_eq_neg_charpoly_coeff,
FiniteField.Matrix.charpoly_pow_card, FiniteField.pow_card]
| false |
import Mathlib.Analysis.Convex.StrictConvexBetween
import Mathlib.Geometry.Euclidean.Basic
#align_import geometry.euclidean.sphere.basic from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open RealInnerProductSpace
namespace EuclideanGeometry
variable {V : Type*} (P : Type*)
open FiniteDimensional
@[ext]
structure Sphere [MetricSpace P] where
center : P
radius : ℝ
#align euclidean_geometry.sphere EuclideanGeometry.Sphere
variable {P}
section MetricSpace
variable [MetricSpace P]
instance [Nonempty P] : Nonempty (Sphere P) :=
⟨⟨Classical.arbitrary P, 0⟩⟩
instance : Coe (Sphere P) (Set P) :=
⟨fun s => Metric.sphere s.center s.radius⟩
instance : Membership P (Sphere P) :=
⟨fun p s => p ∈ (s : Set P)⟩
theorem Sphere.mk_center (c : P) (r : ℝ) : (⟨c, r⟩ : Sphere P).center = c :=
rfl
#align euclidean_geometry.sphere.mk_center EuclideanGeometry.Sphere.mk_center
theorem Sphere.mk_radius (c : P) (r : ℝ) : (⟨c, r⟩ : Sphere P).radius = r :=
rfl
#align euclidean_geometry.sphere.mk_radius EuclideanGeometry.Sphere.mk_radius
@[simp]
| Mathlib/Geometry/Euclidean/Sphere/Basic.lean | 74 | 75 | theorem Sphere.mk_center_radius (s : Sphere P) : (⟨s.center, s.radius⟩ : Sphere P) = s := by |
ext <;> rfl
| false |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds
#align_import data.real.pi.bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973"
-- Porting note: needed to add a lot of type ascriptions for lean to interpret numbers as reals.
open scoped Real
namespace Real
theorem pi_gt_sqrtTwoAddSeries (n : ℕ) :
(2 : ℝ) ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) < π := by
have : √(2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) * (2 : ℝ) ^ (n + 2) < π := by
rw [← lt_div_iff, ← sin_pi_over_two_pow_succ]
focus
apply sin_lt
apply div_pos pi_pos
all_goals apply pow_pos; norm_num
apply lt_of_le_of_lt (le_of_eq _) this
rw [pow_succ' _ (n + 1), ← mul_assoc, div_mul_cancel₀, mul_comm]; norm_num
#align real.pi_gt_sqrt_two_add_series Real.pi_gt_sqrtTwoAddSeries
| Mathlib/Data/Real/Pi/Bounds.lean | 40 | 71 | theorem pi_lt_sqrtTwoAddSeries (n : ℕ) :
π < (2 : ℝ) ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) + 1 / (4 : ℝ) ^ n := by |
have : π <
(√(2 - sqrtTwoAddSeries 0 n) / (2 : ℝ) + (1 : ℝ) / ((2 : ℝ) ^ n) ^ 3 / 4) *
(2 : ℝ) ^ (n + 2) := by
rw [← div_lt_iff (by norm_num), ← sin_pi_over_two_pow_succ]
refine lt_of_lt_of_le (lt_add_of_sub_right_lt (sin_gt_sub_cube ?_ ?_)) ?_
· apply div_pos pi_pos; apply pow_pos; norm_num
· rw [div_le_iff']
· refine le_trans pi_le_four ?_
simp only [show (4 : ℝ) = (2 : ℝ) ^ 2 by norm_num, mul_one]
apply pow_le_pow_right (by norm_num)
apply le_add_of_nonneg_left; apply Nat.zero_le
· apply pow_pos; norm_num
apply add_le_add_left; rw [div_le_div_right (by norm_num)]
rw [le_div_iff (by norm_num), ← mul_pow]
refine le_trans ?_ (le_of_eq (one_pow 3)); apply pow_le_pow_left
· apply le_of_lt; apply mul_pos
· apply div_pos pi_pos; apply pow_pos; norm_num
· apply pow_pos; norm_num
· rw [← le_div_iff (by norm_num)]
refine le_trans ((div_le_div_right ?_).mpr pi_le_four) ?_
· apply pow_pos; norm_num
· simp only [pow_succ', ← div_div, one_div]
-- Porting note: removed `convert le_rfl`
norm_num
apply lt_of_lt_of_le this (le_of_eq _); rw [add_mul]; congr 1
· ring
simp only [show (4 : ℝ) = 2 ^ 2 by norm_num, ← pow_mul, div_div, ← pow_add]
rw [one_div, one_div, inv_mul_eq_iff_eq_mul₀, eq_comm, mul_inv_eq_iff_eq_mul₀, ← pow_add]
· rw [add_assoc, Nat.mul_succ, add_comm, add_comm n, add_assoc, mul_comm n]
all_goals norm_num
| false |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.Ring.Int
#align_import algebra.field.power from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae"
variable {α : Type*}
section DivisionRing
variable [DivisionRing α] {n : ℤ}
| Mathlib/Algebra/Field/Power.lean | 26 | 30 | theorem Odd.neg_zpow (h : Odd n) (a : α) : (-a) ^ n = -a ^ n := by |
have hn : n ≠ 0 := by rintro rfl; exact Int.odd_iff_not_even.1 h even_zero
obtain ⟨k, rfl⟩ := h
simp_rw [zpow_add' (.inr (.inl hn)), zpow_one, zpow_mul, zpow_two, neg_mul_neg,
neg_mul_eq_mul_neg]
| false |
import Mathlib.CategoryTheory.Adjunction.Whiskering
import Mathlib.CategoryTheory.Sites.PreservesSheafification
#align_import category_theory.sites.adjunction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open GrothendieckTopology CategoryTheory Limits Opposite
universe v u
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
variable {D : Type*} [Category D]
variable {E : Type*} [Category E]
variable {F : D ⥤ E} {G : E ⥤ D}
variable [HasWeakSheafify J D]
abbrev sheafForget [ConcreteCategory D] [HasSheafCompose J (forget D)] :
Sheaf J D ⥤ SheafOfTypes J :=
sheafCompose J (forget D) ⋙ (sheafEquivSheafOfTypes J).functor
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf_forget CategoryTheory.sheafForget
namespace Sheaf
noncomputable section
@[simps]
def composeEquiv [HasSheafCompose J F] (adj : G ⊣ F) (X : Sheaf J E) (Y : Sheaf J D) :
((composeAndSheafify J G).obj X ⟶ Y) ≃ (X ⟶ (sheafCompose J F).obj Y) :=
let A := adj.whiskerRight Cᵒᵖ
{ toFun := fun η => ⟨A.homEquiv _ _ (toSheafify J _ ≫ η.val)⟩
invFun := fun γ => ⟨sheafifyLift J ((A.homEquiv _ _).symm ((sheafToPresheaf _ _).map γ)) Y.2⟩
left_inv := by
intro η
ext1
dsimp
symm
apply sheafifyLift_unique
rw [Equiv.symm_apply_apply]
right_inv := by
intro γ
ext1
dsimp
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [toSheafify_sheafifyLift, Equiv.apply_symm_apply] }
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.compose_equiv CategoryTheory.Sheaf.composeEquiv
-- These lemmas have always been bad (#7657), but leanprover/lean4#2644 made `simp` start noticing
attribute [nolint simpNF] CategoryTheory.Sheaf.composeEquiv_apply_val
CategoryTheory.Sheaf.composeEquiv_symm_apply_val
@[simps! unit_app_val counit_app_val]
def adjunction [HasSheafCompose J F] (adj : G ⊣ F) :
composeAndSheafify J G ⊣ sheafCompose J F :=
Adjunction.mkOfHomEquiv
{ homEquiv := composeEquiv J adj
homEquiv_naturality_left_symm := fun f g => by
ext1
dsimp [composeEquiv]
rw [sheafifyMap_sheafifyLift]
erw [Adjunction.homEquiv_naturality_left_symm]
rw [whiskeringRight_obj_map]
rfl
homEquiv_naturality_right := fun f g => by
ext
dsimp [composeEquiv]
erw [Adjunction.homEquiv_unit, Adjunction.homEquiv_unit]
dsimp
simp }
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.adjunction CategoryTheory.Sheaf.adjunction
instance [F.IsRightAdjoint] : (sheafCompose J F).IsRightAdjoint :=
(adjunction J (Adjunction.ofIsRightAdjoint F)).isRightAdjoint
instance [G.IsLeftAdjoint] : (composeAndSheafify J G).IsLeftAdjoint :=
(adjunction J (Adjunction.ofIsLeftAdjoint G)).isLeftAdjoint
lemma preservesSheafification_of_adjunction (adj : G ⊣ F) :
J.PreservesSheafification G where
le P Q f hf := by
have := adj.isRightAdjoint
rw [MorphismProperty.inverseImage_iff]
dsimp
intro R hR
rw [← ((adj.whiskerRight Cᵒᵖ).homEquiv P R).comp_bijective]
convert (((adj.whiskerRight Cᵒᵖ).homEquiv Q R).trans
(hf.homEquiv (R ⋙ F) ((sheafCompose J F).obj ⟨R, hR⟩).cond)).bijective
ext g X
dsimp [Adjunction.whiskerRight, Adjunction.mkOfUnitCounit]
simp
instance [G.IsLeftAdjoint] : J.PreservesSheafification G :=
preservesSheafification_of_adjunction J (Adjunction.ofIsLeftAdjoint G)
section ForgetToType
variable [ConcreteCategory D] [HasSheafCompose J (forget D)]
abbrev composeAndSheafifyFromTypes (G : Type max v u ⥤ D) : SheafOfTypes J ⥤ Sheaf J D :=
(sheafEquivSheafOfTypes J).inverse ⋙ composeAndSheafify _ G
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.compose_and_sheafify_from_types CategoryTheory.Sheaf.composeAndSheafifyFromTypes
def adjunctionToTypes {G : Type max v u ⥤ D} (adj : G ⊣ forget D) :
composeAndSheafifyFromTypes J G ⊣ sheafForget J :=
(sheafEquivSheafOfTypes J).symm.toAdjunction.comp (adjunction J adj)
set_option linter.uppercaseLean3 false in
#align category_theory.Sheaf.adjunction_to_types CategoryTheory.Sheaf.adjunctionToTypes
@[simp]
| Mathlib/CategoryTheory/Sites/Adjunction.lean | 136 | 143 | theorem adjunctionToTypes_unit_app_val {G : Type max v u ⥤ D} (adj : G ⊣ forget D)
(Y : SheafOfTypes J) :
((adjunctionToTypes J adj).unit.app Y).val =
(adj.whiskerRight _).unit.app ((sheafOfTypesToPresheaf J).obj Y) ≫
whiskerRight (toSheafify J _) (forget D) := by |
dsimp [adjunctionToTypes, Adjunction.comp]
simp
rfl
| false |
import Mathlib.Logic.Encodable.Lattice
import Mathlib.MeasureTheory.MeasurableSpace.Defs
#align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
open MeasurableSpace Set
open scoped Classical
open MeasureTheory
def IsPiSystem {α} (C : Set (Set α)) : Prop :=
∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C
#align is_pi_system IsPiSystem
theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by
intro s h_s t h_t _
rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self,
Set.mem_singleton_iff]
#align is_pi_system.singleton IsPiSystem.singleton
theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert ∅ S) := by
intro s hs t ht hst
cases' hs with hs hs
· simp [hs]
· cases' ht with ht ht
· simp [ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_empty IsPiSystem.insert_empty
theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert Set.univ S) := by
intro s hs t ht hst
cases' hs with hs hs
· cases' ht with ht ht <;> simp [hs, ht]
· cases' ht with ht ht
· simp [hs, ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_univ IsPiSystem.insert_univ
| Mathlib/MeasureTheory/PiSystem.lean | 105 | 109 | theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) :
IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by |
rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst
rw [← Set.preimage_inter] at hst ⊢
exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩
| false |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section CommRing
variable [CommRing R] {p q : R[X]}
section
variable [Semiring S]
theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S}
(hz : aeval z p = 0) (inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.natDegree :=
natDegree_pos_of_eval₂_root hp (algebraMap R S) hz inj
#align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root
theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p ≠ 0) {z : S} (hz : aeval z p = 0)
(inj : ∀ x : R, algebraMap R S x = 0 → x = 0) : 0 < p.degree :=
natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj)
#align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root
theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ p₂ : R[X]} (h : q ∣ p₁ - p₂) :
p₁ %ₘ q = p₂ %ₘ q := by
nontriviality R
obtain ⟨f, sub_eq⟩ := h
refine (div_modByMonic_unique (p₂ /ₘ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2
rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm]
#align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub
theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by
by_cases hq : q.Monic
· cases' subsingleton_or_nontrivial R with hR hR
· simp only [eq_iff_true_of_subsingleton]
· exact
(div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq
⟨by
rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc,
add_comm (q * _), modByMonic_add_div _ hq],
(degree_add_le _ _).trans_lt
(max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2
· simp_rw [modByMonic_eq_of_not_monic _ hq]
#align polynomial.add_mod_by_monic Polynomial.add_modByMonic
| Mathlib/Algebra/Polynomial/RingDivision.lean | 72 | 80 | theorem smul_modByMonic (c : R) (p : R[X]) : c • p %ₘ q = c • (p %ₘ q) := by |
by_cases hq : q.Monic
· cases' subsingleton_or_nontrivial R with hR hR
· simp only [eq_iff_true_of_subsingleton]
· exact
(div_modByMonic_unique (c • (p /ₘ q)) (c • (p %ₘ q)) hq
⟨by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq],
(degree_smul_le _ _).trans_lt (degree_modByMonic_lt _ hq)⟩).2
· simp_rw [modByMonic_eq_of_not_monic _ hq]
| false |
import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals
import Mathlib.Analysis.Calculus.ParametricIntegral
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
#align_import analysis.mellin_transform from "leanprover-community/mathlib"@"917c3c072e487b3cccdbfeff17e75b40e45f66cb"
open MeasureTheory Set Filter Asymptotics TopologicalSpace
open Real
open Complex hiding exp log abs_of_nonneg
open scoped Topology
noncomputable section
section Defs
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]
def MellinConvergent (f : ℝ → E) (s : ℂ) : Prop :=
IntegrableOn (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) (Ioi 0)
#align mellin_convergent MellinConvergent
theorem MellinConvergent.const_smul {f : ℝ → E} {s : ℂ} (hf : MellinConvergent f s) {𝕜 : Type*}
[NontriviallyNormedField 𝕜] [NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) :
MellinConvergent (fun t => c • f t) s := by
simpa only [MellinConvergent, smul_comm] using hf.smul c
#align mellin_convergent.const_smul MellinConvergent.const_smul
theorem MellinConvergent.cpow_smul {f : ℝ → E} {s a : ℂ} :
MellinConvergent (fun t => (t : ℂ) ^ a • f t) s ↔ MellinConvergent f (s + a) := by
refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi
simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul]
#align mellin_convergent.cpow_smul MellinConvergent.cpow_smul
nonrec theorem MellinConvergent.div_const {f : ℝ → ℂ} {s : ℂ} (hf : MellinConvergent f s) (a : ℂ) :
MellinConvergent (fun t => f t / a) s := by
simpa only [MellinConvergent, smul_eq_mul, ← mul_div_assoc] using hf.div_const a
#align mellin_convergent.div_const MellinConvergent.div_const
theorem MellinConvergent.comp_mul_left {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : 0 < a) :
MellinConvergent (fun t => f (a * t)) s ↔ MellinConvergent f s := by
have := integrableOn_Ioi_comp_mul_left_iff (fun t : ℝ => (t : ℂ) ^ (s - 1) • f t) 0 ha
rw [mul_zero] at this
have h1 : EqOn (fun t : ℝ => (↑(a * t) : ℂ) ^ (s - 1) • f (a * t))
((a : ℂ) ^ (s - 1) • fun t : ℝ => (t : ℂ) ^ (s - 1) • f (a * t)) (Ioi 0) := fun t ht ↦ by
simp only [ofReal_mul, mul_cpow_ofReal_nonneg ha.le (le_of_lt ht), mul_smul, Pi.smul_apply]
have h2 : (a : ℂ) ^ (s - 1) ≠ 0 := by
rw [Ne, cpow_eq_zero_iff, not_and_or, ofReal_eq_zero]
exact Or.inl ha.ne'
rw [MellinConvergent, MellinConvergent, ← this, integrableOn_congr_fun h1 measurableSet_Ioi,
IntegrableOn, IntegrableOn, integrable_smul_iff h2]
#align mellin_convergent.comp_mul_left MellinConvergent.comp_mul_left
theorem MellinConvergent.comp_rpow {f : ℝ → E} {s : ℂ} {a : ℝ} (ha : a ≠ 0) :
MellinConvergent (fun t => f (t ^ a)) s ↔ MellinConvergent f (s / a) := by
refine Iff.trans ?_ (integrableOn_Ioi_comp_rpow_iff' _ ha)
rw [MellinConvergent]
refine integrableOn_congr_fun (fun t ht => ?_) measurableSet_Ioi
dsimp only [Pi.smul_apply]
rw [← Complex.coe_smul (t ^ (a - 1)), ← mul_smul, ← cpow_mul_ofReal_nonneg (le_of_lt ht),
ofReal_cpow (le_of_lt ht), ← cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt ht)), ofReal_sub,
ofReal_one, mul_sub, mul_div_cancel₀ _ (ofReal_ne_zero.mpr ha), mul_one, add_comm, ←
add_sub_assoc, sub_add_cancel]
#align mellin_convergent.comp_rpow MellinConvergent.comp_rpow
def Complex.VerticalIntegrable (f : ℂ → E) (σ : ℝ) (μ : Measure ℝ := by volume_tac) : Prop :=
Integrable (fun (y : ℝ) ↦ f (σ + y * I)) μ
def mellin (f : ℝ → E) (s : ℂ) : E :=
∫ t : ℝ in Ioi 0, (t : ℂ) ^ (s - 1) • f t
#align mellin mellin
def mellinInv (σ : ℝ) (f : ℂ → E) (x : ℝ) : E :=
(1 / (2 * π)) • ∫ y : ℝ, (x : ℂ) ^ (-(σ + y * I)) • f (σ + y * I)
-- next few lemmas don't require convergence of the Mellin transform (they are just 0 = 0 otherwise)
theorem mellin_cpow_smul (f : ℝ → E) (s a : ℂ) :
mellin (fun t => (t : ℂ) ^ a • f t) s = mellin f (s + a) := by
refine setIntegral_congr measurableSet_Ioi fun t ht => ?_
simp_rw [← sub_add_eq_add_sub, cpow_add _ _ (ofReal_ne_zero.2 <| ne_of_gt ht), mul_smul]
#align mellin_cpow_smul mellin_cpow_smul
| Mathlib/Analysis/MellinTransform.lean | 112 | 114 | theorem mellin_const_smul (f : ℝ → E) (s : ℂ) {𝕜 : Type*} [NontriviallyNormedField 𝕜]
[NormedSpace 𝕜 E] [SMulCommClass ℂ 𝕜 E] (c : 𝕜) :
mellin (fun t => c • f t) s = c • mellin f s := by | simp only [mellin, smul_comm, integral_smul]
| false |
import Mathlib.RingTheory.DedekindDomain.Ideal
#align_import ring_theory.dedekind_domain.factorization from "leanprover-community/mathlib"@"2f588be38bb5bec02f218ba14f82fc82eb663f87"
noncomputable section
open scoped Classical nonZeroDivisors
open Set Function UniqueFactorizationMonoid IsDedekindDomain IsDedekindDomain.HeightOneSpectrum
Classical
variable {R : Type*} [CommRing R] {K : Type*} [Field K] [Algebra R K] [IsFractionRing R K]
variable [IsDedekindDomain R] (v : HeightOneSpectrum R)
def IsDedekindDomain.HeightOneSpectrum.maxPowDividing (I : Ideal R) : Ideal R :=
v.asIdeal ^ (Associates.mk v.asIdeal).count (Associates.mk I).factors
#align is_dedekind_domain.height_one_spectrum.max_pow_dividing IsDedekindDomain.HeightOneSpectrum.maxPowDividing
theorem Ideal.finite_factors {I : Ideal R} (hI : I ≠ 0) :
{v : HeightOneSpectrum R | v.asIdeal ∣ I}.Finite := by
rw [← Set.finite_coe_iff, Set.coe_setOf]
haveI h_fin := fintypeSubtypeDvd I hI
refine
Finite.of_injective (fun v => (⟨(v : HeightOneSpectrum R).asIdeal, v.2⟩ : { x // x ∣ I })) ?_
intro v w hvw
simp? at hvw says simp only [Subtype.mk.injEq] at hvw
exact Subtype.coe_injective ((HeightOneSpectrum.ext_iff (R := R) ↑v ↑w).mpr hvw)
#align ideal.finite_factors Ideal.finite_factors
theorem Associates.finite_factors {I : Ideal R} (hI : I ≠ 0) :
∀ᶠ v : HeightOneSpectrum R in Filter.cofinite,
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ) = 0 := by
have h_supp : {v : HeightOneSpectrum R | ¬((Associates.mk v.asIdeal).count
(Associates.mk I).factors : ℤ) = 0} = {v : HeightOneSpectrum R | v.asIdeal ∣ I} := by
ext v
simp_rw [Int.natCast_eq_zero]
exact Associates.count_ne_zero_iff_dvd hI v.irreducible
rw [Filter.eventually_cofinite, h_supp]
exact Ideal.finite_factors hI
#align associates.finite_factors Associates.finite_factors
namespace Ideal
theorem finite_mulSupport {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => v.maxPowDividing I).Finite :=
haveI h_subset : {v : HeightOneSpectrum R | v.maxPowDividing I ≠ 1} ⊆
{v : HeightOneSpectrum R |
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ) ≠ 0} := by
intro v hv h_zero
have hv' : v.maxPowDividing I = 1 := by
rw [IsDedekindDomain.HeightOneSpectrum.maxPowDividing, Int.natCast_eq_zero.mp h_zero,
pow_zero _]
exact hv hv'
Finite.subset (Filter.eventually_cofinite.mp (Associates.finite_factors hI)) h_subset
#align ideal.finite_mul_support Ideal.finite_mulSupport
theorem finite_mulSupport_coe {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ)).Finite := by
rw [mulSupport]
simp_rw [Ne, zpow_natCast, ← FractionalIdeal.coeIdeal_pow, FractionalIdeal.coeIdeal_eq_one]
exact finite_mulSupport hI
#align ideal.finite_mul_support_coe Ideal.finite_mulSupport_coe
theorem finite_mulSupport_inv {I : Ideal R} (hI : I ≠ 0) :
(mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
(-((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ))).Finite := by
rw [mulSupport]
simp_rw [zpow_neg, Ne, inv_eq_one]
exact finite_mulSupport_coe hI
#align ideal.finite_mul_support_inv Ideal.finite_mulSupport_inv
| Mathlib/RingTheory/DedekindDomain/Factorization.lean | 131 | 144 | theorem finprod_not_dvd (I : Ideal R) (hI : I ≠ 0) :
¬v.asIdeal ^ ((Associates.mk v.asIdeal).count (Associates.mk I).factors + 1) ∣
∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I := by |
have hf := finite_mulSupport hI
have h_ne_zero : v.maxPowDividing I ≠ 0 := pow_ne_zero _ v.ne_bot
rw [← mul_finprod_cond_ne v hf, pow_add, pow_one, finprod_cond_ne _ _ hf]
intro h_contr
have hv_prime : Prime v.asIdeal := Ideal.prime_of_isPrime v.ne_bot v.isPrime
obtain ⟨w, hw, hvw'⟩ :=
Prime.exists_mem_finset_dvd hv_prime ((mul_dvd_mul_iff_left h_ne_zero).mp h_contr)
have hw_prime : Prime w.asIdeal := Ideal.prime_of_isPrime w.ne_bot w.isPrime
have hvw := Prime.dvd_of_dvd_pow hv_prime hvw'
rw [Prime.dvd_prime_iff_associated hv_prime hw_prime, associated_iff_eq] at hvw
exact (Finset.mem_erase.mp hw).1 (HeightOneSpectrum.ext w v (Eq.symm hvw))
| false |
import Mathlib.Data.Set.Image
import Mathlib.Data.SProd
#align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Function
namespace Set
section Prod
variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β}
theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) :
(s ×ˢ t).Subsingleton := fun _x hx _y hy ↦
Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2)
noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] :
DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable
#align set.decidable_mem_prod Set.decidableMemProd
@[gcongr]
theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ :=
fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩
#align set.prod_mono Set.prod_mono
@[gcongr]
theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t :=
prod_mono hs Subset.rfl
#align set.prod_mono_left Set.prod_mono_left
@[gcongr]
theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ :=
prod_mono Subset.rfl ht
#align set.prod_mono_right Set.prod_mono_right
@[simp]
theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ :=
⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩
#align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self
@[simp]
theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ :=
and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self
#align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self
theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P :=
⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩
#align set.prod_subset_iff Set.prod_subset_iff
theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) :=
prod_subset_iff
#align set.forall_prod_set Set.forall_prod_set
theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by
simp [and_assoc]
#align set.exists_prod_set Set.exists_prod_set
@[simp]
theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by
ext
exact and_false_iff _
#align set.prod_empty Set.prod_empty
@[simp]
theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by
ext
exact false_and_iff _
#align set.empty_prod Set.empty_prod
@[simp, mfld_simps]
theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by
ext
exact true_and_iff _
#align set.univ_prod_univ Set.univ_prod_univ
theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq]
#align set.univ_prod Set.univ_prod
theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by simp [prod_eq]
#align set.prod_univ Set.prod_univ
@[simp] lemma prod_eq_univ [Nonempty α] [Nonempty β] : s ×ˢ t = univ ↔ s = univ ∧ t = univ := by
simp [eq_univ_iff_forall, forall_and]
@[simp]
theorem singleton_prod : ({a} : Set α) ×ˢ t = Prod.mk a '' t := by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align set.singleton_prod Set.singleton_prod
@[simp]
theorem prod_singleton : s ×ˢ ({b} : Set β) = (fun a => (a, b)) '' s := by
ext ⟨x, y⟩
simp [and_left_comm, eq_comm]
#align set.prod_singleton Set.prod_singleton
| Mathlib/Data/Set/Prod.lean | 122 | 122 | theorem singleton_prod_singleton : ({a} : Set α) ×ˢ ({b} : Set β) = {(a, b)} := by | simp
| false |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionSemiring
variable [DivisionSemiring α] {a b c d : α}
theorem add_div (a b c : α) : (a + b) / c = a / c + b / c := by simp_rw [div_eq_mul_inv, add_mul]
#align add_div add_div
@[field_simps]
theorem div_add_div_same (a b c : α) : a / c + b / c = (a + b) / c :=
(add_div _ _ _).symm
#align div_add_div_same div_add_div_same
theorem same_add_div (h : b ≠ 0) : (b + a) / b = 1 + a / b := by rw [← div_self h, add_div]
#align same_add_div same_add_div
theorem div_add_same (h : b ≠ 0) : (a + b) / b = a / b + 1 := by rw [← div_self h, add_div]
#align div_add_same div_add_same
theorem one_add_div (h : b ≠ 0) : 1 + a / b = (b + a) / b :=
(same_add_div h).symm
#align one_add_div one_add_div
theorem div_add_one (h : b ≠ 0) : a / b + 1 = (a + b) / b :=
(div_add_same h).symm
#align div_add_one div_add_one
theorem inv_add_inv' (ha : a ≠ 0) (hb : b ≠ 0) :
a⁻¹ + b⁻¹ = a⁻¹ * (a + b) * b⁻¹ :=
let _ := invertibleOfNonzero ha; let _ := invertibleOfNonzero hb; invOf_add_invOf a b
| Mathlib/Algebra/Field/Basic.lean | 56 | 58 | theorem one_div_mul_add_mul_one_div_eq_one_div_add_one_div (ha : a ≠ 0) (hb : b ≠ 0) :
1 / a * (a + b) * (1 / b) = 1 / a + 1 / b := by |
simpa only [one_div] using (inv_add_inv' ha hb).symm
| false |
import Mathlib.Algebra.Order.Floor
import Mathlib.Algebra.Order.Field.Power
import Mathlib.Data.Nat.Log
#align_import data.int.log from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
variable {R : Type*} [LinearOrderedSemifield R] [FloorSemiring R]
namespace Int
def log (b : ℕ) (r : R) : ℤ :=
if 1 ≤ r then Nat.log b ⌊r⌋₊ else -Nat.clog b ⌈r⁻¹⌉₊
#align int.log Int.log
theorem log_of_one_le_right (b : ℕ) {r : R} (hr : 1 ≤ r) : log b r = Nat.log b ⌊r⌋₊ :=
if_pos hr
#align int.log_of_one_le_right Int.log_of_one_le_right
| Mathlib/Data/Int/Log.lean | 66 | 70 | theorem log_of_right_le_one (b : ℕ) {r : R} (hr : r ≤ 1) : log b r = -Nat.clog b ⌈r⁻¹⌉₊ := by |
obtain rfl | hr := hr.eq_or_lt
· rw [log, if_pos hr, inv_one, Nat.ceil_one, Nat.floor_one, Nat.log_one_right, Nat.clog_one_right,
Int.ofNat_zero, neg_zero]
· exact if_neg hr.not_le
| false |
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.SimpleGraph.AdjMatrix
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.simple_graph.strongly_regular from "leanprover-community/mathlib"@"2b35fc7bea4640cb75e477e83f32fbd538920822"
open Finset
universe u
namespace SimpleGraph
variable {V : Type u} [Fintype V] [DecidableEq V]
variable (G : SimpleGraph V) [DecidableRel G.Adj]
structure IsSRGWith (n k ℓ μ : ℕ) : Prop where
card : Fintype.card V = n
regular : G.IsRegularOfDegree k
of_adj : ∀ v w : V, G.Adj v w → Fintype.card (G.commonNeighbors v w) = ℓ
of_not_adj : Pairwise fun v w => ¬G.Adj v w → Fintype.card (G.commonNeighbors v w) = μ
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with SimpleGraph.IsSRGWith
variable {G} {n k ℓ μ : ℕ}
theorem bot_strongly_regular : (⊥ : SimpleGraph V).IsSRGWith (Fintype.card V) 0 ℓ 0 where
card := rfl
regular := bot_degree
of_adj := fun v w h => h.elim
of_not_adj := fun v w _h => by
simp only [card_eq_zero, Fintype.card_ofFinset, forall_true_left, not_false_iff, bot_adj]
ext
simp [mem_commonNeighbors]
#align simple_graph.bot_strongly_regular SimpleGraph.bot_strongly_regular
theorem IsSRGWith.top :
(⊤ : SimpleGraph V).IsSRGWith (Fintype.card V) (Fintype.card V - 1) (Fintype.card V - 2) μ where
card := rfl
regular := IsRegularOfDegree.top
of_adj := fun v w h => by
rw [card_commonNeighbors_top]
exact h
of_not_adj := fun v w h h' => False.elim (h' ((top_adj v w).2 h))
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.top SimpleGraph.IsSRGWith.top
theorem IsSRGWith.card_neighborFinset_union_eq {v w : V} (h : G.IsSRGWith n k ℓ μ) :
(G.neighborFinset v ∪ G.neighborFinset w).card =
2 * k - Fintype.card (G.commonNeighbors v w) := by
apply Nat.add_right_cancel (m := Fintype.card (G.commonNeighbors v w))
rw [Nat.sub_add_cancel, ← Set.toFinset_card]
-- Porting note: Set.toFinset_inter needs workaround to use unification to solve for one of the
-- instance arguments:
· simp [commonNeighbors, @Set.toFinset_inter _ _ _ _ _ _ (_),
← neighborFinset_def, Finset.card_union_add_card_inter, card_neighborFinset_eq_degree,
h.regular.degree_eq, two_mul]
· apply le_trans (card_commonNeighbors_le_degree_left _ _ _)
simp [h.regular.degree_eq, two_mul]
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_eq SimpleGraph.IsSRGWith.card_neighborFinset_union_eq
theorem IsSRGWith.card_neighborFinset_union_of_not_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(hne : v ≠ w) (ha : ¬G.Adj v w) :
(G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - μ := by
rw [← h.of_not_adj hne ha]
apply h.card_neighborFinset_union_eq
set_option linter.uppercaseLean3 false in
#align simple_graph.is_SRG_with.card_neighbor_finset_union_of_not_adj SimpleGraph.IsSRGWith.card_neighborFinset_union_of_not_adj
| Mathlib/Combinatorics/SimpleGraph/StronglyRegular.lean | 110 | 113 | theorem IsSRGWith.card_neighborFinset_union_of_adj {v w : V} (h : G.IsSRGWith n k ℓ μ)
(ha : G.Adj v w) : (G.neighborFinset v ∪ G.neighborFinset w).card = 2 * k - ℓ := by |
rw [← h.of_adj v w ha]
apply h.card_neighborFinset_union_eq
| false |
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]
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 114 | 119 | 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]
| false |
import Mathlib.Algebra.CharP.Defs
import Mathlib.RingTheory.Multiplicity
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section OrderBasic
open multiplicity
variable [Semiring R] {φ : R⟦X⟧}
theorem exists_coeff_ne_zero_iff_ne_zero : (∃ n : ℕ, coeff R n φ ≠ 0) ↔ φ ≠ 0 := by
refine not_iff_not.mp ?_
push_neg
-- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386?
simp [PowerSeries.ext_iff, (coeff R _).map_zero]
#align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero
def order (φ : R⟦X⟧) : PartENat :=
letI := Classical.decEq R
letI := Classical.decEq R⟦X⟧
if h : φ = 0 then ⊤ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h)
#align power_series.order PowerSeries.order
@[simp]
theorem order_zero : order (0 : R⟦X⟧) = ⊤ :=
dif_pos rfl
#align power_series.order_zero PowerSeries.order_zero
theorem order_finite_iff_ne_zero : (order φ).Dom ↔ φ ≠ 0 := by
simp only [order]
constructor
· split_ifs with h <;> intro H
· simp only [PartENat.top_eq_none, Part.not_none_dom] at H
· exact h
· intro h
simp [h]
#align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero
theorem coeff_order (h : (order φ).Dom) : coeff R (φ.order.get h) φ ≠ 0 := by
classical
simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast']
generalize_proofs h
exact Nat.find_spec h
#align power_series.coeff_order PowerSeries.coeff_order
theorem order_le (n : ℕ) (h : coeff R n φ ≠ 0) : order φ ≤ n := by
classical
rw [order, dif_neg]
· simp only [PartENat.coe_le_coe]
exact Nat.find_le h
· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩
#align power_series.order_le PowerSeries.order_le
theorem coeff_of_lt_order (n : ℕ) (h : ↑n < order φ) : coeff R n φ = 0 := by
contrapose! h
exact order_le _ h
#align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order
@[simp]
theorem order_eq_top {φ : R⟦X⟧} : φ.order = ⊤ ↔ φ = 0 :=
PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left
#align power_series.order_eq_top PowerSeries.order_eq_top
theorem nat_le_order (φ : R⟦X⟧) (n : ℕ) (h : ∀ i < n, coeff R i φ = 0) : ↑n ≤ order φ := by
by_contra H; rw [not_le] at H
have : (order φ).Dom := PartENat.dom_of_le_natCast H.le
rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H
exact coeff_order this (h _ H)
#align power_series.nat_le_order PowerSeries.nat_le_order
theorem le_order (φ : R⟦X⟧) (n : PartENat) (h : ∀ i : ℕ, ↑i < n → coeff R i φ = 0) :
n ≤ order φ := by
induction n using PartENat.casesOn
· show _ ≤ _
rw [top_le_iff, order_eq_top]
ext i
exact h _ (PartENat.natCast_lt_top i)
· apply nat_le_order
simpa only [PartENat.coe_lt_coe] using h
#align power_series.le_order PowerSeries.le_order
| Mathlib/RingTheory/PowerSeries/Order.lean | 134 | 139 | theorem order_eq_nat {φ : R⟦X⟧} {n : ℕ} :
order φ = n ↔ coeff R n φ ≠ 0 ∧ ∀ i, i < n → coeff R i φ = 0 := by |
classical
rcases eq_or_ne φ 0 with (rfl | hφ)
· simpa [(coeff R _).map_zero] using (PartENat.natCast_ne_top _).symm
simp [order, dif_neg hφ, Nat.find_eq_iff]
| false |
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.LinearAlgebra.Dimension.Constructions
#align_import algebra.linear_recurrence from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f"
noncomputable section
open Finset
open Polynomial
structure LinearRecurrence (α : Type*) [CommSemiring α] where
order : ℕ
coeffs : Fin order → α
#align linear_recurrence LinearRecurrence
instance (α : Type*) [CommSemiring α] : Inhabited (LinearRecurrence α) :=
⟨⟨0, default⟩⟩
namespace LinearRecurrence
section CommSemiring
variable {α : Type*} [CommSemiring α] (E : LinearRecurrence α)
def IsSolution (u : ℕ → α) :=
∀ n, u (n + E.order) = ∑ i, E.coeffs i * u (n + i)
#align linear_recurrence.is_solution LinearRecurrence.IsSolution
def mkSol (init : Fin E.order → α) : ℕ → α
| n =>
if h : n < E.order then init ⟨n, h⟩
else
∑ k : Fin E.order,
have _ : n - E.order + k < n := by
rw [add_comm, ← add_tsub_assoc_of_le (not_lt.mp h), tsub_lt_iff_left]
· exact add_lt_add_right k.is_lt n
· convert add_le_add (zero_le (k : ℕ)) (not_lt.mp h)
simp only [zero_add]
E.coeffs k * mkSol init (n - E.order + k)
#align linear_recurrence.mk_sol LinearRecurrence.mkSol
theorem is_sol_mkSol (init : Fin E.order → α) : E.IsSolution (E.mkSol init) := by
intro n
rw [mkSol]
simp
#align linear_recurrence.is_sol_mk_sol LinearRecurrence.is_sol_mkSol
| Mathlib/Algebra/LinearRecurrence.lean | 92 | 95 | theorem mkSol_eq_init (init : Fin E.order → α) : ∀ n : Fin E.order, E.mkSol init n = init n := by |
intro n
rw [mkSol]
simp only [n.is_lt, dif_pos, Fin.mk_val, Fin.eta]
| false |
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
| Mathlib/Algebra/Polynomial/RingDivision.lean | 166 | 169 | 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)
| false |
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}
section sequence
variable {n : ℕ}
theorem IntFractPair.get?_seq1_eq_succ_get?_stream :
(IntFractPair.seq1 v).snd.get? n = (IntFractPair.stream v) (n + 1) :=
rfl
#align generalized_continued_fraction.int_fract_pair.nth_seq1_eq_succ_nth_stream GeneralizedContinuedFraction.IntFractPair.get?_seq1_eq_succ_get?_stream
section Termination
theorem of_terminatedAt_iff_intFractPair_seq1_terminatedAt :
(of v).TerminatedAt n ↔ (IntFractPair.seq1 v).snd.TerminatedAt n :=
Option.map_eq_none
#align generalized_continued_fraction.of_terminated_at_iff_int_fract_pair_seq1_terminated_at GeneralizedContinuedFraction.of_terminatedAt_iff_intFractPair_seq1_terminatedAt
| Mathlib/Algebra/ContinuedFractions/Computation/Translations.lean | 209 | 212 | theorem of_terminatedAt_n_iff_succ_nth_intFractPair_stream_eq_none :
(of v).TerminatedAt n ↔ IntFractPair.stream v (n + 1) = none := by |
rw [of_terminatedAt_iff_intFractPair_seq1_terminatedAt, Stream'.Seq.TerminatedAt,
IntFractPair.get?_seq1_eq_succ_get?_stream]
| false |
import Mathlib.AlgebraicTopology.SimplexCategory
import Mathlib.CategoryTheory.Comma.Arrow
import Mathlib.CategoryTheory.Limits.FunctorCategory
import Mathlib.CategoryTheory.Opposites
#align_import algebraic_topology.simplicial_object from "leanprover-community/mathlib"@"5ed51dc37c6b891b79314ee11a50adc2b1df6fd6"
open Opposite
open CategoryTheory
open CategoryTheory.Limits
universe v u v' u'
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
-- porting note (#5171): removed @[nolint has_nonempty_instance]
def SimplicialObject :=
SimplexCategoryᵒᵖ ⥤ C
#align category_theory.simplicial_object CategoryTheory.SimplicialObject
@[simps!]
instance : Category (SimplicialObject C) := by
dsimp only [SimplicialObject]
infer_instance
namespace SimplicialObject
set_option quotPrecheck false in
scoped[Simplicial]
notation3:1000 X " _[" n "]" =>
(X : CategoryTheory.SimplicialObject _).obj (Opposite.op (SimplexCategory.mk n))
open Simplicial
instance {J : Type v} [SmallCategory J] [HasLimitsOfShape J C] :
HasLimitsOfShape J (SimplicialObject C) := by
dsimp [SimplicialObject]
infer_instance
instance [HasLimits C] : HasLimits (SimplicialObject C) :=
⟨inferInstance⟩
instance {J : Type v} [SmallCategory J] [HasColimitsOfShape J C] :
HasColimitsOfShape J (SimplicialObject C) := by
dsimp [SimplicialObject]
infer_instance
instance [HasColimits C] : HasColimits (SimplicialObject C) :=
⟨inferInstance⟩
variable {C}
-- Porting note (#10688): added to ease automation
@[ext]
lemma hom_ext {X Y : SimplicialObject C} (f g : X ⟶ Y)
(h : ∀ (n : SimplexCategoryᵒᵖ), f.app n = g.app n) : f = g :=
NatTrans.ext _ _ (by ext; apply h)
variable (X : SimplicialObject C)
def δ {n} (i : Fin (n + 2)) : X _[n + 1] ⟶ X _[n] :=
X.map (SimplexCategory.δ i).op
#align category_theory.simplicial_object.δ CategoryTheory.SimplicialObject.δ
def σ {n} (i : Fin (n + 1)) : X _[n] ⟶ X _[n + 1] :=
X.map (SimplexCategory.σ i).op
#align category_theory.simplicial_object.σ CategoryTheory.SimplicialObject.σ
def eqToIso {n m : ℕ} (h : n = m) : X _[n] ≅ X _[m] :=
X.mapIso (CategoryTheory.eqToIso (by congr))
#align category_theory.simplicial_object.eq_to_iso CategoryTheory.SimplicialObject.eqToIso
@[simp]
theorem eqToIso_refl {n : ℕ} (h : n = n) : X.eqToIso h = Iso.refl _ := by
ext
simp [eqToIso]
#align category_theory.simplicial_object.eq_to_iso_refl CategoryTheory.SimplicialObject.eqToIso_refl
@[reassoc]
theorem δ_comp_δ {n} {i j : Fin (n + 2)} (H : i ≤ j) :
X.δ j.succ ≫ X.δ i = X.δ (Fin.castSucc i) ≫ X.δ j := by
dsimp [δ]
simp only [← X.map_comp, ← op_comp, SimplexCategory.δ_comp_δ H]
#align category_theory.simplicial_object.δ_comp_δ CategoryTheory.SimplicialObject.δ_comp_δ
@[reassoc]
theorem δ_comp_δ' {n} {i : Fin (n + 2)} {j : Fin (n + 3)} (H : Fin.castSucc i < j) :
X.δ j ≫ X.δ i =
X.δ (Fin.castSucc i) ≫
X.δ (j.pred fun (hj : j = 0) => by simp [hj, Fin.not_lt_zero] at H) := by
dsimp [δ]
simp only [← X.map_comp, ← op_comp, SimplexCategory.δ_comp_δ' H]
#align category_theory.simplicial_object.δ_comp_δ' CategoryTheory.SimplicialObject.δ_comp_δ'
@[reassoc]
theorem δ_comp_δ'' {n} {i : Fin (n + 3)} {j : Fin (n + 2)} (H : i ≤ Fin.castSucc j) :
X.δ j.succ ≫ X.δ (i.castLT (Nat.lt_of_le_of_lt (Fin.le_iff_val_le_val.mp H) j.is_lt)) =
X.δ i ≫ X.δ j := by
dsimp [δ]
simp only [← X.map_comp, ← op_comp, SimplexCategory.δ_comp_δ'' H]
#align category_theory.simplicial_object.δ_comp_δ'' CategoryTheory.SimplicialObject.δ_comp_δ''
@[reassoc]
| Mathlib/AlgebraicTopology/SimplicialObject.lean | 131 | 134 | theorem δ_comp_δ_self {n} {i : Fin (n + 2)} :
X.δ (Fin.castSucc i) ≫ X.δ i = X.δ i.succ ≫ X.δ i := by |
dsimp [δ]
simp only [← X.map_comp, ← op_comp, SimplexCategory.δ_comp_δ_self]
| false |
import Mathlib.MeasureTheory.PiSystem
import Mathlib.Order.OmegaCompletePartialOrder
import Mathlib.Topology.Constructions
import Mathlib.MeasureTheory.MeasurableSpace.Basic
open Set
namespace MeasureTheory
variable {ι : Type _} {α : ι → Type _}
section cylinder
def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) :=
(fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S
@[simp]
theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) :
f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S :=
mem_preimage
@[simp]
theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by
rw [cylinder, preimage_empty]
@[simp]
theorem cylinder_univ (s : Finset ι) : cylinder s (univ : Set (∀ i : s, α i)) = univ := by
rw [cylinder, preimage_univ]
@[simp]
theorem cylinder_eq_empty_iff [h_nonempty : Nonempty (∀ i, α i)] (s : Finset ι)
(S : Set (∀ i : s, α i)) :
cylinder s S = ∅ ↔ S = ∅ := by
refine ⟨fun h ↦ ?_, fun h ↦ by (rw [h]; exact cylinder_empty _)⟩
by_contra hS
rw [← Ne, ← nonempty_iff_ne_empty] at hS
let f := hS.some
have hf : f ∈ S := hS.choose_spec
classical
let f' : ∀ i, α i := fun i ↦ if hi : i ∈ s then f ⟨i, hi⟩ else h_nonempty.some i
have hf' : f' ∈ cylinder s S := by
rw [mem_cylinder]
simpa only [f', Finset.coe_mem, dif_pos]
rw [h] at hf'
exact not_mem_empty _ hf'
theorem inter_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∩ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∩
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_inter_iff, mem_cylinder, mem_setOf_eq]; rfl
theorem inter_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∩ cylinder s S₂ = cylinder s (S₁ ∩ S₂) := by
classical rw [inter_cylinder]; rfl
theorem union_cylinder (s₁ s₂ : Finset ι) (S₁ : Set (∀ i : s₁, α i)) (S₂ : Set (∀ i : s₂, α i))
[DecidableEq ι] :
cylinder s₁ S₁ ∪ cylinder s₂ S₂ =
cylinder (s₁ ∪ s₂)
((fun f ↦ fun j : s₁ ↦ f ⟨j, Finset.mem_union_left s₂ j.prop⟩) ⁻¹' S₁ ∪
(fun f ↦ fun j : s₂ ↦ f ⟨j, Finset.mem_union_right s₁ j.prop⟩) ⁻¹' S₂) := by
ext1 f; simp only [mem_union, mem_cylinder, mem_setOf_eq]; rfl
theorem union_cylinder_same (s : Finset ι) (S₁ : Set (∀ i : s, α i)) (S₂ : Set (∀ i : s, α i)) :
cylinder s S₁ ∪ cylinder s S₂ = cylinder s (S₁ ∪ S₂) := by
classical rw [union_cylinder]; rfl
theorem compl_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) :
(cylinder s S)ᶜ = cylinder s (Sᶜ) := by
ext1 f; simp only [mem_compl_iff, mem_cylinder]
| Mathlib/MeasureTheory/Constructions/Cylinders.lean | 213 | 215 | theorem diff_cylinder_same (s : Finset ι) (S T : Set (∀ i : s, α i)) :
cylinder s S \ cylinder s T = cylinder s (S \ T) := by |
ext1 f; simp only [mem_diff, mem_cylinder]
| false |
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Algebra.Ring.Rat
#align_import data.rat.order from "leanprover-community/mathlib"@"a59dad53320b73ef180174aae867addd707ef00e"
assert_not_exists Field
assert_not_exists Finset
assert_not_exists Set.Icc
assert_not_exists GaloisConnection
namespace Rat
variable {a b c p q : ℚ}
@[simp] lemma divInt_nonneg_iff_of_pos_right {a b : ℤ} (hb : 0 < b) : 0 ≤ a /. b ↔ 0 ≤ a := by
cases' hab : a /. b with n d hd hnd
rw [mk'_eq_divInt, divInt_eq_iff hb.ne' (mod_cast hd)] at hab
rw [← num_nonneg, ← mul_nonneg_iff_of_pos_right hb, ← hab,
mul_nonneg_iff_of_pos_right (mod_cast Nat.pos_of_ne_zero hd)]
#align rat.mk_nonneg Rat.divInt_nonneg_iff_of_pos_right
@[simp] lemma divInt_nonneg {a b : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a /. b := by
obtain rfl | hb := hb.eq_or_lt
· simp
rfl
rwa [divInt_nonneg_iff_of_pos_right hb]
@[simp] lemma mkRat_nonneg {a : ℤ} (ha : 0 ≤ a) (b : ℕ) : 0 ≤ mkRat a b := by
simpa using divInt_nonneg ha (Int.natCast_nonneg _)
| Mathlib/Algebra/Order/Ring/Rat.lean | 50 | 59 | theorem ofScientific_nonneg (m : ℕ) (s : Bool) (e : ℕ) :
0 ≤ Rat.ofScientific m s e := by |
rw [Rat.ofScientific]
cases s
· rw [if_neg (by decide)]
refine num_nonneg.mp ?_
rw [num_natCast]
exact Int.natCast_nonneg _
· rw [if_pos rfl, normalize_eq_mkRat]
exact Rat.mkRat_nonneg (Int.natCast_nonneg _) _
| false |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.Data.Finset.Sort
#align_import data.polynomial.basic from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69"
set_option linter.uppercaseLean3 false
noncomputable section
structure Polynomial (R : Type*) [Semiring R] where ofFinsupp ::
toFinsupp : AddMonoidAlgebra R ℕ
#align polynomial Polynomial
#align polynomial.of_finsupp Polynomial.ofFinsupp
#align polynomial.to_finsupp Polynomial.toFinsupp
@[inherit_doc] scoped[Polynomial] notation:9000 R "[X]" => Polynomial R
open AddMonoidAlgebra
open Finsupp hiding single
open Function hiding Commute
open Polynomial
namespace Polynomial
universe u
variable {R : Type u} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q : R[X]}
theorem forall_iff_forall_finsupp (P : R[X] → Prop) :
(∀ p, P p) ↔ ∀ q : R[ℕ], P ⟨q⟩ :=
⟨fun h q => h ⟨q⟩, fun h ⟨p⟩ => h p⟩
#align polynomial.forall_iff_forall_finsupp Polynomial.forall_iff_forall_finsupp
theorem exists_iff_exists_finsupp (P : R[X] → Prop) :
(∃ p, P p) ↔ ∃ q : R[ℕ], P ⟨q⟩ :=
⟨fun ⟨⟨p⟩, hp⟩ => ⟨p, hp⟩, fun ⟨q, hq⟩ => ⟨⟨q⟩, hq⟩⟩
#align polynomial.exists_iff_exists_finsupp Polynomial.exists_iff_exists_finsupp
@[simp]
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f := by cases f; rfl
#align polynomial.eta Polynomial.eta
section AddMonoidAlgebra
private irreducible_def add : R[X] → R[X] → R[X]
| ⟨a⟩, ⟨b⟩ => ⟨a + b⟩
private irreducible_def neg {R : Type u} [Ring R] : R[X] → R[X]
| ⟨a⟩ => ⟨-a⟩
private irreducible_def mul : R[X] → R[X] → R[X]
| ⟨a⟩, ⟨b⟩ => ⟨a * b⟩
instance zero : Zero R[X] :=
⟨⟨0⟩⟩
#align polynomial.has_zero Polynomial.zero
instance one : One R[X] :=
⟨⟨1⟩⟩
#align polynomial.one Polynomial.one
instance add' : Add R[X] :=
⟨add⟩
#align polynomial.has_add Polynomial.add'
instance neg' {R : Type u} [Ring R] : Neg R[X] :=
⟨neg⟩
#align polynomial.has_neg Polynomial.neg'
instance sub {R : Type u} [Ring R] : Sub R[X] :=
⟨fun a b => a + -b⟩
#align polynomial.has_sub Polynomial.sub
instance mul' : Mul R[X] :=
⟨mul⟩
#align polynomial.has_mul Polynomial.mul'
-- If the private definitions are accidentally exposed, simplify them away.
@[simp] theorem add_eq_add : add p q = p + q := rfl
@[simp] theorem mul_eq_mul : mul p q = p * q := rfl
instance smulZeroClass {S : Type*} [SMulZeroClass S R] : SMulZeroClass S R[X] where
smul r p := ⟨r • p.toFinsupp⟩
smul_zero a := congr_arg ofFinsupp (smul_zero a)
#align polynomial.smul_zero_class Polynomial.smulZeroClass
-- to avoid a bug in the `ring` tactic
instance (priority := 1) pow : Pow R[X] ℕ where pow p n := npowRec n p
#align polynomial.has_pow Polynomial.pow
@[simp]
theorem ofFinsupp_zero : (⟨0⟩ : R[X]) = 0 :=
rfl
#align polynomial.of_finsupp_zero Polynomial.ofFinsupp_zero
@[simp]
theorem ofFinsupp_one : (⟨1⟩ : R[X]) = 1 :=
rfl
#align polynomial.of_finsupp_one Polynomial.ofFinsupp_one
@[simp]
theorem ofFinsupp_add {a b} : (⟨a + b⟩ : R[X]) = ⟨a⟩ + ⟨b⟩ :=
show _ = add _ _ by rw [add_def]
#align polynomial.of_finsupp_add Polynomial.ofFinsupp_add
@[simp]
theorem ofFinsupp_neg {R : Type u} [Ring R] {a} : (⟨-a⟩ : R[X]) = -⟨a⟩ :=
show _ = neg _ by rw [neg_def]
#align polynomial.of_finsupp_neg Polynomial.ofFinsupp_neg
@[simp]
theorem ofFinsupp_sub {R : Type u} [Ring R] {a b} : (⟨a - b⟩ : R[X]) = ⟨a⟩ - ⟨b⟩ := by
rw [sub_eq_add_neg, ofFinsupp_add, ofFinsupp_neg]
rfl
#align polynomial.of_finsupp_sub Polynomial.ofFinsupp_sub
@[simp]
theorem ofFinsupp_mul (a b) : (⟨a * b⟩ : R[X]) = ⟨a⟩ * ⟨b⟩ :=
show _ = mul _ _ by rw [mul_def]
#align polynomial.of_finsupp_mul Polynomial.ofFinsupp_mul
@[simp]
theorem ofFinsupp_smul {S : Type*} [SMulZeroClass S R] (a : S) (b) :
(⟨a • b⟩ : R[X]) = (a • ⟨b⟩ : R[X]) :=
rfl
#align polynomial.of_finsupp_smul Polynomial.ofFinsupp_smul
@[simp]
| Mathlib/Algebra/Polynomial/Basic.lean | 195 | 199 | theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by |
change _ = npowRec n _
induction n with
| zero => simp [npowRec]
| succ n n_ih => simp [npowRec, n_ih, pow_succ]
| false |
import Mathlib.Data.Multiset.Nodup
import Mathlib.Data.List.NatAntidiagonal
#align_import data.multiset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Multiset
namespace Nat
def antidiagonal (n : ℕ) : Multiset (ℕ × ℕ) :=
List.Nat.antidiagonal n
#align multiset.nat.antidiagonal Multiset.Nat.antidiagonal
@[simp]
| Mathlib/Data/Multiset/NatAntidiagonal.lean | 36 | 37 | theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by |
rw [antidiagonal, mem_coe, List.Nat.mem_antidiagonal]
| false |
import Mathlib.Data.List.Nodup
#align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
variable {α : Type*}
namespace List
inductive Duplicate (x : α) : List α → Prop
| cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l)
| cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l)
#align list.duplicate List.Duplicate
local infixl:50 " ∈+ " => List.Duplicate
variable {l : List α} {x : α}
theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l :=
Duplicate.cons_mem h
#align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self
theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l :=
Duplicate.cons_duplicate h
#align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons
theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by
induction' h with l' _ y l' _ hm
· exact mem_cons_self _ _
· exact mem_cons_of_mem _ hm
#align list.duplicate.mem List.Duplicate.mem
theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by
cases' h with _ h _ _ h
· exact h
· exact h.mem
#align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self
@[simp]
theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l :=
⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩
#align list.duplicate_cons_self_iff List.duplicate_cons_self_iff
theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem)
#align list.duplicate.ne_nil List.Duplicate.ne_nil
@[simp]
theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl
#align list.not_duplicate_nil List.not_duplicate_nil
theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by
induction' h with l' h z l' h _
· simp [ne_nil_of_mem h]
· simp [ne_nil_of_mem h.mem]
#align list.duplicate.ne_singleton List.Duplicate.ne_singleton
@[simp]
theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl
#align list.not_duplicate_singleton List.not_duplicate_singleton
theorem Duplicate.elim_nil (h : x ∈+ []) : False :=
not_duplicate_nil x h
#align list.duplicate.elim_nil List.Duplicate.elim_nil
theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False :=
not_duplicate_singleton x y h
#align list.duplicate.elim_singleton List.Duplicate.elim_singleton
theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by
refine ⟨fun h => ?_, fun h => ?_⟩
· cases' h with _ hm _ _ hm
· exact Or.inl ⟨rfl, hm⟩
· exact Or.inr hm
· rcases h with (⟨rfl | h⟩ | h)
· simpa
· exact h.cons_duplicate
#align list.duplicate_cons_iff List.duplicate_cons_iff
theorem Duplicate.of_duplicate_cons {y : α} (h : x ∈+ y :: l) (hx : x ≠ y) : x ∈+ l := by
simpa [duplicate_cons_iff, hx.symm] using h
#align list.duplicate.of_duplicate_cons List.Duplicate.of_duplicate_cons
theorem duplicate_cons_iff_of_ne {y : α} (hne : x ≠ y) : x ∈+ y :: l ↔ x ∈+ l := by
simp [duplicate_cons_iff, hne.symm]
#align list.duplicate_cons_iff_of_ne List.duplicate_cons_iff_of_ne
| Mathlib/Data/List/Duplicate.lean | 106 | 113 | theorem Duplicate.mono_sublist {l' : List α} (hx : x ∈+ l) (h : l <+ l') : x ∈+ l' := by |
induction' h with l₁ l₂ y _ IH l₁ l₂ y h IH
· exact hx
· exact (IH hx).duplicate_cons _
· rw [duplicate_cons_iff] at hx ⊢
rcases hx with (⟨rfl, hx⟩ | hx)
· simp [h.subset hx]
· simp [IH hx]
| false |
import Mathlib.Algebra.Polynomial.Cardinal
import Mathlib.RingTheory.Algebraic
#align_import algebra.algebraic_card from "leanprover-community/mathlib"@"40494fe75ecbd6d2ec61711baa630cf0a7b7d064"
universe u v
open Cardinal Polynomial Set
open Cardinal Polynomial
namespace Algebraic
theorem infinite_of_charZero (R A : Type*) [CommRing R] [IsDomain R] [Ring A] [Algebra R A]
[CharZero A] : { x : A | IsAlgebraic R x }.Infinite :=
infinite_of_injective_forall_mem Nat.cast_injective isAlgebraic_nat
#align algebraic.infinite_of_char_zero Algebraic.infinite_of_charZero
theorem aleph0_le_cardinal_mk_of_charZero (R A : Type*) [CommRing R] [IsDomain R] [Ring A]
[Algebra R A] [CharZero A] : ℵ₀ ≤ #{ x : A // IsAlgebraic R x } :=
infinite_iff.1 (Set.infinite_coe_iff.2 <| infinite_of_charZero R A)
#align algebraic.aleph_0_le_cardinal_mk_of_char_zero Algebraic.aleph0_le_cardinal_mk_of_charZero
section lift
variable (R : Type u) (A : Type v) [CommRing R] [CommRing A] [IsDomain A] [Algebra R A]
[NoZeroSMulDivisors R A]
| Mathlib/Algebra/AlgebraicCard.lean | 45 | 54 | theorem cardinal_mk_lift_le_mul :
Cardinal.lift.{u} #{ x : A // IsAlgebraic R x } ≤ Cardinal.lift.{v} #R[X] * ℵ₀ := by |
rw [← mk_uLift, ← mk_uLift]
choose g hg₁ hg₂ using fun x : { x : A | IsAlgebraic R x } => x.coe_prop
refine lift_mk_le_lift_mk_mul_of_lift_mk_preimage_le g fun f => ?_
rw [lift_le_aleph0, le_aleph0_iff_set_countable]
suffices MapsTo (↑) (g ⁻¹' {f}) (f.rootSet A) from
this.countable_of_injOn Subtype.coe_injective.injOn (f.rootSet_finite A).countable
rintro x (rfl : g x = f)
exact mem_rootSet.2 ⟨hg₁ x, hg₂ x⟩
| false |
import Mathlib.LinearAlgebra.Matrix.DotProduct
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
#align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7"
open Matrix
namespace Matrix
open FiniteDimensional
variable {l m n o R : Type*} [Fintype n] [Fintype o]
section StarOrderedField
variable [Fintype m] [Field R] [PartialOrder R] [StarRing R] [StarOrderedRing R]
| Mathlib/Data/Matrix/Rank.lean | 217 | 220 | theorem ker_mulVecLin_conjTranspose_mul_self (A : Matrix m n R) :
LinearMap.ker (Aᴴ * A).mulVecLin = LinearMap.ker (mulVecLin A) := by |
ext x
simp only [LinearMap.mem_ker, mulVecLin_apply, conjTranspose_mul_self_mulVec_eq_zero]
| false |
import Mathlib.Combinatorics.Quiver.Basic
import Mathlib.Combinatorics.Quiver.Path
#align_import combinatorics.quiver.cast from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
universe v v₁ v₂ u u₁ u₂
variable {U : Type*} [Quiver.{u + 1} U]
namespace Quiver
def Hom.cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) : u' ⟶ v' :=
Eq.ndrec (motive := (· ⟶ v')) (Eq.ndrec e hv) hu
#align quiver.hom.cast Quiver.Hom.cast
theorem Hom.cast_eq_cast {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) :
e.cast hu hv = _root_.cast (by {rw [hu, hv]}) e := by
subst_vars
rfl
#align quiver.hom.cast_eq_cast Quiver.Hom.cast_eq_cast
@[simp]
theorem Hom.cast_rfl_rfl {u v : U} (e : u ⟶ v) : e.cast rfl rfl = e :=
rfl
#align quiver.hom.cast_rfl_rfl Quiver.Hom.cast_rfl_rfl
@[simp]
theorem Hom.cast_cast {u v u' v' u'' v'' : U} (e : u ⟶ v) (hu : u = u') (hv : v = v')
(hu' : u' = u'') (hv' : v' = v'') :
(e.cast hu hv).cast hu' hv' = e.cast (hu.trans hu') (hv.trans hv') := by
subst_vars
rfl
#align quiver.hom.cast_cast Quiver.Hom.cast_cast
theorem Hom.cast_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) :
HEq (e.cast hu hv) e := by
subst_vars
rfl
#align quiver.hom.cast_heq Quiver.Hom.cast_heq
| Mathlib/Combinatorics/Quiver/Cast.lean | 63 | 66 | theorem Hom.cast_eq_iff_heq {u v u' v' : U} (hu : u = u') (hv : v = v') (e : u ⟶ v) (e' : u' ⟶ v') :
e.cast hu hv = e' ↔ HEq e e' := by |
rw [Hom.cast_eq_cast]
exact _root_.cast_eq_iff_heq
| false |
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
| Mathlib/Algebra/Module/Submodule/Ker.lean | 107 | 109 | theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by |
simp [disjoint_def]
| false |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.Normed.Group.Completion
#align_import analysis.normed.group.hom_completion from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
noncomputable section
open Set NormedAddGroupHom UniformSpace
section Completion
variable {G : Type*} [SeminormedAddCommGroup G] {H : Type*} [SeminormedAddCommGroup H]
{K : Type*} [SeminormedAddCommGroup K]
def NormedAddGroupHom.completion (f : NormedAddGroupHom G H) :
NormedAddGroupHom (Completion G) (Completion H) :=
.ofLipschitz (f.toAddMonoidHom.completion f.continuous) f.lipschitz.completion_map
#align normed_add_group_hom.completion NormedAddGroupHom.completion
theorem NormedAddGroupHom.completion_def (f : NormedAddGroupHom G H) (x : Completion G) :
f.completion x = Completion.map f x :=
rfl
#align normed_add_group_hom.completion_def NormedAddGroupHom.completion_def
@[simp]
theorem NormedAddGroupHom.completion_coe_to_fun (f : NormedAddGroupHom G H) :
(f.completion : Completion G → Completion H) = Completion.map f := rfl
#align normed_add_group_hom.completion_coe_to_fun NormedAddGroupHom.completion_coe_to_fun
-- Porting note: `@[simp]` moved to the next lemma
theorem NormedAddGroupHom.completion_coe (f : NormedAddGroupHom G H) (g : G) :
f.completion g = f g :=
Completion.map_coe f.uniformContinuous _
#align normed_add_group_hom.completion_coe NormedAddGroupHom.completion_coe
@[simp]
theorem NormedAddGroupHom.completion_coe' (f : NormedAddGroupHom G H) (g : G) :
Completion.map f g = f g :=
f.completion_coe g
@[simps]
def normedAddGroupHomCompletionHom :
NormedAddGroupHom G H →+ NormedAddGroupHom (Completion G) (Completion H) where
toFun := NormedAddGroupHom.completion
map_zero' := toAddMonoidHom_injective AddMonoidHom.completion_zero
map_add' f g := toAddMonoidHom_injective <|
f.toAddMonoidHom.completion_add g.toAddMonoidHom f.continuous g.continuous
#align normed_add_group_hom_completion_hom normedAddGroupHomCompletionHom
#align normed_add_group_hom_completion_hom_apply normedAddGroupHomCompletionHom_apply
@[simp]
theorem NormedAddGroupHom.completion_id :
(NormedAddGroupHom.id G).completion = NormedAddGroupHom.id (Completion G) := by
ext x
rw [NormedAddGroupHom.completion_def, NormedAddGroupHom.coe_id, Completion.map_id]
rfl
#align normed_add_group_hom.completion_id NormedAddGroupHom.completion_id
theorem NormedAddGroupHom.completion_comp (f : NormedAddGroupHom G H) (g : NormedAddGroupHom H K) :
g.completion.comp f.completion = (g.comp f).completion := by
ext x
rw [NormedAddGroupHom.coe_comp, NormedAddGroupHom.completion_def,
NormedAddGroupHom.completion_coe_to_fun, NormedAddGroupHom.completion_coe_to_fun,
Completion.map_comp g.uniformContinuous f.uniformContinuous]
rfl
#align normed_add_group_hom.completion_comp NormedAddGroupHom.completion_comp
theorem NormedAddGroupHom.completion_neg (f : NormedAddGroupHom G H) :
(-f).completion = -f.completion :=
map_neg (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f
#align normed_add_group_hom.completion_neg NormedAddGroupHom.completion_neg
theorem NormedAddGroupHom.completion_add (f g : NormedAddGroupHom G H) :
(f + g).completion = f.completion + g.completion :=
normedAddGroupHomCompletionHom.map_add f g
#align normed_add_group_hom.completion_add NormedAddGroupHom.completion_add
theorem NormedAddGroupHom.completion_sub (f g : NormedAddGroupHom G H) :
(f - g).completion = f.completion - g.completion :=
map_sub (normedAddGroupHomCompletionHom : NormedAddGroupHom G H →+ _) f g
#align normed_add_group_hom.completion_sub NormedAddGroupHom.completion_sub
@[simp]
theorem NormedAddGroupHom.zero_completion : (0 : NormedAddGroupHom G H).completion = 0 :=
normedAddGroupHomCompletionHom.map_zero
#align normed_add_group_hom.zero_completion NormedAddGroupHom.zero_completion
@[simps] -- Porting note: added `@[simps]`
def NormedAddCommGroup.toCompl : NormedAddGroupHom G (Completion G) where
toFun := (↑)
map_add' := Completion.toCompl.map_add
bound' := ⟨1, by simp [le_refl]⟩
#align normed_add_comm_group.to_compl NormedAddCommGroup.toCompl
open NormedAddCommGroup
theorem NormedAddCommGroup.norm_toCompl (x : G) : ‖toCompl x‖ = ‖x‖ :=
Completion.norm_coe x
#align normed_add_comm_group.norm_to_compl NormedAddCommGroup.norm_toCompl
theorem NormedAddCommGroup.denseRange_toCompl : DenseRange (toCompl : G → Completion G) :=
Completion.denseInducing_coe.dense
#align normed_add_comm_group.dense_range_to_compl NormedAddCommGroup.denseRange_toCompl
@[simp]
theorem NormedAddGroupHom.completion_toCompl (f : NormedAddGroupHom G H) :
f.completion.comp toCompl = toCompl.comp f := by ext x; simp
#align normed_add_group_hom.completion_to_compl NormedAddGroupHom.completion_toCompl
@[simp]
theorem NormedAddGroupHom.norm_completion (f : NormedAddGroupHom G H) : ‖f.completion‖ = ‖f‖ :=
le_antisymm (ofLipschitz_norm_le _ _) <| opNorm_le_bound _ (norm_nonneg _) fun x => by
simpa using f.completion.le_opNorm x
#align normed_add_group_hom.norm_completion NormedAddGroupHom.norm_completion
theorem NormedAddGroupHom.ker_le_ker_completion (f : NormedAddGroupHom G H) :
(toCompl.comp <| incl f.ker).range ≤ f.completion.ker := by
rintro _ ⟨⟨g, h₀ : f g = 0⟩, rfl⟩
simp [h₀, mem_ker, Completion.coe_zero]
#align normed_add_group_hom.ker_le_ker_completion NormedAddGroupHom.ker_le_ker_completion
| Mathlib/Analysis/Normed/Group/HomCompletion.lean | 171 | 193 | theorem NormedAddGroupHom.ker_completion {f : NormedAddGroupHom G H} {C : ℝ}
(h : f.SurjectiveOnWith f.range C) :
(f.completion.ker : Set <| Completion G) = closure (toCompl.comp <| incl f.ker).range := by |
refine le_antisymm ?_ (closure_minimal f.ker_le_ker_completion f.completion.isClosed_ker)
rintro hatg (hatg_in : f.completion hatg = 0)
rw [SeminormedAddCommGroup.mem_closure_iff]
intro ε ε_pos
rcases h.exists_pos with ⟨C', C'_pos, hC'⟩
rcases exists_pos_mul_lt ε_pos (1 + C' * ‖f‖) with ⟨δ, δ_pos, hδ⟩
obtain ⟨_, ⟨g : G, rfl⟩, hg : ‖hatg - g‖ < δ⟩ :=
SeminormedAddCommGroup.mem_closure_iff.mp (Completion.denseInducing_coe.dense hatg) δ δ_pos
obtain ⟨g' : G, hgg' : f g' = f g, hfg : ‖g'‖ ≤ C' * ‖f g‖⟩ := hC' (f g) (mem_range_self _ g)
have mem_ker : g - g' ∈ f.ker := by rw [f.mem_ker, map_sub, sub_eq_zero.mpr hgg'.symm]
refine ⟨_, ⟨⟨g - g', mem_ker⟩, rfl⟩, ?_⟩
have : ‖f g‖ ≤ ‖f‖ * δ := calc
‖f g‖ ≤ ‖f‖ * ‖hatg - g‖ := by simpa [hatg_in] using f.completion.le_opNorm (hatg - g)
_ ≤ ‖f‖ * δ := by gcongr
calc ‖hatg - ↑(g - g')‖ = ‖hatg - g + g'‖ := by rw [Completion.coe_sub, sub_add]
_ ≤ ‖hatg - g‖ + ‖(g' : Completion G)‖ := norm_add_le _ _
_ = ‖hatg - g‖ + ‖g'‖ := by rw [Completion.norm_coe]
_ < δ + C' * ‖f g‖ := add_lt_add_of_lt_of_le hg hfg
_ ≤ δ + C' * (‖f‖ * δ) := by gcongr
_ < ε := by simpa only [add_mul, one_mul, mul_assoc] using hδ
| false |
import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.CategoryTheory.Abelian.Refinements
#align_import category_theory.abelian.diagram_lemmas.four from "leanprover-community/mathlib"@"d34cbcf6c94953e965448c933cd9cc485115ebbd"
namespace CategoryTheory
open Category Limits Preadditive
namespace Abelian
variable {C : Type*} [Category C] [Abelian C]
open ComposableArrows
section Four
variable {R₁ R₂ : ComposableArrows C 3} (φ : R₁ ⟶ R₂)
| Mathlib/CategoryTheory/Abelian/DiagramLemmas/Four.lean | 62 | 83 | theorem mono_of_epi_of_mono_of_mono' (hR₁ : R₁.map' 0 2 = 0)
(hR₁' : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) := by |
apply mono_of_cancel_zero
intro A f₂ h₁
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, NatTrans.naturality, reassoc_of% h₁,
zero_comp, zero_comp]
obtain ⟨A₁, π₁, _, f₁, hf₁⟩ := (hR₁'.exact 0).exact_up_to_refinements f₂ h₂
dsimp at hf₁
have h₃ : (f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
rw [assoc, ← NatTrans.naturality, ← reassoc_of% hf₁, h₁, comp_zero]
obtain ⟨A₂, π₂, _, g₀, hg₀⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₃
obtain ⟨A₃, π₃, _, f₀, hf₀⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
have h₄ : f₀ ≫ R₁.map' 0 1 = π₃ ≫ π₂ ≫ f₁ := by
rw [← cancel_mono (app' φ 1 _), assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% hf₀, hg₀]
rfl
rw [← cancel_epi π₁, comp_zero, hf₁, ← cancel_epi π₂, ← cancel_epi π₃, comp_zero,
comp_zero, ← reassoc_of% h₄, ← R₁.map'_comp 0 1 2, hR₁, comp_zero]
| false |
import Mathlib.MeasureTheory.Measure.MeasureSpaceDef
#align_import measure_theory.measure.ae_disjoint from "leanprover-community/mathlib"@"bc7d81beddb3d6c66f71449c5bc76c38cb77cf9e"
open Set Function
namespace MeasureTheory
variable {ι α : Type*} {m : MeasurableSpace α} (μ : Measure α)
def AEDisjoint (s t : Set α) :=
μ (s ∩ t) = 0
#align measure_theory.ae_disjoint MeasureTheory.AEDisjoint
variable {μ} {s t u v : Set α}
theorem exists_null_pairwise_disjoint_diff [Countable ι] {s : ι → Set α}
(hd : Pairwise (AEDisjoint μ on s)) : ∃ t : ι → Set α, (∀ i, MeasurableSet (t i)) ∧
(∀ i, μ (t i) = 0) ∧ Pairwise (Disjoint on fun i => s i \ t i) := by
refine ⟨fun i => toMeasurable μ (s i ∩ ⋃ j ∈ ({i}ᶜ : Set ι), s j), fun i =>
measurableSet_toMeasurable _ _, fun i => ?_, ?_⟩
· simp only [measure_toMeasurable, inter_iUnion]
exact (measure_biUnion_null_iff <| to_countable _).2 fun j hj => hd (Ne.symm hj)
· simp only [Pairwise, disjoint_left, onFun, mem_diff, not_and, and_imp, Classical.not_not]
intro i j hne x hi hU hj
replace hU : x ∉ s i ∩ iUnion fun j ↦ iUnion fun _ ↦ s j :=
fun h ↦ hU (subset_toMeasurable _ _ h)
simp only [mem_inter_iff, mem_iUnion, not_and, not_exists] at hU
exact (hU hi j hne.symm hj).elim
#align measure_theory.exists_null_pairwise_disjoint_diff MeasureTheory.exists_null_pairwise_disjoint_diff
namespace AEDisjoint
protected theorem eq (h : AEDisjoint μ s t) : μ (s ∩ t) = 0 :=
h
#align measure_theory.ae_disjoint.eq MeasureTheory.AEDisjoint.eq
@[symm]
protected theorem symm (h : AEDisjoint μ s t) : AEDisjoint μ t s := by rwa [AEDisjoint, inter_comm]
#align measure_theory.ae_disjoint.symm MeasureTheory.AEDisjoint.symm
protected theorem symmetric : Symmetric (AEDisjoint μ) := fun _ _ => AEDisjoint.symm
#align measure_theory.ae_disjoint.symmetric MeasureTheory.AEDisjoint.symmetric
protected theorem comm : AEDisjoint μ s t ↔ AEDisjoint μ t s :=
⟨AEDisjoint.symm, AEDisjoint.symm⟩
#align measure_theory.ae_disjoint.comm MeasureTheory.AEDisjoint.comm
protected theorem _root_.Disjoint.aedisjoint (h : Disjoint s t) : AEDisjoint μ s t := by
rw [AEDisjoint, disjoint_iff_inter_eq_empty.1 h, measure_empty]
#align disjoint.ae_disjoint Disjoint.aedisjoint
protected theorem _root_.Pairwise.aedisjoint {f : ι → Set α} (hf : Pairwise (Disjoint on f)) :
Pairwise (AEDisjoint μ on f) :=
hf.mono fun _i _j h => h.aedisjoint
#align pairwise.ae_disjoint Pairwise.aedisjoint
protected theorem _root_.Set.PairwiseDisjoint.aedisjoint {f : ι → Set α} {s : Set ι}
(hf : s.PairwiseDisjoint f) : s.Pairwise (AEDisjoint μ on f) :=
hf.mono' fun _i _j h => h.aedisjoint
#align set.pairwise_disjoint.ae_disjoint Set.PairwiseDisjoint.aedisjoint
theorem mono_ae (h : AEDisjoint μ s t) (hu : u ≤ᵐ[μ] s) (hv : v ≤ᵐ[μ] t) : AEDisjoint μ u v :=
measure_mono_null_ae (hu.inter hv) h
#align measure_theory.ae_disjoint.mono_ae MeasureTheory.AEDisjoint.mono_ae
protected theorem mono (h : AEDisjoint μ s t) (hu : u ⊆ s) (hv : v ⊆ t) : AEDisjoint μ u v :=
mono_ae h (HasSubset.Subset.eventuallyLE hu) (HasSubset.Subset.eventuallyLE hv)
#align measure_theory.ae_disjoint.mono MeasureTheory.AEDisjoint.mono
protected theorem congr (h : AEDisjoint μ s t) (hu : u =ᵐ[μ] s) (hv : v =ᵐ[μ] t) :
AEDisjoint μ u v :=
mono_ae h (Filter.EventuallyEq.le hu) (Filter.EventuallyEq.le hv)
#align measure_theory.ae_disjoint.congr MeasureTheory.AEDisjoint.congr
@[simp]
theorem iUnion_left_iff [Countable ι] {s : ι → Set α} :
AEDisjoint μ (⋃ i, s i) t ↔ ∀ i, AEDisjoint μ (s i) t := by
simp only [AEDisjoint, iUnion_inter, measure_iUnion_null_iff]
#align measure_theory.ae_disjoint.Union_left_iff MeasureTheory.AEDisjoint.iUnion_left_iff
@[simp]
| Mathlib/MeasureTheory/Measure/AEDisjoint.lean | 100 | 102 | theorem iUnion_right_iff [Countable ι] {t : ι → Set α} :
AEDisjoint μ s (⋃ i, t i) ↔ ∀ i, AEDisjoint μ s (t i) := by |
simp only [AEDisjoint, inter_iUnion, measure_iUnion_null_iff]
| false |
import Mathlib.Data.ENNReal.Real
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Topology.UniformSpace.Pi
import Mathlib.Topology.UniformSpace.UniformConvergence
import Mathlib.Topology.UniformSpace.UniformEmbedding
#align_import topology.metric_space.emetric_space from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
open Set Filter Classical
open scoped Uniformity Topology Filter NNReal ENNReal Pointwise
universe u v w
variable {α : Type u} {β : Type v} {X : Type*}
theorem uniformity_dist_of_mem_uniformity [LinearOrder β] {U : Filter (α × α)} (z : β)
(D : α → α → β) (H : ∀ s, s ∈ U ↔ ∃ ε > z, ∀ {a b : α}, D a b < ε → (a, b) ∈ s) :
U = ⨅ ε > z, 𝓟 { p : α × α | D p.1 p.2 < ε } :=
HasBasis.eq_biInf ⟨fun s => by simp only [H, subset_def, Prod.forall, mem_setOf]⟩
#align uniformity_dist_of_mem_uniformity uniformity_dist_of_mem_uniformity
@[ext]
class EDist (α : Type*) where
edist : α → α → ℝ≥0∞
#align has_edist EDist
export EDist (edist)
def uniformSpaceOfEDist (edist : α → α → ℝ≥0∞) (edist_self : ∀ x : α, edist x x = 0)
(edist_comm : ∀ x y : α, edist x y = edist y x)
(edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z) : UniformSpace α :=
.ofFun edist edist_self edist_comm edist_triangle fun ε ε0 =>
⟨ε / 2, ENNReal.half_pos ε0.ne', fun _ h₁ _ h₂ =>
(ENNReal.add_lt_add h₁ h₂).trans_eq (ENNReal.add_halves _)⟩
#align uniform_space_of_edist uniformSpaceOfEDist
-- the uniform structure is embedded in the emetric space structure
-- to avoid instance diamond issues. See Note [forgetful inheritance].
class PseudoEMetricSpace (α : Type u) extends EDist α : Type u where
edist_self : ∀ x : α, edist x x = 0
edist_comm : ∀ x y : α, edist x y = edist y x
edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z
toUniformSpace : UniformSpace α := uniformSpaceOfEDist edist edist_self edist_comm edist_triangle
uniformity_edist : 𝓤 α = ⨅ ε > 0, 𝓟 { p : α × α | edist p.1 p.2 < ε } := by rfl
#align pseudo_emetric_space PseudoEMetricSpace
attribute [instance] PseudoEMetricSpace.toUniformSpace
@[ext]
protected theorem PseudoEMetricSpace.ext {α : Type*} {m m' : PseudoEMetricSpace α}
(h : m.toEDist = m'.toEDist) : m = m' := by
cases' m with ed _ _ _ U hU
cases' m' with ed' _ _ _ U' hU'
congr 1
exact UniformSpace.ext (((show ed = ed' from h) ▸ hU).trans hU'.symm)
variable [PseudoEMetricSpace α]
export PseudoEMetricSpace (edist_self edist_comm edist_triangle)
attribute [simp] edist_self
theorem edist_triangle_left (x y z : α) : edist x y ≤ edist z x + edist z y := by
rw [edist_comm z]; apply edist_triangle
#align edist_triangle_left edist_triangle_left
theorem edist_triangle_right (x y z : α) : edist x y ≤ edist x z + edist y z := by
rw [edist_comm y]; apply edist_triangle
#align edist_triangle_right edist_triangle_right
| Mathlib/Topology/EMetricSpace/Basic.lean | 118 | 124 | theorem edist_congr_right {x y z : α} (h : edist x y = 0) : edist x z = edist y z := by |
apply le_antisymm
· rw [← zero_add (edist y z), ← h]
apply edist_triangle
· rw [edist_comm] at h
rw [← zero_add (edist x z), ← h]
apply edist_triangle
| false |
import Mathlib.LinearAlgebra.GeneralLinearGroup
import Mathlib.LinearAlgebra.Matrix.ToLin
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.Algebra.Star.Unitary
#align_import linear_algebra.unitary_group from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9"
universe u v
namespace Matrix
open LinearMap Matrix
section
variable (n : Type u) [DecidableEq n] [Fintype n]
variable (α : Type v) [CommRing α] [StarRing α]
abbrev unitaryGroup :=
unitary (Matrix n n α)
#align matrix.unitary_group Matrix.unitaryGroup
end
variable {n : Type u} [DecidableEq n] [Fintype n]
variable {α : Type v} [CommRing α] [StarRing α] {A : Matrix n n α}
| Mathlib/LinearAlgebra/UnitaryGroup.lean | 66 | 68 | theorem mem_unitaryGroup_iff : A ∈ Matrix.unitaryGroup n α ↔ A * star A = 1 := by |
refine ⟨And.right, fun hA => ⟨?_, hA⟩⟩
simpa only [mul_eq_one_comm] using hA
| false |
import Mathlib.Topology.Algebra.Algebra
import Mathlib.Topology.ContinuousFunction.Compact
import Mathlib.Topology.UrysohnsLemma
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Topology.Algebra.Module.CharacterSpace
#align_import topology.continuous_function.ideals from "leanprover-community/mathlib"@"c2258f7bf086b17eac0929d635403780c39e239f"
open scoped NNReal
namespace ContinuousMap
open TopologicalSpace
section TopologicalRing
variable {X R : Type*} [TopologicalSpace X] [Semiring R]
variable [TopologicalSpace R] [TopologicalSemiring R]
variable (R)
def idealOfSet (s : Set X) : Ideal C(X, R) where
carrier := {f : C(X, R) | ∀ x ∈ sᶜ, f x = 0}
add_mem' {f g} hf hg x hx := by simp [hf x hx, hg x hx, coe_add, Pi.add_apply, add_zero]
zero_mem' _ _ := rfl
smul_mem' c f hf x hx := mul_zero (c x) ▸ congr_arg (fun y => c x * y) (hf x hx)
#align continuous_map.ideal_of_set ContinuousMap.idealOfSet
theorem idealOfSet_closed [T2Space R] (s : Set X) :
IsClosed (idealOfSet R s : Set C(X, R)) := by
simp only [idealOfSet, Submodule.coe_set_mk, Set.setOf_forall]
exact isClosed_iInter fun x => isClosed_iInter fun _ =>
isClosed_eq (continuous_eval_const x) continuous_const
#align continuous_map.ideal_of_set_closed ContinuousMap.idealOfSet_closed
variable {R}
theorem mem_idealOfSet {s : Set X} {f : C(X, R)} :
f ∈ idealOfSet R s ↔ ∀ ⦃x : X⦄, x ∈ sᶜ → f x = 0 := by
convert Iff.rfl
#align continuous_map.mem_ideal_of_set ContinuousMap.mem_idealOfSet
theorem not_mem_idealOfSet {s : Set X} {f : C(X, R)} : f ∉ idealOfSet R s ↔ ∃ x ∈ sᶜ, f x ≠ 0 := by
simp_rw [mem_idealOfSet]; push_neg; rfl
#align continuous_map.not_mem_ideal_of_set ContinuousMap.not_mem_idealOfSet
def setOfIdeal (I : Ideal C(X, R)) : Set X :=
{x : X | ∀ f ∈ I, (f : C(X, R)) x = 0}ᶜ
#align continuous_map.set_of_ideal ContinuousMap.setOfIdeal
theorem not_mem_setOfIdeal {I : Ideal C(X, R)} {x : X} :
x ∉ setOfIdeal I ↔ ∀ ⦃f : C(X, R)⦄, f ∈ I → f x = 0 := by
rw [← Set.mem_compl_iff, setOfIdeal, compl_compl, Set.mem_setOf]
#align continuous_map.not_mem_set_of_ideal ContinuousMap.not_mem_setOfIdeal
theorem mem_setOfIdeal {I : Ideal C(X, R)} {x : X} :
x ∈ setOfIdeal I ↔ ∃ f ∈ I, (f : C(X, R)) x ≠ 0 := by
simp_rw [setOfIdeal, Set.mem_compl_iff, Set.mem_setOf]; push_neg; rfl
#align continuous_map.mem_set_of_ideal ContinuousMap.mem_setOfIdeal
theorem setOfIdeal_open [T2Space R] (I : Ideal C(X, R)) : IsOpen (setOfIdeal I) := by
simp only [setOfIdeal, Set.setOf_forall, isOpen_compl_iff]
exact
isClosed_iInter fun f =>
isClosed_iInter fun _ => isClosed_eq (map_continuous f) continuous_const
#align continuous_map.set_of_ideal_open ContinuousMap.setOfIdeal_open
@[simps]
def opensOfIdeal [T2Space R] (I : Ideal C(X, R)) : Opens X :=
⟨setOfIdeal I, setOfIdeal_open I⟩
#align continuous_map.opens_of_ideal ContinuousMap.opensOfIdeal
@[simp]
theorem setOfTop_eq_univ [Nontrivial R] : setOfIdeal (⊤ : Ideal C(X, R)) = Set.univ :=
Set.univ_subset_iff.mp fun _ _ => mem_setOfIdeal.mpr ⟨1, Submodule.mem_top, one_ne_zero⟩
#align continuous_map.set_of_top_eq_univ ContinuousMap.setOfTop_eq_univ
@[simp]
theorem idealOfEmpty_eq_bot : idealOfSet R (∅ : Set X) = ⊥ :=
Ideal.ext fun f => by
simp only [mem_idealOfSet, Set.compl_empty, Set.mem_univ, forall_true_left, Ideal.mem_bot,
DFunLike.ext_iff, zero_apply]
#align continuous_map.ideal_of_empty_eq_bot ContinuousMap.idealOfEmpty_eq_bot
@[simp]
| Mathlib/Topology/ContinuousFunction/Ideals.lean | 154 | 156 | theorem mem_idealOfSet_compl_singleton (x : X) (f : C(X, R)) :
f ∈ idealOfSet R ({x}ᶜ : Set X) ↔ f x = 0 := by |
simp only [mem_idealOfSet, compl_compl, Set.mem_singleton_iff, forall_eq]
| false |
import Mathlib.Analysis.InnerProductSpace.Calculus
import Mathlib.Analysis.InnerProductSpace.PiL2
#align_import analysis.inner_product_space.euclidean_dist from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
open scoped Topology
open Set
variable {E : Type*} [AddCommGroup E] [TopologicalSpace E] [TopologicalAddGroup E] [T2Space E]
[Module ℝ E] [ContinuousSMul ℝ E] [FiniteDimensional ℝ E]
noncomputable section
open FiniteDimensional
def toEuclidean : E ≃L[ℝ] EuclideanSpace ℝ (Fin <| finrank ℝ E) :=
ContinuousLinearEquiv.ofFinrankEq finrank_euclideanSpace_fin.symm
#align to_euclidean toEuclidean
namespace Euclidean
nonrec def dist (x y : E) : ℝ :=
dist (toEuclidean x) (toEuclidean y)
#align euclidean.dist Euclidean.dist
def closedBall (x : E) (r : ℝ) : Set E :=
{y | dist y x ≤ r}
#align euclidean.closed_ball Euclidean.closedBall
def ball (x : E) (r : ℝ) : Set E :=
{y | dist y x < r}
#align euclidean.ball Euclidean.ball
theorem ball_eq_preimage (x : E) (r : ℝ) :
ball x r = toEuclidean ⁻¹' Metric.ball (toEuclidean x) r :=
rfl
#align euclidean.ball_eq_preimage Euclidean.ball_eq_preimage
theorem closedBall_eq_preimage (x : E) (r : ℝ) :
closedBall x r = toEuclidean ⁻¹' Metric.closedBall (toEuclidean x) r :=
rfl
#align euclidean.closed_ball_eq_preimage Euclidean.closedBall_eq_preimage
theorem ball_subset_closedBall {x : E} {r : ℝ} : ball x r ⊆ closedBall x r := fun _ (hy : _ < r) =>
le_of_lt hy
#align euclidean.ball_subset_closed_ball Euclidean.ball_subset_closedBall
theorem isOpen_ball {x : E} {r : ℝ} : IsOpen (ball x r) :=
Metric.isOpen_ball.preimage toEuclidean.continuous
#align euclidean.is_open_ball Euclidean.isOpen_ball
theorem mem_ball_self {x : E} {r : ℝ} (hr : 0 < r) : x ∈ ball x r :=
Metric.mem_ball_self hr
#align euclidean.mem_ball_self Euclidean.mem_ball_self
theorem closedBall_eq_image (x : E) (r : ℝ) :
closedBall x r = toEuclidean.symm '' Metric.closedBall (toEuclidean x) r := by
rw [toEuclidean.image_symm_eq_preimage, closedBall_eq_preimage]
#align euclidean.closed_ball_eq_image Euclidean.closedBall_eq_image
nonrec theorem isCompact_closedBall {x : E} {r : ℝ} : IsCompact (closedBall x r) := by
rw [closedBall_eq_image]
exact (isCompact_closedBall _ _).image toEuclidean.symm.continuous
#align euclidean.is_compact_closed_ball Euclidean.isCompact_closedBall
theorem isClosed_closedBall {x : E} {r : ℝ} : IsClosed (closedBall x r) :=
isCompact_closedBall.isClosed
#align euclidean.is_closed_closed_ball Euclidean.isClosed_closedBall
nonrec theorem closure_ball (x : E) {r : ℝ} (h : r ≠ 0) : closure (ball x r) = closedBall x r := by
rw [ball_eq_preimage, ← toEuclidean.preimage_closure, closure_ball (toEuclidean x) h,
closedBall_eq_preimage]
#align euclidean.closure_ball Euclidean.closure_ball
nonrec theorem exists_pos_lt_subset_ball {R : ℝ} {s : Set E} {x : E} (hR : 0 < R) (hs : IsClosed s)
(h : s ⊆ ball x R) : ∃ r ∈ Ioo 0 R, s ⊆ ball x r := by
rw [ball_eq_preimage, ← image_subset_iff] at h
rcases exists_pos_lt_subset_ball hR (toEuclidean.isClosed_image.2 hs) h with ⟨r, hr, hsr⟩
exact ⟨r, hr, image_subset_iff.1 hsr⟩
#align euclidean.exists_pos_lt_subset_ball Euclidean.exists_pos_lt_subset_ball
theorem nhds_basis_closedBall {x : E} : (𝓝 x).HasBasis (fun r : ℝ => 0 < r) (closedBall x) := by
rw [toEuclidean.toHomeomorph.nhds_eq_comap x]
exact Metric.nhds_basis_closedBall.comap _
#align euclidean.nhds_basis_closed_ball Euclidean.nhds_basis_closedBall
theorem closedBall_mem_nhds {x : E} {r : ℝ} (hr : 0 < r) : closedBall x r ∈ 𝓝 x :=
nhds_basis_closedBall.mem_of_mem hr
#align euclidean.closed_ball_mem_nhds Euclidean.closedBall_mem_nhds
| Mathlib/Analysis/InnerProductSpace/EuclideanDist.lean | 117 | 119 | theorem nhds_basis_ball {x : E} : (𝓝 x).HasBasis (fun r : ℝ => 0 < r) (ball x) := by |
rw [toEuclidean.toHomeomorph.nhds_eq_comap x]
exact Metric.nhds_basis_ball.comap _
| false |
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
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]
#align distrib_three_right distrib_three_right
class NonUnitalNonAssocSemiring (α : Type u) extends AddCommMonoid α, Distrib α, MulZeroClass α
#align non_unital_non_assoc_semiring NonUnitalNonAssocSemiring
class NonUnitalSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, SemigroupWithZero α
#align non_unital_semiring NonUnitalSemiring
class NonAssocSemiring (α : Type u) extends NonUnitalNonAssocSemiring α, MulZeroOneClass α,
AddCommMonoidWithOne α
#align non_assoc_semiring NonAssocSemiring
class NonUnitalNonAssocRing (α : Type u) extends AddCommGroup α, NonUnitalNonAssocSemiring α
#align non_unital_non_assoc_ring NonUnitalNonAssocRing
class NonUnitalRing (α : Type*) extends NonUnitalNonAssocRing α, NonUnitalSemiring α
#align non_unital_ring NonUnitalRing
class NonAssocRing (α : Type*) extends NonUnitalNonAssocRing α, NonAssocSemiring α,
AddCommGroupWithOne α
#align non_assoc_ring NonAssocRing
class Semiring (α : Type u) extends NonUnitalSemiring α, NonAssocSemiring α, MonoidWithZero α
#align semiring Semiring
class Ring (R : Type u) extends Semiring R, AddCommGroup R, AddGroupWithOne R
#align ring Ring
section DistribMulOneClass
variable [Add α] [MulOneClass α]
| Mathlib/Algebra/Ring/Defs.lean | 156 | 157 | theorem add_one_mul [RightDistribClass α] (a b : α) : (a + 1) * b = a * b + b := by |
rw [add_mul, one_mul]
| false |
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Directed
#align_import data.set.Union_lift from "leanprover-community/mathlib"@"5a4ea8453f128345f73cc656e80a49de2a54f481"
variable {α : Type*} {ι β : Sort _}
namespace Set
section UnionLift
@[nolint unusedArguments]
noncomputable def iUnionLift (S : ι → Set α) (f : ∀ i, S i → β)
(_ : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩) (T : Set α)
(hT : T ⊆ iUnion S) (x : T) : β :=
let i := Classical.indefiniteDescription _ (mem_iUnion.1 (hT x.prop))
f i ⟨x, i.prop⟩
#align set.Union_lift Set.iUnionLift
variable {S : ι → Set α} {f : ∀ i, S i → β}
{hf : ∀ (i j) (x : α) (hxi : x ∈ S i) (hxj : x ∈ S j), f i ⟨x, hxi⟩ = f j ⟨x, hxj⟩} {T : Set α}
{hT : T ⊆ iUnion S} (hT' : T = iUnion S)
@[simp]
theorem iUnionLift_mk {i : ι} (x : S i) (hx : (x : α) ∈ T) :
iUnionLift S f hf T hT ⟨x, hx⟩ = f i x := hf _ i x _ _
#align set.Union_lift_mk Set.iUnionLift_mk
@[simp]
theorem iUnionLift_inclusion {i : ι} (x : S i) (h : S i ⊆ T) :
iUnionLift S f hf T hT (Set.inclusion h x) = f i x :=
iUnionLift_mk x _
#align set.Union_lift_inclusion Set.iUnionLift_inclusion
theorem iUnionLift_of_mem (x : T) {i : ι} (hx : (x : α) ∈ S i) :
iUnionLift S f hf T hT x = f i ⟨x, hx⟩ := by cases' x with x hx; exact hf _ _ _ _ _
#align set.Union_lift_of_mem Set.iUnionLift_of_mem
| Mathlib/Data/Set/UnionLift.lean | 79 | 90 | theorem preimage_iUnionLift (t : Set β) :
iUnionLift S f hf T hT ⁻¹' t =
inclusion hT ⁻¹' (⋃ i, inclusion (subset_iUnion S i) '' (f i ⁻¹' t)) := by |
ext x
simp only [mem_preimage, mem_iUnion, mem_image]
constructor
· rcases mem_iUnion.1 (hT x.prop) with ⟨i, hi⟩
refine fun h => ⟨i, ⟨x, hi⟩, ?_, rfl⟩
rwa [iUnionLift_of_mem x hi] at h
· rintro ⟨i, ⟨y, hi⟩, h, hxy⟩
obtain rfl : y = x := congr_arg Subtype.val hxy
rwa [iUnionLift_of_mem x hi]
| false |
import Mathlib.Algebra.MvPolynomial.Basic
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
#align_import ring_theory.adjoin.fg from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
universe u v w
open Subsemiring Ring Submodule
open Pointwise
namespace Subalgebra
variable {R : Type u} {A : Type v} {B : Type w}
variable [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
def FG (S : Subalgebra R A) : Prop :=
∃ t : Finset A, Algebra.adjoin R ↑t = S
#align subalgebra.fg Subalgebra.FG
theorem fg_adjoin_finset (s : Finset A) : (Algebra.adjoin R (↑s : Set A)).FG :=
⟨s, rfl⟩
#align subalgebra.fg_adjoin_finset Subalgebra.fg_adjoin_finset
theorem fg_def {S : Subalgebra R A} : S.FG ↔ ∃ t : Set A, Set.Finite t ∧ Algebra.adjoin R t = S :=
Iff.symm Set.exists_finite_iff_finset
#align subalgebra.fg_def Subalgebra.fg_def
theorem fg_bot : (⊥ : Subalgebra R A).FG :=
⟨∅, Finset.coe_empty ▸ Algebra.adjoin_empty R A⟩
#align subalgebra.fg_bot Subalgebra.fg_bot
theorem fg_of_fg_toSubmodule {S : Subalgebra R A} : S.toSubmodule.FG → S.FG :=
fun ⟨t, ht⟩ ↦ ⟨t, le_antisymm
(Algebra.adjoin_le fun x hx ↦ show x ∈ Subalgebra.toSubmodule S from ht ▸ subset_span hx) <|
show Subalgebra.toSubmodule S ≤ Subalgebra.toSubmodule (Algebra.adjoin R ↑t) from fun x hx ↦
span_le.mpr (fun x hx ↦ Algebra.subset_adjoin hx)
(show x ∈ span R ↑t by
rw [ht]
exact hx)⟩
#align subalgebra.fg_of_fg_to_submodule Subalgebra.fg_of_fg_toSubmodule
theorem fg_of_noetherian [IsNoetherian R A] (S : Subalgebra R A) : S.FG :=
fg_of_fg_toSubmodule (IsNoetherian.noetherian (Subalgebra.toSubmodule S))
#align subalgebra.fg_of_noetherian Subalgebra.fg_of_noetherian
theorem fg_of_submodule_fg (h : (⊤ : Submodule R A).FG) : (⊤ : Subalgebra R A).FG :=
let ⟨s, hs⟩ := h
⟨s, toSubmodule.injective <| by
rw [Algebra.top_toSubmodule, eq_top_iff, ← hs, span_le]
exact Algebra.subset_adjoin⟩
#align subalgebra.fg_of_submodule_fg Subalgebra.fg_of_submodule_fg
theorem FG.prod {S : Subalgebra R A} {T : Subalgebra R B} (hS : S.FG) (hT : T.FG) :
(S.prod T).FG := by
obtain ⟨s, hs⟩ := fg_def.1 hS
obtain ⟨t, ht⟩ := fg_def.1 hT
rw [← hs.2, ← ht.2]
exact fg_def.2 ⟨LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1}),
Set.Finite.union (Set.Finite.image _ (Set.Finite.union hs.1 (Set.finite_singleton _)))
(Set.Finite.image _ (Set.Finite.union ht.1 (Set.finite_singleton _))),
Algebra.adjoin_inl_union_inr_eq_prod R s t⟩
#align subalgebra.fg.prod Subalgebra.FG.prod
section
open scoped Classical
theorem FG.map {S : Subalgebra R A} (f : A →ₐ[R] B) (hs : S.FG) : (S.map f).FG :=
let ⟨s, hs⟩ := hs
⟨s.image f, by rw [Finset.coe_image, Algebra.adjoin_image, hs]⟩
#align subalgebra.fg.map Subalgebra.FG.map
end
theorem fg_of_fg_map (S : Subalgebra R A) (f : A →ₐ[R] B) (hf : Function.Injective f)
(hs : (S.map f).FG) : S.FG :=
let ⟨s, hs⟩ := hs
⟨s.preimage f fun _ _ _ _ h ↦ hf h,
map_injective hf <| by
rw [← Algebra.adjoin_image, Finset.coe_preimage, Set.image_preimage_eq_of_subset, hs]
rw [← AlgHom.coe_range, ← Algebra.adjoin_le_iff, hs, ← Algebra.map_top]
exact map_mono le_top⟩
#align subalgebra.fg_of_fg_map Subalgebra.fg_of_fg_map
theorem fg_top (S : Subalgebra R A) : (⊤ : Subalgebra R S).FG ↔ S.FG :=
⟨fun h ↦ by
rw [← S.range_val, ← Algebra.map_top]
exact FG.map _ h, fun h ↦
fg_of_fg_map _ S.val Subtype.val_injective <| by
rw [Algebra.map_top, range_val]
exact h⟩
#align subalgebra.fg_top Subalgebra.fg_top
| Mathlib/RingTheory/Adjoin/FG.lean | 170 | 179 | theorem induction_on_adjoin [IsNoetherian R A] (P : Subalgebra R A → Prop) (base : P ⊥)
(ih : ∀ (S : Subalgebra R A) (x : A), P S → P (Algebra.adjoin R (insert x S)))
(S : Subalgebra R A) : P S := by |
classical
obtain ⟨t, rfl⟩ := S.fg_of_noetherian
refine Finset.induction_on t ?_ ?_
· simpa using base
intro x t _ h
rw [Finset.coe_insert]
simpa only [Algebra.adjoin_insert_adjoin] using ih _ x h
| false |
import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL2
#align_import measure_theory.function.conditional_expectation.condexp_L1 from "leanprover-community/mathlib"@"d8bbb04e2d2a44596798a9207ceefc0fb236e41e"
noncomputable section
open TopologicalSpace MeasureTheory.Lp Filter ContinuousLinearMap
open scoped NNReal ENNReal Topology MeasureTheory
namespace MeasureTheory
variable {α β F F' G G' 𝕜 : Type*} {p : ℝ≥0∞} [RCLike 𝕜]
-- 𝕜 for ℝ or ℂ
-- F for a Lp submodule
[NormedAddCommGroup F]
[NormedSpace 𝕜 F]
-- F' for integrals on a Lp submodule
[NormedAddCommGroup F']
[NormedSpace 𝕜 F'] [NormedSpace ℝ F'] [CompleteSpace F']
-- G for a Lp add_subgroup
[NormedAddCommGroup G]
-- G' for integrals on a Lp add_subgroup
[NormedAddCommGroup G']
[NormedSpace ℝ G'] [CompleteSpace G']
section CondexpInd
variable {m m0 : MeasurableSpace α} {μ : Measure α} {s t : Set α} [NormedSpace ℝ G]
section CondexpIndL1Fin
set_option linter.uppercaseLean3 false
def condexpIndL1Fin (hm : m ≤ m0) [SigmaFinite (μ.trim hm)] (hs : MeasurableSet s) (hμs : μ s ≠ ∞)
(x : G) : α →₁[μ] G :=
(integrable_condexpIndSMul hm hs hμs x).toL1 _
#align measure_theory.condexp_ind_L1_fin MeasureTheory.condexpIndL1Fin
theorem condexpIndL1Fin_ae_eq_condexpIndSMul (hm : m ≤ m0) [SigmaFinite (μ.trim hm)]
(hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x : G) :
condexpIndL1Fin hm hs hμs x =ᵐ[μ] condexpIndSMul hm hs hμs x :=
(integrable_condexpIndSMul hm hs hμs x).coeFn_toL1
#align measure_theory.condexp_ind_L1_fin_ae_eq_condexp_ind_smul MeasureTheory.condexpIndL1Fin_ae_eq_condexpIndSMul
variable {hm : m ≤ m0} [SigmaFinite (μ.trim hm)]
-- Porting note: this lemma fills the hole in `refine' (Memℒp.coeFn_toLp _) ...`
-- which is not automatically filled in Lean 4
private theorem q {hs : MeasurableSet s} {hμs : μ s ≠ ∞} {x : G} :
Memℒp (condexpIndSMul hm hs hμs x) 1 μ := by
rw [memℒp_one_iff_integrable]; apply integrable_condexpIndSMul
| Mathlib/MeasureTheory/Function/ConditionalExpectation/CondexpL1.lean | 92 | 102 | theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
condexpIndL1Fin hm hs hμs (x + y) =
condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y := by |
ext1
refine (Memℒp.coeFn_toLp q).trans ?_
refine EventuallyEq.trans ?_ (Lp.coeFn_add _ _).symm
refine EventuallyEq.trans ?_
(EventuallyEq.add (Memℒp.coeFn_toLp q).symm (Memℒp.coeFn_toLp q).symm)
rw [condexpIndSMul_add]
refine (Lp.coeFn_add _ _).trans (eventually_of_forall fun a => ?_)
rfl
| false |
import Mathlib.Data.Nat.Bits
import Mathlib.Order.Lattice
#align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
namespace Nat
section
set_option linter.deprecated false
theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _
#align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow
theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n
| 0 => by simp [shiftLeft', pow_zero, Nat.one_mul]
| k + 1 => by
change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2)
rw [bit1_val]
change 2 * (shiftLeft' true m k + 1) = _
rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2]
#align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow
end
#align nat.one_shiftl Nat.one_shiftLeft
#align nat.zero_shiftl Nat.zero_shiftLeft
#align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow
theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by
induction n <;> simp [bit_ne_zero, shiftLeft', *]
#align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left
theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0
| 0, h => absurd rfl h
| succ _, _ => Nat.bit1_ne_zero _
#align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero
@[simp]
theorem size_zero : size 0 = 0 := by simp [size]
#align nat.size_zero Nat.size_zero
@[simp]
theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by
rw [size]
conv =>
lhs
rw [binaryRec]
simp [h]
rw [div2_bit]
#align nat.size_bit Nat.size_bit
section
set_option linter.deprecated false
@[simp]
theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) :=
@size_bit false n (Nat.bit0_ne_zero h)
#align nat.size_bit0 Nat.size_bit0
@[simp]
theorem size_bit1 (n) : size (bit1 n) = succ (size n) :=
@size_bit true n (Nat.bit1_ne_zero n)
#align nat.size_bit1 Nat.size_bit1
@[simp]
theorem size_one : size 1 = 1 :=
show size (bit1 0) = 1 by rw [size_bit1, size_zero]
#align nat.size_one Nat.size_one
end
@[simp]
theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) :
size (shiftLeft' b m n) = size m + n := by
induction' n with n IH <;> simp [shiftLeft'] at h ⊢
rw [size_bit h, Nat.add_succ]
by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]]
rw [s0] at h ⊢
cases b; · exact absurd rfl h
have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0
rw [shiftLeft'_tt_eq_mul_pow] at this
obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩)
simp only [zero_add, one_mul] at this
obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this
rfl
#align nat.size_shiftl' Nat.size_shiftLeft'
-- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp
-- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue.
@[simp, nolint simpNF]
theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false]
#align nat.size_shiftl Nat.size_shiftLeft
theorem lt_size_self (n : ℕ) : n < 2 ^ size n := by
rw [← one_shiftLeft]
have : ∀ {n}, n = 0 → n < 1 <<< (size n) := by simp
apply binaryRec _ _ n
· apply this rfl
intro b n IH
by_cases h : bit b n = 0
· apply this h
rw [size_bit h, shiftLeft_succ, shiftLeft_eq, one_mul, ← bit0_val]
exact bit_lt_bit0 _ (by simpa [shiftLeft_eq, shiftRight_eq_div_pow] using IH)
#align nat.lt_size_self Nat.lt_size_self
theorem size_le {m n : ℕ} : size m ≤ n ↔ m < 2 ^ n :=
⟨fun h => lt_of_lt_of_le (lt_size_self _) (pow_le_pow_of_le_right (by decide) h), by
rw [← one_shiftLeft]; revert n
apply binaryRec _ _ m
· intro n
simp
· intro b m IH n h
by_cases e : bit b m = 0
· simp [e]
rw [size_bit e]
cases' n with n
· exact e.elim (Nat.eq_zero_of_le_zero (le_of_lt_succ h))
· apply succ_le_succ (IH _)
apply Nat.lt_of_mul_lt_mul_left (a := 2)
simp only [← bit0_val, shiftLeft_succ] at *
exact lt_of_le_of_lt (bit0_le_bit b rfl.le) h⟩
#align nat.size_le Nat.size_le
theorem lt_size {m n : ℕ} : m < size n ↔ 2 ^ m ≤ n := by
rw [← not_lt, Decidable.iff_not_comm, not_lt, size_le]
#align nat.lt_size Nat.lt_size
theorem size_pos {n : ℕ} : 0 < size n ↔ 0 < n := by rw [lt_size]; rfl
#align nat.size_pos Nat.size_pos
| Mathlib/Data/Nat/Size.lean | 144 | 145 | theorem size_eq_zero {n : ℕ} : size n = 0 ↔ n = 0 := by |
simpa [Nat.pos_iff_ne_zero, not_iff_not] using size_pos
| false |
import Mathlib.GroupTheory.FreeGroup.Basic
import Mathlib.GroupTheory.QuotientGroup
#align_import group_theory.presented_group from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46"
variable {α : Type*}
def PresentedGroup (rels : Set (FreeGroup α)) :=
FreeGroup α ⧸ Subgroup.normalClosure rels
#align presented_group PresentedGroup
namespace PresentedGroup
instance (rels : Set (FreeGroup α)) : Group (PresentedGroup rels) :=
QuotientGroup.Quotient.group _
def of {rels : Set (FreeGroup α)} (x : α) : PresentedGroup rels :=
QuotientGroup.mk (FreeGroup.of x)
#align presented_group.of PresentedGroup.of
@[simp]
theorem closure_range_of (rels : Set (FreeGroup α)) :
Subgroup.closure (Set.range (PresentedGroup.of : α → PresentedGroup rels)) = ⊤ := by
have : (PresentedGroup.of : α → PresentedGroup rels) = QuotientGroup.mk' _ ∘ FreeGroup.of := rfl
rw [this, Set.range_comp, ← MonoidHom.map_closure (QuotientGroup.mk' _),
FreeGroup.closure_range_of, ← MonoidHom.range_eq_map]
exact MonoidHom.range_top_of_surjective _ (QuotientGroup.mk'_surjective _)
section ToGroup
variable {G : Type*} [Group G] {f : α → G} {rels : Set (FreeGroup α)}
local notation "F" => FreeGroup.lift f
-- Porting note: `F` has been expanded, because `F r = 1` produces a sorry.
variable (h : ∀ r ∈ rels, FreeGroup.lift f r = 1)
theorem closure_rels_subset_ker : Subgroup.normalClosure rels ≤ MonoidHom.ker F :=
Subgroup.normalClosure_le_normal fun x w ↦ (MonoidHom.mem_ker _).2 (h x w)
#align presented_group.closure_rels_subset_ker PresentedGroup.closure_rels_subset_ker
theorem to_group_eq_one_of_mem_closure : ∀ x ∈ Subgroup.normalClosure rels, F x = 1 :=
fun _ w ↦ (MonoidHom.mem_ker _).1 <| closure_rels_subset_ker h w
#align presented_group.to_group_eq_one_of_mem_closure PresentedGroup.to_group_eq_one_of_mem_closure
def toGroup : PresentedGroup rels →* G :=
QuotientGroup.lift (Subgroup.normalClosure rels) F (to_group_eq_one_of_mem_closure h)
#align presented_group.to_group PresentedGroup.toGroup
@[simp]
theorem toGroup.of {x : α} : toGroup h (of x) = f x :=
FreeGroup.lift.of
#align presented_group.to_group.of PresentedGroup.toGroup.of
theorem toGroup.unique (g : PresentedGroup rels →* G)
(hg : ∀ x : α, g (PresentedGroup.of x) = f x) : ∀ {x}, g x = toGroup h x := by
intro x
refine QuotientGroup.induction_on x ?_
exact fun _ ↦ FreeGroup.lift.unique (g.comp (QuotientGroup.mk' _)) hg
#align presented_group.to_group.unique PresentedGroup.toGroup.unique
@[ext]
| Mathlib/GroupTheory/PresentedGroup.lean | 101 | 104 | theorem ext {φ ψ : PresentedGroup rels →* G} (hx : ∀ (x : α), φ (.of x) = ψ (.of x)) : φ = ψ := by |
unfold PresentedGroup
ext
apply hx
| false |
import Mathlib.Algebra.Polynomial.Basic
import Mathlib.SetTheory.Cardinal.Ordinal
#align_import data.polynomial.cardinal from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c"
universe u
open Cardinal Polynomial
open Cardinal
namespace Polynomial
@[simp]
theorem cardinal_mk_eq_max {R : Type u} [Semiring R] [Nontrivial R] : #(R[X]) = max #R ℵ₀ :=
(toFinsuppIso R).toEquiv.cardinal_eq.trans <| by
rw [AddMonoidAlgebra, mk_finsupp_lift_of_infinite, lift_uzero, max_comm]
rfl
#align polynomial.cardinal_mk_eq_max Polynomial.cardinal_mk_eq_max
| Mathlib/Algebra/Polynomial/Cardinal.lean | 34 | 37 | theorem cardinal_mk_le_max {R : Type u} [Semiring R] : #(R[X]) ≤ max #R ℵ₀ := by |
cases subsingleton_or_nontrivial R
· exact (mk_eq_one _).trans_le (le_max_of_le_right one_le_aleph0)
· exact cardinal_mk_eq_max.le
| false |
import Mathlib.Data.Finset.Fold
import Mathlib.Algebra.GCDMonoid.Multiset
#align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
#align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d"
variable {ι α β γ : Type*}
namespace Finset
open Multiset
variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section lcm
def lcm (s : Finset β) (f : β → α) : α :=
s.fold GCDMonoid.lcm 1 f
#align finset.lcm Finset.lcm
variable {s s₁ s₂ : Finset β} {f : β → α}
theorem lcm_def : s.lcm f = (s.1.map f).lcm :=
rfl
#align finset.lcm_def Finset.lcm_def
@[simp]
theorem lcm_empty : (∅ : Finset β).lcm f = 1 :=
fold_empty
#align finset.lcm_empty Finset.lcm_empty
@[simp]
theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by
apply Iff.trans Multiset.lcm_dvd
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.lcm_dvd_iff Finset.lcm_dvd_iff
theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a :=
lcm_dvd_iff.2
#align finset.lcm_dvd Finset.lcm_dvd
theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f :=
lcm_dvd_iff.1 dvd_rfl _ hb
#align finset.dvd_lcm Finset.dvd_lcm
@[simp]
theorem lcm_insert [DecidableEq β] {b : β} :
(insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by
by_cases h : b ∈ s
· rw [insert_eq_of_mem h,
(lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)]
apply fold_insert h
#align finset.lcm_insert Finset.lcm_insert
@[simp]
theorem lcm_singleton {b : β} : ({b} : Finset β).lcm f = normalize (f b) :=
Multiset.lcm_singleton
#align finset.lcm_singleton Finset.lcm_singleton
-- Porting note: Priority changed for `simpNF`
@[simp 1100]
theorem normalize_lcm : normalize (s.lcm f) = s.lcm f := by simp [lcm_def]
#align finset.normalize_lcm Finset.normalize_lcm
theorem lcm_union [DecidableEq β] : (s₁ ∪ s₂).lcm f = GCDMonoid.lcm (s₁.lcm f) (s₂.lcm f) :=
Finset.induction_on s₁ (by rw [empty_union, lcm_empty, lcm_one_left, normalize_lcm])
fun a s _ ih ↦ by rw [insert_union, lcm_insert, lcm_insert, ih, lcm_assoc]
#align finset.lcm_union Finset.lcm_union
theorem lcm_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) :
s₁.lcm f = s₂.lcm g := by
subst hs
exact Finset.fold_congr hfg
#align finset.lcm_congr Finset.lcm_congr
theorem lcm_mono_fun {g : β → α} (h : ∀ b ∈ s, f b ∣ g b) : s.lcm f ∣ s.lcm g :=
lcm_dvd fun b hb ↦ (h b hb).trans (dvd_lcm hb)
#align finset.lcm_mono_fun Finset.lcm_mono_fun
theorem lcm_mono (h : s₁ ⊆ s₂) : s₁.lcm f ∣ s₂.lcm f :=
lcm_dvd fun _ hb ↦ dvd_lcm (h hb)
#align finset.lcm_mono Finset.lcm_mono
theorem lcm_image [DecidableEq β] {g : γ → β} (s : Finset γ) :
(s.image g).lcm f = s.lcm (f ∘ g) := by
classical induction' s using Finset.induction with c s _ ih <;> simp [*]
#align finset.lcm_image Finset.lcm_image
theorem lcm_eq_lcm_image [DecidableEq α] : s.lcm f = (s.image f).lcm id :=
Eq.symm <| lcm_image _
#align finset.lcm_eq_lcm_image Finset.lcm_eq_lcm_image
| Mathlib/Algebra/GCDMonoid/Finset.lean | 123 | 125 | theorem lcm_eq_zero_iff [Nontrivial α] : s.lcm f = 0 ↔ 0 ∈ f '' s := by |
simp only [Multiset.mem_map, lcm_def, Multiset.lcm_eq_zero_iff, Set.mem_image, mem_coe, ←
Finset.mem_def]
| false |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f"
namespace PowerSeries
section Ring
variable {R S : Type*} [Ring R] [Ring S]
def invUnitsSub (u : Rˣ) : PowerSeries R :=
mk fun n => 1 /ₚ u ^ (n + 1)
#align power_series.inv_units_sub PowerSeries.invUnitsSub
@[simp]
theorem coeff_invUnitsSub (u : Rˣ) (n : ℕ) : coeff R n (invUnitsSub u) = 1 /ₚ u ^ (n + 1) :=
coeff_mk _ _
#align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub
@[simp]
theorem constantCoeff_invUnitsSub (u : Rˣ) : constantCoeff R (invUnitsSub u) = 1 /ₚ u := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one]
#align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub
@[simp]
| Mathlib/RingTheory/PowerSeries/WellKnown.lean | 52 | 55 | theorem invUnitsSub_mul_X (u : Rˣ) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by |
ext (_ | n)
· simp
· simp [n.succ_ne_zero, pow_succ']
| false |
import Mathlib.Data.ENNReal.Inv
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
section iInf
variable {ι : Sort*} {f g : ι → ℝ≥0∞}
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
theorem toNNReal_iInf (hf : ∀ i, f i ≠ ∞) : (iInf f).toNNReal = ⨅ i, (f i).toNNReal := by
cases isEmpty_or_nonempty ι
· rw [iInf_of_empty, top_toNNReal, NNReal.iInf_empty]
· lift f to ι → ℝ≥0 using hf
simp_rw [← coe_iInf, toNNReal_coe]
#align ennreal.to_nnreal_infi ENNReal.toNNReal_iInf
theorem toNNReal_sInf (s : Set ℝ≥0∞) (hs : ∀ r ∈ s, r ≠ ∞) :
(sInf s).toNNReal = sInf (ENNReal.toNNReal '' s) := by
have hf : ∀ i, ((↑) : s → ℝ≥0∞) i ≠ ∞ := fun ⟨r, rs⟩ => hs r rs
-- Porting note: `← sInf_image'` had to be replaced by `← image_eq_range` as the lemmas are used
-- in a different order.
simpa only [← sInf_range, ← image_eq_range, Subtype.range_coe_subtype] using (toNNReal_iInf hf)
#align ennreal.to_nnreal_Inf ENNReal.toNNReal_sInf
| Mathlib/Data/ENNReal/Real.lean | 556 | 561 | theorem toNNReal_iSup (hf : ∀ i, f i ≠ ∞) : (iSup f).toNNReal = ⨆ i, (f i).toNNReal := by |
lift f to ι → ℝ≥0 using hf
simp_rw [toNNReal_coe]
by_cases h : BddAbove (range f)
· rw [← coe_iSup h, toNNReal_coe]
· rw [NNReal.iSup_of_not_bddAbove h, iSup_coe_eq_top.2 h, top_toNNReal]
| false |
import Mathlib.Combinatorics.SimpleGraph.DegreeSum
import Mathlib.Combinatorics.SimpleGraph.Subgraph
#align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508"
universe u
namespace SimpleGraph
variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G)
namespace Subgraph
def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w
#align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching
noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet :=
⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩
#align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge
theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts)
(hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by
simp only [IsMatching.toEdge, Subtype.mk_eq_mk]
congr
exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm
#align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj
theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) :
Function.Surjective h.toEdge := by
rintro ⟨e, he⟩
refine Sym2.ind (fun x y he => ?_) e he
exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩
#align simple_graph.subgraph.is_matching.to_edge.surjective SimpleGraph.Subgraph.IsMatching.toEdge.surjective
| Mathlib/Combinatorics/SimpleGraph/Matching.lean | 77 | 80 | theorem IsMatching.toEdge_eq_toEdge_of_adj {M : Subgraph G} {v w : V} (h : M.IsMatching)
(hv : v ∈ M.verts) (hw : w ∈ M.verts) (ha : M.Adj v w) :
h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩ := by |
rw [h.toEdge_eq_of_adj hv ha, h.toEdge_eq_of_adj hw (M.symm ha), Subtype.mk_eq_mk, Sym2.eq_swap]
| false |
import Mathlib.SetTheory.Ordinal.Arithmetic
import Mathlib.SetTheory.Ordinal.Exponential
#align_import set_theory.ordinal.cantor_normal_form from "leanprover-community/mathlib"@"991ff3b5269848f6dd942ae8e9dd3c946035dc8b"
noncomputable section
universe u
open List
namespace Ordinal
@[elab_as_elim]
noncomputable def CNFRec (b : Ordinal) {C : Ordinal → Sort*} (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : ∀ o, C o := fun o ↦ by
by_cases h : o = 0
· rw [h]; exact H0
· exact H o h (CNFRec _ H0 H (o % b ^ log b o))
termination_by o => o
decreasing_by exact mod_opow_log_lt_self b h
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec Ordinal.CNFRec
@[simp]
theorem CNFRec_zero {C : Ordinal → Sort*} (b : Ordinal) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) : @CNFRec b C H0 H 0 = H0 := by
rw [CNFRec, dif_pos rfl]
rfl
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_zero Ordinal.CNFRec_zero
theorem CNFRec_pos (b : Ordinal) {o : Ordinal} {C : Ordinal → Sort*} (ho : o ≠ 0) (H0 : C 0)
(H : ∀ o, o ≠ 0 → C (o % b ^ log b o) → C o) :
@CNFRec b C H0 H o = H o ho (@CNFRec b C H0 H _) := by rw [CNFRec, dif_neg ho]
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_rec_pos Ordinal.CNFRec_pos
-- Porting note: unknown attribute @[pp_nodot]
def CNF (b o : Ordinal) : List (Ordinal × Ordinal) :=
CNFRec b [] (fun o _ho IH ↦ (log b o, o / b ^ log b o)::IH) o
set_option linter.uppercaseLean3 false in
#align ordinal.CNF Ordinal.CNF
@[simp]
theorem CNF_zero (b : Ordinal) : CNF b 0 = [] :=
CNFRec_zero b _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_zero Ordinal.CNF_zero
theorem CNF_ne_zero {b o : Ordinal} (ho : o ≠ 0) :
CNF b o = (log b o, o / b ^ log b o)::CNF b (o % b ^ log b o) :=
CNFRec_pos b ho _ _
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_ne_zero Ordinal.CNF_ne_zero
theorem zero_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 0 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
set_option linter.uppercaseLean3 false in
#align ordinal.zero_CNF Ordinal.zero_CNF
theorem one_CNF {o : Ordinal} (ho : o ≠ 0) : CNF 1 o = [⟨0, o⟩] := by simp [CNF_ne_zero ho]
set_option linter.uppercaseLean3 false in
#align ordinal.one_CNF Ordinal.one_CNF
theorem CNF_of_le_one {b o : Ordinal} (hb : b ≤ 1) (ho : o ≠ 0) : CNF b o = [⟨0, o⟩] := by
rcases le_one_iff.1 hb with (rfl | rfl)
· exact zero_CNF ho
· exact one_CNF ho
set_option linter.uppercaseLean3 false in
#align ordinal.CNF_of_le_one Ordinal.CNF_of_le_one
| Mathlib/SetTheory/Ordinal/CantorNormalForm.lean | 108 | 109 | theorem CNF_of_lt {b o : Ordinal} (ho : o ≠ 0) (hb : o < b) : CNF b o = [⟨0, o⟩] := by |
simp only [CNF_ne_zero ho, log_eq_zero hb, opow_zero, div_one, mod_one, CNF_zero]
| false |
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
variable {𝕜 : Type*} [RCLike 𝕜]
variable {n : Type*} [LinearOrder n] [IsWellOrder n (· < ·)] [LocallyFiniteOrderBot n]
section set_options
set_option linter.uppercaseLean3 false
set_option quotPrecheck false
local notation "⟪" x ", " y "⟫ₑ" =>
@inner 𝕜 _ _ ((WithLp.equiv 2 _).symm x) ((WithLp.equiv _ _).symm y)
open Matrix
open scoped Matrix ComplexOrder
variable {S : Matrix n n 𝕜} [Fintype n] (hS : S.PosDef)
noncomputable def LDL.lowerInv : Matrix n n 𝕜 :=
@gramSchmidt 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun 𝕜 n)
#align LDL.lower_inv LDL.lowerInv
theorem LDL.lowerInv_eq_gramSchmidtBasis :
LDL.lowerInv hS =
((Pi.basisFun 𝕜 n).toMatrix
(@gramSchmidtBasis 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun 𝕜 n)))ᵀ := by
letI := NormedAddCommGroup.ofMatrix hS.transpose
letI := InnerProductSpace.ofMatrix hS.transpose
ext i j
rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
#align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis
noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) := by
rw [LDL.lowerInv_eq_gramSchmidtBasis]
haveI :=
Basis.invertibleToMatrix (Pi.basisFun 𝕜 n)
(@gramSchmidtBasis 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun 𝕜 n))
infer_instance
#align LDL.invertible_lower_inv LDL.invertibleLowerInv
theorem LDL.lowerInv_orthogonal {i j : n} (h₀ : i ≠ j) :
⟪LDL.lowerInv hS i, Sᵀ *ᵥ LDL.lowerInv hS j⟫ₑ = 0 :=
@gramSchmidt_orthogonal 𝕜 _ _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) _ _ _ _ _ _ _ h₀
#align LDL.lower_inv_orthogonal LDL.lowerInv_orthogonal
noncomputable def LDL.diagEntries : n → 𝕜 := fun i =>
⟪star (LDL.lowerInv hS i), S *ᵥ star (LDL.lowerInv hS i)⟫ₑ
#align LDL.diag_entries LDL.diagEntries
noncomputable def LDL.diag : Matrix n n 𝕜 :=
Matrix.diagonal (LDL.diagEntries hS)
#align LDL.diag LDL.diag
theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j = 0 := by
rw [←
@gramSchmidt_triangular 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
i j hij (Pi.basisFun 𝕜 n),
Pi.basisFun_repr, LDL.lowerInv]
#align LDL.lower_inv_triangular LDL.lowerInv_triangular
theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS * S * (LDL.lowerInv hS)ᴴ := by
ext i j
by_cases hij : i = j
· simp only [diag, diagEntries, EuclideanSpace.inner_piLp_equiv_symm, star_star, hij,
diagonal_apply_eq, Matrix.mul_assoc]
rfl
· simp only [LDL.diag, hij, diagonal_apply_ne, Ne, not_false_iff, mul_mul_apply]
rw [conjTranspose, transpose_map, transpose_transpose, dotProduct_mulVec,
(LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, ← inner_conj_symm,
mulVec_transpose, EuclideanSpace.inner_piLp_equiv_symm, ← RCLike.star_def, ←
star_dotProduct_star, dotProduct_comm, star_star]
rfl
#align LDL.diag_eq_lower_inv_conj LDL.diag_eq_lowerInv_conj
noncomputable def LDL.lower :=
(LDL.lowerInv hS)⁻¹
#align LDL.lower LDL.lower
| Mathlib/LinearAlgebra/Matrix/LDL.lean | 123 | 127 | theorem LDL.lower_conj_diag : LDL.lower hS * LDL.diag hS * (LDL.lower hS)ᴴ = S := by |
rw [LDL.lower, conjTranspose_nonsing_inv, Matrix.mul_assoc,
Matrix.inv_mul_eq_iff_eq_mul_of_invertible (LDL.lowerInv hS),
Matrix.mul_inv_eq_iff_eq_mul_of_invertible]
exact LDL.diag_eq_lowerInv_conj hS
| false |
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathlib.LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
variable {𝕜 : Type*} [RCLike 𝕜]
variable {n : Type*} [LinearOrder n] [IsWellOrder n (· < ·)] [LocallyFiniteOrderBot n]
section set_options
set_option linter.uppercaseLean3 false
set_option quotPrecheck false
local notation "⟪" x ", " y "⟫ₑ" =>
@inner 𝕜 _ _ ((WithLp.equiv 2 _).symm x) ((WithLp.equiv _ _).symm y)
open Matrix
open scoped Matrix ComplexOrder
variable {S : Matrix n n 𝕜} [Fintype n] (hS : S.PosDef)
noncomputable def LDL.lowerInv : Matrix n n 𝕜 :=
@gramSchmidt 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun 𝕜 n)
#align LDL.lower_inv LDL.lowerInv
| Mathlib/LinearAlgebra/Matrix/LDL.lean | 57 | 66 | theorem LDL.lowerInv_eq_gramSchmidtBasis :
LDL.lowerInv hS =
((Pi.basisFun 𝕜 n).toMatrix
(@gramSchmidtBasis 𝕜 (n → 𝕜) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun 𝕜 n)))ᵀ := by |
letI := NormedAddCommGroup.ofMatrix hS.transpose
letI := InnerProductSpace.ofMatrix hS.transpose
ext i j
rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
| false |
import Mathlib.Data.Complex.Basic
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.circle_transform from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open Set MeasureTheory Metric Filter Function
open scoped Interval Real
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] (R : ℝ) (z w : ℂ)
namespace Complex
def circleTransform (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • (circleMap z R θ - w)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform Complex.circleTransform
def circleTransformDeriv (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ - w) ^ 2)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform_deriv Complex.circleTransformDeriv
| Mathlib/MeasureTheory/Integral/CircleTransform.lean | 48 | 55 | theorem circleTransformDeriv_periodic (f : ℂ → E) :
Periodic (circleTransformDeriv R z w f) (2 * π) := by |
have := periodic_circleMap
simp_rw [Periodic] at *
intro x
simp_rw [circleTransformDeriv, this]
congr 2
simp [this]
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.