Context stringlengths 57 92.3k | file_name stringlengths 21 79 | start int64 14 3.67k | end int64 18 3.69k | theorem stringlengths 25 2.71k | proof stringlengths 5 10.6k |
|---|---|---|---|---|---|
import Mathlib.Data.Real.Sqrt
import Mathlib.Analysis.NormedSpace.Star.Basic
import Mathlib.Analysis.NormedSpace.ContinuousLinearMap
import Mathlib.Analysis.NormedSpace.Basic
#align_import data.is_R_or_C.basic from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb"
section
local notation "π" => algebraMap β _
open ComplexConjugate
class RCLike (K : semiOutParam Type*) extends DenselyNormedField K, StarRing K,
NormedAlgebra β K, CompleteSpace K where
re : K β+ β
im : K β+ β
I : K
I_re_ax : re I = 0
I_mul_I_ax : I = 0 β¨ I * I = -1
re_add_im_ax : β z : K, π (re z) + π (im z) * I = z
ofReal_re_ax : β r : β, re (π r) = r
ofReal_im_ax : β r : β, im (π r) = 0
mul_re_ax : β z w : K, re (z * w) = re z * re w - im z * im w
mul_im_ax : β z w : K, im (z * w) = re z * im w + im z * re w
conj_re_ax : β z : K, re (conj z) = re z
conj_im_ax : β z : K, im (conj z) = -im z
conj_I_ax : conj I = -I
norm_sq_eq_def_ax : β z : K, βzβ ^ 2 = re z * re z + im z * im z
mul_im_I_ax : β z : K, im z * im I = im z
[toPartialOrder : PartialOrder K]
le_iff_re_im {z w : K} : z β€ w β re z β€ re w β§ im z = im w
-- note we cannot put this in the `extends` clause
[toDecidableEq : DecidableEq K]
#align is_R_or_C RCLike
scoped[ComplexOrder] attribute [instance 100] RCLike.toPartialOrder
attribute [instance 100] RCLike.toDecidableEq
end
variable {K E : Type*} [RCLike K]
namespace RCLike
open ComplexConjugate
@[coe] abbrev ofReal : β β K := Algebra.cast
noncomputable instance (priority := 900) algebraMapCoe : CoeTC β K :=
β¨ofRealβ©
#align is_R_or_C.algebra_map_coe RCLike.algebraMapCoe
theorem ofReal_alg (x : β) : (x : K) = x β’ (1 : K) :=
Algebra.algebraMap_eq_smul_one x
#align is_R_or_C.of_real_alg RCLike.ofReal_alg
theorem real_smul_eq_coe_mul (r : β) (z : K) : r β’ z = (r : K) * z :=
Algebra.smul_def r z
#align is_R_or_C.real_smul_eq_coe_mul RCLike.real_smul_eq_coe_mul
theorem real_smul_eq_coe_smul [AddCommGroup E] [Module K E] [Module β E] [IsScalarTower β K E]
(r : β) (x : E) : r β’ x = (r : K) β’ x := by rw [RCLike.ofReal_alg, smul_one_smul]
#align is_R_or_C.real_smul_eq_coe_smul RCLike.real_smul_eq_coe_smul
theorem algebraMap_eq_ofReal : β(algebraMap β K) = ofReal :=
rfl
#align is_R_or_C.algebra_map_eq_of_real RCLike.algebraMap_eq_ofReal
@[simp, rclike_simps]
theorem re_add_im (z : K) : (re z : K) + im z * I = z :=
RCLike.re_add_im_ax z
#align is_R_or_C.re_add_im RCLike.re_add_im
@[simp, norm_cast, rclike_simps]
theorem ofReal_re : β r : β, re (r : K) = r :=
RCLike.ofReal_re_ax
#align is_R_or_C.of_real_re RCLike.ofReal_re
@[simp, norm_cast, rclike_simps]
theorem ofReal_im : β r : β, im (r : K) = 0 :=
RCLike.ofReal_im_ax
#align is_R_or_C.of_real_im RCLike.ofReal_im
@[simp, rclike_simps]
theorem mul_re : β z w : K, re (z * w) = re z * re w - im z * im w :=
RCLike.mul_re_ax
#align is_R_or_C.mul_re RCLike.mul_re
@[simp, rclike_simps]
theorem mul_im : β z w : K, im (z * w) = re z * im w + im z * re w :=
RCLike.mul_im_ax
#align is_R_or_C.mul_im RCLike.mul_im
theorem ext_iff {z w : K} : z = w β re z = re w β§ im z = im w :=
β¨fun h => h βΈ β¨rfl, rflβ©, fun β¨hβ, hββ© => re_add_im z βΈ re_add_im w βΈ hβ βΈ hβ βΈ rflβ©
#align is_R_or_C.ext_iff RCLike.ext_iff
theorem ext {z w : K} (hre : re z = re w) (him : im z = im w) : z = w :=
ext_iff.2 β¨hre, himβ©
#align is_R_or_C.ext RCLike.ext
@[norm_cast]
theorem ofReal_zero : ((0 : β) : K) = 0 :=
algebraMap.coe_zero
#align is_R_or_C.of_real_zero RCLike.ofReal_zero
@[rclike_simps]
theorem zero_re' : re (0 : K) = (0 : β) :=
map_zero re
#align is_R_or_C.zero_re' RCLike.zero_re'
@[norm_cast]
theorem ofReal_one : ((1 : β) : K) = 1 :=
map_one (algebraMap β K)
#align is_R_or_C.of_real_one RCLike.ofReal_one
@[simp, rclike_simps]
theorem one_re : re (1 : K) = 1 := by rw [β ofReal_one, ofReal_re]
#align is_R_or_C.one_re RCLike.one_re
@[simp, rclike_simps]
theorem one_im : im (1 : K) = 0 := by rw [β ofReal_one, ofReal_im]
#align is_R_or_C.one_im RCLike.one_im
theorem ofReal_injective : Function.Injective ((β) : β β K) :=
(algebraMap β K).injective
#align is_R_or_C.of_real_injective RCLike.ofReal_injective
@[norm_cast]
theorem ofReal_inj {z w : β} : (z : K) = (w : K) β z = w :=
algebraMap.coe_inj
#align is_R_or_C.of_real_inj RCLike.ofReal_inj
-- replaced by `RCLike.ofNat_re`
#noalign is_R_or_C.bit0_re
#noalign is_R_or_C.bit1_re
-- replaced by `RCLike.ofNat_im`
#noalign is_R_or_C.bit0_im
#noalign is_R_or_C.bit1_im
theorem ofReal_eq_zero {x : β} : (x : K) = 0 β x = 0 :=
algebraMap.lift_map_eq_zero_iff x
#align is_R_or_C.of_real_eq_zero RCLike.ofReal_eq_zero
theorem ofReal_ne_zero {x : β} : (x : K) β 0 β x β 0 :=
ofReal_eq_zero.not
#align is_R_or_C.of_real_ne_zero RCLike.ofReal_ne_zero
@[simp, rclike_simps, norm_cast]
theorem ofReal_add (r s : β) : ((r + s : β) : K) = r + s :=
algebraMap.coe_add _ _
#align is_R_or_C.of_real_add RCLike.ofReal_add
-- replaced by `RCLike.ofReal_ofNat`
#noalign is_R_or_C.of_real_bit0
#noalign is_R_or_C.of_real_bit1
@[simp, norm_cast, rclike_simps]
theorem ofReal_neg (r : β) : ((-r : β) : K) = -r :=
algebraMap.coe_neg r
#align is_R_or_C.of_real_neg RCLike.ofReal_neg
@[simp, norm_cast, rclike_simps]
theorem ofReal_sub (r s : β) : ((r - s : β) : K) = r - s :=
map_sub (algebraMap β K) r s
#align is_R_or_C.of_real_sub RCLike.ofReal_sub
@[simp, rclike_simps, norm_cast]
theorem ofReal_sum {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β β) :
((β i β s, f i : β) : K) = β i β s, (f i : K) :=
map_sum (algebraMap β K) _ _
#align is_R_or_C.of_real_sum RCLike.ofReal_sum
@[simp, rclike_simps, norm_cast]
theorem ofReal_finsupp_sum {Ξ± M : Type*} [Zero M] (f : Ξ± ββ M) (g : Ξ± β M β β) :
((f.sum fun a b => g a b : β) : K) = f.sum fun a b => (g a b : K) :=
map_finsupp_sum (algebraMap β K) f g
#align is_R_or_C.of_real_finsupp_sum RCLike.ofReal_finsupp_sum
@[simp, norm_cast, rclike_simps]
theorem ofReal_mul (r s : β) : ((r * s : β) : K) = r * s :=
algebraMap.coe_mul _ _
#align is_R_or_C.of_real_mul RCLike.ofReal_mul
@[simp, norm_cast, rclike_simps]
theorem ofReal_pow (r : β) (n : β) : ((r ^ n : β) : K) = (r : K) ^ n :=
map_pow (algebraMap β K) r n
#align is_R_or_C.of_real_pow RCLike.ofReal_pow
@[simp, rclike_simps, norm_cast]
theorem ofReal_prod {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β β) :
((β i β s, f i : β) : K) = β i β s, (f i : K) :=
map_prod (algebraMap β K) _ _
#align is_R_or_C.of_real_prod RCLike.ofReal_prod
@[simp, rclike_simps, norm_cast]
theorem ofReal_finsupp_prod {Ξ± M : Type*} [Zero M] (f : Ξ± ββ M) (g : Ξ± β M β β) :
((f.prod fun a b => g a b : β) : K) = f.prod fun a b => (g a b : K) :=
map_finsupp_prod _ f g
#align is_R_or_C.of_real_finsupp_prod RCLike.ofReal_finsupp_prod
@[simp, norm_cast, rclike_simps]
theorem real_smul_ofReal (r x : β) : r β’ (x : K) = (r : K) * (x : K) :=
real_smul_eq_coe_mul _ _
#align is_R_or_C.real_smul_of_real RCLike.real_smul_ofReal
@[rclike_simps]
theorem re_ofReal_mul (r : β) (z : K) : re (βr * z) = r * re z := by
simp only [mul_re, ofReal_im, zero_mul, ofReal_re, sub_zero]
#align is_R_or_C.of_real_mul_re RCLike.re_ofReal_mul
@[rclike_simps]
theorem im_ofReal_mul (r : β) (z : K) : im (βr * z) = r * im z := by
simp only [add_zero, ofReal_im, zero_mul, ofReal_re, mul_im]
#align is_R_or_C.of_real_mul_im RCLike.im_ofReal_mul
@[rclike_simps]
theorem smul_re (r : β) (z : K) : re (r β’ z) = r * re z := by
rw [real_smul_eq_coe_mul, re_ofReal_mul]
#align is_R_or_C.smul_re RCLike.smul_re
@[rclike_simps]
theorem smul_im (r : β) (z : K) : im (r β’ z) = r * im z := by
rw [real_smul_eq_coe_mul, im_ofReal_mul]
#align is_R_or_C.smul_im RCLike.smul_im
@[simp, norm_cast, rclike_simps]
theorem norm_ofReal (r : β) : β(r : K)β = |r| :=
norm_algebraMap' K r
#align is_R_or_C.norm_of_real RCLike.norm_ofReal
-- see Note [lower instance priority]
instance (priority := 100) charZero_rclike : CharZero K :=
(RingHom.charZero_iff (algebraMap β K).injective).1 inferInstance
set_option linter.uppercaseLean3 false in
#align is_R_or_C.char_zero_R_or_C RCLike.charZero_rclike
@[simp, rclike_simps]
theorem I_re : re (I : K) = 0 :=
I_re_ax
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_re RCLike.I_re
@[simp, rclike_simps]
theorem I_im (z : K) : im z * im (I : K) = im z :=
mul_im_I_ax z
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_im RCLike.I_im
@[simp, rclike_simps]
theorem I_im' (z : K) : im (I : K) * im z = im z := by rw [mul_comm, I_im]
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_im' RCLike.I_im'
@[rclike_simps] -- porting note (#10618): was `simp`
theorem I_mul_re (z : K) : re (I * z) = -im z := by
simp only [I_re, zero_sub, I_im', zero_mul, mul_re]
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_mul_re RCLike.I_mul_re
theorem I_mul_I : (I : K) = 0 β¨ (I : K) * I = -1 :=
I_mul_I_ax
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_mul_I RCLike.I_mul_I
variable (π) in
lemma I_eq_zero_or_im_I_eq_one : (I : K) = 0 β¨ im (I : K) = 1 :=
I_mul_I (K := K) |>.imp_right fun h β¦ by simpa [h] using (I_mul_re (I : K)).symm
@[simp, rclike_simps]
theorem conj_re (z : K) : re (conj z) = re z :=
RCLike.conj_re_ax z
#align is_R_or_C.conj_re RCLike.conj_re
@[simp, rclike_simps]
theorem conj_im (z : K) : im (conj z) = -im z :=
RCLike.conj_im_ax z
#align is_R_or_C.conj_im RCLike.conj_im
@[simp, rclike_simps]
theorem conj_I : conj (I : K) = -I :=
RCLike.conj_I_ax
set_option linter.uppercaseLean3 false in
#align is_R_or_C.conj_I RCLike.conj_I
@[simp, rclike_simps]
theorem conj_ofReal (r : β) : conj (r : K) = (r : K) := by
rw [ext_iff]
simp only [ofReal_im, conj_im, eq_self_iff_true, conj_re, and_self_iff, neg_zero]
#align is_R_or_C.conj_of_real RCLike.conj_ofReal
-- replaced by `RCLike.conj_ofNat`
#noalign is_R_or_C.conj_bit0
#noalign is_R_or_C.conj_bit1
theorem conj_nat_cast (n : β) : conj (n : K) = n := map_natCast _ _
-- See note [no_index around OfNat.ofNat]
theorem conj_ofNat (n : β) [n.AtLeastTwo] : conj (no_index (OfNat.ofNat n : K)) = OfNat.ofNat n :=
map_ofNat _ _
@[rclike_simps] -- Porting note (#10618): was a `simp` but `simp` can prove it
theorem conj_neg_I : conj (-I) = (I : K) := by rw [map_neg, conj_I, neg_neg]
set_option linter.uppercaseLean3 false in
#align is_R_or_C.conj_neg_I RCLike.conj_neg_I
theorem conj_eq_re_sub_im (z : K) : conj z = re z - im z * I :=
(congr_arg conj (re_add_im z).symm).trans <| by
rw [map_add, map_mul, conj_I, conj_ofReal, conj_ofReal, mul_neg, sub_eq_add_neg]
#align is_R_or_C.conj_eq_re_sub_im RCLike.conj_eq_re_sub_im
theorem sub_conj (z : K) : z - conj z = 2 * im z * I :=
calc
z - conj z = re z + im z * I - (re z - im z * I) := by rw [re_add_im, β conj_eq_re_sub_im]
_ = 2 * im z * I := by rw [add_sub_sub_cancel, β two_mul, mul_assoc]
#align is_R_or_C.sub_conj RCLike.sub_conj
@[rclike_simps]
theorem conj_smul (r : β) (z : K) : conj (r β’ z) = r β’ conj z := by
rw [conj_eq_re_sub_im, conj_eq_re_sub_im, smul_re, smul_im, ofReal_mul, ofReal_mul,
real_smul_eq_coe_mul r (_ - _), mul_sub, mul_assoc]
#align is_R_or_C.conj_smul RCLike.conj_smul
theorem add_conj (z : K) : z + conj z = 2 * re z :=
calc
z + conj z = re z + im z * I + (re z - im z * I) := by rw [re_add_im, conj_eq_re_sub_im]
_ = 2 * re z := by rw [add_add_sub_cancel, two_mul]
#align is_R_or_C.add_conj RCLike.add_conj
theorem re_eq_add_conj (z : K) : β(re z) = (z + conj z) / 2 := by
rw [add_conj, mul_div_cancel_leftβ (re z : K) two_ne_zero]
#align is_R_or_C.re_eq_add_conj RCLike.re_eq_add_conj
theorem im_eq_conj_sub (z : K) : β(im z) = I * (conj z - z) / 2 := by
rw [β neg_inj, β ofReal_neg, β I_mul_re, re_eq_add_conj, map_mul, conj_I, β neg_div, β mul_neg,
neg_sub, mul_sub, neg_mul, sub_eq_add_neg]
#align is_R_or_C.im_eq_conj_sub RCLike.im_eq_conj_sub
open List in
theorem is_real_TFAE (z : K) : TFAE [conj z = z, β r : β, (r : K) = z, β(re z) = z, im z = 0] := by
tfae_have 1 β 4
Β· intro h
rw [β @ofReal_inj K, im_eq_conj_sub, h, sub_self, mul_zero, zero_div,
ofReal_zero]
tfae_have 4 β 3
Β· intro h
conv_rhs => rw [β re_add_im z, h, ofReal_zero, zero_mul, add_zero]
tfae_have 3 β 2
Β· exact fun h => β¨_, hβ©
tfae_have 2 β 1
Β· exact fun β¨r, hrβ© => hr βΈ conj_ofReal _
tfae_finish
#align is_R_or_C.is_real_tfae RCLike.is_real_TFAE
theorem conj_eq_iff_real {z : K} : conj z = z β β r : β, z = (r : K) :=
((is_real_TFAE z).out 0 1).trans <| by simp only [eq_comm]
#align is_R_or_C.conj_eq_iff_real RCLike.conj_eq_iff_real
theorem conj_eq_iff_re {z : K} : conj z = z β (re z : K) = z :=
(is_real_TFAE z).out 0 2
#align is_R_or_C.conj_eq_iff_re RCLike.conj_eq_iff_re
theorem conj_eq_iff_im {z : K} : conj z = z β im z = 0 :=
(is_real_TFAE z).out 0 3
#align is_R_or_C.conj_eq_iff_im RCLike.conj_eq_iff_im
@[simp]
theorem star_def : (Star.star : K β K) = conj :=
rfl
#align is_R_or_C.star_def RCLike.star_def
variable (K)
abbrev conjToRingEquiv : K β+* Kα΅α΅α΅ :=
starRingEquiv
#align is_R_or_C.conj_to_ring_equiv RCLike.conjToRingEquiv
variable {K} {z : K}
def normSq : K β*β β where
toFun z := re z * re z + im z * im z
map_zero' := by simp only [add_zero, mul_zero, map_zero]
map_one' := by simp only [one_im, add_zero, mul_one, one_re, mul_zero]
map_mul' z w := by
simp only [mul_im, mul_re]
ring
#align is_R_or_C.norm_sq RCLike.normSq
theorem normSq_apply (z : K) : normSq z = re z * re z + im z * im z :=
rfl
#align is_R_or_C.norm_sq_apply RCLike.normSq_apply
theorem norm_sq_eq_def {z : K} : βzβ ^ 2 = re z * re z + im z * im z :=
norm_sq_eq_def_ax z
#align is_R_or_C.norm_sq_eq_def RCLike.norm_sq_eq_def
theorem normSq_eq_def' (z : K) : normSq z = βzβ ^ 2 :=
norm_sq_eq_def.symm
#align is_R_or_C.norm_sq_eq_def' RCLike.normSq_eq_def'
@[rclike_simps]
theorem normSq_zero : normSq (0 : K) = 0 :=
normSq.map_zero
#align is_R_or_C.norm_sq_zero RCLike.normSq_zero
@[rclike_simps]
theorem normSq_one : normSq (1 : K) = 1 :=
normSq.map_one
#align is_R_or_C.norm_sq_one RCLike.normSq_one
theorem normSq_nonneg (z : K) : 0 β€ normSq z :=
add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)
#align is_R_or_C.norm_sq_nonneg RCLike.normSq_nonneg
@[rclike_simps] -- porting note (#10618): was `simp`
theorem normSq_eq_zero {z : K} : normSq z = 0 β z = 0 :=
map_eq_zero _
#align is_R_or_C.norm_sq_eq_zero RCLike.normSq_eq_zero
@[simp, rclike_simps]
theorem normSq_pos {z : K} : 0 < normSq z β z β 0 := by
rw [lt_iff_le_and_ne, Ne, eq_comm]; simp [normSq_nonneg]
#align is_R_or_C.norm_sq_pos RCLike.normSq_pos
@[simp, rclike_simps]
theorem normSq_neg (z : K) : normSq (-z) = normSq z := by simp only [normSq_eq_def', norm_neg]
#align is_R_or_C.norm_sq_neg RCLike.normSq_neg
@[simp, rclike_simps]
theorem normSq_conj (z : K) : normSq (conj z) = normSq z := by
simp only [normSq_apply, neg_mul, mul_neg, neg_neg, rclike_simps]
#align is_R_or_C.norm_sq_conj RCLike.normSq_conj
@[rclike_simps] -- porting note (#10618): was `simp`
theorem normSq_mul (z w : K) : normSq (z * w) = normSq z * normSq w :=
map_mul _ z w
#align is_R_or_C.norm_sq_mul RCLike.normSq_mul
theorem normSq_add (z w : K) : normSq (z + w) = normSq z + normSq w + 2 * re (z * conj w) := by
simp only [normSq_apply, map_add, rclike_simps]
ring
#align is_R_or_C.norm_sq_add RCLike.normSq_add
theorem re_sq_le_normSq (z : K) : re z * re z β€ normSq z :=
le_add_of_nonneg_right (mul_self_nonneg _)
#align is_R_or_C.re_sq_le_norm_sq RCLike.re_sq_le_normSq
theorem im_sq_le_normSq (z : K) : im z * im z β€ normSq z :=
le_add_of_nonneg_left (mul_self_nonneg _)
#align is_R_or_C.im_sq_le_norm_sq RCLike.im_sq_le_normSq
theorem mul_conj (z : K) : z * conj z = βzβ ^ 2 := by
apply ext <;> simp [β ofReal_pow, norm_sq_eq_def, mul_comm]
#align is_R_or_C.mul_conj RCLike.mul_conj
theorem conj_mul (z : K) : conj z * z = βzβ ^ 2 := by rw [mul_comm, mul_conj]
#align is_R_or_C.conj_mul RCLike.conj_mul
lemma inv_eq_conj (hz : βzβ = 1) : zβ»ΒΉ = conj z :=
inv_eq_of_mul_eq_one_left $ by simp_rw [conj_mul, hz, algebraMap.coe_one, one_pow]
theorem normSq_sub (z w : K) : normSq (z - w) = normSq z + normSq w - 2 * re (z * conj w) := by
simp only [normSq_add, sub_eq_add_neg, map_neg, mul_neg, normSq_neg, map_neg]
#align is_R_or_C.norm_sq_sub RCLike.normSq_sub
theorem sqrt_normSq_eq_norm {z : K} : β(normSq z) = βzβ := by
rw [normSq_eq_def', Real.sqrt_sq (norm_nonneg _)]
#align is_R_or_C.sqrt_norm_sq_eq_norm RCLike.sqrt_normSq_eq_norm
@[simp, norm_cast, rclike_simps]
theorem ofReal_inv (r : β) : ((rβ»ΒΉ : β) : K) = (r : K)β»ΒΉ :=
map_invβ _ r
#align is_R_or_C.of_real_inv RCLike.ofReal_inv
theorem inv_def (z : K) : zβ»ΒΉ = conj z * ((βzβ ^ 2)β»ΒΉ : β) := by
rcases eq_or_ne z 0 with (rfl | hβ)
Β· simp
Β· apply inv_eq_of_mul_eq_one_right
rw [β mul_assoc, mul_conj, ofReal_inv, ofReal_pow, mul_inv_cancel]
simpa
#align is_R_or_C.inv_def RCLike.inv_def
@[simp, rclike_simps]
theorem inv_re (z : K) : re zβ»ΒΉ = re z / normSq z := by
rw [inv_def, normSq_eq_def', mul_comm, re_ofReal_mul, conj_re, div_eq_inv_mul]
#align is_R_or_C.inv_re RCLike.inv_re
@[simp, rclike_simps]
theorem inv_im (z : K) : im zβ»ΒΉ = -im z / normSq z := by
rw [inv_def, normSq_eq_def', mul_comm, im_ofReal_mul, conj_im, div_eq_inv_mul]
#align is_R_or_C.inv_im RCLike.inv_im
theorem div_re (z w : K) : re (z / w) = re z * re w / normSq w + im z * im w / normSq w := by
simp only [div_eq_mul_inv, mul_assoc, sub_eq_add_neg, neg_mul, mul_neg, neg_neg, map_neg,
rclike_simps]
#align is_R_or_C.div_re RCLike.div_re
theorem div_im (z w : K) : im (z / w) = im z * re w / normSq w - re z * im w / normSq w := by
simp only [div_eq_mul_inv, mul_assoc, sub_eq_add_neg, add_comm, neg_mul, mul_neg, map_neg,
rclike_simps]
#align is_R_or_C.div_im RCLike.div_im
@[rclike_simps] -- porting note (#10618): was `simp`
theorem conj_inv (x : K) : conj xβ»ΒΉ = (conj x)β»ΒΉ :=
star_inv' _
#align is_R_or_C.conj_inv RCLike.conj_inv
lemma conj_div (x y : K) : conj (x / y) = conj x / conj y := map_div' conj conj_inv _ _
--TODO: Do we rather want the map as an explicit definition?
lemma exists_norm_eq_mul_self (x : K) : β c, βcβ = 1 β§ ββxβ = c * x := by
obtain rfl | hx := eq_or_ne x 0
Β· exact β¨1, by simpβ©
Β· exact β¨βxβ / x, by simp [norm_ne_zero_iff.2, hx]β©
lemma exists_norm_mul_eq_self (x : K) : β c, βcβ = 1 β§ c * βxβ = x := by
obtain rfl | hx := eq_or_ne x 0
Β· exact β¨1, by simpβ©
Β· exact β¨x / βxβ, by simp [norm_ne_zero_iff.2, hx]β©
@[simp, norm_cast, rclike_simps]
theorem ofReal_div (r s : β) : ((r / s : β) : K) = r / s :=
map_divβ (algebraMap β K) r s
#align is_R_or_C.of_real_div RCLike.ofReal_div
theorem div_re_ofReal {z : K} {r : β} : re (z / r) = re z / r := by
rw [div_eq_inv_mul, div_eq_inv_mul, β ofReal_inv, re_ofReal_mul]
#align is_R_or_C.div_re_of_real RCLike.div_re_ofReal
@[simp, norm_cast, rclike_simps]
theorem ofReal_zpow (r : β) (n : β€) : ((r ^ n : β) : K) = (r : K) ^ n :=
map_zpowβ (algebraMap β K) r n
#align is_R_or_C.of_real_zpow RCLike.ofReal_zpow
theorem I_mul_I_of_nonzero : (I : K) β 0 β (I : K) * I = -1 :=
I_mul_I_ax.resolve_left
set_option linter.uppercaseLean3 false in
#align is_R_or_C.I_mul_I_of_nonzero RCLike.I_mul_I_of_nonzero
@[simp, rclike_simps]
theorem inv_I : (I : K)β»ΒΉ = -I := by
by_cases h : (I : K) = 0
Β· simp [h]
Β· field_simp [I_mul_I_of_nonzero h]
set_option linter.uppercaseLean3 false in
#align is_R_or_C.inv_I RCLike.inv_I
@[simp, rclike_simps]
theorem div_I (z : K) : z / I = -(z * I) := by rw [div_eq_mul_inv, inv_I, mul_neg]
set_option linter.uppercaseLean3 false in
#align is_R_or_C.div_I RCLike.div_I
@[rclike_simps] -- porting note (#10618): was `simp`
theorem normSq_inv (z : K) : normSq zβ»ΒΉ = (normSq z)β»ΒΉ :=
map_invβ normSq z
#align is_R_or_C.norm_sq_inv RCLike.normSq_inv
@[rclike_simps] -- porting note (#10618): was `simp`
theorem normSq_div (z w : K) : normSq (z / w) = normSq z / normSq w :=
map_divβ normSq z w
#align is_R_or_C.norm_sq_div RCLike.normSq_div
@[rclike_simps] -- porting note (#10618): was `simp`
theorem norm_conj {z : K} : βconj zβ = βzβ := by simp only [β sqrt_normSq_eq_norm, normSq_conj]
#align is_R_or_C.norm_conj RCLike.norm_conj
instance (priority := 100) : CstarRing K where
norm_star_mul_self {x} := (norm_mul _ _).trans <| congr_arg (Β· * βxβ) norm_conj
@[simp, rclike_simps, norm_cast]
theorem ofReal_natCast (n : β) : ((n : β) : K) = n :=
map_natCast (algebraMap β K) n
#align is_R_or_C.of_real_nat_cast RCLike.ofReal_natCast
@[simp, rclike_simps] -- Porting note: removed `norm_cast`
theorem natCast_re (n : β) : re (n : K) = n := by rw [β ofReal_natCast, ofReal_re]
#align is_R_or_C.nat_cast_re RCLike.natCast_re
@[simp, rclike_simps, norm_cast]
theorem natCast_im (n : β) : im (n : K) = 0 := by rw [β ofReal_natCast, ofReal_im]
#align is_R_or_C.nat_cast_im RCLike.natCast_im
-- See note [no_index around OfNat.ofNat]
@[simp, rclike_simps]
theorem ofNat_re (n : β) [n.AtLeastTwo] : re (no_index (OfNat.ofNat n) : K) = OfNat.ofNat n :=
natCast_re n
-- See note [no_index around OfNat.ofNat]
@[simp, rclike_simps]
theorem ofNat_im (n : β) [n.AtLeastTwo] : im (no_index (OfNat.ofNat n) : K) = 0 :=
natCast_im n
-- See note [no_index around OfNat.ofNat]
@[simp, rclike_simps, norm_cast]
theorem ofReal_ofNat (n : β) [n.AtLeastTwo] :
((no_index (OfNat.ofNat n) : β) : K) = OfNat.ofNat n :=
ofReal_natCast n
theorem ofNat_mul_re (n : β) [n.AtLeastTwo] (z : K) :
re (OfNat.ofNat n * z) = OfNat.ofNat n * re z := by
rw [β ofReal_ofNat, re_ofReal_mul]
| Mathlib/Analysis/RCLike/Basic.lean | 662 | 664 | theorem ofNat_mul_im (n : β) [n.AtLeastTwo] (z : K) :
im (OfNat.ofNat n * z) = OfNat.ofNat n * im z := by |
rw [β ofReal_ofNat, im_ofReal_mul]
|
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
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 := π)]
theorem iteratedFDeriv_succ_const (n : β) (c : F) :
(iteratedFDeriv π (n + 1) fun _ : E β¦ c) = 0 :=
funext fun x β¦ by simpa [β iteratedFDerivWithin_univ] using
iteratedFDerivWithin_succ_const n c uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_succ_const iteratedFDeriv_succ_const
theorem iteratedFDerivWithin_const_of_ne {n : β} (hn : n β 0) (c : F)
(hs : UniqueDiffOn π s) (hx : x β s) :
iteratedFDerivWithin π n (fun _ : E β¦ c) s x = 0 := by
cases n with
| zero => contradiction
| succ n => exact iteratedFDerivWithin_succ_const n c hs hx
theorem iteratedFDeriv_const_of_ne {n : β} (hn : n β 0) (c : F) :
(iteratedFDeriv π n fun _ : E β¦ c) = 0 :=
funext fun x β¦ by simpa [β iteratedFDerivWithin_univ] using
iteratedFDerivWithin_const_of_ne hn c uniqueDiffOn_univ (mem_univ x)
#align iterated_fderiv_const_of_ne iteratedFDeriv_const_of_ne
theorem IsBoundedLinearMap.contDiff (hf : IsBoundedLinearMap π f) : ContDiff π n f := by
suffices h : ContDiff π β f from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine β¨hf.differentiable, ?_β©
simp_rw [hf.fderiv]
exact contDiff_const
#align is_bounded_linear_map.cont_diff IsBoundedLinearMap.contDiff
theorem ContinuousLinearMap.contDiff (f : E βL[π] F) : ContDiff π n f :=
f.isBoundedLinearMap.contDiff
#align continuous_linear_map.cont_diff ContinuousLinearMap.contDiff
theorem ContinuousLinearEquiv.contDiff (f : E βL[π] F) : ContDiff π n f :=
(f : E βL[π] F).contDiff
#align continuous_linear_equiv.cont_diff ContinuousLinearEquiv.contDiff
theorem LinearIsometry.contDiff (f : E ββα΅’[π] F) : ContDiff π n f :=
f.toContinuousLinearMap.contDiff
#align linear_isometry.cont_diff LinearIsometry.contDiff
theorem LinearIsometryEquiv.contDiff (f : E ββα΅’[π] F) : ContDiff π n f :=
(f : E βL[π] F).contDiff
#align linear_isometry_equiv.cont_diff LinearIsometryEquiv.contDiff
theorem contDiff_id : ContDiff π n (id : E β E) :=
IsBoundedLinearMap.id.contDiff
#align cont_diff_id contDiff_id
theorem contDiffWithinAt_id {s x} : ContDiffWithinAt π n (id : E β E) s x :=
contDiff_id.contDiffWithinAt
#align cont_diff_within_at_id contDiffWithinAt_id
theorem contDiffAt_id {x} : ContDiffAt π n (id : E β E) x :=
contDiff_id.contDiffAt
#align cont_diff_at_id contDiffAt_id
theorem contDiffOn_id {s} : ContDiffOn π n (id : E β E) s :=
contDiff_id.contDiffOn
#align cont_diff_on_id contDiffOn_id
theorem IsBoundedBilinearMap.contDiff (hb : IsBoundedBilinearMap π b) : ContDiff π n b := by
suffices h : ContDiff π β b from h.of_le le_top
rw [contDiff_top_iff_fderiv]
refine β¨hb.differentiable, ?_β©
simp only [hb.fderiv]
exact hb.isBoundedLinearMap_deriv.contDiff
#align is_bounded_bilinear_map.cont_diff IsBoundedBilinearMap.contDiff
theorem HasFTaylorSeriesUpToOn.continuousLinearMap_comp (g : F βL[π] G)
(hf : HasFTaylorSeriesUpToOn n f p s) :
HasFTaylorSeriesUpToOn n (g β f) (fun x k => g.compContinuousMultilinearMap (p x k)) s where
zero_eq x hx := congr_arg g (hf.zero_eq x hx)
fderivWithin m hm x hx := (ContinuousLinearMap.compContinuousMultilinearMapL π
(fun _ : Fin m => E) F G g).hasFDerivAt.comp_hasFDerivWithinAt x (hf.fderivWithin m hm x hx)
cont m hm := (ContinuousLinearMap.compContinuousMultilinearMapL π
(fun _ : Fin m => E) F G g).continuous.comp_continuousOn (hf.cont m hm)
#align has_ftaylor_series_up_to_on.continuous_linear_map_comp HasFTaylorSeriesUpToOn.continuousLinearMap_comp
theorem ContDiffWithinAt.continuousLinearMap_comp (g : F βL[π] G)
(hf : ContDiffWithinAt π n f s x) : ContDiffWithinAt π n (g β f) s x := fun m hm β¦ by
rcases hf m hm with β¨u, hu, p, hpβ©
exact β¨u, hu, _, hp.continuousLinearMap_comp gβ©
#align cont_diff_within_at.continuous_linear_map_comp ContDiffWithinAt.continuousLinearMap_comp
theorem ContDiffAt.continuousLinearMap_comp (g : F βL[π] G) (hf : ContDiffAt π n f x) :
ContDiffAt π n (g β f) x :=
ContDiffWithinAt.continuousLinearMap_comp g hf
#align cont_diff_at.continuous_linear_map_comp ContDiffAt.continuousLinearMap_comp
theorem ContDiffOn.continuousLinearMap_comp (g : F βL[π] G) (hf : ContDiffOn π n f s) :
ContDiffOn π n (g β f) s := fun x hx => (hf x hx).continuousLinearMap_comp g
#align cont_diff_on.continuous_linear_map_comp ContDiffOn.continuousLinearMap_comp
theorem ContDiff.continuousLinearMap_comp {f : E β F} (g : F βL[π] G) (hf : ContDiff π n f) :
ContDiff π n fun x => g (f x) :=
contDiffOn_univ.1 <| ContDiffOn.continuousLinearMap_comp _ (contDiffOn_univ.2 hf)
#align cont_diff.continuous_linear_map_comp ContDiff.continuousLinearMap_comp
theorem ContinuousLinearMap.iteratedFDerivWithin_comp_left {f : E β F} (g : F βL[π] G)
(hf : ContDiffOn π n f s) (hs : UniqueDiffOn π s) (hx : x β s) {i : β} (hi : (i : ββ) β€ n) :
iteratedFDerivWithin π i (g β f) s x =
g.compContinuousMultilinearMap (iteratedFDerivWithin π i f s x) :=
(((hf.ftaylorSeriesWithin hs).continuousLinearMap_comp g).eq_iteratedFDerivWithin_of_uniqueDiffOn
hi hs hx).symm
#align continuous_linear_map.iterated_fderiv_within_comp_left ContinuousLinearMap.iteratedFDerivWithin_comp_left
theorem ContinuousLinearMap.iteratedFDeriv_comp_left {f : E β F} (g : F βL[π] G)
(hf : ContDiff π n f) (x : E) {i : β} (hi : (i : ββ) β€ n) :
iteratedFDeriv π i (g β f) x = g.compContinuousMultilinearMap (iteratedFDeriv π i f x) := by
simp only [β iteratedFDerivWithin_univ]
exact g.iteratedFDerivWithin_comp_left hf.contDiffOn uniqueDiffOn_univ (mem_univ x) hi
#align continuous_linear_map.iterated_fderiv_comp_left ContinuousLinearMap.iteratedFDeriv_comp_left
theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_left (g : F βL[π] G) (f : E β F)
(hs : UniqueDiffOn π s) (hx : x β s) (i : β) :
iteratedFDerivWithin π i (g β f) s x =
(g : F βL[π] G).compContinuousMultilinearMap (iteratedFDerivWithin π i f s x) := by
induction' i with i IH generalizing x
Β· ext1 m
simp only [Nat.zero_eq, iteratedFDerivWithin_zero_apply, comp_apply,
ContinuousLinearMap.compContinuousMultilinearMap_coe, coe_coe]
Β· ext1 m
rw [iteratedFDerivWithin_succ_apply_left]
have Z : fderivWithin π (iteratedFDerivWithin π i (g β f) s) s x =
fderivWithin π (g.compContinuousMultilinearMapL (fun _ : Fin i => E) β
iteratedFDerivWithin π i f s) s x :=
fderivWithin_congr' (@IH) hx
simp_rw [Z]
rw [(g.compContinuousMultilinearMapL fun _ : Fin i => E).comp_fderivWithin (hs x hx)]
simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_apply,
ContinuousLinearEquiv.compContinuousMultilinearMapL_apply,
ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
rw [iteratedFDerivWithin_succ_apply_left]
#align continuous_linear_equiv.iterated_fderiv_within_comp_left ContinuousLinearEquiv.iteratedFDerivWithin_comp_left
theorem LinearIsometry.norm_iteratedFDerivWithin_comp_left {f : E β F} (g : F ββα΅’[π] G)
(hf : ContDiffOn π n f s) (hs : UniqueDiffOn π s) (hx : x β s) {i : β} (hi : (i : ββ) β€ n) :
βiteratedFDerivWithin π i (g β f) s xβ = βiteratedFDerivWithin π i f s xβ := by
have :
iteratedFDerivWithin π i (g β f) s x =
g.toContinuousLinearMap.compContinuousMultilinearMap (iteratedFDerivWithin π i f s x) :=
g.toContinuousLinearMap.iteratedFDerivWithin_comp_left hf hs hx hi
rw [this]
apply LinearIsometry.norm_compContinuousMultilinearMap
#align linear_isometry.norm_iterated_fderiv_within_comp_left LinearIsometry.norm_iteratedFDerivWithin_comp_left
theorem LinearIsometry.norm_iteratedFDeriv_comp_left {f : E β F} (g : F ββα΅’[π] G)
(hf : ContDiff π n f) (x : E) {i : β} (hi : (i : ββ) β€ n) :
βiteratedFDeriv π i (g β f) xβ = βiteratedFDeriv π i f xβ := by
simp only [β iteratedFDerivWithin_univ]
exact g.norm_iteratedFDerivWithin_comp_left hf.contDiffOn uniqueDiffOn_univ (mem_univ x) hi
#align linear_isometry.norm_iterated_fderiv_comp_left LinearIsometry.norm_iteratedFDeriv_comp_left
theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left (g : F ββα΅’[π] G) (f : E β F)
(hs : UniqueDiffOn π s) (hx : x β s) (i : β) :
βiteratedFDerivWithin π i (g β f) s xβ = βiteratedFDerivWithin π i f s xβ := by
have :
iteratedFDerivWithin π i (g β f) s x =
(g : F βL[π] G).compContinuousMultilinearMap (iteratedFDerivWithin π i f s x) :=
g.toContinuousLinearEquiv.iteratedFDerivWithin_comp_left f hs hx i
rw [this]
apply LinearIsometry.norm_compContinuousMultilinearMap g.toLinearIsometry
#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_left LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_left
theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_left (g : F ββα΅’[π] G) (f : E β F) (x : E)
(i : β) : βiteratedFDeriv π i (g β f) xβ = βiteratedFDeriv π i f xβ := by
rw [β iteratedFDerivWithin_univ, β iteratedFDerivWithin_univ]
apply g.norm_iteratedFDerivWithin_comp_left f uniqueDiffOn_univ (mem_univ x) i
#align linear_isometry_equiv.norm_iterated_fderiv_comp_left LinearIsometryEquiv.norm_iteratedFDeriv_comp_left
theorem ContinuousLinearEquiv.comp_contDiffWithinAt_iff (e : F βL[π] G) :
ContDiffWithinAt π n (e β f) s x β ContDiffWithinAt π n f s x :=
β¨fun H => by
simpa only [(Β· β Β·), e.symm.coe_coe, e.symm_apply_apply] using
H.continuousLinearMap_comp (e.symm : G βL[π] F),
fun H => H.continuousLinearMap_comp (e : F βL[π] G)β©
#align continuous_linear_equiv.comp_cont_diff_within_at_iff ContinuousLinearEquiv.comp_contDiffWithinAt_iff
theorem ContinuousLinearEquiv.comp_contDiffAt_iff (e : F βL[π] G) :
ContDiffAt π n (e β f) x β ContDiffAt π n f x := by
simp only [β contDiffWithinAt_univ, e.comp_contDiffWithinAt_iff]
#align continuous_linear_equiv.comp_cont_diff_at_iff ContinuousLinearEquiv.comp_contDiffAt_iff
theorem ContinuousLinearEquiv.comp_contDiffOn_iff (e : F βL[π] G) :
ContDiffOn π n (e β f) s β ContDiffOn π n f s := by
simp [ContDiffOn, e.comp_contDiffWithinAt_iff]
#align continuous_linear_equiv.comp_cont_diff_on_iff ContinuousLinearEquiv.comp_contDiffOn_iff
theorem ContinuousLinearEquiv.comp_contDiff_iff (e : F βL[π] G) :
ContDiff π n (e β f) β ContDiff π n f := by
simp only [β contDiffOn_univ, e.comp_contDiffOn_iff]
#align continuous_linear_equiv.comp_cont_diff_iff ContinuousLinearEquiv.comp_contDiff_iff
theorem HasFTaylorSeriesUpToOn.compContinuousLinearMap (hf : HasFTaylorSeriesUpToOn n f p s)
(g : G βL[π] E) :
HasFTaylorSeriesUpToOn n (f β g) (fun x k => (p (g x) k).compContinuousLinearMap fun _ => g)
(g β»ΒΉ' s) := by
let A : β m : β, (E[Γm]βL[π] F) β G[Γm]βL[π] F := fun m h => h.compContinuousLinearMap fun _ => g
have hA : β m, IsBoundedLinearMap π (A m) := fun m =>
isBoundedLinearMap_continuousMultilinearMap_comp_linear g
constructor
Β· intro x hx
simp only [(hf.zero_eq (g x) hx).symm, Function.comp_apply]
change (p (g x) 0 fun _ : Fin 0 => g 0) = p (g x) 0 0
rw [ContinuousLinearMap.map_zero]
rfl
Β· intro m hm x hx
convert (hA m).hasFDerivAt.comp_hasFDerivWithinAt x
((hf.fderivWithin m hm (g x) hx).comp x g.hasFDerivWithinAt (Subset.refl _))
ext y v
change p (g x) (Nat.succ m) (g β cons y v) = p (g x) m.succ (cons (g y) (g β v))
rw [comp_cons]
Β· intro m hm
exact (hA m).continuous.comp_continuousOn <| (hf.cont m hm).comp g.continuous.continuousOn <|
Subset.refl _
#align has_ftaylor_series_up_to_on.comp_continuous_linear_map HasFTaylorSeriesUpToOn.compContinuousLinearMap
theorem ContDiffWithinAt.comp_continuousLinearMap {x : G} (g : G βL[π] E)
(hf : ContDiffWithinAt π n f s (g x)) : ContDiffWithinAt π n (f β g) (g β»ΒΉ' s) x := by
intro m hm
rcases hf m hm with β¨u, hu, p, hpβ©
refine β¨g β»ΒΉ' u, ?_, _, hp.compContinuousLinearMap gβ©
refine g.continuous.continuousWithinAt.tendsto_nhdsWithin ?_ hu
exact (mapsTo_singleton.2 <| mem_singleton _).union_union (mapsTo_preimage _ _)
#align cont_diff_within_at.comp_continuous_linear_map ContDiffWithinAt.comp_continuousLinearMap
theorem ContDiffOn.comp_continuousLinearMap (hf : ContDiffOn π n f s) (g : G βL[π] E) :
ContDiffOn π n (f β g) (g β»ΒΉ' s) := fun x hx => (hf (g x) hx).comp_continuousLinearMap g
#align cont_diff_on.comp_continuous_linear_map ContDiffOn.comp_continuousLinearMap
theorem ContDiff.comp_continuousLinearMap {f : E β F} {g : G βL[π] E} (hf : ContDiff π n f) :
ContDiff π n (f β g) :=
contDiffOn_univ.1 <| ContDiffOn.comp_continuousLinearMap (contDiffOn_univ.2 hf) _
#align cont_diff.comp_continuous_linear_map ContDiff.comp_continuousLinearMap
theorem ContinuousLinearMap.iteratedFDerivWithin_comp_right {f : E β F} (g : G βL[π] E)
(hf : ContDiffOn π n f s) (hs : UniqueDiffOn π s) (h's : UniqueDiffOn π (g β»ΒΉ' s)) {x : G}
(hx : g x β s) {i : β} (hi : (i : ββ) β€ n) :
iteratedFDerivWithin π i (f β g) (g β»ΒΉ' s) x =
(iteratedFDerivWithin π i f s (g x)).compContinuousLinearMap fun _ => g :=
(((hf.ftaylorSeriesWithin hs).compContinuousLinearMap g).eq_iteratedFDerivWithin_of_uniqueDiffOn
hi h's hx).symm
#align continuous_linear_map.iterated_fderiv_within_comp_right ContinuousLinearMap.iteratedFDerivWithin_comp_right
theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G βL[π] E) (f : E β F)
(hs : UniqueDiffOn π s) {x : G} (hx : g x β s) (i : β) :
iteratedFDerivWithin π i (f β g) (g β»ΒΉ' s) x =
(iteratedFDerivWithin π i f s (g x)).compContinuousLinearMap fun _ => g := by
induction' i with i IH generalizing x
Β· ext1
simp only [Nat.zero_eq, iteratedFDerivWithin_zero_apply, comp_apply,
ContinuousMultilinearMap.compContinuousLinearMap_apply]
Β· ext1 m
simp only [ContinuousMultilinearMap.compContinuousLinearMap_apply,
ContinuousLinearEquiv.coe_coe, iteratedFDerivWithin_succ_apply_left]
have : fderivWithin π (iteratedFDerivWithin π i (f β g) (g β»ΒΉ' s)) (g β»ΒΉ' s) x =
fderivWithin π
(ContinuousMultilinearMap.compContinuousLinearMapEquivL _ (fun _x : Fin i => g) β
(iteratedFDerivWithin π i f s β g)) (g β»ΒΉ' s) x :=
fderivWithin_congr' (@IH) hx
rw [this, ContinuousLinearEquiv.comp_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx)]
simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_apply,
ContinuousMultilinearMap.compContinuousLinearMapEquivL_apply,
ContinuousMultilinearMap.compContinuousLinearMap_apply]
rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx),
ContinuousLinearMap.coe_comp', coe_coe, comp_apply, tail_def, tail_def]
#align continuous_linear_equiv.iterated_fderiv_within_comp_right ContinuousLinearEquiv.iteratedFDerivWithin_comp_right
theorem ContinuousLinearMap.iteratedFDeriv_comp_right (g : G βL[π] E) {f : E β F}
(hf : ContDiff π n f) (x : G) {i : β} (hi : (i : ββ) β€ n) :
iteratedFDeriv π i (f β g) x =
(iteratedFDeriv π i f (g x)).compContinuousLinearMap fun _ => g := by
simp only [β iteratedFDerivWithin_univ]
exact g.iteratedFDerivWithin_comp_right hf.contDiffOn uniqueDiffOn_univ uniqueDiffOn_univ
(mem_univ _) hi
#align continuous_linear_map.iterated_fderiv_comp_right ContinuousLinearMap.iteratedFDeriv_comp_right
theorem LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right (g : G ββα΅’[π] E) (f : E β F)
(hs : UniqueDiffOn π s) {x : G} (hx : g x β s) (i : β) :
βiteratedFDerivWithin π i (f β g) (g β»ΒΉ' s) xβ = βiteratedFDerivWithin π i f s (g x)β := by
have : iteratedFDerivWithin π i (f β g) (g β»ΒΉ' s) x =
(iteratedFDerivWithin π i f s (g x)).compContinuousLinearMap fun _ => g :=
g.toContinuousLinearEquiv.iteratedFDerivWithin_comp_right f hs hx i
rw [this, ContinuousMultilinearMap.norm_compContinuous_linearIsometryEquiv]
#align linear_isometry_equiv.norm_iterated_fderiv_within_comp_right LinearIsometryEquiv.norm_iteratedFDerivWithin_comp_right
theorem LinearIsometryEquiv.norm_iteratedFDeriv_comp_right (g : G ββα΅’[π] E) (f : E β F) (x : G)
(i : β) : βiteratedFDeriv π i (f β g) xβ = βiteratedFDeriv π i f (g x)β := by
simp only [β iteratedFDerivWithin_univ]
apply g.norm_iteratedFDerivWithin_comp_right f uniqueDiffOn_univ (mem_univ (g x)) i
#align linear_isometry_equiv.norm_iterated_fderiv_comp_right LinearIsometryEquiv.norm_iteratedFDeriv_comp_right
theorem ContinuousLinearEquiv.contDiffWithinAt_comp_iff (e : G βL[π] E) :
ContDiffWithinAt π n (f β e) (e β»ΒΉ' s) (e.symm x) β ContDiffWithinAt π n f s x := by
constructor
Β· intro H
simpa [β preimage_comp, (Β· β Β·)] using H.comp_continuousLinearMap (e.symm : E βL[π] G)
Β· intro H
rw [β e.apply_symm_apply x, β e.coe_coe] at H
exact H.comp_continuousLinearMap _
#align continuous_linear_equiv.cont_diff_within_at_comp_iff ContinuousLinearEquiv.contDiffWithinAt_comp_iff
theorem ContinuousLinearEquiv.contDiffAt_comp_iff (e : G βL[π] E) :
ContDiffAt π n (f β e) (e.symm x) β ContDiffAt π n f x := by
rw [β contDiffWithinAt_univ, β contDiffWithinAt_univ, β preimage_univ]
exact e.contDiffWithinAt_comp_iff
#align continuous_linear_equiv.cont_diff_at_comp_iff ContinuousLinearEquiv.contDiffAt_comp_iff
theorem ContinuousLinearEquiv.contDiffOn_comp_iff (e : G βL[π] E) :
ContDiffOn π n (f β e) (e β»ΒΉ' s) β ContDiffOn π n f s :=
β¨fun H => by simpa [(Β· β Β·)] using H.comp_continuousLinearMap (e.symm : E βL[π] G), fun H =>
H.comp_continuousLinearMap (e : G βL[π] E)β©
#align continuous_linear_equiv.cont_diff_on_comp_iff ContinuousLinearEquiv.contDiffOn_comp_iff
theorem ContinuousLinearEquiv.contDiff_comp_iff (e : G βL[π] E) :
ContDiff π n (f β e) β ContDiff π n f := by
rw [β contDiffOn_univ, β contDiffOn_univ, β preimage_univ]
exact e.contDiffOn_comp_iff
#align continuous_linear_equiv.cont_diff_comp_iff ContinuousLinearEquiv.contDiff_comp_iff
theorem HasFTaylorSeriesUpToOn.prod (hf : HasFTaylorSeriesUpToOn n f p s) {g : E β G}
{q : E β FormalMultilinearSeries π E G} (hg : HasFTaylorSeriesUpToOn n g q s) :
HasFTaylorSeriesUpToOn n (fun y => (f y, g y)) (fun y k => (p y k).prod (q y k)) s := by
set L := fun m => ContinuousMultilinearMap.prodL π (fun _ : Fin m => E) F G
constructor
Β· intro x hx; rw [β hf.zero_eq x hx, β hg.zero_eq x hx]; rfl
Β· intro m hm x hx
convert (L m).hasFDerivAt.comp_hasFDerivWithinAt x
((hf.fderivWithin m hm x hx).prod (hg.fderivWithin m hm x hx))
Β· intro m hm
exact (L m).continuous.comp_continuousOn ((hf.cont m hm).prod (hg.cont m hm))
#align has_ftaylor_series_up_to_on.prod HasFTaylorSeriesUpToOn.prod
theorem ContDiffWithinAt.prod {s : Set E} {f : E β F} {g : E β G} (hf : ContDiffWithinAt π n f s x)
(hg : ContDiffWithinAt π n g s x) : ContDiffWithinAt π n (fun x : E => (f x, g x)) s x := by
intro m hm
rcases hf m hm with β¨u, hu, p, hpβ©
rcases hg m hm with β¨v, hv, q, hqβ©
exact
β¨u β© v, Filter.inter_mem hu hv, _,
(hp.mono inter_subset_left).prod (hq.mono inter_subset_right)β©
#align cont_diff_within_at.prod ContDiffWithinAt.prod
theorem ContDiffOn.prod {s : Set E} {f : E β F} {g : E β G} (hf : ContDiffOn π n f s)
(hg : ContDiffOn π n g s) : ContDiffOn π n (fun x : E => (f x, g x)) s := fun x hx =>
(hf x hx).prod (hg x hx)
#align cont_diff_on.prod ContDiffOn.prod
theorem ContDiffAt.prod {f : E β F} {g : E β G} (hf : ContDiffAt π n f x)
(hg : ContDiffAt π n g x) : ContDiffAt π n (fun x : E => (f x, g x)) x :=
contDiffWithinAt_univ.1 <|
ContDiffWithinAt.prod (contDiffWithinAt_univ.2 hf) (contDiffWithinAt_univ.2 hg)
#align cont_diff_at.prod ContDiffAt.prod
theorem ContDiff.prod {f : E β F} {g : E β G} (hf : ContDiff π n f) (hg : ContDiff π n g) :
ContDiff π n fun x : E => (f x, g x) :=
contDiffOn_univ.1 <| ContDiffOn.prod (contDiffOn_univ.2 hf) (contDiffOn_univ.2 hg)
#align cont_diff.prod ContDiff.prod
private theorem ContDiffOn.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu] [NormedSpace π Eu]
{Fu : Type u} [NormedAddCommGroup Fu] [NormedSpace π Fu] {Gu : Type u} [NormedAddCommGroup Gu]
[NormedSpace π Gu] {s : Set Eu} {t : Set Fu} {g : Fu β Gu} {f : Eu β Fu}
(hg : ContDiffOn π n g t) (hf : ContDiffOn π n f s) (st : s β f β»ΒΉ' t) :
ContDiffOn π n (g β f) s := by
induction' n using ENat.nat_induction with n IH Itop generalizing Eu Fu Gu
Β· rw [contDiffOn_zero] at hf hg β’
exact ContinuousOn.comp hg hf st
Β· rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg β’
intro x hx
rcases (contDiffOn_succ_iff_hasFDerivWithinAt.1 hf) x hx with β¨u, hu, f', hf', f'_diffβ©
rcases hg (f x) (st hx) with β¨v, hv, g', hg', g'_diffβ©
rw [insert_eq_of_mem hx] at hu β’
have xu : x β u := mem_of_mem_nhdsWithin hx hu
let w := s β© (u β© f β»ΒΉ' v)
have wv : w β f β»ΒΉ' v := fun y hy => hy.2.2
have wu : w β u := fun y hy => hy.2.1
have ws : w β s := fun y hy => hy.1
refine β¨w, ?_, fun y => (g' (f y)).comp (f' y), ?_, ?_β©
Β· show w β π[s] x
apply Filter.inter_mem self_mem_nhdsWithin
apply Filter.inter_mem hu
apply ContinuousWithinAt.preimage_mem_nhdsWithin'
Β· rw [β continuousWithinAt_inter' hu]
exact (hf' x xu).differentiableWithinAt.continuousWithinAt.mono inter_subset_right
Β· apply nhdsWithin_mono _ _ hv
exact Subset.trans (image_subset_iff.mpr st) (subset_insert (f x) t)
Β· show β y β w, HasFDerivWithinAt (g β f) ((g' (f y)).comp (f' y)) w y
rintro y β¨-, yu, yvβ©
exact (hg' (f y) yv).comp y ((hf' y yu).mono wu) wv
Β· show ContDiffOn π n (fun y => (g' (f y)).comp (f' y)) w
have A : ContDiffOn π n (fun y => g' (f y)) w :=
IH g'_diff ((hf.of_le (WithTop.coe_le_coe.2 (Nat.le_succ n))).mono ws) wv
have B : ContDiffOn π n f' w := f'_diff.mono wu
have C : ContDiffOn π n (fun y => (g' (f y), f' y)) w := A.prod B
have D : ContDiffOn π n (fun p : (Fu βL[π] Gu) Γ (Eu βL[π] Fu) => p.1.comp p.2) univ :=
isBoundedBilinearMap_comp.contDiff.contDiffOn
exact IH D C (subset_univ _)
Β· rw [contDiffOn_top] at hf hg β’
exact fun n => Itop n (hg n) (hf n) st
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F β G} {f : E β F} (hg : ContDiffOn π n g t)
(hf : ContDiffOn π n f s) (st : s β f β»ΒΉ' t) : ContDiffOn π n (g β f) s := by
let Eu : Type max uE uF uG := ULift.{max uF uG} E
let Fu : Type max uE uF uG := ULift.{max uE uG} F
let Gu : Type max uE uF uG := ULift.{max uE uF} G
-- declare the isomorphisms
have isoE : Eu βL[π] E := ContinuousLinearEquiv.ulift
have isoF : Fu βL[π] F := ContinuousLinearEquiv.ulift
have isoG : Gu βL[π] G := ContinuousLinearEquiv.ulift
-- lift the functions to the new spaces, check smoothness there, and then go back.
let fu : Eu β Fu := (isoF.symm β f) β isoE
have fu_diff : ContDiffOn π n fu (isoE β»ΒΉ' s) := by
rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
let gu : Fu β Gu := (isoG.symm β g) β isoF
have gu_diff : ContDiffOn π n gu (isoF β»ΒΉ' t) := by
rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
have main : ContDiffOn π n (gu β fu) (isoE β»ΒΉ' s) := by
apply ContDiffOn.comp_same_univ gu_diff fu_diff
intro y hy
simp only [fu, ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
rw [isoF.apply_symm_apply (f (isoE y))]
exact st hy
have : gu β fu = (isoG.symm β g β f) β isoE := by
ext y
simp only [fu, gu, Function.comp_apply]
rw [isoF.apply_symm_apply (f (isoE y))]
rwa [this, isoE.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff] at main
#align cont_diff_on.comp ContDiffOn.comp
theorem ContDiffOn.comp' {s : Set E} {t : Set F} {g : F β G} {f : E β F} (hg : ContDiffOn π n g t)
(hf : ContDiffOn π n f s) : ContDiffOn π n (g β f) (s β© f β»ΒΉ' t) :=
hg.comp (hf.mono inter_subset_left) inter_subset_right
#align cont_diff_on.comp' ContDiffOn.comp'
theorem ContDiff.comp_contDiffOn {s : Set E} {g : F β G} {f : E β F} (hg : ContDiff π n g)
(hf : ContDiffOn π n f s) : ContDiffOn π n (g β f) s :=
(contDiffOn_univ.2 hg).comp hf subset_preimage_univ
#align cont_diff.comp_cont_diff_on ContDiff.comp_contDiffOn
theorem ContDiff.comp {g : F β G} {f : E β F} (hg : ContDiff π n g) (hf : ContDiff π n f) :
ContDiff π n (g β f) :=
contDiffOn_univ.1 <| ContDiffOn.comp (contDiffOn_univ.2 hg) (contDiffOn_univ.2 hf) (subset_univ _)
#align cont_diff.comp ContDiff.comp
theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F β G} {f : E β F} (x : E)
(hg : ContDiffWithinAt π n g t (f x)) (hf : ContDiffWithinAt π n f s x) (st : s β f β»ΒΉ' t) :
ContDiffWithinAt π n (g β f) s x := by
intro m hm
rcases hg.contDiffOn hm with β¨u, u_nhd, _, huβ©
rcases hf.contDiffOn hm with β¨v, v_nhd, vs, hvβ©
have xmem : x β f β»ΒΉ' u β© v :=
β¨(mem_of_mem_nhdsWithin (mem_insert (f x) _) u_nhd : _),
mem_of_mem_nhdsWithin (mem_insert x s) v_nhdβ©
have : f β»ΒΉ' u β π[insert x s] x := by
apply hf.continuousWithinAt.insert_self.preimage_mem_nhdsWithin'
apply nhdsWithin_mono _ _ u_nhd
rw [image_insert_eq]
exact insert_subset_insert (image_subset_iff.mpr st)
have Z :=
(hu.comp (hv.mono inter_subset_right) inter_subset_left).contDiffWithinAt
xmem m le_rfl
have : π[f β»ΒΉ' u β© v] x = π[insert x s] x := by
have A : f β»ΒΉ' u β© v = insert x s β© (f β»ΒΉ' u β© v) := by
apply Subset.antisymm _ inter_subset_right
rintro y β¨hy1, hy2β©
simpa only [mem_inter_iff, mem_preimage, hy2, and_true, true_and, vs hy2] using hy1
rw [A, β nhdsWithin_restrict'']
exact Filter.inter_mem this v_nhd
rwa [insert_eq_of_mem xmem, this] at Z
#align cont_diff_within_at.comp ContDiffWithinAt.comp
theorem ContDiffWithinAt.comp_of_mem {s : Set E} {t : Set F} {g : F β G} {f : E β F} (x : E)
(hg : ContDiffWithinAt π n g t (f x)) (hf : ContDiffWithinAt π n f s x)
(hs : t β π[f '' s] f x) : ContDiffWithinAt π n (g β f) s x :=
(hg.mono_of_mem hs).comp x hf (subset_preimage_image f s)
#align cont_diff_within_at.comp_of_mem ContDiffWithinAt.comp_of_mem
theorem ContDiffWithinAt.comp' {s : Set E} {t : Set F} {g : F β G} {f : E β F} (x : E)
(hg : ContDiffWithinAt π n g t (f x)) (hf : ContDiffWithinAt π n f s x) :
ContDiffWithinAt π n (g β f) (s β© f β»ΒΉ' t) x :=
hg.comp x (hf.mono inter_subset_left) inter_subset_right
#align cont_diff_within_at.comp' ContDiffWithinAt.comp'
theorem ContDiffAt.comp_contDiffWithinAt {n} (x : E) (hg : ContDiffAt π n g (f x))
(hf : ContDiffWithinAt π n f s x) : ContDiffWithinAt π n (g β f) s x :=
hg.comp x hf (mapsTo_univ _ _)
#align cont_diff_at.comp_cont_diff_within_at ContDiffAt.comp_contDiffWithinAt
nonrec theorem ContDiffAt.comp (x : E) (hg : ContDiffAt π n g (f x)) (hf : ContDiffAt π n f x) :
ContDiffAt π n (g β f) x :=
hg.comp x hf subset_preimage_univ
#align cont_diff_at.comp ContDiffAt.comp
theorem ContDiff.comp_contDiffWithinAt {g : F β G} {f : E β F} (h : ContDiff π n g)
(hf : ContDiffWithinAt π n f t x) : ContDiffWithinAt π n (g β f) t x :=
haveI : ContDiffWithinAt π n g univ (f x) := h.contDiffAt.contDiffWithinAt
this.comp x hf (subset_univ _)
#align cont_diff.comp_cont_diff_within_at ContDiff.comp_contDiffWithinAt
theorem ContDiff.comp_contDiffAt {g : F β G} {f : E β F} (x : E) (hg : ContDiff π n g)
(hf : ContDiffAt π n f x) : ContDiffAt π n (g β f) x :=
hg.comp_contDiffWithinAt hf
#align cont_diff.comp_cont_diff_at ContDiff.comp_contDiffAt
theorem contDiff_fst : ContDiff π n (Prod.fst : E Γ F β E) :=
IsBoundedLinearMap.contDiff IsBoundedLinearMap.fst
#align cont_diff_fst contDiff_fst
theorem ContDiff.fst {f : E β F Γ G} (hf : ContDiff π n f) : ContDiff π n fun x => (f x).1 :=
contDiff_fst.comp hf
#align cont_diff.fst ContDiff.fst
theorem ContDiff.fst' {f : E β G} (hf : ContDiff π n f) : ContDiff π n fun x : E Γ F => f x.1 :=
hf.comp contDiff_fst
#align cont_diff.fst' ContDiff.fst'
theorem contDiffOn_fst {s : Set (E Γ F)} : ContDiffOn π n (Prod.fst : E Γ F β E) s :=
ContDiff.contDiffOn contDiff_fst
#align cont_diff_on_fst contDiffOn_fst
theorem ContDiffOn.fst {f : E β F Γ G} {s : Set E} (hf : ContDiffOn π n f s) :
ContDiffOn π n (fun x => (f x).1) s :=
contDiff_fst.comp_contDiffOn hf
#align cont_diff_on.fst ContDiffOn.fst
theorem contDiffAt_fst {p : E Γ F} : ContDiffAt π n (Prod.fst : E Γ F β E) p :=
contDiff_fst.contDiffAt
#align cont_diff_at_fst contDiffAt_fst
theorem ContDiffAt.fst {f : E β F Γ G} {x : E} (hf : ContDiffAt π n f x) :
ContDiffAt π n (fun x => (f x).1) x :=
contDiffAt_fst.comp x hf
#align cont_diff_at.fst ContDiffAt.fst
theorem ContDiffAt.fst' {f : E β G} {x : E} {y : F} (hf : ContDiffAt π n f x) :
ContDiffAt π n (fun x : E Γ F => f x.1) (x, y) :=
ContDiffAt.comp (x, y) hf contDiffAt_fst
#align cont_diff_at.fst' ContDiffAt.fst'
theorem ContDiffAt.fst'' {f : E β G} {x : E Γ F} (hf : ContDiffAt π n f x.1) :
ContDiffAt π n (fun x : E Γ F => f x.1) x :=
hf.comp x contDiffAt_fst
#align cont_diff_at.fst'' ContDiffAt.fst''
theorem contDiffWithinAt_fst {s : Set (E Γ F)} {p : E Γ F} :
ContDiffWithinAt π n (Prod.fst : E Γ F β E) s p :=
contDiff_fst.contDiffWithinAt
#align cont_diff_within_at_fst contDiffWithinAt_fst
theorem contDiff_snd : ContDiff π n (Prod.snd : E Γ F β F) :=
IsBoundedLinearMap.contDiff IsBoundedLinearMap.snd
#align cont_diff_snd contDiff_snd
theorem ContDiff.snd {f : E β F Γ G} (hf : ContDiff π n f) : ContDiff π n fun x => (f x).2 :=
contDiff_snd.comp hf
#align cont_diff.snd ContDiff.snd
theorem ContDiff.snd' {f : F β G} (hf : ContDiff π n f) : ContDiff π n fun x : E Γ F => f x.2 :=
hf.comp contDiff_snd
#align cont_diff.snd' ContDiff.snd'
theorem contDiffOn_snd {s : Set (E Γ F)} : ContDiffOn π n (Prod.snd : E Γ F β F) s :=
ContDiff.contDiffOn contDiff_snd
#align cont_diff_on_snd contDiffOn_snd
theorem ContDiffOn.snd {f : E β F Γ G} {s : Set E} (hf : ContDiffOn π n f s) :
ContDiffOn π n (fun x => (f x).2) s :=
contDiff_snd.comp_contDiffOn hf
#align cont_diff_on.snd ContDiffOn.snd
theorem contDiffAt_snd {p : E Γ F} : ContDiffAt π n (Prod.snd : E Γ F β F) p :=
contDiff_snd.contDiffAt
#align cont_diff_at_snd contDiffAt_snd
theorem ContDiffAt.snd {f : E β F Γ G} {x : E} (hf : ContDiffAt π n f x) :
ContDiffAt π n (fun x => (f x).2) x :=
contDiffAt_snd.comp x hf
#align cont_diff_at.snd ContDiffAt.snd
theorem ContDiffAt.snd' {f : F β G} {x : E} {y : F} (hf : ContDiffAt π n f y) :
ContDiffAt π n (fun x : E Γ F => f x.2) (x, y) :=
ContDiffAt.comp (x, y) hf contDiffAt_snd
#align cont_diff_at.snd' ContDiffAt.snd'
theorem ContDiffAt.snd'' {f : F β G} {x : E Γ F} (hf : ContDiffAt π n f x.2) :
ContDiffAt π n (fun x : E Γ F => f x.2) x :=
hf.comp x contDiffAt_snd
#align cont_diff_at.snd'' ContDiffAt.snd''
theorem contDiffWithinAt_snd {s : Set (E Γ F)} {p : E Γ F} :
ContDiffWithinAt π n (Prod.snd : E Γ F β F) s p :=
contDiff_snd.contDiffWithinAt
#align cont_diff_within_at_snd contDiffWithinAt_snd
theorem contDiff_prodAssoc : ContDiff π β€ <| Equiv.prodAssoc E F G :=
(LinearIsometryEquiv.prodAssoc π E F G).contDiff
#align cont_diff_prod_assoc contDiff_prodAssoc
theorem contDiff_prodAssoc_symm : ContDiff π β€ <| (Equiv.prodAssoc E F G).symm :=
(LinearIsometryEquiv.prodAssoc π E F G).symm.contDiff
#align cont_diff_prod_assoc_symm contDiff_prodAssoc_symm
theorem ContDiffWithinAt.hasFDerivWithinAt_nhds {f : E β F β G} {g : E β F} {t : Set F} {n : β}
{xβ : E} (hf : ContDiffWithinAt π (n + 1) (uncurry f) (insert xβ s ΓΛ’ t) (xβ, g xβ))
(hg : ContDiffWithinAt π n g s xβ) (hgt : t β π[g '' s] g xβ) :
β v β π[insert xβ s] xβ, v β insert xβ s β§ β f' : E β F βL[π] G,
(β x β v, HasFDerivWithinAt (f x) (f' x) t (g x)) β§
ContDiffWithinAt π n (fun x => f' x) s xβ := by
have hst : insert xβ s ΓΛ’ t β π[(fun x => (x, g x)) '' s] (xβ, g xβ) := by
refine nhdsWithin_mono _ ?_ (nhdsWithin_prod self_mem_nhdsWithin hgt)
simp_rw [image_subset_iff, mk_preimage_prod, preimage_id', subset_inter_iff, subset_insert,
true_and_iff, subset_preimage_image]
obtain β¨v, hv, hvs, f', hvf', hf'β© := contDiffWithinAt_succ_iff_hasFDerivWithinAt'.mp hf
refine
β¨(fun z => (z, g z)) β»ΒΉ' v β© insert xβ s, ?_, inter_subset_right, fun z =>
(f' (z, g z)).comp (ContinuousLinearMap.inr π E F), ?_, ?_β©
Β· refine inter_mem ?_ self_mem_nhdsWithin
have := mem_of_mem_nhdsWithin (mem_insert _ _) hv
refine mem_nhdsWithin_insert.mpr β¨this, ?_β©
refine (continuousWithinAt_id.prod hg.continuousWithinAt).preimage_mem_nhdsWithin' ?_
rw [β nhdsWithin_le_iff] at hst hv β’
exact (hst.trans <| nhdsWithin_mono _ <| subset_insert _ _).trans hv
Β· intro z hz
have := hvf' (z, g z) hz.1
refine this.comp _ (hasFDerivAt_prod_mk_right _ _).hasFDerivWithinAt ?_
exact mapsTo'.mpr (image_prod_mk_subset_prod_right hz.2)
Β· exact (hf'.continuousLinearMap_comp <| (ContinuousLinearMap.compL π F (E Γ F) G).flip
(ContinuousLinearMap.inr π E F)).comp_of_mem xβ (contDiffWithinAt_id.prod hg) hst
#align cont_diff_within_at.has_fderiv_within_at_nhds ContDiffWithinAt.hasFDerivWithinAt_nhds
theorem ContDiffWithinAt.fderivWithin'' {f : E β F β G} {g : E β F} {t : Set F} {n : ββ}
(hf : ContDiffWithinAt π n (Function.uncurry f) (insert xβ s ΓΛ’ t) (xβ, g xβ))
(hg : ContDiffWithinAt π m g s xβ)
(ht : βαΆ x in π[insert xβ s] xβ, UniqueDiffWithinAt π t (g x)) (hmn : m + 1 β€ n)
(hgt : t β π[g '' s] g xβ) :
ContDiffWithinAt π m (fun x => fderivWithin π (f x) t (g x)) s xβ := by
have : β k : β, (k : ββ) β€ m β
ContDiffWithinAt π k (fun x => fderivWithin π (f x) t (g x)) s xβ := fun k hkm β¦ by
obtain β¨v, hv, -, f', hvf', hf'β© :=
(hf.of_le <| (add_le_add_right hkm 1).trans hmn).hasFDerivWithinAt_nhds (hg.of_le hkm) hgt
refine hf'.congr_of_eventuallyEq_insert ?_
filter_upwards [hv, ht]
exact fun y hy h2y => (hvf' y hy).fderivWithin h2y
induction' m with m
Β· obtain rfl := eq_top_iff.mpr hmn
rw [contDiffWithinAt_top]
exact fun m => this m le_top
exact this _ le_rfl
#align cont_diff_within_at.fderiv_within'' ContDiffWithinAt.fderivWithin''
theorem ContDiffWithinAt.fderivWithin' {f : E β F β G} {g : E β F} {t : Set F} {n : ββ}
(hf : ContDiffWithinAt π n (Function.uncurry f) (insert xβ s ΓΛ’ t) (xβ, g xβ))
(hg : ContDiffWithinAt π m g s xβ)
(ht : βαΆ x in π[insert xβ s] xβ, UniqueDiffWithinAt π t (g x)) (hmn : m + 1 β€ n)
(hst : s β g β»ΒΉ' t) : ContDiffWithinAt π m (fun x => fderivWithin π (f x) t (g x)) s xβ :=
hf.fderivWithin'' hg ht hmn <| mem_of_superset self_mem_nhdsWithin <| image_subset_iff.mpr hst
#align cont_diff_within_at.fderiv_within' ContDiffWithinAt.fderivWithin'
protected theorem ContDiffWithinAt.fderivWithin {f : E β F β G} {g : E β F} {t : Set F} {n : ββ}
(hf : ContDiffWithinAt π n (Function.uncurry f) (s ΓΛ’ t) (xβ, g xβ))
(hg : ContDiffWithinAt π m g s xβ) (ht : UniqueDiffOn π t) (hmn : m + 1 β€ n) (hxβ : xβ β s)
(hst : s β g β»ΒΉ' t) : ContDiffWithinAt π m (fun x => fderivWithin π (f x) t (g x)) s xβ := by
rw [β insert_eq_self.mpr hxβ] at hf
refine hf.fderivWithin' hg ?_ hmn hst
rw [insert_eq_self.mpr hxβ]
exact eventually_of_mem self_mem_nhdsWithin fun x hx => ht _ (hst hx)
#align cont_diff_within_at.fderiv_within ContDiffWithinAt.fderivWithin
theorem ContDiffWithinAt.fderivWithin_apply {f : E β F β G} {g k : E β F} {t : Set F} {n : ββ}
(hf : ContDiffWithinAt π n (Function.uncurry f) (s ΓΛ’ t) (xβ, g xβ))
(hg : ContDiffWithinAt π m g s xβ) (hk : ContDiffWithinAt π m k s xβ) (ht : UniqueDiffOn π t)
(hmn : m + 1 β€ n) (hxβ : xβ β s) (hst : s β g β»ΒΉ' t) :
ContDiffWithinAt π m (fun x => fderivWithin π (f x) t (g x) (k x)) s xβ :=
(contDiff_fst.clm_apply contDiff_snd).contDiffAt.comp_contDiffWithinAt xβ
((hf.fderivWithin hg ht hmn hxβ hst).prod hk)
#align cont_diff_within_at.fderiv_within_apply ContDiffWithinAt.fderivWithin_apply
theorem ContDiffWithinAt.fderivWithin_right (hf : ContDiffWithinAt π n f s xβ)
(hs : UniqueDiffOn π s) (hmn : (m + 1 : ββ) β€ n) (hxβs : xβ β s) :
ContDiffWithinAt π m (fderivWithin π f s) s xβ :=
ContDiffWithinAt.fderivWithin
(ContDiffWithinAt.comp (xβ, xβ) hf contDiffWithinAt_snd <| prod_subset_preimage_snd s s)
contDiffWithinAt_id hs hmn hxβs (by rw [preimage_id'])
#align cont_diff_within_at.fderiv_within_right ContDiffWithinAt.fderivWithin_right
-- TODO: can we make a version of `ContDiffWithinAt.fderivWithin` for iterated derivatives?
theorem ContDiffWithinAt.iteratedFderivWithin_right {i : β} (hf : ContDiffWithinAt π n f s xβ)
(hs : UniqueDiffOn π s) (hmn : (m + i : ββ) β€ n) (hxβs : xβ β s) :
ContDiffWithinAt π m (iteratedFDerivWithin π i f s) s xβ := by
induction' i with i hi generalizing m
Β· rw [ENat.coe_zero, add_zero] at hmn
exact (hf.of_le hmn).continuousLinearMap_comp
((continuousMultilinearCurryFin0 π E F).symm : _ βL[π] E [Γ0]βL[π] F)
Β· rw [Nat.cast_succ, add_comm _ 1, β add_assoc] at hmn
exact ((hi hmn).fderivWithin_right hs le_rfl hxβs).continuousLinearMap_comp
(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (i+1) β¦ E) F : _ βL[π] E [Γ(i+1)]βL[π] F)
protected theorem ContDiffAt.fderiv {f : E β F β G} {g : E β F} {n : ββ}
(hf : ContDiffAt π n (Function.uncurry f) (xβ, g xβ)) (hg : ContDiffAt π m g xβ)
(hmn : m + 1 β€ n) : ContDiffAt π m (fun x => fderiv π (f x) (g x)) xβ := by
simp_rw [β fderivWithin_univ]
refine (ContDiffWithinAt.fderivWithin hf.contDiffWithinAt hg.contDiffWithinAt uniqueDiffOn_univ
hmn (mem_univ xβ) ?_).contDiffAt univ_mem
rw [preimage_univ]
#align cont_diff_at.fderiv ContDiffAt.fderiv
theorem ContDiffAt.fderiv_right (hf : ContDiffAt π n f xβ) (hmn : (m + 1 : ββ) β€ n) :
ContDiffAt π m (fderiv π f) xβ :=
ContDiffAt.fderiv (ContDiffAt.comp (xβ, xβ) hf contDiffAt_snd) contDiffAt_id hmn
#align cont_diff_at.fderiv_right ContDiffAt.fderiv_right
theorem ContDiffAt.iteratedFDeriv_right {i : β} (hf : ContDiffAt π n f xβ)
(hmn : (m + i : ββ) β€ n) : ContDiffAt π m (iteratedFDeriv π i f) xβ := by
rw [β iteratedFDerivWithin_univ, β contDiffWithinAt_univ] at *
exact hf.iteratedFderivWithin_right uniqueDiffOn_univ hmn trivial
protected theorem ContDiff.fderiv {f : E β F β G} {g : E β F} {n m : ββ}
(hf : ContDiff π m <| Function.uncurry f) (hg : ContDiff π n g) (hnm : n + 1 β€ m) :
ContDiff π n fun x => fderiv π (f x) (g x) :=
contDiff_iff_contDiffAt.mpr fun _ => hf.contDiffAt.fderiv hg.contDiffAt hnm
#align cont_diff.fderiv ContDiff.fderiv
theorem ContDiff.fderiv_right (hf : ContDiff π n f) (hmn : (m + 1 : ββ) β€ n) :
ContDiff π m (fderiv π f) :=
contDiff_iff_contDiffAt.mpr fun _x => hf.contDiffAt.fderiv_right hmn
#align cont_diff.fderiv_right ContDiff.fderiv_right
theorem ContDiff.iteratedFDeriv_right {i : β} (hf : ContDiff π n f)
(hmn : (m + i : ββ) β€ n) : ContDiff π m (iteratedFDeriv π i f) :=
contDiff_iff_contDiffAt.mpr fun _x => hf.contDiffAt.iteratedFDeriv_right hmn
theorem Continuous.fderiv {f : E β F β G} {g : E β F} {n : ββ}
(hf : ContDiff π n <| Function.uncurry f) (hg : Continuous g) (hn : 1 β€ n) :
Continuous fun x => fderiv π (f x) (g x) :=
(hf.fderiv (contDiff_zero.mpr hg) hn).continuous
#align continuous.fderiv Continuous.fderiv
theorem ContDiff.fderiv_apply {f : E β F β G} {g k : E β F} {n m : ββ}
(hf : ContDiff π m <| Function.uncurry f) (hg : ContDiff π n g) (hk : ContDiff π n k)
(hnm : n + 1 β€ m) : ContDiff π n fun x => fderiv π (f x) (g x) (k x) :=
(hf.fderiv hg hnm).clm_apply hk
#align cont_diff.fderiv_apply ContDiff.fderiv_apply
theorem contDiffOn_fderivWithin_apply {m n : ββ} {s : Set E} {f : E β F} (hf : ContDiffOn π n f s)
(hs : UniqueDiffOn π s) (hmn : m + 1 β€ n) :
ContDiffOn π m (fun p : E Γ E => (fderivWithin π f s p.1 : E βL[π] F) p.2) (s ΓΛ’ univ) :=
((hf.fderivWithin hs hmn).comp contDiffOn_fst (prod_subset_preimage_fst _ _)).clm_apply
contDiffOn_snd
#align cont_diff_on_fderiv_within_apply contDiffOn_fderivWithin_apply
theorem ContDiffOn.continuousOn_fderivWithin_apply (hf : ContDiffOn π n f s) (hs : UniqueDiffOn π s)
(hn : 1 β€ n) :
ContinuousOn (fun p : E Γ E => (fderivWithin π f s p.1 : E β F) p.2) (s ΓΛ’ univ) :=
(contDiffOn_fderivWithin_apply hf hs <| by rwa [zero_add]).continuousOn
#align cont_diff_on.continuous_on_fderiv_within_apply ContDiffOn.continuousOn_fderivWithin_apply
theorem ContDiff.contDiff_fderiv_apply {f : E β F} (hf : ContDiff π n f) (hmn : m + 1 β€ n) :
ContDiff π m fun p : E Γ E => (fderiv π f p.1 : E βL[π] F) p.2 := by
rw [β contDiffOn_univ] at hf β’
rw [β fderivWithin_univ, β univ_prod_univ]
exact contDiffOn_fderivWithin_apply hf uniqueDiffOn_univ hmn
#align cont_diff.cont_diff_fderiv_apply ContDiff.contDiff_fderiv_apply
theorem ContDiffWithinAt.sub {s : Set E} {f g : E β F} (hf : ContDiffWithinAt π n f s x)
(hg : ContDiffWithinAt π n g s x) : ContDiffWithinAt π n (fun x => f x - g x) s x := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
#align cont_diff_within_at.sub ContDiffWithinAt.sub
theorem ContDiffAt.sub {f g : E β F} (hf : ContDiffAt π n f x) (hg : ContDiffAt π n g x) :
ContDiffAt π n (fun x => f x - g x) x := by simpa only [sub_eq_add_neg] using hf.add hg.neg
#align cont_diff_at.sub ContDiffAt.sub
theorem ContDiffOn.sub {s : Set E} {f g : E β F} (hf : ContDiffOn π n f s)
(hg : ContDiffOn π n g s) : ContDiffOn π n (fun x => f x - g x) s := by
simpa only [sub_eq_add_neg] using hf.add hg.neg
#align cont_diff_on.sub ContDiffOn.sub
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 1,415 | 1,416 | theorem ContDiff.sub {f g : E β F} (hf : ContDiff π n f) (hg : ContDiff π n g) :
ContDiff π n fun x => f x - g x := by | simpa only [sub_eq_add_neg] using hf.add hg.neg
|
import Mathlib.Algebra.Order.CauSeq.BigOperators
import Mathlib.Data.Complex.Abs
import Mathlib.Data.Complex.BigOperators
import Mathlib.Data.Nat.Choose.Sum
#align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
open CauSeq Finset IsAbsoluteValue
open scoped Classical ComplexConjugate
namespace Complex
variable (x y : β)
@[simp]
theorem exp_zero : exp 0 = 1 := by
rw [exp]
refine lim_eq_of_equiv_const fun Ξ΅ Ξ΅0 => β¨1, fun j hj => ?_β©
convert (config := .unfoldSameFun) Ξ΅0 -- Porting note: Ξ΅0 : Ξ΅ > 0 but goal is _ < Ξ΅
cases' j with j j
Β· exact absurd hj (not_le_of_gt zero_lt_one)
Β· dsimp [exp']
induction' j with j ih
Β· dsimp [exp']; simp [show Nat.succ 0 = 1 from rfl]
Β· rw [β ih (by simp [Nat.succ_le_succ])]
simp only [sum_range_succ, pow_succ]
simp
#align complex.exp_zero Complex.exp_zero
theorem exp_add : exp (x + y) = exp x * exp y := by
have hj : β j : β, (β m β range j, (x + y) ^ m / m.factorial) =
β i β range j, β k β range (i + 1), x ^ k / k.factorial *
(y ^ (i - k) / (i - k).factorial) := by
intro j
refine Finset.sum_congr rfl fun m _ => ?_
rw [add_pow, div_eq_mul_inv, sum_mul]
refine Finset.sum_congr rfl fun I hi => ?_
have hβ : (m.choose I : β) β 0 :=
Nat.cast_ne_zero.2 (pos_iff_ne_zero.1 (Nat.choose_pos (Nat.le_of_lt_succ (mem_range.1 hi))))
have hβ := Nat.choose_mul_factorial_mul_factorial (Nat.le_of_lt_succ <| Finset.mem_range.1 hi)
rw [β hβ, Nat.cast_mul, Nat.cast_mul, mul_inv, mul_inv]
simp only [mul_left_comm (m.choose I : β), mul_assoc, mul_left_comm (m.choose I : β)β»ΒΉ,
mul_comm (m.choose I : β)]
rw [inv_mul_cancel hβ]
simp [div_eq_mul_inv, mul_comm, mul_assoc, mul_left_comm]
simp_rw [exp, exp', lim_mul_lim]
apply (lim_eq_lim_of_equiv _).symm
simp only [hj]
exact cauchy_product (isCauSeq_abs_exp x) (isCauSeq_exp y)
#align complex.exp_add Complex.exp_add
-- Porting note (#11445): new definition
noncomputable def expMonoidHom : MonoidHom (Multiplicative β) β :=
{ toFun := fun z => exp (Multiplicative.toAdd z),
map_one' := by simp,
map_mul' := by simp [exp_add] }
theorem exp_list_sum (l : List β) : exp l.sum = (l.map exp).prod :=
map_list_prod (M := Multiplicative β) expMonoidHom l
#align complex.exp_list_sum Complex.exp_list_sum
theorem exp_multiset_sum (s : Multiset β) : exp s.sum = (s.map exp).prod :=
@MonoidHom.map_multiset_prod (Multiplicative β) β _ _ expMonoidHom s
#align complex.exp_multiset_sum Complex.exp_multiset_sum
theorem exp_sum {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β β) :
exp (β x β s, f x) = β x β s, exp (f x) :=
map_prod (Ξ² := Multiplicative β) expMonoidHom f s
#align complex.exp_sum Complex.exp_sum
lemma exp_nsmul (x : β) (n : β) : exp (n β’ x) = exp x ^ n :=
@MonoidHom.map_pow (Multiplicative β) β _ _ expMonoidHom _ _
theorem exp_nat_mul (x : β) : β n : β, exp (n * x) = exp x ^ n
| 0 => by rw [Nat.cast_zero, zero_mul, exp_zero, pow_zero]
| Nat.succ n => by rw [pow_succ, Nat.cast_add_one, add_mul, exp_add, β exp_nat_mul _ n, one_mul]
#align complex.exp_nat_mul Complex.exp_nat_mul
theorem exp_ne_zero : exp x β 0 := fun h =>
zero_ne_one <| by rw [β exp_zero, β add_neg_self x, exp_add, h]; simp
#align complex.exp_ne_zero Complex.exp_ne_zero
theorem exp_neg : exp (-x) = (exp x)β»ΒΉ := by
rw [β mul_right_inj' (exp_ne_zero x), β exp_add]; simp [mul_inv_cancel (exp_ne_zero x)]
#align complex.exp_neg Complex.exp_neg
theorem exp_sub : exp (x - y) = exp x / exp y := by
simp [sub_eq_add_neg, exp_add, exp_neg, div_eq_mul_inv]
#align complex.exp_sub Complex.exp_sub
theorem exp_int_mul (z : β) (n : β€) : Complex.exp (n * z) = Complex.exp z ^ n := by
cases n
Β· simp [exp_nat_mul]
Β· simp [exp_add, add_mul, pow_add, exp_neg, exp_nat_mul]
#align complex.exp_int_mul Complex.exp_int_mul
@[simp]
theorem exp_conj : exp (conj x) = conj (exp x) := by
dsimp [exp]
rw [β lim_conj]
refine congr_arg CauSeq.lim (CauSeq.ext fun _ => ?_)
dsimp [exp', Function.comp_def, cauSeqConj]
rw [map_sum (starRingEnd _)]
refine sum_congr rfl fun n _ => ?_
rw [map_divβ, map_pow, β ofReal_natCast, conj_ofReal]
#align complex.exp_conj Complex.exp_conj
@[simp]
theorem ofReal_exp_ofReal_re (x : β) : ((exp x).re : β) = exp x :=
conj_eq_iff_re.1 <| by rw [β exp_conj, conj_ofReal]
#align complex.of_real_exp_of_real_re Complex.ofReal_exp_ofReal_re
@[simp, norm_cast]
theorem ofReal_exp (x : β) : (Real.exp x : β) = exp x :=
ofReal_exp_ofReal_re _
#align complex.of_real_exp Complex.ofReal_exp
@[simp]
theorem exp_ofReal_im (x : β) : (exp x).im = 0 := by rw [β ofReal_exp_ofReal_re, ofReal_im]
#align complex.exp_of_real_im Complex.exp_ofReal_im
theorem exp_ofReal_re (x : β) : (exp x).re = Real.exp x :=
rfl
#align complex.exp_of_real_re Complex.exp_ofReal_re
theorem two_sinh : 2 * sinh x = exp x - exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_sinh Complex.two_sinh
theorem two_cosh : 2 * cosh x = exp x + exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_cosh Complex.two_cosh
@[simp]
theorem sinh_zero : sinh 0 = 0 := by simp [sinh]
#align complex.sinh_zero Complex.sinh_zero
@[simp]
theorem sinh_neg : sinh (-x) = -sinh x := by simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
#align complex.sinh_neg Complex.sinh_neg
private theorem sinh_add_aux {a b c d : β} :
(a - b) * (c + d) + (a + b) * (c - d) = 2 * (a * c - b * d) := by ring
theorem sinh_add : sinh (x + y) = sinh x * cosh y + cosh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_sinh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_sinh, mul_left_comm, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, β mul_assoc, two_cosh]
exact sinh_add_aux
#align complex.sinh_add Complex.sinh_add
@[simp]
theorem cosh_zero : cosh 0 = 1 := by simp [cosh]
#align complex.cosh_zero Complex.cosh_zero
@[simp]
theorem cosh_neg : cosh (-x) = cosh x := by simp [add_comm, cosh, exp_neg]
#align complex.cosh_neg Complex.cosh_neg
private theorem cosh_add_aux {a b c d : β} :
(a + b) * (c + d) + (a - b) * (c - d) = 2 * (a * c + b * d) := by ring
theorem cosh_add : cosh (x + y) = cosh x * cosh y + sinh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_cosh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_cosh, β mul_assoc, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, mul_left_comm, two_sinh]
exact cosh_add_aux
#align complex.cosh_add Complex.cosh_add
theorem sinh_sub : sinh (x - y) = sinh x * cosh y - cosh x * sinh y := by
simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
#align complex.sinh_sub Complex.sinh_sub
theorem cosh_sub : cosh (x - y) = cosh x * cosh y - sinh x * sinh y := by
simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]
#align complex.cosh_sub Complex.cosh_sub
theorem sinh_conj : sinh (conj x) = conj (sinh x) := by
rw [sinh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_sub, sinh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.sinh_conj Complex.sinh_conj
@[simp]
theorem ofReal_sinh_ofReal_re (x : β) : ((sinh x).re : β) = sinh x :=
conj_eq_iff_re.1 <| by rw [β sinh_conj, conj_ofReal]
#align complex.of_real_sinh_of_real_re Complex.ofReal_sinh_ofReal_re
@[simp, norm_cast]
theorem ofReal_sinh (x : β) : (Real.sinh x : β) = sinh x :=
ofReal_sinh_ofReal_re _
#align complex.of_real_sinh Complex.ofReal_sinh
@[simp]
theorem sinh_ofReal_im (x : β) : (sinh x).im = 0 := by rw [β ofReal_sinh_ofReal_re, ofReal_im]
#align complex.sinh_of_real_im Complex.sinh_ofReal_im
theorem sinh_ofReal_re (x : β) : (sinh x).re = Real.sinh x :=
rfl
#align complex.sinh_of_real_re Complex.sinh_ofReal_re
theorem cosh_conj : cosh (conj x) = conj (cosh x) := by
rw [cosh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_add, cosh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.cosh_conj Complex.cosh_conj
theorem ofReal_cosh_ofReal_re (x : β) : ((cosh x).re : β) = cosh x :=
conj_eq_iff_re.1 <| by rw [β cosh_conj, conj_ofReal]
#align complex.of_real_cosh_of_real_re Complex.ofReal_cosh_ofReal_re
@[simp, norm_cast]
theorem ofReal_cosh (x : β) : (Real.cosh x : β) = cosh x :=
ofReal_cosh_ofReal_re _
#align complex.of_real_cosh Complex.ofReal_cosh
@[simp]
theorem cosh_ofReal_im (x : β) : (cosh x).im = 0 := by rw [β ofReal_cosh_ofReal_re, ofReal_im]
#align complex.cosh_of_real_im Complex.cosh_ofReal_im
@[simp]
theorem cosh_ofReal_re (x : β) : (cosh x).re = Real.cosh x :=
rfl
#align complex.cosh_of_real_re Complex.cosh_ofReal_re
theorem tanh_eq_sinh_div_cosh : tanh x = sinh x / cosh x :=
rfl
#align complex.tanh_eq_sinh_div_cosh Complex.tanh_eq_sinh_div_cosh
@[simp]
theorem tanh_zero : tanh 0 = 0 := by simp [tanh]
#align complex.tanh_zero Complex.tanh_zero
@[simp]
theorem tanh_neg : tanh (-x) = -tanh x := by simp [tanh, neg_div]
#align complex.tanh_neg Complex.tanh_neg
theorem tanh_conj : tanh (conj x) = conj (tanh x) := by
rw [tanh, sinh_conj, cosh_conj, β map_divβ, tanh]
#align complex.tanh_conj Complex.tanh_conj
@[simp]
theorem ofReal_tanh_ofReal_re (x : β) : ((tanh x).re : β) = tanh x :=
conj_eq_iff_re.1 <| by rw [β tanh_conj, conj_ofReal]
#align complex.of_real_tanh_of_real_re Complex.ofReal_tanh_ofReal_re
@[simp, norm_cast]
theorem ofReal_tanh (x : β) : (Real.tanh x : β) = tanh x :=
ofReal_tanh_ofReal_re _
#align complex.of_real_tanh Complex.ofReal_tanh
@[simp]
theorem tanh_ofReal_im (x : β) : (tanh x).im = 0 := by rw [β ofReal_tanh_ofReal_re, ofReal_im]
#align complex.tanh_of_real_im Complex.tanh_ofReal_im
theorem tanh_ofReal_re (x : β) : (tanh x).re = Real.tanh x :=
rfl
#align complex.tanh_of_real_re Complex.tanh_ofReal_re
@[simp]
theorem cosh_add_sinh : cosh x + sinh x = exp x := by
rw [β mul_right_inj' (two_ne_zero' β), mul_add, two_cosh, two_sinh, add_add_sub_cancel, two_mul]
#align complex.cosh_add_sinh Complex.cosh_add_sinh
@[simp]
theorem sinh_add_cosh : sinh x + cosh x = exp x := by rw [add_comm, cosh_add_sinh]
#align complex.sinh_add_cosh Complex.sinh_add_cosh
@[simp]
theorem exp_sub_cosh : exp x - cosh x = sinh x :=
sub_eq_iff_eq_add.2 (sinh_add_cosh x).symm
#align complex.exp_sub_cosh Complex.exp_sub_cosh
@[simp]
theorem exp_sub_sinh : exp x - sinh x = cosh x :=
sub_eq_iff_eq_add.2 (cosh_add_sinh x).symm
#align complex.exp_sub_sinh Complex.exp_sub_sinh
@[simp]
theorem cosh_sub_sinh : cosh x - sinh x = exp (-x) := by
rw [β mul_right_inj' (two_ne_zero' β), mul_sub, two_cosh, two_sinh, add_sub_sub_cancel, two_mul]
#align complex.cosh_sub_sinh Complex.cosh_sub_sinh
@[simp]
theorem sinh_sub_cosh : sinh x - cosh x = -exp (-x) := by rw [β neg_sub, cosh_sub_sinh]
#align complex.sinh_sub_cosh Complex.sinh_sub_cosh
@[simp]
theorem cosh_sq_sub_sinh_sq : cosh x ^ 2 - sinh x ^ 2 = 1 := by
rw [sq_sub_sq, cosh_add_sinh, cosh_sub_sinh, β exp_add, add_neg_self, exp_zero]
#align complex.cosh_sq_sub_sinh_sq Complex.cosh_sq_sub_sinh_sq
theorem cosh_sq : cosh x ^ 2 = sinh x ^ 2 + 1 := by
rw [β cosh_sq_sub_sinh_sq x]
ring
#align complex.cosh_sq Complex.cosh_sq
theorem sinh_sq : sinh x ^ 2 = cosh x ^ 2 - 1 := by
rw [β cosh_sq_sub_sinh_sq x]
ring
#align complex.sinh_sq Complex.sinh_sq
theorem cosh_two_mul : cosh (2 * x) = cosh x ^ 2 + sinh x ^ 2 := by rw [two_mul, cosh_add, sq, sq]
#align complex.cosh_two_mul Complex.cosh_two_mul
theorem sinh_two_mul : sinh (2 * x) = 2 * sinh x * cosh x := by
rw [two_mul, sinh_add]
ring
#align complex.sinh_two_mul Complex.sinh_two_mul
theorem cosh_three_mul : cosh (3 * x) = 4 * cosh x ^ 3 - 3 * cosh x := by
have h1 : x + 2 * x = 3 * x := by ring
rw [β h1, cosh_add x (2 * x)]
simp only [cosh_two_mul, sinh_two_mul]
have h2 : sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2 := by ring
rw [h2, sinh_sq]
ring
#align complex.cosh_three_mul Complex.cosh_three_mul
theorem sinh_three_mul : sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x := by
have h1 : x + 2 * x = 3 * x := by ring
rw [β h1, sinh_add x (2 * x)]
simp only [cosh_two_mul, sinh_two_mul]
have h2 : cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2 := by ring
rw [h2, cosh_sq]
ring
#align complex.sinh_three_mul Complex.sinh_three_mul
@[simp]
theorem sin_zero : sin 0 = 0 := by simp [sin]
#align complex.sin_zero Complex.sin_zero
@[simp]
theorem sin_neg : sin (-x) = -sin x := by
simp [sin, sub_eq_add_neg, exp_neg, (neg_div _ _).symm, add_mul]
#align complex.sin_neg Complex.sin_neg
theorem two_sin : 2 * sin x = (exp (-x * I) - exp (x * I)) * I :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_sin Complex.two_sin
theorem two_cos : 2 * cos x = exp (x * I) + exp (-x * I) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_cos Complex.two_cos
theorem sinh_mul_I : sinh (x * I) = sin x * I := by
rw [β mul_right_inj' (two_ne_zero' β), two_sinh, β mul_assoc, two_sin, mul_assoc, I_mul_I,
mul_neg_one, neg_sub, neg_mul_eq_neg_mul]
set_option linter.uppercaseLean3 false in
#align complex.sinh_mul_I Complex.sinh_mul_I
theorem cosh_mul_I : cosh (x * I) = cos x := by
rw [β mul_right_inj' (two_ne_zero' β), two_cosh, two_cos, neg_mul_eq_neg_mul]
set_option linter.uppercaseLean3 false in
#align complex.cosh_mul_I Complex.cosh_mul_I
theorem tanh_mul_I : tanh (x * I) = tan x * I := by
rw [tanh_eq_sinh_div_cosh, cosh_mul_I, sinh_mul_I, mul_div_right_comm, tan]
set_option linter.uppercaseLean3 false in
#align complex.tanh_mul_I Complex.tanh_mul_I
theorem cos_mul_I : cos (x * I) = cosh x := by rw [β cosh_mul_I]; ring_nf; simp
set_option linter.uppercaseLean3 false in
#align complex.cos_mul_I Complex.cos_mul_I
theorem sin_mul_I : sin (x * I) = sinh x * I := by
have h : I * sin (x * I) = -sinh x := by
rw [mul_comm, β sinh_mul_I]
ring_nf
simp
rw [β neg_neg (sinh x), β h]
apply Complex.ext <;> simp
set_option linter.uppercaseLean3 false in
#align complex.sin_mul_I Complex.sin_mul_I
theorem tan_mul_I : tan (x * I) = tanh x * I := by
rw [tan, sin_mul_I, cos_mul_I, mul_div_right_comm, tanh_eq_sinh_div_cosh]
set_option linter.uppercaseLean3 false in
#align complex.tan_mul_I Complex.tan_mul_I
theorem sin_add : sin (x + y) = sin x * cos y + cos x * sin y := by
rw [β mul_left_inj' I_ne_zero, β sinh_mul_I, add_mul, add_mul, mul_right_comm, β sinh_mul_I,
mul_assoc, β sinh_mul_I, β cosh_mul_I, β cosh_mul_I, sinh_add]
#align complex.sin_add Complex.sin_add
@[simp]
theorem cos_zero : cos 0 = 1 := by simp [cos]
#align complex.cos_zero Complex.cos_zero
@[simp]
theorem cos_neg : cos (-x) = cos x := by simp [cos, sub_eq_add_neg, exp_neg, add_comm]
#align complex.cos_neg Complex.cos_neg
private theorem cos_add_aux {a b c d : β} :
(a + b) * (c + d) - (b - a) * (d - c) * -1 = 2 * (a * c + b * d) := by ring
theorem cos_add : cos (x + y) = cos x * cos y - sin x * sin y := by
rw [β cosh_mul_I, add_mul, cosh_add, cosh_mul_I, cosh_mul_I, sinh_mul_I, sinh_mul_I,
mul_mul_mul_comm, I_mul_I, mul_neg_one, sub_eq_add_neg]
#align complex.cos_add Complex.cos_add
theorem sin_sub : sin (x - y) = sin x * cos y - cos x * sin y := by
simp [sub_eq_add_neg, sin_add, sin_neg, cos_neg]
#align complex.sin_sub Complex.sin_sub
theorem cos_sub : cos (x - y) = cos x * cos y + sin x * sin y := by
simp [sub_eq_add_neg, cos_add, sin_neg, cos_neg]
#align complex.cos_sub Complex.cos_sub
theorem sin_add_mul_I (x y : β) : sin (x + y * I) = sin x * cosh y + cos x * sinh y * I := by
rw [sin_add, cos_mul_I, sin_mul_I, mul_assoc]
set_option linter.uppercaseLean3 false in
#align complex.sin_add_mul_I Complex.sin_add_mul_I
theorem sin_eq (z : β) : sin z = sin z.re * cosh z.im + cos z.re * sinh z.im * I := by
convert sin_add_mul_I z.re z.im; exact (re_add_im z).symm
#align complex.sin_eq Complex.sin_eq
theorem cos_add_mul_I (x y : β) : cos (x + y * I) = cos x * cosh y - sin x * sinh y * I := by
rw [cos_add, cos_mul_I, sin_mul_I, mul_assoc]
set_option linter.uppercaseLean3 false in
#align complex.cos_add_mul_I Complex.cos_add_mul_I
theorem cos_eq (z : β) : cos z = cos z.re * cosh z.im - sin z.re * sinh z.im * I := by
convert cos_add_mul_I z.re z.im; exact (re_add_im z).symm
#align complex.cos_eq Complex.cos_eq
theorem sin_sub_sin : sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2) := by
have s1 := sin_add ((x + y) / 2) ((x - y) / 2)
have s2 := sin_sub ((x + y) / 2) ((x - y) / 2)
rw [div_add_div_same, add_sub, add_right_comm, add_sub_cancel_right, half_add_self] at s1
rw [div_sub_div_same, β sub_add, add_sub_cancel_left, half_add_self] at s2
rw [s1, s2]
ring
#align complex.sin_sub_sin Complex.sin_sub_sin
theorem cos_sub_cos : cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2) := by
have s1 := cos_add ((x + y) / 2) ((x - y) / 2)
have s2 := cos_sub ((x + y) / 2) ((x - y) / 2)
rw [div_add_div_same, add_sub, add_right_comm, add_sub_cancel_right, half_add_self] at s1
rw [div_sub_div_same, β sub_add, add_sub_cancel_left, half_add_self] at s2
rw [s1, s2]
ring
#align complex.cos_sub_cos Complex.cos_sub_cos
theorem sin_add_sin : sin x + sin y = 2 * sin ((x + y) / 2) * cos ((x - y) / 2) := by
simpa using sin_sub_sin x (-y)
theorem cos_add_cos : cos x + cos y = 2 * cos ((x + y) / 2) * cos ((x - y) / 2) := by
calc
cos x + cos y = cos ((x + y) / 2 + (x - y) / 2) + cos ((x + y) / 2 - (x - y) / 2) := ?_
_ =
cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2) +
(cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)) :=
?_
_ = 2 * cos ((x + y) / 2) * cos ((x - y) / 2) := ?_
Β· congr <;> field_simp
Β· rw [cos_add, cos_sub]
ring
#align complex.cos_add_cos Complex.cos_add_cos
theorem sin_conj : sin (conj x) = conj (sin x) := by
rw [β mul_left_inj' I_ne_zero, β sinh_mul_I, β conj_neg_I, β RingHom.map_mul, β RingHom.map_mul,
sinh_conj, mul_neg, sinh_neg, sinh_mul_I, mul_neg]
#align complex.sin_conj Complex.sin_conj
@[simp]
theorem ofReal_sin_ofReal_re (x : β) : ((sin x).re : β) = sin x :=
conj_eq_iff_re.1 <| by rw [β sin_conj, conj_ofReal]
#align complex.of_real_sin_of_real_re Complex.ofReal_sin_ofReal_re
@[simp, norm_cast]
theorem ofReal_sin (x : β) : (Real.sin x : β) = sin x :=
ofReal_sin_ofReal_re _
#align complex.of_real_sin Complex.ofReal_sin
@[simp]
theorem sin_ofReal_im (x : β) : (sin x).im = 0 := by rw [β ofReal_sin_ofReal_re, ofReal_im]
#align complex.sin_of_real_im Complex.sin_ofReal_im
theorem sin_ofReal_re (x : β) : (sin x).re = Real.sin x :=
rfl
#align complex.sin_of_real_re Complex.sin_ofReal_re
theorem cos_conj : cos (conj x) = conj (cos x) := by
rw [β cosh_mul_I, β conj_neg_I, β RingHom.map_mul, β cosh_mul_I, cosh_conj, mul_neg, cosh_neg]
#align complex.cos_conj Complex.cos_conj
@[simp]
theorem ofReal_cos_ofReal_re (x : β) : ((cos x).re : β) = cos x :=
conj_eq_iff_re.1 <| by rw [β cos_conj, conj_ofReal]
#align complex.of_real_cos_of_real_re Complex.ofReal_cos_ofReal_re
@[simp, norm_cast]
theorem ofReal_cos (x : β) : (Real.cos x : β) = cos x :=
ofReal_cos_ofReal_re _
#align complex.of_real_cos Complex.ofReal_cos
@[simp]
theorem cos_ofReal_im (x : β) : (cos x).im = 0 := by rw [β ofReal_cos_ofReal_re, ofReal_im]
#align complex.cos_of_real_im Complex.cos_ofReal_im
theorem cos_ofReal_re (x : β) : (cos x).re = Real.cos x :=
rfl
#align complex.cos_of_real_re Complex.cos_ofReal_re
@[simp]
theorem tan_zero : tan 0 = 0 := by simp [tan]
#align complex.tan_zero Complex.tan_zero
theorem tan_eq_sin_div_cos : tan x = sin x / cos x :=
rfl
#align complex.tan_eq_sin_div_cos Complex.tan_eq_sin_div_cos
theorem tan_mul_cos {x : β} (hx : cos x β 0) : tan x * cos x = sin x := by
rw [tan_eq_sin_div_cos, div_mul_cancelβ _ hx]
#align complex.tan_mul_cos Complex.tan_mul_cos
@[simp]
theorem tan_neg : tan (-x) = -tan x := by simp [tan, neg_div]
#align complex.tan_neg Complex.tan_neg
theorem tan_conj : tan (conj x) = conj (tan x) := by rw [tan, sin_conj, cos_conj, β map_divβ, tan]
#align complex.tan_conj Complex.tan_conj
@[simp]
theorem ofReal_tan_ofReal_re (x : β) : ((tan x).re : β) = tan x :=
conj_eq_iff_re.1 <| by rw [β tan_conj, conj_ofReal]
#align complex.of_real_tan_of_real_re Complex.ofReal_tan_ofReal_re
@[simp, norm_cast]
theorem ofReal_tan (x : β) : (Real.tan x : β) = tan x :=
ofReal_tan_ofReal_re _
#align complex.of_real_tan Complex.ofReal_tan
@[simp]
theorem tan_ofReal_im (x : β) : (tan x).im = 0 := by rw [β ofReal_tan_ofReal_re, ofReal_im]
#align complex.tan_of_real_im Complex.tan_ofReal_im
theorem tan_ofReal_re (x : β) : (tan x).re = Real.tan x :=
rfl
#align complex.tan_of_real_re Complex.tan_ofReal_re
theorem cos_add_sin_I : cos x + sin x * I = exp (x * I) := by
rw [β cosh_add_sinh, sinh_mul_I, cosh_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.cos_add_sin_I Complex.cos_add_sin_I
theorem cos_sub_sin_I : cos x - sin x * I = exp (-x * I) := by
rw [neg_mul, β cosh_sub_sinh, sinh_mul_I, cosh_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.cos_sub_sin_I Complex.cos_sub_sin_I
@[simp]
theorem sin_sq_add_cos_sq : sin x ^ 2 + cos x ^ 2 = 1 :=
Eq.trans (by rw [cosh_mul_I, sinh_mul_I, mul_pow, I_sq, mul_neg_one, sub_neg_eq_add, add_comm])
(cosh_sq_sub_sinh_sq (x * I))
#align complex.sin_sq_add_cos_sq Complex.sin_sq_add_cos_sq
@[simp]
theorem cos_sq_add_sin_sq : cos x ^ 2 + sin x ^ 2 = 1 := by rw [add_comm, sin_sq_add_cos_sq]
#align complex.cos_sq_add_sin_sq Complex.cos_sq_add_sin_sq
| Mathlib/Data/Complex/Exponential.lean | 720 | 720 | theorem cos_two_mul' : cos (2 * x) = cos x ^ 2 - sin x ^ 2 := by | rw [two_mul, cos_add, β sq, β sq]
|
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {Ξ± : Type*} {Ξ² : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {π : Type*} {π' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing π] [NormedDivisionRing π']
variable {c c' cβ cβ : β} {f : Ξ± β E} {g : Ξ± β F} {k : Ξ± β G}
variable {f' : Ξ± β E'} {g' : Ξ± β F'} {k' : Ξ± β G'}
variable {f'' : Ξ± β E''} {g'' : Ξ± β F''} {k'' : Ξ± β G''}
variable {l l' : Filter Ξ±}
theorem IsBigOWith.isBigO (h : IsBigOWith c l f g) : f =O[l] g := by rw [IsBigO_def]; exact β¨c, hβ©
#align asymptotics.is_O_with.is_O Asymptotics.IsBigOWith.isBigO
theorem IsLittleO.isBigOWith (hgf : f =o[l] g) : IsBigOWith 1 l f g :=
hgf.def' zero_lt_one
#align asymptotics.is_o.is_O_with Asymptotics.IsLittleO.isBigOWith
theorem IsLittleO.isBigO (hgf : f =o[l] g) : f =O[l] g :=
hgf.isBigOWith.isBigO
#align asymptotics.is_o.is_O Asymptotics.IsLittleO.isBigO
theorem IsBigO.isBigOWith : f =O[l] g β β c : β, IsBigOWith c l f g :=
isBigO_iff_isBigOWith.1
#align asymptotics.is_O.is_O_with Asymptotics.IsBigO.isBigOWith
theorem IsBigOWith.weaken (h : IsBigOWith c l f g') (hc : c β€ c') : IsBigOWith c' l f g' :=
IsBigOWith.of_bound <|
mem_of_superset h.bound fun x hx =>
calc
βf xβ β€ c * βg' xβ := hx
_ β€ _ := by gcongr
#align asymptotics.is_O_with.weaken Asymptotics.IsBigOWith.weaken
theorem IsBigOWith.exists_pos (h : IsBigOWith c l f g') :
β c' > 0, IsBigOWith c' l f g' :=
β¨max c 1, lt_of_lt_of_le zero_lt_one (le_max_right c 1), h.weaken <| le_max_left c 1β©
#align asymptotics.is_O_with.exists_pos Asymptotics.IsBigOWith.exists_pos
theorem IsBigO.exists_pos (h : f =O[l] g') : β c > 0, IsBigOWith c l f g' :=
let β¨_c, hcβ© := h.isBigOWith
hc.exists_pos
#align asymptotics.is_O.exists_pos Asymptotics.IsBigO.exists_pos
theorem IsBigOWith.exists_nonneg (h : IsBigOWith c l f g') :
β c' β₯ 0, IsBigOWith c' l f g' :=
let β¨c, cpos, hcβ© := h.exists_pos
β¨c, le_of_lt cpos, hcβ©
#align asymptotics.is_O_with.exists_nonneg Asymptotics.IsBigOWith.exists_nonneg
theorem IsBigO.exists_nonneg (h : f =O[l] g') : β c β₯ 0, IsBigOWith c l f g' :=
let β¨_c, hcβ© := h.isBigOWith
hc.exists_nonneg
#align asymptotics.is_O.exists_nonneg Asymptotics.IsBigO.exists_nonneg
theorem isBigO_iff_eventually_isBigOWith : f =O[l] g' β βαΆ c in atTop, IsBigOWith c l f g' :=
isBigO_iff_isBigOWith.trans
β¨fun β¨c, hcβ© => mem_atTop_sets.2 β¨c, fun _c' hc' => hc.weaken hc'β©, fun h => h.existsβ©
#align asymptotics.is_O_iff_eventually_is_O_with Asymptotics.isBigO_iff_eventually_isBigOWith
theorem isBigO_iff_eventually : f =O[l] g' β βαΆ c in atTop, βαΆ x in l, βf xβ β€ c * βg' xβ :=
isBigO_iff_eventually_isBigOWith.trans <| by simp only [IsBigOWith_def]
#align asymptotics.is_O_iff_eventually Asymptotics.isBigO_iff_eventually
theorem IsBigO.exists_mem_basis {ΞΉ} {p : ΞΉ β Prop} {s : ΞΉ β Set Ξ±} (h : f =O[l] g')
(hb : l.HasBasis p s) :
β c > 0, β i : ΞΉ, p i β§ β x β s i, βf xβ β€ c * βg' xβ :=
flip Exists.imp h.exists_pos fun c h => by
simpa only [isBigOWith_iff, hb.eventually_iff, exists_prop] using h
#align asymptotics.is_O.exists_mem_basis Asymptotics.IsBigO.exists_mem_basis
theorem isBigOWith_inv (hc : 0 < c) : IsBigOWith cβ»ΒΉ l f g β βαΆ x in l, c * βf xβ β€ βg xβ := by
simp only [IsBigOWith_def, β div_eq_inv_mul, le_div_iff' hc]
#align asymptotics.is_O_with_inv Asymptotics.isBigOWith_inv
-- We prove this lemma with strange assumptions to get two lemmas below automatically
theorem isLittleO_iff_nat_mul_le_aux (hβ : (β x, 0 β€ βf xβ) β¨ β x, 0 β€ βg xβ) :
f =o[l] g β β n : β, βαΆ x in l, βn * βf xβ β€ βg xβ := by
constructor
Β· rintro H (_ | n)
Β· refine (H.def one_pos).mono fun x hβ' => ?_
rw [Nat.cast_zero, zero_mul]
refine hβ.elim (fun hf => (hf x).trans ?_) fun hg => hg x
rwa [one_mul] at hβ'
Β· have : (0 : β) < n.succ := Nat.cast_pos.2 n.succ_pos
exact (isBigOWith_inv this).1 (H.def' <| inv_pos.2 this)
Β· refine fun H => isLittleO_iff.2 fun Ξ΅ Ξ΅0 => ?_
rcases exists_nat_gt Ξ΅β»ΒΉ with β¨n, hnβ©
have hnβ : (0 : β) < n := (inv_pos.2 Ξ΅0).trans hn
refine ((isBigOWith_inv hnβ).2 (H n)).bound.mono fun x hfg => ?_
refine hfg.trans (mul_le_mul_of_nonneg_right (inv_le_of_inv_le Ξ΅0 hn.le) ?_)
refine hβ.elim (fun hf => nonneg_of_mul_nonneg_right ((hf x).trans hfg) ?_) fun h => h x
exact inv_pos.2 hnβ
#align asymptotics.is_o_iff_nat_mul_le_aux Asymptotics.isLittleO_iff_nat_mul_le_aux
theorem isLittleO_iff_nat_mul_le : f =o[l] g' β β n : β, βαΆ x in l, βn * βf xβ β€ βg' xβ :=
isLittleO_iff_nat_mul_le_aux (Or.inr fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le Asymptotics.isLittleO_iff_nat_mul_le
theorem isLittleO_iff_nat_mul_le' : f' =o[l] g β β n : β, βαΆ x in l, βn * βf' xβ β€ βg xβ :=
isLittleO_iff_nat_mul_le_aux (Or.inl fun _x => norm_nonneg _)
#align asymptotics.is_o_iff_nat_mul_le' Asymptotics.isLittleO_iff_nat_mul_le'
@[nontriviality]
theorem isLittleO_of_subsingleton [Subsingleton E'] : f' =o[l] g' :=
IsLittleO.of_bound fun c hc => by simp [Subsingleton.elim (f' _) 0, mul_nonneg hc.le]
#align asymptotics.is_o_of_subsingleton Asymptotics.isLittleO_of_subsingleton
@[nontriviality]
theorem isBigO_of_subsingleton [Subsingleton E'] : f' =O[l] g' :=
isLittleO_of_subsingleton.isBigO
#align asymptotics.is_O_of_subsingleton Asymptotics.isBigO_of_subsingleton
theorem IsBigOWith.comp_tendsto (hcfg : IsBigOWith c l f g) {k : Ξ² β Ξ±} {l' : Filter Ξ²}
(hk : Tendsto k l' l) : IsBigOWith c l' (f β k) (g β k) :=
IsBigOWith.of_bound <| hk hcfg.bound
#align asymptotics.is_O_with.comp_tendsto Asymptotics.IsBigOWith.comp_tendsto
theorem IsBigO.comp_tendsto (hfg : f =O[l] g) {k : Ξ² β Ξ±} {l' : Filter Ξ²} (hk : Tendsto k l' l) :
(f β k) =O[l'] (g β k) :=
isBigO_iff_isBigOWith.2 <| hfg.isBigOWith.imp fun _c h => h.comp_tendsto hk
#align asymptotics.is_O.comp_tendsto Asymptotics.IsBigO.comp_tendsto
theorem IsLittleO.comp_tendsto (hfg : f =o[l] g) {k : Ξ² β Ξ±} {l' : Filter Ξ²} (hk : Tendsto k l' l) :
(f β k) =o[l'] (g β k) :=
IsLittleO.of_isBigOWith fun _c cpos => (hfg.forall_isBigOWith cpos).comp_tendsto hk
#align asymptotics.is_o.comp_tendsto Asymptotics.IsLittleO.comp_tendsto
@[simp]
theorem isBigOWith_map {k : Ξ² β Ξ±} {l : Filter Ξ²} :
IsBigOWith c (map k l) f g β IsBigOWith c l (f β k) (g β k) := by
simp only [IsBigOWith_def]
exact eventually_map
#align asymptotics.is_O_with_map Asymptotics.isBigOWith_map
@[simp]
theorem isBigO_map {k : Ξ² β Ξ±} {l : Filter Ξ²} : f =O[map k l] g β (f β k) =O[l] (g β k) := by
simp only [IsBigO_def, isBigOWith_map]
#align asymptotics.is_O_map Asymptotics.isBigO_map
@[simp]
theorem isLittleO_map {k : Ξ² β Ξ±} {l : Filter Ξ²} : f =o[map k l] g β (f β k) =o[l] (g β k) := by
simp only [IsLittleO_def, isBigOWith_map]
#align asymptotics.is_o_map Asymptotics.isLittleO_map
theorem IsBigOWith.mono (h : IsBigOWith c l' f g) (hl : l β€ l') : IsBigOWith c l f g :=
IsBigOWith.of_bound <| hl h.bound
#align asymptotics.is_O_with.mono Asymptotics.IsBigOWith.mono
theorem IsBigO.mono (h : f =O[l'] g) (hl : l β€ l') : f =O[l] g :=
isBigO_iff_isBigOWith.2 <| h.isBigOWith.imp fun _c h => h.mono hl
#align asymptotics.is_O.mono Asymptotics.IsBigO.mono
theorem IsLittleO.mono (h : f =o[l'] g) (hl : l β€ l') : f =o[l] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).mono hl
#align asymptotics.is_o.mono Asymptotics.IsLittleO.mono
theorem IsBigOWith.trans (hfg : IsBigOWith c l f g) (hgk : IsBigOWith c' l g k) (hc : 0 β€ c) :
IsBigOWith (c * c') l f k := by
simp only [IsBigOWith_def] at *
filter_upwards [hfg, hgk] with x hx hx'
calc
βf xβ β€ c * βg xβ := hx
_ β€ c * (c' * βk xβ) := by gcongr
_ = c * c' * βk xβ := (mul_assoc _ _ _).symm
#align asymptotics.is_O_with.trans Asymptotics.IsBigOWith.trans
@[trans]
theorem IsBigO.trans {f : Ξ± β E} {g : Ξ± β F'} {k : Ξ± β G} (hfg : f =O[l] g) (hgk : g =O[l] k) :
f =O[l] k :=
let β¨_c, cnonneg, hcβ© := hfg.exists_nonneg
let β¨_c', hc'β© := hgk.isBigOWith
(hc.trans hc' cnonneg).isBigO
#align asymptotics.is_O.trans Asymptotics.IsBigO.trans
instance transIsBigOIsBigO :
@Trans (Ξ± β E) (Ξ± β F') (Ξ± β G) (Β· =O[l] Β·) (Β· =O[l] Β·) (Β· =O[l] Β·) where
trans := IsBigO.trans
theorem IsLittleO.trans_isBigOWith (hfg : f =o[l] g) (hgk : IsBigOWith c l g k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact ((hfg this).trans hgk this.le).congr_const (div_mul_cancelβ _ hc.ne')
#align asymptotics.is_o.trans_is_O_with Asymptotics.IsLittleO.trans_isBigOWith
@[trans]
theorem IsLittleO.trans_isBigO {f : Ξ± β E} {g : Ξ± β F} {k : Ξ± β G'} (hfg : f =o[l] g)
(hgk : g =O[l] k) : f =o[l] k :=
let β¨_c, cpos, hcβ© := hgk.exists_pos
hfg.trans_isBigOWith hc cpos
#align asymptotics.is_o.trans_is_O Asymptotics.IsLittleO.trans_isBigO
instance transIsLittleOIsBigO :
@Trans (Ξ± β E) (Ξ± β F) (Ξ± β G') (Β· =o[l] Β·) (Β· =O[l] Β·) (Β· =o[l] Β·) where
trans := IsLittleO.trans_isBigO
theorem IsBigOWith.trans_isLittleO (hfg : IsBigOWith c l f g) (hgk : g =o[l] k) (hc : 0 < c) :
f =o[l] k := by
simp only [IsLittleO_def] at *
intro c' c'pos
have : 0 < c' / c := div_pos c'pos hc
exact (hfg.trans (hgk this) hc.le).congr_const (mul_div_cancelβ _ hc.ne')
#align asymptotics.is_O_with.trans_is_o Asymptotics.IsBigOWith.trans_isLittleO
@[trans]
theorem IsBigO.trans_isLittleO {f : Ξ± β E} {g : Ξ± β F'} {k : Ξ± β G} (hfg : f =O[l] g)
(hgk : g =o[l] k) : f =o[l] k :=
let β¨_c, cpos, hcβ© := hfg.exists_pos
hc.trans_isLittleO hgk cpos
#align asymptotics.is_O.trans_is_o Asymptotics.IsBigO.trans_isLittleO
instance transIsBigOIsLittleO :
@Trans (Ξ± β E) (Ξ± β F') (Ξ± β G) (Β· =O[l] Β·) (Β· =o[l] Β·) (Β· =o[l] Β·) where
trans := IsBigO.trans_isLittleO
@[trans]
theorem IsLittleO.trans {f : Ξ± β E} {g : Ξ± β F} {k : Ξ± β G} (hfg : f =o[l] g) (hgk : g =o[l] k) :
f =o[l] k :=
hfg.trans_isBigOWith hgk.isBigOWith one_pos
#align asymptotics.is_o.trans Asymptotics.IsLittleO.trans
instance transIsLittleOIsLittleO :
@Trans (Ξ± β E) (Ξ± β F) (Ξ± β G) (Β· =o[l] Β·) (Β· =o[l] Β·) (Β· =o[l] Β·) where
trans := IsLittleO.trans
theorem _root_.Filter.Eventually.trans_isBigO {f : Ξ± β E} {g : Ξ± β F'} {k : Ξ± β G}
(hfg : βαΆ x in l, βf xβ β€ βg xβ) (hgk : g =O[l] k) : f =O[l] k :=
(IsBigO.of_bound' hfg).trans hgk
#align filter.eventually.trans_is_O Filter.Eventually.trans_isBigO
theorem _root_.Filter.Eventually.isBigO {f : Ξ± β E} {g : Ξ± β β} {l : Filter Ξ±}
(hfg : βαΆ x in l, βf xβ β€ g x) : f =O[l] g :=
IsBigO.of_bound' <| hfg.mono fun _x hx => hx.trans <| Real.le_norm_self _
#align filter.eventually.is_O Filter.Eventually.isBigO
section
variable (l)
theorem isBigOWith_of_le' (hfg : β x, βf xβ β€ c * βg xβ) : IsBigOWith c l f g :=
IsBigOWith.of_bound <| univ_mem' hfg
#align asymptotics.is_O_with_of_le' Asymptotics.isBigOWith_of_le'
theorem isBigOWith_of_le (hfg : β x, βf xβ β€ βg xβ) : IsBigOWith 1 l f g :=
isBigOWith_of_le' l fun x => by
rw [one_mul]
exact hfg x
#align asymptotics.is_O_with_of_le Asymptotics.isBigOWith_of_le
theorem isBigO_of_le' (hfg : β x, βf xβ β€ c * βg xβ) : f =O[l] g :=
(isBigOWith_of_le' l hfg).isBigO
#align asymptotics.is_O_of_le' Asymptotics.isBigO_of_le'
theorem isBigO_of_le (hfg : β x, βf xβ β€ βg xβ) : f =O[l] g :=
(isBigOWith_of_le l hfg).isBigO
#align asymptotics.is_O_of_le Asymptotics.isBigO_of_le
end
theorem isBigOWith_refl (f : Ξ± β E) (l : Filter Ξ±) : IsBigOWith 1 l f f :=
isBigOWith_of_le l fun _ => le_rfl
#align asymptotics.is_O_with_refl Asymptotics.isBigOWith_refl
theorem isBigO_refl (f : Ξ± β E) (l : Filter Ξ±) : f =O[l] f :=
(isBigOWith_refl f l).isBigO
#align asymptotics.is_O_refl Asymptotics.isBigO_refl
theorem _root_.Filter.EventuallyEq.isBigO {fβ fβ : Ξ± β E} (hf : fβ =αΆ [l] fβ) : fβ =O[l] fβ :=
hf.trans_isBigO (isBigO_refl _ _)
theorem IsBigOWith.trans_le (hfg : IsBigOWith c l f g) (hgk : β x, βg xβ β€ βk xβ) (hc : 0 β€ c) :
IsBigOWith c l f k :=
(hfg.trans (isBigOWith_of_le l hgk) hc).congr_const <| mul_one c
#align asymptotics.is_O_with.trans_le Asymptotics.IsBigOWith.trans_le
theorem IsBigO.trans_le (hfg : f =O[l] g') (hgk : β x, βg' xβ β€ βk xβ) : f =O[l] k :=
hfg.trans (isBigO_of_le l hgk)
#align asymptotics.is_O.trans_le Asymptotics.IsBigO.trans_le
theorem IsLittleO.trans_le (hfg : f =o[l] g) (hgk : β x, βg xβ β€ βk xβ) : f =o[l] k :=
hfg.trans_isBigOWith (isBigOWith_of_le _ hgk) zero_lt_one
#align asymptotics.is_o.trans_le Asymptotics.IsLittleO.trans_le
theorem isLittleO_irrefl' (h : βαΆ x in l, βf' xβ β 0) : Β¬f' =o[l] f' := by
intro ho
rcases ((ho.bound one_half_pos).and_frequently h).exists with β¨x, hle, hneβ©
rw [one_div, β div_eq_inv_mul] at hle
exact (half_lt_self (lt_of_le_of_ne (norm_nonneg _) hne.symm)).not_le hle
#align asymptotics.is_o_irrefl' Asymptotics.isLittleO_irrefl'
theorem isLittleO_irrefl (h : βαΆ x in l, f'' x β 0) : Β¬f'' =o[l] f'' :=
isLittleO_irrefl' <| h.mono fun _x => norm_ne_zero_iff.mpr
#align asymptotics.is_o_irrefl Asymptotics.isLittleO_irrefl
theorem IsBigO.not_isLittleO (h : f'' =O[l] g') (hf : βαΆ x in l, f'' x β 0) :
Β¬g' =o[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isLittleO h')
#align asymptotics.is_O.not_is_o Asymptotics.IsBigO.not_isLittleO
theorem IsLittleO.not_isBigO (h : f'' =o[l] g') (hf : βαΆ x in l, f'' x β 0) :
Β¬g' =O[l] f'' := fun h' =>
isLittleO_irrefl hf (h.trans_isBigO h')
#align asymptotics.is_o.not_is_O Asymptotics.IsLittleO.not_isBigO
@[simp]
theorem isBigOWith_pure {x} : IsBigOWith c (pure x) f g β βf xβ β€ c * βg xβ :=
isBigOWith_iff
#align asymptotics.is_O_with_pure Asymptotics.isBigOWith_pure
theorem IsBigOWith.sup (h : IsBigOWith c l f g) (h' : IsBigOWith c l' f g) :
IsBigOWith c (l β l') f g :=
IsBigOWith.of_bound <| mem_sup.2 β¨h.bound, h'.boundβ©
#align asymptotics.is_O_with.sup Asymptotics.IsBigOWith.sup
theorem IsBigOWith.sup' (h : IsBigOWith c l f g') (h' : IsBigOWith c' l' f g') :
IsBigOWith (max c c') (l β l') f g' :=
IsBigOWith.of_bound <|
mem_sup.2 β¨(h.weaken <| le_max_left c c').bound, (h'.weaken <| le_max_right c c').boundβ©
#align asymptotics.is_O_with.sup' Asymptotics.IsBigOWith.sup'
theorem IsBigO.sup (h : f =O[l] g') (h' : f =O[l'] g') : f =O[l β l'] g' :=
let β¨_c, hcβ© := h.isBigOWith
let β¨_c', hc'β© := h'.isBigOWith
(hc.sup' hc').isBigO
#align asymptotics.is_O.sup Asymptotics.IsBigO.sup
theorem IsLittleO.sup (h : f =o[l] g) (h' : f =o[l'] g) : f =o[l β l'] g :=
IsLittleO.of_isBigOWith fun _c cpos => (h.forall_isBigOWith cpos).sup (h'.forall_isBigOWith cpos)
#align asymptotics.is_o.sup Asymptotics.IsLittleO.sup
@[simp]
theorem isBigO_sup : f =O[l β l'] g' β f =O[l] g' β§ f =O[l'] g' :=
β¨fun h => β¨h.mono le_sup_left, h.mono le_sup_rightβ©, fun h => h.1.sup h.2β©
#align asymptotics.is_O_sup Asymptotics.isBigO_sup
@[simp]
theorem isLittleO_sup : f =o[l β l'] g β f =o[l] g β§ f =o[l'] g :=
β¨fun h => β¨h.mono le_sup_left, h.mono le_sup_rightβ©, fun h => h.1.sup h.2β©
#align asymptotics.is_o_sup Asymptotics.isLittleO_sup
theorem isBigOWith_insert [TopologicalSpace Ξ±] {x : Ξ±} {s : Set Ξ±} {C : β} {g : Ξ± β E} {g' : Ξ± β F}
(h : βg xβ β€ C * βg' xβ) : IsBigOWith C (π[insert x s] x) g g' β
IsBigOWith C (π[s] x) g g' := by
simp_rw [IsBigOWith_def, nhdsWithin_insert, eventually_sup, eventually_pure, h, true_and_iff]
#align asymptotics.is_O_with_insert Asymptotics.isBigOWith_insert
protected theorem IsBigOWith.insert [TopologicalSpace Ξ±] {x : Ξ±} {s : Set Ξ±} {C : β} {g : Ξ± β E}
{g' : Ξ± β F} (h1 : IsBigOWith C (π[s] x) g g') (h2 : βg xβ β€ C * βg' xβ) :
IsBigOWith C (π[insert x s] x) g g' :=
(isBigOWith_insert h2).mpr h1
#align asymptotics.is_O_with.insert Asymptotics.IsBigOWith.insert
theorem isLittleO_insert [TopologicalSpace Ξ±] {x : Ξ±} {s : Set Ξ±} {g : Ξ± β E'} {g' : Ξ± β F'}
(h : g x = 0) : g =o[π[insert x s] x] g' β g =o[π[s] x] g' := by
simp_rw [IsLittleO_def]
refine forall_congr' fun c => forall_congr' fun hc => ?_
rw [isBigOWith_insert]
rw [h, norm_zero]
exact mul_nonneg hc.le (norm_nonneg _)
#align asymptotics.is_o_insert Asymptotics.isLittleO_insert
protected theorem IsLittleO.insert [TopologicalSpace Ξ±] {x : Ξ±} {s : Set Ξ±} {g : Ξ± β E'}
{g' : Ξ± β F'} (h1 : g =o[π[s] x] g') (h2 : g x = 0) : g =o[π[insert x s] x] g' :=
(isLittleO_insert h2).mpr h1
#align asymptotics.is_o.insert Asymptotics.IsLittleO.insert
@[simp]
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 897 | 898 | theorem isBigOWith_neg_right : (IsBigOWith c l f fun x => -g' x) β IsBigOWith c l f g' := by |
simp only [IsBigOWith_def, norm_neg]
|
import Mathlib.Algebra.CharP.Defs
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Int.ModEq
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Dynamics.PeriodicPts
import Mathlib.GroupTheory.Index
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Order.Interval.Set.Infinite
#align_import group_theory.order_of_element from "leanprover-community/mathlib"@"d07245fd37786daa997af4f1a73a49fa3b748408"
open Function Fintype Nat Pointwise Subgroup Submonoid
variable {G H A Ξ± Ξ² : Type*}
section Monoid
variable [Monoid G] {a b x y : G} {n m : β}
@[to_additive
"`addOrderOf a` is the order of the element `a`, i.e. the `n β₯ 1`, s.t. `n β’ a = 0` if it
exists. Otherwise, i.e. if `a` is of infinite order, then `addOrderOf a` is `0` by convention."]
noncomputable def orderOf (x : G) : β :=
minimalPeriod (x * Β·) 1
#align order_of orderOf
#align add_order_of addOrderOf
@[simp]
theorem addOrderOf_ofMul_eq_orderOf (x : G) : addOrderOf (Additive.ofMul x) = orderOf x :=
rfl
#align add_order_of_of_mul_eq_order_of addOrderOf_ofMul_eq_orderOf
@[simp]
lemma orderOf_ofAdd_eq_addOrderOf {Ξ± : Type*} [AddMonoid Ξ±] (a : Ξ±) :
orderOf (Multiplicative.ofAdd a) = addOrderOf a := rfl
#align order_of_of_add_eq_add_order_of orderOf_ofAdd_eq_addOrderOf
@[to_additive]
protected lemma IsOfFinOrder.orderOf_pos (h : IsOfFinOrder x) : 0 < orderOf x :=
minimalPeriod_pos_of_mem_periodicPts h
#align order_of_pos' IsOfFinOrder.orderOf_pos
#align add_order_of_pos' IsOfFinAddOrder.addOrderOf_pos
@[to_additive addOrderOf_nsmul_eq_zero]
| Mathlib/GroupTheory/OrderOfElement.lean | 177 | 180 | theorem pow_orderOf_eq_one (x : G) : x ^ orderOf x = 1 := by |
convert Eq.trans _ (isPeriodicPt_minimalPeriod (x * Β·) 1)
-- Porting note(#12129): additional beta reduction needed in the middle of the rewrite
rw [orderOf, mul_left_iterate]; beta_reduce; rw [mul_one]
|
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.NormTrace
#align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a"
open scoped NumberField
open Finset NumberField Algebra FiniteDimensional
namespace RingOfIntegers
variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L]
noncomputable def norm [IsSeparable K L] : π L β* π K :=
RingOfIntegers.restrict_monoidHom
((Algebra.norm K).comp (algebraMap (π L) L : (π L) β* L))
fun x => isIntegral_norm K x.2
#align ring_of_integers.norm RingOfIntegers.norm
@[simp] lemma coe_norm [IsSeparable K L] (x : π L) :
norm K x = Algebra.norm K (x : L) := rfl
theorem coe_algebraMap_norm [IsSeparable K L] (x : π L) :
(algebraMap (π K) (π L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) :=
rfl
#align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm
theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : π K) :
algebraMap _ K (norm K (algebraMap (π K) (π L) x)) =
Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl
#align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap
theorem norm_algebraMap [IsSeparable K L] (x : π K) :
norm K (algebraMap (π K) (π L) x) = x ^ finrank K L := by
rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap,
RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap,
RingOfIntegers.coe_eq_algebraMap, map_pow]
#align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : π L} : IsUnit (norm K x) β IsUnit x := by
classical
refine β¨fun hx => ?_, IsUnit.map _β©
replace hx : IsUnit (algebraMap (π K) (π L) <| norm K x) := hx.map (algebraMap (π K) <| π L)
refine @isUnit_of_mul_isUnit_right (π L) _
β¨(univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x,
prod_mem fun Ο _ => x.2.map (Ο : L β+* L).toIntAlgHomβ© _ ?_
convert hx using 1
ext
convert_to ((univ \ {AlgEquiv.refl}).prod fun Ο : L ββ[K] L => Ο x) *
β Ο β {(AlgEquiv.refl : L ββ[K] L)}, Ο x = _
Β· rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul,
RingOfIntegers.map_mk]
Β· rw [prod_sdiff <| subset_univ _, β norm_eq_prod_automorphisms, coe_algebraMap_norm]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
| Mathlib/NumberTheory/NumberField/Norm.lean | 90 | 99 | theorem dvd_norm [IsGalois K L] (x : π L) : x β£ algebraMap (π K) (π L) (norm K x) := by |
classical
have hint :
IsIntegral β€ (β Ο β univ.erase (AlgEquiv.refl : L ββ[K] L), Ο x) :=
IsIntegral.prod _ (fun Ο _ =>
((RingOfIntegers.isIntegral_coe x).map Ο))
refine β¨β¨_, hintβ©, ?_β©
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [β Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
|
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring.List
import Mathlib.Data.Int.ModEq
import Mathlib.Data.Nat.Bits
import Mathlib.Data.Nat.Log
import Mathlib.Data.List.Indexes
import Mathlib.Data.List.Palindrome
import Mathlib.Tactic.IntervalCases
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
#align_import data.nat.digits from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
namespace Nat
variable {n : β}
def digitsAux0 : β β List β
| 0 => []
| n + 1 => [n + 1]
#align nat.digits_aux_0 Nat.digitsAux0
def digitsAux1 (n : β) : List β :=
List.replicate n 1
#align nat.digits_aux_1 Nat.digitsAux1
def digitsAux (b : β) (h : 2 β€ b) : β β List β
| 0 => []
| n + 1 =>
((n + 1) % b) :: digitsAux b h ((n + 1) / b)
decreasing_by exact Nat.div_lt_self (Nat.succ_pos _) h
#align nat.digits_aux Nat.digitsAux
@[simp]
theorem digitsAux_zero (b : β) (h : 2 β€ b) : digitsAux b h 0 = [] := by rw [digitsAux]
#align nat.digits_aux_zero Nat.digitsAux_zero
theorem digitsAux_def (b : β) (h : 2 β€ b) (n : β) (w : 0 < n) :
digitsAux b h n = (n % b) :: digitsAux b h (n / b) := by
cases n
Β· cases w
Β· rw [digitsAux]
#align nat.digits_aux_def Nat.digitsAux_def
def digits : β β β β List β
| 0 => digitsAux0
| 1 => digitsAux1
| b + 2 => digitsAux (b + 2) (by norm_num)
#align nat.digits Nat.digits
@[simp]
theorem digits_zero (b : β) : digits b 0 = [] := by
rcases b with (_ | β¨_ | β¨_β©β©) <;> simp [digits, digitsAux0, digitsAux1]
#align nat.digits_zero Nat.digits_zero
-- @[simp] -- Porting note (#10618): simp can prove this
theorem digits_zero_zero : digits 0 0 = [] :=
rfl
#align nat.digits_zero_zero Nat.digits_zero_zero
@[simp]
theorem digits_zero_succ (n : β) : digits 0 n.succ = [n + 1] :=
rfl
#align nat.digits_zero_succ Nat.digits_zero_succ
theorem digits_zero_succ' : β {n : β}, n β 0 β digits 0 n = [n]
| 0, h => (h rfl).elim
| _ + 1, _ => rfl
#align nat.digits_zero_succ' Nat.digits_zero_succ'
@[simp]
theorem digits_one (n : β) : digits 1 n = List.replicate n 1 :=
rfl
#align nat.digits_one Nat.digits_one
-- @[simp] -- Porting note (#10685): dsimp can prove this
theorem digits_one_succ (n : β) : digits 1 (n + 1) = 1 :: digits 1 n :=
rfl
#align nat.digits_one_succ Nat.digits_one_succ
theorem digits_add_two_add_one (b n : β) :
digits (b + 2) (n + 1) = ((n + 1) % (b + 2)) :: digits (b + 2) ((n + 1) / (b + 2)) := by
simp [digits, digitsAux_def]
#align nat.digits_add_two_add_one Nat.digits_add_two_add_one
@[simp]
lemma digits_of_two_le_of_pos {b : β} (hb : 2 β€ b) (hn : 0 < n) :
Nat.digits b n = n % b :: Nat.digits b (n / b) := by
rw [Nat.eq_add_of_sub_eq hb rfl, Nat.eq_add_of_sub_eq hn rfl, Nat.digits_add_two_add_one]
theorem digits_def' :
β {b : β} (_ : 1 < b) {n : β} (_ : 0 < n), digits b n = (n % b) :: digits b (n / b)
| 0, h => absurd h (by decide)
| 1, h => absurd h (by decide)
| b + 2, _ => digitsAux_def _ (by simp) _
#align nat.digits_def' Nat.digits_def'
@[simp]
theorem digits_of_lt (b x : β) (hx : x β 0) (hxb : x < b) : digits b x = [x] := by
rcases exists_eq_succ_of_ne_zero hx with β¨x, rflβ©
rcases Nat.exists_eq_add_of_le' ((Nat.le_add_left 1 x).trans_lt hxb) with β¨b, rflβ©
rw [digits_add_two_add_one, div_eq_of_lt hxb, digits_zero, mod_eq_of_lt hxb]
#align nat.digits_of_lt Nat.digits_of_lt
theorem digits_add (b : β) (h : 1 < b) (x y : β) (hxb : x < b) (hxy : x β 0 β¨ y β 0) :
digits b (x + b * y) = x :: digits b y := by
rcases Nat.exists_eq_add_of_le' h with β¨b, rfl : _ = _ + 2β©
cases y
Β· simp [hxb, hxy.resolve_right (absurd rfl)]
dsimp [digits]
rw [digitsAux_def]
Β· congr
Β· simp [Nat.add_mod, mod_eq_of_lt hxb]
Β· simp [add_mul_div_left, div_eq_of_lt hxb]
Β· apply Nat.succ_pos
#align nat.digits_add Nat.digits_add
-- If we had a function converting a list into a polynomial,
-- and appropriate lemmas about that function,
-- we could rewrite this in terms of that.
def ofDigits {Ξ± : Type*} [Semiring Ξ±] (b : Ξ±) : List β β Ξ±
| [] => 0
| h :: t => h + b * ofDigits b t
#align nat.of_digits Nat.ofDigits
theorem ofDigits_eq_foldr {Ξ± : Type*} [Semiring Ξ±] (b : Ξ±) (L : List β) :
ofDigits b L = List.foldr (fun x y => βx + b * y) 0 L := by
induction' L with d L ih
Β· rfl
Β· dsimp [ofDigits]
rw [ih]
#align nat.of_digits_eq_foldr Nat.ofDigits_eq_foldr
theorem ofDigits_eq_sum_map_with_index_aux (b : β) (l : List β) :
((List.range l.length).zipWith ((fun i a : β => a * b ^ (i + 1))) l).sum =
b * ((List.range l.length).zipWith (fun i a => a * b ^ i) l).sum := by
suffices
(List.range l.length).zipWith (fun i a : β => a * b ^ (i + 1)) l =
(List.range l.length).zipWith (fun i a => b * (a * b ^ i)) l
by simp [this]
congr; ext; simp [pow_succ]; ring
#align nat.of_digits_eq_sum_map_with_index_aux Nat.ofDigits_eq_sum_map_with_index_aux
theorem ofDigits_eq_sum_mapIdx (b : β) (L : List β) :
ofDigits b L = (L.mapIdx fun i a => a * b ^ i).sum := by
rw [List.mapIdx_eq_enum_map, List.enum_eq_zip_range, List.map_uncurry_zip_eq_zipWith,
ofDigits_eq_foldr]
induction' L with hd tl hl
Β· simp
Β· simpa [List.range_succ_eq_map, List.zipWith_map_left, ofDigits_eq_sum_map_with_index_aux] using
Or.inl hl
#align nat.of_digits_eq_sum_map_with_index Nat.ofDigits_eq_sum_mapIdx
@[simp]
theorem ofDigits_nil {b : β} : ofDigits b [] = 0 := rfl
@[simp]
theorem ofDigits_singleton {b n : β} : ofDigits b [n] = n := by simp [ofDigits]
#align nat.of_digits_singleton Nat.ofDigits_singleton
@[simp]
theorem ofDigits_one_cons {Ξ± : Type*} [Semiring Ξ±] (h : β) (L : List β) :
ofDigits (1 : Ξ±) (h :: L) = h + ofDigits 1 L := by simp [ofDigits]
#align nat.of_digits_one_cons Nat.ofDigits_one_cons
theorem ofDigits_cons {b hd} {tl : List β} :
ofDigits b (hd :: tl) = hd + b * ofDigits b tl := rfl
theorem ofDigits_append {b : β} {l1 l2 : List β} :
ofDigits b (l1 ++ l2) = ofDigits b l1 + b ^ l1.length * ofDigits b l2 := by
induction' l1 with hd tl IH
Β· simp [ofDigits]
Β· rw [ofDigits, List.cons_append, ofDigits, IH, List.length_cons, pow_succ']
ring
#align nat.of_digits_append Nat.ofDigits_append
@[norm_cast]
theorem coe_ofDigits (Ξ± : Type*) [Semiring Ξ±] (b : β) (L : List β) :
((ofDigits b L : β) : Ξ±) = ofDigits (b : Ξ±) L := by
induction' L with d L ih
Β· simp [ofDigits]
Β· dsimp [ofDigits]; push_cast; rw [ih]
#align nat.coe_of_digits Nat.coe_ofDigits
@[norm_cast]
theorem coe_int_ofDigits (b : β) (L : List β) : ((ofDigits b L : β) : β€) = ofDigits (b : β€) L := by
induction' L with d L _
Β· rfl
Β· dsimp [ofDigits]; push_cast; simp only
#align nat.coe_int_of_digits Nat.coe_int_ofDigits
theorem digits_zero_of_eq_zero {b : β} (h : b β 0) :
β {L : List β} (_ : ofDigits b L = 0), β l β L, l = 0
| _ :: _, h0, _, List.Mem.head .. => Nat.eq_zero_of_add_eq_zero_right h0
| _ :: _, h0, _, List.Mem.tail _ hL =>
digits_zero_of_eq_zero h (mul_right_injectiveβ h (Nat.eq_zero_of_add_eq_zero_left h0)) _ hL
#align nat.digits_zero_of_eq_zero Nat.digits_zero_of_eq_zero
theorem digits_ofDigits (b : β) (h : 1 < b) (L : List β) (wβ : β l β L, l < b)
(wβ : β h : L β [], L.getLast h β 0) : digits b (ofDigits b L) = L := by
induction' L with d L ih
Β· dsimp [ofDigits]
simp
Β· dsimp [ofDigits]
replace wβ := wβ (by simp)
rw [digits_add b h]
Β· rw [ih]
Β· intro l m
apply wβ
exact List.mem_cons_of_mem _ m
Β· intro h
rw [List.getLast_cons h] at wβ
convert wβ
Β· exact wβ d (List.mem_cons_self _ _)
Β· by_cases h' : L = []
Β· rcases h' with rfl
left
simpa using wβ
Β· right
contrapose! wβ
refine digits_zero_of_eq_zero h.ne_bot wβ _ ?_
rw [List.getLast_cons h']
exact List.getLast_mem h'
#align nat.digits_of_digits Nat.digits_ofDigits
theorem ofDigits_digits (b n : β) : ofDigits b (digits b n) = n := by
cases' b with b
Β· cases' n with n
Β· rfl
Β· change ofDigits 0 [n + 1] = n + 1
dsimp [ofDigits]
Β· cases' b with b
Β· induction' n with n ih
Β· rfl
Β· rw [Nat.zero_add] at ih β’
simp only [ih, add_comm 1, ofDigits_one_cons, Nat.cast_id, digits_one_succ]
Β· apply Nat.strongInductionOn n _
clear n
intro n h
cases n
Β· rw [digits_zero]
rfl
Β· simp only [Nat.succ_eq_add_one, digits_add_two_add_one]
dsimp [ofDigits]
rw [h _ (Nat.div_lt_self' _ b)]
rw [Nat.mod_add_div]
#align nat.of_digits_digits Nat.ofDigits_digits
theorem ofDigits_one (L : List β) : ofDigits 1 L = L.sum := by
induction' L with _ _ ih
Β· rfl
Β· simp [ofDigits, List.sum_cons, ih]
#align nat.of_digits_one Nat.ofDigits_one
theorem digits_eq_nil_iff_eq_zero {b n : β} : digits b n = [] β n = 0 := by
constructor
Β· intro h
have : ofDigits b (digits b n) = ofDigits b [] := by rw [h]
convert this
rw [ofDigits_digits]
Β· rintro rfl
simp
#align nat.digits_eq_nil_iff_eq_zero Nat.digits_eq_nil_iff_eq_zero
theorem digits_ne_nil_iff_ne_zero {b n : β} : digits b n β [] β n β 0 :=
not_congr digits_eq_nil_iff_eq_zero
#align nat.digits_ne_nil_iff_ne_zero Nat.digits_ne_nil_iff_ne_zero
theorem digits_eq_cons_digits_div {b n : β} (h : 1 < b) (w : n β 0) :
digits b n = (n % b) :: digits b (n / b) := by
rcases b with (_ | _ | b)
Β· rw [digits_zero_succ' w, Nat.mod_zero, Nat.div_zero, Nat.digits_zero_zero]
Β· norm_num at h
rcases n with (_ | n)
Β· norm_num at w
Β· simp only [digits_add_two_add_one, ne_eq]
#align nat.digits_eq_cons_digits_div Nat.digits_eq_cons_digits_div
theorem digits_getLast {b : β} (m : β) (h : 1 < b) (p q) :
(digits b m).getLast p = (digits b (m / b)).getLast q := by
by_cases hm : m = 0
Β· simp [hm]
simp only [digits_eq_cons_digits_div h hm]
rw [List.getLast_cons]
#align nat.digits_last Nat.digits_getLast
theorem digits.injective (b : β) : Function.Injective b.digits :=
Function.LeftInverse.injective (ofDigits_digits b)
#align nat.digits.injective Nat.digits.injective
@[simp]
theorem digits_inj_iff {b n m : β} : b.digits n = b.digits m β n = m :=
(digits.injective b).eq_iff
#align nat.digits_inj_iff Nat.digits_inj_iff
theorem digits_len (b n : β) (hb : 1 < b) (hn : n β 0) : (b.digits n).length = b.log n + 1 := by
induction' n using Nat.strong_induction_on with n IH
rw [digits_eq_cons_digits_div hb hn, List.length]
by_cases h : n / b = 0
Β· have hb0 : b β 0 := (Nat.succ_le_iff.1 hb).ne_bot
simp [h, log_eq_zero_iff, β Nat.div_eq_zero_iff hb0.bot_lt]
Β· have : n / b < n := div_lt_self (Nat.pos_of_ne_zero hn) hb
rw [IH _ this h, log_div_base, tsub_add_cancel_of_le]
refine Nat.succ_le_of_lt (log_pos hb ?_)
contrapose! h
exact div_eq_of_lt h
#align nat.digits_len Nat.digits_len
theorem getLast_digit_ne_zero (b : β) {m : β} (hm : m β 0) :
(digits b m).getLast (digits_ne_nil_iff_ne_zero.mpr hm) β 0 := by
rcases b with (_ | _ | b)
Β· cases m
Β· cases hm rfl
Β· simp
Β· cases m
Β· cases hm rfl
rename β => m
simp only [zero_add, digits_one, List.getLast_replicate_succ m 1]
exact Nat.one_ne_zero
revert hm
apply Nat.strongInductionOn m
intro n IH hn
by_cases hnb : n < b + 2
Β· simpa only [digits_of_lt (b + 2) n hn hnb]
Β· rw [digits_getLast n (le_add_left 2 b)]
refine IH _ (Nat.div_lt_self hn.bot_lt (one_lt_succ_succ b)) ?_
rw [β pos_iff_ne_zero]
exact Nat.div_pos (le_of_not_lt hnb) (zero_lt_succ (succ b))
#align nat.last_digit_ne_zero Nat.getLast_digit_ne_zero
theorem mul_ofDigits (n : β) {b : β} {l : List β} :
n * ofDigits b l = ofDigits b (l.map (n * Β·)) := by
induction l with
| nil => rfl
| cons hd tl ih =>
rw [List.map_cons, ofDigits_cons, ofDigits_cons, β ih]
ring
theorem ofDigits_add_ofDigits_eq_ofDigits_zipWith_of_length_eq {b : β} {l1 l2 : List β}
(h : l1.length = l2.length) :
ofDigits b l1 + ofDigits b l2 = ofDigits b (l1.zipWith (Β· + Β·) l2) := by
induction l1 generalizing l2 with
| nil => simp_all [eq_comm, List.length_eq_zero, ofDigits]
| cons hdβ tlβ ihβ =>
induction l2 generalizing tlβ with
| nil => simp_all
| cons hdβ tlβ ihβ =>
simp_all only [List.length_cons, succ_eq_add_one, ofDigits_cons, add_left_inj,
eq_comm, List.zipWith_cons_cons, add_eq]
rw [β ihβ h.symm, mul_add]
ac_rfl
theorem digits_lt_base' {b m : β} : β {d}, d β digits (b + 2) m β d < b + 2 := by
apply Nat.strongInductionOn m
intro n IH d hd
cases' n with n
Β· rw [digits_zero] at hd
cases hd
-- base b+2 expansion of 0 has no digits
rw [digits_add_two_add_one] at hd
cases hd
Β· exact n.succ.mod_lt (by simp)
-- Porting note: Previous code (single line) contained linarith.
-- . exact IH _ (Nat.div_lt_self (Nat.succ_pos _) (by linarith)) hd
Β· apply IH ((n + 1) / (b + 2))
Β· apply Nat.div_lt_self <;> omega
Β· assumption
#align nat.digits_lt_base' Nat.digits_lt_base'
theorem digits_lt_base {b m d : β} (hb : 1 < b) (hd : d β digits b m) : d < b := by
rcases b with (_ | _ | b) <;> try simp_all
exact digits_lt_base' hd
#align nat.digits_lt_base Nat.digits_lt_base
theorem ofDigits_lt_base_pow_length' {b : β} {l : List β} (hl : β x β l, x < b + 2) :
ofDigits (b + 2) l < (b + 2) ^ l.length := by
induction' l with hd tl IH
Β· simp [ofDigits]
Β· rw [ofDigits, List.length_cons, pow_succ]
have : (ofDigits (b + 2) tl + 1) * (b + 2) β€ (b + 2) ^ tl.length * (b + 2) :=
mul_le_mul (IH fun x hx => hl _ (List.mem_cons_of_mem _ hx)) (by rfl) (by simp only [zero_le])
(Nat.zero_le _)
suffices βhd < b + 2 by linarith
exact hl hd (List.mem_cons_self _ _)
#align nat.of_digits_lt_base_pow_length' Nat.ofDigits_lt_base_pow_length'
theorem ofDigits_lt_base_pow_length {b : β} {l : List β} (hb : 1 < b) (hl : β x β l, x < b) :
ofDigits b l < b ^ l.length := by
rcases b with (_ | _ | b) <;> try simp_all
exact ofDigits_lt_base_pow_length' hl
#align nat.of_digits_lt_base_pow_length Nat.ofDigits_lt_base_pow_length
theorem lt_base_pow_length_digits' {b m : β} : m < (b + 2) ^ (digits (b + 2) m).length := by
convert @ofDigits_lt_base_pow_length' b (digits (b + 2) m) fun _ => digits_lt_base'
rw [ofDigits_digits (b + 2) m]
#align nat.lt_base_pow_length_digits' Nat.lt_base_pow_length_digits'
theorem lt_base_pow_length_digits {b m : β} (hb : 1 < b) : m < b ^ (digits b m).length := by
rcases b with (_ | _ | b) <;> try simp_all
exact lt_base_pow_length_digits'
#align nat.lt_base_pow_length_digits Nat.lt_base_pow_length_digits
theorem ofDigits_digits_append_digits {b m n : β} :
ofDigits b (digits b n ++ digits b m) = n + b ^ (digits b n).length * m := by
rw [ofDigits_append, ofDigits_digits, ofDigits_digits]
#align nat.of_digits_digits_append_digits Nat.ofDigits_digits_append_digits
theorem digits_append_digits {b m n : β} (hb : 0 < b) :
digits b n ++ digits b m = digits b (n + b ^ (digits b n).length * m) := by
rcases eq_or_lt_of_le (Nat.succ_le_of_lt hb) with (rfl | hb)
Β· simp [List.replicate_add]
rw [β ofDigits_digits_append_digits]
refine (digits_ofDigits b hb _ (fun l hl => ?_) (fun h_append => ?_)).symm
Β· rcases (List.mem_append.mp hl) with (h | h) <;> exact digits_lt_base hb h
Β· by_cases h : digits b m = []
Β· simp only [h, List.append_nil] at h_append β’
exact getLast_digit_ne_zero b <| digits_ne_nil_iff_ne_zero.mp h_append
Β· exact (List.getLast_append' _ _ h) βΈ
(getLast_digit_ne_zero _ <| digits_ne_nil_iff_ne_zero.mp h)
theorem digits_len_le_digits_len_succ (b n : β) :
(digits b n).length β€ (digits b (n + 1)).length := by
rcases Decidable.eq_or_ne n 0 with (rfl | hn)
Β· simp
rcases le_or_lt b 1 with hb | hb
Β· interval_cases b <;> simp_arith [digits_zero_succ', hn]
simpa [digits_len, hb, hn] using log_mono_right (le_succ _)
#align nat.digits_len_le_digits_len_succ Nat.digits_len_le_digits_len_succ
theorem le_digits_len_le (b n m : β) (h : n β€ m) : (digits b n).length β€ (digits b m).length :=
monotone_nat_of_le_succ (digits_len_le_digits_len_succ b) h
#align nat.le_digits_len_le Nat.le_digits_len_le
@[mono]
theorem ofDigits_monotone {p q : β} (L : List β) (h : p β€ q) : ofDigits p L β€ ofDigits q L := by
induction' L with _ _ hi
Β· rfl
Β· simp only [ofDigits, cast_id, add_le_add_iff_left]
exact Nat.mul_le_mul h hi
theorem sum_le_ofDigits {p : β} (L : List β) (h : 1 β€ p) : L.sum β€ ofDigits p L :=
(ofDigits_one L).symm βΈ ofDigits_monotone L h
theorem digit_sum_le (p n : β) : List.sum (digits p n) β€ n := by
induction' n with n
Β· exact digits_zero _ βΈ Nat.le_refl (List.sum [])
Β· induction' p with p
Β· rw [digits_zero_succ, List.sum_cons, List.sum_nil, add_zero]
Β· nth_rw 2 [β ofDigits_digits p.succ (n + 1)]
rw [β ofDigits_one <| digits p.succ n.succ]
exact ofDigits_monotone (digits p.succ n.succ) <| Nat.succ_pos p
theorem pow_length_le_mul_ofDigits {b : β} {l : List β} (hl : l β []) (hl2 : l.getLast hl β 0) :
(b + 2) ^ l.length β€ (b + 2) * ofDigits (b + 2) l := by
rw [β List.dropLast_append_getLast hl]
simp only [List.length_append, List.length, zero_add, List.length_dropLast, ofDigits_append,
List.length_dropLast, ofDigits_singleton, add_comm (l.length - 1), pow_add, pow_one]
apply Nat.mul_le_mul_left
refine le_trans ?_ (Nat.le_add_left _ _)
have : 0 < l.getLast hl := by rwa [pos_iff_ne_zero]
convert Nat.mul_le_mul_left ((b + 2) ^ (l.length - 1)) this using 1
rw [Nat.mul_one]
#align nat.pow_length_le_mul_of_digits Nat.pow_length_le_mul_ofDigits
theorem base_pow_length_digits_le' (b m : β) (hm : m β 0) :
(b + 2) ^ (digits (b + 2) m).length β€ (b + 2) * m := by
have : digits (b + 2) m β [] := digits_ne_nil_iff_ne_zero.mpr hm
convert @pow_length_le_mul_ofDigits b (digits (b+2) m)
this (getLast_digit_ne_zero _ hm)
rw [ofDigits_digits]
#align nat.base_pow_length_digits_le' Nat.base_pow_length_digits_le'
theorem base_pow_length_digits_le (b m : β) (hb : 1 < b) :
m β 0 β b ^ (digits b m).length β€ b * m := by
rcases b with (_ | _ | b) <;> try simp_all
exact base_pow_length_digits_le' b m
#align nat.base_pow_length_digits_le Nat.base_pow_length_digits_le
lemma ofDigits_div_eq_ofDigits_tail {p : β} (hpos : 0 < p) (digits : List β)
(wβ : β l β digits, l < p) : ofDigits p digits / p = ofDigits p digits.tail := by
induction' digits with hd tl
Β· simp [ofDigits]
Β· refine Eq.trans (add_mul_div_left hd _ hpos) ?_
rw [Nat.div_eq_of_lt <| wβ _ <| List.mem_cons_self _ _, zero_add]
rfl
lemma ofDigits_div_pow_eq_ofDigits_drop
{p : β} (i : β) (hpos : 0 < p) (digits : List β) (wβ : β l β digits, l < p) :
ofDigits p digits / p ^ i = ofDigits p (digits.drop i) := by
induction' i with i hi
Β· simp
Β· rw [Nat.pow_succ, β Nat.div_div_eq_div_mul, hi, ofDigits_div_eq_ofDigits_tail hpos
(List.drop i digits) fun x hx β¦ wβ x <| List.mem_of_mem_drop hx, β List.drop_one,
List.drop_drop, add_comm]
lemma self_div_pow_eq_ofDigits_drop {p : β} (i n : β) (h : 2 β€ p):
n / p ^ i = ofDigits p ((p.digits n).drop i) := by
convert ofDigits_div_pow_eq_ofDigits_drop i (zero_lt_of_lt h) (p.digits n)
(fun l hl β¦ digits_lt_base h hl)
exact (ofDigits_digits p n).symm
open Finset
theorem sub_one_mul_sum_div_pow_eq_sub_sum_digits {p : β}
(L : List β) {h_nonempty} (h_ne_zero : L.getLast h_nonempty β 0) (h_lt : β l β L, l < p) :
(p - 1) * β i β range L.length, (ofDigits p L) / p ^ i.succ = (ofDigits p L) - L.sum := by
obtain h | rfl | h : 1 < p β¨ 1 = p β¨ p < 1 := trichotomous 1 p
Β· induction' L with hd tl ih
Β· simp [ofDigits]
Β· simp only [List.length_cons, List.sum_cons, self_div_pow_eq_ofDigits_drop _ _ h,
digits_ofDigits p h (hd :: tl) h_lt (fun _ => h_ne_zero)]
simp only [ofDigits]
rw [sum_range_succ, Nat.cast_id]
simp only [List.drop, List.drop_length]
obtain rfl | h' := em <| tl = []
Β· simp [ofDigits]
Β· have wβ' := fun l hl β¦ h_lt l <| List.mem_cons_of_mem hd hl
have wβ' := fun (h : tl β []) β¦ (List.getLast_cons h) βΈ h_ne_zero
have ih := ih (wβ' h') wβ'
simp only [self_div_pow_eq_ofDigits_drop _ _ h, digits_ofDigits p h tl wβ' wβ',
β Nat.one_add] at ih
have := sum_singleton (fun x β¦ ofDigits p <| tl.drop x) tl.length
rw [β Ico_succ_singleton, List.drop_length, ofDigits] at this
have hβ : 1 β€ tl.length := List.length_pos.mpr h'
rw [β sum_range_add_sum_Ico _ <| hβ, β add_zero (β x β Ico _ _, ofDigits p (tl.drop x)),
β this, sum_Ico_consecutive _ hβ <| (le_add_right tl.length 1),
β sum_Ico_add _ 0 tl.length 1,
Ico_zero_eq_range, mul_add, mul_add, ih, range_one, sum_singleton, List.drop, ofDigits,
mul_zero, add_zero, β Nat.add_sub_assoc <| sum_le_ofDigits _ <| Nat.le_of_lt h]
nth_rw 2 [β one_mul <| ofDigits p tl]
rw [β add_mul, one_eq_succ_zero, Nat.sub_add_cancel <| zero_lt_of_lt h,
Nat.add_sub_add_left]
Β· simp [ofDigits_one]
Β· simp [lt_one_iff.mp h]
cases L
Β· rfl
Β· simp [ofDigits]
theorem sub_one_mul_sum_log_div_pow_eq_sub_sum_digits {p : β} (n : β) :
(p - 1) * β i β range (log p n).succ, n / p ^ i.succ = n - (p.digits n).sum := by
obtain h | rfl | h : 1 < p β¨ 1 = p β¨ p < 1 := trichotomous 1 p
Β· rcases eq_or_ne n 0 with rfl | hn
Β· simp
Β· convert sub_one_mul_sum_div_pow_eq_sub_sum_digits (p.digits n) (getLast_digit_ne_zero p hn) <|
(fun l a β¦ digits_lt_base h a)
Β· refine (digits_len p n h hn).symm
all_goals exact (ofDigits_digits p n).symm
Β· simp
Β· simp [lt_one_iff.mp h]
cases n
all_goals simp
theorem digits_two_eq_bits (n : β) : digits 2 n = n.bits.map fun b => cond b 1 0 := by
induction' n using Nat.binaryRecFromOne with b n h ih
Β· simp
Β· rfl
rw [bits_append_bit _ _ fun hn => absurd hn h]
cases b
Β· rw [digits_def' one_lt_two]
Β· simpa [Nat.bit, Nat.bit0_val n]
Β· simpa [pos_iff_ne_zero, Nat.bit0_eq_zero]
Β· simpa [Nat.bit, Nat.bit1_val n, add_comm, digits_add 2 one_lt_two 1 n, Nat.add_mul_div_left]
#align nat.digits_two_eq_bits Nat.digits_two_eq_bits
-- This is really a theorem about polynomials.
theorem dvd_ofDigits_sub_ofDigits {Ξ± : Type*} [CommRing Ξ±] {a b k : Ξ±} (h : k β£ a - b)
(L : List β) : k β£ ofDigits a L - ofDigits b L := by
induction' L with d L ih
Β· change k β£ 0 - 0
simp
Β· simp only [ofDigits, add_sub_add_left_eq_sub]
exact dvd_mul_sub_mul h ih
#align nat.dvd_of_digits_sub_of_digits Nat.dvd_ofDigits_sub_ofDigits
theorem ofDigits_modEq' (b b' : β) (k : β) (h : b β‘ b' [MOD k]) (L : List β) :
ofDigits b L β‘ ofDigits b' L [MOD k] := by
induction' L with d L ih
Β· rfl
Β· dsimp [ofDigits]
dsimp [Nat.ModEq] at *
conv_lhs => rw [Nat.add_mod, Nat.mul_mod, h, ih]
conv_rhs => rw [Nat.add_mod, Nat.mul_mod]
#align nat.of_digits_modeq' Nat.ofDigits_modEq'
theorem ofDigits_modEq (b k : β) (L : List β) : ofDigits b L β‘ ofDigits (b % k) L [MOD k] :=
ofDigits_modEq' b (b % k) k (b.mod_modEq k).symm L
#align nat.of_digits_modeq Nat.ofDigits_modEq
theorem ofDigits_mod (b k : β) (L : List β) : ofDigits b L % k = ofDigits (b % k) L % k :=
ofDigits_modEq b k L
#align nat.of_digits_mod Nat.ofDigits_mod
theorem ofDigits_mod_eq_head! (b : β) (l : List β) : ofDigits b l % b = l.head! % b := by
induction l <;> simp [Nat.ofDigits, Int.ModEq]
theorem head!_digits {b n : β} (h : b β 1) : (Nat.digits b n).head! = n % b := by
by_cases hb : 1 < b
Β· rcases n with _ | n
Β· simp
Β· nth_rw 2 [β Nat.ofDigits_digits b (n + 1)]
rw [Nat.ofDigits_mod_eq_head! _ _]
exact (Nat.mod_eq_of_lt (Nat.digits_lt_base hb <| List.head!_mem_self <|
Nat.digits_ne_nil_iff_ne_zero.mpr <| Nat.succ_ne_zero n)).symm
Β· rcases n with _ | _ <;> simp_all [show b = 0 by omega]
theorem ofDigits_zmodeq' (b b' : β€) (k : β) (h : b β‘ b' [ZMOD k]) (L : List β) :
ofDigits b L β‘ ofDigits b' L [ZMOD k] := by
induction' L with d L ih
Β· rfl
Β· dsimp [ofDigits]
dsimp [Int.ModEq] at *
conv_lhs => rw [Int.add_emod, Int.mul_emod, h, ih]
conv_rhs => rw [Int.add_emod, Int.mul_emod]
#align nat.of_digits_zmodeq' Nat.ofDigits_zmodeq'
theorem ofDigits_zmodeq (b : β€) (k : β) (L : List β) : ofDigits b L β‘ ofDigits (b % k) L [ZMOD k] :=
ofDigits_zmodeq' b (b % k) k (b.mod_modEq βk).symm L
#align nat.of_digits_zmodeq Nat.ofDigits_zmodeq
theorem ofDigits_zmod (b : β€) (k : β) (L : List β) : ofDigits b L % k = ofDigits (b % k) L % k :=
ofDigits_zmodeq b k L
#align nat.of_digits_zmod Nat.ofDigits_zmod
theorem modEq_digits_sum (b b' : β) (h : b' % b = 1) (n : β) : n β‘ (digits b' n).sum [MOD b] := by
rw [β ofDigits_one]
conv =>
congr
Β· skip
Β· rw [β ofDigits_digits b' n]
convert ofDigits_modEq b' b (digits b' n)
exact h.symm
#align nat.modeq_digits_sum Nat.modEq_digits_sum
theorem modEq_three_digits_sum (n : β) : n β‘ (digits 10 n).sum [MOD 3] :=
modEq_digits_sum 3 10 (by norm_num) n
#align nat.modeq_three_digits_sum Nat.modEq_three_digits_sum
theorem modEq_nine_digits_sum (n : β) : n β‘ (digits 10 n).sum [MOD 9] :=
modEq_digits_sum 9 10 (by norm_num) n
#align nat.modeq_nine_digits_sum Nat.modEq_nine_digits_sum
theorem zmodeq_ofDigits_digits (b b' : β) (c : β€) (h : b' β‘ c [ZMOD b]) (n : β) :
n β‘ ofDigits c (digits b' n) [ZMOD b] := by
conv =>
congr
Β· skip
Β· rw [β ofDigits_digits b' n]
rw [coe_int_ofDigits]
apply ofDigits_zmodeq' _ _ _ h
#align nat.zmodeq_of_digits_digits Nat.zmodeq_ofDigits_digits
theorem ofDigits_neg_one :
β L : List β, ofDigits (-1 : β€) L = (L.map fun n : β => (n : β€)).alternatingSum
| [] => rfl
| [n] => by simp [ofDigits, List.alternatingSum]
| a :: b :: t => by
simp only [ofDigits, List.alternatingSum, List.map_cons, ofDigits_neg_one t]
ring
#align nat.of_digits_neg_one Nat.ofDigits_neg_one
theorem modEq_eleven_digits_sum (n : β) :
n β‘ ((digits 10 n).map fun n : β => (n : β€)).alternatingSum [ZMOD 11] := by
have t := zmodeq_ofDigits_digits 11 10 (-1 : β€) (by unfold Int.ModEq; rfl) n
rwa [ofDigits_neg_one] at t
#align nat.modeq_eleven_digits_sum Nat.modEq_eleven_digits_sum
theorem dvd_iff_dvd_digits_sum (b b' : β) (h : b' % b = 1) (n : β) :
b β£ n β b β£ (digits b' n).sum := by
rw [β ofDigits_one]
conv_lhs => rw [β ofDigits_digits b' n]
rw [Nat.dvd_iff_mod_eq_zero, Nat.dvd_iff_mod_eq_zero, ofDigits_mod, h]
#align nat.dvd_iff_dvd_digits_sum Nat.dvd_iff_dvd_digits_sum
theorem three_dvd_iff (n : β) : 3 β£ n β 3 β£ (digits 10 n).sum :=
dvd_iff_dvd_digits_sum 3 10 (by norm_num) n
#align nat.three_dvd_iff Nat.three_dvd_iff
theorem nine_dvd_iff (n : β) : 9 β£ n β 9 β£ (digits 10 n).sum :=
dvd_iff_dvd_digits_sum 9 10 (by norm_num) n
#align nat.nine_dvd_iff Nat.nine_dvd_iff
theorem dvd_iff_dvd_ofDigits (b b' : β) (c : β€) (h : (b : β€) β£ (b' : β€) - c) (n : β) :
b β£ n β (b : β€) β£ ofDigits c (digits b' n) := by
rw [β Int.natCast_dvd_natCast]
exact
dvd_iff_dvd_of_dvd_sub (zmodeq_ofDigits_digits b b' c (Int.modEq_iff_dvd.2 h).symm _).symm.dvd
#align nat.dvd_iff_dvd_of_digits Nat.dvd_iff_dvd_ofDigits
theorem eleven_dvd_iff :
11 β£ n β (11 : β€) β£ ((digits 10 n).map fun n : β => (n : β€)).alternatingSum := by
have t := dvd_iff_dvd_ofDigits 11 10 (-1 : β€) (by norm_num) n
rw [ofDigits_neg_one] at t
exact t
#align nat.eleven_dvd_iff Nat.eleven_dvd_iff
theorem eleven_dvd_of_palindrome (p : (digits 10 n).Palindrome) (h : Even (digits 10 n).length) :
11 β£ n := by
let dig := (digits 10 n).map fun n : β => (n : β€)
replace h : Even dig.length := by rwa [List.length_map]
refine eleven_dvd_iff.2 β¨0, (?_ : dig.alternatingSum = 0)β©
have := dig.alternatingSum_reverse
rw [(p.map _).reverse_eq, _root_.pow_succ', h.neg_one_pow, mul_one, neg_one_zsmul] at this
exact eq_zero_of_neg_eq this.symm
#align nat.eleven_dvd_of_palindrome Nat.eleven_dvd_of_palindrome
lemma toDigitsCore_lens_eq_aux (b f : Nat) :
β (n : Nat) (l1 l2 : List Char), l1.length = l2.length β
(Nat.toDigitsCore b f n l1).length = (Nat.toDigitsCore b f n l2).length := by
induction f with (simp only [Nat.toDigitsCore, List.length]; intro n l1 l2 hlen)
| zero => assumption
| succ f ih =>
if hx : n / b = 0 then
simp only [hx, if_true, List.length, congrArg (fun l β¦ l + 1) hlen]
else
simp only [hx, if_false]
specialize ih (n / b) (Nat.digitChar (n % b) :: l1) (Nat.digitChar (n % b) :: l2)
simp only [List.length, congrArg (fun l β¦ l + 1) hlen] at ih
exact ih trivial
@[deprecated (since := "2024-02-19")] alias to_digits_core_lens_eq_aux:= toDigitsCore_lens_eq_aux
lemma toDigitsCore_lens_eq (b f : Nat) : β (n : Nat) (c : Char) (tl : List Char),
(Nat.toDigitsCore b f n (c :: tl)).length = (Nat.toDigitsCore b f n tl).length + 1 := by
induction f with (intro n c tl; simp only [Nat.toDigitsCore, List.length])
| succ f ih =>
if hnb : (n / b) = 0 then
simp only [hnb, if_true, List.length]
else
generalize hx: Nat.digitChar (n % b) = x
simp only [hx, hnb, if_false] at ih
simp only [hnb, if_false]
specialize ih (n / b) c (x :: tl)
rw [β ih]
have lens_eq : (x :: (c :: tl)).length = (c :: x :: tl).length := by simp
apply toDigitsCore_lens_eq_aux
exact lens_eq
@[deprecated (since := "2024-02-19")] alias to_digits_core_lens_eq:= toDigitsCore_lens_eq
lemma nat_repr_len_aux (n b e : Nat) (h_b_pos : 0 < b) : n < b ^ e.succ β n / b < b ^ e := by
simp only [Nat.pow_succ]
exact (@Nat.div_lt_iff_lt_mul b n (b ^ e) h_b_pos).mpr
lemma toDigitsCore_length (b : Nat) (h : 2 <= b) (f n e : Nat)
(hlt : n < b ^ e) (h_e_pos: 0 < e) : (Nat.toDigitsCore b f n []).length <= e := by
induction f generalizing n e hlt h_e_pos with
simp only [Nat.toDigitsCore, List.length, Nat.zero_le]
| succ f ih =>
cases e with
| zero => exact False.elim (Nat.lt_irrefl 0 h_e_pos)
| succ e =>
if h_pred_pos : 0 < e then
have _ : 0 < b := Nat.lt_trans (by decide) h
specialize ih (n / b) e (nat_repr_len_aux n b e βΉ0 < bβΊ hlt) h_pred_pos
if hdiv_ten : n / b = 0 then
simp only [hdiv_ten]; exact Nat.le.step h_pred_pos
else
simp only [hdiv_ten,
toDigitsCore_lens_eq b f (n / b) (Nat.digitChar <| n % b), if_false]
exact Nat.succ_le_succ ih
else
obtain rfl : e = 0 := Nat.eq_zero_of_not_pos h_pred_pos
have _ : b ^ 1 = b := by simp only [Nat.pow_succ, pow_zero, Nat.one_mul]
have _ : n < b := βΉb ^ 1 = bβΊ βΈ hlt
simp [(@Nat.div_eq_of_lt n b βΉn < bβΊ : n / b = 0)]
@[deprecated (since := "2024-02-19")] alias to_digits_core_length := toDigitsCore_length
lemma repr_length (n e : Nat) : 0 < e β n < 10 ^ e β (Nat.repr n).length <= e := by
cases n with
(intro e0 he; simp only [Nat.repr, Nat.toDigits, String.length, List.asString])
| zero => assumption
| succ n =>
if hterm : n.succ / 10 = 0 then
simp only [hterm, Nat.toDigitsCore]; assumption
else
exact toDigitsCore_length 10 (by decide) (Nat.succ n + 1) (Nat.succ n) e he e0
namespace NormDigits
theorem digits_succ (b n m r l) (e : r + b * m = n) (hr : r < b)
(h : Nat.digits b m = l β§ 1 < b β§ 0 < m) : (Nat.digits b n = r :: l) β§ 1 < b β§ 0 < n := by
rcases h with β¨h, b2, m0β©
have b0 : 0 < b := by omega
have n0 : 0 < n := by linarith [mul_pos b0 m0]
refine β¨?_, b2, n0β©
obtain β¨rfl, rflβ© := (Nat.div_mod_unique b0).2 β¨e, hrβ©
subst h; exact Nat.digits_def' b2 n0
#align nat.norm_digits.digits_succ Nat.NormDigits.digits_succ
| Mathlib/Data/Nat/Digits.lean | 876 | 881 | theorem digits_one (b n) (n0 : 0 < n) (nb : n < b) : Nat.digits b n = [n] β§ 1 < b β§ 0 < n := by |
have b2 : 1 < b :=
lt_iff_add_one_le.mpr (le_trans (add_le_add_right (lt_iff_add_one_le.mp n0) 1) nb)
refine β¨?_, b2, n0β©
rw [Nat.digits_def' b2 n0, Nat.mod_eq_of_lt nb,
(Nat.div_eq_zero_iff ((zero_le n).trans_lt nb)).2 nb, Nat.digits_zero]
|
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.Topology.Algebra.Monoid
import Mathlib.Topology.Algebra.Constructions
#align_import topology.algebra.group.basic from "leanprover-community/mathlib"@"3b1890e71632be9e3b2086ab512c3259a7e9a3ef"
open scoped Classical
open Set Filter TopologicalSpace Function Topology Pointwise MulOpposite
universe u v w x
variable {G : Type w} {H : Type x} {Ξ± : Type u} {Ξ² : Type v}
class ContinuousNeg (G : Type u) [TopologicalSpace G] [Neg G] : Prop where
continuous_neg : Continuous fun a : G => -a
#align has_continuous_neg ContinuousNeg
-- Porting note: added
attribute [continuity] ContinuousNeg.continuous_neg
@[to_additive (attr := continuity)]
class ContinuousInv (G : Type u) [TopologicalSpace G] [Inv G] : Prop where
continuous_inv : Continuous fun a : G => aβ»ΒΉ
#align has_continuous_inv ContinuousInv
--#align has_continuous_neg ContinuousNeg
-- Porting note: added
attribute [continuity] ContinuousInv.continuous_inv
export ContinuousInv (continuous_inv)
export ContinuousNeg (continuous_neg)
section ContinuousInv
variable [TopologicalSpace G] [Inv G] [ContinuousInv G]
@[to_additive]
protected theorem Specializes.inv {x y : G} (h : x β€³ y) : (xβ»ΒΉ) β€³ (yβ»ΒΉ) :=
h.map continuous_inv
@[to_additive]
protected theorem Inseparable.inv {x y : G} (h : Inseparable x y) : Inseparable (xβ»ΒΉ) (yβ»ΒΉ) :=
h.map continuous_inv
@[to_additive]
protected theorem Specializes.zpow {G : Type*} [DivInvMonoid G] [TopologicalSpace G]
[ContinuousMul G] [ContinuousInv G] {x y : G} (h : x β€³ y) : β m : β€, (x ^ m) β€³ (y ^ m)
| .ofNat n => by simpa using h.pow n
| .negSucc n => by simpa using (h.pow (n + 1)).inv
@[to_additive]
protected theorem Inseparable.zpow {G : Type*} [DivInvMonoid G] [TopologicalSpace G]
[ContinuousMul G] [ContinuousInv G] {x y : G} (h : Inseparable x y) (m : β€) :
Inseparable (x ^ m) (y ^ m) :=
(h.specializes.zpow m).antisymm (h.specializes'.zpow m)
@[to_additive]
instance : ContinuousInv (ULift G) :=
β¨continuous_uLift_up.comp (continuous_inv.comp continuous_uLift_down)β©
@[to_additive]
theorem continuousOn_inv {s : Set G} : ContinuousOn Inv.inv s :=
continuous_inv.continuousOn
#align continuous_on_inv continuousOn_inv
#align continuous_on_neg continuousOn_neg
@[to_additive]
theorem continuousWithinAt_inv {s : Set G} {x : G} : ContinuousWithinAt Inv.inv s x :=
continuous_inv.continuousWithinAt
#align continuous_within_at_inv continuousWithinAt_inv
#align continuous_within_at_neg continuousWithinAt_neg
@[to_additive]
theorem continuousAt_inv {x : G} : ContinuousAt Inv.inv x :=
continuous_inv.continuousAt
#align continuous_at_inv continuousAt_inv
#align continuous_at_neg continuousAt_neg
@[to_additive]
theorem tendsto_inv (a : G) : Tendsto Inv.inv (π a) (π aβ»ΒΉ) :=
continuousAt_inv
#align tendsto_inv tendsto_inv
#align tendsto_neg tendsto_neg
@[to_additive
"If a function converges to a value in an additive topological group, then its
negation converges to the negation of this value."]
theorem Filter.Tendsto.inv {f : Ξ± β G} {l : Filter Ξ±} {y : G} (h : Tendsto f l (π y)) :
Tendsto (fun x => (f x)β»ΒΉ) l (π yβ»ΒΉ) :=
(continuous_inv.tendsto y).comp h
#align filter.tendsto.inv Filter.Tendsto.inv
#align filter.tendsto.neg Filter.Tendsto.neg
variable [TopologicalSpace Ξ±] {f : Ξ± β G} {s : Set Ξ±} {x : Ξ±}
@[to_additive (attr := continuity, fun_prop)]
theorem Continuous.inv (hf : Continuous f) : Continuous fun x => (f x)β»ΒΉ :=
continuous_inv.comp hf
#align continuous.inv Continuous.inv
#align continuous.neg Continuous.neg
@[to_additive (attr := fun_prop)]
theorem ContinuousAt.inv (hf : ContinuousAt f x) : ContinuousAt (fun x => (f x)β»ΒΉ) x :=
continuousAt_inv.comp hf
#align continuous_at.inv ContinuousAt.inv
#align continuous_at.neg ContinuousAt.neg
@[to_additive (attr := fun_prop)]
theorem ContinuousOn.inv (hf : ContinuousOn f s) : ContinuousOn (fun x => (f x)β»ΒΉ) s :=
continuous_inv.comp_continuousOn hf
#align continuous_on.inv ContinuousOn.inv
#align continuous_on.neg ContinuousOn.neg
@[to_additive]
theorem ContinuousWithinAt.inv (hf : ContinuousWithinAt f s x) :
ContinuousWithinAt (fun x => (f x)β»ΒΉ) s x :=
Filter.Tendsto.inv hf
#align continuous_within_at.inv ContinuousWithinAt.inv
#align continuous_within_at.neg ContinuousWithinAt.neg
@[to_additive]
instance Prod.continuousInv [TopologicalSpace H] [Inv H] [ContinuousInv H] :
ContinuousInv (G Γ H) :=
β¨continuous_inv.fst'.prod_mk continuous_inv.snd'β©
variable {ΞΉ : Type*}
@[to_additive]
instance Pi.continuousInv {C : ΞΉ β Type*} [β i, TopologicalSpace (C i)] [β i, Inv (C i)]
[β i, ContinuousInv (C i)] : ContinuousInv (β i, C i) where
continuous_inv := continuous_pi fun i => (continuous_apply i).inv
#align pi.has_continuous_inv Pi.continuousInv
#align pi.has_continuous_neg Pi.continuousNeg
@[to_additive
"A version of `Pi.continuousNeg` for non-dependent functions. It is needed
because sometimes Lean fails to use `Pi.continuousNeg` for non-dependent functions."]
instance Pi.has_continuous_inv' : ContinuousInv (ΞΉ β G) :=
Pi.continuousInv
#align pi.has_continuous_inv' Pi.has_continuous_inv'
#align pi.has_continuous_neg' Pi.has_continuous_neg'
@[to_additive]
instance (priority := 100) continuousInv_of_discreteTopology [TopologicalSpace H] [Inv H]
[DiscreteTopology H] : ContinuousInv H :=
β¨continuous_of_discreteTopologyβ©
#align has_continuous_inv_of_discrete_topology continuousInv_of_discreteTopology
#align has_continuous_neg_of_discrete_topology continuousNeg_of_discreteTopology
@[to_additive]
theorem Inducing.continuousInv {G H : Type*} [Inv G] [Inv H] [TopologicalSpace G]
[TopologicalSpace H] [ContinuousInv H] {f : G β H} (hf : Inducing f)
(hf_inv : β x, f xβ»ΒΉ = (f x)β»ΒΉ) : ContinuousInv G :=
β¨hf.continuous_iff.2 <| by simpa only [(Β· β Β·), hf_inv] using hf.continuous.invβ©
#align inducing.has_continuous_inv Inducing.continuousInv
#align inducing.has_continuous_neg Inducing.continuousNeg
section TopologicalGroup
-- Porting note (#11215): TODO should this docstring be extended
-- to match the multiplicative version?
class TopologicalAddGroup (G : Type u) [TopologicalSpace G] [AddGroup G] extends
ContinuousAdd G, ContinuousNeg G : Prop
#align topological_add_group TopologicalAddGroup
-- Porting note: check that these β names exist once they've been ported in the future.
@[to_additive]
class TopologicalGroup (G : Type*) [TopologicalSpace G] [Group G] extends ContinuousMul G,
ContinuousInv G : Prop
#align topological_group TopologicalGroup
--#align topological_add_group TopologicalAddGroup
variable [TopologicalSpace G] [Group G] [TopologicalGroup G] [TopologicalSpace Ξ±] {f : Ξ± β G}
{s : Set Ξ±} {x : Ξ±}
instance : TopologicalGroup (ULift G) where
@[to_additive]
instance [TopologicalSpace H] [Group H] [TopologicalGroup H] : TopologicalGroup (G Γ H) where
continuous_inv := continuous_inv.prod_map continuous_inv
@[to_additive]
instance Pi.topologicalGroup {C : Ξ² β Type*} [β b, TopologicalSpace (C b)] [β b, Group (C b)]
[β b, TopologicalGroup (C b)] : TopologicalGroup (β b, C b) where
continuous_inv := continuous_pi fun i => (continuous_apply i).inv
#align pi.topological_group Pi.topologicalGroup
#align pi.topological_add_group Pi.topologicalAddGroup
open MulOpposite
@[to_additive]
instance [Inv Ξ±] [ContinuousInv Ξ±] : ContinuousInv Ξ±α΅α΅α΅ :=
opHomeomorph.symm.inducing.continuousInv unop_inv
@[to_additive "If addition is continuous in `Ξ±`, then it also is in `Ξ±α΅α΅α΅`."]
instance [Group Ξ±] [TopologicalGroup Ξ±] : TopologicalGroup Ξ±α΅α΅α΅ where
variable (G)
@[to_additive]
theorem nhds_one_symm : comap Inv.inv (π (1 : G)) = π (1 : G) :=
((Homeomorph.inv G).comap_nhds_eq _).trans (congr_arg nhds inv_one)
#align nhds_one_symm nhds_one_symm
#align nhds_zero_symm nhds_zero_symm
@[to_additive]
theorem nhds_one_symm' : map Inv.inv (π (1 : G)) = π (1 : G) :=
((Homeomorph.inv G).map_nhds_eq _).trans (congr_arg nhds inv_one)
#align nhds_one_symm' nhds_one_symm'
#align nhds_zero_symm' nhds_zero_symm'
@[to_additive]
| Mathlib/Topology/Algebra/Group/Basic.lean | 672 | 673 | theorem inv_mem_nhds_one {S : Set G} (hS : S β (π 1 : Filter G)) : Sβ»ΒΉ β π (1 : G) := by |
rwa [β nhds_one_symm'] at hS
|
import Mathlib.Algebra.BigOperators.Associated
import Mathlib.Algebra.GCDMonoid.Basic
import Mathlib.Data.Finsupp.Multiset
import Mathlib.Data.Nat.Factors
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.Multiplicity
#align_import ring_theory.unique_factorization_domain from "leanprover-community/mathlib"@"570e9f4877079b3a923135b3027ac3be8695ab8c"
variable {Ξ± : Type*}
local infixl:50 " ~α΅€ " => Associated
class WfDvdMonoid (Ξ± : Type*) [CommMonoidWithZero Ξ±] : Prop where
wellFounded_dvdNotUnit : WellFounded (@DvdNotUnit Ξ± _)
#align wf_dvd_monoid WfDvdMonoid
export WfDvdMonoid (wellFounded_dvdNotUnit)
-- see Note [lower instance priority]
instance (priority := 100) IsNoetherianRing.wfDvdMonoid [CommRing Ξ±] [IsDomain Ξ±]
[IsNoetherianRing Ξ±] : WfDvdMonoid Ξ± :=
β¨by
convert InvImage.wf (fun a => Ideal.span ({a} : Set Ξ±)) (wellFounded_submodule_gt _ _)
ext
exact Ideal.span_singleton_lt_span_singleton.symmβ©
#align is_noetherian_ring.wf_dvd_monoid IsNoetherianRing.wfDvdMonoid
theorem WfDvdMonoid.of_wellFounded_associates [CancelCommMonoidWithZero Ξ±]
(h : WellFounded ((Β· < Β·) : Associates Ξ± β Associates Ξ± β Prop)) : WfDvdMonoid Ξ± :=
WfDvdMonoid.of_wfDvdMonoid_associates
β¨by
convert h
ext
exact Associates.dvdNotUnit_iff_ltβ©
#align wf_dvd_monoid.of_well_founded_associates WfDvdMonoid.of_wellFounded_associates
theorem WfDvdMonoid.iff_wellFounded_associates [CancelCommMonoidWithZero Ξ±] :
WfDvdMonoid Ξ± β WellFounded ((Β· < Β·) : Associates Ξ± β Associates Ξ± β Prop) :=
β¨by apply WfDvdMonoid.wellFounded_associates, WfDvdMonoid.of_wellFounded_associatesβ©
#align wf_dvd_monoid.iff_well_founded_associates WfDvdMonoid.iff_wellFounded_associates
theorem WfDvdMonoid.max_power_factor' [CommMonoidWithZero Ξ±] [WfDvdMonoid Ξ±] {aβ x : Ξ±}
(h : aβ β 0) (hx : Β¬IsUnit x) : β (n : β) (a : Ξ±), Β¬x β£ a β§ aβ = x ^ n * a := by
obtain β¨a, β¨n, rflβ©, hmβ© := wellFounded_dvdNotUnit.has_min
{a | β n, x ^ n * a = aβ} β¨aβ, 0, by rw [pow_zero, one_mul]β©
refine β¨n, a, ?_, rflβ©; rintro β¨d, rflβ©
exact hm d β¨n + 1, by rw [pow_succ, mul_assoc]β©
β¨(right_ne_zero_of_mul <| right_ne_zero_of_mul h), x, hx, mul_comm _ _β©
theorem WfDvdMonoid.max_power_factor [CommMonoidWithZero Ξ±] [WfDvdMonoid Ξ±] {aβ x : Ξ±}
(h : aβ β 0) (hx : Irreducible x) : β (n : β) (a : Ξ±), Β¬x β£ a β§ aβ = x ^ n * a :=
max_power_factor' h hx.not_unit
theorem multiplicity.finite_of_not_isUnit [CancelCommMonoidWithZero Ξ±] [WfDvdMonoid Ξ±]
{a b : Ξ±} (ha : Β¬IsUnit a) (hb : b β 0) : multiplicity.Finite a b := by
obtain β¨n, c, ndvd, rflβ© := WfDvdMonoid.max_power_factor' hb ha
exact β¨n, by rwa [pow_succ, mul_dvd_mul_iff_left (left_ne_zero_of_mul hb)]β©
theorem prime_factors_irreducible [CancelCommMonoidWithZero Ξ±] {a : Ξ±} {f : Multiset Ξ±}
(ha : Irreducible a) (pfa : (β b β f, Prime b) β§ f.prod ~α΅€ a) : β p, a ~α΅€ p β§ f = {p} := by
haveI := Classical.decEq Ξ±
refine @Multiset.induction_on _
(fun g => (g.prod ~α΅€ a) β (β b β g, Prime b) β β p, a ~α΅€ p β§ g = {p}) f ?_ ?_ pfa.2 pfa.1
Β· intro h; exact (ha.not_unit (associated_one_iff_isUnit.1 (Associated.symm h))).elim
Β· rintro p s _ β¨u, huβ© hs
use p
have hs0 : s = 0 := by
by_contra hs0
obtain β¨q, hqβ© := Multiset.exists_mem_of_ne_zero hs0
apply (hs q (by simp [hq])).2.1
refine (ha.isUnit_or_isUnit (?_ : _ = p * βu * (s.erase q).prod * _)).resolve_left ?_
Β· rw [mul_right_comm _ _ q, mul_assoc, β Multiset.prod_cons, Multiset.cons_erase hq, β hu,
mul_comm, mul_comm p _, mul_assoc]
simp
apply mt isUnit_of_mul_isUnit_left (mt isUnit_of_mul_isUnit_left _)
apply (hs p (Multiset.mem_cons_self _ _)).2.1
simp only [mul_one, Multiset.prod_cons, Multiset.prod_zero, hs0] at *
exact β¨Associated.symm β¨u, huβ©, rflβ©
#align prime_factors_irreducible prime_factors_irreducible
namespace UniqueFactorizationMonoid
variable {R : Type*} [CancelCommMonoidWithZero R] [UniqueFactorizationMonoid R]
theorem isRelPrime_iff_no_prime_factors {a b : R} (ha : a β 0) :
IsRelPrime a b β β β¦dβ¦, d β£ a β d β£ b β Β¬Prime d :=
β¨fun h _ ha hb β¦ (Β·.not_unit <| h ha hb), fun h β¦ WfDvdMonoid.isRelPrime_of_no_irreducible_factors
(ha Β·.1) fun _ irr ha hb β¦ h ha hb (UniqueFactorizationMonoid.irreducible_iff_prime.mp irr)β©
#align unique_factorization_monoid.no_factors_of_no_prime_factors UniqueFactorizationMonoid.isRelPrime_iff_no_prime_factors
theorem dvd_of_dvd_mul_left_of_no_prime_factors {a b c : R} (ha : a β 0)
(h : β β¦dβ¦, d β£ a β d β£ c β Β¬Prime d) : a β£ b * c β a β£ b :=
((isRelPrime_iff_no_prime_factors ha).mpr h).dvd_of_dvd_mul_right
#align unique_factorization_monoid.dvd_of_dvd_mul_left_of_no_prime_factors UniqueFactorizationMonoid.dvd_of_dvd_mul_left_of_no_prime_factors
theorem dvd_of_dvd_mul_right_of_no_prime_factors {a b c : R} (ha : a β 0)
(no_factors : β {d}, d β£ a β d β£ b β Β¬Prime d) : a β£ b * c β a β£ c := by
simpa [mul_comm b c] using dvd_of_dvd_mul_left_of_no_prime_factors ha @no_factors
#align unique_factorization_monoid.dvd_of_dvd_mul_right_of_no_prime_factors UniqueFactorizationMonoid.dvd_of_dvd_mul_right_of_no_prime_factors
theorem exists_reduced_factors :
β a β (0 : R), β b,
β a' b' c', IsRelPrime a' b' β§ c' * a' = a β§ c' * b' = b := by
intro a
refine induction_on_prime a ?_ ?_ ?_
Β· intros
contradiction
Β· intro a a_unit _ b
use a, b, 1
constructor
Β· intro p p_dvd_a _
exact isUnit_of_dvd_unit p_dvd_a a_unit
Β· simp
Β· intro a p a_ne_zero p_prime ih_a pa_ne_zero b
by_cases h : p β£ b
Β· rcases h with β¨b, rflβ©
obtain β¨a', b', c', no_factor, ha', hb'β© := ih_a a_ne_zero b
refine β¨a', b', p * c', @no_factor, ?_, ?_β©
Β· rw [mul_assoc, ha']
Β· rw [mul_assoc, hb']
Β· obtain β¨a', b', c', coprime, rfl, rflβ© := ih_a a_ne_zero b
refine β¨p * a', b', c', ?_, mul_left_comm _ _ _, rflβ©
intro q q_dvd_pa' q_dvd_b'
cases' p_prime.left_dvd_or_dvd_right_of_dvd_mul q_dvd_pa' with p_dvd_q q_dvd_a'
Β· have : p β£ c' * b' := dvd_mul_of_dvd_right (p_dvd_q.trans q_dvd_b') _
contradiction
exact coprime q_dvd_a' q_dvd_b'
#align unique_factorization_monoid.exists_reduced_factors UniqueFactorizationMonoid.exists_reduced_factors
theorem exists_reduced_factors' (a b : R) (hb : b β 0) :
β a' b' c', IsRelPrime a' b' β§ c' * a' = a β§ c' * b' = b :=
let β¨b', a', c', no_factor, hb, haβ© := exists_reduced_factors b hb a
β¨a', b', c', fun _ hpb hpa => no_factor hpa hpb, ha, hbβ©
#align unique_factorization_monoid.exists_reduced_factors' UniqueFactorizationMonoid.exists_reduced_factors'
theorem pow_right_injective {a : R} (ha0 : a β 0) (ha1 : Β¬IsUnit a) :
Function.Injective (a ^ Β· : β β R) := by
letI := Classical.decEq R
intro i j hij
letI : Nontrivial R := β¨β¨a, 0, ha0β©β©
letI : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
obtain β¨p', hp', dvd'β© := WfDvdMonoid.exists_irreducible_factor ha1 ha0
obtain β¨p, mem, _β© := exists_mem_normalizedFactors_of_dvd ha0 hp' dvd'
have := congr_arg (fun x => Multiset.count p (normalizedFactors x)) hij
simp only [normalizedFactors_pow, Multiset.count_nsmul] at this
exact mul_right_cancelβ (Multiset.count_ne_zero.mpr mem) this
#align unique_factorization_monoid.pow_right_injective UniqueFactorizationMonoid.pow_right_injective
theorem pow_eq_pow_iff {a : R} (ha0 : a β 0) (ha1 : Β¬IsUnit a) {i j : β} : a ^ i = a ^ j β i = j :=
(pow_right_injective ha0 ha1).eq_iff
#align unique_factorization_monoid.pow_eq_pow_iff UniqueFactorizationMonoid.pow_eq_pow_iff
namespace Associates
open UniqueFactorizationMonoid Associated Multiset
variable [CancelCommMonoidWithZero Ξ±]
abbrev FactorSet.{u} (Ξ± : Type u) [CancelCommMonoidWithZero Ξ±] : Type u :=
WithTop (Multiset { a : Associates Ξ± // Irreducible a })
#align associates.factor_set Associates.FactorSet
attribute [local instance] Associated.setoid
theorem FactorSet.coe_add {a b : Multiset { a : Associates Ξ± // Irreducible a }} :
(β(a + b) : FactorSet Ξ±) = a + b := by norm_cast
#align associates.factor_set.coe_add Associates.FactorSet.coe_add
theorem FactorSet.sup_add_inf_eq_add [DecidableEq (Associates Ξ±)] :
β a b : FactorSet Ξ±, a β b + a β b = a + b
| β€, b => show β€ β b + β€ β b = β€ + b by simp
| a, β€ => show a β β€ + a β β€ = a + β€ by simp
| WithTop.some a, WithTop.some b =>
show (a : FactorSet Ξ±) β b + (a : FactorSet Ξ±) β b = a + b by
rw [β WithTop.coe_sup, β WithTop.coe_inf, β WithTop.coe_add, β WithTop.coe_add,
WithTop.coe_eq_coe]
exact Multiset.union_add_inter _ _
#align associates.factor_set.sup_add_inf_eq_add Associates.FactorSet.sup_add_inf_eq_add
def FactorSet.prod : FactorSet Ξ± β Associates Ξ±
| β€ => 0
| WithTop.some s => (s.map (β)).prod
#align associates.factor_set.prod Associates.FactorSet.prod
@[simp]
theorem prod_top : (β€ : FactorSet Ξ±).prod = 0 :=
rfl
#align associates.prod_top Associates.prod_top
@[simp]
theorem prod_coe {s : Multiset { a : Associates Ξ± // Irreducible a }} :
FactorSet.prod (s : FactorSet Ξ±) = (s.map (β)).prod :=
rfl
#align associates.prod_coe Associates.prod_coe
@[simp]
theorem prod_add : β a b : FactorSet Ξ±, (a + b).prod = a.prod * b.prod
| β€, b => show (β€ + b).prod = (β€ : FactorSet Ξ±).prod * b.prod by simp
| a, β€ => show (a + β€).prod = a.prod * (β€ : FactorSet Ξ±).prod by simp
| WithTop.some a, WithTop.some b => by
rw [β FactorSet.coe_add, prod_coe, prod_coe, prod_coe, Multiset.map_add, Multiset.prod_add]
#align associates.prod_add Associates.prod_add
@[gcongr]
theorem prod_mono : β {a b : FactorSet Ξ±}, a β€ b β a.prod β€ b.prod
| β€, b, h => by
have : b = β€ := top_unique h
rw [this, prod_top]
| a, β€, _ => show a.prod β€ (β€ : FactorSet Ξ±).prod by simp
| WithTop.some a, WithTop.some b, h =>
prod_le_prod <| Multiset.map_le_map <| WithTop.coe_le_coe.1 <| h
#align associates.prod_mono Associates.prod_mono
theorem FactorSet.prod_eq_zero_iff [Nontrivial Ξ±] (p : FactorSet Ξ±) : p.prod = 0 β p = β€ := by
unfold FactorSet at p
induction p -- TODO: `induction_eliminator` doesn't work with `abbrev`
Β· simp only [iff_self_iff, eq_self_iff_true, Associates.prod_top]
Β· rw [prod_coe, Multiset.prod_eq_zero_iff, Multiset.mem_map, eq_false WithTop.coe_ne_top,
iff_false_iff, not_exists]
exact fun a => not_and_of_not_right _ a.prop.ne_zero
#align associates.factor_set.prod_eq_zero_iff Associates.FactorSet.prod_eq_zero_iff
theorem prod_le [Nontrivial Ξ±] {a b : FactorSet Ξ±} : a.prod β€ b.prod β a β€ b := by
refine β¨fun h β¦ ?_, prod_monoβ©
have : a.prod.factors β€ b.prod.factors := factors_mono h
rwa [prod_factors, prod_factors] at this
#align associates.prod_le Associates.prod_le
open Classical in
noncomputable instance : Sup (Associates Ξ±) :=
β¨fun a b => (a.factors β b.factors).prodβ©
open Classical in
noncomputable instance : Inf (Associates Ξ±) :=
β¨fun a b => (a.factors β b.factors).prodβ©
open Classical in
noncomputable instance : Lattice (Associates Ξ±) :=
{ Associates.instPartialOrder with
sup := (Β· β Β·)
inf := (Β· β Β·)
sup_le := fun _ _ c hac hbc =>
factors_prod c βΈ prod_mono (sup_le (factors_mono hac) (factors_mono hbc))
le_sup_left := fun a _ => le_trans (le_of_eq (factors_prod a).symm) <| prod_mono <| le_sup_left
le_sup_right := fun _ b =>
le_trans (le_of_eq (factors_prod b).symm) <| prod_mono <| le_sup_right
le_inf := fun a _ _ hac hbc =>
factors_prod a βΈ prod_mono (le_inf (factors_mono hac) (factors_mono hbc))
inf_le_left := fun a _ => le_trans (prod_mono inf_le_left) (le_of_eq (factors_prod a))
inf_le_right := fun _ b => le_trans (prod_mono inf_le_right) (le_of_eq (factors_prod b)) }
open Classical in
theorem sup_mul_inf (a b : Associates Ξ±) : (a β b) * (a β b) = a * b :=
show (a.factors β b.factors).prod * (a.factors β b.factors).prod = a * b by
nontriviality Ξ±
refine eq_of_factors_eq_factors ?_
rw [β prod_add, prod_factors, factors_mul, FactorSet.sup_add_inf_eq_add]
#align associates.sup_mul_inf Associates.sup_mul_inf
theorem dvd_of_mem_factors {a p : Associates Ξ±} (hm : p β factors a) :
p β£ a := by
rcases eq_or_ne a 0 with rfl | ha0
Β· exact dvd_zero p
obtain β¨a0, nza, ha'β© := exists_non_zero_rep ha0
rw [β Associates.factors_prod a]
rw [β ha', factors_mk a0 nza] at hm β’
rw [prod_coe]
apply Multiset.dvd_prod; apply Multiset.mem_map.mpr
exact β¨β¨p, irreducible_of_mem_factorSet hmβ©, mem_factorSet_some.mp hm, rflβ©
#align associates.dvd_of_mem_factors Associates.dvd_of_mem_factors
theorem dvd_of_mem_factors' {a : Ξ±} {p : Associates Ξ±} {hp : Irreducible p} {hz : a β 0}
(h_mem : Subtype.mk p hp β factors' a) : p β£ Associates.mk a := by
haveI := Classical.decEq (Associates Ξ±)
apply dvd_of_mem_factors
rw [factors_mk _ hz]
apply mem_factorSet_some.2 h_mem
#align associates.dvd_of_mem_factors' Associates.dvd_of_mem_factors'
theorem mem_factors'_of_dvd {a p : Ξ±} (ha0 : a β 0) (hp : Irreducible p) (hd : p β£ a) :
Subtype.mk (Associates.mk p) (irreducible_mk.2 hp) β factors' a := by
obtain β¨q, hq, hpqβ© := exists_mem_factors_of_dvd ha0 hp hd
apply Multiset.mem_pmap.mpr; use q; use hq
exact Subtype.eq (Eq.symm (mk_eq_mk_iff_associated.mpr hpq))
#align associates.mem_factors'_of_dvd Associates.mem_factors'_of_dvd
theorem mem_factors'_iff_dvd {a p : Ξ±} (ha0 : a β 0) (hp : Irreducible p) :
Subtype.mk (Associates.mk p) (irreducible_mk.2 hp) β factors' a β p β£ a := by
constructor
Β· rw [β mk_dvd_mk]
apply dvd_of_mem_factors'
apply ha0
Β· apply mem_factors'_of_dvd ha0 hp
#align associates.mem_factors'_iff_dvd Associates.mem_factors'_iff_dvd
theorem mem_factors_of_dvd {a p : Ξ±} (ha0 : a β 0) (hp : Irreducible p) (hd : p β£ a) :
Associates.mk p β factors (Associates.mk a) := by
rw [factors_mk _ ha0]
exact mem_factorSet_some.mpr (mem_factors'_of_dvd ha0 hp hd)
#align associates.mem_factors_of_dvd Associates.mem_factors_of_dvd
theorem mem_factors_iff_dvd {a p : Ξ±} (ha0 : a β 0) (hp : Irreducible p) :
Associates.mk p β factors (Associates.mk a) β p β£ a := by
constructor
Β· rw [β mk_dvd_mk]
apply dvd_of_mem_factors
Β· apply mem_factors_of_dvd ha0 hp
#align associates.mem_factors_iff_dvd Associates.mem_factors_iff_dvd
open Classical in
theorem exists_prime_dvd_of_not_inf_one {a b : Ξ±} (ha : a β 0) (hb : b β 0)
(h : Associates.mk a β Associates.mk b β 1) : β p : Ξ±, Prime p β§ p β£ a β§ p β£ b := by
have hz : factors (Associates.mk a) β factors (Associates.mk b) β 0 := by
contrapose! h with hf
change (factors (Associates.mk a) β factors (Associates.mk b)).prod = 1
rw [hf]
exact Multiset.prod_zero
rw [factors_mk a ha, factors_mk b hb, β WithTop.coe_inf] at hz
obtain β¨β¨p0, p0_irrβ©, p0_memβ© := Multiset.exists_mem_of_ne_zero ((mt WithTop.coe_eq_coe.mpr) hz)
rw [Multiset.inf_eq_inter] at p0_mem
obtain β¨p, rflβ© : β p, Associates.mk p = p0 := Quot.exists_rep p0
refine β¨p, ?_, ?_, ?_β©
Β· rw [β UniqueFactorizationMonoid.irreducible_iff_prime, β irreducible_mk]
exact p0_irr
Β· apply dvd_of_mk_le_mk
apply dvd_of_mem_factors' (Multiset.mem_inter.mp p0_mem).left
apply ha
Β· apply dvd_of_mk_le_mk
apply dvd_of_mem_factors' (Multiset.mem_inter.mp p0_mem).right
apply hb
#align associates.exists_prime_dvd_of_not_inf_one Associates.exists_prime_dvd_of_not_inf_one
theorem coprime_iff_inf_one {a b : Ξ±} (ha0 : a β 0) (hb0 : b β 0) :
Associates.mk a β Associates.mk b = 1 β β {d : Ξ±}, d β£ a β d β£ b β Β¬Prime d := by
constructor
Β· intro hg p ha hb hp
refine (Associates.prime_mk.mpr hp).not_unit (isUnit_of_dvd_one ?_)
rw [β hg]
exact le_inf (mk_le_mk_of_dvd ha) (mk_le_mk_of_dvd hb)
Β· contrapose
intro hg hc
obtain β¨p, hp, hpa, hpbβ© := exists_prime_dvd_of_not_inf_one ha0 hb0 hg
exact hc hpa hpb hp
#align associates.coprime_iff_inf_one Associates.coprime_iff_inf_one
theorem factors_self [Nontrivial Ξ±] {p : Associates Ξ±} (hp : Irreducible p) :
p.factors = WithTop.some {β¨p, hpβ©} :=
eq_of_prod_eq_prod
(by rw [factors_prod, FactorSet.prod]; dsimp; rw [prod_singleton])
#align associates.factors_self Associates.factors_self
theorem factors_prime_pow [Nontrivial Ξ±] {p : Associates Ξ±} (hp : Irreducible p) (k : β) :
factors (p ^ k) = WithTop.some (Multiset.replicate k β¨p, hpβ©) :=
eq_of_prod_eq_prod
(by
rw [Associates.factors_prod, FactorSet.prod]
dsimp; rw [Multiset.map_replicate, Multiset.prod_replicate, Subtype.coe_mk])
#align associates.factors_prime_pow Associates.factors_prime_pow
theorem prime_pow_le_iff_le_bcount [DecidableEq (Associates Ξ±)] {m p : Associates Ξ±}
(hβ : m β 0) (hβ : Irreducible p) {k : β} : p ^ k β€ m β k β€ bcount β¨p, hββ© m.factors := by
rcases Associates.exists_non_zero_rep hβ with β¨m, hm, rflβ©
have := nontrivial_of_ne _ _ hm
rw [bcount, factors_mk, Multiset.le_count_iff_replicate_le, β factors_le, factors_prime_pow,
factors_mk, WithTop.coe_le_coe] <;> assumption
section count
variable [DecidableEq (Associates Ξ±)] [β p : Associates Ξ±, Decidable (Irreducible p)]
theorem prime_pow_dvd_iff_le {m p : Associates Ξ±} (hβ : m β 0) (hβ : Irreducible p) {k : β} :
p ^ k β€ m β k β€ count p m.factors := by
rw [count, dif_pos hβ, prime_pow_le_iff_le_bcount hβ]
#align associates.prime_pow_dvd_iff_le Associates.prime_pow_dvd_iff_le
theorem le_of_count_ne_zero {m p : Associates Ξ±} (h0 : m β 0) (hp : Irreducible p) :
count p m.factors β 0 β p β€ m := by
nontriviality Ξ±
rw [β pos_iff_ne_zero]
intro h
rw [β pow_one p]
apply (prime_pow_dvd_iff_le h0 hp).2
simpa only
#align associates.le_of_count_ne_zero Associates.le_of_count_ne_zero
theorem count_ne_zero_iff_dvd {a p : Ξ±} (ha0 : a β 0) (hp : Irreducible p) :
(Associates.mk p).count (Associates.mk a).factors β 0 β p β£ a := by
nontriviality Ξ±
rw [β Associates.mk_le_mk_iff_dvd]
refine
β¨fun h =>
Associates.le_of_count_ne_zero (Associates.mk_ne_zero.mpr ha0)
(Associates.irreducible_mk.mpr hp) h,
fun h => ?_β©
rw [β pow_one (Associates.mk p),
Associates.prime_pow_dvd_iff_le (Associates.mk_ne_zero.mpr ha0)
(Associates.irreducible_mk.mpr hp)] at h
exact (zero_lt_one.trans_le h).ne'
#align associates.count_ne_zero_iff_dvd Associates.count_ne_zero_iff_dvd
theorem count_self [Nontrivial Ξ±] [DecidableEq (Associates Ξ±)] {p : Associates Ξ±}
(hp : Irreducible p) : p.count p.factors = 1 := by
simp [factors_self hp, Associates.count_some hp]
#align associates.count_self Associates.count_self
theorem count_eq_zero_of_ne [DecidableEq (Associates Ξ±)] {p q : Associates Ξ±} (hp : Irreducible p)
(hq : Irreducible q) (h : p β q) : p.count q.factors = 0 :=
not_ne_iff.mp fun h' β¦ h <| associated_iff_eq.mp <| hp.associated_of_dvd hq <|
le_of_count_ne_zero hq.ne_zero hp h'
#align associates.count_eq_zero_of_ne Associates.count_eq_zero_of_ne
theorem count_mul [DecidableEq (Associates Ξ±)] {a : Associates Ξ±} (ha : a β 0) {b : Associates Ξ±}
(hb : b β 0) {p : Associates Ξ±} (hp : Irreducible p) :
count p (factors (a * b)) = count p a.factors + count p b.factors := by
obtain β¨a0, nza, rflβ© := exists_non_zero_rep ha
obtain β¨b0, nzb, rflβ© := exists_non_zero_rep hb
rw [factors_mul, factors_mk a0 nza, factors_mk b0 nzb, β FactorSet.coe_add, count_some hp,
Multiset.count_add, count_some hp, count_some hp]
#align associates.count_mul Associates.count_mul
theorem count_of_coprime [DecidableEq (Associates Ξ±)] {a : Associates Ξ±} (ha : a β 0)
{b : Associates Ξ±} (hb : b β 0) (hab : β d, d β£ a β d β£ b β Β¬Prime d) {p : Associates Ξ±}
(hp : Irreducible p) : count p a.factors = 0 β¨ count p b.factors = 0 := by
rw [or_iff_not_imp_left, β Ne]
intro hca
contrapose! hab with hcb
exact β¨p, le_of_count_ne_zero ha hp hca, le_of_count_ne_zero hb hp hcb,
UniqueFactorizationMonoid.irreducible_iff_prime.mp hpβ©
#align associates.count_of_coprime Associates.count_of_coprime
theorem count_mul_of_coprime [DecidableEq (Associates Ξ±)] {a : Associates Ξ±} {b : Associates Ξ±}
(hb : b β 0) {p : Associates Ξ±} (hp : Irreducible p) (hab : β d, d β£ a β d β£ b β Β¬Prime d) :
count p a.factors = 0 β¨ count p a.factors = count p (a * b).factors := by
by_cases ha : a = 0
Β· simp [ha]
cases' count_of_coprime ha hb hab hp with hz hb0; Β· tauto
apply Or.intro_right
rw [count_mul ha hb hp, hb0, add_zero]
#align associates.count_mul_of_coprime Associates.count_mul_of_coprime
theorem count_mul_of_coprime' [DecidableEq (Associates Ξ±)] {a b : Associates Ξ±} {p : Associates Ξ±}
(hp : Irreducible p) (hab : β d, d β£ a β d β£ b β Β¬Prime d) :
count p (a * b).factors = count p a.factors β¨ count p (a * b).factors = count p b.factors := by
by_cases ha : a = 0
Β· simp [ha]
by_cases hb : b = 0
Β· simp [hb]
rw [count_mul ha hb hp]
cases' count_of_coprime ha hb hab hp with ha0 hb0
Β· apply Or.intro_right
rw [ha0, zero_add]
Β· apply Or.intro_left
rw [hb0, add_zero]
#align associates.count_mul_of_coprime' Associates.count_mul_of_coprime'
theorem dvd_count_of_dvd_count_mul [DecidableEq (Associates Ξ±)] {a b : Associates Ξ±} (hb : b β 0)
{p : Associates Ξ±} (hp : Irreducible p) (hab : β d, d β£ a β d β£ b β Β¬Prime d) {k : β}
(habk : k β£ count p (a * b).factors) : k β£ count p a.factors := by
by_cases ha : a = 0
Β· simpa [*] using habk
cases' count_of_coprime ha hb hab hp with hz h
Β· rw [hz]
exact dvd_zero k
Β· rw [count_mul ha hb hp, h] at habk
exact habk
#align associates.dvd_count_of_dvd_count_mul Associates.dvd_count_of_dvd_count_mul
@[simp]
theorem factors_one [Nontrivial Ξ±] : factors (1 : Associates Ξ±) = 0 := by
apply eq_of_prod_eq_prod
rw [Associates.factors_prod]
exact Multiset.prod_zero
#align associates.factors_one Associates.factors_one
@[simp]
theorem pow_factors [Nontrivial Ξ±] {a : Associates Ξ±} {k : β} :
(a ^ k).factors = k β’ a.factors := by
induction' k with n h
Β· rw [zero_nsmul, pow_zero]
exact factors_one
Β· rw [pow_succ, succ_nsmul, factors_mul, h]
#align associates.pow_factors Associates.pow_factors
theorem count_pow [Nontrivial Ξ±] [DecidableEq (Associates Ξ±)] {a : Associates Ξ±} (ha : a β 0)
{p : Associates Ξ±} (hp : Irreducible p) (k : β) :
count p (a ^ k).factors = k * count p a.factors := by
induction' k with n h
Β· rw [pow_zero, factors_one, zero_mul, count_zero hp]
Β· rw [pow_succ', count_mul ha (pow_ne_zero _ ha) hp, h]
ring
#align associates.count_pow Associates.count_pow
| Mathlib/RingTheory/UniqueFactorizationDomain.lean | 1,849 | 1,852 | theorem dvd_count_pow [Nontrivial Ξ±] [DecidableEq (Associates Ξ±)] {a : Associates Ξ±} (ha : a β 0)
{p : Associates Ξ±} (hp : Irreducible p) (k : β) : k β£ count p (a ^ k).factors := by |
rw [count_pow ha hp]
apply dvd_mul_right
|
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Algebra.Star.Unitary
import Mathlib.Data.Nat.ModEq
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.Tactic.Monotonicity
#align_import number_theory.pell_matiyasevic from "leanprover-community/mathlib"@"795b501869b9fa7aa716d5fdadd00c03f983a605"
namespace Pell
open Nat
section
variable {d : β€}
def IsPell : β€βd β Prop
| β¨x, yβ© => x * x - d * y * y = 1
#align pell.is_pell Pell.IsPell
theorem isPell_norm : β {b : β€βd}, IsPell b β b * star b = 1
| β¨x, yβ© => by simp [Zsqrtd.ext_iff, IsPell, mul_comm]; ring_nf
#align pell.is_pell_norm Pell.isPell_norm
theorem isPell_iff_mem_unitary : β {b : β€βd}, IsPell b β b β unitary (β€βd)
| β¨x, yβ© => by rw [unitary.mem_iff, isPell_norm, mul_comm (star _), and_self_iff]
#align pell.is_pell_iff_mem_unitary Pell.isPell_iff_mem_unitary
theorem isPell_mul {b c : β€βd} (hb : IsPell b) (hc : IsPell c) : IsPell (b * c) :=
isPell_norm.2 (by simp [mul_comm, mul_left_comm c, mul_assoc,
star_mul, isPell_norm.1 hb, isPell_norm.1 hc])
#align pell.is_pell_mul Pell.isPell_mul
theorem isPell_star : β {b : β€βd}, IsPell b β IsPell (star b)
| β¨x, yβ© => by simp [IsPell, Zsqrtd.star_mk]
#align pell.is_pell_star Pell.isPell_star
end
section
-- Porting note: was parameter in Lean3
variable {a : β} (a1 : 1 < a)
private def d (_a1 : 1 < a) :=
a * a - 1
@[simp]
theorem d_pos : 0 < d a1 :=
tsub_pos_of_lt (mul_lt_mul a1 (le_of_lt a1) (by decide) (Nat.zero_le _) : 1 * 1 < a * a)
#align pell.d_pos Pell.d_pos
-- TODO(lint): Fix double namespace issue
--@[nolint dup_namespace]
def pell : β β β Γ β
-- Porting note: used pattern matching because `Nat.recOn` is noncomputable
| 0 => (1, 0)
| n+1 => ((pell n).1 * a + d a1 * (pell n).2, (pell n).1 + (pell n).2 * a)
#align pell.pell Pell.pell
def xn (n : β) : β :=
(pell a1 n).1
#align pell.xn Pell.xn
def yn (n : β) : β :=
(pell a1 n).2
#align pell.yn Pell.yn
@[simp]
theorem pell_val (n : β) : pell a1 n = (xn a1 n, yn a1 n) :=
show pell a1 n = ((pell a1 n).1, (pell a1 n).2) from
match pell a1 n with
| (_, _) => rfl
#align pell.pell_val Pell.pell_val
@[simp]
theorem xn_zero : xn a1 0 = 1 :=
rfl
#align pell.xn_zero Pell.xn_zero
@[simp]
theorem yn_zero : yn a1 0 = 0 :=
rfl
#align pell.yn_zero Pell.yn_zero
@[simp]
theorem xn_succ (n : β) : xn a1 (n + 1) = xn a1 n * a + d a1 * yn a1 n :=
rfl
#align pell.xn_succ Pell.xn_succ
@[simp]
theorem yn_succ (n : β) : yn a1 (n + 1) = xn a1 n + yn a1 n * a :=
rfl
#align pell.yn_succ Pell.yn_succ
--@[simp] Porting note (#10618): `simp` can prove it
theorem xn_one : xn a1 1 = a := by simp
#align pell.xn_one Pell.xn_one
--@[simp] Porting note (#10618): `simp` can prove it
theorem yn_one : yn a1 1 = 1 := by simp
#align pell.yn_one Pell.yn_one
def xz (n : β) : β€ :=
xn a1 n
#align pell.xz Pell.xz
def yz (n : β) : β€ :=
yn a1 n
#align pell.yz Pell.yz
section
def az (a : β) : β€ :=
a
#align pell.az Pell.az
end
theorem asq_pos : 0 < a * a :=
le_trans (le_of_lt a1)
(by have := @Nat.mul_le_mul_left 1 a a (le_of_lt a1); rwa [mul_one] at this)
#align pell.asq_pos Pell.asq_pos
theorem dz_val : β(d a1) = az a * az a - 1 :=
have : 1 β€ a * a := asq_pos a1
by rw [Pell.d, Int.ofNat_sub this]; rfl
#align pell.dz_val Pell.dz_val
@[simp]
theorem xz_succ (n : β) : (xz a1 (n + 1)) = xz a1 n * az a + d a1 * yz a1 n :=
rfl
#align pell.xz_succ Pell.xz_succ
@[simp]
theorem yz_succ (n : β) : yz a1 (n + 1) = xz a1 n + yz a1 n * az a :=
rfl
#align pell.yz_succ Pell.yz_succ
def pellZd (n : β) : β€β(d a1) :=
β¨xn a1 n, yn a1 nβ©
#align pell.pell_zd Pell.pellZd
@[simp]
theorem pellZd_re (n : β) : (pellZd a1 n).re = xn a1 n :=
rfl
#align pell.pell_zd_re Pell.pellZd_re
@[simp]
theorem pellZd_im (n : β) : (pellZd a1 n).im = yn a1 n :=
rfl
#align pell.pell_zd_im Pell.pellZd_im
theorem isPell_nat {x y : β} : IsPell (β¨x, yβ© : β€β(d a1)) β x * x - d a1 * y * y = 1 :=
β¨fun h =>
Nat.cast_inj.1
(by rw [Int.ofNat_sub (Int.le_of_ofNat_le_ofNat <| Int.le.intro_sub _ h)]; exact h),
fun h =>
show ((x * x : β) - (d a1 * y * y : β) : β€) = 1 by
rw [β Int.ofNat_sub <| le_of_lt <| Nat.lt_of_sub_eq_succ h, h]; rflβ©
#align pell.is_pell_nat Pell.isPell_nat
@[simp]
theorem pellZd_succ (n : β) : pellZd a1 (n + 1) = pellZd a1 n * β¨a, 1β© := by ext <;> simp
#align pell.pell_zd_succ Pell.pellZd_succ
theorem isPell_one : IsPell (β¨a, 1β© : β€β(d a1)) :=
show az a * az a - d a1 * 1 * 1 = 1 by simp [dz_val]
#align pell.is_pell_one Pell.isPell_one
theorem isPell_pellZd : β n : β, IsPell (pellZd a1 n)
| 0 => rfl
| n + 1 => by
let o := isPell_one a1
simp; exact Pell.isPell_mul (isPell_pellZd n) o
#align pell.is_pell_pell_zd Pell.isPell_pellZd
@[simp]
theorem pell_eqz (n : β) : xz a1 n * xz a1 n - d a1 * yz a1 n * yz a1 n = 1 :=
isPell_pellZd a1 n
#align pell.pell_eqz Pell.pell_eqz
@[simp]
theorem pell_eq (n : β) : xn a1 n * xn a1 n - d a1 * yn a1 n * yn a1 n = 1 :=
let pn := pell_eqz a1 n
have h : (β(xn a1 n * xn a1 n) : β€) - β(d a1 * yn a1 n * yn a1 n) = 1 := by
repeat' rw [Int.ofNat_mul]; exact pn
have hl : d a1 * yn a1 n * yn a1 n β€ xn a1 n * xn a1 n :=
Nat.cast_le.1 <| Int.le.intro _ <| add_eq_of_eq_sub' <| Eq.symm h
Nat.cast_inj.1 (by rw [Int.ofNat_sub hl]; exact h)
#align pell.pell_eq Pell.pell_eq
instance dnsq : Zsqrtd.Nonsquare (d a1) :=
β¨fun n h =>
have : n * n + 1 = a * a := by rw [β h]; exact Nat.succ_pred_eq_of_pos (asq_pos a1)
have na : n < a := Nat.mul_self_lt_mul_self_iff.1 (by rw [β this]; exact Nat.lt_succ_self _)
have : (n + 1) * (n + 1) β€ n * n + 1 := by rw [this]; exact Nat.mul_self_le_mul_self na
have : n + n β€ 0 :=
@Nat.le_of_add_le_add_right _ (n * n + 1) _ (by ring_nf at this β’; assumption)
Nat.ne_of_gt (d_pos a1) <| by
rwa [Nat.eq_zero_of_le_zero ((Nat.le_add_left _ _).trans this)] at hβ©
#align pell.dnsq Pell.dnsq
theorem xn_ge_a_pow : β n : β, a ^ n β€ xn a1 n
| 0 => le_refl 1
| n + 1 => by
simp only [_root_.pow_succ, xn_succ]
exact le_trans (Nat.mul_le_mul_right _ (xn_ge_a_pow n)) (Nat.le_add_right _ _)
#align pell.xn_ge_a_pow Pell.xn_ge_a_pow
theorem n_lt_a_pow : β n : β, n < a ^ n
| 0 => Nat.le_refl 1
| n + 1 => by
have IH := n_lt_a_pow n
have : a ^ n + a ^ n β€ a ^ n * a := by
rw [β mul_two]
exact Nat.mul_le_mul_left _ a1
simp only [_root_.pow_succ, gt_iff_lt]
refine lt_of_lt_of_le ?_ this
exact add_lt_add_of_lt_of_le IH (lt_of_le_of_lt (Nat.zero_le _) IH)
#align pell.n_lt_a_pow Pell.n_lt_a_pow
theorem n_lt_xn (n) : n < xn a1 n :=
lt_of_lt_of_le (n_lt_a_pow a1 n) (xn_ge_a_pow a1 n)
#align pell.n_lt_xn Pell.n_lt_xn
theorem x_pos (n) : 0 < xn a1 n :=
lt_of_le_of_lt (Nat.zero_le n) (n_lt_xn a1 n)
#align pell.x_pos Pell.x_pos
theorem eq_pell_lem : β (n) (b : β€β(d a1)), 1 β€ b β IsPell b β
b β€ pellZd a1 n β β n, b = pellZd a1 n
| 0, b => fun h1 _ hl => β¨0, @Zsqrtd.le_antisymm _ (dnsq a1) _ _ hl h1β©
| n + 1, b => fun h1 hp h =>
have a1p : (0 : β€β(d a1)) β€ β¨a, 1β© := trivial
have am1p : (0 : β€β(d a1)) β€ β¨a, -1β© := show (_ : Nat) β€ _ by simp; exact Nat.pred_le _
have a1m : (β¨a, 1β© * β¨a, -1β© : β€β(d a1)) = 1 := isPell_norm.1 (isPell_one a1)
if ha : (β¨βa, 1β© : β€β(d a1)) β€ b then
let β¨m, eβ© :=
eq_pell_lem n (b * β¨a, -1β©) (by rw [β a1m]; exact mul_le_mul_of_nonneg_right ha am1p)
(isPell_mul hp (isPell_star.1 (isPell_one a1)))
(by
have t := mul_le_mul_of_nonneg_right h am1p
rwa [pellZd_succ, mul_assoc, a1m, mul_one] at t)
β¨m + 1, by
rw [show b = b * β¨a, -1β© * β¨a, 1β© by rw [mul_assoc, Eq.trans (mul_comm _ _) a1m]; simp,
pellZd_succ, e]β©
else
suffices Β¬1 < b from β¨0, show b = 1 from (Or.resolve_left (lt_or_eq_of_le h1) this).symmβ©
fun h1l => by
cases' b with x y
exact by
have bm : (_ * β¨_, _β© : β€βd a1) = 1 := Pell.isPell_norm.1 hp
have y0l : (0 : β€βd a1) < β¨x - x, y - -yβ© :=
sub_lt_sub h1l fun hn : (1 : β€βd a1) β€ β¨x, -yβ© => by
have t := mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)
erw [bm, mul_one] at t
exact h1l t
have yl2 : (β¨_, _β© : β€β_) < β¨_, _β© :=
show (β¨x, yβ© - β¨x, -yβ© : β€βd a1) < β¨a, 1β© - β¨a, -1β© from
sub_lt_sub ha fun hn : (β¨x, -yβ© : β€βd a1) β€ β¨a, -1β© => by
have t := mul_le_mul_of_nonneg_right
(mul_le_mul_of_nonneg_left hn (le_trans zero_le_one h1)) a1p
erw [bm, one_mul, mul_assoc, Eq.trans (mul_comm _ _) a1m, mul_one] at t
exact ha t
simp only [sub_self, sub_neg_eq_add] at y0l; simp only [Zsqrtd.neg_re, add_right_neg,
Zsqrtd.neg_im, neg_neg] at yl2
exact
match y, y0l, (yl2 : (β¨_, _β© : β€β_) < β¨_, _β©) with
| 0, y0l, _ => y0l (le_refl 0)
| (y + 1 : β), _, yl2 =>
yl2
(Zsqrtd.le_of_le_le (by simp [sub_eq_add_neg])
(let t := Int.ofNat_le_ofNat_of_le (Nat.succ_pos y)
add_le_add t t))
| Int.negSucc _, y0l, _ => y0l trivial
#align pell.eq_pell_lem Pell.eq_pell_lem
theorem eq_pellZd (b : β€β(d a1)) (b1 : 1 β€ b) (hp : IsPell b) : β n, b = pellZd a1 n :=
let β¨n, hβ© := @Zsqrtd.le_arch (d a1) b
eq_pell_lem a1 n b b1 hp <|
h.trans <| by
rw [Zsqrtd.natCast_val]
exact
Zsqrtd.le_of_le_le (Int.ofNat_le_ofNat_of_le <| le_of_lt <| n_lt_xn _ _)
(Int.ofNat_zero_le _)
#align pell.eq_pell_zd Pell.eq_pellZd
theorem eq_pell {x y : β} (hp : x * x - d a1 * y * y = 1) : β n, x = xn a1 n β§ y = yn a1 n :=
have : (1 : β€β(d a1)) β€ β¨x, yβ© :=
match x, hp with
| 0, (hp : 0 - _ = 1) => by rw [zero_tsub] at hp; contradiction
| x + 1, _hp =>
Zsqrtd.le_of_le_le (Int.ofNat_le_ofNat_of_le <| Nat.succ_pos x) (Int.ofNat_zero_le _)
let β¨m, eβ© := eq_pellZd a1 β¨x, yβ© this ((isPell_nat a1).2 hp)
β¨m,
match x, y, e with
| _, _, rfl => β¨rfl, rflβ©β©
#align pell.eq_pell Pell.eq_pell
theorem pellZd_add (m) : β n, pellZd a1 (m + n) = pellZd a1 m * pellZd a1 n
| 0 => (mul_one _).symm
| n + 1 => by rw [β add_assoc, pellZd_succ, pellZd_succ, pellZd_add _ n, β mul_assoc]
#align pell.pell_zd_add Pell.pellZd_add
theorem xn_add (m n) : xn a1 (m + n) = xn a1 m * xn a1 n + d a1 * yn a1 m * yn a1 n := by
injection pellZd_add a1 m n with h _
zify
rw [h]
simp [pellZd]
#align pell.xn_add Pell.xn_add
theorem yn_add (m n) : yn a1 (m + n) = xn a1 m * yn a1 n + yn a1 m * xn a1 n := by
injection pellZd_add a1 m n with _ h
zify
rw [h]
simp [pellZd]
#align pell.yn_add Pell.yn_add
theorem pellZd_sub {m n} (h : n β€ m) : pellZd a1 (m - n) = pellZd a1 m * star (pellZd a1 n) := by
let t := pellZd_add a1 n (m - n)
rw [add_tsub_cancel_of_le h] at t
rw [t, mul_comm (pellZd _ n) _, mul_assoc, isPell_norm.1 (isPell_pellZd _ _), mul_one]
#align pell.pell_zd_sub Pell.pellZd_sub
theorem xz_sub {m n} (h : n β€ m) :
xz a1 (m - n) = xz a1 m * xz a1 n - d a1 * yz a1 m * yz a1 n := by
rw [sub_eq_add_neg, β mul_neg]
exact congr_arg Zsqrtd.re (pellZd_sub a1 h)
#align pell.xz_sub Pell.xz_sub
theorem yz_sub {m n} (h : n β€ m) : yz a1 (m - n) = xz a1 n * yz a1 m - xz a1 m * yz a1 n := by
rw [sub_eq_add_neg, β mul_neg, mul_comm, add_comm]
exact congr_arg Zsqrtd.im (pellZd_sub a1 h)
#align pell.yz_sub Pell.yz_sub
theorem xy_coprime (n) : (xn a1 n).Coprime (yn a1 n) :=
Nat.coprime_of_dvd' fun k _ kx ky => by
let p := pell_eq a1 n
rw [β p]
exact Nat.dvd_sub (le_of_lt <| Nat.lt_of_sub_eq_succ p) (kx.mul_left _) (ky.mul_left _)
#align pell.xy_coprime Pell.xy_coprime
theorem strictMono_y : StrictMono (yn a1)
| m, 0, h => absurd h <| Nat.not_lt_zero _
| m, n + 1, h => by
have : yn a1 m β€ yn a1 n :=
Or.elim (lt_or_eq_of_le <| Nat.le_of_succ_le_succ h) (fun hl => le_of_lt <| strictMono_y hl)
fun e => by rw [e]
simp; refine lt_of_le_of_lt ?_ (Nat.lt_add_of_pos_left <| x_pos a1 n)
rw [β mul_one (yn a1 m)]
exact mul_le_mul this (le_of_lt a1) (Nat.zero_le _) (Nat.zero_le _)
#align pell.strict_mono_y Pell.strictMono_y
theorem strictMono_x : StrictMono (xn a1)
| m, 0, h => absurd h <| Nat.not_lt_zero _
| m, n + 1, h => by
have : xn a1 m β€ xn a1 n :=
Or.elim (lt_or_eq_of_le <| Nat.le_of_succ_le_succ h) (fun hl => le_of_lt <| strictMono_x hl)
fun e => by rw [e]
simp; refine lt_of_lt_of_le (lt_of_le_of_lt this ?_) (Nat.le_add_right _ _)
have t := Nat.mul_lt_mul_of_pos_left a1 (x_pos a1 n)
rwa [mul_one] at t
#align pell.strict_mono_x Pell.strictMono_x
theorem yn_ge_n : β n, n β€ yn a1 n
| 0 => Nat.zero_le _
| n + 1 =>
show n < yn a1 (n + 1) from lt_of_le_of_lt (yn_ge_n n) (strictMono_y a1 <| Nat.lt_succ_self n)
#align pell.yn_ge_n Pell.yn_ge_n
theorem y_mul_dvd (n) : β k, yn a1 n β£ yn a1 (n * k)
| 0 => dvd_zero _
| k + 1 => by
rw [Nat.mul_succ, yn_add]; exact dvd_add (dvd_mul_left _ _) ((y_mul_dvd _ k).mul_right _)
#align pell.y_mul_dvd Pell.y_mul_dvd
theorem y_dvd_iff (m n) : yn a1 m β£ yn a1 n β m β£ n :=
β¨fun h =>
Nat.dvd_of_mod_eq_zero <|
(Nat.eq_zero_or_pos _).resolve_right fun hp => by
have co : Nat.Coprime (yn a1 m) (xn a1 (m * (n / m))) :=
Nat.Coprime.symm <| (xy_coprime a1 _).coprime_dvd_right (y_mul_dvd a1 m (n / m))
have m0 : 0 < m :=
m.eq_zero_or_pos.resolve_left fun e => by
rw [e, Nat.mod_zero] at hp;rw [e] at h
exact _root_.ne_of_lt (strictMono_y a1 hp) (eq_zero_of_zero_dvd h).symm
rw [β Nat.mod_add_div n m, yn_add] at h
exact
not_le_of_gt (strictMono_y _ <| Nat.mod_lt n m0)
(Nat.le_of_dvd (strictMono_y _ hp) <|
co.dvd_of_dvd_mul_right <|
(Nat.dvd_add_iff_right <| (y_mul_dvd _ _ _).mul_left _).2 h),
fun β¨k, eβ© => by rw [e]; apply y_mul_dvdβ©
#align pell.y_dvd_iff Pell.y_dvd_iff
theorem xy_modEq_yn (n) :
β k, xn a1 (n * k) β‘ xn a1 n ^ k [MOD yn a1 n ^ 2] β§ yn a1 (n * k) β‘
k * xn a1 n ^ (k - 1) * yn a1 n [MOD yn a1 n ^ 3]
| 0 => by constructor <;> simp <;> exact Nat.ModEq.refl _
| k + 1 => by
let β¨hx, hyβ© := xy_modEq_yn n k
have L : xn a1 (n * k) * xn a1 n + d a1 * yn a1 (n * k) * yn a1 n β‘
xn a1 n ^ k * xn a1 n + 0 [MOD yn a1 n ^ 2] :=
(hx.mul_right _).add <|
modEq_zero_iff_dvd.2 <| by
rw [_root_.pow_succ]
exact
mul_dvd_mul_right
(dvd_mul_of_dvd_right
(modEq_zero_iff_dvd.1 <|
(hy.of_dvd <| by simp [_root_.pow_succ]).trans <|
modEq_zero_iff_dvd.2 <| by simp)
_) _
have R : xn a1 (n * k) * yn a1 n + yn a1 (n * k) * xn a1 n β‘
xn a1 n ^ k * yn a1 n + k * xn a1 n ^ k * yn a1 n [MOD yn a1 n ^ 3] :=
ModEq.add
(by
rw [_root_.pow_succ]
exact hx.mul_right' _) <| by
have : k * xn a1 n ^ (k - 1) * yn a1 n * xn a1 n = k * xn a1 n ^ k * yn a1 n := by
cases' k with k <;> simp [_root_.pow_succ]; ring_nf
rw [β this]
exact hy.mul_right _
rw [add_tsub_cancel_right, Nat.mul_succ, xn_add, yn_add, pow_succ (xn _ n), Nat.succ_mul,
add_comm (k * xn _ n ^ k) (xn _ n ^ k), right_distrib]
exact β¨L, Rβ©
#align pell.xy_modeq_yn Pell.xy_modEq_yn
theorem ysq_dvd_yy (n) : yn a1 n * yn a1 n β£ yn a1 (n * yn a1 n) :=
modEq_zero_iff_dvd.1 <|
((xy_modEq_yn a1 n (yn a1 n)).right.of_dvd <| by simp [_root_.pow_succ]).trans
(modEq_zero_iff_dvd.2 <| by simp [mul_dvd_mul_left, mul_assoc])
#align pell.ysq_dvd_yy Pell.ysq_dvd_yy
theorem dvd_of_ysq_dvd {n t} (h : yn a1 n * yn a1 n β£ yn a1 t) : yn a1 n β£ t :=
have nt : n β£ t := (y_dvd_iff a1 n t).1 <| dvd_of_mul_left_dvd h
n.eq_zero_or_pos.elim (fun n0 => by rwa [n0] at nt β’) fun n0l : 0 < n => by
let β¨k, keβ© := nt
have : yn a1 n β£ k * xn a1 n ^ (k - 1) :=
Nat.dvd_of_mul_dvd_mul_right (strictMono_y a1 n0l) <|
modEq_zero_iff_dvd.1 <| by
have xm := (xy_modEq_yn a1 n k).right; rw [β ke] at xm
exact (xm.of_dvd <| by simp [_root_.pow_succ]).symm.trans h.modEq_zero_nat
rw [ke]
exact dvd_mul_of_dvd_right (((xy_coprime _ _).pow_left _).symm.dvd_of_dvd_mul_right this) _
#align pell.dvd_of_ysq_dvd Pell.dvd_of_ysq_dvd
theorem pellZd_succ_succ (n) :
pellZd a1 (n + 2) + pellZd a1 n = (2 * a : β) * pellZd a1 (n + 1) := by
have : (1 : β€β(d a1)) + β¨a, 1β© * β¨a, 1β© = β¨a, 1β© * (2 * a) := by
rw [Zsqrtd.natCast_val]
change (β¨_, _β© : β€β(d a1)) = β¨_, _β©
rw [dz_val]
dsimp [az]
ext <;> dsimp <;> ring_nf
simpa [mul_add, mul_comm, mul_left_comm, add_comm] using congr_arg (Β· * pellZd a1 n) this
#align pell.pell_zd_succ_succ Pell.pellZd_succ_succ
theorem xy_succ_succ (n) :
xn a1 (n + 2) + xn a1 n =
2 * a * xn a1 (n + 1) β§ yn a1 (n + 2) + yn a1 n = 2 * a * yn a1 (n + 1) := by
have := pellZd_succ_succ a1 n; unfold pellZd at this
erw [Zsqrtd.smul_val (2 * a : β)] at this
injection this with hβ hβ
constructor <;> apply Int.ofNat.inj <;> [simpa using hβ; simpa using hβ]
#align pell.xy_succ_succ Pell.xy_succ_succ
theorem xn_succ_succ (n) : xn a1 (n + 2) + xn a1 n = 2 * a * xn a1 (n + 1) :=
(xy_succ_succ a1 n).1
#align pell.xn_succ_succ Pell.xn_succ_succ
theorem yn_succ_succ (n) : yn a1 (n + 2) + yn a1 n = 2 * a * yn a1 (n + 1) :=
(xy_succ_succ a1 n).2
#align pell.yn_succ_succ Pell.yn_succ_succ
theorem xz_succ_succ (n) : xz a1 (n + 2) = (2 * a : β) * xz a1 (n + 1) - xz a1 n :=
eq_sub_of_add_eq <| by delta xz; rw [β Int.ofNat_add, β Int.ofNat_mul, xn_succ_succ]
#align pell.xz_succ_succ Pell.xz_succ_succ
theorem yz_succ_succ (n) : yz a1 (n + 2) = (2 * a : β) * yz a1 (n + 1) - yz a1 n :=
eq_sub_of_add_eq <| by delta yz; rw [β Int.ofNat_add, β Int.ofNat_mul, yn_succ_succ]
#align pell.yz_succ_succ Pell.yz_succ_succ
theorem yn_modEq_a_sub_one : β n, yn a1 n β‘ n [MOD a - 1]
| 0 => by simp [Nat.ModEq.refl]
| 1 => by simp [Nat.ModEq.refl]
| n + 2 =>
(yn_modEq_a_sub_one n).add_right_cancel <| by
rw [yn_succ_succ, (by ring : n + 2 + n = 2 * (n + 1))]
exact ((modEq_sub a1.le).mul_left 2).mul (yn_modEq_a_sub_one (n + 1))
#align pell.yn_modeq_a_sub_one Pell.yn_modEq_a_sub_one
theorem yn_modEq_two : β n, yn a1 n β‘ n [MOD 2]
| 0 => by rfl
| 1 => by simp; rfl
| n + 2 =>
(yn_modEq_two n).add_right_cancel <| by
rw [yn_succ_succ, mul_assoc, (by ring : n + 2 + n = 2 * (n + 1))]
exact (dvd_mul_right 2 _).modEq_zero_nat.trans (dvd_mul_right 2 _).zero_modEq_nat
#align pell.yn_modeq_two Pell.yn_modEq_two
section
theorem x_sub_y_dvd_pow_lem (y2 y1 y0 yn1 yn0 xn1 xn0 ay a2 : β€) :
(a2 * yn1 - yn0) * ay + y2 - (a2 * xn1 - xn0) =
y2 - a2 * y1 + y0 + a2 * (yn1 * ay + y1 - xn1) - (yn0 * ay + y0 - xn0) := by
ring
#align pell.x_sub_y_dvd_pow_lem Pell.x_sub_y_dvd_pow_lem
end
theorem x_sub_y_dvd_pow (y : β) :
β n, (2 * a * y - y * y - 1 : β€) β£ yz a1 n * (a - y) + β(y ^ n) - xz a1 n
| 0 => by simp [xz, yz, Int.ofNat_zero, Int.ofNat_one]
| 1 => by simp [xz, yz, Int.ofNat_zero, Int.ofNat_one]
| n + 2 => by
have : (2 * a * y - y * y - 1 : β€) β£ β(y ^ (n + 2)) - β(2 * a) * β(y ^ (n + 1)) + β(y ^ n) :=
β¨-β(y ^ n), by
simp [_root_.pow_succ, mul_add, Int.ofNat_mul, show ((2 : β) : β€) = 2 from rfl, mul_comm,
mul_left_comm]
ringβ©
rw [xz_succ_succ, yz_succ_succ, x_sub_y_dvd_pow_lem β(y ^ (n + 2)) β(y ^ (n + 1)) β(y ^ n)]
exact _root_.dvd_sub (dvd_add this <| (x_sub_y_dvd_pow _ (n + 1)).mul_left _)
(x_sub_y_dvd_pow _ n)
#align pell.x_sub_y_dvd_pow Pell.x_sub_y_dvd_pow
theorem xn_modEq_x2n_add_lem (n j) : xn a1 n β£ d a1 * yn a1 n * (yn a1 n * xn a1 j) + xn a1 j := by
have h1 : d a1 * yn a1 n * (yn a1 n * xn a1 j) + xn a1 j =
(d a1 * yn a1 n * yn a1 n + 1) * xn a1 j := by
simp [add_mul, mul_assoc]
have h2 : d a1 * yn a1 n * yn a1 n + 1 = xn a1 n * xn a1 n := by
zify at *
apply add_eq_of_eq_sub' (Eq.symm (pell_eqz a1 n))
rw [h2] at h1; rw [h1, mul_assoc]; exact dvd_mul_right _ _
#align pell.xn_modeq_x2n_add_lem Pell.xn_modEq_x2n_add_lem
theorem xn_modEq_x2n_add (n j) : xn a1 (2 * n + j) + xn a1 j β‘ 0 [MOD xn a1 n] := by
rw [two_mul, add_assoc, xn_add, add_assoc, β zero_add 0]
refine (dvd_mul_right (xn a1 n) (xn a1 (n + j))).modEq_zero_nat.add ?_
rw [yn_add, left_distrib, add_assoc, β zero_add 0]
exact
((dvd_mul_right _ _).mul_left _).modEq_zero_nat.add (xn_modEq_x2n_add_lem _ _ _).modEq_zero_nat
#align pell.xn_modeq_x2n_add Pell.xn_modEq_x2n_add
| Mathlib/NumberTheory/PellMatiyasevic.lean | 606 | 619 | theorem xn_modEq_x2n_sub_lem {n j} (h : j β€ n) : xn a1 (2 * n - j) + xn a1 j β‘ 0 [MOD xn a1 n] := by |
have h1 : xz a1 n β£ d a1 * yz a1 n * yz a1 (n - j) + xz a1 j := by
rw [yz_sub _ h, mul_sub_left_distrib, sub_add_eq_add_sub]
exact
dvd_sub
(by
delta xz; delta yz
rw [mul_comm (xn _ _ : β€)]
exact mod_cast (xn_modEq_x2n_add_lem _ n j))
((dvd_mul_right _ _).mul_left _)
rw [two_mul, add_tsub_assoc_of_le h, xn_add, add_assoc, β zero_add 0]
exact
(dvd_mul_right _ _).modEq_zero_nat.add
(Int.natCast_dvd_natCast.1 <| by simpa [xz, yz] using h1).modEq_zero_nat
|
import Mathlib.Algebra.Order.Module.Defs
import Mathlib.Data.DFinsupp.Basic
#align_import data.dfinsupp.order from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29"
open Finset
variable {ΞΉ : Type*} {Ξ± : ΞΉ β Type*}
namespace DFinsupp
section Zero
variable [β i, Zero (Ξ± i)]
instance [β i, PartialOrder (Ξ± i)] : PartialOrder (Ξ β i, Ξ± i) :=
{ (inferInstance : Preorder (DFinsupp Ξ±)) with
le_antisymm := fun _ _ hfg hgf β¦ ext fun i β¦ (hfg i).antisymm (hgf i) }
instance [β i, SemilatticeInf (Ξ± i)] : SemilatticeInf (Ξ β i, Ξ± i) :=
{ (inferInstance : PartialOrder (DFinsupp Ξ±)) with
inf := zipWith (fun _ β¦ (Β· β Β·)) fun _ β¦ inf_idem _
inf_le_left := fun _ _ _ β¦ inf_le_left
inf_le_right := fun _ _ _ β¦ inf_le_right
le_inf := fun _ _ _ hf hg i β¦ le_inf (hf i) (hg i) }
@[simp, norm_cast]
lemma coe_inf [β i, SemilatticeInf (Ξ± i)] (f g : Ξ β i, Ξ± i) : f β g = βf β g := rfl
theorem inf_apply [β i, SemilatticeInf (Ξ± i)] (f g : Ξ β i, Ξ± i) (i : ΞΉ) : (f β g) i = f i β g i :=
zipWith_apply _ _ _ _ _
#align dfinsupp.inf_apply DFinsupp.inf_apply
instance [β i, SemilatticeSup (Ξ± i)] : SemilatticeSup (Ξ β i, Ξ± i) :=
{ (inferInstance : PartialOrder (DFinsupp Ξ±)) with
sup := zipWith (fun _ β¦ (Β· β Β·)) fun _ β¦ sup_idem _
le_sup_left := fun _ _ _ β¦ le_sup_left
le_sup_right := fun _ _ _ β¦ le_sup_right
sup_le := fun _ _ _ hf hg i β¦ sup_le (hf i) (hg i) }
@[simp, norm_cast]
lemma coe_sup [β i, SemilatticeSup (Ξ± i)] (f g : Ξ β i, Ξ± i) : f β g = βf β g := rfl
theorem sup_apply [β i, SemilatticeSup (Ξ± i)] (f g : Ξ β i, Ξ± i) (i : ΞΉ) : (f β g) i = f i β g i :=
zipWith_apply _ _ _ _ _
#align dfinsupp.sup_apply DFinsupp.sup_apply
instance (Ξ± : ΞΉ β Type*) [β i, OrderedAddCommMonoid (Ξ± i)] : OrderedAddCommMonoid (Ξ β i, Ξ± i) :=
{ (inferInstance : AddCommMonoid (DFinsupp Ξ±)),
(inferInstance : PartialOrder (DFinsupp Ξ±)) with
add_le_add_left := fun _ _ h c i β¦ add_le_add_left (h i) (c i) }
instance (Ξ± : ΞΉ β Type*) [β i, OrderedCancelAddCommMonoid (Ξ± i)] :
OrderedCancelAddCommMonoid (Ξ β i, Ξ± i) :=
{ (inferInstance : OrderedAddCommMonoid (DFinsupp Ξ±)) with
le_of_add_le_add_left := fun _ _ _ H i β¦ le_of_add_le_add_left (H i) }
instance [β i, OrderedAddCommMonoid (Ξ± i)] [β i, ContravariantClass (Ξ± i) (Ξ± i) (Β· + Β·) (Β· β€ Β·)] :
ContravariantClass (Ξ β i, Ξ± i) (Ξ β i, Ξ± i) (Β· + Β·) (Β· β€ Β·) :=
β¨fun _ _ _ H i β¦ le_of_add_le_add_left (H i)β©
section CanonicallyLinearOrderedAddCommMonoid
variable [β i, CanonicallyLinearOrderedAddCommMonoid (Ξ± i)] [DecidableEq ΞΉ] {f g : Ξ β i, Ξ± i}
@[simp]
theorem support_inf : (f β g).support = f.support β© g.support := by
ext
simp only [inf_apply, mem_support_iff, Ne, Finset.mem_inter]
simp only [inf_eq_min, β nonpos_iff_eq_zero, min_le_iff, not_or]
#align dfinsupp.support_inf DFinsupp.support_inf
@[simp]
| Mathlib/Data/DFinsupp/Order.lean | 320 | 323 | theorem support_sup : (f β g).support = f.support βͺ g.support := by |
ext
simp only [Finset.mem_union, mem_support_iff, sup_apply, Ne, β bot_eq_zero]
rw [_root_.sup_eq_bot_iff, not_and_or]
|
import Mathlib.Analysis.Convex.Basic
import Mathlib.Order.Filter.Extr
import Mathlib.Tactic.GCongr
#align_import analysis.convex.function from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
open scoped Classical
open LinearMap Set Convex Pointwise
variable {π E F Ξ± Ξ² ΞΉ : Type*}
section OrderedSemiring
variable [OrderedSemiring π]
section AddCommMonoid
variable [AddCommMonoid E] [AddCommMonoid F]
section OrderedAddCommMonoid
variable [OrderedAddCommMonoid Ξ±] [OrderedAddCommMonoid Ξ²]
section AddCancelCommMonoid
variable [AddCancelCommMonoid E] [OrderedAddCommMonoid Ξ²] [Module π E] [SMul π Ξ²] {s : Set E}
{f : E β Ξ²}
| Mathlib/Analysis/Convex/Function.lean | 940 | 946 | theorem StrictConvexOn.translate_right (hf : StrictConvexOn π s f) (c : E) :
StrictConvexOn π ((fun z => c + z) β»ΒΉ' s) (f β fun z => c + z) :=
β¨hf.1.translate_preimage_right _, fun x hx y hy hxy a b ha hb hab =>
calc
f (c + (a β’ x + b β’ y)) = f (a β’ (c + x) + b β’ (c + y)) := by |
rw [smul_add, smul_add, add_add_add_comm, Convex.combo_self hab]
_ < a β’ f (c + x) + b β’ f (c + y) := hf.2 hx hy ((add_right_injective c).ne hxy) ha hb habβ©
|
import Mathlib.CategoryTheory.Functor.Const
import Mathlib.CategoryTheory.DiscreteCategory
import Mathlib.CategoryTheory.Yoneda
import Mathlib.CategoryTheory.Functor.ReflectsIso
#align_import category_theory.limits.cones from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da"
-- morphism levels before object levels. See note [CategoryTheory universes].
universe vβ vβ vβ vβ uβ uβ uβ uβ
open CategoryTheory
variable {J : Type uβ} [Category.{vβ} J]
variable {K : Type uβ} [Category.{vβ} K]
variable {C : Type uβ} [Category.{vβ} C]
variable {D : Type uβ} [Category.{vβ} D]
open CategoryTheory
open CategoryTheory.Category
open CategoryTheory.Functor
open Opposite
namespace CategoryTheory
section
variable (J C)
@[simps!]
def cones : (J β₯€ C) β₯€ Cα΅α΅ β₯€ Type max uβ vβ where
obj := Functor.cones
map f := whiskerLeft (const J).op (yoneda.map f)
#align category_theory.cones CategoryTheory.cones
@[simps!]
def cocones : (J β₯€ C)α΅α΅ β₯€ C β₯€ Type max uβ vβ where
obj F := Functor.cocones (unop F)
map f := whiskerLeft (const J) (coyoneda.map f)
#align category_theory.cocones CategoryTheory.cocones
end
namespace Limits
section
structure Cone (F : J β₯€ C) where
pt : C
Ο : (const J).obj pt βΆ F
#align category_theory.limits.cone CategoryTheory.Limits.Cone
set_option linter.uppercaseLean3 false in
#align category_theory.limits.cone.X CategoryTheory.Limits.Cone.pt
instance inhabitedCone (F : Discrete PUnit β₯€ C) : Inhabited (Cone F) :=
β¨{ pt := F.obj β¨β¨β©β©
Ο := { app := fun β¨β¨β©β© => π _
naturality := by
intro X Y f
match X, Y, f with
| .mk A, .mk B, .up g =>
aesop_cat
}
}β©
#align category_theory.limits.inhabited_cone CategoryTheory.Limits.inhabitedCone
@[reassoc (attr := simp)]
theorem Cone.w {F : J β₯€ C} (c : Cone F) {j j' : J} (f : j βΆ j') :
c.Ο.app j β« F.map f = c.Ο.app j' := by
rw [β c.Ο.naturality f]
apply id_comp
#align category_theory.limits.cone.w CategoryTheory.Limits.Cone.w
structure Cocone (F : J β₯€ C) where
pt : C
ΞΉ : F βΆ (const J).obj pt
#align category_theory.limits.cocone CategoryTheory.Limits.Cocone
set_option linter.uppercaseLean3 false in
#align category_theory.limits.cocone.X CategoryTheory.Limits.Cocone.pt
instance inhabitedCocone (F : Discrete PUnit β₯€ C) : Inhabited (Cocone F) :=
β¨{ pt := F.obj β¨β¨β©β©
ΞΉ := { app := fun β¨β¨β©β© => π _
naturality := by
intro X Y f
match X, Y, f with
| .mk A, .mk B, .up g =>
aesop_cat
}
}β©
#align category_theory.limits.inhabited_cocone CategoryTheory.Limits.inhabitedCocone
@[reassoc] -- @[simp] -- Porting note (#10618): simp can prove this
| Mathlib/CategoryTheory/Limits/Cones.lean | 181 | 184 | theorem Cocone.w {F : J β₯€ C} (c : Cocone F) {j j' : J} (f : j βΆ j') :
F.map f β« c.ΞΉ.app j' = c.ΞΉ.app j := by |
rw [c.ΞΉ.naturality f]
apply comp_id
|
import Mathlib.Topology.Algebra.InfiniteSum.Basic
import Mathlib.Topology.Algebra.UniformGroup
noncomputable section
open Filter Finset Function
open scoped Topology
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*}
section TopologicalGroup
variable [CommGroup Ξ±] [TopologicalSpace Ξ±] [TopologicalGroup Ξ±]
variable {f g : Ξ² β Ξ±} {a aβ aβ : Ξ±}
-- `by simpa using` speeds up elaboration. Why?
@[to_additive]
theorem HasProd.inv (h : HasProd f a) : HasProd (fun b β¦ (f b)β»ΒΉ) aβ»ΒΉ := by
simpa only using h.map (MonoidHom.id Ξ±)β»ΒΉ continuous_inv
#align has_sum.neg HasSum.neg
@[to_additive]
theorem Multipliable.inv (hf : Multipliable f) : Multipliable fun b β¦ (f b)β»ΒΉ :=
hf.hasProd.inv.multipliable
#align summable.neg Summable.neg
@[to_additive]
theorem Multipliable.of_inv (hf : Multipliable fun b β¦ (f b)β»ΒΉ) : Multipliable f := by
simpa only [inv_inv] using hf.inv
#align summable.of_neg Summable.of_neg
@[to_additive]
theorem multipliable_inv_iff : (Multipliable fun b β¦ (f b)β»ΒΉ) β Multipliable f :=
β¨Multipliable.of_inv, Multipliable.invβ©
#align summable_neg_iff summable_neg_iff
@[to_additive]
theorem HasProd.div (hf : HasProd f aβ) (hg : HasProd g aβ) :
HasProd (fun b β¦ f b / g b) (aβ / aβ) := by
simp only [div_eq_mul_inv]
exact hf.mul hg.inv
#align has_sum.sub HasSum.sub
@[to_additive]
theorem Multipliable.div (hf : Multipliable f) (hg : Multipliable g) :
Multipliable fun b β¦ f b / g b :=
(hf.hasProd.div hg.hasProd).multipliable
#align summable.sub Summable.sub
@[to_additive]
theorem Multipliable.trans_div (hg : Multipliable g) (hfg : Multipliable fun b β¦ f b / g b) :
Multipliable f := by
simpa only [div_mul_cancel] using hfg.mul hg
#align summable.trans_sub Summable.trans_sub
@[to_additive]
theorem multipliable_iff_of_multipliable_div (hfg : Multipliable fun b β¦ f b / g b) :
Multipliable f β Multipliable g :=
β¨fun hf β¦ hf.trans_div <| by simpa only [inv_div] using hfg.inv, fun hg β¦ hg.trans_div hfgβ©
#align summable_iff_of_summable_sub summable_iff_of_summable_sub
@[to_additive]
theorem HasProd.update (hf : HasProd f aβ) (b : Ξ²) [DecidableEq Ξ²] (a : Ξ±) :
HasProd (update f b a) (a / f b * aβ) := by
convert (hasProd_ite_eq b (a / f b)).mul hf with b'
by_cases h : b' = b
Β· rw [h, update_same]
simp [eq_self_iff_true, if_true, sub_add_cancel]
Β· simp only [h, update_noteq, if_false, Ne, one_mul, not_false_iff]
#align has_sum.update HasSum.update
@[to_additive]
theorem Multipliable.update (hf : Multipliable f) (b : Ξ²) [DecidableEq Ξ²] (a : Ξ±) :
Multipliable (update f b a) :=
(hf.hasProd.update b a).multipliable
#align summable.update Summable.update
@[to_additive]
theorem HasProd.hasProd_compl_iff {s : Set Ξ²} (hf : HasProd (f β (β) : s β Ξ±) aβ) :
HasProd (f β (β) : βsαΆ β Ξ±) aβ β HasProd f (aβ * aβ) := by
refine β¨fun h β¦ hf.mul_compl h, fun h β¦ ?_β©
rw [hasProd_subtype_iff_mulIndicator] at hf β’
rw [Set.mulIndicator_compl]
simpa only [div_eq_mul_inv, mul_inv_cancel_comm] using h.div hf
#align has_sum.has_sum_compl_iff HasSum.hasSum_compl_iff
@[to_additive]
theorem HasProd.hasProd_iff_compl {s : Set Ξ²} (hf : HasProd (f β (β) : s β Ξ±) aβ) :
HasProd f aβ β HasProd (f β (β) : βsαΆ β Ξ±) (aβ / aβ) :=
Iff.symm <| hf.hasProd_compl_iff.trans <| by rw [mul_div_cancel]
#align has_sum.has_sum_iff_compl HasSum.hasSum_iff_compl
@[to_additive]
theorem Multipliable.multipliable_compl_iff {s : Set Ξ²} (hf : Multipliable (f β (β) : s β Ξ±)) :
Multipliable (f β (β) : βsαΆ β Ξ±) β Multipliable f where
mp := fun β¨_, haβ© β¦ (hf.hasProd.hasProd_compl_iff.1 ha).multipliable
mpr := fun β¨_, haβ© β¦ (hf.hasProd.hasProd_iff_compl.1 ha).multipliable
#align summable.summable_compl_iff Summable.summable_compl_iff
@[to_additive]
protected theorem Finset.hasProd_compl_iff (s : Finset Ξ²) :
HasProd (fun x : { x // x β s } β¦ f x) a β HasProd f (a * β i β s, f i) :=
(s.hasProd f).hasProd_compl_iff.trans <| by rw [mul_comm]
#align finset.has_sum_compl_iff Finset.hasSum_compl_iff
@[to_additive]
protected theorem Finset.hasProd_iff_compl (s : Finset Ξ²) :
HasProd f a β HasProd (fun x : { x // x β s } β¦ f x) (a / β i β s, f i) :=
(s.hasProd f).hasProd_iff_compl
#align finset.has_sum_iff_compl Finset.hasSum_iff_compl
@[to_additive]
protected theorem Finset.multipliable_compl_iff (s : Finset Ξ²) :
(Multipliable fun x : { x // x β s } β¦ f x) β Multipliable f :=
(s.multipliable f).multipliable_compl_iff
#align finset.summable_compl_iff Finset.summable_compl_iff
@[to_additive]
theorem Set.Finite.multipliable_compl_iff {s : Set Ξ²} (hs : s.Finite) :
Multipliable (f β (β) : βsαΆ β Ξ±) β Multipliable f :=
(hs.multipliable f).multipliable_compl_iff
#align set.finite.summable_compl_iff Set.Finite.summable_compl_iff
@[to_additive]
theorem hasProd_ite_div_hasProd [DecidableEq Ξ²] (hf : HasProd f a) (b : Ξ²) :
HasProd (fun n β¦ ite (n = b) 1 (f n)) (a / f b) := by
convert hf.update b 1 using 1
Β· ext n
rw [Function.update_apply]
Β· rw [div_mul_eq_mul_div, one_mul]
#align has_sum_ite_sub_has_sum hasSum_ite_sub_hasSum
section tprod
variable [T2Space Ξ±]
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/Group.lean | 150 | 154 | theorem tprod_inv : β' b, (f b)β»ΒΉ = (β' b, f b)β»ΒΉ := by |
by_cases hf : Multipliable f
Β· exact hf.hasProd.inv.tprod_eq
Β· simp [tprod_eq_one_of_not_multipliable hf,
tprod_eq_one_of_not_multipliable (mt Multipliable.of_inv hf)]
|
import Mathlib.Analysis.Convex.Combination
import Mathlib.Analysis.Convex.Strict
import Mathlib.Topology.Connected.PathConnected
import Mathlib.Topology.Algebra.Affine
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.convex.topology from "leanprover-community/mathlib"@"0e3aacdc98d25e0afe035c452d876d28cbffaa7e"
assert_not_exists Norm
open Metric Bornology Set Pointwise Convex
variable {ΞΉ π E : Type*}
theorem Real.convex_iff_isPreconnected {s : Set β} : Convex β s β IsPreconnected s :=
convex_iff_ordConnected.trans isPreconnected_iff_ordConnected.symm
#align real.convex_iff_is_preconnected Real.convex_iff_isPreconnected
alias β¨_, IsPreconnected.convexβ© := Real.convex_iff_isPreconnected
#align is_preconnected.convex IsPreconnected.convex
section ContinuousConstSMul
variable [LinearOrderedField π] [AddCommGroup E] [Module π E] [TopologicalSpace E]
[TopologicalAddGroup E] [ContinuousConstSMul π E]
theorem Convex.combo_interior_closure_subset_interior {s : Set E} (hs : Convex π s) {a b : π}
(ha : 0 < a) (hb : 0 β€ b) (hab : a + b = 1) : a β’ interior s + b β’ closure s β interior s :=
interior_smulβ ha.ne' s βΈ
calc
interior (a β’ s) + b β’ closure s β interior (a β’ s) + closure (b β’ s) :=
add_subset_add Subset.rfl (smul_closure_subset b s)
_ = interior (a β’ s) + b β’ s := by rw [isOpen_interior.add_closure (b β’ s)]
_ β interior (a β’ s + b β’ s) := subset_interior_add_left
_ β interior s := interior_mono <| hs.set_combo_subset ha.le hb hab
#align convex.combo_interior_closure_subset_interior Convex.combo_interior_closure_subset_interior
theorem Convex.combo_interior_self_subset_interior {s : Set E} (hs : Convex π s) {a b : π}
(ha : 0 < a) (hb : 0 β€ b) (hab : a + b = 1) : a β’ interior s + b β’ s β interior s :=
calc
a β’ interior s + b β’ s β a β’ interior s + b β’ closure s :=
add_subset_add Subset.rfl <| image_subset _ subset_closure
_ β interior s := hs.combo_interior_closure_subset_interior ha hb hab
#align convex.combo_interior_self_subset_interior Convex.combo_interior_self_subset_interior
theorem Convex.combo_closure_interior_subset_interior {s : Set E} (hs : Convex π s) {a b : π}
(ha : 0 β€ a) (hb : 0 < b) (hab : a + b = 1) : a β’ closure s + b β’ interior s β interior s := by
rw [add_comm]
exact hs.combo_interior_closure_subset_interior hb ha (add_comm a b βΈ hab)
#align convex.combo_closure_interior_subset_interior Convex.combo_closure_interior_subset_interior
theorem Convex.combo_self_interior_subset_interior {s : Set E} (hs : Convex π s) {a b : π}
(ha : 0 β€ a) (hb : 0 < b) (hab : a + b = 1) : a β’ s + b β’ interior s β interior s := by
rw [add_comm]
exact hs.combo_interior_self_subset_interior hb ha (add_comm a b βΈ hab)
#align convex.combo_self_interior_subset_interior Convex.combo_self_interior_subset_interior
theorem Convex.combo_interior_closure_mem_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β interior s) (hy : y β closure s) {a b : π} (ha : 0 < a) (hb : 0 β€ b)
(hab : a + b = 1) : a β’ x + b β’ y β interior s :=
hs.combo_interior_closure_subset_interior ha hb hab <|
add_mem_add (smul_mem_smul_set hx) (smul_mem_smul_set hy)
#align convex.combo_interior_closure_mem_interior Convex.combo_interior_closure_mem_interior
theorem Convex.combo_interior_self_mem_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β interior s) (hy : y β s) {a b : π} (ha : 0 < a) (hb : 0 β€ b) (hab : a + b = 1) :
a β’ x + b β’ y β interior s :=
hs.combo_interior_closure_mem_interior hx (subset_closure hy) ha hb hab
#align convex.combo_interior_self_mem_interior Convex.combo_interior_self_mem_interior
theorem Convex.combo_closure_interior_mem_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β closure s) (hy : y β interior s) {a b : π} (ha : 0 β€ a) (hb : 0 < b)
(hab : a + b = 1) : a β’ x + b β’ y β interior s :=
hs.combo_closure_interior_subset_interior ha hb hab <|
add_mem_add (smul_mem_smul_set hx) (smul_mem_smul_set hy)
#align convex.combo_closure_interior_mem_interior Convex.combo_closure_interior_mem_interior
theorem Convex.combo_self_interior_mem_interior {s : Set E} (hs : Convex π s) {x y : E} (hx : x β s)
(hy : y β interior s) {a b : π} (ha : 0 β€ a) (hb : 0 < b) (hab : a + b = 1) :
a β’ x + b β’ y β interior s :=
hs.combo_closure_interior_mem_interior (subset_closure hx) hy ha hb hab
#align convex.combo_self_interior_mem_interior Convex.combo_self_interior_mem_interior
theorem Convex.openSegment_interior_closure_subset_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β interior s) (hy : y β closure s) : openSegment π x y β interior s := by
rintro _ β¨a, b, ha, hb, hab, rflβ©
exact hs.combo_interior_closure_mem_interior hx hy ha hb.le hab
#align convex.open_segment_interior_closure_subset_interior Convex.openSegment_interior_closure_subset_interior
theorem Convex.openSegment_interior_self_subset_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β interior s) (hy : y β s) : openSegment π x y β interior s :=
hs.openSegment_interior_closure_subset_interior hx (subset_closure hy)
#align convex.open_segment_interior_self_subset_interior Convex.openSegment_interior_self_subset_interior
theorem Convex.openSegment_closure_interior_subset_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β closure s) (hy : y β interior s) : openSegment π x y β interior s := by
rintro _ β¨a, b, ha, hb, hab, rflβ©
exact hs.combo_closure_interior_mem_interior hx hy ha.le hb hab
#align convex.open_segment_closure_interior_subset_interior Convex.openSegment_closure_interior_subset_interior
theorem Convex.openSegment_self_interior_subset_interior {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β s) (hy : y β interior s) : openSegment π x y β interior s :=
hs.openSegment_closure_interior_subset_interior (subset_closure hx) hy
#align convex.open_segment_self_interior_subset_interior Convex.openSegment_self_interior_subset_interior
| Mathlib/Analysis/Convex/Topology.lean | 213 | 218 | theorem Convex.add_smul_sub_mem_interior' {s : Set E} (hs : Convex π s) {x y : E}
(hx : x β closure s) (hy : y β interior s) {t : π} (ht : t β Ioc (0 : π) 1) :
x + t β’ (y - x) β interior s := by |
simpa only [sub_smul, smul_sub, one_smul, add_sub, add_comm] using
hs.combo_interior_closure_mem_interior hy hx ht.1 (sub_nonneg.mpr ht.2)
(add_sub_cancel _ _)
|
import Mathlib.Algebra.Divisibility.Basic
import Mathlib.Algebra.Group.Int
import Mathlib.Algebra.Group.Nat
import Mathlib.Algebra.Group.Opposite
import Mathlib.Algebra.Group.Units
import Mathlib.Data.List.Perm
import Mathlib.Data.List.ProdSigma
import Mathlib.Data.List.Range
import Mathlib.Data.List.Rotate
#align_import data.list.big_operators.basic from "leanprover-community/mathlib"@"6c5f73fd6f6cc83122788a80a27cdd54663609f4"
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
assert_not_exists Ring
variable {ΞΉ Ξ± Ξ² M N P G : Type*}
namespace List
section Monoid
variable [Monoid M] [Monoid N] [Monoid P] {l lβ lβ : List M} {a : M}
@[to_additive (attr := simp)]
theorem prod_cons : (a :: l).prod = a * l.prod :=
calc
(a :: l).prod = foldl (Β· * Β·) (a * 1) l := by
simp only [List.prod, foldl_cons, one_mul, mul_one]
_ = _ := foldl_assoc
#align list.prod_cons List.prod_cons
#align list.sum_cons List.sum_cons
@[to_additive]
lemma prod_induction
(p : M β Prop) (hom : β a b, p a β p b β p (a * b)) (unit : p 1) (base : β x β l, p x) :
p l.prod := by
induction' l with a l ih
Β· simpa
rw [List.prod_cons]
simp only [Bool.not_eq_true, List.mem_cons, forall_eq_or_imp] at base
exact hom _ _ (base.1) (ih base.2)
@[to_additive (attr := simp)]
theorem prod_append : (lβ ++ lβ).prod = lβ.prod * lβ.prod :=
calc
(lβ ++ lβ).prod = foldl (Β· * Β·) (foldl (Β· * Β·) 1 lβ * 1) lβ := by simp [List.prod]
_ = lβ.prod * lβ.prod := foldl_assoc
#align list.prod_append List.prod_append
#align list.sum_append List.sum_append
@[to_additive]
theorem prod_concat : (l.concat a).prod = l.prod * a := by
rw [concat_eq_append, prod_append, prod_singleton]
#align list.prod_concat List.prod_concat
#align list.sum_concat List.sum_concat
@[to_additive (attr := simp)]
theorem prod_join {l : List (List M)} : l.join.prod = (l.map List.prod).prod := by
induction l <;> [rfl; simp only [*, List.join, map, prod_append, prod_cons]]
#align list.prod_join List.prod_join
#align list.sum_join List.sum_join
@[to_additive]
theorem prod_eq_foldr : β {l : List M}, l.prod = foldr (Β· * Β·) 1 l
| [] => rfl
| cons a l => by rw [prod_cons, foldr_cons, prod_eq_foldr]
#align list.prod_eq_foldr List.prod_eq_foldr
#align list.sum_eq_foldr List.sum_eq_foldr
@[to_additive (attr := simp)]
theorem prod_replicate (n : β) (a : M) : (replicate n a).prod = a ^ n := by
induction' n with n ih
Β· rw [pow_zero]
rfl
Β· rw [replicate_succ, prod_cons, ih, pow_succ']
#align list.prod_replicate List.prod_replicate
#align list.sum_replicate List.sum_replicate
@[to_additive sum_eq_card_nsmul]
theorem prod_eq_pow_card (l : List M) (m : M) (h : β x β l, x = m) : l.prod = m ^ l.length := by
rw [β prod_replicate, β List.eq_replicate.mpr β¨rfl, hβ©]
#align list.prod_eq_pow_card List.prod_eq_pow_card
#align list.sum_eq_card_nsmul List.sum_eq_card_nsmul
@[to_additive]
theorem prod_hom_rel (l : List ΞΉ) {r : M β N β Prop} {f : ΞΉ β M} {g : ΞΉ β N} (hβ : r 1 1)
(hβ : β β¦i a bβ¦, r a b β r (f i * a) (g i * b)) : r (l.map f).prod (l.map g).prod :=
List.recOn l hβ fun a l hl => by simp only [map_cons, prod_cons, hβ hl]
#align list.prod_hom_rel List.prod_hom_rel
#align list.sum_hom_rel List.sum_hom_rel
@[to_additive]
theorem rel_prod {R : M β N β Prop} (h : R 1 1) (hf : (R β R β R) (Β· * Β·) (Β· * Β·)) :
(Forallβ R β R) prod prod :=
rel_foldl hf h
#align list.rel_prod List.rel_prod
#align list.rel_sum List.rel_sum
@[to_additive]
theorem prod_hom (l : List M) {F : Type*} [FunLike F M N] [MonoidHomClass F M N] (f : F) :
(l.map f).prod = f l.prod := by
simp only [prod, foldl_map, β map_one f]
exact l.foldl_hom f (Β· * Β·) (Β· * f Β·) 1 (fun x y => (map_mul f x y).symm)
#align list.prod_hom List.prod_hom
#align list.sum_hom List.sum_hom
@[to_additive]
theorem prod_homβ (l : List ΞΉ) (f : M β N β P) (hf : β a b c d, f (a * b) (c * d) = f a c * f b d)
(hf' : f 1 1 = 1) (fβ : ΞΉ β M) (fβ : ΞΉ β N) :
(l.map fun i => f (fβ i) (fβ i)).prod = f (l.map fβ).prod (l.map fβ).prod := by
simp only [prod, foldl_map]
-- Porting note: next 3 lines used to be
-- convert l.foldl_homβ (fun a b => f a b) _ _ _ _ _ fun a b i => _
-- Β· exact hf'.symm
-- Β· exact hf _ _ _ _
rw [β l.foldl_homβ (fun a b => f a b), hf']
intros
exact hf _ _ _ _
#align list.prod_homβ List.prod_homβ
#align list.sum_homβ List.sum_homβ
@[to_additive (attr := simp)]
theorem prod_map_mul {Ξ± : Type*} [CommMonoid Ξ±] {l : List ΞΉ} {f g : ΞΉ β Ξ±} :
(l.map fun i => f i * g i).prod = (l.map f).prod * (l.map g).prod :=
l.prod_homβ (Β· * Β·) mul_mul_mul_comm (mul_one _) _ _
#align list.prod_map_mul List.prod_map_mul
#align list.sum_map_add List.sum_map_add
@[to_additive]
theorem prod_map_hom (L : List ΞΉ) (f : ΞΉ β M) {G : Type*} [FunLike G M N] [MonoidHomClass G M N]
(g : G) :
(L.map (g β f)).prod = g (L.map f).prod := by rw [β prod_hom, map_map]
#align list.prod_map_hom List.prod_map_hom
#align list.sum_map_hom List.sum_map_hom
@[to_additive]
theorem prod_isUnit : β {L : List M}, (β m β L, IsUnit m) β IsUnit L.prod
| [], _ => by simp
| h :: t, u => by
simp only [List.prod_cons]
exact IsUnit.mul (u h (mem_cons_self h t)) (prod_isUnit fun m mt => u m (mem_cons_of_mem h mt))
#align list.prod_is_unit List.prod_isUnit
#align list.sum_is_add_unit List.sum_isAddUnit
@[to_additive]
theorem prod_isUnit_iff {Ξ± : Type*} [CommMonoid Ξ±] {L : List Ξ±} :
IsUnit L.prod β β m β L, IsUnit m := by
refine β¨fun h => ?_, prod_isUnitβ©
induction' L with m L ih
Β· exact fun m' h' => False.elim (not_mem_nil m' h')
rw [prod_cons, IsUnit.mul_iff] at h
exact fun m' h' => Or.elim (eq_or_mem_of_mem_cons h') (fun H => H.substr h.1) fun H => ih h.2 _ H
#align list.prod_is_unit_iff List.prod_isUnit_iff
#align list.sum_is_add_unit_iff List.sum_isAddUnit_iff
@[to_additive (attr := simp)]
theorem prod_take_mul_prod_drop : β (L : List M) (i : β), (L.take i).prod * (L.drop i).prod = L.prod
| [], i => by simp [Nat.zero_le]
| L, 0 => by simp
| h :: t, n + 1 => by
dsimp
rw [prod_cons, prod_cons, mul_assoc, prod_take_mul_prod_drop t]
#align list.prod_take_mul_prod_drop List.prod_take_mul_prod_drop
#align list.sum_take_add_sum_drop List.sum_take_add_sum_drop
@[to_additive (attr := simp)]
theorem prod_take_succ :
β (L : List M) (i : β) (p), (L.take (i + 1)).prod = (L.take i).prod * L.get β¨i, pβ©
| [], i, p => by cases p
| h :: t, 0, _ => rfl
| h :: t, n + 1, p => by
dsimp
rw [prod_cons, prod_cons, prod_take_succ t n (Nat.lt_of_succ_lt_succ p), mul_assoc]
#align list.prod_take_succ List.prod_take_succ
#align list.sum_take_succ List.sum_take_succ
@[to_additive "A list with sum not zero must have positive length."]
theorem length_pos_of_prod_ne_one (L : List M) (h : L.prod β 1) : 0 < L.length := by
cases L
Β· simp at h
Β· simp
#align list.length_pos_of_prod_ne_one List.length_pos_of_prod_ne_one
#align list.length_pos_of_sum_ne_zero List.length_pos_of_sum_ne_zero
@[to_additive length_pos_of_sum_pos "A list with positive sum must have positive length."]
theorem length_pos_of_one_lt_prod [Preorder M] (L : List M) (h : 1 < L.prod) : 0 < L.length :=
length_pos_of_prod_ne_one L h.ne'
#align list.length_pos_of_one_lt_prod List.length_pos_of_one_lt_prod
#align list.length_pos_of_sum_pos List.length_pos_of_sum_pos
@[to_additive "A list with negative sum must have positive length."]
theorem length_pos_of_prod_lt_one [Preorder M] (L : List M) (h : L.prod < 1) : 0 < L.length :=
length_pos_of_prod_ne_one L h.ne
#align list.length_pos_of_prod_lt_one List.length_pos_of_prod_lt_one
#align list.length_pos_of_sum_neg List.length_pos_of_sum_neg
@[to_additive]
theorem prod_set :
β (L : List M) (n : β) (a : M),
(L.set n a).prod =
((L.take n).prod * if n < L.length then a else 1) * (L.drop (n + 1)).prod
| x :: xs, 0, a => by simp [set]
| x :: xs, i + 1, a => by
simp [set, prod_set xs i a, mul_assoc, Nat.succ_eq_add_one, Nat.add_lt_add_iff_right]
| [], _, _ => by simp [set, (Nat.zero_le _).not_lt, Nat.zero_le]
#align list.prod_update_nth List.prod_set
#align list.sum_update_nth List.sum_set
@[to_additive "We'd like to state this as `L.headI + L.tail.sum = L.sum`, but because `L.headI`
relies on an inhabited instance to return a garbage value on the empty list, this is not possible.
Instead, we write the statement in terms of `(L.get? 0).getD 0`."]
| Mathlib/Algebra/BigOperators/Group/List.lean | 289 | 290 | theorem get?_zero_mul_tail_prod (l : List M) : (l.get? 0).getD 1 * l.tail.prod = l.prod := by |
cases l <;> simp
|
import Mathlib.Topology.Compactness.SigmaCompact
import Mathlib.Topology.Connected.TotallyDisconnected
import Mathlib.Topology.Inseparable
#align_import topology.separation from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d"
open Function Set Filter Topology TopologicalSpace
open scoped Classical
universe u v
variable {X : Type*} {Y : Type*} [TopologicalSpace X]
section Separation
def SeparatedNhds : Set X β Set X β Prop := fun s t : Set X =>
β U V : Set X, IsOpen U β§ IsOpen V β§ s β U β§ t β V β§ Disjoint U V
#align separated_nhds SeparatedNhds
theorem separatedNhds_iff_disjoint {s t : Set X} : SeparatedNhds s t β Disjoint (πΛ’ s) (πΛ’ t) := by
simp only [(hasBasis_nhdsSet s).disjoint_iff (hasBasis_nhdsSet t), SeparatedNhds, exists_prop, β
exists_and_left, and_assoc, and_comm, and_left_comm]
#align separated_nhds_iff_disjoint separatedNhds_iff_disjoint
alias β¨SeparatedNhds.disjoint_nhdsSet, _β© := separatedNhds_iff_disjoint
class T0Space (X : Type u) [TopologicalSpace X] : Prop where
t0 : β β¦x y : Xβ¦, Inseparable x y β x = y
#align t0_space T0Space
theorem t0Space_iff_inseparable (X : Type u) [TopologicalSpace X] :
T0Space X β β x y : X, Inseparable x y β x = y :=
β¨fun β¨hβ© => h, fun h => β¨hβ©β©
#align t0_space_iff_inseparable t0Space_iff_inseparable
theorem t0Space_iff_not_inseparable (X : Type u) [TopologicalSpace X] :
T0Space X β Pairwise fun x y : X => Β¬Inseparable x y := by
simp only [t0Space_iff_inseparable, Ne, not_imp_not, Pairwise]
#align t0_space_iff_not_inseparable t0Space_iff_not_inseparable
theorem Inseparable.eq [T0Space X] {x y : X} (h : Inseparable x y) : x = y :=
T0Space.t0 h
#align inseparable.eq Inseparable.eq
protected theorem Inducing.injective [TopologicalSpace Y] [T0Space X] {f : X β Y}
(hf : Inducing f) : Injective f := fun _ _ h =>
(hf.inseparable_iff.1 <| .of_eq h).eq
#align inducing.injective Inducing.injective
protected theorem Inducing.embedding [TopologicalSpace Y] [T0Space X] {f : X β Y}
(hf : Inducing f) : Embedding f :=
β¨hf, hf.injectiveβ©
#align inducing.embedding Inducing.embedding
lemma embedding_iff_inducing [TopologicalSpace Y] [T0Space X] {f : X β Y} :
Embedding f β Inducing f :=
β¨Embedding.toInducing, Inducing.embeddingβ©
#align embedding_iff_inducing embedding_iff_inducing
theorem t0Space_iff_nhds_injective (X : Type u) [TopologicalSpace X] :
T0Space X β Injective (π : X β Filter X) :=
t0Space_iff_inseparable X
#align t0_space_iff_nhds_injective t0Space_iff_nhds_injective
theorem nhds_injective [T0Space X] : Injective (π : X β Filter X) :=
(t0Space_iff_nhds_injective X).1 βΉ_βΊ
#align nhds_injective nhds_injective
theorem inseparable_iff_eq [T0Space X] {x y : X} : Inseparable x y β x = y :=
nhds_injective.eq_iff
#align inseparable_iff_eq inseparable_iff_eq
@[simp]
theorem nhds_eq_nhds_iff [T0Space X] {a b : X} : π a = π b β a = b :=
nhds_injective.eq_iff
#align nhds_eq_nhds_iff nhds_eq_nhds_iff
@[simp]
theorem inseparable_eq_eq [T0Space X] : Inseparable = @Eq X :=
funextβ fun _ _ => propext inseparable_iff_eq
#align inseparable_eq_eq inseparable_eq_eq
theorem TopologicalSpace.IsTopologicalBasis.inseparable_iff {b : Set (Set X)}
(hb : IsTopologicalBasis b) {x y : X} : Inseparable x y β β s β b, (x β s β y β s) :=
β¨fun h s hs β¦ inseparable_iff_forall_open.1 h _ (hb.isOpen hs),
fun h β¦ hb.nhds_hasBasis.eq_of_same_basis <| by
convert hb.nhds_hasBasis using 2
exact and_congr_right (h _)β©
theorem TopologicalSpace.IsTopologicalBasis.eq_iff [T0Space X] {b : Set (Set X)}
(hb : IsTopologicalBasis b) {x y : X} : x = y β β s β b, (x β s β y β s) :=
inseparable_iff_eq.symm.trans hb.inseparable_iff
theorem t0Space_iff_exists_isOpen_xor'_mem (X : Type u) [TopologicalSpace X] :
T0Space X β Pairwise fun x y => β U : Set X, IsOpen U β§ Xor' (x β U) (y β U) := by
simp only [t0Space_iff_not_inseparable, xor_iff_not_iff, not_forall, exists_prop,
inseparable_iff_forall_open, Pairwise]
#align t0_space_iff_exists_is_open_xor_mem t0Space_iff_exists_isOpen_xor'_mem
theorem exists_isOpen_xor'_mem [T0Space X] {x y : X} (h : x β y) :
β U : Set X, IsOpen U β§ Xor' (x β U) (y β U) :=
(t0Space_iff_exists_isOpen_xor'_mem X).1 βΉ_βΊ h
#align exists_is_open_xor_mem exists_isOpen_xor'_mem
def specializationOrder (X) [TopologicalSpace X] [T0Space X] : PartialOrder X :=
{ specializationPreorder X, PartialOrder.lift (OrderDual.toDual β π) nhds_injective with }
#align specialization_order specializationOrder
instance SeparationQuotient.instT0Space : T0Space (SeparationQuotient X) :=
β¨fun x y => Quotient.inductionOnβ' x y fun _ _ h =>
SeparationQuotient.mk_eq_mk.2 <| SeparationQuotient.inducing_mk.inseparable_iff.1 hβ©
theorem minimal_nonempty_closed_subsingleton [T0Space X] {s : Set X} (hs : IsClosed s)
(hmin : β t, t β s β t.Nonempty β IsClosed t β t = s) : s.Subsingleton := by
clear Y -- Porting note: added
refine fun x hx y hy => of_not_not fun hxy => ?_
rcases exists_isOpen_xor'_mem hxy with β¨U, hUo, hUβ©
wlog h : x β U β§ y β U
Β· refine this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
cases' h with hxU hyU
have : s \ U = s := hmin (s \ U) diff_subset β¨y, hy, hyUβ© (hs.sdiff hUo)
exact (this.symm.subset hx).2 hxU
#align minimal_nonempty_closed_subsingleton minimal_nonempty_closed_subsingleton
theorem minimal_nonempty_closed_eq_singleton [T0Space X] {s : Set X} (hs : IsClosed s)
(hne : s.Nonempty) (hmin : β t, t β s β t.Nonempty β IsClosed t β t = s) : β x, s = {x} :=
exists_eq_singleton_iff_nonempty_subsingleton.2
β¨hne, minimal_nonempty_closed_subsingleton hs hminβ©
#align minimal_nonempty_closed_eq_singleton minimal_nonempty_closed_eq_singleton
theorem IsClosed.exists_closed_singleton [T0Space X] [CompactSpace X] {S : Set X}
(hS : IsClosed S) (hne : S.Nonempty) : β x : X, x β S β§ IsClosed ({x} : Set X) := by
obtain β¨V, Vsub, Vne, Vcls, hVβ© := hS.exists_minimal_nonempty_closed_subset hne
rcases minimal_nonempty_closed_eq_singleton Vcls Vne hV with β¨x, rflβ©
exact β¨x, Vsub (mem_singleton x), Vclsβ©
#align is_closed.exists_closed_singleton IsClosed.exists_closed_singleton
theorem minimal_nonempty_open_subsingleton [T0Space X] {s : Set X} (hs : IsOpen s)
(hmin : β t, t β s β t.Nonempty β IsOpen t β t = s) : s.Subsingleton := by
clear Y -- Porting note: added
refine fun x hx y hy => of_not_not fun hxy => ?_
rcases exists_isOpen_xor'_mem hxy with β¨U, hUo, hUβ©
wlog h : x β U β§ y β U
Β· exact this hs hmin y hy x hx (Ne.symm hxy) U hUo hU.symm (hU.resolve_left h)
cases' h with hxU hyU
have : s β© U = s := hmin (s β© U) inter_subset_left β¨x, hx, hxUβ© (hs.inter hUo)
exact hyU (this.symm.subset hy).2
#align minimal_nonempty_open_subsingleton minimal_nonempty_open_subsingleton
theorem minimal_nonempty_open_eq_singleton [T0Space X] {s : Set X} (hs : IsOpen s)
(hne : s.Nonempty) (hmin : β t, t β s β t.Nonempty β IsOpen t β t = s) : β x, s = {x} :=
exists_eq_singleton_iff_nonempty_subsingleton.2 β¨hne, minimal_nonempty_open_subsingleton hs hminβ©
#align minimal_nonempty_open_eq_singleton minimal_nonempty_open_eq_singleton
theorem exists_isOpen_singleton_of_isOpen_finite [T0Space X] {s : Set X} (hfin : s.Finite)
(hne : s.Nonempty) (ho : IsOpen s) : β x β s, IsOpen ({x} : Set X) := by
lift s to Finset X using hfin
induction' s using Finset.strongInductionOn with s ihs
rcases em (β t, t β s β§ t.Nonempty β§ IsOpen (t : Set X)) with (β¨t, hts, htne, htoβ© | ht)
Β· rcases ihs t hts htne hto with β¨x, hxt, hxoβ©
exact β¨x, hts.1 hxt, hxoβ©
Β· -- Porting note: was `rcases minimal_nonempty_open_eq_singleton ho hne _ with β¨x, hxβ©`
-- https://github.com/leanprover/std4/issues/116
rsuffices β¨x, hxβ© : β x, s.toSet = {x}
Β· exact β¨x, hx.symm βΈ rfl, hx βΈ hoβ©
refine minimal_nonempty_open_eq_singleton ho hne ?_
refine fun t hts htne hto => of_not_not fun hts' => ht ?_
lift t to Finset X using s.finite_toSet.subset hts
exact β¨t, ssubset_iff_subset_ne.2 β¨hts, mt Finset.coe_inj.2 hts'β©, htne, htoβ©
#align exists_open_singleton_of_open_finite exists_isOpen_singleton_of_isOpen_finite
theorem exists_open_singleton_of_finite [T0Space X] [Finite X] [Nonempty X] :
β x : X, IsOpen ({x} : Set X) :=
let β¨x, _, hβ© := exists_isOpen_singleton_of_isOpen_finite (Set.toFinite _)
univ_nonempty isOpen_univ
β¨x, hβ©
#align exists_open_singleton_of_fintype exists_open_singleton_of_finite
theorem t0Space_of_injective_of_continuous [TopologicalSpace Y] {f : X β Y}
(hf : Function.Injective f) (hf' : Continuous f) [T0Space Y] : T0Space X :=
β¨fun _ _ h => hf <| (h.map hf').eqβ©
#align t0_space_of_injective_of_continuous t0Space_of_injective_of_continuous
protected theorem Embedding.t0Space [TopologicalSpace Y] [T0Space Y] {f : X β Y}
(hf : Embedding f) : T0Space X :=
t0Space_of_injective_of_continuous hf.inj hf.continuous
#align embedding.t0_space Embedding.t0Space
instance Subtype.t0Space [T0Space X] {p : X β Prop} : T0Space (Subtype p) :=
embedding_subtype_val.t0Space
#align subtype.t0_space Subtype.t0Space
theorem t0Space_iff_or_not_mem_closure (X : Type u) [TopologicalSpace X] :
T0Space X β Pairwise fun a b : X => a β closure ({b} : Set X) β¨ b β closure ({a} : Set X) := by
simp only [t0Space_iff_not_inseparable, inseparable_iff_mem_closure, not_and_or]
#align t0_space_iff_or_not_mem_closure t0Space_iff_or_not_mem_closure
instance Prod.instT0Space [TopologicalSpace Y] [T0Space X] [T0Space Y] : T0Space (X Γ Y) :=
β¨fun _ _ h => Prod.ext (h.map continuous_fst).eq (h.map continuous_snd).eqβ©
instance Pi.instT0Space {ΞΉ : Type*} {X : ΞΉ β Type*} [β i, TopologicalSpace (X i)]
[β i, T0Space (X i)] :
T0Space (β i, X i) :=
β¨fun _ _ h => funext fun i => (h.map (continuous_apply i)).eqβ©
#align pi.t0_space Pi.instT0Space
instance ULift.instT0Space [T0Space X] : T0Space (ULift X) :=
embedding_uLift_down.t0Space
theorem T0Space.of_cover (h : β x y, Inseparable x y β β s : Set X, x β s β§ y β s β§ T0Space s) :
T0Space X := by
refine β¨fun x y hxy => ?_β©
rcases h x y hxy with β¨s, hxs, hys, hsβ©
lift x to s using hxs; lift y to s using hys
rw [β subtype_inseparable_iff] at hxy
exact congr_arg Subtype.val hxy.eq
#align t0_space.of_cover T0Space.of_cover
theorem T0Space.of_open_cover (h : β x, β s : Set X, x β s β§ IsOpen s β§ T0Space s) : T0Space X :=
T0Space.of_cover fun x _ hxy =>
let β¨s, hxs, hso, hsβ© := h x
β¨s, hxs, (hxy.mem_open_iff hso).1 hxs, hsβ©
#align t0_space.of_open_cover T0Space.of_open_cover
@[mk_iff]
class R0Space (X : Type u) [TopologicalSpace X] : Prop where
specializes_symmetric : Symmetric (Specializes : X β X β Prop)
export R0Space (specializes_symmetric)
class T1Space (X : Type u) [TopologicalSpace X] : Prop where
t1 : β x, IsClosed ({x} : Set X)
#align t1_space T1Space
theorem isClosed_singleton [T1Space X] {x : X} : IsClosed ({x} : Set X) :=
T1Space.t1 x
#align is_closed_singleton isClosed_singleton
theorem isOpen_compl_singleton [T1Space X] {x : X} : IsOpen ({x}αΆ : Set X) :=
isClosed_singleton.isOpen_compl
#align is_open_compl_singleton isOpen_compl_singleton
theorem isOpen_ne [T1Space X] {x : X} : IsOpen { y | y β x } :=
isOpen_compl_singleton
#align is_open_ne isOpen_ne
@[to_additive]
theorem Continuous.isOpen_mulSupport [T1Space X] [One X] [TopologicalSpace Y] {f : Y β X}
(hf : Continuous f) : IsOpen (mulSupport f) :=
isOpen_ne.preimage hf
#align continuous.is_open_mul_support Continuous.isOpen_mulSupport
#align continuous.is_open_support Continuous.isOpen_support
theorem Ne.nhdsWithin_compl_singleton [T1Space X] {x y : X} (h : x β y) : π[{y}αΆ] x = π x :=
isOpen_ne.nhdsWithin_eq h
#align ne.nhds_within_compl_singleton Ne.nhdsWithin_compl_singleton
theorem Ne.nhdsWithin_diff_singleton [T1Space X] {x y : X} (h : x β y) (s : Set X) :
π[s \ {y}] x = π[s] x := by
rw [diff_eq, inter_comm, nhdsWithin_inter_of_mem]
exact mem_nhdsWithin_of_mem_nhds (isOpen_ne.mem_nhds h)
#align ne.nhds_within_diff_singleton Ne.nhdsWithin_diff_singleton
lemma nhdsWithin_compl_singleton_le [T1Space X] (x y : X) : π[{x}αΆ] x β€ π[{y}αΆ] x := by
rcases eq_or_ne x y with rfl|hy
Β· exact Eq.le rfl
Β· rw [Ne.nhdsWithin_compl_singleton hy]
exact nhdsWithin_le_nhds
theorem isOpen_setOf_eventually_nhdsWithin [T1Space X] {p : X β Prop} :
IsOpen { x | βαΆ y in π[β ] x, p y } := by
refine isOpen_iff_mem_nhds.mpr fun a ha => ?_
filter_upwards [eventually_nhds_nhdsWithin.mpr ha] with b hb
rcases eq_or_ne a b with rfl | h
Β· exact hb
Β· rw [h.symm.nhdsWithin_compl_singleton] at hb
exact hb.filter_mono nhdsWithin_le_nhds
#align is_open_set_of_eventually_nhds_within isOpen_setOf_eventually_nhdsWithin
protected theorem Set.Finite.isClosed [T1Space X] {s : Set X} (hs : Set.Finite s) : IsClosed s := by
rw [β biUnion_of_singleton s]
exact hs.isClosed_biUnion fun i _ => isClosed_singleton
#align set.finite.is_closed Set.Finite.isClosed
theorem TopologicalSpace.IsTopologicalBasis.exists_mem_of_ne [T1Space X] {b : Set (Set X)}
(hb : IsTopologicalBasis b) {x y : X} (h : x β y) : β a β b, x β a β§ y β a := by
rcases hb.isOpen_iff.1 isOpen_ne x h with β¨a, ab, xa, haβ©
exact β¨a, ab, xa, fun h => ha h rflβ©
#align topological_space.is_topological_basis.exists_mem_of_ne TopologicalSpace.IsTopologicalBasis.exists_mem_of_ne
protected theorem Finset.isClosed [T1Space X] (s : Finset X) : IsClosed (s : Set X) :=
s.finite_toSet.isClosed
#align finset.is_closed Finset.isClosed
theorem t1Space_TFAE (X : Type u) [TopologicalSpace X] :
List.TFAE [T1Space X,
β x, IsClosed ({ x } : Set X),
β x, IsOpen ({ x }αΆ : Set X),
Continuous (@CofiniteTopology.of X),
β β¦x y : Xβ¦, x β y β {y}αΆ β π x,
β β¦x y : Xβ¦, x β y β β s β π x, y β s,
β β¦x y : Xβ¦, x β y β β U : Set X, IsOpen U β§ x β U β§ y β U,
β β¦x y : Xβ¦, x β y β Disjoint (π x) (pure y),
β β¦x y : Xβ¦, x β y β Disjoint (pure x) (π y),
β β¦x y : Xβ¦, x β€³ y β x = y] := by
tfae_have 1 β 2
Β· exact β¨fun h => h.1, fun h => β¨hβ©β©
tfae_have 2 β 3
Β· simp only [isOpen_compl_iff]
tfae_have 5 β 3
Β· refine forall_swap.trans ?_
simp only [isOpen_iff_mem_nhds, mem_compl_iff, mem_singleton_iff]
tfae_have 5 β 6
Β· simp only [β subset_compl_singleton_iff, exists_mem_subset_iff]
tfae_have 5 β 7
Β· simp only [(nhds_basis_opens _).mem_iff, subset_compl_singleton_iff, exists_prop, and_assoc,
and_left_comm]
tfae_have 5 β 8
Β· simp only [β principal_singleton, disjoint_principal_right]
tfae_have 8 β 9
Β· exact forall_swap.trans (by simp only [disjoint_comm, ne_comm])
tfae_have 1 β 4
Β· simp only [continuous_def, CofiniteTopology.isOpen_iff']
rintro H s (rfl | hs)
exacts [isOpen_empty, compl_compl s βΈ (@Set.Finite.isClosed _ _ H _ hs).isOpen_compl]
tfae_have 4 β 2
Β· exact fun h x => (CofiniteTopology.isClosed_iff.2 <| Or.inr (finite_singleton _)).preimage h
tfae_have 2 β 10
Β· simp only [β closure_subset_iff_isClosed, specializes_iff_mem_closure, subset_def,
mem_singleton_iff, eq_comm]
tfae_finish
#align t1_space_tfae t1Space_TFAE
theorem t1Space_iff_continuous_cofinite_of : T1Space X β Continuous (@CofiniteTopology.of X) :=
(t1Space_TFAE X).out 0 3
#align t1_space_iff_continuous_cofinite_of t1Space_iff_continuous_cofinite_of
theorem CofiniteTopology.continuous_of [T1Space X] : Continuous (@CofiniteTopology.of X) :=
t1Space_iff_continuous_cofinite_of.mp βΉ_βΊ
#align cofinite_topology.continuous_of CofiniteTopology.continuous_of
theorem t1Space_iff_exists_open :
T1Space X β Pairwise fun x y => β U : Set X, IsOpen U β§ x β U β§ y β U :=
(t1Space_TFAE X).out 0 6
#align t1_space_iff_exists_open t1Space_iff_exists_open
theorem t1Space_iff_disjoint_pure_nhds : T1Space X β β β¦x y : Xβ¦, x β y β Disjoint (pure x) (π y) :=
(t1Space_TFAE X).out 0 8
#align t1_space_iff_disjoint_pure_nhds t1Space_iff_disjoint_pure_nhds
theorem t1Space_iff_disjoint_nhds_pure : T1Space X β β β¦x y : Xβ¦, x β y β Disjoint (π x) (pure y) :=
(t1Space_TFAE X).out 0 7
#align t1_space_iff_disjoint_nhds_pure t1Space_iff_disjoint_nhds_pure
theorem t1Space_iff_specializes_imp_eq : T1Space X β β β¦x y : Xβ¦, x β€³ y β x = y :=
(t1Space_TFAE X).out 0 9
#align t1_space_iff_specializes_imp_eq t1Space_iff_specializes_imp_eq
theorem disjoint_pure_nhds [T1Space X] {x y : X} (h : x β y) : Disjoint (pure x) (π y) :=
t1Space_iff_disjoint_pure_nhds.mp βΉ_βΊ h
#align disjoint_pure_nhds disjoint_pure_nhds
theorem disjoint_nhds_pure [T1Space X] {x y : X} (h : x β y) : Disjoint (π x) (pure y) :=
t1Space_iff_disjoint_nhds_pure.mp βΉ_βΊ h
#align disjoint_nhds_pure disjoint_nhds_pure
theorem Specializes.eq [T1Space X] {x y : X} (h : x β€³ y) : x = y :=
t1Space_iff_specializes_imp_eq.1 βΉ_βΊ h
#align specializes.eq Specializes.eq
theorem specializes_iff_eq [T1Space X] {x y : X} : x β€³ y β x = y :=
β¨Specializes.eq, fun h => h βΈ specializes_rflβ©
#align specializes_iff_eq specializes_iff_eq
@[simp] theorem specializes_eq_eq [T1Space X] : (Β· β€³ Β·) = @Eq X :=
funextβ fun _ _ => propext specializes_iff_eq
#align specializes_eq_eq specializes_eq_eq
@[simp]
theorem pure_le_nhds_iff [T1Space X] {a b : X} : pure a β€ π b β a = b :=
specializes_iff_pure.symm.trans specializes_iff_eq
#align pure_le_nhds_iff pure_le_nhds_iff
@[simp]
theorem nhds_le_nhds_iff [T1Space X] {a b : X} : π a β€ π b β a = b :=
specializes_iff_eq
#align nhds_le_nhds_iff nhds_le_nhds_iff
instance (priority := 100) [T1Space X] : R0Space X where
specializes_symmetric _ _ := by rw [specializes_iff_eq, specializes_iff_eq]; exact Eq.symm
instance : T1Space (CofiniteTopology X) :=
t1Space_iff_continuous_cofinite_of.mpr continuous_id
theorem t1Space_antitone : Antitone (@T1Space X) := fun a _ h _ =>
@T1Space.mk _ a fun x => (T1Space.t1 x).mono h
#align t1_space_antitone t1Space_antitone
theorem continuousWithinAt_update_of_ne [T1Space X] [DecidableEq X] [TopologicalSpace Y] {f : X β Y}
{s : Set X} {x x' : X} {y : Y} (hne : x' β x) :
ContinuousWithinAt (Function.update f x y) s x' β ContinuousWithinAt f s x' :=
EventuallyEq.congr_continuousWithinAt
(mem_nhdsWithin_of_mem_nhds <| mem_of_superset (isOpen_ne.mem_nhds hne) fun _y' hy' =>
Function.update_noteq hy' _ _)
(Function.update_noteq hne _ _)
#align continuous_within_at_update_of_ne continuousWithinAt_update_of_ne
theorem continuousAt_update_of_ne [T1Space X] [DecidableEq X] [TopologicalSpace Y]
{f : X β Y} {x x' : X} {y : Y} (hne : x' β x) :
ContinuousAt (Function.update f x y) x' β ContinuousAt f x' := by
simp only [β continuousWithinAt_univ, continuousWithinAt_update_of_ne hne]
#align continuous_at_update_of_ne continuousAt_update_of_ne
theorem continuousOn_update_iff [T1Space X] [DecidableEq X] [TopologicalSpace Y] {f : X β Y}
{s : Set X} {x : X} {y : Y} :
ContinuousOn (Function.update f x y) s β
ContinuousOn f (s \ {x}) β§ (x β s β Tendsto f (π[s \ {x}] x) (π y)) := by
rw [ContinuousOn, β and_forall_ne x, and_comm]
refine and_congr β¨fun H z hz => ?_, fun H z hzx hzs => ?_β© (forall_congr' fun _ => ?_)
Β· specialize H z hz.2 hz.1
rw [continuousWithinAt_update_of_ne hz.2] at H
exact H.mono diff_subset
Β· rw [continuousWithinAt_update_of_ne hzx]
refine (H z β¨hzs, hzxβ©).mono_of_mem (inter_mem_nhdsWithin _ ?_)
exact isOpen_ne.mem_nhds hzx
Β· exact continuousWithinAt_update_same
#align continuous_on_update_iff continuousOn_update_iff
theorem t1Space_of_injective_of_continuous [TopologicalSpace Y] {f : X β Y}
(hf : Function.Injective f) (hf' : Continuous f) [T1Space Y] : T1Space X :=
t1Space_iff_specializes_imp_eq.2 fun _ _ h => hf (h.map hf').eq
#align t1_space_of_injective_of_continuous t1Space_of_injective_of_continuous
protected theorem Embedding.t1Space [TopologicalSpace Y] [T1Space Y] {f : X β Y}
(hf : Embedding f) : T1Space X :=
t1Space_of_injective_of_continuous hf.inj hf.continuous
#align embedding.t1_space Embedding.t1Space
instance Subtype.t1Space {X : Type u} [TopologicalSpace X] [T1Space X] {p : X β Prop} :
T1Space (Subtype p) :=
embedding_subtype_val.t1Space
#align subtype.t1_space Subtype.t1Space
instance [TopologicalSpace Y] [T1Space X] [T1Space Y] : T1Space (X Γ Y) :=
β¨fun β¨a, bβ© => @singleton_prod_singleton _ _ a b βΈ isClosed_singleton.prod isClosed_singletonβ©
instance {ΞΉ : Type*} {X : ΞΉ β Type*} [β i, TopologicalSpace (X i)] [β i, T1Space (X i)] :
T1Space (β i, X i) :=
β¨fun f => univ_pi_singleton f βΈ isClosed_set_pi fun _ _ => isClosed_singletonβ©
instance ULift.instT1Space [T1Space X] : T1Space (ULift X) :=
embedding_uLift_down.t1Space
-- see Note [lower instance priority]
instance (priority := 100) TotallyDisconnectedSpace.t1Space [h: TotallyDisconnectedSpace X] :
T1Space X := by
rw [((t1Space_TFAE X).out 0 1 :)]
intro x
rw [β totallyDisconnectedSpace_iff_connectedComponent_singleton.mp h x]
exact isClosed_connectedComponent
-- see Note [lower instance priority]
instance (priority := 100) T1Space.t0Space [T1Space X] : T0Space X :=
β¨fun _ _ h => h.specializes.eqβ©
#align t1_space.t0_space T1Space.t0Space
@[simp]
theorem compl_singleton_mem_nhds_iff [T1Space X] {x y : X} : {x}αΆ β π y β y β x :=
isOpen_compl_singleton.mem_nhds_iff
#align compl_singleton_mem_nhds_iff compl_singleton_mem_nhds_iff
theorem compl_singleton_mem_nhds [T1Space X] {x y : X} (h : y β x) : {x}αΆ β π y :=
compl_singleton_mem_nhds_iff.mpr h
#align compl_singleton_mem_nhds compl_singleton_mem_nhds
@[simp]
theorem closure_singleton [T1Space X] {x : X} : closure ({x} : Set X) = {x} :=
isClosed_singleton.closure_eq
#align closure_singleton closure_singleton
-- Porting note (#11215): TODO: the proof was `hs.induction_on (by simp) fun x => by simp`
theorem Set.Subsingleton.closure [T1Space X] {s : Set X} (hs : s.Subsingleton) :
(closure s).Subsingleton := by
rcases hs.eq_empty_or_singleton with (rfl | β¨x, rflβ©) <;> simp
#align set.subsingleton.closure Set.Subsingleton.closure
@[simp]
theorem subsingleton_closure [T1Space X] {s : Set X} : (closure s).Subsingleton β s.Subsingleton :=
β¨fun h => h.anti subset_closure, fun h => h.closureβ©
#align subsingleton_closure subsingleton_closure
theorem isClosedMap_const {X Y} [TopologicalSpace X] [TopologicalSpace Y] [T1Space Y] {y : Y} :
IsClosedMap (Function.const X y) :=
IsClosedMap.of_nonempty fun s _ h2s => by simp_rw [const, h2s.image_const, isClosed_singleton]
#align is_closed_map_const isClosedMap_const
theorem nhdsWithin_insert_of_ne [T1Space X] {x y : X} {s : Set X} (hxy : x β y) :
π[insert y s] x = π[s] x := by
refine le_antisymm (Filter.le_def.2 fun t ht => ?_) (nhdsWithin_mono x <| subset_insert y s)
obtain β¨o, ho, hxo, hostβ© := mem_nhdsWithin.mp ht
refine mem_nhdsWithin.mpr β¨o \ {y}, ho.sdiff isClosed_singleton, β¨hxo, hxyβ©, ?_β©
rw [inter_insert_of_not_mem <| not_mem_diff_of_mem (mem_singleton y)]
exact (inter_subset_inter diff_subset Subset.rfl).trans host
#align nhds_within_insert_of_ne nhdsWithin_insert_of_ne
theorem insert_mem_nhdsWithin_of_subset_insert [T1Space X] {x y : X} {s t : Set X}
(hu : t β insert y s) : insert x s β π[t] x := by
rcases eq_or_ne x y with (rfl | h)
Β· exact mem_of_superset self_mem_nhdsWithin hu
refine nhdsWithin_mono x hu ?_
rw [nhdsWithin_insert_of_ne h]
exact mem_of_superset self_mem_nhdsWithin (subset_insert x s)
#align insert_mem_nhds_within_of_subset_insert insert_mem_nhdsWithin_of_subset_insert
@[simp]
theorem ker_nhds [T1Space X] (x : X) : (π x).ker = {x} := by
simp [ker_nhds_eq_specializes]
theorem biInter_basis_nhds [T1Space X] {ΞΉ : Sort*} {p : ΞΉ β Prop} {s : ΞΉ β Set X} {x : X}
(h : (π x).HasBasis p s) : β (i) (_ : p i), s i = {x} := by
rw [β h.ker, ker_nhds]
#align bInter_basis_nhds biInter_basis_nhds
@[simp]
theorem compl_singleton_mem_nhdsSet_iff [T1Space X] {x : X} {s : Set X} : {x}αΆ β πΛ’ s β x β s := by
rw [isOpen_compl_singleton.mem_nhdsSet, subset_compl_singleton_iff]
#align compl_singleton_mem_nhds_set_iff compl_singleton_mem_nhdsSet_iff
@[simp]
theorem nhdsSet_le_iff [T1Space X] {s t : Set X} : πΛ’ s β€ πΛ’ t β s β t := by
refine β¨?_, fun h => monotone_nhdsSet hβ©
simp_rw [Filter.le_def]; intro h x hx
specialize h {x}αΆ
simp_rw [compl_singleton_mem_nhdsSet_iff] at h
by_contra hxt
exact h hxt hx
#align nhds_set_le_iff nhdsSet_le_iff
@[simp]
theorem nhdsSet_inj_iff [T1Space X] {s t : Set X} : πΛ’ s = πΛ’ t β s = t := by
simp_rw [le_antisymm_iff]
exact and_congr nhdsSet_le_iff nhdsSet_le_iff
#align nhds_set_inj_iff nhdsSet_inj_iff
theorem injective_nhdsSet [T1Space X] : Function.Injective (πΛ’ : Set X β Filter X) := fun _ _ hst =>
nhdsSet_inj_iff.mp hst
#align injective_nhds_set injective_nhdsSet
theorem strictMono_nhdsSet [T1Space X] : StrictMono (πΛ’ : Set X β Filter X) :=
monotone_nhdsSet.strictMono_of_injective injective_nhdsSet
#align strict_mono_nhds_set strictMono_nhdsSet
@[simp]
theorem nhds_le_nhdsSet_iff [T1Space X] {s : Set X} {x : X} : π x β€ πΛ’ s β x β s := by
rw [β nhdsSet_singleton, nhdsSet_le_iff, singleton_subset_iff]
#align nhds_le_nhds_set_iff nhds_le_nhdsSet_iff
theorem Dense.diff_singleton [T1Space X] {s : Set X} (hs : Dense s) (x : X) [NeBot (π[β ] x)] :
Dense (s \ {x}) :=
hs.inter_of_isOpen_right (dense_compl_singleton x) isOpen_compl_singleton
#align dense.diff_singleton Dense.diff_singleton
theorem Dense.diff_finset [T1Space X] [β x : X, NeBot (π[β ] x)] {s : Set X} (hs : Dense s)
(t : Finset X) : Dense (s \ t) := by
induction t using Finset.induction_on with
| empty => simpa using hs
| insert _ ih =>
rw [Finset.coe_insert, β union_singleton, β diff_diff]
exact ih.diff_singleton _
#align dense.diff_finset Dense.diff_finset
theorem Dense.diff_finite [T1Space X] [β x : X, NeBot (π[β ] x)] {s : Set X} (hs : Dense s)
{t : Set X} (ht : t.Finite) : Dense (s \ t) := by
convert hs.diff_finset ht.toFinset
exact (Finite.coe_toFinset _).symm
#align dense.diff_finite Dense.diff_finite
theorem eq_of_tendsto_nhds [TopologicalSpace Y] [T1Space Y] {f : X β Y} {x : X} {y : Y}
(h : Tendsto f (π x) (π y)) : f x = y :=
by_contra fun hfa : f x β y =>
have factβ : {f x}αΆ β π y := compl_singleton_mem_nhds hfa.symm
have factβ : Tendsto f (pure x) (π y) := h.comp (tendsto_id'.2 <| pure_le_nhds x)
factβ factβ (Eq.refl <| f x)
#align eq_of_tendsto_nhds eq_of_tendsto_nhds
theorem Filter.Tendsto.eventually_ne [TopologicalSpace Y] [T1Space Y] {g : X β Y}
{l : Filter X} {bβ bβ : Y} (hg : Tendsto g l (π bβ)) (hb : bβ β bβ) : βαΆ z in l, g z β bβ :=
hg.eventually (isOpen_compl_singleton.eventually_mem hb)
#align filter.tendsto.eventually_ne Filter.Tendsto.eventually_ne
theorem ContinuousAt.eventually_ne [TopologicalSpace Y] [T1Space Y] {g : X β Y} {x : X} {y : Y}
(hg1 : ContinuousAt g x) (hg2 : g x β y) : βαΆ z in π x, g z β y :=
hg1.tendsto.eventually_ne hg2
#align continuous_at.eventually_ne ContinuousAt.eventually_ne
theorem eventually_ne_nhds [T1Space X] {a b : X} (h : a β b) : βαΆ x in π a, x β b :=
IsOpen.eventually_mem isOpen_ne h
theorem eventually_ne_nhdsWithin [T1Space X] {a b : X} {s : Set X} (h : a β b) :
βαΆ x in π[s] a, x β b :=
Filter.Eventually.filter_mono nhdsWithin_le_nhds <| eventually_ne_nhds h
theorem continuousAt_of_tendsto_nhds [TopologicalSpace Y] [T1Space Y] {f : X β Y} {x : X} {y : Y}
(h : Tendsto f (π x) (π y)) : ContinuousAt f x := by
rwa [ContinuousAt, eq_of_tendsto_nhds h]
#align continuous_at_of_tendsto_nhds continuousAt_of_tendsto_nhds
@[simp]
theorem tendsto_const_nhds_iff [T1Space X] {l : Filter Y} [NeBot l] {c d : X} :
Tendsto (fun _ => c) l (π d) β c = d := by simp_rw [Tendsto, Filter.map_const, pure_le_nhds_iff]
#align tendsto_const_nhds_iff tendsto_const_nhds_iff
theorem isOpen_singleton_of_finite_mem_nhds [T1Space X] (x : X)
{s : Set X} (hs : s β π x) (hsf : s.Finite) : IsOpen ({x} : Set X) := by
have A : {x} β s := by simp only [singleton_subset_iff, mem_of_mem_nhds hs]
have B : IsClosed (s \ {x}) := (hsf.subset diff_subset).isClosed
have C : (s \ {x})αΆ β π x := B.isOpen_compl.mem_nhds fun h => h.2 rfl
have D : {x} β π x := by simpa only [β diff_eq, diff_diff_cancel_left A] using inter_mem hs C
rwa [β mem_interior_iff_mem_nhds, β singleton_subset_iff, subset_interior_iff_isOpen] at D
#align is_open_singleton_of_finite_mem_nhds isOpen_singleton_of_finite_mem_nhds
theorem infinite_of_mem_nhds {X} [TopologicalSpace X] [T1Space X] (x : X) [hx : NeBot (π[β ] x)]
{s : Set X} (hs : s β π x) : Set.Infinite s := by
refine fun hsf => hx.1 ?_
rw [β isOpen_singleton_iff_punctured_nhds]
exact isOpen_singleton_of_finite_mem_nhds x hs hsf
#align infinite_of_mem_nhds infinite_of_mem_nhds
theorem discrete_of_t1_of_finite [T1Space X] [Finite X] :
DiscreteTopology X := by
apply singletons_open_iff_discrete.mp
intro x
rw [β isClosed_compl_iff]
exact (Set.toFinite _).isClosed
#align discrete_of_t1_of_finite discrete_of_t1_of_finite
theorem PreconnectedSpace.trivial_of_discrete [PreconnectedSpace X] [DiscreteTopology X] :
Subsingleton X := by
rw [β not_nontrivial_iff_subsingleton]
rintro β¨x, y, hxyβ©
rw [Ne, β mem_singleton_iff, (isClopen_discrete _).eq_univ <| singleton_nonempty y] at hxy
exact hxy (mem_univ x)
#align preconnected_space.trivial_of_discrete PreconnectedSpace.trivial_of_discrete
theorem IsPreconnected.infinite_of_nontrivial [T1Space X] {s : Set X} (h : IsPreconnected s)
(hs : s.Nontrivial) : s.Infinite := by
refine mt (fun hf => (subsingleton_coe s).mp ?_) (not_subsingleton_iff.mpr hs)
haveI := @discrete_of_t1_of_finite s _ _ hf.to_subtype
exact @PreconnectedSpace.trivial_of_discrete _ _ (Subtype.preconnectedSpace h) _
#align is_preconnected.infinite_of_nontrivial IsPreconnected.infinite_of_nontrivial
theorem ConnectedSpace.infinite [ConnectedSpace X] [Nontrivial X] [T1Space X] : Infinite X :=
infinite_univ_iff.mp <| isPreconnected_univ.infinite_of_nontrivial nontrivial_univ
#align connected_space.infinite ConnectedSpace.infinite
instance (priority := 100) ConnectedSpace.neBot_nhdsWithin_compl_of_nontrivial_of_t1space
[ConnectedSpace X] [Nontrivial X] [T1Space X] (x : X) :
NeBot (π[β ] x) := by
by_contra contra
rw [not_neBot, β isOpen_singleton_iff_punctured_nhds] at contra
replace contra := nonempty_inter isOpen_compl_singleton
contra (compl_union_self _) (Set.nonempty_compl_of_nontrivial _) (singleton_nonempty _)
simp [compl_inter_self {x}] at contra
theorem SeparationQuotient.t1Space_iff : T1Space (SeparationQuotient X) β R0Space X := by
rw [r0Space_iff, ((t1Space_TFAE (SeparationQuotient X)).out 0 9 :)]
constructor
Β· intro h x y xspecy
rw [β Inducing.specializes_iff inducing_mk, h xspecy] at *
Β· rintro h β¨xβ© β¨yβ© sxspecsy
have xspecy : x β€³ y := (Inducing.specializes_iff inducing_mk).mp sxspecsy
have yspecx : y β€³ x := h xspecy
erw [mk_eq_mk, inseparable_iff_specializes_and]
exact β¨xspecy, yspecxβ©
theorem singleton_mem_nhdsWithin_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X}
(hx : x β s) : {x} β π[s] x := by
have : ({β¨x, hxβ©} : Set s) β π (β¨x, hxβ© : s) := by simp [nhds_discrete]
simpa only [nhdsWithin_eq_map_subtype_coe hx, image_singleton] using
@image_mem_map _ _ _ ((β) : s β X) _ this
#align singleton_mem_nhds_within_of_mem_discrete singleton_mem_nhdsWithin_of_mem_discrete
theorem nhdsWithin_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X} (hx : x β s) :
π[s] x = pure x :=
le_antisymm (le_pure_iff.2 <| singleton_mem_nhdsWithin_of_mem_discrete hx) (pure_le_nhdsWithin hx)
#align nhds_within_of_mem_discrete nhdsWithin_of_mem_discrete
theorem Filter.HasBasis.exists_inter_eq_singleton_of_mem_discrete {ΞΉ : Type*} {p : ΞΉ β Prop}
{t : ΞΉ β Set X} {s : Set X} [DiscreteTopology s] {x : X} (hb : (π x).HasBasis p t)
(hx : x β s) : β i, p i β§ t i β© s = {x} := by
rcases (nhdsWithin_hasBasis hb s).mem_iff.1 (singleton_mem_nhdsWithin_of_mem_discrete hx) with
β¨i, hi, hixβ©
exact β¨i, hi, hix.antisymm <| singleton_subset_iff.2 β¨mem_of_mem_nhds <| hb.mem_of_mem hi, hxβ©β©
#align filter.has_basis.exists_inter_eq_singleton_of_mem_discrete Filter.HasBasis.exists_inter_eq_singleton_of_mem_discrete
theorem nhds_inter_eq_singleton_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X}
(hx : x β s) : β U β π x, U β© s = {x} := by
simpa using (π x).basis_sets.exists_inter_eq_singleton_of_mem_discrete hx
#align nhds_inter_eq_singleton_of_mem_discrete nhds_inter_eq_singleton_of_mem_discrete
theorem isOpen_inter_eq_singleton_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X}
(hx : x β s) : β U : Set X, IsOpen U β§ U β© s = {x} := by
obtain β¨U, hU_nhds, hU_interβ© := nhds_inter_eq_singleton_of_mem_discrete hx
obtain β¨t, ht_sub, ht_open, ht_xβ© := mem_nhds_iff.mp hU_nhds
refine β¨t, ht_open, Set.Subset.antisymm ?_ ?_β©
Β· exact hU_inter βΈ Set.inter_subset_inter_left s ht_sub
Β· rw [Set.subset_inter_iff, Set.singleton_subset_iff, Set.singleton_subset_iff]
exact β¨ht_x, hxβ©
theorem disjoint_nhdsWithin_of_mem_discrete {s : Set X} [DiscreteTopology s] {x : X} (hx : x β s) :
β U β π[β ] x, Disjoint U s :=
let β¨V, h, h'β© := nhds_inter_eq_singleton_of_mem_discrete hx
β¨{x}αΆ β© V, inter_mem_nhdsWithin _ h,
disjoint_iff_inter_eq_empty.mpr (by rw [inter_assoc, h', compl_inter_self])β©
#align disjoint_nhds_within_of_mem_discrete disjoint_nhdsWithin_of_mem_discrete
@[deprecated embedding_inclusion (since := "2023-02-02")]
theorem TopologicalSpace.subset_trans {s t : Set X} (ts : t β s) :
(instTopologicalSpaceSubtype : TopologicalSpace t) =
(instTopologicalSpaceSubtype : TopologicalSpace s).induced (Set.inclusion ts) :=
(embedding_inclusion ts).induced
#align topological_space.subset_trans TopologicalSpace.subset_trans
@[mk_iff]
class T2Space (X : Type u) [TopologicalSpace X] : Prop where
t2 : Pairwise fun x y => β u v : Set X, IsOpen u β§ IsOpen v β§ x β u β§ y β v β§ Disjoint u v
#align t2_space T2Space
theorem t2_separation [T2Space X] {x y : X} (h : x β y) :
β u v : Set X, IsOpen u β§ IsOpen v β§ x β u β§ y β v β§ Disjoint u v :=
T2Space.t2 h
#align t2_separation t2_separation
-- todo: use this as a definition?
theorem t2Space_iff_disjoint_nhds : T2Space X β Pairwise fun x y : X => Disjoint (π x) (π y) := by
refine (t2Space_iff X).trans (forallβ_congr fun x y _ => ?_)
simp only [(nhds_basis_opens x).disjoint_iff (nhds_basis_opens y), exists_prop, β exists_and_left,
and_assoc, and_comm, and_left_comm]
#align t2_space_iff_disjoint_nhds t2Space_iff_disjoint_nhds
@[simp]
theorem disjoint_nhds_nhds [T2Space X] {x y : X} : Disjoint (π x) (π y) β x β y :=
β¨fun hd he => by simp [he, nhds_neBot.ne] at hd, (t2Space_iff_disjoint_nhds.mp βΉ_βΊ Β·)β©
#align disjoint_nhds_nhds disjoint_nhds_nhds
theorem pairwise_disjoint_nhds [T2Space X] : Pairwise (Disjoint on (π : X β Filter X)) := fun _ _ =>
disjoint_nhds_nhds.2
#align pairwise_disjoint_nhds pairwise_disjoint_nhds
protected theorem Set.pairwiseDisjoint_nhds [T2Space X] (s : Set X) : s.PairwiseDisjoint π :=
pairwise_disjoint_nhds.set_pairwise s
#align set.pairwise_disjoint_nhds Set.pairwiseDisjoint_nhds
theorem Set.Finite.t2_separation [T2Space X] {s : Set X} (hs : s.Finite) :
β U : X β Set X, (β x, x β U x β§ IsOpen (U x)) β§ s.PairwiseDisjoint U :=
s.pairwiseDisjoint_nhds.exists_mem_filter_basis hs nhds_basis_opens
#align set.finite.t2_separation Set.Finite.t2_separation
-- see Note [lower instance priority]
instance (priority := 100) T2Space.t1Space [T2Space X] : T1Space X :=
t1Space_iff_disjoint_pure_nhds.mpr fun _ _ hne =>
(disjoint_nhds_nhds.2 hne).mono_left <| pure_le_nhds _
#align t2_space.t1_space T2Space.t1Space
-- see Note [lower instance priority]
instance (priority := 100) T2Space.r1Space [T2Space X] : R1Space X :=
β¨fun x y β¦ (eq_or_ne x y).imp specializes_of_eq disjoint_nhds_nhds.2β©
theorem SeparationQuotient.t2Space_iff : T2Space (SeparationQuotient X) β R1Space X := by
simp only [t2Space_iff_disjoint_nhds, Pairwise, surjective_mk.forallβ, ne_eq, mk_eq_mk,
r1Space_iff_inseparable_or_disjoint_nhds, β disjoint_comap_iff surjective_mk, comap_mk_nhds_mk,
β or_iff_not_imp_left]
instance SeparationQuotient.t2Space [R1Space X] : T2Space (SeparationQuotient X) :=
t2Space_iff.2 βΉ_βΊ
instance (priority := 80) [R1Space X] [T0Space X] : T2Space X :=
t2Space_iff_disjoint_nhds.2 fun _x _y hne β¦ disjoint_nhds_nhds_iff_not_inseparable.2 fun hxy β¦
hne hxy.eq
theorem R1Space.t2Space_iff_t0Space [R1Space X] : T2Space X β T0Space X := by
constructor <;> intro <;> infer_instance
theorem t2_iff_nhds : T2Space X β β {x y : X}, NeBot (π x β π y) β x = y := by
simp only [t2Space_iff_disjoint_nhds, disjoint_iff, neBot_iff, Ne, not_imp_comm, Pairwise]
#align t2_iff_nhds t2_iff_nhds
theorem eq_of_nhds_neBot [T2Space X] {x y : X} (h : NeBot (π x β π y)) : x = y :=
t2_iff_nhds.mp βΉ_βΊ h
#align eq_of_nhds_ne_bot eq_of_nhds_neBot
theorem t2Space_iff_nhds :
T2Space X β Pairwise fun x y : X => β U β π x, β V β π y, Disjoint U V := by
simp only [t2Space_iff_disjoint_nhds, Filter.disjoint_iff, Pairwise]
#align t2_space_iff_nhds t2Space_iff_nhds
theorem t2_separation_nhds [T2Space X] {x y : X} (h : x β y) :
β u v, u β π x β§ v β π y β§ Disjoint u v :=
let β¨u, v, open_u, open_v, x_in, y_in, huvβ© := t2_separation h
β¨u, v, open_u.mem_nhds x_in, open_v.mem_nhds y_in, huvβ©
#align t2_separation_nhds t2_separation_nhds
theorem t2_separation_compact_nhds [LocallyCompactSpace X] [T2Space X] {x y : X} (h : x β y) :
β u v, u β π x β§ v β π y β§ IsCompact u β§ IsCompact v β§ Disjoint u v := by
simpa only [exists_prop, β exists_and_left, and_comm, and_assoc, and_left_comm] using
((compact_basis_nhds x).disjoint_iff (compact_basis_nhds y)).1 (disjoint_nhds_nhds.2 h)
#align t2_separation_compact_nhds t2_separation_compact_nhds
theorem t2_iff_ultrafilter :
T2Space X β β {x y : X} (f : Ultrafilter X), βf β€ π x β βf β€ π y β x = y :=
t2_iff_nhds.trans <| by simp only [β exists_ultrafilter_iff, and_imp, le_inf_iff, exists_imp]
#align t2_iff_ultrafilter t2_iff_ultrafilter
theorem t2_iff_isClosed_diagonal : T2Space X β IsClosed (diagonal X) := by
simp only [t2Space_iff_disjoint_nhds, β isOpen_compl_iff, isOpen_iff_mem_nhds, Prod.forall,
nhds_prod_eq, compl_diagonal_mem_prod, mem_compl_iff, mem_diagonal_iff, Pairwise]
#align t2_iff_is_closed_diagonal t2_iff_isClosed_diagonal
theorem isClosed_diagonal [T2Space X] : IsClosed (diagonal X) :=
t2_iff_isClosed_diagonal.mp βΉ_βΊ
#align is_closed_diagonal isClosed_diagonal
-- Porting note: 2 lemmas moved below
theorem tendsto_nhds_unique [T2Space X] {f : Y β X} {l : Filter Y} {a b : X} [NeBot l]
(ha : Tendsto f l (π a)) (hb : Tendsto f l (π b)) : a = b :=
eq_of_nhds_neBot <| neBot_of_le <| le_inf ha hb
#align tendsto_nhds_unique tendsto_nhds_unique
theorem tendsto_nhds_unique' [T2Space X] {f : Y β X} {l : Filter Y} {a b : X} (_ : NeBot l)
(ha : Tendsto f l (π a)) (hb : Tendsto f l (π b)) : a = b :=
eq_of_nhds_neBot <| neBot_of_le <| le_inf ha hb
#align tendsto_nhds_unique' tendsto_nhds_unique'
theorem tendsto_nhds_unique_of_eventuallyEq [T2Space X] {f g : Y β X} {l : Filter Y} {a b : X}
[NeBot l] (ha : Tendsto f l (π a)) (hb : Tendsto g l (π b)) (hfg : f =αΆ [l] g) : a = b :=
tendsto_nhds_unique (ha.congr' hfg) hb
#align tendsto_nhds_unique_of_eventually_eq tendsto_nhds_unique_of_eventuallyEq
theorem tendsto_nhds_unique_of_frequently_eq [T2Space X] {f g : Y β X} {l : Filter Y} {a b : X}
(ha : Tendsto f l (π a)) (hb : Tendsto g l (π b)) (hfg : βαΆ x in l, f x = g x) : a = b :=
have : βαΆ z : X Γ X in π (a, b), z.1 = z.2 := (ha.prod_mk_nhds hb).frequently hfg
not_not.1 fun hne => this (isClosed_diagonal.isOpen_compl.mem_nhds hne)
#align tendsto_nhds_unique_of_frequently_eq tendsto_nhds_unique_of_frequently_eq
theorem IsCompact.nhdsSet_inter_eq [T2Space X] {s t : Set X} (hs : IsCompact s) (ht : IsCompact t) :
πΛ’ (s β© t) = πΛ’ s β πΛ’ t := by
refine le_antisymm (nhdsSet_inter_le _ _) ?_
simp_rw [hs.nhdsSet_inf_eq_biSup, ht.inf_nhdsSet_eq_biSup, nhdsSet, sSup_image]
refine iSupβ_le fun x hxs β¦ iSupβ_le fun y hyt β¦ ?_
rcases eq_or_ne x y with (rfl|hne)
Β· exact le_iSupβ_of_le x β¨hxs, hytβ© (inf_idem _).le
Β· exact (disjoint_nhds_nhds.mpr hne).eq_bot βΈ bot_le
theorem Set.InjOn.exists_mem_nhdsSet {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
[T2Space Y] {f : X β Y} {s : Set X} (inj : InjOn f s) (sc : IsCompact s)
(fc : β x β s, ContinuousAt f x) (loc : β x β s, β u β π x, InjOn f u) :
β t β πΛ’ s, InjOn f t := by
have : β x β s ΓΛ’ s, βαΆ y in π x, f y.1 = f y.2 β y.1 = y.2 := fun (x, y) β¨hx, hyβ© β¦ by
rcases eq_or_ne x y with rfl | hne
Β· rcases loc x hx with β¨u, hu, hfβ©
exact Filter.mem_of_superset (prod_mem_nhds hu hu) <| forall_prod_set.2 hf
Β· suffices βαΆ z in π (x, y), f z.1 β f z.2 from this.mono fun _ hne h β¦ absurd h hne
refine (fc x hx).prod_map' (fc y hy) <| isClosed_diagonal.isOpen_compl.mem_nhds ?_
exact inj.ne hx hy hne
rw [β eventually_nhdsSet_iff_forall, sc.nhdsSet_prod_eq sc] at this
exact eventually_prod_self_iff.1 this
theorem Set.InjOn.exists_isOpen_superset {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y]
[T2Space Y] {f : X β Y} {s : Set X} (inj : InjOn f s) (sc : IsCompact s)
(fc : β x β s, ContinuousAt f x) (loc : β x β s, β u β π x, InjOn f u) :
β t, IsOpen t β§ s β t β§ InjOn f t :=
let β¨_t, hst, htβ© := inj.exists_mem_nhdsSet sc fc loc
let β¨u, huo, hsu, hutβ© := mem_nhdsSet_iff_exists.1 hst
β¨u, huo, hsu, ht.mono hutβ©
section limUnder
variable [T2Space X] {f : Filter X}
theorem lim_eq {x : X} [NeBot f] (h : f β€ π x) : @lim _ _ β¨xβ© f = x :=
tendsto_nhds_unique (le_nhds_lim β¨x, hβ©) h
set_option linter.uppercaseLean3 false in
#align Lim_eq lim_eq
theorem lim_eq_iff [NeBot f] (h : β x : X, f β€ π x) {x} : @lim _ _ β¨xβ© f = x β f β€ π x :=
β¨fun c => c βΈ le_nhds_lim h, lim_eqβ©
set_option linter.uppercaseLean3 false in
#align Lim_eq_iff lim_eq_iff
theorem Ultrafilter.lim_eq_iff_le_nhds [CompactSpace X] {x : X} {F : Ultrafilter X} :
F.lim = x β βF β€ π x :=
β¨fun h => h βΈ F.le_nhds_lim, lim_eqβ©
set_option linter.uppercaseLean3 false in
#align ultrafilter.Lim_eq_iff_le_nhds Ultrafilter.lim_eq_iff_le_nhds
| Mathlib/Topology/Separation.lean | 1,495 | 1,501 | theorem isOpen_iff_ultrafilter' [CompactSpace X] (U : Set X) :
IsOpen U β β F : Ultrafilter X, F.lim β U β U β F.1 := by |
rw [isOpen_iff_ultrafilter]
refine β¨fun h F hF => h F.lim hF F F.le_nhds_lim, ?_β©
intro cond x hx f h
rw [β Ultrafilter.lim_eq_iff_le_nhds.2 h] at hx
exact cond _ hx
|
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.SetLike.Fintype
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.PGroup
import Mathlib.GroupTheory.NoncommPiCoprod
import Mathlib.Order.Atoms.Finite
import Mathlib.Data.Set.Lattice
#align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
open Fintype MulAction Subgroup
section InfiniteSylow
variable (p : β) (G : Type*) [Group G]
structure Sylow extends Subgroup G where
isPGroup' : IsPGroup p toSubgroup
is_maximal' : β {Q : Subgroup G}, IsPGroup p Q β toSubgroup β€ Q β Q = toSubgroup
#align sylow Sylow
variable {p} {G}
open Equiv Equiv.Perm Finset Function List QuotientGroup
universe u v w
variable {G : Type u} {Ξ± : Type v} {Ξ² : Type w} [Group G]
attribute [local instance 10] Subtype.fintype setFintype Classical.propDecidable
theorem QuotientGroup.card_preimage_mk [Fintype G] (s : Subgroup G) (t : Set (G β§Έ s)) :
Fintype.card (QuotientGroup.mk β»ΒΉ' t) = Fintype.card s * Fintype.card t := by
rw [β Fintype.card_prod, Fintype.card_congr (preimageMkEquivSubgroupProdSet _ _)]
#align quotient_group.card_preimage_mk QuotientGroup.card_preimage_mk
namespace Sylow
theorem mem_fixedPoints_mul_left_cosets_iff_mem_normalizer {H : Subgroup G} [Finite (H : Set G)]
{x : G} : (x : G β§Έ H) β MulAction.fixedPoints H (G β§Έ H) β x β normalizer H :=
β¨fun hx =>
have ha : β {y : G β§Έ H}, y β orbit H (x : G β§Έ H) β y = x := mem_fixedPoints'.1 hx _
(inv_mem_iff (G := G)).1
(mem_normalizer_fintype fun n (hn : n β H) =>
have : (nβ»ΒΉ * x)β»ΒΉ * x β H := QuotientGroup.eq.1 (ha β¨β¨nβ»ΒΉ, inv_mem hnβ©, rflβ©)
show _ β H by
rw [mul_inv_rev, inv_inv] at this
convert this
rw [inv_inv]),
fun hx : β n : G, n β H β x * n * xβ»ΒΉ β H =>
mem_fixedPoints'.2 fun y =>
Quotient.inductionOn' y fun y hy =>
QuotientGroup.eq.2
(let β¨β¨b, hbββ©, hbββ© := hy
have hbβ : (b * x)β»ΒΉ * y β H := QuotientGroup.eq.1 hbβ
(inv_mem_iff (G := G)).1 <|
(hx _).2 <|
(mul_mem_cancel_left (inv_mem hbβ)).1 <| by
rw [hx] at hbβ; simpa [mul_inv_rev, mul_assoc] using hbβ)β©
#align sylow.mem_fixed_points_mul_left_cosets_iff_mem_normalizer Sylow.mem_fixedPoints_mul_left_cosets_iff_mem_normalizer
def fixedPointsMulLeftCosetsEquivQuotient (H : Subgroup G) [Finite (H : Set G)] :
MulAction.fixedPoints H (G β§Έ H) β
normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H :=
@subtypeQuotientEquivQuotientSubtype G (normalizer H : Set G) (_) (_)
(MulAction.fixedPoints H (G β§Έ H))
(fun a => (@mem_fixedPoints_mul_left_cosets_iff_mem_normalizer _ _ _ βΉ_βΊ _).symm)
(by
intros
unfold_projs
rw [leftRel_apply (Ξ± := normalizer H), leftRel_apply]
rfl)
#align sylow.fixed_points_mul_left_cosets_equiv_quotient Sylow.fixedPointsMulLeftCosetsEquivQuotient
theorem card_quotient_normalizer_modEq_card_quotient [Fintype G] {p : β} {n : β} [hp : Fact p.Prime]
{H : Subgroup G} (hH : Fintype.card H = p ^ n) :
Fintype.card (normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H) β‘
card (G β§Έ H) [MOD p] := by
rw [β Fintype.card_congr (fixedPointsMulLeftCosetsEquivQuotient H)]
exact ((IsPGroup.of_card hH).card_modEq_card_fixedPoints _).symm
#align sylow.card_quotient_normalizer_modeq_card_quotient Sylow.card_quotient_normalizer_modEq_card_quotient
| Mathlib/GroupTheory/Sylow.lean | 548 | 556 | theorem card_normalizer_modEq_card [Fintype G] {p : β} {n : β} [hp : Fact p.Prime] {H : Subgroup G}
(hH : Fintype.card H = p ^ n) : card (normalizer H) β‘ card G [MOD p ^ (n + 1)] := by |
have : H.subgroupOf (normalizer H) β H := (subgroupOfEquivOfLe le_normalizer).toEquiv
simp only [β Nat.card_eq_fintype_card] at hH β’
rw [card_eq_card_quotient_mul_card_subgroup H,
card_eq_card_quotient_mul_card_subgroup (H.subgroupOf (normalizer H)), Nat.card_congr this,
hH, pow_succ']
simp only [Nat.card_eq_fintype_card] at hH β’
exact (card_quotient_normalizer_modEq_card_quotient hH).mul_right' _
|
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Algebra.Ring.Int
import Mathlib.Data.Nat.Factorial.Basic
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Order.Bounds.Basic
#align_import data.nat.prime from "leanprover-community/mathlib"@"8631e2d5ea77f6c13054d9151d82b83069680cb1"
open Bool Subtype
open Nat
namespace Nat
variable {n : β}
-- Porting note (#11180): removed @[pp_nodot]
def Prime (p : β) :=
Irreducible p
#align nat.prime Nat.Prime
theorem irreducible_iff_nat_prime (a : β) : Irreducible a β Nat.Prime a :=
Iff.rfl
#align irreducible_iff_nat_prime Nat.irreducible_iff_nat_prime
@[aesop safe destruct] theorem not_prime_zero : Β¬Prime 0
| h => h.ne_zero rfl
#align nat.not_prime_zero Nat.not_prime_zero
@[aesop safe destruct] theorem not_prime_one : Β¬Prime 1
| h => h.ne_one rfl
#align nat.not_prime_one Nat.not_prime_one
theorem Prime.ne_zero {n : β} (h : Prime n) : n β 0 :=
Irreducible.ne_zero h
#align nat.prime.ne_zero Nat.Prime.ne_zero
theorem Prime.pos {p : β} (pp : Prime p) : 0 < p :=
Nat.pos_of_ne_zero pp.ne_zero
#align nat.prime.pos Nat.Prime.pos
theorem Prime.two_le : β {p : β}, Prime p β 2 β€ p
| 0, h => (not_prime_zero h).elim
| 1, h => (not_prime_one h).elim
| _ + 2, _ => le_add_self
#align nat.prime.two_le Nat.Prime.two_le
theorem Prime.one_lt {p : β} : Prime p β 1 < p :=
Prime.two_le
#align nat.prime.one_lt Nat.Prime.one_lt
lemma Prime.one_le {p : β} (hp : p.Prime) : 1 β€ p := hp.one_lt.le
instance Prime.one_lt' (p : β) [hp : Fact p.Prime] : Fact (1 < p) :=
β¨hp.1.one_ltβ©
#align nat.prime.one_lt' Nat.Prime.one_lt'
theorem Prime.ne_one {p : β} (hp : p.Prime) : p β 1 :=
hp.one_lt.ne'
#align nat.prime.ne_one Nat.Prime.ne_one
theorem Prime.eq_one_or_self_of_dvd {p : β} (pp : p.Prime) (m : β) (hm : m β£ p) :
m = 1 β¨ m = p := by
obtain β¨n, hnβ© := hm
have := pp.isUnit_or_isUnit hn
rw [Nat.isUnit_iff, Nat.isUnit_iff] at this
apply Or.imp_right _ this
rintro rfl
rw [hn, mul_one]
#align nat.prime.eq_one_or_self_of_dvd Nat.Prime.eq_one_or_self_of_dvd
theorem prime_def_lt'' {p : β} : Prime p β 2 β€ p β§ β m, m β£ p β m = 1 β¨ m = p := by
refine β¨fun h => β¨h.two_le, h.eq_one_or_self_of_dvdβ©, fun h => ?_β©
-- Porting note: needed to make β explicit
have h1 := (@one_lt_two β ..).trans_le h.1
refine β¨mt Nat.isUnit_iff.mp h1.ne', fun a b hab => ?_β©
simp only [Nat.isUnit_iff]
apply Or.imp_right _ (h.2 a _)
Β· rintro rfl
rw [β mul_right_inj' (pos_of_gt h1).ne', β hab, mul_one]
Β· rw [hab]
exact dvd_mul_right _ _
#align nat.prime_def_lt'' Nat.prime_def_lt''
theorem prime_def_lt {p : β} : Prime p β 2 β€ p β§ β m < p, m β£ p β m = 1 :=
prime_def_lt''.trans <|
and_congr_right fun p2 =>
forall_congr' fun _ =>
β¨fun h l d => (h d).resolve_right (ne_of_lt l), fun h d =>
(le_of_dvd (le_of_succ_le p2) d).lt_or_eq_dec.imp_left fun l => h l dβ©
#align nat.prime_def_lt Nat.prime_def_lt
theorem prime_def_lt' {p : β} : Prime p β 2 β€ p β§ β m, 2 β€ m β m < p β Β¬m β£ p :=
prime_def_lt.trans <|
and_congr_right fun p2 =>
forall_congr' fun m =>
β¨fun h m2 l d => not_lt_of_ge m2 ((h l d).symm βΈ by decide), fun h l d => by
rcases m with (_ | _ | m)
Β· rw [eq_zero_of_zero_dvd d] at p2
revert p2
decide
Β· rfl
Β· exact (h le_add_self l).elim dβ©
#align nat.prime_def_lt' Nat.prime_def_lt'
theorem prime_def_le_sqrt {p : β} : Prime p β 2 β€ p β§ β m, 2 β€ m β m β€ sqrt p β Β¬m β£ p :=
prime_def_lt'.trans <|
and_congr_right fun p2 =>
β¨fun a m m2 l => a m m2 <| lt_of_le_of_lt l <| sqrt_lt_self p2, fun a =>
have : β {m k : β}, m β€ k β 1 < m β p β m * k := fun {m k} mk m1 e =>
a m m1 (le_sqrt.2 (e.symm βΈ Nat.mul_le_mul_left m mk)) β¨k, eβ©
fun m m2 l β¨k, eβ© => by
rcases le_total m k with mk | km
Β· exact this mk m2 e
Β· rw [mul_comm] at e
refine this km (lt_of_mul_lt_mul_right ?_ (zero_le m)) e
rwa [one_mul, β e]β©
#align nat.prime_def_le_sqrt Nat.prime_def_le_sqrt
theorem prime_of_coprime (n : β) (h1 : 1 < n) (h : β m < n, m β 0 β n.Coprime m) : Prime n := by
refine prime_def_lt.mpr β¨h1, fun m mlt mdvd => ?_β©
have hm : m β 0 := by
rintro rfl
rw [zero_dvd_iff] at mdvd
exact mlt.ne' mdvd
exact (h m mlt hm).symm.eq_one_of_dvd mdvd
#align nat.prime_of_coprime Nat.prime_of_coprime
section
@[local instance]
def decidablePrime1 (p : β) : Decidable (Prime p) :=
decidable_of_iff' _ prime_def_lt'
#align nat.decidable_prime_1 Nat.decidablePrime1
theorem prime_two : Prime 2 := by decide
#align nat.prime_two Nat.prime_two
theorem prime_three : Prime 3 := by decide
#align nat.prime_three Nat.prime_three
theorem prime_five : Prime 5 := by decide
theorem Prime.five_le_of_ne_two_of_ne_three {p : β} (hp : p.Prime) (h_two : p β 2)
(h_three : p β 3) : 5 β€ p := by
by_contra! h
revert h_two h_three hp
-- Porting note (#11043): was `decide!`
match p with
| 0 => decide
| 1 => decide
| 2 => decide
| 3 => decide
| 4 => decide
| n + 5 => exact (h.not_le le_add_self).elim
#align nat.prime.five_le_of_ne_two_of_ne_three Nat.Prime.five_le_of_ne_two_of_ne_three
end
theorem Prime.pred_pos {p : β} (pp : Prime p) : 0 < pred p :=
lt_pred_iff.2 pp.one_lt
#align nat.prime.pred_pos Nat.Prime.pred_pos
theorem succ_pred_prime {p : β} (pp : Prime p) : succ (pred p) = p :=
succ_pred_eq_of_pos pp.pos
#align nat.succ_pred_prime Nat.succ_pred_prime
theorem dvd_prime {p m : β} (pp : Prime p) : m β£ p β m = 1 β¨ m = p :=
β¨fun d => pp.eq_one_or_self_of_dvd m d, fun h =>
h.elim (fun e => e.symm βΈ one_dvd _) fun e => e.symm βΈ dvd_rflβ©
#align nat.dvd_prime Nat.dvd_prime
theorem dvd_prime_two_le {p m : β} (pp : Prime p) (H : 2 β€ m) : m β£ p β m = p :=
(dvd_prime pp).trans <| or_iff_right_of_imp <| Not.elim <| ne_of_gt H
#align nat.dvd_prime_two_le Nat.dvd_prime_two_le
theorem prime_dvd_prime_iff_eq {p q : β} (pp : p.Prime) (qp : q.Prime) : p β£ q β p = q :=
dvd_prime_two_le qp (Prime.two_le pp)
#align nat.prime_dvd_prime_iff_eq Nat.prime_dvd_prime_iff_eq
theorem Prime.not_dvd_one {p : β} (pp : Prime p) : Β¬p β£ 1 :=
Irreducible.not_dvd_one pp
#align nat.prime.not_dvd_one Nat.Prime.not_dvd_one
theorem prime_mul_iff {a b : β} : Nat.Prime (a * b) β a.Prime β§ b = 1 β¨ b.Prime β§ a = 1 := by
simp only [iff_self_iff, irreducible_mul_iff, β irreducible_iff_nat_prime, Nat.isUnit_iff]
#align nat.prime_mul_iff Nat.prime_mul_iff
theorem not_prime_mul {a b : β} (a1 : a β 1) (b1 : b β 1) : Β¬Prime (a * b) := by
simp [prime_mul_iff, _root_.not_or, *]
#align nat.not_prime_mul Nat.not_prime_mul
theorem not_prime_mul' {a b n : β} (h : a * b = n) (hβ : a β 1) (hβ : b β 1) : Β¬Prime n :=
h βΈ not_prime_mul hβ hβ
#align nat.not_prime_mul' Nat.not_prime_mul'
theorem Prime.dvd_iff_eq {p a : β} (hp : p.Prime) (a1 : a β 1) : a β£ p β p = a := by
refine β¨?_, by rintro rfl; rflβ©
rintro β¨j, rflβ©
rcases prime_mul_iff.mp hp with (β¨_, rflβ© | β¨_, rflβ©)
Β· exact mul_one _
Β· exact (a1 rfl).elim
#align nat.prime.dvd_iff_eq Nat.Prime.dvd_iff_eq
section MinFac
theorem minFac_lemma (n k : β) (h : Β¬n < k * k) : sqrt n - k < sqrt n + 2 - k :=
(tsub_lt_tsub_iff_right <| le_sqrt.2 <| le_of_not_gt h).2 <| Nat.lt_add_of_pos_right (by decide)
#align nat.min_fac_lemma Nat.minFac_lemma
@[semireducible] def minFacAux (n : β) : β β β
| k =>
if n < k * k then n
else
if k β£ n then k
else
minFacAux n (k + 2)
termination_by k => sqrt n + 2 - k
decreasing_by simp_wf; apply minFac_lemma n k; assumption
#align nat.min_fac_aux Nat.minFacAux
def minFac (n : β) : β :=
if 2 β£ n then 2 else minFacAux n 3
#align nat.min_fac Nat.minFac
@[simp]
theorem minFac_zero : minFac 0 = 2 :=
rfl
#align nat.min_fac_zero Nat.minFac_zero
@[simp]
theorem minFac_one : minFac 1 = 1 := by
simp [minFac, minFacAux]
#align nat.min_fac_one Nat.minFac_one
@[simp]
theorem minFac_two : minFac 2 = 2 := by
simp [minFac, minFacAux]
theorem minFac_eq (n : β) : minFac n = if 2 β£ n then 2 else minFacAux n 3 := rfl
#align nat.min_fac_eq Nat.minFac_eq
private def minFacProp (n k : β) :=
2 β€ k β§ k β£ n β§ β m, 2 β€ m β m β£ n β k β€ m
theorem minFacAux_has_prop {n : β} (n2 : 2 β€ n) :
β k i, k = 2 * i + 3 β (β m, 2 β€ m β m β£ n β k β€ m) β minFacProp n (minFacAux n k)
| k => fun i e a => by
rw [minFacAux]
by_cases h : n < k * k <;> simp [h]
Β· have pp : Prime n :=
prime_def_le_sqrt.2
β¨n2, fun m m2 l d => not_lt_of_ge l <| lt_of_lt_of_le (sqrt_lt.2 h) (a m m2 d)β©
exact β¨n2, dvd_rfl, fun m m2 d => le_of_eq ((dvd_prime_two_le pp m2).1 d).symmβ©
have k2 : 2 β€ k := by
subst e
apply Nat.le_add_left
by_cases dk : k β£ n <;> simp [dk]
Β· exact β¨k2, dk, aβ©
Β· refine
have := minFac_lemma n k h
minFacAux_has_prop n2 (k + 2) (i + 1) (by simp [k, e, left_distrib, add_right_comm])
fun m m2 d => ?_
rcases Nat.eq_or_lt_of_le (a m m2 d) with me | ml
Β· subst me
contradiction
apply (Nat.eq_or_lt_of_le ml).resolve_left
intro me
rw [β me, e] at d
have d' : 2 * (i + 2) β£ n := d
have := a _ le_rfl (dvd_of_mul_right_dvd d')
rw [e] at this
exact absurd this (by contradiction)
termination_by k => sqrt n + 2 - k
#align nat.min_fac_aux_has_prop Nat.minFacAux_has_prop
| Mathlib/Data/Nat/Prime.lean | 324 | 335 | theorem minFac_has_prop {n : β} (n1 : n β 1) : minFacProp n (minFac n) := by |
by_cases n0 : n = 0
Β· simp [n0, minFacProp, GE.ge]
have n2 : 2 β€ n := by
revert n0 n1
rcases n with (_ | _ | _) <;> simp [succ_le_succ]
simp only [minFac_eq, Nat.isUnit_iff]
by_cases d2 : 2 β£ n <;> simp [d2]
Β· exact β¨le_rfl, d2, fun k k2 _ => k2β©
Β· refine
minFacAux_has_prop n2 3 0 rfl fun m m2 d => (Nat.eq_or_lt_of_le m2).resolve_left (mt ?_ d2)
exact fun e => e.symm βΈ d
|
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.RingTheory.Prime
import Mathlib.RingTheory.Polynomial.Content
import Mathlib.RingTheory.Ideal.Quotient
#align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff"
open Polynomial Ideal.Quotient
variable {R : Type*} [CommRing R]
namespace Polynomial
open Polynomial
namespace EisensteinCriterionAux
-- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion`
theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R}
(hfP : β n : β, βn < f.degree β f.coeff n β P) :
map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree :=
Polynomial.ext fun n => by
by_cases hf0 : f = 0
Β· simp [hf0]
rcases lt_trichotomy (n : WithBot β) (degree f) with (h | h | h)
Β· erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg,
mul_zero]
rintro rfl
exact not_lt_of_ge degree_le_natDegree h
Β· have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm
rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map]
Β· rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt]
Β· refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_
rwa [β degree_eq_natDegree hf0]
Β· exact lt_of_le_of_lt (degree_map_le _ _) h
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem
theorem le_natDegree_of_map_eq_mul_X_pow {n : β} {P : Ideal R} (hP : P.IsPrime) {q : R[X]}
{c : Polynomial (R β§Έ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) :
n β€ q.natDegree :=
Nat.cast_le.1
(calc
βn = degree (q.map (mk P)) := by
rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one]
_ β€ degree q := degree_map_le _ _
_ β€ natDegree q := degree_le_natDegree
)
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow
theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : β} {P : Ideal R} {q : R[X]}
{c : Polynomial (R β§Έ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n β 0) : eval 0 q β P := by
rw [β coeff_zero_eq_eval_zero, β eq_zero_iff_mem, β coeff_map, hq,
coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.eval_zero_mem_ideal_of_eq_mul_X_pow Polynomial.EisensteinCriterionAux.eval_zero_mem_ideal_of_eq_mul_X_pow
| Mathlib/RingTheory/EisensteinCriterion.lean | 72 | 78 | theorem isUnit_of_natDegree_eq_zero_of_isPrimitive {p q : R[X]}
-- Porting note: stated using `IsPrimitive` which is defeq to old statement.
(hu : IsPrimitive (p * q)) (hpm : p.natDegree = 0) : IsUnit p := by |
rw [eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm), isUnit_C]
refine hu _ ?_
rw [β eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm)]
exact dvd_mul_right _ _
|
import Mathlib.Order.Filter.Interval
import Mathlib.Order.Interval.Set.Pi
import Mathlib.Tactic.TFAE
import Mathlib.Tactic.NormNum
import Mathlib.Topology.Order.LeftRight
import Mathlib.Topology.Order.OrderClosed
#align_import topology.order.basic from "leanprover-community/mathlib"@"3efd324a3a31eaa40c9d5bfc669c4fafee5f9423"
open Set Filter TopologicalSpace Topology Function
open OrderDual (toDual ofDual)
universe u v w
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w}
-- Porting note (#11215): TODO: define `Preorder.topology` before `OrderTopology` and reuse the def
class OrderTopology (Ξ± : Type*) [t : TopologicalSpace Ξ±] [Preorder Ξ±] : Prop where
topology_eq_generate_intervals : t = generateFrom { s | β a, s = Ioi a β¨ s = Iio a }
#align order_topology OrderTopology
def Preorder.topology (Ξ± : Type*) [Preorder Ξ±] : TopologicalSpace Ξ± :=
generateFrom { s : Set Ξ± | β a : Ξ±, s = { b : Ξ± | a < b } β¨ s = { b : Ξ± | b < a } }
#align preorder.topology Preorder.topology
section OrderTopology
instance tendstoIxxNhdsWithin {Ξ± : Type*} [TopologicalSpace Ξ±] (a : Ξ±) {s t : Set Ξ±}
{Ixx} [TendstoIxxClass Ixx (π a) (π a)] [TendstoIxxClass Ixx (π s) (π t)] :
TendstoIxxClass Ixx (π[s] a) (π[t] a) :=
Filter.tendstoIxxClass_inf
#align tendsto_Ixx_nhds_within tendstoIxxNhdsWithin
instance tendstoIccClassNhdsPi {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, Preorder (Ξ± i)]
[β i, TopologicalSpace (Ξ± i)] [β i, OrderTopology (Ξ± i)] (f : β i, Ξ± i) :
TendstoIxxClass Icc (π f) (π f) := by
constructor
conv in (π f).smallSets => rw [nhds_pi, Filter.pi]
simp only [smallSets_iInf, smallSets_comap_eq_comap_image, tendsto_iInf, tendsto_comap_iff]
intro i
have : Tendsto (fun g : β i, Ξ± i => g i) (π f) (π (f i)) := (continuous_apply i).tendsto f
refine (this.comp tendsto_fst).Icc (this.comp tendsto_snd) |>.smallSets_mono ?_
filter_upwards [] using fun β¨f, gβ© β¦ image_subset_iff.mpr fun p hp β¦ β¨hp.1 i, hp.2 iβ©
#align tendsto_Icc_class_nhds_pi tendstoIccClassNhdsPi
-- Porting note (#10756): new lemma
theorem induced_topology_le_preorder [Preorder Ξ±] [Preorder Ξ²] [TopologicalSpace Ξ²]
[OrderTopology Ξ²] {f : Ξ± β Ξ²} (hf : β {x y}, f x < f y β x < y) :
induced f βΉTopologicalSpace Ξ²βΊ β€ Preorder.topology Ξ± := by
let _ := Preorder.topology Ξ±; have : OrderTopology Ξ± := β¨rflβ©
refine le_of_nhds_le_nhds fun x => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal, Ioi, Iio, β hf]
refine inf_le_inf (le_iInfβ fun a ha => ?_) (le_iInfβ fun a ha => ?_)
exacts [iInfβ_le (f a) ha, iInfβ_le (f a) ha]
-- Porting note (#10756): new lemma
theorem induced_topology_eq_preorder [Preorder Ξ±] [Preorder Ξ²] [TopologicalSpace Ξ²]
[OrderTopology Ξ²] {f : Ξ± β Ξ²} (hf : β {x y}, f x < f y β x < y)
(Hβ : β {a b x}, b < f a β Β¬(b < f x) β β y, y < a β§ b β€ f y)
(Hβ : β {a b x}, f a < b β Β¬(f x < b) β β y, a < y β§ f y β€ b) :
induced f βΉTopologicalSpace Ξ²βΊ = Preorder.topology Ξ± := by
let _ := Preorder.topology Ξ±; have : OrderTopology Ξ± := β¨rflβ©
refine le_antisymm (induced_topology_le_preorder hf) ?_
refine le_of_nhds_le_nhds fun a => ?_
simp only [nhds_eq_order, nhds_induced, comap_inf, comap_iInf, comap_principal]
refine inf_le_inf (le_iInfβ fun b hb => ?_) (le_iInfβ fun b hb => ?_)
Β· rcases em (β x, Β¬(b < f x)) with (β¨x, hxβ© | hb)
Β· rcases Hβ hb hx with β¨y, hya, hybβ©
exact iInfβ_le_of_le y hya (principal_mono.2 fun z hz => hyb.trans_lt (hf.2 hz))
Β· push_neg at hb
exact le_principal_iff.2 (univ_mem' hb)
Β· rcases em (β x, Β¬(f x < b)) with (β¨x, hxβ© | hb)
Β· rcases Hβ hb hx with β¨y, hya, hybβ©
exact iInfβ_le_of_le y hya (principal_mono.2 fun z hz => (hf.2 hz).trans_le hyb)
Β· push_neg at hb
exact le_principal_iff.2 (univ_mem' hb)
theorem induced_orderTopology' {Ξ± : Type u} {Ξ² : Type v} [Preorder Ξ±] [ta : TopologicalSpace Ξ²]
[Preorder Ξ²] [OrderTopology Ξ²] (f : Ξ± β Ξ²) (hf : β {x y}, f x < f y β x < y)
(Hβ : β {a x}, x < f a β β b < a, x β€ f b) (Hβ : β {a x}, f a < x β β b > a, f b β€ x) :
@OrderTopology _ (induced f ta) _ :=
let _ := induced f ta
β¨induced_topology_eq_preorder hf (fun h _ => Hβ h) (fun h _ => Hβ h)β©
#align induced_order_topology' induced_orderTopology'
theorem induced_orderTopology {Ξ± : Type u} {Ξ² : Type v} [Preorder Ξ±] [ta : TopologicalSpace Ξ²]
[Preorder Ξ²] [OrderTopology Ξ²] (f : Ξ± β Ξ²) (hf : β {x y}, f x < f y β x < y)
(H : β {x y}, x < y β β a, x < f a β§ f a < y) : @OrderTopology _ (induced f ta) _ :=
induced_orderTopology' f (hf)
(fun xa => let β¨b, xb, baβ© := H xa; β¨b, hf.1 ba, le_of_lt xbβ©)
fun ax => let β¨b, ab, bxβ© := H ax; β¨b, hf.1 ab, le_of_lt bxβ©
#align induced_order_topology induced_orderTopology
nonrec theorem StrictMono.induced_topology_eq_preorder {Ξ± Ξ² : Type*} [LinearOrder Ξ±]
[LinearOrder Ξ²] [t : TopologicalSpace Ξ²] [OrderTopology Ξ²] {f : Ξ± β Ξ²}
(hf : StrictMono f) (hc : OrdConnected (range f)) : t.induced f = Preorder.topology Ξ± := by
refine induced_topology_eq_preorder hf.lt_iff_lt (fun hβ hβ => ?_) fun hβ hβ => ?_
Β· rcases hc.out (mem_range_self _) (mem_range_self _) β¨not_lt.1 hβ, hβ.leβ© with β¨y, rflβ©
exact β¨y, hf.lt_iff_lt.1 hβ, le_rflβ©
Β· rcases hc.out (mem_range_self _) (mem_range_self _) β¨hβ.le, not_lt.1 hββ© with β¨y, rflβ©
exact β¨y, hf.lt_iff_lt.1 hβ, le_rflβ©
theorem StrictMono.embedding_of_ordConnected {Ξ± Ξ² : Type*} [LinearOrder Ξ±] [LinearOrder Ξ²]
[TopologicalSpace Ξ±] [h : OrderTopology Ξ±] [TopologicalSpace Ξ²] [OrderTopology Ξ²] {f : Ξ± β Ξ²}
(hf : StrictMono f) (hc : OrdConnected (range f)) : Embedding f :=
β¨β¨h.1.trans <| Eq.symm <| hf.induced_topology_eq_preorder hcβ©, hf.injectiveβ©
instance orderTopology_of_ordConnected {Ξ± : Type u} [TopologicalSpace Ξ±] [LinearOrder Ξ±]
[OrderTopology Ξ±] {t : Set Ξ±} [ht : OrdConnected t] : OrderTopology t :=
β¨(Subtype.strictMono_coe t).induced_topology_eq_preorder <| by
rwa [β @Subtype.range_val _ t] at htβ©
#align order_topology_of_ord_connected orderTopology_of_ordConnected
theorem nhdsWithin_Ici_eq'' [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderTopology Ξ±] (a : Ξ±) :
π[β₯] a = (β¨
(u) (_ : a < u), π (Iio u)) β π (Ici a) := by
rw [nhdsWithin, nhds_eq_order]
refine le_antisymm (inf_le_inf_right _ inf_le_right) (le_inf (le_inf ?_ inf_le_left) inf_le_right)
exact inf_le_right.trans (le_iInfβ fun l hl => principal_mono.2 <| Ici_subset_Ioi.2 hl)
#align nhds_within_Ici_eq'' nhdsWithin_Ici_eq''
theorem nhdsWithin_Iic_eq'' [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderTopology Ξ±] (a : Ξ±) :
π[β€] a = (β¨
l < a, π (Ioi l)) β π (Iic a) :=
nhdsWithin_Ici_eq'' (toDual a)
#align nhds_within_Iic_eq'' nhdsWithin_Iic_eq''
theorem nhdsWithin_Ici_eq' [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderTopology Ξ±] {a : Ξ±}
(ha : β u, a < u) : π[β₯] a = β¨
(u) (_ : a < u), π (Ico a u) := by
simp only [nhdsWithin_Ici_eq'', biInf_inf ha, inf_principal, Iio_inter_Ici]
#align nhds_within_Ici_eq' nhdsWithin_Ici_eq'
theorem nhdsWithin_Iic_eq' [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderTopology Ξ±] {a : Ξ±}
(ha : β l, l < a) : π[β€] a = β¨
l < a, π (Ioc l a) := by
simp only [nhdsWithin_Iic_eq'', biInf_inf ha, inf_principal, Ioi_inter_Iic]
#align nhds_within_Iic_eq' nhdsWithin_Iic_eq'
theorem nhdsWithin_Ici_basis' [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] {a : Ξ±}
(ha : β u, a < u) : (π[β₯] a).HasBasis (fun u => a < u) fun u => Ico a u :=
(nhdsWithin_Ici_eq' ha).symm βΈ
hasBasis_biInf_principal
(fun b hb c hc => β¨min b c, lt_min hb hc, Ico_subset_Ico_right (min_le_left _ _),
Ico_subset_Ico_right (min_le_right _ _)β©)
ha
#align nhds_within_Ici_basis' nhdsWithin_Ici_basis'
theorem nhdsWithin_Iic_basis' [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] {a : Ξ±}
(ha : β l, l < a) : (π[β€] a).HasBasis (fun l => l < a) fun l => Ioc l a := by
convert nhdsWithin_Ici_basis' (Ξ± := Ξ±α΅α΅) ha using 2
exact dual_Ico.symm
#align nhds_within_Iic_basis' nhdsWithin_Iic_basis'
theorem nhdsWithin_Ici_basis [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] [NoMaxOrder Ξ±]
(a : Ξ±) : (π[β₯] a).HasBasis (fun u => a < u) fun u => Ico a u :=
nhdsWithin_Ici_basis' (exists_gt a)
#align nhds_within_Ici_basis nhdsWithin_Ici_basis
theorem nhdsWithin_Iic_basis [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTopology Ξ±] [NoMinOrder Ξ±]
(a : Ξ±) : (π[β€] a).HasBasis (fun l => l < a) fun l => Ioc l a :=
nhdsWithin_Iic_basis' (exists_lt a)
#align nhds_within_Iic_basis nhdsWithin_Iic_basis
theorem nhds_top_order [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderTop Ξ±] [OrderTopology Ξ±] :
π (β€ : Ξ±) = β¨
(l) (hβ : l < β€), π (Ioi l) := by simp [nhds_eq_order (β€ : Ξ±)]
#align nhds_top_order nhds_top_order
theorem nhds_bot_order [TopologicalSpace Ξ±] [Preorder Ξ±] [OrderBot Ξ±] [OrderTopology Ξ±] :
π (β₯ : Ξ±) = β¨
(l) (hβ : β₯ < l), π (Iio l) := by simp [nhds_eq_order (β₯ : Ξ±)]
#align nhds_bot_order nhds_bot_order
theorem nhds_top_basis [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTop Ξ±] [OrderTopology Ξ±]
[Nontrivial Ξ±] : (π β€).HasBasis (fun a : Ξ± => a < β€) fun a : Ξ± => Ioi a := by
have : β x : Ξ±, x < β€ := (exists_ne β€).imp fun x hx => hx.lt_top
simpa only [Iic_top, nhdsWithin_univ, Ioc_top] using nhdsWithin_Iic_basis' this
#align nhds_top_basis nhds_top_basis
theorem nhds_bot_basis [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderBot Ξ±] [OrderTopology Ξ±]
[Nontrivial Ξ±] : (π β₯).HasBasis (fun a : Ξ± => β₯ < a) fun a : Ξ± => Iio a :=
nhds_top_basis (Ξ± := Ξ±α΅α΅)
#align nhds_bot_basis nhds_bot_basis
theorem nhds_top_basis_Ici [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderTop Ξ±] [OrderTopology Ξ±]
[Nontrivial Ξ±] [DenselyOrdered Ξ±] : (π β€).HasBasis (fun a : Ξ± => a < β€) Ici :=
nhds_top_basis.to_hasBasis
(fun _a ha => let β¨b, hab, hbβ© := exists_between ha; β¨b, hb, Ici_subset_Ioi.mpr habβ©)
fun a ha => β¨a, ha, Ioi_subset_Ici_selfβ©
#align nhds_top_basis_Ici nhds_top_basis_Ici
theorem nhds_bot_basis_Iic [TopologicalSpace Ξ±] [LinearOrder Ξ±] [OrderBot Ξ±] [OrderTopology Ξ±]
[Nontrivial Ξ±] [DenselyOrdered Ξ±] : (π β₯).HasBasis (fun a : Ξ± => β₯ < a) Iic :=
nhds_top_basis_Ici (Ξ± := Ξ±α΅α΅)
#align nhds_bot_basis_Iic nhds_bot_basis_Iic
theorem tendsto_nhds_top_mono [TopologicalSpace Ξ²] [Preorder Ξ²] [OrderTop Ξ²] [OrderTopology Ξ²]
{l : Filter Ξ±} {f g : Ξ± β Ξ²} (hf : Tendsto f l (π β€)) (hg : f β€αΆ [l] g) : Tendsto g l (π β€) := by
simp only [nhds_top_order, tendsto_iInf, tendsto_principal] at hf β’
intro x hx
filter_upwards [hf x hx, hg] with _ using lt_of_lt_of_le
#align tendsto_nhds_top_mono tendsto_nhds_top_mono
theorem tendsto_nhds_bot_mono [TopologicalSpace Ξ²] [Preorder Ξ²] [OrderBot Ξ²] [OrderTopology Ξ²]
{l : Filter Ξ±} {f g : Ξ± β Ξ²} (hf : Tendsto f l (π β₯)) (hg : g β€αΆ [l] f) : Tendsto g l (π β₯) :=
tendsto_nhds_top_mono (Ξ² := Ξ²α΅α΅) hf hg
#align tendsto_nhds_bot_mono tendsto_nhds_bot_mono
theorem tendsto_nhds_top_mono' [TopologicalSpace Ξ²] [Preorder Ξ²] [OrderTop Ξ²] [OrderTopology Ξ²]
{l : Filter Ξ±} {f g : Ξ± β Ξ²} (hf : Tendsto f l (π β€)) (hg : f β€ g) : Tendsto g l (π β€) :=
tendsto_nhds_top_mono hf (eventually_of_forall hg)
#align tendsto_nhds_top_mono' tendsto_nhds_top_mono'
theorem tendsto_nhds_bot_mono' [TopologicalSpace Ξ²] [Preorder Ξ²] [OrderBot Ξ²] [OrderTopology Ξ²]
{l : Filter Ξ±} {f g : Ξ± β Ξ²} (hf : Tendsto f l (π β₯)) (hg : g β€ f) : Tendsto g l (π β₯) :=
tendsto_nhds_bot_mono hf (eventually_of_forall hg)
#align tendsto_nhds_bot_mono' tendsto_nhds_bot_mono'
section LinearOrder
variable [TopologicalSpace Ξ±] [LinearOrder Ξ±]
section OrderTopology
variable [OrderTopology Ξ±]
theorem order_separated {aβ aβ : Ξ±} (h : aβ < aβ) :
β u v : Set Ξ±, IsOpen u β§ IsOpen v β§ aβ β u β§ aβ β v β§ β bβ β u, β bβ β v, bβ < bβ :=
let β¨x, hx, y, hy, hβ© := h.exists_disjoint_Iio_Ioi
β¨Iio x, Ioi y, isOpen_gt' _, isOpen_lt' _, hx, hy, hβ©
#align order_separated order_separated
-- see Note [lower instance priority]
instance (priority := 100) OrderTopology.to_orderClosedTopology : OrderClosedTopology Ξ± where
isClosed_le' := isOpen_compl_iff.1 <| isOpen_prod_iff.mpr fun aβ aβ (h : Β¬aβ β€ aβ) =>
have h : aβ < aβ := lt_of_not_ge h
let β¨u, v, hu, hv, haβ, haβ, hβ© := order_separated h
β¨v, u, hv, hu, haβ, haβ, fun β¨bβ, bββ© β¨hβ, hββ© => not_le_of_gt <| h bβ hβ bβ hββ©
#align order_topology.to_order_closed_topology OrderTopology.to_orderClosedTopology
theorem exists_Ioc_subset_of_mem_nhds {a : Ξ±} {s : Set Ξ±} (hs : s β π a) (h : β l, l < a) :
β l < a, Ioc l a β s :=
(nhdsWithin_Iic_basis' h).mem_iff.mp (nhdsWithin_le_nhds hs)
#align exists_Ioc_subset_of_mem_nhds exists_Ioc_subset_of_mem_nhds
theorem exists_Ioc_subset_of_mem_nhds' {a : Ξ±} {s : Set Ξ±} (hs : s β π a) {l : Ξ±} (hl : l < a) :
β l' β Ico l a, Ioc l' a β s :=
let β¨l', hl'a, hl'sβ© := exists_Ioc_subset_of_mem_nhds hs β¨l, hlβ©
β¨max l l', β¨le_max_left _ _, max_lt hl hl'aβ©,
(Ioc_subset_Ioc_left <| le_max_right _ _).trans hl'sβ©
#align exists_Ioc_subset_of_mem_nhds' exists_Ioc_subset_of_mem_nhds'
theorem exists_Ico_subset_of_mem_nhds' {a : Ξ±} {s : Set Ξ±} (hs : s β π a) {u : Ξ±} (hu : a < u) :
β u' β Ioc a u, Ico a u' β s := by
simpa only [OrderDual.exists, exists_prop, dual_Ico, dual_Ioc] using
exists_Ioc_subset_of_mem_nhds' (show ofDual β»ΒΉ' s β π (toDual a) from hs) hu.dual
#align exists_Ico_subset_of_mem_nhds' exists_Ico_subset_of_mem_nhds'
theorem exists_Ico_subset_of_mem_nhds {a : Ξ±} {s : Set Ξ±} (hs : s β π a) (h : β u, a < u) :
β u, a < u β§ Ico a u β s :=
let β¨_l', hl'β© := h;
let β¨l, hlβ© := exists_Ico_subset_of_mem_nhds' hs hl'
β¨l, hl.1.1, hl.2β©
#align exists_Ico_subset_of_mem_nhds exists_Ico_subset_of_mem_nhds
theorem exists_Icc_mem_subset_of_mem_nhdsWithin_Ici {a : Ξ±} {s : Set Ξ±} (hs : s β π[β₯] a) :
β b, a β€ b β§ Icc a b β π[β₯] a β§ Icc a b β s := by
rcases (em (IsMax a)).imp_right not_isMax_iff.mp with (ha | ha)
Β· use a
simpa [ha.Ici_eq] using hs
Β· rcases (nhdsWithin_Ici_basis' ha).mem_iff.mp hs with β¨b, hab, hbsβ©
rcases eq_empty_or_nonempty (Ioo a b) with (H | β¨c, hac, hcbβ©)
Β· have : Ico a b = Icc a a := by rw [β Icc_union_Ioo_eq_Ico le_rfl hab, H, union_empty]
exact β¨a, le_rfl, this βΈ β¨Ico_mem_nhdsWithin_Ici' hab, hbsβ©β©
Β· refine β¨c, hac.le, Icc_mem_nhdsWithin_Ici' hac, ?_β©
exact (Icc_subset_Ico_right hcb).trans hbs
#align exists_Icc_mem_subset_of_mem_nhds_within_Ici exists_Icc_mem_subset_of_mem_nhdsWithin_Ici
theorem exists_Icc_mem_subset_of_mem_nhdsWithin_Iic {a : Ξ±} {s : Set Ξ±} (hs : s β π[β€] a) :
β b β€ a, Icc b a β π[β€] a β§ Icc b a β s := by
simpa only [dual_Icc, toDual.surjective.exists] using
exists_Icc_mem_subset_of_mem_nhdsWithin_Ici (Ξ± := Ξ±α΅α΅) (a := toDual a) hs
#align exists_Icc_mem_subset_of_mem_nhds_within_Iic exists_Icc_mem_subset_of_mem_nhdsWithin_Iic
theorem exists_Icc_mem_subset_of_mem_nhds {a : Ξ±} {s : Set Ξ±} (hs : s β π a) :
β b c, a β Icc b c β§ Icc b c β π a β§ Icc b c β s := by
rcases exists_Icc_mem_subset_of_mem_nhdsWithin_Iic (nhdsWithin_le_nhds hs) with
β¨b, hba, hb_nhds, hbsβ©
rcases exists_Icc_mem_subset_of_mem_nhdsWithin_Ici (nhdsWithin_le_nhds hs) with
β¨c, hac, hc_nhds, hcsβ©
refine β¨b, c, β¨hba, hacβ©, ?_β©
rw [β Icc_union_Icc_eq_Icc hba hac, β nhds_left_sup_nhds_right]
exact β¨union_mem_sup hb_nhds hc_nhds, union_subset hbs hcsβ©
#align exists_Icc_mem_subset_of_mem_nhds exists_Icc_mem_subset_of_mem_nhds
theorem IsOpen.exists_Ioo_subset [Nontrivial Ξ±] {s : Set Ξ±} (hs : IsOpen s) (h : s.Nonempty) :
β a b, a < b β§ Ioo a b β s := by
obtain β¨x, hxβ© : β x, x β s := h
obtain β¨y, hyβ© : β y, y β x := exists_ne x
rcases lt_trichotomy x y with (H | rfl | H)
Β· obtain β¨u, xu, huβ© : β u, x < u β§ Ico x u β s :=
exists_Ico_subset_of_mem_nhds (hs.mem_nhds hx) β¨y, Hβ©
exact β¨x, u, xu, Ioo_subset_Ico_self.trans huβ©
Β· exact (hy rfl).elim
Β· obtain β¨l, lx, hlβ© : β l, l < x β§ Ioc l x β s :=
exists_Ioc_subset_of_mem_nhds (hs.mem_nhds hx) β¨y, Hβ©
exact β¨l, x, lx, Ioo_subset_Ioc_self.trans hlβ©
#align is_open.exists_Ioo_subset IsOpen.exists_Ioo_subset
| Mathlib/Topology/Order/Basic.lean | 466 | 471 | theorem dense_of_exists_between [Nontrivial Ξ±] {s : Set Ξ±}
(h : β β¦a bβ¦, a < b β β c β s, a < c β§ c < b) : Dense s := by |
refine dense_iff_inter_open.2 fun U U_open U_nonempty => ?_
obtain β¨a, b, hab, Hβ© : β a b : Ξ±, a < b β§ Ioo a b β U := U_open.exists_Ioo_subset U_nonempty
obtain β¨x, xs, hxβ© : β x β s, a < x β§ x < b := h hab
exact β¨x, β¨H hx, xsβ©β©
|
import Mathlib.Algebra.Homology.ComplexShape
import Mathlib.CategoryTheory.Subobject.Limits
import Mathlib.CategoryTheory.GradedObject
import Mathlib.Algebra.Homology.ShortComplex.Basic
#align_import algebra.homology.homological_complex from "leanprover-community/mathlib"@"88bca0ce5d22ebfd9e73e682e51d60ea13b48347"
universe v u
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
variable {ΞΉ : Type*}
variable (V : Type u) [Category.{v} V] [HasZeroMorphisms V]
structure HomologicalComplex (c : ComplexShape ΞΉ) where
X : ΞΉ β V
d : β i j, X i βΆ X j
shape : β i j, Β¬c.Rel i j β d i j = 0 := by aesop_cat
d_comp_d' : β i j k, c.Rel i j β c.Rel j k β d i j β« d j k = 0 := by aesop_cat
#align homological_complex HomologicalComplex
abbrev ChainComplex (Ξ± : Type*) [AddRightCancelSemigroup Ξ±] [One Ξ±] : Type _ :=
HomologicalComplex V (ComplexShape.down Ξ±)
#align chain_complex ChainComplex
abbrev CochainComplex (Ξ± : Type*) [AddRightCancelSemigroup Ξ±] [One Ξ±] : Type _ :=
HomologicalComplex V (ComplexShape.up Ξ±)
#align cochain_complex CochainComplex
namespace ChainComplex
section MkHom
variable {V}
variable (P Q : CochainComplex V β) (zero : P.X 0 βΆ Q.X 0) (one : P.X 1 βΆ Q.X 1)
(one_zero_comm : zero β« Q.d 0 1 = P.d 0 1 β« one)
(succ : β (n : β) (p : Ξ£' (f : P.X n βΆ Q.X n) (f' : P.X (n + 1) βΆ Q.X (n + 1)),
f β« Q.d n (n + 1) = P.d n (n + 1) β« f'),
Ξ£' f'' : P.X (n + 2) βΆ Q.X (n + 2), p.2.1 β« Q.d (n + 1) (n + 2) = P.d (n + 1) (n + 2) β« f'')
def mkHomAux :
β n,
Ξ£' (f : P.X n βΆ Q.X n) (f' : P.X (n + 1) βΆ Q.X (n + 1)),
f β« Q.d n (n + 1) = P.d n (n + 1) β« f'
| 0 => β¨zero, one, one_zero_commβ©
| n + 1 => β¨(mkHomAux n).2.1, (succ n (mkHomAux n)).1, (succ n (mkHomAux n)).2β©
#align cochain_complex.mk_hom_aux CochainComplex.mkHomAux
def mkHom : P βΆ Q where
f n := (mkHomAux P Q zero one one_zero_comm succ n).1
comm' n m := by
rintro (rfl : n + 1 = m)
exact (mkHomAux P Q zero one one_zero_comm succ n).2.2
#align cochain_complex.mk_hom CochainComplex.mkHom
@[simp]
theorem mkHom_f_0 : (mkHom P Q zero one one_zero_comm succ).f 0 = zero :=
rfl
#align cochain_complex.mk_hom_f_0 CochainComplex.mkHom_f_0
@[simp]
theorem mkHom_f_1 : (mkHom P Q zero one one_zero_comm succ).f 1 = one :=
rfl
#align cochain_complex.mk_hom_f_1 CochainComplex.mkHom_f_1
@[simp]
| Mathlib/Algebra/Homology/HomologicalComplex.lean | 1,144 | 1,150 | theorem mkHom_f_succ_succ (n : β) :
(mkHom P Q zero one one_zero_comm succ).f (n + 2) =
(succ n
β¨(mkHom P Q zero one one_zero_comm succ).f n,
(mkHom P Q zero one one_zero_comm succ).f (n + 1),
(mkHom P Q zero one one_zero_comm succ).comm n (n + 1)β©).1 := by |
dsimp [mkHom, mkHomAux]
|
import Mathlib.Topology.Constructions
#align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
open Set Filter Function Topology Filter
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
variable [TopologicalSpace Ξ±]
@[simp]
theorem nhds_bind_nhdsWithin {a : Ξ±} {s : Set Ξ±} : ((π a).bind fun x => π[s] x) = π[s] a :=
bind_inf_principal.trans <| congr_argβ _ nhds_bind_nhds rfl
#align nhds_bind_nhds_within nhds_bind_nhdsWithin
@[simp]
theorem eventually_nhds_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β Prop} :
(βαΆ y in π a, βαΆ x in π[s] y, p x) β βαΆ x in π[s] a, p x :=
Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x }
#align eventually_nhds_nhds_within eventually_nhds_nhdsWithin
theorem eventually_nhdsWithin_iff {a : Ξ±} {s : Set Ξ±} {p : Ξ± β Prop} :
(βαΆ x in π[s] a, p x) β βαΆ x in π a, x β s β p x :=
eventually_inf_principal
#align eventually_nhds_within_iff eventually_nhdsWithin_iff
theorem frequently_nhdsWithin_iff {z : Ξ±} {s : Set Ξ±} {p : Ξ± β Prop} :
(βαΆ x in π[s] z, p x) β βαΆ x in π z, p x β§ x β s :=
frequently_inf_principal.trans <| by simp only [and_comm]
#align frequently_nhds_within_iff frequently_nhdsWithin_iff
theorem mem_closure_ne_iff_frequently_within {z : Ξ±} {s : Set Ξ±} :
z β closure (s \ {z}) β βαΆ x in π[β ] z, x β s := by
simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff]
#align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within
@[simp]
theorem eventually_nhdsWithin_nhdsWithin {a : Ξ±} {s : Set Ξ±} {p : Ξ± β Prop} :
(βαΆ y in π[s] a, βαΆ x in π[s] y, p x) β βαΆ x in π[s] a, p x := by
refine β¨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_leftβ©
simp only [eventually_nhdsWithin_iff] at h β’
exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs
#align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin
theorem nhdsWithin_eq (a : Ξ±) (s : Set Ξ±) :
π[s] a = β¨
t β { t : Set Ξ± | a β t β§ IsOpen t }, π (t β© s) :=
((nhds_basis_opens a).inf_principal s).eq_biInf
#align nhds_within_eq nhdsWithin_eq
theorem nhdsWithin_univ (a : Ξ±) : π[Set.univ] a = π a := by
rw [nhdsWithin, principal_univ, inf_top_eq]
#align nhds_within_univ nhdsWithin_univ
theorem nhdsWithin_hasBasis {p : Ξ² β Prop} {s : Ξ² β Set Ξ±} {a : Ξ±} (h : (π a).HasBasis p s)
(t : Set Ξ±) : (π[t] a).HasBasis p fun i => s i β© t :=
h.inf_principal t
#align nhds_within_has_basis nhdsWithin_hasBasis
theorem nhdsWithin_basis_open (a : Ξ±) (t : Set Ξ±) :
(π[t] a).HasBasis (fun u => a β u β§ IsOpen u) fun u => u β© t :=
nhdsWithin_hasBasis (nhds_basis_opens a) t
#align nhds_within_basis_open nhdsWithin_basis_open
theorem mem_nhdsWithin {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} :
t β π[s] a β β u, IsOpen u β§ a β u β§ u β© s β t := by
simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff
#align mem_nhds_within mem_nhdsWithin
theorem mem_nhdsWithin_iff_exists_mem_nhds_inter {t : Set Ξ±} {a : Ξ±} {s : Set Ξ±} :
t β π[s] a β β u β π a, u β© s β t :=
(nhdsWithin_hasBasis (π a).basis_sets s).mem_iff
#align mem_nhds_within_iff_exists_mem_nhds_inter mem_nhdsWithin_iff_exists_mem_nhds_inter
theorem diff_mem_nhdsWithin_compl {x : Ξ±} {s : Set Ξ±} (hs : s β π x) (t : Set Ξ±) :
s \ t β π[tαΆ] x :=
diff_mem_inf_principal_compl hs t
#align diff_mem_nhds_within_compl diff_mem_nhdsWithin_compl
theorem diff_mem_nhdsWithin_diff {x : Ξ±} {s t : Set Ξ±} (hs : s β π[t] x) (t' : Set Ξ±) :
s \ t' β π[t \ t'] x := by
rw [nhdsWithin, diff_eq, diff_eq, β inf_principal, β inf_assoc]
exact inter_mem_inf hs (mem_principal_self _)
#align diff_mem_nhds_within_diff diff_mem_nhdsWithin_diff
theorem nhds_of_nhdsWithin_of_nhds {s t : Set Ξ±} {a : Ξ±} (h1 : s β π a) (h2 : t β π[s] a) :
t β π a := by
rcases mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h2 with β¨_, Hw, hwβ©
exact (π a).sets_of_superset ((π a).inter_sets Hw h1) hw
#align nhds_of_nhds_within_of_nhds nhds_of_nhdsWithin_of_nhds
theorem mem_nhdsWithin_iff_eventually {s t : Set Ξ±} {x : Ξ±} :
t β π[s] x β βαΆ y in π x, y β s β y β t :=
eventually_inf_principal
#align mem_nhds_within_iff_eventually mem_nhdsWithin_iff_eventually
theorem mem_nhdsWithin_iff_eventuallyEq {s t : Set Ξ±} {x : Ξ±} :
t β π[s] x β s =αΆ [π x] (s β© t : Set Ξ±) := by
simp_rw [mem_nhdsWithin_iff_eventually, eventuallyEq_set, mem_inter_iff, iff_self_and]
#align mem_nhds_within_iff_eventually_eq mem_nhdsWithin_iff_eventuallyEq
theorem nhdsWithin_eq_iff_eventuallyEq {s t : Set Ξ±} {x : Ξ±} : π[s] x = π[t] x β s =αΆ [π x] t :=
set_eventuallyEq_iff_inf_principal.symm
#align nhds_within_eq_iff_eventually_eq nhdsWithin_eq_iff_eventuallyEq
theorem nhdsWithin_le_iff {s t : Set Ξ±} {x : Ξ±} : π[s] x β€ π[t] x β t β π[s] x :=
set_eventuallyLE_iff_inf_principal_le.symm.trans set_eventuallyLE_iff_mem_inf_principal
#align nhds_within_le_iff nhdsWithin_le_iff
-- Porting note: golfed, dropped an unneeded assumption
theorem preimage_nhdsWithin_coinduced' {Ο : Ξ± β Ξ²} {s : Set Ξ²} {t : Set Ξ±} {a : Ξ±} (h : a β t)
(hs : s β @nhds Ξ² (.coinduced (fun x : t => Ο x) inferInstance) (Ο a)) :
Ο β»ΒΉ' s β π[t] a := by
lift a to t using h
replace hs : (fun x : t => Ο x) β»ΒΉ' s β π a := preimage_nhds_coinduced hs
rwa [β map_nhds_subtype_val, mem_map]
#align preimage_nhds_within_coinduced' preimage_nhdsWithin_coinduced'β
theorem mem_nhdsWithin_of_mem_nhds {s t : Set Ξ±} {a : Ξ±} (h : s β π a) : s β π[t] a :=
mem_inf_of_left h
#align mem_nhds_within_of_mem_nhds mem_nhdsWithin_of_mem_nhds
theorem self_mem_nhdsWithin {a : Ξ±} {s : Set Ξ±} : s β π[s] a :=
mem_inf_of_right (mem_principal_self s)
#align self_mem_nhds_within self_mem_nhdsWithin
theorem eventually_mem_nhdsWithin {a : Ξ±} {s : Set Ξ±} : βαΆ x in π[s] a, x β s :=
self_mem_nhdsWithin
#align eventually_mem_nhds_within eventually_mem_nhdsWithin
theorem inter_mem_nhdsWithin (s : Set Ξ±) {t : Set Ξ±} {a : Ξ±} (h : t β π a) : s β© t β π[s] a :=
inter_mem self_mem_nhdsWithin (mem_inf_of_left h)
#align inter_mem_nhds_within inter_mem_nhdsWithin
theorem nhdsWithin_mono (a : Ξ±) {s t : Set Ξ±} (h : s β t) : π[s] a β€ π[t] a :=
inf_le_inf_left _ (principal_mono.mpr h)
#align nhds_within_mono nhdsWithin_mono
theorem pure_le_nhdsWithin {a : Ξ±} {s : Set Ξ±} (ha : a β s) : pure a β€ π[s] a :=
le_inf (pure_le_nhds a) (le_principal_iff.2 ha)
#align pure_le_nhds_within pure_le_nhdsWithin
theorem mem_of_mem_nhdsWithin {a : Ξ±} {s t : Set Ξ±} (ha : a β s) (ht : t β π[s] a) : a β t :=
pure_le_nhdsWithin ha ht
#align mem_of_mem_nhds_within mem_of_mem_nhdsWithin
theorem Filter.Eventually.self_of_nhdsWithin {p : Ξ± β Prop} {s : Set Ξ±} {x : Ξ±}
(h : βαΆ y in π[s] x, p y) (hx : x β s) : p x :=
mem_of_mem_nhdsWithin hx h
#align filter.eventually.self_of_nhds_within Filter.Eventually.self_of_nhdsWithin
theorem tendsto_const_nhdsWithin {l : Filter Ξ²} {s : Set Ξ±} {a : Ξ±} (ha : a β s) :
Tendsto (fun _ : Ξ² => a) l (π[s] a) :=
tendsto_const_pure.mono_right <| pure_le_nhdsWithin ha
#align tendsto_const_nhds_within tendsto_const_nhdsWithin
theorem nhdsWithin_restrict'' {a : Ξ±} (s : Set Ξ±) {t : Set Ξ±} (h : t β π[s] a) :
π[s] a = π[s β© t] a :=
le_antisymm (le_inf inf_le_left (le_principal_iff.mpr (inter_mem self_mem_nhdsWithin h)))
(inf_le_inf_left _ (principal_mono.mpr Set.inter_subset_left))
#align nhds_within_restrict'' nhdsWithin_restrict''
theorem nhdsWithin_restrict' {a : Ξ±} (s : Set Ξ±) {t : Set Ξ±} (h : t β π a) : π[s] a = π[s β© t] a :=
nhdsWithin_restrict'' s <| mem_inf_of_left h
#align nhds_within_restrict' nhdsWithin_restrict'
theorem nhdsWithin_restrict {a : Ξ±} (s : Set Ξ±) {t : Set Ξ±} (hβ : a β t) (hβ : IsOpen t) :
π[s] a = π[s β© t] a :=
nhdsWithin_restrict' s (IsOpen.mem_nhds hβ hβ)
#align nhds_within_restrict nhdsWithin_restrict
theorem nhdsWithin_le_of_mem {a : Ξ±} {s t : Set Ξ±} (h : s β π[t] a) : π[t] a β€ π[s] a :=
nhdsWithin_le_iff.mpr h
#align nhds_within_le_of_mem nhdsWithin_le_of_mem
theorem nhdsWithin_le_nhds {a : Ξ±} {s : Set Ξ±} : π[s] a β€ π a := by
rw [β nhdsWithin_univ]
apply nhdsWithin_le_of_mem
exact univ_mem
#align nhds_within_le_nhds nhdsWithin_le_nhds
theorem nhdsWithin_eq_nhdsWithin' {a : Ξ±} {s t u : Set Ξ±} (hs : s β π a) (hβ : t β© s = u β© s) :
π[t] a = π[u] a := by rw [nhdsWithin_restrict' t hs, nhdsWithin_restrict' u hs, hβ]
#align nhds_within_eq_nhds_within' nhdsWithin_eq_nhdsWithin'
theorem nhdsWithin_eq_nhdsWithin {a : Ξ±} {s t u : Set Ξ±} (hβ : a β s) (hβ : IsOpen s)
(hβ : t β© s = u β© s) : π[t] a = π[u] a := by
rw [nhdsWithin_restrict t hβ hβ, nhdsWithin_restrict u hβ hβ, hβ]
#align nhds_within_eq_nhds_within nhdsWithin_eq_nhdsWithin
@[simp] theorem nhdsWithin_eq_nhds {a : Ξ±} {s : Set Ξ±} : π[s] a = π a β s β π a :=
inf_eq_left.trans le_principal_iff
#align nhds_within_eq_nhds nhdsWithin_eq_nhds
theorem IsOpen.nhdsWithin_eq {a : Ξ±} {s : Set Ξ±} (h : IsOpen s) (ha : a β s) : π[s] a = π a :=
nhdsWithin_eq_nhds.2 <| h.mem_nhds ha
#align is_open.nhds_within_eq IsOpen.nhdsWithin_eq
theorem preimage_nhds_within_coinduced {Ο : Ξ± β Ξ²} {s : Set Ξ²} {t : Set Ξ±} {a : Ξ±} (h : a β t)
(ht : IsOpen t)
(hs : s β @nhds Ξ² (.coinduced (fun x : t => Ο x) inferInstance) (Ο a)) :
Ο β»ΒΉ' s β π a := by
rw [β ht.nhdsWithin_eq h]
exact preimage_nhdsWithin_coinduced' h hs
#align preimage_nhds_within_coinduced preimage_nhds_within_coinduced
@[simp]
theorem nhdsWithin_empty (a : Ξ±) : π[β
] a = β₯ := by rw [nhdsWithin, principal_empty, inf_bot_eq]
#align nhds_within_empty nhdsWithin_empty
theorem nhdsWithin_union (a : Ξ±) (s t : Set Ξ±) : π[s βͺ t] a = π[s] a β π[t] a := by
delta nhdsWithin
rw [β inf_sup_left, sup_principal]
#align nhds_within_union nhdsWithin_union
theorem nhdsWithin_biUnion {ΞΉ} {I : Set ΞΉ} (hI : I.Finite) (s : ΞΉ β Set Ξ±) (a : Ξ±) :
π[β i β I, s i] a = β¨ i β I, π[s i] a :=
Set.Finite.induction_on hI (by simp) fun _ _ hT β¦ by
simp only [hT, nhdsWithin_union, iSup_insert, biUnion_insert]
#align nhds_within_bUnion nhdsWithin_biUnion
theorem nhdsWithin_sUnion {S : Set (Set Ξ±)} (hS : S.Finite) (a : Ξ±) :
π[ββ S] a = β¨ s β S, π[s] a := by
rw [sUnion_eq_biUnion, nhdsWithin_biUnion hS]
#align nhds_within_sUnion nhdsWithin_sUnion
theorem nhdsWithin_iUnion {ΞΉ} [Finite ΞΉ] (s : ΞΉ β Set Ξ±) (a : Ξ±) :
π[β i, s i] a = β¨ i, π[s i] a := by
rw [β sUnion_range, nhdsWithin_sUnion (finite_range s), iSup_range]
#align nhds_within_Union nhdsWithin_iUnion
theorem nhdsWithin_inter (a : Ξ±) (s t : Set Ξ±) : π[s β© t] a = π[s] a β π[t] a := by
delta nhdsWithin
rw [inf_left_comm, inf_assoc, inf_principal, β inf_assoc, inf_idem]
#align nhds_within_inter nhdsWithin_inter
theorem nhdsWithin_inter' (a : Ξ±) (s t : Set Ξ±) : π[s β© t] a = π[s] a β π t := by
delta nhdsWithin
rw [β inf_principal, inf_assoc]
#align nhds_within_inter' nhdsWithin_inter'
theorem nhdsWithin_inter_of_mem {a : Ξ±} {s t : Set Ξ±} (h : s β π[t] a) : π[s β© t] a = π[t] a := by
rw [nhdsWithin_inter, inf_eq_right]
exact nhdsWithin_le_of_mem h
#align nhds_within_inter_of_mem nhdsWithin_inter_of_mem
theorem nhdsWithin_inter_of_mem' {a : Ξ±} {s t : Set Ξ±} (h : t β π[s] a) : π[s β© t] a = π[s] a := by
rw [inter_comm, nhdsWithin_inter_of_mem h]
#align nhds_within_inter_of_mem' nhdsWithin_inter_of_mem'
@[simp]
theorem nhdsWithin_singleton (a : Ξ±) : π[{a}] a = pure a := by
rw [nhdsWithin, principal_singleton, inf_eq_right.2 (pure_le_nhds a)]
#align nhds_within_singleton nhdsWithin_singleton
@[simp]
theorem nhdsWithin_insert (a : Ξ±) (s : Set Ξ±) : π[insert a s] a = pure a β π[s] a := by
rw [β singleton_union, nhdsWithin_union, nhdsWithin_singleton]
#align nhds_within_insert nhdsWithin_insert
theorem mem_nhdsWithin_insert {a : Ξ±} {s t : Set Ξ±} : t β π[insert a s] a β a β t β§ t β π[s] a := by
simp
#align mem_nhds_within_insert mem_nhdsWithin_insert
theorem insert_mem_nhdsWithin_insert {a : Ξ±} {s t : Set Ξ±} (h : t β π[s] a) :
insert a t β π[insert a s] a := by simp [mem_of_superset h]
#align insert_mem_nhds_within_insert insert_mem_nhdsWithin_insert
theorem insert_mem_nhds_iff {a : Ξ±} {s : Set Ξ±} : insert a s β π a β s β π[β ] a := by
simp only [nhdsWithin, mem_inf_principal, mem_compl_iff, mem_singleton_iff, or_iff_not_imp_left,
insert_def]
#align insert_mem_nhds_iff insert_mem_nhds_iff
@[simp]
theorem nhdsWithin_compl_singleton_sup_pure (a : Ξ±) : π[β ] a β pure a = π a := by
rw [β nhdsWithin_singleton, β nhdsWithin_union, compl_union_self, nhdsWithin_univ]
#align nhds_within_compl_singleton_sup_pure nhdsWithin_compl_singleton_sup_pure
theorem nhdsWithin_prod {Ξ± : Type*} [TopologicalSpace Ξ±] {Ξ² : Type*} [TopologicalSpace Ξ²]
{s u : Set Ξ±} {t v : Set Ξ²} {a : Ξ±} {b : Ξ²} (hu : u β π[s] a) (hv : v β π[t] b) :
u ΓΛ’ v β π[s ΓΛ’ t] (a, b) := by
rw [nhdsWithin_prod_eq]
exact prod_mem_prod hu hv
#align nhds_within_prod nhdsWithin_prod
theorem nhdsWithin_pi_eq' {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {I : Set ΞΉ}
(hI : I.Finite) (s : β i, Set (Ξ± i)) (x : β i, Ξ± i) :
π[pi I s] x = β¨
i, comap (fun x => x i) (π (x i) β β¨
(_ : i β I), π (s i)) := by
simp only [nhdsWithin, nhds_pi, Filter.pi, comap_inf, comap_iInf, pi_def, comap_principal, β
iInf_principal_finite hI, β iInf_inf_eq]
#align nhds_within_pi_eq' nhdsWithin_pi_eq'
theorem nhdsWithin_pi_eq {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {I : Set ΞΉ}
(hI : I.Finite) (s : β i, Set (Ξ± i)) (x : β i, Ξ± i) :
π[pi I s] x =
(β¨
i β I, comap (fun x => x i) (π[s i] x i)) β
β¨
(i) (_ : i β I), comap (fun x => x i) (π (x i)) := by
simp only [nhdsWithin, nhds_pi, Filter.pi, pi_def, β iInf_principal_finite hI, comap_inf,
comap_principal, eval]
rw [iInf_split _ fun i => i β I, inf_right_comm]
simp only [iInf_inf_eq]
#align nhds_within_pi_eq nhdsWithin_pi_eq
theorem nhdsWithin_pi_univ_eq {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [Finite ΞΉ] [β i, TopologicalSpace (Ξ± i)]
(s : β i, Set (Ξ± i)) (x : β i, Ξ± i) :
π[pi univ s] x = β¨
i, comap (fun x => x i) (π[s i] x i) := by
simpa [nhdsWithin] using nhdsWithin_pi_eq finite_univ s x
#align nhds_within_pi_univ_eq nhdsWithin_pi_univ_eq
theorem nhdsWithin_pi_eq_bot {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {I : Set ΞΉ}
{s : β i, Set (Ξ± i)} {x : β i, Ξ± i} : π[pi I s] x = β₯ β β i β I, π[s i] x i = β₯ := by
simp only [nhdsWithin, nhds_pi, pi_inf_principal_pi_eq_bot]
#align nhds_within_pi_eq_bot nhdsWithin_pi_eq_bot
theorem nhdsWithin_pi_neBot {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {I : Set ΞΉ}
{s : β i, Set (Ξ± i)} {x : β i, Ξ± i} : (π[pi I s] x).NeBot β β i β I, (π[s i] x i).NeBot := by
simp [neBot_iff, nhdsWithin_pi_eq_bot]
#align nhds_within_pi_ne_bot nhdsWithin_pi_neBot
theorem Filter.Tendsto.piecewise_nhdsWithin {f g : Ξ± β Ξ²} {t : Set Ξ±} [β x, Decidable (x β t)]
{a : Ξ±} {s : Set Ξ±} {l : Filter Ξ²} (hβ : Tendsto f (π[s β© t] a) l)
(hβ : Tendsto g (π[s β© tαΆ] a) l) : Tendsto (piecewise t f g) (π[s] a) l := by
apply Tendsto.piecewise <;> rwa [β nhdsWithin_inter']
#align filter.tendsto.piecewise_nhds_within Filter.Tendsto.piecewise_nhdsWithin
theorem Filter.Tendsto.if_nhdsWithin {f g : Ξ± β Ξ²} {p : Ξ± β Prop} [DecidablePred p] {a : Ξ±}
{s : Set Ξ±} {l : Filter Ξ²} (hβ : Tendsto f (π[s β© { x | p x }] a) l)
(hβ : Tendsto g (π[s β© { x | Β¬p x }] a) l) :
Tendsto (fun x => if p x then f x else g x) (π[s] a) l :=
hβ.piecewise_nhdsWithin hβ
#align filter.tendsto.if_nhds_within Filter.Tendsto.if_nhdsWithin
theorem map_nhdsWithin (f : Ξ± β Ξ²) (a : Ξ±) (s : Set Ξ±) :
map f (π[s] a) = β¨
t β { t : Set Ξ± | a β t β§ IsOpen t }, π (f '' (t β© s)) :=
((nhdsWithin_basis_open a s).map f).eq_biInf
#align map_nhds_within map_nhdsWithin
theorem tendsto_nhdsWithin_mono_left {f : Ξ± β Ξ²} {a : Ξ±} {s t : Set Ξ±} {l : Filter Ξ²} (hst : s β t)
(h : Tendsto f (π[t] a) l) : Tendsto f (π[s] a) l :=
h.mono_left <| nhdsWithin_mono a hst
#align tendsto_nhds_within_mono_left tendsto_nhdsWithin_mono_left
theorem tendsto_nhdsWithin_mono_right {f : Ξ² β Ξ±} {l : Filter Ξ²} {a : Ξ±} {s t : Set Ξ±} (hst : s β t)
(h : Tendsto f l (π[s] a)) : Tendsto f l (π[t] a) :=
h.mono_right (nhdsWithin_mono a hst)
#align tendsto_nhds_within_mono_right tendsto_nhdsWithin_mono_right
theorem tendsto_nhdsWithin_of_tendsto_nhds {f : Ξ± β Ξ²} {a : Ξ±} {s : Set Ξ±} {l : Filter Ξ²}
(h : Tendsto f (π a) l) : Tendsto f (π[s] a) l :=
h.mono_left inf_le_left
#align tendsto_nhds_within_of_tendsto_nhds tendsto_nhdsWithin_of_tendsto_nhds
theorem eventually_mem_of_tendsto_nhdsWithin {f : Ξ² β Ξ±} {a : Ξ±} {s : Set Ξ±} {l : Filter Ξ²}
(h : Tendsto f l (π[s] a)) : βαΆ i in l, f i β s := by
simp_rw [nhdsWithin_eq, tendsto_iInf, mem_setOf_eq, tendsto_principal, mem_inter_iff,
eventually_and] at h
exact (h univ β¨mem_univ a, isOpen_univβ©).2
#align eventually_mem_of_tendsto_nhds_within eventually_mem_of_tendsto_nhdsWithin
theorem tendsto_nhds_of_tendsto_nhdsWithin {f : Ξ² β Ξ±} {a : Ξ±} {s : Set Ξ±} {l : Filter Ξ²}
(h : Tendsto f l (π[s] a)) : Tendsto f l (π a) :=
h.mono_right nhdsWithin_le_nhds
#align tendsto_nhds_of_tendsto_nhds_within tendsto_nhds_of_tendsto_nhdsWithin
theorem nhdsWithin_neBot_of_mem {s : Set Ξ±} {x : Ξ±} (hx : x β s) : NeBot (π[s] x) :=
mem_closure_iff_nhdsWithin_neBot.1 <| subset_closure hx
#align nhds_within_ne_bot_of_mem nhdsWithin_neBot_of_mem
theorem IsClosed.mem_of_nhdsWithin_neBot {s : Set Ξ±} (hs : IsClosed s) {x : Ξ±}
(hx : NeBot <| π[s] x) : x β s :=
hs.closure_eq βΈ mem_closure_iff_nhdsWithin_neBot.2 hx
#align is_closed.mem_of_nhds_within_ne_bot IsClosed.mem_of_nhdsWithin_neBot
theorem DenseRange.nhdsWithin_neBot {ΞΉ : Type*} {f : ΞΉ β Ξ±} (h : DenseRange f) (x : Ξ±) :
NeBot (π[range f] x) :=
mem_closure_iff_clusterPt.1 (h x)
#align dense_range.nhds_within_ne_bot DenseRange.nhdsWithin_neBot
theorem mem_closure_pi {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {I : Set ΞΉ}
{s : β i, Set (Ξ± i)} {x : β i, Ξ± i} : x β closure (pi I s) β β i β I, x i β closure (s i) := by
simp only [mem_closure_iff_nhdsWithin_neBot, nhdsWithin_pi_neBot]
#align mem_closure_pi mem_closure_pi
theorem closure_pi_set {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] (I : Set ΞΉ)
(s : β i, Set (Ξ± i)) : closure (pi I s) = pi I fun i => closure (s i) :=
Set.ext fun _ => mem_closure_pi
#align closure_pi_set closure_pi_set
theorem dense_pi {ΞΉ : Type*} {Ξ± : ΞΉ β Type*} [β i, TopologicalSpace (Ξ± i)] {s : β i, Set (Ξ± i)}
(I : Set ΞΉ) (hs : β i β I, Dense (s i)) : Dense (pi I s) := by
simp only [dense_iff_closure_eq, closure_pi_set, pi_congr rfl fun i hi => (hs i hi).closure_eq,
pi_univ]
#align dense_pi dense_pi
theorem eventuallyEq_nhdsWithin_iff {f g : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±} :
f =αΆ [π[s] a] g β βαΆ x in π a, x β s β f x = g x :=
mem_inf_principal
#align eventually_eq_nhds_within_iff eventuallyEq_nhdsWithin_iff
theorem eventuallyEq_nhdsWithin_of_eqOn {f g : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±} (h : EqOn f g s) :
f =αΆ [π[s] a] g :=
mem_inf_of_right h
#align eventually_eq_nhds_within_of_eq_on eventuallyEq_nhdsWithin_of_eqOn
theorem Set.EqOn.eventuallyEq_nhdsWithin {f g : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±} (h : EqOn f g s) :
f =αΆ [π[s] a] g :=
eventuallyEq_nhdsWithin_of_eqOn h
#align set.eq_on.eventually_eq_nhds_within Set.EqOn.eventuallyEq_nhdsWithin
theorem tendsto_nhdsWithin_congr {f g : Ξ± β Ξ²} {s : Set Ξ±} {a : Ξ±} {l : Filter Ξ²}
(hfg : β x β s, f x = g x) (hf : Tendsto f (π[s] a) l) : Tendsto g (π[s] a) l :=
(tendsto_congr' <| eventuallyEq_nhdsWithin_of_eqOn hfg).1 hf
#align tendsto_nhds_within_congr tendsto_nhdsWithin_congr
theorem eventually_nhdsWithin_of_forall {s : Set Ξ±} {a : Ξ±} {p : Ξ± β Prop} (h : β x β s, p x) :
βαΆ x in π[s] a, p x :=
mem_inf_of_right h
#align eventually_nhds_within_of_forall eventually_nhdsWithin_of_forall
theorem tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within {a : Ξ±} {l : Filter Ξ²} {s : Set Ξ±}
(f : Ξ² β Ξ±) (h1 : Tendsto f l (π a)) (h2 : βαΆ x in l, f x β s) : Tendsto f l (π[s] a) :=
tendsto_inf.2 β¨h1, tendsto_principal.2 h2β©
#align tendsto_nhds_within_of_tendsto_nhds_of_eventually_within tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
theorem tendsto_nhdsWithin_iff {a : Ξ±} {l : Filter Ξ²} {s : Set Ξ±} {f : Ξ² β Ξ±} :
Tendsto f l (π[s] a) β Tendsto f l (π a) β§ βαΆ n in l, f n β s :=
β¨fun h => β¨tendsto_nhds_of_tendsto_nhdsWithin h, eventually_mem_of_tendsto_nhdsWithin hβ©, fun h =>
tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ h.1 h.2β©
#align tendsto_nhds_within_iff tendsto_nhdsWithin_iff
@[simp]
theorem tendsto_nhdsWithin_range {a : Ξ±} {l : Filter Ξ²} {f : Ξ² β Ξ±} :
Tendsto f l (π[range f] a) β Tendsto f l (π a) :=
β¨fun h => h.mono_right inf_le_left, fun h =>
tendsto_inf.2 β¨h, tendsto_principal.2 <| eventually_of_forall mem_range_selfβ©β©
#align tendsto_nhds_within_range tendsto_nhdsWithin_range
theorem Filter.EventuallyEq.eq_of_nhdsWithin {s : Set Ξ±} {f g : Ξ± β Ξ²} {a : Ξ±} (h : f =αΆ [π[s] a] g)
(hmem : a β s) : f a = g a :=
h.self_of_nhdsWithin hmem
#align filter.eventually_eq.eq_of_nhds_within Filter.EventuallyEq.eq_of_nhdsWithin
theorem eventually_nhdsWithin_of_eventually_nhds {Ξ± : Type*} [TopologicalSpace Ξ±] {s : Set Ξ±}
{a : Ξ±} {p : Ξ± β Prop} (h : βαΆ x in π a, p x) : βαΆ x in π[s] a, p x :=
mem_nhdsWithin_of_mem_nhds h
#align eventually_nhds_within_of_eventually_nhds eventually_nhdsWithin_of_eventually_nhds
theorem mem_nhdsWithin_subtype {s : Set Ξ±} {a : { x // x β s }} {t u : Set { x // x β s }} :
t β π[u] a β t β comap ((β) : s β Ξ±) (π[(β) '' u] a) := by
rw [nhdsWithin, nhds_subtype, principal_subtype, β comap_inf, β nhdsWithin]
#align mem_nhds_within_subtype mem_nhdsWithin_subtype
theorem nhdsWithin_subtype (s : Set Ξ±) (a : { x // x β s }) (t : Set { x // x β s }) :
π[t] a = comap ((β) : s β Ξ±) (π[(β) '' t] a) :=
Filter.ext fun _ => mem_nhdsWithin_subtype
#align nhds_within_subtype nhdsWithin_subtype
theorem nhdsWithin_eq_map_subtype_coe {s : Set Ξ±} {a : Ξ±} (h : a β s) :
π[s] a = map ((β) : s β Ξ±) (π β¨a, hβ©) :=
(map_nhds_subtype_val β¨a, hβ©).symm
#align nhds_within_eq_map_subtype_coe nhdsWithin_eq_map_subtype_coe
theorem mem_nhds_subtype_iff_nhdsWithin {s : Set Ξ±} {a : s} {t : Set s} :
t β π a β (β) '' t β π[s] (a : Ξ±) := by
rw [β map_nhds_subtype_val, image_mem_map_iff Subtype.val_injective]
#align mem_nhds_subtype_iff_nhds_within mem_nhds_subtype_iff_nhdsWithin
theorem preimage_coe_mem_nhds_subtype {s t : Set Ξ±} {a : s} : (β) β»ΒΉ' t β π a β t β π[s] βa := by
rw [β map_nhds_subtype_val, mem_map]
#align preimage_coe_mem_nhds_subtype preimage_coe_mem_nhds_subtype
theorem eventually_nhds_subtype_iff (s : Set Ξ±) (a : s) (P : Ξ± β Prop) :
(βαΆ x : s in π a, P x) β βαΆ x in π[s] a, P x :=
preimage_coe_mem_nhds_subtype
theorem frequently_nhds_subtype_iff (s : Set Ξ±) (a : s) (P : Ξ± β Prop) :
(βαΆ x : s in π a, P x) β βαΆ x in π[s] a, P x :=
eventually_nhds_subtype_iff s a (Β¬ P Β·) |>.not
theorem tendsto_nhdsWithin_iff_subtype {s : Set Ξ±} {a : Ξ±} (h : a β s) (f : Ξ± β Ξ²) (l : Filter Ξ²) :
Tendsto f (π[s] a) l β Tendsto (s.restrict f) (π β¨a, hβ©) l := by
rw [nhdsWithin_eq_map_subtype_coe h, tendsto_map'_iff]; rfl
#align tendsto_nhds_within_iff_subtype tendsto_nhdsWithin_iff_subtype
variable [TopologicalSpace Ξ²] [TopologicalSpace Ξ³] [TopologicalSpace Ξ΄]
theorem ContinuousWithinAt.tendsto {f : Ξ± β Ξ²} {s : Set Ξ±} {x : Ξ±} (h : ContinuousWithinAt f s x) :
Tendsto f (π[s] x) (π (f x)) :=
h
#align continuous_within_at.tendsto ContinuousWithinAt.tendsto
theorem ContinuousOn.continuousWithinAt {f : Ξ± β Ξ²} {s : Set Ξ±} {x : Ξ±} (hf : ContinuousOn f s)
(hx : x β s) : ContinuousWithinAt f s x :=
hf x hx
#align continuous_on.continuous_within_at ContinuousOn.continuousWithinAt
theorem continuousWithinAt_univ (f : Ξ± β Ξ²) (x : Ξ±) :
ContinuousWithinAt f Set.univ x β ContinuousAt f x := by
rw [ContinuousAt, ContinuousWithinAt, nhdsWithin_univ]
#align continuous_within_at_univ continuousWithinAt_univ
theorem continuous_iff_continuousOn_univ {f : Ξ± β Ξ²} : Continuous f β ContinuousOn f univ := by
simp [continuous_iff_continuousAt, ContinuousOn, ContinuousAt, ContinuousWithinAt,
nhdsWithin_univ]
#align continuous_iff_continuous_on_univ continuous_iff_continuousOn_univ
theorem continuousWithinAt_iff_continuousAt_restrict (f : Ξ± β Ξ²) {x : Ξ±} {s : Set Ξ±} (h : x β s) :
ContinuousWithinAt f s x β ContinuousAt (s.restrict f) β¨x, hβ© :=
tendsto_nhdsWithin_iff_subtype h f _
#align continuous_within_at_iff_continuous_at_restrict continuousWithinAt_iff_continuousAt_restrict
theorem ContinuousWithinAt.tendsto_nhdsWithin {f : Ξ± β Ξ²} {x : Ξ±} {s : Set Ξ±} {t : Set Ξ²}
(h : ContinuousWithinAt f s x) (ht : MapsTo f s t) : Tendsto f (π[s] x) (π[t] f x) :=
tendsto_inf.2 β¨h, tendsto_principal.2 <| mem_inf_of_right <| mem_principal.2 <| htβ©
#align continuous_within_at.tendsto_nhds_within ContinuousWithinAt.tendsto_nhdsWithin
theorem ContinuousWithinAt.tendsto_nhdsWithin_image {f : Ξ± β Ξ²} {x : Ξ±} {s : Set Ξ±}
(h : ContinuousWithinAt f s x) : Tendsto f (π[s] x) (π[f '' s] f x) :=
h.tendsto_nhdsWithin (mapsTo_image _ _)
#align continuous_within_at.tendsto_nhds_within_image ContinuousWithinAt.tendsto_nhdsWithin_image
theorem ContinuousWithinAt.prod_map {f : Ξ± β Ξ³} {g : Ξ² β Ξ΄} {s : Set Ξ±} {t : Set Ξ²} {x : Ξ±} {y : Ξ²}
(hf : ContinuousWithinAt f s x) (hg : ContinuousWithinAt g t y) :
ContinuousWithinAt (Prod.map f g) (s ΓΛ’ t) (x, y) := by
unfold ContinuousWithinAt at *
rw [nhdsWithin_prod_eq, Prod.map, nhds_prod_eq]
exact hf.prod_map hg
#align continuous_within_at.prod_map ContinuousWithinAt.prod_map
theorem continuousWithinAt_prod_of_discrete_left [DiscreteTopology Ξ±]
{f : Ξ± Γ Ξ² β Ξ³} {s : Set (Ξ± Γ Ξ²)} {x : Ξ± Γ Ξ²} :
ContinuousWithinAt f s x β ContinuousWithinAt (f β¨x.1, Β·β©) {b | (x.1, b) β s} x.2 := by
rw [β x.eta]; simp_rw [ContinuousWithinAt, nhdsWithin, nhds_prod_eq, nhds_discrete, pure_prod,
β map_inf_principal_preimage]; rfl
theorem continuousWithinAt_prod_of_discrete_right [DiscreteTopology Ξ²]
{f : Ξ± Γ Ξ² β Ξ³} {s : Set (Ξ± Γ Ξ²)} {x : Ξ± Γ Ξ²} :
ContinuousWithinAt f s x β ContinuousWithinAt (f β¨Β·, x.2β©) {a | (a, x.2) β s} x.1 := by
rw [β x.eta]; simp_rw [ContinuousWithinAt, nhdsWithin, nhds_prod_eq, nhds_discrete, prod_pure,
β map_inf_principal_preimage]; rfl
theorem continuousAt_prod_of_discrete_left [DiscreteTopology Ξ±] {f : Ξ± Γ Ξ² β Ξ³} {x : Ξ± Γ Ξ²} :
ContinuousAt f x β ContinuousAt (f β¨x.1, Β·β©) x.2 := by
simp_rw [β continuousWithinAt_univ]; exact continuousWithinAt_prod_of_discrete_left
theorem continuousAt_prod_of_discrete_right [DiscreteTopology Ξ²] {f : Ξ± Γ Ξ² β Ξ³} {x : Ξ± Γ Ξ²} :
ContinuousAt f x β ContinuousAt (f β¨Β·, x.2β©) x.1 := by
simp_rw [β continuousWithinAt_univ]; exact continuousWithinAt_prod_of_discrete_right
theorem continuousOn_prod_of_discrete_left [DiscreteTopology Ξ±] {f : Ξ± Γ Ξ² β Ξ³} {s : Set (Ξ± Γ Ξ²)} :
ContinuousOn f s β β a, ContinuousOn (f β¨a, Β·β©) {b | (a, b) β s} := by
simp_rw [ContinuousOn, Prod.forall, continuousWithinAt_prod_of_discrete_left]; rfl
theorem continuousOn_prod_of_discrete_right [DiscreteTopology Ξ²] {f : Ξ± Γ Ξ² β Ξ³} {s : Set (Ξ± Γ Ξ²)} :
ContinuousOn f s β β b, ContinuousOn (f β¨Β·, bβ©) {a | (a, b) β s} := by
simp_rw [ContinuousOn, Prod.forall, continuousWithinAt_prod_of_discrete_right]; apply forall_swap
theorem continuous_prod_of_discrete_left [DiscreteTopology Ξ±] {f : Ξ± Γ Ξ² β Ξ³} :
Continuous f β β a, Continuous (f β¨a, Β·β©) := by
simp_rw [continuous_iff_continuousOn_univ]; exact continuousOn_prod_of_discrete_left
theorem continuous_prod_of_discrete_right [DiscreteTopology Ξ²] {f : Ξ± Γ Ξ² β Ξ³} :
Continuous f β β b, Continuous (f β¨Β·, bβ©) := by
simp_rw [continuous_iff_continuousOn_univ]; exact continuousOn_prod_of_discrete_right
theorem isOpenMap_prod_of_discrete_left [DiscreteTopology Ξ±] {f : Ξ± Γ Ξ² β Ξ³} :
IsOpenMap f β β a, IsOpenMap (f β¨a, Β·β©) := by
simp_rw [isOpenMap_iff_nhds_le, Prod.forall, nhds_prod_eq, nhds_discrete, pure_prod, map_map]
rfl
theorem isOpenMap_prod_of_discrete_right [DiscreteTopology Ξ²] {f : Ξ± Γ Ξ² β Ξ³} :
IsOpenMap f β β b, IsOpenMap (f β¨Β·, bβ©) := by
simp_rw [isOpenMap_iff_nhds_le, Prod.forall, forall_swap (Ξ± := Ξ±) (Ξ² := Ξ²), nhds_prod_eq,
nhds_discrete, prod_pure, map_map]; rfl
theorem continuousWithinAt_pi {ΞΉ : Type*} {Ο : ΞΉ β Type*} [β i, TopologicalSpace (Ο i)]
{f : Ξ± β β i, Ο i} {s : Set Ξ±} {x : Ξ±} :
ContinuousWithinAt f s x β β i, ContinuousWithinAt (fun y => f y i) s x :=
tendsto_pi_nhds
#align continuous_within_at_pi continuousWithinAt_pi
theorem continuousOn_pi {ΞΉ : Type*} {Ο : ΞΉ β Type*} [β i, TopologicalSpace (Ο i)]
{f : Ξ± β β i, Ο i} {s : Set Ξ±} : ContinuousOn f s β β i, ContinuousOn (fun y => f y i) s :=
β¨fun h i x hx => tendsto_pi_nhds.1 (h x hx) i, fun h x hx => tendsto_pi_nhds.2 fun i => h i x hxβ©
#align continuous_on_pi continuousOn_pi
@[fun_prop]
theorem continuousOn_pi' {ΞΉ : Type*} {Ο : ΞΉ β Type*} [β i, TopologicalSpace (Ο i)]
{f : Ξ± β β i, Ο i} {s : Set Ξ±} (hf : β i, ContinuousOn (fun y => f y i) s) :
ContinuousOn f s :=
continuousOn_pi.2 hf
theorem ContinuousWithinAt.fin_insertNth {n} {Ο : Fin (n + 1) β Type*}
[β i, TopologicalSpace (Ο i)] (i : Fin (n + 1)) {f : Ξ± β Ο i} {a : Ξ±} {s : Set Ξ±}
(hf : ContinuousWithinAt f s a) {g : Ξ± β β j : Fin n, Ο (i.succAbove j)}
(hg : ContinuousWithinAt g s a) : ContinuousWithinAt (fun a => i.insertNth (f a) (g a)) s a :=
hf.tendsto.fin_insertNth i hg
#align continuous_within_at.fin_insert_nth ContinuousWithinAt.fin_insertNth
nonrec theorem ContinuousOn.fin_insertNth {n} {Ο : Fin (n + 1) β Type*}
[β i, TopologicalSpace (Ο i)] (i : Fin (n + 1)) {f : Ξ± β Ο i} {s : Set Ξ±}
(hf : ContinuousOn f s) {g : Ξ± β β j : Fin n, Ο (i.succAbove j)} (hg : ContinuousOn g s) :
ContinuousOn (fun a => i.insertNth (f a) (g a)) s := fun a ha =>
(hf a ha).fin_insertNth i (hg a ha)
#align continuous_on.fin_insert_nth ContinuousOn.fin_insertNth
theorem continuousOn_iff {f : Ξ± β Ξ²} {s : Set Ξ±} :
ContinuousOn f s β
β x β s, β t : Set Ξ², IsOpen t β f x β t β β u, IsOpen u β§ x β u β§ u β© s β f β»ΒΉ' t := by
simp only [ContinuousOn, ContinuousWithinAt, tendsto_nhds, mem_nhdsWithin]
#align continuous_on_iff continuousOn_iff
theorem continuousOn_iff_continuous_restrict {f : Ξ± β Ξ²} {s : Set Ξ±} :
ContinuousOn f s β Continuous (s.restrict f) := by
rw [ContinuousOn, continuous_iff_continuousAt]; constructor
Β· rintro h β¨x, xsβ©
exact (continuousWithinAt_iff_continuousAt_restrict f xs).mp (h x xs)
intro h x xs
exact (continuousWithinAt_iff_continuousAt_restrict f xs).mpr (h β¨x, xsβ©)
#align continuous_on_iff_continuous_restrict continuousOn_iff_continuous_restrict
-- Porting note: 2 new lemmas
alias β¨ContinuousOn.restrict, _β© := continuousOn_iff_continuous_restrict
theorem ContinuousOn.restrict_mapsTo {f : Ξ± β Ξ²} {s : Set Ξ±} {t : Set Ξ²} (hf : ContinuousOn f s)
(ht : MapsTo f s t) : Continuous (ht.restrict f s t) :=
hf.restrict.codRestrict _
theorem continuousOn_iff' {f : Ξ± β Ξ²} {s : Set Ξ±} :
ContinuousOn f s β β t : Set Ξ², IsOpen t β β u, IsOpen u β§ f β»ΒΉ' t β© s = u β© s := by
have : β t, IsOpen (s.restrict f β»ΒΉ' t) β β u : Set Ξ±, IsOpen u β§ f β»ΒΉ' t β© s = u β© s := by
intro t
rw [isOpen_induced_iff, Set.restrict_eq, Set.preimage_comp]
simp only [Subtype.preimage_coe_eq_preimage_coe_iff]
constructor <;>
Β· rintro β¨u, ou, useqβ©
exact β¨u, ou, by simpa only [Set.inter_comm, eq_comm] using useqβ©
rw [continuousOn_iff_continuous_restrict, continuous_def]; simp only [this]
#align continuous_on_iff' continuousOn_iff'
theorem ContinuousOn.mono_dom {Ξ± Ξ² : Type*} {tβ tβ : TopologicalSpace Ξ±} {tβ : TopologicalSpace Ξ²}
(hβ : tβ β€ tβ) {s : Set Ξ±} {f : Ξ± β Ξ²} (hβ : @ContinuousOn Ξ± Ξ² tβ tβ f s) :
@ContinuousOn Ξ± Ξ² tβ tβ f s := fun x hx _u hu =>
map_mono (inf_le_inf_right _ <| nhds_mono hβ) (hβ x hx hu)
#align continuous_on.mono_dom ContinuousOn.mono_dom
theorem ContinuousOn.mono_rng {Ξ± Ξ² : Type*} {tβ : TopologicalSpace Ξ±} {tβ tβ : TopologicalSpace Ξ²}
(hβ : tβ β€ tβ) {s : Set Ξ±} {f : Ξ± β Ξ²} (hβ : @ContinuousOn Ξ± Ξ² tβ tβ f s) :
@ContinuousOn Ξ± Ξ² tβ tβ f s := fun x hx _u hu =>
hβ x hx <| nhds_mono hβ hu
#align continuous_on.mono_rng ContinuousOn.mono_rng
theorem continuousOn_iff_isClosed {f : Ξ± β Ξ²} {s : Set Ξ±} :
ContinuousOn f s β β t : Set Ξ², IsClosed t β β u, IsClosed u β§ f β»ΒΉ' t β© s = u β© s := by
have : β t, IsClosed (s.restrict f β»ΒΉ' t) β β u : Set Ξ±, IsClosed u β§ f β»ΒΉ' t β© s = u β© s := by
intro t
rw [isClosed_induced_iff, Set.restrict_eq, Set.preimage_comp]
simp only [Subtype.preimage_coe_eq_preimage_coe_iff, eq_comm, Set.inter_comm s]
rw [continuousOn_iff_continuous_restrict, continuous_iff_isClosed]; simp only [this]
#align continuous_on_iff_is_closed continuousOn_iff_isClosed
theorem ContinuousOn.prod_map {f : Ξ± β Ξ³} {g : Ξ² β Ξ΄} {s : Set Ξ±} {t : Set Ξ²}
(hf : ContinuousOn f s) (hg : ContinuousOn g t) : ContinuousOn (Prod.map f g) (s ΓΛ’ t) :=
fun β¨x, yβ© β¨hx, hyβ© => ContinuousWithinAt.prod_map (hf x hx) (hg y hy)
#align continuous_on.prod_map ContinuousOn.prod_map
theorem continuous_of_cover_nhds {ΞΉ : Sort*} {f : Ξ± β Ξ²} {s : ΞΉ β Set Ξ±}
(hs : β x : Ξ±, β i, s i β π x) (hf : β i, ContinuousOn f (s i)) :
Continuous f :=
continuous_iff_continuousAt.mpr fun x β¦ let β¨i, hiβ© := hs x; by
rw [ContinuousAt, β nhdsWithin_eq_nhds.2 hi]
exact hf _ _ (mem_of_mem_nhds hi)
#align continuous_of_cover_nhds continuous_of_cover_nhds
theorem continuousOn_empty (f : Ξ± β Ξ²) : ContinuousOn f β
:= fun _ => False.elim
#align continuous_on_empty continuousOn_empty
@[simp]
theorem continuousOn_singleton (f : Ξ± β Ξ²) (a : Ξ±) : ContinuousOn f {a} :=
forall_eq.2 <| by
simpa only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_left] using fun s =>
mem_of_mem_nhds
#align continuous_on_singleton continuousOn_singleton
theorem Set.Subsingleton.continuousOn {s : Set Ξ±} (hs : s.Subsingleton) (f : Ξ± β Ξ²) :
ContinuousOn f s :=
hs.induction_on (continuousOn_empty f) (continuousOn_singleton f)
#align set.subsingleton.continuous_on Set.Subsingleton.continuousOn
theorem nhdsWithin_le_comap {x : Ξ±} {s : Set Ξ±} {f : Ξ± β Ξ²} (ctsf : ContinuousWithinAt f s x) :
π[s] x β€ comap f (π[f '' s] f x) :=
ctsf.tendsto_nhdsWithin_image.le_comap
#align nhds_within_le_comap nhdsWithin_le_comap
@[simp]
theorem comap_nhdsWithin_range {Ξ±} (f : Ξ± β Ξ²) (y : Ξ²) : comap f (π[range f] y) = comap f (π y) :=
comap_inf_principal_range
#align comap_nhds_within_range comap_nhdsWithin_range
theorem ContinuousWithinAt.mono {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} (h : ContinuousWithinAt f t x)
(hs : s β t) : ContinuousWithinAt f s x :=
h.mono_left (nhdsWithin_mono x hs)
#align continuous_within_at.mono ContinuousWithinAt.mono
theorem ContinuousWithinAt.mono_of_mem {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±}
(h : ContinuousWithinAt f t x) (hs : t β π[s] x) : ContinuousWithinAt f s x :=
h.mono_left (nhdsWithin_le_of_mem hs)
#align continuous_within_at.mono_of_mem ContinuousWithinAt.mono_of_mem
theorem continuousWithinAt_congr_nhds {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} (h : π[s] x = π[t] x) :
ContinuousWithinAt f s x β ContinuousWithinAt f t x := by
simp only [ContinuousWithinAt, h]
theorem continuousWithinAt_inter' {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} (h : t β π[s] x) :
ContinuousWithinAt f (s β© t) x β ContinuousWithinAt f s x := by
simp [ContinuousWithinAt, nhdsWithin_restrict'' s h]
#align continuous_within_at_inter' continuousWithinAt_inter'
theorem continuousWithinAt_inter {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} (h : t β π x) :
ContinuousWithinAt f (s β© t) x β ContinuousWithinAt f s x := by
simp [ContinuousWithinAt, nhdsWithin_restrict' s h]
#align continuous_within_at_inter continuousWithinAt_inter
theorem continuousWithinAt_union {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} :
ContinuousWithinAt f (s βͺ t) x β ContinuousWithinAt f s x β§ ContinuousWithinAt f t x := by
simp only [ContinuousWithinAt, nhdsWithin_union, tendsto_sup]
#align continuous_within_at_union continuousWithinAt_union
theorem ContinuousWithinAt.union {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±} (hs : ContinuousWithinAt f s x)
(ht : ContinuousWithinAt f t x) : ContinuousWithinAt f (s βͺ t) x :=
continuousWithinAt_union.2 β¨hs, htβ©
#align continuous_within_at.union ContinuousWithinAt.union
theorem ContinuousWithinAt.mem_closure_image {f : Ξ± β Ξ²} {s : Set Ξ±} {x : Ξ±}
(h : ContinuousWithinAt f s x) (hx : x β closure s) : f x β closure (f '' s) :=
haveI := mem_closure_iff_nhdsWithin_neBot.1 hx
mem_closure_of_tendsto h <| mem_of_superset self_mem_nhdsWithin (subset_preimage_image f s)
#align continuous_within_at.mem_closure_image ContinuousWithinAt.mem_closure_image
theorem ContinuousWithinAt.mem_closure {f : Ξ± β Ξ²} {s : Set Ξ±} {x : Ξ±} {A : Set Ξ²}
(h : ContinuousWithinAt f s x) (hx : x β closure s) (hA : MapsTo f s A) : f x β closure A :=
closure_mono (image_subset_iff.2 hA) (h.mem_closure_image hx)
#align continuous_within_at.mem_closure ContinuousWithinAt.mem_closure
theorem Set.MapsTo.closure_of_continuousWithinAt {f : Ξ± β Ξ²} {s : Set Ξ±} {t : Set Ξ²}
(h : MapsTo f s t) (hc : β x β closure s, ContinuousWithinAt f s x) :
MapsTo f (closure s) (closure t) := fun x hx => (hc x hx).mem_closure hx h
#align set.maps_to.closure_of_continuous_within_at Set.MapsTo.closure_of_continuousWithinAt
theorem Set.MapsTo.closure_of_continuousOn {f : Ξ± β Ξ²} {s : Set Ξ±} {t : Set Ξ²} (h : MapsTo f s t)
(hc : ContinuousOn f (closure s)) : MapsTo f (closure s) (closure t) :=
h.closure_of_continuousWithinAt fun x hx => (hc x hx).mono subset_closure
#align set.maps_to.closure_of_continuous_on Set.MapsTo.closure_of_continuousOn
theorem ContinuousWithinAt.image_closure {f : Ξ± β Ξ²} {s : Set Ξ±}
(hf : β x β closure s, ContinuousWithinAt f s x) : f '' closure s β closure (f '' s) :=
((mapsTo_image f s).closure_of_continuousWithinAt hf).image_subset
#align continuous_within_at.image_closure ContinuousWithinAt.image_closure
theorem ContinuousOn.image_closure {f : Ξ± β Ξ²} {s : Set Ξ±} (hf : ContinuousOn f (closure s)) :
f '' closure s β closure (f '' s) :=
ContinuousWithinAt.image_closure fun x hx => (hf x hx).mono subset_closure
#align continuous_on.image_closure ContinuousOn.image_closure
@[simp]
theorem continuousWithinAt_singleton {f : Ξ± β Ξ²} {x : Ξ±} : ContinuousWithinAt f {x} x := by
simp only [ContinuousWithinAt, nhdsWithin_singleton, tendsto_pure_nhds]
#align continuous_within_at_singleton continuousWithinAt_singleton
@[simp]
theorem continuousWithinAt_insert_self {f : Ξ± β Ξ²} {x : Ξ±} {s : Set Ξ±} :
ContinuousWithinAt f (insert x s) x β ContinuousWithinAt f s x := by
simp only [β singleton_union, continuousWithinAt_union, continuousWithinAt_singleton,
true_and_iff]
#align continuous_within_at_insert_self continuousWithinAt_insert_self
alias β¨_, ContinuousWithinAt.insert_selfβ© := continuousWithinAt_insert_self
#align continuous_within_at.insert_self ContinuousWithinAt.insert_self
theorem ContinuousWithinAt.diff_iff {f : Ξ± β Ξ²} {s t : Set Ξ±} {x : Ξ±}
(ht : ContinuousWithinAt f t x) : ContinuousWithinAt f (s \ t) x β ContinuousWithinAt f s x :=
β¨fun h => (h.union ht).mono <| by simp only [diff_union_self, subset_union_left], fun h =>
h.mono diff_subsetβ©
#align continuous_within_at.diff_iff ContinuousWithinAt.diff_iff
@[simp]
theorem continuousWithinAt_diff_self {f : Ξ± β Ξ²} {s : Set Ξ±} {x : Ξ±} :
ContinuousWithinAt f (s \ {x}) x β ContinuousWithinAt f s x :=
continuousWithinAt_singleton.diff_iff
#align continuous_within_at_diff_self continuousWithinAt_diff_self
@[simp]
| Mathlib/Topology/ContinuousOn.lean | 830 | 832 | theorem continuousWithinAt_compl_self {f : Ξ± β Ξ²} {a : Ξ±} :
ContinuousWithinAt f {a}αΆ a β ContinuousAt f a := by |
rw [compl_eq_univ_diff, continuousWithinAt_diff_self, continuousWithinAt_univ]
|
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Int.Lemmas
import Mathlib.Data.Set.Subsingleton
import Mathlib.Init.Data.Nat.Lemmas
import Mathlib.Order.GaloisConnection
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Positivity
#align_import algebra.order.floor from "leanprover-community/mathlib"@"afdb43429311b885a7988ea15d0bac2aac80f69c"
open Set
variable {F Ξ± Ξ² : Type*}
class FloorSemiring (Ξ±) [OrderedSemiring Ξ±] where
floor : Ξ± β β
ceil : Ξ± β β
floor_of_neg {a : Ξ±} (ha : a < 0) : floor a = 0
gc_floor {a : Ξ±} {n : β} (ha : 0 β€ a) : n β€ floor a β (n : Ξ±) β€ a
gc_ceil : GaloisConnection ceil (β)
#align floor_semiring FloorSemiring
instance : FloorSemiring β where
floor := id
ceil := id
floor_of_neg ha := (Nat.not_lt_zero _ ha).elim
gc_floor _ := by
rw [Nat.cast_id]
rfl
gc_ceil n a := by
rw [Nat.cast_id]
rfl
namespace Nat
theorem subsingleton_floorSemiring {Ξ±} [LinearOrderedSemiring Ξ±] :
Subsingleton (FloorSemiring Ξ±) := by
refine β¨fun Hβ Hβ => ?_β©
have : Hβ.ceil = Hβ.ceil := funext fun a => (Hβ.gc_ceil.l_unique Hβ.gc_ceil) fun n => rfl
have : Hβ.floor = Hβ.floor := by
ext a
cases' lt_or_le a 0 with h h
Β· rw [Hβ.floor_of_neg, Hβ.floor_of_neg] <;> exact h
Β· refine eq_of_forall_le_iff fun n => ?_
rw [Hβ.gc_floor, Hβ.gc_floor] <;> exact h
cases Hβ
cases Hβ
congr
#align subsingleton_floor_semiring subsingleton_floorSemiring
class FloorRing (Ξ±) [LinearOrderedRing Ξ±] where
floor : Ξ± β β€
ceil : Ξ± β β€
gc_coe_floor : GaloisConnection (β) floor
gc_ceil_coe : GaloisConnection ceil (β)
#align floor_ring FloorRing
instance : FloorRing β€ where
floor := id
ceil := id
gc_coe_floor a b := by
rw [Int.cast_id]
rfl
gc_ceil_coe a b := by
rw [Int.cast_id]
rfl
def FloorRing.ofFloor (Ξ±) [LinearOrderedRing Ξ±] (floor : Ξ± β β€)
(gc_coe_floor : GaloisConnection (β) floor) : FloorRing Ξ± :=
{ floor
ceil := fun a => -floor (-a)
gc_coe_floor
gc_ceil_coe := fun a z => by rw [neg_le, β gc_coe_floor, Int.cast_neg, neg_le_neg_iff] }
#align floor_ring.of_floor FloorRing.ofFloor
def FloorRing.ofCeil (Ξ±) [LinearOrderedRing Ξ±] (ceil : Ξ± β β€)
(gc_ceil_coe : GaloisConnection ceil (β)) : FloorRing Ξ± :=
{ floor := fun a => -ceil (-a)
ceil
gc_coe_floor := fun a z => by rw [le_neg, gc_ceil_coe, Int.cast_neg, neg_le_neg_iff]
gc_ceil_coe }
#align floor_ring.of_ceil FloorRing.ofCeil
namespace Int
variable [LinearOrderedRing Ξ±] [FloorRing Ξ±] {z : β€} {a : Ξ±}
def floor : Ξ± β β€ :=
FloorRing.floor
#align int.floor Int.floor
def ceil : Ξ± β β€ :=
FloorRing.ceil
#align int.ceil Int.ceil
def fract (a : Ξ±) : Ξ± :=
a - floor a
#align int.fract Int.fract
@[simp]
theorem floor_int : (Int.floor : β€ β β€) = id :=
rfl
#align int.floor_int Int.floor_int
@[simp]
theorem ceil_int : (Int.ceil : β€ β β€) = id :=
rfl
#align int.ceil_int Int.ceil_int
@[simp]
theorem fract_int : (Int.fract : β€ β β€) = 0 :=
funext fun x => by simp [fract]
#align int.fract_int Int.fract_int
@[inherit_doc]
notation "β" a "β" => Int.floor a
@[inherit_doc]
notation "β" a "β" => Int.ceil a
-- Mathematical notation for `fract a` is usually `{a}`. Let's not even go there.
@[simp]
theorem floorRing_floor_eq : @FloorRing.floor = @Int.floor :=
rfl
#align int.floor_ring_floor_eq Int.floorRing_floor_eq
@[simp]
theorem floorRing_ceil_eq : @FloorRing.ceil = @Int.ceil :=
rfl
#align int.floor_ring_ceil_eq Int.floorRing_ceil_eq
theorem gc_coe_floor : GaloisConnection ((β) : β€ β Ξ±) floor :=
FloorRing.gc_coe_floor
#align int.gc_coe_floor Int.gc_coe_floor
theorem le_floor : z β€ βaβ β (z : Ξ±) β€ a :=
(gc_coe_floor z a).symm
#align int.le_floor Int.le_floor
theorem floor_lt : βaβ < z β a < z :=
lt_iff_lt_of_le_iff_le le_floor
#align int.floor_lt Int.floor_lt
theorem floor_le (a : Ξ±) : (βaβ : Ξ±) β€ a :=
gc_coe_floor.l_u_le a
#align int.floor_le Int.floor_le
theorem floor_nonneg : 0 β€ βaβ β 0 β€ a := by rw [le_floor, Int.cast_zero]
#align int.floor_nonneg Int.floor_nonneg
@[simp]
theorem floor_le_sub_one_iff : βaβ β€ z - 1 β a < z := by rw [β floor_lt, le_sub_one_iff]
#align int.floor_le_sub_one_iff Int.floor_le_sub_one_iff
@[simp]
theorem floor_le_neg_one_iff : βaβ β€ -1 β a < 0 := by
rw [β zero_sub (1 : β€), floor_le_sub_one_iff, cast_zero]
#align int.floor_le_neg_one_iff Int.floor_le_neg_one_iff
theorem floor_nonpos (ha : a β€ 0) : βaβ β€ 0 := by
rw [β @cast_le Ξ±, Int.cast_zero]
exact (floor_le a).trans ha
#align int.floor_nonpos Int.floor_nonpos
theorem lt_succ_floor (a : Ξ±) : a < βaβ.succ :=
floor_lt.1 <| Int.lt_succ_self _
#align int.lt_succ_floor Int.lt_succ_floor
@[simp]
theorem lt_floor_add_one (a : Ξ±) : a < βaβ + 1 := by
simpa only [Int.succ, Int.cast_add, Int.cast_one] using lt_succ_floor a
#align int.lt_floor_add_one Int.lt_floor_add_one
@[simp]
theorem sub_one_lt_floor (a : Ξ±) : a - 1 < βaβ :=
sub_lt_iff_lt_add.2 (lt_floor_add_one a)
#align int.sub_one_lt_floor Int.sub_one_lt_floor
@[simp]
theorem floor_intCast (z : β€) : β(z : Ξ±)β = z :=
eq_of_forall_le_iff fun a => by rw [le_floor, Int.cast_le]
#align int.floor_int_cast Int.floor_intCast
@[simp]
theorem floor_natCast (n : β) : β(n : Ξ±)β = n :=
eq_of_forall_le_iff fun a => by rw [le_floor, β cast_natCast, cast_le]
#align int.floor_nat_cast Int.floor_natCast
@[simp]
theorem floor_zero : β(0 : Ξ±)β = 0 := by rw [β cast_zero, floor_intCast]
#align int.floor_zero Int.floor_zero
@[simp]
theorem floor_one : β(1 : Ξ±)β = 1 := by rw [β cast_one, floor_intCast]
#align int.floor_one Int.floor_one
-- See note [no_index around OfNat.ofNat]
@[simp] theorem floor_ofNat (n : β) [n.AtLeastTwo] : β(no_index (OfNat.ofNat n : Ξ±))β = n :=
floor_natCast n
@[mono]
theorem floor_mono : Monotone (floor : Ξ± β β€) :=
gc_coe_floor.monotone_u
#align int.floor_mono Int.floor_mono
@[gcongr]
theorem floor_le_floor : β x y : Ξ±, x β€ y β βxβ β€ βyβ := floor_mono
theorem floor_pos : 0 < βaβ β 1 β€ a := by
-- Porting note: broken `convert le_floor`
rw [Int.lt_iff_add_one_le, zero_add, le_floor, cast_one]
#align int.floor_pos Int.floor_pos
@[simp]
theorem floor_add_int (a : Ξ±) (z : β€) : βa + zβ = βaβ + z :=
eq_of_forall_le_iff fun a => by
rw [le_floor, β sub_le_iff_le_add, β sub_le_iff_le_add, le_floor, Int.cast_sub]
#align int.floor_add_int Int.floor_add_int
@[simp]
theorem floor_add_one (a : Ξ±) : βa + 1β = βaβ + 1 := by
-- Porting note: broken `convert floor_add_int a 1`
rw [β cast_one, floor_add_int]
#align int.floor_add_one Int.floor_add_one
theorem le_floor_add (a b : Ξ±) : βaβ + βbβ β€ βa + bβ := by
rw [le_floor, Int.cast_add]
exact add_le_add (floor_le _) (floor_le _)
#align int.le_floor_add Int.le_floor_add
theorem le_floor_add_floor (a b : Ξ±) : βa + bβ - 1 β€ βaβ + βbβ := by
rw [β sub_le_iff_le_add, le_floor, Int.cast_sub, sub_le_comm, Int.cast_sub, Int.cast_one]
refine le_trans ?_ (sub_one_lt_floor _).le
rw [sub_le_iff_le_add', β add_sub_assoc, sub_le_sub_iff_right]
exact floor_le _
#align int.le_floor_add_floor Int.le_floor_add_floor
@[simp]
theorem floor_int_add (z : β€) (a : Ξ±) : ββz + aβ = z + βaβ := by
simpa only [add_comm] using floor_add_int a z
#align int.floor_int_add Int.floor_int_add
@[simp]
| Mathlib/Algebra/Order/Floor.lean | 802 | 803 | theorem floor_add_nat (a : Ξ±) (n : β) : βa + nβ = βaβ + n := by |
rw [β Int.cast_natCast, floor_add_int]
|
import Mathlib.MeasureTheory.Measure.Doubling
import Mathlib.MeasureTheory.Covering.Vitali
import Mathlib.MeasureTheory.Covering.Differentiation
#align_import measure_theory.covering.density_theorem from "leanprover-community/mathlib"@"5f6e827d81dfbeb6151d7016586ceeb0099b9655"
noncomputable section
open Set Filter Metric MeasureTheory TopologicalSpace
open scoped NNReal Topology
namespace IsUnifLocDoublingMeasure
variable {Ξ± : Type*} [MetricSpace Ξ±] [MeasurableSpace Ξ±] (ΞΌ : Measure Ξ±)
[IsUnifLocDoublingMeasure ΞΌ]
section
variable [SecondCountableTopology Ξ±] [BorelSpace Ξ±] [IsLocallyFiniteMeasure ΞΌ]
open scoped Topology
irreducible_def vitaliFamily (K : β) : VitaliFamily ΞΌ := by
let R := scalingScaleOf ΞΌ (max (4 * K + 3) 3)
have Rpos : 0 < R := scalingScaleOf_pos _ _
have A : β x : Ξ±, βαΆ r in π[>] (0 : β),
ΞΌ (closedBall x (3 * r)) β€ scalingConstantOf ΞΌ (max (4 * K + 3) 3) * ΞΌ (closedBall x r) := by
intro x
apply frequently_iff.2 fun {U} hU => ?_
obtain β¨Ξ΅, Ξ΅pos, hΞ΅β© := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hU
refine β¨min Ξ΅ R, hΞ΅ β¨lt_min Ξ΅pos Rpos, min_le_left _ _β©, ?_β©
exact measure_mul_le_scalingConstantOf_mul ΞΌ
β¨zero_lt_three, le_max_right _ _β© (min_le_right _ _)
exact (Vitali.vitaliFamily ΞΌ (scalingConstantOf ΞΌ (max (4 * K + 3) 3)) A).enlarge (R / 4)
(by linarith)
#align is_unif_loc_doubling_measure.vitali_family IsUnifLocDoublingMeasure.vitaliFamily
theorem closedBall_mem_vitaliFamily_of_dist_le_mul {K : β} {x y : Ξ±} {r : β} (h : dist x y β€ K * r)
(rpos : 0 < r) : closedBall y r β (vitaliFamily ΞΌ K).setsAt x := by
let R := scalingScaleOf ΞΌ (max (4 * K + 3) 3)
simp only [vitaliFamily, VitaliFamily.enlarge, Vitali.vitaliFamily, mem_union, mem_setOf_eq,
isClosed_ball, true_and_iff, (nonempty_ball.2 rpos).mono ball_subset_interior_closedBall,
measurableSet_closedBall]
by_cases H : closedBall y r β closedBall x (R / 4)
swap; Β· exact Or.inr H
left
rcases le_or_lt r R with (hr | hr)
Β· refine β¨(K + 1) * r, ?_β©
constructor
Β· apply closedBall_subset_closedBall'
rw [dist_comm]
linarith
Β· have I1 : closedBall x (3 * ((K + 1) * r)) β closedBall y ((4 * K + 3) * r) := by
apply closedBall_subset_closedBall'
linarith
have I2 : closedBall y ((4 * K + 3) * r) β closedBall y (max (4 * K + 3) 3 * r) := by
apply closedBall_subset_closedBall
exact mul_le_mul_of_nonneg_right (le_max_left _ _) rpos.le
apply (measure_mono (I1.trans I2)).trans
exact measure_mul_le_scalingConstantOf_mul _
β¨zero_lt_three.trans_le (le_max_right _ _), le_rflβ© hr
Β· refine β¨R / 4, H, ?_β©
have : closedBall x (3 * (R / 4)) β closedBall y r := by
apply closedBall_subset_closedBall'
have A : y β closedBall y r := mem_closedBall_self rpos.le
have B := mem_closedBall'.1 (H A)
linarith
apply (measure_mono this).trans _
refine le_mul_of_one_le_left (zero_le _) ?_
exact ENNReal.one_le_coe_iff.2 (le_max_right _ _)
#align is_unif_loc_doubling_measure.closed_ball_mem_vitali_family_of_dist_le_mul IsUnifLocDoublingMeasure.closedBall_mem_vitaliFamily_of_dist_le_mul
theorem tendsto_closedBall_filterAt {K : β} {x : Ξ±} {ΞΉ : Type*} {l : Filter ΞΉ} (w : ΞΉ β Ξ±)
(Ξ΄ : ΞΉ β β) (Ξ΄lim : Tendsto Ξ΄ l (π[>] 0)) (xmem : βαΆ j in l, x β closedBall (w j) (K * Ξ΄ j)) :
Tendsto (fun j => closedBall (w j) (Ξ΄ j)) l ((vitaliFamily ΞΌ K).filterAt x) := by
refine (vitaliFamily ΞΌ K).tendsto_filterAt_iff.mpr β¨?_, fun Ξ΅ hΞ΅ => ?_β©
Β· filter_upwards [xmem, Ξ΄lim self_mem_nhdsWithin] with j hj h'j
exact closedBall_mem_vitaliFamily_of_dist_le_mul ΞΌ hj h'j
Β· rcases l.eq_or_neBot with rfl | h
Β· simp
have hK : 0 β€ K := by
rcases (xmem.and (Ξ΄lim self_mem_nhdsWithin)).exists with β¨j, hj, h'jβ©
have : 0 β€ K * Ξ΄ j := nonempty_closedBall.1 β¨x, hjβ©
exact (mul_nonneg_iff_left_nonneg_of_pos (mem_Ioi.1 h'j)).1 this
have Ξ΄pos := eventually_mem_of_tendsto_nhdsWithin Ξ΄lim
replace Ξ΄lim := tendsto_nhds_of_tendsto_nhdsWithin Ξ΄lim
replace hK : 0 < K + 1 := by linarith
apply (((Metric.tendsto_nhds.mp Ξ΄lim _ (div_pos hΞ΅ hK)).and Ξ΄pos).and xmem).mono
rintro j β¨β¨hjΞ΅, hjβ : 0 < Ξ΄ jβ©, hxβ© y hy
replace hjΞ΅ : (K + 1) * Ξ΄ j < Ξ΅ := by
simpa [abs_eq_self.mpr hjβ.le] using (lt_div_iff' hK).mp hjΞ΅
simp only [mem_closedBall] at hx hy β’
linarith [dist_triangle_right y x (w j)]
#align is_unif_loc_doubling_measure.tendsto_closed_ball_filter_at IsUnifLocDoublingMeasure.tendsto_closedBall_filterAt
end
section Applications
variable [SecondCountableTopology Ξ±] [BorelSpace Ξ±] [IsLocallyFiniteMeasure ΞΌ] {E : Type*}
[NormedAddCommGroup E]
| Mathlib/MeasureTheory/Covering/DensityTheorem.lean | 146 | 151 | theorem ae_tendsto_measure_inter_div (S : Set Ξ±) (K : β) : βα΅ x βΞΌ.restrict S,
β {ΞΉ : Type*} {l : Filter ΞΉ} (w : ΞΉ β Ξ±) (Ξ΄ : ΞΉ β β) (Ξ΄lim : Tendsto Ξ΄ l (π[>] 0))
(xmem : βαΆ j in l, x β closedBall (w j) (K * Ξ΄ j)),
Tendsto (fun j => ΞΌ (S β© closedBall (w j) (Ξ΄ j)) / ΞΌ (closedBall (w j) (Ξ΄ j))) l (π 1) := by |
filter_upwards [(vitaliFamily ΞΌ K).ae_tendsto_measure_inter_div S] with x hx ΞΉ l w Ξ΄ Ξ΄lim
xmem using hx.comp (tendsto_closedBall_filterAt ΞΌ _ _ Ξ΄lim xmem)
|
import Mathlib.Data.Nat.Prime
import Mathlib.Data.PNat.Basic
#align_import data.pnat.prime from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f"
namespace PNat
open Nat
def gcd (n m : β+) : β+ :=
β¨Nat.gcd (n : β) (m : β), Nat.gcd_pos_of_pos_left (m : β) n.posβ©
#align pnat.gcd PNat.gcd
def lcm (n m : β+) : β+ :=
β¨Nat.lcm (n : β) (m : β), by
let h := mul_pos n.pos m.pos
rw [β gcd_mul_lcm (n : β) (m : β), mul_comm] at h
exact pos_of_dvd_of_pos (Dvd.intro (Nat.gcd (n : β) (m : β)) rfl) hβ©
#align pnat.lcm PNat.lcm
@[simp, norm_cast]
theorem gcd_coe (n m : β+) : (gcd n m : β) = Nat.gcd n m :=
rfl
#align pnat.gcd_coe PNat.gcd_coe
@[simp, norm_cast]
theorem lcm_coe (n m : β+) : (lcm n m : β) = Nat.lcm n m :=
rfl
#align pnat.lcm_coe PNat.lcm_coe
theorem gcd_dvd_left (n m : β+) : gcd n m β£ n :=
dvd_iff.2 (Nat.gcd_dvd_left (n : β) (m : β))
#align pnat.gcd_dvd_left PNat.gcd_dvd_left
theorem gcd_dvd_right (n m : β+) : gcd n m β£ m :=
dvd_iff.2 (Nat.gcd_dvd_right (n : β) (m : β))
#align pnat.gcd_dvd_right PNat.gcd_dvd_right
theorem dvd_gcd {m n k : β+} (hm : k β£ m) (hn : k β£ n) : k β£ gcd m n :=
dvd_iff.2 (Nat.dvd_gcd (dvd_iff.1 hm) (dvd_iff.1 hn))
#align pnat.dvd_gcd PNat.dvd_gcd
theorem dvd_lcm_left (n m : β+) : n β£ lcm n m :=
dvd_iff.2 (Nat.dvd_lcm_left (n : β) (m : β))
#align pnat.dvd_lcm_left PNat.dvd_lcm_left
theorem dvd_lcm_right (n m : β+) : m β£ lcm n m :=
dvd_iff.2 (Nat.dvd_lcm_right (n : β) (m : β))
#align pnat.dvd_lcm_right PNat.dvd_lcm_right
theorem lcm_dvd {m n k : β+} (hm : m β£ k) (hn : n β£ k) : lcm m n β£ k :=
dvd_iff.2 (@Nat.lcm_dvd (m : β) (n : β) (k : β) (dvd_iff.1 hm) (dvd_iff.1 hn))
#align pnat.lcm_dvd PNat.lcm_dvd
theorem gcd_mul_lcm (n m : β+) : gcd n m * lcm n m = n * m :=
Subtype.eq (Nat.gcd_mul_lcm (n : β) (m : β))
#align pnat.gcd_mul_lcm PNat.gcd_mul_lcm
theorem eq_one_of_lt_two {n : β+} : n < 2 β n = 1 := by
intro h; apply le_antisymm; swap
Β· apply PNat.one_le
Β· exact PNat.lt_add_one_iff.1 h
#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_two
section Coprime
def Coprime (m n : β+) : Prop :=
m.gcd n = 1
#align pnat.coprime PNat.Coprime
@[simp, norm_cast]
theorem coprime_coe {m n : β+} : Nat.Coprime βm βn β m.Coprime n := by
unfold Nat.Coprime Coprime
rw [β coe_inj]
simp
#align pnat.coprime_coe PNat.coprime_coe
theorem Coprime.mul {k m n : β+} : m.Coprime k β n.Coprime k β (m * n).Coprime k := by
repeat rw [β coprime_coe]
rw [mul_coe]
apply Nat.Coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
theorem Coprime.mul_right {k m n : β+} : k.Coprime m β k.Coprime n β k.Coprime (m * n) := by
repeat rw [β coprime_coe]
rw [mul_coe]
apply Nat.Coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
theorem gcd_comm {m n : β+} : m.gcd n = n.gcd m := by
apply eq
simp only [gcd_coe]
apply Nat.gcd_comm
#align pnat.gcd_comm PNat.gcd_comm
theorem gcd_eq_left_iff_dvd {m n : β+} : m β£ n β m.gcd n = m := by
rw [dvd_iff]
rw [Nat.gcd_eq_left_iff_dvd]
rw [β coe_inj]
simp
#align pnat.gcd_eq_left_iff_dvd PNat.gcd_eq_left_iff_dvd
theorem gcd_eq_right_iff_dvd {m n : β+} : m β£ n β n.gcd m = m := by
rw [gcd_comm]
apply gcd_eq_left_iff_dvd
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
theorem Coprime.gcd_mul_left_cancel (m : β+) {n k : β+} :
k.Coprime n β (k * m).gcd n = m.gcd n := by
intro h; apply eq; simp only [gcd_coe, mul_coe]
apply Nat.Coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
theorem Coprime.gcd_mul_right_cancel (m : β+) {n k : β+} :
k.Coprime n β (m * k).gcd n = m.gcd n := by rw [mul_comm]; apply Coprime.gcd_mul_left_cancel
#align pnat.coprime.gcd_mul_right_cancel PNat.Coprime.gcd_mul_right_cancel
theorem Coprime.gcd_mul_left_cancel_right (m : β+) {n k : β+} :
k.Coprime m β m.gcd (k * n) = m.gcd n := by
intro h; iterate 2 rw [gcd_comm]; symm;
apply Coprime.gcd_mul_left_cancel _ h
#align pnat.coprime.gcd_mul_left_cancel_right PNat.Coprime.gcd_mul_left_cancel_right
theorem Coprime.gcd_mul_right_cancel_right (m : β+) {n k : β+} :
k.Coprime m β m.gcd (n * k) = m.gcd n := by
rw [mul_comm];
apply Coprime.gcd_mul_left_cancel_right
#align pnat.coprime.gcd_mul_right_cancel_right PNat.Coprime.gcd_mul_right_cancel_right
@[simp]
theorem one_gcd {n : β+} : gcd 1 n = 1 := by
rw [β gcd_eq_left_iff_dvd]
apply one_dvd
#align pnat.one_gcd PNat.one_gcd
@[simp]
theorem gcd_one {n : β+} : gcd n 1 = 1 := by
rw [gcd_comm]
apply one_gcd
#align pnat.gcd_one PNat.gcd_one
@[symm]
| Mathlib/Data/PNat/Prime.lean | 257 | 260 | theorem Coprime.symm {m n : β+} : m.Coprime n β n.Coprime m := by |
unfold Coprime
rw [gcd_comm]
simp
|
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]
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]
#align roots_of_unity.coe_pow rootsOfUnity.coe_pow
@[mk_iff IsPrimitiveRoot.iff_def]
structure IsPrimitiveRoot (ΞΆ : M) (k : β) : Prop where
pow_eq_one : ΞΆ ^ (k : β) = 1
dvd_of_pow_eq_one : β l : β, ΞΆ ^ l = 1 β k β£ l
#align is_primitive_root IsPrimitiveRoot
#align is_primitive_root.iff_def IsPrimitiveRoot.iff_def
@[simps!]
def IsPrimitiveRoot.toRootsOfUnity {ΞΌ : M} {n : β+} (h : IsPrimitiveRoot ΞΌ n) : rootsOfUnity n M :=
rootsOfUnity.mkOfPowEq ΞΌ h.pow_eq_one
#align is_primitive_root.to_roots_of_unity IsPrimitiveRoot.toRootsOfUnity
#align is_primitive_root.coe_to_roots_of_unity_coe IsPrimitiveRoot.val_toRootsOfUnity_coe
#align is_primitive_root.coe_inv_to_roots_of_unity_coe IsPrimitiveRoot.val_inv_toRootsOfUnity_coe
namespace IsPrimitiveRoot
variable {k l : β}
theorem mk_of_lt (ΞΆ : M) (hk : 0 < k) (h1 : ΞΆ ^ k = 1) (h : β l : β, 0 < l β l < k β ΞΆ ^ l β 1) :
IsPrimitiveRoot ΞΆ k := by
refine β¨h1, fun l hl => ?_β©
suffices k.gcd l = k by exact this βΈ k.gcd_dvd_right l
rw [eq_iff_le_not_lt]
refine β¨Nat.le_of_dvd hk (k.gcd_dvd_left l), ?_β©
intro h'; apply h _ (Nat.gcd_pos_of_pos_left _ hk) h'
exact pow_gcd_eq_one _ h1 hl
#align is_primitive_root.mk_of_lt IsPrimitiveRoot.mk_of_lt
section CommMonoid
variable {ΞΆ : M} {f : F} (h : IsPrimitiveRoot ΞΆ k)
@[nontriviality]
theorem of_subsingleton [Subsingleton M] (x : M) : IsPrimitiveRoot x 1 :=
β¨Subsingleton.elim _ _, fun _ _ => one_dvd _β©
#align is_primitive_root.of_subsingleton IsPrimitiveRoot.of_subsingleton
theorem pow_eq_one_iff_dvd (l : β) : ΞΆ ^ l = 1 β k β£ l :=
β¨h.dvd_of_pow_eq_one l, by
rintro β¨i, rflβ©; simp only [pow_mul, h.pow_eq_one, one_pow, PNat.mul_coe]β©
#align is_primitive_root.pow_eq_one_iff_dvd IsPrimitiveRoot.pow_eq_one_iff_dvd
theorem isUnit (h : IsPrimitiveRoot ΞΆ k) (h0 : 0 < k) : IsUnit ΞΆ := by
apply isUnit_of_mul_eq_one ΞΆ (ΞΆ ^ (k - 1))
rw [β pow_succ', tsub_add_cancel_of_le h0.nat_succ_le, h.pow_eq_one]
#align is_primitive_root.is_unit IsPrimitiveRoot.isUnit
theorem pow_ne_one_of_pos_of_lt (h0 : 0 < l) (hl : l < k) : ΞΆ ^ l β 1 :=
mt (Nat.le_of_dvd h0 β h.dvd_of_pow_eq_one _) <| not_le_of_lt hl
#align is_primitive_root.pow_ne_one_of_pos_of_lt IsPrimitiveRoot.pow_ne_one_of_pos_of_lt
theorem ne_one (hk : 1 < k) : ΞΆ β 1 :=
h.pow_ne_one_of_pos_of_lt zero_lt_one hk β (pow_one ΞΆ).trans
#align is_primitive_root.ne_one IsPrimitiveRoot.ne_one
theorem pow_inj (h : IsPrimitiveRoot ΞΆ k) β¦i j : ββ¦ (hi : i < k) (hj : j < k) (H : ΞΆ ^ i = ΞΆ ^ j) :
i = j := by
wlog hij : i β€ j generalizing i j
Β· exact (this hj hi H.symm (le_of_not_le hij)).symm
apply le_antisymm hij
rw [β tsub_eq_zero_iff_le]
apply Nat.eq_zero_of_dvd_of_lt _ (lt_of_le_of_lt tsub_le_self hj)
apply h.dvd_of_pow_eq_one
rw [β ((h.isUnit (lt_of_le_of_lt (Nat.zero_le _) hi)).pow i).mul_left_inj, β pow_add,
tsub_add_cancel_of_le hij, H, one_mul]
#align is_primitive_root.pow_inj IsPrimitiveRoot.pow_inj
theorem one : IsPrimitiveRoot (1 : M) 1 :=
{ pow_eq_one := pow_one _
dvd_of_pow_eq_one := fun _ _ => one_dvd _ }
#align is_primitive_root.one IsPrimitiveRoot.one
@[simp]
theorem one_right_iff : IsPrimitiveRoot ΞΆ 1 β ΞΆ = 1 := by
clear h
constructor
Β· intro h; rw [β pow_one ΞΆ, h.pow_eq_one]
Β· rintro rfl; exact one
#align is_primitive_root.one_right_iff IsPrimitiveRoot.one_right_iff
@[simp]
theorem coe_submonoidClass_iff {M B : Type*} [CommMonoid M] [SetLike B M] [SubmonoidClass B M]
{N : B} {ΞΆ : N} : IsPrimitiveRoot (ΞΆ : M) k β IsPrimitiveRoot ΞΆ k := by
simp_rw [iff_def]
norm_cast
#align is_primitive_root.coe_submonoid_class_iff IsPrimitiveRoot.coe_submonoidClass_iff
@[simp]
theorem coe_units_iff {ΞΆ : MΛ£} : IsPrimitiveRoot (ΞΆ : M) k β IsPrimitiveRoot ΞΆ k := by
simp only [iff_def, Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one]
#align is_primitive_root.coe_units_iff IsPrimitiveRoot.coe_units_iff
lemma isUnit_unit {ΞΆ : M} {n} (hn) (hΞΆ : IsPrimitiveRoot ΞΆ n) :
IsPrimitiveRoot (hΞΆ.isUnit hn).unit n := coe_units_iff.mp hΞΆ
lemma isUnit_unit' {ΞΆ : G} {n} (hn) (hΞΆ : IsPrimitiveRoot ΞΆ n) :
IsPrimitiveRoot (hΞΆ.isUnit hn).unit' n := coe_units_iff.mp hΞΆ
-- Porting note `variable` above already contains `(h : IsPrimitiveRoot ΞΆ k)`
theorem pow_of_coprime (i : β) (hi : i.Coprime k) : IsPrimitiveRoot (ΞΆ ^ i) k := by
by_cases h0 : k = 0
Β· subst k; simp_all only [pow_one, Nat.coprime_zero_right]
rcases h.isUnit (Nat.pos_of_ne_zero h0) with β¨ΞΆ, rflβ©
rw [β Units.val_pow_eq_pow_val]
rw [coe_units_iff] at h β’
refine
{ pow_eq_one := by rw [β pow_mul', pow_mul, h.pow_eq_one, one_pow]
dvd_of_pow_eq_one := ?_ }
intro l hl
apply h.dvd_of_pow_eq_one
rw [β pow_one ΞΆ, β zpow_natCast ΞΆ, β hi.gcd_eq_one, Nat.gcd_eq_gcd_ab, zpow_add, mul_pow,
β zpow_natCast, β zpow_mul, mul_right_comm]
simp only [zpow_mul, hl, h.pow_eq_one, one_zpow, one_pow, one_mul, zpow_natCast]
#align is_primitive_root.pow_of_coprime IsPrimitiveRoot.pow_of_coprime
theorem pow_of_prime (h : IsPrimitiveRoot ΞΆ k) {p : β} (hprime : Nat.Prime p) (hdiv : Β¬p β£ k) :
IsPrimitiveRoot (ΞΆ ^ p) k :=
h.pow_of_coprime p (hprime.coprime_iff_not_dvd.2 hdiv)
#align is_primitive_root.pow_of_prime IsPrimitiveRoot.pow_of_prime
theorem pow_iff_coprime (h : IsPrimitiveRoot ΞΆ k) (h0 : 0 < k) (i : β) :
IsPrimitiveRoot (ΞΆ ^ i) k β i.Coprime k := by
refine β¨?_, h.pow_of_coprime iβ©
intro hi
obtain β¨a, haβ© := i.gcd_dvd_left k
obtain β¨b, hbβ© := i.gcd_dvd_right k
suffices b = k by
-- Porting note: was `rwa [this, β one_mul k, mul_left_inj' h0.ne', eq_comm] at hb`
rw [this, eq_comm, Nat.mul_left_eq_self_iff h0] at hb
rwa [Nat.Coprime]
rw [ha] at hi
rw [mul_comm] at hb
apply Nat.dvd_antisymm β¨i.gcd k, hbβ© (hi.dvd_of_pow_eq_one b _)
rw [β pow_mul', β mul_assoc, β hb, pow_mul, h.pow_eq_one, one_pow]
#align is_primitive_root.pow_iff_coprime IsPrimitiveRoot.pow_iff_coprime
protected theorem orderOf (ΞΆ : M) : IsPrimitiveRoot ΞΆ (orderOf ΞΆ) :=
β¨pow_orderOf_eq_one ΞΆ, fun _ => orderOf_dvd_of_pow_eq_oneβ©
#align is_primitive_root.order_of IsPrimitiveRoot.orderOf
theorem unique {ΞΆ : M} (hk : IsPrimitiveRoot ΞΆ k) (hl : IsPrimitiveRoot ΞΆ l) : k = l :=
Nat.dvd_antisymm (hk.2 _ hl.1) (hl.2 _ hk.1)
#align is_primitive_root.unique IsPrimitiveRoot.unique
theorem eq_orderOf : k = orderOf ΞΆ :=
h.unique (IsPrimitiveRoot.orderOf ΞΆ)
#align is_primitive_root.eq_order_of IsPrimitiveRoot.eq_orderOf
protected theorem iff (hk : 0 < k) :
IsPrimitiveRoot ΞΆ k β ΞΆ ^ k = 1 β§ β l : β, 0 < l β l < k β ΞΆ ^ l β 1 := by
refine β¨fun h => β¨h.pow_eq_one, fun l hl' hl => ?_β©,
fun β¨hΞΆ, hlβ© => IsPrimitiveRoot.mk_of_lt ΞΆ hk hΞΆ hlβ©
rw [h.eq_orderOf] at hl
exact pow_ne_one_of_lt_orderOf' hl'.ne' hl
#align is_primitive_root.iff IsPrimitiveRoot.iff
protected theorem not_iff : Β¬IsPrimitiveRoot ΞΆ k β orderOf ΞΆ β k :=
β¨fun h hk => h <| hk βΈ IsPrimitiveRoot.orderOf ΞΆ,
fun h hk => h.symm <| hk.unique <| IsPrimitiveRoot.orderOf ΞΆβ©
#align is_primitive_root.not_iff IsPrimitiveRoot.not_iff
theorem pow_mul_pow_lcm {ΞΆ' : M} {k' : β} (hΞΆ : IsPrimitiveRoot ΞΆ k) (hΞΆ' : IsPrimitiveRoot ΞΆ' k')
(hk : k β 0) (hk' : k' β 0) :
IsPrimitiveRoot
(ΞΆ ^ (k / Nat.factorizationLCMLeft k k') * ΞΆ' ^ (k' / Nat.factorizationLCMRight k k'))
(Nat.lcm k k') := by
convert IsPrimitiveRoot.orderOf _
convert ((Commute.all ΞΆ ΞΆ').orderOf_mul_pow_eq_lcm
(by simpa [β hΞΆ.eq_orderOf]) (by simpa [β hΞΆ'.eq_orderOf])).symm using 2
all_goals simp [hΞΆ.eq_orderOf, hΞΆ'.eq_orderOf]
| Mathlib/RingTheory/RootsOfUnity/Basic.lean | 488 | 491 | theorem pow_of_dvd (h : IsPrimitiveRoot ΞΆ k) {p : β} (hp : p β 0) (hdiv : p β£ k) :
IsPrimitiveRoot (ΞΆ ^ p) (k / p) := by |
suffices orderOf (ΞΆ ^ p) = k / p by exact this βΈ IsPrimitiveRoot.orderOf (ΞΆ ^ p)
rw [orderOf_pow' _ hp, β eq_orderOf h, Nat.gcd_eq_right hdiv]
|
import Mathlib.MeasureTheory.Function.LpOrder
#align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f"
noncomputable section
open scoped Classical
open Topology ENNReal MeasureTheory NNReal
open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} {m : MeasurableSpace Ξ±} {ΞΌ Ξ½ : Measure Ξ±} [MeasurableSpace Ξ΄]
variable [NormedAddCommGroup Ξ²]
variable [NormedAddCommGroup Ξ³]
namespace MeasureTheory
theorem lintegral_nnnorm_eq_lintegral_edist (f : Ξ± β Ξ²) :
β«β» a, βf aββ βΞΌ = β«β» a, edist (f a) 0 βΞΌ := by simp only [edist_eq_coe_nnnorm]
#align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist
theorem lintegral_norm_eq_lintegral_edist (f : Ξ± β Ξ²) :
β«β» a, ENNReal.ofReal βf aβ βΞΌ = β«β» a, edist (f a) 0 βΞΌ := by
simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm]
#align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist
theorem lintegral_edist_triangle {f g h : Ξ± β Ξ²} (hf : AEStronglyMeasurable f ΞΌ)
(hh : AEStronglyMeasurable h ΞΌ) :
(β«β» a, edist (f a) (g a) βΞΌ) β€ (β«β» a, edist (f a) (h a) βΞΌ) + β«β» a, edist (g a) (h a) βΞΌ := by
rw [β lintegral_add_left' (hf.edist hh)]
refine lintegral_mono fun a => ?_
apply edist_triangle_right
#align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle
theorem lintegral_nnnorm_zero : (β«β» _ : Ξ±, β(0 : Ξ²)ββ βΞΌ) = 0 := by simp
#align measure_theory.lintegral_nnnorm_zero MeasureTheory.lintegral_nnnorm_zero
theorem lintegral_nnnorm_add_left {f : Ξ± β Ξ²} (hf : AEStronglyMeasurable f ΞΌ) (g : Ξ± β Ξ³) :
β«β» a, βf aββ + βg aββ βΞΌ = (β«β» a, βf aββ βΞΌ) + β«β» a, βg aββ βΞΌ :=
lintegral_add_left' hf.ennnorm _
#align measure_theory.lintegral_nnnorm_add_left MeasureTheory.lintegral_nnnorm_add_left
theorem lintegral_nnnorm_add_right (f : Ξ± β Ξ²) {g : Ξ± β Ξ³} (hg : AEStronglyMeasurable g ΞΌ) :
β«β» a, βf aββ + βg aββ βΞΌ = (β«β» a, βf aββ βΞΌ) + β«β» a, βg aββ βΞΌ :=
lintegral_add_right' _ hg.ennnorm
#align measure_theory.lintegral_nnnorm_add_right MeasureTheory.lintegral_nnnorm_add_right
theorem lintegral_nnnorm_neg {f : Ξ± β Ξ²} : (β«β» a, β(-f) aββ βΞΌ) = β«β» a, βf aββ βΞΌ := by
simp only [Pi.neg_apply, nnnorm_neg]
#align measure_theory.lintegral_nnnorm_neg MeasureTheory.lintegral_nnnorm_neg
def HasFiniteIntegral {_ : MeasurableSpace Ξ±} (f : Ξ± β Ξ²) (ΞΌ : Measure Ξ± := by volume_tac) : Prop :=
(β«β» a, βf aββ βΞΌ) < β
#align measure_theory.has_finite_integral MeasureTheory.HasFiniteIntegral
theorem hasFiniteIntegral_def {_ : MeasurableSpace Ξ±} (f : Ξ± β Ξ²) (ΞΌ : Measure Ξ±) :
HasFiniteIntegral f ΞΌ β ((β«β» a, βf aββ βΞΌ) < β) :=
Iff.rfl
theorem hasFiniteIntegral_iff_norm (f : Ξ± β Ξ²) :
HasFiniteIntegral f ΞΌ β (β«β» a, ENNReal.ofReal βf aβ βΞΌ) < β := by
simp only [HasFiniteIntegral, ofReal_norm_eq_coe_nnnorm]
#align measure_theory.has_finite_integral_iff_norm MeasureTheory.hasFiniteIntegral_iff_norm
theorem hasFiniteIntegral_iff_edist (f : Ξ± β Ξ²) :
HasFiniteIntegral f ΞΌ β (β«β» a, edist (f a) 0 βΞΌ) < β := by
simp only [hasFiniteIntegral_iff_norm, edist_dist, dist_zero_right]
#align measure_theory.has_finite_integral_iff_edist MeasureTheory.hasFiniteIntegral_iff_edist
theorem hasFiniteIntegral_iff_ofReal {f : Ξ± β β} (h : 0 β€α΅[ΞΌ] f) :
HasFiniteIntegral f ΞΌ β (β«β» a, ENNReal.ofReal (f a) βΞΌ) < β := by
rw [HasFiniteIntegral, lintegral_nnnorm_eq_of_ae_nonneg h]
#align measure_theory.has_finite_integral_iff_of_real MeasureTheory.hasFiniteIntegral_iff_ofReal
theorem hasFiniteIntegral_iff_ofNNReal {f : Ξ± β ββ₯0} :
HasFiniteIntegral (fun x => (f x : β)) ΞΌ β (β«β» a, f a βΞΌ) < β := by
simp [hasFiniteIntegral_iff_norm]
#align measure_theory.has_finite_integral_iff_of_nnreal MeasureTheory.hasFiniteIntegral_iff_ofNNReal
theorem HasFiniteIntegral.mono {f : Ξ± β Ξ²} {g : Ξ± β Ξ³} (hg : HasFiniteIntegral g ΞΌ)
(h : βα΅ a βΞΌ, βf aβ β€ βg aβ) : HasFiniteIntegral f ΞΌ := by
simp only [hasFiniteIntegral_iff_norm] at *
calc
(β«β» a, ENNReal.ofReal βf aβ βΞΌ) β€ β«β» a : Ξ±, ENNReal.ofReal βg aβ βΞΌ :=
lintegral_mono_ae (h.mono fun a h => ofReal_le_ofReal h)
_ < β := hg
#align measure_theory.has_finite_integral.mono MeasureTheory.HasFiniteIntegral.mono
theorem HasFiniteIntegral.mono' {f : Ξ± β Ξ²} {g : Ξ± β β} (hg : HasFiniteIntegral g ΞΌ)
(h : βα΅ a βΞΌ, βf aβ β€ g a) : HasFiniteIntegral f ΞΌ :=
hg.mono <| h.mono fun _x hx => le_trans hx (le_abs_self _)
#align measure_theory.has_finite_integral.mono' MeasureTheory.HasFiniteIntegral.mono'
theorem HasFiniteIntegral.congr' {f : Ξ± β Ξ²} {g : Ξ± β Ξ³} (hf : HasFiniteIntegral f ΞΌ)
(h : βα΅ a βΞΌ, βf aβ = βg aβ) : HasFiniteIntegral g ΞΌ :=
hf.mono <| EventuallyEq.le <| EventuallyEq.symm h
#align measure_theory.has_finite_integral.congr' MeasureTheory.HasFiniteIntegral.congr'
theorem hasFiniteIntegral_congr' {f : Ξ± β Ξ²} {g : Ξ± β Ξ³} (h : βα΅ a βΞΌ, βf aβ = βg aβ) :
HasFiniteIntegral f ΞΌ β HasFiniteIntegral g ΞΌ :=
β¨fun hf => hf.congr' h, fun hg => hg.congr' <| EventuallyEq.symm hβ©
#align measure_theory.has_finite_integral_congr' MeasureTheory.hasFiniteIntegral_congr'
theorem HasFiniteIntegral.congr {f g : Ξ± β Ξ²} (hf : HasFiniteIntegral f ΞΌ) (h : f =α΅[ΞΌ] g) :
HasFiniteIntegral g ΞΌ :=
hf.congr' <| h.fun_comp norm
#align measure_theory.has_finite_integral.congr MeasureTheory.HasFiniteIntegral.congr
theorem hasFiniteIntegral_congr {f g : Ξ± β Ξ²} (h : f =α΅[ΞΌ] g) :
HasFiniteIntegral f ΞΌ β HasFiniteIntegral g ΞΌ :=
hasFiniteIntegral_congr' <| h.fun_comp norm
#align measure_theory.has_finite_integral_congr MeasureTheory.hasFiniteIntegral_congr
theorem hasFiniteIntegral_const_iff {c : Ξ²} :
HasFiniteIntegral (fun _ : Ξ± => c) ΞΌ β c = 0 β¨ ΞΌ univ < β := by
simp [HasFiniteIntegral, lintegral_const, lt_top_iff_ne_top, ENNReal.mul_eq_top,
or_iff_not_imp_left]
#align measure_theory.has_finite_integral_const_iff MeasureTheory.hasFiniteIntegral_const_iff
theorem hasFiniteIntegral_const [IsFiniteMeasure ΞΌ] (c : Ξ²) :
HasFiniteIntegral (fun _ : Ξ± => c) ΞΌ :=
hasFiniteIntegral_const_iff.2 (Or.inr <| measure_lt_top _ _)
#align measure_theory.has_finite_integral_const MeasureTheory.hasFiniteIntegral_const
theorem hasFiniteIntegral_of_bounded [IsFiniteMeasure ΞΌ] {f : Ξ± β Ξ²} {C : β}
(hC : βα΅ a βΞΌ, βf aβ β€ C) : HasFiniteIntegral f ΞΌ :=
(hasFiniteIntegral_const C).mono' hC
#align measure_theory.has_finite_integral_of_bounded MeasureTheory.hasFiniteIntegral_of_bounded
theorem HasFiniteIntegral.of_finite [Finite Ξ±] [IsFiniteMeasure ΞΌ] {f : Ξ± β Ξ²} :
HasFiniteIntegral f ΞΌ :=
let β¨_β© := nonempty_fintype Ξ±
hasFiniteIntegral_of_bounded <| ae_of_all ΞΌ <| norm_le_pi_norm f
@[deprecated (since := "2024-02-05")]
alias hasFiniteIntegral_of_fintype := HasFiniteIntegral.of_finite
theorem HasFiniteIntegral.mono_measure {f : Ξ± β Ξ²} (h : HasFiniteIntegral f Ξ½) (hΞΌ : ΞΌ β€ Ξ½) :
HasFiniteIntegral f ΞΌ :=
lt_of_le_of_lt (lintegral_mono' hΞΌ le_rfl) h
#align measure_theory.has_finite_integral.mono_measure MeasureTheory.HasFiniteIntegral.mono_measure
| Mathlib/MeasureTheory/Function/L1Space.lean | 196 | 199 | theorem HasFiniteIntegral.add_measure {f : Ξ± β Ξ²} (hΞΌ : HasFiniteIntegral f ΞΌ)
(hΞ½ : HasFiniteIntegral f Ξ½) : HasFiniteIntegral f (ΞΌ + Ξ½) := by |
simp only [HasFiniteIntegral, lintegral_add_measure] at *
exact add_lt_top.2 β¨hΞΌ, hΞ½β©
|
import Mathlib.LinearAlgebra.CliffordAlgebra.Grading
import Mathlib.Algebra.Module.Opposites
#align_import linear_algebra.clifford_algebra.conjugation from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
namespace CliffordAlgebra
section Reverse
theorem submodule_map_reverse_eq_comap (p : Submodule R (CliffordAlgebra Q)) :
p.map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) =
p.comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) :=
Submodule.map_equiv_eq_comap_symm (reverseEquiv : _ ββ[R] _) _
#align clifford_algebra.submodule_map_reverse_eq_comap CliffordAlgebra.submodule_map_reverse_eq_comap
@[simp]
theorem ΞΉ_range_map_reverse :
(ΞΉ Q).range.map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q)
= LinearMap.range (ΞΉ Q) := by
rw [reverse, reverseOp, Submodule.map_comp, ΞΉ_range_map_lift, LinearMap.range_comp,
β Submodule.map_comp]
exact Submodule.map_id _
#align clifford_algebra.ΞΉ_range_map_reverse CliffordAlgebra.ΞΉ_range_map_reverse
@[simp]
theorem ΞΉ_range_comap_reverse :
(ΞΉ Q).range.comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q)
= LinearMap.range (ΞΉ Q) := by
rw [β submodule_map_reverse_eq_comap, ΞΉ_range_map_reverse]
#align clifford_algebra.ΞΉ_range_comap_reverse CliffordAlgebra.ΞΉ_range_comap_reverse
theorem submodule_map_mul_reverse (p q : Submodule R (CliffordAlgebra Q)) :
(p * q).map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) =
q.map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) *
p.map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) := by
simp_rw [reverse, Submodule.map_comp, Submodule.map_mul, Submodule.map_unop_mul]
#align clifford_algebra.submodule_map_mul_reverse CliffordAlgebra.submodule_map_mul_reverse
theorem submodule_comap_mul_reverse (p q : Submodule R (CliffordAlgebra Q)) :
(p * q).comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) =
q.comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) *
p.comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) := by
simp_rw [β submodule_map_reverse_eq_comap, submodule_map_mul_reverse]
#align clifford_algebra.submodule_comap_mul_reverse CliffordAlgebra.submodule_comap_mul_reverse
theorem submodule_map_pow_reverse (p : Submodule R (CliffordAlgebra Q)) (n : β) :
(p ^ n).map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) =
p.map (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) ^ n := by
simp_rw [reverse, Submodule.map_comp, Submodule.map_pow, Submodule.map_unop_pow]
#align clifford_algebra.submodule_map_pow_reverse CliffordAlgebra.submodule_map_pow_reverse
| Mathlib/LinearAlgebra/CliffordAlgebra/Conjugation.lean | 295 | 298 | theorem submodule_comap_pow_reverse (p : Submodule R (CliffordAlgebra Q)) (n : β) :
(p ^ n).comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) =
p.comap (reverse : CliffordAlgebra Q ββ[R] CliffordAlgebra Q) ^ n := by |
simp_rw [β submodule_map_reverse_eq_comap, submodule_map_pow_reverse]
|
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "β€[i]" => GaussianInt
namespace GaussianInt
instance : Repr β€[i] :=
β¨fun x _ => "β¨" ++ repr x.re ++ ", " ++ repr x.im ++ "β©"β©
instance instCommRing : CommRing β€[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : β€[i] β+* β :=
Zsqrtd.lift β¨I, by simpβ©
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe β€[i] β :=
β¨toComplexβ©
theorem toComplex_def (x : β€[i]) : (x : β) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : β€) : ((β¨x, yβ© : β€[i]) : β) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_defβ (x : β€[i]) : (x : β) = β¨x.re, x.imβ© := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_defβ GaussianInt.toComplex_defβ
@[simp]
theorem to_real_re (x : β€[i]) : ((x.re : β€) : β) = (x : β).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : β€[i]) : ((x.im : β€) : β) = (x : β).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : β€) : ((β¨x, yβ© : β€[i]) : β).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : β€) : ((β¨x, yβ© : β€[i]) : β).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : β€[i]) : ((x + y : β€[i]) : β) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : β€[i]) : ((x * y : β€[i]) : β) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : β€[i]) : β) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : β€[i]) : β) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : β€[i]) : ((-x : β€[i]) : β) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : β€[i]) : ((x - y : β€[i]) : β) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : β€[i]) : ((star x : β€[i]) : β) = conj (x : β) := by
rw [toComplex_defβ, toComplex_defβ]
exact congr_argβ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : β€[i]} : (x : β) = y β x = y := by
cases x; cases y; simp [toComplex_defβ]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun β¦_ _β¦ β¦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : β€[i]} : (x : β) = 0 β x = 0 := by
rw [β toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
theorem intCast_real_norm (x : β€[i]) : (x.norm : β) = Complex.normSq (x : β) := by
rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_real_norm := intCast_real_norm
@[simp]
theorem intCast_complex_norm (x : β€[i]) : (x.norm : β) = Complex.normSq (x : β) := by
cases x; rw [Zsqrtd.norm, normSq]; simp
#align gaussian_int.nat_cast_complex_norm GaussianInt.intCast_complex_norm
@[deprecated (since := "2024-04-17")]
alias int_cast_complex_norm := intCast_complex_norm
theorem norm_nonneg (x : β€[i]) : 0 β€ norm x :=
Zsqrtd.norm_nonneg (by norm_num) _
#align gaussian_int.norm_nonneg GaussianInt.norm_nonneg
@[simp]
theorem norm_eq_zero {x : β€[i]} : norm x = 0 β x = 0 := by rw [β @Int.cast_inj β _ _ _]; simp
#align gaussian_int.norm_eq_zero GaussianInt.norm_eq_zero
theorem norm_pos {x : β€[i]} : 0 < norm x β x β 0 := by
rw [lt_iff_le_and_ne, Ne, eq_comm, norm_eq_zero]; simp [norm_nonneg]
#align gaussian_int.norm_pos GaussianInt.norm_pos
theorem abs_natCast_norm (x : β€[i]) : (x.norm.natAbs : β€) = x.norm :=
Int.natAbs_of_nonneg (norm_nonneg _)
#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_natCast_norm
-- 2024-04-05
@[deprecated] alias abs_coe_nat_norm := abs_natCast_norm
@[simp]
theorem natCast_natAbs_norm {Ξ± : Type*} [Ring Ξ±] (x : β€[i]) : (x.norm.natAbs : Ξ±) = x.norm := by
rw [β Int.cast_natCast, abs_natCast_norm]
#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.natCast_natAbs_norm
@[deprecated (since := "2024-04-17")]
alias nat_cast_natAbs_norm := natCast_natAbs_norm
theorem natAbs_norm_eq (x : β€[i]) :
x.norm.natAbs = x.re.natAbs * x.re.natAbs + x.im.natAbs * x.im.natAbs :=
Int.ofNat.inj <| by simp; simp [Zsqrtd.norm]
#align gaussian_int.nat_abs_norm_eq GaussianInt.natAbs_norm_eq
instance : Div β€[i] :=
β¨fun x y =>
let n := (norm y : β)β»ΒΉ
let c := star y
β¨round ((x * c).re * n : β), round ((x * c).im * n : β)β©β©
theorem div_def (x y : β€[i]) :
x / y = β¨round ((x * star y).re / norm y : β), round ((x * star y).im / norm y : β)β© :=
show Zsqrtd.mk _ _ = _ by simp [div_eq_mul_inv]
#align gaussian_int.div_def GaussianInt.div_def
theorem toComplex_div_re (x y : β€[i]) : ((x / y : β€[i]) : β).re = round (x / y : β).re := by
rw [div_def, β @Rat.round_cast β _ _]
simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
#align gaussian_int.to_complex_div_re GaussianInt.toComplex_div_re
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 217 | 219 | theorem toComplex_div_im (x y : β€[i]) : ((x / y : β€[i]) : β).im = round (x / y : β).im := by |
rw [div_def, β @Rat.round_cast β _ _, β @Rat.round_cast β _ _]
simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
|
import Mathlib.Data.Finset.Pointwise
#align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259"
open MulOpposite
open Pointwise
variable {Ξ± : Type*} [DecidableEq Ξ±]
namespace Finset
section CommGroup
variable [CommGroup Ξ±] (e : Ξ±) (x : Finset Ξ± Γ Finset Ξ±)
@[to_additive (attr := simps) "The **Dyson e-transform**.
Turns `(s, t)` into `(s βͺ e +α΅₯ t, t β© -e +α΅₯ s)`. This reduces the sum of the two sets."]
def mulDysonETransform : Finset Ξ± Γ Finset Ξ± :=
(x.1 βͺ e β’ x.2, x.2 β© eβ»ΒΉ β’ x.1)
#align finset.mul_dyson_e_transform Finset.mulDysonETransform
#align finset.add_dyson_e_transform Finset.addDysonETransform
@[to_additive]
theorem mulDysonETransform.subset :
(mulDysonETransform e x).1 * (mulDysonETransform e x).2 β x.1 * x.2 := by
refine union_mul_inter_subset_union.trans (union_subset Subset.rfl ?_)
rw [mul_smul_comm, smul_mul_assoc, inv_smul_smul, mul_comm]
#align finset.mul_dyson_e_transform.subset Finset.mulDysonETransform.subset
#align finset.add_dyson_e_transform.subset Finset.addDysonETransform.subset
@[to_additive]
theorem mulDysonETransform.card :
(mulDysonETransform e x).1.card + (mulDysonETransform e x).2.card = x.1.card + x.2.card := by
dsimp
rw [β card_smul_finset e (_ β© _), smul_finset_inter, smul_inv_smul, inter_comm,
card_union_add_card_inter, card_smul_finset]
#align finset.mul_dyson_e_transform.card Finset.mulDysonETransform.card
#align finset.add_dyson_e_transform.card Finset.addDysonETransform.card
@[to_additive (attr := simp)]
theorem mulDysonETransform_idem :
mulDysonETransform e (mulDysonETransform e x) = mulDysonETransform e x := by
ext : 1 <;> dsimp
Β· rw [smul_finset_inter, smul_inv_smul, inter_comm, union_eq_left]
exact inter_subset_union
Β· rw [smul_finset_union, inv_smul_smul, union_comm, inter_eq_left]
exact inter_subset_union
#align finset.mul_dyson_e_transform_idem Finset.mulDysonETransform_idem
#align finset.add_dyson_e_transform_idem Finset.addDysonETransform_idem
variable {e x}
@[to_additive]
| Mathlib/Combinatorics/Additive/ETransform.lean | 88 | 92 | theorem mulDysonETransform.smul_finset_snd_subset_fst :
e β’ (mulDysonETransform e x).2 β (mulDysonETransform e x).1 := by |
dsimp
rw [smul_finset_inter, smul_inv_smul, inter_comm]
exact inter_subset_union
|
import Mathlib.Algebra.Category.ModuleCat.Free
import Mathlib.Topology.Category.Profinite.CofilteredLimit
import Mathlib.Topology.Category.Profinite.Product
import Mathlib.Topology.LocallyConstant.Algebra
import Mathlib.Init.Data.Bool.Lemmas
universe u
namespace Profinite
namespace NobelingProof
variable {I : Type u} [LinearOrder I] [IsWellOrder I (Β·<Β·)] (C : Set (I β Bool))
open Profinite ContinuousMap CategoryTheory Limits Opposite Submodule
section Projections
variable (J K L : I β Prop) [β i, Decidable (J i)] [β i, Decidable (K i)] [β i, Decidable (L i)]
def Proj : (I β Bool) β (I β Bool) :=
fun c i β¦ if J i then c i else false
@[simp]
theorem continuous_proj :
Continuous (Proj J : (I β Bool) β (I β Bool)) := by
dsimp (config := { unfoldPartialApp := true }) [Proj]
apply continuous_pi
intro i
split
Β· apply continuous_apply
Β· apply continuous_const
def Ο : Set (I β Bool) := (Proj J) '' C
@[simps!]
def ProjRestrict : C β Ο C J :=
Set.MapsTo.restrict (Proj J) _ _ (Set.mapsTo_image _ _)
@[simp]
theorem continuous_projRestrict : Continuous (ProjRestrict C J) :=
Continuous.restrict _ (continuous_proj _)
theorem proj_eq_self {x : I β Bool} (h : β i, x i β false β J i) : Proj J x = x := by
ext i
simp only [Proj, ite_eq_left_iff]
contrapose!
simpa only [ne_comm] using h i
theorem proj_prop_eq_self (hh : β i x, x β C β x i β false β J i) : Ο C J = C := by
ext x
refine β¨fun β¨y, hy, hβ© β¦ ?_, fun h β¦ β¨x, h, ?_β©β©
Β· rwa [β h, proj_eq_self]; exact (hh Β· y hy)
Β· rw [proj_eq_self]; exact (hh Β· x h)
theorem proj_comp_of_subset (h : β i, J i β K i) : (Proj J β Proj K) =
(Proj J : (I β Bool) β (I β Bool)) := by
ext x i; dsimp [Proj]; aesop
| Mathlib/Topology/Category/Profinite/Nobeling.lean | 129 | 139 | theorem proj_eq_of_subset (h : β i, J i β K i) : Ο (Ο C K) J = Ο C J := by |
ext x
refine β¨fun h β¦ ?_, fun h β¦ ?_β©
Β· obtain β¨y, β¨z, hz, rflβ©, rflβ© := h
refine β¨z, hz, (?_ : _ = (Proj J β Proj K) z)β©
rw [proj_comp_of_subset J K h]
Β· obtain β¨y, hy, rflβ© := h
dsimp [Ο]
rw [β Set.image_comp]
refine β¨y, hy, ?_β©
rw [proj_comp_of_subset J K h]
|
import Mathlib.Algebra.Algebra.Opposite
import Mathlib.Algebra.Algebra.Pi
import Mathlib.Algebra.BigOperators.Pi
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.BigOperators.RingEquiv
import Mathlib.Algebra.Module.LinearMap.Basic
import Mathlib.Algebra.Module.Pi
import Mathlib.Algebra.Star.BigOperators
import Mathlib.Algebra.Star.Module
import Mathlib.Algebra.Star.Pi
import Mathlib.Data.Fintype.BigOperators
import Mathlib.GroupTheory.GroupAction.BigOperators
#align_import data.matrix.basic from "leanprover-community/mathlib"@"eba5bb3155cab51d80af00e8d7d69fa271b1302b"
universe u u' v w
def Matrix (m : Type u) (n : Type u') (Ξ± : Type v) : Type max u u' v :=
m β n β Ξ±
#align matrix Matrix
variable {l m n o : Type*} {m' : o β Type*} {n' : o β Type*}
variable {R : Type*} {S : Type*} {Ξ± : Type v} {Ξ² : Type w} {Ξ³ : Type*}
namespace Matrix
open Matrix
namespace Matrix
section Diagonal
variable [DecidableEq n]
def diagonal [Zero Ξ±] (d : n β Ξ±) : Matrix n n Ξ± :=
of fun i j => if i = j then d i else 0
#align matrix.diagonal Matrix.diagonal
-- TODO: set as an equation lemma for `diagonal`, see mathlib4#3024
theorem diagonal_apply [Zero Ξ±] (d : n β Ξ±) (i j) : diagonal d i j = if i = j then d i else 0 :=
rfl
#align matrix.diagonal_apply Matrix.diagonal_apply
@[simp]
theorem diagonal_apply_eq [Zero Ξ±] (d : n β Ξ±) (i : n) : (diagonal d) i i = d i := by
simp [diagonal]
#align matrix.diagonal_apply_eq Matrix.diagonal_apply_eq
@[simp]
theorem diagonal_apply_ne [Zero Ξ±] (d : n β Ξ±) {i j : n} (h : i β j) : (diagonal d) i j = 0 := by
simp [diagonal, h]
#align matrix.diagonal_apply_ne Matrix.diagonal_apply_ne
theorem diagonal_apply_ne' [Zero Ξ±] (d : n β Ξ±) {i j : n} (h : j β i) : (diagonal d) i j = 0 :=
diagonal_apply_ne d h.symm
#align matrix.diagonal_apply_ne' Matrix.diagonal_apply_ne'
@[simp]
theorem diagonal_eq_diagonal_iff [Zero Ξ±] {dβ dβ : n β Ξ±} :
diagonal dβ = diagonal dβ β β i, dβ i = dβ i :=
β¨fun h i => by simpa using congr_arg (fun m : Matrix n n Ξ± => m i i) h, fun h => by
rw [show dβ = dβ from funext h]β©
#align matrix.diagonal_eq_diagonal_iff Matrix.diagonal_eq_diagonal_iff
theorem diagonal_injective [Zero Ξ±] : Function.Injective (diagonal : (n β Ξ±) β Matrix n n Ξ±) :=
fun dβ dβ h => funext fun i => by simpa using Matrix.ext_iff.mpr h i i
#align matrix.diagonal_injective Matrix.diagonal_injective
@[simp]
theorem diagonal_zero [Zero Ξ±] : (diagonal fun _ => 0 : Matrix n n Ξ±) = 0 := by
ext
simp [diagonal]
#align matrix.diagonal_zero Matrix.diagonal_zero
@[simp]
theorem diagonal_transpose [Zero Ξ±] (v : n β Ξ±) : (diagonal v)α΅ = diagonal v := by
ext i j
by_cases h : i = j
Β· simp [h, transpose]
Β· simp [h, transpose, diagonal_apply_ne' _ h]
#align matrix.diagonal_transpose Matrix.diagonal_transpose
@[simp]
theorem diagonal_add [AddZeroClass Ξ±] (dβ dβ : n β Ξ±) :
diagonal dβ + diagonal dβ = diagonal fun i => dβ i + dβ i := by
ext i j
by_cases h : i = j <;>
simp [h]
#align matrix.diagonal_add Matrix.diagonal_add
@[simp]
theorem diagonal_smul [Zero Ξ±] [SMulZeroClass R Ξ±] (r : R) (d : n β Ξ±) :
diagonal (r β’ d) = r β’ diagonal d := by
ext i j
by_cases h : i = j <;> simp [h]
#align matrix.diagonal_smul Matrix.diagonal_smul
@[simp]
theorem diagonal_neg [NegZeroClass Ξ±] (d : n β Ξ±) :
-diagonal d = diagonal fun i => -d i := by
ext i j
by_cases h : i = j <;>
simp [h]
#align matrix.diagonal_neg Matrix.diagonal_neg
@[simp]
theorem diagonal_sub [SubNegZeroMonoid Ξ±] (dβ dβ : n β Ξ±) :
diagonal dβ - diagonal dβ = diagonal fun i => dβ i - dβ i := by
ext i j
by_cases h : i = j <;>
simp [h]
instance [Zero Ξ±] [NatCast Ξ±] : NatCast (Matrix n n Ξ±) where
natCast m := diagonal fun _ => m
@[norm_cast]
theorem diagonal_natCast [Zero Ξ±] [NatCast Ξ±] (m : β) : diagonal (fun _ : n => (m : Ξ±)) = m := rfl
@[norm_cast]
theorem diagonal_natCast' [Zero Ξ±] [NatCast Ξ±] (m : β) : diagonal ((m : n β Ξ±)) = m := rfl
-- See note [no_index around OfNat.ofNat]
theorem diagonal_ofNat [Zero Ξ±] [NatCast Ξ±] (m : β) [m.AtLeastTwo] :
diagonal (fun _ : n => no_index (OfNat.ofNat m : Ξ±)) = OfNat.ofNat m := rfl
-- See note [no_index around OfNat.ofNat]
theorem diagonal_ofNat' [Zero Ξ±] [NatCast Ξ±] (m : β) [m.AtLeastTwo] :
diagonal (no_index (OfNat.ofNat m : n β Ξ±)) = OfNat.ofNat m := rfl
instance [Zero Ξ±] [IntCast Ξ±] : IntCast (Matrix n n Ξ±) where
intCast m := diagonal fun _ => m
@[norm_cast]
theorem diagonal_intCast [Zero Ξ±] [IntCast Ξ±] (m : β€) : diagonal (fun _ : n => (m : Ξ±)) = m := rfl
@[norm_cast]
theorem diagonal_intCast' [Zero Ξ±] [IntCast Ξ±] (m : β€) : diagonal ((m : n β Ξ±)) = m := rfl
variable (n Ξ±)
@[simps]
def diagonalAddMonoidHom [AddZeroClass Ξ±] : (n β Ξ±) β+ Matrix n n Ξ± where
toFun := diagonal
map_zero' := diagonal_zero
map_add' x y := (diagonal_add x y).symm
#align matrix.diagonal_add_monoid_hom Matrix.diagonalAddMonoidHom
variable (R)
@[simps]
def diagonalLinearMap [Semiring R] [AddCommMonoid Ξ±] [Module R Ξ±] : (n β Ξ±) ββ[R] Matrix n n Ξ± :=
{ diagonalAddMonoidHom n Ξ± with map_smul' := diagonal_smul }
#align matrix.diagonal_linear_map Matrix.diagonalLinearMap
variable {n Ξ± R}
@[simp]
theorem diagonal_map [Zero Ξ±] [Zero Ξ²] {f : Ξ± β Ξ²} (h : f 0 = 0) {d : n β Ξ±} :
(diagonal d).map f = diagonal fun m => f (d m) := by
ext
simp only [diagonal_apply, map_apply]
split_ifs <;> simp [h]
#align matrix.diagonal_map Matrix.diagonal_map
@[simp]
theorem diagonal_conjTranspose [AddMonoid Ξ±] [StarAddMonoid Ξ±] (v : n β Ξ±) :
(diagonal v)α΄΄ = diagonal (star v) := by
rw [conjTranspose, diagonal_transpose, diagonal_map (star_zero _)]
rfl
#align matrix.diagonal_conj_transpose Matrix.diagonal_conjTranspose
instance instAddMonoidWithOne [AddMonoidWithOne Ξ±] : AddMonoidWithOne (Matrix n n Ξ±) where
natCast_zero := show diagonal _ = _ by
rw [Nat.cast_zero, diagonal_zero]
natCast_succ n := show diagonal _ = diagonal _ + _ by
rw [Nat.cast_succ, β diagonal_add, diagonal_one]
instance instAddGroupWithOne [AddGroupWithOne Ξ±] : AddGroupWithOne (Matrix n n Ξ±) where
intCast_ofNat n := show diagonal _ = diagonal _ by
rw [Int.cast_natCast]
intCast_negSucc n := show diagonal _ = -(diagonal _) by
rw [Int.cast_negSucc, diagonal_neg]
__ := addGroup
__ := instAddMonoidWithOne
instance instAddCommMonoidWithOne [AddCommMonoidWithOne Ξ±] :
AddCommMonoidWithOne (Matrix n n Ξ±) where
__ := addCommMonoid
__ := instAddMonoidWithOne
instance instAddCommGroupWithOne [AddCommGroupWithOne Ξ±] :
AddCommGroupWithOne (Matrix n n Ξ±) where
__ := addCommGroup
__ := instAddGroupWithOne
section DotProduct
variable [Fintype m] [Fintype n]
def dotProduct [Mul Ξ±] [AddCommMonoid Ξ±] (v w : m β Ξ±) : Ξ± :=
β i, v i * w i
#align matrix.dot_product Matrix.dotProduct
@[inherit_doc]
scoped infixl:72 " β¬α΅₯ " => Matrix.dotProduct
theorem dotProduct_assoc [NonUnitalSemiring Ξ±] (u : m β Ξ±) (w : n β Ξ±) (v : Matrix m n Ξ±) :
(fun j => u β¬α΅₯ fun i => v i j) β¬α΅₯ w = u β¬α΅₯ fun i => v i β¬α΅₯ w := by
simpa [dotProduct, Finset.mul_sum, Finset.sum_mul, mul_assoc] using Finset.sum_comm
#align matrix.dot_product_assoc Matrix.dotProduct_assoc
theorem dotProduct_comm [AddCommMonoid Ξ±] [CommSemigroup Ξ±] (v w : m β Ξ±) : v β¬α΅₯ w = w β¬α΅₯ v := by
simp_rw [dotProduct, mul_comm]
#align matrix.dot_product_comm Matrix.dotProduct_comm
@[simp]
theorem dotProduct_pUnit [AddCommMonoid Ξ±] [Mul Ξ±] (v w : PUnit β Ξ±) : v β¬α΅₯ w = v β¨β© * w β¨β© := by
simp [dotProduct]
#align matrix.dot_product_punit Matrix.dotProduct_pUnit
section StarRing
variable [NonUnitalSemiring Ξ±] [StarRing Ξ±] (v w : m β Ξ±)
theorem star_dotProduct_star : star v β¬α΅₯ star w = star (w β¬α΅₯ v) := by simp [dotProduct]
#align matrix.star_dot_product_star Matrix.star_dotProduct_star
| Mathlib/Data/Matrix/Basic.lean | 939 | 939 | theorem star_dotProduct : star v β¬α΅₯ w = star (star w β¬α΅₯ v) := by | simp [dotProduct]
|
import Mathlib.Order.Filter.SmallSets
import Mathlib.Tactic.Monotonicity
import Mathlib.Topology.Compactness.Compact
import Mathlib.Topology.NhdsSet
import Mathlib.Algebra.Group.Defs
#align_import topology.uniform_space.basic from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c"
open Set Filter Topology
universe u v ua ub uc ud
variable {Ξ± : Type ua} {Ξ² : Type ub} {Ξ³ : Type uc} {Ξ΄ : Type ud} {ΞΉ : Sort*}
def idRel {Ξ± : Type*} :=
{ p : Ξ± Γ Ξ± | p.1 = p.2 }
#align id_rel idRel
@[simp]
theorem mem_idRel {a b : Ξ±} : (a, b) β @idRel Ξ± β a = b :=
Iff.rfl
#align mem_id_rel mem_idRel
@[simp]
theorem idRel_subset {s : Set (Ξ± Γ Ξ±)} : idRel β s β β a, (a, a) β s := by
simp [subset_def]
#align id_rel_subset idRel_subset
def compRel (rβ rβ : Set (Ξ± Γ Ξ±)) :=
{ p : Ξ± Γ Ξ± | β z : Ξ±, (p.1, z) β rβ β§ (z, p.2) β rβ }
#align comp_rel compRel
@[inherit_doc]
scoped[Uniformity] infixl:62 " β " => compRel
open Uniformity
@[simp]
theorem mem_compRel {Ξ± : Type u} {rβ rβ : Set (Ξ± Γ Ξ±)} {x y : Ξ±} :
(x, y) β rβ β rβ β β z, (x, z) β rβ β§ (z, y) β rβ :=
Iff.rfl
#align mem_comp_rel mem_compRel
@[simp]
theorem swap_idRel : Prod.swap '' idRel = @idRel Ξ± :=
Set.ext fun β¨a, bβ© => by simpa [image_swap_eq_preimage_swap] using eq_comm
#align swap_id_rel swap_idRel
theorem Monotone.compRel [Preorder Ξ²] {f g : Ξ² β Set (Ξ± Γ Ξ±)} (hf : Monotone f) (hg : Monotone g) :
Monotone fun x => f x β g x := fun _ _ h _ β¨z, hβ, hββ© => β¨z, hf h hβ, hg h hββ©
#align monotone.comp_rel Monotone.compRel
@[mono]
theorem compRel_mono {f g h k : Set (Ξ± Γ Ξ±)} (hβ : f β h) (hβ : g β k) : f β g β h β k :=
fun _ β¨z, h, h'β© => β¨z, hβ h, hβ h'β©
#align comp_rel_mono compRel_mono
theorem prod_mk_mem_compRel {a b c : Ξ±} {s t : Set (Ξ± Γ Ξ±)} (hβ : (a, c) β s) (hβ : (c, b) β t) :
(a, b) β s β t :=
β¨c, hβ, hββ©
#align prod_mk_mem_comp_rel prod_mk_mem_compRel
@[simp]
theorem id_compRel {r : Set (Ξ± Γ Ξ±)} : idRel β r = r :=
Set.ext fun β¨a, bβ© => by simp
#align id_comp_rel id_compRel
theorem compRel_assoc {r s t : Set (Ξ± Γ Ξ±)} : r β s β t = r β (s β t) := by
ext β¨a, bβ©; simp only [mem_compRel]; tauto
#align comp_rel_assoc compRel_assoc
theorem left_subset_compRel {s t : Set (Ξ± Γ Ξ±)} (h : idRel β t) : s β s β t := fun β¨_x, yβ© xy_in =>
β¨y, xy_in, h <| rflβ©
#align left_subset_comp_rel left_subset_compRel
theorem right_subset_compRel {s t : Set (Ξ± Γ Ξ±)} (h : idRel β s) : t β s β t := fun β¨x, _yβ© xy_in =>
β¨x, h <| rfl, xy_inβ©
#align right_subset_comp_rel right_subset_compRel
theorem subset_comp_self {s : Set (Ξ± Γ Ξ±)} (h : idRel β s) : s β s β s :=
left_subset_compRel h
#align subset_comp_self subset_comp_self
theorem subset_iterate_compRel {s t : Set (Ξ± Γ Ξ±)} (h : idRel β s) (n : β) :
t β (s β Β·)^[n] t := by
induction' n with n ihn generalizing t
exacts [Subset.rfl, (right_subset_compRel h).trans ihn]
#align subset_iterate_comp_rel subset_iterate_compRel
def SymmetricRel (V : Set (Ξ± Γ Ξ±)) : Prop :=
Prod.swap β»ΒΉ' V = V
#align symmetric_rel SymmetricRel
def symmetrizeRel (V : Set (Ξ± Γ Ξ±)) : Set (Ξ± Γ Ξ±) :=
V β© Prod.swap β»ΒΉ' V
#align symmetrize_rel symmetrizeRel
theorem symmetric_symmetrizeRel (V : Set (Ξ± Γ Ξ±)) : SymmetricRel (symmetrizeRel V) := by
simp [SymmetricRel, symmetrizeRel, preimage_inter, inter_comm, β preimage_comp]
#align symmetric_symmetrize_rel symmetric_symmetrizeRel
theorem symmetrizeRel_subset_self (V : Set (Ξ± Γ Ξ±)) : symmetrizeRel V β V :=
sep_subset _ _
#align symmetrize_rel_subset_self symmetrizeRel_subset_self
@[mono]
theorem symmetrize_mono {V W : Set (Ξ± Γ Ξ±)} (h : V β W) : symmetrizeRel V β symmetrizeRel W :=
inter_subset_inter h <| preimage_mono h
#align symmetrize_mono symmetrize_mono
theorem SymmetricRel.mk_mem_comm {V : Set (Ξ± Γ Ξ±)} (hV : SymmetricRel V) {x y : Ξ±} :
(x, y) β V β (y, x) β V :=
Set.ext_iff.1 hV (y, x)
#align symmetric_rel.mk_mem_comm SymmetricRel.mk_mem_comm
theorem SymmetricRel.eq {U : Set (Ξ± Γ Ξ±)} (hU : SymmetricRel U) : Prod.swap β»ΒΉ' U = U :=
hU
#align symmetric_rel.eq SymmetricRel.eq
theorem SymmetricRel.inter {U V : Set (Ξ± Γ Ξ±)} (hU : SymmetricRel U) (hV : SymmetricRel V) :
SymmetricRel (U β© V) := by rw [SymmetricRel, preimage_inter, hU.eq, hV.eq]
#align symmetric_rel.inter SymmetricRel.inter
structure UniformSpace.Core (Ξ± : Type u) where
uniformity : Filter (Ξ± Γ Ξ±)
refl : π idRel β€ uniformity
symm : Tendsto Prod.swap uniformity uniformity
comp : (uniformity.lift' fun s => s β s) β€ uniformity
#align uniform_space.core UniformSpace.Core
protected theorem UniformSpace.Core.comp_mem_uniformity_sets {c : Core Ξ±} {s : Set (Ξ± Γ Ξ±)}
(hs : s β c.uniformity) : β t β c.uniformity, t β t β s :=
(mem_lift'_sets <| monotone_id.compRel monotone_id).mp <| c.comp hs
def UniformSpace.Core.mk' {Ξ± : Type u} (U : Filter (Ξ± Γ Ξ±)) (refl : β r β U, β (x), (x, x) β r)
(symm : β r β U, Prod.swap β»ΒΉ' r β U) (comp : β r β U, β t β U, t β t β r) :
UniformSpace.Core Ξ± :=
β¨U, fun _r ru => idRel_subset.2 (refl _ ru), symm, fun _r ru =>
let β¨_s, hs, hsrβ© := comp _ ru
mem_of_superset (mem_lift' hs) hsrβ©
#align uniform_space.core.mk' UniformSpace.Core.mk'
def UniformSpace.Core.mkOfBasis {Ξ± : Type u} (B : FilterBasis (Ξ± Γ Ξ±))
(refl : β r β B, β (x), (x, x) β r) (symm : β r β B, β t β B, t β Prod.swap β»ΒΉ' r)
(comp : β r β B, β t β B, t β t β r) : UniformSpace.Core Ξ± where
uniformity := B.filter
refl := B.hasBasis.ge_iff.mpr fun _r ru => idRel_subset.2 <| refl _ ru
symm := (B.hasBasis.tendsto_iff B.hasBasis).mpr symm
comp := (HasBasis.le_basis_iff (B.hasBasis.lift' (monotone_id.compRel monotone_id))
B.hasBasis).2 comp
#align uniform_space.core.mk_of_basis UniformSpace.Core.mkOfBasis
def UniformSpace.Core.toTopologicalSpace {Ξ± : Type u} (u : UniformSpace.Core Ξ±) :
TopologicalSpace Ξ± :=
.mkOfNhds fun x β¦ .comap (Prod.mk x) u.uniformity
#align uniform_space.core.to_topological_space UniformSpace.Core.toTopologicalSpace
theorem UniformSpace.Core.ext :
β {uβ uβ : UniformSpace.Core Ξ±}, uβ.uniformity = uβ.uniformity β uβ = uβ
| β¨_, _, _, _β©, β¨_, _, _, _β©, rfl => rfl
#align uniform_space.core_eq UniformSpace.Core.ext
theorem UniformSpace.Core.nhds_toTopologicalSpace {Ξ± : Type u} (u : Core Ξ±) (x : Ξ±) :
@nhds Ξ± u.toTopologicalSpace x = comap (Prod.mk x) u.uniformity := by
apply TopologicalSpace.nhds_mkOfNhds_of_hasBasis (fun _ β¦ (basis_sets _).comap _)
Β· exact fun a U hU β¦ u.refl hU rfl
Β· intro a U hU
rcases u.comp_mem_uniformity_sets hU with β¨V, hV, hVUβ©
filter_upwards [preimage_mem_comap hV] with b hb
filter_upwards [preimage_mem_comap hV] with c hc
exact hVU β¨b, hb, hcβ©
-- the topological structure is embedded in the uniform structure
-- to avoid instance diamond issues. See Note [forgetful inheritance].
class UniformSpace (Ξ± : Type u) extends TopologicalSpace Ξ± where
protected uniformity : Filter (Ξ± Γ Ξ±)
protected symm : Tendsto Prod.swap uniformity uniformity
protected comp : (uniformity.lift' fun s => s β s) β€ uniformity
protected nhds_eq_comap_uniformity (x : Ξ±) : π x = comap (Prod.mk x) uniformity
#align uniform_space UniformSpace
#noalign uniform_space.mk' -- Can't be a `match_pattern`, so not useful anymore
def uniformity (Ξ± : Type u) [UniformSpace Ξ±] : Filter (Ξ± Γ Ξ±) :=
@UniformSpace.uniformity Ξ± _
#align uniformity uniformity
scoped[Uniformity] notation "π€[" u "]" => @uniformity _ u
@[inherit_doc] -- Porting note (#11215): TODO: should we drop the `uniformity` def?
scoped[Uniformity] notation "π€" => uniformity
abbrev UniformSpace.ofCoreEq {Ξ± : Type u} (u : UniformSpace.Core Ξ±) (t : TopologicalSpace Ξ±)
(h : t = u.toTopologicalSpace) : UniformSpace Ξ± where
__ := u
toTopologicalSpace := t
nhds_eq_comap_uniformity x := by rw [h, u.nhds_toTopologicalSpace]
#align uniform_space.of_core_eq UniformSpace.ofCoreEq
abbrev UniformSpace.ofCore {Ξ± : Type u} (u : UniformSpace.Core Ξ±) : UniformSpace Ξ± :=
.ofCoreEq u _ rfl
#align uniform_space.of_core UniformSpace.ofCore
abbrev UniformSpace.toCore (u : UniformSpace Ξ±) : UniformSpace.Core Ξ± where
__ := u
refl := by
rintro U hU β¨x, yβ© (rfl : x = y)
have : Prod.mk x β»ΒΉ' U β π x := by
rw [UniformSpace.nhds_eq_comap_uniformity]
exact preimage_mem_comap hU
convert mem_of_mem_nhds this
theorem UniformSpace.toCore_toTopologicalSpace (u : UniformSpace Ξ±) :
u.toCore.toTopologicalSpace = u.toTopologicalSpace :=
TopologicalSpace.ext_nhds fun a β¦ by
rw [u.nhds_eq_comap_uniformity, u.toCore.nhds_toTopologicalSpace]
#align uniform_space.to_core_to_topological_space UniformSpace.toCore_toTopologicalSpace
@[deprecated UniformSpace.mk (since := "2024-03-20")]
def UniformSpace.ofNhdsEqComap (u : UniformSpace.Core Ξ±) (_t : TopologicalSpace Ξ±)
(h : β x, π x = u.uniformity.comap (Prod.mk x)) : UniformSpace Ξ± where
__ := u
nhds_eq_comap_uniformity := h
@[ext]
protected theorem UniformSpace.ext {uβ uβ : UniformSpace Ξ±} (h : π€[uβ] = π€[uβ]) : uβ = uβ := by
have : uβ.toTopologicalSpace = uβ.toTopologicalSpace := TopologicalSpace.ext_nhds fun x β¦ by
rw [uβ.nhds_eq_comap_uniformity, uβ.nhds_eq_comap_uniformity]
exact congr_arg (comap _) h
cases uβ; cases uβ; congr
#align uniform_space_eq UniformSpace.ext
protected theorem UniformSpace.ext_iff {uβ uβ : UniformSpace Ξ±} :
uβ = uβ β β s, s β π€[uβ] β s β π€[uβ] :=
β¨fun h _ => h βΈ Iff.rfl, fun h => by ext; exact h _β©
theorem UniformSpace.ofCoreEq_toCore (u : UniformSpace Ξ±) (t : TopologicalSpace Ξ±)
(h : t = u.toCore.toTopologicalSpace) : .ofCoreEq u.toCore t h = u :=
UniformSpace.ext rfl
#align uniform_space.of_core_eq_to_core UniformSpace.ofCoreEq_toCore
abbrev UniformSpace.replaceTopology {Ξ± : Type*} [i : TopologicalSpace Ξ±] (u : UniformSpace Ξ±)
(h : i = u.toTopologicalSpace) : UniformSpace Ξ± where
__ := u
toTopologicalSpace := i
nhds_eq_comap_uniformity x := by rw [h, u.nhds_eq_comap_uniformity]
#align uniform_space.replace_topology UniformSpace.replaceTopology
theorem UniformSpace.replaceTopology_eq {Ξ± : Type*} [i : TopologicalSpace Ξ±] (u : UniformSpace Ξ±)
(h : i = u.toTopologicalSpace) : u.replaceTopology h = u :=
UniformSpace.ext rfl
#align uniform_space.replace_topology_eq UniformSpace.replaceTopology_eq
-- Porting note: rfc: use `UniformSpace.Core.mkOfBasis`? This will change defeq here and there
def UniformSpace.ofFun {Ξ± : Type u} {Ξ² : Type v} [OrderedAddCommMonoid Ξ²]
(d : Ξ± β Ξ± β Ξ²) (refl : β x, d x x = 0) (symm : β x y, d x y = d y x)
(triangle : β x y z, d x z β€ d x y + d y z)
(half : β Ξ΅ > (0 : Ξ²), β Ξ΄ > (0 : Ξ²), β x < Ξ΄, β y < Ξ΄, x + y < Ξ΅) :
UniformSpace Ξ± :=
.ofCore
{ uniformity := β¨
r > 0, π { x | d x.1 x.2 < r }
refl := le_iInfβ fun r hr => principal_mono.2 <| idRel_subset.2 fun x => by simpa [refl]
symm := tendsto_iInf_iInf fun r => tendsto_iInf_iInf fun _ => tendsto_principal_principal.2
fun x hx => by rwa [mem_setOf, symm]
comp := le_iInfβ fun r hr => let β¨Ξ΄, h0, hΞ΄rβ© := half r hr; le_principal_iff.2 <|
mem_of_superset
(mem_lift' <| mem_iInf_of_mem Ξ΄ <| mem_iInf_of_mem h0 <| mem_principal_self _)
fun (x, z) β¨y, hβ, hββ© => (triangle _ _ _).trans_lt (hΞ΄r _ hβ _ hβ) }
#align uniform_space.of_fun UniformSpace.ofFun
theorem UniformSpace.hasBasis_ofFun {Ξ± : Type u} {Ξ² : Type v} [LinearOrderedAddCommMonoid Ξ²]
(hβ : β x : Ξ², 0 < x) (d : Ξ± β Ξ± β Ξ²) (refl : β x, d x x = 0) (symm : β x y, d x y = d y x)
(triangle : β x y z, d x z β€ d x y + d y z)
(half : β Ξ΅ > (0 : Ξ²), β Ξ΄ > (0 : Ξ²), β x < Ξ΄, β y < Ξ΄, x + y < Ξ΅) :
π€[.ofFun d refl symm triangle half].HasBasis ((0 : Ξ²) < Β·) (fun Ξ΅ => { x | d x.1 x.2 < Ξ΅ }) :=
hasBasis_biInf_principal'
(fun Ξ΅β hβ Ξ΅β hβ => β¨min Ξ΅β Ξ΅β, lt_min hβ hβ, fun _x hx => lt_of_lt_of_le hx (min_le_left _ _),
fun _x hx => lt_of_lt_of_le hx (min_le_right _ _)β©) hβ
#align uniform_space.has_basis_of_fun UniformSpace.hasBasis_ofFun
section UniformSpace
variable [UniformSpace Ξ±]
theorem nhds_eq_comap_uniformity {x : Ξ±} : π x = (π€ Ξ±).comap (Prod.mk x) :=
UniformSpace.nhds_eq_comap_uniformity x
#align nhds_eq_comap_uniformity nhds_eq_comap_uniformity
theorem isOpen_uniformity {s : Set Ξ±} :
IsOpen s β β x β s, { p : Ξ± Γ Ξ± | p.1 = x β p.2 β s } β π€ Ξ± := by
simp only [isOpen_iff_mem_nhds, nhds_eq_comap_uniformity, mem_comap_prod_mk]
#align is_open_uniformity isOpen_uniformity
theorem refl_le_uniformity : π idRel β€ π€ Ξ± :=
(@UniformSpace.toCore Ξ± _).refl
#align refl_le_uniformity refl_le_uniformity
instance uniformity.neBot [Nonempty Ξ±] : NeBot (π€ Ξ±) :=
diagonal_nonempty.principal_neBot.mono refl_le_uniformity
#align uniformity.ne_bot uniformity.neBot
theorem refl_mem_uniformity {x : Ξ±} {s : Set (Ξ± Γ Ξ±)} (h : s β π€ Ξ±) : (x, x) β s :=
refl_le_uniformity h rfl
#align refl_mem_uniformity refl_mem_uniformity
theorem mem_uniformity_of_eq {x y : Ξ±} {s : Set (Ξ± Γ Ξ±)} (h : s β π€ Ξ±) (hx : x = y) : (x, y) β s :=
refl_le_uniformity h hx
#align mem_uniformity_of_eq mem_uniformity_of_eq
theorem symm_le_uniformity : map (@Prod.swap Ξ± Ξ±) (π€ _) β€ π€ _ :=
UniformSpace.symm
#align symm_le_uniformity symm_le_uniformity
theorem comp_le_uniformity : ((π€ Ξ±).lift' fun s : Set (Ξ± Γ Ξ±) => s β s) β€ π€ Ξ± :=
UniformSpace.comp
#align comp_le_uniformity comp_le_uniformity
theorem lift'_comp_uniformity : ((π€ Ξ±).lift' fun s : Set (Ξ± Γ Ξ±) => s β s) = π€ Ξ± :=
comp_le_uniformity.antisymm <| le_lift'.2 fun _s hs β¦ mem_of_superset hs <|
subset_comp_self <| idRel_subset.2 fun _ β¦ refl_mem_uniformity hs
theorem tendsto_swap_uniformity : Tendsto (@Prod.swap Ξ± Ξ±) (π€ Ξ±) (π€ Ξ±) :=
symm_le_uniformity
#align tendsto_swap_uniformity tendsto_swap_uniformity
theorem comp_mem_uniformity_sets {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) : β t β π€ Ξ±, t β t β s :=
(mem_lift'_sets <| monotone_id.compRel monotone_id).mp <| comp_le_uniformity hs
#align comp_mem_uniformity_sets comp_mem_uniformity_sets
theorem eventually_uniformity_iterate_comp_subset {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) (n : β) :
βαΆ t in (π€ Ξ±).smallSets, (t β Β·)^[n] t β s := by
suffices βαΆ t in (π€ Ξ±).smallSets, t β s β§ (t β Β·)^[n] t β s from (eventually_and.1 this).2
induction' n with n ihn generalizing s
Β· simpa
rcases comp_mem_uniformity_sets hs with β¨t, htU, htsβ©
refine (ihn htU).mono fun U hU => ?_
rw [Function.iterate_succ_apply']
exact
β¨hU.1.trans <| (subset_comp_self <| refl_le_uniformity htU).trans hts,
(compRel_mono hU.1 hU.2).trans htsβ©
#align eventually_uniformity_iterate_comp_subset eventually_uniformity_iterate_comp_subset
theorem eventually_uniformity_comp_subset {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) :
βαΆ t in (π€ Ξ±).smallSets, t β t β s :=
eventually_uniformity_iterate_comp_subset hs 1
#align eventually_uniformity_comp_subset eventually_uniformity_comp_subset
theorem Filter.Tendsto.uniformity_trans {l : Filter Ξ²} {fβ fβ fβ : Ξ² β Ξ±}
(hββ : Tendsto (fun x => (fβ x, fβ x)) l (π€ Ξ±))
(hββ : Tendsto (fun x => (fβ x, fβ x)) l (π€ Ξ±)) : Tendsto (fun x => (fβ x, fβ x)) l (π€ Ξ±) := by
refine le_trans (le_lift'.2 fun s hs => mem_map.2 ?_) comp_le_uniformity
filter_upwards [mem_map.1 (hββ hs), mem_map.1 (hββ hs)] with x hxββ hxββ using β¨_, hxββ, hxβββ©
#align filter.tendsto.uniformity_trans Filter.Tendsto.uniformity_trans
theorem Filter.Tendsto.uniformity_symm {l : Filter Ξ²} {f : Ξ² β Ξ± Γ Ξ±} (h : Tendsto f l (π€ Ξ±)) :
Tendsto (fun x => ((f x).2, (f x).1)) l (π€ Ξ±) :=
tendsto_swap_uniformity.comp h
#align filter.tendsto.uniformity_symm Filter.Tendsto.uniformity_symm
theorem tendsto_diag_uniformity (f : Ξ² β Ξ±) (l : Filter Ξ²) :
Tendsto (fun x => (f x, f x)) l (π€ Ξ±) := fun _s hs =>
mem_map.2 <| univ_mem' fun _ => refl_mem_uniformity hs
#align tendsto_diag_uniformity tendsto_diag_uniformity
theorem tendsto_const_uniformity {a : Ξ±} {f : Filter Ξ²} : Tendsto (fun _ => (a, a)) f (π€ Ξ±) :=
tendsto_diag_uniformity (fun _ => a) f
#align tendsto_const_uniformity tendsto_const_uniformity
theorem symm_of_uniformity {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) :
β t β π€ Ξ±, (β a b, (a, b) β t β (b, a) β t) β§ t β s :=
have : preimage Prod.swap s β π€ Ξ± := symm_le_uniformity hs
β¨s β© preimage Prod.swap s, inter_mem hs this, fun _ _ β¨hβ, hββ© => β¨hβ, hββ©, inter_subset_leftβ©
#align symm_of_uniformity symm_of_uniformity
theorem comp_symm_of_uniformity {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) :
β t β π€ Ξ±, (β {a b}, (a, b) β t β (b, a) β t) β§ t β t β s :=
let β¨_t, htβ, htββ© := comp_mem_uniformity_sets hs
let β¨t', ht', ht'β, ht'ββ© := symm_of_uniformity htβ
β¨t', ht', ht'β _ _, Subset.trans (monotone_id.compRel monotone_id ht'β) htββ©
#align comp_symm_of_uniformity comp_symm_of_uniformity
theorem uniformity_le_symm : π€ Ξ± β€ @Prod.swap Ξ± Ξ± <$> π€ Ξ± := by
rw [map_swap_eq_comap_swap]; exact tendsto_swap_uniformity.le_comap
#align uniformity_le_symm uniformity_le_symm
theorem uniformity_eq_symm : π€ Ξ± = @Prod.swap Ξ± Ξ± <$> π€ Ξ± :=
le_antisymm uniformity_le_symm symm_le_uniformity
#align uniformity_eq_symm uniformity_eq_symm
@[simp]
theorem comap_swap_uniformity : comap (@Prod.swap Ξ± Ξ±) (π€ Ξ±) = π€ Ξ± :=
(congr_arg _ uniformity_eq_symm).trans <| comap_map Prod.swap_injective
#align comap_swap_uniformity comap_swap_uniformity
theorem symmetrize_mem_uniformity {V : Set (Ξ± Γ Ξ±)} (h : V β π€ Ξ±) : symmetrizeRel V β π€ Ξ± := by
apply (π€ Ξ±).inter_sets h
rw [β image_swap_eq_preimage_swap, uniformity_eq_symm]
exact image_mem_map h
#align symmetrize_mem_uniformity symmetrize_mem_uniformity
theorem UniformSpace.hasBasis_symmetric :
(π€ Ξ±).HasBasis (fun s : Set (Ξ± Γ Ξ±) => s β π€ Ξ± β§ SymmetricRel s) id :=
hasBasis_self.2 fun t t_in =>
β¨symmetrizeRel t, symmetrize_mem_uniformity t_in, symmetric_symmetrizeRel t,
symmetrizeRel_subset_self tβ©
#align uniform_space.has_basis_symmetric UniformSpace.hasBasis_symmetric
theorem uniformity_lift_le_swap {g : Set (Ξ± Γ Ξ±) β Filter Ξ²} {f : Filter Ξ²} (hg : Monotone g)
(h : ((π€ Ξ±).lift fun s => g (preimage Prod.swap s)) β€ f) : (π€ Ξ±).lift g β€ f :=
calc
(π€ Ξ±).lift g β€ (Filter.map (@Prod.swap Ξ± Ξ±) <| π€ Ξ±).lift g :=
lift_mono uniformity_le_symm le_rfl
_ β€ _ := by rw [map_lift_eq2 hg, image_swap_eq_preimage_swap]; exact h
#align uniformity_lift_le_swap uniformity_lift_le_swap
theorem uniformity_lift_le_comp {f : Set (Ξ± Γ Ξ±) β Filter Ξ²} (h : Monotone f) :
((π€ Ξ±).lift fun s => f (s β s)) β€ (π€ Ξ±).lift f :=
calc
((π€ Ξ±).lift fun s => f (s β s)) = ((π€ Ξ±).lift' fun s : Set (Ξ± Γ Ξ±) => s β s).lift f := by
rw [lift_lift'_assoc]
Β· exact monotone_id.compRel monotone_id
Β· exact h
_ β€ (π€ Ξ±).lift f := lift_mono comp_le_uniformity le_rfl
#align uniformity_lift_le_comp uniformity_lift_le_comp
-- Porting note (#10756): new lemma
theorem comp3_mem_uniformity {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) : β t β π€ Ξ±, t β (t β t) β s :=
let β¨_t', ht', ht'sβ© := comp_mem_uniformity_sets hs
let β¨t, ht, htt'β© := comp_mem_uniformity_sets ht'
β¨t, ht, (compRel_mono ((subset_comp_self (refl_le_uniformity ht)).trans htt') htt').trans ht'sβ©
theorem comp_le_uniformity3 : ((π€ Ξ±).lift' fun s : Set (Ξ± Γ Ξ±) => s β (s β s)) β€ π€ Ξ± := fun _ h =>
let β¨_t, htU, htβ© := comp3_mem_uniformity h
mem_of_superset (mem_lift' htU) ht
#align comp_le_uniformity3 comp_le_uniformity3
theorem comp_symm_mem_uniformity_sets {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) :
β t β π€ Ξ±, SymmetricRel t β§ t β t β s := by
obtain β¨w, w_in, w_subβ© : β w β π€ Ξ±, w β w β s := comp_mem_uniformity_sets hs
use symmetrizeRel w, symmetrize_mem_uniformity w_in, symmetric_symmetrizeRel w
have : symmetrizeRel w β w := symmetrizeRel_subset_self w
calc symmetrizeRel w β symmetrizeRel w
_ β w β w := by mono
_ β s := w_sub
#align comp_symm_mem_uniformity_sets comp_symm_mem_uniformity_sets
theorem subset_comp_self_of_mem_uniformity {s : Set (Ξ± Γ Ξ±)} (h : s β π€ Ξ±) : s β s β s :=
subset_comp_self (refl_le_uniformity h)
#align subset_comp_self_of_mem_uniformity subset_comp_self_of_mem_uniformity
theorem comp_comp_symm_mem_uniformity_sets {s : Set (Ξ± Γ Ξ±)} (hs : s β π€ Ξ±) :
β t β π€ Ξ±, SymmetricRel t β§ t β t β t β s := by
rcases comp_symm_mem_uniformity_sets hs with β¨w, w_in, _, w_subβ©
rcases comp_symm_mem_uniformity_sets w_in with β¨t, t_in, t_symm, t_subβ©
use t, t_in, t_symm
have : t β t β t := subset_comp_self_of_mem_uniformity t_in
-- Porting note: Needed the following `have`s to make `mono` work
have ht := Subset.refl t
have hw := Subset.refl w
calc
t β t β t β w β t := by mono
_ β w β (t β t) := by mono
_ β w β w := by mono
_ β s := w_sub
#align comp_comp_symm_mem_uniformity_sets comp_comp_symm_mem_uniformity_sets
def UniformSpace.ball (x : Ξ²) (V : Set (Ξ² Γ Ξ²)) : Set Ξ² :=
Prod.mk x β»ΒΉ' V
#align uniform_space.ball UniformSpace.ball
open UniformSpace (ball)
theorem UniformSpace.mem_ball_self (x : Ξ±) {V : Set (Ξ± Γ Ξ±)} (hV : V β π€ Ξ±) : x β ball x V :=
refl_mem_uniformity hV
#align uniform_space.mem_ball_self UniformSpace.mem_ball_self
theorem mem_ball_comp {V W : Set (Ξ² Γ Ξ²)} {x y z} (h : y β ball x V) (h' : z β ball y W) :
z β ball x (V β W) :=
prod_mk_mem_compRel h h'
#align mem_ball_comp mem_ball_comp
theorem ball_subset_of_comp_subset {V W : Set (Ξ² Γ Ξ²)} {x y} (h : x β ball y W) (h' : W β W β V) :
ball x W β ball y V := fun _z z_in => h' (mem_ball_comp h z_in)
#align ball_subset_of_comp_subset ball_subset_of_comp_subset
theorem ball_mono {V W : Set (Ξ² Γ Ξ²)} (h : V β W) (x : Ξ²) : ball x V β ball x W :=
preimage_mono h
#align ball_mono ball_mono
theorem ball_inter (x : Ξ²) (V W : Set (Ξ² Γ Ξ²)) : ball x (V β© W) = ball x V β© ball x W :=
preimage_inter
#align ball_inter ball_inter
theorem ball_inter_left (x : Ξ²) (V W : Set (Ξ² Γ Ξ²)) : ball x (V β© W) β ball x V :=
ball_mono inter_subset_left x
#align ball_inter_left ball_inter_left
theorem ball_inter_right (x : Ξ²) (V W : Set (Ξ² Γ Ξ²)) : ball x (V β© W) β ball x W :=
ball_mono inter_subset_right x
#align ball_inter_right ball_inter_right
theorem mem_ball_symmetry {V : Set (Ξ² Γ Ξ²)} (hV : SymmetricRel V) {x y} :
x β ball y V β y β ball x V :=
show (x, y) β Prod.swap β»ΒΉ' V β (x, y) β V by
unfold SymmetricRel at hV
rw [hV]
#align mem_ball_symmetry mem_ball_symmetry
theorem ball_eq_of_symmetry {V : Set (Ξ² Γ Ξ²)} (hV : SymmetricRel V) {x} :
ball x V = { y | (y, x) β V } := by
ext y
rw [mem_ball_symmetry hV]
exact Iff.rfl
#align ball_eq_of_symmetry ball_eq_of_symmetry
theorem mem_comp_of_mem_ball {V W : Set (Ξ² Γ Ξ²)} {x y z : Ξ²} (hV : SymmetricRel V)
(hx : x β ball z V) (hy : y β ball z W) : (x, y) β V β W := by
rw [mem_ball_symmetry hV] at hx
exact β¨z, hx, hyβ©
#align mem_comp_of_mem_ball mem_comp_of_mem_ball
theorem UniformSpace.isOpen_ball (x : Ξ±) {V : Set (Ξ± Γ Ξ±)} (hV : IsOpen V) : IsOpen (ball x V) :=
hV.preimage <| continuous_const.prod_mk continuous_id
#align uniform_space.is_open_ball UniformSpace.isOpen_ball
theorem UniformSpace.isClosed_ball (x : Ξ±) {V : Set (Ξ± Γ Ξ±)} (hV : IsClosed V) :
IsClosed (ball x V) :=
hV.preimage <| continuous_const.prod_mk continuous_id
theorem mem_comp_comp {V W M : Set (Ξ² Γ Ξ²)} (hW' : SymmetricRel W) {p : Ξ² Γ Ξ²} :
p β V β M β W β (ball p.1 V ΓΛ’ ball p.2 W β© M).Nonempty := by
cases' p with x y
constructor
Β· rintro β¨z, β¨w, hpw, hwzβ©, hzyβ©
exact β¨(w, z), β¨hpw, by rwa [mem_ball_symmetry hW']β©, hwzβ©
Β· rintro β¨β¨w, zβ©, β¨w_in, z_inβ©, hwzβ©
rw [mem_ball_symmetry hW'] at z_in
exact β¨z, β¨w, w_in, hwzβ©, z_inβ©
#align mem_comp_comp mem_comp_comp
theorem mem_nhds_uniformity_iff_right {x : Ξ±} {s : Set Ξ±} :
s β π x β { p : Ξ± Γ Ξ± | p.1 = x β p.2 β s } β π€ Ξ± := by
simp only [nhds_eq_comap_uniformity, mem_comap_prod_mk]
#align mem_nhds_uniformity_iff_right mem_nhds_uniformity_iff_right
theorem mem_nhds_uniformity_iff_left {x : Ξ±} {s : Set Ξ±} :
s β π x β { p : Ξ± Γ Ξ± | p.2 = x β p.1 β s } β π€ Ξ± := by
rw [uniformity_eq_symm, mem_nhds_uniformity_iff_right]
simp only [map_def, mem_map, preimage_setOf_eq, Prod.snd_swap, Prod.fst_swap]
#align mem_nhds_uniformity_iff_left mem_nhds_uniformity_iff_left
theorem nhdsWithin_eq_comap_uniformity_of_mem {x : Ξ±} {T : Set Ξ±} (hx : x β T) (S : Set Ξ±) :
π[S] x = (π€ Ξ± β π (T ΓΛ’ S)).comap (Prod.mk x) := by
simp [nhdsWithin, nhds_eq_comap_uniformity, hx]
theorem nhdsWithin_eq_comap_uniformity {x : Ξ±} (S : Set Ξ±) :
π[S] x = (π€ Ξ± β π (univ ΓΛ’ S)).comap (Prod.mk x) :=
nhdsWithin_eq_comap_uniformity_of_mem (mem_univ _) S
theorem isOpen_iff_ball_subset {s : Set Ξ±} : IsOpen s β β x β s, β V β π€ Ξ±, ball x V β s := by
simp_rw [isOpen_iff_mem_nhds, nhds_eq_comap_uniformity, mem_comap, ball]
#align is_open_iff_ball_subset isOpen_iff_ball_subset
theorem nhds_basis_uniformity' {p : ΞΉ β Prop} {s : ΞΉ β Set (Ξ± Γ Ξ±)} (h : (π€ Ξ±).HasBasis p s)
{x : Ξ±} : (π x).HasBasis p fun i => ball x (s i) := by
rw [nhds_eq_comap_uniformity]
exact h.comap (Prod.mk x)
#align nhds_basis_uniformity' nhds_basis_uniformity'
theorem nhds_basis_uniformity {p : ΞΉ β Prop} {s : ΞΉ β Set (Ξ± Γ Ξ±)} (h : (π€ Ξ±).HasBasis p s)
{x : Ξ±} : (π x).HasBasis p fun i => { y | (y, x) β s i } := by
replace h := h.comap Prod.swap
rw [comap_swap_uniformity] at h
exact nhds_basis_uniformity' h
#align nhds_basis_uniformity nhds_basis_uniformity
theorem nhds_eq_comap_uniformity' {x : Ξ±} : π x = (π€ Ξ±).comap fun y => (y, x) :=
(nhds_basis_uniformity (π€ Ξ±).basis_sets).eq_of_same_basis <| (π€ Ξ±).basis_sets.comap _
#align nhds_eq_comap_uniformity' nhds_eq_comap_uniformity'
| Mathlib/Topology/UniformSpace/Basic.lean | 763 | 765 | theorem UniformSpace.mem_nhds_iff {x : Ξ±} {s : Set Ξ±} : s β π x β β V β π€ Ξ±, ball x V β s := by |
rw [nhds_eq_comap_uniformity, mem_comap]
simp_rw [ball]
|
import Mathlib.Logic.Relation
import Mathlib.Data.List.Forall2
import Mathlib.Data.List.Lex
import Mathlib.Data.List.Infix
#align_import data.list.chain from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
universe u v
open Nat
namespace List
variable {Ξ± : Type u} {Ξ² : Type v} {R r : Ξ± β Ξ± β Prop} {l lβ lβ : List Ξ±} {a b : Ξ±}
mk_iff_of_inductive_prop List.Chain List.chain_iff
#align list.chain_iff List.chain_iff
#align list.chain.nil List.Chain.nil
#align list.chain.cons List.Chain.cons
#align list.rel_of_chain_cons List.rel_of_chain_cons
#align list.chain_of_chain_cons List.chain_of_chain_cons
#align list.chain.imp' List.Chain.imp'
#align list.chain.imp List.Chain.imp
theorem Chain.iff {S : Ξ± β Ξ± β Prop} (H : β a b, R a b β S a b) {a : Ξ±} {l : List Ξ±} :
Chain R a l β Chain S a l :=
β¨Chain.imp fun a b => (H a b).1, Chain.imp fun a b => (H a b).2β©
#align list.chain.iff List.Chain.iff
theorem Chain.iff_mem {a : Ξ±} {l : List Ξ±} :
Chain R a l β Chain (fun x y => x β a :: l β§ y β l β§ R x y) a l :=
β¨fun p => by
induction' p with _ a b l r _ IH <;> constructor <;>
[exact β¨mem_cons_self _ _, mem_cons_self _ _, rβ©;
exact IH.imp fun a b β¨am, bm, hβ© => β¨mem_cons_of_mem _ am, mem_cons_of_mem _ bm, hβ©],
Chain.imp fun a b h => h.2.2β©
#align list.chain.iff_mem List.Chain.iff_mem
theorem chain_singleton {a b : Ξ±} : Chain R a [b] β R a b := by
simp only [chain_cons, Chain.nil, and_true_iff]
#align list.chain_singleton List.chain_singleton
theorem chain_split {a b : Ξ±} {lβ lβ : List Ξ±} :
Chain R a (lβ ++ b :: lβ) β Chain R a (lβ ++ [b]) β§ Chain R b lβ := by
induction' lβ with x lβ IH generalizing a <;>
simp only [*, nil_append, cons_append, Chain.nil, chain_cons, and_true_iff, and_assoc]
#align list.chain_split List.chain_split
@[simp]
theorem chain_append_cons_cons {a b c : Ξ±} {lβ lβ : List Ξ±} :
Chain R a (lβ ++ b :: c :: lβ) β Chain R a (lβ ++ [b]) β§ R b c β§ Chain R c lβ := by
rw [chain_split, chain_cons]
#align list.chain_append_cons_cons List.chain_append_cons_cons
theorem chain_iff_forallβ :
β {a : Ξ±} {l : List Ξ±}, Chain R a l β l = [] β¨ Forallβ R (a :: dropLast l) l
| a, [] => by simp
| a, b :: l => by
by_cases h : l = [] <;>
simp [@chain_iff_forallβ b l, dropLast, *]
#align list.chain_iff_forallβ List.chain_iff_forallβ
| Mathlib/Data/List/Chain.lean | 82 | 83 | theorem chain_append_singleton_iff_forallβ :
Chain R a (l ++ [b]) β Forallβ R (a :: l) (l ++ [b]) := by | simp [chain_iff_forallβ]
|
import Mathlib.Data.Set.Card
import Mathlib.Order.Minimal
import Mathlib.Data.Matroid.Init
set_option autoImplicit true
open Set
def Matroid.ExchangeProperty {Ξ± : Type _} (P : Set Ξ± β Prop) : Prop :=
β X Y, P X β P Y β β a β X \ Y, β b β Y \ X, P (insert b (X \ {a}))
def Matroid.ExistsMaximalSubsetProperty {Ξ± : Type _} (P : Set Ξ± β Prop) (X : Set Ξ±) : Prop :=
β I, P I β I β X β (maximals (Β· β Β·) {Y | P Y β§ I β Y β§ Y β X}).Nonempty
@[ext] structure Matroid (Ξ± : Type _) where
(E : Set Ξ±)
(Base : Set Ξ± β Prop)
(Indep : Set Ξ± β Prop)
(indep_iff' : β β¦Iβ¦, Indep I β β B, Base B β§ I β B)
(exists_base : β B, Base B)
(base_exchange : Matroid.ExchangeProperty Base)
(maximality : β X, X β E β Matroid.ExistsMaximalSubsetProperty Indep X)
(subset_ground : β B, Base B β B β E)
namespace Matroid
variable {Ξ± : Type*} {M : Matroid Ξ±}
protected class Finite (M : Matroid Ξ±) : Prop where
(ground_finite : M.E.Finite)
protected class Nonempty (M : Matroid Ξ±) : Prop where
(ground_nonempty : M.E.Nonempty)
theorem ground_nonempty (M : Matroid Ξ±) [M.Nonempty] : M.E.Nonempty :=
Nonempty.ground_nonempty
theorem ground_nonempty_iff (M : Matroid Ξ±) : M.E.Nonempty β M.Nonempty :=
β¨fun h β¦ β¨hβ©, fun β¨hβ© β¦ hβ©
theorem ground_finite (M : Matroid Ξ±) [M.Finite] : M.E.Finite :=
Finite.ground_finite
theorem set_finite (M : Matroid Ξ±) [M.Finite] (X : Set Ξ±) (hX : X β M.E := by aesop) : X.Finite :=
M.ground_finite.subset hX
instance finite_of_finite [Finite Ξ±] {M : Matroid Ξ±} : M.Finite :=
β¨Set.toFinite _β©
class FiniteRk (M : Matroid Ξ±) : Prop where
exists_finite_base : β B, M.Base B β§ B.Finite
instance finiteRk_of_finite (M : Matroid Ξ±) [M.Finite] : FiniteRk M :=
β¨M.exists_base.imp (fun B hB β¦ β¨hB, M.set_finite B (M.subset_ground _ hB)β©)β©
class InfiniteRk (M : Matroid Ξ±) : Prop where
exists_infinite_base : β B, M.Base B β§ B.Infinite
class RkPos (M : Matroid Ξ±) : Prop where
empty_not_base : Β¬M.Base β
theorem rkPos_iff_empty_not_base : M.RkPos β Β¬M.Base β
:=
β¨fun β¨hβ© β¦ h, fun h β¦ β¨hβ©β©
section exchange
section Basis
def Basis (M : Matroid Ξ±) (I X : Set Ξ±) : Prop :=
I β maximals (Β· β Β·) {A | M.Indep A β§ A β X} β§ X β M.E
def Basis' (M : Matroid Ξ±) (I X : Set Ξ±) : Prop :=
I β maximals (Β· β Β·) {A | M.Indep A β§ A β X}
theorem Basis'.indep (hI : M.Basis' I X) : M.Indep I :=
hI.1.1
theorem Basis.indep (hI : M.Basis I X) : M.Indep I :=
hI.1.1.1
theorem Basis.subset (hI : M.Basis I X) : I β X :=
hI.1.1.2
theorem Basis.basis' (hI : M.Basis I X) : M.Basis' I X :=
hI.1
theorem Basis'.basis (hI : M.Basis' I X) (hX : X β M.E := by aesop_mat) : M.Basis I X :=
β¨hI, hXβ©
theorem Basis'.subset (hI : M.Basis' I X) : I β X :=
hI.1.2
theorem setOf_basis_eq (M : Matroid Ξ±) (hX : X β M.E := by aesop_mat) :
{I | M.Basis I X} = maximals (Β· β Β·) ({I | M.Indep I} β© Iic X) := by
ext I; simp [Matroid.Basis, maximals, iff_true_intro hX]
@[aesop unsafe 15% (rule_sets := [Matroid])]
theorem Basis.subset_ground (hI : M.Basis I X) : X β M.E :=
hI.2
theorem Basis.basis_inter_ground (hI : M.Basis I X) : M.Basis I (X β© M.E) := by
convert hI
rw [inter_eq_self_of_subset_left hI.subset_ground]
@[aesop unsafe 15% (rule_sets := [Matroid])]
theorem Basis.left_subset_ground (hI : M.Basis I X) : I β M.E :=
hI.indep.subset_ground
theorem Basis.eq_of_subset_indep (hI : M.Basis I X) (hJ : M.Indep J) (hIJ : I β J) (hJX : J β X) :
I = J :=
hIJ.antisymm (hI.1.2 β¨hJ, hJXβ© hIJ)
theorem Basis.Finite (hI : M.Basis I X) [FiniteRk M] : I.Finite := hI.indep.finite
| Mathlib/Data/Matroid/Basic.lean | 739 | 742 | theorem basis_iff' :
M.Basis I X β (M.Indep I β§ I β X β§ β J, M.Indep J β I β J β J β X β I = J) β§ X β M.E := by |
simp [Basis, mem_maximals_setOf_iff, and_assoc, and_congr_left_iff, and_imp,
and_congr_left_iff, and_congr_right_iff, @Imp.swap (_ β X)]
|
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β· X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β· X) β« mul = (Ξ±_ X X X).hom β« (X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
attribute [simp] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [tensorHom_def'_assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [tensorHom_def_assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
| Mathlib/CategoryTheory/Monoidal/Mon_.lean | 84 | 85 | theorem assoc_flip :
(M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β· M.X) β« M.mul := by | simp
|
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace Num
variable {Ξ± : Type*}
open PosNum
theorem pred_to_nat : β n : Num, (pred n : β) = Nat.pred n
| 0 => rfl
| pos p => by rw [pred, PosNum.pred'_to_nat]; rfl
#align num.pred_to_nat Num.pred_to_nat
theorem ppred_to_nat : β n : Num, (β) <$> ppred n = Nat.ppred n
| 0 => rfl
| pos p => by
rw [ppred, Option.map_some, Nat.ppred_eq_some.2]
rw [PosNum.pred'_to_nat, Nat.succ_pred_eq_of_pos (PosNum.to_nat_pos _)]
rfl
#align num.ppred_to_nat Num.ppred_to_nat
theorem cmp_swap (m n) : (cmp m n).swap = cmp n m := by
cases m <;> cases n <;> try { rfl }; apply PosNum.cmp_swap
#align num.cmp_swap Num.cmp_swap
theorem cmp_eq (m n) : cmp m n = Ordering.eq β m = n := by
have := cmp_to_nat m n
-- Porting note: `cases` didn't rewrite at `this`, so `revert` & `intro` are required.
revert this; cases cmp m n <;> intro this <;> simp at this β’ <;> try { exact this } <;>
simp [show m β n from fun e => by rw [e] at this; exact lt_irrefl _ this]
#align num.cmp_eq Num.cmp_eq
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring Ξ±] {m n : Num} : (m : Ξ±) < n β m < n := by
rw [β cast_to_nat m, β cast_to_nat n, Nat.cast_lt (Ξ± := Ξ±), lt_to_nat]
#align num.cast_lt Num.cast_lt
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring Ξ±] {m n : Num} : (m : Ξ±) β€ n β m β€ n := by
rw [β not_lt]; exact not_congr cast_lt
#align num.cast_le Num.cast_le
@[simp, norm_cast]
| Mathlib/Data/Num/Lemmas.lean | 870 | 871 | theorem cast_inj [LinearOrderedSemiring Ξ±] {m n : Num} : (m : Ξ±) = n β m = n := by |
rw [β cast_to_nat m, β cast_to_nat n, Nat.cast_inj, to_nat_inj]
|
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.Prod
import Mathlib.SetTheory.Cardinal.Basic
import Mathlib.Tactic.FinCases
import Mathlib.Tactic.LinearCombination
import Mathlib.Lean.Expr.ExtraRecognizers
import Mathlib.Data.Set.Subsingleton
#align_import linear_algebra.linear_independent from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb"
noncomputable section
open Function Set Submodule
open Cardinal
universe u' u
variable {ΞΉ : Type u'} {ΞΉ' : Type*} {R : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable {v : ΞΉ β M}
variable [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M'']
variable [Module R M] [Module R M'] [Module R M'']
variable {a b : R} {x y : M}
variable (R) (v)
def LinearIndependent : Prop :=
LinearMap.ker (Finsupp.total ΞΉ M R v) = β₯
#align linear_independent LinearIndependent
open Lean PrettyPrinter.Delaborator SubExpr in
@[delab app.LinearIndependent]
def delabLinearIndependent : Delab :=
whenPPOption getPPNotation <|
whenNotPPOption getPPAnalysisSkip <|
withOptionAtCurrPos `pp.analysis.skip true do
let e β getExpr
guard <| e.isAppOfArity ``LinearIndependent 7
let some _ := (e.getArg! 0).coeTypeSet? | failure
let optionsPerPos β if (e.getArg! 3).isLambda then
withNaryArg 3 do return (β read).optionsPerPos.setBool (β getPos) pp.funBinderTypes.name true
else
withNaryArg 0 do return (β read).optionsPerPos.setBool (β getPos) `pp.analysis.namedArg true
withTheReader Context ({Β· with optionsPerPos}) delab
variable {R} {v}
theorem linearIndependent_iff :
LinearIndependent R v β β l, Finsupp.total ΞΉ M R v l = 0 β l = 0 := by
simp [LinearIndependent, LinearMap.ker_eq_bot']
#align linear_independent_iff linearIndependent_iff
theorem linearIndependent_iff' :
LinearIndependent R v β
β s : Finset ΞΉ, β g : ΞΉ β R, β i β s, g i β’ v i = 0 β β i β s, g i = 0 :=
linearIndependent_iff.trans
β¨fun hf s g hg i his =>
have h :=
hf (β i β s, Finsupp.single i (g i)) <| by
simpa only [map_sum, Finsupp.total_single] using hg
calc
g i = (Finsupp.lapply i : (ΞΉ ββ R) ββ[R] R) (Finsupp.single i (g i)) := by
{ rw [Finsupp.lapply_apply, Finsupp.single_eq_same] }
_ = β j β s, (Finsupp.lapply i : (ΞΉ ββ R) ββ[R] R) (Finsupp.single j (g j)) :=
Eq.symm <|
Finset.sum_eq_single i
(fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji])
fun hnis => hnis.elim his
_ = (β j β s, Finsupp.single j (g j)) i := (map_sum ..).symm
_ = 0 := DFunLike.ext_iff.1 h i,
fun hf l hl =>
Finsupp.ext fun i =>
_root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hniβ©
#align linear_independent_iff' linearIndependent_iff'
theorem linearIndependent_iff'' :
LinearIndependent R v β
β (s : Finset ΞΉ) (g : ΞΉ β R), (β i β s, g i = 0) β
β i β s, g i β’ v i = 0 β β i, g i = 0 := by
classical
exact linearIndependent_iff'.trans
β¨fun H s g hg hv i => if his : i β s then H s g hv i his else hg i his, fun H s g hg i hi => by
convert
H s (fun j => if j β s then g j else 0) (fun j hj => if_neg hj)
(by simp_rw [ite_smul, zero_smul, Finset.sum_extend_by_zero, hg]) i
exact (if_pos hi).symmβ©
#align linear_independent_iff'' linearIndependent_iff''
theorem not_linearIndependent_iff :
Β¬LinearIndependent R v β
β s : Finset ΞΉ, β g : ΞΉ β R, β i β s, g i β’ v i = 0 β§ β i β s, g i β 0 := by
rw [linearIndependent_iff']
simp only [exists_prop, not_forall]
#align not_linear_independent_iff not_linearIndependent_iff
theorem Fintype.linearIndependent_iff [Fintype ΞΉ] :
LinearIndependent R v β β g : ΞΉ β R, β i, g i β’ v i = 0 β β i, g i = 0 := by
refine
β¨fun H g => by simpa using linearIndependent_iff'.1 H Finset.univ g, fun H =>
linearIndependent_iff''.2 fun s g hg hs i => H _ ?_ _β©
rw [β hs]
refine (Finset.sum_subset (Finset.subset_univ _) fun i _ hi => ?_).symm
rw [hg i hi, zero_smul]
#align fintype.linear_independent_iff Fintype.linearIndependent_iff
theorem Fintype.linearIndependent_iff' [Fintype ΞΉ] [DecidableEq ΞΉ] :
LinearIndependent R v β
LinearMap.ker (LinearMap.lsum R (fun _ β¦ R) β fun i β¦ LinearMap.id.smulRight (v i)) = β₯ := by
simp [Fintype.linearIndependent_iff, LinearMap.ker_eq_bot', funext_iff]
#align fintype.linear_independent_iff' Fintype.linearIndependent_iff'
theorem Fintype.not_linearIndependent_iff [Fintype ΞΉ] :
Β¬LinearIndependent R v β β g : ΞΉ β R, β i, g i β’ v i = 0 β§ β i, g i β 0 := by
simpa using not_iff_not.2 Fintype.linearIndependent_iff
#align fintype.not_linear_independent_iff Fintype.not_linearIndependent_iff
theorem linearIndependent_empty_type [IsEmpty ΞΉ] : LinearIndependent R v :=
linearIndependent_iff.mpr fun v _hv => Subsingleton.elim v 0
#align linear_independent_empty_type linearIndependent_empty_type
theorem LinearIndependent.ne_zero [Nontrivial R] (i : ΞΉ) (hv : LinearIndependent R v) : v i β 0 :=
fun h =>
zero_ne_one' R <|
Eq.symm
(by
suffices (Finsupp.single i 1 : ΞΉ ββ R) i = 0 by simpa
rw [linearIndependent_iff.1 hv (Finsupp.single i 1)]
Β· simp
Β· simp [h])
#align linear_independent.ne_zero LinearIndependent.ne_zero
lemma LinearIndependent.eq_zero_of_pair {x y : M} (h : LinearIndependent R ![x, y])
{s t : R} (h' : s β’ x + t β’ y = 0) : s = 0 β§ t = 0 := by
have := linearIndependent_iff'.1 h Finset.univ ![s, t]
simp only [Fin.sum_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons, h',
Finset.mem_univ, forall_true_left] at this
exact β¨this 0, this 1β©
lemma LinearIndependent.pair_iff {x y : M} :
LinearIndependent R ![x, y] β β (s t : R), s β’ x + t β’ y = 0 β s = 0 β§ t = 0 := by
refine β¨fun h s t hst β¦ h.eq_zero_of_pair hst, fun h β¦ ?_β©
apply Fintype.linearIndependent_iff.2
intro g hg
simp only [Fin.sum_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons] at hg
intro i
fin_cases i
exacts [(h _ _ hg).1, (h _ _ hg).2]
theorem LinearIndependent.comp (h : LinearIndependent R v) (f : ΞΉ' β ΞΉ) (hf : Injective f) :
LinearIndependent R (v β f) := by
rw [linearIndependent_iff, Finsupp.total_comp]
intro l hl
have h_map_domain : β x, (Finsupp.mapDomain f l) (f x) = 0 := by
rw [linearIndependent_iff.1 h (Finsupp.mapDomain f l) hl]; simp
ext x
convert h_map_domain x
rw [Finsupp.mapDomain_apply hf]
#align linear_independent.comp LinearIndependent.comp
theorem linearIndependent_iff_finset_linearIndependent :
LinearIndependent R v β β (s : Finset ΞΉ), LinearIndependent R (v β (Subtype.val : s β ΞΉ)) :=
β¨fun H _ β¦ H.comp _ Subtype.val_injective, fun H β¦ linearIndependent_iff'.2 fun s g hg i hi β¦
Fintype.linearIndependent_iff.1 (H s) (g β Subtype.val)
(hg βΈ Finset.sum_attach s fun j β¦ g j β’ v j) β¨i, hiβ©β©
theorem LinearIndependent.coe_range (i : LinearIndependent R v) :
LinearIndependent R ((β) : range v β M) := by simpa using i.comp _ (rangeSplitting_injective v)
#align linear_independent.coe_range LinearIndependent.coe_range
theorem LinearIndependent.map (hv : LinearIndependent R v) {f : M ββ[R] M'}
(hf_inj : Disjoint (span R (range v)) (LinearMap.ker f)) : LinearIndependent R (f β v) := by
rw [disjoint_iff_inf_le, β Set.image_univ, Finsupp.span_image_eq_map_total,
map_inf_eq_map_inf_comap, map_le_iff_le_comap, comap_bot, Finsupp.supported_univ, top_inf_eq]
at hf_inj
unfold LinearIndependent at hv β’
rw [hv, le_bot_iff] at hf_inj
haveI : Inhabited M := β¨0β©
rw [Finsupp.total_comp, Finsupp.lmapDomain_total _ _ f, LinearMap.ker_comp,
hf_inj]
exact fun _ => rfl
#align linear_independent.map LinearIndependent.map
theorem Submodule.range_ker_disjoint {f : M ββ[R] M'}
(hv : LinearIndependent R (f β v)) :
Disjoint (span R (range v)) (LinearMap.ker f) := by
rw [LinearIndependent, Finsupp.total_comp, Finsupp.lmapDomain_total R _ f (fun _ β¦ rfl),
LinearMap.ker_comp] at hv
rw [disjoint_iff_inf_le, β Set.image_univ, Finsupp.span_image_eq_map_total,
map_inf_eq_map_inf_comap, hv, inf_bot_eq, map_bot]
theorem LinearIndependent.map' (hv : LinearIndependent R v) (f : M ββ[R] M')
(hf_inj : LinearMap.ker f = β₯) : LinearIndependent R (f β v) :=
hv.map <| by simp [hf_inj]
#align linear_independent.map' LinearIndependent.map'
theorem LinearIndependent.map_of_injective_injective {R' : Type*} {M' : Type*}
[Semiring R'] [AddCommMonoid M'] [Module R' M'] (hv : LinearIndependent R v)
(i : R' β R) (j : M β+ M') (hi : β r, i r = 0 β r = 0) (hj : β m, j m = 0 β m = 0)
(hc : β (r : R') (m : M), j (i r β’ m) = r β’ j m) : LinearIndependent R' (j β v) := by
rw [linearIndependent_iff'] at hv β’
intro S r' H s hs
simp_rw [comp_apply, β hc, β map_sum] at H
exact hi _ <| hv _ _ (hj _ H) s hs
theorem LinearIndependent.map_of_surjective_injective {R' : Type*} {M' : Type*}
[Semiring R'] [AddCommMonoid M'] [Module R' M'] (hv : LinearIndependent R v)
(i : ZeroHom R R') (j : M β+ M') (hi : Surjective i) (hj : β m, j m = 0 β m = 0)
(hc : β (r : R) (m : M), j (r β’ m) = i r β’ j m) : LinearIndependent R' (j β v) := by
obtain β¨i', hi'β© := hi.hasRightInverse
refine hv.map_of_injective_injective i' j (fun _ h β¦ ?_) hj fun r m β¦ ?_
Β· apply_fun i at h
rwa [hi', i.map_zero] at h
rw [hc (i' r) m, hi']
theorem LinearIndependent.of_comp (f : M ββ[R] M') (hfv : LinearIndependent R (f β v)) :
LinearIndependent R v :=
linearIndependent_iff'.2 fun s g hg i his =>
have : (β i β s, g i β’ f (v i)) = 0 := by
simp_rw [β map_smul, β map_sum, hg, f.map_zero]
linearIndependent_iff'.1 hfv s g this i his
#align linear_independent.of_comp LinearIndependent.of_comp
protected theorem LinearMap.linearIndependent_iff (f : M ββ[R] M') (hf_inj : LinearMap.ker f = β₯) :
LinearIndependent R (f β v) β LinearIndependent R v :=
β¨fun h => h.of_comp f, fun h => h.map <| by simp only [hf_inj, disjoint_bot_right]β©
#align linear_map.linear_independent_iff LinearMap.linearIndependent_iff
@[nontriviality]
theorem linearIndependent_of_subsingleton [Subsingleton R] : LinearIndependent R v :=
linearIndependent_iff.2 fun _l _hl => Subsingleton.elim _ _
#align linear_independent_of_subsingleton linearIndependent_of_subsingleton
theorem linearIndependent_equiv (e : ΞΉ β ΞΉ') {f : ΞΉ' β M} :
LinearIndependent R (f β e) β LinearIndependent R f :=
β¨fun h => Function.comp_id f βΈ e.self_comp_symm βΈ h.comp _ e.symm.injective, fun h =>
h.comp _ e.injectiveβ©
#align linear_independent_equiv linearIndependent_equiv
theorem linearIndependent_equiv' (e : ΞΉ β ΞΉ') {f : ΞΉ' β M} {g : ΞΉ β M} (h : f β e = g) :
LinearIndependent R g β LinearIndependent R f :=
h βΈ linearIndependent_equiv e
#align linear_independent_equiv' linearIndependent_equiv'
theorem linearIndependent_subtype_range {ΞΉ} {f : ΞΉ β M} (hf : Injective f) :
LinearIndependent R ((β) : range f β M) β LinearIndependent R f :=
Iff.symm <| linearIndependent_equiv' (Equiv.ofInjective f hf) rfl
#align linear_independent_subtype_range linearIndependent_subtype_range
alias β¨LinearIndependent.of_subtype_range, _β© := linearIndependent_subtype_range
#align linear_independent.of_subtype_range LinearIndependent.of_subtype_range
theorem linearIndependent_image {ΞΉ} {s : Set ΞΉ} {f : ΞΉ β M} (hf : Set.InjOn f s) :
(LinearIndependent R fun x : s => f x) β LinearIndependent R fun x : f '' s => (x : M) :=
linearIndependent_equiv' (Equiv.Set.imageOfInjOn _ _ hf) rfl
#align linear_independent_image linearIndependent_image
theorem linearIndependent_span (hs : LinearIndependent R v) :
LinearIndependent R (M := span R (range v))
(fun i : ΞΉ => β¨v i, subset_span (mem_range_self i)β©) :=
LinearIndependent.of_comp (span R (range v)).subtype hs
#align linear_independent_span linearIndependent_span
theorem LinearIndependent.fin_cons' {m : β} (x : M) (v : Fin m β M) (hli : LinearIndependent R v)
(x_ortho : β (c : R) (y : Submodule.span R (Set.range v)), c β’ x + y = (0 : M) β c = 0) :
LinearIndependent R (Fin.cons x v : Fin m.succ β M) := by
rw [Fintype.linearIndependent_iff] at hli β’
rintro g total_eq j
simp_rw [Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ] at total_eq
have : g 0 = 0 := by
refine x_ortho (g 0) β¨β i : Fin m, g i.succ β’ v i, ?_β© total_eq
exact sum_mem fun i _ => smul_mem _ _ (subset_span β¨i, rflβ©)
rw [this, zero_smul, zero_add] at total_eq
exact Fin.cases this (hli _ total_eq) j
#align linear_independent.fin_cons' LinearIndependent.fin_cons'
theorem LinearIndependent.restrict_scalars [Semiring K] [SMulWithZero R K] [Module K M]
[IsScalarTower R K M] (hinj : Function.Injective fun r : R => r β’ (1 : K))
(li : LinearIndependent K v) : LinearIndependent R v := by
refine linearIndependent_iff'.mpr fun s g hg i hi => hinj ?_
dsimp only; rw [zero_smul]
refine (linearIndependent_iff'.mp li : _) _ (g Β· β’ (1:K)) ?_ i hi
simp_rw [smul_assoc, one_smul]
exact hg
#align linear_independent.restrict_scalars LinearIndependent.restrict_scalars
theorem linearIndependent_finset_map_embedding_subtype (s : Set M)
(li : LinearIndependent R ((β) : s β M)) (t : Finset s) :
LinearIndependent R ((β) : Finset.map (Embedding.subtype s) t β M) := by
let f : t.map (Embedding.subtype s) β s := fun x =>
β¨x.1, by
obtain β¨x, hβ© := x
rw [Finset.mem_map] at h
obtain β¨a, _ha, rflβ© := h
simp only [Subtype.coe_prop, Embedding.coe_subtype]β©
convert LinearIndependent.comp li f ?_
rintro β¨x, hxβ© β¨y, hyβ©
rw [Finset.mem_map] at hx hy
obtain β¨a, _ha, rflβ© := hx
obtain β¨b, _hb, rflβ© := hy
simp only [f, imp_self, Subtype.mk_eq_mk]
#align linear_independent_finset_map_embedding_subtype linearIndependent_finset_map_embedding_subtype
theorem linearIndependent_bounded_of_finset_linearIndependent_bounded {n : β}
(H : β s : Finset M, (LinearIndependent R fun i : s => (i : M)) β s.card β€ n) :
β s : Set M, LinearIndependent R ((β) : s β M) β #s β€ n := by
intro s li
apply Cardinal.card_le_of
intro t
rw [β Finset.card_map (Embedding.subtype s)]
apply H
apply linearIndependent_finset_map_embedding_subtype _ li
#align linear_independent_bounded_of_finset_linear_independent_bounded linearIndependent_bounded_of_finset_linearIndependent_bounded
section Module
variable {v : ΞΉ β M}
variable [Ring R] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M'']
variable [Module R M] [Module R M'] [Module R M'']
variable {a b : R} {x y : M}
theorem linearIndependent_iff_injective_total :
LinearIndependent R v β Function.Injective (Finsupp.total ΞΉ M R v) :=
linearIndependent_iff.trans
(injective_iff_map_eq_zero (Finsupp.total ΞΉ M R v).toAddMonoidHom).symm
#align linear_independent_iff_injective_total linearIndependent_iff_injective_total
alias β¨LinearIndependent.injective_total, _β© := linearIndependent_iff_injective_total
#align linear_independent.injective_total LinearIndependent.injective_total
theorem LinearIndependent.injective [Nontrivial R] (hv : LinearIndependent R v) : Injective v := by
intro i j hij
let l : ΞΉ ββ R := Finsupp.single i (1 : R) - Finsupp.single j 1
have h_total : Finsupp.total ΞΉ M R v l = 0 := by
simp_rw [l, LinearMap.map_sub, Finsupp.total_apply]
simp [hij]
have h_single_eq : Finsupp.single i (1 : R) = Finsupp.single j 1 := by
rw [linearIndependent_iff] at hv
simp [eq_add_of_sub_eq' (hv l h_total)]
simpa [Finsupp.single_eq_single_iff] using h_single_eq
#align linear_independent.injective LinearIndependent.injective
theorem LinearIndependent.to_subtype_range {ΞΉ} {f : ΞΉ β M} (hf : LinearIndependent R f) :
LinearIndependent R ((β) : range f β M) := by
nontriviality R
exact (linearIndependent_subtype_range hf.injective).2 hf
#align linear_independent.to_subtype_range LinearIndependent.to_subtype_range
theorem LinearIndependent.to_subtype_range' {ΞΉ} {f : ΞΉ β M} (hf : LinearIndependent R f) {t}
(ht : range f = t) : LinearIndependent R ((β) : t β M) :=
ht βΈ hf.to_subtype_range
#align linear_independent.to_subtype_range' LinearIndependent.to_subtype_range'
theorem LinearIndependent.image_of_comp {ΞΉ ΞΉ'} (s : Set ΞΉ) (f : ΞΉ β ΞΉ') (g : ΞΉ' β M)
(hs : LinearIndependent R fun x : s => g (f x)) :
LinearIndependent R fun x : f '' s => g x := by
nontriviality R
have : InjOn f s := injOn_iff_injective.2 hs.injective.of_comp
exact (linearIndependent_equiv' (Equiv.Set.imageOfInjOn f s this) rfl).1 hs
#align linear_independent.image_of_comp LinearIndependent.image_of_comp
theorem LinearIndependent.image {ΞΉ} {s : Set ΞΉ} {f : ΞΉ β M}
(hs : LinearIndependent R fun x : s => f x) :
LinearIndependent R fun x : f '' s => (x : M) := by
convert LinearIndependent.image_of_comp s f id hs
#align linear_independent.image LinearIndependent.image
theorem LinearIndependent.group_smul {G : Type*} [hG : Group G] [DistribMulAction G R]
[DistribMulAction G M] [IsScalarTower G R M] [SMulCommClass G R M] {v : ΞΉ β M}
(hv : LinearIndependent R v) (w : ΞΉ β G) : LinearIndependent R (w β’ v) := by
rw [linearIndependent_iff''] at hv β’
intro s g hgs hsum i
refine (smul_eq_zero_iff_eq (w i)).1 ?_
refine hv s (fun i => w i β’ g i) (fun i hi => ?_) ?_ i
Β· dsimp only
exact (hgs i hi).symm βΈ smul_zero _
Β· rw [β hsum, Finset.sum_congr rfl _]
intros
dsimp
rw [smul_assoc, smul_comm]
#align linear_independent.group_smul LinearIndependent.group_smul
-- This lemma cannot be proved with `LinearIndependent.group_smul` since the action of
-- `RΛ£` on `R` is not commutative.
theorem LinearIndependent.units_smul {v : ΞΉ β M} (hv : LinearIndependent R v) (w : ΞΉ β RΛ£) :
LinearIndependent R (w β’ v) := by
rw [linearIndependent_iff''] at hv β’
intro s g hgs hsum i
rw [β (w i).mul_left_eq_zero]
refine hv s (fun i => g i β’ (w i : R)) (fun i hi => ?_) ?_ i
Β· dsimp only
exact (hgs i hi).symm βΈ zero_smul _ _
Β· rw [β hsum, Finset.sum_congr rfl _]
intros
erw [Pi.smul_apply, smul_assoc]
rfl
#align linear_independent.units_smul LinearIndependent.units_smul
lemma LinearIndependent.eq_of_pair {x y : M} (h : LinearIndependent R ![x, y])
{s t s' t' : R} (h' : s β’ x + t β’ y = s' β’ x + t' β’ y) : s = s' β§ t = t' := by
have : (s - s') β’ x + (t - t') β’ y = 0 := by
rw [β sub_eq_zero_of_eq h', β sub_eq_zero]
simp only [sub_smul]
abel
simpa [sub_eq_zero] using h.eq_zero_of_pair this
lemma LinearIndependent.eq_zero_of_pair' {x y : M} (h : LinearIndependent R ![x, y])
{s t : R} (h' : s β’ x = t β’ y) : s = 0 β§ t = 0 := by
suffices H : s = 0 β§ 0 = t from β¨H.1, H.2.symmβ©
exact h.eq_of_pair (by simpa using h')
lemma LinearIndependent.linear_combination_pair_of_det_ne_zero {R M : Type*} [CommRing R]
[NoZeroDivisors R] [AddCommGroup M] [Module R M]
{x y : M} (h : LinearIndependent R ![x, y])
{a b c d : R} (h' : a * d - b * c β 0) :
LinearIndependent R ![a β’ x + b β’ y, c β’ x + d β’ y] := by
apply LinearIndependent.pair_iff.2 (fun s t hst β¦ ?_)
have H : (s * a + t * c) β’ x + (s * b + t * d) β’ y = 0 := by
convert hst using 1
simp only [_root_.add_smul, smul_add, smul_smul]
abel
have I1 : s * a + t * c = 0 := (h.eq_zero_of_pair H).1
have I2 : s * b + t * d = 0 := (h.eq_zero_of_pair H).2
have J1 : (a * d - b * c) * s = 0 := by linear_combination d * I1 - c * I2
have J2 : (a * d - b * c) * t = 0 := by linear_combination -b * I1 + a * I2
exact β¨by simpa [h'] using mul_eq_zero.1 J1, by simpa [h'] using mul_eq_zero.1 J2β©
theorem surjective_of_linearIndependent_of_span [Nontrivial R] (hv : LinearIndependent R v)
(f : ΞΉ' βͺ ΞΉ) (hss : range v β span R (range (v β f))) : Surjective f := by
intro i
let repr : (span R (range (v β f)) : Type _) β ΞΉ' ββ R := (hv.comp f f.injective).repr
let l := (repr β¨v i, hss (mem_range_self i)β©).mapDomain f
have h_total_l : Finsupp.total ΞΉ M R v l = v i := by
dsimp only [l]
rw [Finsupp.total_mapDomain]
rw [(hv.comp f f.injective).total_repr]
-- Porting note: `rfl` isn't necessary.
have h_total_eq : (Finsupp.total ΞΉ M R v) l = (Finsupp.total ΞΉ M R v) (Finsupp.single i 1) := by
rw [h_total_l, Finsupp.total_single, one_smul]
have l_eq : l = _ := LinearMap.ker_eq_bot.1 hv h_total_eq
dsimp only [l] at l_eq
rw [β Finsupp.embDomain_eq_mapDomain] at l_eq
rcases Finsupp.single_of_embDomain_single (repr β¨v i, _β©) f i (1 : R) zero_ne_one.symm l_eq with
β¨i', hi'β©
use i'
exact hi'.2
#align surjective_of_linear_independent_of_span surjective_of_linearIndependent_of_span
| Mathlib/LinearAlgebra/LinearIndependent.lean | 1,075 | 1,087 | theorem eq_of_linearIndependent_of_span_subtype [Nontrivial R] {s t : Set M}
(hs : LinearIndependent R (fun x => x : s β M)) (h : t β s) (hst : s β span R t) : s = t := by |
let f : t βͺ s :=
β¨fun x => β¨x.1, h x.2β©, fun a b hab => Subtype.coe_injective (Subtype.mk.inj hab)β©
have h_surj : Surjective f := by
apply surjective_of_linearIndependent_of_span hs f _
convert hst <;> simp [f, comp]
show s = t
apply Subset.antisymm _ h
intro x hx
rcases h_surj β¨x, hxβ© with β¨y, hyβ©
convert y.mem
rw [β Subtype.mk.inj hy]
|
import Mathlib.Algebra.NeZero
import Mathlib.Data.Nat.Defs
import Mathlib.Logic.Embedding.Basic
import Mathlib.Logic.Equiv.Set
import Mathlib.Tactic.Common
#align_import data.fin.basic from "leanprover-community/mathlib"@"3a2b5524a138b5d0b818b858b516d4ac8a484b03"
assert_not_exists Monoid
universe u v
open Fin Nat Function
def finZeroElim {Ξ± : Fin 0 β Sort*} (x : Fin 0) : Ξ± x :=
x.elim0
#align fin_zero_elim finZeroElim
namespace Fin
instance {n : β} : CanLift β (Fin n) Fin.val (Β· < n) where
prf k hk := β¨β¨k, hkβ©, rflβ©
def rec0 {Ξ± : Fin 0 β Sort*} (i : Fin 0) : Ξ± i := absurd i.2 (Nat.not_lt_zero _)
#align fin.elim0' Fin.elim0
variable {n m : β}
--variable {a b : Fin n} -- this *really* breaks stuff
#align fin.fin_to_nat Fin.coeToNat
theorem val_injective : Function.Injective (@Fin.val n) :=
@Fin.eq_of_val_eq n
#align fin.val_injective Fin.val_injective
lemma size_positive : Fin n β 0 < n := Fin.pos
lemma size_positive' [Nonempty (Fin n)] : 0 < n :=
βΉNonempty (Fin n)βΊ.elim Fin.pos
protected theorem prop (a : Fin n) : a.val < n :=
a.2
#align fin.prop Fin.prop
#align fin.is_lt Fin.is_lt
#align fin.pos Fin.pos
#align fin.pos_iff_nonempty Fin.pos_iff_nonempty
lemma lt_last_iff_ne_last {a : Fin (n + 1)} : a < last n β a β last n := by
simp [Fin.lt_iff_le_and_ne, le_last]
lemma ne_zero_of_lt {a b : Fin (n + 1)} (hab : a < b) : b β 0 :=
Fin.ne_of_gt $ Fin.lt_of_le_of_lt a.zero_le hab
lemma ne_last_of_lt {a b : Fin (n + 1)} (hab : a < b) : a β last n :=
Fin.ne_of_lt $ Fin.lt_of_lt_of_le hab b.le_last
@[simps apply symm_apply]
def equivSubtype : Fin n β { i // i < n } where
toFun a := β¨a.1, a.2β©
invFun a := β¨a.1, a.2β©
left_inv := fun β¨_, _β© => rfl
right_inv := fun β¨_, _β© => rfl
#align fin.equiv_subtype Fin.equivSubtype
#align fin.equiv_subtype_symm_apply Fin.equivSubtype_symm_apply
#align fin.equiv_subtype_apply Fin.equivSubtype_apply
section Add
#align fin.val_one Fin.val_one
#align fin.coe_one Fin.val_one
@[simp]
theorem val_one' (n : β) [NeZero n] : ((1 : Fin n) : β) = 1 % n :=
rfl
#align fin.coe_one' Fin.val_one'
-- Porting note: Delete this lemma after porting
theorem val_one'' {n : β} : ((1 : Fin (n + 1)) : β) = 1 % (n + 1) :=
rfl
#align fin.one_val Fin.val_one''
#align fin.mk_one Fin.mk_one
instance nontrivial {n : β} : Nontrivial (Fin (n + 2)) where
exists_pair_ne := β¨0, 1, (ne_iff_vne 0 1).mpr (by simp [val_one, val_zero])β©
theorem nontrivial_iff_two_le : Nontrivial (Fin n) β 2 β€ n := by
rcases n with (_ | _ | n) <;>
simp [β Nat.one_eq_succ_zero, Fin.nontrivial, not_nontrivial, Nat.succ_le_iff]
-- Porting note: here and in the next lemma, had to use `β Nat.one_eq_succ_zero`.
#align fin.nontrivial_iff_two_le Fin.nontrivial_iff_two_le
#align fin.subsingleton_iff_le_one Fin.subsingleton_iff_le_one
section Monoid
-- Porting note (#10618): removing `simp`, `simp` can prove it with AddCommMonoid instance
protected theorem add_zero [NeZero n] (k : Fin n) : k + 0 = k := by
simp only [add_def, val_zero', Nat.add_zero, mod_eq_of_lt (is_lt k)]
#align fin.add_zero Fin.add_zero
-- Porting note (#10618): removing `simp`, `simp` can prove it with AddCommMonoid instance
protected theorem zero_add [NeZero n] (k : Fin n) : 0 + k = k := by
simp [ext_iff, add_def, mod_eq_of_lt (is_lt k)]
#align fin.zero_add Fin.zero_add
instance {a : β} [NeZero n] : OfNat (Fin n) a where
ofNat := Fin.ofNat' a n.pos_of_neZero
instance inhabited (n : β) [NeZero n] : Inhabited (Fin n) :=
β¨0β©
instance inhabitedFinOneAdd (n : β) : Inhabited (Fin (1 + n)) :=
haveI : NeZero (1 + n) := by rw [Nat.add_comm]; infer_instance
inferInstance
@[simp]
theorem default_eq_zero (n : β) [NeZero n] : (default : Fin n) = 0 :=
rfl
#align fin.default_eq_zero Fin.default_eq_zero
#align fin.val_add Fin.val_add
#align fin.coe_add Fin.val_add
theorem val_add_eq_ite {n : β} (a b : Fin n) :
(β(a + b) : β) = if n β€ a + b then a + b - n else a + b := by
rw [Fin.val_add, Nat.add_mod_eq_ite, Nat.mod_eq_of_lt (show βa < n from a.2),
Nat.mod_eq_of_lt (show βb < n from b.2)]
#align fin.coe_add_eq_ite Fin.val_add_eq_ite
#align fin.coe_add_one_of_lt Fin.val_add_one_of_lt
#align fin.last_add_one Fin.last_add_one
#align fin.coe_add_one Fin.val_add_one
#align fin.val_two Fin.val_two
--- Porting note: syntactically the same as the above
#align fin.coe_two Fin.val_two
section DivMod
def divNat (i : Fin (m * n)) : Fin m :=
β¨i / n, Nat.div_lt_of_lt_mul <| Nat.mul_comm m n βΈ i.propβ©
#align fin.div_nat Fin.divNat
@[simp]
theorem coe_divNat (i : Fin (m * n)) : (i.divNat : β) = i / n :=
rfl
#align fin.coe_div_nat Fin.coe_divNat
def modNat (i : Fin (m * n)) : Fin n := β¨i % n, Nat.mod_lt _ <| Nat.pos_of_mul_pos_left i.posβ©
#align fin.mod_nat Fin.modNat
@[simp]
theorem coe_modNat (i : Fin (m * n)) : (i.modNat : β) = i % n :=
rfl
#align fin.coe_mod_nat Fin.coe_modNat
| Mathlib/Data/Fin/Basic.lean | 1,774 | 1,786 | theorem modNat_rev (i : Fin (m * n)) : i.rev.modNat = i.modNat.rev := by |
ext
have Hβ : i % n + 1 β€ n := i.modNat.is_lt
have Hβ : i / n < m := i.divNat.is_lt
simp only [coe_modNat, val_rev]
calc
(m * n - (i + 1)) % n = (m * n - ((i / n) * n + i % n + 1)) % n := by rw [Nat.div_add_mod']
_ = ((m - i / n - 1) * n + (n - (i % n + 1))) % n := by
rw [Nat.mul_sub_right_distrib, Nat.one_mul, Nat.sub_add_sub_cancel _ Hβ,
Nat.mul_sub_right_distrib, Nat.sub_sub, Nat.add_assoc]
exact Nat.le_mul_of_pos_left _ <| Nat.le_sub_of_add_le' Hβ
_ = n - (i % n + 1) := by
rw [Nat.mul_comm, Nat.mul_add_mod, Nat.mod_eq_of_lt]; exact i.modNat.rev.is_lt
|
import Mathlib.Topology.Defs.Induced
import Mathlib.Topology.Basic
#align_import topology.order from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Function Set Filter Topology
universe u v w
namespace TopologicalSpace
variable {Ξ± : Type u}
inductive GenerateOpen (g : Set (Set Ξ±)) : Set Ξ± β Prop
| basic : β s β g, GenerateOpen g s
| univ : GenerateOpen g univ
| inter : β s t, GenerateOpen g s β GenerateOpen g t β GenerateOpen g (s β© t)
| sUnion : β S : Set (Set Ξ±), (β s β S, GenerateOpen g s) β GenerateOpen g (ββ S)
#align topological_space.generate_open TopologicalSpace.GenerateOpen
def generateFrom (g : Set (Set Ξ±)) : TopologicalSpace Ξ± where
IsOpen := GenerateOpen g
isOpen_univ := GenerateOpen.univ
isOpen_inter := GenerateOpen.inter
isOpen_sUnion := GenerateOpen.sUnion
#align topological_space.generate_from TopologicalSpace.generateFrom
theorem isOpen_generateFrom_of_mem {g : Set (Set Ξ±)} {s : Set Ξ±} (hs : s β g) :
IsOpen[generateFrom g] s :=
GenerateOpen.basic s hs
#align topological_space.is_open_generate_from_of_mem TopologicalSpace.isOpen_generateFrom_of_mem
theorem nhds_generateFrom {g : Set (Set Ξ±)} {a : Ξ±} :
@nhds Ξ± (generateFrom g) a = β¨
s β { s | a β s β§ s β g }, π s := by
letI := generateFrom g
rw [nhds_def]
refine le_antisymm (biInf_mono fun s β¨as, sgβ© => β¨as, .basic _ sgβ©) <| le_iInfβ ?_
rintro s β¨ha, hsβ©
induction hs with
| basic _ hs => exact iInfβ_le _ β¨ha, hsβ©
| univ => exact le_top.trans_eq principal_univ.symm
| inter _ _ _ _ hs ht => exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal
| sUnion _ _ hS =>
let β¨t, htS, hatβ© := ha
exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS)
#align topological_space.nhds_generate_from TopologicalSpace.nhds_generateFrom
lemma tendsto_nhds_generateFrom_iff {Ξ² : Type*} {m : Ξ± β Ξ²} {f : Filter Ξ±} {g : Set (Set Ξ²)}
{b : Ξ²} : Tendsto m f (@nhds Ξ² (generateFrom g) b) β β s β g, b β s β m β»ΒΉ' s β f := by
simp only [nhds_generateFrom, @forall_swap (b β _), tendsto_iInf, mem_setOf_eq, and_imp,
tendsto_principal]; rfl
@[deprecated] alias β¨_, tendsto_nhds_generateFromβ© := tendsto_nhds_generateFrom_iff
#align topological_space.tendsto_nhds_generate_from TopologicalSpace.tendsto_nhds_generateFrom
protected def mkOfNhds (n : Ξ± β Filter Ξ±) : TopologicalSpace Ξ± where
IsOpen s := β a β s, s β n a
isOpen_univ _ _ := univ_mem
isOpen_inter := fun _s _t hs ht x β¨hxs, hxtβ© => inter_mem (hs x hxs) (ht x hxt)
isOpen_sUnion := fun _s hs _a β¨x, hx, hxaβ© =>
mem_of_superset (hs x hx _ hxa) (subset_sUnion_of_mem hx)
#align topological_space.mk_of_nhds TopologicalSpace.mkOfNhds
theorem nhds_mkOfNhds_of_hasBasis {n : Ξ± β Filter Ξ±} {ΞΉ : Ξ± β Sort*} {p : β a, ΞΉ a β Prop}
{s : β a, ΞΉ a β Set Ξ±} (hb : β a, (n a).HasBasis (p a) (s a))
(hpure : β a i, p a i β a β s a i) (hopen : β a i, p a i β βαΆ x in n a, s a i β n x) (a : Ξ±) :
@nhds Ξ± (.mkOfNhds n) a = n a := by
let t : TopologicalSpace Ξ± := .mkOfNhds n
apply le_antisymm
Β· intro U hU
replace hpure : pure β€ n := fun x β¦ (hb x).ge_iff.2 (hpure x)
refine mem_nhds_iff.2 β¨{x | U β n x}, fun x hx β¦ hpure x hx, fun x hx β¦ ?_, hUβ©
rcases (hb x).mem_iff.1 hx with β¨i, hpi, hiβ©
exact (hopen x i hpi).mono fun y hy β¦ mem_of_superset hy hi
Β· exact (nhds_basis_opens a).ge_iff.2 fun U β¨haU, hUoβ© β¦ hUo a haU
theorem nhds_mkOfNhds (n : Ξ± β Filter Ξ±) (a : Ξ±) (hβ : pure β€ n)
(hβ : β a, β s β n a, βαΆ y in n a, s β n y) :
@nhds Ξ± (TopologicalSpace.mkOfNhds n) a = n a :=
nhds_mkOfNhds_of_hasBasis (fun a β¦ (n a).basis_sets) hβ hβ _
#align topological_space.nhds_mk_of_nhds TopologicalSpace.nhds_mkOfNhds
theorem nhds_mkOfNhds_single [DecidableEq Ξ±] {aβ : Ξ±} {l : Filter Ξ±} (h : pure aβ β€ l) (b : Ξ±) :
@nhds Ξ± (TopologicalSpace.mkOfNhds (update pure aβ l)) b =
(update pure aβ l : Ξ± β Filter Ξ±) b := by
refine nhds_mkOfNhds _ _ (le_update_iff.mpr β¨h, fun _ _ => le_rflβ©) fun a s hs => ?_
rcases eq_or_ne a aβ with (rfl | ha)
Β· filter_upwards [hs] with b hb
rcases eq_or_ne b a with (rfl | hb)
Β· exact hs
Β· rwa [update_noteq hb]
Β· simpa only [update_noteq ha, mem_pure, eventually_pure] using hs
#align topological_space.nhds_mk_of_nhds_single TopologicalSpace.nhds_mkOfNhds_single
theorem nhds_mkOfNhds_filterBasis (B : Ξ± β FilterBasis Ξ±) (a : Ξ±) (hβ : β x, β n β B x, x β n)
(hβ : β x, β n β B x, β nβ β B x, β x' β nβ, β nβ β B x', nβ β n) :
@nhds Ξ± (TopologicalSpace.mkOfNhds fun x => (B x).filter) a = (B a).filter :=
nhds_mkOfNhds_of_hasBasis (fun a β¦ (B a).hasBasis) hβ hβ a
#align topological_space.nhds_mk_of_nhds_filter_basis TopologicalSpace.nhds_mkOfNhds_filterBasis
section Lattice
variable {Ξ± : Type*} {t tβ tβ : TopologicalSpace Ξ±} {s : Set Ξ±}
theorem IsOpen.mono (hs : IsOpen[tβ] s) (h : tβ β€ tβ) : IsOpen[tβ] s := h s hs
#align is_open.mono IsOpen.mono
theorem IsClosed.mono (hs : IsClosed[tβ] s) (h : tβ β€ tβ) : IsClosed[tβ] s :=
(@isOpen_compl_iff Ξ± s tβ).mp <| hs.isOpen_compl.mono h
#align is_closed.mono IsClosed.mono
theorem closure.mono (h : tβ β€ tβ) : closure[tβ] s β closure[tβ] s :=
@closure_minimal _ s (@closure _ tβ s) tβ subset_closure (IsClosed.mono isClosed_closure h)
theorem isOpen_implies_isOpen_iff : (β s, IsOpen[tβ] s β IsOpen[tβ] s) β tβ β€ tβ :=
Iff.rfl
#align is_open_implies_is_open_iff isOpen_implies_isOpen_iff
theorem TopologicalSpace.isOpen_top_iff {Ξ±} (U : Set Ξ±) : IsOpen[β€] U β U = β
β¨ U = univ :=
β¨fun h => by
induction h with
| basic _ h => exact False.elim h
| univ => exact .inr rfl
| inter _ _ _ _ hβ hβ =>
rcases hβ with (rfl | rfl) <;> rcases hβ with (rfl | rfl) <;> simp
| sUnion _ _ ih => exact sUnion_mem_empty_univ ih, by
rintro (rfl | rfl)
exacts [@isOpen_empty _ β€, @isOpen_univ _ β€]β©
#align topological_space.is_open_top_iff TopologicalSpace.isOpen_top_iff
class DiscreteTopology (Ξ± : Type*) [t : TopologicalSpace Ξ±] : Prop where
eq_bot : t = β₯
#align discrete_topology DiscreteTopology
theorem discreteTopology_bot (Ξ± : Type*) : @DiscreteTopology Ξ± β₯ :=
@DiscreteTopology.mk Ξ± β₯ rfl
#align discrete_topology_bot discreteTopology_bot
-- constructions using the complete lattice structure
section iInf
open TopologicalSpace
variable {Ξ± : Type u} {ΞΉ : Sort v}
theorem generateFrom_union (aβ aβ : Set (Set Ξ±)) :
generateFrom (aβ βͺ aβ) = generateFrom aβ β generateFrom aβ :=
(gc_generateFrom Ξ±).u_inf
#align generate_from_union generateFrom_union
theorem setOf_isOpen_sup (tβ tβ : TopologicalSpace Ξ±) :
{ s | IsOpen[tβ β tβ] s } = { s | IsOpen[tβ] s } β© { s | IsOpen[tβ] s } :=
rfl
#align set_of_is_open_sup setOf_isOpen_sup
theorem generateFrom_iUnion {f : ΞΉ β Set (Set Ξ±)} :
generateFrom (β i, f i) = β¨
i, generateFrom (f i) :=
(gc_generateFrom Ξ±).u_iInf
#align generate_from_Union generateFrom_iUnion
theorem setOf_isOpen_iSup {t : ΞΉ β TopologicalSpace Ξ±} :
{ s | IsOpen[β¨ i, t i] s } = β i, { s | IsOpen[t i] s } :=
(gc_generateFrom Ξ±).l_iSup
#align set_of_is_open_supr setOf_isOpen_iSup
theorem generateFrom_sUnion {S : Set (Set (Set Ξ±))} :
generateFrom (ββ S) = β¨
s β S, generateFrom s :=
(gc_generateFrom Ξ±).u_sInf
#align generate_from_sUnion generateFrom_sUnion
theorem setOf_isOpen_sSup {T : Set (TopologicalSpace Ξ±)} :
{ s | IsOpen[sSup T] s } = β t β T, { s | IsOpen[t] s } :=
(gc_generateFrom Ξ±).l_sSup
#align set_of_is_open_Sup setOf_isOpen_sSup
theorem generateFrom_union_isOpen (a b : TopologicalSpace Ξ±) :
generateFrom ({ s | IsOpen[a] s } βͺ { s | IsOpen[b] s }) = a β b :=
(gciGenerateFrom Ξ±).u_inf_l _ _
#align generate_from_union_is_open generateFrom_union_isOpen
theorem generateFrom_iUnion_isOpen (f : ΞΉ β TopologicalSpace Ξ±) :
generateFrom (β i, { s | IsOpen[f i] s }) = β¨
i, f i :=
(gciGenerateFrom Ξ±).u_iInf_l _
#align generate_from_Union_is_open generateFrom_iUnion_isOpen
theorem generateFrom_inter (a b : TopologicalSpace Ξ±) :
generateFrom ({ s | IsOpen[a] s } β© { s | IsOpen[b] s }) = a β b :=
(gciGenerateFrom Ξ±).u_sup_l _ _
#align generate_from_inter generateFrom_inter
theorem generateFrom_iInter (f : ΞΉ β TopologicalSpace Ξ±) :
generateFrom (β i, { s | IsOpen[f i] s }) = β¨ i, f i :=
(gciGenerateFrom Ξ±).u_iSup_l _
#align generate_from_Inter generateFrom_iInter
theorem generateFrom_iInter_of_generateFrom_eq_self (f : ΞΉ β Set (Set Ξ±))
(hf : β i, { s | IsOpen[generateFrom (f i)] s } = f i) :
generateFrom (β i, f i) = β¨ i, generateFrom (f i) :=
(gciGenerateFrom Ξ±).u_iSup_of_lu_eq_self f hf
#align generate_from_Inter_of_generate_from_eq_self generateFrom_iInter_of_generateFrom_eq_self
variable {t : ΞΉ β TopologicalSpace Ξ±}
theorem isOpen_iSup_iff {s : Set Ξ±} : IsOpen[β¨ i, t i] s β β i, IsOpen[t i] s :=
show s β {s | IsOpen[iSup t] s} β s β { x : Set Ξ± | β i : ΞΉ, IsOpen[t i] x } by
simp [setOf_isOpen_iSup]
#align is_open_supr_iff isOpen_iSup_iff
set_option tactic.skipAssignedInstances false in
| Mathlib/Topology/Order.lean | 987 | 988 | theorem isClosed_iSup_iff {s : Set Ξ±} : IsClosed[β¨ i, t i] s β β i, IsClosed[t i] s := by |
simp [β @isOpen_compl_iff _ _ (β¨ i, t i), β @isOpen_compl_iff _ _ (t _), isOpen_iSup_iff]
|
import Mathlib.Data.Set.Function
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Core
import Mathlib.Tactic.Attr.Core
#align_import logic.equiv.local_equiv from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
open Lean Meta Elab Tactic
def mfld_cfg : Simps.Config where
attrs := [`mfld_simps]
fullyApplied := false
#align mfld_cfg mfld_cfg
open Function Set
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
structure PartialEquiv (Ξ± : Type*) (Ξ² : Type*) where
toFun : Ξ± β Ξ²
invFun : Ξ² β Ξ±
source : Set Ξ±
target : Set Ξ²
map_source' : β β¦xβ¦, x β source β toFun x β target
map_target' : β β¦xβ¦, x β target β invFun x β source
left_inv' : β β¦xβ¦, x β source β invFun (toFun x) = x
right_inv' : β β¦xβ¦, x β target β toFun (invFun x) = x
#align local_equiv PartialEquiv
attribute [coe] PartialEquiv.toFun
namespace PartialEquiv
variable (e : PartialEquiv Ξ± Ξ²) (e' : PartialEquiv Ξ² Ξ³)
instance [Inhabited Ξ±] [Inhabited Ξ²] : Inhabited (PartialEquiv Ξ± Ξ²) :=
β¨β¨const Ξ± default, const Ξ² default, β
, β
, mapsTo_empty _ _, mapsTo_empty _ _, eqOn_empty _ _,
eqOn_empty _ _β©β©
@[symm]
protected def symm : PartialEquiv Ξ² Ξ± where
toFun := e.invFun
invFun := e.toFun
source := e.target
target := e.source
map_source' := e.map_target'
map_target' := e.map_source'
left_inv' := e.right_inv'
right_inv' := e.left_inv'
#align local_equiv.symm PartialEquiv.symm
instance : CoeFun (PartialEquiv Ξ± Ξ²) fun _ => Ξ± β Ξ² :=
β¨PartialEquiv.toFunβ©
def Simps.symm_apply (e : PartialEquiv Ξ± Ξ²) : Ξ² β Ξ± :=
e.symm
#align local_equiv.simps.symm_apply PartialEquiv.Simps.symm_apply
initialize_simps_projections PartialEquiv (toFun β apply, invFun β symm_apply)
-- Porting note: this can be proven with `dsimp only`
-- @[simp, mfld_simps]
-- theorem coe_mk (f : Ξ± β Ξ²) (g s t ml mr il ir) :
-- (PartialEquiv.mk f g s t ml mr il ir : Ξ± β Ξ²) = f := by dsimp only
-- #align local_equiv.coe_mk PartialEquiv.coe_mk
#noalign local_equiv.coe_mk
@[simp, mfld_simps]
theorem coe_symm_mk (f : Ξ± β Ξ²) (g s t ml mr il ir) :
((PartialEquiv.mk f g s t ml mr il ir).symm : Ξ² β Ξ±) = g :=
rfl
#align local_equiv.coe_symm_mk PartialEquiv.coe_symm_mk
-- Porting note: this is now a syntactic tautology
-- @[simp, mfld_simps]
-- theorem toFun_as_coe : e.toFun = e := rfl
-- #align local_equiv.to_fun_as_coe PartialEquiv.toFun_as_coe
#noalign local_equiv.to_fun_as_coe
@[simp, mfld_simps]
theorem invFun_as_coe : e.invFun = e.symm :=
rfl
#align local_equiv.inv_fun_as_coe PartialEquiv.invFun_as_coe
@[simp, mfld_simps]
theorem map_source {x : Ξ±} (h : x β e.source) : e x β e.target :=
e.map_source' h
#align local_equiv.map_source PartialEquiv.map_source
lemma map_source'' : e '' e.source β e.target :=
fun _ β¨_, hx, hexβ© β¦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)
@[simp, mfld_simps]
theorem map_target {x : Ξ²} (h : x β e.target) : e.symm x β e.source :=
e.map_target' h
#align local_equiv.map_target PartialEquiv.map_target
@[simp, mfld_simps]
theorem left_inv {x : Ξ±} (h : x β e.source) : e.symm (e x) = x :=
e.left_inv' h
#align local_equiv.left_inv PartialEquiv.left_inv
@[simp, mfld_simps]
theorem right_inv {x : Ξ²} (h : x β e.target) : e (e.symm x) = x :=
e.right_inv' h
#align local_equiv.right_inv PartialEquiv.right_inv
theorem eq_symm_apply {x : Ξ±} {y : Ξ²} (hx : x β e.source) (hy : y β e.target) :
x = e.symm y β e x = y :=
β¨fun h => by rw [β e.right_inv hy, h], fun h => by rw [β e.left_inv hx, h]β©
#align local_equiv.eq_symm_apply PartialEquiv.eq_symm_apply
protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source
#align local_equiv.maps_to PartialEquiv.mapsTo
theorem symm_mapsTo : MapsTo e.symm e.target e.source :=
e.symm.mapsTo
#align local_equiv.symm_maps_to PartialEquiv.symm_mapsTo
protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv
#align local_equiv.left_inv_on PartialEquiv.leftInvOn
protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv
#align local_equiv.right_inv_on PartialEquiv.rightInvOn
protected theorem invOn : InvOn e.symm e e.source e.target :=
β¨e.leftInvOn, e.rightInvOnβ©
#align local_equiv.inv_on PartialEquiv.invOn
protected theorem injOn : InjOn e e.source :=
e.leftInvOn.injOn
#align local_equiv.inj_on PartialEquiv.injOn
protected theorem bijOn : BijOn e e.source e.target :=
e.invOn.bijOn e.mapsTo e.symm_mapsTo
#align local_equiv.bij_on PartialEquiv.bijOn
protected theorem surjOn : SurjOn e e.source e.target :=
e.bijOn.surjOn
#align local_equiv.surj_on PartialEquiv.surjOn
@[simps (config := .asFn)]
def _root_.Equiv.toPartialEquivOfImageEq (e : Ξ± β Ξ²) (s : Set Ξ±) (t : Set Ξ²) (h : e '' s = t) :
PartialEquiv Ξ± Ξ² where
toFun := e
invFun := e.symm
source := s
target := t
map_source' x hx := h βΈ mem_image_of_mem _ hx
map_target' x hx := by
subst t
rcases hx with β¨x, hx, rflβ©
rwa [e.symm_apply_apply]
left_inv' x _ := e.symm_apply_apply x
right_inv' x _ := e.apply_symm_apply x
@[simps! (config := mfld_cfg)]
def _root_.Equiv.toPartialEquiv (e : Ξ± β Ξ²) : PartialEquiv Ξ± Ξ² :=
e.toPartialEquivOfImageEq univ univ <| by rw [image_univ, e.surjective.range_eq]
#align equiv.to_local_equiv Equiv.toPartialEquiv
#align equiv.to_local_equiv_symm_apply Equiv.toPartialEquiv_symm_apply
#align equiv.to_local_equiv_target Equiv.toPartialEquiv_target
#align equiv.to_local_equiv_apply Equiv.toPartialEquiv_apply
#align equiv.to_local_equiv_source Equiv.toPartialEquiv_source
instance inhabitedOfEmpty [IsEmpty Ξ±] [IsEmpty Ξ²] : Inhabited (PartialEquiv Ξ± Ξ²) :=
β¨((Equiv.equivEmpty Ξ±).trans (Equiv.equivEmpty Ξ²).symm).toPartialEquivβ©
#align local_equiv.inhabited_of_empty PartialEquiv.inhabitedOfEmpty
@[simps (config := .asFn)]
def copy (e : PartialEquiv Ξ± Ξ²) (f : Ξ± β Ξ²) (hf : βe = f) (g : Ξ² β Ξ±) (hg : βe.symm = g) (s : Set Ξ±)
(hs : e.source = s) (t : Set Ξ²) (ht : e.target = t) :
PartialEquiv Ξ± Ξ² where
toFun := f
invFun := g
source := s
target := t
map_source' _ := ht βΈ hs βΈ hf βΈ e.map_source
map_target' _ := hs βΈ ht βΈ hg βΈ e.map_target
left_inv' _ := hs βΈ hf βΈ hg βΈ e.left_inv
right_inv' _ := ht βΈ hf βΈ hg βΈ e.right_inv
#align local_equiv.copy PartialEquiv.copy
#align local_equiv.copy_source PartialEquiv.copy_source
#align local_equiv.copy_apply PartialEquiv.copy_apply
#align local_equiv.copy_symm_apply PartialEquiv.copy_symm_apply
#align local_equiv.copy_target PartialEquiv.copy_target
theorem copy_eq (e : PartialEquiv Ξ± Ξ²) (f : Ξ± β Ξ²) (hf : βe = f) (g : Ξ² β Ξ±) (hg : βe.symm = g)
(s : Set Ξ±) (hs : e.source = s) (t : Set Ξ²) (ht : e.target = t) :
e.copy f hf g hg s hs t ht = e := by
substs f g s t
cases e
rfl
#align local_equiv.copy_eq PartialEquiv.copy_eq
protected def toEquiv : e.source β e.target where
toFun x := β¨e x, e.map_source x.memβ©
invFun y := β¨e.symm y, e.map_target y.memβ©
left_inv := fun β¨_, hxβ© => Subtype.eq <| e.left_inv hx
right_inv := fun β¨_, hyβ© => Subtype.eq <| e.right_inv hy
#align local_equiv.to_equiv PartialEquiv.toEquiv
@[simp, mfld_simps]
theorem symm_source : e.symm.source = e.target :=
rfl
#align local_equiv.symm_source PartialEquiv.symm_source
@[simp, mfld_simps]
theorem symm_target : e.symm.target = e.source :=
rfl
#align local_equiv.symm_target PartialEquiv.symm_target
@[simp, mfld_simps]
theorem symm_symm : e.symm.symm = e := by
cases e
rfl
#align local_equiv.symm_symm PartialEquiv.symm_symm
theorem symm_bijective :
Function.Bijective (PartialEquiv.symm : PartialEquiv Ξ± Ξ² β PartialEquiv Ξ² Ξ±) :=
Function.bijective_iff_has_inverse.mpr β¨_, symm_symm, symm_symmβ©
theorem image_source_eq_target : e '' e.source = e.target :=
e.bijOn.image_eq
#align local_equiv.image_source_eq_target PartialEquiv.image_source_eq_target
theorem forall_mem_target {p : Ξ² β Prop} : (β y β e.target, p y) β β x β e.source, p (e x) := by
rw [β image_source_eq_target, forall_mem_image]
#align local_equiv.forall_mem_target PartialEquiv.forall_mem_target
theorem exists_mem_target {p : Ξ² β Prop} : (β y β e.target, p y) β β x β e.source, p (e x) := by
rw [β image_source_eq_target, exists_mem_image]
#align local_equiv.exists_mem_target PartialEquiv.exists_mem_target
def IsImage (s : Set Ξ±) (t : Set Ξ²) : Prop :=
β β¦xβ¦, x β e.source β (e x β t β x β s)
#align local_equiv.is_image PartialEquiv.IsImage
theorem isImage_source_target : e.IsImage e.source e.target := fun x hx => by simp [hx]
#align local_equiv.is_image_source_target PartialEquiv.isImage_source_target
theorem isImage_source_target_of_disjoint (e' : PartialEquiv Ξ± Ξ²) (hs : Disjoint e.source e'.source)
(ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target :=
IsImage.of_image_eq <| by rw [hs.inter_eq, ht.inter_eq, image_empty]
#align local_equiv.is_image_source_target_of_disjoint PartialEquiv.isImage_source_target_of_disjoint
theorem image_source_inter_eq' (s : Set Ξ±) : e '' (e.source β© s) = e.target β© e.symm β»ΒΉ' s := by
rw [inter_comm, e.leftInvOn.image_inter', image_source_eq_target, inter_comm]
#align local_equiv.image_source_inter_eq' PartialEquiv.image_source_inter_eq'
theorem image_source_inter_eq (s : Set Ξ±) :
e '' (e.source β© s) = e.target β© e.symm β»ΒΉ' (e.source β© s) := by
rw [inter_comm, e.leftInvOn.image_inter, image_source_eq_target, inter_comm]
#align local_equiv.image_source_inter_eq PartialEquiv.image_source_inter_eq
theorem image_eq_target_inter_inv_preimage {s : Set Ξ±} (h : s β e.source) :
e '' s = e.target β© e.symm β»ΒΉ' s := by
rw [β e.image_source_inter_eq', inter_eq_self_of_subset_right h]
#align local_equiv.image_eq_target_inter_inv_preimage PartialEquiv.image_eq_target_inter_inv_preimage
theorem symm_image_eq_source_inter_preimage {s : Set Ξ²} (h : s β e.target) :
e.symm '' s = e.source β© e β»ΒΉ' s :=
e.symm.image_eq_target_inter_inv_preimage h
#align local_equiv.symm_image_eq_source_inter_preimage PartialEquiv.symm_image_eq_source_inter_preimage
theorem symm_image_target_inter_eq (s : Set Ξ²) :
e.symm '' (e.target β© s) = e.source β© e β»ΒΉ' (e.target β© s) :=
e.symm.image_source_inter_eq _
#align local_equiv.symm_image_target_inter_eq PartialEquiv.symm_image_target_inter_eq
theorem symm_image_target_inter_eq' (s : Set Ξ²) : e.symm '' (e.target β© s) = e.source β© e β»ΒΉ' s :=
e.symm.image_source_inter_eq' _
#align local_equiv.symm_image_target_inter_eq' PartialEquiv.symm_image_target_inter_eq'
theorem source_inter_preimage_inv_preimage (s : Set Ξ±) :
e.source β© e β»ΒΉ' (e.symm β»ΒΉ' s) = e.source β© s :=
Set.ext fun x => and_congr_right_iff.2 fun hx =>
by simp only [mem_preimage, e.left_inv hx]
#align local_equiv.source_inter_preimage_inv_preimage PartialEquiv.source_inter_preimage_inv_preimage
theorem source_inter_preimage_target_inter (s : Set Ξ²) :
e.source β© e β»ΒΉ' (e.target β© s) = e.source β© e β»ΒΉ' s :=
ext fun _ => β¨fun hx => β¨hx.1, hx.2.2β©, fun hx => β¨hx.1, e.map_source hx.1, hx.2β©β©
#align local_equiv.source_inter_preimage_target_inter PartialEquiv.source_inter_preimage_target_inter
theorem target_inter_inv_preimage_preimage (s : Set Ξ²) :
e.target β© e.symm β»ΒΉ' (e β»ΒΉ' s) = e.target β© s :=
e.symm.source_inter_preimage_inv_preimage _
#align local_equiv.target_inter_inv_preimage_preimage PartialEquiv.target_inter_inv_preimage_preimage
theorem symm_image_image_of_subset_source {s : Set Ξ±} (h : s β e.source) : e.symm '' (e '' s) = s :=
(e.leftInvOn.mono h).image_image
#align local_equiv.symm_image_image_of_subset_source PartialEquiv.symm_image_image_of_subset_source
theorem image_symm_image_of_subset_target {s : Set Ξ²} (h : s β e.target) : e '' (e.symm '' s) = s :=
e.symm.symm_image_image_of_subset_source h
#align local_equiv.image_symm_image_of_subset_target PartialEquiv.image_symm_image_of_subset_target
theorem source_subset_preimage_target : e.source β e β»ΒΉ' e.target :=
e.mapsTo
#align local_equiv.source_subset_preimage_target PartialEquiv.source_subset_preimage_target
theorem symm_image_target_eq_source : e.symm '' e.target = e.source :=
e.symm.image_source_eq_target
#align local_equiv.symm_image_target_eq_source PartialEquiv.symm_image_target_eq_source
theorem target_subset_preimage_source : e.target β e.symm β»ΒΉ' e.source :=
e.symm_mapsTo
#align local_equiv.target_subset_preimage_source PartialEquiv.target_subset_preimage_source
@[ext]
protected theorem ext {e e' : PartialEquiv Ξ± Ξ²} (h : β x, e x = e' x)
(hsymm : β x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := by
have A : (e : Ξ± β Ξ²) = e' := by
ext x
exact h x
have B : (e.symm : Ξ² β Ξ±) = e'.symm := by
ext x
exact hsymm x
have I : e '' e.source = e.target := e.image_source_eq_target
have I' : e' '' e'.source = e'.target := e'.image_source_eq_target
rw [A, hs, I'] at I
cases e; cases e'
simp_all
#align local_equiv.ext PartialEquiv.ext
protected def restr (s : Set Ξ±) : PartialEquiv Ξ± Ξ² :=
(@IsImage.of_symm_preimage_eq Ξ± Ξ² e s (e.symm β»ΒΉ' s) rfl).restr
#align local_equiv.restr PartialEquiv.restr
@[simp, mfld_simps]
theorem restr_coe (s : Set Ξ±) : (e.restr s : Ξ± β Ξ²) = e :=
rfl
#align local_equiv.restr_coe PartialEquiv.restr_coe
@[simp, mfld_simps]
theorem restr_coe_symm (s : Set Ξ±) : ((e.restr s).symm : Ξ² β Ξ±) = e.symm :=
rfl
#align local_equiv.restr_coe_symm PartialEquiv.restr_coe_symm
@[simp, mfld_simps]
theorem restr_source (s : Set Ξ±) : (e.restr s).source = e.source β© s :=
rfl
#align local_equiv.restr_source PartialEquiv.restr_source
@[simp, mfld_simps]
theorem restr_target (s : Set Ξ±) : (e.restr s).target = e.target β© e.symm β»ΒΉ' s :=
rfl
#align local_equiv.restr_target PartialEquiv.restr_target
theorem restr_eq_of_source_subset {e : PartialEquiv Ξ± Ξ²} {s : Set Ξ±} (h : e.source β s) :
e.restr s = e :=
PartialEquiv.ext (fun _ => rfl) (fun _ => rfl) (by simp [inter_eq_self_of_subset_left h])
#align local_equiv.restr_eq_of_source_subset PartialEquiv.restr_eq_of_source_subset
@[simp, mfld_simps]
theorem restr_univ {e : PartialEquiv Ξ± Ξ²} : e.restr univ = e :=
restr_eq_of_source_subset (subset_univ _)
#align local_equiv.restr_univ PartialEquiv.restr_univ
protected def refl (Ξ± : Type*) : PartialEquiv Ξ± Ξ± :=
(Equiv.refl Ξ±).toPartialEquiv
#align local_equiv.refl PartialEquiv.refl
@[simp, mfld_simps]
theorem refl_source : (PartialEquiv.refl Ξ±).source = univ :=
rfl
#align local_equiv.refl_source PartialEquiv.refl_source
@[simp, mfld_simps]
theorem refl_target : (PartialEquiv.refl Ξ±).target = univ :=
rfl
#align local_equiv.refl_target PartialEquiv.refl_target
@[simp, mfld_simps]
theorem refl_coe : (PartialEquiv.refl Ξ± : Ξ± β Ξ±) = id :=
rfl
#align local_equiv.refl_coe PartialEquiv.refl_coe
@[simp, mfld_simps]
theorem refl_symm : (PartialEquiv.refl Ξ±).symm = PartialEquiv.refl Ξ± :=
rfl
#align local_equiv.refl_symm PartialEquiv.refl_symm
-- Porting note: removed `simp` because `simp` can prove this
@[mfld_simps]
theorem refl_restr_source (s : Set Ξ±) : ((PartialEquiv.refl Ξ±).restr s).source = s := by simp
#align local_equiv.refl_restr_source PartialEquiv.refl_restr_source
-- Porting note: removed `simp` because `simp` can prove this
@[mfld_simps]
theorem refl_restr_target (s : Set Ξ±) : ((PartialEquiv.refl Ξ±).restr s).target = s := by
change univ β© id β»ΒΉ' s = s
simp
#align local_equiv.refl_restr_target PartialEquiv.refl_restr_target
def ofSet (s : Set Ξ±) : PartialEquiv Ξ± Ξ± where
toFun := id
invFun := id
source := s
target := s
map_source' _ hx := hx
map_target' _ hx := hx
left_inv' _ _ := rfl
right_inv' _ _ := rfl
#align local_equiv.of_set PartialEquiv.ofSet
@[simp, mfld_simps]
theorem ofSet_source (s : Set Ξ±) : (PartialEquiv.ofSet s).source = s :=
rfl
#align local_equiv.of_set_source PartialEquiv.ofSet_source
@[simp, mfld_simps]
theorem ofSet_target (s : Set Ξ±) : (PartialEquiv.ofSet s).target = s :=
rfl
#align local_equiv.of_set_target PartialEquiv.ofSet_target
@[simp, mfld_simps]
theorem ofSet_coe (s : Set Ξ±) : (PartialEquiv.ofSet s : Ξ± β Ξ±) = id :=
rfl
#align local_equiv.of_set_coe PartialEquiv.ofSet_coe
@[simp, mfld_simps]
theorem ofSet_symm (s : Set Ξ±) : (PartialEquiv.ofSet s).symm = PartialEquiv.ofSet s :=
rfl
#align local_equiv.of_set_symm PartialEquiv.ofSet_symm
@[simps]
protected def trans' (e' : PartialEquiv Ξ² Ξ³) (h : e.target = e'.source) : PartialEquiv Ξ± Ξ³ where
toFun := e' β e
invFun := e.symm β e'.symm
source := e.source
target := e'.target
map_source' x hx := by simp [β h, hx]
map_target' y hy := by simp [h, hy]
left_inv' x hx := by simp [hx, β h]
right_inv' y hy := by simp [hy, h]
#align local_equiv.trans' PartialEquiv.trans'
@[trans]
protected def trans : PartialEquiv Ξ± Ξ³ :=
PartialEquiv.trans' (e.symm.restr e'.source).symm (e'.restr e.target) (inter_comm _ _)
#align local_equiv.trans PartialEquiv.trans
@[simp, mfld_simps]
theorem coe_trans : (e.trans e' : Ξ± β Ξ³) = e' β e :=
rfl
#align local_equiv.coe_trans PartialEquiv.coe_trans
@[simp, mfld_simps]
theorem coe_trans_symm : ((e.trans e').symm : Ξ³ β Ξ±) = e.symm β e'.symm :=
rfl
#align local_equiv.coe_trans_symm PartialEquiv.coe_trans_symm
theorem trans_apply {x : Ξ±} : (e.trans e') x = e' (e x) :=
rfl
#align local_equiv.trans_apply PartialEquiv.trans_apply
theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := by
cases e; cases e'; rfl
#align local_equiv.trans_symm_eq_symm_trans_symm PartialEquiv.trans_symm_eq_symm_trans_symm
@[simp, mfld_simps]
theorem trans_source : (e.trans e').source = e.source β© e β»ΒΉ' e'.source :=
rfl
#align local_equiv.trans_source PartialEquiv.trans_source
| Mathlib/Logic/Equiv/PartialEquiv.lean | 720 | 721 | theorem trans_source' : (e.trans e').source = e.source β© e β»ΒΉ' (e.target β© e'.source) := by |
mfld_set_tac
|
import Mathlib.Algebra.Group.Indicator
import Mathlib.Data.Finset.Piecewise
import Mathlib.Data.Finset.Preimage
#align_import algebra.big_operators.basic from "leanprover-community/mathlib"@"65a1391a0106c9204fe45bc73a039f056558cb83"
-- TODO
-- assert_not_exists AddCommMonoidWithOne
assert_not_exists MonoidWithZero
assert_not_exists MulAction
variable {ΞΉ ΞΊ Ξ± Ξ² Ξ³ : Type*}
open Fin Function
library_note "operator precedence of big operators"
@[to_additive (attr := simp)]
theorem map_prod [CommMonoid Ξ²] [CommMonoid Ξ³] {G : Type*} [FunLike G Ξ² Ξ³] [MonoidHomClass G Ξ² Ξ³]
(g : G) (f : Ξ± β Ξ²) (s : Finset Ξ±) : g (β x β s, f x) = β x β s, g (f x) := by
simp only [Finset.prod_eq_multiset_prod, map_multiset_prod, Multiset.map_map]; rfl
#align map_prod map_prod
#align map_sum map_sum
@[to_additive]
theorem MonoidHom.coe_finset_prod [MulOneClass Ξ²] [CommMonoid Ξ³] (f : Ξ± β Ξ² β* Ξ³) (s : Finset Ξ±) :
β(β x β s, f x) = β x β s, β(f x) :=
map_prod (MonoidHom.coeFn Ξ² Ξ³) _ _
#align monoid_hom.coe_finset_prod MonoidHom.coe_finset_prod
#align add_monoid_hom.coe_finset_sum AddMonoidHom.coe_finset_sum
@[to_additive (attr := simp)
"See also `Finset.sum_apply`, with the same conclusion but with the weaker hypothesis
`f : Ξ± β Ξ² β Ξ³`"]
theorem MonoidHom.finset_prod_apply [MulOneClass Ξ²] [CommMonoid Ξ³] (f : Ξ± β Ξ² β* Ξ³) (s : Finset Ξ±)
(b : Ξ²) : (β x β s, f x) b = β x β s, f x b :=
map_prod (MonoidHom.eval b) _ _
#align monoid_hom.finset_prod_apply MonoidHom.finset_prod_apply
#align add_monoid_hom.finset_sum_apply AddMonoidHom.finset_sum_apply
variable {s sβ sβ : Finset Ξ±} {a : Ξ±} {f g : Ξ± β Ξ²}
namespace Finset
section CommMonoid
variable [CommMonoid Ξ²]
@[to_additive (attr := simp)]
theorem prod_empty : β x β β
, f x = 1 :=
rfl
#align finset.prod_empty Finset.prod_empty
#align finset.sum_empty Finset.sum_empty
@[to_additive]
theorem prod_of_empty [IsEmpty Ξ±] (s : Finset Ξ±) : β i β s, f i = 1 := by
rw [eq_empty_of_isEmpty s, prod_empty]
#align finset.prod_of_empty Finset.prod_of_empty
#align finset.sum_of_empty Finset.sum_of_empty
@[to_additive (attr := simp)]
theorem prod_cons (h : a β s) : β x β cons a s h, f x = f a * β x β s, f x :=
fold_cons h
#align finset.prod_cons Finset.prod_cons
#align finset.sum_cons Finset.sum_cons
@[to_additive (attr := simp)]
theorem prod_insert [DecidableEq Ξ±] : a β s β β x β insert a s, f x = f a * β x β s, f x :=
fold_insert
#align finset.prod_insert Finset.prod_insert
#align finset.sum_insert Finset.sum_insert
@[to_additive (attr := simp) "The sum of `f` over `insert a s` is the same as
the sum over `s`, as long as `a` is in `s` or `f a = 0`."]
theorem prod_insert_of_eq_one_if_not_mem [DecidableEq Ξ±] (h : a β s β f a = 1) :
β x β insert a s, f x = β x β s, f x := by
by_cases hm : a β s
Β· simp_rw [insert_eq_of_mem hm]
Β· rw [prod_insert hm, h hm, one_mul]
#align finset.prod_insert_of_eq_one_if_not_mem Finset.prod_insert_of_eq_one_if_not_mem
#align finset.sum_insert_of_eq_zero_if_not_mem Finset.sum_insert_of_eq_zero_if_not_mem
@[to_additive (attr := simp) "The sum of `f` over `insert a s` is the same as
the sum over `s`, as long as `f a = 0`."]
theorem prod_insert_one [DecidableEq Ξ±] (h : f a = 1) : β x β insert a s, f x = β x β s, f x :=
prod_insert_of_eq_one_if_not_mem fun _ => h
#align finset.prod_insert_one Finset.prod_insert_one
#align finset.sum_insert_zero Finset.sum_insert_zero
@[to_additive]
theorem prod_insert_div {M : Type*} [CommGroup M] [DecidableEq Ξ±] (ha : a β s) {f : Ξ± β M} :
(β x β insert a s, f x) / f a = β x β s, f x := by simp [ha]
@[to_additive (attr := simp)]
theorem prod_singleton (f : Ξ± β Ξ²) (a : Ξ±) : β x β singleton a, f x = f a :=
Eq.trans fold_singleton <| mul_one _
#align finset.prod_singleton Finset.prod_singleton
#align finset.sum_singleton Finset.sum_singleton
@[to_additive]
theorem prod_pair [DecidableEq Ξ±] {a b : Ξ±} (h : a β b) :
(β x β ({a, b} : Finset Ξ±), f x) = f a * f b := by
rw [prod_insert (not_mem_singleton.2 h), prod_singleton]
#align finset.prod_pair Finset.prod_pair
#align finset.sum_pair Finset.sum_pair
@[to_additive (attr := simp)]
theorem prod_const_one : (β _x β s, (1 : Ξ²)) = 1 := by
simp only [Finset.prod, Multiset.map_const', Multiset.prod_replicate, one_pow]
#align finset.prod_const_one Finset.prod_const_one
#align finset.sum_const_zero Finset.sum_const_zero
@[to_additive (attr := simp)]
theorem prod_image [DecidableEq Ξ±] {s : Finset Ξ³} {g : Ξ³ β Ξ±} :
(β x β s, β y β s, g x = g y β x = y) β β x β s.image g, f x = β x β s, f (g x) :=
fold_image
#align finset.prod_image Finset.prod_image
#align finset.sum_image Finset.sum_image
@[to_additive (attr := simp)]
theorem prod_map (s : Finset Ξ±) (e : Ξ± βͺ Ξ³) (f : Ξ³ β Ξ²) :
β x β s.map e, f x = β x β s, f (e x) := by
rw [Finset.prod, Finset.map_val, Multiset.map_map]; rfl
#align finset.prod_map Finset.prod_map
#align finset.sum_map Finset.sum_map
@[to_additive]
lemma prod_attach (s : Finset Ξ±) (f : Ξ± β Ξ²) : β x β s.attach, f x = β x β s, f x := by
classical rw [β prod_image Subtype.coe_injective.injOn, attach_image_val]
#align finset.prod_attach Finset.prod_attach
#align finset.sum_attach Finset.sum_attach
@[to_additive (attr := congr)]
theorem prod_congr (h : sβ = sβ) : (β x β sβ, f x = g x) β sβ.prod f = sβ.prod g := by
rw [h]; exact fold_congr
#align finset.prod_congr Finset.prod_congr
#align finset.sum_congr Finset.sum_congr
@[to_additive]
theorem prod_eq_one {f : Ξ± β Ξ²} {s : Finset Ξ±} (h : β x β s, f x = 1) : β x β s, f x = 1 :=
calc
β x β s, f x = β _x β s, 1 := Finset.prod_congr rfl h
_ = 1 := Finset.prod_const_one
#align finset.prod_eq_one Finset.prod_eq_one
#align finset.sum_eq_zero Finset.sum_eq_zero
@[to_additive]
theorem prod_disjUnion (h) :
β x β sβ.disjUnion sβ h, f x = (β x β sβ, f x) * β x β sβ, f x := by
refine Eq.trans ?_ (fold_disjUnion h)
rw [one_mul]
rfl
#align finset.prod_disj_union Finset.prod_disjUnion
#align finset.sum_disj_union Finset.sum_disjUnion
@[to_additive]
theorem prod_disjiUnion (s : Finset ΞΉ) (t : ΞΉ β Finset Ξ±) (h) :
β x β s.disjiUnion t h, f x = β i β s, β x β t i, f x := by
refine Eq.trans ?_ (fold_disjiUnion h)
dsimp [Finset.prod, Multiset.prod, Multiset.fold, Finset.disjUnion, Finset.fold]
congr
exact prod_const_one.symm
#align finset.prod_disj_Union Finset.prod_disjiUnion
#align finset.sum_disj_Union Finset.sum_disjiUnion
@[to_additive]
theorem prod_union_inter [DecidableEq Ξ±] :
(β x β sβ βͺ sβ, f x) * β x β sβ β© sβ, f x = (β x β sβ, f x) * β x β sβ, f x :=
fold_union_inter
#align finset.prod_union_inter Finset.prod_union_inter
#align finset.sum_union_inter Finset.sum_union_inter
@[to_additive]
theorem prod_union [DecidableEq Ξ±] (h : Disjoint sβ sβ) :
β x β sβ βͺ sβ, f x = (β x β sβ, f x) * β x β sβ, f x := by
rw [β prod_union_inter, disjoint_iff_inter_eq_empty.mp h]; exact (mul_one _).symm
#align finset.prod_union Finset.prod_union
#align finset.sum_union Finset.sum_union
@[to_additive]
| Mathlib/Algebra/BigOperators/Group/Finset.lean | 464 | 468 | theorem prod_filter_mul_prod_filter_not
(s : Finset Ξ±) (p : Ξ± β Prop) [DecidablePred p] [β x, Decidable (Β¬p x)] (f : Ξ± β Ξ²) :
(β x β s.filter p, f x) * β x β s.filter fun x => Β¬p x, f x = β x β s, f x := by |
have := Classical.decEq Ξ±
rw [β prod_union (disjoint_filter_filter_neg s s p), filter_union_filter_neg_eq]
|
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
β¨β¨default, default, default, defaultβ©β©
instance [Zero R] : Zero (Cubic R) :=
β¨β¨0, 0, 0, 0β©β©
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly β¨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)β© := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly β¨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)β© := by
rw [β one_mul <| X - C x, β C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (β n > 3, P.toPoly.coeff n = 0) β§ P.toPoly.coeff 3 = P.a β§
P.toPoly.coeff 2 = P.b β§ P.toPoly.coeff 1 = P.c β§ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : β} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [β coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [β coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by rw [β coeff_eq_c, h, coeff_eq_c]
#align cubic.c_of_eq Cubic.c_of_eq
theorem d_of_eq (h : P.toPoly = Q.toPoly) : P.d = Q.d := by rw [β coeff_eq_d, h, coeff_eq_d]
#align cubic.d_of_eq Cubic.d_of_eq
theorem toPoly_injective (P Q : Cubic R) : P.toPoly = Q.toPoly β P = Q :=
β¨fun h β¦ Cubic.ext P Q (a_of_eq h) (b_of_eq h) (c_of_eq h) (d_of_eq h), congr_arg toPolyβ©
#align cubic.to_poly_injective Cubic.toPoly_injective
theorem of_a_eq_zero (ha : P.a = 0) : P.toPoly = C P.b * X ^ 2 + C P.c * X + C P.d := by
rw [toPoly, ha, C_0, zero_mul, zero_add]
#align cubic.of_a_eq_zero Cubic.of_a_eq_zero
theorem of_a_eq_zero' : toPoly β¨0, b, c, dβ© = C b * X ^ 2 + C c * X + C d :=
of_a_eq_zero rfl
#align cubic.of_a_eq_zero' Cubic.of_a_eq_zero'
theorem of_b_eq_zero (ha : P.a = 0) (hb : P.b = 0) : P.toPoly = C P.c * X + C P.d := by
rw [of_a_eq_zero ha, hb, C_0, zero_mul, zero_add]
#align cubic.of_b_eq_zero Cubic.of_b_eq_zero
theorem of_b_eq_zero' : toPoly β¨0, 0, c, dβ© = C c * X + C d :=
of_b_eq_zero rfl rfl
#align cubic.of_b_eq_zero' Cubic.of_b_eq_zero'
theorem of_c_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) : P.toPoly = C P.d := by
rw [of_b_eq_zero ha hb, hc, C_0, zero_mul, zero_add]
#align cubic.of_c_eq_zero Cubic.of_c_eq_zero
theorem of_c_eq_zero' : toPoly β¨0, 0, 0, dβ© = C d :=
of_c_eq_zero rfl rfl rfl
#align cubic.of_c_eq_zero' Cubic.of_c_eq_zero'
theorem of_d_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) (hd : P.d = 0) :
P.toPoly = 0 := by
rw [of_c_eq_zero ha hb hc, hd, C_0]
#align cubic.of_d_eq_zero Cubic.of_d_eq_zero
theorem of_d_eq_zero' : (β¨0, 0, 0, 0β© : Cubic R).toPoly = 0 :=
of_d_eq_zero rfl rfl rfl rfl
#align cubic.of_d_eq_zero' Cubic.of_d_eq_zero'
theorem zero : (0 : Cubic R).toPoly = 0 :=
of_d_eq_zero'
#align cubic.zero Cubic.zero
theorem toPoly_eq_zero_iff (P : Cubic R) : P.toPoly = 0 β P = 0 := by
rw [β zero, toPoly_injective]
#align cubic.to_poly_eq_zero_iff Cubic.toPoly_eq_zero_iff
private theorem ne_zero (h0 : P.a β 0 β¨ P.b β 0 β¨ P.c β 0 β¨ P.d β 0) : P.toPoly β 0 := by
contrapose! h0
rw [(toPoly_eq_zero_iff P).mp h0]
exact β¨rfl, rfl, rfl, rflβ©
theorem ne_zero_of_a_ne_zero (ha : P.a β 0) : P.toPoly β 0 :=
(or_imp.mp ne_zero).1 ha
#align cubic.ne_zero_of_a_ne_zero Cubic.ne_zero_of_a_ne_zero
theorem ne_zero_of_b_ne_zero (hb : P.b β 0) : P.toPoly β 0 :=
(or_imp.mp (or_imp.mp ne_zero).2).1 hb
#align cubic.ne_zero_of_b_ne_zero Cubic.ne_zero_of_b_ne_zero
theorem ne_zero_of_c_ne_zero (hc : P.c β 0) : P.toPoly β 0 :=
(or_imp.mp (or_imp.mp (or_imp.mp ne_zero).2).2).1 hc
#align cubic.ne_zero_of_c_ne_zero Cubic.ne_zero_of_c_ne_zero
theorem ne_zero_of_d_ne_zero (hd : P.d β 0) : P.toPoly β 0 :=
(or_imp.mp (or_imp.mp (or_imp.mp ne_zero).2).2).2 hd
#align cubic.ne_zero_of_d_ne_zero Cubic.ne_zero_of_d_ne_zero
@[simp]
theorem leadingCoeff_of_a_ne_zero (ha : P.a β 0) : P.toPoly.leadingCoeff = P.a :=
leadingCoeff_cubic ha
#align cubic.leading_coeff_of_a_ne_zero Cubic.leadingCoeff_of_a_ne_zero
@[simp]
theorem leadingCoeff_of_a_ne_zero' (ha : a β 0) : (toPoly β¨a, b, c, dβ©).leadingCoeff = a :=
leadingCoeff_of_a_ne_zero ha
#align cubic.leading_coeff_of_a_ne_zero' Cubic.leadingCoeff_of_a_ne_zero'
@[simp]
theorem leadingCoeff_of_b_ne_zero (ha : P.a = 0) (hb : P.b β 0) : P.toPoly.leadingCoeff = P.b := by
rw [of_a_eq_zero ha, leadingCoeff_quadratic hb]
#align cubic.leading_coeff_of_b_ne_zero Cubic.leadingCoeff_of_b_ne_zero
@[simp]
theorem leadingCoeff_of_b_ne_zero' (hb : b β 0) : (toPoly β¨0, b, c, dβ©).leadingCoeff = b :=
leadingCoeff_of_b_ne_zero rfl hb
#align cubic.leading_coeff_of_b_ne_zero' Cubic.leadingCoeff_of_b_ne_zero'
@[simp]
theorem leadingCoeff_of_c_ne_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c β 0) :
P.toPoly.leadingCoeff = P.c := by
rw [of_b_eq_zero ha hb, leadingCoeff_linear hc]
#align cubic.leading_coeff_of_c_ne_zero Cubic.leadingCoeff_of_c_ne_zero
@[simp]
theorem leadingCoeff_of_c_ne_zero' (hc : c β 0) : (toPoly β¨0, 0, c, dβ©).leadingCoeff = c :=
leadingCoeff_of_c_ne_zero rfl rfl hc
#align cubic.leading_coeff_of_c_ne_zero' Cubic.leadingCoeff_of_c_ne_zero'
@[simp]
| Mathlib/Algebra/CubicDiscriminant.lean | 231 | 233 | theorem leadingCoeff_of_c_eq_zero (ha : P.a = 0) (hb : P.b = 0) (hc : P.c = 0) :
P.toPoly.leadingCoeff = P.d := by |
rw [of_c_eq_zero ha hb hc, leadingCoeff_C]
|
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ΞΉ : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A βΆ B) [HasImage f] (g : B βΆ C) [HasKernel g]
theorem image_le_kernel (w : f β« g = 0) : imageSubobject f β€ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f β« g = 0) : (imageSubobject f : V) βΆ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f β« g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f β« g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f β« g = 0) :
imageToKernel f g w β« (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f β« g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [β comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f β« g = 0) :
factorThruImageSubobject f β« imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A βΆ B) (g : B βΆ C)
@[simp]
theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A βΆ B) g w = 0 := by
ext
simp
#align image_to_kernel_zero_left imageToKernel_zero_left
theorem imageToKernel_zero_right [HasImages V] {w} :
imageToKernel f (0 : B βΆ C) w =
(imageSubobject f).arrow β« inv (kernelSubobject (0 : B βΆ C)).arrow := by
ext
simp
#align image_to_kernel_zero_right imageToKernel_zero_right
section
variable [HasKernels V] [HasImages V]
theorem imageToKernel_comp_right {D : V} (h : C βΆ D) (w : f β« g = 0) :
imageToKernel f (g β« h) (by simp [reassoc_of% w]) =
imageToKernel f g w β« Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by
ext
simp
#align image_to_kernel_comp_right imageToKernel_comp_right
theorem imageToKernel_comp_left {Z : V} (h : Z βΆ A) (w : f β« g = 0) :
imageToKernel (h β« f) g (by simp [w]) =
Subobject.ofLE _ _ (imageSubobject_comp_le h f) β« imageToKernel f g w := by
ext
simp
#align image_to_kernel_comp_left imageToKernel_comp_left
@[simp]
| Mathlib/Algebra/Homology/ImageToKernel.lean | 127 | 132 | theorem imageToKernel_comp_mono {D : V} (h : C βΆ D) [Mono h] (w) :
imageToKernel f (g β« h) w =
imageToKernel f g ((cancel_mono h).mp (by simpa using w : (f β« g) β« h = 0 β« h)) β«
(Subobject.isoOfEq _ _ (kernelSubobject_comp_mono g h)).inv := by |
ext
simp
|
import Mathlib.Init.Core
import Mathlib.LinearAlgebra.AffineSpace.Basis
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import linear_algebra.affine_space.finite_dimensional from "leanprover-community/mathlib"@"67e606eaea14c7854bdc556bd53d98aefdf76ec0"
noncomputable section
open Affine
section AffineSpace'
variable (k : Type*) {V : Type*} {P : Type*}
variable {ΞΉ : Type*}
open AffineSubspace FiniteDimensional Module
variable [DivisionRing k] [AddCommGroup V] [Module k V] [AffineSpace V P]
theorem finiteDimensional_vectorSpan_of_finite {s : Set P} (h : Set.Finite s) :
FiniteDimensional k (vectorSpan k s) :=
span_of_finite k <| h.vsub h
#align finite_dimensional_vector_span_of_finite finiteDimensional_vectorSpan_of_finite
instance finiteDimensional_vectorSpan_range [Finite ΞΉ] (p : ΞΉ β P) :
FiniteDimensional k (vectorSpan k (Set.range p)) :=
finiteDimensional_vectorSpan_of_finite k (Set.finite_range _)
#align finite_dimensional_vector_span_range finiteDimensional_vectorSpan_range
instance finiteDimensional_vectorSpan_image_of_finite [Finite ΞΉ] (p : ΞΉ β P) (s : Set ΞΉ) :
FiniteDimensional k (vectorSpan k (p '' s)) :=
finiteDimensional_vectorSpan_of_finite k (Set.toFinite _)
#align finite_dimensional_vector_span_image_of_finite finiteDimensional_vectorSpan_image_of_finite
theorem finiteDimensional_direction_affineSpan_of_finite {s : Set P} (h : Set.Finite s) :
FiniteDimensional k (affineSpan k s).direction :=
(direction_affineSpan k s).symm βΈ finiteDimensional_vectorSpan_of_finite k h
#align finite_dimensional_direction_affine_span_of_finite finiteDimensional_direction_affineSpan_of_finite
instance finiteDimensional_direction_affineSpan_range [Finite ΞΉ] (p : ΞΉ β P) :
FiniteDimensional k (affineSpan k (Set.range p)).direction :=
finiteDimensional_direction_affineSpan_of_finite k (Set.finite_range _)
#align finite_dimensional_direction_affine_span_range finiteDimensional_direction_affineSpan_range
instance finiteDimensional_direction_affineSpan_image_of_finite [Finite ΞΉ] (p : ΞΉ β P) (s : Set ΞΉ) :
FiniteDimensional k (affineSpan k (p '' s)).direction :=
finiteDimensional_direction_affineSpan_of_finite k (Set.toFinite _)
#align finite_dimensional_direction_affine_span_image_of_finite finiteDimensional_direction_affineSpan_image_of_finite
theorem finite_of_fin_dim_affineIndependent [FiniteDimensional k V] {p : ΞΉ β P}
(hi : AffineIndependent k p) : Finite ΞΉ := by
nontriviality ΞΉ; inhabit ΞΉ
rw [affineIndependent_iff_linearIndependent_vsub k p default] at hi
letI : IsNoetherian k V := IsNoetherian.iff_fg.2 inferInstance
exact
(Set.finite_singleton default).finite_of_compl (Set.finite_coe_iff.1 hi.finite_of_isNoetherian)
#align finite_of_fin_dim_affine_independent finite_of_fin_dim_affineIndependent
theorem finite_set_of_fin_dim_affineIndependent [FiniteDimensional k V] {s : Set ΞΉ} {f : s β P}
(hi : AffineIndependent k f) : s.Finite :=
@Set.toFinite _ s (finite_of_fin_dim_affineIndependent k hi)
#align finite_set_of_fin_dim_affine_independent finite_set_of_fin_dim_affineIndependent
variable {k}
theorem AffineIndependent.finrank_vectorSpan_image_finset [DecidableEq P]
{p : ΞΉ β P} (hi : AffineIndependent k p) {s : Finset ΞΉ} {n : β} (hc : Finset.card s = n + 1) :
finrank k (vectorSpan k (s.image p : Set P)) = n := by
classical
have hi' := hi.range.mono (Set.image_subset_range p βs)
have hc' : (s.image p).card = n + 1 := by rwa [s.card_image_of_injective hi.injective]
have hn : (s.image p).Nonempty := by simp [hc', β Finset.card_pos]
rcases hn with β¨pβ, hpββ©
have hpβ' : pβ β p '' s := by simpa using hpβ
rw [affineIndependent_set_iff_linearIndependent_vsub k hpβ', β Finset.coe_singleton,
β Finset.coe_image, β Finset.coe_sdiff, Finset.sdiff_singleton_eq_erase, β Finset.coe_image]
at hi'
have hc : (Finset.image (fun p : P => p -α΅₯ pβ) ((Finset.image p s).erase pβ)).card = n := by
rw [Finset.card_image_of_injective _ (vsub_left_injective _), Finset.card_erase_of_mem hpβ]
exact Nat.pred_eq_of_eq_succ hc'
rwa [vectorSpan_eq_span_vsub_finset_right_ne k hpβ, finrank_span_finset_eq_card, hc]
#align affine_independent.finrank_vector_span_image_finset AffineIndependent.finrank_vectorSpan_image_finset
theorem AffineIndependent.finrank_vectorSpan [Fintype ΞΉ] {p : ΞΉ β P} (hi : AffineIndependent k p)
{n : β} (hc : Fintype.card ΞΉ = n + 1) : finrank k (vectorSpan k (Set.range p)) = n := by
classical
rw [β Finset.card_univ] at hc
rw [β Set.image_univ, β Finset.coe_univ, β Finset.coe_image]
exact hi.finrank_vectorSpan_image_finset hc
#align affine_independent.finrank_vector_span AffineIndependent.finrank_vectorSpan
lemma AffineIndependent.finrank_vectorSpan_add_one [Fintype ΞΉ] [Nonempty ΞΉ] {p : ΞΉ β P}
(hi : AffineIndependent k p) : finrank k (vectorSpan k (Set.range p)) + 1 = Fintype.card ΞΉ := by
rw [hi.finrank_vectorSpan (tsub_add_cancel_of_le _).symm, tsub_add_cancel_of_le] <;>
exact Fintype.card_pos
theorem AffineIndependent.vectorSpan_eq_top_of_card_eq_finrank_add_one [FiniteDimensional k V]
[Fintype ΞΉ] {p : ΞΉ β P} (hi : AffineIndependent k p) (hc : Fintype.card ΞΉ = finrank k V + 1) :
vectorSpan k (Set.range p) = β€ :=
Submodule.eq_top_of_finrank_eq <| hi.finrank_vectorSpan hc
#align affine_independent.vector_span_eq_top_of_card_eq_finrank_add_one AffineIndependent.vectorSpan_eq_top_of_card_eq_finrank_add_one
variable (k)
theorem finrank_vectorSpan_image_finset_le [DecidableEq P] (p : ΞΉ β P) (s : Finset ΞΉ) {n : β}
(hc : Finset.card s = n + 1) : finrank k (vectorSpan k (s.image p : Set P)) β€ n := by
classical
have hn : (s.image p).Nonempty := by
rw [Finset.image_nonempty, β Finset.card_pos, hc]
apply Nat.succ_pos
rcases hn with β¨pβ, hpββ©
rw [vectorSpan_eq_span_vsub_finset_right_ne k hpβ]
refine le_trans (finrank_span_finset_le_card (((s.image p).erase pβ).image fun p => p -α΅₯ pβ)) ?_
rw [Finset.card_image_of_injective _ (vsub_left_injective pβ), Finset.card_erase_of_mem hpβ,
tsub_le_iff_right, β hc]
apply Finset.card_image_le
#align finrank_vector_span_image_finset_le finrank_vectorSpan_image_finset_le
theorem finrank_vectorSpan_range_le [Fintype ΞΉ] (p : ΞΉ β P) {n : β} (hc : Fintype.card ΞΉ = n + 1) :
finrank k (vectorSpan k (Set.range p)) β€ n := by
classical
rw [β Set.image_univ, β Finset.coe_univ, β Finset.coe_image]
rw [β Finset.card_univ] at hc
exact finrank_vectorSpan_image_finset_le _ _ _ hc
#align finrank_vector_span_range_le finrank_vectorSpan_range_le
lemma finrank_vectorSpan_range_add_one_le [Fintype ΞΉ] [Nonempty ΞΉ] (p : ΞΉ β P) :
finrank k (vectorSpan k (Set.range p)) + 1 β€ Fintype.card ΞΉ :=
(le_tsub_iff_right $ Nat.succ_le_iff.2 Fintype.card_pos).1 $ finrank_vectorSpan_range_le _ _
(tsub_add_cancel_of_le $ Nat.succ_le_iff.2 Fintype.card_pos).symm
theorem affineIndependent_iff_finrank_vectorSpan_eq [Fintype ΞΉ] (p : ΞΉ β P) {n : β}
(hc : Fintype.card ΞΉ = n + 1) :
AffineIndependent k p β finrank k (vectorSpan k (Set.range p)) = n := by
classical
have hn : Nonempty ΞΉ := by simp [β Fintype.card_pos_iff, hc]
cases' hn with iβ
rw [affineIndependent_iff_linearIndependent_vsub _ _ iβ,
linearIndependent_iff_card_eq_finrank_span, eq_comm,
vectorSpan_range_eq_span_range_vsub_right_ne k p iβ, Set.finrank]
rw [β Finset.card_univ] at hc
rw [Fintype.subtype_card]
simp [Finset.filter_ne', Finset.card_erase_of_mem, hc]
#align affine_independent_iff_finrank_vector_span_eq affineIndependent_iff_finrank_vectorSpan_eq
theorem affineIndependent_iff_le_finrank_vectorSpan [Fintype ΞΉ] (p : ΞΉ β P) {n : β}
(hc : Fintype.card ΞΉ = n + 1) :
AffineIndependent k p β n β€ finrank k (vectorSpan k (Set.range p)) := by
rw [affineIndependent_iff_finrank_vectorSpan_eq k p hc]
constructor
Β· rintro rfl
rfl
Β· exact fun hle => le_antisymm (finrank_vectorSpan_range_le k p hc) hle
#align affine_independent_iff_le_finrank_vector_span affineIndependent_iff_le_finrank_vectorSpan
theorem affineIndependent_iff_not_finrank_vectorSpan_le [Fintype ΞΉ] (p : ΞΉ β P) {n : β}
(hc : Fintype.card ΞΉ = n + 2) :
AffineIndependent k p β Β¬finrank k (vectorSpan k (Set.range p)) β€ n := by
rw [affineIndependent_iff_le_finrank_vectorSpan k p hc, β Nat.lt_iff_add_one_le, lt_iff_not_ge]
#align affine_independent_iff_not_finrank_vector_span_le affineIndependent_iff_not_finrank_vectorSpan_le
theorem finrank_vectorSpan_le_iff_not_affineIndependent [Fintype ΞΉ] (p : ΞΉ β P) {n : β}
(hc : Fintype.card ΞΉ = n + 2) :
finrank k (vectorSpan k (Set.range p)) β€ n β Β¬AffineIndependent k p :=
(not_iff_comm.1 (affineIndependent_iff_not_finrank_vectorSpan_le k p hc).symm).symm
#align finrank_vector_span_le_iff_not_affine_independent finrank_vectorSpan_le_iff_not_affineIndependent
variable {k}
lemma AffineIndependent.card_le_finrank_succ [Fintype ΞΉ] {p : ΞΉ β P} (hp : AffineIndependent k p) :
Fintype.card ΞΉ β€ FiniteDimensional.finrank k (vectorSpan k (Set.range p)) + 1 := by
cases isEmpty_or_nonempty ΞΉ
Β· simp [Fintype.card_eq_zero]
rw [β tsub_le_iff_right]
exact (affineIndependent_iff_le_finrank_vectorSpan _ _
(tsub_add_cancel_of_le <| Nat.one_le_iff_ne_zero.2 Fintype.card_ne_zero).symm).1 hp
open Finset in
lemma AffineIndependent.card_le_card_of_subset_affineSpan {s t : Finset V}
(hs : AffineIndependent k ((β) : s β V)) (hst : (s : Set V) β affineSpan k (t : Set V)) :
s.card β€ t.card := by
obtain rfl | hs' := s.eq_empty_or_nonempty
Β· simp
obtain rfl | ht' := t.eq_empty_or_nonempty
Β· simpa [Set.subset_empty_iff] using hst
have := hs'.to_subtype
have := ht'.to_set.to_subtype
have direction_le := AffineSubspace.direction_le (affineSpan_mono k hst)
rw [AffineSubspace.affineSpan_coe, direction_affineSpan, direction_affineSpan,
β @Subtype.range_coe _ (s : Set V), β @Subtype.range_coe _ (t : Set V)] at direction_le
have finrank_le := add_le_add_right (Submodule.finrank_le_finrank_of_le direction_le) 1
-- We use `erw` to elide the difference between `β₯s` and `β₯(s : Set V)}`
erw [hs.finrank_vectorSpan_add_one] at finrank_le
simpa using finrank_le.trans <| finrank_vectorSpan_range_add_one_le _ _
open Finset in
lemma AffineIndependent.card_lt_card_of_affineSpan_lt_affineSpan {s t : Finset V}
(hs : AffineIndependent k ((β) : s β V))
(hst : affineSpan k (s : Set V) < affineSpan k (t : Set V)) : s.card < t.card := by
obtain rfl | hs' := s.eq_empty_or_nonempty
Β· simpa [card_pos] using hst
obtain rfl | ht' := t.eq_empty_or_nonempty
Β· simp [Set.subset_empty_iff] at hst
have := hs'.to_subtype
have := ht'.to_set.to_subtype
have dir_lt := AffineSubspace.direction_lt_of_nonempty (k := k) hst $ hs'.to_set.affineSpan k
rw [direction_affineSpan, direction_affineSpan,
β @Subtype.range_coe _ (s : Set V), β @Subtype.range_coe _ (t : Set V)] at dir_lt
have finrank_lt := add_lt_add_right (Submodule.finrank_lt_finrank_of_lt dir_lt) 1
-- We use `erw` to elide the difference between `β₯s` and `β₯(s : Set V)}`
erw [hs.finrank_vectorSpan_add_one] at finrank_lt
simpa using finrank_lt.trans_le <| finrank_vectorSpan_range_add_one_le _ _
theorem AffineIndependent.vectorSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one
[DecidableEq P] {p : ΞΉ β P}
(hi : AffineIndependent k p) {s : Finset ΞΉ} {sm : Submodule k V} [FiniteDimensional k sm]
(hle : vectorSpan k (s.image p : Set P) β€ sm) (hc : Finset.card s = finrank k sm + 1) :
vectorSpan k (s.image p : Set P) = sm :=
eq_of_le_of_finrank_eq hle <| hi.finrank_vectorSpan_image_finset hc
#align affine_independent.vector_span_image_finset_eq_of_le_of_card_eq_finrank_add_one AffineIndependent.vectorSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one
theorem AffineIndependent.vectorSpan_eq_of_le_of_card_eq_finrank_add_one [Fintype ΞΉ] {p : ΞΉ β P}
(hi : AffineIndependent k p) {sm : Submodule k V} [FiniteDimensional k sm]
(hle : vectorSpan k (Set.range p) β€ sm) (hc : Fintype.card ΞΉ = finrank k sm + 1) :
vectorSpan k (Set.range p) = sm :=
eq_of_le_of_finrank_eq hle <| hi.finrank_vectorSpan hc
#align affine_independent.vector_span_eq_of_le_of_card_eq_finrank_add_one AffineIndependent.vectorSpan_eq_of_le_of_card_eq_finrank_add_one
theorem AffineIndependent.affineSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one
[DecidableEq P] {p : ΞΉ β P}
(hi : AffineIndependent k p) {s : Finset ΞΉ} {sp : AffineSubspace k P}
[FiniteDimensional k sp.direction] (hle : affineSpan k (s.image p : Set P) β€ sp)
(hc : Finset.card s = finrank k sp.direction + 1) : affineSpan k (s.image p : Set P) = sp := by
have hn : s.Nonempty := by
rw [β Finset.card_pos, hc]
apply Nat.succ_pos
refine eq_of_direction_eq_of_nonempty_of_le ?_ ((hn.image p).to_set.affineSpan k) hle
have hd := direction_le hle
rw [direction_affineSpan] at hd β’
exact hi.vectorSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one hd hc
#align affine_independent.affine_span_image_finset_eq_of_le_of_card_eq_finrank_add_one AffineIndependent.affineSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one
theorem AffineIndependent.affineSpan_eq_of_le_of_card_eq_finrank_add_one [Fintype ΞΉ] {p : ΞΉ β P}
(hi : AffineIndependent k p) {sp : AffineSubspace k P} [FiniteDimensional k sp.direction]
(hle : affineSpan k (Set.range p) β€ sp) (hc : Fintype.card ΞΉ = finrank k sp.direction + 1) :
affineSpan k (Set.range p) = sp := by
classical
rw [β Finset.card_univ] at hc
rw [β Set.image_univ, β Finset.coe_univ, β Finset.coe_image] at hle β’
exact hi.affineSpan_image_finset_eq_of_le_of_card_eq_finrank_add_one hle hc
#align affine_independent.affine_span_eq_of_le_of_card_eq_finrank_add_one AffineIndependent.affineSpan_eq_of_le_of_card_eq_finrank_add_one
theorem AffineIndependent.affineSpan_eq_top_iff_card_eq_finrank_add_one [FiniteDimensional k V]
[Fintype ΞΉ] {p : ΞΉ β P} (hi : AffineIndependent k p) :
affineSpan k (Set.range p) = β€ β Fintype.card ΞΉ = finrank k V + 1 := by
constructor
Β· intro h_tot
let n := Fintype.card ΞΉ - 1
have hn : Fintype.card ΞΉ = n + 1 :=
(Nat.succ_pred_eq_of_pos (card_pos_of_affineSpan_eq_top k V P h_tot)).symm
rw [hn, β finrank_top, β (vectorSpan_eq_top_of_affineSpan_eq_top k V P) h_tot,
β hi.finrank_vectorSpan hn]
Β· intro hc
rw [β finrank_top, β direction_top k V P] at hc
exact hi.affineSpan_eq_of_le_of_card_eq_finrank_add_one le_top hc
#align affine_independent.affine_span_eq_top_iff_card_eq_finrank_add_one AffineIndependent.affineSpan_eq_top_iff_card_eq_finrank_add_one
theorem Affine.Simplex.span_eq_top [FiniteDimensional k V] {n : β} (T : Affine.Simplex k V n)
(hrank : finrank k V = n) : affineSpan k (Set.range T.points) = β€ := by
rw [AffineIndependent.affineSpan_eq_top_iff_card_eq_finrank_add_one T.independent,
Fintype.card_fin, hrank]
#align affine.simplex.span_eq_top Affine.Simplex.span_eq_top
instance finiteDimensional_vectorSpan_insert (s : AffineSubspace k P)
[FiniteDimensional k s.direction] (p : P) :
FiniteDimensional k (vectorSpan k (insert p (s : Set P))) := by
rw [β direction_affineSpan, β affineSpan_insert_affineSpan]
rcases (s : Set P).eq_empty_or_nonempty with (hs | β¨pβ, hpββ©)
Β· rw [coe_eq_bot_iff] at hs
rw [hs, bot_coe, span_empty, bot_coe, direction_affineSpan]
convert finiteDimensional_bot k V <;> simp
Β· rw [affineSpan_coe, direction_affineSpan_insert hpβ]
infer_instance
#align finite_dimensional_vector_span_insert finiteDimensional_vectorSpan_insert
instance finiteDimensional_direction_affineSpan_insert (s : AffineSubspace k P)
[FiniteDimensional k s.direction] (p : P) :
FiniteDimensional k (affineSpan k (insert p (s : Set P))).direction :=
(direction_affineSpan k (insert p (s : Set P))).symm βΈ finiteDimensional_vectorSpan_insert s p
#align finite_dimensional_direction_affine_span_insert finiteDimensional_direction_affineSpan_insert
variable (k)
instance finiteDimensional_vectorSpan_insert_set (s : Set P) [FiniteDimensional k (vectorSpan k s)]
(p : P) : FiniteDimensional k (vectorSpan k (insert p s)) := by
haveI : FiniteDimensional k (affineSpan k s).direction :=
(direction_affineSpan k s).symm βΈ inferInstance
rw [β direction_affineSpan, β affineSpan_insert_affineSpan, direction_affineSpan]
exact finiteDimensional_vectorSpan_insert (affineSpan k s) p
#align finite_dimensional_vector_span_insert_set finiteDimensional_vectorSpan_insert_set
def Collinear (s : Set P) : Prop :=
Module.rank k (vectorSpan k s) β€ 1
#align collinear Collinear
theorem collinear_iff_rank_le_one (s : Set P) :
Collinear k s β Module.rank k (vectorSpan k s) β€ 1 := Iff.rfl
#align collinear_iff_rank_le_one collinear_iff_rank_le_one
variable {k}
theorem collinear_iff_finrank_le_one {s : Set P} [FiniteDimensional k (vectorSpan k s)] :
Collinear k s β finrank k (vectorSpan k s) β€ 1 := by
have h := collinear_iff_rank_le_one k s
rw [β finrank_eq_rank] at h
exact mod_cast h
#align collinear_iff_finrank_le_one collinear_iff_finrank_le_one
alias β¨Collinear.finrank_le_one, _β© := collinear_iff_finrank_le_one
#align collinear.finrank_le_one Collinear.finrank_le_one
theorem Collinear.subset {sβ sβ : Set P} (hs : sβ β sβ) (h : Collinear k sβ) : Collinear k sβ :=
(rank_le_of_submodule (vectorSpan k sβ) (vectorSpan k sβ) (vectorSpan_mono k hs)).trans h
#align collinear.subset Collinear.subset
theorem Collinear.finiteDimensional_vectorSpan {s : Set P} (h : Collinear k s) :
FiniteDimensional k (vectorSpan k s) :=
IsNoetherian.iff_fg.1
(IsNoetherian.iff_rank_lt_aleph0.2 (lt_of_le_of_lt h Cardinal.one_lt_aleph0))
#align collinear.finite_dimensional_vector_span Collinear.finiteDimensional_vectorSpan
theorem Collinear.finiteDimensional_direction_affineSpan {s : Set P} (h : Collinear k s) :
FiniteDimensional k (affineSpan k s).direction :=
(direction_affineSpan k s).symm βΈ h.finiteDimensional_vectorSpan
#align collinear.finite_dimensional_direction_affine_span Collinear.finiteDimensional_direction_affineSpan
variable (k P)
theorem collinear_empty : Collinear k (β
: Set P) := by
rw [collinear_iff_rank_le_one, vectorSpan_empty]
simp
#align collinear_empty collinear_empty
variable {P}
theorem collinear_singleton (p : P) : Collinear k ({p} : Set P) := by
rw [collinear_iff_rank_le_one, vectorSpan_singleton]
simp
#align collinear_singleton collinear_singleton
variable {k}
theorem collinear_iff_of_mem {s : Set P} {pβ : P} (h : pβ β s) :
Collinear k s β β v : V, β p β s, β r : k, p = r β’ v +α΅₯ pβ := by
simp_rw [collinear_iff_rank_le_one, rank_submodule_le_one_iff', Submodule.le_span_singleton_iff]
constructor
Β· rintro β¨vβ, hvβ©
use vβ
intro p hp
obtain β¨r, hrβ© := hv (p -α΅₯ pβ) (vsub_mem_vectorSpan k hp h)
use r
rw [eq_vadd_iff_vsub_eq]
exact hr.symm
Β· rintro β¨v, hpβvβ©
use v
intro w hw
have hs : vectorSpan k s β€ k β v := by
rw [vectorSpan_eq_span_vsub_set_right k h, Submodule.span_le, Set.subset_def]
intro x hx
rw [SetLike.mem_coe, Submodule.mem_span_singleton]
rw [Set.mem_image] at hx
rcases hx with β¨p, hp, rflβ©
rcases hpβv p hp with β¨r, rflβ©
use r
simp
have hw' := SetLike.le_def.1 hs hw
rwa [Submodule.mem_span_singleton] at hw'
#align collinear_iff_of_mem collinear_iff_of_mem
theorem collinear_iff_exists_forall_eq_smul_vadd (s : Set P) :
Collinear k s β β (pβ : P) (v : V), β p β s, β r : k, p = r β’ v +α΅₯ pβ := by
rcases Set.eq_empty_or_nonempty s with (rfl | β¨β¨pβ, hpββ©β©)
Β· simp [collinear_empty]
Β· rw [collinear_iff_of_mem hpβ]
constructor
Β· exact fun h => β¨pβ, hβ©
Β· rintro β¨p, v, hvβ©
use v
intro pβ hpβ
rcases hv pβ hpβ with β¨r, rflβ©
rcases hv pβ hpβ with β¨rβ, rflβ©
use r - rβ
simp [vadd_vadd, β add_smul]
#align collinear_iff_exists_forall_eq_smul_vadd collinear_iff_exists_forall_eq_smul_vadd
variable (k)
theorem collinear_pair (pβ pβ : P) : Collinear k ({pβ, pβ} : Set P) := by
rw [collinear_iff_exists_forall_eq_smul_vadd]
use pβ, pβ -α΅₯ pβ
intro p hp
rw [Set.mem_insert_iff, Set.mem_singleton_iff] at hp
cases' hp with hp hp
Β· use 0
simp [hp]
Β· use 1
simp [hp]
#align collinear_pair collinear_pair
variable {k}
theorem affineIndependent_iff_not_collinear {p : Fin 3 β P} :
AffineIndependent k p β Β¬Collinear k (Set.range p) := by
rw [collinear_iff_finrank_le_one,
affineIndependent_iff_not_finrank_vectorSpan_le k p (Fintype.card_fin 3)]
#align affine_independent_iff_not_collinear affineIndependent_iff_not_collinear
theorem collinear_iff_not_affineIndependent {p : Fin 3 β P} :
Collinear k (Set.range p) β Β¬AffineIndependent k p := by
rw [collinear_iff_finrank_le_one,
finrank_vectorSpan_le_iff_not_affineIndependent k p (Fintype.card_fin 3)]
#align collinear_iff_not_affine_independent collinear_iff_not_affineIndependent
theorem affineIndependent_iff_not_collinear_set {pβ pβ pβ : P} :
AffineIndependent k ![pβ, pβ, pβ] β Β¬Collinear k ({pβ, pβ, pβ} : Set P) := by
rw [affineIndependent_iff_not_collinear]
simp_rw [Matrix.range_cons, Matrix.range_empty, Set.singleton_union, insert_emptyc_eq]
#align affine_independent_iff_not_collinear_set affineIndependent_iff_not_collinear_set
theorem collinear_iff_not_affineIndependent_set {pβ pβ pβ : P} :
Collinear k ({pβ, pβ, pβ} : Set P) β Β¬AffineIndependent k ![pβ, pβ, pβ] :=
affineIndependent_iff_not_collinear_set.not_left.symm
#align collinear_iff_not_affine_independent_set collinear_iff_not_affineIndependent_set
theorem affineIndependent_iff_not_collinear_of_ne {p : Fin 3 β P} {iβ iβ iβ : Fin 3} (hββ : iβ β iβ)
(hββ : iβ β iβ) (hββ : iβ β iβ) :
AffineIndependent k p β Β¬Collinear k ({p iβ, p iβ, p iβ} : Set P) := by
have hu : (Finset.univ : Finset (Fin 3)) = {iβ, iβ, iβ} := by
-- Porting note: Originally `by decide!`
fin_cases iβ <;> fin_cases iβ <;> fin_cases iβ
<;> simp (config := {decide := true}) only at hββ hββ hββ β’
rw [affineIndependent_iff_not_collinear, β Set.image_univ, β Finset.coe_univ, hu,
Finset.coe_insert, Finset.coe_insert, Finset.coe_singleton, Set.image_insert_eq, Set.image_pair]
#align affine_independent_iff_not_collinear_of_ne affineIndependent_iff_not_collinear_of_ne
theorem collinear_iff_not_affineIndependent_of_ne {p : Fin 3 β P} {iβ iβ iβ : Fin 3} (hββ : iβ β iβ)
(hββ : iβ β iβ) (hββ : iβ β iβ) :
Collinear k ({p iβ, p iβ, p iβ} : Set P) β Β¬AffineIndependent k p :=
(affineIndependent_iff_not_collinear_of_ne hββ hββ hββ).not_left.symm
#align collinear_iff_not_affine_independent_of_ne collinear_iff_not_affineIndependent_of_ne
theorem neββ_of_not_collinear {pβ pβ pβ : P} (h : Β¬Collinear k ({pβ, pβ, pβ} : Set P)) :
pβ β pβ := by
rintro rfl
simp [collinear_pair] at h
#align neββ_of_not_collinear neββ_of_not_collinear
theorem neββ_of_not_collinear {pβ pβ pβ : P} (h : Β¬Collinear k ({pβ, pβ, pβ} : Set P)) :
pβ β pβ := by
rintro rfl
simp [collinear_pair] at h
#align neββ_of_not_collinear neββ_of_not_collinear
theorem neββ_of_not_collinear {pβ pβ pβ : P} (h : Β¬Collinear k ({pβ, pβ, pβ} : Set P)) :
pβ β pβ := by
rintro rfl
simp [collinear_pair] at h
#align neββ_of_not_collinear neββ_of_not_collinear
theorem Collinear.mem_affineSpan_of_mem_of_ne {s : Set P} (h : Collinear k s) {pβ pβ pβ : P}
(hpβ : pβ β s) (hpβ : pβ β s) (hpβ : pβ β s) (hpβpβ : pβ β pβ) : pβ β line[k, pβ, pβ] := by
rw [collinear_iff_of_mem hpβ] at h
rcases h with β¨v, hβ©
rcases h pβ hpβ with β¨rβ, rflβ©
rcases h pβ hpβ with β¨rβ, rflβ©
rw [vadd_left_mem_affineSpan_pair]
refine β¨rβ / rβ, ?_β©
have hβ : rβ β 0 := by
rintro rfl
simp at hpβpβ
simp [smul_smul, hβ]
#align collinear.mem_affine_span_of_mem_of_ne Collinear.mem_affineSpan_of_mem_of_ne
theorem Collinear.affineSpan_eq_of_ne {s : Set P} (h : Collinear k s) {pβ pβ : P} (hpβ : pβ β s)
(hpβ : pβ β s) (hpβpβ : pβ β pβ) : line[k, pβ, pβ] = affineSpan k s :=
le_antisymm (affineSpan_mono _ (Set.insert_subset_iff.2 β¨hpβ, Set.singleton_subset_iff.2 hpββ©))
(affineSpan_le.2 fun _ hp => h.mem_affineSpan_of_mem_of_ne hpβ hpβ hp hpβpβ)
#align collinear.affine_span_eq_of_ne Collinear.affineSpan_eq_of_ne
theorem Collinear.collinear_insert_iff_of_ne {s : Set P} (h : Collinear k s) {pβ pβ pβ : P}
(hpβ : pβ β s) (hpβ : pβ β s) (hpβpβ : pβ β pβ) :
Collinear k (insert pβ s) β Collinear k ({pβ, pβ, pβ} : Set P) := by
have hv : vectorSpan k (insert pβ s) = vectorSpan k ({pβ, pβ, pβ} : Set P) := by
-- Porting note: Original proof used `conv_lhs` and `conv_rhs`, but these tactics timed out.
rw [β direction_affineSpan, β affineSpan_insert_affineSpan]
symm
rw [β direction_affineSpan, β affineSpan_insert_affineSpan, h.affineSpan_eq_of_ne hpβ hpβ hpβpβ]
rw [Collinear, Collinear, hv]
#align collinear.collinear_insert_iff_of_ne Collinear.collinear_insert_iff_of_ne
theorem collinear_insert_iff_of_mem_affineSpan {s : Set P} {p : P} (h : p β affineSpan k s) :
Collinear k (insert p s) β Collinear k s := by
rw [Collinear, Collinear, vectorSpan_insert_eq_vectorSpan h]
#align collinear_insert_iff_of_mem_affine_span collinear_insert_iff_of_mem_affineSpan
| Mathlib/LinearAlgebra/AffineSpace/FiniteDimensional.lean | 620 | 623 | theorem collinear_insert_of_mem_affineSpan_pair {pβ pβ pβ : P} (h : pβ β line[k, pβ, pβ]) :
Collinear k ({pβ, pβ, pβ} : Set P) := by |
rw [collinear_insert_iff_of_mem_affineSpan h]
exact collinear_pair _ _ _
|
import Mathlib.Algebra.Order.Invertible
import Mathlib.Algebra.Order.Module.OrderedSMul
import Mathlib.LinearAlgebra.AffineSpace.Midpoint
import Mathlib.LinearAlgebra.Ray
import Mathlib.Tactic.GCongr
#align_import analysis.convex.segment from "leanprover-community/mathlib"@"c5773405394e073885e2a144c9ca14637e8eb963"
variable {π E F G ΞΉ : Type*} {Ο : ΞΉ β Type*}
open Function Set
open Pointwise Convex
section OrderedSemiring
variable [OrderedSemiring π] [AddCommMonoid E]
open Convex
open Convex
section OrderedRing
variable (π) [OrderedRing π] [AddCommGroup E] [AddCommGroup F] [AddCommGroup G] [Module π E]
[Module π F]
| Mathlib/Analysis/Convex/Segment.lean | 308 | 313 | theorem sameRay_of_mem_segment [StrictOrderedCommRing π] [AddCommGroup E] [Module π E] {x y z : E}
(h : x β [y -[π] z]) : SameRay π (x - y) (z - x) := by |
rw [segment_eq_image'] at h
rcases h with β¨ΞΈ, β¨hΞΈβ, hΞΈββ©, rflβ©
simpa only [add_sub_cancel_left, β sub_sub, sub_smul, one_smul] using
(SameRay.sameRay_nonneg_smul_left (z - y) hΞΈβ).nonneg_smul_right (sub_nonneg.2 hΞΈβ)
|
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open scoped Classical MeasureTheory NNReal ENNReal
open TopologicalSpace MeasureTheory.Measure
noncomputable section
namespace MeasureTheory
variable {Ξ© E : Type*} [MeasurableSpace E]
class HasPDF {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) : Prop where
pdf' : AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ
#align measure_theory.has_pdf MeasureTheory.HasPDF
section HasPDF
variable {_ : MeasurableSpace Ξ©}
theorem hasPDF_iff {X : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E} :
HasPDF X β ΞΌ β AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ :=
β¨@HasPDF.pdf' _ _ _ _ _ _ _, HasPDF.mkβ©
#align measure_theory.pdf.has_pdf_iff MeasureTheory.hasPDF_iff
theorem hasPDF_iff_of_aemeasurable {X : Ξ© β E} {β : Measure Ξ©}
{ΞΌ : Measure E} (hX : AEMeasurable X β) :
HasPDF X β ΞΌ β (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ := by
rw [hasPDF_iff]
simp only [hX, true_and]
#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.hasPDF_iff_of_aemeasurable
@[measurability]
theorem HasPDF.aemeasurable (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E) [hX : HasPDF X β ΞΌ] : AEMeasurable X β :=
hX.pdf'.1
#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.aemeasurable
instance HasPDF.haveLebesgueDecomposition {X : Ξ© β E} {β : Measure Ξ©}
{ΞΌ : Measure E} [hX : HasPDF X β ΞΌ] : (map X β).HaveLebesgueDecomposition ΞΌ :=
hX.pdf'.2.1
#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.HasPDF.haveLebesgueDecomposition
theorem HasPDF.absolutelyContinuous {X : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E}
[hX : HasPDF X β ΞΌ] : map X β βͺ ΞΌ :=
hX.pdf'.2.2
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.HasPDF.absolutelyContinuous
theorem HasPDF.quasiMeasurePreserving_of_measurable (X : Ξ© β E) (β : Measure Ξ©) (ΞΌ : Measure E)
[HasPDF X β ΞΌ] (h : Measurable X) : QuasiMeasurePreserving X β ΞΌ :=
{ measurable := h
absolutelyContinuous := HasPDF.absolutelyContinuous }
#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable
theorem HasPDF.congr {X Y : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E} (hXY : X =α΅[β] Y)
[hX : HasPDF X β ΞΌ] : HasPDF Y β ΞΌ :=
β¨(HasPDF.aemeasurable X β ΞΌ).congr hXY, β.map_congr hXY βΈ hX.haveLebesgueDecomposition,
β.map_congr hXY βΈ hX.absolutelyContinuousβ©
theorem HasPDF.congr' {X Y : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E} (hXY : X =α΅[β] Y) :
HasPDF X β ΞΌ β HasPDF Y β ΞΌ :=
β¨fun _ β¦ HasPDF.congr hXY, fun _ β¦ HasPDF.congr hXY.symmβ©
| Mathlib/Probability/Density.lean | 122 | 128 | theorem hasPDF_of_map_eq_withDensity {X : Ξ© β E} {β : Measure Ξ©} {ΞΌ : Measure E}
(hX : AEMeasurable X β) (f : E β ββ₯0β) (hf : AEMeasurable f ΞΌ) (h : map X β = ΞΌ.withDensity f) :
HasPDF X β ΞΌ := by |
refine β¨hX, ?_, ?_β© <;> rw [h]
Β· rw [withDensity_congr_ae hf.ae_eq_mk]
exact haveLebesgueDecomposition_withDensity ΞΌ hf.measurable_mk
Β· exact withDensity_absolutelyContinuous ΞΌ f
|
import Batteries.Classes.Order
import Batteries.Control.ForInStep.Basic
namespace Batteries
namespace BinomialHeap
namespace Imp
inductive HeapNode (Ξ± : Type u) where
| nil : HeapNode Ξ±
| node (a : Ξ±) (child sibling : HeapNode Ξ±) : HeapNode Ξ±
deriving Repr
@[simp] def HeapNode.realSize : HeapNode Ξ± β Nat
| .nil => 0
| .node _ c s => c.realSize + 1 + s.realSize
def HeapNode.singleton (a : Ξ±) : HeapNode Ξ± := .node a .nil .nil
def HeapNode.rank : HeapNode Ξ± β Nat
| .nil => 0
| .node _ _ s => s.rank + 1
@[inline] private def HeapNode.rankTR (s : HeapNode Ξ±) : Nat := go s 0 where
go : HeapNode Ξ± β Nat β Nat
| .nil, r => r
| .node _ _ s, r => go s (r + 1)
@[csimp] private theorem HeapNode.rankTR_eq : @rankTR = @rank := by
funext Ξ± s; exact go s 0
where
go {Ξ±} : β s n, @rankTR.go Ξ± s n = rank s + n
| .nil, _ => (Nat.zero_add ..).symm
| .node .., _ => by simp_arith only [rankTR.go, go, rank]
inductive Heap (Ξ± : Type u) where
| nil : Heap Ξ±
| cons (rank : Nat) (val : Ξ±) (node : HeapNode Ξ±) (next : Heap Ξ±) : Heap Ξ±
deriving Repr
@[simp] def Heap.realSize : Heap Ξ± β Nat
| .nil => 0
| .cons _ _ c s => c.realSize + 1 + s.realSize
def Heap.size : Heap Ξ± β Nat
| .nil => 0
| .cons r _ _ s => 1 <<< r + s.size
@[inline] def Heap.isEmpty : Heap Ξ± β Bool
| .nil => true
| _ => false
@[inline] def Heap.singleton (a : Ξ±) : Heap Ξ± := .cons 0 a .nil .nil
def Heap.rankGT : Heap Ξ± β Nat β Prop
| .nil, _ => True
| .cons r .., n => n < r
instance : Decidable (Heap.rankGT s n) :=
match s with
| .nil => inferInstanceAs (Decidable True)
| .cons .. => inferInstanceAs (Decidable (_ < _))
@[simp] def Heap.length : Heap Ξ± β Nat
| .nil => 0
| .cons _ _ _ r => r.length + 1
@[inline] def combine (le : Ξ± β Ξ± β Bool) (aβ aβ : Ξ±) (nβ nβ : HeapNode Ξ±) : Ξ± Γ HeapNode Ξ± :=
if le aβ aβ then (aβ, .node aβ nβ nβ) else (aβ, .node aβ nβ nβ)
@[specialize] def Heap.merge (le : Ξ± β Ξ± β Bool) : Heap Ξ± β Heap Ξ± β Heap Ξ±
| .nil, h => h
| h, .nil => h
| sβ@(.cons rβ aβ nβ tβ), sβ@(.cons rβ aβ nβ tβ) =>
if rβ < rβ then .cons rβ aβ nβ (merge le tβ sβ)
else if rβ < rβ then .cons rβ aβ nβ (merge le sβ tβ)
else
let (a, n) := combine le aβ aβ nβ nβ
let r := rβ + 1
if tβ.rankGT r then if tβ.rankGT r
then .cons r a n (merge le tβ tβ)
else merge le (.cons r a n tβ) tβ
else if tβ.rankGT r
then merge le tβ (.cons r a n tβ)
else .cons r a n (merge le tβ tβ)
termination_by sβ sβ => sβ.length + sβ.length
def HeapNode.toHeap (s : HeapNode Ξ±) : Heap Ξ± := go s s.rank .nil where
go : HeapNode Ξ± β Nat β Heap Ξ± β Heap Ξ±
| .nil, _, res => res
| .node a c s, n, res => go s (n - 1) (.cons (n - 1) a c res)
@[specialize] def Heap.headD (le : Ξ± β Ξ± β Bool) (a : Ξ±) : Heap Ξ± β Ξ±
| .nil => a
| .cons _ b _ hs => headD le (if le a b then a else b) hs
@[inline] def Heap.head? (le : Ξ± β Ξ± β Bool) : Heap Ξ± β Option Ξ±
| .nil => none
| .cons _ h _ hs => some <| headD le h hs
structure FindMin (Ξ±) where
before : Heap Ξ± β Heap Ξ± := id
val : Ξ±
node : HeapNode Ξ±
next : Heap Ξ±
@[specialize] def Heap.findMin (le : Ξ± β Ξ± β Bool) (k : Heap Ξ± β Heap Ξ±) :
Heap Ξ± β FindMin Ξ± β FindMin Ξ±
| .nil, res => res
| .cons r a c s, res =>
-- It is important that we check `le res.val a` here, not the other way
-- around. This ensures that head? and findMin find the same element even
-- when we have `le res.val a` and `le a res.val` (i.e. le is not antisymmetric).
findMin le (k β .cons r a c) s <| if le res.val a then res else β¨k, a, c, sβ©
def Heap.deleteMin (le : Ξ± β Ξ± β Bool) : Heap Ξ± β Option (Ξ± Γ Heap Ξ±)
| .nil => none
| .cons r a c s =>
let { before, val, node, next } := findMin le (.cons r a c) s β¨id, a, c, sβ©
some (val, node.toHeap.merge le (before next))
@[inline] def Heap.tail? (le : Ξ± β Ξ± β Bool) (h : Heap Ξ±) : Option (Heap Ξ±) :=
deleteMin le h |>.map (Β·.snd)
@[inline] def Heap.tail (le : Ξ± β Ξ± β Bool) (h : Heap Ξ±) : Heap Ξ± := tail? le h |>.getD .nil
theorem Heap.realSize_merge (le) (sβ sβ : Heap Ξ±) :
(sβ.merge le sβ).realSize = sβ.realSize + sβ.realSize := by
unfold merge; split
Β· simp
Β· simp
Β· next rβ aβ nβ tβ rβ aβ nβ tβ =>
have IHβ r a n := realSize_merge le tβ (cons r a n tβ)
have IHβ r a n := realSize_merge le (cons r a n tβ) tβ
have IHβ := realSize_merge le tβ tβ
split; Β· simp [IHβ, Nat.add_assoc]
split; Β· simp [IHβ, Nat.add_assoc, Nat.add_left_comm]
split; simp only; rename_i a n eq
have : n.realSize = nβ.realSize + 1 + nβ.realSize := by
rw [combine] at eq; split at eq <;> cases eq <;>
simp [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm]
split <;> split <;> simp [IHβ, IHβ, IHβ, this, Nat.add_assoc, Nat.add_left_comm]
termination_by sβ.length + sβ.length
private def FindMin.HasSize (res : FindMin Ξ±) (n : Nat) : Prop :=
β m,
(β s, (res.before s).realSize = m + s.realSize) β§
n = m + res.node.realSize + res.next.realSize + 1
private theorem Heap.realSize_findMin {s : Heap Ξ±}
(m) (hk : β s, (k s).realSize = m + s.realSize)
(eq : n = m + s.realSize) (hres : res.HasSize n) :
(s.findMin le k res).HasSize n :=
match s with
| .nil => hres
| .cons r a c s => by
simp [findMin]
refine realSize_findMin (m + c.realSize + 1)
(by simp [hk, Nat.add_assoc]) (by simp [eq, Nat.add_assoc]) ?_
split
Β· exact hres
Β· exact β¨m, hk, by simp [eq, Nat.add_assoc, Nat.add_comm, Nat.add_left_comm]β©
theorem HeapNode.realSize_toHeap (s : HeapNode Ξ±) : s.toHeap.realSize = s.realSize := go s where
go {n res} : β s : HeapNode Ξ±, (toHeap.go s n res).realSize = s.realSize + res.realSize
| .nil => (Nat.zero_add _).symm
| .node a c s => by simp [toHeap.go, go, Nat.add_assoc, Nat.add_left_comm]
theorem Heap.realSize_deleteMin {s : Heap Ξ±} (eq : s.deleteMin le = some (a, s')) :
s.realSize = s'.realSize + 1 := by
cases s with cases eq | cons r a c s => ?_
have : (s.findMin le (cons r a c) β¨id, a, c, sβ©).HasSize (c.realSize + s.realSize + 1) :=
Heap.realSize_findMin (c.realSize + 1) (by simp) (Nat.add_right_comm ..) β¨0, by simpβ©
revert this
match s.findMin le (cons r a c) β¨id, a, c, sβ© with
| { before, val, node, next } =>
intro β¨m, ihβ, ihββ©; dsimp only at ihβ ihβ
rw [realSize, Nat.add_right_comm, ihβ]
simp only [realSize_merge, HeapNode.realSize_toHeap, ihβ, Nat.add_assoc, Nat.add_left_comm]
| .lake/packages/batteries/Batteries/Data/BinomialHeap/Basic.lean | 259 | 263 | theorem Heap.realSize_tail? {s : Heap Ξ±} : s.tail? le = some s' β
s.realSize = s'.realSize + 1 := by |
simp only [Heap.tail?]; intro eq
match eqβ : s.deleteMin le, eq with
| some (a, tl), rfl => exact realSize_deleteMin eqβ
|
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Factorial.DoubleFactorial
#align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74"
noncomputable section
open Polynomial
namespace Polynomial
noncomputable def hermite : β β Polynomial β€
| 0 => 1
| n + 1 => X * hermite n - derivative (hermite n)
#align polynomial.hermite Polynomial.hermite
@[simp]
theorem hermite_succ (n : β) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by
rw [hermite]
#align polynomial.hermite_succ Polynomial.hermite_succ
theorem hermite_eq_iterate (n : β) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by
induction' n with n ih
Β· rfl
Β· rw [Function.iterate_succ_apply', β ih, hermite_succ]
#align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate
@[simp]
theorem hermite_zero : hermite 0 = C 1 :=
rfl
#align polynomial.hermite_zero Polynomial.hermite_zero
-- Porting note (#10618): There was initially @[simp] on this line but it was removed
-- because simp can prove this theorem
theorem hermite_one : hermite 1 = X := by
rw [hermite_succ, hermite_zero]
simp only [map_one, mul_one, derivative_one, sub_zero]
#align polynomial.hermite_one Polynomial.hermite_one
section coeff
theorem coeff_hermite_succ_zero (n : β) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by
simp [coeff_derivative]
#align polynomial.coeff_hermite_succ_zero Polynomial.coeff_hermite_succ_zero
theorem coeff_hermite_succ_succ (n k : β) : coeff (hermite (n + 1)) (k + 1) =
coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) := by
rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm]
norm_cast
#align polynomial.coeff_hermite_succ_succ Polynomial.coeff_hermite_succ_succ
theorem coeff_hermite_of_lt {n k : β} (hnk : n < k) : coeff (hermite n) k = 0 := by
obtain β¨k, rflβ© := Nat.exists_eq_add_of_lt hnk
clear hnk
induction' n with n ih generalizing k
Β· apply coeff_C
Β· have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring
rw [coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2),
mul_zero, sub_zero]
#align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt
@[simp]
| Mathlib/RingTheory/Polynomial/Hermite/Basic.lean | 103 | 107 | theorem coeff_hermite_self (n : β) : coeff (hermite n) n = 1 := by |
induction' n with n ih
Β· apply coeff_C
Β· rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero]
simp
|
import Mathlib.Tactic.Linarith
import Mathlib.CategoryTheory.Skeletal
import Mathlib.Data.Fintype.Sort
import Mathlib.Order.Category.NonemptyFinLinOrd
import Mathlib.CategoryTheory.Functor.ReflectsIso
#align_import algebraic_topology.simplex_category from "leanprover-community/mathlib"@"e8ac6315bcfcbaf2d19a046719c3b553206dac75"
universe v
open CategoryTheory CategoryTheory.Limits
def SimplexCategory :=
β
#align simplex_category SimplexCategory
namespace SimplexCategory
section
-- Porting note: the definition of `SimplexCategory` is made irreducible below
def mk (n : β) : SimplexCategory :=
n
#align simplex_category.mk SimplexCategory.mk
scoped[Simplicial] notation "[" n "]" => SimplexCategory.mk n
-- TODO: Make `len` irreducible.
def len (n : SimplexCategory) : β :=
n
#align simplex_category.len SimplexCategory.len
@[ext]
theorem ext (a b : SimplexCategory) : a.len = b.len β a = b :=
id
#align simplex_category.ext SimplexCategory.ext
attribute [irreducible] SimplexCategory
open Simplicial
@[simp]
theorem len_mk (n : β) : [n].len = n :=
rfl
#align simplex_category.len_mk SimplexCategory.len_mk
@[simp]
theorem mk_len (n : SimplexCategory) : ([n.len] : SimplexCategory) = n :=
rfl
#align simplex_category.mk_len SimplexCategory.mk_len
protected def rec {F : SimplexCategory β Sort*} (h : β n : β, F [n]) : β X, F X := fun n =>
h n.len
#align simplex_category.rec SimplexCategory.rec
-- porting note (#5171): removed @[nolint has_nonempty_instance]
protected def Hom (a b : SimplexCategory) :=
Fin (a.len + 1) βo Fin (b.len + 1)
#align simplex_category.hom SimplexCategory.Hom
instance smallCategory : SmallCategory.{0} SimplexCategory where
Hom n m := SimplexCategory.Hom n m
id m := SimplexCategory.Hom.id _
comp f g := SimplexCategory.Hom.comp g f
#align simplex_category.small_category SimplexCategory.smallCategory
@[simp]
lemma id_toOrderHom (a : SimplexCategory) :
Hom.toOrderHom (π a) = OrderHom.id := rfl
@[simp]
lemma comp_toOrderHom {a b c: SimplexCategory} (f : a βΆ b) (g : b βΆ c) :
(f β« g).toOrderHom = g.toOrderHom.comp f.toOrderHom := rfl
-- Porting note: added because `Hom.ext'` is not triggered automatically
@[ext]
theorem Hom.ext {a b : SimplexCategory} (f g : a βΆ b) :
f.toOrderHom = g.toOrderHom β f = g :=
Hom.ext' _ _
def const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x βΆ y :=
Hom.mk <| β¨fun _ => i, by tautoβ©
#align simplex_category.const SimplexCategory.const
@[simp]
lemma const_eq_id : const [0] [0] 0 = π _ := by aesop
@[simp]
lemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :
(const x y i).toOrderHom a = i := rfl
@[simp]
theorem const_comp (x : SimplexCategory) {y z : SimplexCategory}
(f : y βΆ z) (i : Fin (y.len + 1)) :
const x y i β« f = const x z (f.toOrderHom i) :=
rfl
#align simplex_category.const_comp SimplexCategory.const_comp
@[simp]
def mkHom {n m : β} (f : Fin (n + 1) βo Fin (m + 1)) : ([n] : SimplexCategory) βΆ [m] :=
SimplexCategory.Hom.mk f
#align simplex_category.mk_hom SimplexCategory.mkHom
theorem hom_zero_zero (f : ([0] : SimplexCategory) βΆ [0]) : f = π _ := by
ext : 3
apply @Subsingleton.elim (Fin 1)
#align simplex_category.hom_zero_zero SimplexCategory.hom_zero_zero
end
open Simplicial
section Skeleton
@[simps obj map]
def skeletalFunctor : SimplexCategory β₯€ NonemptyFinLinOrd where
obj a := NonemptyFinLinOrd.of (Fin (a.len + 1))
map f := f.toOrderHom
#align simplex_category.skeletal_functor SimplexCategory.skeletalFunctor
theorem skeletalFunctor.coe_map {Ξβ Ξβ : SimplexCategory} (f : Ξβ βΆ Ξβ) :
β(skeletalFunctor.map f) = f.toOrderHom :=
rfl
#align simplex_category.skeletal_functor.coe_map SimplexCategory.skeletalFunctor.coe_map
theorem skeletal : Skeletal SimplexCategory := fun X Y β¨Iβ© => by
suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
ext
simpa
apply Fintype.card_congr
exact ((skeletalFunctor β forget NonemptyFinLinOrd).mapIso I).toEquiv
#align simplex_category.skeletal SimplexCategory.skeletal
lemma isSkeletonOf :
IsSkeletonOf NonemptyFinLinOrd SimplexCategory skeletalFunctor where
skel := skeletal
eqv := SkeletalFunctor.isEquivalence
#align simplex_category.is_skeleton_of SimplexCategory.isSkeletonOf
def Truncated (n : β) :=
FullSubcategory fun a : SimplexCategory => a.len β€ n
#align simplex_category.truncated SimplexCategory.Truncated
instance (n : β) : SmallCategory.{0} (Truncated n) :=
FullSubcategory.category _
section EpiMono
theorem mono_iff_injective {n m : SimplexCategory} {f : n βΆ m} :
Mono f β Function.Injective f.toOrderHom := by
rw [β Functor.mono_map_iff_mono skeletalEquivalence.functor]
dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
simp only [skeletalFunctor_obj, skeletalFunctor_map,
NonemptyFinLinOrd.mono_iff_injective, NonemptyFinLinOrd.coe_of]
#align simplex_category.mono_iff_injective SimplexCategory.mono_iff_injective
theorem epi_iff_surjective {n m : SimplexCategory} {f : n βΆ m} :
Epi f β Function.Surjective f.toOrderHom := by
rw [β Functor.epi_map_iff_epi skeletalEquivalence.functor]
dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
simp only [skeletalFunctor_obj, skeletalFunctor_map,
NonemptyFinLinOrd.epi_iff_surjective, NonemptyFinLinOrd.coe_of]
#align simplex_category.epi_iff_surjective SimplexCategory.epi_iff_surjective
theorem len_le_of_mono {x y : SimplexCategory} {f : x βΆ y} : Mono f β x.len β€ y.len := by
intro hyp_f_mono
have f_inj : Function.Injective f.toOrderHom.toFun := mono_iff_injective.1 hyp_f_mono
simpa using Fintype.card_le_of_injective f.toOrderHom.toFun f_inj
#align simplex_category.len_le_of_mono SimplexCategory.len_le_of_mono
theorem le_of_mono {n m : β} {f : ([n] : SimplexCategory) βΆ [m]} : CategoryTheory.Mono f β n β€ m :=
len_le_of_mono
#align simplex_category.le_of_mono SimplexCategory.le_of_mono
theorem len_le_of_epi {x y : SimplexCategory} {f : x βΆ y} : Epi f β y.len β€ x.len := by
intro hyp_f_epi
have f_surj : Function.Surjective f.toOrderHom.toFun := epi_iff_surjective.1 hyp_f_epi
simpa using Fintype.card_le_of_surjective f.toOrderHom.toFun f_surj
#align simplex_category.len_le_of_epi SimplexCategory.len_le_of_epi
theorem le_of_epi {n m : β} {f : ([n] : SimplexCategory) βΆ [m]} : Epi f β m β€ n :=
len_le_of_epi
#align simplex_category.le_of_epi SimplexCategory.le_of_epi
instance {n : β} {i : Fin (n + 2)} : Mono (Ξ΄ i) := by
rw [mono_iff_injective]
exact Fin.succAbove_right_injective
instance {n : β} {i : Fin (n + 1)} : Epi (Ο i) := by
rw [epi_iff_surjective]
intro b
simp only [Ο, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
by_cases h : b β€ i
Β· use b
-- This was not needed before leanprover/lean4#2644
dsimp
rw [Fin.predAbove_of_le_castSucc i b (by simpa only [Fin.coe_eq_castSucc] using h)]
simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
Β· use b.succ
-- This was not needed before leanprover/lean4#2644
dsimp
rw [Fin.predAbove_of_castSucc_lt i b.succ _, Fin.pred_succ]
rw [not_le] at h
rw [Fin.lt_iff_val_lt_val] at h β’
simpa only [Fin.val_succ, Fin.coe_castSucc] using Nat.lt.step h
instance : (forget SimplexCategory).ReflectsIsomorphisms :=
β¨fun f hf =>
Iso.isIso_hom
{ hom := f
inv := Hom.mk
{ toFun := inv ((forget SimplexCategory).map f)
monotone' := fun yβ yβ h => by
by_cases h' : yβ < yβ
Β· by_contra h''
apply not_le.mpr h'
convert f.toOrderHom.monotone (le_of_not_ge h'')
all_goals
exact (congr_hom (Iso.inv_hom_id
(asIso ((forget SimplexCategory).map f))) _).symm
Β· rw [eq_of_le_of_not_lt h h'] }
hom_inv_id := by
ext1
ext1
exact Iso.hom_inv_id (asIso ((forget _).map f))
inv_hom_id := by
ext1
ext1
exact Iso.inv_hom_id (asIso ((forget _).map f)) }β©
theorem isIso_of_bijective {x y : SimplexCategory} {f : x βΆ y}
(hf : Function.Bijective f.toOrderHom.toFun) : IsIso f :=
haveI : IsIso ((forget SimplexCategory).map f) := (isIso_iff_bijective _).mpr hf
isIso_of_reflects_iso f (forget SimplexCategory)
#align simplex_category.is_iso_of_bijective SimplexCategory.isIso_of_bijective
@[simp]
def orderIsoOfIso {x y : SimplexCategory} (e : x β
y) : Fin (x.len + 1) βo Fin (y.len + 1) :=
Equiv.toOrderIso
{ toFun := e.hom.toOrderHom
invFun := e.inv.toOrderHom
left_inv := fun i => by
simpa only using congr_arg (fun Ο => (Hom.toOrderHom Ο) i) e.hom_inv_id
right_inv := fun i => by
simpa only using congr_arg (fun Ο => (Hom.toOrderHom Ο) i) e.inv_hom_id }
e.hom.toOrderHom.monotone e.inv.toOrderHom.monotone
#align simplex_category.order_iso_of_iso SimplexCategory.orderIsoOfIso
| Mathlib/AlgebraicTopology/SimplexCategory.lean | 658 | 668 | theorem iso_eq_iso_refl {x : SimplexCategory} (e : x β
x) : e = Iso.refl x := by |
have h : (Finset.univ : Finset (Fin (x.len + 1))).card = x.len + 1 := Finset.card_fin (x.len + 1)
have eqβ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
have eqβ :=
Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
-- Porting note: the proof was rewritten from this point in #3414 (reenableeta)
-- It could be investigated again to see if the original can be restored.
ext x
replace eqβ := congr_arg (Β· x) eqβ
replace eqβ := congr_arg (Β· x) eqβ.symm
simp_all
|
import Mathlib.Algebra.ModEq
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Algebra.Periodic
import Mathlib.Data.Int.SuccPred
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.Order.Circular
import Mathlib.Data.List.TFAE
import Mathlib.Data.Set.Lattice
#align_import algebra.order.to_interval_mod from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
section LinearOrderedAddCommGroup
variable {Ξ± : Type*} [LinearOrderedAddCommGroup Ξ±] [hΞ± : Archimedean Ξ±] {p : Ξ±} (hp : 0 < p)
{a b c : Ξ±} {n : β€}
def toIcoDiv (a b : Ξ±) : β€ :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose
#align to_Ico_div toIcoDiv
theorem sub_toIcoDiv_zsmul_mem_Ico (a b : Ξ±) : b - toIcoDiv hp a b β’ p β Set.Ico a (a + p) :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.1
#align sub_to_Ico_div_zsmul_mem_Ico sub_toIcoDiv_zsmul_mem_Ico
theorem toIcoDiv_eq_of_sub_zsmul_mem_Ico (h : b - n β’ p β Set.Ico a (a + p)) :
toIcoDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.2 _ h).symm
#align to_Ico_div_eq_of_sub_zsmul_mem_Ico toIcoDiv_eq_of_sub_zsmul_mem_Ico
def toIocDiv (a b : Ξ±) : β€ :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose
#align to_Ioc_div toIocDiv
theorem sub_toIocDiv_zsmul_mem_Ioc (a b : Ξ±) : b - toIocDiv hp a b β’ p β Set.Ioc a (a + p) :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.1
#align sub_to_Ioc_div_zsmul_mem_Ioc sub_toIocDiv_zsmul_mem_Ioc
theorem toIocDiv_eq_of_sub_zsmul_mem_Ioc (h : b - n β’ p β Set.Ioc a (a + p)) :
toIocDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.2 _ h).symm
#align to_Ioc_div_eq_of_sub_zsmul_mem_Ioc toIocDiv_eq_of_sub_zsmul_mem_Ioc
def toIcoMod (a b : Ξ±) : Ξ± :=
b - toIcoDiv hp a b β’ p
#align to_Ico_mod toIcoMod
def toIocMod (a b : Ξ±) : Ξ± :=
b - toIocDiv hp a b β’ p
#align to_Ioc_mod toIocMod
theorem toIcoMod_mem_Ico (a b : Ξ±) : toIcoMod hp a b β Set.Ico a (a + p) :=
sub_toIcoDiv_zsmul_mem_Ico hp a b
#align to_Ico_mod_mem_Ico toIcoMod_mem_Ico
theorem toIcoMod_mem_Ico' (b : Ξ±) : toIcoMod hp 0 b β Set.Ico 0 p := by
convert toIcoMod_mem_Ico hp 0 b
exact (zero_add p).symm
#align to_Ico_mod_mem_Ico' toIcoMod_mem_Ico'
theorem toIocMod_mem_Ioc (a b : Ξ±) : toIocMod hp a b β Set.Ioc a (a + p) :=
sub_toIocDiv_zsmul_mem_Ioc hp a b
#align to_Ioc_mod_mem_Ioc toIocMod_mem_Ioc
theorem left_le_toIcoMod (a b : Ξ±) : a β€ toIcoMod hp a b :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).1
#align left_le_to_Ico_mod left_le_toIcoMod
theorem left_lt_toIocMod (a b : Ξ±) : a < toIocMod hp a b :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).1
#align left_lt_to_Ioc_mod left_lt_toIocMod
theorem toIcoMod_lt_right (a b : Ξ±) : toIcoMod hp a b < a + p :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).2
#align to_Ico_mod_lt_right toIcoMod_lt_right
theorem toIocMod_le_right (a b : Ξ±) : toIocMod hp a b β€ a + p :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).2
#align to_Ioc_mod_le_right toIocMod_le_right
@[simp]
theorem self_sub_toIcoDiv_zsmul (a b : Ξ±) : b - toIcoDiv hp a b β’ p = toIcoMod hp a b :=
rfl
#align self_sub_to_Ico_div_zsmul self_sub_toIcoDiv_zsmul
@[simp]
theorem self_sub_toIocDiv_zsmul (a b : Ξ±) : b - toIocDiv hp a b β’ p = toIocMod hp a b :=
rfl
#align self_sub_to_Ioc_div_zsmul self_sub_toIocDiv_zsmul
@[simp]
theorem toIcoDiv_zsmul_sub_self (a b : Ξ±) : toIcoDiv hp a b β’ p - b = -toIcoMod hp a b := by
rw [toIcoMod, neg_sub]
#align to_Ico_div_zsmul_sub_self toIcoDiv_zsmul_sub_self
@[simp]
theorem toIocDiv_zsmul_sub_self (a b : Ξ±) : toIocDiv hp a b β’ p - b = -toIocMod hp a b := by
rw [toIocMod, neg_sub]
#align to_Ioc_div_zsmul_sub_self toIocDiv_zsmul_sub_self
@[simp]
theorem toIcoMod_sub_self (a b : Ξ±) : toIcoMod hp a b - b = -toIcoDiv hp a b β’ p := by
rw [toIcoMod, sub_sub_cancel_left, neg_smul]
#align to_Ico_mod_sub_self toIcoMod_sub_self
@[simp]
theorem toIocMod_sub_self (a b : Ξ±) : toIocMod hp a b - b = -toIocDiv hp a b β’ p := by
rw [toIocMod, sub_sub_cancel_left, neg_smul]
#align to_Ioc_mod_sub_self toIocMod_sub_self
@[simp]
theorem self_sub_toIcoMod (a b : Ξ±) : b - toIcoMod hp a b = toIcoDiv hp a b β’ p := by
rw [toIcoMod, sub_sub_cancel]
#align self_sub_to_Ico_mod self_sub_toIcoMod
@[simp]
theorem self_sub_toIocMod (a b : Ξ±) : b - toIocMod hp a b = toIocDiv hp a b β’ p := by
rw [toIocMod, sub_sub_cancel]
#align self_sub_to_Ioc_mod self_sub_toIocMod
@[simp]
theorem toIcoMod_add_toIcoDiv_zsmul (a b : Ξ±) : toIcoMod hp a b + toIcoDiv hp a b β’ p = b := by
rw [toIcoMod, sub_add_cancel]
#align to_Ico_mod_add_to_Ico_div_zsmul toIcoMod_add_toIcoDiv_zsmul
@[simp]
theorem toIocMod_add_toIocDiv_zsmul (a b : Ξ±) : toIocMod hp a b + toIocDiv hp a b β’ p = b := by
rw [toIocMod, sub_add_cancel]
#align to_Ioc_mod_add_to_Ioc_div_zsmul toIocMod_add_toIocDiv_zsmul
@[simp]
theorem toIcoDiv_zsmul_sub_toIcoMod (a b : Ξ±) : toIcoDiv hp a b β’ p + toIcoMod hp a b = b := by
rw [add_comm, toIcoMod_add_toIcoDiv_zsmul]
#align to_Ico_div_zsmul_sub_to_Ico_mod toIcoDiv_zsmul_sub_toIcoMod
@[simp]
theorem toIocDiv_zsmul_sub_toIocMod (a b : Ξ±) : toIocDiv hp a b β’ p + toIocMod hp a b = b := by
rw [add_comm, toIocMod_add_toIocDiv_zsmul]
#align to_Ioc_div_zsmul_sub_to_Ioc_mod toIocDiv_zsmul_sub_toIocMod
theorem toIcoMod_eq_iff : toIcoMod hp a b = c β c β Set.Ico a (a + p) β§ β z : β€, b = c + z β’ p := by
refine
β¨fun h =>
β¨h βΈ toIcoMod_mem_Ico hp a b, toIcoDiv hp a b, h βΈ (toIcoMod_add_toIcoDiv_zsmul _ _ _).symmβ©,
?_β©
simp_rw [β @sub_eq_iff_eq_add]
rintro β¨hc, n, rflβ©
rw [β toIcoDiv_eq_of_sub_zsmul_mem_Ico hp hc, toIcoMod]
#align to_Ico_mod_eq_iff toIcoMod_eq_iff
theorem toIocMod_eq_iff : toIocMod hp a b = c β c β Set.Ioc a (a + p) β§ β z : β€, b = c + z β’ p := by
refine
β¨fun h =>
β¨h βΈ toIocMod_mem_Ioc hp a b, toIocDiv hp a b, h βΈ (toIocMod_add_toIocDiv_zsmul hp _ _).symmβ©,
?_β©
simp_rw [β @sub_eq_iff_eq_add]
rintro β¨hc, n, rflβ©
rw [β toIocDiv_eq_of_sub_zsmul_mem_Ioc hp hc, toIocMod]
#align to_Ioc_mod_eq_iff toIocMod_eq_iff
@[simp]
theorem toIcoDiv_apply_left (a : Ξ±) : toIcoDiv hp a a = 0 :=
toIcoDiv_eq_of_sub_zsmul_mem_Ico hp <| by simp [hp]
#align to_Ico_div_apply_left toIcoDiv_apply_left
@[simp]
theorem toIocDiv_apply_left (a : Ξ±) : toIocDiv hp a a = -1 :=
toIocDiv_eq_of_sub_zsmul_mem_Ioc hp <| by simp [hp]
#align to_Ioc_div_apply_left toIocDiv_apply_left
@[simp]
theorem toIcoMod_apply_left (a : Ξ±) : toIcoMod hp a a = a := by
rw [toIcoMod_eq_iff hp, Set.left_mem_Ico]
exact β¨lt_add_of_pos_right _ hp, 0, by simpβ©
#align to_Ico_mod_apply_left toIcoMod_apply_left
@[simp]
theorem toIocMod_apply_left (a : Ξ±) : toIocMod hp a a = a + p := by
rw [toIocMod_eq_iff hp, Set.right_mem_Ioc]
exact β¨lt_add_of_pos_right _ hp, -1, by simpβ©
#align to_Ioc_mod_apply_left toIocMod_apply_left
theorem toIcoDiv_apply_right (a : Ξ±) : toIcoDiv hp a (a + p) = 1 :=
toIcoDiv_eq_of_sub_zsmul_mem_Ico hp <| by simp [hp]
#align to_Ico_div_apply_right toIcoDiv_apply_right
theorem toIocDiv_apply_right (a : Ξ±) : toIocDiv hp a (a + p) = 0 :=
toIocDiv_eq_of_sub_zsmul_mem_Ioc hp <| by simp [hp]
#align to_Ioc_div_apply_right toIocDiv_apply_right
theorem toIcoMod_apply_right (a : Ξ±) : toIcoMod hp a (a + p) = a := by
rw [toIcoMod_eq_iff hp, Set.left_mem_Ico]
exact β¨lt_add_of_pos_right _ hp, 1, by simpβ©
#align to_Ico_mod_apply_right toIcoMod_apply_right
theorem toIocMod_apply_right (a : Ξ±) : toIocMod hp a (a + p) = a + p := by
rw [toIocMod_eq_iff hp, Set.right_mem_Ioc]
exact β¨lt_add_of_pos_right _ hp, 0, by simpβ©
#align to_Ioc_mod_apply_right toIocMod_apply_right
@[simp]
theorem toIcoDiv_add_zsmul (a b : Ξ±) (m : β€) : toIcoDiv hp a (b + m β’ p) = toIcoDiv hp a b + m :=
toIcoDiv_eq_of_sub_zsmul_mem_Ico hp <| by
simpa only [add_smul, add_sub_add_right_eq_sub] using sub_toIcoDiv_zsmul_mem_Ico hp a b
#align to_Ico_div_add_zsmul toIcoDiv_add_zsmul
@[simp]
theorem toIcoDiv_add_zsmul' (a b : Ξ±) (m : β€) :
toIcoDiv hp (a + m β’ p) b = toIcoDiv hp a b - m := by
refine toIcoDiv_eq_of_sub_zsmul_mem_Ico _ ?_
rw [sub_smul, β sub_add, add_right_comm]
simpa using sub_toIcoDiv_zsmul_mem_Ico hp a b
#align to_Ico_div_add_zsmul' toIcoDiv_add_zsmul'
@[simp]
theorem toIocDiv_add_zsmul (a b : Ξ±) (m : β€) : toIocDiv hp a (b + m β’ p) = toIocDiv hp a b + m :=
toIocDiv_eq_of_sub_zsmul_mem_Ioc hp <| by
simpa only [add_smul, add_sub_add_right_eq_sub] using sub_toIocDiv_zsmul_mem_Ioc hp a b
#align to_Ioc_div_add_zsmul toIocDiv_add_zsmul
@[simp]
theorem toIocDiv_add_zsmul' (a b : Ξ±) (m : β€) :
toIocDiv hp (a + m β’ p) b = toIocDiv hp a b - m := by
refine toIocDiv_eq_of_sub_zsmul_mem_Ioc _ ?_
rw [sub_smul, β sub_add, add_right_comm]
simpa using sub_toIocDiv_zsmul_mem_Ioc hp a b
#align to_Ioc_div_add_zsmul' toIocDiv_add_zsmul'
@[simp]
theorem toIcoDiv_zsmul_add (a b : Ξ±) (m : β€) : toIcoDiv hp a (m β’ p + b) = m + toIcoDiv hp a b := by
rw [add_comm, toIcoDiv_add_zsmul, add_comm]
#align to_Ico_div_zsmul_add toIcoDiv_zsmul_add
@[simp]
theorem toIocDiv_zsmul_add (a b : Ξ±) (m : β€) : toIocDiv hp a (m β’ p + b) = m + toIocDiv hp a b := by
rw [add_comm, toIocDiv_add_zsmul, add_comm]
#align to_Ioc_div_zsmul_add toIocDiv_zsmul_add
@[simp]
theorem toIcoDiv_sub_zsmul (a b : Ξ±) (m : β€) : toIcoDiv hp a (b - m β’ p) = toIcoDiv hp a b - m := by
rw [sub_eq_add_neg, β neg_smul, toIcoDiv_add_zsmul, sub_eq_add_neg]
#align to_Ico_div_sub_zsmul toIcoDiv_sub_zsmul
@[simp]
theorem toIcoDiv_sub_zsmul' (a b : Ξ±) (m : β€) :
toIcoDiv hp (a - m β’ p) b = toIcoDiv hp a b + m := by
rw [sub_eq_add_neg, β neg_smul, toIcoDiv_add_zsmul', sub_neg_eq_add]
#align to_Ico_div_sub_zsmul' toIcoDiv_sub_zsmul'
@[simp]
theorem toIocDiv_sub_zsmul (a b : Ξ±) (m : β€) : toIocDiv hp a (b - m β’ p) = toIocDiv hp a b - m := by
rw [sub_eq_add_neg, β neg_smul, toIocDiv_add_zsmul, sub_eq_add_neg]
#align to_Ioc_div_sub_zsmul toIocDiv_sub_zsmul
@[simp]
theorem toIocDiv_sub_zsmul' (a b : Ξ±) (m : β€) :
toIocDiv hp (a - m β’ p) b = toIocDiv hp a b + m := by
rw [sub_eq_add_neg, β neg_smul, toIocDiv_add_zsmul', sub_neg_eq_add]
#align to_Ioc_div_sub_zsmul' toIocDiv_sub_zsmul'
@[simp]
theorem toIcoDiv_add_right (a b : Ξ±) : toIcoDiv hp a (b + p) = toIcoDiv hp a b + 1 := by
simpa only [one_zsmul] using toIcoDiv_add_zsmul hp a b 1
#align to_Ico_div_add_right toIcoDiv_add_right
@[simp]
theorem toIcoDiv_add_right' (a b : Ξ±) : toIcoDiv hp (a + p) b = toIcoDiv hp a b - 1 := by
simpa only [one_zsmul] using toIcoDiv_add_zsmul' hp a b 1
#align to_Ico_div_add_right' toIcoDiv_add_right'
@[simp]
theorem toIocDiv_add_right (a b : Ξ±) : toIocDiv hp a (b + p) = toIocDiv hp a b + 1 := by
simpa only [one_zsmul] using toIocDiv_add_zsmul hp a b 1
#align to_Ioc_div_add_right toIocDiv_add_right
@[simp]
theorem toIocDiv_add_right' (a b : Ξ±) : toIocDiv hp (a + p) b = toIocDiv hp a b - 1 := by
simpa only [one_zsmul] using toIocDiv_add_zsmul' hp a b 1
#align to_Ioc_div_add_right' toIocDiv_add_right'
@[simp]
theorem toIcoDiv_add_left (a b : Ξ±) : toIcoDiv hp a (p + b) = toIcoDiv hp a b + 1 := by
rw [add_comm, toIcoDiv_add_right]
#align to_Ico_div_add_left toIcoDiv_add_left
@[simp]
theorem toIcoDiv_add_left' (a b : Ξ±) : toIcoDiv hp (p + a) b = toIcoDiv hp a b - 1 := by
rw [add_comm, toIcoDiv_add_right']
#align to_Ico_div_add_left' toIcoDiv_add_left'
@[simp]
theorem toIocDiv_add_left (a b : Ξ±) : toIocDiv hp a (p + b) = toIocDiv hp a b + 1 := by
rw [add_comm, toIocDiv_add_right]
#align to_Ioc_div_add_left toIocDiv_add_left
@[simp]
theorem toIocDiv_add_left' (a b : Ξ±) : toIocDiv hp (p + a) b = toIocDiv hp a b - 1 := by
rw [add_comm, toIocDiv_add_right']
#align to_Ioc_div_add_left' toIocDiv_add_left'
@[simp]
theorem toIcoDiv_sub (a b : Ξ±) : toIcoDiv hp a (b - p) = toIcoDiv hp a b - 1 := by
simpa only [one_zsmul] using toIcoDiv_sub_zsmul hp a b 1
#align to_Ico_div_sub toIcoDiv_sub
@[simp]
theorem toIcoDiv_sub' (a b : Ξ±) : toIcoDiv hp (a - p) b = toIcoDiv hp a b + 1 := by
simpa only [one_zsmul] using toIcoDiv_sub_zsmul' hp a b 1
#align to_Ico_div_sub' toIcoDiv_sub'
@[simp]
theorem toIocDiv_sub (a b : Ξ±) : toIocDiv hp a (b - p) = toIocDiv hp a b - 1 := by
simpa only [one_zsmul] using toIocDiv_sub_zsmul hp a b 1
#align to_Ioc_div_sub toIocDiv_sub
@[simp]
theorem toIocDiv_sub' (a b : Ξ±) : toIocDiv hp (a - p) b = toIocDiv hp a b + 1 := by
simpa only [one_zsmul] using toIocDiv_sub_zsmul' hp a b 1
#align to_Ioc_div_sub' toIocDiv_sub'
theorem toIcoDiv_sub_eq_toIcoDiv_add (a b c : Ξ±) :
toIcoDiv hp a (b - c) = toIcoDiv hp (a + c) b := by
apply toIcoDiv_eq_of_sub_zsmul_mem_Ico
rw [β sub_right_comm, Set.sub_mem_Ico_iff_left, add_right_comm]
exact sub_toIcoDiv_zsmul_mem_Ico hp (a + c) b
#align to_Ico_div_sub_eq_to_Ico_div_add toIcoDiv_sub_eq_toIcoDiv_add
theorem toIocDiv_sub_eq_toIocDiv_add (a b c : Ξ±) :
toIocDiv hp a (b - c) = toIocDiv hp (a + c) b := by
apply toIocDiv_eq_of_sub_zsmul_mem_Ioc
rw [β sub_right_comm, Set.sub_mem_Ioc_iff_left, add_right_comm]
exact sub_toIocDiv_zsmul_mem_Ioc hp (a + c) b
#align to_Ioc_div_sub_eq_to_Ioc_div_add toIocDiv_sub_eq_toIocDiv_add
theorem toIcoDiv_sub_eq_toIcoDiv_add' (a b c : Ξ±) :
toIcoDiv hp (a - c) b = toIcoDiv hp a (b + c) := by
rw [β sub_neg_eq_add, toIcoDiv_sub_eq_toIcoDiv_add, sub_eq_add_neg]
#align to_Ico_div_sub_eq_to_Ico_div_add' toIcoDiv_sub_eq_toIcoDiv_add'
theorem toIocDiv_sub_eq_toIocDiv_add' (a b c : Ξ±) :
toIocDiv hp (a - c) b = toIocDiv hp a (b + c) := by
rw [β sub_neg_eq_add, toIocDiv_sub_eq_toIocDiv_add, sub_eq_add_neg]
#align to_Ioc_div_sub_eq_to_Ioc_div_add' toIocDiv_sub_eq_toIocDiv_add'
theorem toIcoDiv_neg (a b : Ξ±) : toIcoDiv hp a (-b) = -(toIocDiv hp (-a) b + 1) := by
suffices toIcoDiv hp a (-b) = -toIocDiv hp (-(a + p)) b by
rwa [neg_add, β sub_eq_add_neg, toIocDiv_sub_eq_toIocDiv_add', toIocDiv_add_right] at this
rw [β neg_eq_iff_eq_neg, eq_comm]
apply toIocDiv_eq_of_sub_zsmul_mem_Ioc
obtain β¨hc, hoβ© := sub_toIcoDiv_zsmul_mem_Ico hp a (-b)
rw [β neg_lt_neg_iff, neg_sub' (-b), neg_neg, β neg_smul] at ho
rw [β neg_le_neg_iff, neg_sub' (-b), neg_neg, β neg_smul] at hc
refine β¨ho, hc.trans_eq ?_β©
rw [neg_add, neg_add_cancel_right]
#align to_Ico_div_neg toIcoDiv_neg
theorem toIcoDiv_neg' (a b : Ξ±) : toIcoDiv hp (-a) b = -(toIocDiv hp a (-b) + 1) := by
simpa only [neg_neg] using toIcoDiv_neg hp (-a) (-b)
#align to_Ico_div_neg' toIcoDiv_neg'
theorem toIocDiv_neg (a b : Ξ±) : toIocDiv hp a (-b) = -(toIcoDiv hp (-a) b + 1) := by
rw [β neg_neg b, toIcoDiv_neg, neg_neg, neg_neg, neg_add', neg_neg, add_sub_cancel_right]
#align to_Ioc_div_neg toIocDiv_neg
theorem toIocDiv_neg' (a b : Ξ±) : toIocDiv hp (-a) b = -(toIcoDiv hp a (-b) + 1) := by
simpa only [neg_neg] using toIocDiv_neg hp (-a) (-b)
#align to_Ioc_div_neg' toIocDiv_neg'
@[simp]
theorem toIcoMod_add_zsmul (a b : Ξ±) (m : β€) : toIcoMod hp a (b + m β’ p) = toIcoMod hp a b := by
rw [toIcoMod, toIcoDiv_add_zsmul, toIcoMod, add_smul]
abel
#align to_Ico_mod_add_zsmul toIcoMod_add_zsmul
@[simp]
theorem toIcoMod_add_zsmul' (a b : Ξ±) (m : β€) :
toIcoMod hp (a + m β’ p) b = toIcoMod hp a b + m β’ p := by
simp only [toIcoMod, toIcoDiv_add_zsmul', sub_smul, sub_add]
#align to_Ico_mod_add_zsmul' toIcoMod_add_zsmul'
@[simp]
theorem toIocMod_add_zsmul (a b : Ξ±) (m : β€) : toIocMod hp a (b + m β’ p) = toIocMod hp a b := by
rw [toIocMod, toIocDiv_add_zsmul, toIocMod, add_smul]
abel
#align to_Ioc_mod_add_zsmul toIocMod_add_zsmul
@[simp]
theorem toIocMod_add_zsmul' (a b : Ξ±) (m : β€) :
toIocMod hp (a + m β’ p) b = toIocMod hp a b + m β’ p := by
simp only [toIocMod, toIocDiv_add_zsmul', sub_smul, sub_add]
#align to_Ioc_mod_add_zsmul' toIocMod_add_zsmul'
@[simp]
theorem toIcoMod_zsmul_add (a b : Ξ±) (m : β€) : toIcoMod hp a (m β’ p + b) = toIcoMod hp a b := by
rw [add_comm, toIcoMod_add_zsmul]
#align to_Ico_mod_zsmul_add toIcoMod_zsmul_add
@[simp]
theorem toIcoMod_zsmul_add' (a b : Ξ±) (m : β€) :
toIcoMod hp (m β’ p + a) b = m β’ p + toIcoMod hp a b := by
rw [add_comm, toIcoMod_add_zsmul', add_comm]
#align to_Ico_mod_zsmul_add' toIcoMod_zsmul_add'
@[simp]
theorem toIocMod_zsmul_add (a b : Ξ±) (m : β€) : toIocMod hp a (m β’ p + b) = toIocMod hp a b := by
rw [add_comm, toIocMod_add_zsmul]
#align to_Ioc_mod_zsmul_add toIocMod_zsmul_add
@[simp]
theorem toIocMod_zsmul_add' (a b : Ξ±) (m : β€) :
toIocMod hp (m β’ p + a) b = m β’ p + toIocMod hp a b := by
rw [add_comm, toIocMod_add_zsmul', add_comm]
#align to_Ioc_mod_zsmul_add' toIocMod_zsmul_add'
@[simp]
theorem toIcoMod_sub_zsmul (a b : Ξ±) (m : β€) : toIcoMod hp a (b - m β’ p) = toIcoMod hp a b := by
rw [sub_eq_add_neg, β neg_smul, toIcoMod_add_zsmul]
#align to_Ico_mod_sub_zsmul toIcoMod_sub_zsmul
@[simp]
theorem toIcoMod_sub_zsmul' (a b : Ξ±) (m : β€) :
toIcoMod hp (a - m β’ p) b = toIcoMod hp a b - m β’ p := by
simp_rw [sub_eq_add_neg, β neg_smul, toIcoMod_add_zsmul']
#align to_Ico_mod_sub_zsmul' toIcoMod_sub_zsmul'
@[simp]
theorem toIocMod_sub_zsmul (a b : Ξ±) (m : β€) : toIocMod hp a (b - m β’ p) = toIocMod hp a b := by
rw [sub_eq_add_neg, β neg_smul, toIocMod_add_zsmul]
#align to_Ioc_mod_sub_zsmul toIocMod_sub_zsmul
@[simp]
theorem toIocMod_sub_zsmul' (a b : Ξ±) (m : β€) :
toIocMod hp (a - m β’ p) b = toIocMod hp a b - m β’ p := by
simp_rw [sub_eq_add_neg, β neg_smul, toIocMod_add_zsmul']
#align to_Ioc_mod_sub_zsmul' toIocMod_sub_zsmul'
@[simp]
theorem toIcoMod_add_right (a b : Ξ±) : toIcoMod hp a (b + p) = toIcoMod hp a b := by
simpa only [one_zsmul] using toIcoMod_add_zsmul hp a b 1
#align to_Ico_mod_add_right toIcoMod_add_right
@[simp]
| Mathlib/Algebra/Order/ToIntervalMod.lean | 480 | 481 | theorem toIcoMod_add_right' (a b : Ξ±) : toIcoMod hp (a + p) b = toIcoMod hp a b + p := by |
simpa only [one_zsmul] using toIcoMod_add_zsmul' hp a b 1
|
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 Coord
@[simps!]
def coord : M ββ[R] R :=
Finsupp.lapply i ββ βb.repr
#align basis.coord Basis.coord
theorem forall_coord_eq_zero_iff {x : M} : (β i, b.coord i x = 0) β x = 0 :=
Iff.trans (by simp only [b.coord_apply, DFunLike.ext_iff, Finsupp.zero_apply])
b.repr.map_eq_zero_iff
#align basis.forall_coord_eq_zero_iff Basis.forall_coord_eq_zero_iff
noncomputable def sumCoords : M ββ[R] R :=
(Finsupp.lsum β fun _ => LinearMap.id) ββ (b.repr : M ββ[R] ΞΉ ββ R)
#align basis.sum_coords Basis.sumCoords
@[simp]
theorem coe_sumCoords : (b.sumCoords : M β R) = fun m => (b.repr m).sum fun _ => id :=
rfl
#align basis.coe_sum_coords Basis.coe_sumCoords
theorem coe_sumCoords_eq_finsum : (b.sumCoords : M β R) = fun m => βαΆ i, b.coord i m := by
ext m
simp only [Basis.sumCoords, Basis.coord, Finsupp.lapply_apply, LinearMap.id_coe,
LinearEquiv.coe_coe, Function.comp_apply, Finsupp.coe_lsum, LinearMap.coe_comp,
finsum_eq_sum _ (b.repr m).finite_support, Finsupp.sum, Finset.finite_toSet_toFinset, id,
Finsupp.fun_support_eq]
#align basis.coe_sum_coords_eq_finsum Basis.coe_sumCoords_eq_finsum
@[simp high]
theorem coe_sumCoords_of_fintype [Fintype ΞΉ] : (b.sumCoords : M β R) = β i, b.coord i := by
ext m
-- Porting note: - `eq_self_iff_true`
-- + `comp_apply` `LinearMap.coeFn_sum`
simp only [sumCoords, Finsupp.sum_fintype, LinearMap.id_coe, LinearEquiv.coe_coe, coord_apply,
id, Fintype.sum_apply, imp_true_iff, Finsupp.coe_lsum, LinearMap.coe_comp, comp_apply,
LinearMap.coeFn_sum]
#align basis.coe_sum_coords_of_fintype Basis.coe_sumCoords_of_fintype
@[simp]
| Mathlib/LinearAlgebra/Basis.lean | 250 | 252 | theorem sumCoords_self_apply : b.sumCoords (b i) = 1 := by |
simp only [Basis.sumCoords, LinearMap.id_coe, LinearEquiv.coe_coe, id, Basis.repr_self,
Function.comp_apply, Finsupp.coe_lsum, LinearMap.coe_comp, Finsupp.sum_single_index]
|
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.SetLike.Fintype
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.PGroup
import Mathlib.GroupTheory.NoncommPiCoprod
import Mathlib.Order.Atoms.Finite
import Mathlib.Data.Set.Lattice
#align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
open Fintype MulAction Subgroup
section InfiniteSylow
variable (p : β) (G : Type*) [Group G]
structure Sylow extends Subgroup G where
isPGroup' : IsPGroup p toSubgroup
is_maximal' : β {Q : Subgroup G}, IsPGroup p Q β toSubgroup β€ Q β Q = toSubgroup
#align sylow Sylow
variable {p} {G}
open Equiv Equiv.Perm Finset Function List QuotientGroup
universe u v w
variable {G : Type u} {Ξ± : Type v} {Ξ² : Type w} [Group G]
attribute [local instance 10] Subtype.fintype setFintype Classical.propDecidable
theorem QuotientGroup.card_preimage_mk [Fintype G] (s : Subgroup G) (t : Set (G β§Έ s)) :
Fintype.card (QuotientGroup.mk β»ΒΉ' t) = Fintype.card s * Fintype.card t := by
rw [β Fintype.card_prod, Fintype.card_congr (preimageMkEquivSubgroupProdSet _ _)]
#align quotient_group.card_preimage_mk QuotientGroup.card_preimage_mk
namespace Sylow
theorem mem_fixedPoints_mul_left_cosets_iff_mem_normalizer {H : Subgroup G} [Finite (H : Set G)]
{x : G} : (x : G β§Έ H) β MulAction.fixedPoints H (G β§Έ H) β x β normalizer H :=
β¨fun hx =>
have ha : β {y : G β§Έ H}, y β orbit H (x : G β§Έ H) β y = x := mem_fixedPoints'.1 hx _
(inv_mem_iff (G := G)).1
(mem_normalizer_fintype fun n (hn : n β H) =>
have : (nβ»ΒΉ * x)β»ΒΉ * x β H := QuotientGroup.eq.1 (ha β¨β¨nβ»ΒΉ, inv_mem hnβ©, rflβ©)
show _ β H by
rw [mul_inv_rev, inv_inv] at this
convert this
rw [inv_inv]),
fun hx : β n : G, n β H β x * n * xβ»ΒΉ β H =>
mem_fixedPoints'.2 fun y =>
Quotient.inductionOn' y fun y hy =>
QuotientGroup.eq.2
(let β¨β¨b, hbββ©, hbββ© := hy
have hbβ : (b * x)β»ΒΉ * y β H := QuotientGroup.eq.1 hbβ
(inv_mem_iff (G := G)).1 <|
(hx _).2 <|
(mul_mem_cancel_left (inv_mem hbβ)).1 <| by
rw [hx] at hbβ; simpa [mul_inv_rev, mul_assoc] using hbβ)β©
#align sylow.mem_fixed_points_mul_left_cosets_iff_mem_normalizer Sylow.mem_fixedPoints_mul_left_cosets_iff_mem_normalizer
def fixedPointsMulLeftCosetsEquivQuotient (H : Subgroup G) [Finite (H : Set G)] :
MulAction.fixedPoints H (G β§Έ H) β
normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H :=
@subtypeQuotientEquivQuotientSubtype G (normalizer H : Set G) (_) (_)
(MulAction.fixedPoints H (G β§Έ H))
(fun a => (@mem_fixedPoints_mul_left_cosets_iff_mem_normalizer _ _ _ βΉ_βΊ _).symm)
(by
intros
unfold_projs
rw [leftRel_apply (Ξ± := normalizer H), leftRel_apply]
rfl)
#align sylow.fixed_points_mul_left_cosets_equiv_quotient Sylow.fixedPointsMulLeftCosetsEquivQuotient
theorem card_quotient_normalizer_modEq_card_quotient [Fintype G] {p : β} {n : β} [hp : Fact p.Prime]
{H : Subgroup G} (hH : Fintype.card H = p ^ n) :
Fintype.card (normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H) β‘
card (G β§Έ H) [MOD p] := by
rw [β Fintype.card_congr (fixedPointsMulLeftCosetsEquivQuotient H)]
exact ((IsPGroup.of_card hH).card_modEq_card_fixedPoints _).symm
#align sylow.card_quotient_normalizer_modeq_card_quotient Sylow.card_quotient_normalizer_modEq_card_quotient
theorem card_normalizer_modEq_card [Fintype G] {p : β} {n : β} [hp : Fact p.Prime] {H : Subgroup G}
(hH : Fintype.card H = p ^ n) : card (normalizer H) β‘ card G [MOD p ^ (n + 1)] := by
have : H.subgroupOf (normalizer H) β H := (subgroupOfEquivOfLe le_normalizer).toEquiv
simp only [β Nat.card_eq_fintype_card] at hH β’
rw [card_eq_card_quotient_mul_card_subgroup H,
card_eq_card_quotient_mul_card_subgroup (H.subgroupOf (normalizer H)), Nat.card_congr this,
hH, pow_succ']
simp only [Nat.card_eq_fintype_card] at hH β’
exact (card_quotient_normalizer_modEq_card_quotient hH).mul_right' _
#align sylow.card_normalizer_modeq_card Sylow.card_normalizer_modEq_card
theorem prime_dvd_card_quotient_normalizer [Fintype G] {p : β} {n : β} [hp : Fact p.Prime]
(hdvd : p ^ (n + 1) β£ card G) {H : Subgroup G} (hH : Fintype.card H = p ^ n) :
p β£ card (normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H) :=
let β¨s, hsβ© := exists_eq_mul_left_of_dvd hdvd
have hcard : card (G β§Έ H) = s * p :=
(mul_left_inj' (show card H β 0 from Fintype.card_ne_zero)).1
(by
simp only [β Nat.card_eq_fintype_card] at hs hH β’
rw [β card_eq_card_quotient_mul_card_subgroup H, hH, hs, pow_succ', mul_assoc, mul_comm p])
have hm :
s * p % p =
card (normalizer H β§Έ Subgroup.comap ((normalizer H).subtype : normalizer H β* G) H) % p :=
hcard βΈ (card_quotient_normalizer_modEq_card_quotient hH).symm
Nat.dvd_of_mod_eq_zero (by rwa [Nat.mod_eq_zero_of_dvd (dvd_mul_left _ _), eq_comm] at hm)
#align sylow.prime_dvd_card_quotient_normalizer Sylow.prime_dvd_card_quotient_normalizer
theorem prime_pow_dvd_card_normalizer [Fintype G] {p : β} {n : β} [_hp : Fact p.Prime]
(hdvd : p ^ (n + 1) β£ card G) {H : Subgroup G} (hH : Fintype.card H = p ^ n) :
p ^ (n + 1) β£ card (normalizer H) :=
Nat.modEq_zero_iff_dvd.1 ((card_normalizer_modEq_card hH).trans hdvd.modEq_zero_nat)
#align sylow.prime_pow_dvd_card_normalizer Sylow.prime_pow_dvd_card_normalizer
theorem exists_subgroup_card_pow_succ [Fintype G] {p : β} {n : β} [hp : Fact p.Prime]
(hdvd : p ^ (n + 1) β£ card G) {H : Subgroup G} (hH : Fintype.card H = p ^ n) :
β K : Subgroup G, Fintype.card K = p ^ (n + 1) β§ H β€ K :=
let β¨s, hsβ© := exists_eq_mul_left_of_dvd hdvd
have hcard : card (G β§Έ H) = s * p :=
(mul_left_inj' (show card H β 0 from Fintype.card_ne_zero)).1
(by
simp only [β Nat.card_eq_fintype_card] at hs hH β’
rw [β card_eq_card_quotient_mul_card_subgroup H, hH, hs, pow_succ', mul_assoc, mul_comm p])
have hm : s * p % p = card (normalizer H β§Έ H.subgroupOf H.normalizer) % p :=
Fintype.card_congr (fixedPointsMulLeftCosetsEquivQuotient H) βΈ
hcard βΈ (IsPGroup.of_card hH).card_modEq_card_fixedPoints _
have hm' : p β£ card (normalizer H β§Έ H.subgroupOf H.normalizer) :=
Nat.dvd_of_mod_eq_zero (by rwa [Nat.mod_eq_zero_of_dvd (dvd_mul_left _ _), eq_comm] at hm)
let β¨x, hxβ© := @exists_prime_orderOf_dvd_card _ (QuotientGroup.Quotient.group _) _ _ hp hm'
have hequiv : H β H.subgroupOf H.normalizer := (subgroupOfEquivOfLe le_normalizer).symm.toEquiv
β¨Subgroup.map (normalizer H).subtype
(Subgroup.comap (mk' (H.subgroupOf H.normalizer)) (zpowers x)), by
show Fintype.card (Subgroup.map H.normalizer.subtype
(comap (mk' (H.subgroupOf H.normalizer)) (Subgroup.zpowers x))) = p ^ (n + 1)
suffices Fintype.card (Subtype.val ''
(Subgroup.comap (mk' (H.subgroupOf H.normalizer)) (zpowers x) : Set H.normalizer)) =
p ^ (n + 1)
by convert this using 2
rw [Set.card_image_of_injective
(Subgroup.comap (mk' (H.subgroupOf H.normalizer)) (zpowers x) : Set H.normalizer)
Subtype.val_injective,
pow_succ, β hH, Fintype.card_congr hequiv, β hx, β Fintype.card_zpowers, β
Fintype.card_prod]
exact @Fintype.card_congr _ _ (_) (_)
(preimageMkEquivSubgroupProdSet (H.subgroupOf H.normalizer) (zpowers x)), by
intro y hy
simp only [exists_prop, Subgroup.coeSubtype, mk'_apply, Subgroup.mem_map, Subgroup.mem_comap]
refine β¨β¨y, le_normalizer hyβ©, β¨0, ?_β©, rflβ©
dsimp only
rw [zpow_zero, eq_comm, QuotientGroup.eq_one_iff]
simpa using hyβ©
#align sylow.exists_subgroup_card_pow_succ Sylow.exists_subgroup_card_pow_succ
theorem exists_subgroup_card_pow_prime_le [Fintype G] (p : β) :
β {n m : β} [_hp : Fact p.Prime] (_hdvd : p ^ m β£ card G) (H : Subgroup G)
(_hH : card H = p ^ n) (_hnm : n β€ m), β K : Subgroup G, card K = p ^ m β§ H β€ K
| n, m => fun {hdvd H hH hnm} =>
(lt_or_eq_of_le hnm).elim
(fun hnm : n < m =>
have h0m : 0 < m := lt_of_le_of_lt n.zero_le hnm
have _wf : m - 1 < m := Nat.sub_lt h0m zero_lt_one
have hnm1 : n β€ m - 1 := le_tsub_of_add_le_right hnm
let β¨K, hKβ© :=
@exists_subgroup_card_pow_prime_le _ _ n (m - 1) _
(Nat.pow_dvd_of_le_of_pow_dvd tsub_le_self hdvd) H hH hnm1
have hdvd' : p ^ (m - 1 + 1) β£ card G := by rwa [tsub_add_cancel_of_le h0m.nat_succ_le]
let β¨K', hK'β© := @exists_subgroup_card_pow_succ _ _ _ _ _ _ hdvd' K hK.1
β¨K', by rw [hK'.1, tsub_add_cancel_of_le h0m.nat_succ_le], le_trans hK.2 hK'.2β©)
fun hnm : n = m => β¨H, by simp [hH, hnm]β©
#align sylow.exists_subgroup_card_pow_prime_le Sylow.exists_subgroup_card_pow_prime_le
theorem exists_subgroup_card_pow_prime [Fintype G] (p : β) {n : β} [Fact p.Prime]
(hdvd : p ^ n β£ card G) : β K : Subgroup G, Fintype.card K = p ^ n :=
let β¨K, hKβ© := exists_subgroup_card_pow_prime_le p hdvd β₯
-- The @ is due to a Fintype β₯ mismatch, but this will be fixed once we convert to Nat.card
(by rw [β @Nat.card_eq_fintype_card, card_bot, pow_zero]) n.zero_le
β¨K, hK.1β©
#align sylow.exists_subgroup_card_pow_prime Sylow.exists_subgroup_card_pow_prime
lemma exists_subgroup_card_pow_prime_of_le_card {n p : β} (hp : p.Prime) (h : IsPGroup p G)
(hn : p ^ n β€ Nat.card G) : β H : Subgroup G, Nat.card H = p ^ n := by
have : Fact p.Prime := β¨hpβ©
have : Finite G := Nat.finite_of_card_ne_zero <| by linarith [Nat.one_le_pow n p hp.pos]
cases nonempty_fintype G
obtain β¨m, hmβ© := h.exists_card_eq
simp_rw [Nat.card_eq_fintype_card] at hm hn β’
refine exists_subgroup_card_pow_prime _ ?_
rw [hm] at hn β’
exact pow_dvd_pow _ <| (pow_le_pow_iff_right hp.one_lt).1 hn
lemma exists_subgroup_le_card_pow_prime_of_le_card {n p : β} (hp : p.Prime) (h : IsPGroup p G)
{H : Subgroup G} (hn : p ^ n β€ Nat.card H) : β H' β€ H, Nat.card H' = p ^ n := by
obtain β¨H', H'cardβ© := exists_subgroup_card_pow_prime_of_le_card hp (h.to_subgroup H) hn
refine β¨H'.map H.subtype, map_subtype_le _, ?_β©
rw [β H'card]
let e : H' β* H'.map H.subtype := H'.equivMapOfInjective (Subgroup.subtype H) H.subtype_injective
exact Nat.card_congr e.symm.toEquiv
lemma exists_subgroup_le_card_le {k p : β} (hp : p.Prime) (h : IsPGroup p G) {H : Subgroup G}
(hk : k β€ Nat.card H) (hkβ : k β 0) : β H' β€ H, Nat.card H' β€ k β§ k < p * Nat.card H' := by
obtain β¨m, hmk, hkmβ© : β s, p ^ s β€ k β§ k < p ^ (s + 1) :=
exists_nat_pow_near (Nat.one_le_iff_ne_zero.2 hkβ) hp.one_lt
obtain β¨H', H'H, H'cardβ© := exists_subgroup_le_card_pow_prime_of_le_card hp h (hmk.trans hk)
refine β¨H', H'H, ?_β©
simpa only [pow_succ', H'card] using And.intro hmk hkm
theorem pow_dvd_card_of_pow_dvd_card [Fintype G] {p n : β} [hp : Fact p.Prime] (P : Sylow p G)
(hdvd : p ^ n β£ card G) : p ^ n β£ card P :=
(hp.1.coprime_pow_of_not_dvd
(not_dvd_index_sylow P index_ne_zero_of_finite)).symm.dvd_of_dvd_mul_left
((index_mul_card P.1).symm βΈ hdvd)
#align sylow.pow_dvd_card_of_pow_dvd_card Sylow.pow_dvd_card_of_pow_dvd_card
theorem dvd_card_of_dvd_card [Fintype G] {p : β} [Fact p.Prime] (P : Sylow p G)
(hdvd : p β£ card G) : p β£ card P := by
rw [β pow_one p] at hdvd
have key := P.pow_dvd_card_of_pow_dvd_card hdvd
rwa [pow_one] at key
#align sylow.dvd_card_of_dvd_card Sylow.dvd_card_of_dvd_card
theorem card_coprime_index [Fintype G] {p : β} [hp : Fact p.Prime] (P : Sylow p G) :
(card P).Coprime (index (P : Subgroup G)) :=
let β¨_n, hnβ© := IsPGroup.iff_card.mp P.2
hn.symm βΈ (hp.1.coprime_pow_of_not_dvd (not_dvd_index_sylow P index_ne_zero_of_finite)).symm
#align sylow.card_coprime_index Sylow.card_coprime_index
theorem ne_bot_of_dvd_card [Fintype G] {p : β} [hp : Fact p.Prime] (P : Sylow p G)
(hdvd : p β£ card G) : (P : Subgroup G) β β₯ := by
refine fun h => hp.out.not_dvd_one ?_
have key : p β£ card (P : Subgroup G) := P.dvd_card_of_dvd_card hdvd
-- The @ is due to a Fintype β₯ mismatch, but this will be fixed once we convert to Nat.card
rwa [h, β @Nat.card_eq_fintype_card, card_bot] at key
#align sylow.ne_bot_of_dvd_card Sylow.ne_bot_of_dvd_card
theorem card_eq_multiplicity [Fintype G] {p : β} [hp : Fact p.Prime] (P : Sylow p G) :
card P = p ^ Nat.factorization (card G) p := by
obtain β¨n, heq : card P = _β© := IsPGroup.iff_card.mp P.isPGroup'
refine Nat.dvd_antisymm ?_ (P.pow_dvd_card_of_pow_dvd_card (Nat.ord_proj_dvd _ p))
rw [heq, β hp.out.pow_dvd_iff_dvd_ord_proj (show card G β 0 from card_ne_zero), β heq]
simp only [β Nat.card_eq_fintype_card]
exact P.1.card_subgroup_dvd_card
#align sylow.card_eq_multiplicity Sylow.card_eq_multiplicity
def ofCard [Fintype G] {p : β} [Fact p.Prime] (H : Subgroup G) [Fintype H]
(card_eq : card H = p ^ (card G).factorization p) : Sylow p G where
toSubgroup := H
isPGroup' := IsPGroup.of_card card_eq
is_maximal' := by
obtain β¨P, hHPβ© := (IsPGroup.of_card card_eq).exists_le_sylow
exact SetLike.ext'
(Set.eq_of_subset_of_card_le hHP (P.card_eq_multiplicity.trans card_eq.symm).le).symm βΈ P.3
#align sylow.of_card Sylow.ofCard
@[simp, norm_cast]
theorem coe_ofCard [Fintype G] {p : β} [Fact p.Prime] (H : Subgroup G) [Fintype H]
(card_eq : card H = p ^ (card G).factorization p) : β(ofCard H card_eq) = H :=
rfl
#align sylow.coe_of_card Sylow.coe_ofCard
noncomputable def unique_of_normal {p : β} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
(h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
refine { uniq := fun Q β¦ ?_ }
obtain β¨x, h1β© := exists_smul_eq G P Q
obtain β¨x, h2β© := exists_smul_eq G P default
rw [Sylow.smul_eq_of_normal] at h1 h2
rw [β h1, β h2]
#align sylow.subsingleton_of_normal Sylow.unique_of_normal
section Pointwise
open Pointwise
| Mathlib/GroupTheory/Sylow.lean | 763 | 770 | theorem characteristic_of_normal {p : β} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
(h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by |
haveI := Sylow.unique_of_normal P h
rw [characteristic_iff_map_eq]
intro Ξ¦
show (Ξ¦ β’ P).toSubgroup = P.toSubgroup
congr
simp [eq_iff_true_of_subsingleton]
|
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Data.Set.Finite
#align_import order.filter.basic from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
set_option autoImplicit true
open Function Set Order
open scoped Classical
universe u v w x y
structure Filter (Ξ± : Type*) where
sets : Set (Set Ξ±)
univ_sets : Set.univ β sets
sets_of_superset {x y} : x β sets β x β y β y β sets
inter_sets {x y} : x β sets β y β sets β x β© y β sets
#align filter Filter
instance {Ξ± : Type*} : Membership (Set Ξ±) (Filter Ξ±) :=
β¨fun U F => U β F.setsβ©
namespace Filter
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {Ξ΄ : Type*} {ΞΉ : Sort x}
open Filter
section Lattice
variable {f g : Filter Ξ±} {s t : Set Ξ±}
instance : PartialOrder (Filter Ξ±) where
le f g := β β¦U : Set Ξ±β¦, U β g β U β f
le_antisymm a b hβ hβ := filter_eq <| Subset.antisymm hβ hβ
le_refl a := Subset.rfl
le_trans a b c hβ hβ := Subset.trans hβ hβ
theorem le_def : f β€ g β β x β g, x β f :=
Iff.rfl
#align filter.le_def Filter.le_def
protected theorem not_le : Β¬f β€ g β β s β g, s β f := by simp_rw [le_def, not_forall, exists_prop]
#align filter.not_le Filter.not_le
inductive GenerateSets (g : Set (Set Ξ±)) : Set Ξ± β Prop
| basic {s : Set Ξ±} : s β g β GenerateSets g s
| univ : GenerateSets g univ
| superset {s t : Set Ξ±} : GenerateSets g s β s β t β GenerateSets g t
| inter {s t : Set Ξ±} : GenerateSets g s β GenerateSets g t β GenerateSets g (s β© t)
#align filter.generate_sets Filter.GenerateSets
def generate (g : Set (Set Ξ±)) : Filter Ξ± where
sets := {s | GenerateSets g s}
univ_sets := GenerateSets.univ
sets_of_superset := GenerateSets.superset
inter_sets := GenerateSets.inter
#align filter.generate Filter.generate
lemma mem_generate_of_mem {s : Set <| Set Ξ±} {U : Set Ξ±} (h : U β s) :
U β generate s := GenerateSets.basic h
theorem le_generate_iff {s : Set (Set Ξ±)} {f : Filter Ξ±} : f β€ generate s β s β f.sets :=
Iff.intro (fun h _ hu => h <| GenerateSets.basic <| hu) fun h _ hu =>
hu.recOn (fun h' => h h') univ_mem (fun _ hxy hx => mem_of_superset hx hxy) fun _ _ hx hy =>
inter_mem hx hy
#align filter.sets_iff_generate Filter.le_generate_iff
theorem mem_generate_iff {s : Set <| Set Ξ±} {U : Set Ξ±} :
U β generate s β β t β s, Set.Finite t β§ ββ t β U := by
constructor <;> intro h
Β· induction h with
| @basic V V_in =>
exact β¨{V}, singleton_subset_iff.2 V_in, finite_singleton _, (sInter_singleton _).subsetβ©
| univ => exact β¨β
, empty_subset _, finite_empty, subset_univ _β©
| superset _ hVW hV =>
rcases hV with β¨t, hts, ht, htVβ©
exact β¨t, hts, ht, htV.trans hVWβ©
| inter _ _ hV hW =>
rcases hV, hW with β¨β¨t, hts, ht, htVβ©, u, hus, hu, huWβ©
exact
β¨t βͺ u, union_subset hts hus, ht.union hu,
(sInter_union _ _).subset.trans <| inter_subset_inter htV huWβ©
Β· rcases h with β¨t, hts, tfin, hβ©
exact mem_of_superset ((sInter_mem tfin).2 fun V hV => GenerateSets.basic <| hts hV) h
#align filter.mem_generate_iff Filter.mem_generate_iff
@[simp] lemma generate_singleton (s : Set Ξ±) : generate {s} = π s :=
le_antisymm (fun _t ht β¦ mem_of_superset (mem_generate_of_mem <| mem_singleton _) ht) <|
le_generate_iff.2 <| singleton_subset_iff.2 Subset.rfl
protected def mkOfClosure (s : Set (Set Ξ±)) (hs : (generate s).sets = s) : Filter Ξ± where
sets := s
univ_sets := hs βΈ univ_mem
sets_of_superset := hs βΈ mem_of_superset
inter_sets := hs βΈ inter_mem
#align filter.mk_of_closure Filter.mkOfClosure
theorem mkOfClosure_sets {s : Set (Set Ξ±)} {hs : (generate s).sets = s} :
Filter.mkOfClosure s hs = generate s :=
Filter.ext fun u =>
show u β (Filter.mkOfClosure s hs).sets β u β (generate s).sets from hs.symm βΈ Iff.rfl
#align filter.mk_of_closure_sets Filter.mkOfClosure_sets
def giGenerate (Ξ± : Type*) :
@GaloisInsertion (Set (Set Ξ±)) (Filter Ξ±)α΅α΅ _ _ Filter.generate Filter.sets where
gc _ _ := le_generate_iff
le_l_u _ _ h := GenerateSets.basic h
choice s hs := Filter.mkOfClosure s (le_antisymm hs <| le_generate_iff.1 <| le_rfl)
choice_eq _ _ := mkOfClosure_sets
#align filter.gi_generate Filter.giGenerate
instance : Inf (Filter Ξ±) :=
β¨fun f g : Filter Ξ± =>
{ sets := { s | β a β f, β b β g, s = a β© b }
univ_sets := β¨_, univ_mem, _, univ_mem, by simpβ©
sets_of_superset := by
rintro x y β¨a, ha, b, hb, rflβ© xy
refine
β¨a βͺ y, mem_of_superset ha subset_union_left, b βͺ y,
mem_of_superset hb subset_union_left, ?_β©
rw [β inter_union_distrib_right, union_eq_self_of_subset_left xy]
inter_sets := by
rintro x y β¨a, ha, b, hb, rflβ© β¨c, hc, d, hd, rflβ©
refine β¨a β© c, inter_mem ha hc, b β© d, inter_mem hb hd, ?_β©
ac_rfl }β©
theorem mem_inf_iff {f g : Filter Ξ±} {s : Set Ξ±} : s β f β g β β tβ β f, β tβ β g, s = tβ β© tβ :=
Iff.rfl
#align filter.mem_inf_iff Filter.mem_inf_iff
theorem mem_inf_of_left {f g : Filter Ξ±} {s : Set Ξ±} (h : s β f) : s β f β g :=
β¨s, h, univ, univ_mem, (inter_univ s).symmβ©
#align filter.mem_inf_of_left Filter.mem_inf_of_left
theorem mem_inf_of_right {f g : Filter Ξ±} {s : Set Ξ±} (h : s β g) : s β f β g :=
β¨univ, univ_mem, s, h, (univ_inter s).symmβ©
#align filter.mem_inf_of_right Filter.mem_inf_of_right
theorem inter_mem_inf {Ξ± : Type u} {f g : Filter Ξ±} {s t : Set Ξ±} (hs : s β f) (ht : t β g) :
s β© t β f β g :=
β¨s, hs, t, ht, rflβ©
#align filter.inter_mem_inf Filter.inter_mem_inf
theorem mem_inf_of_inter {f g : Filter Ξ±} {s t u : Set Ξ±} (hs : s β f) (ht : t β g)
(h : s β© t β u) : u β f β g :=
mem_of_superset (inter_mem_inf hs ht) h
#align filter.mem_inf_of_inter Filter.mem_inf_of_inter
theorem mem_inf_iff_superset {f g : Filter Ξ±} {s : Set Ξ±} :
s β f β g β β tβ β f, β tβ β g, tβ β© tβ β s :=
β¨fun β¨tβ, hβ, tβ, hβ, Eqβ© => β¨tβ, hβ, tβ, hβ, Eq βΈ Subset.rflβ©, fun β¨_, hβ, _, hβ, subβ© =>
mem_inf_of_inter hβ hβ subβ©
#align filter.mem_inf_iff_superset Filter.mem_inf_iff_superset
instance : Top (Filter Ξ±) :=
β¨{ sets := { s | β x, x β s }
univ_sets := fun x => mem_univ x
sets_of_superset := fun hx hxy a => hxy (hx a)
inter_sets := fun hx hy _ => mem_inter (hx _) (hy _) }β©
theorem mem_top_iff_forall {s : Set Ξ±} : s β (β€ : Filter Ξ±) β β x, x β s :=
Iff.rfl
#align filter.mem_top_iff_forall Filter.mem_top_iff_forall
@[simp]
theorem mem_top {s : Set Ξ±} : s β (β€ : Filter Ξ±) β s = univ := by
rw [mem_top_iff_forall, eq_univ_iff_forall]
#align filter.mem_top Filter.mem_top
@[mono, gcongr]
theorem join_mono {fβ fβ : Filter (Filter Ξ±)} (h : fβ β€ fβ) : join fβ β€ join fβ := fun _ hs => h hs
#align filter.join_mono Filter.join_mono
protected def Eventually (p : Ξ± β Prop) (f : Filter Ξ±) : Prop :=
{ x | p x } β f
#align filter.eventually Filter.Eventually
@[inherit_doc Filter.Eventually]
notation3 "βαΆ "(...)" in "f", "r:(scoped p => Filter.Eventually p f) => r
theorem eventually_iff {f : Filter Ξ±} {P : Ξ± β Prop} : (βαΆ x in f, P x) β { x | P x } β f :=
Iff.rfl
#align filter.eventually_iff Filter.eventually_iff
@[simp]
theorem eventually_mem_set {s : Set Ξ±} {l : Filter Ξ±} : (βαΆ x in l, x β s) β s β l :=
Iff.rfl
#align filter.eventually_mem_set Filter.eventually_mem_set
protected theorem ext' {fβ fβ : Filter Ξ±}
(h : β p : Ξ± β Prop, (βαΆ x in fβ, p x) β βαΆ x in fβ, p x) : fβ = fβ :=
Filter.ext h
#align filter.ext' Filter.ext'
theorem Eventually.filter_mono {fβ fβ : Filter Ξ±} (h : fβ β€ fβ) {p : Ξ± β Prop}
(hp : βαΆ x in fβ, p x) : βαΆ x in fβ, p x :=
h hp
#align filter.eventually.filter_mono Filter.Eventually.filter_mono
theorem eventually_of_mem {f : Filter Ξ±} {P : Ξ± β Prop} {U : Set Ξ±} (hU : U β f)
(h : β x β U, P x) : βαΆ x in f, P x :=
mem_of_superset hU h
#align filter.eventually_of_mem Filter.eventually_of_mem
protected theorem Eventually.and {p q : Ξ± β Prop} {f : Filter Ξ±} :
f.Eventually p β f.Eventually q β βαΆ x in f, p x β§ q x :=
inter_mem
#align filter.eventually.and Filter.Eventually.and
@[simp] theorem eventually_true (f : Filter Ξ±) : βαΆ _ in f, True := univ_mem
#align filter.eventually_true Filter.eventually_true
theorem eventually_of_forall {p : Ξ± β Prop} {f : Filter Ξ±} (hp : β x, p x) : βαΆ x in f, p x :=
univ_mem' hp
#align filter.eventually_of_forall Filter.eventually_of_forall
@[simp]
theorem eventually_false_iff_eq_bot {f : Filter Ξ±} : (βαΆ _ in f, False) β f = β₯ :=
empty_mem_iff_bot
#align filter.eventually_false_iff_eq_bot Filter.eventually_false_iff_eq_bot
@[simp]
theorem eventually_const {f : Filter Ξ±} [t : NeBot f] {p : Prop} : (βαΆ _ in f, p) β p := by
by_cases h : p <;> simp [h, t.ne]
#align filter.eventually_const Filter.eventually_const
theorem eventually_iff_exists_mem {p : Ξ± β Prop} {f : Filter Ξ±} :
(βαΆ x in f, p x) β β v β f, β y β v, p y :=
exists_mem_subset_iff.symm
#align filter.eventually_iff_exists_mem Filter.eventually_iff_exists_mem
theorem Eventually.exists_mem {p : Ξ± β Prop} {f : Filter Ξ±} (hp : βαΆ x in f, p x) :
β v β f, β y β v, p y :=
eventually_iff_exists_mem.1 hp
#align filter.eventually.exists_mem Filter.Eventually.exists_mem
theorem Eventually.mp {p q : Ξ± β Prop} {f : Filter Ξ±} (hp : βαΆ x in f, p x)
(hq : βαΆ x in f, p x β q x) : βαΆ x in f, q x :=
mp_mem hp hq
#align filter.eventually.mp Filter.Eventually.mp
theorem Eventually.mono {p q : Ξ± β Prop} {f : Filter Ξ±} (hp : βαΆ x in f, p x)
(hq : β x, p x β q x) : βαΆ x in f, q x :=
hp.mp (eventually_of_forall hq)
#align filter.eventually.mono Filter.Eventually.mono
theorem forall_eventually_of_eventually_forall {f : Filter Ξ±} {p : Ξ± β Ξ² β Prop}
(h : βαΆ x in f, β y, p x y) : β y, βαΆ x in f, p x y :=
fun y => h.mono fun _ h => h y
#align filter.forall_eventually_of_eventually_forall Filter.forall_eventually_of_eventually_forall
@[simp]
theorem eventually_and {p q : Ξ± β Prop} {f : Filter Ξ±} :
(βαΆ x in f, p x β§ q x) β (βαΆ x in f, p x) β§ βαΆ x in f, q x :=
inter_mem_iff
#align filter.eventually_and Filter.eventually_and
theorem Eventually.congr {f : Filter Ξ±} {p q : Ξ± β Prop} (h' : βαΆ x in f, p x)
(h : βαΆ x in f, p x β q x) : βαΆ x in f, q x :=
h'.mp (h.mono fun _ hx => hx.mp)
#align filter.eventually.congr Filter.Eventually.congr
theorem eventually_congr {f : Filter Ξ±} {p q : Ξ± β Prop} (h : βαΆ x in f, p x β q x) :
(βαΆ x in f, p x) β βαΆ x in f, q x :=
β¨fun hp => hp.congr h, fun hq => hq.congr <| by simpa only [Iff.comm] using hβ©
#align filter.eventually_congr Filter.eventually_congr
@[simp]
theorem eventually_all {ΞΉ : Sort*} [Finite ΞΉ] {l} {p : ΞΉ β Ξ± β Prop} :
(βαΆ x in l, β i, p i x) β β i, βαΆ x in l, p i x := by
simpa only [Filter.Eventually, setOf_forall] using iInter_mem
#align filter.eventually_all Filter.eventually_all
@[simp]
theorem eventually_all_finite {ΞΉ} {I : Set ΞΉ} (hI : I.Finite) {l} {p : ΞΉ β Ξ± β Prop} :
(βαΆ x in l, β i β I, p i x) β β i β I, βαΆ x in l, p i x := by
simpa only [Filter.Eventually, setOf_forall] using biInter_mem hI
#align filter.eventually_all_finite Filter.eventually_all_finite
alias _root_.Set.Finite.eventually_all := eventually_all_finite
#align set.finite.eventually_all Set.Finite.eventually_all
-- attribute [protected] Set.Finite.eventually_all
@[simp] theorem eventually_all_finset {ΞΉ} (I : Finset ΞΉ) {l} {p : ΞΉ β Ξ± β Prop} :
(βαΆ x in l, β i β I, p i x) β β i β I, βαΆ x in l, p i x :=
I.finite_toSet.eventually_all
#align filter.eventually_all_finset Filter.eventually_all_finset
alias _root_.Finset.eventually_all := eventually_all_finset
#align finset.eventually_all Finset.eventually_all
-- attribute [protected] Finset.eventually_all
@[simp]
theorem eventually_or_distrib_left {f : Filter Ξ±} {p : Prop} {q : Ξ± β Prop} :
(βαΆ x in f, p β¨ q x) β p β¨ βαΆ x in f, q x :=
by_cases (fun h : p => by simp [h]) fun h => by simp [h]
#align filter.eventually_or_distrib_left Filter.eventually_or_distrib_left
@[simp]
theorem eventually_or_distrib_right {f : Filter Ξ±} {p : Ξ± β Prop} {q : Prop} :
(βαΆ x in f, p x β¨ q) β (βαΆ x in f, p x) β¨ q := by
simp only [@or_comm _ q, eventually_or_distrib_left]
#align filter.eventually_or_distrib_right Filter.eventually_or_distrib_right
theorem eventually_imp_distrib_left {f : Filter Ξ±} {p : Prop} {q : Ξ± β Prop} :
(βαΆ x in f, p β q x) β p β βαΆ x in f, q x :=
eventually_all
#align filter.eventually_imp_distrib_left Filter.eventually_imp_distrib_left
@[simp]
theorem eventually_bot {p : Ξ± β Prop} : βαΆ x in β₯, p x :=
β¨β©
#align filter.eventually_bot Filter.eventually_bot
@[simp]
theorem eventually_top {p : Ξ± β Prop} : (βαΆ x in β€, p x) β β x, p x :=
Iff.rfl
#align filter.eventually_top Filter.eventually_top
@[simp]
theorem eventually_sup {p : Ξ± β Prop} {f g : Filter Ξ±} :
(βαΆ x in f β g, p x) β (βαΆ x in f, p x) β§ βαΆ x in g, p x :=
Iff.rfl
#align filter.eventually_sup Filter.eventually_sup
@[simp]
theorem eventually_sSup {p : Ξ± β Prop} {fs : Set (Filter Ξ±)} :
(βαΆ x in sSup fs, p x) β β f β fs, βαΆ x in f, p x :=
Iff.rfl
#align filter.eventually_Sup Filter.eventually_sSup
@[simp]
theorem eventually_iSup {p : Ξ± β Prop} {fs : ΞΉ β Filter Ξ±} :
(βαΆ x in β¨ b, fs b, p x) β β b, βαΆ x in fs b, p x :=
mem_iSup
#align filter.eventually_supr Filter.eventually_iSup
@[simp]
theorem eventually_principal {a : Set Ξ±} {p : Ξ± β Prop} : (βαΆ x in π a, p x) β β x β a, p x :=
Iff.rfl
#align filter.eventually_principal Filter.eventually_principal
theorem Eventually.forall_mem {Ξ± : Type*} {f : Filter Ξ±} {s : Set Ξ±} {P : Ξ± β Prop}
(hP : βαΆ x in f, P x) (hf : π s β€ f) : β x β s, P x :=
Filter.eventually_principal.mp (hP.filter_mono hf)
theorem eventually_inf {f g : Filter Ξ±} {p : Ξ± β Prop} :
(βαΆ x in f β g, p x) β β s β f, β t β g, β x β s β© t, p x :=
mem_inf_iff_superset
#align filter.eventually_inf Filter.eventually_inf
theorem eventually_inf_principal {f : Filter Ξ±} {p : Ξ± β Prop} {s : Set Ξ±} :
(βαΆ x in f β π s, p x) β βαΆ x in f, x β s β p x :=
mem_inf_principal
#align filter.eventually_inf_principal Filter.eventually_inf_principal
protected def Frequently (p : Ξ± β Prop) (f : Filter Ξ±) : Prop :=
Β¬βαΆ x in f, Β¬p x
#align filter.frequently Filter.Frequently
@[inherit_doc Filter.Frequently]
notation3 "βαΆ "(...)" in "f", "r:(scoped p => Filter.Frequently p f) => r
theorem Eventually.frequently {f : Filter Ξ±} [NeBot f] {p : Ξ± β Prop} (h : βαΆ x in f, p x) :
βαΆ x in f, p x :=
compl_not_mem h
#align filter.eventually.frequently Filter.Eventually.frequently
theorem frequently_of_forall {f : Filter Ξ±} [NeBot f] {p : Ξ± β Prop} (h : β x, p x) :
βαΆ x in f, p x :=
Eventually.frequently (eventually_of_forall h)
#align filter.frequently_of_forall Filter.frequently_of_forall
theorem Frequently.mp {p q : Ξ± β Prop} {f : Filter Ξ±} (h : βαΆ x in f, p x)
(hpq : βαΆ x in f, p x β q x) : βαΆ x in f, q x :=
mt (fun hq => hq.mp <| hpq.mono fun _ => mt) h
#align filter.frequently.mp Filter.Frequently.mp
theorem Frequently.filter_mono {p : Ξ± β Prop} {f g : Filter Ξ±} (h : βαΆ x in f, p x) (hle : f β€ g) :
βαΆ x in g, p x :=
mt (fun h' => h'.filter_mono hle) h
#align filter.frequently.filter_mono Filter.Frequently.filter_mono
theorem Frequently.mono {p q : Ξ± β Prop} {f : Filter Ξ±} (h : βαΆ x in f, p x)
(hpq : β x, p x β q x) : βαΆ x in f, q x :=
h.mp (eventually_of_forall hpq)
#align filter.frequently.mono Filter.Frequently.mono
theorem Frequently.and_eventually {p q : Ξ± β Prop} {f : Filter Ξ±} (hp : βαΆ x in f, p x)
(hq : βαΆ x in f, q x) : βαΆ x in f, p x β§ q x := by
refine mt (fun h => hq.mp <| h.mono ?_) hp
exact fun x hpq hq hp => hpq β¨hp, hqβ©
#align filter.frequently.and_eventually Filter.Frequently.and_eventually
| Mathlib/Order/Filter/Basic.lean | 1,319 | 1,321 | theorem Eventually.and_frequently {p q : Ξ± β Prop} {f : Filter Ξ±} (hp : βαΆ x in f, p x)
(hq : βαΆ x in f, q x) : βαΆ x in f, p x β§ q x := by |
simpa only [and_comm] using hq.and_eventually hp
|
import Mathlib.Analysis.InnerProductSpace.Projection
import Mathlib.Analysis.NormedSpace.PiLp
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.UnitaryGroup
#align_import analysis.inner_product_space.pi_L2 from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
set_option linter.uppercaseLean3 false
open Real Set Filter RCLike Submodule Function Uniformity Topology NNReal ENNReal
ComplexConjugate DirectSum
noncomputable section
variable {ΞΉ ΞΉ' π : Type*} [RCLike π]
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace π E]
variable {E' : Type*} [NormedAddCommGroup E'] [InnerProductSpace π E']
variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace β F]
variable {F' : Type*} [NormedAddCommGroup F'] [InnerProductSpace β F']
local notation "βͺ" x ", " y "β«" => @inner π _ _ x y
instance PiLp.innerProductSpace {ΞΉ : Type*} [Fintype ΞΉ] (f : ΞΉ β Type*)
[β i, NormedAddCommGroup (f i)] [β i, InnerProductSpace π (f i)] :
InnerProductSpace π (PiLp 2 f) where
inner x y := β i, inner (x i) (y i)
norm_sq_eq_inner x := by
simp only [PiLp.norm_sq_eq_of_L2, map_sum, β norm_sq_eq_inner, one_div]
conj_symm := by
intro x y
unfold inner
rw [map_sum]
apply Finset.sum_congr rfl
rintro z -
apply inner_conj_symm
add_left x y z :=
show (β i, inner (x i + y i) (z i)) = (β i, inner (x i) (z i)) + β i, inner (y i) (z i) by
simp only [inner_add_left, Finset.sum_add_distrib]
smul_left x y r :=
show (β i : ΞΉ, inner (r β’ x i) (y i)) = conj r * β i, inner (x i) (y i) by
simp only [Finset.mul_sum, inner_smul_left]
#align pi_Lp.inner_product_space PiLp.innerProductSpace
@[simp]
theorem PiLp.inner_apply {ΞΉ : Type*} [Fintype ΞΉ] {f : ΞΉ β Type*} [β i, NormedAddCommGroup (f i)]
[β i, InnerProductSpace π (f i)] (x y : PiLp 2 f) : βͺx, yβ« = β i, βͺx i, y iβ« :=
rfl
#align pi_Lp.inner_apply PiLp.inner_apply
abbrev EuclideanSpace (π : Type*) (n : Type*) : Type _ :=
PiLp 2 fun _ : n => π
#align euclidean_space EuclideanSpace
theorem EuclideanSpace.nnnorm_eq {π : Type*} [RCLike π] {n : Type*} [Fintype n]
(x : EuclideanSpace π n) : βxββ = NNReal.sqrt (β i, βx iββ ^ 2) :=
PiLp.nnnorm_eq_of_L2 x
#align euclidean_space.nnnorm_eq EuclideanSpace.nnnorm_eq
theorem EuclideanSpace.norm_eq {π : Type*} [RCLike π] {n : Type*} [Fintype n]
(x : EuclideanSpace π n) : βxβ = β(β i, βx iβ ^ 2) := by
simpa only [Real.coe_sqrt, NNReal.coe_sum] using congr_arg ((β) : ββ₯0 β β) x.nnnorm_eq
#align euclidean_space.norm_eq EuclideanSpace.norm_eq
theorem EuclideanSpace.dist_eq {π : Type*} [RCLike π] {n : Type*} [Fintype n]
(x y : EuclideanSpace π n) : dist x y = β(β i, dist (x i) (y i) ^ 2) :=
PiLp.dist_eq_of_L2 x y
#align euclidean_space.dist_eq EuclideanSpace.dist_eq
theorem EuclideanSpace.nndist_eq {π : Type*} [RCLike π] {n : Type*} [Fintype n]
(x y : EuclideanSpace π n) : nndist x y = NNReal.sqrt (β i, nndist (x i) (y i) ^ 2) :=
PiLp.nndist_eq_of_L2 x y
#align euclidean_space.nndist_eq EuclideanSpace.nndist_eq
theorem EuclideanSpace.edist_eq {π : Type*} [RCLike π] {n : Type*} [Fintype n]
(x y : EuclideanSpace π n) : edist x y = (β i, edist (x i) (y i) ^ 2) ^ (1 / 2 : β) :=
PiLp.edist_eq_of_L2 x y
#align euclidean_space.edist_eq EuclideanSpace.edist_eq
theorem EuclideanSpace.ball_zero_eq {n : Type*} [Fintype n] (r : β) (hr : 0 β€ r) :
Metric.ball (0 : EuclideanSpace β n) r = {x | β i, x i ^ 2 < r ^ 2} := by
ext x
have : (0 : β) β€ β i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _
simp_rw [mem_setOf, mem_ball_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_lt this hr]
theorem EuclideanSpace.closedBall_zero_eq {n : Type*} [Fintype n] (r : β) (hr : 0 β€ r) :
Metric.closedBall (0 : EuclideanSpace β n) r = {x | β i, x i ^ 2 β€ r ^ 2} := by
ext
simp_rw [mem_setOf, mem_closedBall_zero_iff, norm_eq, norm_eq_abs, sq_abs, sqrt_le_left hr]
theorem EuclideanSpace.sphere_zero_eq {n : Type*} [Fintype n] (r : β) (hr : 0 β€ r) :
Metric.sphere (0 : EuclideanSpace β n) r = {x | β i, x i ^ 2 = r ^ 2} := by
ext x
have : (0 : β) β€ β i, x i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _
simp_rw [mem_setOf, mem_sphere_zero_iff_norm, norm_eq, norm_eq_abs, sq_abs,
Real.sqrt_eq_iff_sq_eq this hr, eq_comm]
section
#align euclidean_space.finite_dimensional WithLp.instModuleFinite
variable [Fintype ΞΉ]
#align euclidean_space.inner_product_space PiLp.innerProductSpace
@[simp]
theorem finrank_euclideanSpace :
FiniteDimensional.finrank π (EuclideanSpace π ΞΉ) = Fintype.card ΞΉ := by
simp [EuclideanSpace, PiLp, WithLp]
#align finrank_euclidean_space finrank_euclideanSpace
theorem finrank_euclideanSpace_fin {n : β} :
FiniteDimensional.finrank π (EuclideanSpace π (Fin n)) = n := by simp
#align finrank_euclidean_space_fin finrank_euclideanSpace_fin
theorem EuclideanSpace.inner_eq_star_dotProduct (x y : EuclideanSpace π ΞΉ) :
βͺx, yβ« = Matrix.dotProduct (star <| WithLp.equiv _ _ x) (WithLp.equiv _ _ y) :=
rfl
#align euclidean_space.inner_eq_star_dot_product EuclideanSpace.inner_eq_star_dotProduct
theorem EuclideanSpace.inner_piLp_equiv_symm (x y : ΞΉ β π) :
βͺ(WithLp.equiv 2 _).symm x, (WithLp.equiv 2 _).symm yβ« = Matrix.dotProduct (star x) y :=
rfl
#align euclidean_space.inner_pi_Lp_equiv_symm EuclideanSpace.inner_piLp_equiv_symm
def DirectSum.IsInternal.isometryL2OfOrthogonalFamily [DecidableEq ΞΉ] {V : ΞΉ β Submodule π E}
(hV : DirectSum.IsInternal V)
(hV' : OrthogonalFamily π (fun i => V i) fun i => (V i).subtypeβα΅’) :
E ββα΅’[π] PiLp 2 fun i => V i := by
let eβ := DirectSum.linearEquivFunOnFintype π ΞΉ fun i => V i
let eβ := LinearEquiv.ofBijective (DirectSum.coeLinearMap V) hV
refine LinearEquiv.isometryOfInner (eβ.symm.trans eβ) ?_
suffices β (v w : PiLp 2 fun i => V i), βͺv, wβ« = βͺeβ (eβ.symm v), eβ (eβ.symm w)β« by
intro vβ wβ
convert this (eβ (eβ.symm vβ)) (eβ (eβ.symm wβ)) <;>
simp only [LinearEquiv.symm_apply_apply, LinearEquiv.apply_symm_apply]
intro v w
trans βͺβ i, (V i).subtypeβα΅’ (v i), β i, (V i).subtypeβα΅’ (w i)β«
Β· simp only [sum_inner, hV'.inner_right_fintype, PiLp.inner_apply]
Β· congr <;> simp
#align direct_sum.is_internal.isometry_L2_of_orthogonal_family DirectSum.IsInternal.isometryL2OfOrthogonalFamily
@[simp]
theorem DirectSum.IsInternal.isometryL2OfOrthogonalFamily_symm_apply [DecidableEq ΞΉ]
{V : ΞΉ β Submodule π E} (hV : DirectSum.IsInternal V)
(hV' : OrthogonalFamily π (fun i => V i) fun i => (V i).subtypeβα΅’) (w : PiLp 2 fun i => V i) :
(hV.isometryL2OfOrthogonalFamily hV').symm w = β i, (w i : E) := by
classical
let eβ := DirectSum.linearEquivFunOnFintype π ΞΉ fun i => V i
let eβ := LinearEquiv.ofBijective (DirectSum.coeLinearMap V) hV
suffices β v : β¨ i, V i, eβ v = β i, eβ v i by exact this (eβ.symm w)
intro v
-- Porting note: added `DFinsupp.lsum`
simp [eβ, eβ, DirectSum.coeLinearMap, DirectSum.toModule, DFinsupp.lsum,
DFinsupp.sumAddHom_apply]
#align direct_sum.is_internal.isometry_L2_of_orthogonal_family_symm_apply DirectSum.IsInternal.isometryL2OfOrthogonalFamily_symm_apply
end
variable (ΞΉ π)
abbrev EuclideanSpace.equiv : EuclideanSpace π ΞΉ βL[π] ΞΉ β π :=
PiLp.continuousLinearEquiv 2 π _
#align euclidean_space.equiv EuclideanSpace.equiv
#noalign euclidean_space.equiv_to_linear_equiv_apply
#noalign euclidean_space.equiv_apply
#noalign euclidean_space.equiv_to_linear_equiv_symm_apply
#noalign euclidean_space.equiv_symm_apply
variable {ΞΉ π}
-- TODO : This should be generalized to `PiLp`.
@[simps!]
def EuclideanSpace.projβ (i : ΞΉ) : EuclideanSpace π ΞΉ ββ[π] π :=
(LinearMap.proj i).comp (WithLp.linearEquiv 2 π (ΞΉ β π) : EuclideanSpace π ΞΉ ββ[π] ΞΉ β π)
#align euclidean_space.projβ EuclideanSpace.projβ
#align euclidean_space.projβ_apply EuclideanSpace.projβ_apply
-- TODO : This should be generalized to `PiLp`.
@[simps! apply coe]
def EuclideanSpace.proj (i : ΞΉ) : EuclideanSpace π ΞΉ βL[π] π :=
β¨EuclideanSpace.projβ i, continuous_apply iβ©
#align euclidean_space.proj EuclideanSpace.proj
#align euclidean_space.proj_coe EuclideanSpace.proj_coe
#align euclidean_space.proj_apply EuclideanSpace.proj_apply
variable (ΞΉ π E)
variable [Fintype ΞΉ]
structure OrthonormalBasis where ofRepr ::
repr : E ββα΅’[π] EuclideanSpace π ΞΉ
#align orthonormal_basis OrthonormalBasis
#align orthonormal_basis.of_repr OrthonormalBasis.ofRepr
#align orthonormal_basis.repr OrthonormalBasis.repr
variable {ΞΉ π E}
instance OrthonormalBasis.instInhabited : Inhabited (OrthonormalBasis ΞΉ π (EuclideanSpace π ΞΉ)) :=
β¨EuclideanSpace.basisFun ΞΉ πβ©
#align orthonormal_basis.inhabited OrthonormalBasis.instInhabited
open FiniteDimensional
section ToMatrix
variable [DecidableEq ΞΉ]
section
variable (a b : OrthonormalBasis ΞΉ π E)
theorem OrthonormalBasis.toMatrix_orthonormalBasis_mem_unitary :
a.toBasis.toMatrix b β Matrix.unitaryGroup ΞΉ π := by
rw [Matrix.mem_unitaryGroup_iff']
ext i j
convert a.repr.inner_map_map (b i) (b j)
rw [orthonormal_iff_ite.mp b.orthonormal i j]
rfl
#align orthonormal_basis.to_matrix_orthonormal_basis_mem_unitary OrthonormalBasis.toMatrix_orthonormalBasis_mem_unitary
@[simp]
theorem OrthonormalBasis.det_to_matrix_orthonormalBasis : βa.toBasis.det bβ = 1 := by
have := (Matrix.det_of_mem_unitary (a.toMatrix_orthonormalBasis_mem_unitary b)).2
rw [star_def, RCLike.mul_conj] at this
norm_cast at this
rwa [pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero] at this
#align orthonormal_basis.det_to_matrix_orthonormal_basis OrthonormalBasis.det_to_matrix_orthonormalBasis
end
section FiniteDimensional
variable {v : Set E}
variable {A : ΞΉ β Submodule π E}
noncomputable def DirectSum.IsInternal.collectedOrthonormalBasis
(hV : OrthogonalFamily π (fun i => A i) fun i => (A i).subtypeβα΅’) [DecidableEq ΞΉ]
(hV_sum : DirectSum.IsInternal fun i => A i) {Ξ± : ΞΉ β Type*} [β i, Fintype (Ξ± i)]
(v_family : β i, OrthonormalBasis (Ξ± i) π (A i)) : OrthonormalBasis (Ξ£i, Ξ± i) π E :=
(hV_sum.collectedBasis fun i => (v_family i).toBasis).toOrthonormalBasis <| by
simpa using
hV.orthonormal_sigma_orthonormal (show β i, Orthonormal π (v_family i).toBasis by simp)
#align direct_sum.is_internal.collected_orthonormal_basis DirectSum.IsInternal.collectedOrthonormalBasis
| Mathlib/Analysis/InnerProductSpace/PiL2.lean | 787 | 792 | theorem DirectSum.IsInternal.collectedOrthonormalBasis_mem [DecidableEq ΞΉ]
(h : DirectSum.IsInternal A) {Ξ± : ΞΉ β Type*} [β i, Fintype (Ξ± i)]
(hV : OrthogonalFamily π (fun i => A i) fun i => (A i).subtypeβα΅’)
(v : β i, OrthonormalBasis (Ξ± i) π (A i)) (a : Ξ£i, Ξ± i) :
h.collectedOrthonormalBasis hV v a β A a.1 := by |
simp [DirectSum.IsInternal.collectedOrthonormalBasis]
|
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]
| Mathlib/Analysis/Convex/GaugeRescale.lean | 48 | 52 | 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'
|
import Mathlib.CategoryTheory.Sites.Sieves
#align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe w vβ vβ uβ uβ
namespace CategoryTheory
open Opposite CategoryTheory Category Limits Sieve
namespace Presieve
variable {C : Type uβ} [Category.{vβ} C]
variable {P Q U : Cα΅α΅ β₯€ Type w}
variable {X Y : C} {S : Sieve X} {R : Presieve X}
def FamilyOfElements (P : Cα΅α΅ β₯€ Type w) (R : Presieve X) :=
β β¦Y : Cβ¦ (f : Y βΆ X), R f β P.obj (op Y)
#align category_theory.presieve.family_of_elements CategoryTheory.Presieve.FamilyOfElements
instance : Inhabited (FamilyOfElements P (β₯ : Presieve X)) :=
β¨fun _ _ => False.elimβ©
def FamilyOfElements.restrict {Rβ Rβ : Presieve X} (h : Rβ β€ Rβ) :
FamilyOfElements P Rβ β FamilyOfElements P Rβ := fun x _ f hf => x f (h _ hf)
#align category_theory.presieve.family_of_elements.restrict CategoryTheory.Presieve.FamilyOfElements.restrict
def FamilyOfElements.map (p : FamilyOfElements P R) (Ο : P βΆ Q) :
FamilyOfElements Q R :=
fun _ f hf => Ο.app _ (p f hf)
@[simp]
lemma FamilyOfElements.map_apply
(p : FamilyOfElements P R) (Ο : P βΆ Q) {Y : C} (f : Y βΆ X) (hf : R f) :
p.map Ο f hf = Ο.app _ (p f hf) := rfl
lemma FamilyOfElements.restrict_map
(p : FamilyOfElements P R) (Ο : P βΆ Q) {R' : Presieve X} (h : R' β€ R) :
(p.restrict h).map Ο = (p.map Ο).restrict h := rfl
def FamilyOfElements.Compatible (x : FamilyOfElements P R) : Prop :=
β β¦Yβ Yβ Zβ¦ (gβ : Z βΆ Yβ) (gβ : Z βΆ Yβ) β¦fβ : Yβ βΆ Xβ¦ β¦fβ : Yβ βΆ Xβ¦ (hβ : R fβ) (hβ : R fβ),
gβ β« fβ = gβ β« fβ β P.map gβ.op (x fβ hβ) = P.map gβ.op (x fβ hβ)
#align category_theory.presieve.family_of_elements.compatible CategoryTheory.Presieve.FamilyOfElements.Compatible
def FamilyOfElements.PullbackCompatible (x : FamilyOfElements P R) [R.hasPullbacks] : Prop :=
β β¦Yβ Yββ¦ β¦fβ : Yβ βΆ Xβ¦ β¦fβ : Yβ βΆ Xβ¦ (hβ : R fβ) (hβ : R fβ),
haveI := hasPullbacks.has_pullbacks hβ hβ
P.map (pullback.fst : Limits.pullback fβ fβ βΆ _).op (x fβ hβ) = P.map pullback.snd.op (x fβ hβ)
#align category_theory.presieve.family_of_elements.pullback_compatible CategoryTheory.Presieve.FamilyOfElements.PullbackCompatible
theorem pullbackCompatible_iff (x : FamilyOfElements P R) [R.hasPullbacks] :
x.Compatible β x.PullbackCompatible := by
constructor
Β· intro t Yβ Yβ fβ fβ hfβ hfβ
apply t
haveI := hasPullbacks.has_pullbacks hfβ hfβ
apply pullback.condition
Β· intro t Yβ Yβ Z gβ gβ fβ fβ hfβ hfβ comm
haveI := hasPullbacks.has_pullbacks hfβ hfβ
rw [β pullback.lift_fst _ _ comm, op_comp, FunctorToTypes.map_comp_apply, t hfβ hfβ,
β FunctorToTypes.map_comp_apply, β op_comp, pullback.lift_snd]
#align category_theory.presieve.pullback_compatible_iff CategoryTheory.Presieve.pullbackCompatible_iff
theorem FamilyOfElements.Compatible.restrict {Rβ Rβ : Presieve X} (h : Rβ β€ Rβ)
{x : FamilyOfElements P Rβ} : x.Compatible β (x.restrict h).Compatible :=
fun q _ _ _ gβ gβ _ _ hβ hβ comm => q gβ gβ (h _ hβ) (h _ hβ) comm
#align category_theory.presieve.family_of_elements.compatible.restrict CategoryTheory.Presieve.FamilyOfElements.Compatible.restrict
noncomputable def FamilyOfElements.sieveExtend (x : FamilyOfElements P R) :
FamilyOfElements P (generate R : Presieve X) := fun _ _ hf =>
P.map hf.choose_spec.choose.op (x _ hf.choose_spec.choose_spec.choose_spec.1)
#align category_theory.presieve.family_of_elements.sieve_extend CategoryTheory.Presieve.FamilyOfElements.sieveExtend
theorem FamilyOfElements.Compatible.sieveExtend {x : FamilyOfElements P R} (hx : x.Compatible) :
x.sieveExtend.Compatible := by
intro _ _ _ _ _ _ _ hβ hβ comm
iterate 2 erw [β FunctorToTypes.map_comp_apply]; rw [β op_comp]
apply hx
simp [comm, hβ.choose_spec.choose_spec.choose_spec.2, hβ.choose_spec.choose_spec.choose_spec.2]
#align category_theory.presieve.family_of_elements.compatible.sieve_extend CategoryTheory.Presieve.FamilyOfElements.Compatible.sieveExtend
| Mathlib/CategoryTheory/Sites/IsSheafFor.lean | 195 | 202 | theorem extend_agrees {x : FamilyOfElements P R} (t : x.Compatible) {f : Y βΆ X} (hf : R f) :
x.sieveExtend f (le_generate R Y hf) = x f hf := by |
have h := (le_generate R Y hf).choose_spec
unfold FamilyOfElements.sieveExtend
rw [t h.choose (π _) _ hf _]
Β· simp
Β· rw [id_comp]
exact h.choose_spec.choose_spec.2
|
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Algebra.Ring.Subsemiring.Basic
#align_import ring_theory.subring.basic from "leanprover-community/mathlib"@"b915e9392ecb2a861e1e766f0e1df6ac481188ca"
universe u v w
variable {R : Type u} {S : Type v} {T : Type w} [Ring R]
namespace Subring
instance : Bot (Subring R) :=
β¨(Int.castRingHom R).rangeβ©
instance : Inhabited (Subring R) :=
β¨β₯β©
theorem coe_bot : ((β₯ : Subring R) : Set R) = Set.range ((β) : β€ β R) :=
RingHom.coe_range (Int.castRingHom R)
#align subring.coe_bot Subring.coe_bot
theorem mem_bot {x : R} : x β (β₯ : Subring R) β β n : β€, βn = x :=
RingHom.mem_range
#align subring.mem_bot Subring.mem_bot
instance : Inf (Subring R) :=
β¨fun s t =>
{ s.toSubmonoid β t.toSubmonoid, s.toAddSubgroup β t.toAddSubgroup with carrier := s β© t }β©
@[simp]
theorem coe_inf (p p' : Subring R) : ((p β p' : Subring R) : Set R) = (p : Set R) β© p' :=
rfl
#align subring.coe_inf Subring.coe_inf
@[simp]
theorem mem_inf {p p' : Subring R} {x : R} : x β p β p' β x β p β§ x β p' :=
Iff.rfl
#align subring.mem_inf Subring.mem_inf
instance : InfSet (Subring R) :=
β¨fun s =>
Subring.mk' (β t β s, βt) (β¨
t β s, t.toSubmonoid) (β¨
t β s, Subring.toAddSubgroup t)
(by simp) (by simp)β©
@[simp, norm_cast]
theorem coe_sInf (S : Set (Subring R)) : ((sInf S : Subring R) : Set R) = β s β S, βs :=
rfl
#align subring.coe_Inf Subring.coe_sInf
theorem mem_sInf {S : Set (Subring R)} {x : R} : x β sInf S β β p β S, x β p :=
Set.mem_iInterβ
#align subring.mem_Inf Subring.mem_sInf
@[simp, norm_cast]
theorem coe_iInf {ΞΉ : Sort*} {S : ΞΉ β Subring R} : (β(β¨
i, S i) : Set R) = β i, S i := by
simp only [iInf, coe_sInf, Set.biInter_range]
#align subring.coe_infi Subring.coe_iInf
theorem mem_iInf {ΞΉ : Sort*} {S : ΞΉ β Subring R} {x : R} : (x β β¨
i, S i) β β i, x β S i := by
simp only [iInf, mem_sInf, Set.forall_mem_range]
#align subring.mem_infi Subring.mem_iInf
@[simp]
theorem sInf_toSubmonoid (s : Set (Subring R)) :
(sInf s).toSubmonoid = β¨
t β s, t.toSubmonoid :=
mk'_toSubmonoid _ _
#align subring.Inf_to_submonoid Subring.sInf_toSubmonoid
@[simp]
theorem sInf_toAddSubgroup (s : Set (Subring R)) :
(sInf s).toAddSubgroup = β¨
t β s, Subring.toAddSubgroup t :=
mk'_toAddSubgroup _ _
#align subring.Inf_to_add_subgroup Subring.sInf_toAddSubgroup
instance : CompleteLattice (Subring R) :=
{ completeLatticeOfInf (Subring R) fun _ =>
IsGLB.of_image SetLike.coe_subset_coe isGLB_biInf with
bot := β₯
bot_le := fun s _x hx =>
let β¨n, hnβ© := mem_bot.1 hx
hn βΈ intCast_mem s n
top := β€
le_top := fun _s _x _hx => trivial
inf := (Β· β Β·)
inf_le_left := fun _s _t _x => And.left
inf_le_right := fun _s _t _x => And.right
le_inf := fun _s _tβ _tβ hβ hβ _x hx => β¨hβ hx, hβ hxβ© }
theorem eq_top_iff' (A : Subring R) : A = β€ β β x : R, x β A :=
eq_top_iff.trans β¨fun h m => h <| mem_top m, fun h m _ => h mβ©
#align subring.eq_top_iff' Subring.eq_top_iff'
section
variable (R)
def center : Subring R :=
{ Subsemiring.center R with
carrier := Set.center R
neg_mem' := Set.neg_mem_center }
#align subring.center Subring.center
theorem coe_center : β(center R) = Set.center R :=
rfl
#align subring.coe_center Subring.coe_center
@[simp]
theorem center_toSubsemiring : (center R).toSubsemiring = Subsemiring.center R :=
rfl
#align subring.center_to_subsemiring Subring.center_toSubsemiring
variable {R}
theorem mem_center_iff {z : R} : z β center R β β g, g * z = z * g :=
Subsemigroup.mem_center_iff
#align subring.mem_center_iff Subring.mem_center_iff
instance decidableMemCenter [DecidableEq R] [Fintype R] : DecidablePred (Β· β center R) := fun _ =>
decidable_of_iff' _ mem_center_iff
#align subring.decidable_mem_center Subring.decidableMemCenter
@[simp]
theorem center_eq_top (R) [CommRing R] : center R = β€ :=
SetLike.coe_injective (Set.center_eq_univ R)
#align subring.center_eq_top Subring.center_eq_top
instance : CommRing (center R) :=
{ inferInstanceAs (CommSemiring (Subsemiring.center R)), (center R).toRing with }
end
def closure (s : Set R) : Subring R :=
sInf { S | s β S }
#align subring.closure Subring.closure
theorem mem_closure {x : R} {s : Set R} : x β closure s β β S : Subring R, s β S β x β S :=
mem_sInf
#align subring.mem_closure Subring.mem_closure
@[simp, aesop safe 20 apply (rule_sets := [SetLike])]
theorem subset_closure {s : Set R} : s β closure s := fun _ hx => mem_closure.2 fun _ hS => hS hx
#align subring.subset_closure Subring.subset_closure
theorem not_mem_of_not_mem_closure {s : Set R} {P : R} (hP : P β closure s) : P β s := fun h =>
hP (subset_closure h)
#align subring.not_mem_of_not_mem_closure Subring.not_mem_of_not_mem_closure
@[simp]
theorem closure_le {s : Set R} {t : Subring R} : closure s β€ t β s β t :=
β¨Set.Subset.trans subset_closure, fun h => sInf_le hβ©
#align subring.closure_le Subring.closure_le
theorem closure_mono β¦s t : Set Rβ¦ (h : s β t) : closure s β€ closure t :=
closure_le.2 <| Set.Subset.trans h subset_closure
#align subring.closure_mono Subring.closure_mono
theorem closure_eq_of_le {s : Set R} {t : Subring R} (hβ : s β t) (hβ : t β€ closure s) :
closure s = t :=
le_antisymm (closure_le.2 hβ) hβ
#align subring.closure_eq_of_le Subring.closure_eq_of_le
@[elab_as_elim]
theorem closure_induction {s : Set R} {p : R β Prop} {x} (h : x β closure s) (Hs : β x β s, p x)
(zero : p 0) (one : p 1) (add : β x y, p x β p y β p (x + y)) (neg : β x : R, p x β p (-x))
(mul : β x y, p x β p y β p (x * y)) : p x :=
(@closure_le _ _ _ β¨β¨β¨β¨p, @mulβ©, oneβ©, @add, zeroβ©, @negβ©).2 Hs h
#align subring.closure_induction Subring.closure_induction
@[elab_as_elim]
theorem closure_induction' {s : Set R} {p : β x, x β closure s β Prop}
(mem : β (x) (h : x β s), p x (subset_closure h))
(zero : p 0 (zero_mem _)) (one : p 1 (one_mem _))
(add : β x hx y hy, p x hx β p y hy β p (x + y) (add_mem hx hy))
(neg : β x hx, p x hx β p (-x) (neg_mem hx))
(mul : β x hx y hy, p x hx β p y hy β p (x * y) (mul_mem hx hy))
{a : R} (ha : a β closure s) : p a ha := by
refine Exists.elim ?_ fun (ha : a β closure s) (hc : p a ha) => hc
refine
closure_induction ha (fun m hm => β¨subset_closure hm, mem m hmβ©) β¨zero_mem _, zeroβ©
β¨one_mem _, oneβ© ?_ (fun x hx => hx.elim fun hx' hx => β¨neg_mem hx', neg _ _ hxβ©) ?_
Β· exact (fun x y hx hy => hx.elim fun hx' hx => hy.elim fun hy' hy =>
β¨add_mem hx' hy', add _ _ _ _ hx hyβ©)
Β· exact (fun x y hx hy => hx.elim fun hx' hx => hy.elim fun hy' hy =>
β¨mul_mem hx' hy', mul _ _ _ _ hx hyβ©)
@[elab_as_elim]
theorem closure_inductionβ {s : Set R} {p : R β R β Prop} {a b : R} (ha : a β closure s)
(hb : b β closure s) (Hs : β x β s, β y β s, p x y) (H0_left : β x, p 0 x)
(H0_right : β x, p x 0) (H1_left : β x, p 1 x) (H1_right : β x, p x 1)
(Hneg_left : β x y, p x y β p (-x) y) (Hneg_right : β x y, p x y β p x (-y))
(Hadd_left : β xβ xβ y, p xβ y β p xβ y β p (xβ + xβ) y)
(Hadd_right : β x yβ yβ, p x yβ β p x yβ β p x (yβ + yβ))
(Hmul_left : β xβ xβ y, p xβ y β p xβ y β p (xβ * xβ) y)
(Hmul_right : β x yβ yβ, p x yβ β p x yβ β p x (yβ * yβ)) : p a b := by
refine
closure_induction hb ?_ (H0_right _) (H1_right _) (Hadd_right a) (Hneg_right a) (Hmul_right a)
refine closure_induction ha Hs (fun x _ => H0_left x) (fun x _ => H1_left x) ?_ ?_ ?_
Β· exact fun x y Hβ Hβ z zs => Hadd_left x y z (Hβ z zs) (Hβ z zs)
Β· exact fun x hx z zs => Hneg_left x z (hx z zs)
Β· exact fun x y Hβ Hβ z zs => Hmul_left x y z (Hβ z zs) (Hβ z zs)
#align subring.closure_inductionβ Subring.closure_inductionβ
| Mathlib/Algebra/Ring/Subring/Basic.lean | 919 | 946 | theorem mem_closure_iff {s : Set R} {x} :
x β closure s β x β AddSubgroup.closure (Submonoid.closure s : Set R) :=
β¨fun h =>
closure_induction h (fun x hx => AddSubgroup.subset_closure <| Submonoid.subset_closure hx)
(AddSubgroup.zero_mem _)
(AddSubgroup.subset_closure (Submonoid.one_mem (Submonoid.closure s)))
(fun x y hx hy => AddSubgroup.add_mem _ hx hy) (fun x hx => AddSubgroup.neg_mem _ hx)
fun x y hx hy =>
AddSubgroup.closure_induction hy
(fun q hq =>
AddSubgroup.closure_induction hx
(fun p hp => AddSubgroup.subset_closure ((Submonoid.closure s).mul_mem hp hq))
(by rw [zero_mul q]; apply AddSubgroup.zero_mem _)
(fun pβ pβ ihpβ ihpβ => by rw [add_mul pβ pβ q]; apply AddSubgroup.add_mem _ ihpβ ihpβ)
fun x hx => by
have f : -x * q = -(x * q) := by | simp
rw [f]; apply AddSubgroup.neg_mem _ hx)
(by rw [mul_zero x]; apply AddSubgroup.zero_mem _)
(fun qβ qβ ihqβ ihqβ => by rw [mul_add x qβ qβ]; apply AddSubgroup.add_mem _ ihqβ ihqβ)
fun z hz => by
have f : x * -z = -(x * z) := by simp
rw [f]; apply AddSubgroup.neg_mem _ hz,
fun h =>
AddSubgroup.closure_induction (p := (Β· β closure s)) h
(fun x hx =>
Submonoid.closure_induction hx (fun x hx => subset_closure hx) (one_mem _) fun x y hx hy =>
mul_mem hx hy)
(zero_mem _) (fun x y hx hy => add_mem hx hy) fun x hx => neg_mem hxβ©
|
import Mathlib.Init.Data.Prod
import Mathlib.Data.Seq.WSeq
#align_import data.seq.parallel from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
universe u v
namespace Computation
open Stream'
variable {Ξ± : Type u} {Ξ² : Type v}
def parallel.aux2 : List (Computation Ξ±) β Sum Ξ± (List (Computation Ξ±)) :=
List.foldr
(fun c o =>
match o with
| Sum.inl a => Sum.inl a
| Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
(Sum.inr [])
#align computation.parallel.aux2 Computation.parallel.aux2
def parallel.aux1 :
List (Computation Ξ±) Γ WSeq (Computation Ξ±) β
Sum Ξ± (List (Computation Ξ±) Γ WSeq (Computation Ξ±))
| (l, S) =>
rmap
(fun l' =>
match Seq.destruct S with
| none => (l', Seq.nil)
| some (none, S') => (l', S')
| some (some c, S') => (c :: l', S'))
(parallel.aux2 l)
#align computation.parallel.aux1 Computation.parallel.aux1
def parallel (S : WSeq (Computation Ξ±)) : Computation Ξ± :=
corec parallel.aux1 ([], S)
#align computation.parallel Computation.parallel
theorem terminates_parallel.aux :
β {l : List (Computation Ξ±)} {S c},
c β l β Terminates c β Terminates (corec parallel.aux1 (l, S)) := by
have lem1 :
β l S, (β a : Ξ±, parallel.aux2 l = Sum.inl a) β Terminates (corec parallel.aux1 (l, S)) := by
intro l S e
cases' e with a e
have : corec parallel.aux1 (l, S) = return a := by
apply destruct_eq_pure
simp only [parallel.aux1, rmap, corec_eq]
rw [e]
rw [this]
-- Porting note: This line is required.
exact ret_terminates a
intro l S c m T
revert l S
apply @terminatesRecOn _ _ c T _ _
Β· intro a l S m
apply lem1
induction' l with c l IH <;> simp at m
cases' m with e m
Β· rw [β e]
simp only [parallel.aux2, rmap, List.foldr_cons, destruct_pure]
split <;> simp
Β· cases' IH m with a' e
simp only [parallel.aux2, rmap, List.foldr_cons]
simp? [parallel.aux2] at e says simp only [parallel.aux2, rmap] at e
rw [e]
exact β¨a', rflβ©
Β· intro s IH l S m
have H1 : β l', parallel.aux2 l = Sum.inr l' β s β l' := by
induction' l with c l IH' <;> intro l' e' <;> simp at m
cases' m with e m <;> simp [parallel.aux2] at e'
Β· rw [β e] at e'
-- Porting note: `revert e'` & `intro e'` are required.
revert e'
split
Β· simp
Β· simp only [destruct_think, Sum.inr.injEq]
rintro rfl
simp
Β· induction' e : List.foldr (fun c o =>
match o with
| Sum.inl a => Sum.inl a
| Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c))
(Sum.inr List.nil) l with a' ls <;> erw [e] at e'
Β· contradiction
have := IH' m _ e
-- Porting note: `revert e'` & `intro e'` are required.
revert e'
cases destruct c <;> intro e' <;> [injection e'; injection e' with h']
rw [β h']
simp [this]
induction' h : parallel.aux2 l with a l'
Β· exact lem1 _ _ β¨a, hβ©
Β· have H2 : corec parallel.aux1 (l, S) = think _ := destruct_eq_think (by
simp only [parallel.aux1, rmap, corec_eq]
rw [h])
rw [H2]
refine @Computation.think_terminates _ _ ?_
have := H1 _ h
rcases Seq.destruct S with (_ | β¨_ | c, S'β©) <;> simp [parallel.aux1] <;> apply IH <;>
simp [this]
#align computation.terminates_parallel.aux Computation.terminates_parallel.aux
theorem terminates_parallel {S : WSeq (Computation Ξ±)} {c} (h : c β S) [T : Terminates c] :
Terminates (parallel S) := by
suffices
β (n) (l : List (Computation Ξ±)) (S c),
c β l β¨ some (some c) = Seq.get? S n β Terminates c β Terminates (corec parallel.aux1 (l, S))
from
let β¨n, hβ© := h
this n [] S c (Or.inr h) T
intro n; induction' n with n IH <;> intro l S c o T
Β· cases' o with a a
Β· exact terminates_parallel.aux a T
have H : Seq.destruct S = some (some c, Seq.tail S) := by simp [Seq.destruct, (Β· <$> Β·), β a]
induction' h : parallel.aux2 l with a l'
Β· have C : corec parallel.aux1 (l, S) = pure a := by
apply destruct_eq_pure
rw [corec_eq, parallel.aux1]
dsimp only []
rw [h]
simp only [rmap]
rw [C]
infer_instance
Β· have C : corec parallel.aux1 (l, S) = _ := destruct_eq_think (by
simp only [corec_eq, rmap, parallel.aux1.eq_1]
rw [h, H])
rw [C]
refine @Computation.think_terminates _ _ ?_
apply terminates_parallel.aux _ T
simp
Β· cases' o with a a
Β· exact terminates_parallel.aux a T
induction' h : parallel.aux2 l with a l'
Β· have C : corec parallel.aux1 (l, S) = pure a := by
apply destruct_eq_pure
rw [corec_eq, parallel.aux1]
dsimp only []
rw [h]
simp only [rmap]
rw [C]
infer_instance
Β· have C : corec parallel.aux1 (l, S) = _ := destruct_eq_think (by
simp only [corec_eq, rmap, parallel.aux1.eq_1]
rw [h])
rw [C]
refine @Computation.think_terminates _ _ ?_
have TT : β l', Terminates (corec parallel.aux1 (l', S.tail)) := by
intro
apply IH _ _ _ (Or.inr _) T
rw [a]
cases' S with f al
rfl
induction' e : Seq.get? S 0 with o
Β· have D : Seq.destruct S = none := by
dsimp [Seq.destruct]
rw [e]
rfl
rw [D]
simp only
have TT := TT l'
rwa [Seq.destruct_eq_nil D, Seq.tail_nil] at TT
Β· have D : Seq.destruct S = some (o, S.tail) := by
dsimp [Seq.destruct]
rw [e]
rfl
rw [D]
cases' o with c <;> simp [parallel.aux1, TT]
#align computation.terminates_parallel Computation.terminates_parallel
| Mathlib/Data/Seq/Parallel.lean | 189 | 266 | theorem exists_of_mem_parallel {S : WSeq (Computation Ξ±)} {a} (h : a β parallel S) :
β c β S, a β c := by |
suffices
β C, a β C β β (l : List (Computation Ξ±)) (S),
corec parallel.aux1 (l, S) = C β β c, (c β l β¨ c β S) β§ a β c from
let β¨c, h1, h2β© := this _ h [] S rfl
β¨c, h1.resolve_left <| List.not_mem_nil _, h2β©
let F : List (Computation Ξ±) β Sum Ξ± (List (Computation Ξ±)) β Prop := by
intro l a
cases' a with a l'
Β· exact β c β l, a β c
Β· exact β a', (β c β l', a' β c) β β c β l, a' β c
have lem1 : β l : List (Computation Ξ±), F l (parallel.aux2 l) := by
intro l
induction' l with c l IH <;> simp only [parallel.aux2, List.foldr]
Β· intro a h
rcases h with β¨c, hn, _β©
exact False.elim <| List.not_mem_nil _ hn
Β· simp only [parallel.aux2] at IH
-- Porting note: `revert IH` & `intro IH` are required.
revert IH
cases' List.foldr (fun c o =>
match o with
| Sum.inl a => Sum.inl a
| Sum.inr ls => rmap (fun c' => c' :: ls) (destruct c)) (Sum.inr List.nil) l with a ls <;>
intro IH <;>
simp only [parallel.aux2]
Β· rcases IH with β¨c', cl, acβ©
exact β¨c', List.Mem.tail _ cl, acβ©
Β· induction' h : destruct c with a c' <;> simp only [rmap]
Β· refine β¨c, List.mem_cons_self _ _, ?_β©
rw [destruct_eq_pure h]
apply ret_mem
Β· intro a' h
rcases h with β¨d, dm, adβ©
simp? at dm says simp only [List.mem_cons] at dm
cases' dm with e dl
Β· rw [e] at ad
refine β¨c, List.mem_cons_self _ _, ?_β©
rw [destruct_eq_think h]
exact think_mem ad
Β· cases' IH a' β¨d, dl, adβ© with d dm
cases' dm with dm ad
exact β¨d, List.Mem.tail _ dm, adβ©
intro C aC
-- Porting note: `revert e'` & `intro e'` are required.
apply memRecOn aC <;> [skip; intro C' IH] <;> intro l S e <;> have e' := congr_arg destruct e <;>
have := lem1 l <;> simp only [parallel.aux1, corec_eq, destruct_pure, destruct_think] at e' <;>
revert this e' <;> cases' parallel.aux2 l with a' l' <;> intro this e' <;>
[injection e' with h'; injection e'; injection e'; injection e' with h']
Β· rw [h'] at this
rcases this with β¨c, cl, acβ©
exact β¨c, Or.inl cl, acβ©
Β· induction' e : Seq.destruct S with a <;> rw [e] at h'
Β· exact
let β¨d, o, adβ© := IH _ _ h'
let β¨c, cl, acβ© := this a β¨d, o.resolve_right (WSeq.not_mem_nil _), adβ©
β¨c, Or.inl cl, acβ©
Β· cases' a with o S'
cases' o with c <;> simp [parallel.aux1] at h' <;> rcases IH _ _ h' with β¨d, dl | dS', adβ©
Β· exact
let β¨c, cl, acβ© := this a β¨d, dl, adβ©
β¨c, Or.inl cl, acβ©
Β· refine β¨d, Or.inr ?_, adβ©
rw [Seq.destruct_eq_cons e]
exact Seq.mem_cons_of_mem _ dS'
Β· simp at dl
cases' dl with dc dl
Β· rw [dc] at ad
refine β¨c, Or.inr ?_, adβ©
rw [Seq.destruct_eq_cons e]
apply Seq.mem_cons
Β· exact
let β¨c, cl, acβ© := this a β¨d, dl, adβ©
β¨c, Or.inl cl, acβ©
Β· refine β¨d, Or.inr ?_, adβ©
rw [Seq.destruct_eq_cons e]
exact Seq.mem_cons_of_mem _ dS'
|
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Tactic.Positivity.Core
import Mathlib.Algebra.Ring.NegOnePow
#align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical
open Topology Filter Set
namespace Real
open Real
@[simp]
theorem sin_pi : sin Ο = 0 := by
rw [β mul_div_cancel_leftβ Ο (two_ne_zero' β), two_mul, add_div, sin_add, cos_pi_div_two]; simp
#align real.sin_pi Real.sin_pi
@[simp]
theorem cos_pi : cos Ο = -1 := by
rw [β mul_div_cancel_leftβ Ο (two_ne_zero' β), mul_div_assoc, cos_two_mul, cos_pi_div_two]
norm_num
#align real.cos_pi Real.cos_pi
@[simp]
theorem sin_two_pi : sin (2 * Ο) = 0 := by simp [two_mul, sin_add]
#align real.sin_two_pi Real.sin_two_pi
@[simp]
theorem cos_two_pi : cos (2 * Ο) = 1 := by simp [two_mul, cos_add]
#align real.cos_two_pi Real.cos_two_pi
theorem sin_antiperiodic : Function.Antiperiodic sin Ο := by simp [sin_add]
#align real.sin_antiperiodic Real.sin_antiperiodic
theorem sin_periodic : Function.Periodic sin (2 * Ο) :=
sin_antiperiodic.periodic_two_mul
#align real.sin_periodic Real.sin_periodic
@[simp]
theorem sin_add_pi (x : β) : sin (x + Ο) = -sin x :=
sin_antiperiodic x
#align real.sin_add_pi Real.sin_add_pi
@[simp]
theorem sin_add_two_pi (x : β) : sin (x + 2 * Ο) = sin x :=
sin_periodic x
#align real.sin_add_two_pi Real.sin_add_two_pi
@[simp]
theorem sin_sub_pi (x : β) : sin (x - Ο) = -sin x :=
sin_antiperiodic.sub_eq x
#align real.sin_sub_pi Real.sin_sub_pi
@[simp]
theorem sin_sub_two_pi (x : β) : sin (x - 2 * Ο) = sin x :=
sin_periodic.sub_eq x
#align real.sin_sub_two_pi Real.sin_sub_two_pi
@[simp]
theorem sin_pi_sub (x : β) : sin (Ο - x) = sin x :=
neg_neg (sin x) βΈ sin_neg x βΈ sin_antiperiodic.sub_eq'
#align real.sin_pi_sub Real.sin_pi_sub
@[simp]
theorem sin_two_pi_sub (x : β) : sin (2 * Ο - x) = -sin x :=
sin_neg x βΈ sin_periodic.sub_eq'
#align real.sin_two_pi_sub Real.sin_two_pi_sub
@[simp]
theorem sin_nat_mul_pi (n : β) : sin (n * Ο) = 0 :=
sin_antiperiodic.nat_mul_eq_of_eq_zero sin_zero n
#align real.sin_nat_mul_pi Real.sin_nat_mul_pi
@[simp]
theorem sin_int_mul_pi (n : β€) : sin (n * Ο) = 0 :=
sin_antiperiodic.int_mul_eq_of_eq_zero sin_zero n
#align real.sin_int_mul_pi Real.sin_int_mul_pi
@[simp]
theorem sin_add_nat_mul_two_pi (x : β) (n : β) : sin (x + n * (2 * Ο)) = sin x :=
sin_periodic.nat_mul n x
#align real.sin_add_nat_mul_two_pi Real.sin_add_nat_mul_two_pi
@[simp]
theorem sin_add_int_mul_two_pi (x : β) (n : β€) : sin (x + n * (2 * Ο)) = sin x :=
sin_periodic.int_mul n x
#align real.sin_add_int_mul_two_pi Real.sin_add_int_mul_two_pi
@[simp]
theorem sin_sub_nat_mul_two_pi (x : β) (n : β) : sin (x - n * (2 * Ο)) = sin x :=
sin_periodic.sub_nat_mul_eq n
#align real.sin_sub_nat_mul_two_pi Real.sin_sub_nat_mul_two_pi
@[simp]
theorem sin_sub_int_mul_two_pi (x : β) (n : β€) : sin (x - n * (2 * Ο)) = sin x :=
sin_periodic.sub_int_mul_eq n
#align real.sin_sub_int_mul_two_pi Real.sin_sub_int_mul_two_pi
@[simp]
theorem sin_nat_mul_two_pi_sub (x : β) (n : β) : sin (n * (2 * Ο) - x) = -sin x :=
sin_neg x βΈ sin_periodic.nat_mul_sub_eq n
#align real.sin_nat_mul_two_pi_sub Real.sin_nat_mul_two_pi_sub
@[simp]
theorem sin_int_mul_two_pi_sub (x : β) (n : β€) : sin (n * (2 * Ο) - x) = -sin x :=
sin_neg x βΈ sin_periodic.int_mul_sub_eq n
#align real.sin_int_mul_two_pi_sub Real.sin_int_mul_two_pi_sub
theorem sin_add_int_mul_pi (x : β) (n : β€) : sin (x + n * Ο) = (-1) ^ n * sin x :=
n.coe_negOnePow β βΈ sin_antiperiodic.add_int_mul_eq n
theorem sin_add_nat_mul_pi (x : β) (n : β) : sin (x + n * Ο) = (-1) ^ n * sin x :=
sin_antiperiodic.add_nat_mul_eq n
theorem sin_sub_int_mul_pi (x : β) (n : β€) : sin (x - n * Ο) = (-1) ^ n * sin x :=
n.coe_negOnePow β βΈ sin_antiperiodic.sub_int_mul_eq n
theorem sin_sub_nat_mul_pi (x : β) (n : β) : sin (x - n * Ο) = (-1) ^ n * sin x :=
sin_antiperiodic.sub_nat_mul_eq n
theorem sin_int_mul_pi_sub (x : β) (n : β€) : sin (n * Ο - x) = -((-1) ^ n * sin x) := by
simpa only [sin_neg, mul_neg, Int.coe_negOnePow] using sin_antiperiodic.int_mul_sub_eq n
theorem sin_nat_mul_pi_sub (x : β) (n : β) : sin (n * Ο - x) = -((-1) ^ n * sin x) := by
simpa only [sin_neg, mul_neg] using sin_antiperiodic.nat_mul_sub_eq n
theorem cos_antiperiodic : Function.Antiperiodic cos Ο := by simp [cos_add]
#align real.cos_antiperiodic Real.cos_antiperiodic
theorem cos_periodic : Function.Periodic cos (2 * Ο) :=
cos_antiperiodic.periodic_two_mul
#align real.cos_periodic Real.cos_periodic
@[simp]
theorem cos_add_pi (x : β) : cos (x + Ο) = -cos x :=
cos_antiperiodic x
#align real.cos_add_pi Real.cos_add_pi
@[simp]
theorem cos_add_two_pi (x : β) : cos (x + 2 * Ο) = cos x :=
cos_periodic x
#align real.cos_add_two_pi Real.cos_add_two_pi
@[simp]
theorem cos_sub_pi (x : β) : cos (x - Ο) = -cos x :=
cos_antiperiodic.sub_eq x
#align real.cos_sub_pi Real.cos_sub_pi
@[simp]
theorem cos_sub_two_pi (x : β) : cos (x - 2 * Ο) = cos x :=
cos_periodic.sub_eq x
#align real.cos_sub_two_pi Real.cos_sub_two_pi
@[simp]
theorem cos_pi_sub (x : β) : cos (Ο - x) = -cos x :=
cos_neg x βΈ cos_antiperiodic.sub_eq'
#align real.cos_pi_sub Real.cos_pi_sub
@[simp]
theorem cos_two_pi_sub (x : β) : cos (2 * Ο - x) = cos x :=
cos_neg x βΈ cos_periodic.sub_eq'
#align real.cos_two_pi_sub Real.cos_two_pi_sub
@[simp]
theorem cos_nat_mul_two_pi (n : β) : cos (n * (2 * Ο)) = 1 :=
(cos_periodic.nat_mul_eq n).trans cos_zero
#align real.cos_nat_mul_two_pi Real.cos_nat_mul_two_pi
@[simp]
theorem cos_int_mul_two_pi (n : β€) : cos (n * (2 * Ο)) = 1 :=
(cos_periodic.int_mul_eq n).trans cos_zero
#align real.cos_int_mul_two_pi Real.cos_int_mul_two_pi
@[simp]
theorem cos_add_nat_mul_two_pi (x : β) (n : β) : cos (x + n * (2 * Ο)) = cos x :=
cos_periodic.nat_mul n x
#align real.cos_add_nat_mul_two_pi Real.cos_add_nat_mul_two_pi
@[simp]
theorem cos_add_int_mul_two_pi (x : β) (n : β€) : cos (x + n * (2 * Ο)) = cos x :=
cos_periodic.int_mul n x
#align real.cos_add_int_mul_two_pi Real.cos_add_int_mul_two_pi
@[simp]
theorem cos_sub_nat_mul_two_pi (x : β) (n : β) : cos (x - n * (2 * Ο)) = cos x :=
cos_periodic.sub_nat_mul_eq n
#align real.cos_sub_nat_mul_two_pi Real.cos_sub_nat_mul_two_pi
@[simp]
theorem cos_sub_int_mul_two_pi (x : β) (n : β€) : cos (x - n * (2 * Ο)) = cos x :=
cos_periodic.sub_int_mul_eq n
#align real.cos_sub_int_mul_two_pi Real.cos_sub_int_mul_two_pi
@[simp]
theorem cos_nat_mul_two_pi_sub (x : β) (n : β) : cos (n * (2 * Ο) - x) = cos x :=
cos_neg x βΈ cos_periodic.nat_mul_sub_eq n
#align real.cos_nat_mul_two_pi_sub Real.cos_nat_mul_two_pi_sub
@[simp]
theorem cos_int_mul_two_pi_sub (x : β) (n : β€) : cos (n * (2 * Ο) - x) = cos x :=
cos_neg x βΈ cos_periodic.int_mul_sub_eq n
#align real.cos_int_mul_two_pi_sub Real.cos_int_mul_two_pi_sub
theorem cos_add_int_mul_pi (x : β) (n : β€) : cos (x + n * Ο) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_antiperiodic.add_int_mul_eq n
theorem cos_add_nat_mul_pi (x : β) (n : β) : cos (x + n * Ο) = (-1) ^ n * cos x :=
cos_antiperiodic.add_nat_mul_eq n
theorem cos_sub_int_mul_pi (x : β) (n : β€) : cos (x - n * Ο) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_antiperiodic.sub_int_mul_eq n
theorem cos_sub_nat_mul_pi (x : β) (n : β) : cos (x - n * Ο) = (-1) ^ n * cos x :=
cos_antiperiodic.sub_nat_mul_eq n
theorem cos_int_mul_pi_sub (x : β) (n : β€) : cos (n * Ο - x) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_neg x βΈ cos_antiperiodic.int_mul_sub_eq n
theorem cos_nat_mul_pi_sub (x : β) (n : β) : cos (n * Ο - x) = (-1) ^ n * cos x :=
cos_neg x βΈ cos_antiperiodic.nat_mul_sub_eq n
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_nat_mul_two_pi_add_pi (n : β) : cos (n * (2 * Ο) + Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.nat_mul n).add_antiperiod_eq cos_antiperiodic
#align real.cos_nat_mul_two_pi_add_pi Real.cos_nat_mul_two_pi_add_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_int_mul_two_pi_add_pi (n : β€) : cos (n * (2 * Ο) + Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.int_mul n).add_antiperiod_eq cos_antiperiodic
#align real.cos_int_mul_two_pi_add_pi Real.cos_int_mul_two_pi_add_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_nat_mul_two_pi_sub_pi (n : β) : cos (n * (2 * Ο) - Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.nat_mul n).sub_antiperiod_eq cos_antiperiodic
#align real.cos_nat_mul_two_pi_sub_pi Real.cos_nat_mul_two_pi_sub_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_int_mul_two_pi_sub_pi (n : β€) : cos (n * (2 * Ο) - Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.int_mul n).sub_antiperiod_eq cos_antiperiodic
#align real.cos_int_mul_two_pi_sub_pi Real.cos_int_mul_two_pi_sub_pi
theorem sin_pos_of_pos_of_lt_pi {x : β} (h0x : 0 < x) (hxp : x < Ο) : 0 < sin x :=
if hx2 : x β€ 2 then sin_pos_of_pos_of_le_two h0x hx2
else
have : (2 : β) + 2 = 4 := by norm_num
have : Ο - x β€ 2 :=
sub_le_iff_le_add.2 (le_trans pi_le_four (this βΈ add_le_add_left (le_of_not_ge hx2) _))
sin_pi_sub x βΈ sin_pos_of_pos_of_le_two (sub_pos.2 hxp) this
#align real.sin_pos_of_pos_of_lt_pi Real.sin_pos_of_pos_of_lt_pi
theorem sin_pos_of_mem_Ioo {x : β} (hx : x β Ioo 0 Ο) : 0 < sin x :=
sin_pos_of_pos_of_lt_pi hx.1 hx.2
#align real.sin_pos_of_mem_Ioo Real.sin_pos_of_mem_Ioo
theorem sin_nonneg_of_mem_Icc {x : β} (hx : x β Icc 0 Ο) : 0 β€ sin x := by
rw [β closure_Ioo pi_ne_zero.symm] at hx
exact
closure_lt_subset_le continuous_const continuous_sin
(closure_mono (fun y => sin_pos_of_mem_Ioo) hx)
#align real.sin_nonneg_of_mem_Icc Real.sin_nonneg_of_mem_Icc
theorem sin_nonneg_of_nonneg_of_le_pi {x : β} (h0x : 0 β€ x) (hxp : x β€ Ο) : 0 β€ sin x :=
sin_nonneg_of_mem_Icc β¨h0x, hxpβ©
#align real.sin_nonneg_of_nonneg_of_le_pi Real.sin_nonneg_of_nonneg_of_le_pi
theorem sin_neg_of_neg_of_neg_pi_lt {x : β} (hx0 : x < 0) (hpx : -Ο < x) : sin x < 0 :=
neg_pos.1 <| sin_neg x βΈ sin_pos_of_pos_of_lt_pi (neg_pos.2 hx0) (neg_lt.1 hpx)
#align real.sin_neg_of_neg_of_neg_pi_lt Real.sin_neg_of_neg_of_neg_pi_lt
theorem sin_nonpos_of_nonnpos_of_neg_pi_le {x : β} (hx0 : x β€ 0) (hpx : -Ο β€ x) : sin x β€ 0 :=
neg_nonneg.1 <| sin_neg x βΈ sin_nonneg_of_nonneg_of_le_pi (neg_nonneg.2 hx0) (neg_le.1 hpx)
#align real.sin_nonpos_of_nonnpos_of_neg_pi_le Real.sin_nonpos_of_nonnpos_of_neg_pi_le
@[simp]
theorem sin_pi_div_two : sin (Ο / 2) = 1 :=
have : sin (Ο / 2) = 1 β¨ sin (Ο / 2) = -1 := by
simpa [sq, mul_self_eq_one_iff] using sin_sq_add_cos_sq (Ο / 2)
this.resolve_right fun h =>
show Β¬(0 : β) < -1 by norm_num <|
h βΈ sin_pos_of_pos_of_lt_pi pi_div_two_pos (half_lt_self pi_pos)
#align real.sin_pi_div_two Real.sin_pi_div_two
theorem sin_add_pi_div_two (x : β) : sin (x + Ο / 2) = cos x := by simp [sin_add]
#align real.sin_add_pi_div_two Real.sin_add_pi_div_two
theorem sin_sub_pi_div_two (x : β) : sin (x - Ο / 2) = -cos x := by simp [sub_eq_add_neg, sin_add]
#align real.sin_sub_pi_div_two Real.sin_sub_pi_div_two
theorem sin_pi_div_two_sub (x : β) : sin (Ο / 2 - x) = cos x := by simp [sub_eq_add_neg, sin_add]
#align real.sin_pi_div_two_sub Real.sin_pi_div_two_sub
theorem cos_add_pi_div_two (x : β) : cos (x + Ο / 2) = -sin x := by simp [cos_add]
#align real.cos_add_pi_div_two Real.cos_add_pi_div_two
theorem cos_sub_pi_div_two (x : β) : cos (x - Ο / 2) = sin x := by simp [sub_eq_add_neg, cos_add]
#align real.cos_sub_pi_div_two Real.cos_sub_pi_div_two
theorem cos_pi_div_two_sub (x : β) : cos (Ο / 2 - x) = sin x := by
rw [β cos_neg, neg_sub, cos_sub_pi_div_two]
#align real.cos_pi_div_two_sub Real.cos_pi_div_two_sub
theorem cos_pos_of_mem_Ioo {x : β} (hx : x β Ioo (-(Ο / 2)) (Ο / 2)) : 0 < cos x :=
sin_add_pi_div_two x βΈ sin_pos_of_mem_Ioo β¨by linarith [hx.1], by linarith [hx.2]β©
#align real.cos_pos_of_mem_Ioo Real.cos_pos_of_mem_Ioo
theorem cos_nonneg_of_mem_Icc {x : β} (hx : x β Icc (-(Ο / 2)) (Ο / 2)) : 0 β€ cos x :=
sin_add_pi_div_two x βΈ sin_nonneg_of_mem_Icc β¨by linarith [hx.1], by linarith [hx.2]β©
#align real.cos_nonneg_of_mem_Icc Real.cos_nonneg_of_mem_Icc
theorem cos_nonneg_of_neg_pi_div_two_le_of_le {x : β} (hl : -(Ο / 2) β€ x) (hu : x β€ Ο / 2) :
0 β€ cos x :=
cos_nonneg_of_mem_Icc β¨hl, huβ©
#align real.cos_nonneg_of_neg_pi_div_two_le_of_le Real.cos_nonneg_of_neg_pi_div_two_le_of_le
theorem cos_neg_of_pi_div_two_lt_of_lt {x : β} (hxβ : Ο / 2 < x) (hxβ : x < Ο + Ο / 2) :
cos x < 0 :=
neg_pos.1 <| cos_pi_sub x βΈ cos_pos_of_mem_Ioo β¨by linarith, by linarithβ©
#align real.cos_neg_of_pi_div_two_lt_of_lt Real.cos_neg_of_pi_div_two_lt_of_lt
theorem cos_nonpos_of_pi_div_two_le_of_le {x : β} (hxβ : Ο / 2 β€ x) (hxβ : x β€ Ο + Ο / 2) :
cos x β€ 0 :=
neg_nonneg.1 <| cos_pi_sub x βΈ cos_nonneg_of_mem_Icc β¨by linarith, by linarithβ©
#align real.cos_nonpos_of_pi_div_two_le_of_le Real.cos_nonpos_of_pi_div_two_le_of_le
theorem sin_eq_sqrt_one_sub_cos_sq {x : β} (hl : 0 β€ x) (hu : x β€ Ο) :
sin x = β(1 - cos x ^ 2) := by
rw [β abs_sin_eq_sqrt_one_sub_cos_sq, abs_of_nonneg (sin_nonneg_of_nonneg_of_le_pi hl hu)]
#align real.sin_eq_sqrt_one_sub_cos_sq Real.sin_eq_sqrt_one_sub_cos_sq
theorem cos_eq_sqrt_one_sub_sin_sq {x : β} (hl : -(Ο / 2) β€ x) (hu : x β€ Ο / 2) :
cos x = β(1 - sin x ^ 2) := by
rw [β abs_cos_eq_sqrt_one_sub_sin_sq, abs_of_nonneg (cos_nonneg_of_mem_Icc β¨hl, huβ©)]
#align real.cos_eq_sqrt_one_sub_sin_sq Real.cos_eq_sqrt_one_sub_sin_sq
lemma cos_half {x : β} (hl : -Ο β€ x) (hr : x β€ Ο) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
have : 0 β€ cos (x / 2) := cos_nonneg_of_mem_Icc <| by constructor <;> linarith
rw [β sqrt_sq this, cos_sq, add_div, two_mul, add_halves]
lemma abs_sin_half (x : β) : |sin (x / 2)| = sqrt ((1 - cos x) / 2) := by
rw [β sqrt_sq_eq_abs, sin_sq_eq_half_sub, two_mul, add_halves, sub_div]
lemma sin_half_eq_sqrt {x : β} (hl : 0 β€ x) (hr : x β€ 2 * Ο) :
sin (x / 2) = sqrt ((1 - cos x) / 2) := by
rw [β abs_sin_half, abs_of_nonneg]
apply sin_nonneg_of_nonneg_of_le_pi <;> linarith
lemma sin_half_eq_neg_sqrt {x : β} (hl : -(2 * Ο) β€ x) (hr : x β€ 0) :
sin (x / 2) = -sqrt ((1 - cos x) / 2) := by
rw [β abs_sin_half, abs_of_nonpos, neg_neg]
apply sin_nonpos_of_nonnpos_of_neg_pi_le <;> linarith
theorem sin_eq_zero_iff_of_lt_of_lt {x : β} (hxβ : -Ο < x) (hxβ : x < Ο) : sin x = 0 β x = 0 :=
β¨fun h => by
contrapose! h
cases h.lt_or_lt with
| inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hxβ).ne
| inr h0 => exact (sin_pos_of_pos_of_lt_pi h0 hxβ).ne',
fun h => by simp [h]β©
#align real.sin_eq_zero_iff_of_lt_of_lt Real.sin_eq_zero_iff_of_lt_of_lt
theorem sin_eq_zero_iff {x : β} : sin x = 0 β β n : β€, (n : β) * Ο = x :=
β¨fun h =>
β¨βx / Οβ,
le_antisymm (sub_nonneg.1 (Int.sub_floor_div_mul_nonneg _ pi_pos))
(sub_nonpos.1 <|
le_of_not_gt fun hβ =>
(sin_pos_of_pos_of_lt_pi hβ (Int.sub_floor_div_mul_lt _ pi_pos)).ne
(by simp [sub_eq_add_neg, sin_add, h, sin_int_mul_pi]))β©,
fun β¨n, hnβ© => hn βΈ sin_int_mul_pi _β©
#align real.sin_eq_zero_iff Real.sin_eq_zero_iff
theorem sin_ne_zero_iff {x : β} : sin x β 0 β β n : β€, (n : β) * Ο β x := by
rw [β not_exists, not_iff_not, sin_eq_zero_iff]
#align real.sin_ne_zero_iff Real.sin_ne_zero_iff
theorem sin_eq_zero_iff_cos_eq {x : β} : sin x = 0 β cos x = 1 β¨ cos x = -1 := by
rw [β mul_self_eq_one_iff, β sin_sq_add_cos_sq x, sq, sq, β sub_eq_iff_eq_add, sub_self]
exact β¨fun h => by rw [h, mul_zero], eq_zero_of_mul_self_eq_zero β Eq.symmβ©
#align real.sin_eq_zero_iff_cos_eq Real.sin_eq_zero_iff_cos_eq
theorem cos_eq_one_iff (x : β) : cos x = 1 β β n : β€, (n : β) * (2 * Ο) = x :=
β¨fun h =>
let β¨n, hnβ© := sin_eq_zero_iff.1 (sin_eq_zero_iff_cos_eq.2 (Or.inl h))
β¨n / 2,
(Int.emod_two_eq_zero_or_one n).elim
(fun hn0 => by
rwa [β mul_assoc, β @Int.cast_two β, β Int.cast_mul,
Int.ediv_mul_cancel ((Int.dvd_iff_emod_eq_zero _ _).2 hn0)])
fun hn1 => by
rw [β Int.emod_add_ediv n 2, hn1, Int.cast_add, Int.cast_one, add_mul, one_mul, add_comm,
mul_comm (2 : β€), Int.cast_mul, mul_assoc, Int.cast_two] at hn
rw [β hn, cos_int_mul_two_pi_add_pi] at h
exact absurd h (by norm_num)β©,
fun β¨n, hnβ© => hn βΈ cos_int_mul_two_pi _β©
#align real.cos_eq_one_iff Real.cos_eq_one_iff
theorem cos_eq_one_iff_of_lt_of_lt {x : β} (hxβ : -(2 * Ο) < x) (hxβ : x < 2 * Ο) :
cos x = 1 β x = 0 :=
β¨fun h => by
rcases (cos_eq_one_iff _).1 h with β¨n, rflβ©
rw [mul_lt_iff_lt_one_left two_pi_pos] at hxβ
rw [neg_lt, neg_mul_eq_neg_mul, mul_lt_iff_lt_one_left two_pi_pos] at hxβ
norm_cast at hxβ hxβ
obtain rfl : n = 0 := le_antisymm (by omega) (by omega)
simp, fun h => by simp [h]β©
#align real.cos_eq_one_iff_of_lt_of_lt Real.cos_eq_one_iff_of_lt_of_lt
theorem sin_lt_sin_of_lt_of_le_pi_div_two {x y : β} (hxβ : -(Ο / 2) β€ x) (hyβ : y β€ Ο / 2)
(hxy : x < y) : sin x < sin y := by
rw [β sub_pos, sin_sub_sin]
have : 0 < sin ((y - x) / 2) := by apply sin_pos_of_pos_of_lt_pi <;> linarith
have : 0 < cos ((y + x) / 2) := by refine cos_pos_of_mem_Ioo β¨?_, ?_β© <;> linarith
positivity
#align real.sin_lt_sin_of_lt_of_le_pi_div_two Real.sin_lt_sin_of_lt_of_le_pi_div_two
theorem strictMonoOn_sin : StrictMonoOn sin (Icc (-(Ο / 2)) (Ο / 2)) := fun _ hx _ hy hxy =>
sin_lt_sin_of_lt_of_le_pi_div_two hx.1 hy.2 hxy
#align real.strict_mono_on_sin Real.strictMonoOn_sin
theorem cos_lt_cos_of_nonneg_of_le_pi {x y : β} (hxβ : 0 β€ x) (hyβ : y β€ Ο) (hxy : x < y) :
cos y < cos x := by
rw [β sin_pi_div_two_sub, β sin_pi_div_two_sub]
apply sin_lt_sin_of_lt_of_le_pi_div_two <;> linarith
#align real.cos_lt_cos_of_nonneg_of_le_pi Real.cos_lt_cos_of_nonneg_of_le_pi
theorem cos_lt_cos_of_nonneg_of_le_pi_div_two {x y : β} (hxβ : 0 β€ x) (hyβ : y β€ Ο / 2)
(hxy : x < y) : cos y < cos x :=
cos_lt_cos_of_nonneg_of_le_pi hxβ (hyβ.trans (by linarith)) hxy
#align real.cos_lt_cos_of_nonneg_of_le_pi_div_two Real.cos_lt_cos_of_nonneg_of_le_pi_div_two
theorem strictAntiOn_cos : StrictAntiOn cos (Icc 0 Ο) := fun _ hx _ hy hxy =>
cos_lt_cos_of_nonneg_of_le_pi hx.1 hy.2 hxy
#align real.strict_anti_on_cos Real.strictAntiOn_cos
theorem cos_le_cos_of_nonneg_of_le_pi {x y : β} (hxβ : 0 β€ x) (hyβ : y β€ Ο) (hxy : x β€ y) :
cos y β€ cos x :=
(strictAntiOn_cos.le_iff_le β¨hxβ.trans hxy, hyββ© β¨hxβ, hxy.trans hyββ©).2 hxy
#align real.cos_le_cos_of_nonneg_of_le_pi Real.cos_le_cos_of_nonneg_of_le_pi
theorem sin_le_sin_of_le_of_le_pi_div_two {x y : β} (hxβ : -(Ο / 2) β€ x) (hyβ : y β€ Ο / 2)
(hxy : x β€ y) : sin x β€ sin y :=
(strictMonoOn_sin.le_iff_le β¨hxβ, hxy.trans hyββ© β¨hxβ.trans hxy, hyββ©).2 hxy
#align real.sin_le_sin_of_le_of_le_pi_div_two Real.sin_le_sin_of_le_of_le_pi_div_two
theorem injOn_sin : InjOn sin (Icc (-(Ο / 2)) (Ο / 2)) :=
strictMonoOn_sin.injOn
#align real.inj_on_sin Real.injOn_sin
theorem injOn_cos : InjOn cos (Icc 0 Ο) :=
strictAntiOn_cos.injOn
#align real.inj_on_cos Real.injOn_cos
theorem surjOn_sin : SurjOn sin (Icc (-(Ο / 2)) (Ο / 2)) (Icc (-1) 1) := by
simpa only [sin_neg, sin_pi_div_two] using
intermediate_value_Icc (neg_le_self pi_div_two_pos.le) continuous_sin.continuousOn
#align real.surj_on_sin Real.surjOn_sin
theorem surjOn_cos : SurjOn cos (Icc 0 Ο) (Icc (-1) 1) := by
simpa only [cos_zero, cos_pi] using intermediate_value_Icc' pi_pos.le continuous_cos.continuousOn
#align real.surj_on_cos Real.surjOn_cos
theorem sin_mem_Icc (x : β) : sin x β Icc (-1 : β) 1 :=
β¨neg_one_le_sin x, sin_le_one xβ©
#align real.sin_mem_Icc Real.sin_mem_Icc
theorem cos_mem_Icc (x : β) : cos x β Icc (-1 : β) 1 :=
β¨neg_one_le_cos x, cos_le_one xβ©
#align real.cos_mem_Icc Real.cos_mem_Icc
theorem mapsTo_sin (s : Set β) : MapsTo sin s (Icc (-1 : β) 1) := fun x _ => sin_mem_Icc x
#align real.maps_to_sin Real.mapsTo_sin
theorem mapsTo_cos (s : Set β) : MapsTo cos s (Icc (-1 : β) 1) := fun x _ => cos_mem_Icc x
#align real.maps_to_cos Real.mapsTo_cos
theorem bijOn_sin : BijOn sin (Icc (-(Ο / 2)) (Ο / 2)) (Icc (-1) 1) :=
β¨mapsTo_sin _, injOn_sin, surjOn_sinβ©
#align real.bij_on_sin Real.bijOn_sin
theorem bijOn_cos : BijOn cos (Icc 0 Ο) (Icc (-1) 1) :=
β¨mapsTo_cos _, injOn_cos, surjOn_cosβ©
#align real.bij_on_cos Real.bijOn_cos
@[simp]
theorem range_cos : range cos = (Icc (-1) 1 : Set β) :=
Subset.antisymm (range_subset_iff.2 cos_mem_Icc) surjOn_cos.subset_range
#align real.range_cos Real.range_cos
@[simp]
theorem range_sin : range sin = (Icc (-1) 1 : Set β) :=
Subset.antisymm (range_subset_iff.2 sin_mem_Icc) surjOn_sin.subset_range
#align real.range_sin Real.range_sin
theorem range_cos_infinite : (range Real.cos).Infinite := by
rw [Real.range_cos]
exact Icc_infinite (by norm_num)
#align real.range_cos_infinite Real.range_cos_infinite
theorem range_sin_infinite : (range Real.sin).Infinite := by
rw [Real.range_sin]
exact Icc_infinite (by norm_num)
#align real.range_sin_infinite Real.range_sin_infinite
section CosDivSq
variable (x : β)
@[simp]
noncomputable def sqrtTwoAddSeries (x : β) : β β β
| 0 => x
| n + 1 => β(2 + sqrtTwoAddSeries x n)
#align real.sqrt_two_add_series Real.sqrtTwoAddSeries
theorem sqrtTwoAddSeries_zero : sqrtTwoAddSeries x 0 = x := by simp
#align real.sqrt_two_add_series_zero Real.sqrtTwoAddSeries_zero
theorem sqrtTwoAddSeries_one : sqrtTwoAddSeries 0 1 = β2 := by simp
#align real.sqrt_two_add_series_one Real.sqrtTwoAddSeries_one
theorem sqrtTwoAddSeries_two : sqrtTwoAddSeries 0 2 = β(2 + β2) := by simp
#align real.sqrt_two_add_series_two Real.sqrtTwoAddSeries_two
theorem sqrtTwoAddSeries_zero_nonneg : β n : β, 0 β€ sqrtTwoAddSeries 0 n
| 0 => le_refl 0
| _ + 1 => sqrt_nonneg _
#align real.sqrt_two_add_series_zero_nonneg Real.sqrtTwoAddSeries_zero_nonneg
theorem sqrtTwoAddSeries_nonneg {x : β} (h : 0 β€ x) : β n : β, 0 β€ sqrtTwoAddSeries x n
| 0 => h
| _ + 1 => sqrt_nonneg _
#align real.sqrt_two_add_series_nonneg Real.sqrtTwoAddSeries_nonneg
theorem sqrtTwoAddSeries_lt_two : β n : β, sqrtTwoAddSeries 0 n < 2
| 0 => by norm_num
| n + 1 => by
refine lt_of_lt_of_le ?_ (sqrt_sq zero_lt_two.le).le
rw [sqrtTwoAddSeries, sqrt_lt_sqrt_iff, β lt_sub_iff_add_lt']
Β· refine (sqrtTwoAddSeries_lt_two n).trans_le ?_
norm_num
Β· exact add_nonneg zero_le_two (sqrtTwoAddSeries_zero_nonneg n)
#align real.sqrt_two_add_series_lt_two Real.sqrtTwoAddSeries_lt_two
theorem sqrtTwoAddSeries_succ (x : β) :
β n : β, sqrtTwoAddSeries x (n + 1) = sqrtTwoAddSeries (β(2 + x)) n
| 0 => rfl
| n + 1 => by rw [sqrtTwoAddSeries, sqrtTwoAddSeries_succ _ _, sqrtTwoAddSeries]
#align real.sqrt_two_add_series_succ Real.sqrtTwoAddSeries_succ
theorem sqrtTwoAddSeries_monotone_left {x y : β} (h : x β€ y) :
β n : β, sqrtTwoAddSeries x n β€ sqrtTwoAddSeries y n
| 0 => h
| n + 1 => by
rw [sqrtTwoAddSeries, sqrtTwoAddSeries]
exact sqrt_le_sqrt (add_le_add_left (sqrtTwoAddSeries_monotone_left h _) _)
#align real.sqrt_two_add_series_monotone_left Real.sqrtTwoAddSeries_monotone_left
@[simp]
theorem cos_pi_over_two_pow : β n : β, cos (Ο / 2 ^ (n + 1)) = sqrtTwoAddSeries 0 n / 2
| 0 => by simp
| n + 1 => by
have A : (1 : β) < 2 ^ (n + 1) := one_lt_pow one_lt_two n.succ_ne_zero
have B : Ο / 2 ^ (n + 1) < Ο := div_lt_self pi_pos A
have C : 0 < Ο / 2 ^ (n + 1) := by positivity
rw [pow_succ, div_mul_eq_div_div, cos_half, cos_pi_over_two_pow n, sqrtTwoAddSeries,
add_div_eq_mul_add_div, one_mul, β div_mul_eq_div_div, sqrt_div, sqrt_mul_self] <;>
linarith [sqrtTwoAddSeries_nonneg le_rfl n]
#align real.cos_pi_over_two_pow Real.cos_pi_over_two_pow
theorem sin_sq_pi_over_two_pow (n : β) :
sin (Ο / 2 ^ (n + 1)) ^ 2 = 1 - (sqrtTwoAddSeries 0 n / 2) ^ 2 := by
rw [sin_sq, cos_pi_over_two_pow]
#align real.sin_sq_pi_over_two_pow Real.sin_sq_pi_over_two_pow
theorem sin_sq_pi_over_two_pow_succ (n : β) :
sin (Ο / 2 ^ (n + 2)) ^ 2 = 1 / 2 - sqrtTwoAddSeries 0 n / 4 := by
rw [sin_sq_pi_over_two_pow, sqrtTwoAddSeries, div_pow, sq_sqrt, add_div, β sub_sub]
Β· congr
Β· norm_num
Β· norm_num
Β· exact add_nonneg two_pos.le (sqrtTwoAddSeries_zero_nonneg _)
#align real.sin_sq_pi_over_two_pow_succ Real.sin_sq_pi_over_two_pow_succ
@[simp]
theorem sin_pi_over_two_pow_succ (n : β) :
sin (Ο / 2 ^ (n + 2)) = β(2 - sqrtTwoAddSeries 0 n) / 2 := by
rw [eq_div_iff_mul_eq two_ne_zero, eq_comm, sqrt_eq_iff_sq_eq, mul_pow,
sin_sq_pi_over_two_pow_succ, sub_mul]
Β· congr <;> norm_num
Β· rw [sub_nonneg]
exact (sqrtTwoAddSeries_lt_two _).le
refine mul_nonneg (sin_nonneg_of_nonneg_of_le_pi ?_ ?_) zero_le_two
Β· positivity
Β· exact div_le_self pi_pos.le <| one_le_pow_of_one_le one_le_two _
#align real.sin_pi_over_two_pow_succ Real.sin_pi_over_two_pow_succ
@[simp]
theorem cos_pi_div_four : cos (Ο / 4) = β2 / 2 := by
trans cos (Ο / 2 ^ 2)
Β· congr
norm_num
Β· simp
#align real.cos_pi_div_four Real.cos_pi_div_four
@[simp]
theorem sin_pi_div_four : sin (Ο / 4) = β2 / 2 := by
trans sin (Ο / 2 ^ 2)
Β· congr
norm_num
Β· simp
#align real.sin_pi_div_four Real.sin_pi_div_four
@[simp]
theorem cos_pi_div_eight : cos (Ο / 8) = β(2 + β2) / 2 := by
trans cos (Ο / 2 ^ 3)
Β· congr
norm_num
Β· simp
#align real.cos_pi_div_eight Real.cos_pi_div_eight
@[simp]
theorem sin_pi_div_eight : sin (Ο / 8) = β(2 - β2) / 2 := by
trans sin (Ο / 2 ^ 3)
Β· congr
norm_num
Β· simp
#align real.sin_pi_div_eight Real.sin_pi_div_eight
@[simp]
theorem cos_pi_div_sixteen : cos (Ο / 16) = β(2 + β(2 + β2)) / 2 := by
trans cos (Ο / 2 ^ 4)
Β· congr
norm_num
Β· simp
#align real.cos_pi_div_sixteen Real.cos_pi_div_sixteen
@[simp]
theorem sin_pi_div_sixteen : sin (Ο / 16) = β(2 - β(2 + β2)) / 2 := by
trans sin (Ο / 2 ^ 4)
Β· congr
norm_num
Β· simp
#align real.sin_pi_div_sixteen Real.sin_pi_div_sixteen
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean | 867 | 871 | theorem cos_pi_div_thirty_two : cos (Ο / 32) = β(2 + β(2 + β(2 + β2))) / 2 := by |
trans cos (Ο / 2 ^ 5)
Β· congr
norm_num
Β· simp
|
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.Aut
import Mathlib.Data.ZMod.Defs
import Mathlib.Tactic.Ring
#align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33"
open MulOpposite
universe u v
class Shelf (Ξ± : Type u) where
act : Ξ± β Ξ± β Ξ±
self_distrib : β {x y z : Ξ±}, act x (act y z) = act (act x y) (act x z)
#align shelf Shelf
class UnitalShelf (Ξ± : Type u) extends Shelf Ξ±, One Ξ± :=
(one_act : β a : Ξ±, act 1 a = a)
(act_one : β a : Ξ±, act a 1 = a)
#align unital_shelf UnitalShelf
@[ext]
structure ShelfHom (Sβ : Type*) (Sβ : Type*) [Shelf Sβ] [Shelf Sβ] where
toFun : Sβ β Sβ
map_act' : β {x y : Sβ}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y)
#align shelf_hom ShelfHom
#align shelf_hom.ext_iff ShelfHom.ext_iff
#align shelf_hom.ext ShelfHom.ext
class Rack (Ξ± : Type u) extends Shelf Ξ± where
invAct : Ξ± β Ξ± β Ξ±
left_inv : β x, Function.LeftInverse (invAct x) (act x)
right_inv : β x, Function.RightInverse (invAct x) (act x)
#align rack Rack
scoped[Quandles] infixr:65 " β " => Shelf.act
scoped[Quandles] infixr:65 " ββ»ΒΉ " => Rack.invAct
scoped[Quandles] infixr:25 " ββ " => ShelfHom
open Quandles
namespace Rack
variable {R : Type*} [Rack R]
-- Porting note: No longer a need for `Rack.self_distrib`
export Shelf (self_distrib)
-- porting note, changed name to `act'` to not conflict with `Shelf.act`
def act' (x : R) : R β R where
toFun := Shelf.act x
invFun := invAct x
left_inv := left_inv x
right_inv := right_inv x
#align rack.act Rack.act'
@[simp]
theorem act'_apply (x y : R) : act' x y = x β y :=
rfl
#align rack.act_apply Rack.act'_apply
@[simp]
theorem act'_symm_apply (x y : R) : (act' x).symm y = x ββ»ΒΉ y :=
rfl
#align rack.act_symm_apply Rack.act'_symm_apply
@[simp]
theorem invAct_apply (x y : R) : (act' x)β»ΒΉ y = x ββ»ΒΉ y :=
rfl
#align rack.inv_act_apply Rack.invAct_apply
@[simp]
theorem invAct_act_eq (x y : R) : x ββ»ΒΉ x β y = y :=
left_inv x y
#align rack.inv_act_act_eq Rack.invAct_act_eq
@[simp]
theorem act_invAct_eq (x y : R) : x β x ββ»ΒΉ y = y :=
right_inv x y
#align rack.act_inv_act_eq Rack.act_invAct_eq
theorem left_cancel (x : R) {y y' : R} : x β y = x β y' β y = y' := by
constructor
Β· apply (act' x).injective
rintro rfl
rfl
#align rack.left_cancel Rack.left_cancel
| Mathlib/Algebra/Quandle.lean | 232 | 236 | theorem left_cancel_inv (x : R) {y y' : R} : x ββ»ΒΉ y = x ββ»ΒΉ y' β y = y' := by |
constructor
Β· apply (act' x).symm.injective
rintro rfl
rfl
|
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Tactic.Positivity.Core
import Mathlib.Algebra.Ring.NegOnePow
#align_import analysis.special_functions.trigonometric.basic from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical
open Topology Filter Set
namespace Real
open Real
@[simp]
theorem sin_pi : sin Ο = 0 := by
rw [β mul_div_cancel_leftβ Ο (two_ne_zero' β), two_mul, add_div, sin_add, cos_pi_div_two]; simp
#align real.sin_pi Real.sin_pi
@[simp]
theorem cos_pi : cos Ο = -1 := by
rw [β mul_div_cancel_leftβ Ο (two_ne_zero' β), mul_div_assoc, cos_two_mul, cos_pi_div_two]
norm_num
#align real.cos_pi Real.cos_pi
@[simp]
theorem sin_two_pi : sin (2 * Ο) = 0 := by simp [two_mul, sin_add]
#align real.sin_two_pi Real.sin_two_pi
@[simp]
theorem cos_two_pi : cos (2 * Ο) = 1 := by simp [two_mul, cos_add]
#align real.cos_two_pi Real.cos_two_pi
theorem sin_antiperiodic : Function.Antiperiodic sin Ο := by simp [sin_add]
#align real.sin_antiperiodic Real.sin_antiperiodic
theorem sin_periodic : Function.Periodic sin (2 * Ο) :=
sin_antiperiodic.periodic_two_mul
#align real.sin_periodic Real.sin_periodic
@[simp]
theorem sin_add_pi (x : β) : sin (x + Ο) = -sin x :=
sin_antiperiodic x
#align real.sin_add_pi Real.sin_add_pi
@[simp]
theorem sin_add_two_pi (x : β) : sin (x + 2 * Ο) = sin x :=
sin_periodic x
#align real.sin_add_two_pi Real.sin_add_two_pi
@[simp]
theorem sin_sub_pi (x : β) : sin (x - Ο) = -sin x :=
sin_antiperiodic.sub_eq x
#align real.sin_sub_pi Real.sin_sub_pi
@[simp]
theorem sin_sub_two_pi (x : β) : sin (x - 2 * Ο) = sin x :=
sin_periodic.sub_eq x
#align real.sin_sub_two_pi Real.sin_sub_two_pi
@[simp]
theorem sin_pi_sub (x : β) : sin (Ο - x) = sin x :=
neg_neg (sin x) βΈ sin_neg x βΈ sin_antiperiodic.sub_eq'
#align real.sin_pi_sub Real.sin_pi_sub
@[simp]
theorem sin_two_pi_sub (x : β) : sin (2 * Ο - x) = -sin x :=
sin_neg x βΈ sin_periodic.sub_eq'
#align real.sin_two_pi_sub Real.sin_two_pi_sub
@[simp]
theorem sin_nat_mul_pi (n : β) : sin (n * Ο) = 0 :=
sin_antiperiodic.nat_mul_eq_of_eq_zero sin_zero n
#align real.sin_nat_mul_pi Real.sin_nat_mul_pi
@[simp]
theorem sin_int_mul_pi (n : β€) : sin (n * Ο) = 0 :=
sin_antiperiodic.int_mul_eq_of_eq_zero sin_zero n
#align real.sin_int_mul_pi Real.sin_int_mul_pi
@[simp]
theorem sin_add_nat_mul_two_pi (x : β) (n : β) : sin (x + n * (2 * Ο)) = sin x :=
sin_periodic.nat_mul n x
#align real.sin_add_nat_mul_two_pi Real.sin_add_nat_mul_two_pi
@[simp]
theorem sin_add_int_mul_two_pi (x : β) (n : β€) : sin (x + n * (2 * Ο)) = sin x :=
sin_periodic.int_mul n x
#align real.sin_add_int_mul_two_pi Real.sin_add_int_mul_two_pi
@[simp]
theorem sin_sub_nat_mul_two_pi (x : β) (n : β) : sin (x - n * (2 * Ο)) = sin x :=
sin_periodic.sub_nat_mul_eq n
#align real.sin_sub_nat_mul_two_pi Real.sin_sub_nat_mul_two_pi
@[simp]
theorem sin_sub_int_mul_two_pi (x : β) (n : β€) : sin (x - n * (2 * Ο)) = sin x :=
sin_periodic.sub_int_mul_eq n
#align real.sin_sub_int_mul_two_pi Real.sin_sub_int_mul_two_pi
@[simp]
theorem sin_nat_mul_two_pi_sub (x : β) (n : β) : sin (n * (2 * Ο) - x) = -sin x :=
sin_neg x βΈ sin_periodic.nat_mul_sub_eq n
#align real.sin_nat_mul_two_pi_sub Real.sin_nat_mul_two_pi_sub
@[simp]
theorem sin_int_mul_two_pi_sub (x : β) (n : β€) : sin (n * (2 * Ο) - x) = -sin x :=
sin_neg x βΈ sin_periodic.int_mul_sub_eq n
#align real.sin_int_mul_two_pi_sub Real.sin_int_mul_two_pi_sub
theorem sin_add_int_mul_pi (x : β) (n : β€) : sin (x + n * Ο) = (-1) ^ n * sin x :=
n.coe_negOnePow β βΈ sin_antiperiodic.add_int_mul_eq n
theorem sin_add_nat_mul_pi (x : β) (n : β) : sin (x + n * Ο) = (-1) ^ n * sin x :=
sin_antiperiodic.add_nat_mul_eq n
theorem sin_sub_int_mul_pi (x : β) (n : β€) : sin (x - n * Ο) = (-1) ^ n * sin x :=
n.coe_negOnePow β βΈ sin_antiperiodic.sub_int_mul_eq n
theorem sin_sub_nat_mul_pi (x : β) (n : β) : sin (x - n * Ο) = (-1) ^ n * sin x :=
sin_antiperiodic.sub_nat_mul_eq n
theorem sin_int_mul_pi_sub (x : β) (n : β€) : sin (n * Ο - x) = -((-1) ^ n * sin x) := by
simpa only [sin_neg, mul_neg, Int.coe_negOnePow] using sin_antiperiodic.int_mul_sub_eq n
theorem sin_nat_mul_pi_sub (x : β) (n : β) : sin (n * Ο - x) = -((-1) ^ n * sin x) := by
simpa only [sin_neg, mul_neg] using sin_antiperiodic.nat_mul_sub_eq n
theorem cos_antiperiodic : Function.Antiperiodic cos Ο := by simp [cos_add]
#align real.cos_antiperiodic Real.cos_antiperiodic
theorem cos_periodic : Function.Periodic cos (2 * Ο) :=
cos_antiperiodic.periodic_two_mul
#align real.cos_periodic Real.cos_periodic
@[simp]
theorem cos_add_pi (x : β) : cos (x + Ο) = -cos x :=
cos_antiperiodic x
#align real.cos_add_pi Real.cos_add_pi
@[simp]
theorem cos_add_two_pi (x : β) : cos (x + 2 * Ο) = cos x :=
cos_periodic x
#align real.cos_add_two_pi Real.cos_add_two_pi
@[simp]
theorem cos_sub_pi (x : β) : cos (x - Ο) = -cos x :=
cos_antiperiodic.sub_eq x
#align real.cos_sub_pi Real.cos_sub_pi
@[simp]
theorem cos_sub_two_pi (x : β) : cos (x - 2 * Ο) = cos x :=
cos_periodic.sub_eq x
#align real.cos_sub_two_pi Real.cos_sub_two_pi
@[simp]
theorem cos_pi_sub (x : β) : cos (Ο - x) = -cos x :=
cos_neg x βΈ cos_antiperiodic.sub_eq'
#align real.cos_pi_sub Real.cos_pi_sub
@[simp]
theorem cos_two_pi_sub (x : β) : cos (2 * Ο - x) = cos x :=
cos_neg x βΈ cos_periodic.sub_eq'
#align real.cos_two_pi_sub Real.cos_two_pi_sub
@[simp]
theorem cos_nat_mul_two_pi (n : β) : cos (n * (2 * Ο)) = 1 :=
(cos_periodic.nat_mul_eq n).trans cos_zero
#align real.cos_nat_mul_two_pi Real.cos_nat_mul_two_pi
@[simp]
theorem cos_int_mul_two_pi (n : β€) : cos (n * (2 * Ο)) = 1 :=
(cos_periodic.int_mul_eq n).trans cos_zero
#align real.cos_int_mul_two_pi Real.cos_int_mul_two_pi
@[simp]
theorem cos_add_nat_mul_two_pi (x : β) (n : β) : cos (x + n * (2 * Ο)) = cos x :=
cos_periodic.nat_mul n x
#align real.cos_add_nat_mul_two_pi Real.cos_add_nat_mul_two_pi
@[simp]
theorem cos_add_int_mul_two_pi (x : β) (n : β€) : cos (x + n * (2 * Ο)) = cos x :=
cos_periodic.int_mul n x
#align real.cos_add_int_mul_two_pi Real.cos_add_int_mul_two_pi
@[simp]
theorem cos_sub_nat_mul_two_pi (x : β) (n : β) : cos (x - n * (2 * Ο)) = cos x :=
cos_periodic.sub_nat_mul_eq n
#align real.cos_sub_nat_mul_two_pi Real.cos_sub_nat_mul_two_pi
@[simp]
theorem cos_sub_int_mul_two_pi (x : β) (n : β€) : cos (x - n * (2 * Ο)) = cos x :=
cos_periodic.sub_int_mul_eq n
#align real.cos_sub_int_mul_two_pi Real.cos_sub_int_mul_two_pi
@[simp]
theorem cos_nat_mul_two_pi_sub (x : β) (n : β) : cos (n * (2 * Ο) - x) = cos x :=
cos_neg x βΈ cos_periodic.nat_mul_sub_eq n
#align real.cos_nat_mul_two_pi_sub Real.cos_nat_mul_two_pi_sub
@[simp]
theorem cos_int_mul_two_pi_sub (x : β) (n : β€) : cos (n * (2 * Ο) - x) = cos x :=
cos_neg x βΈ cos_periodic.int_mul_sub_eq n
#align real.cos_int_mul_two_pi_sub Real.cos_int_mul_two_pi_sub
theorem cos_add_int_mul_pi (x : β) (n : β€) : cos (x + n * Ο) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_antiperiodic.add_int_mul_eq n
theorem cos_add_nat_mul_pi (x : β) (n : β) : cos (x + n * Ο) = (-1) ^ n * cos x :=
cos_antiperiodic.add_nat_mul_eq n
theorem cos_sub_int_mul_pi (x : β) (n : β€) : cos (x - n * Ο) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_antiperiodic.sub_int_mul_eq n
theorem cos_sub_nat_mul_pi (x : β) (n : β) : cos (x - n * Ο) = (-1) ^ n * cos x :=
cos_antiperiodic.sub_nat_mul_eq n
theorem cos_int_mul_pi_sub (x : β) (n : β€) : cos (n * Ο - x) = (-1) ^ n * cos x :=
n.coe_negOnePow β βΈ cos_neg x βΈ cos_antiperiodic.int_mul_sub_eq n
theorem cos_nat_mul_pi_sub (x : β) (n : β) : cos (n * Ο - x) = (-1) ^ n * cos x :=
cos_neg x βΈ cos_antiperiodic.nat_mul_sub_eq n
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_nat_mul_two_pi_add_pi (n : β) : cos (n * (2 * Ο) + Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.nat_mul n).add_antiperiod_eq cos_antiperiodic
#align real.cos_nat_mul_two_pi_add_pi Real.cos_nat_mul_two_pi_add_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_int_mul_two_pi_add_pi (n : β€) : cos (n * (2 * Ο) + Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.int_mul n).add_antiperiod_eq cos_antiperiodic
#align real.cos_int_mul_two_pi_add_pi Real.cos_int_mul_two_pi_add_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_nat_mul_two_pi_sub_pi (n : β) : cos (n * (2 * Ο) - Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.nat_mul n).sub_antiperiod_eq cos_antiperiodic
#align real.cos_nat_mul_two_pi_sub_pi Real.cos_nat_mul_two_pi_sub_pi
-- Porting note (#10618): was @[simp], but simp can prove it
theorem cos_int_mul_two_pi_sub_pi (n : β€) : cos (n * (2 * Ο) - Ο) = -1 := by
simpa only [cos_zero] using (cos_periodic.int_mul n).sub_antiperiod_eq cos_antiperiodic
#align real.cos_int_mul_two_pi_sub_pi Real.cos_int_mul_two_pi_sub_pi
theorem sin_pos_of_pos_of_lt_pi {x : β} (h0x : 0 < x) (hxp : x < Ο) : 0 < sin x :=
if hx2 : x β€ 2 then sin_pos_of_pos_of_le_two h0x hx2
else
have : (2 : β) + 2 = 4 := by norm_num
have : Ο - x β€ 2 :=
sub_le_iff_le_add.2 (le_trans pi_le_four (this βΈ add_le_add_left (le_of_not_ge hx2) _))
sin_pi_sub x βΈ sin_pos_of_pos_of_le_two (sub_pos.2 hxp) this
#align real.sin_pos_of_pos_of_lt_pi Real.sin_pos_of_pos_of_lt_pi
theorem sin_pos_of_mem_Ioo {x : β} (hx : x β Ioo 0 Ο) : 0 < sin x :=
sin_pos_of_pos_of_lt_pi hx.1 hx.2
#align real.sin_pos_of_mem_Ioo Real.sin_pos_of_mem_Ioo
theorem sin_nonneg_of_mem_Icc {x : β} (hx : x β Icc 0 Ο) : 0 β€ sin x := by
rw [β closure_Ioo pi_ne_zero.symm] at hx
exact
closure_lt_subset_le continuous_const continuous_sin
(closure_mono (fun y => sin_pos_of_mem_Ioo) hx)
#align real.sin_nonneg_of_mem_Icc Real.sin_nonneg_of_mem_Icc
theorem sin_nonneg_of_nonneg_of_le_pi {x : β} (h0x : 0 β€ x) (hxp : x β€ Ο) : 0 β€ sin x :=
sin_nonneg_of_mem_Icc β¨h0x, hxpβ©
#align real.sin_nonneg_of_nonneg_of_le_pi Real.sin_nonneg_of_nonneg_of_le_pi
theorem sin_neg_of_neg_of_neg_pi_lt {x : β} (hx0 : x < 0) (hpx : -Ο < x) : sin x < 0 :=
neg_pos.1 <| sin_neg x βΈ sin_pos_of_pos_of_lt_pi (neg_pos.2 hx0) (neg_lt.1 hpx)
#align real.sin_neg_of_neg_of_neg_pi_lt Real.sin_neg_of_neg_of_neg_pi_lt
theorem sin_nonpos_of_nonnpos_of_neg_pi_le {x : β} (hx0 : x β€ 0) (hpx : -Ο β€ x) : sin x β€ 0 :=
neg_nonneg.1 <| sin_neg x βΈ sin_nonneg_of_nonneg_of_le_pi (neg_nonneg.2 hx0) (neg_le.1 hpx)
#align real.sin_nonpos_of_nonnpos_of_neg_pi_le Real.sin_nonpos_of_nonnpos_of_neg_pi_le
@[simp]
theorem sin_pi_div_two : sin (Ο / 2) = 1 :=
have : sin (Ο / 2) = 1 β¨ sin (Ο / 2) = -1 := by
simpa [sq, mul_self_eq_one_iff] using sin_sq_add_cos_sq (Ο / 2)
this.resolve_right fun h =>
show Β¬(0 : β) < -1 by norm_num <|
h βΈ sin_pos_of_pos_of_lt_pi pi_div_two_pos (half_lt_self pi_pos)
#align real.sin_pi_div_two Real.sin_pi_div_two
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Basic.lean | 502 | 502 | theorem sin_add_pi_div_two (x : β) : sin (x + Ο / 2) = cos x := by | simp [sin_add]
|
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Data.Set.Finite
#align_import order.conditionally_complete_lattice.finset from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
open Set
variable {ΞΉ Ξ± Ξ² Ξ³ : Type*}
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder Ξ±] {s t : Set Ξ±} {a b : Ξ±}
theorem Finset.Nonempty.csSup_eq_max' {s : Finset Ξ±} (h : s.Nonempty) : sSup βs = s.max' h :=
eq_of_forall_ge_iff fun _ => (csSup_le_iff s.bddAbove h.to_set).trans (s.max'_le_iff h).symm
#align finset.nonempty.cSup_eq_max' Finset.Nonempty.csSup_eq_max'
theorem Finset.Nonempty.csInf_eq_min' {s : Finset Ξ±} (h : s.Nonempty) : sInf βs = s.min' h :=
@Finset.Nonempty.csSup_eq_max' Ξ±α΅α΅ _ s h
#align finset.nonempty.cInf_eq_min' Finset.Nonempty.csInf_eq_min'
| Mathlib/Order/ConditionallyCompleteLattice/Finset.lean | 33 | 35 | theorem Finset.Nonempty.csSup_mem {s : Finset Ξ±} (h : s.Nonempty) : sSup (s : Set Ξ±) β s := by |
rw [h.csSup_eq_max']
exact s.max'_mem _
|
import Mathlib.Data.Nat.Lattice
import Mathlib.Logic.Denumerable
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.Hom.Basic
import Mathlib.Data.Set.Subsingleton
#align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
variable {Ξ± : Type*}
namespace RelEmbedding
variable {r : Ξ± β Ξ± β Prop} [IsStrictOrder Ξ± r]
def natLT (f : β β Ξ±) (H : β n : β, r (f n) (f (n + 1))) : ((Β· < Β·) : β β β β Prop) βͺr r :=
ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H
#align rel_embedding.nat_lt RelEmbedding.natLT
@[simp]
theorem coe_natLT {f : β β Ξ±} {H : β n : β, r (f n) (f (n + 1))} : β(natLT f H) = f :=
rfl
#align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT
def natGT (f : β β Ξ±) (H : β n : β, r (f (n + 1)) (f n)) : ((Β· > Β·) : β β β β Prop) βͺr r :=
haveI := IsStrictOrder.swap r
RelEmbedding.swap (natLT f H)
#align rel_embedding.nat_gt RelEmbedding.natGT
@[simp]
theorem coe_natGT {f : β β Ξ±} {H : β n : β, r (f (n + 1)) (f n)} : β(natGT f H) = f :=
rfl
#align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT
| Mathlib/Order/OrderIsoNat.lean | 58 | 62 | theorem exists_not_acc_lt_of_not_acc {a : Ξ±} {r} (h : Β¬Acc r a) : β b, Β¬Acc r b β§ r b a := by |
contrapose! h
refine β¨_, fun b hr => ?_β©
by_contra hb
exact h b hb hr
|
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Data.Set.NAry
import Mathlib.Order.Directed
#align_import order.bounds.basic from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
open Function Set
open OrderDual (toDual ofDual)
universe u v w x
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w} {ΞΉ : Sort x}
section
variable [Preorder Ξ±] [Preorder Ξ²] {s t : Set Ξ±} {a b : Ξ±}
def upperBounds (s : Set Ξ±) : Set Ξ± :=
{ x | β β¦aβ¦, a β s β a β€ x }
#align upper_bounds upperBounds
def lowerBounds (s : Set Ξ±) : Set Ξ± :=
{ x | β β¦aβ¦, a β s β x β€ a }
#align lower_bounds lowerBounds
def BddAbove (s : Set Ξ±) :=
(upperBounds s).Nonempty
#align bdd_above BddAbove
def BddBelow (s : Set Ξ±) :=
(lowerBounds s).Nonempty
#align bdd_below BddBelow
def IsLeast (s : Set Ξ±) (a : Ξ±) : Prop :=
a β s β§ a β lowerBounds s
#align is_least IsLeast
def IsGreatest (s : Set Ξ±) (a : Ξ±) : Prop :=
a β s β§ a β upperBounds s
#align is_greatest IsGreatest
def IsLUB (s : Set Ξ±) : Ξ± β Prop :=
IsLeast (upperBounds s)
#align is_lub IsLUB
def IsGLB (s : Set Ξ±) : Ξ± β Prop :=
IsGreatest (lowerBounds s)
#align is_glb IsGLB
theorem mem_upperBounds : a β upperBounds s β β x β s, x β€ a :=
Iff.rfl
#align mem_upper_bounds mem_upperBounds
theorem mem_lowerBounds : a β lowerBounds s β β x β s, a β€ x :=
Iff.rfl
#align mem_lower_bounds mem_lowerBounds
lemma mem_upperBounds_iff_subset_Iic : a β upperBounds s β s β Iic a := Iff.rfl
#align mem_upper_bounds_iff_subset_Iic mem_upperBounds_iff_subset_Iic
lemma mem_lowerBounds_iff_subset_Ici : a β lowerBounds s β s β Ici a := Iff.rfl
#align mem_lower_bounds_iff_subset_Ici mem_lowerBounds_iff_subset_Ici
theorem bddAbove_def : BddAbove s β β x, β y β s, y β€ x :=
Iff.rfl
#align bdd_above_def bddAbove_def
theorem bddBelow_def : BddBelow s β β x, β y β s, x β€ y :=
Iff.rfl
#align bdd_below_def bddBelow_def
theorem bot_mem_lowerBounds [OrderBot Ξ±] (s : Set Ξ±) : β₯ β lowerBounds s := fun _ _ => bot_le
#align bot_mem_lower_bounds bot_mem_lowerBounds
theorem top_mem_upperBounds [OrderTop Ξ±] (s : Set Ξ±) : β€ β upperBounds s := fun _ _ => le_top
#align top_mem_upper_bounds top_mem_upperBounds
@[simp]
theorem isLeast_bot_iff [OrderBot Ξ±] : IsLeast s β₯ β β₯ β s :=
and_iff_left <| bot_mem_lowerBounds _
#align is_least_bot_iff isLeast_bot_iff
@[simp]
theorem isGreatest_top_iff [OrderTop Ξ±] : IsGreatest s β€ β β€ β s :=
and_iff_left <| top_mem_upperBounds _
#align is_greatest_top_iff isGreatest_top_iff
theorem not_bddAbove_iff' : Β¬BddAbove s β β x, β y β s, Β¬y β€ x := by
simp [BddAbove, upperBounds, Set.Nonempty]
#align not_bdd_above_iff' not_bddAbove_iff'
theorem not_bddBelow_iff' : Β¬BddBelow s β β x, β y β s, Β¬x β€ y :=
@not_bddAbove_iff' Ξ±α΅α΅ _ _
#align not_bdd_below_iff' not_bddBelow_iff'
theorem not_bddAbove_iff {Ξ± : Type*} [LinearOrder Ξ±] {s : Set Ξ±} :
Β¬BddAbove s β β x, β y β s, x < y := by
simp only [not_bddAbove_iff', not_le]
#align not_bdd_above_iff not_bddAbove_iff
theorem not_bddBelow_iff {Ξ± : Type*} [LinearOrder Ξ±] {s : Set Ξ±} :
Β¬BddBelow s β β x, β y β s, y < x :=
@not_bddAbove_iff Ξ±α΅α΅ _ _
#align not_bdd_below_iff not_bddBelow_iff
@[simp] lemma bddBelow_preimage_ofDual {s : Set Ξ±} : BddBelow (ofDual β»ΒΉ' s) β BddAbove s := Iff.rfl
@[simp] lemma bddAbove_preimage_ofDual {s : Set Ξ±} : BddAbove (ofDual β»ΒΉ' s) β BddBelow s := Iff.rfl
@[simp] lemma bddBelow_preimage_toDual {s : Set Ξ±α΅α΅} :
BddBelow (toDual β»ΒΉ' s) β BddAbove s := Iff.rfl
@[simp] lemma bddAbove_preimage_toDual {s : Set Ξ±α΅α΅} :
BddAbove (toDual β»ΒΉ' s) β BddBelow s := Iff.rfl
theorem BddAbove.dual (h : BddAbove s) : BddBelow (ofDual β»ΒΉ' s) :=
h
#align bdd_above.dual BddAbove.dual
theorem BddBelow.dual (h : BddBelow s) : BddAbove (ofDual β»ΒΉ' s) :=
h
#align bdd_below.dual BddBelow.dual
theorem IsLeast.dual (h : IsLeast s a) : IsGreatest (ofDual β»ΒΉ' s) (toDual a) :=
h
#align is_least.dual IsLeast.dual
theorem IsGreatest.dual (h : IsGreatest s a) : IsLeast (ofDual β»ΒΉ' s) (toDual a) :=
h
#align is_greatest.dual IsGreatest.dual
theorem IsLUB.dual (h : IsLUB s a) : IsGLB (ofDual β»ΒΉ' s) (toDual a) :=
h
#align is_lub.dual IsLUB.dual
theorem IsGLB.dual (h : IsGLB s a) : IsLUB (ofDual β»ΒΉ' s) (toDual a) :=
h
#align is_glb.dual IsGLB.dual
abbrev IsLeast.orderBot (h : IsLeast s a) :
OrderBot s where
bot := β¨a, h.1β©
bot_le := Subtype.forall.2 h.2
#align is_least.order_bot IsLeast.orderBot
abbrev IsGreatest.orderTop (h : IsGreatest s a) :
OrderTop s where
top := β¨a, h.1β©
le_top := Subtype.forall.2 h.2
#align is_greatest.order_top IsGreatest.orderTop
theorem upperBounds_mono_set β¦s t : Set Ξ±β¦ (hst : s β t) : upperBounds t β upperBounds s :=
fun _ hb _ h => hb <| hst h
#align upper_bounds_mono_set upperBounds_mono_set
theorem lowerBounds_mono_set β¦s t : Set Ξ±β¦ (hst : s β t) : lowerBounds t β lowerBounds s :=
fun _ hb _ h => hb <| hst h
#align lower_bounds_mono_set lowerBounds_mono_set
theorem upperBounds_mono_mem β¦a bβ¦ (hab : a β€ b) : a β upperBounds s β b β upperBounds s :=
fun ha _ h => le_trans (ha h) hab
#align upper_bounds_mono_mem upperBounds_mono_mem
theorem lowerBounds_mono_mem β¦a bβ¦ (hab : a β€ b) : b β lowerBounds s β a β lowerBounds s :=
fun hb _ h => le_trans hab (hb h)
#align lower_bounds_mono_mem lowerBounds_mono_mem
theorem upperBounds_mono β¦s t : Set Ξ±β¦ (hst : s β t) β¦a bβ¦ (hab : a β€ b) :
a β upperBounds t β b β upperBounds s := fun ha =>
upperBounds_mono_set hst <| upperBounds_mono_mem hab ha
#align upper_bounds_mono upperBounds_mono
theorem lowerBounds_mono β¦s t : Set Ξ±β¦ (hst : s β t) β¦a bβ¦ (hab : a β€ b) :
b β lowerBounds t β a β lowerBounds s := fun hb =>
lowerBounds_mono_set hst <| lowerBounds_mono_mem hab hb
#align lower_bounds_mono lowerBounds_mono
theorem BddAbove.mono β¦s t : Set Ξ±β¦ (h : s β t) : BddAbove t β BddAbove s :=
Nonempty.mono <| upperBounds_mono_set h
#align bdd_above.mono BddAbove.mono
theorem BddBelow.mono β¦s t : Set Ξ±β¦ (h : s β t) : BddBelow t β BddBelow s :=
Nonempty.mono <| lowerBounds_mono_set h
#align bdd_below.mono BddBelow.mono
theorem IsLUB.of_subset_of_superset {s t p : Set Ξ±} (hs : IsLUB s a) (hp : IsLUB p a) (hst : s β t)
(htp : t β p) : IsLUB t a :=
β¨upperBounds_mono_set htp hp.1, lowerBounds_mono_set (upperBounds_mono_set hst) hs.2β©
#align is_lub.of_subset_of_superset IsLUB.of_subset_of_superset
theorem IsGLB.of_subset_of_superset {s t p : Set Ξ±} (hs : IsGLB s a) (hp : IsGLB p a) (hst : s β t)
(htp : t β p) : IsGLB t a :=
hs.dual.of_subset_of_superset hp hst htp
#align is_glb.of_subset_of_superset IsGLB.of_subset_of_superset
theorem IsLeast.mono (ha : IsLeast s a) (hb : IsLeast t b) (hst : s β t) : b β€ a :=
hb.2 (hst ha.1)
#align is_least.mono IsLeast.mono
theorem IsGreatest.mono (ha : IsGreatest s a) (hb : IsGreatest t b) (hst : s β t) : a β€ b :=
hb.2 (hst ha.1)
#align is_greatest.mono IsGreatest.mono
theorem IsLUB.mono (ha : IsLUB s a) (hb : IsLUB t b) (hst : s β t) : a β€ b :=
IsLeast.mono hb ha <| upperBounds_mono_set hst
#align is_lub.mono IsLUB.mono
theorem IsGLB.mono (ha : IsGLB s a) (hb : IsGLB t b) (hst : s β t) : b β€ a :=
IsGreatest.mono hb ha <| lowerBounds_mono_set hst
#align is_glb.mono IsGLB.mono
theorem subset_lowerBounds_upperBounds (s : Set Ξ±) : s β lowerBounds (upperBounds s) :=
fun _ hx _ hy => hy hx
#align subset_lower_bounds_upper_bounds subset_lowerBounds_upperBounds
theorem subset_upperBounds_lowerBounds (s : Set Ξ±) : s β upperBounds (lowerBounds s) :=
fun _ hx _ hy => hy hx
#align subset_upper_bounds_lower_bounds subset_upperBounds_lowerBounds
theorem Set.Nonempty.bddAbove_lowerBounds (hs : s.Nonempty) : BddAbove (lowerBounds s) :=
hs.mono (subset_upperBounds_lowerBounds s)
#align set.nonempty.bdd_above_lower_bounds Set.Nonempty.bddAbove_lowerBounds
theorem Set.Nonempty.bddBelow_upperBounds (hs : s.Nonempty) : BddBelow (upperBounds s) :=
hs.mono (subset_lowerBounds_upperBounds s)
#align set.nonempty.bdd_below_upper_bounds Set.Nonempty.bddBelow_upperBounds
theorem IsLeast.isGLB (h : IsLeast s a) : IsGLB s a :=
β¨h.2, fun _ hb => hb h.1β©
#align is_least.is_glb IsLeast.isGLB
theorem IsGreatest.isLUB (h : IsGreatest s a) : IsLUB s a :=
β¨h.2, fun _ hb => hb h.1β©
#align is_greatest.is_lub IsGreatest.isLUB
theorem IsLUB.upperBounds_eq (h : IsLUB s a) : upperBounds s = Ici a :=
Set.ext fun _ => β¨fun hb => h.2 hb, fun hb => upperBounds_mono_mem hb h.1β©
#align is_lub.upper_bounds_eq IsLUB.upperBounds_eq
theorem IsGLB.lowerBounds_eq (h : IsGLB s a) : lowerBounds s = Iic a :=
h.dual.upperBounds_eq
#align is_glb.lower_bounds_eq IsGLB.lowerBounds_eq
theorem IsLeast.lowerBounds_eq (h : IsLeast s a) : lowerBounds s = Iic a :=
h.isGLB.lowerBounds_eq
#align is_least.lower_bounds_eq IsLeast.lowerBounds_eq
theorem IsGreatest.upperBounds_eq (h : IsGreatest s a) : upperBounds s = Ici a :=
h.isLUB.upperBounds_eq
#align is_greatest.upper_bounds_eq IsGreatest.upperBounds_eq
-- Porting note (#10756): new lemma
theorem IsGreatest.lt_iff (h : IsGreatest s a) : a < b β β x β s, x < b :=
β¨fun hlt _x hx => (h.2 hx).trans_lt hlt, fun h' => h' _ h.1β©
-- Porting note (#10756): new lemma
theorem IsLeast.lt_iff (h : IsLeast s a) : b < a β β x β s, b < x :=
h.dual.lt_iff
theorem isLUB_le_iff (h : IsLUB s a) : a β€ b β b β upperBounds s := by
rw [h.upperBounds_eq]
rfl
#align is_lub_le_iff isLUB_le_iff
theorem le_isGLB_iff (h : IsGLB s a) : b β€ a β b β lowerBounds s := by
rw [h.lowerBounds_eq]
rfl
#align le_is_glb_iff le_isGLB_iff
theorem isLUB_iff_le_iff : IsLUB s a β β b, a β€ b β b β upperBounds s :=
β¨fun h _ => isLUB_le_iff h, fun H => β¨(H _).1 le_rfl, fun b hb => (H b).2 hbβ©β©
#align is_lub_iff_le_iff isLUB_iff_le_iff
theorem isGLB_iff_le_iff : IsGLB s a β β b, b β€ a β b β lowerBounds s :=
@isLUB_iff_le_iff Ξ±α΅α΅ _ _ _
#align is_glb_iff_le_iff isGLB_iff_le_iff
theorem IsLUB.bddAbove (h : IsLUB s a) : BddAbove s :=
β¨a, h.1β©
#align is_lub.bdd_above IsLUB.bddAbove
theorem IsGLB.bddBelow (h : IsGLB s a) : BddBelow s :=
β¨a, h.1β©
#align is_glb.bdd_below IsGLB.bddBelow
theorem IsGreatest.bddAbove (h : IsGreatest s a) : BddAbove s :=
β¨a, h.2β©
#align is_greatest.bdd_above IsGreatest.bddAbove
theorem IsLeast.bddBelow (h : IsLeast s a) : BddBelow s :=
β¨a, h.2β©
#align is_least.bdd_below IsLeast.bddBelow
theorem IsLeast.nonempty (h : IsLeast s a) : s.Nonempty :=
β¨a, h.1β©
#align is_least.nonempty IsLeast.nonempty
theorem IsGreatest.nonempty (h : IsGreatest s a) : s.Nonempty :=
β¨a, h.1β©
#align is_greatest.nonempty IsGreatest.nonempty
@[simp]
theorem upperBounds_union : upperBounds (s βͺ t) = upperBounds s β© upperBounds t :=
Subset.antisymm (fun _ hb => β¨fun _ hx => hb (Or.inl hx), fun _ hx => hb (Or.inr hx)β©)
fun _ hb _ hx => hx.elim (fun hs => hb.1 hs) fun ht => hb.2 ht
#align upper_bounds_union upperBounds_union
@[simp]
theorem lowerBounds_union : lowerBounds (s βͺ t) = lowerBounds s β© lowerBounds t :=
@upperBounds_union Ξ±α΅α΅ _ s t
#align lower_bounds_union lowerBounds_union
theorem union_upperBounds_subset_upperBounds_inter :
upperBounds s βͺ upperBounds t β upperBounds (s β© t) :=
union_subset (upperBounds_mono_set inter_subset_left)
(upperBounds_mono_set inter_subset_right)
#align union_upper_bounds_subset_upper_bounds_inter union_upperBounds_subset_upperBounds_inter
theorem union_lowerBounds_subset_lowerBounds_inter :
lowerBounds s βͺ lowerBounds t β lowerBounds (s β© t) :=
@union_upperBounds_subset_upperBounds_inter Ξ±α΅α΅ _ s t
#align union_lower_bounds_subset_lower_bounds_inter union_lowerBounds_subset_lowerBounds_inter
theorem isLeast_union_iff {a : Ξ±} {s t : Set Ξ±} :
IsLeast (s βͺ t) a β IsLeast s a β§ a β lowerBounds t β¨ a β lowerBounds s β§ IsLeast t a := by
simp [IsLeast, lowerBounds_union, or_and_right, and_comm (a := a β t), and_assoc]
#align is_least_union_iff isLeast_union_iff
theorem isGreatest_union_iff :
IsGreatest (s βͺ t) a β
IsGreatest s a β§ a β upperBounds t β¨ a β upperBounds s β§ IsGreatest t a :=
@isLeast_union_iff Ξ±α΅α΅ _ a s t
#align is_greatest_union_iff isGreatest_union_iff
theorem BddAbove.inter_of_left (h : BddAbove s) : BddAbove (s β© t) :=
h.mono inter_subset_left
#align bdd_above.inter_of_left BddAbove.inter_of_left
theorem BddAbove.inter_of_right (h : BddAbove t) : BddAbove (s β© t) :=
h.mono inter_subset_right
#align bdd_above.inter_of_right BddAbove.inter_of_right
theorem BddBelow.inter_of_left (h : BddBelow s) : BddBelow (s β© t) :=
h.mono inter_subset_left
#align bdd_below.inter_of_left BddBelow.inter_of_left
theorem BddBelow.inter_of_right (h : BddBelow t) : BddBelow (s β© t) :=
h.mono inter_subset_right
#align bdd_below.inter_of_right BddBelow.inter_of_right
theorem BddAbove.union [IsDirected Ξ± (Β· β€ Β·)] {s t : Set Ξ±} :
BddAbove s β BddAbove t β BddAbove (s βͺ t) := by
rintro β¨a, haβ© β¨b, hbβ©
obtain β¨c, hca, hcbβ© := exists_ge_ge a b
rw [BddAbove, upperBounds_union]
exact β¨c, upperBounds_mono_mem hca ha, upperBounds_mono_mem hcb hbβ©
#align bdd_above.union BddAbove.union
theorem bddAbove_union [IsDirected Ξ± (Β· β€ Β·)] {s t : Set Ξ±} :
BddAbove (s βͺ t) β BddAbove s β§ BddAbove t :=
β¨fun h => β¨h.mono subset_union_left, h.mono subset_union_rightβ©, fun h =>
h.1.union h.2β©
#align bdd_above_union bddAbove_union
theorem BddBelow.union [IsDirected Ξ± (Β· β₯ Β·)] {s t : Set Ξ±} :
BddBelow s β BddBelow t β BddBelow (s βͺ t) :=
@BddAbove.union Ξ±α΅α΅ _ _ _ _
#align bdd_below.union BddBelow.union
theorem bddBelow_union [IsDirected Ξ± (Β· β₯ Β·)] {s t : Set Ξ±} :
BddBelow (s βͺ t) β BddBelow s β§ BddBelow t :=
@bddAbove_union Ξ±α΅α΅ _ _ _ _
#align bdd_below_union bddBelow_union
theorem IsLUB.union [SemilatticeSup Ξ³] {a b : Ξ³} {s t : Set Ξ³} (hs : IsLUB s a) (ht : IsLUB t b) :
IsLUB (s βͺ t) (a β b) :=
β¨fun _ h =>
h.casesOn (fun h => le_sup_of_le_left <| hs.left h) fun h => le_sup_of_le_right <| ht.left h,
fun _ hc =>
sup_le (hs.right fun _ hd => hc <| Or.inl hd) (ht.right fun _ hd => hc <| Or.inr hd)β©
#align is_lub.union IsLUB.union
theorem IsGLB.union [SemilatticeInf Ξ³] {aβ aβ : Ξ³} {s t : Set Ξ³} (hs : IsGLB s aβ)
(ht : IsGLB t aβ) : IsGLB (s βͺ t) (aβ β aβ) :=
hs.dual.union ht
#align is_glb.union IsGLB.union
theorem IsLeast.union [LinearOrder Ξ³] {a b : Ξ³} {s t : Set Ξ³} (ha : IsLeast s a)
(hb : IsLeast t b) : IsLeast (s βͺ t) (min a b) :=
β¨by rcases le_total a b with h | h <;> simp [h, ha.1, hb.1], (ha.isGLB.union hb.isGLB).1β©
#align is_least.union IsLeast.union
theorem IsGreatest.union [LinearOrder Ξ³] {a b : Ξ³} {s t : Set Ξ³} (ha : IsGreatest s a)
(hb : IsGreatest t b) : IsGreatest (s βͺ t) (max a b) :=
β¨by rcases le_total a b with h | h <;> simp [h, ha.1, hb.1], (ha.isLUB.union hb.isLUB).1β©
#align is_greatest.union IsGreatest.union
theorem IsLUB.inter_Ici_of_mem [LinearOrder Ξ³] {s : Set Ξ³} {a b : Ξ³} (ha : IsLUB s a) (hb : b β s) :
IsLUB (s β© Ici b) a :=
β¨fun _ hx => ha.1 hx.1, fun c hc =>
have hbc : b β€ c := hc β¨hb, le_rflβ©
ha.2 fun x hx => ((le_total x b).elim fun hxb => hxb.trans hbc) fun hbx => hc β¨hx, hbxβ©β©
#align is_lub.inter_Ici_of_mem IsLUB.inter_Ici_of_mem
theorem IsGLB.inter_Iic_of_mem [LinearOrder Ξ³] {s : Set Ξ³} {a b : Ξ³} (ha : IsGLB s a) (hb : b β s) :
IsGLB (s β© Iic b) a :=
ha.dual.inter_Ici_of_mem hb
#align is_glb.inter_Iic_of_mem IsGLB.inter_Iic_of_mem
| Mathlib/Order/Bounds/Basic.lean | 496 | 499 | theorem bddAbove_iff_exists_ge [SemilatticeSup Ξ³] {s : Set Ξ³} (xβ : Ξ³) :
BddAbove s β β x, xβ β€ x β§ β y β s, y β€ x := by |
rw [bddAbove_def, exists_ge_and_iff_exists]
exact Monotone.ball fun x _ => monotone_le
|
import Mathlib.Algebra.Algebra.Defs
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.Field.Canonical.Basic
import Mathlib.Algebra.Order.Nonneg.Field
import Mathlib.Algebra.Order.Nonneg.Floor
import Mathlib.Data.Real.Pointwise
import Mathlib.Order.ConditionallyCompleteLattice.Group
import Mathlib.Tactic.GCongr.Core
#align_import data.real.nnreal from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010"
open Function
-- to ensure these instances are computable
def NNReal := { r : β // 0 β€ r } deriving
Zero, One, Semiring, StrictOrderedSemiring, CommMonoidWithZero, CommSemiring,
SemilatticeInf, SemilatticeSup, DistribLattice, OrderedCommSemiring,
CanonicallyOrderedCommSemiring, Inhabited
#align nnreal NNReal
namespace NNReal
scoped notation "ββ₯0" => NNReal
noncomputable instance : FloorSemiring ββ₯0 := Nonneg.floorSemiring
instance instDenselyOrdered : DenselyOrdered ββ₯0 := Nonneg.instDenselyOrdered
instance : OrderBot ββ₯0 := inferInstance
instance : Archimedean ββ₯0 := Nonneg.archimedean
noncomputable instance : Sub ββ₯0 := Nonneg.sub
noncomputable instance : OrderedSub ββ₯0 := Nonneg.orderedSub
noncomputable instance : CanonicallyLinearOrderedSemifield ββ₯0 :=
Nonneg.canonicallyLinearOrderedSemifield
@[coe] def toReal : ββ₯0 β β := Subtype.val
instance : Coe ββ₯0 β := β¨toRealβ©
-- Simp lemma to put back `n.val` into the normal form given by the coercion.
@[simp]
theorem val_eq_coe (n : ββ₯0) : n.val = n :=
rfl
#align nnreal.val_eq_coe NNReal.val_eq_coe
instance canLift : CanLift β ββ₯0 toReal fun r => 0 β€ r :=
Subtype.canLift _
#align nnreal.can_lift NNReal.canLift
@[ext] protected theorem eq {n m : ββ₯0} : (n : β) = (m : β) β n = m :=
Subtype.eq
#align nnreal.eq NNReal.eq
protected theorem eq_iff {n m : ββ₯0} : (n : β) = (m : β) β n = m :=
Subtype.ext_iff.symm
#align nnreal.eq_iff NNReal.eq_iff
theorem ne_iff {x y : ββ₯0} : (x : β) β (y : β) β x β y :=
not_congr <| NNReal.eq_iff
#align nnreal.ne_iff NNReal.ne_iff
protected theorem Β«forallΒ» {p : ββ₯0 β Prop} :
(β x : ββ₯0, p x) β β (x : β) (hx : 0 β€ x), p β¨x, hxβ© :=
Subtype.forall
#align nnreal.forall NNReal.forall
protected theorem Β«existsΒ» {p : ββ₯0 β Prop} :
(β x : ββ₯0, p x) β β (x : β) (hx : 0 β€ x), p β¨x, hxβ© :=
Subtype.exists
#align nnreal.exists NNReal.exists
noncomputable def _root_.Real.toNNReal (r : β) : ββ₯0 :=
β¨max r 0, le_max_right _ _β©
#align real.to_nnreal Real.toNNReal
theorem _root_.Real.coe_toNNReal (r : β) (hr : 0 β€ r) : (Real.toNNReal r : β) = r :=
max_eq_left hr
#align real.coe_to_nnreal Real.coe_toNNReal
theorem _root_.Real.toNNReal_of_nonneg {r : β} (hr : 0 β€ r) : r.toNNReal = β¨r, hrβ© := by
simp_rw [Real.toNNReal, max_eq_left hr]
#align real.to_nnreal_of_nonneg Real.toNNReal_of_nonneg
theorem _root_.Real.le_coe_toNNReal (r : β) : r β€ Real.toNNReal r :=
le_max_left r 0
#align real.le_coe_to_nnreal Real.le_coe_toNNReal
theorem coe_nonneg (r : ββ₯0) : (0 : β) β€ r := r.2
#align nnreal.coe_nonneg NNReal.coe_nonneg
@[simp, norm_cast] theorem coe_mk (a : β) (ha) : toReal β¨a, haβ© = a := rfl
#align nnreal.coe_mk NNReal.coe_mk
example : Zero ββ₯0 := by infer_instance
example : One ββ₯0 := by infer_instance
example : Add ββ₯0 := by infer_instance
noncomputable example : Sub ββ₯0 := by infer_instance
example : Mul ββ₯0 := by infer_instance
noncomputable example : Inv ββ₯0 := by infer_instance
noncomputable example : Div ββ₯0 := by infer_instance
example : LE ββ₯0 := by infer_instance
example : Bot ββ₯0 := by infer_instance
example : Inhabited ββ₯0 := by infer_instance
example : Nontrivial ββ₯0 := by infer_instance
protected theorem coe_injective : Injective ((β) : ββ₯0 β β) := Subtype.coe_injective
#align nnreal.coe_injective NNReal.coe_injective
@[simp, norm_cast] lemma coe_inj {rβ rβ : ββ₯0} : (rβ : β) = rβ β rβ = rβ :=
NNReal.coe_injective.eq_iff
#align nnreal.coe_eq NNReal.coe_inj
@[deprecated (since := "2024-02-03")] protected alias coe_eq := coe_inj
@[simp, norm_cast] lemma coe_zero : ((0 : ββ₯0) : β) = 0 := rfl
#align nnreal.coe_zero NNReal.coe_zero
@[simp, norm_cast] lemma coe_one : ((1 : ββ₯0) : β) = 1 := rfl
#align nnreal.coe_one NNReal.coe_one
@[simp, norm_cast]
protected theorem coe_add (rβ rβ : ββ₯0) : ((rβ + rβ : ββ₯0) : β) = rβ + rβ :=
rfl
#align nnreal.coe_add NNReal.coe_add
@[simp, norm_cast]
protected theorem coe_mul (rβ rβ : ββ₯0) : ((rβ * rβ : ββ₯0) : β) = rβ * rβ :=
rfl
#align nnreal.coe_mul NNReal.coe_mul
@[simp, norm_cast]
protected theorem coe_inv (r : ββ₯0) : ((rβ»ΒΉ : ββ₯0) : β) = (r : β)β»ΒΉ :=
rfl
#align nnreal.coe_inv NNReal.coe_inv
@[simp, norm_cast]
protected theorem coe_div (rβ rβ : ββ₯0) : ((rβ / rβ : ββ₯0) : β) = (rβ : β) / rβ :=
rfl
#align nnreal.coe_div NNReal.coe_div
#noalign nnreal.coe_bit0
#noalign nnreal.coe_bit1
protected theorem coe_two : ((2 : ββ₯0) : β) = 2 := rfl
#align nnreal.coe_two NNReal.coe_two
@[simp, norm_cast]
protected theorem coe_sub {rβ rβ : ββ₯0} (h : rβ β€ rβ) : ((rβ - rβ : ββ₯0) : β) = βrβ - βrβ :=
max_eq_left <| le_sub_comm.2 <| by simp [show (rβ : β) β€ rβ from h]
#align nnreal.coe_sub NNReal.coe_sub
variable {r rβ rβ : ββ₯0} {x y : β}
@[simp, norm_cast] lemma coe_eq_zero : (r : β) = 0 β r = 0 := by rw [β coe_zero, coe_inj]
#align coe_eq_zero NNReal.coe_eq_zero
@[simp, norm_cast] lemma coe_eq_one : (r : β) = 1 β r = 1 := by rw [β coe_one, coe_inj]
#align coe_inj_one NNReal.coe_eq_one
@[norm_cast] lemma coe_ne_zero : (r : β) β 0 β r β 0 := coe_eq_zero.not
#align nnreal.coe_ne_zero NNReal.coe_ne_zero
@[norm_cast] lemma coe_ne_one : (r : β) β 1 β r β 1 := coe_eq_one.not
example : CommSemiring ββ₯0 := by infer_instance
def toRealHom : ββ₯0 β+* β where
toFun := (β)
map_one' := NNReal.coe_one
map_mul' := NNReal.coe_mul
map_zero' := NNReal.coe_zero
map_add' := NNReal.coe_add
#align nnreal.to_real_hom NNReal.toRealHom
@[simp] theorem coe_toRealHom : βtoRealHom = toReal := rfl
#align nnreal.coe_to_real_hom NNReal.coe_toRealHom
example : MonoidWithZero ββ₯0 := by infer_instance
example : CommMonoidWithZero ββ₯0 := by infer_instance
noncomputable example : CommGroupWithZero ββ₯0 := by infer_instance
@[simp, norm_cast]
theorem coe_indicator {Ξ±} (s : Set Ξ±) (f : Ξ± β ββ₯0) (a : Ξ±) :
((s.indicator f a : ββ₯0) : β) = s.indicator (fun x => β(f x)) a :=
(toRealHom : ββ₯0 β+ β).map_indicator _ _ _
#align nnreal.coe_indicator NNReal.coe_indicator
@[simp, norm_cast]
theorem coe_pow (r : ββ₯0) (n : β) : ((r ^ n : ββ₯0) : β) = (r : β) ^ n := rfl
#align nnreal.coe_pow NNReal.coe_pow
@[simp, norm_cast]
theorem coe_zpow (r : ββ₯0) (n : β€) : ((r ^ n : ββ₯0) : β) = (r : β) ^ n := rfl
#align nnreal.coe_zpow NNReal.coe_zpow
@[norm_cast]
theorem coe_list_sum (l : List ββ₯0) : ((l.sum : ββ₯0) : β) = (l.map (β)).sum :=
map_list_sum toRealHom l
#align nnreal.coe_list_sum NNReal.coe_list_sum
@[norm_cast]
theorem coe_list_prod (l : List ββ₯0) : ((l.prod : ββ₯0) : β) = (l.map (β)).prod :=
map_list_prod toRealHom l
#align nnreal.coe_list_prod NNReal.coe_list_prod
@[norm_cast]
theorem coe_multiset_sum (s : Multiset ββ₯0) : ((s.sum : ββ₯0) : β) = (s.map (β)).sum :=
map_multiset_sum toRealHom s
#align nnreal.coe_multiset_sum NNReal.coe_multiset_sum
@[norm_cast]
theorem coe_multiset_prod (s : Multiset ββ₯0) : ((s.prod : ββ₯0) : β) = (s.map (β)).prod :=
map_multiset_prod toRealHom s
#align nnreal.coe_multiset_prod NNReal.coe_multiset_prod
@[norm_cast]
theorem coe_sum {Ξ±} {s : Finset Ξ±} {f : Ξ± β ββ₯0} : β(β a β s, f a) = β a β s, (f a : β) :=
map_sum toRealHom _ _
#align nnreal.coe_sum NNReal.coe_sum
theorem _root_.Real.toNNReal_sum_of_nonneg {Ξ±} {s : Finset Ξ±} {f : Ξ± β β}
(hf : β a, a β s β 0 β€ f a) :
Real.toNNReal (β a β s, f a) = β a β s, Real.toNNReal (f a) := by
rw [β coe_inj, NNReal.coe_sum, Real.coe_toNNReal _ (Finset.sum_nonneg hf)]
exact Finset.sum_congr rfl fun x hxs => by rw [Real.coe_toNNReal _ (hf x hxs)]
#align real.to_nnreal_sum_of_nonneg Real.toNNReal_sum_of_nonneg
@[norm_cast]
theorem coe_prod {Ξ±} {s : Finset Ξ±} {f : Ξ± β ββ₯0} : β(β a β s, f a) = β a β s, (f a : β) :=
map_prod toRealHom _ _
#align nnreal.coe_prod NNReal.coe_prod
theorem _root_.Real.toNNReal_prod_of_nonneg {Ξ±} {s : Finset Ξ±} {f : Ξ± β β}
(hf : β a, a β s β 0 β€ f a) :
Real.toNNReal (β a β s, f a) = β a β s, Real.toNNReal (f a) := by
rw [β coe_inj, NNReal.coe_prod, Real.coe_toNNReal _ (Finset.prod_nonneg hf)]
exact Finset.prod_congr rfl fun x hxs => by rw [Real.coe_toNNReal _ (hf x hxs)]
#align real.to_nnreal_prod_of_nonneg Real.toNNReal_prod_of_nonneg
-- Porting note (#11215): TODO: `simp`? `norm_cast`?
theorem coe_nsmul (r : ββ₯0) (n : β) : β(n β’ r) = n β’ (r : β) := rfl
#align nnreal.nsmul_coe NNReal.coe_nsmul
@[simp, norm_cast]
protected theorem coe_natCast (n : β) : (β(βn : ββ₯0) : β) = n :=
map_natCast toRealHom n
#align nnreal.coe_nat_cast NNReal.coe_natCast
@[deprecated (since := "2024-04-17")]
alias coe_nat_cast := NNReal.coe_natCast
-- See note [no_index around OfNat.ofNat]
@[simp, norm_cast]
protected theorem coe_ofNat (n : β) [n.AtLeastTwo] :
(no_index (OfNat.ofNat n : ββ₯0) : β) = OfNat.ofNat n :=
rfl
@[simp, norm_cast]
protected theorem coe_ofScientific (m : β) (s : Bool) (e : β) :
β(OfScientific.ofScientific m s e : ββ₯0) = (OfScientific.ofScientific m s e : β) :=
rfl
noncomputable example : LinearOrder ββ₯0 := by infer_instance
@[simp, norm_cast] lemma coe_le_coe : (rβ : β) β€ rβ β rβ β€ rβ := Iff.rfl
#align nnreal.coe_le_coe NNReal.coe_le_coe
@[simp, norm_cast] lemma coe_lt_coe : (rβ : β) < rβ β rβ < rβ := Iff.rfl
#align nnreal.coe_lt_coe NNReal.coe_lt_coe
@[simp, norm_cast] lemma coe_pos : (0 : β) < r β 0 < r := Iff.rfl
#align nnreal.coe_pos NNReal.coe_pos
@[simp, norm_cast] lemma one_le_coe : 1 β€ (r : β) β 1 β€ r := by rw [β coe_le_coe, coe_one]
@[simp, norm_cast] lemma one_lt_coe : 1 < (r : β) β 1 < r := by rw [β coe_lt_coe, coe_one]
@[simp, norm_cast] lemma coe_le_one : (r : β) β€ 1 β r β€ 1 := by rw [β coe_le_coe, coe_one]
@[simp, norm_cast] lemma coe_lt_one : (r : β) < 1 β r < 1 := by rw [β coe_lt_coe, coe_one]
@[mono] lemma coe_mono : Monotone ((β) : ββ₯0 β β) := fun _ _ => NNReal.coe_le_coe.2
#align nnreal.coe_mono NNReal.coe_mono
@[gcongr] alias β¨_, GCongr.toReal_le_toRealβ© := coe_le_coe
protected theorem _root_.Real.toNNReal_mono : Monotone Real.toNNReal := fun _ _ h =>
max_le_max h (le_refl 0)
#align real.to_nnreal_mono Real.toNNReal_mono
@[simp]
theorem _root_.Real.toNNReal_coe {r : ββ₯0} : Real.toNNReal r = r :=
NNReal.eq <| max_eq_left r.2
#align real.to_nnreal_coe Real.toNNReal_coe
@[simp]
theorem mk_natCast (n : β) : @Eq ββ₯0 (β¨(n : β), n.cast_nonnegβ© : ββ₯0) n :=
NNReal.eq (NNReal.coe_natCast n).symm
#align nnreal.mk_coe_nat NNReal.mk_natCast
@[deprecated (since := "2024-04-05")] alias mk_coe_nat := mk_natCast
-- Porting note: place this in the `Real` namespace
@[simp]
theorem toNNReal_coe_nat (n : β) : Real.toNNReal n = n :=
NNReal.eq <| by simp [Real.coe_toNNReal]
#align nnreal.to_nnreal_coe_nat NNReal.toNNReal_coe_nat
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem _root_.Real.toNNReal_ofNat (n : β) [n.AtLeastTwo] :
Real.toNNReal (no_index (OfNat.ofNat n)) = OfNat.ofNat n :=
toNNReal_coe_nat n
noncomputable def gi : GaloisInsertion Real.toNNReal (β) :=
GaloisInsertion.monotoneIntro NNReal.coe_mono Real.toNNReal_mono Real.le_coe_toNNReal fun _ =>
Real.toNNReal_coe
#align nnreal.gi NNReal.gi
-- note that anything involving the (decidability of the) linear order,
-- will be noncomputable, everything else should not be.
example : OrderBot ββ₯0 := by infer_instance
example : PartialOrder ββ₯0 := by infer_instance
noncomputable example : CanonicallyLinearOrderedAddCommMonoid ββ₯0 := by infer_instance
noncomputable example : LinearOrderedAddCommMonoid ββ₯0 := by infer_instance
example : DistribLattice ββ₯0 := by infer_instance
example : SemilatticeInf ββ₯0 := by infer_instance
example : SemilatticeSup ββ₯0 := by infer_instance
noncomputable example : LinearOrderedSemiring ββ₯0 := by infer_instance
example : OrderedCommSemiring ββ₯0 := by infer_instance
noncomputable example : LinearOrderedCommMonoid ββ₯0 := by infer_instance
noncomputable example : LinearOrderedCommMonoidWithZero ββ₯0 := by infer_instance
noncomputable example : LinearOrderedCommGroupWithZero ββ₯0 := by infer_instance
example : CanonicallyOrderedCommSemiring ββ₯0 := by infer_instance
example : DenselyOrdered ββ₯0 := by infer_instance
example : NoMaxOrder ββ₯0 := by infer_instance
instance instPosSMulStrictMono {Ξ±} [Preorder Ξ±] [MulAction β Ξ±] [PosSMulStrictMono β Ξ±] :
PosSMulStrictMono ββ₯0 Ξ± where
elim _r hr _aβ _aβ ha := (smul_lt_smul_of_pos_left ha (coe_pos.2 hr):)
instance instSMulPosStrictMono {Ξ±} [Zero Ξ±] [Preorder Ξ±] [MulAction β Ξ±] [SMulPosStrictMono β Ξ±] :
SMulPosStrictMono ββ₯0 Ξ± where
elim _a ha _rβ _rβ hr := (smul_lt_smul_of_pos_right (coe_lt_coe.2 hr) ha:)
-- Porting note (#11215): TODO: restore once `simps` supports `ββ₯0` @[simps!? apply_coe_coe]
def orderIsoIccZeroCoe (a : ββ₯0) : Set.Icc (0 : β) a βo Set.Iic a where
toEquiv := Equiv.Set.sep (Set.Ici 0) fun x : β => x β€ a
map_rel_iff' := Iff.rfl
#align nnreal.order_iso_Icc_zero_coe NNReal.orderIsoIccZeroCoe
@[simp]
theorem orderIsoIccZeroCoe_apply_coe_coe (a : ββ₯0) (b : Set.Icc (0 : β) a) :
(orderIsoIccZeroCoe a b : β) = b :=
rfl
@[simp]
theorem orderIsoIccZeroCoe_symm_apply_coe (a : ββ₯0) (b : Set.Iic a) :
((orderIsoIccZeroCoe a).symm b : β) = b :=
rfl
#align nnreal.order_iso_Icc_zero_coe_symm_apply_coe NNReal.orderIsoIccZeroCoe_symm_apply_coe
-- note we need the `@` to make the `Membership.mem` have a sensible type
theorem coe_image {s : Set ββ₯0} :
(β) '' s = { x : β | β h : 0 β€ x, @Membership.mem ββ₯0 _ _ β¨x, hβ© s } :=
Subtype.coe_image
#align nnreal.coe_image NNReal.coe_image
theorem bddAbove_coe {s : Set ββ₯0} : BddAbove (((β) : ββ₯0 β β) '' s) β BddAbove s :=
Iff.intro
(fun β¨b, hbβ© =>
β¨Real.toNNReal b, fun β¨y, _β© hys =>
show y β€ max b 0 from le_max_of_le_left <| hb <| Set.mem_image_of_mem _ hysβ©)
fun β¨b, hbβ© => β¨b, fun _ β¨_, hx, eqβ© => eq βΈ hb hxβ©
#align nnreal.bdd_above_coe NNReal.bddAbove_coe
theorem bddBelow_coe (s : Set ββ₯0) : BddBelow (((β) : ββ₯0 β β) '' s) :=
β¨0, fun _ β¨q, _, eqβ© => eq βΈ q.2β©
#align nnreal.bdd_below_coe NNReal.bddBelow_coe
noncomputable instance : ConditionallyCompleteLinearOrderBot ββ₯0 :=
Nonneg.conditionallyCompleteLinearOrderBot 0
@[norm_cast]
theorem coe_sSup (s : Set ββ₯0) : (β(sSup s) : β) = sSup (((β) : ββ₯0 β β) '' s) := by
rcases Set.eq_empty_or_nonempty s with rfl|hs
Β· simp
by_cases H : BddAbove s
Β· have A : sSup (Subtype.val '' s) β Set.Ici 0 := by
apply Real.sSup_nonneg
rintro - β¨y, -, rflβ©
exact y.2
exact (@subset_sSup_of_within β (Set.Ici (0 : β)) _ _ (_) s hs H A).symm
Β· simp only [csSup_of_not_bddAbove H, csSup_empty, bot_eq_zero', NNReal.coe_zero]
apply (Real.sSup_of_not_bddAbove ?_).symm
contrapose! H
exact bddAbove_coe.1 H
#align nnreal.coe_Sup NNReal.coe_sSup
@[simp, norm_cast] -- Porting note: add `simp`
theorem coe_iSup {ΞΉ : Sort*} (s : ΞΉ β ββ₯0) : (β(β¨ i, s i) : β) = β¨ i, β(s i) := by
rw [iSup, iSup, coe_sSup, β Set.range_comp]; rfl
#align nnreal.coe_supr NNReal.coe_iSup
@[norm_cast]
theorem coe_sInf (s : Set ββ₯0) : (β(sInf s) : β) = sInf (((β) : ββ₯0 β β) '' s) := by
rcases Set.eq_empty_or_nonempty s with rfl|hs
Β· simp only [Set.image_empty, Real.sInf_empty, coe_eq_zero]
exact @subset_sInf_emptyset β (Set.Ici (0 : β)) _ _ (_)
have A : sInf (Subtype.val '' s) β Set.Ici 0 := by
apply Real.sInf_nonneg
rintro - β¨y, -, rflβ©
exact y.2
exact (@subset_sInf_of_within β (Set.Ici (0 : β)) _ _ (_) s hs (OrderBot.bddBelow s) A).symm
#align nnreal.coe_Inf NNReal.coe_sInf
@[simp]
theorem sInf_empty : sInf (β
: Set ββ₯0) = 0 := by
rw [β coe_eq_zero, coe_sInf, Set.image_empty, Real.sInf_empty]
#align nnreal.Inf_empty NNReal.sInf_empty
@[norm_cast]
| Mathlib/Data/Real/NNReal.lean | 550 | 551 | theorem coe_iInf {ΞΉ : Sort*} (s : ΞΉ β ββ₯0) : (β(β¨
i, s i) : β) = β¨
i, β(s i) := by |
rw [iInf, iInf, coe_sInf, β Set.range_comp]; rfl
|
import Mathlib.Algebra.Order.Group.Instances
import Mathlib.Analysis.Convex.Segment
import Mathlib.Tactic.GCongr
#align_import analysis.convex.star from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Set
open Convex Pointwise
variable {π E F : Type*}
section OrderedSemiring
variable [OrderedSemiring π]
section AddCommMonoid
variable [AddCommMonoid E] [AddCommMonoid F]
section AddCommGroup
variable [AddCommGroup E] [AddCommGroup F] [Module π E] [Module π F] {x y : E} {s t : Set E}
theorem StarConvex.add_smul_mem (hs : StarConvex π x s) (hy : x + y β s) {t : π} (htβ : 0 β€ t)
(htβ : t β€ 1) : x + t β’ y β s := by
have h : x + t β’ y = (1 - t) β’ x + t β’ (x + y) := by
rw [smul_add, β add_assoc, β add_smul, sub_add_cancel, one_smul]
rw [h]
exact hs hy (sub_nonneg_of_le htβ) htβ (sub_add_cancel _ _)
#align star_convex.add_smul_mem StarConvex.add_smul_mem
theorem StarConvex.smul_mem (hs : StarConvex π 0 s) (hx : x β s) {t : π} (htβ : 0 β€ t)
(htβ : t β€ 1) : t β’ x β s := by simpa using hs.add_smul_mem (by simpa using hx) htβ htβ
#align star_convex.smul_mem StarConvex.smul_mem
theorem StarConvex.add_smul_sub_mem (hs : StarConvex π x s) (hy : y β s) {t : π} (htβ : 0 β€ t)
(htβ : t β€ 1) : x + t β’ (y - x) β s := by
apply hs.segment_subset hy
rw [segment_eq_image']
exact mem_image_of_mem _ β¨htβ, htββ©
#align star_convex.add_smul_sub_mem StarConvex.add_smul_sub_mem
theorem StarConvex.affine_preimage (f : E βα΅[π] F) {s : Set F} (hs : StarConvex π (f x) s) :
StarConvex π x (f β»ΒΉ' s) := by
intro y hy a b ha hb hab
rw [mem_preimage, Convex.combo_affine_apply hab]
exact hs hy ha hb hab
#align star_convex.affine_preimage StarConvex.affine_preimage
theorem StarConvex.affine_image (f : E βα΅[π] F) {s : Set E} (hs : StarConvex π x s) :
StarConvex π (f x) (f '' s) := by
rintro y β¨y', β¨hy', hy'fβ©β© a b ha hb hab
refine β¨a β’ x + b β’ y', β¨hs hy' ha hb hab, ?_β©β©
rw [Convex.combo_affine_apply hab, hy'f]
#align star_convex.affine_image StarConvex.affine_image
| Mathlib/Analysis/Convex/Star.lean | 367 | 369 | theorem StarConvex.neg (hs : StarConvex π x s) : StarConvex π (-x) (-s) := by |
rw [β image_neg]
exact hs.is_linear_image IsLinearMap.isLinearMap_neg
|
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 LieModule
variable {Mβ : Type wβ} [AddCommGroup Mβ] [Module R Mβ] [LieRingModule L Mβ] [LieModule R L Mβ]
variable (R L M)
theorem antitone_lowerCentralSeries : Antitone <| lowerCentralSeries R L M := by
intro l k
induction' k with k ih generalizing l <;> intro h
Β· exact (Nat.le_zero.mp h).symm βΈ le_rfl
Β· rcases Nat.of_le_succ h with (hk | hk)
Β· rw [lowerCentralSeries_succ]
exact (LieSubmodule.mono_lie_right _ _ β€ (ih hk)).trans (LieSubmodule.lie_le_right _ _)
Β· exact hk.symm βΈ le_rfl
#align lie_module.antitone_lower_central_series LieModule.antitone_lowerCentralSeries
theorem eventually_iInf_lowerCentralSeries_eq [IsArtinian R M] :
βαΆ l in Filter.atTop, β¨
k, lowerCentralSeries R L M k = lowerCentralSeries R L M l := by
have h_wf : WellFounded ((Β· > Β·) : (LieSubmodule R L M)α΅α΅ β (LieSubmodule R L M)α΅α΅ β Prop) :=
LieSubmodule.wellFounded_of_isArtinian R L M
obtain β¨n, hn : β m, n β€ m β lowerCentralSeries R L M n = lowerCentralSeries R L M mβ© :=
WellFounded.monotone_chain_condition.mp h_wf β¨_, antitone_lowerCentralSeries R L Mβ©
refine Filter.eventually_atTop.mpr β¨n, fun l hl β¦ le_antisymm (iInf_le _ _) (le_iInf fun m β¦ ?_)β©
rcases le_or_lt l m with h | h
Β· rw [β hn _ hl, β hn _ (hl.trans h)]
Β· exact antitone_lowerCentralSeries R L M (le_of_lt h)
theorem trivial_iff_lower_central_eq_bot : IsTrivial L M β lowerCentralSeries R L M 1 = β₯ := by
constructor <;> intro h
Β· erw [eq_bot_iff, LieSubmodule.lieSpan_le]; rintro m β¨x, n, hnβ©; rw [β hn, h.trivial]; simp
Β· rw [LieSubmodule.eq_bot_iff] at h; apply IsTrivial.mk; intro x m; apply h
apply LieSubmodule.subset_lieSpan
-- Porting note: was `use x, m; rfl`
simp only [LieSubmodule.top_coe, Subtype.exists, LieSubmodule.mem_top, exists_prop, true_and,
Set.mem_setOf]
exact β¨x, m, rflβ©
#align lie_module.trivial_iff_lower_central_eq_bot LieModule.trivial_iff_lower_central_eq_bot
theorem iterate_toEnd_mem_lowerCentralSeries (x : L) (m : M) (k : β) :
(toEnd R L M x)^[k] m β lowerCentralSeries R L M k := by
induction' k with k ih
Β· simp only [Nat.zero_eq, Function.iterate_zero, lowerCentralSeries_zero, LieSubmodule.mem_top]
Β· simp only [lowerCentralSeries_succ, Function.comp_apply, Function.iterate_succ',
toEnd_apply_apply]
exact LieSubmodule.lie_mem_lie _ _ (LieSubmodule.mem_top x) ih
#align lie_module.iterate_to_endomorphism_mem_lower_central_series LieModule.iterate_toEnd_mem_lowerCentralSeries
theorem iterate_toEnd_mem_lowerCentralSeriesβ (x y : L) (m : M) (k : β) :
(toEnd R L M x ββ toEnd R L M y)^[k] m β
lowerCentralSeries R L M (2 * k) := by
induction' k with k ih
Β· simp
have hk : 2 * k.succ = (2 * k + 1) + 1 := rfl
simp only [lowerCentralSeries_succ, Function.comp_apply, Function.iterate_succ', hk,
toEnd_apply_apply, LinearMap.coe_comp, toEnd_apply_apply]
refine LieSubmodule.lie_mem_lie _ _ (LieSubmodule.mem_top x) ?_
exact LieSubmodule.lie_mem_lie _ _ (LieSubmodule.mem_top y) ih
variable {R L M}
theorem map_lowerCentralSeries_le (f : M βββ
R,Lβ Mβ) :
(lowerCentralSeries R L M k).map f β€ lowerCentralSeries R L Mβ k := by
induction' k with k ih
Β· simp only [Nat.zero_eq, lowerCentralSeries_zero, le_top]
Β· simp only [LieModule.lowerCentralSeries_succ, LieSubmodule.map_bracket_eq]
exact LieSubmodule.mono_lie_right _ _ β€ ih
#align lie_module.map_lower_central_series_le LieModule.map_lowerCentralSeries_le
lemma map_lowerCentralSeries_eq {f : M βββ
R,Lβ Mβ} (hf : Function.Surjective f) :
(lowerCentralSeries R L M k).map f = lowerCentralSeries R L Mβ k := by
apply le_antisymm (map_lowerCentralSeries_le k f)
induction' k with k ih
Β· rwa [lowerCentralSeries_zero, lowerCentralSeries_zero, top_le_iff, f.map_top, f.range_eq_top]
Β· simp only [lowerCentralSeries_succ, LieSubmodule.map_bracket_eq]
apply LieSubmodule.mono_lie_right
assumption
variable (R L M)
open LieAlgebra
theorem derivedSeries_le_lowerCentralSeries (k : β) :
derivedSeries R L k β€ lowerCentralSeries R L L k := by
induction' k with k h
Β· rw [derivedSeries_def, derivedSeriesOfIdeal_zero, lowerCentralSeries_zero]
Β· have h' : derivedSeries R L k β€ β€ := by simp only [le_top]
rw [derivedSeries_def, derivedSeriesOfIdeal_succ, lowerCentralSeries_succ]
exact LieSubmodule.mono_lie _ _ _ _ h' h
#align lie_module.derived_series_le_lower_central_series LieModule.derivedSeries_le_lowerCentralSeries
class IsNilpotent : Prop where
nilpotent : β k, lowerCentralSeries R L M k = β₯
#align lie_module.is_nilpotent LieModule.IsNilpotent
theorem exists_lowerCentralSeries_eq_bot_of_isNilpotent [IsNilpotent R L M] :
β k, lowerCentralSeries R L M k = β₯ :=
IsNilpotent.nilpotent
@[simp] lemma iInf_lowerCentralSeries_eq_bot_of_isNilpotent [IsNilpotent R L M] :
β¨
k, lowerCentralSeries R L M k = β₯ := by
obtain β¨k, hkβ© := exists_lowerCentralSeries_eq_bot_of_isNilpotent R L M
rw [eq_bot_iff, β hk]
exact iInf_le _ _
theorem isNilpotent_iff : IsNilpotent R L M β β k, lowerCentralSeries R L M k = β₯ :=
β¨fun h => h.nilpotent, fun h => β¨hβ©β©
#align lie_module.is_nilpotent_iff LieModule.isNilpotent_iff
variable {R L M}
theorem _root_.LieSubmodule.isNilpotent_iff_exists_lcs_eq_bot (N : LieSubmodule R L M) :
LieModule.IsNilpotent R L N β β k, N.lcs k = β₯ := by
rw [isNilpotent_iff]
refine exists_congr fun k => ?_
rw [N.lowerCentralSeries_eq_lcs_comap k, LieSubmodule.comap_incl_eq_bot,
inf_eq_right.mpr (N.lcs_le_self k)]
#align lie_submodule.is_nilpotent_iff_exists_lcs_eq_bot LieSubmodule.isNilpotent_iff_exists_lcs_eq_bot
variable (R L M)
instance (priority := 100) trivialIsNilpotent [IsTrivial L M] : IsNilpotent R L M :=
β¨by use 1; change β
β€, β€β = β₯; simpβ©
#align lie_module.trivial_is_nilpotent LieModule.trivialIsNilpotent
theorem exists_forall_pow_toEnd_eq_zero [hM : IsNilpotent R L M] :
β k : β, β x : L, toEnd R L M x ^ k = 0 := by
obtain β¨k, hMβ© := hM
use k
intro x; ext m
rw [LinearMap.pow_apply, LinearMap.zero_apply, β @LieSubmodule.mem_bot R L M, β hM]
exact iterate_toEnd_mem_lowerCentralSeries R L M x m k
#align lie_module.nilpotent_endo_of_nilpotent_module LieModule.exists_forall_pow_toEnd_eq_zero
| Mathlib/Algebra/Lie/Nilpotent.lean | 264 | 268 | theorem isNilpotent_toEnd_of_isNilpotent [IsNilpotent R L M] (x : L) :
_root_.IsNilpotent (toEnd R L M x) := by |
change β k, toEnd R L M x ^ k = 0
have := exists_forall_pow_toEnd_eq_zero R L M
tauto
|
import Mathlib.Geometry.Manifold.MFDeriv.Defs
#align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
noncomputable section
open scoped Topology Manifold
open Set Bundle
section DerivativesProperties
variable
{π : Type*} [NontriviallyNormedField π]
{E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners π E H)
{M : Type*} [TopologicalSpace M] [ChartedSpace H M]
{E' : Type*} [NormedAddCommGroup E'] [NormedSpace π E']
{H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners π E' H'}
{M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
{E'' : Type*} [NormedAddCommGroup E''] [NormedSpace π E'']
{H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners π E'' H''}
{M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
{f fβ fβ : M β M'} {x : M} {s t : Set M} {g : M' β M''} {u : Set M'}
theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x := by
unfold UniqueMDiffWithinAt
simp only [preimage_univ, univ_inter]
exact I.unique_diff _ (mem_range_self _)
#align unique_mdiff_within_at_univ uniqueMDiffWithinAt_univ
variable {I}
theorem uniqueMDiffWithinAt_iff {s : Set M} {x : M} :
UniqueMDiffWithinAt I s x β
UniqueDiffWithinAt π ((extChartAt I x).symm β»ΒΉ' s β© (extChartAt I x).target)
((extChartAt I x) x) := by
apply uniqueDiffWithinAt_congr
rw [nhdsWithin_inter, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
#align unique_mdiff_within_at_iff uniqueMDiffWithinAt_iff
nonrec theorem UniqueMDiffWithinAt.mono_nhds {s t : Set M} {x : M} (hs : UniqueMDiffWithinAt I s x)
(ht : π[s] x β€ π[t] x) : UniqueMDiffWithinAt I t x :=
hs.mono_nhds <| by simpa only [β map_extChartAt_nhdsWithin] using Filter.map_mono ht
theorem UniqueMDiffWithinAt.mono_of_mem {s t : Set M} {x : M} (hs : UniqueMDiffWithinAt I s x)
(ht : t β π[s] x) : UniqueMDiffWithinAt I t x :=
hs.mono_nhds (nhdsWithin_le_iff.2 ht)
theorem UniqueMDiffWithinAt.mono (h : UniqueMDiffWithinAt I s x) (st : s β t) :
UniqueMDiffWithinAt I t x :=
UniqueDiffWithinAt.mono h <| inter_subset_inter (preimage_mono st) (Subset.refl _)
#align unique_mdiff_within_at.mono UniqueMDiffWithinAt.mono
theorem UniqueMDiffWithinAt.inter' (hs : UniqueMDiffWithinAt I s x) (ht : t β π[s] x) :
UniqueMDiffWithinAt I (s β© t) x :=
hs.mono_of_mem (Filter.inter_mem self_mem_nhdsWithin ht)
#align unique_mdiff_within_at.inter' UniqueMDiffWithinAt.inter'
theorem UniqueMDiffWithinAt.inter (hs : UniqueMDiffWithinAt I s x) (ht : t β π x) :
UniqueMDiffWithinAt I (s β© t) x :=
hs.inter' (nhdsWithin_le_nhds ht)
#align unique_mdiff_within_at.inter UniqueMDiffWithinAt.inter
theorem IsOpen.uniqueMDiffWithinAt (hs : IsOpen s) (xs : x β s) : UniqueMDiffWithinAt I s x :=
(uniqueMDiffWithinAt_univ I).mono_of_mem <| nhdsWithin_le_nhds <| hs.mem_nhds xs
#align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt
theorem UniqueMDiffOn.inter (hs : UniqueMDiffOn I s) (ht : IsOpen t) : UniqueMDiffOn I (s β© t) :=
fun _x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (ht.mem_nhds hx.2)
#align unique_mdiff_on.inter UniqueMDiffOn.inter
theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s :=
fun _x hx => hs.uniqueMDiffWithinAt hx
#align is_open.unique_mdiff_on IsOpen.uniqueMDiffOn
theorem uniqueMDiffOn_univ : UniqueMDiffOn I (univ : Set M) :=
isOpen_univ.uniqueMDiffOn
#align unique_mdiff_on_univ uniqueMDiffOn_univ
variable [Is : SmoothManifoldWithCorners I M] [I's : SmoothManifoldWithCorners I' M']
[I''s : SmoothManifoldWithCorners I'' M'']
{f' fβ' fβ' : TangentSpace I x βL[π] TangentSpace I' (f x)}
{g' : TangentSpace I' (f x) βL[π] TangentSpace I'' (g (f x))}
nonrec theorem UniqueMDiffWithinAt.eq (U : UniqueMDiffWithinAt I s x)
(h : HasMFDerivWithinAt I I' f s x f') (hβ : HasMFDerivWithinAt I I' f s x fβ') : f' = fβ' := by
-- Porting note: didn't need `convert` because of finding instances by unification
convert U.eq h.2 hβ.2
#align unique_mdiff_within_at.eq UniqueMDiffWithinAt.eq
theorem UniqueMDiffOn.eq (U : UniqueMDiffOn I s) (hx : x β s) (h : HasMFDerivWithinAt I I' f s x f')
(hβ : HasMFDerivWithinAt I I' f s x fβ') : f' = fβ' :=
UniqueMDiffWithinAt.eq (U _ hx) h hβ
#align unique_mdiff_on.eq UniqueMDiffOn.eq
nonrec theorem UniqueMDiffWithinAt.prod {x : M} {y : M'} {s t} (hs : UniqueMDiffWithinAt I s x)
(ht : UniqueMDiffWithinAt I' t y) : UniqueMDiffWithinAt (I.prod I') (s ΓΛ’ t) (x, y) := by
refine (hs.prod ht).mono ?_
rw [ModelWithCorners.range_prod, β prod_inter_prod]
rfl
theorem UniqueMDiffOn.prod {s : Set M} {t : Set M'} (hs : UniqueMDiffOn I s)
(ht : UniqueMDiffOn I' t) : UniqueMDiffOn (I.prod I') (s ΓΛ’ t) := fun x h β¦
(hs x.1 h.1).prod (ht x.2 h.2)
theorem mdifferentiableWithinAt_iff {f : M β M'} {s : Set M} {x : M} :
MDifferentiableWithinAt I I' f s x β
ContinuousWithinAt f s x β§
DifferentiableWithinAt π (writtenInExtChartAt I I' x f)
((extChartAt I x).target β© (extChartAt I x).symm β»ΒΉ' s) ((extChartAt I x) x) := by
rw [mdifferentiableWithinAt_iff']
refine and_congr Iff.rfl (exists_congr fun f' => ?_)
rw [inter_comm]
simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq]
#align mdifferentiable_within_at_iff mdifferentiableWithinAt_iff
theorem mdifferentiableWithinAt_iff_of_mem_source {x' : M} {y : M'}
(hx : x' β (chartAt H x).source) (hy : f x' β (chartAt H' y).source) :
MDifferentiableWithinAt I I' f s x' β
ContinuousWithinAt f s x' β§
DifferentiableWithinAt π (extChartAt I' y β f β (extChartAt I x).symm)
((extChartAt I x).symm β»ΒΉ' s β© Set.range I) ((extChartAt I x) x') :=
(differentiable_within_at_localInvariantProp I I').liftPropWithinAt_indep_chart
(StructureGroupoid.chart_mem_maximalAtlas _ x) hx (StructureGroupoid.chart_mem_maximalAtlas _ y)
hy
#align mdifferentiable_within_at_iff_of_mem_source mdifferentiableWithinAt_iff_of_mem_source
theorem mfderivWithin_zero_of_not_mdifferentiableWithinAt
(h : Β¬MDifferentiableWithinAt I I' f s x) : mfderivWithin I I' f s x = 0 := by
simp only [mfderivWithin, h, if_neg, not_false_iff]
#align mfderiv_within_zero_of_not_mdifferentiable_within_at mfderivWithin_zero_of_not_mdifferentiableWithinAt
theorem mfderiv_zero_of_not_mdifferentiableAt (h : Β¬MDifferentiableAt I I' f x) :
mfderiv I I' f x = 0 := by simp only [mfderiv, h, if_neg, not_false_iff]
#align mfderiv_zero_of_not_mdifferentiable_at mfderiv_zero_of_not_mdifferentiableAt
theorem HasMFDerivWithinAt.mono (h : HasMFDerivWithinAt I I' f t x f') (hst : s β t) :
HasMFDerivWithinAt I I' f s x f' :=
β¨ContinuousWithinAt.mono h.1 hst,
HasFDerivWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))β©
#align has_mfderiv_within_at.mono HasMFDerivWithinAt.mono
theorem HasMFDerivAt.hasMFDerivWithinAt (h : HasMFDerivAt I I' f x f') :
HasMFDerivWithinAt I I' f s x f' :=
β¨ContinuousAt.continuousWithinAt h.1, HasFDerivWithinAt.mono h.2 inter_subset_rightβ©
#align has_mfderiv_at.has_mfderiv_within_at HasMFDerivAt.hasMFDerivWithinAt
theorem HasMFDerivWithinAt.mdifferentiableWithinAt (h : HasMFDerivWithinAt I I' f s x f') :
MDifferentiableWithinAt I I' f s x :=
β¨h.1, β¨f', h.2β©β©
#align has_mfderiv_within_at.mdifferentiable_within_at HasMFDerivWithinAt.mdifferentiableWithinAt
theorem HasMFDerivAt.mdifferentiableAt (h : HasMFDerivAt I I' f x f') :
MDifferentiableAt I I' f x := by
rw [mdifferentiableAt_iff]
exact β¨h.1, β¨f', h.2β©β©
#align has_mfderiv_at.mdifferentiable_at HasMFDerivAt.mdifferentiableAt
@[simp, mfld_simps]
theorem hasMFDerivWithinAt_univ :
HasMFDerivWithinAt I I' f univ x f' β HasMFDerivAt I I' f x f' := by
simp only [HasMFDerivWithinAt, HasMFDerivAt, continuousWithinAt_univ, mfld_simps]
#align has_mfderiv_within_at_univ hasMFDerivWithinAt_univ
theorem hasMFDerivAt_unique (hβ : HasMFDerivAt I I' f x fβ') (hβ : HasMFDerivAt I I' f x fβ') :
fβ' = fβ' := by
rw [β hasMFDerivWithinAt_univ] at hβ hβ
exact (uniqueMDiffWithinAt_univ I).eq hβ hβ
#align has_mfderiv_at_unique hasMFDerivAt_unique
theorem hasMFDerivWithinAt_inter' (h : t β π[s] x) :
HasMFDerivWithinAt I I' f (s β© t) x f' β HasMFDerivWithinAt I I' f s x f' := by
rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq,
hasFDerivWithinAt_inter', continuousWithinAt_inter' h]
exact extChartAt_preimage_mem_nhdsWithin I h
#align has_mfderiv_within_at_inter' hasMFDerivWithinAt_inter'
theorem hasMFDerivWithinAt_inter (h : t β π x) :
HasMFDerivWithinAt I I' f (s β© t) x f' β HasMFDerivWithinAt I I' f s x f' := by
rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter,
continuousWithinAt_inter h]
exact extChartAt_preimage_mem_nhds I h
#align has_mfderiv_within_at_inter hasMFDerivWithinAt_inter
theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f')
(ht : HasMFDerivWithinAt I I' f t x f') : HasMFDerivWithinAt I I' f (s βͺ t) x f' := by
constructor
Β· exact ContinuousWithinAt.union hs.1 ht.1
Β· convert HasFDerivWithinAt.union hs.2 ht.2 using 1
simp only [union_inter_distrib_right, preimage_union]
#align has_mfderiv_within_at.union HasMFDerivWithinAt.union
theorem HasMFDerivWithinAt.mono_of_mem (h : HasMFDerivWithinAt I I' f s x f') (ht : s β π[t] x) :
HasMFDerivWithinAt I I' f t x f' :=
(hasMFDerivWithinAt_inter' ht).1 (h.mono inter_subset_right)
#align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.mono_of_mem
theorem HasMFDerivWithinAt.hasMFDerivAt (h : HasMFDerivWithinAt I I' f s x f') (hs : s β π x) :
HasMFDerivAt I I' f x f' := by
rwa [β univ_inter s, hasMFDerivWithinAt_inter hs, hasMFDerivWithinAt_univ] at h
#align has_mfderiv_within_at.has_mfderiv_at HasMFDerivWithinAt.hasMFDerivAt
theorem MDifferentiableWithinAt.hasMFDerivWithinAt (h : MDifferentiableWithinAt I I' f s x) :
HasMFDerivWithinAt I I' f s x (mfderivWithin I I' f s x) := by
refine β¨h.1, ?_β©
simp only [mfderivWithin, h, if_pos, mfld_simps]
exact DifferentiableWithinAt.hasFDerivWithinAt h.2
#align mdifferentiable_within_at.has_mfderiv_within_at MDifferentiableWithinAt.hasMFDerivWithinAt
protected theorem MDifferentiableWithinAt.mfderivWithin (h : MDifferentiableWithinAt I I' f s x) :
mfderivWithin I I' f s x =
fderivWithin π (writtenInExtChartAt I I' x f : _) ((extChartAt I x).symm β»ΒΉ' s β© range I)
((extChartAt I x) x) := by
simp only [mfderivWithin, h, if_pos]
#align mdifferentiable_within_at.mfderiv_within MDifferentiableWithinAt.mfderivWithin
theorem MDifferentiableAt.hasMFDerivAt (h : MDifferentiableAt I I' f x) :
HasMFDerivAt I I' f x (mfderiv I I' f x) := by
refine β¨h.continuousAt, ?_β©
simp only [mfderiv, h, if_pos, mfld_simps]
exact DifferentiableWithinAt.hasFDerivWithinAt h.differentiableWithinAt_writtenInExtChartAt
#align mdifferentiable_at.has_mfderiv_at MDifferentiableAt.hasMFDerivAt
protected theorem MDifferentiableAt.mfderiv (h : MDifferentiableAt I I' f x) :
mfderiv I I' f x =
fderivWithin π (writtenInExtChartAt I I' x f : _) (range I) ((extChartAt I x) x) := by
simp only [mfderiv, h, if_pos]
#align mdifferentiable_at.mfderiv MDifferentiableAt.mfderiv
protected theorem HasMFDerivAt.mfderiv (h : HasMFDerivAt I I' f x f') : mfderiv I I' f x = f' :=
(hasMFDerivAt_unique h h.mdifferentiableAt.hasMFDerivAt).symm
#align has_mfderiv_at.mfderiv HasMFDerivAt.mfderiv
theorem HasMFDerivWithinAt.mfderivWithin (h : HasMFDerivWithinAt I I' f s x f')
(hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = f' := by
ext
rw [hxs.eq h h.mdifferentiableWithinAt.hasMFDerivWithinAt]
#align has_mfderiv_within_at.mfderiv_within HasMFDerivWithinAt.mfderivWithin
theorem MDifferentiable.mfderivWithin (h : MDifferentiableAt I I' f x)
(hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = mfderiv I I' f x := by
apply HasMFDerivWithinAt.mfderivWithin _ hxs
exact h.hasMFDerivAt.hasMFDerivWithinAt
#align mdifferentiable.mfderiv_within MDifferentiable.mfderivWithin
theorem mfderivWithin_subset (st : s β t) (hs : UniqueMDiffWithinAt I s x)
(h : MDifferentiableWithinAt I I' f t x) :
mfderivWithin I I' f s x = mfderivWithin I I' f t x :=
((MDifferentiableWithinAt.hasMFDerivWithinAt h).mono st).mfderivWithin hs
#align mfderiv_within_subset mfderivWithin_subset
theorem MDifferentiableWithinAt.mono (hst : s β t) (h : MDifferentiableWithinAt I I' f t x) :
MDifferentiableWithinAt I I' f s x :=
β¨ContinuousWithinAt.mono h.1 hst, DifferentiableWithinAt.mono
h.differentiableWithinAt_writtenInExtChartAt
(inter_subset_inter_left _ (preimage_mono hst))β©
#align mdifferentiable_within_at.mono MDifferentiableWithinAt.mono
theorem mdifferentiableWithinAt_univ :
MDifferentiableWithinAt I I' f univ x β MDifferentiableAt I I' f x := by
simp_rw [MDifferentiableWithinAt, MDifferentiableAt, ChartedSpace.LiftPropAt]
#align mdifferentiable_within_at_univ mdifferentiableWithinAt_univ
theorem mdifferentiableWithinAt_inter (ht : t β π x) :
MDifferentiableWithinAt I I' f (s β© t) x β MDifferentiableWithinAt I I' f s x := by
rw [MDifferentiableWithinAt, MDifferentiableWithinAt,
(differentiable_within_at_localInvariantProp I I').liftPropWithinAt_inter ht]
#align mdifferentiable_within_at_inter mdifferentiableWithinAt_inter
theorem mdifferentiableWithinAt_inter' (ht : t β π[s] x) :
MDifferentiableWithinAt I I' f (s β© t) x β MDifferentiableWithinAt I I' f s x := by
rw [MDifferentiableWithinAt, MDifferentiableWithinAt,
(differentiable_within_at_localInvariantProp I I').liftPropWithinAt_inter' ht]
#align mdifferentiable_within_at_inter' mdifferentiableWithinAt_inter'
theorem MDifferentiableAt.mdifferentiableWithinAt (h : MDifferentiableAt I I' f x) :
MDifferentiableWithinAt I I' f s x :=
MDifferentiableWithinAt.mono (subset_univ _) (mdifferentiableWithinAt_univ.2 h)
#align mdifferentiable_at.mdifferentiable_within_at MDifferentiableAt.mdifferentiableWithinAt
theorem MDifferentiableWithinAt.mdifferentiableAt (h : MDifferentiableWithinAt I I' f s x)
(hs : s β π x) : MDifferentiableAt I I' f x := by
have : s = univ β© s := by rw [univ_inter]
rwa [this, mdifferentiableWithinAt_inter hs, mdifferentiableWithinAt_univ] at h
#align mdifferentiable_within_at.mdifferentiable_at MDifferentiableWithinAt.mdifferentiableAt
theorem MDifferentiableOn.mdifferentiableAt (h : MDifferentiableOn I I' f s) (hx : s β π x) :
MDifferentiableAt I I' f x :=
(h x (mem_of_mem_nhds hx)).mdifferentiableAt hx
theorem MDifferentiableOn.mono (h : MDifferentiableOn I I' f t) (st : s β t) :
MDifferentiableOn I I' f s := fun x hx => (h x (st hx)).mono st
#align mdifferentiable_on.mono MDifferentiableOn.mono
theorem mdifferentiableOn_univ : MDifferentiableOn I I' f univ β MDifferentiable I I' f := by
simp only [MDifferentiableOn, mdifferentiableWithinAt_univ, mfld_simps]; rfl
#align mdifferentiable_on_univ mdifferentiableOn_univ
theorem MDifferentiable.mdifferentiableOn (h : MDifferentiable I I' f) :
MDifferentiableOn I I' f s :=
(mdifferentiableOn_univ.2 h).mono (subset_univ _)
#align mdifferentiable.mdifferentiable_on MDifferentiable.mdifferentiableOn
theorem mdifferentiableOn_of_locally_mdifferentiableOn
(h : β x β s, β u, IsOpen u β§ x β u β§ MDifferentiableOn I I' f (s β© u)) :
MDifferentiableOn I I' f s := by
intro x xs
rcases h x xs with β¨t, t_open, xt, htβ©
exact (mdifferentiableWithinAt_inter (t_open.mem_nhds xt)).1 (ht x β¨xs, xtβ©)
#align mdifferentiable_on_of_locally_mdifferentiable_on mdifferentiableOn_of_locally_mdifferentiableOn
@[simp, mfld_simps]
theorem mfderivWithin_univ : mfderivWithin I I' f univ = mfderiv I I' f := by
ext x : 1
simp only [mfderivWithin, mfderiv, mfld_simps]
rw [mdifferentiableWithinAt_univ]
#align mfderiv_within_univ mfderivWithin_univ
theorem mfderivWithin_inter (ht : t β π x) :
mfderivWithin I I' f (s β© t) x = mfderivWithin I I' f s x := by
rw [mfderivWithin, mfderivWithin, extChartAt_preimage_inter_eq, mdifferentiableWithinAt_inter ht,
fderivWithin_inter (extChartAt_preimage_mem_nhds I ht)]
#align mfderiv_within_inter mfderivWithin_inter
theorem mfderivWithin_of_mem_nhds (h : s β π x) : mfderivWithin I I' f s x = mfderiv I I' f x := by
rw [β mfderivWithin_univ, β univ_inter s, mfderivWithin_inter h]
lemma mfderivWithin_of_isOpen (hs : IsOpen s) (hx : x β s) :
mfderivWithin I I' f s x = mfderiv I I' f x :=
mfderivWithin_of_mem_nhds (hs.mem_nhds hx)
theorem mfderivWithin_eq_mfderiv (hs : UniqueMDiffWithinAt I s x) (h : MDifferentiableAt I I' f x) :
mfderivWithin I I' f s x = mfderiv I I' f x := by
rw [β mfderivWithin_univ]
exact mfderivWithin_subset (subset_univ _) hs h.mdifferentiableWithinAt
theorem mdifferentiableAt_iff_of_mem_source {x' : M} {y : M'}
(hx : x' β (chartAt H x).source) (hy : f x' β (chartAt H' y).source) :
MDifferentiableAt I I' f x' β
ContinuousAt f x' β§
DifferentiableWithinAt π (extChartAt I' y β f β (extChartAt I x).symm) (Set.range I)
((extChartAt I x) x') :=
mdifferentiableWithinAt_univ.symm.trans <|
(mdifferentiableWithinAt_iff_of_mem_source hx hy).trans <| by
rw [continuousWithinAt_univ, Set.preimage_univ, Set.univ_inter]
#align mdifferentiable_at_iff_of_mem_source mdifferentiableAt_iff_of_mem_source
-- Porting note: moved from `ContMDiffMFDeriv`
variable {n : ββ}
theorem ContMDiffWithinAt.mdifferentiableWithinAt (hf : ContMDiffWithinAt I I' n f s x)
(hn : 1 β€ n) : MDifferentiableWithinAt I I' f s x := by
suffices h : MDifferentiableWithinAt I I' f (s β© f β»ΒΉ' (extChartAt I' (f x)).source) x by
rwa [mdifferentiableWithinAt_inter'] at h
apply hf.1.preimage_mem_nhdsWithin
exact extChartAt_source_mem_nhds I' (f x)
rw [mdifferentiableWithinAt_iff]
exact β¨hf.1.mono inter_subset_left, (hf.2.differentiableWithinAt hn).mono (by mfld_set_tac)β©
#align cont_mdiff_within_at.mdifferentiable_within_at ContMDiffWithinAt.mdifferentiableWithinAt
theorem ContMDiffAt.mdifferentiableAt (hf : ContMDiffAt I I' n f x) (hn : 1 β€ n) :
MDifferentiableAt I I' f x :=
mdifferentiableWithinAt_univ.1 <| ContMDiffWithinAt.mdifferentiableWithinAt hf hn
#align cont_mdiff_at.mdifferentiable_at ContMDiffAt.mdifferentiableAt
theorem ContMDiffOn.mdifferentiableOn (hf : ContMDiffOn I I' n f s) (hn : 1 β€ n) :
MDifferentiableOn I I' f s := fun x hx => (hf x hx).mdifferentiableWithinAt hn
#align cont_mdiff_on.mdifferentiable_on ContMDiffOn.mdifferentiableOn
theorem ContMDiff.mdifferentiable (hf : ContMDiff I I' n f) (hn : 1 β€ n) : MDifferentiable I I' f :=
fun x => (hf x).mdifferentiableAt hn
#align cont_mdiff.mdifferentiable ContMDiff.mdifferentiable
nonrec theorem SmoothWithinAt.mdifferentiableWithinAt (hf : SmoothWithinAt I I' f s x) :
MDifferentiableWithinAt I I' f s x :=
hf.mdifferentiableWithinAt le_top
#align smooth_within_at.mdifferentiable_within_at SmoothWithinAt.mdifferentiableWithinAt
nonrec theorem SmoothAt.mdifferentiableAt (hf : SmoothAt I I' f x) : MDifferentiableAt I I' f x :=
hf.mdifferentiableAt le_top
#align smooth_at.mdifferentiable_at SmoothAt.mdifferentiableAt
nonrec theorem SmoothOn.mdifferentiableOn (hf : SmoothOn I I' f s) : MDifferentiableOn I I' f s :=
hf.mdifferentiableOn le_top
#align smooth_on.mdifferentiable_on SmoothOn.mdifferentiableOn
theorem Smooth.mdifferentiable (hf : Smooth I I' f) : MDifferentiable I I' f :=
ContMDiff.mdifferentiable hf le_top
#align smooth.mdifferentiable Smooth.mdifferentiable
theorem Smooth.mdifferentiableAt (hf : Smooth I I' f) : MDifferentiableAt I I' f x :=
hf.mdifferentiable x
#align smooth.mdifferentiable_at Smooth.mdifferentiableAt
theorem Smooth.mdifferentiableWithinAt (hf : Smooth I I' f) : MDifferentiableWithinAt I I' f s x :=
hf.mdifferentiableAt.mdifferentiableWithinAt
#align smooth.mdifferentiable_within_at Smooth.mdifferentiableWithinAt
theorem HasMFDerivWithinAt.continuousWithinAt (h : HasMFDerivWithinAt I I' f s x f') :
ContinuousWithinAt f s x :=
h.1
#align has_mfderiv_within_at.continuous_within_at HasMFDerivWithinAt.continuousWithinAt
theorem HasMFDerivAt.continuousAt (h : HasMFDerivAt I I' f x f') : ContinuousAt f x :=
h.1
#align has_mfderiv_at.continuous_at HasMFDerivAt.continuousAt
theorem MDifferentiableOn.continuousOn (h : MDifferentiableOn I I' f s) : ContinuousOn f s :=
fun x hx => (h x hx).continuousWithinAt
#align mdifferentiable_on.continuous_on MDifferentiableOn.continuousOn
theorem MDifferentiable.continuous (h : MDifferentiable I I' f) : Continuous f :=
continuous_iff_continuousAt.2 fun x => (h x).continuousAt
#align mdifferentiable.continuous MDifferentiable.continuous
theorem tangentMapWithin_subset {p : TangentBundle I M} (st : s β t)
(hs : UniqueMDiffWithinAt I s p.1) (h : MDifferentiableWithinAt I I' f t p.1) :
tangentMapWithin I I' f s p = tangentMapWithin I I' f t p := by
simp only [tangentMapWithin, mfld_simps]
rw [mfderivWithin_subset st hs h]
#align tangent_map_within_subset tangentMapWithin_subset
| Mathlib/Geometry/Manifold/MFDeriv/Basic.lean | 460 | 462 | theorem tangentMapWithin_univ : tangentMapWithin I I' f univ = tangentMap I I' f := by |
ext p : 1
simp only [tangentMapWithin, tangentMap, mfld_simps]
|
import Mathlib.Algebra.Group.Submonoid.Basic
import Mathlib.Algebra.Group.Subsemigroup.Operations
import Mathlib.Algebra.Group.Nat
import Mathlib.GroupTheory.GroupAction.Defs
#align_import group_theory.submonoid.operations from "leanprover-community/mathlib"@"cf8e77c636317b059a8ce20807a29cf3772a0640"
assert_not_exists MonoidWithZero
variable {M N P : Type*} [MulOneClass M] [MulOneClass N] [MulOneClass P] (S : Submonoid M)
section
@[simps]
def Submonoid.toAddSubmonoid : Submonoid M βo AddSubmonoid (Additive M) where
toFun S :=
{ carrier := Additive.toMul β»ΒΉ' S
zero_mem' := S.one_mem'
add_mem' := fun ha hb => S.mul_mem' ha hb }
invFun S :=
{ carrier := Additive.ofMul β»ΒΉ' S
one_mem' := S.zero_mem'
mul_mem' := fun ha hb => S.add_mem' ha hb}
left_inv x := by cases x; rfl
right_inv x := by cases x; rfl
map_rel_iff' := Iff.rfl
#align submonoid.to_add_submonoid Submonoid.toAddSubmonoid
#align submonoid.to_add_submonoid_symm_apply_coe Submonoid.toAddSubmonoid_symm_apply_coe
#align submonoid.to_add_submonoid_apply_coe Submonoid.toAddSubmonoid_apply_coe
abbrev AddSubmonoid.toSubmonoid' : AddSubmonoid (Additive M) βo Submonoid M :=
Submonoid.toAddSubmonoid.symm
#align add_submonoid.to_submonoid' AddSubmonoid.toSubmonoid'
theorem Submonoid.toAddSubmonoid_closure (S : Set M) :
Submonoid.toAddSubmonoid (Submonoid.closure S)
= AddSubmonoid.closure (Additive.toMul β»ΒΉ' S) :=
le_antisymm
(Submonoid.toAddSubmonoid.le_symm_apply.1 <|
Submonoid.closure_le.2 (AddSubmonoid.subset_closure (M := Additive M)))
(AddSubmonoid.closure_le.2 <| Submonoid.subset_closure (M := M))
#align submonoid.to_add_submonoid_closure Submonoid.toAddSubmonoid_closure
theorem AddSubmonoid.toSubmonoid'_closure (S : Set (Additive M)) :
AddSubmonoid.toSubmonoid' (AddSubmonoid.closure S)
= Submonoid.closure (Multiplicative.ofAdd β»ΒΉ' S) :=
le_antisymm
(AddSubmonoid.toSubmonoid'.le_symm_apply.1 <|
AddSubmonoid.closure_le.2 (Submonoid.subset_closure (M := M)))
(Submonoid.closure_le.2 <| AddSubmonoid.subset_closure (M := Additive M))
#align add_submonoid.to_submonoid'_closure AddSubmonoid.toSubmonoid'_closure
end
section
variable {A : Type*} [AddZeroClass A]
@[simps]
def AddSubmonoid.toSubmonoid : AddSubmonoid A βo Submonoid (Multiplicative A) where
toFun S :=
{ carrier := Multiplicative.toAdd β»ΒΉ' S
one_mem' := S.zero_mem'
mul_mem' := fun ha hb => S.add_mem' ha hb }
invFun S :=
{ carrier := Multiplicative.ofAdd β»ΒΉ' S
zero_mem' := S.one_mem'
add_mem' := fun ha hb => S.mul_mem' ha hb}
left_inv x := by cases x; rfl
right_inv x := by cases x; rfl
map_rel_iff' := Iff.rfl
#align add_submonoid.to_submonoid AddSubmonoid.toSubmonoid
#align add_submonoid.to_submonoid_symm_apply_coe AddSubmonoid.toSubmonoid_symm_apply_coe
#align add_submonoid.to_submonoid_apply_coe AddSubmonoid.toSubmonoid_apply_coe
abbrev Submonoid.toAddSubmonoid' : Submonoid (Multiplicative A) βo AddSubmonoid A :=
AddSubmonoid.toSubmonoid.symm
#align submonoid.to_add_submonoid' Submonoid.toAddSubmonoid'
theorem AddSubmonoid.toSubmonoid_closure (S : Set A) :
(AddSubmonoid.toSubmonoid) (AddSubmonoid.closure S)
= Submonoid.closure (Multiplicative.toAdd β»ΒΉ' S) :=
le_antisymm
(AddSubmonoid.toSubmonoid.to_galoisConnection.l_le <|
AddSubmonoid.closure_le.2 <| Submonoid.subset_closure (M := Multiplicative A))
(Submonoid.closure_le.2 <| AddSubmonoid.subset_closure (M := A))
#align add_submonoid.to_submonoid_closure AddSubmonoid.toSubmonoid_closure
theorem Submonoid.toAddSubmonoid'_closure (S : Set (Multiplicative A)) :
Submonoid.toAddSubmonoid' (Submonoid.closure S)
= AddSubmonoid.closure (Additive.ofMul β»ΒΉ' S) :=
le_antisymm
(Submonoid.toAddSubmonoid'.to_galoisConnection.l_le <|
Submonoid.closure_le.2 <| AddSubmonoid.subset_closure (M := A))
(AddSubmonoid.closure_le.2 <| Submonoid.subset_closure (M := Multiplicative A))
#align submonoid.to_add_submonoid'_closure Submonoid.toAddSubmonoid'_closure
end
namespace Submonoid
variable {F : Type*} [FunLike F M N] [mc : MonoidHomClass F M N]
open Set
@[to_additive
"The preimage of an `AddSubmonoid` along an `AddMonoid` homomorphism is an `AddSubmonoid`."]
def comap (f : F) (S : Submonoid N) :
Submonoid M where
carrier := f β»ΒΉ' S
one_mem' := show f 1 β S by rw [map_one]; exact S.one_mem
mul_mem' ha hb := show f (_ * _) β S by rw [map_mul]; exact S.mul_mem ha hb
#align submonoid.comap Submonoid.comap
#align add_submonoid.comap AddSubmonoid.comap
@[to_additive (attr := simp)]
theorem coe_comap (S : Submonoid N) (f : F) : (S.comap f : Set M) = f β»ΒΉ' S :=
rfl
#align submonoid.coe_comap Submonoid.coe_comap
#align add_submonoid.coe_comap AddSubmonoid.coe_comap
@[to_additive (attr := simp)]
theorem mem_comap {S : Submonoid N} {f : F} {x : M} : x β S.comap f β f x β S :=
Iff.rfl
#align submonoid.mem_comap Submonoid.mem_comap
#align add_submonoid.mem_comap AddSubmonoid.mem_comap
@[to_additive]
theorem comap_comap (S : Submonoid P) (g : N β* P) (f : M β* N) :
(S.comap g).comap f = S.comap (g.comp f) :=
rfl
#align submonoid.comap_comap Submonoid.comap_comap
#align add_submonoid.comap_comap AddSubmonoid.comap_comap
@[to_additive (attr := simp)]
theorem comap_id (S : Submonoid P) : S.comap (MonoidHom.id P) = S :=
ext (by simp)
#align submonoid.comap_id Submonoid.comap_id
#align add_submonoid.comap_id AddSubmonoid.comap_id
@[to_additive
"The image of an `AddSubmonoid` along an `AddMonoid` homomorphism is an `AddSubmonoid`."]
def map (f : F) (S : Submonoid M) :
Submonoid N where
carrier := f '' S
one_mem' := β¨1, S.one_mem, map_one fβ©
mul_mem' := by
rintro _ _ β¨x, hx, rflβ© β¨y, hy, rflβ©;
exact β¨x * y, S.mul_mem hx hy, by rw [map_mul]β©
#align submonoid.map Submonoid.map
#align add_submonoid.map AddSubmonoid.map
@[to_additive (attr := simp)]
theorem coe_map (f : F) (S : Submonoid M) : (S.map f : Set N) = f '' S :=
rfl
#align submonoid.coe_map Submonoid.coe_map
#align add_submonoid.coe_map AddSubmonoid.coe_map
@[to_additive (attr := simp)]
theorem mem_map {f : F} {S : Submonoid M} {y : N} : y β S.map f β β x β S, f x = y := Iff.rfl
#align submonoid.mem_map Submonoid.mem_map
#align add_submonoid.mem_map AddSubmonoid.mem_map
@[to_additive]
theorem mem_map_of_mem (f : F) {S : Submonoid M} {x : M} (hx : x β S) : f x β S.map f :=
mem_image_of_mem f hx
#align submonoid.mem_map_of_mem Submonoid.mem_map_of_mem
#align add_submonoid.mem_map_of_mem AddSubmonoid.mem_map_of_mem
@[to_additive]
theorem apply_coe_mem_map (f : F) (S : Submonoid M) (x : S) : f x β S.map f :=
mem_map_of_mem f x.2
#align submonoid.apply_coe_mem_map Submonoid.apply_coe_mem_map
#align add_submonoid.apply_coe_mem_map AddSubmonoid.apply_coe_mem_map
@[to_additive]
theorem map_map (g : N β* P) (f : M β* N) : (S.map f).map g = S.map (g.comp f) :=
SetLike.coe_injective <| image_image _ _ _
#align submonoid.map_map Submonoid.map_map
#align add_submonoid.map_map AddSubmonoid.map_map
-- The simpNF linter says that the LHS can be simplified via `Submonoid.mem_map`.
-- However this is a higher priority lemma.
-- https://github.com/leanprover/std4/issues/207
@[to_additive (attr := simp 1100, nolint simpNF)]
theorem mem_map_iff_mem {f : F} (hf : Function.Injective f) {S : Submonoid M} {x : M} :
f x β S.map f β x β S :=
hf.mem_set_image
#align submonoid.mem_map_iff_mem Submonoid.mem_map_iff_mem
#align add_submonoid.mem_map_iff_mem AddSubmonoid.mem_map_iff_mem
@[to_additive]
theorem map_le_iff_le_comap {f : F} {S : Submonoid M} {T : Submonoid N} :
S.map f β€ T β S β€ T.comap f :=
image_subset_iff
#align submonoid.map_le_iff_le_comap Submonoid.map_le_iff_le_comap
#align add_submonoid.map_le_iff_le_comap AddSubmonoid.map_le_iff_le_comap
@[to_additive]
theorem gc_map_comap (f : F) : GaloisConnection (map f) (comap f) := fun _ _ => map_le_iff_le_comap
#align submonoid.gc_map_comap Submonoid.gc_map_comap
#align add_submonoid.gc_map_comap AddSubmonoid.gc_map_comap
@[to_additive]
theorem map_le_of_le_comap {T : Submonoid N} {f : F} : S β€ T.comap f β S.map f β€ T :=
(gc_map_comap f).l_le
#align submonoid.map_le_of_le_comap Submonoid.map_le_of_le_comap
#align add_submonoid.map_le_of_le_comap AddSubmonoid.map_le_of_le_comap
@[to_additive]
theorem le_comap_of_map_le {T : Submonoid N} {f : F} : S.map f β€ T β S β€ T.comap f :=
(gc_map_comap f).le_u
#align submonoid.le_comap_of_map_le Submonoid.le_comap_of_map_le
#align add_submonoid.le_comap_of_map_le AddSubmonoid.le_comap_of_map_le
@[to_additive]
theorem le_comap_map {f : F} : S β€ (S.map f).comap f :=
(gc_map_comap f).le_u_l _
#align submonoid.le_comap_map Submonoid.le_comap_map
#align add_submonoid.le_comap_map AddSubmonoid.le_comap_map
@[to_additive]
theorem map_comap_le {S : Submonoid N} {f : F} : (S.comap f).map f β€ S :=
(gc_map_comap f).l_u_le _
#align submonoid.map_comap_le Submonoid.map_comap_le
#align add_submonoid.map_comap_le AddSubmonoid.map_comap_le
@[to_additive]
theorem monotone_map {f : F} : Monotone (map f) :=
(gc_map_comap f).monotone_l
#align submonoid.monotone_map Submonoid.monotone_map
#align add_submonoid.monotone_map AddSubmonoid.monotone_map
@[to_additive]
theorem monotone_comap {f : F} : Monotone (comap f) :=
(gc_map_comap f).monotone_u
#align submonoid.monotone_comap Submonoid.monotone_comap
#align add_submonoid.monotone_comap AddSubmonoid.monotone_comap
@[to_additive (attr := simp)]
theorem map_comap_map {f : F} : ((S.map f).comap f).map f = S.map f :=
(gc_map_comap f).l_u_l_eq_l _
#align submonoid.map_comap_map Submonoid.map_comap_map
#align add_submonoid.map_comap_map AddSubmonoid.map_comap_map
@[to_additive (attr := simp)]
theorem comap_map_comap {S : Submonoid N} {f : F} : ((S.comap f).map f).comap f = S.comap f :=
(gc_map_comap f).u_l_u_eq_u _
#align submonoid.comap_map_comap Submonoid.comap_map_comap
#align add_submonoid.comap_map_comap AddSubmonoid.comap_map_comap
@[to_additive]
theorem map_sup (S T : Submonoid M) (f : F) : (S β T).map f = S.map f β T.map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_sup
#align submonoid.map_sup Submonoid.map_sup
#align add_submonoid.map_sup AddSubmonoid.map_sup
@[to_additive]
theorem map_iSup {ΞΉ : Sort*} (f : F) (s : ΞΉ β Submonoid M) : (iSup s).map f = β¨ i, (s i).map f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).l_iSup
#align submonoid.map_supr Submonoid.map_iSup
#align add_submonoid.map_supr AddSubmonoid.map_iSup
@[to_additive]
theorem comap_inf (S T : Submonoid N) (f : F) : (S β T).comap f = S.comap f β T.comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_inf
#align submonoid.comap_inf Submonoid.comap_inf
#align add_submonoid.comap_inf AddSubmonoid.comap_inf
@[to_additive]
theorem comap_iInf {ΞΉ : Sort*} (f : F) (s : ΞΉ β Submonoid N) :
(iInf s).comap f = β¨
i, (s i).comap f :=
(gc_map_comap f : GaloisConnection (map f) (comap f)).u_iInf
#align submonoid.comap_infi Submonoid.comap_iInf
#align add_submonoid.comap_infi AddSubmonoid.comap_iInf
@[to_additive (attr := simp)]
theorem map_bot (f : F) : (β₯ : Submonoid M).map f = β₯ :=
(gc_map_comap f).l_bot
#align submonoid.map_bot Submonoid.map_bot
#align add_submonoid.map_bot AddSubmonoid.map_bot
@[to_additive (attr := simp)]
theorem comap_top (f : F) : (β€ : Submonoid N).comap f = β€ :=
(gc_map_comap f).u_top
#align submonoid.comap_top Submonoid.comap_top
#align add_submonoid.comap_top AddSubmonoid.comap_top
@[to_additive (attr := simp)]
theorem map_id (S : Submonoid M) : S.map (MonoidHom.id M) = S :=
ext fun _ => β¨fun β¨_, h, rflβ© => h, fun h => β¨_, h, rflβ©β©
#align submonoid.map_id Submonoid.map_id
#align add_submonoid.map_id AddSubmonoid.map_id
variable {A : Type*} [SetLike A M] [hA : SubmonoidClass A M] (S' : A)
instance AddSubmonoidClass.nSMul {M} [AddMonoid M] {A : Type*} [SetLike A M]
[AddSubmonoidClass A M] (S : A) : SMul β S :=
β¨fun n a => β¨n β’ a.1, nsmul_mem a.2 nβ©β©
#align add_submonoid_class.has_nsmul AddSubmonoidClass.nSMul
namespace MonoidHom
variable {F : Type*} [FunLike F M N] [mc : MonoidHomClass F M N]
open Submonoid
library_note "range copy pattern"
@[to_additive "The range of an `AddMonoidHom` is an `AddSubmonoid`."]
def mrange (f : F) : Submonoid N :=
((β€ : Submonoid M).map f).copy (Set.range f) Set.image_univ.symm
#align monoid_hom.mrange MonoidHom.mrange
#align add_monoid_hom.mrange AddMonoidHom.mrange
@[to_additive (attr := simp)]
theorem coe_mrange (f : F) : (mrange f : Set N) = Set.range f :=
rfl
#align monoid_hom.coe_mrange MonoidHom.coe_mrange
#align add_monoid_hom.coe_mrange AddMonoidHom.coe_mrange
@[to_additive (attr := simp)]
theorem mem_mrange {f : F} {y : N} : y β mrange f β β x, f x = y :=
Iff.rfl
#align monoid_hom.mem_mrange MonoidHom.mem_mrange
#align add_monoid_hom.mem_mrange AddMonoidHom.mem_mrange
@[to_additive]
theorem mrange_eq_map (f : F) : mrange f = (β€ : Submonoid M).map f :=
Submonoid.copy_eq _
#align monoid_hom.mrange_eq_map MonoidHom.mrange_eq_map
#align add_monoid_hom.mrange_eq_map AddMonoidHom.mrange_eq_map
@[to_additive (attr := simp)]
theorem mrange_id : mrange (MonoidHom.id M) = β€ := by
simp [mrange_eq_map]
@[to_additive]
theorem map_mrange (g : N β* P) (f : M β* N) : f.mrange.map g = mrange (comp g f) := by
simpa only [mrange_eq_map] using (β€ : Submonoid M).map_map g f
#align monoid_hom.map_mrange MonoidHom.map_mrange
#align add_monoid_hom.map_mrange AddMonoidHom.map_mrange
@[to_additive]
theorem mrange_top_iff_surjective {f : F} : mrange f = (β€ : Submonoid N) β Function.Surjective f :=
SetLike.ext'_iff.trans <| Iff.trans (by rw [coe_mrange, coe_top]) Set.range_iff_surjective
#align monoid_hom.mrange_top_iff_surjective MonoidHom.mrange_top_iff_surjective
#align add_monoid_hom.mrange_top_iff_surjective AddMonoidHom.mrange_top_iff_surjective
@[to_additive (attr := simp)
"The range of a surjective `AddMonoid` hom is the whole of the codomain."]
theorem mrange_top_of_surjective (f : F) (hf : Function.Surjective f) :
mrange f = (β€ : Submonoid N) :=
mrange_top_iff_surjective.2 hf
#align monoid_hom.mrange_top_of_surjective MonoidHom.mrange_top_of_surjective
#align add_monoid_hom.mrange_top_of_surjective AddMonoidHom.mrange_top_of_surjective
@[to_additive]
theorem mclosure_preimage_le (f : F) (s : Set N) : closure (f β»ΒΉ' s) β€ (closure s).comap f :=
closure_le.2 fun _ hx => SetLike.mem_coe.2 <| mem_comap.2 <| subset_closure hx
#align monoid_hom.mclosure_preimage_le MonoidHom.mclosure_preimage_le
#align add_monoid_hom.mclosure_preimage_le AddMonoidHom.mclosure_preimage_le
@[to_additive
"The image under an `AddMonoid` hom of the `AddSubmonoid` generated by a set equals
the `AddSubmonoid` generated by the image of the set."]
theorem map_mclosure (f : F) (s : Set M) : (closure s).map f = closure (f '' s) :=
le_antisymm
(map_le_iff_le_comap.2 <|
le_trans (closure_mono <| Set.subset_preimage_image _ _) (mclosure_preimage_le _ _))
(closure_le.2 <| Set.image_subset _ subset_closure)
#align monoid_hom.map_mclosure MonoidHom.map_mclosure
#align add_monoid_hom.map_mclosure AddMonoidHom.map_mclosure
@[to_additive (attr := simp)]
theorem mclosure_range (f : F) : closure (Set.range f) = mrange f := by
rw [β Set.image_univ, β map_mclosure, mrange_eq_map, closure_univ]
@[to_additive "Restriction of an `AddMonoid` hom to an `AddSubmonoid` of the domain."]
def restrict {N S : Type*} [MulOneClass N] [SetLike S M] [SubmonoidClass S M] (f : M β* N)
(s : S) : s β* N :=
f.comp (SubmonoidClass.subtype _)
#align monoid_hom.restrict MonoidHom.restrict
#align add_monoid_hom.restrict AddMonoidHom.restrict
@[to_additive (attr := simp)]
theorem restrict_apply {N S : Type*} [MulOneClass N] [SetLike S M] [SubmonoidClass S M]
(f : M β* N) (s : S) (x : s) : f.restrict s x = f x :=
rfl
#align monoid_hom.restrict_apply MonoidHom.restrict_apply
#align add_monoid_hom.restrict_apply AddMonoidHom.restrict_apply
@[to_additive (attr := simp)]
theorem restrict_mrange (f : M β* N) : mrange (f.restrict S) = S.map f := by
simp [SetLike.ext_iff]
#align monoid_hom.restrict_mrange MonoidHom.restrict_mrange
#align add_monoid_hom.restrict_mrange AddMonoidHom.restrict_mrange
@[to_additive (attr := simps apply)
"Restriction of an `AddMonoid` hom to an `AddSubmonoid` of the codomain."]
def codRestrict {S} [SetLike S N] [SubmonoidClass S N] (f : M β* N) (s : S) (h : β x, f x β s) :
M β* s where
toFun n := β¨f n, h nβ©
map_one' := Subtype.eq f.map_one
map_mul' x y := Subtype.eq (f.map_mul x y)
#align monoid_hom.cod_restrict MonoidHom.codRestrict
#align add_monoid_hom.cod_restrict AddMonoidHom.codRestrict
#align monoid_hom.cod_restrict_apply MonoidHom.codRestrict_apply
@[to_additive "Restriction of an `AddMonoid` hom to its range interpreted as a submonoid."]
def mrangeRestrict {N} [MulOneClass N] (f : M β* N) : M β* (mrange f) :=
(f.codRestrict (mrange f)) fun x => β¨x, rflβ©
#align monoid_hom.mrange_restrict MonoidHom.mrangeRestrict
#align add_monoid_hom.mrange_restrict AddMonoidHom.mrangeRestrict
@[to_additive (attr := simp)]
theorem coe_mrangeRestrict {N} [MulOneClass N] (f : M β* N) (x : M) :
(f.mrangeRestrict x : N) = f x :=
rfl
#align monoid_hom.coe_mrange_restrict MonoidHom.coe_mrangeRestrict
#align add_monoid_hom.coe_mrange_restrict AddMonoidHom.coe_mrangeRestrict
@[to_additive]
theorem mrangeRestrict_surjective (f : M β* N) : Function.Surjective f.mrangeRestrict :=
fun β¨_, β¨x, rflβ©β© => β¨x, rflβ©
#align monoid_hom.mrange_restrict_surjective MonoidHom.mrangeRestrict_surjective
#align add_monoid_hom.mrange_restrict_surjective AddMonoidHom.mrangeRestrict_surjective
@[to_additive
"The additive kernel of an `AddMonoid` hom is the `AddSubmonoid` of
elements such that `f x = 0`"]
def mker (f : F) : Submonoid M :=
(β₯ : Submonoid N).comap f
#align monoid_hom.mker MonoidHom.mker
#align add_monoid_hom.mker AddMonoidHom.mker
@[to_additive]
theorem mem_mker (f : F) {x : M} : x β mker f β f x = 1 :=
Iff.rfl
#align monoid_hom.mem_mker MonoidHom.mem_mker
#align add_monoid_hom.mem_mker AddMonoidHom.mem_mker
@[to_additive]
theorem coe_mker (f : F) : (mker f : Set M) = (f : M β N) β»ΒΉ' {1} :=
rfl
#align monoid_hom.coe_mker MonoidHom.coe_mker
#align add_monoid_hom.coe_mker AddMonoidHom.coe_mker
@[to_additive]
instance decidableMemMker [DecidableEq N] (f : F) : DecidablePred (Β· β mker f) := fun x =>
decidable_of_iff (f x = 1) (mem_mker f)
#align monoid_hom.decidable_mem_mker MonoidHom.decidableMemMker
#align add_monoid_hom.decidable_mem_mker AddMonoidHom.decidableMemMker
@[to_additive]
theorem comap_mker (g : N β* P) (f : M β* N) : g.mker.comap f = mker (comp g f) :=
rfl
#align monoid_hom.comap_mker MonoidHom.comap_mker
#align add_monoid_hom.comap_mker AddMonoidHom.comap_mker
@[to_additive (attr := simp)]
theorem comap_bot' (f : F) : (β₯ : Submonoid N).comap f = mker f :=
rfl
#align monoid_hom.comap_bot' MonoidHom.comap_bot'
#align add_monoid_hom.comap_bot' AddMonoidHom.comap_bot'
@[to_additive (attr := simp)]
theorem restrict_mker (f : M β* N) : mker (f.restrict S) = f.mker.comap S.subtype :=
rfl
#align monoid_hom.restrict_mker MonoidHom.restrict_mker
#align add_monoid_hom.restrict_mker AddMonoidHom.restrict_mker
@[to_additive]
theorem mrangeRestrict_mker (f : M β* N) : mker (mrangeRestrict f) = mker f := by
ext x
change (β¨f x, _β© : mrange f) = β¨1, _β© β f x = 1
simp
#align monoid_hom.range_restrict_mker MonoidHom.mrangeRestrict_mker
#align add_monoid_hom.range_restrict_mker AddMonoidHom.mrangeRestrict_mker
@[to_additive (attr := simp)]
theorem mker_one : mker (1 : M β* N) = β€ := by
ext
simp [mem_mker]
#align monoid_hom.mker_one MonoidHom.mker_one
#align add_monoid_hom.mker_zero AddMonoidHom.mker_zero
@[to_additive prod_map_comap_prod']
theorem prod_map_comap_prod' {M' : Type*} {N' : Type*} [MulOneClass M'] [MulOneClass N']
(f : M β* N) (g : M' β* N') (S : Submonoid N) (S' : Submonoid N') :
(S.prod S').comap (prodMap f g) = (S.comap f).prod (S'.comap g) :=
SetLike.coe_injective <| Set.preimage_prod_map_prod f g _ _
#align monoid_hom.prod_map_comap_prod' MonoidHom.prod_map_comap_prod'
-- Porting note: to_additive translated the name incorrectly in mathlib 3.
#align add_monoid_hom.sum_map_comap_sum' AddMonoidHom.prod_map_comap_prod'
@[to_additive mker_prod_map]
theorem mker_prod_map {M' : Type*} {N' : Type*} [MulOneClass M'] [MulOneClass N'] (f : M β* N)
(g : M' β* N') : mker (prodMap f g) = f.mker.prod (mker g) := by
rw [β comap_bot', β comap_bot', β comap_bot', β prod_map_comap_prod', bot_prod_bot]
#align monoid_hom.mker_prod_map MonoidHom.mker_prod_map
-- Porting note: to_additive translated the name incorrectly in mathlib 3.
#align add_monoid_hom.mker_sum_map AddMonoidHom.mker_prod_map
@[to_additive (attr := simp)]
theorem mker_inl : mker (inl M N) = β₯ := by
ext x
simp [mem_mker]
#align monoid_hom.mker_inl MonoidHom.mker_inl
#align add_monoid_hom.mker_inl AddMonoidHom.mker_inl
@[to_additive (attr := simp)]
theorem mker_inr : mker (inr M N) = β₯ := by
ext x
simp [mem_mker]
#align monoid_hom.mker_inr MonoidHom.mker_inr
#align add_monoid_hom.mker_inr AddMonoidHom.mker_inr
@[to_additive (attr := simp)]
lemma mker_fst : mker (fst M N) = .prod β₯ β€ := SetLike.ext fun _ => (and_true_iff _).symm
@[to_additive (attr := simp)]
lemma mker_snd : mker (snd M N) = .prod β€ β₯ := SetLike.ext fun _ => (true_and_iff _).symm
@[to_additive (attr := simps)
"the `AddMonoidHom` from the preimage of an additive submonoid to itself."]
def submonoidComap (f : M β* N) (N' : Submonoid N) :
N'.comap f β* N' where
toFun x := β¨f x, x.2β©
map_one' := Subtype.eq f.map_one
map_mul' x y := Subtype.eq (f.map_mul x y)
#align monoid_hom.submonoid_comap MonoidHom.submonoidComap
#align add_monoid_hom.add_submonoid_comap AddMonoidHom.addSubmonoidComap
#align monoid_hom.submonoid_comap_apply_coe MonoidHom.submonoidComap_apply_coe
#align add_monoid_hom.submonoid_comap_apply_coe AddMonoidHom.addSubmonoidComap_apply_coe
@[to_additive (attr := simps)
"the `AddMonoidHom` from an additive submonoid to its image. See
`AddEquiv.AddSubmonoidMap` for a variant for `AddEquiv`s."]
def submonoidMap (f : M β* N) (M' : Submonoid M) : M' β* M'.map f where
toFun x := β¨f x, β¨x, x.2, rflβ©β©
map_one' := Subtype.eq <| f.map_one
map_mul' x y := Subtype.eq <| f.map_mul x y
#align monoid_hom.submonoid_map MonoidHom.submonoidMap
#align add_monoid_hom.add_submonoid_map AddMonoidHom.addSubmonoidMap
#align monoid_hom.submonoid_map_apply_coe MonoidHom.submonoidMap_apply_coe
#align add_monoid_hom.submonoid_map_apply_coe AddMonoidHom.addSubmonoidMap_apply_coe
@[to_additive]
| Mathlib/Algebra/Group/Submonoid/Operations.lean | 1,211 | 1,214 | theorem submonoidMap_surjective (f : M β* N) (M' : Submonoid M) :
Function.Surjective (f.submonoidMap M') := by |
rintro β¨_, x, hx, rflβ©
exact β¨β¨x, hxβ©, rflβ©
|
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {Ξ± : Type u}
class OrderedAddCommGroup (Ξ± : Type u) extends AddCommGroup Ξ±, PartialOrder Ξ± where
protected add_le_add_left : β a b : Ξ±, a β€ b β β c : Ξ±, c + a β€ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (Ξ± : Type u) extends CommGroup Ξ±, PartialOrder Ξ± where
protected mul_le_mul_left : β a b : Ξ±, a β€ b β β c : Ξ±, c * a β€ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup Ξ±] :
OrderedCancelCommMonoid Ξ± :=
{ βΉOrderedCommGroup Ξ±βΊ with le_of_mul_le_mul_left := fun a b c β¦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (Ξ± : Type u) [OrderedAddCommGroup Ξ±] : CovariantClass Ξ± Ξ± (swap (Β· + Β·)) (Β· < Β·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le Ξ±
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
ContravariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·) where
elim a b c bc := by simpa using mul_le_mul_left' bc aβ»ΒΉ
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (Ξ± : Type u) [OrderedCommGroup Ξ±] :
ContravariantClass Ξ± Ξ± (swap (Β· * Β·)) (Β· β€ Β·) where
elim a b c bc := by simpa using mul_le_mul_right' bc aβ»ΒΉ
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group Ξ±]
section Preorder
variable [Preorder Ξ±]
section CommGroup
variable [CommGroup Ξ±]
section CommGroup
variable [CommGroup Ξ±]
section LE
variable [LE Ξ±] [CovariantClass Ξ± Ξ± (Β· * Β·) (Β· β€ Β·)] {a b c d : Ξ±}
@[to_additive sub_le_sub_iff]
theorem div_le_div_iff' : a / b β€ c / d β a * d β€ c * b := by
simpa only [div_eq_mul_inv] using mul_inv_le_mul_inv_iff'
#align div_le_div_iff' div_le_div_iff'
#align sub_le_sub_iff sub_le_sub_iff
@[to_additive]
theorem le_div_iff_mul_le' : b β€ c / a β a * b β€ c := by rw [le_div_iff_mul_le, mul_comm]
#align le_div_iff_mul_le' le_div_iff_mul_le'
#align le_sub_iff_add_le' le_sub_iff_add_le'
alias β¨add_le_of_le_sub_left, le_sub_left_of_add_leβ© := le_sub_iff_add_le'
#align le_sub_left_of_add_le le_sub_left_of_add_le
#align add_le_of_le_sub_left add_le_of_le_sub_left
@[to_additive]
| Mathlib/Algebra/Order/Group/Defs.lean | 816 | 816 | theorem div_le_iff_le_mul' : a / b β€ c β a β€ b * c := by | rw [div_le_iff_le_mul, mul_comm]
|
import Mathlib.Algebra.Order.CauSeq.BigOperators
import Mathlib.Data.Complex.Abs
import Mathlib.Data.Complex.BigOperators
import Mathlib.Data.Nat.Choose.Sum
#align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
open CauSeq Finset IsAbsoluteValue
open scoped Classical ComplexConjugate
namespace Complex
variable (x y : β)
@[simp]
theorem exp_zero : exp 0 = 1 := by
rw [exp]
refine lim_eq_of_equiv_const fun Ξ΅ Ξ΅0 => β¨1, fun j hj => ?_β©
convert (config := .unfoldSameFun) Ξ΅0 -- Porting note: Ξ΅0 : Ξ΅ > 0 but goal is _ < Ξ΅
cases' j with j j
Β· exact absurd hj (not_le_of_gt zero_lt_one)
Β· dsimp [exp']
induction' j with j ih
Β· dsimp [exp']; simp [show Nat.succ 0 = 1 from rfl]
Β· rw [β ih (by simp [Nat.succ_le_succ])]
simp only [sum_range_succ, pow_succ]
simp
#align complex.exp_zero Complex.exp_zero
theorem exp_add : exp (x + y) = exp x * exp y := by
have hj : β j : β, (β m β range j, (x + y) ^ m / m.factorial) =
β i β range j, β k β range (i + 1), x ^ k / k.factorial *
(y ^ (i - k) / (i - k).factorial) := by
intro j
refine Finset.sum_congr rfl fun m _ => ?_
rw [add_pow, div_eq_mul_inv, sum_mul]
refine Finset.sum_congr rfl fun I hi => ?_
have hβ : (m.choose I : β) β 0 :=
Nat.cast_ne_zero.2 (pos_iff_ne_zero.1 (Nat.choose_pos (Nat.le_of_lt_succ (mem_range.1 hi))))
have hβ := Nat.choose_mul_factorial_mul_factorial (Nat.le_of_lt_succ <| Finset.mem_range.1 hi)
rw [β hβ, Nat.cast_mul, Nat.cast_mul, mul_inv, mul_inv]
simp only [mul_left_comm (m.choose I : β), mul_assoc, mul_left_comm (m.choose I : β)β»ΒΉ,
mul_comm (m.choose I : β)]
rw [inv_mul_cancel hβ]
simp [div_eq_mul_inv, mul_comm, mul_assoc, mul_left_comm]
simp_rw [exp, exp', lim_mul_lim]
apply (lim_eq_lim_of_equiv _).symm
simp only [hj]
exact cauchy_product (isCauSeq_abs_exp x) (isCauSeq_exp y)
#align complex.exp_add Complex.exp_add
-- Porting note (#11445): new definition
noncomputable def expMonoidHom : MonoidHom (Multiplicative β) β :=
{ toFun := fun z => exp (Multiplicative.toAdd z),
map_one' := by simp,
map_mul' := by simp [exp_add] }
theorem exp_list_sum (l : List β) : exp l.sum = (l.map exp).prod :=
map_list_prod (M := Multiplicative β) expMonoidHom l
#align complex.exp_list_sum Complex.exp_list_sum
theorem exp_multiset_sum (s : Multiset β) : exp s.sum = (s.map exp).prod :=
@MonoidHom.map_multiset_prod (Multiplicative β) β _ _ expMonoidHom s
#align complex.exp_multiset_sum Complex.exp_multiset_sum
theorem exp_sum {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β β) :
exp (β x β s, f x) = β x β s, exp (f x) :=
map_prod (Ξ² := Multiplicative β) expMonoidHom f s
#align complex.exp_sum Complex.exp_sum
lemma exp_nsmul (x : β) (n : β) : exp (n β’ x) = exp x ^ n :=
@MonoidHom.map_pow (Multiplicative β) β _ _ expMonoidHom _ _
theorem exp_nat_mul (x : β) : β n : β, exp (n * x) = exp x ^ n
| 0 => by rw [Nat.cast_zero, zero_mul, exp_zero, pow_zero]
| Nat.succ n => by rw [pow_succ, Nat.cast_add_one, add_mul, exp_add, β exp_nat_mul _ n, one_mul]
#align complex.exp_nat_mul Complex.exp_nat_mul
theorem exp_ne_zero : exp x β 0 := fun h =>
zero_ne_one <| by rw [β exp_zero, β add_neg_self x, exp_add, h]; simp
#align complex.exp_ne_zero Complex.exp_ne_zero
theorem exp_neg : exp (-x) = (exp x)β»ΒΉ := by
rw [β mul_right_inj' (exp_ne_zero x), β exp_add]; simp [mul_inv_cancel (exp_ne_zero x)]
#align complex.exp_neg Complex.exp_neg
theorem exp_sub : exp (x - y) = exp x / exp y := by
simp [sub_eq_add_neg, exp_add, exp_neg, div_eq_mul_inv]
#align complex.exp_sub Complex.exp_sub
theorem exp_int_mul (z : β) (n : β€) : Complex.exp (n * z) = Complex.exp z ^ n := by
cases n
Β· simp [exp_nat_mul]
Β· simp [exp_add, add_mul, pow_add, exp_neg, exp_nat_mul]
#align complex.exp_int_mul Complex.exp_int_mul
@[simp]
theorem exp_conj : exp (conj x) = conj (exp x) := by
dsimp [exp]
rw [β lim_conj]
refine congr_arg CauSeq.lim (CauSeq.ext fun _ => ?_)
dsimp [exp', Function.comp_def, cauSeqConj]
rw [map_sum (starRingEnd _)]
refine sum_congr rfl fun n _ => ?_
rw [map_divβ, map_pow, β ofReal_natCast, conj_ofReal]
#align complex.exp_conj Complex.exp_conj
@[simp]
theorem ofReal_exp_ofReal_re (x : β) : ((exp x).re : β) = exp x :=
conj_eq_iff_re.1 <| by rw [β exp_conj, conj_ofReal]
#align complex.of_real_exp_of_real_re Complex.ofReal_exp_ofReal_re
@[simp, norm_cast]
theorem ofReal_exp (x : β) : (Real.exp x : β) = exp x :=
ofReal_exp_ofReal_re _
#align complex.of_real_exp Complex.ofReal_exp
@[simp]
theorem exp_ofReal_im (x : β) : (exp x).im = 0 := by rw [β ofReal_exp_ofReal_re, ofReal_im]
#align complex.exp_of_real_im Complex.exp_ofReal_im
theorem exp_ofReal_re (x : β) : (exp x).re = Real.exp x :=
rfl
#align complex.exp_of_real_re Complex.exp_ofReal_re
theorem two_sinh : 2 * sinh x = exp x - exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_sinh Complex.two_sinh
theorem two_cosh : 2 * cosh x = exp x + exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_cosh Complex.two_cosh
@[simp]
theorem sinh_zero : sinh 0 = 0 := by simp [sinh]
#align complex.sinh_zero Complex.sinh_zero
@[simp]
theorem sinh_neg : sinh (-x) = -sinh x := by simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
#align complex.sinh_neg Complex.sinh_neg
private theorem sinh_add_aux {a b c d : β} :
(a - b) * (c + d) + (a + b) * (c - d) = 2 * (a * c - b * d) := by ring
theorem sinh_add : sinh (x + y) = sinh x * cosh y + cosh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_sinh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_sinh, mul_left_comm, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, β mul_assoc, two_cosh]
exact sinh_add_aux
#align complex.sinh_add Complex.sinh_add
@[simp]
theorem cosh_zero : cosh 0 = 1 := by simp [cosh]
#align complex.cosh_zero Complex.cosh_zero
@[simp]
theorem cosh_neg : cosh (-x) = cosh x := by simp [add_comm, cosh, exp_neg]
#align complex.cosh_neg Complex.cosh_neg
private theorem cosh_add_aux {a b c d : β} :
(a + b) * (c + d) + (a - b) * (c - d) = 2 * (a * c + b * d) := by ring
theorem cosh_add : cosh (x + y) = cosh x * cosh y + sinh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_cosh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_cosh, β mul_assoc, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, mul_left_comm, two_sinh]
exact cosh_add_aux
#align complex.cosh_add Complex.cosh_add
theorem sinh_sub : sinh (x - y) = sinh x * cosh y - cosh x * sinh y := by
simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
#align complex.sinh_sub Complex.sinh_sub
theorem cosh_sub : cosh (x - y) = cosh x * cosh y - sinh x * sinh y := by
simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]
#align complex.cosh_sub Complex.cosh_sub
theorem sinh_conj : sinh (conj x) = conj (sinh x) := by
rw [sinh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_sub, sinh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.sinh_conj Complex.sinh_conj
@[simp]
theorem ofReal_sinh_ofReal_re (x : β) : ((sinh x).re : β) = sinh x :=
conj_eq_iff_re.1 <| by rw [β sinh_conj, conj_ofReal]
#align complex.of_real_sinh_of_real_re Complex.ofReal_sinh_ofReal_re
@[simp, norm_cast]
theorem ofReal_sinh (x : β) : (Real.sinh x : β) = sinh x :=
ofReal_sinh_ofReal_re _
#align complex.of_real_sinh Complex.ofReal_sinh
@[simp]
theorem sinh_ofReal_im (x : β) : (sinh x).im = 0 := by rw [β ofReal_sinh_ofReal_re, ofReal_im]
#align complex.sinh_of_real_im Complex.sinh_ofReal_im
theorem sinh_ofReal_re (x : β) : (sinh x).re = Real.sinh x :=
rfl
#align complex.sinh_of_real_re Complex.sinh_ofReal_re
theorem cosh_conj : cosh (conj x) = conj (cosh x) := by
rw [cosh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_add, cosh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.cosh_conj Complex.cosh_conj
theorem ofReal_cosh_ofReal_re (x : β) : ((cosh x).re : β) = cosh x :=
conj_eq_iff_re.1 <| by rw [β cosh_conj, conj_ofReal]
#align complex.of_real_cosh_of_real_re Complex.ofReal_cosh_ofReal_re
@[simp, norm_cast]
theorem ofReal_cosh (x : β) : (Real.cosh x : β) = cosh x :=
ofReal_cosh_ofReal_re _
#align complex.of_real_cosh Complex.ofReal_cosh
@[simp]
theorem cosh_ofReal_im (x : β) : (cosh x).im = 0 := by rw [β ofReal_cosh_ofReal_re, ofReal_im]
#align complex.cosh_of_real_im Complex.cosh_ofReal_im
@[simp]
theorem cosh_ofReal_re (x : β) : (cosh x).re = Real.cosh x :=
rfl
#align complex.cosh_of_real_re Complex.cosh_ofReal_re
theorem tanh_eq_sinh_div_cosh : tanh x = sinh x / cosh x :=
rfl
#align complex.tanh_eq_sinh_div_cosh Complex.tanh_eq_sinh_div_cosh
@[simp]
theorem tanh_zero : tanh 0 = 0 := by simp [tanh]
#align complex.tanh_zero Complex.tanh_zero
@[simp]
theorem tanh_neg : tanh (-x) = -tanh x := by simp [tanh, neg_div]
#align complex.tanh_neg Complex.tanh_neg
theorem tanh_conj : tanh (conj x) = conj (tanh x) := by
rw [tanh, sinh_conj, cosh_conj, β map_divβ, tanh]
#align complex.tanh_conj Complex.tanh_conj
@[simp]
theorem ofReal_tanh_ofReal_re (x : β) : ((tanh x).re : β) = tanh x :=
conj_eq_iff_re.1 <| by rw [β tanh_conj, conj_ofReal]
#align complex.of_real_tanh_of_real_re Complex.ofReal_tanh_ofReal_re
@[simp, norm_cast]
theorem ofReal_tanh (x : β) : (Real.tanh x : β) = tanh x :=
ofReal_tanh_ofReal_re _
#align complex.of_real_tanh Complex.ofReal_tanh
@[simp]
theorem tanh_ofReal_im (x : β) : (tanh x).im = 0 := by rw [β ofReal_tanh_ofReal_re, ofReal_im]
#align complex.tanh_of_real_im Complex.tanh_ofReal_im
theorem tanh_ofReal_re (x : β) : (tanh x).re = Real.tanh x :=
rfl
#align complex.tanh_of_real_re Complex.tanh_ofReal_re
@[simp]
theorem cosh_add_sinh : cosh x + sinh x = exp x := by
rw [β mul_right_inj' (two_ne_zero' β), mul_add, two_cosh, two_sinh, add_add_sub_cancel, two_mul]
#align complex.cosh_add_sinh Complex.cosh_add_sinh
@[simp]
theorem sinh_add_cosh : sinh x + cosh x = exp x := by rw [add_comm, cosh_add_sinh]
#align complex.sinh_add_cosh Complex.sinh_add_cosh
@[simp]
theorem exp_sub_cosh : exp x - cosh x = sinh x :=
sub_eq_iff_eq_add.2 (sinh_add_cosh x).symm
#align complex.exp_sub_cosh Complex.exp_sub_cosh
@[simp]
theorem exp_sub_sinh : exp x - sinh x = cosh x :=
sub_eq_iff_eq_add.2 (cosh_add_sinh x).symm
#align complex.exp_sub_sinh Complex.exp_sub_sinh
@[simp]
theorem cosh_sub_sinh : cosh x - sinh x = exp (-x) := by
rw [β mul_right_inj' (two_ne_zero' β), mul_sub, two_cosh, two_sinh, add_sub_sub_cancel, two_mul]
#align complex.cosh_sub_sinh Complex.cosh_sub_sinh
@[simp]
theorem sinh_sub_cosh : sinh x - cosh x = -exp (-x) := by rw [β neg_sub, cosh_sub_sinh]
#align complex.sinh_sub_cosh Complex.sinh_sub_cosh
@[simp]
theorem cosh_sq_sub_sinh_sq : cosh x ^ 2 - sinh x ^ 2 = 1 := by
rw [sq_sub_sq, cosh_add_sinh, cosh_sub_sinh, β exp_add, add_neg_self, exp_zero]
#align complex.cosh_sq_sub_sinh_sq Complex.cosh_sq_sub_sinh_sq
theorem cosh_sq : cosh x ^ 2 = sinh x ^ 2 + 1 := by
rw [β cosh_sq_sub_sinh_sq x]
ring
#align complex.cosh_sq Complex.cosh_sq
theorem sinh_sq : sinh x ^ 2 = cosh x ^ 2 - 1 := by
rw [β cosh_sq_sub_sinh_sq x]
ring
#align complex.sinh_sq Complex.sinh_sq
theorem cosh_two_mul : cosh (2 * x) = cosh x ^ 2 + sinh x ^ 2 := by rw [two_mul, cosh_add, sq, sq]
#align complex.cosh_two_mul Complex.cosh_two_mul
theorem sinh_two_mul : sinh (2 * x) = 2 * sinh x * cosh x := by
rw [two_mul, sinh_add]
ring
#align complex.sinh_two_mul Complex.sinh_two_mul
theorem cosh_three_mul : cosh (3 * x) = 4 * cosh x ^ 3 - 3 * cosh x := by
have h1 : x + 2 * x = 3 * x := by ring
rw [β h1, cosh_add x (2 * x)]
simp only [cosh_two_mul, sinh_two_mul]
have h2 : sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2 := by ring
rw [h2, sinh_sq]
ring
#align complex.cosh_three_mul Complex.cosh_three_mul
| Mathlib/Data/Complex/Exponential.lean | 475 | 481 | theorem sinh_three_mul : sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x := by |
have h1 : x + 2 * x = 3 * x := by ring
rw [β h1, sinh_add x (2 * x)]
simp only [cosh_two_mul, sinh_two_mul]
have h2 : cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2 := by ring
rw [h2, cosh_sq]
ring
|
import Mathlib.LinearAlgebra.CliffordAlgebra.Grading
import Mathlib.Algebra.Module.Opposites
#align_import linear_algebra.clifford_algebra.conjugation from "leanprover-community/mathlib"@"34020e531ebc4e8aac6d449d9eecbcd1508ea8d0"
variable {R : Type*} [CommRing R]
variable {M : Type*} [AddCommGroup M] [Module R M]
variable {Q : QuadraticForm R M}
namespace CliffordAlgebra
section Submodule
variable (Q)
section Involute
theorem submodule_map_involute_eq_comap (p : Submodule R (CliffordAlgebra Q)) :
p.map (involute : CliffordAlgebra Q ββ[R] CliffordAlgebra Q).toLinearMap =
p.comap (involute : CliffordAlgebra Q ββ[R] CliffordAlgebra Q).toLinearMap :=
Submodule.map_equiv_eq_comap_symm involuteEquiv.toLinearEquiv _
#align clifford_algebra.submodule_map_involute_eq_comap CliffordAlgebra.submodule_map_involute_eq_comap
@[simp]
theorem ΞΉ_range_map_involute :
(ΞΉ Q).range.map (involute : CliffordAlgebra Q ββ[R] CliffordAlgebra Q).toLinearMap =
LinearMap.range (ΞΉ Q) :=
(ΞΉ_range_map_lift _ _).trans (LinearMap.range_neg _)
#align clifford_algebra.ΞΉ_range_map_involute CliffordAlgebra.ΞΉ_range_map_involute
@[simp]
theorem ΞΉ_range_comap_involute :
(ΞΉ Q).range.comap (involute : CliffordAlgebra Q ββ[R] CliffordAlgebra Q).toLinearMap =
LinearMap.range (ΞΉ Q) := by
rw [β submodule_map_involute_eq_comap, ΞΉ_range_map_involute]
#align clifford_algebra.ΞΉ_range_comap_involute CliffordAlgebra.ΞΉ_range_comap_involute
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Conjugation.lean | 234 | 237 | theorem evenOdd_map_involute (n : ZMod 2) :
(evenOdd Q n).map (involute : CliffordAlgebra Q ββ[R] CliffordAlgebra Q).toLinearMap =
evenOdd Q n := by |
simp_rw [evenOdd, Submodule.map_iSup, Submodule.map_pow, ΞΉ_range_map_involute]
|
import Mathlib.Data.Set.Basic
#align_import order.circular from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
class Btw (Ξ± : Type*) where
btw : Ξ± β Ξ± β Ξ± β Prop
#align has_btw Btw
export Btw (btw)
class SBtw (Ξ± : Type*) where
sbtw : Ξ± β Ξ± β Ξ± β Prop
#align has_sbtw SBtw
export SBtw (sbtw)
class CircularPreorder (Ξ± : Type*) extends Btw Ξ±, SBtw Ξ± where
btw_refl (a : Ξ±) : btw a a a
btw_cyclic_left {a b c : Ξ±} : btw a b c β btw b c a
sbtw := fun a b c => btw a b c β§ Β¬btw c b a
sbtw_iff_btw_not_btw {a b c : Ξ±} : sbtw a b c β btw a b c β§ Β¬btw c b a := by intros; rfl
sbtw_trans_left {a b c d : Ξ±} : sbtw a b c β sbtw b d c β sbtw a d c
#align circular_preorder CircularPreorder
export CircularPreorder (btw_refl btw_cyclic_left sbtw_trans_left)
class CircularPartialOrder (Ξ± : Type*) extends CircularPreorder Ξ± where
btw_antisymm {a b c : Ξ±} : btw a b c β btw c b a β a = b β¨ b = c β¨ c = a
#align circular_partial_order CircularPartialOrder
export CircularPartialOrder (btw_antisymm)
class CircularOrder (Ξ± : Type*) extends CircularPartialOrder Ξ± where
btw_total : β a b c : Ξ±, btw a b c β¨ btw c b a
#align circular_order CircularOrder
export CircularOrder (btw_total)
section CircularOrder
variable {Ξ± : Type*} [CircularOrder Ξ±]
theorem left_mem_cIcc (a b : Ξ±) : a β cIcc a b :=
btw_rfl_left
#align set.left_mem_cIcc Set.left_mem_cIcc
theorem right_mem_cIcc (a b : Ξ±) : b β cIcc a b :=
btw_rfl_right
#align set.right_mem_cIcc Set.right_mem_cIcc
| Mathlib/Order/Circular.lean | 369 | 371 | theorem compl_cIcc {a b : Ξ±} : (cIcc a b)αΆ = cIoo b a := by |
ext
rw [Set.mem_cIoo, sbtw_iff_not_btw, cIcc, mem_compl_iff, mem_setOf]
|
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.Tactic.FinCases
#align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Affine
namespace Finset
theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by
ext x
fin_cases x <;> simp
#align finset.univ_fin2 Finset.univ_fin2
variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [S : AffineSpace V P]
variable {ΞΉ : Type*} (s : Finset ΞΉ)
variable {ΞΉβ : Type*} (sβ : Finset ΞΉβ)
def weightedVSubOfPoint (p : ΞΉ β P) (b : P) : (ΞΉ β k) ββ[k] V :=
β i β s, (LinearMap.proj i : (ΞΉ β k) ββ[k] k).smulRight (p i -α΅₯ b)
#align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint
@[simp]
theorem weightedVSubOfPoint_apply (w : ΞΉ β k) (p : ΞΉ β P) (b : P) :
s.weightedVSubOfPoint p b w = β i β s, w i β’ (p i -α΅₯ b) := by
simp [weightedVSubOfPoint, LinearMap.sum_apply]
#align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply
@[simp (high)]
theorem weightedVSubOfPoint_apply_const (w : ΞΉ β k) (p : P) (b : P) :
s.weightedVSubOfPoint (fun _ => p) b w = (β i β s, w i) β’ (p -α΅₯ b) := by
rw [weightedVSubOfPoint_apply, sum_smul]
#align finset.weighted_vsub_of_point_apply_const Finset.weightedVSubOfPoint_apply_const
theorem weightedVSubOfPoint_congr {wβ wβ : ΞΉ β k} (hw : β i β s, wβ i = wβ i) {pβ pβ : ΞΉ β P}
(hp : β i β s, pβ i = pβ i) (b : P) :
s.weightedVSubOfPoint pβ b wβ = s.weightedVSubOfPoint pβ b wβ := by
simp_rw [weightedVSubOfPoint_apply]
refine sum_congr rfl fun i hi => ?_
rw [hw i hi, hp i hi]
#align finset.weighted_vsub_of_point_congr Finset.weightedVSubOfPoint_congr
theorem weightedVSubOfPoint_eq_of_weights_eq (p : ΞΉ β P) (j : ΞΉ) (wβ wβ : ΞΉ β k)
(hw : β i, i β j β wβ i = wβ i) :
s.weightedVSubOfPoint p (p j) wβ = s.weightedVSubOfPoint p (p j) wβ := by
simp only [Finset.weightedVSubOfPoint_apply]
congr
ext i
rcases eq_or_ne i j with h | h
Β· simp [h]
Β· simp [hw i h]
#align finset.weighted_vsub_of_point_eq_of_weights_eq Finset.weightedVSubOfPoint_eq_of_weights_eq
theorem weightedVSubOfPoint_eq_of_sum_eq_zero (w : ΞΉ β k) (p : ΞΉ β P) (h : β i β s, w i = 0)
(bβ bβ : P) : s.weightedVSubOfPoint p bβ w = s.weightedVSubOfPoint p bβ w := by
apply eq_of_sub_eq_zero
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, β sum_sub_distrib]
conv_lhs =>
congr
Β· skip
Β· ext
rw [β smul_sub, vsub_sub_vsub_cancel_left]
rw [β sum_smul, h, zero_smul]
#align finset.weighted_vsub_of_point_eq_of_sum_eq_zero Finset.weightedVSubOfPoint_eq_of_sum_eq_zero
theorem weightedVSubOfPoint_vadd_eq_of_sum_eq_one (w : ΞΉ β k) (p : ΞΉ β P) (h : β i β s, w i = 1)
(bβ bβ : P) : s.weightedVSubOfPoint p bβ w +α΅₯ bβ = s.weightedVSubOfPoint p bβ w +α΅₯ bβ := by
erw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, β @vsub_eq_zero_iff_eq V,
vadd_vsub_assoc, vsub_vadd_eq_vsub_sub, β add_sub_assoc, add_comm, add_sub_assoc, β
sum_sub_distrib]
conv_lhs =>
congr
Β· skip
Β· congr
Β· skip
Β· ext
rw [β smul_sub, vsub_sub_vsub_cancel_left]
rw [β sum_smul, h, one_smul, vsub_add_vsub_cancel, vsub_self]
#align finset.weighted_vsub_of_point_vadd_eq_of_sum_eq_one Finset.weightedVSubOfPoint_vadd_eq_of_sum_eq_one
@[simp (high)]
theorem weightedVSubOfPoint_erase [DecidableEq ΞΉ] (w : ΞΉ β k) (p : ΞΉ β P) (i : ΞΉ) :
(s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply]
apply sum_erase
rw [vsub_self, smul_zero]
#align finset.weighted_vsub_of_point_erase Finset.weightedVSubOfPoint_erase
@[simp (high)]
theorem weightedVSubOfPoint_insert [DecidableEq ΞΉ] (w : ΞΉ β k) (p : ΞΉ β P) (i : ΞΉ) :
(insert i s).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply]
apply sum_insert_zero
rw [vsub_self, smul_zero]
#align finset.weighted_vsub_of_point_insert Finset.weightedVSubOfPoint_insert
theorem weightedVSubOfPoint_indicator_subset (w : ΞΉ β k) (p : ΞΉ β P) (b : P) {sβ sβ : Finset ΞΉ}
(h : sβ β sβ) :
sβ.weightedVSubOfPoint p b w = sβ.weightedVSubOfPoint p b (Set.indicator (βsβ) w) := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply]
exact Eq.symm <|
sum_indicator_subset_of_eq_zero w (fun i wi => wi β’ (p i -α΅₯ b : V)) h fun i => zero_smul k _
#align finset.weighted_vsub_of_point_indicator_subset Finset.weightedVSubOfPoint_indicator_subset
theorem weightedVSubOfPoint_map (e : ΞΉβ βͺ ΞΉ) (w : ΞΉ β k) (p : ΞΉ β P) (b : P) :
(sβ.map e).weightedVSubOfPoint p b w = sβ.weightedVSubOfPoint (p β e) b (w β e) := by
simp_rw [weightedVSubOfPoint_apply]
exact Finset.sum_map _ _ _
#align finset.weighted_vsub_of_point_map Finset.weightedVSubOfPoint_map
theorem sum_smul_vsub_eq_weightedVSubOfPoint_sub (w : ΞΉ β k) (pβ pβ : ΞΉ β P) (b : P) :
(β i β s, w i β’ (pβ i -α΅₯ pβ i)) =
s.weightedVSubOfPoint pβ b w - s.weightedVSubOfPoint pβ b w := by
simp_rw [weightedVSubOfPoint_apply, β sum_sub_distrib, β smul_sub, vsub_sub_vsub_cancel_right]
#align finset.sum_smul_vsub_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_eq_weightedVSubOfPoint_sub
theorem sum_smul_vsub_const_eq_weightedVSubOfPoint_sub (w : ΞΉ β k) (pβ : ΞΉ β P) (pβ b : P) :
(β i β s, w i β’ (pβ i -α΅₯ pβ)) = s.weightedVSubOfPoint pβ b w - (β i β s, w i) β’ (pβ -α΅₯ b) := by
rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const]
#align finset.sum_smul_vsub_const_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_const_eq_weightedVSubOfPoint_sub
theorem sum_smul_const_vsub_eq_sub_weightedVSubOfPoint (w : ΞΉ β k) (pβ : ΞΉ β P) (pβ b : P) :
(β i β s, w i β’ (pβ -α΅₯ pβ i)) = (β i β s, w i) β’ (pβ -α΅₯ b) - s.weightedVSubOfPoint pβ b w := by
rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const]
#align finset.sum_smul_const_vsub_eq_sub_weighted_vsub_of_point Finset.sum_smul_const_vsub_eq_sub_weightedVSubOfPoint
theorem weightedVSubOfPoint_sdiff [DecidableEq ΞΉ] {sβ : Finset ΞΉ} (h : sβ β s) (w : ΞΉ β k)
(p : ΞΉ β P) (b : P) :
(s \ sβ).weightedVSubOfPoint p b w + sβ.weightedVSubOfPoint p b w =
s.weightedVSubOfPoint p b w := by
simp_rw [weightedVSubOfPoint_apply, sum_sdiff h]
#align finset.weighted_vsub_of_point_sdiff Finset.weightedVSubOfPoint_sdiff
theorem weightedVSubOfPoint_sdiff_sub [DecidableEq ΞΉ] {sβ : Finset ΞΉ} (h : sβ β s) (w : ΞΉ β k)
(p : ΞΉ β P) (b : P) :
(s \ sβ).weightedVSubOfPoint p b w - sβ.weightedVSubOfPoint p b (-w) =
s.weightedVSubOfPoint p b w := by
rw [map_neg, sub_neg_eq_add, s.weightedVSubOfPoint_sdiff h]
#align finset.weighted_vsub_of_point_sdiff_sub Finset.weightedVSubOfPoint_sdiff_sub
theorem weightedVSubOfPoint_subtype_eq_filter (w : ΞΉ β k) (p : ΞΉ β P) (b : P) (pred : ΞΉ β Prop)
[DecidablePred pred] :
((s.subtype pred).weightedVSubOfPoint (fun i => p i) b fun i => w i) =
(s.filter pred).weightedVSubOfPoint p b w := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, β sum_subtype_eq_sum_filter]
#align finset.weighted_vsub_of_point_subtype_eq_filter Finset.weightedVSubOfPoint_subtype_eq_filter
theorem weightedVSubOfPoint_filter_of_ne (w : ΞΉ β k) (p : ΞΉ β P) (b : P) {pred : ΞΉ β Prop}
[DecidablePred pred] (h : β i β s, w i β 0 β pred i) :
(s.filter pred).weightedVSubOfPoint p b w = s.weightedVSubOfPoint p b w := by
rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, sum_filter_of_ne]
intro i hi hne
refine h i hi ?_
intro hw
simp [hw] at hne
#align finset.weighted_vsub_of_point_filter_of_ne Finset.weightedVSubOfPoint_filter_of_ne
theorem weightedVSubOfPoint_const_smul (w : ΞΉ β k) (p : ΞΉ β P) (b : P) (c : k) :
s.weightedVSubOfPoint p b (c β’ w) = c β’ s.weightedVSubOfPoint p b w := by
simp_rw [weightedVSubOfPoint_apply, smul_sum, Pi.smul_apply, smul_smul, smul_eq_mul]
#align finset.weighted_vsub_of_point_const_smul Finset.weightedVSubOfPoint_const_smul
def weightedVSub (p : ΞΉ β P) : (ΞΉ β k) ββ[k] V :=
s.weightedVSubOfPoint p (Classical.choice S.nonempty)
#align finset.weighted_vsub Finset.weightedVSub
theorem weightedVSub_apply (w : ΞΉ β k) (p : ΞΉ β P) :
s.weightedVSub p w = β i β s, w i β’ (p i -α΅₯ Classical.choice S.nonempty) := by
simp [weightedVSub, LinearMap.sum_apply]
#align finset.weighted_vsub_apply Finset.weightedVSub_apply
theorem weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero (w : ΞΉ β k) (p : ΞΉ β P)
(h : β i β s, w i = 0) (b : P) : s.weightedVSub p w = s.weightedVSubOfPoint p b w :=
s.weightedVSubOfPoint_eq_of_sum_eq_zero w p h _ _
#align finset.weighted_vsub_eq_weighted_vsub_of_point_of_sum_eq_zero Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero
@[simp]
theorem weightedVSub_apply_const (w : ΞΉ β k) (p : P) (h : β i β s, w i = 0) :
s.weightedVSub (fun _ => p) w = 0 := by
rw [weightedVSub, weightedVSubOfPoint_apply_const, h, zero_smul]
#align finset.weighted_vsub_apply_const Finset.weightedVSub_apply_const
@[simp]
theorem weightedVSub_empty (w : ΞΉ β k) (p : ΞΉ β P) : (β
: Finset ΞΉ).weightedVSub p w = (0 : V) := by
simp [weightedVSub_apply]
#align finset.weighted_vsub_empty Finset.weightedVSub_empty
theorem weightedVSub_congr {wβ wβ : ΞΉ β k} (hw : β i β s, wβ i = wβ i) {pβ pβ : ΞΉ β P}
(hp : β i β s, pβ i = pβ i) : s.weightedVSub pβ wβ = s.weightedVSub pβ wβ :=
s.weightedVSubOfPoint_congr hw hp _
#align finset.weighted_vsub_congr Finset.weightedVSub_congr
theorem weightedVSub_indicator_subset (w : ΞΉ β k) (p : ΞΉ β P) {sβ sβ : Finset ΞΉ} (h : sβ β sβ) :
sβ.weightedVSub p w = sβ.weightedVSub p (Set.indicator (βsβ) w) :=
weightedVSubOfPoint_indicator_subset _ _ _ h
#align finset.weighted_vsub_indicator_subset Finset.weightedVSub_indicator_subset
theorem weightedVSub_map (e : ΞΉβ βͺ ΞΉ) (w : ΞΉ β k) (p : ΞΉ β P) :
(sβ.map e).weightedVSub p w = sβ.weightedVSub (p β e) (w β e) :=
sβ.weightedVSubOfPoint_map _ _ _ _
#align finset.weighted_vsub_map Finset.weightedVSub_map
theorem sum_smul_vsub_eq_weightedVSub_sub (w : ΞΉ β k) (pβ pβ : ΞΉ β P) :
(β i β s, w i β’ (pβ i -α΅₯ pβ i)) = s.weightedVSub pβ w - s.weightedVSub pβ w :=
s.sum_smul_vsub_eq_weightedVSubOfPoint_sub _ _ _ _
#align finset.sum_smul_vsub_eq_weighted_vsub_sub Finset.sum_smul_vsub_eq_weightedVSub_sub
theorem sum_smul_vsub_const_eq_weightedVSub (w : ΞΉ β k) (pβ : ΞΉ β P) (pβ : P)
(h : β i β s, w i = 0) : (β i β s, w i β’ (pβ i -α΅₯ pβ)) = s.weightedVSub pβ w := by
rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, sub_zero]
#align finset.sum_smul_vsub_const_eq_weighted_vsub Finset.sum_smul_vsub_const_eq_weightedVSub
| Mathlib/LinearAlgebra/AffineSpace/Combination.lean | 320 | 322 | theorem sum_smul_const_vsub_eq_neg_weightedVSub (w : ΞΉ β k) (pβ : ΞΉ β P) (pβ : P)
(h : β i β s, w i = 0) : (β i β s, w i β’ (pβ -α΅₯ pβ i)) = -s.weightedVSub pβ w := by |
rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, zero_sub]
|
import Mathlib.Algebra.Algebra.Subalgebra.Operations
import Mathlib.Algebra.Ring.Fin
import Mathlib.RingTheory.Ideal.Quotient
#align_import ring_theory.ideal.quotient_operations from "leanprover-community/mathlib"@"b88d81c84530450a8989e918608e5960f015e6c8"
universe u v w
namespace Ideal
open Function RingHom
variable {R : Type u} {S : Type v} {F : Type w} [CommRing R] [Semiring S]
@[simp]
theorem map_quotient_self (I : Ideal R) : map (Quotient.mk I) I = β₯ :=
eq_bot_iff.2 <|
Ideal.map_le_iff_le_comap.2 fun _ hx =>
(Submodule.mem_bot (R β§Έ I)).2 <| Ideal.Quotient.eq_zero_iff_mem.2 hx
#align ideal.map_quotient_self Ideal.map_quotient_self
@[simp]
theorem mk_ker {I : Ideal R} : ker (Quotient.mk I) = I := by
ext
rw [ker, mem_comap, Submodule.mem_bot, Quotient.eq_zero_iff_mem]
#align ideal.mk_ker Ideal.mk_ker
theorem map_mk_eq_bot_of_le {I J : Ideal R} (h : I β€ J) : I.map (Quotient.mk J) = β₯ := by
rw [map_eq_bot_iff_le_ker, mk_ker]
exact h
#align ideal.map_mk_eq_bot_of_le Ideal.map_mk_eq_bot_of_le
theorem ker_quotient_lift {I : Ideal R} (f : R β+* S)
(H : I β€ ker f) :
ker (Ideal.Quotient.lift I f H) = f.ker.map (Quotient.mk I) := by
apply Ideal.ext
intro x
constructor
Β· intro hx
obtain β¨y, hyβ© := Quotient.mk_surjective x
rw [mem_ker, β hy, Ideal.Quotient.lift_mk, β mem_ker] at hx
rw [β hy, mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective]
exact β¨y, hx, rflβ©
Β· intro hx
rw [mem_map_iff_of_surjective (Quotient.mk I) Quotient.mk_surjective] at hx
obtain β¨y, hyβ© := hx
rw [mem_ker, β hy.right, Ideal.Quotient.lift_mk]
exact hy.left
#align ideal.ker_quotient_lift Ideal.ker_quotient_lift
lemma injective_lift_iff {I : Ideal R} {f : R β+* S} (H : β (a : R), a β I β f a = 0) :
Injective (Quotient.lift I f H) β ker f = I := by
rw [injective_iff_ker_eq_bot, ker_quotient_lift, map_eq_bot_iff_le_ker, mk_ker]
constructor
Β· exact fun h β¦ le_antisymm h H
Β· rintro rfl; rfl
lemma ker_Pi_Quotient_mk {ΞΉ : Type*} (I : ΞΉ β Ideal R) :
ker (Pi.ringHom fun i : ΞΉ β¦ Quotient.mk (I i)) = β¨
i, I i := by
simp [Pi.ker_ringHom, mk_ker]
@[simp]
theorem bot_quotient_isMaximal_iff (I : Ideal R) : (β₯ : Ideal (R β§Έ I)).IsMaximal β I.IsMaximal :=
β¨fun hI =>
mk_ker (I := I) βΈ
comap_isMaximal_of_surjective (Quotient.mk I) Quotient.mk_surjective (K := β₯) (H := hI),
fun hI => by
letI := Quotient.field I
exact bot_isMaximalβ©
#align ideal.bot_quotient_is_maximal_iff Ideal.bot_quotient_isMaximal_iff
@[simp]
theorem mem_quotient_iff_mem_sup {I J : Ideal R} {x : R} :
Quotient.mk I x β J.map (Quotient.mk I) β x β J β I := by
rw [β mem_comap, comap_map_of_surjective (Quotient.mk I) Quotient.mk_surjective, β
ker_eq_comap_bot, mk_ker]
#align ideal.mem_quotient_iff_mem_sup Ideal.mem_quotient_iff_mem_sup
theorem mem_quotient_iff_mem {I J : Ideal R} (hIJ : I β€ J) {x : R} :
Quotient.mk I x β J.map (Quotient.mk I) β x β J := by
rw [mem_quotient_iff_mem_sup, sup_eq_left.mpr hIJ]
#align ideal.mem_quotient_iff_mem Ideal.mem_quotient_iff_mem
section QuotientAlgebra
variable (Rβ Rβ : Type*) {A B : Type*}
variable [CommSemiring Rβ] [CommSemiring Rβ] [CommRing A]
variable [Algebra Rβ A] [Algebra Rβ A]
instance Quotient.algebra {I : Ideal A} : Algebra Rβ (A β§Έ I) :=
{ toRingHom := (Ideal.Quotient.mk I).comp (algebraMap Rβ A)
smul_def' := fun _ x =>
Quotient.inductionOn' x fun _ =>
((Quotient.mk I).congr_arg <| Algebra.smul_def _ _).trans (RingHom.map_mul _ _ _)
commutes' := fun _ _ => mul_comm _ _ }
#align ideal.quotient.algebra Ideal.Quotient.algebra
-- Lean can struggle to find this instance later if we don't provide this shortcut
-- Porting note: this can probably now be deleted
-- update: maybe not - removal causes timeouts
instance Quotient.isScalarTower [SMul Rβ Rβ] [IsScalarTower Rβ Rβ A] (I : Ideal A) :
IsScalarTower Rβ Rβ (A β§Έ I) := by infer_instance
#align ideal.quotient.is_scalar_tower Ideal.Quotient.isScalarTower
def Quotient.mkβ (I : Ideal A) : A ββ[Rβ] A β§Έ I :=
β¨β¨β¨β¨fun a => Submodule.Quotient.mk a, rflβ©, fun _ _ => rflβ©, rfl, fun _ _ => rflβ©, fun _ => rflβ©
#align ideal.quotient.mkβ Ideal.Quotient.mkβ
theorem Quotient.algHom_ext {I : Ideal A} {S} [Semiring S] [Algebra Rβ S] β¦f g : A β§Έ I ββ[Rβ] Sβ¦
(h : f.comp (Quotient.mkβ Rβ I) = g.comp (Quotient.mkβ Rβ I)) : f = g :=
AlgHom.ext fun x => Quotient.inductionOn' x <| AlgHom.congr_fun h
#align ideal.quotient.alg_hom_ext Ideal.Quotient.algHom_ext
theorem Quotient.alg_map_eq (I : Ideal A) :
algebraMap Rβ (A β§Έ I) = (algebraMap A (A β§Έ I)).comp (algebraMap Rβ A) :=
rfl
#align ideal.quotient.alg_map_eq Ideal.Quotient.alg_map_eq
theorem Quotient.mkβ_toRingHom (I : Ideal A) :
(Quotient.mkβ Rβ I).toRingHom = Ideal.Quotient.mk I :=
rfl
#align ideal.quotient.mkβ_to_ring_hom Ideal.Quotient.mkβ_toRingHom
@[simp]
theorem Quotient.mkβ_eq_mk (I : Ideal A) : β(Quotient.mkβ Rβ I) = Quotient.mk I :=
rfl
#align ideal.quotient.mkβ_eq_mk Ideal.Quotient.mkβ_eq_mk
@[simp]
theorem Quotient.algebraMap_eq (I : Ideal R) : algebraMap R (R β§Έ I) = Quotient.mk I :=
rfl
#align ideal.quotient.algebra_map_eq Ideal.Quotient.algebraMap_eq
@[simp]
theorem Quotient.mk_comp_algebraMap (I : Ideal A) :
(Quotient.mk I).comp (algebraMap Rβ A) = algebraMap Rβ (A β§Έ I) :=
rfl
#align ideal.quotient.mk_comp_algebra_map Ideal.Quotient.mk_comp_algebraMap
@[simp]
theorem Quotient.mk_algebraMap (I : Ideal A) (x : Rβ) :
Quotient.mk I (algebraMap Rβ A x) = algebraMap Rβ (A β§Έ I) x :=
rfl
#align ideal.quotient.mk_algebra_map Ideal.Quotient.mk_algebraMap
theorem Quotient.mkβ_surjective (I : Ideal A) : Function.Surjective (Quotient.mkβ Rβ I) :=
surjective_quot_mk _
#align ideal.quotient.mkβ_surjective Ideal.Quotient.mkβ_surjective
@[simp]
theorem Quotient.mkβ_ker (I : Ideal A) : RingHom.ker (Quotient.mkβ Rβ I : A β+* A β§Έ I) = I :=
Ideal.mk_ker
#align ideal.quotient.mkβ_ker Ideal.Quotient.mkβ_ker
variable {Rβ}
section
variable [Semiring B] [Algebra Rβ B]
def Quotient.liftβ (I : Ideal A) (f : A ββ[Rβ] B) (hI : β a : A, a β I β f a = 0) :
A β§Έ I ββ[Rβ] B :=
{-- this is IsScalarTower.algebraMap_apply Rβ A (A β§Έ I) but the file `Algebra.Algebra.Tower`
-- imports this file.
Ideal.Quotient.lift
I (f : A β+* B) hI with
commutes' := fun r => by
have : algebraMap Rβ (A β§Έ I) r = algebraMap A (A β§Έ I) (algebraMap Rβ A r) := by
simp_rw [Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]
rw [this, Ideal.Quotient.algebraMap_eq, RingHom.toFun_eq_coe, Ideal.Quotient.lift_mk,
AlgHom.coe_toRingHom, Algebra.algebraMap_eq_smul_one, Algebra.algebraMap_eq_smul_one,
map_smul, map_one] }
#align ideal.quotient.liftβ Ideal.Quotient.liftβ
@[simp]
theorem Quotient.liftβ_apply (I : Ideal A) (f : A ββ[Rβ] B) (hI : β a : A, a β I β f a = 0) (x) :
Ideal.Quotient.liftβ I f hI x = Ideal.Quotient.lift I (f : A β+* B) hI x :=
rfl
#align ideal.quotient.liftβ_apply Ideal.Quotient.liftβ_apply
theorem Quotient.liftβ_comp (I : Ideal A) (f : A ββ[Rβ] B) (hI : β a : A, a β I β f a = 0) :
(Ideal.Quotient.liftβ I f hI).comp (Ideal.Quotient.mkβ Rβ I) = f :=
AlgHom.ext fun _ => (Ideal.Quotient.lift_mk I (f : A β+* B) hI : _)
#align ideal.quotient.liftβ_comp Ideal.Quotient.liftβ_comp
theorem KerLift.map_smul (f : A ββ[Rβ] B) (r : Rβ) (x : A β§Έ (RingHom.ker f)) :
f.kerLift (r β’ x) = r β’ f.kerLift x := by
obtain β¨a, rflβ© := Quotient.mkβ_surjective Rβ _ x
exact f.map_smul _ _
#align ideal.ker_lift.map_smul Ideal.KerLift.map_smul
def kerLiftAlg (f : A ββ[Rβ] B) : A β§Έ (RingHom.ker f) ββ[Rβ] B :=
AlgHom.mk' (RingHom.kerLift (f : A β+* B)) fun _ _ => KerLift.map_smul f _ _
#align ideal.ker_lift_alg Ideal.kerLiftAlg
@[simp]
theorem kerLiftAlg_mk (f : A ββ[Rβ] B) (a : A) :
kerLiftAlg f (Quotient.mk (RingHom.ker f) a) = f a := by
rfl
#align ideal.ker_lift_alg_mk Ideal.kerLiftAlg_mk
@[simp]
theorem kerLiftAlg_toRingHom (f : A ββ[Rβ] B) :
(kerLiftAlg f : A β§Έ ker f β+* B) = RingHom.kerLift (f : A β+* B) :=
rfl
#align ideal.ker_lift_alg_to_ring_hom Ideal.kerLiftAlg_toRingHom
theorem kerLiftAlg_injective (f : A ββ[Rβ] B) : Function.Injective (kerLiftAlg f) :=
RingHom.kerLift_injective (R := A) (S := B) f
#align ideal.ker_lift_alg_injective Ideal.kerLiftAlg_injective
@[simps!]
def quotientKerAlgEquivOfRightInverse {f : A ββ[Rβ] B} {g : B β A}
(hf : Function.RightInverse g f) : (A β§Έ RingHom.ker f) ββ[Rβ] B :=
{ RingHom.quotientKerEquivOfRightInverse hf,
kerLiftAlg f with }
#align ideal.quotient_ker_alg_equiv_of_right_inverse Ideal.quotientKerAlgEquivOfRightInverse
#align ideal.quotient_ker_alg_equiv_of_right_inverse.apply Ideal.quotientKerAlgEquivOfRightInverse_apply
#align ideal.quotient_ker_alg_equiv_of_right_inverse_symm.apply Ideal.quotientKerAlgEquivOfRightInverse_symm_apply
@[deprecated (since := "2024-02-27")]
alias quotientKerAlgEquivOfRightInverse.apply := quotientKerAlgEquivOfRightInverse_apply
@[deprecated (since := "2024-02-27")]
alias QuotientKerAlgEquivOfRightInverseSymm.apply := quotientKerAlgEquivOfRightInverse_symm_apply
@[simps!]
noncomputable def quotientKerAlgEquivOfSurjective {f : A ββ[Rβ] B} (hf : Function.Surjective f) :
(A β§Έ (RingHom.ker f)) ββ[Rβ] B :=
quotientKerAlgEquivOfRightInverse (Classical.choose_spec hf.hasRightInverse)
#align ideal.quotient_ker_alg_equiv_of_surjective Ideal.quotientKerAlgEquivOfSurjective
end
section
variable [CommRing B] [Algebra Rβ B]
def quotientMapβ {I : Ideal A} (J : Ideal B) (f : A ββ[Rβ] B) (hIJ : I β€ J.comap f) :
A β§Έ I ββ[Rβ] B β§Έ J :=
{ quotientMap J (f : A β+* B) hIJ with commutes' := fun r => by simp only [RingHom.toFun_eq_coe,
quotientMap_algebraMap, AlgHom.coe_toRingHom, AlgHom.commutes, Quotient.mk_algebraMap] }
#align ideal.quotient_mapβ Ideal.quotientMapβ
@[simp]
theorem quotient_map_mkβ {I : Ideal A} (J : Ideal B) (f : A ββ[Rβ] B) (H : I β€ J.comap f) {x : A} :
quotientMapβ J f H (Quotient.mk I x) = Quotient.mkβ Rβ J (f x) :=
rfl
#align ideal.quotient_map_mkβ Ideal.quotient_map_mkβ
theorem quotient_map_comp_mkβ {I : Ideal A} (J : Ideal B) (f : A ββ[Rβ] B) (H : I β€ J.comap f) :
(quotientMapβ J f H).comp (Quotient.mkβ Rβ I) = (Quotient.mkβ Rβ J).comp f :=
AlgHom.ext fun x => by simp only [quotient_map_mkβ, Quotient.mkβ_eq_mk, AlgHom.comp_apply]
#align ideal.quotient_map_comp_mkβ Ideal.quotient_map_comp_mkβ
def quotientEquivAlg (I : Ideal A) (J : Ideal B) (f : A ββ[Rβ] B) (hIJ : J = I.map (f : A β+* B)) :
(A β§Έ I) ββ[Rβ] B β§Έ J :=
{ quotientEquiv I J (f : A β+* B) hIJ with
commutes' := fun r => by
-- Porting note: Needed to add the below lemma because Equivs coerce weird
have : β (e : RingEquiv (A β§Έ I) (B β§Έ J)), Equiv.toFun e.toEquiv = DFunLike.coe e :=
fun _ β¦ rfl
rw [this]
simp only [quotientEquiv_apply, RingHom.toFun_eq_coe, quotientMap_algebraMap,
RingEquiv.coe_toRingHom, AlgEquiv.coe_ringEquiv, AlgEquiv.commutes, Quotient.mk_algebraMap]}
#align ideal.quotient_equiv_alg Ideal.quotientEquivAlg
end
instance (priority := 100) quotientAlgebra {I : Ideal A} [Algebra R A] :
Algebra (R β§Έ I.comap (algebraMap R A)) (A β§Έ I) :=
(quotientMap I (algebraMap R A) (le_of_eq rfl)).toAlgebra
#align ideal.quotient_algebra Ideal.quotientAlgebra
theorem algebraMap_quotient_injective {I : Ideal A} [Algebra R A] :
Function.Injective (algebraMap (R β§Έ I.comap (algebraMap R A)) (A β§Έ I)) := by
rintro β¨aβ© β¨bβ© hab
replace hab := Quotient.eq.mp hab
rw [β RingHom.map_sub] at hab
exact Quotient.eq.mpr hab
#align ideal.algebra_map_quotient_injective Ideal.algebraMap_quotient_injective
variable (Rβ)
def quotientEquivAlgOfEq {I J : Ideal A} (h : I = J) : (A β§Έ I) ββ[Rβ] A β§Έ J :=
quotientEquivAlg I J AlgEquiv.refl <| h βΈ (map_id I).symm
#align ideal.quotient_equiv_alg_of_eq Ideal.quotientEquivAlgOfEq
@[simp]
theorem quotientEquivAlgOfEq_mk {I J : Ideal A} (h : I = J) (x : A) :
quotientEquivAlgOfEq Rβ h (Ideal.Quotient.mk I x) = Ideal.Quotient.mk J x :=
rfl
#align ideal.quotient_equiv_alg_of_eq_mk Ideal.quotientEquivAlgOfEq_mk
@[simp]
| Mathlib/RingTheory/Ideal/QuotientOperations.lean | 676 | 679 | theorem quotientEquivAlgOfEq_symm {I J : Ideal A} (h : I = J) :
(quotientEquivAlgOfEq Rβ h).symm = quotientEquivAlgOfEq Rβ h.symm := by |
ext
rfl
|
import Mathlib.Init.Control.Combinators
import Mathlib.Init.Function
import Mathlib.Tactic.CasesM
import Mathlib.Tactic.Attr.Core
#align_import control.basic from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
universe u v w
variable {Ξ± Ξ² Ξ³ : Type u}
section Monad
variable {m : Type u β Type v} [Monad m] [LawfulMonad m]
open List
#align list.mpartition List.partitionM
| Mathlib/Control/Basic.lean | 83 | 85 | theorem map_bind (x : m Ξ±) {g : Ξ± β m Ξ²} {f : Ξ² β Ξ³} :
f <$> (x >>= g) = x >>= fun a => f <$> g a := by |
rw [β bind_pure_comp, bind_assoc]; simp [bind_pure_comp]
|
import Mathlib.Data.Fin.VecNotation
import Mathlib.SetTheory.Cardinal.Basic
#align_import model_theory.basic from "leanprover-community/mathlib"@"369525b73f229ccd76a6ec0e0e0bf2be57599768"
set_option autoImplicit true
universe u v u' v' w w'
open Cardinal
open Cardinal
namespace FirstOrder
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
structure Language where
Functions : β β Type u
Relations : β β Type v
#align first_order.language FirstOrder.Language
--@[simp]
def Sequenceβ (aβ aβ aβ : Type u) : β β Type u
| 0 => aβ
| 1 => aβ
| 2 => aβ
| _ => PEmpty
#align first_order.sequenceβ FirstOrder.Sequenceβ
namespace Language
@[simps]
protected def mkβ (c fβ fβ : Type u) (rβ rβ : Type v) : Language :=
β¨Sequenceβ c fβ fβ, Sequenceβ PEmpty rβ rββ©
#align first_order.language.mkβ FirstOrder.Language.mkβ
protected def empty : Language :=
β¨fun _ => Empty, fun _ => Emptyβ©
#align first_order.language.empty FirstOrder.Language.empty
instance : Inhabited Language :=
β¨Language.emptyβ©
protected def sum (L : Language.{u, v}) (L' : Language.{u', v'}) : Language :=
β¨fun n => Sum (L.Functions n) (L'.Functions n), fun n => Sum (L.Relations n) (L'.Relations n)β©
#align first_order.language.sum FirstOrder.Language.sum
variable (L : Language.{u, v})
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
protected def Constants :=
L.Functions 0
#align first_order.language.constants FirstOrder.Language.Constants
@[simp]
theorem constants_mkβ (c fβ fβ : Type u) (rβ rβ : Type v) :
(Language.mkβ c fβ fβ rβ rβ).Constants = c :=
rfl
#align first_order.language.constants_mkβ FirstOrder.Language.constants_mkβ
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
def Symbols :=
Sum (Ξ£l, L.Functions l) (Ξ£l, L.Relations l)
#align first_order.language.symbols FirstOrder.Language.Symbols
def card : Cardinal :=
#L.Symbols
#align first_order.language.card FirstOrder.Language.card
class IsRelational : Prop where
empty_functions : β n, IsEmpty (L.Functions n)
#align first_order.language.is_relational FirstOrder.Language.IsRelational
class IsAlgebraic : Prop where
empty_relations : β n, IsEmpty (L.Relations n)
#align first_order.language.is_algebraic FirstOrder.Language.IsAlgebraic
variable {L} {L' : Language.{u', v'}}
theorem card_eq_card_functions_add_card_relations :
L.card =
(Cardinal.sum fun l => Cardinal.lift.{v} #(L.Functions l)) +
Cardinal.sum fun l => Cardinal.lift.{u} #(L.Relations l) := by
simp [card, Symbols]
#align first_order.language.card_eq_card_functions_add_card_relations FirstOrder.Language.card_eq_card_functions_add_card_relations
instance [L.IsRelational] {n : β} : IsEmpty (L.Functions n) :=
IsRelational.empty_functions n
instance [L.IsAlgebraic] {n : β} : IsEmpty (L.Relations n) :=
IsAlgebraic.empty_relations n
instance isRelational_of_empty_functions {symb : β β Type*} :
IsRelational β¨fun _ => Empty, symbβ© :=
β¨fun _ => instIsEmptyEmptyβ©
#align first_order.language.is_relational_of_empty_functions FirstOrder.Language.isRelational_of_empty_functions
instance isAlgebraic_of_empty_relations {symb : β β Type*} : IsAlgebraic β¨symb, fun _ => Emptyβ© :=
β¨fun _ => instIsEmptyEmptyβ©
#align first_order.language.is_algebraic_of_empty_relations FirstOrder.Language.isAlgebraic_of_empty_relations
instance isRelational_empty : IsRelational Language.empty :=
Language.isRelational_of_empty_functions
#align first_order.language.is_relational_empty FirstOrder.Language.isRelational_empty
instance isAlgebraic_empty : IsAlgebraic Language.empty :=
Language.isAlgebraic_of_empty_relations
#align first_order.language.is_algebraic_empty FirstOrder.Language.isAlgebraic_empty
instance isRelational_sum [L.IsRelational] [L'.IsRelational] : IsRelational (L.sum L') :=
β¨fun _ => instIsEmptySumβ©
#align first_order.language.is_relational_sum FirstOrder.Language.isRelational_sum
instance isAlgebraic_sum [L.IsAlgebraic] [L'.IsAlgebraic] : IsAlgebraic (L.sum L') :=
β¨fun _ => instIsEmptySumβ©
#align first_order.language.is_algebraic_sum FirstOrder.Language.isAlgebraic_sum
instance isRelational_mkβ {c fβ fβ : Type u} {rβ rβ : Type v} [h0 : IsEmpty c] [h1 : IsEmpty fβ]
[h2 : IsEmpty fβ] : IsRelational (Language.mkβ c fβ fβ rβ rβ) :=
β¨fun n =>
Nat.casesOn n h0 fun n => Nat.casesOn n h1 fun n => Nat.casesOn n h2 fun _ =>
inferInstanceAs (IsEmpty PEmpty)β©
#align first_order.language.is_relational_mkβ FirstOrder.Language.isRelational_mkβ
instance isAlgebraic_mkβ {c fβ fβ : Type u} {rβ rβ : Type v} [h1 : IsEmpty rβ] [h2 : IsEmpty rβ] :
IsAlgebraic (Language.mkβ c fβ fβ rβ rβ) :=
β¨fun n =>
Nat.casesOn n (inferInstanceAs (IsEmpty PEmpty)) fun n =>
Nat.casesOn n h1 fun n => Nat.casesOn n h2 fun _ => inferInstanceAs (IsEmpty PEmpty)β©
#align first_order.language.is_algebraic_mkβ FirstOrder.Language.isAlgebraic_mkβ
instance subsingleton_mkβ_functions {c fβ fβ : Type u} {rβ rβ : Type v} [h0 : Subsingleton c]
[h1 : Subsingleton fβ] [h2 : Subsingleton fβ] {n : β} :
Subsingleton ((Language.mkβ c fβ fβ rβ rβ).Functions n) :=
Nat.casesOn n h0 fun n =>
Nat.casesOn n h1 fun n => Nat.casesOn n h2 fun _ => β¨fun x => PEmpty.elim xβ©
#align first_order.language.subsingleton_mkβ_functions FirstOrder.Language.subsingleton_mkβ_functions
instance subsingleton_mkβ_relations {c fβ fβ : Type u} {rβ rβ : Type v} [h1 : Subsingleton rβ]
[h2 : Subsingleton rβ] {n : β} : Subsingleton ((Language.mkβ c fβ fβ rβ rβ).Relations n) :=
Nat.casesOn n β¨fun x => PEmpty.elim xβ© fun n =>
Nat.casesOn n h1 fun n => Nat.casesOn n h2 fun _ => β¨fun x => PEmpty.elim xβ©
#align first_order.language.subsingleton_mkβ_relations FirstOrder.Language.subsingleton_mkβ_relations
@[simp]
theorem empty_card : Language.empty.card = 0 := by simp [card_eq_card_functions_add_card_relations]
#align first_order.language.empty_card FirstOrder.Language.empty_card
instance isEmpty_empty : IsEmpty Language.empty.Symbols := by
simp only [Language.Symbols, isEmpty_sum, isEmpty_sigma]
exact β¨fun _ => inferInstance, fun _ => inferInstanceβ©
#align first_order.language.is_empty_empty FirstOrder.Language.isEmpty_empty
instance Countable.countable_functions [h : Countable L.Symbols] : Countable (Ξ£l, L.Functions l) :=
@Function.Injective.countable _ _ h _ Sum.inl_injective
#align first_order.language.countable.countable_functions FirstOrder.Language.Countable.countable_functions
@[simp]
theorem card_functions_sum (i : β) :
#((L.sum L').Functions i)
= (Cardinal.lift.{u'} #(L.Functions i) + Cardinal.lift.{u} #(L'.Functions i) : Cardinal) := by
simp [Language.sum]
#align first_order.language.card_functions_sum FirstOrder.Language.card_functions_sum
@[simp]
theorem card_relations_sum (i : β) :
#((L.sum L').Relations i) =
Cardinal.lift.{v'} #(L.Relations i) + Cardinal.lift.{v} #(L'.Relations i) := by
simp [Language.sum]
#align first_order.language.card_relations_sum FirstOrder.Language.card_relations_sum
@[simp]
theorem card_sum :
(L.sum L').card = Cardinal.lift.{max u' v'} L.card + Cardinal.lift.{max u v} L'.card := by
simp only [card_eq_card_functions_add_card_relations, card_functions_sum, card_relations_sum,
sum_add_distrib', lift_add, lift_sum, lift_lift]
simp only [add_assoc, add_comm (Cardinal.sum fun i => (#(L'.Functions i)).lift)]
#align first_order.language.card_sum FirstOrder.Language.card_sum
@[simp]
theorem card_mkβ (c fβ fβ : Type u) (rβ rβ : Type v) :
(Language.mkβ c fβ fβ rβ rβ).card =
Cardinal.lift.{v} #c + Cardinal.lift.{v} #fβ + Cardinal.lift.{v} #fβ +
Cardinal.lift.{u} #rβ + Cardinal.lift.{u} #rβ := by
simp [card_eq_card_functions_add_card_relations, add_assoc]
#align first_order.language.card_mkβ FirstOrder.Language.card_mkβ
variable (L) (M : Type w)
@[ext]
class Structure where
funMap : β {n}, L.Functions n β (Fin n β M) β M
RelMap : β {n}, L.Relations n β (Fin n β M) β Prop
set_option linter.uppercaseLean3 false in
#align first_order.language.Structure FirstOrder.Language.Structure
set_option linter.uppercaseLean3 false in
#align first_order.language.Structure.fun_map FirstOrder.Language.Structure.funMap
set_option linter.uppercaseLean3 false in
#align first_order.language.Structure.rel_map FirstOrder.Language.Structure.RelMap
variable (N : Type w') [L.Structure M] [L.Structure N]
open Structure
def Inhabited.trivialStructure {Ξ± : Type*} [Inhabited Ξ±] : L.Structure Ξ± :=
β¨default, defaultβ©
#align first_order.language.inhabited.trivial_structure FirstOrder.Language.Inhabited.trivialStructure
structure Hom where
toFun : M β N
-- Porting note:
-- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
-- but that isn't currently sufficient.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
-- If that can be improved, we should change this to `by aesop` and remove the proofs below.
map_fun' : β {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun β x) := by
intros; trivial
map_rel' : β {n} (r : L.Relations n) (x), RelMap r x β RelMap r (toFun β x) := by
-- Porting note: see porting note on `Hom.map_fun'`
intros; trivial
#align first_order.language.hom FirstOrder.Language.Hom
@[inherit_doc]
scoped[FirstOrder] notation:25 A " β[" L "] " B => FirstOrder.Language.Hom L A B
structure Embedding extends M βͺ N where
map_fun' : β {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun β x) := by
-- Porting note: see porting note on `Hom.map_fun'`
intros; trivial
map_rel' : β {n} (r : L.Relations n) (x), RelMap r (toFun β x) β RelMap r x := by
-- Porting note: see porting note on `Hom.map_fun'`
intros; trivial
#align first_order.language.embedding FirstOrder.Language.Embedding
@[inherit_doc]
scoped[FirstOrder] notation:25 A " βͺ[" L "] " B => FirstOrder.Language.Embedding L A B
structure Equiv extends M β N where
map_fun' : β {n} (f : L.Functions n) (x), toFun (funMap f x) = funMap f (toFun β x) := by
-- Porting note: see porting note on `Hom.map_fun'`
intros; trivial
map_rel' : β {n} (r : L.Relations n) (x), RelMap r (toFun β x) β RelMap r x := by
-- Porting note: see porting note on `Hom.map_fun'`
intros; trivial
#align first_order.language.equiv FirstOrder.Language.Equiv
@[inherit_doc]
scoped[FirstOrder] notation:25 A " β[" L "] " B => FirstOrder.Language.Equiv L A B
-- Porting note: was [L.Structure P] and [L.Structure Q]
-- The former reported an error.
variable {L M N} {P : Type*} [Structure L P] {Q : Type*} [Structure L Q]
-- Porting note (#11445): new definition
@[coe]
def constantMap (c : L.Constants) : M := funMap c default
instance : CoeTC L.Constants M :=
β¨constantMapβ©
theorem funMap_eq_coe_constants {c : L.Constants} {x : Fin 0 β M} : funMap c x = c :=
congr rfl (funext finZeroElim)
#align first_order.language.fun_map_eq_coe_constants FirstOrder.Language.funMap_eq_coe_constants
theorem nonempty_of_nonempty_constants [h : Nonempty L.Constants] : Nonempty M :=
h.map (β)
#align first_order.language.nonempty_of_nonempty_constants FirstOrder.Language.nonempty_of_nonempty_constants
def funMapβ {c fβ fβ : Type u} {rβ rβ : Type v} (c' : c β M) (fβ' : fβ β M β M)
(fβ' : fβ β M β M β M) : β {n}, (Language.mkβ c fβ fβ rβ rβ).Functions n β (Fin n β M) β M
| 0, f, _ => c' f
| 1, f, x => fβ' f (x 0)
| 2, f, x => fβ' f (x 0) (x 1)
| _ + 3, f, _ => PEmpty.elim f
#align first_order.language.fun_mapβ FirstOrder.Language.funMapβ
def RelMapβ {c fβ fβ : Type u} {rβ rβ : Type v} (rβ' : rβ β Set M) (rβ' : rβ β M β M β Prop) :
β {n}, (Language.mkβ c fβ fβ rβ rβ).Relations n β (Fin n β M) β Prop
| 0, r, _ => PEmpty.elim r
| 1, r, x => x 0 β rβ' r
| 2, r, x => rβ' r (x 0) (x 1)
| _ + 3, r, _ => PEmpty.elim r
#align first_order.language.rel_mapβ FirstOrder.Language.RelMapβ
protected def Structure.mkβ {c fβ fβ : Type u} {rβ rβ : Type v} (c' : c β M) (fβ' : fβ β M β M)
(fβ' : fβ β M β M β M) (rβ' : rβ β Set M) (rβ' : rβ β M β M β Prop) :
(Language.mkβ c fβ fβ rβ rβ).Structure M :=
β¨funMapβ c' fβ' fβ', RelMapβ rβ' rβ'β©
set_option linter.uppercaseLean3 false in
#align first_order.language.Structure.mkβ FirstOrder.Language.Structure.mkβ
class HomClass (L : outParam Language) (F M N : Type*)
[FunLike F M N] [L.Structure M] [L.Structure N] : Prop where
map_fun : β (Ο : F) {n} (f : L.Functions n) (x), Ο (funMap f x) = funMap f (Ο β x)
map_rel : β (Ο : F) {n} (r : L.Relations n) (x), RelMap r x β RelMap r (Ο β x)
#align first_order.language.hom_class FirstOrder.Language.HomClass
class StrongHomClass (L : outParam Language) (F M N : Type*)
[FunLike F M N] [L.Structure M] [L.Structure N] : Prop where
map_fun : β (Ο : F) {n} (f : L.Functions n) (x), Ο (funMap f x) = funMap f (Ο β x)
map_rel : β (Ο : F) {n} (r : L.Relations n) (x), RelMap r (Ο β x) β RelMap r x
#align first_order.language.strong_hom_class FirstOrder.Language.StrongHomClass
-- Porting note: using implicit brackets for `Structure` arguments
instance (priority := 100) StrongHomClass.homClass [L.Structure M]
[L.Structure N] [FunLike F M N] [StrongHomClass L F M N] : HomClass L F M N where
map_fun := StrongHomClass.map_fun
map_rel Ο _ R x := (StrongHomClass.map_rel Ο R x).2
#align first_order.language.strong_hom_class.hom_class FirstOrder.Language.StrongHomClass.homClass
theorem HomClass.strongHomClassOfIsAlgebraic [L.IsAlgebraic] {F M N} [L.Structure M] [L.Structure N]
[FunLike F M N] [HomClass L F M N] : StrongHomClass L F M N where
map_fun := HomClass.map_fun
map_rel _ n R _ := (IsAlgebraic.empty_relations n).elim R
#align first_order.language.hom_class.strong_hom_class_of_is_algebraic FirstOrder.Language.HomClass.strongHomClassOfIsAlgebraic
theorem HomClass.map_constants {F M N} [L.Structure M] [L.Structure N] [FunLike F M N]
[HomClass L F M N] (Ο : F) (c : L.Constants) : Ο c = c :=
(HomClass.map_fun Ο c default).trans (congr rfl (funext default))
#align first_order.language.hom_class.map_constants FirstOrder.Language.HomClass.map_constants
attribute [inherit_doc FirstOrder.Language.Hom.map_fun'] FirstOrder.Language.Embedding.map_fun'
FirstOrder.Language.HomClass.map_fun FirstOrder.Language.StrongHomClass.map_fun
FirstOrder.Language.Equiv.map_fun'
attribute [inherit_doc FirstOrder.Language.Hom.map_rel'] FirstOrder.Language.Embedding.map_rel'
FirstOrder.Language.HomClass.map_rel FirstOrder.Language.StrongHomClass.map_rel
FirstOrder.Language.Equiv.map_rel'
def HomClass.toHom {F M N} [L.Structure M] [L.Structure N] [FunLike F M N]
[HomClass L F M N] : F β M β[L] N := fun Ο =>
β¨Ο, HomClass.map_fun Ο, HomClass.map_rel Οβ©
#align first_order.language.hom_class.to_hom FirstOrder.Language.HomClass.toHom
namespace Embedding
instance funLike : FunLike (M βͺ[L] N) M N where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
congr
ext x
exact Function.funext_iff.1 h x
instance embeddingLike : EmbeddingLike (M βͺ[L] N) M N where
injective' f := f.toEmbedding.injective
#align first_order.language.embedding.embedding_like FirstOrder.Language.Embedding.embeddingLike
instance strongHomClass : StrongHomClass L (M βͺ[L] N) M N where
map_fun := map_fun'
map_rel := map_rel'
#align first_order.language.embedding.strong_hom_class FirstOrder.Language.Embedding.strongHomClass
#noalign first_order.language.embedding.has_coe_to_fun -- Porting note: replaced by funLike instance
@[simp]
theorem map_fun (Ο : M βͺ[L] N) {n : β} (f : L.Functions n) (x : Fin n β M) :
Ο (funMap f x) = funMap f (Ο β x) :=
HomClass.map_fun Ο f x
#align first_order.language.embedding.map_fun FirstOrder.Language.Embedding.map_fun
@[simp]
theorem map_constants (Ο : M βͺ[L] N) (c : L.Constants) : Ο c = c :=
HomClass.map_constants Ο c
#align first_order.language.embedding.map_constants FirstOrder.Language.Embedding.map_constants
@[simp]
theorem map_rel (Ο : M βͺ[L] N) {n : β} (r : L.Relations n) (x : Fin n β M) :
RelMap r (Ο β x) β RelMap r x :=
StrongHomClass.map_rel Ο r x
#align first_order.language.embedding.map_rel FirstOrder.Language.Embedding.map_rel
def toHom : (M βͺ[L] N) β M β[L] N :=
HomClass.toHom
#align first_order.language.embedding.to_hom FirstOrder.Language.Embedding.toHom
@[simp]
theorem coe_toHom {f : M βͺ[L] N} : (f.toHom : M β N) = f :=
rfl
#align first_order.language.embedding.coe_to_hom FirstOrder.Language.Embedding.coe_toHom
theorem coe_injective : @Function.Injective (M βͺ[L] N) (M β N) (β)
| f, g, h => by
cases f
cases g
congr
ext x
exact Function.funext_iff.1 h x
#align first_order.language.embedding.coe_injective FirstOrder.Language.Embedding.coe_injective
@[ext]
theorem ext β¦f g : M βͺ[L] Nβ¦ (h : β x, f x = g x) : f = g :=
coe_injective (funext h)
#align first_order.language.embedding.ext FirstOrder.Language.Embedding.ext
theorem ext_iff {f g : M βͺ[L] N} : f = g β β x, f x = g x :=
β¨fun h _ => h βΈ rfl, fun h => ext hβ©
#align first_order.language.embedding.ext_iff FirstOrder.Language.Embedding.ext_iff
theorem toHom_injective : @Function.Injective (M βͺ[L] N) (M β[L] N) (Β·.toHom) := by
intro f f' h
ext
exact congr_fun (congr_arg (β) h) _
@[simp]
theorem toHom_inj {f g : M βͺ[L] N} : f.toHom = g.toHom β f = g :=
β¨fun h β¦ toHom_injective h, fun h β¦ congr_arg (Β·.toHom) hβ©
theorem injective (f : M βͺ[L] N) : Function.Injective f :=
f.toEmbedding.injective
#align first_order.language.embedding.injective FirstOrder.Language.Embedding.injective
@[simps!]
def ofInjective [L.IsAlgebraic] {f : M β[L] N} (hf : Function.Injective f) : M βͺ[L] N :=
{ f with
inj' := hf
map_rel' := fun {_} r x => StrongHomClass.map_rel f r x }
#align first_order.language.embedding.of_injective FirstOrder.Language.Embedding.ofInjective
@[simp]
theorem coeFn_ofInjective [L.IsAlgebraic] {f : M β[L] N} (hf : Function.Injective f) :
(ofInjective hf : M β N) = f :=
rfl
#align first_order.language.embedding.coe_fn_of_injective FirstOrder.Language.Embedding.coeFn_ofInjective
@[simp]
| Mathlib/ModelTheory/Basic.lean | 698 | 700 | theorem ofInjective_toHom [L.IsAlgebraic] {f : M β[L] N} (hf : Function.Injective f) :
(ofInjective hf).toHom = f := by |
ext; simp
|
import Mathlib.Algebra.Group.Units.Hom
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.GroupWithZero.Hom
import Mathlib.GroupTheory.GroupAction.Units
#align_import algebra.group_with_zero.units.lemmas from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
assert_not_exists DenselyOrdered
variable {Ξ± Mβ Gβ Mβ' Gβ' F F' : Type*}
variable [MonoidWithZero Mβ]
section MonoidWithZero
variable [GroupWithZero Gβ] [Nontrivial Mβ] [MonoidWithZero Mβ'] [FunLike F Gβ Mβ]
[MonoidWithZeroHomClass F Gβ Mβ] [FunLike F' Gβ Mβ'] [MonoidWithZeroHomClass F' Gβ Mβ']
(f : F) {a : Gβ}
theorem map_ne_zero : f a β 0 β a β 0 :=
β¨fun hfa ha => hfa <| ha.symm βΈ map_zero f, fun ha => ((IsUnit.mk0 a ha).map f).ne_zeroβ©
#align map_ne_zero map_ne_zero
@[simp]
theorem map_eq_zero : f a = 0 β a = 0 :=
not_iff_not.1 (map_ne_zero f)
#align map_eq_zero map_eq_zero
| Mathlib/Algebra/GroupWithZero/Units/Lemmas.lean | 49 | 52 | theorem eq_on_invβ (f g : F') (h : f a = g a) : f aβ»ΒΉ = g aβ»ΒΉ := by |
rcases eq_or_ne a 0 with (rfl | ha)
Β· rw [inv_zero, map_zero, map_zero]
Β· exact (IsUnit.mk0 a ha).eq_on_inv f g h
|
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open scoped Classical MeasureTheory NNReal ENNReal
open TopologicalSpace MeasureTheory.Measure
noncomputable section
namespace MeasureTheory
variable {Ξ© E : Type*} [MeasurableSpace E]
class HasPDF {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) : Prop where
pdf' : AEMeasurable X β β§ (map X β).HaveLebesgueDecomposition ΞΌ β§ map X β βͺ ΞΌ
#align measure_theory.has_pdf MeasureTheory.HasPDF
def pdf {_ : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©) (ΞΌ : Measure E := by volume_tac) :
E β ββ₯0β :=
(map X β).rnDeriv ΞΌ
#align measure_theory.pdf MeasureTheory.pdf
theorem pdf_def {_ : MeasurableSpace Ξ©} {β : Measure Ξ©} {ΞΌ : Measure E} {X : Ξ© β E} :
pdf X β ΞΌ = (map X β).rnDeriv ΞΌ := rfl
theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ξ©} {β : Measure Ξ©} {ΞΌ : Measure E}
{X : Ξ© β E} (hX : Β¬AEMeasurable X β) : pdf X β ΞΌ =α΅[ΞΌ] 0 := by
rw [pdf_def, map_of_not_aemeasurable hX]
exact rnDeriv_zero ΞΌ
#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_of_not_aemeasurable
theorem pdf_of_not_haveLebesgueDecomposition {_ : MeasurableSpace Ξ©} {β : Measure Ξ©}
{ΞΌ : Measure E} {X : Ξ© β E} (h : Β¬(map X β).HaveLebesgueDecomposition ΞΌ) : pdf X β ΞΌ = 0 :=
rnDeriv_of_not_haveLebesgueDecomposition h
theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ξ©} {β : Measure Ξ©} {ΞΌ : Measure E}
(X : Ξ© β E) (h : Β¬pdf X β ΞΌ =α΅[ΞΌ] 0) : AEMeasurable X β := by
contrapose! h
exact pdf_of_not_aemeasurable h
#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.aemeasurable_of_pdf_ne_zero
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ξ©} {β : Measure Ξ©} {ΞΌ : Measure E} {X : Ξ© β E}
(hac : map X β βͺ ΞΌ) (hpdf : Β¬pdf X β ΞΌ =α΅[ΞΌ] 0) : HasPDF X β ΞΌ := by
refine β¨?_, ?_, hacβ©
Β· exact aemeasurable_of_pdf_ne_zero X hpdf
Β· contrapose! hpdf
have := pdf_of_not_haveLebesgueDecomposition hpdf
filter_upwards using congrFun this
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPDF_of_pdf_ne_zero
@[measurability]
theorem measurable_pdf {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) : Measurable (pdf X β ΞΌ) := by
exact measurable_rnDeriv _ _
#align measure_theory.measurable_pdf MeasureTheory.measurable_pdf
theorem withDensity_pdf_le_map {_ : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) : ΞΌ.withDensity (pdf X β ΞΌ) β€ map X β :=
withDensity_rnDeriv_le _ _
theorem set_lintegral_pdf_le_map {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) (s : Set E) :
β«β» x in s, pdf X β ΞΌ x βΞΌ β€ map X β s := by
apply (withDensity_apply_le _ s).trans
exact withDensity_pdf_le_map _ _ _ s
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) [hX : HasPDF X β ΞΌ] :
map X β = ΞΌ.withDensity (pdf X β ΞΌ) := by
rw [pdf_def, withDensity_rnDeriv_eq _ _ hX.absolutelyContinuous]
#align measure_theory.map_eq_with_density_pdf MeasureTheory.map_eq_withDensity_pdf
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ξ©} (X : Ξ© β E) (β : Measure Ξ©)
(ΞΌ : Measure E := by volume_tac) [hX : HasPDF X β ΞΌ] {s : Set E}
(hs : MeasurableSet s) : map X β s = β«β» x in s, pdf X β ΞΌ x βΞΌ := by
rw [β withDensity_apply _ hs, map_eq_withDensity_pdf X β ΞΌ]
#align measure_theory.map_eq_set_lintegral_pdf MeasureTheory.map_eq_set_lintegral_pdf
namespace pdf
variable {m : MeasurableSpace Ξ©} {β : Measure Ξ©} {ΞΌ : Measure E}
protected theorem congr {X Y : Ξ© β E} (hXY : X =α΅[β] Y) : pdf X β ΞΌ = pdf Y β ΞΌ := by
rw [pdf_def, pdf_def, map_congr hXY]
| Mathlib/Probability/Density.lean | 202 | 205 | theorem lintegral_eq_measure_univ {X : Ξ© β E} [HasPDF X β ΞΌ] :
β«β» x, pdf X β ΞΌ x βΞΌ = β Set.univ := by |
rw [β set_lintegral_univ, β map_eq_set_lintegral_pdf X β ΞΌ MeasurableSet.univ,
map_apply_of_aemeasurable (HasPDF.aemeasurable X β ΞΌ) MeasurableSet.univ, Set.preimage_univ]
|
import Mathlib.CategoryTheory.Sites.Subsheaf
import Mathlib.CategoryTheory.Sites.CompatibleSheafification
import Mathlib.CategoryTheory.Sites.LocallyInjective
#align_import category_theory.sites.surjective from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u w v' u' w'
open Opposite CategoryTheory CategoryTheory.GrothendieckTopology
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike
variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A]
namespace Presheaf
@[simps (config := .lemmasOnly)]
def imageSieve {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : C} (s : G.obj (op U)) : Sieve U where
arrows V i := β t : F.obj (op V), f.app _ t = G.map i.op s
downward_closed := by
rintro V W i β¨t, htβ© j
refine β¨F.map j.op t, ?_β©
rw [op_comp, G.map_comp, comp_apply, β ht, elementwise_of% f.naturality]
#align category_theory.image_sieve CategoryTheory.Presheaf.imageSieve
theorem imageSieve_eq_sieveOfSection {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : C} (s : G.obj (op U)) :
imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s :=
rfl
#align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.Presheaf.imageSieve_eq_sieveOfSection
theorem imageSieve_whisker_forget {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : C} (s : G.obj (op U)) :
imageSieve (whiskerRight f (forget A)) s = imageSieve f s :=
rfl
#align category_theory.image_sieve_whisker_forget CategoryTheory.Presheaf.imageSieve_whisker_forget
theorem imageSieve_app {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : C} (s : F.obj (op U)) :
imageSieve f (f.app _ s) = β€ := by
ext V i
simp only [Sieve.top_apply, iff_true_iff, imageSieve_apply]
have := elementwise_of% (f.naturality i.op)
exact β¨F.map i.op s, this sβ©
#align category_theory.image_sieve_app CategoryTheory.Presheaf.imageSieve_app
noncomputable def localPreimage {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : Cα΅α΅} (s : G.obj U)
{V : C} (g : V βΆ U.unop) (hg : imageSieve f s g) :
F.obj (op V) :=
hg.choose
@[simp]
lemma app_localPreimage {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) {U : Cα΅α΅} (s : G.obj U)
{V : C} (g : V βΆ U.unop) (hg : imageSieve f s g) :
f.app _ (localPreimage f s g hg) = G.map g.op s :=
hg.choose_spec
class IsLocallySurjective {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) : Prop where
imageSieve_mem {U : C} (s : G.obj (op U)) : imageSieve f s β J U
#align category_theory.is_locally_surjective CategoryTheory.Presheaf.IsLocallySurjective
lemma imageSieve_mem {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) [IsLocallySurjective J f] {U : Cα΅α΅}
(s : G.obj U) : imageSieve f s β J U.unop :=
IsLocallySurjective.imageSieve_mem _
instance {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) [IsLocallySurjective J f] :
IsLocallySurjective J (whiskerRight f (forget A)) where
imageSieve_mem s := imageSieve_mem J f s
| Mathlib/CategoryTheory/Sites/LocallySurjective.lean | 101 | 105 | theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cα΅α΅ β₯€ A} (f : F βΆ G) :
IsLocallySurjective J f β (imagePresheaf (whiskerRight f (forget A))).sheafify J = β€ := by |
simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj,
Set.top_eq_univ, Set.mem_univ, iff_true_iff]
exact β¨fun H _ => H.imageSieve_mem, fun H => β¨H _β©β©
|
import Mathlib.FieldTheory.Minpoly.Field
#align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f"
open Polynomial
open Polynomial
variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S]
variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B]
variable {K : Type*} [Field K]
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where
gen : S
dim : β
basis : Basis (Fin dim) R S
basis_eq_pow : β (i), basis i = gen ^ (i : β)
#align power_basis PowerBasis
-- this is usually not needed because of `basis_eq_pow` but can be needed in some cases;
-- in such circumstances, add it manually using `@[simps dim gen basis]`.
initialize_simps_projections PowerBasis (-basis)
namespace PowerBasis
@[simp]
theorem coe_basis (pb : PowerBasis R S) : βpb.basis = fun i : Fin pb.dim => pb.gen ^ (i : β) :=
funext pb.basis_eq_pow
#align power_basis.coe_basis PowerBasis.coe_basis
theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis
#align power_basis.finite_dimensional PowerBasis.finite
@[deprecated] alias finiteDimensional := PowerBasis.finite
theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) :
FiniteDimensional.finrank R S = pb.dim := by
rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin]
#align power_basis.finrank PowerBasis.finrank
theorem mem_span_pow' {x y : S} {d : β} :
y β Submodule.span R (Set.range fun i : Fin d => x ^ (i : β)) β
β f : R[X], f.degree < d β§ y = aeval x f := by
have : (Set.range fun i : Fin d => x ^ (i : β)) = (fun i : β => x ^ i) '' β(Finset.range d) := by
ext n
simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range]
exact β¨fun β¨β¨i, hiβ©, hyβ© => β¨i, hi, hyβ©, fun β¨i, hi, hyβ© => β¨β¨i, hiβ©, hyβ©β©
simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support,
exists_iff_exists_finsupp, coeff, aeval_def, evalβRingHom', evalβ_eq_sum, Polynomial.sum,
Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, evalβ_zero, exists_prop,
LinearMap.id_coe, evalβ_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight,
Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe]
simp_rw [@eq_comm _ y]
exact Iff.rfl
#align power_basis.mem_span_pow' PowerBasis.mem_span_pow'
theorem mem_span_pow {x y : S} {d : β} (hd : d β 0) :
y β Submodule.span R (Set.range fun i : Fin d => x ^ (i : β)) β
β f : R[X], f.natDegree < d β§ y = aeval x f := by
rw [mem_span_pow']
constructor <;>
Β· rintro β¨f, h, hyβ©
refine β¨f, ?_, hyβ©
by_cases hf : f = 0
Β· simp only [hf, natDegree_zero, degree_zero] at h β’
first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d
simp_all only [degree_eq_natDegree hf]
Β· first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h
#align power_basis.mem_span_pow PowerBasis.mem_span_pow
theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim β 0 := fun h =>
not_nonempty_iff.mpr (h.symm βΈ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty
#align power_basis.dim_ne_zero PowerBasis.dim_ne_zero
theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim :=
Nat.pos_of_ne_zero pb.dim_ne_zero
#align power_basis.dim_pos PowerBasis.dim_pos
theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) :
β f : R[X], f.natDegree < pb.dim β§ y = aeval pb.gen f :=
(mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y)
#align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval
| Mathlib/RingTheory/PowerBasis.lean | 132 | 135 | theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : β f : R[X], y = aeval pb.gen f := by |
nontriviality S
obtain β¨f, _, hfβ© := exists_eq_aeval pb y
exact β¨f, hfβ©
|
import Mathlib.Algebra.Lie.OfAssociative
import Mathlib.Algebra.Lie.IdealOperations
#align_import algebra.lie.abelian from "leanprover-community/mathlib"@"8983bec7cdf6cb2dd1f21315c8a34ab00d7b2f6d"
universe u v w wβ wβ
class LieModule.IsTrivial (L : Type v) (M : Type w) [Bracket L M] [Zero M] : Prop where
trivial : β (x : L) (m : M), β
x, mβ = 0
#align lie_module.is_trivial LieModule.IsTrivial
@[simp]
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
(x : L) (m : M) : β
x, mβ = 0 :=
LieModule.IsTrivial.trivial x m
#align trivial_lie_zero trivial_lie_zero
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=
β¨fun x m β¦ by rw [Subsingleton.eq_zero x, zero_lie]β©
instance LieModule.instIsTrivialOfSubsingleton' {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton M] : LieModule.IsTrivial L M :=
β¨fun x m β¦ by simp_rw [Subsingleton.eq_zero m, lie_zero]β©
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=
LieModule.IsTrivial L L
#align is_lie_abelian IsLieAbelian
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
[LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
trivial x y := by apply h.trivial
#align lie_ideal.is_lie_abelian_of_trivial LieIdeal.isLieAbelian_of_trivial
theorem Function.Injective.isLieAbelian {R : Type u} {Lβ : Type v} {Lβ : Type w} [CommRing R]
[LieRing Lβ] [LieRing Lβ] [LieAlgebra R Lβ] [LieAlgebra R Lβ] {f : Lβ βββ
Rβ Lβ}
(hβ : Function.Injective f) (_ : IsLieAbelian Lβ) : IsLieAbelian Lβ :=
{ trivial := fun x y => hβ <|
calc
f β
x, yβ = β
f x, f yβ := LieHom.map_lie f x y
_ = 0 := trivial_lie_zero _ _ _ _
_ = f 0 := f.map_zero.symm}
#align function.injective.is_lie_abelian Function.Injective.isLieAbelian
theorem Function.Surjective.isLieAbelian {R : Type u} {Lβ : Type v} {Lβ : Type w} [CommRing R]
[LieRing Lβ] [LieRing Lβ] [LieAlgebra R Lβ] [LieAlgebra R Lβ] {f : Lβ βββ
Rβ Lβ}
(hβ : Function.Surjective f) (hβ : IsLieAbelian Lβ) : IsLieAbelian Lβ :=
{ trivial := fun x y => by
obtain β¨u, rflβ© := hβ x
obtain β¨v, rflβ© := hβ y
rw [β LieHom.map_lie, trivial_lie_zero, LieHom.map_zero] }
#align function.surjective.is_lie_abelian Function.Surjective.isLieAbelian
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {Lβ : Type v} {Lβ : Type w} [CommRing R]
[LieRing Lβ] [LieRing Lβ] [LieAlgebra R Lβ] [LieAlgebra R Lβ] (e : Lβ βββ
Rβ Lβ) :
IsLieAbelian Lβ β IsLieAbelian Lβ :=
β¨e.symm.injective.isLieAbelian, e.injective.isLieAbelianβ©
#align lie_abelian_iff_equiv_lie_abelian lie_abelian_iff_equiv_lie_abelian
theorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :
Std.Commutative (Ξ± := A) (Β· * Β·) β IsLieAbelian A := by
have hβ : Std.Commutative (Ξ± := A) (Β· * Β·) β β a b : A, a * b = b * a :=
β¨fun h => h.1, fun h => β¨hβ©β©
have hβ : IsLieAbelian A β β a b : A, β
a, bβ = 0 := β¨fun h => h.1, fun h => β¨hβ©β©
simp only [hβ, hβ, LieRing.of_associative_ring_bracket, sub_eq_zero]
#align commutative_ring_iff_abelian_lie_ring commutative_ring_iff_abelian_lie_ring
section Center
variable (R : Type u) (L : Type v) (M : Type w) (N : Type wβ)
variable [CommRing R] [LieRing L] [LieAlgebra R L]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
variable [AddCommGroup N] [Module R N] [LieRingModule L N] [LieModule R L N]
section IdealOperations
open LieSubmodule LieSubalgebra
variable {R : Type u} {L : Type v} {M : Type w}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L)
@[simp]
theorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : β
I, Nβ = β₯ := by
suffices β
I, Nβ β€ β₯ from le_bot_iff.mp this
rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]
rintro m β¨x, n, hβ©; rw [trivial_lie_zero] at h; simp [β h]
#align lie_submodule.trivial_lie_oper_zero LieSubmodule.trivial_lie_oper_zero
| Mathlib/Algebra/Lie/Abelian.lean | 318 | 326 | theorem LieSubmodule.lie_abelian_iff_lie_self_eq_bot : IsLieAbelian I β β
I, Iβ = β₯ := by |
simp only [_root_.eq_bot_iff, lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le,
LieSubmodule.bot_coe, Set.subset_singleton_iff, Set.mem_setOf_eq, exists_imp]
refine
β¨fun h z x y hz =>
hz.symm.trans
(((I : LieSubalgebra R L).coe_bracket x y).symm.trans
((coe_zero_iff_zero _ _).mpr (by apply h.trivial))),
fun h => β¨fun x y => ((I : LieSubalgebra R L).coe_zero_iff_zero _).mp (h _ x y rfl)β©β©
|
import Mathlib.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Exponential
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
assert_not_exists Absorbs
noncomputable section
namespace Complex
variable {z : β}
open ComplexConjugate Topology Filter
instance : Norm β :=
β¨absβ©
@[simp]
theorem norm_eq_abs (z : β) : βzβ = abs z :=
rfl
#align complex.norm_eq_abs Complex.norm_eq_abs
lemma norm_I : βIβ = 1 := abs_I
theorem norm_exp_ofReal_mul_I (t : β) : βexp (t * I)β = 1 := by
simp only [norm_eq_abs, abs_exp_ofReal_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I
instance instNormedAddCommGroup : NormedAddCommGroup β :=
AddGroupNorm.toNormedAddCommGroup
{ abs with
map_zero' := map_zero abs
neg' := abs.map_neg
eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 }
instance : NormedField β where
dist_eq _ _ := rfl
norm_mul' := map_mul abs
instance : DenselyNormedField β where
lt_norm_lt rβ rβ hβ hr :=
let β¨x, hβ© := exists_between hr
β¨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (hβ.trans_lt h.1)]β©
instance {R : Type*} [NormedField R] [NormedAlgebra R β] : NormedAlgebra R β where
norm_smul_le r x := by
rw [β algebraMap_smul β r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, β Real.norm_eq_abs,
norm_algebraMap']
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace β E]
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace β E :=
NormedSpace.restrictScalars β β E
#align normed_space.complex_to_real NormedSpace.complexToReal
-- see Note [lower instance priority]
instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A]
[NormedAlgebra β A] : NormedAlgebra β A :=
NormedAlgebra.restrictScalars β β A
theorem dist_eq (z w : β) : dist z w = abs (z - w) :=
rfl
#align complex.dist_eq Complex.dist_eq
theorem dist_eq_re_im (z w : β) : dist z w = β((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
rw [sq, sq]
rfl
#align complex.dist_eq_re_im Complex.dist_eq_re_im
@[simp]
theorem dist_mk (xβ yβ xβ yβ : β) :
dist (mk xβ yβ) (mk xβ yβ) = β((xβ - xβ) ^ 2 + (yβ - yβ) ^ 2) :=
dist_eq_re_im _ _
#align complex.dist_mk Complex.dist_mk
theorem dist_of_re_eq {z w : β} (h : z.re = w.re) : dist z w = dist z.im w.im := by
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq]
#align complex.dist_of_re_eq Complex.dist_of_re_eq
theorem nndist_of_re_eq {z w : β} (h : z.re = w.re) : nndist z w = nndist z.im w.im :=
NNReal.eq <| dist_of_re_eq h
#align complex.nndist_of_re_eq Complex.nndist_of_re_eq
theorem edist_of_re_eq {z w : β} (h : z.re = w.re) : edist z w = edist z.im w.im := by
rw [edist_nndist, edist_nndist, nndist_of_re_eq h]
#align complex.edist_of_re_eq Complex.edist_of_re_eq
theorem dist_of_im_eq {z w : β} (h : z.im = w.im) : dist z w = dist z.re w.re := by
rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, add_zero, Real.sqrt_sq_eq_abs, Real.dist_eq]
#align complex.dist_of_im_eq Complex.dist_of_im_eq
theorem nndist_of_im_eq {z w : β} (h : z.im = w.im) : nndist z w = nndist z.re w.re :=
NNReal.eq <| dist_of_im_eq h
#align complex.nndist_of_im_eq Complex.nndist_of_im_eq
theorem edist_of_im_eq {z w : β} (h : z.im = w.im) : edist z w = edist z.re w.re := by
rw [edist_nndist, edist_nndist, nndist_of_im_eq h]
#align complex.edist_of_im_eq Complex.edist_of_im_eq
theorem dist_conj_self (z : β) : dist (conj z) z = 2 * |z.im| := by
rw [dist_of_re_eq (conj_re z), conj_im, dist_comm, Real.dist_eq, sub_neg_eq_add, β two_mul,
_root_.abs_mul, abs_of_pos (zero_lt_two' β)]
#align complex.dist_conj_self Complex.dist_conj_self
theorem nndist_conj_self (z : β) : nndist (conj z) z = 2 * Real.nnabs z.im :=
NNReal.eq <| by rw [β dist_nndist, NNReal.coe_mul, NNReal.coe_two, Real.coe_nnabs, dist_conj_self]
#align complex.nndist_conj_self Complex.nndist_conj_self
theorem dist_self_conj (z : β) : dist z (conj z) = 2 * |z.im| := by rw [dist_comm, dist_conj_self]
#align complex.dist_self_conj Complex.dist_self_conj
theorem nndist_self_conj (z : β) : nndist z (conj z) = 2 * Real.nnabs z.im := by
rw [nndist_comm, nndist_conj_self]
#align complex.nndist_self_conj Complex.nndist_self_conj
@[simp 1100]
theorem comap_abs_nhds_zero : comap abs (π 0) = π 0 :=
comap_norm_nhds_zero
#align complex.comap_abs_nhds_zero Complex.comap_abs_nhds_zero
theorem norm_real (r : β) : β(r : β)β = βrβ :=
abs_ofReal _
#align complex.norm_real Complex.norm_real
@[simp 1100]
theorem norm_rat (r : β) : β(r : β)β = |(r : β)| := by
rw [β ofReal_ratCast]
exact norm_real _
#align complex.norm_rat Complex.norm_rat
@[simp 1100]
theorem norm_nat (n : β) : β(n : β)β = n :=
abs_natCast _
#align complex.norm_nat Complex.norm_nat
@[simp 1100]
lemma norm_int {n : β€} : β(n : β)β = |(n : β)| := abs_intCast n
#align complex.norm_int Complex.norm_int
theorem norm_int_of_nonneg {n : β€} (hn : 0 β€ n) : β(n : β)β = n := by
rw [norm_int, β Int.cast_abs, _root_.abs_of_nonneg hn]
#align complex.norm_int_of_nonneg Complex.norm_int_of_nonneg
lemma normSq_eq_norm_sq (z : β) : normSq z = βzβ ^ 2 := by
rw [normSq_eq_abs, norm_eq_abs]
@[continuity]
theorem continuous_abs : Continuous abs :=
continuous_norm
#align complex.continuous_abs Complex.continuous_abs
@[continuity]
theorem continuous_normSq : Continuous normSq := by
simpa [β normSq_eq_abs] using continuous_abs.pow 2
#align complex.continuous_norm_sq Complex.continuous_normSq
@[simp, norm_cast]
theorem nnnorm_real (r : β) : β(r : β)ββ = βrββ :=
Subtype.ext <| norm_real r
#align complex.nnnorm_real Complex.nnnorm_real
@[simp, norm_cast]
theorem nnnorm_nat (n : β) : β(n : β)ββ = n :=
Subtype.ext <| by simp
#align complex.nnnorm_nat Complex.nnnorm_nat
@[simp, norm_cast]
theorem nnnorm_int (n : β€) : β(n : β)ββ = βnββ :=
Subtype.ext norm_int
#align complex.nnnorm_int Complex.nnnorm_int
theorem nnnorm_eq_one_of_pow_eq_one {ΞΆ : β} {n : β} (h : ΞΆ ^ n = 1) (hn : n β 0) : βΞΆββ = 1 :=
(pow_left_inj zero_le' zero_le' hn).1 <| by rw [β nnnorm_pow, h, nnnorm_one, one_pow]
#align complex.nnnorm_eq_one_of_pow_eq_one Complex.nnnorm_eq_one_of_pow_eq_one
theorem norm_eq_one_of_pow_eq_one {ΞΆ : β} {n : β} (h : ΞΆ ^ n = 1) (hn : n β 0) : βΞΆβ = 1 :=
congr_arg Subtype.val (nnnorm_eq_one_of_pow_eq_one h hn)
#align complex.norm_eq_one_of_pow_eq_one Complex.norm_eq_one_of_pow_eq_one
theorem equivRealProd_apply_le (z : β) : βequivRealProd zβ β€ abs z := by
simp [Prod.norm_def, abs_re_le_abs, abs_im_le_abs]
#align complex.equiv_real_prod_apply_le Complex.equivRealProd_apply_le
theorem equivRealProd_apply_le' (z : β) : βequivRealProd zβ β€ 1 * abs z := by
simpa using equivRealProd_apply_le z
#align complex.equiv_real_prod_apply_le' Complex.equivRealProd_apply_le'
theorem lipschitz_equivRealProd : LipschitzWith 1 equivRealProd := by
simpa using AddMonoidHomClass.lipschitz_of_bound equivRealProdLm 1 equivRealProd_apply_le'
#align complex.lipschitz_equiv_real_prod Complex.lipschitz_equivRealProd
theorem antilipschitz_equivRealProd : AntilipschitzWith (NNReal.sqrt 2) equivRealProd :=
AddMonoidHomClass.antilipschitz_of_bound equivRealProdLm fun z β¦ by
simpa only [Real.coe_sqrt, NNReal.coe_ofNat] using abs_le_sqrt_two_mul_max z
#align complex.antilipschitz_equiv_real_prod Complex.antilipschitz_equivRealProd
theorem uniformEmbedding_equivRealProd : UniformEmbedding equivRealProd :=
antilipschitz_equivRealProd.uniformEmbedding lipschitz_equivRealProd.uniformContinuous
#align complex.uniform_embedding_equiv_real_prod Complex.uniformEmbedding_equivRealProd
instance : CompleteSpace β :=
(completeSpace_congr uniformEmbedding_equivRealProd).mpr inferInstance
instance instT2Space : T2Space β := TopologicalSpace.t2Space_of_metrizableSpace
@[simps! (config := { simpRhs := true }) apply symm_apply_re symm_apply_im]
def equivRealProdCLM : β βL[β] β Γ β :=
equivRealProdLm.toContinuousLinearEquivOfBounds 1 (β2) equivRealProd_apply_le' fun p =>
abs_le_sqrt_two_mul_max (equivRealProd.symm p)
#align complex.equiv_real_prod_clm Complex.equivRealProdCLM
theorem equivRealProdCLM_symm_apply (p : β Γ β) :
Complex.equivRealProdCLM.symm p = p.1 + p.2 * Complex.I := Complex.equivRealProd_symm_apply p
instance : ProperSpace β :=
(id lipschitz_equivRealProd : LipschitzWith 1 equivRealProdCLM.toHomeomorph).properSpace
theorem tendsto_abs_cocompact_atTop : Tendsto abs (cocompact β) atTop :=
tendsto_norm_cocompact_atTop
#align complex.tendsto_abs_cocompact_at_top Complex.tendsto_abs_cocompact_atTop
theorem tendsto_normSq_cocompact_atTop : Tendsto normSq (cocompact β) atTop := by
simpa [mul_self_abs]
using tendsto_abs_cocompact_atTop.atTop_mul_atTop tendsto_abs_cocompact_atTop
#align complex.tendsto_norm_sq_cocompact_at_top Complex.tendsto_normSq_cocompact_atTop
open ContinuousLinearMap
def reCLM : β βL[β] β :=
reLm.mkContinuous 1 fun x => by simp [abs_re_le_abs]
#align complex.re_clm Complex.reCLM
@[continuity, fun_prop]
theorem continuous_re : Continuous re :=
reCLM.continuous
#align complex.continuous_re Complex.continuous_re
@[simp]
theorem reCLM_coe : (reCLM : β ββ[β] β) = reLm :=
rfl
#align complex.re_clm_coe Complex.reCLM_coe
@[simp]
theorem reCLM_apply (z : β) : (reCLM : β β β) z = z.re :=
rfl
#align complex.re_clm_apply Complex.reCLM_apply
def imCLM : β βL[β] β :=
imLm.mkContinuous 1 fun x => by simp [abs_im_le_abs]
#align complex.im_clm Complex.imCLM
@[continuity, fun_prop]
theorem continuous_im : Continuous im :=
imCLM.continuous
#align complex.continuous_im Complex.continuous_im
@[simp]
theorem imCLM_coe : (imCLM : β ββ[β] β) = imLm :=
rfl
#align complex.im_clm_coe Complex.imCLM_coe
@[simp]
theorem imCLM_apply (z : β) : (imCLM : β β β) z = z.im :=
rfl
#align complex.im_clm_apply Complex.imCLM_apply
| Mathlib/Analysis/Complex/Basic.lean | 309 | 313 | theorem restrictScalars_one_smulRight' (x : E) :
ContinuousLinearMap.restrictScalars β ((1 : β βL[β] β).smulRight x : β βL[β] E) =
reCLM.smulRight x + I β’ imCLM.smulRight x := by |
ext β¨a, bβ©
simp [mk_eq_add_mul_I, mul_smul, smul_comm I b x]
|
import Mathlib.Data.Int.Bitwise
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.LinearAlgebra.Matrix.Symmetric
#align_import linear_algebra.matrix.zpow from "leanprover-community/mathlib"@"03fda9112aa6708947da13944a19310684bfdfcb"
open Matrix
namespace Matrix
variable {n' : Type*} [DecidableEq n'] [Fintype n'] {R : Type*} [CommRing R]
local notation "M" => Matrix n' n' R
noncomputable instance : DivInvMonoid M :=
{ show Monoid M by infer_instance, show Inv M by infer_instance with }
section ZPow
open Int
@[simp]
theorem one_zpow : β n : β€, (1 : M) ^ n = 1
| (n : β) => by rw [zpow_natCast, one_pow]
| -[n+1] => by rw [zpow_negSucc, one_pow, inv_one]
#align matrix.one_zpow Matrix.one_zpow
theorem zero_zpow : β z : β€, z β 0 β (0 : M) ^ z = 0
| (n : β), h => by
rw [zpow_natCast, zero_pow]
exact mod_cast h
| -[n+1], _ => by simp [zero_pow n.succ_ne_zero]
#align matrix.zero_zpow Matrix.zero_zpow
theorem zero_zpow_eq (n : β€) : (0 : M) ^ n = if n = 0 then 1 else 0 := by
split_ifs with h
Β· rw [h, zpow_zero]
Β· rw [zero_zpow _ h]
#align matrix.zero_zpow_eq Matrix.zero_zpow_eq
theorem inv_zpow (A : M) : β n : β€, Aβ»ΒΉ ^ n = (A ^ n)β»ΒΉ
| (n : β) => by rw [zpow_natCast, zpow_natCast, inv_pow']
| -[n+1] => by rw [zpow_negSucc, zpow_negSucc, inv_pow']
#align matrix.inv_zpow Matrix.inv_zpow
@[simp]
theorem zpow_neg_one (A : M) : A ^ (-1 : β€) = Aβ»ΒΉ := by
convert DivInvMonoid.zpow_neg' 0 A
simp only [zpow_one, Int.ofNat_zero, Int.ofNat_succ, zpow_eq_pow, zero_add]
#align matrix.zpow_neg_one Matrix.zpow_neg_one
#align matrix.zpow_coe_nat zpow_natCast
@[simp]
theorem zpow_neg_natCast (A : M) (n : β) : A ^ (-n : β€) = (A ^ n)β»ΒΉ := by
cases n
Β· simp
Β· exact DivInvMonoid.zpow_neg' _ _
#align matrix.zpow_neg_coe_nat Matrix.zpow_neg_natCast
@[deprecated (since := "2024-04-05")] alias zpow_neg_coe_nat := zpow_neg_natCast
theorem _root_.IsUnit.det_zpow {A : M} (h : IsUnit A.det) (n : β€) : IsUnit (A ^ n).det := by
cases' n with n n
Β· simpa using h.pow n
Β· simpa using h.pow n.succ
#align is_unit.det_zpow IsUnit.det_zpow
theorem isUnit_det_zpow_iff {A : M} {z : β€} : IsUnit (A ^ z).det β IsUnit A.det β¨ z = 0 := by
induction' z using Int.induction_on with z _ z _
Β· simp
Β· rw [β Int.ofNat_succ, zpow_natCast, det_pow, isUnit_pow_succ_iff, β Int.ofNat_zero,
Int.ofNat_inj]
simp
Β· rw [β neg_add', β Int.ofNat_succ, zpow_neg_natCast, isUnit_nonsing_inv_det_iff, det_pow,
isUnit_pow_succ_iff, neg_eq_zero, β Int.ofNat_zero, Int.ofNat_inj]
simp
#align matrix.is_unit_det_zpow_iff Matrix.isUnit_det_zpow_iff
theorem zpow_neg {A : M} (h : IsUnit A.det) : β n : β€, A ^ (-n) = (A ^ n)β»ΒΉ
| (n : β) => zpow_neg_natCast _ _
| -[n+1] => by
rw [zpow_negSucc, neg_negSucc, zpow_natCast, nonsing_inv_nonsing_inv]
rw [det_pow]
exact h.pow _
#align matrix.zpow_neg Matrix.zpow_neg
theorem inv_zpow' {A : M} (h : IsUnit A.det) (n : β€) : Aβ»ΒΉ ^ n = A ^ (-n) := by
rw [zpow_neg h, inv_zpow]
#align matrix.inv_zpow' Matrix.inv_zpow'
theorem zpow_add_one {A : M} (h : IsUnit A.det) : β n : β€, A ^ (n + 1) = A ^ n * A
| (n : β) => by simp only [β Nat.cast_succ, pow_succ, zpow_natCast]
| -[n+1] =>
calc
A ^ (-(n + 1) + 1 : β€) = (A ^ n)β»ΒΉ := by
rw [neg_add, neg_add_cancel_right, zpow_neg h, zpow_natCast]
_ = (A * A ^ n)β»ΒΉ * A := by
rw [mul_inv_rev, Matrix.mul_assoc, nonsing_inv_mul _ h, Matrix.mul_one]
_ = A ^ (-(n + 1 : β€)) * A := by
rw [zpow_neg h, β Int.ofNat_succ, zpow_natCast, pow_succ']
#align matrix.zpow_add_one Matrix.zpow_add_one
theorem zpow_sub_one {A : M} (h : IsUnit A.det) (n : β€) : A ^ (n - 1) = A ^ n * Aβ»ΒΉ :=
calc
A ^ (n - 1) = A ^ (n - 1) * A * Aβ»ΒΉ := by
rw [mul_assoc, mul_nonsing_inv _ h, mul_one]
_ = A ^ n * Aβ»ΒΉ := by rw [β zpow_add_one h, sub_add_cancel]
#align matrix.zpow_sub_one Matrix.zpow_sub_one
theorem zpow_add {A : M} (ha : IsUnit A.det) (m n : β€) : A ^ (m + n) = A ^ m * A ^ n := by
induction n using Int.induction_on with
| hz => simp
| hp n ihn => simp only [β add_assoc, zpow_add_one ha, ihn, mul_assoc]
| hn n ihn => rw [zpow_sub_one ha, β mul_assoc, β ihn, β zpow_sub_one ha, add_sub_assoc]
#align matrix.zpow_add Matrix.zpow_add
theorem zpow_add_of_nonpos {A : M} {m n : β€} (hm : m β€ 0) (hn : n β€ 0) :
A ^ (m + n) = A ^ m * A ^ n := by
rcases nonsing_inv_cancel_or_zero A with (β¨h, _β© | h)
Β· exact zpow_add (isUnit_det_of_left_inverse h) m n
Β· obtain β¨k, rflβ© := exists_eq_neg_ofNat hm
obtain β¨l, rflβ© := exists_eq_neg_ofNat hn
simp_rw [β neg_add, β Int.ofNat_add, zpow_neg_natCast, β inv_pow', h, pow_add]
#align matrix.zpow_add_of_nonpos Matrix.zpow_add_of_nonpos
theorem zpow_add_of_nonneg {A : M} {m n : β€} (hm : 0 β€ m) (hn : 0 β€ n) :
A ^ (m + n) = A ^ m * A ^ n := by
obtain β¨k, rflβ© := eq_ofNat_of_zero_le hm
obtain β¨l, rflβ© := eq_ofNat_of_zero_le hn
rw [β Int.ofNat_add, zpow_natCast, zpow_natCast, zpow_natCast, pow_add]
#align matrix.zpow_add_of_nonneg Matrix.zpow_add_of_nonneg
theorem zpow_one_add {A : M} (h : IsUnit A.det) (i : β€) : A ^ (1 + i) = A * A ^ i := by
rw [zpow_add h, zpow_one]
#align matrix.zpow_one_add Matrix.zpow_one_add
theorem SemiconjBy.zpow_right {A X Y : M} (hx : IsUnit X.det) (hy : IsUnit Y.det)
(h : SemiconjBy A X Y) : β m : β€, SemiconjBy A (X ^ m) (Y ^ m)
| (n : β) => by simp [h.pow_right n]
| -[n+1] => by
have hx' : IsUnit (X ^ n.succ).det := by
rw [det_pow]
exact hx.pow n.succ
have hy' : IsUnit (Y ^ n.succ).det := by
rw [det_pow]
exact hy.pow n.succ
rw [zpow_negSucc, zpow_negSucc, nonsing_inv_apply _ hx', nonsing_inv_apply _ hy', SemiconjBy]
refine (isRegular_of_isLeftRegular_det hy'.isRegular.left).left ?_
dsimp only
rw [β mul_assoc, β (h.pow_right n.succ).eq, mul_assoc, mul_smul,
mul_adjugate, β Matrix.mul_assoc,
mul_smul (Y ^ _) (βhy'.unitβ»ΒΉ : R), mul_adjugate, smul_smul, smul_smul, hx'.val_inv_mul,
hy'.val_inv_mul, one_smul, Matrix.mul_one, Matrix.one_mul]
#align matrix.semiconj_by.zpow_right Matrix.SemiconjBy.zpow_right
theorem Commute.zpow_right {A B : M} (h : Commute A B) (m : β€) : Commute A (B ^ m) := by
rcases nonsing_inv_cancel_or_zero B with (β¨hB, _β© | hB)
Β· refine SemiconjBy.zpow_right ?_ ?_ h _ <;> exact isUnit_det_of_left_inverse hB
Β· cases m
Β· simpa using h.pow_right _
Β· simp [β inv_pow', hB]
#align matrix.commute.zpow_right Matrix.Commute.zpow_right
theorem Commute.zpow_left {A B : M} (h : Commute A B) (m : β€) : Commute (A ^ m) B :=
(Commute.zpow_right h.symm m).symm
#align matrix.commute.zpow_left Matrix.Commute.zpow_left
theorem Commute.zpow_zpow {A B : M} (h : Commute A B) (m n : β€) : Commute (A ^ m) (B ^ n) :=
Commute.zpow_right (Commute.zpow_left h _) _
#align matrix.commute.zpow_zpow Matrix.Commute.zpow_zpow
theorem Commute.zpow_self (A : M) (n : β€) : Commute (A ^ n) A :=
Commute.zpow_left (Commute.refl A) _
#align matrix.commute.zpow_self Matrix.Commute.zpow_self
theorem Commute.self_zpow (A : M) (n : β€) : Commute A (A ^ n) :=
Commute.zpow_right (Commute.refl A) _
#align matrix.commute.self_zpow Matrix.Commute.self_zpow
theorem Commute.zpow_zpow_self (A : M) (m n : β€) : Commute (A ^ m) (A ^ n) :=
Commute.zpow_zpow (Commute.refl A) _ _
#align matrix.commute.zpow_zpow_self Matrix.Commute.zpow_zpow_self
set_option linter.deprecated false in
theorem zpow_bit0 (A : M) (n : β€) : A ^ bit0 n = A ^ n * A ^ n := by
rcases le_total 0 n with nonneg | nonpos
Β· exact zpow_add_of_nonneg nonneg nonneg
Β· exact zpow_add_of_nonpos nonpos nonpos
#align matrix.zpow_bit0 Matrix.zpow_bit0
theorem zpow_add_one_of_ne_neg_one {A : M} : β n : β€, n β -1 β A ^ (n + 1) = A ^ n * A
| (n : β), _ => by simp only [pow_succ, β Nat.cast_succ, zpow_natCast]
| -1, h => absurd rfl h
| -((n : β) + 2), _ => by
rcases nonsing_inv_cancel_or_zero A with (β¨h, _β© | h)
Β· apply zpow_add_one (isUnit_det_of_left_inverse h)
Β· show A ^ (-((n + 1 : β) : β€)) = A ^ (-((n + 2 : β) : β€)) * A
simp_rw [zpow_neg_natCast, β inv_pow', h, zero_pow $ Nat.succ_ne_zero _, zero_mul]
#align matrix.zpow_add_one_of_ne_neg_one Matrix.zpow_add_one_of_ne_neg_one
set_option linter.deprecated false in
theorem zpow_bit1 (A : M) (n : β€) : A ^ bit1 n = A ^ n * A ^ n * A := by
rw [bit1, zpow_add_one_of_ne_neg_one, zpow_bit0]
intro h
simpa using congr_arg bodd h
#align matrix.zpow_bit1 Matrix.zpow_bit1
theorem zpow_mul (A : M) (h : IsUnit A.det) : β m n : β€, A ^ (m * n) = (A ^ m) ^ n
| (m : β), (n : β) => by rw [zpow_natCast, zpow_natCast, β pow_mul, β zpow_natCast, Int.ofNat_mul]
| (m : β), -[n+1] => by
rw [zpow_natCast, zpow_negSucc, β pow_mul, ofNat_mul_negSucc, zpow_neg_natCast]
| -[m+1], (n : β) => by
rw [zpow_natCast, zpow_negSucc, β inv_pow', β pow_mul, negSucc_mul_ofNat, zpow_neg_natCast,
inv_pow']
| -[m+1], -[n+1] => by
rw [zpow_negSucc, zpow_negSucc, negSucc_mul_negSucc, β Int.ofNat_mul, zpow_natCast, inv_pow', β
pow_mul, nonsing_inv_nonsing_inv]
rw [det_pow]
exact h.pow _
#align matrix.zpow_mul Matrix.zpow_mul
theorem zpow_mul' (A : M) (h : IsUnit A.det) (m n : β€) : A ^ (m * n) = (A ^ n) ^ m := by
rw [mul_comm, zpow_mul _ h]
#align matrix.zpow_mul' Matrix.zpow_mul'
@[simp, norm_cast]
theorem coe_units_zpow (u : MΛ£) : β n : β€, ((u ^ n : MΛ£) : M) = (u : M) ^ n
| (n : β) => by rw [zpow_natCast, zpow_natCast, Units.val_pow_eq_pow_val]
| -[k+1] => by
rw [zpow_negSucc, zpow_negSucc, β inv_pow, uβ»ΒΉ.val_pow_eq_pow_val, β inv_pow', coe_units_inv]
#align matrix.coe_units_zpow Matrix.coe_units_zpow
theorem zpow_ne_zero_of_isUnit_det [Nonempty n'] [Nontrivial R] {A : M} (ha : IsUnit A.det)
(z : β€) : A ^ z β 0 := by
have := ha.det_zpow z
contrapose! this
rw [this, det_zero βΉ_βΊ]
exact not_isUnit_zero
#align matrix.zpow_ne_zero_of_is_unit_det Matrix.zpow_ne_zero_of_isUnit_det
theorem zpow_sub {A : M} (ha : IsUnit A.det) (z1 z2 : β€) : A ^ (z1 - z2) = A ^ z1 / A ^ z2 := by
rw [sub_eq_add_neg, zpow_add ha, zpow_neg ha, div_eq_mul_inv]
#align matrix.zpow_sub Matrix.zpow_sub
theorem Commute.mul_zpow {A B : M} (h : Commute A B) : β i : β€, (A * B) ^ i = A ^ i * B ^ i
| (n : β) => by simp [h.mul_pow n]
| -[n+1] => by
rw [zpow_negSucc, zpow_negSucc, zpow_negSucc, β mul_inv_rev,
h.mul_pow n.succ, (h.pow_pow _ _).eq]
#align matrix.commute.mul_zpow Matrix.Commute.mul_zpow
set_option linter.deprecated false in
theorem zpow_bit0' (A : M) (n : β€) : A ^ bit0 n = (A * A) ^ n :=
(zpow_bit0 A n).trans (Commute.mul_zpow (Commute.refl A) n).symm
#align matrix.zpow_bit0' Matrix.zpow_bit0'
set_option linter.deprecated false in
theorem zpow_bit1' (A : M) (n : β€) : A ^ bit1 n = (A * A) ^ n * A := by
rw [zpow_bit1, Commute.mul_zpow (Commute.refl A)]
#align matrix.zpow_bit1' Matrix.zpow_bit1'
theorem zpow_neg_mul_zpow_self (n : β€) {A : M} (h : IsUnit A.det) : A ^ (-n) * A ^ n = 1 := by
rw [zpow_neg h, nonsing_inv_mul _ (h.det_zpow _)]
#align matrix.zpow_neg_mul_zpow_self Matrix.zpow_neg_mul_zpow_self
| Mathlib/LinearAlgebra/Matrix/ZPow.lean | 325 | 325 | theorem one_div_pow {A : M} (n : β) : (1 / A) ^ n = 1 / A ^ n := by | simp only [one_div, inv_pow']
|
import Mathlib.Data.Option.NAry
import Mathlib.Data.Seq.Computation
#align_import data.seq.seq from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace Stream'
universe u v w
def IsSeq {Ξ± : Type u} (s : Stream' (Option Ξ±)) : Prop :=
β {n : β}, s n = none β s (n + 1) = none
#align stream.is_seq Stream'.IsSeq
def Seq (Ξ± : Type u) : Type u :=
{ f : Stream' (Option Ξ±) // f.IsSeq }
#align stream.seq Stream'.Seq
def Seq1 (Ξ±) :=
Ξ± Γ Seq Ξ±
#align stream.seq1 Stream'.Seq1
namespace Seq
variable {Ξ± : Type u} {Ξ² : Type v} {Ξ³ : Type w}
def nil : Seq Ξ± :=
β¨Stream'.const none, fun {_} _ => rflβ©
#align stream.seq.nil Stream'.Seq.nil
instance : Inhabited (Seq Ξ±) :=
β¨nilβ©
def cons (a : Ξ±) (s : Seq Ξ±) : Seq Ξ± :=
β¨some a::s.1, by
rintro (n | _) h
Β· contradiction
Β· exact s.2 hβ©
#align stream.seq.cons Stream'.Seq.cons
@[simp]
theorem val_cons (s : Seq Ξ±) (x : Ξ±) : (cons x s).val = some x::s.val :=
rfl
#align stream.seq.val_cons Stream'.Seq.val_cons
def get? : Seq Ξ± β β β Option Ξ± :=
Subtype.val
#align stream.seq.nth Stream'.Seq.get?
@[simp]
theorem get?_mk (f hf) : @get? Ξ± β¨f, hfβ© = f :=
rfl
#align stream.seq.nth_mk Stream'.Seq.get?_mk
@[simp]
theorem get?_nil (n : β) : (@nil Ξ±).get? n = none :=
rfl
#align stream.seq.nth_nil Stream'.Seq.get?_nil
@[simp]
theorem get?_cons_zero (a : Ξ±) (s : Seq Ξ±) : (cons a s).get? 0 = some a :=
rfl
#align stream.seq.nth_cons_zero Stream'.Seq.get?_cons_zero
@[simp]
theorem get?_cons_succ (a : Ξ±) (s : Seq Ξ±) (n : β) : (cons a s).get? (n + 1) = s.get? n :=
rfl
#align stream.seq.nth_cons_succ Stream'.Seq.get?_cons_succ
@[ext]
protected theorem ext {s t : Seq Ξ±} (h : β n : β, s.get? n = t.get? n) : s = t :=
Subtype.eq <| funext h
#align stream.seq.ext Stream'.Seq.ext
theorem cons_injective2 : Function.Injective2 (cons : Ξ± β Seq Ξ± β Seq Ξ±) := fun x y s t h =>
β¨by rw [β Option.some_inj, β get?_cons_zero, h, get?_cons_zero],
Seq.ext fun n => by simp_rw [β get?_cons_succ x s n, h, get?_cons_succ]β©
#align stream.seq.cons_injective2 Stream'.Seq.cons_injective2
theorem cons_left_injective (s : Seq Ξ±) : Function.Injective fun x => cons x s :=
cons_injective2.left _
#align stream.seq.cons_left_injective Stream'.Seq.cons_left_injective
theorem cons_right_injective (x : Ξ±) : Function.Injective (cons x) :=
cons_injective2.right _
#align stream.seq.cons_right_injective Stream'.Seq.cons_right_injective
def TerminatedAt (s : Seq Ξ±) (n : β) : Prop :=
s.get? n = none
#align stream.seq.terminated_at Stream'.Seq.TerminatedAt
instance terminatedAtDecidable (s : Seq Ξ±) (n : β) : Decidable (s.TerminatedAt n) :=
decidable_of_iff' (s.get? n).isNone <| by unfold TerminatedAt; cases s.get? n <;> simp
#align stream.seq.terminated_at_decidable Stream'.Seq.terminatedAtDecidable
def Terminates (s : Seq Ξ±) : Prop :=
β n : β, s.TerminatedAt n
#align stream.seq.terminates Stream'.Seq.Terminates
theorem not_terminates_iff {s : Seq Ξ±} : Β¬s.Terminates β β n, (s.get? n).isSome := by
simp only [Terminates, TerminatedAt, β Ne.eq_def, Option.ne_none_iff_isSome, not_exists, iff_self]
#align stream.seq.not_terminates_iff Stream'.Seq.not_terminates_iff
@[simp]
def omap (f : Ξ² β Ξ³) : Option (Ξ± Γ Ξ²) β Option (Ξ± Γ Ξ³)
| none => none
| some (a, b) => some (a, f b)
#align stream.seq.omap Stream'.Seq.omap
def head (s : Seq Ξ±) : Option Ξ± :=
get? s 0
#align stream.seq.head Stream'.Seq.head
def tail (s : Seq Ξ±) : Seq Ξ± :=
β¨s.1.tail, fun n' => by
cases' s with f al
exact al n'β©
#align stream.seq.tail Stream'.Seq.tail
protected def Mem (a : Ξ±) (s : Seq Ξ±) :=
some a β s.1
#align stream.seq.mem Stream'.Seq.Mem
instance : Membership Ξ± (Seq Ξ±) :=
β¨Seq.Memβ©
theorem le_stable (s : Seq Ξ±) {m n} (h : m β€ n) : s.get? m = none β s.get? n = none := by
cases' s with f al
induction' h with n _ IH
exacts [id, fun h2 => al (IH h2)]
#align stream.seq.le_stable Stream'.Seq.le_stable
theorem terminated_stable : β (s : Seq Ξ±) {m n : β}, m β€ n β s.TerminatedAt m β s.TerminatedAt n :=
le_stable
#align stream.seq.terminated_stable Stream'.Seq.terminated_stable
| Mathlib/Data/Seq/Seq.lean | 174 | 178 | theorem ge_stable (s : Seq Ξ±) {aβ : Ξ±} {n m : β} (m_le_n : m β€ n)
(s_nth_eq_some : s.get? n = some aβ) : β aβ : Ξ±, s.get? m = some aβ :=
have : s.get? n β none := by | simp [s_nth_eq_some]
have : s.get? m β none := mt (s.le_stable m_le_n) this
Option.ne_none_iff_exists'.mp this
|
import Mathlib.Order.Filter.Lift
import Mathlib.Topology.Defs.Filter
#align_import topology.basic from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40"
noncomputable section
open Set Filter
universe u v w x
def TopologicalSpace.ofClosed {X : Type u} (T : Set (Set X)) (empty_mem : β
β T)
(sInter_mem : β A, A β T β ββ A β T)
(union_mem : β A, A β T β β B, B β T β A βͺ B β T) : TopologicalSpace X where
IsOpen X := XαΆ β T
isOpen_univ := by simp [empty_mem]
isOpen_inter s t hs ht := by simpa only [compl_inter] using union_mem sαΆ hs tαΆ ht
isOpen_sUnion s hs := by
simp only [Set.compl_sUnion]
exact sInter_mem (compl '' s) fun z β¨y, hy, hzβ© => hz βΈ hs y hy
#align topological_space.of_closed TopologicalSpace.ofClosed
section TopologicalSpace
variable {X : Type u} {Y : Type v} {ΞΉ : Sort w} {Ξ± Ξ² : Type*}
{x : X} {s sβ sβ t : Set X} {p pβ pβ : X β Prop}
open Topology
lemma isOpen_mk {p hβ hβ hβ} : IsOpen[β¨p, hβ, hβ, hββ©] s β p s := Iff.rfl
#align is_open_mk isOpen_mk
@[ext]
protected theorem TopologicalSpace.ext :
β {f g : TopologicalSpace X}, IsOpen[f] = IsOpen[g] β f = g
| β¨_, _, _, _β©, β¨_, _, _, _β©, rfl => rfl
#align topological_space_eq TopologicalSpace.ext
section
variable [TopologicalSpace X]
end
protected theorem TopologicalSpace.ext_iff {t t' : TopologicalSpace X} :
t = t' β β s, IsOpen[t] s β IsOpen[t'] s :=
β¨fun h s => h βΈ Iff.rfl, fun h => by ext; exact h _β©
#align topological_space_eq_iff TopologicalSpace.ext_iff
theorem isOpen_fold {t : TopologicalSpace X} : t.IsOpen s = IsOpen[t] s :=
rfl
#align is_open_fold isOpen_fold
variable [TopologicalSpace X]
theorem isOpen_iUnion {f : ΞΉ β Set X} (h : β i, IsOpen (f i)) : IsOpen (β i, f i) :=
isOpen_sUnion (forall_mem_range.2 h)
#align is_open_Union isOpen_iUnion
theorem isOpen_biUnion {s : Set Ξ±} {f : Ξ± β Set X} (h : β i β s, IsOpen (f i)) :
IsOpen (β i β s, f i) :=
isOpen_iUnion fun i => isOpen_iUnion fun hi => h i hi
#align is_open_bUnion isOpen_biUnion
theorem IsOpen.union (hβ : IsOpen sβ) (hβ : IsOpen sβ) : IsOpen (sβ βͺ sβ) := by
rw [union_eq_iUnion]; exact isOpen_iUnion (Bool.forall_bool.2 β¨hβ, hββ©)
#align is_open.union IsOpen.union
lemma isOpen_iff_of_cover {f : Ξ± β Set X} (ho : β i, IsOpen (f i)) (hU : (β i, f i) = univ) :
IsOpen s β β i, IsOpen (f i β© s) := by
refine β¨fun h i β¦ (ho i).inter h, fun h β¦ ?_β©
rw [β s.inter_univ, inter_comm, β hU, iUnion_inter]
exact isOpen_iUnion fun i β¦ h i
@[simp] theorem isOpen_empty : IsOpen (β
: Set X) := by
rw [β sUnion_empty]; exact isOpen_sUnion fun a => False.elim
#align is_open_empty isOpen_empty
theorem Set.Finite.isOpen_sInter {s : Set (Set X)} (hs : s.Finite) :
(β t β s, IsOpen t) β IsOpen (ββ s) :=
Finite.induction_on hs (fun _ => by rw [sInter_empty]; exact isOpen_univ) fun _ _ ih h => by
simp only [sInter_insert, forall_mem_insert] at h β’
exact h.1.inter (ih h.2)
#align is_open_sInter Set.Finite.isOpen_sInter
theorem Set.Finite.isOpen_biInter {s : Set Ξ±} {f : Ξ± β Set X} (hs : s.Finite)
(h : β i β s, IsOpen (f i)) :
IsOpen (β i β s, f i) :=
sInter_image f s βΈ (hs.image _).isOpen_sInter (forall_mem_image.2 h)
#align is_open_bInter Set.Finite.isOpen_biInter
theorem isOpen_iInter_of_finite [Finite ΞΉ] {s : ΞΉ β Set X} (h : β i, IsOpen (s i)) :
IsOpen (β i, s i) :=
(finite_range _).isOpen_sInter (forall_mem_range.2 h)
#align is_open_Inter isOpen_iInter_of_finite
theorem isOpen_biInter_finset {s : Finset Ξ±} {f : Ξ± β Set X} (h : β i β s, IsOpen (f i)) :
IsOpen (β i β s, f i) :=
s.finite_toSet.isOpen_biInter h
#align is_open_bInter_finset isOpen_biInter_finset
@[simp] -- Porting note: added `simp`
theorem isOpen_const {p : Prop} : IsOpen { _x : X | p } := by by_cases p <;> simp [*]
#align is_open_const isOpen_const
theorem IsOpen.and : IsOpen { x | pβ x } β IsOpen { x | pβ x } β IsOpen { x | pβ x β§ pβ x } :=
IsOpen.inter
#align is_open.and IsOpen.and
@[simp] theorem isOpen_compl_iff : IsOpen sαΆ β IsClosed s :=
β¨fun h => β¨hβ©, fun h => h.isOpen_complβ©
#align is_open_compl_iff isOpen_compl_iff
theorem TopologicalSpace.ext_iff_isClosed {tβ tβ : TopologicalSpace X} :
tβ = tβ β β s, IsClosed[tβ] s β IsClosed[tβ] s := by
rw [TopologicalSpace.ext_iff, compl_surjective.forall]
simp only [@isOpen_compl_iff _ _ tβ, @isOpen_compl_iff _ _ tβ]
alias β¨_, TopologicalSpace.ext_isClosedβ© := TopologicalSpace.ext_iff_isClosed
-- Porting note (#10756): new lemma
theorem isClosed_const {p : Prop} : IsClosed { _x : X | p } := β¨isOpen_const (p := Β¬p)β©
@[simp] theorem isClosed_empty : IsClosed (β
: Set X) := isClosed_const
#align is_closed_empty isClosed_empty
@[simp] theorem isClosed_univ : IsClosed (univ : Set X) := isClosed_const
#align is_closed_univ isClosed_univ
theorem IsClosed.union : IsClosed sβ β IsClosed sβ β IsClosed (sβ βͺ sβ) := by
simpa only [β isOpen_compl_iff, compl_union] using IsOpen.inter
#align is_closed.union IsClosed.union
theorem isClosed_sInter {s : Set (Set X)} : (β t β s, IsClosed t) β IsClosed (ββ s) := by
simpa only [β isOpen_compl_iff, compl_sInter, sUnion_image] using isOpen_biUnion
#align is_closed_sInter isClosed_sInter
theorem isClosed_iInter {f : ΞΉ β Set X} (h : β i, IsClosed (f i)) : IsClosed (β i, f i) :=
isClosed_sInter <| forall_mem_range.2 h
#align is_closed_Inter isClosed_iInter
theorem isClosed_biInter {s : Set Ξ±} {f : Ξ± β Set X} (h : β i β s, IsClosed (f i)) :
IsClosed (β i β s, f i) :=
isClosed_iInter fun i => isClosed_iInter <| h i
#align is_closed_bInter isClosed_biInter
@[simp]
theorem isClosed_compl_iff {s : Set X} : IsClosed sαΆ β IsOpen s := by
rw [β isOpen_compl_iff, compl_compl]
#align is_closed_compl_iff isClosed_compl_iff
alias β¨_, IsOpen.isClosed_complβ© := isClosed_compl_iff
#align is_open.is_closed_compl IsOpen.isClosed_compl
theorem IsOpen.sdiff (hβ : IsOpen s) (hβ : IsClosed t) : IsOpen (s \ t) :=
IsOpen.inter hβ hβ.isOpen_compl
#align is_open.sdiff IsOpen.sdiff
theorem IsClosed.inter (hβ : IsClosed sβ) (hβ : IsClosed sβ) : IsClosed (sβ β© sβ) := by
rw [β isOpen_compl_iff] at *
rw [compl_inter]
exact IsOpen.union hβ hβ
#align is_closed.inter IsClosed.inter
theorem IsClosed.sdiff (hβ : IsClosed s) (hβ : IsOpen t) : IsClosed (s \ t) :=
IsClosed.inter hβ (isClosed_compl_iff.mpr hβ)
#align is_closed.sdiff IsClosed.sdiff
theorem Set.Finite.isClosed_biUnion {s : Set Ξ±} {f : Ξ± β Set X} (hs : s.Finite)
(h : β i β s, IsClosed (f i)) :
IsClosed (β i β s, f i) := by
simp only [β isOpen_compl_iff, compl_iUnion] at *
exact hs.isOpen_biInter h
#align is_closed_bUnion Set.Finite.isClosed_biUnion
lemma isClosed_biUnion_finset {s : Finset Ξ±} {f : Ξ± β Set X} (h : β i β s, IsClosed (f i)) :
IsClosed (β i β s, f i) :=
s.finite_toSet.isClosed_biUnion h
theorem isClosed_iUnion_of_finite [Finite ΞΉ] {s : ΞΉ β Set X} (h : β i, IsClosed (s i)) :
IsClosed (β i, s i) := by
simp only [β isOpen_compl_iff, compl_iUnion] at *
exact isOpen_iInter_of_finite h
#align is_closed_Union isClosed_iUnion_of_finite
theorem isClosed_imp {p q : X β Prop} (hp : IsOpen { x | p x }) (hq : IsClosed { x | q x }) :
IsClosed { x | p x β q x } := by
simpa only [imp_iff_not_or] using hp.isClosed_compl.union hq
#align is_closed_imp isClosed_imp
theorem IsClosed.not : IsClosed { a | p a } β IsOpen { a | Β¬p a } :=
isOpen_compl_iff.mpr
#align is_closed.not IsClosed.not
theorem mem_interior : x β interior s β β t β s, IsOpen t β§ x β t := by
simp only [interior, mem_sUnion, mem_setOf_eq, and_assoc, and_left_comm]
#align mem_interior mem_interiorβ
@[simp]
theorem isOpen_interior : IsOpen (interior s) :=
isOpen_sUnion fun _ => And.left
#align is_open_interior isOpen_interior
theorem interior_subset : interior s β s :=
sUnion_subset fun _ => And.right
#align interior_subset interior_subset
theorem interior_maximal (hβ : t β s) (hβ : IsOpen t) : t β interior s :=
subset_sUnion_of_mem β¨hβ, hββ©
#align interior_maximal interior_maximal
theorem IsOpen.interior_eq (h : IsOpen s) : interior s = s :=
interior_subset.antisymm (interior_maximal (Subset.refl s) h)
#align is_open.interior_eq IsOpen.interior_eq
theorem interior_eq_iff_isOpen : interior s = s β IsOpen s :=
β¨fun h => h βΈ isOpen_interior, IsOpen.interior_eqβ©
#align interior_eq_iff_is_open interior_eq_iff_isOpen
theorem subset_interior_iff_isOpen : s β interior s β IsOpen s := by
simp only [interior_eq_iff_isOpen.symm, Subset.antisymm_iff, interior_subset, true_and]
#align subset_interior_iff_is_open subset_interior_iff_isOpen
theorem IsOpen.subset_interior_iff (hβ : IsOpen s) : s β interior t β s β t :=
β¨fun h => Subset.trans h interior_subset, fun hβ => interior_maximal hβ hββ©
#align is_open.subset_interior_iff IsOpen.subset_interior_iff
theorem subset_interior_iff : t β interior s β β U, IsOpen U β§ t β U β§ U β s :=
β¨fun h => β¨interior s, isOpen_interior, h, interior_subsetβ©, fun β¨_U, hU, htU, hUsβ© =>
htU.trans (interior_maximal hUs hU)β©
#align subset_interior_iff subset_interior_iff
lemma interior_subset_iff : interior s β t β β U, IsOpen U β U β s β U β t := by
simp [interior]
@[mono, gcongr]
theorem interior_mono (h : s β t) : interior s β interior t :=
interior_maximal (Subset.trans interior_subset h) isOpen_interior
#align interior_mono interior_mono
@[simp]
theorem interior_empty : interior (β
: Set X) = β
:=
isOpen_empty.interior_eq
#align interior_empty interior_empty
@[simp]
theorem interior_univ : interior (univ : Set X) = univ :=
isOpen_univ.interior_eq
#align interior_univ interior_univ
@[simp]
theorem interior_eq_univ : interior s = univ β s = univ :=
β¨fun h => univ_subset_iff.mp <| h.symm.trans_le interior_subset, fun h => h.symm βΈ interior_univβ©
#align interior_eq_univ interior_eq_univ
@[simp]
theorem interior_interior : interior (interior s) = interior s :=
isOpen_interior.interior_eq
#align interior_interior interior_interior
@[simp]
theorem interior_inter : interior (s β© t) = interior s β© interior t :=
(Monotone.map_inf_le (fun _ _ β¦ interior_mono) s t).antisymm <|
interior_maximal (inter_subset_inter interior_subset interior_subset) <|
isOpen_interior.inter isOpen_interior
#align interior_inter interior_inter
theorem Set.Finite.interior_biInter {ΞΉ : Type*} {s : Set ΞΉ} (hs : s.Finite) (f : ΞΉ β Set X) :
interior (β i β s, f i) = β i β s, interior (f i) :=
hs.induction_on (by simp) <| by intros; simp [*]
theorem Set.Finite.interior_sInter {S : Set (Set X)} (hS : S.Finite) :
interior (ββ S) = β s β S, interior s := by
rw [sInter_eq_biInter, hS.interior_biInter]
@[simp]
theorem Finset.interior_iInter {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Set X) :
interior (β i β s, f i) = β i β s, interior (f i) :=
s.finite_toSet.interior_biInter f
#align finset.interior_Inter Finset.interior_iInter
@[simp]
theorem interior_iInter_of_finite [Finite ΞΉ] (f : ΞΉ β Set X) :
interior (β i, f i) = β i, interior (f i) := by
rw [β sInter_range, (finite_range f).interior_sInter, biInter_range]
#align interior_Inter interior_iInter_of_finite
theorem interior_union_isClosed_of_interior_empty (hβ : IsClosed s)
(hβ : interior t = β
) : interior (s βͺ t) = interior s :=
have : interior (s βͺ t) β s := fun x β¨u, β¨(huβ : IsOpen u), (huβ : u β s βͺ t)β©, (hxβ : x β u)β© =>
by_contradiction fun hxβ : x β s =>
have : u \ s β t := fun x β¨hβ, hββ© => Or.resolve_left (huβ hβ) hβ
have : u \ s β interior t := by rwa [(IsOpen.sdiff huβ hβ).subset_interior_iff]
have : u \ s β β
:= by rwa [hβ] at this
this β¨hxβ, hxββ©
Subset.antisymm (interior_maximal this isOpen_interior) (interior_mono subset_union_left)
#align interior_union_is_closed_of_interior_empty interior_union_isClosed_of_interior_empty
theorem isOpen_iff_forall_mem_open : IsOpen s β β x β s, β t, t β s β§ IsOpen t β§ x β t := by
rw [β subset_interior_iff_isOpen]
simp only [subset_def, mem_interior]
#align is_open_iff_forall_mem_open isOpen_iff_forall_mem_open
theorem interior_iInter_subset (s : ΞΉ β Set X) : interior (β i, s i) β β i, interior (s i) :=
subset_iInter fun _ => interior_mono <| iInter_subset _ _
#align interior_Inter_subset interior_iInter_subset
theorem interior_iInterβ_subset (p : ΞΉ β Sort*) (s : β i, p i β Set X) :
interior (β (i) (j), s i j) β β (i) (j), interior (s i j) :=
(interior_iInter_subset _).trans <| iInter_mono fun _ => interior_iInter_subset _
#align interior_Interβ_subset interior_iInterβ_subset
theorem interior_sInter_subset (S : Set (Set X)) : interior (ββ S) β β s β S, interior s :=
calc
interior (ββ S) = interior (β s β S, s) := by rw [sInter_eq_biInter]
_ β β s β S, interior s := interior_iInterβ_subset _ _
#align interior_sInter_subset interior_sInter_subset
theorem Filter.HasBasis.lift'_interior {l : Filter X} {p : ΞΉ β Prop} {s : ΞΉ β Set X}
(h : l.HasBasis p s) : (l.lift' interior).HasBasis p fun i => interior (s i) :=
h.lift' fun _ _ β¦ interior_mono
theorem Filter.lift'_interior_le (l : Filter X) : l.lift' interior β€ l := fun _s hs β¦
mem_of_superset (mem_lift' hs) interior_subset
theorem Filter.HasBasis.lift'_interior_eq_self {l : Filter X} {p : ΞΉ β Prop} {s : ΞΉ β Set X}
(h : l.HasBasis p s) (ho : β i, p i β IsOpen (s i)) : l.lift' interior = l :=
le_antisymm l.lift'_interior_le <| h.lift'_interior.ge_iff.2 fun i hi β¦ by
simpa only [(ho i hi).interior_eq] using h.mem_of_mem hi
@[simp]
theorem isClosed_closure : IsClosed (closure s) :=
isClosed_sInter fun _ => And.left
#align is_closed_closure isClosed_closure
theorem subset_closure : s β closure s :=
subset_sInter fun _ => And.right
#align subset_closure subset_closure
theorem not_mem_of_not_mem_closure {P : X} (hP : P β closure s) : P β s := fun h =>
hP (subset_closure h)
#align not_mem_of_not_mem_closure not_mem_of_not_mem_closure
theorem closure_minimal (hβ : s β t) (hβ : IsClosed t) : closure s β t :=
sInter_subset_of_mem β¨hβ, hββ©
#align closure_minimal closure_minimal
theorem Disjoint.closure_left (hd : Disjoint s t) (ht : IsOpen t) :
Disjoint (closure s) t :=
disjoint_compl_left.mono_left <| closure_minimal hd.subset_compl_right ht.isClosed_compl
#align disjoint.closure_left Disjoint.closure_left
theorem Disjoint.closure_right (hd : Disjoint s t) (hs : IsOpen s) :
Disjoint s (closure t) :=
(hd.symm.closure_left hs).symm
#align disjoint.closure_right Disjoint.closure_right
theorem IsClosed.closure_eq (h : IsClosed s) : closure s = s :=
Subset.antisymm (closure_minimal (Subset.refl s) h) subset_closure
#align is_closed.closure_eq IsClosed.closure_eq
theorem IsClosed.closure_subset (hs : IsClosed s) : closure s β s :=
closure_minimal (Subset.refl _) hs
#align is_closed.closure_subset IsClosed.closure_subset
theorem IsClosed.closure_subset_iff (hβ : IsClosed t) : closure s β t β s β t :=
β¨Subset.trans subset_closure, fun h => closure_minimal h hββ©
#align is_closed.closure_subset_iff IsClosed.closure_subset_iff
theorem IsClosed.mem_iff_closure_subset (hs : IsClosed s) :
x β s β closure ({x} : Set X) β s :=
(hs.closure_subset_iff.trans Set.singleton_subset_iff).symm
#align is_closed.mem_iff_closure_subset IsClosed.mem_iff_closure_subset
@[mono, gcongr]
theorem closure_mono (h : s β t) : closure s β closure t :=
closure_minimal (Subset.trans h subset_closure) isClosed_closure
#align closure_mono closure_mono
theorem monotone_closure (X : Type*) [TopologicalSpace X] : Monotone (@closure X _) := fun _ _ =>
closure_mono
#align monotone_closure monotone_closure
theorem diff_subset_closure_iff : s \ t β closure t β s β closure t := by
rw [diff_subset_iff, union_eq_self_of_subset_left subset_closure]
#align diff_subset_closure_iff diff_subset_closure_iff
theorem closure_inter_subset_inter_closure (s t : Set X) :
closure (s β© t) β closure s β© closure t :=
(monotone_closure X).map_inf_le s t
#align closure_inter_subset_inter_closure closure_inter_subset_inter_closure
theorem isClosed_of_closure_subset (h : closure s β s) : IsClosed s := by
rw [subset_closure.antisymm h]; exact isClosed_closure
#align is_closed_of_closure_subset isClosed_of_closure_subset
theorem closure_eq_iff_isClosed : closure s = s β IsClosed s :=
β¨fun h => h βΈ isClosed_closure, IsClosed.closure_eqβ©
#align closure_eq_iff_is_closed closure_eq_iff_isClosed
theorem closure_subset_iff_isClosed : closure s β s β IsClosed s :=
β¨isClosed_of_closure_subset, IsClosed.closure_subsetβ©
#align closure_subset_iff_is_closed closure_subset_iff_isClosed
@[simp]
theorem closure_empty : closure (β
: Set X) = β
:=
isClosed_empty.closure_eq
#align closure_empty closure_empty
@[simp]
theorem closure_empty_iff (s : Set X) : closure s = β
β s = β
:=
β¨subset_eq_empty subset_closure, fun h => h.symm βΈ closure_emptyβ©
#align closure_empty_iff closure_empty_iff
@[simp]
theorem closure_nonempty_iff : (closure s).Nonempty β s.Nonempty := by
simp only [nonempty_iff_ne_empty, Ne, closure_empty_iff]
#align closure_nonempty_iff closure_nonempty_iff
alias β¨Set.Nonempty.of_closure, Set.Nonempty.closureβ© := closure_nonempty_iff
#align set.nonempty.of_closure Set.Nonempty.of_closure
#align set.nonempty.closure Set.Nonempty.closure
@[simp]
theorem closure_univ : closure (univ : Set X) = univ :=
isClosed_univ.closure_eq
#align closure_univ closure_univ
@[simp]
theorem closure_closure : closure (closure s) = closure s :=
isClosed_closure.closure_eq
#align closure_closure closure_closure
theorem closure_eq_compl_interior_compl : closure s = (interior sαΆ)αΆ := by
rw [interior, closure, compl_sUnion, compl_image_set_of]
simp only [compl_subset_compl, isOpen_compl_iff]
#align closure_eq_compl_interior_compl closure_eq_compl_interior_compl
@[simp]
theorem closure_union : closure (s βͺ t) = closure s βͺ closure t := by
simp [closure_eq_compl_interior_compl, compl_inter]
#align closure_union closure_union
theorem Set.Finite.closure_biUnion {ΞΉ : Type*} {s : Set ΞΉ} (hs : s.Finite) (f : ΞΉ β Set X) :
closure (β i β s, f i) = β i β s, closure (f i) := by
simp [closure_eq_compl_interior_compl, hs.interior_biInter]
theorem Set.Finite.closure_sUnion {S : Set (Set X)} (hS : S.Finite) :
closure (ββ S) = β s β S, closure s := by
rw [sUnion_eq_biUnion, hS.closure_biUnion]
@[simp]
theorem Finset.closure_biUnion {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β Set X) :
closure (β i β s, f i) = β i β s, closure (f i) :=
s.finite_toSet.closure_biUnion f
#align finset.closure_bUnion Finset.closure_biUnion
@[simp]
theorem closure_iUnion_of_finite [Finite ΞΉ] (f : ΞΉ β Set X) :
closure (β i, f i) = β i, closure (f i) := by
rw [β sUnion_range, (finite_range _).closure_sUnion, biUnion_range]
#align closure_Union closure_iUnion_of_finite
theorem interior_subset_closure : interior s β closure s :=
Subset.trans interior_subset subset_closure
#align interior_subset_closure interior_subset_closure
@[simp]
theorem interior_compl : interior sαΆ = (closure s)αΆ := by
simp [closure_eq_compl_interior_compl]
#align interior_compl interior_compl
@[simp]
theorem closure_compl : closure sαΆ = (interior s)αΆ := by
simp [closure_eq_compl_interior_compl]
#align closure_compl closure_compl
theorem mem_closure_iff :
x β closure s β β o, IsOpen o β x β o β (o β© s).Nonempty :=
β¨fun h o oo ao =>
by_contradiction fun os =>
have : s β oαΆ := fun x xs xo => os β¨x, xo, xsβ©
closure_minimal this (isClosed_compl_iff.2 oo) h ao,
fun H _ β¨hβ, hββ© =>
by_contradiction fun nc =>
let β¨_, hc, hsβ© := H _ hβ.isOpen_compl nc
hc (hβ hs)β©
#align mem_closure_iff mem_closure_iff
theorem closure_inter_open_nonempty_iff (h : IsOpen t) :
(closure s β© t).Nonempty β (s β© t).Nonempty :=
β¨fun β¨_x, hxcs, hxtβ© => inter_comm t s βΈ mem_closure_iff.1 hxcs t h hxt, fun h =>
h.mono <| inf_le_inf_right t subset_closureβ©
#align closure_inter_open_nonempty_iff closure_inter_open_nonempty_iff
theorem Filter.le_lift'_closure (l : Filter X) : l β€ l.lift' closure :=
le_lift'.2 fun _ h => mem_of_superset h subset_closure
#align filter.le_lift'_closure Filter.le_lift'_closure
theorem Filter.HasBasis.lift'_closure {l : Filter X} {p : ΞΉ β Prop} {s : ΞΉ β Set X}
(h : l.HasBasis p s) : (l.lift' closure).HasBasis p fun i => closure (s i) :=
h.lift' (monotone_closure X)
#align filter.has_basis.lift'_closure Filter.HasBasis.lift'_closure
theorem Filter.HasBasis.lift'_closure_eq_self {l : Filter X} {p : ΞΉ β Prop} {s : ΞΉ β Set X}
(h : l.HasBasis p s) (hc : β i, p i β IsClosed (s i)) : l.lift' closure = l :=
le_antisymm (h.ge_iff.2 fun i hi => (hc i hi).closure_eq βΈ mem_lift' (h.mem_of_mem hi))
l.le_lift'_closure
#align filter.has_basis.lift'_closure_eq_self Filter.HasBasis.lift'_closure_eq_self
@[simp]
theorem Filter.lift'_closure_eq_bot {l : Filter X} : l.lift' closure = β₯ β l = β₯ :=
β¨fun h => bot_unique <| h βΈ l.le_lift'_closure, fun h =>
h.symm βΈ by rw [lift'_bot (monotone_closure _), closure_empty, principal_empty]β©
#align filter.lift'_closure_eq_bot Filter.lift'_closure_eq_bot
theorem dense_iff_closure_eq : Dense s β closure s = univ :=
eq_univ_iff_forall.symm
#align dense_iff_closure_eq dense_iff_closure_eq
alias β¨Dense.closure_eq, _β© := dense_iff_closure_eq
#align dense.closure_eq Dense.closure_eq
theorem interior_eq_empty_iff_dense_compl : interior s = β
β Dense sαΆ := by
rw [dense_iff_closure_eq, closure_compl, compl_univ_iff]
#align interior_eq_empty_iff_dense_compl interior_eq_empty_iff_dense_compl
theorem Dense.interior_compl (h : Dense s) : interior sαΆ = β
:=
interior_eq_empty_iff_dense_compl.2 <| by rwa [compl_compl]
#align dense.interior_compl Dense.interior_compl
@[simp]
theorem dense_closure : Dense (closure s) β Dense s := by
rw [Dense, Dense, closure_closure]
#align dense_closure dense_closure
protected alias β¨_, Dense.closureβ© := dense_closure
alias β¨Dense.of_closure, _β© := dense_closure
#align dense.of_closure Dense.of_closure
#align dense.closure Dense.closure
@[simp]
theorem dense_univ : Dense (univ : Set X) := fun _ => subset_closure trivial
#align dense_univ dense_univ
theorem dense_iff_inter_open :
Dense s β β U, IsOpen U β U.Nonempty β (U β© s).Nonempty := by
constructor <;> intro h
Β· rintro U U_op β¨x, x_inβ©
exact mem_closure_iff.1 (h _) U U_op x_in
Β· intro x
rw [mem_closure_iff]
intro U U_op x_in
exact h U U_op β¨_, x_inβ©
#align dense_iff_inter_open dense_iff_inter_open
alias β¨Dense.inter_open_nonempty, _β© := dense_iff_inter_open
#align dense.inter_open_nonempty Dense.inter_open_nonempty
theorem Dense.exists_mem_open (hs : Dense s) {U : Set X} (ho : IsOpen U)
(hne : U.Nonempty) : β x β s, x β U :=
let β¨x, hxβ© := hs.inter_open_nonempty U ho hne
β¨x, hx.2, hx.1β©
#align dense.exists_mem_open Dense.exists_mem_open
theorem Dense.nonempty_iff (hs : Dense s) : s.Nonempty β Nonempty X :=
β¨fun β¨x, _β© => β¨xβ©, fun β¨xβ© =>
let β¨y, hyβ© := hs.inter_open_nonempty _ isOpen_univ β¨x, trivialβ©
β¨y, hy.2β©β©
#align dense.nonempty_iff Dense.nonempty_iff
theorem Dense.nonempty [h : Nonempty X] (hs : Dense s) : s.Nonempty :=
hs.nonempty_iff.2 h
#align dense.nonempty Dense.nonempty
@[mono]
theorem Dense.mono (h : sβ β sβ) (hd : Dense sβ) : Dense sβ := fun x =>
closure_mono h (hd x)
#align dense.mono Dense.mono
theorem dense_compl_singleton_iff_not_open :
Dense ({x}αΆ : Set X) β Β¬IsOpen ({x} : Set X) := by
constructor
Β· intro hd ho
exact (hd.inter_open_nonempty _ ho (singleton_nonempty _)).ne_empty (inter_compl_self _)
Β· refine fun ho => dense_iff_inter_open.2 fun U hU hne => inter_compl_nonempty_iff.2 fun hUx => ?_
obtain rfl : U = {x} := eq_singleton_iff_nonempty_unique_mem.2 β¨hne, hUxβ©
exact ho hU
#align dense_compl_singleton_iff_not_open dense_compl_singleton_iff_not_open
@[simp]
theorem closure_diff_interior (s : Set X) : closure s \ interior s = frontier s :=
rfl
#align closure_diff_interior closure_diff_interior
lemma disjoint_interior_frontier : Disjoint (interior s) (frontier s) := by
rw [disjoint_iff_inter_eq_empty, β closure_diff_interior, diff_eq,
β inter_assoc, inter_comm, β inter_assoc, compl_inter_self, empty_inter]
@[simp]
theorem closure_diff_frontier (s : Set X) : closure s \ frontier s = interior s := by
rw [frontier, diff_diff_right_self, inter_eq_self_of_subset_right interior_subset_closure]
#align closure_diff_frontier closure_diff_frontier
@[simp]
theorem self_diff_frontier (s : Set X) : s \ frontier s = interior s := by
rw [frontier, diff_diff_right, diff_eq_empty.2 subset_closure,
inter_eq_self_of_subset_right interior_subset, empty_union]
#align self_diff_frontier self_diff_frontier
theorem frontier_eq_closure_inter_closure : frontier s = closure s β© closure sαΆ := by
rw [closure_compl, frontier, diff_eq]
#align frontier_eq_closure_inter_closure frontier_eq_closure_inter_closure
theorem frontier_subset_closure : frontier s β closure s :=
diff_subset
#align frontier_subset_closure frontier_subset_closure
theorem IsClosed.frontier_subset (hs : IsClosed s) : frontier s β s :=
frontier_subset_closure.trans hs.closure_eq.subset
#align is_closed.frontier_subset IsClosed.frontier_subset
theorem frontier_closure_subset : frontier (closure s) β frontier s :=
diff_subset_diff closure_closure.subset <| interior_mono subset_closure
#align frontier_closure_subset frontier_closure_subset
theorem frontier_interior_subset : frontier (interior s) β frontier s :=
diff_subset_diff (closure_mono interior_subset) interior_interior.symm.subset
#align frontier_interior_subset frontier_interior_subset
@[simp]
theorem frontier_compl (s : Set X) : frontier sαΆ = frontier s := by
simp only [frontier_eq_closure_inter_closure, compl_compl, inter_comm]
#align frontier_compl frontier_compl
@[simp]
theorem frontier_univ : frontier (univ : Set X) = β
:= by simp [frontier]
#align frontier_univ frontier_univ
@[simp]
theorem frontier_empty : frontier (β
: Set X) = β
:= by simp [frontier]
#align frontier_empty frontier_empty
theorem frontier_inter_subset (s t : Set X) :
frontier (s β© t) β frontier s β© closure t βͺ closure s β© frontier t := by
simp only [frontier_eq_closure_inter_closure, compl_inter, closure_union]
refine (inter_subset_inter_left _ (closure_inter_subset_inter_closure s t)).trans_eq ?_
simp only [inter_union_distrib_left, union_inter_distrib_right, inter_assoc,
inter_comm (closure t)]
#align frontier_inter_subset frontier_inter_subset
theorem frontier_union_subset (s t : Set X) :
frontier (s βͺ t) β frontier s β© closure tαΆ βͺ closure sαΆ β© frontier t := by
simpa only [frontier_compl, β compl_union] using frontier_inter_subset sαΆ tαΆ
#align frontier_union_subset frontier_union_subset
theorem IsClosed.frontier_eq (hs : IsClosed s) : frontier s = s \ interior s := by
rw [frontier, hs.closure_eq]
#align is_closed.frontier_eq IsClosed.frontier_eq
theorem IsOpen.frontier_eq (hs : IsOpen s) : frontier s = closure s \ s := by
rw [frontier, hs.interior_eq]
#align is_open.frontier_eq IsOpen.frontier_eq
theorem IsOpen.inter_frontier_eq (hs : IsOpen s) : s β© frontier s = β
:= by
rw [hs.frontier_eq, inter_diff_self]
#align is_open.inter_frontier_eq IsOpen.inter_frontier_eq
theorem isClosed_frontier : IsClosed (frontier s) := by
rw [frontier_eq_closure_inter_closure]; exact IsClosed.inter isClosed_closure isClosed_closure
#align is_closed_frontier isClosed_frontier
theorem interior_frontier (h : IsClosed s) : interior (frontier s) = β
:= by
have A : frontier s = s \ interior s := h.frontier_eq
have B : interior (frontier s) β interior s := by rw [A]; exact interior_mono diff_subset
have C : interior (frontier s) β frontier s := interior_subset
have : interior (frontier s) β interior s β© (s \ interior s) :=
subset_inter B (by simpa [A] using C)
rwa [inter_diff_self, subset_empty_iff] at this
#align interior_frontier interior_frontier
theorem closure_eq_interior_union_frontier (s : Set X) : closure s = interior s βͺ frontier s :=
(union_diff_cancel interior_subset_closure).symm
#align closure_eq_interior_union_frontier closure_eq_interior_union_frontier
theorem closure_eq_self_union_frontier (s : Set X) : closure s = s βͺ frontier s :=
(union_diff_cancel' interior_subset subset_closure).symm
#align closure_eq_self_union_frontier closure_eq_self_union_frontier
theorem Disjoint.frontier_left (ht : IsOpen t) (hd : Disjoint s t) : Disjoint (frontier s) t :=
subset_compl_iff_disjoint_right.1 <|
frontier_subset_closure.trans <| closure_minimal (disjoint_left.1 hd) <| isClosed_compl_iff.2 ht
#align disjoint.frontier_left Disjoint.frontier_left
theorem Disjoint.frontier_right (hs : IsOpen s) (hd : Disjoint s t) : Disjoint s (frontier t) :=
(hd.symm.frontier_left hs).symm
#align disjoint.frontier_right Disjoint.frontier_right
theorem frontier_eq_inter_compl_interior :
frontier s = (interior s)αΆ β© (interior sαΆ)αΆ := by
rw [β frontier_compl, β closure_compl, β diff_eq, closure_diff_interior]
#align frontier_eq_inter_compl_interior frontier_eq_inter_compl_interior
theorem compl_frontier_eq_union_interior :
(frontier s)αΆ = interior s βͺ interior sαΆ := by
rw [frontier_eq_inter_compl_interior]
simp only [compl_inter, compl_compl]
#align compl_frontier_eq_union_interior compl_frontier_eq_union_interior
theorem nhds_def' (x : X) : π x = β¨
(s : Set X) (_ : IsOpen s) (_ : x β s), π s := by
simp only [nhds_def, mem_setOf_eq, @and_comm (x β _), iInf_and]
#align nhds_def' nhds_def'
theorem nhds_basis_opens (x : X) :
(π x).HasBasis (fun s : Set X => x β s β§ IsOpen s) fun s => s := by
rw [nhds_def]
exact hasBasis_biInf_principal
(fun s β¨has, hsβ© t β¨hat, htβ© =>
β¨s β© t, β¨β¨has, hatβ©, IsOpen.inter hs htβ©, β¨inter_subset_left, inter_subset_rightβ©β©)
β¨univ, β¨mem_univ x, isOpen_univβ©β©
#align nhds_basis_opens nhds_basis_opens
theorem nhds_basis_closeds (x : X) : (π x).HasBasis (fun s : Set X => x β s β§ IsClosed s) compl :=
β¨fun t => (nhds_basis_opens x).mem_iff.trans <|
compl_surjective.exists.trans <| by simp only [isOpen_compl_iff, mem_compl_iff]β©
#align nhds_basis_closeds nhds_basis_closeds
@[simp]
theorem lift'_nhds_interior (x : X) : (π x).lift' interior = π x :=
(nhds_basis_opens x).lift'_interior_eq_self fun _ β¦ And.right
theorem Filter.HasBasis.nhds_interior {x : X} {p : ΞΉ β Prop} {s : ΞΉ β Set X}
(h : (π x).HasBasis p s) : (π x).HasBasis p (interior <| s Β·) :=
lift'_nhds_interior x βΈ h.lift'_interior
theorem le_nhds_iff {f} : f β€ π x β β s : Set X, x β s β IsOpen s β s β f := by simp [nhds_def]
#align le_nhds_iff le_nhds_iff
theorem nhds_le_of_le {f} (h : x β s) (o : IsOpen s) (sf : π s β€ f) : π x β€ f := by
rw [nhds_def]; exact iInfβ_le_of_le s β¨h, oβ© sf
#align nhds_le_of_le nhds_le_of_le
theorem mem_nhds_iff : s β π x β β t β s, IsOpen t β§ x β t :=
(nhds_basis_opens x).mem_iff.trans <| exists_congr fun _ =>
β¨fun h => β¨h.2, h.1.2, h.1.1β©, fun h => β¨β¨h.2.2, h.2.1β©, h.1β©β©
#align mem_nhds_iff mem_nhds_iffβ
theorem eventually_nhds_iff {p : X β Prop} :
(βαΆ x in π x, p x) β β t : Set X, (β x β t, p x) β§ IsOpen t β§ x β t :=
mem_nhds_iff.trans <| by simp only [subset_def, exists_prop, mem_setOf_eq]
#align eventually_nhds_iff eventually_nhds_iff
theorem mem_interior_iff_mem_nhds : x β interior s β s β π x :=
mem_interior.trans mem_nhds_iff.symm
#align mem_interior_iff_mem_nhds mem_interior_iff_mem_nhds
theorem map_nhds {f : X β Ξ±} :
map f (π x) = β¨
s β { s : Set X | x β s β§ IsOpen s }, π (f '' s) :=
((nhds_basis_opens x).map f).eq_biInf
#align map_nhds map_nhds
theorem mem_of_mem_nhds : s β π x β x β s := fun H =>
let β¨_t, ht, _, hsβ© := mem_nhds_iff.1 H; ht hs
#align mem_of_mem_nhds mem_of_mem_nhds
theorem Filter.Eventually.self_of_nhds {p : X β Prop} (h : βαΆ y in π x, p y) : p x :=
mem_of_mem_nhds h
#align filter.eventually.self_of_nhds Filter.Eventually.self_of_nhds
theorem IsOpen.mem_nhds (hs : IsOpen s) (hx : x β s) : s β π x :=
mem_nhds_iff.2 β¨s, Subset.refl _, hs, hxβ©
#align is_open.mem_nhds IsOpen.mem_nhds
protected theorem IsOpen.mem_nhds_iff (hs : IsOpen s) : s β π x β x β s :=
β¨mem_of_mem_nhds, fun hx => mem_nhds_iff.2 β¨s, Subset.rfl, hs, hxβ©β©
#align is_open.mem_nhds_iff IsOpen.mem_nhds_iff
theorem IsClosed.compl_mem_nhds (hs : IsClosed s) (hx : x β s) : sαΆ β π x :=
hs.isOpen_compl.mem_nhds (mem_compl hx)
#align is_closed.compl_mem_nhds IsClosed.compl_mem_nhds
theorem IsOpen.eventually_mem (hs : IsOpen s) (hx : x β s) :
βαΆ x in π x, x β s :=
IsOpen.mem_nhds hs hx
#align is_open.eventually_mem IsOpen.eventually_mem
theorem nhds_basis_opens' (x : X) :
(π x).HasBasis (fun s : Set X => s β π x β§ IsOpen s) fun x => x := by
convert nhds_basis_opens x using 2
exact and_congr_left_iff.2 IsOpen.mem_nhds_iff
#align nhds_basis_opens' nhds_basis_opens'
theorem exists_open_set_nhds {U : Set X} (h : β x β s, U β π x) :
β V : Set X, s β V β§ IsOpen V β§ V β U :=
β¨interior U, fun x hx => mem_interior_iff_mem_nhds.2 <| h x hx, isOpen_interior, interior_subsetβ©
#align exists_open_set_nhds exists_open_set_nhds
theorem exists_open_set_nhds' {U : Set X} (h : U β β¨ x β s, π x) :
β V : Set X, s β V β§ IsOpen V β§ V β U :=
exists_open_set_nhds (by simpa using h)
#align exists_open_set_nhds' exists_open_set_nhds'
theorem Filter.Eventually.eventually_nhds {p : X β Prop} (h : βαΆ y in π x, p y) :
βαΆ y in π x, βαΆ x in π y, p x :=
let β¨t, htp, hto, haβ© := eventually_nhds_iff.1 h
eventually_nhds_iff.2 β¨t, fun _x hx => eventually_nhds_iff.2 β¨t, htp, hto, hxβ©, hto, haβ©
#align filter.eventually.eventually_nhds Filter.Eventually.eventually_nhds
@[simp]
theorem eventually_eventually_nhds {p : X β Prop} :
(βαΆ y in π x, βαΆ x in π y, p x) β βαΆ x in π x, p x :=
β¨fun h => h.self_of_nhds, fun h => h.eventually_nhdsβ©
#align eventually_eventually_nhds eventually_eventually_nhds
@[simp]
theorem frequently_frequently_nhds {p : X β Prop} :
(βαΆ x' in π x, βαΆ x'' in π x', p x'') β βαΆ x in π x, p x := by
rw [β not_iff_not]
simp only [not_frequently, eventually_eventually_nhds]
#align frequently_frequently_nhds frequently_frequently_nhds
@[simp]
theorem eventually_mem_nhds : (βαΆ x' in π x, s β π x') β s β π x :=
eventually_eventually_nhds
#align eventually_mem_nhds eventually_mem_nhds
@[simp]
theorem nhds_bind_nhds : (π x).bind π = π x :=
Filter.ext fun _ => eventually_eventually_nhds
#align nhds_bind_nhds nhds_bind_nhds
@[simp]
theorem eventually_eventuallyEq_nhds {f g : X β Ξ±} :
(βαΆ y in π x, f =αΆ [π y] g) β f =αΆ [π x] g :=
eventually_eventually_nhds
#align eventually_eventually_eq_nhds eventually_eventuallyEq_nhds
theorem Filter.EventuallyEq.eq_of_nhds {f g : X β Ξ±} (h : f =αΆ [π x] g) : f x = g x :=
h.self_of_nhds
#align filter.eventually_eq.eq_of_nhds Filter.EventuallyEq.eq_of_nhds
@[simp]
theorem eventually_eventuallyLE_nhds [LE Ξ±] {f g : X β Ξ±} :
(βαΆ y in π x, f β€αΆ [π y] g) β f β€αΆ [π x] g :=
eventually_eventually_nhds
#align eventually_eventually_le_nhds eventually_eventuallyLE_nhds
theorem Filter.EventuallyEq.eventuallyEq_nhds {f g : X β Ξ±} (h : f =αΆ [π x] g) :
βαΆ y in π x, f =αΆ [π y] g :=
h.eventually_nhds
#align filter.eventually_eq.eventually_eq_nhds Filter.EventuallyEq.eventuallyEq_nhds
theorem Filter.EventuallyLE.eventuallyLE_nhds [LE Ξ±] {f g : X β Ξ±} (h : f β€αΆ [π x] g) :
βαΆ y in π x, f β€αΆ [π y] g :=
h.eventually_nhds
#align filter.eventually_le.eventually_le_nhds Filter.EventuallyLE.eventuallyLE_nhds
theorem all_mem_nhds (x : X) (P : Set X β Prop) (hP : β s t, s β t β P s β P t) :
(β s β π x, P s) β β s, IsOpen s β x β s β P s :=
((nhds_basis_opens x).forall_iff hP).trans <| by simp only [@and_comm (x β _), and_imp]
#align all_mem_nhds all_mem_nhds
theorem all_mem_nhds_filter (x : X) (f : Set X β Set Ξ±) (hf : β s t, s β t β f s β f t)
(l : Filter Ξ±) : (β s β π x, f s β l) β β s, IsOpen s β x β s β f s β l :=
all_mem_nhds _ _ fun s t ssubt h => mem_of_superset h (hf s t ssubt)
#align all_mem_nhds_filter all_mem_nhds_filter
theorem tendsto_nhds {f : Ξ± β X} {l : Filter Ξ±} :
Tendsto f l (π x) β β s, IsOpen s β x β s β f β»ΒΉ' s β l :=
all_mem_nhds_filter _ _ (fun _ _ h => preimage_mono h) _
#align tendsto_nhds tendsto_nhds
theorem tendsto_atTop_nhds [Nonempty Ξ±] [SemilatticeSup Ξ±] {f : Ξ± β X} :
Tendsto f atTop (π x) β β U : Set X, x β U β IsOpen U β β N, β n, N β€ n β f n β U :=
(atTop_basis.tendsto_iff (nhds_basis_opens x)).trans <| by
simp only [and_imp, exists_prop, true_and_iff, mem_Ici, ge_iff_le]
#align tendsto_at_top_nhds tendsto_atTop_nhds
theorem tendsto_const_nhds {f : Filter Ξ±} : Tendsto (fun _ : Ξ± => x) f (π x) :=
tendsto_nhds.mpr fun _ _ ha => univ_mem' fun _ => ha
#align tendsto_const_nhds tendsto_const_nhds
theorem tendsto_atTop_of_eventually_const {ΞΉ : Type*} [SemilatticeSup ΞΉ] [Nonempty ΞΉ]
{u : ΞΉ β X} {iβ : ΞΉ} (h : β i β₯ iβ, u i = x) : Tendsto u atTop (π x) :=
Tendsto.congr' (EventuallyEq.symm (eventually_atTop.mpr β¨iβ, hβ©)) tendsto_const_nhds
#align tendsto_at_top_of_eventually_const tendsto_atTop_of_eventually_const
theorem tendsto_atBot_of_eventually_const {ΞΉ : Type*} [SemilatticeInf ΞΉ] [Nonempty ΞΉ]
{u : ΞΉ β X} {iβ : ΞΉ} (h : β i β€ iβ, u i = x) : Tendsto u atBot (π x) :=
Tendsto.congr' (EventuallyEq.symm (eventually_atBot.mpr β¨iβ, hβ©)) tendsto_const_nhds
#align tendsto_at_bot_of_eventually_const tendsto_atBot_of_eventually_const
theorem pure_le_nhds : pure β€ (π : X β Filter X) := fun _ _ hs => mem_pure.2 <| mem_of_mem_nhds hs
#align pure_le_nhds pure_le_nhds
theorem tendsto_pure_nhds (f : Ξ± β X) (a : Ξ±) : Tendsto f (pure a) (π (f a)) :=
(tendsto_pure_pure f a).mono_right (pure_le_nhds _)
#align tendsto_pure_nhds tendsto_pure_nhds
theorem OrderTop.tendsto_atTop_nhds [PartialOrder Ξ±] [OrderTop Ξ±] (f : Ξ± β X) :
Tendsto f atTop (π (f β€)) :=
(tendsto_atTop_pure f).mono_right (pure_le_nhds _)
#align order_top.tendsto_at_top_nhds OrderTop.tendsto_atTop_nhds
@[simp]
instance nhds_neBot : NeBot (π x) :=
neBot_of_le (pure_le_nhds x)
#align nhds_ne_bot nhds_neBot
theorem tendsto_nhds_of_eventually_eq {l : Filter Ξ±} {f : Ξ± β X} (h : βαΆ x' in l, f x' = x) :
Tendsto f l (π x) :=
tendsto_const_nhds.congr' (.symm h)
theorem Filter.EventuallyEq.tendsto {l : Filter Ξ±} {f : Ξ± β X} (hf : f =αΆ [l] fun _ β¦ x) :
Tendsto f l (π x) :=
tendsto_nhds_of_eventually_eq hf
theorem ClusterPt.neBot {F : Filter X} (h : ClusterPt x F) : NeBot (π x β F) :=
h
#align cluster_pt.ne_bot ClusterPt.neBot
theorem Filter.HasBasis.clusterPt_iff {ΞΉX ΞΉF} {pX : ΞΉX β Prop} {sX : ΞΉX β Set X} {pF : ΞΉF β Prop}
{sF : ΞΉF β Set X} {F : Filter X} (hX : (π x).HasBasis pX sX) (hF : F.HasBasis pF sF) :
ClusterPt x F β β β¦iβ¦, pX i β β β¦jβ¦, pF j β (sX i β© sF j).Nonempty :=
hX.inf_basis_neBot_iff hF
#align filter.has_basis.cluster_pt_iff Filter.HasBasis.clusterPt_iff
theorem clusterPt_iff {F : Filter X} :
ClusterPt x F β β β¦U : Set Xβ¦, U β π x β β β¦Vβ¦, V β F β (U β© V).Nonempty :=
inf_neBot_iff
#align cluster_pt_iff clusterPt_iff
theorem clusterPt_iff_not_disjoint {F : Filter X} :
ClusterPt x F β Β¬Disjoint (π x) F := by
rw [disjoint_iff, ClusterPt, neBot_iff]
theorem clusterPt_principal_iff :
ClusterPt x (π s) β β U β π x, (U β© s).Nonempty :=
inf_principal_neBot_iff
#align cluster_pt_principal_iff clusterPt_principal_iff
theorem clusterPt_principal_iff_frequently :
ClusterPt x (π s) β βαΆ y in π x, y β s := by
simp only [clusterPt_principal_iff, frequently_iff, Set.Nonempty, exists_prop, mem_inter_iff]
#align cluster_pt_principal_iff_frequently clusterPt_principal_iff_frequently
theorem ClusterPt.of_le_nhds {f : Filter X} (H : f β€ π x) [NeBot f] : ClusterPt x f := by
rwa [ClusterPt, inf_eq_right.mpr H]
#align cluster_pt.of_le_nhds ClusterPt.of_le_nhds
theorem ClusterPt.of_le_nhds' {f : Filter X} (H : f β€ π x) (_hf : NeBot f) :
ClusterPt x f :=
ClusterPt.of_le_nhds H
#align cluster_pt.of_le_nhds' ClusterPt.of_le_nhds'
theorem ClusterPt.of_nhds_le {f : Filter X} (H : π x β€ f) : ClusterPt x f := by
simp only [ClusterPt, inf_eq_left.mpr H, nhds_neBot]
#align cluster_pt.of_nhds_le ClusterPt.of_nhds_le
theorem ClusterPt.mono {f g : Filter X} (H : ClusterPt x f) (h : f β€ g) : ClusterPt x g :=
NeBot.mono H <| inf_le_inf_left _ h
#align cluster_pt.mono ClusterPt.mono
theorem ClusterPt.of_inf_left {f g : Filter X} (H : ClusterPt x <| f β g) : ClusterPt x f :=
H.mono inf_le_left
#align cluster_pt.of_inf_left ClusterPt.of_inf_left
theorem ClusterPt.of_inf_right {f g : Filter X} (H : ClusterPt x <| f β g) :
ClusterPt x g :=
H.mono inf_le_right
#align cluster_pt.of_inf_right ClusterPt.of_inf_right
theorem Ultrafilter.clusterPt_iff {f : Ultrafilter X} : ClusterPt x f β βf β€ π x :=
β¨f.le_of_inf_neBot', fun h => ClusterPt.of_le_nhds hβ©
#align ultrafilter.cluster_pt_iff Ultrafilter.clusterPt_iff
theorem clusterPt_iff_ultrafilter {f : Filter X} : ClusterPt x f β
β u : Ultrafilter X, u β€ f β§ u β€ π x := by
simp_rw [ClusterPt, β le_inf_iff, exists_ultrafilter_iff, inf_comm]
theorem mapClusterPt_def {ΞΉ : Type*} (x : X) (F : Filter ΞΉ) (u : ΞΉ β X) :
MapClusterPt x F u β ClusterPt x (map u F) := Iff.rfl
theorem mapClusterPt_iff {ΞΉ : Type*} (x : X) (F : Filter ΞΉ) (u : ΞΉ β X) :
MapClusterPt x F u β β s β π x, βαΆ a in F, u a β s := by
simp_rw [MapClusterPt, ClusterPt, inf_neBot_iff_frequently_left, frequently_map]
rfl
#align map_cluster_pt_iff mapClusterPt_iff
theorem mapClusterPt_iff_ultrafilter {ΞΉ : Type*} (x : X) (F : Filter ΞΉ) (u : ΞΉ β X) :
MapClusterPt x F u β β U : Ultrafilter ΞΉ, U β€ F β§ Tendsto u U (π x) := by
simp_rw [MapClusterPt, ClusterPt, β Filter.push_pull', map_neBot_iff, tendsto_iff_comap,
β le_inf_iff, exists_ultrafilter_iff, inf_comm]
theorem mapClusterPt_comp {X Ξ± Ξ² : Type*} {x : X} [TopologicalSpace X] {F : Filter Ξ±} {Ο : Ξ± β Ξ²}
{u : Ξ² β X} : MapClusterPt x F (u β Ο) β MapClusterPt x (map Ο F) u := Iff.rfl
theorem mapClusterPt_of_comp {F : Filter Ξ±} {Ο : Ξ² β Ξ±} {p : Filter Ξ²}
{u : Ξ± β X} [NeBot p] (h : Tendsto Ο p F) (H : Tendsto (u β Ο) p (π x)) :
MapClusterPt x F u := by
have :=
calc
map (u β Ο) p = map u (map Ο p) := map_map
_ β€ map u F := map_mono h
have : map (u β Ο) p β€ π x β map u F := le_inf H this
exact neBot_of_le this
#align map_cluster_pt_of_comp mapClusterPt_of_comp
theorem acc_iff_cluster (x : X) (F : Filter X) : AccPt x F β ClusterPt x (π {x}αΆ β F) := by
rw [AccPt, nhdsWithin, ClusterPt, inf_assoc]
#align acc_iff_cluster acc_iff_cluster
theorem acc_principal_iff_cluster (x : X) (C : Set X) :
AccPt x (π C) β ClusterPt x (π (C \ {x})) := by
rw [acc_iff_cluster, inf_principal, inter_comm, diff_eq]
#align acc_principal_iff_cluster acc_principal_iff_cluster
theorem accPt_iff_nhds (x : X) (C : Set X) : AccPt x (π C) β β U β π x, β y β U β© C, y β x := by
simp [acc_principal_iff_cluster, clusterPt_principal_iff, Set.Nonempty, exists_prop, and_assoc,
@and_comm (Β¬_ = x)]
#align acc_pt_iff_nhds accPt_iff_nhds
theorem accPt_iff_frequently (x : X) (C : Set X) : AccPt x (π C) β βαΆ y in π x, y β x β§ y β C := by
simp [acc_principal_iff_cluster, clusterPt_principal_iff_frequently, and_comm]
#align acc_pt_iff_frequently accPt_iff_frequently
theorem AccPt.mono {F G : Filter X} (h : AccPt x F) (hFG : F β€ G) : AccPt x G :=
NeBot.mono h (inf_le_inf_left _ hFG)
#align acc_pt.mono AccPt.mono
theorem interior_eq_nhds' : interior s = { x | s β π x } :=
Set.ext fun x => by simp only [mem_interior, mem_nhds_iff, mem_setOf_eq]
#align interior_eq_nhds' interior_eq_nhds'
theorem interior_eq_nhds : interior s = { x | π x β€ π s } :=
interior_eq_nhds'.trans <| by simp only [le_principal_iff]
#align interior_eq_nhds interior_eq_nhds
@[simp]
theorem interior_mem_nhds : interior s β π x β s β π x :=
β¨fun h => mem_of_superset h interior_subset, fun h =>
IsOpen.mem_nhds isOpen_interior (mem_interior_iff_mem_nhds.2 h)β©
#align interior_mem_nhds interior_mem_nhds
theorem interior_setOf_eq {p : X β Prop} : interior { x | p x } = { x | βαΆ y in π x, p y } :=
interior_eq_nhds'
#align interior_set_of_eq interior_setOf_eq
theorem isOpen_setOf_eventually_nhds {p : X β Prop} : IsOpen { x | βαΆ y in π x, p y } := by
simp only [β interior_setOf_eq, isOpen_interior]
#align is_open_set_of_eventually_nhds isOpen_setOf_eventually_nhds
theorem subset_interior_iff_nhds {V : Set X} : s β interior V β β x β s, V β π x := by
simp_rw [subset_def, mem_interior_iff_mem_nhds]
#align subset_interior_iff_nhds subset_interior_iff_nhds
theorem isOpen_iff_nhds : IsOpen s β β x β s, π x β€ π s :=
calc
IsOpen s β s β interior s := subset_interior_iff_isOpen.symm
_ β β x β s, π x β€ π s := by simp_rw [interior_eq_nhds, subset_def, mem_setOf]
#align is_open_iff_nhds isOpen_iff_nhds
theorem TopologicalSpace.ext_iff_nhds {t t' : TopologicalSpace X} :
t = t' β β x, @nhds _ t x = @nhds _ t' x :=
β¨fun H x β¦ congrFun (congrArg _ H) _, fun H β¦ by ext; simp_rw [@isOpen_iff_nhds _ _ _, H]β©
alias β¨_, TopologicalSpace.ext_nhdsβ© := TopologicalSpace.ext_iff_nhds
theorem isOpen_iff_mem_nhds : IsOpen s β β x β s, s β π x :=
isOpen_iff_nhds.trans <| forall_congr' fun _ => imp_congr_right fun _ => le_principal_iff
#align is_open_iff_mem_nhds isOpen_iff_mem_nhds
theorem isOpen_iff_eventually : IsOpen s β β x, x β s β βαΆ y in π x, y β s :=
isOpen_iff_mem_nhds
#align is_open_iff_eventually isOpen_iff_eventually
theorem isOpen_iff_ultrafilter :
IsOpen s β β x β s, β (l : Ultrafilter X), βl β€ π x β s β l := by
simp_rw [isOpen_iff_mem_nhds, β mem_iff_ultrafilter]
#align is_open_iff_ultrafilter isOpen_iff_ultrafilter
theorem isOpen_singleton_iff_nhds_eq_pure (x : X) : IsOpen ({x} : Set X) β π x = pure x := by
constructor
Β· intro h
apply le_antisymm _ (pure_le_nhds x)
rw [le_pure_iff]
exact h.mem_nhds (mem_singleton x)
Β· intro h
simp [isOpen_iff_nhds, h]
#align is_open_singleton_iff_nhds_eq_pure isOpen_singleton_iff_nhds_eq_pure
theorem isOpen_singleton_iff_punctured_nhds (x : X) : IsOpen ({x} : Set X) β π[β ] x = β₯ := by
rw [isOpen_singleton_iff_nhds_eq_pure, nhdsWithin, β mem_iff_inf_principal_compl, β le_pure_iff,
nhds_neBot.le_pure_iff]
#align is_open_singleton_iff_punctured_nhds isOpen_singleton_iff_punctured_nhds
theorem mem_closure_iff_frequently : x β closure s β βαΆ x in π x, x β s := by
rw [Filter.Frequently, Filter.Eventually, β mem_interior_iff_mem_nhds,
closure_eq_compl_interior_compl, mem_compl_iff, compl_def]
#align mem_closure_iff_frequently mem_closure_iff_frequently
alias β¨_, Filter.Frequently.mem_closureβ© := mem_closure_iff_frequently
#align filter.frequently.mem_closure Filter.Frequently.mem_closure
theorem isClosed_iff_frequently : IsClosed s β β x, (βαΆ y in π x, y β s) β x β s := by
rw [β closure_subset_iff_isClosed]
refine forall_congr' fun x => ?_
rw [mem_closure_iff_frequently]
#align is_closed_iff_frequently isClosed_iff_frequently
theorem isClosed_setOf_clusterPt {f : Filter X} : IsClosed { x | ClusterPt x f } := by
simp only [ClusterPt, inf_neBot_iff_frequently_left, setOf_forall, imp_iff_not_or]
refine isClosed_iInter fun p => IsClosed.union ?_ ?_ <;> apply isClosed_compl_iff.2
exacts [isOpen_setOf_eventually_nhds, isOpen_const]
#align is_closed_set_of_cluster_pt isClosed_setOf_clusterPt
theorem mem_closure_iff_clusterPt : x β closure s β ClusterPt x (π s) :=
mem_closure_iff_frequently.trans clusterPt_principal_iff_frequently.symm
#align mem_closure_iff_cluster_pt mem_closure_iff_clusterPt
theorem mem_closure_iff_nhds_ne_bot : x β closure s β π x β π s β β₯ :=
mem_closure_iff_clusterPt.trans neBot_iff
#align mem_closure_iff_nhds_ne_bot mem_closure_iff_nhds_ne_bot
@[deprecated (since := "2024-01-28")]
alias mem_closure_iff_nhds_neBot := mem_closure_iff_nhds_ne_bot
theorem mem_closure_iff_nhdsWithin_neBot : x β closure s β NeBot (π[s] x) :=
mem_closure_iff_clusterPt
#align mem_closure_iff_nhds_within_ne_bot mem_closure_iff_nhdsWithin_neBot
lemma not_mem_closure_iff_nhdsWithin_eq_bot : x β closure s β π[s] x = β₯ := by
rw [mem_closure_iff_nhdsWithin_neBot, not_neBot]
theorem dense_compl_singleton (x : X) [NeBot (π[β ] x)] : Dense ({x}αΆ : Set X) := by
intro y
rcases eq_or_ne y x with (rfl | hne)
Β· rwa [mem_closure_iff_nhdsWithin_neBot]
Β· exact subset_closure hne
#align dense_compl_singleton dense_compl_singleton
-- Porting note (#10618): was a `@[simp]` lemma but `simp` can prove it
theorem closure_compl_singleton (x : X) [NeBot (π[β ] x)] : closure {x}αΆ = (univ : Set X) :=
(dense_compl_singleton x).closure_eq
#align closure_compl_singleton closure_compl_singleton
@[simp]
theorem interior_singleton (x : X) [NeBot (π[β ] x)] : interior {x} = (β
: Set X) :=
interior_eq_empty_iff_dense_compl.2 (dense_compl_singleton x)
#align interior_singleton interior_singleton
theorem not_isOpen_singleton (x : X) [NeBot (π[β ] x)] : Β¬IsOpen ({x} : Set X) :=
dense_compl_singleton_iff_not_open.1 (dense_compl_singleton x)
#align not_is_open_singleton not_isOpen_singleton
theorem closure_eq_cluster_pts : closure s = { a | ClusterPt a (π s) } :=
Set.ext fun _ => mem_closure_iff_clusterPt
#align closure_eq_cluster_pts closure_eq_cluster_pts
theorem mem_closure_iff_nhds : x β closure s β β t β π x, (t β© s).Nonempty :=
mem_closure_iff_clusterPt.trans clusterPt_principal_iff
#align mem_closure_iff_nhds mem_closure_iff_nhds
theorem mem_closure_iff_nhds' : x β closure s β β t β π x, β y : s, βy β t := by
simp only [mem_closure_iff_nhds, Set.inter_nonempty_iff_exists_right, SetCoe.exists, exists_prop]
#align mem_closure_iff_nhds' mem_closure_iff_nhds'
theorem mem_closure_iff_comap_neBot :
x β closure s β NeBot (comap ((β) : s β X) (π x)) := by
simp_rw [mem_closure_iff_nhds, comap_neBot_iff, Set.inter_nonempty_iff_exists_right,
SetCoe.exists, exists_prop]
#align mem_closure_iff_comap_ne_bot mem_closure_iff_comap_neBot
theorem mem_closure_iff_nhds_basis' {p : ΞΉ β Prop} {s : ΞΉ β Set X} (h : (π x).HasBasis p s) :
x β closure t β β i, p i β (s i β© t).Nonempty :=
mem_closure_iff_clusterPt.trans <|
(h.clusterPt_iff (hasBasis_principal _)).trans <| by simp only [exists_prop, forall_const]
#align mem_closure_iff_nhds_basis' mem_closure_iff_nhds_basis'
theorem mem_closure_iff_nhds_basis {p : ΞΉ β Prop} {s : ΞΉ β Set X} (h : (π x).HasBasis p s) :
x β closure t β β i, p i β β y β t, y β s i :=
(mem_closure_iff_nhds_basis' h).trans <| by
simp only [Set.Nonempty, mem_inter_iff, exists_prop, and_comm]
#align mem_closure_iff_nhds_basis mem_closure_iff_nhds_basis
theorem clusterPt_iff_forall_mem_closure {F : Filter X} :
ClusterPt x F β β s β F, x β closure s := by
simp_rw [ClusterPt, inf_neBot_iff, mem_closure_iff_nhds]
rw [forallβ_swap]
theorem clusterPt_iff_lift'_closure {F : Filter X} :
ClusterPt x F β pure x β€ (F.lift' closure) := by
simp_rw [clusterPt_iff_forall_mem_closure,
(hasBasis_pure _).le_basis_iff F.basis_sets.lift'_closure, id, singleton_subset_iff, true_and,
exists_const]
theorem clusterPt_iff_lift'_closure' {F : Filter X} :
ClusterPt x F β (F.lift' closure β pure x).NeBot := by
rw [clusterPt_iff_lift'_closure, β Ultrafilter.coe_pure, inf_comm, Ultrafilter.inf_neBot_iff]
@[simp]
theorem clusterPt_lift'_closure_iff {F : Filter X} :
ClusterPt x (F.lift' closure) β ClusterPt x F := by
simp [clusterPt_iff_lift'_closure, lift'_lift'_assoc (monotone_closure X) (monotone_closure X)]
| Mathlib/Topology/Basic.lean | 1,332 | 1,334 | theorem mem_closure_iff_ultrafilter :
x β closure s β β u : Ultrafilter X, s β u β§ βu β€ π x := by |
simp [closure_eq_cluster_pts, ClusterPt, β exists_ultrafilter_iff, and_comm]
|
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {Ξ± : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField Ξ±] {a : Ξ±}
@[simp]
theorem preimage_mul_const_Iio (a : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
theorem preimage_mul_const_Ioo (a b : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Ioo a b = Ioo (a / c) (b / c) := by simp [β Ioi_inter_Iio, h]
#align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 624 | 625 | theorem preimage_mul_const_Ioc (a b : Ξ±) {c : Ξ±} (h : 0 < c) :
(fun x => x * c) β»ΒΉ' Ioc a b = Ioc (a / c) (b / c) := by | simp [β Ioi_inter_Iic, h]
|
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Polynomial.RingDivision
#align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace Polynomial
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] (p q : R[X])
noncomputable def mirror :=
p.reverse * X ^ p.natTrailingDegree
#align polynomial.mirror Polynomial.mirror
@[simp]
theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror]
#align polynomial.mirror_zero Polynomial.mirror_zero
theorem mirror_monomial (n : β) (a : R) : (monomial n a).mirror = monomial n a := by
classical
by_cases ha : a = 0
Β· rw [ha, monomial_zero_right, mirror_zero]
Β· rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, β
C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero,
mul_one]
#align polynomial.mirror_monomial Polynomial.mirror_monomial
theorem mirror_C (a : R) : (C a).mirror = C a :=
mirror_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_C Polynomial.mirror_C
theorem mirror_X : X.mirror = (X : R[X]) :=
mirror_monomial 1 (1 : R)
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_X Polynomial.mirror_X
theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by
by_cases hp : p = 0
Β· rw [hp, mirror_zero]
nontriviality R
rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow,
tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree]
rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero]
#align polynomial.mirror_nat_degree Polynomial.mirror_natDegree
theorem mirror_natTrailingDegree : p.mirror.natTrailingDegree = p.natTrailingDegree := by
by_cases hp : p = 0
Β· rw [hp, mirror_zero]
Β· rw [mirror, natTrailingDegree_mul_X_pow ((mt reverse_eq_zero.mp) hp),
natTrailingDegree_reverse, zero_add]
#align polynomial.mirror_nat_trailing_degree Polynomial.mirror_natTrailingDegree
| Mathlib/Algebra/Polynomial/Mirror.lean | 82 | 97 | theorem coeff_mirror (n : β) :
p.mirror.coeff n = p.coeff (revAt (p.natDegree + p.natTrailingDegree) n) := by |
by_cases h2 : p.natDegree < n
Β· rw [coeff_eq_zero_of_natDegree_lt (by rwa [mirror_natDegree])]
by_cases h1 : n β€ p.natDegree + p.natTrailingDegree
Β· rw [revAt_le h1, coeff_eq_zero_of_lt_natTrailingDegree]
exact (tsub_lt_iff_left h1).mpr (Nat.add_lt_add_right h2 _)
Β· rw [β revAtFun_eq, revAtFun, if_neg h1, coeff_eq_zero_of_natDegree_lt h2]
rw [not_lt] at h2
rw [revAt_le (h2.trans (Nat.le_add_right _ _))]
by_cases h3 : p.natTrailingDegree β€ n
Β· rw [β tsub_add_eq_add_tsub h2, β tsub_tsub_assoc h2 h3, mirror, coeff_mul_X_pow', if_pos h3,
coeff_reverse, revAt_le (tsub_le_self.trans h2)]
rw [not_le] at h3
rw [coeff_eq_zero_of_natDegree_lt (lt_tsub_iff_right.mpr (Nat.add_lt_add_left h3 _))]
exact coeff_eq_zero_of_lt_natTrailingDegree (by rwa [mirror_natTrailingDegree])
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace EuclideanGeometry
open InnerProductGeometry
variable {V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace β V] [MetricSpace P]
[NormedAddTorsor V P]
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 360 | 365 | theorem dist_sq_eq_dist_sq_add_dist_sq_iff_angle_eq_pi_div_two (p1 p2 p3 : P) :
dist p1 p3 * dist p1 p3 = dist p1 p2 * dist p1 p2 + dist p3 p2 * dist p3 p2 β
β p1 p2 p3 = Ο / 2 := by |
erw [dist_comm p3 p2, dist_eq_norm_vsub V p1 p3, dist_eq_norm_vsub V p1 p2,
dist_eq_norm_vsub V p2 p3, β norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two,
vsub_sub_vsub_cancel_right p1, β neg_vsub_eq_vsub_rev p2 p3, norm_neg]
|
import Mathlib.Probability.Kernel.CondDistrib
#align_import probability.kernel.condexp from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d"
open MeasureTheory Set Filter TopologicalSpace
open scoped ENNReal MeasureTheory ProbabilityTheory
namespace ProbabilityTheory
variable {Ξ© F : Type*} {m : MeasurableSpace Ξ©} [mΞ© : MeasurableSpace Ξ©]
[StandardBorelSpace Ξ©] [Nonempty Ξ©] {ΞΌ : Measure Ξ©} [IsFiniteMeasure ΞΌ]
noncomputable irreducible_def condexpKernel (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ]
(m : MeasurableSpace Ξ©) : @kernel Ξ© Ξ© m mΞ© :=
kernel.comap (@condDistrib Ξ© Ξ© Ξ© mΞ© _ _ mΞ© (m β mΞ©) id id ΞΌ _) id
(measurable_id'' (inf_le_left : m β mΞ© β€ m))
#align probability_theory.condexp_kernel ProbabilityTheory.condexpKernel
lemma condexpKernel_apply_eq_condDistrib {Ο : Ξ©} :
condexpKernel ΞΌ m Ο = @condDistrib Ξ© Ξ© Ξ© mΞ© _ _ mΞ© (m β mΞ©) id id ΞΌ _ (id Ο) := by
simp_rw [condexpKernel, kernel.comap_apply]
instance : IsMarkovKernel (condexpKernel ΞΌ m) := by simp only [condexpKernel]; infer_instance
section Integrability
variable [NormedAddCommGroup F] {f : Ξ© β F}
theorem _root_.MeasureTheory.Integrable.condexpKernel_ae (hf_int : Integrable f ΞΌ) :
βα΅ Ο βΞΌ, Integrable f (condexpKernel ΞΌ m Ο) := by
rw [condexpKernel]
convert Integrable.condDistrib_ae
(aemeasurable_id'' ΞΌ (inf_le_right : m β mΞ© β€ mΞ©)) aemeasurable_id
(hf_int.comp_snd_map_prod_id (inf_le_right : m β mΞ© β€ mΞ©)) using 1
#align measure_theory.integrable.condexp_kernel_ae MeasureTheory.Integrable.condexpKernel_ae
theorem _root_.MeasureTheory.Integrable.integral_norm_condexpKernel (hf_int : Integrable f ΞΌ) :
Integrable (fun Ο => β« y, βf yβ βcondexpKernel ΞΌ m Ο) ΞΌ := by
rw [condexpKernel]
convert Integrable.integral_norm_condDistrib
(aemeasurable_id'' ΞΌ (inf_le_right : m β mΞ© β€ mΞ©)) aemeasurable_id
(hf_int.comp_snd_map_prod_id (inf_le_right : m β mΞ© β€ mΞ©)) using 1
#align measure_theory.integrable.integral_norm_condexp_kernel MeasureTheory.Integrable.integral_norm_condexpKernel
| Mathlib/Probability/Kernel/Condexp.lean | 141 | 147 | theorem _root_.MeasureTheory.Integrable.norm_integral_condexpKernel [NormedSpace β F]
(hf_int : Integrable f ΞΌ) :
Integrable (fun Ο => ββ« y, f y βcondexpKernel ΞΌ m Οβ) ΞΌ := by |
rw [condexpKernel]
convert Integrable.norm_integral_condDistrib
(aemeasurable_id'' ΞΌ (inf_le_right : m β mΞ© β€ mΞ©)) aemeasurable_id
(hf_int.comp_snd_map_prod_id (inf_le_right : m β mΞ© β€ mΞ©)) using 1
|
import Mathlib.Algebra.GroupPower.IterateHom
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Iterate
import Mathlib.Order.SemiconjSup
import Mathlib.Tactic.Monotonicity
import Mathlib.Topology.Order.MonotoneContinuity
#align_import dynamics.circle.rotation_number.translation_number from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical
open Filter Set Int Topology
open Function hiding Commute
structure CircleDeg1Lift extends β βo β : Type where
map_add_one' : β x, toFun (x + 1) = toFun x + 1
#align circle_deg1_lift CircleDeg1Lift
namespace CircleDeg1Lift
instance : FunLike CircleDeg1Lift β β where
coe f := f.toFun
coe_injective' | β¨β¨_, _β©, _β©, β¨β¨_, _β©, _β©, rfl => rfl
instance : OrderHomClass CircleDeg1Lift β β where
map_rel f _ _ h := f.monotone' h
@[simp] theorem coe_mk (f h) : β(mk f h) = f := rfl
#align circle_deg1_lift.coe_mk CircleDeg1Lift.coe_mk
variable (f g : CircleDeg1Lift)
@[simp] theorem coe_toOrderHom : βf.toOrderHom = f := rfl
protected theorem monotone : Monotone f := f.monotone'
#align circle_deg1_lift.monotone CircleDeg1Lift.monotone
@[mono] theorem mono {x y} (h : x β€ y) : f x β€ f y := f.monotone h
#align circle_deg1_lift.mono CircleDeg1Lift.mono
theorem strictMono_iff_injective : StrictMono f β Injective f :=
f.monotone.strictMono_iff_injective
#align circle_deg1_lift.strict_mono_iff_injective CircleDeg1Lift.strictMono_iff_injective
@[simp]
theorem map_add_one : β x, f (x + 1) = f x + 1 :=
f.map_add_one'
#align circle_deg1_lift.map_add_one CircleDeg1Lift.map_add_one
@[simp]
theorem map_one_add (x : β) : f (1 + x) = 1 + f x := by rw [add_comm, map_add_one, add_comm 1]
#align circle_deg1_lift.map_one_add CircleDeg1Lift.map_one_add
#noalign circle_deg1_lift.coe_inj -- Use `DFunLike.coe_inj`
@[ext]
theorem ext β¦f g : CircleDeg1Liftβ¦ (h : β x, f x = g x) : f = g :=
DFunLike.ext f g h
#align circle_deg1_lift.ext CircleDeg1Lift.ext
theorem ext_iff {f g : CircleDeg1Lift} : f = g β β x, f x = g x :=
DFunLike.ext_iff
#align circle_deg1_lift.ext_iff CircleDeg1Lift.ext_iff
instance : Monoid CircleDeg1Lift where
mul f g :=
{ toOrderHom := f.1.comp g.1
map_add_one' := fun x => by simp [map_add_one] }
one := β¨.id, fun _ => rflβ©
mul_one f := rfl
one_mul f := rfl
mul_assoc fβ fβ fβ := DFunLike.coe_injective rfl
instance : Inhabited CircleDeg1Lift := β¨1β©
@[simp]
theorem coe_mul : β(f * g) = f β g :=
rfl
#align circle_deg1_lift.coe_mul CircleDeg1Lift.coe_mul
theorem mul_apply (x) : (f * g) x = f (g x) :=
rfl
#align circle_deg1_lift.mul_apply CircleDeg1Lift.mul_apply
@[simp]
theorem coe_one : β(1 : CircleDeg1Lift) = id :=
rfl
#align circle_deg1_lift.coe_one CircleDeg1Lift.coe_one
instance unitsHasCoeToFun : CoeFun CircleDeg1LiftΛ£ fun _ => β β β :=
β¨fun f => β(f : CircleDeg1Lift)β©
#align circle_deg1_lift.units_has_coe_to_fun CircleDeg1Lift.unitsHasCoeToFun
#noalign circle_deg1_lift.units_coe -- now LHS = RHS
@[simp]
theorem units_inv_apply_apply (f : CircleDeg1LiftΛ£) (x : β) :
(fβ»ΒΉ : CircleDeg1LiftΛ£) (f x) = x := by simp only [β mul_apply, f.inv_mul, coe_one, id]
#align circle_deg1_lift.units_inv_apply_apply CircleDeg1Lift.units_inv_apply_apply
@[simp]
theorem units_apply_inv_apply (f : CircleDeg1LiftΛ£) (x : β) :
f ((fβ»ΒΉ : CircleDeg1LiftΛ£) x) = x := by simp only [β mul_apply, f.mul_inv, coe_one, id]
#align circle_deg1_lift.units_apply_inv_apply CircleDeg1Lift.units_apply_inv_apply
def toOrderIso : CircleDeg1LiftΛ£ β* β βo β where
toFun f :=
{ toFun := f
invFun := βfβ»ΒΉ
left_inv := units_inv_apply_apply f
right_inv := units_apply_inv_apply f
map_rel_iff' := β¨fun h => by simpa using mono (βfβ»ΒΉ) h, mono fβ© }
map_one' := rfl
map_mul' f g := rfl
#align circle_deg1_lift.to_order_iso CircleDeg1Lift.toOrderIso
@[simp]
theorem coe_toOrderIso (f : CircleDeg1LiftΛ£) : β(toOrderIso f) = f :=
rfl
#align circle_deg1_lift.coe_to_order_iso CircleDeg1Lift.coe_toOrderIso
@[simp]
theorem coe_toOrderIso_symm (f : CircleDeg1LiftΛ£) :
β(toOrderIso f).symm = (fβ»ΒΉ : CircleDeg1LiftΛ£) :=
rfl
#align circle_deg1_lift.coe_to_order_iso_symm CircleDeg1Lift.coe_toOrderIso_symm
@[simp]
theorem coe_toOrderIso_inv (f : CircleDeg1LiftΛ£) : β(toOrderIso f)β»ΒΉ = (fβ»ΒΉ : CircleDeg1LiftΛ£) :=
rfl
#align circle_deg1_lift.coe_to_order_iso_inv CircleDeg1Lift.coe_toOrderIso_inv
theorem isUnit_iff_bijective {f : CircleDeg1Lift} : IsUnit f β Bijective f :=
β¨fun β¨u, hβ© => h βΈ (toOrderIso u).bijective, fun h =>
Units.isUnit
{ val := f
inv :=
{ toFun := (Equiv.ofBijective f h).symm
monotone' := fun x y hxy =>
(f.strictMono_iff_injective.2 h.1).le_iff_le.1
(by simp only [Equiv.ofBijective_apply_symm_apply f h, hxy])
map_add_one' := fun x =>
h.1 <| by simp only [Equiv.ofBijective_apply_symm_apply f, f.map_add_one] }
val_inv := ext <| Equiv.ofBijective_apply_symm_apply f h
inv_val := ext <| Equiv.ofBijective_symm_apply_apply f h }β©
#align circle_deg1_lift.is_unit_iff_bijective CircleDeg1Lift.isUnit_iff_bijective
theorem coe_pow : β n : β, β(f ^ n) = f^[n]
| 0 => rfl
| n + 1 => by
ext x
simp [coe_pow n, pow_succ]
#align circle_deg1_lift.coe_pow CircleDeg1Lift.coe_pow
theorem semiconjBy_iff_semiconj {f gβ gβ : CircleDeg1Lift} :
SemiconjBy f gβ gβ β Semiconj f gβ gβ :=
ext_iff
#align circle_deg1_lift.semiconj_by_iff_semiconj CircleDeg1Lift.semiconjBy_iff_semiconj
theorem commute_iff_commute {f g : CircleDeg1Lift} : Commute f g β Function.Commute f g :=
ext_iff
#align circle_deg1_lift.commute_iff_commute CircleDeg1Lift.commute_iff_commute
def translate : Multiplicative β β* CircleDeg1LiftΛ£ := MonoidHom.toHomUnits <|
{ toFun := fun x =>
β¨β¨fun y => Multiplicative.toAdd x + y, fun _ _ h => add_le_add_left h _β©, fun _ =>
(add_assoc _ _ _).symmβ©
map_one' := ext <| zero_add
map_mul' := fun _ _ => ext <| add_assoc _ _ }
#align circle_deg1_lift.translate CircleDeg1Lift.translate
@[simp]
theorem translate_apply (x y : β) : translate (Multiplicative.ofAdd x) y = x + y :=
rfl
#align circle_deg1_lift.translate_apply CircleDeg1Lift.translate_apply
@[simp]
theorem translate_inv_apply (x y : β) : (translate <| Multiplicative.ofAdd x)β»ΒΉ y = -x + y :=
rfl
#align circle_deg1_lift.translate_inv_apply CircleDeg1Lift.translate_inv_apply
@[simp]
theorem translate_zpow (x : β) (n : β€) :
translate (Multiplicative.ofAdd x) ^ n = translate (Multiplicative.ofAdd <| βn * x) := by
simp only [β zsmul_eq_mul, ofAdd_zsmul, MonoidHom.map_zpow]
#align circle_deg1_lift.translate_zpow CircleDeg1Lift.translate_zpow
@[simp]
theorem translate_pow (x : β) (n : β) :
translate (Multiplicative.ofAdd x) ^ n = translate (Multiplicative.ofAdd <| βn * x) :=
translate_zpow x n
#align circle_deg1_lift.translate_pow CircleDeg1Lift.translate_pow
@[simp]
theorem translate_iterate (x : β) (n : β) :
(translate (Multiplicative.ofAdd x))^[n] = translate (Multiplicative.ofAdd <| βn * x) := by
rw [β coe_pow, β Units.val_pow_eq_pow_val, translate_pow]
#align circle_deg1_lift.translate_iterate CircleDeg1Lift.translate_iterate
theorem commute_nat_add (n : β) : Function.Commute f (n + Β·) := by
simpa only [nsmul_one, add_left_iterate] using Function.Commute.iterate_right f.map_one_add n
#align circle_deg1_lift.commute_nat_add CircleDeg1Lift.commute_nat_add
theorem commute_add_nat (n : β) : Function.Commute f (Β· + n) := by
simp only [add_comm _ (n : β), f.commute_nat_add n]
#align circle_deg1_lift.commute_add_nat CircleDeg1Lift.commute_add_nat
theorem commute_sub_nat (n : β) : Function.Commute f (Β· - n) := by
simpa only [sub_eq_add_neg] using
(f.commute_add_nat n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv
#align circle_deg1_lift.commute_sub_nat CircleDeg1Lift.commute_sub_nat
theorem commute_add_int : β n : β€, Function.Commute f (Β· + n)
| (n : β) => f.commute_add_nat n
| -[n+1] => by simpa [sub_eq_add_neg] using f.commute_sub_nat (n + 1)
#align circle_deg1_lift.commute_add_int CircleDeg1Lift.commute_add_int
theorem commute_int_add (n : β€) : Function.Commute f (n + Β·) := by
simpa only [add_comm _ (n : β)] using f.commute_add_int n
#align circle_deg1_lift.commute_int_add CircleDeg1Lift.commute_int_add
theorem commute_sub_int (n : β€) : Function.Commute f (Β· - n) := by
simpa only [sub_eq_add_neg] using
(f.commute_add_int n).inverses_right (Equiv.addRight _).right_inv (Equiv.addRight _).left_inv
#align circle_deg1_lift.commute_sub_int CircleDeg1Lift.commute_sub_int
@[simp]
theorem map_int_add (m : β€) (x : β) : f (m + x) = m + f x :=
f.commute_int_add m x
#align circle_deg1_lift.map_int_add CircleDeg1Lift.map_int_add
@[simp]
theorem map_add_int (x : β) (m : β€) : f (x + m) = f x + m :=
f.commute_add_int m x
#align circle_deg1_lift.map_add_int CircleDeg1Lift.map_add_int
@[simp]
theorem map_sub_int (x : β) (n : β€) : f (x - n) = f x - n :=
f.commute_sub_int n x
#align circle_deg1_lift.map_sub_int CircleDeg1Lift.map_sub_int
@[simp]
theorem map_add_nat (x : β) (n : β) : f (x + n) = f x + n :=
f.map_add_int x n
#align circle_deg1_lift.map_add_nat CircleDeg1Lift.map_add_nat
@[simp]
theorem map_nat_add (n : β) (x : β) : f (n + x) = n + f x :=
f.map_int_add n x
#align circle_deg1_lift.map_nat_add CircleDeg1Lift.map_nat_add
@[simp]
theorem map_sub_nat (x : β) (n : β) : f (x - n) = f x - n :=
f.map_sub_int x n
#align circle_deg1_lift.map_sub_nat CircleDeg1Lift.map_sub_nat
theorem map_int_of_map_zero (n : β€) : f n = f 0 + n := by rw [β f.map_add_int, zero_add]
#align circle_deg1_lift.map_int_of_map_zero CircleDeg1Lift.map_int_of_map_zero
@[simp]
theorem map_fract_sub_fract_eq (x : β) : f (fract x) - fract x = f x - x := by
rw [Int.fract, f.map_sub_int, sub_sub_sub_cancel_right]
#align circle_deg1_lift.map_fract_sub_fract_eq CircleDeg1Lift.map_fract_sub_fract_eq
noncomputable instance : Lattice CircleDeg1Lift where
sup f g :=
{ toFun := fun x => max (f x) (g x)
monotone' := fun x y h => max_le_max (f.mono h) (g.mono h)
-- TODO: generalize to `Monotone.max`
map_add_one' := fun x => by simp [max_add_add_right] }
le f g := β x, f x β€ g x
le_refl f x := le_refl (f x)
le_trans fβ fβ fβ hββ hββ x := le_trans (hββ x) (hββ x)
le_antisymm fβ fβ hββ hββ := ext fun x => le_antisymm (hββ x) (hββ x)
le_sup_left f g x := le_max_left (f x) (g x)
le_sup_right f g x := le_max_right (f x) (g x)
sup_le fβ fβ fβ hβ hβ x := max_le (hβ x) (hβ x)
inf f g :=
{ toFun := fun x => min (f x) (g x)
monotone' := fun x y h => min_le_min (f.mono h) (g.mono h)
map_add_one' := fun x => by simp [min_add_add_right] }
inf_le_left f g x := min_le_left (f x) (g x)
inf_le_right f g x := min_le_right (f x) (g x)
le_inf fβ fβ fβ hβ hβ x := le_min (hβ x) (hβ x)
@[simp]
theorem sup_apply (x : β) : (f β g) x = max (f x) (g x) :=
rfl
#align circle_deg1_lift.sup_apply CircleDeg1Lift.sup_apply
@[simp]
theorem inf_apply (x : β) : (f β g) x = min (f x) (g x) :=
rfl
#align circle_deg1_lift.inf_apply CircleDeg1Lift.inf_apply
theorem iterate_monotone (n : β) : Monotone fun f : CircleDeg1Lift => f^[n] := fun f _ h =>
f.monotone.iterate_le_of_le h _
#align circle_deg1_lift.iterate_monotone CircleDeg1Lift.iterate_monotone
theorem iterate_mono {f g : CircleDeg1Lift} (h : f β€ g) (n : β) : f^[n] β€ g^[n] :=
iterate_monotone n h
#align circle_deg1_lift.iterate_mono CircleDeg1Lift.iterate_mono
theorem pow_mono {f g : CircleDeg1Lift} (h : f β€ g) (n : β) : f ^ n β€ g ^ n := fun x => by
simp only [coe_pow, iterate_mono h n x]
#align circle_deg1_lift.pow_mono CircleDeg1Lift.pow_mono
theorem pow_monotone (n : β) : Monotone fun f : CircleDeg1Lift => f ^ n := fun _ _ h => pow_mono h n
#align circle_deg1_lift.pow_monotone CircleDeg1Lift.pow_monotone
theorem map_le_of_map_zero (x : β) : f x β€ f 0 + βxβ :=
calc
f x β€ f βxβ := f.monotone <| le_ceil _
_ = f 0 + βxβ := f.map_int_of_map_zero _
#align circle_deg1_lift.map_le_of_map_zero CircleDeg1Lift.map_le_of_map_zero
theorem map_map_zero_le : f (g 0) β€ f 0 + βg 0β :=
f.map_le_of_map_zero (g 0)
#align circle_deg1_lift.map_map_zero_le CircleDeg1Lift.map_map_zero_le
theorem floor_map_map_zero_le : βf (g 0)β β€ βf 0β + βg 0β :=
calc
βf (g 0)β β€ βf 0 + βg 0ββ := floor_mono <| f.map_map_zero_le g
_ = βf 0β + βg 0β := floor_add_int _ _
#align circle_deg1_lift.floor_map_map_zero_le CircleDeg1Lift.floor_map_map_zero_le
theorem ceil_map_map_zero_le : βf (g 0)β β€ βf 0β + βg 0β :=
calc
βf (g 0)β β€ βf 0 + βg 0ββ := ceil_mono <| f.map_map_zero_le g
_ = βf 0β + βg 0β := ceil_add_int _ _
#align circle_deg1_lift.ceil_map_map_zero_le CircleDeg1Lift.ceil_map_map_zero_le
theorem map_map_zero_lt : f (g 0) < f 0 + g 0 + 1 :=
calc
f (g 0) β€ f 0 + βg 0β := f.map_map_zero_le g
_ < f 0 + (g 0 + 1) := add_lt_add_left (ceil_lt_add_one _) _
_ = f 0 + g 0 + 1 := (add_assoc _ _ _).symm
#align circle_deg1_lift.map_map_zero_lt CircleDeg1Lift.map_map_zero_lt
theorem le_map_of_map_zero (x : β) : f 0 + βxβ β€ f x :=
calc
f 0 + βxβ = f βxβ := (f.map_int_of_map_zero _).symm
_ β€ f x := f.monotone <| floor_le _
#align circle_deg1_lift.le_map_of_map_zero CircleDeg1Lift.le_map_of_map_zero
theorem le_map_map_zero : f 0 + βg 0β β€ f (g 0) :=
f.le_map_of_map_zero (g 0)
#align circle_deg1_lift.le_map_map_zero CircleDeg1Lift.le_map_map_zero
theorem le_floor_map_map_zero : βf 0β + βg 0β β€ βf (g 0)β :=
calc
βf 0β + βg 0β = βf 0 + βg 0ββ := (floor_add_int _ _).symm
_ β€ βf (g 0)β := floor_mono <| f.le_map_map_zero g
#align circle_deg1_lift.le_floor_map_map_zero CircleDeg1Lift.le_floor_map_map_zero
theorem le_ceil_map_map_zero : βf 0β + βg 0β β€ β(f * g) 0β :=
calc
βf 0β + βg 0β = βf 0 + βg 0ββ := (ceil_add_int _ _).symm
_ β€ βf (g 0)β := ceil_mono <| f.le_map_map_zero g
#align circle_deg1_lift.le_ceil_map_map_zero CircleDeg1Lift.le_ceil_map_map_zero
theorem lt_map_map_zero : f 0 + g 0 - 1 < f (g 0) :=
calc
f 0 + g 0 - 1 = f 0 + (g 0 - 1) := add_sub_assoc _ _ _
_ < f 0 + βg 0β := add_lt_add_left (sub_one_lt_floor _) _
_ β€ f (g 0) := f.le_map_map_zero g
#align circle_deg1_lift.lt_map_map_zero CircleDeg1Lift.lt_map_map_zero
theorem dist_map_map_zero_lt : dist (f 0 + g 0) (f (g 0)) < 1 := by
rw [dist_comm, Real.dist_eq, abs_lt, lt_sub_iff_add_lt', sub_lt_iff_lt_add', β sub_eq_add_neg]
exact β¨f.lt_map_map_zero g, f.map_map_zero_lt gβ©
#align circle_deg1_lift.dist_map_map_zero_lt CircleDeg1Lift.dist_map_map_zero_lt
theorem dist_map_zero_lt_of_semiconj {f gβ gβ : CircleDeg1Lift} (h : Function.Semiconj f gβ gβ) :
dist (gβ 0) (gβ 0) < 2 :=
calc
dist (gβ 0) (gβ 0) β€ dist (gβ 0) (f (gβ 0) - f 0) + dist _ (gβ 0) := dist_triangle _ _ _
_ = dist (f 0 + gβ 0) (f (gβ 0)) + dist (gβ 0 + f 0) (gβ (f 0)) := by
simp only [h.eq, Real.dist_eq, sub_sub, add_comm (f 0), sub_sub_eq_add_sub,
abs_sub_comm (gβ (f 0))]
_ < 1 + 1 := add_lt_add (f.dist_map_map_zero_lt gβ) (gβ.dist_map_map_zero_lt f)
_ = 2 := one_add_one_eq_two
#align circle_deg1_lift.dist_map_zero_lt_of_semiconj CircleDeg1Lift.dist_map_zero_lt_of_semiconj
theorem dist_map_zero_lt_of_semiconjBy {f gβ gβ : CircleDeg1Lift} (h : SemiconjBy f gβ gβ) :
dist (gβ 0) (gβ 0) < 2 :=
dist_map_zero_lt_of_semiconj <| semiconjBy_iff_semiconj.1 h
#align circle_deg1_lift.dist_map_zero_lt_of_semiconj_by CircleDeg1Lift.dist_map_zero_lt_of_semiconjBy
protected theorem tendsto_atBot : Tendsto f atBot atBot :=
tendsto_atBot_mono f.map_le_of_map_zero <| tendsto_atBot_add_const_left _ _ <|
(tendsto_atBot_mono fun x => (ceil_lt_add_one x).le) <|
tendsto_atBot_add_const_right _ _ tendsto_id
#align circle_deg1_lift.tendsto_at_bot CircleDeg1Lift.tendsto_atBot
protected theorem tendsto_atTop : Tendsto f atTop atTop :=
tendsto_atTop_mono f.le_map_of_map_zero <| tendsto_atTop_add_const_left _ _ <|
(tendsto_atTop_mono fun x => (sub_one_lt_floor x).le) <| by
simpa [sub_eq_add_neg] using tendsto_atTop_add_const_right _ _ tendsto_id
#align circle_deg1_lift.tendsto_at_top CircleDeg1Lift.tendsto_atTop
theorem continuous_iff_surjective : Continuous f β Function.Surjective f :=
β¨fun h => h.surjective f.tendsto_atTop f.tendsto_atBot, f.monotone.continuous_of_surjectiveβ©
#align circle_deg1_lift.continuous_iff_surjective CircleDeg1Lift.continuous_iff_surjective
theorem iterate_le_of_map_le_add_int {x : β} {m : β€} (h : f x β€ x + m) (n : β) :
f^[n] x β€ x + n * m := by
simpa only [nsmul_eq_mul, add_right_iterate] using
(f.commute_add_int m).iterate_le_of_map_le f.monotone (monotone_id.add_const (m : β)) h n
#align circle_deg1_lift.iterate_le_of_map_le_add_int CircleDeg1Lift.iterate_le_of_map_le_add_int
theorem le_iterate_of_add_int_le_map {x : β} {m : β€} (h : x + m β€ f x) (n : β) :
x + n * m β€ f^[n] x := by
simpa only [nsmul_eq_mul, add_right_iterate] using
(f.commute_add_int m).symm.iterate_le_of_map_le (monotone_id.add_const (m : β)) f.monotone h n
#align circle_deg1_lift.le_iterate_of_add_int_le_map CircleDeg1Lift.le_iterate_of_add_int_le_map
theorem iterate_eq_of_map_eq_add_int {x : β} {m : β€} (h : f x = x + m) (n : β) :
f^[n] x = x + n * m := by
simpa only [nsmul_eq_mul, add_right_iterate] using (f.commute_add_int m).iterate_eq_of_map_eq n h
#align circle_deg1_lift.iterate_eq_of_map_eq_add_int CircleDeg1Lift.iterate_eq_of_map_eq_add_int
theorem iterate_pos_le_iff {x : β} {m : β€} {n : β} (hn : 0 < n) :
f^[n] x β€ x + n * m β f x β€ x + m := by
simpa only [nsmul_eq_mul, add_right_iterate] using
(f.commute_add_int m).iterate_pos_le_iff_map_le f.monotone (strictMono_id.add_const (m : β)) hn
#align circle_deg1_lift.iterate_pos_le_iff CircleDeg1Lift.iterate_pos_le_iff
theorem iterate_pos_lt_iff {x : β} {m : β€} {n : β} (hn : 0 < n) :
f^[n] x < x + n * m β f x < x + m := by
simpa only [nsmul_eq_mul, add_right_iterate] using
(f.commute_add_int m).iterate_pos_lt_iff_map_lt f.monotone (strictMono_id.add_const (m : β)) hn
#align circle_deg1_lift.iterate_pos_lt_iff CircleDeg1Lift.iterate_pos_lt_iff
| Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean | 600 | 603 | theorem iterate_pos_eq_iff {x : β} {m : β€} {n : β} (hn : 0 < n) :
f^[n] x = x + n * m β f x = x + m := by |
simpa only [nsmul_eq_mul, add_right_iterate] using
(f.commute_add_int m).iterate_pos_eq_iff_map_eq f.monotone (strictMono_id.add_const (m : β)) hn
|
import Mathlib.NumberTheory.FLT.Basic
import Mathlib.NumberTheory.PythagoreanTriples
import Mathlib.RingTheory.Coprime.Lemmas
import Mathlib.Tactic.LinearCombination
#align_import number_theory.fermat4 from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
noncomputable section
open scoped Classical
def Fermat42 (a b c : β€) : Prop :=
a β 0 β§ b β 0 β§ a ^ 4 + b ^ 4 = c ^ 2
#align fermat_42 Fermat42
namespace Fermat42
theorem comm {a b c : β€} : Fermat42 a b c β Fermat42 b a c := by
delta Fermat42
rw [add_comm]
tauto
#align fermat_42.comm Fermat42.comm
theorem mul {a b c k : β€} (hk0 : k β 0) :
Fermat42 a b c β Fermat42 (k * a) (k * b) (k ^ 2 * c) := by
delta Fermat42
constructor
Β· intro f42
constructor
Β· exact mul_ne_zero hk0 f42.1
constructor
Β· exact mul_ne_zero hk0 f42.2.1
Β· have H : a ^ 4 + b ^ 4 = c ^ 2 := f42.2.2
linear_combination k ^ 4 * H
Β· intro f42
constructor
Β· exact right_ne_zero_of_mul f42.1
constructor
Β· exact right_ne_zero_of_mul f42.2.1
apply (mul_right_inj' (pow_ne_zero 4 hk0)).mp
linear_combination f42.2.2
#align fermat_42.mul Fermat42.mul
theorem ne_zero {a b c : β€} (h : Fermat42 a b c) : c β 0 := by
apply ne_zero_pow two_ne_zero _; apply ne_of_gt
rw [β h.2.2, (by ring : a ^ 4 + b ^ 4 = (a ^ 2) ^ 2 + (b ^ 2) ^ 2)]
exact
add_pos (sq_pos_of_ne_zero (pow_ne_zero 2 h.1)) (sq_pos_of_ne_zero (pow_ne_zero 2 h.2.1))
#align fermat_42.ne_zero Fermat42.ne_zero
def Minimal (a b c : β€) : Prop :=
Fermat42 a b c β§ β a1 b1 c1 : β€, Fermat42 a1 b1 c1 β Int.natAbs c β€ Int.natAbs c1
#align fermat_42.minimal Fermat42.Minimal
theorem exists_minimal {a b c : β€} (h : Fermat42 a b c) : β a0 b0 c0, Minimal a0 b0 c0 := by
let S : Set β := { n | β s : β€ Γ β€ Γ β€, Fermat42 s.1 s.2.1 s.2.2 β§ n = Int.natAbs s.2.2 }
have S_nonempty : S.Nonempty := by
use Int.natAbs c
rw [Set.mem_setOf_eq]
use β¨a, β¨b, cβ©β©
let m : β := Nat.find S_nonempty
have m_mem : m β S := Nat.find_spec S_nonempty
rcases m_mem with β¨s0, hs0, hs1β©
use s0.1, s0.2.1, s0.2.2, hs0
intro a1 b1 c1 h1
rw [β hs1]
apply Nat.find_min'
use β¨a1, β¨b1, c1β©β©
#align fermat_42.exists_minimal Fermat42.exists_minimal
theorem coprime_of_minimal {a b c : β€} (h : Minimal a b c) : IsCoprime a b := by
apply Int.gcd_eq_one_iff_coprime.mp
by_contra hab
obtain β¨p, hp, hpa, hpbβ© := Nat.Prime.not_coprime_iff_dvd.mp hab
obtain β¨a1, rflβ© := Int.natCast_dvd.mpr hpa
obtain β¨b1, rflβ© := Int.natCast_dvd.mpr hpb
have hpc : (p : β€) ^ 2 β£ c := by
rw [β Int.pow_dvd_pow_iff two_ne_zero, β h.1.2.2]
apply Dvd.intro (a1 ^ 4 + b1 ^ 4)
ring
obtain β¨c1, rflβ© := hpc
have hf : Fermat42 a1 b1 c1 :=
(Fermat42.mul (Int.natCast_ne_zero.mpr (Nat.Prime.ne_zero hp))).mpr h.1
apply Nat.le_lt_asymm (h.2 _ _ _ hf)
rw [Int.natAbs_mul, lt_mul_iff_one_lt_left, Int.natAbs_pow, Int.natAbs_ofNat]
Β· exact Nat.one_lt_pow two_ne_zero (Nat.Prime.one_lt hp)
Β· exact Nat.pos_of_ne_zero (Int.natAbs_ne_zero.2 (ne_zero hf))
#align fermat_42.coprime_of_minimal Fermat42.coprime_of_minimal
theorem minimal_comm {a b c : β€} : Minimal a b c β Minimal b a c := fun β¨h1, h2β© =>
β¨Fermat42.comm.mp h1, h2β©
#align fermat_42.minimal_comm Fermat42.minimal_comm
theorem neg_of_minimal {a b c : β€} : Minimal a b c β Minimal a b (-c) := by
rintro β¨β¨ha, hb, heqβ©, h2β©
constructor
Β· apply And.intro ha (And.intro hb _)
rw [heq]
exact (neg_sq c).symm
rwa [Int.natAbs_neg c]
#align fermat_42.neg_of_minimal Fermat42.neg_of_minimal
theorem exists_odd_minimal {a b c : β€} (h : Fermat42 a b c) :
β a0 b0 c0, Minimal a0 b0 c0 β§ a0 % 2 = 1 := by
obtain β¨a0, b0, c0, hfβ© := exists_minimal h
cases' Int.emod_two_eq_zero_or_one a0 with hap hap
Β· cases' Int.emod_two_eq_zero_or_one b0 with hbp hbp
Β· exfalso
have h1 : 2 β£ (Int.gcd a0 b0 : β€) :=
Int.dvd_gcd (Int.dvd_of_emod_eq_zero hap) (Int.dvd_of_emod_eq_zero hbp)
rw [Int.gcd_eq_one_iff_coprime.mpr (coprime_of_minimal hf)] at h1
revert h1
decide
Β· exact β¨b0, β¨a0, β¨c0, minimal_comm hf, hbpβ©β©β©
exact β¨a0, β¨b0, β¨c0, hf, hapβ©β©β©
#align fermat_42.exists_odd_minimal Fermat42.exists_odd_minimal
| Mathlib/NumberTheory/FLT/Four.lean | 141 | 149 | theorem exists_pos_odd_minimal {a b c : β€} (h : Fermat42 a b c) :
β a0 b0 c0, Minimal a0 b0 c0 β§ a0 % 2 = 1 β§ 0 < c0 := by |
obtain β¨a0, b0, c0, hf, hcβ© := exists_odd_minimal h
rcases lt_trichotomy 0 c0 with (h1 | h1 | h1)
Β· use a0, b0, c0
Β· exfalso
exact ne_zero hf.1 h1.symm
Β· use a0, b0, -c0, neg_of_minimal hf, hc
exact neg_pos.mpr h1
|
import Mathlib.Algebra.Algebra.Tower
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Regular.Pow
import Mathlib.Algebra.MonoidAlgebra.Support
import Mathlib.Data.Finsupp.Antidiagonal
import Mathlib.Order.SymmDiff
import Mathlib.RingTheory.Adjoin.Basic
#align_import data.mv_polynomial.basic from "leanprover-community/mathlib"@"c8734e8953e4b439147bd6f75c2163f6d27cdce6"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
open scoped Pointwise
universe u v w x
variable {R : Type u} {Sβ : Type v} {Sβ : Type w} {Sβ : Type x}
def MvPolynomial (Ο : Type*) (R : Type*) [CommSemiring R] :=
AddMonoidAlgebra R (Ο ββ β)
#align mv_polynomial MvPolynomial
namespace MvPolynomial
-- Porting note: because of `MvPolynomial.C` and `MvPolynomial.X` this linter throws
-- tons of warnings in this file, and it's easier to just disable them globally in the file
set_option linter.uppercaseLean3 false
variable {Ο : Type*} {a a' aβ aβ : R} {e : β} {n m : Ο} {s : Ο ββ β}
section CommSemiring
variable [CommSemiring R] [CommSemiring Sβ] {p q : MvPolynomial Ο R}
def monomial (s : Ο ββ β) : R ββ[R] MvPolynomial Ο R :=
lsingle s
#align mv_polynomial.monomial MvPolynomial.monomial
theorem single_eq_monomial (s : Ο ββ β) (a : R) : Finsupp.single s a = monomial s a :=
rfl
#align mv_polynomial.single_eq_monomial MvPolynomial.single_eq_monomial
theorem mul_def : p * q = p.sum fun m a => q.sum fun n b => monomial (m + n) (a * b) :=
AddMonoidAlgebra.mul_def
#align mv_polynomial.mul_def MvPolynomial.mul_def
def C : R β+* MvPolynomial Ο R :=
{ singleZeroRingHom with toFun := monomial 0 }
#align mv_polynomial.C MvPolynomial.C
variable (R Ο)
@[simp]
theorem algebraMap_eq : algebraMap R (MvPolynomial Ο R) = C :=
rfl
#align mv_polynomial.algebra_map_eq MvPolynomial.algebraMap_eq
variable {R Ο}
def X (n : Ο) : MvPolynomial Ο R :=
monomial (Finsupp.single n 1) 1
#align mv_polynomial.X MvPolynomial.X
theorem monomial_left_injective {r : R} (hr : r β 0) :
Function.Injective fun s : Ο ββ β => monomial s r :=
Finsupp.single_left_injective hr
#align mv_polynomial.monomial_left_injective MvPolynomial.monomial_left_injective
@[simp]
theorem monomial_left_inj {s t : Ο ββ β} {r : R} (hr : r β 0) :
monomial s r = monomial t r β s = t :=
Finsupp.single_left_inj hr
#align mv_polynomial.monomial_left_inj MvPolynomial.monomial_left_inj
theorem C_apply : (C a : MvPolynomial Ο R) = monomial 0 a :=
rfl
#align mv_polynomial.C_apply MvPolynomial.C_apply
-- Porting note (#10618): `simp` can prove this
theorem C_0 : C 0 = (0 : MvPolynomial Ο R) := map_zero _
#align mv_polynomial.C_0 MvPolynomial.C_0
-- Porting note (#10618): `simp` can prove this
theorem C_1 : C 1 = (1 : MvPolynomial Ο R) :=
rfl
#align mv_polynomial.C_1 MvPolynomial.C_1
theorem C_mul_monomial : C a * monomial s a' = monomial s (a * a') := by
-- Porting note: this `show` feels like defeq abuse, but I can't find the appropriate lemmas
show AddMonoidAlgebra.single _ _ * AddMonoidAlgebra.single _ _ = AddMonoidAlgebra.single _ _
simp [C_apply, single_mul_single]
#align mv_polynomial.C_mul_monomial MvPolynomial.C_mul_monomial
-- Porting note (#10618): `simp` can prove this
theorem C_add : (C (a + a') : MvPolynomial Ο R) = C a + C a' :=
Finsupp.single_add _ _ _
#align mv_polynomial.C_add MvPolynomial.C_add
-- Porting note (#10618): `simp` can prove this
theorem C_mul : (C (a * a') : MvPolynomial Ο R) = C a * C a' :=
C_mul_monomial.symm
#align mv_polynomial.C_mul MvPolynomial.C_mul
-- Porting note (#10618): `simp` can prove this
theorem C_pow (a : R) (n : β) : (C (a ^ n) : MvPolynomial Ο R) = C a ^ n :=
map_pow _ _ _
#align mv_polynomial.C_pow MvPolynomial.C_pow
theorem C_injective (Ο : Type*) (R : Type*) [CommSemiring R] :
Function.Injective (C : R β MvPolynomial Ο R) :=
Finsupp.single_injective _
#align mv_polynomial.C_injective MvPolynomial.C_injective
theorem C_surjective {R : Type*} [CommSemiring R] (Ο : Type*) [IsEmpty Ο] :
Function.Surjective (C : R β MvPolynomial Ο R) := by
refine fun p => β¨p.toFun 0, Finsupp.ext fun a => ?_β©
simp only [C_apply, β single_eq_monomial, (Finsupp.ext isEmptyElim (Ξ± := Ο) : a = 0),
single_eq_same]
rfl
#align mv_polynomial.C_surjective MvPolynomial.C_surjective
@[simp]
theorem C_inj {Ο : Type*} (R : Type*) [CommSemiring R] (r s : R) :
(C r : MvPolynomial Ο R) = C s β r = s :=
(C_injective Ο R).eq_iff
#align mv_polynomial.C_inj MvPolynomial.C_inj
instance nontrivial_of_nontrivial (Ο : Type*) (R : Type*) [CommSemiring R] [Nontrivial R] :
Nontrivial (MvPolynomial Ο R) :=
inferInstanceAs (Nontrivial <| AddMonoidAlgebra R (Ο ββ β))
instance infinite_of_infinite (Ο : Type*) (R : Type*) [CommSemiring R] [Infinite R] :
Infinite (MvPolynomial Ο R) :=
Infinite.of_injective C (C_injective _ _)
#align mv_polynomial.infinite_of_infinite MvPolynomial.infinite_of_infinite
instance infinite_of_nonempty (Ο : Type*) (R : Type*) [Nonempty Ο] [CommSemiring R]
[Nontrivial R] : Infinite (MvPolynomial Ο R) :=
Infinite.of_injective ((fun s : Ο ββ β => monomial s 1) β Finsupp.single (Classical.arbitrary Ο))
<| (monomial_left_injective one_ne_zero).comp (Finsupp.single_injective _)
#align mv_polynomial.infinite_of_nonempty MvPolynomial.infinite_of_nonempty
theorem C_eq_coe_nat (n : β) : (C βn : MvPolynomial Ο R) = n := by
induction n <;> simp [Nat.succ_eq_add_one, *]
#align mv_polynomial.C_eq_coe_nat MvPolynomial.C_eq_coe_nat
theorem C_mul' : MvPolynomial.C a * p = a β’ p :=
(Algebra.smul_def a p).symm
#align mv_polynomial.C_mul' MvPolynomial.C_mul'
theorem smul_eq_C_mul (p : MvPolynomial Ο R) (a : R) : a β’ p = C a * p :=
C_mul'.symm
#align mv_polynomial.smul_eq_C_mul MvPolynomial.smul_eq_C_mul
theorem C_eq_smul_one : (C a : MvPolynomial Ο R) = a β’ (1 : MvPolynomial Ο R) := by
rw [β C_mul', mul_one]
#align mv_polynomial.C_eq_smul_one MvPolynomial.C_eq_smul_one
theorem smul_monomial {Sβ : Type*} [SMulZeroClass Sβ R] (r : Sβ) :
r β’ monomial s a = monomial s (r β’ a) :=
Finsupp.smul_single _ _ _
#align mv_polynomial.smul_monomial MvPolynomial.smul_monomial
theorem X_injective [Nontrivial R] : Function.Injective (X : Ο β MvPolynomial Ο R) :=
(monomial_left_injective one_ne_zero).comp (Finsupp.single_left_injective one_ne_zero)
#align mv_polynomial.X_injective MvPolynomial.X_injective
@[simp]
theorem X_inj [Nontrivial R] (m n : Ο) : X m = (X n : MvPolynomial Ο R) β m = n :=
X_injective.eq_iff
#align mv_polynomial.X_inj MvPolynomial.X_inj
theorem monomial_pow : monomial s a ^ e = monomial (e β’ s) (a ^ e) :=
AddMonoidAlgebra.single_pow e
#align mv_polynomial.monomial_pow MvPolynomial.monomial_pow
@[simp]
theorem monomial_mul {s s' : Ο ββ β} {a b : R} :
monomial s a * monomial s' b = monomial (s + s') (a * b) :=
AddMonoidAlgebra.single_mul_single
#align mv_polynomial.monomial_mul MvPolynomial.monomial_mul
variable (Ο R)
def monomialOneHom : Multiplicative (Ο ββ β) β* MvPolynomial Ο R :=
AddMonoidAlgebra.of _ _
#align mv_polynomial.monomial_one_hom MvPolynomial.monomialOneHom
variable {Ο R}
@[simp]
theorem monomialOneHom_apply : monomialOneHom R Ο s = (monomial s 1 : MvPolynomial Ο R) :=
rfl
#align mv_polynomial.monomial_one_hom_apply MvPolynomial.monomialOneHom_apply
theorem X_pow_eq_monomial : X n ^ e = monomial (Finsupp.single n e) (1 : R) := by
simp [X, monomial_pow]
#align mv_polynomial.X_pow_eq_monomial MvPolynomial.X_pow_eq_monomial
theorem monomial_add_single : monomial (s + Finsupp.single n e) a = monomial s a * X n ^ e := by
rw [X_pow_eq_monomial, monomial_mul, mul_one]
#align mv_polynomial.monomial_add_single MvPolynomial.monomial_add_single
theorem monomial_single_add : monomial (Finsupp.single n e + s) a = X n ^ e * monomial s a := by
rw [X_pow_eq_monomial, monomial_mul, one_mul]
#align mv_polynomial.monomial_single_add MvPolynomial.monomial_single_add
theorem C_mul_X_pow_eq_monomial {s : Ο} {a : R} {n : β} :
C a * X s ^ n = monomial (Finsupp.single s n) a := by
rw [β zero_add (Finsupp.single s n), monomial_add_single, C_apply]
#align mv_polynomial.C_mul_X_pow_eq_monomial MvPolynomial.C_mul_X_pow_eq_monomial
theorem C_mul_X_eq_monomial {s : Ο} {a : R} : C a * X s = monomial (Finsupp.single s 1) a := by
rw [β C_mul_X_pow_eq_monomial, pow_one]
#align mv_polynomial.C_mul_X_eq_monomial MvPolynomial.C_mul_X_eq_monomial
-- Porting note (#10618): `simp` can prove this
theorem monomial_zero {s : Ο ββ β} : monomial s (0 : R) = 0 :=
Finsupp.single_zero _
#align mv_polynomial.monomial_zero MvPolynomial.monomial_zero
@[simp]
theorem monomial_zero' : (monomial (0 : Ο ββ β) : R β MvPolynomial Ο R) = C :=
rfl
#align mv_polynomial.monomial_zero' MvPolynomial.monomial_zero'
@[simp]
theorem monomial_eq_zero {s : Ο ββ β} {b : R} : monomial s b = 0 β b = 0 :=
Finsupp.single_eq_zero
#align mv_polynomial.monomial_eq_zero MvPolynomial.monomial_eq_zero
@[simp]
theorem sum_monomial_eq {A : Type*} [AddCommMonoid A] {u : Ο ββ β} {r : R} {b : (Ο ββ β) β R β A}
(w : b u 0 = 0) : sum (monomial u r) b = b u r :=
Finsupp.sum_single_index w
#align mv_polynomial.sum_monomial_eq MvPolynomial.sum_monomial_eq
@[simp]
theorem sum_C {A : Type*} [AddCommMonoid A] {b : (Ο ββ β) β R β A} (w : b 0 0 = 0) :
sum (C a) b = b 0 a :=
sum_monomial_eq w
#align mv_polynomial.sum_C MvPolynomial.sum_C
theorem monomial_sum_one {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β Ο ββ β) :
(monomial (β i β s, f i) 1 : MvPolynomial Ο R) = β i β s, monomial (f i) 1 :=
map_prod (monomialOneHom R Ο) (fun i => Multiplicative.ofAdd (f i)) s
#align mv_polynomial.monomial_sum_one MvPolynomial.monomial_sum_one
theorem monomial_sum_index {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β Ο ββ β) (a : R) :
monomial (β i β s, f i) a = C a * β i β s, monomial (f i) 1 := by
rw [β monomial_sum_one, C_mul', β (monomial _).map_smul, smul_eq_mul, mul_one]
#align mv_polynomial.monomial_sum_index MvPolynomial.monomial_sum_index
theorem monomial_finsupp_sum_index {Ξ± Ξ² : Type*} [Zero Ξ²] (f : Ξ± ββ Ξ²) (g : Ξ± β Ξ² β Ο ββ β)
(a : R) : monomial (f.sum g) a = C a * f.prod fun a b => monomial (g a b) 1 :=
monomial_sum_index _ _ _
#align mv_polynomial.monomial_finsupp_sum_index MvPolynomial.monomial_finsupp_sum_index
theorem monomial_eq_monomial_iff {Ξ± : Type*} (aβ aβ : Ξ± ββ β) (bβ bβ : R) :
monomial aβ bβ = monomial aβ bβ β aβ = aβ β§ bβ = bβ β¨ bβ = 0 β§ bβ = 0 :=
Finsupp.single_eq_single_iff _ _ _ _
#align mv_polynomial.monomial_eq_monomial_iff MvPolynomial.monomial_eq_monomial_iff
theorem monomial_eq : monomial s a = C a * (s.prod fun n e => X n ^ e : MvPolynomial Ο R) := by
simp only [X_pow_eq_monomial, β monomial_finsupp_sum_index, Finsupp.sum_single]
#align mv_polynomial.monomial_eq MvPolynomial.monomial_eq
@[simp]
lemma prod_X_pow_eq_monomial : β x β s.support, X x ^ s x = monomial s (1 : R) := by
simp only [monomial_eq, map_one, one_mul, Finsupp.prod]
theorem induction_on_monomial {M : MvPolynomial Ο R β Prop} (h_C : β a, M (C a))
(h_X : β p n, M p β M (p * X n)) : β s a, M (monomial s a) := by
intro s a
apply @Finsupp.induction Ο β _ _ s
Β· show M (monomial 0 a)
exact h_C a
Β· intro n e p _hpn _he ih
have : β e : β, M (monomial p a * X n ^ e) := by
intro e
induction e with
| zero => simp [ih]
| succ e e_ih => simp [ih, pow_succ, (mul_assoc _ _ _).symm, h_X, e_ih]
simp [add_comm, monomial_add_single, this]
#align mv_polynomial.induction_on_monomial MvPolynomial.induction_on_monomial
@[elab_as_elim]
theorem induction_on' {P : MvPolynomial Ο R β Prop} (p : MvPolynomial Ο R)
(h1 : β (u : Ο ββ β) (a : R), P (monomial u a))
(h2 : β p q : MvPolynomial Ο R, P p β P q β P (p + q)) : P p :=
Finsupp.induction p
(suffices P (monomial 0 0) by rwa [monomial_zero] at this
show P (monomial 0 0) from h1 0 0)
fun a b f _ha _hb hPf => h2 _ _ (h1 _ _) hPf
#align mv_polynomial.induction_on' MvPolynomial.induction_on'
theorem induction_on''' {M : MvPolynomial Ο R β Prop} (p : MvPolynomial Ο R) (h_C : β a, M (C a))
(h_add_weak :
β (a : Ο ββ β) (b : R) (f : (Ο ββ β) ββ R),
a β f.support β b β 0 β M f β M ((show (Ο ββ β) ββ R from monomial a b) + f)) :
M p :=
-- Porting note: I had to add the `show ... from ...` above, a type ascription was insufficient.
Finsupp.induction p (C_0.rec <| h_C 0) h_add_weak
#align mv_polynomial.induction_on''' MvPolynomial.induction_on'''
theorem induction_on'' {M : MvPolynomial Ο R β Prop} (p : MvPolynomial Ο R) (h_C : β a, M (C a))
(h_add_weak :
β (a : Ο ββ β) (b : R) (f : (Ο ββ β) ββ R),
a β f.support β b β 0 β M f β M (monomial a b) β
M ((show (Ο ββ β) ββ R from monomial a b) + f))
(h_X : β (p : MvPolynomial Ο R) (n : Ο), M p β M (p * MvPolynomial.X n)) : M p :=
-- Porting note: I had to add the `show ... from ...` above, a type ascription was insufficient.
induction_on''' p h_C fun a b f ha hb hf =>
h_add_weak a b f ha hb hf <| induction_on_monomial h_C h_X a b
#align mv_polynomial.induction_on'' MvPolynomial.induction_on''
@[recursor 5]
theorem induction_on {M : MvPolynomial Ο R β Prop} (p : MvPolynomial Ο R) (h_C : β a, M (C a))
(h_add : β p q, M p β M q β M (p + q)) (h_X : β p n, M p β M (p * X n)) : M p :=
induction_on'' p h_C (fun a b f _ha _hb hf hm => h_add (monomial a b) f hm hf) h_X
#align mv_polynomial.induction_on MvPolynomial.induction_on
theorem ringHom_ext {A : Type*} [Semiring A] {f g : MvPolynomial Ο R β+* A}
(hC : β r, f (C r) = g (C r)) (hX : β i, f (X i) = g (X i)) : f = g := by
refine AddMonoidAlgebra.ringHom_ext' ?_ ?_
-- Porting note: this has high priority, but Lean still chooses `RingHom.ext`, why?
-- probably because of the type synonym
Β· ext x
exact hC _
Β· apply Finsupp.mulHom_ext'; intros x
-- Porting note: `Finsupp.mulHom_ext'` needs to have increased priority
apply MonoidHom.ext_mnat
exact hX _
#align mv_polynomial.ring_hom_ext MvPolynomial.ringHom_ext
@[ext 1100]
theorem ringHom_ext' {A : Type*} [Semiring A] {f g : MvPolynomial Ο R β+* A}
(hC : f.comp C = g.comp C) (hX : β i, f (X i) = g (X i)) : f = g :=
ringHom_ext (RingHom.ext_iff.1 hC) hX
#align mv_polynomial.ring_hom_ext' MvPolynomial.ringHom_ext'
theorem hom_eq_hom [Semiring Sβ] (f g : MvPolynomial Ο R β+* Sβ) (hC : f.comp C = g.comp C)
(hX : β n : Ο, f (X n) = g (X n)) (p : MvPolynomial Ο R) : f p = g p :=
RingHom.congr_fun (ringHom_ext' hC hX) p
#align mv_polynomial.hom_eq_hom MvPolynomial.hom_eq_hom
theorem is_id (f : MvPolynomial Ο R β+* MvPolynomial Ο R) (hC : f.comp C = C)
(hX : β n : Ο, f (X n) = X n) (p : MvPolynomial Ο R) : f p = p :=
hom_eq_hom f (RingHom.id _) hC hX p
#align mv_polynomial.is_id MvPolynomial.is_id
@[ext 1100]
theorem algHom_ext' {A B : Type*} [CommSemiring A] [CommSemiring B] [Algebra R A] [Algebra R B]
{f g : MvPolynomial Ο A ββ[R] B}
(hβ :
f.comp (IsScalarTower.toAlgHom R A (MvPolynomial Ο A)) =
g.comp (IsScalarTower.toAlgHom R A (MvPolynomial Ο A)))
(hβ : β i, f (X i) = g (X i)) : f = g :=
AlgHom.coe_ringHom_injective (MvPolynomial.ringHom_ext' (congr_arg AlgHom.toRingHom hβ) hβ)
#align mv_polynomial.alg_hom_ext' MvPolynomial.algHom_ext'
@[ext 1200]
theorem algHom_ext {A : Type*} [Semiring A] [Algebra R A] {f g : MvPolynomial Ο R ββ[R] A}
(hf : β i : Ο, f (X i) = g (X i)) : f = g :=
AddMonoidAlgebra.algHom_ext' (mulHom_ext' fun X : Ο => MonoidHom.ext_mnat (hf X))
#align mv_polynomial.alg_hom_ext MvPolynomial.algHom_ext
@[simp]
theorem algHom_C {Ο : Type*} (f : MvPolynomial Ο R ββ[R] MvPolynomial Ο R) (r : R) :
f (C r) = C r :=
f.commutes r
#align mv_polynomial.alg_hom_C MvPolynomial.algHom_C
@[simp]
theorem adjoin_range_X : Algebra.adjoin R (range (X : Ο β MvPolynomial Ο R)) = β€ := by
set S := Algebra.adjoin R (range (X : Ο β MvPolynomial Ο R))
refine top_unique fun p hp => ?_; clear hp
induction p using MvPolynomial.induction_on with
| h_C => exact S.algebraMap_mem _
| h_add p q hp hq => exact S.add_mem hp hq
| h_X p i hp => exact S.mul_mem hp (Algebra.subset_adjoin <| mem_range_self _)
#align mv_polynomial.adjoin_range_X MvPolynomial.adjoin_range_X
@[ext]
theorem linearMap_ext {M : Type*} [AddCommMonoid M] [Module R M] {f g : MvPolynomial Ο R ββ[R] M}
(h : β s, f ββ monomial s = g ββ monomial s) : f = g :=
Finsupp.lhom_ext' h
#align mv_polynomial.linear_map_ext MvPolynomial.linearMap_ext
section Aeval
variable [Algebra R Sβ] [CommSemiring Sβ]
variable (f : Ο β Sβ)
@[simp]
theorem algebraMap_apply (r : R) : algebraMap R (MvPolynomial Ο Sβ) r = C (algebraMap R Sβ r) := rfl
#align mv_polynomial.algebra_map_apply MvPolynomial.algebraMap_apply
def aeval : MvPolynomial Ο R ββ[R] Sβ :=
{ evalβHom (algebraMap R Sβ) f with commutes' := fun _r => evalβ_C _ _ _ }
#align mv_polynomial.aeval MvPolynomial.aeval
theorem aeval_def (p : MvPolynomial Ο R) : aeval f p = evalβ (algebraMap R Sβ) f p :=
rfl
#align mv_polynomial.aeval_def MvPolynomial.aeval_def
theorem aeval_eq_evalβHom (p : MvPolynomial Ο R) : aeval f p = evalβHom (algebraMap R Sβ) f p :=
rfl
#align mv_polynomial.aeval_eq_evalβ_hom MvPolynomial.aeval_eq_evalβHom
@[simp]
lemma coe_aeval_eq_eval : RingHomClass.toRingHom (MvPolynomial.aeval f) = MvPolynomial.eval f :=
rfl
@[simp]
theorem aeval_X (s : Ο) : aeval f (X s : MvPolynomial _ R) = f s :=
evalβ_X _ _ _
#align mv_polynomial.aeval_X MvPolynomial.aeval_X
@[simp]
theorem aeval_C (r : R) : aeval f (C r) = algebraMap R Sβ r :=
evalβ_C _ _ _
#align mv_polynomial.aeval_C MvPolynomial.aeval_C
| Mathlib/Algebra/MvPolynomial/Basic.lean | 1,547 | 1,549 | theorem aeval_unique (Ο : MvPolynomial Ο R ββ[R] Sβ) : Ο = aeval (Ο β X) := by |
ext i
simp
|
import Mathlib.Algebra.Algebra.Unitization
import Mathlib.Algebra.Star.NonUnitalSubalgebra
import Mathlib.Algebra.Star.Subalgebra
import Mathlib.GroupTheory.GroupAction.Ring
section Subalgebra
variable {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
def Subalgebra.toNonUnitalSubalgebra (S : Subalgebra R A) : NonUnitalSubalgebra R A :=
{ S with
smul_mem' := fun r _x hx => S.smul_mem hx r }
theorem Subalgebra.one_mem_toNonUnitalSubalgebra (S : Subalgebra R A) :
(1 : A) β S.toNonUnitalSubalgebra :=
S.one_mem
def NonUnitalSubalgebra.toSubalgebra (S : NonUnitalSubalgebra R A) (h1 : (1 : A) β S) :
Subalgebra R A :=
{ S with
one_mem' := h1
algebraMap_mem' := fun r =>
(Algebra.algebraMap_eq_smul_one (R := R) (A := A) r).symm βΈ SMulMemClass.smul_mem r h1 }
theorem Subalgebra.toNonUnitalSubalgebra_toSubalgebra (S : Subalgebra R A) :
S.toNonUnitalSubalgebra.toSubalgebra S.one_mem = S := by cases S; rfl
| Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean | 73 | 75 | theorem NonUnitalSubalgebra.toSubalgebra_toNonUnitalSubalgebra (S : NonUnitalSubalgebra R A)
(h1 : (1 : A) β S) : (NonUnitalSubalgebra.toSubalgebra S h1).toNonUnitalSubalgebra = S := by |
cases S; rfl
|
import Mathlib.Algebra.Group.Basic
import Mathlib.Algebra.Group.Commute.Defs
import Mathlib.Logic.Unique
import Mathlib.Tactic.Nontriviality
import Mathlib.Tactic.Lift
#align_import algebra.group.units from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
assert_not_exists Multiplicative
assert_not_exists MonoidWithZero
assert_not_exists DenselyOrdered
open Function
universe u
variable {Ξ± : Type u}
structure Units (Ξ± : Type u) [Monoid Ξ±] where
val : Ξ±
inv : Ξ±
val_inv : val * inv = 1
inv_val : inv * val = 1
#align units Units
#align units.val Units.val
#align units.inv Units.inv
#align units.val_inv Units.val_inv
#align units.inv_val Units.inv_val
attribute [coe] Units.val
@[inherit_doc]
postfix:1024 "Λ£" => Units
-- We don't provide notation for the additive version, because its use is somewhat rare.
structure AddUnits (Ξ± : Type u) [AddMonoid Ξ±] where
val : Ξ±
neg : Ξ±
val_neg : val + neg = 0
neg_val : neg + val = 0
#align add_units AddUnits
#align add_units.val AddUnits.val
#align add_units.neg AddUnits.neg
#align add_units.val_neg AddUnits.val_neg
#align add_units.neg_val AddUnits.neg_val
attribute [to_additive] Units
attribute [coe] AddUnits.val
namespace Units
section Monoid
variable [Monoid Ξ±]
-- Porting note: unclear whether this should be a `CoeHead` or `CoeTail`
@[to_additive "An additive unit can be interpreted as a term in the base `AddMonoid`."]
instance : CoeHead Ξ±Λ£ Ξ± :=
β¨valβ©
@[to_additive "The additive inverse of an additive unit in an `AddMonoid`."]
instance instInv : Inv Ξ±Λ£ :=
β¨fun u => β¨u.2, u.1, u.4, u.3β©β©
attribute [instance] AddUnits.instNeg
#noalign units.simps.coe
#noalign add_units.simps.coe
@[to_additive "See Note [custom simps projection]"]
def Simps.val_inv (u : Ξ±Λ£) : Ξ± := β(uβ»ΒΉ)
#align units.simps.coe_inv Units.Simps.val_inv
#align add_units.simps.coe_neg AddUnits.Simps.val_neg
initialize_simps_projections Units (as_prefix val, val_inv β null, inv β val_inv, as_prefix val_inv)
initialize_simps_projections AddUnits
(as_prefix val, val_neg β null, neg β val_neg, as_prefix val_neg)
-- Porting note: removed `simp` tag because of the tautology
@[to_additive]
theorem val_mk (a : Ξ±) (b hβ hβ) : β(Units.mk a b hβ hβ) = a :=
rfl
#align units.coe_mk Units.val_mk
#align add_units.coe_mk AddUnits.val_mk
@[to_additive (attr := ext)]
theorem ext : Function.Injective (val : Ξ±Λ£ β Ξ±)
| β¨v, iβ, viβ, ivββ©, β¨v', iβ, viβ, ivββ©, e => by
simp only at e; subst v'; congr;
simpa only [ivβ, viβ, one_mul, mul_one] using mul_assoc iβ v iβ
#align units.ext Units.ext
#align add_units.ext AddUnits.ext
@[to_additive (attr := norm_cast)]
theorem eq_iff {a b : Ξ±Λ£} : (a : Ξ±) = b β a = b :=
ext.eq_iff
#align units.eq_iff Units.eq_iff
#align add_units.eq_iff AddUnits.eq_iff
@[to_additive]
theorem ext_iff {a b : Ξ±Λ£} : a = b β (a : Ξ±) = b :=
eq_iff.symm
#align units.ext_iff Units.ext_iff
#align add_units.ext_iff AddUnits.ext_iff
@[to_additive "Additive units have decidable equality
if the base `AddMonoid` has deciable equality."]
instance [DecidableEq Ξ±] : DecidableEq Ξ±Λ£ := fun _ _ => decidable_of_iff' _ ext_iff
@[to_additive (attr := simp)]
theorem mk_val (u : Ξ±Λ£) (y hβ hβ) : mk (u : Ξ±) y hβ hβ = u :=
ext rfl
#align units.mk_coe Units.mk_val
#align add_units.mk_coe AddUnits.mk_val
@[to_additive (attr := simps) "Copy an `AddUnit`, adjusting definitional equalities."]
def copy (u : Ξ±Λ£) (val : Ξ±) (hv : val = u) (inv : Ξ±) (hi : inv = βuβ»ΒΉ) : Ξ±Λ£ :=
{ val, inv, inv_val := hv.symm βΈ hi.symm βΈ u.inv_val, val_inv := hv.symm βΈ hi.symm βΈ u.val_inv }
#align units.copy Units.copy
#align add_units.copy AddUnits.copy
#align units.coe_copy Units.val_copy
#align add_units.coe_copy AddUnits.val_copy
#align units.coe_inv_copy Units.val_inv_copy
#align add_units.coe_neg_copy AddUnits.val_neg_copy
@[to_additive]
theorem copy_eq (u : Ξ±Λ£) (val hv inv hi) : u.copy val hv inv hi = u :=
ext hv
#align units.copy_eq Units.copy_eq
#align add_units.copy_eq AddUnits.copy_eq
@[to_additive "Additive units of an additive monoid have an induced addition."]
instance : Mul Ξ±Λ£ where
mul uβ uβ :=
β¨uβ.val * uβ.val, uβ.inv * uβ.inv,
by rw [mul_assoc, β mul_assoc uβ.val, val_inv, one_mul, val_inv],
by rw [mul_assoc, β mul_assoc uβ.inv, inv_val, one_mul, inv_val]β©
@[to_additive "Additive units of an additive monoid have a zero."]
instance : One Ξ±Λ£ where
one := β¨1, 1, one_mul 1, one_mul 1β©
@[to_additive "Additive units of an additive monoid have an addition and an additive identity."]
instance instMulOneClass : MulOneClass Ξ±Λ£ where
one_mul u := ext <| one_mul (u : Ξ±)
mul_one u := ext <| mul_one (u : Ξ±)
@[to_additive "Additive units of an additive monoid are inhabited because `0` is an additive unit."]
instance : Inhabited Ξ±Λ£ :=
β¨1β©
@[to_additive "Additive units of an additive monoid have a representation of the base value in
the `AddMonoid`."]
instance [Repr Ξ±] : Repr Ξ±Λ£ :=
β¨reprPrec β valβ©
variable (a b c : Ξ±Λ£) {u : Ξ±Λ£}
@[to_additive (attr := simp, norm_cast)]
theorem val_mul : (β(a * b) : Ξ±) = a * b :=
rfl
#align units.coe_mul Units.val_mul
#align add_units.coe_add AddUnits.val_add
@[to_additive (attr := simp, norm_cast)]
theorem val_one : ((1 : Ξ±Λ£) : Ξ±) = 1 :=
rfl
#align units.coe_one Units.val_one
#align add_units.coe_zero AddUnits.val_zero
@[to_additive (attr := simp, norm_cast)]
theorem val_eq_one {a : Ξ±Λ£} : (a : Ξ±) = 1 β a = 1 := by rw [β Units.val_one, eq_iff]
#align units.coe_eq_one Units.val_eq_one
#align add_units.coe_eq_zero AddUnits.val_eq_zero
@[to_additive (attr := simp)]
theorem inv_mk (x y : Ξ±) (hβ hβ) : (mk x y hβ hβ)β»ΒΉ = mk y x hβ hβ :=
rfl
#align units.inv_mk Units.inv_mk
#align add_units.neg_mk AddUnits.neg_mk
-- Porting note: coercions are now eagerly elaborated, so no need for `val_eq_coe`
#noalign units.val_eq_coe
#noalign add_units.val_eq_coe
@[to_additive (attr := simp)]
theorem inv_eq_val_inv : a.inv = ((aβ»ΒΉ : Ξ±Λ£) : Ξ±) :=
rfl
#align units.inv_eq_coe_inv Units.inv_eq_val_inv
#align add_units.neg_eq_coe_neg AddUnits.neg_eq_val_neg
@[to_additive (attr := simp)]
theorem inv_mul : (βaβ»ΒΉ * a : Ξ±) = 1 :=
inv_val _
#align units.inv_mul Units.inv_mul
#align add_units.neg_add AddUnits.neg_add
@[to_additive (attr := simp)]
theorem mul_inv : (a * βaβ»ΒΉ : Ξ±) = 1 :=
val_inv _
#align units.mul_inv Units.mul_inv
#align add_units.add_neg AddUnits.add_neg
@[to_additive] lemma commute_coe_inv : Commute (a : Ξ±) βaβ»ΒΉ := by
rw [Commute, SemiconjBy, inv_mul, mul_inv]
@[to_additive] lemma commute_inv_coe : Commute βaβ»ΒΉ (a : Ξ±) := a.commute_coe_inv.symm
@[to_additive]
theorem inv_mul_of_eq {a : Ξ±} (h : βu = a) : βuβ»ΒΉ * a = 1 := by rw [β h, u.inv_mul]
#align units.inv_mul_of_eq Units.inv_mul_of_eq
#align add_units.neg_add_of_eq AddUnits.neg_add_of_eq
@[to_additive]
theorem mul_inv_of_eq {a : Ξ±} (h : βu = a) : a * βuβ»ΒΉ = 1 := by rw [β h, u.mul_inv]
#align units.mul_inv_of_eq Units.mul_inv_of_eq
#align add_units.add_neg_of_eq AddUnits.add_neg_of_eq
@[to_additive (attr := simp)]
theorem mul_inv_cancel_left (a : Ξ±Λ£) (b : Ξ±) : (a : Ξ±) * (βaβ»ΒΉ * b) = b := by
rw [β mul_assoc, mul_inv, one_mul]
#align units.mul_inv_cancel_left Units.mul_inv_cancel_left
#align add_units.add_neg_cancel_left AddUnits.add_neg_cancel_left
@[to_additive (attr := simp)]
theorem inv_mul_cancel_left (a : Ξ±Λ£) (b : Ξ±) : (βaβ»ΒΉ : Ξ±) * (a * b) = b := by
rw [β mul_assoc, inv_mul, one_mul]
#align units.inv_mul_cancel_left Units.inv_mul_cancel_left
#align add_units.neg_add_cancel_left AddUnits.neg_add_cancel_left
@[to_additive (attr := simp)]
theorem mul_inv_cancel_right (a : Ξ±) (b : Ξ±Λ£) : a * b * βbβ»ΒΉ = a := by
rw [mul_assoc, mul_inv, mul_one]
#align units.mul_inv_cancel_right Units.mul_inv_cancel_right
#align add_units.add_neg_cancel_right AddUnits.add_neg_cancel_right
@[to_additive (attr := simp)]
| Mathlib/Algebra/Group/Units.lean | 304 | 305 | theorem inv_mul_cancel_right (a : Ξ±) (b : Ξ±Λ£) : a * βbβ»ΒΉ * b = a := by |
rw [mul_assoc, inv_mul, mul_one]
|
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section deriv
variable {ΞΉ : Type*} {l : Filter ΞΉ} {π : Type*} [RCLike π] {G : Type*} [NormedAddCommGroup G]
[NormedSpace π G] {f : ΞΉ β π β G} {g : π β G} {f' : ΞΉ β π β G} {g' : π β G} {x : π}
theorem UniformCauchySeqOnFilter.one_smulRight {l' : Filter π}
(hf' : UniformCauchySeqOnFilter f' l l') :
UniformCauchySeqOnFilter (fun n => fun z => (1 : π βL[π] π).smulRight (f' n z)) l l' := by
-- The tricky part of this proof is that operator norms are written in terms of `β€` whereas
-- metrics are written in terms of `<`. So we need to shrink `Ξ΅` utilizing the archimedean
-- property of `β`
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero,
Metric.tendstoUniformlyOnFilter_iff] at hf' β’
intro Ξ΅ hΞ΅
obtain β¨q, hq, hq'β© := exists_between hΞ΅.lt
apply (hf' q hq).mono
intro n hn
refine lt_of_le_of_lt ?_ hq'
simp only [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn β’
refine ContinuousLinearMap.opNorm_le_bound _ hq.le ?_
intro z
simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply,
ContinuousLinearMap.one_apply]
rw [β smul_sub, norm_smul, mul_comm]
gcongr
#align uniform_cauchy_seq_on_filter.one_smul_right UniformCauchySeqOnFilter.one_smulRight
theorem uniformCauchySeqOnFilter_of_deriv (hf' : UniformCauchySeqOnFilter f' l (π x))
(hf : βαΆ n : ΞΉ Γ π in l ΓΛ’ π x, HasDerivAt (f n.1) (f' n.1 n.2) n.2)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (π x) := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hf
exact uniformCauchySeqOnFilter_of_fderiv hf'.one_smulRight hf hfg
#align uniform_cauchy_seq_on_filter_of_deriv uniformCauchySeqOnFilter_of_deriv
theorem uniformCauchySeqOn_ball_of_deriv {r : β} (hf' : UniformCauchySeqOn f' l (Metric.ball x r))
(hf : β n : ΞΉ, β y : π, y β Metric.ball x r β HasDerivAt (f n) (f' n y) y)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOn f l (Metric.ball x r) := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hf
rw [uniformCauchySeqOn_iff_uniformCauchySeqOnFilter] at hf'
have hf' :
UniformCauchySeqOn (fun n => fun z => (1 : π βL[π] π).smulRight (f' n z)) l
(Metric.ball x r) := by
rw [uniformCauchySeqOn_iff_uniformCauchySeqOnFilter]
exact hf'.one_smulRight
exact uniformCauchySeqOn_ball_of_fderiv hf' hf hfg
#align uniform_cauchy_seq_on_ball_of_deriv uniformCauchySeqOn_ball_of_deriv
theorem hasDerivAt_of_tendstoUniformlyOnFilter [NeBot l]
(hf' : TendstoUniformlyOnFilter f' g' l (π x))
(hf : βαΆ n : ΞΉ Γ π in l ΓΛ’ π x, HasDerivAt (f n.1) (f' n.1 n.2) n.2)
(hfg : βαΆ y in π x, Tendsto (fun n => f n y) l (π (g y))) : HasDerivAt g (g' x) x := by
-- The first part of the proof rewrites `hf` and the goal to be functions so that Lean
-- can recognize them when we apply `hasFDerivAt_of_tendstoUniformlyOnFilter`
let F' n z := (1 : π βL[π] π).smulRight (f' n z)
let G' z := (1 : π βL[π] π).smulRight (g' z)
simp_rw [hasDerivAt_iff_hasFDerivAt] at hf β’
-- Now we need to rewrite hf' in terms of `ContinuousLinearMap`s. The tricky part is that
-- operator norms are written in terms of `β€` whereas metrics are written in terms of `<`. So we
-- need to shrink `Ξ΅` utilizing the archimedean property of `β`
have hf' : TendstoUniformlyOnFilter F' G' l (π x) := by
rw [Metric.tendstoUniformlyOnFilter_iff] at hf' β’
intro Ξ΅ hΞ΅
obtain β¨q, hq, hq'β© := exists_between hΞ΅.lt
apply (hf' q hq).mono
intro n hn
refine lt_of_le_of_lt ?_ hq'
simp only [dist_eq_norm] at hn β’
refine ContinuousLinearMap.opNorm_le_bound _ hq.le ?_
intro z
simp only [F', G', ContinuousLinearMap.coe_sub', Pi.sub_apply,
ContinuousLinearMap.smulRight_apply, ContinuousLinearMap.one_apply]
rw [β smul_sub, norm_smul, mul_comm]
gcongr
exact hasFDerivAt_of_tendstoUniformlyOnFilter hf' hf hfg
#align has_deriv_at_of_tendsto_uniformly_on_filter hasDerivAt_of_tendstoUniformlyOnFilter
theorem hasDerivAt_of_tendstoLocallyUniformlyOn [NeBot l] {s : Set π} (hs : IsOpen s)
(hf' : TendstoLocallyUniformlyOn f' g' l s)
(hf : βαΆ n in l, β x β s, HasDerivAt (f n) (f' n x) x)
(hfg : β x β s, Tendsto (fun n => f n x) l (π (g x))) (hx : x β s) : HasDerivAt g (g' x) x := by
have h1 : s β π x := hs.mem_nhds hx
have h2 : βαΆ n : ΞΉ Γ π in l ΓΛ’ π x, HasDerivAt (f n.1) (f' n.1 n.2) n.2 :=
eventually_prod_iff.2 β¨_, hf, fun x => x β s, h1, fun {n} => idβ©
refine hasDerivAt_of_tendstoUniformlyOnFilter ?_ h2 (eventually_of_mem h1 hfg)
simpa [IsOpen.nhdsWithin_eq hs hx] using tendstoLocallyUniformlyOn_iff_filter.mp hf' x hx
#align has_deriv_at_of_tendsto_locally_uniformly_on hasDerivAt_of_tendstoLocallyUniformlyOn
theorem hasDerivAt_of_tendsto_locally_uniformly_on' [NeBot l] {s : Set π} (hs : IsOpen s)
(hf' : TendstoLocallyUniformlyOn (deriv β f) g' l s)
(hf : βαΆ n in l, DifferentiableOn π (f n) s)
(hfg : β x β s, Tendsto (fun n => f n x) l (π (g x))) (hx : x β s) : HasDerivAt g (g' x) x := by
refine hasDerivAt_of_tendstoLocallyUniformlyOn hs hf' ?_ hfg hx
filter_upwards [hf] with n h z hz using ((h z hz).differentiableAt (hs.mem_nhds hz)).hasDerivAt
#align has_deriv_at_of_tendsto_locally_uniformly_on' hasDerivAt_of_tendsto_locally_uniformly_on'
theorem hasDerivAt_of_tendstoUniformlyOn [NeBot l] {s : Set π} (hs : IsOpen s)
(hf' : TendstoUniformlyOn f' g' l s)
(hf : βαΆ n in l, β x : π, x β s β HasDerivAt (f n) (f' n x) x)
(hfg : β x : π, x β s β Tendsto (fun n => f n x) l (π (g x))) :
β x : π, x β s β HasDerivAt g (g' x) x := fun _ =>
hasDerivAt_of_tendstoLocallyUniformlyOn hs hf'.tendstoLocallyUniformlyOn hf hfg
#align has_deriv_at_of_tendsto_uniformly_on hasDerivAt_of_tendstoUniformlyOn
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 556 | 564 | theorem hasDerivAt_of_tendstoUniformly [NeBot l] (hf' : TendstoUniformly f' g' l)
(hf : βαΆ n in l, β x : π, HasDerivAt (f n) (f' n x) x)
(hfg : β x : π, Tendsto (fun n => f n x) l (π (g x))) : β x : π, HasDerivAt g (g' x) x := by |
intro x
have hf : βαΆ n in l, β x : π, x β Set.univ β HasDerivAt (f n) (f' n x) x := by
filter_upwards [hf] with n h x _ using h x
have hfg : β x : π, x β Set.univ β Tendsto (fun n => f n x) l (π (g x)) := by simp [hfg]
have hf' : TendstoUniformlyOn f' g' l Set.univ := by rwa [tendstoUniformlyOn_univ]
exact hasDerivAt_of_tendstoUniformlyOn isOpen_univ hf' hf hfg x (Set.mem_univ x)
|
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f"
namespace PowerSeries
section invOneSubPow
variable {S : Type*} [CommRing S] (d : β)
theorem mk_one_mul_one_sub_eq_one : (mk 1 : Sβ¦Xβ§) * (1 - X) = 1 := by
rw [mul_comm, ext_iff]
intro n
cases n with
| zero => simp
| succ n => simp [sub_mul]
theorem mk_one_pow_eq_mk_choose_add :
(mk 1 : Sβ¦Xβ§) ^ (d + 1) = (mk fun n => Nat.choose (d + n) d : Sβ¦Xβ§) := by
induction d with
| zero => ext; simp
| succ d hd =>
ext n
rw [pow_add, hd, pow_one, mul_comm, coeff_mul]
simp_rw [coeff_mk, Pi.one_apply, one_mul]
norm_cast
rw [Finset.sum_antidiagonal_choose_add, β Nat.choose_succ_succ, Nat.succ_eq_add_one,
add_right_comm]
noncomputable def invOneSubPow : Sβ¦Xβ§Λ£ where
val := mk fun n => Nat.choose (d + n) d
inv := (1 - X) ^ (d + 1)
val_inv := by
rw [β mk_one_pow_eq_mk_choose_add, β mul_pow, mk_one_mul_one_sub_eq_one, one_pow]
inv_val := by
rw [β mk_one_pow_eq_mk_choose_add, β mul_pow, mul_comm, mk_one_mul_one_sub_eq_one, one_pow]
theorem invOneSubPow_val_eq_mk_choose_add :
(invOneSubPow d).val = (mk fun n => Nat.choose (d + n) d : Sβ¦Xβ§) := rfl
| Mathlib/RingTheory/PowerSeries/WellKnown.lean | 123 | 125 | theorem invOneSubPow_val_zero_eq_invUnitSub_one :
(invOneSubPow 0).val = invUnitsSub (1 : SΛ£) := by |
simp [invOneSubPow, invUnitsSub]
|
import Mathlib.Algebra.Order.CauSeq.BigOperators
import Mathlib.Data.Complex.Abs
import Mathlib.Data.Complex.BigOperators
import Mathlib.Data.Nat.Choose.Sum
#align_import data.complex.exponential from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
open CauSeq Finset IsAbsoluteValue
open scoped Classical ComplexConjugate
namespace Complex
variable (x y : β)
@[simp]
theorem exp_zero : exp 0 = 1 := by
rw [exp]
refine lim_eq_of_equiv_const fun Ξ΅ Ξ΅0 => β¨1, fun j hj => ?_β©
convert (config := .unfoldSameFun) Ξ΅0 -- Porting note: Ξ΅0 : Ξ΅ > 0 but goal is _ < Ξ΅
cases' j with j j
Β· exact absurd hj (not_le_of_gt zero_lt_one)
Β· dsimp [exp']
induction' j with j ih
Β· dsimp [exp']; simp [show Nat.succ 0 = 1 from rfl]
Β· rw [β ih (by simp [Nat.succ_le_succ])]
simp only [sum_range_succ, pow_succ]
simp
#align complex.exp_zero Complex.exp_zero
theorem exp_add : exp (x + y) = exp x * exp y := by
have hj : β j : β, (β m β range j, (x + y) ^ m / m.factorial) =
β i β range j, β k β range (i + 1), x ^ k / k.factorial *
(y ^ (i - k) / (i - k).factorial) := by
intro j
refine Finset.sum_congr rfl fun m _ => ?_
rw [add_pow, div_eq_mul_inv, sum_mul]
refine Finset.sum_congr rfl fun I hi => ?_
have hβ : (m.choose I : β) β 0 :=
Nat.cast_ne_zero.2 (pos_iff_ne_zero.1 (Nat.choose_pos (Nat.le_of_lt_succ (mem_range.1 hi))))
have hβ := Nat.choose_mul_factorial_mul_factorial (Nat.le_of_lt_succ <| Finset.mem_range.1 hi)
rw [β hβ, Nat.cast_mul, Nat.cast_mul, mul_inv, mul_inv]
simp only [mul_left_comm (m.choose I : β), mul_assoc, mul_left_comm (m.choose I : β)β»ΒΉ,
mul_comm (m.choose I : β)]
rw [inv_mul_cancel hβ]
simp [div_eq_mul_inv, mul_comm, mul_assoc, mul_left_comm]
simp_rw [exp, exp', lim_mul_lim]
apply (lim_eq_lim_of_equiv _).symm
simp only [hj]
exact cauchy_product (isCauSeq_abs_exp x) (isCauSeq_exp y)
#align complex.exp_add Complex.exp_add
-- Porting note (#11445): new definition
noncomputable def expMonoidHom : MonoidHom (Multiplicative β) β :=
{ toFun := fun z => exp (Multiplicative.toAdd z),
map_one' := by simp,
map_mul' := by simp [exp_add] }
theorem exp_list_sum (l : List β) : exp l.sum = (l.map exp).prod :=
map_list_prod (M := Multiplicative β) expMonoidHom l
#align complex.exp_list_sum Complex.exp_list_sum
theorem exp_multiset_sum (s : Multiset β) : exp s.sum = (s.map exp).prod :=
@MonoidHom.map_multiset_prod (Multiplicative β) β _ _ expMonoidHom s
#align complex.exp_multiset_sum Complex.exp_multiset_sum
theorem exp_sum {Ξ± : Type*} (s : Finset Ξ±) (f : Ξ± β β) :
exp (β x β s, f x) = β x β s, exp (f x) :=
map_prod (Ξ² := Multiplicative β) expMonoidHom f s
#align complex.exp_sum Complex.exp_sum
lemma exp_nsmul (x : β) (n : β) : exp (n β’ x) = exp x ^ n :=
@MonoidHom.map_pow (Multiplicative β) β _ _ expMonoidHom _ _
theorem exp_nat_mul (x : β) : β n : β, exp (n * x) = exp x ^ n
| 0 => by rw [Nat.cast_zero, zero_mul, exp_zero, pow_zero]
| Nat.succ n => by rw [pow_succ, Nat.cast_add_one, add_mul, exp_add, β exp_nat_mul _ n, one_mul]
#align complex.exp_nat_mul Complex.exp_nat_mul
theorem exp_ne_zero : exp x β 0 := fun h =>
zero_ne_one <| by rw [β exp_zero, β add_neg_self x, exp_add, h]; simp
#align complex.exp_ne_zero Complex.exp_ne_zero
theorem exp_neg : exp (-x) = (exp x)β»ΒΉ := by
rw [β mul_right_inj' (exp_ne_zero x), β exp_add]; simp [mul_inv_cancel (exp_ne_zero x)]
#align complex.exp_neg Complex.exp_neg
theorem exp_sub : exp (x - y) = exp x / exp y := by
simp [sub_eq_add_neg, exp_add, exp_neg, div_eq_mul_inv]
#align complex.exp_sub Complex.exp_sub
theorem exp_int_mul (z : β) (n : β€) : Complex.exp (n * z) = Complex.exp z ^ n := by
cases n
Β· simp [exp_nat_mul]
Β· simp [exp_add, add_mul, pow_add, exp_neg, exp_nat_mul]
#align complex.exp_int_mul Complex.exp_int_mul
@[simp]
theorem exp_conj : exp (conj x) = conj (exp x) := by
dsimp [exp]
rw [β lim_conj]
refine congr_arg CauSeq.lim (CauSeq.ext fun _ => ?_)
dsimp [exp', Function.comp_def, cauSeqConj]
rw [map_sum (starRingEnd _)]
refine sum_congr rfl fun n _ => ?_
rw [map_divβ, map_pow, β ofReal_natCast, conj_ofReal]
#align complex.exp_conj Complex.exp_conj
@[simp]
theorem ofReal_exp_ofReal_re (x : β) : ((exp x).re : β) = exp x :=
conj_eq_iff_re.1 <| by rw [β exp_conj, conj_ofReal]
#align complex.of_real_exp_of_real_re Complex.ofReal_exp_ofReal_re
@[simp, norm_cast]
theorem ofReal_exp (x : β) : (Real.exp x : β) = exp x :=
ofReal_exp_ofReal_re _
#align complex.of_real_exp Complex.ofReal_exp
@[simp]
theorem exp_ofReal_im (x : β) : (exp x).im = 0 := by rw [β ofReal_exp_ofReal_re, ofReal_im]
#align complex.exp_of_real_im Complex.exp_ofReal_im
theorem exp_ofReal_re (x : β) : (exp x).re = Real.exp x :=
rfl
#align complex.exp_of_real_re Complex.exp_ofReal_re
theorem two_sinh : 2 * sinh x = exp x - exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_sinh Complex.two_sinh
theorem two_cosh : 2 * cosh x = exp x + exp (-x) :=
mul_div_cancelβ _ two_ne_zero
#align complex.two_cosh Complex.two_cosh
@[simp]
theorem sinh_zero : sinh 0 = 0 := by simp [sinh]
#align complex.sinh_zero Complex.sinh_zero
@[simp]
theorem sinh_neg : sinh (-x) = -sinh x := by simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
#align complex.sinh_neg Complex.sinh_neg
private theorem sinh_add_aux {a b c d : β} :
(a - b) * (c + d) + (a + b) * (c - d) = 2 * (a * c - b * d) := by ring
theorem sinh_add : sinh (x + y) = sinh x * cosh y + cosh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_sinh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_sinh, mul_left_comm, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, β mul_assoc, two_cosh]
exact sinh_add_aux
#align complex.sinh_add Complex.sinh_add
@[simp]
theorem cosh_zero : cosh 0 = 1 := by simp [cosh]
#align complex.cosh_zero Complex.cosh_zero
@[simp]
theorem cosh_neg : cosh (-x) = cosh x := by simp [add_comm, cosh, exp_neg]
#align complex.cosh_neg Complex.cosh_neg
private theorem cosh_add_aux {a b c d : β} :
(a + b) * (c + d) + (a - b) * (c - d) = 2 * (a * c + b * d) := by ring
theorem cosh_add : cosh (x + y) = cosh x * cosh y + sinh x * sinh y := by
rw [β mul_right_inj' (two_ne_zero' β), two_cosh, exp_add, neg_add, exp_add, eq_comm, mul_add, β
mul_assoc, two_cosh, β mul_assoc, two_sinh, β mul_right_inj' (two_ne_zero' β), mul_add,
mul_left_comm, two_cosh, mul_left_comm, two_sinh]
exact cosh_add_aux
#align complex.cosh_add Complex.cosh_add
theorem sinh_sub : sinh (x - y) = sinh x * cosh y - cosh x * sinh y := by
simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
#align complex.sinh_sub Complex.sinh_sub
theorem cosh_sub : cosh (x - y) = cosh x * cosh y - sinh x * sinh y := by
simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]
#align complex.cosh_sub Complex.cosh_sub
theorem sinh_conj : sinh (conj x) = conj (sinh x) := by
rw [sinh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_sub, sinh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.sinh_conj Complex.sinh_conj
@[simp]
theorem ofReal_sinh_ofReal_re (x : β) : ((sinh x).re : β) = sinh x :=
conj_eq_iff_re.1 <| by rw [β sinh_conj, conj_ofReal]
#align complex.of_real_sinh_of_real_re Complex.ofReal_sinh_ofReal_re
@[simp, norm_cast]
theorem ofReal_sinh (x : β) : (Real.sinh x : β) = sinh x :=
ofReal_sinh_ofReal_re _
#align complex.of_real_sinh Complex.ofReal_sinh
@[simp]
theorem sinh_ofReal_im (x : β) : (sinh x).im = 0 := by rw [β ofReal_sinh_ofReal_re, ofReal_im]
#align complex.sinh_of_real_im Complex.sinh_ofReal_im
theorem sinh_ofReal_re (x : β) : (sinh x).re = Real.sinh x :=
rfl
#align complex.sinh_of_real_re Complex.sinh_ofReal_re
theorem cosh_conj : cosh (conj x) = conj (cosh x) := by
rw [cosh, β RingHom.map_neg, exp_conj, exp_conj, β RingHom.map_add, cosh, map_divβ]
-- Porting note: not nice
simp [β one_add_one_eq_two]
#align complex.cosh_conj Complex.cosh_conj
theorem ofReal_cosh_ofReal_re (x : β) : ((cosh x).re : β) = cosh x :=
conj_eq_iff_re.1 <| by rw [β cosh_conj, conj_ofReal]
#align complex.of_real_cosh_of_real_re Complex.ofReal_cosh_ofReal_re
@[simp, norm_cast]
theorem ofReal_cosh (x : β) : (Real.cosh x : β) = cosh x :=
ofReal_cosh_ofReal_re _
#align complex.of_real_cosh Complex.ofReal_cosh
@[simp]
theorem cosh_ofReal_im (x : β) : (cosh x).im = 0 := by rw [β ofReal_cosh_ofReal_re, ofReal_im]
#align complex.cosh_of_real_im Complex.cosh_ofReal_im
@[simp]
theorem cosh_ofReal_re (x : β) : (cosh x).re = Real.cosh x :=
rfl
#align complex.cosh_of_real_re Complex.cosh_ofReal_re
theorem tanh_eq_sinh_div_cosh : tanh x = sinh x / cosh x :=
rfl
#align complex.tanh_eq_sinh_div_cosh Complex.tanh_eq_sinh_div_cosh
@[simp]
theorem tanh_zero : tanh 0 = 0 := by simp [tanh]
#align complex.tanh_zero Complex.tanh_zero
@[simp]
theorem tanh_neg : tanh (-x) = -tanh x := by simp [tanh, neg_div]
#align complex.tanh_neg Complex.tanh_neg
theorem tanh_conj : tanh (conj x) = conj (tanh x) := by
rw [tanh, sinh_conj, cosh_conj, β map_divβ, tanh]
#align complex.tanh_conj Complex.tanh_conj
@[simp]
theorem ofReal_tanh_ofReal_re (x : β) : ((tanh x).re : β) = tanh x :=
conj_eq_iff_re.1 <| by rw [β tanh_conj, conj_ofReal]
#align complex.of_real_tanh_of_real_re Complex.ofReal_tanh_ofReal_re
@[simp, norm_cast]
theorem ofReal_tanh (x : β) : (Real.tanh x : β) = tanh x :=
ofReal_tanh_ofReal_re _
#align complex.of_real_tanh Complex.ofReal_tanh
@[simp]
theorem tanh_ofReal_im (x : β) : (tanh x).im = 0 := by rw [β ofReal_tanh_ofReal_re, ofReal_im]
#align complex.tanh_of_real_im Complex.tanh_ofReal_im
theorem tanh_ofReal_re (x : β) : (tanh x).re = Real.tanh x :=
rfl
#align complex.tanh_of_real_re Complex.tanh_ofReal_re
@[simp]
theorem cosh_add_sinh : cosh x + sinh x = exp x := by
rw [β mul_right_inj' (two_ne_zero' β), mul_add, two_cosh, two_sinh, add_add_sub_cancel, two_mul]
#align complex.cosh_add_sinh Complex.cosh_add_sinh
@[simp]
theorem sinh_add_cosh : sinh x + cosh x = exp x := by rw [add_comm, cosh_add_sinh]
#align complex.sinh_add_cosh Complex.sinh_add_cosh
@[simp]
theorem exp_sub_cosh : exp x - cosh x = sinh x :=
sub_eq_iff_eq_add.2 (sinh_add_cosh x).symm
#align complex.exp_sub_cosh Complex.exp_sub_cosh
@[simp]
theorem exp_sub_sinh : exp x - sinh x = cosh x :=
sub_eq_iff_eq_add.2 (cosh_add_sinh x).symm
#align complex.exp_sub_sinh Complex.exp_sub_sinh
@[simp]
theorem cosh_sub_sinh : cosh x - sinh x = exp (-x) := by
rw [β mul_right_inj' (two_ne_zero' β), mul_sub, two_cosh, two_sinh, add_sub_sub_cancel, two_mul]
#align complex.cosh_sub_sinh Complex.cosh_sub_sinh
@[simp]
theorem sinh_sub_cosh : sinh x - cosh x = -exp (-x) := by rw [β neg_sub, cosh_sub_sinh]
#align complex.sinh_sub_cosh Complex.sinh_sub_cosh
@[simp]
theorem cosh_sq_sub_sinh_sq : cosh x ^ 2 - sinh x ^ 2 = 1 := by
rw [sq_sub_sq, cosh_add_sinh, cosh_sub_sinh, β exp_add, add_neg_self, exp_zero]
#align complex.cosh_sq_sub_sinh_sq Complex.cosh_sq_sub_sinh_sq
theorem cosh_sq : cosh x ^ 2 = sinh x ^ 2 + 1 := by
rw [β cosh_sq_sub_sinh_sq x]
ring
#align complex.cosh_sq Complex.cosh_sq
| Mathlib/Data/Complex/Exponential.lean | 453 | 455 | theorem sinh_sq : sinh x ^ 2 = cosh x ^ 2 - 1 := by |
rw [β cosh_sq_sub_sinh_sq x]
ring
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.