Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k |
|---|---|---|---|---|---|
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Field.Defs
import Mathlib.Data.Tree.Basic
import Mathlib.Logic.Basic
import Mathlib.Tactic.NormNum.Core
import Mathlib.Util.SynthesizeUsing
import Mathlib.Util.Qq
open Lean Parser Tactic Mathlib Meta NormNum Qq
initialize registerTraceClass `CancelDenoms
namespace CancelDenoms
theorem mul_subst {α} [CommRing α] {n1 n2 k e1 e2 t1 t2 : α}
(h1 : n1 * e1 = t1) (h2 : n2 * e2 = t2) (h3 : n1 * n2 = k) : k * (e1 * e2) = t1 * t2 := by
rw [← h3, mul_comm n1, mul_assoc n2, ← mul_assoc n1, h1,
← mul_assoc n2, mul_comm n2, mul_assoc, h2]
#align cancel_factors.mul_subst CancelDenoms.mul_subst
theorem div_subst {α} [Field α] {n1 n2 k e1 e2 t1 : α}
(h1 : n1 * e1 = t1) (h2 : n2 / e2 = 1) (h3 : n1 * n2 = k) : k * (e1 / e2) = t1 := by
rw [← h3, mul_assoc, mul_div_left_comm, h2, ← mul_assoc, h1, mul_comm, one_mul]
#align cancel_factors.div_subst CancelDenoms.div_subst
theorem cancel_factors_eq_div {α} [Field α] {n e e' : α}
(h : n * e = e') (h2 : n ≠ 0) : e = e' / n :=
eq_div_of_mul_eq h2 <| by rwa [mul_comm] at h
#align cancel_factors.cancel_factors_eq_div CancelDenoms.cancel_factors_eq_div
theorem add_subst {α} [Ring α] {n e1 e2 t1 t2 : α} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :
n * (e1 + e2) = t1 + t2 := by simp [left_distrib, *]
#align cancel_factors.add_subst CancelDenoms.add_subst
theorem sub_subst {α} [Ring α] {n e1 e2 t1 t2 : α} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :
n * (e1 - e2) = t1 - t2 := by simp [left_distrib, *, sub_eq_add_neg]
#align cancel_factors.sub_subst CancelDenoms.sub_subst
theorem neg_subst {α} [Ring α] {n e t : α} (h1 : n * e = t) : n * -e = -t := by simp [*]
#align cancel_factors.neg_subst CancelDenoms.neg_subst
theorem pow_subst {α} [CommRing α] {n e1 t1 k l : α} {e2 : ℕ}
(h1 : n * e1 = t1) (h2 : l * n ^ e2 = k) : k * (e1 ^ e2) = l * t1 ^ e2 := by
rw [← h2, ← h1, mul_pow, mul_assoc]
theorem inv_subst {α} [Field α] {n k e : α} (h2 : e ≠ 0) (h3 : n * e = k) :
k * (e ⁻¹) = n := by rw [← div_eq_mul_inv, ← h3, mul_div_cancel_right₀ _ h2]
theorem cancel_factors_lt {α} [LinearOrderedField α] {a b ad bd a' b' gcd : α}
(ha : ad * a = a') (hb : bd * b = b') (had : 0 < ad) (hbd : 0 < bd) (hgcd : 0 < gcd) :
(a < b) = (1 / gcd * (bd * a') < 1 / gcd * (ad * b')) := by
rw [mul_lt_mul_left, ← ha, ← hb, ← mul_assoc, ← mul_assoc, mul_comm bd, mul_lt_mul_left]
· exact mul_pos had hbd
· exact one_div_pos.2 hgcd
#align cancel_factors.cancel_factors_lt CancelDenoms.cancel_factors_lt
| Mathlib/Tactic/CancelDenoms/Core.lean | 81 | 86 | theorem cancel_factors_le {α} [LinearOrderedField α] {a b ad bd a' b' gcd : α}
(ha : ad * a = a') (hb : bd * b = b') (had : 0 < ad) (hbd : 0 < bd) (hgcd : 0 < gcd) :
(a ≤ b) = (1 / gcd * (bd * a') ≤ 1 / gcd * (ad * b')) := by |
rw [mul_le_mul_left, ← ha, ← hb, ← mul_assoc, ← mul_assoc, mul_comm bd, mul_le_mul_left]
· exact mul_pos had hbd
· exact one_div_pos.2 hgcd
|
import Batteries.Tactic.SeqFocus
namespace Batteries
class TotalBLE (le : α → α → Bool) : Prop where
total : le a b ∨ le b a
class OrientedCmp (cmp : α → α → Ordering) : Prop where
symm (x y) : (cmp x y).swap = cmp y x
class TransCmp (cmp : α → α → Ordering) extends OrientedCmp cmp : Prop where
le_trans : cmp x y ≠ .gt → cmp y z ≠ .gt → cmp x z ≠ .gt
instance [inst : OrientedCmp cmp] : OrientedCmp (flip cmp) where
symm _ _ := inst.symm ..
instance [inst : TransCmp cmp] : TransCmp (flip cmp) where
le_trans h1 h2 := inst.le_trans h2 h1
class BEqCmp [BEq α] (cmp : α → α → Ordering) : Prop where
cmp_iff_beq : cmp x y = .eq ↔ x == y
| .lake/packages/batteries/Batteries/Classes/Order.lean | 121 | 122 | theorem BEqCmp.cmp_iff_eq [BEq α] [LawfulBEq α] [BEqCmp (α := α) cmp] : cmp x y = .eq ↔ x = y := by |
simp [BEqCmp.cmp_iff_beq]
|
import Mathlib.Order.Bounds.Basic
import Mathlib.Order.WellFounded
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Data.Set.Lattice
#align_import order.conditionally_complete_lattice.basic from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
open Function OrderDual Set
variable {α β γ : Type*} {ι : Sort*}
section
variable [Preorder α]
open scoped Classical
noncomputable instance WithTop.instSupSet [SupSet α] :
SupSet (WithTop α) :=
⟨fun S =>
if ⊤ ∈ S then ⊤ else if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then
↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩
noncomputable instance WithTop.instInfSet [InfSet α] : InfSet (WithTop α) :=
⟨fun S => if S ⊆ {⊤} ∨ ¬BddBelow S then ⊤ else ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩
noncomputable instance WithBot.instSupSet [SupSet α] : SupSet (WithBot α) :=
⟨(WithTop.instInfSet (α := αᵒᵈ)).sInf⟩
noncomputable instance WithBot.instInfSet [InfSet α] :
InfSet (WithBot α) :=
⟨(WithTop.instSupSet (α := αᵒᵈ)).sSup⟩
theorem WithTop.sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s)
(hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
(if_neg hs).trans <| if_pos hs'
#align with_top.Sup_eq WithTop.sSup_eq
theorem WithTop.sInf_eq [InfSet α] {s : Set (WithTop α)} (hs : ¬s ⊆ {⊤}) (h's : BddBelow s) :
sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
if_neg <| by simp [hs, h's]
#align with_top.Inf_eq WithTop.sInf_eq
theorem WithBot.sInf_eq [InfSet α] {s : Set (WithBot α)} (hs : ⊥ ∉ s)
(hs' : BddBelow ((↑) ⁻¹' s : Set α)) : sInf s = ↑(sInf ((↑) ⁻¹' s) : α) :=
(if_neg hs).trans <| if_pos hs'
#align with_bot.Inf_eq WithBot.sInf_eq
theorem WithBot.sSup_eq [SupSet α] {s : Set (WithBot α)} (hs : ¬s ⊆ {⊥}) (h's : BddAbove s) :
sSup s = ↑(sSup ((↑) ⁻¹' s) : α) :=
WithTop.sInf_eq (α := αᵒᵈ) hs h's
#align with_bot.Sup_eq WithBot.sSup_eq
@[simp]
theorem WithTop.sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ :=
if_pos <| by simp
#align with_top.cInf_empty WithTop.sInf_empty
@[simp]
theorem WithTop.iInf_empty [IsEmpty ι] [InfSet α] (f : ι → WithTop α) :
⨅ i, f i = ⊤ := by rw [iInf, range_eq_empty, WithTop.sInf_empty]
#align with_top.cinfi_empty WithTop.iInf_empty
theorem WithTop.coe_sInf' [InfSet α] {s : Set α} (hs : s.Nonempty) (h's : BddBelow s) :
↑(sInf s) = (sInf ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
obtain ⟨x, hx⟩ := hs
change _ = ite _ _ _
split_ifs with h
· rcases h with h1 | h2
· cases h1 (mem_image_of_mem _ hx)
· exact (h2 (Monotone.map_bddBelow coe_mono h's)).elim
· rw [preimage_image_eq]
exact Option.some_injective _
#align with_top.coe_Inf' WithTop.coe_sInf'
-- Porting note: the mathlib3 proof uses `range_comp` in the opposite direction and
-- does not need `rfl`.
@[norm_cast]
theorem WithTop.coe_iInf [Nonempty ι] [InfSet α] {f : ι → α} (hf : BddBelow (range f)) :
↑(⨅ i, f i) = (⨅ i, f i : WithTop α) := by
rw [iInf, iInf, WithTop.coe_sInf' (range_nonempty f) hf, ← range_comp]
rfl
#align with_top.coe_infi WithTop.coe_iInf
theorem WithTop.coe_sSup' [SupSet α] {s : Set α} (hs : BddAbove s) :
↑(sSup s) = (sSup ((fun (a : α) ↦ ↑a) '' s) : WithTop α) := by
change _ = ite _ _ _
rw [if_neg, preimage_image_eq, if_pos hs]
· exact Option.some_injective _
· rintro ⟨x, _, ⟨⟩⟩
#align with_top.coe_Sup' WithTop.coe_sSup'
-- Porting note: the mathlib3 proof uses `range_comp` in the opposite direction and
-- does not need `rfl`.
@[norm_cast]
| Mathlib/Order/ConditionallyCompleteLattice/Basic.lean | 127 | 129 | theorem WithTop.coe_iSup [SupSet α] (f : ι → α) (h : BddAbove (Set.range f)) :
↑(⨆ i, f i) = (⨆ i, f i : WithTop α) := by |
rw [iSup, iSup, WithTop.coe_sSup' h, ← range_comp]; rfl
|
import Mathlib.Data.List.Basic
#align_import data.list.infix from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2"
open Nat
variable {α β : Type*}
namespace List
variable {l l₁ l₂ l₃ : List α} {a b : α} {m n : ℕ}
section Fix
#align list.prefix_append List.prefix_append
#align list.suffix_append List.suffix_append
#align list.infix_append List.infix_append
#align list.infix_append' List.infix_append'
#align list.is_prefix.is_infix List.IsPrefix.isInfix
#align list.is_suffix.is_infix List.IsSuffix.isInfix
#align list.nil_prefix List.nil_prefix
#align list.nil_suffix List.nil_suffix
#align list.nil_infix List.nil_infix
#align list.prefix_refl List.prefix_refl
#align list.suffix_refl List.suffix_refl
#align list.infix_refl List.infix_refl
theorem prefix_rfl : l <+: l :=
prefix_refl _
#align list.prefix_rfl List.prefix_rfl
theorem suffix_rfl : l <:+ l :=
suffix_refl _
#align list.suffix_rfl List.suffix_rfl
theorem infix_rfl : l <:+: l :=
infix_refl _
#align list.infix_rfl List.infix_rfl
#align list.suffix_cons List.suffix_cons
theorem prefix_concat (a : α) (l) : l <+: concat l a := by simp
#align list.prefix_concat List.prefix_concat
| Mathlib/Data/List/Infix.lean | 73 | 76 | theorem prefix_concat_iff {l₁ l₂ : List α} {a : α} :
l₁ <+: l₂ ++ [a] ↔ l₁ = l₂ ++ [a] ∨ l₁ <+: l₂ := by |
simpa only [← reverse_concat', reverse_inj, reverse_suffix] using
suffix_cons_iff (l₁ := l₁.reverse) (l₂ := l₂.reverse)
|
import Mathlib.Analysis.NormedSpace.OperatorNorm.Bilinear
import Mathlib.Analysis.NormedSpace.OperatorNorm.NNNorm
import Mathlib.Analysis.NormedSpace.Span
suppress_compilation
open Bornology
open Filter hiding map_smul
open scoped Classical NNReal Topology Uniformity
-- the `ₗ` subscript variables are for special cases about linear (as opposed to semilinear) maps
variable {𝕜 𝕜₂ 𝕜₃ E Eₗ F Fₗ G Gₗ 𝓕 : Type*}
section Normed
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
[NormedAddCommGroup Fₗ]
open Metric ContinuousLinearMap
section
variable [NontriviallyNormedField 𝕜] [NontriviallyNormedField 𝕜₂] [NontriviallyNormedField 𝕜₃]
[NormedSpace 𝕜 E] [NormedSpace 𝕜₂ F] [NormedSpace 𝕜₃ G] [NormedSpace 𝕜 Fₗ] (c : 𝕜)
{σ₁₂ : 𝕜 →+* 𝕜₂} {σ₂₃ : 𝕜₂ →+* 𝕜₃} (f g : E →SL[σ₁₂] F) (x y z : E)
namespace LinearMap
| Mathlib/Analysis/NormedSpace/OperatorNorm/NormedSpace.lean | 42 | 46 | theorem bound_of_shell [RingHomIsometric σ₁₂] (f : E →ₛₗ[σ₁₂] F) {ε C : ℝ} (ε_pos : 0 < ε) {c : 𝕜}
(hc : 1 < ‖c‖) (hf : ∀ x, ε / ‖c‖ ≤ ‖x‖ → ‖x‖ < ε → ‖f x‖ ≤ C * ‖x‖) (x : E) :
‖f x‖ ≤ C * ‖x‖ := by |
by_cases hx : x = 0; · simp [hx]
exact SemilinearMapClass.bound_of_shell_semi_normed f ε_pos hc hf (norm_ne_zero_iff.2 hx)
|
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
theorem mem_orthogonal' (v : E) : v ∈ Kᗮ ↔ ∀ u ∈ K, ⟪v, u⟫ = 0 := by
simp_rw [mem_orthogonal, inner_eq_zero_symm]
#align submodule.mem_orthogonal' Submodule.mem_orthogonal'
variable {K}
theorem inner_right_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪u, v⟫ = 0 :=
(K.mem_orthogonal v).1 hv u hu
#align submodule.inner_right_of_mem_orthogonal Submodule.inner_right_of_mem_orthogonal
theorem inner_left_of_mem_orthogonal {u v : E} (hu : u ∈ K) (hv : v ∈ Kᗮ) : ⟪v, u⟫ = 0 := by
rw [inner_eq_zero_symm]; exact inner_right_of_mem_orthogonal hu hv
#align submodule.inner_left_of_mem_orthogonal Submodule.inner_left_of_mem_orthogonal
theorem mem_orthogonal_singleton_iff_inner_right {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪u, v⟫ = 0 := by
refine ⟨inner_right_of_mem_orthogonal (mem_span_singleton_self u), ?_⟩
intro hv w hw
rw [mem_span_singleton] at hw
obtain ⟨c, rfl⟩ := hw
simp [inner_smul_left, hv]
#align submodule.mem_orthogonal_singleton_iff_inner_right Submodule.mem_orthogonal_singleton_iff_inner_right
theorem mem_orthogonal_singleton_iff_inner_left {u v : E} : v ∈ (𝕜 ∙ u)ᗮ ↔ ⟪v, u⟫ = 0 := by
rw [mem_orthogonal_singleton_iff_inner_right, inner_eq_zero_symm]
#align submodule.mem_orthogonal_singleton_iff_inner_left Submodule.mem_orthogonal_singleton_iff_inner_left
theorem sub_mem_orthogonal_of_inner_left {x y : E} (h : ∀ v : K, ⟪x, v⟫ = ⟪y, v⟫) : x - y ∈ Kᗮ := by
rw [mem_orthogonal']
intro u hu
rw [inner_sub_left, sub_eq_zero]
exact h ⟨u, hu⟩
#align submodule.sub_mem_orthogonal_of_inner_left Submodule.sub_mem_orthogonal_of_inner_left
theorem sub_mem_orthogonal_of_inner_right {x y : E} (h : ∀ v : K, ⟪(v : E), x⟫ = ⟪(v : E), y⟫) :
x - y ∈ Kᗮ := by
intro u hu
rw [inner_sub_right, sub_eq_zero]
exact h ⟨u, hu⟩
#align submodule.sub_mem_orthogonal_of_inner_right Submodule.sub_mem_orthogonal_of_inner_right
variable (K)
| Mathlib/Analysis/InnerProductSpace/Orthogonal.lean | 103 | 107 | theorem inf_orthogonal_eq_bot : K ⊓ Kᗮ = ⊥ := by |
rw [eq_bot_iff]
intro x
rw [mem_inf]
exact fun ⟨hx, ho⟩ => inner_self_eq_zero.1 (ho x hx)
|
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Relator
import Mathlib.Init.Data.Quot
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Use
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.SimpRw
#align_import logic.relation from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
open Function
variable {α β γ δ ε ζ : Type*}
namespace Relation
variable {r : α → α → Prop} {a b c d : α}
@[mk_iff ReflTransGen.cases_tail_iff]
inductive ReflTransGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflTransGen r a a
| tail {b c} : ReflTransGen r a b → r b c → ReflTransGen r a c
#align relation.refl_trans_gen Relation.ReflTransGen
#align relation.refl_trans_gen.cases_tail_iff Relation.ReflTransGen.cases_tail_iff
attribute [refl] ReflTransGen.refl
@[mk_iff]
inductive ReflGen (r : α → α → Prop) (a : α) : α → Prop
| refl : ReflGen r a a
| single {b} : r a b → ReflGen r a b
#align relation.refl_gen Relation.ReflGen
#align relation.refl_gen_iff Relation.reflGen_iff
@[mk_iff]
inductive TransGen (r : α → α → Prop) (a : α) : α → Prop
| single {b} : r a b → TransGen r a b
| tail {b c} : TransGen r a b → r b c → TransGen r a c
#align relation.trans_gen Relation.TransGen
#align relation.trans_gen_iff Relation.transGen_iff
attribute [refl] ReflGen.refl
namespace ReflTransGen
@[trans]
| Mathlib/Logic/Relation.lean | 296 | 299 | theorem trans (hab : ReflTransGen r a b) (hbc : ReflTransGen r b c) : ReflTransGen r a c := by |
induction hbc with
| refl => assumption
| tail _ hcd hac => exact hac.tail hcd
|
import Mathlib.Analysis.Complex.RemovableSingularity
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.complex.locally_uniform_limit from "leanprover-community/mathlib"@"fe44cd36149e675eb5dec87acc7e8f1d6568e081"
open Set Metric MeasureTheory Filter Complex intervalIntegral
open scoped Real Topology
variable {E ι : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] {U K : Set ℂ}
{z : ℂ} {M r δ : ℝ} {φ : Filter ι} {F : ι → ℂ → E} {f g : ℂ → E}
namespace Complex
section Cderiv
noncomputable def cderiv (r : ℝ) (f : ℂ → E) (z : ℂ) : E :=
(2 * π * I : ℂ)⁻¹ • ∮ w in C(z, r), ((w - z) ^ 2)⁻¹ • f w
#align complex.cderiv Complex.cderiv
theorem cderiv_eq_deriv (hU : IsOpen U) (hf : DifferentiableOn ℂ f U) (hr : 0 < r)
(hzr : closedBall z r ⊆ U) : cderiv r f z = deriv f z :=
two_pi_I_inv_smul_circleIntegral_sub_sq_inv_smul_of_differentiable hU hzr hf (mem_ball_self hr)
#align complex.cderiv_eq_deriv Complex.cderiv_eq_deriv
| Mathlib/Analysis/Complex/LocallyUniformLimit.lean | 50 | 64 | theorem norm_cderiv_le (hr : 0 < r) (hf : ∀ w ∈ sphere z r, ‖f w‖ ≤ M) :
‖cderiv r f z‖ ≤ M / r := by |
have hM : 0 ≤ M := by
obtain ⟨w, hw⟩ : (sphere z r).Nonempty := NormedSpace.sphere_nonempty.mpr hr.le
exact (norm_nonneg _).trans (hf w hw)
have h1 : ∀ w ∈ sphere z r, ‖((w - z) ^ 2)⁻¹ • f w‖ ≤ M / r ^ 2 := by
intro w hw
simp only [mem_sphere_iff_norm, norm_eq_abs] at hw
simp only [norm_smul, inv_mul_eq_div, hw, norm_eq_abs, map_inv₀, Complex.abs_pow]
exact div_le_div hM (hf w hw) (sq_pos_of_pos hr) le_rfl
have h2 := circleIntegral.norm_integral_le_of_norm_le_const hr.le h1
simp only [cderiv, norm_smul]
refine (mul_le_mul le_rfl h2 (norm_nonneg _) (norm_nonneg _)).trans (le_of_eq ?_)
field_simp [_root_.abs_of_nonneg Real.pi_pos.le]
ring
|
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
def slope (f : k → PE) (a b : k) : E :=
(b - a)⁻¹ • (f b -ᵥ f a)
#align slope slope
theorem slope_fun_def (f : k → PE) : slope f = fun a b => (b - a)⁻¹ • (f b -ᵥ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k → k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k → k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k → PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k → E) (a b : k) : slope f a b = (b - a)⁻¹ • (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k → PE) (a b : k) : (b - a) • slope f a b = f b -ᵥ f a := by
rcases eq_or_ne a b with (rfl | hne)
· rw [sub_self, zero_smul, vsub_self]
· rw [slope, smul_inv_smul₀ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k → PE) (a b : k) : (b - a) • slope f a b +ᵥ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k → E) (c : PE) : (slope fun x => f x +ᵥ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k → E) {a b : k} (h : a ≠ b) :
slope (fun x => (x - a) • f x) a b = f b := by
simp [slope, inv_smul_smul₀ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
| Mathlib/LinearAlgebra/AffineSpace/Slope.lean | 78 | 79 | theorem eq_of_slope_eq_zero {f : k → PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by |
rw [← sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
|
import Mathlib.Algebra.Periodic
import Mathlib.Data.Nat.Count
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Interval.Finset.Nat
#align_import data.nat.periodic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace Nat
open Nat Function
theorem periodic_gcd (a : ℕ) : Periodic (gcd a) a := by
simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic]
#align nat.periodic_gcd Nat.periodic_gcd
theorem periodic_coprime (a : ℕ) : Periodic (Coprime a) a := by
simp only [coprime_add_self_right, forall_const, iff_self_iff, eq_iff_iff, Periodic]
#align nat.periodic_coprime Nat.periodic_coprime
theorem periodic_mod (a : ℕ) : Periodic (fun n => n % a) a := by
simp only [forall_const, eq_self_iff_true, add_mod_right, Periodic]
#align nat.periodic_mod Nat.periodic_mod
theorem _root_.Function.Periodic.map_mod_nat {α : Type*} {f : ℕ → α} {a : ℕ} (hf : Periodic f a) :
∀ n, f (n % a) = f n := fun n => by
conv_rhs => rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul]
#align function.periodic.map_mod_nat Function.Periodic.map_mod_nat
section Multiset
open Multiset
| Mathlib/Data/Nat/Periodic.lean | 48 | 54 | theorem filter_multiset_Ico_card_eq_of_periodic (n a : ℕ) (p : ℕ → Prop) [DecidablePred p]
(pp : Periodic p a) : card (filter p (Ico n (n + a))) = a.count p := by |
rw [count_eq_card_filter_range, Finset.card, Finset.filter_val, Finset.range_val, ←
multiset_Ico_map_mod n, ← map_count_True_eq_filter_card, ← map_count_True_eq_filter_card,
map_map]
congr; funext n
exact (Function.Periodic.map_mod_nat pp n).symm
|
import Mathlib.Topology.Algebra.Module.WeakDual
import Mathlib.MeasureTheory.Integral.BoundedContinuousFunction
import Mathlib.MeasureTheory.Measure.HasOuterApproxClosed
#align_import measure_theory.measure.finite_measure from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open MeasureTheory
open Set
open Filter
open BoundedContinuousFunction
open scoped Topology ENNReal NNReal BoundedContinuousFunction
namespace MeasureTheory
namespace FiniteMeasure
section FiniteMeasure
variable {Ω : Type*} [MeasurableSpace Ω]
def _root_.MeasureTheory.FiniteMeasure (Ω : Type*) [MeasurableSpace Ω] : Type _ :=
{ μ : Measure Ω // IsFiniteMeasure μ }
#align measure_theory.finite_measure MeasureTheory.FiniteMeasure
-- Porting note: as with other subtype synonyms (e.g., `ℝ≥0`, we need a new function for the
-- coercion instead of relying on `Subtype.val`.
@[coe]
def toMeasure : FiniteMeasure Ω → Measure Ω := Subtype.val
instance instCoe : Coe (FiniteMeasure Ω) (MeasureTheory.Measure Ω) where
coe := toMeasure
instance isFiniteMeasure (μ : FiniteMeasure Ω) : IsFiniteMeasure (μ : Measure Ω) :=
μ.prop
#align measure_theory.finite_measure.is_finite_measure MeasureTheory.FiniteMeasure.isFiniteMeasure
@[simp]
theorem val_eq_toMeasure (ν : FiniteMeasure Ω) : ν.val = (ν : Measure Ω) :=
rfl
#align measure_theory.finite_measure.val_eq_to_measure MeasureTheory.FiniteMeasure.val_eq_toMeasure
theorem toMeasure_injective : Function.Injective ((↑) : FiniteMeasure Ω → Measure Ω) :=
Subtype.coe_injective
#align measure_theory.finite_measure.coe_injective MeasureTheory.FiniteMeasure.toMeasure_injective
instance instFunLike : FunLike (FiniteMeasure Ω) (Set Ω) ℝ≥0 where
coe μ s := ((μ : Measure Ω) s).toNNReal
coe_injective' μ ν h := toMeasure_injective $ Measure.ext fun s _ ↦ by
simpa [ENNReal.toNNReal_eq_toNNReal_iff, measure_ne_top] using congr_fun h s
lemma coeFn_def (μ : FiniteMeasure Ω) : μ = fun s ↦ ((μ : Measure Ω) s).toNNReal := rfl
#align measure_theory.finite_measure.coe_fn_eq_to_nnreal_coe_fn_to_measure MeasureTheory.FiniteMeasure.coeFn_def
lemma coeFn_mk (μ : Measure Ω) (hμ) :
DFunLike.coe (F := FiniteMeasure Ω) ⟨μ, hμ⟩ = fun s ↦ (μ s).toNNReal := rfl
@[simp, norm_cast]
lemma mk_apply (μ : Measure Ω) (hμ) (s : Set Ω) :
DFunLike.coe (F := FiniteMeasure Ω) ⟨μ, hμ⟩ s = (μ s).toNNReal := rfl
@[simp]
theorem ennreal_coeFn_eq_coeFn_toMeasure (ν : FiniteMeasure Ω) (s : Set Ω) :
(ν s : ℝ≥0∞) = (ν : Measure Ω) s :=
ENNReal.coe_toNNReal (measure_lt_top (↑ν) s).ne
#align measure_theory.finite_measure.ennreal_coe_fn_eq_coe_fn_to_measure MeasureTheory.FiniteMeasure.ennreal_coeFn_eq_coeFn_toMeasure
theorem apply_mono (μ : FiniteMeasure Ω) {s₁ s₂ : Set Ω} (h : s₁ ⊆ s₂) : μ s₁ ≤ μ s₂ := by
change ((μ : Measure Ω) s₁).toNNReal ≤ ((μ : Measure Ω) s₂).toNNReal
have key : (μ : Measure Ω) s₁ ≤ (μ : Measure Ω) s₂ := (μ : Measure Ω).mono h
apply (ENNReal.toNNReal_le_toNNReal (measure_ne_top _ s₁) (measure_ne_top _ s₂)).mpr key
#align measure_theory.finite_measure.apply_mono MeasureTheory.FiniteMeasure.apply_mono
def mass (μ : FiniteMeasure Ω) : ℝ≥0 :=
μ univ
#align measure_theory.finite_measure.mass MeasureTheory.FiniteMeasure.mass
@[simp] theorem apply_le_mass (μ : FiniteMeasure Ω) (s : Set Ω) : μ s ≤ μ.mass := by
simpa using apply_mono μ (subset_univ s)
@[simp]
theorem ennreal_mass {μ : FiniteMeasure Ω} : (μ.mass : ℝ≥0∞) = (μ : Measure Ω) univ :=
ennreal_coeFn_eq_coeFn_toMeasure μ Set.univ
#align measure_theory.finite_measure.ennreal_mass MeasureTheory.FiniteMeasure.ennreal_mass
instance instZero : Zero (FiniteMeasure Ω) where zero := ⟨0, MeasureTheory.isFiniteMeasureZero⟩
#align measure_theory.finite_measure.has_zero MeasureTheory.FiniteMeasure.instZero
@[simp, norm_cast] lemma coeFn_zero : ⇑(0 : FiniteMeasure Ω) = 0 := rfl
#align measure_theory.finite_measure.coe_fn_zero MeasureTheory.FiniteMeasure.coeFn_zero
@[simp]
theorem zero_mass : (0 : FiniteMeasure Ω).mass = 0 :=
rfl
#align measure_theory.finite_measure.zero.mass MeasureTheory.FiniteMeasure.zero_mass
@[simp]
theorem mass_zero_iff (μ : FiniteMeasure Ω) : μ.mass = 0 ↔ μ = 0 := by
refine ⟨fun μ_mass => ?_, fun hμ => by simp only [hμ, zero_mass]⟩
apply toMeasure_injective
apply Measure.measure_univ_eq_zero.mp
rwa [← ennreal_mass, ENNReal.coe_eq_zero]
#align measure_theory.finite_measure.mass_zero_iff MeasureTheory.FiniteMeasure.mass_zero_iff
theorem mass_nonzero_iff (μ : FiniteMeasure Ω) : μ.mass ≠ 0 ↔ μ ≠ 0 := by
rw [not_iff_not]
exact FiniteMeasure.mass_zero_iff μ
#align measure_theory.finite_measure.mass_nonzero_iff MeasureTheory.FiniteMeasure.mass_nonzero_iff
@[ext]
| Mathlib/MeasureTheory/Measure/FiniteMeasure.lean | 213 | 217 | theorem eq_of_forall_toMeasure_apply_eq (μ ν : FiniteMeasure Ω)
(h : ∀ s : Set Ω, MeasurableSet s → (μ : Measure Ω) s = (ν : Measure Ω) s) : μ = ν := by |
apply Subtype.ext
ext1 s s_mble
exact h s s_mble
|
import Mathlib.Data.Int.Interval
import Mathlib.Data.Int.SuccPred
import Mathlib.Data.Int.ConditionallyCompleteOrder
import Mathlib.Topology.Instances.Discrete
import Mathlib.Topology.MetricSpace.Bounded
import Mathlib.Order.Filter.Archimedean
#align_import topology.instances.int from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open Metric Set Filter
namespace Int
instance : Dist ℤ :=
⟨fun x y => dist (x : ℝ) y⟩
theorem dist_eq (x y : ℤ) : dist x y = |(x : ℝ) - y| := rfl
#align int.dist_eq Int.dist_eq
theorem dist_eq' (m n : ℤ) : dist m n = |m - n| := by rw [dist_eq]; norm_cast
@[norm_cast, simp]
theorem dist_cast_real (x y : ℤ) : dist (x : ℝ) y = dist x y :=
rfl
#align int.dist_cast_real Int.dist_cast_real
| Mathlib/Topology/Instances/Int.lean | 41 | 43 | theorem pairwise_one_le_dist : Pairwise fun m n : ℤ => 1 ≤ dist m n := by |
intro m n hne
rw [dist_eq]; norm_cast; rwa [← zero_add (1 : ℤ), Int.add_one_le_iff, abs_pos, sub_ne_zero]
|
import Mathlib.CategoryTheory.Category.Cat
import Mathlib.CategoryTheory.Elements
#align_import category_theory.grothendieck from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
universe u
namespace CategoryTheory
variable {C D : Type*} [Category C] [Category D]
variable (F : C ⥤ Cat)
-- Porting note(#5171): no such linter yet
-- @[nolint has_nonempty_instance]
structure Grothendieck where
base : C
fiber : F.obj base
#align category_theory.grothendieck CategoryTheory.Grothendieck
namespace Grothendieck
variable {F}
structure Hom (X Y : Grothendieck F) where
base : X.base ⟶ Y.base
fiber : (F.map base).obj X.fiber ⟶ Y.fiber
#align category_theory.grothendieck.hom CategoryTheory.Grothendieck.Hom
@[ext]
theorem ext {X Y : Grothendieck F} (f g : Hom X Y) (w_base : f.base = g.base)
(w_fiber : eqToHom (by rw [w_base]) ≫ f.fiber = g.fiber) : f = g := by
cases f; cases g
congr
dsimp at w_base
aesop_cat
#align category_theory.grothendieck.ext CategoryTheory.Grothendieck.ext
@[simps]
def id (X : Grothendieck F) : Hom X X where
base := 𝟙 X.base
fiber := eqToHom (by erw [CategoryTheory.Functor.map_id, Functor.id_obj X.fiber])
#align category_theory.grothendieck.id CategoryTheory.Grothendieck.id
instance (X : Grothendieck F) : Inhabited (Hom X X) :=
⟨id X⟩
@[simps]
def comp {X Y Z : Grothendieck F} (f : Hom X Y) (g : Hom Y Z) : Hom X Z where
base := f.base ≫ g.base
fiber :=
eqToHom (by erw [Functor.map_comp, Functor.comp_obj]) ≫ (F.map g.base).map f.fiber ≫ g.fiber
#align category_theory.grothendieck.comp CategoryTheory.Grothendieck.comp
attribute [local simp] eqToHom_map
instance : Category (Grothendieck F) where
Hom X Y := Grothendieck.Hom X Y
id X := Grothendieck.id X
comp := @fun X Y Z f g => Grothendieck.comp f g
comp_id := @fun X Y f => by
dsimp; ext
· simp
· dsimp
rw [← NatIso.naturality_2 (eqToIso (F.map_id Y.base)) f.fiber]
simp
id_comp := @fun X Y f => by dsimp; ext <;> simp
assoc := @fun W X Y Z f g h => by
dsimp; ext
· simp
· dsimp
rw [← NatIso.naturality_2 (eqToIso (F.map_comp _ _)) f.fiber]
simp
@[simp]
theorem id_fiber' (X : Grothendieck F) :
Hom.fiber (𝟙 X) = eqToHom (by erw [CategoryTheory.Functor.map_id, Functor.id_obj X.fiber]) :=
id_fiber X
#align category_theory.grothendieck.id_fiber' CategoryTheory.Grothendieck.id_fiber'
| Mathlib/CategoryTheory/Grothendieck.lean | 132 | 136 | theorem congr {X Y : Grothendieck F} {f g : X ⟶ Y} (h : f = g) :
f.fiber = eqToHom (by subst h; rfl) ≫ g.fiber := by |
subst h
dsimp
simp
|
import Batteries.Tactic.Alias
import Batteries.Data.Nat.Basic
namespace Nat
@[simp] theorem recAux_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAux zero succ 0 = zero := rfl
theorem recAux_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAux zero succ (n+1) = succ n (Nat.recAux zero succ n) := rfl
@[simp] theorem recAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAuxOn 0 zero succ = zero := rfl
theorem recAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAuxOn (n+1) zero succ = succ n (Nat.recAuxOn n zero succ) := rfl
@[simp] theorem casesAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) :
Nat.casesAuxOn 0 zero succ = zero := rfl
theorem casesAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) (n) :
Nat.casesAuxOn (n+1) zero succ = succ n := rfl
theorem strongRec_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n)
(t : Nat) : Nat.strongRec ind t = ind t fun m _ => Nat.strongRec ind m := by
conv => lhs; unfold Nat.strongRec
theorem strongRecOn_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n)
(t : Nat) : Nat.strongRecOn t ind = ind t fun m _ => Nat.strongRecOn m ind :=
Nat.strongRec_eq ..
@[simp] theorem recDiagAux_zero_left {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) :
Nat.recDiagAux zero_left zero_right succ_succ 0 n = zero_left n := by cases n <;> rfl
@[simp] theorem recDiagAux_zero_right {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m)
(h : zero_left 0 = zero_right 0 := by first | assumption | trivial) :
Nat.recDiagAux zero_left zero_right succ_succ m 0 = zero_right m := by cases m; exact h; rfl
theorem recDiagAux_succ_succ {motive : Nat → Nat → Sort _}
(zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m n) :
Nat.recDiagAux zero_left zero_right succ_succ (m+1) (n+1)
= succ_succ m n (Nat.recDiagAux zero_left zero_right succ_succ m n) := rfl
@[simp] theorem recDiag_zero_zero {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0)
(zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) :
Nat.recDiag (motive:=motive) zero_zero zero_succ succ_zero succ_succ 0 0 = zero_zero := rfl
| .lake/packages/batteries/Batteries/Data/Nat/Lemmas.lean | 74 | 79 | theorem recDiag_zero_succ {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0)
(zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0)
(succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) :
Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 (n+1)
= zero_succ n (Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 n) := by |
simp [Nat.recDiag]; rfl
|
import Mathlib.MeasureTheory.Integral.Lebesgue
#align_import measure_theory.measure.giry_monad from "leanprover-community/mathlib"@"56f4cd1ef396e9fd389b5d8371ee9ad91d163625"
noncomputable section
open scoped Classical
open ENNReal
open scoped Classical
open Set Filter
variable {α β : Type*}
namespace MeasureTheory
namespace Measure
variable [MeasurableSpace α] [MeasurableSpace β]
instance instMeasurableSpace : MeasurableSpace (Measure α) :=
⨆ (s : Set α) (_ : MeasurableSet s), (borel ℝ≥0∞).comap fun μ => μ s
#align measure_theory.measure.measurable_space MeasureTheory.Measure.instMeasurableSpace
theorem measurable_coe {s : Set α} (hs : MeasurableSet s) : Measurable fun μ : Measure α => μ s :=
Measurable.of_comap_le <| le_iSup_of_le s <| le_iSup_of_le hs <| le_rfl
#align measure_theory.measure.measurable_coe MeasureTheory.Measure.measurable_coe
theorem measurable_of_measurable_coe (f : β → Measure α)
(h : ∀ (s : Set α), MeasurableSet s → Measurable fun b => f b s) : Measurable f :=
Measurable.of_le_map <|
iSup₂_le fun s hs =>
MeasurableSpace.comap_le_iff_le_map.2 <| by rw [MeasurableSpace.map_comp]; exact h s hs
#align measure_theory.measure.measurable_of_measurable_coe MeasureTheory.Measure.measurable_of_measurable_coe
instance instMeasurableAdd₂ {α : Type*} {m : MeasurableSpace α} : MeasurableAdd₂ (Measure α) := by
refine ⟨Measure.measurable_of_measurable_coe _ fun s hs => ?_⟩
simp_rw [Measure.coe_add, Pi.add_apply]
refine Measurable.add ?_ ?_
· exact (Measure.measurable_coe hs).comp measurable_fst
· exact (Measure.measurable_coe hs).comp measurable_snd
#align measure_theory.measure.has_measurable_add₂ MeasureTheory.Measure.instMeasurableAdd₂
theorem measurable_measure {μ : α → Measure β} :
Measurable μ ↔ ∀ (s : Set β), MeasurableSet s → Measurable fun b => μ b s :=
⟨fun hμ _s hs => (measurable_coe hs).comp hμ, measurable_of_measurable_coe μ⟩
#align measure_theory.measure.measurable_measure MeasureTheory.Measure.measurable_measure
theorem measurable_map (f : α → β) (hf : Measurable f) :
Measurable fun μ : Measure α => map f μ := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [map_apply hf hs]
exact measurable_coe (hf hs)
#align measure_theory.measure.measurable_map MeasureTheory.Measure.measurable_map
theorem measurable_dirac : Measurable (Measure.dirac : α → Measure α) := by
refine measurable_of_measurable_coe _ fun s hs => ?_
simp_rw [dirac_apply' _ hs]
exact measurable_one.indicator hs
#align measure_theory.measure.measurable_dirac MeasureTheory.Measure.measurable_dirac
theorem measurable_lintegral {f : α → ℝ≥0∞} (hf : Measurable f) :
Measurable fun μ : Measure α => ∫⁻ x, f x ∂μ := by
simp only [lintegral_eq_iSup_eapprox_lintegral, hf, SimpleFunc.lintegral]
refine measurable_iSup fun n => Finset.measurable_sum _ fun i _ => ?_
refine Measurable.const_mul ?_ _
exact measurable_coe ((SimpleFunc.eapprox f n).measurableSet_preimage _)
#align measure_theory.measure.measurable_lintegral MeasureTheory.Measure.measurable_lintegral
def join (m : Measure (Measure α)) : Measure α :=
Measure.ofMeasurable (fun s _ => ∫⁻ μ, μ s ∂m)
(by simp only [measure_empty, lintegral_const, zero_mul])
(by
intro f hf h
simp_rw [measure_iUnion h hf]
apply lintegral_tsum
intro i; exact (measurable_coe (hf i)).aemeasurable)
#align measure_theory.measure.join MeasureTheory.Measure.join
@[simp]
theorem join_apply {m : Measure (Measure α)} {s : Set α} (hs : MeasurableSet s) :
join m s = ∫⁻ μ, μ s ∂m :=
Measure.ofMeasurable_apply s hs
#align measure_theory.measure.join_apply MeasureTheory.Measure.join_apply
@[simp]
theorem join_zero : (0 : Measure (Measure α)).join = 0 := by
ext1 s hs
simp only [hs, join_apply, lintegral_zero_measure, coe_zero, Pi.zero_apply]
#align measure_theory.measure.join_zero MeasureTheory.Measure.join_zero
theorem measurable_join : Measurable (join : Measure (Measure α) → Measure α) :=
measurable_of_measurable_coe _ fun s hs => by
simp only [join_apply hs]; exact measurable_lintegral (measurable_coe hs)
#align measure_theory.measure.measurable_join MeasureTheory.Measure.measurable_join
| Mathlib/MeasureTheory/Measure/GiryMonad.lean | 128 | 149 | theorem lintegral_join {m : Measure (Measure α)} {f : α → ℝ≥0∞} (hf : Measurable f) :
∫⁻ x, f x ∂join m = ∫⁻ μ, ∫⁻ x, f x ∂μ ∂m := by |
simp_rw [lintegral_eq_iSup_eapprox_lintegral hf, SimpleFunc.lintegral,
join_apply (SimpleFunc.measurableSet_preimage _ _)]
suffices
∀ (s : ℕ → Finset ℝ≥0∞) (f : ℕ → ℝ≥0∞ → Measure α → ℝ≥0∞), (∀ n r, Measurable (f n r)) →
Monotone (fun n μ => ∑ r ∈ s n, r * f n r μ) →
⨆ n, ∑ r ∈ s n, r * ∫⁻ μ, f n r μ ∂m = ∫⁻ μ, ⨆ n, ∑ r ∈ s n, r * f n r μ ∂m by
refine
this (fun n => SimpleFunc.range (SimpleFunc.eapprox f n))
(fun n r μ => μ (SimpleFunc.eapprox f n ⁻¹' {r})) ?_ ?_
· exact fun n r => measurable_coe (SimpleFunc.measurableSet_preimage _ _)
· exact fun n m h μ => SimpleFunc.lintegral_mono (SimpleFunc.monotone_eapprox _ h) le_rfl
intro s f hf hm
rw [lintegral_iSup _ hm]
swap
· exact fun n => Finset.measurable_sum _ fun r _ => (hf _ _).const_mul _
congr
funext n
rw [lintegral_finset_sum (s n)]
· simp_rw [lintegral_const_mul _ (hf _ _)]
· exact fun r _ => (hf _ _).const_mul _
|
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.Deriv.Linear
import Mathlib.Analysis.Complex.Conformal
import Mathlib.Analysis.Calculus.Conformal.NormedSpace
#align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
section RealDerivOfComplex
open Complex
variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ}
theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) :
HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by
have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt
have B :
HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ)
(ofRealCLM z) :=
h.hasStrictFDerivAt.restrictScalars ℝ
have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt
-- Porting note: this should be by:
-- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt
-- but for some reason simp can not use `ContinuousLinearMap.comp_apply`
convert (C.comp z (B.comp z A)).hasStrictDerivAt
rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply]
simp
#align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex
theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) :
HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by
have A : HasFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasFDerivAt
have B :
HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ)
(ofRealCLM z) :=
h.hasFDerivAt.restrictScalars ℝ
have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt
-- Porting note: this should be by:
-- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt
-- but for some reason simp can not use `ContinuousLinearMap.comp_apply`
convert (C.comp z (B.comp z A)).hasDerivAt
rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply]
simp
#align has_deriv_at.real_of_complex HasDerivAt.real_of_complex
theorem ContDiffAt.real_of_complex {n : ℕ∞} (h : ContDiffAt ℂ n e z) :
ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by
have A : ContDiffAt ℝ n ((↑) : ℝ → ℂ) z := ofRealCLM.contDiff.contDiffAt
have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ
have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt
exact C.comp z (B.comp z A)
#align cont_diff_at.real_of_complex ContDiffAt.real_of_complex
theorem ContDiff.real_of_complex {n : ℕ∞} (h : ContDiff ℂ n e) :
ContDiff ℝ n fun x : ℝ => (e x).re :=
contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex
#align cont_diff.real_of_complex ContDiff.real_of_complex
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]
theorem HasStrictDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E}
(h : HasStrictDerivAt f f' x) :
HasStrictFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by
simpa only [Complex.restrictScalars_one_smulRight'] using
h.hasStrictFDerivAt.restrictScalars ℝ
#align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv'
theorem HasDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasDerivAt f f' x) :
HasFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by
simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ
#align has_deriv_at.complex_to_real_fderiv' HasDerivAt.complexToReal_fderiv'
theorem HasDerivWithinAt.complexToReal_fderiv' {f : ℂ → E} {s : Set ℂ} {x : ℂ} {f' : E}
(h : HasDerivWithinAt f f' s x) :
HasFDerivWithinAt f (reCLM.smulRight f' + I • imCLM.smulRight f') s x := by
simpa only [Complex.restrictScalars_one_smulRight'] using
h.hasFDerivWithinAt.restrictScalars ℝ
#align has_deriv_within_at.complex_to_real_fderiv' HasDerivWithinAt.complexToReal_fderiv'
| Mathlib/Analysis/Complex/RealDeriv.lean | 118 | 120 | theorem HasStrictDerivAt.complexToReal_fderiv {f : ℂ → ℂ} {f' x : ℂ} (h : HasStrictDerivAt f f' x) :
HasStrictFDerivAt f (f' • (1 : ℂ →L[ℝ] ℂ)) x := by |
simpa only [Complex.restrictScalars_one_smulRight] using h.hasStrictFDerivAt.restrictScalars ℝ
|
import Mathlib.LinearAlgebra.Quotient
import Mathlib.RingTheory.Ideal.Operations
namespace Submodule
open Pointwise
variable {R M M' F G : Type*} [CommRing R] [AddCommGroup M] [Module R M]
variable {N N₁ N₂ P P₁ P₂ : Submodule R M}
def colon (N P : Submodule R M) : Ideal R :=
annihilator (P.map N.mkQ)
#align submodule.colon Submodule.colon
theorem mem_colon {r} : r ∈ N.colon P ↔ ∀ p ∈ P, r • p ∈ N :=
mem_annihilator.trans
⟨fun H p hp => (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
fun H _ ⟨p, hp, hpm⟩ => hpm ▸ ((Quotient.mk_eq_zero N).2 <| H p hp)⟩
#align submodule.mem_colon Submodule.mem_colon
theorem mem_colon' {r} : r ∈ N.colon P ↔ P ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) N :=
mem_colon
#align submodule.mem_colon' Submodule.mem_colon'
@[simp]
theorem colon_top {I : Ideal R} : I.colon ⊤ = I := by
simp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]
exact fun x ↦ ⟨fun h ↦ mul_one x ▸ h 1 trivial, fun h _ _ ↦ I.mul_mem_right _ h⟩
@[simp]
theorem colon_bot : colon ⊥ N = N.annihilator := by
simp_rw [SetLike.ext_iff, mem_colon, mem_annihilator, mem_bot, forall_const]
theorem colon_mono (hn : N₁ ≤ N₂) (hp : P₁ ≤ P₂) : N₁.colon P₂ ≤ N₂.colon P₁ := fun _ hrnp =>
mem_colon.2 fun p₁ hp₁ => hn <| mem_colon.1 hrnp p₁ <| hp hp₁
#align submodule.colon_mono Submodule.colon_mono
theorem iInf_colon_iSup (ι₁ : Sort*) (f : ι₁ → Submodule R M) (ι₂ : Sort*)
(g : ι₂ → Submodule R M) : (⨅ i, f i).colon (⨆ j, g j) = ⨅ (i) (j), (f i).colon (g j) :=
le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
mem_colon'.2 <|
iSup_le fun j =>
map_le_iff_le_comap.1 <|
le_iInf fun i =>
map_le_iff_le_comap.2 <|
mem_colon'.1 <|
have := (mem_iInf _).1 H i
have := (mem_iInf _).1 this j
this
#align submodule.infi_colon_supr Submodule.iInf_colon_iSup
@[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
r ∈ N.colon (Submodule.span R {x}) ↔ r • x ∈ N :=
calc
r ∈ N.colon (Submodule.span R {x}) ↔ ∀ a : R, r • a • x ∈ N := by
simp [Submodule.mem_colon, Submodule.mem_span_singleton]
_ ↔ r • x ∈ N := by simp_rw [fun (a : R) ↦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
#align submodule.mem_colon_singleton Submodule.mem_colon_singleton
@[simp]
| Mathlib/RingTheory/Ideal/Colon.lean | 76 | 78 | theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
r ∈ I.colon (Ideal.span {x}) ↔ r * x ∈ I := by |
simp only [← Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
|
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset
import Mathlib.Data.Finite.Card
import Mathlib.GroupTheory.Finiteness
import Mathlib.GroupTheory.GroupAction.Quotient
#align_import group_theory.index from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
namespace Subgroup
open Cardinal
variable {G : Type*} [Group G] (H K L : Subgroup G)
@[to_additive "The index of a subgroup as a natural number,
and returns 0 if the index is infinite."]
noncomputable def index : ℕ :=
Nat.card (G ⧸ H)
#align subgroup.index Subgroup.index
#align add_subgroup.index AddSubgroup.index
@[to_additive "The relative index of a subgroup as a natural number,
and returns 0 if the relative index is infinite."]
noncomputable def relindex : ℕ :=
(H.subgroupOf K).index
#align subgroup.relindex Subgroup.relindex
#align add_subgroup.relindex AddSubgroup.relindex
@[to_additive]
theorem index_comap_of_surjective {G' : Type*} [Group G'] {f : G' →* G}
(hf : Function.Surjective f) : (H.comap f).index = H.index := by
letI := QuotientGroup.leftRel H
letI := QuotientGroup.leftRel (H.comap f)
have key : ∀ x y : G', Setoid.r x y ↔ Setoid.r (f x) (f y) := by
simp only [QuotientGroup.leftRel_apply]
exact fun x y => iff_of_eq (congr_arg (· ∈ H) (by rw [f.map_mul, f.map_inv]))
refine Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨?_, ?_⟩)
· simp_rw [← Quotient.eq''] at key
refine Quotient.ind' fun x => ?_
refine Quotient.ind' fun y => ?_
exact (key x y).mpr
· refine Quotient.ind' fun x => ?_
obtain ⟨y, hy⟩ := hf x
exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩
#align subgroup.index_comap_of_surjective Subgroup.index_comap_of_surjective
#align add_subgroup.index_comap_of_surjective AddSubgroup.index_comap_of_surjective
@[to_additive]
theorem index_comap {G' : Type*} [Group G'] (f : G' →* G) :
(H.comap f).index = H.relindex f.range :=
Eq.trans (congr_arg index (by rfl))
((H.subgroupOf f.range).index_comap_of_surjective f.rangeRestrict_surjective)
#align subgroup.index_comap Subgroup.index_comap
#align add_subgroup.index_comap AddSubgroup.index_comap
@[to_additive]
theorem relindex_comap {G' : Type*} [Group G'] (f : G' →* G) (K : Subgroup G') :
relindex (comap f H) K = relindex H (map f K) := by
rw [relindex, subgroupOf, comap_comap, index_comap, ← f.map_range, K.subtype_range]
#align subgroup.relindex_comap Subgroup.relindex_comap
#align add_subgroup.relindex_comap AddSubgroup.relindex_comap
variable {H K L}
@[to_additive relindex_mul_index]
theorem relindex_mul_index (h : H ≤ K) : H.relindex K * K.index = H.index :=
((mul_comm _ _).trans (Cardinal.toNat_mul _ _).symm).trans
(congr_arg Cardinal.toNat (Equiv.cardinal_eq (quotientEquivProdOfLE h))).symm
#align subgroup.relindex_mul_index Subgroup.relindex_mul_index
#align add_subgroup.relindex_mul_index AddSubgroup.relindex_mul_index
@[to_additive]
theorem index_dvd_of_le (h : H ≤ K) : K.index ∣ H.index :=
dvd_of_mul_left_eq (H.relindex K) (relindex_mul_index h)
#align subgroup.index_dvd_of_le Subgroup.index_dvd_of_le
#align add_subgroup.index_dvd_of_le AddSubgroup.index_dvd_of_le
@[to_additive]
theorem relindex_dvd_index_of_le (h : H ≤ K) : H.relindex K ∣ H.index :=
dvd_of_mul_right_eq K.index (relindex_mul_index h)
#align subgroup.relindex_dvd_index_of_le Subgroup.relindex_dvd_index_of_le
#align add_subgroup.relindex_dvd_index_of_le AddSubgroup.relindex_dvd_index_of_le
@[to_additive]
theorem relindex_subgroupOf (hKL : K ≤ L) :
(H.subgroupOf L).relindex (K.subgroupOf L) = H.relindex K :=
((index_comap (H.subgroupOf L) (inclusion hKL)).trans (congr_arg _ (inclusion_range hKL))).symm
#align subgroup.relindex_subgroup_of Subgroup.relindex_subgroupOf
#align add_subgroup.relindex_add_subgroup_of AddSubgroup.relindex_addSubgroupOf
variable (H K L)
@[to_additive relindex_mul_relindex]
theorem relindex_mul_relindex (hHK : H ≤ K) (hKL : K ≤ L) :
H.relindex K * K.relindex L = H.relindex L := by
rw [← relindex_subgroupOf hKL]
exact relindex_mul_index fun x hx => hHK hx
#align subgroup.relindex_mul_relindex Subgroup.relindex_mul_relindex
#align add_subgroup.relindex_mul_relindex AddSubgroup.relindex_mul_relindex
@[to_additive]
theorem inf_relindex_right : (H ⊓ K).relindex K = H.relindex K := by
rw [relindex, relindex, inf_subgroupOf_right]
#align subgroup.inf_relindex_right Subgroup.inf_relindex_right
#align add_subgroup.inf_relindex_right AddSubgroup.inf_relindex_right
@[to_additive]
| Mathlib/GroupTheory/Index.lean | 140 | 141 | theorem inf_relindex_left : (H ⊓ K).relindex H = K.relindex H := by |
rw [inf_comm, inf_relindex_right]
|
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.ContinuousFunction.CocompactMap
open Filter Metric
variable {𝕜 E F 𝓕 : Type*}
variable [NormedAddCommGroup E] [NormedAddCommGroup F] [ProperSpace E] [ProperSpace F]
variable {f : 𝓕}
| Mathlib/Analysis/Normed/Group/CocompactMap.lean | 29 | 39 | theorem CocompactMapClass.norm_le [FunLike 𝓕 E F] [CocompactMapClass 𝓕 E F] (ε : ℝ) :
∃ r : ℝ, ∀ x : E, r < ‖x‖ → ε < ‖f x‖ := by |
have h := cocompact_tendsto f
rw [tendsto_def] at h
specialize h (Metric.closedBall 0 ε)ᶜ (mem_cocompact_of_closedBall_compl_subset 0 ⟨ε, rfl.subset⟩)
rcases closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩
use r
intro x hx
suffices x ∈ f⁻¹' (Metric.closedBall 0 ε)ᶜ by aesop
apply hr
simp [hx]
|
import Mathlib.Data.Fintype.Card
import Mathlib.Order.UpperLower.Basic
#align_import combinatorics.set_family.intersecting from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46"
open Finset
variable {α : Type*}
namespace Set
section SemilatticeInf
variable [SemilatticeInf α] [OrderBot α] {s t : Set α} {a b c : α}
def Intersecting (s : Set α) : Prop :=
∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → ¬Disjoint a b
#align set.intersecting Set.Intersecting
@[mono]
theorem Intersecting.mono (h : t ⊆ s) (hs : s.Intersecting) : t.Intersecting := fun _a ha _b hb =>
hs (h ha) (h hb)
#align set.intersecting.mono Set.Intersecting.mono
theorem Intersecting.not_bot_mem (hs : s.Intersecting) : ⊥ ∉ s := fun h => hs h h disjoint_bot_left
#align set.intersecting.not_bot_mem Set.Intersecting.not_bot_mem
theorem Intersecting.ne_bot (hs : s.Intersecting) (ha : a ∈ s) : a ≠ ⊥ :=
ne_of_mem_of_not_mem ha hs.not_bot_mem
#align set.intersecting.ne_bot Set.Intersecting.ne_bot
theorem intersecting_empty : (∅ : Set α).Intersecting := fun _ => False.elim
#align set.intersecting_empty Set.intersecting_empty
@[simp]
| Mathlib/Combinatorics/SetFamily/Intersecting.lean | 61 | 61 | theorem intersecting_singleton : ({a} : Set α).Intersecting ↔ a ≠ ⊥ := by | simp [Intersecting]
|
import Mathlib.Data.Finset.Lattice
import Mathlib.Data.Fintype.Vector
import Mathlib.Data.Multiset.Sym
#align_import data.finset.sym from "leanprover-community/mathlib"@"02ba8949f486ebecf93fe7460f1ed0564b5e442c"
namespace Finset
variable {α : Type*}
@[simps]
protected def sym2 (s : Finset α) : Finset (Sym2 α) := ⟨s.1.sym2, s.2.sym2⟩
#align finset.sym2 Finset.sym2
section
variable {s t : Finset α} {a b : α}
theorem mk_mem_sym2_iff : s(a, b) ∈ s.sym2 ↔ a ∈ s ∧ b ∈ s := by
rw [mem_mk, sym2_val, Multiset.mk_mem_sym2_iff, mem_mk, mem_mk]
#align finset.mk_mem_sym2_iff Finset.mk_mem_sym2_iff
@[simp]
theorem mem_sym2_iff {m : Sym2 α} : m ∈ s.sym2 ↔ ∀ a ∈ m, a ∈ s := by
rw [mem_mk, sym2_val, Multiset.mem_sym2_iff]
simp only [mem_val]
#align finset.mem_sym2_iff Finset.mem_sym2_iff
instance _root_.Sym2.instFintype [Fintype α] : Fintype (Sym2 α) where
elems := Finset.univ.sym2
complete := fun x ↦ by rw [mem_sym2_iff]; exact (fun a _ ↦ mem_univ a)
-- Note(kmill): Using a default argument to make this simp lemma more general.
@[simp]
theorem sym2_univ [Fintype α] (inst : Fintype (Sym2 α) := Sym2.instFintype) :
(univ : Finset α).sym2 = univ := by
ext
simp only [mem_sym2_iff, mem_univ, implies_true]
#align finset.sym2_univ Finset.sym2_univ
@[simp, mono]
theorem sym2_mono (h : s ⊆ t) : s.sym2 ⊆ t.sym2 := by
rw [← val_le_iff, sym2_val, sym2_val]
apply Multiset.sym2_mono
rwa [val_le_iff]
#align finset.sym2_mono Finset.sym2_mono
theorem monotone_sym2 : Monotone (Finset.sym2 : Finset α → _) := fun _ _ => sym2_mono
theorem injective_sym2 : Function.Injective (Finset.sym2 : Finset α → _) := by
intro s t h
ext x
simpa using congr(s(x, x) ∈ $h)
theorem strictMono_sym2 : StrictMono (Finset.sym2 : Finset α → _) :=
monotone_sym2.strictMono_of_injective injective_sym2
theorem sym2_toFinset [DecidableEq α] (m : Multiset α) :
m.toFinset.sym2 = m.sym2.toFinset := by
ext z
refine z.ind fun x y ↦ ?_
simp only [mk_mem_sym2_iff, Multiset.mem_toFinset, Multiset.mk_mem_sym2_iff]
@[simp]
theorem sym2_empty : (∅ : Finset α).sym2 = ∅ := rfl
#align finset.sym2_empty Finset.sym2_empty
@[simp]
theorem sym2_eq_empty : s.sym2 = ∅ ↔ s = ∅ := by
rw [← val_eq_zero, sym2_val, Multiset.sym2_eq_zero_iff, val_eq_zero]
#align finset.sym2_eq_empty Finset.sym2_eq_empty
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem sym2_nonempty : s.sym2.Nonempty ↔ s.Nonempty := by
rw [← not_iff_not]
simp_rw [not_nonempty_iff_eq_empty, sym2_eq_empty]
#align finset.sym2_nonempty Finset.sym2_nonempty
protected alias ⟨_, Nonempty.sym2⟩ := sym2_nonempty
#align finset.nonempty.sym2 Finset.Nonempty.sym2
@[simp]
theorem sym2_singleton (a : α) : ({a} : Finset α).sym2 = {Sym2.diag a} := rfl
#align finset.sym2_singleton Finset.sym2_singleton
theorem card_sym2 (s : Finset α) : s.sym2.card = Nat.choose (s.card + 1) 2 := by
rw [card_def, sym2_val, Multiset.card_sym2, ← card_def]
#align finset.card_sym2 Finset.card_sym2
end
variable [DecidableEq α] {s t : Finset α} {a b : α}
theorem sym2_eq_image : s.sym2 = (s ×ˢ s).image Sym2.mk := by
ext z
refine z.ind fun x y ↦ ?_
rw [mk_mem_sym2_iff, mem_image]
constructor
· intro h
use (x, y)
simp only [mem_product, h, and_self, true_and]
· rintro ⟨⟨a, b⟩, h⟩
simp only [mem_product, Sym2.eq_iff] at h
obtain ⟨h, (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩)⟩ := h
<;> simp [h]
theorem isDiag_mk_of_mem_diag {a : α × α} (h : a ∈ s.diag) : (Sym2.mk a).IsDiag :=
(Sym2.isDiag_iff_proj_eq _).2 (mem_diag.1 h).2
#align finset.is_diag_mk_of_mem_diag Finset.isDiag_mk_of_mem_diag
theorem not_isDiag_mk_of_mem_offDiag {a : α × α} (h : a ∈ s.offDiag) :
¬ (Sym2.mk a).IsDiag := by
rw [Sym2.isDiag_iff_proj_eq]
exact (mem_offDiag.1 h).2.2
#align finset.not_is_diag_mk_of_mem_off_diag Finset.not_isDiag_mk_of_mem_offDiag
section Sym2
variable {m : Sym2 α}
-- Porting note: add this lemma and remove simp in the next lemma since simpNF lint
-- warns that its LHS is not in normal form
@[simp]
| Mathlib/Data/Finset/Sym.lean | 152 | 154 | theorem diag_mem_sym2_mem_iff : (∀ b, b ∈ Sym2.diag a → b ∈ s) ↔ a ∈ s := by |
rw [← mem_sym2_iff]
exact mk_mem_sym2_iff.trans <| and_self_iff
|
import Mathlib.Data.PFunctor.Multivariate.Basic
#align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe u
open MvFunctor
class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where
P : MvPFunctor.{u} n
abs : ∀ {α}, P α → F α
repr : ∀ {α}, F α → P α
abs_repr : ∀ {α} (x : F α), abs (repr x) = x
abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p
#align mvqpf MvQPF
namespace MvQPF
variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F]
open MvFunctor (LiftP LiftR)
protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map]
rfl
#align mvqpf.id_map MvQPF.id_map
@[simp]
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) (x : F α) :
(g ⊚ f) <$$> x = g <$$> f <$$> x := by
rw [← abs_repr x]
cases' repr x with a f
rw [← abs_map, ← abs_map, ← abs_map]
rfl
#align mvqpf.comp_map MvQPF.comp_map
instance (priority := 100) lawfulMvFunctor : LawfulMvFunctor F where
id_map := @MvQPF.id_map n F _ _
comp_map := @comp_map n F _ _
#align mvqpf.is_lawful_mvfunctor MvQPF.lawfulMvFunctor
-- Lifting predicates and relations
theorem liftP_iff {α : TypeVec n} (p : ∀ ⦃i⦄, α i → Prop) (x : F α) :
LiftP p x ↔ ∃ a f, x = abs ⟨a, f⟩ ∧ ∀ i j, p (f i j) := by
constructor
· rintro ⟨y, hy⟩
cases' h : repr y with a f
use a, fun i j => (f i j).val
constructor
· rw [← hy, ← abs_repr y, h, ← abs_map]; rfl
intro i j
apply (f i j).property
rintro ⟨a, f, h₀, h₁⟩
use abs ⟨a, fun i j => ⟨f i j, h₁ i j⟩⟩
rw [← abs_map, h₀]; rfl
#align mvqpf.liftp_iff MvQPF.liftP_iff
| Mathlib/Data/QPF/Multivariate/Basic.lean | 141 | 157 | theorem liftR_iff {α : TypeVec n} (r : ∀ /- ⦃i⦄ -/ {i}, α i → α i → Prop) (x y : F α) :
LiftR r x y ↔ ∃ a f₀ f₁, x = abs ⟨a, f₀⟩ ∧ y = abs ⟨a, f₁⟩ ∧ ∀ i j, r (f₀ i j) (f₁ i j) := by |
constructor
· rintro ⟨u, xeq, yeq⟩
cases' h : repr u with a f
use a, fun i j => (f i j).val.fst, fun i j => (f i j).val.snd
constructor
· rw [← xeq, ← abs_repr u, h, ← abs_map]; rfl
constructor
· rw [← yeq, ← abs_repr u, h, ← abs_map]; rfl
intro i j
exact (f i j).property
rintro ⟨a, f₀, f₁, xeq, yeq, h⟩
use abs ⟨a, fun i j => ⟨(f₀ i j, f₁ i j), h i j⟩⟩
dsimp; constructor
· rw [xeq, ← abs_map]; rfl
rw [yeq, ← abs_map]; rfl
|
import Mathlib.Analysis.NormedSpace.Basic
#align_import analysis.normed_space.enorm from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2"
noncomputable section
attribute [local instance] Classical.propDecidable
open ENNReal
structure ENorm (𝕜 : Type*) (V : Type*) [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] where
toFun : V → ℝ≥0∞
eq_zero' : ∀ x, toFun x = 0 → x = 0
map_add_le' : ∀ x y : V, toFun (x + y) ≤ toFun x + toFun y
map_smul_le' : ∀ (c : 𝕜) (x : V), toFun (c • x) ≤ ‖c‖₊ * toFun x
#align enorm ENorm
namespace ENorm
variable {𝕜 : Type*} {V : Type*} [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] (e : ENorm 𝕜 V)
-- Porting note: added to appease norm_cast complaints
attribute [coe] ENorm.toFun
instance : CoeFun (ENorm 𝕜 V) fun _ => V → ℝ≥0∞ :=
⟨ENorm.toFun⟩
theorem coeFn_injective : Function.Injective ((↑) : ENorm 𝕜 V → V → ℝ≥0∞) := fun e₁ e₂ h => by
cases e₁
cases e₂
congr
#align enorm.coe_fn_injective ENorm.coeFn_injective
@[ext]
theorem ext {e₁ e₂ : ENorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂ :=
coeFn_injective <| funext h
#align enorm.ext ENorm.ext
theorem ext_iff {e₁ e₂ : ENorm 𝕜 V} : e₁ = e₂ ↔ ∀ x, e₁ x = e₂ x :=
⟨fun h _ => h ▸ rfl, ext⟩
#align enorm.ext_iff ENorm.ext_iff
@[simp, norm_cast]
theorem coe_inj {e₁ e₂ : ENorm 𝕜 V} : (e₁ : V → ℝ≥0∞) = e₂ ↔ e₁ = e₂ :=
coeFn_injective.eq_iff
#align enorm.coe_inj ENorm.coe_inj
@[simp]
| Mathlib/Analysis/NormedSpace/ENorm.lean | 82 | 92 | theorem map_smul (c : 𝕜) (x : V) : e (c • x) = ‖c‖₊ * e x := by |
apply le_antisymm (e.map_smul_le' c x)
by_cases hc : c = 0
· simp [hc]
calc
(‖c‖₊ : ℝ≥0∞) * e x = ‖c‖₊ * e (c⁻¹ • c • x) := by rw [inv_smul_smul₀ hc]
_ ≤ ‖c‖₊ * (‖c⁻¹‖₊ * e (c • x)) := mul_le_mul_left' (e.map_smul_le' _ _) _
_ = e (c • x) := by
rw [← mul_assoc, nnnorm_inv, ENNReal.coe_inv, ENNReal.mul_inv_cancel _ ENNReal.coe_ne_top,
one_mul]
<;> simp [hc]
|
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Mul
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
#align_import analysis.mean_inequalities_pow from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f"
universe u v
open Finset
open scoped Classical
open NNReal ENNReal
noncomputable section
variable {ι : Type u} (s : Finset ι)
namespace Real
theorem pow_arith_mean_le_arith_mean_pow (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) (n : ℕ) :
(∑ i ∈ s, w i * z i) ^ n ≤ ∑ i ∈ s, w i * z i ^ n :=
(convexOn_pow n).map_sum_le hw hw' hz
#align real.pow_arith_mean_le_arith_mean_pow Real.pow_arith_mean_le_arith_mean_pow
theorem pow_arith_mean_le_arith_mean_pow_of_even (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1) {n : ℕ} (hn : Even n) :
(∑ i ∈ s, w i * z i) ^ n ≤ ∑ i ∈ s, w i * z i ^ n :=
hn.convexOn_pow.map_sum_le hw hw' fun _ _ => Set.mem_univ _
#align real.pow_arith_mean_le_arith_mean_pow_of_even Real.pow_arith_mean_le_arith_mean_pow_of_even
theorem pow_sum_div_card_le_sum_pow {f : ι → ℝ} (n : ℕ) (hf : ∀ a ∈ s, 0 ≤ f a) :
(∑ x ∈ s, f x) ^ (n + 1) / (s.card : ℝ) ^ n ≤ ∑ x ∈ s, f x ^ (n + 1) := by
rcases s.eq_empty_or_nonempty with (rfl | hs)
· simp_rw [Finset.sum_empty, zero_pow n.succ_ne_zero, zero_div]; rfl
· have hs0 : 0 < (s.card : ℝ) := Nat.cast_pos.2 hs.card_pos
suffices (∑ x ∈ s, f x / s.card) ^ (n + 1) ≤ ∑ x ∈ s, f x ^ (n + 1) / s.card by
rwa [← Finset.sum_div, ← Finset.sum_div, div_pow, pow_succ (s.card : ℝ), ← div_div,
div_le_iff hs0, div_mul, div_self hs0.ne', div_one] at this
have :=
@ConvexOn.map_sum_le ℝ ℝ ℝ ι _ _ _ _ _ _ (Set.Ici 0) (fun x => x ^ (n + 1)) s
(fun _ => 1 / s.card) ((↑) ∘ f) (convexOn_pow (n + 1)) ?_ ?_ fun i hi =>
Set.mem_Ici.2 (hf i hi)
· simpa only [inv_mul_eq_div, one_div, Algebra.id.smul_eq_mul] using this
· simp only [one_div, inv_nonneg, Nat.cast_nonneg, imp_true_iff]
· simpa only [one_div, Finset.sum_const, nsmul_eq_mul] using mul_inv_cancel hs0.ne'
#align real.pow_sum_div_card_le_sum_pow Real.pow_sum_div_card_le_sum_pow
theorem zpow_arith_mean_le_arith_mean_zpow (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 < z i) (m : ℤ) :
(∑ i ∈ s, w i * z i) ^ m ≤ ∑ i ∈ s, w i * z i ^ m :=
(convexOn_zpow m).map_sum_le hw hw' hz
#align real.zpow_arith_mean_le_arith_mean_zpow Real.zpow_arith_mean_le_arith_mean_zpow
theorem rpow_arith_mean_le_arith_mean_rpow (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i)
(hw' : ∑ i ∈ s, w i = 1) (hz : ∀ i ∈ s, 0 ≤ z i) {p : ℝ} (hp : 1 ≤ p) :
(∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p :=
(convexOn_rpow hp).map_sum_le hw hw' hz
#align real.rpow_arith_mean_le_arith_mean_rpow Real.rpow_arith_mean_le_arith_mean_rpow
| Mathlib/Analysis/MeanInequalitiesPow.lean | 101 | 110 | theorem arith_mean_le_rpow_mean (w z : ι → ℝ) (hw : ∀ i ∈ s, 0 ≤ w i) (hw' : ∑ i ∈ s, w i = 1)
(hz : ∀ i ∈ s, 0 ≤ z i) {p : ℝ} (hp : 1 ≤ p) :
∑ i ∈ s, w i * z i ≤ (∑ i ∈ s, w i * z i ^ p) ^ (1 / p) := by |
have : 0 < p := by positivity
rw [← rpow_le_rpow_iff _ _ this, ← rpow_mul, one_div_mul_cancel (ne_of_gt this), rpow_one]
· exact rpow_arith_mean_le_arith_mean_rpow s w z hw hw' hz hp
all_goals
apply_rules [sum_nonneg, rpow_nonneg]
intro i hi
apply_rules [mul_nonneg, rpow_nonneg, hw i hi, hz i hi]
|
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]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
coherence
#align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id
@[reassoc]
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 57 | 60 | theorem pentagon_inv_inv_hom (W X Y Z : C) :
(α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom =
(𝟙 W ⊗ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by |
coherence
|
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
| Mathlib/Data/List/Duplicate.lean | 70 | 73 | 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]
|
import Mathlib.Analysis.SpecialFunctions.Integrals
import Mathlib.MeasureTheory.Integral.Layercake
#align_import measure_theory.integral.layercake from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b"
open Set
namespace MeasureTheory
variable {α : Type*} [MeasurableSpace α] {f : α → ℝ} (μ : Measure α) (f_nn : 0 ≤ᵐ[μ] f)
(f_mble : AEMeasurable f μ) {p : ℝ} (p_pos : 0 < p)
section Layercake
| Mathlib/Analysis/SpecialFunctions/Pow/Integral.lean | 50 | 72 | theorem lintegral_rpow_eq_lintegral_meas_le_mul :
∫⁻ ω, ENNReal.ofReal (f ω ^ p) ∂μ =
ENNReal.ofReal p * ∫⁻ t in Ioi 0, μ {a : α | t ≤ f a} * ENNReal.ofReal (t ^ (p - 1)) := by |
have one_lt_p : -1 < p - 1 := by linarith
have obs : ∀ x : ℝ, ∫ t : ℝ in (0)..x, t ^ (p - 1) = x ^ p / p := by
intro x
rw [integral_rpow (Or.inl one_lt_p)]
simp [Real.zero_rpow p_pos.ne.symm]
set g := fun t : ℝ => t ^ (p - 1)
have g_nn : ∀ᵐ t ∂volume.restrict (Ioi (0 : ℝ)), 0 ≤ g t := by
filter_upwards [self_mem_ae_restrict (measurableSet_Ioi : MeasurableSet (Ioi (0 : ℝ)))]
intro t t_pos
exact Real.rpow_nonneg (mem_Ioi.mp t_pos).le (p - 1)
have g_intble : ∀ t > 0, IntervalIntegrable g volume 0 t := fun _ _ =>
intervalIntegral.intervalIntegrable_rpow' one_lt_p
have key := lintegral_comp_eq_lintegral_meas_le_mul μ f_nn f_mble g_intble g_nn
rw [← key, ← lintegral_const_mul'' (ENNReal.ofReal p)] <;> simp_rw [obs]
· congr with ω
rw [← ENNReal.ofReal_mul p_pos.le, mul_div_cancel₀ (f ω ^ p) p_pos.ne.symm]
· have aux := (@measurable_const ℝ α (by infer_instance) (by infer_instance) p).aemeasurable
(μ := μ)
exact (Measurable.ennreal_ofReal (hf := measurable_id)).comp_aemeasurable
((f_mble.pow aux).div_const p)
|
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.RingTheory.Ideal.Quotient
#align_import linear_algebra.smodeq from "leanprover-community/mathlib"@"146d3d1fa59c091fedaad8a4afa09d6802886d24"
open Submodule
open Polynomial
variable {R : Type*} [Ring R]
variable {A : Type*} [CommRing A]
variable {M : Type*} [AddCommGroup M] [Module R M] (U U₁ U₂ : Submodule R M)
variable {x x₁ x₂ y y₁ y₂ z z₁ z₂ : M}
variable {N : Type*} [AddCommGroup N] [Module R N] (V V₁ V₂ : Submodule R N)
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
def SModEq (x y : M) : Prop :=
(Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y
#align smodeq SModEq
notation:50 x " ≡ " y " [SMOD " N "]" => SModEq N x y
variable {U U₁ U₂}
set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534
protected theorem SModEq.def :
x ≡ y [SMOD U] ↔ (Submodule.Quotient.mk x : M ⧸ U) = Submodule.Quotient.mk y :=
Iff.rfl
#align smodeq.def SModEq.def
namespace SModEq
| Mathlib/LinearAlgebra/SModEq.lean | 44 | 44 | theorem sub_mem : x ≡ y [SMOD U] ↔ x - y ∈ U := by | rw [SModEq.def, Submodule.Quotient.eq]
|
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section Factorial
variable {m n : ℕ}
@[simp] theorem factorial_zero : 0! = 1 :=
rfl
#align nat.factorial_zero Nat.factorial_zero
theorem factorial_succ (n : ℕ) : (n + 1)! = (n + 1) * n ! :=
rfl
#align nat.factorial_succ Nat.factorial_succ
@[simp] theorem factorial_one : 1! = 1 :=
rfl
#align nat.factorial_one Nat.factorial_one
@[simp] theorem factorial_two : 2! = 2 :=
rfl
#align nat.factorial_two Nat.factorial_two
theorem mul_factorial_pred (hn : 0 < n) : n * (n - 1)! = n ! :=
Nat.sub_add_cancel (Nat.succ_le_of_lt hn) ▸ rfl
#align nat.mul_factorial_pred Nat.mul_factorial_pred
theorem factorial_pos : ∀ n, 0 < n !
| 0 => Nat.zero_lt_one
| succ n => Nat.mul_pos (succ_pos _) (factorial_pos n)
#align nat.factorial_pos Nat.factorial_pos
theorem factorial_ne_zero (n : ℕ) : n ! ≠ 0 :=
ne_of_gt (factorial_pos _)
#align nat.factorial_ne_zero Nat.factorial_ne_zero
theorem factorial_dvd_factorial {m n} (h : m ≤ n) : m ! ∣ n ! := by
induction' h with n _ ih
· exact Nat.dvd_refl _
· exact Nat.dvd_trans ih (Nat.dvd_mul_left _ _)
#align nat.factorial_dvd_factorial Nat.factorial_dvd_factorial
theorem dvd_factorial : ∀ {m n}, 0 < m → m ≤ n → m ∣ n !
| succ _, _, _, h => Nat.dvd_trans (Nat.dvd_mul_right _ _) (factorial_dvd_factorial h)
#align nat.dvd_factorial Nat.dvd_factorial
@[mono, gcongr]
theorem factorial_le {m n} (h : m ≤ n) : m ! ≤ n ! :=
le_of_dvd (factorial_pos _) (factorial_dvd_factorial h)
#align nat.factorial_le Nat.factorial_le
theorem factorial_mul_pow_le_factorial : ∀ {m n : ℕ}, m ! * (m + 1) ^ n ≤ (m + n)!
| m, 0 => by simp
| m, n + 1 => by
rw [← Nat.add_assoc, factorial_succ, Nat.mul_comm (_ + 1), Nat.pow_succ, ← Nat.mul_assoc]
exact Nat.mul_le_mul factorial_mul_pow_le_factorial (succ_le_succ (le_add_right _ _))
#align nat.factorial_mul_pow_le_factorial Nat.factorial_mul_pow_le_factorial
theorem factorial_lt (hn : 0 < n) : n ! < m ! ↔ n < m := by
refine ⟨fun h => not_le.mp fun hmn => Nat.not_le_of_lt h (factorial_le hmn), fun h => ?_⟩
have : ∀ {n}, 0 < n → n ! < (n + 1)! := by
intro k hk
rw [factorial_succ, succ_mul, Nat.lt_add_left_iff_pos]
exact Nat.mul_pos hk k.factorial_pos
induction' h with k hnk ih generalizing hn
· exact this hn
· exact lt_trans (ih hn) $ this <| lt_trans hn <| lt_of_succ_le hnk
#align nat.factorial_lt Nat.factorial_lt
@[gcongr]
lemma factorial_lt_of_lt {m n : ℕ} (hn : 0 < n) (h : n < m) : n ! < m ! := (factorial_lt hn).mpr h
@[simp] lemma one_lt_factorial : 1 < n ! ↔ 1 < n := factorial_lt Nat.one_pos
#align nat.one_lt_factorial Nat.one_lt_factorial
@[simp]
theorem factorial_eq_one : n ! = 1 ↔ n ≤ 1 := by
constructor
· intro h
rw [← not_lt, ← one_lt_factorial, h]
apply lt_irrefl
· rintro (_|_|_) <;> rfl
#align nat.factorial_eq_one Nat.factorial_eq_one
| Mathlib/Data/Nat/Factorial/Basic.lean | 121 | 129 | theorem factorial_inj (hn : 1 < n) : n ! = m ! ↔ n = m := by |
refine ⟨fun h => ?_, congr_arg _⟩
obtain hnm | rfl | hnm := lt_trichotomy n m
· rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm
cases lt_irrefl _ hnm
· rfl
rw [← one_lt_factorial, h, one_lt_factorial] at hn
rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm
cases lt_irrefl _ hnm
|
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Group.OrderIso
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Logic.Pairwise
#align_import data.set.intervals.group from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
variable {α : Type*}
namespace Set
section PairwiseDisjoint
section OrderedCommGroup
variable [OrderedCommGroup α] (a b : α)
@[to_additive]
theorem pairwise_disjoint_Ioc_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioc (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_le hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_le hx.2.2
have i2 := hx.2.1.trans_le hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
#align set.pairwise_disjoint_Ioc_mul_zpow Set.pairwise_disjoint_Ioc_mul_zpow
#align set.pairwise_disjoint_Ioc_add_zsmul Set.pairwise_disjoint_Ioc_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ico_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ico (a * b ^ n) (a * b ^ (n + 1))) := by
simp (config := { unfoldPartialApp := true }) only [Function.onFun]
simp_rw [Set.disjoint_iff]
intro m n hmn x hx
apply hmn
have hb : 1 < b := by
have : a * b ^ m < a * b ^ (m + 1) := hx.1.1.trans_lt hx.1.2
rwa [mul_lt_mul_iff_left, ← mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this
have i1 := hx.1.1.trans_lt hx.2.2
have i2 := hx.2.1.trans_lt hx.1.2
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, Int.lt_add_one_iff] at i1 i2
exact le_antisymm i1 i2
#align set.pairwise_disjoint_Ico_mul_zpow Set.pairwise_disjoint_Ico_mul_zpow
#align set.pairwise_disjoint_Ico_add_zsmul Set.pairwise_disjoint_Ico_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ioo_mul_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioo (a * b ^ n) (a * b ^ (n + 1))) := fun _ _ hmn =>
(pairwise_disjoint_Ioc_mul_zpow a b hmn).mono Ioo_subset_Ioc_self Ioo_subset_Ioc_self
#align set.pairwise_disjoint_Ioo_mul_zpow Set.pairwise_disjoint_Ioo_mul_zpow
#align set.pairwise_disjoint_Ioo_add_zsmul Set.pairwise_disjoint_Ioo_add_zsmul
@[to_additive]
theorem pairwise_disjoint_Ioc_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioc (b ^ n) (b ^ (n + 1))) := by
simpa only [one_mul] using pairwise_disjoint_Ioc_mul_zpow 1 b
#align set.pairwise_disjoint_Ioc_zpow Set.pairwise_disjoint_Ioc_zpow
#align set.pairwise_disjoint_Ioc_zsmul Set.pairwise_disjoint_Ioc_zsmul
@[to_additive]
theorem pairwise_disjoint_Ico_zpow :
Pairwise (Disjoint on fun n : ℤ => Ico (b ^ n) (b ^ (n + 1))) := by
simpa only [one_mul] using pairwise_disjoint_Ico_mul_zpow 1 b
#align set.pairwise_disjoint_Ico_zpow Set.pairwise_disjoint_Ico_zpow
#align set.pairwise_disjoint_Ico_zsmul Set.pairwise_disjoint_Ico_zsmul
@[to_additive]
| Mathlib/Algebra/Order/Interval/Set/Group.lean | 226 | 228 | theorem pairwise_disjoint_Ioo_zpow :
Pairwise (Disjoint on fun n : ℤ => Ioo (b ^ n) (b ^ (n + 1))) := by |
simpa only [one_mul] using pairwise_disjoint_Ioo_mul_zpow 1 b
|
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 68 | 69 | theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by |
rw [catalan]
|
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.RCLike.Basic
open Set Algebra Filter
open scoped Topology
variable (𝕜 : Type*) [RCLike 𝕜]
| Mathlib/Analysis/SpecificLimits/RCLike.lean | 19 | 22 | theorem RCLike.tendsto_inverse_atTop_nhds_zero_nat :
Tendsto (fun n : ℕ => (n : 𝕜)⁻¹) atTop (𝓝 0) := by |
convert tendsto_algebraMap_inverse_atTop_nhds_zero_nat 𝕜
simp
|
import Mathlib.AlgebraicTopology.DoldKan.FunctorN
#align_import algebraic_topology.dold_kan.normalized from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
CategoryTheory.Subobject CategoryTheory.Idempotents DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
universe v
variable {A : Type*} [Category A] [Abelian A] {X : SimplicialObject A}
theorem HigherFacesVanish.inclusionOfMooreComplexMap (n : ℕ) :
HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1)) := fun j _ => by
dsimp [AlgebraicTopology.inclusionOfMooreComplexMap, NormalizedMooreComplex.objX]
rw [← factorThru_arrow _ _ (finset_inf_arrow_factors Finset.univ _ j
(by simp only [Finset.mem_univ])), assoc, kernelSubobject_arrow_comp, comp_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.higher_faces_vanish.inclusion_of_Moore_complex_map AlgebraicTopology.DoldKan.HigherFacesVanish.inclusionOfMooreComplexMap
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 52 | 59 | theorem factors_normalizedMooreComplex_PInfty (n : ℕ) :
Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n) := by |
rcases n with _|n
· apply top_factors
· rw [PInfty_f, NormalizedMooreComplex.objX, finset_inf_factors]
intro i _
apply kernelSubobject_factors
exact (HigherFacesVanish.of_P (n + 1) n) i le_add_self
|
import Mathlib.Algebra.Group.Hom.Defs
#align_import algebra.group.ext from "leanprover-community/mathlib"@"e574b1a4e891376b0ef974b926da39e05da12a06"
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
@[to_additive (attr := ext)]
theorem Monoid.ext {M : Type u} ⦃m₁ m₂ : Monoid M⦄
(h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M)) :
m₁ = m₂ := by
have : m₁.toMulOneClass = m₂.toMulOneClass := MulOneClass.ext h_mul
have h₁ : m₁.one = m₂.one := congr_arg (·.one) this
let f : @MonoidHom M M m₁.toMulOneClass m₂.toMulOneClass :=
@MonoidHom.mk _ _ (_) _ (@OneHom.mk _ _ (_) _ id h₁)
(fun x y => congr_fun (congr_fun h_mul x) y)
have : m₁.npow = m₂.npow := by
ext n x
exact @MonoidHom.map_pow M M m₁ m₂ f x n
rcases m₁ with @⟨@⟨⟨_⟩⟩, ⟨_⟩⟩
rcases m₂ with @⟨@⟨⟨_⟩⟩, ⟨_⟩⟩
congr
#align monoid.ext Monoid.ext
#align add_monoid.ext AddMonoid.ext
@[to_additive]
theorem CommMonoid.toMonoid_injective {M : Type u} :
Function.Injective (@CommMonoid.toMonoid M) := by
rintro ⟨⟩ ⟨⟩ h
congr
#align comm_monoid.to_monoid_injective CommMonoid.toMonoid_injective
#align add_comm_monoid.to_add_monoid_injective AddCommMonoid.toAddMonoid_injective
@[to_additive (attr := ext)]
theorem CommMonoid.ext {M : Type*} ⦃m₁ m₂ : CommMonoid M⦄
(h_mul : (letI := m₁; HMul.hMul : M → M → M) = (letI := m₂; HMul.hMul : M → M → M)) : m₁ = m₂ :=
CommMonoid.toMonoid_injective <| Monoid.ext h_mul
#align comm_monoid.ext CommMonoid.ext
#align add_comm_monoid.ext AddCommMonoid.ext
@[to_additive]
| Mathlib/Algebra/Group/Ext.lean | 71 | 74 | theorem LeftCancelMonoid.toMonoid_injective {M : Type u} :
Function.Injective (@LeftCancelMonoid.toMonoid M) := by |
rintro @⟨@⟨⟩⟩ @⟨@⟨⟩⟩ h
congr <;> injection h
|
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
open CategoryTheory
namespace ModuleCat
variable {ι ι' R : Type*} [Ring R] {S : ShortComplex (ModuleCat R)}
(hS : S.Exact) (hS' : S.ShortExact) {v : ι → S.X₁}
open CategoryTheory Submodule Set
section LinearIndependent
variable (hv : LinearIndependent R v) {u : ι ⊕ ι' → S.X₂}
(hw : LinearIndependent R (S.g ∘ u ∘ Sum.inr))
(hm : Mono S.f) (huv : u ∘ Sum.inl = S.f ∘ v)
| Mathlib/Algebra/Category/ModuleCat/Free.lean | 44 | 49 | theorem disjoint_span_sum : Disjoint (span R (range (u ∘ Sum.inl)))
(span R (range (u ∘ Sum.inr))) := by |
rw [huv, disjoint_comm]
refine Disjoint.mono_right (span_mono (range_comp_subset_range _ _)) ?_
rw [← LinearMap.range_coe, span_eq (LinearMap.range S.f), hS.moduleCat_range_eq_ker]
exact range_ker_disjoint hw
|
import Mathlib.Data.Finsupp.Encodable
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Span
import Mathlib.Data.Set.Countable
#align_import linear_algebra.finsupp from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Set LinearMap Submodule
namespace Finsupp
variable {α : Type*} {M : Type*} {N : Type*} {P : Type*} {R : Type*} {S : Type*}
variable [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M]
variable [AddCommMonoid N] [Module R N]
variable [AddCommMonoid P] [Module R P]
def lsingle (a : α) : M →ₗ[R] α →₀ M :=
{ Finsupp.singleAddHom a with map_smul' := fun _ _ => (smul_single _ _ _).symm }
#align finsupp.lsingle Finsupp.lsingle
theorem lhom_ext ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a b, φ (single a b) = ψ (single a b)) : φ = ψ :=
LinearMap.toAddMonoidHom_injective <| addHom_ext h
#align finsupp.lhom_ext Finsupp.lhom_ext
-- Porting note: The priority should be higher than `LinearMap.ext`.
@[ext high]
theorem lhom_ext' ⦃φ ψ : (α →₀ M) →ₗ[R] N⦄ (h : ∀ a, φ.comp (lsingle a) = ψ.comp (lsingle a)) :
φ = ψ :=
lhom_ext fun a => LinearMap.congr_fun (h a)
#align finsupp.lhom_ext' Finsupp.lhom_ext'
def lapply (a : α) : (α →₀ M) →ₗ[R] M :=
{ Finsupp.applyAddHom a with map_smul' := fun _ _ => rfl }
#align finsupp.lapply Finsupp.lapply
@[simps]
def lcoeFun : (α →₀ M) →ₗ[R] α → M where
toFun := (⇑)
map_add' x y := by
ext
simp
map_smul' x y := by
ext
simp
#align finsupp.lcoe_fun Finsupp.lcoeFun
@[simp]
theorem lsingle_apply (a : α) (b : M) : (lsingle a : M →ₗ[R] α →₀ M) b = single a b :=
rfl
#align finsupp.lsingle_apply Finsupp.lsingle_apply
@[simp]
theorem lapply_apply (a : α) (f : α →₀ M) : (lapply a : (α →₀ M) →ₗ[R] M) f = f a :=
rfl
#align finsupp.lapply_apply Finsupp.lapply_apply
@[simp]
theorem lapply_comp_lsingle_same (a : α) : lapply a ∘ₗ lsingle a = (.id : M →ₗ[R] M) := by ext; simp
@[simp]
| Mathlib/LinearAlgebra/Finsupp.lean | 237 | 238 | theorem lapply_comp_lsingle_of_ne (a a' : α) (h : a ≠ a') :
lapply a ∘ₗ lsingle a' = (0 : M →ₗ[R] M) := by | ext; simp [h.symm]
|
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
simp [disjoint_def]
#align linear_map.disjoint_ker LinearMap.disjoint_ker
theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
#align linear_map.ker_eq_bot' LinearMap.ker_eq_bot'
theorem ker_eq_bot_of_inverse {τ₂₁ : R₂ →+* R} [RingHomInvPair τ₁₂ τ₂₁] {f : M →ₛₗ[τ₁₂] M₂}
{g : M₂ →ₛₗ[τ₂₁] M} (h : (g.comp f : M →ₗ[R] M) = id) : ker f = ⊥ :=
ker_eq_bot'.2 fun m hm => by rw [← id_apply (R := R) m, ← h, comp_apply, hm, g.map_zero]
#align linear_map.ker_eq_bot_of_inverse LinearMap.ker_eq_bot_of_inverse
theorem le_ker_iff_map [RingHomSurjective τ₁₂] {f : F} {p : Submodule R M} :
p ≤ ker f ↔ map f p = ⊥ := by rw [ker, eq_bot_iff, map_le_iff_le_comap]
#align linear_map.le_ker_iff_map LinearMap.le_ker_iff_map
| Mathlib/Algebra/Module/Submodule/Ker.lean | 125 | 126 | theorem ker_codRestrict {τ₂₁ : R₂ →+* R} (p : Submodule R M) (f : M₂ →ₛₗ[τ₂₁] M) (hf) :
ker (codRestrict p f hf) = ker f := by | rw [ker, comap_codRestrict, Submodule.map_bot]; rfl
|
import Mathlib.Algebra.Ring.Int
import Mathlib.SetTheory.Game.PGame
import Mathlib.Tactic.Abel
#align_import set_theory.game.basic from "leanprover-community/mathlib"@"8900d545017cd21961daa2a1734bb658ef52c618"
-- Porting note: many definitions here are noncomputable as the compiler does not support PGame.rec
noncomputable section
namespace SetTheory
open Function PGame
open PGame
universe u
-- Porting note: moved the setoid instance to PGame.lean
abbrev Game :=
Quotient PGame.setoid
#align game SetTheory.Game
namespace Game
-- Porting note (#11445): added this definition
instance : Neg Game where
neg := Quot.map Neg.neg <| fun _ _ => (neg_equiv_neg_iff).2
instance : Zero Game where zero := ⟦0⟧
instance : Add Game where
add := Quotient.map₂ HAdd.hAdd <| fun _ _ hx _ _ hy => PGame.add_congr hx hy
instance instAddCommGroupWithOneGame : AddCommGroupWithOne Game where
zero := ⟦0⟧
one := ⟦1⟧
add_zero := by
rintro ⟨x⟩
exact Quot.sound (add_zero_equiv x)
zero_add := by
rintro ⟨x⟩
exact Quot.sound (zero_add_equiv x)
add_assoc := by
rintro ⟨x⟩ ⟨y⟩ ⟨z⟩
exact Quot.sound add_assoc_equiv
add_left_neg := Quotient.ind <| fun x => Quot.sound (add_left_neg_equiv x)
add_comm := by
rintro ⟨x⟩ ⟨y⟩
exact Quot.sound add_comm_equiv
nsmul := nsmulRec
zsmul := zsmulRec
instance : Inhabited Game :=
⟨0⟩
instance instPartialOrderGame : PartialOrder Game where
le := Quotient.lift₂ (· ≤ ·) fun x₁ y₁ x₂ y₂ hx hy => propext (le_congr hx hy)
le_refl := by
rintro ⟨x⟩
exact le_refl x
le_trans := by
rintro ⟨x⟩ ⟨y⟩ ⟨z⟩
exact @le_trans _ _ x y z
le_antisymm := by
rintro ⟨x⟩ ⟨y⟩ h₁ h₂
apply Quot.sound
exact ⟨h₁, h₂⟩
lt := Quotient.lift₂ (· < ·) fun x₁ y₁ x₂ y₂ hx hy => propext (lt_congr hx hy)
lt_iff_le_not_le := by
rintro ⟨x⟩ ⟨y⟩
exact @lt_iff_le_not_le _ _ x y
def LF : Game → Game → Prop :=
Quotient.lift₂ PGame.LF fun _ _ _ _ hx hy => propext (lf_congr hx hy)
#align game.lf SetTheory.Game.LF
local infixl:50 " ⧏ " => LF
@[simp]
| Mathlib/SetTheory/Game/Basic.lean | 111 | 113 | theorem not_le : ∀ {x y : Game}, ¬x ≤ y ↔ y ⧏ x := by |
rintro ⟨x⟩ ⟨y⟩
exact PGame.not_le
|
import Mathlib.Topology.Algebra.InfiniteSum.Constructions
import Mathlib.Topology.Algebra.Module.Basic
#align_import topology.algebra.infinite_sum.module from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
variable {α β γ δ : Type*}
open Filter Finset Function
variable {ι κ R R₂ M M₂ : Type*}
section HasSum
-- Results in this section hold for continuous additive monoid homomorphisms or equivalences but we
-- don't have bundled continuous additive homomorphisms.
variable [Semiring R] [Semiring R₂] [AddCommMonoid M] [Module R M] [AddCommMonoid M₂] [Module R₂ M₂]
[TopologicalSpace M] [TopologicalSpace M₂] {σ : R →+* R₂} {σ' : R₂ →+* R} [RingHomInvPair σ σ']
[RingHomInvPair σ' σ]
protected theorem ContinuousLinearMap.hasSum {f : ι → M} (φ : M →SL[σ] M₂) {x : M}
(hf : HasSum f x) : HasSum (fun b : ι ↦ φ (f b)) (φ x) := by
simpa only using hf.map φ.toLinearMap.toAddMonoidHom φ.continuous
#align continuous_linear_map.has_sum ContinuousLinearMap.hasSum
alias HasSum.mapL := ContinuousLinearMap.hasSum
set_option linter.uppercaseLean3 false in
#align has_sum.mapL HasSum.mapL
protected theorem ContinuousLinearMap.summable {f : ι → M} (φ : M →SL[σ] M₂) (hf : Summable f) :
Summable fun b : ι ↦ φ (f b) :=
(hf.hasSum.mapL φ).summable
#align continuous_linear_map.summable ContinuousLinearMap.summable
alias Summable.mapL := ContinuousLinearMap.summable
set_option linter.uppercaseLean3 false in
#align summable.mapL Summable.mapL
protected theorem ContinuousLinearMap.map_tsum [T2Space M₂] {f : ι → M} (φ : M →SL[σ] M₂)
(hf : Summable f) : φ (∑' z, f z) = ∑' z, φ (f z) :=
(hf.hasSum.mapL φ).tsum_eq.symm
#align continuous_linear_map.map_tsum ContinuousLinearMap.map_tsum
protected theorem ContinuousLinearEquiv.hasSum {f : ι → M} (e : M ≃SL[σ] M₂) {y : M₂} :
HasSum (fun b : ι ↦ e (f b)) y ↔ HasSum f (e.symm y) :=
⟨fun h ↦ by simpa only [e.symm.coe_coe, e.symm_apply_apply] using h.mapL (e.symm : M₂ →SL[σ'] M),
fun h ↦ by simpa only [e.coe_coe, e.apply_symm_apply] using (e : M →SL[σ] M₂).hasSum h⟩
#align continuous_linear_equiv.has_sum ContinuousLinearEquiv.hasSum
protected theorem ContinuousLinearEquiv.hasSum' {f : ι → M} (e : M ≃SL[σ] M₂) {x : M} :
HasSum (fun b : ι ↦ e (f b)) (e x) ↔ HasSum f x := by
rw [e.hasSum, ContinuousLinearEquiv.symm_apply_apply]
#align continuous_linear_equiv.has_sum' ContinuousLinearEquiv.hasSum'
protected theorem ContinuousLinearEquiv.summable {f : ι → M} (e : M ≃SL[σ] M₂) :
(Summable fun b : ι ↦ e (f b)) ↔ Summable f :=
⟨fun hf ↦ (e.hasSum.1 hf.hasSum).summable, (e : M →SL[σ] M₂).summable⟩
#align continuous_linear_equiv.summable ContinuousLinearEquiv.summable
| Mathlib/Topology/Algebra/InfiniteSum/Module.lean | 167 | 178 | theorem ContinuousLinearEquiv.tsum_eq_iff [T2Space M] [T2Space M₂] {f : ι → M} (e : M ≃SL[σ] M₂)
{y : M₂} : (∑' z, e (f z)) = y ↔ ∑' z, f z = e.symm y := by |
by_cases hf : Summable f
· exact
⟨fun h ↦ (e.hasSum.mp ((e.summable.mpr hf).hasSum_iff.mpr h)).tsum_eq, fun h ↦
(e.hasSum.mpr (hf.hasSum_iff.mpr h)).tsum_eq⟩
· have hf' : ¬Summable fun z ↦ e (f z) := fun h ↦ hf (e.summable.mp h)
rw [tsum_eq_zero_of_not_summable hf, tsum_eq_zero_of_not_summable hf']
refine ⟨?_, fun H ↦ ?_⟩
· rintro rfl
simp
· simpa using congr_arg (fun z ↦ e z) H
|
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
#align order_iso.image_Iic OrderIso.image_Iic
@[simp]
theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) :=
e.dual.image_Iic a
#align order_iso.image_Ici OrderIso.image_Ici
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 78 | 79 | theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by |
rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm]
|
import Mathlib.Combinatorics.SimpleGraph.Connectivity
import Mathlib.Tactic.Linarith
#align_import combinatorics.simple_graph.acyclic from "leanprover-community/mathlib"@"b07688016d62f81d14508ff339ea3415558d6353"
universe u v
namespace SimpleGraph
open Walk
variable {V : Type u} (G : SimpleGraph V)
def IsAcyclic : Prop := ∀ ⦃v : V⦄ (c : G.Walk v v), ¬c.IsCycle
#align simple_graph.is_acyclic SimpleGraph.IsAcyclic
@[mk_iff]
structure IsTree : Prop where
protected isConnected : G.Connected
protected IsAcyclic : G.IsAcyclic
#align simple_graph.is_tree SimpleGraph.IsTree
variable {G}
@[simp] lemma isAcyclic_bot : IsAcyclic (⊥ : SimpleGraph V) := fun _a _w hw ↦ hw.ne_bot rfl
theorem isAcyclic_iff_forall_adj_isBridge :
G.IsAcyclic ↔ ∀ ⦃v w : V⦄, G.Adj v w → G.IsBridge s(v, w) := by
simp_rw [isBridge_iff_adj_and_forall_cycle_not_mem]
constructor
· intro ha v w hvw
apply And.intro hvw
intro u p hp
cases ha p hp
· rintro hb v (_ | ⟨ha, p⟩) hp
· exact hp.not_of_nil
· apply (hb ha).2 _ hp
rw [Walk.edges_cons]
apply List.mem_cons_self
#align simple_graph.is_acyclic_iff_forall_adj_is_bridge SimpleGraph.isAcyclic_iff_forall_adj_isBridge
theorem isAcyclic_iff_forall_edge_isBridge :
G.IsAcyclic ↔ ∀ ⦃e⦄, e ∈ (G.edgeSet) → G.IsBridge e := by
simp [isAcyclic_iff_forall_adj_isBridge, Sym2.forall]
#align simple_graph.is_acyclic_iff_forall_edge_is_bridge SimpleGraph.isAcyclic_iff_forall_edge_isBridge
theorem IsAcyclic.path_unique {G : SimpleGraph V} (h : G.IsAcyclic) {v w : V} (p q : G.Path v w) :
p = q := by
obtain ⟨p, hp⟩ := p
obtain ⟨q, hq⟩ := q
rw [Subtype.mk.injEq]
induction p with
| nil =>
cases (Walk.isPath_iff_eq_nil _).mp hq
rfl
| cons ph p ih =>
rw [isAcyclic_iff_forall_adj_isBridge] at h
specialize h ph
rw [isBridge_iff_adj_and_forall_walk_mem_edges] at h
replace h := h.2 (q.append p.reverse)
simp only [Walk.edges_append, Walk.edges_reverse, List.mem_append, List.mem_reverse] at h
cases' h with h h
· cases q with
| nil => simp [Walk.isPath_def] at hp
| cons _ q =>
rw [Walk.cons_isPath_iff] at hp hq
simp only [Walk.edges_cons, List.mem_cons, Sym2.eq_iff, true_and] at h
rcases h with (⟨h, rfl⟩ | ⟨rfl, rfl⟩) | h
· cases ih hp.1 q hq.1
rfl
· simp at hq
· exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hq.2
· rw [Walk.cons_isPath_iff] at hp
exact absurd (Walk.fst_mem_support_of_mem_edges _ h) hp.2
#align simple_graph.is_acyclic.path_unique SimpleGraph.IsAcyclic.path_unique
| Mathlib/Combinatorics/SimpleGraph/Acyclic.lean | 118 | 127 | theorem isAcyclic_of_path_unique (h : ∀ (v w : V) (p q : G.Path v w), p = q) : G.IsAcyclic := by |
intro v c hc
simp only [Walk.isCycle_def, Ne] at hc
cases c with
| nil => cases hc.2.1 rfl
| cons ha c' =>
simp only [Walk.cons_isTrail_iff, Walk.support_cons, List.tail_cons, true_and_iff] at hc
specialize h _ _ ⟨c', by simp only [Walk.isPath_def, hc.2]⟩ (Path.singleton ha.symm)
rw [Path.singleton, Subtype.mk.injEq] at h
simp [h] at hc
|
import Mathlib.RingTheory.IntegrallyClosed
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.Norm
#align_import ring_theory.discriminant from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
universe u v w z
open scoped Matrix
open Matrix FiniteDimensional Fintype Polynomial Finset IntermediateField
namespace Algebra
variable (A : Type u) {B : Type v} (C : Type z) {ι : Type w} [DecidableEq ι]
variable [CommRing A] [CommRing B] [Algebra A B] [CommRing C] [Algebra A C]
section Discr
-- Porting note: using `[DecidableEq ι]` instead of `by classical...` did not work in
-- mathlib3.
noncomputable def discr (A : Type u) {B : Type v} [CommRing A] [CommRing B] [Algebra A B]
[Fintype ι] (b : ι → B) := (traceMatrix A b).det
#align algebra.discr Algebra.discr
theorem discr_def [Fintype ι] (b : ι → B) : discr A b = (traceMatrix A b).det := rfl
variable {A C} in
theorem discr_eq_discr_of_algEquiv [Fintype ι] (b : ι → B) (f : B ≃ₐ[A] C) :
Algebra.discr A b = Algebra.discr A (f ∘ b) := by
rw [discr_def]; congr; ext
simp_rw [traceMatrix_apply, traceForm_apply, Function.comp, ← map_mul f, trace_eq_of_algEquiv]
#align algebra.discr_def Algebra.discr_def
variable {ι' : Type*} [Fintype ι'] [Fintype ι] [DecidableEq ι']
section Basic
@[simp]
theorem discr_reindex (b : Basis ι A B) (f : ι ≃ ι') : discr A (b ∘ ⇑f.symm) = discr A b := by
classical rw [← Basis.coe_reindex, discr_def, traceMatrix_reindex, det_reindex_self, ← discr_def]
#align algebra.discr_reindex Algebra.discr_reindex
| Mathlib/RingTheory/Discriminant.lean | 93 | 106 | theorem discr_zero_of_not_linearIndependent [IsDomain A] {b : ι → B}
(hli : ¬LinearIndependent A b) : discr A b = 0 := by |
classical
obtain ⟨g, hg, i, hi⟩ := Fintype.not_linearIndependent_iff.1 hli
have : (traceMatrix A b) *ᵥ g = 0 := by
ext i
have : ∀ j, (trace A B) (b i * b j) * g j = (trace A B) (g j • b j * b i) := by
intro j;
simp [mul_comm]
simp only [mulVec, dotProduct, traceMatrix_apply, Pi.zero_apply, traceForm_apply, fun j =>
this j, ← map_sum, ← sum_mul, hg, zero_mul, LinearMap.map_zero]
by_contra h
rw [discr_def] at h
simp [Matrix.eq_zero_of_mulVec_eq_zero h this] at hi
|
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
#align_import analysis.special_functions.pow.continuity from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate
open Filter Finset Set
section CpowLimits
open Complex
variable {α : Type*}
theorem zero_cpow_eq_nhds {b : ℂ} (hb : b ≠ 0) : (fun x : ℂ => (0 : ℂ) ^ x) =ᶠ[𝓝 b] 0 := by
suffices ∀ᶠ x : ℂ in 𝓝 b, x ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [zero_cpow hx, Pi.zero_apply]
exact IsOpen.eventually_mem isOpen_ne hb
#align zero_cpow_eq_nhds zero_cpow_eq_nhds
theorem cpow_eq_nhds {a b : ℂ} (ha : a ≠ 0) :
(fun x => x ^ b) =ᶠ[𝓝 a] fun x => exp (log x * b) := by
suffices ∀ᶠ x : ℂ in 𝓝 a, x ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
exact IsOpen.eventually_mem isOpen_ne ha
#align cpow_eq_nhds cpow_eq_nhds
theorem cpow_eq_nhds' {p : ℂ × ℂ} (hp_fst : p.fst ≠ 0) :
(fun x => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) := by
suffices ∀ᶠ x : ℂ × ℂ in 𝓝 p, x.1 ≠ 0 from
this.mono fun x hx ↦ by
dsimp only
rw [cpow_def_of_ne_zero hx]
refine IsOpen.eventually_mem ?_ hp_fst
change IsOpen { x : ℂ × ℂ | x.1 = 0 }ᶜ
rw [isOpen_compl_iff]
exact isClosed_eq continuous_fst continuous_const
#align cpow_eq_nhds' cpow_eq_nhds'
-- Continuity of `fun x => a ^ x`: union of these two lemmas is optimal.
theorem continuousAt_const_cpow {a b : ℂ} (ha : a ≠ 0) : ContinuousAt (fun x : ℂ => a ^ x) b := by
have cpow_eq : (fun x : ℂ => a ^ x) = fun x => exp (log a * x) := by
ext1 b
rw [cpow_def_of_ne_zero ha]
rw [cpow_eq]
exact continuous_exp.continuousAt.comp (ContinuousAt.mul continuousAt_const continuousAt_id)
#align continuous_at_const_cpow continuousAt_const_cpow
theorem continuousAt_const_cpow' {a b : ℂ} (h : b ≠ 0) : ContinuousAt (fun x : ℂ => a ^ x) b := by
by_cases ha : a = 0
· rw [ha, continuousAt_congr (zero_cpow_eq_nhds h)]
exact continuousAt_const
· exact continuousAt_const_cpow ha
#align continuous_at_const_cpow' continuousAt_const_cpow'
| Mathlib/Analysis/SpecialFunctions/Pow/Continuity.lean | 84 | 91 | theorem continuousAt_cpow {p : ℂ × ℂ} (hp_fst : p.fst ∈ slitPlane) :
ContinuousAt (fun x : ℂ × ℂ => x.1 ^ x.2) p := by |
rw [continuousAt_congr (cpow_eq_nhds' <| slitPlane_ne_zero hp_fst)]
refine continuous_exp.continuousAt.comp ?_
exact
ContinuousAt.mul
(ContinuousAt.comp (continuousAt_clog hp_fst) continuous_fst.continuousAt)
continuous_snd.continuousAt
|
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.LinearAlgebra.Matrix.ToLin
#align_import linear_algebra.matrix.basis from "leanprover-community/mathlib"@"6c263e4bfc2e6714de30f22178b4d0ca4d149a76"
noncomputable section
open LinearMap Matrix Set Submodule
open Matrix
section BasisToMatrix
variable {ι ι' κ κ' : Type*}
variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
variable {R₂ M₂ : Type*} [CommRing R₂] [AddCommGroup M₂] [Module R₂ M₂]
open Function Matrix
def Basis.toMatrix (e : Basis ι R M) (v : ι' → M) : Matrix ι ι' R := fun i j => e.repr (v j) i
#align basis.to_matrix Basis.toMatrix
variable (e : Basis ι R M) (v : ι' → M) (i : ι) (j : ι')
namespace Basis
theorem toMatrix_apply : e.toMatrix v i j = e.repr (v j) i :=
rfl
#align basis.to_matrix_apply Basis.toMatrix_apply
theorem toMatrix_transpose_apply : (e.toMatrix v)ᵀ j = e.repr (v j) :=
funext fun _ => rfl
#align basis.to_matrix_transpose_apply Basis.toMatrix_transpose_apply
theorem toMatrix_eq_toMatrix_constr [Fintype ι] [DecidableEq ι] (v : ι → M) :
e.toMatrix v = LinearMap.toMatrix e e (e.constr ℕ v) := by
ext
rw [Basis.toMatrix_apply, LinearMap.toMatrix_apply, Basis.constr_basis]
#align basis.to_matrix_eq_to_matrix_constr Basis.toMatrix_eq_toMatrix_constr
-- TODO (maybe) Adjust the definition of `Basis.toMatrix` to eliminate the transpose.
theorem coePiBasisFun.toMatrix_eq_transpose [Finite ι] :
((Pi.basisFun R ι).toMatrix : Matrix ι ι R → Matrix ι ι R) = Matrix.transpose := by
ext M i j
rfl
#align basis.coe_pi_basis_fun.to_matrix_eq_transpose Basis.coePiBasisFun.toMatrix_eq_transpose
@[simp]
theorem toMatrix_self [DecidableEq ι] : e.toMatrix e = 1 := by
unfold Basis.toMatrix
ext i j
simp [Basis.equivFun, Matrix.one_apply, Finsupp.single_apply, eq_comm]
#align basis.to_matrix_self Basis.toMatrix_self
| Mathlib/LinearAlgebra/Matrix/Basis.lean | 86 | 92 | theorem toMatrix_update [DecidableEq ι'] (x : M) :
e.toMatrix (Function.update v j x) = Matrix.updateColumn (e.toMatrix v) j (e.repr x) := by |
ext i' k
rw [Basis.toMatrix, Matrix.updateColumn_apply, e.toMatrix_apply]
split_ifs with h
· rw [h, update_same j x v]
· rw [update_noteq h]
|
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section Infsep
open ENNReal
open Set Function
noncomputable def infsep [EDist α] (s : Set α) : ℝ :=
ENNReal.toReal s.einfsep
#align set.infsep Set.infsep
section EDist
variable [EDist α] {x y : α} {s : Set α}
| Mathlib/Topology/MetricSpace/Infsep.lean | 332 | 333 | theorem infsep_zero : s.infsep = 0 ↔ s.einfsep = 0 ∨ s.einfsep = ∞ := by |
rw [infsep, ENNReal.toReal_eq_zero_iff]
|
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 248 | 249 | theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by | simp [toList]
|
import Mathlib.Algebra.Module.Submodule.Map
#align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
open Function
open Pointwise
variable {R : Type*} {R₁ : Type*} {R₂ : Type*} {R₃ : Type*}
variable {K : Type*}
variable {M : Type*} {M₁ : Type*} {M₂ : Type*} {M₃ : Type*}
variable {V : Type*} {V₂ : Type*}
namespace LinearMap
section AddCommMonoid
variable [Semiring R] [Semiring R₂] [Semiring R₃]
variable [AddCommMonoid M] [AddCommMonoid M₂] [AddCommMonoid M₃]
variable {σ₁₂ : R →+* R₂} {σ₂₃ : R₂ →+* R₃} {σ₁₃ : R →+* R₃}
variable [RingHomCompTriple σ₁₂ σ₂₃ σ₁₃]
variable [Module R M] [Module R₂ M₂] [Module R₃ M₃]
open Submodule
variable {σ₂₁ : R₂ →+* R} {τ₁₂ : R →+* R₂} {τ₂₃ : R₂ →+* R₃} {τ₁₃ : R →+* R₃}
variable [RingHomCompTriple τ₁₂ τ₂₃ τ₁₃]
variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂]
def ker (f : F) : Submodule R M :=
comap f ⊥
#align linear_map.ker LinearMap.ker
@[simp]
theorem mem_ker {f : F} {y} : y ∈ ker f ↔ f y = 0 :=
mem_bot R₂
#align linear_map.mem_ker LinearMap.mem_ker
@[simp]
theorem ker_id : ker (LinearMap.id : M →ₗ[R] M) = ⊥ :=
rfl
#align linear_map.ker_id LinearMap.ker_id
@[simp]
theorem map_coe_ker (f : F) (x : ker f) : f x = 0 :=
mem_ker.1 x.2
#align linear_map.map_coe_ker LinearMap.map_coe_ker
theorem ker_toAddSubmonoid (f : M →ₛₗ[τ₁₂] M₂) : f.ker.toAddSubmonoid = (AddMonoidHom.mker f) :=
rfl
#align linear_map.ker_to_add_submonoid LinearMap.ker_toAddSubmonoid
theorem comp_ker_subtype (f : M →ₛₗ[τ₁₂] M₂) : f.comp f.ker.subtype = 0 :=
LinearMap.ext fun x => mem_ker.1 x.2
#align linear_map.comp_ker_subtype LinearMap.comp_ker_subtype
theorem ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker (g.comp f : M →ₛₗ[τ₁₃] M₃) = comap f (ker g) :=
rfl
#align linear_map.ker_comp LinearMap.ker_comp
theorem ker_le_ker_comp (f : M →ₛₗ[τ₁₂] M₂) (g : M₂ →ₛₗ[τ₂₃] M₃) :
ker f ≤ ker (g.comp f : M →ₛₗ[τ₁₃] M₃) := by rw [ker_comp]; exact comap_mono bot_le
#align linear_map.ker_le_ker_comp LinearMap.ker_le_ker_comp
theorem ker_sup_ker_le_ker_comp_of_commute {f g : M →ₗ[R] M} (h : Commute f g) :
ker f ⊔ ker g ≤ ker (f ∘ₗ g) := by
refine sup_le_iff.mpr ⟨?_, ker_le_ker_comp g f⟩
rw [← mul_eq_comp, h.eq, mul_eq_comp]
exact ker_le_ker_comp f g
@[simp]
theorem ker_le_comap {p : Submodule R₂ M₂} (f : M →ₛₗ[τ₁₂] M₂) :
ker f ≤ p.comap f :=
fun x hx ↦ by simp [mem_ker.mp hx]
theorem disjoint_ker {f : F} {p : Submodule R M} :
Disjoint p (ker f) ↔ ∀ x ∈ p, f x = 0 → x = 0 := by
simp [disjoint_def]
#align linear_map.disjoint_ker LinearMap.disjoint_ker
| Mathlib/Algebra/Module/Submodule/Ker.lean | 112 | 113 | theorem ker_eq_bot' {f : F} : ker f = ⊥ ↔ ∀ m, f m = 0 → m = 0 := by |
simpa [disjoint_iff_inf_le] using disjoint_ker (f := f) (p := ⊤)
|
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section DescFactorial
def descFactorial (n : ℕ) : ℕ → ℕ
| 0 => 1
| k + 1 => (n - k) * descFactorial n k
#align nat.desc_factorial Nat.descFactorial
@[simp]
theorem descFactorial_zero (n : ℕ) : n.descFactorial 0 = 1 :=
rfl
#align nat.desc_factorial_zero Nat.descFactorial_zero
@[simp]
theorem descFactorial_succ (n k : ℕ) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k :=
rfl
#align nat.desc_factorial_succ Nat.descFactorial_succ
theorem zero_descFactorial_succ (k : ℕ) : (0 : ℕ).descFactorial (k + 1) = 0 := by
rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul]
#align nat.zero_desc_factorial_succ Nat.zero_descFactorial_succ
| Mathlib/Data/Nat/Factorial/Basic.lean | 344 | 344 | theorem descFactorial_one (n : ℕ) : n.descFactorial 1 = n := by | simp
|
import Mathlib.LinearAlgebra.Matrix.Adjugate
import Mathlib.RingTheory.PolynomialAlgebra
#align_import linear_algebra.matrix.charpoly.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
universe u v w
namespace Matrix
open Finset Matrix Polynomial
variable {R S : Type*} [CommRing R] [CommRing S]
variable {m n : Type*} [DecidableEq m] [DecidableEq n] [Fintype m] [Fintype n]
variable (M₁₁ : Matrix m m R) (M₁₂ : Matrix m n R) (M₂₁ : Matrix n m R) (M₂₂ M : Matrix n n R)
variable (i j : n)
def charmatrix (M : Matrix n n R) : Matrix n n R[X] :=
Matrix.scalar n (X : R[X]) - (C : R →+* R[X]).mapMatrix M
#align charmatrix Matrix.charmatrix
theorem charmatrix_apply :
charmatrix M i j = (Matrix.diagonal fun _ : n => X) i j - C (M i j) :=
rfl
#align charmatrix_apply Matrix.charmatrix_apply
@[simp]
theorem charmatrix_apply_eq : charmatrix M i i = (X : R[X]) - C (M i i) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, map_apply,
diagonal_apply_eq]
#align charmatrix_apply_eq Matrix.charmatrix_apply_eq
@[simp]
theorem charmatrix_apply_ne (h : i ≠ j) : charmatrix M i j = -C (M i j) := by
simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, diagonal_apply_ne _ h,
map_apply, sub_eq_neg_self]
#align charmatrix_apply_ne Matrix.charmatrix_apply_ne
| Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean | 67 | 76 | theorem matPolyEquiv_charmatrix : matPolyEquiv (charmatrix M) = X - C M := by |
ext k i j
simp only [matPolyEquiv_coeff_apply, coeff_sub, Pi.sub_apply]
by_cases h : i = j
· subst h
rw [charmatrix_apply_eq, coeff_sub]
simp only [coeff_X, coeff_C]
split_ifs <;> simp
· rw [charmatrix_apply_ne _ _ _ h, coeff_X, coeff_neg, coeff_C, coeff_C]
split_ifs <;> simp [h]
|
import Mathlib.Analysis.Normed.Field.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.normed.ring.seminorm from "leanprover-community/mathlib"@"7ea604785a41a0681eac70c5a82372493dbefc68"
open NNReal
variable {F R S : Type*} (x y : R) (r : ℝ)
structure RingSeminorm (R : Type*) [NonUnitalNonAssocRing R] extends AddGroupSeminorm R where
mul_le' : ∀ x y : R, toFun (x * y) ≤ toFun x * toFun y
#align ring_seminorm RingSeminorm
structure RingNorm (R : Type*) [NonUnitalNonAssocRing R] extends RingSeminorm R, AddGroupNorm R
#align ring_norm RingNorm
structure MulRingSeminorm (R : Type*) [NonAssocRing R] extends AddGroupSeminorm R,
MonoidWithZeroHom R ℝ
#align mul_ring_seminorm MulRingSeminorm
structure MulRingNorm (R : Type*) [NonAssocRing R] extends MulRingSeminorm R, AddGroupNorm R
#align mul_ring_norm MulRingNorm
attribute [nolint docBlame]
RingSeminorm.toAddGroupSeminorm RingNorm.toAddGroupNorm RingNorm.toRingSeminorm
MulRingSeminorm.toAddGroupSeminorm MulRingSeminorm.toMonoidWithZeroHom
MulRingNorm.toAddGroupNorm MulRingNorm.toMulRingSeminorm
namespace RingSeminorm
section NonUnitalRing
variable [NonUnitalRing R]
instance funLike : FunLike (RingSeminorm R) R ℝ where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact congr_fun h x
instance ringSeminormClass : RingSeminormClass (RingSeminorm R) R ℝ where
map_zero f := f.map_zero'
map_add_le_add f := f.add_le'
map_mul_le_mul f := f.mul_le'
map_neg_eq_map f := f.neg'
#align ring_seminorm.ring_seminorm_class RingSeminorm.ringSeminormClass
@[simp]
theorem toFun_eq_coe (p : RingSeminorm R) : (p.toAddGroupSeminorm : R → ℝ) = p :=
rfl
#align ring_seminorm.to_fun_eq_coe RingSeminorm.toFun_eq_coe
@[ext]
theorem ext {p q : RingSeminorm R} : (∀ x, p x = q x) → p = q :=
DFunLike.ext p q
#align ring_seminorm.ext RingSeminorm.ext
instance : Zero (RingSeminorm R) :=
⟨{ AddGroupSeminorm.instZeroAddGroupSeminorm.zero with mul_le' :=
fun _ _ => (zero_mul _).ge }⟩
theorem eq_zero_iff {p : RingSeminorm R} : p = 0 ↔ ∀ x, p x = 0 :=
DFunLike.ext_iff
#align ring_seminorm.eq_zero_iff RingSeminorm.eq_zero_iff
| Mathlib/Analysis/Normed/Ring/Seminorm.lean | 116 | 116 | theorem ne_zero_iff {p : RingSeminorm R} : p ≠ 0 ↔ ∃ x, p x ≠ 0 := by | simp [eq_zero_iff]
|
import Mathlib.Order.Cover
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.GaloisConnection
#align_import order.modular_lattice from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open Set
variable {α : Type*}
class IsWeakUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy_covBy {a b : α} : a ⊓ b ⋖ a → a ⊓ b ⋖ b → a ⋖ a ⊔ b
#align is_weak_upper_modular_lattice IsWeakUpperModularLattice
class IsWeakLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_covBy_sup {a b : α} : a ⋖ a ⊔ b → b ⋖ a ⊔ b → a ⊓ b ⋖ a
#align is_weak_lower_modular_lattice IsWeakLowerModularLattice
class IsUpperModularLattice (α : Type*) [Lattice α] : Prop where
covBy_sup_of_inf_covBy {a b : α} : a ⊓ b ⋖ a → b ⋖ a ⊔ b
#align is_upper_modular_lattice IsUpperModularLattice
class IsLowerModularLattice (α : Type*) [Lattice α] : Prop where
inf_covBy_of_covBy_sup {a b : α} : a ⋖ a ⊔ b → a ⊓ b ⋖ b
#align is_lower_modular_lattice IsLowerModularLattice
class IsModularLattice (α : Type*) [Lattice α] : Prop where
sup_inf_le_assoc_of_le : ∀ {x : α} (y : α) {z : α}, x ≤ z → (x ⊔ y) ⊓ z ≤ x ⊔ y ⊓ z
#align is_modular_lattice IsModularLattice
section UpperModular
variable [Lattice α] [IsUpperModularLattice α] {a b : α}
theorem covBy_sup_of_inf_covBy_left : a ⊓ b ⋖ a → b ⋖ a ⊔ b :=
IsUpperModularLattice.covBy_sup_of_inf_covBy
#align covby_sup_of_inf_covby_left covBy_sup_of_inf_covBy_left
| Mathlib/Order/ModularLattice.lean | 151 | 153 | theorem covBy_sup_of_inf_covBy_right : a ⊓ b ⋖ b → a ⋖ a ⊔ b := by |
rw [sup_comm, inf_comm]
exact covBy_sup_of_inf_covBy_left
|
import Mathlib.Algebra.BigOperators.Group.Multiset
import Mathlib.Data.Multiset.Dedup
#align_import data.multiset.bind from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
assert_not_exists MonoidWithZero
assert_not_exists MulAction
universe v
variable {α : Type*} {β : Type v} {γ δ : Type*}
namespace Multiset
def join : Multiset (Multiset α) → Multiset α :=
sum
#align multiset.join Multiset.join
theorem coe_join :
∀ L : List (List α), join (L.map ((↑) : List α → Multiset α) : Multiset (Multiset α)) = L.join
| [] => rfl
| l :: L => by
exact congr_arg (fun s : Multiset α => ↑l + s) (coe_join L)
#align multiset.coe_join Multiset.coe_join
@[simp]
theorem join_zero : @join α 0 = 0 :=
rfl
#align multiset.join_zero Multiset.join_zero
@[simp]
theorem join_cons (s S) : @join α (s ::ₘ S) = s + join S :=
sum_cons _ _
#align multiset.join_cons Multiset.join_cons
@[simp]
theorem join_add (S T) : @join α (S + T) = join S + join T :=
sum_add _ _
#align multiset.join_add Multiset.join_add
@[simp]
theorem singleton_join (a) : join ({a} : Multiset (Multiset α)) = a :=
sum_singleton _
#align multiset.singleton_join Multiset.singleton_join
@[simp]
theorem mem_join {a S} : a ∈ @join α S ↔ ∃ s ∈ S, a ∈ s :=
Multiset.induction_on S (by simp) <| by
simp (config := { contextual := true }) [or_and_right, exists_or]
#align multiset.mem_join Multiset.mem_join
@[simp]
theorem card_join (S) : card (@join α S) = sum (map card S) :=
Multiset.induction_on S (by simp) (by simp)
#align multiset.card_join Multiset.card_join
@[simp]
| Mathlib/Data/Multiset/Bind.lean | 82 | 86 | theorem map_join (f : α → β) (S : Multiset (Multiset α)) :
map f (join S) = join (map (map f) S) := by |
induction S using Multiset.induction with
| empty => simp
| cons _ _ ih => simp [ih]
|
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
#align real.logb_neg_eq_logb Real.logb_neg_eq_logb
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 72 | 73 | theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by |
simp_rw [logb, log_mul hx hy, add_div]
|
import Mathlib.Analysis.Normed.Order.Lattice
import Mathlib.MeasureTheory.Function.LpSpace
#align_import measure_theory.function.lp_order from "leanprover-community/mathlib"@"5dc275ec639221ca4d5f56938eb966f6ad9bc89f"
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory
open scoped ENNReal
variable {α E : Type*} {m : MeasurableSpace α} {μ : Measure α} {p : ℝ≥0∞}
namespace MeasureTheory
namespace Lp
section Order
variable [NormedLatticeAddCommGroup E]
theorem coeFn_le (f g : Lp E p μ) : f ≤ᵐ[μ] g ↔ f ≤ g := by
rw [← Subtype.coe_le_coe, ← AEEqFun.coeFn_le]
#align measure_theory.Lp.coe_fn_le MeasureTheory.Lp.coeFn_le
| Mathlib/MeasureTheory/Function/LpOrder.lean | 45 | 50 | theorem coeFn_nonneg (f : Lp E p μ) : 0 ≤ᵐ[μ] f ↔ 0 ≤ f := by |
rw [← coeFn_le]
have h0 := Lp.coeFn_zero E p μ
constructor <;> intro h <;> filter_upwards [h, h0] with _ _ h2
· rwa [h2]
· rwa [← h2]
|
import Mathlib.CategoryTheory.Idempotents.Basic
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Equivalence
#align_import category_theory.idempotents.karoubi from "leanprover-community/mathlib"@"200eda15d8ff5669854ff6bcc10aaf37cb70498f"
noncomputable section
open CategoryTheory.Category CategoryTheory.Preadditive CategoryTheory.Limits BigOperators
namespace CategoryTheory
variable (C : Type*) [Category C]
namespace Idempotents
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Karoubi where
X : C
p : X ⟶ X
idem : p ≫ p = p := by aesop_cat
#align category_theory.idempotents.karoubi CategoryTheory.Idempotents.Karoubi
namespace Karoubi
variable {C}
attribute [reassoc (attr := simp)] idem
@[ext]
theorem ext {P Q : Karoubi C} (h_X : P.X = Q.X) (h_p : P.p ≫ eqToHom h_X = eqToHom h_X ≫ Q.p) :
P = Q := by
cases P
cases Q
dsimp at h_X h_p
subst h_X
simpa only [mk.injEq, heq_eq_eq, true_and, eqToHom_refl, comp_id, id_comp] using h_p
#align category_theory.idempotents.karoubi.ext CategoryTheory.Idempotents.Karoubi.ext
@[ext]
structure Hom (P Q : Karoubi C) where
f : P.X ⟶ Q.X
comm : f = P.p ≫ f ≫ Q.p := by aesop_cat
#align category_theory.idempotents.karoubi.hom CategoryTheory.Idempotents.Karoubi.Hom
instance [Preadditive C] (P Q : Karoubi C) : Inhabited (Hom P Q) :=
⟨⟨0, by rw [zero_comp, comp_zero]⟩⟩
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Idempotents/Karoubi.lean | 85 | 85 | theorem p_comp {P Q : Karoubi C} (f : Hom P Q) : P.p ≫ f.f = f.f := by | rw [f.comm, ← assoc, P.idem]
|
import Mathlib.Algebra.Group.Indicator
import Mathlib.Data.Finset.Piecewise
import Mathlib.Data.Finset.Preimage
#align_import algebra.big_operators.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
-- TODO
-- assert_not_exists AddCommMonoidWithOne
assert_not_exists MonoidWithZero
assert_not_exists MulAction
variable {ι κ α β γ : Type*}
open Fin Function
namespace Finset
@[to_additive "`∑ x ∈ s, f x` is the sum of `f x` as `x` ranges over the elements
of the finite set `s`."]
protected def prod [CommMonoid β] (s : Finset α) (f : α → β) : β :=
(s.1.map f).prod
#align finset.prod Finset.prod
#align finset.sum Finset.sum
@[to_additive (attr := simp)]
theorem prod_mk [CommMonoid β] (s : Multiset α) (hs : s.Nodup) (f : α → β) :
(⟨s, hs⟩ : Finset α).prod f = (s.map f).prod :=
rfl
#align finset.prod_mk Finset.prod_mk
#align finset.sum_mk Finset.sum_mk
@[to_additive (attr := simp)]
| Mathlib/Algebra/BigOperators/Group/Finset.lean | 67 | 68 | theorem prod_val [CommMonoid α] (s : Finset α) : s.1.prod = s.prod id := by |
rw [Finset.prod, Multiset.map_id]
|
import Mathlib.Data.List.Basic
#align_import data.list.palindrome from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec"
variable {α β : Type*}
namespace List
inductive Palindrome : List α → Prop
| nil : Palindrome []
| singleton : ∀ x, Palindrome [x]
| cons_concat : ∀ (x) {l}, Palindrome l → Palindrome (x :: (l ++ [x]))
#align list.palindrome List.Palindrome
namespace Palindrome
variable {l : List α}
| Mathlib/Data/List/Palindrome.lean | 50 | 52 | theorem reverse_eq {l : List α} (p : Palindrome l) : reverse l = l := by |
induction p <;> try (exact rfl)
simpa
|
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField α] {a : α}
@[simp]
theorem preimage_mul_const_Iio (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
theorem preimage_mul_const_Ioo (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by simp [← Ioi_inter_Iio, h]
#align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo
@[simp]
theorem preimage_mul_const_Ioc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c) := by simp [← Ioi_inter_Iic, h]
#align set.preimage_mul_const_Ioc Set.preimage_mul_const_Ioc
@[simp]
theorem preimage_mul_const_Ico (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ico a b = Ico (a / c) (b / c) := by simp [← Ici_inter_Iio, h]
#align set.preimage_mul_const_Ico Set.preimage_mul_const_Ico
@[simp]
theorem preimage_mul_const_Icc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Icc a b = Icc (a / c) (b / c) := by simp [← Ici_inter_Iic, h]
#align set.preimage_mul_const_Icc Set.preimage_mul_const_Icc
@[simp]
theorem preimage_mul_const_Iio_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iio a = Ioi (a / c) :=
ext fun _x => (div_lt_iff_of_neg h).symm
#align set.preimage_mul_const_Iio_of_neg Set.preimage_mul_const_Iio_of_neg
@[simp]
theorem preimage_mul_const_Ioi_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioi a = Iio (a / c) :=
ext fun _x => (lt_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ioi_of_neg Set.preimage_mul_const_Ioi_of_neg
@[simp]
theorem preimage_mul_const_Iic_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Iic a = Ici (a / c) :=
ext fun _x => (div_le_iff_of_neg h).symm
#align set.preimage_mul_const_Iic_of_neg Set.preimage_mul_const_Iic_of_neg
@[simp]
theorem preimage_mul_const_Ici_of_neg (a : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ici a = Iic (a / c) :=
ext fun _x => (le_div_iff_of_neg h).symm
#align set.preimage_mul_const_Ici_of_neg Set.preimage_mul_const_Ici_of_neg
@[simp]
theorem preimage_mul_const_Ioo_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (b / c) (a / c) := by simp [← Ioi_inter_Iio, h, inter_comm]
#align set.preimage_mul_const_Ioo_of_neg Set.preimage_mul_const_Ioo_of_neg
@[simp]
theorem preimage_mul_const_Ioc_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ioc a b = Ico (b / c) (a / c) := by
simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm]
#align set.preimage_mul_const_Ioc_of_neg Set.preimage_mul_const_Ioc_of_neg
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 674 | 676 | theorem preimage_mul_const_Ico_of_neg (a b : α) {c : α} (h : c < 0) :
(fun x => x * c) ⁻¹' Ico a b = Ioc (b / c) (a / c) := by |
simp [← Ici_inter_Iio, ← Ioi_inter_Iic, h, inter_comm]
|
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.Ring
#align_import data.nat.count from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
open Finset
namespace Nat
variable (p : ℕ → Prop)
section Count
variable [DecidablePred p]
def count (n : ℕ) : ℕ :=
(List.range n).countP p
#align nat.count Nat.count
@[simp]
theorem count_zero : count p 0 = 0 := by
rw [count, List.range_zero, List.countP, List.countP.go]
#align nat.count_zero Nat.count_zero
def CountSet.fintype (n : ℕ) : Fintype { i // i < n ∧ p i } := by
apply Fintype.ofFinset ((Finset.range n).filter p)
intro x
rw [mem_filter, mem_range]
rfl
#align nat.count_set.fintype Nat.CountSet.fintype
scoped[Count] attribute [instance] Nat.CountSet.fintype
open Count
theorem count_eq_card_filter_range (n : ℕ) : count p n = ((range n).filter p).card := by
rw [count, List.countP_eq_length_filter]
rfl
#align nat.count_eq_card_filter_range Nat.count_eq_card_filter_range
theorem count_eq_card_fintype (n : ℕ) : count p n = Fintype.card { k : ℕ // k < n ∧ p k } := by
rw [count_eq_card_filter_range, ← Fintype.card_ofFinset, ← CountSet.fintype]
rfl
#align nat.count_eq_card_fintype Nat.count_eq_card_fintype
theorem count_succ (n : ℕ) : count p (n + 1) = count p n + if p n then 1 else 0 := by
split_ifs with h <;> simp [count, List.range_succ, h]
#align nat.count_succ Nat.count_succ
@[mono]
theorem count_monotone : Monotone (count p) :=
monotone_nat_of_le_succ fun n ↦ by by_cases h : p n <;> simp [count_succ, h]
#align nat.count_monotone Nat.count_monotone
| Mathlib/Data/Nat/Count.lean | 74 | 83 | theorem count_add (a b : ℕ) : count p (a + b) = count p a + count (fun k ↦ p (a + k)) b := by |
have : Disjoint ((range a).filter p) (((range b).map <| addLeftEmbedding a).filter p) := by
apply disjoint_filter_filter
rw [Finset.disjoint_left]
simp_rw [mem_map, mem_range, addLeftEmbedding_apply]
rintro x hx ⟨c, _, rfl⟩
exact (self_le_add_right _ _).not_lt hx
simp_rw [count_eq_card_filter_range, range_add, filter_union, card_union_of_disjoint this,
filter_map, addLeftEmbedding, card_map]
rfl
|
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.specific_limits.floor_pow from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Finset
open Topology
| Mathlib/Analysis/SpecificLimits/FloorPow.lean | 28 | 182 | theorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : ℕ → ℝ) (l : ℝ)
(hmono : Monotone u)
(hlim : ∀ a : ℝ, 1 < a → ∃ c : ℕ → ℕ, (∀ᶠ n in atTop, (c (n + 1) : ℝ) ≤ a * c n) ∧
Tendsto c atTop atTop ∧ Tendsto (fun n => u (c n) / c n) atTop (𝓝 l)) :
Tendsto (fun n => u n / n) atTop (𝓝 l) := by |
/- To check the result up to some `ε > 0`, we use a sequence `c` for which the ratio
`c (N+1) / c N` is bounded by `1 + ε`. Sandwiching a given `n` between two consecutive values of
`c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)`
and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable
to the limit `l` up to `1 + ε`.
We give a version of this proof by clearing out denominators first, to avoid discussing the sign
of different quantities. -/
have lnonneg : 0 ≤ l := by
rcases hlim 2 one_lt_two with ⟨c, _, ctop, clim⟩
have : Tendsto (fun n => u 0 / c n) atTop (𝓝 0) :=
tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop)
apply le_of_tendsto_of_tendsto' this clim fun n => ?_
gcongr
exact hmono (zero_le _)
have A : ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, u n - n * l ≤ ε * (1 + ε + l) * n := by
intro ε εpos
rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩
have L : ∀ᶠ n in atTop, u (c n) - c n * l ≤ ε * c n := by
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ,
Asymptotics.isLittleO_iff] at clim
filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'
have cnpos : 0 < c n := cnpos'
calc
u (c n) - c n * l = (u (c n) / c n - l) * c n := by
simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, field_simps]
_ ≤ ε * c n := by
gcongr
refine (le_abs_self _).trans ?_
simpa using hn
obtain ⟨a, ha⟩ :
∃ a : ℕ, ∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ u (c b) - c b * l ≤ ε * c b :=
eventually_atTop.1 (cgrowth.and L)
let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)
filter_upwards [Ici_mem_atTop M] with n hn
have exN : ∃ N, n < c N := by
rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩
exact ⟨N, by linarith only [hN]⟩
let N := Nat.find exN
have ncN : n < c N := Nat.find_spec exN
have aN : a + 1 ≤ N := by
by_contra! h
have cNM : c N ≤ M := by
apply le_max'
apply mem_image_of_mem
exact mem_range.2 h
exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)
have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN
have cNn : c (N - 1) ≤ n := by
have : N - 1 < N := Nat.pred_lt Npos.ne'
simpa only [not_lt] using Nat.find_min exN this
have IcN : (c N : ℝ) ≤ (1 + ε) * c (N - 1) := by
have A : a ≤ N - 1 := by
apply @Nat.le_of_add_le_add_right a 1 (N - 1)
rw [Nat.sub_add_cancel Npos]
exact aN
have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
have := (ha _ A).1
rwa [B] at this
calc
u n - n * l ≤ u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le
_ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring
_ ≤ ε * c N + ε * c (N - 1) * l := by
gcongr
· exact (ha N (a.le_succ.trans aN)).2
· linarith only [IcN]
_ ≤ ε * ((1 + ε) * c (N - 1)) + ε * c (N - 1) * l := by gcongr
_ = ε * (1 + ε + l) * c (N - 1) := by ring
_ ≤ ε * (1 + ε + l) * n := by gcongr
have B : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in atTop, (n : ℝ) * l - u n ≤ ε * (1 + l) * n := by
intro ε εpos
rcases hlim (1 + ε) ((lt_add_iff_pos_right _).2 εpos) with ⟨c, cgrowth, ctop, clim⟩
have L : ∀ᶠ n : ℕ in atTop, (c n : ℝ) * l - u (c n) ≤ ε * c n := by
rw [← tendsto_sub_nhds_zero_iff, ← Asymptotics.isLittleO_one_iff ℝ,
Asymptotics.isLittleO_iff] at clim
filter_upwards [clim εpos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'
have cnpos : 0 < c n := cnpos'
calc
(c n : ℝ) * l - u (c n) = -(u (c n) / c n - l) * c n := by
simp only [cnpos.ne', Ne, Nat.cast_eq_zero, not_false_iff, neg_sub, field_simps]
_ ≤ ε * c n := by
gcongr
refine le_trans (neg_le_abs _) ?_
simpa using hn
obtain ⟨a, ha⟩ :
∃ a : ℕ,
∀ b : ℕ, a ≤ b → (c (b + 1) : ℝ) ≤ (1 + ε) * c b ∧ (c b : ℝ) * l - u (c b) ≤ ε * c b :=
eventually_atTop.1 (cgrowth.and L)
let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)
filter_upwards [Ici_mem_atTop M] with n hn
have exN : ∃ N, n < c N := by
rcases (tendsto_atTop.1 ctop (n + 1)).exists with ⟨N, hN⟩
exact ⟨N, by linarith only [hN]⟩
let N := Nat.find exN
have ncN : n < c N := Nat.find_spec exN
have aN : a + 1 ≤ N := by
by_contra! h
have cNM : c N ≤ M := by
apply le_max'
apply mem_image_of_mem
exact mem_range.2 h
exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)
have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN
have aN' : a ≤ N - 1 := by
apply @Nat.le_of_add_le_add_right a 1 (N - 1)
rw [Nat.sub_add_cancel Npos]
exact aN
have cNn : c (N - 1) ≤ n := by
have : N - 1 < N := Nat.pred_lt Npos.ne'
simpa only [not_lt] using Nat.find_min exN this
calc
(n : ℝ) * l - u n ≤ c N * l - u (c (N - 1)) := by
gcongr
exact hmono cNn
_ ≤ (1 + ε) * c (N - 1) * l - u (c (N - 1)) := by
gcongr
have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos
simpa [B] using (ha _ aN').1
_ = c (N - 1) * l - u (c (N - 1)) + ε * c (N - 1) * l := by ring
_ ≤ ε * c (N - 1) + ε * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl
_ = ε * (1 + l) * c (N - 1) := by ring
_ ≤ ε * (1 + l) * n := by gcongr
refine tendsto_order.2 ⟨fun d hd => ?_, fun d hd => ?_⟩
· obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, d + ε * (1 + l) < l ∧ 0 < ε := by
have L : Tendsto (fun ε => d + ε * (1 + l)) (𝓝[>] 0) (𝓝 (d + 0 * (1 + l))) := by
apply Tendsto.mono_left _ nhdsWithin_le_nhds
exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds)
simp only [zero_mul, add_zero] at L
exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists
filter_upwards [B ε εpos, Ioi_mem_atTop 0] with n hn npos
simp_rw [div_eq_inv_mul]
calc
d < (n : ℝ)⁻¹ * n * (l - ε * (1 + l)) := by
rw [inv_mul_cancel, one_mul]
· linarith only [hε]
· exact Nat.cast_ne_zero.2 (ne_of_gt npos)
_ = (n : ℝ)⁻¹ * (n * l - ε * (1 + l) * n) := by ring
_ ≤ (n : ℝ)⁻¹ * u n := by gcongr; linarith only [hn]
· obtain ⟨ε, hε, εpos⟩ : ∃ ε : ℝ, l + ε * (1 + ε + l) < d ∧ 0 < ε := by
have L : Tendsto (fun ε => l + ε * (1 + ε + l)) (𝓝[>] 0) (𝓝 (l + 0 * (1 + 0 + l))) := by
apply Tendsto.mono_left _ nhdsWithin_le_nhds
exact
tendsto_const_nhds.add
(tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds))
simp only [zero_mul, add_zero] at L
exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists
filter_upwards [A ε εpos, Ioi_mem_atTop 0] with n hn (npos : 0 < n)
calc
u n / n ≤ (n * l + ε * (1 + ε + l) * n) / n := by gcongr; linarith only [hn]
_ = (l + ε * (1 + ε + l)) := by field_simp; ring
_ < d := hε
|
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
#align_import linear_algebra.affine_space.matrix from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine Matrix
open Set
universe u₁ u₂ u₃ u₄
variable {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄}
variable [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P)
noncomputable def toMatrix {ι' : Type*} (q : ι' → P) : Matrix ι' ι k :=
fun i j => b.coord j (q i)
#align affine_basis.to_matrix AffineBasis.toMatrix
@[simp]
theorem toMatrix_apply {ι' : Type*} (q : ι' → P) (i : ι') (j : ι) :
b.toMatrix q i j = b.coord j (q i) := rfl
#align affine_basis.to_matrix_apply AffineBasis.toMatrix_apply
@[simp]
| Mathlib/LinearAlgebra/AffineSpace/Matrix.lean | 48 | 50 | theorem toMatrix_self [DecidableEq ι] : b.toMatrix b = (1 : Matrix ι ι k) := by |
ext i j
rw [toMatrix_apply, coord_apply, Matrix.one_eq_pi_single, Pi.single_apply]
|
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.Fintype.Card
#align_import data.multiset.fintype from "leanprover-community/mathlib"@"e3d9ab8faa9dea8f78155c6c27d62a621f4c152d"
variable {α : Type*} [DecidableEq α] {m : Multiset α}
def Multiset.ToType (m : Multiset α) : Type _ := (x : α) × Fin (m.count x)
#align multiset.to_type Multiset.ToType
instance : CoeSort (Multiset α) (Type _) := ⟨Multiset.ToType⟩
example : DecidableEq m := inferInstanceAs <| DecidableEq ((x : α) × Fin (m.count x))
-- Porting note: syntactic equality
#noalign multiset.coe_sort_eq
@[reducible, match_pattern]
def Multiset.mkToType (m : Multiset α) (x : α) (i : Fin (m.count x)) : m :=
⟨x, i⟩
#align multiset.mk_to_type Multiset.mkToType
instance instCoeSortMultisetType.instCoeOutToType : CoeOut m α :=
⟨fun x ↦ x.1⟩
#align multiset.has_coe_to_sort.has_coe instCoeSortMultisetType.instCoeOutToTypeₓ
-- Porting note: syntactic equality
#noalign multiset.fst_coe_eq_coe
-- Syntactic equality
#noalign multiset.coe_eq
-- @[simp] -- Porting note (#10685): dsimp can prove this
theorem Multiset.coe_mk {x : α} {i : Fin (m.count x)} : ↑(m.mkToType x i) = x :=
rfl
#align multiset.coe_mk Multiset.coe_mk
@[simp] lemma Multiset.coe_mem {x : m} : ↑x ∈ m := Multiset.count_pos.mp (by have := x.2.2; omega)
#align multiset.coe_mem Multiset.coe_mem
@[simp]
protected theorem Multiset.forall_coe (p : m → Prop) :
(∀ x : m, p x) ↔ ∀ (x : α) (i : Fin (m.count x)), p ⟨x, i⟩ :=
Sigma.forall
#align multiset.forall_coe Multiset.forall_coe
@[simp]
protected theorem Multiset.exists_coe (p : m → Prop) :
(∃ x : m, p x) ↔ ∃ (x : α) (i : Fin (m.count x)), p ⟨x, i⟩ :=
Sigma.exists
#align multiset.exists_coe Multiset.exists_coe
instance : Fintype { p : α × ℕ | p.2 < m.count p.1 } :=
Fintype.ofFinset
(m.toFinset.biUnion fun x ↦ (Finset.range (m.count x)).map ⟨Prod.mk x, Prod.mk.inj_left x⟩)
(by
rintro ⟨x, i⟩
simp only [Finset.mem_biUnion, Multiset.mem_toFinset, Finset.mem_map, Finset.mem_range,
Function.Embedding.coeFn_mk, Prod.mk.inj_iff, Set.mem_setOf_eq]
simp only [← and_assoc, exists_eq_right, and_iff_right_iff_imp]
exact fun h ↦ Multiset.count_pos.mp (by omega))
def Multiset.toEnumFinset (m : Multiset α) : Finset (α × ℕ) :=
{ p : α × ℕ | p.2 < m.count p.1 }.toFinset
#align multiset.to_enum_finset Multiset.toEnumFinset
@[simp]
theorem Multiset.mem_toEnumFinset (m : Multiset α) (p : α × ℕ) :
p ∈ m.toEnumFinset ↔ p.2 < m.count p.1 :=
Set.mem_toFinset
#align multiset.mem_to_enum_finset Multiset.mem_toEnumFinset
theorem Multiset.mem_of_mem_toEnumFinset {p : α × ℕ} (h : p ∈ m.toEnumFinset) : p.1 ∈ m :=
have := (m.mem_toEnumFinset p).mp h; Multiset.count_pos.mp (by omega)
#align multiset.mem_of_mem_to_enum_finset Multiset.mem_of_mem_toEnumFinset
@[mono]
theorem Multiset.toEnumFinset_mono {m₁ m₂ : Multiset α} (h : m₁ ≤ m₂) :
m₁.toEnumFinset ⊆ m₂.toEnumFinset := by
intro p
simp only [Multiset.mem_toEnumFinset]
exact gt_of_ge_of_gt (Multiset.le_iff_count.mp h p.1)
#align multiset.to_enum_finset_mono Multiset.toEnumFinset_mono
@[simp]
| Mathlib/Data/Multiset/Fintype.lean | 130 | 141 | theorem Multiset.toEnumFinset_subset_iff {m₁ m₂ : Multiset α} :
m₁.toEnumFinset ⊆ m₂.toEnumFinset ↔ m₁ ≤ m₂ := by |
refine ⟨fun h ↦ ?_, Multiset.toEnumFinset_mono⟩
rw [Multiset.le_iff_count]
intro x
by_cases hx : x ∈ m₁
· apply Nat.le_of_pred_lt
have : (x, m₁.count x - 1) ∈ m₁.toEnumFinset := by
rw [Multiset.mem_toEnumFinset]
exact Nat.pred_lt (ne_of_gt (Multiset.count_pos.mpr hx))
simpa only [Multiset.mem_toEnumFinset] using h this
· simp [hx]
|
import Mathlib.Algebra.Polynomial.Module.AEval
#align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
universe u v
open Polynomial BigOperators
@[nolint unusedArguments]
def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M
#align polynomial_module PolynomialModule
variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R)
-- Porting note: stated instead of deriving
noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited
noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup
variable {M}
variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M]
namespace PolynomialModule
@[nolint unusedArguments]
noncomputable instance : Module S (PolynomialModule R M) :=
Finsupp.module ℕ M
instance instFunLike : FunLike (PolynomialModule R M) ℕ M :=
Finsupp.instFunLike
instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M :=
Finsupp.instCoeFun
theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 :=
Finsupp.zero_apply
theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a :=
Finsupp.add_apply g₁ g₂ a
noncomputable def single (i : ℕ) : M →+ PolynomialModule R M :=
Finsupp.singleAddHom i
#align polynomial_module.single PolynomialModule.single
theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.single_apply PolynomialModule.single_apply
noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M :=
Finsupp.lsingle i
#align polynomial_module.lsingle PolynomialModule.lsingle
theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply
theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m :=
(lsingle R i).map_smul r m
#align polynomial_module.single_smul PolynomialModule.single_smul
variable {R}
theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0)
(hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f :=
Finsupp.induction_linear f h0 hadd hsingle
#align polynomial_module.induction_linear PolynomialModule.induction_linear
noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) :=
inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ)))
#align polynomial_module.polynomial_module PolynomialModule.polynomialModule
lemma smul_def (f : R[X]) (m : PolynomialModule R M) :
f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by
rfl
instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] :
IsScalarTower S R (PolynomialModule R M) :=
Finsupp.isScalarTower _ _
instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M]
[IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by
haveI : IsScalarTower R R[X] (PolynomialModule R M) :=
inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ
constructor
intro x y z
rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc]
#align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower'
@[simp]
theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) :
monomial i r • single R j m = single R (i + j) (r • m) := by
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply,
Module.algebraMap_end_apply, smul_def]
induction i generalizing r j m with
| zero =>
rw [Function.iterate_zero, zero_add]
exact Finsupp.smul_single r j m
| succ n hn =>
rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn]
congr 2
rw [Nat.one_add]
exact Finsupp.mapDomain_single
#align polynomial_module.monomial_smul_single PolynomialModule.monomial_smul_single
@[simp]
theorem monomial_smul_apply (i : ℕ) (r : R) (g : PolynomialModule R M) (n : ℕ) :
(monomial i r • g) n = ite (i ≤ n) (r • g (n - i)) 0 := by
induction' g using PolynomialModule.induction_linear with p q hp hq
· simp only [smul_zero, zero_apply, ite_self]
· simp only [smul_add, add_apply, hp, hq]
split_ifs
exacts [rfl, zero_add 0]
· rw [monomial_smul_single, single_apply, single_apply, smul_ite, smul_zero, ← ite_and]
congr
rw [eq_iff_iff]
constructor
· rintro rfl
simp
· rintro ⟨e, rfl⟩
rw [add_comm, tsub_add_cancel_of_le e]
#align polynomial_module.monomial_smul_apply PolynomialModule.monomial_smul_apply
@[simp]
| Mathlib/Algebra/Polynomial/Module/Basic.lean | 157 | 169 | theorem smul_single_apply (i : ℕ) (f : R[X]) (m : M) (n : ℕ) :
(f • single R i m) n = ite (i ≤ n) (f.coeff (n - i) • m) 0 := by |
induction' f using Polynomial.induction_on' with p q hp hq
· rw [add_smul, Finsupp.add_apply, hp, hq, coeff_add, add_smul]
split_ifs
exacts [rfl, zero_add 0]
· rw [monomial_smul_single, single_apply, coeff_monomial, ite_smul, zero_smul]
by_cases h : i ≤ n
· simp_rw [eq_tsub_iff_add_eq_of_le h, if_pos h]
· rw [if_neg h, ite_eq_right_iff]
intro e
exfalso
linarith
|
import Mathlib.Data.Fintype.Basic
import Mathlib.GroupTheory.Perm.Sign
import Mathlib.Logic.Equiv.Defs
#align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f"
section Fintype
variable {α β : Type*} [Fintype α] [DecidableEq β] (e : Equiv.Perm α) (f : α ↪ β)
def Function.Embedding.toEquivRange : α ≃ Set.range f :=
⟨fun a => ⟨f a, Set.mem_range_self a⟩, f.invOfMemRange, fun _ => by simp, fun _ => by simp⟩
#align function.embedding.to_equiv_range Function.Embedding.toEquivRange
@[simp]
theorem Function.Embedding.toEquivRange_apply (a : α) :
f.toEquivRange a = ⟨f a, Set.mem_range_self a⟩ :=
rfl
#align function.embedding.to_equiv_range_apply Function.Embedding.toEquivRange_apply
@[simp]
theorem Function.Embedding.toEquivRange_symm_apply_self (a : α) :
f.toEquivRange.symm ⟨f a, Set.mem_range_self a⟩ = a := by simp [Equiv.symm_apply_eq]
#align function.embedding.to_equiv_range_symm_apply_self Function.Embedding.toEquivRange_symm_apply_self
theorem Function.Embedding.toEquivRange_eq_ofInjective :
f.toEquivRange = Equiv.ofInjective f f.injective := by
ext
simp
#align function.embedding.to_equiv_range_eq_of_injective Function.Embedding.toEquivRange_eq_ofInjective
def Equiv.Perm.viaFintypeEmbedding : Equiv.Perm β :=
e.extendDomain f.toEquivRange
#align equiv.perm.via_fintype_embedding Equiv.Perm.viaFintypeEmbedding
@[simp]
| Mathlib/Logic/Equiv/Fintype.lean | 72 | 75 | theorem Equiv.Perm.viaFintypeEmbedding_apply_image (a : α) :
e.viaFintypeEmbedding f (f a) = f (e a) := by |
rw [Equiv.Perm.viaFintypeEmbedding]
convert Equiv.Perm.extendDomain_apply_image e (Function.Embedding.toEquivRange f) a
|
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function
open scoped Topology ENNReal Convex
variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E]
[CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α}
{s t : Set α}
namespace MeasureTheory
section NormedAddCommGroup
variable (μ)
variable {f g : α → E}
noncomputable def average (f : α → E) :=
∫ x, f x ∂(μ univ)⁻¹ • μ
#align measure_theory.average MeasureTheory.average
notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r
notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r
notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r
@[simp]
theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero]
#align measure_theory.average_zero MeasureTheory.average_zero
@[simp]
theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by
rw [average, smul_zero, integral_zero_measure]
#align measure_theory.average_zero_measure MeasureTheory.average_zero_measure
@[simp]
theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ :=
integral_neg f
#align measure_theory.average_neg MeasureTheory.average_neg
theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ :=
rfl
#align measure_theory.average_eq' MeasureTheory.average_eq'
theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by
rw [average_eq', integral_smul_measure, ENNReal.toReal_inv]
#align measure_theory.average_eq MeasureTheory.average_eq
theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rw [average, measure_univ, inv_one, one_smul]
#align measure_theory.average_eq_integral MeasureTheory.average_eq_integral
@[simp]
theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) :
(μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by
rcases eq_or_ne μ 0 with hμ | hμ
· rw [hμ, integral_zero_measure, average_zero_measure, smul_zero]
· rw [average_eq, smul_inv_smul₀]
refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne'
rwa [Ne, measure_univ_eq_zero]
#align measure_theory.measure_smul_average MeasureTheory.measure_smul_average
theorem setAverage_eq (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by rw [average_eq, restrict_apply_univ]
#align measure_theory.set_average_eq MeasureTheory.setAverage_eq
theorem setAverage_eq' (f : α → E) (s : Set α) :
⨍ x in s, f x ∂μ = ∫ x, f x ∂(μ s)⁻¹ • μ.restrict s := by
simp only [average_eq', restrict_apply_univ]
#align measure_theory.set_average_eq' MeasureTheory.setAverage_eq'
variable {μ}
| Mathlib/MeasureTheory/Integral/Average.lean | 361 | 362 | theorem average_congr {f g : α → E} (h : f =ᵐ[μ] g) : ⨍ x, f x ∂μ = ⨍ x, g x ∂μ := by |
simp only [average_eq, integral_congr_ae h]
|
import Mathlib.Algebra.Polynomial.Splits
import Mathlib.RingTheory.Adjoin.Basic
import Mathlib.RingTheory.AdjoinRoot
#align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
noncomputable section
open Polynomial
section Embeddings
variable (F : Type*) [Field F]
open AdjoinRoot in
def AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly {R : Type*} [CommRing R] [Algebra F R] (x : R) :
Algebra.adjoin F ({x} : Set R) ≃ₐ[F] AdjoinRoot (minpoly F x) :=
AlgEquiv.symm <| AlgEquiv.ofBijective (Minpoly.toAdjoin F x) <| by
refine ⟨(injective_iff_map_eq_zero _).2 fun P₁ hP₁ ↦ ?_, Minpoly.toAdjoin.surjective F x⟩
obtain ⟨P, rfl⟩ := mk_surjective P₁
refine AdjoinRoot.mk_eq_zero.mpr (minpoly.dvd F x ?_)
rwa [Minpoly.toAdjoin_apply', liftHom_mk, ← Subalgebra.coe_eq_zero, aeval_subalgebra_coe] at hP₁
#align alg_equiv.adjoin_singleton_equiv_adjoin_root_minpoly AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly
noncomputable def Algebra.adjoin.liftSingleton {S T : Type*}
[CommRing S] [CommRing T] [Algebra F S] [Algebra F T]
(x : S) (y : T) (h : aeval y (minpoly F x) = 0) :
Algebra.adjoin F {x} →ₐ[F] T :=
(AdjoinRoot.liftHom _ y h).comp (AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly F x).toAlgHom
open Finset
| Mathlib/RingTheory/Adjoin/Field.lean | 56 | 81 | theorem Polynomial.lift_of_splits {F K L : Type*} [Field F] [Field K] [Field L] [Algebra F K]
[Algebra F L] (s : Finset K) : (∀ x ∈ s, IsIntegral F x ∧
Splits (algebraMap F L) (minpoly F x)) → Nonempty (Algebra.adjoin F (s : Set K) →ₐ[F] L) := by |
classical
refine Finset.induction_on s (fun _ ↦ ?_) fun a s _ ih H ↦ ?_
· rw [coe_empty, Algebra.adjoin_empty]
exact ⟨(Algebra.ofId F L).comp (Algebra.botEquiv F K)⟩
rw [forall_mem_insert] at H
rcases H with ⟨⟨H1, H2⟩, H3⟩
cases' ih H3 with f
choose H3 _ using H3
rw [coe_insert, Set.insert_eq, Set.union_comm, Algebra.adjoin_union_eq_adjoin_adjoin]
set Ks := Algebra.adjoin F (s : Set K)
haveI : FiniteDimensional F Ks := ((Submodule.fg_iff_finiteDimensional _).1
(fg_adjoin_of_finite s.finite_toSet H3)).of_subalgebra_toSubmodule
letI := fieldOfFiniteDimensional F Ks
letI := (f : Ks →+* L).toAlgebra
have H5 : IsIntegral Ks a := H1.tower_top
have H6 : (minpoly Ks a).Splits (algebraMap Ks L) := by
refine splits_of_splits_of_dvd _ ((minpoly.monic H1).map (algebraMap F Ks)).ne_zero
((splits_map_iff _ _).2 ?_) (minpoly.dvd _ _ ?_)
· rw [← IsScalarTower.algebraMap_eq]
exact H2
· rw [Polynomial.aeval_map_algebraMap, minpoly.aeval]
obtain ⟨y, hy⟩ := Polynomial.exists_root_of_splits _ H6 (minpoly.degree_pos H5).ne'
exact ⟨Subalgebra.ofRestrictScalars F _ <| Algebra.adjoin.liftSingleton Ks a y hy⟩
|
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜']
variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G}
variable {f' : α → E'} {g' : α → F'} {k' : α → G'}
variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''}
variable {l l' : Filter α}
section Defs
irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
#align asymptotics.is_O_with Asymptotics.IsBigOWith
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by rw [IsBigOWith_def]
#align asymptotics.is_O_with_iff Asymptotics.isBigOWith_iff
alias ⟨IsBigOWith.bound, IsBigOWith.of_bound⟩ := isBigOWith_iff
#align asymptotics.is_O_with.bound Asymptotics.IsBigOWith.bound
#align asymptotics.is_O_with.of_bound Asymptotics.IsBigOWith.of_bound
irreducible_def IsBigO (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∃ c : ℝ, IsBigOWith c l f g
#align asymptotics.is_O Asymptotics.IsBigO
@[inherit_doc]
notation:100 f " =O[" l "] " g:100 => IsBigO l f g
theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by rw [IsBigO_def]
#align asymptotics.is_O_iff_is_O_with Asymptotics.isBigO_iff_isBigOWith
theorem isBigO_iff : f =O[l] g ↔ ∃ c : ℝ, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by
simp only [IsBigO_def, IsBigOWith_def]
#align asymptotics.is_O_iff Asymptotics.isBigO_iff
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 118 | 132 | theorem isBigO_iff' {g : α → E'''} :
f =O[l] g ↔ ∃ c > 0, ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by |
refine ⟨fun h => ?mp, fun h => ?mpr⟩
case mp =>
rw [isBigO_iff] at h
obtain ⟨c, hc⟩ := h
refine ⟨max c 1, zero_lt_one.trans_le (le_max_right _ _), ?_⟩
filter_upwards [hc] with x hx
apply hx.trans
gcongr
exact le_max_left _ _
case mpr =>
rw [isBigO_iff]
obtain ⟨c, ⟨_, hc⟩⟩ := h
exact ⟨c, hc⟩
|
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Init.Order.Defs
set_option autoImplicit true
structure UFModel (n) where
parent : Fin n → Fin n
rank : Nat → Nat
rank_lt : ∀ i, (parent i).1 ≠ i → rank i < rank (parent i)
structure UFNode (α : Type*) where
parent : Nat
value : α
rank : Nat
inductive UFModel.Agrees (arr : Array α) (f : α → β) : ∀ {n}, (Fin n → β) → Prop
| mk : Agrees arr f fun i ↦ f (arr.get i)
namespace UFModel.Agrees
theorem mk' {arr : Array α} {f : α → β} {n} {g : Fin n → β} (e : n = arr.size)
(H : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = g ⟨i, h₂⟩) : Agrees arr f g := by
cases e
have : (fun i ↦ f (arr.get i)) = g := by funext ⟨i, h⟩; apply H
cases this; constructor
theorem size_eq {arr : Array α} {m : Fin n → β} (H : Agrees arr f m) : n = arr.size := by
cases H; rfl
theorem get_eq {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m) :
∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩ := by
cases H; exact fun i h _ ↦ rfl
theorem get_eq' {arr : Array α} {m : Fin arr.size → β} (H : Agrees arr f m)
(i) : f (arr.get i) = m i := H.get_eq ..
theorem empty {f : α → β} {g : Fin 0 → β} : Agrees #[] f g := mk' rfl nofun
| Mathlib/Data/UnionFind.lean | 91 | 101 | theorem push {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m)
(k) (hk : k = n + 1) (x) (m' : Fin k → β)
(hm₁ : ∀ (i : Fin k) (h : i < n), m' i = m ⟨i, h⟩)
(hm₂ : ∀ (h : n < k), f x = m' ⟨n, h⟩) : Agrees (arr.push x) f m' := by |
cases H
have : k = (arr.push x).size := by simp [hk]
refine mk' this fun i h₁ h₂ ↦ ?_
simp [Array.get_push]; split <;> (rename_i h; simp at hm₁ ⊢)
· rw [← hm₁ ⟨i, h₂⟩]; assumption
· cases show i = arr.size by apply Nat.le_antisymm <;> simp_all [Nat.lt_succ]
rw [hm₂]
|
import Mathlib.Algebra.Group.Prod
import Mathlib.Order.Cover
#align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
assert_not_exists MonoidWithZero
open Set
namespace Function
variable {α β A B M N P G : Type*}
section One
variable [One M] [One N] [One P]
@[to_additive "`support` of a function is the set of points `x` such that `f x ≠ 0`."]
def mulSupport (f : α → M) : Set α := {x | f x ≠ 1}
#align function.mul_support Function.mulSupport
#align function.support Function.support
@[to_additive]
theorem mulSupport_eq_preimage (f : α → M) : mulSupport f = f ⁻¹' {1}ᶜ :=
rfl
#align function.mul_support_eq_preimage Function.mulSupport_eq_preimage
#align function.support_eq_preimage Function.support_eq_preimage
@[to_additive]
theorem nmem_mulSupport {f : α → M} {x : α} : x ∉ mulSupport f ↔ f x = 1 :=
not_not
#align function.nmem_mul_support Function.nmem_mulSupport
#align function.nmem_support Function.nmem_support
@[to_additive]
theorem compl_mulSupport {f : α → M} : (mulSupport f)ᶜ = { x | f x = 1 } :=
ext fun _ => nmem_mulSupport
#align function.compl_mul_support Function.compl_mulSupport
#align function.compl_support Function.compl_support
@[to_additive (attr := simp)]
theorem mem_mulSupport {f : α → M} {x : α} : x ∈ mulSupport f ↔ f x ≠ 1 :=
Iff.rfl
#align function.mem_mul_support Function.mem_mulSupport
#align function.mem_support Function.mem_support
@[to_additive (attr := simp)]
theorem mulSupport_subset_iff {f : α → M} {s : Set α} : mulSupport f ⊆ s ↔ ∀ x, f x ≠ 1 → x ∈ s :=
Iff.rfl
#align function.mul_support_subset_iff Function.mulSupport_subset_iff
#align function.support_subset_iff Function.support_subset_iff
@[to_additive]
theorem mulSupport_subset_iff' {f : α → M} {s : Set α} :
mulSupport f ⊆ s ↔ ∀ x ∉ s, f x = 1 :=
forall_congr' fun _ => not_imp_comm
#align function.mul_support_subset_iff' Function.mulSupport_subset_iff'
#align function.support_subset_iff' Function.support_subset_iff'
@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1 := by
simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def,
not_imp_comm, and_comm, forall_and]
#align function.mul_support_eq_iff Function.mulSupport_eq_iff
#align function.support_eq_iff Function.support_eq_iff
@[to_additive]
theorem ext_iff_mulSupport {f g : α → M} :
f = g ↔ f.mulSupport = g.mulSupport ∧ ∀ x ∈ f.mulSupport, f x = g x :=
⟨fun h ↦ h ▸ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, h₂⟩ ↦ funext fun x ↦ by
if hx : x ∈ f.mulSupport then exact h₂ x hx
else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩
@[to_additive]
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
mulSupport (update f x y) = insert x (mulSupport f) := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
| Mathlib/Algebra/Group/Support.lean | 93 | 95 | theorem mulSupport_update_one [DecidableEq α] (f : α → M) (x : α) :
mulSupport (update f x 1) = mulSupport f \ {x} := by |
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
|
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.Module.Basic
import Mathlib.Algebra.Regular.SMul
import Mathlib.Data.Finset.Preimage
import Mathlib.Data.Rat.BigOperators
import Mathlib.GroupTheory.GroupAction.Hom
import Mathlib.Data.Set.Subsingleton
#align_import data.finsupp.basic from "leanprover-community/mathlib"@"f69db8cecc668e2d5894d7e9bfc491da60db3b9f"
noncomputable section
open Finset Function
variable {α β γ ι M M' N P G H R S : Type*}
namespace Finsupp
section Graph
variable [Zero M]
def graph (f : α →₀ M) : Finset (α × M) :=
f.support.map ⟨fun a => Prod.mk a (f a), fun _ _ h => (Prod.mk.inj h).1⟩
#align finsupp.graph Finsupp.graph
| Mathlib/Data/Finsupp/Basic.lean | 68 | 74 | theorem mk_mem_graph_iff {a : α} {m : M} {f : α →₀ M} : (a, m) ∈ f.graph ↔ f a = m ∧ m ≠ 0 := by |
simp_rw [graph, mem_map, mem_support_iff]
constructor
· rintro ⟨b, ha, rfl, -⟩
exact ⟨rfl, ha⟩
· rintro ⟨rfl, ha⟩
exact ⟨a, ha, rfl⟩
|
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ₛₗ
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 64 | 67 | 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ₛₗ]⟩
|
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Tactic.Ring
#align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
def hyperoperation : ℕ → ℕ → ℕ → ℕ
| 0, _, k => k + 1
| 1, m, 0 => m
| 2, _, 0 => 0
| _ + 3, _, 0 => 1
| n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k)
#align hyperoperation hyperoperation
-- Basic hyperoperation lemmas
@[simp]
theorem hyperoperation_zero (m : ℕ) : hyperoperation 0 m = Nat.succ :=
funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one]
#align hyperoperation_zero hyperoperation_zero
theorem hyperoperation_ge_three_eq_one (n m : ℕ) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
#align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
theorem hyperoperation_recursion (n m k : ℕ) :
hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by
rw [hyperoperation]
#align hyperoperation_recursion hyperoperation_recursion
-- Interesting hyperoperation lemmas
@[simp]
| Mathlib/Data/Nat/Hyperoperation.lean | 60 | 65 | theorem hyperoperation_one : hyperoperation 1 = (· + ·) := by |
ext m k
induction' k with bn bih
· rw [Nat.add_zero m, hyperoperation]
· rw [hyperoperation_recursion, bih, hyperoperation_zero]
exact Nat.add_assoc m bn 1
|
import Mathlib.Algebra.Group.Subsemigroup.Basic
#align_import group_theory.subsemigroup.membership from "leanprover-community/mathlib"@"6cb77a8eaff0ddd100e87b1591c6d3ad319514ff"
assert_not_exists MonoidWithZero
variable {ι : Sort*} {M A B : Type*}
section NonAssoc
variable [Mul M]
open Set
namespace Subsemigroup
-- TODO: this section can be generalized to `[MulMemClass B M] [CompleteLattice B]`
-- such that `complete_lattice.le` coincides with `set_like.le`
@[to_additive]
theorem mem_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) {x : M} :
(x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx ↦ closure_induction hx (fun y hy ↦ mem_iUnion.mp hy) ?_
rintro x y ⟨i, hi⟩ ⟨j, hj⟩
rcases hS i j with ⟨k, hki, hkj⟩
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
#align subsemigroup.mem_supr_of_directed Subsemigroup.mem_iSup_of_directed
#align add_subsemigroup.mem_supr_of_directed AddSubsemigroup.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {S : ι → Subsemigroup M} (hS : Directed (· ≤ ·) S) :
((⨆ i, S i : Subsemigroup M) : Set M) = ⋃ i, S i :=
Set.ext fun x => by simp [mem_iSup_of_directed hS]
#align subsemigroup.coe_supr_of_directed Subsemigroup.coe_iSup_of_directed
#align add_subsemigroup.coe_supr_of_directed AddSubsemigroup.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) {x : M} :
x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
simp only [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk,
exists_prop]
#align subsemigroup.mem_Sup_of_directed_on Subsemigroup.mem_sSup_of_directed_on
#align add_subsemigroup.mem_Sup_of_directed_on AddSubsemigroup.mem_sSup_of_directed_on
@[to_additive]
theorem coe_sSup_of_directed_on {S : Set (Subsemigroup M)} (hS : DirectedOn (· ≤ ·) S) :
(↑(sSup S) : Set M) = ⋃ s ∈ S, ↑s :=
Set.ext fun x => by simp [mem_sSup_of_directed_on hS]
#align subsemigroup.coe_Sup_of_directed_on Subsemigroup.coe_sSup_of_directed_on
#align add_subsemigroup.coe_Sup_of_directed_on AddSubsemigroup.coe_sSup_of_directed_on
@[to_additive]
theorem mem_sup_left {S T : Subsemigroup M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T := by
have : S ≤ S ⊔ T := le_sup_left
tauto
#align subsemigroup.mem_sup_left Subsemigroup.mem_sup_left
#align add_subsemigroup.mem_sup_left AddSubsemigroup.mem_sup_left
@[to_additive]
| Mathlib/Algebra/Group/Subsemigroup/Membership.lean | 89 | 91 | theorem mem_sup_right {S T : Subsemigroup M} : ∀ {x : M}, x ∈ T → x ∈ S ⊔ T := by |
have : T ≤ S ⊔ T := le_sup_right
tauto
|
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Data.ENat.Lattice
import Mathlib.Data.Part
import Mathlib.Tactic.NormNum
#align_import data.nat.part_enat from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8"
open Part hiding some
def PartENat : Type :=
Part ℕ
#align part_enat PartENat
namespace PartENat
@[coe]
def some : ℕ → PartENat :=
Part.some
#align part_enat.some PartENat.some
instance : Zero PartENat :=
⟨some 0⟩
instance : Inhabited PartENat :=
⟨0⟩
instance : One PartENat :=
⟨some 1⟩
instance : Add PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => get x h.1 + get y h.2⟩⟩
instance (n : ℕ) : Decidable (some n).Dom :=
isTrue trivial
@[simp]
theorem dom_some (x : ℕ) : (some x).Dom :=
trivial
#align part_enat.dom_some PartENat.dom_some
instance addCommMonoid : AddCommMonoid PartENat where
add := (· + ·)
zero := 0
add_comm x y := Part.ext' and_comm fun _ _ => add_comm _ _
zero_add x := Part.ext' (true_and_iff _) fun _ _ => zero_add _
add_zero x := Part.ext' (and_true_iff _) fun _ _ => add_zero _
add_assoc x y z := Part.ext' and_assoc fun _ _ => add_assoc _ _ _
nsmul := nsmulRec
instance : AddCommMonoidWithOne PartENat :=
{ PartENat.addCommMonoid with
one := 1
natCast := some
natCast_zero := rfl
natCast_succ := fun _ => Part.ext' (true_and_iff _).symm fun _ _ => rfl }
theorem some_eq_natCast (n : ℕ) : some n = n :=
rfl
#align part_enat.some_eq_coe PartENat.some_eq_natCast
instance : CharZero PartENat where
cast_injective := Part.some_injective
theorem natCast_inj {x y : ℕ} : (x : PartENat) = y ↔ x = y :=
Nat.cast_inj
#align part_enat.coe_inj PartENat.natCast_inj
@[simp]
theorem dom_natCast (x : ℕ) : (x : PartENat).Dom :=
trivial
#align part_enat.dom_coe PartENat.dom_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem dom_ofNat (x : ℕ) [x.AtLeastTwo] : (no_index (OfNat.ofNat x : PartENat)).Dom :=
trivial
@[simp]
theorem dom_zero : (0 : PartENat).Dom :=
trivial
@[simp]
theorem dom_one : (1 : PartENat).Dom :=
trivial
instance : CanLift PartENat ℕ (↑) Dom :=
⟨fun n hn => ⟨n.get hn, Part.some_get _⟩⟩
instance : LE PartENat :=
⟨fun x y => ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy⟩
instance : Top PartENat :=
⟨none⟩
instance : Bot PartENat :=
⟨0⟩
instance : Sup PartENat :=
⟨fun x y => ⟨x.Dom ∧ y.Dom, fun h => x.get h.1 ⊔ y.get h.2⟩⟩
theorem le_def (x y : PartENat) :
x ≤ y ↔ ∃ h : y.Dom → x.Dom, ∀ hy : y.Dom, x.get (h hy) ≤ y.get hy :=
Iff.rfl
#align part_enat.le_def PartENat.le_def
@[elab_as_elim]
protected theorem casesOn' {P : PartENat → Prop} :
∀ a : PartENat, P ⊤ → (∀ n : ℕ, P (some n)) → P a :=
Part.induction_on
#align part_enat.cases_on' PartENat.casesOn'
@[elab_as_elim]
protected theorem casesOn {P : PartENat → Prop} : ∀ a : PartENat, P ⊤ → (∀ n : ℕ, P n) → P a := by
exact PartENat.casesOn'
#align part_enat.cases_on PartENat.casesOn
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem top_add (x : PartENat) : ⊤ + x = ⊤ :=
Part.ext' (false_and_iff _) fun h => h.left.elim
#align part_enat.top_add PartENat.top_add
-- not a simp lemma as we will provide a `LinearOrderedAddCommMonoidWithTop` instance later
theorem add_top (x : PartENat) : x + ⊤ = ⊤ := by rw [add_comm, top_add]
#align part_enat.add_top PartENat.add_top
@[simp]
theorem natCast_get {x : PartENat} (h : x.Dom) : (x.get h : PartENat) = x := by
exact Part.ext' (iff_of_true trivial h) fun _ _ => rfl
#align part_enat.coe_get PartENat.natCast_get
@[simp, norm_cast]
theorem get_natCast' (x : ℕ) (h : (x : PartENat).Dom) : get (x : PartENat) h = x := by
rw [← natCast_inj, natCast_get]
#align part_enat.get_coe' PartENat.get_natCast'
theorem get_natCast {x : ℕ} : get (x : PartENat) (dom_natCast x) = x :=
get_natCast' _ _
#align part_enat.get_coe PartENat.get_natCast
| Mathlib/Data/Nat/PartENat.lean | 192 | 194 | theorem coe_add_get {x : ℕ} {y : PartENat} (h : ((x : PartENat) + y).Dom) :
get ((x : PartENat) + y) h = x + get y h.2 := by |
rfl
|
import Mathlib.Data.Set.Image
import Mathlib.Data.Set.Lattice
#align_import data.set.sigma from "leanprover-community/mathlib"@"2258b40dacd2942571c8ce136215350c702dc78f"
namespace Set
variable {ι ι' : Type*} {α β : ι → Type*} {s s₁ s₂ : Set ι} {t t₁ t₂ : ∀ i, Set (α i)}
{u : Set (Σ i, α i)} {x : Σ i, α i} {i j : ι} {a : α i}
@[simp]
theorem range_sigmaMk (i : ι) : range (Sigma.mk i : α i → Sigma α) = Sigma.fst ⁻¹' {i} := by
apply Subset.antisymm
· rintro _ ⟨b, rfl⟩
simp
· rintro ⟨x, y⟩ (rfl | _)
exact mem_range_self y
#align set.range_sigma_mk Set.range_sigmaMk
theorem preimage_image_sigmaMk_of_ne (h : i ≠ j) (s : Set (α j)) :
Sigma.mk i ⁻¹' (Sigma.mk j '' s) = ∅ := by
ext x
simp [h.symm]
#align set.preimage_image_sigma_mk_of_ne Set.preimage_image_sigmaMk_of_ne
theorem image_sigmaMk_preimage_sigmaMap_subset {β : ι' → Type*} (f : ι → ι')
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) ⊆ Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) :=
image_subset_iff.2 fun x hx ↦ ⟨g i x, hx, rfl⟩
#align set.image_sigma_mk_preimage_sigma_map_subset Set.image_sigmaMk_preimage_sigmaMap_subset
| Mathlib/Data/Set/Sigma.lean | 43 | 50 | theorem image_sigmaMk_preimage_sigmaMap {β : ι' → Type*} {f : ι → ι'} (hf : Function.Injective f)
(g : ∀ i, α i → β (f i)) (i : ι) (s : Set (β (f i))) :
Sigma.mk i '' (g i ⁻¹' s) = Sigma.map f g ⁻¹' (Sigma.mk (f i) '' s) := by |
refine (image_sigmaMk_preimage_sigmaMap_subset f g i s).antisymm ?_
rintro ⟨j, x⟩ ⟨y, hys, hxy⟩
simp only [hf.eq_iff, Sigma.map, Sigma.ext_iff] at hxy
rcases hxy with ⟨rfl, hxy⟩; rw [heq_iff_eq] at hxy; subst y
exact ⟨x, hys, rfl⟩
|
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Set.Finite
#align_import data.finset.n_ary from "leanprover-community/mathlib"@"eba7871095e834365616b5e43c8c7bb0b37058d0"
open Function Set
variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*}
namespace Finset
variable [DecidableEq α'] [DecidableEq β'] [DecidableEq γ] [DecidableEq γ'] [DecidableEq δ]
[DecidableEq δ'] [DecidableEq ε] [DecidableEq ε'] {f f' : α → β → γ} {g g' : α → β → γ → δ}
{s s' : Finset α} {t t' : Finset β} {u u' : Finset γ} {a a' : α} {b b' : β} {c : γ}
def image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) : Finset γ :=
(s ×ˢ t).image <| uncurry f
#align finset.image₂ Finset.image₂
@[simp]
theorem mem_image₂ : c ∈ image₂ f s t ↔ ∃ a ∈ s, ∃ b ∈ t, f a b = c := by
simp [image₂, and_assoc]
#align finset.mem_image₂ Finset.mem_image₂
@[simp, norm_cast]
theorem coe_image₂ (f : α → β → γ) (s : Finset α) (t : Finset β) :
(image₂ f s t : Set γ) = Set.image2 f s t :=
Set.ext fun _ => mem_image₂
#align finset.coe_image₂ Finset.coe_image₂
theorem card_image₂_le (f : α → β → γ) (s : Finset α) (t : Finset β) :
(image₂ f s t).card ≤ s.card * t.card :=
card_image_le.trans_eq <| card_product _ _
#align finset.card_image₂_le Finset.card_image₂_le
theorem card_image₂_iff :
(image₂ f s t).card = s.card * t.card ↔ (s ×ˢ t : Set (α × β)).InjOn fun x => f x.1 x.2 := by
rw [← card_product, ← coe_product]
exact card_image_iff
#align finset.card_image₂_iff Finset.card_image₂_iff
theorem card_image₂ (hf : Injective2 f) (s : Finset α) (t : Finset β) :
(image₂ f s t).card = s.card * t.card :=
(card_image_of_injective _ hf.uncurry).trans <| card_product _ _
#align finset.card_image₂ Finset.card_image₂
theorem mem_image₂_of_mem (ha : a ∈ s) (hb : b ∈ t) : f a b ∈ image₂ f s t :=
mem_image₂.2 ⟨a, ha, b, hb, rfl⟩
#align finset.mem_image₂_of_mem Finset.mem_image₂_of_mem
theorem mem_image₂_iff (hf : Injective2 f) : f a b ∈ image₂ f s t ↔ a ∈ s ∧ b ∈ t := by
rw [← mem_coe, coe_image₂, mem_image2_iff hf, mem_coe, mem_coe]
#align finset.mem_image₂_iff Finset.mem_image₂_iff
theorem image₂_subset (hs : s ⊆ s') (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s' t' := by
rw [← coe_subset, coe_image₂, coe_image₂]
exact image2_subset hs ht
#align finset.image₂_subset Finset.image₂_subset
theorem image₂_subset_left (ht : t ⊆ t') : image₂ f s t ⊆ image₂ f s t' :=
image₂_subset Subset.rfl ht
#align finset.image₂_subset_left Finset.image₂_subset_left
theorem image₂_subset_right (hs : s ⊆ s') : image₂ f s t ⊆ image₂ f s' t :=
image₂_subset hs Subset.rfl
#align finset.image₂_subset_right Finset.image₂_subset_right
theorem image_subset_image₂_left (hb : b ∈ t) : s.image (fun a => f a b) ⊆ image₂ f s t :=
image_subset_iff.2 fun _ ha => mem_image₂_of_mem ha hb
#align finset.image_subset_image₂_left Finset.image_subset_image₂_left
theorem image_subset_image₂_right (ha : a ∈ s) : t.image (fun b => f a b) ⊆ image₂ f s t :=
image_subset_iff.2 fun _ => mem_image₂_of_mem ha
#align finset.image_subset_image₂_right Finset.image_subset_image₂_right
| Mathlib/Data/Finset/NAry.lean | 98 | 100 | theorem forall_image₂_iff {p : γ → Prop} :
(∀ z ∈ image₂ f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) := by |
simp_rw [← mem_coe, coe_image₂, forall_image2_iff]
|
import Mathlib.Topology.Constructions
import Mathlib.Topology.Separation
open Set Filter Function Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : X → Y}
section codiscrete_filter
| Mathlib/Topology/DiscreteSubset.lean | 83 | 92 | theorem isClosed_and_discrete_iff {S : Set X} :
IsClosed S ∧ DiscreteTopology S ↔ ∀ x, Disjoint (𝓝[≠] x) (𝓟 S) := by |
rw [discreteTopology_subtype_iff, isClosed_iff_clusterPt, ← forall_and]
congrm (∀ x, ?_)
rw [← not_imp_not, clusterPt_iff_not_disjoint, not_not, ← disjoint_iff]
constructor <;> intro H
· by_cases hx : x ∈ S
exacts [H.2 hx, (H.1 hx).mono_left nhdsWithin_le_nhds]
· refine ⟨fun hx ↦ ?_, fun _ ↦ H⟩
simpa [disjoint_iff, nhdsWithin, inf_assoc, hx] using H
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
#align real.cosh_arsinh Real.cosh_arsinh
theorem sinh_surjective : Surjective sinh :=
LeftInverse.surjective sinh_arsinh
#align real.sinh_surjective Real.sinh_surjective
theorem sinh_bijective : Bijective sinh :=
⟨sinh_injective, sinh_surjective⟩
#align real.sinh_bijective Real.sinh_bijective
@[simp]
theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x :=
rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x
#align real.arsinh_sinh Real.arsinh_sinh
@[simps]
def sinhEquiv : ℝ ≃ ℝ where
toFun := sinh
invFun := arsinh
left_inv := arsinh_sinh
right_inv := sinh_arsinh
#align real.sinh_equiv Real.sinhEquiv
@[simps! (config := .asFn)]
def sinhOrderIso : ℝ ≃o ℝ where
toEquiv := sinhEquiv
map_rel_iff' := @sinh_le_sinh
#align real.sinh_order_iso Real.sinhOrderIso
@[simps! (config := .asFn)]
def sinhHomeomorph : ℝ ≃ₜ ℝ :=
sinhOrderIso.toHomeomorph
#align real.sinh_homeomorph Real.sinhHomeomorph
theorem arsinh_bijective : Bijective arsinh :=
sinhEquiv.symm.bijective
#align real.arsinh_bijective Real.arsinh_bijective
theorem arsinh_injective : Injective arsinh :=
sinhEquiv.symm.injective
#align real.arsinh_injective Real.arsinh_injective
theorem arsinh_surjective : Surjective arsinh :=
sinhEquiv.symm.surjective
#align real.arsinh_surjective Real.arsinh_surjective
theorem arsinh_strictMono : StrictMono arsinh :=
sinhOrderIso.symm.strictMono
#align real.arsinh_strict_mono Real.arsinh_strictMono
@[simp]
theorem arsinh_inj : arsinh x = arsinh y ↔ x = y :=
arsinh_injective.eq_iff
#align real.arsinh_inj Real.arsinh_inj
@[simp]
theorem arsinh_le_arsinh : arsinh x ≤ arsinh y ↔ x ≤ y :=
sinhOrderIso.symm.le_iff_le
#align real.arsinh_le_arsinh Real.arsinh_le_arsinh
@[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh
@[simp]
theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y :=
sinhOrderIso.symm.lt_iff_lt
#align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh
@[simp]
theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 :=
arsinh_injective.eq_iff' arsinh_zero
#align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 164 | 164 | theorem arsinh_nonneg_iff : 0 ≤ arsinh x ↔ 0 ≤ x := by | rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
#align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 93 | 98 | theorem differentiableWithinAt_arcsin_Iic {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by |
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩
rw [← neg_neg x, ← image_neg_Ici] at h
have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg
simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
|
import Mathlib.Data.DFinsupp.Lex
import Mathlib.Order.GameAdd
import Mathlib.Order.Antisymmetrization
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Tactic.AdaptationNote
#align_import data.dfinsupp.well_founded from "leanprover-community/mathlib"@"e9b8651eb1ad354f4de6be35a38ef31efcd2cfaa"
variable {ι : Type*} {α : ι → Type*}
namespace DFinsupp
open Relation Prod
section Zero
variable [∀ i, Zero (α i)] (r : ι → ι → Prop) (s : ∀ i, α i → α i → Prop)
| Mathlib/Data/DFinsupp/WellFounded.lean | 69 | 98 | theorem lex_fibration [∀ (i) (s : Set ι), Decidable (i ∈ s)] :
Fibration (InvImage (GameAdd (DFinsupp.Lex r s) (DFinsupp.Lex r s)) snd) (DFinsupp.Lex r s)
fun x => piecewise x.2.1 x.2.2 x.1 := by |
rintro ⟨p, x₁, x₂⟩ x ⟨i, hr, hs⟩
simp_rw [piecewise_apply] at hs hr
split_ifs at hs with hp
· refine ⟨⟨{ j | r j i → j ∈ p }, piecewise x₁ x { j | r j i }, x₂⟩,
.fst ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq]
· simp only [if_pos hj]
· split_ifs with hi
· rwa [hr i hi, if_pos hp] at hs
· assumption
· ext1 j
simp only [piecewise_apply, Set.mem_setOf_eq]
split_ifs with h₁ h₂ <;> try rfl
· rw [hr j h₂, if_pos (h₁ h₂)]
· rw [Classical.not_imp] at h₁
rw [hr j h₁.1, if_neg h₁.2]
· refine ⟨⟨{ j | r j i ∧ j ∈ p }, x₁, piecewise x₂ x { j | r j i }⟩,
.snd ⟨i, fun j hj ↦ ?_, ?_⟩, ?_⟩ <;> simp only [piecewise_apply, Set.mem_setOf_eq]
· exact if_pos hj
· split_ifs with hi
· rwa [hr i hi, if_neg hp] at hs
· assumption
· ext1 j
simp only [piecewise_apply, Set.mem_setOf_eq]
split_ifs with h₁ h₂ <;> try rfl
· rw [hr j h₁.1, if_pos h₁.2]
· rw [hr j h₂, if_neg]
simpa [h₂] using h₁
|
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
| Mathlib/Data/List/Duplicate.lean | 88 | 95 | 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
|
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}
| Mathlib/Combinatorics/SimpleGraph/Density.lean | 57 | 58 | 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]
|
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
| Mathlib/RingTheory/Coprime/Basic.lean | 84 | 86 | 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
|
import Mathlib.Data.Finset.Fin
import Mathlib.Data.Int.Order.Units
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.GroupTheory.Perm.Support
import Mathlib.Logic.Equiv.Fintype
#align_import group_theory.perm.sign from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u v
open Equiv Function Fintype Finset
variable {α : Type u} {β : Type v}
-- An example on how to determine the order of an element of a finite group.
example : orderOf (-1 : ℤˣ) = 2 :=
orderOf_eq_prime (Int.units_sq _) (by decide)
namespace Equiv.Perm
theorem perm_inv_on_of_perm_on_finset {s : Finset α} {f : Perm α} (h : ∀ x ∈ s, f x ∈ s) {y : α}
(hy : y ∈ s) : f⁻¹ y ∈ s := by
have h0 : ∀ y ∈ s, ∃ (x : _) (hx : x ∈ s), y = (fun i (_ : i ∈ s) => f i) x hx :=
Finset.surj_on_of_inj_on_of_card_le (fun x hx => (fun i _ => f i) x hx) (fun a ha => h a ha)
(fun a₁ a₂ ha₁ ha₂ heq => (Equiv.apply_eq_iff_eq f).mp heq) rfl.ge
obtain ⟨y2, hy2, heq⟩ := h0 y hy
convert hy2
rw [heq]
simp only [inv_apply_self]
#align equiv.perm.perm_inv_on_of_perm_on_finset Equiv.Perm.perm_inv_on_of_perm_on_finset
| Mathlib/GroupTheory/Perm/Finite.lean | 68 | 75 | theorem perm_inv_mapsTo_of_mapsTo (f : Perm α) {s : Set α} [Finite s] (h : Set.MapsTo f s s) :
Set.MapsTo (f⁻¹ : _) s s := by |
cases nonempty_fintype s
exact fun x hx =>
Set.mem_toFinset.mp <|
perm_inv_on_of_perm_on_finset
(fun a ha => Set.mem_toFinset.mpr (h (Set.mem_toFinset.mp ha)))
(Set.mem_toFinset.mpr hx)
|
import Mathlib.CategoryTheory.Opposites
#align_import category_theory.eq_to_hom from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe v₁ v₂ v₃ u₁ u₂ u₃
-- morphism levels before object levels. See note [CategoryTheory universes].
namespace CategoryTheory
open Opposite
variable {C : Type u₁} [Category.{v₁} C]
def eqToHom {X Y : C} (p : X = Y) : X ⟶ Y := by rw [p]; exact 𝟙 _
#align category_theory.eq_to_hom CategoryTheory.eqToHom
@[simp]
theorem eqToHom_refl (X : C) (p : X = X) : eqToHom p = 𝟙 X :=
rfl
#align category_theory.eq_to_hom_refl CategoryTheory.eqToHom_refl
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/EqToHom.lean | 52 | 56 | theorem eqToHom_trans {X Y Z : C} (p : X = Y) (q : Y = Z) :
eqToHom p ≫ eqToHom q = eqToHom (p.trans q) := by |
cases p
cases q
simp
|
import Mathlib.MeasureTheory.Measure.Lebesgue.Complex
import Mathlib.MeasureTheory.Integral.DivergenceTheorem
import Mathlib.MeasureTheory.Integral.CircleIntegral
import Mathlib.Analysis.Calculus.Dslope
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Complex.ReImTopology
import Mathlib.Analysis.Calculus.DiffContOnCl
import Mathlib.Analysis.Calculus.FDeriv.Analytic
import Mathlib.Data.Real.Cardinality
#align_import analysis.complex.cauchy_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open TopologicalSpace Set MeasureTheory intervalIntegral Metric Filter Function
open scoped Interval Real NNReal ENNReal Topology
noncomputable section
universe u
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E]
namespace Complex
| Mathlib/Analysis/Complex/CauchyIntegral.lean | 166 | 203 | theorem integral_boundary_rect_of_hasFDerivAt_real_off_countable (f : ℂ → E) (f' : ℂ → ℂ →L[ℝ] E)
(z w : ℂ) (s : Set ℂ) (hs : s.Countable)
(Hc : ContinuousOn f ([[z.re, w.re]] ×ℂ [[z.im, w.im]]))
(Hd : ∀ x ∈ Ioo (min z.re w.re) (max z.re w.re) ×ℂ Ioo (min z.im w.im) (max z.im w.im) \ s,
HasFDerivAt f (f' x) x)
(Hi : IntegrableOn (fun z => I • f' z 1 - f' z I) ([[z.re, w.re]] ×ℂ [[z.im, w.im]])) :
(∫ x : ℝ in z.re..w.re, f (x + z.im * I)) - (∫ x : ℝ in z.re..w.re, f (x + w.im * I)) +
I • (∫ y : ℝ in z.im..w.im, f (re w + y * I)) -
I • ∫ y : ℝ in z.im..w.im, f (re z + y * I) =
∫ x : ℝ in z.re..w.re, ∫ y : ℝ in z.im..w.im, I • f' (x + y * I) 1 - f' (x + y * I) I := by |
set e : (ℝ × ℝ) ≃L[ℝ] ℂ := equivRealProdCLM.symm
have he : ∀ x y : ℝ, ↑x + ↑y * I = e (x, y) := fun x y => (mk_eq_add_mul_I x y).symm
have he₁ : e (1, 0) = 1 := rfl; have he₂ : e (0, 1) = I := rfl
simp only [he] at *
set F : ℝ × ℝ → E := f ∘ e
set F' : ℝ × ℝ → ℝ × ℝ →L[ℝ] E := fun p => (f' (e p)).comp (e : ℝ × ℝ →L[ℝ] ℂ)
have hF' : ∀ p : ℝ × ℝ, (-(I • F' p)) (1, 0) + F' p (0, 1) = -(I • f' (e p) 1 - f' (e p) I) := by
rintro ⟨x, y⟩
simp only [F', ContinuousLinearMap.neg_apply, ContinuousLinearMap.smul_apply,
ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, he₁, he₂, neg_add_eq_sub,
neg_sub]
set R : Set (ℝ × ℝ) := [[z.re, w.re]] ×ˢ [[w.im, z.im]]
set t : Set (ℝ × ℝ) := e ⁻¹' s
rw [uIcc_comm z.im] at Hc Hi; rw [min_comm z.im, max_comm z.im] at Hd
have hR : e ⁻¹' ([[z.re, w.re]] ×ℂ [[w.im, z.im]]) = R := rfl
have htc : ContinuousOn F R := Hc.comp e.continuousOn hR.ge
have htd :
∀ p ∈ Ioo (min z.re w.re) (max z.re w.re) ×ˢ Ioo (min w.im z.im) (max w.im z.im) \ t,
HasFDerivAt F (F' p) p :=
fun p hp => (Hd (e p) hp).comp p e.hasFDerivAt
simp_rw [← intervalIntegral.integral_smul, intervalIntegral.integral_symm w.im z.im, ←
intervalIntegral.integral_neg, ← hF']
refine (integral2_divergence_prod_of_hasFDerivWithinAt_off_countable (fun p => -(I • F p)) F
(fun p => -(I • F' p)) F' z.re w.im w.re z.im t (hs.preimage e.injective)
(htc.const_smul _).neg htc (fun p hp => ((htd p hp).const_smul I).neg) htd ?_).symm
rw [← (volume_preserving_equiv_real_prod.symm _).integrableOn_comp_preimage
(MeasurableEquiv.measurableEmbedding _)] at Hi
simpa only [hF'] using Hi.neg
|
import Mathlib.Topology.Algebra.Valuation
import Mathlib.Topology.Algebra.WithZeroTopology
import Mathlib.Topology.Algebra.UniformField
#align_import topology.algebra.valued_field from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064"
open Filter Set
open Topology
section DivisionRing
variable {K : Type*} [DivisionRing K] {Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀]
section ValuationTopologicalDivisionRing
section InversionEstimate
variable (v : Valuation K Γ₀)
-- The following is the main technical lemma ensuring that inversion is continuous
-- in the topology induced by a valuation on a division ring (i.e. the next instance)
-- and the fact that a valued field is completable
-- [BouAC, VI.5.1 Lemme 1]
| Mathlib/Topology/Algebra/ValuedField.lean | 51 | 72 | theorem Valuation.inversion_estimate {x y : K} {γ : Γ₀ˣ} (y_ne : y ≠ 0)
(h : v (x - y) < min (γ * (v y * v y)) (v y)) : v (x⁻¹ - y⁻¹) < γ := by |
have hyp1 : v (x - y) < γ * (v y * v y) := lt_of_lt_of_le h (min_le_left _ _)
have hyp1' : v (x - y) * (v y * v y)⁻¹ < γ := mul_inv_lt_of_lt_mul₀ hyp1
have hyp2 : v (x - y) < v y := lt_of_lt_of_le h (min_le_right _ _)
have key : v x = v y := Valuation.map_eq_of_sub_lt v hyp2
have x_ne : x ≠ 0 := by
intro h
apply y_ne
rw [h, v.map_zero] at key
exact v.zero_iff.1 key.symm
have decomp : x⁻¹ - y⁻¹ = x⁻¹ * (y - x) * y⁻¹ := by
rw [mul_sub_left_distrib, sub_mul, mul_assoc, show y * y⁻¹ = 1 from mul_inv_cancel y_ne,
show x⁻¹ * x = 1 from inv_mul_cancel x_ne, mul_one, one_mul]
calc
v (x⁻¹ - y⁻¹) = v (x⁻¹ * (y - x) * y⁻¹) := by rw [decomp]
_ = v x⁻¹ * (v <| y - x) * v y⁻¹ := by repeat' rw [Valuation.map_mul]
_ = (v x)⁻¹ * (v <| y - x) * (v y)⁻¹ := by rw [map_inv₀, map_inv₀]
_ = (v <| y - x) * (v y * v y)⁻¹ := by rw [mul_assoc, mul_comm, key, mul_assoc, mul_inv_rev]
_ = (v <| y - x) * (v y * v y)⁻¹ := rfl
_ = (v <| x - y) * (v y * v y)⁻¹ := by rw [Valuation.map_sub_swap]
_ < γ := hyp1'
|
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Data.ZMod.Algebra
#align_import ring_theory.polynomial.cyclotomic.expand from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472"
namespace Polynomial
@[simp]
theorem cyclotomic_expand_eq_cyclotomic_mul {p n : ℕ} (hp : Nat.Prime p) (hdiv : ¬p ∣ n)
(R : Type*) [CommRing R] :
expand R p (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R := by
rcases Nat.eq_zero_or_pos n with (rfl | hnpos)
· simp
haveI := NeZero.of_pos hnpos
suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ by
rw [← map_cyclotomic_int, ← map_expand, this, Polynomial.map_mul, map_cyclotomic_int,
map_cyclotomic]
refine eq_of_monic_of_dvd_of_natDegree_le ((cyclotomic.monic _ ℤ).mul (cyclotomic.monic _ ℤ))
((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_
· refine (IsPrimitive.Int.dvd_iff_map_cast_dvd_map_cast _ _
(IsPrimitive.mul (cyclotomic.isPrimitive (n * p) ℤ) (cyclotomic.isPrimitive n ℤ))
((cyclotomic.monic n ℤ).expand hp.pos).isPrimitive).2 ?_
rw [Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic_int, map_expand, map_cyclotomic_int]
refine IsCoprime.mul_dvd (cyclotomic.isCoprime_rat fun h => ?_) ?_ ?_
· replace h : n * p = n * 1 := by simp [h]
exact Nat.Prime.ne_one hp (mul_left_cancel₀ hnpos.ne' h)
· have hpos : 0 < n * p := mul_pos hnpos hp.pos
have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne'
rw [cyclotomic_eq_minpoly_rat hprim hpos]
refine minpoly.dvd ℚ _ ?_
rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def,
@isRoot_cyclotomic_iff]
convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n)
rw [Nat.mul_div_cancel _ (Nat.Prime.pos hp)]
· have hprim := Complex.isPrimitiveRoot_exp _ hnpos.ne.symm
rw [cyclotomic_eq_minpoly_rat hprim hnpos]
refine minpoly.dvd ℚ _ ?_
rw [aeval_def, ← eval_map, map_expand, expand_eval, ← IsRoot.def, ←
cyclotomic_eq_minpoly_rat hprim hnpos, map_cyclotomic, @isRoot_cyclotomic_iff]
exact IsPrimitiveRoot.pow_of_prime hprim hp hdiv
· rw [natDegree_expand, natDegree_cyclotomic,
natDegree_mul (cyclotomic_ne_zero _ ℤ) (cyclotomic_ne_zero _ ℤ), natDegree_cyclotomic,
natDegree_cyclotomic, mul_comm n,
Nat.totient_mul ((Nat.Prime.coprime_iff_not_dvd hp).2 hdiv), Nat.totient_prime hp,
mul_comm (p - 1), ← Nat.mul_succ, Nat.sub_one, Nat.succ_pred_eq_of_pos hp.pos]
#align polynomial.cyclotomic_expand_eq_cyclotomic_mul Polynomial.cyclotomic_expand_eq_cyclotomic_mul
@[simp]
| Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean | 78 | 96 | theorem cyclotomic_expand_eq_cyclotomic {p n : ℕ} (hp : Nat.Prime p) (hdiv : p ∣ n) (R : Type*)
[CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R := by |
rcases n.eq_zero_or_pos with (rfl | hzero)
· simp
haveI := NeZero.of_pos hzero
suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ by
rw [← map_cyclotomic_int, ← map_expand, this, map_cyclotomic_int]
refine eq_of_monic_of_dvd_of_natDegree_le (cyclotomic.monic _ ℤ)
((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_
· have hpos := Nat.mul_pos hzero hp.pos
have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne.symm
rw [cyclotomic_eq_minpoly hprim hpos]
refine minpoly.isIntegrallyClosed_dvd (hprim.isIntegral hpos) ?_
rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def,
@isRoot_cyclotomic_iff]
convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n)
rw [Nat.mul_div_cancel _ hp.pos]
· rw [natDegree_expand, natDegree_cyclotomic, natDegree_cyclotomic, mul_comm n,
Nat.totient_mul_of_prime_of_dvd hp hdiv, mul_comm]
|
import Mathlib.Data.Nat.Choose.Basic
import Mathlib.Data.Nat.Factorial.Cast
#align_import data.nat.choose.cast from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496"
open Nat
variable (K : Type*) [DivisionRing K] [CharZero K]
namespace Nat
theorem cast_choose {a b : ℕ} (h : a ≤ b) : (b.choose a : K) = b ! / (a ! * (b - a)!) := by
have : ∀ {n : ℕ}, (n ! : K) ≠ 0 := Nat.cast_ne_zero.2 (factorial_ne_zero _)
rw [eq_div_iff_mul_eq (mul_ne_zero this this)]
rw_mod_cast [← mul_assoc, choose_mul_factorial_mul_factorial h]
#align nat.cast_choose Nat.cast_choose
| Mathlib/Data/Nat/Choose/Cast.lean | 31 | 32 | theorem cast_add_choose {a b : ℕ} : ((a + b).choose a : K) = (a + b)! / (a ! * b !) := by |
rw [cast_choose K (_root_.le_add_right le_rfl), add_tsub_cancel_left]
|
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.Topology.NoetherianSpace
#align_import algebraic_geometry.prime_spectrum.noetherian from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301"
universe u v
namespace PrimeSpectrum
open Submodule
variable (R : Type u) [CommRing R] [IsNoetherianRing R]
variable {A : Type u} [CommRing A] [IsDomain A] [IsNoetherianRing A]
| Mathlib/AlgebraicGeometry/PrimeSpectrum/Noetherian.lean | 27 | 54 | theorem exists_primeSpectrum_prod_le (I : Ideal R) :
∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I := by |
-- Porting note: Need to specify `P` explicitly
refine IsNoetherian.induction
(P := fun I => ∃ Z : Multiset (PrimeSpectrum R), Multiset.prod (Z.map asIdeal) ≤ I)
(fun (M : Ideal R) hgt => ?_) I
by_cases h_prM : M.IsPrime
· use {⟨M, h_prM⟩}
rw [Multiset.map_singleton, Multiset.prod_singleton]
by_cases htop : M = ⊤
· rw [htop]
exact ⟨0, le_top⟩
have lt_add : ∀ z ∉ M, M < M + span R {z} := by
intro z hz
refine lt_of_le_of_ne le_sup_left fun m_eq => hz ?_
rw [m_eq]
exact Ideal.mem_sup_right (mem_span_singleton_self z)
obtain ⟨x, hx, y, hy, hxy⟩ := (Ideal.not_isPrime_iff.mp h_prM).resolve_left htop
obtain ⟨Wx, h_Wx⟩ := hgt (M + span R {x}) (lt_add _ hx)
obtain ⟨Wy, h_Wy⟩ := hgt (M + span R {y}) (lt_add _ hy)
use Wx + Wy
rw [Multiset.map_add, Multiset.prod_add]
apply le_trans (Submodule.mul_le_mul h_Wx h_Wy)
rw [add_mul]
apply sup_le (show M * (M + span R {y}) ≤ M from Ideal.mul_le_right)
rw [mul_add]
apply sup_le (show span R {x} * M ≤ M from Ideal.mul_le_left)
rwa [span_mul_span, Set.singleton_mul_singleton, span_singleton_le_iff_mem]
|
import Mathlib.Data.Nat.Defs
import Mathlib.Tactic.GCongr.Core
import Mathlib.Tactic.Common
import Mathlib.Tactic.Monotonicity.Attr
#align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
namespace Nat
def factorial : ℕ → ℕ
| 0 => 1
| succ n => succ n * factorial n
#align nat.factorial Nat.factorial
scoped notation:10000 n "!" => Nat.factorial n
section DescFactorial
def descFactorial (n : ℕ) : ℕ → ℕ
| 0 => 1
| k + 1 => (n - k) * descFactorial n k
#align nat.desc_factorial Nat.descFactorial
@[simp]
theorem descFactorial_zero (n : ℕ) : n.descFactorial 0 = 1 :=
rfl
#align nat.desc_factorial_zero Nat.descFactorial_zero
@[simp]
theorem descFactorial_succ (n k : ℕ) : n.descFactorial (k + 1) = (n - k) * n.descFactorial k :=
rfl
#align nat.desc_factorial_succ Nat.descFactorial_succ
| Mathlib/Data/Nat/Factorial/Basic.lean | 340 | 341 | theorem zero_descFactorial_succ (k : ℕ) : (0 : ℕ).descFactorial (k + 1) = 0 := by |
rw [descFactorial_succ, Nat.zero_sub, Nat.zero_mul]
|
import Mathlib.Data.Real.Irrational
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Algebra.LinearRecurrence
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.Prime
#align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
noncomputable section
open Polynomial
abbrev goldenRatio : ℝ := (1 + √5) / 2
#align golden_ratio goldenRatio
abbrev goldenConj : ℝ := (1 - √5) / 2
#align golden_conj goldenConj
@[inherit_doc goldenRatio] scoped[goldenRatio] notation "φ" => goldenRatio
@[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj
open Real goldenRatio
theorem inv_gold : φ⁻¹ = -ψ := by
have : 1 + √5 ≠ 0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num))
field_simp [sub_mul, mul_add]
norm_num
#align inv_gold inv_gold
| Mathlib/Data/Real/GoldenRatio.lean | 51 | 53 | theorem inv_goldConj : ψ⁻¹ = -φ := by |
rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg]
exact inv_gold.symm
|
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section TypeclassesLeftLE
variable [LE α] [CovariantClass α α (· * ·) (· ≤ ·)] {a b c d : α}
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by
rw [← mul_le_mul_iff_left a]
simp
#align left.inv_le_one_iff Left.inv_le_one_iff
#align left.neg_nonpos_iff Left.neg_nonpos_iff
@[to_additive (attr := simp) "Uses `left` co(ntra)variant."]
theorem Left.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1 := by
rw [← mul_le_mul_iff_left a]
simp
#align left.one_le_inv_iff Left.one_le_inv_iff
#align left.nonneg_neg_iff Left.nonneg_neg_iff
@[to_additive (attr := simp)]
theorem le_inv_mul_iff_mul_le : b ≤ a⁻¹ * c ↔ a * b ≤ c := by
rw [← mul_le_mul_iff_left a]
simp
#align le_inv_mul_iff_mul_le le_inv_mul_iff_mul_le
#align le_neg_add_iff_add_le le_neg_add_iff_add_le
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 120 | 121 | theorem inv_mul_le_iff_le_mul : b⁻¹ * a ≤ c ↔ a ≤ b * c := by |
rw [← mul_le_mul_iff_left b, mul_inv_cancel_left]
|
import Batteries.Data.Sum.Basic
import Batteries.Logic
open Function
namespace Sum
@[simp] protected theorem «forall» {p : α ⊕ β → Prop} :
(∀ x, p x) ↔ (∀ a, p (inl a)) ∧ ∀ b, p (inr b) :=
⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, h₂⟩ => Sum.rec h₁ h₂⟩
@[simp] protected theorem «exists» {p : α ⊕ β → Prop} :
(∃ x, p x) ↔ (∃ a, p (inl a)) ∨ ∃ b, p (inr b) :=
⟨ fun
| ⟨inl a, h⟩ => Or.inl ⟨a, h⟩
| ⟨inr b, h⟩ => Or.inr ⟨b, h⟩,
fun
| Or.inl ⟨a, h⟩ => ⟨inl a, h⟩
| Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩
theorem forall_sum {γ : α ⊕ β → Sort _} (p : (∀ ab, γ ab) → Prop) :
(∀ fab, p fab) ↔ (∀ fa fb, p (Sum.rec fa fb)) := by
refine ⟨fun h fa fb => h _, fun h fab => ?_⟩
have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by
ext ab; cases ab <;> rfl
rw [h1]; exact h _ _
section get
@[simp] theorem inl_getLeft : ∀ (x : α ⊕ β) (h : x.isLeft), inl (x.getLeft h) = x
| inl _, _ => rfl
@[simp] theorem inr_getRight : ∀ (x : α ⊕ β) (h : x.isRight), inr (x.getRight h) = x
| inr _, _ => rfl
@[simp] theorem getLeft?_eq_none_iff {x : α ⊕ β} : x.getLeft? = none ↔ x.isRight := by
cases x <;> simp only [getLeft?, isRight, eq_self_iff_true]
@[simp] theorem getRight?_eq_none_iff {x : α ⊕ β} : x.getRight? = none ↔ x.isLeft := by
cases x <;> simp only [getRight?, isLeft, eq_self_iff_true]
theorem eq_left_getLeft_of_isLeft : ∀ {x : α ⊕ β} (h : x.isLeft), x = inl (x.getLeft h)
| inl _, _ => rfl
@[simp] theorem getLeft_eq_iff (h : x.isLeft) : x.getLeft h = a ↔ x = inl a := by
cases x <;> simp at h ⊢
theorem eq_right_getRight_of_isRight : ∀ {x : α ⊕ β} (h : x.isRight), x = inr (x.getRight h)
| inr _, _ => rfl
@[simp] theorem getRight_eq_iff (h : x.isRight) : x.getRight h = b ↔ x = inr b := by
cases x <;> simp at h ⊢
@[simp] theorem getLeft?_eq_some_iff : x.getLeft? = some a ↔ x = inl a := by
cases x <;> simp only [getLeft?, Option.some.injEq, inl.injEq]
@[simp] theorem getRight?_eq_some_iff : x.getRight? = some b ↔ x = inr b := by
cases x <;> simp only [getRight?, Option.some.injEq, inr.injEq]
@[simp] theorem bnot_isLeft (x : α ⊕ β) : !x.isLeft = x.isRight := by cases x <;> rfl
@[simp] theorem isLeft_eq_false {x : α ⊕ β} : x.isLeft = false ↔ x.isRight := by cases x <;> simp
theorem not_isLeft {x : α ⊕ β} : ¬x.isLeft ↔ x.isRight := by simp
@[simp] theorem bnot_isRight (x : α ⊕ β) : !x.isRight = x.isLeft := by cases x <;> rfl
@[simp] theorem isRight_eq_false {x : α ⊕ β} : x.isRight = false ↔ x.isLeft := by cases x <;> simp
| .lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean | 81 | 81 | theorem not_isRight {x : α ⊕ β} : ¬x.isRight ↔ x.isLeft := by | simp
|
import Mathlib.Algebra.Lie.Matrix
import Mathlib.LinearAlgebra.Matrix.SesquilinearForm
import Mathlib.Tactic.NoncommRing
#align_import algebra.lie.skew_adjoint from "leanprover-community/mathlib"@"075b3f7d19b9da85a0b54b3e33055a74fc388dec"
universe u v w w₁
section SkewAdjointMatrices
open scoped Matrix
variable {R : Type u} {n : Type w} [CommRing R] [DecidableEq n] [Fintype n]
variable (J : Matrix n n R)
theorem Matrix.lie_transpose (A B : Matrix n n R) : ⁅A, B⁆ᵀ = ⁅Bᵀ, Aᵀ⁆ :=
show (A * B - B * A)ᵀ = Bᵀ * Aᵀ - Aᵀ * Bᵀ by simp
#align matrix.lie_transpose Matrix.lie_transpose
-- Porting note: Changed `(A B)` to `{A B}` for convenience in `skewAdjointMatricesLieSubalgebra`
theorem Matrix.isSkewAdjoint_bracket {A B : Matrix n n R} (hA : A ∈ skewAdjointMatricesSubmodule J)
(hB : B ∈ skewAdjointMatricesSubmodule J) : ⁅A, B⁆ ∈ skewAdjointMatricesSubmodule J := by
simp only [mem_skewAdjointMatricesSubmodule] at *
change ⁅A, B⁆ᵀ * J = J * (-⁅A, B⁆)
change Aᵀ * J = J * (-A) at hA
change Bᵀ * J = J * (-B) at hB
rw [Matrix.lie_transpose, LieRing.of_associative_ring_bracket,
LieRing.of_associative_ring_bracket, sub_mul, mul_assoc, mul_assoc, hA, hB, ← mul_assoc,
← mul_assoc, hA, hB]
noncomm_ring
#align matrix.is_skew_adjoint_bracket Matrix.isSkewAdjoint_bracket
def skewAdjointMatricesLieSubalgebra : LieSubalgebra R (Matrix n n R) :=
{ skewAdjointMatricesSubmodule J with
lie_mem' := J.isSkewAdjoint_bracket }
#align skew_adjoint_matrices_lie_subalgebra skewAdjointMatricesLieSubalgebra
@[simp]
theorem mem_skewAdjointMatricesLieSubalgebra (A : Matrix n n R) :
A ∈ skewAdjointMatricesLieSubalgebra J ↔ A ∈ skewAdjointMatricesSubmodule J :=
Iff.rfl
#align mem_skew_adjoint_matrices_lie_subalgebra mem_skewAdjointMatricesLieSubalgebra
def skewAdjointMatricesLieSubalgebraEquiv (P : Matrix n n R) (h : Invertible P) :
skewAdjointMatricesLieSubalgebra J ≃ₗ⁅R⁆ skewAdjointMatricesLieSubalgebra (Pᵀ * J * P) :=
LieEquiv.ofSubalgebras _ _ (P.lieConj h).symm <| by
ext A
suffices P.lieConj h A ∈ skewAdjointMatricesSubmodule J ↔
A ∈ skewAdjointMatricesSubmodule (Pᵀ * J * P) by
simp only [LieSubalgebra.mem_coe, Submodule.mem_map_equiv, LieSubalgebra.mem_map_submodule,
LinearEquiv.coe_coe]
exact this
simp [Matrix.IsSkewAdjoint, J.isAdjointPair_equiv _ _ P (isUnit_of_invertible P)]
#align skew_adjoint_matrices_lie_subalgebra_equiv skewAdjointMatricesLieSubalgebraEquiv
-- TODO(mathlib4#6607): fix elaboration so annotation on `A` isn't needed
theorem skewAdjointMatricesLieSubalgebraEquiv_apply (P : Matrix n n R) (h : Invertible P)
(A : skewAdjointMatricesLieSubalgebra J) :
↑(skewAdjointMatricesLieSubalgebraEquiv J P h A) = P⁻¹ * (A : Matrix n n R) * P := by
simp [skewAdjointMatricesLieSubalgebraEquiv]
#align skew_adjoint_matrices_lie_subalgebra_equiv_apply skewAdjointMatricesLieSubalgebraEquiv_apply
def skewAdjointMatricesLieSubalgebraEquivTranspose {m : Type w} [DecidableEq m] [Fintype m]
(e : Matrix n n R ≃ₐ[R] Matrix m m R) (h : ∀ A, (e A)ᵀ = e Aᵀ) :
skewAdjointMatricesLieSubalgebra J ≃ₗ⁅R⁆ skewAdjointMatricesLieSubalgebra (e J) :=
LieEquiv.ofSubalgebras _ _ e.toLieEquiv <| by
ext A
suffices J.IsSkewAdjoint (e.symm A) ↔ (e J).IsSkewAdjoint A by
-- Porting note: Originally `simpa [this]`
simpa [- LieSubalgebra.mem_map, LieSubalgebra.mem_map_submodule]
simp only [Matrix.IsSkewAdjoint, Matrix.IsAdjointPair, ← h,
← Function.Injective.eq_iff e.injective, map_mul, AlgEquiv.apply_symm_apply, map_neg]
#align skew_adjoint_matrices_lie_subalgebra_equiv_transpose skewAdjointMatricesLieSubalgebraEquivTranspose
@[simp]
theorem skewAdjointMatricesLieSubalgebraEquivTranspose_apply {m : Type w} [DecidableEq m]
[Fintype m] (e : Matrix n n R ≃ₐ[R] Matrix m m R) (h : ∀ A, (e A)ᵀ = e Aᵀ)
(A : skewAdjointMatricesLieSubalgebra J) :
(skewAdjointMatricesLieSubalgebraEquivTranspose J e h A : Matrix m m R) = e A :=
rfl
#align skew_adjoint_matrices_lie_subalgebra_equiv_transpose_apply skewAdjointMatricesLieSubalgebraEquivTranspose_apply
| Mathlib/Algebra/Lie/SkewAdjoint.lean | 170 | 176 | theorem mem_skewAdjointMatricesLieSubalgebra_unit_smul (u : Rˣ) (J A : Matrix n n R) :
A ∈ skewAdjointMatricesLieSubalgebra (u • J) ↔ A ∈ skewAdjointMatricesLieSubalgebra J := by |
change A ∈ skewAdjointMatricesSubmodule (u • J) ↔ A ∈ skewAdjointMatricesSubmodule J
simp only [mem_skewAdjointMatricesSubmodule, Matrix.IsSkewAdjoint, Matrix.IsAdjointPair]
constructor <;> intro h
· simpa using congr_arg (fun B => u⁻¹ • B) h
· simp [h]
|
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Computability.Primrec
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Linarith
#align_import computability.ackermann from "leanprover-community/mathlib"@"9b2660e1b25419042c8da10bf411aa3c67f14383"
open Nat
def ack : ℕ → ℕ → ℕ
| 0, n => n + 1
| m + 1, 0 => ack m 1
| m + 1, n + 1 => ack m (ack (m + 1) n)
#align ack ack
@[simp]
theorem ack_zero (n : ℕ) : ack 0 n = n + 1 := by rw [ack]
#align ack_zero ack_zero
@[simp]
| Mathlib/Computability/Ackermann.lean | 74 | 74 | theorem ack_succ_zero (m : ℕ) : ack (m + 1) 0 = ack m 1 := by | rw [ack]
|
import Mathlib.Algebra.Group.Prod
import Mathlib.Order.Cover
#align_import algebra.support from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1"
assert_not_exists MonoidWithZero
open Set
namespace Function
variable {α β A B M N P G : Type*}
section One
variable [One M] [One N] [One P]
@[to_additive "`support` of a function is the set of points `x` such that `f x ≠ 0`."]
def mulSupport (f : α → M) : Set α := {x | f x ≠ 1}
#align function.mul_support Function.mulSupport
#align function.support Function.support
@[to_additive]
theorem mulSupport_eq_preimage (f : α → M) : mulSupport f = f ⁻¹' {1}ᶜ :=
rfl
#align function.mul_support_eq_preimage Function.mulSupport_eq_preimage
#align function.support_eq_preimage Function.support_eq_preimage
@[to_additive]
theorem nmem_mulSupport {f : α → M} {x : α} : x ∉ mulSupport f ↔ f x = 1 :=
not_not
#align function.nmem_mul_support Function.nmem_mulSupport
#align function.nmem_support Function.nmem_support
@[to_additive]
theorem compl_mulSupport {f : α → M} : (mulSupport f)ᶜ = { x | f x = 1 } :=
ext fun _ => nmem_mulSupport
#align function.compl_mul_support Function.compl_mulSupport
#align function.compl_support Function.compl_support
@[to_additive (attr := simp)]
theorem mem_mulSupport {f : α → M} {x : α} : x ∈ mulSupport f ↔ f x ≠ 1 :=
Iff.rfl
#align function.mem_mul_support Function.mem_mulSupport
#align function.mem_support Function.mem_support
@[to_additive (attr := simp)]
theorem mulSupport_subset_iff {f : α → M} {s : Set α} : mulSupport f ⊆ s ↔ ∀ x, f x ≠ 1 → x ∈ s :=
Iff.rfl
#align function.mul_support_subset_iff Function.mulSupport_subset_iff
#align function.support_subset_iff Function.support_subset_iff
@[to_additive]
theorem mulSupport_subset_iff' {f : α → M} {s : Set α} :
mulSupport f ⊆ s ↔ ∀ x ∉ s, f x = 1 :=
forall_congr' fun _ => not_imp_comm
#align function.mul_support_subset_iff' Function.mulSupport_subset_iff'
#align function.support_subset_iff' Function.support_subset_iff'
@[to_additive]
theorem mulSupport_eq_iff {f : α → M} {s : Set α} :
mulSupport f = s ↔ (∀ x, x ∈ s → f x ≠ 1) ∧ ∀ x, x ∉ s → f x = 1 := by
simp (config := { contextual := true }) only [ext_iff, mem_mulSupport, ne_eq, iff_def,
not_imp_comm, and_comm, forall_and]
#align function.mul_support_eq_iff Function.mulSupport_eq_iff
#align function.support_eq_iff Function.support_eq_iff
@[to_additive]
theorem ext_iff_mulSupport {f g : α → M} :
f = g ↔ f.mulSupport = g.mulSupport ∧ ∀ x ∈ f.mulSupport, f x = g x :=
⟨fun h ↦ h ▸ ⟨rfl, fun _ _ ↦ rfl⟩, fun ⟨h₁, h₂⟩ ↦ funext fun x ↦ by
if hx : x ∈ f.mulSupport then exact h₂ x hx
else rw [nmem_mulSupport.1 hx, nmem_mulSupport.1 (mt (Set.ext_iff.1 h₁ x).2 hx)]⟩
@[to_additive]
theorem mulSupport_update_of_ne_one [DecidableEq α] (f : α → M) (x : α) {y : M} (hy : y ≠ 1) :
mulSupport (update f x y) = insert x (mulSupport f) := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
theorem mulSupport_update_one [DecidableEq α] (f : α → M) (x : α) :
mulSupport (update f x 1) = mulSupport f \ {x} := by
ext a; rcases eq_or_ne a x with rfl | hne <;> simp [*]
@[to_additive]
| Mathlib/Algebra/Group/Support.lean | 98 | 100 | theorem mulSupport_update_eq_ite [DecidableEq α] [DecidableEq M] (f : α → M) (x : α) (y : M) :
mulSupport (update f x y) = if y = 1 then mulSupport f \ {x} else insert x (mulSupport f) := by |
rcases eq_or_ne y 1 with rfl | hy <;> simp [mulSupport_update_one, mulSupport_update_of_ne_one, *]
|
import Mathlib.Analysis.SpecialFunctions.Complex.Log
import Mathlib.RingTheory.RootsOfUnity.Basic
#align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
namespace Complex
open Polynomial Real
open scoped Nat Real
theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) :
IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by
rw [IsPrimitiveRoot.iff_def]
simp only [← exp_nat_mul, exp_eq_one_iff]
have hn0 : (n : ℂ) ≠ 0 := mod_cast h0
constructor
· use i
field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)]
· simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff,
mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps]
norm_cast
rintro l k hk
conv_rhs at hk => rw [mul_comm, ← mul_assoc]
have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero]
field_simp [hz] at hk
norm_cast at hk
have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left
exact hi.symm.dvd_of_dvd_mul_left this
#align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
simpa only [Nat.cast_one, one_div] using
isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left
#align complex.is_primitive_root_exp Complex.isPrimitiveRoot_exp
| Mathlib/RingTheory/RootsOfUnity/Complex.lean | 58 | 69 | theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) :
IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ := by |
have hn0 : (n : ℂ) ≠ 0 := mod_cast hn
constructor; swap
· rintro ⟨i, -, hi, rfl⟩; exact isPrimitiveRoot_exp_of_coprime i n hn hi
intro h
obtain ⟨i, hi, rfl⟩ :=
(isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one (Nat.pos_of_ne_zero hn)
refine ⟨i, hi, ((isPrimitiveRoot_exp n hn).pow_iff_coprime (Nat.pos_of_ne_zero hn) i).mp h, ?_⟩
rw [← exp_nat_mul]
congr 1
field_simp [hn0, mul_comm (i : ℂ)]
|
import Mathlib.Algebra.Order.Ring.Int
#align_import data.int.least_greatest from "leanprover-community/mathlib"@"3342d1b2178381196f818146ff79bc0e7ccd9e2d"
namespace Int
def leastOfBdd {P : ℤ → Prop} [DecidablePred P] (b : ℤ) (Hb : ∀ z : ℤ, P z → b ≤ z)
(Hinh : ∃ z : ℤ, P z) : { lb : ℤ // P lb ∧ ∀ z : ℤ, P z → lb ≤ z } :=
have EX : ∃ n : ℕ, P (b + n) :=
let ⟨elt, Helt⟩ := Hinh
match elt, le.dest (Hb _ Helt), Helt with
| _, ⟨n, rfl⟩, Hn => ⟨n, Hn⟩
⟨b + (Nat.find EX : ℤ), Nat.find_spec EX, fun z h =>
match z, le.dest (Hb _ h), h with
| _, ⟨_, rfl⟩, h => add_le_add_left (Int.ofNat_le.2 <| Nat.find_min' _ h) _⟩
#align int.least_of_bdd Int.leastOfBdd
theorem exists_least_of_bdd
{P : ℤ → Prop}
(Hbdd : ∃ b : ℤ , ∀ z : ℤ , P z → b ≤ z)
(Hinh : ∃ z : ℤ , P z) : ∃ lb : ℤ , P lb ∧ ∀ z : ℤ , P z → lb ≤ z := by
classical
let ⟨b , Hb⟩ := Hbdd
let ⟨lb , H⟩ := leastOfBdd b Hb Hinh
exact ⟨lb , H⟩
#align int.exists_least_of_bdd Int.exists_least_of_bdd
| Mathlib/Data/Int/LeastGreatest.lean | 71 | 76 | theorem coe_leastOfBdd_eq {P : ℤ → Prop} [DecidablePred P] {b b' : ℤ} (Hb : ∀ z : ℤ, P z → b ≤ z)
(Hb' : ∀ z : ℤ, P z → b' ≤ z) (Hinh : ∃ z : ℤ, P z) :
(leastOfBdd b Hb Hinh : ℤ) = leastOfBdd b' Hb' Hinh := by |
rcases leastOfBdd b Hb Hinh with ⟨n, hn, h2n⟩
rcases leastOfBdd b' Hb' Hinh with ⟨n', hn', h2n'⟩
exact le_antisymm (h2n _ hn') (h2n' _ hn)
|
import Mathlib.MeasureTheory.Group.Measure
import Mathlib.MeasureTheory.Integral.IntegrableOn
import Mathlib.MeasureTheory.Function.LocallyIntegrable
open Asymptotics MeasureTheory Set Filter
variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F]
{f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α}
theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l]
(hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) :
IntegrableAtFilter f l μ := by
obtain ⟨C, hC⟩ := hf.bound
obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ :=
(hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets
refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩
refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_
exact (hfg x hx).trans (le_abs_self _)
theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ)
(hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by
rewrite [← integrableAtFilter_top] at *
exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg
variable [TopologicalSpace α] [SecondCountableTopology α]
namespace MeasureTheory
| Mathlib/MeasureTheory/Integral/Asymptotics.lean | 58 | 62 | theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)]
(hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g)
(hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by |
refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩
exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.