Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | goals listlengths 0 224 | goals_before listlengths 0 221 |
|---|---|---|---|---|---|---|---|
import Mathlib.Analysis.Calculus.ContDiff.Defs
import Mathlib.Analysis.Calculus.FDeriv.Add
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Inverse
#align_import analysis.calculus.cont_diff from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical NNReal Nat
local notation "β" => (β€ : ββ)
universe u v w uD uE uF uG
attribute [local instance 1001]
NormedAddCommGroup.toAddCommGroup NormedSpace.toModule' AddCommGroup.toAddCommMonoid
open Set Fin Filter Function
open scoped Topology
variable {π : Type*} [NontriviallyNormedField π] {D : Type uD} [NormedAddCommGroup D]
[NormedSpace π D] {E : Type uE} [NormedAddCommGroup E] [NormedSpace π E] {F : Type uF}
[NormedAddCommGroup F] [NormedSpace π F] {G : Type uG} [NormedAddCommGroup G] [NormedSpace π G]
{X : Type*} [NormedAddCommGroup X] [NormedSpace π X] {s sβ t u : Set E} {f fβ : E β F}
{g : F β G} {x xβ : E} {c : F} {b : E Γ F β G} {m n : ββ} {p : E β FormalMultilinearSeries π E F}
@[simp]
theorem iteratedFDerivWithin_zero_fun (hs : UniqueDiffOn π s) (hx : x β s) {i : β} :
iteratedFDerivWithin π i (fun _ : E β¦ (0 : F)) s x = 0 := by
induction i generalizing x with
| zero => ext; simp
| succ i IH =>
ext m
rw [iteratedFDerivWithin_succ_apply_left, fderivWithin_congr (fun _ β¦ IH) (IH hx)]
rw [fderivWithin_const_apply _ (hs x hx)]
rfl
@[simp]
theorem iteratedFDeriv_zero_fun {n : β} : (iteratedFDeriv π n fun _ : E β¦ (0 : F)) = 0 :=
funext fun x β¦ by simpa [β iteratedFDerivWithin_univ] using
iteratedFDerivWithin_zero_fun uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_zero_fun iteratedFDeriv_zero_fun
theorem contDiff_zero_fun : ContDiff π n fun _ : E => (0 : F) :=
contDiff_of_differentiable_iteratedFDeriv fun m _ => by
rw [iteratedFDeriv_zero_fun]
exact differentiable_const (0 : E[Γm]βL[π] F)
#align cont_diff_zero_fun contDiff_zero_fun
theorem contDiff_const {c : F} : ContDiff π n fun _ : E => c := by
suffices h : ContDiff π β fun _ : E => c from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine β¨differentiable_const c, ?_β©
rw [fderiv_const]
exact contDiff_zero_fun
#align cont_diff_const contDiff_const
theorem contDiffOn_const {c : F} {s : Set E} : ContDiffOn π n (fun _ : E => c) s :=
contDiff_const.contDiffOn
#align cont_diff_on_const contDiffOn_const
theorem contDiffAt_const {c : F} : ContDiffAt π n (fun _ : E => c) x :=
contDiff_const.contDiffAt
#align cont_diff_at_const contDiffAt_const
theorem contDiffWithinAt_const {c : F} : ContDiffWithinAt π n (fun _ : E => c) s x :=
contDiffAt_const.contDiffWithinAt
#align cont_diff_within_at_const contDiffWithinAt_const
@[nontriviality]
theorem contDiff_of_subsingleton [Subsingleton F] : ContDiff π n f := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiff_const
#align cont_diff_of_subsingleton contDiff_of_subsingleton
@[nontriviality]
theorem contDiffAt_of_subsingleton [Subsingleton F] : ContDiffAt π n f x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffAt_const
#align cont_diff_at_of_subsingleton contDiffAt_of_subsingleton
@[nontriviality]
theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt π n f s x := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
#align cont_diff_within_at_of_subsingleton contDiffWithinAt_of_subsingleton
@[nontriviality]
theorem contDiffOn_of_subsingleton [Subsingleton F] : ContDiffOn π n f s := by
rw [Subsingleton.elim f fun _ => 0]; exact contDiffOn_const
#align cont_diff_on_of_subsingleton contDiffOn_of_subsingleton
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 126 | 132 | theorem iteratedFDerivWithin_succ_const (n : β) (c : F) (hs : UniqueDiffOn π s) (hx : x β s) :
iteratedFDerivWithin π (n + 1) (fun _ : E β¦ c) s x = 0 := by |
ext m
rw [iteratedFDerivWithin_succ_apply_right hs hx]
rw [iteratedFDerivWithin_congr (fun y hy β¦ fderivWithin_const_apply c (hs y hy)) hx]
rw [iteratedFDerivWithin_zero_fun hs hx]
simp [ContinuousMultilinearMap.zero_apply (R := π)]
| [
" iteratedFDerivWithin π i (fun x => 0) s x = 0",
" iteratedFDerivWithin π 0 (fun x => 0) s x = 0",
" (iteratedFDerivWithin π 0 (fun x => 0) s x) xβ = 0 xβ",
" iteratedFDerivWithin π (i + 1) (fun x => 0) s x = 0",
" (iteratedFDerivWithin π (i + 1) (fun x => 0) s x) m = 0 m",
" ((fderivWithin π (fun ... | [
" iteratedFDerivWithin π i (fun x => 0) s x = 0",
" iteratedFDerivWithin π 0 (fun x => 0) s x = 0",
" (iteratedFDerivWithin π 0 (fun x => 0) s x) xβ = 0 xβ",
" iteratedFDerivWithin π (i + 1) (fun x => 0) s x = 0",
" (iteratedFDerivWithin π (i + 1) (fun x => 0) s x) m = 0 m",
" ((fderivWithin π (fun ... |
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.NormedSpace.LinearIsometry
#align_import analysis.normed_space.conformal_linear_map from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1"
noncomputable section
open Function LinearIsometry ContinuousLinearMap
def IsConformalMap {R : Type*} {X Y : Type*} [NormedField R] [SeminormedAddCommGroup X]
[SeminormedAddCommGroup Y] [NormedSpace R X] [NormedSpace R Y] (f' : X βL[R] Y) :=
β c β (0 : R), β li : X ββα΅’[R] Y, f' = c β’ li.toContinuousLinearMap
#align is_conformal_map IsConformalMap
variable {R M N G M' : Type*} [NormedField R] [SeminormedAddCommGroup M] [SeminormedAddCommGroup N]
[SeminormedAddCommGroup G] [NormedSpace R M] [NormedSpace R N] [NormedSpace R G]
[NormedAddCommGroup M'] [NormedSpace R M'] {f : M βL[R] N} {g : N βL[R] G} {c : R}
theorem isConformalMap_id : IsConformalMap (id R M) :=
β¨1, one_ne_zero, id, by simpβ©
#align is_conformal_map_id isConformalMap_id
theorem IsConformalMap.smul (hf : IsConformalMap f) {c : R} (hc : c β 0) :
IsConformalMap (c β’ f) := by
rcases hf with β¨c', hc', li, rflβ©
exact β¨c * c', mul_ne_zero hc hc', li, smul_smul _ _ _β©
#align is_conformal_map.smul IsConformalMap.smul
theorem isConformalMap_const_smul (hc : c β 0) : IsConformalMap (c β’ id R M) :=
isConformalMap_id.smul hc
#align is_conformal_map_const_smul isConformalMap_const_smul
protected theorem LinearIsometry.isConformalMap (f' : M ββα΅’[R] N) :
IsConformalMap f'.toContinuousLinearMap :=
β¨1, one_ne_zero, f', (one_smul _ _).symmβ©
#align linear_isometry.is_conformal_map LinearIsometry.isConformalMap
@[nontriviality]
theorem isConformalMap_of_subsingleton [Subsingleton M] (f' : M βL[R] N) : IsConformalMap f' :=
β¨1, one_ne_zero, β¨0, fun x => by simp [Subsingleton.elim x 0]β©, Subsingleton.elim _ _β©
#align is_conformal_map_of_subsingleton isConformalMap_of_subsingleton
namespace IsConformalMap
| Mathlib/Analysis/NormedSpace/ConformalLinearMap.lean | 84 | 89 | theorem comp (hg : IsConformalMap g) (hf : IsConformalMap f) : IsConformalMap (g.comp f) := by |
rcases hf with β¨cf, hcf, lif, rflβ©
rcases hg with β¨cg, hcg, lig, rflβ©
refine β¨cg * cf, mul_ne_zero hcg hcf, lig.comp lif, ?_β©
rw [smul_comp, comp_smul, mul_smul]
rfl
| [
" ContinuousLinearMap.id R M = 1 β’ LinearIsometry.id.toContinuousLinearMap",
" IsConformalMap (c β’ f)",
" IsConformalMap (c β’ c' β’ li.toContinuousLinearMap)",
" β0 xβ = βxβ",
" IsConformalMap (g.comp f)",
" IsConformalMap (g.comp (cf β’ lif.toContinuousLinearMap))",
" IsConformalMap ((cg β’ lig.toContinuo... | [
" ContinuousLinearMap.id R M = 1 β’ LinearIsometry.id.toContinuousLinearMap",
" IsConformalMap (c β’ f)",
" IsConformalMap (c β’ c' β’ li.toContinuousLinearMap)",
" β0 xβ = βxβ",
" IsConformalMap (g.comp f)"
] |
import Mathlib.FieldTheory.SplittingField.Construction
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.Separable
import Mathlib.FieldTheory.NormalClosure
import Mathlib.RingTheory.Polynomial.SeparableDegree
open scoped Classical Polynomial
open FiniteDimensional Polynomial IntermediateField Field
noncomputable section
universe u v w
variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E]
variable (K : Type w) [Field K] [Algebra F K]
namespace Field
def Emb := E ββ[F] AlgebraicClosure E
def finSepDegree : β := Nat.card (Emb F E)
instance instInhabitedEmb : Inhabited (Emb F E) := β¨IsScalarTower.toAlgHom F E _β©
instance instNeZeroFinSepDegree [FiniteDimensional F E] : NeZero (finSepDegree F E) :=
β¨Nat.card_ne_zero.2 β¨inferInstance, Fintype.finite <| minpoly.AlgHom.fintype _ _ _β©β©
def embEquivOfEquiv (i : E ββ[F] K) :
Emb F E β Emb F K := AlgEquiv.arrowCongr i <| AlgEquiv.symm <| by
let _ : Algebra E K := i.toAlgHom.toRingHom.toAlgebra
have : Algebra.IsAlgebraic E K := by
constructor
intro x
have h := isAlgebraic_algebraMap (R := E) (A := K) (i.symm.toAlgHom x)
rw [show β y : E, (algebraMap E K) y = i.toAlgHom y from fun y β¦ rfl] at h
simpa only [AlgEquiv.toAlgHom_eq_coe, AlgHom.coe_coe, AlgEquiv.apply_symm_apply] using h
apply AlgEquiv.restrictScalars (R := F) (S := E)
exact IsAlgClosure.equivOfAlgebraic E K (AlgebraicClosure K) (AlgebraicClosure E)
theorem finSepDegree_eq_of_equiv (i : E ββ[F] K) :
finSepDegree F E = finSepDegree F K := Nat.card_congr (embEquivOfEquiv F E K i)
@[simp]
| Mathlib/FieldTheory/SeparableDegree.lean | 168 | 172 | theorem finSepDegree_self : finSepDegree F F = 1 := by |
have : Cardinal.mk (Emb F F) = 1 := le_antisymm
(Cardinal.le_one_iff_subsingleton.2 AlgHom.subsingleton)
(Cardinal.one_le_iff_ne_zero.2 <| Cardinal.mk_ne_zero _)
rw [finSepDegree, Nat.card, this, Cardinal.one_toNat]
| [
" AlgebraicClosure K ββ[F] AlgebraicClosure E",
" Algebra.IsAlgebraic E K",
" β (x : K), IsAlgebraic E x",
" IsAlgebraic E x",
" AlgebraicClosure K ββ[E] AlgebraicClosure E",
" finSepDegree F F = 1"
] | [
" AlgebraicClosure K ββ[F] AlgebraicClosure E",
" Algebra.IsAlgebraic E K",
" β (x : K), IsAlgebraic E x",
" IsAlgebraic E x",
" AlgebraicClosure K ββ[E] AlgebraicClosure E",
" finSepDegree F F = 1"
] |
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal
#align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
set_option linter.uppercaseLean3 false
noncomputable section
open scoped Classical
open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set
section Limits
open Real Filter
theorem tendsto_rpow_atTop {y : β} (hy : 0 < y) : Tendsto (fun x : β => x ^ y) atTop atTop := by
rw [tendsto_atTop_atTop]
intro b
use max b 0 ^ (1 / y)
intro x hx
exact
le_of_max_le_left
(by
convert rpow_le_rpow (rpow_nonneg (le_max_right b 0) (1 / y)) hx (le_of_lt hy)
using 1
rw [β rpow_mul (le_max_right b 0), (eq_div_iff (ne_of_gt hy)).mp rfl, Real.rpow_one])
#align tendsto_rpow_at_top tendsto_rpow_atTop
theorem tendsto_rpow_neg_atTop {y : β} (hy : 0 < y) : Tendsto (fun x : β => x ^ (-y)) atTop (π 0) :=
Tendsto.congr' (eventuallyEq_of_mem (Ioi_mem_atTop 0) fun _ hx => (rpow_neg (le_of_lt hx) y).symm)
(tendsto_rpow_atTop hy).inv_tendsto_atTop
#align tendsto_rpow_neg_at_top tendsto_rpow_neg_atTop
open Asymptotics in
lemma tendsto_rpow_atTop_of_base_lt_one (b : β) (hbβ : -1 < b) (hbβ : b < 1) :
Tendsto (b ^ Β· : β β β) atTop (π (0:β)) := by
rcases lt_trichotomy b 0 with hb|rfl|hb
case inl => -- b < 0
simp_rw [Real.rpow_def_of_nonpos hb.le, hb.ne, ite_false]
rw [β isLittleO_const_iff (c := (1:β)) one_ne_zero, (one_mul (1 : β)).symm]
refine IsLittleO.mul_isBigO ?exp ?cos
case exp =>
rw [isLittleO_const_iff one_ne_zero]
refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id
rw [β log_neg_eq_log, log_neg_iff (by linarith)]
linarith
case cos =>
rw [isBigO_iff]
exact β¨1, eventually_of_forall fun x => by simp [Real.abs_cos_le_one]β©
case inr.inl => -- b = 0
refine Tendsto.mono_right ?_ (Iff.mpr pure_le_nhds_iff rfl)
rw [tendsto_pure]
filter_upwards [eventually_ne_atTop 0] with _ hx
simp [hx]
case inr.inr => -- b > 0
simp_rw [Real.rpow_def_of_pos hb]
refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_neg ?_).mpr tendsto_id
exact (log_neg_iff hb).mpr hbβ
lemma tendsto_rpow_atTop_of_base_gt_one (b : β) (hb : 1 < b) :
Tendsto (b ^ Β· : β β β) atBot (π (0:β)) := by
simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)]
refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_of_pos ?_).mpr tendsto_id
exact (log_pos_iff (by positivity)).mpr <| by aesop
lemma tendsto_rpow_atBot_of_base_lt_one (b : β) (hbβ : 0 < b) (hbβ : b < 1) :
Tendsto (b ^ Β· : β β β) atBot atTop := by
simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)]
refine tendsto_exp_atTop.comp <| (tendsto_const_mul_atTop_iff_neg <| tendsto_id (Ξ± := β)).mpr ?_
exact (log_neg_iff hbβ).mpr hbβ
lemma tendsto_rpow_atBot_of_base_gt_one (b : β) (hb : 1 < b) :
Tendsto (b ^ Β· : β β β) atBot (π 0) := by
simp_rw [Real.rpow_def_of_pos (by positivity : 0 < b)]
refine tendsto_exp_atBot.comp <| (tendsto_const_mul_atBot_iff_pos <| tendsto_id (Ξ± := β)).mpr ?_
exact (log_pos_iff (by positivity)).mpr <| by aesop
theorem tendsto_rpow_div_mul_add (a b c : β) (hb : 0 β b) :
Tendsto (fun x => x ^ (a / (b * x + c))) atTop (π 1) := by
refine
Tendsto.congr' ?_
((tendsto_exp_nhds_zero_nhds_one.comp
(by
simpa only [mul_zero, pow_one] using
(tendsto_const_nhds (x := a)).mul
(tendsto_div_pow_mul_exp_add_atTop b c 1 hb))).comp
tendsto_log_atTop)
apply eventuallyEq_of_mem (Ioi_mem_atTop (0 : β))
intro x hx
simp only [Set.mem_Ioi, Function.comp_apply] at hx β’
rw [exp_log hx, β exp_log (rpow_pos_of_pos hx (a / (b * x + c))), log_rpow hx (a / (b * x + c))]
field_simp
#align tendsto_rpow_div_mul_add tendsto_rpow_div_mul_add
theorem tendsto_rpow_div : Tendsto (fun x => x ^ ((1 : β) / x)) atTop (π 1) := by
convert tendsto_rpow_div_mul_add (1 : β) _ (0 : β) zero_ne_one
ring
#align tendsto_rpow_div tendsto_rpow_div
theorem tendsto_rpow_neg_div : Tendsto (fun x => x ^ (-(1 : β) / x)) atTop (π 1) := by
convert tendsto_rpow_div_mul_add (-(1 : β)) _ (0 : β) zero_ne_one
ring
#align tendsto_rpow_neg_div tendsto_rpow_neg_div
| Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean | 132 | 137 | theorem tendsto_exp_div_rpow_atTop (s : β) : Tendsto (fun x : β => exp x / x ^ s) atTop atTop := by |
cases' archimedean_iff_nat_lt.1 Real.instArchimedean s with n hn
refine tendsto_atTop_mono' _ ?_ (tendsto_exp_div_pow_atTop n)
filter_upwards [eventually_gt_atTop (0 : β), eventually_ge_atTop (1 : β)] with x hxβ hxβ
rw [div_le_div_left (exp_pos _) (pow_pos hxβ _) (rpow_pos_of_pos hxβ _), β Real.rpow_natCast]
exact rpow_le_rpow_of_exponent_le hxβ hn.le
| [
" Tendsto (fun x => x ^ y) atTop atTop",
" β (b : β), β i, β (a : β), i β€ a β b β€ a ^ y",
" β i, β (a : β), i β€ a β b β€ a ^ y",
" β (a : β), max b 0 ^ (1 / y) β€ a β b β€ a ^ y",
" b β€ x ^ y",
" max b ?m.800 β€ x ^ y",
" max b ?m.800 = (max b 0 ^ (1 / y)) ^ y",
" Tendsto (fun x => b ^ x) atTop (π 0)",
... | [
" Tendsto (fun x => x ^ y) atTop atTop",
" β (b : β), β i, β (a : β), i β€ a β b β€ a ^ y",
" β i, β (a : β), i β€ a β b β€ a ^ y",
" β (a : β), max b 0 ^ (1 / y) β€ a β b β€ a ^ y",
" b β€ x ^ y",
" max b ?m.800 β€ x ^ y",
" max b ?m.800 = (max b 0 ^ (1 / y)) ^ y",
" Tendsto (fun x => b ^ x) atTop (π 0)",
... |
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : β)
def divisors : Finset β :=
Finset.filter (fun x : β => x β£ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset β :=
Finset.filter (fun x : β => x β£ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (β Γ β) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ΓΛ’ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n β 0) : (Finset.range n.succ).filter (Β· β£ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n β 0) :
(Finset.range n).filter (Β· β£ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : Β¬n β properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : β} : n β properDivisors m β n β£ m β§ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); Β· simp [properDivisors]
simp only [and_comm, β filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
theorem insert_self_properDivisors (h : n β 0) : insert n (properDivisors n) = divisors n := by
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
#align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
| Mathlib/NumberTheory/Divisors.lean | 89 | 91 | theorem cons_self_properDivisors (h : n β 0) :
cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by |
rw [cons_eq_insert, insert_self_properDivisors h]
| [
" filter (fun x => x β£ n) (range n.succ) = n.divisors",
" aβ β filter (fun x => x β£ n) (range n.succ) β aβ β n.divisors",
" aβ β£ n β aβ < n.succ β 1 β€ aβ",
" filter (fun x => x β£ n) (range n) = n.properDivisors",
" aβ β filter (fun x => x β£ n) (range n) β aβ β n.properDivisors",
" aβ β£ n β aβ < n β 1 β€ aβ... | [
" filter (fun x => x β£ n) (range n.succ) = n.divisors",
" aβ β filter (fun x => x β£ n) (range n.succ) β aβ β n.divisors",
" aβ β£ n β aβ < n.succ β 1 β€ aβ",
" filter (fun x => x β£ n) (range n) = n.properDivisors",
" aβ β filter (fun x => x β£ n) (range n) β aβ β n.properDivisors",
" aβ β£ n β aβ < n β 1 β€ aβ... |
import Mathlib.Analysis.Calculus.FDeriv.Equiv
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
#align_import analysis.calculus.inverse from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Function Set Filter Metric
open scoped Topology Classical NNReal
noncomputable section
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace π G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace π G']
variable {Ξ΅ : β}
open Asymptotics Filter Metric Set
open ContinuousLinearMap (id)
namespace HasStrictFDerivAt
theorem approximates_deriv_on_nhds {f : E β F} {f' : E βL[π] F} {a : E}
(hf : HasStrictFDerivAt f f' a) {c : ββ₯0} (hc : Subsingleton E β¨ 0 < c) :
β s β π a, ApproximatesLinearOn f f' s c := by
cases' hc with hE hc
Β· refine β¨univ, IsOpen.mem_nhds isOpen_univ trivial, fun x _ y _ => ?_β©
simp [@Subsingleton.elim E hE x y]
have := hf.def hc
rw [nhds_prod_eq, Filter.Eventually, mem_prod_same_iff] at this
rcases this with β¨s, has, hsβ©
exact β¨s, has, fun x hx y hy => hs (mk_mem_prod hx hy)β©
#align has_strict_fderiv_at.approximates_deriv_on_nhds HasStrictFDerivAt.approximates_deriv_on_nhds
| Mathlib/Analysis/Calculus/InverseFunctionTheorem/FDeriv.lean | 86 | 96 | theorem map_nhds_eq_of_surj [CompleteSpace E] [CompleteSpace F] {f : E β F} {f' : E βL[π] F} {a : E}
(hf : HasStrictFDerivAt f (f' : E βL[π] F) a) (h : LinearMap.range f' = β€) :
map f (π a) = π (f a) := by |
let f'symm := f'.nonlinearRightInverseOfSurjective h
set c : ββ₯0 := f'symm.nnnormβ»ΒΉ / 2 with hc
have f'symm_pos : 0 < f'symm.nnnorm := f'.nonlinearRightInverseOfSurjective_nnnorm_pos h
have cpos : 0 < c := by simp [hc, half_pos, inv_pos, f'symm_pos]
obtain β¨s, s_nhds, hsβ© : β s β π a, ApproximatesLinearOn f f' s c :=
hf.approximates_deriv_on_nhds (Or.inr cpos)
apply hs.map_nhds_eq f'symm s_nhds (Or.inr (NNReal.half_lt_self _))
simp [ne_of_gt f'symm_pos]
| [
" β s β π a, ApproximatesLinearOn f f' s c",
" βf x - f y - f' (x - y)β β€ βc * βx - yβ",
" map f (π a) = π (f a)",
" 0 < c",
" f'symm.nnnormβ»ΒΉ β 0"
] | [
" β s β π a, ApproximatesLinearOn f f' s c",
" βf x - f y - f' (x - y)β β€ βc * βx - yβ",
" map f (π a) = π (f a)"
] |
import Mathlib.Algebra.Lie.BaseChange
import Mathlib.Algebra.Lie.Solvable
import Mathlib.Algebra.Lie.Quotient
import Mathlib.Algebra.Lie.Normalizer
import Mathlib.LinearAlgebra.Eigenspace.Basic
import Mathlib.Order.Filter.AtTopBot
import Mathlib.RingTheory.Artinian
import Mathlib.RingTheory.Nilpotent.Lemmas
import Mathlib.Tactic.Monotonicity
#align_import algebra.lie.nilpotent from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1"
universe u v w wβ wβ
section NilpotentModules
variable {R : Type u} {L : Type v} {M : Type w}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
variable (k : β) (N : LieSubmodule R L M)
namespace LieSubmodule
variable {Nβ Nβ : LieSubmodule R L M}
def ucs (k : β) : LieSubmodule R L M β LieSubmodule R L M :=
normalizer^[k]
#align lie_submodule.ucs LieSubmodule.ucs
@[simp]
theorem ucs_zero : N.ucs 0 = N :=
rfl
#align lie_submodule.ucs_zero LieSubmodule.ucs_zero
@[simp]
theorem ucs_succ (k : β) : N.ucs (k + 1) = (N.ucs k).normalizer :=
Function.iterate_succ_apply' normalizer k N
#align lie_submodule.ucs_succ LieSubmodule.ucs_succ
theorem ucs_add (k l : β) : N.ucs (k + l) = (N.ucs l).ucs k :=
Function.iterate_add_apply normalizer k l N
#align lie_submodule.ucs_add LieSubmodule.ucs_add
@[mono]
theorem ucs_mono (k : β) (h : Nβ β€ Nβ) : Nβ.ucs k β€ Nβ.ucs k := by
induction' k with k ih
Β· simpa
simp only [ucs_succ]
-- Porting note: `mono` makes no progress
apply monotone_normalizer ih
#align lie_submodule.ucs_mono LieSubmodule.ucs_mono
| Mathlib/Algebra/Lie/Nilpotent.lean | 493 | 496 | theorem ucs_eq_self_of_normalizer_eq_self (h : Nβ.normalizer = Nβ) (k : β) : Nβ.ucs k = Nβ := by |
induction' k with k ih
Β· simp
Β· rwa [ucs_succ, ih]
| [
" ucs k Nβ β€ ucs k Nβ",
" ucs 0 Nβ β€ ucs 0 Nβ",
" ucs (k + 1) Nβ β€ ucs (k + 1) Nβ",
" (ucs k Nβ).normalizer β€ (ucs k Nβ).normalizer",
" ucs k Nβ = Nβ",
" ucs 0 Nβ = Nβ",
" ucs (k + 1) Nβ = Nβ"
] | [
" ucs k Nβ β€ ucs k Nβ",
" ucs 0 Nβ β€ ucs 0 Nβ",
" ucs (k + 1) Nβ β€ ucs (k + 1) Nβ",
" (ucs k Nβ).normalizer β€ (ucs k Nβ).normalizer",
" ucs k Nβ = Nβ"
] |
import Mathlib.Data.Finset.Grade
import Mathlib.Order.Interval.Finset.Basic
#align_import data.finset.interval from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
variable {Ξ± Ξ² : Type*}
namespace Finset
section Decidable
variable [DecidableEq Ξ±] (s t : Finset Ξ±)
instance instLocallyFiniteOrder : LocallyFiniteOrder (Finset Ξ±) where
finsetIcc s t := t.powerset.filter (s β Β·)
finsetIco s t := t.ssubsets.filter (s β Β·)
finsetIoc s t := t.powerset.filter (s β Β·)
finsetIoo s t := t.ssubsets.filter (s β Β·)
finset_mem_Icc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ico s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
finset_mem_Ioc s t u := by
rw [mem_filter, mem_powerset]
exact and_comm
finset_mem_Ioo s t u := by
rw [mem_filter, mem_ssubsets]
exact and_comm
theorem Icc_eq_filter_powerset : Icc s t = t.powerset.filter (s β Β·) :=
rfl
#align finset.Icc_eq_filter_powerset Finset.Icc_eq_filter_powerset
theorem Ico_eq_filter_ssubsets : Ico s t = t.ssubsets.filter (s β Β·) :=
rfl
#align finset.Ico_eq_filter_ssubsets Finset.Ico_eq_filter_ssubsets
theorem Ioc_eq_filter_powerset : Ioc s t = t.powerset.filter (s β Β·) :=
rfl
#align finset.Ioc_eq_filter_powerset Finset.Ioc_eq_filter_powerset
theorem Ioo_eq_filter_ssubsets : Ioo s t = t.ssubsets.filter (s β Β·) :=
rfl
#align finset.Ioo_eq_filter_ssubsets Finset.Ioo_eq_filter_ssubsets
theorem Iic_eq_powerset : Iic s = s.powerset :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iic_eq_powerset Finset.Iic_eq_powerset
theorem Iio_eq_ssubsets : Iio s = s.ssubsets :=
filter_true_of_mem fun t _ => empty_subset t
#align finset.Iio_eq_ssubsets Finset.Iio_eq_ssubsets
variable {s t}
theorem Icc_eq_image_powerset (h : s β t) : Icc s t = (t \ s).powerset.image (s βͺ Β·) := by
ext u
simp_rw [mem_Icc, mem_image, mem_powerset]
constructor
Β· rintro β¨hs, htβ©
exact β¨u \ s, sdiff_le_sdiff_right ht, sup_sdiff_cancel_right hsβ©
Β· rintro β¨v, hv, rflβ©
exact β¨le_sup_left, union_subset h <| hv.trans sdiff_subsetβ©
#align finset.Icc_eq_image_powerset Finset.Icc_eq_image_powerset
theorem Ico_eq_image_ssubsets (h : s β t) : Ico s t = (t \ s).ssubsets.image (s βͺ Β·) := by
ext u
simp_rw [mem_Ico, mem_image, mem_ssubsets]
constructor
Β· rintro β¨hs, htβ©
exact β¨u \ s, sdiff_lt_sdiff_right ht hs, sup_sdiff_cancel_right hsβ©
Β· rintro β¨v, hv, rflβ©
exact β¨le_sup_left, sup_lt_of_lt_sdiff_left hv hβ©
#align finset.Ico_eq_image_ssubsets Finset.Ico_eq_image_ssubsets
| Mathlib/Data/Finset/Interval.lean | 101 | 106 | theorem card_Icc_finset (h : s β t) : (Icc s t).card = 2 ^ (t.card - s.card) := by |
rw [β card_sdiff h, β card_powerset, Icc_eq_image_powerset h, Finset.card_image_iff]
rintro u hu v hv (huv : s β u = s β v)
rw [mem_coe, mem_powerset] at hu hv
rw [β (disjoint_sdiff.mono_right hu : Disjoint s u).sup_sdiff_cancel_left, β
(disjoint_sdiff.mono_right hv : Disjoint s v).sup_sdiff_cancel_left, huv]
| [
" u β (fun s t => filter (fun x => s β x) t.powerset) s t β s β€ u β§ u β€ t",
" u β t β§ s β u β s β€ u β§ u β€ t",
" u β (fun s t => filter (fun x => s β x) t.ssubsets) s t β s β€ u β§ u < t",
" u β t β§ s β u β s β€ u β§ u < t",
" u β (fun s t => filter (fun x => s β x) t.powerset) s t β s < u β§ u β€ t",
" u β t β§ ... | [
" u β (fun s t => filter (fun x => s β x) t.powerset) s t β s β€ u β§ u β€ t",
" u β t β§ s β u β s β€ u β§ u β€ t",
" u β (fun s t => filter (fun x => s β x) t.ssubsets) s t β s β€ u β§ u < t",
" u β t β§ s β u β s β€ u β§ u < t",
" u β (fun s t => filter (fun x => s β x) t.powerset) s t β s < u β§ u β€ t",
" u β t β§ ... |
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Order.BigOperators.Group.List
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.Order.WellFoundedSet
#align_import group_theory.submonoid.pointwise from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
open Set Pointwise
variable {Ξ± : Type*} {G : Type*} {M : Type*} {R : Type*} {A : Type*}
variable [Monoid M] [AddMonoid A]
namespace Submonoid
namespace AddSubmonoid
namespace Set.IsPWO
variable [OrderedCancelCommMonoid Ξ±] {s : Set Ξ±}
@[to_additive]
| Mathlib/Algebra/Group/Submonoid/Pointwise.lean | 700 | 704 | theorem submonoid_closure (hpos : β x : Ξ±, x β s β 1 β€ x) (h : s.IsPWO) :
IsPWO (Submonoid.closure s : Set Ξ±) := by |
rw [Submonoid.closure_eq_image_prod]
refine (h.partiallyWellOrderedOn_sublistForallβ (Β· β€ Β·)).image_of_monotone_on ?_
exact fun l1 _ l2 hl2 h12 => h12.prod_le_prod' fun x hx => hpos x <| hl2 x hx
| [
" (β(closure s)).IsPWO",
" (List.prod '' {l | β x β l, x β s}).IsPWO",
" β aβ β {l | β x β l, x β s},\n β aβ β {l | β x β l, x β s}, List.SublistForallβ (fun x x_1 => x β€ x_1) aβ aβ β aβ.prod β€ aβ.prod"
] | [
" (β(closure s)).IsPWO"
] |
import Mathlib.Data.Int.Interval
import Mathlib.RingTheory.Binomial
import Mathlib.RingTheory.HahnSeries.PowerSeries
import Mathlib.RingTheory.HahnSeries.Summable
import Mathlib.FieldTheory.RatFunc.AsPolynomial
import Mathlib.RingTheory.Localization.FractionRing
#align_import ring_theory.laurent_series from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86"
universe u
open scoped Classical
open HahnSeries Polynomial
noncomputable section
abbrev LaurentSeries (R : Type u) [Zero R] :=
HahnSeries β€ R
#align laurent_series LaurentSeries
variable {R : Type*}
namespace LaurentSeries
section Semiring
variable [Semiring R]
instance : Coe (PowerSeries R) (LaurentSeries R) :=
β¨HahnSeries.ofPowerSeries β€ Rβ©
#noalign laurent_series.coe_power_series
@[simp]
theorem coeff_coe_powerSeries (x : PowerSeries R) (n : β) :
HahnSeries.coeff (x : LaurentSeries R) n = PowerSeries.coeff R n x := by
rw [ofPowerSeries_apply_coeff]
#align laurent_series.coeff_coe_power_series LaurentSeries.coeff_coe_powerSeries
def powerSeriesPart (x : LaurentSeries R) : PowerSeries R :=
PowerSeries.mk fun n => x.coeff (x.order + n)
#align laurent_series.power_series_part LaurentSeries.powerSeriesPart
@[simp]
theorem powerSeriesPart_coeff (x : LaurentSeries R) (n : β) :
PowerSeries.coeff R n x.powerSeriesPart = x.coeff (x.order + n) :=
PowerSeries.coeff_mk _ _
#align laurent_series.power_series_part_coeff LaurentSeries.powerSeriesPart_coeff
@[simp]
theorem powerSeriesPart_zero : powerSeriesPart (0 : LaurentSeries R) = 0 := by
ext
simp [(PowerSeries.coeff _ _).map_zero] -- Note: this doesn't get picked up any more
#align laurent_series.power_series_part_zero LaurentSeries.powerSeriesPart_zero
@[simp]
| Mathlib/RingTheory/LaurentSeries.lean | 112 | 121 | theorem powerSeriesPart_eq_zero (x : LaurentSeries R) : x.powerSeriesPart = 0 β x = 0 := by |
constructor
Β· contrapose!
simp only [ne_eq]
intro h
rw [PowerSeries.ext_iff, not_forall]
refine β¨0, ?_β©
simp [coeff_order_ne_zero h]
Β· rintro rfl
simp
| [
" ((ofPowerSeries β€ R) x).coeff βn = (PowerSeries.coeff R n) x",
" powerSeriesPart 0 = 0",
" (PowerSeries.coeff R nβ) (powerSeriesPart 0) = (PowerSeries.coeff R nβ) 0",
" x.powerSeriesPart = 0 β x = 0",
" x.powerSeriesPart = 0 β x = 0",
" x β 0 β x.powerSeriesPart β 0",
" Β¬x = 0 β Β¬x.powerSeriesPart = 0... | [
" ((ofPowerSeries β€ R) x).coeff βn = (PowerSeries.coeff R n) x",
" powerSeriesPart 0 = 0",
" (PowerSeries.coeff R nβ) (powerSeriesPart 0) = (PowerSeries.coeff R nβ) 0",
" x.powerSeriesPart = 0 β x = 0"
] |
import Mathlib.MeasureTheory.Measure.MeasureSpace
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
#align_import measure_theory.measure.open_pos from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Topology ENNReal MeasureTheory
open Set Function Filter
namespace MeasureTheory
namespace Measure
section Basic
variable {X Y : Type*} [TopologicalSpace X] {m : MeasurableSpace X} [TopologicalSpace Y]
[T2Space Y] (ΞΌ Ξ½ : Measure X)
class IsOpenPosMeasure : Prop where
open_pos : β U : Set X, IsOpen U β U.Nonempty β ΞΌ U β 0
#align measure_theory.measure.is_open_pos_measure MeasureTheory.Measure.IsOpenPosMeasure
variable [IsOpenPosMeasure ΞΌ] {s U F : Set X} {x : X}
theorem _root_.IsOpen.measure_ne_zero (hU : IsOpen U) (hne : U.Nonempty) : ΞΌ U β 0 :=
IsOpenPosMeasure.open_pos U hU hne
#align is_open.measure_ne_zero IsOpen.measure_ne_zero
theorem _root_.IsOpen.measure_pos (hU : IsOpen U) (hne : U.Nonempty) : 0 < ΞΌ U :=
(hU.measure_ne_zero ΞΌ hne).bot_lt
#align is_open.measure_pos IsOpen.measure_pos
instance (priority := 100) [Nonempty X] : NeZero ΞΌ :=
β¨measure_univ_pos.mp <| isOpen_univ.measure_pos ΞΌ univ_nonemptyβ©
theorem _root_.IsOpen.measure_pos_iff (hU : IsOpen U) : 0 < ΞΌ U β U.Nonempty :=
β¨fun h => nonempty_iff_ne_empty.2 fun he => h.ne' <| he.symm βΈ measure_empty, hU.measure_pos ΞΌβ©
#align is_open.measure_pos_iff IsOpen.measure_pos_iff
theorem _root_.IsOpen.measure_eq_zero_iff (hU : IsOpen U) : ΞΌ U = 0 β U = β
:= by
simpa only [not_lt, nonpos_iff_eq_zero, not_nonempty_iff_eq_empty] using
not_congr (hU.measure_pos_iff ΞΌ)
#align is_open.measure_eq_zero_iff IsOpen.measure_eq_zero_iff
theorem measure_pos_of_nonempty_interior (h : (interior s).Nonempty) : 0 < ΞΌ s :=
(isOpen_interior.measure_pos ΞΌ h).trans_le (measure_mono interior_subset)
#align measure_theory.measure.measure_pos_of_nonempty_interior MeasureTheory.Measure.measure_pos_of_nonempty_interior
theorem measure_pos_of_mem_nhds (h : s β π x) : 0 < ΞΌ s :=
measure_pos_of_nonempty_interior _ β¨x, mem_interior_iff_mem_nhds.2 hβ©
#align measure_theory.measure.measure_pos_of_mem_nhds MeasureTheory.Measure.measure_pos_of_mem_nhds
theorem isOpenPosMeasure_smul {c : ββ₯0β} (h : c β 0) : IsOpenPosMeasure (c β’ ΞΌ) :=
β¨fun _U Uo Une => mul_ne_zero h (Uo.measure_ne_zero ΞΌ Une)β©
#align measure_theory.measure.is_open_pos_measure_smul MeasureTheory.Measure.isOpenPosMeasure_smul
variable {ΞΌ Ξ½}
protected theorem AbsolutelyContinuous.isOpenPosMeasure (h : ΞΌ βͺ Ξ½) : IsOpenPosMeasure Ξ½ :=
β¨fun _U ho hne hβ => ho.measure_ne_zero ΞΌ hne (h hβ)β©
#align measure_theory.measure.absolutely_continuous.is_open_pos_measure MeasureTheory.Measure.AbsolutelyContinuous.isOpenPosMeasure
theorem _root_.LE.le.isOpenPosMeasure (h : ΞΌ β€ Ξ½) : IsOpenPosMeasure Ξ½ :=
h.absolutelyContinuous.isOpenPosMeasure
#align has_le.le.is_open_pos_measure LE.le.isOpenPosMeasure
theorem _root_.IsOpen.measure_zero_iff_eq_empty (hU : IsOpen U) :
ΞΌ U = 0 β U = β
:=
β¨fun h β¦ (hU.measure_eq_zero_iff ΞΌ).mp h, fun h β¦ by simp [h]β©
theorem _root_.IsOpen.ae_eq_empty_iff_eq (hU : IsOpen U) :
U =α΅[ΞΌ] (β
: Set X) β U = β
:= by
rw [ae_eq_empty, hU.measure_zero_iff_eq_empty]
theorem _root_.IsOpen.eq_empty_of_measure_zero (hU : IsOpen U) (hβ : ΞΌ U = 0) : U = β
:=
(hU.measure_eq_zero_iff ΞΌ).mp hβ
#align is_open.eq_empty_of_measure_zero IsOpen.eq_empty_of_measure_zero
| Mathlib/MeasureTheory/Measure/OpenPos.lean | 97 | 100 | theorem _root_.IsClosed.ae_eq_univ_iff_eq (hF : IsClosed F) :
F =α΅[ΞΌ] univ β F = univ := by |
refine β¨fun h β¦ ?_, fun h β¦ by rw [h]β©
rwa [ae_eq_univ, hF.isOpen_compl.measure_eq_zero_iff ΞΌ, compl_empty_iff] at h
| [
" ΞΌ U = 0 β U = β
",
" ΞΌ U = 0",
" U =αΆ [ae ΞΌ] β
β U = β
",
" F =αΆ [ae ΞΌ] univ β F = univ",
" F =αΆ [ae ΞΌ] univ",
" F = univ"
] | [
" ΞΌ U = 0 β U = β
",
" ΞΌ U = 0",
" U =αΆ [ae ΞΌ] β
β U = β
",
" F =αΆ [ae ΞΌ] univ β F = univ"
] |
import Mathlib.LinearAlgebra.Basis.VectorSpace
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
#align_import field_theory.finiteness from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f"
universe u v
open scoped Classical
open Cardinal
open Cardinal Submodule Module Function
namespace IsNoetherian
variable {K : Type u} {V : Type v} [DivisionRing K] [AddCommGroup V] [Module K V]
theorem iff_rank_lt_aleph0 : IsNoetherian K V β Module.rank K V < β΅β := by
let b := Basis.ofVectorSpace K V
rw [β b.mk_eq_rank'', lt_aleph0_iff_set_finite]
constructor
Β· intro
exact (Basis.ofVectorSpaceIndex.linearIndependent K V).set_finite_of_isNoetherian
Β· intro hbfinite
refine
@isNoetherian_of_linearEquiv K (β€ : Submodule K V) V _ _ _ _ _ (LinearEquiv.ofTop _ rfl)
(id ?_)
refine isNoetherian_of_fg_of_noetherian _ β¨Set.Finite.toFinset hbfinite, ?_β©
rw [Set.Finite.coe_toFinset, β b.span_eq, Basis.coe_ofVectorSpace, Subtype.range_coe]
#align is_noetherian.iff_rank_lt_aleph_0 IsNoetherian.iff_rank_lt_aleph0
#align is_noetherian.rank_lt_aleph_0 rank_lt_aleph0
noncomputable def fintypeBasisIndex {ΞΉ : Type*} [IsNoetherian K V] (b : Basis ΞΉ K V) : Fintype ΞΉ :=
b.fintypeIndexOfRankLtAleph0 (rank_lt_aleph0 K V)
#align is_noetherian.fintype_basis_index IsNoetherian.fintypeBasisIndex
noncomputable instance [IsNoetherian K V] : Fintype (Basis.ofVectorSpaceIndex K V) :=
fintypeBasisIndex (Basis.ofVectorSpace K V)
theorem finite_basis_index {ΞΉ : Type*} {s : Set ΞΉ} [IsNoetherian K V] (b : Basis s K V) :
s.Finite :=
b.finite_index_of_rank_lt_aleph0 (rank_lt_aleph0 K V)
#align is_noetherian.finite_basis_index IsNoetherian.finite_basis_index
variable (K V)
noncomputable def finsetBasisIndex [IsNoetherian K V] : Finset V :=
(finite_basis_index (Basis.ofVectorSpace K V)).toFinset
#align is_noetherian.finset_basis_index IsNoetherian.finsetBasisIndex
@[simp]
theorem coe_finsetBasisIndex [IsNoetherian K V] :
(β(finsetBasisIndex K V) : Set V) = Basis.ofVectorSpaceIndex K V :=
Set.Finite.coe_toFinset _
#align is_noetherian.coe_finset_basis_index IsNoetherian.coe_finsetBasisIndex
@[simp]
theorem coeSort_finsetBasisIndex [IsNoetherian K V] :
(finsetBasisIndex K V : Type _) = Basis.ofVectorSpaceIndex K V :=
Set.Finite.coeSort_toFinset _
#align is_noetherian.coe_sort_finset_basis_index IsNoetherian.coeSort_finsetBasisIndex
noncomputable def finsetBasis [IsNoetherian K V] : Basis (finsetBasisIndex K V) K V :=
(Basis.ofVectorSpace K V).reindex (by rw [coeSort_finsetBasisIndex])
#align is_noetherian.finset_basis IsNoetherian.finsetBasis
@[simp]
theorem range_finsetBasis [IsNoetherian K V] :
Set.range (finsetBasis K V) = Basis.ofVectorSpaceIndex K V := by
rw [finsetBasis, Basis.range_reindex, Basis.range_ofVectorSpace]
#align is_noetherian.range_finset_basis IsNoetherian.range_finsetBasis
variable {K V}
| Mathlib/FieldTheory/Finiteness.lean | 103 | 112 | theorem iff_fg : IsNoetherian K V β Module.Finite K V := by |
constructor
Β· intro h
exact
β¨β¨finsetBasisIndex K V, by
convert (finsetBasis K V).span_eq
simpβ©β©
Β· rintro β¨s, hsβ©
rw [IsNoetherian.iff_rank_lt_aleph0, β rank_top, β hs]
exact lt_of_le_of_lt (rank_span_le _) s.finite_toSet.lt_aleph0
| [
" IsNoetherian K V β Module.rank K V < β΅β",
" IsNoetherian K V β (Basis.ofVectorSpaceIndex K V).Finite",
" IsNoetherian K V β (Basis.ofVectorSpaceIndex K V).Finite",
" (Basis.ofVectorSpaceIndex K V).Finite",
" (Basis.ofVectorSpaceIndex K V).Finite β IsNoetherian K V",
" IsNoetherian K V",
" IsNoetherian... | [
" IsNoetherian K V β Module.rank K V < β΅β",
" IsNoetherian K V β (Basis.ofVectorSpaceIndex K V).Finite",
" IsNoetherian K V β (Basis.ofVectorSpaceIndex K V).Finite",
" (Basis.ofVectorSpaceIndex K V).Finite",
" (Basis.ofVectorSpaceIndex K V).Finite β IsNoetherian K V",
" IsNoetherian K V",
" IsNoetherian... |
import Mathlib.Data.Set.Image
import Mathlib.Order.Interval.Set.Basic
#align_import data.set.intervals.with_bot_top from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
variable {Ξ± : Type*}
namespace WithTop
@[simp]
theorem preimage_coe_top : (some : Ξ± β WithTop Ξ±) β»ΒΉ' {β€} = (β
: Set Ξ±) :=
eq_empty_of_subset_empty fun _ => coe_ne_top
#align with_top.preimage_coe_top WithTop.preimage_coe_top
variable [Preorder Ξ±] {a b : Ξ±}
theorem range_coe : range (some : Ξ± β WithTop Ξ±) = Iio β€ := by
ext x
rw [mem_Iio, WithTop.lt_top_iff_ne_top, mem_range, ne_top_iff_exists]
#align with_top.range_coe WithTop.range_coe
@[simp]
theorem preimage_coe_Ioi : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioi a = Ioi a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Ioi WithTop.preimage_coe_Ioi
@[simp]
theorem preimage_coe_Ici : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ici a = Ici a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Ici WithTop.preimage_coe_Ici
@[simp]
theorem preimage_coe_Iio : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Iio a = Iio a :=
ext fun _ => coe_lt_coe
#align with_top.preimage_coe_Iio WithTop.preimage_coe_Iio
@[simp]
theorem preimage_coe_Iic : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Iic a = Iic a :=
ext fun _ => coe_le_coe
#align with_top.preimage_coe_Iic WithTop.preimage_coe_Iic
@[simp]
theorem preimage_coe_Icc : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Icc a b = Icc a b := by simp [β Ici_inter_Iic]
#align with_top.preimage_coe_Icc WithTop.preimage_coe_Icc
@[simp]
theorem preimage_coe_Ico : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ico a b = Ico a b := by simp [β Ici_inter_Iio]
#align with_top.preimage_coe_Ico WithTop.preimage_coe_Ico
@[simp]
theorem preimage_coe_Ioc : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioc a b = Ioc a b := by simp [β Ioi_inter_Iic]
#align with_top.preimage_coe_Ioc WithTop.preimage_coe_Ioc
@[simp]
theorem preimage_coe_Ioo : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioo a b = Ioo a b := by simp [β Ioi_inter_Iio]
#align with_top.preimage_coe_Ioo WithTop.preimage_coe_Ioo
@[simp]
theorem preimage_coe_Iio_top : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Iio β€ = univ := by
rw [β range_coe, preimage_range]
#align with_top.preimage_coe_Iio_top WithTop.preimage_coe_Iio_top
@[simp]
theorem preimage_coe_Ico_top : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ico a β€ = Ici a := by
simp [β Ici_inter_Iio]
#align with_top.preimage_coe_Ico_top WithTop.preimage_coe_Ico_top
@[simp]
theorem preimage_coe_Ioo_top : (some : Ξ± β WithTop Ξ±) β»ΒΉ' Ioo a β€ = Ioi a := by
simp [β Ioi_inter_Iio]
#align with_top.preimage_coe_Ioo_top WithTop.preimage_coe_Ioo_top
| Mathlib/Order/Interval/Set/WithBotTop.lean | 89 | 90 | theorem image_coe_Ioi : (some : Ξ± β WithTop Ξ±) '' Ioi a = Ioo (a : WithTop Ξ±) β€ := by |
rw [β preimage_coe_Ioi, image_preimage_eq_inter_range, range_coe, Ioi_inter_Iio]
| [
" range some = Iio β€",
" x β range some β x β Iio β€",
" some β»ΒΉ' Icc βa βb = Icc a b",
" some β»ΒΉ' Ico βa βb = Ico a b",
" some β»ΒΉ' Ioc βa βb = Ioc a b",
" some β»ΒΉ' Ioo βa βb = Ioo a b",
" some β»ΒΉ' Iio β€ = univ",
" some β»ΒΉ' Ico βa β€ = Ici a",
" some β»ΒΉ' Ioo βa β€ = Ioi a",
" some '' Ioi a = Ioo βa β€... | [
" range some = Iio β€",
" x β range some β x β Iio β€",
" some β»ΒΉ' Icc βa βb = Icc a b",
" some β»ΒΉ' Ico βa βb = Ico a b",
" some β»ΒΉ' Ioc βa βb = Ioc a b",
" some β»ΒΉ' Ioo βa βb = Ioo a b",
" some β»ΒΉ' Iio β€ = univ",
" some β»ΒΉ' Ico βa β€ = Ici a",
" some β»ΒΉ' Ioo βa β€ = Ioi a",
" some '' Ioi a = Ioo βa β€... |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module β E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) β’ x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) β’ x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
theorem gaugeRescale_smul (s t : Set E) {c : β} (hc : 0 β€ c) (x : E) :
gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x := by
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
variable [TopologicalSpace E] [T1Space E]
theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent β s) (hsb : IsVonNBounded β s)
(x : E) : gaugeRescale s s x = x := by
rcases eq_or_ne x 0 with rfl | hx; Β· simp
rw [gaugeRescale, div_self, one_smul]
exact ((gauge_pos hsa hsb).2 hx).ne'
theorem gaugeRescale_self {s : Set E} (hsa : Absorbent β s) (hsb : IsVonNBounded β s) :
gaugeRescale s s = id :=
funext <| gaugeRescale_self_apply hsa hsb
theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x β 0) :
gauge t (gaugeRescale s t x) = gauge s x := by
rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)),
smul_eq_mul, div_mul_cancelβ _ hx]
| Mathlib/Analysis/Convex/GaugeRescale.lean | 63 | 67 | theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent β t) (htb : IsVonNBounded β t)
(x : E) : gauge t (gaugeRescale s t x) = gauge s x := by |
rcases eq_or_ne x 0 with rfl | hx
Β· simp
Β· exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne'
| [
" gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x",
" (c * gauge s x / (c * gauge t x) * c) β’ x = (c * (gauge s x / gauge t x)) β’ x",
" gaugeRescale s s x = x",
" gaugeRescale s s 0 = 0",
" gauge s x β 0",
" gauge t (gaugeRescale s t x) = gauge s x",
" gauge t (gaugeRescale s t 0) = gauge s 0"
] | [
" gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x",
" (c * gauge s x / (c * gauge t x) * c) β’ x = (c * (gauge s x / gauge t x)) β’ x",
" gaugeRescale s s x = x",
" gaugeRescale s s 0 = 0",
" gauge s x β 0",
" gauge t (gaugeRescale s t x) = gauge s x"
] |
import Mathlib.Data.Set.Pointwise.Interval
import Mathlib.LinearAlgebra.AffineSpace.Basic
import Mathlib.LinearAlgebra.BilinearMap
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Prod
#align_import linear_algebra.affine_space.affine_map from "leanprover-community/mathlib"@"bd1fc183335ea95a9519a1630bcf901fe9326d83"
open Affine
structure AffineMap (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*) [Ring k]
[AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2]
[AffineSpace V2 P2] where
toFun : P1 β P2
linear : V1 ββ[k] V2
map_vadd' : β (p : P1) (v : V1), toFun (v +α΅₯ p) = linear v +α΅₯ toFun p
#align affine_map AffineMap
notation:25 P1 " βα΅[" k:25 "] " P2:0 => AffineMap k P1 P2
instance AffineMap.instFunLike (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*)
[Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2]
[AffineSpace V2 P2] : FunLike (P1 βα΅[k] P2) P1 P2 where
coe := AffineMap.toFun
coe_injective' := fun β¨f, f_linear, f_addβ© β¨g, g_linear, g_addβ© => fun (h : f = g) => by
cases' (AddTorsor.nonempty : Nonempty P1) with p
congr with v
apply vadd_right_cancel (f p)
erw [β f_add, h, β g_add]
#align affine_map.fun_like AffineMap.instFunLike
instance AffineMap.hasCoeToFun (k : Type*) {V1 : Type*} (P1 : Type*) {V2 : Type*} (P2 : Type*)
[Ring k] [AddCommGroup V1] [Module k V1] [AffineSpace V1 P1] [AddCommGroup V2] [Module k V2]
[AffineSpace V2 P2] : CoeFun (P1 βα΅[k] P2) fun _ => P1 β P2 :=
DFunLike.hasCoeToFun
#align affine_map.has_coe_to_fun AffineMap.hasCoeToFun
namespace AffineMap
variable {k : Type*} {V1 : Type*} {P1 : Type*} {V2 : Type*} {P2 : Type*} {V3 : Type*}
{P3 : Type*} {V4 : Type*} {P4 : Type*} [Ring k] [AddCommGroup V1] [Module k V1]
[AffineSpace V1 P1] [AddCommGroup V2] [Module k V2] [AffineSpace V2 P2] [AddCommGroup V3]
[Module k V3] [AffineSpace V3 P3] [AddCommGroup V4] [Module k V4] [AffineSpace V4 P4]
@[simp]
theorem coe_mk (f : P1 β P2) (linear add) : ((mk f linear add : P1 βα΅[k] P2) : P1 β P2) = f :=
rfl
#align affine_map.coe_mk AffineMap.coe_mk
@[simp]
theorem toFun_eq_coe (f : P1 βα΅[k] P2) : f.toFun = βf :=
rfl
#align affine_map.to_fun_eq_coe AffineMap.toFun_eq_coe
@[simp]
theorem map_vadd (f : P1 βα΅[k] P2) (p : P1) (v : V1) : f (v +α΅₯ p) = f.linear v +α΅₯ f p :=
f.map_vadd' p v
#align affine_map.map_vadd AffineMap.map_vadd
@[simp]
theorem linearMap_vsub (f : P1 βα΅[k] P2) (p1 p2 : P1) : f.linear (p1 -α΅₯ p2) = f p1 -α΅₯ f p2 := by
conv_rhs => rw [β vsub_vadd p1 p2, map_vadd, vadd_vsub]
#align affine_map.linear_map_vsub AffineMap.linearMap_vsub
@[ext]
theorem ext {f g : P1 βα΅[k] P2} (h : β p, f p = g p) : f = g :=
DFunLike.ext _ _ h
#align affine_map.ext AffineMap.ext
theorem ext_iff {f g : P1 βα΅[k] P2} : f = g β β p, f p = g p :=
β¨fun h _ => h βΈ rfl, extβ©
#align affine_map.ext_iff AffineMap.ext_iff
theorem coeFn_injective : @Function.Injective (P1 βα΅[k] P2) (P1 β P2) (β) :=
DFunLike.coe_injective
#align affine_map.coe_fn_injective AffineMap.coeFn_injective
protected theorem congr_arg (f : P1 βα΅[k] P2) {x y : P1} (h : x = y) : f x = f y :=
congr_arg _ h
#align affine_map.congr_arg AffineMap.congr_arg
protected theorem congr_fun {f g : P1 βα΅[k] P2} (h : f = g) (x : P1) : f x = g x :=
h βΈ rfl
#align affine_map.congr_fun AffineMap.congr_fun
| Mathlib/LinearAlgebra/AffineSpace/AffineMap.lean | 162 | 169 | theorem ext_linear {f g : P1 βα΅[k] P2} (hβ : f.linear = g.linear) {p : P1} (hβ : f p = g p) :
f = g := by |
ext q
have hgl : g.linear (q -α΅₯ p) = toFun g ((q -α΅₯ p) +α΅₯ q) -α΅₯ toFun g q := by simp
have := f.map_vadd' q (q -α΅₯ p)
rw [hβ, hgl, toFun_eq_coe, map_vadd, linearMap_vsub, hβ] at this
simp at this
exact this
| [
" { toFun := f, linear := f_linear, map_vadd' := f_add } = { toFun := g, linear := g_linear, map_vadd' := g_add }",
" f_linear v = g_linear v",
" f_linear v +α΅₯ f p = g_linear v +α΅₯ f p",
" f.linear (p1 -α΅₯ p2) = f p1 -α΅₯ f p2",
"k : Type u_1\nV1 : Type u_2\nP1 : Type u_3\nV2 : Type u_4\nP2 : Type u_5\nV3 : Typ... | [
" { toFun := f, linear := f_linear, map_vadd' := f_add } = { toFun := g, linear := g_linear, map_vadd' := g_add }",
" f_linear v = g_linear v",
" f_linear v +α΅₯ f p = g_linear v +α΅₯ f p",
" f.linear (p1 -α΅₯ p2) = f p1 -α΅₯ f p2",
"k : Type u_1\nV1 : Type u_2\nP1 : Type u_3\nV2 : Type u_4\nP2 : Type u_5\nV3 : Typ... |
import Mathlib.Data.List.Duplicate
import Mathlib.Data.List.Sort
#align_import data.list.nodup_equiv_fin from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab"
namespace List
variable {Ξ± : Type*}
section Sublist
| Mathlib/Data/List/NodupEquivFin.lean | 116 | 137 | theorem sublist_of_orderEmbedding_get?_eq {l l' : List Ξ±} (f : β βͺo β)
(hf : β ix : β, l.get? ix = l'.get? (f ix)) : l <+ l' := by |
induction' l with hd tl IH generalizing l' f
Β· simp
have : some hd = _ := hf 0
rw [eq_comm, List.get?_eq_some] at this
obtain β¨w, hβ© := this
let f' : β βͺo β :=
OrderEmbedding.ofMapLEIff (fun i => f (i + 1) - (f 0 + 1)) fun a b => by
dsimp only
rw [Nat.sub_le_sub_iff_right, OrderEmbedding.le_iff_le, Nat.succ_le_succ_iff]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact b.succ_pos
have : β ix, tl.get? ix = (l'.drop (f 0 + 1)).get? (f' ix) := by
intro ix
rw [List.get?_drop, OrderEmbedding.coe_ofMapLEIff, Nat.add_sub_cancel', β hf, List.get?]
rw [Nat.succ_le_iff, OrderEmbedding.lt_iff_lt]
exact ix.succ_pos
rw [β List.take_append_drop (f 0 + 1) l', β List.singleton_append]
apply List.Sublist.append _ (IH _ this)
rw [List.singleton_sublist, β h, l'.get_take _ (Nat.lt_succ_self _)]
apply List.get_mem
| [
" l <+ l'",
" [] <+ l'",
" hd :: tl <+ l'",
" (fun i => f (i + 1) - (f 0 + 1)) a β€ (fun i => f (i + 1) - (f 0 + 1)) b β a β€ b",
" f (a + 1) - (f 0 + 1) β€ f (b + 1) - (f 0 + 1) β a β€ b",
" f 0 + 1 β€ f (b + 1)",
" 0 < b + 1",
" β (ix : β), tl.get? ix = (drop (f 0 + 1) l').get? (f' ix)",
" tl.get? ix =... | [
" l <+ l'"
] |
import Mathlib.Algebra.FreeMonoid.Basic
import Mathlib.Algebra.Group.Submonoid.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Int.Order.Lemmas
#align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
variable {M A B : Type*}
section Assoc
variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B}
section NonAssoc
variable [MulOneClass M]
open Set
namespace Submonoid
-- TODO: this section can be generalized to `[SubmonoidClass B M] [CompleteLattice B]`
-- such that `CompleteLattice.LE` coincides with `SetLike.LE`
@[to_additive]
theorem mem_iSup_of_directed {ΞΉ} [hΞΉ : Nonempty ΞΉ] {S : ΞΉ β Submonoid 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 _ β¦ mem_iUnion.1) ?_ ?_
Β· exact hΞΉ.elim fun i β¦ β¨i, (S i).one_memβ©
Β· 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 submonoid.mem_supr_of_directed Submonoid.mem_iSup_of_directed
#align add_submonoid.mem_supr_of_directed AddSubmonoid.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {ΞΉ} [Nonempty ΞΉ] {S : ΞΉ β Submonoid M} (hS : Directed (Β· β€ Β·) S) :
((β¨ i, S i : Submonoid M) : Set M) = β i, S i :=
Set.ext fun x β¦ by simp [mem_iSup_of_directed hS]
#align submonoid.coe_supr_of_directed Submonoid.coe_iSup_of_directed
#align add_submonoid.coe_supr_of_directed AddSubmonoid.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (Β· β€ Β·) S) {x : M} : x β sSup S β β s β S, x β s := by
haveI : Nonempty S := Sne.to_subtype
simp [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk]
#align submonoid.mem_Sup_of_directed_on Submonoid.mem_sSup_of_directedOn
#align add_submonoid.mem_Sup_of_directed_on AddSubmonoid.mem_sSup_of_directedOn
@[to_additive]
theorem coe_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (Β· β€ Β·) S) : (β(sSup S) : Set M) = β s β S, βs :=
Set.ext fun x => by simp [mem_sSup_of_directedOn Sne hS]
#align submonoid.coe_Sup_of_directed_on Submonoid.coe_sSup_of_directedOn
#align add_submonoid.coe_Sup_of_directed_on AddSubmonoid.coe_sSup_of_directedOn
@[to_additive]
| Mathlib/Algebra/Group/Submonoid/Membership.lean | 234 | 236 | theorem mem_sup_left {S T : Submonoid M} : β {x : M}, x β S β x β S β T := by |
rw [β SetLike.le_def]
exact le_sup_left
| [
" x β β¨ i, S i β β i, x β S i",
" x β β¨ i, S i β β i, x β S i",
" x β closure (β i, β(S i)) β β i, x β S i",
" β i, 1 β S i",
" β (x y : M), (β i, x β S i) β (β i, y β S i) β β i, x * y β S i",
" β i, x * y β S i",
" x β β(β¨ i, S i) β x β β i, β(S i)",
" x β sSup S β β s β S, x β s",
" x β β(sSup S)... | [
" x β β¨ i, S i β β i, x β S i",
" x β β¨ i, S i β β i, x β S i",
" x β closure (β i, β(S i)) β β i, x β S i",
" β i, 1 β S i",
" β (x y : M), (β i, x β S i) β (β i, y β S i) β β i, x * y β S i",
" β i, x * y β S i",
" x β β(β¨ i, S i) β x β β i, β(S i)",
" x β sSup S β β s β S, x β s",
" x β β(sSup S)... |
import Mathlib.MeasureTheory.Measure.Restrict
open scoped ENNReal NNReal Topology
open Set MeasureTheory Measure Filter Function MeasurableSpace ENNReal
variable {Ξ± Ξ² Ξ΄ ΞΉ : Type*}
namespace MeasureTheory
variable {m0 : MeasurableSpace Ξ±} [MeasurableSpace Ξ²] {ΞΌ Ξ½ Ξ½β Ξ½β: Measure Ξ±}
{s t : Set Ξ±}
section IsFiniteMeasure
class IsFiniteMeasure (ΞΌ : Measure Ξ±) : Prop where
measure_univ_lt_top : ΞΌ univ < β
#align measure_theory.is_finite_measure MeasureTheory.IsFiniteMeasure
#align measure_theory.is_finite_measure.measure_univ_lt_top MeasureTheory.IsFiniteMeasure.measure_univ_lt_top
theorem not_isFiniteMeasure_iff : Β¬IsFiniteMeasure ΞΌ β ΞΌ Set.univ = β := by
refine β¨fun h => ?_, fun h => fun h' => h'.measure_univ_lt_top.ne hβ©
by_contra h'
exact h β¨lt_top_iff_ne_top.mpr h'β©
#align measure_theory.not_is_finite_measure_iff MeasureTheory.not_isFiniteMeasure_iff
instance Restrict.isFiniteMeasure (ΞΌ : Measure Ξ±) [hs : Fact (ΞΌ s < β)] :
IsFiniteMeasure (ΞΌ.restrict s) :=
β¨by simpa using hs.elimβ©
#align measure_theory.restrict.is_finite_measure MeasureTheory.Restrict.isFiniteMeasure
theorem measure_lt_top (ΞΌ : Measure Ξ±) [IsFiniteMeasure ΞΌ] (s : Set Ξ±) : ΞΌ s < β :=
(measure_mono (subset_univ s)).trans_lt IsFiniteMeasure.measure_univ_lt_top
#align measure_theory.measure_lt_top MeasureTheory.measure_lt_top
instance isFiniteMeasureRestrict (ΞΌ : Measure Ξ±) (s : Set Ξ±) [h : IsFiniteMeasure ΞΌ] :
IsFiniteMeasure (ΞΌ.restrict s) :=
β¨by simpa using measure_lt_top ΞΌ sβ©
#align measure_theory.is_finite_measure_restrict MeasureTheory.isFiniteMeasureRestrict
theorem measure_ne_top (ΞΌ : Measure Ξ±) [IsFiniteMeasure ΞΌ] (s : Set Ξ±) : ΞΌ s β β :=
ne_of_lt (measure_lt_top ΞΌ s)
#align measure_theory.measure_ne_top MeasureTheory.measure_ne_top
theorem measure_compl_le_add_of_le_add [IsFiniteMeasure ΞΌ] (hs : MeasurableSet s)
(ht : MeasurableSet t) {Ξ΅ : ββ₯0β} (h : ΞΌ s β€ ΞΌ t + Ξ΅) : ΞΌ tαΆ β€ ΞΌ sαΆ + Ξ΅ := by
rw [measure_compl ht (measure_ne_top ΞΌ _), measure_compl hs (measure_ne_top ΞΌ _),
tsub_le_iff_right]
calc
ΞΌ univ = ΞΌ univ - ΞΌ s + ΞΌ s := (tsub_add_cancel_of_le <| measure_mono s.subset_univ).symm
_ β€ ΞΌ univ - ΞΌ s + (ΞΌ t + Ξ΅) := add_le_add_left h _
_ = _ := by rw [add_right_comm, add_assoc]
#align measure_theory.measure_compl_le_add_of_le_add MeasureTheory.measure_compl_le_add_of_le_add
theorem measure_compl_le_add_iff [IsFiniteMeasure ΞΌ] (hs : MeasurableSet s) (ht : MeasurableSet t)
{Ξ΅ : ββ₯0β} : ΞΌ sαΆ β€ ΞΌ tαΆ + Ξ΅ β ΞΌ t β€ ΞΌ s + Ξ΅ :=
β¨fun h => compl_compl s βΈ compl_compl t βΈ measure_compl_le_add_of_le_add hs.compl ht.compl h,
measure_compl_le_add_of_le_add ht hsβ©
#align measure_theory.measure_compl_le_add_iff MeasureTheory.measure_compl_le_add_iff
def measureUnivNNReal (ΞΌ : Measure Ξ±) : ββ₯0 :=
(ΞΌ univ).toNNReal
#align measure_theory.measure_univ_nnreal MeasureTheory.measureUnivNNReal
@[simp]
theorem coe_measureUnivNNReal (ΞΌ : Measure Ξ±) [IsFiniteMeasure ΞΌ] :
β(measureUnivNNReal ΞΌ) = ΞΌ univ :=
ENNReal.coe_toNNReal (measure_ne_top ΞΌ univ)
#align measure_theory.coe_measure_univ_nnreal MeasureTheory.coe_measureUnivNNReal
instance isFiniteMeasureZero : IsFiniteMeasure (0 : Measure Ξ±) :=
β¨by simpβ©
#align measure_theory.is_finite_measure_zero MeasureTheory.isFiniteMeasureZero
instance (priority := 50) isFiniteMeasureOfIsEmpty [IsEmpty Ξ±] : IsFiniteMeasure ΞΌ := by
rw [eq_zero_of_isEmpty ΞΌ]
infer_instance
#align measure_theory.is_finite_measure_of_is_empty MeasureTheory.isFiniteMeasureOfIsEmpty
@[simp]
theorem measureUnivNNReal_zero : measureUnivNNReal (0 : Measure Ξ±) = 0 :=
rfl
#align measure_theory.measure_univ_nnreal_zero MeasureTheory.measureUnivNNReal_zero
instance isFiniteMeasureAdd [IsFiniteMeasure ΞΌ] [IsFiniteMeasure Ξ½] : IsFiniteMeasure (ΞΌ + Ξ½) where
measure_univ_lt_top := by
rw [Measure.coe_add, Pi.add_apply, ENNReal.add_lt_top]
exact β¨measure_lt_top _ _, measure_lt_top _ _β©
#align measure_theory.is_finite_measure_add MeasureTheory.isFiniteMeasureAdd
instance isFiniteMeasureSMulNNReal [IsFiniteMeasure ΞΌ] {r : ββ₯0} : IsFiniteMeasure (r β’ ΞΌ) where
measure_univ_lt_top := ENNReal.mul_lt_top ENNReal.coe_ne_top (measure_ne_top _ _)
#align measure_theory.is_finite_measure_smul_nnreal MeasureTheory.isFiniteMeasureSMulNNReal
instance IsFiniteMeasure.average : IsFiniteMeasure ((ΞΌ univ)β»ΒΉ β’ ΞΌ) where
measure_univ_lt_top := by
rw [smul_apply, smul_eq_mul, β ENNReal.div_eq_inv_mul]
exact ENNReal.div_self_le_one.trans_lt ENNReal.one_lt_top
instance isFiniteMeasureSMulOfNNRealTower {R} [SMul R ββ₯0] [SMul R ββ₯0β] [IsScalarTower R ββ₯0 ββ₯0β]
[IsScalarTower R ββ₯0β ββ₯0β] [IsFiniteMeasure ΞΌ] {r : R} : IsFiniteMeasure (r β’ ΞΌ) := by
rw [β smul_one_smul ββ₯0 r ΞΌ]
infer_instance
#align measure_theory.is_finite_measure_smul_of_nnreal_tower MeasureTheory.isFiniteMeasureSMulOfNNRealTower
theorem isFiniteMeasure_of_le (ΞΌ : Measure Ξ±) [IsFiniteMeasure ΞΌ] (h : Ξ½ β€ ΞΌ) : IsFiniteMeasure Ξ½ :=
{ measure_univ_lt_top := (h Set.univ).trans_lt (measure_lt_top _ _) }
#align measure_theory.is_finite_measure_of_le MeasureTheory.isFiniteMeasure_of_le
@[instance]
| Mathlib/MeasureTheory/Measure/Typeclasses.lean | 132 | 139 | theorem Measure.isFiniteMeasure_map {m : MeasurableSpace Ξ±} (ΞΌ : Measure Ξ±) [IsFiniteMeasure ΞΌ]
(f : Ξ± β Ξ²) : IsFiniteMeasure (ΞΌ.map f) := by |
by_cases hf : AEMeasurable f ΞΌ
Β· constructor
rw [map_apply_of_aemeasurable hf MeasurableSet.univ]
exact measure_lt_top ΞΌ _
Β· rw [map_of_not_aemeasurable hf]
exact MeasureTheory.isFiniteMeasureZero
| [
" Β¬IsFiniteMeasure ΞΌ β ΞΌ univ = β€",
" ΞΌ univ = β€",
" False",
" (ΞΌ.restrict s) univ < β€",
" ΞΌ tαΆ β€ ΞΌ sαΆ + Ξ΅",
" ΞΌ univ β€ ΞΌ univ - ΞΌ s + Ξ΅ + ΞΌ t",
" ΞΌ univ - ΞΌ s + (ΞΌ t + Ξ΅) = ΞΌ univ - ΞΌ s + Ξ΅ + ΞΌ t",
" 0 univ < β€",
" IsFiniteMeasure ΞΌ",
" IsFiniteMeasure 0",
" (ΞΌ + Ξ½) univ < β€",
" ΞΌ univ < β€ β§ ... | [
" Β¬IsFiniteMeasure ΞΌ β ΞΌ univ = β€",
" ΞΌ univ = β€",
" False",
" (ΞΌ.restrict s) univ < β€",
" ΞΌ tαΆ β€ ΞΌ sαΆ + Ξ΅",
" ΞΌ univ β€ ΞΌ univ - ΞΌ s + Ξ΅ + ΞΌ t",
" ΞΌ univ - ΞΌ s + (ΞΌ t + Ξ΅) = ΞΌ univ - ΞΌ s + Ξ΅ + ΞΌ t",
" 0 univ < β€",
" IsFiniteMeasure ΞΌ",
" IsFiniteMeasure 0",
" (ΞΌ + Ξ½) univ < β€",
" ΞΌ univ < β€ β§ ... |
import Mathlib.Topology.Constructions
import Mathlib.Topology.ContinuousOn
#align_import topology.bases from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Function Topology
noncomputable section
namespace TopologicalSpace
universe u
variable {Ξ± : Type u} {Ξ² : Type*} [t : TopologicalSpace Ξ±] {B : Set (Set Ξ±)} {s : Set Ξ±}
structure IsTopologicalBasis (s : Set (Set Ξ±)) : Prop where
exists_subset_inter : β tβ β s, β tβ β s, β x β tβ β© tβ, β tβ β s, x β tβ β§ tβ β tβ β© tβ
sUnion_eq : ββ s = univ
eq_generateFrom : t = generateFrom s
#align topological_space.is_topological_basis TopologicalSpace.IsTopologicalBasis
| Mathlib/Topology/Bases.lean | 77 | 90 | theorem IsTopologicalBasis.insert_empty {s : Set (Set Ξ±)} (h : IsTopologicalBasis s) :
IsTopologicalBasis (insert β
s) := by |
refine β¨?_, by rw [sUnion_insert, empty_union, h.sUnion_eq], ?_β©
Β· rintro tβ (rfl | hβ) tβ (rfl | hβ) x β¨hxβ, hxββ©
Β· cases hxβ
Β· cases hxβ
Β· cases hxβ
Β· obtain β¨tβ, hβ, hsβ© := h.exists_subset_inter _ hβ _ hβ x β¨hxβ, hxββ©
exact β¨tβ, .inr hβ, hsβ©
Β· rw [h.eq_generateFrom]
refine le_antisymm (le_generateFrom fun t => ?_) (generateFrom_anti <| subset_insert β
s)
rintro (rfl | ht)
Β· exact @isOpen_empty _ (generateFrom s)
Β· exact .basic t ht
| [
" IsTopologicalBasis (insert β
s)",
" ββ insert β
s = univ",
" β tβ β insert β
s, β tβ β insert β
s, β x β tβ β© tβ, β tβ β insert β
s, x β tβ β§ tβ β tβ β© tβ",
" β tβ β insert β
s, x β tβ β§ tβ β β
β© β
",
" β tβ β insert β
s, x β tβ β§ tβ β β
β© tβ",
" β tβ β insert β
s, x β tβ β§ tβ β tβ β© β
",
" β tβ β inser... | [
" IsTopologicalBasis (insert β
s)"
] |
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Analysis.Seminorm
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Analysis.RCLike.Basic
#align_import analysis.convex.gauge from "leanprover-community/mathlib"@"373b03b5b9d0486534edbe94747f23cb3712f93d"
open NormedField Set
open scoped Pointwise Topology NNReal
noncomputable section
variable {π E F : Type*}
section AddCommGroup
variable [AddCommGroup E] [Module β E]
def gauge (s : Set E) (x : E) : β :=
sInf { r : β | 0 < r β§ x β r β’ s }
#align gauge gauge
variable {s t : Set E} {x : E} {a : β}
theorem gauge_def : gauge s x = sInf ({ r β Set.Ioi (0 : β) | x β r β’ s }) :=
rfl
#align gauge_def gauge_def
theorem gauge_def' : gauge s x = sInf {r β Set.Ioi (0 : β) | rβ»ΒΉ β’ x β s} := by
congrm sInf {r | ?_}
exact and_congr_right fun hr => mem_smul_set_iff_inv_smul_memβ hr.ne' _ _
#align gauge_def' gauge_def'
private theorem gauge_set_bddBelow : BddBelow { r : β | 0 < r β§ x β r β’ s } :=
β¨0, fun _ hr => hr.1.leβ©
theorem Absorbent.gauge_set_nonempty (absorbs : Absorbent β s) :
{ r : β | 0 < r β§ x β r β’ s }.Nonempty :=
let β¨r, hrβ, hrββ© := (absorbs x).exists_pos
β¨r, hrβ, hrβ r (Real.norm_of_nonneg hrβ.le).ge rflβ©
#align absorbent.gauge_set_nonempty Absorbent.gauge_set_nonempty
theorem gauge_mono (hs : Absorbent β s) (h : s β t) : gauge t β€ gauge s := fun _ =>
csInf_le_csInf gauge_set_bddBelow hs.gauge_set_nonempty fun _ hr => β¨hr.1, smul_set_mono h hr.2β©
#align gauge_mono gauge_mono
| Mathlib/Analysis/Convex/Gauge.lean | 86 | 89 | theorem exists_lt_of_gauge_lt (absorbs : Absorbent β s) (h : gauge s x < a) :
β b, 0 < b β§ b < a β§ x β b β’ s := by |
obtain β¨b, β¨hb, hxβ©, hbaβ© := exists_lt_of_csInf_lt absorbs.gauge_set_nonempty h
exact β¨b, hb, hba, hxβ©
| [
" gauge s x = sInf {r | r β Ioi 0 β§ rβ»ΒΉ β’ x β s}",
" 0 < r β§ x β r β’ s β r β Ioi 0 β§ rβ»ΒΉ β’ x β s",
" β b, 0 < b β§ b < a β§ x β b β’ s"
] | [
" gauge s x = sInf {r | r β Ioi 0 β§ rβ»ΒΉ β’ x β s}",
" 0 < r β§ x β r β’ s β r β Ioi 0 β§ rβ»ΒΉ β’ x β s",
" β b, 0 < b β§ b < a β§ x β b β’ s"
] |
import Mathlib.Data.List.Join
#align_import data.list.permutation from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
-- Make sure we don't import algebra
assert_not_exists Monoid
open Nat
variable {Ξ± Ξ² : Type*}
namespace List
theorem permutationsAux2_fst (t : Ξ±) (ts : List Ξ±) (r : List Ξ²) :
β (ys : List Ξ±) (f : List Ξ± β Ξ²), (permutationsAux2 t ts r ys f).1 = ys ++ ts
| [], f => rfl
| y :: ys, f => by simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_fst List.permutationsAux2_fst
@[simp]
theorem permutationsAux2_snd_nil (t : Ξ±) (ts : List Ξ±) (r : List Ξ²) (f : List Ξ± β Ξ²) :
(permutationsAux2 t ts r [] f).2 = r :=
rfl
#align list.permutations_aux2_snd_nil List.permutationsAux2_snd_nil
@[simp]
theorem permutationsAux2_snd_cons (t : Ξ±) (ts : List Ξ±) (r : List Ξ²) (y : Ξ±) (ys : List Ξ±)
(f : List Ξ± β Ξ²) :
(permutationsAux2 t ts r (y :: ys) f).2 =
f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List Ξ± => f (y :: x)).2 := by
simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
#align list.permutations_aux2_snd_cons List.permutationsAux2_snd_cons
theorem permutationsAux2_append (t : Ξ±) (ts : List Ξ±) (r : List Ξ²) (ys : List Ξ±) (f : List Ξ± β Ξ²) :
(permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
induction ys generalizing f <;> simp [*]
#align list.permutations_aux2_append List.permutationsAux2_append
| Mathlib/Data/List/Permutation.lean | 83 | 87 | theorem permutationsAux2_comp_append {t : Ξ±} {ts ys : List Ξ±} {r : List Ξ²} (f : List Ξ± β Ξ²) :
((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by |
induction' ys with ys_hd _ ys_ih generalizing f
Β· simp
Β· simp [ys_ih fun xs => f (ys_hd :: xs)]
| [
" (permutationsAux2 t ts r (y :: ys) f).1 = y :: ys ++ ts",
" (permutationsAux2 t ts r (y :: ys) f).2 = f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x => f (y :: x)).2",
" (permutationsAux2 t ts [] ys f).2 ++ r = (permutationsAux2 t ts r ys f).2",
" (permutationsAux2 t ts [] [] f).2 ++ r = (permu... | [
" (permutationsAux2 t ts r (y :: ys) f).1 = y :: ys ++ ts",
" (permutationsAux2 t ts r (y :: ys) f).2 = f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x => f (y :: x)).2",
" (permutationsAux2 t ts [] ys f).2 ++ r = (permutationsAux2 t ts r ys f).2",
" (permutationsAux2 t ts [] [] f).2 ++ r = (permu... |
import Mathlib.Data.Set.Image
#align_import order.directed from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
open Function
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {ΞΉ : Sort w} (r r' s : Ξ± β Ξ± β Prop)
local infixl:50 " βΌ " => r
def Directed (f : ΞΉ β Ξ±) :=
β x y, β z, f x βΌ f z β§ f y βΌ f z
#align directed Directed
def DirectedOn (s : Set Ξ±) :=
β x β s, β y β s, β z β s, x βΌ z β§ y βΌ z
#align directed_on DirectedOn
variable {r r'}
theorem directedOn_iff_directed {s} : @DirectedOn Ξ± r s β Directed r (Subtype.val : s β Ξ±) := by
simp only [DirectedOn, Directed, Subtype.exists, exists_and_left, exists_prop, Subtype.forall]
exact forallβ_congr fun x _ => by simp [And.comm, and_assoc]
#align directed_on_iff_directed directedOn_iff_directed
alias β¨DirectedOn.directed_val, _β© := directedOn_iff_directed
#align directed_on.directed_coe DirectedOn.directed_val
| Mathlib/Order/Directed.lean | 66 | 67 | theorem directedOn_range {f : ΞΉ β Ξ±} : Directed r f β DirectedOn r (Set.range f) := by |
simp_rw [Directed, DirectedOn, Set.forall_mem_range, Set.exists_range_iff]
| [
" DirectedOn r s β Directed r Subtype.val",
" (β x β s, β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1 β s, β a_2, r a a_2 β§ a_2 β s β§ r a_1 a_2",
" (β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1, r x a_1 β§ a_1 β s β§ r a a_1",
" Directed r f β DirectedOn r (Set.range f)"
] | [
" DirectedOn r s β Directed r Subtype.val",
" (β x β s, β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1 β s, β a_2, r a a_2 β§ a_2 β s β§ r a_1 a_2",
" (β y β s, β z β s, r x z β§ r y z) β β a β s, β a_1, r x a_1 β§ a_1 β s β§ r a a_1",
" Directed r f β DirectedOn r (Set.range f)"
] |
import Mathlib.Probability.ProbabilityMassFunction.Monad
#align_import probability.probability_mass_function.constructions from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d"
universe u
namespace PMF
noncomputable section
variable {Ξ± Ξ² Ξ³ : Type*}
open scoped Classical
open NNReal ENNReal
section Map
def map (f : Ξ± β Ξ²) (p : PMF Ξ±) : PMF Ξ² :=
bind p (pure β f)
#align pmf.map PMF.map
variable (f : Ξ± β Ξ²) (p : PMF Ξ±) (b : Ξ²)
theorem monad_map_eq_map {Ξ± Ξ² : Type u} (f : Ξ± β Ξ²) (p : PMF Ξ±) : f <$> p = p.map f := rfl
#align pmf.monad_map_eq_map PMF.monad_map_eq_map
@[simp]
theorem map_apply : (map f p) b = β' a, if b = f a then p a else 0 := by simp [map]
#align pmf.map_apply PMF.map_apply
@[simp]
theorem support_map : (map f p).support = f '' p.support :=
Set.ext fun b => by simp [map, @eq_comm Ξ² b]
#align pmf.support_map PMF.support_map
| Mathlib/Probability/ProbabilityMassFunction/Constructions.lean | 60 | 60 | theorem mem_support_map_iff : b β (map f p).support β β a β p.support, f a = b := by | simp
| [
" (map f p) b = β' (a : Ξ±), if b = f a then p a else 0",
" b β (map f p).support β b β f '' p.support",
" b β (map f p).support β β a β p.support, f a = b"
] | [
" (map f p) b = β' (a : Ξ±), if b = f a then p a else 0",
" b β (map f p).support β b β f '' p.support",
" b β (map f p).support β β a β p.support, f a = b"
] |
import Mathlib.Data.ZMod.Basic
import Mathlib.GroupTheory.Index
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import Mathlib.Tactic.IntervalCases
#align_import group_theory.p_group from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
open Fintype MulAction
variable (p : β) (G : Type*) [Group G]
def IsPGroup : Prop :=
β g : G, β k : β, g ^ p ^ k = 1
#align is_p_group IsPGroup
variable {p} {G}
namespace IsPGroup
theorem iff_orderOf [hp : Fact p.Prime] : IsPGroup p G β β g : G, β k : β, orderOf g = p ^ k :=
forall_congr' fun g =>
β¨fun β¨k, hkβ© =>
Exists.imp (fun _ h => h.right)
((Nat.dvd_prime_pow hp.out).mp (orderOf_dvd_of_pow_eq_one hk)),
Exists.imp fun k hk => by rw [β hk, pow_orderOf_eq_one]β©
#align is_p_group.iff_order_of IsPGroup.iff_orderOf
theorem of_card [Fintype G] {n : β} (hG : card G = p ^ n) : IsPGroup p G := fun g =>
β¨n, by rw [β hG, pow_card_eq_one]β©
#align is_p_group.of_card IsPGroup.of_card
theorem of_bot : IsPGroup p (β₯ : Subgroup G) :=
of_card (by rw [β Nat.card_eq_fintype_card, Subgroup.card_bot, pow_zero])
#align is_p_group.of_bot IsPGroup.of_bot
theorem iff_card [Fact p.Prime] [Fintype G] : IsPGroup p G β β n : β, card G = p ^ n := by
have hG : card G β 0 := card_ne_zero
refine β¨fun h => ?_, fun β¨n, hnβ© => of_card hnβ©
suffices β q β Nat.factors (card G), q = p by
use (card G).factors.length
rw [β List.prod_replicate, β List.eq_replicate_of_mem this, Nat.prod_factors hG]
intro q hq
obtain β¨hq1, hq2β© := (Nat.mem_factors hG).mp hq
haveI : Fact q.Prime := β¨hq1β©
obtain β¨g, hgβ© := exists_prime_orderOf_dvd_card q hq2
obtain β¨k, hkβ© := (iff_orderOf.mp h) g
exact (hq1.pow_eq_iff.mp (hg.symm.trans hk).symm).1.symm
#align is_p_group.iff_card IsPGroup.iff_card
alias β¨exists_card_eq, _β© := iff_card
section GIsPGroup
variable (hG : IsPGroup p G)
theorem of_injective {H : Type*} [Group H] (Ο : H β* G) (hΟ : Function.Injective Ο) :
IsPGroup p H := by
simp_rw [IsPGroup, β hΟ.eq_iff, Ο.map_pow, Ο.map_one]
exact fun h => hG (Ο h)
#align is_p_group.of_injective IsPGroup.of_injective
theorem to_subgroup (H : Subgroup G) : IsPGroup p H :=
hG.of_injective H.subtype Subtype.coe_injective
#align is_p_group.to_subgroup IsPGroup.to_subgroup
theorem of_surjective {H : Type*} [Group H] (Ο : G β* H) (hΟ : Function.Surjective Ο) :
IsPGroup p H := by
refine fun h => Exists.elim (hΟ h) fun g hg => Exists.imp (fun k hk => ?_) (hG g)
rw [β hg, β Ο.map_pow, hk, Ο.map_one]
#align is_p_group.of_surjective IsPGroup.of_surjective
theorem to_quotient (H : Subgroup G) [H.Normal] : IsPGroup p (G β§Έ H) :=
hG.of_surjective (QuotientGroup.mk' H) Quotient.surjective_Quotient_mk''
#align is_p_group.to_quotient IsPGroup.to_quotient
theorem of_equiv {H : Type*} [Group H] (Ο : G β* H) : IsPGroup p H :=
hG.of_surjective Ο.toMonoidHom Ο.surjective
#align is_p_group.of_equiv IsPGroup.of_equiv
theorem orderOf_coprime {n : β} (hn : p.Coprime n) (g : G) : (orderOf g).Coprime n :=
let β¨k, hkβ© := hG g
(hn.pow_left k).coprime_dvd_left (orderOf_dvd_of_pow_eq_one hk)
#align is_p_group.order_of_coprime IsPGroup.orderOf_coprime
noncomputable def powEquiv {n : β} (hn : p.Coprime n) : G β G :=
let h : β g : G, (Nat.card (Subgroup.zpowers g)).Coprime n := fun g =>
(Nat.card_zpowers g).symm βΈ hG.orderOf_coprime hn g
{ toFun := (Β· ^ n)
invFun := fun g => (powCoprime (h g)).symm β¨g, Subgroup.mem_zpowers gβ©
left_inv := fun g =>
Subtype.ext_iff.1 <|
(powCoprime (h (g ^ n))).left_inv
β¨g, _, Subtype.ext_iff.1 <| (powCoprime (h g)).left_inv β¨g, Subgroup.mem_zpowers gβ©β©
right_inv := fun g =>
Subtype.ext_iff.1 <| (powCoprime (h g)).right_inv β¨g, Subgroup.mem_zpowers gβ© }
#align is_p_group.pow_equiv IsPGroup.powEquiv
@[simp]
theorem powEquiv_apply {n : β} (hn : p.Coprime n) (g : G) : hG.powEquiv hn g = g ^ n :=
rfl
#align is_p_group.pow_equiv_apply IsPGroup.powEquiv_apply
@[simp]
| Mathlib/GroupTheory/PGroup.lean | 123 | 124 | theorem powEquiv_symm_apply {n : β} (hn : p.Coprime n) (g : G) :
(hG.powEquiv hn).symm g = g ^ (orderOf g).gcdB n := by | rw [β Nat.card_zpowers]; rfl
| [
" g ^ p ^ k = 1",
" g ^ p ^ n = 1",
" card β₯β₯ = p ^ ?m.2806",
" IsPGroup p G β β n, card G = p ^ n",
" β n, card G = p ^ n",
" card G = p ^ (card G).factors.length",
" β q β (card G).factors, q = p",
" q = p",
" IsPGroup p H",
" β (g : H), β k, Ο g ^ p ^ k = 1",
" h ^ p ^ k = 1",
" (hG.powEqui... | [
" g ^ p ^ k = 1",
" g ^ p ^ n = 1",
" card β₯β₯ = p ^ ?m.2806",
" IsPGroup p G β β n, card G = p ^ n",
" β n, card G = p ^ n",
" card G = p ^ (card G).factors.length",
" β q β (card G).factors, q = p",
" q = p",
" IsPGroup p H",
" β (g : H), β k, Ο g ^ p ^ k = 1",
" h ^ p ^ k = 1",
" (hG.powEqui... |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module β E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) β’ x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) β’ x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
theorem gaugeRescale_smul (s t : Set E) {c : β} (hc : 0 β€ c) (x : E) :
gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x := by
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
variable [TopologicalSpace E] [T1Space E]
theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent β s) (hsb : IsVonNBounded β s)
(x : E) : gaugeRescale s s x = x := by
rcases eq_or_ne x 0 with rfl | hx; Β· simp
rw [gaugeRescale, div_self, one_smul]
exact ((gauge_pos hsa hsb).2 hx).ne'
theorem gaugeRescale_self {s : Set E} (hsa : Absorbent β s) (hsb : IsVonNBounded β s) :
gaugeRescale s s = id :=
funext <| gaugeRescale_self_apply hsa hsb
theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x β 0) :
gauge t (gaugeRescale s t x) = gauge s x := by
rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)),
smul_eq_mul, div_mul_cancelβ _ hx]
theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent β t) (htb : IsVonNBounded β t)
(x : E) : gauge t (gaugeRescale s t x) = gauge s x := by
rcases eq_or_ne x 0 with rfl | hx
Β· simp
Β· exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne'
| Mathlib/Analysis/Convex/GaugeRescale.lean | 69 | 73 | theorem gauge_gaugeRescale_le (s t : Set E) (x : E) :
gauge t (gaugeRescale s t x) β€ gauge s x := by |
by_cases hx : gauge t x = 0
Β· simp [gaugeRescale, hx, gauge_nonneg]
Β· exact (gauge_gaugeRescale' s hx).le
| [
" gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x",
" (c * gauge s x / (c * gauge t x) * c) β’ x = (c * (gauge s x / gauge t x)) β’ x",
" gaugeRescale s s x = x",
" gaugeRescale s s 0 = 0",
" gauge s x β 0",
" gauge t (gaugeRescale s t x) = gauge s x",
" gauge t (gaugeRescale s t 0) = gauge s 0",
" ga... | [
" gaugeRescale s t (c β’ x) = c β’ gaugeRescale s t x",
" (c * gauge s x / (c * gauge t x) * c) β’ x = (c * (gauge s x / gauge t x)) β’ x",
" gaugeRescale s s x = x",
" gaugeRescale s s 0 = 0",
" gauge s x β 0",
" gauge t (gaugeRescale s t x) = gauge s x",
" gauge t (gaugeRescale s t 0) = gauge s 0",
" ga... |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode Ξ±) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
Β· apply min?_reverse
Β· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode Ξ±) : t.reverse.max? = t.min? := by
rw [β min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : Β¬x β (.nil : RBNode Ξ±) := by simp [(Β·βΒ·), EMem]
@[simp] theorem mem_node {y c a x b} :
y β (.node c a x b : RBNode Ξ±) β y = x β¨ y β a β¨ y β b := by simp [(Β·βΒ·), EMem]
theorem All_def {t : RBNode Ξ±} : t.All p β β x β t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode Ξ±} : t.Any p β β x β t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t β β x β t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t β β y β t, cmp x y = .eq := Any_def
theorem mem_congr [@TransCmp Ξ± cmp] {t : RBNode Ξ±} (h : cmp x y = .eq) :
Mem cmp x t β Mem cmp y t := by simp [Mem, TransCmp.cmp_congr_left' h]
theorem isOrdered_iff' [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t L R β
(β a β L, t.All (cmpLT cmp a Β·)) β§
(β a β R, t.All (cmpLT cmp Β· a)) β§
(β a β L, β b β R, cmpLT cmp a b) β§
Ordered cmp t := by
induction t generalizing L R with
| nil =>
simp [isOrdered]; split <;> simp [cmpLT_iff]
next h => intro _ ha _ hb; cases h _ _ ha hb
| node _ l v r =>
simp [isOrdered, *]
exact β¨
fun β¨β¨Ll, lv, Lv, olβ©, β¨vr, rR, vR, orβ©β© => β¨
fun _ h => β¨Lv _ h, Ll _ h, (Lv _ h).trans_l vrβ©,
fun _ h => β¨vR _ h, (vR _ h).trans_r lv, rR _ hβ©,
fun _ hL _ hR => (Lv _ hL).trans (vR _ hR),
lv, vr, ol, orβ©,
fun β¨hL, hR, _, lv, vr, ol, orβ© => β¨
β¨fun _ h => (hL _ h).2.1, lv, fun _ h => (hL _ h).1, olβ©,
β¨vr, fun _ h => (hR _ h).2.2, fun _ h => (hR _ h).1, orβ©β©β©
theorem isOrdered_iff [@TransCmp Ξ± cmp] {t : RBNode Ξ±} :
isOrdered cmp t β Ordered cmp t := by simp [isOrdered_iff']
instance (cmp) [@TransCmp Ξ± cmp] (t) : Decidable (Ordered cmp t) := decidable_of_iff _ isOrdered_iff
class IsCut (cmp : Ξ± β Ξ± β Ordering) (cut : Ξ± β Ordering) : Prop where
le_lt_trans [TransCmp cmp] : cmp x y β .gt β cut x = .lt β cut y = .lt
le_gt_trans [TransCmp cmp] : cmp x y β .gt β cut y = .gt β cut x = .gt
theorem IsCut.lt_trans [IsCut cmp cut] [TransCmp cmp]
(H : cmp x y = .lt) : cut x = .lt β cut y = .lt :=
IsCut.le_lt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H
theorem IsCut.gt_trans [IsCut cmp cut] [TransCmp cmp]
(H : cmp x y = .lt) : cut y = .gt β cut x = .gt :=
IsCut.le_gt_trans <| TransCmp.gt_asymm <| OrientedCmp.cmp_eq_gt.2 H
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 92 | 100 | theorem IsCut.congr [IsCut cmp cut] [TransCmp cmp] (H : cmp x y = .eq) : cut x = cut y := by |
cases ey : cut y
Β· exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h) ey
Β· cases ex : cut x
Β· exact IsCut.le_lt_trans (fun h => nomatch H.symm.trans h) ex |>.symm.trans ey
Β· rfl
Β· refine IsCut.le_gt_trans (cmp := cmp) (fun h => ?_) ex |>.symm.trans ey
cases H.symm.trans <| OrientedCmp.cmp_eq_gt.1 h
Β· exact IsCut.le_gt_trans (fun h => nomatch H.symm.trans h) ey
| [
" t.reverse.min? = t.max?",
" t.reverse.min? =\n match t with\n | nil => none\n | node c l v nil => some v\n | node c l v r => r.max?",
" nil.reverse.min? = none",
" (node cβ lβ vβ nil).reverse.min? = some vβ",
" (node cβ lβ vβ rβ).reverse.min? = rβ.max?",
" (node cβ rβ.reverse vβ lβ.reverse).... | [
" t.reverse.min? = t.max?",
" t.reverse.min? =\n match t with\n | nil => none\n | node c l v nil => some v\n | node c l v r => r.max?",
" nil.reverse.min? = none",
" (node cβ lβ vβ nil).reverse.min? = some vβ",
" (node cβ lβ vβ rβ).reverse.min? = rβ.max?",
" (node cβ rβ.reverse vβ lβ.reverse).... |
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]
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, *]
@[to_additive]
theorem mulSupport_extend_one_subset {f : Ξ± β M} {g : Ξ± β N} :
mulSupport (f.extend g 1) β f '' mulSupport g :=
mulSupport_subset_iff'.mpr fun x hfg β¦ by
by_cases hf : β a, f a = x
Β· rw [extend, dif_pos hf, β nmem_mulSupport]
rw [β Classical.choose_spec hf] at hfg
exact fun hg β¦ hfg β¨_, hg, rflβ©
Β· rw [extend_apply' _ _ _ hf]; rfl
@[to_additive]
theorem mulSupport_extend_one {f : Ξ± β M} {g : Ξ± β N} (hf : f.Injective) :
mulSupport (f.extend g 1) = f '' mulSupport g :=
mulSupport_extend_one_subset.antisymm <| by
rintro _ β¨x, hx, rflβ©; rwa [mem_mulSupport, hf.extend_apply]
@[to_additive]
theorem mulSupport_disjoint_iff {f : Ξ± β M} {s : Set Ξ±} :
Disjoint (mulSupport f) s β EqOn f 1 s := by
simp_rw [β subset_compl_iff_disjoint_right, mulSupport_subset_iff', not_mem_compl_iff, EqOn,
Pi.one_apply]
#align function.mul_support_disjoint_iff Function.mulSupport_disjoint_iff
#align function.support_disjoint_iff Function.support_disjoint_iff
@[to_additive]
| Mathlib/Algebra/Group/Support.lean | 127 | 129 | theorem disjoint_mulSupport_iff {f : Ξ± β M} {s : Set Ξ±} :
Disjoint s (mulSupport f) β EqOn f 1 s := by |
rw [disjoint_comm, mulSupport_disjoint_iff]
| [
" mulSupport f = s β (β x β s, f x β 1) β§ β x β s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a β mulSupport (update f x y) β a β insert x (mulSupport f)",
" a β mulSupport (update f a y) β a β insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... | [
" mulSupport f = s β (β x β s, f x β 1) β§ β x β s, f x = 1",
" f x = g x",
" mulSupport (update f x y) = insert x (mulSupport f)",
" a β mulSupport (update f x y) β a β insert x (mulSupport f)",
" a β mulSupport (update f a y) β a β insert a (mulSupport f)",
" mulSupport (update f x 1) = mulSupport f \\ {... |
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer
import Mathlib.CategoryTheory.Limits.Constructions.EpiMono
import Mathlib.CategoryTheory.Limits.Preserves.Limits
import Mathlib.CategoryTheory.Limits.Shapes.Types
#align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
open CategoryTheory.Limits
namespace CategoryTheory
universe v uβ uβ
variable (C : Type uβ) [Category.{v} C] {C' : Type uβ} [Category.{v} C']
-- Porting note(#5171): linter not ported yet
-- @[nolint has_nonempty_instance]
structure GlueData where
J : Type v
U : J β C
V : J Γ J β C
f : β i j, V (i, j) βΆ U i
f_mono : β i j, Mono (f i j) := by infer_instance
f_hasPullback : β i j k, HasPullback (f i j) (f i k) := by infer_instance
f_id : β i, IsIso (f i i) := by infer_instance
t : β i j, V (i, j) βΆ V (j, i)
t_id : β i, t i i = π _
t' : β i j k, pullback (f i j) (f i k) βΆ pullback (f j k) (f j i)
t_fac : β i j k, t' i j k β« pullback.snd = pullback.fst β« t i j
cocycle : β i j k, t' i j k β« t' j k i β« t' k i j = π _
#align category_theory.glue_data CategoryTheory.GlueData
attribute [simp] GlueData.t_id
attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback
attribute [reassoc] GlueData.t_fac GlueData.cocycle
namespace GlueData
variable {C}
variable (D : GlueData C)
@[simp]
theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by
have eqβ := D.t_fac i i j
have eqβ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _)
rw [D.t_id, Category.comp_id, eqβ] at eqβ
have eqβ := (IsIso.eq_comp_inv (D.f i i)).mp eqβ
rw [Category.assoc, β pullback.condition, β Category.assoc] at eqβ
exact
Mono.right_cancellation _ _
((Mono.right_cancellation _ _ eqβ).trans (pullbackSymmetry_hom_comp_fst _ _).symm)
#align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij
theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd := by
rw [β Category.assoc, β D.t_fac]
simp
#align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii
| Mathlib/CategoryTheory/GlueData.lean | 93 | 95 | theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd := by |
rw [β Category.assoc, β D.t_fac]
simp
| [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd",
" D.t' j i i = (D.t' j i i β« pullback.snd) β« inv pullback.snd",
" D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd",
" D.t' i j i = (D.t' i j i β« pullback.snd) β« inv pullback.snd"
] | [
" D.t' i i j = (pullbackSymmetry (D.f i i) (D.f i j)).hom",
" D.t' j i i = pullback.fst β« D.t j i β« inv pullback.snd",
" D.t' j i i = (D.t' j i i β« pullback.snd) β« inv pullback.snd",
" D.t' i j i = pullback.fst β« D.t i j β« inv pullback.snd"
] |
import Mathlib.FieldTheory.RatFunc.Defs
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u v
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
variable {K : Type u}
namespace RatFunc
section Field
variable [CommRing K]
protected irreducible_def zero : RatFunc K :=
β¨0β©
#align ratfunc.zero RatFunc.zero
instance : Zero (RatFunc K) :=
β¨RatFunc.zeroβ©
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]`
-- that does not close the goal
theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by
simp only [Zero.zero, OfNat.ofNat, RatFunc.zero]
#align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero
protected irreducible_def add : RatFunc K β RatFunc K β RatFunc K
| β¨pβ©, β¨qβ© => β¨p + qβ©
#align ratfunc.add RatFunc.add
instance : Add (RatFunc K) :=
β¨RatFunc.addβ©
-- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]`
-- that does not close the goal
theorem ofFractionRing_add (p q : FractionRing K[X]) :
ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by
simp only [HAdd.hAdd, Add.add, RatFunc.add]
#align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add
protected irreducible_def sub : RatFunc K β RatFunc K β RatFunc K
| β¨pβ©, β¨qβ© => β¨p - qβ©
#align ratfunc.sub RatFunc.sub
instance : Sub (RatFunc K) :=
β¨RatFunc.subβ©
-- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]`
-- that does not close the goal
theorem ofFractionRing_sub (p q : FractionRing K[X]) :
ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by
simp only [Sub.sub, HSub.hSub, RatFunc.sub]
#align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub
protected irreducible_def neg : RatFunc K β RatFunc K
| β¨pβ© => β¨-pβ©
#align ratfunc.neg RatFunc.neg
instance : Neg (RatFunc K) :=
β¨RatFunc.negβ©
| Mathlib/FieldTheory/RatFunc/Basic.lean | 117 | 118 | theorem ofFractionRing_neg (p : FractionRing K[X]) :
ofFractionRing (-p) = -ofFractionRing p := by | simp only [Neg.neg, RatFunc.neg]
| [
" { toFractionRing := 0 } = 0",
" { toFractionRing := p + q } = { toFractionRing := p } + { toFractionRing := q }",
" { toFractionRing := p - q } = { toFractionRing := p } - { toFractionRing := q }",
" { toFractionRing := -p } = -{ toFractionRing := p }"
] | [
" { toFractionRing := 0 } = 0",
" { toFractionRing := p + q } = { toFractionRing := p } + { toFractionRing := q }",
" { toFractionRing := p - q } = { toFractionRing := p } - { toFractionRing := q }",
" { toFractionRing := -p } = -{ toFractionRing := p }"
] |
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]
| Mathlib/GroupTheory/Index.lean | 126 | 129 | 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
| [
" (comap f H).index = H.index",
" β (x y : G'), Setoid.r x y β Setoid.r (f x) (f y)",
" β (x y : G'), xβ»ΒΉ * y β comap f H β (f x)β»ΒΉ * f y β H",
" f (xβ»ΒΉ * y) = (f x)β»ΒΉ * f y",
" Function.Injective (Quotient.map' βf β―)",
" β β¦aβ : G' β§Έ comap f Hβ¦, Quotient.map' βf β― (Quotient.mk'' x) = Quotient.map' βf β― a... | [
" (comap f H).index = H.index",
" β (x y : G'), Setoid.r x y β Setoid.r (f x) (f y)",
" β (x y : G'), xβ»ΒΉ * y β comap f H β (f x)β»ΒΉ * f y β H",
" f (xβ»ΒΉ * y) = (f x)β»ΒΉ * f y",
" Function.Injective (Quotient.map' βf β―)",
" β β¦aβ : G' β§Έ comap f Hβ¦, Quotient.map' βf β― (Quotient.mk'' x) = Quotient.map' βf β― a... |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
namespace List
variable {Ξ± : Type*} [DecidableEq Ξ±]
def nextOr : β (_ : List Ξ±) (_ _ : Ξ±), Ξ±
| [], _, default => default
| [_], _, default => default
-- Handles the not-found and the wraparound case
| y :: z :: xs, x, default => if x = y then z else nextOr (z :: xs) x default
#align list.next_or List.nextOr
@[simp]
theorem nextOr_nil (x d : Ξ±) : nextOr [] x d = d :=
rfl
#align list.next_or_nil List.nextOr_nil
@[simp]
theorem nextOr_singleton (x y d : Ξ±) : nextOr [y] x d = d :=
rfl
#align list.next_or_singleton List.nextOr_singleton
@[simp]
theorem nextOr_self_cons_cons (xs : List Ξ±) (x y d : Ξ±) : nextOr (x :: y :: xs) x d = y :=
if_pos rfl
#align list.next_or_self_cons_cons List.nextOr_self_cons_cons
theorem nextOr_cons_of_ne (xs : List Ξ±) (y x d : Ξ±) (h : x β y) :
nextOr (y :: xs) x d = nextOr xs x d := by
cases' xs with z zs
Β· rfl
Β· exact if_neg h
#align list.next_or_cons_of_ne List.nextOr_cons_of_ne
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List Ξ±) (x d d' : Ξ±) (x_mem : x β xs)
(x_ne : x β xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' := by
induction' xs with y ys IH
Β· cases x_mem
cases' ys with z zs
Β· simp at x_mem x_ne
contradiction
by_cases h : x = y
Β· rw [h, nextOr_self_cons_cons, nextOr_self_cons_cons]
Β· rw [nextOr, nextOr, IH]
Β· simpa [h] using x_mem
Β· simpa using x_ne
#align list.next_or_eq_next_or_of_mem_of_ne List.nextOr_eq_nextOr_of_mem_of_ne
| Mathlib/Data/List/Cycle.lean | 76 | 84 | theorem mem_of_nextOr_ne {xs : List Ξ±} {x d : Ξ±} (h : nextOr xs x d β d) : x β xs := by |
induction' xs with y ys IH
Β· simp at h
cases' ys with z zs
Β· simp at h
Β· by_cases hx : x = y
Β· simp [hx]
Β· rw [nextOr_cons_of_ne _ _ _ _ hx] at h
simpa [hx] using IH h
| [
" (y :: xs).nextOr x d = xs.nextOr x d",
" [y].nextOr x d = [].nextOr x d",
" (y :: z :: zs).nextOr x d = (z :: zs).nextOr x d",
" xs.nextOr x d = xs.nextOr x d'",
" [].nextOr x d = [].nextOr x d'",
" (y :: ys).nextOr x d = (y :: ys).nextOr x d'",
" [y].nextOr x d = [y].nextOr x d'",
" (y :: z :: zs).... | [
" (y :: xs).nextOr x d = xs.nextOr x d",
" [y].nextOr x d = [].nextOr x d",
" (y :: z :: zs).nextOr x d = (z :: zs).nextOr x d",
" xs.nextOr x d = xs.nextOr x d'",
" [].nextOr x d = [].nextOr x d'",
" (y :: ys).nextOr x d = (y :: ys).nextOr x d'",
" [y].nextOr x d = [y].nextOr x d'",
" (y :: z :: zs).... |
import Mathlib.Data.ENat.Lattice
import Mathlib.Order.OrderIsoNat
import Mathlib.Tactic.TFAE
#align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
open List hiding le_antisymm
open OrderDual
universe u v
variable {Ξ± Ξ² : Type*}
namespace Set
section LT
variable [LT Ξ±] [LT Ξ²] (s t : Set Ξ±)
def subchain : Set (List Ξ±) :=
{ l | l.Chain' (Β· < Β·) β§ β i β l, i β s }
#align set.subchain Set.subchain
@[simp] -- porting note: new `simp`
theorem nil_mem_subchain : [] β s.subchain := β¨trivial, fun _ β¦ nofunβ©
#align set.nil_mem_subchain Set.nil_mem_subchain
variable {s} {l : List Ξ±} {a : Ξ±}
theorem cons_mem_subchain_iff :
(a::l) β s.subchain β a β s β§ l β s.subchain β§ β b β l.head?, a < b := by
simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm,
and_assoc]
#align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff
@[simp] -- Porting note (#10756): new lemma + `simp`
theorem singleton_mem_subchain_iff : [a] β s.subchain β a β s := by simp [cons_mem_subchain_iff]
instance : Nonempty s.subchain :=
β¨β¨[], s.nil_mem_subchainβ©β©
variable (s)
noncomputable def chainHeight : ββ :=
β¨ l β s.subchain, length l
#align set.chain_height Set.chainHeight
theorem chainHeight_eq_iSup_subtype : s.chainHeight = β¨ l : s.subchain, βl.1.length :=
iSup_subtype'
#align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype
| Mathlib/Order/Height.lean | 93 | 106 | theorem exists_chain_of_le_chainHeight {n : β} (hn : βn β€ s.chainHeight) :
β l β s.subchain, length l = n := by |
rcases (le_top : s.chainHeight β€ β€).eq_or_lt with ha | ha <;>
rw [chainHeight_eq_iSup_subtype] at ha
Β· obtain β¨_, β¨β¨l, hβ, hββ©, rflβ©, hββ© :=
not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
exact β¨l.take n, β¨hβ.take _, fun x h β¦ hβ _ <| take_subset _ _ hβ©,
(l.length_take n).trans <| min_eq_left <| le_of_not_ge hββ©
Β· rw [ENat.iSup_coe_lt_top] at ha
obtain β¨β¨l, hβ, hββ©, e : l.length = _β© := Nat.sSup_mem (Set.range_nonempty _) ha
refine
β¨l.take n, β¨hβ.take _, fun x h β¦ hβ _ <| take_subset _ _ hβ©,
(l.length_take n).trans <| min_eq_left <| ?_β©
rwa [e, β Nat.cast_le (Ξ± := ββ), sSup_range, ENat.coe_iSup ha, β chainHeight_eq_iSup_subtype]
| [
" a :: l β s.subchain β a β s β§ l β s.subchain β§ β b β l.head?, a < b",
" [a] β s.subchain β a β s",
" β l β s.subchain, l.length = n",
" n β€ l.length"
] | [
" a :: l β s.subchain β a β s β§ l β s.subchain β§ β b β l.head?, a < b",
" [a] β s.subchain β a β s",
" β l β s.subchain, l.length = n"
] |
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.SetTheory.Cardinal.Cofinality
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
noncomputable section
universe u
open Function Set Submodule
variable {ΞΉ : Type*} {ΞΉ' : Type*} {R : Type*} {Rβ : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable [Semiring R]
variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
section
variable (ΞΉ R M)
structure Basis where
ofRepr ::
repr : M ββ[R] ΞΉ ββ R
#align basis Basis
#align basis.repr Basis.repr
#align basis.of_repr Basis.ofRepr
end
instance uniqueBasis [Subsingleton R] : Unique (Basis ΞΉ R M) :=
β¨β¨β¨defaultβ©β©, fun β¨bβ© => by rw [Subsingleton.elim b]β©
#align unique_basis uniqueBasis
namespace Basis
instance : Inhabited (Basis ΞΉ R (ΞΉ ββ R)) :=
β¨.ofRepr (LinearEquiv.refl _ _)β©
variable (b bβ : Basis ΞΉ R M) (i : ΞΉ) (c : R) (x : M)
section repr
theorem repr_injective : Injective (repr : Basis ΞΉ R M β M ββ[R] ΞΉ ββ R) := fun f g h => by
cases f; cases g; congr
#align basis.repr_injective Basis.repr_injective
instance instFunLike : FunLike (Basis ΞΉ R M) ΞΉ M where
coe b i := b.repr.symm (Finsupp.single i 1)
coe_injective' f g h := repr_injective <| LinearEquiv.symm_bijective.injective <|
LinearEquiv.toLinearMap_injective <| by ext; exact congr_fun h _
#align basis.fun_like Basis.instFunLike
@[simp]
theorem coe_ofRepr (e : M ββ[R] ΞΉ ββ R) : β(ofRepr e) = fun i => e.symm (Finsupp.single i 1) :=
rfl
#align basis.coe_of_repr Basis.coe_ofRepr
protected theorem injective [Nontrivial R] : Injective b :=
b.repr.symm.injective.comp fun _ _ => (Finsupp.single_left_inj (one_ne_zero : (1 : R) β 0)).mp
#align basis.injective Basis.injective
theorem repr_symm_single_one : b.repr.symm (Finsupp.single i 1) = b i :=
rfl
#align basis.repr_symm_single_one Basis.repr_symm_single_one
theorem repr_symm_single : b.repr.symm (Finsupp.single i c) = c β’ b i :=
calc
b.repr.symm (Finsupp.single i c) = b.repr.symm (c β’ Finsupp.single i (1 : R)) := by
{ rw [Finsupp.smul_single', mul_one] }
_ = c β’ b i := by rw [LinearEquiv.map_smul, repr_symm_single_one]
#align basis.repr_symm_single Basis.repr_symm_single
@[simp]
theorem repr_self : b.repr (b i) = Finsupp.single i 1 :=
LinearEquiv.apply_symm_apply _ _
#align basis.repr_self Basis.repr_self
| Mathlib/LinearAlgebra/Basis.lean | 149 | 150 | theorem repr_self_apply (j) [Decidable (i = j)] : b.repr (b i) j = if i = j then 1 else 0 := by |
rw [repr_self, Finsupp.single_apply]
| [
" { repr := b } = default",
" f = g",
" { repr := reprβ } = g",
" { repr := reprβΒΉ } = { repr := reprβ }",
" βf.repr.symm = βg.repr.symm",
" (βf.repr.symm ββ Finsupp.lsingle aβ) 1 = (βg.repr.symm ββ Finsupp.lsingle aβ) 1",
" b.repr.symm (Finsupp.single i c) = b.repr.symm (c β’ Finsupp.single i 1)",
" b... | [
" { repr := b } = default",
" f = g",
" { repr := reprβ } = g",
" { repr := reprβΒΉ } = { repr := reprβ }",
" βf.repr.symm = βg.repr.symm",
" (βf.repr.symm ββ Finsupp.lsingle aβ) 1 = (βg.repr.symm ββ Finsupp.lsingle aβ) 1",
" b.repr.symm (Finsupp.single i c) = b.repr.symm (c β’ Finsupp.single i 1)",
" b... |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
theorem Int.sq_ne_two_mod_four (z : β€) : z * z % 4 β 2 := by
suffices Β¬z * z % (4 : β) = 2 % (4 : β) by exact this
rw [β ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
#align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four
noncomputable section
open scoped Classical
def PythagoreanTriple (x y z : β€) : Prop :=
x * x + y * y = z * z
#align pythagorean_triple PythagoreanTriple
| Mathlib/NumberTheory/PythagoreanTriples.lean | 54 | 56 | theorem pythagoreanTriple_comm {x y z : β€} : PythagoreanTriple x y z β PythagoreanTriple y x z := by |
delta PythagoreanTriple
rw [add_comm]
| [
" z * z β 2",
" β¨0, β―β© * β¨0, β―β© β 2",
" β¨1, β―β© * β¨1, β―β© β 2",
" β¨2, β―β© * β¨2, β―β© β 2",
" β¨3, β―β© * β¨3, β―β© β 2",
" z * z % 4 β 2",
" Β¬z * z % β4 = 2 % β4",
" Β¬β(z * z) = β2",
" PythagoreanTriple x y z β PythagoreanTriple y x z",
" x * x + y * y = z * z β y * y + x * x = z * z"
] | [
" z * z β 2",
" β¨0, β―β© * β¨0, β―β© β 2",
" β¨1, β―β© * β¨1, β―β© β 2",
" β¨2, β―β© * β¨2, β―β© β 2",
" β¨3, β―β© * β¨3, β―β© β 2",
" z * z % 4 β 2",
" Β¬z * z % β4 = 2 % β4",
" Β¬β(z * z) = β2",
" PythagoreanTriple x y z β PythagoreanTriple y x z"
] |
import Mathlib.Data.List.OfFn
import Mathlib.Data.List.Range
#align_import data.list.indexes from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
assert_not_exists MonoidWithZero
universe u v
open Function
namespace List
variable {Ξ± : Type u} {Ξ² : Type v}
section MapIdx
-- Porting note: Add back old definition because it's easier for writing proofs.
protected def oldMapIdxCore (f : β β Ξ± β Ξ²) : β β List Ξ± β List Ξ²
| _, [] => []
| k, a :: as => f k a :: List.oldMapIdxCore f (k + 1) as
protected def oldMapIdx (f : β β Ξ± β Ξ²) (as : List Ξ±) : List Ξ² :=
List.oldMapIdxCore f 0 as
@[simp]
theorem mapIdx_nil {Ξ± Ξ²} (f : β β Ξ± β Ξ²) : mapIdx f [] = [] :=
rfl
#align list.map_with_index_nil List.mapIdx_nil
-- Porting note (#10756): new theorem.
protected theorem oldMapIdxCore_eq (l : List Ξ±) (f : β β Ξ± β Ξ²) (n : β) :
l.oldMapIdxCore f n = l.oldMapIdx fun i a β¦ f (i + n) a := by
induction' l with hd tl hl generalizing f n
Β· rfl
Β· rw [List.oldMapIdx]
simp only [List.oldMapIdxCore, hl, Nat.add_left_comm, Nat.add_comm, Nat.add_zero]
#noalign list.map_with_index_core_eq
-- Porting note: convert new definition to old definition.
-- A few new theorems are added to achieve this
-- 1. Prove that `oldMapIdxCore f (l ++ [e]) = oldMapIdxCore f l ++ [f l.length e]`
-- 2. Prove that `oldMapIdx f (l ++ [e]) = oldMapIdx f l ++ [f l.length e]`
-- 3. Prove list induction using `β l e, p [] β (p l β p (l ++ [e])) β p l`
-- Porting note (#10756): new theorem.
theorem list_reverse_induction (p : List Ξ± β Prop) (base : p [])
(ind : β (l : List Ξ±) (e : Ξ±), p l β p (l ++ [e])) : (β (l : List Ξ±), p l) := by
let q := fun l β¦ p (reverse l)
have pq : β l, p (reverse l) β q l := by simp only [q, reverse_reverse]; intro; exact id
have qp : β l, q (reverse l) β p l := by simp only [q, reverse_reverse]; intro; exact id
intro l
apply qp
generalize (reverse l) = l
induction' l with head tail ih
Β· apply pq; simp only [reverse_nil, base]
Β· apply pq; simp only [reverse_cons]; apply ind; apply qp; rw [reverse_reverse]; exact ih
-- Porting note (#10756): new theorem.
protected theorem oldMapIdxCore_append : β (f : β β Ξ± β Ξ²) (n : β) (lβ lβ : List Ξ±),
List.oldMapIdxCore f n (lβ ++ lβ) =
List.oldMapIdxCore f n lβ ++ List.oldMapIdxCore f (n + lβ.length) lβ := by
intros f n lβ lβ
generalize e : (lβ ++ lβ).length = len
revert n lβ lβ
induction' len with len ih <;> intros n lβ lβ h
Β· have lβ_nil : lβ = [] := by
cases lβ
Β· rfl
Β· contradiction
have lβ_nil : lβ = [] := by
cases lβ
Β· rfl
Β· rw [List.length_append] at h; contradiction
simp only [lβ_nil, lβ_nil]; rfl
Β· cases' lβ with head tail
Β· rfl
Β· simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and]
suffices n + Nat.succ (length tail) = n + 1 + tail.length by
rw [this]
apply ih (n + 1) _ _ _
simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
simp only [length_append, h]
rw [Nat.add_assoc]; simp only [Nat.add_comm]
-- Porting note (#10756): new theorem.
protected theorem oldMapIdx_append : β (f : β β Ξ± β Ξ²) (l : List Ξ±) (e : Ξ±),
List.oldMapIdx f (l ++ [e]) = List.oldMapIdx f l ++ [f l.length e] := by
intros f l e
unfold List.oldMapIdx
rw [List.oldMapIdxCore_append f 0 l [e]]
simp only [Nat.zero_add]; rfl
-- Porting note (#10756): new theorem.
theorem mapIdxGo_append : β (f : β β Ξ± β Ξ²) (lβ lβ : List Ξ±) (arr : Array Ξ²),
mapIdx.go f (lβ ++ lβ) arr = mapIdx.go f lβ (List.toArray (mapIdx.go f lβ arr)) := by
intros f lβ lβ arr
generalize e : (lβ ++ lβ).length = len
revert lβ lβ arr
induction' len with len ih <;> intros lβ lβ arr h
Β· have lβ_nil : lβ = [] := by
cases lβ
Β· rfl
Β· contradiction
have lβ_nil : lβ = [] := by
cases lβ
Β· rfl
Β· rw [List.length_append] at h; contradiction
rw [lβ_nil, lβ_nil]; simp only [mapIdx.go, Array.toList_eq, Array.toArray_data]
Β· cases' lβ with head tail <;> simp only [mapIdx.go]
Β· simp only [nil_append, Array.toList_eq, Array.toArray_data]
Β· simp only [List.append_eq]
rw [ih]
Β· simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
simp only [length_append, h]
-- Porting note (#10756): new theorem.
theorem mapIdxGo_length : β (f : β β Ξ± β Ξ²) (l : List Ξ±) (arr : Array Ξ²),
length (mapIdx.go f l arr) = length l + arr.size := by
intro f l
induction' l with head tail ih
Β· intro; simp only [mapIdx.go, Array.toList_eq, length_nil, Nat.zero_add]
Β· intro; simp only [mapIdx.go]; rw [ih]; simp only [Array.size_push, length_cons];
simp only [Nat.add_succ, add_zero, Nat.add_comm]
-- Porting note (#10756): new theorem.
| Mathlib/Data/List/Indexes.lean | 141 | 147 | theorem mapIdx_append_one : β (f : β β Ξ± β Ξ²) (l : List Ξ±) (e : Ξ±),
mapIdx f (l ++ [e]) = mapIdx f l ++ [f l.length e] := by |
intros f l e
unfold mapIdx
rw [mapIdxGo_append f l [e]]
simp only [mapIdx.go, Array.size_toArray, mapIdxGo_length, length_nil, Nat.add_zero,
Array.toList_eq, Array.push_data, Array.data_toArray]
| [
" List.oldMapIdxCore f n l = List.oldMapIdx (fun i a => f (i + n) a) l",
" List.oldMapIdxCore f n [] = List.oldMapIdx (fun i a => f (i + n) a) []",
" List.oldMapIdxCore f n (hd :: tl) = List.oldMapIdx (fun i a => f (i + n) a) (hd :: tl)",
" List.oldMapIdxCore f n (hd :: tl) = List.oldMapIdxCore (fun i a => f ... | [
" List.oldMapIdxCore f n l = List.oldMapIdx (fun i a => f (i + n) a) l",
" List.oldMapIdxCore f n [] = List.oldMapIdx (fun i a => f (i + n) a) []",
" List.oldMapIdxCore f n (hd :: tl) = List.oldMapIdx (fun i a => f (i + n) a) (hd :: tl)",
" List.oldMapIdxCore f n (hd :: tl) = List.oldMapIdxCore (fun i a => f ... |
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Preserves.Basic
#align_import category_theory.limits.preserves.shapes.pullbacks from "leanprover-community/mathlib"@"f11e306adb9f2a393539d2bb4293bf1b42caa7ac"
noncomputable section
universe vβ vβ uβ uβ
-- Porting note: need Functor namespace for mapCone
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Functor
namespace CategoryTheory.Limits
section Pushout
variable {C : Type uβ} [Category.{vβ} C]
variable {D : Type uβ} [Category.{vβ} D]
variable (G : C β₯€ D)
variable {W X Y Z : C} {h : X βΆ Z} {k : Y βΆ Z} {f : W βΆ X} {g : W βΆ Y} (comm : f β« h = g β« k)
def isColimitMapCoconePushoutCoconeEquiv :
IsColimit (mapCocone G (PushoutCocone.mk h k comm)) β
IsColimit
(PushoutCocone.mk (G.map h) (G.map k) (by simp only [β G.map_comp, comm]) :
PushoutCocone (G.map f) (G.map g)) :=
(IsColimit.precomposeHomEquiv (diagramIsoSpan.{vβ} _).symm _).symm.trans <|
IsColimit.equivIsoColimit <|
Cocones.ext (Iso.refl _) <| by
rintro (_ | _ | _) <;> dsimp <;>
simp only [Category.comp_id, Category.id_comp, β G.map_comp]
#align category_theory.limits.is_colimit_map_cocone_pushout_cocone_equiv CategoryTheory.Limits.isColimitMapCoconePushoutCoconeEquiv
def isColimitPushoutCoconeMapOfIsColimit [PreservesColimit (span f g) G]
(l : IsColimit (PushoutCocone.mk h k comm)) :
IsColimit (PushoutCocone.mk (G.map h) (G.map k) (show G.map f β« G.map h = G.map g β« G.map k
from by simp only [β G.map_comp,comm] )) :=
isColimitMapCoconePushoutCoconeEquiv G comm (PreservesColimit.preserves l)
#align category_theory.limits.is_colimit_pushout_cocone_map_of_is_colimit CategoryTheory.Limits.isColimitPushoutCoconeMapOfIsColimit
def isColimitOfIsColimitPushoutCoconeMap [ReflectsColimit (span f g) G]
(l : IsColimit (PushoutCocone.mk (G.map h) (G.map k) (show G.map f β« G.map h =
G.map g β« G.map k from by simp only [β G.map_comp,comm]))) :
IsColimit (PushoutCocone.mk h k comm) :=
ReflectsColimit.reflects ((isColimitMapCoconePushoutCoconeEquiv G comm).symm l)
#align category_theory.limits.is_colimit_of_is_colimit_pushout_cocone_map CategoryTheory.Limits.isColimitOfIsColimitPushoutCoconeMap
variable (f g) [PreservesColimit (span f g) G]
def isColimitOfHasPushoutOfPreservesColimit [i : HasPushout f g] :
IsColimit (PushoutCocone.mk (G.map pushout.inl) (G.map (@pushout.inr _ _ _ _ _ f g i))
(show G.map f β« G.map pushout.inl = G.map g β« G.map pushout.inr from by
simp only [β G.map_comp, pushout.condition])) :=
isColimitPushoutCoconeMapOfIsColimit G _ (pushoutIsPushout f g)
#align category_theory.limits.is_colimit_of_has_pushout_of_preserves_colimit CategoryTheory.Limits.isColimitOfHasPushoutOfPreservesColimit
def preservesPushoutSymmetry : PreservesColimit (span g f) G where
preserves {c} hc := by
apply (IsColimit.precomposeHomEquiv (diagramIsoSpan.{vβ} _).symm _).toFun
apply IsColimit.ofIsoColimit _ (PushoutCocone.isoMk _).symm
apply PushoutCocone.isColimitOfFlip
apply (isColimitMapCoconePushoutCoconeEquiv _ _).toFun
Β· refine @PreservesColimit.preserves _ _ _ _ _ _ _ _ ?_ _ ?_ -- Porting note: more TC coddling
Β· dsimp
infer_instance
Β· exact PushoutCocone.flipIsColimit hc
#align category_theory.limits.preserves_pushout_symmetry CategoryTheory.Limits.preservesPushoutSymmetry
theorem hasPushout_of_preservesPushout [HasPushout f g] : HasPushout (G.map f) (G.map g) :=
β¨β¨β¨_, isColimitPushoutCoconeMapOfIsColimit G _ (pushoutIsPushout _ _)β©β©β©
#align category_theory.limits.has_pushout_of_preserves_pushout CategoryTheory.Limits.hasPushout_of_preservesPushout
variable [HasPushout f g] [HasPushout (G.map f) (G.map g)]
def PreservesPushout.iso : pushout (G.map f) (G.map g) β
G.obj (pushout f g) :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _)
(isColimitOfHasPushoutOfPreservesColimit G f g)
#align category_theory.limits.preserves_pushout.iso CategoryTheory.Limits.PreservesPushout.iso
@[simp]
theorem PreservesPushout.iso_hom : (PreservesPushout.iso G f g).hom = pushoutComparison G f g :=
rfl
#align category_theory.limits.preserves_pushout.iso_hom CategoryTheory.Limits.PreservesPushout.iso_hom
@[reassoc]
theorem PreservesPushout.inl_iso_hom :
pushout.inl β« (PreservesPushout.iso G f g).hom = G.map pushout.inl := by
delta PreservesPushout.iso
simp
#align category_theory.limits.preserves_pushout.inl_iso_hom CategoryTheory.Limits.PreservesPushout.inl_iso_hom
@[reassoc]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Pullbacks.lean | 232 | 235 | theorem PreservesPushout.inr_iso_hom :
pushout.inr β« (PreservesPushout.iso G f g).hom = G.map pushout.inr := by |
delta PreservesPushout.iso
simp
| [
" G.map f β« G.map h = G.map g β« G.map k",
" β (j : WalkingSpan),\n ((Cocones.precompose (diagramIsoSpan (span f g β G)).symm.hom).obj (G.mapCocone (PushoutCocone.mk h k comm))).ΞΉ.app\n j β«\n (Iso.refl\n ((Cocones.precompose (diagramIsoSpan (span f g β G)).symm.hom).obj\n ... | [
" G.map f β« G.map h = G.map g β« G.map k",
" β (j : WalkingSpan),\n ((Cocones.precompose (diagramIsoSpan (span f g β G)).symm.hom).obj (G.mapCocone (PushoutCocone.mk h k comm))).ΞΉ.app\n j β«\n (Iso.refl\n ((Cocones.precompose (diagramIsoSpan (span f g β G)).symm.hom).obj\n ... |
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
theorem Int.sq_ne_two_mod_four (z : β€) : z * z % 4 β 2 := by
suffices Β¬z * z % (4 : β) = 2 % (4 : β) by exact this
rw [β ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
#align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four
noncomputable section
open scoped Classical
def PythagoreanTriple (x y z : β€) : Prop :=
x * x + y * y = z * z
#align pythagorean_triple PythagoreanTriple
theorem pythagoreanTriple_comm {x y z : β€} : PythagoreanTriple x y z β PythagoreanTriple y x z := by
delta PythagoreanTriple
rw [add_comm]
#align pythagorean_triple_comm pythagoreanTriple_comm
| Mathlib/NumberTheory/PythagoreanTriples.lean | 60 | 61 | theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by |
simp only [PythagoreanTriple, zero_mul, zero_add]
| [
" z * z β 2",
" β¨0, β―β© * β¨0, β―β© β 2",
" β¨1, β―β© * β¨1, β―β© β 2",
" β¨2, β―β© * β¨2, β―β© β 2",
" β¨3, β―β© * β¨3, β―β© β 2",
" z * z % 4 β 2",
" Β¬z * z % β4 = 2 % β4",
" Β¬β(z * z) = β2",
" PythagoreanTriple x y z β PythagoreanTriple y x z",
" x * x + y * y = z * z β y * y + x * x = z * z",
" PythagoreanTriple ... | [
" z * z β 2",
" β¨0, β―β© * β¨0, β―β© β 2",
" β¨1, β―β© * β¨1, β―β© β 2",
" β¨2, β―β© * β¨2, β―β© β 2",
" β¨3, β―β© * β¨3, β―β© β 2",
" z * z % 4 β 2",
" Β¬z * z % β4 = 2 % β4",
" Β¬β(z * z) = β2",
" PythagoreanTriple x y z β PythagoreanTriple y x z",
" x * x + y * y = z * z β y * y + x * x = z * z",
" PythagoreanTriple ... |
import Mathlib.Data.Matrix.Block
import Mathlib.Data.Matrix.Notation
import Mathlib.LinearAlgebra.StdBasis
import Mathlib.RingTheory.AlgebraTower
import Mathlib.Algebra.Algebra.Subalgebra.Tower
#align_import linear_algebra.matrix.to_lin from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6"
noncomputable section
open LinearMap Matrix Set Submodule
section ToMatrixRight
variable {R : Type*} [Semiring R]
variable {l m n : Type*}
def Matrix.vecMulLinear [Fintype m] (M : Matrix m n R) : (m β R) ββ[R] n β R where
toFun x := x α΅₯* M
map_add' _ _ := funext fun _ β¦ add_dotProduct _ _ _
map_smul' _ _ := funext fun _ β¦ smul_dotProduct _ _ _
#align matrix.vec_mul_linear Matrix.vecMulLinear
@[simp] theorem Matrix.vecMulLinear_apply [Fintype m] (M : Matrix m n R) (x : m β R) :
M.vecMulLinear x = x α΅₯* M := rfl
theorem Matrix.coe_vecMulLinear [Fintype m] (M : Matrix m n R) :
(M.vecMulLinear : _ β _) = M.vecMul := rfl
variable [Fintype m] [DecidableEq m]
@[simp]
theorem Matrix.vecMul_stdBasis (M : Matrix m n R) (i j) :
(LinearMap.stdBasis R (fun _ β¦ R) i 1 α΅₯* M) j = M i j := by
have : (β i', (if i = i' then 1 else 0) * M i' j) = M i j := by
simp_rw [boole_mul, Finset.sum_ite_eq, Finset.mem_univ, if_true]
simp only [vecMul, dotProduct]
convert this
split_ifs with h <;> simp only [stdBasis_apply]
Β· rw [h, Function.update_same]
Β· rw [Function.update_noteq (Ne.symm h), Pi.zero_apply]
#align matrix.vec_mul_std_basis Matrix.vecMul_stdBasis
| Mathlib/LinearAlgebra/Matrix/ToLin.lean | 102 | 110 | theorem range_vecMulLinear (M : Matrix m n R) :
LinearMap.range M.vecMulLinear = span R (range M) := by |
letI := Classical.decEq m
simp_rw [range_eq_map, β iSup_range_stdBasis, Submodule.map_iSup, range_eq_map, β
Ideal.span_singleton_one, Ideal.span, Submodule.map_span, image_image, image_singleton,
Matrix.vecMulLinear_apply, iSup_span, range_eq_iUnion, iUnion_singleton_eq_range,
LinearMap.stdBasis, coe_single]
unfold vecMul
simp_rw [single_dotProduct, one_mul]
| [
" ((LinearMap.stdBasis R (fun x => R) i) 1 α΅₯* M) j = M i j",
" β i' : m, (if i = i' then 1 else 0) * M i' j = M i j",
" β x : m, (LinearMap.stdBasis R (fun x => R) i) 1 x * M x j = M i j",
" (LinearMap.stdBasis R (fun x => R) i) 1 xβ = if i = xβ then 1 else 0",
" (LinearMap.stdBasis R (fun x => R) i) 1 xβ =... | [
" ((LinearMap.stdBasis R (fun x => R) i) 1 α΅₯* M) j = M i j",
" β i' : m, (if i = i' then 1 else 0) * M i' j = M i j",
" β x : m, (LinearMap.stdBasis R (fun x => R) i) 1 x * M x j = M i j",
" (LinearMap.stdBasis R (fun x => R) i) 1 xβ = if i = xβ then 1 else 0",
" (LinearMap.stdBasis R (fun x => R) i) 1 xβ =... |
import Mathlib.Analysis.InnerProductSpace.Orientation
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
#align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
variable {ΞΉ E F : Type*}
variable [Fintype ΞΉ] [NormedAddCommGroup F] [InnerProductSpace β F] [FiniteDimensional β F]
[MeasurableSpace F] [BorelSpace F]
section
variable {m n : β} [_i : Fact (finrank β F = n)]
theorem Orientation.measure_orthonormalBasis (o : Orientation β F (Fin n))
(b : OrthonormalBasis ΞΉ β F) : o.volumeForm.measure (parallelepiped b) = 1 := by
have e : ΞΉ β Fin n := by
refine Fintype.equivFinOfCardEq ?_
rw [β _i.out, finrank_eq_card_basis b.toBasis]
have A : βb = b.reindex e β e := by
ext x
simp only [OrthonormalBasis.coe_reindex, Function.comp_apply, Equiv.symm_apply_apply]
rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped,
o.abs_volumeForm_apply_of_orthonormal, ENNReal.ofReal_one]
#align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis
theorem Orientation.measure_eq_volume (o : Orientation β F (Fin n)) :
o.volumeForm.measure = volume := by
have A : o.volumeForm.measure (stdOrthonormalBasis β F).toBasis.parallelepiped = 1 :=
Orientation.measure_orthonormalBasis o (stdOrthonormalBasis β F)
rw [addHaarMeasure_unique o.volumeForm.measure
(stdOrthonormalBasis β F).toBasis.parallelepiped, A, one_smul]
simp only [volume, Basis.addHaar]
#align orientation.measure_eq_volume Orientation.measure_eq_volume
end
| Mathlib/MeasureTheory/Measure/Haar/InnerProductSpace.lean | 61 | 66 | theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ΞΉ β F) :
volume (parallelepiped b) = 1 := by |
haveI : Fact (finrank β F = finrank β F) := β¨rflβ©
let o := (stdOrthonormalBasis β F).toBasis.orientation
rw [β o.measure_eq_volume]
exact o.measure_orthonormalBasis b
| [
" o.volumeForm.measure (parallelepiped βb) = 1",
" ΞΉ β Fin n",
" Fintype.card ΞΉ = n",
" βb = β(b.reindex e) β βe",
" b x = (β(b.reindex e) β βe) x",
" o.volumeForm.measure = volume",
" addHaarMeasure (stdOrthonormalBasis β F).toBasis.parallelepiped = volume",
" volume (parallelepiped βb) = 1"
] | [
" o.volumeForm.measure (parallelepiped βb) = 1",
" ΞΉ β Fin n",
" Fintype.card ΞΉ = n",
" βb = β(b.reindex e) β βe",
" b x = (β(b.reindex e) β βe) x",
" o.volumeForm.measure = volume",
" addHaarMeasure (stdOrthonormalBasis β F).toBasis.parallelepiped = volume",
" volume (parallelepiped βb) = 1"
] |
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Fin.VecNotation
import Mathlib.Order.Disjointed
import Mathlib.MeasureTheory.OuterMeasure.Defs
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
section OuterMeasureClass
variable {Ξ± ΞΉ F : Type*} [FunLike F (Set Ξ±) ββ₯0β] [OuterMeasureClass F Ξ±]
{ΞΌ : F} {s t : Set Ξ±}
@[simp]
theorem measure_empty : ΞΌ β
= 0 := OuterMeasureClass.measure_empty ΞΌ
#align measure_theory.measure_empty MeasureTheory.measure_empty
@[mono, gcongr]
theorem measure_mono (h : s β t) : ΞΌ s β€ ΞΌ t :=
OuterMeasureClass.measure_mono ΞΌ h
#align measure_theory.measure_mono MeasureTheory.measure_mono
theorem measure_mono_null (h : s β t) (ht : ΞΌ t = 0) : ΞΌ s = 0 :=
eq_bot_mono (measure_mono h) ht
#align measure_theory.measure_mono_null MeasureTheory.measure_mono_null
theorem measure_pos_of_superset (h : s β t) (hs : ΞΌ s β 0) : 0 < ΞΌ t :=
hs.bot_lt.trans_le (measure_mono h)
theorem measure_iUnion_le [Countable ΞΉ] (s : ΞΉ β Set Ξ±) : ΞΌ (β i, s i) β€ β' i, ΞΌ (s i) := by
refine rel_iSup_tsum ΞΌ measure_empty (Β· β€ Β·) (fun t β¦ ?_) _
calc
ΞΌ (β i, t i) = ΞΌ (β i, disjointed t i) := by rw [iUnion_disjointed]
_ β€ β' i, ΞΌ (disjointed t i) :=
OuterMeasureClass.measure_iUnion_nat_le _ _ (disjoint_disjointed _)
_ β€ β' i, ΞΌ (t i) := by gcongr; apply disjointed_subset
#align measure_theory.measure_Union_le MeasureTheory.measure_iUnion_le
theorem measure_biUnion_le {I : Set ΞΉ} (ΞΌ : F) (hI : I.Countable) (s : ΞΉ β Set Ξ±) :
ΞΌ (β i β I, s i) β€ β' i : I, ΞΌ (s i) := by
have := hI.to_subtype
rw [biUnion_eq_iUnion]
apply measure_iUnion_le
#align measure_theory.measure_bUnion_le MeasureTheory.measure_biUnion_le
theorem measure_biUnion_finset_le (I : Finset ΞΉ) (s : ΞΉ β Set Ξ±) :
ΞΌ (β i β I, s i) β€ β i β I, ΞΌ (s i) :=
(measure_biUnion_le ΞΌ I.countable_toSet s).trans_eq <| I.tsum_subtype (ΞΌ <| s Β·)
#align measure_theory.measure_bUnion_finset_le MeasureTheory.measure_biUnion_finset_le
theorem measure_iUnion_fintype_le [Fintype ΞΉ] (ΞΌ : F) (s : ΞΉ β Set Ξ±) :
ΞΌ (β i, s i) β€ β i, ΞΌ (s i) := by
simpa using measure_biUnion_finset_le Finset.univ s
#align measure_theory.measure_Union_fintype_le MeasureTheory.measure_iUnion_fintype_le
theorem measure_union_le (s t : Set Ξ±) : ΞΌ (s βͺ t) β€ ΞΌ s + ΞΌ t := by
simpa [union_eq_iUnion] using measure_iUnion_fintype_le ΞΌ (cond Β· s t)
#align measure_theory.measure_union_le MeasureTheory.measure_union_le
theorem measure_le_inter_add_diff (ΞΌ : F) (s t : Set Ξ±) : ΞΌ s β€ ΞΌ (s β© t) + ΞΌ (s \ t) := by
simpa using measure_union_le (s β© t) (s \ t)
| Mathlib/MeasureTheory/OuterMeasure/Basic.lean | 96 | 100 | theorem measure_diff_null (ht : ΞΌ t = 0) : ΞΌ (s \ t) = ΞΌ s :=
(measure_mono diff_subset).antisymm <| calc
ΞΌ s β€ ΞΌ (s β© t) + ΞΌ (s \ t) := measure_le_inter_add_diff _ _ _
_ β€ ΞΌ t + ΞΌ (s \ t) := by | gcongr; apply inter_subset_right
_ = ΞΌ (s \ t) := by simp [ht]
| [
" ΞΌ (β i, s i) β€ β' (i : ΞΉ), ΞΌ (s i)",
" (fun x x_1 => x β€ x_1) (ΞΌ (β¨ i, t i)) (β' (i : β), ΞΌ (t i))",
" ΞΌ (β i, t i) = ΞΌ (β i, disjointed t i)",
" β' (i : β), ΞΌ (disjointed t i) β€ β' (i : β), ΞΌ (t i)",
" disjointed t aβ β t aβ",
" ΞΌ (β i β I, s i) β€ β' (i : βI), ΞΌ (s βi)",
" ΞΌ (β x, s βx) β€ β' (i : βI)... | [
" ΞΌ (β i, s i) β€ β' (i : ΞΉ), ΞΌ (s i)",
" (fun x x_1 => x β€ x_1) (ΞΌ (β¨ i, t i)) (β' (i : β), ΞΌ (t i))",
" ΞΌ (β i, t i) = ΞΌ (β i, disjointed t i)",
" β' (i : β), ΞΌ (disjointed t i) β€ β' (i : β), ΞΌ (t i)",
" disjointed t aβ β t aβ",
" ΞΌ (β i β I, s i) β€ β' (i : βI), ΞΌ (s βi)",
" ΞΌ (β x, s βx) β€ β' (i : βI)... |
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Order.Filter.AtTopBot
import Mathlib.Tactic.GCongr
#align_import order.filter.archimedean from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
variable {Ξ± R : Type*}
open Filter Set Function
@[simp]
theorem Nat.comap_cast_atTop [StrictOrderedSemiring R] [Archimedean R] :
comap ((β) : β β R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Nat.cast_le) exists_nat_ge
#align nat.comap_coe_at_top Nat.comap_cast_atTop
theorem tendsto_natCast_atTop_iff [StrictOrderedSemiring R] [Archimedean R] {f : Ξ± β β}
{l : Filter Ξ±} : Tendsto (fun n => (f n : R)) l atTop β Tendsto f l atTop :=
tendsto_atTop_embedding (fun _ _ => Nat.cast_le) exists_nat_ge
#align tendsto_coe_nat_at_top_iff tendsto_natCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_iff := tendsto_natCast_atTop_iff
theorem tendsto_natCast_atTop_atTop [OrderedSemiring R] [Archimedean R] :
Tendsto ((β) : β β R) atTop atTop :=
Nat.mono_cast.tendsto_atTop_atTop exists_nat_ge
#align tendsto_coe_nat_at_top_at_top tendsto_natCast_atTop_atTop
@[deprecated (since := "2024-04-17")]
alias tendsto_nat_cast_atTop_atTop := tendsto_natCast_atTop_atTop
theorem Filter.Eventually.natCast_atTop [OrderedSemiring R] [Archimedean R] {p : R β Prop}
(h : βαΆ (x:R) in atTop, p x) : βαΆ (n:β) in atTop, p n :=
tendsto_natCast_atTop_atTop.eventually h
@[deprecated (since := "2024-04-17")]
alias Filter.Eventually.nat_cast_atTop := Filter.Eventually.natCast_atTop
@[simp] theorem Int.comap_cast_atTop [StrictOrderedRing R] [Archimedean R] :
comap ((β) : β€ β R) atTop = atTop :=
comap_embedding_atTop (fun _ _ => Int.cast_le) fun r =>
let β¨n, hnβ© := exists_nat_ge r; β¨n, mod_cast hnβ©
#align int.comap_coe_at_top Int.comap_cast_atTop
@[simp]
theorem Int.comap_cast_atBot [StrictOrderedRing R] [Archimedean R] :
comap ((β) : β€ β R) atBot = atBot :=
comap_embedding_atBot (fun _ _ => Int.cast_le) fun r =>
let β¨n, hnβ© := exists_nat_ge (-r)
β¨-n, by simpa [neg_le] using hnβ©
#align int.comap_coe_at_bot Int.comap_cast_atBot
theorem tendsto_intCast_atTop_iff [StrictOrderedRing R] [Archimedean R] {f : Ξ± β β€}
{l : Filter Ξ±} : Tendsto (fun n => (f n : R)) l atTop β Tendsto f l atTop := by
rw [β @Int.comap_cast_atTop R, tendsto_comap_iff]; rfl
#align tendsto_coe_int_at_top_iff tendsto_intCast_atTop_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_int_cast_atTop_iff := tendsto_intCast_atTop_iff
theorem tendsto_intCast_atBot_iff [StrictOrderedRing R] [Archimedean R] {f : Ξ± β β€}
{l : Filter Ξ±} : Tendsto (fun n => (f n : R)) l atBot β Tendsto f l atBot := by
rw [β @Int.comap_cast_atBot R, tendsto_comap_iff]; rfl
#align tendsto_coe_int_at_bot_iff tendsto_intCast_atBot_iff
@[deprecated (since := "2024-04-17")]
alias tendsto_int_cast_atBot_iff := tendsto_intCast_atBot_iff
theorem tendsto_intCast_atTop_atTop [StrictOrderedRing R] [Archimedean R] :
Tendsto ((β) : β€ β R) atTop atTop :=
tendsto_intCast_atTop_iff.2 tendsto_id
#align tendsto_coe_int_at_top_at_top tendsto_intCast_atTop_atTop
@[deprecated (since := "2024-04-17")]
alias tendsto_int_cast_atTop_atTop := tendsto_intCast_atTop_atTop
theorem Filter.Eventually.intCast_atTop [StrictOrderedRing R] [Archimedean R] {p : R β Prop}
(h : βαΆ (x:R) in atTop, p x) : βαΆ (n:β€) in atTop, p n := by
rw [β Int.comap_cast_atTop (R := R)]; exact h.comap _
@[deprecated (since := "2024-04-17")]
alias Filter.Eventually.int_cast_atTop := Filter.Eventually.intCast_atTop
| Mathlib/Order/Filter/Archimedean.lean | 100 | 102 | theorem Filter.Eventually.intCast_atBot [StrictOrderedRing R] [Archimedean R] {p : R β Prop}
(h : βαΆ (x:R) in atBot, p x) : βαΆ (n:β€) in atBot, p n := by |
rw [β Int.comap_cast_atBot (R := R)]; exact h.comap _
| [
" β(-βn) β€ r",
" Tendsto (fun n => β(f n)) l atTop β Tendsto f l atTop",
" Tendsto (fun n => β(f n)) l atTop β Tendsto (Int.cast β f) l atTop",
" Tendsto (fun n => β(f n)) l atBot β Tendsto f l atBot",
" Tendsto (fun n => β(f n)) l atBot β Tendsto (Int.cast β f) l atBot",
" βαΆ (n : β€) in atTop, p βn",
"... | [
" β(-βn) β€ r",
" Tendsto (fun n => β(f n)) l atTop β Tendsto f l atTop",
" Tendsto (fun n => β(f n)) l atTop β Tendsto (Int.cast β f) l atTop",
" Tendsto (fun n => β(f n)) l atBot β Tendsto f l atBot",
" Tendsto (fun n => β(f n)) l atBot β Tendsto (Int.cast β f) l atBot",
" βαΆ (n : β€) in atTop, p βn",
"... |
import Mathlib.Data.Fintype.List
#align_import data.list.cycle from "leanprover-community/mathlib"@"7413128c3bcb3b0818e3e18720abc9ea3100fb49"
assert_not_exists MonoidWithZero
open List
def Cycle (Ξ± : Type*) : Type _ :=
Quotient (IsRotated.setoid Ξ±)
#align cycle Cycle
namespace Cycle
variable {Ξ± : Type*}
-- Porting note (#11445): new definition
@[coe] def ofList : List Ξ± β Cycle Ξ± :=
Quot.mk _
instance : Coe (List Ξ±) (Cycle Ξ±) :=
β¨ofListβ©
@[simp]
theorem coe_eq_coe {lβ lβ : List Ξ±} : (lβ : Cycle Ξ±) = (lβ : Cycle Ξ±) β lβ ~r lβ :=
@Quotient.eq _ (IsRotated.setoid _) _ _
#align cycle.coe_eq_coe Cycle.coe_eq_coe
@[simp]
theorem mk_eq_coe (l : List Ξ±) : Quot.mk _ l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk_eq_coe Cycle.mk_eq_coe
@[simp]
theorem mk''_eq_coe (l : List Ξ±) : Quotient.mk'' l = (l : Cycle Ξ±) :=
rfl
#align cycle.mk'_eq_coe Cycle.mk''_eq_coe
theorem coe_cons_eq_coe_append (l : List Ξ±) (a : Ξ±) :
(β(a :: l) : Cycle Ξ±) = (β(l ++ [a]) : Cycle Ξ±) :=
Quot.sound β¨1, by rw [rotate_cons_succ, rotate_zero]β©
#align cycle.coe_cons_eq_coe_append Cycle.coe_cons_eq_coe_append
def nil : Cycle Ξ± :=
([] : List Ξ±)
#align cycle.nil Cycle.nil
@[simp]
theorem coe_nil : β([] : List Ξ±) = @nil Ξ± :=
rfl
#align cycle.coe_nil Cycle.coe_nil
@[simp]
theorem coe_eq_nil (l : List Ξ±) : (l : Cycle Ξ±) = nil β l = [] :=
coe_eq_coe.trans isRotated_nil_iff
#align cycle.coe_eq_nil Cycle.coe_eq_nil
instance : EmptyCollection (Cycle Ξ±) :=
β¨nilβ©
@[simp]
theorem empty_eq : β
= @nil Ξ± :=
rfl
#align cycle.empty_eq Cycle.empty_eq
instance : Inhabited (Cycle Ξ±) :=
β¨nilβ©
@[elab_as_elim]
theorem induction_on {C : Cycle Ξ± β Prop} (s : Cycle Ξ±) (H0 : C nil)
(HI : β (a) (l : List Ξ±), C βl β C β(a :: l)) : C s :=
Quotient.inductionOn' s fun l => by
refine List.recOn l ?_ ?_ <;> simp
assumption'
#align cycle.induction_on Cycle.induction_on
def Mem (a : Ξ±) (s : Cycle Ξ±) : Prop :=
Quot.liftOn s (fun l => a β l) fun _ _ e => propext <| e.mem_iff
#align cycle.mem Cycle.Mem
instance : Membership Ξ± (Cycle Ξ±) :=
β¨Memβ©
@[simp]
theorem mem_coe_iff {a : Ξ±} {l : List Ξ±} : a β (βl : Cycle Ξ±) β a β l :=
Iff.rfl
#align cycle.mem_coe_iff Cycle.mem_coe_iff
@[simp]
theorem not_mem_nil : β a, a β @nil Ξ± :=
List.not_mem_nil
#align cycle.not_mem_nil Cycle.not_mem_nil
instance [DecidableEq Ξ±] : DecidableEq (Cycle Ξ±) := fun sβ sβ =>
Quotient.recOnSubsingletonβ' sβ sβ fun _ _ => decidable_of_iff' _ Quotient.eq''
instance [DecidableEq Ξ±] (x : Ξ±) (s : Cycle Ξ±) : Decidable (x β s) :=
Quotient.recOnSubsingleton' s fun l => show Decidable (x β l) from inferInstance
nonrec def reverse (s : Cycle Ξ±) : Cycle Ξ± :=
Quot.map reverse (fun _ _ => IsRotated.reverse) s
#align cycle.reverse Cycle.reverse
@[simp]
theorem reverse_coe (l : List Ξ±) : (l : Cycle Ξ±).reverse = l.reverse :=
rfl
#align cycle.reverse_coe Cycle.reverse_coe
@[simp]
theorem mem_reverse_iff {a : Ξ±} {s : Cycle Ξ±} : a β s.reverse β a β s :=
Quot.inductionOn s fun _ => mem_reverse
#align cycle.mem_reverse_iff Cycle.mem_reverse_iff
@[simp]
theorem reverse_reverse (s : Cycle Ξ±) : s.reverse.reverse = s :=
Quot.inductionOn s fun _ => by simp
#align cycle.reverse_reverse Cycle.reverse_reverse
@[simp]
theorem reverse_nil : nil.reverse = @nil Ξ± :=
rfl
#align cycle.reverse_nil Cycle.reverse_nil
def length (s : Cycle Ξ±) : β :=
Quot.liftOn s List.length fun _ _ e => e.perm.length_eq
#align cycle.length Cycle.length
@[simp]
theorem length_coe (l : List Ξ±) : length (l : Cycle Ξ±) = l.length :=
rfl
#align cycle.length_coe Cycle.length_coe
@[simp]
theorem length_nil : length (@nil Ξ±) = 0 :=
rfl
#align cycle.length_nil Cycle.length_nil
@[simp]
theorem length_reverse (s : Cycle Ξ±) : s.reverse.length = s.length :=
Quot.inductionOn s List.length_reverse
#align cycle.length_reverse Cycle.length_reverse
def Subsingleton (s : Cycle Ξ±) : Prop :=
s.length β€ 1
#align cycle.subsingleton Cycle.Subsingleton
theorem subsingleton_nil : Subsingleton (@nil Ξ±) := Nat.zero_le _
#align cycle.subsingleton_nil Cycle.subsingleton_nil
theorem length_subsingleton_iff {s : Cycle Ξ±} : Subsingleton s β length s β€ 1 :=
Iff.rfl
#align cycle.length_subsingleton_iff Cycle.length_subsingleton_iff
@[simp]
| Mathlib/Data/List/Cycle.lean | 601 | 602 | theorem subsingleton_reverse_iff {s : Cycle Ξ±} : s.reverse.Subsingleton β s.Subsingleton := by |
simp [length_subsingleton_iff]
| [
" (a :: l).rotate 1 = l ++ [a]",
" C (Quotient.mk'' l)",
" C (Quotient.mk'' [])",
" β (head : Ξ±) (tail : List Ξ±), C (Quotient.mk'' tail) β C (Quotient.mk'' (head :: tail))",
" β (head : Ξ±) (tail : List Ξ±), C βtail β C β(head :: tail)",
" (reverse (Quot.mk Setoid.r xβ)).reverse = Quot.mk Setoid.r xβ",
" ... | [
" (a :: l).rotate 1 = l ++ [a]",
" C (Quotient.mk'' l)",
" C (Quotient.mk'' [])",
" β (head : Ξ±) (tail : List Ξ±), C (Quotient.mk'' tail) β C (Quotient.mk'' (head :: tail))",
" β (head : Ξ±) (tail : List Ξ±), C βtail β C β(head :: tail)",
" (reverse (Quot.mk Setoid.r xβ)).reverse = Quot.mk Setoid.r xβ",
" ... |
import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.TypeTags
import Mathlib.Algebra.Ring.Hom.Defs
import Mathlib.Algebra.Ring.Nat
#align_import data.nat.cast.basic from "leanprover-community/mathlib"@"acebd8d49928f6ed8920e502a6c90674e75bd441"
assert_not_exists OrderedCommGroup
assert_not_exists Commute.zero_right
assert_not_exists Commute.add_right
assert_not_exists abs_eq_max_neg
assert_not_exists natCast_ne
assert_not_exists MulOpposite.natCast
-- Porting note: There are many occasions below where we need `simp [map_zero f]`
-- where `simp [map_zero]` should suffice. (Similarly for `map_one`.)
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/simp.20regression.20with.20MonoidHomClass
open Additive Multiplicative
variable {Ξ± Ξ² : Type*}
namespace Nat
def castAddMonoidHom (Ξ± : Type*) [AddMonoidWithOne Ξ±] :
β β+ Ξ± where
toFun := Nat.cast
map_add' := cast_add
map_zero' := cast_zero
#align nat.cast_add_monoid_hom Nat.castAddMonoidHom
@[simp]
theorem coe_castAddMonoidHom [AddMonoidWithOne Ξ±] : (castAddMonoidHom Ξ± : β β Ξ±) = Nat.cast :=
rfl
#align nat.coe_cast_add_monoid_hom Nat.coe_castAddMonoidHom
lemma _root_.Even.natCast [AddMonoidWithOne Ξ±] {n : β} (hn : Even n) : Even (n : Ξ±) :=
hn.map <| Nat.castAddMonoidHom Ξ±
section MonoidWithZeroHomClass
variable {A F : Type*} [MulZeroOneClass A] [FunLike F β A]
| Mathlib/Data/Nat/Cast/Basic.lean | 159 | 164 | theorem ext_nat'' [MonoidWithZeroHomClass F β A] (f g : F) (h_pos : β {n : β}, 0 < n β f n = g n) :
f = g := by |
apply DFunLike.ext
rintro (_ | n)
Β· simp [map_zero f, map_zero g]
Β· exact h_pos n.succ_pos
| [
" f = g",
" β (x : β), f x = g x",
" f 0 = g 0",
" f (n + 1) = g (n + 1)"
] | [
" f = g"
] |
import Mathlib.Algebra.Polynomial.Mirror
import Mathlib.Analysis.Complex.Polynomial
#align_import data.polynomial.unit_trinomial from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
namespace Polynomial
open scoped Polynomial
open Finset
section Semiring
variable {R : Type*} [Semiring R] (k m n : β) (u v w : R)
noncomputable def trinomial :=
C u * X ^ k + C v * X ^ m + C w * X ^ n
#align polynomial.trinomial Polynomial.trinomial
theorem trinomial_def : trinomial k m n u v w = C u * X ^ k + C v * X ^ m + C w * X ^ n :=
rfl
#align polynomial.trinomial_def Polynomial.trinomial_def
variable {k m n u v w}
theorem trinomial_leading_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff n = w := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg (hkm.trans hmn).ne', if_neg hmn.ne', if_pos rfl, zero_add, zero_add]
#align polynomial.trinomial_leading_coeff' Polynomial.trinomial_leading_coeff'
theorem trinomial_middle_coeff (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff m = v := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_neg hkm.ne', if_pos rfl, if_neg hmn.ne, zero_add, add_zero]
#align polynomial.trinomial_middle_coeff Polynomial.trinomial_middle_coeff
theorem trinomial_trailing_coeff' (hkm : k < m) (hmn : m < n) :
(trinomial k m n u v w).coeff k = u := by
rw [trinomial_def, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X_pow,
if_pos rfl, if_neg hkm.ne, if_neg (hkm.trans hmn).ne, add_zero, add_zero]
#align polynomial.trinomial_trailing_coeff' Polynomial.trinomial_trailing_coeff'
theorem trinomial_natDegree (hkm : k < m) (hmn : m < n) (hw : w β 0) :
(trinomial k m n u v w).natDegree = n := by
refine
natDegree_eq_of_degree_eq_some
((Finset.sup_le fun i h => ?_).antisymm <|
le_degree_of_ne_zero <| by rwa [trinomial_leading_coeff' hkm hmn])
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
Β· exact WithBot.coe_le_coe.mpr (hkm.trans hmn).le
Β· exact WithBot.coe_le_coe.mpr hmn.le
Β· exact le_rfl
#align polynomial.trinomial_nat_degree Polynomial.trinomial_natDegree
theorem trinomial_natTrailingDegree (hkm : k < m) (hmn : m < n) (hu : u β 0) :
(trinomial k m n u v w).natTrailingDegree = k := by
refine
natTrailingDegree_eq_of_trailingDegree_eq_some
((Finset.le_inf fun i h => ?_).antisymm <|
trailingDegree_le_of_ne_zero <| by rwa [trinomial_trailing_coeff' hkm hmn]).symm
replace h := support_trinomial' k m n u v w h
rw [mem_insert, mem_insert, mem_singleton] at h
rcases h with (rfl | rfl | rfl)
Β· exact le_rfl
Β· exact WithTop.coe_le_coe.mpr hkm.le
Β· exact WithTop.coe_le_coe.mpr (hkm.trans hmn).le
#align polynomial.trinomial_nat_trailing_degree Polynomial.trinomial_natTrailingDegree
| Mathlib/Algebra/Polynomial/UnitTrinomial.lean | 95 | 97 | theorem trinomial_leadingCoeff (hkm : k < m) (hmn : m < n) (hw : w β 0) :
(trinomial k m n u v w).leadingCoeff = w := by |
rw [leadingCoeff, trinomial_natDegree hkm hmn hw, trinomial_leading_coeff' hkm hmn]
| [
" (trinomial k m n u v w).coeff n = w",
" (trinomial k m n u v w).coeff m = v",
" (trinomial k m n u v w).coeff k = u",
" (trinomial k m n u v w).natDegree = n",
" (trinomial k m n u v w).coeff n β 0",
" βi β€ βn",
" βi β€ βi",
" (trinomial k m n u v w).natTrailingDegree = k",
" (trinomial k m n u v w... | [
" (trinomial k m n u v w).coeff n = w",
" (trinomial k m n u v w).coeff m = v",
" (trinomial k m n u v w).coeff k = u",
" (trinomial k m n u v w).natDegree = n",
" (trinomial k m n u v w).coeff n β 0",
" βi β€ βn",
" βi β€ βi",
" (trinomial k m n u v w).natTrailingDegree = k",
" (trinomial k m n u v w... |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ΞΉ : Sort*} {π E : Type*}
section OrderedSemiring
variable (π) [OrderedSemiring π] [AddCommMonoid E] [Module π E] {s t sβ sβ tβ tβ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
β (x β s) (y β t), segment π x y
#align convex_join convexJoin
variable {π}
| Mathlib/Analysis/Convex/Join.lean | 36 | 37 | theorem mem_convexJoin : x β convexJoin π s t β β a β s, β b β t, x β segment π a b := by |
simp [convexJoin]
| [
" x β convexJoin π s t β β a β s, β b β t, x β segment π a b"
] | [
" x β convexJoin π s t β β a β s, β b β t, x β segment π a b"
] |
import Mathlib.GroupTheory.QuotientGroup
#align_import algebra.char_zero.quotient from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46"
variable {R : Type*} [DivisionRing R] [CharZero R] {p : R}
namespace AddSubgroup
theorem zsmul_mem_zmultiples_iff_exists_sub_div {r : R} {z : β€} (hz : z β 0) :
z β’ r β AddSubgroup.zmultiples p β
β k : Fin z.natAbs, r - (k : β) β’ (p / z : R) β AddSubgroup.zmultiples p := by
rw [AddSubgroup.mem_zmultiples_iff]
simp_rw [AddSubgroup.mem_zmultiples_iff, div_eq_mul_inv, β smul_mul_assoc, eq_sub_iff_add_eq]
have hz' : (z : R) β 0 := Int.cast_ne_zero.mpr hz
conv_rhs => simp (config := { singlePass := true }) only [β (mul_right_injectiveβ hz').eq_iff]
simp_rw [β zsmul_eq_mul, smul_add, β mul_smul_comm, zsmul_eq_mul (z : R)β»ΒΉ, mul_inv_cancel hz',
mul_one, β natCast_zsmul, smul_smul, β add_smul]
constructor
Β· rintro β¨k, hβ©
simp_rw [β h]
refine β¨β¨(k % z).toNat, ?_β©, k / z, ?_β©
Β· rw [β Int.ofNat_lt, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)]
exact (Int.emod_lt _ hz).trans_eq (Int.abs_eq_natAbs _)
rw [Fin.val_mk, Int.toNat_of_nonneg (Int.emod_nonneg _ hz)]
nth_rewrite 3 [β Int.ediv_add_emod k z]
rfl
Β· rintro β¨k, n, hβ©
exact β¨_, hβ©
#align add_subgroup.zsmul_mem_zmultiples_iff_exists_sub_div AddSubgroup.zsmul_mem_zmultiples_iff_exists_sub_div
| Mathlib/Algebra/CharZero/Quotient.lean | 42 | 47 | theorem nsmul_mem_zmultiples_iff_exists_sub_div {r : R} {n : β} (hn : n β 0) :
n β’ r β AddSubgroup.zmultiples p β
β k : Fin n, r - (k : β) β’ (p / n : R) β AddSubgroup.zmultiples p := by |
rw [β natCast_zsmul r, zsmul_mem_zmultiples_iff_exists_sub_div (Int.natCast_ne_zero.mpr hn),
Int.cast_natCast]
rfl
| [
" z β’ r β zmultiples p β β k, r - βk β’ (p / βz) β zmultiples p",
" (β k, k β’ p = z β’ r) β β k, r - βk β’ (p / βz) β zmultiples p",
" (β k, k β’ p = z β’ r) β β k k_1, k_1 β’ p + βk β’ p * (βz)β»ΒΉ = r",
"R : Type u_1\ninstβΒΉ : DivisionRing R\ninstβ : CharZero R\np r : R\nz : β€\nhz : z β 0\nhz' : βz β 0\n| β k k_1, k... | [
" z β’ r β zmultiples p β β k, r - βk β’ (p / βz) β zmultiples p",
" (β k, k β’ p = z β’ r) β β k, r - βk β’ (p / βz) β zmultiples p",
" (β k, k β’ p = z β’ r) β β k k_1, k_1 β’ p + βk β’ p * (βz)β»ΒΉ = r",
"R : Type u_1\ninstβΒΉ : DivisionRing R\ninstβ : CharZero R\np r : R\nz : β€\nhz : z β 0\nhz' : βz β 0\n| β k k_1, k... |
import Mathlib.Data.Set.Prod
import Mathlib.Logic.Equiv.Fin
import Mathlib.ModelTheory.LanguageMap
#align_import model_theory.syntax from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728"
universe u v w u' v'
namespace FirstOrder
namespace Language
variable (L : Language.{u, v}) {L' : Language}
variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P]
variable {Ξ± : Type u'} {Ξ² : Type v'} {Ξ³ : Type*}
open FirstOrder
open Structure Fin
inductive Term (Ξ± : Type u') : Type max u u'
| var : Ξ± β Term Ξ±
| func : β {l : β} (_f : L.Functions l) (_ts : Fin l β Term Ξ±), Term Ξ±
#align first_order.language.term FirstOrder.Language.Term
export Term (var func)
variable {L}
scoped[FirstOrder] prefix:arg "&" => FirstOrder.Language.Term.var β Sum.inr
namespace LHom
open Term
-- Porting note: universes in different order
@[simp]
def onTerm (Ο : L βα΄Έ L') : L.Term Ξ± β L'.Term Ξ±
| var i => var i
| func f ts => func (Ο.onFunction f) fun i => onTerm Ο (ts i)
set_option linter.uppercaseLean3 false in
#align first_order.language.LHom.on_term FirstOrder.Language.LHom.onTerm
@[simp]
theorem id_onTerm : ((LHom.id L).onTerm : L.Term Ξ± β L.Term Ξ±) = id := by
ext t
induction' t with _ _ _ _ ih
Β· rfl
Β· simp_rw [onTerm, ih]
rfl
set_option linter.uppercaseLean3 false in
#align first_order.language.LHom.id_on_term FirstOrder.Language.LHom.id_onTerm
@[simp]
| Mathlib/ModelTheory/Syntax.lean | 284 | 290 | theorem comp_onTerm {L'' : Language} (Ο : L' βα΄Έ L'') (Ο : L βα΄Έ L') :
((Ο.comp Ο).onTerm : L.Term Ξ± β L''.Term Ξ±) = Ο.onTerm β Ο.onTerm := by |
ext t
induction' t with _ _ _ _ ih
Β· rfl
Β· simp_rw [onTerm, ih]
rfl
| [
" (LHom.id L).onTerm = id",
" (LHom.id L).onTerm t = id t",
" (LHom.id L).onTerm (var aβ) = id (var aβ)",
" (LHom.id L).onTerm (func _fβ _tsβ) = id (func _fβ _tsβ)",
" (func ((LHom.id L).onFunction _fβ) fun i => id (_tsβ i)) = id (func _fβ _tsβ)",
" (Ο.comp Ο).onTerm = Ο.onTerm β Ο.onTerm",
" (Ο.comp Ο)... | [
" (LHom.id L).onTerm = id",
" (LHom.id L).onTerm t = id t",
" (LHom.id L).onTerm (var aβ) = id (var aβ)",
" (LHom.id L).onTerm (func _fβ _tsβ) = id (func _fβ _tsβ)",
" (func ((LHom.id L).onFunction _fβ) fun i => id (_tsβ i)) = id (func _fβ _tsβ)",
" (Ο.comp Ο).onTerm = Ο.onTerm β Ο.onTerm"
] |
import Mathlib.LinearAlgebra.Basis
import Mathlib.Algebra.Module.LocalizedModule
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Localization.Integer
#align_import ring_theory.localization.module from "leanprover-community/mathlib"@"2e59a6de168f95d16b16d217b808a36290398c0a"
open nonZeroDivisors
section Localization
variable {R : Type*} (Rβ : Type*) [CommSemiring R] (S : Submonoid R)
section IsLocalizedModule
section AddCommMonoid
open Submodule
variable [CommSemiring Rβ] [Algebra R Rβ] [hT : IsLocalization S Rβ]
variable {M M' : Type*} [AddCommMonoid M] [Module R M] [Module Rβ M] [IsScalarTower R Rβ M]
[AddCommMonoid M'] [Module R M'] [Module Rβ M'] [IsScalarTower R Rβ M'] (f : M ββ[R] M')
[IsLocalizedModule S f]
theorem span_eq_top_of_isLocalizedModule {v : Set M} (hv : span R v = β€) :
span Rβ (f '' v) = β€ := top_unique fun x _ β¦ by
obtain β¨β¨m, sβ©, hβ© := IsLocalizedModule.surj S f x
rw [Submonoid.smul_def, β algebraMap_smul Rβ, β Units.smul_isUnit (IsLocalization.map_units Rβ s),
eq_comm, β inv_smul_eq_iff] at h
refine h βΈ smul_mem _ _ (span_subset_span R Rβ _ ?_)
rw [β LinearMap.coe_restrictScalars R, β LinearMap.map_span, hv]
exact mem_map_of_mem mem_top
| Mathlib/RingTheory/Localization/Module.lean | 56 | 71 | theorem LinearIndependent.of_isLocalizedModule {ΞΉ : Type*} {v : ΞΉ β M}
(hv : LinearIndependent R v) : LinearIndependent Rβ (f β v) := by |
rw [linearIndependent_iff'] at hv β’
intro t g hg i hi
choose! a g' hg' using IsLocalization.exist_integer_multiples S t g
have h0 : f (β i β t, g' i β’ v i) = 0 := by
apply_fun ((a : R) β’ Β·) at hg
rw [smul_zero, Finset.smul_sum] at hg
rw [map_sum, β hg]
refine Finset.sum_congr rfl fun i hi => ?_
rw [β smul_assoc, β hg' i hi, map_smul, Function.comp_apply, algebraMap_smul]
obtain β¨s, hsβ© := (IsLocalizedModule.eq_zero_iff S f).mp h0
simp_rw [Finset.smul_sum, Submonoid.smul_def, smul_smul] at hs
specialize hv t _ hs i hi
rw [β (IsLocalization.map_units Rβ a).mul_right_eq_zero, β Algebra.smul_def, β hg' i hi]
exact (IsLocalization.map_eq_zero_iff S _ _).2 β¨s, hvβ©
| [
" x β span Rβ (βf '' v)",
" f (m, s).1 β β(span R (βf '' v))",
" (βR f) (m, s).1 β β(map (βR f) β€)",
" LinearIndependent Rβ (βf β v)",
" β (s : Finset ΞΉ) (g : ΞΉ β Rβ), β i β s, g i β’ (βf β v) i = 0 β β i β s, g i = 0",
" g i = 0",
" f (β i β t, g' i β’ v i) = 0",
" β x β t, f (g' x β’ v x) = β x β t, βa... | [
" x β span Rβ (βf '' v)",
" f (m, s).1 β β(span R (βf '' v))",
" (βR f) (m, s).1 β β(map (βR f) β€)",
" LinearIndependent Rβ (βf β v)"
] |
import Mathlib.Algebra.DirectLimit
import Mathlib.Algebra.CharP.Algebra
import Mathlib.FieldTheory.IsAlgClosed.Basic
import Mathlib.FieldTheory.SplittingField.Construction
#align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87"
universe u v w
noncomputable section
open scoped Classical Polynomial
open Polynomial
variable (k : Type u) [Field k]
namespace AlgebraicClosure
open MvPolynomial
abbrev MonicIrreducible : Type u :=
{ f : k[X] // Monic f β§ Irreducible f }
#align algebraic_closure.monic_irreducible AlgebraicClosure.MonicIrreducible
def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k :=
Polynomial.evalβ MvPolynomial.C (X f) f
set_option linter.uppercaseLean3 false in
#align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf
def spanEval : Ideal (MvPolynomial (MonicIrreducible k) k) :=
Ideal.span <| Set.range <| evalXSelf k
#align algebraic_closure.span_eval AlgebraicClosure.spanEval
def toSplittingField (s : Finset (MonicIrreducible k)) :
MvPolynomial (MonicIrreducible k) k ββ[k] SplittingField (β x β s, x : k[X]) :=
MvPolynomial.aeval fun f =>
if hf : f β s then
rootOfSplits _
((splits_prod_iff _ fun (j : MonicIrreducible k) _ => j.2.2.ne_zero).1
(SplittingField.splits _) f hf)
(mt isUnit_iff_degree_eq_zero.2 f.2.2.not_unit)
else 37
#align algebraic_closure.to_splitting_field AlgebraicClosure.toSplittingField
theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f β s) :
toSplittingField k s (evalXSelf k f) = 0 := by
rw [toSplittingField, evalXSelf, β AlgHom.coe_toRingHom, hom_evalβ, AlgHom.coe_toRingHom,
MvPolynomial.aeval_X, dif_pos hf, β MvPolynomial.algebraMap_eq, AlgHom.comp_algebraMap]
exact map_rootOfSplits _ _ _
set_option linter.uppercaseLean3 false in
#align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf
| Mathlib/FieldTheory/IsAlgClosed/AlgebraicClosure.lean | 85 | 94 | theorem spanEval_ne_top : spanEval k β β€ := by |
rw [Ideal.ne_top_iff_one, spanEval, Ideal.span, β Set.image_univ,
Finsupp.mem_span_image_iff_total]
rintro β¨v, _, hvβ©
replace hv := congr_arg (toSplittingField k v.support) hv
rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv
Β· exact zero_ne_one hv
intro j hj
rw [smul_eq_mul, AlgHom.map_mul, toSplittingField_evalXSelf (s := v.support) hj,
mul_zero]
| [
" (toSplittingField k s) (evalXSelf k f) = 0",
" Polynomial.evalβ (algebraMap k (β x β s, βx).SplittingField)\n (rootOfSplits (algebraMap k (β x β s, βx).SplittingField) β― β―) βf =\n 0",
" spanEval k β β€",
" Β¬β l β Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible ... | [
" (toSplittingField k s) (evalXSelf k f) = 0",
" Polynomial.evalβ (algebraMap k (β x β s, βx).SplittingField)\n (rootOfSplits (algebraMap k (β x β s, βx).SplittingField) β― β―) βf =\n 0",
" spanEval k β β€"
] |
import Mathlib.ModelTheory.FinitelyGenerated
import Mathlib.ModelTheory.DirectLimit
import Mathlib.ModelTheory.Bundled
#align_import model_theory.fraisse from "leanprover-community/mathlib"@"0602c59878ff3d5f71dea69c2d32ccf2e93e5398"
universe u v w w'
open scoped FirstOrder
open Set CategoryTheory
namespace FirstOrder
namespace Language
open Structure Substructure
variable (L : Language.{u, v})
def age (M : Type w) [L.Structure M] : Set (Bundled.{w} L.Structure) :=
{N | Structure.FG L N β§ Nonempty (N βͺ[L] M)}
#align first_order.language.age FirstOrder.Language.age
variable {L} (K : Set (Bundled.{w} L.Structure))
def Hereditary : Prop :=
β M : Bundled.{w} L.Structure, M β K β L.age M β K
#align first_order.language.hereditary FirstOrder.Language.Hereditary
def JointEmbedding : Prop :=
DirectedOn (fun M N : Bundled.{w} L.Structure => Nonempty (M βͺ[L] N)) K
#align first_order.language.joint_embedding FirstOrder.Language.JointEmbedding
def Amalgamation : Prop :=
β (M N P : Bundled.{w} L.Structure) (MN : M βͺ[L] N) (MP : M βͺ[L] P),
M β K β N β K β P β K β β (Q : Bundled.{w} L.Structure) (NQ : N βͺ[L] Q) (PQ : P βͺ[L] Q),
Q β K β§ NQ.comp MN = PQ.comp MP
#align first_order.language.amalgamation FirstOrder.Language.Amalgamation
class IsFraisse : Prop where
is_nonempty : K.Nonempty
FG : β M : Bundled.{w} L.Structure, M β K β Structure.FG L M
is_equiv_invariant : β M N : Bundled.{w} L.Structure, Nonempty (M β[L] N) β (M β K β N β K)
is_essentially_countable : (Quotient.mk' '' K).Countable
hereditary : Hereditary K
jointEmbedding : JointEmbedding K
amalgamation : Amalgamation K
#align first_order.language.is_fraisse FirstOrder.Language.IsFraisse
variable {K} (L) (M : Type w) [Structure L M]
theorem age.is_equiv_invariant (N P : Bundled.{w} L.Structure) (h : Nonempty (N β[L] P)) :
N β L.age M β P β L.age M :=
and_congr h.some.fg_iff
β¨Nonempty.map fun x => Embedding.comp x h.some.symm.toEmbedding,
Nonempty.map fun x => Embedding.comp x h.some.toEmbeddingβ©
#align first_order.language.age.is_equiv_invariant FirstOrder.Language.age.is_equiv_invariant
variable {L} {M} {N : Type w} [Structure L N]
theorem Embedding.age_subset_age (MN : M βͺ[L] N) : L.age M β L.age N := fun _ =>
And.imp_right (Nonempty.map MN.comp)
#align first_order.language.embedding.age_subset_age FirstOrder.Language.Embedding.age_subset_age
theorem Equiv.age_eq_age (MN : M β[L] N) : L.age M = L.age N :=
le_antisymm MN.toEmbedding.age_subset_age MN.symm.toEmbedding.age_subset_age
#align first_order.language.equiv.age_eq_age FirstOrder.Language.Equiv.age_eq_age
theorem Structure.FG.mem_age_of_equiv {M N : Bundled L.Structure} (h : Structure.FG L M)
(MN : Nonempty (M β[L] N)) : N β L.age M :=
β¨MN.some.fg_iff.1 h, β¨MN.some.symm.toEmbeddingβ©β©
set_option linter.uppercaseLean3 false in
#align first_order.language.Structure.fg.mem_age_of_equiv FirstOrder.Language.Structure.FG.mem_age_of_equiv
theorem Hereditary.is_equiv_invariant_of_fg (h : Hereditary K)
(fg : β M : Bundled.{w} L.Structure, M β K β Structure.FG L M) (M N : Bundled.{w} L.Structure)
(hn : Nonempty (M β[L] N)) : M β K β N β K :=
β¨fun MK => h M MK ((fg M MK).mem_age_of_equiv hn),
fun NK => h N NK ((fg N NK).mem_age_of_equiv β¨hn.some.symmβ©)β©
#align first_order.language.hereditary.is_equiv_invariant_of_fg FirstOrder.Language.Hereditary.is_equiv_invariant_of_fg
variable (M)
theorem age.nonempty : (L.age M).Nonempty :=
β¨Bundled.of (Substructure.closure L (β
: Set M)),
(fg_iff_structure_fg _).1 (fg_closure Set.finite_empty), β¨Substructure.subtype _β©β©
#align first_order.language.age.nonempty FirstOrder.Language.age.nonempty
theorem age.hereditary : Hereditary (L.age M) := fun _ hN _ hP => hN.2.some.age_subset_age hP
#align first_order.language.age.hereditary FirstOrder.Language.age.hereditary
theorem age.jointEmbedding : JointEmbedding (L.age M) := fun _ hN _ hP =>
β¨Bundled.of (β₯(hN.2.some.toHom.range β hP.2.some.toHom.range)),
β¨(fg_iff_structure_fg _).1 ((hN.1.range hN.2.some.toHom).sup (hP.1.range hP.2.some.toHom)),
β¨Substructure.subtype _β©β©,
β¨Embedding.comp (inclusion le_sup_left) hN.2.some.equivRange.toEmbeddingβ©,
β¨Embedding.comp (inclusion le_sup_right) hP.2.some.equivRange.toEmbeddingβ©β©
#align first_order.language.age.joint_embedding FirstOrder.Language.age.jointEmbedding
| Mathlib/ModelTheory/Fraisse.lean | 169 | 182 | theorem age.countable_quotient [h : Countable M] : (Quotient.mk' '' L.age M).Countable := by |
classical
refine (congr_arg _ (Set.ext <| Quotient.forall.2 fun N => ?_)).mp
(countable_range fun s : Finset M => β¦β¨closure L (s : Set M), inferInstanceβ©β§)
constructor
Β· rintro β¨s, hsβ©
use Bundled.of (closure L (s : Set M))
exact β¨β¨(fg_iff_structure_fg _).1 (fg_closure s.finite_toSet), β¨Substructure.subtype _β©β©, hsβ©
Β· simp only [mem_range, Quotient.eq]
rintro β¨P, β¨β¨s, hsβ©, β¨PMβ©β©, hP2β©
have : P β N := by apply Quotient.eq'.mp; rw [hP2]; rfl -- Porting note: added
refine β¨s.image PM, Setoid.trans (b := P) ?_ thisβ©
rw [β Embedding.coe_toHom, Finset.coe_image, closure_image PM.toHom, hs, β Hom.range_eq_map]
exact β¨PM.equivRange.symmβ©
| [
" (Quotient.mk' '' L.age M).Countable",
" (β¦Nβ§ β range fun s => β¦{ Ξ± := β₯((closure L).toFun βs), str := inferInstance }β§) β β¦Nβ§ β Quotient.mk' '' L.age M",
" (β¦Nβ§ β range fun s => β¦{ Ξ± := β₯((closure L).toFun βs), str := inferInstance }β§) β β¦Nβ§ β Quotient.mk' '' L.age M",
" β¦Nβ§ β Quotient.mk' '' L.age M",
" ... | [
" (Quotient.mk' '' L.age M).Countable"
] |
import Mathlib.Analysis.Calculus.FDeriv.Analytic
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
import Mathlib.Analysis.Complex.CauchyIntegral
#align_import analysis.complex.removable_singularity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Metric Set Filter Asymptotics Function
open scoped Topology Filter NNReal Real
universe u
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E]
namespace Complex
| Mathlib/Analysis/Complex/RemovableSingularity.lean | 34 | 43 | theorem analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt {f : β β E} {c : β}
(hd : βαΆ z in π[β ] c, DifferentiableAt β f z) (hc : ContinuousAt f c) : AnalyticAt β f c := by |
rcases (nhdsWithin_hasBasis nhds_basis_closedBall _).mem_iff.1 hd with β¨R, hR0, hRsβ©
lift R to ββ₯0 using hR0.le
replace hc : ContinuousOn f (closedBall c R) := by
refine fun z hz => ContinuousAt.continuousWithinAt ?_
rcases eq_or_ne z c with (rfl | hne)
exacts [hc, (hRs β¨hz, hneβ©).continuousAt]
exact (hasFPowerSeriesOnBall_of_differentiable_off_countable (countable_singleton c) hc
(fun z hz => hRs (diff_subset_diff_left ball_subset_closedBall hz)) hR0).analyticAt
| [
" AnalyticAt β f c",
" ContinuousOn f (closedBall c βR)",
" ContinuousAt f z"
] | [
" AnalyticAt β f c"
] |
import Mathlib.AlgebraicTopology.DoldKan.Faces
import Mathlib.CategoryTheory.Idempotents.Basic
#align_import algebraic_topology.dold_kan.projections from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive
CategoryTheory.SimplicialObject Opposite CategoryTheory.Idempotents
open Simplicial DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C] {X : SimplicialObject C}
noncomputable def P : β β (K[X] βΆ K[X])
| 0 => π _
| q + 1 => P q β« (π _ + HΟ q)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P AlgebraicTopology.DoldKan.P
-- Porting note: `P_zero` and `P_succ` have been added to ease the port, because
-- `unfold P` would sometimes unfold to a `match` rather than the induction formula
lemma P_zero : (P 0 : K[X] βΆ K[X]) = π _ := rfl
lemma P_succ (q : β) : (P (q+1) : K[X] βΆ K[X]) = P q β« (π _ + HΟ q) := rfl
@[simp]
theorem P_f_0_eq (q : β) : ((P q).f 0 : X _[0] βΆ X _[0]) = π _ := by
induction' q with q hq
Β· rfl
Β· simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,
HomologicalComplex.id_f, id_comp, hq, HΟ_eq_zero, add_zero]
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_f_0_eq AlgebraicTopology.DoldKan.P_f_0_eq
def Q (q : β) : K[X] βΆ K[X] :=
π _ - P q
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q AlgebraicTopology.DoldKan.Q
theorem P_add_Q (q : β) : P q + Q q = π K[X] := by
rw [Q]
abel
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_add_Q AlgebraicTopology.DoldKan.P_add_Q
theorem P_add_Q_f (q n : β) : (P q).f n + (Q q).f n = π (X _[n]) :=
HomologicalComplex.congr_hom (P_add_Q q) n
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_add_Q_f AlgebraicTopology.DoldKan.P_add_Q_f
@[simp]
theorem Q_zero : (Q 0 : K[X] βΆ _) = 0 :=
sub_self _
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q_eq_zero AlgebraicTopology.DoldKan.Q_zero
theorem Q_succ (q : β) : (Q (q + 1) : K[X] βΆ _) = Q q - P q β« HΟ q := by
simp only [Q, P_succ, comp_add, comp_id]
abel
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Q_eq AlgebraicTopology.DoldKan.Q_succ
@[simp]
| Mathlib/AlgebraicTopology/DoldKan/Projections.lean | 100 | 101 | theorem Q_f_0_eq (q : β) : ((Q q).f 0 : X _[0] βΆ X _[0]) = 0 := by |
simp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self]
| [
" (P q).f 0 = π (K[X].X 0)",
" (P 0).f 0 = π (K[X].X 0)",
" (P (q + 1)).f 0 = π (K[X].X 0)",
" P q + Q q = π K[X]",
" P q + (π K[X] - P q) = π K[X]",
" Q (q + 1) = Q q - P q β« HΟ q",
" π K[X] - (P q + P q β« HΟ q) = π K[X] - P q - P q β« HΟ q",
" (Q q).f 0 = 0"
] | [
" (P q).f 0 = π (K[X].X 0)",
" (P 0).f 0 = π (K[X].X 0)",
" (P (q + 1)).f 0 = π (K[X].X 0)",
" P q + Q q = π K[X]",
" P q + (π K[X] - P q) = π K[X]",
" Q (q + 1) = Q q - P q β« HΟ q",
" π K[X] - (P q + P q β« HΟ q) = π K[X] - P q - P q β« HΟ q",
" (Q q).f 0 = 0"
] |
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
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
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.factors_normalized_Moore_complex_P_infty AlgebraicTopology.DoldKan.factors_normalizedMooreComplex_PInfty
@[simps!]
def PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] βΆ N[X] :=
ChainComplex.ofHom _ _ _ _ _ _
(fun n => factorThru _ _ (factors_normalizedMooreComplex_PInfty n)) fun n => by
rw [β cancel_mono (NormalizedMooreComplex.objX X n).arrow, assoc, assoc, factorThru_arrow,
β inclusionOfMooreComplexMap_f, β normalizedMooreComplex_objD,
β (inclusionOfMooreComplexMap X).comm (n + 1) n, inclusionOfMooreComplexMap_f,
factorThru_arrow_assoc, β alternatingFaceMapComplex_obj_d]
exact PInfty.comm (n + 1) n
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.P_infty_to_normalized_Moore_complex AlgebraicTopology.DoldKan.PInftyToNormalizedMooreComplex
@[reassoc (attr := simp)]
| Mathlib/AlgebraicTopology/DoldKan/Normalized.lean | 77 | 78 | theorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :
PInftyToNormalizedMooreComplex X β« inclusionOfMooreComplexMap X = PInfty := by | aesop_cat
| [
" (AlgebraicTopology.inclusionOfMooreComplexMap X).f (n + 1) β« X.Ξ΄ j.succ = 0",
" (Finset.univ.inf fun k => kernelSubobject (X.Ξ΄ k.succ)).arrow β« X.Ξ΄ j.succ = 0",
" j β Finset.univ",
" (NormalizedMooreComplex.objX X n).Factors (PInfty.f n)",
" (NormalizedMooreComplex.objX X 0).Factors (PInfty.f 0)",
" (No... | [
" (AlgebraicTopology.inclusionOfMooreComplexMap X).f (n + 1) β« X.Ξ΄ j.succ = 0",
" (Finset.univ.inf fun k => kernelSubobject (X.Ξ΄ k.succ)).arrow β« X.Ξ΄ j.succ = 0",
" j β Finset.univ",
" (NormalizedMooreComplex.objX X n).Factors (PInfty.f n)",
" (NormalizedMooreComplex.objX X 0).Factors (PInfty.f 0)",
" (No... |
import Mathlib.Dynamics.Flow
import Mathlib.Tactic.Monotonicity
#align_import dynamics.omega_limit from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Function Filter Topology
section omegaLimit
variable {Ο : Type*} {Ξ± : Type*} {Ξ² : Type*} {ΞΉ : Type*}
def omegaLimit [TopologicalSpace Ξ²] (f : Filter Ο) (Ο : Ο β Ξ± β Ξ²) (s : Set Ξ±) : Set Ξ² :=
β u β f, closure (image2 Ο u s)
#align omega_limit omegaLimit
@[inherit_doc]
scoped[omegaLimit] notation "Ο" => omegaLimit
scoped[omegaLimit] notation "ΟβΊ" => omegaLimit Filter.atTop
scoped[omegaLimit] notation "Οβ»" => omegaLimit Filter.atBot
variable [TopologicalSpace Ξ²]
variable (f : Filter Ο) (Ο : Ο β Ξ± β Ξ²) (s sβ sβ : Set Ξ±)
open omegaLimit
theorem omegaLimit_def : Ο f Ο s = β u β f, closure (image2 Ο u s) := rfl
#align omega_limit_def omegaLimit_def
theorem omegaLimit_subset_of_tendsto {m : Ο β Ο} {fβ fβ : Filter Ο} (hf : Tendsto m fβ fβ) :
Ο fβ (fun t x β¦ Ο (m t) x) s β Ο fβ Ο s := by
refine iInterβ_mono' fun u hu β¦ β¨m β»ΒΉ' u, tendsto_def.mp hf _ hu, ?_β©
rw [β image2_image_left]
exact closure_mono (image2_subset (image_preimage_subset _ _) Subset.rfl)
#align omega_limit_subset_of_tendsto omegaLimit_subset_of_tendsto
theorem omegaLimit_mono_left {fβ fβ : Filter Ο} (hf : fβ β€ fβ) : Ο fβ Ο s β Ο fβ Ο s :=
omegaLimit_subset_of_tendsto Ο s (tendsto_id'.2 hf)
#align omega_limit_mono_left omegaLimit_mono_left
theorem omegaLimit_mono_right {sβ sβ : Set Ξ±} (hs : sβ β sβ) : Ο f Ο sβ β Ο f Ο sβ :=
iInterβ_mono fun _u _hu β¦ closure_mono (image2_subset Subset.rfl hs)
#align omega_limit_mono_right omegaLimit_mono_right
theorem isClosed_omegaLimit : IsClosed (Ο f Ο s) :=
isClosed_iInter fun _u β¦ isClosed_iInter fun _hu β¦ isClosed_closure
#align is_closed_omega_limit isClosed_omegaLimit
theorem mapsTo_omegaLimit' {Ξ±' Ξ²' : Type*} [TopologicalSpace Ξ²'] {f : Filter Ο} {Ο : Ο β Ξ± β Ξ²}
{Ο' : Ο β Ξ±' β Ξ²'} {ga : Ξ± β Ξ±'} {s' : Set Ξ±'} (hs : MapsTo ga s s') {gb : Ξ² β Ξ²'}
(hg : βαΆ t in f, EqOn (gb β Ο t) (Ο' t β ga) s) (hgc : Continuous gb) :
MapsTo gb (Ο f Ο s) (Ο f Ο' s') := by
simp only [omegaLimit_def, mem_iInter, MapsTo]
intro y hy u hu
refine map_mem_closure hgc (hy _ (inter_mem hu hg)) (forall_image2_iff.2 fun t ht x hx β¦ ?_)
calc
gb (Ο t x) = Ο' t (ga x) := ht.2 hx
_ β image2 Ο' u s' := mem_image2_of_mem ht.1 (hs hx)
#align maps_to_omega_limit' mapsTo_omegaLimit'
theorem mapsTo_omegaLimit {Ξ±' Ξ²' : Type*} [TopologicalSpace Ξ²'] {f : Filter Ο} {Ο : Ο β Ξ± β Ξ²}
{Ο' : Ο β Ξ±' β Ξ²'} {ga : Ξ± β Ξ±'} {s' : Set Ξ±'} (hs : MapsTo ga s s') {gb : Ξ² β Ξ²'}
(hg : β t x, gb (Ο t x) = Ο' t (ga x)) (hgc : Continuous gb) :
MapsTo gb (Ο f Ο s) (Ο f Ο' s') :=
mapsTo_omegaLimit' _ hs (eventually_of_forall fun t x _hx β¦ hg t x) hgc
#align maps_to_omega_limit mapsTo_omegaLimit
theorem omegaLimit_image_eq {Ξ±' : Type*} (Ο : Ο β Ξ±' β Ξ²) (f : Filter Ο) (g : Ξ± β Ξ±') :
Ο f Ο (g '' s) = Ο f (fun t x β¦ Ο t (g x)) s := by simp only [omegaLimit, image2_image_right]
#align omega_limit_image_eq omegaLimit_image_eq
theorem omegaLimit_preimage_subset {Ξ±' : Type*} (Ο : Ο β Ξ±' β Ξ²) (s : Set Ξ±') (f : Filter Ο)
(g : Ξ± β Ξ±') : Ο f (fun t x β¦ Ο t (g x)) (g β»ΒΉ' s) β Ο f Ο s :=
mapsTo_omegaLimit _ (mapsTo_preimage _ _) (fun _t _x β¦ rfl) continuous_id
#align omega_limit_preimage_subset omegaLimit_preimage_subset
theorem mem_omegaLimit_iff_frequently (y : Ξ²) :
y β Ο f Ο s β β n β π y, βαΆ t in f, (s β© Ο t β»ΒΉ' n).Nonempty := by
simp_rw [frequently_iff, omegaLimit_def, mem_iInter, mem_closure_iff_nhds]
constructor
Β· intro h _ hn _ hu
rcases h _ hu _ hn with β¨_, _, _, ht, _, hx, rflβ©
exact β¨_, ht, _, hx, by rwa [mem_preimage]β©
Β· intro h _ hu _ hn
rcases h _ hn hu with β¨_, ht, _, hx, hΟtxβ©
exact β¨_, hΟtx, _, ht, _, hx, rflβ©
#align mem_omega_limit_iff_frequently mem_omegaLimit_iff_frequently
| Mathlib/Dynamics/OmegaLimit.lean | 142 | 144 | theorem mem_omegaLimit_iff_frequentlyβ (y : Ξ²) :
y β Ο f Ο s β β n β π y, βαΆ t in f, (Ο t '' s β© n).Nonempty := by |
simp_rw [mem_omegaLimit_iff_frequently, image_inter_nonempty_iff]
| [
" Ο fβ (fun t x => Ο (m t) x) s β Ο fβ Ο s",
" closure (image2 (fun t x => Ο (m t) x) (m β»ΒΉ' u) s) β closure (image2 Ο u s)",
" closure (image2 Ο ((fun t => m t) '' (m β»ΒΉ' u)) s) β closure (image2 Ο u s)",
" MapsTo gb (Ο f Ο s) (Ο f Ο' s')",
" β β¦x : Ξ²β¦, (β i β f, x β closure (image2 Ο i s)) β β i β f, gb x... | [
" Ο fβ (fun t x => Ο (m t) x) s β Ο fβ Ο s",
" closure (image2 (fun t x => Ο (m t) x) (m β»ΒΉ' u) s) β closure (image2 Ο u s)",
" closure (image2 Ο ((fun t => m t) '' (m β»ΒΉ' u)) s) β closure (image2 Ο u s)",
" MapsTo gb (Ο f Ο s) (Ο f Ο' s')",
" β β¦x : Ξ²β¦, (β i β f, x β closure (image2 Ο i s)) β β i β f, gb x... |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {ΞΈ : β} : cos ΞΈ = 0 β β k : β€, ΞΈ = (2 * k + 1) * Ο / 2 := by
have h : (exp (ΞΈ * I) + exp (-ΞΈ * I)) / 2 = 0 β exp (2 * ΞΈ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (ΞΈ * I) + exp (-ΞΈ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, β div_eq_iff (exp_ne_zero _), β exp_sub]
ring_nf
rw [cos, h, β exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {ΞΈ : β} : cos ΞΈ β 0 β β k : β€, ΞΈ β (2 * k + 1) * Ο / 2 := by
rw [β not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {ΞΈ : β} : sin ΞΈ = 0 β β k : β€, ΞΈ = k * Ο := by
rw [β Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
Β· rintro β¨k, hkβ©
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
Β· rintro β¨k, rflβ©
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {ΞΈ : β} : sin ΞΈ β 0 β β k : β€, ΞΈ β k * Ο := by
rw [β not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {ΞΈ : β} : tan ΞΈ = 0 β β k : β€, k * Ο / 2 = ΞΈ := by
rw [tan, div_eq_zero_iff, β mul_eq_zero, β mul_right_inj' two_ne_zero, mul_zero,
β mul_assoc, β sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {ΞΈ : β} : tan ΞΈ β 0 β β k : β€, (k * Ο / 2 : β) β ΞΈ := by
rw [β not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : β€) : tan (n * Ο / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {ΞΈ : β} (hΞΈ : cos ΞΈ β 0) : tan ΞΈ = 0 β β k : β€, k * Ο = ΞΈ := by
simp only [tan, hΞΈ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 90 | 101 | theorem cos_eq_cos_iff {x y : β} : cos x = cos y β β k : β€, y = 2 * k * Ο + x β¨ y = 2 * k * Ο - x :=
calc
cos x = cos y β cos x - cos y = 0 := sub_eq_zero.symm
_ β -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by | rw [cos_sub_cos]
_ β sin ((x + y) / 2) = 0 β¨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : β) β 0)]
_ β sin ((x - y) / 2) = 0 β¨ sin ((x + y) / 2) = 0 := or_comm
_ β (β k : β€, y = 2 * k * Ο + x) β¨ β k : β€, y = 2 * k * Ο - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : β) β 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : β), mul_right_comm _ (2 : β)]
constructor <;> Β· rintro β¨k, rflβ©; use -k; simp
_ β β k : β€, y = 2 * k * Ο + x β¨ y = 2 * k * Ο - x := exists_or.symm
| [
" ΞΈ.cos = 0 β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" (cexp (ΞΈ * I) + cexp (-ΞΈ * I)) / 2 = 0 β cexp (2 * ΞΈ * I) = -1",
" cexp (ΞΈ * I - -ΞΈ * I) = -1 β cexp (2 * ΞΈ * I) = -1",
" (β n, 2 * I * ΞΈ = βΟ * I + βn * (2 * βΟ * I)) β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" 2 * I * ΞΈ = βΟ * I + βx * (2 * βΟ * I) β ΞΈ = (2 * βx +... | [
" ΞΈ.cos = 0 β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" (cexp (ΞΈ * I) + cexp (-ΞΈ * I)) / 2 = 0 β cexp (2 * ΞΈ * I) = -1",
" cexp (ΞΈ * I - -ΞΈ * I) = -1 β cexp (2 * ΞΈ * I) = -1",
" (β n, 2 * I * ΞΈ = βΟ * I + βn * (2 * βΟ * I)) β β k, ΞΈ = (2 * βk + 1) * βΟ / 2",
" 2 * I * ΞΈ = βΟ * I + βx * (2 * βΟ * I) β ΞΈ = (2 * βx +... |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.GeomSum
import Mathlib.Data.Fintype.BigOperators
import Mathlib.RingTheory.PowerSeries.Inverse
import Mathlib.RingTheory.PowerSeries.WellKnown
import Mathlib.Tactic.FieldSimp
#align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Nat Finset Finset.Nat PowerSeries
variable (A : Type*) [CommRing A] [Algebra β A]
def bernoulli' : β β β :=
WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' =>
1 - β k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2
#align bernoulli' bernoulli'
theorem bernoulli'_def' (n : β) :
bernoulli' n = 1 - β k : Fin n, n.choose k / (n - k + 1) * bernoulli' k :=
WellFounded.fix_eq _ _ _
#align bernoulli'_def' bernoulli'_def'
theorem bernoulli'_def (n : β) :
bernoulli' n = 1 - β k β range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', β Fin.sum_univ_eq_sum_range]
#align bernoulli'_def bernoulli'_def
theorem bernoulli'_spec (n : β) :
(β k β range n.succ, (n.choose (n - k) : β) / (n - k + 1) * bernoulli' k) = 1 := by
rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add,
div_one, cast_one, one_mul, sub_add, β sum_sub_distrib, β sub_eq_zero, sub_sub_cancel_left,
neg_eq_zero]
exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self])
#align bernoulli'_spec bernoulli'_spec
theorem bernoulli'_spec' (n : β) :
(β k β antidiagonal n, ((k.1 + k.2).choose k.2 : β) / (k.2 + 1) * bernoulli' k.1) = 1 := by
refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n)
refine sum_congr rfl fun x hx => ?_
simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub]
#align bernoulli'_spec' bernoulli'_spec'
@[simp]
| Mathlib/NumberTheory/Bernoulli.lean | 137 | 150 | theorem sum_bernoulli' (n : β) : (β k β range n, (n.choose k : β) * bernoulli' k) = n := by |
cases' n with n
Β· simp
suffices
((n + 1 : β) * β k β range n, β(n.choose k) / (n - k + 1) * bernoulli' k) =
β x β range n, β(n.succ.choose x) * bernoulli' x by
rw_mod_cast [sum_range_succ, bernoulli'_def, β this, choose_succ_self_right]
ring
simp_rw [mul_sum, β mul_assoc]
refine sum_congr rfl fun k hk => ?_
congr
have : ((n - k : β) : β) + 1 β 0 := by norm_cast
field_simp [β cast_sub (mem_range.1 hk).le, mul_comm]
rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
| [
" bernoulli' n = 1 - β k β range n, β(n.choose k) / (βn - βk + 1) * bernoulli' k",
" β k β range n.succ, β(n.choose (n - k)) / (βn - βk + 1) * bernoulli' k = 1",
" β x β range n, (β(n.choose x) / (βn - βx + 1) * bernoulli' x - β(n.choose (n - x)) / (βn - βx + 1) * bernoulli' x) = 0",
" β(n.choose x) / (βn - β... | [
" bernoulli' n = 1 - β k β range n, β(n.choose k) / (βn - βk + 1) * bernoulli' k",
" β k β range n.succ, β(n.choose (n - k)) / (βn - βk + 1) * bernoulli' k = 1",
" β x β range n, (β(n.choose x) / (βn - βx + 1) * bernoulli' x - β(n.choose (n - x)) / (βn - βx + 1) * bernoulli' x) = 0",
" β(n.choose x) / (βn - β... |
import Mathlib.Algebra.Regular.Basic
import Mathlib.LinearAlgebra.Matrix.MvPolynomial
import Mathlib.LinearAlgebra.Matrix.Polynomial
import Mathlib.RingTheory.Polynomial.Basic
#align_import linear_algebra.matrix.adjugate from "leanprover-community/mathlib"@"a99f85220eaf38f14f94e04699943e185a5e1d1a"
namespace Matrix
universe u v w
variable {m : Type u} {n : Type v} {Ξ± : Type w}
variable [DecidableEq n] [Fintype n] [DecidableEq m] [Fintype m] [CommRing Ξ±]
open Matrix Polynomial Equiv Equiv.Perm Finset
section Cramer
variable (A : Matrix n n Ξ±) (b : n β Ξ±)
def cramerMap (i : n) : Ξ± :=
(A.updateColumn i b).det
#align matrix.cramer_map Matrix.cramerMap
theorem cramerMap_is_linear (i : n) : IsLinearMap Ξ± fun b => cramerMap A b i :=
{ map_add := det_updateColumn_add _ _
map_smul := det_updateColumn_smul _ _ }
#align matrix.cramer_map_is_linear Matrix.cramerMap_is_linear
theorem cramer_is_linear : IsLinearMap Ξ± (cramerMap A) := by
constructor <;> intros <;> ext i
Β· apply (cramerMap_is_linear A i).1
Β· apply (cramerMap_is_linear A i).2
#align matrix.cramer_is_linear Matrix.cramer_is_linear
def cramer (A : Matrix n n Ξ±) : (n β Ξ±) ββ[Ξ±] (n β Ξ±) :=
IsLinearMap.mk' (cramerMap A) (cramer_is_linear A)
#align matrix.cramer Matrix.cramer
theorem cramer_apply (i : n) : cramer A b i = (A.updateColumn i b).det :=
rfl
#align matrix.cramer_apply Matrix.cramer_apply
theorem cramer_transpose_apply (i : n) : cramer Aα΅ b i = (A.updateRow i b).det := by
rw [cramer_apply, updateColumn_transpose, det_transpose]
#align matrix.cramer_transpose_apply Matrix.cramer_transpose_apply
theorem cramer_transpose_row_self (i : n) : Aα΅.cramer (A i) = Pi.single i A.det := by
ext j
rw [cramer_apply, Pi.single_apply]
split_ifs with h
Β· -- i = j: this entry should be `A.det`
subst h
simp only [updateColumn_transpose, det_transpose, updateRow_eq_self]
Β· -- i β j: this entry should be 0
rw [updateColumn_transpose, det_transpose]
apply det_zero_of_row_eq h
rw [updateRow_self, updateRow_ne (Ne.symm h)]
#align matrix.cramer_transpose_row_self Matrix.cramer_transpose_row_self
| Mathlib/LinearAlgebra/Matrix/Adjugate.lean | 119 | 122 | theorem cramer_row_self (i : n) (h : β j, b j = A j i) : A.cramer b = Pi.single i A.det := by |
rw [β transpose_transpose A, det_transpose]
convert cramer_transpose_row_self Aα΅ i
exact funext h
| [
" IsLinearMap Ξ± A.cramerMap",
" β (x y : n β Ξ±), A.cramerMap (x + y) = A.cramerMap x + A.cramerMap y",
" β (c : Ξ±) (x : n β Ξ±), A.cramerMap (c β’ x) = c β’ A.cramerMap x",
" A.cramerMap (xβ + yβ) = A.cramerMap xβ + A.cramerMap yβ",
" A.cramerMap (cβ β’ xβ) = cβ β’ A.cramerMap xβ",
" A.cramerMap (xβ + yβ) i = ... | [
" IsLinearMap Ξ± A.cramerMap",
" β (x y : n β Ξ±), A.cramerMap (x + y) = A.cramerMap x + A.cramerMap y",
" β (c : Ξ±) (x : n β Ξ±), A.cramerMap (c β’ x) = c β’ A.cramerMap x",
" A.cramerMap (xβ + yβ) = A.cramerMap xβ + A.cramerMap yβ",
" A.cramerMap (cβ β’ xβ) = cβ β’ A.cramerMap xβ",
" A.cramerMap (xβ + yβ) i = ... |
import Mathlib.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]
| Mathlib/Order/Interval/Set/OrderIso.lean | 30 | 32 | theorem preimage_Ici (e : Ξ± βo Ξ²) (b : Ξ²) : e β»ΒΉ' Ici b = Ici (e.symm b) := by |
ext x
simp [β e.le_iff_le]
| [
" βe β»ΒΉ' Iic b = Iic (e.symm b)",
" x β βe β»ΒΉ' Iic b β x β Iic (e.symm b)",
" βe β»ΒΉ' Ici b = Ici (e.symm b)",
" x β βe β»ΒΉ' Ici b β x β Ici (e.symm b)"
] | [
" βe β»ΒΉ' Iic b = Iic (e.symm b)",
" x β βe β»ΒΉ' Iic b β x β Iic (e.symm b)",
" βe β»ΒΉ' Ici b = Ici (e.symm b)"
] |
import Mathlib.Topology.Order.IsLUB
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
variable {Ξ± Ξ² Ξ³ : Type*}
section DenselyOrdered
variable [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] [DenselyOrdered Ξ±] {a b : Ξ±}
{s : Set Ξ±}
theorem closure_Ioi' {a : Ξ±} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by
apply Subset.antisymm
Β· exact closure_minimal Ioi_subset_Ici_self isClosed_Ici
Β· rw [β diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff]
exact isGLB_Ioi.mem_closure h
#align closure_Ioi' closure_Ioi'
@[simp]
theorem closure_Ioi (a : Ξ±) [NoMaxOrder Ξ±] : closure (Ioi a) = Ici a :=
closure_Ioi' nonempty_Ioi
#align closure_Ioi closure_Ioi
theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a :=
closure_Ioi' (Ξ± := Ξ±α΅α΅) h
#align closure_Iio' closure_Iio'
@[simp]
theorem closure_Iio (a : Ξ±) [NoMinOrder Ξ±] : closure (Iio a) = Iic a :=
closure_Iio' nonempty_Iio
#align closure_Iio closure_Iio
@[simp]
theorem closure_Ioo {a b : Ξ±} (hab : a β b) : closure (Ioo a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ioo_subset_Icc_self isClosed_Icc
Β· cases' hab.lt_or_lt with hab hab
Β· rw [β diff_subset_closure_iff, Icc_diff_Ioo_same hab.le]
have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab
simp only [insert_subset_iff, singleton_subset_iff]
exact β¨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'β©
Β· rw [Icc_eq_empty_of_lt hab]
exact empty_subset _
#align closure_Ioo closure_Ioo
@[simp]
theorem closure_Ioc {a b : Ξ±} (hab : a β b) : closure (Ioc a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ioc_subset_Icc_self isClosed_Icc
Β· apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self)
rw [closure_Ioo hab]
#align closure_Ioc closure_Ioc
@[simp]
theorem closure_Ico {a b : Ξ±} (hab : a β b) : closure (Ico a b) = Icc a b := by
apply Subset.antisymm
Β· exact closure_minimal Ico_subset_Icc_self isClosed_Icc
Β· apply Subset.trans _ (closure_mono Ioo_subset_Ico_self)
rw [closure_Ioo hab]
#align closure_Ico closure_Ico
@[simp]
theorem interior_Ici' {a : Ξ±} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by
rw [β compl_Iio, interior_compl, closure_Iio' ha, compl_Iic]
#align interior_Ici' interior_Ici'
theorem interior_Ici [NoMinOrder Ξ±] {a : Ξ±} : interior (Ici a) = Ioi a :=
interior_Ici' nonempty_Iio
#align interior_Ici interior_Ici
@[simp]
theorem interior_Iic' {a : Ξ±} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a :=
interior_Ici' (Ξ± := Ξ±α΅α΅) ha
#align interior_Iic' interior_Iic'
theorem interior_Iic [NoMaxOrder Ξ±] {a : Ξ±} : interior (Iic a) = Iio a :=
interior_Iic' nonempty_Ioi
#align interior_Iic interior_Iic
@[simp]
theorem interior_Icc [NoMinOrder Ξ±] [NoMaxOrder Ξ±] {a b : Ξ±} : interior (Icc a b) = Ioo a b := by
rw [β Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio]
#align interior_Icc interior_Icc
@[simp]
theorem Icc_mem_nhds_iff [NoMinOrder Ξ±] [NoMaxOrder Ξ±] {a b x : Ξ±} :
Icc a b β π x β x β Ioo a b := by
rw [β interior_Icc, mem_interior_iff_mem_nhds]
@[simp]
| Mathlib/Topology/Order/DenselyOrdered.lean | 111 | 112 | theorem interior_Ico [NoMinOrder Ξ±] {a b : Ξ±} : interior (Ico a b) = Ioo a b := by |
rw [β Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio]
| [
" closure (Ioi a) = Ici a",
" closure (Ioi a) β Ici a",
" Ici a β closure (Ioi a)",
" a β closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) β Icc a b",
" Icc a b β closure (Ioo a b)",
" {a, b} β closure (Ioo a b)",
" a β closure (Ioo a b) β§ b β closure (Ioo a b)",
" β
β closure... | [
" closure (Ioi a) = Ici a",
" closure (Ioi a) β Ici a",
" Ici a β closure (Ioi a)",
" a β closure (Ioi a)",
" closure (Ioo a b) = Icc a b",
" closure (Ioo a b) β Icc a b",
" Icc a b β closure (Ioo a b)",
" {a, b} β closure (Ioo a b)",
" a β closure (Ioo a b) β§ b β closure (Ioo a b)",
" β
β closure... |
import Mathlib.Order.Interval.Set.ProjIcc
import Mathlib.Topology.Algebra.Order.Field
import Mathlib.Topology.Bornology.Hom
import Mathlib.Topology.EMetricSpace.Lipschitz
import Mathlib.Topology.MetricSpace.Basic
import Mathlib.Topology.MetricSpace.Bounded
#align_import topology.metric_space.lipschitz from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
universe u v w x
open Filter Function Set Topology NNReal ENNReal Bornology
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {ΞΉ : Type x}
| Mathlib/Topology/MetricSpace/Lipschitz.lean | 41 | 44 | theorem lipschitzWith_iff_dist_le_mul [PseudoMetricSpace Ξ±] [PseudoMetricSpace Ξ²] {K : ββ₯0}
{f : Ξ± β Ξ²} : LipschitzWith K f β β x y, dist (f x) (f y) β€ K * dist x y := by |
simp only [LipschitzWith, edist_nndist, dist_nndist]
norm_cast
| [
" LipschitzWith K f β β (x y : Ξ±), dist (f x) (f y) β€ βK * dist x y",
" (β (x y : Ξ±), β(nndist (f x) (f y)) β€ βK * β(nndist x y)) β β (x y : Ξ±), β(nndist (f x) (f y)) β€ βK * β(nndist x y)"
] | [
" LipschitzWith K f β β (x y : Ξ±), dist (f x) (f y) β€ βK * dist x y"
] |
import Mathlib.Algebra.Star.Order
import Mathlib.Topology.Instances.NNReal
import Mathlib.Topology.Order.MonotoneContinuity
#align_import data.real.sqrt from "leanprover-community/mathlib"@"31c24aa72e7b3e5ed97a8412470e904f82b81004"
open Set Filter
open scoped Filter NNReal Topology
namespace NNReal
variable {x y : ββ₯0}
-- Porting note: was @[pp_nodot]
noncomputable def sqrt : ββ₯0 βo ββ₯0 :=
OrderIso.symm <| powOrderIso 2 two_ne_zero
#align nnreal.sqrt NNReal.sqrt
@[simp] lemma sq_sqrt (x : ββ₯0) : sqrt x ^ 2 = x := sqrt.symm_apply_apply _
#align nnreal.sq_sqrt NNReal.sq_sqrt
@[simp] lemma sqrt_sq (x : ββ₯0) : sqrt (x ^ 2) = x := sqrt.apply_symm_apply _
#align nnreal.sqrt_sq NNReal.sqrt_sq
@[simp] lemma mul_self_sqrt (x : ββ₯0) : sqrt x * sqrt x = x := by rw [β sq, sq_sqrt]
#align nnreal.mul_self_sqrt NNReal.mul_self_sqrt
@[simp] lemma sqrt_mul_self (x : ββ₯0) : sqrt (x * x) = x := by rw [β sq, sqrt_sq]
#align nnreal.sqrt_mul_self NNReal.sqrt_mul_self
lemma sqrt_le_sqrt : sqrt x β€ sqrt y β x β€ y := sqrt.le_iff_le
#align nnreal.sqrt_le_sqrt_iff NNReal.sqrt_le_sqrt
lemma sqrt_lt_sqrt : sqrt x < sqrt y β x < y := sqrt.lt_iff_lt
#align nnreal.sqrt_lt_sqrt_iff NNReal.sqrt_lt_sqrt
lemma sqrt_eq_iff_eq_sq : sqrt x = y β x = y ^ 2 := sqrt.toEquiv.apply_eq_iff_eq_symm_apply
#align nnreal.sqrt_eq_iff_sq_eq NNReal.sqrt_eq_iff_eq_sq
lemma sqrt_le_iff_le_sq : sqrt x β€ y β x β€ y ^ 2 := sqrt.to_galoisConnection _ _
#align nnreal.sqrt_le_iff NNReal.sqrt_le_iff_le_sq
lemma le_sqrt_iff_sq_le : x β€ sqrt y β x ^ 2 β€ y := (sqrt.symm.to_galoisConnection _ _).symm
#align nnreal.le_sqrt_iff NNReal.le_sqrt_iff_sq_le
-- 2024-02-14
@[deprecated] alias sqrt_le_sqrt_iff := sqrt_le_sqrt
@[deprecated] alias sqrt_lt_sqrt_iff := sqrt_lt_sqrt
@[deprecated] alias sqrt_le_iff := sqrt_le_iff_le_sq
@[deprecated] alias le_sqrt_iff := le_sqrt_iff_sq_le
@[deprecated] alias sqrt_eq_iff_sq_eq := sqrt_eq_iff_eq_sq
@[simp] lemma sqrt_eq_zero : sqrt x = 0 β x = 0 := by simp [sqrt_eq_iff_eq_sq]
#align nnreal.sqrt_eq_zero NNReal.sqrt_eq_zero
@[simp] lemma sqrt_eq_one : sqrt x = 1 β x = 1 := by simp [sqrt_eq_iff_eq_sq]
@[simp] lemma sqrt_zero : sqrt 0 = 0 := by simp
#align nnreal.sqrt_zero NNReal.sqrt_zero
@[simp] lemma sqrt_one : sqrt 1 = 1 := by simp
#align nnreal.sqrt_one NNReal.sqrt_one
@[simp] lemma sqrt_le_one : sqrt x β€ 1 β x β€ 1 := by rw [β sqrt_one, sqrt_le_sqrt, sqrt_one]
@[simp] lemma one_le_sqrt : 1 β€ sqrt x β 1 β€ x := by rw [β sqrt_one, sqrt_le_sqrt, sqrt_one]
| Mathlib/Data/Real/Sqrt.lean | 97 | 98 | theorem sqrt_mul (x y : ββ₯0) : sqrt (x * y) = sqrt x * sqrt y := by |
rw [sqrt_eq_iff_eq_sq, mul_pow, sq_sqrt, sq_sqrt]
| [
" sqrt x * sqrt x = x",
" sqrt (x * x) = x",
" sqrt x = 0 β x = 0",
" sqrt x = 1 β x = 1",
" sqrt 0 = 0",
" sqrt 1 = 1",
" sqrt x β€ 1 β x β€ 1",
" 1 β€ sqrt x β 1 β€ x",
" sqrt (x * y) = sqrt x * sqrt y"
] | [
" sqrt x * sqrt x = x",
" sqrt (x * x) = x",
" sqrt x = 0 β x = 0",
" sqrt x = 1 β x = 1",
" sqrt 0 = 0",
" sqrt 1 = 1",
" sqrt x β€ 1 β x β€ 1",
" 1 β€ sqrt x β 1 β€ x",
" sqrt (x * y) = sqrt x * sqrt y"
] |
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 OrderedAddCommGroup
variable [OrderedAddCommGroup Ξ±] (a b c : Ξ±)
@[simp]
theorem preimage_const_add_Ici : (fun x => a + x) β»ΒΉ' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add'.symm
#align set.preimage_const_add_Ici Set.preimage_const_add_Ici
@[simp]
theorem preimage_const_add_Ioi : (fun x => a + x) β»ΒΉ' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add'.symm
#align set.preimage_const_add_Ioi Set.preimage_const_add_Ioi
@[simp]
theorem preimage_const_add_Iic : (fun x => a + x) β»ΒΉ' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le'.symm
#align set.preimage_const_add_Iic Set.preimage_const_add_Iic
@[simp]
theorem preimage_const_add_Iio : (fun x => a + x) β»ΒΉ' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt'.symm
#align set.preimage_const_add_Iio Set.preimage_const_add_Iio
@[simp]
theorem preimage_const_add_Icc : (fun x => a + x) β»ΒΉ' Icc b c = Icc (b - a) (c - a) := by
simp [β Ici_inter_Iic]
#align set.preimage_const_add_Icc Set.preimage_const_add_Icc
@[simp]
theorem preimage_const_add_Ico : (fun x => a + x) β»ΒΉ' Ico b c = Ico (b - a) (c - a) := by
simp [β Ici_inter_Iio]
#align set.preimage_const_add_Ico Set.preimage_const_add_Ico
@[simp]
theorem preimage_const_add_Ioc : (fun x => a + x) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a) := by
simp [β Ioi_inter_Iic]
#align set.preimage_const_add_Ioc Set.preimage_const_add_Ioc
@[simp]
theorem preimage_const_add_Ioo : (fun x => a + x) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a) := by
simp [β Ioi_inter_Iio]
#align set.preimage_const_add_Ioo Set.preimage_const_add_Ioo
@[simp]
theorem preimage_add_const_Ici : (fun x => x + a) β»ΒΉ' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add.symm
#align set.preimage_add_const_Ici Set.preimage_add_const_Ici
@[simp]
theorem preimage_add_const_Ioi : (fun x => x + a) β»ΒΉ' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add.symm
#align set.preimage_add_const_Ioi Set.preimage_add_const_Ioi
@[simp]
theorem preimage_add_const_Iic : (fun x => x + a) β»ΒΉ' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le.symm
#align set.preimage_add_const_Iic Set.preimage_add_const_Iic
@[simp]
theorem preimage_add_const_Iio : (fun x => x + a) β»ΒΉ' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt.symm
#align set.preimage_add_const_Iio Set.preimage_add_const_Iio
@[simp]
theorem preimage_add_const_Icc : (fun x => x + a) β»ΒΉ' Icc b c = Icc (b - a) (c - a) := by
simp [β Ici_inter_Iic]
#align set.preimage_add_const_Icc Set.preimage_add_const_Icc
@[simp]
theorem preimage_add_const_Ico : (fun x => x + a) β»ΒΉ' Ico b c = Ico (b - a) (c - a) := by
simp [β Ici_inter_Iio]
#align set.preimage_add_const_Ico Set.preimage_add_const_Ico
@[simp]
theorem preimage_add_const_Ioc : (fun x => x + a) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a) := by
simp [β Ioi_inter_Iic]
#align set.preimage_add_const_Ioc Set.preimage_add_const_Ioc
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 207 | 208 | theorem preimage_add_const_Ioo : (fun x => x + a) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a) := by |
simp [β Ioi_inter_Iio]
| [
" (fun x => a + x) β»ΒΉ' Icc b c = Icc (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ico b c = Ico (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a)",
" (fun x => x + a) β»ΒΉ' Icc b c = Icc (b - a) (c - a)",
" (fun x => x + a) β»ΒΉ' Ico b c ... | [
" (fun x => a + x) β»ΒΉ' Icc b c = Icc (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ico b c = Ico (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a)",
" (fun x => a + x) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a)",
" (fun x => x + a) β»ΒΉ' Icc b c = Icc (b - a) (c - a)",
" (fun x => x + a) β»ΒΉ' Ico b c ... |
import Mathlib.Algebra.BigOperators.Associated
import Mathlib.Data.ZMod.Basic
import Mathlib.Data.Nat.PrimeFin
import Mathlib.RingTheory.Coprime.Lemmas
namespace ZMod
variable {n m : β}
def unitsMap (hm : n β£ m) : (ZMod m)Λ£ β* (ZMod n)Λ£ := Units.map (castHom hm (ZMod n))
lemma unitsMap_def (hm : n β£ m) : unitsMap hm = Units.map (castHom hm (ZMod n)) := rfl
lemma unitsMap_comp {d : β} (hm : n β£ m) (hd : m β£ d) :
(unitsMap hm).comp (unitsMap hd) = unitsMap (dvd_trans hm hd) := by
simp only [unitsMap_def]
rw [β Units.map_comp]
exact congr_arg Units.map <| congr_arg RingHom.toMonoidHom <| castHom_comp hm hd
@[simp]
lemma unitsMap_self (n : β) : unitsMap (dvd_refl n) = MonoidHom.id _ := by
simp [unitsMap, castHom_self]
lemma IsUnit_cast_of_dvd (hm : n β£ m) (a : Units (ZMod m)) : IsUnit (cast (a : ZMod m) : ZMod n) :=
Units.isUnit (unitsMap hm a)
| Mathlib/Data/ZMod/Units.lean | 38 | 63 | theorem unitsMap_surjective [hm : NeZero m] (h : n β£ m) :
Function.Surjective (unitsMap h) := by |
suffices β x : β, x.Coprime n β β k : β, (x + k * n).Coprime m by
intro x
have β¨k, hkβ© := this x.val.val (val_coe_unit_coprime x)
refine β¨unitOfCoprime _ hk, Units.ext ?_β©
have : NeZero n := β¨fun hn β¦ hm.out (eq_zero_of_zero_dvd (hn βΈ h))β©
simp [unitsMap_def]
intro x hx
let ps := m.primeFactors.filter (fun p β¦ Β¬p β£ x)
use ps.prod id
apply Nat.coprime_of_dvd
intro p pp hp hpn
by_cases hpx : p β£ x
Β· have h := Nat.dvd_sub' hp hpx
rw [add_comm, Nat.add_sub_cancel] at h
rcases pp.dvd_mul.mp h with h | h
Β· have β¨q, hq, hq'β© := (pp.prime.dvd_finset_prod_iff id).mp h
rw [Finset.mem_filter, Nat.mem_primeFactors,
β (Nat.prime_dvd_prime_iff_eq pp hq.1.1).mp hq'] at hq
exact hq.2 hpx
Β· exact Nat.Prime.not_coprime_iff_dvd.mpr β¨p, pp, hpx, hβ© hx
Β· have pps : p β ps := Finset.mem_filter.mpr β¨Nat.mem_primeFactors.mpr β¨pp, hpn, hm.outβ©, hpxβ©
have h := Nat.dvd_sub' hp ((Finset.dvd_prod_of_mem id pps).mul_right n)
rw [Nat.add_sub_cancel] at h
contradiction
| [
" (unitsMap hm).comp (unitsMap hd) = unitsMap β―",
" (Units.map β(castHom hm (ZMod n))).comp (Units.map β(castHom hd (ZMod m))) = Units.map β(castHom β― (ZMod n))",
" Units.map ((β(castHom hm (ZMod n))).comp β(castHom hd (ZMod m))) = Units.map β(castHom β― (ZMod n))",
" unitsMap β― = MonoidHom.id (ZMod n)Λ£",
" ... | [
" (unitsMap hm).comp (unitsMap hd) = unitsMap β―",
" (Units.map β(castHom hm (ZMod n))).comp (Units.map β(castHom hd (ZMod m))) = Units.map β(castHom β― (ZMod n))",
" Units.map ((β(castHom hm (ZMod n))).comp β(castHom hd (ZMod m))) = Units.map β(castHom β― (ZMod n))",
" unitsMap β― = MonoidHom.id (ZMod n)Λ£",
" ... |
import Mathlib.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Adjunction.Evaluation
import Mathlib.Tactic.CategoryTheory.Elementwise
import Mathlib.CategoryTheory.Adhesive
import Mathlib.CategoryTheory.Sites.ConcreteSheafification
#align_import category_theory.sites.subsheaf from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe w v u
open Opposite CategoryTheory
namespace CategoryTheory.GrothendieckTopology
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
@[ext]
structure Subpresheaf (F : Cα΅α΅ β₯€ Type w) where
obj : β U, Set (F.obj U)
map : β {U V : Cα΅α΅} (i : U βΆ V), obj U β F.map i β»ΒΉ' obj V
#align category_theory.grothendieck_topology.subpresheaf CategoryTheory.GrothendieckTopology.Subpresheaf
variable {F F' F'' : Cα΅α΅ β₯€ Type w} (G G' : Subpresheaf F)
instance : PartialOrder (Subpresheaf F) :=
PartialOrder.lift Subpresheaf.obj Subpresheaf.ext
instance : Top (Subpresheaf F) :=
β¨β¨fun U => β€, @fun U V _ x _ => by aesop_catβ©β©
instance : Nonempty (Subpresheaf F) :=
inferInstance
@[simps!]
def Subpresheaf.toPresheaf : Cα΅α΅ β₯€ Type w where
obj U := G.obj U
map := @fun U V i x => β¨F.map i x, G.map i x.propβ©
map_id X := by
ext β¨x, _β©
dsimp
simp only [FunctorToTypes.map_id_apply]
map_comp := @fun X Y Z i j => by
ext β¨x, _β©
dsimp
simp only [FunctorToTypes.map_comp_apply]
#align category_theory.grothendieck_topology.subpresheaf.to_presheaf CategoryTheory.GrothendieckTopology.Subpresheaf.toPresheaf
instance {U} : CoeHead (G.toPresheaf.obj U) (F.obj U) where
coe := Subtype.val
@[simps]
def Subpresheaf.ΞΉ : G.toPresheaf βΆ F where app U x := x
#align category_theory.grothendieck_topology.subpresheaf.ΞΉ CategoryTheory.GrothendieckTopology.Subpresheaf.ΞΉ
instance : Mono G.ΞΉ :=
β¨@fun _ fβ fβ e =>
NatTrans.ext fβ fβ <|
funext fun U => funext fun x => Subtype.ext <| congr_fun (congr_app e U) xβ©
@[simps]
def Subpresheaf.homOfLe {G G' : Subpresheaf F} (h : G β€ G') : G.toPresheaf βΆ G'.toPresheaf where
app U x := β¨x, h U x.propβ©
#align category_theory.grothendieck_topology.subpresheaf.hom_of_le CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe
instance {G G' : Subpresheaf F} (h : G β€ G') : Mono (Subpresheaf.homOfLe h) :=
β¨fun fβ fβ e =>
NatTrans.ext fβ fβ <|
funext fun U =>
funext fun x =>
Subtype.ext <| (congr_arg Subtype.val <| (congr_fun (congr_app e U) x : _) : _)β©
@[reassoc (attr := simp)]
theorem Subpresheaf.homOfLe_ΞΉ {G G' : Subpresheaf F} (h : G β€ G') :
Subpresheaf.homOfLe h β« G'.ΞΉ = G.ΞΉ := by
ext
rfl
#align category_theory.grothendieck_topology.subpresheaf.hom_of_le_ΞΉ CategoryTheory.GrothendieckTopology.Subpresheaf.homOfLe_ΞΉ
instance : IsIso (Subpresheaf.ΞΉ (β€ : Subpresheaf F)) := by
refine @NatIso.isIso_of_isIso_app _ _ _ _ _ _ _ ?_
intro X
rw [isIso_iff_bijective]
exact β¨Subtype.coe_injective, fun x => β¨β¨x, _root_.trivialβ©, rflβ©β©
| Mathlib/CategoryTheory/Sites/Subsheaf.lean | 122 | 130 | theorem Subpresheaf.eq_top_iff_isIso : G = β€ β IsIso G.ΞΉ := by |
constructor
Β· rintro rfl
infer_instance
Β· intro H
ext U x
apply iff_true_iff.mpr
rw [β IsIso.inv_hom_id_apply (G.ΞΉ.app U) x]
exact ((inv (G.ΞΉ.app U)) x).2
| [
" x β F.map xβΒΉ β»ΒΉ' (fun U => β€) V",
" { obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.map (π X) =\n π ({ obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.obj X)",
" β({ obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.map (π X) β¨x, propertyββ©) =... | [
" x β F.map xβΒΉ β»ΒΉ' (fun U => β€) V",
" { obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.map (π X) =\n π ({ obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.obj X)",
" β({ obj := fun U => β(G.obj U), map := fun U V i x => β¨F.map i βx, β―β© }.map (π X) β¨x, propertyββ©) =... |
import Mathlib.SetTheory.Cardinal.Finite
#align_import data.set.ncard from "leanprover-community/mathlib"@"74c2af38a828107941029b03839882c5c6f87a04"
namespace Set
variable {Ξ± Ξ² : Type*} {s t : Set Ξ±}
noncomputable def encard (s : Set Ξ±) : ββ := PartENat.withTopEquiv (PartENat.card s)
@[simp] theorem encard_univ_coe (s : Set Ξ±) : encard (univ : Set s) = encard s := by
rw [encard, encard, PartENat.card_congr (Equiv.Set.univ βs)]
theorem encard_univ (Ξ± : Type*) :
encard (univ : Set Ξ±) = PartENat.withTopEquiv (PartENat.card Ξ±) := by
rw [encard, PartENat.card_congr (Equiv.Set.univ Ξ±)]
theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card := by
have := h.fintype
rw [encard, PartENat.card_eq_coe_fintype_card,
PartENat.withTopEquiv_natCast, toFinite_toFinset, toFinset_card]
| Mathlib/Data/Set/Card.lean | 78 | 80 | theorem encard_eq_coe_toFinset_card (s : Set Ξ±) [Fintype s] : encard s = s.toFinset.card := by |
have h := toFinite s
rw [h.encard_eq_coe_toFinset_card, toFinite_toFinset]
| [
" univ.encard = s.encard",
" univ.encard = PartENat.withTopEquiv (PartENat.card Ξ±)",
" s.encard = βh.toFinset.card",
" s.encard = βs.toFinset.card"
] | [
" univ.encard = s.encard",
" univ.encard = PartENat.withTopEquiv (PartENat.card Ξ±)",
" s.encard = βh.toFinset.card",
" s.encard = βs.toFinset.card"
] |
import Mathlib.Dynamics.PeriodicPts
import Mathlib.GroupTheory.Exponent
import Mathlib.GroupTheory.GroupAction.Basic
namespace MulAction
universe u v
variable {Ξ± : Type v}
variable {G : Type u} [Group G] [MulAction G Ξ±]
variable {M : Type u} [Monoid M] [MulAction M Ξ±]
@[to_additive "If the action is periodic, then a lower bound for its period can be computed."]
theorem le_period {m : M} {a : Ξ±} {n : β} (period_pos : 0 < period m a)
(moved : β k, 0 < k β k < n β m ^ k β’ a β a) : n β€ period m a :=
le_of_not_gt fun period_lt_n =>
moved _ period_pos period_lt_n <| pow_period_smul m a
@[to_additive "If for some `n`, `(n β’ m) +α΅₯ a = a`, then `period m a β€ n`."]
theorem period_le_of_fixed {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n) (fixed : m ^ n β’ a = a) :
period m a β€ n :=
(isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_le n_pos
@[to_additive "If for some `n`, `(n β’ m) +α΅₯ a = a`, then `0 < period m a`."]
theorem period_pos_of_fixed {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n) (fixed : m ^ n β’ a = a) :
0 < period m a :=
(isPeriodicPt_smul_iff.mpr fixed).minimalPeriod_pos n_pos
@[to_additive]
theorem period_eq_one_iff {m : M} {a : Ξ±} : period m a = 1 β m β’ a = a :=
β¨fun eq_one => pow_one m βΈ eq_one βΈ pow_period_smul m a,
fun fixed => le_antisymm
(period_le_of_fixed one_pos (by simpa))
(period_pos_of_fixed one_pos (by simpa))β©
@[to_additive "For any non-zero `n` less than the period of `m` on `a`, `a` is moved by `n β’ m`."]
theorem pow_smul_ne_of_lt_period {m : M} {a : Ξ±} {n : β} (n_pos : 0 < n)
(n_lt_period : n < period m a) : m ^ n β’ a β a := fun a_fixed =>
not_le_of_gt n_lt_period <| period_le_of_fixed n_pos a_fixed
section MonoidExponent
@[to_additive]
theorem period_dvd_orderOf (m : M) (a : Ξ±) : period m a β£ orderOf m := by
rw [β pow_smul_eq_iff_period_dvd, pow_orderOf_eq_one, one_smul]
@[to_additive]
theorem period_pos_of_orderOf_pos {m : M} (order_pos : 0 < orderOf m) (a : Ξ±) :
0 < period m a :=
Nat.pos_of_dvd_of_pos (period_dvd_orderOf m a) order_pos
@[to_additive]
theorem period_le_orderOf {m : M} (order_pos : 0 < orderOf m) (a : Ξ±) :
period m a β€ orderOf m :=
Nat.le_of_dvd order_pos (period_dvd_orderOf m a)
@[to_additive]
theorem period_dvd_exponent (m : M) (a : Ξ±) : period m a β£ Monoid.exponent M := by
rw [β pow_smul_eq_iff_period_dvd, Monoid.pow_exponent_eq_one, one_smul]
@[to_additive]
theorem period_pos_of_exponent_pos (exp_pos : 0 < Monoid.exponent M) (m : M) (a : Ξ±) :
0 < period m a :=
Nat.pos_of_dvd_of_pos (period_dvd_exponent m a) exp_pos
@[to_additive]
theorem period_le_exponent (exp_pos : 0 < Monoid.exponent M) (m : M) (a : Ξ±) :
period m a β€ Monoid.exponent M :=
Nat.le_of_dvd exp_pos (period_dvd_exponent m a)
variable (Ξ±)
@[to_additive]
| Mathlib/GroupTheory/GroupAction/Period.lean | 117 | 120 | theorem period_bounded_of_exponent_pos (exp_pos : 0 < Monoid.exponent M) (m : M) :
BddAbove (Set.range (fun a : Ξ± => period m a)) := by |
use Monoid.exponent M
simpa [upperBounds] using period_le_exponent exp_pos _
| [
" m ^ 1 β’ a = a",
" period m a β£ orderOf m",
" period m a β£ Monoid.exponent M",
" BddAbove (Set.range fun a => period m a)",
" Monoid.exponent M β upperBounds (Set.range fun a => period m a)"
] | [
" m ^ 1 β’ a = a",
" period m a β£ orderOf m",
" period m a β£ Monoid.exponent M",
" BddAbove (Set.range fun a => period m a)"
] |
import Mathlib.Algebra.Star.Basic
import Mathlib.Data.Set.Finite
import Mathlib.Data.Set.Pointwise.Basic
#align_import algebra.star.pointwise from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
namespace Set
open Pointwise
local postfix:max "β" => star
variable {Ξ± : Type*} {s t : Set Ξ±} {a : Ξ±}
protected def star [Star Ξ±] : Star (Set Ξ±) := β¨preimage Star.starβ©
#align set.has_star Set.star
scoped[Pointwise] attribute [instance] Set.star
@[simp]
theorem star_empty [Star Ξ±] : (β
: Set Ξ±)β = β
:= rfl
#align set.star_empty Set.star_empty
@[simp]
theorem star_univ [Star Ξ±] : (univ : Set Ξ±)β = univ := rfl
#align set.star_univ Set.star_univ
@[simp]
theorem nonempty_star [InvolutiveStar Ξ±] {s : Set Ξ±} : sβ.Nonempty β s.Nonempty :=
star_involutive.surjective.nonempty_preimage
#align set.nonempty_star Set.nonempty_star
theorem Nonempty.star [InvolutiveStar Ξ±] {s : Set Ξ±} (h : s.Nonempty) : sβ.Nonempty :=
nonempty_star.2 h
#align set.nonempty.star Set.Nonempty.star
@[simp]
theorem mem_star [Star Ξ±] : a β sβ β aβ β s := Iff.rfl
#align set.mem_star Set.mem_star
theorem star_mem_star [InvolutiveStar Ξ±] : aβ β sβ β a β s := by simp only [mem_star, star_star]
#align set.star_mem_star Set.star_mem_star
@[simp]
theorem star_preimage [Star Ξ±] : Star.star β»ΒΉ' s = sβ := rfl
#align set.star_preimage Set.star_preimage
@[simp]
theorem image_star [InvolutiveStar Ξ±] : Star.star '' s = sβ := by
simp only [β star_preimage]
rw [image_eq_preimage_of_inverse] <;> intro <;> simp only [star_star]
#align set.image_star Set.image_star
@[simp]
theorem inter_star [Star Ξ±] : (s β© t)β = sβ β© tβ := preimage_inter
#align set.inter_star Set.inter_star
@[simp]
theorem union_star [Star Ξ±] : (s βͺ t)β = sβ βͺ tβ := preimage_union
#align set.union_star Set.union_star
@[simp]
theorem iInter_star {ΞΉ : Sort*} [Star Ξ±] (s : ΞΉ β Set Ξ±) : (β i, s i)β = β i, (s i)β :=
preimage_iInter
#align set.Inter_star Set.iInter_star
@[simp]
theorem iUnion_star {ΞΉ : Sort*} [Star Ξ±] (s : ΞΉ β Set Ξ±) : (β i, s i)β = β i, (s i)β :=
preimage_iUnion
#align set.Union_star Set.iUnion_star
@[simp]
theorem compl_star [Star Ξ±] : sαΆβ = sβαΆ := preimage_compl
#align set.compl_star Set.compl_star
@[simp]
instance [InvolutiveStar Ξ±] : InvolutiveStar (Set Ξ±) where
star := Star.star
star_involutive s := by simp only [β star_preimage, preimage_preimage, star_star, preimage_id']
@[simp]
theorem star_subset_star [InvolutiveStar Ξ±] {s t : Set Ξ±} : sβ β tβ β s β t :=
Equiv.star.surjective.preimage_subset_preimage_iff
#align set.star_subset_star Set.star_subset_star
theorem star_subset [InvolutiveStar Ξ±] {s t : Set Ξ±} : sβ β t β s β tβ := by
rw [β star_subset_star, star_star]
#align set.star_subset Set.star_subset
theorem Finite.star [InvolutiveStar Ξ±] {s : Set Ξ±} (hs : s.Finite) : sβ.Finite :=
hs.preimage star_injective.injOn
#align set.finite.star Set.Finite.star
| Mathlib/Algebra/Star/Pointwise.lean | 115 | 117 | theorem star_singleton {Ξ² : Type*} [InvolutiveStar Ξ²] (x : Ξ²) : ({x} : Set Ξ²)β = {xβ} := by |
ext1 y
rw [mem_star, mem_singleton_iff, mem_singleton_iff, star_eq_iff_star_eq, eq_comm]
| [
" aβ β sβ β a β s",
" star '' s = sβ",
" star '' s = star β»ΒΉ' s",
" Function.LeftInverse star star",
" Function.RightInverse star star",
" xβββ = xβ",
" sββ = s",
" sβ β t β s β tβ",
" {x}β = {xβ}",
" y β {x}β β y β {xβ}"
] | [
" aβ β sβ β a β s",
" star '' s = sβ",
" star '' s = star β»ΒΉ' s",
" Function.LeftInverse star star",
" Function.RightInverse star star",
" xβββ = xβ",
" sββ = s",
" sβ β t β s β tβ",
" {x}β = {xβ}"
] |
import Mathlib.MeasureTheory.Constructions.Prod.Basic
import Mathlib.MeasureTheory.Measure.MeasureSpace
namespace MeasureTheory
namespace Measure
variable {M : Type*} [Monoid M] [MeasurableSpace M]
@[to_additive conv "Additive convolution of measures."]
noncomputable def mconv (ΞΌ : Measure M) (Ξ½ : Measure M) :
Measure M := Measure.map (fun x : M Γ M β¦ x.1 * x.2) (ΞΌ.prod Ξ½)
scoped[MeasureTheory] infix:80 " β " => MeasureTheory.Measure.mconv
scoped[MeasureTheory] infix:80 " β " => MeasureTheory.Measure.conv
@[to_additive (attr := simp)]
theorem dirac_one_mconv [MeasurableMulβ M] (ΞΌ : Measure M) [SFinite ΞΌ] :
(Measure.dirac 1) β ΞΌ = ΞΌ := by
unfold mconv
rw [MeasureTheory.Measure.dirac_prod, map_map]
Β· simp only [Function.comp_def, one_mul, map_id']
all_goals { measurability }
@[to_additive (attr := simp)]
theorem mconv_dirac_one [MeasurableMulβ M]
(ΞΌ : Measure M) [SFinite ΞΌ] : ΞΌ β (Measure.dirac 1) = ΞΌ := by
unfold mconv
rw [MeasureTheory.Measure.prod_dirac, map_map]
Β· simp only [Function.comp_def, mul_one, map_id']
all_goals { measurability }
@[to_additive (attr := simp) conv_zero]
theorem mconv_zero (ΞΌ : Measure M) : (0 : Measure M) β ΞΌ = (0 : Measure M) := by
unfold mconv
simp
@[to_additive (attr := simp) zero_conv]
| Mathlib/MeasureTheory/Group/Convolution.lean | 65 | 67 | theorem zero_mconv (ΞΌ : Measure M) : ΞΌ β (0 : Measure M) = (0 : Measure M) := by |
unfold mconv
simp
| [
" dirac 1 β ΞΌ = ΞΌ",
" map (fun x => x.1 * x.2) ((dirac 1).prod ΞΌ) = ΞΌ",
" map ((fun x => x.1 * x.2) β Prod.mk 1) ΞΌ = ΞΌ",
" Measurable (Prod.mk 1)",
" Measurable fun x => x.1 * x.2",
" ΞΌ β dirac 1 = ΞΌ",
" map (fun x => x.1 * x.2) (ΞΌ.prod (dirac 1)) = ΞΌ",
" map ((fun x => x.1 * x.2) β fun x => (x, 1)) ΞΌ... | [
" dirac 1 β ΞΌ = ΞΌ",
" map (fun x => x.1 * x.2) ((dirac 1).prod ΞΌ) = ΞΌ",
" map ((fun x => x.1 * x.2) β Prod.mk 1) ΞΌ = ΞΌ",
" Measurable (Prod.mk 1)",
" Measurable fun x => x.1 * x.2",
" ΞΌ β dirac 1 = ΞΌ",
" map (fun x => x.1 * x.2) (ΞΌ.prod (dirac 1)) = ΞΌ",
" map ((fun x => x.1 * x.2) β fun x => (x, 1)) ΞΌ... |
import Mathlib.Data.Set.Finite
import Mathlib.Order.Partition.Finpartition
#align_import data.setoid.partition from "leanprover-community/mathlib"@"b363547b3113d350d053abdf2884e9850a56b205"
namespace Setoid
variable {Ξ± : Type*}
theorem eq_of_mem_eqv_class {c : Set (Set Ξ±)} (H : β a, β! b β c, a β b) {x b b'}
(hc : b β c) (hb : x β b) (hc' : b' β c) (hb' : x β b') : b = b' :=
(H x).unique β¨hc, hbβ© β¨hc', hb'β©
#align setoid.eq_of_mem_eqv_class Setoid.eq_of_mem_eqv_class
def mkClasses (c : Set (Set Ξ±)) (H : β a, β! b β c, a β b) : Setoid Ξ± where
r x y := β s β c, x β s β y β s
iseqv.refl := fun _ _ _ hx => hx
iseqv.symm := fun {x _y} h s hs hy => by
obtain β¨t, β¨ht, hxβ©, _β© := H x
rwa [eq_of_mem_eqv_class H hs hy ht (h t ht hx)]
iseqv.trans := fun {_x y z} h1 h2 s hs hx => h2 s hs (h1 s hs hx)
#align setoid.mk_classes Setoid.mkClasses
def classes (r : Setoid Ξ±) : Set (Set Ξ±) :=
{ s | β y, s = { x | r.Rel x y } }
#align setoid.classes Setoid.classes
theorem mem_classes (r : Setoid Ξ±) (y) : { x | r.Rel x y } β r.classes :=
β¨y, rflβ©
#align setoid.mem_classes Setoid.mem_classes
| Mathlib/Data/Setoid/Partition.lean | 67 | 71 | theorem classes_ker_subset_fiber_set {Ξ² : Type*} (f : Ξ± β Ξ²) :
(Setoid.ker f).classes β Set.range fun y => { x | f x = y } := by |
rintro s β¨x, rflβ©
rw [Set.mem_range]
exact β¨f x, rflβ©
| [
" x β s",
" (ker f).classes β Set.range fun y => {x | f x = y}",
" {x_1 | (ker f).Rel x_1 x} β Set.range fun y => {x | f x = y}",
" β y, {x | f x = y} = {x_1 | (ker f).Rel x_1 x}"
] | [
" x β s",
" (ker f).classes β Set.range fun y => {x | f x = y}"
] |
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.Calculus.BumpFunction.Normed
import Mathlib.MeasureTheory.Integral.Average
import Mathlib.MeasureTheory.Covering.Differentiation
import Mathlib.MeasureTheory.Covering.BesicovitchVectorSpace
import Mathlib.MeasureTheory.Measure.Haar.Unique
#align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
universe uG uE'
open ContinuousLinearMap Metric MeasureTheory Filter Function Measure Set
open scoped Convolution Topology
namespace ContDiffBump
variable {G : Type uG} {E' : Type uE'} [NormedAddCommGroup E'] {g : G β E'} [MeasurableSpace G]
{ΞΌ : MeasureTheory.Measure G} [NormedSpace β E'] [NormedAddCommGroup G] [NormedSpace β G]
[HasContDiffBump G] [CompleteSpace E'] {Ο : ContDiffBump (0 : G)} {xβ : G}
theorem convolution_eq_right {xβ : G} (hg : β x β ball xβ Ο.rOut, g x = g xβ) :
(Ο β[lsmul β β, ΞΌ] g : G β E') xβ = integral ΞΌ Ο β’ g xβ := by
simp_rw [convolution_eq_right' _ Ο.support_eq.subset hg, lsmul_apply, integral_smul_const]
#align cont_diff_bump.convolution_eq_right ContDiffBump.convolution_eq_right
variable [BorelSpace G]
variable [IsLocallyFiniteMeasure ΞΌ] [ΞΌ.IsOpenPosMeasure]
variable [FiniteDimensional β G]
theorem normed_convolution_eq_right {xβ : G} (hg : β x β ball xβ Ο.rOut, g x = g xβ) :
(Ο.normed ΞΌ β[lsmul β β, ΞΌ] g : G β E') xβ = g xβ := by
rw [convolution_eq_right' _ Ο.support_normed_eq.subset hg]
exact integral_normed_smul Ο ΞΌ (g xβ)
#align cont_diff_bump.normed_convolution_eq_right ContDiffBump.normed_convolution_eq_right
variable [ΞΌ.IsAddLeftInvariant]
theorem dist_normed_convolution_le {xβ : G} {Ξ΅ : β} (hmg : AEStronglyMeasurable g ΞΌ)
(hg : β x β ball xβ Ο.rOut, dist (g x) (g xβ) β€ Ξ΅) :
dist ((Ο.normed ΞΌ β[lsmul β β, ΞΌ] g : G β E') xβ) (g xβ) β€ Ξ΅ :=
dist_convolution_le (by simp_rw [β dist_self (g xβ), hg xβ (mem_ball_self Ο.rOut_pos)])
Ο.support_normed_eq.subset Ο.nonneg_normed Ο.integral_normed hmg hg
#align cont_diff_bump.dist_normed_convolution_le ContDiffBump.dist_normed_convolution_le
nonrec theorem convolution_tendsto_right {ΞΉ} {Ο : ΞΉ β ContDiffBump (0 : G)} {g : ΞΉ β G β E'}
{k : ΞΉ β G} {xβ : G} {zβ : E'} {l : Filter ΞΉ} (hΟ : Tendsto (fun i => (Ο i).rOut) l (π 0))
(hig : βαΆ i in l, AEStronglyMeasurable (g i) ΞΌ) (hcg : Tendsto (uncurry g) (l ΓΛ’ π xβ) (π zβ))
(hk : Tendsto k l (π xβ)) :
Tendsto (fun i => ((Ο i).normed ΞΌ β[lsmul β β, ΞΌ] g i) (k i)) l (π zβ) :=
convolution_tendsto_right (eventually_of_forall fun i => (Ο i).nonneg_normed)
(eventually_of_forall fun i => (Ο i).integral_normed) (tendsto_support_normed_smallSets hΟ) hig
hcg hk
#align cont_diff_bump.convolution_tendsto_right ContDiffBump.convolution_tendsto_right
theorem convolution_tendsto_right_of_continuous {ΞΉ} {Ο : ΞΉ β ContDiffBump (0 : G)} {l : Filter ΞΉ}
(hΟ : Tendsto (fun i => (Ο i).rOut) l (π 0)) (hg : Continuous g) (xβ : G) :
Tendsto (fun i => ((Ο i).normed ΞΌ β[lsmul β β, ΞΌ] g) xβ) l (π (g xβ)) :=
convolution_tendsto_right hΟ (eventually_of_forall fun _ => hg.aestronglyMeasurable)
((hg.tendsto xβ).comp tendsto_snd) tendsto_const_nhds
#align cont_diff_bump.convolution_tendsto_right_of_continuous ContDiffBump.convolution_tendsto_right_of_continuous
| Mathlib/Analysis/Calculus/BumpFunction/Convolution.lean | 110 | 139 | theorem ae_convolution_tendsto_right_of_locallyIntegrable
{ΞΉ} {Ο : ΞΉ β ContDiffBump (0 : G)} {l : Filter ΞΉ} {K : β}
(hΟ : Tendsto (fun i β¦ (Ο i).rOut) l (π 0))
(h'Ο : βαΆ i in l, (Ο i).rOut β€ K * (Ο i).rIn) (hg : LocallyIntegrable g ΞΌ) : βα΅ xβ βΞΌ,
Tendsto (fun i β¦ ((Ο i).normed ΞΌ β[lsmul β β, ΞΌ] g) xβ) l (π (g xβ)) := by |
have : IsAddHaarMeasure ΞΌ := β¨β©
-- By Lebesgue differentiation theorem, the average of `g` on a small ball converges
-- almost everywhere to the value of `g` as the radius shrinks to zero.
-- We will see that this set of points satisfies the desired conclusion.
filter_upwards [(Besicovitch.vitaliFamily ΞΌ).ae_tendsto_average_norm_sub hg] with xβ hβ
simp only [convolution_eq_swap, lsmul_apply]
have hΟ' : Tendsto (fun i β¦ (Ο i).rOut) l (π[>] 0) :=
tendsto_nhdsWithin_iff.2 β¨hΟ, eventually_of_forall (fun i β¦ (Ο i).rOut_pos)β©
have := (hβ.comp (Besicovitch.tendsto_filterAt ΞΌ xβ)).comp hΟ'
simp only [Function.comp] at this
apply tendsto_integral_smul_of_tendsto_average_norm_sub (K ^ (FiniteDimensional.finrank β G)) this
Β· filter_upwards with i using
hg.integrableOn_isCompact (isCompact_closedBall _ _)
Β· apply tendsto_const_nhds.congr (fun i β¦ ?_)
rw [β integral_neg_eq_self]
simp only [sub_neg_eq_add, integral_add_left_eq_self, integral_normed]
Β· filter_upwards with i
change support ((ContDiffBump.normed (Ο i) ΞΌ) β (fun y β¦ xβ - y)) β closedBall xβ (Ο i).rOut
simp only [support_comp_eq_preimage, support_normed_eq]
intro x hx
simp only [mem_preimage, mem_ball, dist_zero_right] at hx
simpa [dist_eq_norm_sub'] using hx.le
Β· filter_upwards [h'Ο] with i hi x
rw [abs_of_nonneg (nonneg_normed _ _), addHaar_closedBall_center]
exact (Ο i).normed_le_div_measure_closedBall_rOut _ _ hi _
| [
" (βΟ β[lsmul β β, ΞΌ] g) xβ = integral ΞΌ βΟ β’ g xβ",
" (Ο.normed ΞΌ β[lsmul β β, ΞΌ] g) xβ = g xβ",
" β« (t : G), ((lsmul β β) (Ο.normed ΞΌ t)) (g xβ) βΞΌ = g xβ",
" 0 β€ Ξ΅",
" βα΅ (xβ : G) βΞΌ, Tendsto (fun i => ((Ο i).normed ΞΌ β[lsmul β β, ΞΌ] g) xβ) l (π (g xβ))",
" Tendsto (fun i => ((Ο i).normed ΞΌ β[lsmul β ... | [
" (βΟ β[lsmul β β, ΞΌ] g) xβ = integral ΞΌ βΟ β’ g xβ",
" (Ο.normed ΞΌ β[lsmul β β, ΞΌ] g) xβ = g xβ",
" β« (t : G), ((lsmul β β) (Ο.normed ΞΌ t)) (g xβ) βΞΌ = g xβ",
" 0 β€ Ξ΅",
" βα΅ (xβ : G) βΞΌ, Tendsto (fun i => ((Ο i).normed ΞΌ β[lsmul β β, ΞΌ] g) xβ) l (π (g xβ))"
] |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section WithDivisionRing
variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : β} [DivisionRing K]
theorem nth_cont_eq_succ_nth_cont_aux : g.continuants n = g.continuantsAux (n + 1) :=
rfl
#align generalized_continued_fraction.nth_cont_eq_succ_nth_cont_aux GeneralizedContinuedFraction.nth_cont_eq_succ_nth_cont_aux
theorem num_eq_conts_a : g.numerators n = (g.continuants n).a :=
rfl
#align generalized_continued_fraction.num_eq_conts_a GeneralizedContinuedFraction.num_eq_conts_a
theorem denom_eq_conts_b : g.denominators n = (g.continuants n).b :=
rfl
#align generalized_continued_fraction.denom_eq_conts_b GeneralizedContinuedFraction.denom_eq_conts_b
theorem convergent_eq_num_div_denom : g.convergents n = g.numerators n / g.denominators n :=
rfl
#align generalized_continued_fraction.convergent_eq_num_div_denom GeneralizedContinuedFraction.convergent_eq_num_div_denom
theorem convergent_eq_conts_a_div_conts_b :
g.convergents n = (g.continuants n).a / (g.continuants n).b :=
rfl
#align generalized_continued_fraction.convergent_eq_conts_a_div_conts_b GeneralizedContinuedFraction.convergent_eq_conts_a_div_conts_b
theorem exists_conts_a_of_num {A : K} (nth_num_eq : g.numerators n = A) :
β conts, g.continuants n = conts β§ conts.a = A := by simpa
#align generalized_continued_fraction.exists_conts_a_of_num GeneralizedContinuedFraction.exists_conts_a_of_num
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 116 | 117 | theorem exists_conts_b_of_denom {B : K} (nth_denom_eq : g.denominators n = B) :
β conts, g.continuants n = conts β§ conts.b = B := by | simpa
| [
" β conts, g.continuants n = conts β§ conts.a = A",
" β conts, g.continuants n = conts β§ conts.b = B"
] | [
" β conts, g.continuants n = conts β§ conts.a = A",
" β conts, g.continuants n = conts β§ conts.b = B"
] |
import Mathlib.Analysis.Calculus.LocalExtr.Rolle
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Topology.Algebra.Polynomial
#align_import analysis.calculus.local_extr from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
namespace Polynomial
theorem card_roots_toFinset_le_card_roots_derivative_diff_roots_succ (p : β[X]) :
p.roots.toFinset.card β€ (p.derivative.roots.toFinset \ p.roots.toFinset).card + 1 := by
rcases eq_or_ne (derivative p) 0 with hp' | hp'
Β· rw [eq_C_of_derivative_eq_zero hp', roots_C, Multiset.toFinset_zero, Finset.card_empty]
exact zero_le _
have hp : p β 0 := ne_of_apply_ne derivative (by rwa [derivative_zero])
refine Finset.card_le_diff_of_interleaved fun x hx y hy hxy hxy' => ?_
rw [Multiset.mem_toFinset, mem_roots hp] at hx hy
obtain β¨z, hz1, hz2β© := exists_deriv_eq_zero hxy p.continuousOn (hx.trans hy.symm)
refine β¨z, ?_, hz1β©
rwa [Multiset.mem_toFinset, mem_roots hp', IsRoot, β p.deriv]
#align polynomial.card_roots_to_finset_le_card_roots_derivative_diff_roots_succ Polynomial.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ
theorem card_roots_toFinset_le_derivative (p : β[X]) :
p.roots.toFinset.card β€ p.derivative.roots.toFinset.card + 1 :=
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ.trans <|
add_le_add_right (Finset.card_mono Finset.sdiff_subset) _
#align polynomial.card_roots_to_finset_le_derivative Polynomial.card_roots_toFinset_le_derivative
theorem card_roots_le_derivative (p : β[X]) :
Multiset.card p.roots β€ Multiset.card (derivative p).roots + 1 :=
calc
Multiset.card p.roots = β x β p.roots.toFinset, p.roots.count x :=
(Multiset.toFinset_sum_count_eq _).symm
_ = β x β p.roots.toFinset, (p.roots.count x - 1 + 1) :=
(Eq.symm <| Finset.sum_congr rfl fun x hx => tsub_add_cancel_of_le <|
Nat.succ_le_iff.2 <| Multiset.count_pos.2 <| Multiset.mem_toFinset.1 hx)
_ = (β x β p.roots.toFinset, (p.rootMultiplicity x - 1)) + p.roots.toFinset.card := by
simp only [Finset.sum_add_distrib, Finset.card_eq_sum_ones, count_roots]
_ β€ (β x β p.roots.toFinset, p.derivative.rootMultiplicity x) +
((p.derivative.roots.toFinset \ p.roots.toFinset).card + 1) :=
(add_le_add
(Finset.sum_le_sum fun x _ => rootMultiplicity_sub_one_le_derivative_rootMultiplicity _ _)
p.card_roots_toFinset_le_card_roots_derivative_diff_roots_succ)
_ β€ (β x β p.roots.toFinset, p.derivative.roots.count x) +
((β x β p.derivative.roots.toFinset \ p.roots.toFinset,
p.derivative.roots.count x) + 1) := by
simp only [β count_roots]
refine add_le_add_left (add_le_add_right ((Finset.card_eq_sum_ones _).trans_le ?_) _) _
refine Finset.sum_le_sum fun x hx => Nat.succ_le_iff.2 <| ?_
rw [Multiset.count_pos, β Multiset.mem_toFinset]
exact (Finset.mem_sdiff.1 hx).1
_ = Multiset.card (derivative p).roots + 1 := by
rw [β add_assoc, β Finset.sum_union Finset.disjoint_sdiff, Finset.union_sdiff_self_eq_union, β
Multiset.toFinset_sum_count_eq, β Finset.sum_subset Finset.subset_union_right]
intro x _ hxβ
simpa only [Multiset.mem_toFinset, Multiset.count_eq_zero] using hxβ
#align polynomial.card_roots_le_derivative Polynomial.card_roots_le_derivative
| Mathlib/Analysis/Calculus/LocalExtr/Polynomial.lean | 91 | 94 | theorem card_rootSet_le_derivative {F : Type*} [CommRing F] [Algebra F β] (p : F[X]) :
Fintype.card (p.rootSet β) β€ Fintype.card (p.derivative.rootSet β) + 1 := by |
simpa only [rootSet_def, Finset.coe_sort_coe, Fintype.card_coe, derivative_map] using
card_roots_toFinset_le_derivative (p.map (algebraMap F β))
| [
" p.roots.toFinset.card β€ ((derivative p).roots.toFinset \\ p.roots.toFinset).card + 1",
" 0 β€ ((derivative (C (p.coeff 0))).roots.toFinset \\ β
).card + 1",
" derivative p β derivative 0",
" β z β (derivative p).roots.toFinset, x < z β§ z < y",
" z β (derivative p).roots.toFinset",
" β x β p.roots.toFinset... | [
" p.roots.toFinset.card β€ ((derivative p).roots.toFinset \\ p.roots.toFinset).card + 1",
" 0 β€ ((derivative (C (p.coeff 0))).roots.toFinset \\ β
).card + 1",
" derivative p β derivative 0",
" β z β (derivative p).roots.toFinset, x < z β§ z < y",
" z β (derivative p).roots.toFinset",
" β x β p.roots.toFinset... |
import Mathlib.RingTheory.Polynomial.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import data.polynomial.expand from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
universe u v w
open Polynomial
open Finset
namespace Polynomial
section CommSemiring
variable (R : Type u) [CommSemiring R] {S : Type v} [CommSemiring S] (p q : β)
noncomputable def expand : R[X] ββ[R] R[X] :=
{ (evalβRingHom C (X ^ p) : R[X] β+* R[X]) with commutes' := fun _ => evalβ_C _ _ }
#align polynomial.expand Polynomial.expand
theorem coe_expand : (expand R p : R[X] β R[X]) = evalβ C (X ^ p) :=
rfl
#align polynomial.coe_expand Polynomial.coe_expand
variable {R}
theorem expand_eq_comp_X_pow {f : R[X]} : expand R p f = f.comp (X ^ p) := rfl
| Mathlib/Algebra/Polynomial/Expand.lean | 48 | 49 | theorem expand_eq_sum {f : R[X]} : expand R p f = f.sum fun e a => C a * (X ^ p) ^ e := by |
simp [expand, evalβ]
| [
" (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e"
] | [
" (expand R p) f = f.sum fun e a => C a * (X ^ p) ^ e"
] |
import Mathlib.Algebra.MonoidAlgebra.Basic
#align_import algebra.monoid_algebra.division from "leanprover-community/mathlib"@"72c366d0475675f1309d3027d3d7d47ee4423951"
variable {k G : Type*} [Semiring k]
namespace AddMonoidAlgebra
section
variable [AddCancelCommMonoid G]
noncomputable def divOf (x : k[G]) (g : G) : k[G] :=
-- note: comapping by `+ g` has the effect of subtracting `g` from every element in
-- the support, and discarding the elements of the support from which `g` can't be subtracted.
-- If `G` is an additive group, such as `β€` when used for `LaurentPolynomial`,
-- then no discarding occurs.
@Finsupp.comapDomain.addMonoidHom _ _ _ _ (g + Β·) (add_right_injective g) x
#align add_monoid_algebra.div_of AddMonoidAlgebra.divOf
local infixl:70 " /α΅αΆ " => divOf
@[simp]
theorem divOf_apply (g : G) (x : k[G]) (g' : G) : (x /α΅αΆ g) g' = x (g + g') :=
rfl
#align add_monoid_algebra.div_of_apply AddMonoidAlgebra.divOf_apply
@[simp]
theorem support_divOf (g : G) (x : k[G]) :
(x /α΅αΆ g).support =
x.support.preimage (g + Β·) (Function.Injective.injOn (add_right_injective g)) :=
rfl
#align add_monoid_algebra.support_div_of AddMonoidAlgebra.support_divOf
@[simp]
theorem zero_divOf (g : G) : (0 : k[G]) /α΅αΆ g = 0 :=
map_zero (Finsupp.comapDomain.addMonoidHom _)
#align add_monoid_algebra.zero_div_of AddMonoidAlgebra.zero_divOf
@[simp]
| Mathlib/Algebra/MonoidAlgebra/Division.lean | 77 | 79 | theorem divOf_zero (x : k[G]) : x /α΅αΆ 0 = x := by |
refine Finsupp.ext fun _ => ?_ -- Porting note: `ext` doesn't work
simp only [AddMonoidAlgebra.divOf_apply, zero_add]
| [
" x /α΅αΆ 0 = x",
" (x /α΅αΆ 0) xβ = x xβ"
] | [
" x /α΅αΆ 0 = x"
] |
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
| Mathlib/LinearAlgebra/AffineSpace/Slope.lean | 62 | 63 | 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]
| [
" slope f a a = 0",
" (b - a) β’ slope f a b = f b -α΅₯ f a",
" (a - a) β’ slope f a a = f a -α΅₯ f a",
" (b - a) β’ slope f a b +α΅₯ f a = f b"
] | [
" slope f a a = 0",
" (b - a) β’ slope f a b = f b -α΅₯ f a",
" (a - a) β’ slope f a a = f a -α΅₯ f a",
" (b - a) β’ slope f a b +α΅₯ f a = f b"
] |
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]
| Mathlib/Order/Interval/Set/OrderIso.lean | 58 | 59 | theorem preimage_Ioc (e : Ξ± βo Ξ²) (a b : Ξ²) : e β»ΒΉ' Ioc a b = Ioc (e.symm a) (e.symm b) := by |
simp [β Ioi_inter_Iic]
| [
" βe β»ΒΉ' Iic b = Iic (e.symm b)",
" x β βe β»ΒΉ' Iic b β x β Iic (e.symm b)",
" βe β»ΒΉ' Ici b = Ici (e.symm b)",
" x β βe β»ΒΉ' Ici b β x β Ici (e.symm b)",
" βe β»ΒΉ' Iio b = Iio (e.symm b)",
" x β βe β»ΒΉ' Iio b β x β Iio (e.symm b)",
" βe β»ΒΉ' Ioi b = Ioi (e.symm b)",
" x β βe β»ΒΉ' Ioi b β x β Ioi (e.symm b)"... | [
" βe β»ΒΉ' Iic b = Iic (e.symm b)",
" x β βe β»ΒΉ' Iic b β x β Iic (e.symm b)",
" βe β»ΒΉ' Ici b = Ici (e.symm b)",
" x β βe β»ΒΉ' Ici b β x β Ici (e.symm b)",
" βe β»ΒΉ' Iio b = Iio (e.symm b)",
" x β βe β»ΒΉ' Iio b β x β Iio (e.symm b)",
" βe β»ΒΉ' Ioi b = Ioi (e.symm b)",
" x β βe β»ΒΉ' Ioi b β x β Ioi (e.symm b)"... |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Bicategory.Coherence
namespace CategoryTheory
namespace Bicategory
open Category
open scoped Bicategory
open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp)
universe w v u
variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a βΆ b} {g : b βΆ a}
def leftZigzag (Ξ· : π a βΆ f β« g) (Ξ΅ : g β« f βΆ π b) :=
Ξ· β· f ββ« f β Ξ΅
def rightZigzag (Ξ· : π a βΆ f β« g) (Ξ΅ : g β« f βΆ π b) :=
g β Ξ· ββ« Ξ΅ β· g
theorem rightZigzag_idempotent_of_left_triangle
(Ξ· : π a βΆ f β« g) (Ξ΅ : g β« f βΆ π b) (h : leftZigzag Ξ· Ξ΅ = (Ξ»_ _).hom β« (Ο_ _).inv) :
rightZigzag Ξ· Ξ΅ ββ« rightZigzag Ξ· Ξ΅ = rightZigzag Ξ· Ξ΅ := by
dsimp only [rightZigzag]
calc
_ = g β Ξ· ββ« ((Ξ΅ β· g β· π a) β« (π b β« g) β Ξ·) ββ« Ξ΅ β· g := by
simp [bicategoricalComp]; coherence
_ = π _ ββ« g β (Ξ· β· π a β« (f β« g) β Ξ·) ββ« (Ξ΅ β· (g β« f) β« π b β Ξ΅) β· g ββ« π _ := by
rw [β whisker_exchange]; simp [bicategoricalComp]; coherence
_ = g β Ξ· ββ« g β leftZigzag Ξ· Ξ΅ β· g ββ« Ξ΅ β· g := by
rw [β whisker_exchange, β whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence
_ = g β Ξ· ββ« Ξ΅ β· g := by
rw [h]; simp [bicategoricalComp]; coherence
structure Adjunction (f : a βΆ b) (g : b βΆ a) where
unit : π a βΆ f β« g
counit : g β« f βΆ π b
left_triangle : leftZigzag unit counit = (Ξ»_ _).hom β« (Ο_ _).inv := by aesop_cat
right_triangle : rightZigzag unit counit = (Ο_ _).hom β« (Ξ»_ _).inv := by aesop_cat
@[inherit_doc] scoped infixr:15 " β£ " => Bicategory.Adjunction
namespace Adjunction
attribute [simp] left_triangle right_triangle
attribute [local simp] leftZigzag rightZigzag
def id (a : B) : π a β£ π a where
unit := (Ο_ _).inv
counit := (Ο_ _).hom
left_triangle := by dsimp; coherence
right_triangle := by dsimp; coherence
instance : Inhabited (Adjunction (π a) (π a)) :=
β¨id aβ©
noncomputable section
variable (Ξ· : π a β
f β« g) (Ξ΅ : g β« f β
π b)
def leftZigzagIso (Ξ· : π a β
f β« g) (Ξ΅ : g β« f β
π b) :=
whiskerRightIso Ξ· f βͺββ« whiskerLeftIso f Ξ΅
def rightZigzagIso (Ξ· : π a β
f β« g) (Ξ΅ : g β« f β
π b) :=
whiskerLeftIso g Ξ· βͺββ« whiskerRightIso Ξ΅ g
attribute [local simp] leftZigzagIso rightZigzagIso leftZigzag rightZigzag
@[simp]
theorem leftZigzagIso_hom : (leftZigzagIso Ξ· Ξ΅).hom = leftZigzag Ξ·.hom Ξ΅.hom :=
rfl
@[simp]
theorem rightZigzagIso_hom : (rightZigzagIso Ξ· Ξ΅).hom = rightZigzag Ξ·.hom Ξ΅.hom :=
rfl
@[simp]
theorem leftZigzagIso_inv : (leftZigzagIso Ξ· Ξ΅).inv = rightZigzag Ξ΅.inv Ξ·.inv := by
simp [bicategoricalComp, bicategoricalIsoComp]
@[simp]
| Mathlib/CategoryTheory/Bicategory/Adjunction.lean | 205 | 206 | theorem rightZigzagIso_inv : (rightZigzagIso Ξ· Ξ΅).inv = leftZigzag Ξ΅.inv Ξ·.inv := by |
simp [bicategoricalComp, bicategoricalIsoComp]
| [
" rightZigzag Ξ· Ξ΅ ββ« rightZigzag Ξ· Ξ΅ = rightZigzag Ξ· Ξ΅",
" (g β Ξ· ββ« Ξ΅ β· g) ββ« g β Ξ· ββ« Ξ΅ β· g = g β Ξ· ββ« Ξ΅ β· g",
" (g β Ξ· ββ« Ξ΅ β· g) ββ« g β Ξ· ββ« Ξ΅ β· g = g β Ξ· ββ« (Ξ΅ β· g β· π a β« (π b β« g) β Ξ·) ββ« Ξ΅ β· g",
" g β Ξ· β« (Ξ±_ g f g).inv β« Ξ΅ β· g β« (Ξ»_ g).hom β« (Ο_ g).inv β« g β Ξ· β« (Ξ±_ g f g).inv β« Ξ΅ β· g =\n g β Ξ· β«... | [
" rightZigzag Ξ· Ξ΅ ββ« rightZigzag Ξ· Ξ΅ = rightZigzag Ξ· Ξ΅",
" (g β Ξ· ββ« Ξ΅ β· g) ββ« g β Ξ· ββ« Ξ΅ β· g = g β Ξ· ββ« Ξ΅ β· g",
" (g β Ξ· ββ« Ξ΅ β· g) ββ« g β Ξ· ββ« Ξ΅ β· g = g β Ξ· ββ« (Ξ΅ β· g β· π a β« (π b β« g) β Ξ·) ββ« Ξ΅ β· g",
" g β Ξ· β« (Ξ±_ g f g).inv β« Ξ΅ β· g β« (Ξ»_ g).hom β« (Ο_ g).inv β« g β Ξ· β« (Ξ±_ g f g).inv β« Ξ΅ β· g =\n g β Ξ· β«... |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {π : Type*} [NontriviallyNormedField π] {E : Type*} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type*} [NormedAddCommGroup F] [NormedSpace π F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace π G]
structure IsBoundedLinearMap (π : Type*) [NormedField π] {E : Type*} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type*} [NormedAddCommGroup F] [NormedSpace π F] (f : E β F) extends
IsLinearMap π f : Prop where
bound : β M, 0 < M β§ β x : E, βf xβ β€ M * βxβ
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E β F} (hf : IsLinearMap π f) (M : β)
(h : β x : E, βf xβ β€ M * βxβ) : IsBoundedLinearMap π f :=
β¨hf,
by_cases
(fun (this : M β€ 0) =>
β¨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)β©)
fun (this : Β¬M β€ 0) => β¨M, lt_of_not_ge this, hβ©β©
#align is_linear_map.with_bound IsLinearMap.with_bound
theorem ContinuousLinearMap.isBoundedLinearMap (f : E βL[π] F) : IsBoundedLinearMap π f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
section
variable {ΞΉ : Type*} [Fintype ΞΉ]
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 217 | 231 | theorem isBoundedLinearMap_prod_multilinear {E : ΞΉ β Type*} [β i, NormedAddCommGroup (E i)]
[β i, NormedSpace π (E i)] :
IsBoundedLinearMap π fun p : ContinuousMultilinearMap π E F Γ ContinuousMultilinearMap π E G =>
p.1.prod p.2 where
map_add pβ pβ := by | ext : 1; rfl
map_smul c p := by ext : 1; rfl
bound := by
refine β¨1, zero_lt_one, fun p β¦ ?_β©
rw [one_mul]
apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _
intro m
rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff]
constructor
Β· exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity)
Β· exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity)
| [
" (pβ + pβ).1.prod (pβ + pβ).2 = pβ.1.prod pβ.2 + pβ.1.prod pβ.2",
" ((pβ + pβ).1.prod (pβ + pβ).2) xβ = (pβ.1.prod pβ.2 + pβ.1.prod pβ.2) xβ",
" (c β’ p).1.prod (c β’ p).2 = c β’ p.1.prod p.2",
" ((c β’ p).1.prod (c β’ p).2) xβ = (c β’ p.1.prod p.2) xβ",
" β M, 0 < M β§ β (x : ContinuousMultilinearMap π E F Γ Co... | [
" (pβ + pβ).1.prod (pβ + pβ).2 = pβ.1.prod pβ.2 + pβ.1.prod pβ.2"
] |
import Mathlib.AlgebraicGeometry.OpenImmersion
import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact
import Mathlib.CategoryTheory.MorphismProperty.Composition
import Mathlib.RingTheory.LocalProperties
universe v u
open CategoryTheory
namespace AlgebraicGeometry
class IsClosedImmersion {X Y : Scheme} (f : X βΆ Y) : Prop where
base_closed : ClosedEmbedding f.1.base
surj_on_stalks : β x, Function.Surjective (PresheafedSpace.stalkMap f.1 x)
namespace IsClosedImmersion
lemma closedEmbedding {X Y : Scheme} (f : X βΆ Y)
[IsClosedImmersion f] : ClosedEmbedding f.1.base :=
IsClosedImmersion.base_closed
lemma surjective_stalkMap {X Y : Scheme} (f : X βΆ Y)
[IsClosedImmersion f] (x : X) : Function.Surjective (PresheafedSpace.stalkMap f.1 x) :=
IsClosedImmersion.surj_on_stalks x
instance {X Y : Scheme} (f : X βΆ Y) [IsIso f] : IsClosedImmersion f where
base_closed := Homeomorph.closedEmbedding <| TopCat.homeoOfIso (asIso f.1.base)
surj_on_stalks := fun _ β¦ (ConcreteCategory.bijective_of_isIso _).2
instance : MorphismProperty.IsMultiplicative @IsClosedImmersion where
id_mem _ := inferInstance
comp_mem {X Y Z} f g hf hg := by
refine β¨hg.base_closed.comp hf.base_closed, fun x β¦ ?_β©
erw [PresheafedSpace.stalkMap.comp]
exact (hf.surj_on_stalks x).comp (hg.surj_on_stalks (f.1.1 x))
instance comp {X Y Z : Scheme} (f : X βΆ Y) (g : Y βΆ Z) [IsClosedImmersion f]
[IsClosedImmersion g] : IsClosedImmersion (f β« g) :=
MorphismProperty.IsStableUnderComposition.comp_mem f g inferInstance inferInstance
lemma respectsIso : MorphismProperty.RespectsIso @IsClosedImmersion := by
constructor <;> intro X Y Z e f hf <;> infer_instance
| Mathlib/AlgebraicGeometry/Morphisms/ClosedImmersion.lean | 79 | 89 | theorem spec_of_surjective {R S : CommRingCat} (f : R βΆ S) (h : Function.Surjective f) :
IsClosedImmersion (Scheme.specMap f) where
base_closed := PrimeSpectrum.closedEmbedding_comap_of_surjective _ _ h
surj_on_stalks x := by |
erw [β localRingHom_comp_stalkIso, CommRingCat.coe_comp, CommRingCat.coe_comp]
apply Function.Surjective.comp (Function.Surjective.comp _ _) _
Β· exact (ConcreteCategory.bijective_of_isIso (StructureSheaf.stalkIso S x).inv).2
Β· exact surjective_localRingHom_of_surjective f h x.asIdeal
Β· let g := (StructureSheaf.stalkIso ((CommRingCat.of R))
((PrimeSpectrum.comap (CommRingCat.ofHom f)) x)).hom
exact (ConcreteCategory.bijective_of_isIso g).2
| [
" IsClosedImmersion (f β« g)",
" Function.Surjective β(PresheafedSpace.stalkMap (f β« g).val x)",
" Function.Surjective β(PresheafedSpace.stalkMap g.val (f.val.base x) β« PresheafedSpace.stalkMap f.val x)",
" MorphismProperty.RespectsIso @IsClosedImmersion",
" β {X Y Z : Scheme} (e : X β
Y) (f : Y βΆ Z), IsClos... | [
" IsClosedImmersion (f β« g)",
" Function.Surjective β(PresheafedSpace.stalkMap (f β« g).val x)",
" Function.Surjective β(PresheafedSpace.stalkMap g.val (f.val.base x) β« PresheafedSpace.stalkMap f.val x)",
" MorphismProperty.RespectsIso @IsClosedImmersion",
" β {X Y Z : Scheme} (e : X β
Y) (f : Y βΆ Z), IsClos... |
import Mathlib.FieldTheory.PrimitiveElement
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly
import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.Galois
#align_import ring_theory.norm from "leanprover-community/mathlib"@"fecd3520d2a236856f254f27714b80dcfe28ea57"
universe u v w
variable {R S T : Type*} [CommRing R] [Ring S]
variable [Algebra R S]
variable {K L F : Type*} [Field K] [Field L] [Field F]
variable [Algebra K L] [Algebra K F]
variable {ΞΉ : Type w}
open FiniteDimensional
open LinearMap
open Matrix Polynomial
open scoped Matrix
namespace Algebra
variable (R)
noncomputable def norm : S β* R :=
LinearMap.det.comp (lmul R S).toRingHom.toMonoidHom
#align algebra.norm Algebra.norm
theorem norm_apply (x : S) : norm R x = LinearMap.det (lmul R S x) := rfl
#align algebra.norm_apply Algebra.norm_apply
theorem norm_eq_one_of_not_exists_basis (h : Β¬β s : Finset S, Nonempty (Basis s R S)) (x : S) :
norm R x = 1 := by rw [norm_apply, LinearMap.det]; split_ifs <;> trivial
#align algebra.norm_eq_one_of_not_exists_basis Algebra.norm_eq_one_of_not_exists_basis
variable {R}
theorem norm_eq_one_of_not_module_finite (h : Β¬Module.Finite R S) (x : S) : norm R x = 1 := by
refine norm_eq_one_of_not_exists_basis _ (mt ?_ h) _
rintro β¨s, β¨bβ©β©
exact Module.Finite.of_basis b
#align algebra.norm_eq_one_of_not_module_finite Algebra.norm_eq_one_of_not_module_finite
-- Can't be a `simp` lemma because it depends on a choice of basis
theorem norm_eq_matrix_det [Fintype ΞΉ] [DecidableEq ΞΉ] (b : Basis ΞΉ R S) (s : S) :
norm R s = Matrix.det (Algebra.leftMulMatrix b s) := by
rw [norm_apply, β LinearMap.det_toMatrix b, β toMatrix_lmul_eq]; rfl
#align algebra.norm_eq_matrix_det Algebra.norm_eq_matrix_det
theorem norm_algebraMap_of_basis [Fintype ΞΉ] (b : Basis ΞΉ R S) (x : R) :
norm R (algebraMap R S x) = x ^ Fintype.card ΞΉ := by
haveI := Classical.decEq ΞΉ
rw [norm_apply, β det_toMatrix b, lmul_algebraMap]
convert @det_diagonal _ _ _ _ _ fun _ : ΞΉ => x
Β· ext (i j); rw [toMatrix_lsmul]
Β· rw [Finset.prod_const, Finset.card_univ]
#align algebra.norm_algebra_map_of_basis Algebra.norm_algebraMap_of_basis
@[simp]
protected theorem norm_algebraMap {L : Type*} [Ring L] [Algebra K L] (x : K) :
norm K (algebraMap K L x) = x ^ finrank K L := by
by_cases H : β s : Finset L, Nonempty (Basis s K L)
Β· rw [norm_algebraMap_of_basis H.choose_spec.some, finrank_eq_card_basis H.choose_spec.some]
Β· rw [norm_eq_one_of_not_exists_basis K H, finrank_eq_zero_of_not_exists_basis, pow_zero]
rintro β¨s, β¨bβ©β©
exact H β¨s, β¨bβ©β©
#align algebra.norm_algebra_map Algebra.norm_algebraMap
section EqProdRoots
| Mathlib/RingTheory/Norm.lean | 118 | 121 | theorem PowerBasis.norm_gen_eq_coeff_zero_minpoly (pb : PowerBasis R S) :
norm R pb.gen = (-1) ^ pb.dim * coeff (minpoly R pb.gen) 0 := by |
rw [norm_eq_matrix_det pb.basis, det_eq_sign_charpoly_coeff, charpoly_leftMulMatrix,
Fintype.card_fin]
| [
" (norm R) x = 1",
" (if H : β s, Nonempty (Basis { x // x β s } R S) then detAux (Trunc.mk β―.some) else 1) ((lmul R S) x) = 1",
" (detAux (Trunc.mk β―.some)) ((lmul R S) x) = 1",
" 1 ((lmul R S) x) = 1",
" (β s, Nonempty (Basis { x // x β s } R S)) β Module.Finite R S",
" Module.Finite R S",
" (norm R) ... | [
" (norm R) x = 1",
" (if H : β s, Nonempty (Basis { x // x β s } R S) then detAux (Trunc.mk β―.some) else 1) ((lmul R S) x) = 1",
" (detAux (Trunc.mk β―.some)) ((lmul R S) x) = 1",
" 1 ((lmul R S) x) = 1",
" (β s, Nonempty (Basis { x // x β s } R S)) β Module.Finite R S",
" Module.Finite R S",
" (norm R) ... |
import Batteries.Data.RBMap.Basic
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Mathport.Rename
import Mathlib.Tactic.TypeStar
import Mathlib.Util.CompileInductive
#align_import data.tree from "leanprover-community/mathlib"@"ed989ff568099019c6533a4d94b27d852a5710d8"
inductive Tree.{u} (Ξ± : Type u) : Type u
| nil : Tree Ξ±
| node : Ξ± β Tree Ξ± β Tree Ξ± β Tree Ξ±
deriving DecidableEq, Repr -- Porting note: Removed `has_reflect`, added `Repr`.
#align tree Tree
namespace Tree
universe u
variable {Ξ± : Type u}
-- Porting note: replaced with `deriving Repr` which builds a better instance anyway
#noalign tree.repr
instance : Inhabited (Tree Ξ±) :=
β¨nilβ©
open Batteries (RBNode)
def ofRBNode : RBNode Ξ± β Tree Ξ±
| RBNode.nil => nil
| RBNode.node _color l key r => node key (ofRBNode l) (ofRBNode r)
#align tree.of_rbnode Tree.ofRBNode
def map {Ξ²} (f : Ξ± β Ξ²) : Tree Ξ± β Tree Ξ²
| nil => nil
| node a l r => node (f a) (map f l) (map f r)
#align tree.map Tree.map
@[simp]
def numNodes : Tree Ξ± β β
| nil => 0
| node _ a b => a.numNodes + b.numNodes + 1
#align tree.num_nodes Tree.numNodes
@[simp]
def numLeaves : Tree Ξ± β β
| nil => 1
| node _ a b => a.numLeaves + b.numLeaves
#align tree.num_leaves Tree.numLeaves
@[simp]
def height : Tree Ξ± β β
| nil => 0
| node _ a b => max a.height b.height + 1
#align tree.height Tree.height
theorem numLeaves_eq_numNodes_succ (x : Tree Ξ±) : x.numLeaves = x.numNodes + 1 := by
induction x <;> simp [*, Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
#align tree.num_leaves_eq_num_nodes_succ Tree.numLeaves_eq_numNodes_succ
| Mathlib/Data/Tree/Basic.lean | 94 | 96 | theorem numLeaves_pos (x : Tree Ξ±) : 0 < x.numLeaves := by |
rw [numLeaves_eq_numNodes_succ]
exact x.numNodes.zero_lt_succ
| [
" x.numLeaves = x.numNodes + 1",
" nil.numLeaves = nil.numNodes + 1",
" (node aβΒ² aβΒΉ aβ).numLeaves = (node aβΒ² aβΒΉ aβ).numNodes + 1",
" 0 < x.numLeaves",
" 0 < x.numNodes + 1"
] | [
" x.numLeaves = x.numNodes + 1",
" nil.numLeaves = nil.numNodes + 1",
" (node aβΒ² aβΒΉ aβ).numLeaves = (node aβΒ² aβΒΉ aβ).numNodes + 1",
" 0 < x.numLeaves"
] |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Mul
import Mathlib.Analysis.Calculus.FDeriv.Add
#align_import analysis.calculus.deriv.mul from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
noncomputable section
open scoped Classical Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {π : Type u} [NontriviallyNormedField π]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace π F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace π E]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace π G]
variable {f fβ fβ g : π β F}
variable {f' fβ' fβ' g' : F}
variable {x : π}
variable {s t : Set π}
variable {L Lβ Lβ : Filter π}
section SMul
variable {π' : Type*} [NontriviallyNormedField π'] [NormedAlgebra π π'] [NormedSpace π' F]
[IsScalarTower π π' F] {c : π β π'} {c' : π'}
| Mathlib/Analysis/Calculus/Deriv/Mul.lean | 87 | 89 | theorem HasDerivWithinAt.smul (hc : HasDerivWithinAt c c' s x) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (fun y => c y β’ f y) (c x β’ f' + c' β’ f x) s x := by |
simpa using (HasFDerivWithinAt.smul hc hf).hasDerivWithinAt
| [
" HasDerivWithinAt (fun y => c y β’ f y) (c x β’ f' + c' β’ f x) s x"
] | [
" HasDerivWithinAt (fun y => c y β’ f y) (c x β’ f' + c' β’ f x) s x"
] |
import Mathlib.Data.Set.Lattice
#align_import data.set.accumulate from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
variable {Ξ± Ξ² Ξ³ : Type*} {s : Ξ± β Set Ξ²} {t : Ξ± β Set Ξ³}
namespace Set
def Accumulate [LE Ξ±] (s : Ξ± β Set Ξ²) (x : Ξ±) : Set Ξ² :=
β y β€ x, s y
#align set.accumulate Set.Accumulate
theorem accumulate_def [LE Ξ±] {x : Ξ±} : Accumulate s x = β y β€ x, s y :=
rfl
#align set.accumulate_def Set.accumulate_def
@[simp]
theorem mem_accumulate [LE Ξ±] {x : Ξ±} {z : Ξ²} : z β Accumulate s x β β y β€ x, z β s y := by
simp_rw [accumulate_def, mem_iUnionβ, exists_prop]
#align set.mem_accumulate Set.mem_accumulate
theorem subset_accumulate [Preorder Ξ±] {x : Ξ±} : s x β Accumulate s x := fun _ => mem_biUnion le_rfl
#align set.subset_accumulate Set.subset_accumulate
theorem accumulate_subset_iUnion [Preorder Ξ±] (x : Ξ±) : Accumulate s x β β i, s i :=
(biUnion_subset_biUnion_left (subset_univ _)).trans_eq (biUnion_univ _)
theorem monotone_accumulate [Preorder Ξ±] : Monotone (Accumulate s) := fun _ _ hxy =>
biUnion_subset_biUnion_left fun _ hz => le_trans hz hxy
#align set.monotone_accumulate Set.monotone_accumulate
@[gcongr]
theorem accumulate_subset_accumulate [Preorder Ξ±] {x y} (h : x β€ y) :
Accumulate s x β Accumulate s y :=
monotone_accumulate h
theorem biUnion_accumulate [Preorder Ξ±] (x : Ξ±) : β y β€ x, Accumulate s y = β y β€ x, s y := by
apply Subset.antisymm
Β· exact iUnionβ_subset fun y hy => monotone_accumulate hy
Β· exact iUnionβ_mono fun y _ => subset_accumulate
#align set.bUnion_accumulate Set.biUnion_accumulate
| Mathlib/Data/Set/Accumulate.lean | 56 | 61 | theorem iUnion_accumulate [Preorder Ξ±] : β x, Accumulate s x = β x, s x := by |
apply Subset.antisymm
Β· simp only [subset_def, mem_iUnion, exists_imp, mem_accumulate]
intro z x x' β¨_, hzβ©
exact β¨x', hzβ©
Β· exact iUnion_mono fun i => subset_accumulate
| [
" z β Accumulate s x β β y β€ x, z β s y",
" β y, β (_ : y β€ x), Accumulate s y = β y, β (_ : y β€ x), s y",
" β y, β (_ : y β€ x), Accumulate s y β β y, β (_ : y β€ x), s y",
" β y, β (_ : y β€ x), s y β β y, β (_ : y β€ x), Accumulate s y",
" β x, Accumulate s x = β x, s x",
" β x, Accumulate s x β β x, s x",... | [
" z β Accumulate s x β β y β€ x, z β s y",
" β y, β (_ : y β€ x), Accumulate s y = β y, β (_ : y β€ x), s y",
" β y, β (_ : y β€ x), Accumulate s y β β y, β (_ : y β€ x), s y",
" β y, β (_ : y β€ x), s y β β y, β (_ : y β€ x), Accumulate s y",
" β x, Accumulate s x = β x, s x"
] |
import Mathlib.CategoryTheory.EpiMono
import Mathlib.CategoryTheory.Functor.FullyFaithful
import Mathlib.Tactic.PPWithUniv
import Mathlib.Data.Set.Defs
#align_import category_theory.types from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
namespace CategoryTheory
-- morphism levels before object levels. See note [CategoryTheory universes].
universe v v' w u u'
@[to_additive existing CategoryTheory.types]
instance types : LargeCategory (Type u) where
Hom a b := a β b
id a := id
comp f g := g β f
#align category_theory.types CategoryTheory.types
theorem types_hom {Ξ± Ξ² : Type u} : (Ξ± βΆ Ξ²) = (Ξ± β Ξ²) :=
rfl
#align category_theory.types_hom CategoryTheory.types_hom
-- porting note (#10688): this lemma was not here in Lean 3. Lean 3 `ext` would solve this goal
-- because of its "if all else fails, apply all `ext` lemmas" policy,
-- which apparently we want to move away from.
@[ext] theorem types_ext {Ξ± Ξ² : Type u} (f g : Ξ± βΆ Ξ²) (h : β a : Ξ±, f a = g a) : f = g := by
funext x
exact h x
theorem types_id (X : Type u) : π X = id :=
rfl
#align category_theory.types_id CategoryTheory.types_id
theorem types_comp {X Y Z : Type u} (f : X βΆ Y) (g : Y βΆ Z) : f β« g = g β f :=
rfl
#align category_theory.types_comp CategoryTheory.types_comp
@[simp]
theorem types_id_apply (X : Type u) (x : X) : (π X : X β X) x = x :=
rfl
#align category_theory.types_id_apply CategoryTheory.types_id_apply
@[simp]
theorem types_comp_apply {X Y Z : Type u} (f : X βΆ Y) (g : Y βΆ Z) (x : X) : (f β« g) x = g (f x) :=
rfl
#align category_theory.types_comp_apply CategoryTheory.types_comp_apply
@[simp]
theorem hom_inv_id_apply {X Y : Type u} (f : X β
Y) (x : X) : f.inv (f.hom x) = x :=
congr_fun f.hom_inv_id x
#align category_theory.hom_inv_id_apply CategoryTheory.hom_inv_id_apply
@[simp]
theorem inv_hom_id_apply {X Y : Type u} (f : X β
Y) (y : Y) : f.hom (f.inv y) = y :=
congr_fun f.inv_hom_id y
#align category_theory.inv_hom_id_apply CategoryTheory.inv_hom_id_apply
-- Unfortunately without this wrapper we can't use `CategoryTheory` idioms, such as `IsIso f`.
abbrev asHom {Ξ± Ξ² : Type u} (f : Ξ± β Ξ²) : Ξ± βΆ Ξ² :=
f
#align category_theory.as_hom CategoryTheory.asHom
@[inherit_doc]
scoped notation "βΎ" f:200 => CategoryTheory.asHom f
section
-- We verify the expected type checking behaviour of `asHom`
variable (Ξ± Ξ² Ξ³ : Type u) (f : Ξ± β Ξ²) (g : Ξ² β Ξ³)
example : Ξ± β Ξ³ :=
βΎf β« βΎg
example [IsIso (βΎf)] : Mono (βΎf) := by infer_instance
example [IsIso (βΎf)] : βΎf β« inv (βΎf) = π Ξ± := by simp
end
namespace FunctorToTypes
variable {C : Type u} [Category.{v} C] (F G H : C β₯€ Type w) {X Y Z : C}
variable (Ο : F βΆ G) (Ο : G βΆ H)
@[simp]
theorem map_comp_apply (f : X βΆ Y) (g : Y βΆ Z) (a : F.obj X) :
(F.map (f β« g)) a = (F.map g) ((F.map f) a) := by simp [types_comp]
#align category_theory.functor_to_types.map_comp_apply CategoryTheory.FunctorToTypes.map_comp_apply
@[simp]
theorem map_id_apply (a : F.obj X) : (F.map (π X)) a = a := by simp [types_id]
#align category_theory.functor_to_types.map_id_apply CategoryTheory.FunctorToTypes.map_id_apply
theorem naturality (f : X βΆ Y) (x : F.obj X) : Ο.app Y ((F.map f) x) = (G.map f) (Ο.app X x) :=
congr_fun (Ο.naturality f) x
#align category_theory.functor_to_types.naturality CategoryTheory.FunctorToTypes.naturality
@[simp]
theorem comp (x : F.obj X) : (Ο β« Ο).app X x = Ο.app X (Ο.app X x) :=
rfl
#align category_theory.functor_to_types.comp CategoryTheory.FunctorToTypes.comp
@[simp]
| Mathlib/CategoryTheory/Types.lean | 170 | 172 | theorem eqToHom_map_comp_apply (p : X = Y) (q : Y = Z) (x : F.obj X) :
F.map (eqToHom q) (F.map (eqToHom p) x) = F.map (eqToHom <| p.trans q) x := by |
aesop_cat
| [
" f = g",
" f x = g x",
" Mono (βΎf)",
" βΎf β« inv (βΎf) = π Ξ±",
" F.map (f β« g) a = F.map g (F.map f a)",
" F.map (π X) a = a",
" F.map (eqToHom q) (F.map (eqToHom p) x) = F.map (eqToHom β―) x"
] | [
" f = g",
" f x = g x",
" Mono (βΎf)",
" βΎf β« inv (βΎf) = π Ξ±",
" F.map (f β« g) a = F.map g (F.map f a)",
" F.map (π X) a = a",
" F.map (eqToHom q) (F.map (eqToHom p) x) = F.map (eqToHom β―) x"
] |
import Mathlib.Data.Matrix.Basis
import Mathlib.RingTheory.TensorProduct.Basic
#align_import ring_theory.matrix_algebra from "leanprover-community/mathlib"@"6c351a8fb9b06e5a542fdf427bfb9f46724f9453"
suppress_compilation
universe u v w
open TensorProduct
open TensorProduct
open Algebra.TensorProduct
open Matrix
variable {R : Type u} [CommSemiring R]
variable {A : Type v} [Semiring A] [Algebra R A]
variable {n : Type w}
variable (R A n)
namespace MatrixEquivTensor
def toFunBilinear : A ββ[R] Matrix n n R ββ[R] Matrix n n A :=
(Algebra.lsmul R R (Matrix n n A)).toLinearMap.complβ (Algebra.linearMap R A).mapMatrix
#align matrix_equiv_tensor.to_fun_bilinear MatrixEquivTensor.toFunBilinear
@[simp]
theorem toFunBilinear_apply (a : A) (m : Matrix n n R) :
toFunBilinear R A n a m = a β’ m.map (algebraMap R A) :=
rfl
#align matrix_equiv_tensor.to_fun_bilinear_apply MatrixEquivTensor.toFunBilinear_apply
def toFunLinear : A β[R] Matrix n n R ββ[R] Matrix n n A :=
TensorProduct.lift (toFunBilinear R A n)
#align matrix_equiv_tensor.to_fun_linear MatrixEquivTensor.toFunLinear
variable [DecidableEq n] [Fintype n]
def toFunAlgHom : A β[R] Matrix n n R ββ[R] Matrix n n A :=
algHomOfLinearMapTensorProduct (toFunLinear R A n)
(by
intros
simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul]
ext
dsimp
simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum,
_root_.mul_assoc, Algebra.left_comm])
(by
simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply,
Matrix.map_one (algebraMap R A) (map_zero _) (map_one _), one_smul])
#align matrix_equiv_tensor.to_fun_alg_hom MatrixEquivTensor.toFunAlgHom
@[simp]
theorem toFunAlgHom_apply (a : A) (m : Matrix n n R) :
toFunAlgHom R A n (a ββ m) = a β’ m.map (algebraMap R A) := rfl
#align matrix_equiv_tensor.to_fun_alg_hom_apply MatrixEquivTensor.toFunAlgHom_apply
def invFun (M : Matrix n n A) : A β[R] Matrix n n R :=
β p : n Γ n, M p.1 p.2 ββ stdBasisMatrix p.1 p.2 1
#align matrix_equiv_tensor.inv_fun MatrixEquivTensor.invFun
@[simp]
theorem invFun_zero : invFun R A n 0 = 0 := by simp [invFun]
#align matrix_equiv_tensor.inv_fun_zero MatrixEquivTensor.invFun_zero
@[simp]
theorem invFun_add (M N : Matrix n n A) :
invFun R A n (M + N) = invFun R A n M + invFun R A n N := by
simp [invFun, add_tmul, Finset.sum_add_distrib]
#align matrix_equiv_tensor.inv_fun_add MatrixEquivTensor.invFun_add
@[simp]
theorem invFun_smul (a : A) (M : Matrix n n A) :
invFun R A n (a β’ M) = a ββ 1 * invFun R A n M := by
simp [invFun, Finset.mul_sum]
#align matrix_equiv_tensor.inv_fun_smul MatrixEquivTensor.invFun_smul
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ββ M := by
dsimp [invFun]
simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, β tmul_sum, mul_boole]
congr
conv_rhs => rw [matrix_eq_sum_std_basis M]
convert Finset.sum_product (Ξ² := Matrix n n R); simp
#align matrix_equiv_tensor.inv_fun_algebra_map MatrixEquivTensor.invFun_algebraMap
| Mathlib/RingTheory/MatrixAlgebra.lean | 113 | 121 | theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by |
simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite β(algebraMap R A), smul_eq_mul,
mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
Pi.smul_def]
convert Finset.sum_product (Ξ² := Matrix n n A)
conv_lhs => rw [matrix_eq_sum_std_basis M]
refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
simp only [stdBasisMatrix, smul_apply, Matrix.map_apply]
split_ifs <;> aesop
| [
" β (aβ aβ : A) (bβ bβ : Matrix n n R),\n (toFunLinear R A n) ((aβ * aβ) ββ[R] (bβ * bβ)) =\n (toFunLinear R A n) (aβ ββ[R] bβ) * (toFunLinear R A n) (aβ ββ[R] bβ)",
" (toFunLinear R A n) ((aββ * aββ) ββ[R] (bββ * bββ)) =\n (toFunLinear R A n) (aββ ββ[R] bββ) * (toFunLinear R A n) (aββ ββ[R] bββ)",
"... | [
" β (aβ aβ : A) (bβ bβ : Matrix n n R),\n (toFunLinear R A n) ((aβ * aβ) ββ[R] (bβ * bβ)) =\n (toFunLinear R A n) (aβ ββ[R] bβ) * (toFunLinear R A n) (aβ ββ[R] bβ)",
" (toFunLinear R A n) ((aββ * aββ) ββ[R] (bββ * bββ)) =\n (toFunLinear R A n) (aββ ββ[R] bββ) * (toFunLinear R A n) (aββ ββ[R] bββ)",
"... |
import Mathlib.Tactic.Linarith.Datatypes
import Mathlib.Tactic.Zify
import Mathlib.Tactic.CancelDenoms.Core
import Batteries.Data.RBMap.Basic
import Mathlib.Data.HashMap
import Mathlib.Control.Basic
set_option autoImplicit true
namespace Linarith
open Lean hiding Rat
open Elab Tactic Meta
open Qq
partial def splitConjunctions : Preprocessor where
name := "split conjunctions"
transform := aux
where
aux (proof : Expr) : MetaM (List Expr) := do
match (β instantiateMVars (β inferType proof)).getAppFnArgs with
| (``And, #[_, _]) =>
pure ((β aux (β mkAppM ``And.left #[proof])) ++
(β aux (β mkAppM ``And.right #[proof])))
| _ => pure [proof]
partial def filterComparisons : Preprocessor where
name := "filter terms that are not proofs of comparisons"
transform h := do
let tp β whnfR (β instantiateMVars (β inferType h))
if (β isProp tp) && (β aux tp) then pure [h]
else pure []
where
aux (e : Expr) : MetaM Bool := do
match e.getAppFnArgs with
| (``Eq, _) | (``LE.le, _) | (``LT.lt, _) => pure true
| (``Not, #[e]) => match (β whnfR e).getAppFnArgs with
| (``LE.le, _) | (``LT.lt, _) => pure true
| _ => pure false
| _ => pure false
section cancelDenoms
| Mathlib/Tactic/Linarith/Preprocessing.lean | 273 | 273 | theorem without_one_mul [MulOneClass M] {a b : M} (h : 1 * a = b) : a = b := by | rwa [one_mul] at h
| [
" a = b"
] | [
" a = b"
] |
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.Filter.CountableInter
import Mathlib.Order.Filter.CardinalInter
import Mathlib.SetTheory.Cardinal.Ordinal
import Mathlib.SetTheory.Cardinal.Cofinality
import Mathlib.Order.Filter.Bases
open Set Filter Cardinal
universe u
variable {ΞΉ : Type u} {Ξ± Ξ² : Type u}
variable {c : Cardinal.{u}} {hreg : c.IsRegular}
variable {l : Filter Ξ±}
namespace Filter
variable (Ξ±) in
def cocardinal (hreg : c.IsRegular) : Filter Ξ± := by
apply ofCardinalUnion {s | Cardinal.mk s < c} (lt_of_lt_of_le (nat_lt_aleph0 2) hreg.aleph0_le)
Β· refine fun s hS hSc β¦ lt_of_le_of_lt (mk_sUnion_le _) <| mul_lt_of_lt hreg.aleph0_le hS ?_
exact iSup_lt_of_isRegular hreg hS fun i β¦ hSc i i.property
Β· exact fun _ hSc _ ht β¦ lt_of_le_of_lt (mk_le_mk_of_subset ht) hSc
@[simp]
theorem mem_cocardinal {s : Set Ξ±} :
s β cocardinal Ξ± hreg β Cardinal.mk (sαΆ : Set Ξ±) < c := Iff.rfl
@[simp] lemma cocardinal_aleph0_eq_cofinite :
cocardinal (Ξ± := Ξ±) isRegular_aleph0 = cofinite := by
aesop
instance instCardinalInterFilter_cocardinal : CardinalInterFilter (cocardinal (Ξ± := Ξ±) hreg) c where
cardinal_sInter_mem S hS hSs := by
rw [mem_cocardinal, Set.compl_sInter]
apply lt_of_le_of_lt (mk_sUnion_le _)
apply mul_lt_of_lt hreg.aleph0_le (lt_of_le_of_lt mk_image_le hS)
apply iSup_lt_of_isRegular hreg <| lt_of_le_of_lt mk_image_le hS
intro i
aesop
@[simp]
theorem eventually_cocardinal {p : Ξ± β Prop} :
(βαΆ x in cocardinal Ξ± hreg, p x) β #{ x | Β¬p x } < c := Iff.rfl
theorem hasBasis_cocardinal : HasBasis (cocardinal Ξ± hreg) {s : Set Ξ± | #s < c} compl :=
β¨fun s =>
β¨fun h => β¨sαΆ, h, (compl_compl s).subsetβ©, fun β¨_t, htf, htsβ© => by
have : #βsαΆ < c := by
apply lt_of_le_of_lt _ htf
rw [compl_subset_comm] at hts
apply Cardinal.mk_le_mk_of_subset hts
simp_all only [mem_cocardinal] β©β©
| Mathlib/Order/Filter/Cocardinal.lean | 70 | 72 | theorem frequently_cocardinal {p : Ξ± β Prop} :
(βαΆ x in cocardinal Ξ± hreg, p x) β c β€ # { x | p x } := by |
simp only [Filter.Frequently, eventually_cocardinal, not_not,coe_setOf, not_lt]
| [
" Filter Ξ±",
" β (S : Set (Set Ξ±)), #βS < c β (β s β S, s β {s | #βs < c}) β ββ S β {s | #βs < c}",
" β¨ s_1, #ββs_1 < c",
" β t β {s | #βs < c}, β s β t, s β {s | #βs < c}",
" cocardinal Ξ± isRegular_aleph0 = cofinite",
" ββ S β cocardinal Ξ± hreg",
" #β(ββ (compl '' S)) < c",
" #β(compl '' S) * β¨ s, #β... | [
" Filter Ξ±",
" β (S : Set (Set Ξ±)), #βS < c β (β s β S, s β {s | #βs < c}) β ββ S β {s | #βs < c}",
" β¨ s_1, #ββs_1 < c",
" β t β {s | #βs < c}, β s β t, s β {s | #βs < c}",
" cocardinal Ξ± isRegular_aleph0 = cofinite",
" ββ S β cocardinal Ξ± hreg",
" #β(ββ (compl '' S)) < c",
" #β(compl '' S) * β¨ s, #β... |
import Batteries.Data.Char
import Batteries.Data.List.Lemmas
import Batteries.Data.String.Basic
import Batteries.Tactic.Lint.Misc
import Batteries.Tactic.SeqFocus
namespace String
attribute [ext] ext
theorem lt_trans {sβ sβ sβ : String} : sβ < sβ β sβ < sβ β sβ < sβ :=
List.lt_trans' (Ξ± := Char) Nat.lt_trans
(fun h1 h2 => Nat.not_lt.2 <| Nat.le_trans (Nat.not_lt.1 h2) (Nat.not_lt.1 h1))
theorem lt_antisymm {sβ sβ : String} (hβ : Β¬sβ < sβ) (hβ : Β¬sβ < sβ) : sβ = sβ :=
ext <| List.lt_antisymm' (Ξ± := Char)
(fun h1 h2 => Char.le_antisymm (Nat.not_lt.1 h2) (Nat.not_lt.1 h1)) hβ hβ
instance : Batteries.TransOrd String := .compareOfLessAndEq
String.lt_irrefl String.lt_trans String.lt_antisymm
instance : Batteries.LTOrd String := .compareOfLessAndEq
String.lt_irrefl String.lt_trans String.lt_antisymm
instance : Batteries.BEqOrd String := .compareOfLessAndEq String.lt_irrefl
@[simp] theorem mk_length (s : List Char) : (String.mk s).length = s.length := rfl
attribute [simp] toList -- prefer `String.data` over `String.toList` in lemmas
private theorem add_csize_pos : 0 < i + csize c :=
Nat.add_pos_right _ (csize_pos c)
private theorem ne_add_csize_add_self : i β n + csize c + i :=
Nat.ne_of_lt (Nat.lt_add_of_pos_left add_csize_pos)
private theorem ne_self_add_add_csize : i β i + (n + csize c) :=
Nat.ne_of_lt (Nat.lt_add_of_pos_right add_csize_pos)
@[inline] def utf8Len : List Char β Nat := utf8ByteSize.go
@[simp] theorem utf8ByteSize.go_eq : utf8ByteSize.go = utf8Len := rfl
@[simp] theorem utf8ByteSize_mk (cs) : utf8ByteSize β¨csβ© = utf8Len cs := rfl
@[simp] theorem utf8Len_nil : utf8Len [] = 0 := rfl
@[simp] theorem utf8Len_cons (c cs) : utf8Len (c :: cs) = utf8Len cs + csize c := rfl
@[simp] theorem utf8Len_append (csβ csβ) : utf8Len (csβ ++ csβ) = utf8Len csβ + utf8Len csβ := by
induction csβ <;> simp [*, Nat.add_right_comm]
@[simp] theorem utf8Len_reverseAux (csβ csβ) :
utf8Len (csβ.reverseAux csβ) = utf8Len csβ + utf8Len csβ := by
induction csβ generalizing csβ <;> simp [*, β Nat.add_assoc, Nat.add_right_comm]
@[simp] theorem utf8Len_reverse (cs) : utf8Len cs.reverse = utf8Len cs := utf8Len_reverseAux ..
@[simp] theorem utf8Len_eq_zero : utf8Len l = 0 β l = [] := by
cases l <;> simp [Nat.ne_of_gt add_csize_pos]
section
open List
theorem utf8Len_le_of_sublist : β {csβ csβ}, csβ <+ csβ β utf8Len csβ β€ utf8Len csβ
| _, _, .slnil => Nat.le_refl _
| _, _, .cons _ h => Nat.le_trans (utf8Len_le_of_sublist h) (Nat.le_add_right ..)
| _, _, .consβ _ h => Nat.add_le_add_right (utf8Len_le_of_sublist h) _
theorem utf8Len_le_of_infix (h : csβ <:+: csβ) : utf8Len csβ β€ utf8Len csβ :=
utf8Len_le_of_sublist h.sublist
theorem utf8Len_le_of_suffix (h : csβ <:+ csβ) : utf8Len csβ β€ utf8Len csβ :=
utf8Len_le_of_sublist h.sublist
theorem utf8Len_le_of_prefix (h : csβ <+: csβ) : utf8Len csβ β€ utf8Len csβ :=
utf8Len_le_of_sublist h.sublist
end
@[simp] theorem endPos_eq (cs : List Char) : endPos β¨csβ© = β¨utf8Len csβ© := rfl
theorem endPos_eq_zero : β (s : String), endPos s = 0 β s = ""
| β¨_β© => Pos.ext_iff.trans <| utf8Len_eq_zero.trans ext_iff.symm
theorem isEmpty_iff (s : String) : isEmpty s β s = "" :=
(beq_iff_eq ..).trans (endPos_eq_zero _)
def utf8InductionOn {motive : List Char β Pos β Sort u}
(s : List Char) (i p : Pos)
(nil : β i, motive [] i)
(eq : β c cs, motive (c :: cs) p)
(ind : β (c : Char) cs i, i β p β motive cs (i + c) β motive (c :: cs) i) :
motive s i :=
match s with
| [] => nil i
| c::cs =>
if h : i = p then
h βΈ eq c cs
else ind c cs i h (utf8InductionOn cs (i + c) p nil eq ind)
| .lake/packages/batteries/Batteries/Data/String/Lemmas.lean | 134 | 143 | theorem utf8GetAux_add_right_cancel (s : List Char) (i p n : Nat) :
utf8GetAux s β¨i + nβ© β¨p + nβ© = utf8GetAux s β¨iβ© β¨pβ© := by |
apply utf8InductionOn s β¨iβ© β¨pβ© (motive := fun s i =>
utf8GetAux s β¨i.byteIdx + nβ© β¨p + nβ© = utf8GetAux s i β¨pβ©) <;>
simp [utf8GetAux]
intro c cs β¨iβ© h ih
simp [Pos.ext_iff, Pos.addChar_eq] at h β’
simp [Nat.add_right_cancel_iff, h]
rw [Nat.add_right_comm]
exact ih
| [
" utf8Len (csβ ++ csβ) = utf8Len csβ + utf8Len csβ",
" utf8Len ([] ++ csβ) = utf8Len [] + utf8Len csβ",
" utf8Len (headβ :: tailβ ++ csβ) = utf8Len (headβ :: tailβ) + utf8Len csβ",
" utf8Len (csβ.reverseAux csβ) = utf8Len csβ + utf8Len csβ",
" utf8Len ([].reverseAux csβ) = utf8Len [] + utf8Len csβ",
" utf... | [
" utf8Len (csβ ++ csβ) = utf8Len csβ + utf8Len csβ",
" utf8Len ([] ++ csβ) = utf8Len [] + utf8Len csβ",
" utf8Len (headβ :: tailβ ++ csβ) = utf8Len (headβ :: tailβ) + utf8Len csβ",
" utf8Len (csβ.reverseAux csβ) = utf8Len csβ + utf8Len csβ",
" utf8Len ([].reverseAux csβ) = utf8Len [] + utf8Len csβ",
" utf... |
import Batteries.Data.Array.Lemmas
namespace ByteArray
@[ext] theorem ext : {a b : ByteArray} β a.data = b.data β a = b
| β¨_β©, β¨_β©, rfl => rfl
theorem getElem_eq_data_getElem (a : ByteArray) (h : i < a.size) : a[i] = a.data[i] := rfl
@[simp] theorem uset_eq_set (a : ByteArray) {i : USize} (h : i.toNat < a.size) (v : UInt8) :
a.uset i v h = a.set β¨i.toNat, hβ© v := rfl
@[simp] theorem mkEmpty_data (cap) : (mkEmpty cap).data = #[] := rfl
@[simp] theorem empty_data : empty.data = #[] := rfl
@[simp] theorem size_empty : empty.size = 0 := rfl
@[simp] theorem push_data (a : ByteArray) (b : UInt8) : (a.push b).data = a.data.push b := rfl
@[simp] theorem size_push (a : ByteArray) (b : UInt8) : (a.push b).size = a.size + 1 :=
Array.size_push ..
@[simp] theorem get_push_eq (a : ByteArray) (x : UInt8) : (a.push x)[a.size] = x :=
Array.get_push_eq ..
theorem get_push_lt (a : ByteArray) (x : UInt8) (i : Nat) (h : i < a.size) :
(a.push x)[i]'(size_push .. βΈ Nat.lt_succ_of_lt h) = a[i] :=
Array.get_push_lt ..
@[simp] theorem set_data (a : ByteArray) (i : Fin a.size) (v : UInt8) :
(a.set i v).data = a.data.set i v := rfl
@[simp] theorem size_set (a : ByteArray) (i : Fin a.size) (v : UInt8) :
(a.set i v).size = a.size :=
Array.size_set ..
@[simp] theorem get_set_eq (a : ByteArray) (i : Fin a.size) (v : UInt8) : (a.set i v)[i.val] = v :=
Array.get_set_eq ..
theorem get_set_ne (a : ByteArray) (i : Fin a.size) (v : UInt8) (hj : j < a.size) (h : i.val β j) :
(a.set i v)[j]'(a.size_set .. βΈ hj) = a[j] :=
Array.get_set_ne (h:=h) ..
theorem set_set (a : ByteArray) (i : Fin a.size) (v v' : UInt8) :
(a.set i v).set β¨i, by simp [i.2]β© v' = a.set i v' :=
ByteArray.ext <| Array.set_set ..
@[simp] theorem copySlice_data (a i b j len exact) :
(copySlice a i b j len exact).data = b.data.extract 0 j ++ a.data.extract i (i + len)
++ b.data.extract (j + min len (a.data.size - i)) b.data.size := rfl
@[simp] theorem append_eq (a b) : ByteArray.append a b = a ++ b := rfl
@[simp] theorem append_data (a b : ByteArray) : (a ++ b).data = a.data ++ b.data := by
rw [βappend_eq]; simp [ByteArray.append, size]
rw [Array.extract_empty_of_stop_le_start (h:=Nat.le_add_right ..), Array.append_nil]
theorem size_append (a b : ByteArray) : (a ++ b).size = a.size + b.size := by
simp only [size, append_eq, append_data]; exact Array.size_append ..
theorem get_append_left {a b : ByteArray} (hlt : i < a.size)
(h : i < (a ++ b).size := size_append .. βΈ Nat.lt_of_lt_of_le hlt (Nat.le_add_right ..)) :
(a ++ b)[i] = a[i] := by
simp [getElem_eq_data_getElem]; exact Array.get_append_left hlt
| .lake/packages/batteries/Batteries/Data/ByteArray.lean | 84 | 87 | theorem get_append_right {a b : ByteArray} (hle : a.size β€ i) (h : i < (a ++ b).size)
(h' : i - a.size < b.size := Nat.sub_lt_left_of_lt_add hle (size_append .. βΈ h)) :
(a ++ b)[i] = b[i - a.size] := by |
simp [getElem_eq_data_getElem]; exact Array.get_append_right hle
| [
" βi < (a.set i v).size",
" (a ++ b).data = a.data ++ b.data",
" (a.append b).data = a.data ++ b.data",
" a.data ++ b.data ++ a.data.extract (a.data.size + b.data.size) a.data.size = a.data ++ b.data",
" (a ++ b).size = a.size + b.size",
" (a.data ++ b.data).size = a.data.size + b.data.size",
" (a ++ b)... | [
" βi < (a.set i v).size",
" (a ++ b).data = a.data ++ b.data",
" (a.append b).data = a.data ++ b.data",
" a.data ++ b.data ++ a.data.extract (a.data.size + b.data.size) a.data.size = a.data ++ b.data",
" (a ++ b).size = a.size + b.size",
" (a.data ++ b.data).size = a.data.size + b.data.size",
" (a ++ b)... |
import Mathlib.Topology.Category.TopCat.Limits.Pullbacks
import Mathlib.Geometry.RingedSpace.LocallyRingedSpace
#align_import algebraic_geometry.open_immersion.basic from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1"
-- Porting note: due to `PresheafedSpace`, `SheafedSpace` and `LocallyRingedSpace`
set_option linter.uppercaseLean3 false
open TopologicalSpace CategoryTheory Opposite
open CategoryTheory.Limits
namespace AlgebraicGeometry
universe v vβ vβ u
variable {C : Type u} [Category.{v} C]
class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace C} (f : X βΆ Y) : Prop where
base_open : OpenEmbedding f.base
c_iso : β U : Opens X, IsIso (f.c.app (op (base_open.isOpenMap.functor.obj U)))
#align algebraic_geometry.PresheafedSpace.is_open_immersion AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
abbrev SheafedSpace.IsOpenImmersion {X Y : SheafedSpace C} (f : X βΆ Y) : Prop :=
PresheafedSpace.IsOpenImmersion f
#align algebraic_geometry.SheafedSpace.is_open_immersion AlgebraicGeometry.SheafedSpace.IsOpenImmersion
abbrev LocallyRingedSpace.IsOpenImmersion {X Y : LocallyRingedSpace} (f : X βΆ Y) : Prop :=
SheafedSpace.IsOpenImmersion f.1
#align algebraic_geometry.LocallyRingedSpace.is_open_immersion AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
namespace PresheafedSpace.IsOpenImmersion
open PresheafedSpace
local notation "IsOpenImmersion" => PresheafedSpace.IsOpenImmersion
attribute [instance] IsOpenImmersion.c_iso
section
variable {X Y : PresheafedSpace C} {f : X βΆ Y} (H : IsOpenImmersion f)
abbrev openFunctor :=
H.base_open.isOpenMap.functor
#align algebraic_geometry.PresheafedSpace.is_open_immersion.open_functor AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.openFunctor
@[simps! hom_c_app]
noncomputable def isoRestrict : X β
Y.restrict H.base_open :=
PresheafedSpace.isoOfComponents (Iso.refl _) <| by
symm
fapply NatIso.ofComponents
Β· intro U
refine asIso (f.c.app (op (H.openFunctor.obj (unop U)))) βͺβ« X.presheaf.mapIso (eqToIso ?_)
induction U using Opposite.rec' with | h U => ?_
cases U
dsimp only [IsOpenMap.functor, Functor.op, Opens.map]
congr 2
erw [Set.preimage_image_eq _ H.base_open.inj]
rfl
Β· intro U V i
simp only [CategoryTheory.eqToIso.hom, TopCat.Presheaf.pushforwardObj_map, Category.assoc,
Functor.op_map, Iso.trans_hom, asIso_hom, Functor.mapIso_hom, β X.presheaf.map_comp]
erw [f.c.naturality_assoc, β X.presheaf.map_comp]
congr 1
#align algebraic_geometry.PresheafedSpace.is_open_immersion.iso_restrict AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict
@[simp]
| Mathlib/Geometry/RingedSpace/OpenImmersion.lean | 133 | 141 | theorem isoRestrict_hom_ofRestrict : H.isoRestrict.hom β« Y.ofRestrict _ = f := by |
-- Porting note: `ext` did not pick up `NatTrans.ext`
refine PresheafedSpace.Hom.ext _ _ rfl <| NatTrans.ext _ _ <| funext fun x => ?_
simp only [isoRestrict_hom_c_app, NatTrans.comp_app, eqToHom_refl,
ofRestrict_c_app, Category.assoc, whiskerRight_id']
erw [Category.comp_id, comp_c_app, f.c.naturality_assoc, β X.presheaf.map_comp]
trans f.c.app x β« X.presheaf.map (π _)
Β· congr 1
Β· erw [X.presheaf.map_id, Category.comp_id]
| [] | [] |
import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic
import Mathlib.CategoryTheory.Monoidal.Functorial
import Mathlib.CategoryTheory.Monoidal.Types.Basic
import Mathlib.LinearAlgebra.DirectSum.Finsupp
import Mathlib.CategoryTheory.Linear.LinearFunctor
#align_import algebra.category.Module.adjunctions from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4"
set_option linter.uppercaseLean3 false -- `Module`
noncomputable section
open CategoryTheory
namespace ModuleCat
universe u
open scoped Classical
variable (R : Type u)
section
variable [Ring R]
@[simps]
def free : Type u β₯€ ModuleCat R where
obj X := ModuleCat.of R (X ββ R)
map {X Y} f := Finsupp.lmapDomain _ _ f
map_id := by intros; exact Finsupp.lmapDomain_id _ _
map_comp := by intros; exact Finsupp.lmapDomain_comp _ _ _ _
#align Module.free ModuleCat.free
def adj : free R β£ forget (ModuleCat.{u} R) :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X M => (Finsupp.lift M R X).toEquiv.symm
homEquiv_naturality_left_symm := fun {_ _} M f g =>
Finsupp.lhom_ext' fun x =>
LinearMap.ext_ring
(Finsupp.sum_mapDomain_index_addMonoidHom fun y => (smulAddHom R M).flip (g y)).symm }
#align Module.adj ModuleCat.adj
instance : (forget (ModuleCat.{u} R)).IsRightAdjoint :=
(adj R).isRightAdjoint
end
namespace Free
open MonoidalCategory
variable [CommRing R]
attribute [local ext] TensorProduct.ext
def Ξ΅ : π_ (ModuleCat.{u} R) βΆ (free R).obj (π_ (Type u)) :=
Finsupp.lsingle PUnit.unit
#align Module.free.Ξ΅ ModuleCat.Free.Ξ΅
-- This lemma has always been bad, but lean4#2644 made `simp` start noticing
@[simp, nolint simpNF]
theorem Ξ΅_apply (r : R) : Ξ΅ R r = Finsupp.single PUnit.unit r :=
rfl
#align Module.free.Ξ΅_apply ModuleCat.Free.Ξ΅_apply
def ΞΌ (Ξ± Ξ² : Type u) : (free R).obj Ξ± β (free R).obj Ξ² β
(free R).obj (Ξ± β Ξ²) :=
(finsuppTensorFinsupp' R Ξ± Ξ²).toModuleIso
#align Module.free.ΞΌ ModuleCat.Free.ΞΌ
theorem ΞΌ_natural {X Y X' Y' : Type u} (f : X βΆ Y) (g : X' βΆ Y') :
((free R).map f β (free R).map g) β« (ΞΌ R Y Y').hom = (ΞΌ R X X').hom β« (free R).map (f β g) := by
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro x'
apply LinearMap.ext_ring
apply Finsupp.ext
intro β¨y, y'β©
-- Porting note (#10934): used to be dsimp [ΞΌ]
change (finsuppTensorFinsupp' R Y Y')
(Finsupp.mapDomain f (Finsupp.single x 1) ββ[R] Finsupp.mapDomain g (Finsupp.single x' 1)) _
= (Finsupp.mapDomain (f β g) (finsuppTensorFinsupp' R X X'
(Finsupp.single x 1 ββ[R] Finsupp.single x' 1))) _
-- extra `rfl` after leanprover/lean4#2466
simp_rw [Finsupp.mapDomain_single, finsuppTensorFinsupp'_single_tmul_single, mul_one,
Finsupp.mapDomain_single, CategoryTheory.tensor_apply]; rfl
#align Module.free.ΞΌ_natural ModuleCat.Free.ΞΌ_natural
| Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean | 112 | 129 | theorem left_unitality (X : Type u) :
(Ξ»_ ((free R).obj X)).hom =
(Ξ΅ R β π ((free R).obj X)) β« (ΞΌ R (π_ (Type u)) X).hom β« map (free R).obj (Ξ»_ X).hom := by |
-- Porting note (#11041): broken ext
apply TensorProduct.ext
apply LinearMap.ext_ring
apply Finsupp.lhom_ext'
intro x
apply LinearMap.ext_ring
apply Finsupp.ext
intro x'
-- Porting note (#10934): used to be dsimp [Ξ΅, ΞΌ]
let q : X ββ R := ((Ξ»_ (of R (X ββ R))).hom) (1 ββ[R] Finsupp.single x 1)
change q x' = Finsupp.mapDomain (Ξ»_ X).hom (finsuppTensorFinsupp' R (π_ (Type u)) X
(Finsupp.single PUnit.unit 1 ββ[R] Finsupp.single x 1)) x'
simp_rw [q, finsuppTensorFinsupp'_single_tmul_single,
ModuleCat.MonoidalCategory.leftUnitor_hom_apply, mul_one,
Finsupp.mapDomain_single, CategoryTheory.leftUnitor_hom_apply, one_smul]
| [
" β (X : Type u),\n { obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.map (π X) =\n π ({ obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.obj X)",
" { obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.map (π Xβ... | [
" β (X : Type u),\n { obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.map (π X) =\n π ({ obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.obj X)",
" { obj := fun X => of R (X ββ R), map := fun {X Y} f => Finsupp.lmapDomain R R f }.map (π Xβ... |
import Mathlib.Data.List.Chain
#align_import data.list.destutter from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
variable {Ξ± : Type*} (l : List Ξ±) (R : Ξ± β Ξ± β Prop) [DecidableRel R] {a b : Ξ±}
namespace List
@[simp]
theorem destutter'_nil : destutter' R a [] = [a] :=
rfl
#align list.destutter'_nil List.destutter'_nil
theorem destutter'_cons :
(b :: l).destutter' R a = if R a b then a :: destutter' R b l else destutter' R a l :=
rfl
#align list.destutter'_cons List.destutter'_cons
variable {R}
@[simp]
theorem destutter'_cons_pos (h : R b a) : (a :: l).destutter' R b = b :: l.destutter' R a := by
rw [destutter', if_pos h]
#align list.destutter'_cons_pos List.destutter'_cons_pos
@[simp]
theorem destutter'_cons_neg (h : Β¬R b a) : (a :: l).destutter' R b = l.destutter' R b := by
rw [destutter', if_neg h]
#align list.destutter'_cons_neg List.destutter'_cons_neg
variable (R)
@[simp]
theorem destutter'_singleton : [b].destutter' R a = if R a b then [a, b] else [a] := by
split_ifs with h <;> simp! [h]
#align list.destutter'_singleton List.destutter'_singleton
| Mathlib/Data/List/Destutter.lean | 64 | 70 | theorem destutter'_sublist (a) : l.destutter' R a <+ a :: l := by |
induction' l with b l hl generalizing a
Β· simp
rw [destutter']
split_ifs
Β· exact Sublist.consβ a (hl b)
Β· exact (hl a).trans ((l.sublist_cons b).cons_cons a)
| [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l",
" destutter' R a [b] = if R a b then [a, b] else [a]",
" destutter' R a [b] = [a, b]",
" destutter' R a [b] = [a]",
" destutter' R a l <+ a :: l",
" destutter' R a [] <+ [a]",
" destutter' R a (b :: l) <... | [
" destutter' R b (a :: l) = b :: destutter' R a l",
" destutter' R b (a :: l) = destutter' R b l",
" destutter' R a [b] = if R a b then [a, b] else [a]",
" destutter' R a [b] = [a, b]",
" destutter' R a [b] = [a]",
" destutter' R a l <+ a :: l"
] |
import Mathlib.Algebra.CharP.Two
import Mathlib.Algebra.CharP.Reduced
import Mathlib.Algebra.NeZero
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.GroupTheory.SpecificGroups.Cyclic
import Mathlib.NumberTheory.Divisors
import Mathlib.RingTheory.IntegralDomain
import Mathlib.Tactic.Zify
#align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
open scoped Classical Polynomial
noncomputable section
open Polynomial
open Finset
variable {M N G R S F : Type*}
variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G]
section rootsOfUnity
variable {k l : β+}
def rootsOfUnity (k : β+) (M : Type*) [CommMonoid M] : Subgroup MΛ£ where
carrier := {ΞΆ | ΞΆ ^ (k : β) = 1}
one_mem' := one_pow _
mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul]
inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one]
#align roots_of_unity rootsOfUnity
@[simp]
theorem mem_rootsOfUnity (k : β+) (ΞΆ : MΛ£) : ΞΆ β rootsOfUnity k M β ΞΆ ^ (k : β) = 1 :=
Iff.rfl
#align mem_roots_of_unity mem_rootsOfUnity
theorem mem_rootsOfUnity' (k : β+) (ΞΆ : MΛ£) : ΞΆ β rootsOfUnity k M β (ΞΆ : M) ^ (k : β) = 1 := by
rw [mem_rootsOfUnity]; norm_cast
#align mem_roots_of_unity' mem_rootsOfUnity'
@[simp]
theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = β₯ := by ext; simp
theorem rootsOfUnity.coe_injective {n : β+} :
Function.Injective (fun x : rootsOfUnity n M β¦ x.val.val) :=
Units.ext.comp fun _ _ => Subtype.eq
#align roots_of_unity.coe_injective rootsOfUnity.coe_injective
@[simps! coe_val]
def rootsOfUnity.mkOfPowEq (ΞΆ : M) {n : β+} (h : ΞΆ ^ (n : β) = 1) : rootsOfUnity n M :=
β¨Units.ofPowEqOne ΞΆ n h n.ne_zero, Units.pow_ofPowEqOne _ _β©
#align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq
#align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe
@[simp]
theorem rootsOfUnity.coe_mkOfPowEq {ΞΆ : M} {n : β+} (h : ΞΆ ^ (n : β) = 1) :
((rootsOfUnity.mkOfPowEq _ h : MΛ£) : M) = ΞΆ :=
rfl
#align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq
theorem rootsOfUnity_le_of_dvd (h : k β£ l) : rootsOfUnity k M β€ rootsOfUnity l M := by
obtain β¨d, rflβ© := h
intro ΞΆ h
simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow]
#align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd
theorem map_rootsOfUnity (f : MΛ£ β* NΛ£) (k : β+) : (rootsOfUnity k M).map f β€ rootsOfUnity k N := by
rintro _ β¨ΞΆ, h, rflβ©
simp_all only [β map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one]
#align map_roots_of_unity map_rootsOfUnity
@[norm_cast]
| Mathlib/RingTheory/RootsOfUnity/Basic.lean | 131 | 133 | theorem rootsOfUnity.coe_pow [CommMonoid R] (ΞΆ : rootsOfUnity k R) (m : β) :
(((ΞΆ ^ m :) : RΛ£) : R) = ((ΞΆ : RΛ£) : R) ^ m := by |
rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val]
| [
" aβ * bβ β {ΞΆ | ΞΆ ^ βk = 1}",
" xβΒΉβ»ΒΉ β { carrier := {ΞΆ | ΞΆ ^ βk = 1}, mul_mem' := β―, one_mem' := β― }.carrier",
" ΞΆ β rootsOfUnity k M β βΞΆ ^ βk = 1",
" ΞΆ ^ βk = 1 β βΞΆ ^ βk = 1",
" rootsOfUnity 1 M = β₯",
" xβ β rootsOfUnity 1 M β xβ β β₯",
" rootsOfUnity k M β€ rootsOfUnity l M",
" rootsOfUnity k M β€ ... | [
" aβ * bβ β {ΞΆ | ΞΆ ^ βk = 1}",
" xβΒΉβ»ΒΉ β { carrier := {ΞΆ | ΞΆ ^ βk = 1}, mul_mem' := β―, one_mem' := β― }.carrier",
" ΞΆ β rootsOfUnity k M β βΞΆ ^ βk = 1",
" ΞΆ ^ βk = 1 β βΞΆ ^ βk = 1",
" rootsOfUnity 1 M = β₯",
" xβ β rootsOfUnity 1 M β xβ β β₯",
" rootsOfUnity k M β€ rootsOfUnity l M",
" rootsOfUnity k M β€ ... |
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Calculus.FDeriv.Linear
import Mathlib.Analysis.Calculus.FDeriv.Comp
#align_import analysis.calculus.fderiv.equiv from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace π G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace π G']
variable {f fβ fβ g : E β F}
variable {f' fβ' fβ' g' : E βL[π] F}
variable (e : E βL[π] F)
variable {x : E}
variable {s t : Set E}
variable {L Lβ Lβ : Filter E}
| Mathlib/Analysis/Calculus/FDeriv/Equiv.lean | 391 | 410 | theorem HasStrictFDerivAt.of_local_left_inverse {f : E β F} {f' : E βL[π] F} {g : F β E} {a : F}
(hg : ContinuousAt g a) (hf : HasStrictFDerivAt f (f' : E βL[π] F) (g a))
(hfg : βαΆ y in π a, f (g y) = y) : HasStrictFDerivAt g (f'.symm : F βL[π] E) a := by |
replace hg := hg.prod_map' hg
replace hfg := hfg.prod_mk_nhds hfg
have :
(fun p : F Γ F => g p.1 - g p.2 - f'.symm (p.1 - p.2)) =O[π (a, a)] fun p : F Γ F =>
f' (g p.1 - g p.2) - (p.1 - p.2) := by
refine ((f'.symm : F βL[π] E).isBigO_comp _ _).congr (fun x => ?_) fun _ => rfl
simp
refine this.trans_isLittleO ?_
clear this
refine ((hf.comp_tendsto hg).symm.congr'
(hfg.mono ?_) (eventually_of_forall fun _ => rfl)).trans_isBigO ?_
Β· rintro p β¨hp1, hp2β©
simp [hp1, hp2]
Β· refine (hf.isBigO_sub_rev.comp_tendsto hg).congr' (eventually_of_forall fun _ => rfl)
(hfg.mono ?_)
rintro p β¨hp1, hp2β©
simp only [(Β· β Β·), hp1, hp2]
| [
" HasStrictFDerivAt g (βf'.symm) a",
" (fun p => g p.1 - g p.2 - f'.symm (p.1 - p.2)) =O[π (a, a)] fun p => f' (g p.1 - g p.2) - (p.1 - p.2)",
" βf'.symm (f' (g x.1 - g x.2) - (x.1 - x.2)) = g x.1 - g x.2 - f'.symm (x.1 - x.2)",
" (fun p => f' (g p.1 - g p.2) - (p.1 - p.2)) =o[π (a, a)] fun p => p.1 - p.2",... | [
" HasStrictFDerivAt g (βf'.symm) a"
] |
import Mathlib.Data.List.Basic
#align_import data.list.join from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
-- Make sure we don't import algebra
assert_not_exists Monoid
variable {Ξ± Ξ² : Type*}
namespace List
attribute [simp] join
-- Porting note (#10618): simp can prove this
-- @[simp]
theorem join_singleton (l : List Ξ±) : [l].join = l := by rw [join, join, append_nil]
#align list.join_singleton List.join_singleton
@[simp]
theorem join_eq_nil : β {L : List (List Ξ±)}, join L = [] β β l β L, l = []
| [] => iff_of_true rfl (forall_mem_nil _)
| l :: L => by simp only [join, append_eq_nil, join_eq_nil, forall_mem_cons]
#align list.join_eq_nil List.join_eq_nil
@[simp]
theorem join_append (Lβ Lβ : List (List Ξ±)) : join (Lβ ++ Lβ) = join Lβ ++ join Lβ := by
induction Lβ
Β· rfl
Β· simp [*]
#align list.join_append List.join_append
theorem join_concat (L : List (List Ξ±)) (l : List Ξ±) : join (L.concat l) = join L ++ l := by simp
#align list.join_concat List.join_concat
@[simp]
theorem join_filter_not_isEmpty :
β {L : List (List Ξ±)}, join (L.filter fun l => !l.isEmpty) = L.join
| [] => rfl
| [] :: L => by
simp [join_filter_not_isEmpty (L := L), isEmpty_iff_eq_nil]
| (a :: l) :: L => by
simp [join_filter_not_isEmpty (L := L)]
#align list.join_filter_empty_eq_ff List.join_filter_not_isEmpty
@[deprecated (since := "2024-02-25")] alias join_filter_isEmpty_eq_false := join_filter_not_isEmpty
@[simp]
theorem join_filter_ne_nil [DecidablePred fun l : List Ξ± => l β []] {L : List (List Ξ±)} :
join (L.filter fun l => l β []) = L.join := by
simp [join_filter_not_isEmpty, β isEmpty_iff_eq_nil]
#align list.join_filter_ne_nil List.join_filter_ne_nil
theorem join_join (l : List (List (List Ξ±))) : l.join.join = (l.map join).join := by
induction l <;> simp [*]
#align list.join_join List.join_join
lemma length_join' (L : List (List Ξ±)) : length (join L) = Nat.sum (map length L) := by
induction L <;> [rfl; simp only [*, join, map, Nat.sum_cons, length_append]]
lemma countP_join' (p : Ξ± β Bool) :
β L : List (List Ξ±), countP p L.join = Nat.sum (L.map (countP p))
| [] => rfl
| a :: l => by rw [join, countP_append, map_cons, Nat.sum_cons, countP_join' _ l]
lemma count_join' [BEq Ξ±] (L : List (List Ξ±)) (a : Ξ±) :
L.join.count a = Nat.sum (L.map (count a)) := countP_join' _ _
lemma length_bind' (l : List Ξ±) (f : Ξ± β List Ξ²) :
length (l.bind f) = Nat.sum (map (length β f) l) := by rw [List.bind, length_join', map_map]
lemma countP_bind' (p : Ξ² β Bool) (l : List Ξ±) (f : Ξ± β List Ξ²) :
countP p (l.bind f) = Nat.sum (map (countP p β f) l) := by rw [List.bind, countP_join', map_map]
lemma count_bind' [BEq Ξ²] (l : List Ξ±) (f : Ξ± β List Ξ²) (x : Ξ²) :
count x (l.bind f) = Nat.sum (map (count x β f) l) := countP_bind' _ _ _
@[simp]
theorem bind_eq_nil {l : List Ξ±} {f : Ξ± β List Ξ²} : List.bind l f = [] β β x β l, f x = [] :=
join_eq_nil.trans <| by
simp only [mem_map, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align list.bind_eq_nil List.bind_eq_nil
| Mathlib/Data/List/Join.lean | 105 | 109 | theorem take_sum_join' (L : List (List Ξ±)) (i : β) :
L.join.take (Nat.sum ((L.map length).take i)) = (L.take i).join := by |
induction L generalizing i
Β· simp
Β· cases i <;> simp [take_append, *]
| [
" [l].join = l",
" (l :: L).join = [] β β (l_1 : List Ξ±), l_1 β l :: L β l_1 = []",
" (Lβ ++ Lβ).join = Lβ.join ++ Lβ.join",
" ([] ++ Lβ).join = [].join ++ Lβ.join",
" (headβ :: tailβ ++ Lβ).join = (headβ :: tailβ).join ++ Lβ.join",
" (L.concat l).join = L.join ++ l",
" (filter (fun l => !l.isEmpty) ([]... | [
" [l].join = l",
" (l :: L).join = [] β β (l_1 : List Ξ±), l_1 β l :: L β l_1 = []",
" (Lβ ++ Lβ).join = Lβ.join ++ Lβ.join",
" ([] ++ Lβ).join = [].join ++ Lβ.join",
" (headβ :: tailβ ++ Lβ).join = (headβ :: tailβ).join ++ Lβ.join",
" (L.concat l).join = L.join ++ l",
" (filter (fun l => !l.isEmpty) ([]... |
import Mathlib.Algebra.CharP.Basic
import Mathlib.Algebra.CharP.Algebra
import Mathlib.Data.Nat.Prime
#align_import algebra.char_p.exp_char from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe u
variable (R : Type u)
section Semiring
variable [Semiring R]
class inductive ExpChar (R : Type u) [Semiring R] : β β Prop
| zero [CharZero R] : ExpChar R 1
| prime {q : β} (hprime : q.Prime) [hchar : CharP R q] : ExpChar R q
#align exp_char ExpChar
#align exp_char.prime ExpChar.prime
instance expChar_prime (p) [CharP R p] [Fact p.Prime] : ExpChar R p := ExpChar.prime Fact.out
instance expChar_zero [CharZero R] : ExpChar R 1 := ExpChar.zero
instance (S : Type*) [Semiring S] (p) [ExpChar R p] [ExpChar S p] : ExpChar (R Γ S) p := by
obtain hp | β¨hpβ© := βΉExpChar R pβΊ
Β· have := Prod.charZero_of_left R S; exact .zero
obtain _ | _ := βΉExpChar S pβΊ
Β· exact (Nat.not_prime_one hp).elim
Β· have := Prod.charP R S p; exact .prime hp
variable {R} in
theorem ExpChar.eq {p q : β} (hp : ExpChar R p) (hq : ExpChar R q) : p = q := by
cases' hp with hp _ hp' hp
Β· cases' hq with hq _ hq' hq
exacts [rfl, False.elim (Nat.not_prime_zero (CharP.eq R hq (CharP.ofCharZero R) βΈ hq'))]
Β· cases' hq with hq _ hq' hq
exacts [False.elim (Nat.not_prime_zero (CharP.eq R hp (CharP.ofCharZero R) βΈ hp')),
CharP.eq R hp hq]
theorem ExpChar.congr {p : β} (q : β) [hq : ExpChar R q] (h : q = p) : ExpChar R p := h βΈ hq
noncomputable def ringExpChar (R : Type*) [NonAssocSemiring R] : β := max (ringChar R) 1
theorem ringExpChar.eq (q : β) [h : ExpChar R q] : ringExpChar R = q := by
cases' h with _ _ h _
Β· haveI := CharP.ofCharZero R
rw [ringExpChar, ringChar.eq R 0]; rfl
rw [ringExpChar, ringChar.eq R q]
exact Nat.max_eq_left h.one_lt.le
@[simp]
| Mathlib/Algebra/CharP/ExpChar.lean | 82 | 83 | theorem ringExpChar.eq_one (R : Type*) [NonAssocSemiring R] [CharZero R] : ringExpChar R = 1 := by |
rw [ringExpChar, ringChar.eq_zero, max_eq_right zero_le_one]
| [
" ExpChar (R Γ S) p",
" ExpChar (R Γ S) 1",
" p = q",
" 1 = q",
" ringExpChar R = q",
" ringExpChar R = 1",
" max 0 1 = 1",
" max q 1 = q"
] | [
" ExpChar (R Γ S) p",
" ExpChar (R Γ S) 1",
" p = q",
" 1 = q",
" ringExpChar R = q",
" ringExpChar R = 1",
" max 0 1 = 1",
" max q 1 = q"
] |
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.ordinal from "leanprover-community/mathlib"@"b90e72c7eebbe8de7c8293a80208ea2ba135c834"
universe u
open SetTheory PGame
open scoped NaturalOps PGame
namespace Ordinal
noncomputable def toPGame : Ordinal.{u} β PGame.{u}
| o =>
have : IsWellOrder o.out.Ξ± (Β· < Β·) := isWellOrder_out_lt o
β¨o.out.Ξ±, PEmpty, fun x =>
have := Ordinal.typein_lt_self x
(typein (Β· < Β·) x).toPGame,
PEmpty.elimβ©
termination_by x => x
#align ordinal.to_pgame Ordinal.toPGame
@[nolint unusedHavesSuffices]
theorem toPGame_def (o : Ordinal) :
have : IsWellOrder o.out.Ξ± (Β· < Β·) := isWellOrder_out_lt o
o.toPGame = β¨o.out.Ξ±, PEmpty, fun x => (typein (Β· < Β·) x).toPGame, PEmpty.elimβ© := by
rw [toPGame]
#align ordinal.to_pgame_def Ordinal.toPGame_def
@[simp, nolint unusedHavesSuffices]
theorem toPGame_leftMoves (o : Ordinal) : o.toPGame.LeftMoves = o.out.Ξ± := by
rw [toPGame, LeftMoves]
#align ordinal.to_pgame_left_moves Ordinal.toPGame_leftMoves
@[simp, nolint unusedHavesSuffices]
| Mathlib/SetTheory/Game/Ordinal.lean | 58 | 59 | theorem toPGame_rightMoves (o : Ordinal) : o.toPGame.RightMoves = PEmpty := by |
rw [toPGame, RightMoves]
| [
" let_fun this := β―;\n o.toPGame = mk (Quotient.out o).Ξ± PEmpty.{u_1 + 1} (fun x => (typein (fun x x_1 => x < x_1) x).toPGame) PEmpty.elim",
" o.toPGame.LeftMoves = (Quotient.out o).Ξ±",
" o.toPGame.RightMoves = PEmpty.{u_1 + 1}"
] | [
" let_fun this := β―;\n o.toPGame = mk (Quotient.out o).Ξ± PEmpty.{u_1 + 1} (fun x => (typein (fun x x_1 => x < x_1) x).toPGame) PEmpty.elim",
" o.toPGame.LeftMoves = (Quotient.out o).Ξ±",
" o.toPGame.RightMoves = PEmpty.{u_1 + 1}"
] |
import Mathlib.Order.ConditionallyCompleteLattice.Finset
import Mathlib.Order.Interval.Finset.Nat
#align_import data.nat.lattice from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54"
assert_not_exists MonoidWithZero
open Set
namespace Nat
open scoped Classical
noncomputable instance : InfSet β :=
β¨fun s β¦ if h : β n, n β s then @Nat.find (fun n β¦ n β s) _ h else 0β©
noncomputable instance : SupSet β :=
β¨fun s β¦ if h : β n, β a β s, a β€ n then @Nat.find (fun n β¦ β a β s, a β€ n) _ h else 0β©
theorem sInf_def {s : Set β} (h : s.Nonempty) : sInf s = @Nat.find (fun n β¦ n β s) _ h :=
dif_pos _
#align nat.Inf_def Nat.sInf_def
theorem sSup_def {s : Set β} (h : β n, β a β s, a β€ n) :
sSup s = @Nat.find (fun n β¦ β a β s, a β€ n) _ h :=
dif_pos _
#align nat.Sup_def Nat.sSup_def
theorem _root_.Set.Infinite.Nat.sSup_eq_zero {s : Set β} (h : s.Infinite) : sSup s = 0 :=
dif_neg fun β¨n, hnβ© β¦
let β¨k, hks, hkβ© := h.exists_gt n
(hn k hks).not_lt hk
#align set.infinite.nat.Sup_eq_zero Set.Infinite.Nat.sSup_eq_zero
@[simp]
theorem sInf_eq_zero {s : Set β} : sInf s = 0 β 0 β s β¨ s = β
:= by
cases eq_empty_or_nonempty s with
| inl h => subst h
simp only [or_true_iff, eq_self_iff_true, iff_true_iff, iInf, InfSet.sInf,
mem_empty_iff_false, exists_false, dif_neg, not_false_iff]
| inr h => simp only [h.ne_empty, or_false_iff, Nat.sInf_def, h, Nat.find_eq_zero]
#align nat.Inf_eq_zero Nat.sInf_eq_zero
@[simp]
| Mathlib/Data/Nat/Lattice.lean | 59 | 62 | theorem sInf_empty : sInf β
= 0 := by |
rw [sInf_eq_zero]
right
rfl
| [
" sInf s = 0 β 0 β s β¨ s = β
",
" sInf β
= 0 β 0 β β
β¨ β
= β
",
" sInf β
= 0",
" 0 β β
β¨ β
= β
",
" β
= β
"
] | [
" sInf s = 0 β 0 β s β¨ s = β
",
" sInf β
= 0 β 0 β β
β¨ β
= β
",
" sInf β
= 0"
] |
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {Ξ± Ξ² : Type*} [LinearOrder Ξ±]
open Function
namespace Set
def projIci (a x : Ξ±) : Ici a := β¨max a x, le_max_left _ _β©
#align set.proj_Ici Set.projIci
def projIic (b x : Ξ±) : Iic b := β¨min b x, min_le_left _ _β©
#align set.proj_Iic Set.projIic
def projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : Icc a b :=
β¨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)β©
#align set.proj_Icc Set.projIcc
variable {a b : Ξ±} (h : a β€ b) {x : Ξ±}
@[norm_cast]
theorem coe_projIci (a x : Ξ±) : (projIci a x : Ξ±) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : Ξ±) : (projIic b x : Ξ±) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : Ξ±) (h : a β€ b) (x : Ξ±) : (projIcc a b h x : Ξ±) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x β€ a) : projIci a x = β¨a, le_rflβ© := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b β€ x) : projIic b x = β¨b, le_rflβ© := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
theorem projIcc_of_le_left (hx : x β€ a) : projIcc a b h x = β¨a, left_mem_Icc.2 hβ© := by
simp [projIcc, hx, hx.trans h]
#align set.proj_Icc_of_le_left Set.projIcc_of_le_left
theorem projIcc_of_right_le (hx : b β€ x) : projIcc a b h x = β¨b, right_mem_Icc.2 hβ© := by
simp [projIcc, hx, h]
#align set.proj_Icc_of_right_le Set.projIcc_of_right_le
@[simp]
theorem projIci_self (a : Ξ±) : projIci a a = β¨a, le_rflβ© := projIci_of_le le_rfl
#align set.proj_Ici_self Set.projIci_self
@[simp]
theorem projIic_self (b : Ξ±) : projIic b b = β¨b, le_rflβ© := projIic_of_le le_rfl
#align set.proj_Iic_self Set.projIic_self
@[simp]
theorem projIcc_left : projIcc a b h a = β¨a, left_mem_Icc.2 hβ© :=
projIcc_of_le_left h le_rfl
#align set.proj_Icc_left Set.projIcc_left
@[simp]
theorem projIcc_right : projIcc a b h b = β¨b, right_mem_Icc.2 hβ© :=
projIcc_of_right_le h le_rfl
#align set.proj_Icc_right Set.projIcc_right
theorem projIci_eq_self : projIci a x = β¨a, le_rflβ© β x β€ a := by simp [projIci, Subtype.ext_iff]
#align set.proj_Ici_eq_self Set.projIci_eq_self
theorem projIic_eq_self : projIic b x = β¨b, le_rflβ© β b β€ x := by simp [projIic, Subtype.ext_iff]
#align set.proj_Iic_eq_self Set.projIic_eq_self
theorem projIcc_eq_left (h : a < b) : projIcc a b h.le x = β¨a, left_mem_Icc.mpr h.leβ© β x β€ a := by
simp [projIcc, Subtype.ext_iff, h.not_le]
#align set.proj_Icc_eq_left Set.projIcc_eq_left
| Mathlib/Order/Interval/Set/ProjIcc.lean | 109 | 110 | theorem projIcc_eq_right (h : a < b) : projIcc a b h.le x = β¨b, right_mem_Icc.2 h.leβ© β b β€ x := by |
simp [projIcc, Subtype.ext_iff, max_min_distrib_left, h.le, h.not_le]
| [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©",
" projIci a x = β¨a, β―β© β x β€ a",
" projIic b x = β¨b, β―β© β b β€ x",
" projIcc a b β― x = β¨a, β―β© β x β€ a",
" projIcc a b β― x = β¨b, β―β© β b β€ x"
] | [
" projIcc a b h x = β¨a, β―β©",
" projIcc a b h x = β¨b, β―β©",
" projIci a x = β¨a, β―β© β x β€ a",
" projIic b x = β¨b, β―β© β b β€ x",
" projIcc a b β― x = β¨a, β―β© β x β€ a",
" projIcc a b β― x = β¨b, β―β© β b β€ x"
] |
import Mathlib.Data.Stream.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Init.Data.List.Basic
import Mathlib.Data.List.Basic
#align_import data.stream.init from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
set_option autoImplicit true
open Nat Function Option
namespace Stream'
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ΄ : Type w}
instance [Inhabited Ξ±] : Inhabited (Stream' Ξ±) :=
β¨Stream'.const defaultβ©
protected theorem eta (s : Stream' Ξ±) : (head s::tail s) = s :=
funext fun i => by cases i <;> rfl
#align stream.eta Stream'.eta
@[ext]
protected theorem ext {sβ sβ : Stream' Ξ±} : (β n, get sβ n = get sβ n) β sβ = sβ :=
fun h => funext h
#align stream.ext Stream'.ext
@[simp]
theorem get_zero_cons (a : Ξ±) (s : Stream' Ξ±) : get (a::s) 0 = a :=
rfl
#align stream.nth_zero_cons Stream'.get_zero_cons
@[simp]
theorem head_cons (a : Ξ±) (s : Stream' Ξ±) : head (a::s) = a :=
rfl
#align stream.head_cons Stream'.head_cons
@[simp]
theorem tail_cons (a : Ξ±) (s : Stream' Ξ±) : tail (a::s) = s :=
rfl
#align stream.tail_cons Stream'.tail_cons
@[simp]
theorem get_drop (n m : Nat) (s : Stream' Ξ±) : get (drop m s) n = get s (n + m) :=
rfl
#align stream.nth_drop Stream'.get_drop
theorem tail_eq_drop (s : Stream' Ξ±) : tail s = drop 1 s :=
rfl
#align stream.tail_eq_drop Stream'.tail_eq_drop
@[simp]
theorem drop_drop (n m : Nat) (s : Stream' Ξ±) : drop n (drop m s) = drop (n + m) s := by
ext; simp [Nat.add_assoc]
#align stream.drop_drop Stream'.drop_drop
@[simp] theorem get_tail {s : Stream' Ξ±} : s.tail.get n = s.get (n + 1) := rfl
@[simp] theorem tail_drop' {s : Stream' Ξ±} : tail (drop i s) = s.drop (i+1) := by
ext; simp [Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
@[simp] theorem drop_tail' {s : Stream' Ξ±} : drop i (tail s) = s.drop (i+1) := rfl
theorem tail_drop (n : Nat) (s : Stream' Ξ±) : tail (drop n s) = drop n (tail s) := by simp
#align stream.tail_drop Stream'.tail_drop
theorem get_succ (n : Nat) (s : Stream' Ξ±) : get s (succ n) = get (tail s) n :=
rfl
#align stream.nth_succ Stream'.get_succ
@[simp]
theorem get_succ_cons (n : Nat) (s : Stream' Ξ±) (x : Ξ±) : get (x::s) n.succ = get s n :=
rfl
#align stream.nth_succ_cons Stream'.get_succ_cons
@[simp] theorem drop_zero {s : Stream' Ξ±} : s.drop 0 = s := rfl
theorem drop_succ (n : Nat) (s : Stream' Ξ±) : drop (succ n) s = drop n (tail s) :=
rfl
#align stream.drop_succ Stream'.drop_succ
| Mathlib/Data/Stream/Init.lean | 94 | 94 | theorem head_drop (a : Stream' Ξ±) (n : β) : (a.drop n).head = a.get n := by | simp
| [
" (s.head :: s.tail) i = s i",
" (s.head :: s.tail) 0 = s 0",
" (s.head :: s.tail) (nβ + 1) = s (nβ + 1)",
" drop n (drop m s) = drop (n + m) s",
" (drop n (drop m s)).get nβ = (drop (n + m) s).get nβ",
" (drop i s).tail = drop (i + 1) s",
" (drop i s).tail.get nβ = (drop (i + 1) s).get nβ",
" (drop n... | [
" (s.head :: s.tail) i = s i",
" (s.head :: s.tail) 0 = s 0",
" (s.head :: s.tail) (nβ + 1) = s (nβ + 1)",
" drop n (drop m s) = drop (n + m) s",
" (drop n (drop m s)).get nβ = (drop (n + m) s).get nβ",
" (drop i s).tail = drop (i + 1) s",
" (drop i s).tail.get nβ = (drop (i + 1) s).get nβ",
" (drop n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.