Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | goals listlengths 0 224 | goals_before listlengths 0 220 |
|---|---|---|---|---|---|---|---|
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.MeasureTheory.Integral.Layercake
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
#align_import measure_theory.measure.portmanteau from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open MeasureTheory Set Filter BoundedContinuousFunction
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
section LimsupClosedLEAndLELiminfOpen
variable {Ω : Type*} [MeasurableSpace Ω]
theorem le_measure_compl_liminf_of_limsup_measure_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i E) ≤ μ E) :
μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ := by
rcases L.eq_or_neBot with rfl | hne
· simp only [liminf_bot, le_top]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
have obs :
(L.liminf fun i : ι => 1 - μs i E) = L.liminf ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl
rw [obs]
have := antitone_const_tsub.map_limsup_of_continuousAt (F := L)
(fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simp_rw [← this]
exact antitone_const_tsub h
#align measure_theory.le_measure_compl_liminf_of_limsup_measure_le MeasureTheory.le_measure_compl_liminf_of_limsup_measure_le
theorem le_measure_liminf_of_limsup_measure_compl_le {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : (L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ) :
μ E ≤ L.liminf fun i => μs i E :=
compl_compl E ▸ le_measure_compl_liminf_of_limsup_measure_le (MeasurableSet.compl E_mble) h
#align measure_theory.le_measure_liminf_of_limsup_measure_compl_le MeasureTheory.le_measure_liminf_of_limsup_measure_compl_le
theorem limsup_measure_compl_le_of_le_liminf_measure {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : μ E ≤ L.liminf fun i => μs i E) :
(L.limsup fun i => μs i Eᶜ) ≤ μ Eᶜ := by
rcases L.eq_or_neBot with rfl | hne
· simp only [limsup_bot, bot_le]
have meas_Ec : μ Eᶜ = 1 - μ E := by
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top μ E).ne
have meas_i_Ec : ∀ i, μs i Eᶜ = 1 - μs i E := by
intro i
simpa only [measure_univ] using measure_compl E_mble (measure_lt_top (μs i) E).ne
simp_rw [meas_Ec, meas_i_Ec]
have obs :
(L.limsup fun i : ι => 1 - μs i E) = L.limsup ((fun x => 1 - x) ∘ fun i : ι => μs i E) := rfl
rw [obs]
have := antitone_const_tsub.map_liminf_of_continuousAt (F := L)
(fun i => μs i E) (ENNReal.continuous_sub_left ENNReal.one_ne_top).continuousAt
simp_rw [← this]
exact antitone_const_tsub h
#align measure_theory.limsup_measure_compl_le_of_le_liminf_measure MeasureTheory.limsup_measure_compl_le_of_le_liminf_measure
theorem limsup_measure_le_of_le_liminf_measure_compl {ι : Type*} {L : Filter ι} {μ : Measure Ω}
{μs : ι → Measure Ω} [IsProbabilityMeasure μ] [∀ i, IsProbabilityMeasure (μs i)] {E : Set Ω}
(E_mble : MeasurableSet E) (h : μ Eᶜ ≤ L.liminf fun i => μs i Eᶜ) :
(L.limsup fun i => μs i E) ≤ μ E :=
compl_compl E ▸ limsup_measure_compl_le_of_le_liminf_measure (MeasurableSet.compl E_mble) h
#align measure_theory.limsup_measure_le_of_le_liminf_measure_compl MeasureTheory.limsup_measure_le_of_le_liminf_measure_compl
variable [TopologicalSpace Ω] [OpensMeasurableSpace Ω]
| Mathlib/MeasureTheory/Measure/Portmanteau.lean | 172 | 183 | theorem limsup_measure_closed_le_iff_liminf_measure_open_ge {ι : Type*} {L : Filter ι}
{μ : Measure Ω} {μs : ι → Measure Ω} [IsProbabilityMeasure μ]
[∀ i, IsProbabilityMeasure (μs i)] :
(∀ F, IsClosed F → (L.limsup fun i => μs i F) ≤ μ F) ↔
∀ G, IsOpen G → μ G ≤ L.liminf fun i => μs i G := by |
constructor
· intro h G G_open
exact le_measure_liminf_of_limsup_measure_compl_le
G_open.measurableSet (h Gᶜ (isClosed_compl_iff.mpr G_open))
· intro h F F_closed
exact limsup_measure_le_of_le_liminf_measure_compl
F_closed.measurableSet (h Fᶜ (isOpen_compl_iff.mpr F_closed))
| [
" μ Eᶜ ≤ liminf (fun i => (μs i) Eᶜ) L",
" μ Eᶜ ≤ liminf (fun i => (μs i) Eᶜ) ⊥",
" μ Eᶜ = 1 - μ E",
" ∀ (i : ι), (μs i) Eᶜ = 1 - (μs i) E",
" (μs i) Eᶜ = 1 - (μs i) E",
" 1 - μ E ≤ liminf (fun i => 1 - (μs i) E) L",
" 1 - μ E ≤ liminf ((fun x => 1 - x) ∘ fun i => (μs i) E) L",
" 1 - μ E ≤ 1 - limsup ... | [
" μ Eᶜ ≤ liminf (fun i => (μs i) Eᶜ) L",
" μ Eᶜ ≤ liminf (fun i => (μs i) Eᶜ) ⊥",
" μ Eᶜ = 1 - μ E",
" ∀ (i : ι), (μs i) Eᶜ = 1 - (μs i) E",
" (μs i) Eᶜ = 1 - (μs i) E",
" 1 - μ E ≤ liminf (fun i => 1 - (μs i) E) L",
" 1 - μ E ≤ liminf ((fun x => 1 - x) ∘ fun i => (μs i) E) L",
" 1 - μ E ≤ 1 - limsup ... |
import Mathlib.Algebra.Group.Fin
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import linear_algebra.matrix.circulant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
variable {α β m n R : Type*}
namespace Matrix
open Function
open Matrix
def circulant [Sub n] (v : n → α) : Matrix n n α :=
of fun i j => v (i - j)
#align matrix.circulant Matrix.circulant
-- TODO: set as an equation lemma for `circulant`, see mathlib4#3024
@[simp]
theorem circulant_apply [Sub n] (v : n → α) (i j) : circulant v i j = v (i - j) := rfl
#align matrix.circulant_apply Matrix.circulant_apply
theorem circulant_col_zero_eq [AddGroup n] (v : n → α) (i : n) : circulant v i 0 = v i :=
congr_arg v (sub_zero _)
#align matrix.circulant_col_zero_eq Matrix.circulant_col_zero_eq
theorem circulant_injective [AddGroup n] : Injective (circulant : (n → α) → Matrix n n α) := by
intro v w h
ext k
rw [← circulant_col_zero_eq v, ← circulant_col_zero_eq w, h]
#align matrix.circulant_injective Matrix.circulant_injective
theorem Fin.circulant_injective : ∀ n, Injective fun v : Fin n → α => circulant v
| 0 => by simp [Injective]
| n + 1 => Matrix.circulant_injective
#align matrix.fin.circulant_injective Matrix.Fin.circulant_injective
@[simp]
theorem circulant_inj [AddGroup n] {v w : n → α} : circulant v = circulant w ↔ v = w :=
circulant_injective.eq_iff
#align matrix.circulant_inj Matrix.circulant_inj
@[simp]
theorem Fin.circulant_inj {n} {v w : Fin n → α} : circulant v = circulant w ↔ v = w :=
(Fin.circulant_injective n).eq_iff
#align matrix.fin.circulant_inj Matrix.Fin.circulant_inj
theorem transpose_circulant [AddGroup n] (v : n → α) :
(circulant v)ᵀ = circulant fun i => v (-i) := by ext; simp
#align matrix.transpose_circulant Matrix.transpose_circulant
theorem conjTranspose_circulant [Star α] [AddGroup n] (v : n → α) :
(circulant v)ᴴ = circulant (star fun i => v (-i)) := by ext; simp
#align matrix.conj_transpose_circulant Matrix.conjTranspose_circulant
theorem Fin.transpose_circulant : ∀ {n} (v : Fin n → α), (circulant v)ᵀ = circulant fun i => v (-i)
| 0 => by simp [Injective, eq_iff_true_of_subsingleton]
| n + 1 => Matrix.transpose_circulant
#align matrix.fin.transpose_circulant Matrix.Fin.transpose_circulant
theorem Fin.conjTranspose_circulant [Star α] :
∀ {n} (v : Fin n → α), (circulant v)ᴴ = circulant (star fun i => v (-i))
| 0 => by simp [Injective, eq_iff_true_of_subsingleton]
| n + 1 => Matrix.conjTranspose_circulant
#align matrix.fin.conj_transpose_circulant Matrix.Fin.conjTranspose_circulant
theorem map_circulant [Sub n] (v : n → α) (f : α → β) :
(circulant v).map f = circulant fun i => f (v i) :=
ext fun _ _ => rfl
#align matrix.map_circulant Matrix.map_circulant
theorem circulant_neg [Neg α] [Sub n] (v : n → α) : circulant (-v) = -circulant v :=
ext fun _ _ => rfl
#align matrix.circulant_neg Matrix.circulant_neg
@[simp]
theorem circulant_zero (α n) [Zero α] [Sub n] : circulant 0 = (0 : Matrix n n α) :=
ext fun _ _ => rfl
#align matrix.circulant_zero Matrix.circulant_zero
theorem circulant_add [Add α] [Sub n] (v w : n → α) :
circulant (v + w) = circulant v + circulant w :=
ext fun _ _ => rfl
#align matrix.circulant_add Matrix.circulant_add
theorem circulant_sub [Sub α] [Sub n] (v w : n → α) :
circulant (v - w) = circulant v - circulant w :=
ext fun _ _ => rfl
#align matrix.circulant_sub Matrix.circulant_sub
theorem circulant_mul [Semiring α] [Fintype n] [AddGroup n] (v w : n → α) :
circulant v * circulant w = circulant (circulant v *ᵥ w) := by
ext i j
simp only [mul_apply, mulVec, circulant_apply, dotProduct]
refine Fintype.sum_equiv (Equiv.subRight j) _ _ ?_
intro x
simp only [Equiv.subRight_apply, sub_sub_sub_cancel_right]
#align matrix.circulant_mul Matrix.circulant_mul
theorem Fin.circulant_mul [Semiring α] :
∀ {n} (v w : Fin n → α), circulant v * circulant w = circulant (circulant v *ᵥ w)
| 0 => by simp [Injective, eq_iff_true_of_subsingleton]
| n + 1 => Matrix.circulant_mul
#align matrix.fin.circulant_mul Matrix.Fin.circulant_mul
theorem circulant_mul_comm [CommSemigroup α] [AddCommMonoid α] [Fintype n] [AddCommGroup n]
(v w : n → α) : circulant v * circulant w = circulant w * circulant v := by
ext i j
simp only [mul_apply, circulant_apply, mul_comm]
refine Fintype.sum_equiv ((Equiv.subLeft i).trans (Equiv.addRight j)) _ _ ?_
intro x
simp only [Equiv.trans_apply, Equiv.subLeft_apply, Equiv.coe_addRight, add_sub_cancel_right,
mul_comm]
congr 2
abel
#align matrix.circulant_mul_comm Matrix.circulant_mul_comm
theorem Fin.circulant_mul_comm [CommSemigroup α] [AddCommMonoid α] :
∀ {n} (v w : Fin n → α), circulant v * circulant w = circulant w * circulant v
| 0 => by simp [Injective]
| n + 1 => Matrix.circulant_mul_comm
#align matrix.fin.circulant_mul_comm Matrix.Fin.circulant_mul_comm
theorem circulant_smul [Sub n] [SMul R α] (k : R) (v : n → α) :
circulant (k • v) = k • circulant v := rfl
#align matrix.circulant_smul Matrix.circulant_smul
@[simp]
| Mathlib/LinearAlgebra/Matrix/Circulant.lean | 166 | 169 | theorem circulant_single_one (α n) [Zero α] [One α] [DecidableEq n] [AddGroup n] :
circulant (Pi.single 0 1 : n → α) = (1 : Matrix n n α) := by |
ext i j
simp [one_apply, Pi.single_apply, sub_eq_zero]
| [
" Injective circulant",
" v = w",
" v k = w k",
" Injective fun v => circulant v",
" (circulant v)ᵀ = circulant fun i => v (-i)",
" (circulant v)ᵀ i✝ j✝ = circulant (fun i => v (-i)) i✝ j✝",
" (circulant v)ᴴ = circulant (star fun i => v (-i))",
" (circulant v)ᴴ i✝ j✝ = circulant (star fun i => v (-i))... | [
" Injective circulant",
" v = w",
" v k = w k",
" Injective fun v => circulant v",
" (circulant v)ᵀ = circulant fun i => v (-i)",
" (circulant v)ᵀ i✝ j✝ = circulant (fun i => v (-i)) i✝ j✝",
" (circulant v)ᴴ = circulant (star fun i => v (-i))",
" (circulant v)ᴴ i✝ j✝ = circulant (star fun i => v (-i))... |
import Mathlib.RingTheory.EisensteinCriterion
import Mathlib.RingTheory.Polynomial.ScaleRoots
#align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973"
universe u v w z
variable {R : Type u}
open Ideal Algebra Finset
open Polynomial
namespace Polynomial
@[mk_iff]
structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where
mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
#align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt
@[mk_iff]
structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where
leading : f.leadingCoeff ∉ 𝓟
mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
not_mem : f.coeff 0 ∉ 𝓟 ^ 2
#align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt
namespace IsWeaklyEisensteinAt
section CommRing
variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
variable {S : Type v} [CommRing S] [Algebra R S]
-- Porting note: `Ideal.neg_mem_iff` was `neg_mem_iff` on line 142 but Lean was not able to find
-- NegMemClass
| Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean | 128 | 138 | theorem pow_natDegree_le_of_root_of_monic_mem {x : R} (hroot : IsRoot f x) (hmo : f.Monic) :
∀ i, f.natDegree ≤ i → x ^ i ∈ 𝓟 := by |
intro i hi
obtain ⟨k, hk⟩ := exists_add_of_le hi
rw [hk, pow_add]
suffices x ^ f.natDegree ∈ 𝓟 by exact mul_mem_right (x ^ k) 𝓟 this
rw [IsRoot.def, eval_eq_sum_range, Finset.range_add_one,
Finset.sum_insert Finset.not_mem_range_self, Finset.sum_range, hmo.coeff_natDegree, one_mul] at
*
rw [eq_neg_of_add_eq_zero_left hroot, Ideal.neg_mem_iff]
exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
| [
" ∀ (i : ℕ), f.natDegree ≤ i → x ^ i ∈ 𝓟",
" x ^ i ∈ 𝓟",
" x ^ f.natDegree * x ^ k ∈ 𝓟",
" x ^ f.natDegree ∈ 𝓟",
" ∑ i : Fin f.natDegree, f.coeff ↑i * x ^ ↑i ∈ 𝓟"
] | [] |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.MeasureTheory.Integral.DominatedConvergence
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual
#align_import analysis.calculus.parametric_integral from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
open TopologicalSpace MeasureTheory Filter Metric
open scoped Topology Filter
variable {α : Type*} [MeasurableSpace α] {μ : Measure α} {𝕜 : Type*} [RCLike 𝕜] {E : Type*}
[NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace 𝕜 E] {H : Type*}
[NormedAddCommGroup H] [NormedSpace 𝕜 H]
variable {F : H → α → E} {x₀ : H} {bound : α → ℝ} {ε : ℝ}
| Mathlib/Analysis/Calculus/ParametricIntegral.lean | 75 | 155 | theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] E} (ε_pos : 0 < ε)
(hF_meas : ∀ x ∈ ball x₀ ε, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ)
(hF'_meas : AEStronglyMeasurable F' μ)
(h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖)
(bound_integrable : Integrable (bound : α → ℝ) μ)
(h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) :
Integrable F' μ ∧ HasFDerivAt (fun x ↦ ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by |
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos
have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x ↦ inv_nonneg.mpr (norm_nonneg _)
set b : α → ℝ := fun a ↦ |bound a|
have b_int : Integrable b μ := bound_integrable.norm
have b_nonneg : ∀ a, 0 ≤ b a := fun a ↦ abs_nonneg _
replace h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ :=
h_lipsch.mono fun a ha x hx ↦
(ha x hx).trans <| mul_le_mul_of_nonneg_right (le_abs_self _) (norm_nonneg _)
have hF_int' : ∀ x ∈ ball x₀ ε, Integrable (F x) μ := fun x x_in ↦ by
have : ∀ᵐ a ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a := by
simp only [norm_sub_rev (F x₀ _)]
refine h_lipsch.mono fun a ha ↦ (ha x x_in).trans ?_
rw [mul_comm ε]
rw [mem_ball, dist_eq_norm] at x_in
exact mul_le_mul_of_nonneg_left x_in.le (b_nonneg _)
exact integrable_of_norm_sub_le (hF_meas x x_in) hF_int
(bound_integrable.norm.const_mul ε) this
have hF'_int : Integrable F' μ :=
have : ∀ᵐ a ∂μ, ‖F' a‖ ≤ b a := by
apply (h_diff.and h_lipsch).mono
rintro a ⟨ha_diff, ha_lip⟩
exact ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip)
b_int.mono' hF'_meas this
refine ⟨hF'_int, ?_⟩
/- Discard the trivial case where `E` is not complete, as all integrals vanish. -/
by_cases hE : CompleteSpace E; swap
· rcases subsingleton_or_nontrivial H with hH|hH
· have : Subsingleton (H →L[𝕜] E) := inferInstance
convert hasFDerivAt_of_subsingleton _ x₀
· have : ¬(CompleteSpace (H →L[𝕜] E)) := by
simpa [SeparatingDual.completeSpace_continuousLinearMap_iff] using hE
simp only [integral, hE, ↓reduceDite, this]
exact hasFDerivAt_const 0 x₀
have h_ball : ball x₀ ε ∈ 𝓝 x₀ := ball_mem_nhds x₀ ε_pos
have : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖⁻¹ * ‖((∫ a, F x a ∂μ) - ∫ a, F x₀ a ∂μ) - (∫ a, F' a ∂μ) (x - x₀)‖ =
‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by
apply mem_of_superset (ball_mem_nhds _ ε_pos)
intro x x_in; simp only
rw [Set.mem_setOf_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, integral_sub,
← ContinuousLinearMap.integral_apply hF'_int]
exacts [hF_int' x x_in, hF_int, (hF_int' x x_in).sub hF_int,
hF'_int.apply_continuousLinearMap _]
rw [hasFDerivAt_iff_tendsto, tendsto_congr' this, ← tendsto_zero_iff_norm_tendsto_zero, ←
show (∫ a : α, ‖x₀ - x₀‖⁻¹ • (F x₀ a - F x₀ a - (F' a) (x₀ - x₀)) ∂μ) = 0 by simp]
apply tendsto_integral_filter_of_dominated_convergence
· filter_upwards [h_ball] with _ x_in
apply AEStronglyMeasurable.const_smul
exact ((hF_meas _ x_in).sub (hF_meas _ x₀_in)).sub (hF'_meas.apply_continuousLinearMap _)
· refine mem_of_superset h_ball fun x hx ↦ ?_
apply (h_diff.and h_lipsch).mono
on_goal 1 => rintro a ⟨-, ha_bound⟩
show ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ ≤ b a + ‖F' a‖
replace ha_bound : ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := ha_bound x hx
calc
‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ =
‖‖x - x₀‖⁻¹ • (F x a - F x₀ a) - ‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := by rw [smul_sub]
_ ≤ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a)‖ + ‖‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := norm_sub_le _ _
_ = ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a‖ + ‖x - x₀‖⁻¹ * ‖F' a (x - x₀)‖ := by
rw [norm_smul_of_nonneg, norm_smul_of_nonneg] <;> exact nneg _
_ ≤ ‖x - x₀‖⁻¹ * (b a * ‖x - x₀‖) + ‖x - x₀‖⁻¹ * (‖F' a‖ * ‖x - x₀‖) := by
gcongr; exact (F' a).le_opNorm _
_ ≤ b a + ‖F' a‖ := ?_
simp only [← div_eq_inv_mul]
apply_rules [add_le_add, div_le_of_nonneg_of_le_mul] <;> first | rfl | positivity
· exact b_int.add hF'_int.norm
· apply h_diff.mono
intro a ha
suffices Tendsto (fun x ↦ ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa
rw [tendsto_zero_iff_norm_tendsto_zero]
have : (fun x ↦ ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x ↦
‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ := by
ext x
rw [norm_smul_of_nonneg (nneg _)]
rwa [hasFDerivAt_iff_tendsto, this] at ha
| [
" Integrable F' μ ∧ HasFDerivAt (fun x => ∫ (a : α), F x a ∂μ) (∫ (a : α), F' a ∂μ) x₀",
" Integrable (F x) μ",
" ∀ᵐ (a : α) ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a",
" ∀ᵐ (a : α) ∂μ, ‖F x a - F x₀ a‖ ≤ ε * b a",
" b a * ‖x - x₀‖ ≤ ε * b a",
" b a * ‖x - x₀‖ ≤ b a * ε",
" ∀ᵐ (a : α) ∂μ, ‖F' a‖ ≤ b a",
" ∀ (x :... | [] |
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.MeasureTheory.Function.SimpleFuncDense
#align_import measure_theory.function.simple_func_dense_lp from "leanprover-community/mathlib"@"5a2df4cd59cb31e97a516d4603a14bed5c2f9425"
noncomputable section
set_option linter.uppercaseLean3 false
open Set Function Filter TopologicalSpace ENNReal EMetric Finset
open scoped Classical Topology ENNReal MeasureTheory
variable {α β ι E F 𝕜 : Type*}
namespace MeasureTheory
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
section SimpleFuncProperties
variable [MeasurableSpace α]
variable [NormedAddCommGroup E] [NormedAddCommGroup F]
variable {μ : Measure α} {p : ℝ≥0∞}
theorem exists_forall_norm_le (f : α →ₛ F) : ∃ C, ∀ x, ‖f x‖ ≤ C :=
exists_forall_le (f.map fun x => ‖x‖)
#align measure_theory.simple_func.exists_forall_norm_le MeasureTheory.SimpleFunc.exists_forall_norm_le
theorem memℒp_zero (f : α →ₛ E) (μ : Measure α) : Memℒp f 0 μ :=
memℒp_zero_iff_aestronglyMeasurable.mpr f.aestronglyMeasurable
#align measure_theory.simple_func.mem_ℒp_zero MeasureTheory.SimpleFunc.memℒp_zero
theorem memℒp_top (f : α →ₛ E) (μ : Measure α) : Memℒp f ∞ μ :=
let ⟨C, hfC⟩ := f.exists_forall_norm_le
memℒp_top_of_bound f.aestronglyMeasurable C <| eventually_of_forall hfC
#align measure_theory.simple_func.mem_ℒp_top MeasureTheory.SimpleFunc.memℒp_top
protected theorem snorm'_eq {p : ℝ} (f : α →ₛ F) (μ : Measure α) :
snorm' f p μ = (∑ y ∈ f.range, (‖y‖₊ : ℝ≥0∞) ^ p * μ (f ⁻¹' {y})) ^ (1 / p) := by
have h_map : (fun a => (‖f a‖₊ : ℝ≥0∞) ^ p) = f.map fun a : F => (‖a‖₊ : ℝ≥0∞) ^ p := by
simp; rfl
rw [snorm', h_map, lintegral_eq_lintegral, map_lintegral]
#align measure_theory.simple_func.snorm'_eq MeasureTheory.SimpleFunc.snorm'_eq
theorem measure_preimage_lt_top_of_memℒp (hp_pos : p ≠ 0) (hp_ne_top : p ≠ ∞) (f : α →ₛ E)
(hf : Memℒp f p μ) (y : E) (hy_ne : y ≠ 0) : μ (f ⁻¹' {y}) < ∞ := by
have hp_pos_real : 0 < p.toReal := ENNReal.toReal_pos hp_pos hp_ne_top
have hf_snorm := Memℒp.snorm_lt_top hf
rw [snorm_eq_snorm' hp_pos hp_ne_top, f.snorm'_eq, ←
@ENNReal.lt_rpow_one_div_iff _ _ (1 / p.toReal) (by simp [hp_pos_real]),
@ENNReal.top_rpow_of_pos (1 / (1 / p.toReal)) (by simp [hp_pos_real]),
ENNReal.sum_lt_top_iff] at hf_snorm
by_cases hyf : y ∈ f.range
swap
· suffices h_empty : f ⁻¹' {y} = ∅ by
rw [h_empty, measure_empty]; exact ENNReal.coe_lt_top
ext1 x
rw [Set.mem_preimage, Set.mem_singleton_iff, mem_empty_iff_false, iff_false_iff]
refine fun hxy => hyf ?_
rw [mem_range, Set.mem_range]
exact ⟨x, hxy⟩
specialize hf_snorm y hyf
rw [ENNReal.mul_lt_top_iff] at hf_snorm
cases hf_snorm with
| inl hf_snorm => exact hf_snorm.2
| inr hf_snorm =>
cases hf_snorm with
| inl hf_snorm =>
refine absurd ?_ hy_ne
simpa [hp_pos_real] using hf_snorm
| inr hf_snorm => simp [hf_snorm]
#align measure_theory.simple_func.measure_preimage_lt_top_of_mem_ℒp MeasureTheory.SimpleFunc.measure_preimage_lt_top_of_memℒp
| Mathlib/MeasureTheory/Function/SimpleFuncDenseLp.lean | 325 | 337 | theorem memℒp_of_finite_measure_preimage (p : ℝ≥0∞) {f : α →ₛ E}
(hf : ∀ y, y ≠ 0 → μ (f ⁻¹' {y}) < ∞) : Memℒp f p μ := by |
by_cases hp0 : p = 0
· rw [hp0, memℒp_zero_iff_aestronglyMeasurable]; exact f.aestronglyMeasurable
by_cases hp_top : p = ∞
· rw [hp_top]; exact memℒp_top f μ
refine ⟨f.aestronglyMeasurable, ?_⟩
rw [snorm_eq_snorm' hp0 hp_top, f.snorm'_eq]
refine ENNReal.rpow_lt_top_of_nonneg (by simp) (ENNReal.sum_lt_top_iff.mpr fun y _ => ?_).ne
by_cases hy0 : y = 0
· simp [hy0, ENNReal.toReal_pos hp0 hp_top]
· refine ENNReal.mul_lt_top ?_ (hf y hy0).ne
exact (ENNReal.rpow_lt_top_of_nonneg ENNReal.toReal_nonneg ENNReal.coe_ne_top).ne
| [
" snorm' (↑f) p μ = (∑ y ∈ f.range, ↑‖y‖₊ ^ p * μ (↑f ⁻¹' {y})) ^ (1 / p)",
" (fun a => ↑‖↑f a‖₊ ^ p) = ↑(map (fun a => ↑‖a‖₊ ^ p) f)",
" (fun a => ↑‖↑f a‖₊ ^ p) = (fun a => ↑‖a‖₊ ^ p) ∘ ↑f",
" μ (↑f ⁻¹' {y}) < ⊤",
" 0 < 1 / p.toReal",
" 0 < 1 / (1 / p.toReal)",
" 0 < ⊤",
" ↑f ⁻¹' {y} = ∅",
" x ∈ ↑f... | [
" snorm' (↑f) p μ = (∑ y ∈ f.range, ↑‖y‖₊ ^ p * μ (↑f ⁻¹' {y})) ^ (1 / p)",
" (fun a => ↑‖↑f a‖₊ ^ p) = ↑(map (fun a => ↑‖a‖₊ ^ p) f)",
" (fun a => ↑‖↑f a‖₊ ^ p) = (fun a => ↑‖a‖₊ ^ p) ∘ ↑f",
" μ (↑f ⁻¹' {y}) < ⊤",
" 0 < 1 / p.toReal",
" 0 < 1 / (1 / p.toReal)",
" 0 < ⊤",
" ↑f ⁻¹' {y} = ∅",
" x ∈ ↑f... |
import Mathlib.LinearAlgebra.Span
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Ideal.QuotientOperations
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M]
def IsAssociatedPrime : Prop :=
I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator
#align is_associated_prime IsAssociatedPrime
variable (R)
def associatedPrimes : Set (Ideal R) :=
{ I | IsAssociatedPrime I M }
#align associated_primes associatedPrimes
variable {I J M R}
variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M')
theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl
#align associate_primes.mem_iff AssociatePrimes.mem_iff
theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1
#align is_associated_prime.is_prime IsAssociatedPrime.isPrime
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) :
IsAssociatedPrime I M' := by
obtain ⟨x, rfl⟩ := h.2
refine ⟨h.1, ⟨f x, ?_⟩⟩
ext r
rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ←
map_smul, ← f.map_zero, hf.eq_iff]
#align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective
theorem LinearEquiv.isAssociatedPrime_iff (l : M ≃ₗ[R] M') :
IsAssociatedPrime I M ↔ IsAssociatedPrime I M' :=
⟨fun h => h.map_of_injective l l.injective,
fun h => h.map_of_injective l.symm l.symm.injective⟩
#align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
| Mathlib/RingTheory/Ideal/AssociatedPrime.lean | 74 | 78 | theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : ¬IsAssociatedPrime I M := by |
rintro ⟨hI, x, hx⟩
apply hI.ne_top
rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot]
at hx
| [
" IsAssociatedPrime I M'",
" IsAssociatedPrime (Submodule.span R {x}).annihilator M'",
" (Submodule.span R {x}).annihilator = (Submodule.span R {f x}).annihilator",
" r ∈ (Submodule.span R {x}).annihilator ↔ r ∈ (Submodule.span R {f x}).annihilator",
" ¬IsAssociatedPrime I M",
" False",
" I = ⊤"
] | [
" IsAssociatedPrime I M'",
" IsAssociatedPrime (Submodule.span R {x}).annihilator M'",
" (Submodule.span R {x}).annihilator = (Submodule.span R {f x}).annihilator",
" r ∈ (Submodule.span R {x}).annihilator ↔ r ∈ (Submodule.span R {f x}).annihilator"
] |
import Mathlib.MeasureTheory.Measure.Typeclasses
import Mathlib.MeasureTheory.Measure.MutuallySingular
import Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated
open Function Set
open scoped ENNReal Classical
noncomputable section
variable {α β δ : Type*} [MeasurableSpace α] [MeasurableSpace β] {s : Set α} {a : α}
namespace MeasureTheory
namespace Measure
def dirac (a : α) : Measure α := (OuterMeasure.dirac a).toMeasure (by simp)
#align measure_theory.measure.dirac MeasureTheory.Measure.dirac
instance : MeasureSpace PUnit :=
⟨dirac PUnit.unit⟩
theorem le_dirac_apply {a} : s.indicator 1 a ≤ dirac a s :=
OuterMeasure.dirac_apply a s ▸ le_toMeasure_apply _ _ _
#align measure_theory.measure.le_dirac_apply MeasureTheory.Measure.le_dirac_apply
@[simp]
theorem dirac_apply' (a : α) (hs : MeasurableSet s) : dirac a s = s.indicator 1 a :=
toMeasure_apply _ _ hs
#align measure_theory.measure.dirac_apply' MeasureTheory.Measure.dirac_apply'
@[simp]
| Mathlib/MeasureTheory/Measure/Dirac.lean | 45 | 49 | theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by |
have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1
refine le_antisymm (this univ trivial ▸ ?_) (this s h ▸ le_dirac_apply)
rw [← dirac_apply' a MeasurableSet.univ]
exact measure_mono (subset_univ s)
| [
" inst✝¹ ≤ (OuterMeasure.dirac a).caratheodory",
" (dirac a) s = 1",
" (dirac a) s ≤ univ.indicator 1 a",
" (dirac a) s ≤ (dirac a) univ"
] | [
" inst✝¹ ≤ (OuterMeasure.dirac a).caratheodory"
] |
import Mathlib.SetTheory.Ordinal.Arithmetic
namespace OrdinalApprox
universe u
variable {α : Type u}
variable [CompleteLattice α] (f : α →o α) (x : α)
open Function fixedPoints Cardinal Order OrderHom
set_option linter.unusedVariables false in
def lfpApprox (a : Ordinal.{u}) : α :=
sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x})
termination_by a
decreasing_by exact h
| Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean | 77 | 85 | theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by |
unfold Monotone; intros a b h; unfold lfpApprox
refine sSup_le_sSup ?h
apply sup_le_sup_right
simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂]
intros a' h'
use a'
exact ⟨lt_of_lt_of_le h' h, rfl⟩
| [
" (invImage (fun x => x) Ordinal.wellFoundedRelation).1 b a",
" Monotone (lfpApprox f x)",
" ∀ ⦃a b : Ordinal.{u}⦄, a ≤ b → lfpApprox f x a ≤ lfpApprox f x b",
" lfpApprox f x a ≤ lfpApprox f x b",
" sSup ({x_1 | ∃ b, ∃ (_ : b < a), f (lfpApprox f x b) = x_1} ∪ {x}) ≤\n sSup ({x_1 | ∃ b_1, ∃ (_ : b_1 < b... | [
" (invImage (fun x => x) Ordinal.wellFoundedRelation).1 b a"
] |
import Mathlib.CategoryTheory.Category.Basic
import Mathlib.CategoryTheory.Functor.Basic
import Mathlib.CategoryTheory.Groupoid
import Mathlib.Tactic.NthRewrite
import Mathlib.CategoryTheory.PathCategory
import Mathlib.CategoryTheory.Quotient
import Mathlib.Combinatorics.Quiver.Symmetric
#align_import category_theory.groupoid.free_groupoid from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
open Set Classical Function
attribute [local instance] propDecidable
namespace CategoryTheory
namespace Groupoid
namespace Free
universe u v u' v' u'' v''
variable {V : Type u} [Quiver.{v + 1} V]
abbrev _root_.Quiver.Hom.toPosPath {X Y : V} (f : X ⟶ Y) :
(CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom X Y :=
f.toPos.toPath
#align category_theory.groupoid.free.quiver.hom.to_pos_path Quiver.Hom.toPosPath
abbrev _root_.Quiver.Hom.toNegPath {X Y : V} (f : X ⟶ Y) :
(CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom Y X :=
f.toNeg.toPath
#align category_theory.groupoid.free.quiver.hom.to_neg_path Quiver.Hom.toNegPath
inductive redStep : HomRel (Paths (Quiver.Symmetrify V))
| step (X Z : Quiver.Symmetrify V) (f : X ⟶ Z) :
redStep (𝟙 (Paths.of.obj X)) (f.toPath ≫ (Quiver.reverse f).toPath)
#align category_theory.groupoid.free.red_step CategoryTheory.Groupoid.Free.redStep
def _root_.CategoryTheory.FreeGroupoid (V) [Q : Quiver V] :=
Quotient (@redStep V Q)
#align category_theory.free_groupoid CategoryTheory.FreeGroupoid
instance {V} [Quiver V] [Nonempty V] : Nonempty (FreeGroupoid V) := by
inhabit V; exact ⟨⟨@default V _⟩⟩
theorem congr_reverse {X Y : Paths <| Quiver.Symmetrify V} (p q : X ⟶ Y) :
Quotient.CompClosure redStep p q → Quotient.CompClosure redStep p.reverse q.reverse := by
rintro ⟨XW, pp, qq, WY, _, Z, f⟩
have : Quotient.CompClosure redStep (WY.reverse ≫ 𝟙 _ ≫ XW.reverse)
(WY.reverse ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ XW.reverse) := by
constructor
constructor
simpa only [CategoryStruct.comp, CategoryStruct.id, Quiver.Path.reverse, Quiver.Path.nil_comp,
Quiver.Path.reverse_comp, Quiver.reverse_reverse, Quiver.Path.reverse_toPath,
Quiver.Path.comp_assoc] using this
#align category_theory.groupoid.free.congr_reverse CategoryTheory.Groupoid.Free.congr_reverse
theorem congr_comp_reverse {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) :
Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p ≫ p.reverse) =
Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 X) := by
apply Quot.EqvGen_sound
induction' p with a b q f ih
· apply EqvGen.refl
· simp only [Quiver.Path.reverse]
fapply EqvGen.trans
-- Porting note: `Quiver.Path.*` and `Quiver.Hom.*` notation not working
· exact q ≫ Quiver.Path.reverse q
· apply EqvGen.symm
apply EqvGen.rel
have : Quotient.CompClosure redStep (q ≫ 𝟙 _ ≫ Quiver.Path.reverse q)
(q ≫ (Quiver.Hom.toPath f ≫ Quiver.Hom.toPath (Quiver.reverse f)) ≫
Quiver.Path.reverse q) := by
apply Quotient.CompClosure.intro
apply redStep.step
simp only [Category.assoc, Category.id_comp] at this ⊢
-- Porting note: `simp` cannot see how `Quiver.Path.comp_assoc` is relevant, so change to
-- category notation
change Quotient.CompClosure redStep (q ≫ Quiver.Path.reverse q)
(Quiver.Path.cons q f ≫ (Quiver.Hom.toPath (Quiver.reverse f)) ≫ (Quiver.Path.reverse q))
simp only [← Category.assoc] at this ⊢
exact this
· exact ih
#align category_theory.groupoid.free.congr_comp_reverse CategoryTheory.Groupoid.Free.congr_comp_reverse
| Mathlib/CategoryTheory/Groupoid/FreeGroupoid.lean | 120 | 124 | theorem congr_reverse_comp {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) :
Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p.reverse ≫ p) =
Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 Y) := by |
nth_rw 2 [← Quiver.Path.reverse_reverse p]
apply congr_comp_reverse
| [
" Nonempty (FreeGroupoid V)",
" Quotient.CompClosure redStep p q → Quotient.CompClosure redStep (Quiver.Path.reverse p) (Quiver.Path.reverse q)",
" Quotient.CompClosure redStep (Quiver.Path.reverse (XW ≫ 𝟙 (Paths.of.obj X✝) ≫ WY))\n (Quiver.Path.reverse (XW ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ WY))",
... | [
" Nonempty (FreeGroupoid V)",
" Quotient.CompClosure redStep p q → Quotient.CompClosure redStep (Quiver.Path.reverse p) (Quiver.Path.reverse q)",
" Quotient.CompClosure redStep (Quiver.Path.reverse (XW ≫ 𝟙 (Paths.of.obj X✝) ≫ WY))\n (Quiver.Path.reverse (XW ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ WY))",
... |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm]
#align symm_diff_comm symmDiff_comm
instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) :=
⟨symmDiff_comm⟩
#align symm_diff_is_comm symmDiff_isCommutative
@[simp]
theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self]
#align symm_diff_self symmDiff_self
@[simp]
theorem symmDiff_bot : a ∆ ⊥ = a := by rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq]
#align symm_diff_bot symmDiff_bot
@[simp]
theorem bot_symmDiff : ⊥ ∆ a = a := by rw [symmDiff_comm, symmDiff_bot]
#align bot_symm_diff bot_symmDiff
@[simp]
theorem symmDiff_eq_bot {a b : α} : a ∆ b = ⊥ ↔ a = b := by
simp_rw [symmDiff, sup_eq_bot_iff, sdiff_eq_bot_iff, le_antisymm_iff]
#align symm_diff_eq_bot symmDiff_eq_bot
| Mathlib/Order/SymmDiff.lean | 137 | 138 | theorem symmDiff_of_le {a b : α} (h : a ≤ b) : a ∆ b = b \ a := by |
rw [symmDiff, sdiff_eq_bot_iff.2 h, bot_sup_eq]
| [
" ∀ (p q : Bool), p ∆ q = xor p q",
" a ∆ b = b ∆ a",
" a ∆ a = ⊥",
" a ∆ ⊥ = a",
" ⊥ ∆ a = a",
" a ∆ b = ⊥ ↔ a = b",
" a ∆ b = b \\ a"
] | [
" ∀ (p q : Bool), p ∆ q = xor p q",
" a ∆ b = b ∆ a",
" a ∆ a = ⊥",
" a ∆ ⊥ = a",
" ⊥ ∆ a = a",
" a ∆ b = ⊥ ↔ a = b"
] |
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 RankCondition
variable [RankCondition R]
| Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean | 109 | 118 | theorem Basis.le_span'' {ι : Type*} [Fintype ι] (b : Basis ι R M) {w : Set M} [Fintype w]
(s : span R w = ⊤) : Fintype.card ι ≤ Fintype.card w := by |
-- We construct a surjective linear map `(w → R) →ₗ[R] (ι → R)`,
-- by expressing a linear combination in `w` as a linear combination in `ι`.
fapply card_le_of_surjective' R
· exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑))
· apply Surjective.comp (g := b.repr.toLinearMap)
· apply LinearEquiv.surjective
rw [← LinearMap.range_eq_top, Finsupp.range_total]
simpa using s
| [
" Fintype.card ι ≤ Fintype.card ↑w",
" (↑w →₀ R) →ₗ[R] ι →₀ R",
" Surjective ⇑(↑b.repr ∘ₗ Finsupp.total (↑w) M R Subtype.val)",
" Surjective ⇑↑b.repr",
" Surjective fun x => (Finsupp.total (↑w) M R Subtype.val) x",
" span R (range Subtype.val) = ⊤"
] | [] |
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Normed.Group.Lemmas
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.Analysis.NormedSpace.AffineIsometry
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
import Mathlib.Analysis.NormedSpace.RieszLemma
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Topology.Algebra.Module.FiniteDimension
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.Matrix
#align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
universe u v w x
noncomputable section
open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology
NNReal Metric
section CompleteField
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x}
[AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F']
[ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜]
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by
change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E)
-- Porting note: this could be easier with `det_cases`
by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E)
· rcases h with ⟨s, ⟨b⟩⟩
haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b
simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b]
refine Continuous.matrix_det ?_
exact
((LinearMap.toMatrix b b).toLinearMap.comp
(ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional
· -- Porting note: was `unfold LinearMap.det`
rw [LinearMap.det_def]
simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const
#align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det
irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E']
[FiniteDimensional ℝ E'] : ℝ≥0 :=
let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv
max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1
#align lipschitz_extension_constant lipschitzExtensionConstant
theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E']
[FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by
rw [lipschitzExtensionConstant]
exact zero_lt_one.trans_le (le_max_right _ _)
#align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos
theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'}
{K : ℝ≥0} (hf : LipschitzOnWith K f s) :
∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by
let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E'
let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv
have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz
have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s :=
LA.comp_lipschitzOnWith hf
obtain ⟨g, hg, gs⟩ :
∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s :=
L.extend_pi
refine ⟨A.symm ∘ g, ?_, ?_⟩
· have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by
apply A.symm.lipschitz
apply (LAsymm.comp hg).weaken
rw [lipschitzExtensionConstant, ← mul_assoc]
exact mul_le_mul' (le_max_left _ _) le_rfl
· intro x hx
have : A (f x) = g x := gs hx
simp only [(· ∘ ·), ← this, A.symm_apply_apply]
#align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension
| Mathlib/Analysis/NormedSpace/FiniteDimension.lean | 223 | 229 | theorem LinearMap.exists_antilipschitzWith [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F)
(hf : LinearMap.ker f = ⊥) : ∃ K > 0, AntilipschitzWith K f := by |
cases subsingleton_or_nontrivial E
· exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩
· rw [LinearMap.ker_eq_bot] at hf
let e : E ≃L[𝕜] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv
exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩
| [
" Continuous fun f => f.det",
" Continuous fun f => LinearMap.det ↑f",
" Continuous fun f => ((LinearMap.toMatrix b b) ↑f).det",
" Continuous fun f => (LinearMap.toMatrix b b) ↑f",
" Continuous fun f =>\n (if H : ∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 E) then LinearMap.detAux (Trunc.mk ⋯.some) else 1) ↑f... | [
" Continuous fun f => f.det",
" Continuous fun f => LinearMap.det ↑f",
" Continuous fun f => ((LinearMap.toMatrix b b) ↑f).det",
" Continuous fun f => (LinearMap.toMatrix b b) ↑f",
" Continuous fun f =>\n (if H : ∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 E) then LinearMap.detAux (Trunc.mk ⋯.some) else 1) ↑f... |
import Mathlib.Topology.MetricSpace.PseudoMetric
#align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
open Set Filter Bornology
open scoped NNReal Uniformity
universe u v w
variable {α : Type u} {β : Type v} {X ι : Type*}
variable [PseudoMetricSpace α]
class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where
eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y
#align metric_space MetricSpace
@[ext]
theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) :
m = m' := by
cases m; cases m'; congr; ext1; assumption
#align metric_space.ext MetricSpace.ext
def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ)
(dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x)
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
(H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s)
(eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α :=
{ PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with
eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ }
#align metric_space.of_dist_topology MetricSpace.ofDistTopology
variable {γ : Type w} [MetricSpace γ]
theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y :=
MetricSpace.eq_of_dist_eq_zero
#align eq_of_dist_eq_zero eq_of_dist_eq_zero
@[simp]
theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y :=
Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _
#align dist_eq_zero dist_eq_zero
@[simp]
theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero]
#align zero_eq_dist zero_eq_dist
| Mathlib/Topology/MetricSpace/Basic.lean | 77 | 78 | theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by |
simpa only [not_iff_not] using dist_eq_zero
| [
" m = m'",
" mk eq_of_dist_eq_zero✝ = m'",
" mk eq_of_dist_eq_zero✝¹ = mk eq_of_dist_eq_zero✝",
" toPseudoMetricSpace✝¹ = toPseudoMetricSpace✝",
" PseudoMetricSpace.toDist = PseudoMetricSpace.toDist",
" 0 = dist x y ↔ x = y",
" dist x y ≠ 0 ↔ x ≠ y"
] | [
" m = m'",
" mk eq_of_dist_eq_zero✝ = m'",
" mk eq_of_dist_eq_zero✝¹ = mk eq_of_dist_eq_zero✝",
" toPseudoMetricSpace✝¹ = toPseudoMetricSpace✝",
" PseudoMetricSpace.toDist = PseudoMetricSpace.toDist",
" 0 = dist x y ↔ x = y"
] |
import Mathlib.FieldTheory.Separable
import Mathlib.RingTheory.IntegralDomain
import Mathlib.Algebra.CharP.Reduced
import Mathlib.Tactic.ApplyFun
#align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43"
variable {K : Type*} {R : Type*}
local notation "q" => Fintype.card K
open Finset
open scoped Polynomial
namespace FiniteField
theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] :
∏ x : Kˣ, x = (-1 : Kˣ) := by
classical
have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 :=
prod_involution (fun x _ => x⁻¹) (by simp)
(fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff])
(fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp)
rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one]
#align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
| Mathlib/FieldTheory/Finite/Basic.lean | 115 | 139 | theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K]
(G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by |
let n := Fintype.card G
intro nzero
have ⟨p, char_p⟩ := CharP.exists K
have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero
cases CharP.char_is_prime_or_zero K p with
| inr pzero =>
exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd
| inl pprime =>
have fact_pprime := Fact.mk pprime
-- G has an element x of order p by Cauchy's theorem
have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd
-- F has an element u (= ↑↑x) of order p
let u := ((x : Kˣ) : K)
have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe]
-- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ...
have h : u = 1 := by
rw [← sub_left_inj, sub_self 1]
apply pow_eq_zero (n := p)
rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self]
exact Commute.one_right u
-- ... meaning x didn't have order p after all, contradiction
apply pprime.one_lt.ne
rw [← hu, h, orderOf_one]
| [
" ∏ x : Kˣ, x = -1",
" ∀ (a : Kˣ) (ha : a ∈ univ.erase (-1)), a * (fun x x_1 => x⁻¹) a ha = 1",
" ∀ (ha : a ∈ univ.erase (-1)), a ≠ 1 → (fun x x_1 => x⁻¹) a ha ≠ a",
" ∀ (ha : a ∈ univ.erase (-1)), (fun x x_1 => x⁻¹) a ha ∈ univ.erase (-1)",
" ∀ (a : Kˣ) (ha : a ∈ univ.erase (-1)), (fun x x_1 => x⁻¹) ((fun ... | [
" ∏ x : Kˣ, x = -1",
" ∀ (a : Kˣ) (ha : a ∈ univ.erase (-1)), a * (fun x x_1 => x⁻¹) a ha = 1",
" ∀ (ha : a ∈ univ.erase (-1)), a ≠ 1 → (fun x x_1 => x⁻¹) a ha ≠ a",
" ∀ (ha : a ∈ univ.erase (-1)), (fun x x_1 => x⁻¹) a ha ∈ univ.erase (-1)",
" ∀ (a : Kˣ) (ha : a ∈ univ.erase (-1)), (fun x x_1 => x⁻¹) ((fun ... |
import Mathlib.Order.Filter.Lift
import Mathlib.Topology.Separation
import Mathlib.Order.Interval.Set.Monotone
#align_import topology.filter from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
open Set Filter TopologicalSpace
open Filter Topology
variable {ι : Sort*} {α β X Y : Type*}
namespace Filter
instance : TopologicalSpace (Filter α) :=
generateFrom <| range <| Iic ∘ 𝓟
theorem isOpen_Iic_principal {s : Set α} : IsOpen (Iic (𝓟 s)) :=
GenerateOpen.basic _ (mem_range_self _)
#align filter.is_open_Iic_principal Filter.isOpen_Iic_principal
theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by
simpa only [Iic_principal] using isOpen_Iic_principal
#align filter.is_open_set_of_mem Filter.isOpen_setOf_mem
theorem isTopologicalBasis_Iic_principal :
IsTopologicalBasis (range (Iic ∘ 𝓟 : Set α → Set (Filter α))) :=
{ exists_subset_inter := by
rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩ l hl
exact ⟨Iic (𝓟 s) ∩ Iic (𝓟 t), ⟨s ∩ t, by simp⟩, hl, Subset.rfl⟩
sUnion_eq := sUnion_eq_univ_iff.2 fun l => ⟨Iic ⊤, ⟨univ, congr_arg Iic principal_univ⟩,
mem_Iic.2 le_top⟩
eq_generateFrom := rfl }
#align filter.is_topological_basis_Iic_principal Filter.isTopologicalBasis_Iic_principal
theorem isOpen_iff {s : Set (Filter α)} : IsOpen s ↔ ∃ T : Set (Set α), s = ⋃ t ∈ T, Iic (𝓟 t) :=
isTopologicalBasis_Iic_principal.open_iff_eq_sUnion.trans <| by
simp only [exists_subset_range_and_iff, sUnion_image, (· ∘ ·)]
#align filter.is_open_iff Filter.isOpen_iff
theorem nhds_eq (l : Filter α) : 𝓝 l = l.lift' (Iic ∘ 𝓟) :=
nhds_generateFrom.trans <| by
simp only [mem_setOf_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift,
(· ∘ ·), mem_Iic, le_principal_iff]
#align filter.nhds_eq Filter.nhds_eq
theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } := by
simpa only [(· ∘ ·), Iic_principal] using nhds_eq l
#align filter.nhds_eq' Filter.nhds_eq'
protected theorem tendsto_nhds {la : Filter α} {lb : Filter β} {f : α → Filter β} :
Tendsto f la (𝓝 lb) ↔ ∀ s ∈ lb, ∀ᶠ a in la, s ∈ f a := by
simp only [nhds_eq', tendsto_lift', mem_setOf_eq]
#align filter.tendsto_nhds Filter.tendsto_nhds
protected theorem HasBasis.nhds {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) :
HasBasis (𝓝 l) p fun i => Iic (𝓟 (s i)) := by
rw [nhds_eq]
exact h.lift' monotone_principal.Iic
#align filter.has_basis.nhds Filter.HasBasis.nhds
protected theorem tendsto_pure_self (l : Filter X) :
Tendsto (pure : X → Filter X) l (𝓝 l) := by
rw [Filter.tendsto_nhds]
exact fun s hs ↦ Eventually.mono hs fun x ↦ id
instance {l : Filter α} [IsCountablyGenerated l] : IsCountablyGenerated (𝓝 l) :=
let ⟨_b, hb⟩ := l.exists_antitone_basis
HasCountableBasis.isCountablyGenerated <| ⟨hb.nhds, Set.to_countable _⟩
| Mathlib/Topology/Filter.lean | 105 | 106 | theorem HasBasis.nhds' {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) :
HasBasis (𝓝 l) p fun i => { l' | s i ∈ l' } := by | simpa only [Iic_principal] using h.nhds
| [
" IsOpen {l | s ∈ l}",
" ∀ t₁ ∈ range (Iic ∘ 𝓟), ∀ t₂ ∈ range (Iic ∘ 𝓟), ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ range (Iic ∘ 𝓟), x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂",
" ∃ t₃ ∈ range (Iic ∘ 𝓟), l ∈ t₃ ∧ t₃ ⊆ (Iic ∘ 𝓟) s ∩ (Iic ∘ 𝓟) t",
" (Iic ∘ 𝓟) (s ∩ t) = Iic (𝓟 s) ∩ Iic (𝓟 t)",
" (∃ S ⊆ range (Iic ∘ 𝓟), s = ⋃₀ S) ↔ ∃ T, s = ⋃... | [
" IsOpen {l | s ∈ l}",
" ∀ t₁ ∈ range (Iic ∘ 𝓟), ∀ t₂ ∈ range (Iic ∘ 𝓟), ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ range (Iic ∘ 𝓟), x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂",
" ∃ t₃ ∈ range (Iic ∘ 𝓟), l ∈ t₃ ∧ t₃ ⊆ (Iic ∘ 𝓟) s ∩ (Iic ∘ 𝓟) t",
" (Iic ∘ 𝓟) (s ∩ t) = Iic (𝓟 s) ∩ Iic (𝓟 t)",
" (∃ S ⊆ range (Iic ∘ 𝓟), s = ⋃₀ S) ↔ ∃ T, s = ⋃... |
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.Real
#align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set
open Pointwise Topology
variable {𝕜 E : Type*}
variable [NormedField 𝕜]
section SeminormedAddCommGroup
variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E]
theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
conv_lhs => rw [← inv_smul_smul₀ hc x]
simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀]
#align smul_ball smul_ball
theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by
rw [_root_.smul_ball hc, smul_zero, mul_one]
#align smul_unit_ball smul_unitBall
theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) :
c • sphere x r = sphere (c • x) (‖c‖ * r) := by
ext y
rw [mem_smul_set_iff_inv_smul_mem₀ hc]
conv_lhs => rw [← inv_smul_smul₀ hc x]
simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne',
mul_comm r]
#align smul_sphere' smul_sphere'
theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) :
c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by
simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc]
#align smul_closed_ball' smul_closedBall'
theorem set_smul_sphere_zero {s : Set 𝕜} (hs : 0 ∉ s) (r : ℝ) :
s • sphere (0 : E) r = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) :=
calc
s • sphere (0 : E) r = ⋃ c ∈ s, c • sphere (0 : E) r := iUnion_smul_left_image.symm
_ = ⋃ c ∈ s, sphere (0 : E) (‖c‖ * r) := iUnion₂_congr fun c hc ↦ by
rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero]
_ = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := by ext; simp [eq_comm]
theorem Bornology.IsBounded.smul₀ {s : Set E} (hs : IsBounded s) (c : 𝕜) : IsBounded (c • s) :=
(lipschitzWith_smul c).isBounded_image hs
#align metric.bounded.smul Bornology.IsBounded.smul₀
theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s)
{u : Set E} (hu : u ∈ 𝓝 x) : ∀ᶠ r in 𝓝 (0 : 𝕜), {x} + r • s ⊆ u := by
obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu
obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_closedBall_lt 0 0
have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos)
filter_upwards [this] with r hr
simp only [image_add_left, singleton_add]
intro y hy
obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy
have I : ‖r • z‖ ≤ ε :=
calc
‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _
_ ≤ ε / R * R :=
(mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs))
(norm_nonneg _) (div_pos εpos Rpos).le)
_ = ε := by field_simp
have : y = x + r • z := by simp only [hz, add_neg_cancel_left]
apply hε
simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I
#align eventually_singleton_add_smul_subset eventually_singleton_add_smul_subset
variable [NormedSpace ℝ E] {x y z : E} {δ ε : ℝ}
| Mathlib/Analysis/NormedSpace/Pointwise.lean | 150 | 151 | theorem smul_unitBall_of_pos {r : ℝ} (hr : 0 < r) : r • ball (0 : E) 1 = ball (0 : E) r := by |
rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le]
| [
" c • ball x r = ball (c • x) (‖c‖ * r)",
" y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
" c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
"𝕜 : Type u_1\nE : Type u_2\ninst✝² : NormedField 𝕜\ninst✝¹ : SeminormedAddCommGroup E\ninst✝ : NormedSpace 𝕜 E\nc : 𝕜\nhc : c ≠ 0\nx : E\nr : ℝ\ny : E\n| c⁻¹ • y... | [
" c • ball x r = ball (c • x) (‖c‖ * r)",
" y ∈ c • ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
" c⁻¹ • y ∈ ball x r ↔ y ∈ ball (c • x) (‖c‖ * r)",
"𝕜 : Type u_1\nE : Type u_2\ninst✝² : NormedField 𝕜\ninst✝¹ : SeminormedAddCommGroup E\ninst✝ : NormedSpace 𝕜 E\nc : 𝕜\nhc : c ≠ 0\nx : E\nr : ℝ\ny : E\n| c⁻¹ • y... |
import Mathlib.Geometry.Manifold.MFDeriv.Atlas
noncomputable section
open scoped Manifold
open Set
section UniqueMDiff
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*}
[TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
{I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M'] {s : Set M} {x : M}
theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x)
{f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f')
(hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by
have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x))
refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt
case pt => simp only [mfld_simps]
case sub1 => mfld_set_tac
case sub2 =>
rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩
exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩
theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'}
{f' : M → E →L[𝕜] E'} (hf : ∀ x ∈ s, HasMFDerivWithinAt I I' f s x (f' x))
(hd : ∀ x ∈ s, DenseRange (f' x)) :
UniqueMDiffOn I' (f '' s) :=
forall_mem_image.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx)
theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'}
(hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) :
UniqueMDiffOn I' (f '' s) :=
hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd
protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x)
{e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) :
UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by
rw [← e.image_source_inter_eq', inter_comm]
exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange
(he.mdifferentiableAt hx).hasMFDerivAt.hasMFDerivWithinAt
(he.mfderiv_surjective hx).denseRange
theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'}
(he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦
e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1)
#align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage
| Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean | 84 | 92 | theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) :
UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) := by |
-- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e`
-- the local chart at `x`.
apply UniqueMDiffOn.uniqueDiffOn
rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source]
exact (hs.inter (chartAt H x).open_source).image_denseRange'
(fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2)
fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange
| [
" UniqueMDiffWithinAt I' (f '' s) (f x)",
" writtenInExtChartAt I I' x f (↑(extChartAt I x) x) = ↑(extChartAt I' (f x)) (f x)",
" writtenInExtChartAt I I' x f '' (↑(extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' (f x)).source) ∩ range ↑I) ⊆\n ↑(extChartAt I' (f x)).symm ⁻¹' (f '' s) ∩ range ↑I'",
" ↑(e... | [
" UniqueMDiffWithinAt I' (f '' s) (f x)",
" writtenInExtChartAt I I' x f (↑(extChartAt I x) x) = ↑(extChartAt I' (f x)) (f x)",
" writtenInExtChartAt I I' x f '' (↑(extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' (f x)).source) ∩ range ↑I) ⊆\n ↑(extChartAt I' (f x)).symm ⁻¹' (f '' s) ∩ range ↑I'",
" ↑(e... |
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Data.Finset.Pointwise
import Mathlib.Tactic.GCongr
#align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd"
open Nat
open NNRat Pointwise
namespace Finset
variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α}
@[to_additive card_sub_mul_le_card_sub_mul_card_sub
"**Ruzsa's triangle inequality**. Subtraction version."]
theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) :
(A / C).card * B.card ≤ (A / B).card * (B / C).card := by
rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card]
refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_)
fun x _ ↦ card_le_one_iff.2 fun hu hv ↦
((mem_bipartiteBelow _).1 hu).2.symm.trans ?_
obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx
refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_
· rw [mem_bipartiteAbove]
exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩
· exact div_right_injective (Prod.ext_iff.1 h).1
· exact ((mem_bipartiteBelow _).1 hv).2
#align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div
#align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub
@[to_additive card_sub_mul_le_card_add_mul_card_add
"**Ruzsa's triangle inequality**. Sub-add-add version."]
theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) :
(A / C).card * B.card ≤ (A * B).card * (B * C).card := by
rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul
#align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add
@[to_additive card_add_mul_le_card_sub_mul_card_add
"**Ruzsa's triangle inequality**. Add-sub-sub version."]
theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset α) :
(A * C).card * B.card ≤ (A / B).card * (B * C).card := by
rw [← div_inv_eq_mul, ← div_inv_eq_mul B]
exact card_div_mul_le_card_div_mul_card_div _ _ _
#align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul
#align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add
@[to_additive card_add_mul_le_card_add_mul_card_sub
"**Ruzsa's triangle inequality**. Add-add-sub version."]
theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset α) :
(A * C).card * B.card ≤ (A * B).card * (B / C).card := by
rw [← div_inv_eq_mul, div_eq_mul_inv B]
exact card_div_mul_le_card_mul_mul_card_mul _ _ _
#align finset.card_mul_mul_le_card_mul_mul_card_div Finset.card_mul_mul_le_card_mul_mul_card_div
#align finset.card_add_mul_le_card_add_mul_card_sub Finset.card_add_mul_le_card_add_mul_card_sub
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
@[to_additive]
| Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean | 92 | 118 | theorem mul_pluennecke_petridis (C : Finset α)
(hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card) :
(A * B * C).card * A.card ≤ (A * B).card * (A * C).card := by |
induction' C using Finset.induction_on with x C _ ih
· simp
set A' := A ∩ (A * C / {x}) with hA'
set C' := insert x C with hC'
have h₀ : A' * {x} = A * {x} ∩ (A * C) := by
rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel]
have h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x}) := by
rw [hC', insert_eq, union_comm, mul_union]
refine (sup_sdiff_eq_sup ?_).symm
rw [mul_right_comm, mul_right_comm A, h₀]
exact mul_subset_mul_right inter_subset_right
have h₂ : A' * B * {x} ⊆ A * B * {x} :=
mul_subset_mul_right (mul_subset_mul_right inter_subset_left)
have h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card := by
rw [h₁]
refine (card_union_le _ _).trans_eq ?_
rw [card_sdiff h₂, ← add_tsub_assoc_of_le (card_le_card h₂), card_mul_singleton,
card_mul_singleton]
refine (mul_le_mul_right' h₃ _).trans ?_
rw [tsub_mul, add_mul]
refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_
rw [← mul_add, ← mul_tsub, ← hA', hC', insert_eq, mul_union, ← card_mul_singleton A x, ←
card_mul_singleton A' x, add_comm (card _), h₀,
eq_tsub_of_add_eq (card_union_add_card_inter _ _)]
| [
" (A / C).card * B.card ≤ (A / B).card * (B / C).card",
" (A / C).card * B.card ≤ ((A / B) ×ˢ (B / C)).card * 1",
" x.1 * x.2 = b✝",
" (fun b => (a / b, b / c)) b ∈ bipartiteAbove (fun b ac => ac.1 * ac.2 = b) ((A / B) ×ˢ (B / C)) (a / c)",
" (fun b => (a / b, b / c)) b ∈ (A / B) ×ˢ (B / C) ∧\n ((fun b =... | [
" (A / C).card * B.card ≤ (A / B).card * (B / C).card",
" (A / C).card * B.card ≤ ((A / B) ×ˢ (B / C)).card * 1",
" x.1 * x.2 = b✝",
" (fun b => (a / b, b / c)) b ∈ bipartiteAbove (fun b ac => ac.1 * ac.2 = b) ((A / B) ×ˢ (B / C)) (a / c)",
" (fun b => (a / b, b / c)) b ∈ (A / B) ×ˢ (B / C) ∧\n ((fun b =... |
import Mathlib.RingTheory.Polynomial.Hermite.Basic
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import ring_theory.polynomial.hermite.gaussian from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open Polynomial
namespace Polynomial
| Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean | 40 | 55 | theorem deriv_gaussian_eq_hermite_mul_gaussian (n : ℕ) (x : ℝ) :
deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x =
(-1 : ℝ) ^ n * aeval x (hermite n) * Real.exp (-(x ^ 2 / 2)) := by |
rw [mul_assoc]
induction' n with n ih generalizing x
· rw [Function.iterate_zero_apply, pow_zero, one_mul, hermite_zero, C_1, map_one, one_mul]
· replace ih : deriv^[n] _ = _ := _root_.funext ih
have deriv_gaussian :
deriv (fun y => Real.exp (-(y ^ 2 / 2))) x = -x * Real.exp (-(x ^ 2 / 2)) := by
-- porting note (#10745): was `simp [mul_comm, ← neg_mul]`
rw [deriv_exp (by simp)]; simp; ring
rw [Function.iterate_succ_apply', ih, deriv_const_mul_field, deriv_mul, pow_succ (-1 : ℝ),
deriv_gaussian, hermite_succ, map_sub, map_mul, aeval_X, Polynomial.deriv_aeval]
· ring
· apply Polynomial.differentiable_aeval
· apply DifferentiableAt.exp; simp -- Porting note: was just `simp`
| [
" deriv^[n] (fun y => (-(y ^ 2 / 2)).exp) x = (-1) ^ n * (aeval x) (hermite n) * (-(x ^ 2 / 2)).exp",
" deriv^[n] (fun y => (-(y ^ 2 / 2)).exp) x = (-1) ^ n * ((aeval x) (hermite n) * (-(x ^ 2 / 2)).exp)",
" deriv^[0] (fun y => (-(y ^ 2 / 2)).exp) x = (-1) ^ 0 * ((aeval x) (hermite 0) * (-(x ^ 2 / 2)).exp)",
... | [] |
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
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 110 | 112 | 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]
| [
" θ.cos = 0 ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2",
" (cexp (θ * I) + cexp (-θ * I)) / 2 = 0 ↔ cexp (2 * θ * I) = -1",
" cexp (θ * I - -θ * I) = -1 ↔ cexp (2 * θ * I) = -1",
" (∃ n, 2 * I * θ = ↑π * I + ↑n * (2 * ↑π * I)) ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2",
" 2 * I * θ = ↑π * I + ↑x * (2 * ↑π * I) ↔ θ = (2 * ↑x +... | [
" θ.cos = 0 ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2",
" (cexp (θ * I) + cexp (-θ * I)) / 2 = 0 ↔ cexp (2 * θ * I) = -1",
" cexp (θ * I - -θ * I) = -1 ↔ cexp (2 * θ * I) = -1",
" (∃ n, 2 * I * θ = ↑π * I + ↑n * (2 * ↑π * I)) ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2",
" 2 * I * θ = ↑π * I + ↑x * (2 * ↑π * I) ↔ θ = (2 * ↑x +... |
import Mathlib.Topology.Algebra.Polynomial
import Mathlib.Topology.ContinuousFunction.Algebra
import Mathlib.Topology.UnitInterval
import Mathlib.Algebra.Star.Subalgebra
#align_import topology.continuous_function.polynomial from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
variable {R : Type*}
open Polynomial
namespace Polynomial
section
variable [Semiring R] [TopologicalSpace R] [TopologicalSemiring R]
@[simps]
def toContinuousMap (p : R[X]) : C(R, R) :=
⟨fun x : R => p.eval x, by fun_prop⟩
#align polynomial.to_continuous_map Polynomial.toContinuousMap
open ContinuousMap in
lemma toContinuousMap_X_eq_id : X.toContinuousMap = .id R := by
ext; simp
@[simps]
def toContinuousMapOn (p : R[X]) (X : Set R) : C(X, R) :=
-- Porting note: Old proof was `⟨fun x : X => p.toContinuousMap x, by continuity⟩`
⟨fun x : X => p.toContinuousMap x, Continuous.comp (by continuity) (by continuity)⟩
#align polynomial.to_continuous_map_on Polynomial.toContinuousMapOn
open ContinuousMap in
lemma toContinuousMapOn_X_eq_restrict_id (s : Set R) :
X.toContinuousMapOn s = restrict s (.id R) := by
ext; simp
-- TODO some lemmas about when `toContinuousMapOn` is injective?
end
section
variable {α : Type*} [TopologicalSpace α] [CommSemiring R] [TopologicalSpace R]
[TopologicalSemiring R]
@[simp]
| Mathlib/Topology/ContinuousFunction/Polynomial.lean | 76 | 82 | theorem aeval_continuousMap_apply (g : R[X]) (f : C(α, R)) (x : α) :
((Polynomial.aeval f) g) x = g.eval (f x) := by |
refine Polynomial.induction_on' g ?_ ?_
· intro p q hp hq
simp [hp, hq]
· intro n a
simp [Pi.pow_apply]
| [
" Continuous fun x => eval x p",
" X.toContinuousMap = ContinuousMap.id R",
" X.toContinuousMap a✝ = (ContinuousMap.id R) a✝",
" Continuous ⇑p.toContinuousMap",
" Continuous fun x => ↑x",
" X.toContinuousMapOn s = restrict s (ContinuousMap.id R)",
" (X.toContinuousMapOn s) a✝ = (restrict s (ContinuousMa... | [
" Continuous fun x => eval x p",
" X.toContinuousMap = ContinuousMap.id R",
" X.toContinuousMap a✝ = (ContinuousMap.id R) a✝",
" Continuous ⇑p.toContinuousMap",
" Continuous fun x => ↑x",
" X.toContinuousMapOn s = restrict s (ContinuousMap.id R)",
" (X.toContinuousMapOn s) a✝ = (restrict s (ContinuousMa... |
import Mathlib.Computability.DFA
import Mathlib.Data.Fintype.Powerset
#align_import computability.NFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
open Set
open Computability
universe u v
-- Porting note: Required as `NFA` is used in mathlib3
set_option linter.uppercaseLean3 false
structure NFA (α : Type u) (σ : Type v) where
step : σ → α → Set σ
start : Set σ
accept : Set σ
#align NFA NFA
variable {α : Type u} {σ σ' : Type v} (M : NFA α σ)
namespace NFA
instance : Inhabited (NFA α σ) :=
⟨NFA.mk (fun _ _ => ∅) ∅ ∅⟩
def stepSet (S : Set σ) (a : α) : Set σ :=
⋃ s ∈ S, M.step s a
#align NFA.step_set NFA.stepSet
theorem mem_stepSet (s : σ) (S : Set σ) (a : α) : s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a := by
simp [stepSet]
#align NFA.mem_step_set NFA.mem_stepSet
@[simp]
| Mathlib/Computability/NFA.lean | 58 | 58 | theorem stepSet_empty (a : α) : M.stepSet ∅ a = ∅ := by | simp [stepSet]
| [
" s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a",
" M.stepSet ∅ a = ∅"
] | [
" s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a"
] |
import Mathlib.Algebra.Group.Subgroup.Pointwise
import Mathlib.Data.Set.Basic
import Mathlib.Data.Setoid.Basic
import Mathlib.GroupTheory.Coset
#align_import group_theory.double_coset from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
-- Porting note: removed import
-- import Mathlib.Tactic.Group
variable {G : Type*} [Group G] {α : Type*} [Mul α] (J : Subgroup G) (g : G)
open MulOpposite
open scoped Pointwise
namespace Doset
def doset (a : α) (s t : Set α) : Set α :=
s * {a} * t
#align doset Doset.doset
lemma doset_eq_image2 (a : α) (s t : Set α) : doset a s t = Set.image2 (· * a * ·) s t := by
simp_rw [doset, Set.mul_singleton, ← Set.image2_mul, Set.image2_image_left]
theorem mem_doset {s t : Set α} {a b : α} : b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y := by
simp only [doset_eq_image2, Set.mem_image2, eq_comm]
#align doset.mem_doset Doset.mem_doset
theorem mem_doset_self (H K : Subgroup G) (a : G) : a ∈ doset a H K :=
mem_doset.mpr ⟨1, H.one_mem, 1, K.one_mem, (one_mul a).symm.trans (mul_one (1 * a)).symm⟩
#align doset.mem_doset_self Doset.mem_doset_self
theorem doset_eq_of_mem {H K : Subgroup G} {a b : G} (hb : b ∈ doset a H K) :
doset b H K = doset a H K := by
obtain ⟨h, hh, k, hk, rfl⟩ := mem_doset.1 hb
rw [doset, doset, ← Set.singleton_mul_singleton, ← Set.singleton_mul_singleton, mul_assoc,
mul_assoc, Subgroup.singleton_mul_subgroup hk, ← mul_assoc, ← mul_assoc,
Subgroup.subgroup_mul_singleton hh]
#align doset.doset_eq_of_mem Doset.doset_eq_of_mem
theorem mem_doset_of_not_disjoint {H K : Subgroup G} {a b : G}
(h : ¬Disjoint (doset a H K) (doset b H K)) : b ∈ doset a H K := by
rw [Set.not_disjoint_iff] at h
simp only [mem_doset] at *
obtain ⟨x, ⟨l, hl, r, hr, hrx⟩, y, hy, ⟨r', hr', rfl⟩⟩ := h
refine ⟨y⁻¹ * l, H.mul_mem (H.inv_mem hy) hl, r * r'⁻¹, K.mul_mem hr (K.inv_mem hr'), ?_⟩
rwa [mul_assoc, mul_assoc, eq_inv_mul_iff_mul_eq, ← mul_assoc, ← mul_assoc, eq_mul_inv_iff_mul_eq]
#align doset.mem_doset_of_not_disjoint Doset.mem_doset_of_not_disjoint
theorem eq_of_not_disjoint {H K : Subgroup G} {a b : G}
(h : ¬Disjoint (doset a H K) (doset b H K)) : doset a H K = doset b H K := by
rw [disjoint_comm] at h
have ha : a ∈ doset b H K := mem_doset_of_not_disjoint h
apply doset_eq_of_mem ha
#align doset.eq_of_not_disjoint Doset.eq_of_not_disjoint
def setoid (H K : Set G) : Setoid G :=
Setoid.ker fun x => doset x H K
#align doset.setoid Doset.setoid
def Quotient (H K : Set G) : Type _ :=
_root_.Quotient (setoid H K)
#align doset.quotient Doset.Quotient
theorem rel_iff {H K : Subgroup G} {x y : G} :
(setoid ↑H ↑K).Rel x y ↔ ∃ a ∈ H, ∃ b ∈ K, y = a * x * b :=
Iff.trans
⟨fun hxy => (congr_arg _ hxy).mpr (mem_doset_self H K y), fun hxy => (doset_eq_of_mem hxy).symm⟩
mem_doset
#align doset.rel_iff Doset.rel_iff
theorem bot_rel_eq_leftRel (H : Subgroup G) :
(setoid ↑(⊥ : Subgroup G) ↑H).Rel = (QuotientGroup.leftRel H).Rel := by
ext a b
rw [rel_iff, Setoid.Rel, QuotientGroup.leftRel_apply]
constructor
· rintro ⟨a, rfl : a = 1, b, hb, rfl⟩
change a⁻¹ * (1 * a * b) ∈ H
rwa [one_mul, inv_mul_cancel_left]
· rintro (h : a⁻¹ * b ∈ H)
exact ⟨1, rfl, a⁻¹ * b, h, by rw [one_mul, mul_inv_cancel_left]⟩
#align doset.bot_rel_eq_left_rel Doset.bot_rel_eq_leftRel
theorem rel_bot_eq_right_group_rel (H : Subgroup G) :
(setoid ↑H ↑(⊥ : Subgroup G)).Rel = (QuotientGroup.rightRel H).Rel := by
ext a b
rw [rel_iff, Setoid.Rel, QuotientGroup.rightRel_apply]
constructor
· rintro ⟨b, hb, a, rfl : a = 1, rfl⟩
change b * a * 1 * a⁻¹ ∈ H
rwa [mul_one, mul_inv_cancel_right]
· rintro (h : b * a⁻¹ ∈ H)
exact ⟨b * a⁻¹, h, 1, rfl, by rw [mul_one, inv_mul_cancel_right]⟩
#align doset.rel_bot_eq_right_group_rel Doset.rel_bot_eq_right_group_rel
def quotToDoset (H K : Subgroup G) (q : Quotient (H : Set G) K) : Set G :=
doset q.out' H K
#align doset.quot_to_doset Doset.quotToDoset
abbrev mk (H K : Subgroup G) (a : G) : Quotient (H : Set G) K :=
Quotient.mk'' a
#align doset.mk Doset.mk
instance (H K : Subgroup G) : Inhabited (Quotient (H : Set G) K) :=
⟨mk H K (1 : G)⟩
| Mathlib/GroupTheory/DoubleCoset.lean | 130 | 133 | theorem eq (H K : Subgroup G) (a b : G) :
mk H K a = mk H K b ↔ ∃ h ∈ H, ∃ k ∈ K, b = h * a * k := by |
rw [Quotient.eq'']
apply rel_iff
| [
" doset a s t = Set.image2 (fun x x_1 => x * a * x_1) s t",
" b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y",
" doset b ↑H ↑K = doset a ↑H ↑K",
" doset (h * a * k) ↑H ↑K = doset a ↑H ↑K",
" b ∈ doset a ↑H ↑K",
" ∃ x ∈ ↑H, ∃ y ∈ ↑K, b = x * a * y",
" b = y⁻¹ * l * a * (r * r'⁻¹)",
" doset a ↑H ↑K =... | [
" doset a s t = Set.image2 (fun x x_1 => x * a * x_1) s t",
" b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y",
" doset b ↑H ↑K = doset a ↑H ↑K",
" doset (h * a * k) ↑H ↑K = doset a ↑H ↑K",
" b ∈ doset a ↑H ↑K",
" ∃ x ∈ ↑H, ∃ y ∈ ↑K, b = x * a * y",
" b = y⁻¹ * l * a * (r * r'⁻¹)",
" doset a ↑H ↑K =... |
import Mathlib.Algebra.DualNumber
import Mathlib.Algebra.QuaternionBasis
import Mathlib.Data.Complex.Module
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.CliffordAlgebra.Star
import Mathlib.LinearAlgebra.QuadraticForm.Prod
#align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e"
open CliffordAlgebra
namespace CliffordAlgebraComplex
open scoped ComplexConjugate
def Q : QuadraticForm ℝ ℝ :=
-QuadraticForm.sq (R := ℝ) -- Porting note: Added `(R := ℝ)`
set_option linter.uppercaseLean3 false in
#align clifford_algebra_complex.Q CliffordAlgebraComplex.Q
@[simp]
theorem Q_apply (r : ℝ) : Q r = -(r * r) :=
rfl
set_option linter.uppercaseLean3 false in
#align clifford_algebra_complex.Q_apply CliffordAlgebraComplex.Q_apply
def toComplex : CliffordAlgebra Q →ₐ[ℝ] ℂ :=
CliffordAlgebra.lift Q
⟨LinearMap.toSpanSingleton _ _ Complex.I, fun r => by
dsimp [LinearMap.toSpanSingleton, LinearMap.id]
rw [mul_mul_mul_comm]
simp⟩
#align clifford_algebra_complex.to_complex CliffordAlgebraComplex.toComplex
@[simp]
theorem toComplex_ι (r : ℝ) : toComplex (ι Q r) = r • Complex.I :=
CliffordAlgebra.lift_ι_apply _ _ r
#align clifford_algebra_complex.to_complex_ι CliffordAlgebraComplex.toComplex_ι
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean | 157 | 164 | theorem toComplex_involute (c : CliffordAlgebra Q) :
toComplex (involute c) = conj (toComplex c) := by |
have : toComplex (involute (ι Q 1)) = conj (toComplex (ι Q 1)) := by
simp only [involute_ι, toComplex_ι, AlgHom.map_neg, one_smul, Complex.conj_I]
suffices toComplex.comp involute = Complex.conjAe.toAlgHom.comp toComplex by
exact AlgHom.congr_fun this c
ext : 2
exact this
| [
" (LinearMap.toSpanSingleton ℝ ℂ Complex.I) r * (LinearMap.toSpanSingleton ℝ ℂ Complex.I) r = (algebraMap ℝ ℂ) (Q r)",
" ↑r * Complex.I * (↑r * Complex.I) = ↑(-(r * r))",
" ↑r * ↑r * (Complex.I * Complex.I) = ↑(-(r * r))",
" toComplex (involute c) = (starRingEnd ℂ) (toComplex c)",
" toComplex (involute ((ι ... | [
" (LinearMap.toSpanSingleton ℝ ℂ Complex.I) r * (LinearMap.toSpanSingleton ℝ ℂ Complex.I) r = (algebraMap ℝ ℂ) (Q r)",
" ↑r * Complex.I * (↑r * Complex.I) = ↑(-(r * r))",
" ↑r * ↑r * (Complex.I * Complex.I) = ↑(-(r * r))"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Analysis.SumOverResidueClass
#align_import analysis.p_series from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
def SuccDiffBounded (C : ℕ) (u : ℕ → ℕ) : Prop :=
∀ n : ℕ, u (n + 2) - u (n + 1) ≤ C • (u (n + 1) - u n)
namespace Finset
variable {M : Type*} [OrderedAddCommMonoid M] {f : ℕ → M} {u : ℕ → ℕ}
| Mathlib/Analysis/PSeries.lean | 50 | 62 | theorem le_sum_schlomilch' (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (h_pos : ∀ n, 0 < u n)
(hu : Monotone u) (n : ℕ) :
(∑ k ∈ Ico (u 0) (u n), f k) ≤ ∑ k ∈ range n, (u (k + 1) - u k) • f (u k) := by |
induction' n with n ihn
· simp
suffices (∑ k ∈ Ico (u n) (u (n + 1)), f k) ≤ (u (n + 1) - u n) • f (u n) by
rw [sum_range_succ, ← sum_Ico_consecutive]
· exact add_le_add ihn this
exacts [hu n.zero_le, hu n.le_succ]
have : ∀ k ∈ Ico (u n) (u (n + 1)), f k ≤ f (u n) := fun k hk =>
hf (Nat.succ_le_of_lt (h_pos n)) (mem_Ico.mp hk).1
convert sum_le_sum this
simp [pow_succ, mul_two]
| [
" ∑ k ∈ Ico (u 0) (u n), f k ≤ ∑ k ∈ range n, (u (k + 1) - u k) • f (u k)",
" ∑ k ∈ Ico (u 0) (u 0), f k ≤ ∑ k ∈ range 0, (u (k + 1) - u k) • f (u k)",
" ∑ k ∈ Ico (u 0) (u (n + 1)), f k ≤ ∑ k ∈ range (n + 1), (u (k + 1) - u k) • f (u k)",
" ∑ i ∈ Ico (u 0) ?n, f i + ∑ i ∈ Ico ?n (u (n + 1)), f i ≤\n ∑ x ∈... | [] |
import Mathlib.Algebra.Group.Defs
import Mathlib.Logic.Relation
#align_import algebra.homology.complex_shape from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
noncomputable section
open scoped Classical
@[ext]
structure ComplexShape (ι : Type*) where
Rel : ι → ι → Prop
next_eq : ∀ {i j j'}, Rel i j → Rel i j' → j = j'
prev_eq : ∀ {i i' j}, Rel i j → Rel i' j → i = i'
#align complex_shape ComplexShape
#align complex_shape.ext ComplexShape.ext
#align complex_shape.ext_iff ComplexShape.ext_iff
namespace ComplexShape
variable {ι : Type*}
@[simps]
def refl (ι : Type*) : ComplexShape ι where
Rel i j := i = j
next_eq w w' := w.symm.trans w'
prev_eq w w' := w.trans w'.symm
#align complex_shape.refl ComplexShape.refl
#align complex_shape.refl_rel ComplexShape.refl_Rel
@[simps]
def symm (c : ComplexShape ι) : ComplexShape ι where
Rel i j := c.Rel j i
next_eq w w' := c.prev_eq w w'
prev_eq w w' := c.next_eq w w'
#align complex_shape.symm ComplexShape.symm
#align complex_shape.symm_rel ComplexShape.symm_Rel
@[simp]
theorem symm_symm (c : ComplexShape ι) : c.symm.symm = c := by
ext
simp
#align complex_shape.symm_symm ComplexShape.symm_symm
theorem symm_bijective :
Function.Bijective (ComplexShape.symm : ComplexShape ι → ComplexShape ι) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
@[simp]
def trans (c₁ c₂ : ComplexShape ι) : ComplexShape ι where
Rel := Relation.Comp c₁.Rel c₂.Rel
next_eq w w' := by
obtain ⟨k, w₁, w₂⟩ := w
obtain ⟨k', w₁', w₂'⟩ := w'
rw [c₁.next_eq w₁ w₁'] at w₂
exact c₂.next_eq w₂ w₂'
prev_eq w w' := by
obtain ⟨k, w₁, w₂⟩ := w
obtain ⟨k', w₁', w₂'⟩ := w'
rw [c₂.prev_eq w₂ w₂'] at w₁
exact c₁.prev_eq w₁ w₁'
#align complex_shape.trans ComplexShape.trans
instance subsingleton_next (c : ComplexShape ι) (i : ι) : Subsingleton { j // c.Rel i j } := by
constructor
rintro ⟨j, rij⟩ ⟨k, rik⟩
congr
exact c.next_eq rij rik
instance subsingleton_prev (c : ComplexShape ι) (j : ι) : Subsingleton { i // c.Rel i j } := by
constructor
rintro ⟨i, rik⟩ ⟨j, rjk⟩
congr
exact c.prev_eq rik rjk
def next (c : ComplexShape ι) (i : ι) : ι :=
if h : ∃ j, c.Rel i j then h.choose else i
#align complex_shape.next ComplexShape.next
def prev (c : ComplexShape ι) (j : ι) : ι :=
if h : ∃ i, c.Rel i j then h.choose else j
#align complex_shape.prev ComplexShape.prev
theorem next_eq' (c : ComplexShape ι) {i j : ι} (h : c.Rel i j) : c.next i = j := by
apply c.next_eq _ h
rw [next]
rw [dif_pos]
exact Exists.choose_spec ⟨j, h⟩
#align complex_shape.next_eq' ComplexShape.next_eq'
| Mathlib/Algebra/Homology/ComplexShape.lean | 161 | 164 | theorem prev_eq' (c : ComplexShape ι) {i j : ι} (h : c.Rel i j) : c.prev j = i := by |
apply c.prev_eq _ h
rw [prev, dif_pos]
exact Exists.choose_spec (⟨i, h⟩ : ∃ k, c.Rel k j)
| [
" c.symm.symm = c",
" c.symm.symm.Rel x✝¹ x✝ ↔ c.Rel x✝¹ x✝",
" j✝ = j'✝",
" i✝ = i'✝",
" Subsingleton { j // c.Rel i j }",
" ∀ (a b : { j // c.Rel i j }), a = b",
" ⟨j, rij⟩ = ⟨k, rik⟩",
" j = k",
" Subsingleton { i // c.Rel i j }",
" ∀ (a b : { i // c.Rel i j }), a = b",
" ⟨i, rik⟩ = ⟨j, rjk⟩"... | [
" c.symm.symm = c",
" c.symm.symm.Rel x✝¹ x✝ ↔ c.Rel x✝¹ x✝",
" j✝ = j'✝",
" i✝ = i'✝",
" Subsingleton { j // c.Rel i j }",
" ∀ (a b : { j // c.Rel i j }), a = b",
" ⟨j, rij⟩ = ⟨k, rik⟩",
" j = k",
" Subsingleton { i // c.Rel i j }",
" ∀ (a b : { i // c.Rel i j }), a = b",
" ⟨i, rik⟩ = ⟨j, rjk⟩"... |
import Mathlib.MeasureTheory.Measure.Typeclasses
#align_import measure_theory.decomposition.unsigned_hahn from "leanprover-community/mathlib"@"0f1becb755b3d008b242c622e248a70556ad19e6"
open Set Filter
open scoped Classical
open Topology ENNReal
namespace MeasureTheory
variable {α : Type*} [MeasurableSpace α] {μ ν : Measure α}
| Mathlib/MeasureTheory/Decomposition/UnsignedHahn.lean | 37 | 176 | theorem hahn_decomposition [IsFiniteMeasure μ] [IsFiniteMeasure ν] :
∃ s,
MeasurableSet s ∧
(∀ t, MeasurableSet t → t ⊆ s → ν t ≤ μ t) ∧ ∀ t, MeasurableSet t → t ⊆ sᶜ → μ t ≤ ν t := by |
let d : Set α → ℝ := fun s => ((μ s).toNNReal : ℝ) - (ν s).toNNReal
let c : Set ℝ := d '' { s | MeasurableSet s }
let γ : ℝ := sSup c
have hμ : ∀ s, μ s ≠ ∞ := measure_ne_top μ
have hν : ∀ s, ν s ≠ ∞ := measure_ne_top ν
have to_nnreal_μ : ∀ s, ((μ s).toNNReal : ℝ≥0∞) = μ s := fun s => ENNReal.coe_toNNReal <| hμ _
have to_nnreal_ν : ∀ s, ((ν s).toNNReal : ℝ≥0∞) = ν s := fun s => ENNReal.coe_toNNReal <| hν _
have d_split : ∀ s t, MeasurableSet s → MeasurableSet t → d s = d (s \ t) + d (s ∩ t) := by
intro s t _hs ht
dsimp only [d]
rw [← measure_inter_add_diff s ht, ← measure_inter_add_diff s ht,
ENNReal.toNNReal_add (hμ _) (hμ _), ENNReal.toNNReal_add (hν _) (hν _), NNReal.coe_add,
NNReal.coe_add]
simp only [sub_eq_add_neg, neg_add]
abel
have d_Union :
∀ s : ℕ → Set α, Monotone s → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋃ n, s n))) := by
intro s hm
refine Tendsto.sub ?_ ?_ <;>
refine NNReal.tendsto_coe.2 <| (ENNReal.tendsto_toNNReal ?_).comp <| tendsto_measure_iUnion hm
· exact hμ _
· exact hν _
have d_Inter :
∀ s : ℕ → Set α,
(∀ n, MeasurableSet (s n)) →
(∀ n m, n ≤ m → s m ⊆ s n) → Tendsto (fun n => d (s n)) atTop (𝓝 (d (⋂ n, s n))) := by
intro s hs hm
refine Tendsto.sub ?_ ?_ <;>
refine
NNReal.tendsto_coe.2 <|
(ENNReal.tendsto_toNNReal <| ?_).comp <| tendsto_measure_iInter hs hm ?_
exacts [hμ _, ⟨0, hμ _⟩, hν _, ⟨0, hν _⟩]
have bdd_c : BddAbove c := by
use (μ univ).toNNReal
rintro r ⟨s, _hs, rfl⟩
refine le_trans (sub_le_self _ <| NNReal.coe_nonneg _) ?_
rw [NNReal.coe_le_coe, ← ENNReal.coe_le_coe, to_nnreal_μ, to_nnreal_μ]
exact measure_mono (subset_univ _)
have c_nonempty : c.Nonempty := Nonempty.image _ ⟨_, MeasurableSet.empty⟩
have d_le_γ : ∀ s, MeasurableSet s → d s ≤ γ := fun s hs => le_csSup bdd_c ⟨s, hs, rfl⟩
have : ∀ n : ℕ, ∃ s : Set α, MeasurableSet s ∧ γ - (1 / 2) ^ n < d s := by
intro n
have : γ - (1 / 2) ^ n < γ := sub_lt_self γ (pow_pos (half_pos zero_lt_one) n)
rcases exists_lt_of_lt_csSup c_nonempty this with ⟨r, ⟨s, hs, rfl⟩, hlt⟩
exact ⟨s, hs, hlt⟩
rcases Classical.axiom_of_choice this with ⟨e, he⟩
change ℕ → Set α at e
have he₁ : ∀ n, MeasurableSet (e n) := fun n => (he n).1
have he₂ : ∀ n, γ - (1 / 2) ^ n < d (e n) := fun n => (he n).2
let f : ℕ → ℕ → Set α := fun n m => (Finset.Ico n (m + 1)).inf e
have hf : ∀ n m, MeasurableSet (f n m) := by
intro n m
simp only [f, Finset.inf_eq_iInf]
exact MeasurableSet.biInter (to_countable _) fun i _ => he₁ _
have f_subset_f : ∀ {a b c d}, a ≤ b → c ≤ d → f a d ⊆ f b c := by
intro a b c d hab hcd
simp_rw [f, Finset.inf_eq_iInf]
exact biInter_subset_biInter_left (Finset.Ico_subset_Ico hab <| Nat.succ_le_succ hcd)
have f_succ : ∀ n m, n ≤ m → f n (m + 1) = f n m ∩ e (m + 1) := by
intro n m hnm
have : n ≤ m + 1 := le_of_lt (Nat.succ_le_succ hnm)
simp_rw [f, Nat.Ico_succ_right_eq_insert_Ico this, Finset.inf_insert, Set.inter_comm]
rfl
have le_d_f : ∀ n m, m ≤ n → γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n ≤ d (f m n) := by
intro n m h
refine Nat.le_induction ?_ ?_ n h
· have := he₂ m
simp_rw [f, Nat.Ico_succ_singleton, Finset.inf_singleton]
linarith
· intro n (hmn : m ≤ n) ih
have : γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) ≤ γ + d (f m (n + 1)) := by
calc
γ + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ (n + 1)) =
γ + (γ - 2 * (1 / 2) ^ m + ((1 / 2) ^ n - (1 / 2) ^ (n + 1))) := by
rw [pow_succ, mul_one_div, _root_.sub_half]
_ = γ - (1 / 2) ^ (n + 1) + (γ - 2 * (1 / 2) ^ m + (1 / 2) ^ n) := by
simp only [sub_eq_add_neg]; abel
_ ≤ d (e (n + 1)) + d (f m n) := add_le_add (le_of_lt <| he₂ _) ih
_ ≤ d (e (n + 1)) + d (f m n \ e (n + 1)) + d (f m (n + 1)) := by
rw [f_succ _ _ hmn, d_split (f m n) (e (n + 1)) (hf _ _) (he₁ _), add_assoc]
_ = d (e (n + 1) ∪ f m n) + d (f m (n + 1)) := by
rw [d_split (e (n + 1) ∪ f m n) (e (n + 1)), union_diff_left, union_inter_cancel_left]
· abel
· exact (he₁ _).union (hf _ _)
· exact he₁ _
_ ≤ γ + d (f m (n + 1)) := add_le_add_right (d_le_γ _ <| (he₁ _).union (hf _ _)) _
exact (add_le_add_iff_left γ).1 this
let s := ⋃ m, ⋂ n, f m n
have γ_le_d_s : γ ≤ d s := by
have hγ : Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 γ) := by
suffices Tendsto (fun m : ℕ => γ - 2 * (1 / 2) ^ m) atTop (𝓝 (γ - 2 * 0)) by
simpa only [mul_zero, tsub_zero]
exact
tendsto_const_nhds.sub <|
tendsto_const_nhds.mul <|
tendsto_pow_atTop_nhds_zero_of_lt_one (le_of_lt <| half_pos <| zero_lt_one)
(half_lt_self zero_lt_one)
have hd : Tendsto (fun m => d (⋂ n, f m n)) atTop (𝓝 (d (⋃ m, ⋂ n, f m n))) := by
refine d_Union _ ?_
exact fun n m hnm =>
subset_iInter fun i => Subset.trans (iInter_subset (f n) i) <| f_subset_f hnm <| le_rfl
refine le_of_tendsto_of_tendsto' hγ hd fun m => ?_
have : Tendsto (fun n => d (f m n)) atTop (𝓝 (d (⋂ n, f m n))) := by
refine d_Inter _ ?_ ?_
· intro n
exact hf _ _
· intro n m hnm
exact f_subset_f le_rfl hnm
refine ge_of_tendsto this (eventually_atTop.2 ⟨m, fun n hmn => ?_⟩)
change γ - 2 * (1 / 2) ^ m ≤ d (f m n)
refine le_trans ?_ (le_d_f _ _ hmn)
exact le_add_of_le_of_nonneg le_rfl (pow_nonneg (le_of_lt <| half_pos <| zero_lt_one) _)
have hs : MeasurableSet s := MeasurableSet.iUnion fun n => MeasurableSet.iInter fun m => hf _ _
refine ⟨s, hs, ?_, ?_⟩
· intro t ht hts
have : 0 ≤ d t :=
(add_le_add_iff_left γ).1 <|
calc
γ + 0 ≤ d s := by rw [add_zero]; exact γ_le_d_s
_ = d (s \ t) + d t := by rw [d_split _ _ hs ht, inter_eq_self_of_subset_right hts]
_ ≤ γ + d t := add_le_add (d_le_γ _ (hs.diff ht)) le_rfl
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, le_sub_iff_add_le, zero_add] using this
· intro t ht hts
have : d t ≤ 0 :=
(add_le_add_iff_left γ).1 <|
calc
γ + d t ≤ d s + d t := by gcongr
_ = d (s ∪ t) := by
rw [d_split _ _ (hs.union ht) ht, union_diff_right, union_inter_cancel_right,
(subset_compl_iff_disjoint_left.1 hts).sdiff_eq_left]
_ ≤ γ + 0 := by rw [add_zero]; exact d_le_γ _ (hs.union ht)
rw [← to_nnreal_μ, ← to_nnreal_ν, ENNReal.coe_le_coe, ← NNReal.coe_le_coe]
simpa only [d, sub_le_iff_le_add, zero_add] using this
| [
" ∃ s,\n MeasurableSet s ∧\n (∀ (t : Set α), MeasurableSet t → t ⊆ s → ν t ≤ μ t) ∧ ∀ (t : Set α), MeasurableSet t → t ⊆ sᶜ → μ t ≤ ν t",
" ∀ (s t : Set α), MeasurableSet s → MeasurableSet t → d s = d (s \\ t) + d (s ∩ t)",
" d s = d (s \\ t) + d (s ∩ t)",
" ↑(μ s).toNNReal - ↑(ν s).toNNReal =\n ↑(... | [] |
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.Algebra.GradedMonoid
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Equiv
import Mathlib.Algebra.MvPolynomial.Variables
import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous
import Mathlib.Algebra.Polynomial.Roots
#align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
namespace MvPolynomial
variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*}
def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i
theorem weightedDegree_one (d : σ →₀ ℕ) :
weightedDegree 1 d = degree d := by
simp [weightedDegree, degree, Finsupp.total, Finsupp.sum]
def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) :=
IsWeightedHomogeneous 1 φ n
#align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous
variable [CommSemiring R]
theorem weightedTotalDegree_one (φ : MvPolynomial σ R) :
weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by
simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe,
Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe,
id, Algebra.id.smul_eq_mul, mul_one]
variable (σ R)
def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where
carrier := { x | x.IsHomogeneous n }
smul_mem' r a ha c hc := by
rw [coeff_smul] at hc
apply ha
intro h
apply hc
rw [h]
exact smul_zero r
zero_mem' d hd := False.elim (hd <| coeff_zero _)
add_mem' {a b} ha hb c hc := by
rw [coeff_add] at hc
obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by
contrapose! hc
simp only [hc, add_zero]
· exact ha h
· exact hb h
#align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule
@[simp]
lemma weightedHomogeneousSubmodule_one (n : ℕ) :
weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl
variable {σ R}
@[simp]
theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) :
p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl
#align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule
variable (σ R)
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by
simp_rw [← weightedDegree_one]
exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
#align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported
variable {σ R}
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) :=
weightedHomogeneousSubmodule_mul 1 m n
#align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul
section
variable [CommSemiring R]
theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) :
IsHomogeneous (monomial d r) n := by
simp_rw [← weightedDegree_one] at hn
exact isWeightedHomogeneous_monomial 1 d r hn
#align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial
variable (σ)
theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} :
p.totalDegree = 0 ↔ IsHomogeneous p 0 := by
rw [← weightedTotalDegree_one,
← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous]
alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous
#align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero
theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial σ R) 0 := by
apply isHomogeneous_monomial
simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.is_homogeneous_C MvPolynomial.isHomogeneous_C
variable (R)
theorem isHomogeneous_zero (n : ℕ) : IsHomogeneous (0 : MvPolynomial σ R) n :=
(homogeneousSubmodule σ R n).zero_mem
#align mv_polynomial.is_homogeneous_zero MvPolynomial.isHomogeneous_zero
theorem isHomogeneous_one : IsHomogeneous (1 : MvPolynomial σ R) 0 :=
isHomogeneous_C _ _
#align mv_polynomial.is_homogeneous_one MvPolynomial.isHomogeneous_one
variable {σ}
theorem isHomogeneous_X (i : σ) : IsHomogeneous (X i : MvPolynomial σ R) 1 := by
apply isHomogeneous_monomial
rw [degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton]
exact Finsupp.single_eq_same
set_option linter.uppercaseLean3 false in
#align mv_polynomial.is_homogeneous_X MvPolynomial.isHomogeneous_X
end
namespace IsHomogeneous
variable [CommSemiring R] [CommSemiring S] {φ ψ : MvPolynomial σ R} {m n : ℕ}
| Mathlib/RingTheory/MvPolynomial/Homogeneous.lean | 163 | 166 | theorem coeff_eq_zero (hφ : IsHomogeneous φ n) {d : σ →₀ ℕ} (hd : degree d ≠ n) :
coeff d φ = 0 := by |
simp_rw [← weightedDegree_one] at hd
exact IsWeightedHomogeneous.coeff_eq_zero hφ d hd
| [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 φ = φ.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a ≠ 0 ∨ coeff c b ≠ 0",
" coeff c a + coeff c b = 0",
" coeff c a ≠ 0",
" False",
" r • coeff c a = 0",
" r • 0 = 0",
" homogeneousSubmodule σ R n = Finsupp.supported R R {d | deg... | [
" (weightedDegree 1) d = degree d",
" weightedTotalDegree 1 φ = φ.totalDegree",
" (weightedDegree 1) c = n",
" coeff c a ≠ 0 ∨ coeff c b ≠ 0",
" coeff c a + coeff c b = 0",
" coeff c a ≠ 0",
" False",
" r • coeff c a = 0",
" r • 0 = 0",
" homogeneousSubmodule σ R n = Finsupp.supported R R {d | deg... |
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
| Mathlib/Algebra/MvPolynomial/Variables.lean | 93 | 94 | theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by |
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
| [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = ∅",
" ((monomial s) r).vars = s.support",
" (C r).vars = ∅",
" (X n).vars = {n}"
] | [
" p.vars = p.degrees.toFinset",
" p.degrees.toFinset = p.degrees.toFinset",
" vars 0 = ∅",
" ((monomial s) r).vars = s.support",
" (C r).vars = ∅"
] |
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.RingTheory.Localization.FractionRing
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
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] [IsDomain R] {p q : R[X]}
section Roots
open Multiset Finset
noncomputable def roots (p : R[X]) : Multiset R :=
haveI := Classical.decEq R
haveI := Classical.dec (p = 0)
if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h)
#align polynomial.roots Polynomial.roots
theorem roots_def [DecidableEq R] (p : R[X]) [Decidable (p = 0)] :
p.roots = if h : p = 0 then ∅ else Classical.choose (exists_multiset_roots h) := by
-- porting noteL `‹_›` doesn't work for instance arguments
rename_i iR ip0
obtain rfl := Subsingleton.elim iR (Classical.decEq R)
obtain rfl := Subsingleton.elim ip0 (Classical.dec (p = 0))
rfl
#align polynomial.roots_def Polynomial.roots_def
@[simp]
theorem roots_zero : (0 : R[X]).roots = 0 :=
dif_pos rfl
#align polynomial.roots_zero Polynomial.roots_zero
theorem card_roots (hp0 : p ≠ 0) : (Multiset.card (roots p) : WithBot ℕ) ≤ degree p := by
classical
unfold roots
rw [dif_neg hp0]
exact (Classical.choose_spec (exists_multiset_roots hp0)).1
#align polynomial.card_roots Polynomial.card_roots
theorem card_roots' (p : R[X]) : Multiset.card p.roots ≤ natDegree p := by
by_cases hp0 : p = 0
· simp [hp0]
exact WithBot.coe_le_coe.1 (le_trans (card_roots hp0) (le_of_eq <| degree_eq_natDegree hp0))
#align polynomial.card_roots' Polynomial.card_roots'
theorem card_roots_sub_C {p : R[X]} {a : R} (hp0 : 0 < degree p) :
(Multiset.card (p - C a).roots : WithBot ℕ) ≤ degree p :=
calc
(Multiset.card (p - C a).roots : WithBot ℕ) ≤ degree (p - C a) :=
card_roots <| mt sub_eq_zero.1 fun h => not_le_of_gt hp0 <| h.symm ▸ degree_C_le
_ = degree p := by rw [sub_eq_add_neg, ← C_neg]; exact degree_add_C hp0
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C Polynomial.card_roots_sub_C
theorem card_roots_sub_C' {p : R[X]} {a : R} (hp0 : 0 < degree p) :
Multiset.card (p - C a).roots ≤ natDegree p :=
WithBot.coe_le_coe.1
(le_trans (card_roots_sub_C hp0)
(le_of_eq <| degree_eq_natDegree fun h => by simp_all [lt_irrefl]))
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C' Polynomial.card_roots_sub_C'
@[simp]
theorem count_roots [DecidableEq R] (p : R[X]) : p.roots.count a = rootMultiplicity a p := by
classical
by_cases hp : p = 0
· simp [hp]
rw [roots_def, dif_neg hp]
exact (Classical.choose_spec (exists_multiset_roots hp)).2 a
#align polynomial.count_roots Polynomial.count_roots
@[simp]
theorem mem_roots' : a ∈ p.roots ↔ p ≠ 0 ∧ IsRoot p a := by
classical
rw [← count_pos, count_roots p, rootMultiplicity_pos']
#align polynomial.mem_roots' Polynomial.mem_roots'
theorem mem_roots (hp : p ≠ 0) : a ∈ p.roots ↔ IsRoot p a :=
mem_roots'.trans <| and_iff_right hp
#align polynomial.mem_roots Polynomial.mem_roots
theorem ne_zero_of_mem_roots (h : a ∈ p.roots) : p ≠ 0 :=
(mem_roots'.1 h).1
#align polynomial.ne_zero_of_mem_roots Polynomial.ne_zero_of_mem_roots
theorem isRoot_of_mem_roots (h : a ∈ p.roots) : IsRoot p a :=
(mem_roots'.1 h).2
#align polynomial.is_root_of_mem_roots Polynomial.isRoot_of_mem_roots
-- Porting note: added during port.
lemma mem_roots_iff_aeval_eq_zero {x : R} (w : p ≠ 0) : x ∈ roots p ↔ aeval x p = 0 := by
rw [mem_roots w, IsRoot.def, aeval_def, eval₂_eq_eval_map]
simp
theorem card_le_degree_of_subset_roots {p : R[X]} {Z : Finset R} (h : Z.val ⊆ p.roots) :
Z.card ≤ p.natDegree :=
(Multiset.card_le_card (Finset.val_le_iff_val_subset.2 h)).trans (Polynomial.card_roots' p)
#align polynomial.card_le_degree_of_subset_roots Polynomial.card_le_degree_of_subset_roots
| Mathlib/Algebra/Polynomial/Roots.lean | 136 | 139 | theorem finite_setOf_isRoot {p : R[X]} (hp : p ≠ 0) : Set.Finite { x | IsRoot p x } := by |
classical
simpa only [← Finset.setOf_mem, Multiset.mem_toFinset, mem_roots hp]
using p.roots.toFinset.finite_toSet
| [
" p.roots = if h : p = 0 then ∅ else Classical.choose ⋯",
" ↑(Multiset.card p.roots) ≤ p.degree",
" ↑(Multiset.card (if h : p = 0 then ∅ else Classical.choose ⋯)) ≤ p.degree",
" ↑(Multiset.card (Classical.choose ⋯)) ≤ p.degree",
" Multiset.card p.roots ≤ p.natDegree",
" (p - C a).degree = p.degree",
" (... | [
" p.roots = if h : p = 0 then ∅ else Classical.choose ⋯",
" ↑(Multiset.card p.roots) ≤ p.degree",
" ↑(Multiset.card (if h : p = 0 then ∅ else Classical.choose ⋯)) ≤ p.degree",
" ↑(Multiset.card (Classical.choose ⋯)) ≤ p.degree",
" Multiset.card p.roots ≤ p.natDegree",
" (p - C a).degree = p.degree",
" (... |
import Mathlib.Algebra.Lie.OfAssociative
import Mathlib.Algebra.Lie.IdealOperations
#align_import algebra.lie.abelian from "leanprover-community/mathlib"@"8983bec7cdf6cb2dd1f21315c8a34ab00d7b2f6d"
universe u v w w₁ w₂
class LieModule.IsTrivial (L : Type v) (M : Type w) [Bracket L M] [Zero M] : Prop where
trivial : ∀ (x : L) (m : M), ⁅x, m⁆ = 0
#align lie_module.is_trivial LieModule.IsTrivial
@[simp]
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
(x : L) (m : M) : ⁅x, m⁆ = 0 :=
LieModule.IsTrivial.trivial x m
#align trivial_lie_zero trivial_lie_zero
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=
⟨fun x m ↦ by rw [Subsingleton.eq_zero x, zero_lie]⟩
instance LieModule.instIsTrivialOfSubsingleton' {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton M] : LieModule.IsTrivial L M :=
⟨fun x m ↦ by simp_rw [Subsingleton.eq_zero m, lie_zero]⟩
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=
LieModule.IsTrivial L L
#align is_lie_abelian IsLieAbelian
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
[LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
trivial x y := by apply h.trivial
#align lie_ideal.is_lie_abelian_of_trivial LieIdeal.isLieAbelian_of_trivial
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
(h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁ :=
{ trivial := fun x y => h₁ <|
calc
f ⁅x, y⁆ = ⁅f x, f y⁆ := LieHom.map_lie f x y
_ = 0 := trivial_lie_zero _ _ _ _
_ = f 0 := f.map_zero.symm}
#align function.injective.is_lie_abelian Function.Injective.isLieAbelian
theorem Function.Surjective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
(h₁ : Function.Surjective f) (h₂ : IsLieAbelian L₁) : IsLieAbelian L₂ :=
{ trivial := fun x y => by
obtain ⟨u, rfl⟩ := h₁ x
obtain ⟨v, rfl⟩ := h₁ y
rw [← LieHom.map_lie, trivial_lie_zero, LieHom.map_zero] }
#align function.surjective.is_lie_abelian Function.Surjective.isLieAbelian
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
IsLieAbelian L₁ ↔ IsLieAbelian L₂ :=
⟨e.symm.injective.isLieAbelian, e.injective.isLieAbelian⟩
#align lie_abelian_iff_equiv_lie_abelian lie_abelian_iff_equiv_lie_abelian
theorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :
Std.Commutative (α := A) (· * ·) ↔ IsLieAbelian A := by
have h₁ : Std.Commutative (α := A) (· * ·) ↔ ∀ a b : A, a * b = b * a :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
have h₂ : IsLieAbelian A ↔ ∀ a b : A, ⁅a, b⁆ = 0 := ⟨fun h => h.1, fun h => ⟨h⟩⟩
simp only [h₁, h₂, LieRing.of_associative_ring_bracket, sub_eq_zero]
#align commutative_ring_iff_abelian_lie_ring commutative_ring_iff_abelian_lie_ring
section Center
variable (R : Type u) (L : Type v) (M : Type w) (N : Type w₁)
variable [CommRing R] [LieRing L] [LieAlgebra R L]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
variable [AddCommGroup N] [Module R N] [LieRingModule L N] [LieModule R L N]
section IdealOperations
open LieSubmodule LieSubalgebra
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]
variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L)
@[simp]
| Mathlib/Algebra/Lie/Abelian.lean | 312 | 315 | theorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : ⁅I, N⁆ = ⊥ := by |
suffices ⁅I, N⁆ ≤ ⊥ from le_bot_iff.mp this
rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]
rintro m ⟨x, n, h⟩; rw [trivial_lie_zero] at h; simp [← h]
| [
" ⁅x, m⁆ = 0",
" ⁅x, y⁆ = 0",
" ⁅f u, y⁆ = 0",
" ⁅f u, f v⁆ = 0",
" (Std.Commutative fun x x_1 => x * x_1) ↔ IsLieAbelian A",
" ⁅I, N⁆ = ⊥",
" ⁅I, N⁆ ≤ ⊥",
" {m | ∃ x n, ⁅↑x, ↑n⁆ = m} ⊆ ↑⊥",
" m ∈ ↑⊥"
] | [
" ⁅x, m⁆ = 0",
" ⁅x, y⁆ = 0",
" ⁅f u, y⁆ = 0",
" ⁅f u, f v⁆ = 0",
" (Std.Commutative fun x x_1 => x * x_1) ↔ IsLieAbelian A"
] |
import Mathlib.Geometry.Euclidean.Sphere.Basic
#align_import geometry.euclidean.sphere.second_inter from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open RealInnerProductSpace
namespace EuclideanGeometry
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P]
def Sphere.secondInter (s : Sphere P) (p : P) (v : V) : P :=
(-2 * ⟪v, p -ᵥ s.center⟫ / ⟪v, v⟫) • v +ᵥ p
#align euclidean_geometry.sphere.second_inter EuclideanGeometry.Sphere.secondInter
@[simp]
theorem Sphere.secondInter_dist (s : Sphere P) (p : P) (v : V) :
dist (s.secondInter p v) s.center = dist p s.center := by
rw [Sphere.secondInter]
by_cases hv : v = 0; · simp [hv]
rw [dist_smul_vadd_eq_dist _ _ hv]
exact Or.inr rfl
#align euclidean_geometry.sphere.second_inter_dist EuclideanGeometry.Sphere.secondInter_dist
@[simp]
theorem Sphere.secondInter_mem {s : Sphere P} {p : P} (v : V) : s.secondInter p v ∈ s ↔ p ∈ s := by
simp_rw [mem_sphere, Sphere.secondInter_dist]
#align euclidean_geometry.sphere.second_inter_mem EuclideanGeometry.Sphere.secondInter_mem
variable (V)
@[simp]
theorem Sphere.secondInter_zero (s : Sphere P) (p : P) : s.secondInter p (0 : V) = p := by
simp [Sphere.secondInter]
#align euclidean_geometry.sphere.second_inter_zero EuclideanGeometry.Sphere.secondInter_zero
variable {V}
theorem Sphere.secondInter_eq_self_iff {s : Sphere P} {p : P} {v : V} :
s.secondInter p v = p ↔ ⟪v, p -ᵥ s.center⟫ = 0 := by
refine ⟨fun hp => ?_, fun hp => ?_⟩
· by_cases hv : v = 0
· simp [hv]
rwa [Sphere.secondInter, eq_comm, eq_vadd_iff_vsub_eq, vsub_self, eq_comm, smul_eq_zero,
or_iff_left hv, div_eq_zero_iff, inner_self_eq_zero, or_iff_left hv, mul_eq_zero,
or_iff_right (by norm_num : (-2 : ℝ) ≠ 0)] at hp
· rw [Sphere.secondInter, hp, mul_zero, zero_div, zero_smul, zero_vadd]
#align euclidean_geometry.sphere.second_inter_eq_self_iff EuclideanGeometry.Sphere.secondInter_eq_self_iff
| Mathlib/Geometry/Euclidean/Sphere/SecondInter.lean | 82 | 98 | theorem Sphere.eq_or_eq_secondInter_of_mem_mk'_span_singleton_iff_mem {s : Sphere P} {p : P}
(hp : p ∈ s) {v : V} {p' : P} (hp' : p' ∈ AffineSubspace.mk' p (ℝ ∙ v)) :
p' = p ∨ p' = s.secondInter p v ↔ p' ∈ s := by |
refine ⟨fun h => ?_, fun h => ?_⟩
· rcases h with (h | h)
· rwa [h]
· rwa [h, Sphere.secondInter_mem]
· rw [AffineSubspace.mem_mk'_iff_vsub_mem, Submodule.mem_span_singleton] at hp'
rcases hp' with ⟨r, hr⟩
rw [eq_comm, ← eq_vadd_iff_vsub_eq] at hr
subst hr
by_cases hv : v = 0
· simp [hv]
rw [Sphere.secondInter]
rw [mem_sphere] at h hp
rw [← hp, dist_smul_vadd_eq_dist _ _ hv] at h
rcases h with (h | h) <;> simp [h]
| [
" dist (s.secondInter p v) s.center = dist p s.center",
" dist ((-2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ) • v +ᵥ p) s.center = dist p s.center",
" -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ = 0 ∨ -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ = -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ",
" s.secondInter p v ∈ s ↔ p ∈ s",
" s.secon... | [
" dist (s.secondInter p v) s.center = dist p s.center",
" dist ((-2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ) • v +ᵥ p) s.center = dist p s.center",
" -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ = 0 ∨ -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ = -2 * ⟪v, p -ᵥ s.center⟫_ℝ / ⟪v, v⟫_ℝ",
" s.secondInter p v ∈ s ↔ p ∈ s",
" s.secon... |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
theorem intervalIntegrable_iff' [NoAtoms μ] :
IntervalIntegrable f μ a b ↔ IntegrableOn f (uIcc a b) μ := by
rw [intervalIntegrable_iff, ← Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff' intervalIntegrable_iff'
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 103 | 105 | theorem intervalIntegrable_iff_integrableOn_Icc_of_le {f : ℝ → E} {a b : ℝ} (hab : a ≤ b)
{μ : Measure ℝ} [NoAtoms μ] : IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ := by |
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioc]
| [
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f [[a, b]] μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ"
] | [
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f [[a, b]] μ"
] |
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
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
#align measure_theory.fin_meas_additive.add MeasureTheory.FinMeasAdditive.add
theorem smul [Monoid 𝕜] [DistribMulAction 𝕜 β] (hT : FinMeasAdditive μ T) (c : 𝕜) :
FinMeasAdditive μ fun s => c • T s := fun s t hs ht hμs hμt hst => by
simp [hT s t hs ht hμs hμt hst]
#align measure_theory.fin_meas_additive.smul MeasureTheory.FinMeasAdditive.smul
theorem of_eq_top_imp_eq_top {μ' : Measure α} (h : ∀ s, MeasurableSet s → μ s = ∞ → μ' s = ∞)
(hT : FinMeasAdditive μ T) : FinMeasAdditive μ' T := fun s t hs ht hμ's hμ't hst =>
hT s t hs ht (mt (h s hs) hμ's) (mt (h t ht) hμ't) hst
#align measure_theory.fin_meas_additive.of_eq_top_imp_eq_top MeasureTheory.FinMeasAdditive.of_eq_top_imp_eq_top
theorem of_smul_measure (c : ℝ≥0∞) (hc_ne_top : c ≠ ∞) (hT : FinMeasAdditive (c • μ) T) :
FinMeasAdditive μ T := by
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top] at hμs
simp only [hc_ne_top, or_false_iff, Ne, false_and_iff] at hμs
exact hμs.2
#align measure_theory.fin_meas_additive.of_smul_measure MeasureTheory.FinMeasAdditive.of_smul_measure
| Mathlib/MeasureTheory/Integral/SetToL1.lean | 130 | 135 | theorem smul_measure (c : ℝ≥0∞) (hc_ne_zero : c ≠ 0) (hT : FinMeasAdditive μ T) :
FinMeasAdditive (c • μ) T := by |
refine of_eq_top_imp_eq_top (fun s _ hμs => ?_) hT
rw [Measure.smul_apply, smul_eq_mul, ENNReal.mul_eq_top]
simp only [hc_ne_zero, true_and_iff, Ne, not_false_iff]
exact Or.inl hμs
| [
" 0 (s ∪ t) = 0 s + 0 t",
" FinMeasAdditive μ (T + T')",
" (T + T') (s ∪ t) = (T + T') s + (T + T') t",
" T s + T t + (T' s + T' t) = T s + T' s + (T t + T' t)",
" (fun s => c • T s) (s ∪ t) = (fun s => c • T s) s + (fun s => c • T s) t",
" FinMeasAdditive μ T",
" μ s = ⊤",
" FinMeasAdditive (c • μ) T... | [
" 0 (s ∪ t) = 0 s + 0 t",
" FinMeasAdditive μ (T + T')",
" (T + T') (s ∪ t) = (T + T') s + (T + T') t",
" T s + T t + (T' s + T' t) = T s + T' s + (T t + T' t)",
" (fun s => c • T s) (s ∪ t) = (fun s => c • T s) s + (fun s => c • T s) t",
" FinMeasAdditive μ T",
" μ s = ⊤"
] |
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Relator
import Mathlib.Init.Data.Quot
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Use
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.SimpRw
#align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Function
variable {α β γ δ ε ζ : Type*}
namespace Relation
section Comp
variable {r : α → β → Prop} {p : β → γ → Prop} {q : γ → δ → Prop}
def Comp (r : α → β → Prop) (p : β → γ → Prop) (a : α) (c : γ) : Prop :=
∃ b, r a b ∧ p b c
#align relation.comp Relation.Comp
@[inherit_doc]
local infixr:80 " ∘r " => Relation.Comp
theorem comp_eq : r ∘r (· = ·) = r :=
funext fun _ ↦ funext fun b ↦ propext <|
Iff.intro (fun ⟨_, h, Eq⟩ ↦ Eq ▸ h) fun h ↦ ⟨b, h, rfl⟩
#align relation.comp_eq Relation.comp_eq
theorem eq_comp : (· = ·) ∘r r = r :=
funext fun a ↦ funext fun _ ↦ propext <|
Iff.intro (fun ⟨_, Eq, h⟩ ↦ Eq.symm ▸ h) fun h ↦ ⟨a, rfl, h⟩
#align relation.eq_comp Relation.eq_comp
theorem iff_comp {r : Prop → α → Prop} : (· ↔ ·) ∘r r = r := by
have : (· ↔ ·) = (· = ·) := by funext a b; exact iff_eq_eq
rw [this, eq_comp]
#align relation.iff_comp Relation.iff_comp
| Mathlib/Logic/Relation.lean | 154 | 156 | theorem comp_iff {r : α → Prop → Prop} : r ∘r (· ↔ ·) = r := by |
have : (· ↔ ·) = (· = ·) := by funext a b; exact iff_eq_eq
rw [this, comp_eq]
| [
" (fun x x_1 => x ↔ x_1) ∘r r = r",
" (fun x x_1 => x ↔ x_1) = fun x x_1 => x = x_1",
" (a ↔ b) = (a = b)",
" (r ∘r fun x x_1 => x ↔ x_1) = r"
] | [
" (fun x x_1 => x ↔ x_1) ∘r r = r",
" (fun x x_1 => x ↔ x_1) = fun x x_1 => x = x_1",
" (a ↔ b) = (a = b)"
] |
import Mathlib.Algebra.Group.Aut
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Logic.Function.Basic
#align_import group_theory.semidirect_product from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable (N : Type*) (G : Type*) {H : Type*} [Group N] [Group G] [Group H]
@[ext]
structure SemidirectProduct (φ : G →* MulAut N) where
left : N
right : G
deriving DecidableEq
#align semidirect_product SemidirectProduct
-- Porting note: these lemmas are autogenerated by the inductive definition and are not
-- in simple form due to the existence of mk_eq_inl_mul_inr
attribute [nolint simpNF] SemidirectProduct.mk.injEq
attribute [nolint simpNF] SemidirectProduct.mk.sizeOf_spec
-- Porting note: unknown attribute
-- attribute [pp_using_anonymous_constructor] SemidirectProduct
@[inherit_doc]
notation:35 N " ⋊[" φ:35 "] " G:35 => SemidirectProduct N G φ
namespace SemidirectProduct
variable {N G}
variable {φ : G →* MulAut N}
instance : Mul (SemidirectProduct N G φ) where
mul a b := ⟨a.1 * φ a.2 b.1, a.2 * b.2⟩
lemma mul_def (a b : SemidirectProduct N G φ) : a * b = ⟨a.1 * φ a.2 b.1, a.2 * b.2⟩ := rfl
@[simp]
theorem mul_left (a b : N ⋊[φ] G) : (a * b).left = a.left * φ a.right b.left := rfl
#align semidirect_product.mul_left SemidirectProduct.mul_left
@[simp]
theorem mul_right (a b : N ⋊[φ] G) : (a * b).right = a.right * b.right := rfl
#align semidirect_product.mul_right SemidirectProduct.mul_right
instance : One (SemidirectProduct N G φ) where one := ⟨1, 1⟩
@[simp]
theorem one_left : (1 : N ⋊[φ] G).left = 1 := rfl
#align semidirect_product.one_left SemidirectProduct.one_left
@[simp]
theorem one_right : (1 : N ⋊[φ] G).right = 1 := rfl
#align semidirect_product.one_right SemidirectProduct.one_right
instance : Inv (SemidirectProduct N G φ) where
inv x := ⟨φ x.2⁻¹ x.1⁻¹, x.2⁻¹⟩
@[simp]
theorem inv_left (a : N ⋊[φ] G) : a⁻¹.left = φ a.right⁻¹ a.left⁻¹ := rfl
#align semidirect_product.inv_left SemidirectProduct.inv_left
@[simp]
theorem inv_right (a : N ⋊[φ] G) : a⁻¹.right = a.right⁻¹ := rfl
#align semidirect_product.inv_right SemidirectProduct.inv_right
instance : Group (N ⋊[φ] G) where
mul_assoc a b c := SemidirectProduct.ext _ _ (by simp [mul_assoc]) (by simp [mul_assoc])
one_mul a := SemidirectProduct.ext _ _ (by simp) (one_mul a.2)
mul_one a := SemidirectProduct.ext _ _ (by simp) (mul_one _)
mul_left_inv a := SemidirectProduct.ext _ _ (by simp) (by simp)
instance : Inhabited (N ⋊[φ] G) := ⟨1⟩
def inl : N →* N ⋊[φ] G where
toFun n := ⟨n, 1⟩
map_one' := rfl
map_mul' := by intros; ext <;>
simp only [mul_left, map_one, MulAut.one_apply, mul_right, mul_one]
#align semidirect_product.inl SemidirectProduct.inl
@[simp]
theorem left_inl (n : N) : (inl n : N ⋊[φ] G).left = n := rfl
#align semidirect_product.left_inl SemidirectProduct.left_inl
@[simp]
theorem right_inl (n : N) : (inl n : N ⋊[φ] G).right = 1 := rfl
#align semidirect_product.right_inl SemidirectProduct.right_inl
theorem inl_injective : Function.Injective (inl : N → N ⋊[φ] G) :=
Function.injective_iff_hasLeftInverse.2 ⟨left, left_inl⟩
#align semidirect_product.inl_injective SemidirectProduct.inl_injective
@[simp]
theorem inl_inj {n₁ n₂ : N} : (inl n₁ : N ⋊[φ] G) = inl n₂ ↔ n₁ = n₂ :=
inl_injective.eq_iff
#align semidirect_product.inl_inj SemidirectProduct.inl_inj
def inr : G →* N ⋊[φ] G where
toFun g := ⟨1, g⟩
map_one' := rfl
map_mul' := by intros; ext <;> simp
#align semidirect_product.inr SemidirectProduct.inr
@[simp]
theorem left_inr (g : G) : (inr g : N ⋊[φ] G).left = 1 := rfl
#align semidirect_product.left_inr SemidirectProduct.left_inr
@[simp]
theorem right_inr (g : G) : (inr g : N ⋊[φ] G).right = g := rfl
#align semidirect_product.right_inr SemidirectProduct.right_inr
theorem inr_injective : Function.Injective (inr : G → N ⋊[φ] G) :=
Function.injective_iff_hasLeftInverse.2 ⟨right, right_inr⟩
#align semidirect_product.inr_injective SemidirectProduct.inr_injective
@[simp]
theorem inr_inj {g₁ g₂ : G} : (inr g₁ : N ⋊[φ] G) = inr g₂ ↔ g₁ = g₂ :=
inr_injective.eq_iff
#align semidirect_product.inr_inj SemidirectProduct.inr_inj
theorem inl_aut (g : G) (n : N) : (inl (φ g n) : N ⋊[φ] G) = inr g * inl n * inr g⁻¹ := by
ext <;> simp
#align semidirect_product.inl_aut SemidirectProduct.inl_aut
| Mathlib/GroupTheory/SemidirectProduct.lean | 161 | 162 | theorem inl_aut_inv (g : G) (n : N) : (inl ((φ g)⁻¹ n) : N ⋊[φ] G) = inr g⁻¹ * inl n * inr g := by |
rw [← MonoidHom.map_inv, inl_aut, inv_inv]
| [
" (a * b * c).left = (a * (b * c)).left",
" (a * b * c).right = (a * (b * c)).right",
" (1 * a).left = a.left",
" (a * 1).left = a.left",
" (a⁻¹ * a).left = left 1",
" (a⁻¹ * a).right = right 1",
" ∀ (x y : N),\n { toFun := fun n => { left := n, right := 1 }, map_one' := ⋯ }.toFun (x * y) =\n { ... | [
" (a * b * c).left = (a * (b * c)).left",
" (a * b * c).right = (a * (b * c)).right",
" (1 * a).left = a.left",
" (a * 1).left = a.left",
" (a⁻¹ * a).left = left 1",
" (a⁻¹ * a).right = right 1",
" ∀ (x y : N),\n { toFun := fun n => { left := n, right := 1 }, map_one' := ⋯ }.toFun (x * y) =\n { ... |
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Monoidal.Functor
#align_import category_theory.monoidal.preadditive from "leanprover-community/mathlib"@"986c4d5761f938b2e1c43c01f001b6d9d88c2055"
noncomputable section
open scoped Classical
namespace CategoryTheory
open CategoryTheory.Limits
open CategoryTheory.MonoidalCategory
variable (C : Type*) [Category C] [Preadditive C] [MonoidalCategory C]
class MonoidalPreadditive : Prop where
whiskerLeft_zero : ∀ {X Y Z : C}, X ◁ (0 : Y ⟶ Z) = 0 := by aesop_cat
zero_whiskerRight : ∀ {X Y Z : C}, (0 : Y ⟶ Z) ▷ X = 0 := by aesop_cat
whiskerLeft_add : ∀ {X Y Z : C} (f g : Y ⟶ Z), X ◁ (f + g) = X ◁ f + X ◁ g := by aesop_cat
add_whiskerRight : ∀ {X Y Z : C} (f g : Y ⟶ Z), (f + g) ▷ X = f ▷ X + g ▷ X := by aesop_cat
#align category_theory.monoidal_preadditive CategoryTheory.MonoidalPreadditive
attribute [simp] MonoidalPreadditive.whiskerLeft_zero MonoidalPreadditive.zero_whiskerRight
attribute [simp] MonoidalPreadditive.whiskerLeft_add MonoidalPreadditive.add_whiskerRight
variable {C}
variable [MonoidalPreadditive C]
namespace MonoidalPreadditive
-- The priority setting will not be needed when we replace `𝟙 X ⊗ f` by `X ◁ f`.
@[simp (low)]
theorem tensor_zero {W X Y Z : C} (f : W ⟶ X) : f ⊗ (0 : Y ⟶ Z) = 0 := by
simp [tensorHom_def]
-- The priority setting will not be needed when we replace `f ⊗ 𝟙 X` by `f ▷ X`.
@[simp (low)]
theorem zero_tensor {W X Y Z : C} (f : Y ⟶ Z) : (0 : W ⟶ X) ⊗ f = 0 := by
simp [tensorHom_def]
| Mathlib/CategoryTheory/Monoidal/Preadditive.lean | 60 | 61 | theorem tensor_add {W X Y Z : C} (f : W ⟶ X) (g h : Y ⟶ Z) : f ⊗ (g + h) = f ⊗ g + f ⊗ h := by |
simp [tensorHom_def]
| [
" f ⊗ 0 = 0",
" 0 ⊗ f = 0",
" f ⊗ (g + h) = f ⊗ g + f ⊗ h"
] | [
" f ⊗ 0 = 0",
" 0 ⊗ f = 0"
] |
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Finset.Powerset
#align_import data.fintype.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
variable {α : Type*} [DecidableEq α]
open List
namespace Multiset
def lists : Multiset α → Finset (List α) := fun s =>
Quotient.liftOn s (fun l => l.permutations.toFinset) fun l l' (h : l ~ l') => by
ext sl
simp only [mem_permutations, List.mem_toFinset]
exact ⟨fun hs => hs.trans h, fun hs => hs.trans h.symm⟩
#align multiset.lists Multiset.lists
@[simp]
theorem lists_coe (l : List α) : lists (l : Multiset α) = l.permutations.toFinset :=
rfl
#align multiset.lists_coe Multiset.lists_coe
@[simp]
| Mathlib/Data/Fintype/List.lean | 51 | 53 | theorem mem_lists_iff (s : Multiset α) (l : List α) : l ∈ lists s ↔ s = ⟦l⟧ := by |
induction s using Quotient.inductionOn
simpa using perm_comm
| [
" (fun l => l.permutations.toFinset) l = (fun l => l.permutations.toFinset) l'",
" sl ∈ (fun l => l.permutations.toFinset) l ↔ sl ∈ (fun l => l.permutations.toFinset) l'",
" sl ~ l ↔ sl ~ l'",
" l ∈ s.lists ↔ s = ⟦l⟧",
" l ∈ lists ⟦a✝⟧ ↔ ⟦a✝⟧ = ⟦l⟧"
] | [
" (fun l => l.permutations.toFinset) l = (fun l => l.permutations.toFinset) l'",
" sl ∈ (fun l => l.permutations.toFinset) l ↔ sl ∈ (fun l => l.permutations.toFinset) l'",
" sl ~ l ↔ sl ~ l'"
] |
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]
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 276 | 280 | 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]
| [
" descPochhammer R 1 = X",
" descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1)",
" (descPochhammer R n).Monic",
" (descPochhammer R 0).Monic",
" (descPochhammer R (n + 1)).Monic",
" map f (descPochhammer R n) = descPochhammer T n",
" map f (descPochhammer R 0) = descPochhammer T 0",
" m... | [
" descPochhammer R 1 = X",
" descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1)",
" (descPochhammer R n).Monic",
" (descPochhammer R 0).Monic",
" (descPochhammer R (n + 1)).Monic"
] |
import Mathlib.Data.Nat.Squarefree
import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity
import Mathlib.Tactic.LinearCombination
#align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
section NegOneSquare
-- This could be formulated for a general integer `a` in place of `-1`,
-- but it would not directly specialize to `-1`,
-- because `((-1 : ℤ) : ZMod n)` is not the same as `(-1 : ZMod n)`.
theorem ZMod.isSquare_neg_one_of_dvd {m n : ℕ} (hd : m ∣ n) (hs : IsSquare (-1 : ZMod n)) :
IsSquare (-1 : ZMod m) := by
let f : ZMod n →+* ZMod m := ZMod.castHom hd _
rw [← RingHom.map_one f, ← RingHom.map_neg]
exact hs.map f
#align zmod.is_square_neg_one_of_dvd ZMod.isSquare_neg_one_of_dvd
theorem ZMod.isSquare_neg_one_mul {m n : ℕ} (hc : m.Coprime n) (hm : IsSquare (-1 : ZMod m))
(hn : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod (m * n)) := by
have : IsSquare (-1 : ZMod m × ZMod n) := by
rw [show (-1 : ZMod m × ZMod n) = ((-1 : ZMod m), (-1 : ZMod n)) from rfl]
obtain ⟨x, hx⟩ := hm
obtain ⟨y, hy⟩ := hn
rw [hx, hy]
exact ⟨(x, y), rfl⟩
simpa only [RingEquiv.map_neg_one] using this.map (ZMod.chineseRemainder hc).symm
#align zmod.is_square_neg_one_mul ZMod.isSquare_neg_one_mul
| Mathlib/NumberTheory/SumTwoSquares.lean | 98 | 103 | theorem Nat.Prime.mod_four_ne_three_of_dvd_isSquare_neg_one {p n : ℕ} (hpp : p.Prime) (hp : p ∣ n)
(hs : IsSquare (-1 : ZMod n)) : p % 4 ≠ 3 := by |
obtain ⟨y, h⟩ := ZMod.isSquare_neg_one_of_dvd hp hs
rw [← sq, eq_comm, show (-1 : ZMod p) = -1 ^ 2 by ring] at h
haveI : Fact p.Prime := ⟨hpp⟩
exact ZMod.mod_four_ne_three_of_sq_eq_neg_sq' one_ne_zero h
| [
" IsSquare (-1)",
" IsSquare (f (-1))",
" IsSquare (-1, -1)",
" IsSquare (x * x, y * y)",
" p % 4 ≠ 3",
" -1 = -1 ^ 2"
] | [
" IsSquare (-1)",
" IsSquare (f (-1))",
" IsSquare (-1, -1)",
" IsSquare (x * x, y * y)"
] |
import Mathlib.Data.Matrix.Invertible
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.matrix.nonsingular_inverse from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422"
namespace Matrix
universe u u' v
variable {l : Type*} {m : Type u} {n : Type u'} {α : Type v}
open Matrix Equiv Equiv.Perm Finset
section Inv
variable [Fintype n] [DecidableEq n] [CommRing α]
variable (A : Matrix n n α) (B : Matrix n n α)
| Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean | 205 | 207 | theorem isUnit_det_transpose (h : IsUnit A.det) : IsUnit Aᵀ.det := by |
rw [det_transpose]
exact h
| [
" IsUnit Aᵀ.det",
" IsUnit A.det"
] | [] |
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.GroupTheory.GroupAction.Hom
open Set Pointwise
theorem MulAction.smul_bijective_of_is_unit
{M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) :
Function.Bijective (fun (a : α) ↦ m • a) := by
lift m to Mˣ using hm
rw [Function.bijective_iff_has_inverse]
use fun a ↦ m⁻¹ • a
constructor
· intro x; simp [← Units.smul_def]
· intro x; simp [← Units.smul_def]
variable {R S : Type*} (M M₁ M₂ N : Type*)
variable [Monoid R] [Monoid S] (σ : R → S)
variable [MulAction R M] [MulAction S N] [MulAction R M₁] [MulAction R M₂]
variable {F : Type*} (h : F)
section MulActionSemiHomClass
variable [FunLike F M N] [MulActionSemiHomClass F σ M N]
(c : R) (s : Set M) (t : Set N)
-- @[simp] -- In #8386, the `simp_nf` linter complains:
-- "Left-hand side does not simplify, when using the simp lemma on itself."
-- For now we will have to manually add `image_smul_setₛₗ _` to the `simp` argument list.
-- TODO: when lean4#3107 is fixed, mark this as `@[simp]`.
theorem image_smul_setₛₗ :
h '' (c • s) = σ c • h '' s := by
simp only [← image_smul, image_image, map_smulₛₗ h]
#align image_smul_setₛₗ image_smul_setₛₗ
theorem smul_preimage_set_leₛₗ :
c • h ⁻¹' t ⊆ h ⁻¹' (σ c • t) := by
rintro x ⟨y, hy, rfl⟩
exact ⟨h y, hy, by rw [map_smulₛₗ]⟩
variable {c}
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 72 | 84 | theorem preimage_smul_setₛₗ'
(hc : Function.Surjective (fun (m : M) ↦ c • m))
(hc' : Function.Injective (fun (n : N) ↦ σ c • n)) :
h ⁻¹' (σ c • t) = c • h ⁻¹' t := by |
apply le_antisymm
· intro m
obtain ⟨m', rfl⟩ := hc m
rintro ⟨n, hn, hn'⟩
refine ⟨m', ?_, rfl⟩
rw [map_smulₛₗ] at hn'
rw [mem_preimage, ← hc' hn']
exact hn
· exact smul_preimage_set_leₛₗ M N σ h c t
| [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... | [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... |
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.LinearAlgebra.SesquilinearForm
#align_import analysis.inner_product_space.orthogonal from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {𝕜 E F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
namespace Submodule
variable (K : Submodule 𝕜 E)
def orthogonal : Submodule 𝕜 E where
carrier := { v | ∀ u ∈ K, ⟪u, v⟫ = 0 }
zero_mem' _ _ := inner_zero_right _
add_mem' hx hy u hu := by rw [inner_add_right, hx u hu, hy u hu, add_zero]
smul_mem' c x hx u hu := by rw [inner_smul_right, hx u hu, mul_zero]
#align submodule.orthogonal Submodule.orthogonal
@[inherit_doc]
notation:1200 K "ᗮ" => orthogonal K
theorem mem_orthogonal (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪u, v⟫ = 0 :=
Iff.rfl
#align submodule.mem_orthogonal Submodule.mem_orthogonal
| Mathlib/Analysis/InnerProductSpace/Orthogonal.lean | 56 | 57 | theorem mem_orthogonal' (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫ = 0 := by |
simp_rw [mem_orthogonal, inner_eq_zero_symm]
| [
" ⟪u, a✝ + b✝⟫_𝕜 = 0",
" ⟪u, c • x⟫_𝕜 = 0",
" v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫_𝕜 = 0"
] | [
" ⟪u, a✝ + b✝⟫_𝕜 = 0",
" ⟪u, c • x⟫_𝕜 = 0"
] |
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Data.List.Cycle
import Mathlib.Data.Nat.Prime
import Mathlib.Data.PNat.Basic
import Mathlib.Dynamics.FixedPoints.Basic
import Mathlib.GroupTheory.GroupAction.Group
#align_import dynamics.periodic_pts from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
open Set
namespace Function
open Function (Commute)
variable {α : Type*} {β : Type*} {f fa : α → α} {fb : β → β} {x y : α} {m n : ℕ}
def IsPeriodicPt (f : α → α) (n : ℕ) (x : α) :=
IsFixedPt f^[n] x
#align function.is_periodic_pt Function.IsPeriodicPt
theorem IsFixedPt.isPeriodicPt (hf : IsFixedPt f x) (n : ℕ) : IsPeriodicPt f n x :=
hf.iterate n
#align function.is_fixed_pt.is_periodic_pt Function.IsFixedPt.isPeriodicPt
theorem is_periodic_id (n : ℕ) (x : α) : IsPeriodicPt id n x :=
(isFixedPt_id x).isPeriodicPt n
#align function.is_periodic_id Function.is_periodic_id
theorem isPeriodicPt_zero (f : α → α) (x : α) : IsPeriodicPt f 0 x :=
isFixedPt_id x
#align function.is_periodic_pt_zero Function.isPeriodicPt_zero
namespace IsPeriodicPt
instance [DecidableEq α] {f : α → α} {n : ℕ} {x : α} : Decidable (IsPeriodicPt f n x) :=
IsFixedPt.decidable
protected theorem isFixedPt (hf : IsPeriodicPt f n x) : IsFixedPt f^[n] x :=
hf
#align function.is_periodic_pt.is_fixed_pt Function.IsPeriodicPt.isFixedPt
protected theorem map (hx : IsPeriodicPt fa n x) {g : α → β} (hg : Semiconj g fa fb) :
IsPeriodicPt fb n (g x) :=
IsFixedPt.map hx (hg.iterate_right n)
#align function.is_periodic_pt.map Function.IsPeriodicPt.map
theorem apply_iterate (hx : IsPeriodicPt f n x) (m : ℕ) : IsPeriodicPt f n (f^[m] x) :=
hx.map <| Commute.iterate_self f m
#align function.is_periodic_pt.apply_iterate Function.IsPeriodicPt.apply_iterate
protected theorem apply (hx : IsPeriodicPt f n x) : IsPeriodicPt f n (f x) :=
hx.apply_iterate 1
#align function.is_periodic_pt.apply Function.IsPeriodicPt.apply
protected theorem add (hn : IsPeriodicPt f n x) (hm : IsPeriodicPt f m x) :
IsPeriodicPt f (n + m) x := by
rw [IsPeriodicPt, iterate_add]
exact hn.comp hm
#align function.is_periodic_pt.add Function.IsPeriodicPt.add
| Mathlib/Dynamics/PeriodicPts.lean | 106 | 109 | theorem left_of_add (hn : IsPeriodicPt f (n + m) x) (hm : IsPeriodicPt f m x) :
IsPeriodicPt f n x := by |
rw [IsPeriodicPt, iterate_add] at hn
exact hn.left_of_comp hm
| [
" IsPeriodicPt f (n + m) x",
" IsFixedPt (f^[n] ∘ f^[m]) x",
" IsPeriodicPt f n x"
] | [
" IsPeriodicPt f (n + m) x",
" IsFixedPt (f^[n] ∘ f^[m]) x"
] |
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic
import Mathlib.Analysis.NormedSpace.Pointwise
#align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Metric
variable {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E]
theorem RCLike.norm_coe_norm {z : E} : ‖(‖z‖ : 𝕜)‖ = ‖z‖ := by simp
#align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm
variable [NormedSpace 𝕜 E]
@[simp]
theorem norm_smul_inv_norm {x : E} (hx : x ≠ 0) : ‖(‖x‖⁻¹ : 𝕜) • x‖ = 1 := by
have : ‖x‖ ≠ 0 := by simp [hx]
field_simp [norm_smul]
#align norm_smul_inv_norm norm_smul_inv_norm
theorem norm_smul_inv_norm' {r : ℝ} (r_nonneg : 0 ≤ r) {x : E} (hx : x ≠ 0) :
‖((r : 𝕜) * (‖x‖ : 𝕜)⁻¹) • x‖ = r := by
have : ‖x‖ ≠ 0 := by simp [hx]
field_simp [norm_smul, r_nonneg, rclike_simps]
#align norm_smul_inv_norm' norm_smul_inv_norm'
theorem LinearMap.bound_of_sphere_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] 𝕜)
(h : ∀ z ∈ sphere (0 : E) r, ‖f z‖ ≤ c) (z : E) : ‖f z‖ ≤ c / r * ‖z‖ := by
by_cases z_zero : z = 0
· rw [z_zero]
simp only [LinearMap.map_zero, norm_zero, mul_zero]
exact le_rfl
set z₁ := ((r : 𝕜) * (‖z‖ : 𝕜)⁻¹) • z with hz₁
have norm_f_z₁ : ‖f z₁‖ ≤ c := by
apply h
rw [mem_sphere_zero_iff_norm]
exact norm_smul_inv_norm' r_pos.le z_zero
have r_ne_zero : (r : 𝕜) ≠ 0 := RCLike.ofReal_ne_zero.mpr r_pos.ne'
have eq : f z = ‖z‖ / r * f z₁ := by
rw [hz₁, LinearMap.map_smul, smul_eq_mul]
rw [← mul_assoc, ← mul_assoc, div_mul_cancel₀ _ r_ne_zero, mul_inv_cancel, one_mul]
simp only [z_zero, RCLike.ofReal_eq_zero, norm_eq_zero, Ne, not_false_iff]
rw [eq, norm_mul, norm_div, RCLike.norm_coe_norm, RCLike.norm_of_nonneg r_pos.le,
div_mul_eq_mul_div, div_mul_eq_mul_div, mul_comm]
apply div_le_div _ _ r_pos rfl.ge
· exact mul_nonneg ((norm_nonneg _).trans norm_f_z₁) (norm_nonneg z)
apply mul_le_mul norm_f_z₁ rfl.le (norm_nonneg z) ((norm_nonneg _).trans norm_f_z₁)
#align linear_map.bound_of_sphere_bound LinearMap.bound_of_sphere_bound
theorem LinearMap.bound_of_ball_bound' {r : ℝ} (r_pos : 0 < r) (c : ℝ) (f : E →ₗ[𝕜] 𝕜)
(h : ∀ z ∈ closedBall (0 : E) r, ‖f z‖ ≤ c) (z : E) : ‖f z‖ ≤ c / r * ‖z‖ :=
f.bound_of_sphere_bound r_pos c (fun z hz => h z hz.le) z
#align linear_map.bound_of_ball_bound' LinearMap.bound_of_ball_bound'
| Mathlib/Analysis/NormedSpace/RCLike.lean | 85 | 93 | theorem ContinuousLinearMap.opNorm_bound_of_ball_bound {r : ℝ} (r_pos : 0 < r) (c : ℝ)
(f : E →L[𝕜] 𝕜) (h : ∀ z ∈ closedBall (0 : E) r, ‖f z‖ ≤ c) : ‖f‖ ≤ c / r := by |
apply ContinuousLinearMap.opNorm_le_bound
· apply div_nonneg _ r_pos.le
exact
(norm_nonneg _).trans
(h 0 (by simp only [norm_zero, mem_closedBall, dist_zero_left, r_pos.le]))
apply LinearMap.bound_of_ball_bound' r_pos
exact fun z hz => h z hz
| [
" ‖↑‖z‖‖ = ‖z‖",
" ‖(↑‖x‖)⁻¹ • x‖ = 1",
" ‖x‖ ≠ 0",
" ‖(↑r * (↑‖x‖)⁻¹) • x‖ = r",
" ‖f z‖ ≤ c / r * ‖z‖",
" ‖f 0‖ ≤ c / r * ‖0‖",
" 0 ≤ 0",
" ‖f z₁‖ ≤ c",
" z₁ ∈ sphere 0 r",
" ‖z₁‖ = r",
" f z = ↑‖z‖ / ↑r * f z₁",
" f z = ↑‖z‖ / ↑r * (↑r * (↑‖z‖)⁻¹ * f z)",
" ↑‖z‖ ≠ 0",
" ‖f z₁‖ * ‖z‖ / r... | [
" ‖↑‖z‖‖ = ‖z‖",
" ‖(↑‖x‖)⁻¹ • x‖ = 1",
" ‖x‖ ≠ 0",
" ‖(↑r * (↑‖x‖)⁻¹) • x‖ = r",
" ‖f z‖ ≤ c / r * ‖z‖",
" ‖f 0‖ ≤ c / r * ‖0‖",
" 0 ≤ 0",
" ‖f z₁‖ ≤ c",
" z₁ ∈ sphere 0 r",
" ‖z₁‖ = r",
" f z = ↑‖z‖ / ↑r * f z₁",
" f z = ↑‖z‖ / ↑r * (↑r * (↑‖z‖)⁻¹ * f z)",
" ↑‖z‖ ≠ 0",
" ‖f z₁‖ * ‖z‖ / r... |
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Combinatorics.Additive.AP.Three.Defs
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Complex.ExponentialBounds
#align_import combinatorics.additive.behrend from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open Nat hiding log
open Finset Metric Real
open scoped Pointwise
lemma threeAPFree_frontier {𝕜 E : Type*} [LinearOrderedField 𝕜] [TopologicalSpace E]
[AddCommMonoid E] [Module 𝕜 E] {s : Set E} (hs₀ : IsClosed s) (hs₁ : StrictConvex 𝕜 s) :
ThreeAPFree (frontier s) := by
intro a ha b hb c hc habc
obtain rfl : (1 / 2 : 𝕜) • a + (1 / 2 : 𝕜) • c = b := by
rwa [← smul_add, one_div, inv_smul_eq_iff₀ (show (2 : 𝕜) ≠ 0 by norm_num), two_smul]
have :=
hs₁.eq (hs₀.frontier_subset ha) (hs₀.frontier_subset hc) one_half_pos one_half_pos
(add_halves _) hb.2
simp [this, ← add_smul]
ring_nf
simp
#align add_salem_spencer_frontier threeAPFree_frontier
lemma threeAPFree_sphere {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[StrictConvexSpace ℝ E] (x : E) (r : ℝ) : ThreeAPFree (sphere x r) := by
obtain rfl | hr := eq_or_ne r 0
· rw [sphere_zero]
exact threeAPFree_singleton _
· convert threeAPFree_frontier isClosed_ball (strictConvex_closedBall ℝ x r)
exact (frontier_closedBall _ hr).symm
#align add_salem_spencer_sphere threeAPFree_sphere
namespace Behrend
variable {α β : Type*} {n d k N : ℕ} {x : Fin n → ℕ}
def box (n d : ℕ) : Finset (Fin n → ℕ) :=
Fintype.piFinset fun _ => range d
#align behrend.box Behrend.box
| Mathlib/Combinatorics/Additive/AP/Three/Behrend.lean | 97 | 97 | theorem mem_box : x ∈ box n d ↔ ∀ i, x i < d := by | simp only [box, Fintype.mem_piFinset, mem_range]
| [
" ThreeAPFree (frontier s)",
" a = b",
" (1 / 2) • a + (1 / 2) • c = b",
" 2 ≠ 0",
" a = (1 / 2) • a + (1 / 2) • c",
" c = (2⁻¹ + 2⁻¹) • c",
" c = 1 • c",
" ThreeAPFree (sphere x r)",
" ThreeAPFree (sphere x 0)",
" ThreeAPFree {x}",
" sphere x r = frontier (closedBall x r)",
" x ∈ box n d ↔ ∀ ... | [
" ThreeAPFree (frontier s)",
" a = b",
" (1 / 2) • a + (1 / 2) • c = b",
" 2 ≠ 0",
" a = (1 / 2) • a + (1 / 2) • c",
" c = (2⁻¹ + 2⁻¹) • c",
" c = 1 • c",
" ThreeAPFree (sphere x r)",
" ThreeAPFree (sphere x 0)",
" ThreeAPFree {x}",
" sphere x r = frontier (closedBall x r)"
] |
import Mathlib.Analysis.Normed.Field.Basic
#align_import analysis.normed_space.int from "leanprover-community/mathlib"@"5cc2dfdd3e92f340411acea4427d701dc7ed26f8"
namespace Int
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
obtain rfl | rfl := units_eq_one_or e <;>
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
#align int.nnnorm_coe_units Int.nnnorm_coe_units
theorem norm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖ = 1 := by
rw [← coe_nnnorm, nnnorm_coe_units, NNReal.coe_one]
#align int.norm_coe_units Int.norm_coe_units
@[simp]
theorem nnnorm_natCast (n : ℕ) : ‖(n : ℤ)‖₊ = n :=
Real.nnnorm_natCast _
#align int.nnnorm_coe_nat Int.nnnorm_natCast
@[deprecated (since := "2024-04-05")] alias nnnorm_coe_nat := nnnorm_natCast
@[simp]
theorem toNat_add_toNat_neg_eq_nnnorm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖₊ := by
rw [← Nat.cast_add, toNat_add_toNat_neg_eq_natAbs, NNReal.natCast_natAbs]
#align int.to_nat_add_to_nat_neg_eq_nnnorm Int.toNat_add_toNat_neg_eq_nnnorm
@[simp]
| Mathlib/Analysis/NormedSpace/Int.lean | 46 | 48 | theorem toNat_add_toNat_neg_eq_norm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖ := by |
simpa only [NNReal.coe_natCast, NNReal.coe_add] using
congrArg NNReal.toReal (toNat_add_toNat_neg_eq_nnnorm n)
| [
" ‖↑e‖₊ = 1",
" ‖↑1‖₊ = 1",
" ‖↑(-1)‖₊ = 1",
" ‖↑e‖ = 1",
" ↑n.toNat + ↑(-n).toNat = ‖n‖₊",
" ↑n.toNat + ↑(-n).toNat = ‖n‖"
] | [
" ‖↑e‖₊ = 1",
" ‖↑1‖₊ = 1",
" ‖↑(-1)‖₊ = 1",
" ‖↑e‖ = 1",
" ↑n.toNat + ↑(-n).toNat = ‖n‖₊"
] |
import Mathlib.Topology.Algebra.Module.WeakDual
import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.LocallyConvex.WithSeminorms
#align_import analysis.locally_convex.weak_dual from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {𝕜 E F ι : Type*}
open Topology
section BilinForm
namespace LinearMap
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] [AddCommGroup F] [Module 𝕜 F]
def toSeminorm (f : E →ₗ[𝕜] 𝕜) : Seminorm 𝕜 E :=
(normSeminorm 𝕜 𝕜).comp f
#align linear_map.to_seminorm LinearMap.toSeminorm
theorem coe_toSeminorm {f : E →ₗ[𝕜] 𝕜} : ⇑f.toSeminorm = fun x => ‖f x‖ :=
rfl
#align linear_map.coe_to_seminorm LinearMap.coe_toSeminorm
@[simp]
theorem toSeminorm_apply {f : E →ₗ[𝕜] 𝕜} {x : E} : f.toSeminorm x = ‖f x‖ :=
rfl
#align linear_map.to_seminorm_apply LinearMap.toSeminorm_apply
theorem toSeminorm_ball_zero {f : E →ₗ[𝕜] 𝕜} {r : ℝ} :
Seminorm.ball f.toSeminorm 0 r = { x : E | ‖f x‖ < r } := by
simp only [Seminorm.ball_zero_eq, toSeminorm_apply]
#align linear_map.to_seminorm_ball_zero LinearMap.toSeminorm_ball_zero
| Mathlib/Analysis/LocallyConvex/WeakDual.lean | 73 | 76 | theorem toSeminorm_comp (f : F →ₗ[𝕜] 𝕜) (g : E →ₗ[𝕜] F) :
f.toSeminorm.comp g = (f.comp g).toSeminorm := by |
ext
simp only [Seminorm.comp_apply, toSeminorm_apply, coe_comp, Function.comp_apply]
| [
" f.toSeminorm.ball 0 r = {x | ‖f x‖ < r}",
" f.toSeminorm.comp g = (f ∘ₗ g).toSeminorm",
" (f.toSeminorm.comp g) x✝ = (f ∘ₗ g).toSeminorm x✝"
] | [
" f.toSeminorm.ball 0 r = {x | ‖f x‖ < r}"
] |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 98 | 100 | theorem intervalIntegrable_iff' [NoAtoms μ] :
IntervalIntegrable f μ a b ↔ IntegrableOn f (uIcc a b) μ := by |
rw [intervalIntegrable_iff, ← Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
| [
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f [[a, b]] μ"
] | [
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ",
" IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ"
] |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.GroupTheory.GroupAction.Units
import Mathlib.Logic.Basic
import Mathlib.Tactic.Ring
#align_import ring_theory.coprime.basic from "leanprover-community/mathlib"@"a95b16cbade0f938fc24abd05412bde1e84bab9b"
universe u v
section CommSemiring
variable {R : Type u} [CommSemiring R] (x y z : R)
def IsCoprime : Prop :=
∃ a b, a * x + b * y = 1
#align is_coprime IsCoprime
variable {x y z}
@[symm]
theorem IsCoprime.symm (H : IsCoprime x y) : IsCoprime y x :=
let ⟨a, b, H⟩ := H
⟨b, a, by rw [add_comm, H]⟩
#align is_coprime.symm IsCoprime.symm
theorem isCoprime_comm : IsCoprime x y ↔ IsCoprime y x :=
⟨IsCoprime.symm, IsCoprime.symm⟩
#align is_coprime_comm isCoprime_comm
theorem isCoprime_self : IsCoprime x x ↔ IsUnit x :=
⟨fun ⟨a, b, h⟩ => isUnit_of_mul_eq_one x (a + b) <| by rwa [mul_comm, add_mul], fun h =>
let ⟨b, hb⟩ := isUnit_iff_exists_inv'.1 h
⟨b, 0, by rwa [zero_mul, add_zero]⟩⟩
#align is_coprime_self isCoprime_self
theorem isCoprime_zero_left : IsCoprime 0 x ↔ IsUnit x :=
⟨fun ⟨a, b, H⟩ => isUnit_of_mul_eq_one x b <| by rwa [mul_zero, zero_add, mul_comm] at H, fun H =>
let ⟨b, hb⟩ := isUnit_iff_exists_inv'.1 H
⟨1, b, by rwa [one_mul, zero_add]⟩⟩
#align is_coprime_zero_left isCoprime_zero_left
theorem isCoprime_zero_right : IsCoprime x 0 ↔ IsUnit x :=
isCoprime_comm.trans isCoprime_zero_left
#align is_coprime_zero_right isCoprime_zero_right
theorem not_isCoprime_zero_zero [Nontrivial R] : ¬IsCoprime (0 : R) 0 :=
mt isCoprime_zero_right.mp not_isUnit_zero
#align not_coprime_zero_zero not_isCoprime_zero_zero
lemma IsCoprime.intCast {R : Type*} [CommRing R] {a b : ℤ} (h : IsCoprime a b) :
IsCoprime (a : R) (b : R) := by
rcases h with ⟨u, v, H⟩
use u, v
rw_mod_cast [H]
exact Int.cast_one
theorem IsCoprime.ne_zero [Nontrivial R] {p : Fin 2 → R} (h : IsCoprime (p 0) (p 1)) : p ≠ 0 := by
rintro rfl
exact not_isCoprime_zero_zero h
#align is_coprime.ne_zero IsCoprime.ne_zero
theorem IsCoprime.ne_zero_or_ne_zero [Nontrivial R] (h : IsCoprime x y) : x ≠ 0 ∨ y ≠ 0 := by
apply not_or_of_imp
rintro rfl rfl
exact not_isCoprime_zero_zero h
theorem isCoprime_one_left : IsCoprime 1 x :=
⟨1, 0, by rw [one_mul, zero_mul, add_zero]⟩
#align is_coprime_one_left isCoprime_one_left
theorem isCoprime_one_right : IsCoprime x 1 :=
⟨0, 1, by rw [one_mul, zero_mul, zero_add]⟩
#align is_coprime_one_right isCoprime_one_right
theorem IsCoprime.dvd_of_dvd_mul_right (H1 : IsCoprime x z) (H2 : x ∣ y * z) : x ∣ y := by
let ⟨a, b, H⟩ := H1
rw [← mul_one y, ← H, mul_add, ← mul_assoc, mul_left_comm]
exact dvd_add (dvd_mul_left _ _) (H2.mul_left _)
#align is_coprime.dvd_of_dvd_mul_right IsCoprime.dvd_of_dvd_mul_right
theorem IsCoprime.dvd_of_dvd_mul_left (H1 : IsCoprime x y) (H2 : x ∣ y * z) : x ∣ z := by
let ⟨a, b, H⟩ := H1
rw [← one_mul z, ← H, add_mul, mul_right_comm, mul_assoc b]
exact dvd_add (dvd_mul_left _ _) (H2.mul_left _)
#align is_coprime.dvd_of_dvd_mul_left IsCoprime.dvd_of_dvd_mul_left
theorem IsCoprime.mul_left (H1 : IsCoprime x z) (H2 : IsCoprime y z) : IsCoprime (x * y) z :=
let ⟨a, b, h1⟩ := H1
let ⟨c, d, h2⟩ := H2
⟨a * c, a * x * d + b * c * y + b * d * z,
calc a * c * (x * y) + (a * x * d + b * c * y + b * d * z) * z
_ = (a * x + b * z) * (c * y + d * z) := by ring
_ = 1 := by rw [h1, h2, mul_one]
⟩
#align is_coprime.mul_left IsCoprime.mul_left
theorem IsCoprime.mul_right (H1 : IsCoprime x y) (H2 : IsCoprime x z) : IsCoprime x (y * z) := by
rw [isCoprime_comm] at H1 H2 ⊢
exact H1.mul_left H2
#align is_coprime.mul_right IsCoprime.mul_right
| Mathlib/RingTheory/Coprime/Basic.lean | 129 | 136 | theorem IsCoprime.mul_dvd (H : IsCoprime x y) (H1 : x ∣ z) (H2 : y ∣ z) : x * y ∣ z := by |
obtain ⟨a, b, h⟩ := H
rw [← mul_one z, ← h, mul_add]
apply dvd_add
· rw [mul_comm z, mul_assoc]
exact (mul_dvd_mul_left _ H2).mul_left _
· rw [mul_comm b, ← mul_assoc]
exact (mul_dvd_mul_right H1 _).mul_right _
| [
" b * y + a * x = 1",
" x * (a + b) = 1",
" b * x + 0 * x = 1",
" x * b = 1",
" 1 * 0 + b * x = 1",
" IsCoprime ↑a ↑b",
" ↑u * ↑a + ↑v * ↑b = 1",
" ↑1 = 1",
" p ≠ 0",
" False",
" x ≠ 0 ∨ y ≠ 0",
" x = 0 → y ≠ 0",
" 1 * 1 + 0 * x = 1",
" 0 * x + 1 * 1 = 1",
" x ∣ y",
" x ∣ y * a * x + b... | [
" b * y + a * x = 1",
" x * (a + b) = 1",
" b * x + 0 * x = 1",
" x * b = 1",
" 1 * 0 + b * x = 1",
" IsCoprime ↑a ↑b",
" ↑u * ↑a + ↑v * ↑b = 1",
" ↑1 = 1",
" p ≠ 0",
" False",
" x ≠ 0 ∨ y ≠ 0",
" x = 0 → y ≠ 0",
" 1 * 1 + 0 * x = 1",
" 0 * x + 1 * 1 = 1",
" x ∣ y",
" x ∣ y * a * x + b... |
import Mathlib.Algebra.Order.Group.TypeTags
import Mathlib.FieldTheory.RatFunc.Degree
import Mathlib.RingTheory.DedekindDomain.IntegralClosure
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.Topology.Algebra.ValuedField
#align_import number_theory.function_field from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open scoped nonZeroDivisors Polynomial DiscreteValuation
variable (Fq F : Type) [Field Fq] [Field F]
abbrev FunctionField [Algebra (RatFunc Fq) F] : Prop :=
FiniteDimensional (RatFunc Fq) F
#align function_field FunctionField
-- Porting note: Removed `protected`
theorem functionField_iff (Fqt : Type*) [Field Fqt] [Algebra Fq[X] Fqt]
[IsFractionRing Fq[X] Fqt] [Algebra (RatFunc Fq) F] [Algebra Fqt F] [Algebra Fq[X] F]
[IsScalarTower Fq[X] Fqt F] [IsScalarTower Fq[X] (RatFunc Fq) F] :
FunctionField Fq F ↔ FiniteDimensional Fqt F := by
let e := IsLocalization.algEquiv Fq[X]⁰ (RatFunc Fq) Fqt
have : ∀ (c) (x : F), e c • x = c • x := by
intro c x
rw [Algebra.smul_def, Algebra.smul_def]
congr
refine congr_fun (f := fun c => algebraMap Fqt F (e c)) ?_ c -- Porting note: Added `(f := _)`
refine IsLocalization.ext (nonZeroDivisors Fq[X]) _ _ ?_ ?_ ?_ ?_ ?_ <;> intros <;>
simp only [AlgEquiv.map_one, RingHom.map_one, AlgEquiv.map_mul, RingHom.map_mul,
AlgEquiv.commutes, ← IsScalarTower.algebraMap_apply]
constructor <;> intro h
· let b := FiniteDimensional.finBasis (RatFunc Fq) F
exact FiniteDimensional.of_fintype_basis (b.mapCoeffs e this)
· let b := FiniteDimensional.finBasis Fqt F
refine FiniteDimensional.of_fintype_basis (b.mapCoeffs e.symm ?_)
intro c x; convert (this (e.symm c) x).symm; simp only [e.apply_symm_apply]
#align function_field_iff functionField_iff
theorem algebraMap_injective [Algebra Fq[X] F] [Algebra (RatFunc Fq) F]
[IsScalarTower Fq[X] (RatFunc Fq) F] : Function.Injective (⇑(algebraMap Fq[X] F)) := by
rw [IsScalarTower.algebraMap_eq Fq[X] (RatFunc Fq) F]
exact (algebraMap (RatFunc Fq) F).injective.comp (IsFractionRing.injective Fq[X] (RatFunc Fq))
#align algebra_map_injective algebraMap_injective
namespace FunctionField
def ringOfIntegers [Algebra Fq[X] F] :=
integralClosure Fq[X] F
#align function_field.ring_of_integers FunctionField.ringOfIntegers
namespace ringOfIntegers
variable [Algebra Fq[X] F]
instance : IsDomain (ringOfIntegers Fq F) :=
(ringOfIntegers Fq F).isDomain
instance : IsIntegralClosure (ringOfIntegers Fq F) Fq[X] F :=
integralClosure.isIntegralClosure _ _
variable [Algebra (RatFunc Fq) F] [IsScalarTower Fq[X] (RatFunc Fq) F]
theorem algebraMap_injective : Function.Injective (⇑(algebraMap Fq[X] (ringOfIntegers Fq F))) := by
have hinj : Function.Injective (⇑(algebraMap Fq[X] F)) := by
rw [IsScalarTower.algebraMap_eq Fq[X] (RatFunc Fq) F]
exact (algebraMap (RatFunc Fq) F).injective.comp (IsFractionRing.injective Fq[X] (RatFunc Fq))
rw [injective_iff_map_eq_zero (algebraMap Fq[X] (↥(ringOfIntegers Fq F)))]
intro p hp
rw [← Subtype.coe_inj, Subalgebra.coe_zero] at hp
rw [injective_iff_map_eq_zero (algebraMap Fq[X] F)] at hinj
exact hinj p hp
#align function_field.ring_of_integers.algebra_map_injective FunctionField.ringOfIntegers.algebraMap_injective
| Mathlib/NumberTheory/FunctionField.lean | 124 | 127 | theorem not_isField : ¬IsField (ringOfIntegers Fq F) := by |
simpa [← (IsIntegralClosure.isIntegral_algebra Fq[X] F).isField_iff_isField
(algebraMap_injective Fq F)] using
Polynomial.not_isField Fq
| [
" FunctionField Fq F ↔ FiniteDimensional Fqt F",
" ∀ (c : RatFunc Fq) (x : F), e c • x = c • x",
" e c • x = c • x",
" (algebraMap Fqt F) (e c) * x = (algebraMap (RatFunc Fq) F) c * x",
" (algebraMap Fqt F) (e c) = (algebraMap (RatFunc Fq) F) c",
" (fun c => (algebraMap Fqt F) (e c)) = ⇑(algebraMap (RatFu... | [
" FunctionField Fq F ↔ FiniteDimensional Fqt F",
" ∀ (c : RatFunc Fq) (x : F), e c • x = c • x",
" e c • x = c • x",
" (algebraMap Fqt F) (e c) * x = (algebraMap (RatFunc Fq) F) c * x",
" (algebraMap Fqt F) (e c) = (algebraMap (RatFunc Fq) F) c",
" (fun c => (algebraMap Fqt F) (e c)) = ⇑(algebraMap (RatFu... |
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors
import Mathlib.LinearAlgebra.BilinearForm.Properties
open LinearMap (BilinForm)
universe u v w
variable {R : Type*} {M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
variable {R₁ : Type*} {M₁ : Type*} [CommRing R₁] [AddCommGroup M₁] [Module R₁ M₁]
variable {V : Type*} {K : Type*} [Field K] [AddCommGroup V] [Module K V]
variable {B : BilinForm R M} {B₁ : BilinForm R₁ M₁}
namespace LinearMap
namespace BilinForm
def IsOrtho (B : BilinForm R M) (x y : M) : Prop :=
B x y = 0
#align bilin_form.is_ortho LinearMap.BilinForm.IsOrtho
theorem isOrtho_def {B : BilinForm R M} {x y : M} : B.IsOrtho x y ↔ B x y = 0 :=
Iff.rfl
#align bilin_form.is_ortho_def LinearMap.BilinForm.isOrtho_def
theorem isOrtho_zero_left (x : M) : IsOrtho B (0 : M) x := LinearMap.isOrtho_zero_left B x
#align bilin_form.is_ortho_zero_left LinearMap.BilinForm.isOrtho_zero_left
theorem isOrtho_zero_right (x : M) : IsOrtho B x (0 : M) :=
zero_right x
#align bilin_form.is_ortho_zero_right LinearMap.BilinForm.isOrtho_zero_right
theorem ne_zero_of_not_isOrtho_self {B : BilinForm K V} (x : V) (hx₁ : ¬B.IsOrtho x x) : x ≠ 0 :=
fun hx₂ => hx₁ (hx₂.symm ▸ isOrtho_zero_left _)
#align bilin_form.ne_zero_of_not_is_ortho_self LinearMap.BilinForm.ne_zero_of_not_isOrtho_self
theorem IsRefl.ortho_comm (H : B.IsRefl) {x y : M} : IsOrtho B x y ↔ IsOrtho B y x :=
⟨eq_zero H, eq_zero H⟩
#align bilin_form.is_refl.ortho_comm LinearMap.BilinForm.IsRefl.ortho_comm
theorem IsAlt.ortho_comm (H : B₁.IsAlt) {x y : M₁} : IsOrtho B₁ x y ↔ IsOrtho B₁ y x :=
LinearMap.IsAlt.ortho_comm H
#align bilin_form.is_alt.ortho_comm LinearMap.BilinForm.IsAlt.ortho_comm
theorem IsSymm.ortho_comm (H : B.IsSymm) {x y : M} : IsOrtho B x y ↔ IsOrtho B y x :=
LinearMap.IsSymm.ortho_comm H
#align bilin_form.is_symm.ortho_comm LinearMap.BilinForm.IsSymm.ortho_comm
def iIsOrtho {n : Type w} (B : BilinForm R M) (v : n → M) : Prop :=
B.IsOrthoᵢ v
set_option linter.uppercaseLean3 false in
#align bilin_form.is_Ortho LinearMap.BilinForm.iIsOrtho
theorem iIsOrtho_def {n : Type w} {B : BilinForm R M} {v : n → M} :
B.iIsOrtho v ↔ ∀ i j : n, i ≠ j → B (v i) (v j) = 0 :=
Iff.rfl
set_option linter.uppercaseLean3 false in
#align bilin_form.is_Ortho_def LinearMap.BilinForm.iIsOrtho_def
section
variable {R₄ M₄ : Type*} [CommRing R₄] [IsDomain R₄]
variable [AddCommGroup M₄] [Module R₄ M₄] {G : BilinForm R₄ M₄}
@[simp]
theorem isOrtho_smul_left {x y : M₄} {a : R₄} (ha : a ≠ 0) :
IsOrtho G (a • x) y ↔ IsOrtho G x y := by
dsimp only [IsOrtho]
rw [map_smul]
simp only [LinearMap.smul_apply, smul_eq_mul, mul_eq_zero, or_iff_right_iff_imp]
exact fun a ↦ (ha a).elim
#align bilin_form.is_ortho_smul_left LinearMap.BilinForm.isOrtho_smul_left
@[simp]
theorem isOrtho_smul_right {x y : M₄} {a : R₄} (ha : a ≠ 0) :
IsOrtho G x (a • y) ↔ IsOrtho G x y := by
dsimp only [IsOrtho]
rw [map_smul]
simp only [smul_eq_mul, mul_eq_zero, or_iff_right_iff_imp]
exact fun a ↦ (ha a).elim
#align bilin_form.is_ortho_smul_right LinearMap.BilinForm.isOrtho_smul_right
| Mathlib/LinearAlgebra/BilinearForm/Orthogonal.lean | 119 | 130 | theorem linearIndependent_of_iIsOrtho {n : Type w} {B : BilinForm K V} {v : n → V}
(hv₁ : B.iIsOrtho v) (hv₂ : ∀ i, ¬B.IsOrtho (v i) (v i)) : LinearIndependent K v := by |
classical
rw [linearIndependent_iff']
intro s w hs i hi
have : B (s.sum fun i : n => w i • v i) (v i) = 0 := by rw [hs, zero_left]
have hsum : (s.sum fun j : n => w j * B (v j) (v i)) = w i * B (v i) (v i) := by
apply Finset.sum_eq_single_of_mem i hi
intro j _ hij
rw [iIsOrtho_def.1 hv₁ _ _ hij, mul_zero]
simp_rw [sum_left, smul_left, hsum] at this
exact eq_zero_of_ne_zero_of_mul_right_eq_zero (hv₂ i) this
| [
" G.IsOrtho (a • x) y ↔ G.IsOrtho x y",
" (G (a • x)) y = 0 ↔ (G x) y = 0",
" (a • G x) y = 0 ↔ (G x) y = 0",
" a = 0 → (G x) y = 0",
" G.IsOrtho x (a • y) ↔ G.IsOrtho x y",
" (G x) (a • y) = 0 ↔ (G x) y = 0",
" a • (G x) y = 0 ↔ (G x) y = 0",
" LinearIndependent K v",
" ∀ (s : Finset n) (g : n → K)... | [
" G.IsOrtho (a • x) y ↔ G.IsOrtho x y",
" (G (a • x)) y = 0 ↔ (G x) y = 0",
" (a • G x) y = 0 ↔ (G x) y = 0",
" a = 0 → (G x) y = 0",
" G.IsOrtho x (a • y) ↔ G.IsOrtho x y",
" (G x) (a • y) = 0 ↔ (G x) y = 0",
" a • (G x) y = 0 ↔ (G x) y = 0"
] |
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Data.List.Chain
#align_import data.bool.count from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
namespace List
@[simp]
theorem count_not_add_count (l : List Bool) (b : Bool) : count (!b) l + count b l = length l := by
-- Porting note: Proof re-written
-- Old proof: simp only [length_eq_countP_add_countP (Eq (!b)), Bool.not_not_eq, count]
simp only [length_eq_countP_add_countP (· == !b), count, add_right_inj]
suffices (fun x => x == b) = (fun a => decide ¬(a == !b) = true) by rw [this]
ext x; cases x <;> cases b <;> rfl
#align list.count_bnot_add_count List.count_not_add_count
@[simp]
theorem count_add_count_not (l : List Bool) (b : Bool) : count b l + count (!b) l = length l := by
rw [add_comm, count_not_add_count]
#align list.count_add_count_bnot List.count_add_count_not
@[simp]
theorem count_false_add_count_true (l : List Bool) : count false l + count true l = length l :=
count_not_add_count l true
#align list.count_ff_add_count_tt List.count_false_add_count_true
@[simp]
theorem count_true_add_count_false (l : List Bool) : count true l + count false l = length l :=
count_not_add_count l false
#align list.count_tt_add_count_ff List.count_true_add_count_false
theorem Chain.count_not :
∀ {b : Bool} {l : List Bool}, Chain (· ≠ ·) b l → count (!b) l = count b l + length l % 2
| b, [], _h => rfl
| b, x :: l, h => by
obtain rfl : b = !x := Bool.eq_not_iff.2 (rel_of_chain_cons h)
rw [Bool.not_not, count_cons_self, count_cons_of_ne x.not_ne_self,
Chain.count_not (chain_of_chain_cons h), length, add_assoc, Nat.mod_two_add_succ_mod_two]
#align list.chain.count_bnot List.Chain.count_not
namespace Chain'
variable {l : List Bool}
theorem count_not_eq_count (hl : Chain' (· ≠ ·) l) (h2 : Even (length l)) (b : Bool) :
count (!b) l = count b l := by
cases' l with x l
· rfl
rw [length_cons, Nat.even_add_one, Nat.not_even_iff] at h2
suffices count (!x) (x :: l) = count x (x :: l) by
-- Porting note: old proof is
-- cases b <;> cases x <;> try exact this;
cases b <;> cases x <;>
revert this <;> simp only [Bool.not_false, Bool.not_true] <;> intro this <;>
(try exact this) <;> exact this.symm
rw [count_cons_of_ne x.not_ne_self, hl.count_not, h2, count_cons_self]
#align list.chain'.count_bnot_eq_count List.Chain'.count_not_eq_count
theorem count_false_eq_count_true (hl : Chain' (· ≠ ·) l) (h2 : Even (length l)) :
count false l = count true l :=
hl.count_not_eq_count h2 true
#align list.chain'.count_ff_eq_count_tt List.Chain'.count_false_eq_count_true
theorem count_not_le_count_add_one (hl : Chain' (· ≠ ·) l) (b : Bool) :
count (!b) l ≤ count b l + 1 := by
cases' l with x l
· exact zero_le _
obtain rfl | rfl : b = x ∨ b = !x := by simp only [Bool.eq_not_iff, em]
· rw [count_cons_of_ne b.not_ne_self, count_cons_self, hl.count_not, add_assoc]
exact add_le_add_left (Nat.mod_lt _ two_pos).le _
· rw [Bool.not_not, count_cons_self, count_cons_of_ne x.not_ne_self, hl.count_not]
exact add_le_add_right (le_add_right le_rfl) _
#align list.chain'.count_bnot_le_count_add_one List.Chain'.count_not_le_count_add_one
theorem count_false_le_count_true_add_one (hl : Chain' (· ≠ ·) l) :
count false l ≤ count true l + 1 :=
hl.count_not_le_count_add_one true
#align list.chain'.count_ff_le_count_tt_add_one List.Chain'.count_false_le_count_true_add_one
theorem count_true_le_count_false_add_one (hl : Chain' (· ≠ ·) l) :
count true l ≤ count false l + 1 :=
hl.count_not_le_count_add_one false
#align list.chain'.count_tt_le_count_ff_add_one List.Chain'.count_true_le_count_false_add_one
theorem two_mul_count_bool_of_even (hl : Chain' (· ≠ ·) l) (h2 : Even (length l)) (b : Bool) :
2 * count b l = length l := by
rw [← count_not_add_count l b, hl.count_not_eq_count h2, two_mul]
#align list.chain'.two_mul_count_bool_of_even List.Chain'.two_mul_count_bool_of_even
| Mathlib/Data/Bool/Count.lean | 105 | 117 | theorem two_mul_count_bool_eq_ite (hl : Chain' (· ≠ ·) l) (b : Bool) :
2 * count b l =
if Even (length l) then length l else
if Option.some b == l.head? then length l + 1 else length l - 1 := by |
by_cases h2 : Even (length l)
· rw [if_pos h2, hl.two_mul_count_bool_of_even h2]
· cases' l with x l
· exact (h2 even_zero).elim
simp only [if_neg h2, count_cons, mul_add, head?, Option.mem_some_iff, @eq_comm _ x]
rw [length_cons, Nat.even_add_one, not_not] at h2
replace hl : l.Chain' (· ≠ ·) := hl.tail
rw [hl.two_mul_count_bool_of_even h2]
cases b <;> cases x <;> split_ifs <;> simp <;> contradiction
| [
" count (!b) l + count b l = l.length",
" countP (fun x => x == b) l = countP (fun a => decide ¬(a == !b) = true) l",
" (fun x => x == b) = fun a => decide ¬(a == !b) = true",
" (x == b) = decide ¬(x == !b) = true",
" (false == b) = decide ¬(false == !b) = true",
" (true == b) = decide ¬(true == !b) = tru... | [
" count (!b) l + count b l = l.length",
" countP (fun x => x == b) l = countP (fun a => decide ¬(a == !b) = true) l",
" (fun x => x == b) = fun a => decide ¬(a == !b) = true",
" (x == b) = decide ¬(x == !b) = true",
" (false == b) = decide ¬(false == !b) = true",
" (true == b) = decide ¬(true == !b) = tru... |
import Mathlib.Analysis.Normed.Group.Basic
#align_import information_theory.hamming from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
section HammingDistNorm
open Finset Function
variable {α ι : Type*} {β : ι → Type*} [Fintype ι] [∀ i, DecidableEq (β i)]
variable {γ : ι → Type*} [∀ i, DecidableEq (γ i)]
def hammingDist (x y : ∀ i, β i) : ℕ :=
(univ.filter fun i => x i ≠ y i).card
#align hamming_dist hammingDist
@[simp]
theorem hammingDist_self (x : ∀ i, β i) : hammingDist x x = 0 := by
rw [hammingDist, card_eq_zero, filter_eq_empty_iff]
exact fun _ _ H => H rfl
#align hamming_dist_self hammingDist_self
theorem hammingDist_nonneg {x y : ∀ i, β i} : 0 ≤ hammingDist x y :=
zero_le _
#align hamming_dist_nonneg hammingDist_nonneg
theorem hammingDist_comm (x y : ∀ i, β i) : hammingDist x y = hammingDist y x := by
simp_rw [hammingDist, ne_comm]
#align hamming_dist_comm hammingDist_comm
theorem hammingDist_triangle (x y z : ∀ i, β i) :
hammingDist x z ≤ hammingDist x y + hammingDist y z := by
classical
unfold hammingDist
refine le_trans (card_mono ?_) (card_union_le _ _)
rw [← filter_or]
exact monotone_filter_right _ fun i h ↦ (h.ne_or_ne _).imp_right Ne.symm
#align hamming_dist_triangle hammingDist_triangle
theorem hammingDist_triangle_left (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist z x + hammingDist z y := by
rw [hammingDist_comm z]
exact hammingDist_triangle _ _ _
#align hamming_dist_triangle_left hammingDist_triangle_left
theorem hammingDist_triangle_right (x y z : ∀ i, β i) :
hammingDist x y ≤ hammingDist x z + hammingDist y z := by
rw [hammingDist_comm y]
exact hammingDist_triangle _ _ _
#align hamming_dist_triangle_right hammingDist_triangle_right
theorem swap_hammingDist : swap (@hammingDist _ β _ _) = hammingDist := by
funext x y
exact hammingDist_comm _ _
#align swap_hamming_dist swap_hammingDist
theorem eq_of_hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 → x = y := by
simp_rw [hammingDist, card_eq_zero, filter_eq_empty_iff, Classical.not_not, funext_iff, mem_univ,
forall_true_left, imp_self]
#align eq_of_hamming_dist_eq_zero eq_of_hammingDist_eq_zero
@[simp]
theorem hammingDist_eq_zero {x y : ∀ i, β i} : hammingDist x y = 0 ↔ x = y :=
⟨eq_of_hammingDist_eq_zero, fun H => by
rw [H]
exact hammingDist_self _⟩
#align hamming_dist_eq_zero hammingDist_eq_zero
@[simp]
| Mathlib/InformationTheory/Hamming.lean | 106 | 107 | theorem hamming_zero_eq_dist {x y : ∀ i, β i} : 0 = hammingDist x y ↔ x = y := by |
rw [eq_comm, hammingDist_eq_zero]
| [
" hammingDist x x = 0",
" ∀ ⦃x_1 : ι⦄, x_1 ∈ univ → ¬x x_1 ≠ x x_1",
" hammingDist x y = hammingDist y x",
" hammingDist x z ≤ hammingDist x y + hammingDist y z",
" (filter (fun i => x i ≠ z i) univ).card ≤\n (filter (fun i => x i ≠ y i) univ).card + (filter (fun i => y i ≠ z i) univ).card",
" filter (... | [
" hammingDist x x = 0",
" ∀ ⦃x_1 : ι⦄, x_1 ∈ univ → ¬x x_1 ≠ x x_1",
" hammingDist x y = hammingDist y x",
" hammingDist x z ≤ hammingDist x y + hammingDist y z",
" (filter (fun i => x i ≠ z i) univ).card ≤\n (filter (fun i => x i ≠ y i) univ).card + (filter (fun i => y i ≠ z i) univ).card",
" filter (... |
import Mathlib.Geometry.Euclidean.Circumcenter
#align_import geometry.euclidean.monge_point from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0"
noncomputable section
open scoped Classical
open scoped RealInnerProductSpace
namespace Affine
namespace Simplex
open Finset AffineSubspace EuclideanGeometry PointsWithCircumcenterIndex
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
[NormedAddTorsor V P]
def mongePoint {n : ℕ} (s : Simplex ℝ P n) : P :=
(((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) •
((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ
s.circumcenter
#align affine.simplex.monge_point Affine.Simplex.mongePoint
theorem mongePoint_eq_smul_vsub_vadd_circumcenter {n : ℕ} (s : Simplex ℝ P n) :
s.mongePoint =
(((n + 1 : ℕ) : ℝ) / ((n - 1 : ℕ) : ℝ)) •
((univ : Finset (Fin (n + 1))).centroid ℝ s.points -ᵥ s.circumcenter) +ᵥ
s.circumcenter :=
rfl
#align affine.simplex.monge_point_eq_smul_vsub_vadd_circumcenter Affine.Simplex.mongePoint_eq_smul_vsub_vadd_circumcenter
theorem mongePoint_mem_affineSpan {n : ℕ} (s : Simplex ℝ P n) :
s.mongePoint ∈ affineSpan ℝ (Set.range s.points) :=
smul_vsub_vadd_mem _ _ (centroid_mem_affineSpan_of_card_eq_add_one ℝ _ (card_fin (n + 1)))
s.circumcenter_mem_affineSpan s.circumcenter_mem_affineSpan
#align affine.simplex.monge_point_mem_affine_span Affine.Simplex.mongePoint_mem_affineSpan
theorem mongePoint_eq_of_range_eq {n : ℕ} {s₁ s₂ : Simplex ℝ P n}
(h : Set.range s₁.points = Set.range s₂.points) : s₁.mongePoint = s₂.mongePoint := by
simp_rw [mongePoint_eq_smul_vsub_vadd_circumcenter, centroid_eq_of_range_eq h,
circumcenter_eq_of_range_eq h]
#align affine.simplex.monge_point_eq_of_range_eq Affine.Simplex.mongePoint_eq_of_range_eq
def mongePointWeightsWithCircumcenter (n : ℕ) : PointsWithCircumcenterIndex (n + 2) → ℝ
| pointIndex _ => ((n + 1 : ℕ) : ℝ)⁻¹
| circumcenterIndex => -2 / ((n + 1 : ℕ) : ℝ)
#align affine.simplex.monge_point_weights_with_circumcenter Affine.Simplex.mongePointWeightsWithCircumcenter
@[simp]
theorem sum_mongePointWeightsWithCircumcenter (n : ℕ) :
∑ i, mongePointWeightsWithCircumcenter n i = 1 := by
simp_rw [sum_pointsWithCircumcenter, mongePointWeightsWithCircumcenter, sum_const, card_fin,
nsmul_eq_mul]
-- Porting note: replaced
-- have hn1 : (n + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
field_simp [n.cast_add_one_ne_zero]
ring
#align affine.simplex.sum_monge_point_weights_with_circumcenter Affine.Simplex.sum_mongePointWeightsWithCircumcenter
theorem mongePoint_eq_affineCombination_of_pointsWithCircumcenter {n : ℕ}
(s : Simplex ℝ P (n + 2)) :
s.mongePoint =
(univ : Finset (PointsWithCircumcenterIndex (n + 2))).affineCombination ℝ
s.pointsWithCircumcenter (mongePointWeightsWithCircumcenter n) := by
rw [mongePoint_eq_smul_vsub_vadd_circumcenter,
centroid_eq_affineCombination_of_pointsWithCircumcenter,
circumcenter_eq_affineCombination_of_pointsWithCircumcenter, affineCombination_vsub,
← LinearMap.map_smul, weightedVSub_vadd_affineCombination]
congr with i
rw [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.sub_apply]
-- Porting note: replaced
-- have hn1 : (n + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
have hn1 : (n + 1 : ℝ) ≠ 0 := n.cast_add_one_ne_zero
cases i <;>
simp_rw [centroidWeightsWithCircumcenter, circumcenterWeightsWithCircumcenter,
mongePointWeightsWithCircumcenter] <;>
rw [add_tsub_assoc_of_le (by decide : 1 ≤ 2), (by decide : 2 - 1 = 1)]
· rw [if_pos (mem_univ _), sub_zero, add_zero, card_fin]
-- Porting note: replaced
-- have hn3 : (n + 2 + 1 : ℝ) ≠ 0 := mod_cast Nat.succ_ne_zero _
have hn3 : (n + 2 + 1 : ℝ) ≠ 0 := by norm_cast
field_simp [hn1, hn3, mul_comm]
· field_simp [hn1]
ring
#align affine.simplex.monge_point_eq_affine_combination_of_points_with_circumcenter Affine.Simplex.mongePoint_eq_affineCombination_of_pointsWithCircumcenter
def mongePointVSubFaceCentroidWeightsWithCircumcenter {n : ℕ} (i₁ i₂ : Fin (n + 3)) :
PointsWithCircumcenterIndex (n + 2) → ℝ
| pointIndex i => if i = i₁ ∨ i = i₂ then ((n + 1 : ℕ) : ℝ)⁻¹ else 0
| circumcenterIndex => -2 / ((n + 1 : ℕ) : ℝ)
#align affine.simplex.monge_point_vsub_face_centroid_weights_with_circumcenter Affine.Simplex.mongePointVSubFaceCentroidWeightsWithCircumcenter
| Mathlib/Geometry/Euclidean/MongePoint.lean | 169 | 182 | theorem mongePointVSubFaceCentroidWeightsWithCircumcenter_eq_sub {n : ℕ} {i₁ i₂ : Fin (n + 3)}
(h : i₁ ≠ i₂) :
mongePointVSubFaceCentroidWeightsWithCircumcenter i₁ i₂ =
mongePointWeightsWithCircumcenter n - centroidWeightsWithCircumcenter {i₁, i₂}ᶜ := by |
ext i
cases' i with i
· rw [Pi.sub_apply, mongePointWeightsWithCircumcenter, centroidWeightsWithCircumcenter,
mongePointVSubFaceCentroidWeightsWithCircumcenter]
have hu : card ({i₁, i₂}ᶜ : Finset (Fin (n + 3))) = n + 1 := by
simp [card_compl, Fintype.card_fin, h]
rw [hu]
by_cases hi : i = i₁ ∨ i = i₂ <;> simp [compl_eq_univ_sdiff, hi]
· simp [mongePointWeightsWithCircumcenter, centroidWeightsWithCircumcenter,
mongePointVSubFaceCentroidWeightsWithCircumcenter]
| [
" s₁.mongePoint = s₂.mongePoint",
" ∑ i : PointsWithCircumcenterIndex (n + 2), mongePointWeightsWithCircumcenter n i = 1",
" ↑(n + 2 + 1) * (↑(n + 1))⁻¹ + -2 / ↑(n + 1) = 1",
" ↑n + 2 + 1 + -2 = ↑n + 1",
" s.mongePoint = (affineCombination ℝ univ s.pointsWithCircumcenter) (mongePointWeightsWithCircumcenter ... | [
" s₁.mongePoint = s₂.mongePoint",
" ∑ i : PointsWithCircumcenterIndex (n + 2), mongePointWeightsWithCircumcenter n i = 1",
" ↑(n + 2 + 1) * (↑(n + 1))⁻¹ + -2 / ↑(n + 1) = 1",
" ↑n + 2 + 1 + -2 = ↑n + 1",
" s.mongePoint = (affineCombination ℝ univ s.pointsWithCircumcenter) (mongePointWeightsWithCircumcenter ... |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.ConcreteCategory.BundledHom
import Mathlib.CategoryTheory.Elementwise
#align_import analysis.normed.group.SemiNormedGroup from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
set_option linter.uppercaseLean3 false
noncomputable section
universe u
open CategoryTheory
def SemiNormedGroupCat : Type (u + 1) :=
Bundled SeminormedAddCommGroup
#align SemiNormedGroup SemiNormedGroupCat
namespace SemiNormedGroupCat
instance bundledHom : BundledHom @NormedAddGroupHom where
toFun := @NormedAddGroupHom.toFun
id := @NormedAddGroupHom.id
comp := @NormedAddGroupHom.comp
#align SemiNormedGroup.bundled_hom SemiNormedGroupCat.bundledHom
deriving instance LargeCategory for SemiNormedGroupCat
-- Porting note: deriving fails for ConcreteCategory, adding instance manually.
-- See https://github.com/leanprover-community/mathlib4/issues/5020
-- deriving instance LargeCategory, ConcreteCategory for SemiRingCat
instance : ConcreteCategory SemiNormedGroupCat := by
dsimp [SemiNormedGroupCat]
infer_instance
instance : CoeSort SemiNormedGroupCat Type* where
coe X := X.α
def of (M : Type u) [SeminormedAddCommGroup M] : SemiNormedGroupCat :=
Bundled.of M
#align SemiNormedGroupCat.of SemiNormedGroupCat.of
instance (M : SemiNormedGroupCat) : SeminormedAddCommGroup M :=
M.str
-- Porting note (#10754): added instance
instance funLike {V W : SemiNormedGroupCat} : FunLike (V ⟶ W) V W where
coe := (forget SemiNormedGroupCat).map
coe_injective' := fun f g h => by cases f; cases g; congr
instance toAddMonoidHomClass {V W : SemiNormedGroupCat} : AddMonoidHomClass (V ⟶ W) V W where
map_add f := f.map_add'
map_zero f := (AddMonoidHom.mk' f.toFun f.map_add').map_zero
-- Porting note (#10688): added to ease automation
@[ext]
lemma ext {M N : SemiNormedGroupCat} {f₁ f₂ : M ⟶ N} (h : ∀ (x : M), f₁ x = f₂ x) : f₁ = f₂ :=
DFunLike.ext _ _ h
@[simp]
theorem coe_of (V : Type u) [SeminormedAddCommGroup V] : (SemiNormedGroupCat.of V : Type u) = V :=
rfl
#align SemiNormedGroup.coe_of SemiNormedGroupCat.coe_of
-- Porting note: marked with high priority to short circuit simplifier's path
@[simp (high)]
theorem coe_id (V : SemiNormedGroupCat) : (𝟙 V : V → V) = id :=
rfl
#align SemiNormedGroup.coe_id SemiNormedGroupCat.coe_id
-- Porting note: marked with high priority to short circuit simplifier's path
@[simp (high)]
theorem coe_comp {M N K : SemiNormedGroupCat} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : M → K) = g ∘ f :=
rfl
#align SemiNormedGroup.coe_comp SemiNormedGroupCat.coe_comp
instance : Inhabited SemiNormedGroupCat :=
⟨of PUnit⟩
instance ofUnique (V : Type u) [SeminormedAddCommGroup V] [i : Unique V] :
Unique (SemiNormedGroupCat.of V) :=
i
#align SemiNormedGroup.of_unique SemiNormedGroupCat.ofUnique
instance {M N : SemiNormedGroupCat} : Zero (M ⟶ N) :=
NormedAddGroupHom.zero
@[simp]
theorem zero_apply {V W : SemiNormedGroupCat} (x : V) : (0 : V ⟶ W) x = 0 :=
rfl
#align SemiNormedGroup.zero_apply SemiNormedGroupCat.zero_apply
instance : Limits.HasZeroMorphisms.{u, u + 1} SemiNormedGroupCat where
theorem isZero_of_subsingleton (V : SemiNormedGroupCat) [Subsingleton V] : Limits.IsZero V := by
refine ⟨fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩, fun X => ⟨⟨⟨0⟩, fun f => ?_⟩⟩⟩
· ext x; have : x = 0 := Subsingleton.elim _ _; simp only [this, map_zero]
· ext; apply Subsingleton.elim
#align SemiNormedGroup.is_zero_of_subsingleton SemiNormedGroupCat.isZero_of_subsingleton
instance hasZeroObject : Limits.HasZeroObject SemiNormedGroupCat.{u} :=
⟨⟨of PUnit, isZero_of_subsingleton _⟩⟩
#align SemiNormedGroup.has_zero_object SemiNormedGroupCat.hasZeroObject
| Mathlib/Analysis/Normed/Group/SemiNormedGroupCat.lean | 121 | 129 | theorem iso_isometry_of_normNoninc {V W : SemiNormedGroupCat} (i : V ≅ W) (h1 : i.hom.NormNoninc)
(h2 : i.inv.NormNoninc) : Isometry i.hom := by |
apply AddMonoidHomClass.isometry_of_norm
intro v
apply le_antisymm (h1 v)
calc
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
‖v‖ = ‖i.inv (i.hom v)‖ := by erw [Iso.hom_inv_id_apply]
_ ≤ ‖i.hom v‖ := h2 _
| [
" ConcreteCategory SemiNormedGroupCat",
" ConcreteCategory (Bundled SeminormedAddCommGroup)",
" f = g",
" { toFun := toFun✝, map_add' := map_add'✝, bound' := bound'✝ } = g",
" { toFun := toFun✝¹, map_add' := map_add'✝¹, bound' := bound'✝¹ } =\n { toFun := toFun✝, map_add' := map_add'✝, bound' := bound'✝ ... | [
" ConcreteCategory SemiNormedGroupCat",
" ConcreteCategory (Bundled SeminormedAddCommGroup)",
" f = g",
" { toFun := toFun✝, map_add' := map_add'✝, bound' := bound'✝ } = g",
" { toFun := toFun✝¹, map_add' := map_add'✝¹, bound' := bound'✝¹ } =\n { toFun := toFun✝, map_add' := map_add'✝, bound' := bound'✝ ... |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 47 | 48 | theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by |
coherence
| [
" (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y",
" (λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y)",
" (λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom",
" 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ (X ⊗ Y)).inv ≫ (α_ X Y (𝟙_ C)).hom"
] | [
" (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y",
" (λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y)",
" (λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom"
] |
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
import Mathlib.Data.Rat.Cast.Order
import Mathlib.Order.Partition.Finpartition
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
#align_import combinatorics.simple_graph.density from "leanprover-community/mathlib"@"a4ec43f53b0bd44c697bcc3f5a62edd56f269ef1"
open Finset
variable {𝕜 ι κ α β : Type*}
namespace Rel
section Asymmetric
variable [LinearOrderedField 𝕜] (r : α → β → Prop) [∀ a, DecidablePred (r a)] {s s₁ s₂ : Finset α}
{t t₁ t₂ : Finset β} {a : α} {b : β} {δ : 𝕜}
def interedges (s : Finset α) (t : Finset β) : Finset (α × β) :=
(s ×ˢ t).filter fun e ↦ r e.1 e.2
#align rel.interedges Rel.interedges
def edgeDensity (s : Finset α) (t : Finset β) : ℚ :=
(interedges r s t).card / (s.card * t.card)
#align rel.edge_density Rel.edgeDensity
variable {r}
theorem mem_interedges_iff {x : α × β} : x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2 := by
rw [interedges, mem_filter, Finset.mem_product, and_assoc]
#align rel.mem_interedges_iff Rel.mem_interedges_iff
theorem mk_mem_interedges_iff : (a, b) ∈ interedges r s t ↔ a ∈ s ∧ b ∈ t ∧ r a b :=
mem_interedges_iff
#align rel.mk_mem_interedges_iff Rel.mk_mem_interedges_iff
@[simp]
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 66 | 67 | theorem interedges_empty_left (t : Finset β) : interedges r ∅ t = ∅ := by |
rw [interedges, Finset.empty_product, filter_empty]
| [
" x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2",
" interedges r ∅ t = ∅"
] | [
" x ∈ interedges r s t ↔ x.1 ∈ s ∧ x.2 ∈ t ∧ r x.1 x.2"
] |
import Mathlib.Algebra.Polynomial.Smeval
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.RingTheory.Polynomial.Pochhammer
section Multichoose
open Function Polynomial
class BinomialRing (R : Type*) [AddCommMonoid R] [Pow R ℕ] where
nsmul_right_injective (n : ℕ) (h : n ≠ 0) : Injective (n • · : R → R)
multichoose : R → ℕ → R
factorial_nsmul_multichoose (r : R) (n : ℕ) :
n.factorial • multichoose r n = (ascPochhammer ℕ n).smeval r
section Pochhammer
namespace Polynomial
| Mathlib/RingTheory/Binomial.lean | 90 | 97 | theorem ascPochhammer_smeval_cast (R : Type*) [Semiring R] {S : Type*} [NonAssocSemiring S]
[Pow S ℕ] [Module R S] [IsScalarTower R S S] [NatPowAssoc S]
(x : S) (n : ℕ) : (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x := by |
induction' n with n hn
· simp only [Nat.zero_eq, ascPochhammer_zero, smeval_one, one_smul]
· simp only [ascPochhammer_succ_right, mul_add, smeval_add, smeval_mul_X, ← Nat.cast_comm]
simp only [← C_eq_natCast, smeval_C_mul, hn, ← nsmul_eq_smul_cast R n]
exact rfl
| [
" (ascPochhammer R n).smeval x = (ascPochhammer ℕ n).smeval x",
" (ascPochhammer R 0).smeval x = (ascPochhammer ℕ 0).smeval x",
" (ascPochhammer R (n + 1)).smeval x = (ascPochhammer ℕ (n + 1)).smeval x",
" (ascPochhammer R n).smeval x * x + (↑n * ascPochhammer R n).smeval x =\n (ascPochhammer ℕ n).smeval x... | [] |
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Set.Finite
#align_import combinatorics.hall.finite from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
open Finset
universe u v
namespace HallMarriageTheorem
variable {ι : Type u} {α : Type v} [DecidableEq α] {t : ι → Finset α}
section Fintype
variable [Fintype ι]
theorem hall_cond_of_erase {x : ι} (a : α)
(ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card)
(s' : Finset { x' : ι | x' ≠ x }) : s'.card ≤ (s'.biUnion fun x' => (t x').erase a).card := by
haveI := Classical.decEq ι
specialize ha (s'.image fun z => z.1)
rw [image_nonempty, Finset.card_image_of_injective s' Subtype.coe_injective] at ha
by_cases he : s'.Nonempty
· have ha' : s'.card < (s'.biUnion fun x => t x).card := by
convert ha he fun h => by simpa [← h] using mem_univ x using 2
ext x
simp only [mem_image, mem_biUnion, exists_prop, SetCoe.exists, exists_and_right,
exists_eq_right, Subtype.coe_mk]
rw [← erase_biUnion]
by_cases hb : a ∈ s'.biUnion fun x => t x
· rw [card_erase_of_mem hb]
exact Nat.le_sub_one_of_lt ha'
· rw [erase_eq_of_not_mem hb]
exact Nat.le_of_lt ha'
· rw [nonempty_iff_ne_empty, not_not] at he
subst s'
simp
#align hall_marriage_theorem.hall_cond_of_erase HallMarriageTheorem.hall_cond_of_erase
theorem hall_hard_inductive_step_A {n : ℕ} (hn : Fintype.card ι = n + 1)
(ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card)
(ih :
∀ {ι' : Type u} [Fintype ι'] (t' : ι' → Finset α),
Fintype.card ι' ≤ n →
(∀ s' : Finset ι', s'.card ≤ (s'.biUnion t').card) →
∃ f : ι' → α, Function.Injective f ∧ ∀ x, f x ∈ t' x)
(ha : ∀ s : Finset ι, s.Nonempty → s ≠ univ → s.card < (s.biUnion t).card) :
∃ f : ι → α, Function.Injective f ∧ ∀ x, f x ∈ t x := by
haveI : Nonempty ι := Fintype.card_pos_iff.mp (hn.symm ▸ Nat.succ_pos _)
haveI := Classical.decEq ι
-- Choose an arbitrary element `x : ι` and `y : t x`.
let x := Classical.arbitrary ι
have tx_ne : (t x).Nonempty := by
rw [← Finset.card_pos]
calc
0 < 1 := Nat.one_pos
_ ≤ (Finset.biUnion {x} t).card := ht {x}
_ = (t x).card := by rw [Finset.singleton_biUnion]
choose y hy using tx_ne
-- Restrict to everything except `x` and `y`.
let ι' := { x' : ι | x' ≠ x }
let t' : ι' → Finset α := fun x' => (t x').erase y
have card_ι' : Fintype.card ι' = n :=
calc
Fintype.card ι' = Fintype.card ι - 1 := Set.card_ne_eq _
_ = n := by rw [hn, Nat.add_succ_sub_one, add_zero]
rcases ih t' card_ι'.le (hall_cond_of_erase y ha) with ⟨f', hfinj, hfr⟩
-- Extend the resulting function.
refine ⟨fun z => if h : z = x then y else f' ⟨z, h⟩, ?_, ?_⟩
· rintro z₁ z₂
have key : ∀ {x}, y ≠ f' x := by
intro x h
simpa [t', ← h] using hfr x
by_cases h₁ : z₁ = x <;> by_cases h₂ : z₂ = x <;> simp [h₁, h₂, hfinj.eq_iff, key, key.symm]
· intro z
simp only [ne_eq, Set.mem_setOf_eq]
split_ifs with hz
· rwa [hz]
· specialize hfr ⟨z, hz⟩
rw [mem_erase] at hfr
exact hfr.2
set_option linter.uppercaseLean3 false in
#align hall_marriage_theorem.hall_hard_inductive_step_A HallMarriageTheorem.hall_hard_inductive_step_A
theorem hall_cond_of_restrict {ι : Type u} {t : ι → Finset α} {s : Finset ι}
(ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card) (s' : Finset (s : Set ι)) :
s'.card ≤ (s'.biUnion fun a' => t a').card := by
classical
rw [← card_image_of_injective s' Subtype.coe_injective]
convert ht (s'.image fun z => z.1) using 1
apply congr_arg
ext y
simp
#align hall_marriage_theorem.hall_cond_of_restrict HallMarriageTheorem.hall_cond_of_restrict
| Mathlib/Combinatorics/Hall/Finite.lean | 136 | 158 | theorem hall_cond_of_compl {ι : Type u} {t : ι → Finset α} {s : Finset ι}
(hus : s.card = (s.biUnion t).card) (ht : ∀ s : Finset ι, s.card ≤ (s.biUnion t).card)
(s' : Finset (sᶜ : Set ι)) : s'.card ≤ (s'.biUnion fun x' => t x' \ s.biUnion t).card := by |
haveI := Classical.decEq ι
have disj : Disjoint s (s'.image fun z => z.1) := by
simp only [disjoint_left, not_exists, mem_image, exists_prop, SetCoe.exists, exists_and_right,
exists_eq_right, Subtype.coe_mk]
intro x hx hc _
exact absurd hx hc
have : s'.card = (s ∪ s'.image fun z => z.1).card - s.card := by
simp [disj, card_image_of_injective _ Subtype.coe_injective, Nat.add_sub_cancel_left]
rw [this, hus]
refine (Nat.sub_le_sub_right (ht _) _).trans ?_
rw [← card_sdiff]
· refine (card_le_card ?_).trans le_rfl
intro t
simp only [mem_biUnion, mem_sdiff, not_exists, mem_image, and_imp, mem_union, exists_and_right,
exists_imp]
rintro x (hx | ⟨x', hx', rfl⟩) rat hs
· exact False.elim <| (hs x) <| And.intro hx rat
· use x', hx', rat, hs
· apply biUnion_subset_biUnion_of_subset_left
apply subset_union_left
| [
" s'.card ≤ (s'.biUnion fun x' => (t ↑x').erase a).card",
" s'.card < (s'.biUnion fun x_1 => t ↑x_1).card",
" False",
" (s'.biUnion fun x_1 => t ↑x_1) = (image (fun z => ↑z) s').biUnion t",
" (x ∈ s'.biUnion fun x => t ↑x) ↔ x ∈ (image (fun z => ↑z) s').biUnion t",
" s'.card ≤ ((s'.biUnion fun x' => t ↑x'... | [
" s'.card ≤ (s'.biUnion fun x' => (t ↑x').erase a).card",
" s'.card < (s'.biUnion fun x_1 => t ↑x_1).card",
" False",
" (s'.biUnion fun x_1 => t ↑x_1) = (image (fun z => ↑z) s').biUnion t",
" (x ∈ s'.biUnion fun x => t ↑x) ↔ x ∈ (image (fun z => ↑z) s').biUnion t",
" s'.card ≤ ((s'.biUnion fun x' => t ↑x'... |
import Mathlib.Data.PNat.Prime
import Mathlib.Algebra.IsPrimePow
import Mathlib.NumberTheory.Cyclotomic.Basic
import Mathlib.RingTheory.Adjoin.PowerBasis
import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval
import Mathlib.RingTheory.Norm
import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand
#align_import number_theory.cyclotomic.primitive_roots from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
open Polynomial Algebra Finset FiniteDimensional IsCyclotomicExtension Nat PNat Set
open scoped IntermediateField
universe u v w z
variable {p n : ℕ+} (A : Type w) (B : Type z) (K : Type u) {L : Type v} (C : Type w)
variable [CommRing A] [CommRing B] [Algebra A B] [IsCyclotomicExtension {n} A B]
section Zeta
namespace IsCyclotomicExtension
variable (n)
noncomputable def zeta : B :=
(exists_prim_root A <| Set.mem_singleton n : ∃ r : B, IsPrimitiveRoot r n).choose
#align is_cyclotomic_extension.zeta IsCyclotomicExtension.zeta
@[simp]
theorem zeta_spec : IsPrimitiveRoot (zeta n A B) n :=
Classical.choose_spec (exists_prim_root A (Set.mem_singleton n) : ∃ r : B, IsPrimitiveRoot r n)
#align is_cyclotomic_extension.zeta_spec IsCyclotomicExtension.zeta_spec
| Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean | 92 | 95 | theorem aeval_zeta [IsDomain B] [NeZero ((n : ℕ) : B)] :
aeval (zeta n A B) (cyclotomic n A) = 0 := by |
rw [aeval_def, ← eval_map, ← IsRoot.def, map_cyclotomic, isRoot_cyclotomic_iff]
exact zeta_spec n A B
| [
" (aeval (zeta n A B)) (cyclotomic (↑n) A) = 0",
" IsPrimitiveRoot (zeta n A B) ↑n"
] | [] |
import Mathlib.Data.Set.Prod
import Mathlib.Logic.Function.Conjugate
#align_import data.set.function from "leanprover-community/mathlib"@"996b0ff959da753a555053a480f36e5f264d4207"
variable {α β γ : Type*} {ι : Sort*} {π : α → Type*}
open Equiv Equiv.Perm Function
namespace Set
section restrict
def restrict (s : Set α) (f : ∀ a : α, π a) : ∀ a : s, π a := fun x => f x
#align set.restrict Set.restrict
theorem restrict_eq (f : α → β) (s : Set α) : s.restrict f = f ∘ Subtype.val :=
rfl
#align set.restrict_eq Set.restrict_eq
@[simp]
theorem restrict_apply (f : α → β) (s : Set α) (x : s) : s.restrict f x = f x :=
rfl
#align set.restrict_apply Set.restrict_apply
theorem restrict_eq_iff {f : ∀ a, π a} {s : Set α} {g : ∀ a : s, π a} :
restrict s f = g ↔ ∀ (a) (ha : a ∈ s), f a = g ⟨a, ha⟩ :=
funext_iff.trans Subtype.forall
#align set.restrict_eq_iff Set.restrict_eq_iff
theorem eq_restrict_iff {s : Set α} {f : ∀ a : s, π a} {g : ∀ a, π a} :
f = restrict s g ↔ ∀ (a) (ha : a ∈ s), f ⟨a, ha⟩ = g a :=
funext_iff.trans Subtype.forall
#align set.eq_restrict_iff Set.eq_restrict_iff
@[simp]
theorem range_restrict (f : α → β) (s : Set α) : Set.range (s.restrict f) = f '' s :=
(range_comp _ _).trans <| congr_arg (f '' ·) Subtype.range_coe
#align set.range_restrict Set.range_restrict
theorem image_restrict (f : α → β) (s t : Set α) :
s.restrict f '' (Subtype.val ⁻¹' t) = f '' (t ∩ s) := by
rw [restrict_eq, image_comp, image_preimage_eq_inter_range, Subtype.range_coe]
#align set.image_restrict Set.image_restrict
@[simp]
theorem restrict_dite {s : Set α} [∀ x, Decidable (x ∈ s)] (f : ∀ a ∈ s, β)
(g : ∀ a ∉ s, β) :
(s.restrict fun a => if h : a ∈ s then f a h else g a h) = (fun a : s => f a a.2) :=
funext fun a => dif_pos a.2
#align set.restrict_dite Set.restrict_dite
@[simp]
theorem restrict_dite_compl {s : Set α} [∀ x, Decidable (x ∈ s)] (f : ∀ a ∈ s, β)
(g : ∀ a ∉ s, β) :
(sᶜ.restrict fun a => if h : a ∈ s then f a h else g a h) = (fun a : (sᶜ : Set α) => g a a.2) :=
funext fun a => dif_neg a.2
#align set.restrict_dite_compl Set.restrict_dite_compl
@[simp]
theorem restrict_ite (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] :
(s.restrict fun a => if a ∈ s then f a else g a) = s.restrict f :=
restrict_dite _ _
#align set.restrict_ite Set.restrict_ite
@[simp]
theorem restrict_ite_compl (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] :
(sᶜ.restrict fun a => if a ∈ s then f a else g a) = sᶜ.restrict g :=
restrict_dite_compl _ _
#align set.restrict_ite_compl Set.restrict_ite_compl
@[simp]
theorem restrict_piecewise (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] :
s.restrict (piecewise s f g) = s.restrict f :=
restrict_ite _ _ _
#align set.restrict_piecewise Set.restrict_piecewise
@[simp]
theorem restrict_piecewise_compl (f g : α → β) (s : Set α) [∀ x, Decidable (x ∈ s)] :
sᶜ.restrict (piecewise s f g) = sᶜ.restrict g :=
restrict_ite_compl _ _ _
#align set.restrict_piecewise_compl Set.restrict_piecewise_compl
theorem restrict_extend_range (f : α → β) (g : α → γ) (g' : β → γ) :
(range f).restrict (extend f g g') = fun x => g x.coe_prop.choose := by
classical
exact restrict_dite _ _
#align set.restrict_extend_range Set.restrict_extend_range
@[simp]
| Mathlib/Data/Set/Function.lean | 124 | 127 | theorem restrict_extend_compl_range (f : α → β) (g : α → γ) (g' : β → γ) :
(range f)ᶜ.restrict (extend f g g') = g' ∘ Subtype.val := by |
classical
exact restrict_dite_compl _ _
| [
" s.restrict f '' (Subtype.val ⁻¹' t) = f '' (t ∩ s)",
" (range f).restrict (extend f g g') = fun x => g (Exists.choose ⋯)",
" (range f)ᶜ.restrict (extend f g g') = g' ∘ Subtype.val"
] | [
" s.restrict f '' (Subtype.val ⁻¹' t) = f '' (t ∩ s)",
" (range f).restrict (extend f g g') = fun x => g (Exists.choose ⋯)"
] |
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]
| Mathlib/Order/Partition/Equipartition.lean | 104 | 110 | 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]
| [
" P.IsEquipartition ↔ ∀ a ∈ P.parts, a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1",
" t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1",
" ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1)",
" False",
" s.card / P.parts.card ≤ t.card",
" (∑ i ... | [
" P.IsEquipartition ↔ ∀ a ∈ P.parts, a.card = s.card / P.parts.card ∨ a.card = s.card / P.parts.card + 1",
" t.card = s.card / P.parts.card ↔ t.card ≠ s.card / P.parts.card + 1",
" ¬(t.card = s.card / P.parts.card ∧ t.card = s.card / P.parts.card + 1)",
" False",
" s.card / P.parts.card ≤ t.card",
" (∑ i ... |
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
| Mathlib/Data/Real/Pi/Bounds.lean | 28 | 37 | 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
| [
" 2 ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) < π",
" √(2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2) < π",
" 0 < 2 ^ (n + 2)",
" (π / 2 ^ (n + 2)).sin < π / 2 ^ (n + 2)",
" 0 < π / 2 ^ (n + 2)",
" 0 < 2",
" 2 ^ (n + 1) * √(2 - sqrtTwoAddSeries 0 n) = √(2 - sqrtTwoAddSeries 0 n) / 2 * 2 ^ (n + 2)",
" 2 ≠ ... | [] |
import Mathlib.Geometry.Manifold.MFDeriv.Basic
noncomputable section
open scoped Manifold
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {f : E → E'}
{s : Set E} {x : E}
section MFDerivFderiv
theorem uniqueMDiffWithinAt_iff_uniqueDiffWithinAt :
UniqueMDiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x := by
simp only [UniqueMDiffWithinAt, mfld_simps]
#align unique_mdiff_within_at_iff_unique_diff_within_at uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
alias ⟨UniqueMDiffWithinAt.uniqueDiffWithinAt, UniqueDiffWithinAt.uniqueMDiffWithinAt⟩ :=
uniqueMDiffWithinAt_iff_uniqueDiffWithinAt
#align unique_mdiff_within_at.unique_diff_within_at UniqueMDiffWithinAt.uniqueDiffWithinAt
#align unique_diff_within_at.unique_mdiff_within_at UniqueDiffWithinAt.uniqueMDiffWithinAt
theorem uniqueMDiffOn_iff_uniqueDiffOn : UniqueMDiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s := by
simp [UniqueMDiffOn, UniqueDiffOn, uniqueMDiffWithinAt_iff_uniqueDiffWithinAt]
#align unique_mdiff_on_iff_unique_diff_on uniqueMDiffOn_iff_uniqueDiffOn
alias ⟨UniqueMDiffOn.uniqueDiffOn, UniqueDiffOn.uniqueMDiffOn⟩ := uniqueMDiffOn_iff_uniqueDiffOn
#align unique_mdiff_on.unique_diff_on UniqueMDiffOn.uniqueDiffOn
#align unique_diff_on.unique_mdiff_on UniqueDiffOn.uniqueMDiffOn
-- Porting note (#10618): was `@[simp, mfld_simps]` but `simp` can prove it
theorem writtenInExtChartAt_model_space : writtenInExtChartAt 𝓘(𝕜, E) 𝓘(𝕜, E') x f = f :=
rfl
#align written_in_ext_chart_model_space writtenInExtChartAt_model_space
theorem hasMFDerivWithinAt_iff_hasFDerivWithinAt {f'} :
HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x := by
simpa only [HasMFDerivWithinAt, and_iff_right_iff_imp, mfld_simps] using
HasFDerivWithinAt.continuousWithinAt
#align has_mfderiv_within_at_iff_has_fderiv_within_at hasMFDerivWithinAt_iff_hasFDerivWithinAt
alias ⟨HasMFDerivWithinAt.hasFDerivWithinAt, HasFDerivWithinAt.hasMFDerivWithinAt⟩ :=
hasMFDerivWithinAt_iff_hasFDerivWithinAt
#align has_mfderiv_within_at.has_fderiv_within_at HasMFDerivWithinAt.hasFDerivWithinAt
#align has_fderiv_within_at.has_mfderiv_within_at HasFDerivWithinAt.hasMFDerivWithinAt
theorem hasMFDerivAt_iff_hasFDerivAt {f'} :
HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x := by
rw [← hasMFDerivWithinAt_univ, hasMFDerivWithinAt_iff_hasFDerivWithinAt, hasFDerivWithinAt_univ]
#align has_mfderiv_at_iff_has_fderiv_at hasMFDerivAt_iff_hasFDerivAt
alias ⟨HasMFDerivAt.hasFDerivAt, HasFDerivAt.hasMFDerivAt⟩ := hasMFDerivAt_iff_hasFDerivAt
#align has_mfderiv_at.has_fderiv_at HasMFDerivAt.hasFDerivAt
#align has_fderiv_at.has_mfderiv_at HasFDerivAt.hasMFDerivAt
theorem mdifferentiableWithinAt_iff_differentiableWithinAt :
MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x ↔ DifferentiableWithinAt 𝕜 f s x := by
simp only [mdifferentiableWithinAt_iff', mfld_simps]
exact ⟨fun H => H.2, fun H => ⟨H.continuousWithinAt, H⟩⟩
#align mdifferentiable_within_at_iff_differentiable_within_at mdifferentiableWithinAt_iff_differentiableWithinAt
alias ⟨MDifferentiableWithinAt.differentiableWithinAt,
DifferentiableWithinAt.mdifferentiableWithinAt⟩ :=
mdifferentiableWithinAt_iff_differentiableWithinAt
#align mdifferentiable_within_at.differentiable_within_at MDifferentiableWithinAt.differentiableWithinAt
#align differentiable_within_at.mdifferentiable_within_at DifferentiableWithinAt.mdifferentiableWithinAt
theorem mdifferentiableAt_iff_differentiableAt :
MDifferentiableAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x ↔ DifferentiableAt 𝕜 f x := by
simp only [mdifferentiableAt_iff, differentiableWithinAt_univ, mfld_simps]
exact ⟨fun H => H.2, fun H => ⟨H.continuousAt, H⟩⟩
#align mdifferentiable_at_iff_differentiable_at mdifferentiableAt_iff_differentiableAt
alias ⟨MDifferentiableAt.differentiableAt, DifferentiableAt.mdifferentiableAt⟩ :=
mdifferentiableAt_iff_differentiableAt
#align mdifferentiable_at.differentiable_at MDifferentiableAt.differentiableAt
#align differentiable_at.mdifferentiable_at DifferentiableAt.mdifferentiableAt
| Mathlib/Geometry/Manifold/MFDeriv/FDeriv.lean | 96 | 99 | theorem mdifferentiableOn_iff_differentiableOn :
MDifferentiableOn 𝓘(𝕜, E) 𝓘(𝕜, E') f s ↔ DifferentiableOn 𝕜 f s := by |
simp only [MDifferentiableOn, DifferentiableOn,
mdifferentiableWithinAt_iff_differentiableWithinAt]
| [
" UniqueMDiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x",
" UniqueMDiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s",
" HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x",
" HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x",
" MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E... | [
" UniqueMDiffWithinAt 𝓘(𝕜, E) s x ↔ UniqueDiffWithinAt 𝕜 s x",
" UniqueMDiffOn 𝓘(𝕜, E) s ↔ UniqueDiffOn 𝕜 s",
" HasMFDerivWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E') f s x f' ↔ HasFDerivWithinAt f f' s x",
" HasMFDerivAt 𝓘(𝕜, E) 𝓘(𝕜, E') f x f' ↔ HasFDerivAt f f' x",
" MDifferentiableWithinAt 𝓘(𝕜, E) 𝓘(𝕜, E... |
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.MeasureTheory.Group.Measure
#align_import measure_theory.group.integration from "leanprover-community/mathlib"@"ec247d43814751ffceb33b758e8820df2372bf6f"
namespace MeasureTheory
open Measure TopologicalSpace
open scoped ENNReal
variable {𝕜 M α G E F : Type*} [MeasurableSpace G]
variable [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F]
variable {μ : Measure G} {f : G → E} {g : G}
section MeasurableMul
variable [Group G] [MeasurableMul G]
@[to_additive
"Translating a function by left-addition does not change its integral with respect to a
left-invariant measure."] -- Porting note: was `@[simp]`
| Mathlib/MeasureTheory/Group/Integral.lean | 58 | 61 | theorem integral_mul_left_eq_self [IsMulLeftInvariant μ] (f : G → E) (g : G) :
(∫ x, f (g * x) ∂μ) = ∫ x, f x ∂μ := by |
have h_mul : MeasurableEmbedding fun x => g * x := (MeasurableEquiv.mulLeft g).measurableEmbedding
rw [← h_mul.integral_map, map_mul_left_eq_self]
| [
" ∫ (x : G), f (g * x) ∂μ = ∫ (x : G), f x ∂μ"
] | [] |
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
| Mathlib/Algebra/Ring/Ext.lean | 133 | 135 | theorem AddCommMonoidWithOne.toAddMonoidWithOne_injective :
Function.Injective (@AddCommMonoidWithOne.toAddMonoidWithOne R) := by |
rintro ⟨⟩ ⟨⟩ _; congr
| [
" inst₁ = inst₂",
" toAddMonoid = toAddMonoid",
" HAdd.hAdd = HAdd.hAdd",
" NatCast.natCast = NatCast.natCast",
" NatCast.natCast n = NatCast.natCast n",
" NatCast.natCast 0 = NatCast.natCast 0",
" 0 = 0",
" NatCast.natCast (n + 1) = NatCast.natCast (n + 1)",
" NatCast.natCast n + 1 = NatCast.natCas... | [
" inst₁ = inst₂",
" toAddMonoid = toAddMonoid",
" HAdd.hAdd = HAdd.hAdd",
" NatCast.natCast = NatCast.natCast",
" NatCast.natCast n = NatCast.natCast n",
" NatCast.natCast 0 = NatCast.natCast 0",
" 0 = 0",
" NatCast.natCast (n + 1) = NatCast.natCast (n + 1)",
" NatCast.natCast n + 1 = NatCast.natCas... |
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.Instances.NNReal
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.Metrizable.Basic
import Mathlib.Topology.Order.T5
#align_import topology.instances.ennreal from "leanprover-community/mathlib"@"ec4b2eeb50364487f80421c0b4c41328a611f30d"
noncomputable section
open Set Filter Metric Function
open scoped Classical Topology ENNReal NNReal Filter
variable {α : Type*} {β : Type*} {γ : Type*}
namespace ENNReal
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} {x y z : ℝ≥0∞} {ε ε₁ ε₂ : ℝ≥0∞} {s : Set ℝ≥0∞}
section TopologicalSpace
open TopologicalSpace
instance : TopologicalSpace ℝ≥0∞ := Preorder.topology ℝ≥0∞
instance : OrderTopology ℝ≥0∞ := ⟨rfl⟩
-- short-circuit type class inference
instance : T2Space ℝ≥0∞ := inferInstance
instance : T5Space ℝ≥0∞ := inferInstance
instance : T4Space ℝ≥0∞ := inferInstance
instance : SecondCountableTopology ℝ≥0∞ :=
orderIsoUnitIntervalBirational.toHomeomorph.embedding.secondCountableTopology
instance : MetrizableSpace ENNReal :=
orderIsoUnitIntervalBirational.toHomeomorph.embedding.metrizableSpace
theorem embedding_coe : Embedding ((↑) : ℝ≥0 → ℝ≥0∞) :=
coe_strictMono.embedding_of_ordConnected <| by rw [range_coe']; exact ordConnected_Iio
#align ennreal.embedding_coe ENNReal.embedding_coe
theorem isOpen_ne_top : IsOpen { a : ℝ≥0∞ | a ≠ ∞ } := isOpen_ne
#align ennreal.is_open_ne_top ENNReal.isOpen_ne_top
theorem isOpen_Ico_zero : IsOpen (Ico 0 b) := by
rw [ENNReal.Ico_eq_Iio]
exact isOpen_Iio
#align ennreal.is_open_Ico_zero ENNReal.isOpen_Ico_zero
theorem openEmbedding_coe : OpenEmbedding ((↑) : ℝ≥0 → ℝ≥0∞) :=
⟨embedding_coe, by rw [range_coe']; exact isOpen_Iio⟩
#align ennreal.open_embedding_coe ENNReal.openEmbedding_coe
theorem coe_range_mem_nhds : range ((↑) : ℝ≥0 → ℝ≥0∞) ∈ 𝓝 (r : ℝ≥0∞) :=
IsOpen.mem_nhds openEmbedding_coe.isOpen_range <| mem_range_self _
#align ennreal.coe_range_mem_nhds ENNReal.coe_range_mem_nhds
@[norm_cast]
theorem tendsto_coe {f : Filter α} {m : α → ℝ≥0} {a : ℝ≥0} :
Tendsto (fun a => (m a : ℝ≥0∞)) f (𝓝 ↑a) ↔ Tendsto m f (𝓝 a) :=
embedding_coe.tendsto_nhds_iff.symm
#align ennreal.tendsto_coe ENNReal.tendsto_coe
theorem continuous_coe : Continuous ((↑) : ℝ≥0 → ℝ≥0∞) :=
embedding_coe.continuous
#align ennreal.continuous_coe ENNReal.continuous_coe
theorem continuous_coe_iff {α} [TopologicalSpace α] {f : α → ℝ≥0} :
(Continuous fun a => (f a : ℝ≥0∞)) ↔ Continuous f :=
embedding_coe.continuous_iff.symm
#align ennreal.continuous_coe_iff ENNReal.continuous_coe_iff
theorem nhds_coe {r : ℝ≥0} : 𝓝 (r : ℝ≥0∞) = (𝓝 r).map (↑) :=
(openEmbedding_coe.map_nhds_eq r).symm
#align ennreal.nhds_coe ENNReal.nhds_coe
| Mathlib/Topology/Instances/ENNReal.lean | 92 | 94 | theorem tendsto_nhds_coe_iff {α : Type*} {l : Filter α} {x : ℝ≥0} {f : ℝ≥0∞ → α} :
Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ (↑) : ℝ≥0 → α) (𝓝 x) l := by |
rw [nhds_coe, tendsto_map'_iff]
| [
" (range ofNNReal).OrdConnected",
" (Iio ⊤).OrdConnected",
" IsOpen (Ico 0 b)",
" IsOpen (Iio b)",
" IsOpen (range ofNNReal)",
" IsOpen (Iio ⊤)",
" Tendsto f (𝓝 ↑x) l ↔ Tendsto (f ∘ ofNNReal) (𝓝 x) l"
] | [
" (range ofNNReal).OrdConnected",
" (Iio ⊤).OrdConnected",
" IsOpen (Ico 0 b)",
" IsOpen (Iio b)",
" IsOpen (range ofNNReal)",
" IsOpen (Iio ⊤)"
] |
import Mathlib.Algebra.Polynomial.Expand
import Mathlib.Algebra.Polynomial.Splits
import Mathlib.Algebra.Squarefree.Basic
import Mathlib.FieldTheory.Minpoly.Field
import Mathlib.RingTheory.PowerBasis
#align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
universe u v w
open scoped Classical
open Polynomial Finset
namespace Polynomial
section CommSemiring
variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S]
def Separable (f : R[X]) : Prop :=
IsCoprime f (derivative f)
#align polynomial.separable Polynomial.Separable
theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) :=
Iff.rfl
#align polynomial.separable_def Polynomial.separable_def
theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 :=
Iff.rfl
#align polynomial.separable_def' Polynomial.separable_def'
theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by
rintro ⟨x, y, h⟩
simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h
#align polynomial.not_separable_zero Polynomial.not_separable_zero
theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 :=
(not_separable_zero <| · ▸ h)
@[simp]
theorem separable_one : (1 : R[X]).Separable :=
isCoprime_one_left
#align polynomial.separable_one Polynomial.separable_one
@[nontriviality]
| Mathlib/FieldTheory/Separable.lean | 66 | 67 | theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by |
simp [Separable, IsCoprime, eq_iff_true_of_subsingleton]
| [
" ¬Separable 0",
" False",
" f.Separable"
] | [
" ¬Separable 0",
" False"
] |
import Mathlib.Data.List.Basic
#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
open Nat
namespace List
variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
variable [DecidableEq α]
section Union
#align list.nil_union List.nil_union
#align list.cons_union List.cons_unionₓ
#align list.mem_union List.mem_union_iff
theorem mem_union_left (h : a ∈ l₁) (l₂ : List α) : a ∈ l₁ ∪ l₂ :=
mem_union_iff.2 (Or.inl h)
#align list.mem_union_left List.mem_union_left
theorem mem_union_right (l₁ : List α) (h : a ∈ l₂) : a ∈ l₁ ∪ l₂ :=
mem_union_iff.2 (Or.inr h)
#align list.mem_union_right List.mem_union_right
theorem sublist_suffix_of_union : ∀ l₁ l₂ : List α, ∃ t, t <+ l₁ ∧ t ++ l₂ = l₁ ∪ l₂
| [], l₂ => ⟨[], by rfl, rfl⟩
| a :: l₁, l₂ =>
let ⟨t, s, e⟩ := sublist_suffix_of_union l₁ l₂
if h : a ∈ l₁ ∪ l₂ then
⟨t, sublist_cons_of_sublist _ s, by
simp only [e, cons_union, insert_of_mem h]⟩
else
⟨a :: t, s.cons_cons _, by
simp only [cons_append, cons_union, e, insert_of_not_mem h]⟩
#align list.sublist_suffix_of_union List.sublist_suffix_of_union
theorem suffix_union_right (l₁ l₂ : List α) : l₂ <:+ l₁ ∪ l₂ :=
(sublist_suffix_of_union l₁ l₂).imp fun _ => And.right
#align list.suffix_union_right List.suffix_union_right
theorem union_sublist_append (l₁ l₂ : List α) : l₁ ∪ l₂ <+ l₁ ++ l₂ :=
let ⟨_, s, e⟩ := sublist_suffix_of_union l₁ l₂
e ▸ (append_sublist_append_right _).2 s
#align list.union_sublist_append List.union_sublist_append
| Mathlib/Data/List/Lattice.lean | 109 | 110 | theorem forall_mem_union : (∀ x ∈ l₁ ∪ l₂, p x) ↔ (∀ x ∈ l₁, p x) ∧ ∀ x ∈ l₂, p x := by |
simp only [mem_union_iff, or_imp, forall_and]
| [
" [] <+ []",
" t ++ l₂ = a :: l₁ ∪ l₂",
" a :: t ++ l₂ = a :: l₁ ∪ l₂",
" (∀ (x : α), x ∈ l₁ ∪ l₂ → p x) ↔ (∀ (x : α), x ∈ l₁ → p x) ∧ ∀ (x : α), x ∈ l₂ → p x"
] | [
" [] <+ []",
" t ++ l₂ = a :: l₁ ∪ l₂",
" a :: t ++ l₂ = a :: l₁ ∪ l₂"
] |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 42 | 43 | theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by | coherence
| [
" (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y",
" (λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y)",
" (λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom"
] | [
" (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y",
" (λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y)"
] |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Combinatorics.SimpleGraph.Dart
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Data.ZMod.Parity
#align_import combinatorics.simple_graph.degree_sum from "leanprover-community/mathlib"@"90659cbe25e59ec302e2fb92b00e9732160cc620"
open Finset
namespace SimpleGraph
universe u
variable {V : Type u} (G : SimpleGraph V)
section DegreeSum
variable [Fintype V] [DecidableRel G.Adj]
-- Porting note: Changed to `Fintype (Sym2 V)` to match Combinatorics.SimpleGraph.Basic
variable [Fintype (Sym2 V)]
| Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean | 56 | 64 | theorem dart_fst_fiber [DecidableEq V] (v : V) :
(univ.filter fun d : G.Dart => d.fst = v) = univ.image (G.dartOfNeighborSet v) := by |
ext d
simp only [mem_image, true_and_iff, mem_filter, SetCoe.exists, mem_univ, exists_prop_of_true]
constructor
· rintro rfl
exact ⟨_, d.adj, by ext <;> rfl⟩
· rintro ⟨e, he, rfl⟩
rfl
| [
" filter (fun d => d.toProd.1 = v) univ = image (G.dartOfNeighborSet v) univ",
" d ∈ filter (fun d => d.toProd.1 = v) univ ↔ d ∈ image (G.dartOfNeighborSet v) univ",
" d.toProd.1 = v ↔ ∃ x, ∃ (h : x ∈ G.neighborSet v), G.dartOfNeighborSet v ⟨x, h⟩ = d",
" d.toProd.1 = v → ∃ x, ∃ (h : x ∈ G.neighborSet v), G.d... | [] |
import Mathlib.MeasureTheory.Integral.SetToL1
#align_import measure_theory.integral.bochner from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
assert_not_exists Differentiable
noncomputable section
open scoped Topology NNReal ENNReal MeasureTheory
open Set Filter TopologicalSpace ENNReal EMetric
namespace MeasureTheory
variable {α E F 𝕜 : Type*}
local infixr:25 " →ₛ " => SimpleFunc
namespace SimpleFunc
section PosPart
variable [LinearOrder E] [Zero E] [MeasurableSpace α]
def posPart (f : α →ₛ E) : α →ₛ E :=
f.map fun b => max b 0
#align measure_theory.simple_func.pos_part MeasureTheory.SimpleFunc.posPart
def negPart [Neg E] (f : α →ₛ E) : α →ₛ E :=
posPart (-f)
#align measure_theory.simple_func.neg_part MeasureTheory.SimpleFunc.negPart
theorem posPart_map_norm (f : α →ₛ ℝ) : (posPart f).map norm = posPart f := by
ext; rw [map_apply, Real.norm_eq_abs, abs_of_nonneg]; exact le_max_right _ _
#align measure_theory.simple_func.pos_part_map_norm MeasureTheory.SimpleFunc.posPart_map_norm
| Mathlib/MeasureTheory/Integral/Bochner.lean | 278 | 279 | theorem negPart_map_norm (f : α →ₛ ℝ) : (negPart f).map norm = negPart f := by |
rw [negPart]; exact posPart_map_norm _
| [
" map norm f.posPart = f.posPart",
" ↑(map norm f.posPart) a✝ = ↑f.posPart a✝",
" 0 ≤ ↑f.posPart a✝",
" map norm f.negPart = f.negPart",
" map norm (-f).posPart = (-f).posPart"
] | [
" map norm f.posPart = f.posPart",
" ↑(map norm f.posPart) a✝ = ↑f.posPart a✝",
" 0 ≤ ↑f.posPart a✝"
] |
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
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]
#align list.duplicate.mono_sublist List.Duplicate.mono_sublist
theorem duplicate_iff_sublist : x ∈+ l ↔ [x, x] <+ l := by
induction' l with y l IH
· simp
· by_cases hx : x = y
· simp [hx, cons_sublist_cons, singleton_sublist]
· rw [duplicate_cons_iff_of_ne hx, IH]
refine ⟨sublist_cons_of_sublist y, fun h => ?_⟩
cases h
· assumption
· contradiction
#align list.duplicate_iff_sublist List.duplicate_iff_sublist
theorem nodup_iff_forall_not_duplicate : Nodup l ↔ ∀ x : α, ¬x ∈+ l := by
simp_rw [nodup_iff_sublist, duplicate_iff_sublist]
#align list.nodup_iff_forall_not_duplicate List.nodup_iff_forall_not_duplicate
| Mathlib/Data/List/Duplicate.lean | 133 | 134 | theorem exists_duplicate_iff_not_nodup : (∃ x : α, x ∈+ l) ↔ ¬Nodup l := by |
simp [nodup_iff_forall_not_duplicate]
| [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l",
" y = x ∧ x ∈ l ∨ x ∈+ l",
" x = x ∧ x ∈ l ∨ x ∈+ l",
" x ∈+ y :: l",
" x ∈+ x :: l",
" x ∈+ l",
" x ∈+ y :: l ↔ x ∈+ l",
" x ∈+ l'",
" x ∈+ []",
" x ∈+ y ... | [
" x ∈ l",
" x ∈ x :: l'",
" x ∈ y :: l'",
" l ≠ [y]",
" x :: l' ≠ [y]",
" z :: l' ≠ [y]",
" x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l",
" y = x ∧ x ∈ l ∨ x ∈+ l",
" x = x ∧ x ∈ l ∨ x ∈+ l",
" x ∈+ y :: l",
" x ∈+ x :: l",
" x ∈+ l",
" x ∈+ y :: l ↔ x ∈+ l",
" x ∈+ l'",
" x ∈+ []",
" x ∈+ y ... |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Data.Set.Function
#align_import data.set.intervals.surj_on from "leanprover-community/mathlib"@"a59dad53320b73ef180174aae867addd707ef00e"
variable {α : Type*} {β : Type*} [LinearOrder α] [PartialOrder β] {f : α → β}
open Set Function
open OrderDual (toDual)
theorem surjOn_Ioo_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
(a b : α) : SurjOn f (Ioo a b) (Ioo (f a) (f b)) := by
intro p hp
rcases h_surj p with ⟨x, rfl⟩
refine ⟨x, mem_Ioo.2 ?_, rfl⟩
contrapose! hp
exact fun h => h.2.not_le (h_mono <| hp <| h_mono.reflect_lt h.1)
#align surj_on_Ioo_of_monotone_surjective surjOn_Ioo_of_monotone_surjective
| Mathlib/Order/Interval/Set/SurjOn.lean | 35 | 44 | theorem surjOn_Ico_of_monotone_surjective (h_mono : Monotone f) (h_surj : Function.Surjective f)
(a b : α) : SurjOn f (Ico a b) (Ico (f a) (f b)) := by |
obtain hab | hab := lt_or_le a b
· intro p hp
rcases eq_left_or_mem_Ioo_of_mem_Ico hp with (rfl | hp')
· exact mem_image_of_mem f (left_mem_Ico.mpr hab)
· have := surjOn_Ioo_of_monotone_surjective h_mono h_surj a b hp'
exact image_subset f Ioo_subset_Ico_self this
· rw [Ico_eq_empty (h_mono hab).not_lt]
exact surjOn_empty f _
| [
" SurjOn f (Ioo a b) (Ioo (f a) (f b))",
" p ∈ f '' Ioo a b",
" f x ∈ f '' Ioo a b",
" a < x ∧ x < b",
" f x ∉ Ioo (f a) (f b)",
" SurjOn f (Ico a b) (Ico (f a) (f b))",
" p ∈ f '' Ico a b",
" f a ∈ f '' Ico a b",
" SurjOn f (Ico a b) ∅"
] | [
" SurjOn f (Ioo a b) (Ioo (f a) (f b))",
" p ∈ f '' Ioo a b",
" f x ∈ f '' Ioo a b",
" a < x ∧ x < b",
" f x ∉ Ioo (f a) (f b)"
] |
import Mathlib.Algebra.Polynomial.Coeff
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Polynomial
open Finset (antidiagonal mem_antidiagonal)
namespace PowerSeries
open Finsupp (single)
variable {R : Type*}
section Trunc
variable [Semiring R]
open Finset Nat
def trunc (n : ℕ) (φ : R⟦X⟧) : R[X] :=
∑ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m φ)
#align power_series.trunc PowerSeries.trunc
theorem coeff_trunc (m) (n) (φ : R⟦X⟧) :
(trunc n φ).coeff m = if m < n then coeff R m φ else 0 := by
simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff]
#align power_series.coeff_trunc PowerSeries.coeff_trunc
@[simp]
theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 :=
Polynomial.ext fun m => by
rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero]
split_ifs <;> rfl
#align power_series.trunc_zero PowerSeries.trunc_zero
@[simp]
theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_one, Polynomial.coeff_one]
split_ifs with h _ h'
· rfl
· rfl
· subst h'; simp at h
· rfl
#align power_series.trunc_one PowerSeries.trunc_one
@[simp]
theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a :=
Polynomial.ext fun m => by
rw [coeff_trunc, coeff_C, Polynomial.coeff_C]
split_ifs with H <;> first |rfl|try simp_all
set_option linter.uppercaseLean3 false in
#align power_series.trunc_C PowerSeries.trunc_C
@[simp]
theorem trunc_add (n) (φ ψ : R⟦X⟧) : trunc n (φ + ψ) = trunc n φ + trunc n ψ :=
Polynomial.ext fun m => by
simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add]
split_ifs with H
· rfl
· rw [zero_add]
#align power_series.trunc_add PowerSeries.trunc_add
| Mathlib/RingTheory/PowerSeries/Trunc.lean | 84 | 86 | theorem trunc_succ (f : R⟦X⟧) (n : ℕ) :
trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by |
rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range]
| [
" (trunc n φ).coeff m = if m < n then (coeff R m) φ else 0",
" (trunc n 0).coeff m = Polynomial.coeff 0 m",
" (if m < n then 0 else 0) = 0",
" 0 = 0",
" (trunc (n + 1) 1).coeff m = Polynomial.coeff 1 m",
" (if m < n + 1 then if m = 0 then 1 else 0 else 0) = if m = 0 then 1 else 0",
" 1 = 1",
" 0 = 1",... | [
" (trunc n φ).coeff m = if m < n then (coeff R m) φ else 0",
" (trunc n 0).coeff m = Polynomial.coeff 0 m",
" (if m < n then 0 else 0) = 0",
" 0 = 0",
" (trunc (n + 1) 1).coeff m = Polynomial.coeff 1 m",
" (if m < n + 1 then if m = 0 then 1 else 0 else 0) = if m = 0 then 1 else 0",
" 1 = 1",
" 0 = 1",... |
import Mathlib.Algebra.Group.Hom.End
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Algebra.SMulWithZero
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.GroupTheory.GroupAction.Units
#align_import algebra.module.basic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
assert_not_exists Multiset
assert_not_exists Set.indicator
assert_not_exists Pi.single_smul₀
open Function Set
universe u v
variable {α R k S M M₂ M₃ ι : Type*}
@[ext]
class Module (R : Type u) (M : Type v) [Semiring R] [AddCommMonoid M] extends
DistribMulAction R M where
protected add_smul : ∀ (r s : R) (x : M), (r + s) • x = r • x + s • x
protected zero_smul : ∀ x : M, (0 : R) • x = 0
#align module Module
#align module.ext Module.ext
#align module.ext_iff Module.ext_iff
section AddCommMonoid
variable [Semiring R] [AddCommMonoid M] [Module R M] (r s : R) (x y : M)
-- see Note [lower instance priority]
instance (priority := 100) Module.toMulActionWithZero : MulActionWithZero R M :=
{ (inferInstance : MulAction R M) with
smul_zero := smul_zero
zero_smul := Module.zero_smul }
#align module.to_mul_action_with_zero Module.toMulActionWithZero
instance AddCommMonoid.natModule : Module ℕ M where
one_smul := one_nsmul
mul_smul m n a := mul_nsmul' a m n
smul_add n a b := nsmul_add a b n
smul_zero := nsmul_zero
zero_smul := zero_nsmul
add_smul r s x := add_nsmul x r s
#align add_comm_monoid.nat_module AddCommMonoid.natModule
theorem AddMonoid.End.natCast_def (n : ℕ) :
(↑n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd ℕ M n :=
rfl
#align add_monoid.End.nat_cast_def AddMonoid.End.natCast_def
theorem add_smul : (r + s) • x = r • x + s • x :=
Module.add_smul r s x
#align add_smul add_smul
| Mathlib/Algebra/Module/Defs.lean | 97 | 98 | theorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a • x + b • x = x := by |
rw [← add_smul, h, one_smul]
| [
" a • x + b • x = x"
] | [] |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
#align_import analysis.special_functions.compare_exp from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Asymptotics Filter Function
open scoped Topology
namespace Complex
structure IsExpCmpFilter (l : Filter ℂ) : Prop where
tendsto_re : Tendsto re l atTop
isBigO_im_pow_re : ∀ n : ℕ, (fun z : ℂ => z.im ^ n) =O[l] fun z => Real.exp z.re
#align complex.is_exp_cmp_filter Complex.IsExpCmpFilter
namespace IsExpCmpFilter
variable {l : Filter ℂ}
theorem of_isBigO_im_re_rpow (hre : Tendsto re l atTop) (r : ℝ) (hr : im =O[l] fun z => z.re ^ r) :
IsExpCmpFilter l :=
⟨hre, fun n =>
IsLittleO.isBigO <|
calc
(fun z : ℂ => z.im ^ n) =O[l] fun z => (z.re ^ r) ^ n := hr.pow n
_ =ᶠ[l] fun z => z.re ^ (r * n) :=
((hre.eventually_ge_atTop 0).mono fun z hz => by
simp only [Real.rpow_mul hz r n, Real.rpow_natCast])
_ =o[l] fun z => Real.exp z.re := (isLittleO_rpow_exp_atTop _).comp_tendsto hre ⟩
set_option linter.uppercaseLean3 false in
#align complex.is_exp_cmp_filter.of_is_O_im_re_rpow Complex.IsExpCmpFilter.of_isBigO_im_re_rpow
theorem of_isBigO_im_re_pow (hre : Tendsto re l atTop) (n : ℕ) (hr : im =O[l] fun z => z.re ^ n) :
IsExpCmpFilter l :=
of_isBigO_im_re_rpow hre n <| mod_cast hr
set_option linter.uppercaseLean3 false in
#align complex.is_exp_cmp_filter.of_is_O_im_re_pow Complex.IsExpCmpFilter.of_isBigO_im_re_pow
theorem of_boundedUnder_abs_im (hre : Tendsto re l atTop)
(him : IsBoundedUnder (· ≤ ·) l fun z => |z.im|) : IsExpCmpFilter l :=
of_isBigO_im_re_pow hre 0 <| by
simpa only [pow_zero] using him.isBigO_const (f := im) one_ne_zero
#align complex.is_exp_cmp_filter.of_bounded_under_abs_im Complex.IsExpCmpFilter.of_boundedUnder_abs_im
theorem of_boundedUnder_im (hre : Tendsto re l atTop) (him_le : IsBoundedUnder (· ≤ ·) l im)
(him_ge : IsBoundedUnder (· ≥ ·) l im) : IsExpCmpFilter l :=
of_boundedUnder_abs_im hre <| isBoundedUnder_le_abs.2 ⟨him_le, him_ge⟩
#align complex.is_exp_cmp_filter.of_bounded_under_im Complex.IsExpCmpFilter.of_boundedUnder_im
theorem eventually_ne (hl : IsExpCmpFilter l) : ∀ᶠ w : ℂ in l, w ≠ 0 :=
hl.tendsto_re.eventually_ne_atTop' _
#align complex.is_exp_cmp_filter.eventually_ne Complex.IsExpCmpFilter.eventually_ne
theorem tendsto_abs_re (hl : IsExpCmpFilter l) : Tendsto (fun z : ℂ => |z.re|) l atTop :=
tendsto_abs_atTop_atTop.comp hl.tendsto_re
#align complex.is_exp_cmp_filter.tendsto_abs_re Complex.IsExpCmpFilter.tendsto_abs_re
theorem tendsto_abs (hl : IsExpCmpFilter l) : Tendsto abs l atTop :=
tendsto_atTop_mono abs_re_le_abs hl.tendsto_abs_re
#align complex.is_exp_cmp_filter.tendsto_abs Complex.IsExpCmpFilter.tendsto_abs
theorem isLittleO_log_re_re (hl : IsExpCmpFilter l) : (fun z => Real.log z.re) =o[l] re :=
Real.isLittleO_log_id_atTop.comp_tendsto hl.tendsto_re
#align complex.is_exp_cmp_filter.is_o_log_re_re Complex.IsExpCmpFilter.isLittleO_log_re_re
theorem isLittleO_im_pow_exp_re (hl : IsExpCmpFilter l) (n : ℕ) :
(fun z : ℂ => z.im ^ n) =o[l] fun z => Real.exp z.re :=
flip IsLittleO.of_pow two_ne_zero <|
calc
(fun z : ℂ ↦ (z.im ^ n) ^ 2) = (fun z ↦ z.im ^ (2 * n)) := by simp only [pow_mul']
_ =O[l] fun z ↦ Real.exp z.re := hl.isBigO_im_pow_re _
_ = fun z ↦ (Real.exp z.re) ^ 1 := by simp only [pow_one]
_ =o[l] fun z ↦ (Real.exp z.re) ^ 2 :=
(isLittleO_pow_pow_atTop_of_lt one_lt_two).comp_tendsto <|
Real.tendsto_exp_atTop.comp hl.tendsto_re
#align complex.is_exp_cmp_filter.is_o_im_pow_exp_re Complex.IsExpCmpFilter.isLittleO_im_pow_exp_re
| Mathlib/Analysis/SpecialFunctions/CompareExp.lean | 119 | 121 | theorem abs_im_pow_eventuallyLE_exp_re (hl : IsExpCmpFilter l) (n : ℕ) :
(fun z : ℂ => |z.im| ^ n) ≤ᶠ[l] fun z => Real.exp z.re := by |
simpa using (hl.isLittleO_im_pow_exp_re n).bound zero_lt_one
| [
" (fun z => (z.re ^ r) ^ n) z = (fun z => z.re ^ (r * ↑n)) z",
" im =O[l] fun z => z.re ^ 0",
" (fun z => (z.im ^ n) ^ 2) = fun z => z.im ^ (2 * n)",
" (fun z => z.re.exp) = fun z => z.re.exp ^ 1",
" (fun z => |z.im| ^ n) ≤ᶠ[l] fun z => z.re.exp"
] | [
" (fun z => (z.re ^ r) ^ n) z = (fun z => z.re ^ (r * ↑n)) z",
" im =O[l] fun z => z.re ^ 0",
" (fun z => (z.im ^ n) ^ 2) = fun z => z.im ^ (2 * n)",
" (fun z => z.re.exp) = fun z => z.re.exp ^ 1"
] |
import Mathlib.CategoryTheory.Filtered.Connected
import Mathlib.CategoryTheory.Limits.TypesFiltered
import Mathlib.CategoryTheory.Limits.Final
universe v₁ v₂ u₁ u₂
namespace CategoryTheory
open CategoryTheory.Limits CategoryTheory.Functor Opposite
section ArbitraryUniverses
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D)
theorem Functor.final_of_isFiltered_structuredArrow [∀ d, IsFiltered (StructuredArrow d F)] :
Final F where
out _ := IsFiltered.isConnected _
theorem Functor.initial_of_isCofiltered_costructuredArrow
[∀ d, IsCofiltered (CostructuredArrow F d)] : Initial F where
out _ := IsCofiltered.isConnected _
theorem isFiltered_structuredArrow_of_isFiltered_of_exists [IsFilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (d ⟶ F.obj c)) (h₂ : ∀ {d : D} {c : C} (s s' : d ⟶ F.obj c),
∃ (c' : C) (t : c ⟶ c'), s ≫ F.map t = s' ≫ F.map t) (d : D) :
IsFiltered (StructuredArrow d F) := by
have : Nonempty (StructuredArrow d F) := by
obtain ⟨c, ⟨f⟩⟩ := h₁ d
exact ⟨.mk f⟩
suffices IsFilteredOrEmpty (StructuredArrow d F) from IsFiltered.mk
refine ⟨fun f g => ?_, fun f g η μ => ?_⟩
· obtain ⟨c, ⟨t, ht⟩⟩ := h₂ (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right))
(g.hom ≫ F.map (IsFiltered.rightToMax f.right g.right))
refine ⟨.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t)), ?_, ?_, trivial⟩
· exact StructuredArrow.homMk (IsFiltered.leftToMax _ _ ≫ t) rfl
· exact StructuredArrow.homMk (IsFiltered.rightToMax _ _ ≫ t) (by simpa using ht.symm)
· refine ⟨.mk (f.hom ≫ F.map (η.right ≫ IsFiltered.coeqHom η.right μ.right)),
StructuredArrow.homMk (IsFiltered.coeqHom η.right μ.right) (by simp), ?_⟩
simpa using IsFiltered.coeq_condition _ _
| Mathlib/CategoryTheory/Filtered/Final.lean | 74 | 87 | theorem isCofiltered_costructuredArrow_of_isCofiltered_of_exists [IsCofilteredOrEmpty C]
(h₁ : ∀ d, ∃ c, Nonempty (F.obj c ⟶ d)) (h₂ : ∀ {d : D} {c : C} (s s' : F.obj c ⟶ d),
∃ (c' : C) (t : c' ⟶ c), F.map t ≫ s = F.map t ≫ s') (d : D) :
IsCofiltered (CostructuredArrow F d) := by |
suffices IsFiltered (CostructuredArrow F d)ᵒᵖ from isCofiltered_of_isFiltered_op _
suffices IsFiltered (StructuredArrow (op d) F.op) from
IsFiltered.of_equivalence (costructuredArrowOpEquivalence _ _).symm
apply isFiltered_structuredArrow_of_isFiltered_of_exists
· intro d
obtain ⟨c, ⟨t⟩⟩ := h₁ d.unop
exact ⟨op c, ⟨Quiver.Hom.op t⟩⟩
· intro d c s s'
obtain ⟨c', t, ht⟩ := h₂ s.unop s'.unop
exact ⟨op c', Quiver.Hom.op t, Quiver.Hom.unop_inj ht⟩
| [
" IsFiltered (StructuredArrow d F)",
" Nonempty (StructuredArrow d F)",
" IsFilteredOrEmpty (StructuredArrow d F)",
" ∃ Z x x, True",
" f ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))",
" g ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))",
... | [
" IsFiltered (StructuredArrow d F)",
" Nonempty (StructuredArrow d F)",
" IsFilteredOrEmpty (StructuredArrow d F)",
" ∃ Z x x, True",
" f ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))",
" g ⟶ StructuredArrow.mk (f.hom ≫ F.map (IsFiltered.leftToMax f.right g.right ≫ t))",
... |
import Mathlib.Probability.ProbabilityMassFunction.Basic
#align_import probability.probability_mass_function.monad from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d"
noncomputable section
variable {α β γ : Type*}
open scoped Classical
open NNReal ENNReal
open MeasureTheory
namespace PMF
section Pure
def pure (a : α) : PMF α :=
⟨fun a' => if a' = a then 1 else 0, hasSum_ite_eq _ _⟩
#align pmf.pure PMF.pure
variable (a a' : α)
@[simp]
theorem pure_apply : pure a a' = if a' = a then 1 else 0 := rfl
#align pmf.pure_apply PMF.pure_apply
@[simp]
theorem support_pure : (pure a).support = {a} :=
Set.ext fun a' => by simp [mem_support_iff]
#align pmf.support_pure PMF.support_pure
theorem mem_support_pure_iff : a' ∈ (pure a).support ↔ a' = a := by simp
#align pmf.mem_support_pure_iff PMF.mem_support_pure_iff
-- @[simp] -- Porting note (#10618): simp can prove this
theorem pure_apply_self : pure a a = 1 :=
if_pos rfl
#align pmf.pure_apply_self PMF.pure_apply_self
theorem pure_apply_of_ne (h : a' ≠ a) : pure a a' = 0 :=
if_neg h
#align pmf.pure_apply_of_ne PMF.pure_apply_of_ne
instance [Inhabited α] : Inhabited (PMF α) :=
⟨pure default⟩
section Measure
variable (s : Set α)
@[simp]
theorem toOuterMeasure_pure_apply : (pure a).toOuterMeasure s = if a ∈ s then 1 else 0 := by
refine (toOuterMeasure_apply (pure a) s).trans ?_
split_ifs with ha
· refine (tsum_congr fun b => ?_).trans (tsum_ite_eq a 1)
exact ite_eq_left_iff.2 fun hb => symm (ite_eq_right_iff.2 fun h => (hb <| h.symm ▸ ha).elim)
· refine (tsum_congr fun b => ?_).trans tsum_zero
exact ite_eq_right_iff.2 fun hb => ite_eq_right_iff.2 fun h => (ha <| h ▸ hb).elim
#align pmf.to_outer_measure_pure_apply PMF.toOuterMeasure_pure_apply
variable [MeasurableSpace α]
@[simp]
theorem toMeasure_pure_apply (hs : MeasurableSet s) :
(pure a).toMeasure s = if a ∈ s then 1 else 0 :=
(toMeasure_apply_eq_toOuterMeasure_apply (pure a) s hs).trans (toOuterMeasure_pure_apply a s)
#align pmf.to_measure_pure_apply PMF.toMeasure_pure_apply
theorem toMeasure_pure : (pure a).toMeasure = Measure.dirac a :=
Measure.ext fun s hs => by rw [toMeasure_pure_apply a s hs, Measure.dirac_apply' a hs]; rfl
#align pmf.to_measure_pure PMF.toMeasure_pure
@[simp]
| Mathlib/Probability/ProbabilityMassFunction/Monad.lean | 97 | 99 | theorem toPMF_dirac [Countable α] [h : MeasurableSingletonClass α] :
(Measure.dirac a).toPMF = pure a := by |
rw [toPMF_eq_iff_toMeasure_eq, toMeasure_pure]
| [
" a' ∈ (pure a).support ↔ a' ∈ {a}",
" a' ∈ (pure a).support ↔ a' = a",
" (pure a).toOuterMeasure s = if a ∈ s then 1 else 0",
" ∑' (x : α), s.indicator (⇑(pure a)) x = if a ∈ s then 1 else 0",
" ∑' (x : α), s.indicator (⇑(pure a)) x = 1",
" s.indicator (⇑(pure a)) b = if b = a then 1 else 0",
" ∑' (x :... | [
" a' ∈ (pure a).support ↔ a' ∈ {a}",
" a' ∈ (pure a).support ↔ a' = a",
" (pure a).toOuterMeasure s = if a ∈ s then 1 else 0",
" ∑' (x : α), s.indicator (⇑(pure a)) x = if a ∈ s then 1 else 0",
" ∑' (x : α), s.indicator (⇑(pure a)) x = 1",
" s.indicator (⇑(pure a)) b = if b = a then 1 else 0",
" ∑' (x :... |
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {α β : Type*} [NormedAddCommGroup β]
def IsEquivalent (l : Filter α) (u v : α → β) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : α → β} {l : Filter α}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Θ[l] v :=
⟨h.isBigO, h.isBigO_symm⟩
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Θ[l] u :=
⟨h.isBigO_symm, h.isBigO⟩
@[refl]
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 102 | 104 | theorem IsEquivalent.refl : u ~[l] u := by |
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
| [
" v =O[l] u",
" u x✝ = (u - v) x✝ + v x✝",
" u ~[l] u",
" 0 =o[l] u"
] | [
" v =O[l] u",
" u x✝ = (u - v) x✝ + v x✝"
] |
import Mathlib.LinearAlgebra.CliffordAlgebra.Basic
import Mathlib.Data.ZMod.Basic
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import linear_algebra.clifford_algebra.grading from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
namespace CliffordAlgebra
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
open scoped DirectSum
variable (Q)
def evenOdd (i : ZMod 2) : Submodule R (CliffordAlgebra Q) :=
⨆ j : { n : ℕ // ↑n = i }, LinearMap.range (ι Q) ^ (j : ℕ)
#align clifford_algebra.even_odd CliffordAlgebra.evenOdd
theorem one_le_evenOdd_zero : 1 ≤ evenOdd Q 0 := by
refine le_trans ?_ (le_iSup _ ⟨0, Nat.cast_zero⟩)
exact (pow_zero _).ge
#align clifford_algebra.one_le_even_odd_zero CliffordAlgebra.one_le_evenOdd_zero
| Mathlib/LinearAlgebra/CliffordAlgebra/Grading.lean | 40 | 42 | theorem range_ι_le_evenOdd_one : LinearMap.range (ι Q) ≤ evenOdd Q 1 := by |
refine le_trans ?_ (le_iSup _ ⟨1, Nat.cast_one⟩)
exact (pow_one _).ge
| [
" 1 ≤ evenOdd Q 0",
" 1 ≤ LinearMap.range (ι Q) ^ ↑⟨0, ⋯⟩",
" LinearMap.range (ι Q) ≤ evenOdd Q 1",
" LinearMap.range (ι Q) ≤ LinearMap.range (ι Q) ^ ↑⟨1, ⋯⟩"
] | [
" 1 ≤ evenOdd Q 0",
" 1 ≤ LinearMap.range (ι Q) ^ ↑⟨0, ⋯⟩"
] |
import Mathlib.Topology.Separation
import Mathlib.Topology.UniformSpace.Basic
import Mathlib.Topology.UniformSpace.Cauchy
#align_import topology.uniform_space.uniform_convergence from "leanprover-community/mathlib"@"2705404e701abc6b3127da906f40bae062a169c9"
noncomputable section
open Topology Uniformity Filter Set
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {ι : Type x} [UniformSpace β]
variable {F : ι → α → β} {f : α → β} {s s' : Set α} {x : α} {p : Filter ι} {p' : Filter α}
{g : ι → α}
def TendstoUniformlyOnFilter (F : ι → α → β) (f : α → β) (p : Filter ι) (p' : Filter α) :=
∀ u ∈ 𝓤 β, ∀ᶠ n : ι × α in p ×ˢ p', (f n.snd, F n.fst n.snd) ∈ u
#align tendsto_uniformly_on_filter TendstoUniformlyOnFilter
theorem tendstoUniformlyOnFilter_iff_tendsto :
TendstoUniformlyOnFilter F f p p' ↔
Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ p') (𝓤 β) :=
Iff.rfl
#align tendsto_uniformly_on_filter_iff_tendsto tendstoUniformlyOnFilter_iff_tendsto
def TendstoUniformlyOn (F : ι → α → β) (f : α → β) (p : Filter ι) (s : Set α) :=
∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, x ∈ s → (f x, F n x) ∈ u
#align tendsto_uniformly_on TendstoUniformlyOn
theorem tendstoUniformlyOn_iff_tendstoUniformlyOnFilter :
TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (𝓟 s) := by
simp only [TendstoUniformlyOn, TendstoUniformlyOnFilter]
apply forall₂_congr
simp_rw [eventually_prod_principal_iff]
simp
#align tendsto_uniformly_on_iff_tendsto_uniformly_on_filter tendstoUniformlyOn_iff_tendstoUniformlyOnFilter
alias ⟨TendstoUniformlyOn.tendstoUniformlyOnFilter, TendstoUniformlyOnFilter.tendstoUniformlyOn⟩ :=
tendstoUniformlyOn_iff_tendstoUniformlyOnFilter
#align tendsto_uniformly_on.tendsto_uniformly_on_filter TendstoUniformlyOn.tendstoUniformlyOnFilter
#align tendsto_uniformly_on_filter.tendsto_uniformly_on TendstoUniformlyOnFilter.tendstoUniformlyOn
theorem tendstoUniformlyOn_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} {s : Set α} :
TendstoUniformlyOn F f p s ↔
Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ 𝓟 s) (𝓤 β) := by
simp [tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto]
#align tendsto_uniformly_on_iff_tendsto tendstoUniformlyOn_iff_tendsto
def TendstoUniformly (F : ι → α → β) (f : α → β) (p : Filter ι) :=
∀ u ∈ 𝓤 β, ∀ᶠ n in p, ∀ x : α, (f x, F n x) ∈ u
#align tendsto_uniformly TendstoUniformly
-- Porting note: moved from below
theorem tendstoUniformlyOn_univ : TendstoUniformlyOn F f p univ ↔ TendstoUniformly F f p := by
simp [TendstoUniformlyOn, TendstoUniformly]
#align tendsto_uniformly_on_univ tendstoUniformlyOn_univ
theorem tendstoUniformly_iff_tendstoUniformlyOnFilter :
TendstoUniformly F f p ↔ TendstoUniformlyOnFilter F f p ⊤ := by
rw [← tendstoUniformlyOn_univ, tendstoUniformlyOn_iff_tendstoUniformlyOnFilter, principal_univ]
#align tendsto_uniformly_iff_tendsto_uniformly_on_filter tendstoUniformly_iff_tendstoUniformlyOnFilter
theorem TendstoUniformly.tendstoUniformlyOnFilter (h : TendstoUniformly F f p) :
TendstoUniformlyOnFilter F f p ⊤ := by rwa [← tendstoUniformly_iff_tendstoUniformlyOnFilter]
#align tendsto_uniformly.tendsto_uniformly_on_filter TendstoUniformly.tendstoUniformlyOnFilter
theorem tendstoUniformlyOn_iff_tendstoUniformly_comp_coe :
TendstoUniformlyOn F f p s ↔ TendstoUniformly (fun i (x : s) => F i x) (f ∘ (↑)) p :=
forall₂_congr fun u _ => by simp
#align tendsto_uniformly_on_iff_tendsto_uniformly_comp_coe tendstoUniformlyOn_iff_tendstoUniformly_comp_coe
theorem tendstoUniformly_iff_tendsto {F : ι → α → β} {f : α → β} {p : Filter ι} :
TendstoUniformly F f p ↔ Tendsto (fun q : ι × α => (f q.2, F q.1 q.2)) (p ×ˢ ⊤) (𝓤 β) := by
simp [tendstoUniformly_iff_tendstoUniformlyOnFilter, tendstoUniformlyOnFilter_iff_tendsto]
#align tendsto_uniformly_iff_tendsto tendstoUniformly_iff_tendsto
| Mathlib/Topology/UniformSpace/UniformConvergence.lean | 166 | 171 | theorem TendstoUniformlyOnFilter.tendsto_at (h : TendstoUniformlyOnFilter F f p p')
(hx : 𝓟 {x} ≤ p') : Tendsto (fun n => F n x) p <| 𝓝 (f x) := by |
refine Uniform.tendsto_nhds_right.mpr fun u hu => mem_map.mpr ?_
filter_upwards [(h u hu).curry]
intro i h
simpa using h.filter_mono hx
| [
" TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (𝓟 s)",
" (∀ u ∈ 𝓤 β, ∀ᶠ (n : ι) in p, ∀ x ∈ s, (f x, F n x) ∈ u) ↔\n ∀ u ∈ 𝓤 β, ∀ᶠ (n : ι × α) in p ×ˢ 𝓟 s, (f n.2, F n.1 n.2) ∈ u",
" ∀ a ∈ 𝓤 β, (∀ᶠ (n : ι) in p, ∀ x ∈ s, (f x, F n x) ∈ a) ↔ ∀ᶠ (n : ι × α) in p ×ˢ 𝓟 s, (f n.2, F n.1 n.2) ... | [
" TendstoUniformlyOn F f p s ↔ TendstoUniformlyOnFilter F f p (𝓟 s)",
" (∀ u ∈ 𝓤 β, ∀ᶠ (n : ι) in p, ∀ x ∈ s, (f x, F n x) ∈ u) ↔\n ∀ u ∈ 𝓤 β, ∀ᶠ (n : ι × α) in p ×ˢ 𝓟 s, (f n.2, F n.1 n.2) ∈ u",
" ∀ a ∈ 𝓤 β, (∀ᶠ (n : ι) in p, ∀ x ∈ s, (f x, F n x) ∈ a) ↔ ∀ᶠ (n : ι × α) in p ×ˢ 𝓟 s, (f n.2, F n.1 n.2) ... |
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Nat.Dist
import Mathlib.Data.Ordmap.Ordnode
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
#align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
variable {α : Type*}
namespace Ordnode
theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 :=
not_le_of_gt H
#align ordnode.not_le_delta Ordnode.not_le_delta
theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False :=
not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by
simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta)
#align ordnode.delta_lt_false Ordnode.delta_lt_false
def realSize : Ordnode α → ℕ
| nil => 0
| node _ l _ r => realSize l + realSize r + 1
#align ordnode.real_size Ordnode.realSize
def Sized : Ordnode α → Prop
| nil => True
| node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r
#align ordnode.sized Ordnode.Sized
theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) :=
⟨rfl, hl, hr⟩
#align ordnode.sized.node' Ordnode.Sized.node'
theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by
rw [h.1]
#align ordnode.sized.eq_node' Ordnode.Sized.eq_node'
theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) :
size (@node α s l x r) = size l + size r + 1 :=
H.1
#align ordnode.sized.size_eq Ordnode.Sized.size_eq
@[elab_as_elim]
theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil)
(H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by
induction t with
| nil => exact H0
| node _ _ _ _ t_ih_l t_ih_r =>
rw [hl.eq_node']
exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2)
#align ordnode.sized.induction Ordnode.Sized.induction
theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t
| nil, _ => rfl
| node s l x r, ⟨h₁, h₂, h₃⟩ => by
rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl
#align ordnode.size_eq_real_size Ordnode.size_eq_realSize
@[simp]
theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by
cases t <;> [simp;simp [ht.1]]
#align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero
theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by
rw [h.1]; apply Nat.le_add_left
#align ordnode.sized.pos Ordnode.Sized.pos
theorem dual_dual : ∀ t : Ordnode α, dual (dual t) = t
| nil => rfl
| node s l x r => by rw [dual, dual, dual_dual l, dual_dual r]
#align ordnode.dual_dual Ordnode.dual_dual
@[simp]
theorem size_dual (t : Ordnode α) : size (dual t) = size t := by cases t <;> rfl
#align ordnode.size_dual Ordnode.size_dual
def BalancedSz (l r : ℕ) : Prop :=
l + r ≤ 1 ∨ l ≤ delta * r ∧ r ≤ delta * l
#align ordnode.balanced_sz Ordnode.BalancedSz
instance BalancedSz.dec : DecidableRel BalancedSz := fun _ _ => Or.decidable
#align ordnode.balanced_sz.dec Ordnode.BalancedSz.dec
def Balanced : Ordnode α → Prop
| nil => True
| node _ l _ r => BalancedSz (size l) (size r) ∧ Balanced l ∧ Balanced r
#align ordnode.balanced Ordnode.Balanced
instance Balanced.dec : DecidablePred (@Balanced α)
| nil => by
unfold Balanced
infer_instance
| node _ l _ r => by
unfold Balanced
haveI := Balanced.dec l
haveI := Balanced.dec r
infer_instance
#align ordnode.balanced.dec Ordnode.Balanced.dec
@[symm]
theorem BalancedSz.symm {l r : ℕ} : BalancedSz l r → BalancedSz r l :=
Or.imp (by rw [add_comm]; exact id) And.symm
#align ordnode.balanced_sz.symm Ordnode.BalancedSz.symm
theorem balancedSz_zero {l : ℕ} : BalancedSz l 0 ↔ l ≤ 1 := by
simp (config := { contextual := true }) [BalancedSz]
#align ordnode.balanced_sz_zero Ordnode.balancedSz_zero
| Mathlib/Data/Ordmap/Ordset.lean | 200 | 210 | theorem balancedSz_up {l r₁ r₂ : ℕ} (h₁ : r₁ ≤ r₂) (h₂ : l + r₂ ≤ 1 ∨ r₂ ≤ delta * l)
(H : BalancedSz l r₁) : BalancedSz l r₂ := by |
refine or_iff_not_imp_left.2 fun h => ?_
refine ⟨?_, h₂.resolve_left h⟩
cases H with
| inl H =>
cases r₂
· cases h (le_trans (Nat.add_le_add_left (Nat.zero_le _) _) H)
· exact le_trans (le_trans (Nat.le_add_right _ _) H) (Nat.le_add_left 1 _)
| inr H =>
exact le_trans H.1 (Nat.mul_le_mul_left _ h₁)
| [
" 0 < delta",
" a ≤ delta * (delta * a)",
" 1 ≤ delta * delta",
" node s l x r = l.node' x r",
" C t",
" C nil",
" C (node size✝ l✝ x✝ r✝)",
" C (l✝.node' x✝ r✝)",
" (node s l x r).size = (node s l x r).realSize",
" (match node (l.realSize + r.realSize + 1) l x r with\n | nil => 0\n | node s... | [
" 0 < delta",
" a ≤ delta * (delta * a)",
" 1 ≤ delta * delta",
" node s l x r = l.node' x r",
" C t",
" C nil",
" C (node size✝ l✝ x✝ r✝)",
" C (l✝.node' x✝ r✝)",
" (node s l x r).size = (node s l x r).realSize",
" (match node (l.realSize + r.realSize + 1) l x r with\n | nil => 0\n | node s... |
import Mathlib.Algebra.Bounds
import Mathlib.Algebra.Order.Field.Basic -- Porting note: `LinearOrderedField`, etc
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.order.pointwise from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Function Set
open Pointwise
variable {α : Type*}
-- Porting note: Swapped the place of `CompleteLattice` and `ConditionallyCompleteLattice`
-- due to simpNF problem between `sSup_xx` `csSup_xx`.
section CompleteLattice
variable [CompleteLattice α]
section Group
variable [Group α] [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· ≤ ·)]
(s t : Set α)
@[to_additive]
theorem sSup_inv (s : Set α) : sSup s⁻¹ = (sInf s)⁻¹ := by
rw [← image_inv, sSup_image]
exact ((OrderIso.inv α).map_sInf _).symm
#align Sup_inv sSup_inv
#align Sup_neg sSup_neg
@[to_additive]
| Mathlib/Algebra/Order/Pointwise.lean | 68 | 70 | theorem sInf_inv (s : Set α) : sInf s⁻¹ = (sSup s)⁻¹ := by |
rw [← image_inv, sInf_image]
exact ((OrderIso.inv α).map_sSup _).symm
| [
" sSup s⁻¹ = (sInf s)⁻¹",
" ⨆ a ∈ s, a⁻¹ = (sInf s)⁻¹",
" sInf s⁻¹ = (sSup s)⁻¹",
" ⨅ a ∈ s, a⁻¹ = (sSup s)⁻¹"
] | [
" sSup s⁻¹ = (sInf s)⁻¹",
" ⨆ a ∈ s, a⁻¹ = (sInf s)⁻¹"
] |
import Mathlib.Analysis.Seminorm
import Mathlib.Topology.Algebra.Equicontinuity
import Mathlib.Topology.MetricSpace.Equicontinuity
import Mathlib.Topology.Algebra.FilterBasis
import Mathlib.Topology.Algebra.Module.LocallyConvex
#align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec"
open NormedField Set Seminorm TopologicalSpace Filter List
open NNReal Pointwise Topology Uniformity
variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*}
section FilterBasis
variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E]
variable (𝕜 E ι)
abbrev SeminormFamily :=
ι → Seminorm 𝕜 E
#align seminorm_family SeminormFamily
variable {𝕜 E ι}
namespace SeminormFamily
def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) :=
⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r)
#align seminorm_family.basis_sets SeminormFamily.basisSets
variable (p : SeminormFamily 𝕜 E ι)
theorem basisSets_iff {U : Set E} :
U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by
simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff]
#align seminorm_family.basis_sets_iff SeminormFamily.basisSets_iff
theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets :=
(basisSets_iff _).mpr ⟨i, _, hr, rfl⟩
#align seminorm_family.basis_sets_mem SeminormFamily.basisSets_mem
theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets :=
(basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩
#align seminorm_family.basis_sets_singleton_mem SeminormFamily.basisSets_singleton_mem
theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by
let i := Classical.arbitrary ι
refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩
exact p.basisSets_singleton_mem i zero_lt_one
#align seminorm_family.basis_sets_nonempty SeminormFamily.basisSets_nonempty
theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) :
∃ z ∈ p.basisSets, z ⊆ U ∩ V := by
classical
rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩
rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩
use ((s ∪ t).sup p).ball 0 (min r₁ r₂)
refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩
rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩),
ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂]
exact
Set.subset_inter
(Set.iInter₂_mono' fun i hi =>
⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩)
(Set.iInter₂_mono' fun i hi =>
⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩)
#align seminorm_family.basis_sets_intersect SeminormFamily.basisSets_intersect
theorem basisSets_zero (U) (hU : U ∈ p.basisSets) : (0 : E) ∈ U := by
rcases p.basisSets_iff.mp hU with ⟨ι', r, hr, hU⟩
rw [hU, mem_ball_zero, map_zero]
exact hr
#align seminorm_family.basis_sets_zero SeminormFamily.basisSets_zero
| Mathlib/Analysis/LocallyConvex/WithSeminorms.lean | 121 | 127 | theorem basisSets_add (U) (hU : U ∈ p.basisSets) :
∃ V ∈ p.basisSets, V + V ⊆ U := by |
rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩
use (s.sup p).ball 0 (r / 2)
refine ⟨p.basisSets_mem s (div_pos hr zero_lt_two), ?_⟩
refine Set.Subset.trans (ball_add_ball_subset (s.sup p) (r / 2) (r / 2) 0 0) ?_
rw [hU, add_zero, add_halves']
| [
" U ∈ p.basisSets ↔ ∃ i r, 0 < r ∧ U = (i.sup p).ball 0 r",
" (p i).ball 0 r = ({i}.sup p).ball 0 r",
" p.basisSets.Nonempty",
" (p i).ball 0 1 ∈ p.basisSets",
" ∃ z ∈ p.basisSets, z ⊆ U ∩ V",
" ((s ∪ t).sup p).ball 0 (min r₁ r₂) ∈ p.basisSets ∧ ((s ∪ t).sup p).ball 0 (min r₁ r₂) ⊆ U ∩ V",
" ((s ∪ t).su... | [
" U ∈ p.basisSets ↔ ∃ i r, 0 < r ∧ U = (i.sup p).ball 0 r",
" (p i).ball 0 r = ({i}.sup p).ball 0 r",
" p.basisSets.Nonempty",
" (p i).ball 0 1 ∈ p.basisSets",
" ∃ z ∈ p.basisSets, z ⊆ U ∩ V",
" ((s ∪ t).sup p).ball 0 (min r₁ r₂) ∈ p.basisSets ∧ ((s ∪ t).sup p).ball 0 (min r₁ r₂) ⊆ U ∩ V",
" ((s ∪ t).su... |
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
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]
#align simple_graph.subgraph.is_matching.to_edge_eq_to_edge_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_toEdge_of_adj
def IsPerfectMatching : Prop := M.IsMatching ∧ M.IsSpanning
#align simple_graph.subgraph.is_perfect_matching SimpleGraph.Subgraph.IsPerfectMatching
| Mathlib/Combinatorics/SimpleGraph/Matching.lean | 90 | 93 | theorem IsMatching.support_eq_verts {M : Subgraph G} (h : M.IsMatching) : M.support = M.verts := by |
refine M.support_subset_verts.antisymm fun v hv => ?_
obtain ⟨w, hvw, -⟩ := h hv
exact ⟨_, hvw⟩
| [
" h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩",
" s(v, Exists.choose ⋯) = s(v, w)",
" Exists.choose ⋯ = w",
" Function.Surjective h.toEdge",
" ∃ a, h.toEdge a = ⟨e, he⟩",
" ∃ a, h.toEdge a = ⟨s(x, y), he⟩",
" h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩",
" M.support = M.verts",
" v ∈ M.support"
] | [
" h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩",
" s(v, Exists.choose ⋯) = s(v, w)",
" Exists.choose ⋯ = w",
" Function.Surjective h.toEdge",
" ∃ a, h.toEdge a = ⟨e, he⟩",
" ∃ a, h.toEdge a = ⟨s(x, y), he⟩",
" h.toEdge ⟨v, hv⟩ = h.toEdge ⟨w, hw⟩"
] |
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
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
#align int.log_of_right_le_one Int.log_of_right_le_one
@[simp, norm_cast]
theorem log_natCast (b : ℕ) (n : ℕ) : log b (n : R) = Nat.log b n := by
cases n
· simp [log_of_right_le_one]
· rw [log_of_one_le_right, Nat.floor_natCast]
simp
#align int.log_nat_cast Int.log_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem log_ofNat (b : ℕ) (n : ℕ) [n.AtLeastTwo] :
log b (no_index (OfNat.ofNat n : R)) = Nat.log b (OfNat.ofNat n) :=
log_natCast b n
theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (r : R) : log b r = 0 := by
rcases le_total 1 r with h | h
· rw [log_of_one_le_right _ h, Nat.log_of_left_le_one hb, Int.ofNat_zero]
· rw [log_of_right_le_one _ h, Nat.clog_of_left_le_one hb, Int.ofNat_zero, neg_zero]
#align int.log_of_left_le_one Int.log_of_left_le_one
theorem log_of_right_le_zero (b : ℕ) {r : R} (hr : r ≤ 0) : log b r = 0 := by
rw [log_of_right_le_one _ (hr.trans zero_le_one),
Nat.clog_of_right_le_one ((Nat.ceil_eq_zero.mpr <| inv_nonpos.2 hr).trans_le zero_le_one),
Int.ofNat_zero, neg_zero]
#align int.log_of_right_le_zero Int.log_of_right_le_zero
theorem zpow_log_le_self {b : ℕ} {r : R} (hb : 1 < b) (hr : 0 < r) : (b : R) ^ log b r ≤ r := by
rcases le_total 1 r with hr1 | hr1
· rw [log_of_one_le_right _ hr1]
rw [zpow_natCast, ← Nat.cast_pow, ← Nat.le_floor_iff hr.le]
exact Nat.pow_log_le_self b (Nat.floor_pos.mpr hr1).ne'
· rw [log_of_right_le_one _ hr1, zpow_neg, zpow_natCast, ← Nat.cast_pow]
exact inv_le_of_inv_le hr (Nat.ceil_le.1 <| Nat.le_pow_clog hb _)
#align int.zpow_log_le_self Int.zpow_log_le_self
| Mathlib/Data/Int/Log.lean | 108 | 124 | theorem lt_zpow_succ_log_self {b : ℕ} (hb : 1 < b) (r : R) : r < (b : R) ^ (log b r + 1) := by |
rcases le_or_lt r 0 with hr | hr
· rw [log_of_right_le_zero _ hr, zero_add, zpow_one]
exact hr.trans_lt (zero_lt_one.trans_le <| mod_cast hb.le)
rcases le_or_lt 1 r with hr1 | hr1
· rw [log_of_one_le_right _ hr1]
rw [Int.ofNat_add_one_out, zpow_natCast, ← Nat.cast_pow]
apply Nat.lt_of_floor_lt
exact Nat.lt_pow_succ_log_self hb _
· rw [log_of_right_le_one _ hr1.le]
have hcri : 1 < r⁻¹ := one_lt_inv hr hr1
have : 1 ≤ Nat.clog b ⌈r⁻¹⌉₊ :=
Nat.succ_le_of_lt (Nat.clog_pos hb <| Nat.one_lt_cast.1 <| hcri.trans_le (Nat.le_ceil _))
rw [neg_add_eq_sub, ← neg_sub, ← Int.ofNat_one, ← Int.ofNat_sub this, zpow_neg, zpow_natCast,
lt_inv hr (pow_pos (Nat.cast_pos.mpr <| zero_lt_one.trans hb) _), ← Nat.cast_pow]
refine Nat.lt_ceil.1 ?_
exact Nat.pow_pred_clog_lt_self hb <| Nat.one_lt_cast.1 <| hcri.trans_le <| Nat.le_ceil _
| [
" log b r = -↑(b.clog ⌈r⁻¹⌉₊)",
" log b 1 = -↑(b.clog ⌈1⁻¹⌉₊)",
" log b ↑n = ↑(b.log n)",
" log b ↑0 = ↑(b.log 0)",
" log b ↑(n✝ + 1) = ↑(b.log (n✝ + 1))",
" 1 ≤ ↑(n✝ + 1)",
" log b r = 0",
" ↑b ^ log b r ≤ r",
" ↑b ^ ↑(b.log ⌊r⌋₊) ≤ r",
" b ^ b.log ⌊r⌋₊ ≤ ⌊r⌋₊",
" (↑(b ^ b.clog ⌈r⁻¹⌉₊))⁻¹ ≤ r",... | [
" log b r = -↑(b.clog ⌈r⁻¹⌉₊)",
" log b 1 = -↑(b.clog ⌈1⁻¹⌉₊)",
" log b ↑n = ↑(b.log n)",
" log b ↑0 = ↑(b.log 0)",
" log b ↑(n✝ + 1) = ↑(b.log (n✝ + 1))",
" 1 ≤ ↑(n✝ + 1)",
" log b r = 0",
" ↑b ^ log b r ≤ r",
" ↑b ^ ↑(b.log ⌊r⌋₊) ≤ r",
" b ^ b.log ⌊r⌋₊ ≤ ⌊r⌋₊",
" (↑(b ^ b.clog ⌈r⁻¹⌉₊))⁻¹ ≤ r"
... |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Data.Set.Finite
#align_import order.conditionally_complete_lattice.finset from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
open Set
variable {ι α β γ : Type*}
namespace Finset
section ConditionallyCompleteLattice
variable [ConditionallyCompleteLattice α]
theorem sup'_eq_csSup_image (s : Finset ι) (H : s.Nonempty) (f : ι → α) :
s.sup' H f = sSup (f '' s) :=
eq_of_forall_ge_iff fun a => by
simp [csSup_le_iff (s.finite_toSet.image f).bddAbove (H.to_set.image f)]
#align finset.sup'_eq_cSup_image Finset.sup'_eq_csSup_image
#align finset.nonempty.sup'_eq_cSup_image Finset.sup'_eq_csSup_image
theorem inf'_eq_csInf_image (s : Finset ι) (H : s.Nonempty) (f : ι → α) :
s.inf' H f = sInf (f '' s) :=
sup'_eq_csSup_image (α := αᵒᵈ) _ H _
#align finset.inf'_eq_cInf_image Finset.inf'_eq_csInf_image
| Mathlib/Order/ConditionallyCompleteLattice/Finset.lean | 85 | 86 | theorem sup'_id_eq_csSup (s : Finset α) (hs) : s.sup' hs id = sSup s := by |
rw [sup'_eq_csSup_image s hs, Set.image_id]
| [
" s.sup' H f ≤ a ↔ sSup (f '' ↑s) ≤ a",
" s.sup' hs id = sSup ↑s"
] | [
" s.sup' H f ≤ a ↔ sSup (f '' ↑s) ≤ a"
] |
import Mathlib.Topology.UniformSpace.CompleteSeparated
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.MetricSpace.Bounded
#align_import topology.metric_space.antilipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
variable {α β γ : Type*}
open scoped NNReal ENNReal Uniformity Topology
open Set Filter Bornology
def AntilipschitzWith [PseudoEMetricSpace α] [PseudoEMetricSpace β] (K : ℝ≥0) (f : α → β) :=
∀ x y, edist x y ≤ K * edist (f x) (f y)
#align antilipschitz_with AntilipschitzWith
theorem AntilipschitzWith.edist_lt_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0}
{f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y < ⊤ :=
(h x y).trans_lt <| ENNReal.mul_lt_top ENNReal.coe_ne_top (edist_ne_top _ _)
#align antilipschitz_with.edist_lt_top AntilipschitzWith.edist_lt_top
theorem AntilipschitzWith.edist_ne_top [PseudoEMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0}
{f : α → β} (h : AntilipschitzWith K f) (x y : α) : edist x y ≠ ⊤ :=
(h.edist_lt_top x y).ne
#align antilipschitz_with.edist_ne_top AntilipschitzWith.edist_ne_top
section Metric
variable [PseudoMetricSpace α] [PseudoMetricSpace β] {K : ℝ≥0} {f : α → β}
theorem antilipschitzWith_iff_le_mul_nndist :
AntilipschitzWith K f ↔ ∀ x y, nndist x y ≤ K * nndist (f x) (f y) := by
simp only [AntilipschitzWith, edist_nndist]
norm_cast
#align antilipschitz_with_iff_le_mul_nndist antilipschitzWith_iff_le_mul_nndist
alias ⟨AntilipschitzWith.le_mul_nndist, AntilipschitzWith.of_le_mul_nndist⟩ :=
antilipschitzWith_iff_le_mul_nndist
#align antilipschitz_with.le_mul_nndist AntilipschitzWith.le_mul_nndist
#align antilipschitz_with.of_le_mul_nndist AntilipschitzWith.of_le_mul_nndist
| Mathlib/Topology/MetricSpace/Antilipschitz.lean | 64 | 67 | theorem antilipschitzWith_iff_le_mul_dist :
AntilipschitzWith K f ↔ ∀ x y, dist x y ≤ K * dist (f x) (f y) := by |
simp only [antilipschitzWith_iff_le_mul_nndist, dist_nndist]
norm_cast
| [
" AntilipschitzWith K f ↔ ∀ (x y : α), nndist x y ≤ K * nndist (f x) (f y)",
" (∀ (x y : α), ↑(nndist x y) ≤ ↑K * ↑(nndist (f x) (f y))) ↔ ∀ (x y : α), nndist x y ≤ K * nndist (f x) (f y)",
" AntilipschitzWith K f ↔ ∀ (x y : α), dist x y ≤ ↑K * dist (f x) (f y)",
" (∀ (x y : α), nndist x y ≤ K * nndist (f x) ... | [
" AntilipschitzWith K f ↔ ∀ (x y : α), nndist x y ≤ K * nndist (f x) (f y)",
" (∀ (x y : α), ↑(nndist x y) ≤ ↑K * ↑(nndist (f x) (f y))) ↔ ∀ (x y : α), nndist x y ≤ K * nndist (f x) (f y)"
] |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Module.Torsion
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v v' u₁' w w'
variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum
variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁]
variable [Module R M] [Module R M'] [Module R M₁]
section Finsupp
variable (R M M')
variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M']
open Module.Free
@[simp]
theorem rank_finsupp (ι : Type w) :
Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by
obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma,
Cardinal.sum_const]
#align rank_finsupp rank_finsupp
| Mathlib/LinearAlgebra/Dimension/Constructions.lean | 171 | 172 | theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by |
simp [rank_finsupp]
| [
" Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)",
" Module.rank R (ι →₀ M) = #ι * Module.rank R M"
] | [
" Module.rank R (ι →₀ M) = lift.{v, w} #ι * lift.{w, v} (Module.rank R M)"
] |
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
#align_import data.complex.exponential_bounds from "leanprover-community/mathlib"@"402f8982dddc1864bd703da2d6e2ee304a866973"
namespace Real
open IsAbsoluteValue Finset CauSeq Complex
theorem exp_one_near_10 : |exp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10 := by
apply exp_approx_start
iterate 13 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
#align real.exp_one_near_10 Real.exp_one_near_10
theorem exp_one_near_20 : |exp 1 - 363916618873 / 133877442384| ≤ 1 / 10 ^ 20 := by
apply exp_approx_start
iterate 21 refine exp_1_approx_succ_eq (by norm_num1; rfl) (by norm_cast) ?_
norm_num1
refine exp_approx_end' _ (by norm_num1; rfl) _ (by norm_cast) (by simp) ?_
rw [_root_.abs_one, abs_of_pos] <;> norm_num1
#align real.exp_one_near_20 Real.exp_one_near_20
theorem exp_one_gt_d9 : 2.7182818283 < exp 1 :=
lt_of_lt_of_le (by norm_num) (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
#align real.exp_one_gt_d9 Real.exp_one_gt_d9
theorem exp_one_lt_d9 : exp 1 < 2.7182818286 :=
lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) (by norm_num)
#align real.exp_one_lt_d9 Real.exp_one_lt_d9
theorem exp_neg_one_gt_d9 : 0.36787944116 < exp (-1) := by
rw [exp_neg, lt_inv _ (exp_pos _)]
· refine lt_of_le_of_lt (sub_le_iff_le_add.1 (abs_sub_le_iff.1 exp_one_near_10).1) ?_
norm_num
· norm_num
#align real.exp_neg_one_gt_d9 Real.exp_neg_one_gt_d9
theorem exp_neg_one_lt_d9 : exp (-1) < 0.3678794412 := by
rw [exp_neg, inv_lt (exp_pos _)]
· refine lt_of_lt_of_le ?_ (sub_le_comm.1 (abs_sub_le_iff.1 exp_one_near_10).2)
norm_num
· norm_num
#align real.exp_neg_one_lt_d9 Real.exp_neg_one_lt_d9
set_option tactic.skipAssignedInstances false in
| Mathlib/Data/Complex/ExponentialBounds.lean | 59 | 71 | theorem log_two_near_10 : |log 2 - 287209 / 414355| ≤ 1 / 10 ^ 10 := by |
suffices |log 2 - 287209 / 414355| ≤ 1 / 17179869184 + (1 / 10 ^ 10 - 1 / 2 ^ 34) by
norm_num1 at *
assumption
have t : |(2⁻¹ : ℝ)| = 2⁻¹ := by rw [abs_of_pos]; norm_num
have z := Real.abs_log_sub_add_sum_range_le (show |(2⁻¹ : ℝ)| < 1 by rw [t]; norm_num) 34
rw [t] at z
norm_num1 at z
rw [one_div (2 : ℝ), log_inv, ← sub_eq_add_neg, _root_.abs_sub_comm] at z
apply le_trans (_root_.abs_sub_le _ _ _) (add_le_add z _)
simp_rw [sum_range_succ]
norm_num
rw [abs_of_pos] <;> norm_num
| [
" |rexp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10",
" |rexp 1 - expNear 0 1 (2244083 / 825552)| ≤ |1| ^ 0 / ↑(Nat.factorial 0) * (1 / 10 ^ 10)",
" 0 + 1 = ?m.532",
" 1 = ?m.532",
" ↑1 = ?m.543",
" |rexp 1 - expNear 1 1 ((2244083 / 825552 - 1) * 1)| ≤ |1| ^ 1 / ↑(Nat.factorial 1) * (1 / 10 ^ 10 * 1)",
" 1 + 1 ... | [
" |rexp 1 - 2244083 / 825552| ≤ 1 / 10 ^ 10",
" |rexp 1 - expNear 0 1 (2244083 / 825552)| ≤ |1| ^ 0 / ↑(Nat.factorial 0) * (1 / 10 ^ 10)",
" 0 + 1 = ?m.532",
" 1 = ?m.532",
" ↑1 = ?m.543",
" |rexp 1 - expNear 1 1 ((2244083 / 825552 - 1) * 1)| ≤ |1| ^ 1 / ↑(Nat.factorial 1) * (1 / 10 ^ 10 * 1)",
" 1 + 1 ... |
import Mathlib.Topology.Category.TopCat.Adjunctions
#align_import topology.category.Top.epi_mono from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe u
open CategoryTheory
open TopCat
namespace TopCat
theorem epi_iff_surjective {X Y : TopCat.{u}} (f : X ⟶ Y) : Epi f ↔ Function.Surjective f := by
suffices Epi f ↔ Epi ((forget TopCat).map f) by
rw [this, CategoryTheory.epi_iff_surjective]
rfl
constructor
· intro
infer_instance
· apply Functor.epi_of_epi_map
set_option linter.uppercaseLean3 false in
#align Top.epi_iff_surjective TopCat.epi_iff_surjective
| Mathlib/Topology/Category/TopCat/EpiMono.lean | 38 | 45 | theorem mono_iff_injective {X Y : TopCat.{u}} (f : X ⟶ Y) : Mono f ↔ Function.Injective f := by |
suffices Mono f ↔ Mono ((forget TopCat).map f) by
rw [this, CategoryTheory.mono_iff_injective]
rfl
constructor
· intro
infer_instance
· apply Functor.mono_of_mono_map
| [
" Epi f ↔ Function.Surjective ⇑f",
" Function.Surjective ((forget TopCat).map f) ↔ Function.Surjective ⇑f",
" Epi f ↔ Epi ((forget TopCat).map f)",
" Epi f → Epi ((forget TopCat).map f)",
" Epi ((forget TopCat).map f)",
" Epi ((forget TopCat).map f) → Epi f",
" Mono f ↔ Function.Injective ⇑f",
" Funct... | [
" Epi f ↔ Function.Surjective ⇑f",
" Function.Surjective ((forget TopCat).map f) ↔ Function.Surjective ⇑f",
" Epi f ↔ Epi ((forget TopCat).map f)",
" Epi f → Epi ((forget TopCat).map f)",
" Epi ((forget TopCat).map f)",
" Epi ((forget TopCat).map f) → Epi f"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.special_functions.log.monotone from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {x y : ℝ}
| Mathlib/Analysis/SpecialFunctions/Log/Monotone.lean | 32 | 38 | theorem log_mul_self_monotoneOn : MonotoneOn (fun x : ℝ => log x * x) { x | 1 ≤ x } := by |
-- TODO: can be strengthened to exp (-1) ≤ x
simp only [MonotoneOn, mem_setOf_eq]
intro x hex y hey hxy
have y_pos : 0 < y := lt_of_lt_of_le zero_lt_one hey
gcongr
rwa [le_log_iff_exp_le y_pos, Real.exp_zero]
| [
" MonotoneOn (fun x => x.log * x) {x | 1 ≤ x}",
" ∀ ⦃a : ℝ⦄, 1 ≤ a → ∀ ⦃b : ℝ⦄, 1 ≤ b → a ≤ b → a.log * a ≤ b.log * b",
" x.log * x ≤ y.log * y",
" 0 ≤ y.log"
] | [] |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
import Mathlib.Topology.Order.ProjIcc
#align_import analysis.special_functions.trigonometric.inverse from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Topology Filter
open Set Filter
open Real
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] Porting note: not implemented
noncomputable def arcsin : ℝ → ℝ :=
Subtype.val ∘ IccExtend (neg_le_self zero_le_one) sinOrderIso.symm
#align real.arcsin Real.arcsin
theorem arcsin_mem_Icc (x : ℝ) : arcsin x ∈ Icc (-(π / 2)) (π / 2) :=
Subtype.coe_prop _
#align real.arcsin_mem_Icc Real.arcsin_mem_Icc
@[simp]
theorem range_arcsin : range arcsin = Icc (-(π / 2)) (π / 2) := by
rw [arcsin, range_comp Subtype.val]
simp [Icc]
#align real.range_arcsin Real.range_arcsin
theorem arcsin_le_pi_div_two (x : ℝ) : arcsin x ≤ π / 2 :=
(arcsin_mem_Icc x).2
#align real.arcsin_le_pi_div_two Real.arcsin_le_pi_div_two
theorem neg_pi_div_two_le_arcsin (x : ℝ) : -(π / 2) ≤ arcsin x :=
(arcsin_mem_Icc x).1
#align real.neg_pi_div_two_le_arcsin Real.neg_pi_div_two_le_arcsin
theorem arcsin_projIcc (x : ℝ) :
arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by
rw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend,
Function.comp_apply]
#align real.arcsin_proj_Icc Real.arcsin_projIcc
theorem sin_arcsin' {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : sin (arcsin x) = x := by
simpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using
Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply ⟨x, hx⟩)
#align real.sin_arcsin' Real.sin_arcsin'
theorem sin_arcsin {x : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) : sin (arcsin x) = x :=
sin_arcsin' ⟨hx₁, hx₂⟩
#align real.sin_arcsin Real.sin_arcsin
theorem arcsin_sin' {x : ℝ} (hx : x ∈ Icc (-(π / 2)) (π / 2)) : arcsin (sin x) = x :=
injOn_sin (arcsin_mem_Icc _) hx <| by rw [sin_arcsin (neg_one_le_sin _) (sin_le_one _)]
#align real.arcsin_sin' Real.arcsin_sin'
theorem arcsin_sin {x : ℝ} (hx₁ : -(π / 2) ≤ x) (hx₂ : x ≤ π / 2) : arcsin (sin x) = x :=
arcsin_sin' ⟨hx₁, hx₂⟩
#align real.arcsin_sin Real.arcsin_sin
theorem strictMonoOn_arcsin : StrictMonoOn arcsin (Icc (-1) 1) :=
(Subtype.strictMono_coe _).comp_strictMonoOn <|
sinOrderIso.symm.strictMono.strictMonoOn_IccExtend _
#align real.strict_mono_on_arcsin Real.strictMonoOn_arcsin
theorem monotone_arcsin : Monotone arcsin :=
(Subtype.mono_coe _).comp <| sinOrderIso.symm.monotone.IccExtend _
#align real.monotone_arcsin Real.monotone_arcsin
theorem injOn_arcsin : InjOn arcsin (Icc (-1) 1) :=
strictMonoOn_arcsin.injOn
#align real.inj_on_arcsin Real.injOn_arcsin
theorem arcsin_inj {x y : ℝ} (hx₁ : -1 ≤ x) (hx₂ : x ≤ 1) (hy₁ : -1 ≤ y) (hy₂ : y ≤ 1) :
arcsin x = arcsin y ↔ x = y :=
injOn_arcsin.eq_iff ⟨hx₁, hx₂⟩ ⟨hy₁, hy₂⟩
#align real.arcsin_inj Real.arcsin_inj
@[continuity]
theorem continuous_arcsin : Continuous arcsin :=
continuous_subtype_val.comp sinOrderIso.symm.continuous.Icc_extend'
#align real.continuous_arcsin Real.continuous_arcsin
theorem continuousAt_arcsin {x : ℝ} : ContinuousAt arcsin x :=
continuous_arcsin.continuousAt
#align real.continuous_at_arcsin Real.continuousAt_arcsin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean | 108 | 111 | theorem arcsin_eq_of_sin_eq {x y : ℝ} (h₁ : sin x = y) (h₂ : x ∈ Icc (-(π / 2)) (π / 2)) :
arcsin y = x := by |
subst y
exact injOn_sin (arcsin_mem_Icc _) h₂ (sin_arcsin' (sin_mem_Icc x))
| [
" range arcsin = Icc (-(π / 2)) (π / 2)",
" Subtype.val '' range (IccExtend arcsin.proof_2 ⇑sinOrderIso.symm) = Icc (-(π / 2)) (π / 2)",
" (↑(projIcc (-1) 1 ⋯ x)).arcsin = x.arcsin",
" x.arcsin.sin = x",
" x.sin.arcsin.sin = x.sin",
" y.arcsin = x",
" x.sin.arcsin = x"
] | [
" range arcsin = Icc (-(π / 2)) (π / 2)",
" Subtype.val '' range (IccExtend arcsin.proof_2 ⇑sinOrderIso.symm) = Icc (-(π / 2)) (π / 2)",
" (↑(projIcc (-1) 1 ⋯ x)).arcsin = x.arcsin",
" x.arcsin.sin = x",
" x.sin.arcsin.sin = x.sin"
] |
import Mathlib.Order.Filter.SmallSets
import Mathlib.Tactic.Monotonicity
import Mathlib.Topology.Compactness.Compact
import Mathlib.Topology.NhdsSet
import Mathlib.Algebra.Group.Defs
#align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c"
open Set Filter Topology
universe u v ua ub uc ud
variable {α : Type ua} {β : Type ub} {γ : Type uc} {δ : Type ud} {ι : Sort*}
def idRel {α : Type*} :=
{ p : α × α | p.1 = p.2 }
#align id_rel idRel
@[simp]
theorem mem_idRel {a b : α} : (a, b) ∈ @idRel α ↔ a = b :=
Iff.rfl
#align mem_id_rel mem_idRel
@[simp]
| Mathlib/Topology/UniformSpace/Basic.lean | 140 | 141 | theorem idRel_subset {s : Set (α × α)} : idRel ⊆ s ↔ ∀ a, (a, a) ∈ s := by |
simp [subset_def]
| [
" idRel ⊆ s ↔ ∀ (a : α), (a, a) ∈ s"
] | [] |
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Tactic.GCongr
#align_import order.filter.archimedean from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {α R : Type*}
open Filter Set Function
@[simp]
theorem Nat.comap_cast_atTop [StrictOrderedSemiring R] [Archimedean R] :
comap ((↑) : ℕ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge
#align nat.comap_coe_at_top Nat.comap_cast_atTop
theorem tendsto_natCast_atTop_iff [StrictOrderedSemiring R] [Archimedean R] {f : α → ℕ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop :=
tendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge
#align tendsto_coe_nat_at_top_iff tendsto_natCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_iff := tendsto_natCast_atTop_iff
theorem tendsto_natCast_atTop_atTop [OrderedSemiring R] [Archimedean R] :
Tendsto ((↑) : ℕ → R) atTop atTop :=
Nat.mono_cast.tendsto_atTop_atTop exists_nat_ge
#align tendsto_coe_nat_at_top_at_top tendsto_natCast_atTop_atTop
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_atTop := tendsto_natCast_atTop_atTop
theorem Filter.Eventually.natCast_atTop [OrderedSemiring R] [Archimedean R] {p : R → Prop}
(h : ∀ᶠ (x:R) in atTop, p x) : ∀ᶠ (n:ℕ) in atTop, p n :=
tendsto_natCast_atTop_atTop.eventually h
@[deprecated (since := "2024-04-17")]
alias Filter.Eventually.nat_cast_atTop := Filter.Eventually.natCast_atTop
@[simp] theorem Int.comap_cast_atTop [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge r; ⟨n, mod_cast hn⟩
#align int.comap_coe_at_top Int.comap_cast_atTop
@[simp]
theorem Int.comap_cast_atBot [StrictOrderedRing R] [Archimedean R] :
comap ((↑) : ℤ → R) atBot = atBot :=
comap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>
let ⟨n, hn⟩ := exists_nat_ge (-r)
⟨-n, by simpa [neg_le] using hn⟩
#align int.comap_coe_at_bot Int.comap_cast_atBot
| Mathlib/Order/Filter/Archimedean.lean | 69 | 71 | theorem tendsto_intCast_atTop_iff [StrictOrderedRing R] [Archimedean R] {f : α → ℤ}
{l : Filter α} : Tendsto (fun n => (f n : R)) l atTop ↔ Tendsto f l atTop := by |
rw [← @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl
| [
" ↑(-↑n) ≤ r",
" Tendsto (fun n => ↑(f n)) l atTop ↔ Tendsto f l atTop",
" Tendsto (fun n => ↑(f n)) l atTop ↔ Tendsto (Int.cast ∘ f) l atTop"
] | [
" ↑(-↑n) ≤ r"
] |
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Algebra.GCDMonoid.Nat
#align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
theorem Int.Prime.dvd_mul {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) :
p ∣ m.natAbs ∨ p ∣ n.natAbs := by
rwa [← hp.dvd_mul, ← Int.natAbs_mul, ← Int.natCast_dvd]
#align int.prime.dvd_mul Int.Prime.dvd_mul
theorem Int.Prime.dvd_mul' {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) :
(p : ℤ) ∣ m ∨ (p : ℤ) ∣ n := by
rw [Int.natCast_dvd, Int.natCast_dvd]
exact Int.Prime.dvd_mul hp h
#align int.prime.dvd_mul' Int.Prime.dvd_mul'
theorem Int.Prime.dvd_pow {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) :
p ∣ n.natAbs := by
rw [Int.natCast_dvd, Int.natAbs_pow] at h
exact hp.dvd_of_dvd_pow h
#align int.prime.dvd_pow Int.Prime.dvd_pow
theorem Int.Prime.dvd_pow' {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) :
(p : ℤ) ∣ n := by
rw [Int.natCast_dvd]
exact Int.Prime.dvd_pow hp h
#align int.prime.dvd_pow' Int.Prime.dvd_pow'
theorem prime_two_or_dvd_of_dvd_two_mul_pow_self_two {m : ℤ} {p : ℕ} (hp : Nat.Prime p)
(h : (p : ℤ) ∣ 2 * m ^ 2) : p = 2 ∨ p ∣ Int.natAbs m := by
cases' Int.Prime.dvd_mul hp h with hp2 hpp
· apply Or.intro_left
exact le_antisymm (Nat.le_of_dvd zero_lt_two hp2) (Nat.Prime.two_le hp)
· apply Or.intro_right
rw [sq, Int.natAbs_mul] at hpp
exact or_self_iff.mp ((Nat.Prime.dvd_mul hp).mp hpp)
#align prime_two_or_dvd_of_dvd_two_mul_pow_self_two prime_two_or_dvd_of_dvd_two_mul_pow_self_two
| Mathlib/RingTheory/Int/Basic.lean | 121 | 123 | theorem Int.exists_prime_and_dvd {n : ℤ} (hn : n.natAbs ≠ 1) : ∃ p, Prime p ∧ p ∣ n := by |
obtain ⟨p, pp, pd⟩ := Nat.exists_prime_and_dvd hn
exact ⟨p, Nat.prime_iff_prime_int.mp pp, Int.natCast_dvd.mpr pd⟩
| [
" p ∣ m.natAbs ∨ p ∣ n.natAbs",
" ↑p ∣ m ∨ ↑p ∣ n",
" p ∣ n.natAbs",
" ↑p ∣ n",
" p = 2 ∨ p ∣ m.natAbs",
" p = 2",
" p ∣ m.natAbs",
" ∃ p, Prime p ∧ p ∣ n"
] | [
" p ∣ m.natAbs ∨ p ∣ n.natAbs",
" ↑p ∣ m ∨ ↑p ∣ n",
" p ∣ n.natAbs",
" ↑p ∣ n",
" p = 2 ∨ p ∣ m.natAbs",
" p = 2",
" p ∣ m.natAbs"
] |
import Mathlib.Analysis.InnerProductSpace.Dual
import Mathlib.Analysis.Calculus.FDeriv.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
open Topology InnerProductSpace Set
noncomputable section
variable {𝕜 F : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] [CompleteSpace F]
variable {f : F → 𝕜} {f' x : F}
def HasGradientAtFilter (f : F → 𝕜) (f' x : F) (L : Filter F) :=
HasFDerivAtFilter f (toDual 𝕜 F f') x L
def HasGradientWithinAt (f : F → 𝕜) (f' : F) (s : Set F) (x : F) :=
HasGradientAtFilter f f' x (𝓝[s] x)
def HasGradientAt (f : F → 𝕜) (f' x : F) :=
HasGradientAtFilter f f' x (𝓝 x)
def gradientWithin (f : F → 𝕜) (s : Set F) (x : F) : F :=
(toDual 𝕜 F).symm (fderivWithin 𝕜 f s x)
def gradient (f : F → 𝕜) (x : F) : F :=
(toDual 𝕜 F).symm (fderiv 𝕜 f x)
@[inherit_doc]
scoped[Gradient] notation "∇" => gradient
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
open scoped Gradient
variable {s : Set F} {L : Filter F}
theorem hasGradientWithinAt_iff_hasFDerivWithinAt {s : Set F} :
HasGradientWithinAt f f' s x ↔ HasFDerivWithinAt f (toDual 𝕜 F f') s x :=
Iff.rfl
| Mathlib/Analysis/Calculus/Gradient/Basic.lean | 90 | 92 | theorem hasFDerivWithinAt_iff_hasGradientWithinAt {frechet : F →L[𝕜] 𝕜} {s : Set F} :
HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x := by |
rw [hasGradientWithinAt_iff_hasFDerivWithinAt, (toDual 𝕜 F).apply_symm_apply frechet]
| [
" HasFDerivWithinAt f frechet s x ↔ HasGradientWithinAt f ((toDual 𝕜 F).symm frechet) s x"
] | [] |
import Batteries.Data.Fin.Basic
namespace Fin
attribute [norm_cast] val_last
protected theorem le_antisymm_iff {x y : Fin n} : x = y ↔ x ≤ y ∧ y ≤ x :=
Fin.ext_iff.trans Nat.le_antisymm_iff
protected theorem le_antisymm {x y : Fin n} (h1 : x ≤ y) (h2 : y ≤ x) : x = y :=
Fin.le_antisymm_iff.2 ⟨h1, h2⟩
@[simp] theorem coe_clamp (n m : Nat) : (clamp n m : Nat) = min n m := rfl
@[simp] theorem size_enum (n) : (enum n).size = n := Array.size_ofFn ..
@[simp] theorem enum_zero : (enum 0) = #[] := by simp [enum, Array.ofFn, Array.ofFn.go]
@[simp] theorem getElem_enum (i) (h : i < (enum n).size) : (enum n)[i] = ⟨i, size_enum n ▸ h⟩ :=
Array.getElem_ofFn ..
@[simp] theorem length_list (n) : (list n).length = n := by simp [list]
@[simp] theorem get_list (i : Fin (list n).length) : (list n).get i = i.cast (length_list n) := by
cases i; simp only [list]; rw [← Array.getElem_eq_data_get, getElem_enum, cast_mk]
@[simp] theorem list_zero : list 0 = [] := by simp [list]
| .lake/packages/batteries/Batteries/Data/Fin/Lemmas.lean | 38 | 39 | theorem list_succ (n) : list (n+1) = 0 :: (list n).map Fin.succ := by |
apply List.ext_get; simp; intro i; cases i <;> simp
| [
" enum 0 = #[]",
" (list n).length = n",
" (list n).get i = cast ⋯ i",
" (list n).get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" (enum n).data.get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" list 0 = []",
" list (n + 1) = 0 :: List.map succ (list n)",
" ∀ (n_1 : Nat) (h₁ : n_1 < (list (n + 1)).length) (h₂ ... | [
" enum 0 = #[]",
" (list n).length = n",
" (list n).get i = cast ⋯ i",
" (list n).get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" (enum n).data.get ⟨val✝, isLt✝⟩ = cast ⋯ ⟨val✝, isLt✝⟩",
" list 0 = []"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.