Context stringlengths 57 85k | file_name stringlengths 21 79 | start int64 14 2.42k | end int64 18 2.43k | theorem stringlengths 25 2.71k | proof stringlengths 5 10.6k |
|---|---|---|---|---|---|
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : β}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : β) : β :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 β b β 0 β§ b β 1 β§ b β -1 :=
Iff.trans β¨fun h h' => by simp [logb, h'] at h, div_selfβ© log_ne_zero
@[simp]
theorem logb_abs (x : β) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
theorem logb_neg_eq_logb (x : β) : logb b (-x) = logb b x := by
rw [β logb_abs x, β logb_abs (-x), abs_neg]
#align real.logb_neg_eq_logb Real.logb_neg_eq_logb
theorem logb_mul (hx : x β 0) (hy : y β 0) : logb b (x * y) = logb b x + logb b y := by
simp_rw [logb, log_mul hx hy, add_div]
#align real.logb_mul Real.logb_mul
theorem logb_div (hx : x β 0) (hy : y β 0) : logb b (x / y) = logb b x - logb b y := by
simp_rw [logb, log_div hx hy, sub_div]
#align real.logb_div Real.logb_div
@[simp]
theorem logb_inv (x : β) : logb b xβ»ΒΉ = -logb b x := by simp [logb, neg_div]
#align real.logb_inv Real.logb_inv
theorem inv_logb (a b : β) : (logb a b)β»ΒΉ = logb b a := by simp_rw [logb, inv_div]
#align real.inv_logb Real.inv_logb
theorem inv_logb_mul_base {a b : β} (hβ : a β 0) (hβ : b β 0) (c : β) :
(logb (a * b) c)β»ΒΉ = (logb a c)β»ΒΉ + (logb b c)β»ΒΉ := by
simp_rw [inv_logb]; exact logb_mul hβ hβ
#align real.inv_logb_mul_base Real.inv_logb_mul_base
theorem inv_logb_div_base {a b : β} (hβ : a β 0) (hβ : b β 0) (c : β) :
(logb (a / b) c)β»ΒΉ = (logb a c)β»ΒΉ - (logb b c)β»ΒΉ := by
simp_rw [inv_logb]; exact logb_div hβ hβ
#align real.inv_logb_div_base Real.inv_logb_div_base
theorem logb_mul_base {a b : β} (hβ : a β 0) (hβ : b β 0) (c : β) :
logb (a * b) c = ((logb a c)β»ΒΉ + (logb b c)β»ΒΉ)β»ΒΉ := by rw [β inv_logb_mul_base hβ hβ c, inv_inv]
#align real.logb_mul_base Real.logb_mul_base
theorem logb_div_base {a b : β} (hβ : a β 0) (hβ : b β 0) (c : β) :
logb (a / b) c = ((logb a c)β»ΒΉ - (logb b c)β»ΒΉ)β»ΒΉ := by rw [β inv_logb_div_base hβ hβ c, inv_inv]
#align real.logb_div_base Real.logb_div_base
theorem mul_logb {a b c : β} (hβ : b β 0) (hβ : b β 1) (hβ : b β -1) :
logb a b * logb b c = logb a c := by
unfold logb
rw [mul_comm, div_mul_div_cancel _ (log_ne_zero.mpr β¨hβ, hβ, hββ©)]
#align real.mul_logb Real.mul_logb
theorem div_logb {a b c : β} (hβ : c β 0) (hβ : c β 1) (hβ : c β -1) :
logb a c / logb b c = logb a b :=
div_div_div_cancel_left' _ _ <| log_ne_zero.mpr β¨hβ, hβ, hββ©
#align real.div_logb Real.div_logb
theorem logb_rpow_eq_mul_logb_of_pos (hx : 0 < x) : logb b (x ^ y) = y * logb b x := by
rw [logb, log_rpow hx, logb, mul_div_assoc]
theorem logb_pow {k : β} (hx : 0 < x) : logb b (x ^ k) = k * logb b x := by
rw [β rpow_natCast, logb_rpow_eq_mul_logb_of_pos hx]
section BPosAndBLtOne
variable (b_pos : 0 < b) (b_lt_one : b < 1)
private theorem b_ne_one : b β 1 := by linarith
@[simp]
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 308 | 309 | theorem logb_le_logb_of_base_lt_one (h : 0 < x) (hβ : 0 < y) : logb b x β€ logb b y β y β€ x := by |
rw [logb, logb, div_le_div_right_of_neg (log_neg b_pos b_lt_one), log_le_log_iff hβ h]
|
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.Probability.Independence.Basic
#align_import probability.integration from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740"
noncomputable section
open Set MeasureTheory
open scoped ENNReal MeasureTheory
variable {Ξ© : Type*} {mΞ© : MeasurableSpace Ξ©} {ΞΌ : Measure Ξ©} {f g : Ξ© β ββ₯0β} {X Y : Ξ© β β}
namespace ProbabilityTheory
| Mathlib/Probability/Integration.lean | 45 | 73 | theorem lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mΞ© : MeasurableSpace Ξ©}
{ΞΌ : Measure Ξ©} (hMf : Mf β€ mΞ©) (c : ββ₯0β) {T : Set Ξ©} (h_meas_T : MeasurableSet T)
(h_ind : IndepSets {s | MeasurableSet[Mf] s} {T} ΞΌ) (h_meas_f : Measurable[Mf] f) :
(β«β» Ο, f Ο * T.indicator (fun _ => c) Ο βΞΌ) =
(β«β» Ο, f Ο βΞΌ) * β«β» Ο, T.indicator (fun _ => c) Ο βΞΌ := by |
revert f
have h_mul_indicator : β g, Measurable g β Measurable fun a => g a * T.indicator (fun _ => c) a :=
fun g h_mg => h_mg.mul (measurable_const.indicator h_meas_T)
apply @Measurable.ennreal_induction _ Mf
Β· intro c' s' h_meas_s'
simp_rw [β inter_indicator_mul]
rw [lintegral_indicator _ (MeasurableSet.inter (hMf _ h_meas_s') h_meas_T),
lintegral_indicator _ (hMf _ h_meas_s'), lintegral_indicator _ h_meas_T]
simp only [measurable_const, lintegral_const, univ_inter, lintegral_const_mul,
MeasurableSet.univ, Measure.restrict_apply]
rw [IndepSets_iff] at h_ind
rw [mul_mul_mul_comm, h_ind s' T h_meas_s' (Set.mem_singleton _)]
Β· intro f' g _ h_meas_f' _ h_ind_f' h_ind_g
have h_measM_f' : Measurable f' := h_meas_f'.mono hMf le_rfl
simp_rw [Pi.add_apply, right_distrib]
rw [lintegral_add_left (h_mul_indicator _ h_measM_f'), lintegral_add_left h_measM_f',
right_distrib, h_ind_f', h_ind_g]
Β· intro f h_meas_f h_mono_f h_ind_f
have h_measM_f : β n, Measurable (f n) := fun n => (h_meas_f n).mono hMf le_rfl
simp_rw [ENNReal.iSup_mul]
rw [lintegral_iSup h_measM_f h_mono_f, lintegral_iSup, ENNReal.iSup_mul]
Β· simp_rw [β h_ind_f]
Β· exact fun n => h_mul_indicator _ (h_measM_f n)
Β· exact fun m n h_le a => mul_le_mul_right' (h_mono_f h_le a) _
|
import Mathlib.Algebra.Algebra.Subalgebra.Pointwise
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Maximal
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Noetherian
import Mathlib.RingTheory.ChainOfDivisors
import Mathlib.RingTheory.DedekindDomain.Basic
import Mathlib.RingTheory.FractionalIdeal.Operations
#align_import ring_theory.dedekind_domain.ideal from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e"
variable (R A K : Type*) [CommRing R] [CommRing A] [Field K]
open scoped nonZeroDivisors Polynomial
section Inverse
namespace FractionalIdeal
variable {Rβ : Type*} [CommRing Rβ] [IsDomain Rβ] [Algebra Rβ K] [IsFractionRing Rβ K]
variable {I J : FractionalIdeal Rββ° K}
noncomputable instance : Inv (FractionalIdeal Rββ° K) := β¨fun I => 1 / Iβ©
theorem inv_eq : Iβ»ΒΉ = 1 / I := rfl
#align fractional_ideal.inv_eq FractionalIdeal.inv_eq
theorem inv_zero' : (0 : FractionalIdeal Rββ° K)β»ΒΉ = 0 := div_zero
#align fractional_ideal.inv_zero' FractionalIdeal.inv_zero'
theorem inv_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
Jβ»ΒΉ = β¨(1 : FractionalIdeal Rββ° K) / J, fractional_div_of_nonzero hβ© := div_nonzero h
#align fractional_ideal.inv_nonzero FractionalIdeal.inv_nonzero
theorem coe_inv_of_nonzero {J : FractionalIdeal Rββ° K} (h : J β 0) :
(βJβ»ΒΉ : Submodule Rβ K) = IsLocalization.coeSubmodule K β€ / (J : Submodule Rβ K) := by
simp_rw [inv_nonzero _ h, coe_one, coe_mk, IsLocalization.coeSubmodule_top]
#align fractional_ideal.coe_inv_of_nonzero FractionalIdeal.coe_inv_of_nonzero
variable {K}
theorem mem_inv_iff (hI : I β 0) {x : K} : x β Iβ»ΒΉ β β y β I, x * y β (1 : FractionalIdeal Rββ° K) :=
mem_div_iff_of_nonzero hI
#align fractional_ideal.mem_inv_iff FractionalIdeal.mem_inv_iff
| Mathlib/RingTheory/DedekindDomain/Ideal.lean | 87 | 92 | theorem inv_anti_mono (hI : I β 0) (hJ : J β 0) (hIJ : I β€ J) : Jβ»ΒΉ β€ Iβ»ΒΉ := by |
-- Porting note: in Lean3, introducing `x` would just give `x β Jβ»ΒΉ β x β Iβ»ΒΉ`, but
-- in Lean4, it goes all the way down to the subtypes
intro x
simp only [val_eq_coe, mem_coe, mem_inv_iff hJ, mem_inv_iff hI]
exact fun h y hy => h y (hIJ hy)
|
import Mathlib.Combinatorics.SimpleGraph.Basic
namespace SimpleGraph
variable {V : Type*} (G : SimpleGraph V)
structure Dart extends V Γ V where
adj : G.Adj fst snd
deriving DecidableEq
#align simple_graph.dart SimpleGraph.Dart
initialize_simps_projections Dart (+toProd, -fst, -snd)
attribute [simp] Dart.adj
variable {G}
| Mathlib/Combinatorics/SimpleGraph/Dart.lean | 33 | 34 | theorem Dart.ext_iff (dβ dβ : G.Dart) : dβ = dβ β dβ.toProd = dβ.toProd := by |
cases dβ; cases dβ; simp
|
import Mathlib.CategoryTheory.Sites.Plus
import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory
#align_import category_theory.sites.sheafification from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
namespace CategoryTheory
open CategoryTheory.Limits Opposite
universe w v u
variable {C : Type u} [Category.{v} C] {J : GrothendieckTopology C}
variable {D : Type w} [Category.{max v u} D]
section
variable [ConcreteCategory.{max v u} D]
attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike
-- porting note (#5171): removed @[nolint has_nonempty_instance]
def Meq {X : C} (P : Cα΅α΅ β₯€ D) (S : J.Cover X) :=
{ x : β I : S.Arrow, P.obj (op I.Y) //
β I : S.Relation, P.map I.gβ.op (x I.fst) = P.map I.gβ.op (x I.snd) }
#align category_theory.meq CategoryTheory.Meq
end
namespace GrothendieckTopology
variable (J)
variable [β (P : Cα΅α΅ β₯€ D) (X : C) (S : J.Cover X), HasMultiequalizer (S.index P)]
[β X : C, HasColimitsOfShape (J.Cover X)α΅α΅ D]
noncomputable def sheafify (P : Cα΅α΅ β₯€ D) : Cα΅α΅ β₯€ D :=
J.plusObj (J.plusObj P)
#align category_theory.grothendieck_topology.sheafify CategoryTheory.GrothendieckTopology.sheafify
noncomputable def toSheafify (P : Cα΅α΅ β₯€ D) : P βΆ J.sheafify P :=
J.toPlus P β« J.plusMap (J.toPlus P)
#align category_theory.grothendieck_topology.to_sheafify CategoryTheory.GrothendieckTopology.toSheafify
noncomputable def sheafifyMap {P Q : Cα΅α΅ β₯€ D} (Ξ· : P βΆ Q) : J.sheafify P βΆ J.sheafify Q :=
J.plusMap <| J.plusMap Ξ·
#align category_theory.grothendieck_topology.sheafify_map CategoryTheory.GrothendieckTopology.sheafifyMap
@[simp]
| Mathlib/CategoryTheory/Sites/ConcreteSheafification.lean | 477 | 479 | theorem sheafifyMap_id (P : Cα΅α΅ β₯€ D) : J.sheafifyMap (π P) = π (J.sheafify P) := by |
dsimp [sheafifyMap, sheafify]
simp
|
import Batteries.Control.ForInStep.Lemmas
import Batteries.Data.List.Basic
import Batteries.Tactic.Init
import Batteries.Tactic.Alias
namespace List
open Nat
@[simp] theorem mem_toArray {a : Ξ±} {l : List Ξ±} : a β l.toArray β a β l := by
simp [Array.mem_def]
@[simp]
theorem drop_one : β l : List Ξ±, drop 1 l = tail l
| [] | _ :: _ => rfl
theorem zipWith_distrib_tail : (zipWith f l l').tail = zipWith f l.tail l'.tail := by
rw [β drop_one]; simp [zipWith_distrib_drop]
theorem subset_def {lβ lβ : List Ξ±} : lβ β lβ β β {a : Ξ±}, a β lβ β a β lβ := .rfl
@[simp] theorem nil_subset (l : List Ξ±) : [] β l := nofun
@[simp] theorem Subset.refl (l : List Ξ±) : l β l := fun _ i => i
theorem Subset.trans {lβ lβ lβ : List Ξ±} (hβ : lβ β lβ) (hβ : lβ β lβ) : lβ β lβ :=
fun _ i => hβ (hβ i)
instance : Trans (Membership.mem : Ξ± β List Ξ± β Prop) Subset Membership.mem :=
β¨fun hβ hβ => hβ hββ©
instance : Trans (Subset : List Ξ± β List Ξ± β Prop) Subset Subset :=
β¨Subset.transβ©
@[simp] theorem subset_cons (a : Ξ±) (l : List Ξ±) : l β a :: l := fun _ => Mem.tail _
theorem subset_of_cons_subset {a : Ξ±} {lβ lβ : List Ξ±} : a :: lβ β lβ β lβ β lβ :=
fun s _ i => s (mem_cons_of_mem _ i)
theorem subset_cons_of_subset (a : Ξ±) {lβ lβ : List Ξ±} : lβ β lβ β lβ β a :: lβ :=
fun s _ i => .tail _ (s i)
theorem cons_subset_cons {lβ lβ : List Ξ±} (a : Ξ±) (s : lβ β lβ) : a :: lβ β a :: lβ :=
fun _ => by simp only [mem_cons]; exact Or.imp_right (@s _)
@[simp] theorem subset_append_left (lβ lβ : List Ξ±) : lβ β lβ ++ lβ := fun _ => mem_append_left _
@[simp] theorem subset_append_right (lβ lβ : List Ξ±) : lβ β lβ ++ lβ := fun _ => mem_append_right _
theorem subset_append_of_subset_left (lβ : List Ξ±) : l β lβ β l β lβ ++ lβ :=
fun s => Subset.trans s <| subset_append_left _ _
theorem subset_append_of_subset_right (lβ : List Ξ±) : l β lβ β l β lβ ++ lβ :=
fun s => Subset.trans s <| subset_append_right _ _
@[simp] theorem cons_subset : a :: l β m β a β m β§ l β m := by
simp only [subset_def, mem_cons, or_imp, forall_and, forall_eq]
@[simp] theorem append_subset {lβ lβ l : List Ξ±} :
lβ ++ lβ β l β lβ β l β§ lβ β l := by simp [subset_def, or_imp, forall_and]
theorem subset_nil {l : List Ξ±} : l β [] β l = [] :=
β¨fun h => match l with | [] => rfl | _::_ => (nomatch h (.head ..)), fun | rfl => Subset.refl _β©
theorem map_subset {lβ lβ : List Ξ±} (f : Ξ± β Ξ²) (H : lβ β lβ) : map f lβ β map f lβ :=
fun x => by simp only [mem_map]; exact .imp fun a => .imp_left (@H _)
@[simp] theorem nil_sublist : β l : List Ξ±, [] <+ l
| [] => .slnil
| a :: l => (nil_sublist l).cons a
@[simp] theorem Sublist.refl : β l : List Ξ±, l <+ l
| [] => .slnil
| a :: l => (Sublist.refl l).consβ a
theorem Sublist.trans {lβ lβ lβ : List Ξ±} (hβ : lβ <+ lβ) (hβ : lβ <+ lβ) : lβ <+ lβ := by
induction hβ generalizing lβ with
| slnil => exact hβ
| cons _ _ IH => exact (IH hβ).cons _
| @consβ lβ _ a _ IH =>
generalize e : a :: lβ = lβ'
match e βΈ hβ with
| .slnil => apply nil_sublist
| .cons a' hβ' => cases e; apply (IH hβ').cons
| .consβ a' hβ' => cases e; apply (IH hβ').consβ
instance : Trans (@Sublist Ξ±) Sublist Sublist := β¨Sublist.transβ©
@[simp] theorem sublist_cons (a : Ξ±) (l : List Ξ±) : l <+ a :: l := (Sublist.refl l).cons _
theorem sublist_of_cons_sublist : a :: lβ <+ lβ β lβ <+ lβ :=
(sublist_cons a lβ).trans
@[simp] theorem sublist_append_left : β lβ lβ : List Ξ±, lβ <+ lβ ++ lβ
| [], _ => nil_sublist _
| _ :: lβ, lβ => (sublist_append_left lβ lβ).consβ _
@[simp] theorem sublist_append_right : β lβ lβ : List Ξ±, lβ <+ lβ ++ lβ
| [], _ => Sublist.refl _
| _ :: lβ, lβ => (sublist_append_right lβ lβ).cons _
theorem sublist_append_of_sublist_left (s : l <+ lβ) : l <+ lβ ++ lβ :=
s.trans <| sublist_append_left ..
theorem sublist_append_of_sublist_right (s : l <+ lβ) : l <+ lβ ++ lβ :=
s.trans <| sublist_append_right ..
@[simp]
theorem cons_sublist_cons : a :: lβ <+ a :: lβ β lβ <+ lβ :=
β¨fun | .cons _ s => sublist_of_cons_sublist s | .consβ _ s => s, .consβ _β©
@[simp] theorem append_sublist_append_left : β l, l ++ lβ <+ l ++ lβ β lβ <+ lβ
| [] => Iff.rfl
| _ :: l => cons_sublist_cons.trans (append_sublist_append_left l)
theorem Sublist.append_left : lβ <+ lβ β β l, l ++ lβ <+ l ++ lβ :=
fun h l => (append_sublist_append_left l).mpr h
theorem Sublist.append_right : lβ <+ lβ β β l, lβ ++ l <+ lβ ++ l
| .slnil, _ => Sublist.refl _
| .cons _ h, _ => (h.append_right _).cons _
| .consβ _ h, _ => (h.append_right _).consβ _
theorem sublist_or_mem_of_sublist (h : l <+ lβ ++ a :: lβ) : l <+ lβ ++ lβ β¨ a β l := by
induction lβ generalizing l with
| nil => match h with
| .cons _ h => exact .inl h
| .consβ _ h => exact .inr (.head ..)
| cons b lβ IH =>
match h with
| .cons _ h => exact (IH h).imp_left (Sublist.cons _)
| .consβ _ h => exact (IH h).imp (Sublist.consβ _) (.tail _)
theorem Sublist.reverse : lβ <+ lβ β lβ.reverse <+ lβ.reverse
| .slnil => Sublist.refl _
| .cons _ h => by rw [reverse_cons]; exact sublist_append_of_sublist_left h.reverse
| .consβ _ h => by rw [reverse_cons, reverse_cons]; exact h.reverse.append_right _
@[simp] theorem reverse_sublist : lβ.reverse <+ lβ.reverse β lβ <+ lβ :=
β¨fun h => lβ.reverse_reverse βΈ lβ.reverse_reverse βΈ h.reverse, Sublist.reverseβ©
@[simp] theorem append_sublist_append_right (l) : lβ ++ l <+ lβ ++ l β lβ <+ lβ :=
β¨fun h => by
have := h.reverse
simp only [reverse_append, append_sublist_append_left, reverse_sublist] at this
exact this,
fun h => h.append_right lβ©
theorem Sublist.append (hl : lβ <+ lβ) (hr : rβ <+ rβ) : lβ ++ rβ <+ lβ ++ rβ :=
(hl.append_right _).trans ((append_sublist_append_left _).2 hr)
theorem Sublist.subset : lβ <+ lβ β lβ β lβ
| .slnil, _, h => h
| .cons _ s, _, h => .tail _ (s.subset h)
| .consβ .., _, .head .. => .head ..
| .consβ _ s, _, .tail _ h => .tail _ (s.subset h)
instance : Trans (@Sublist Ξ±) Subset Subset :=
β¨fun hβ hβ => trans hβ.subset hββ©
instance : Trans Subset (@Sublist Ξ±) Subset :=
β¨fun hβ hβ => trans hβ hβ.subsetβ©
instance : Trans (Membership.mem : Ξ± β List Ξ± β Prop) Sublist Membership.mem :=
β¨fun hβ hβ => hβ.subset hββ©
theorem Sublist.length_le : lβ <+ lβ β length lβ β€ length lβ
| .slnil => Nat.le_refl 0
| .cons _l s => le_succ_of_le (length_le s)
| .consβ _ s => succ_le_succ (length_le s)
@[simp] theorem sublist_nil {l : List Ξ±} : l <+ [] β l = [] :=
β¨fun s => subset_nil.1 s.subset, fun H => H βΈ Sublist.refl _β©
theorem Sublist.eq_of_length : lβ <+ lβ β length lβ = length lβ β lβ = lβ
| .slnil, _ => rfl
| .cons a s, h => nomatch Nat.not_lt.2 s.length_le (h βΈ lt_succ_self _)
| .consβ a s, h => by rw [s.eq_of_length (succ.inj h)]
theorem Sublist.eq_of_length_le (s : lβ <+ lβ) (h : length lβ β€ length lβ) : lβ = lβ :=
s.eq_of_length <| Nat.le_antisymm s.length_le h
@[simp] theorem singleton_sublist {a : Ξ±} {l} : [a] <+ l β a β l := by
refine β¨fun h => h.subset (mem_singleton_self _), fun h => ?_β©
obtain β¨_, _, rflβ© := append_of_mem h
exact ((nil_sublist _).consβ _).trans (sublist_append_right ..)
@[simp] theorem replicate_sublist_replicate {m n} (a : Ξ±) :
replicate m a <+ replicate n a β m β€ n := by
refine β¨fun h => ?_, fun h => ?_β©
Β· have := h.length_le; simp only [length_replicate] at this β’; exact this
Β· induction h with
| refl => apply Sublist.refl
| step => simp [*, replicate, Sublist.cons]
theorem isSublist_iff_sublist [BEq Ξ±] [LawfulBEq Ξ±] {lβ lβ : List Ξ±} :
lβ.isSublist lβ β lβ <+ lβ := by
cases lβ <;> cases lβ <;> simp [isSublist]
case cons.cons hdβ tlβ hdβ tlβ =>
if h_eq : hdβ = hdβ then
simp [h_eq, cons_sublist_cons, isSublist_iff_sublist]
else
simp only [beq_iff_eq, h_eq]
constructor
Β· intro h_sub
apply Sublist.cons
exact isSublist_iff_sublist.mp h_sub
Β· intro h_sub
cases h_sub
case cons h_sub =>
exact isSublist_iff_sublist.mpr h_sub
case consβ =>
contradiction
instance [DecidableEq Ξ±] (lβ lβ : List Ξ±) : Decidable (lβ <+ lβ) :=
decidable_of_iff (lβ.isSublist lβ) isSublist_iff_sublist
theorem tail_eq_tailD (l) : @tail Ξ± l = tailD l [] := by cases l <;> rfl
theorem tail_eq_tail? (l) : @tail Ξ± l = (tail? l).getD [] := by simp [tail_eq_tailD]
@[simp] theorem next?_nil : @next? Ξ± [] = none := rfl
@[simp] theorem next?_cons (a l) : @next? Ξ± (a :: l) = some (a, l) := rfl
theorem get_eq_iff : List.get l n = x β l.get? n.1 = some x := by simp [get?_eq_some]
theorem get?_inj
(hβ : i < xs.length) (hβ : Nodup xs) (hβ : xs.get? i = xs.get? j) : i = j := by
induction xs generalizing i j with
| nil => cases hβ
| cons x xs ih =>
match i, j with
| 0, 0 => rfl
| i+1, j+1 => simp; cases hβ with
| cons ha hβ => exact ih (Nat.lt_of_succ_lt_succ hβ) hβ hβ
| i+1, 0 => ?_ | 0, j+1 => ?_
all_goals
simp at hβ
cases hβ; rename_i h' h
have := h x ?_ rfl; cases this
rw [mem_iff_get?]
exact β¨_, hββ©; exact β¨_ , hβ.symmβ©
theorem tail_drop (l : List Ξ±) (n : Nat) : (l.drop n).tail = l.drop (n + 1) := by
induction l generalizing n with
| nil => simp
| cons hd tl hl =>
cases n
Β· simp
Β· simp [hl]
@[simp] theorem modifyNth_nil (f : Ξ± β Ξ±) (n) : [].modifyNth f n = [] := by cases n <;> rfl
@[simp] theorem modifyNth_zero_cons (f : Ξ± β Ξ±) (a : Ξ±) (l : List Ξ±) :
(a :: l).modifyNth f 0 = f a :: l := rfl
@[simp] theorem modifyNth_succ_cons (f : Ξ± β Ξ±) (a : Ξ±) (l : List Ξ±) (n) :
(a :: l).modifyNth f (n + 1) = a :: l.modifyNth f n := by rfl
theorem modifyNthTail_id : β n (l : List Ξ±), l.modifyNthTail id n = l
| 0, _ => rfl
| _+1, [] => rfl
| n+1, a :: l => congrArg (cons a) (modifyNthTail_id n l)
theorem eraseIdx_eq_modifyNthTail : β n (l : List Ξ±), eraseIdx l n = modifyNthTail tail n l
| 0, l => by cases l <;> rfl
| n+1, [] => rfl
| n+1, a :: l => congrArg (cons _) (eraseIdx_eq_modifyNthTail _ _)
@[deprecated] alias removeNth_eq_nth_tail := eraseIdx_eq_modifyNthTail
theorem get?_modifyNth (f : Ξ± β Ξ±) :
β n (l : List Ξ±) m, (modifyNth f n l).get? m = (fun a => if n = m then f a else a) <$> l.get? m
| n, l, 0 => by cases l <;> cases n <;> rfl
| n, [], _+1 => by cases n <;> rfl
| 0, _ :: l, m+1 => by cases h : l.get? m <;> simp [h, modifyNth, m.succ_ne_zero.symm]
| n+1, a :: l, m+1 =>
(get?_modifyNth f n l m).trans <| by
cases h' : l.get? m <;> by_cases h : n = m <;>
simp [h, if_pos, if_neg, Option.map, mt Nat.succ.inj, not_false_iff, h']
theorem modifyNthTail_length (f : List Ξ± β List Ξ±) (H : β l, length (f l) = length l) :
β n l, length (modifyNthTail f n l) = length l
| 0, _ => H _
| _+1, [] => rfl
| _+1, _ :: _ => congrArg (Β·+1) (modifyNthTail_length _ H _ _)
theorem modifyNthTail_add (f : List Ξ± β List Ξ±) (n) (lβ lβ : List Ξ±) :
modifyNthTail f (lβ.length + n) (lβ ++ lβ) = lβ ++ modifyNthTail f n lβ := by
induction lβ <;> simp [*, Nat.succ_add]
theorem exists_of_modifyNthTail (f : List Ξ± β List Ξ±) {n} {l : List Ξ±} (h : n β€ l.length) :
β lβ lβ, l = lβ ++ lβ β§ lβ.length = n β§ modifyNthTail f n l = lβ ++ f lβ :=
have β¨_, _, eq, hlβ© : β lβ lβ, l = lβ ++ lβ β§ lβ.length = n :=
β¨_, _, (take_append_drop n l).symm, length_take_of_le hβ©
β¨_, _, eq, hl, hl βΈ eq βΈ modifyNthTail_add (n := 0) ..β©
@[simp] theorem modify_get?_length (f : Ξ± β Ξ±) : β n l, length (modifyNth f n l) = length l :=
modifyNthTail_length _ fun l => by cases l <;> rfl
@[simp] theorem get?_modifyNth_eq (f : Ξ± β Ξ±) (n) (l : List Ξ±) :
(modifyNth f n l).get? n = f <$> l.get? n := by
simp only [get?_modifyNth, if_pos]
@[simp] theorem get?_modifyNth_ne (f : Ξ± β Ξ±) {m n} (l : List Ξ±) (h : m β n) :
(modifyNth f m l).get? n = l.get? n := by
simp only [get?_modifyNth, if_neg h, id_map']
theorem exists_of_modifyNth (f : Ξ± β Ξ±) {n} {l : List Ξ±} (h : n < l.length) :
β lβ a lβ, l = lβ ++ a :: lβ β§ lβ.length = n β§ modifyNth f n l = lβ ++ f a :: lβ :=
match exists_of_modifyNthTail _ (Nat.le_of_lt h) with
| β¨_, _::_, eq, hl, Hβ© => β¨_, _, _, eq, hl, Hβ©
| β¨_, [], eq, hl, _β© => nomatch Nat.ne_of_gt h (eq βΈ append_nil _ βΈ hl)
theorem modifyNthTail_eq_take_drop (f : List Ξ± β List Ξ±) (H : f [] = []) :
β n l, modifyNthTail f n l = take n l ++ f (drop n l)
| 0, _ => rfl
| _ + 1, [] => H.symm
| n + 1, b :: l => congrArg (cons b) (modifyNthTail_eq_take_drop f H n l)
theorem modifyNth_eq_take_drop (f : Ξ± β Ξ±) :
β n l, modifyNth f n l = take n l ++ modifyHead f (drop n l) :=
modifyNthTail_eq_take_drop _ rfl
theorem modifyNth_eq_take_cons_drop (f : Ξ± β Ξ±) {n l} (h) :
modifyNth f n l = take n l ++ f (get l β¨n, hβ©) :: drop (n + 1) l := by
rw [modifyNth_eq_take_drop, drop_eq_get_cons h]; rfl
theorem set_eq_modifyNth (a : Ξ±) : β n (l : List Ξ±), set l n a = modifyNth (fun _ => a) n l
| 0, l => by cases l <;> rfl
| n+1, [] => rfl
| n+1, b :: l => congrArg (cons _) (set_eq_modifyNth _ _ _)
theorem set_eq_take_cons_drop (a : Ξ±) {n l} (h : n < length l) :
set l n a = take n l ++ a :: drop (n + 1) l := by
rw [set_eq_modifyNth, modifyNth_eq_take_cons_drop _ h]
theorem modifyNth_eq_set_get? (f : Ξ± β Ξ±) :
β n (l : List Ξ±), l.modifyNth f n = ((fun a => l.set n (f a)) <$> l.get? n).getD l
| 0, l => by cases l <;> rfl
| n+1, [] => rfl
| n+1, b :: l =>
(congrArg (cons _) (modifyNth_eq_set_get? ..)).trans <| by cases h : l.get? n <;> simp [h]
theorem modifyNth_eq_set_get (f : Ξ± β Ξ±) {n} {l : List Ξ±} (h) :
l.modifyNth f n = l.set n (f (l.get β¨n, hβ©)) := by
rw [modifyNth_eq_set_get?, get?_eq_get h]; rfl
theorem exists_of_set {l : List Ξ±} (h : n < l.length) :
β lβ a lβ, l = lβ ++ a :: lβ β§ lβ.length = n β§ l.set n a' = lβ ++ a' :: lβ := by
rw [set_eq_modifyNth]; exact exists_of_modifyNth _ h
theorem exists_of_set' {l : List Ξ±} (h : n < l.length) :
β lβ lβ, l = lβ ++ l.get β¨n, hβ© :: lβ β§ lβ.length = n β§ l.set n a' = lβ ++ a' :: lβ :=
have β¨_, _, _, hβ, hβ, hββ© := exists_of_set h; β¨_, _, get_of_append hβ hβ βΈ hβ, hβ, hββ©
@[simp]
theorem get?_set_eq (a : Ξ±) (n) (l : List Ξ±) : (set l n a).get? n = (fun _ => a) <$> l.get? n := by
simp only [set_eq_modifyNth, get?_modifyNth_eq]
theorem get?_set_eq_of_lt (a : Ξ±) {n} {l : List Ξ±} (h : n < length l) :
(set l n a).get? n = some a := by rw [get?_set_eq, get?_eq_get h]; rfl
@[simp]
theorem get?_set_ne (a : Ξ±) {m n} (l : List Ξ±) (h : m β n) : (set l m a).get? n = l.get? n := by
simp only [set_eq_modifyNth, get?_modifyNth_ne _ _ h]
theorem get?_set (a : Ξ±) {m n} (l : List Ξ±) :
(set l m a).get? n = if m = n then (fun _ => a) <$> l.get? n else l.get? n := by
by_cases m = n <;> simp [*, get?_set_eq, get?_set_ne]
theorem get?_set_of_lt (a : Ξ±) {m n} (l : List Ξ±) (h : n < length l) :
(set l m a).get? n = if m = n then some a else l.get? n := by
simp [get?_set, get?_eq_get h]
theorem get?_set_of_lt' (a : Ξ±) {m n} (l : List Ξ±) (h : m < length l) :
(set l m a).get? n = if m = n then some a else l.get? n := by
simp [get?_set]; split <;> subst_vars <;> simp [*, get?_eq_get h]
theorem drop_set_of_lt (a : Ξ±) {n m : Nat} (l : List Ξ±) (h : n < m) :
(l.set n a).drop m = l.drop m :=
List.ext fun i => by rw [get?_drop, get?_drop, get?_set_ne _ _ (by omega)]
theorem take_set_of_lt (a : Ξ±) {n m : Nat} (l : List Ξ±) (h : m < n) :
(l.set n a).take m = l.take m :=
List.ext fun i => by
rw [get?_take_eq_if, get?_take_eq_if]
split
Β· next h' => rw [get?_set_ne _ _ (by omega)]
Β· rfl
theorem length_eraseIdx : β {l i}, i < length l β length (@eraseIdx Ξ± l i) = length l - 1
| [], _, _ => rfl
| _::_, 0, _ => by simp [eraseIdx]
| x::xs, i+1, h => by
have : i < length xs := Nat.lt_of_succ_lt_succ h
simp [eraseIdx, β Nat.add_one]
rw [length_eraseIdx this, Nat.sub_add_cancel (Nat.lt_of_le_of_lt (Nat.zero_le _) this)]
@[deprecated] alias length_removeNth := length_eraseIdx
@[simp] theorem length_tail (l : List Ξ±) : length (tail l) = length l - 1 := by cases l <;> rfl
@[simp] theorem eraseP_nil : [].eraseP p = [] := rfl
theorem eraseP_cons (a : Ξ±) (l : List Ξ±) :
(a :: l).eraseP p = bif p a then l else a :: l.eraseP p := rfl
@[simp] theorem eraseP_cons_of_pos {l : List Ξ±} (p) (h : p a) : (a :: l).eraseP p = l := by
simp [eraseP_cons, h]
@[simp] theorem eraseP_cons_of_neg {l : List Ξ±} (p) (h : Β¬p a) :
(a :: l).eraseP p = a :: l.eraseP p := by simp [eraseP_cons, h]
theorem eraseP_of_forall_not {l : List Ξ±} (h : β a, a β l β Β¬p a) : l.eraseP p = l := by
induction l with
| nil => rfl
| cons _ _ ih => simp [h _ (.head ..), ih (forall_mem_cons.1 h).2]
theorem exists_of_eraseP : β {l : List Ξ±} {a} (al : a β l) (pa : p a),
β a lβ lβ, (β b β lβ, Β¬p b) β§ p a β§ l = lβ ++ a :: lβ β§ l.eraseP p = lβ ++ lβ
| b :: l, a, al, pa =>
if pb : p b then
β¨b, [], l, forall_mem_nil _, pb, by simp [pb]β©
else
match al with
| .head .. => nomatch pb pa
| .tail _ al =>
let β¨c, lβ, lβ, hβ, hβ, hβ, hββ© := exists_of_eraseP al pa
β¨c, b::lβ, lβ, (forall_mem_cons ..).2 β¨pb, hββ©,
hβ, by rw [hβ, cons_append], by simp [pb, hβ]β©
theorem exists_or_eq_self_of_eraseP (p) (l : List Ξ±) :
l.eraseP p = l β¨
β a lβ lβ, (β b β lβ, Β¬p b) β§ p a β§ l = lβ ++ a :: lβ β§ l.eraseP p = lβ ++ lβ :=
if h : β a β l, p a then
let β¨_, ha, paβ© := h
.inr (exists_of_eraseP ha pa)
else
.inl (eraseP_of_forall_not (h β¨Β·, Β·, Β·β©))
@[simp] theorem length_eraseP_of_mem (al : a β l) (pa : p a) :
length (l.eraseP p) = Nat.pred (length l) := by
let β¨_, lβ, lβ, _, _, eβ, eββ© := exists_of_eraseP al pa
rw [eβ]; simp [length_append, eβ]; rfl
theorem eraseP_append_left {a : Ξ±} (pa : p a) :
β {lβ : List Ξ±} lβ, a β lβ β (lβ++lβ).eraseP p = lβ.eraseP p ++ lβ
| x :: xs, lβ, h => by
by_cases h' : p x <;> simp [h']
rw [eraseP_append_left pa lβ ((mem_cons.1 h).resolve_left (mt _ h'))]
intro | rfl => exact pa
theorem eraseP_append_right :
β {lβ : List Ξ±} lβ, (β b β lβ, Β¬p b) β eraseP p (lβ++lβ) = lβ ++ lβ.eraseP p
| [], lβ, _ => rfl
| x :: xs, lβ, h => by
simp [(forall_mem_cons.1 h).1, eraseP_append_right _ (forall_mem_cons.1 h).2]
theorem eraseP_sublist (l : List Ξ±) : l.eraseP p <+ l := by
match exists_or_eq_self_of_eraseP p l with
| .inl h => rw [h]; apply Sublist.refl
| .inr β¨c, lβ, lβ, _, _, hβ, hββ© => rw [hβ, hβ]; simp
theorem eraseP_subset (l : List Ξ±) : l.eraseP p β l := (eraseP_sublist l).subset
protected theorem Sublist.eraseP : lβ <+ lβ β lβ.eraseP p <+ lβ.eraseP p
| .slnil => Sublist.refl _
| .cons a s => by
by_cases h : p a <;> simp [h]
exacts [s.eraseP.trans (eraseP_sublist _), s.eraseP.cons _]
| .consβ a s => by
by_cases h : p a <;> simp [h]
exacts [s, s.eraseP]
theorem mem_of_mem_eraseP {l : List Ξ±} : a β l.eraseP p β a β l := (eraseP_subset _ Β·)
@[simp] theorem mem_eraseP_of_neg {l : List Ξ±} (pa : Β¬p a) : a β l.eraseP p β a β l := by
refine β¨mem_of_mem_eraseP, fun al => ?_β©
match exists_or_eq_self_of_eraseP p l with
| .inl h => rw [h]; assumption
| .inr β¨c, lβ, lβ, hβ, hβ, hβ, hββ© =>
rw [hβ]; rw [hβ] at al
have : a β c := fun h => (h βΈ pa).elim hβ
simp [this] at al; simp [al]
theorem eraseP_map (f : Ξ² β Ξ±) : β (l : List Ξ²), (map f l).eraseP p = map f (l.eraseP (p β f))
| [] => rfl
| b::l => by by_cases h : p (f b) <;> simp [h, eraseP_map f l, eraseP_cons_of_pos]
@[simp] theorem extractP_eq_find?_eraseP
(l : List Ξ±) : extractP p l = (find? p l, eraseP p l) := by
let rec go (acc) : β xs, l = acc.data ++ xs β
extractP.go p l xs acc = (xs.find? p, acc.data ++ xs.eraseP p)
| [] => fun h => by simp [extractP.go, find?, eraseP, h]
| x::xs => by
simp [extractP.go, find?, eraseP]; cases p x <;> simp
Β· intro h; rw [go _ xs]; {simp}; simp [h]
exact go #[] _ rfl
@[simp] theorem filter_sublist {p : Ξ± β Bool} : β (l : List Ξ±), filter p l <+ l
| [] => .slnil
| a :: l => by rw [filter]; split <;> simp [Sublist.cons, Sublist.consβ, filter_sublist l]
theorem length_filter_le (p : Ξ± β Bool) (l : List Ξ±) :
(l.filter p).length β€ l.length := (filter_sublist _).length_le
theorem length_filterMap_le (f : Ξ± β Option Ξ²) (l : List Ξ±) :
(filterMap f l).length β€ l.length := by
rw [β length_map _ some, map_filterMap_some_eq_filter_map_is_some, β length_map _ f]
apply length_filter_le
protected theorem Sublist.filterMap (f : Ξ± β Option Ξ²) (s : lβ <+ lβ) :
filterMap f lβ <+ filterMap f lβ := by
induction s <;> simp <;> split <;> simp [*, cons, consβ]
theorem Sublist.filter (p : Ξ± β Bool) {lβ lβ} (s : lβ <+ lβ) : filter p lβ <+ filter p lβ := by
rw [β filterMap_eq_filter]; apply s.filterMap
@[simp]
theorem filter_eq_self {l} : filter p l = l β β a β l, p a := by
induction l with simp
| cons a l ih =>
cases h : p a <;> simp [*]
intro h; exact Nat.lt_irrefl _ (h βΈ length_filter_le p l)
@[simp]
theorem filter_length_eq_length {l} : (filter p l).length = l.length β β a β l, p a :=
Iff.trans β¨l.filter_sublist.eq_of_length, congrArg lengthβ© filter_eq_self
@[simp] theorem findIdx_nil {Ξ± : Type _} (p : Ξ± β Bool) : [].findIdx p = 0 := rfl
theorem findIdx_cons (p : Ξ± β Bool) (b : Ξ±) (l : List Ξ±) :
(b :: l).findIdx p = bif p b then 0 else (l.findIdx p) + 1 := by
cases H : p b with
| true => simp [H, findIdx, findIdx.go]
| false => simp [H, findIdx, findIdx.go, findIdx_go_succ]
where
findIdx_go_succ (p : Ξ± β Bool) (l : List Ξ±) (n : Nat) :
List.findIdx.go p l (n + 1) = (findIdx.go p l n) + 1 := by
cases l with
| nil => unfold findIdx.go; exact Nat.succ_eq_add_one n
| cons head tail =>
unfold findIdx.go
cases p head <;> simp only [cond_false, cond_true]
exact findIdx_go_succ p tail (n + 1)
theorem findIdx_of_get?_eq_some {xs : List Ξ±} (w : xs.get? (xs.findIdx p) = some y) : p y := by
induction xs with
| nil => simp_all
| cons x xs ih => by_cases h : p x <;> simp_all [findIdx_cons]
theorem findIdx_get {xs : List Ξ±} {w : xs.findIdx p < xs.length} :
p (xs.get β¨xs.findIdx p, wβ©) :=
xs.findIdx_of_get?_eq_some (get?_eq_get w)
theorem findIdx_lt_length_of_exists {xs : List Ξ±} (h : β x β xs, p x) :
xs.findIdx p < xs.length := by
induction xs with
| nil => simp_all
| cons x xs ih =>
by_cases p x
Β· simp_all only [forall_exists_index, and_imp, mem_cons, exists_eq_or_imp, true_or,
findIdx_cons, cond_true, length_cons]
apply Nat.succ_pos
Β· simp_all [findIdx_cons]
refine Nat.succ_lt_succ ?_
obtain β¨x', m', h'β© := h
exact ih x' m' h'
theorem findIdx_get?_eq_get_of_exists {xs : List Ξ±} (h : β x β xs, p x) :
xs.get? (xs.findIdx p) = some (xs.get β¨xs.findIdx p, xs.findIdx_lt_length_of_exists hβ©) :=
get?_eq_get (findIdx_lt_length_of_exists h)
@[simp] theorem findIdx?_nil : ([] : List Ξ±).findIdx? p i = none := rfl
@[simp] theorem findIdx?_cons :
(x :: xs).findIdx? p i = if p x then some i else findIdx? p xs (i + 1) := rfl
@[simp] theorem findIdx?_succ :
(xs : List Ξ±).findIdx? p (i+1) = (xs.findIdx? p i).map fun i => i + 1 := by
induction xs generalizing i with simp
| cons _ _ _ => split <;> simp_all
theorem findIdx?_eq_some_iff (xs : List Ξ±) (p : Ξ± β Bool) :
xs.findIdx? p = some i β (xs.take (i + 1)).map p = replicate i false ++ [true] := by
induction xs generalizing i with
| nil => simp
| cons x xs ih =>
simp only [findIdx?_cons, Nat.zero_add, findIdx?_succ, take_succ_cons, map_cons]
split <;> cases i <;> simp_all
theorem findIdx?_of_eq_some {xs : List Ξ±} {p : Ξ± β Bool} (w : xs.findIdx? p = some i) :
match xs.get? i with | some a => p a | none => false := by
induction xs generalizing i with
| nil => simp_all
| cons x xs ih =>
simp_all only [findIdx?_cons, Nat.zero_add, findIdx?_succ]
split at w <;> cases i <;> simp_all
theorem findIdx?_of_eq_none {xs : List Ξ±} {p : Ξ± β Bool} (w : xs.findIdx? p = none) :
β i, match xs.get? i with | some a => Β¬ p a | none => true := by
intro i
induction xs generalizing i with
| nil => simp_all
| cons x xs ih =>
simp_all only [Bool.not_eq_true, findIdx?_cons, Nat.zero_add, findIdx?_succ]
cases i with
| zero =>
split at w <;> simp_all
| succ i =>
simp only [get?_cons_succ]
apply ih
split at w <;> simp_all
@[simp] theorem findIdx?_append :
(xs ++ ys : List Ξ±).findIdx? p =
(xs.findIdx? p <|> (ys.findIdx? p).map fun i => i + xs.length) := by
induction xs with simp
| cons _ _ _ => split <;> simp_all [Option.map_orElse, Option.map_map]; rfl
@[simp] theorem findIdx?_replicate :
(replicate n a).findIdx? p = if 0 < n β§ p a then some 0 else none := by
induction n with
| zero => simp
| succ n ih =>
simp only [replicate, findIdx?_cons, Nat.zero_add, findIdx?_succ, Nat.zero_lt_succ, true_and]
split <;> simp_all
theorem Pairwise.sublist : lβ <+ lβ β lβ.Pairwise R β lβ.Pairwise R
| .slnil, h => h
| .cons _ s, .cons _ hβ => hβ.sublist s
| .consβ _ s, .cons hβ hβ => (hβ.sublist s).cons fun _ h => hβ _ (s.subset h)
theorem pairwise_map {l : List Ξ±} :
(l.map f).Pairwise R β l.Pairwise fun a b => R (f a) (f b) := by
induction l
Β· simp
Β· simp only [map, pairwise_cons, forall_mem_map_iff, *]
theorem pairwise_append {lβ lβ : List Ξ±} :
(lβ ++ lβ).Pairwise R β lβ.Pairwise R β§ lβ.Pairwise R β§ β a β lβ, β b β lβ, R a b := by
induction lβ <;> simp [*, or_imp, forall_and, and_assoc, and_left_comm]
theorem pairwise_reverse {l : List Ξ±} :
l.reverse.Pairwise R β l.Pairwise (fun a b => R b a) := by
induction l <;> simp [*, pairwise_append, and_comm]
theorem Pairwise.imp {Ξ± R S} (H : β {a b}, R a b β S a b) :
β {l : List Ξ±}, l.Pairwise R β l.Pairwise S
| _, .nil => .nil
| _, .cons hβ hβ => .cons (H β hβ Β·) (hβ.imp H)
theorem replaceF_nil : [].replaceF p = [] := rfl
theorem replaceF_cons (a : Ξ±) (l : List Ξ±) :
(a :: l).replaceF p = match p a with
| none => a :: replaceF p l
| some a' => a' :: l := rfl
theorem replaceF_cons_of_some {l : List Ξ±} (p) (h : p a = some a') :
(a :: l).replaceF p = a' :: l := by
simp [replaceF_cons, h]
theorem replaceF_cons_of_none {l : List Ξ±} (p) (h : p a = none) :
(a :: l).replaceF p = a :: l.replaceF p := by simp [replaceF_cons, h]
theorem replaceF_of_forall_none {l : List Ξ±} (h : β a, a β l β p a = none) : l.replaceF p = l := by
induction l with
| nil => rfl
| cons _ _ ih => simp [h _ (.head ..), ih (forall_mem_cons.1 h).2]
theorem exists_of_replaceF : β {l : List Ξ±} {a a'} (al : a β l) (pa : p a = some a'),
β a a' lβ lβ,
(β b β lβ, p b = none) β§ p a = some a' β§ l = lβ ++ a :: lβ β§ l.replaceF p = lβ ++ a' :: lβ
| b :: l, a, a', al, pa =>
match pb : p b with
| some b' => β¨b, b', [], l, forall_mem_nil _, pb, by simp [pb]β©
| none =>
match al with
| .head .. => nomatch pb.symm.trans pa
| .tail _ al =>
let β¨c, c', lβ, lβ, hβ, hβ, hβ, hββ© := exists_of_replaceF al pa
β¨c, c', b::lβ, lβ, (forall_mem_cons ..).2 β¨pb, hββ©,
hβ, by rw [hβ, cons_append], by simp [pb, hβ]β©
theorem exists_or_eq_self_of_replaceF (p) (l : List Ξ±) :
l.replaceF p = l β¨ β a a' lβ lβ,
(β b β lβ, p b = none) β§ p a = some a' β§ l = lβ ++ a :: lβ β§ l.replaceF p = lβ ++ a' :: lβ :=
if h : β a β l, (p a).isSome then
let β¨_, ha, paβ© := h
.inr (exists_of_replaceF ha (Option.get_mem pa))
else
.inl <| replaceF_of_forall_none fun a ha =>
Option.not_isSome_iff_eq_none.1 fun h' => h β¨a, ha, h'β©
@[simp] theorem length_replaceF : length (replaceF f l) = length l := by
induction l <;> simp [replaceF]; split <;> simp [*]
theorem disjoint_symm (d : Disjoint lβ lβ) : Disjoint lβ lβ := fun _ iβ iβ => d iβ iβ
theorem disjoint_comm : Disjoint lβ lβ β Disjoint lβ lβ := β¨disjoint_symm, disjoint_symmβ©
theorem disjoint_left : Disjoint lβ lβ β β β¦aβ¦, a β lβ β a β lβ := by simp [Disjoint]
theorem disjoint_right : Disjoint lβ lβ β β β¦aβ¦, a β lβ β a β lβ := disjoint_comm
theorem disjoint_iff_ne : Disjoint lβ lβ β β a β lβ, β b β lβ, a β b :=
β¨fun h _ al1 _ bl2 ab => h al1 (ab βΈ bl2), fun h _ al1 al2 => h _ al1 _ al2 rflβ©
theorem disjoint_of_subset_left (ss : lβ β l) (d : Disjoint l lβ) : Disjoint lβ lβ :=
fun _ m => d (ss m)
theorem disjoint_of_subset_right (ss : lβ β l) (d : Disjoint lβ l) : Disjoint lβ lβ :=
fun _ m mβ => d m (ss mβ)
theorem disjoint_of_disjoint_cons_left {lβ lβ} : Disjoint (a :: lβ) lβ β Disjoint lβ lβ :=
disjoint_of_subset_left (subset_cons _ _)
theorem disjoint_of_disjoint_cons_right {lβ lβ} : Disjoint lβ (a :: lβ) β Disjoint lβ lβ :=
disjoint_of_subset_right (subset_cons _ _)
@[simp] theorem disjoint_nil_left (l : List Ξ±) : Disjoint [] l := fun a => (not_mem_nil a).elim
@[simp] theorem disjoint_nil_right (l : List Ξ±) : Disjoint l [] := by
rw [disjoint_comm]; exact disjoint_nil_left _
@[simp 1100] theorem singleton_disjoint : Disjoint [a] l β a β l := by simp [Disjoint]
@[simp 1100] theorem disjoint_singleton : Disjoint l [a] β a β l := by
rw [disjoint_comm, singleton_disjoint]
@[simp] theorem disjoint_append_left : Disjoint (lβ ++ lβ) l β Disjoint lβ l β§ Disjoint lβ l := by
simp [Disjoint, or_imp, forall_and]
@[simp] theorem disjoint_append_right : Disjoint l (lβ ++ lβ) β Disjoint l lβ β§ Disjoint l lβ :=
disjoint_comm.trans <| by rw [disjoint_append_left]; simp [disjoint_comm]
@[simp] theorem disjoint_cons_left : Disjoint (a::lβ) lβ β (a β lβ) β§ Disjoint lβ lβ :=
(disjoint_append_left (lβ := [a])).trans <| by simp [singleton_disjoint]
@[simp] theorem disjoint_cons_right : Disjoint lβ (a :: lβ) β (a β lβ) β§ Disjoint lβ lβ :=
disjoint_comm.trans <| by rw [disjoint_cons_left]; simp [disjoint_comm]
theorem disjoint_of_disjoint_append_left_left (d : Disjoint (lβ ++ lβ) l) : Disjoint lβ l :=
(disjoint_append_left.1 d).1
theorem disjoint_of_disjoint_append_left_right (d : Disjoint (lβ ++ lβ) l) : Disjoint lβ l :=
(disjoint_append_left.1 d).2
theorem disjoint_of_disjoint_append_right_left (d : Disjoint l (lβ ++ lβ)) : Disjoint l lβ :=
(disjoint_append_right.1 d).1
theorem disjoint_of_disjoint_append_right_right (d : Disjoint l (lβ ++ lβ)) : Disjoint l lβ :=
(disjoint_append_right.1 d).2
theorem foldl_hom (f : Ξ±β β Ξ±β) (gβ : Ξ±β β Ξ² β Ξ±β) (gβ : Ξ±β β Ξ² β Ξ±β) (l : List Ξ²) (init : Ξ±β)
(H : β x y, gβ (f x) y = f (gβ x y)) : l.foldl gβ (f init) = f (l.foldl gβ init) := by
induction l generalizing init <;> simp [*, H]
theorem foldr_hom (f : Ξ²β β Ξ²β) (gβ : Ξ± β Ξ²β β Ξ²β) (gβ : Ξ± β Ξ²β β Ξ²β) (l : List Ξ±) (init : Ξ²β)
(H : β x y, gβ x (f y) = f (gβ x y)) : l.foldr gβ (f init) = f (l.foldr gβ init) := by
induction l <;> simp [*, H]
theorem inter_def [BEq Ξ±] (lβ lβ : List Ξ±) : lβ β© lβ = filter (elem Β· lβ) lβ := rfl
@[simp] theorem mem_inter_iff [BEq Ξ±] [LawfulBEq Ξ±] {x : Ξ±} {lβ lβ : List Ξ±} :
x β lβ β© lβ β x β lβ β§ x β lβ := by
cases lβ <;> simp [List.inter_def, mem_filter]
@[simp]
theorem pair_mem_product {xs : List Ξ±} {ys : List Ξ²} {x : Ξ±} {y : Ξ²} :
(x, y) β product xs ys β x β xs β§ y β ys := by
simp only [product, and_imp, mem_map, Prod.mk.injEq,
exists_eq_right_right, mem_bind, iff_self]
@[simp]
theorem leftpad_length (n : Nat) (a : Ξ±) (l : List Ξ±) :
(leftpad n a l).length = max n l.length := by
simp only [leftpad, length_append, length_replicate, Nat.sub_add_eq_max]
theorem leftpad_prefix (n : Nat) (a : Ξ±) (l : List Ξ±) :
replicate (n - length l) a <+: leftpad n a l := by
simp only [IsPrefix, leftpad]
exact Exists.intro l rfl
theorem leftpad_suffix (n : Nat) (a : Ξ±) (l : List Ξ±) : l <:+ (leftpad n a l) := by
simp only [IsSuffix, leftpad]
exact Exists.intro (replicate (n - length l) a) rfl
-- we use ForIn.forIn as the simp normal form
@[simp] theorem forIn_eq_forIn [Monad m] : @List.forIn Ξ± Ξ² m _ = forIn := rfl
theorem forIn_eq_bindList [Monad m] [LawfulMonad m]
(f : Ξ± β Ξ² β m (ForInStep Ξ²)) (l : List Ξ±) (init : Ξ²) :
forIn l init f = ForInStep.run <$> (ForInStep.yield init).bindList f l := by
induction l generalizing init <;> simp [*, map_eq_pure_bind]
congr; ext (b | b) <;> simp
@[simp] theorem forM_append [Monad m] [LawfulMonad m] (lβ lβ : List Ξ±) (f : Ξ± β m PUnit) :
(lβ ++ lβ).forM f = (do lβ.forM f; lβ.forM f) := by induction lβ <;> simp [*]
@[simp] theorem prefix_append (lβ lβ : List Ξ±) : lβ <+: lβ ++ lβ := β¨lβ, rflβ©
@[simp] theorem suffix_append (lβ lβ : List Ξ±) : lβ <:+ lβ ++ lβ := β¨lβ, rflβ©
theorem infix_append (lβ lβ lβ : List Ξ±) : lβ <:+: lβ ++ lβ ++ lβ := β¨lβ, lβ, rflβ©
@[simp] theorem infix_append' (lβ lβ lβ : List Ξ±) : lβ <:+: lβ ++ (lβ ++ lβ) := by
rw [β List.append_assoc]; apply infix_append
theorem IsPrefix.isInfix : lβ <+: lβ β lβ <:+: lβ := fun β¨t, hβ© => β¨[], t, hβ©
theorem IsSuffix.isInfix : lβ <:+ lβ β lβ <:+: lβ := fun β¨t, hβ© => β¨t, [], by rw [h, append_nil]β©
theorem nil_prefix (l : List Ξ±) : [] <+: l := β¨l, rflβ©
theorem nil_suffix (l : List Ξ±) : [] <:+ l := β¨l, append_nil _β©
theorem nil_infix (l : List Ξ±) : [] <:+: l := (nil_prefix _).isInfix
theorem prefix_refl (l : List Ξ±) : l <+: l := β¨[], append_nil _β©
theorem suffix_refl (l : List Ξ±) : l <:+ l := β¨[], rflβ©
theorem infix_refl (l : List Ξ±) : l <:+: l := (prefix_refl l).isInfix
@[simp] theorem suffix_cons (a : Ξ±) : β l, l <:+ a :: l := suffix_append [a]
theorem infix_cons : lβ <:+: lβ β lβ <:+: a :: lβ := fun β¨Lβ, Lβ, hβ© => β¨a :: Lβ, Lβ, h βΈ rflβ©
theorem infix_concat : lβ <:+: lβ β lβ <:+: concat lβ a := fun β¨Lβ, Lβ, hβ© =>
β¨Lβ, concat Lβ a, by simp [β h, concat_eq_append, append_assoc]β©
theorem IsPrefix.trans : β {lβ lβ lβ : List Ξ±}, lβ <+: lβ β lβ <+: lβ β lβ <+: lβ
| _, _, _, β¨rβ, rflβ©, β¨rβ, rflβ© => β¨rβ ++ rβ, (append_assoc _ _ _).symmβ©
theorem IsSuffix.trans : β {lβ lβ lβ : List Ξ±}, lβ <:+ lβ β lβ <:+ lβ β lβ <:+ lβ
| _, _, _, β¨lβ, rflβ©, β¨lβ, rflβ© => β¨lβ ++ lβ, append_assoc _ _ _β©
theorem IsInfix.trans : β {lβ lβ lβ : List Ξ±}, lβ <:+: lβ β lβ <:+: lβ β lβ <:+: lβ
| l, _, _, β¨lβ, rβ, rflβ©, β¨lβ, rβ, rflβ© => β¨lβ ++ lβ, rβ ++ rβ, by simp only [append_assoc]β©
protected theorem IsInfix.sublist : lβ <:+: lβ β lβ <+ lβ
| β¨_, _, hβ© => h βΈ (sublist_append_right ..).trans (sublist_append_left ..)
protected theorem IsInfix.subset (hl : lβ <:+: lβ) : lβ β lβ :=
hl.sublist.subset
protected theorem IsPrefix.sublist (h : lβ <+: lβ) : lβ <+ lβ :=
h.isInfix.sublist
protected theorem IsPrefix.subset (hl : lβ <+: lβ) : lβ β lβ :=
hl.sublist.subset
protected theorem IsSuffix.sublist (h : lβ <:+ lβ) : lβ <+ lβ :=
h.isInfix.sublist
protected theorem IsSuffix.subset (hl : lβ <:+ lβ) : lβ β lβ :=
hl.sublist.subset
@[simp] theorem reverse_suffix : reverse lβ <:+ reverse lβ β lβ <+: lβ :=
β¨fun β¨r, eβ© => β¨reverse r, by rw [β reverse_reverse lβ, β reverse_append, e, reverse_reverse]β©,
fun β¨r, eβ© => β¨reverse r, by rw [β reverse_append, e]β©β©
@[simp] theorem reverse_prefix : reverse lβ <+: reverse lβ β lβ <:+ lβ := by
rw [β reverse_suffix]; simp only [reverse_reverse]
@[simp] theorem reverse_infix : reverse lβ <:+: reverse lβ β lβ <:+: lβ := by
refine β¨fun β¨s, t, eβ© => β¨reverse t, reverse s, ?_β©, fun β¨s, t, eβ© => β¨reverse t, reverse s, ?_β©β©
Β· rw [β reverse_reverse lβ, append_assoc, β reverse_append, β reverse_append, e,
reverse_reverse]
Β· rw [append_assoc, β reverse_append, β reverse_append, e]
theorem IsInfix.length_le (h : lβ <:+: lβ) : lβ.length β€ lβ.length :=
h.sublist.length_le
theorem IsPrefix.length_le (h : lβ <+: lβ) : lβ.length β€ lβ.length :=
h.sublist.length_le
theorem IsSuffix.length_le (h : lβ <:+ lβ) : lβ.length β€ lβ.length :=
h.sublist.length_le
@[simp] theorem infix_nil : l <:+: [] β l = [] := β¨(sublist_nil.1 Β·.sublist), (Β· βΈ infix_refl _)β©
@[simp] theorem prefix_nil : l <+: [] β l = [] := β¨(sublist_nil.1 Β·.sublist), (Β· βΈ prefix_refl _)β©
@[simp] theorem suffix_nil : l <:+ [] β l = [] := β¨(sublist_nil.1 Β·.sublist), (Β· βΈ suffix_refl _)β©
theorem infix_iff_prefix_suffix (lβ lβ : List Ξ±) : lβ <:+: lβ β β t, lβ <+: t β§ t <:+ lβ :=
β¨fun β¨_, t, eβ© => β¨lβ ++ t, β¨_, rflβ©, e βΈ append_assoc .. βΈ β¨_, rflβ©β©,
fun β¨_, β¨t, rflβ©, s, eβ© => β¨s, t, append_assoc .. βΈ eβ©β©
theorem IsInfix.eq_of_length (h : lβ <:+: lβ) : lβ.length = lβ.length β lβ = lβ :=
h.sublist.eq_of_length
theorem IsPrefix.eq_of_length (h : lβ <+: lβ) : lβ.length = lβ.length β lβ = lβ :=
h.sublist.eq_of_length
theorem IsSuffix.eq_of_length (h : lβ <:+ lβ) : lβ.length = lβ.length β lβ = lβ :=
h.sublist.eq_of_length
theorem prefix_of_prefix_length_le :
β {lβ lβ lβ : List Ξ±}, lβ <+: lβ β lβ <+: lβ β length lβ β€ length lβ β lβ <+: lβ
| [], lβ, _, _, _, _ => nil_prefix _
| a :: lβ, b :: lβ, _, β¨rβ, rflβ©, β¨rβ, eβ©, ll => by
injection e with _ e'; subst b
rcases prefix_of_prefix_length_le β¨_, rflβ© β¨_, e'β© (le_of_succ_le_succ ll) with β¨rβ, rflβ©
exact β¨rβ, rflβ©
theorem prefix_or_prefix_of_prefix (hβ : lβ <+: lβ) (hβ : lβ <+: lβ) : lβ <+: lβ β¨ lβ <+: lβ :=
(Nat.le_total (length lβ) (length lβ)).imp (prefix_of_prefix_length_le hβ hβ)
(prefix_of_prefix_length_le hβ hβ)
theorem suffix_of_suffix_length_le
(hβ : lβ <:+ lβ) (hβ : lβ <:+ lβ) (ll : length lβ β€ length lβ) : lβ <:+ lβ :=
reverse_prefix.1 <|
prefix_of_prefix_length_le (reverse_prefix.2 hβ) (reverse_prefix.2 hβ) (by simp [ll])
theorem suffix_or_suffix_of_suffix (hβ : lβ <:+ lβ) (hβ : lβ <:+ lβ) : lβ <:+ lβ β¨ lβ <:+ lβ :=
(prefix_or_prefix_of_prefix (reverse_prefix.2 hβ) (reverse_prefix.2 hβ)).imp reverse_prefix.1
reverse_prefix.1
theorem suffix_cons_iff : lβ <:+ a :: lβ β lβ = a :: lβ β¨ lβ <:+ lβ := by
constructor
Β· rintro β¨β¨hd, tlβ©, hlββ©
Β· exact Or.inl hlβ
Β· simp only [cons_append] at hlβ
injection hlβ with _ hlβ
exact Or.inr β¨_, hlββ©
Β· rintro (rfl | hlβ)
Β· exact (a :: lβ).suffix_refl
Β· exact hlβ.trans (lβ.suffix_cons _)
theorem infix_cons_iff : lβ <:+: a :: lβ β lβ <+: a :: lβ β¨ lβ <:+: lβ := by
constructor
Β· rintro β¨β¨hd, tlβ©, t, hlββ©
Β· exact Or.inl β¨t, hlββ©
Β· simp only [cons_append] at hlβ
injection hlβ with _ hlβ
exact Or.inr β¨_, t, hlββ©
Β· rintro (h | hlβ)
Β· exact h.isInfix
Β· exact infix_cons hlβ
theorem infix_of_mem_join : β {L : List (List Ξ±)}, l β L β l <:+: join L
| l' :: _, h =>
match h with
| List.Mem.head .. => infix_append [] _ _
| List.Mem.tail _ hlMemL =>
IsInfix.trans (infix_of_mem_join hlMemL) <| (suffix_append _ _).isInfix
theorem prefix_append_right_inj (l) : l ++ lβ <+: l ++ lβ β lβ <+: lβ :=
exists_congr fun r => by rw [append_assoc, append_right_inj]
@[simp]
theorem prefix_cons_inj (a) : a :: lβ <+: a :: lβ β lβ <+: lβ :=
prefix_append_right_inj [a]
theorem take_prefix (n) (l : List Ξ±) : take n l <+: l :=
β¨_, take_append_drop _ _β©
theorem drop_suffix (n) (l : List Ξ±) : drop n l <:+ l :=
β¨_, take_append_drop _ _β©
theorem take_sublist (n) (l : List Ξ±) : take n l <+ l :=
(take_prefix n l).sublist
theorem drop_sublist (n) (l : List Ξ±) : drop n l <+ l :=
(drop_suffix n l).sublist
theorem take_subset (n) (l : List Ξ±) : take n l β l :=
(take_sublist n l).subset
theorem drop_subset (n) (l : List Ξ±) : drop n l β l :=
(drop_sublist n l).subset
theorem mem_of_mem_take {l : List Ξ±} (h : a β l.take n) : a β l :=
take_subset n l h
theorem IsPrefix.filter (p : Ξ± β Bool) β¦lβ lβ : List Ξ±β¦ (h : lβ <+: lβ) :
lβ.filter p <+: lβ.filter p := by
obtain β¨xs, rflβ© := h
rw [filter_append]; apply prefix_append
theorem IsSuffix.filter (p : Ξ± β Bool) β¦lβ lβ : List Ξ±β¦ (h : lβ <:+ lβ) :
lβ.filter p <:+ lβ.filter p := by
obtain β¨xs, rflβ© := h
rw [filter_append]; apply suffix_append
theorem IsInfix.filter (p : Ξ± β Bool) β¦lβ lβ : List Ξ±β¦ (h : lβ <:+: lβ) :
lβ.filter p <:+: lβ.filter p := by
obtain β¨xs, ys, rflβ© := h
rw [filter_append, filter_append]; apply infix_append _
theorem mem_of_mem_drop {n} {l : List Ξ±} (h : a β l.drop n) : a β l := drop_subset _ _ h
theorem disjoint_take_drop : β {l : List Ξ±}, l.Nodup β m β€ n β Disjoint (l.take m) (l.drop n)
| [], _, _ => by simp
| x :: xs, hl, h => by
cases m <;> cases n <;> simp only [disjoint_cons_left, drop, not_mem_nil, disjoint_nil_left,
take, not_false_eq_true, and_self]
Β· case succ.zero => cases h
Β· cases hl with | cons hβ hβ =>
refine β¨fun h => hβ _ (mem_of_mem_drop h) rfl, ?_β©
exact disjoint_take_drop hβ (Nat.le_of_succ_le_succ h)
attribute [simp] Chain.nil
@[simp]
theorem chain_cons {a b : Ξ±} {l : List Ξ±} : Chain R a (b :: l) β R a b β§ Chain R b l :=
β¨fun p => by cases p with | cons n p => exact β¨n, pβ©,
fun β¨n, pβ© => p.cons nβ©
theorem rel_of_chain_cons {a b : Ξ±} {l : List Ξ±} (p : Chain R a (b :: l)) : R a b :=
(chain_cons.1 p).1
theorem chain_of_chain_cons {a b : Ξ±} {l : List Ξ±} (p : Chain R a (b :: l)) : Chain R b l :=
(chain_cons.1 p).2
theorem Chain.imp' {R S : Ξ± β Ξ± β Prop} (HRS : β β¦a bβ¦, R a b β S a b) {a b : Ξ±}
(Hab : β β¦cβ¦, R a c β S b c) {l : List Ξ±} (p : Chain R a l) : Chain S b l := by
induction p generalizing b with
| nil => constructor
| cons r _ ih =>
constructor
Β· exact Hab r
Β· exact ih (@HRS _)
theorem Chain.imp {R S : Ξ± β Ξ± β Prop} (H : β a b, R a b β S a b) {a : Ξ±} {l : List Ξ±}
(p : Chain R a l) : Chain S a l :=
p.imp' H (H a)
protected theorem Pairwise.chain (p : Pairwise R (a :: l)) : Chain R a l := by
let β¨r, p'β© := pairwise_cons.1 p; clear p
induction p' generalizing a with
| nil => exact Chain.nil
| @cons b l r' _ IH =>
simp only [chain_cons, forall_mem_cons] at r
exact chain_cons.2 β¨r.1, IH r'β©
@[simp] theorem length_range' (s step) : β n : Nat, length (range' s n step) = n
| 0 => rfl
| _ + 1 => congrArg succ (length_range' _ _ _)
@[simp] theorem range'_eq_nil : range' s n step = [] β n = 0 := by
rw [β length_eq_zero, length_range']
theorem mem_range' : β{n}, m β range' s n step β β i < n, m = s + step * i
| 0 => by simp [range', Nat.not_lt_zero]
| n + 1 => by
have h (i) : i β€ n β i = 0 β¨ β j, i = succ j β§ j < n := by cases i <;> simp [Nat.succ_le]
simp [range', mem_range', Nat.lt_succ, h]; simp only [β exists_and_right, and_assoc]
rw [exists_comm]; simp [Nat.mul_succ, Nat.add_assoc, Nat.add_comm]
@[simp] theorem mem_range'_1 : m β range' s n β s β€ m β§ m < s + n := by
simp [mem_range']; exact β¨
fun β¨i, h, eβ© => e βΈ β¨Nat.le_add_right .., Nat.add_lt_add_left h _β©,
fun β¨hβ, hββ© => β¨m - s, Nat.sub_lt_left_of_lt_add hβ hβ, (Nat.add_sub_cancel' hβ).symmβ©β©
@[simp]
theorem map_add_range' (a) : β s n step, map (a + Β·) (range' s n step) = range' (a + s) n step
| _, 0, _ => rfl
| s, n + 1, step => by simp [range', map_add_range' _ (s + step) n step, Nat.add_assoc]
theorem map_sub_range' (a s n : Nat) (h : a β€ s) :
map (Β· - a) (range' s n step) = range' (s - a) n step := by
conv => lhs; rw [β Nat.add_sub_cancel' h]
rw [β map_add_range', map_map, (?_ : _β_ = _), map_id]
funext x; apply Nat.add_sub_cancel_left
theorem chain_succ_range' : β s n step : Nat,
Chain (fun a b => b = a + step) s (range' (s + step) n step)
| _, 0, _ => Chain.nil
| s, n + 1, step => (chain_succ_range' (s + step) n step).cons rfl
theorem chain_lt_range' (s n : Nat) {step} (h : 0 < step) :
Chain (Β· < Β·) s (range' (s + step) n step) :=
(chain_succ_range' s n step).imp fun _ _ e => e.symm βΈ Nat.lt_add_of_pos_right h
theorem range'_append : β s m n step : Nat,
range' s m step ++ range' (s + step * m) n step = range' s (n + m) step
| s, 0, n, step => rfl
| s, m + 1, n, step => by
simpa [range', Nat.mul_succ, Nat.add_assoc, Nat.add_comm]
using range'_append (s + step) m n step
@[simp] theorem range'_append_1 (s m n : Nat) :
range' s m ++ range' (s + m) n = range' s (n + m) := by simpa using range'_append s m n 1
theorem range'_sublist_right {s m n : Nat} : range' s m step <+ range' s n step β m β€ n :=
β¨fun h => by simpa only [length_range'] using h.length_le,
fun h => by rw [β Nat.sub_add_cancel h, β range'_append]; apply sublist_append_leftβ©
theorem range'_subset_right {s m n : Nat} (step0 : 0 < step) :
range' s m step β range' s n step β m β€ n := by
refine β¨fun h => Nat.le_of_not_lt fun hn => ?_, fun h => (range'_sublist_right.2 h).subsetβ©
have β¨i, h', eβ© := mem_range'.1 <| h <| mem_range'.2 β¨_, hn, rflβ©
exact Nat.ne_of_gt h' (Nat.eq_of_mul_eq_mul_left step0 (Nat.add_left_cancel e))
theorem range'_subset_right_1 {s m n : Nat} : range' s m β range' s n β m β€ n :=
range'_subset_right (by decide)
theorem get?_range' (s step) : β {m n : Nat}, m < n β get? (range' s n step) m = some (s + step * m)
| 0, n + 1, _ => rfl
| m + 1, n + 1, h =>
(get?_range' (s + step) step (Nat.lt_of_add_lt_add_right h)).trans <| by
simp [Nat.mul_succ, Nat.add_assoc, Nat.add_comm]
@[simp] theorem get_range' {n m step} (i) (H : i < (range' n m step).length) :
get (range' n m step) β¨i, Hβ© = n + step * i :=
(get?_eq_some.1 <| get?_range' n step (by simpa using H)).2
theorem range'_concat (s n : Nat) : range' s (n + 1) step = range' s n step ++ [s + step * n] := by
rw [Nat.add_comm n 1]; exact (range'_append s n 1 step).symm
theorem range'_1_concat (s n : Nat) : range' s (n + 1) = range' s n ++ [s + n] := by
simp [range'_concat]
theorem range_loop_range' : β s n : Nat, range.loop s (range' s n) = range' 0 (n + s)
| 0, n => rfl
| s + 1, n => by rw [β Nat.add_assoc, Nat.add_right_comm n s 1]; exact range_loop_range' s (n + 1)
theorem range_eq_range' (n : Nat) : range n = range' 0 n :=
(range_loop_range' n 0).trans <| by rw [Nat.zero_add]
theorem range_succ_eq_map (n : Nat) : range (n + 1) = 0 :: map succ (range n) := by
rw [range_eq_range', range_eq_range', range', Nat.add_comm, β map_add_range']
congr; exact funext one_add
theorem range'_eq_map_range (s n : Nat) : range' s n = map (s + Β·) (range n) := by
rw [range_eq_range', map_add_range']; rfl
@[simp] theorem length_range (n : Nat) : length (range n) = n := by
simp only [range_eq_range', length_range']
@[simp] theorem range_eq_nil {n : Nat} : range n = [] β n = 0 := by
rw [β length_eq_zero, length_range]
@[simp]
theorem range_sublist {m n : Nat} : range m <+ range n β m β€ n := by
simp only [range_eq_range', range'_sublist_right]
@[simp]
| .lake/packages/batteries/Batteries/Data/List/Lemmas.lean | 1,375 | 1,376 | theorem range_subset {m n : Nat} : range m β range n β m β€ n := by |
simp only [range_eq_range', range'_subset_right, lt_succ_self]
|
import Mathlib.Data.ZMod.Quotient
#align_import group_theory.complement from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
open Set
open scoped Pointwise
namespace Subgroup
variable {G : Type*} [Group G] (H K : Subgroup G) (S T : Set G)
@[to_additive "`S` and `T` are complements if `(+) : S Γ T β G` is a bijection"]
def IsComplement : Prop :=
Function.Bijective fun x : S Γ T => x.1.1 * x.2.1
#align subgroup.is_complement Subgroup.IsComplement
#align add_subgroup.is_complement AddSubgroup.IsComplement
@[to_additive "`H` and `K` are complements if `(+) : H Γ K β G` is a bijection"]
abbrev IsComplement' :=
IsComplement (H : Set G) (K : Set G)
#align subgroup.is_complement' Subgroup.IsComplement'
#align add_subgroup.is_complement' AddSubgroup.IsComplement'
@[to_additive "The set of left-complements of `T : Set G`"]
def leftTransversals : Set (Set G) :=
{ S : Set G | IsComplement S T }
#align subgroup.left_transversals Subgroup.leftTransversals
#align add_subgroup.left_transversals AddSubgroup.leftTransversals
@[to_additive "The set of right-complements of `S : Set G`"]
def rightTransversals : Set (Set G) :=
{ T : Set G | IsComplement S T }
#align subgroup.right_transversals Subgroup.rightTransversals
#align add_subgroup.right_transversals AddSubgroup.rightTransversals
variable {H K S T}
@[to_additive]
theorem isComplement'_def : IsComplement' H K β IsComplement (H : Set G) (K : Set G) :=
Iff.rfl
#align subgroup.is_complement'_def Subgroup.isComplement'_def
#align add_subgroup.is_complement'_def AddSubgroup.isComplement'_def
@[to_additive]
theorem isComplement_iff_existsUnique :
IsComplement S T β β g : G, β! x : S Γ T, x.1.1 * x.2.1 = g :=
Function.bijective_iff_existsUnique _
#align subgroup.is_complement_iff_exists_unique Subgroup.isComplement_iff_existsUnique
#align add_subgroup.is_complement_iff_exists_unique AddSubgroup.isComplement_iff_existsUnique
@[to_additive]
theorem IsComplement.existsUnique (h : IsComplement S T) (g : G) :
β! x : S Γ T, x.1.1 * x.2.1 = g :=
isComplement_iff_existsUnique.mp h g
#align subgroup.is_complement.exists_unique Subgroup.IsComplement.existsUnique
#align add_subgroup.is_complement.exists_unique AddSubgroup.IsComplement.existsUnique
@[to_additive]
theorem IsComplement'.symm (h : IsComplement' H K) : IsComplement' K H := by
let Ο : H Γ K β K Γ H :=
Equiv.mk (fun x => β¨x.2β»ΒΉ, x.1β»ΒΉβ©) (fun x => β¨x.2β»ΒΉ, x.1β»ΒΉβ©)
(fun x => Prod.ext (inv_inv _) (inv_inv _)) fun x => Prod.ext (inv_inv _) (inv_inv _)
let Ο : G β G := Equiv.mk (fun g : G => gβ»ΒΉ) (fun g : G => gβ»ΒΉ) inv_inv inv_inv
suffices hf : (Ο β fun x : H Γ K => x.1.1 * x.2.1) = (fun x : K Γ H => x.1.1 * x.2.1) β Ο by
rw [isComplement'_def, IsComplement, β Equiv.bijective_comp Ο]
apply (congr_arg Function.Bijective hf).mp -- Porting note: This was a `rw` in mathlib3
rwa [Ο.comp_bijective]
exact funext fun x => mul_inv_rev _ _
#align subgroup.is_complement'.symm Subgroup.IsComplement'.symm
#align add_subgroup.is_complement'.symm AddSubgroup.IsComplement'.symm
@[to_additive]
theorem isComplement'_comm : IsComplement' H K β IsComplement' K H :=
β¨IsComplement'.symm, IsComplement'.symmβ©
#align subgroup.is_complement'_comm Subgroup.isComplement'_comm
#align add_subgroup.is_complement'_comm AddSubgroup.isComplement'_comm
@[to_additive]
theorem isComplement_univ_singleton {g : G} : IsComplement (univ : Set G) {g} :=
β¨fun β¨_, _, rflβ© β¨_, _, rflβ© h => Prod.ext (Subtype.ext (mul_right_cancel h)) rfl, fun x =>
β¨β¨β¨x * gβ»ΒΉ, β¨β©β©, g, rflβ©, inv_mul_cancel_right x gβ©β©
#align subgroup.is_complement_top_singleton Subgroup.isComplement_univ_singleton
#align add_subgroup.is_complement_top_singleton AddSubgroup.isComplement_univ_singleton
@[to_additive]
theorem isComplement_singleton_univ {g : G} : IsComplement ({g} : Set G) univ :=
β¨fun β¨β¨_, rflβ©, _β© β¨β¨_, rflβ©, _β© h => Prod.ext rfl (Subtype.ext (mul_left_cancel h)), fun x =>
β¨β¨β¨g, rflβ©, gβ»ΒΉ * x, β¨β©β©, mul_inv_cancel_left g xβ©β©
#align subgroup.is_complement_singleton_top Subgroup.isComplement_singleton_univ
#align add_subgroup.is_complement_singleton_top AddSubgroup.isComplement_singleton_univ
@[to_additive]
theorem isComplement_singleton_left {g : G} : IsComplement {g} S β S = univ := by
refine
β¨fun h => top_le_iff.mp fun x _ => ?_, fun h => (congr_arg _ h).mpr isComplement_singleton_univβ©
obtain β¨β¨β¨z, rfl : z = gβ©, y, _β©, hyβ© := h.2 (g * x)
rwa [β mul_left_cancel hy]
#align subgroup.is_complement_singleton_left Subgroup.isComplement_singleton_left
#align add_subgroup.is_complement_singleton_left AddSubgroup.isComplement_singleton_left
@[to_additive]
theorem isComplement_singleton_right {g : G} : IsComplement S {g} β S = univ := by
refine
β¨fun h => top_le_iff.mp fun x _ => ?_, fun h => h βΈ isComplement_univ_singletonβ©
obtain β¨y, hyβ© := h.2 (x * g)
conv_rhs at hy => rw [β show y.2.1 = g from y.2.2]
rw [β mul_right_cancel hy]
exact y.1.2
#align subgroup.is_complement_singleton_right Subgroup.isComplement_singleton_right
#align add_subgroup.is_complement_singleton_right AddSubgroup.isComplement_singleton_right
@[to_additive]
| Mathlib/GroupTheory/Complement.lean | 144 | 153 | theorem isComplement_univ_left : IsComplement univ S β β g : G, S = {g} := by |
refine
β¨fun h => Set.exists_eq_singleton_iff_nonempty_subsingleton.mpr β¨?_, fun a ha b hb => ?_β©, ?_β©
Β· obtain β¨a, _β© := h.2 1
exact β¨a.2.1, a.2.2β©
Β· have : (β¨β¨_, mem_top aβ»ΒΉβ©, β¨a, haβ©β© : (β€ : Set G) Γ S) = β¨β¨_, mem_top bβ»ΒΉβ©, β¨b, hbβ©β© :=
h.1 ((inv_mul_self a).trans (inv_mul_self b).symm)
exact Subtype.ext_iff.mp (Prod.ext_iff.mp this).2
Β· rintro β¨g, rflβ©
exact isComplement_univ_singleton
|
import Mathlib.Data.Set.Function
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.Says
#align_import logic.equiv.set from "leanprover-community/mathlib"@"aba57d4d3dae35460225919dcd82fe91355162f9"
open Function Set
universe u v w z
variable {Ξ± : Sort u} {Ξ² : Sort v} {Ξ³ : Sort w}
namespace Equiv
@[simp]
theorem range_eq_univ {Ξ± : Type*} {Ξ² : Type*} (e : Ξ± β Ξ²) : range e = univ :=
eq_univ_of_forall e.surjective
#align equiv.range_eq_univ Equiv.range_eq_univ
protected theorem image_eq_preimage {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) : e '' s = e.symm β»ΒΉ' s :=
Set.ext fun _ => mem_image_iff_of_inverse e.left_inv e.right_inv
#align equiv.image_eq_preimage Equiv.image_eq_preimage
@[simp 1001]
theorem _root_.Set.mem_image_equiv {Ξ± Ξ²} {S : Set Ξ±} {f : Ξ± β Ξ²} {x : Ξ²} :
x β f '' S β f.symm x β S :=
Set.ext_iff.mp (f.image_eq_preimage S) x
#align set.mem_image_equiv Set.mem_image_equiv
theorem _root_.Set.image_equiv_eq_preimage_symm {Ξ± Ξ²} (S : Set Ξ±) (f : Ξ± β Ξ²) :
f '' S = f.symm β»ΒΉ' S :=
f.image_eq_preimage S
#align set.image_equiv_eq_preimage_symm Set.image_equiv_eq_preimage_symm
theorem _root_.Set.preimage_equiv_eq_image_symm {Ξ± Ξ²} (S : Set Ξ±) (f : Ξ² β Ξ±) :
f β»ΒΉ' S = f.symm '' S :=
(f.symm.image_eq_preimage S).symm
#align set.preimage_equiv_eq_image_symm Set.preimage_equiv_eq_image_symm
-- Porting note: increased priority so this fires before `image_subset_iff`
@[simp high]
protected theorem symm_image_subset {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) (t : Set Ξ²) :
e.symm '' t β s β t β e '' s := by rw [image_subset_iff, e.image_eq_preimage]
#align equiv.subset_image Equiv.symm_image_subset
@[deprecated (since := "2024-01-19")] alias subset_image := Equiv.symm_image_subset
-- Porting note: increased priority so this fires before `image_subset_iff`
@[simp high]
protected theorem subset_symm_image {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) (t : Set Ξ²) :
s β e.symm '' t β e '' s β t :=
calc
s β e.symm '' t β e.symm.symm '' s β t := by rw [e.symm.symm_image_subset]
_ β e '' s β t := by rw [e.symm_symm]
#align equiv.subset_image' Equiv.subset_symm_image
@[deprecated (since := "2024-01-19")] alias subset_image' := Equiv.subset_symm_image
@[simp]
theorem symm_image_image {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) : e.symm '' (e '' s) = s :=
e.leftInverse_symm.image_image s
#align equiv.symm_image_image Equiv.symm_image_image
theorem eq_image_iff_symm_image_eq {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) (t : Set Ξ²) :
t = e '' s β e.symm '' t = s :=
(e.symm.injective.image_injective.eq_iff' (e.symm_image_image s)).symm
#align equiv.eq_image_iff_symm_image_eq Equiv.eq_image_iff_symm_image_eq
@[simp]
theorem image_symm_image {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ²) : e '' (e.symm '' s) = s :=
e.symm.symm_image_image s
#align equiv.image_symm_image Equiv.image_symm_image
@[simp]
theorem image_preimage {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ²) : e '' (e β»ΒΉ' s) = s :=
e.surjective.image_preimage s
#align equiv.image_preimage Equiv.image_preimage
@[simp]
theorem preimage_image {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) : e β»ΒΉ' (e '' s) = s :=
e.injective.preimage_image s
#align equiv.preimage_image Equiv.preimage_image
protected theorem image_compl {Ξ± Ξ²} (f : Equiv Ξ± Ξ²) (s : Set Ξ±) : f '' sαΆ = (f '' s)αΆ :=
image_compl_eq f.bijective
#align equiv.image_compl Equiv.image_compl
@[simp]
theorem symm_preimage_preimage {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ²) : e.symm β»ΒΉ' (e β»ΒΉ' s) = s :=
e.rightInverse_symm.preimage_preimage s
#align equiv.symm_preimage_preimage Equiv.symm_preimage_preimage
@[simp]
theorem preimage_symm_preimage {Ξ± Ξ²} (e : Ξ± β Ξ²) (s : Set Ξ±) : e β»ΒΉ' (e.symm β»ΒΉ' s) = s :=
e.leftInverse_symm.preimage_preimage s
#align equiv.preimage_symm_preimage Equiv.preimage_symm_preimage
theorem preimage_subset {Ξ± Ξ²} (e : Ξ± β Ξ²) (s t : Set Ξ²) : e β»ΒΉ' s β e β»ΒΉ' t β s β t :=
e.surjective.preimage_subset_preimage_iff
#align equiv.preimage_subset Equiv.preimage_subset
-- Porting note (#10618): removed `simp` attribute. `simp` can prove it.
theorem image_subset {Ξ± Ξ²} (e : Ξ± β Ξ²) (s t : Set Ξ±) : e '' s β e '' t β s β t :=
image_subset_image_iff e.injective
#align equiv.image_subset Equiv.image_subset
@[simp]
theorem image_eq_iff_eq {Ξ± Ξ²} (e : Ξ± β Ξ²) (s t : Set Ξ±) : e '' s = e '' t β s = t :=
image_eq_image e.injective
#align equiv.image_eq_iff_eq Equiv.image_eq_iff_eq
theorem preimage_eq_iff_eq_image {Ξ± Ξ²} (e : Ξ± β Ξ²) (s t) : e β»ΒΉ' s = t β s = e '' t :=
Set.preimage_eq_iff_eq_image e.bijective
#align equiv.preimage_eq_iff_eq_image Equiv.preimage_eq_iff_eq_image
theorem eq_preimage_iff_image_eq {Ξ± Ξ²} (e : Ξ± β Ξ²) (s t) : s = e β»ΒΉ' t β e '' s = t :=
Set.eq_preimage_iff_image_eq e.bijective
#align equiv.eq_preimage_iff_image_eq Equiv.eq_preimage_iff_image_eq
lemma setOf_apply_symm_eq_image_setOf {Ξ± Ξ²} (e : Ξ± β Ξ²) (p : Ξ± β Prop) :
{b | p (e.symm b)} = e '' {a | p a} := by
rw [Equiv.image_eq_preimage, preimage_setOf_eq]
@[simp]
theorem prod_assoc_preimage {Ξ± Ξ² Ξ³} {s : Set Ξ±} {t : Set Ξ²} {u : Set Ξ³} :
Equiv.prodAssoc Ξ± Ξ² Ξ³ β»ΒΉ' s ΓΛ’ t ΓΛ’ u = (s ΓΛ’ t) ΓΛ’ u := by
ext
simp [and_assoc]
#align equiv.prod_assoc_preimage Equiv.prod_assoc_preimage
@[simp]
| Mathlib/Logic/Equiv/Set.lean | 155 | 158 | theorem prod_assoc_symm_preimage {Ξ± Ξ² Ξ³} {s : Set Ξ±} {t : Set Ξ²} {u : Set Ξ³} :
(Equiv.prodAssoc Ξ± Ξ² Ξ³).symm β»ΒΉ' (s ΓΛ’ t) ΓΛ’ u = s ΓΛ’ t ΓΛ’ u := by |
ext
simp [and_assoc]
|
import Mathlib.Data.Nat.Bitwise
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Game.Impartial
#align_import set_theory.game.nim from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
noncomputable section
universe u
namespace SetTheory
open scoped PGame
namespace PGame
-- Uses `noncomputable!` to avoid `rec_fn_macro only allowed in meta definitions` VM error
noncomputable def nim : Ordinal.{u} β PGame.{u}
| oβ =>
let f oβ :=
have _ : Ordinal.typein oβ.out.r oβ < oβ := Ordinal.typein_lt_self oβ
nim (Ordinal.typein oβ.out.r oβ)
β¨oβ.out.Ξ±, oβ.out.Ξ±, f, fβ©
termination_by o => o
#align pgame.nim SetTheory.PGame.nim
open Ordinal
theorem nim_def (o : Ordinal) :
have : IsWellOrder (Quotient.out o).Ξ± (Β· < Β·) := inferInstance
nim o =
PGame.mk o.out.Ξ± o.out.Ξ± (fun oβ => nim (Ordinal.typein (Β· < Β·) oβ)) fun oβ =>
nim (Ordinal.typein (Β· < Β·) oβ) := by
rw [nim]; rfl
#align pgame.nim_def SetTheory.PGame.nim_def
theorem leftMoves_nim (o : Ordinal) : (nim o).LeftMoves = o.out.Ξ± := by rw [nim_def]; rfl
#align pgame.left_moves_nim SetTheory.PGame.leftMoves_nim
theorem rightMoves_nim (o : Ordinal) : (nim o).RightMoves = o.out.Ξ± := by rw [nim_def]; rfl
#align pgame.right_moves_nim SetTheory.PGame.rightMoves_nim
| Mathlib/SetTheory/Game/Nim.lean | 73 | 75 | theorem moveLeft_nim_hEq (o : Ordinal) :
have : IsWellOrder (Quotient.out o).Ξ± (Β· < Β·) := inferInstance
HEq (nim o).moveLeft fun i : o.out.Ξ± => nim (typein (Β· < Β·) i) := by | rw [nim_def]; rfl
|
import Mathlib.Algebra.Star.Basic
import Mathlib.Algebra.Order.CauSeq.Completion
#align_import data.real.basic from "leanprover-community/mathlib"@"cb42593171ba005beaaf4549fcfe0dece9ada4c9"
assert_not_exists Finset
assert_not_exists Module
assert_not_exists Submonoid
assert_not_exists FloorRing
structure Real where ofCauchy ::
cauchy : CauSeq.Completion.Cauchy (abs : β β β)
#align real Real
@[inherit_doc]
notation "β" => Real
-- Porting note: unknown attribute
-- attribute [pp_using_anonymous_constructor] Real
namespace Real
open CauSeq CauSeq.Completion
variable {x y : β}
theorem ext_cauchy_iff : β {x y : Real}, x = y β x.cauchy = y.cauchy
| β¨aβ©, β¨bβ© => by rw [ofCauchy.injEq]
#align real.ext_cauchy_iff Real.ext_cauchy_iff
theorem ext_cauchy {x y : Real} : x.cauchy = y.cauchy β x = y :=
ext_cauchy_iff.2
#align real.ext_cauchy Real.ext_cauchy
def equivCauchy : β β CauSeq.Completion.Cauchy (abs : β β β) :=
β¨Real.cauchy, Real.ofCauchy, fun β¨_β© => rfl, fun _ => rflβ©
set_option linter.uppercaseLean3 false in
#align real.equiv_Cauchy Real.equivCauchy
-- irreducible doesn't work for instances: https://github.com/leanprover-community/lean/issues/511
private irreducible_def zero : β :=
β¨0β©
private irreducible_def one : β :=
β¨1β©
private irreducible_def add : β β β β β
| β¨aβ©, β¨bβ© => β¨a + bβ©
private irreducible_def neg : β β β
| β¨aβ© => β¨-aβ©
private irreducible_def mul : β β β β β
| β¨aβ©, β¨bβ© => β¨a * bβ©
private noncomputable irreducible_def inv' : β β β
| β¨aβ© => β¨aβ»ΒΉβ©
instance : Zero β :=
β¨zeroβ©
instance : One β :=
β¨oneβ©
instance : Add β :=
β¨addβ©
instance : Neg β :=
β¨negβ©
instance : Mul β :=
β¨mulβ©
instance : Sub β :=
β¨fun a b => a + -bβ©
noncomputable instance : Inv β :=
β¨inv'β©
theorem ofCauchy_zero : (β¨0β© : β) = 0 :=
zero_def.symm
#align real.of_cauchy_zero Real.ofCauchy_zero
theorem ofCauchy_one : (β¨1β© : β) = 1 :=
one_def.symm
#align real.of_cauchy_one Real.ofCauchy_one
theorem ofCauchy_add (a b) : (β¨a + bβ© : β) = β¨aβ© + β¨bβ© :=
(add_def _ _).symm
#align real.of_cauchy_add Real.ofCauchy_add
theorem ofCauchy_neg (a) : (β¨-aβ© : β) = -β¨aβ© :=
(neg_def _).symm
#align real.of_cauchy_neg Real.ofCauchy_neg
theorem ofCauchy_sub (a b) : (β¨a - bβ© : β) = β¨aβ© - β¨bβ© := by
rw [sub_eq_add_neg, ofCauchy_add, ofCauchy_neg]
rfl
#align real.of_cauchy_sub Real.ofCauchy_sub
theorem ofCauchy_mul (a b) : (β¨a * bβ© : β) = β¨aβ© * β¨bβ© :=
(mul_def _ _).symm
#align real.of_cauchy_mul Real.ofCauchy_mul
theorem ofCauchy_inv {f} : (β¨fβ»ΒΉβ© : β) = β¨fβ©β»ΒΉ :=
show _ = inv' _ by rw [inv']
#align real.of_cauchy_inv Real.ofCauchy_inv
theorem cauchy_zero : (0 : β).cauchy = 0 :=
show zero.cauchy = 0 by rw [zero_def]
#align real.cauchy_zero Real.cauchy_zero
theorem cauchy_one : (1 : β).cauchy = 1 :=
show one.cauchy = 1 by rw [one_def]
#align real.cauchy_one Real.cauchy_one
theorem cauchy_add : β a b, (a + b : β).cauchy = a.cauchy + b.cauchy
| β¨aβ©, β¨bβ© => show (add _ _).cauchy = _ by rw [add_def]
#align real.cauchy_add Real.cauchy_add
theorem cauchy_neg : β a, (-a : β).cauchy = -a.cauchy
| β¨aβ© => show (neg _).cauchy = _ by rw [neg_def]
#align real.cauchy_neg Real.cauchy_neg
theorem cauchy_mul : β a b, (a * b : β).cauchy = a.cauchy * b.cauchy
| β¨aβ©, β¨bβ© => show (mul _ _).cauchy = _ by rw [mul_def]
#align real.cauchy_mul Real.cauchy_mul
theorem cauchy_sub : β a b, (a - b : β).cauchy = a.cauchy - b.cauchy
| β¨aβ©, β¨bβ© => by
rw [sub_eq_add_neg, β cauchy_neg, β cauchy_add]
rfl
#align real.cauchy_sub Real.cauchy_sub
theorem cauchy_inv : β f, (fβ»ΒΉ : β).cauchy = f.cauchyβ»ΒΉ
| β¨fβ© => show (inv' _).cauchy = _ by rw [inv']
#align real.cauchy_inv Real.cauchy_inv
instance instNatCast : NatCast β where natCast n := β¨nβ©
instance instIntCast : IntCast β where intCast z := β¨zβ©
instance instNNRatCast : NNRatCast β where nnratCast q := β¨qβ©
instance instRatCast : RatCast β where ratCast q := β¨qβ©
lemma ofCauchy_natCast (n : β) : (β¨nβ© : β) = n := rfl
lemma ofCauchy_intCast (z : β€) : (β¨zβ© : β) = z := rfl
lemma ofCauchy_nnratCast (q : ββ₯0) : (β¨qβ© : β) = q := rfl
lemma ofCauchy_ratCast (q : β) : (β¨qβ© : β) = q := rfl
#align real.of_cauchy_nat_cast Real.ofCauchy_natCast
#align real.of_cauchy_int_cast Real.ofCauchy_intCast
#align real.of_cauchy_rat_cast Real.ofCauchy_ratCast
lemma cauchy_natCast (n : β) : (n : β).cauchy = n := rfl
lemma cauchy_intCast (z : β€) : (z : β).cauchy = z := rfl
lemma cauchy_nnratCast (q : ββ₯0) : (q : β).cauchy = q := rfl
lemma cauchy_ratCast (q : β) : (q : β).cauchy = q := rfl
#align real.cauchy_nat_cast Real.cauchy_natCast
#align real.cauchy_int_cast Real.cauchy_intCast
#align real.cauchy_rat_cast Real.cauchy_ratCast
instance commRing : CommRing β where
natCast n := β¨nβ©
intCast z := β¨zβ©
zero := (0 : β)
one := (1 : β)
mul := (Β· * Β·)
add := (Β· + Β·)
neg := @Neg.neg β _
sub := @Sub.sub β _
npow := @npowRec β β¨1β© β¨(Β· * Β·)β©
nsmul := @nsmulRec β β¨0β© β¨(Β· + Β·)β©
zsmul := @zsmulRec β β¨0β© β¨(Β· + Β·)β© β¨@Neg.neg β _β© (@nsmulRec β β¨0β© β¨(Β· + Β·)β©)
add_zero a := by apply ext_cauchy; simp [cauchy_add, cauchy_zero]
zero_add a := by apply ext_cauchy; simp [cauchy_add, cauchy_zero]
add_comm a b := by apply ext_cauchy; simp only [cauchy_add, add_comm]
add_assoc a b c := by apply ext_cauchy; simp only [cauchy_add, add_assoc]
mul_zero a := by apply ext_cauchy; simp [cauchy_mul, cauchy_zero]
zero_mul a := by apply ext_cauchy; simp [cauchy_mul, cauchy_zero]
mul_one a := by apply ext_cauchy; simp [cauchy_mul, cauchy_one]
one_mul a := by apply ext_cauchy; simp [cauchy_mul, cauchy_one]
mul_comm a b := by apply ext_cauchy; simp only [cauchy_mul, mul_comm]
mul_assoc a b c := by apply ext_cauchy; simp only [cauchy_mul, mul_assoc]
left_distrib a b c := by apply ext_cauchy; simp only [cauchy_add, cauchy_mul, mul_add]
right_distrib a b c := by apply ext_cauchy; simp only [cauchy_add, cauchy_mul, add_mul]
add_left_neg a := by apply ext_cauchy; simp [cauchy_add, cauchy_neg, cauchy_zero]
natCast_zero := by apply ext_cauchy; simp [cauchy_zero]
natCast_succ n := by apply ext_cauchy; simp [cauchy_one, cauchy_add]
intCast_negSucc z := by apply ext_cauchy; simp [cauchy_neg, cauchy_natCast]
@[simps]
def ringEquivCauchy : β β+* CauSeq.Completion.Cauchy (abs : β β β) :=
{ equivCauchy with
toFun := cauchy
invFun := ofCauchy
map_add' := cauchy_add
map_mul' := cauchy_mul }
set_option linter.uppercaseLean3 false in
#align real.ring_equiv_Cauchy Real.ringEquivCauchy
set_option linter.uppercaseLean3 false in
#align real.ring_equiv_Cauchy_apply Real.ringEquivCauchy_apply
set_option linter.uppercaseLean3 false in
#align real.ring_equiv_Cauchy_symm_apply_cauchy Real.ringEquivCauchy_symm_apply_cauchy
instance instRing : Ring β := by infer_instance
instance : CommSemiring β := by infer_instance
instance semiring : Semiring β := by infer_instance
instance : CommMonoidWithZero β := by infer_instance
instance : MonoidWithZero β := by infer_instance
instance : AddCommGroup β := by infer_instance
instance : AddGroup β := by infer_instance
instance : AddCommMonoid β := by infer_instance
instance : AddMonoid β := by infer_instance
instance : AddLeftCancelSemigroup β := by infer_instance
instance : AddRightCancelSemigroup β := by infer_instance
instance : AddCommSemigroup β := by infer_instance
instance : AddSemigroup β := by infer_instance
instance : CommMonoid β := by infer_instance
instance : Monoid β := by infer_instance
instance : CommSemigroup β := by infer_instance
instance : Semigroup β := by infer_instance
instance : Inhabited β :=
β¨0β©
instance : StarRing β :=
starRingOfComm
instance : TrivialStar β :=
β¨fun _ => rflβ©
def mk (x : CauSeq β abs) : β :=
β¨CauSeq.Completion.mk xβ©
#align real.mk Real.mk
theorem mk_eq {f g : CauSeq β abs} : mk f = mk g β f β g :=
ext_cauchy_iff.trans CauSeq.Completion.mk_eq
#align real.mk_eq Real.mk_eq
private irreducible_def lt : β β β β Prop
| β¨xβ©, β¨yβ© =>
(Quotient.liftOnβ x y (Β· < Β·)) fun _ _ _ _ hf hg =>
propext <|
β¨fun h => lt_of_eq_of_lt (Setoid.symm hf) (lt_of_lt_of_eq h hg), fun h =>
lt_of_eq_of_lt hf (lt_of_lt_of_eq h (Setoid.symm hg))β©
instance : LT β :=
β¨ltβ©
theorem lt_cauchy {f g} : (β¨β¦fβ§β© : β) < β¨β¦gβ§β© β f < g :=
show lt _ _ β _ by rw [lt_def]; rfl
#align real.lt_cauchy Real.lt_cauchy
@[simp]
theorem mk_lt {f g : CauSeq β abs} : mk f < mk g β f < g :=
lt_cauchy
#align real.mk_lt Real.mk_lt
theorem mk_zero : mk 0 = 0 := by rw [β ofCauchy_zero]; rfl
#align real.mk_zero Real.mk_zero
theorem mk_one : mk 1 = 1 := by rw [β ofCauchy_one]; rfl
#align real.mk_one Real.mk_one
theorem mk_add {f g : CauSeq β abs} : mk (f + g) = mk f + mk g := by simp [mk, β ofCauchy_add]
#align real.mk_add Real.mk_add
theorem mk_mul {f g : CauSeq β abs} : mk (f * g) = mk f * mk g := by simp [mk, β ofCauchy_mul]
#align real.mk_mul Real.mk_mul
theorem mk_neg {f : CauSeq β abs} : mk (-f) = -mk f := by simp [mk, β ofCauchy_neg]
#align real.mk_neg Real.mk_neg
@[simp]
| Mathlib/Data/Real/Basic.lean | 332 | 334 | theorem mk_pos {f : CauSeq β abs} : 0 < mk f β Pos f := by |
rw [β mk_zero, mk_lt]
exact iff_of_eq (congr_arg Pos (sub_zero f))
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
#align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Filter Metric Set
open scoped ComplexConjugate Real Topology
namespace Complex
variable {a x z : β}
noncomputable def arg (x : β) : β :=
if 0 β€ x.re then Real.arcsin (x.im / abs x)
else if 0 β€ x.im then Real.arcsin ((-x).im / abs x) + Ο else Real.arcsin ((-x).im / abs x) - Ο
#align complex.arg Complex.arg
theorem sin_arg (x : β) : Real.sin (arg x) = x.im / abs x := by
unfold arg; split_ifs <;>
simp [sub_eq_add_neg, arg,
Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2,
Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg]
#align complex.sin_arg Complex.sin_arg
theorem cos_arg {x : β} (hx : x β 0) : Real.cos (arg x) = x.re / abs x := by
rw [arg]
split_ifs with hβ hβ
Β· rw [Real.cos_arcsin]
field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
Β· rw [Real.cos_add_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 hβ), *]
Β· rw [Real.cos_sub_pi, Real.cos_arcsin]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
_root_.abs_of_neg (not_le.1 hβ), *]
#align complex.cos_arg Complex.cos_arg
@[simp]
theorem abs_mul_exp_arg_mul_I (x : β) : β(abs x) * exp (arg x * I) = x := by
rcases eq_or_ne x 0 with (rfl | hx)
Β· simp
Β· have : abs x β 0 := abs.ne_zero hx
apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
set_option linter.uppercaseLean3 false in
#align complex.abs_mul_exp_arg_mul_I Complex.abs_mul_exp_arg_mul_I
@[simp]
theorem abs_mul_cos_add_sin_mul_I (x : β) : (abs x * (cos (arg x) + sin (arg x) * I) : β) = x := by
rw [β exp_mul_I, abs_mul_exp_arg_mul_I]
set_option linter.uppercaseLean3 false in
#align complex.abs_mul_cos_add_sin_mul_I Complex.abs_mul_cos_add_sin_mul_I
@[simp]
lemma abs_mul_cos_arg (x : β) : abs x * Real.cos (arg x) = x.re := by
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg re (abs_mul_cos_add_sin_mul_I x)
@[simp]
lemma abs_mul_sin_arg (x : β) : abs x * Real.sin (arg x) = x.im := by
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg im (abs_mul_cos_add_sin_mul_I x)
theorem abs_eq_one_iff (z : β) : abs z = 1 β β ΞΈ : β, exp (ΞΈ * I) = z := by
refine β¨fun hz => β¨arg z, ?_β©, ?_β©
Β· calc
exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul]
_ = z := abs_mul_exp_arg_mul_I z
Β· rintro β¨ΞΈ, rflβ©
exact Complex.abs_exp_ofReal_mul_I ΞΈ
#align complex.abs_eq_one_iff Complex.abs_eq_one_iff
@[simp]
theorem range_exp_mul_I : (Set.range fun x : β => exp (x * I)) = Metric.sphere 0 1 := by
ext x
simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range]
set_option linter.uppercaseLean3 false in
#align complex.range_exp_mul_I Complex.range_exp_mul_I
theorem arg_mul_cos_add_sin_mul_I {r : β} (hr : 0 < r) {ΞΈ : β} (hΞΈ : ΞΈ β Set.Ioc (-Ο) Ο) :
arg (r * (cos ΞΈ + sin ΞΈ * I)) = ΞΈ := by
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
simp only [re_ofReal_mul, im_ofReal_mul, neg_im, β ofReal_cos, β ofReal_sin, β
mk_eq_add_mul_I, neg_div, mul_div_cancel_leftβ _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr]
by_cases hβ : ΞΈ β Set.Icc (-(Ο / 2)) (Ο / 2)
Β· rw [if_pos]
exacts [Real.arcsin_sin' hβ, Real.cos_nonneg_of_mem_Icc hβ]
Β· rw [Set.mem_Icc, not_and_or, not_le, not_le] at hβ
cases' hβ with hβ hβ
Β· replace hΞΈ := hΞΈ.1
have hcos : Real.cos ΞΈ < 0 := by
rw [β neg_pos, β Real.cos_add_pi]
refine Real.cos_pos_of_mem_Ioo β¨?_, ?_β© <;> linarith
have hsin : Real.sin ΞΈ < 0 := Real.sin_neg_of_neg_of_neg_pi_lt (by linarith) hΞΈ
rw [if_neg, if_neg, β Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel_right] <;> [linarith;
linarith; exact hsin.not_le; exact hcos.not_le]
Β· replace hΞΈ := hΞΈ.2
have hcos : Real.cos ΞΈ < 0 := Real.cos_neg_of_pi_div_two_lt_of_lt hβ (by linarith)
have hsin : 0 β€ Real.sin ΞΈ := Real.sin_nonneg_of_mem_Icc β¨by linarith, hΞΈβ©
rw [if_neg, if_pos, β Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel] <;> [linarith;
linarith; exact hsin; exact hcos.not_le]
set_option linter.uppercaseLean3 false in
#align complex.arg_mul_cos_add_sin_mul_I Complex.arg_mul_cos_add_sin_mul_I
| Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean | 118 | 119 | theorem arg_cos_add_sin_mul_I {ΞΈ : β} (hΞΈ : ΞΈ β Set.Ioc (-Ο) Ο) : arg (cos ΞΈ + sin ΞΈ * I) = ΞΈ := by |
rw [β one_mul (_ + _), β ofReal_one, arg_mul_cos_add_sin_mul_I zero_lt_one hΞΈ]
|
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
| Mathlib/RingTheory/EisensteinCriterion.lean | 52 | 61 | 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
)
|
import Mathlib.Topology.Separation
import Mathlib.Topology.Bases
#align_import topology.dense_embedding from "leanprover-community/mathlib"@"148aefbd371a25f1cff33c85f20c661ce3155def"
noncomputable section
open Set Filter
open scoped Topology
variable {Ξ± : Type*} {Ξ² : Type*} {Ξ³ : Type*} {Ξ΄ : Type*}
structure DenseInducing [TopologicalSpace Ξ±] [TopologicalSpace Ξ²] (i : Ξ± β Ξ²)
extends Inducing i : Prop where
protected dense : DenseRange i
#align dense_inducing DenseInducing
namespace DenseInducing
variable [TopologicalSpace Ξ±] [TopologicalSpace Ξ²]
variable {i : Ξ± β Ξ²} (di : DenseInducing i)
theorem nhds_eq_comap (di : DenseInducing i) : β a : Ξ±, π a = comap i (π <| i a) :=
di.toInducing.nhds_eq_comap
#align dense_inducing.nhds_eq_comap DenseInducing.nhds_eq_comap
protected theorem continuous (di : DenseInducing i) : Continuous i :=
di.toInducing.continuous
#align dense_inducing.continuous DenseInducing.continuous
theorem closure_range : closure (range i) = univ :=
di.dense.closure_range
#align dense_inducing.closure_range DenseInducing.closure_range
protected theorem preconnectedSpace [PreconnectedSpace Ξ±] (di : DenseInducing i) :
PreconnectedSpace Ξ² :=
di.dense.preconnectedSpace di.continuous
#align dense_inducing.preconnected_space DenseInducing.preconnectedSpace
theorem closure_image_mem_nhds {s : Set Ξ±} {a : Ξ±} (di : DenseInducing i) (hs : s β π a) :
closure (i '' s) β π (i a) := by
rw [di.nhds_eq_comap a, ((nhds_basis_opens _).comap _).mem_iff] at hs
rcases hs with β¨U, β¨haU, hUoβ©, sub : i β»ΒΉ' U β sβ©
refine mem_of_superset (hUo.mem_nhds haU) ?_
calc
U β closure (i '' (i β»ΒΉ' U)) := di.dense.subset_closure_image_preimage_of_isOpen hUo
_ β closure (i '' s) := closure_mono (image_subset i sub)
#align dense_inducing.closure_image_mem_nhds DenseInducing.closure_image_mem_nhds
theorem dense_image (di : DenseInducing i) {s : Set Ξ±} : Dense (i '' s) β Dense s := by
refine β¨fun H x => ?_, di.dense.dense_image di.continuousβ©
rw [di.toInducing.closure_eq_preimage_closure_image, H.closure_eq, preimage_univ]
trivial
#align dense_inducing.dense_image DenseInducing.dense_image
theorem interior_compact_eq_empty [T2Space Ξ²] (di : DenseInducing i) (hd : Dense (range i)αΆ)
{s : Set Ξ±} (hs : IsCompact s) : interior s = β
:= by
refine eq_empty_iff_forall_not_mem.2 fun x hx => ?_
rw [mem_interior_iff_mem_nhds] at hx
have := di.closure_image_mem_nhds hx
rw [(hs.image di.continuous).isClosed.closure_eq] at this
rcases hd.inter_nhds_nonempty this with β¨y, hyi, hysβ©
exact hyi (image_subset_range _ _ hys)
#align dense_inducing.interior_compact_eq_empty DenseInducing.interior_compact_eq_empty
protected theorem prod [TopologicalSpace Ξ³] [TopologicalSpace Ξ΄] {eβ : Ξ± β Ξ²} {eβ : Ξ³ β Ξ΄}
(deβ : DenseInducing eβ) (deβ : DenseInducing eβ) :
DenseInducing fun p : Ξ± Γ Ξ³ => (eβ p.1, eβ p.2) where
toInducing := deβ.toInducing.prod_map deβ.toInducing
dense := deβ.dense.prod_map deβ.dense
#align dense_inducing.prod DenseInducing.prod
open TopologicalSpace
protected theorem separableSpace [SeparableSpace Ξ±] : SeparableSpace Ξ² :=
di.dense.separableSpace di.continuous
#align dense_inducing.separable_space DenseInducing.separableSpace
variable [TopologicalSpace Ξ΄] {f : Ξ³ β Ξ±} {g : Ξ³ β Ξ΄} {h : Ξ΄ β Ξ²}
| Mathlib/Topology/DenseEmbedding.lean | 117 | 124 | theorem tendsto_comap_nhds_nhds {d : Ξ΄} {a : Ξ±} (di : DenseInducing i)
(H : Tendsto h (π d) (π (i a))) (comm : h β g = i β f) : Tendsto f (comap g (π d)) (π a) := by |
have lim1 : map g (comap g (π d)) β€ π d := map_comap_le
replace lim1 : map h (map g (comap g (π d))) β€ map h (π d) := map_mono lim1
rw [Filter.map_map, comm, β Filter.map_map, map_le_iff_le_comap] at lim1
have lim2 : comap i (map h (π d)) β€ comap i (π (i a)) := comap_mono H
rw [β di.nhds_eq_comap] at lim2
exact le_trans lim1 lim2
|
import Mathlib.Algebra.MvPolynomial.Supported
import Mathlib.RingTheory.WittVector.Truncated
#align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
namespace WittVector
variable (p : β) [hp : Fact p.Prime]
variable {k : Type*} [CommRing k]
local notation "π" => WittVector p
-- Porting note: new notation
local notation "π" => MvPolynomial (Fin 2 Γ β) β€
open Finset MvPolynomial
def wittPolyProd (n : β) : π :=
rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β€ n) *
rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β€ n)
#align witt_vector.witt_poly_prod WittVector.wittPolyProd
theorem wittPolyProd_vars (n : β) : (wittPolyProd p n).vars β univ ΓΛ’ range (n + 1) := by
rw [wittPolyProd]
apply Subset.trans (vars_mul _ _)
refine union_subset ?_ ?_ <;>
Β· refine Subset.trans (vars_rename _ _) ?_
simp [wittPolynomial_vars, image_subset_iff]
#align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars
def wittPolyProdRemainder (n : β) : π :=
β i β range n, (p : π) ^ i * wittMul p i ^ p ^ (n - i)
#align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder
theorem wittPolyProdRemainder_vars (n : β) :
(wittPolyProdRemainder p n).vars β univ ΓΛ’ range n := by
rw [wittPolyProdRemainder]
refine Subset.trans (vars_sum_subset _ _) ?_
rw [biUnion_subset]
intro x hx
apply Subset.trans (vars_mul _ _)
refine union_subset ?_ ?_
Β· apply Subset.trans (vars_pow _ _)
have : (p : π) = C (p : β€) := by simp only [Int.cast_natCast, eq_intCast]
rw [this, vars_C]
apply empty_subset
Β· apply Subset.trans (vars_pow _ _)
apply Subset.trans (wittMul_vars _ _)
apply product_subset_product (Subset.refl _)
simp only [mem_range, range_subset] at hx β’
exact hx
#align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars
def remainder (n : β) : π :=
(β x β range (n + 1),
(rename (Prod.mk 0)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : β€) ^ x))) *
β x β range (n + 1),
(rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : β€) ^ x))
#align witt_vector.remainder WittVector.remainder
theorem remainder_vars (n : β) : (remainder p n).vars β univ ΓΛ’ range (n + 1) := by
rw [remainder]
apply Subset.trans (vars_mul _ _)
refine union_subset ?_ ?_ <;>
Β· refine Subset.trans (vars_sum_subset _ _) ?_
rw [biUnion_subset]
intro x hx
rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single]
Β· apply Subset.trans Finsupp.support_single_subset
simpa using mem_range.mp hx
Β· apply pow_ne_zero
exact mod_cast hp.out.ne_zero
#align witt_vector.remainder_vars WittVector.remainder_vars
def polyOfInterest (n : β) : π :=
wittMul p (n + 1) + (p : π) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β€ (n + 1)) -
X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β€ (n + 1))
#align witt_vector.poly_of_interest WittVector.polyOfInterest
theorem mul_polyOfInterest_aux1 (n : β) :
β i β range (n + 1), (p : π) ^ i * wittMul p i ^ p ^ (n - i) = wittPolyProd p n := by
simp only [wittPolyProd]
convert wittStructureInt_prop p (X (0 : Fin 2) * X 1) n using 1
Β· simp only [wittPolynomial, wittMul]
rw [AlgHom.map_sum]
congr 1 with i
congr 1
have hsupp : (Finsupp.single i (p ^ (n - i))).support = {i} := by
rw [Finsupp.support_eq_singleton]
simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne]
exact pow_ne_zero _ hp.out.ne_zero
simp only [bindβ_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast,
Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true,
Int.cast_pow]
Β· simp only [map_mul, bindβ_X_right]
#align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_polyOfInterest_aux1
theorem mul_polyOfInterest_aux2 (n : β) :
(p : π) ^ n * wittMul p n + wittPolyProdRemainder p n = wittPolyProd p n := by
convert mul_polyOfInterest_aux1 p n
rw [sum_range_succ, add_comm, Nat.sub_self, pow_zero, pow_one]
rfl
#align witt_vector.mul_poly_of_interest_aux2 WittVector.mul_polyOfInterest_aux2
theorem mul_polyOfInterest_aux3 (n : β) : wittPolyProd p (n + 1) =
-((p : π) ^ (n + 1) * X (0, n + 1)) * ((p : π) ^ (n + 1) * X (1, n + 1)) +
(p : π) ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β€ (n + 1)) +
(p : π) ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β€ (n + 1)) +
remainder p n := by
-- a useful auxiliary fact
have mvpz : (p : π) ^ (n + 1) = MvPolynomial.C ((p : β€) ^ (n + 1)) := by norm_cast
-- Porting note: the original proof applies `sum_range_succ` through a non-`conv` rewrite,
-- but this does not work in Lean 4; the whole proof also times out very badly. The proof has been
-- nearly totally rewritten here and now finishes quite fast.
rw [wittPolyProd, wittPolynomial, AlgHom.map_sum, AlgHom.map_sum]
conv_lhs =>
arg 1
rw [sum_range_succ, β C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul,
rename_C, rename_X, β mvpz]
conv_lhs =>
arg 2
rw [sum_range_succ, β C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul,
rename_C, rename_X, β mvpz]
conv_rhs =>
enter [1, 1, 2, 2]
rw [sum_range_succ, β C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul,
rename_C, rename_X, β mvpz]
conv_rhs =>
enter [1, 2, 2]
rw [sum_range_succ, β C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul,
rename_C, rename_X, β mvpz]
simp only [add_mul, mul_add]
rw [add_comm _ (remainder p n)]
simp only [add_assoc]
apply congrArg (Add.add _)
ring
#align witt_vector.mul_poly_of_interest_aux3 WittVector.mul_polyOfInterest_aux3
theorem mul_polyOfInterest_aux4 (n : β) :
(p : π) ^ (n + 1) * wittMul p (n + 1) =
-((p : π) ^ (n + 1) * X (0, n + 1)) * ((p : π) ^ (n + 1) * X (1, n + 1)) +
(p : π) ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β€ (n + 1)) +
(p : π) ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β€ (n + 1)) +
(remainder p n - wittPolyProdRemainder p (n + 1)) := by
rw [β add_sub_assoc, eq_sub_iff_add_eq, mul_polyOfInterest_aux2]
exact mul_polyOfInterest_aux3 _ _
#align witt_vector.mul_poly_of_interest_aux4 WittVector.mul_polyOfInterest_aux4
theorem mul_polyOfInterest_aux5 (n : β) :
(p : π) ^ (n + 1) * polyOfInterest p n = remainder p n - wittPolyProdRemainder p (n + 1) := by
simp only [polyOfInterest, mul_sub, mul_add, sub_eq_iff_eq_add']
rw [mul_polyOfInterest_aux4 p n]
ring
#align witt_vector.mul_poly_of_interest_aux5 WittVector.mul_polyOfInterest_aux5
theorem mul_polyOfInterest_vars (n : β) :
((p : π) ^ (n + 1) * polyOfInterest p n).vars β univ ΓΛ’ range (n + 1) := by
rw [mul_polyOfInterest_aux5]
apply Subset.trans (vars_sub_subset _)
refine union_subset ?_ ?_
Β· apply remainder_vars
Β· apply wittPolyProdRemainder_vars
#align witt_vector.mul_poly_of_interest_vars WittVector.mul_polyOfInterest_vars
theorem polyOfInterest_vars_eq (n : β) : (polyOfInterest p n).vars =
((p : π) ^ (n + 1) * (wittMul p (n + 1) + (p : π) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) -
X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p β€ (n + 1)) -
X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p β€ (n + 1)))).vars := by
have : (p : π) ^ (n + 1) = C ((p : β€) ^ (n + 1)) := by norm_cast
rw [polyOfInterest, this, vars_C_mul]
apply pow_ne_zero
exact mod_cast hp.out.ne_zero
#align witt_vector.poly_of_interest_vars_eq WittVector.polyOfInterest_vars_eq
theorem polyOfInterest_vars (n : β) : (polyOfInterest p n).vars β univ ΓΛ’ range (n + 1) := by
rw [polyOfInterest_vars_eq]; apply mul_polyOfInterest_vars
#align witt_vector.poly_of_interest_vars WittVector.polyOfInterest_vars
theorem peval_polyOfInterest (n : β) (x y : π k) :
peval (polyOfInterest p n) ![fun i => x.coeff i, fun i => y.coeff i] =
(x * y).coeff (n + 1) + p ^ (n + 1) * x.coeff (n + 1) * y.coeff (n + 1) -
y.coeff (n + 1) * β i β range (n + 1 + 1), p ^ i * x.coeff i ^ p ^ (n + 1 - i) -
x.coeff (n + 1) * β i β range (n + 1 + 1), p ^ i * y.coeff i ^ p ^ (n + 1 - i) := by
simp only [polyOfInterest, peval, map_natCast, Matrix.head_cons, map_pow,
Function.uncurry_apply_pair, aeval_X, Matrix.cons_val_one, map_mul, Matrix.cons_val_zero,
map_sub]
rw [sub_sub, add_comm (_ * _), β sub_sub]
simp [wittPolynomial_eq_sum_C_mul_X_pow, aeval, evalβ_rename, mul_coeff, peval, map_natCast,
map_add, map_pow, map_mul]
#align witt_vector.peval_poly_of_interest WittVector.peval_polyOfInterest
variable [CharP k p]
| Mathlib/RingTheory/WittVector/MulCoeff.lean | 235 | 246 | theorem peval_polyOfInterest' (n : β) (x y : π k) :
peval (polyOfInterest p n) ![fun i => x.coeff i, fun i => y.coeff i] =
(x * y).coeff (n + 1) - y.coeff (n + 1) * x.coeff 0 ^ p ^ (n + 1) -
x.coeff (n + 1) * y.coeff 0 ^ p ^ (n + 1) := by |
rw [peval_polyOfInterest]
have : (p : k) = 0 := CharP.cast_eq_zero k p
simp only [this, Nat.cast_pow, ne_eq, add_eq_zero, and_false, zero_pow, zero_mul, add_zero,
not_false_eq_true]
have sum_zero_pow_mul_pow_p (y : π k) : β x β range (n + 1 + 1),
(0 : k) ^ x * y.coeff x ^ p ^ (n + 1 - x) = y.coeff 0 ^ p ^ (n + 1) := by
rw [Finset.sum_eq_single_of_mem 0] <;> simp (config := { contextual := true })
congr <;> apply sum_zero_pow_mul_pow_p
|
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(Ξ±_ (π_ C) X Y).hom β« (Ξ»_ (X β Y)).hom = (Ξ»_ X).hom β π Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(Ξ»_ (X β Y)).hom = (Ξ±_ (π_ C) X Y).inv β« ((Ξ»_ X).hom β π Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(Ξ»_ (X β Y)).inv = ((Ξ»_ X).inv β π Y) β« (Ξ±_ (π_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : π X β (Ο_ Y).inv = (Ο_ _).inv β« (Ξ±_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (Ξ»_ X).inv β π Y = (Ξ»_ _).inv β« (Ξ±_ _ _ _).inv := by
coherence
#align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id
@[reassoc]
theorem pentagon_inv_inv_hom (W X Y Z : C) :
(Ξ±_ W (X β Y) Z).inv β« ((Ξ±_ W X Y).inv β π Z) β« (Ξ±_ (W β X) Y Z).hom =
(π W β (Ξ±_ X Y Z).hom) β« (Ξ±_ W X (Y β Z)).inv := by
coherence
#align category_theory.monoidal_category.pentagon_inv_inv_hom CategoryTheory.MonoidalCategory.pentagon_inv_inv_hom
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 63 | 64 | theorem unitors_equal : (Ξ»_ (π_ C)).hom = (Ο_ (π_ C)).hom := by |
coherence
|
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent
import Mathlib.Analysis.Normed.Group.Lemmas
import Mathlib.Analysis.NormedSpace.AddTorsor
import Mathlib.Analysis.NormedSpace.AffineIsometry
import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace
import Mathlib.Analysis.NormedSpace.RieszLemma
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Topology.Algebra.Module.FiniteDimension
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Topology.Instances.Matrix
#align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057"
universe u v w x
noncomputable section
open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology
NNReal Metric
section CompleteField
variable {π : Type u} [NontriviallyNormedField π] {E : Type v} [NormedAddCommGroup E]
[NormedSpace π E] {F : Type w} [NormedAddCommGroup F] [NormedSpace π F] {F' : Type x}
[AddCommGroup F'] [Module π F'] [TopologicalSpace F'] [TopologicalAddGroup F']
[ContinuousSMul π F'] [CompleteSpace π]
theorem ContinuousLinearMap.continuous_det : Continuous fun f : E βL[π] E => f.det := by
change Continuous fun f : E βL[π] E => LinearMap.det (f : E ββ[π] E)
-- Porting note: this could be easier with `det_cases`
by_cases h : β s : Finset E, Nonempty (Basis (β₯s) π E)
Β· rcases h with β¨s, β¨bβ©β©
haveI : FiniteDimensional π E := FiniteDimensional.of_fintype_basis b
simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b]
refine Continuous.matrix_det ?_
exact
((LinearMap.toMatrix b b).toLinearMap.comp
(ContinuousLinearMap.coeLM π)).continuous_of_finiteDimensional
Β· -- Porting note: was `unfold LinearMap.det`
rw [LinearMap.det_def]
simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const
#align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det
irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace β E']
[FiniteDimensional β E'] : ββ₯0 :=
let A := (Basis.ofVectorSpace β E').equivFun.toContinuousLinearEquiv
max (βA.symm.toContinuousLinearMapββ * βA.toContinuousLinearMapββ) 1
#align lipschitz_extension_constant lipschitzExtensionConstant
theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace β E']
[FiniteDimensional β E'] : 0 < lipschitzExtensionConstant E' := by
rw [lipschitzExtensionConstant]
exact zero_lt_one.trans_le (le_max_right _ _)
#align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos
theorem LipschitzOnWith.extend_finite_dimension {Ξ± : Type*} [PseudoMetricSpace Ξ±] {E' : Type*}
[NormedAddCommGroup E'] [NormedSpace β E'] [FiniteDimensional β E'] {s : Set Ξ±} {f : Ξ± β E'}
{K : ββ₯0} (hf : LipschitzOnWith K f s) :
β g : Ξ± β E', LipschitzWith (lipschitzExtensionConstant E' * K) g β§ EqOn f g s := by
let ΞΉ : Type _ := Basis.ofVectorSpaceIndex β E'
let A := (Basis.ofVectorSpace β E').equivFun.toContinuousLinearEquiv
have LA : LipschitzWith βA.toContinuousLinearMapββ A := by apply A.lipschitz
have L : LipschitzOnWith (βA.toContinuousLinearMapββ * K) (A β f) s :=
LA.comp_lipschitzOnWith hf
obtain β¨g, hg, gsβ© :
β g : Ξ± β ΞΉ β β, LipschitzWith (βA.toContinuousLinearMapββ * K) g β§ EqOn (A β f) g s :=
L.extend_pi
refine β¨A.symm β g, ?_, ?_β©
Β· have LAsymm : LipschitzWith βA.symm.toContinuousLinearMapββ A.symm := by
apply A.symm.lipschitz
apply (LAsymm.comp hg).weaken
rw [lipschitzExtensionConstant, β mul_assoc]
exact mul_le_mul' (le_max_left _ _) le_rfl
Β· intro x hx
have : A (f x) = g x := gs hx
simp only [(Β· β Β·), β this, A.symm_apply_apply]
#align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension
theorem LinearMap.exists_antilipschitzWith [FiniteDimensional π E] (f : E ββ[π] F)
(hf : LinearMap.ker f = β₯) : β K > 0, AntilipschitzWith K f := by
cases subsingleton_or_nontrivial E
Β· exact β¨1, zero_lt_one, AntilipschitzWith.of_subsingletonβ©
Β· rw [LinearMap.ker_eq_bot] at hf
let e : E βL[π] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv
exact β¨_, e.nnnorm_symm_pos, e.antilipschitzβ©
#align linear_map.exists_antilipschitz_with LinearMap.exists_antilipschitzWith
open Function in
theorem LinearMap.injective_iff_antilipschitz [FiniteDimensional π E] (f : E ββ[π] F) :
Injective f β β K > 0, AntilipschitzWith K f := by
constructor
Β· rw [β LinearMap.ker_eq_bot]
exact f.exists_antilipschitzWith
Β· rintro β¨K, -, Hβ©
exact H.injective
open Function in
theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional π E] :
IsOpen { L : E βL[π] F | Injective L } := by
rw [isOpen_iff_eventually]
rintro Οβ hΟβ
rcases Οβ.injective_iff_antilipschitz.mp hΟβ with β¨K, K_pos, Hβ©
have : βαΆ Ο in π Οβ, βΟ - Οβββ < Kβ»ΒΉ := eventually_nnnorm_sub_lt _ <| inv_pos_of_pos K_pos
filter_upwards [this] with Ο hΟ
apply Ο.injective_iff_antilipschitz.mpr
exact β¨(Kβ»ΒΉ - βΟ - Οβββ)β»ΒΉ, inv_pos_of_pos (tsub_pos_of_lt hΟ),
H.add_sub_lipschitzWith (Ο - Οβ).lipschitz hΟβ©
protected theorem LinearIndependent.eventually {ΞΉ} [Finite ΞΉ] {f : ΞΉ β E}
(hf : LinearIndependent π f) : βαΆ g in π f, LinearIndependent π g := by
cases nonempty_fintype ΞΉ
simp only [Fintype.linearIndependent_iff'] at hf β’
rcases LinearMap.exists_antilipschitzWith _ hf with β¨K, K0, hKβ©
have : Tendsto (fun g : ΞΉ β E => β i, βg i - f iβ) (π f) (π <| β i, βf i - f iβ) :=
tendsto_finset_sum _ fun i _ =>
Tendsto.norm <| ((continuous_apply i).tendsto _).sub tendsto_const_nhds
simp only [sub_self, norm_zero, Finset.sum_const_zero] at this
refine (this.eventually (gt_mem_nhds <| inv_pos.2 K0)).mono fun g hg => ?_
replace hg : β i, βg i - f iββ < Kβ»ΒΉ := by
rw [β NNReal.coe_lt_coe]
push_cast
exact hg
rw [LinearMap.ker_eq_bot]
refine (hK.add_sub_lipschitzWith (LipschitzWith.of_dist_le_mul fun v u => ?_) hg).injective
simp only [dist_eq_norm, LinearMap.lsum_apply, Pi.sub_apply, LinearMap.sum_apply,
LinearMap.comp_apply, LinearMap.proj_apply, LinearMap.smulRight_apply, LinearMap.id_apply, β
Finset.sum_sub_distrib, β smul_sub, β sub_smul, NNReal.coe_sum, coe_nnnorm, Finset.sum_mul]
refine norm_sum_le_of_le _ fun i _ => ?_
rw [norm_smul, mul_comm]
gcongr
exact norm_le_pi_norm (v - u) i
#align linear_independent.eventually LinearIndependent.eventually
theorem isOpen_setOf_linearIndependent {ΞΉ : Type*} [Finite ΞΉ] :
IsOpen { f : ΞΉ β E | LinearIndependent π f } :=
isOpen_iff_mem_nhds.2 fun _ => LinearIndependent.eventually
#align is_open_set_of_linear_independent isOpen_setOf_linearIndependent
theorem isOpen_setOf_nat_le_rank (n : β) :
IsOpen { f : E βL[π] F | βn β€ (f : E ββ[π] F).rank } := by
simp only [LinearMap.le_rank_iff_exists_linearIndependent_finset, setOf_exists, β exists_prop]
refine isOpen_biUnion fun t _ => ?_
have : Continuous fun f : E βL[π] F => fun x : (t : Set E) => f x :=
continuous_pi fun x => (ContinuousLinearMap.apply π F (x : E)).continuous
exact isOpen_setOf_linearIndependent.preimage this
#align is_open_set_of_nat_le_rank isOpen_setOf_nat_le_rank
theorem Basis.opNNNorm_le {ΞΉ : Type*} [Fintype ΞΉ] (v : Basis ΞΉ π E) {u : E βL[π] F} (M : ββ₯0)
(hu : β i, βu (v i)ββ β€ M) : βuββ β€ Fintype.card ΞΉ β’ βv.equivFunL.toContinuousLinearMapββ * M :=
u.opNNNorm_le_bound _ fun e => by
set Ο := v.equivFunL.toContinuousLinearMap
calc
βu eββ = βu (β i, v.equivFun e i β’ v i)ββ := by rw [v.sum_equivFun]
_ = ββ i, v.equivFun e i β’ (u <| v i)ββ := by simp [map_sum, LinearMap.map_smul]
_ β€ β i, βv.equivFun e i β’ (u <| v i)ββ := nnnorm_sum_le _ _
_ = β i, βv.equivFun e iββ * βu (v i)ββ := by simp only [nnnorm_smul]
_ β€ β i, βv.equivFun e iββ * M := by gcongr; apply hu
_ = (β i, βv.equivFun e iββ) * M := by rw [Finset.sum_mul]
_ β€ Fintype.card ΞΉ β’ (βΟββ * βeββ) * M := by
gcongr
calc
β i, βv.equivFun e iββ β€ Fintype.card ΞΉ β’ βΟ eββ := Pi.sum_nnnorm_apply_le_nnnorm _
_ β€ Fintype.card ΞΉ β’ (βΟββ * βeββ) := nsmul_le_nsmul_right (Ο.le_opNNNorm e) _
_ = Fintype.card ΞΉ β’ βΟββ * M * βeββ := by simp only [smul_mul_assoc, mul_right_comm]
#align basis.op_nnnorm_le Basis.opNNNorm_le
@[deprecated (since := "2024-02-02")] alias Basis.op_nnnorm_le := Basis.opNNNorm_le
theorem Basis.opNorm_le {ΞΉ : Type*} [Fintype ΞΉ] (v : Basis ΞΉ π E) {u : E βL[π] F} {M : β}
(hM : 0 β€ M) (hu : β i, βu (v i)β β€ M) :
βuβ β€ Fintype.card ΞΉ β’ βv.equivFunL.toContinuousLinearMapβ * M := by
simpa using NNReal.coe_le_coe.mpr (v.opNNNorm_le β¨M, hMβ© hu)
#align basis.op_norm_le Basis.opNorm_le
@[deprecated (since := "2024-02-02")] alias Basis.op_norm_le := Basis.opNorm_le
theorem Basis.exists_opNNNorm_le {ΞΉ : Type*} [Finite ΞΉ] (v : Basis ΞΉ π E) :
β C > (0 : ββ₯0), β {u : E βL[π] F} (M : ββ₯0), (β i, βu (v i)ββ β€ M) β βuββ β€ C * M := by
cases nonempty_fintype ΞΉ
exact
β¨max (Fintype.card ΞΉ β’ βv.equivFunL.toContinuousLinearMapββ) 1,
zero_lt_one.trans_le (le_max_right _ _), fun {u} M hu =>
(v.opNNNorm_le M hu).trans <| mul_le_mul_of_nonneg_right (le_max_left _ _) (zero_le M)β©
#align basis.exists_op_nnnorm_le Basis.exists_opNNNorm_le
@[deprecated (since := "2024-02-02")] alias Basis.exists_op_nnnorm_le := Basis.exists_opNNNorm_le
theorem Basis.exists_opNorm_le {ΞΉ : Type*} [Finite ΞΉ] (v : Basis ΞΉ π E) :
β C > (0 : β), β {u : E βL[π] F} {M : β}, 0 β€ M β (β i, βu (v i)β β€ M) β βuβ β€ C * M := by
obtain β¨C, hC, hβ© := v.exists_opNNNorm_le (F := F)
-- Porting note: used `Subtype.forall'` below
refine β¨C, hC, ?_β©
intro u M hM H
simpa using h β¨M, hMβ© H
#align basis.exists_op_norm_le Basis.exists_opNorm_le
@[deprecated (since := "2024-02-02")] alias Basis.exists_op_norm_le := Basis.exists_opNorm_le
instance [FiniteDimensional π E] [SecondCountableTopology F] :
SecondCountableTopology (E βL[π] F) := by
set d := FiniteDimensional.finrank π E
suffices
β Ξ΅ > (0 : β), β n : (E βL[π] F) β Fin d β β, β f g : E βL[π] F, n f = n g β dist f g β€ Ξ΅ from
Metric.secondCountable_of_countable_discretization fun Ξ΅ Ξ΅_pos =>
β¨Fin d β β, by infer_instance, this Ξ΅ Ξ΅_posβ©
intro Ξ΅ Ξ΅_pos
obtain β¨u : β β F, hu : DenseRange uβ© := exists_dense_seq F
let v := FiniteDimensional.finBasis π E
obtain
β¨C : β, C_pos : 0 < C, hC :
β {Ο : E βL[π] F} {M : β}, 0 β€ M β (β i, βΟ (v i)β β€ M) β βΟβ β€ C * Mβ© :=
v.exists_opNorm_le (E := E) (F := F)
have h_2C : 0 < 2 * C := mul_pos zero_lt_two C_pos
have hΞ΅2C : 0 < Ξ΅ / (2 * C) := div_pos Ξ΅_pos h_2C
have : β Ο : E βL[π] F, β n : Fin d β β, βΟ - (v.constrL <| u β n)β β€ Ξ΅ / 2 := by
intro Ο
have : β i, β n, βΟ (v i) - u nβ β€ Ξ΅ / (2 * C) := by
simp only [norm_sub_rev]
intro i
have : Ο (v i) β closure (range u) := hu _
obtain β¨n, hnβ© : β n, βu n - Ο (v i)β < Ξ΅ / (2 * C) := by
rw [mem_closure_iff_nhds_basis Metric.nhds_basis_ball] at this
specialize this (Ξ΅ / (2 * C)) hΞ΅2C
simpa [dist_eq_norm]
exact β¨n, le_of_lt hnβ©
choose n hn using this
use n
replace hn : β i : Fin d, β(Ο - (v.constrL <| u β n)) (v i)β β€ Ξ΅ / (2 * C) := by simp [hn]
have : C * (Ξ΅ / (2 * C)) = Ξ΅ / 2 := by
rw [eq_div_iff (two_ne_zero : (2 : β) β 0), mul_comm, β mul_assoc,
mul_div_cancelβ _ (ne_of_gt h_2C)]
specialize hC (le_of_lt hΞ΅2C) hn
rwa [this] at hC
choose n hn using this
set Ξ¦ := fun Ο : E βL[π] F => v.constrL <| u β n Ο
change β z, dist z (Ξ¦ z) β€ Ξ΅ / 2 at hn
use n
intro x y hxy
calc
dist x y β€ dist x (Ξ¦ x) + dist (Ξ¦ x) y := dist_triangle _ _ _
_ = dist x (Ξ¦ x) + dist y (Ξ¦ y) := by simp [Ξ¦, hxy, dist_comm]
_ β€ Ξ΅ := by linarith [hn x, hn y]
theorem AffineSubspace.closed_of_finiteDimensional {P : Type*} [MetricSpace P]
[NormedAddTorsor E P] (s : AffineSubspace π P) [FiniteDimensional π s.direction] :
IsClosed (s : Set P) :=
s.isClosed_direction_iff.mp s.direction.closed_of_finiteDimensional
#align affine_subspace.closed_of_finite_dimensional AffineSubspace.closed_of_finiteDimensional
section Riesz
theorem exists_norm_le_le_norm_sub_of_finset {c : π} (hc : 1 < βcβ) {R : β} (hR : βcβ < R)
(h : Β¬FiniteDimensional π E) (s : Finset E) : β x : E, βxβ β€ R β§ β y β s, 1 β€ βy - xβ := by
let F := Submodule.span π (s : Set E)
haveI : FiniteDimensional π F :=
Module.finite_def.2
((Submodule.fg_top _).2 (Submodule.fg_def.2 β¨s, Finset.finite_toSet _, rflβ©))
have Fclosed : IsClosed (F : Set E) := Submodule.closed_of_finiteDimensional _
have : β x, x β F := by
contrapose! h
have : (β€ : Submodule π E) = F := by
ext x
simp [h]
have : FiniteDimensional π (β€ : Submodule π E) := by rwa [this]
exact Module.finite_def.2 ((Submodule.fg_top _).1 (Module.finite_def.1 this))
obtain β¨x, xR, hxβ© : β x : E, βxβ β€ R β§ β y : E, y β F β 1 β€ βx - yβ :=
riesz_lemma_of_norm_lt hc hR Fclosed this
have hx' : β y : E, y β F β 1 β€ βy - xβ := by
intro y hy
rw [β norm_neg]
simpa using hx y hy
exact β¨x, xR, fun y hy => hx' _ (Submodule.subset_span hy)β©
#align exists_norm_le_le_norm_sub_of_finset exists_norm_le_le_norm_sub_of_finset
| Mathlib/Analysis/NormedSpace/FiniteDimension.lean | 430 | 441 | theorem exists_seq_norm_le_one_le_norm_sub' {c : π} (hc : 1 < βcβ) {R : β} (hR : βcβ < R)
(h : Β¬FiniteDimensional π E) :
β f : β β E, (β n, βf nβ β€ R) β§ Pairwise fun m n => 1 β€ βf m - f nβ := by |
have : IsSymm E fun x y : E => 1 β€ βx - yβ := by
constructor
intro x y hxy
rw [β norm_neg]
simpa
apply
exists_seq_of_forall_finset_exists' (fun x : E => βxβ β€ R) fun (x : E) (y : E) => 1 β€ βx - yβ
rintro s -
exact exists_norm_le_le_norm_sub_of_finset hc hR h s
|
import Mathlib.CategoryTheory.Monoidal.Category
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
import Mathlib.CategoryTheory.PEmpty
#align_import category_theory.monoidal.of_chosen_finite_products.basic from "leanprover-community/mathlib"@"95a87616d63b3cb49d3fe678d416fbe9c4217bf4"
universe v u
namespace CategoryTheory
variable (C : Type u) [Category.{v} C] {X Y : C}
open CategoryTheory.Limits
section
-- Porting note: no tidy
-- attribute [local tidy] tactic.case_bash
variable {C}
variable (π― : LimitCone (Functor.empty.{0} C))
variable (β¬ : β X Y : C, LimitCone (pair X Y))
namespace MonoidalOfChosenFiniteProducts
abbrev tensorObj (X Y : C) : C :=
(β¬ X Y).cone.pt
#align category_theory.monoidal_of_chosen_finite_products.tensor_obj CategoryTheory.MonoidalOfChosenFiniteProducts.tensorObj
abbrev tensorHom {W X Y Z : C} (f : W βΆ X) (g : Y βΆ Z) : tensorObj β¬ W Y βΆ tensorObj β¬ X Z :=
(BinaryFan.IsLimit.lift' (β¬ X Z).isLimit ((β¬ W Y).cone.Ο.app β¨WalkingPair.leftβ© β« f)
(((β¬ W Y).cone.Ο.app β¨WalkingPair.rightβ© : (β¬ W Y).cone.pt βΆ Y) β« g)).val
#align category_theory.monoidal_of_chosen_finite_products.tensor_hom CategoryTheory.MonoidalOfChosenFiniteProducts.tensorHom
| Mathlib/CategoryTheory/Monoidal/OfChosenFiniteProducts/Basic.lean | 242 | 246 | theorem tensor_id (Xβ Xβ : C) : tensorHom β¬ (π Xβ) (π Xβ) = π (tensorObj β¬ Xβ Xβ) := by |
apply IsLimit.hom_ext (β¬ _ _).isLimit;
rintro β¨β¨β©β© <;>
Β· dsimp [tensorHom]
simp
|
import Mathlib.Algebra.Algebra.Operations
import Mathlib.Data.Fintype.Lattice
import Mathlib.RingTheory.Coprime.Lemmas
#align_import ring_theory.ideal.operations from "leanprover-community/mathlib"@"e7f0ddbf65bd7181a85edb74b64bdc35ba4bdc74"
assert_not_exists Basis -- See `RingTheory.Ideal.Basis`
assert_not_exists Submodule.hasQuotient -- See `RingTheory.Ideal.QuotientOperations`
universe u v w x
open Pointwise
namespace Submodule
variable {R : Type u} {M : Type v} {M' F G : Type*}
section CommSemiring
variable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
open Pointwise
instance hasSMul' : SMul (Ideal R) (Submodule R M) :=
β¨Submodule.mapβ (LinearMap.lsmul R M)β©
#align submodule.has_smul' Submodule.hasSMul'
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I β’ J = I * J :=
rfl
#align ideal.smul_eq_mul Ideal.smul_eq_mul
variable (R M) in
def _root_.Module.annihilator : Ideal R := LinearMap.ker (LinearMap.lsmul R M)
theorem _root_.Module.mem_annihilator {r} : r β Module.annihilator R M β β m : M, r β’ m = 0 :=
β¨fun h β¦ (congr($h Β·)), (LinearMap.ext Β·)β©
theorem _root_.LinearMap.annihilator_le_of_injective (f : M ββ[R] M') (hf : Function.Injective f) :
Module.annihilator R M' β€ Module.annihilator R M := fun x h β¦ by
rw [Module.mem_annihilator] at h β’; exact fun m β¦ hf (by rw [map_smul, h, f.map_zero])
theorem _root_.LinearMap.annihilator_le_of_surjective (f : M ββ[R] M')
(hf : Function.Surjective f) : Module.annihilator R M β€ Module.annihilator R M' := fun x h β¦ by
rw [Module.mem_annihilator] at h β’
intro m; obtain β¨m, rflβ© := hf m
rw [β map_smul, h, f.map_zero]
theorem _root_.LinearEquiv.annihilator_eq (e : M ββ[R] M') :
Module.annihilator R M = Module.annihilator R M' :=
(e.annihilator_le_of_surjective e.surjective).antisymm (e.annihilator_le_of_injective e.injective)
abbrev annihilator (N : Submodule R M) : Ideal R :=
Module.annihilator R N
#align submodule.annihilator Submodule.annihilator
theorem annihilator_top : (β€ : Submodule R M).annihilator = Module.annihilator R M :=
topEquiv.annihilator_eq
variable {I J : Ideal R} {N P : Submodule R M}
theorem mem_annihilator {r} : r β N.annihilator β β n β N, r β’ n = (0 : M) := by
simp_rw [annihilator, Module.mem_annihilator, Subtype.forall, Subtype.ext_iff]; rfl
#align submodule.mem_annihilator Submodule.mem_annihilator
theorem mem_annihilator' {r} : r β N.annihilator β N β€ comap (r β’ (LinearMap.id : M ββ[R] M)) β₯ :=
mem_annihilator.trans β¨fun H n hn => (mem_bot R).2 <| H n hn, fun H _ hn => (mem_bot R).1 <| H hnβ©
#align submodule.mem_annihilator' Submodule.mem_annihilator'
theorem mem_annihilator_span (s : Set M) (r : R) :
r β (Submodule.span R s).annihilator β β n : s, r β’ (n : M) = 0 := by
rw [Submodule.mem_annihilator]
constructor
Β· intro h n
exact h _ (Submodule.subset_span n.prop)
Β· intro h n hn
refine Submodule.span_induction hn ?_ ?_ ?_ ?_
Β· intro x hx
exact h β¨x, hxβ©
Β· exact smul_zero _
Β· intro x y hx hy
rw [smul_add, hx, hy, zero_add]
Β· intro a x hx
rw [smul_comm, hx, smul_zero]
#align submodule.mem_annihilator_span Submodule.mem_annihilator_span
theorem mem_annihilator_span_singleton (g : M) (r : R) :
r β (Submodule.span R ({g} : Set M)).annihilator β r β’ g = 0 := by simp [mem_annihilator_span]
#align submodule.mem_annihilator_span_singleton Submodule.mem_annihilator_span_singleton
theorem annihilator_bot : (β₯ : Submodule R M).annihilator = β€ :=
(Ideal.eq_top_iff_one _).2 <| mem_annihilator'.2 bot_le
#align submodule.annihilator_bot Submodule.annihilator_bot
theorem annihilator_eq_top_iff : N.annihilator = β€ β N = β₯ :=
β¨fun H =>
eq_bot_iff.2 fun (n : M) hn =>
(mem_bot R).2 <| one_smul R n βΈ mem_annihilator.1 ((Ideal.eq_top_iff_one _).1 H) n hn,
fun H => H.symm βΈ annihilator_botβ©
#align submodule.annihilator_eq_top_iff Submodule.annihilator_eq_top_iff
theorem annihilator_mono (h : N β€ P) : P.annihilator β€ N.annihilator := fun _ hrp =>
mem_annihilator.2 fun n hn => mem_annihilator.1 hrp n <| h hn
#align submodule.annihilator_mono Submodule.annihilator_mono
theorem annihilator_iSup (ΞΉ : Sort w) (f : ΞΉ β Submodule R M) :
annihilator (β¨ i, f i) = β¨
i, annihilator (f i) :=
le_antisymm (le_iInf fun _ => annihilator_mono <| le_iSup _ _) fun _ H =>
mem_annihilator'.2 <|
iSup_le fun i =>
have := (mem_iInf _).1 H i
mem_annihilator'.1 this
#align submodule.annihilator_supr Submodule.annihilator_iSup
theorem smul_mem_smul {r} {n} (hr : r β I) (hn : n β N) : r β’ n β I β’ N :=
apply_mem_mapβ _ hr hn
#align submodule.smul_mem_smul Submodule.smul_mem_smul
theorem smul_le {P : Submodule R M} : I β’ N β€ P β β r β I, β n β N, r β’ n β P :=
mapβ_le
#align submodule.smul_le Submodule.smul_le
@[simp, norm_cast]
lemma coe_set_smul : (I : Set R) β’ N = I β’ N :=
Submodule.set_smul_eq_of_le _ _ _
(fun _ _ hr hx => smul_mem_smul hr hx)
(smul_le.mpr fun _ hr _ hx => mem_set_smul_of_mem_mem hr hx)
@[elab_as_elim]
theorem smul_induction_on {p : M β Prop} {x} (H : x β I β’ N) (smul : β r β I, β n β N, p (r β’ n))
(add : β x y, p x β p y β p (x + y)) : p x := by
have H0 : p 0 := by simpa only [zero_smul] using smul 0 I.zero_mem 0 N.zero_mem
refine Submodule.iSup_induction (x := x) _ H ?_ H0 add
rintro β¨i, hiβ© m β¨j, hj, hj'β©
rw [β hj']
exact smul _ hi _ hj
#align submodule.smul_induction_on Submodule.smul_induction_on
@[elab_as_elim]
| Mathlib/RingTheory/Ideal/Operations.lean | 153 | 159 | theorem smul_induction_on' {x : M} (hx : x β I β’ N) {p : β x, x β I β’ N β Prop}
(smul : β (r : R) (hr : r β I) (n : M) (hn : n β N), p (r β’ n) (smul_mem_smul hr hn))
(add : β x hx y hy, p x hx β p y hy β p (x + y) (Submodule.add_mem _ βΉ_βΊ βΉ_βΊ)) : p x hx := by |
refine Exists.elim ?_ fun (h : x β I β’ N) (H : p x h) => H
exact
smul_induction_on hx (fun a ha x hx => β¨_, smul _ ha _ hxβ©) fun x y β¨_, hxβ© β¨_, hyβ© =>
β¨_, add _ _ _ _ hx hyβ©
|
import Mathlib.Order.Cover
import Mathlib.Order.Interval.Finset.Defs
#align_import data.finset.locally_finite from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
assert_not_exists MonoidWithZero
assert_not_exists Finset.sum
open Function OrderDual
open FinsetInterval
variable {ΞΉ Ξ± : Type*}
namespace Finset
section Preorder
variable [Preorder Ξ±]
section LocallyFiniteOrder
variable [LocallyFiniteOrder Ξ±] {a aβ aβ b bβ bβ c x : Ξ±}
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Icc : (Icc a b).Nonempty β a β€ b := by
rw [β coe_nonempty, coe_Icc, Set.nonempty_Icc]
#align finset.nonempty_Icc Finset.nonempty_Icc
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ico : (Ico a b).Nonempty β a < b := by
rw [β coe_nonempty, coe_Ico, Set.nonempty_Ico]
#align finset.nonempty_Ico Finset.nonempty_Ico
@[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem nonempty_Ioc : (Ioc a b).Nonempty β a < b := by
rw [β coe_nonempty, coe_Ioc, Set.nonempty_Ioc]
#align finset.nonempty_Ioc Finset.nonempty_Ioc
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem nonempty_Ioo [DenselyOrdered Ξ±] : (Ioo a b).Nonempty β a < b := by
rw [β coe_nonempty, coe_Ioo, Set.nonempty_Ioo]
#align finset.nonempty_Ioo Finset.nonempty_Ioo
@[simp]
theorem Icc_eq_empty_iff : Icc a b = β
β Β¬a β€ b := by
rw [β coe_eq_empty, coe_Icc, Set.Icc_eq_empty_iff]
#align finset.Icc_eq_empty_iff Finset.Icc_eq_empty_iff
@[simp]
theorem Ico_eq_empty_iff : Ico a b = β
β Β¬a < b := by
rw [β coe_eq_empty, coe_Ico, Set.Ico_eq_empty_iff]
#align finset.Ico_eq_empty_iff Finset.Ico_eq_empty_iff
@[simp]
theorem Ioc_eq_empty_iff : Ioc a b = β
β Β¬a < b := by
rw [β coe_eq_empty, coe_Ioc, Set.Ioc_eq_empty_iff]
#align finset.Ioc_eq_empty_iff Finset.Ioc_eq_empty_iff
-- TODO: This is nonsense. A locally finite order is never densely ordered
@[simp]
theorem Ioo_eq_empty_iff [DenselyOrdered Ξ±] : Ioo a b = β
β Β¬a < b := by
rw [β coe_eq_empty, coe_Ioo, Set.Ioo_eq_empty_iff]
#align finset.Ioo_eq_empty_iff Finset.Ioo_eq_empty_iff
alias β¨_, Icc_eq_emptyβ© := Icc_eq_empty_iff
#align finset.Icc_eq_empty Finset.Icc_eq_empty
alias β¨_, Ico_eq_emptyβ© := Ico_eq_empty_iff
#align finset.Ico_eq_empty Finset.Ico_eq_empty
alias β¨_, Ioc_eq_emptyβ© := Ioc_eq_empty_iff
#align finset.Ioc_eq_empty Finset.Ioc_eq_empty
@[simp]
theorem Ioo_eq_empty (h : Β¬a < b) : Ioo a b = β
:=
eq_empty_iff_forall_not_mem.2 fun _ hx => h ((mem_Ioo.1 hx).1.trans (mem_Ioo.1 hx).2)
#align finset.Ioo_eq_empty Finset.Ioo_eq_empty
@[simp]
theorem Icc_eq_empty_of_lt (h : b < a) : Icc a b = β
:=
Icc_eq_empty h.not_le
#align finset.Icc_eq_empty_of_lt Finset.Icc_eq_empty_of_lt
@[simp]
theorem Ico_eq_empty_of_le (h : b β€ a) : Ico a b = β
:=
Ico_eq_empty h.not_lt
#align finset.Ico_eq_empty_of_le Finset.Ico_eq_empty_of_le
@[simp]
theorem Ioc_eq_empty_of_le (h : b β€ a) : Ioc a b = β
:=
Ioc_eq_empty h.not_lt
#align finset.Ioc_eq_empty_of_le Finset.Ioc_eq_empty_of_le
@[simp]
theorem Ioo_eq_empty_of_le (h : b β€ a) : Ioo a b = β
:=
Ioo_eq_empty h.not_lt
#align finset.Ioo_eq_empty_of_le Finset.Ioo_eq_empty_of_le
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Icc : a β Icc a b β a β€ b := by simp only [mem_Icc, true_and_iff, le_rfl]
#align finset.left_mem_Icc Finset.left_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_mem_Ico : a β Ico a b β a < b := by simp only [mem_Ico, true_and_iff, le_refl]
#align finset.left_mem_Ico Finset.left_mem_Ico
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_mem_Icc : b β Icc a b β a β€ b := by simp only [mem_Icc, and_true_iff, le_rfl]
#align finset.right_mem_Icc Finset.right_mem_Icc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_mem_Ioc : b β Ioc a b β a < b := by simp only [mem_Ioc, and_true_iff, le_rfl]
#align finset.right_mem_Ioc Finset.right_mem_Ioc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_not_mem_Ioc : a β Ioc a b := fun h => lt_irrefl _ (mem_Ioc.1 h).1
#align finset.left_not_mem_Ioc Finset.left_not_mem_Ioc
-- porting note (#10618): simp can prove this
-- @[simp]
theorem left_not_mem_Ioo : a β Ioo a b := fun h => lt_irrefl _ (mem_Ioo.1 h).1
#align finset.left_not_mem_Ioo Finset.left_not_mem_Ioo
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_not_mem_Ico : b β Ico a b := fun h => lt_irrefl _ (mem_Ico.1 h).2
#align finset.right_not_mem_Ico Finset.right_not_mem_Ico
-- porting note (#10618): simp can prove this
-- @[simp]
theorem right_not_mem_Ioo : b β Ioo a b := fun h => lt_irrefl _ (mem_Ioo.1 h).2
#align finset.right_not_mem_Ioo Finset.right_not_mem_Ioo
theorem Icc_subset_Icc (ha : aβ β€ aβ) (hb : bβ β€ bβ) : Icc aβ bβ β Icc aβ bβ := by
simpa [β coe_subset] using Set.Icc_subset_Icc ha hb
#align finset.Icc_subset_Icc Finset.Icc_subset_Icc
theorem Ico_subset_Ico (ha : aβ β€ aβ) (hb : bβ β€ bβ) : Ico aβ bβ β Ico aβ bβ := by
simpa [β coe_subset] using Set.Ico_subset_Ico ha hb
#align finset.Ico_subset_Ico Finset.Ico_subset_Ico
theorem Ioc_subset_Ioc (ha : aβ β€ aβ) (hb : bβ β€ bβ) : Ioc aβ bβ β Ioc aβ bβ := by
simpa [β coe_subset] using Set.Ioc_subset_Ioc ha hb
#align finset.Ioc_subset_Ioc Finset.Ioc_subset_Ioc
theorem Ioo_subset_Ioo (ha : aβ β€ aβ) (hb : bβ β€ bβ) : Ioo aβ bβ β Ioo aβ bβ := by
simpa [β coe_subset] using Set.Ioo_subset_Ioo ha hb
#align finset.Ioo_subset_Ioo Finset.Ioo_subset_Ioo
theorem Icc_subset_Icc_left (h : aβ β€ aβ) : Icc aβ b β Icc aβ b :=
Icc_subset_Icc h le_rfl
#align finset.Icc_subset_Icc_left Finset.Icc_subset_Icc_left
theorem Ico_subset_Ico_left (h : aβ β€ aβ) : Ico aβ b β Ico aβ b :=
Ico_subset_Ico h le_rfl
#align finset.Ico_subset_Ico_left Finset.Ico_subset_Ico_left
theorem Ioc_subset_Ioc_left (h : aβ β€ aβ) : Ioc aβ b β Ioc aβ b :=
Ioc_subset_Ioc h le_rfl
#align finset.Ioc_subset_Ioc_left Finset.Ioc_subset_Ioc_left
theorem Ioo_subset_Ioo_left (h : aβ β€ aβ) : Ioo aβ b β Ioo aβ b :=
Ioo_subset_Ioo h le_rfl
#align finset.Ioo_subset_Ioo_left Finset.Ioo_subset_Ioo_left
theorem Icc_subset_Icc_right (h : bβ β€ bβ) : Icc a bβ β Icc a bβ :=
Icc_subset_Icc le_rfl h
#align finset.Icc_subset_Icc_right Finset.Icc_subset_Icc_right
theorem Ico_subset_Ico_right (h : bβ β€ bβ) : Ico a bβ β Ico a bβ :=
Ico_subset_Ico le_rfl h
#align finset.Ico_subset_Ico_right Finset.Ico_subset_Ico_right
theorem Ioc_subset_Ioc_right (h : bβ β€ bβ) : Ioc a bβ β Ioc a bβ :=
Ioc_subset_Ioc le_rfl h
#align finset.Ioc_subset_Ioc_right Finset.Ioc_subset_Ioc_right
theorem Ioo_subset_Ioo_right (h : bβ β€ bβ) : Ioo a bβ β Ioo a bβ :=
Ioo_subset_Ioo le_rfl h
#align finset.Ioo_subset_Ioo_right Finset.Ioo_subset_Ioo_right
theorem Ico_subset_Ioo_left (h : aβ < aβ) : Ico aβ b β Ioo aβ b := by
rw [β coe_subset, coe_Ico, coe_Ioo]
exact Set.Ico_subset_Ioo_left h
#align finset.Ico_subset_Ioo_left Finset.Ico_subset_Ioo_left
theorem Ioc_subset_Ioo_right (h : bβ < bβ) : Ioc a bβ β Ioo a bβ := by
rw [β coe_subset, coe_Ioc, coe_Ioo]
exact Set.Ioc_subset_Ioo_right h
#align finset.Ioc_subset_Ioo_right Finset.Ioc_subset_Ioo_right
theorem Icc_subset_Ico_right (h : bβ < bβ) : Icc a bβ β Ico a bβ := by
rw [β coe_subset, coe_Icc, coe_Ico]
exact Set.Icc_subset_Ico_right h
#align finset.Icc_subset_Ico_right Finset.Icc_subset_Ico_right
theorem Ioo_subset_Ico_self : Ioo a b β Ico a b := by
rw [β coe_subset, coe_Ioo, coe_Ico]
exact Set.Ioo_subset_Ico_self
#align finset.Ioo_subset_Ico_self Finset.Ioo_subset_Ico_self
theorem Ioo_subset_Ioc_self : Ioo a b β Ioc a b := by
rw [β coe_subset, coe_Ioo, coe_Ioc]
exact Set.Ioo_subset_Ioc_self
#align finset.Ioo_subset_Ioc_self Finset.Ioo_subset_Ioc_self
theorem Ico_subset_Icc_self : Ico a b β Icc a b := by
rw [β coe_subset, coe_Ico, coe_Icc]
exact Set.Ico_subset_Icc_self
#align finset.Ico_subset_Icc_self Finset.Ico_subset_Icc_self
theorem Ioc_subset_Icc_self : Ioc a b β Icc a b := by
rw [β coe_subset, coe_Ioc, coe_Icc]
exact Set.Ioc_subset_Icc_self
#align finset.Ioc_subset_Icc_self Finset.Ioc_subset_Icc_self
theorem Ioo_subset_Icc_self : Ioo a b β Icc a b :=
Ioo_subset_Ico_self.trans Ico_subset_Icc_self
#align finset.Ioo_subset_Icc_self Finset.Ioo_subset_Icc_self
theorem Icc_subset_Icc_iff (hβ : aβ β€ bβ) : Icc aβ bβ β Icc aβ bβ β aβ β€ aβ β§ bβ β€ bβ := by
rw [β coe_subset, coe_Icc, coe_Icc, Set.Icc_subset_Icc_iff hβ]
#align finset.Icc_subset_Icc_iff Finset.Icc_subset_Icc_iff
theorem Icc_subset_Ioo_iff (hβ : aβ β€ bβ) : Icc aβ bβ β Ioo aβ bβ β aβ < aβ β§ bβ < bβ := by
rw [β coe_subset, coe_Icc, coe_Ioo, Set.Icc_subset_Ioo_iff hβ]
#align finset.Icc_subset_Ioo_iff Finset.Icc_subset_Ioo_iff
theorem Icc_subset_Ico_iff (hβ : aβ β€ bβ) : Icc aβ bβ β Ico aβ bβ β aβ β€ aβ β§ bβ < bβ := by
rw [β coe_subset, coe_Icc, coe_Ico, Set.Icc_subset_Ico_iff hβ]
#align finset.Icc_subset_Ico_iff Finset.Icc_subset_Ico_iff
theorem Icc_subset_Ioc_iff (hβ : aβ β€ bβ) : Icc aβ bβ β Ioc aβ bβ β aβ < aβ β§ bβ β€ bβ :=
(Icc_subset_Ico_iff hβ.dual).trans and_comm
#align finset.Icc_subset_Ioc_iff Finset.Icc_subset_Ioc_iff
--TODO: `Ico_subset_Ioo_iff`, `Ioc_subset_Ioo_iff`
theorem Icc_ssubset_Icc_left (hI : aβ β€ bβ) (ha : aβ < aβ) (hb : bβ β€ bβ) :
Icc aβ bβ β Icc aβ bβ := by
rw [β coe_ssubset, coe_Icc, coe_Icc]
exact Set.Icc_ssubset_Icc_left hI ha hb
#align finset.Icc_ssubset_Icc_left Finset.Icc_ssubset_Icc_left
theorem Icc_ssubset_Icc_right (hI : aβ β€ bβ) (ha : aβ β€ aβ) (hb : bβ < bβ) :
Icc aβ bβ β Icc aβ bβ := by
rw [β coe_ssubset, coe_Icc, coe_Icc]
exact Set.Icc_ssubset_Icc_right hI ha hb
#align finset.Icc_ssubset_Icc_right Finset.Icc_ssubset_Icc_right
variable (a)
-- porting note (#10618): simp can prove this
-- @[simp]
theorem Ico_self : Ico a a = β
:=
Ico_eq_empty <| lt_irrefl _
#align finset.Ico_self Finset.Ico_self
-- porting note (#10618): simp can prove this
-- @[simp]
theorem Ioc_self : Ioc a a = β
:=
Ioc_eq_empty <| lt_irrefl _
#align finset.Ioc_self Finset.Ioc_self
-- porting note (#10618): simp can prove this
-- @[simp]
theorem Ioo_self : Ioo a a = β
:=
Ioo_eq_empty <| lt_irrefl _
#align finset.Ioo_self Finset.Ioo_self
variable {a}
def _root_.Set.fintypeOfMemBounds {s : Set Ξ±} [DecidablePred (Β· β s)] (ha : a β lowerBounds s)
(hb : b β upperBounds s) : Fintype s :=
Set.fintypeSubset (Set.Icc a b) fun _ hx => β¨ha hx, hb hxβ©
#align set.fintype_of_mem_bounds Set.fintypeOfMemBounds
section Filter
theorem Ico_filter_lt_of_le_left [DecidablePred (Β· < c)] (hca : c β€ a) :
(Ico a b).filter (Β· < c) = β
:=
filter_false_of_mem fun _ hx => (hca.trans (mem_Ico.1 hx).1).not_lt
#align finset.Ico_filter_lt_of_le_left Finset.Ico_filter_lt_of_le_left
theorem Ico_filter_lt_of_right_le [DecidablePred (Β· < c)] (hbc : b β€ c) :
(Ico a b).filter (Β· < c) = Ico a b :=
filter_true_of_mem fun _ hx => (mem_Ico.1 hx).2.trans_le hbc
#align finset.Ico_filter_lt_of_right_le Finset.Ico_filter_lt_of_right_le
theorem Ico_filter_lt_of_le_right [DecidablePred (Β· < c)] (hcb : c β€ b) :
(Ico a b).filter (Β· < c) = Ico a c := by
ext x
rw [mem_filter, mem_Ico, mem_Ico, and_right_comm]
exact and_iff_left_of_imp fun h => h.2.trans_le hcb
#align finset.Ico_filter_lt_of_le_right Finset.Ico_filter_lt_of_le_right
theorem Ico_filter_le_of_le_left {a b c : Ξ±} [DecidablePred (c β€ Β·)] (hca : c β€ a) :
(Ico a b).filter (c β€ Β·) = Ico a b :=
filter_true_of_mem fun _ hx => hca.trans (mem_Ico.1 hx).1
#align finset.Ico_filter_le_of_le_left Finset.Ico_filter_le_of_le_left
theorem Ico_filter_le_of_right_le {a b : Ξ±} [DecidablePred (b β€ Β·)] :
(Ico a b).filter (b β€ Β·) = β
:=
filter_false_of_mem fun _ hx => (mem_Ico.1 hx).2.not_le
#align finset.Ico_filter_le_of_right_le Finset.Ico_filter_le_of_right_le
theorem Ico_filter_le_of_left_le {a b c : Ξ±} [DecidablePred (c β€ Β·)] (hac : a β€ c) :
(Ico a b).filter (c β€ Β·) = Ico c b := by
ext x
rw [mem_filter, mem_Ico, mem_Ico, and_comm, and_left_comm]
exact and_iff_right_of_imp fun h => hac.trans h.1
#align finset.Ico_filter_le_of_left_le Finset.Ico_filter_le_of_left_le
theorem Icc_filter_lt_of_lt_right {a b c : Ξ±} [DecidablePred (Β· < c)] (h : b < c) :
(Icc a b).filter (Β· < c) = Icc a b :=
filter_true_of_mem fun _ hx => lt_of_le_of_lt (mem_Icc.1 hx).2 h
#align finset.Icc_filter_lt_of_lt_right Finset.Icc_filter_lt_of_lt_right
theorem Ioc_filter_lt_of_lt_right {a b c : Ξ±} [DecidablePred (Β· < c)] (h : b < c) :
(Ioc a b).filter (Β· < c) = Ioc a b :=
filter_true_of_mem fun _ hx => lt_of_le_of_lt (mem_Ioc.1 hx).2 h
#align finset.Ioc_filter_lt_of_lt_right Finset.Ioc_filter_lt_of_lt_right
theorem Iic_filter_lt_of_lt_right {Ξ±} [Preorder Ξ±] [LocallyFiniteOrderBot Ξ±] {a c : Ξ±}
[DecidablePred (Β· < c)] (h : a < c) : (Iic a).filter (Β· < c) = Iic a :=
filter_true_of_mem fun _ hx => lt_of_le_of_lt (mem_Iic.1 hx) h
#align finset.Iic_filter_lt_of_lt_right Finset.Iic_filter_lt_of_lt_right
variable (a b) [Fintype Ξ±]
theorem filter_lt_lt_eq_Ioo [DecidablePred fun j => a < j β§ j < b] :
(univ.filter fun j => a < j β§ j < b) = Ioo a b := by
ext
simp
#align finset.filter_lt_lt_eq_Ioo Finset.filter_lt_lt_eq_Ioo
| Mathlib/Order/Interval/Finset/Basic.lean | 375 | 378 | theorem filter_lt_le_eq_Ioc [DecidablePred fun j => a < j β§ j β€ b] :
(univ.filter fun j => a < j β§ j β€ b) = Ioc a b := by |
ext
simp
|
import Mathlib.Topology.Sets.Closeds
#align_import topology.noetherian_space from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
variable (Ξ± Ξ² : Type*) [TopologicalSpace Ξ±] [TopologicalSpace Ξ²]
namespace TopologicalSpace
@[mk_iff]
class NoetherianSpace : Prop where
wellFounded_opens : WellFounded ((Β· > Β·) : Opens Ξ± β Opens Ξ± β Prop)
#align topological_space.noetherian_space TopologicalSpace.NoetherianSpace
theorem noetherianSpace_iff_opens : NoetherianSpace Ξ± β β s : Opens Ξ±, IsCompact (s : Set Ξ±) := by
rw [noetherianSpace_iff, CompleteLattice.wellFounded_iff_isSupFiniteCompact,
CompleteLattice.isSupFiniteCompact_iff_all_elements_compact]
exact forall_congr' Opens.isCompactElement_iff
#align topological_space.noetherian_space_iff_opens TopologicalSpace.noetherianSpace_iff_opens
instance (priority := 100) NoetherianSpace.compactSpace [h : NoetherianSpace Ξ±] : CompactSpace Ξ± :=
β¨(noetherianSpace_iff_opens Ξ±).mp h β€β©
#align topological_space.noetherian_space.compact_space TopologicalSpace.NoetherianSpace.compactSpace
variable {Ξ± Ξ²}
protected theorem NoetherianSpace.isCompact [NoetherianSpace Ξ±] (s : Set Ξ±) : IsCompact s := by
refine isCompact_iff_finite_subcover.2 fun U hUo hs => ?_
rcases ((noetherianSpace_iff_opens Ξ±).mp βΉ_βΊ β¨β i, U i, isOpen_iUnion hUoβ©).elim_finite_subcover U
hUo Set.Subset.rfl with β¨t, htβ©
exact β¨t, hs.trans htβ©
#align topological_space.noetherian_space.is_compact TopologicalSpace.NoetherianSpace.isCompact
-- Porting note: fixed NS
protected theorem _root_.Inducing.noetherianSpace [NoetherianSpace Ξ±] {i : Ξ² β Ξ±}
(hi : Inducing i) : NoetherianSpace Ξ² :=
(noetherianSpace_iff_opens _).2 fun _ => hi.isCompact_iff.2 (NoetherianSpace.isCompact _)
#align topological_space.inducing.noetherian_space Inducing.noetherianSpace
instance NoetherianSpace.set [NoetherianSpace Ξ±] (s : Set Ξ±) : NoetherianSpace s :=
inducing_subtype_val.noetherianSpace
#align topological_space.noetherian_space.set TopologicalSpace.NoetherianSpace.set
variable (Ξ±)
open List in
theorem noetherianSpace_TFAE :
TFAE [NoetherianSpace Ξ±,
WellFounded fun s t : Closeds Ξ± => s < t,
β s : Set Ξ±, IsCompact s,
β s : Opens Ξ±, IsCompact (s : Set Ξ±)] := by
tfae_have 1 β 2
Β· refine (noetherianSpace_iff Ξ±).trans (Opens.compl_bijective.2.wellFounded_iff ?_)
exact (@OrderIso.compl (Set Ξ±)).lt_iff_lt.symm
tfae_have 1 β 4
Β· exact noetherianSpace_iff_opens Ξ±
tfae_have 1 β 3
Β· exact @NoetherianSpace.isCompact Ξ± _
tfae_have 3 β 4
Β· exact fun h s => h s
tfae_finish
#align topological_space.noetherian_space_tfae TopologicalSpace.noetherianSpace_TFAE
variable {Ξ±}
theorem noetherianSpace_iff_isCompact : NoetherianSpace Ξ± β β s : Set Ξ±, IsCompact s :=
(noetherianSpace_TFAE Ξ±).out 0 2
theorem NoetherianSpace.wellFounded_closeds [NoetherianSpace Ξ±] :
WellFounded fun s t : Closeds Ξ± => s < t :=
Iff.mp ((noetherianSpace_TFAE Ξ±).out 0 1) βΉ_βΊ
instance {Ξ±} : NoetherianSpace (CofiniteTopology Ξ±) := by
simp only [noetherianSpace_iff_isCompact, isCompact_iff_ultrafilter_le_nhds,
CofiniteTopology.nhds_eq, Ultrafilter.le_sup_iff, Filter.le_principal_iff]
intro s f hs
rcases f.le_cofinite_or_eq_pure with (hf | β¨a, rflβ©)
Β· rcases Filter.nonempty_of_mem hs with β¨a, haβ©
exact β¨a, ha, Or.inr hfβ©
Β· exact β¨a, hs, Or.inl le_rflβ©
theorem noetherianSpace_of_surjective [NoetherianSpace Ξ±] (f : Ξ± β Ξ²) (hf : Continuous f)
(hf' : Function.Surjective f) : NoetherianSpace Ξ² :=
noetherianSpace_iff_isCompact.2 <| (Set.image_surjective.mpr hf').forall.2 fun s =>
(NoetherianSpace.isCompact s).image hf
#align topological_space.noetherian_space_of_surjective TopologicalSpace.noetherianSpace_of_surjective
theorem noetherianSpace_iff_of_homeomorph (f : Ξ± ββ Ξ²) : NoetherianSpace Ξ± β NoetherianSpace Ξ² :=
β¨fun _ => noetherianSpace_of_surjective f f.continuous f.surjective,
fun _ => noetherianSpace_of_surjective f.symm f.symm.continuous f.symm.surjectiveβ©
#align topological_space.noetherian_space_iff_of_homeomorph TopologicalSpace.noetherianSpace_iff_of_homeomorph
theorem NoetherianSpace.range [NoetherianSpace Ξ±] (f : Ξ± β Ξ²) (hf : Continuous f) :
NoetherianSpace (Set.range f) :=
noetherianSpace_of_surjective (Set.rangeFactorization f) (hf.subtype_mk _)
Set.surjective_onto_range
#align topological_space.noetherian_space.range TopologicalSpace.NoetherianSpace.range
theorem noetherianSpace_set_iff (s : Set Ξ±) :
NoetherianSpace s β β t, t β s β IsCompact t := by
simp only [noetherianSpace_iff_isCompact, embedding_subtype_val.isCompact_iff,
Subtype.forall_set_subtype]
#align topological_space.noetherian_space_set_iff TopologicalSpace.noetherianSpace_set_iff
@[simp]
theorem noetherian_univ_iff : NoetherianSpace (Set.univ : Set Ξ±) β NoetherianSpace Ξ± :=
noetherianSpace_iff_of_homeomorph (Homeomorph.Set.univ Ξ±)
#align topological_space.noetherian_univ_iff TopologicalSpace.noetherian_univ_iff
theorem NoetherianSpace.iUnion {ΞΉ : Type*} (f : ΞΉ β Set Ξ±) [Finite ΞΉ]
[hf : β i, NoetherianSpace (f i)] : NoetherianSpace (β i, f i) := by
simp_rw [noetherianSpace_set_iff] at hf β’
intro t ht
rw [β Set.inter_eq_left.mpr ht, Set.inter_iUnion]
exact isCompact_iUnion fun i => hf i _ Set.inter_subset_right
#align topological_space.noetherian_space.Union TopologicalSpace.NoetherianSpace.iUnion
-- This is not an instance since it makes a loop with `t2_space_discrete`.
theorem NoetherianSpace.discrete [NoetherianSpace Ξ±] [T2Space Ξ±] : DiscreteTopology Ξ± :=
β¨eq_bot_iff.mpr fun _ _ => isClosed_compl_iff.mp (NoetherianSpace.isCompact _).isClosedβ©
#align topological_space.noetherian_space.discrete TopologicalSpace.NoetherianSpace.discrete
attribute [local instance] NoetherianSpace.discrete
theorem NoetherianSpace.finite [NoetherianSpace Ξ±] [T2Space Ξ±] : Finite Ξ± :=
Finite.of_finite_univ (NoetherianSpace.isCompact Set.univ).finite_of_discrete
#align topological_space.noetherian_space.finite TopologicalSpace.NoetherianSpace.finite
instance (priority := 100) Finite.to_noetherianSpace [Finite Ξ±] : NoetherianSpace Ξ± :=
β¨Finite.wellFounded_of_trans_of_irrefl _β©
#align topological_space.finite.to_noetherian_space TopologicalSpace.Finite.to_noetherianSpace
theorem NoetherianSpace.exists_finite_set_closeds_irreducible [NoetherianSpace Ξ±] (s : Closeds Ξ±) :
β S : Set (Closeds Ξ±), S.Finite β§ (β t β S, IsIrreducible (t : Set Ξ±)) β§ s = sSup S := by
apply wellFounded_closeds.induction s; clear s
intro s H
rcases eq_or_ne s β₯ with rfl | hβ
Β· use β
; simp
Β· by_cases hβ : IsPreirreducible (s : Set Ξ±)
Β· replace hβ : IsIrreducible (s : Set Ξ±) := β¨Closeds.coe_nonempty.2 hβ, hββ©
use {s}; simp [hβ]
Β· simp only [isPreirreducible_iff_closed_union_closed, not_forall, not_or] at hβ
obtain β¨zβ, zβ, hzβ, hzβ, h, hzβ', hzβ'β© := hβ
lift zβ to Closeds Ξ± using hzβ
lift zβ to Closeds Ξ± using hzβ
rcases H (s β zβ) (inf_lt_left.2 hzβ') with β¨Sβ, hSfβ, hSβ, hββ©
rcases H (s β zβ) (inf_lt_left.2 hzβ') with β¨Sβ, hSfβ, hSβ, hββ©
refine β¨Sβ βͺ Sβ, hSfβ.union hSfβ, Set.union_subset_iff.2 β¨hSβ, hSββ©, ?_β©
rwa [sSup_union, β hβ, β hβ, β inf_sup_left, left_eq_inf]
theorem NoetherianSpace.exists_finite_set_isClosed_irreducible [NoetherianSpace Ξ±]
{s : Set Ξ±} (hs : IsClosed s) : β S : Set (Set Ξ±), S.Finite β§
(β t β S, IsClosed t) β§ (β t β S, IsIrreducible t) β§ s = ββ S := by
lift s to Closeds Ξ± using hs
rcases NoetherianSpace.exists_finite_set_closeds_irreducible s with β¨S, hSf, hS, rflβ©
refine β¨(β) '' S, hSf.image _, Set.forall_mem_image.2 fun S _ β¦ S.2, Set.forall_mem_image.2 hS,
?_β©
lift S to Finset (Closeds Ξ±) using hSf
simp [β Finset.sup_id_eq_sSup, Closeds.coe_finset_sup]
theorem NoetherianSpace.exists_finset_irreducible [NoetherianSpace Ξ±] (s : Closeds Ξ±) :
β S : Finset (Closeds Ξ±), (β k : S, IsIrreducible (k : Set Ξ±)) β§ s = S.sup id := by
simpa [Set.exists_finite_iff_finset, Finset.sup_id_eq_sSup]
using NoetherianSpace.exists_finite_set_closeds_irreducible s
#align topological_space.noetherian_space.exists_finset_irreducible TopologicalSpace.NoetherianSpace.exists_finset_irreducible
theorem NoetherianSpace.finite_irreducibleComponents [NoetherianSpace Ξ±] :
(irreducibleComponents Ξ±).Finite := by
obtain β¨S : Set (Set Ξ±), hSf, hSc, hSi, hSUβ© :=
NoetherianSpace.exists_finite_set_isClosed_irreducible isClosed_univ (Ξ± := Ξ±)
refine hSf.subset fun s hs => ?_
lift S to Finset (Set Ξ±) using hSf
rcases isIrreducible_iff_sUnion_closed.1 hs.1 S hSc (hSU βΈ Set.subset_univ _) with β¨t, htS, htβ©
rwa [ht.antisymm (hs.2 (hSi _ htS) ht)]
#align topological_space.noetherian_space.finite_irreducible_components TopologicalSpace.NoetherianSpace.finite_irreducibleComponents
| Mathlib/Topology/NoetherianSpace.lean | 223 | 264 | theorem NoetherianSpace.exists_open_ne_empty_le_irreducibleComponent [NoetherianSpace Ξ±]
(Z : Set Ξ±) (H : Z β irreducibleComponents Ξ±) :
β o : Set Ξ±, IsOpen o β§ o β β
β§ o β€ Z := by |
classical
let ΞΉ : Set (Set Ξ±) := irreducibleComponents Ξ± \ {Z}
have hΞΉ : ΞΉ.Finite := NoetherianSpace.finite_irreducibleComponents.subset Set.diff_subset
have hΞΉ' : Finite ΞΉ := by rwa [Set.finite_coe_iff]
let U := Z \ β (x : ΞΉ), x
have hU0 : U β β
:= fun r β¦ by
obtain β¨Z', hZ'β© := isIrreducible_iff_sUnion_closed.mp H.1 hΞΉ.toFinset
(fun z hz β¦ by
simp only [Set.Finite.mem_toFinset, Set.mem_diff, Set.mem_singleton_iff] at hz
exact isClosed_of_mem_irreducibleComponents _ hz.1)
(by
rw [Set.Finite.coe_toFinset, Set.sUnion_eq_iUnion]
rw [Set.diff_eq_empty] at r
exact r)
simp only [Set.Finite.mem_toFinset, Set.mem_diff, Set.mem_singleton_iff] at hZ'
exact hZ'.1.2 <| le_antisymm (H.2 hZ'.1.1.1 hZ'.2) hZ'.2
have hU1 : U = (β (x : ΞΉ), x.1) αΆ := by
rw [Set.compl_eq_univ_diff]
refine le_antisymm (Set.diff_subset_diff le_top <| subset_refl _) ?_
rw [β Set.compl_eq_univ_diff]
refine Set.compl_subset_iff_union.mpr (le_antisymm le_top ?_)
rw [Set.union_comm, β Set.sUnion_eq_iUnion, β Set.sUnion_insert]
rintro a -
by_cases h : a β U
Β· exact β¨U, Set.mem_insert _ _, hβ©
Β· rw [Set.mem_diff, Decidable.not_and_iff_or_not_not, not_not, Set.mem_iUnion] at h
rcases h with (h|β¨i, hiβ©)
Β· refine β¨irreducibleComponent a, Or.inr ?_, mem_irreducibleComponentβ©
simp only [ΞΉ, Set.mem_diff, Set.mem_singleton_iff]
refine β¨irreducibleComponent_mem_irreducibleComponents _, ?_β©
rintro rfl
exact h mem_irreducibleComponent
Β· exact β¨i, Or.inr i.2, hiβ©
refine β¨U, hU1 βΈ isOpen_compl_iff.mpr ?_, hU0, sdiff_leβ©
exact isClosed_iUnion_of_finite fun i β¦ isClosed_of_mem_irreducibleComponents i.1 i.2.1
|
import Mathlib.Data.Finset.Sort
import Mathlib.Data.Fin.VecNotation
import Mathlib.Data.Sign
import Mathlib.LinearAlgebra.AffineSpace.Combination
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv
import Mathlib.LinearAlgebra.Basis.VectorSpace
#align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
noncomputable section
open Finset Function
open scoped Affine
section AffineIndependent
variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P] {ΞΉ : Type*}
def AffineIndependent (p : ΞΉ β P) : Prop :=
β (s : Finset ΞΉ) (w : ΞΉ β k),
β i β s, w i = 0 β s.weightedVSub p w = (0 : V) β β i β s, w i = 0
#align affine_independent AffineIndependent
theorem affineIndependent_def (p : ΞΉ β P) :
AffineIndependent k p β
β (s : Finset ΞΉ) (w : ΞΉ β k),
β i β s, w i = 0 β s.weightedVSub p w = (0 : V) β β i β s, w i = 0 :=
Iff.rfl
#align affine_independent_def affineIndependent_def
theorem affineIndependent_of_subsingleton [Subsingleton ΞΉ] (p : ΞΉ β P) : AffineIndependent k p :=
fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi
#align affine_independent_of_subsingleton affineIndependent_of_subsingleton
| Mathlib/LinearAlgebra/AffineSpace/Independent.lean | 72 | 81 | theorem affineIndependent_iff_of_fintype [Fintype ΞΉ] (p : ΞΉ β P) :
AffineIndependent k p β
β w : ΞΉ β k, β i, w i = 0 β Finset.univ.weightedVSub p w = (0 : V) β β i, w i = 0 := by |
constructor
Β· exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _)
Β· intro h s w hw hs i hi
rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs
rw [β Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw
replace h := h ((βs : Set ΞΉ).indicator w) hw hs i
simpa [hi] using h
|
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ΞΉ π E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : β β E) (ΞΌ : Measure β) (a b : β) : Prop :=
IntegrableOn f (Ioc a b) ΞΌ β§ IntegrableOn f (Ioc b a) ΞΌ
#align interval_integrable IntervalIntegrable
section
variable {f : β β E} {a b : β} {ΞΌ : Measure β}
theorem intervalIntegrable_iff : IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ξ a b) ΞΌ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f ΞΌ a b) : IntegrableOn f (Ξ a b) ΞΌ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioc a b) ΞΌ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
theorem intervalIntegrable_iff' [NoAtoms ΞΌ] :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (uIcc a b) ΞΌ := by
rw [intervalIntegrable_iff, β Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff' intervalIntegrable_iff'
theorem intervalIntegrable_iff_integrableOn_Icc_of_le {f : β β E} {a b : β} (hab : a β€ b)
{ΞΌ : Measure β} [NoAtoms ΞΌ] : IntervalIntegrable f ΞΌ a b β IntegrableOn f (Icc a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff_integrable_Icc_of_le intervalIntegrable_iff_integrableOn_Icc_of_le
theorem intervalIntegrable_iff_integrableOn_Ico_of_le [NoAtoms ΞΌ] (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ico a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ico]
theorem intervalIntegrable_iff_integrableOn_Ioo_of_le [NoAtoms ΞΌ] (hab : a β€ b) :
IntervalIntegrable f ΞΌ a b β IntegrableOn f (Ioo a b) ΞΌ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioo]
theorem MeasureTheory.Integrable.intervalIntegrable (hf : Integrable f ΞΌ) :
IntervalIntegrable f ΞΌ a b :=
β¨hf.integrableOn, hf.integrableOnβ©
#align measure_theory.integrable.interval_integrable MeasureTheory.Integrable.intervalIntegrable
theorem MeasureTheory.IntegrableOn.intervalIntegrable (hf : IntegrableOn f [[a, b]] ΞΌ) :
IntervalIntegrable f ΞΌ a b :=
β¨MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc),
MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc')β©
#align measure_theory.integrable_on.interval_integrable MeasureTheory.IntegrableOn.intervalIntegrable
theorem intervalIntegrable_const_iff {c : E} :
IntervalIntegrable (fun _ => c) ΞΌ a b β c = 0 β¨ ΞΌ (Ξ a b) < β := by
simp only [intervalIntegrable_iff, integrableOn_const]
#align interval_integrable_const_iff intervalIntegrable_const_iff
@[simp]
theorem intervalIntegrable_const [IsLocallyFiniteMeasure ΞΌ] {c : E} :
IntervalIntegrable (fun _ => c) ΞΌ a b :=
intervalIntegrable_const_iff.2 <| Or.inr measure_Ioc_lt_top
#align interval_integrable_const intervalIntegrable_const
end
namespace IntervalIntegrable
section
variable {f : β β E} {a b c d : β} {ΞΌ Ξ½ : Measure β}
@[symm]
nonrec theorem symm (h : IntervalIntegrable f ΞΌ a b) : IntervalIntegrable f ΞΌ b a :=
h.symm
#align interval_integrable.symm IntervalIntegrable.symm
@[refl, simp] -- Porting note: added `simp`
theorem refl : IntervalIntegrable f ΞΌ a a := by constructor <;> simp
#align interval_integrable.refl IntervalIntegrable.refl
@[trans]
theorem trans {a b c : β} (hab : IntervalIntegrable f ΞΌ a b) (hbc : IntervalIntegrable f ΞΌ b c) :
IntervalIntegrable f ΞΌ a c :=
β¨(hab.1.union hbc.1).mono_set Ioc_subset_Ioc_union_Ioc,
(hbc.2.union hab.2).mono_set Ioc_subset_Ioc_union_Iocβ©
#align interval_integrable.trans IntervalIntegrable.trans
theorem trans_iterate_Ico {a : β β β} {m n : β} (hmn : m β€ n)
(hint : β k β Ico m n, IntervalIntegrable f ΞΌ (a k) (a <| k + 1)) :
IntervalIntegrable f ΞΌ (a m) (a n) := by
revert hint
refine Nat.le_induction ?_ ?_ n hmn
Β· simp
Β· intro p hp IH h
exact (IH fun k hk => h k (Ico_subset_Ico_right p.le_succ hk)).trans (h p (by simp [hp]))
#align interval_integrable.trans_iterate_Ico IntervalIntegrable.trans_iterate_Ico
theorem trans_iterate {a : β β β} {n : β}
(hint : β k < n, IntervalIntegrable f ΞΌ (a k) (a <| k + 1)) :
IntervalIntegrable f ΞΌ (a 0) (a n) :=
trans_iterate_Ico bot_le fun k hk => hint k hk.2
#align interval_integrable.trans_iterate IntervalIntegrable.trans_iterate
theorem neg (h : IntervalIntegrable f ΞΌ a b) : IntervalIntegrable (-f) ΞΌ a b :=
β¨h.1.neg, h.2.negβ©
#align interval_integrable.neg IntervalIntegrable.neg
theorem norm (h : IntervalIntegrable f ΞΌ a b) : IntervalIntegrable (fun x => βf xβ) ΞΌ a b :=
β¨h.1.norm, h.2.normβ©
#align interval_integrable.norm IntervalIntegrable.norm
theorem intervalIntegrable_norm_iff {f : β β E} {ΞΌ : Measure β} {a b : β}
(hf : AEStronglyMeasurable f (ΞΌ.restrict (Ξ a b))) :
IntervalIntegrable (fun t => βf tβ) ΞΌ a b β IntervalIntegrable f ΞΌ a b := by
simp_rw [intervalIntegrable_iff, IntegrableOn]; exact integrable_norm_iff hf
#align interval_integrable.interval_integrable_norm_iff IntervalIntegrable.intervalIntegrable_norm_iff
theorem abs {f : β β β} (h : IntervalIntegrable f ΞΌ a b) :
IntervalIntegrable (fun x => |f x|) ΞΌ a b :=
h.norm
#align interval_integrable.abs IntervalIntegrable.abs
theorem mono (hf : IntervalIntegrable f Ξ½ a b) (h1 : [[c, d]] β [[a, b]]) (h2 : ΞΌ β€ Ξ½) :
IntervalIntegrable f ΞΌ c d :=
intervalIntegrable_iff.mpr <| hf.def'.mono (uIoc_subset_uIoc_of_uIcc_subset_uIcc h1) h2
#align interval_integrable.mono IntervalIntegrable.mono
theorem mono_measure (hf : IntervalIntegrable f Ξ½ a b) (h : ΞΌ β€ Ξ½) : IntervalIntegrable f ΞΌ a b :=
hf.mono Subset.rfl h
#align interval_integrable.mono_measure IntervalIntegrable.mono_measure
theorem mono_set (hf : IntervalIntegrable f ΞΌ a b) (h : [[c, d]] β [[a, b]]) :
IntervalIntegrable f ΞΌ c d :=
hf.mono h le_rfl
#align interval_integrable.mono_set IntervalIntegrable.mono_set
theorem mono_set_ae (hf : IntervalIntegrable f ΞΌ a b) (h : Ξ c d β€α΅[ΞΌ] Ξ a b) :
IntervalIntegrable f ΞΌ c d :=
intervalIntegrable_iff.mpr <| hf.def'.mono_set_ae h
#align interval_integrable.mono_set_ae IntervalIntegrable.mono_set_ae
theorem mono_set' (hf : IntervalIntegrable f ΞΌ a b) (hsub : Ξ c d β Ξ a b) :
IntervalIntegrable f ΞΌ c d :=
hf.mono_set_ae <| eventually_of_forall hsub
#align interval_integrable.mono_set' IntervalIntegrable.mono_set'
theorem mono_fun [NormedAddCommGroup F] {g : β β F} (hf : IntervalIntegrable f ΞΌ a b)
(hgm : AEStronglyMeasurable g (ΞΌ.restrict (Ξ a b)))
(hle : (fun x => βg xβ) β€α΅[ΞΌ.restrict (Ξ a b)] fun x => βf xβ) : IntervalIntegrable g ΞΌ a b :=
intervalIntegrable_iff.2 <| hf.def'.integrable.mono hgm hle
#align interval_integrable.mono_fun IntervalIntegrable.mono_fun
theorem mono_fun' {g : β β β} (hg : IntervalIntegrable g ΞΌ a b)
(hfm : AEStronglyMeasurable f (ΞΌ.restrict (Ξ a b)))
(hle : (fun x => βf xβ) β€α΅[ΞΌ.restrict (Ξ a b)] g) : IntervalIntegrable f ΞΌ a b :=
intervalIntegrable_iff.2 <| hg.def'.integrable.mono' hfm hle
#align interval_integrable.mono_fun' IntervalIntegrable.mono_fun'
protected theorem aestronglyMeasurable (h : IntervalIntegrable f ΞΌ a b) :
AEStronglyMeasurable f (ΞΌ.restrict (Ioc a b)) :=
h.1.aestronglyMeasurable
#align interval_integrable.ae_strongly_measurable IntervalIntegrable.aestronglyMeasurable
protected theorem aestronglyMeasurable' (h : IntervalIntegrable f ΞΌ a b) :
AEStronglyMeasurable f (ΞΌ.restrict (Ioc b a)) :=
h.2.aestronglyMeasurable
#align interval_integrable.ae_strongly_measurable' IntervalIntegrable.aestronglyMeasurable'
end
variable [NormedRing A] {f g : β β E} {a b : β} {ΞΌ : Measure β}
theorem smul [NormedField π] [NormedSpace π E] {f : β β E} {a b : β} {ΞΌ : Measure β}
(h : IntervalIntegrable f ΞΌ a b) (r : π) : IntervalIntegrable (r β’ f) ΞΌ a b :=
β¨h.1.smul r, h.2.smul rβ©
#align interval_integrable.smul IntervalIntegrable.smul
@[simp]
theorem add (hf : IntervalIntegrable f ΞΌ a b) (hg : IntervalIntegrable g ΞΌ a b) :
IntervalIntegrable (fun x => f x + g x) ΞΌ a b :=
β¨hf.1.add hg.1, hf.2.add hg.2β©
#align interval_integrable.add IntervalIntegrable.add
@[simp]
theorem sub (hf : IntervalIntegrable f ΞΌ a b) (hg : IntervalIntegrable g ΞΌ a b) :
IntervalIntegrable (fun x => f x - g x) ΞΌ a b :=
β¨hf.1.sub hg.1, hf.2.sub hg.2β©
#align interval_integrable.sub IntervalIntegrable.sub
theorem sum (s : Finset ΞΉ) {f : ΞΉ β β β E} (h : β i β s, IntervalIntegrable (f i) ΞΌ a b) :
IntervalIntegrable (β i β s, f i) ΞΌ a b :=
β¨integrable_finset_sum' s fun i hi => (h i hi).1, integrable_finset_sum' s fun i hi => (h i hi).2β©
#align interval_integrable.sum IntervalIntegrable.sum
theorem mul_continuousOn {f g : β β A} (hf : IntervalIntegrable f ΞΌ a b)
(hg : ContinuousOn g [[a, b]]) : IntervalIntegrable (fun x => f x * g x) ΞΌ a b := by
rw [intervalIntegrable_iff] at hf β’
exact hf.mul_continuousOn_of_subset hg measurableSet_Ioc isCompact_uIcc Ioc_subset_Icc_self
#align interval_integrable.mul_continuous_on IntervalIntegrable.mul_continuousOn
theorem continuousOn_mul {f g : β β A} (hf : IntervalIntegrable f ΞΌ a b)
(hg : ContinuousOn g [[a, b]]) : IntervalIntegrable (fun x => g x * f x) ΞΌ a b := by
rw [intervalIntegrable_iff] at hf β’
exact hf.continuousOn_mul_of_subset hg isCompact_uIcc measurableSet_Ioc Ioc_subset_Icc_self
#align interval_integrable.continuous_on_mul IntervalIntegrable.continuousOn_mul
@[simp]
theorem const_mul {f : β β A} (hf : IntervalIntegrable f ΞΌ a b) (c : A) :
IntervalIntegrable (fun x => c * f x) ΞΌ a b :=
hf.continuousOn_mul continuousOn_const
#align interval_integrable.const_mul IntervalIntegrable.const_mul
@[simp]
theorem mul_const {f : β β A} (hf : IntervalIntegrable f ΞΌ a b) (c : A) :
IntervalIntegrable (fun x => f x * c) ΞΌ a b :=
hf.mul_continuousOn continuousOn_const
#align interval_integrable.mul_const IntervalIntegrable.mul_const
@[simp]
theorem div_const {π : Type*} {f : β β π} [NormedField π] (h : IntervalIntegrable f ΞΌ a b)
(c : π) : IntervalIntegrable (fun x => f x / c) ΞΌ a b := by
simpa only [div_eq_mul_inv] using mul_const h cβ»ΒΉ
#align interval_integrable.div_const IntervalIntegrable.div_const
theorem comp_mul_left (hf : IntervalIntegrable f volume a b) (c : β) :
IntervalIntegrable (fun x => f (c * x)) volume (a / c) (b / c) := by
rcases eq_or_ne c 0 with (hc | hc); Β· rw [hc]; simp
rw [intervalIntegrable_iff'] at hf β’
have A : MeasurableEmbedding fun x => x * cβ»ΒΉ :=
(Homeomorph.mulRightβ _ (inv_ne_zero hc)).closedEmbedding.measurableEmbedding
rw [β Real.smul_map_volume_mul_right (inv_ne_zero hc), IntegrableOn, Measure.restrict_smul,
integrable_smul_measure (by simpa : ENNReal.ofReal |cβ»ΒΉ| β 0) ENNReal.ofReal_ne_top,
β IntegrableOn, MeasurableEmbedding.integrableOn_map_iff A]
convert hf using 1
Β· ext; simp only [comp_apply]; congr 1; field_simp
Β· rw [preimage_mul_const_uIcc (inv_ne_zero hc)]; field_simp [hc]
#align interval_integrable.comp_mul_left IntervalIntegrable.comp_mul_left
-- Porting note (#10756): new lemma
theorem comp_mul_left_iff {c : β} (hc : c β 0) :
IntervalIntegrable (fun x β¦ f (c * x)) volume (a / c) (b / c) β
IntervalIntegrable f volume a b :=
β¨fun h β¦ by simpa [hc] using h.comp_mul_left cβ»ΒΉ, (comp_mul_left Β· c)β©
theorem comp_mul_right (hf : IntervalIntegrable f volume a b) (c : β) :
IntervalIntegrable (fun x => f (x * c)) volume (a / c) (b / c) := by
simpa only [mul_comm] using comp_mul_left hf c
#align interval_integrable.comp_mul_right IntervalIntegrable.comp_mul_right
theorem comp_add_right (hf : IntervalIntegrable f volume a b) (c : β) :
IntervalIntegrable (fun x => f (x + c)) volume (a - c) (b - c) := by
wlog h : a β€ b generalizing a b
Β· exact IntervalIntegrable.symm (this hf.symm (le_of_not_le h))
rw [intervalIntegrable_iff'] at hf β’
have A : MeasurableEmbedding fun x => x + c :=
(Homeomorph.addRight c).closedEmbedding.measurableEmbedding
rw [β map_add_right_eq_self volume c] at hf
convert (MeasurableEmbedding.integrableOn_map_iff A).mp hf using 1
rw [preimage_add_const_uIcc]
#align interval_integrable.comp_add_right IntervalIntegrable.comp_add_right
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 345 | 347 | theorem comp_add_left (hf : IntervalIntegrable f volume a b) (c : β) :
IntervalIntegrable (fun x => f (c + x)) volume (a - c) (b - c) := by |
simpa only [add_comm] using IntervalIntegrable.comp_add_right hf c
|
import Mathlib.ModelTheory.Syntax
import Mathlib.ModelTheory.Semantics
import Mathlib.Algebra.Ring.Equiv
variable {Ξ± : Type*}
namespace FirstOrder
open FirstOrder
inductive ringFunc : β β Type
| add : ringFunc 2
| mul : ringFunc 2
| neg : ringFunc 1
| zero : ringFunc 0
| one : ringFunc 0
deriving DecidableEq
def Language.ring : Language :=
{ Functions := ringFunc
Relations := fun _ => Empty }
namespace Ring
open ringFunc Language
instance (n : β) : DecidableEq (Language.ring.Functions n) := by
dsimp [Language.ring]; infer_instance
instance (n : β) : DecidableEq (Language.ring.Relations n) := by
dsimp [Language.ring]; infer_instance
abbrev addFunc : Language.ring.Functions 2 := add
abbrev mulFunc : Language.ring.Functions 2 := mul
abbrev negFunc : Language.ring.Functions 1 := neg
abbrev zeroFunc : Language.ring.Functions 0 := zero
abbrev oneFunc : Language.ring.Functions 0 := one
instance (Ξ± : Type*) : Zero (Language.ring.Term Ξ±) :=
{ zero := Constants.term zeroFunc }
theorem zero_def (Ξ± : Type*) : (0 : Language.ring.Term Ξ±) = Constants.term zeroFunc := rfl
instance (Ξ± : Type*) : One (Language.ring.Term Ξ±) :=
{ one := Constants.term oneFunc }
theorem one_def (Ξ± : Type*) : (1 : Language.ring.Term Ξ±) = Constants.term oneFunc := rfl
instance (Ξ± : Type*) : Add (Language.ring.Term Ξ±) :=
{ add := addFunc.applyβ }
theorem add_def (Ξ± : Type*) (tβ tβ : Language.ring.Term Ξ±) :
tβ + tβ = addFunc.applyβ tβ tβ := rfl
instance (Ξ± : Type*) : Mul (Language.ring.Term Ξ±) :=
{ mul := mulFunc.applyβ }
theorem mul_def (Ξ± : Type*) (tβ tβ : Language.ring.Term Ξ±) :
tβ * tβ = mulFunc.applyβ tβ tβ := rfl
instance (Ξ± : Type*) : Neg (Language.ring.Term Ξ±) :=
{ neg := negFunc.applyβ }
theorem neg_def (Ξ± : Type*) (t : Language.ring.Term Ξ±) :
-t = negFunc.applyβ t := rfl
instance : Fintype Language.ring.Symbols :=
β¨β¨Multiset.ofList
[Sum.inl β¨2, .addβ©,
Sum.inl β¨2, .mulβ©,
Sum.inl β¨1, .negβ©,
Sum.inl β¨0, .zeroβ©,
Sum.inl β¨0, .oneβ©], by
dsimp [Language.Symbols]; decideβ©, by
intro x
dsimp [Language.Symbols]
rcases x with β¨_, fβ© | β¨_, fβ©
Β· cases f <;> decide
Β· cases f β©
@[simp]
| Mathlib/ModelTheory/Algebra/Ring/Basic.lean | 138 | 140 | theorem card_ring : card Language.ring = 5 := by |
have : Fintype.card Language.ring.Symbols = 5 := rfl
simp [Language.card, this]
|
import Mathlib.LinearAlgebra.Span
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Ideal.QuotientOperations
import Mathlib.RingTheory.Noetherian
#align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M]
def IsAssociatedPrime : Prop :=
I.IsPrime β§ β x : M, I = (R β x).annihilator
#align is_associated_prime IsAssociatedPrime
variable (R)
def associatedPrimes : Set (Ideal R) :=
{ I | IsAssociatedPrime I M }
#align associated_primes associatedPrimes
variable {I J M R}
variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M ββ[R] M')
theorem AssociatePrimes.mem_iff : I β associatedPrimes R M β IsAssociatedPrime I M := Iff.rfl
#align associate_primes.mem_iff AssociatePrimes.mem_iff
theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1
#align is_associated_prime.is_prime IsAssociatedPrime.isPrime
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) :
IsAssociatedPrime I M' := by
obtain β¨x, rflβ© := h.2
refine β¨h.1, β¨f x, ?_β©β©
ext r
rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, β
map_smul, β f.map_zero, hf.eq_iff]
#align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective
theorem LinearEquiv.isAssociatedPrime_iff (l : M ββ[R] M') :
IsAssociatedPrime I M β IsAssociatedPrime I M' :=
β¨fun h => h.map_of_injective l l.injective,
fun h => h.map_of_injective l.symm l.symm.injectiveβ©
#align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : Β¬IsAssociatedPrime I M := by
rintro β¨hI, x, hxβ©
apply hI.ne_top
rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot]
at hx
#align not_is_associated_prime_of_subsingleton not_isAssociatedPrime_of_subsingleton
variable (R)
| Mathlib/RingTheory/Ideal/AssociatedPrime.lean | 83 | 103 | theorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)
(hx : x β 0) : β P : Ideal R, IsAssociatedPrime P M β§ (R β x).annihilator β€ P := by |
have : (R β x).annihilator β β€ := by
rwa [Ne, Ideal.eq_top_iff_one, Submodule.mem_annihilator_span_singleton, one_smul]
obtain β¨P, β¨l, hβ, y, rflβ©, hββ© :=
set_has_maximal_iff_noetherian.mpr H
{ P | (R β x).annihilator β€ P β§ P β β€ β§ β y : M, P = (R β y).annihilator }
β¨(R β x).annihilator, rfl.le, this, x, rflβ©
refine β¨_, β¨β¨hβ, ?_β©, y, rflβ©, lβ©
intro a b hab
rw [or_iff_not_imp_left]
intro ha
rw [Submodule.mem_annihilator_span_singleton] at ha hab
have Hβ : (R β y).annihilator β€ (R β a β’ y).annihilator := by
intro c hc
rw [Submodule.mem_annihilator_span_singleton] at hc β’
rw [smul_comm, hc, smul_zero]
have Hβ : (Submodule.span R {a β’ y}).annihilator β β€ := by
rwa [Ne, Submodule.annihilator_eq_top_iff, Submodule.span_singleton_eq_bot]
rwa [Hβ.eq_of_not_lt (hβ (R β a β’ y).annihilator β¨l.trans Hβ, Hβ, _, rflβ©),
Submodule.mem_annihilator_span_singleton, smul_comm, smul_smul]
|
import Mathlib.Algebra.Algebra.Prod
import Mathlib.LinearAlgebra.Basic
import Mathlib.LinearAlgebra.Span
import Mathlib.Order.PartialSups
#align_import linear_algebra.prod from "leanprover-community/mathlib"@"cd391184c85986113f8c00844cfe6dda1d34be3d"
universe u v w x y z u' v' w' y'
variable {R : Type u} {K : Type u'} {M : Type v} {V : Type v'} {Mβ : Type w} {Vβ : Type w'}
variable {Mβ : Type y} {Vβ : Type y'} {Mβ : Type z} {ΞΉ : Type x}
variable {Mβ
Mβ : Type*}
section Prod
namespace LinearMap
variable (S : Type*) [Semiring R] [Semiring S]
variable [AddCommMonoid M] [AddCommMonoid Mβ] [AddCommMonoid Mβ] [AddCommMonoid Mβ]
variable [AddCommMonoid Mβ
] [AddCommMonoid Mβ]
variable [Module R M] [Module R Mβ] [Module R Mβ] [Module R Mβ]
variable [Module R Mβ
] [Module R Mβ]
variable (f : M ββ[R] Mβ)
section
variable (R M Mβ)
def fst : M Γ Mβ ββ[R] M where
toFun := Prod.fst
map_add' _x _y := rfl
map_smul' _x _y := rfl
#align linear_map.fst LinearMap.fst
def snd : M Γ Mβ ββ[R] Mβ where
toFun := Prod.snd
map_add' _x _y := rfl
map_smul' _x _y := rfl
#align linear_map.snd LinearMap.snd
end
@[simp]
theorem fst_apply (x : M Γ Mβ) : fst R M Mβ x = x.1 :=
rfl
#align linear_map.fst_apply LinearMap.fst_apply
@[simp]
theorem snd_apply (x : M Γ Mβ) : snd R M Mβ x = x.2 :=
rfl
#align linear_map.snd_apply LinearMap.snd_apply
theorem fst_surjective : Function.Surjective (fst R M Mβ) := fun x => β¨(x, 0), rflβ©
#align linear_map.fst_surjective LinearMap.fst_surjective
theorem snd_surjective : Function.Surjective (snd R M Mβ) := fun x => β¨(0, x), rflβ©
#align linear_map.snd_surjective LinearMap.snd_surjective
@[simps]
def prod (f : M ββ[R] Mβ) (g : M ββ[R] Mβ) : M ββ[R] Mβ Γ Mβ where
toFun := Pi.prod f g
map_add' x y := by simp only [Pi.prod, Prod.mk_add_mk, map_add]
map_smul' c x := by simp only [Pi.prod, Prod.smul_mk, map_smul, RingHom.id_apply]
#align linear_map.prod LinearMap.prod
theorem coe_prod (f : M ββ[R] Mβ) (g : M ββ[R] Mβ) : β(f.prod g) = Pi.prod f g :=
rfl
#align linear_map.coe_prod LinearMap.coe_prod
@[simp]
theorem fst_prod (f : M ββ[R] Mβ) (g : M ββ[R] Mβ) : (fst R Mβ Mβ).comp (prod f g) = f := rfl
#align linear_map.fst_prod LinearMap.fst_prod
@[simp]
theorem snd_prod (f : M ββ[R] Mβ) (g : M ββ[R] Mβ) : (snd R Mβ Mβ).comp (prod f g) = g := rfl
#align linear_map.snd_prod LinearMap.snd_prod
@[simp]
theorem pair_fst_snd : prod (fst R M Mβ) (snd R M Mβ) = LinearMap.id := rfl
#align linear_map.pair_fst_snd LinearMap.pair_fst_snd
theorem prod_comp (f : Mβ ββ[R] Mβ) (g : Mβ ββ[R] Mβ)
(h : M ββ[R] Mβ) : (f.prod g).comp h = (f.comp h).prod (g.comp h) :=
rfl
@[simps]
def prodEquiv [Module S Mβ] [Module S Mβ] [SMulCommClass R S Mβ] [SMulCommClass R S Mβ] :
((M ββ[R] Mβ) Γ (M ββ[R] Mβ)) ββ[S] M ββ[R] Mβ Γ Mβ where
toFun f := f.1.prod f.2
invFun f := ((fst _ _ _).comp f, (snd _ _ _).comp f)
left_inv f := by ext <;> rfl
right_inv f := by ext <;> rfl
map_add' a b := rfl
map_smul' r a := rfl
#align linear_map.prod_equiv LinearMap.prodEquiv
section
variable (R M Mβ)
def inl : M ββ[R] M Γ Mβ :=
prod LinearMap.id 0
#align linear_map.inl LinearMap.inl
def inr : Mβ ββ[R] M Γ Mβ :=
prod 0 LinearMap.id
#align linear_map.inr LinearMap.inr
theorem range_inl : range (inl R M Mβ) = ker (snd R M Mβ) := by
ext x
simp only [mem_ker, mem_range]
constructor
Β· rintro β¨y, rflβ©
rfl
Β· intro h
exact β¨x.fst, Prod.ext rfl h.symmβ©
#align linear_map.range_inl LinearMap.range_inl
theorem ker_snd : ker (snd R M Mβ) = range (inl R M Mβ) :=
Eq.symm <| range_inl R M Mβ
#align linear_map.ker_snd LinearMap.ker_snd
theorem range_inr : range (inr R M Mβ) = ker (fst R M Mβ) := by
ext x
simp only [mem_ker, mem_range]
constructor
Β· rintro β¨y, rflβ©
rfl
Β· intro h
exact β¨x.snd, Prod.ext h.symm rflβ©
#align linear_map.range_inr LinearMap.range_inr
theorem ker_fst : ker (fst R M Mβ) = range (inr R M Mβ) :=
Eq.symm <| range_inr R M Mβ
#align linear_map.ker_fst LinearMap.ker_fst
@[simp] theorem fst_comp_inl : fst R M Mβ ββ inl R M Mβ = id := rfl
@[simp] theorem snd_comp_inl : snd R M Mβ ββ inl R M Mβ = 0 := rfl
@[simp] theorem fst_comp_inr : fst R M Mβ ββ inr R M Mβ = 0 := rfl
@[simp] theorem snd_comp_inr : snd R M Mβ ββ inr R M Mβ = id := rfl
end
@[simp]
theorem coe_inl : (inl R M Mβ : M β M Γ Mβ) = fun x => (x, 0) :=
rfl
#align linear_map.coe_inl LinearMap.coe_inl
theorem inl_apply (x : M) : inl R M Mβ x = (x, 0) :=
rfl
#align linear_map.inl_apply LinearMap.inl_apply
@[simp]
theorem coe_inr : (inr R M Mβ : Mβ β M Γ Mβ) = Prod.mk 0 :=
rfl
#align linear_map.coe_inr LinearMap.coe_inr
theorem inr_apply (x : Mβ) : inr R M Mβ x = (0, x) :=
rfl
#align linear_map.inr_apply LinearMap.inr_apply
theorem inl_eq_prod : inl R M Mβ = prod LinearMap.id 0 :=
rfl
#align linear_map.inl_eq_prod LinearMap.inl_eq_prod
theorem inr_eq_prod : inr R M Mβ = prod 0 LinearMap.id :=
rfl
#align linear_map.inr_eq_prod LinearMap.inr_eq_prod
theorem inl_injective : Function.Injective (inl R M Mβ) := fun _ => by simp
#align linear_map.inl_injective LinearMap.inl_injective
theorem inr_injective : Function.Injective (inr R M Mβ) := fun _ => by simp
#align linear_map.inr_injective LinearMap.inr_injective
def coprod (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) : M Γ Mβ ββ[R] Mβ :=
f.comp (fst _ _ _) + g.comp (snd _ _ _)
#align linear_map.coprod LinearMap.coprod
@[simp]
theorem coprod_apply (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) (x : M Γ Mβ) :
coprod f g x = f x.1 + g x.2 :=
rfl
#align linear_map.coprod_apply LinearMap.coprod_apply
@[simp]
theorem coprod_inl (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) : (coprod f g).comp (inl R M Mβ) = f := by
ext; simp only [map_zero, add_zero, coprod_apply, inl_apply, comp_apply]
#align linear_map.coprod_inl LinearMap.coprod_inl
@[simp]
theorem coprod_inr (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) : (coprod f g).comp (inr R M Mβ) = g := by
ext; simp only [map_zero, coprod_apply, inr_apply, zero_add, comp_apply]
#align linear_map.coprod_inr LinearMap.coprod_inr
@[simp]
theorem coprod_inl_inr : coprod (inl R M Mβ) (inr R M Mβ) = LinearMap.id := by
ext <;>
simp only [Prod.mk_add_mk, add_zero, id_apply, coprod_apply, inl_apply, inr_apply, zero_add]
#align linear_map.coprod_inl_inr LinearMap.coprod_inl_inr
theorem coprod_zero_left (g : Mβ ββ[R] Mβ) : (0 : M ββ[R] Mβ).coprod g = g.comp (snd R M Mβ) :=
zero_add _
theorem coprod_zero_right (f : M ββ[R] Mβ) : f.coprod (0 : Mβ ββ[R] Mβ) = f.comp (fst R M Mβ) :=
add_zero _
theorem comp_coprod (f : Mβ ββ[R] Mβ) (gβ : M ββ[R] Mβ) (gβ : Mβ ββ[R] Mβ) :
f.comp (gβ.coprod gβ) = (f.comp gβ).coprod (f.comp gβ) :=
ext fun x => f.map_add (gβ x.1) (gβ x.2)
#align linear_map.comp_coprod LinearMap.comp_coprod
theorem fst_eq_coprod : fst R M Mβ = coprod LinearMap.id 0 := by ext; simp
#align linear_map.fst_eq_coprod LinearMap.fst_eq_coprod
theorem snd_eq_coprod : snd R M Mβ = coprod 0 LinearMap.id := by ext; simp
#align linear_map.snd_eq_coprod LinearMap.snd_eq_coprod
@[simp]
theorem coprod_comp_prod (f : Mβ ββ[R] Mβ) (g : Mβ ββ[R] Mβ) (f' : M ββ[R] Mβ) (g' : M ββ[R] Mβ) :
(f.coprod g).comp (f'.prod g') = f.comp f' + g.comp g' :=
rfl
#align linear_map.coprod_comp_prod LinearMap.coprod_comp_prod
@[simp]
theorem coprod_map_prod (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) (S : Submodule R M)
(S' : Submodule R Mβ) : (Submodule.prod S S').map (LinearMap.coprod f g) = S.map f β S'.map g :=
SetLike.coe_injective <| by
simp only [LinearMap.coprod_apply, Submodule.coe_sup, Submodule.map_coe]
rw [β Set.image2_add, Set.image2_image_left, Set.image2_image_right]
exact Set.image_prod fun m mβ => f m + g mβ
#align linear_map.coprod_map_prod LinearMap.coprod_map_prod
@[simps]
def coprodEquiv [Module S Mβ] [SMulCommClass R S Mβ] :
((M ββ[R] Mβ) Γ (Mβ ββ[R] Mβ)) ββ[S] M Γ Mβ ββ[R] Mβ where
toFun f := f.1.coprod f.2
invFun f := (f.comp (inl _ _ _), f.comp (inr _ _ _))
left_inv f := by simp only [coprod_inl, coprod_inr]
right_inv f := by simp only [β comp_coprod, comp_id, coprod_inl_inr]
map_add' a b := by
ext
simp only [Prod.snd_add, add_apply, coprod_apply, Prod.fst_add, add_add_add_comm]
map_smul' r a := by
dsimp
ext
simp only [smul_add, smul_apply, Prod.smul_snd, Prod.smul_fst, coprod_apply]
#align linear_map.coprod_equiv LinearMap.coprodEquiv
theorem prod_ext_iff {f g : M Γ Mβ ββ[R] Mβ} :
f = g β f.comp (inl _ _ _) = g.comp (inl _ _ _) β§ f.comp (inr _ _ _) = g.comp (inr _ _ _) :=
(coprodEquiv β).symm.injective.eq_iff.symm.trans Prod.ext_iff
#align linear_map.prod_ext_iff LinearMap.prod_ext_iff
@[ext 1100]
theorem prod_ext {f g : M Γ Mβ ββ[R] Mβ} (hl : f.comp (inl _ _ _) = g.comp (inl _ _ _))
(hr : f.comp (inr _ _ _) = g.comp (inr _ _ _)) : f = g :=
prod_ext_iff.2 β¨hl, hrβ©
#align linear_map.prod_ext LinearMap.prod_ext
def prodMap (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) : M Γ Mβ ββ[R] Mβ Γ Mβ :=
(f.comp (fst R M Mβ)).prod (g.comp (snd R M Mβ))
#align linear_map.prod_map LinearMap.prodMap
theorem coe_prodMap (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) : β(f.prodMap g) = Prod.map f g :=
rfl
#align linear_map.coe_prod_map LinearMap.coe_prodMap
@[simp]
theorem prodMap_apply (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) (x) : f.prodMap g x = (f x.1, g x.2) :=
rfl
#align linear_map.prod_map_apply LinearMap.prodMap_apply
theorem prodMap_comap_prod (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) (S : Submodule R Mβ)
(S' : Submodule R Mβ) :
(Submodule.prod S S').comap (LinearMap.prodMap f g) = (S.comap f).prod (S'.comap g) :=
SetLike.coe_injective <| Set.preimage_prod_map_prod f g _ _
#align linear_map.prod_map_comap_prod LinearMap.prodMap_comap_prod
| Mathlib/LinearAlgebra/Prod.lean | 333 | 336 | theorem ker_prodMap (f : M ββ[R] Mβ) (g : Mβ ββ[R] Mβ) :
ker (LinearMap.prodMap f g) = Submodule.prod (ker f) (ker g) := by |
dsimp only [ker]
rw [β prodMap_comap_prod, Submodule.prod_bot]
|
import Mathlib.Algebra.Associated
import Mathlib.NumberTheory.Divisors
#align_import algebra.is_prime_pow from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
variable {R : Type*} [CommMonoidWithZero R] (n p : R) (k : β)
def IsPrimePow : Prop :=
β (p : R) (k : β), Prime p β§ 0 < k β§ p ^ k = n
#align is_prime_pow IsPrimePow
theorem isPrimePow_def : IsPrimePow n β β (p : R) (k : β), Prime p β§ 0 < k β§ p ^ k = n :=
Iff.rfl
#align is_prime_pow_def isPrimePow_def
theorem isPrimePow_iff_pow_succ : IsPrimePow n β β (p : R) (k : β), Prime p β§ p ^ (k + 1) = n :=
(isPrimePow_def _).trans
β¨fun β¨p, k, hp, hk, hnβ© => β¨_, _, hp, by rwa [Nat.sub_add_cancel hk]β©, fun β¨p, k, hp, hnβ© =>
β¨_, _, hp, Nat.succ_pos', hnβ©β©
#align is_prime_pow_iff_pow_succ isPrimePow_iff_pow_succ
theorem not_isPrimePow_zero [NoZeroDivisors R] : Β¬IsPrimePow (0 : R) := by
simp only [isPrimePow_def, not_exists, not_and', and_imp]
intro x n _hn hx
rw [pow_eq_zero hx]
simp
#align not_is_prime_pow_zero not_isPrimePow_zero
theorem IsPrimePow.not_unit {n : R} (h : IsPrimePow n) : Β¬IsUnit n :=
let β¨_p, _k, hp, hk, hnβ© := h
hn βΈ (isUnit_pow_iff hk.ne').not.mpr hp.not_unit
#align is_prime_pow.not_unit IsPrimePow.not_unit
theorem IsUnit.not_isPrimePow {n : R} (h : IsUnit n) : Β¬IsPrimePow n := fun h' => h'.not_unit h
#align is_unit.not_is_prime_pow IsUnit.not_isPrimePow
theorem not_isPrimePow_one : Β¬IsPrimePow (1 : R) :=
isUnit_one.not_isPrimePow
#align not_is_prime_pow_one not_isPrimePow_one
theorem Prime.isPrimePow {p : R} (hp : Prime p) : IsPrimePow p :=
β¨p, 1, hp, zero_lt_one, by simpβ©
#align prime.is_prime_pow Prime.isPrimePow
theorem IsPrimePow.pow {n : R} (hn : IsPrimePow n) {k : β} (hk : k β 0) : IsPrimePow (n ^ k) :=
let β¨p, k', hp, hk', hnβ© := hn
β¨p, k * k', hp, mul_pos hk.bot_lt hk', by rw [pow_mul', hn]β©
#align is_prime_pow.pow IsPrimePow.pow
theorem IsPrimePow.ne_zero [NoZeroDivisors R] {n : R} (h : IsPrimePow n) : n β 0 := fun t =>
not_isPrimePow_zero (t βΈ h)
#align is_prime_pow.ne_zero IsPrimePow.ne_zero
theorem IsPrimePow.ne_one {n : R} (h : IsPrimePow n) : n β 1 := fun t =>
not_isPrimePow_one (t βΈ h)
#align is_prime_pow.ne_one IsPrimePow.ne_one
section Nat
theorem isPrimePow_nat_iff (n : β) : IsPrimePow n β β p k : β, Nat.Prime p β§ 0 < k β§ p ^ k = n := by
simp only [isPrimePow_def, Nat.prime_iff]
#align is_prime_pow_nat_iff isPrimePow_nat_iff
theorem Nat.Prime.isPrimePow {p : β} (hp : p.Prime) : IsPrimePow p :=
_root_.Prime.isPrimePow (prime_iff.mp hp)
#align nat.prime.is_prime_pow Nat.Prime.isPrimePow
| Mathlib/Algebra/IsPrimePow.lean | 84 | 91 | theorem isPrimePow_nat_iff_bounded (n : β) :
IsPrimePow n β β p : β, p β€ n β§ β k : β, k β€ n β§ p.Prime β§ 0 < k β§ p ^ k = n := by |
rw [isPrimePow_nat_iff]
refine Iff.symm β¨fun β¨p, _, k, _, hp, hk, hnβ© => β¨p, k, hp, hk, hnβ©, ?_β©
rintro β¨p, k, hp, hk, rflβ©
refine β¨p, ?_, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rflβ©
conv => { lhs; rw [β (pow_one p)] }
exact Nat.pow_le_pow_right hp.one_lt.le hk
|
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.NaturalTransformation
import Mathlib.CategoryTheory.Monoidal.Opposite
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.CommSq
#align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44"
open CategoryTheory MonoidalCategory
universe v vβ vβ vβ u uβ uβ uβ
namespace CategoryTheory
class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where
braiding : β X Y : C, X β Y β
Y β X
braiding_naturality_right :
β (X : C) {Y Z : C} (f : Y βΆ Z),
X β f β« (braiding X Z).hom = (braiding X Y).hom β« f β· X := by
aesop_cat
braiding_naturality_left :
β {X Y : C} (f : X βΆ Y) (Z : C),
f β· Z β« (braiding Y Z).hom = (braiding X Z).hom β« Z β f := by
aesop_cat
hexagon_forward :
β X Y Z : C,
(Ξ±_ X Y Z).hom β« (braiding X (Y β Z)).hom β« (Ξ±_ Y Z X).hom =
((braiding X Y).hom β· Z) β« (Ξ±_ Y X Z).hom β« (Y β (braiding X Z).hom) := by
aesop_cat
hexagon_reverse :
β X Y Z : C,
(Ξ±_ X Y Z).inv β« (braiding (X β Y) Z).hom β« (Ξ±_ Z X Y).inv =
(X β (braiding Y Z).hom) β« (Ξ±_ X Z Y).inv β« ((braiding X Z).hom β· Y) := by
aesop_cat
#align category_theory.braided_category CategoryTheory.BraidedCategory
attribute [reassoc (attr := simp)]
BraidedCategory.braiding_naturality_left
BraidedCategory.braiding_naturality_right
attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse
open Category
open MonoidalCategory
open BraidedCategory
@[inherit_doc]
notation "Ξ²_" => BraidedCategory.braiding
def braidedCategoryOfFaithful {C D : Type*} [Category C] [Category D] [MonoidalCategory C]
[MonoidalCategory D] (F : MonoidalFunctor C D) [F.Faithful] [BraidedCategory D]
(Ξ² : β X Y : C, X β Y β
Y β X)
(w : β X Y, F.ΞΌ _ _ β« F.map (Ξ² X Y).hom = (Ξ²_ _ _).hom β« F.ΞΌ _ _) : BraidedCategory C where
braiding := Ξ²
braiding_naturality_left := by
intros
apply F.map_injective
refine (cancel_epi (F.ΞΌ ?_ ?_)).1 ?_
rw [Functor.map_comp, β LaxMonoidalFunctor.ΞΌ_natural_left_assoc, w, Functor.map_comp,
reassoc_of% w, braiding_naturality_left_assoc, LaxMonoidalFunctor.ΞΌ_natural_right]
braiding_naturality_right := by
intros
apply F.map_injective
refine (cancel_epi (F.ΞΌ ?_ ?_)).1 ?_
rw [Functor.map_comp, β LaxMonoidalFunctor.ΞΌ_natural_right_assoc, w, Functor.map_comp,
reassoc_of% w, braiding_naturality_right_assoc, LaxMonoidalFunctor.ΞΌ_natural_left]
hexagon_forward := by
intros
apply F.map_injective
refine (cancel_epi (F.ΞΌ _ _)).1 ?_
refine (cancel_epi (F.ΞΌ _ _ β· _)).1 ?_
rw [Functor.map_comp, Functor.map_comp, Functor.map_comp, Functor.map_comp, β
LaxMonoidalFunctor.ΞΌ_natural_left_assoc, β comp_whiskerRight_assoc, w,
comp_whiskerRight_assoc, LaxMonoidalFunctor.associativity_assoc,
LaxMonoidalFunctor.associativity_assoc, β LaxMonoidalFunctor.ΞΌ_natural_right, β
MonoidalCategory.whiskerLeft_comp_assoc, w, MonoidalCategory.whiskerLeft_comp_assoc,
reassoc_of% w, braiding_naturality_right_assoc,
LaxMonoidalFunctor.associativity, hexagon_forward_assoc]
hexagon_reverse := by
intros
apply F.toFunctor.map_injective
refine (cancel_epi (F.ΞΌ _ _)).1 ?_
refine (cancel_epi (_ β F.ΞΌ _ _)).1 ?_
rw [Functor.map_comp, Functor.map_comp, Functor.map_comp, Functor.map_comp, β
LaxMonoidalFunctor.ΞΌ_natural_right_assoc, β MonoidalCategory.whiskerLeft_comp_assoc, w,
MonoidalCategory.whiskerLeft_comp_assoc, LaxMonoidalFunctor.associativity_inv_assoc,
LaxMonoidalFunctor.associativity_inv_assoc, β LaxMonoidalFunctor.ΞΌ_natural_left,
β comp_whiskerRight_assoc, w, comp_whiskerRight_assoc, reassoc_of% w,
braiding_naturality_left_assoc, LaxMonoidalFunctor.associativity_inv, hexagon_reverse_assoc]
#align category_theory.braided_category_of_faithful CategoryTheory.braidedCategoryOfFaithful
noncomputable def braidedCategoryOfFullyFaithful {C D : Type*} [Category C] [Category D]
[MonoidalCategory C] [MonoidalCategory D] (F : MonoidalFunctor C D) [F.Full]
[F.Faithful] [BraidedCategory D] : BraidedCategory C :=
braidedCategoryOfFaithful F
(fun X Y => F.toFunctor.preimageIso
((asIso (F.ΞΌ _ _)).symm βͺβ« Ξ²_ (F.obj X) (F.obj Y) βͺβ« asIso (F.ΞΌ _ _)))
(by aesop_cat)
#align category_theory.braided_category_of_fully_faithful CategoryTheory.braidedCategoryOfFullyFaithful
section
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory C] [BraidedCategory C]
theorem braiding_leftUnitor_auxβ (X : C) :
(Ξ±_ (π_ C) (π_ C) X).hom β«
(π_ C β (Ξ²_ X (π_ C)).inv) β« (Ξ±_ _ X _).inv β« ((Ξ»_ X).hom β· _) =
((Ξ»_ _).hom β· X) β« (Ξ²_ X (π_ C)).inv := by
coherence
#align category_theory.braiding_left_unitor_auxβ CategoryTheory.braiding_leftUnitor_auxβ
theorem braiding_leftUnitor_auxβ (X : C) :
((Ξ²_ X (π_ C)).hom β· π_ C) β« ((Ξ»_ X).hom β· π_ C) = (Ο_ X).hom β· π_ C :=
calc
((Ξ²_ X (π_ C)).hom β· π_ C) β« ((Ξ»_ X).hom β· π_ C) =
((Ξ²_ X (π_ C)).hom β· π_ C) β« (Ξ±_ _ _ _).hom β« (Ξ±_ _ _ _).inv β« ((Ξ»_ X).hom β· π_ C) := by
coherence
_ = ((Ξ²_ X (π_ C)).hom β· π_ C) β« (Ξ±_ _ _ _).hom β« (_ β (Ξ²_ X _).hom) β«
(_ β (Ξ²_ X _).inv) β« (Ξ±_ _ _ _).inv β« ((Ξ»_ X).hom β· π_ C) := by
simp
_ = (Ξ±_ _ _ _).hom β« (Ξ²_ _ _).hom β« (Ξ±_ _ _ _).hom β« (_ β (Ξ²_ X _).inv) β« (Ξ±_ _ _ _).inv β«
((Ξ»_ X).hom β· π_ C) := by
(slice_lhs 1 3 => rw [β hexagon_forward]); simp only [assoc]
_ = (Ξ±_ _ _ _).hom β« (Ξ²_ _ _).hom β« ((Ξ»_ _).hom β· X) β« (Ξ²_ X _).inv := by
rw [braiding_leftUnitor_auxβ]
_ = (Ξ±_ _ _ _).hom β« (_ β (Ξ»_ _).hom) β« (Ξ²_ _ _).hom β« (Ξ²_ X _).inv := by
(slice_lhs 2 3 => rw [β braiding_naturality_right]); simp only [assoc]
_ = (Ξ±_ _ _ _).hom β« (_ β (Ξ»_ _).hom) := by rw [Iso.hom_inv_id, comp_id]
_ = (Ο_ X).hom β· π_ C := by rw [triangle]
#align category_theory.braiding_left_unitor_auxβ CategoryTheory.braiding_leftUnitor_auxβ
@[reassoc]
theorem braiding_leftUnitor (X : C) : (Ξ²_ X (π_ C)).hom β« (Ξ»_ X).hom = (Ο_ X).hom := by
rw [β whiskerRight_iff, comp_whiskerRight, braiding_leftUnitor_auxβ]
#align category_theory.braiding_left_unitor CategoryTheory.braiding_leftUnitor
theorem braiding_rightUnitor_auxβ (X : C) :
(Ξ±_ X (π_ C) (π_ C)).inv β«
((Ξ²_ (π_ C) X).inv β· π_ C) β« (Ξ±_ _ X _).hom β« (_ β (Ο_ X).hom) =
(X β (Ο_ _).hom) β« (Ξ²_ (π_ C) X).inv := by
coherence
#align category_theory.braiding_right_unitor_auxβ CategoryTheory.braiding_rightUnitor_auxβ
theorem braiding_rightUnitor_auxβ (X : C) :
(π_ C β (Ξ²_ (π_ C) X).hom) β« (π_ C β (Ο_ X).hom) = π_ C β (Ξ»_ X).hom :=
calc
(π_ C β (Ξ²_ (π_ C) X).hom) β« (π_ C β (Ο_ X).hom) =
(π_ C β (Ξ²_ (π_ C) X).hom) β« (Ξ±_ _ _ _).inv β« (Ξ±_ _ _ _).hom β« (π_ C β (Ο_ X).hom) := by
coherence
_ = (π_ C β (Ξ²_ (π_ C) X).hom) β« (Ξ±_ _ _ _).inv β« ((Ξ²_ _ X).hom β· _) β«
((Ξ²_ _ X).inv β· _) β« (Ξ±_ _ _ _).hom β« (π_ C β (Ο_ X).hom) := by
simp
_ = (Ξ±_ _ _ _).inv β« (Ξ²_ _ _).hom β« (Ξ±_ _ _ _).inv β« ((Ξ²_ _ X).inv β· _) β« (Ξ±_ _ _ _).hom β«
(π_ C β (Ο_ X).hom) := by
(slice_lhs 1 3 => rw [β hexagon_reverse]); simp only [assoc]
_ = (Ξ±_ _ _ _).inv β« (Ξ²_ _ _).hom β« (X β (Ο_ _).hom) β« (Ξ²_ _ X).inv := by
rw [braiding_rightUnitor_auxβ]
_ = (Ξ±_ _ _ _).inv β« ((Ο_ _).hom β· _) β« (Ξ²_ _ X).hom β« (Ξ²_ _ _).inv := by
(slice_lhs 2 3 => rw [β braiding_naturality_left]); simp only [assoc]
_ = (Ξ±_ _ _ _).inv β« ((Ο_ _).hom β· _) := by rw [Iso.hom_inv_id, comp_id]
_ = π_ C β (Ξ»_ X).hom := by rw [triangle_assoc_comp_right]
#align category_theory.braiding_right_unitor_auxβ CategoryTheory.braiding_rightUnitor_auxβ
@[reassoc]
theorem braiding_rightUnitor (X : C) : (Ξ²_ (π_ C) X).hom β« (Ο_ X).hom = (Ξ»_ X).hom := by
rw [β whiskerLeft_iff, MonoidalCategory.whiskerLeft_comp, braiding_rightUnitor_auxβ]
#align category_theory.braiding_right_unitor CategoryTheory.braiding_rightUnitor
@[reassoc, simp]
theorem braiding_tensorUnit_left (X : C) : (Ξ²_ (π_ C) X).hom = (Ξ»_ X).hom β« (Ο_ X).inv := by
simp [β braiding_rightUnitor]
@[reassoc, simp]
theorem braiding_inv_tensorUnit_left (X : C) : (Ξ²_ (π_ C) X).inv = (Ο_ X).hom β« (Ξ»_ X).inv := by
rw [Iso.inv_ext]
rw [braiding_tensorUnit_left]
coherence
@[reassoc]
theorem leftUnitor_inv_braiding (X : C) : (Ξ»_ X).inv β« (Ξ²_ (π_ C) X).hom = (Ο_ X).inv := by
simp
#align category_theory.left_unitor_inv_braiding CategoryTheory.leftUnitor_inv_braiding
@[reassoc]
theorem rightUnitor_inv_braiding (X : C) : (Ο_ X).inv β« (Ξ²_ X (π_ C)).hom = (Ξ»_ X).inv := by
apply (cancel_mono (Ξ»_ X).hom).1
simp only [assoc, braiding_leftUnitor, Iso.inv_hom_id]
#align category_theory.right_unitor_inv_braiding CategoryTheory.rightUnitor_inv_braiding
@[reassoc, simp]
| Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean | 353 | 354 | theorem braiding_tensorUnit_right (X : C) : (Ξ²_ X (π_ C)).hom = (Ο_ X).hom β« (Ξ»_ X).inv := by |
simp [β rightUnitor_inv_braiding]
|
import Mathlib.Topology.Algebra.Ring.Basic
import Mathlib.Topology.Algebra.MulAction
import Mathlib.Topology.Algebra.UniformGroup
import Mathlib.Topology.ContinuousFunction.Basic
import Mathlib.Topology.UniformSpace.UniformEmbedding
import Mathlib.Algebra.Algebra.Defs
import Mathlib.LinearAlgebra.Projection
import Mathlib.LinearAlgebra.Pi
import Mathlib.LinearAlgebra.Finsupp
#align_import topology.algebra.module.basic from "leanprover-community/mathlib"@"6285167a053ad0990fc88e56c48ccd9fae6550eb"
open LinearMap (ker range)
open Topology Filter Pointwise
universe u v w u'
section
variable {R : Type*} {M : Type*} [Ring R] [TopologicalSpace R] [TopologicalSpace M]
[AddCommGroup M] [Module R M]
theorem ContinuousSMul.of_nhds_zero [TopologicalRing R] [TopologicalAddGroup M]
(hmul : Tendsto (fun p : R Γ M => p.1 β’ p.2) (π 0 ΓΛ’ π 0) (π 0))
(hmulleft : β m : M, Tendsto (fun a : R => a β’ m) (π 0) (π 0))
(hmulright : β a : R, Tendsto (fun m : M => a β’ m) (π 0) (π 0)) : ContinuousSMul R M where
continuous_smul := by
refine continuous_of_continuousAt_zeroβ (AddMonoidHom.smul : R β+ M β+ M) ?_ ?_ ?_ <;>
simpa [ContinuousAt, nhds_prod_eq]
#align has_continuous_smul.of_nhds_zero ContinuousSMul.of_nhds_zero
end
section
variable {R : Type*} {M : Type*} [Ring R] [TopologicalSpace R] [TopologicalSpace M]
[AddCommGroup M] [ContinuousAdd M] [Module R M] [ContinuousSMul R M]
theorem Submodule.eq_top_of_nonempty_interior' [NeBot (π[{ x : R | IsUnit x }] 0)]
(s : Submodule R M) (hs : (interior (s : Set M)).Nonempty) : s = β€ := by
rcases hs with β¨y, hyβ©
refine Submodule.eq_top_iff'.2 fun x => ?_
rw [mem_interior_iff_mem_nhds] at hy
have : Tendsto (fun c : R => y + c β’ x) (π[{ x : R | IsUnit x }] 0) (π (y + (0 : R) β’ x)) :=
tendsto_const_nhds.add ((tendsto_nhdsWithin_of_tendsto_nhds tendsto_id).smul tendsto_const_nhds)
rw [zero_smul, add_zero] at this
obtain β¨_, hu : y + _ β’ _ β s, u, rflβ© :=
nonempty_of_mem (inter_mem (Filter.mem_map.1 (this hy)) self_mem_nhdsWithin)
have hy' : y β βs := mem_of_mem_nhds hy
rwa [s.add_mem_iff_right hy', β Units.smul_def, s.smul_mem_iff' u] at hu
#align submodule.eq_top_of_nonempty_interior' Submodule.eq_top_of_nonempty_interior'
variable (R M)
theorem Module.punctured_nhds_neBot [Nontrivial M] [NeBot (π[β ] (0 : R))] [NoZeroSMulDivisors R M]
(x : M) : NeBot (π[β ] x) := by
rcases exists_ne (0 : M) with β¨y, hyβ©
suffices Tendsto (fun c : R => x + c β’ y) (π[β ] 0) (π[β ] x) from this.neBot
refine Tendsto.inf ?_ (tendsto_principal_principal.2 <| ?_)
Β· convert tendsto_const_nhds.add ((@tendsto_id R _).smul_const y)
rw [zero_smul, add_zero]
Β· intro c hc
simpa [hy] using hc
#align module.punctured_nhds_ne_bot Module.punctured_nhds_neBot
end
lemma TopologicalSpace.IsSeparable.span {R M : Type*} [AddCommMonoid M] [Semiring R] [Module R M]
[TopologicalSpace M] [TopologicalSpace R] [SeparableSpace R]
[ContinuousAdd M] [ContinuousSMul R M] {s : Set M} (hs : IsSeparable s) :
IsSeparable (Submodule.span R s : Set M) := by
rw [span_eq_iUnion_nat]
refine .iUnion fun n β¦ .image ?_ ?_
Β· have : IsSeparable {f : Fin n β R Γ M | β (i : Fin n), f i β Set.univ ΓΛ’ s} := by
apply isSeparable_pi (fun i β¦ .prod (.of_separableSpace Set.univ) hs)
rwa [Set.univ_prod] at this
Β· apply continuous_finset_sum _ (fun i _ β¦ ?_)
exact (continuous_fst.comp (continuous_apply i)).smul (continuous_snd.comp (continuous_apply i))
section Pi
| Mathlib/Topology/Algebra/Module/Basic.lean | 222 | 234 | theorem LinearMap.continuous_on_pi {ΞΉ : Type*} {R : Type*} {M : Type*} [Finite ΞΉ] [Semiring R]
[TopologicalSpace R] [AddCommMonoid M] [Module R M] [TopologicalSpace M] [ContinuousAdd M]
[ContinuousSMul R M] (f : (ΞΉ β R) ββ[R] M) : Continuous f := by |
cases nonempty_fintype ΞΉ
classical
-- for the proof, write `f` in the standard basis, and use that each coordinate is a continuous
-- function.
have : (f : (ΞΉ β R) β M) = fun x => β i : ΞΉ, x i β’ f fun j => if i = j then 1 else 0 := by
ext x
exact f.pi_apply_eq_sum_univ x
rw [this]
refine continuous_finset_sum _ fun i _ => ?_
exact (continuous_apply i).smul continuous_const
|
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
#align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
set_option linter.uppercaseLean3 false
noncomputable section
open Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v w y
variable {R : Type u} {S : Type v} {T : Type w} {ΞΉ : Type y} {a b : R} {m n : β}
section Semiring
variable [Semiring R] {p q r : R[X]}
section
variable [Semiring S]
variable (f : R β+* S) (x : S)
irreducible_def evalβ (p : R[X]) : S :=
p.sum fun e a => f a * x ^ e
#align polynomial.evalβ Polynomial.evalβ
theorem evalβ_eq_sum {f : R β+* S} {x : S} : p.evalβ f x = p.sum fun e a => f a * x ^ e := by
rw [evalβ_def]
#align polynomial.evalβ_eq_sum Polynomial.evalβ_eq_sum
theorem evalβ_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R β+* S} {s t : S}
{Ο Ο : R[X]} : f = g β s = t β Ο = Ο β evalβ f s Ο = evalβ g t Ο := by
rintro rfl rfl rfl; rfl
#align polynomial.evalβ_congr Polynomial.evalβ_congr
@[simp]
theorem evalβ_at_zero : p.evalβ f 0 = f (coeff p 0) := by
simp (config := { contextual := true }) only [evalβ_eq_sum, zero_pow_eq, mul_ite, mul_zero,
mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff,
RingHom.map_zero, imp_true_iff, eq_self_iff_true]
#align polynomial.evalβ_at_zero Polynomial.evalβ_at_zero
@[simp]
theorem evalβ_zero : (0 : R[X]).evalβ f x = 0 := by simp [evalβ_eq_sum]
#align polynomial.evalβ_zero Polynomial.evalβ_zero
@[simp]
theorem evalβ_C : (C a).evalβ f x = f a := by simp [evalβ_eq_sum]
#align polynomial.evalβ_C Polynomial.evalβ_C
@[simp]
theorem evalβ_X : X.evalβ f x = x := by simp [evalβ_eq_sum]
#align polynomial.evalβ_X Polynomial.evalβ_X
@[simp]
theorem evalβ_monomial {n : β} {r : R} : (monomial n r).evalβ f x = f r * x ^ n := by
simp [evalβ_eq_sum]
#align polynomial.evalβ_monomial Polynomial.evalβ_monomial
@[simp]
theorem evalβ_X_pow {n : β} : (X ^ n).evalβ f x = x ^ n := by
rw [X_pow_eq_monomial]
convert evalβ_monomial f x (n := n) (r := 1)
simp
#align polynomial.evalβ_X_pow Polynomial.evalβ_X_pow
@[simp]
theorem evalβ_add : (p + q).evalβ f x = p.evalβ f x + q.evalβ f x := by
simp only [evalβ_eq_sum]
apply sum_add_index <;> simp [add_mul]
#align polynomial.evalβ_add Polynomial.evalβ_add
@[simp]
theorem evalβ_one : (1 : R[X]).evalβ f x = 1 := by rw [β C_1, evalβ_C, f.map_one]
#align polynomial.evalβ_one Polynomial.evalβ_one
set_option linter.deprecated false in
@[simp]
theorem evalβ_bit0 : (bit0 p).evalβ f x = bit0 (p.evalβ f x) := by rw [bit0, evalβ_add, bit0]
#align polynomial.evalβ_bit0 Polynomial.evalβ_bit0
set_option linter.deprecated false in
@[simp]
theorem evalβ_bit1 : (bit1 p).evalβ f x = bit1 (p.evalβ f x) := by
rw [bit1, evalβ_add, evalβ_bit0, evalβ_one, bit1]
#align polynomial.evalβ_bit1 Polynomial.evalβ_bit1
@[simp]
theorem evalβ_smul (g : R β+* S) (p : R[X]) (x : S) {s : R} :
evalβ g x (s β’ p) = g s * evalβ g x p := by
have A : p.natDegree < p.natDegree.succ := Nat.lt_succ_self _
have B : (s β’ p).natDegree < p.natDegree.succ := (natDegree_smul_le _ _).trans_lt A
rw [evalβ_eq_sum, evalβ_eq_sum, sum_over_range' _ _ _ A, sum_over_range' _ _ _ B] <;>
simp [mul_sum, mul_assoc]
#align polynomial.evalβ_smul Polynomial.evalβ_smul
@[simp]
theorem evalβ_C_X : evalβ C X p = p :=
Polynomial.induction_on' p (fun p q hp hq => by simp [hp, hq]) fun n x => by
rw [evalβ_monomial, β smul_X_eq_monomial, C_mul']
#align polynomial.evalβ_C_X Polynomial.evalβ_C_X
@[simps]
def evalβAddMonoidHom : R[X] β+ S where
toFun := evalβ f x
map_zero' := evalβ_zero _ _
map_add' _ _ := evalβ_add _ _
#align polynomial.evalβ_add_monoid_hom Polynomial.evalβAddMonoidHom
#align polynomial.evalβ_add_monoid_hom_apply Polynomial.evalβAddMonoidHom_apply
@[simp]
theorem evalβ_natCast (n : β) : (n : R[X]).evalβ f x = n := by
induction' n with n ih
-- Porting note: `Nat.zero_eq` is required.
Β· simp only [evalβ_zero, Nat.cast_zero, Nat.zero_eq]
Β· rw [n.cast_succ, evalβ_add, ih, evalβ_one, n.cast_succ]
#align polynomial.evalβ_nat_cast Polynomial.evalβ_natCast
@[deprecated (since := "2024-04-17")]
alias evalβ_nat_cast := evalβ_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
lemma evalβ_ofNat {S : Type*} [Semiring S] (n : β) [n.AtLeastTwo] (f : R β+* S) (a : S) :
(no_index (OfNat.ofNat n : R[X])).evalβ f a = OfNat.ofNat n := by
simp [OfNat.ofNat]
variable [Semiring T]
theorem evalβ_sum (p : T[X]) (g : β β T β R[X]) (x : S) :
(p.sum g).evalβ f x = p.sum fun n a => (g n a).evalβ f x := by
let T : R[X] β+ S :=
{ toFun := evalβ f x
map_zero' := evalβ_zero _ _
map_add' := fun p q => evalβ_add _ _ }
have A : β y, evalβ f x y = T y := fun y => rfl
simp only [A]
rw [sum, map_sum, sum]
#align polynomial.evalβ_sum Polynomial.evalβ_sum
theorem evalβ_list_sum (l : List R[X]) (x : S) : evalβ f x l.sum = (l.map (evalβ f x)).sum :=
map_list_sum (evalβAddMonoidHom f x) l
#align polynomial.evalβ_list_sum Polynomial.evalβ_list_sum
theorem evalβ_multiset_sum (s : Multiset R[X]) (x : S) :
evalβ f x s.sum = (s.map (evalβ f x)).sum :=
map_multiset_sum (evalβAddMonoidHom f x) s
#align polynomial.evalβ_multiset_sum Polynomial.evalβ_multiset_sum
theorem evalβ_finset_sum (s : Finset ΞΉ) (g : ΞΉ β R[X]) (x : S) :
(β i β s, g i).evalβ f x = β i β s, (g i).evalβ f x :=
map_sum (evalβAddMonoidHom f x) _ _
#align polynomial.evalβ_finset_sum Polynomial.evalβ_finset_sum
theorem evalβ_ofFinsupp {f : R β+* S} {x : S} {p : R[β]} :
evalβ f x (β¨pβ© : R[X]) = liftNC (βf) (powersHom S x) p := by
simp only [evalβ_eq_sum, sum, toFinsupp_sum, support, coeff]
rfl
#align polynomial.evalβ_of_finsupp Polynomial.evalβ_ofFinsupp
theorem evalβ_mul_noncomm (hf : β k, Commute (f <| q.coeff k) x) :
evalβ f x (p * q) = evalβ f x p * evalβ f x q := by
rcases p with β¨pβ©; rcases q with β¨qβ©
simp only [coeff] at hf
simp only [β ofFinsupp_mul, evalβ_ofFinsupp]
exact liftNC_mul _ _ p q fun {k n} _hn => (hf k).pow_right n
#align polynomial.evalβ_mul_noncomm Polynomial.evalβ_mul_noncomm
@[simp]
theorem evalβ_mul_X : evalβ f x (p * X) = evalβ f x p * x := by
refine _root_.trans (evalβ_mul_noncomm _ _ fun k => ?_) (by rw [evalβ_X])
rcases em (k = 1) with (rfl | hk)
Β· simp
Β· simp [coeff_X_of_ne_one hk]
#align polynomial.evalβ_mul_X Polynomial.evalβ_mul_X
@[simp]
theorem evalβ_X_mul : evalβ f x (X * p) = evalβ f x p * x := by rw [X_mul, evalβ_mul_X]
#align polynomial.evalβ_X_mul Polynomial.evalβ_X_mul
theorem evalβ_mul_C' (h : Commute (f a) x) : evalβ f x (p * C a) = evalβ f x p * f a := by
rw [evalβ_mul_noncomm, evalβ_C]
intro k
by_cases hk : k = 0
Β· simp only [hk, h, coeff_C_zero, coeff_C_ne_zero]
Β· simp only [coeff_C_ne_zero hk, RingHom.map_zero, Commute.zero_left]
#align polynomial.evalβ_mul_C' Polynomial.evalβ_mul_C'
theorem evalβ_list_prod_noncomm (ps : List R[X])
(hf : β p β ps, β (k), Commute (f <| coeff p k) x) :
evalβ f x ps.prod = (ps.map (Polynomial.evalβ f x)).prod := by
induction' ps using List.reverseRecOn with ps p ihp
Β· simp
Β· simp only [List.forall_mem_append, List.forall_mem_singleton] at hf
simp [evalβ_mul_noncomm _ _ hf.2, ihp hf.1]
#align polynomial.evalβ_list_prod_noncomm Polynomial.evalβ_list_prod_noncomm
@[simps]
def evalβRingHom' (f : R β+* S) (x : S) (hf : β a, Commute (f a) x) : R[X] β+* S where
toFun := evalβ f x
map_add' _ _ := evalβ_add _ _
map_zero' := evalβ_zero _ _
map_mul' _p q := evalβ_mul_noncomm f x fun k => hf <| coeff q k
map_one' := evalβ_one _ _
#align polynomial.evalβ_ring_hom' Polynomial.evalβRingHom'
end
section Eval
variable {x : R}
def eval : R β R[X] β R :=
evalβ (RingHom.id _)
#align polynomial.eval Polynomial.eval
theorem eval_eq_sum : p.eval x = p.sum fun e a => a * x ^ e := by
rw [eval, evalβ_eq_sum]
rfl
#align polynomial.eval_eq_sum Polynomial.eval_eq_sum
theorem eval_eq_sum_range {p : R[X]} (x : R) :
p.eval x = β i β Finset.range (p.natDegree + 1), p.coeff i * x ^ i := by
rw [eval_eq_sum, sum_over_range]; simp
#align polynomial.eval_eq_sum_range Polynomial.eval_eq_sum_range
theorem eval_eq_sum_range' {p : R[X]} {n : β} (hn : p.natDegree < n) (x : R) :
p.eval x = β i β Finset.range n, p.coeff i * x ^ i := by
rw [eval_eq_sum, p.sum_over_range' _ _ hn]; simp
#align polynomial.eval_eq_sum_range' Polynomial.eval_eq_sum_range'
@[simp]
theorem evalβ_at_apply {S : Type*} [Semiring S] (f : R β+* S) (r : R) :
p.evalβ f (f r) = f (p.eval r) := by
rw [evalβ_eq_sum, eval_eq_sum, sum, sum, map_sum f]
simp only [f.map_mul, f.map_pow]
#align polynomial.evalβ_at_apply Polynomial.evalβ_at_apply
@[simp]
theorem evalβ_at_one {S : Type*} [Semiring S] (f : R β+* S) : p.evalβ f 1 = f (p.eval 1) := by
convert evalβ_at_apply (p := p) f 1
simp
#align polynomial.evalβ_at_one Polynomial.evalβ_at_one
@[simp]
theorem evalβ_at_natCast {S : Type*} [Semiring S] (f : R β+* S) (n : β) :
p.evalβ f n = f (p.eval n) := by
convert evalβ_at_apply (p := p) f n
simp
#align polynomial.evalβ_at_nat_cast Polynomial.evalβ_at_natCast
@[deprecated (since := "2024-04-17")]
alias evalβ_at_nat_cast := evalβ_at_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
theorem evalβ_at_ofNat {S : Type*} [Semiring S] (f : R β+* S) (n : β) [n.AtLeastTwo] :
p.evalβ f (no_index (OfNat.ofNat n)) = f (p.eval (OfNat.ofNat n)) := by
simp [OfNat.ofNat]
@[simp]
theorem eval_C : (C a).eval x = a :=
evalβ_C _ _
#align polynomial.eval_C Polynomial.eval_C
@[simp]
theorem eval_natCast {n : β} : (n : R[X]).eval x = n := by simp only [β C_eq_natCast, eval_C]
#align polynomial.eval_nat_cast Polynomial.eval_natCast
@[deprecated (since := "2024-04-17")]
alias eval_nat_cast := eval_natCast
-- See note [no_index around OfNat.ofNat]
@[simp]
lemma eval_ofNat (n : β) [n.AtLeastTwo] (a : R) :
(no_index (OfNat.ofNat n : R[X])).eval a = OfNat.ofNat n := by
simp only [OfNat.ofNat, eval_natCast]
@[simp]
theorem eval_X : X.eval x = x :=
evalβ_X _ _
#align polynomial.eval_X Polynomial.eval_X
@[simp]
theorem eval_monomial {n a} : (monomial n a).eval x = a * x ^ n :=
evalβ_monomial _ _
#align polynomial.eval_monomial Polynomial.eval_monomial
@[simp]
theorem eval_zero : (0 : R[X]).eval x = 0 :=
evalβ_zero _ _
#align polynomial.eval_zero Polynomial.eval_zero
@[simp]
theorem eval_add : (p + q).eval x = p.eval x + q.eval x :=
evalβ_add _ _
#align polynomial.eval_add Polynomial.eval_add
@[simp]
theorem eval_one : (1 : R[X]).eval x = 1 :=
evalβ_one _ _
#align polynomial.eval_one Polynomial.eval_one
set_option linter.deprecated false in
@[simp]
theorem eval_bit0 : (bit0 p).eval x = bit0 (p.eval x) :=
evalβ_bit0 _ _
#align polynomial.eval_bit0 Polynomial.eval_bit0
set_option linter.deprecated false in
@[simp]
theorem eval_bit1 : (bit1 p).eval x = bit1 (p.eval x) :=
evalβ_bit1 _ _
#align polynomial.eval_bit1 Polynomial.eval_bit1
@[simp]
theorem eval_smul [Monoid S] [DistribMulAction S R] [IsScalarTower S R R] (s : S) (p : R[X])
(x : R) : (s β’ p).eval x = s β’ p.eval x := by
rw [β smul_one_smul R s p, eval, evalβ_smul, RingHom.id_apply, smul_one_mul]
#align polynomial.eval_smul Polynomial.eval_smul
@[simp]
theorem eval_C_mul : (C a * p).eval x = a * p.eval x := by
induction p using Polynomial.induction_on' with
| h_add p q ph qh =>
simp only [mul_add, eval_add, ph, qh]
| h_monomial n b =>
simp only [mul_assoc, C_mul_monomial, eval_monomial]
#align polynomial.eval_C_mul Polynomial.eval_C_mul
theorem eval_monomial_one_add_sub [CommRing S] (d : β) (y : S) :
eval (1 + y) (monomial d (d + 1 : S)) - eval y (monomial d (d + 1 : S)) =
β x_1 β range (d + 1), β((d + 1).choose x_1) * (βx_1 * y ^ (x_1 - 1)) := by
have cast_succ : (d + 1 : S) = ((d.succ : β) : S) := by simp only [Nat.cast_succ]
rw [cast_succ, eval_monomial, eval_monomial, add_comm, add_pow]
-- Porting note: `apply_congr` hadn't been ported yet, so `congr` & `ext` is used.
conv_lhs =>
congr
Β· congr
Β· skip
Β· congr
Β· skip
Β· ext
rw [one_pow, mul_one, mul_comm]
rw [sum_range_succ, mul_add, Nat.choose_self, Nat.cast_one, one_mul, add_sub_cancel_right,
mul_sum, sum_range_succ', Nat.cast_zero, zero_mul, mul_zero, add_zero]
refine sum_congr rfl fun y _hy => ?_
rw [β mul_assoc, β mul_assoc, β Nat.cast_mul, Nat.succ_mul_choose_eq, Nat.cast_mul,
Nat.add_sub_cancel]
#align polynomial.eval_monomial_one_add_sub Polynomial.eval_monomial_one_add_sub
@[simps]
def leval {R : Type*} [Semiring R] (r : R) : R[X] ββ[R] R where
toFun f := f.eval r
map_add' _f _g := eval_add
map_smul' c f := eval_smul c f r
#align polynomial.leval Polynomial.leval
#align polynomial.leval_apply Polynomial.leval_apply
@[simp]
theorem eval_natCast_mul {n : β} : ((n : R[X]) * p).eval x = n * p.eval x := by
rw [β C_eq_natCast, eval_C_mul]
#align polynomial.eval_nat_cast_mul Polynomial.eval_natCast_mul
@[deprecated (since := "2024-04-17")]
alias eval_nat_cast_mul := eval_natCast_mul
@[simp]
theorem eval_mul_X : (p * X).eval x = p.eval x * x := by
induction p using Polynomial.induction_on' with
| h_add p q ph qh =>
simp only [add_mul, eval_add, ph, qh]
| h_monomial n a =>
simp only [β monomial_one_one_eq_X, monomial_mul_monomial, eval_monomial, mul_one, pow_succ,
mul_assoc]
#align polynomial.eval_mul_X Polynomial.eval_mul_X
@[simp]
theorem eval_mul_X_pow {k : β} : (p * X ^ k).eval x = p.eval x * x ^ k := by
induction' k with k ih
Β· simp
Β· simp [pow_succ, β mul_assoc, ih]
#align polynomial.eval_mul_X_pow Polynomial.eval_mul_X_pow
theorem eval_sum (p : R[X]) (f : β β R β R[X]) (x : R) :
(p.sum f).eval x = p.sum fun n a => (f n a).eval x :=
evalβ_sum _ _ _ _
#align polynomial.eval_sum Polynomial.eval_sum
theorem eval_finset_sum (s : Finset ΞΉ) (g : ΞΉ β R[X]) (x : R) :
(β i β s, g i).eval x = β i β s, (g i).eval x :=
evalβ_finset_sum _ _ _ _
#align polynomial.eval_finset_sum Polynomial.eval_finset_sum
def IsRoot (p : R[X]) (a : R) : Prop :=
p.eval a = 0
#align polynomial.is_root Polynomial.IsRoot
instance IsRoot.decidable [DecidableEq R] : Decidable (IsRoot p a) := by
unfold IsRoot; infer_instance
#align polynomial.is_root.decidable Polynomial.IsRoot.decidable
@[simp]
theorem IsRoot.def : IsRoot p a β p.eval a = 0 :=
Iff.rfl
#align polynomial.is_root.def Polynomial.IsRoot.def
theorem IsRoot.eq_zero (h : IsRoot p x) : eval x p = 0 :=
h
#align polynomial.is_root.eq_zero Polynomial.IsRoot.eq_zero
| Mathlib/Algebra/Polynomial/Eval.lean | 522 | 528 | theorem coeff_zero_eq_eval_zero (p : R[X]) : coeff p 0 = p.eval 0 :=
calc
coeff p 0 = coeff p 0 * 0 ^ 0 := by | simp
_ = p.eval 0 := by
symm
rw [eval_eq_sum]
exact Finset.sum_eq_single _ (fun b _ hb => by simp [zero_pow hb]) (by simp)
|
import Mathlib.Analysis.NormedSpace.AddTorsorBases
#align_import analysis.convex.intrinsic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open AffineSubspace Set
open scoped Pointwise
variable {π V W Q P : Type*}
section AddTorsor
variable (π) [Ring π] [AddCommGroup V] [Module π V] [TopologicalSpace P] [AddTorsor V P]
{s t : Set P} {x : P}
def intrinsicInterior (s : Set P) : Set P :=
(β) '' interior ((β) β»ΒΉ' s : Set <| affineSpan π s)
#align intrinsic_interior intrinsicInterior
def intrinsicFrontier (s : Set P) : Set P :=
(β) '' frontier ((β) β»ΒΉ' s : Set <| affineSpan π s)
#align intrinsic_frontier intrinsicFrontier
def intrinsicClosure (s : Set P) : Set P :=
(β) '' closure ((β) β»ΒΉ' s : Set <| affineSpan π s)
#align intrinsic_closure intrinsicClosure
variable {π}
@[simp]
theorem mem_intrinsicInterior :
x β intrinsicInterior π s β β y, y β interior ((β) β»ΒΉ' s : Set <| affineSpan π s) β§ βy = x :=
mem_image _ _ _
#align mem_intrinsic_interior mem_intrinsicInterior
@[simp]
theorem mem_intrinsicFrontier :
x β intrinsicFrontier π s β β y, y β frontier ((β) β»ΒΉ' s : Set <| affineSpan π s) β§ βy = x :=
mem_image _ _ _
#align mem_intrinsic_frontier mem_intrinsicFrontier
@[simp]
theorem mem_intrinsicClosure :
x β intrinsicClosure π s β β y, y β closure ((β) β»ΒΉ' s : Set <| affineSpan π s) β§ βy = x :=
mem_image _ _ _
#align mem_intrinsic_closure mem_intrinsicClosure
theorem intrinsicInterior_subset : intrinsicInterior π s β s :=
image_subset_iff.2 interior_subset
#align intrinsic_interior_subset intrinsicInterior_subset
theorem intrinsicFrontier_subset (hs : IsClosed s) : intrinsicFrontier π s β s :=
image_subset_iff.2 (hs.preimage continuous_induced_dom).frontier_subset
#align intrinsic_frontier_subset intrinsicFrontier_subset
theorem intrinsicFrontier_subset_intrinsicClosure : intrinsicFrontier π s β intrinsicClosure π s :=
image_subset _ frontier_subset_closure
#align intrinsic_frontier_subset_intrinsic_closure intrinsicFrontier_subset_intrinsicClosure
theorem subset_intrinsicClosure : s β intrinsicClosure π s :=
fun x hx => β¨β¨x, subset_affineSpan _ _ hxβ©, subset_closure hx, rflβ©
#align subset_intrinsic_closure subset_intrinsicClosure
@[simp]
theorem intrinsicInterior_empty : intrinsicInterior π (β
: Set P) = β
:= by simp [intrinsicInterior]
#align intrinsic_interior_empty intrinsicInterior_empty
@[simp]
theorem intrinsicFrontier_empty : intrinsicFrontier π (β
: Set P) = β
:= by simp [intrinsicFrontier]
#align intrinsic_frontier_empty intrinsicFrontier_empty
@[simp]
theorem intrinsicClosure_empty : intrinsicClosure π (β
: Set P) = β
:= by simp [intrinsicClosure]
#align intrinsic_closure_empty intrinsicClosure_empty
@[simp]
theorem intrinsicClosure_nonempty : (intrinsicClosure π s).Nonempty β s.Nonempty :=
β¨by simp_rw [nonempty_iff_ne_empty]; rintro h rfl; exact h intrinsicClosure_empty,
Nonempty.mono subset_intrinsicClosureβ©
#align intrinsic_closure_nonempty intrinsicClosure_nonempty
alias β¨Set.Nonempty.ofIntrinsicClosure, Set.Nonempty.intrinsicClosureβ© := intrinsicClosure_nonempty
#align set.nonempty.of_intrinsic_closure Set.Nonempty.ofIntrinsicClosure
#align set.nonempty.intrinsic_closure Set.Nonempty.intrinsicClosure
--attribute [protected] Set.Nonempty.intrinsicClosure -- Porting note: removed
@[simp]
theorem intrinsicInterior_singleton (x : P) : intrinsicInterior π ({x} : Set P) = {x} := by
simpa only [intrinsicInterior, preimage_coe_affineSpan_singleton, interior_univ, image_univ,
Subtype.range_coe] using coe_affineSpan_singleton _ _ _
#align intrinsic_interior_singleton intrinsicInterior_singleton
@[simp]
theorem intrinsicFrontier_singleton (x : P) : intrinsicFrontier π ({x} : Set P) = β
:= by
rw [intrinsicFrontier, preimage_coe_affineSpan_singleton, frontier_univ, image_empty]
#align intrinsic_frontier_singleton intrinsicFrontier_singleton
@[simp]
| Mathlib/Analysis/Convex/Intrinsic.lean | 147 | 149 | theorem intrinsicClosure_singleton (x : P) : intrinsicClosure π ({x} : Set P) = {x} := by |
simpa only [intrinsicClosure, preimage_coe_affineSpan_singleton, closure_univ, image_univ,
Subtype.range_coe] using coe_affineSpan_singleton _ _ _
|
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.RingTheory.Localization.FractionRing
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β}
section CommRing
variable [CommRing R] [IsDomain R] {p q : R[X]}
section Roots
open Multiset Finset
noncomputable def roots (p : R[X]) : Multiset R :=
haveI := Classical.decEq R
haveI := Classical.dec (p = 0)
if h : p = 0 then β
else Classical.choose (exists_multiset_roots h)
#align polynomial.roots Polynomial.roots
theorem roots_def [DecidableEq R] (p : R[X]) [Decidable (p = 0)] :
p.roots = if h : p = 0 then β
else Classical.choose (exists_multiset_roots h) := by
-- porting noteL `βΉ_βΊ` doesn't work for instance arguments
rename_i iR ip0
obtain rfl := Subsingleton.elim iR (Classical.decEq R)
obtain rfl := Subsingleton.elim ip0 (Classical.dec (p = 0))
rfl
#align polynomial.roots_def Polynomial.roots_def
@[simp]
theorem roots_zero : (0 : R[X]).roots = 0 :=
dif_pos rfl
#align polynomial.roots_zero Polynomial.roots_zero
theorem card_roots (hp0 : p β 0) : (Multiset.card (roots p) : WithBot β) β€ degree p := by
classical
unfold roots
rw [dif_neg hp0]
exact (Classical.choose_spec (exists_multiset_roots hp0)).1
#align polynomial.card_roots Polynomial.card_roots
theorem card_roots' (p : R[X]) : Multiset.card p.roots β€ natDegree p := by
by_cases hp0 : p = 0
Β· simp [hp0]
exact WithBot.coe_le_coe.1 (le_trans (card_roots hp0) (le_of_eq <| degree_eq_natDegree hp0))
#align polynomial.card_roots' Polynomial.card_roots'
theorem card_roots_sub_C {p : R[X]} {a : R} (hp0 : 0 < degree p) :
(Multiset.card (p - C a).roots : WithBot β) β€ degree p :=
calc
(Multiset.card (p - C a).roots : WithBot β) β€ degree (p - C a) :=
card_roots <| mt sub_eq_zero.1 fun h => not_le_of_gt hp0 <| h.symm βΈ degree_C_le
_ = degree p := by rw [sub_eq_add_neg, β C_neg]; exact degree_add_C hp0
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C Polynomial.card_roots_sub_C
theorem card_roots_sub_C' {p : R[X]} {a : R} (hp0 : 0 < degree p) :
Multiset.card (p - C a).roots β€ natDegree p :=
WithBot.coe_le_coe.1
(le_trans (card_roots_sub_C hp0)
(le_of_eq <| degree_eq_natDegree fun h => by simp_all [lt_irrefl]))
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C' Polynomial.card_roots_sub_C'
@[simp]
theorem count_roots [DecidableEq R] (p : R[X]) : p.roots.count a = rootMultiplicity a p := by
classical
by_cases hp : p = 0
Β· simp [hp]
rw [roots_def, dif_neg hp]
exact (Classical.choose_spec (exists_multiset_roots hp)).2 a
#align polynomial.count_roots Polynomial.count_roots
@[simp]
theorem mem_roots' : a β p.roots β p β 0 β§ IsRoot p a := by
classical
rw [β count_pos, count_roots p, rootMultiplicity_pos']
#align polynomial.mem_roots' Polynomial.mem_roots'
theorem mem_roots (hp : p β 0) : a β p.roots β IsRoot p a :=
mem_roots'.trans <| and_iff_right hp
#align polynomial.mem_roots Polynomial.mem_roots
theorem ne_zero_of_mem_roots (h : a β p.roots) : p β 0 :=
(mem_roots'.1 h).1
#align polynomial.ne_zero_of_mem_roots Polynomial.ne_zero_of_mem_roots
theorem isRoot_of_mem_roots (h : a β p.roots) : IsRoot p a :=
(mem_roots'.1 h).2
#align polynomial.is_root_of_mem_roots Polynomial.isRoot_of_mem_roots
-- Porting note: added during port.
lemma mem_roots_iff_aeval_eq_zero {x : R} (w : p β 0) : x β roots p β aeval x p = 0 := by
rw [mem_roots w, IsRoot.def, aeval_def, evalβ_eq_eval_map]
simp
theorem card_le_degree_of_subset_roots {p : R[X]} {Z : Finset R} (h : Z.val β p.roots) :
Z.card β€ p.natDegree :=
(Multiset.card_le_card (Finset.val_le_iff_val_subset.2 h)).trans (Polynomial.card_roots' p)
#align polynomial.card_le_degree_of_subset_roots Polynomial.card_le_degree_of_subset_roots
theorem finite_setOf_isRoot {p : R[X]} (hp : p β 0) : Set.Finite { x | IsRoot p x } := by
classical
simpa only [β Finset.setOf_mem, Multiset.mem_toFinset, mem_roots hp]
using p.roots.toFinset.finite_toSet
#align polynomial.finite_set_of_is_root Polynomial.finite_setOf_isRoot
theorem eq_zero_of_infinite_isRoot (p : R[X]) (h : Set.Infinite { x | IsRoot p x }) : p = 0 :=
not_imp_comm.mp finite_setOf_isRoot h
#align polynomial.eq_zero_of_infinite_is_root Polynomial.eq_zero_of_infinite_isRoot
theorem exists_max_root [LinearOrder R] (p : R[X]) (hp : p β 0) : β xβ, β x, p.IsRoot x β x β€ xβ :=
Set.exists_upper_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_max_root Polynomial.exists_max_root
theorem exists_min_root [LinearOrder R] (p : R[X]) (hp : p β 0) : β xβ, β x, p.IsRoot x β xβ β€ x :=
Set.exists_lower_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_min_root Polynomial.exists_min_root
theorem eq_of_infinite_eval_eq (p q : R[X]) (h : Set.Infinite { x | eval x p = eval x q }) :
p = q := by
rw [β sub_eq_zero]
apply eq_zero_of_infinite_isRoot
simpa only [IsRoot, eval_sub, sub_eq_zero]
#align polynomial.eq_of_infinite_eval_eq Polynomial.eq_of_infinite_eval_eq
theorem roots_mul {p q : R[X]} (hpq : p * q β 0) : (p * q).roots = p.roots + q.roots := by
classical
exact Multiset.ext.mpr fun r => by
rw [count_add, count_roots, count_roots, count_roots, rootMultiplicity_mul hpq]
#align polynomial.roots_mul Polynomial.roots_mul
theorem roots.le_of_dvd (h : q β 0) : p β£ q β roots p β€ roots q := by
rintro β¨k, rflβ©
exact Multiset.le_iff_exists_add.mpr β¨k.roots, roots_mul hβ©
#align polynomial.roots.le_of_dvd Polynomial.roots.le_of_dvd
theorem mem_roots_sub_C' {p : R[X]} {a x : R} : x β (p - C a).roots β p β C a β§ p.eval x = a := by
rw [mem_roots', IsRoot.def, sub_ne_zero, eval_sub, sub_eq_zero, eval_C]
set_option linter.uppercaseLean3 false in
#align polynomial.mem_roots_sub_C' Polynomial.mem_roots_sub_C'
theorem mem_roots_sub_C {p : R[X]} {a x : R} (hp0 : 0 < degree p) :
x β (p - C a).roots β p.eval x = a :=
mem_roots_sub_C'.trans <| and_iff_right fun hp => hp0.not_le <| hp.symm βΈ degree_C_le
set_option linter.uppercaseLean3 false in
#align polynomial.mem_roots_sub_C Polynomial.mem_roots_sub_C
@[simp]
theorem roots_X_sub_C (r : R) : roots (X - C r) = {r} := by
classical
ext s
rw [count_roots, rootMultiplicity_X_sub_C, count_singleton]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_X_sub_C Polynomial.roots_X_sub_C
@[simp]
theorem roots_X : roots (X : R[X]) = {0} := by rw [β roots_X_sub_C, C_0, sub_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.roots_X Polynomial.roots_X
@[simp]
| Mathlib/Algebra/Polynomial/Roots.lean | 197 | 202 | theorem roots_C (x : R) : (C x).roots = 0 := by |
classical exact
if H : x = 0 then by rw [H, C_0, roots_zero]
else
Multiset.ext.mpr fun r => (by
rw [count_roots, count_zero, rootMultiplicity_eq_zero (not_isRoot_C _ _ H)])
|
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.Probability.Kernel.Disintegration.CdfToKernel
#align_import probability.kernel.cond_cdf from "leanprover-community/mathlib"@"3b88f4005dc2e28d42f974cc1ce838f0dafb39b8"
open MeasureTheory Set Filter TopologicalSpace
open scoped NNReal ENNReal MeasureTheory Topology
namespace MeasureTheory.Measure
variable {Ξ± Ξ² : Type*} {mΞ± : MeasurableSpace Ξ±} (Ο : Measure (Ξ± Γ β))
noncomputable def IicSnd (r : β) : Measure Ξ± :=
(Ο.restrict (univ ΓΛ’ Iic r)).fst
#align measure_theory.measure.Iic_snd MeasureTheory.Measure.IicSnd
| Mathlib/Probability/Kernel/Disintegration/CondCdf.lean | 54 | 58 | theorem IicSnd_apply (r : β) {s : Set Ξ±} (hs : MeasurableSet s) :
Ο.IicSnd r s = Ο (s ΓΛ’ Iic r) := by |
rw [IicSnd, fst_apply hs,
restrict_apply' (MeasurableSet.univ.prod (measurableSet_Iic : MeasurableSet (Iic r))), β
prod_univ, prod_inter_prod, inter_univ, univ_inter]
|
import Mathlib.CategoryTheory.NatIso
#align_import category_theory.bicategory.basic from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514"
namespace CategoryTheory
universe w v u
open Category Iso
-- intended to be used with explicit universe parameters
@[nolint checkUnivs]
class Bicategory (B : Type u) extends CategoryStruct.{v} B where
-- category structure on the collection of 1-morphisms:
homCategory : β a b : B, Category.{w} (a βΆ b) := by infer_instance
-- left whiskering:
whiskerLeft {a b c : B} (f : a βΆ b) {g h : b βΆ c} (Ξ· : g βΆ h) : f β« g βΆ f β« h
-- right whiskering:
whiskerRight {a b c : B} {f g : a βΆ b} (Ξ· : f βΆ g) (h : b βΆ c) : f β« h βΆ g β« h
-- associator:
associator {a b c d : B} (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) : (f β« g) β« h β
f β« g β« h
-- left unitor:
leftUnitor {a b : B} (f : a βΆ b) : π a β« f β
f
-- right unitor:
rightUnitor {a b : B} (f : a βΆ b) : f β« π b β
f
-- axioms for left whiskering:
whiskerLeft_id : β {a b c} (f : a βΆ b) (g : b βΆ c), whiskerLeft f (π g) = π (f β« g) := by
aesop_cat
whiskerLeft_comp :
β {a b c} (f : a βΆ b) {g h i : b βΆ c} (Ξ· : g βΆ h) (ΞΈ : h βΆ i),
whiskerLeft f (Ξ· β« ΞΈ) = whiskerLeft f Ξ· β« whiskerLeft f ΞΈ := by
aesop_cat
id_whiskerLeft :
β {a b} {f g : a βΆ b} (Ξ· : f βΆ g),
whiskerLeft (π a) Ξ· = (leftUnitor f).hom β« Ξ· β« (leftUnitor g).inv := by
aesop_cat
comp_whiskerLeft :
β {a b c d} (f : a βΆ b) (g : b βΆ c) {h h' : c βΆ d} (Ξ· : h βΆ h'),
whiskerLeft (f β« g) Ξ· =
(associator f g h).hom β« whiskerLeft f (whiskerLeft g Ξ·) β« (associator f g h').inv := by
aesop_cat
-- axioms for right whiskering:
id_whiskerRight : β {a b c} (f : a βΆ b) (g : b βΆ c), whiskerRight (π f) g = π (f β« g) := by
aesop_cat
comp_whiskerRight :
β {a b c} {f g h : a βΆ b} (Ξ· : f βΆ g) (ΞΈ : g βΆ h) (i : b βΆ c),
whiskerRight (Ξ· β« ΞΈ) i = whiskerRight Ξ· i β« whiskerRight ΞΈ i := by
aesop_cat
whiskerRight_id :
β {a b} {f g : a βΆ b} (Ξ· : f βΆ g),
whiskerRight Ξ· (π b) = (rightUnitor f).hom β« Ξ· β« (rightUnitor g).inv := by
aesop_cat
whiskerRight_comp :
β {a b c d} {f f' : a βΆ b} (Ξ· : f βΆ f') (g : b βΆ c) (h : c βΆ d),
whiskerRight Ξ· (g β« h) =
(associator f g h).inv β« whiskerRight (whiskerRight Ξ· g) h β« (associator f' g h).hom := by
aesop_cat
-- associativity of whiskerings:
whisker_assoc :
β {a b c d} (f : a βΆ b) {g g' : b βΆ c} (Ξ· : g βΆ g') (h : c βΆ d),
whiskerRight (whiskerLeft f Ξ·) h =
(associator f g h).hom β« whiskerLeft f (whiskerRight Ξ· h) β« (associator f g' h).inv := by
aesop_cat
-- exchange law of left and right whiskerings:
whisker_exchange :
β {a b c} {f g : a βΆ b} {h i : b βΆ c} (Ξ· : f βΆ g) (ΞΈ : h βΆ i),
whiskerLeft f ΞΈ β« whiskerRight Ξ· i = whiskerRight Ξ· h β« whiskerLeft g ΞΈ := by
aesop_cat
-- pentagon identity:
pentagon :
β {a b c d e} (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e),
whiskerRight (associator f g h).hom i β«
(associator f (g β« h) i).hom β« whiskerLeft f (associator g h i).hom =
(associator (f β« g) h i).hom β« (associator f g (h β« i)).hom := by
aesop_cat
-- triangle identity:
triangle :
β {a b c} (f : a βΆ b) (g : b βΆ c),
(associator f (π b) g).hom β« whiskerLeft f (leftUnitor g).hom
= whiskerRight (rightUnitor f).hom g := by
aesop_cat
#align category_theory.bicategory CategoryTheory.Bicategory
#align category_theory.bicategory.hom_category CategoryTheory.Bicategory.homCategory
#align category_theory.bicategory.whisker_left CategoryTheory.Bicategory.whiskerLeft
#align category_theory.bicategory.whisker_right CategoryTheory.Bicategory.whiskerRight
#align category_theory.bicategory.left_unitor CategoryTheory.Bicategory.leftUnitor
#align category_theory.bicategory.right_unitor CategoryTheory.Bicategory.rightUnitor
#align category_theory.bicategory.whisker_left_id' CategoryTheory.Bicategory.whiskerLeft_id
#align category_theory.bicategory.whisker_left_comp' CategoryTheory.Bicategory.whiskerLeft_comp
#align category_theory.bicategory.id_whisker_left' CategoryTheory.Bicategory.id_whiskerLeft
#align category_theory.bicategory.comp_whisker_left' CategoryTheory.Bicategory.comp_whiskerLeft
#align category_theory.bicategory.id_whisker_right' CategoryTheory.Bicategory.id_whiskerRight
#align category_theory.bicategory.comp_whisker_right' CategoryTheory.Bicategory.comp_whiskerRight
#align category_theory.bicategory.whisker_right_id' CategoryTheory.Bicategory.whiskerRight_id
#align category_theory.bicategory.whisker_right_comp' CategoryTheory.Bicategory.whiskerRight_comp
#align category_theory.bicategory.whisker_assoc' CategoryTheory.Bicategory.whisker_assoc
#align category_theory.bicategory.whisker_exchange' CategoryTheory.Bicategory.whisker_exchange
#align category_theory.bicategory.pentagon' CategoryTheory.Bicategory.pentagon
#align category_theory.bicategory.triangle' CategoryTheory.Bicategory.triangle
namespace Bicategory
scoped infixr:81 " β " => Bicategory.whiskerLeft
scoped infixl:81 " β· " => Bicategory.whiskerRight
scoped notation "Ξ±_" => Bicategory.associator
scoped notation "Ξ»_" => Bicategory.leftUnitor
scoped notation "Ο_" => Bicategory.rightUnitor
attribute [instance] homCategory
attribute [reassoc]
whiskerLeft_comp id_whiskerLeft comp_whiskerLeft comp_whiskerRight whiskerRight_id
whiskerRight_comp whisker_assoc whisker_exchange
attribute [reassoc (attr := simp)] pentagon triangle
attribute [simp]
whiskerLeft_id whiskerLeft_comp id_whiskerLeft comp_whiskerLeft id_whiskerRight comp_whiskerRight
whiskerRight_id whiskerRight_comp whisker_assoc
variable {B : Type u} [Bicategory.{w, v} B] {a b c d e : B}
@[reassoc (attr := simp)]
theorem whiskerLeft_hom_inv (f : a βΆ b) {g h : b βΆ c} (Ξ· : g β
h) :
f β Ξ·.hom β« f β Ξ·.inv = π (f β« g) := by rw [β whiskerLeft_comp, hom_inv_id, whiskerLeft_id]
#align category_theory.bicategory.hom_inv_whisker_left CategoryTheory.Bicategory.whiskerLeft_hom_inv
@[reassoc (attr := simp)]
theorem hom_inv_whiskerRight {f g : a βΆ b} (Ξ· : f β
g) (h : b βΆ c) :
Ξ·.hom β· h β« Ξ·.inv β· h = π (f β« h) := by rw [β comp_whiskerRight, hom_inv_id, id_whiskerRight]
#align category_theory.bicategory.hom_inv_whisker_right CategoryTheory.Bicategory.hom_inv_whiskerRight
@[reassoc (attr := simp)]
theorem whiskerLeft_inv_hom (f : a βΆ b) {g h : b βΆ c} (Ξ· : g β
h) :
f β Ξ·.inv β« f β Ξ·.hom = π (f β« h) := by rw [β whiskerLeft_comp, inv_hom_id, whiskerLeft_id]
#align category_theory.bicategory.inv_hom_whisker_left CategoryTheory.Bicategory.whiskerLeft_inv_hom
@[reassoc (attr := simp)]
theorem inv_hom_whiskerRight {f g : a βΆ b} (Ξ· : f β
g) (h : b βΆ c) :
Ξ·.inv β· h β« Ξ·.hom β· h = π (g β« h) := by rw [β comp_whiskerRight, inv_hom_id, id_whiskerRight]
#align category_theory.bicategory.inv_hom_whisker_right CategoryTheory.Bicategory.inv_hom_whiskerRight
@[simps]
def whiskerLeftIso (f : a βΆ b) {g h : b βΆ c} (Ξ· : g β
h) : f β« g β
f β« h where
hom := f β Ξ·.hom
inv := f β Ξ·.inv
#align category_theory.bicategory.whisker_left_iso CategoryTheory.Bicategory.whiskerLeftIso
instance whiskerLeft_isIso (f : a βΆ b) {g h : b βΆ c} (Ξ· : g βΆ h) [IsIso Ξ·] : IsIso (f β Ξ·) :=
(whiskerLeftIso f (asIso Ξ·)).isIso_hom
#align category_theory.bicategory.whisker_left_is_iso CategoryTheory.Bicategory.whiskerLeft_isIso
@[simp]
theorem inv_whiskerLeft (f : a βΆ b) {g h : b βΆ c} (Ξ· : g βΆ h) [IsIso Ξ·] :
inv (f β Ξ·) = f β inv Ξ· := by
apply IsIso.inv_eq_of_hom_inv_id
simp only [β whiskerLeft_comp, whiskerLeft_id, IsIso.hom_inv_id]
#align category_theory.bicategory.inv_whisker_left CategoryTheory.Bicategory.inv_whiskerLeft
@[simps!]
def whiskerRightIso {f g : a βΆ b} (Ξ· : f β
g) (h : b βΆ c) : f β« h β
g β« h where
hom := Ξ·.hom β· h
inv := Ξ·.inv β· h
#align category_theory.bicategory.whisker_right_iso CategoryTheory.Bicategory.whiskerRightIso
instance whiskerRight_isIso {f g : a βΆ b} (Ξ· : f βΆ g) (h : b βΆ c) [IsIso Ξ·] : IsIso (Ξ· β· h) :=
(whiskerRightIso (asIso Ξ·) h).isIso_hom
#align category_theory.bicategory.whisker_right_is_iso CategoryTheory.Bicategory.whiskerRight_isIso
@[simp]
theorem inv_whiskerRight {f g : a βΆ b} (Ξ· : f βΆ g) (h : b βΆ c) [IsIso Ξ·] :
inv (Ξ· β· h) = inv Ξ· β· h := by
apply IsIso.inv_eq_of_hom_inv_id
simp only [β comp_whiskerRight, id_whiskerRight, IsIso.hom_inv_id]
#align category_theory.bicategory.inv_whisker_right CategoryTheory.Bicategory.inv_whiskerRight
@[reassoc (attr := simp)]
theorem pentagon_inv (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
f β (Ξ±_ g h i).inv β« (Ξ±_ f (g β« h) i).inv β« (Ξ±_ f g h).inv β· i =
(Ξ±_ f g (h β« i)).inv β« (Ξ±_ (f β« g) h i).inv :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.pentagon_inv CategoryTheory.Bicategory.pentagon_inv
@[reassoc (attr := simp)]
theorem pentagon_inv_inv_hom_hom_inv (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ f (g β« h) i).inv β« (Ξ±_ f g h).inv β· i β« (Ξ±_ (f β« g) h i).hom =
f β (Ξ±_ g h i).hom β« (Ξ±_ f g (h β« i)).inv := by
rw [β cancel_epi (f β (Ξ±_ g h i).inv), β cancel_mono (Ξ±_ (f β« g) h i).inv]
simp
#align category_theory.bicategory.pentagon_inv_inv_hom_hom_inv CategoryTheory.Bicategory.pentagon_inv_inv_hom_hom_inv
@[reassoc (attr := simp)]
theorem pentagon_inv_hom_hom_hom_inv (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ (f β« g) h i).inv β« (Ξ±_ f g h).hom β· i β« (Ξ±_ f (g β« h) i).hom =
(Ξ±_ f g (h β« i)).hom β« f β (Ξ±_ g h i).inv :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.pentagon_inv_hom_hom_hom_inv CategoryTheory.Bicategory.pentagon_inv_hom_hom_hom_inv
@[reassoc (attr := simp)]
theorem pentagon_hom_inv_inv_inv_inv (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
f β (Ξ±_ g h i).hom β« (Ξ±_ f g (h β« i)).inv β« (Ξ±_ (f β« g) h i).inv =
(Ξ±_ f (g β« h) i).inv β« (Ξ±_ f g h).inv β· i := by
simp [β cancel_epi (f β (Ξ±_ g h i).inv)]
#align category_theory.bicategory.pentagon_hom_inv_inv_inv_inv CategoryTheory.Bicategory.pentagon_hom_inv_inv_inv_inv
@[reassoc (attr := simp)]
theorem pentagon_hom_hom_inv_hom_hom (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ (f β« g) h i).hom β« (Ξ±_ f g (h β« i)).hom β« f β (Ξ±_ g h i).inv =
(Ξ±_ f g h).hom β· i β« (Ξ±_ f (g β« h) i).hom :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.pentagon_hom_hom_inv_hom_hom CategoryTheory.Bicategory.pentagon_hom_hom_inv_hom_hom
@[reassoc (attr := simp)]
theorem pentagon_hom_inv_inv_inv_hom (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ f g (h β« i)).hom β« f β (Ξ±_ g h i).inv β« (Ξ±_ f (g β« h) i).inv =
(Ξ±_ (f β« g) h i).inv β« (Ξ±_ f g h).hom β· i := by
rw [β cancel_epi (Ξ±_ f g (h β« i)).inv, β cancel_mono ((Ξ±_ f g h).inv β· i)]
simp
#align category_theory.bicategory.pentagon_hom_inv_inv_inv_hom CategoryTheory.Bicategory.pentagon_hom_inv_inv_inv_hom
@[reassoc (attr := simp)]
theorem pentagon_hom_hom_inv_inv_hom (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ f (g β« h) i).hom β« f β (Ξ±_ g h i).hom β« (Ξ±_ f g (h β« i)).inv =
(Ξ±_ f g h).inv β· i β« (Ξ±_ (f β« g) h i).hom :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.pentagon_hom_hom_inv_inv_hom CategoryTheory.Bicategory.pentagon_hom_hom_inv_inv_hom
@[reassoc (attr := simp)]
theorem pentagon_inv_hom_hom_hom_hom (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ f g h).inv β· i β« (Ξ±_ (f β« g) h i).hom β« (Ξ±_ f g (h β« i)).hom =
(Ξ±_ f (g β« h) i).hom β« f β (Ξ±_ g h i).hom := by
simp [β cancel_epi ((Ξ±_ f g h).hom β· i)]
#align category_theory.bicategory.pentagon_inv_hom_hom_hom_hom CategoryTheory.Bicategory.pentagon_inv_hom_hom_hom_hom
@[reassoc (attr := simp)]
theorem pentagon_inv_inv_hom_inv_inv (f : a βΆ b) (g : b βΆ c) (h : c βΆ d) (i : d βΆ e) :
(Ξ±_ f g (h β« i)).inv β« (Ξ±_ (f β« g) h i).inv β« (Ξ±_ f g h).hom β· i =
f β (Ξ±_ g h i).inv β« (Ξ±_ f (g β« h) i).inv :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.pentagon_inv_inv_hom_inv_inv CategoryTheory.Bicategory.pentagon_inv_inv_hom_inv_inv
theorem triangle_assoc_comp_left (f : a βΆ b) (g : b βΆ c) :
(Ξ±_ f (π b) g).hom β« f β (Ξ»_ g).hom = (Ο_ f).hom β· g :=
triangle f g
#align category_theory.bicategory.triangle_assoc_comp_left CategoryTheory.Bicategory.triangle_assoc_comp_left
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_right (f : a βΆ b) (g : b βΆ c) :
(Ξ±_ f (π b) g).inv β« (Ο_ f).hom β· g = f β (Ξ»_ g).hom := by rw [β triangle, inv_hom_id_assoc]
#align category_theory.bicategory.triangle_assoc_comp_right CategoryTheory.Bicategory.triangle_assoc_comp_right
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_right_inv (f : a βΆ b) (g : b βΆ c) :
(Ο_ f).inv β· g β« (Ξ±_ f (π b) g).hom = f β (Ξ»_ g).inv := by
simp [β cancel_mono (f β (Ξ»_ g).hom)]
#align category_theory.bicategory.triangle_assoc_comp_right_inv CategoryTheory.Bicategory.triangle_assoc_comp_right_inv
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_left_inv (f : a βΆ b) (g : b βΆ c) :
f β (Ξ»_ g).inv β« (Ξ±_ f (π b) g).inv = (Ο_ f).inv β· g := by
simp [β cancel_mono ((Ο_ f).hom β· g)]
#align category_theory.bicategory.triangle_assoc_comp_left_inv CategoryTheory.Bicategory.triangle_assoc_comp_left_inv
@[reassoc]
theorem associator_naturality_left {f f' : a βΆ b} (Ξ· : f βΆ f') (g : b βΆ c) (h : c βΆ d) :
Ξ· β· g β· h β« (Ξ±_ f' g h).hom = (Ξ±_ f g h).hom β« Ξ· β· (g β« h) := by simp
#align category_theory.bicategory.associator_naturality_left CategoryTheory.Bicategory.associator_naturality_left
@[reassoc]
theorem associator_inv_naturality_left {f f' : a βΆ b} (Ξ· : f βΆ f') (g : b βΆ c) (h : c βΆ d) :
Ξ· β· (g β« h) β« (Ξ±_ f' g h).inv = (Ξ±_ f g h).inv β« Ξ· β· g β· h := by simp
#align category_theory.bicategory.associator_inv_naturality_left CategoryTheory.Bicategory.associator_inv_naturality_left
@[reassoc]
theorem whiskerRight_comp_symm {f f' : a βΆ b} (Ξ· : f βΆ f') (g : b βΆ c) (h : c βΆ d) :
Ξ· β· g β· h = (Ξ±_ f g h).hom β« Ξ· β· (g β« h) β« (Ξ±_ f' g h).inv := by simp
#align category_theory.bicategory.whisker_right_comp_symm CategoryTheory.Bicategory.whiskerRight_comp_symm
@[reassoc]
theorem associator_naturality_middle (f : a βΆ b) {g g' : b βΆ c} (Ξ· : g βΆ g') (h : c βΆ d) :
(f β Ξ·) β· h β« (Ξ±_ f g' h).hom = (Ξ±_ f g h).hom β« f β Ξ· β· h := by simp
#align category_theory.bicategory.associator_naturality_middle CategoryTheory.Bicategory.associator_naturality_middle
@[reassoc]
theorem associator_inv_naturality_middle (f : a βΆ b) {g g' : b βΆ c} (Ξ· : g βΆ g') (h : c βΆ d) :
f β Ξ· β· h β« (Ξ±_ f g' h).inv = (Ξ±_ f g h).inv β« (f β Ξ·) β· h := by simp
#align category_theory.bicategory.associator_inv_naturality_middle CategoryTheory.Bicategory.associator_inv_naturality_middle
@[reassoc]
theorem whisker_assoc_symm (f : a βΆ b) {g g' : b βΆ c} (Ξ· : g βΆ g') (h : c βΆ d) :
f β Ξ· β· h = (Ξ±_ f g h).inv β« (f β Ξ·) β· h β« (Ξ±_ f g' h).hom := by simp
#align category_theory.bicategory.whisker_assoc_symm CategoryTheory.Bicategory.whisker_assoc_symm
@[reassoc]
theorem associator_naturality_right (f : a βΆ b) (g : b βΆ c) {h h' : c βΆ d} (Ξ· : h βΆ h') :
(f β« g) β Ξ· β« (Ξ±_ f g h').hom = (Ξ±_ f g h).hom β« f β g β Ξ· := by simp
#align category_theory.bicategory.associator_naturality_right CategoryTheory.Bicategory.associator_naturality_right
@[reassoc]
theorem associator_inv_naturality_right (f : a βΆ b) (g : b βΆ c) {h h' : c βΆ d} (Ξ· : h βΆ h') :
f β g β Ξ· β« (Ξ±_ f g h').inv = (Ξ±_ f g h).inv β« (f β« g) β Ξ· := by simp
#align category_theory.bicategory.associator_inv_naturality_right CategoryTheory.Bicategory.associator_inv_naturality_right
@[reassoc]
theorem comp_whiskerLeft_symm (f : a βΆ b) (g : b βΆ c) {h h' : c βΆ d} (Ξ· : h βΆ h') :
f β g β Ξ· = (Ξ±_ f g h).inv β« (f β« g) β Ξ· β« (Ξ±_ f g h').hom := by simp
#align category_theory.bicategory.comp_whisker_left_symm CategoryTheory.Bicategory.comp_whiskerLeft_symm
@[reassoc]
theorem leftUnitor_naturality {f g : a βΆ b} (Ξ· : f βΆ g) :
π a β Ξ· β« (Ξ»_ g).hom = (Ξ»_ f).hom β« Ξ· := by
simp
#align category_theory.bicategory.left_unitor_naturality CategoryTheory.Bicategory.leftUnitor_naturality
@[reassoc]
theorem leftUnitor_inv_naturality {f g : a βΆ b} (Ξ· : f βΆ g) :
Ξ· β« (Ξ»_ g).inv = (Ξ»_ f).inv β« π a β Ξ· := by simp
#align category_theory.bicategory.left_unitor_inv_naturality CategoryTheory.Bicategory.leftUnitor_inv_naturality
theorem id_whiskerLeft_symm {f g : a βΆ b} (Ξ· : f βΆ g) : Ξ· = (Ξ»_ f).inv β« π a β Ξ· β« (Ξ»_ g).hom := by
simp
#align category_theory.bicategory.id_whisker_left_symm CategoryTheory.Bicategory.id_whiskerLeft_symm
@[reassoc]
theorem rightUnitor_naturality {f g : a βΆ b} (Ξ· : f βΆ g) :
Ξ· β· π b β« (Ο_ g).hom = (Ο_ f).hom β« Ξ· := by simp
#align category_theory.bicategory.right_unitor_naturality CategoryTheory.Bicategory.rightUnitor_naturality
@[reassoc]
theorem rightUnitor_inv_naturality {f g : a βΆ b} (Ξ· : f βΆ g) :
Ξ· β« (Ο_ g).inv = (Ο_ f).inv β« Ξ· β· π b := by simp
#align category_theory.bicategory.right_unitor_inv_naturality CategoryTheory.Bicategory.rightUnitor_inv_naturality
theorem whiskerRight_id_symm {f g : a βΆ b} (Ξ· : f βΆ g) : Ξ· = (Ο_ f).inv β« Ξ· β· π b β« (Ο_ g).hom := by
simp
#align category_theory.bicategory.whisker_right_id_symm CategoryTheory.Bicategory.whiskerRight_id_symm
theorem whiskerLeft_iff {f g : a βΆ b} (Ξ· ΞΈ : f βΆ g) : π a β Ξ· = π a β ΞΈ β Ξ· = ΞΈ := by simp
#align category_theory.bicategory.whisker_left_iff CategoryTheory.Bicategory.whiskerLeft_iff
theorem whiskerRight_iff {f g : a βΆ b} (Ξ· ΞΈ : f βΆ g) : Ξ· β· π b = ΞΈ β· π b β Ξ· = ΞΈ := by simp
#align category_theory.bicategory.whisker_right_iff CategoryTheory.Bicategory.whiskerRight_iff
@[reassoc, simp]
theorem leftUnitor_whiskerRight (f : a βΆ b) (g : b βΆ c) :
(Ξ»_ f).hom β· g = (Ξ±_ (π a) f g).hom β« (Ξ»_ (f β« g)).hom := by
rw [β whiskerLeft_iff, whiskerLeft_comp, β cancel_epi (Ξ±_ _ _ _).hom, β
cancel_epi ((Ξ±_ _ _ _).hom β· _), pentagon_assoc, triangle, β associator_naturality_middle, β
comp_whiskerRight_assoc, triangle, associator_naturality_left]
#align category_theory.bicategory.left_unitor_whisker_right CategoryTheory.Bicategory.leftUnitor_whiskerRight
@[reassoc, simp]
theorem leftUnitor_inv_whiskerRight (f : a βΆ b) (g : b βΆ c) :
(Ξ»_ f).inv β· g = (Ξ»_ (f β« g)).inv β« (Ξ±_ (π a) f g).inv :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.left_unitor_inv_whisker_right CategoryTheory.Bicategory.leftUnitor_inv_whiskerRight
@[reassoc, simp]
theorem whiskerLeft_rightUnitor (f : a βΆ b) (g : b βΆ c) :
f β (Ο_ g).hom = (Ξ±_ f g (π c)).inv β« (Ο_ (f β« g)).hom := by
rw [β whiskerRight_iff, comp_whiskerRight, β cancel_epi (Ξ±_ _ _ _).inv, β
cancel_epi (f β (Ξ±_ _ _ _).inv), pentagon_inv_assoc, triangle_assoc_comp_right, β
associator_inv_naturality_middle, β whiskerLeft_comp_assoc, triangle_assoc_comp_right,
associator_inv_naturality_right]
#align category_theory.bicategory.whisker_left_right_unitor CategoryTheory.Bicategory.whiskerLeft_rightUnitor
@[reassoc, simp]
theorem whiskerLeft_rightUnitor_inv (f : a βΆ b) (g : b βΆ c) :
f β (Ο_ g).inv = (Ο_ (f β« g)).inv β« (Ξ±_ f g (π c)).hom :=
eq_of_inv_eq_inv (by simp)
#align category_theory.bicategory.whisker_left_right_unitor_inv CategoryTheory.Bicategory.whiskerLeft_rightUnitor_inv
@[reassoc]
theorem leftUnitor_comp (f : a βΆ b) (g : b βΆ c) :
(Ξ»_ (f β« g)).hom = (Ξ±_ (π a) f g).inv β« (Ξ»_ f).hom β· g := by simp
#align category_theory.bicategory.left_unitor_comp CategoryTheory.Bicategory.leftUnitor_comp
@[reassoc]
theorem leftUnitor_comp_inv (f : a βΆ b) (g : b βΆ c) :
(Ξ»_ (f β« g)).inv = (Ξ»_ f).inv β· g β« (Ξ±_ (π a) f g).hom := by simp
#align category_theory.bicategory.left_unitor_comp_inv CategoryTheory.Bicategory.leftUnitor_comp_inv
@[reassoc]
theorem rightUnitor_comp (f : a βΆ b) (g : b βΆ c) :
(Ο_ (f β« g)).hom = (Ξ±_ f g (π c)).hom β« f β (Ο_ g).hom := by simp
#align category_theory.bicategory.right_unitor_comp CategoryTheory.Bicategory.rightUnitor_comp
@[reassoc]
theorem rightUnitor_comp_inv (f : a βΆ b) (g : b βΆ c) :
(Ο_ (f β« g)).inv = f β (Ο_ g).inv β« (Ξ±_ f g (π c)).inv := by simp
#align category_theory.bicategory.right_unitor_comp_inv CategoryTheory.Bicategory.rightUnitor_comp_inv
@[simp]
theorem unitors_equal : (Ξ»_ (π a)).hom = (Ο_ (π a)).hom := by
rw [β whiskerLeft_iff, β cancel_epi (Ξ±_ _ _ _).hom, β cancel_mono (Ο_ _).hom, triangle, β
rightUnitor_comp, rightUnitor_naturality]
#align category_theory.bicategory.unitors_equal CategoryTheory.Bicategory.unitors_equal
@[simp]
| Mathlib/CategoryTheory/Bicategory/Basic.lean | 485 | 485 | theorem unitors_inv_equal : (Ξ»_ (π a)).inv = (Ο_ (π a)).inv := by | simp [Iso.inv_eq_inv]
|
import Mathlib.Topology.UniformSpace.UniformConvergenceTopology
#align_import topology.uniform_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
section
open UniformSpace Filter Set Uniformity Topology UniformConvergence Function
variable {ΞΉ ΞΊ X X' Y Z Ξ± Ξ±' Ξ² Ξ²' Ξ³ π : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y]
[tZ : TopologicalSpace Z] [uΞ± : UniformSpace Ξ±] [uΞ² : UniformSpace Ξ²] [uΞ³ : UniformSpace Ξ³]
def EquicontinuousAt (F : ΞΉ β X β Ξ±) (xβ : X) : Prop :=
β U β π€ Ξ±, βαΆ x in π xβ, β i, (F i xβ, F i x) β U
#align equicontinuous_at EquicontinuousAt
protected abbrev Set.EquicontinuousAt (H : Set <| X β Ξ±) (xβ : X) : Prop :=
EquicontinuousAt ((β) : H β X β Ξ±) xβ
#align set.equicontinuous_at Set.EquicontinuousAt
def EquicontinuousWithinAt (F : ΞΉ β X β Ξ±) (S : Set X) (xβ : X) : Prop :=
β U β π€ Ξ±, βαΆ x in π[S] xβ, β i, (F i xβ, F i x) β U
protected abbrev Set.EquicontinuousWithinAt (H : Set <| X β Ξ±) (S : Set X) (xβ : X) : Prop :=
EquicontinuousWithinAt ((β) : H β X β Ξ±) S xβ
def Equicontinuous (F : ΞΉ β X β Ξ±) : Prop :=
β xβ, EquicontinuousAt F xβ
#align equicontinuous Equicontinuous
protected abbrev Set.Equicontinuous (H : Set <| X β Ξ±) : Prop :=
Equicontinuous ((β) : H β X β Ξ±)
#align set.equicontinuous Set.Equicontinuous
def EquicontinuousOn (F : ΞΉ β X β Ξ±) (S : Set X) : Prop :=
β xβ β S, EquicontinuousWithinAt F S xβ
protected abbrev Set.EquicontinuousOn (H : Set <| X β Ξ±) (S : Set X) : Prop :=
EquicontinuousOn ((β) : H β X β Ξ±) S
def UniformEquicontinuous (F : ΞΉ β Ξ² β Ξ±) : Prop :=
β U β π€ Ξ±, βαΆ xy : Ξ² Γ Ξ² in π€ Ξ², β i, (F i xy.1, F i xy.2) β U
#align uniform_equicontinuous UniformEquicontinuous
protected abbrev Set.UniformEquicontinuous (H : Set <| Ξ² β Ξ±) : Prop :=
UniformEquicontinuous ((β) : H β Ξ² β Ξ±)
#align set.uniform_equicontinuous Set.UniformEquicontinuous
def UniformEquicontinuousOn (F : ΞΉ β Ξ² β Ξ±) (S : Set Ξ²) : Prop :=
β U β π€ Ξ±, βαΆ xy : Ξ² Γ Ξ² in π€ Ξ² β π (S ΓΛ’ S), β i, (F i xy.1, F i xy.2) β U
protected abbrev Set.UniformEquicontinuousOn (H : Set <| Ξ² β Ξ±) (S : Set Ξ²) : Prop :=
UniformEquicontinuousOn ((β) : H β Ξ² β Ξ±) S
lemma EquicontinuousAt.equicontinuousWithinAt {F : ΞΉ β X β Ξ±} {xβ : X} (H : EquicontinuousAt F xβ)
(S : Set X) : EquicontinuousWithinAt F S xβ :=
fun U hU β¦ (H U hU).filter_mono inf_le_left
lemma EquicontinuousWithinAt.mono {F : ΞΉ β X β Ξ±} {xβ : X} {S T : Set X}
(H : EquicontinuousWithinAt F T xβ) (hST : S β T) : EquicontinuousWithinAt F S xβ :=
fun U hU β¦ (H U hU).filter_mono <| nhdsWithin_mono xβ hST
@[simp] lemma equicontinuousWithinAt_univ (F : ΞΉ β X β Ξ±) (xβ : X) :
EquicontinuousWithinAt F univ xβ β EquicontinuousAt F xβ := by
rw [EquicontinuousWithinAt, EquicontinuousAt, nhdsWithin_univ]
lemma equicontinuousAt_restrict_iff (F : ΞΉ β X β Ξ±) {S : Set X} (xβ : S) :
EquicontinuousAt (S.restrict β F) xβ β EquicontinuousWithinAt F S xβ := by
simp [EquicontinuousWithinAt, EquicontinuousAt,
β eventually_nhds_subtype_iff]
lemma Equicontinuous.equicontinuousOn {F : ΞΉ β X β Ξ±} (H : Equicontinuous F)
(S : Set X) : EquicontinuousOn F S :=
fun x _ β¦ (H x).equicontinuousWithinAt S
lemma EquicontinuousOn.mono {F : ΞΉ β X β Ξ±} {S T : Set X}
(H : EquicontinuousOn F T) (hST : S β T) : EquicontinuousOn F S :=
fun x hx β¦ (H x (hST hx)).mono hST
lemma equicontinuousOn_univ (F : ΞΉ β X β Ξ±) :
EquicontinuousOn F univ β Equicontinuous F := by
simp [EquicontinuousOn, Equicontinuous]
lemma equicontinuous_restrict_iff (F : ΞΉ β X β Ξ±) {S : Set X} :
Equicontinuous (S.restrict β F) β EquicontinuousOn F S := by
simp [Equicontinuous, EquicontinuousOn, equicontinuousAt_restrict_iff]
lemma UniformEquicontinuous.uniformEquicontinuousOn {F : ΞΉ β Ξ² β Ξ±} (H : UniformEquicontinuous F)
(S : Set Ξ²) : UniformEquicontinuousOn F S :=
fun U hU β¦ (H U hU).filter_mono inf_le_left
lemma UniformEquicontinuousOn.mono {F : ΞΉ β Ξ² β Ξ±} {S T : Set Ξ²}
(H : UniformEquicontinuousOn F T) (hST : S β T) : UniformEquicontinuousOn F S :=
fun U hU β¦ (H U hU).filter_mono <| by gcongr
lemma uniformEquicontinuousOn_univ (F : ΞΉ β Ξ² β Ξ±) :
UniformEquicontinuousOn F univ β UniformEquicontinuous F := by
simp [UniformEquicontinuousOn, UniformEquicontinuous]
lemma uniformEquicontinuous_restrict_iff (F : ΞΉ β Ξ² β Ξ±) {S : Set Ξ²} :
UniformEquicontinuous (S.restrict β F) β UniformEquicontinuousOn F S := by
rw [UniformEquicontinuous, UniformEquicontinuousOn]
conv in _ β _ => rw [β Subtype.range_val (s := S), β range_prod_map, β map_comap]
rfl
@[simp]
lemma equicontinuousAt_empty [h : IsEmpty ΞΉ] (F : ΞΉ β X β Ξ±) (xβ : X) :
EquicontinuousAt F xβ :=
fun _ _ β¦ eventually_of_forall (fun _ β¦ h.elim)
@[simp]
lemma equicontinuousWithinAt_empty [h : IsEmpty ΞΉ] (F : ΞΉ β X β Ξ±) (S : Set X) (xβ : X) :
EquicontinuousWithinAt F S xβ :=
fun _ _ β¦ eventually_of_forall (fun _ β¦ h.elim)
@[simp]
lemma equicontinuous_empty [IsEmpty ΞΉ] (F : ΞΉ β X β Ξ±) :
Equicontinuous F :=
equicontinuousAt_empty F
@[simp]
lemma equicontinuousOn_empty [IsEmpty ΞΉ] (F : ΞΉ β X β Ξ±) (S : Set X) :
EquicontinuousOn F S :=
fun xβ _ β¦ equicontinuousWithinAt_empty F S xβ
@[simp]
lemma uniformEquicontinuous_empty [h : IsEmpty ΞΉ] (F : ΞΉ β Ξ² β Ξ±) :
UniformEquicontinuous F :=
fun _ _ β¦ eventually_of_forall (fun _ β¦ h.elim)
@[simp]
lemma uniformEquicontinuousOn_empty [h : IsEmpty ΞΉ] (F : ΞΉ β Ξ² β Ξ±) (S : Set Ξ²) :
UniformEquicontinuousOn F S :=
fun _ _ β¦ eventually_of_forall (fun _ β¦ h.elim)
| Mathlib/Topology/UniformSpace/Equicontinuity.lean | 251 | 254 | theorem equicontinuousAt_finite [Finite ΞΉ] {F : ΞΉ β X β Ξ±} {xβ : X} :
EquicontinuousAt F xβ β β i, ContinuousAt (F i) xβ := by |
simp [EquicontinuousAt, ContinuousAt, (nhds_basis_uniformity' (π€ Ξ±).basis_sets).tendsto_right_iff,
UniformSpace.ball, @forall_swap _ ΞΉ]
|
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {Ξ± : Type*}
namespace Set
section OrderedAddCommGroup
variable [OrderedAddCommGroup Ξ±] (a b c : Ξ±)
@[simp]
theorem preimage_const_add_Ici : (fun x => a + x) β»ΒΉ' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add'.symm
#align set.preimage_const_add_Ici Set.preimage_const_add_Ici
@[simp]
theorem preimage_const_add_Ioi : (fun x => a + x) β»ΒΉ' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add'.symm
#align set.preimage_const_add_Ioi Set.preimage_const_add_Ioi
@[simp]
theorem preimage_const_add_Iic : (fun x => a + x) β»ΒΉ' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le'.symm
#align set.preimage_const_add_Iic Set.preimage_const_add_Iic
@[simp]
theorem preimage_const_add_Iio : (fun x => a + x) β»ΒΉ' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt'.symm
#align set.preimage_const_add_Iio Set.preimage_const_add_Iio
@[simp]
theorem preimage_const_add_Icc : (fun x => a + x) β»ΒΉ' Icc b c = Icc (b - a) (c - a) := by
simp [β Ici_inter_Iic]
#align set.preimage_const_add_Icc Set.preimage_const_add_Icc
@[simp]
theorem preimage_const_add_Ico : (fun x => a + x) β»ΒΉ' Ico b c = Ico (b - a) (c - a) := by
simp [β Ici_inter_Iio]
#align set.preimage_const_add_Ico Set.preimage_const_add_Ico
@[simp]
theorem preimage_const_add_Ioc : (fun x => a + x) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a) := by
simp [β Ioi_inter_Iic]
#align set.preimage_const_add_Ioc Set.preimage_const_add_Ioc
@[simp]
theorem preimage_const_add_Ioo : (fun x => a + x) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a) := by
simp [β Ioi_inter_Iio]
#align set.preimage_const_add_Ioo Set.preimage_const_add_Ioo
@[simp]
theorem preimage_add_const_Ici : (fun x => x + a) β»ΒΉ' Ici b = Ici (b - a) :=
ext fun _x => sub_le_iff_le_add.symm
#align set.preimage_add_const_Ici Set.preimage_add_const_Ici
@[simp]
theorem preimage_add_const_Ioi : (fun x => x + a) β»ΒΉ' Ioi b = Ioi (b - a) :=
ext fun _x => sub_lt_iff_lt_add.symm
#align set.preimage_add_const_Ioi Set.preimage_add_const_Ioi
@[simp]
theorem preimage_add_const_Iic : (fun x => x + a) β»ΒΉ' Iic b = Iic (b - a) :=
ext fun _x => le_sub_iff_add_le.symm
#align set.preimage_add_const_Iic Set.preimage_add_const_Iic
@[simp]
theorem preimage_add_const_Iio : (fun x => x + a) β»ΒΉ' Iio b = Iio (b - a) :=
ext fun _x => lt_sub_iff_add_lt.symm
#align set.preimage_add_const_Iio Set.preimage_add_const_Iio
@[simp]
theorem preimage_add_const_Icc : (fun x => x + a) β»ΒΉ' Icc b c = Icc (b - a) (c - a) := by
simp [β Ici_inter_Iic]
#align set.preimage_add_const_Icc Set.preimage_add_const_Icc
@[simp]
theorem preimage_add_const_Ico : (fun x => x + a) β»ΒΉ' Ico b c = Ico (b - a) (c - a) := by
simp [β Ici_inter_Iio]
#align set.preimage_add_const_Ico Set.preimage_add_const_Ico
@[simp]
theorem preimage_add_const_Ioc : (fun x => x + a) β»ΒΉ' Ioc b c = Ioc (b - a) (c - a) := by
simp [β Ioi_inter_Iic]
#align set.preimage_add_const_Ioc Set.preimage_add_const_Ioc
@[simp]
theorem preimage_add_const_Ioo : (fun x => x + a) β»ΒΉ' Ioo b c = Ioo (b - a) (c - a) := by
simp [β Ioi_inter_Iio]
#align set.preimage_add_const_Ioo Set.preimage_add_const_Ioo
@[simp]
theorem preimage_neg_Ici : -Ici a = Iic (-a) :=
ext fun _x => le_neg
#align set.preimage_neg_Ici Set.preimage_neg_Ici
@[simp]
theorem preimage_neg_Iic : -Iic a = Ici (-a) :=
ext fun _x => neg_le
#align set.preimage_neg_Iic Set.preimage_neg_Iic
@[simp]
theorem preimage_neg_Ioi : -Ioi a = Iio (-a) :=
ext fun _x => lt_neg
#align set.preimage_neg_Ioi Set.preimage_neg_Ioi
@[simp]
theorem preimage_neg_Iio : -Iio a = Ioi (-a) :=
ext fun _x => neg_lt
#align set.preimage_neg_Iio Set.preimage_neg_Iio
@[simp]
theorem preimage_neg_Icc : -Icc a b = Icc (-b) (-a) := by simp [β Ici_inter_Iic, inter_comm]
#align set.preimage_neg_Icc Set.preimage_neg_Icc
@[simp]
theorem preimage_neg_Ico : -Ico a b = Ioc (-b) (-a) := by
simp [β Ici_inter_Iio, β Ioi_inter_Iic, inter_comm]
#align set.preimage_neg_Ico Set.preimage_neg_Ico
@[simp]
theorem preimage_neg_Ioc : -Ioc a b = Ico (-b) (-a) := by
simp [β Ioi_inter_Iic, β Ici_inter_Iio, inter_comm]
#align set.preimage_neg_Ioc Set.preimage_neg_Ioc
@[simp]
theorem preimage_neg_Ioo : -Ioo a b = Ioo (-b) (-a) := by simp [β Ioi_inter_Iio, inter_comm]
#align set.preimage_neg_Ioo Set.preimage_neg_Ioo
@[simp]
theorem preimage_sub_const_Ici : (fun x => x - a) β»ΒΉ' Ici b = Ici (b + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Ici Set.preimage_sub_const_Ici
@[simp]
theorem preimage_sub_const_Ioi : (fun x => x - a) β»ΒΉ' Ioi b = Ioi (b + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Ioi Set.preimage_sub_const_Ioi
@[simp]
theorem preimage_sub_const_Iic : (fun x => x - a) β»ΒΉ' Iic b = Iic (b + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Iic Set.preimage_sub_const_Iic
@[simp]
theorem preimage_sub_const_Iio : (fun x => x - a) β»ΒΉ' Iio b = Iio (b + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Iio Set.preimage_sub_const_Iio
@[simp]
theorem preimage_sub_const_Icc : (fun x => x - a) β»ΒΉ' Icc b c = Icc (b + a) (c + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Icc Set.preimage_sub_const_Icc
@[simp]
theorem preimage_sub_const_Ico : (fun x => x - a) β»ΒΉ' Ico b c = Ico (b + a) (c + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Ico Set.preimage_sub_const_Ico
@[simp]
theorem preimage_sub_const_Ioc : (fun x => x - a) β»ΒΉ' Ioc b c = Ioc (b + a) (c + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Ioc Set.preimage_sub_const_Ioc
@[simp]
theorem preimage_sub_const_Ioo : (fun x => x - a) β»ΒΉ' Ioo b c = Ioo (b + a) (c + a) := by
simp [sub_eq_add_neg]
#align set.preimage_sub_const_Ioo Set.preimage_sub_const_Ioo
@[simp]
theorem preimage_const_sub_Ici : (fun x => a - x) β»ΒΉ' Ici b = Iic (a - b) :=
ext fun _x => le_sub_comm
#align set.preimage_const_sub_Ici Set.preimage_const_sub_Ici
@[simp]
theorem preimage_const_sub_Iic : (fun x => a - x) β»ΒΉ' Iic b = Ici (a - b) :=
ext fun _x => sub_le_comm
#align set.preimage_const_sub_Iic Set.preimage_const_sub_Iic
@[simp]
theorem preimage_const_sub_Ioi : (fun x => a - x) β»ΒΉ' Ioi b = Iio (a - b) :=
ext fun _x => lt_sub_comm
#align set.preimage_const_sub_Ioi Set.preimage_const_sub_Ioi
@[simp]
theorem preimage_const_sub_Iio : (fun x => a - x) β»ΒΉ' Iio b = Ioi (a - b) :=
ext fun _x => sub_lt_comm
#align set.preimage_const_sub_Iio Set.preimage_const_sub_Iio
@[simp]
theorem preimage_const_sub_Icc : (fun x => a - x) β»ΒΉ' Icc b c = Icc (a - c) (a - b) := by
simp [β Ici_inter_Iic, inter_comm]
#align set.preimage_const_sub_Icc Set.preimage_const_sub_Icc
@[simp]
theorem preimage_const_sub_Ico : (fun x => a - x) β»ΒΉ' Ico b c = Ioc (a - c) (a - b) := by
simp [β Ioi_inter_Iic, β Ici_inter_Iio, inter_comm]
#align set.preimage_const_sub_Ico Set.preimage_const_sub_Ico
@[simp]
theorem preimage_const_sub_Ioc : (fun x => a - x) β»ΒΉ' Ioc b c = Ico (a - c) (a - b) := by
simp [β Ioi_inter_Iic, β Ici_inter_Iio, inter_comm]
#align set.preimage_const_sub_Ioc Set.preimage_const_sub_Ioc
@[simp]
theorem preimage_const_sub_Ioo : (fun x => a - x) β»ΒΉ' Ioo b c = Ioo (a - c) (a - b) := by
simp [β Ioi_inter_Iio, inter_comm]
#align set.preimage_const_sub_Ioo Set.preimage_const_sub_Ioo
-- @[simp] -- Porting note (#10618): simp can prove this modulo `add_comm`
theorem image_const_add_Iic : (fun x => a + x) '' Iic b = Iic (a + b) := by simp [add_comm]
#align set.image_const_add_Iic Set.image_const_add_Iic
-- @[simp] -- Porting note (#10618): simp can prove this modulo `add_comm`
theorem image_const_add_Iio : (fun x => a + x) '' Iio b = Iio (a + b) := by simp [add_comm]
#align set.image_const_add_Iio Set.image_const_add_Iio
-- @[simp] -- Porting note (#10618): simp can prove this
theorem image_add_const_Iic : (fun x => x + a) '' Iic b = Iic (b + a) := by simp
#align set.image_add_const_Iic Set.image_add_const_Iic
-- @[simp] -- Porting note (#10618): simp can prove this
theorem image_add_const_Iio : (fun x => x + a) '' Iio b = Iio (b + a) := by simp
#align set.image_add_const_Iio Set.image_add_const_Iio
theorem image_neg_Ici : Neg.neg '' Ici a = Iic (-a) := by simp
#align set.image_neg_Ici Set.image_neg_Ici
| Mathlib/Data/Set/Pointwise/Interval.lean | 378 | 378 | theorem image_neg_Iic : Neg.neg '' Iic a = Ici (-a) := by | simp
|
import Mathlib.Analysis.Calculus.SmoothSeries
import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.InnerProductSpace.EuclideanDist
import Mathlib.Data.Set.Pointwise.Support
import Mathlib.MeasureTheory.Measure.Haar.NormedSpace
import Mathlib.MeasureTheory.Measure.Haar.Unique
#align_import analysis.calculus.bump_function_findim from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open Set Metric TopologicalSpace Function Asymptotics MeasureTheory FiniteDimensional
ContinuousLinearMap Filter MeasureTheory.Measure Bornology
open scoped Pointwise Topology NNReal Convolution
variable {E : Type*} [NormedAddCommGroup E]
section
variable [NormedSpace β E] [FiniteDimensional β E]
theorem exists_smooth_tsupport_subset {s : Set E} {x : E} (hs : s β π x) :
β f : E β β,
tsupport f β s β§ HasCompactSupport f β§ ContDiff β β€ f β§ range f β Icc 0 1 β§ f x = 1 := by
obtain β¨d : β, d_pos : 0 < d, hd : Euclidean.closedBall x d β sβ© :=
Euclidean.nhds_basis_closedBall.mem_iff.1 hs
let c : ContDiffBump (toEuclidean x) :=
{ rIn := d / 2
rOut := d
rIn_pos := half_pos d_pos
rIn_lt_rOut := half_lt_self d_pos }
let f : E β β := c β toEuclidean
have f_supp : f.support β Euclidean.ball x d := by
intro y hy
have : toEuclidean y β Function.support c := by
simpa only [Function.mem_support, Function.comp_apply, Ne] using hy
rwa [c.support_eq] at this
have f_tsupp : tsupport f β Euclidean.closedBall x d := by
rw [tsupport, β Euclidean.closure_ball _ d_pos.ne']
exact closure_mono f_supp
refine β¨f, f_tsupp.trans hd, ?_, ?_, ?_, ?_β©
Β· refine isCompact_of_isClosed_isBounded isClosed_closure ?_
have : IsBounded (Euclidean.closedBall x d) := Euclidean.isCompact_closedBall.isBounded
refine this.subset (Euclidean.isClosed_closedBall.closure_subset_iff.2 ?_)
exact f_supp.trans Euclidean.ball_subset_closedBall
Β· apply c.contDiff.comp
exact ContinuousLinearEquiv.contDiff _
Β· rintro t β¨y, rflβ©
exact β¨c.nonneg, c.le_oneβ©
Β· apply c.one_of_mem_closedBall
apply mem_closedBall_self
exact (half_pos d_pos).le
#align exists_smooth_tsupport_subset exists_smooth_tsupport_subset
theorem IsOpen.exists_smooth_support_eq {s : Set E} (hs : IsOpen s) :
β f : E β β, f.support = s β§ ContDiff β β€ f β§ Set.range f β Set.Icc 0 1 := by
rcases eq_empty_or_nonempty s with (rfl | h's)
Β· exact
β¨fun _ => 0, Function.support_zero, contDiff_const, by
simp only [range_const, singleton_subset_iff, left_mem_Icc, zero_le_one]β©
let ΞΉ := { f : E β β // f.support β s β§ HasCompactSupport f β§ ContDiff β β€ f β§ range f β Icc 0 1 }
obtain β¨T, T_count, hTβ© : β T : Set ΞΉ, T.Countable β§ β f β T, support (f : E β β) = s := by
have : β f : ΞΉ, (f : E β β).support = s := by
refine Subset.antisymm (iUnion_subset fun f => f.2.1) ?_
intro x hx
rcases exists_smooth_tsupport_subset (hs.mem_nhds hx) with β¨f, hfβ©
let g : ΞΉ := β¨f, (subset_tsupport f).trans hf.1, hf.2.1, hf.2.2.1, hf.2.2.2.1β©
have : x β support (g : E β β) := by
simp only [hf.2.2.2.2, Subtype.coe_mk, mem_support, Ne, one_ne_zero, not_false_iff]
exact mem_iUnion_of_mem _ this
simp_rw [β this]
apply isOpen_iUnion_countable
rintro β¨f, hfβ©
exact hf.2.2.1.continuous.isOpen_support
obtain β¨g0, hgβ© : β g0 : β β ΞΉ, T = range g0 := by
apply Countable.exists_eq_range T_count
rcases eq_empty_or_nonempty T with (rfl | hT)
Β· simp only [ΞΉ, iUnion_false, iUnion_empty] at hT
simp only [β hT, mem_empty_iff_false, iUnion_of_empty, iUnion_empty, Set.not_nonempty_empty]
at h's
Β· exact hT
let g : β β E β β := fun n => (g0 n).1
have g_s : β n, support (g n) β s := fun n => (g0 n).2.1
have s_g : β x β s, β n, x β support (g n) := fun x hx β¦ by
rw [β hT] at hx
obtain β¨i, iT, hiβ© : β i β T, x β support (i : E β β) := by
simpa only [mem_iUnion, exists_prop] using hx
rw [hg, mem_range] at iT
rcases iT with β¨n, hnβ©
rw [β hn] at hi
exact β¨n, hiβ©
have g_smooth : β n, ContDiff β β€ (g n) := fun n => (g0 n).2.2.2.1
have g_comp_supp : β n, HasCompactSupport (g n) := fun n => (g0 n).2.2.1
have g_nonneg : β n x, 0 β€ g n x := fun n x => ((g0 n).2.2.2.2 (mem_range_self x)).1
obtain β¨Ξ΄, Ξ΄pos, c, Ξ΄c, c_ltβ© :
β Ξ΄ : β β ββ₯0, (β i : β, 0 < Ξ΄ i) β§ β c : NNReal, HasSum Ξ΄ c β§ c < 1 :=
NNReal.exists_pos_sum_of_countable one_ne_zero β
have : β n : β, β r : β, 0 < r β§ β i β€ n, β x, βiteratedFDeriv β i (r β’ g n) xβ β€ Ξ΄ n := by
intro n
have : β i, β R, β x, βiteratedFDeriv β i (fun x => g n x) xβ β€ R := by
intro i
have : BddAbove (range fun x => βiteratedFDeriv β i (fun x : E => g n x) xβ) := by
apply
((g_smooth n).continuous_iteratedFDeriv le_top).norm.bddAbove_range_of_hasCompactSupport
apply HasCompactSupport.comp_left _ norm_zero
apply (g_comp_supp n).iteratedFDeriv
rcases this with β¨R, hRβ©
exact β¨R, fun x => hR (mem_range_self _)β©
choose R hR using this
let M := max (((Finset.range (n + 1)).image R).max' (by simp)) 1
have Ξ΄npos : 0 < Ξ΄ n := Ξ΄pos n
have IR : β i β€ n, R i β€ M := by
intro i hi
refine le_trans ?_ (le_max_left _ _)
apply Finset.le_max'
apply Finset.mem_image_of_mem
-- Porting note: was
-- simp only [Finset.mem_range]
-- linarith
simpa only [Finset.mem_range, Nat.lt_add_one_iff]
refine β¨Mβ»ΒΉ * Ξ΄ n, by positivity, fun i hi x => ?_β©
calc
βiteratedFDeriv β i ((Mβ»ΒΉ * Ξ΄ n) β’ g n) xβ = β(Mβ»ΒΉ * Ξ΄ n) β’ iteratedFDeriv β i (g n) xβ := by
rw [iteratedFDeriv_const_smul_apply]; exact (g_smooth n).of_le le_top
_ = Mβ»ΒΉ * Ξ΄ n * βiteratedFDeriv β i (g n) xβ := by
rw [norm_smul _ (iteratedFDeriv β i (g n) x), Real.norm_of_nonneg]; positivity
_ β€ Mβ»ΒΉ * Ξ΄ n * M := (mul_le_mul_of_nonneg_left ((hR i x).trans (IR i hi)) (by positivity))
_ = Ξ΄ n := by field_simp
choose r rpos hr using this
have S : β x, Summable fun n => (r n β’ g n) x := fun x β¦ by
refine .of_nnnorm_bounded _ Ξ΄c.summable fun n => ?_
rw [β NNReal.coe_le_coe, coe_nnnorm]
simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) x
refine β¨fun x => β' n, (r n β’ g n) x, ?_, ?_, ?_β©
Β· apply Subset.antisymm
Β· intro x hx
simp only [Pi.smul_apply, Algebra.id.smul_eq_mul, mem_support, Ne] at hx
contrapose! hx
have : β n, g n x = 0 := by
intro n
contrapose! hx
exact g_s n hx
simp only [this, mul_zero, tsum_zero]
Β· intro x hx
obtain β¨n, hnβ© : β n, x β support (g n) := s_g x hx
have I : 0 < r n * g n x := mul_pos (rpos n) (lt_of_le_of_ne (g_nonneg n x) (Ne.symm hn))
exact ne_of_gt (tsum_pos (S x) (fun i => mul_nonneg (rpos i).le (g_nonneg i x)) n I)
Β· refine
contDiff_tsum_of_eventually (fun n => (g_smooth n).const_smul (r n))
(fun k _ => (NNReal.hasSum_coe.2 Ξ΄c).summable) ?_
intro i _
simp only [Nat.cofinite_eq_atTop, Pi.smul_apply, Algebra.id.smul_eq_mul,
Filter.eventually_atTop, ge_iff_le]
exact β¨i, fun n hn x => hr _ _ hn _β©
Β· rintro - β¨y, rflβ©
refine β¨tsum_nonneg fun n => mul_nonneg (rpos n).le (g_nonneg n y), le_trans ?_ c_lt.leβ©
have A : HasSum (fun n => (Ξ΄ n : β)) c := NNReal.hasSum_coe.2 Ξ΄c
simp only [Pi.smul_apply, smul_eq_mul, NNReal.val_eq_coe, β A.tsum_eq, ge_iff_le]
apply tsum_le_tsum _ (S y) A.summable
intro n
apply (le_abs_self _).trans
simpa only [norm_iteratedFDeriv_zero] using hr n 0 (zero_le n) y
#align is_open.exists_smooth_support_eq IsOpen.exists_smooth_support_eq
end
section
namespace ExistsContDiffBumpBase
def Ο : E β β :=
(closedBall (0 : E) 1).indicator fun _ => (1 : β)
#align exists_cont_diff_bump_base.Ο ExistsContDiffBumpBase.Ο
variable [NormedSpace β E] [FiniteDimensional β E]
section HelperDefinitions
variable (E)
theorem u_exists :
β u : E β β,
ContDiff β β€ u β§ (β x, u x β Icc (0 : β) 1) β§ support u = ball 0 1 β§ β x, u (-x) = u x := by
have A : IsOpen (ball (0 : E) 1) := isOpen_ball
obtain β¨f, f_support, f_smooth, f_rangeβ© :
β f : E β β, f.support = ball (0 : E) 1 β§ ContDiff β β€ f β§ Set.range f β Set.Icc 0 1 :=
A.exists_smooth_support_eq
have B : β x, f x β Icc (0 : β) 1 := fun x => f_range (mem_range_self x)
refine β¨fun x => (f x + f (-x)) / 2, ?_, ?_, ?_, ?_β©
Β· exact (f_smooth.add (f_smooth.comp contDiff_neg)).div_const _
Β· intro x
simp only [mem_Icc]
constructor
Β· linarith [(B x).1, (B (-x)).1]
Β· linarith [(B x).2, (B (-x)).2]
Β· refine support_eq_iff.2 β¨fun x hx => ?_, fun x hx => ?_β©
Β· apply ne_of_gt
have : 0 < f x := by
apply lt_of_le_of_ne (B x).1 (Ne.symm _)
rwa [β f_support] at hx
linarith [(B (-x)).1]
Β· have I1 : x β support f := by rwa [f_support]
have I2 : -x β support f := by
rw [f_support]
simpa using hx
simp only [mem_support, Classical.not_not] at I1 I2
simp only [I1, I2, add_zero, zero_div]
Β· intro x; simp only [add_comm, neg_neg]
#align exists_cont_diff_bump_base.u_exists ExistsContDiffBumpBase.u_exists
variable {E}
def u (x : E) : β :=
Classical.choose (u_exists E) x
#align exists_cont_diff_bump_base.u ExistsContDiffBumpBase.u
variable (E)
theorem u_smooth : ContDiff β β€ (u : E β β) :=
(Classical.choose_spec (u_exists E)).1
#align exists_cont_diff_bump_base.u_smooth ExistsContDiffBumpBase.u_smooth
theorem u_continuous : Continuous (u : E β β) :=
(u_smooth E).continuous
#align exists_cont_diff_bump_base.u_continuous ExistsContDiffBumpBase.u_continuous
theorem u_support : support (u : E β β) = ball 0 1 :=
(Classical.choose_spec (u_exists E)).2.2.1
#align exists_cont_diff_bump_base.u_support ExistsContDiffBumpBase.u_support
theorem u_compact_support : HasCompactSupport (u : E β β) := by
rw [hasCompactSupport_def, u_support, closure_ball (0 : E) one_ne_zero]
exact isCompact_closedBall _ _
#align exists_cont_diff_bump_base.u_compact_support ExistsContDiffBumpBase.u_compact_support
variable {E}
theorem u_nonneg (x : E) : 0 β€ u x :=
((Classical.choose_spec (u_exists E)).2.1 x).1
#align exists_cont_diff_bump_base.u_nonneg ExistsContDiffBumpBase.u_nonneg
theorem u_le_one (x : E) : u x β€ 1 :=
((Classical.choose_spec (u_exists E)).2.1 x).2
#align exists_cont_diff_bump_base.u_le_one ExistsContDiffBumpBase.u_le_one
theorem u_neg (x : E) : u (-x) = u x :=
(Classical.choose_spec (u_exists E)).2.2.2 x
#align exists_cont_diff_bump_base.u_neg ExistsContDiffBumpBase.u_neg
variable [MeasurableSpace E] [BorelSpace E]
local notation "ΞΌ" => MeasureTheory.Measure.addHaar
variable (E)
theorem u_int_pos : 0 < β« x : E, u x βΞΌ := by
refine (integral_pos_iff_support_of_nonneg u_nonneg ?_).mpr ?_
Β· exact (u_continuous E).integrable_of_hasCompactSupport (u_compact_support E)
Β· rw [u_support]; exact measure_ball_pos _ _ zero_lt_one
#align exists_cont_diff_bump_base.u_int_pos ExistsContDiffBumpBase.u_int_pos
variable {E}
-- Porting note: `W` upper case
set_option linter.uppercaseLean3 false
def w (D : β) (x : E) : β :=
((β« x : E, u x βΞΌ) * |D| ^ finrank β E)β»ΒΉ β’ u (Dβ»ΒΉ β’ x)
#align exists_cont_diff_bump_base.W ExistsContDiffBumpBase.w
theorem w_def (D : β) :
(w D : E β β) = fun x => ((β« x : E, u x βΞΌ) * |D| ^ finrank β E)β»ΒΉ β’ u (Dβ»ΒΉ β’ x) := by
ext1 x; rfl
#align exists_cont_diff_bump_base.W_def ExistsContDiffBumpBase.w_def
theorem w_nonneg (D : β) (x : E) : 0 β€ w D x := by
apply mul_nonneg _ (u_nonneg _)
apply inv_nonneg.2
apply mul_nonneg (u_int_pos E).le
norm_cast
apply pow_nonneg (abs_nonneg D)
#align exists_cont_diff_bump_base.W_nonneg ExistsContDiffBumpBase.w_nonneg
theorem w_mul_Ο_nonneg (D : β) (x y : E) : 0 β€ w D y * Ο (x - y) :=
mul_nonneg (w_nonneg D y) (indicator_nonneg (by simp only [zero_le_one, imp_true_iff]) _)
#align exists_cont_diff_bump_base.W_mul_Ο_nonneg ExistsContDiffBumpBase.w_mul_Ο_nonneg
variable (E)
theorem w_integral {D : β} (Dpos : 0 < D) : β« x : E, w D x βΞΌ = 1 := by
simp_rw [w, integral_smul]
rw [integral_comp_inv_smul_of_nonneg ΞΌ (u : E β β) Dpos.le, abs_of_nonneg Dpos.le, mul_comm]
field_simp [(u_int_pos E).ne']
#align exists_cont_diff_bump_base.W_integral ExistsContDiffBumpBase.w_integral
theorem w_support {D : β} (Dpos : 0 < D) : support (w D : E β β) = ball 0 D := by
have B : D β’ ball (0 : E) 1 = ball 0 D := by
rw [smul_unitBall Dpos.ne', Real.norm_of_nonneg Dpos.le]
have C : D ^ finrank β E β 0 := by
norm_cast
exact pow_ne_zero _ Dpos.ne'
simp only [w_def, Algebra.id.smul_eq_mul, support_mul, support_inv, univ_inter,
support_comp_inv_smulβ Dpos.ne', u_support, B, support_const (u_int_pos E).ne', support_const C,
abs_of_nonneg Dpos.le]
#align exists_cont_diff_bump_base.W_support ExistsContDiffBumpBase.w_support
theorem w_compact_support {D : β} (Dpos : 0 < D) : HasCompactSupport (w D : E β β) := by
rw [hasCompactSupport_def, w_support E Dpos, closure_ball (0 : E) Dpos.ne']
exact isCompact_closedBall _ _
#align exists_cont_diff_bump_base.W_compact_support ExistsContDiffBumpBase.w_compact_support
variable {E}
def y (D : β) : E β β :=
w D β[lsmul β β, ΞΌ] Ο
#align exists_cont_diff_bump_base.Y ExistsContDiffBumpBase.y
theorem y_neg (D : β) (x : E) : y D (-x) = y D x := by
apply convolution_neg_of_neg_eq
Β· filter_upwards with x
simp only [w_def, Real.rpow_natCast, mul_inv_rev, smul_neg, u_neg, smul_eq_mul, forall_const]
Β· filter_upwards with x
simp only [Ο, indicator, mem_closedBall, dist_zero_right, norm_neg, forall_const]
#align exists_cont_diff_bump_base.Y_neg ExistsContDiffBumpBase.y_neg
theorem y_eq_one_of_mem_closedBall {D : β} {x : E} (Dpos : 0 < D)
(hx : x β closedBall (0 : E) (1 - D)) : y D x = 1 := by
change (w D β[lsmul β β, ΞΌ] Ο) x = 1
have B : β y : E, y β ball x D β Ο y = 1 := by
have C : ball x D β ball 0 1 := by
apply ball_subset_ball'
simp only [mem_closedBall] at hx
linarith only [hx]
intro y hy
simp only [Ο, indicator, mem_closedBall, ite_eq_left_iff, not_le, zero_ne_one]
intro h'y
linarith only [mem_ball.1 (C hy), h'y]
have Bx : Ο x = 1 := B _ (mem_ball_self Dpos)
have B' : β y, y β ball x D β Ο y = Ο x := by rw [Bx]; exact B
rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']
simp only [lsmul_apply, Algebra.id.smul_eq_mul, integral_mul_right, w_integral E Dpos, Bx,
one_mul]
#align exists_cont_diff_bump_base.Y_eq_one_of_mem_closed_ball ExistsContDiffBumpBase.y_eq_one_of_mem_closedBall
| Mathlib/Analysis/Calculus/BumpFunction/FiniteDimension.lean | 384 | 399 | theorem y_eq_zero_of_not_mem_ball {D : β} {x : E} (Dpos : 0 < D) (hx : x β ball (0 : E) (1 + D)) :
y D x = 0 := by |
change (w D β[lsmul β β, ΞΌ] Ο) x = 0
have B : β y, y β ball x D β Ο y = 0 := by
intro y hy
simp only [Ο, indicator, mem_closedBall_zero_iff, ite_eq_right_iff, one_ne_zero]
intro h'y
have C : ball y D β ball 0 (1 + D) := by
apply ball_subset_ball'
rw [β dist_zero_right] at h'y
linarith only [h'y]
exact hx (C (mem_ball_comm.1 hy))
have Bx : Ο x = 0 := B _ (mem_ball_self Dpos)
have B' : β y, y β ball x D β Ο y = Ο x := by rw [Bx]; exact B
rw [convolution_eq_right' _ (le_of_eq (w_support E Dpos)) B']
simp only [lsmul_apply, Algebra.id.smul_eq_mul, Bx, mul_zero, integral_const]
|
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow
import Mathlib.Data.Finset.Fold
import Mathlib.Data.Finset.Option
import Mathlib.Data.Finset.Pi
import Mathlib.Data.Finset.Prod
import Mathlib.Data.Multiset.Lattice
import Mathlib.Data.Set.Lattice
import Mathlib.Order.Hom.Lattice
import Mathlib.Order.Nat
#align_import data.finset.lattice from "leanprover-community/mathlib"@"442a83d738cb208d3600056c489be16900ba701d"
-- TODO:
-- assert_not_exists OrderedCommMonoid
assert_not_exists MonoidWithZero
open Function Multiset OrderDual
variable {F Ξ± Ξ² Ξ³ ΞΉ ΞΊ : Type*}
namespace Finset
section Sup
-- TODO: define with just `[Bot Ξ±]` where some lemmas hold without requiring `[OrderBot Ξ±]`
variable [SemilatticeSup Ξ±] [OrderBot Ξ±]
def sup (s : Finset Ξ²) (f : Ξ² β Ξ±) : Ξ± :=
s.fold (Β· β Β·) β₯ f
#align finset.sup Finset.sup
variable {s sβ sβ : Finset Ξ²} {f g : Ξ² β Ξ±} {a : Ξ±}
theorem sup_def : s.sup f = (s.1.map f).sup :=
rfl
#align finset.sup_def Finset.sup_def
@[simp]
theorem sup_empty : (β
: Finset Ξ²).sup f = β₯ :=
fold_empty
#align finset.sup_empty Finset.sup_empty
@[simp]
theorem sup_cons {b : Ξ²} (h : b β s) : (cons b s h).sup f = f b β s.sup f :=
fold_cons h
#align finset.sup_cons Finset.sup_cons
@[simp]
theorem sup_insert [DecidableEq Ξ²] {b : Ξ²} : (insert b s : Finset Ξ²).sup f = f b β s.sup f :=
fold_insert_idem
#align finset.sup_insert Finset.sup_insert
@[simp]
theorem sup_image [DecidableEq Ξ²] (s : Finset Ξ³) (f : Ξ³ β Ξ²) (g : Ξ² β Ξ±) :
(s.image f).sup g = s.sup (g β f) :=
fold_image_idem
#align finset.sup_image Finset.sup_image
@[simp]
theorem sup_map (s : Finset Ξ³) (f : Ξ³ βͺ Ξ²) (g : Ξ² β Ξ±) : (s.map f).sup g = s.sup (g β f) :=
fold_map
#align finset.sup_map Finset.sup_map
@[simp]
theorem sup_singleton {b : Ξ²} : ({b} : Finset Ξ²).sup f = f b :=
Multiset.sup_singleton
#align finset.sup_singleton Finset.sup_singleton
theorem sup_sup : s.sup (f β g) = s.sup f β s.sup g := by
induction s using Finset.cons_induction with
| empty => rw [sup_empty, sup_empty, sup_empty, bot_sup_eq]
| cons _ _ _ ih =>
rw [sup_cons, sup_cons, sup_cons, ih]
exact sup_sup_sup_comm _ _ _ _
#align finset.sup_sup Finset.sup_sup
theorem sup_congr {f g : Ξ² β Ξ±} (hs : sβ = sβ) (hfg : β a β sβ, f a = g a) :
sβ.sup f = sβ.sup g := by
subst hs
exact Finset.fold_congr hfg
#align finset.sup_congr Finset.sup_congr
@[simp]
theorem _root_.map_finset_sup [SemilatticeSup Ξ²] [OrderBot Ξ²]
[FunLike F Ξ± Ξ²] [SupBotHomClass F Ξ± Ξ²]
(f : F) (s : Finset ΞΉ) (g : ΞΉ β Ξ±) : f (s.sup g) = s.sup (f β g) :=
Finset.cons_induction_on s (map_bot f) fun i s _ h => by
rw [sup_cons, sup_cons, map_sup, h, Function.comp_apply]
#align map_finset_sup map_finset_sup
@[simp]
protected theorem sup_le_iff {a : Ξ±} : s.sup f β€ a β β b β s, f b β€ a := by
apply Iff.trans Multiset.sup_le
simp only [Multiset.mem_map, and_imp, exists_imp]
exact β¨fun k b hb => k _ _ hb rfl, fun k a' b hb h => h βΈ k _ hbβ©
#align finset.sup_le_iff Finset.sup_le_iff
protected alias β¨_, sup_leβ© := Finset.sup_le_iff
#align finset.sup_le Finset.sup_le
theorem sup_const_le : (s.sup fun _ => a) β€ a :=
Finset.sup_le fun _ _ => le_rfl
#align finset.sup_const_le Finset.sup_const_le
theorem le_sup {b : Ξ²} (hb : b β s) : f b β€ s.sup f :=
Finset.sup_le_iff.1 le_rfl _ hb
#align finset.le_sup Finset.le_sup
theorem le_sup_of_le {b : Ξ²} (hb : b β s) (h : a β€ f b) : a β€ s.sup f := h.trans <| le_sup hb
#align finset.le_sup_of_le Finset.le_sup_of_le
theorem sup_union [DecidableEq Ξ²] : (sβ βͺ sβ).sup f = sβ.sup f β sβ.sup f :=
eq_of_forall_ge_iff fun c => by simp [or_imp, forall_and]
#align finset.sup_union Finset.sup_union
@[simp]
theorem sup_biUnion [DecidableEq Ξ²] (s : Finset Ξ³) (t : Ξ³ β Finset Ξ²) :
(s.biUnion t).sup f = s.sup fun x => (t x).sup f :=
eq_of_forall_ge_iff fun c => by simp [@forall_swap _ Ξ²]
#align finset.sup_bUnion Finset.sup_biUnion
theorem sup_const {s : Finset Ξ²} (h : s.Nonempty) (c : Ξ±) : (s.sup fun _ => c) = c :=
eq_of_forall_ge_iff (fun _ => Finset.sup_le_iff.trans h.forall_const)
#align finset.sup_const Finset.sup_const
@[simp]
theorem sup_bot (s : Finset Ξ²) : (s.sup fun _ => β₯) = (β₯ : Ξ±) := by
obtain rfl | hs := s.eq_empty_or_nonempty
Β· exact sup_empty
Β· exact sup_const hs _
#align finset.sup_bot Finset.sup_bot
theorem sup_ite (p : Ξ² β Prop) [DecidablePred p] :
(s.sup fun i => ite (p i) (f i) (g i)) = (s.filter p).sup f β (s.filter fun i => Β¬p i).sup g :=
fold_ite _
#align finset.sup_ite Finset.sup_ite
theorem sup_mono_fun {g : Ξ² β Ξ±} (h : β b β s, f b β€ g b) : s.sup f β€ s.sup g :=
Finset.sup_le fun b hb => le_trans (h b hb) (le_sup hb)
#align finset.sup_mono_fun Finset.sup_mono_fun
@[gcongr]
theorem sup_mono (h : sβ β sβ) : sβ.sup f β€ sβ.sup f :=
Finset.sup_le (fun _ hb => le_sup (h hb))
#align finset.sup_mono Finset.sup_mono
protected theorem sup_comm (s : Finset Ξ²) (t : Finset Ξ³) (f : Ξ² β Ξ³ β Ξ±) :
(s.sup fun b => t.sup (f b)) = t.sup fun c => s.sup fun b => f b c :=
eq_of_forall_ge_iff fun a => by simpa using forallβ_swap
#align finset.sup_comm Finset.sup_comm
@[simp, nolint simpNF] -- Porting note: linter claims that LHS does not simplify
theorem sup_attach (s : Finset Ξ²) (f : Ξ² β Ξ±) : (s.attach.sup fun x => f x) = s.sup f :=
(s.attach.sup_map (Function.Embedding.subtype _) f).symm.trans <| congr_arg _ attach_map_val
#align finset.sup_attach Finset.sup_attach
theorem sup_product_left (s : Finset Ξ²) (t : Finset Ξ³) (f : Ξ² Γ Ξ³ β Ξ±) :
(s ΓΛ’ t).sup f = s.sup fun i => t.sup fun i' => f β¨i, i'β© :=
eq_of_forall_ge_iff fun a => by simp [@forall_swap _ Ξ³]
#align finset.sup_product_left Finset.sup_product_left
| Mathlib/Data/Finset/Lattice.lean | 176 | 178 | theorem sup_product_right (s : Finset Ξ²) (t : Finset Ξ³) (f : Ξ² Γ Ξ³ β Ξ±) :
(s ΓΛ’ t).sup f = t.sup fun i' => s.sup fun i => f β¨i, i'β© := by |
rw [sup_product_left, Finset.sup_comm]
|
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]
theorem Coprime.symm {m n : β+} : m.Coprime n β n.Coprime m := by
unfold Coprime
rw [gcd_comm]
simp
#align pnat.coprime.symm PNat.Coprime.symm
@[simp]
theorem one_coprime {n : β+} : (1 : β+).Coprime n :=
one_gcd
#align pnat.one_coprime PNat.one_coprime
@[simp]
theorem coprime_one {n : β+} : n.Coprime 1 :=
Coprime.symm one_coprime
#align pnat.coprime_one PNat.coprime_one
theorem Coprime.coprime_dvd_left {m k n : β+} : m β£ k β k.Coprime n β m.Coprime n := by
rw [dvd_iff]
repeat rw [β coprime_coe]
apply Nat.Coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
theorem Coprime.factor_eq_gcd_left {a b m n : β+} (cop : m.Coprime n) (am : a β£ m) (bn : b β£ n) :
a = (a * b).gcd m := by
rw [gcd_eq_left_iff_dvd] at am
conv_lhs => rw [β am]
rw [eq_comm]
apply Coprime.gcd_mul_right_cancel a
apply Coprime.coprime_dvd_left bn cop.symm
#align pnat.coprime.factor_eq_gcd_left PNat.Coprime.factor_eq_gcd_left
theorem Coprime.factor_eq_gcd_right {a b m n : β+} (cop : m.Coprime n) (am : a β£ m) (bn : b β£ n) :
a = (b * a).gcd m := by rw [mul_comm]; apply Coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_right PNat.Coprime.factor_eq_gcd_right
theorem Coprime.factor_eq_gcd_left_right {a b m n : β+} (cop : m.Coprime n) (am : a β£ m)
(bn : b β£ n) : a = m.gcd (a * b) := by rw [gcd_comm]; apply Coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_left_right PNat.Coprime.factor_eq_gcd_left_right
theorem Coprime.factor_eq_gcd_right_right {a b m n : β+} (cop : m.Coprime n) (am : a β£ m)
(bn : b β£ n) : a = m.gcd (b * a) := by
rw [gcd_comm]
apply Coprime.factor_eq_gcd_right cop am bn
#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_right
| Mathlib/Data/PNat/Prime.lean | 302 | 305 | theorem Coprime.gcd_mul (k : β+) {m n : β+} (h : m.Coprime n) :
k.gcd (m * n) = k.gcd m * k.gcd n := by |
rw [β coprime_coe] at h; apply eq
simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
|
import Mathlib.Analysis.Calculus.FDeriv.Prod
import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FDeriv
import Mathlib.LinearAlgebra.Dual
#align_import analysis.calculus.lagrange_multipliers from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Topology Filter
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E]
[NormedAddCommGroup F] [NormedSpace β F] [CompleteSpace F] {f : E β F} {Ο : E β β} {xβ : E}
{f' : E βL[β] F} {Ο' : E βL[β] β}
theorem IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn Ο {x | f x = f xβ} xβ) (hf' : HasStrictFDerivAt f f' xβ)
(hΟ' : HasStrictFDerivAt Ο Ο' xβ) : LinearMap.range (f'.prod Ο') β β€ := by
intro htop
set fΟ := fun x => (f x, Ο x)
have A : map Ο (π[f β»ΒΉ' {f xβ}] xβ) = π (Ο xβ) := by
change map (Prod.snd β fΟ) (π[fΟ β»ΒΉ' {p | p.1 = f xβ}] xβ) = π (Ο xβ)
rw [β map_map, nhdsWithin, map_inf_principal_preimage, (hf'.prod hΟ').map_nhds_eq_of_surj htop]
exact map_snd_nhdsWithin _
exact hextr.not_nhds_le_map A.ge
#align is_local_extr_on.range_ne_top_of_has_strict_fderiv_at IsLocalExtrOn.range_ne_top_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
(hextr : IsLocalExtrOn Ο {x | f x = f xβ} xβ) (hf' : HasStrictFDerivAt f f' xβ)
(hΟ' : HasStrictFDerivAt Ο Ο' xβ) :
β (Ξ : Module.Dual β F) (Ξβ : β), (Ξ, Ξβ) β 0 β§ β x, Ξ (f' x) + Ξβ β’ Ο' x = 0 := by
rcases Submodule.exists_le_ker_of_lt_top _
(lt_top_iff_ne_top.2 <| hextr.range_ne_top_of_hasStrictFDerivAt hf' hΟ') with
β¨Ξ', h0, hΞ'β©
set e : ((F ββ[β] β) Γ β) ββ[β] F Γ β ββ[β] β :=
((LinearEquiv.refl β (F ββ[β] β)).prod (LinearMap.ringLmapEquivSelf β β β).symm).trans
(LinearMap.coprodEquiv β)
rcases e.surjective Ξ' with β¨β¨Ξ, Ξββ©, rflβ©
refine β¨Ξ, Ξβ, e.map_ne_zero_iff.1 h0, fun x => ?_β©
convert LinearMap.congr_fun (LinearMap.range_le_ker_iff.1 hΞ') x using 1
-- squeezed `simp [mul_comm]` to speed up elaboration
simp only [e, smul_eq_mul, LinearEquiv.trans_apply, LinearEquiv.prod_apply,
LinearEquiv.refl_apply, LinearMap.ringLmapEquivSelf_symm_apply, LinearMap.coprodEquiv_apply,
ContinuousLinearMap.coe_prod, LinearMap.coprod_comp_prod, LinearMap.add_apply,
LinearMap.coe_comp, ContinuousLinearMap.coe_coe, Function.comp_apply, LinearMap.coe_smulRight,
LinearMap.one_apply, mul_comm]
#align is_local_extr_on.exists_linear_map_of_has_strict_fderiv_at IsLocalExtrOn.exists_linear_map_of_hasStrictFDerivAt
theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d {f : E β β} {f' : E βL[β] β}
(hextr : IsLocalExtrOn Ο {x | f x = f xβ} xβ) (hf' : HasStrictFDerivAt f f' xβ)
(hΟ' : HasStrictFDerivAt Ο Ο' xβ) : β a b : β, (a, b) β 0 β§ a β’ f' + b β’ Ο' = 0 := by
obtain β¨Ξ, Ξβ, hΞ, hfΞβ© := hextr.exists_linear_map_of_hasStrictFDerivAt hf' hΟ'
refine β¨Ξ 1, Ξβ, ?_, ?_β©
Β· contrapose! hΞ
simp only [Prod.mk_eq_zero] at hΞ β’
refine β¨LinearMap.ext fun x => ?_, hΞ.2β©
simpa [hΞ.1] using Ξ.map_smul x 1
Β· ext x
have Hβ : Ξ (f' x) = f' x * Ξ 1 := by
simpa only [mul_one, Algebra.id.smul_eq_mul] using Ξ.map_smul (f' x) 1
have Hβ : f' x * Ξ 1 + Ξβ * Ο' x = 0 := by simpa only [Algebra.id.smul_eq_mul, Hβ] using hfΞ x
simpa [mul_comm] using Hβ
#align is_local_extr_on.exists_multipliers_of_has_strict_fderiv_at_1d IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt_1d
| Mathlib/Analysis/Calculus/LagrangeMultipliers.lean | 108 | 121 | theorem IsLocalExtrOn.exists_multipliers_of_hasStrictFDerivAt {ΞΉ : Type*} [Fintype ΞΉ]
{f : ΞΉ β E β β} {f' : ΞΉ β E βL[β] β} (hextr : IsLocalExtrOn Ο {x | β i, f i x = f i xβ} xβ)
(hf' : β i, HasStrictFDerivAt (f i) (f' i) xβ) (hΟ' : HasStrictFDerivAt Ο Ο' xβ) :
β (Ξ : ΞΉ β β) (Ξβ : β), (Ξ, Ξβ) β 0 β§ (β i, Ξ i β’ f' i) + Ξβ β’ Ο' = 0 := by |
letI := Classical.decEq ΞΉ
replace hextr : IsLocalExtrOn Ο {x | (fun i => f i x) = fun i => f i xβ} xβ := by
simpa only [Function.funext_iff] using hextr
rcases hextr.exists_linear_map_of_hasStrictFDerivAt (hasStrictFDerivAt_pi.2 fun i => hf' i)
hΟ' with
β¨Ξ, Ξβ, h0, hsumβ©
rcases (LinearEquiv.piRing β β ΞΉ β).symm.surjective Ξ with β¨Ξ, rflβ©
refine β¨Ξ, Ξβ, ?_, ?_β©
Β· simpa only [Ne, Prod.ext_iff, LinearEquiv.map_eq_zero_iff, Prod.fst_zero] using h0
Β· ext x; simpa [mul_comm] using hsum x
|
import Mathlib.Algebra.Module.Zlattice.Basic
import Mathlib.NumberTheory.NumberField.Embeddings
import Mathlib.NumberTheory.NumberField.FractionalIdeal
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional Finset
local notation "E" K =>
({w : InfinitePlace K // IsReal w} β β) Γ ({w : InfinitePlace K // IsComplex w} β β)
noncomputable def _root_.NumberField.mixedEmbedding : K β+* (E K) :=
RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop)
(Pi.ringHom fun w => w.val.embedding)
instance [NumberField K] : Nontrivial (E K) := by
obtain β¨wβ© := (inferInstance : Nonempty (InfinitePlace K))
obtain hw | hw := w.isReal_or_isComplex
Β· have : Nonempty {w : InfinitePlace K // IsReal w} := β¨β¨w, hwβ©β©
exact nontrivial_prod_left
Β· have : Nonempty {w : InfinitePlace K // IsComplex w} := β¨β¨w, hwβ©β©
exact nontrivial_prod_right
protected theorem finrank [NumberField K] : finrank β (E K) = finrank β K := by
classical
rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const,
card_univ, β NrRealPlaces, β NrComplexPlaces, β card_real_embeddings, Algebra.id.smul_eq_mul,
mul_comm, β card_complex_embeddings, β NumberField.Embeddings.card K β,
Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)]
theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] :
Function.Injective (NumberField.mixedEmbedding K) := by
exact RingHom.injective _
noncomputable section norm
open scoped Classical
variable {K}
def normAtPlace (w : InfinitePlace K) : (E K) β*β β where
toFun x := if hw : IsReal w then βx.1 β¨w, hwβ©β else βx.2 β¨w, not_isReal_iff_isComplex.mp hwβ©β
map_zero' := by simp
map_one' := by simp
map_mul' x y := by split_ifs <;> simp
theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) :
0 β€ normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_nonneg _
theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) :
normAtPlace w (- x) = normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> simp
theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) :
normAtPlace w (x + y) β€ normAtPlace w x + normAtPlace w y := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_add_le _ _
theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : β) :
normAtPlace w (c β’ x) = |c| * normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs
Β· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs]
Β· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
theorem normAtPlace_real (w : InfinitePlace K) (c : β) :
normAtPlace w ((fun _ β¦ c, fun _ β¦ c) : (E K)) = |c| := by
rw [show ((fun _ β¦ c, fun _ β¦ c) : (E K)) = c β’ 1 by ext <;> simp, normAtPlace_smul, map_one,
mul_one]
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean | 286 | 288 | theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K):
normAtPlace w x = βx.1 β¨w, hwβ©β := by |
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos]
|
import Mathlib.Algebra.DualNumber
import Mathlib.Algebra.QuaternionBasis
import Mathlib.Data.Complex.Module
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.CliffordAlgebra.Star
import Mathlib.LinearAlgebra.QuadraticForm.Prod
#align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e"
open CliffordAlgebra
namespace CliffordAlgebraComplex
open scoped ComplexConjugate
def Q : QuadraticForm β β :=
-QuadraticForm.sq (R := β) -- Porting note: Added `(R := β)`
set_option linter.uppercaseLean3 false in
#align clifford_algebra_complex.Q CliffordAlgebraComplex.Q
@[simp]
theorem Q_apply (r : β) : Q r = -(r * r) :=
rfl
set_option linter.uppercaseLean3 false in
#align clifford_algebra_complex.Q_apply CliffordAlgebraComplex.Q_apply
def toComplex : CliffordAlgebra Q ββ[β] β :=
CliffordAlgebra.lift Q
β¨LinearMap.toSpanSingleton _ _ Complex.I, fun r => by
dsimp [LinearMap.toSpanSingleton, LinearMap.id]
rw [mul_mul_mul_comm]
simpβ©
#align clifford_algebra_complex.to_complex CliffordAlgebraComplex.toComplex
@[simp]
theorem toComplex_ΞΉ (r : β) : toComplex (ΞΉ Q r) = r β’ Complex.I :=
CliffordAlgebra.lift_ΞΉ_apply _ _ r
#align clifford_algebra_complex.to_complex_ΞΉ CliffordAlgebraComplex.toComplex_ΞΉ
@[simp]
theorem toComplex_involute (c : CliffordAlgebra Q) :
toComplex (involute c) = conj (toComplex c) := by
have : toComplex (involute (ΞΉ Q 1)) = conj (toComplex (ΞΉ Q 1)) := by
simp only [involute_ΞΉ, toComplex_ΞΉ, AlgHom.map_neg, one_smul, Complex.conj_I]
suffices toComplex.comp involute = Complex.conjAe.toAlgHom.comp toComplex by
exact AlgHom.congr_fun this c
ext : 2
exact this
#align clifford_algebra_complex.to_complex_involute CliffordAlgebraComplex.toComplex_involute
def ofComplex : β ββ[β] CliffordAlgebra Q :=
Complex.lift
β¨CliffordAlgebra.ΞΉ Q 1, by
rw [CliffordAlgebra.ΞΉ_sq_scalar, Q_apply, one_mul, RingHom.map_neg, RingHom.map_one]β©
#align clifford_algebra_complex.of_complex CliffordAlgebraComplex.ofComplex
@[simp]
theorem ofComplex_I : ofComplex Complex.I = ΞΉ Q 1 :=
Complex.liftAux_apply_I _ (by simp)
set_option linter.uppercaseLean3 false in
#align clifford_algebra_complex.of_complex_I CliffordAlgebraComplex.ofComplex_I
@[simp]
| Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean | 182 | 185 | theorem toComplex_comp_ofComplex : toComplex.comp ofComplex = AlgHom.id β β := by |
ext1
dsimp only [AlgHom.comp_apply, Subtype.coe_mk, AlgHom.id_apply]
rw [ofComplex_I, toComplex_ΞΉ, one_smul]
|
import Mathlib.MeasureTheory.Measure.AEMeasurable
#align_import dynamics.ergodic.measure_preserving from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7"
variable {Ξ± Ξ² Ξ³ Ξ΄ : Type*} [MeasurableSpace Ξ±] [MeasurableSpace Ξ²] [MeasurableSpace Ξ³]
[MeasurableSpace Ξ΄]
namespace MeasureTheory
open Measure Function Set
variable {ΞΌa : Measure Ξ±} {ΞΌb : Measure Ξ²} {ΞΌc : Measure Ξ³} {ΞΌd : Measure Ξ΄}
structure MeasurePreserving (f : Ξ± β Ξ²)
(ΞΌa : Measure Ξ± := by volume_tac) (ΞΌb : Measure Ξ² := by volume_tac) : Prop where
protected measurable : Measurable f
protected map_eq : map f ΞΌa = ΞΌb
#align measure_theory.measure_preserving MeasureTheory.MeasurePreserving
#align measure_theory.measure_preserving.measurable MeasureTheory.MeasurePreserving.measurable
#align measure_theory.measure_preserving.map_eq MeasureTheory.MeasurePreserving.map_eq
protected theorem _root_.Measurable.measurePreserving
{f : Ξ± β Ξ²} (h : Measurable f) (ΞΌa : Measure Ξ±) : MeasurePreserving f ΞΌa (map f ΞΌa) :=
β¨h, rflβ©
#align measurable.measure_preserving Measurable.measurePreserving
namespace MeasurePreserving
protected theorem id (ΞΌ : Measure Ξ±) : MeasurePreserving id ΞΌ ΞΌ :=
β¨measurable_id, map_idβ©
#align measure_theory.measure_preserving.id MeasureTheory.MeasurePreserving.id
protected theorem aemeasurable {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) : AEMeasurable f ΞΌa :=
hf.1.aemeasurable
#align measure_theory.measure_preserving.ae_measurable MeasureTheory.MeasurePreserving.aemeasurable
@[nontriviality]
theorem of_isEmpty [IsEmpty Ξ²] (f : Ξ± β Ξ²) (ΞΌa : Measure Ξ±) (ΞΌb : Measure Ξ²) :
MeasurePreserving f ΞΌa ΞΌb :=
β¨measurable_of_subsingleton_codomain _, Subsingleton.elim _ _β©
theorem symm (e : Ξ± βα΅ Ξ²) {ΞΌa : Measure Ξ±} {ΞΌb : Measure Ξ²} (h : MeasurePreserving e ΞΌa ΞΌb) :
MeasurePreserving e.symm ΞΌb ΞΌa :=
β¨e.symm.measurable, by
rw [β h.map_eq, map_map e.symm.measurable e.measurable, e.symm_comp_self, map_id]β©
#align measure_theory.measure_preserving.symm MeasureTheory.MeasurePreserving.symm
theorem restrict_preimage {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) {s : Set Ξ²}
(hs : MeasurableSet s) : MeasurePreserving f (ΞΌa.restrict (f β»ΒΉ' s)) (ΞΌb.restrict s) :=
β¨hf.measurable, by rw [β hf.map_eq, restrict_map hf.measurable hs]β©
#align measure_theory.measure_preserving.restrict_preimage MeasureTheory.MeasurePreserving.restrict_preimage
theorem restrict_preimage_emb {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb)
(hβ : MeasurableEmbedding f) (s : Set Ξ²) :
MeasurePreserving f (ΞΌa.restrict (f β»ΒΉ' s)) (ΞΌb.restrict s) :=
β¨hf.measurable, by rw [β hf.map_eq, hβ.restrict_map]β©
#align measure_theory.measure_preserving.restrict_preimage_emb MeasureTheory.MeasurePreserving.restrict_preimage_emb
theorem restrict_image_emb {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) (hβ : MeasurableEmbedding f)
(s : Set Ξ±) : MeasurePreserving f (ΞΌa.restrict s) (ΞΌb.restrict (f '' s)) := by
simpa only [Set.preimage_image_eq _ hβ.injective] using hf.restrict_preimage_emb hβ (f '' s)
#align measure_theory.measure_preserving.restrict_image_emb MeasureTheory.MeasurePreserving.restrict_image_emb
theorem aemeasurable_comp_iff {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb)
(hβ : MeasurableEmbedding f) {g : Ξ² β Ξ³} : AEMeasurable (g β f) ΞΌa β AEMeasurable g ΞΌb := by
rw [β hf.map_eq, hβ.aemeasurable_map_iff]
#align measure_theory.measure_preserving.ae_measurable_comp_iff MeasureTheory.MeasurePreserving.aemeasurable_comp_iff
protected theorem quasiMeasurePreserving {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) :
QuasiMeasurePreserving f ΞΌa ΞΌb :=
β¨hf.1, hf.2.absolutelyContinuousβ©
#align measure_theory.measure_preserving.quasi_measure_preserving MeasureTheory.MeasurePreserving.quasiMeasurePreserving
protected theorem comp {g : Ξ² β Ξ³} {f : Ξ± β Ξ²} (hg : MeasurePreserving g ΞΌb ΞΌc)
(hf : MeasurePreserving f ΞΌa ΞΌb) : MeasurePreserving (g β f) ΞΌa ΞΌc :=
β¨hg.1.comp hf.1, by rw [β map_map hg.1 hf.1, hf.2, hg.2]β©
#align measure_theory.measure_preserving.comp MeasureTheory.MeasurePreserving.comp
protected theorem trans {e : Ξ± βα΅ Ξ²} {e' : Ξ² βα΅ Ξ³}
{ΞΌa : Measure Ξ±} {ΞΌb : Measure Ξ²} {ΞΌc : Measure Ξ³}
(h : MeasurePreserving e ΞΌa ΞΌb) (h' : MeasurePreserving e' ΞΌb ΞΌc) :
MeasurePreserving (e.trans e') ΞΌa ΞΌc :=
h'.comp h
protected theorem comp_left_iff {g : Ξ± β Ξ²} {e : Ξ² βα΅ Ξ³} (h : MeasurePreserving e ΞΌb ΞΌc) :
MeasurePreserving (e β g) ΞΌa ΞΌc β MeasurePreserving g ΞΌa ΞΌb := by
refine β¨fun hg => ?_, fun hg => h.comp hgβ©
convert (MeasurePreserving.symm e h).comp hg
simp [β Function.comp.assoc e.symm e g]
#align measure_theory.measure_preserving.comp_left_iff MeasureTheory.MeasurePreserving.comp_left_iff
protected theorem comp_right_iff {g : Ξ± β Ξ²} {e : Ξ³ βα΅ Ξ±} (h : MeasurePreserving e ΞΌc ΞΌa) :
MeasurePreserving (g β e) ΞΌc ΞΌb β MeasurePreserving g ΞΌa ΞΌb := by
refine β¨fun hg => ?_, fun hg => hg.comp hβ©
convert hg.comp (MeasurePreserving.symm e h)
simp [Function.comp.assoc g e e.symm]
#align measure_theory.measure_preserving.comp_right_iff MeasureTheory.MeasurePreserving.comp_right_iff
protected theorem sigmaFinite {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) [SigmaFinite ΞΌb] :
SigmaFinite ΞΌa :=
SigmaFinite.of_map ΞΌa hf.aemeasurable (by rwa [hf.map_eq])
#align measure_theory.measure_preserving.sigma_finite MeasureTheory.MeasurePreserving.sigmaFinite
theorem measure_preimage {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb) {s : Set Ξ²}
(hs : MeasurableSet s) : ΞΌa (f β»ΒΉ' s) = ΞΌb s := by rw [β hf.map_eq, map_apply hf.1 hs]
#align measure_theory.measure_preserving.measure_preimage MeasureTheory.MeasurePreserving.measure_preimage
theorem measure_preimage_emb {f : Ξ± β Ξ²} (hf : MeasurePreserving f ΞΌa ΞΌb)
(hfe : MeasurableEmbedding f) (s : Set Ξ²) : ΞΌa (f β»ΒΉ' s) = ΞΌb s := by
rw [β hf.map_eq, hfe.map_apply]
#align measure_theory.measure_preserving.measure_preimage_emb MeasureTheory.MeasurePreserving.measure_preimage_emb
protected theorem iterate {f : Ξ± β Ξ±} (hf : MeasurePreserving f ΞΌa ΞΌa) :
β n, MeasurePreserving f^[n] ΞΌa ΞΌa
| 0 => MeasurePreserving.id ΞΌa
| n + 1 => (MeasurePreserving.iterate hf n).comp hf
#align measure_theory.measure_preserving.iterate MeasureTheory.MeasurePreserving.iterate
variable {ΞΌ : Measure Ξ±} {f : Ξ± β Ξ±} {s : Set Ξ±}
open scoped symmDiff in
lemma measure_symmDiff_preimage_iterate_le
(hf : MeasurePreserving f ΞΌ ΞΌ) (hs : MeasurableSet s) (n : β) :
ΞΌ (s β (f^[n] β»ΒΉ' s)) β€ n β’ ΞΌ (s β (f β»ΒΉ' s)) := by
induction' n with n ih; Β· simp
simp only [add_smul, one_smul, β n.add_one]
refine le_trans (measure_symmDiff_le s (f^[n] β»ΒΉ' s) (f^[n+1] β»ΒΉ' s)) (add_le_add ih ?_)
replace hs : MeasurableSet (s β (f β»ΒΉ' s)) := hs.symmDiff <| hf.measurable hs
rw [iterate_succ', preimage_comp, β preimage_symmDiff, (hf.iterate n).measure_preimage hs]
theorem exists_mem_iterate_mem_of_volume_lt_mul_volume (hf : MeasurePreserving f ΞΌ ΞΌ)
(hs : MeasurableSet s) {n : β} (hvol : ΞΌ (Set.univ : Set Ξ±) < n * ΞΌ s) :
β x β s, β m β Set.Ioo 0 n, f^[m] x β s := by
have A : β m, MeasurableSet (f^[m] β»ΒΉ' s) := fun m β¦ (hf.iterate m).measurable hs
have B : β m, ΞΌ (f^[m] β»ΒΉ' s) = ΞΌ s := fun m β¦ (hf.iterate m).measure_preimage hs
have : ΞΌ (univ : Set Ξ±) < β m β Finset.range n, ΞΌ (f^[m] β»ΒΉ' s) := by simpa [B]
obtain β¨i, hi, j, hj, hij, x, hxi : f^[i] x β s, hxj : f^[j] x β sβ© :
β i < n, β j < n, i β j β§ (f^[i] β»ΒΉ' s β© f^[j] β»ΒΉ' s).Nonempty := by
simpa using exists_nonempty_inter_of_measure_univ_lt_sum_measure ΞΌ (fun m _ β¦ A m) this
wlog hlt : i < j generalizing i j
Β· exact this j hj i hi hij.symm hxj hxi (hij.lt_or_lt.resolve_left hlt)
refine β¨f^[i] x, hxi, j - i, β¨tsub_pos_of_lt hlt, lt_of_le_of_lt (j.sub_le i) hjβ©, ?_β©
rwa [β iterate_add_apply, tsub_add_cancel_of_le hlt.le]
#align measure_theory.measure_preserving.exists_mem_image_mem_of_volume_lt_mul_volume MeasureTheory.MeasurePreserving.exists_mem_iterate_mem_of_volume_lt_mul_volume
| Mathlib/Dynamics/Ergodic/MeasurePreserving.lean | 182 | 186 | theorem exists_mem_iterate_mem [IsFiniteMeasure ΞΌ] (hf : MeasurePreserving f ΞΌ ΞΌ)
(hs : MeasurableSet s) (hs' : ΞΌ s β 0) : β x β s, β m β 0, f^[m] x β s := by |
rcases ENNReal.exists_nat_mul_gt hs' (measure_ne_top ΞΌ (Set.univ : Set Ξ±)) with β¨N, hNβ©
rcases hf.exists_mem_iterate_mem_of_volume_lt_mul_volume hs hN with β¨x, hx, m, hm, hmxβ©
exact β¨x, hx, m, hm.1.ne', hmxβ©
|
import Mathlib.Topology.FiberBundle.Trivialization
import Mathlib.Topology.Order.LeftRightNhds
#align_import topology.fiber_bundle.basic from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833"
variable {ΞΉ B F X : Type*} [TopologicalSpace X]
open TopologicalSpace Filter Set Bundle Topology
-- Porting note(#5171): was @[nolint has_nonempty_instance]
structure FiberBundleCore (ΞΉ : Type*) (B : Type*) [TopologicalSpace B] (F : Type*)
[TopologicalSpace F] where
baseSet : ΞΉ β Set B
isOpen_baseSet : β i, IsOpen (baseSet i)
indexAt : B β ΞΉ
mem_baseSet_at : β x, x β baseSet (indexAt x)
coordChange : ΞΉ β ΞΉ β B β F β F
coordChange_self : β i, β x β baseSet i, β v, coordChange i i x v = v
continuousOn_coordChange : β i j,
ContinuousOn (fun p : B Γ F => coordChange i j p.1 p.2) ((baseSet i β© baseSet j) ΓΛ’ univ)
coordChange_comp : β i j k, β x β baseSet i β© baseSet j β© baseSet k, β v,
(coordChange j k x) (coordChange i j x v) = coordChange i k x v
#align fiber_bundle_core FiberBundleCore
namespace FiberBundleCore
variable [TopologicalSpace B] [TopologicalSpace F] (Z : FiberBundleCore ΞΉ B F)
@[nolint unusedArguments] -- Porting note(#5171): was has_nonempty_instance
def Index (_Z : FiberBundleCore ΞΉ B F) := ΞΉ
#align fiber_bundle_core.index FiberBundleCore.Index
@[nolint unusedArguments, reducible]
def Base (_Z : FiberBundleCore ΞΉ B F) := B
#align fiber_bundle_core.base FiberBundleCore.Base
@[nolint unusedArguments] -- Porting note(#5171): was has_nonempty_instance
def Fiber (_ : FiberBundleCore ΞΉ B F) (_x : B) := F
#align fiber_bundle_core.fiber FiberBundleCore.Fiber
instance topologicalSpaceFiber (x : B) : TopologicalSpace (Z.Fiber x) := βΉ_βΊ
#align fiber_bundle_core.topological_space_fiber FiberBundleCore.topologicalSpaceFiber
abbrev TotalSpace := Bundle.TotalSpace F Z.Fiber
#align fiber_bundle_core.total_space FiberBundleCore.TotalSpace
@[reducible, simp, mfld_simps]
def proj : Z.TotalSpace β B :=
Bundle.TotalSpace.proj
#align fiber_bundle_core.proj FiberBundleCore.proj
def trivChange (i j : ΞΉ) : PartialHomeomorph (B Γ F) (B Γ F) where
source := (Z.baseSet i β© Z.baseSet j) ΓΛ’ univ
target := (Z.baseSet i β© Z.baseSet j) ΓΛ’ univ
toFun p := β¨p.1, Z.coordChange i j p.1 p.2β©
invFun p := β¨p.1, Z.coordChange j i p.1 p.2β©
map_source' p hp := by simpa using hp
map_target' p hp := by simpa using hp
left_inv' := by
rintro β¨x, vβ© hx
simp only [prod_mk_mem_set_prod_eq, mem_inter_iff, and_true, mem_univ] at hx
dsimp only
rw [coordChange_comp, Z.coordChange_self]
exacts [hx.1, β¨β¨hx.1, hx.2β©, hx.1β©]
right_inv' := by
rintro β¨x, vβ© hx
simp only [prod_mk_mem_set_prod_eq, mem_inter_iff, and_true_iff, mem_univ] at hx
dsimp only
rw [Z.coordChange_comp, Z.coordChange_self]
Β· exact hx.2
Β· simp [hx]
open_source := ((Z.isOpen_baseSet i).inter (Z.isOpen_baseSet j)).prod isOpen_univ
open_target := ((Z.isOpen_baseSet i).inter (Z.isOpen_baseSet j)).prod isOpen_univ
continuousOn_toFun := continuous_fst.continuousOn.prod (Z.continuousOn_coordChange i j)
continuousOn_invFun := by
simpa [inter_comm] using continuous_fst.continuousOn.prod (Z.continuousOn_coordChange j i)
#align fiber_bundle_core.triv_change FiberBundleCore.trivChange
@[simp, mfld_simps]
theorem mem_trivChange_source (i j : ΞΉ) (p : B Γ F) :
p β (Z.trivChange i j).source β p.1 β Z.baseSet i β© Z.baseSet j := by
erw [mem_prod]
simp
#align fiber_bundle_core.mem_triv_change_source FiberBundleCore.mem_trivChange_source
def localTrivAsPartialEquiv (i : ΞΉ) : PartialEquiv Z.TotalSpace (B Γ F) where
source := Z.proj β»ΒΉ' Z.baseSet i
target := Z.baseSet i ΓΛ’ univ
invFun p := β¨p.1, Z.coordChange i (Z.indexAt p.1) p.1 p.2β©
toFun p := β¨p.1, Z.coordChange (Z.indexAt p.1) i p.1 p.2β©
map_source' p hp := by
simpa only [Set.mem_preimage, and_true_iff, Set.mem_univ, Set.prod_mk_mem_set_prod_eq] using hp
map_target' p hp := by
simpa only [Set.mem_preimage, and_true_iff, Set.mem_univ, Set.mem_prod] using hp
left_inv' := by
rintro β¨x, vβ© hx
replace hx : x β Z.baseSet i := hx
dsimp only
rw [Z.coordChange_comp, Z.coordChange_self] <;> apply_rules [mem_baseSet_at, mem_inter]
right_inv' := by
rintro β¨x, vβ© hx
simp only [prod_mk_mem_set_prod_eq, and_true_iff, mem_univ] at hx
dsimp only
rw [Z.coordChange_comp, Z.coordChange_self]
exacts [hx, β¨β¨hx, Z.mem_baseSet_at _β©, hxβ©]
#align fiber_bundle_core.local_triv_as_local_equiv FiberBundleCore.localTrivAsPartialEquiv
variable (i : ΞΉ)
theorem mem_localTrivAsPartialEquiv_source (p : Z.TotalSpace) :
p β (Z.localTrivAsPartialEquiv i).source β p.1 β Z.baseSet i :=
Iff.rfl
#align fiber_bundle_core.mem_local_triv_as_local_equiv_source FiberBundleCore.mem_localTrivAsPartialEquiv_source
theorem mem_localTrivAsPartialEquiv_target (p : B Γ F) :
p β (Z.localTrivAsPartialEquiv i).target β p.1 β Z.baseSet i := by
erw [mem_prod]
simp only [and_true_iff, mem_univ]
#align fiber_bundle_core.mem_local_triv_as_local_equiv_target FiberBundleCore.mem_localTrivAsPartialEquiv_target
theorem localTrivAsPartialEquiv_apply (p : Z.TotalSpace) :
(Z.localTrivAsPartialEquiv i) p = β¨p.1, Z.coordChange (Z.indexAt p.1) i p.1 p.2β© :=
rfl
#align fiber_bundle_core.local_triv_as_local_equiv_apply FiberBundleCore.localTrivAsPartialEquiv_apply
theorem localTrivAsPartialEquiv_trans (i j : ΞΉ) :
(Z.localTrivAsPartialEquiv i).symm.trans (Z.localTrivAsPartialEquiv j) β
(Z.trivChange i j).toPartialEquiv := by
constructor
Β· ext x
simp only [mem_localTrivAsPartialEquiv_target, mfld_simps]
rfl
Β· rintro β¨x, vβ© hx
simp only [trivChange, localTrivAsPartialEquiv, PartialEquiv.symm, true_and_iff,
Prod.mk.inj_iff, prod_mk_mem_set_prod_eq, PartialEquiv.trans_source, mem_inter_iff,
and_true_iff, mem_preimage, proj, mem_univ, eq_self_iff_true, (Β· β Β·),
PartialEquiv.coe_trans, TotalSpace.proj] at hx β’
simp only [Z.coordChange_comp, hx, mem_inter_iff, and_self_iff, mem_baseSet_at]
#align fiber_bundle_core.local_triv_as_local_equiv_trans FiberBundleCore.localTrivAsPartialEquiv_trans
instance toTopologicalSpace : TopologicalSpace (Bundle.TotalSpace F Z.Fiber) :=
TopologicalSpace.generateFrom <| β (i : ΞΉ) (s : Set (B Γ F)) (_ : IsOpen s),
{(Z.localTrivAsPartialEquiv i).source β© Z.localTrivAsPartialEquiv i β»ΒΉ' s}
#align fiber_bundle_core.to_topological_space FiberBundleCore.toTopologicalSpace
variable (b : B) (a : F)
theorem open_source' (i : ΞΉ) : IsOpen (Z.localTrivAsPartialEquiv i).source := by
apply TopologicalSpace.GenerateOpen.basic
simp only [exists_prop, mem_iUnion, mem_singleton_iff]
refine β¨i, Z.baseSet i ΓΛ’ univ, (Z.isOpen_baseSet i).prod isOpen_univ, ?_β©
ext p
simp only [localTrivAsPartialEquiv_apply, prod_mk_mem_set_prod_eq, mem_inter_iff, and_self_iff,
mem_localTrivAsPartialEquiv_source, and_true, mem_univ, mem_preimage]
#align fiber_bundle_core.open_source' FiberBundleCore.open_source'
def localTriv (i : ΞΉ) : Trivialization F Z.proj where
baseSet := Z.baseSet i
open_baseSet := Z.isOpen_baseSet i
source_eq := rfl
target_eq := rfl
proj_toFun p _ := by
simp only [mfld_simps]
rfl
open_source := Z.open_source' i
open_target := (Z.isOpen_baseSet i).prod isOpen_univ
continuousOn_toFun := by
rw [continuousOn_open_iff (Z.open_source' i)]
intro s s_open
apply TopologicalSpace.GenerateOpen.basic
simp only [exists_prop, mem_iUnion, mem_singleton_iff]
exact β¨i, s, s_open, rflβ©
continuousOn_invFun := by
refine continuousOn_isOpen_of_generateFrom fun t ht β¦ ?_
simp only [exists_prop, mem_iUnion, mem_singleton_iff] at ht
obtain β¨j, s, s_open, tsβ© : β j s, IsOpen s β§
t = (localTrivAsPartialEquiv Z j).source β© localTrivAsPartialEquiv Z j β»ΒΉ' s := ht
rw [ts]
simp only [PartialEquiv.right_inv, preimage_inter, PartialEquiv.left_inv]
let e := Z.localTrivAsPartialEquiv i
let e' := Z.localTrivAsPartialEquiv j
let f := e.symm.trans e'
have : IsOpen (f.source β© f β»ΒΉ' s) := by
rw [PartialEquiv.EqOnSource.source_inter_preimage_eq (Z.localTrivAsPartialEquiv_trans i j)]
exact (continuousOn_open_iff (Z.trivChange i j).open_source).1
(Z.trivChange i j).continuousOn _ s_open
convert this using 1
dsimp [f, PartialEquiv.trans_source]
rw [β preimage_comp, inter_assoc]
toPartialEquiv := Z.localTrivAsPartialEquiv i
#align fiber_bundle_core.local_triv FiberBundleCore.localTriv
def localTrivAt (b : B) : Trivialization F (Ο F Z.Fiber) :=
Z.localTriv (Z.indexAt b)
#align fiber_bundle_core.local_triv_at FiberBundleCore.localTrivAt
@[simp, mfld_simps]
theorem localTrivAt_def (b : B) : Z.localTriv (Z.indexAt b) = Z.localTrivAt b :=
rfl
#align fiber_bundle_core.local_triv_at_def FiberBundleCore.localTrivAt_def
theorem localTrivAt_snd (b : B) (p) :
(Z.localTrivAt b p).2 = Z.coordChange (Z.indexAt p.1) (Z.indexAt b) p.1 p.2 :=
rfl
theorem continuous_const_section (v : F)
(h : β i j, β x β Z.baseSet i β© Z.baseSet j, Z.coordChange i j x v = v) :
Continuous (show B β Z.TotalSpace from fun x => β¨x, vβ©) := by
refine continuous_iff_continuousAt.2 fun x => ?_
have A : Z.baseSet (Z.indexAt x) β π x :=
IsOpen.mem_nhds (Z.isOpen_baseSet (Z.indexAt x)) (Z.mem_baseSet_at x)
refine ((Z.localTrivAt x).toPartialHomeomorph.continuousAt_iff_continuousAt_comp_left ?_).2 ?_
Β· exact A
Β· apply continuousAt_id.prod
simp only [(Β· β Β·), mfld_simps, localTrivAt_snd]
have : ContinuousOn (fun _ : B => v) (Z.baseSet (Z.indexAt x)) := continuousOn_const
refine (this.congr fun y hy β¦ ?_).continuousAt A
exact h _ _ _ β¨mem_baseSet_at _ _, hyβ©
#align fiber_bundle_core.continuous_const_section FiberBundleCore.continuous_const_section
@[simp, mfld_simps]
theorem localTrivAsPartialEquiv_coe : β(Z.localTrivAsPartialEquiv i) = Z.localTriv i :=
rfl
#align fiber_bundle_core.local_triv_as_local_equiv_coe FiberBundleCore.localTrivAsPartialEquiv_coe
@[simp, mfld_simps]
theorem localTrivAsPartialEquiv_source :
(Z.localTrivAsPartialEquiv i).source = (Z.localTriv i).source :=
rfl
#align fiber_bundle_core.local_triv_as_local_equiv_source FiberBundleCore.localTrivAsPartialEquiv_source
@[simp, mfld_simps]
theorem localTrivAsPartialEquiv_target :
(Z.localTrivAsPartialEquiv i).target = (Z.localTriv i).target :=
rfl
#align fiber_bundle_core.local_triv_as_local_equiv_target FiberBundleCore.localTrivAsPartialEquiv_target
@[simp, mfld_simps]
theorem localTrivAsPartialEquiv_symm :
(Z.localTrivAsPartialEquiv i).symm = (Z.localTriv i).toPartialEquiv.symm :=
rfl
#align fiber_bundle_core.local_triv_as_local_equiv_symm FiberBundleCore.localTrivAsPartialEquiv_symm
@[simp, mfld_simps]
theorem baseSet_at : Z.baseSet i = (Z.localTriv i).baseSet :=
rfl
#align fiber_bundle_core.base_set_at FiberBundleCore.baseSet_at
@[simp, mfld_simps]
theorem localTriv_apply (p : Z.TotalSpace) :
(Z.localTriv i) p = β¨p.1, Z.coordChange (Z.indexAt p.1) i p.1 p.2β© :=
rfl
#align fiber_bundle_core.local_triv_apply FiberBundleCore.localTriv_apply
@[simp, mfld_simps]
| Mathlib/Topology/FiberBundle/Basic.lean | 668 | 670 | theorem localTrivAt_apply (p : Z.TotalSpace) : (Z.localTrivAt p.1) p = β¨p.1, p.2β© := by |
rw [localTrivAt, localTriv_apply, coordChange_self]
exact Z.mem_baseSet_at p.1
|
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 35 | 41 | theorem hasStrictDerivAt_sin (x : β) : HasStrictDerivAt sin (cos x) x := by |
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : β)β»ΒΉ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
|
import Mathlib.Control.Applicative
import Mathlib.Control.Traversable.Basic
import Mathlib.Data.List.Forall2
import Mathlib.Data.Set.Functor
#align_import control.traversable.instances from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607"
universe u v
section Option
open Functor
variable {F G : Type u β Type u}
variable [Applicative F] [Applicative G]
variable [LawfulApplicative F] [LawfulApplicative G]
| Mathlib/Control/Traversable/Instances.lean | 31 | 32 | theorem Option.id_traverse {Ξ±} (x : Option Ξ±) : Option.traverse (pure : Ξ± β Id Ξ±) x = x := by |
cases x <;> rfl
|
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Control.Functor
import Mathlib.Data.SProd
import Mathlib.Util.CompileInductive
import Batteries.Tactic.Lint.Basic
#align_import data.list.defs from "leanprover-community/mathlib"@"d2d8742b0c21426362a9dacebc6005db895ca963"
-- Porting note
-- Many of the definitions in `Data.List.Defs` were already defined upstream in `Batteries`
-- These have been annotated with `#align`s
-- To make this easier for review, the `#align`s have been placed in order of occurrence
-- in `mathlib`
namespace List
open Function Nat
universe u v w x
variable {Ξ± Ξ² Ξ³ Ξ΄ Ξ΅ ΞΆ : Type*}
instance [DecidableEq Ξ±] : SDiff (List Ξ±) :=
β¨List.diffβ©
#align list.replicate List.replicate
#align list.split_at List.splitAt
#align list.split_on_p List.splitOnP
#align list.split_on List.splitOn
#align list.concat List.concat
#align list.head' List.head?
-- mathlib3 `array` is not ported.
#noalign list.to_array
#align list.nthd List.getD
-- Porting note: see
-- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/List.2Ehead/near/313204716
-- for the fooI naming convention.
def getI [Inhabited Ξ±] (l : List Ξ±) (n : Nat) : Ξ± :=
getD l n default
#align list.inth List.getI
def takeI [Inhabited Ξ±] (n : Nat) (l : List Ξ±) : List Ξ± :=
takeD n l default
#align list.take' List.takeI
#align list.modify_nth_tail List.modifyNthTail
#align list.modify_head List.modifyHead
#align list.modify_nth List.modifyNth
#align list.modify_last List.modifyLast
#align list.insert_nth List.insertNth
#align list.take_while List.takeWhile
#align list.scanl List.scanl
#align list.scanr List.scanr
#align list.partition_map List.partitionMap
#align list.find List.find?
def findM {Ξ±} {m : Type u β Type v} [Alternative m] (tac : Ξ± β m PUnit) : List Ξ± β m Ξ± :=
List.firstM fun a => (tac a) $> a
#align list.mfind List.findM
def findM?'
{m : Type u β Type v}
[Monad m] {Ξ± : Type u}
(p : Ξ± β m (ULift Bool)) : List Ξ± β m (Option Ξ±)
| [] => pure none
| x :: xs => do
let β¨pxβ© β p x
if px then pure (some x) else findM?' p xs
#align list.mbfind' List.findM?'
#align list.mbfind List.findM?
#align list.many List.anyM
#align list.mall List.allM
section
variable {m : Type β Type v} [Monad m]
def orM : List (m Bool) β m Bool :=
anyM id
#align list.mbor List.orM
def andM : List (m Bool) β m Bool :=
allM id
#align list.mband List.andM
end
#align list.foldr_with_index List.foldrIdx
#align list.foldl_with_index List.foldlIdx
#align list.find_indexes List.findIdxs
#align list.indexes_values List.indexesValues
#align list.indexes_of List.indexesOf
#align list.lookmap List.lookmap
#align list.countp List.countP
#align list.count List.count
#align list.is_prefix List.IsPrefix
#align list.is_suffix List.IsSuffix
#align list.is_infix List.IsInfix
#align list.inits List.inits
#align list.tails List.tails
#align list.sublists' List.sublists'
#align list.sublists List.sublists
#align list.forallβ List.Forallβ
@[simp]
def Forall (p : Ξ± β Prop) : List Ξ± β Prop
| [] => True
| x :: [] => p x
| x :: l => p x β§ Forall p l
#align list.allβ List.Forall
#align list.transpose List.transpose
#align list.sections List.sections
#align list.erasep List.erasePβ -- prop -> bool
def extractp (p : Ξ± β Prop) [DecidablePred p] : List Ξ± β Option Ξ± Γ List Ξ±
| [] => (none, [])
| a :: l =>
if p a then (some a, l)
else
let (a', l') := extractp p l
(a', a :: l')
#align list.extractp List.extractp
#align list.revzip List.revzip
#align list.product List.product
instance instSProd : SProd (List Ξ±) (List Ξ²) (List (Ξ± Γ Ξ²)) where
sprod := List.product
#align list.sigma List.sigma
#align list.of_fn List.ofFn
#align list.of_fn_nth_val List.ofFnNthVal
#align list.disjoint List.Disjoint
#align list.pairwise List.Pairwise
#align list.pairwise_cons List.pairwise_cons
#align list.decidable_pairwise List.instDecidablePairwise
#align list.pw_filter List.pwFilter
#align list.chain List.Chain
#align list.chain' List.Chain'
#align list.chain_cons List.chain_cons
#align list.nodup List.Nodup
#align list.nodup_decidable List.nodupDecidable
def dedup [DecidableEq Ξ±] : List Ξ± β List Ξ± :=
pwFilter (Β· β Β·)
#align list.dedup List.dedup
def destutter' (R : Ξ± β Ξ± β Prop) [DecidableRel R] : Ξ± β List Ξ± β List Ξ±
| a, [] => [a]
| a, h :: l => if R a h then a :: destutter' R h l else destutter' R a l
#align list.destutter' List.destutter'
-- TODO: should below be "lazily"?
def destutter (R : Ξ± β Ξ± β Prop) [DecidableRel R] : List Ξ± β List Ξ±
| h :: l => destutter' R h l
| [] => []
#align list.destutter List.destutter
#align list.range' List.range'
#align list.reduce_option List.reduceOption
-- Porting note: replace ilast' by getLastD
#align list.ilast' List.ilast'
-- Porting note: remove last' from Batteries
#align list.last' List.getLast?
#align list.rotate List.rotate
#align list.rotate' List.rotate'
#align list.mmap_filter List.filterMapM
#align list.mmap_upper_triangle List.mapDiagM
def mapDiagM' {m} [Monad m] {Ξ±} (f : Ξ± β Ξ± β m Unit) : List Ξ± β m Unit
| [] => return ()
| h :: t => do
_ β f h h
_ β t.mapM' (f h)
t.mapDiagM' f
-- as ported:
-- | [] => return ()
-- | h :: t => (f h h >> t.mapM' (f h)) >> t.mapDiagM'
#align list.mmap'_diag List.mapDiagM'
#align list.traverse List.traverse
#align list.get_rest List.getRest
#align list.slice List.dropSlice
@[simp]
def mapβLeft' (f : Ξ± β Option Ξ² β Ξ³) : List Ξ± β List Ξ² β List Ξ³ Γ List Ξ²
| [], bs => ([], bs)
| a :: as, [] => ((a :: as).map fun a => f a none, [])
| a :: as, b :: bs =>
let rec' := mapβLeft' f as bs
(f a (some b) :: rec'.fst, rec'.snd)
#align list.mapβ_left' List.mapβLeft'
def mapβRight' (f : Option Ξ± β Ξ² β Ξ³) (as : List Ξ±) (bs : List Ξ²) : List Ξ³ Γ List Ξ± :=
mapβLeft' (flip f) bs as
#align list.mapβ_right' List.mapβRight'
@[simp]
def mapβLeft (f : Ξ± β Option Ξ² β Ξ³) : List Ξ± β List Ξ² β List Ξ³
| [], _ => []
| a :: as, [] => (a :: as).map fun a => f a none
| a :: as, b :: bs => f a (some b) :: mapβLeft f as bs
#align list.mapβ_left List.mapβLeft
def mapβRight (f : Option Ξ± β Ξ² β Ξ³) (as : List Ξ±) (bs : List Ξ²) : List Ξ³ :=
mapβLeft (flip f) bs as
#align list.mapβ_right List.mapβRight
#align list.zip_right List.zipRight
#align list.zip_left' List.zipLeft'
#align list.zip_right' List.zipRight'
#align list.zip_left List.zipLeft
#align list.all_some List.allSome
#align list.fill_nones List.fillNones
#align list.take_list List.takeList
#align list.to_rbmap List.toRBMap
#align list.to_chunks_aux List.toChunksAux
#align list.to_chunks List.toChunks
-- porting note -- was `unsafe` but removed for Lean 4 port
-- TODO: naming is awkward...
def mapAsyncChunked {Ξ± Ξ²} (f : Ξ± β Ξ²) (xs : List Ξ±) (chunk_size := 1024) : List Ξ² :=
((xs.toChunks chunk_size).map fun xs => Task.spawn fun _ => List.map f xs).bind Task.get
#align list.map_async_chunked List.mapAsyncChunked
def zipWith3 (f : Ξ± β Ξ² β Ξ³ β Ξ΄) : List Ξ± β List Ξ² β List Ξ³ β List Ξ΄
| x :: xs, y :: ys, z :: zs => f x y z :: zipWith3 f xs ys zs
| _, _, _ => []
#align list.zip_with3 List.zipWith3
def zipWith4 (f : Ξ± β Ξ² β Ξ³ β Ξ΄ β Ξ΅) : List Ξ± β List Ξ² β List Ξ³ β List Ξ΄ β List Ξ΅
| x :: xs, y :: ys, z :: zs, u :: us => f x y z u :: zipWith4 f xs ys zs us
| _, _, _, _ => []
#align list.zip_with4 List.zipWith4
def zipWith5 (f : Ξ± β Ξ² β Ξ³ β Ξ΄ β Ξ΅ β ΞΆ) : List Ξ± β List Ξ² β List Ξ³ β List Ξ΄ β List Ξ΅ β List ΞΆ
| x :: xs, y :: ys, z :: zs, u :: us, v :: vs => f x y z u v :: zipWith5 f xs ys zs us vs
| _, _, _, _, _ => []
#align list.zip_with5 List.zipWith5
def replaceIf : List Ξ± β List Bool β List Ξ± β List Ξ±
| l, _, [] => l
| [], _, _ => []
| l, [], _ => l
| n :: ns, tf :: bs, e@(c :: cs) => if tf then c :: ns.replaceIf bs cs else n :: ns.replaceIf bs e
#align list.replace_if List.replaceIf
#align list.map_with_prefix_suffix_aux List.mapWithPrefixSuffixAux
#align list.map_with_prefix_suffix List.mapWithPrefixSuffix
#align list.map_with_complement List.mapWithComplement
@[simp]
def iterate (f : Ξ± β Ξ±) (a : Ξ±) : (n : β) β List Ξ±
| 0 => []
| n + 1 => a :: iterate f (f a) n
@[inline]
def iterateTR (f : Ξ± β Ξ±) (a : Ξ±) (n : β) : List Ξ± :=
loop a n []
where
@[simp, specialize]
loop (a : Ξ±) (n : β) (l : List Ξ±) : List Ξ± :=
match n with
| 0 => reverse l
| n + 1 => loop (f a) n (a :: l)
| Mathlib/Data/List/Defs.lean | 569 | 571 | theorem iterateTR_loop_eq (f : Ξ± β Ξ±) (a : Ξ±) (n : β) (l : List Ξ±) :
iterateTR.loop f a n l = reverse l ++ iterate f a n := by |
induction n generalizing a l <;> simp [*]
|
import Mathlib.CategoryTheory.Limits.Shapes.Biproducts
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero
#align_import category_theory.limits.preserves.shapes.biproducts from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe wβ wβ vβ vβ uβ uβ
noncomputable section
open CategoryTheory
open CategoryTheory.Limits
namespace CategoryTheory
variable {C : Type uβ} [Category.{vβ} C] {D : Type uβ} [Category.{vβ} D]
section HasZeroMorphisms
variable [HasZeroMorphisms C] [HasZeroMorphisms D]
namespace Functor
section Map
variable (F : C β₯€ D) [PreservesZeroMorphisms F]
variable (F : C β₯€ D) (X Y : C) [HasBinaryBiproduct X Y]
section
variable [HasBinaryBiproduct (F.obj X) (F.obj Y)]
def biprodComparison : F.obj (X β Y) βΆ F.obj X β F.obj Y :=
biprod.lift (F.map biprod.fst) (F.map biprod.snd)
#align category_theory.functor.biprod_comparison CategoryTheory.Functor.biprodComparison
@[reassoc (attr := simp)]
theorem biprodComparison_fst : biprodComparison F X Y β« biprod.fst = F.map biprod.fst :=
biprod.lift_fst _ _
#align category_theory.functor.biprod_comparison_fst CategoryTheory.Functor.biprodComparison_fst
@[reassoc (attr := simp)]
theorem biprodComparison_snd : biprodComparison F X Y β« biprod.snd = F.map biprod.snd :=
biprod.lift_snd _ _
#align category_theory.functor.biprod_comparison_snd CategoryTheory.Functor.biprodComparison_snd
def biprodComparison' : F.obj X β F.obj Y βΆ F.obj (X β Y) :=
biprod.desc (F.map biprod.inl) (F.map biprod.inr)
#align category_theory.functor.biprod_comparison' CategoryTheory.Functor.biprodComparison'
@[reassoc (attr := simp)]
theorem inl_biprodComparison' : biprod.inl β« biprodComparison' F X Y = F.map biprod.inl :=
biprod.inl_desc _ _
#align category_theory.functor.inl_biprod_comparison' CategoryTheory.Functor.inl_biprodComparison'
@[reassoc (attr := simp)]
theorem inr_biprodComparison' : biprod.inr β« biprodComparison' F X Y = F.map biprod.inr :=
biprod.inr_desc _ _
#align category_theory.functor.inr_biprod_comparison' CategoryTheory.Functor.inr_biprodComparison'
variable [PreservesZeroMorphisms F]
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Biproducts.lean | 349 | 351 | theorem biprodComparison'_comp_biprodComparison :
biprodComparison' F X Y β« biprodComparison F X Y = π (F.obj X β F.obj Y) := by |
ext <;> simp [β Functor.map_comp]
|
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {Ο Ο : Type*} {r : R} {e : β} {n m : Ο} {s : Ο ββ β}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial Ο R}
section Vars
def vars (p : MvPolynomial Ο R) : Finset Ο :=
letI := Classical.decEq Ο
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq Ο] (p : MvPolynomial Ο R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial Ο R).vars = β
:= by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r β 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
| Mathlib/Algebra/MvPolynomial/Variables.lean | 87 | 88 | theorem vars_C : (C r : MvPolynomial Ο R).vars = β
:= by |
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
|
import Mathlib.Topology.Bases
import Mathlib.Order.Filter.CountableInter
import Mathlib.Topology.Compactness.SigmaCompact
open Set Filter Topology TopologicalSpace
universe u v
variable {X : Type u} {Y : Type v} {ΞΉ : Type*}
variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X}
section Lindelof
def IsLindelof (s : Set X) :=
β β¦fβ¦ [NeBot f] [CountableInterFilter f], f β€ π s β β x β s, ClusterPt x f
theorem IsLindelof.compl_mem_sets (hs : IsLindelof s) {f : Filter X} [CountableInterFilter f]
(hf : β x β s, sαΆ β π x β f) : sαΆ β f := by
contrapose! hf
simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf β’
exact hs inf_le_right
theorem IsLindelof.compl_mem_sets_of_nhdsWithin (hs : IsLindelof s) {f : Filter X}
[CountableInterFilter f] (hf : β x β s, β t β π[s] x, tαΆ β f) : sαΆ β f := by
refine hs.compl_mem_sets fun x hx β¦ ?_
rw [β disjoint_principal_right, disjoint_right_comm, (basis_sets _).disjoint_iff_left]
exact hf x hx
@[elab_as_elim]
theorem IsLindelof.induction_on (hs : IsLindelof s) {p : Set X β Prop}
(hmono : β β¦s tβ¦, s β t β p t β p s)
(hcountable_union : β (S : Set (Set X)), S.Countable β (β s β S, p s) β p (ββ S))
(hnhds : β x β s, β t β π[s] x, p t) : p s := by
let f : Filter X := ofCountableUnion p hcountable_union (fun t ht _ hsub β¦ hmono hsub ht)
have : sαΆ β f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds)
rwa [β compl_compl s]
theorem IsLindelof.inter_right (hs : IsLindelof s) (ht : IsClosed t) : IsLindelof (s β© t) := by
intro f hnf _ hstf
rw [β inf_principal, le_inf_iff] at hstf
obtain β¨x, hsx, hxβ© : β x β s, ClusterPt x f := hs hstf.1
have hxt : x β t := ht.mem_of_nhdsWithin_neBot <| hx.mono hstf.2
exact β¨x, β¨hsx, hxtβ©, hxβ©
theorem IsLindelof.inter_left (ht : IsLindelof t) (hs : IsClosed s) : IsLindelof (s β© t) :=
inter_comm t s βΈ ht.inter_right hs
theorem IsLindelof.diff (hs : IsLindelof s) (ht : IsOpen t) : IsLindelof (s \ t) :=
hs.inter_right (isClosed_compl_iff.mpr ht)
theorem IsLindelof.of_isClosed_subset (hs : IsLindelof s) (ht : IsClosed t) (h : t β s) :
IsLindelof t := inter_eq_self_of_subset_right h βΈ hs.inter_right ht
theorem IsLindelof.image_of_continuousOn {f : X β Y} (hs : IsLindelof s) (hf : ContinuousOn f s) :
IsLindelof (f '' s) := by
intro l lne _ ls
have : NeBot (l.comap f β π s) :=
comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls)
obtain β¨x, hxs, hxβ© : β x β s, ClusterPt x (l.comap f β π s) := @hs _ this _ inf_le_right
haveI := hx.neBot
use f x, mem_image_of_mem f hxs
have : Tendsto f (π x β (comap f l β π s)) (π (f x) β l) := by
convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1
rw [nhdsWithin]
ac_rfl
exact this.neBot
theorem IsLindelof.image {f : X β Y} (hs : IsLindelof s) (hf : Continuous f) :
IsLindelof (f '' s) := hs.image_of_continuousOn hf.continuousOn
theorem IsLindelof.adherence_nhdset {f : Filter X} [CountableInterFilter f] (hs : IsLindelof s)
(hfβ : f β€ π s) (htβ : IsOpen t) (htβ : β x β s, ClusterPt x f β x β t) : t β f :=
(eq_or_neBot _).casesOn mem_of_eq_bot fun _ β¦
let β¨x, hx, hfxβ© := @hs (f β π tαΆ) _ _ <| inf_le_of_left_le hfβ
have : x β t := htβ x hx hfx.of_inf_left
have : tαΆ β© t β π[tαΆ] x := inter_mem_nhdsWithin _ (htβ.mem_nhds this)
have A : π[tαΆ] x = β₯ := empty_mem_iff_bot.1 <| compl_inter_self t βΈ this
have : π[tαΆ] x β β₯ := hfx.of_inf_right.ne
absurd A this
| Mathlib/Topology/Compactness/Lindelof.lean | 129 | 151 | theorem IsLindelof.elim_countable_subcover {ΞΉ : Type v} (hs : IsLindelof s) (U : ΞΉ β Set X)
(hUo : β i, IsOpen (U i)) (hsU : s β β i, U i) :
β r : Set ΞΉ, r.Countable β§ (s β β i β r, U i) := by |
have hmono : β β¦s t : Set Xβ¦, s β t β (β r : Set ΞΉ, r.Countable β§ t β β i β r, U i)
β (β r : Set ΞΉ, r.Countable β§ s β β i β r, U i) := by
intro _ _ hst β¨r, β¨hrcountable, hsubβ©β©
exact β¨r, hrcountable, Subset.trans hst hsubβ©
have hcountable_union : β (S : Set (Set X)), S.Countable
β (β s β S, β r : Set ΞΉ, r.Countable β§ (s β β i β r, U i))
β β r : Set ΞΉ, r.Countable β§ (ββ S β β i β r, U i) := by
intro S hS hsr
choose! r hr using hsr
refine β¨β s β S, r s, hS.biUnion_iff.mpr (fun s hs β¦ (hr s hs).1), ?_β©
refine sUnion_subset ?h.right.h
simp only [mem_iUnion, exists_prop, iUnion_exists, biUnion_and']
exact fun i is x hx β¦ mem_biUnion is ((hr i is).2 hx)
have h_nhds : β x β s, β t β π[s] x, β r : Set ΞΉ, r.Countable β§ (t β β i β r, U i) := by
intro x hx
let β¨i, hiβ© := mem_iUnion.1 (hsU hx)
refine β¨U i, mem_nhdsWithin_of_mem_nhds ((hUo i).mem_nhds hi), {i}, by simp, ?_β©
simp only [mem_singleton_iff, iUnion_iUnion_eq_left]
exact Subset.refl _
exact hs.induction_on hmono hcountable_union h_nhds
|
import Mathlib.CategoryTheory.Subobject.MonoOver
import Mathlib.CategoryTheory.Skeletal
import Mathlib.CategoryTheory.ConcreteCategory.Basic
import Mathlib.Tactic.ApplyFun
import Mathlib.Tactic.CategoryTheory.Elementwise
#align_import category_theory.subobject.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe vβ vβ uβ uβ
noncomputable section
namespace CategoryTheory
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
variable {C : Type uβ} [Category.{vβ} C] {X Y Z : C}
variable {D : Type uβ} [Category.{vβ} D]
def Subobject (X : C) :=
ThinSkeleton (MonoOver X)
#align category_theory.subobject CategoryTheory.Subobject
instance (X : C) : PartialOrder (Subobject X) := by
dsimp only [Subobject]
infer_instance
namespace Subobject
-- Porting note: made it a def rather than an abbreviation
-- because Lean would make it too transparent
def mk {X A : C} (f : A βΆ X) [Mono f] : Subobject X :=
(toThinSkeleton _).obj (MonoOver.mk' f)
#align category_theory.subobject.mk CategoryTheory.Subobject.mk
section
attribute [local ext] CategoryTheory.Comma
protected theorem ind {X : C} (p : Subobject X β Prop)
(h : β β¦A : Cβ¦ (f : A βΆ X) [Mono f], p (Subobject.mk f)) (P : Subobject X) : p P := by
apply Quotient.inductionOn'
intro a
exact h a.arrow
#align category_theory.subobject.ind CategoryTheory.Subobject.ind
protected theorem indβ {X : C} (p : Subobject X β Subobject X β Prop)
(h : β β¦A B : Cβ¦ (f : A βΆ X) (g : B βΆ X) [Mono f] [Mono g],
p (Subobject.mk f) (Subobject.mk g))
(P Q : Subobject X) : p P Q := by
apply Quotient.inductionOnβ'
intro a b
exact h a.arrow b.arrow
#align category_theory.subobject.indβ CategoryTheory.Subobject.indβ
end
protected def lift {Ξ± : Sort*} {X : C} (F : β β¦A : Cβ¦ (f : A βΆ X) [Mono f], Ξ±)
(h :
β β¦A B : Cβ¦ (f : A βΆ X) (g : B βΆ X) [Mono f] [Mono g] (i : A β
B),
i.hom β« g = f β F f = F g) :
Subobject X β Ξ± := fun P =>
Quotient.liftOn' P (fun m => F m.arrow) fun m n β¨iβ© =>
h m.arrow n.arrow ((MonoOver.forget X β Over.forget X).mapIso i) (Over.w i.hom)
#align category_theory.subobject.lift CategoryTheory.Subobject.lift
@[simp]
protected theorem lift_mk {Ξ± : Sort*} {X : C} (F : β β¦A : Cβ¦ (f : A βΆ X) [Mono f], Ξ±) {h A}
(f : A βΆ X) [Mono f] : Subobject.lift F h (Subobject.mk f) = F f :=
rfl
#align category_theory.subobject.lift_mk CategoryTheory.Subobject.lift_mk
noncomputable def equivMonoOver (X : C) : Subobject X β MonoOver X :=
ThinSkeleton.equivalence _
#align category_theory.subobject.equiv_mono_over CategoryTheory.Subobject.equivMonoOver
noncomputable def representative {X : C} : Subobject X β₯€ MonoOver X :=
(equivMonoOver X).functor
#align category_theory.subobject.representative CategoryTheory.Subobject.representative
noncomputable def representativeIso {X : C} (A : MonoOver X) :
representative.obj ((toThinSkeleton _).obj A) β
A :=
(equivMonoOver X).counitIso.app A
#align category_theory.subobject.representative_iso CategoryTheory.Subobject.representativeIso
noncomputable def underlying {X : C} : Subobject X β₯€ C :=
representative β MonoOver.forget _ β Over.forget _
#align category_theory.subobject.underlying CategoryTheory.Subobject.underlying
instance : CoeOut (Subobject X) C where coe Y := underlying.obj Y
-- Porting note: removed as it has become a syntactic tautology
-- @[simp]
-- theorem underlying_as_coe {X : C} (P : Subobject X) : underlying.obj P = P :=
-- rfl
-- #align category_theory.subobject.underlying_as_coe CategoryTheory.Subobject.underlying_as_coe
noncomputable def underlyingIso {X Y : C} (f : X βΆ Y) [Mono f] : (Subobject.mk f : C) β
X :=
(MonoOver.forget _ β Over.forget _).mapIso (representativeIso (MonoOver.mk' f))
#align category_theory.subobject.underlying_iso CategoryTheory.Subobject.underlyingIso
noncomputable def arrow {X : C} (Y : Subobject X) : (Y : C) βΆ X :=
(representative.obj Y).obj.hom
#align category_theory.subobject.arrow CategoryTheory.Subobject.arrow
instance arrow_mono {X : C} (Y : Subobject X) : Mono Y.arrow :=
(representative.obj Y).property
#align category_theory.subobject.arrow_mono CategoryTheory.Subobject.arrow_mono
@[simp]
theorem arrow_congr {A : C} (X Y : Subobject A) (h : X = Y) :
eqToHom (congr_arg (fun X : Subobject A => (X : C)) h) β« Y.arrow = X.arrow := by
induction h
simp
#align category_theory.subobject.arrow_congr CategoryTheory.Subobject.arrow_congr
@[simp]
theorem representative_coe (Y : Subobject X) : (representative.obj Y : C) = (Y : C) :=
rfl
#align category_theory.subobject.representative_coe CategoryTheory.Subobject.representative_coe
@[simp]
theorem representative_arrow (Y : Subobject X) : (representative.obj Y).arrow = Y.arrow :=
rfl
#align category_theory.subobject.representative_arrow CategoryTheory.Subobject.representative_arrow
@[reassoc (attr := simp)]
theorem underlying_arrow {X : C} {Y Z : Subobject X} (f : Y βΆ Z) :
underlying.map f β« arrow Z = arrow Y :=
Over.w (representative.map f)
#align category_theory.subobject.underlying_arrow CategoryTheory.Subobject.underlying_arrow
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem underlyingIso_arrow {X Y : C} (f : X βΆ Y) [Mono f] :
(underlyingIso f).inv β« (Subobject.mk f).arrow = f :=
Over.w _
#align category_theory.subobject.underlying_iso_arrow CategoryTheory.Subobject.underlyingIso_arrow
@[reassoc (attr := simp)]
theorem underlyingIso_hom_comp_eq_mk {X Y : C} (f : X βΆ Y) [Mono f] :
(underlyingIso f).hom β« f = (mk f).arrow :=
(Iso.eq_inv_comp _).1 (underlyingIso_arrow f).symm
#align category_theory.subobject.underlying_iso_hom_comp_eq_mk CategoryTheory.Subobject.underlyingIso_hom_comp_eq_mk
@[ext]
theorem eq_of_comp_arrow_eq {X Y : C} {P : Subobject Y} {f g : X βΆ P}
(h : f β« P.arrow = g β« P.arrow) : f = g :=
(cancel_mono P.arrow).mp h
#align category_theory.subobject.eq_of_comp_arrow_eq CategoryTheory.Subobject.eq_of_comp_arrow_eq
theorem mk_le_mk_of_comm {B Aβ Aβ : C} {fβ : Aβ βΆ B} {fβ : Aβ βΆ B} [Mono fβ] [Mono fβ] (g : Aβ βΆ Aβ)
(w : g β« fβ = fβ) : mk fβ β€ mk fβ :=
β¨MonoOver.homMk _ wβ©
#align category_theory.subobject.mk_le_mk_of_comm CategoryTheory.Subobject.mk_le_mk_of_comm
@[simp]
theorem mk_arrow (P : Subobject X) : mk P.arrow = P :=
Quotient.inductionOn' P fun Q => by
obtain β¨eβ© := @Quotient.mk_out' _ (isIsomorphicSetoid _) Q
exact Quotient.sound' β¨MonoOver.isoMk (Iso.refl _) βͺβ« eβ©
#align category_theory.subobject.mk_arrow CategoryTheory.Subobject.mk_arrow
theorem le_of_comm {B : C} {X Y : Subobject B} (f : (X : C) βΆ (Y : C)) (w : f β« Y.arrow = X.arrow) :
X β€ Y := by
convert mk_le_mk_of_comm _ w <;> simp
#align category_theory.subobject.le_of_comm CategoryTheory.Subobject.le_of_comm
theorem le_mk_of_comm {B A : C} {X : Subobject B} {f : A βΆ B} [Mono f] (g : (X : C) βΆ A)
(w : g β« f = X.arrow) : X β€ mk f :=
le_of_comm (g β« (underlyingIso f).inv) <| by simp [w]
#align category_theory.subobject.le_mk_of_comm CategoryTheory.Subobject.le_mk_of_comm
theorem mk_le_of_comm {B A : C} {X : Subobject B} {f : A βΆ B} [Mono f] (g : A βΆ (X : C))
(w : g β« X.arrow = f) : mk f β€ X :=
le_of_comm ((underlyingIso f).hom β« g) <| by simp [w]
#align category_theory.subobject.mk_le_of_comm CategoryTheory.Subobject.mk_le_of_comm
@[ext]
theorem eq_of_comm {B : C} {X Y : Subobject B} (f : (X : C) β
(Y : C))
(w : f.hom β« Y.arrow = X.arrow) : X = Y :=
le_antisymm (le_of_comm f.hom w) <| le_of_comm f.inv <| f.inv_comp_eq.2 w.symm
#align category_theory.subobject.eq_of_comm CategoryTheory.Subobject.eq_of_comm
-- Porting note (#11182): removed @[ext]
theorem eq_mk_of_comm {B A : C} {X : Subobject B} (f : A βΆ B) [Mono f] (i : (X : C) β
A)
(w : i.hom β« f = X.arrow) : X = mk f :=
eq_of_comm (i.trans (underlyingIso f).symm) <| by simp [w]
#align category_theory.subobject.eq_mk_of_comm CategoryTheory.Subobject.eq_mk_of_comm
-- Porting note (#11182): removed @[ext]
theorem mk_eq_of_comm {B A : C} {X : Subobject B} (f : A βΆ B) [Mono f] (i : A β
(X : C))
(w : i.hom β« X.arrow = f) : mk f = X :=
Eq.symm <| eq_mk_of_comm _ i.symm <| by rw [Iso.symm_hom, Iso.inv_comp_eq, w]
#align category_theory.subobject.mk_eq_of_comm CategoryTheory.Subobject.mk_eq_of_comm
-- Porting note (#11182): removed @[ext]
theorem mk_eq_mk_of_comm {B Aβ Aβ : C} (f : Aβ βΆ B) (g : Aβ βΆ B) [Mono f] [Mono g] (i : Aβ β
Aβ)
(w : i.hom β« g = f) : mk f = mk g :=
eq_mk_of_comm _ ((underlyingIso f).trans i) <| by simp [w]
#align category_theory.subobject.mk_eq_mk_of_comm CategoryTheory.Subobject.mk_eq_mk_of_comm
-- We make `X` and `Y` explicit arguments here so that when `ofLE` appears in goal statements
-- it is possible to see its source and target
-- (`h` will just display as `_`, because it is in `Prop`).
def ofLE {B : C} (X Y : Subobject B) (h : X β€ Y) : (X : C) βΆ (Y : C) :=
underlying.map <| h.hom
#align category_theory.subobject.of_le CategoryTheory.Subobject.ofLE
@[reassoc (attr := simp)]
theorem ofLE_arrow {B : C} {X Y : Subobject B} (h : X β€ Y) : ofLE X Y h β« Y.arrow = X.arrow :=
underlying_arrow _
#align category_theory.subobject.of_le_arrow CategoryTheory.Subobject.ofLE_arrow
instance {B : C} (X Y : Subobject B) (h : X β€ Y) : Mono (ofLE X Y h) := by
fconstructor
intro Z f g w
replace w := w =β« Y.arrow
ext
simpa using w
theorem ofLE_mk_le_mk_of_comm {B Aβ Aβ : C} {fβ : Aβ βΆ B} {fβ : Aβ βΆ B} [Mono fβ] [Mono fβ]
(g : Aβ βΆ Aβ) (w : g β« fβ = fβ) :
ofLE _ _ (mk_le_mk_of_comm g w) = (underlyingIso _).hom β« g β« (underlyingIso _).inv := by
ext
simp [w]
#align category_theory.subobject.of_le_mk_le_mk_of_comm CategoryTheory.Subobject.ofLE_mk_le_mk_of_comm
def ofLEMk {B A : C} (X : Subobject B) (f : A βΆ B) [Mono f] (h : X β€ mk f) : (X : C) βΆ A :=
ofLE X (mk f) h β« (underlyingIso f).hom
#align category_theory.subobject.of_le_mk CategoryTheory.Subobject.ofLEMk
instance {B A : C} (X : Subobject B) (f : A βΆ B) [Mono f] (h : X β€ mk f) :
Mono (ofLEMk X f h) := by
dsimp only [ofLEMk]
infer_instance
@[simp]
theorem ofLEMk_comp {B A : C} {X : Subobject B} {f : A βΆ B} [Mono f] (h : X β€ mk f) :
ofLEMk X f h β« f = X.arrow := by simp [ofLEMk]
#align category_theory.subobject.of_le_mk_comp CategoryTheory.Subobject.ofLEMk_comp
def ofMkLE {B A : C} (f : A βΆ B) [Mono f] (X : Subobject B) (h : mk f β€ X) : A βΆ (X : C) :=
(underlyingIso f).inv β« ofLE (mk f) X h
#align category_theory.subobject.of_mk_le CategoryTheory.Subobject.ofMkLE
instance {B A : C} (f : A βΆ B) [Mono f] (X : Subobject B) (h : mk f β€ X) :
Mono (ofMkLE f X h) := by
dsimp only [ofMkLE]
infer_instance
@[simp]
theorem ofMkLE_arrow {B A : C} {f : A βΆ B} [Mono f] {X : Subobject B} (h : mk f β€ X) :
ofMkLE f X h β« X.arrow = f := by simp [ofMkLE]
#align category_theory.subobject.of_mk_le_arrow CategoryTheory.Subobject.ofMkLE_arrow
def ofMkLEMk {B Aβ Aβ : C} (f : Aβ βΆ B) (g : Aβ βΆ B) [Mono f] [Mono g] (h : mk f β€ mk g) :
Aβ βΆ Aβ :=
(underlyingIso f).inv β« ofLE (mk f) (mk g) h β« (underlyingIso g).hom
#align category_theory.subobject.of_mk_le_mk CategoryTheory.Subobject.ofMkLEMk
instance {B Aβ Aβ : C} (f : Aβ βΆ B) (g : Aβ βΆ B) [Mono f] [Mono g] (h : mk f β€ mk g) :
Mono (ofMkLEMk f g h) := by
dsimp only [ofMkLEMk]
infer_instance
@[simp]
theorem ofMkLEMk_comp {B Aβ Aβ : C} {f : Aβ βΆ B} {g : Aβ βΆ B} [Mono f] [Mono g] (h : mk f β€ mk g) :
ofMkLEMk f g h β« g = f := by simp [ofMkLEMk]
#align category_theory.subobject.of_mk_le_mk_comp CategoryTheory.Subobject.ofMkLEMk_comp
@[reassoc (attr := simp)]
theorem ofLE_comp_ofLE {B : C} (X Y Z : Subobject B) (hβ : X β€ Y) (hβ : Y β€ Z) :
ofLE X Y hβ β« ofLE Y Z hβ = ofLE X Z (hβ.trans hβ) := by
simp only [ofLE, β Functor.map_comp underlying]
congr 1
#align category_theory.subobject.of_le_comp_of_le CategoryTheory.Subobject.ofLE_comp_ofLE
@[reassoc (attr := simp)]
theorem ofLE_comp_ofLEMk {B A : C} (X Y : Subobject B) (f : A βΆ B) [Mono f] (hβ : X β€ Y)
(hβ : Y β€ mk f) : ofLE X Y hβ β« ofLEMk Y f hβ = ofLEMk X f (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, β Functor.map_comp_assoc underlying]
congr 1
#align category_theory.subobject.of_le_comp_of_le_mk CategoryTheory.Subobject.ofLE_comp_ofLEMk
@[reassoc (attr := simp)]
theorem ofLEMk_comp_ofMkLE {B A : C} (X : Subobject B) (f : A βΆ B) [Mono f] (Y : Subobject B)
(hβ : X β€ mk f) (hβ : mk f β€ Y) : ofLEMk X f hβ β« ofMkLE f Y hβ = ofLE X Y (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, β Functor.map_comp underlying, assoc, Iso.hom_inv_id_assoc]
congr 1
#align category_theory.subobject.of_le_mk_comp_of_mk_le CategoryTheory.Subobject.ofLEMk_comp_ofMkLE
@[reassoc (attr := simp)]
theorem ofLEMk_comp_ofMkLEMk {B Aβ Aβ : C} (X : Subobject B) (f : Aβ βΆ B) [Mono f] (g : Aβ βΆ B)
[Mono g] (hβ : X β€ mk f) (hβ : mk f β€ mk g) :
ofLEMk X f hβ β« ofMkLEMk f g hβ = ofLEMk X g (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, ofMkLEMk, β Functor.map_comp_assoc underlying,
assoc, Iso.hom_inv_id_assoc]
congr 1
#align category_theory.subobject.of_le_mk_comp_of_mk_le_mk CategoryTheory.Subobject.ofLEMk_comp_ofMkLEMk
@[reassoc (attr := simp)]
theorem ofMkLE_comp_ofLE {B Aβ : C} (f : Aβ βΆ B) [Mono f] (X Y : Subobject B) (hβ : mk f β€ X)
(hβ : X β€ Y) : ofMkLE f X hβ β« ofLE X Y hβ = ofMkLE f Y (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, ofMkLEMk, β Functor.map_comp underlying,
assoc]
congr 1
#align category_theory.subobject.of_mk_le_comp_of_le CategoryTheory.Subobject.ofMkLE_comp_ofLE
@[reassoc (attr := simp)]
theorem ofMkLE_comp_ofLEMk {B Aβ Aβ : C} (f : Aβ βΆ B) [Mono f] (X : Subobject B) (g : Aβ βΆ B)
[Mono g] (hβ : mk f β€ X) (hβ : X β€ mk g) :
ofMkLE f X hβ β« ofLEMk X g hβ = ofMkLEMk f g (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, ofMkLEMk, β Functor.map_comp_assoc underlying, assoc]
congr 1
#align category_theory.subobject.of_mk_le_comp_of_le_mk CategoryTheory.Subobject.ofMkLE_comp_ofLEMk
@[reassoc (attr := simp)]
theorem ofMkLEMk_comp_ofMkLE {B Aβ Aβ : C} (f : Aβ βΆ B) [Mono f] (g : Aβ βΆ B) [Mono g]
(X : Subobject B) (hβ : mk f β€ mk g) (hβ : mk g β€ X) :
ofMkLEMk f g hβ β« ofMkLE g X hβ = ofMkLE f X (hβ.trans hβ) := by
simp only [ofMkLE, ofLEMk, ofLE, ofMkLEMk, β Functor.map_comp underlying,
assoc, Iso.hom_inv_id_assoc]
congr 1
#align category_theory.subobject.of_mk_le_mk_comp_of_mk_le CategoryTheory.Subobject.ofMkLEMk_comp_ofMkLE
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Basic.lean | 440 | 445 | theorem ofMkLEMk_comp_ofMkLEMk {B Aβ Aβ Aβ : C} (f : Aβ βΆ B) [Mono f] (g : Aβ βΆ B) [Mono g]
(h : Aβ βΆ B) [Mono h] (hβ : mk f β€ mk g) (hβ : mk g β€ mk h) :
ofMkLEMk f g hβ β« ofMkLEMk g h hβ = ofMkLEMk f h (hβ.trans hβ) := by |
simp only [ofMkLE, ofLEMk, ofLE, ofMkLEMk, β Functor.map_comp_assoc underlying, assoc,
Iso.hom_inv_id_assoc]
congr 1
|
import Mathlib.Topology.VectorBundle.Basic
#align_import topology.vector_bundle.hom from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
noncomputable section
open scoped Bundle
open Bundle Set ContinuousLinearMap
variable {πβ : Type*} [NontriviallyNormedField πβ] {πβ : Type*} [NontriviallyNormedField πβ]
(Ο : πβ β+* πβ) [iΟ : RingHomIsometric Ο]
variable {B : Type*}
variable {Fβ : Type*} [NormedAddCommGroup Fβ] [NormedSpace πβ Fβ] (Eβ : B β Type*)
[β x, AddCommGroup (Eβ x)] [β x, Module πβ (Eβ x)] [TopologicalSpace (TotalSpace Fβ Eβ)]
variable {Fβ : Type*} [NormedAddCommGroup Fβ] [NormedSpace πβ Fβ] (Eβ : B β Type*)
[β x, AddCommGroup (Eβ x)] [β x, Module πβ (Eβ x)] [TopologicalSpace (TotalSpace Fβ Eβ)]
protected abbrev Bundle.ContinuousLinearMap [β x, TopologicalSpace (Eβ x)]
[β x, TopologicalSpace (Eβ x)] : B β Type _ := fun x => Eβ x βSL[Ο] Eβ x
#align bundle.continuous_linear_map Bundle.ContinuousLinearMap
-- Porting note: possibly remove after the port
instance Bundle.ContinuousLinearMap.module [β x, TopologicalSpace (Eβ x)]
[β x, TopologicalSpace (Eβ x)] [β x, TopologicalAddGroup (Eβ x)]
[β x, ContinuousConstSMul πβ (Eβ x)] : β x, Module πβ (Bundle.ContinuousLinearMap Ο Eβ Eβ x) :=
fun _ => inferInstance
#align bundle.continuous_linear_map.module Bundle.ContinuousLinearMap.module
variable {Eβ Eβ}
variable [TopologicalSpace B] (eβ eβ' : Trivialization Fβ (Ο Fβ Eβ))
(eβ eβ' : Trivialization Fβ (Ο Fβ Eβ))
namespace Pretrivialization
def continuousLinearMapCoordChange [eβ.IsLinear πβ] [eβ'.IsLinear πβ] [eβ.IsLinear πβ]
[eβ'.IsLinear πβ] (b : B) : (Fβ βSL[Ο] Fβ) βL[πβ] Fβ βSL[Ο] Fβ :=
((eβ'.coordChangeL πβ eβ b).symm.arrowCongrSL (eβ.coordChangeL πβ eβ' b) :
(Fβ βSL[Ο] Fβ) βL[πβ] Fβ βSL[Ο] Fβ)
#align pretrivialization.continuous_linear_map_coord_change Pretrivialization.continuousLinearMapCoordChange
variable {Ο eβ eβ' eβ eβ'}
variable [β x, TopologicalSpace (Eβ x)] [FiberBundle Fβ Eβ]
variable [β x, TopologicalSpace (Eβ x)] [ita : β x, TopologicalAddGroup (Eβ x)] [FiberBundle Fβ Eβ]
theorem continuousOn_continuousLinearMapCoordChange [VectorBundle πβ Fβ Eβ] [VectorBundle πβ Fβ Eβ]
[MemTrivializationAtlas eβ] [MemTrivializationAtlas eβ'] [MemTrivializationAtlas eβ]
[MemTrivializationAtlas eβ'] :
ContinuousOn (continuousLinearMapCoordChange Ο eβ eβ' eβ eβ')
(eβ.baseSet β© eβ.baseSet β© (eβ'.baseSet β© eβ'.baseSet)) := by
have hβ := (compSL Fβ Fβ Fβ Ο (RingHom.id πβ)).continuous
have hβ := (ContinuousLinearMap.flip (compSL Fβ Fβ Fβ (RingHom.id πβ) Ο)).continuous
have hβ := continuousOn_coordChange πβ eβ' eβ
have hβ := continuousOn_coordChange πβ eβ eβ'
refine ((hβ.comp_continuousOn (hβ.mono ?_)).clm_comp (hβ.comp_continuousOn (hβ.mono ?_))).congr ?_
Β· mfld_set_tac
Β· mfld_set_tac
Β· intro b _; ext L v
-- Porting note: was
-- simp only [continuousLinearMapCoordChange, ContinuousLinearEquiv.coe_coe,
-- ContinuousLinearEquiv.arrowCongrββ_apply, LinearEquiv.toFun_eq_coe, coe_comp',
-- ContinuousLinearEquiv.arrowCongrSL_apply, comp_apply, Function.comp, compSL_apply,
-- flip_apply, ContinuousLinearEquiv.symm_symm]
-- Now `simp` fails to use `ContinuousLinearMap.comp_apply` in this case
dsimp [continuousLinearMapCoordChange]
rw [ContinuousLinearEquiv.symm_symm]
#align pretrivialization.continuous_on_continuous_linear_map_coord_change Pretrivialization.continuousOn_continuousLinearMapCoordChange
variable (Ο eβ eβ' eβ eβ')
variable [eβ.IsLinear πβ] [eβ'.IsLinear πβ] [eβ.IsLinear πβ] [eβ'.IsLinear πβ]
def continuousLinearMap :
Pretrivialization (Fβ βSL[Ο] Fβ) (Ο (Fβ βSL[Ο] Fβ) (Bundle.ContinuousLinearMap Ο Eβ Eβ)) where
toFun p := β¨p.1, .comp (eβ.continuousLinearMapAt πβ p.1) (p.2.comp (eβ.symmL πβ p.1))β©
invFun p := β¨p.1, .comp (eβ.symmL πβ p.1) (p.2.comp (eβ.continuousLinearMapAt πβ p.1))β©
source := Bundle.TotalSpace.proj β»ΒΉ' (eβ.baseSet β© eβ.baseSet)
target := (eβ.baseSet β© eβ.baseSet) ΓΛ’ Set.univ
map_source' := fun β¨x, Lβ© h => β¨h, Set.mem_univ _β©
map_target' := fun β¨x, fβ© h => h.1
left_inv' := fun β¨x, Lβ© β¨hβ, hββ© => by
simp only [TotalSpace.mk_inj]
ext (v : Eβ x)
dsimp only [comp_apply]
rw [Trivialization.symmL_continuousLinearMapAt, Trivialization.symmL_continuousLinearMapAt]
exacts [hβ, hβ]
right_inv' := fun β¨x, fβ© β¨β¨hβ, hββ©, _β© => by
simp only [Prod.mk_inj_left]
ext v
dsimp only [comp_apply]
rw [Trivialization.continuousLinearMapAt_symmL, Trivialization.continuousLinearMapAt_symmL]
exacts [hβ, hβ]
open_target := (eβ.open_baseSet.inter eβ.open_baseSet).prod isOpen_univ
baseSet := eβ.baseSet β© eβ.baseSet
open_baseSet := eβ.open_baseSet.inter eβ.open_baseSet
source_eq := rfl
target_eq := rfl
proj_toFun _ _ := rfl
#align pretrivialization.continuous_linear_map Pretrivialization.continuousLinearMap
-- Porting note (#11215): TODO: see if Lean 4 can generate this instance without a hint
instance continuousLinearMap.isLinear [β x, ContinuousAdd (Eβ x)] [β x, ContinuousSMul πβ (Eβ x)] :
(Pretrivialization.continuousLinearMap Ο eβ eβ).IsLinear πβ where
linear x _ :=
{ map_add := fun L L' =>
show (eβ.continuousLinearMapAt πβ x).comp ((L + L').comp (eβ.symmL πβ x)) = _ by
simp_rw [add_comp, comp_add]
rfl
map_smul := fun c L =>
show (eβ.continuousLinearMapAt πβ x).comp ((c β’ L).comp (eβ.symmL πβ x)) = _ by
simp_rw [smul_comp, comp_smulββ, RingHom.id_apply]
rfl }
#align pretrivialization.continuous_linear_map.is_linear Pretrivialization.continuousLinearMap.isLinear
theorem continuousLinearMap_apply (p : TotalSpace (Fβ βSL[Ο] Fβ) fun x => Eβ x βSL[Ο] Eβ x) :
(continuousLinearMap Ο eβ eβ) p =
β¨p.1, .comp (eβ.continuousLinearMapAt πβ p.1) (p.2.comp (eβ.symmL πβ p.1))β© :=
rfl
#align pretrivialization.continuous_linear_map_apply Pretrivialization.continuousLinearMap_apply
theorem continuousLinearMap_symm_apply (p : B Γ (Fβ βSL[Ο] Fβ)) :
(continuousLinearMap Ο eβ eβ).toPartialEquiv.symm p =
β¨p.1, .comp (eβ.symmL πβ p.1) (p.2.comp (eβ.continuousLinearMapAt πβ p.1))β© :=
rfl
#align pretrivialization.continuous_linear_map_symm_apply Pretrivialization.continuousLinearMap_symm_apply
| Mathlib/Topology/VectorBundle/Hom.lean | 177 | 183 | theorem continuousLinearMap_symm_apply' {b : B} (hb : b β eβ.baseSet β© eβ.baseSet)
(L : Fβ βSL[Ο] Fβ) :
(continuousLinearMap Ο eβ eβ).symm b L =
(eβ.symmL πβ b).comp (L.comp <| eβ.continuousLinearMapAt πβ b) := by |
rw [symm_apply]
Β· rfl
Β· exact hb
|
import Mathlib.Algebra.Group.Subgroup.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Nilpotent
import Mathlib.Order.Radical
def frattini (G : Type*) [Group G] : Subgroup G :=
Order.radical (Subgroup G)
variable {G H : Type*} [Group G] [Group H] {Ο : G β* H} (hΟ : Function.Surjective Ο)
lemma frattini_le_coatom {K : Subgroup G} (h : IsCoatom K) : frattini G β€ K :=
Order.radical_le_coatom h
open Subgroup
lemma frattini_le_comap_frattini_of_surjective : frattini G β€ (frattini H).comap Ο := by
simp_rw [frattini, Order.radical, comap_iInf, le_iInf_iff]
intro M hM
apply biInf_le
exact isCoatom_comap_of_surjective hΟ hM
instance frattini_characteristic : (frattini G).Characteristic := by
rw [characteristic_iff_comap_eq]
intro Ο
apply Ο.comapSubgroup.map_radical
theorem frattini_nongenerating [IsCoatomic (Subgroup G)] {K : Subgroup G}
(h : K β frattini G = β€) : K = β€ :=
Order.radical_nongenerating h
-- The Sylow files unnecessarily use `Fintype` (computable) where often `Finite` would suffice,
-- so we need this:
attribute [local instance] Fintype.ofFinite
| Mathlib/GroupTheory/Frattini.lean | 59 | 74 | theorem frattini_nilpotent [Finite G] : Group.IsNilpotent (frattini G) := by |
-- We use the characterisation of nilpotency in terms of all Sylow subgroups being normal.
have q := (isNilpotent_of_finite_tfae (G := frattini G)).out 0 3
rw [q]; clear q
-- Consider each prime `p` and Sylow `p`-subgroup `P` of `frattini G`.
intro p p_prime P
-- The Frattini argument shows that the normalizer of `P` in `G`
-- together with `frattini G` generates `G`.
have frattini_argument := Sylow.normalizer_sup_eq_top P
-- and hence by the nongenerating property of the Frattini subgroup that
-- the normalizer of `P` in `G` is `G`.
have normalizer_P := frattini_nongenerating frattini_argument
-- This means that `P` is normal as a subgroup of `G`
have P_normal_in_G : (map (frattini G).subtype βP).Normal := normalizer_eq_top.mp normalizer_P
-- and hence also as a subgroup of `frattini G`, which was the remaining goal.
exact P_normal_in_G.of_map_subtype
|
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Ring.Pow
import Mathlib.Algebra.Ring.Int
#align_import algebra.order.field.power from "leanprover-community/mathlib"@"acb3d204d4ee883eb686f45d486a2a6811a01329"
variable {Ξ± : Type*}
open Function Int
section LinearOrderedField
variable [LinearOrderedField Ξ±] {a b c d : Ξ±} {n : β€}
#noalign zpow_bit0_nonneg
#noalign zpow_bit0_pos
#noalign zpow_bit0_pos_iff
#noalign zpow_bit1_neg_iff
#noalign zpow_bit1_nonneg_iff
#noalign zpow_bit1_nonpos_iff
#noalign zpow_bit1_pos_iff
protected theorem Even.zpow_nonneg (hn : Even n) (a : Ξ±) : 0 β€ a ^ n := by
obtain β¨k, rflβ© := hn; rw [zpow_add' (by simp [em'])]; exact mul_self_nonneg _
#align even.zpow_nonneg Even.zpow_nonneg
lemma zpow_two_nonneg (a : Ξ±) : 0 β€ a ^ (2 : β€) := even_two.zpow_nonneg _
#align zpow_two_nonneg zpow_two_nonneg
lemma zpow_neg_two_nonneg (a : Ξ±) : 0 β€ a ^ (-2 : β€) := even_neg_two.zpow_nonneg _
#align zpow_neg_two_nonneg zpow_neg_two_nonneg
protected lemma Even.zpow_pos (hn : Even n) (ha : a β 0) : 0 < a ^ n :=
(hn.zpow_nonneg _).lt_of_ne' (zpow_ne_zero _ ha)
#align even.zpow_pos Even.zpow_pos
lemma zpow_two_pos_of_ne_zero (ha : a β 0) : 0 < a ^ (2 : β€) := even_two.zpow_pos ha
#align zpow_two_pos_of_ne_zero zpow_two_pos_of_ne_zero
| Mathlib/Algebra/Order/Field/Power.lean | 150 | 152 | theorem Even.zpow_pos_iff (hn : Even n) (h : n β 0) : 0 < a ^ n β a β 0 := by |
obtain β¨k, rflβ© := hn
rw [zpow_add' (by simp [em']), mul_self_pos, zpow_ne_zero_iff (by simpa using h)]
|
import Mathlib.Algebra.BigOperators.GroupWithZero.Finset
import Mathlib.Algebra.Group.FiniteSupport
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Set.Subsingleton
#align_import algebra.big_operators.finprod from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
open Function Set
-- Porting note: Used to be section Sort
section sort
variable {G M N : Type*} {Ξ± Ξ² ΞΉ : Sort*} [CommMonoid M] [CommMonoid N]
section
open scoped Classical
noncomputable irreducible_def finsum (lemma := finsum_def') [AddCommMonoid M] (f : Ξ± β M) : M :=
if h : (support (f β PLift.down)).Finite then β i β h.toFinset, f i.down else 0
#align finsum finsum
@[to_additive existing]
noncomputable irreducible_def finprod (lemma := finprod_def') (f : Ξ± β M) : M :=
if h : (mulSupport (f β PLift.down)).Finite then β i β h.toFinset, f i.down else 1
#align finprod finprod
attribute [to_additive existing] finprod_def'
end
open Batteries.ExtendedBinder
notation3"βαΆ "(...)", "r:67:(scoped f => finsum f) => r
notation3"βαΆ "(...)", "r:67:(scoped f => finprod f) => r
-- Porting note: The following ports the lean3 notation for this file, but is currently very fickle.
-- syntax (name := bigfinsum) "βαΆ " extBinders ", " term:67 : term
-- macro_rules (kind := bigfinsum)
-- | `(βαΆ $x:ident, $p) => `(finsum (fun $x:ident β¦ $p))
-- | `(βαΆ $x:ident : $t, $p) => `(finsum (fun $x:ident : $t β¦ $p))
-- | `(βαΆ $x:ident $b:binderPred, $p) =>
-- `(finsum fun $x => (finsum (Ξ± := satisfies_binder_pred% $x $b) (fun _ => $p)))
-- | `(βαΆ ($x:ident) ($h:ident : $t), $p) =>
-- `(finsum fun ($x) => finsum (Ξ± := $t) (fun $h => $p))
-- | `(βαΆ ($x:ident : $_) ($h:ident : $t), $p) =>
-- `(finsum fun ($x) => finsum (Ξ± := $t) (fun $h => $p))
-- | `(βαΆ ($x:ident) ($y:ident), $p) =>
-- `(finsum fun $x => (finsum fun $y => $p))
-- | `(βαΆ ($x:ident) ($y:ident) ($h:ident : $t), $p) =>
-- `(finsum fun $x => (finsum fun $y => (finsum (Ξ± := $t) fun $h => $p)))
-- | `(βαΆ ($x:ident) ($y:ident) ($z:ident), $p) =>
-- `(finsum fun $x => (finsum fun $y => (finsum fun $z => $p)))
-- | `(βαΆ ($x:ident) ($y:ident) ($z:ident) ($h:ident : $t), $p) =>
-- `(finsum fun $x => (finsum fun $y => (finsum fun $z => (finsum (Ξ± := $t) fun $h => $p))))
--
--
-- syntax (name := bigfinprod) "βαΆ " extBinders ", " term:67 : term
-- macro_rules (kind := bigfinprod)
-- | `(βαΆ $x:ident, $p) => `(finprod (fun $x:ident β¦ $p))
-- | `(βαΆ $x:ident : $t, $p) => `(finprod (fun $x:ident : $t β¦ $p))
-- | `(βαΆ $x:ident $b:binderPred, $p) =>
-- `(finprod fun $x => (finprod (Ξ± := satisfies_binder_pred% $x $b) (fun _ => $p)))
-- | `(βαΆ ($x:ident) ($h:ident : $t), $p) =>
-- `(finprod fun ($x) => finprod (Ξ± := $t) (fun $h => $p))
-- | `(βαΆ ($x:ident : $_) ($h:ident : $t), $p) =>
-- `(finprod fun ($x) => finprod (Ξ± := $t) (fun $h => $p))
-- | `(βαΆ ($x:ident) ($y:ident), $p) =>
-- `(finprod fun $x => (finprod fun $y => $p))
-- | `(βαΆ ($x:ident) ($y:ident) ($h:ident : $t), $p) =>
-- `(finprod fun $x => (finprod fun $y => (finprod (Ξ± := $t) fun $h => $p)))
-- | `(βαΆ ($x:ident) ($y:ident) ($z:ident), $p) =>
-- `(finprod fun $x => (finprod fun $y => (finprod fun $z => $p)))
-- | `(βαΆ ($x:ident) ($y:ident) ($z:ident) ($h:ident : $t), $p) =>
-- `(finprod fun $x => (finprod fun $y => (finprod fun $z =>
-- (finprod (Ξ± := $t) fun $h => $p))))
@[to_additive]
theorem finprod_eq_prod_plift_of_mulSupport_toFinset_subset {f : Ξ± β M}
(hf : (mulSupport (f β PLift.down)).Finite) {s : Finset (PLift Ξ±)} (hs : hf.toFinset β s) :
βαΆ i, f i = β i β s, f i.down := by
rw [finprod, dif_pos]
refine Finset.prod_subset hs fun x _ hxf => ?_
rwa [hf.mem_toFinset, nmem_mulSupport] at hxf
#align finprod_eq_prod_plift_of_mul_support_to_finset_subset finprod_eq_prod_plift_of_mulSupport_toFinset_subset
#align finsum_eq_sum_plift_of_support_to_finset_subset finsum_eq_sum_plift_of_support_toFinset_subset
@[to_additive]
theorem finprod_eq_prod_plift_of_mulSupport_subset {f : Ξ± β M} {s : Finset (PLift Ξ±)}
(hs : mulSupport (f β PLift.down) β s) : βαΆ i, f i = β i β s, f i.down :=
finprod_eq_prod_plift_of_mulSupport_toFinset_subset (s.finite_toSet.subset hs) fun x hx => by
rw [Finite.mem_toFinset] at hx
exact hs hx
#align finprod_eq_prod_plift_of_mul_support_subset finprod_eq_prod_plift_of_mulSupport_subset
#align finsum_eq_sum_plift_of_support_subset finsum_eq_sum_plift_of_support_subset
@[to_additive (attr := simp)]
theorem finprod_one : (βαΆ _ : Ξ±, (1 : M)) = 1 := by
have : (mulSupport fun x : PLift Ξ± => (fun _ => 1 : Ξ± β M) x.down) β (β
: Finset (PLift Ξ±)) :=
fun x h => by simp at h
rw [finprod_eq_prod_plift_of_mulSupport_subset this, Finset.prod_empty]
#align finprod_one finprod_one
#align finsum_zero finsum_zero
@[to_additive]
| Mathlib/Algebra/BigOperators/Finprod.lean | 198 | 201 | theorem finprod_of_isEmpty [IsEmpty Ξ±] (f : Ξ± β M) : βαΆ i, f i = 1 := by |
rw [β finprod_one]
congr
simp [eq_iff_true_of_subsingleton]
|
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set Function Filter
open scoped NNReal Topology
instance Real.punctured_nhds_module_neBot {E : Type*} [AddCommGroup E] [TopologicalSpace E]
[ContinuousAdd E] [Nontrivial E] [Module β E] [ContinuousSMul β E] (x : E) : NeBot (π[β ] x) :=
Module.punctured_nhds_neBot β E x
#align real.punctured_nhds_module_ne_bot Real.punctured_nhds_module_neBot
section Seminormed
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace β E]
theorem inv_norm_smul_mem_closed_unit_ball (x : E) :
βxββ»ΒΉ β’ x β closedBall (0 : E) 1 := by
simp only [mem_closedBall_zero_iff, norm_smul, norm_inv, norm_norm, β div_eq_inv_mul,
div_self_le_one]
#align inv_norm_smul_mem_closed_unit_ball inv_norm_smul_mem_closed_unit_ball
theorem norm_smul_of_nonneg {t : β} (ht : 0 β€ t) (x : E) : βt β’ xβ = t * βxβ := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht]
#align norm_smul_of_nonneg norm_smul_of_nonneg
theorem dist_smul_add_one_sub_smul_le {r : β} {x y : E} (h : r β Icc 0 1) :
dist (r β’ x + (1 - r) β’ y) x β€ dist y x :=
calc
dist (r β’ x + (1 - r) β’ y) x = β1 - rβ * βx - yβ := by
simp_rw [dist_eq_norm', β norm_smul, sub_smul, one_smul, smul_sub, β sub_sub, β sub_add,
sub_right_comm]
_ = (1 - r) * dist y x := by
rw [Real.norm_eq_abs, abs_eq_self.mpr (sub_nonneg.mpr h.2), dist_eq_norm']
_ β€ (1 - 0) * dist y x := by gcongr; exact h.1
_ = dist y x := by rw [sub_zero, one_mul]
| Mathlib/Analysis/NormedSpace/Real.lean | 61 | 73 | theorem closure_ball (x : E) {r : β} (hr : r β 0) : closure (ball x r) = closedBall x r := by |
refine Subset.antisymm closure_ball_subset_closedBall fun y hy => ?_
have : ContinuousWithinAt (fun c : β => c β’ (y - x) + x) (Ico 0 1) 1 :=
((continuous_id.smul continuous_const).add continuous_const).continuousWithinAt
convert this.mem_closure _ _
Β· rw [one_smul, sub_add_cancel]
Β· simp [closure_Ico zero_ne_one, zero_le_one]
Β· rintro c β¨hc0, hc1β©
rw [mem_ball, dist_eq_norm, add_sub_cancel_right, norm_smul, Real.norm_eq_abs,
abs_of_nonneg hc0, mul_comm, β mul_one r]
rw [mem_closedBall, dist_eq_norm] at hy
replace hr : 0 < r := ((norm_nonneg _).trans hy).lt_of_ne hr.symm
apply mul_lt_mul' <;> assumption
|
import Mathlib.Analysis.SpecialFunctions.Complex.Log
#align_import analysis.special_functions.pow.complex from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
open scoped Classical
open Real Topology Filter ComplexConjugate Finset Set
namespace Complex
noncomputable def cpow (x y : β) : β :=
if x = 0 then if y = 0 then 1 else 0 else exp (log x * y)
#align complex.cpow Complex.cpow
noncomputable instance : Pow β β :=
β¨cpowβ©
@[simp]
theorem cpow_eq_pow (x y : β) : cpow x y = x ^ y :=
rfl
#align complex.cpow_eq_pow Complex.cpow_eq_pow
theorem cpow_def (x y : β) : x ^ y = if x = 0 then if y = 0 then 1 else 0 else exp (log x * y) :=
rfl
#align complex.cpow_def Complex.cpow_def
theorem cpow_def_of_ne_zero {x : β} (hx : x β 0) (y : β) : x ^ y = exp (log x * y) :=
if_neg hx
#align complex.cpow_def_of_ne_zero Complex.cpow_def_of_ne_zero
@[simp]
theorem cpow_zero (x : β) : x ^ (0 : β) = 1 := by simp [cpow_def]
#align complex.cpow_zero Complex.cpow_zero
@[simp]
theorem cpow_eq_zero_iff (x y : β) : x ^ y = 0 β x = 0 β§ y β 0 := by
simp only [cpow_def]
split_ifs <;> simp [*, exp_ne_zero]
#align complex.cpow_eq_zero_iff Complex.cpow_eq_zero_iff
@[simp]
theorem zero_cpow {x : β} (h : x β 0) : (0 : β) ^ x = 0 := by simp [cpow_def, *]
#align complex.zero_cpow Complex.zero_cpow
theorem zero_cpow_eq_iff {x : β} {a : β} : (0 : β) ^ x = a β x β 0 β§ a = 0 β¨ x = 0 β§ a = 1 := by
constructor
Β· intro hyp
simp only [cpow_def, eq_self_iff_true, if_true] at hyp
by_cases h : x = 0
Β· subst h
simp only [if_true, eq_self_iff_true] at hyp
right
exact β¨rfl, hyp.symmβ©
Β· rw [if_neg h] at hyp
left
exact β¨h, hyp.symmβ©
Β· rintro (β¨h, rflβ© | β¨rfl, rflβ©)
Β· exact zero_cpow h
Β· exact cpow_zero _
#align complex.zero_cpow_eq_iff Complex.zero_cpow_eq_iff
theorem eq_zero_cpow_iff {x : β} {a : β} : a = (0 : β) ^ x β x β 0 β§ a = 0 β¨ x = 0 β§ a = 1 := by
rw [β zero_cpow_eq_iff, eq_comm]
#align complex.eq_zero_cpow_iff Complex.eq_zero_cpow_iff
@[simp]
theorem cpow_one (x : β) : x ^ (1 : β) = x :=
if hx : x = 0 then by simp [hx, cpow_def]
else by rw [cpow_def, if_neg (one_ne_zero : (1 : β) β 0), if_neg hx, mul_one, exp_log hx]
#align complex.cpow_one Complex.cpow_one
@[simp]
theorem one_cpow (x : β) : (1 : β) ^ x = 1 := by
rw [cpow_def]
split_ifs <;> simp_all [one_ne_zero]
#align complex.one_cpow Complex.one_cpow
theorem cpow_add {x : β} (y z : β) (hx : x β 0) : x ^ (y + z) = x ^ y * x ^ z := by
simp only [cpow_def, ite_mul, boole_mul, mul_ite, mul_boole]
simp_all [exp_add, mul_add]
#align complex.cpow_add Complex.cpow_add
theorem cpow_mul {x y : β} (z : β) (hβ : -Ο < (log x * y).im) (hβ : (log x * y).im β€ Ο) :
x ^ (y * z) = (x ^ y) ^ z := by
simp only [cpow_def]
split_ifs <;> simp_all [exp_ne_zero, log_exp hβ hβ, mul_assoc]
#align complex.cpow_mul Complex.cpow_mul
theorem cpow_neg (x y : β) : x ^ (-y) = (x ^ y)β»ΒΉ := by
simp only [cpow_def, neg_eq_zero, mul_neg]
split_ifs <;> simp [exp_neg]
#align complex.cpow_neg Complex.cpow_neg
theorem cpow_sub {x : β} (y z : β) (hx : x β 0) : x ^ (y - z) = x ^ y / x ^ z := by
rw [sub_eq_add_neg, cpow_add _ _ hx, cpow_neg, div_eq_mul_inv]
#align complex.cpow_sub Complex.cpow_sub
theorem cpow_neg_one (x : β) : x ^ (-1 : β) = xβ»ΒΉ := by simpa using cpow_neg x 1
#align complex.cpow_neg_one Complex.cpow_neg_one
lemma cpow_int_mul (x : β) (n : β€) (y : β) : x ^ (n * y) = (x ^ y) ^ n := by
rcases eq_or_ne x 0 with rfl | hx
Β· rcases eq_or_ne n 0 with rfl | hn
Β· simp
Β· rcases eq_or_ne y 0 with rfl | hy <;> simp [*, zero_zpow]
Β· rw [cpow_def_of_ne_zero hx, cpow_def_of_ne_zero hx, mul_left_comm, exp_int_mul]
lemma cpow_mul_int (x y : β) (n : β€) : x ^ (y * n) = (x ^ y) ^ n := by rw [mul_comm, cpow_int_mul]
lemma cpow_nat_mul (x : β) (n : β) (y : β) : x ^ (n * y) = (x ^ y) ^ n :=
mod_cast cpow_int_mul x n y
lemma cpow_ofNat_mul (x : β) (n : β) [n.AtLeastTwo] (y : β) :
x ^ (no_index (OfNat.ofNat n) * y) = (x ^ y) ^ (OfNat.ofNat n : β) :=
cpow_nat_mul x n y
lemma cpow_mul_nat (x y : β) (n : β) : x ^ (y * n) = (x ^ y) ^ n := by
rw [mul_comm, cpow_nat_mul]
lemma cpow_mul_ofNat (x y : β) (n : β) [n.AtLeastTwo] :
x ^ (y * no_index (OfNat.ofNat n)) = (x ^ y) ^ (OfNat.ofNat n : β) :=
cpow_mul_nat x y n
@[simp, norm_cast]
| Mathlib/Analysis/SpecialFunctions/Pow/Complex.lean | 141 | 141 | theorem cpow_natCast (x : β) (n : β) : x ^ (n : β) = x ^ n := by | simpa using cpow_nat_mul x n 1
|
import Mathlib.Order.RelClasses
import Mathlib.Data.List.Basic
#align_import data.list.lex from "leanprover-community/mathlib"@"d6aae1bcbd04b8de2022b9b83a5b5b10e10c777d"
namespace List
open Nat
universe u
variable {Ξ± : Type u}
inductive Lex (r : Ξ± β Ξ± β Prop) : List Ξ± β List Ξ± β Prop
| nil {a l} : Lex r [] (a :: l)
| cons {a lβ lβ} (h : Lex r lβ lβ) : Lex r (a :: lβ) (a :: lβ)
| rel {aβ lβ aβ lβ} (h : r aβ aβ) : Lex r (aβ :: lβ) (aβ :: lβ)
#align list.lex List.Lex
#align list.lex.nil List.Lex.nil
#align list.lex.cons List.Lex.cons
#align list.lex.rel List.Lex.rel
namespace Lex
theorem cons_iff {r : Ξ± β Ξ± β Prop} [IsIrrefl Ξ± r] {a lβ lβ} :
Lex r (a :: lβ) (a :: lβ) β Lex r lβ lβ :=
β¨fun h => by cases' h with _ _ _ _ _ h _ _ _ _ h; exacts [h, (irrefl_of r a h).elim], Lex.consβ©
#align list.lex.cons_iff List.Lex.cons_iff
@[simp]
theorem not_nil_right (r : Ξ± β Ξ± β Prop) (l : List Ξ±) : Β¬Lex r l [] :=
nofun
#align list.lex.not_nil_right List.Lex.not_nil_right
theorem nil_left_or_eq_nil {r : Ξ± β Ξ± β Prop} (l : List Ξ±) : List.Lex r [] l β¨ l = [] :=
match l with
| [] => Or.inr rfl
| (_ :: _) => Or.inl nil
@[simp]
theorem singleton_iff {r : Ξ± β Ξ± β Prop} (a b : Ξ±) : List.Lex r [a] [b] β r a b :=
β¨fun | rel h => h, List.Lex.relβ©
instance isOrderConnected (r : Ξ± β Ξ± β Prop) [IsOrderConnected Ξ± r] [IsTrichotomous Ξ± r] :
IsOrderConnected (List Ξ±) (Lex r) where
conn := aux where
aux
| _, [], c :: lβ, nil => Or.inr nil
| _, [], c :: lβ, rel _ => Or.inr nil
| _, [], c :: lβ, cons _ => Or.inr nil
| _, b :: lβ, c :: lβ, nil => Or.inl nil
| a :: lβ, b :: lβ, c :: lβ, rel h => (IsOrderConnected.conn _ b _ h).imp rel rel
| a :: lβ, b :: lβ, _ :: lβ, cons h => by
rcases trichotomous_of r a b with (ab | rfl | ab)
Β· exact Or.inl (rel ab)
Β· exact (aux _ lβ _ h).imp cons cons
Β· exact Or.inr (rel ab)
#align list.lex.is_order_connected List.Lex.isOrderConnected
-- This can be removed after https://github.com/leanprover/lean4/pull/1866
attribute [nolint defLemma] isOrderConnected.aux
instance isTrichotomous (r : Ξ± β Ξ± β Prop) [IsTrichotomous Ξ± r] :
IsTrichotomous (List Ξ±) (Lex r) where
trichotomous := aux where
aux
| [], [] => Or.inr (Or.inl rfl)
| [], b :: lβ => Or.inl nil
| a :: lβ, [] => Or.inr (Or.inr nil)
| a :: lβ, b :: lβ => by
rcases trichotomous_of r a b with (ab | rfl | ab)
Β· exact Or.inl (rel ab)
Β· exact (aux lβ lβ).imp cons (Or.imp (congr_arg _) cons)
Β· exact Or.inr (Or.inr (rel ab))
#align list.lex.is_trichotomous List.Lex.isTrichotomous
-- This can be removed after https://github.com/leanprover/lean4/pull/1866
attribute [nolint defLemma] isTrichotomous.aux
instance isAsymm (r : Ξ± β Ξ± β Prop) [IsAsymm Ξ± r] : IsAsymm (List Ξ±) (Lex r) where
asymm := aux where
aux
| _, _, Lex.rel hβ, Lex.rel hβ => asymm hβ hβ
| _, _, Lex.rel hβ, Lex.cons _ => asymm hβ hβ
| _, _, Lex.cons _, Lex.rel hβ => asymm hβ hβ
| _, _, Lex.cons hβ, Lex.cons hβ => aux _ _ hβ hβ
#align list.lex.is_asymm List.Lex.isAsymm
-- This can be removed after https://github.com/leanprover/lean4/pull/1866
attribute [nolint defLemma] isAsymm.aux
instance isStrictTotalOrder (r : Ξ± β Ξ± β Prop) [IsStrictTotalOrder Ξ± r] :
IsStrictTotalOrder (List Ξ±) (Lex r) :=
{ isStrictWeakOrder_of_isOrderConnected with }
#align list.lex.is_strict_total_order List.Lex.isStrictTotalOrder
instance decidableRel [DecidableEq Ξ±] (r : Ξ± β Ξ± β Prop) [DecidableRel r] : DecidableRel (Lex r)
| lβ, [] => isFalse fun h => by cases h
| [], b :: lβ => isTrue Lex.nil
| a :: lβ, b :: lβ => by
haveI := decidableRel r lβ lβ
refine decidable_of_iff (r a b β¨ a = b β§ Lex r lβ lβ) β¨fun h => ?_, fun h => ?_β©
Β· rcases h with (h | β¨rfl, hβ©)
Β· exact Lex.rel h
Β· exact Lex.cons h
Β· rcases h with (_ | h | h)
Β· exact Or.inr β¨rfl, hβ©
Β· exact Or.inl h
#align list.lex.decidable_rel List.Lex.decidableRel
theorem append_right (r : Ξ± β Ξ± β Prop) : β {sβ sβ} (t), Lex r sβ sβ β Lex r sβ (sβ ++ t)
| _, _, _, nil => nil
| _, _, _, cons h => cons (append_right r _ h)
| _, _, _, rel r => rel r
#align list.lex.append_right List.Lex.append_right
theorem append_left (R : Ξ± β Ξ± β Prop) {tβ tβ} (h : Lex R tβ tβ) : β s, Lex R (s ++ tβ) (s ++ tβ)
| [] => h
| _ :: l => cons (append_left R h l)
#align list.lex.append_left List.Lex.append_left
theorem imp {r s : Ξ± β Ξ± β Prop} (H : β a b, r a b β s a b) : β lβ lβ, Lex r lβ lβ β Lex s lβ lβ
| _, _, nil => nil
| _, _, cons h => cons (imp H _ _ h)
| _, _, rel r => rel (H _ _ r)
#align list.lex.imp List.Lex.imp
theorem to_ne : β {lβ lβ : List Ξ±}, Lex (Β· β Β·) lβ lβ β lβ β lβ
| _, _, cons h, e => to_ne h (List.cons.inj e).2
| _, _, rel r, e => r (List.cons.inj e).1
#align list.lex.to_ne List.Lex.to_ne
theorem _root_.Decidable.List.Lex.ne_iff [DecidableEq Ξ±] {lβ lβ : List Ξ±}
(H : length lβ β€ length lβ) : Lex (Β· β Β·) lβ lβ β lβ β lβ :=
β¨to_ne, fun h => by
induction' lβ with a lβ IH generalizing lβ <;> cases' lβ with b lβ
Β· contradiction
Β· apply nil
Β· exact (not_lt_of_ge H).elim (succ_pos _)
Β· by_cases ab : a = b
Β· subst b
apply cons
exact IH (le_of_succ_le_succ H) (mt (congr_arg _) h)
Β· exact rel ab β©
#align decidable.list.lex.ne_iff Decidable.List.Lex.ne_iff
| Mathlib/Data/List/Lex.lean | 177 | 179 | theorem ne_iff {lβ lβ : List Ξ±} (H : length lβ β€ length lβ) : Lex (Β· β Β·) lβ lβ β lβ β lβ := by |
classical
exact Decidable.List.Lex.ne_iff H
|
import Mathlib.SetTheory.Game.State
#align_import set_theory.game.domineering from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225"
namespace SetTheory
namespace PGame
namespace Domineering
open Function
@[simps!]
def shiftUp : β€ Γ β€ β β€ Γ β€ :=
(Equiv.refl β€).prodCongr (Equiv.addRight (1 : β€))
#align pgame.domineering.shift_up SetTheory.PGame.Domineering.shiftUp
@[simps!]
def shiftRight : β€ Γ β€ β β€ Γ β€ :=
(Equiv.addRight (1 : β€)).prodCongr (Equiv.refl β€)
#align pgame.domineering.shift_right SetTheory.PGame.Domineering.shiftRight
-- Porting note: reducibility cannot be `local`. For now there are no dependents of this file so
-- being globally reducible is fine.
abbrev Board :=
Finset (β€ Γ β€)
#align pgame.domineering.board SetTheory.PGame.Domineering.Board
def left (b : Board) : Finset (β€ Γ β€) :=
b β© b.map shiftUp
#align pgame.domineering.left SetTheory.PGame.Domineering.left
def right (b : Board) : Finset (β€ Γ β€) :=
b β© b.map shiftRight
#align pgame.domineering.right SetTheory.PGame.Domineering.right
theorem mem_left {b : Board} (x : β€ Γ β€) : x β left b β x β b β§ (x.1, x.2 - 1) β b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_left SetTheory.PGame.Domineering.mem_left
theorem mem_right {b : Board} (x : β€ Γ β€) : x β right b β x β b β§ (x.1 - 1, x.2) β b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_right SetTheory.PGame.Domineering.mem_right
def moveLeft (b : Board) (m : β€ Γ β€) : Board :=
(b.erase m).erase (m.1, m.2 - 1)
#align pgame.domineering.move_left SetTheory.PGame.Domineering.moveLeft
def moveRight (b : Board) (m : β€ Γ β€) : Board :=
(b.erase m).erase (m.1 - 1, m.2)
#align pgame.domineering.move_right SetTheory.PGame.Domineering.moveRight
| Mathlib/SetTheory/Game/Domineering.lean | 79 | 83 | theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : β€ Γ β€} (h : m β right b) :
(m.1 - 1, m.2) β b.erase m := by |
rw [mem_right] at h
apply Finset.mem_erase_of_ne_of_mem _ h.2
exact ne_of_apply_ne Prod.fst (pred_ne_self m.1)
|
import Mathlib.Analysis.BoxIntegral.Partition.Filter
import Mathlib.Analysis.BoxIntegral.Partition.Measure
import Mathlib.Topology.UniformSpace.Compact
import Mathlib.Init.Data.Bool.Lemmas
#align_import analysis.box_integral.basic from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open scoped Classical Topology NNReal Filter Uniformity BoxIntegral
open Set Finset Function Filter Metric BoxIntegral.IntegrationParams
noncomputable section
namespace BoxIntegral
universe u v w
variable {ΞΉ : Type u} {E : Type v} {F : Type w} [NormedAddCommGroup E] [NormedSpace β E]
[NormedAddCommGroup F] [NormedSpace β F] {I J : Box ΞΉ} {Ο : TaggedPrepartition I}
open TaggedPrepartition
local notation "ββΏ" => ΞΉ β β
def integralSum (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I) : F :=
β J β Ο.boxes, vol J (f (Ο.tag J))
#align box_integral.integral_sum BoxIntegral.integralSum
theorem integralSum_biUnionTagged (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : Prepartition I)
(Οi : β J, TaggedPrepartition J) :
integralSum f vol (Ο.biUnionTagged Οi) = β J β Ο.boxes, integralSum f vol (Οi J) := by
refine (Ο.sum_biUnion_boxes _ _).trans <| sum_congr rfl fun J hJ => sum_congr rfl fun J' hJ' => ?_
rw [Ο.tag_biUnionTagged hJ hJ']
#align box_integral.integral_sum_bUnion_tagged BoxIntegral.integralSum_biUnionTagged
theorem integralSum_biUnion_partition (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F)
(Ο : TaggedPrepartition I) (Οi : β J, Prepartition J) (hΟi : β J β Ο, (Οi J).IsPartition) :
integralSum f vol (Ο.biUnionPrepartition Οi) = integralSum f vol Ο := by
refine (Ο.sum_biUnion_boxes _ _).trans (sum_congr rfl fun J hJ => ?_)
calc
(β J' β (Οi J).boxes, vol J' (f (Ο.tag <| Ο.toPrepartition.biUnionIndex Οi J'))) =
β J' β (Οi J).boxes, vol J' (f (Ο.tag J)) :=
sum_congr rfl fun J' hJ' => by rw [Prepartition.biUnionIndex_of_mem _ hJ hJ']
_ = vol J (f (Ο.tag J)) :=
(vol.map β¨β¨fun g : E βL[β] F => g (f (Ο.tag J)), rflβ©, fun _ _ => rflβ©).sum_partition_boxes
le_top (hΟi J hJ)
#align box_integral.integral_sum_bUnion_partition BoxIntegral.integralSum_biUnion_partition
theorem integralSum_inf_partition (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I)
{Ο' : Prepartition I} (h : Ο'.IsPartition) :
integralSum f vol (Ο.infPrepartition Ο') = integralSum f vol Ο :=
integralSum_biUnion_partition f vol Ο _ fun _J hJ => h.restrict (Prepartition.le_of_mem _ hJ)
#align box_integral.integral_sum_inf_partition BoxIntegral.integralSum_inf_partition
theorem integralSum_fiberwise {Ξ±} (g : Box ΞΉ β Ξ±) (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F)
(Ο : TaggedPrepartition I) :
(β y β Ο.boxes.image g, integralSum f vol (Ο.filter (g Β· = y))) = integralSum f vol Ο :=
Ο.sum_fiberwise g fun J => vol J (f <| Ο.tag J)
#align box_integral.integral_sum_fiberwise BoxIntegral.integralSum_fiberwise
theorem integralSum_sub_partitions (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F)
{Οβ Οβ : TaggedPrepartition I} (hβ : Οβ.IsPartition) (hβ : Οβ.IsPartition) :
integralSum f vol Οβ - integralSum f vol Οβ =
β J β (Οβ.toPrepartition β Οβ.toPrepartition).boxes,
(vol J (f <| (Οβ.infPrepartition Οβ.toPrepartition).tag J) -
vol J (f <| (Οβ.infPrepartition Οβ.toPrepartition).tag J)) := by
rw [β integralSum_inf_partition f vol Οβ hβ, β integralSum_inf_partition f vol Οβ hβ,
integralSum, integralSum, Finset.sum_sub_distrib]
simp only [infPrepartition_toPrepartition, inf_comm]
#align box_integral.integral_sum_sub_partitions BoxIntegral.integralSum_sub_partitions
@[simp]
theorem integralSum_disjUnion (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) {Οβ Οβ : TaggedPrepartition I}
(h : Disjoint Οβ.iUnion Οβ.iUnion) :
integralSum f vol (Οβ.disjUnion Οβ h) = integralSum f vol Οβ + integralSum f vol Οβ := by
refine (Prepartition.sum_disj_union_boxes h _).trans
(congr_argβ (Β· + Β·) (sum_congr rfl fun J hJ => ?_) (sum_congr rfl fun J hJ => ?_))
Β· rw [disjUnion_tag_of_mem_left _ hJ]
Β· rw [disjUnion_tag_of_mem_right _ hJ]
#align box_integral.integral_sum_disj_union BoxIntegral.integralSum_disjUnion
@[simp]
theorem integralSum_add (f g : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I) :
integralSum (f + g) vol Ο = integralSum f vol Ο + integralSum g vol Ο := by
simp only [integralSum, Pi.add_apply, (vol _).map_add, Finset.sum_add_distrib]
#align box_integral.integral_sum_add BoxIntegral.integralSum_add
@[simp]
theorem integralSum_neg (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I) :
integralSum (-f) vol Ο = -integralSum f vol Ο := by
simp only [integralSum, Pi.neg_apply, (vol _).map_neg, Finset.sum_neg_distrib]
#align box_integral.integral_sum_neg BoxIntegral.integralSum_neg
@[simp]
theorem integralSum_smul (c : β) (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (Ο : TaggedPrepartition I) :
integralSum (c β’ f) vol Ο = c β’ integralSum f vol Ο := by
simp only [integralSum, Finset.smul_sum, Pi.smul_apply, ContinuousLinearMap.map_smul]
#align box_integral.integral_sum_smul BoxIntegral.integralSum_smul
variable [Fintype ΞΉ]
def HasIntegral (I : Box ΞΉ) (l : IntegrationParams) (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) (y : F) :
Prop :=
Tendsto (integralSum f vol) (l.toFilteriUnion I β€) (π y)
#align box_integral.has_integral BoxIntegral.HasIntegral
def Integrable (I : Box ΞΉ) (l : IntegrationParams) (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) :=
β y, HasIntegral I l f vol y
#align box_integral.integrable BoxIntegral.Integrable
def integral (I : Box ΞΉ) (l : IntegrationParams) (f : ββΏ β E) (vol : ΞΉ βα΅α΅ E βL[β] F) :=
if h : Integrable I l f vol then h.choose else 0
#align box_integral.integral BoxIntegral.integral
-- Porting note: using the above notation ββΏ here causes the theorem below to be silently ignored
-- see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Lean.204.20doesn't.20add.20lemma.20to.20the.20environment/near/363764522
-- and https://github.com/leanprover/lean4/issues/2257
variable {l : IntegrationParams} {f g : (ΞΉ β β) β E} {vol : ΞΉ βα΅α΅ E βL[β] F} {y y' : F}
theorem HasIntegral.tendsto (h : HasIntegral I l f vol y) :
Tendsto (integralSum f vol) (l.toFilteriUnion I β€) (π y) :=
h
#align box_integral.has_integral.tendsto BoxIntegral.HasIntegral.tendsto
theorem hasIntegral_iff : HasIntegral I l f vol y β
β Ξ΅ > (0 : β), β r : ββ₯0 β ββΏ β Ioi (0 : β), (β c, l.RCond (r c)) β§
β c Ο, l.MemBaseSet I c (r c) Ο β IsPartition Ο β dist (integralSum f vol Ο) y β€ Ξ΅ :=
((l.hasBasis_toFilteriUnion_top I).tendsto_iff nhds_basis_closedBall).trans <| by
simp [@forall_swap ββ₯0 (TaggedPrepartition I)]
#align box_integral.has_integral_iff BoxIntegral.hasIntegral_iff
theorem HasIntegral.of_mul (a : β)
(h : β Ξ΅ : β, 0 < Ξ΅ β β r : ββ₯0 β ββΏ β Ioi (0 : β), (β c, l.RCond (r c)) β§ β c Ο,
l.MemBaseSet I c (r c) Ο β IsPartition Ο β dist (integralSum f vol Ο) y β€ a * Ξ΅) :
HasIntegral I l f vol y := by
refine hasIntegral_iff.2 fun Ξ΅ hΞ΅ => ?_
rcases exists_pos_mul_lt hΞ΅ a with β¨Ξ΅', hΞ΅', haβ©
rcases h Ξ΅' hΞ΅' with β¨r, hr, Hβ©
exact β¨r, hr, fun c Ο hΟ hΟp => (H c Ο hΟ hΟp).trans ha.leβ©
#align box_integral.has_integral_of_mul BoxIntegral.HasIntegral.of_mul
theorem integrable_iff_cauchy [CompleteSpace F] :
Integrable I l f vol β Cauchy ((l.toFilteriUnion I β€).map (integralSum f vol)) :=
cauchy_map_iff_exists_tendsto.symm
#align box_integral.integrable_iff_cauchy BoxIntegral.integrable_iff_cauchy
theorem integrable_iff_cauchy_basis [CompleteSpace F] : Integrable I l f vol β
β Ξ΅ > (0 : β), β r : ββ₯0 β ββΏ β Ioi (0 : β), (β c, l.RCond (r c)) β§
β cβ cβ Οβ Οβ, l.MemBaseSet I cβ (r cβ) Οβ β Οβ.IsPartition β l.MemBaseSet I cβ (r cβ) Οβ β
Οβ.IsPartition β dist (integralSum f vol Οβ) (integralSum f vol Οβ) β€ Ξ΅ := by
rw [integrable_iff_cauchy, cauchy_map_iff',
(l.hasBasis_toFilteriUnion_top _).prod_self.tendsto_iff uniformity_basis_dist_le]
refine forallβ_congr fun Ξ΅ _ => exists_congr fun r => ?_
simp only [exists_prop, Prod.forall, Set.mem_iUnion, exists_imp, prod_mk_mem_set_prod_eq, and_imp,
mem_inter_iff, mem_setOf_eq]
exact
and_congr Iff.rfl
β¨fun H cβ cβ Οβ Οβ hβ hUβ hβ hUβ => H Οβ Οβ cβ hβ hUβ cβ hβ hUβ,
fun H Οβ Οβ cβ hβ hUβ cβ hβ hUβ => H cβ cβ Οβ Οβ hβ hUβ hβ hUββ©
#align box_integral.integrable_iff_cauchy_basis BoxIntegral.integrable_iff_cauchy_basis
theorem HasIntegral.mono {lβ lβ : IntegrationParams} (h : HasIntegral I lβ f vol y) (hl : lβ β€ lβ) :
HasIntegral I lβ f vol y :=
h.mono_left <| IntegrationParams.toFilteriUnion_mono _ hl _
#align box_integral.has_integral.mono BoxIntegral.HasIntegral.mono
protected theorem Integrable.hasIntegral (h : Integrable I l f vol) :
HasIntegral I l f vol (integral I l f vol) := by
rw [integral, dif_pos h]
exact Classical.choose_spec h
#align box_integral.integrable.has_integral BoxIntegral.Integrable.hasIntegral
theorem Integrable.mono {l'} (h : Integrable I l f vol) (hle : l' β€ l) : Integrable I l' f vol :=
β¨_, h.hasIntegral.mono hleβ©
#align box_integral.integrable.mono BoxIntegral.Integrable.mono
theorem HasIntegral.unique (h : HasIntegral I l f vol y) (h' : HasIntegral I l f vol y') : y = y' :=
tendsto_nhds_unique h h'
#align box_integral.has_integral.unique BoxIntegral.HasIntegral.unique
theorem HasIntegral.integrable (h : HasIntegral I l f vol y) : Integrable I l f vol :=
β¨_, hβ©
#align box_integral.has_integral.integrable BoxIntegral.HasIntegral.integrable
theorem HasIntegral.integral_eq (h : HasIntegral I l f vol y) : integral I l f vol = y :=
h.integrable.hasIntegral.unique h
#align box_integral.has_integral.integral_eq BoxIntegral.HasIntegral.integral_eq
nonrec theorem HasIntegral.add (h : HasIntegral I l f vol y) (h' : HasIntegral I l g vol y') :
HasIntegral I l (f + g) vol (y + y') := by
simpa only [HasIntegral, β integralSum_add] using h.add h'
#align box_integral.has_integral.add BoxIntegral.HasIntegral.add
theorem Integrable.add (hf : Integrable I l f vol) (hg : Integrable I l g vol) :
Integrable I l (f + g) vol :=
(hf.hasIntegral.add hg.hasIntegral).integrable
#align box_integral.integrable.add BoxIntegral.Integrable.add
theorem integral_add (hf : Integrable I l f vol) (hg : Integrable I l g vol) :
integral I l (f + g) vol = integral I l f vol + integral I l g vol :=
(hf.hasIntegral.add hg.hasIntegral).integral_eq
#align box_integral.integral_add BoxIntegral.integral_add
nonrec theorem HasIntegral.neg (hf : HasIntegral I l f vol y) : HasIntegral I l (-f) vol (-y) := by
simpa only [HasIntegral, β integralSum_neg] using hf.neg
#align box_integral.has_integral.neg BoxIntegral.HasIntegral.neg
theorem Integrable.neg (hf : Integrable I l f vol) : Integrable I l (-f) vol :=
hf.hasIntegral.neg.integrable
#align box_integral.integrable.neg BoxIntegral.Integrable.neg
theorem Integrable.of_neg (hf : Integrable I l (-f) vol) : Integrable I l f vol :=
neg_neg f βΈ hf.neg
#align box_integral.integrable.of_neg BoxIntegral.Integrable.of_neg
@[simp]
theorem integrable_neg : Integrable I l (-f) vol β Integrable I l f vol :=
β¨fun h => h.of_neg, fun h => h.negβ©
#align box_integral.integrable_neg BoxIntegral.integrable_neg
@[simp]
theorem integral_neg : integral I l (-f) vol = -integral I l f vol :=
if h : Integrable I l f vol then h.hasIntegral.neg.integral_eq
else by rw [integral, integral, dif_neg h, dif_neg (mt Integrable.of_neg h), neg_zero]
#align box_integral.integral_neg BoxIntegral.integral_neg
theorem HasIntegral.sub (h : HasIntegral I l f vol y) (h' : HasIntegral I l g vol y') :
HasIntegral I l (f - g) vol (y - y') := by simpa only [sub_eq_add_neg] using h.add h'.neg
#align box_integral.has_integral.sub BoxIntegral.HasIntegral.sub
theorem Integrable.sub (hf : Integrable I l f vol) (hg : Integrable I l g vol) :
Integrable I l (f - g) vol :=
(hf.hasIntegral.sub hg.hasIntegral).integrable
#align box_integral.integrable.sub BoxIntegral.Integrable.sub
theorem integral_sub (hf : Integrable I l f vol) (hg : Integrable I l g vol) :
integral I l (f - g) vol = integral I l f vol - integral I l g vol :=
(hf.hasIntegral.sub hg.hasIntegral).integral_eq
#align box_integral.integral_sub BoxIntegral.integral_sub
theorem hasIntegral_const (c : E) : HasIntegral I l (fun _ => c) vol (vol I c) :=
tendsto_const_nhds.congr' <| (l.eventually_isPartition I).mono fun _Ο hΟ => Eq.symm <|
(vol.map β¨β¨fun g : E βL[β] F β¦ g c, rflβ©, fun _ _ β¦ rflβ©).sum_partition_boxes le_top hΟ
#align box_integral.has_integral_const BoxIntegral.hasIntegral_const
@[simp]
theorem integral_const (c : E) : integral I l (fun _ => c) vol = vol I c :=
(hasIntegral_const c).integral_eq
#align box_integral.integral_const BoxIntegral.integral_const
theorem integrable_const (c : E) : Integrable I l (fun _ => c) vol :=
β¨_, hasIntegral_const cβ©
#align box_integral.integrable_const BoxIntegral.integrable_const
theorem hasIntegral_zero : HasIntegral I l (fun _ => (0 : E)) vol 0 := by
simpa only [β (vol I).map_zero] using hasIntegral_const (0 : E)
#align box_integral.has_integral_zero BoxIntegral.hasIntegral_zero
theorem integrable_zero : Integrable I l (fun _ => (0 : E)) vol :=
β¨0, hasIntegral_zeroβ©
#align box_integral.integrable_zero BoxIntegral.integrable_zero
theorem integral_zero : integral I l (fun _ => (0 : E)) vol = 0 :=
hasIntegral_zero.integral_eq
#align box_integral.integral_zero BoxIntegral.integral_zero
theorem HasIntegral.sum {Ξ± : Type*} {s : Finset Ξ±} {f : Ξ± β ββΏ β E} {g : Ξ± β F}
(h : β i β s, HasIntegral I l (f i) vol (g i)) :
HasIntegral I l (fun x => β i β s, f i x) vol (β i β s, g i) := by
induction' s using Finset.induction_on with a s ha ihs; Β· simp [hasIntegral_zero]
simp only [Finset.sum_insert ha]; rw [Finset.forall_mem_insert] at h
exact h.1.add (ihs h.2)
#align box_integral.has_integral_sum BoxIntegral.HasIntegral.sum
theorem HasIntegral.smul (hf : HasIntegral I l f vol y) (c : β) :
HasIntegral I l (c β’ f) vol (c β’ y) := by
simpa only [HasIntegral, β integralSum_smul] using
(tendsto_const_nhds : Tendsto _ _ (π c)).smul hf
#align box_integral.has_integral.smul BoxIntegral.HasIntegral.smul
theorem Integrable.smul (hf : Integrable I l f vol) (c : β) : Integrable I l (c β’ f) vol :=
(hf.hasIntegral.smul c).integrable
#align box_integral.integrable.smul BoxIntegral.Integrable.smul
theorem Integrable.of_smul {c : β} (hf : Integrable I l (c β’ f) vol) (hc : c β 0) :
Integrable I l f vol := by
simpa [inv_smul_smulβ hc] using hf.smul cβ»ΒΉ
#align box_integral.integrable.of_smul BoxIntegral.Integrable.of_smul
@[simp]
theorem integral_smul (c : β) : integral I l (fun x => c β’ f x) vol = c β’ integral I l f vol := by
rcases eq_or_ne c 0 with (rfl | hc); Β· simp only [zero_smul, integral_zero]
by_cases hf : Integrable I l f vol
Β· exact (hf.hasIntegral.smul c).integral_eq
Β· have : Β¬Integrable I l (fun x => c β’ f x) vol := mt (fun h => h.of_smul hc) hf
rw [integral, integral, dif_neg hf, dif_neg this, smul_zero]
#align box_integral.integral_smul BoxIntegral.integral_smul
open MeasureTheory
theorem integral_nonneg {g : ββΏ β β} (hg : β x β Box.Icc I, 0 β€ g x) (ΞΌ : Measure ββΏ)
[IsLocallyFiniteMeasure ΞΌ] : 0 β€ integral I l g ΞΌ.toBoxAdditive.toSMul := by
by_cases hgi : Integrable I l g ΞΌ.toBoxAdditive.toSMul
Β· refine ge_of_tendsto' hgi.hasIntegral fun Ο => sum_nonneg fun J _ => ?_
exact mul_nonneg ENNReal.toReal_nonneg (hg _ <| Ο.tag_mem_Icc _)
Β· rw [integral, dif_neg hgi]
#align box_integral.integral_nonneg BoxIntegral.integral_nonneg
theorem norm_integral_le_of_norm_le {g : ββΏ β β} (hle : β x β Box.Icc I, βf xβ β€ g x)
(ΞΌ : Measure ββΏ) [IsLocallyFiniteMeasure ΞΌ] (hg : Integrable I l g ΞΌ.toBoxAdditive.toSMul) :
β(integral I l f ΞΌ.toBoxAdditive.toSMul : E)β β€ integral I l g ΞΌ.toBoxAdditive.toSMul := by
by_cases hfi : Integrable.{u, v, v} I l f ΞΌ.toBoxAdditive.toSMul
Β· refine le_of_tendsto_of_tendsto' hfi.hasIntegral.norm hg.hasIntegral fun Ο => ?_
refine norm_sum_le_of_le _ fun J _ => ?_
simp only [BoxAdditiveMap.toSMul_apply, norm_smul, smul_eq_mul, Real.norm_eq_abs,
ΞΌ.toBoxAdditive_apply, abs_of_nonneg ENNReal.toReal_nonneg]
exact mul_le_mul_of_nonneg_left (hle _ <| Ο.tag_mem_Icc _) ENNReal.toReal_nonneg
Β· rw [integral, dif_neg hfi, norm_zero]
exact integral_nonneg (fun x hx => (norm_nonneg _).trans (hle x hx)) ΞΌ
#align box_integral.norm_integral_le_of_norm_le BoxIntegral.norm_integral_le_of_norm_le
theorem norm_integral_le_of_le_const {c : β}
(hc : β x β Box.Icc I, βf xβ β€ c) (ΞΌ : Measure ββΏ) [IsLocallyFiniteMeasure ΞΌ] :
β(integral I l f ΞΌ.toBoxAdditive.toSMul : E)β β€ (ΞΌ I).toReal * c := by
simpa only [integral_const] using norm_integral_le_of_norm_le hc ΞΌ (integrable_const c)
#align box_integral.norm_integral_le_of_le_const BoxIntegral.norm_integral_le_of_le_const
namespace Integrable
def convergenceR (h : Integrable I l f vol) (Ξ΅ : β) : ββ₯0 β ββΏ β Ioi (0 : β) :=
if hΞ΅ : 0 < Ξ΅ then (hasIntegral_iff.1 h.hasIntegral Ξ΅ hΞ΅).choose
else fun _ _ => β¨1, Set.mem_Ioi.2 zero_lt_oneβ©
#align box_integral.integrable.convergence_r BoxIntegral.Integrable.convergenceR
variable {c cβ cβ : ββ₯0} {Ξ΅ Ξ΅β Ξ΅β : β} {Οβ Οβ : TaggedPrepartition I}
theorem convergenceR_cond (h : Integrable I l f vol) (Ξ΅ : β) (c : ββ₯0) :
l.RCond (h.convergenceR Ξ΅ c) := by
rw [convergenceR]; split_ifs with hβ
exacts [(hasIntegral_iff.1 h.hasIntegral Ξ΅ hβ).choose_spec.1 _, fun _ x => rfl]
#align box_integral.integrable.convergence_r_cond BoxIntegral.Integrable.convergenceR_cond
theorem dist_integralSum_integral_le_of_memBaseSet (h : Integrable I l f vol) (hβ : 0 < Ξ΅)
(hΟ : l.MemBaseSet I c (h.convergenceR Ξ΅ c) Ο) (hΟp : Ο.IsPartition) :
dist (integralSum f vol Ο) (integral I l f vol) β€ Ξ΅ := by
rw [convergenceR, dif_pos hβ] at hΟ
exact (hasIntegral_iff.1 h.hasIntegral Ξ΅ hβ).choose_spec.2 c _ hΟ hΟp
#align box_integral.integrable.dist_integral_sum_integral_le_of_mem_base_set BoxIntegral.Integrable.dist_integralSum_integral_le_of_memBaseSet
theorem dist_integralSum_le_of_memBaseSet (h : Integrable I l f vol) (hposβ : 0 < Ξ΅β)
(hposβ : 0 < Ξ΅β) (hβ : l.MemBaseSet I cβ (h.convergenceR Ξ΅β cβ) Οβ)
(hβ : l.MemBaseSet I cβ (h.convergenceR Ξ΅β cβ) Οβ) (HU : Οβ.iUnion = Οβ.iUnion) :
dist (integralSum f vol Οβ) (integralSum f vol Οβ) β€ Ξ΅β + Ξ΅β := by
rcases hβ.exists_common_compl hβ HU with β¨Ο, hΟU, hΟcβ, hΟcββ©
set r : ββΏ β Ioi (0 : β) := fun x => min (h.convergenceR Ξ΅β cβ x) (h.convergenceR Ξ΅β cβ x)
set Οr := Ο.toSubordinate r
have Hβ :
dist (integralSum f vol (Οβ.unionComplToSubordinate Ο hΟU r)) (integral I l f vol) β€ Ξ΅β :=
h.dist_integralSum_integral_le_of_memBaseSet hposβ
(hβ.unionComplToSubordinate (fun _ _ => min_le_left _ _) hΟU hΟcβ)
(isPartition_unionComplToSubordinate _ _ _ _)
rw [HU] at hΟU
have Hβ :
dist (integralSum f vol (Οβ.unionComplToSubordinate Ο hΟU r)) (integral I l f vol) β€ Ξ΅β :=
h.dist_integralSum_integral_le_of_memBaseSet hposβ
(hβ.unionComplToSubordinate (fun _ _ => min_le_right _ _) hΟU hΟcβ)
(isPartition_unionComplToSubordinate _ _ _ _)
simpa [unionComplToSubordinate] using (dist_triangle_right _ _ _).trans (add_le_add Hβ Hβ)
#align box_integral.integrable.dist_integral_sum_le_of_mem_base_set BoxIntegral.Integrable.dist_integralSum_le_of_memBaseSet
theorem tendsto_integralSum_toFilter_prod_self_inf_iUnion_eq_uniformity (h : Integrable I l f vol) :
Tendsto (fun Ο : TaggedPrepartition I Γ TaggedPrepartition I =>
(integralSum f vol Ο.1, integralSum f vol Ο.2))
((l.toFilter I ΓΛ’ l.toFilter I) β π {Ο | Ο.1.iUnion = Ο.2.iUnion}) (π€ F) := by
refine (((l.hasBasis_toFilter I).prod_self.inf_principal _).tendsto_iff
uniformity_basis_dist_le).2 fun Ξ΅ Ξ΅0 => ?_
replace Ξ΅0 := half_pos Ξ΅0
use h.convergenceR (Ξ΅ / 2), h.convergenceR_cond (Ξ΅ / 2); rintro β¨Οβ, Οββ© β¨β¨hβ, hββ©, hUβ©
rw [β add_halves Ξ΅]
exact h.dist_integralSum_le_of_memBaseSet Ξ΅0 Ξ΅0 hβ.choose_spec hβ.choose_spec hU
#align box_integral.integrable.tendsto_integral_sum_to_filter_prod_self_inf_Union_eq_uniformity BoxIntegral.Integrable.tendsto_integralSum_toFilter_prod_self_inf_iUnion_eq_uniformity
theorem cauchy_map_integralSum_toFilteriUnion (h : Integrable I l f vol) (Οβ : Prepartition I) :
Cauchy ((l.toFilteriUnion I Οβ).map (integralSum f vol)) := by
refine β¨inferInstance, ?_β©
rw [prod_map_map_eq, β toFilter_inf_iUnion_eq, β prod_inf_prod, prod_principal_principal]
exact h.tendsto_integralSum_toFilter_prod_self_inf_iUnion_eq_uniformity.mono_left
(inf_le_inf_left _ <| principal_mono.2 fun Ο h => h.1.trans h.2.symm)
#align box_integral.integrable.cauchy_map_integral_sum_to_filter_Union BoxIntegral.Integrable.cauchy_map_integralSum_toFilteriUnion
variable [CompleteSpace F]
| Mathlib/Analysis/BoxIntegral/Basic.lean | 527 | 532 | theorem to_subbox_aux (h : Integrable I l f vol) (hJ : J β€ I) :
β y : F, HasIntegral J l f vol y β§
Tendsto (integralSum f vol) (l.toFilteriUnion I (Prepartition.single I J hJ)) (π y) := by |
refine (cauchy_map_iff_exists_tendsto.1
(h.cauchy_map_integralSum_toFilteriUnion (.single I J hJ))).imp fun y hy β¦ β¨?_, hyβ©
convert hy.comp (l.tendsto_embedBox_toFilteriUnion_top hJ) -- faster than `exact` here
|
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.Analysis.NormedSpace.Dual
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lp
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.function.ae_eq_of_integral from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open MeasureTheory TopologicalSpace NormedSpace Filter
open scoped ENNReal NNReal MeasureTheory Topology
namespace MeasureTheory
variable {Ξ± E : Type*} {m m0 : MeasurableSpace Ξ±} {ΞΌ : Measure Ξ±} {s t : Set Ξ±}
[NormedAddCommGroup E] [NormedSpace β E] [CompleteSpace E] {p : ββ₯0β}
section AeEqOfForallSetIntegralEq
theorem ae_const_le_iff_forall_lt_measure_zero {Ξ²} [LinearOrder Ξ²] [TopologicalSpace Ξ²]
[OrderTopology Ξ²] [FirstCountableTopology Ξ²] (f : Ξ± β Ξ²) (c : Ξ²) :
(βα΅ x βΞΌ, c β€ f x) β β b < c, ΞΌ {x | f x β€ b} = 0 := by
rw [ae_iff]
push_neg
constructor
Β· intro h b hb
exact measure_mono_null (fun y hy => (lt_of_le_of_lt hy hb : _)) h
intro hc
by_cases h : β b, c β€ b
Β· have : {a : Ξ± | f a < c} = β
:= by
apply Set.eq_empty_iff_forall_not_mem.2 fun x hx => ?_
exact (lt_irrefl _ (lt_of_lt_of_le hx (h (f x)))).elim
simp [this]
by_cases H : Β¬IsLUB (Set.Iio c) c
Β· have : c β upperBounds (Set.Iio c) := fun y hy => le_of_lt hy
obtain β¨b, b_up, bcβ© : β b : Ξ², b β upperBounds (Set.Iio c) β§ b < c := by
simpa [IsLUB, IsLeast, this, lowerBounds] using H
exact measure_mono_null (fun x hx => b_up hx) (hc b bc)
push_neg at H h
obtain β¨u, _, u_lt, u_lim, -β© :
β u : β β Ξ²,
StrictMono u β§ (β n : β, u n < c) β§ Tendsto u atTop (π c) β§ β n : β, u n β Set.Iio c :=
H.exists_seq_strictMono_tendsto_of_not_mem (lt_irrefl c) h
have h_Union : {x | f x < c} = β n : β, {x | f x β€ u n} := by
ext1 x
simp_rw [Set.mem_iUnion, Set.mem_setOf_eq]
constructor <;> intro h
Β· obtain β¨n, hnβ© := ((tendsto_order.1 u_lim).1 _ h).exists; exact β¨n, hn.leβ©
Β· obtain β¨n, hnβ© := h; exact hn.trans_lt (u_lt _)
rw [h_Union, measure_iUnion_null_iff]
intro n
exact hc _ (u_lt n)
#align measure_theory.ae_const_le_iff_forall_lt_measure_zero MeasureTheory.ae_const_le_iff_forall_lt_measure_zero
section Real
variable {f : Ξ± β β}
theorem ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable (hfm : StronglyMeasurable f)
(hf : Integrable f ΞΌ) (hf_zero : β s, MeasurableSet s β ΞΌ s < β β 0 β€ β« x in s, f x βΞΌ) :
0 β€α΅[ΞΌ] f := by
simp_rw [EventuallyLE, Pi.zero_apply]
rw [ae_const_le_iff_forall_lt_measure_zero]
intro b hb_neg
let s := {x | f x β€ b}
have hs : MeasurableSet s := hfm.measurableSet_le stronglyMeasurable_const
have mus : ΞΌ s < β := Integrable.measure_le_lt_top hf hb_neg
have h_int_gt : (β« x in s, f x βΞΌ) β€ b * (ΞΌ s).toReal := by
have h_const_le : (β« x in s, f x βΞΌ) β€ β« _ in s, b βΞΌ := by
refine
setIntegral_mono_ae_restrict hf.integrableOn (integrableOn_const.mpr (Or.inr mus)) ?_
rw [EventuallyLE, ae_restrict_iff hs]
exact eventually_of_forall fun x hxs => hxs
rwa [setIntegral_const, smul_eq_mul, mul_comm] at h_const_le
by_contra h
refine (lt_self_iff_false (β« x in s, f x βΞΌ)).mp (h_int_gt.trans_lt ?_)
refine (mul_neg_iff.mpr (Or.inr β¨hb_neg, ?_β©)).trans_le ?_
swap
Β· exact hf_zero s hs mus
refine ENNReal.toReal_nonneg.lt_of_ne fun h_eq => h ?_
cases' (ENNReal.toReal_eq_zero_iff _).mp h_eq.symm with hΞΌs_eq_zero hΞΌs_eq_top
Β· exact hΞΌs_eq_zero
Β· exact absurd hΞΌs_eq_top mus.ne
#align measure_theory.ae_nonneg_of_forall_set_integral_nonneg_of_strongly_measurable MeasureTheory.ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable
@[deprecated (since := "2024-04-17")]
alias ae_nonneg_of_forall_set_integral_nonneg_of_stronglyMeasurable :=
ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable
theorem ae_nonneg_of_forall_setIntegral_nonneg (hf : Integrable f ΞΌ)
(hf_zero : β s, MeasurableSet s β ΞΌ s < β β 0 β€ β« x in s, f x βΞΌ) : 0 β€α΅[ΞΌ] f := by
rcases hf.1 with β¨f', hf'_meas, hf_aeβ©
have hf'_integrable : Integrable f' ΞΌ := Integrable.congr hf hf_ae
have hf'_zero : β s, MeasurableSet s β ΞΌ s < β β 0 β€ β« x in s, f' x βΞΌ := by
intro s hs h's
rw [setIntegral_congr_ae hs (hf_ae.mono fun x hx _ => hx.symm)]
exact hf_zero s hs h's
exact
(ae_nonneg_of_forall_setIntegral_nonneg_of_stronglyMeasurable hf'_meas hf'_integrable
hf'_zero).trans
hf_ae.symm.le
#align measure_theory.ae_nonneg_of_forall_set_integral_nonneg MeasureTheory.ae_nonneg_of_forall_setIntegral_nonneg
@[deprecated (since := "2024-04-17")]
alias ae_nonneg_of_forall_set_integral_nonneg :=
ae_nonneg_of_forall_setIntegral_nonneg
| Mathlib/MeasureTheory/Function/AEEqOfIntegral.lean | 309 | 315 | theorem ae_le_of_forall_setIntegral_le {f g : Ξ± β β} (hf : Integrable f ΞΌ) (hg : Integrable g ΞΌ)
(hf_le : β s, MeasurableSet s β ΞΌ s < β β (β« x in s, f x βΞΌ) β€ β« x in s, g x βΞΌ) :
f β€α΅[ΞΌ] g := by |
rw [β eventually_sub_nonneg]
refine ae_nonneg_of_forall_setIntegral_nonneg (hg.sub hf) fun s hs => ?_
rw [integral_sub' hg.integrableOn hf.integrableOn, sub_nonneg]
exact hf_le s hs
|
import Mathlib.Data.Matrix.Basis
import Mathlib.RingTheory.TensorProduct.Basic
#align_import ring_theory.matrix_algebra from "leanprover-community/mathlib"@"6c351a8fb9b06e5a542fdf427bfb9f46724f9453"
suppress_compilation
universe u v w
open TensorProduct
open TensorProduct
open Algebra.TensorProduct
open Matrix
variable {R : Type u} [CommSemiring R]
variable {A : Type v} [Semiring A] [Algebra R A]
variable {n : Type w}
variable (R A n)
namespace MatrixEquivTensor
def toFunBilinear : A ββ[R] Matrix n n R ββ[R] Matrix n n A :=
(Algebra.lsmul R R (Matrix n n A)).toLinearMap.complβ (Algebra.linearMap R A).mapMatrix
#align matrix_equiv_tensor.to_fun_bilinear MatrixEquivTensor.toFunBilinear
@[simp]
theorem toFunBilinear_apply (a : A) (m : Matrix n n R) :
toFunBilinear R A n a m = a β’ m.map (algebraMap R A) :=
rfl
#align matrix_equiv_tensor.to_fun_bilinear_apply MatrixEquivTensor.toFunBilinear_apply
def toFunLinear : A β[R] Matrix n n R ββ[R] Matrix n n A :=
TensorProduct.lift (toFunBilinear R A n)
#align matrix_equiv_tensor.to_fun_linear MatrixEquivTensor.toFunLinear
variable [DecidableEq n] [Fintype n]
def toFunAlgHom : A β[R] Matrix n n R ββ[R] Matrix n n A :=
algHomOfLinearMapTensorProduct (toFunLinear R A n)
(by
intros
simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul]
ext
dsimp
simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum,
_root_.mul_assoc, Algebra.left_comm])
(by
simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply,
Matrix.map_one (algebraMap R A) (map_zero _) (map_one _), one_smul])
#align matrix_equiv_tensor.to_fun_alg_hom MatrixEquivTensor.toFunAlgHom
@[simp]
theorem toFunAlgHom_apply (a : A) (m : Matrix n n R) :
toFunAlgHom R A n (a ββ m) = a β’ m.map (algebraMap R A) := rfl
#align matrix_equiv_tensor.to_fun_alg_hom_apply MatrixEquivTensor.toFunAlgHom_apply
def invFun (M : Matrix n n A) : A β[R] Matrix n n R :=
β p : n Γ n, M p.1 p.2 ββ stdBasisMatrix p.1 p.2 1
#align matrix_equiv_tensor.inv_fun MatrixEquivTensor.invFun
@[simp]
theorem invFun_zero : invFun R A n 0 = 0 := by simp [invFun]
#align matrix_equiv_tensor.inv_fun_zero MatrixEquivTensor.invFun_zero
@[simp]
theorem invFun_add (M N : Matrix n n A) :
invFun R A n (M + N) = invFun R A n M + invFun R A n N := by
simp [invFun, add_tmul, Finset.sum_add_distrib]
#align matrix_equiv_tensor.inv_fun_add MatrixEquivTensor.invFun_add
@[simp]
| Mathlib/RingTheory/MatrixAlgebra.lean | 99 | 101 | theorem invFun_smul (a : A) (M : Matrix n n A) :
invFun R A n (a β’ M) = a ββ 1 * invFun R A n M := by |
simp [invFun, Finset.mul_sum]
|
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Int.GCD
import Mathlib.RingTheory.Coprime.Basic
#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
universe u v
section RelPrime
variable {Ξ± I} [CommMonoid Ξ±] [DecompositionMonoid Ξ±] {x y z : Ξ±} {s : I β Ξ±} {t : Finset I}
| Mathlib/RingTheory/Coprime/Lemmas.lean | 235 | 240 | theorem IsRelPrime.prod_left : (β i β t, IsRelPrime (s i) x) β IsRelPrime (β i β t, s i) x := by |
classical
refine Finset.induction_on t (fun _ β¦ isRelPrime_one_left) fun b t hbt ih H β¦ ?_
rw [Finset.prod_insert hbt]
rw [Finset.forall_mem_insert] at H
exact H.1.mul_left (ih H.2)
|
import Mathlib.Analysis.Complex.UpperHalfPlane.Topology
import Mathlib.Analysis.SpecialFunctions.Arsinh
import Mathlib.Geometry.Euclidean.Inversion.Basic
#align_import analysis.complex.upper_half_plane.metric from "leanprover-community/mathlib"@"caa58cbf5bfb7f81ccbaca4e8b8ac4bc2b39cc1c"
noncomputable section
open scoped UpperHalfPlane ComplexConjugate NNReal Topology MatrixGroups
open Set Metric Filter Real
variable {z w : β} {r R : β}
namespace UpperHalfPlane
instance : Dist β :=
β¨fun z w => 2 * arsinh (dist (z : β) w / (2 * β(z.im * w.im)))β©
theorem dist_eq (z w : β) : dist z w = 2 * arsinh (dist (z : β) w / (2 * β(z.im * w.im))) :=
rfl
#align upper_half_plane.dist_eq UpperHalfPlane.dist_eq
theorem sinh_half_dist (z w : β) :
sinh (dist z w / 2) = dist (z : β) w / (2 * β(z.im * w.im)) := by
rw [dist_eq, mul_div_cancel_leftβ (arsinh _) two_ne_zero, sinh_arsinh]
#align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist
theorem cosh_half_dist (z w : β) :
cosh (dist z w / 2) = dist (z : β) (conj (w : β)) / (2 * β(z.im * w.im)) := by
rw [β sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt]
Β· congr 1
simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj,
Complex.conj_conj, Complex.mul_re, Complex.conj_re, Complex.conj_im, coe_im]
ring
all_goals positivity
#align upper_half_plane.cosh_half_dist UpperHalfPlane.cosh_half_dist
theorem tanh_half_dist (z w : β) :
tanh (dist z w / 2) = dist (z : β) w / dist (z : β) (conj βw) := by
rw [tanh_eq_sinh_div_cosh, sinh_half_dist, cosh_half_dist, div_div_div_comm, div_self, div_one]
positivity
#align upper_half_plane.tanh_half_dist UpperHalfPlane.tanh_half_dist
theorem exp_half_dist (z w : β) :
exp (dist z w / 2) = (dist (z : β) w + dist (z : β) (conj βw)) / (2 * β(z.im * w.im)) := by
rw [β sinh_add_cosh, sinh_half_dist, cosh_half_dist, add_div]
#align upper_half_plane.exp_half_dist UpperHalfPlane.exp_half_dist
theorem cosh_dist (z w : β) : cosh (dist z w) = 1 + dist (z : β) w ^ 2 / (2 * z.im * w.im) := by
rw [dist_eq, cosh_two_mul, cosh_sq', add_assoc, β two_mul, sinh_arsinh, div_pow, mul_pow,
sq_sqrt, sq (2 : β), mul_assoc, β mul_div_assoc, mul_assoc, mul_div_mul_left] <;> positivity
#align upper_half_plane.cosh_dist UpperHalfPlane.cosh_dist
theorem sinh_half_dist_add_dist (a b c : β) : sinh ((dist a b + dist b c) / 2) =
(dist (a : β) b * dist (c : β) (conj βb) + dist (b : β) c * dist (a : β) (conj βb)) /
(2 * β(a.im * c.im) * dist (b : β) (conj βb)) := by
simp only [add_div _ _ (2 : β), sinh_add, sinh_half_dist, cosh_half_dist, div_mul_div_comm]
rw [β add_div, Complex.dist_self_conj, coe_im, abs_of_pos b.im_pos, mul_comm (dist (b : β) _),
dist_comm (b : β), Complex.dist_conj_comm, mul_mul_mul_comm, mul_mul_mul_comm _ _ _ b.im]
congr 2
rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (βa.im), mul_mul_mul_comm, mul_self_sqrt,
mul_comm] <;> exact (im_pos _).le
#align upper_half_plane.sinh_half_dist_add_dist UpperHalfPlane.sinh_half_dist_add_dist
protected theorem dist_comm (z w : β) : dist z w = dist w z := by
simp only [dist_eq, dist_comm (z : β), mul_comm]
#align upper_half_plane.dist_comm UpperHalfPlane.dist_comm
theorem dist_le_iff_le_sinh :
dist z w β€ r β dist (z : β) w / (2 * β(z.im * w.im)) β€ sinh (r / 2) := by
rw [β div_le_div_right (zero_lt_two' β), β sinh_le_sinh, sinh_half_dist]
#align upper_half_plane.dist_le_iff_le_sinh UpperHalfPlane.dist_le_iff_le_sinh
theorem dist_eq_iff_eq_sinh :
dist z w = r β dist (z : β) w / (2 * β(z.im * w.im)) = sinh (r / 2) := by
rw [β div_left_inj' (two_ne_zero' β), β sinh_inj, sinh_half_dist]
#align upper_half_plane.dist_eq_iff_eq_sinh UpperHalfPlane.dist_eq_iff_eq_sinh
theorem dist_eq_iff_eq_sq_sinh (hr : 0 β€ r) :
dist z w = r β dist (z : β) w ^ 2 / (4 * z.im * w.im) = sinh (r / 2) ^ 2 := by
rw [dist_eq_iff_eq_sinh, β sq_eq_sq, div_pow, mul_pow, sq_sqrt, mul_assoc]
Β· norm_num
all_goals positivity
#align upper_half_plane.dist_eq_iff_eq_sq_sinh UpperHalfPlane.dist_eq_iff_eq_sq_sinh
protected theorem dist_triangle (a b c : β) : dist a c β€ dist a b + dist b c := by
rw [dist_le_iff_le_sinh, sinh_half_dist_add_dist, div_mul_eq_div_div _ _ (dist _ _), le_div_iff,
div_mul_eq_mul_div]
Β· gcongr
exact EuclideanGeometry.mul_dist_le_mul_dist_add_mul_dist (a : β) b c (conj (b : β))
Β· rw [dist_comm, dist_pos, Ne, Complex.conj_eq_iff_im]
exact b.im_ne_zero
#align upper_half_plane.dist_triangle UpperHalfPlane.dist_triangle
theorem dist_le_dist_coe_div_sqrt (z w : β) : dist z w β€ dist (z : β) w / β(z.im * w.im) := by
rw [dist_le_iff_le_sinh, β div_mul_eq_div_div_swap, self_le_sinh_iff]
positivity
#align upper_half_plane.dist_le_dist_coe_div_sqrt UpperHalfPlane.dist_le_dist_coe_div_sqrt
def metricSpaceAux : MetricSpace β where
dist := dist
dist_self z := by rw [dist_eq, dist_self, zero_div, arsinh_zero, mul_zero]
dist_comm := UpperHalfPlane.dist_comm
dist_triangle := UpperHalfPlane.dist_triangle
eq_of_dist_eq_zero {z w} h := by
simpa [dist_eq, Real.sqrt_eq_zero', (mul_pos z.im_pos w.im_pos).not_le, ext_iff] using h
edist_dist _ _ := by exact ENNReal.coe_nnreal_eq _
#align upper_half_plane.metric_space_aux UpperHalfPlane.metricSpaceAux
open Complex
theorem cosh_dist' (z w : β) :
Real.cosh (dist z w) = ((z.re - w.re) ^ 2 + z.im ^ 2 + w.im ^ 2) / (2 * z.im * w.im) := by
field_simp [cosh_dist, Complex.dist_eq, Complex.sq_abs, normSq_apply]
ring
#align upper_half_plane.cosh_dist' UpperHalfPlane.cosh_dist'
def center (z : β) (r : β) : β :=
β¨β¨z.re, z.im * Real.cosh rβ©, by positivityβ©
#align upper_half_plane.center UpperHalfPlane.center
@[simp]
theorem center_re (z r) : (center z r).re = z.re :=
rfl
#align upper_half_plane.center_re UpperHalfPlane.center_re
@[simp]
theorem center_im (z r) : (center z r).im = z.im * Real.cosh r :=
rfl
#align upper_half_plane.center_im UpperHalfPlane.center_im
@[simp]
theorem center_zero (z : β) : center z 0 = z :=
ext' rfl <| by rw [center_im, Real.cosh_zero, mul_one]
#align upper_half_plane.center_zero UpperHalfPlane.center_zero
theorem dist_coe_center_sq (z w : β) (r : β) : dist (z : β) (w.center r) ^ 2 =
2 * z.im * w.im * (Real.cosh (dist z w) - Real.cosh r) + (w.im * Real.sinh r) ^ 2 := by
have H : 2 * z.im * w.im β 0 := by positivity
simp only [Complex.dist_eq, Complex.sq_abs, normSq_apply, coe_re, coe_im, center_re, center_im,
cosh_dist', mul_div_cancelβ _ H, sub_sq z.im, mul_pow, Real.cosh_sq, sub_re, sub_im, mul_sub, β
sq]
ring
#align upper_half_plane.dist_coe_center_sq UpperHalfPlane.dist_coe_center_sq
theorem dist_coe_center (z w : β) (r : β) : dist (z : β) (w.center r) =
β(2 * z.im * w.im * (Real.cosh (dist z w) - Real.cosh r) + (w.im * Real.sinh r) ^ 2) := by
rw [β sqrt_sq dist_nonneg, dist_coe_center_sq]
#align upper_half_plane.dist_coe_center UpperHalfPlane.dist_coe_center
theorem cmp_dist_eq_cmp_dist_coe_center (z w : β) (r : β) :
cmp (dist z w) r = cmp (dist (z : β) (w.center r)) (w.im * Real.sinh r) := by
letI := metricSpaceAux
cases' lt_or_le r 0 with hrβ hrβ
Β· trans Ordering.gt
exacts [(hrβ.trans_le dist_nonneg).cmp_eq_gt,
((mul_neg_of_pos_of_neg w.im_pos (sinh_neg_iff.2 hrβ)).trans_le dist_nonneg).cmp_eq_gt.symm]
have hrβ' : 0 β€ w.im * Real.sinh r := by positivity
have hzwβ : 0 < 2 * z.im * w.im := by positivity
simp only [β cosh_strictMonoOn.cmp_map_eq dist_nonneg hrβ, β
(pow_left_strictMonoOn two_ne_zero).cmp_map_eq dist_nonneg hrβ', dist_coe_center_sq]
rw [β cmp_mul_pos_left hzwβ, β cmp_sub_zero, β mul_sub, β cmp_add_right, zero_add]
#align upper_half_plane.cmp_dist_eq_cmp_dist_coe_center UpperHalfPlane.cmp_dist_eq_cmp_dist_coe_center
theorem dist_eq_iff_dist_coe_center_eq :
dist z w = r β dist (z : β) (w.center r) = w.im * Real.sinh r :=
eq_iff_eq_of_cmp_eq_cmp (cmp_dist_eq_cmp_dist_coe_center z w r)
#align upper_half_plane.dist_eq_iff_dist_coe_center_eq UpperHalfPlane.dist_eq_iff_dist_coe_center_eq
@[simp]
theorem dist_self_center (z : β) (r : β) :
dist (z : β) (z.center r) = z.im * (Real.cosh r - 1) := by
rw [dist_of_re_eq (z.center_re r).symm, dist_comm, Real.dist_eq, mul_sub, mul_one]
exact abs_of_nonneg (sub_nonneg.2 <| le_mul_of_one_le_right z.im_pos.le (one_le_cosh _))
#align upper_half_plane.dist_self_center UpperHalfPlane.dist_self_center
@[simp]
theorem dist_center_dist (z w : β) :
dist (z : β) (w.center (dist z w)) = w.im * Real.sinh (dist z w) :=
dist_eq_iff_dist_coe_center_eq.1 rfl
#align upper_half_plane.dist_center_dist UpperHalfPlane.dist_center_dist
theorem dist_lt_iff_dist_coe_center_lt :
dist z w < r β dist (z : β) (w.center r) < w.im * Real.sinh r :=
lt_iff_lt_of_cmp_eq_cmp (cmp_dist_eq_cmp_dist_coe_center z w r)
#align upper_half_plane.dist_lt_iff_dist_coe_center_lt UpperHalfPlane.dist_lt_iff_dist_coe_center_lt
theorem lt_dist_iff_lt_dist_coe_center :
r < dist z w β w.im * Real.sinh r < dist (z : β) (w.center r) :=
lt_iff_lt_of_cmp_eq_cmp (cmp_eq_cmp_symm.1 <| cmp_dist_eq_cmp_dist_coe_center z w r)
#align upper_half_plane.lt_dist_iff_lt_dist_coe_center UpperHalfPlane.lt_dist_iff_lt_dist_coe_center
theorem dist_le_iff_dist_coe_center_le :
dist z w β€ r β dist (z : β) (w.center r) β€ w.im * Real.sinh r :=
le_iff_le_of_cmp_eq_cmp (cmp_dist_eq_cmp_dist_coe_center z w r)
#align upper_half_plane.dist_le_iff_dist_coe_center_le UpperHalfPlane.dist_le_iff_dist_coe_center_le
theorem le_dist_iff_le_dist_coe_center :
r < dist z w β w.im * Real.sinh r < dist (z : β) (w.center r) :=
lt_iff_lt_of_cmp_eq_cmp (cmp_eq_cmp_symm.1 <| cmp_dist_eq_cmp_dist_coe_center z w r)
#align upper_half_plane.le_dist_iff_le_dist_coe_center UpperHalfPlane.le_dist_iff_le_dist_coe_center
nonrec theorem dist_of_re_eq (h : z.re = w.re) : dist z w = dist (log z.im) (log w.im) := by
have hβ : 0 < z.im / w.im := by positivity
rw [dist_eq_iff_dist_coe_center_eq, Real.dist_eq, β abs_sinh, β log_div z.im_ne_zero w.im_ne_zero,
sinh_log hβ, dist_of_re_eq, coe_im, coe_im, center_im, cosh_abs, cosh_log hβ, inv_div] <;>
[skip; exact h]
nth_rw 4 [β abs_of_pos w.im_pos]
simp only [β _root_.abs_mul, coe_im, Real.dist_eq]
congr 1
field_simp
ring
#align upper_half_plane.dist_of_re_eq UpperHalfPlane.dist_of_re_eq
theorem dist_log_im_le (z w : β) : dist (log z.im) (log w.im) β€ dist z w :=
calc
dist (log z.im) (log w.im) = dist (mk β¨0, z.imβ© z.im_pos) (mk β¨0, w.imβ© w.im_pos) :=
Eq.symm <| dist_of_re_eq rfl
_ β€ dist z w := by
simp_rw [dist_eq]
dsimp only [coe_mk, mk_im]
gcongr
simpa [sqrt_sq_eq_abs] using Complex.abs_im_le_abs (z - w)
#align upper_half_plane.dist_log_im_le UpperHalfPlane.dist_log_im_le
theorem im_le_im_mul_exp_dist (z w : β) : z.im β€ w.im * Real.exp (dist z w) := by
rw [β div_le_iff' w.im_pos, β exp_log z.im_pos, β exp_log w.im_pos, β Real.exp_sub, exp_le_exp]
exact (le_abs_self _).trans (dist_log_im_le z w)
#align upper_half_plane.im_le_im_mul_exp_dist UpperHalfPlane.im_le_im_mul_exp_dist
theorem im_div_exp_dist_le (z w : β) : z.im / Real.exp (dist z w) β€ w.im :=
(div_le_iff (exp_pos _)).2 (im_le_im_mul_exp_dist z w)
#align upper_half_plane.im_div_exp_dist_le UpperHalfPlane.im_div_exp_dist_le
theorem dist_coe_le (z w : β) : dist (z : β) w β€ w.im * (Real.exp (dist z w) - 1) :=
calc
dist (z : β) w β€ dist (z : β) (w.center (dist z w)) + dist (w : β) (w.center (dist z w)) :=
dist_triangle_right _ _ _
_ = w.im * (Real.exp (dist z w) - 1) := by
rw [dist_center_dist, dist_self_center, β mul_add, β add_sub_assoc, Real.sinh_add_cosh]
#align upper_half_plane.dist_coe_le UpperHalfPlane.dist_coe_le
theorem le_dist_coe (z w : β) : w.im * (1 - Real.exp (-dist z w)) β€ dist (z : β) w :=
calc
w.im * (1 - Real.exp (-dist z w)) =
dist (z : β) (w.center (dist z w)) - dist (w : β) (w.center (dist z w)) := by
rw [dist_center_dist, dist_self_center, β Real.cosh_sub_sinh]; ring
_ β€ dist (z : β) w := sub_le_iff_le_add.2 <| dist_triangle _ _ _
#align upper_half_plane.le_dist_coe UpperHalfPlane.le_dist_coe
instance : MetricSpace β :=
metricSpaceAux.replaceTopology <| by
refine le_antisymm (continuous_id_iff_le.1 ?_) ?_
Β· refine (@continuous_iff_continuous_dist β β metricSpaceAux.toPseudoMetricSpace _ _).2 ?_
have : β x : β Γ β, 2 * β(x.1.im * x.2.im) β 0 := fun x => by positivity
-- `continuity` fails to apply `Continuous.div`
apply_rules [Continuous.div, Continuous.mul, continuous_const, Continuous.arsinh,
Continuous.dist, continuous_coe.comp, continuous_fst, continuous_snd,
Real.continuous_sqrt.comp, continuous_im.comp]
Β· letI : MetricSpace β := metricSpaceAux
refine le_of_nhds_le_nhds fun z => ?_
rw [nhds_induced]
refine (nhds_basis_ball.le_basis_iff (nhds_basis_ball.comap _)).2 fun R hR => ?_
have hβ : 1 < R / im z + 1 := lt_add_of_pos_left _ (div_pos hR z.im_pos)
have hβ : 0 < R / im z + 1 := one_pos.trans hβ
refine β¨log (R / im z + 1), Real.log_pos hβ, ?_β©
refine fun w hw => (dist_coe_le w z).trans_lt ?_
rwa [β lt_div_iff' z.im_pos, sub_lt_iff_lt_add, β Real.lt_log_iff_exp_lt hβ]
theorem im_pos_of_dist_center_le {z : β} {r : β} {w : β}
(h : dist w (center z r) β€ z.im * Real.sinh r) : 0 < w.im :=
calc
0 < z.im * (Real.cosh r - Real.sinh r) := mul_pos z.im_pos (sub_pos.2 <| sinh_lt_cosh _)
_ = (z.center r).im - z.im * Real.sinh r := mul_sub _ _ _
_ β€ (z.center r).im - dist (z.center r : β) w := sub_le_sub_left (by rwa [dist_comm]) _
_ β€ w.im := sub_le_comm.1 <| (le_abs_self _).trans (abs_im_le_abs <| z.center r - w)
#align upper_half_plane.im_pos_of_dist_center_le UpperHalfPlane.im_pos_of_dist_center_le
| Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean | 313 | 320 | theorem image_coe_closedBall (z : β) (r : β) :
((β) : β β β) '' closedBall (Ξ± := β) z r = closedBall β(z.center r) (z.im * Real.sinh r) := by |
ext w; constructor
Β· rintro β¨w, hw, rflβ©
exact dist_le_iff_dist_coe_center_le.1 hw
Β· intro hw
lift w to β using im_pos_of_dist_center_le hw
exact mem_image_of_mem _ (dist_le_iff_dist_coe_center_le.2 hw)
|
import Mathlib.Data.Finset.Lattice
#align_import combinatorics.set_family.compression.down from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
variable {Ξ± : Type*} [DecidableEq Ξ±] {π β¬ : Finset (Finset Ξ±)} {s : Finset Ξ±} {a : Ξ±}
namespace Finset
def nonMemberSubfamily (a : Ξ±) (π : Finset (Finset Ξ±)) : Finset (Finset Ξ±) :=
π.filter fun s => a β s
#align finset.non_member_subfamily Finset.nonMemberSubfamily
def memberSubfamily (a : Ξ±) (π : Finset (Finset Ξ±)) : Finset (Finset Ξ±) :=
(π.filter fun s => a β s).image fun s => erase s a
#align finset.member_subfamily Finset.memberSubfamily
@[simp]
theorem mem_nonMemberSubfamily : s β π.nonMemberSubfamily a β s β π β§ a β s := by
simp [nonMemberSubfamily]
#align finset.mem_non_member_subfamily Finset.mem_nonMemberSubfamily
@[simp]
theorem mem_memberSubfamily : s β π.memberSubfamily a β insert a s β π β§ a β s := by
simp_rw [memberSubfamily, mem_image, mem_filter]
refine β¨?_, fun h => β¨insert a s, β¨h.1, by simpβ©, erase_insert h.2β©β©
rintro β¨s, β¨hs1, hs2β©, rflβ©
rw [insert_erase hs2]
exact β¨hs1, not_mem_erase _ _β©
#align finset.mem_member_subfamily Finset.mem_memberSubfamily
theorem nonMemberSubfamily_inter (a : Ξ±) (π β¬ : Finset (Finset Ξ±)) :
(π β© β¬).nonMemberSubfamily a = π.nonMemberSubfamily a β© β¬.nonMemberSubfamily a :=
filter_inter_distrib _ _ _
#align finset.non_member_subfamily_inter Finset.nonMemberSubfamily_inter
theorem memberSubfamily_inter (a : Ξ±) (π β¬ : Finset (Finset Ξ±)) :
(π β© β¬).memberSubfamily a = π.memberSubfamily a β© β¬.memberSubfamily a := by
unfold memberSubfamily
rw [filter_inter_distrib, image_inter_of_injOn _ _ ((erase_injOn' _).mono _)]
simp
#align finset.member_subfamily_inter Finset.memberSubfamily_inter
theorem nonMemberSubfamily_union (a : Ξ±) (π β¬ : Finset (Finset Ξ±)) :
(π βͺ β¬).nonMemberSubfamily a = π.nonMemberSubfamily a βͺ β¬.nonMemberSubfamily a :=
filter_union _ _ _
#align finset.non_member_subfamily_union Finset.nonMemberSubfamily_union
theorem memberSubfamily_union (a : Ξ±) (π β¬ : Finset (Finset Ξ±)) :
(π βͺ β¬).memberSubfamily a = π.memberSubfamily a βͺ β¬.memberSubfamily a := by
simp_rw [memberSubfamily, filter_union, image_union]
#align finset.member_subfamily_union Finset.memberSubfamily_union
theorem card_memberSubfamily_add_card_nonMemberSubfamily (a : Ξ±) (π : Finset (Finset Ξ±)) :
(π.memberSubfamily a).card + (π.nonMemberSubfamily a).card = π.card := by
rw [memberSubfamily, nonMemberSubfamily, card_image_of_injOn]
Β· conv_rhs => rw [β filter_card_add_filter_neg_card_eq_card (fun s => (a β s))]
Β· apply (erase_injOn' _).mono
simp
#align finset.card_member_subfamily_add_card_non_member_subfamily Finset.card_memberSubfamily_add_card_nonMemberSubfamily
| Mathlib/Combinatorics/SetFamily/Compression/Down.lean | 99 | 110 | theorem memberSubfamily_union_nonMemberSubfamily (a : Ξ±) (π : Finset (Finset Ξ±)) :
π.memberSubfamily a βͺ π.nonMemberSubfamily a = π.image fun s => s.erase a := by |
ext s
simp only [mem_union, mem_memberSubfamily, mem_nonMemberSubfamily, mem_image, exists_prop]
constructor
Β· rintro (h | h)
Β· exact β¨_, h.1, erase_insert h.2β©
Β· exact β¨_, h.1, erase_eq_of_not_mem h.2β©
Β· rintro β¨s, hs, rflβ©
by_cases ha : a β s
Β· exact Or.inl β¨by rwa [insert_erase ha], not_mem_erase _ _β©
Β· exact Or.inr β¨by rwa [erase_eq_of_not_mem ha], not_mem_erase _ _β©
|
import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners
import Mathlib.Geometry.Manifold.LocalInvariantProperties
#align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"e5ab837fc252451f3eb9124ae6e7b6f57455e7b9"
open Set Function Filter ChartedSpace SmoothManifoldWithCorners
open scoped Topology Manifold
variable {π : Type*} [NontriviallyNormedField π]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace π E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners π E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners π E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a manifold `M''` over the pair `(E'', H'')`.
{E'' : Type*}
[NormedAddCommGroup E''] [NormedSpace π E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners π E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
-- declare a smooth manifold `N` over the pair `(F, G)`.
{F : Type*}
[NormedAddCommGroup F] [NormedSpace π F] {G : Type*} [TopologicalSpace G]
{J : ModelWithCorners π F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
[SmoothManifoldWithCorners J N]
-- declare a smooth manifold `N'` over the pair `(F', G')`.
{F' : Type*}
[NormedAddCommGroup F'] [NormedSpace π F'] {G' : Type*} [TopologicalSpace G']
{J' : ModelWithCorners π F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
[SmoothManifoldWithCorners J' N']
-- Fβ, Fβ, Fβ, Fβ are normed spaces
{Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ]
[NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ]
-- declare functions, sets, points and smoothness indices
{e : PartialHomeomorph M H}
{e' : PartialHomeomorph M' H'} {f fβ : M β M'} {s sβ t : Set M} {x : M} {m n : ββ}
def ContDiffWithinAtProp (n : ββ) (f : H β H') (s : Set H) (x : H) : Prop :=
ContDiffWithinAt π n (I' β f β I.symm) (I.symm β»ΒΉ' s β© range I) (I x)
#align cont_diff_within_at_prop ContDiffWithinAtProp
theorem contDiffWithinAtProp_self_source {f : E β H'} {s : Set E} {x : E} :
ContDiffWithinAtProp π(π, E) I' n f s x β ContDiffWithinAt π n (I' β f) s x := by
simp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ,
modelWithCornersSelf_coe_symm, CompTriple.comp_eq, preimage_id_eq, id_eq]
#align cont_diff_within_at_prop_self_source contDiffWithinAtProp_self_source
theorem contDiffWithinAtProp_self {f : E β E'} {s : Set E} {x : E} :
ContDiffWithinAtProp π(π, E) π(π, E') n f s x β ContDiffWithinAt π n f s x :=
contDiffWithinAtProp_self_source π(π, E')
#align cont_diff_within_at_prop_self contDiffWithinAtProp_self
theorem contDiffWithinAtProp_self_target {f : H β E'} {s : Set H} {x : H} :
ContDiffWithinAtProp I π(π, E') n f s x β
ContDiffWithinAt π n (f β I.symm) (I.symm β»ΒΉ' s β© range I) (I x) :=
Iff.rfl
#align cont_diff_within_at_prop_self_target contDiffWithinAtProp_self_target
| Mathlib/Geometry/Manifold/ContMDiff/Defs.lean | 116 | 154 | theorem contDiffWithinAt_localInvariantProp (n : ββ) :
(contDiffGroupoid β I).LocalInvariantProp (contDiffGroupoid β I')
(ContDiffWithinAtProp I I' n) where
is_local {s x u f} u_open xu := by |
have : I.symm β»ΒΉ' (s β© u) β© range I = I.symm β»ΒΉ' s β© range I β© I.symm β»ΒΉ' u := by
simp only [inter_right_comm, preimage_inter]
rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]
symm
apply contDiffWithinAt_inter
have : u β π (I.symm (I x)) := by
rw [ModelWithCorners.left_inv]
exact u_open.mem_nhds xu
apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this
right_invariance' {s x f e} he hx h := by
rw [ContDiffWithinAtProp] at h β’
have : I x = (I β e.symm β I.symm) (I (e x)) := by simp only [hx, mfld_simps]
rw [this] at h
have : I (e x) β I.symm β»ΒΉ' e.target β© range I := by simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this
convert (h.comp' _ (this.of_le le_top)).mono_of_mem _ using 1
Β· ext y; simp only [mfld_simps]
refine mem_nhdsWithin.mpr
β¨I.symm β»ΒΉ' e.target, e.open_target.preimage I.continuous_symm, by
simp_rw [mem_preimage, I.left_inv, e.mapsTo hx], ?_β©
mfld_set_tac
congr_of_forall {s x f g} h hx hf := by
apply hf.congr
Β· intro y hy
simp only [mfld_simps] at hy
simp only [h, hy, mfld_simps]
Β· simp only [hx, mfld_simps]
left_invariance' {s x f e'} he' hs hx h := by
rw [ContDiffWithinAtProp] at h β’
have A : (I' β f β I.symm) (I x) β I'.symm β»ΒΉ' e'.source β© range I' := by
simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
convert (this.of_le le_top).comp _ h _
Β· ext y; simp only [mfld_simps]
Β· intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1
|
import Mathlib.RingTheory.MvPowerSeries.Basic
import Mathlib.RingTheory.Ideal.LocalRing
#align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60"
noncomputable section
open Finset (antidiagonal mem_antidiagonal)
namespace MvPowerSeries
open Finsupp
variable {Ο R : Type*}
section Ring
variable [Ring R]
protected noncomputable def inv.aux (a : R) (Ο : MvPowerSeries Ο R) : MvPowerSeries Ο R
| n =>
letI := Classical.decEq Ο
if n = 0 then a
else
-a *
β x β antidiagonal n, if _ : x.2 < n then coeff R x.1 Ο * inv.aux a Ο x.2 else 0
termination_by n => n
#align mv_power_series.inv.aux MvPowerSeries.inv.aux
theorem coeff_inv_aux [DecidableEq Ο] (n : Ο ββ β) (a : R) (Ο : MvPowerSeries Ο R) :
coeff R n (inv.aux a Ο) =
if n = 0 then a
else
-a *
β x β antidiagonal n, if x.2 < n then coeff R x.1 Ο * coeff R x.2 (inv.aux a Ο) else 0 :=
show inv.aux a Ο n = _ by
cases Subsingleton.elim βΉDecidableEq ΟβΊ (Classical.decEq Ο)
rw [inv.aux]
rfl
#align mv_power_series.coeff_inv_aux MvPowerSeries.coeff_inv_aux
def invOfUnit (Ο : MvPowerSeries Ο R) (u : RΛ£) : MvPowerSeries Ο R :=
inv.aux (βuβ»ΒΉ) Ο
#align mv_power_series.inv_of_unit MvPowerSeries.invOfUnit
theorem coeff_invOfUnit [DecidableEq Ο] (n : Ο ββ β) (Ο : MvPowerSeries Ο R) (u : RΛ£) :
coeff R n (invOfUnit Ο u) =
if n = 0 then βuβ»ΒΉ
else
-βuβ»ΒΉ *
β x β antidiagonal n,
if x.2 < n then coeff R x.1 Ο * coeff R x.2 (invOfUnit Ο u) else 0 := by
convert coeff_inv_aux n (βuβ»ΒΉ) Ο
#align mv_power_series.coeff_inv_of_unit MvPowerSeries.coeff_invOfUnit
@[simp]
theorem constantCoeff_invOfUnit (Ο : MvPowerSeries Ο R) (u : RΛ£) :
constantCoeff Ο R (invOfUnit Ο u) = βuβ»ΒΉ := by
classical
rw [β coeff_zero_eq_constantCoeff_apply, coeff_invOfUnit, if_pos rfl]
#align mv_power_series.constant_coeff_inv_of_unit MvPowerSeries.constantCoeff_invOfUnit
| Mathlib/RingTheory/MvPowerSeries/Inverse.lean | 107 | 137 | theorem mul_invOfUnit (Ο : MvPowerSeries Ο R) (u : RΛ£) (h : constantCoeff Ο R Ο = u) :
Ο * invOfUnit Ο u = 1 :=
ext fun n =>
letI := Classical.decEq (Ο ββ β)
if H : n = 0 then by
rw [H]
simp [coeff_mul, support_single_ne_zero, h]
else by
classical
have : ((0 : Ο ββ β), n) β antidiagonal n := by | rw [mem_antidiagonal, zero_add]
rw [coeff_one, if_neg H, coeff_mul, β Finset.insert_erase this,
Finset.sum_insert (Finset.not_mem_erase _ _), coeff_zero_eq_constantCoeff_apply, h,
coeff_invOfUnit, if_neg H, neg_mul, mul_neg, Units.mul_inv_cancel_left, β
Finset.insert_erase this, Finset.sum_insert (Finset.not_mem_erase _ _),
Finset.insert_erase this, if_neg (not_lt_of_ge <| le_rfl), zero_add, add_comm, β
sub_eq_add_neg, sub_eq_zero, Finset.sum_congr rfl]
rintro β¨i, jβ© hij
rw [Finset.mem_erase, mem_antidiagonal] at hij
cases' hij with hβ hβ
subst n
rw [if_pos]
suffices (0 : _) + j < i + j by simpa
apply add_lt_add_right
constructor
Β· intro s
exact Nat.zero_le _
Β· intro H
apply hβ
suffices i = 0 by simp [this]
ext1 s
exact Nat.eq_zero_of_le_zero (H s)
|
import Mathlib.Algebra.EuclideanDomain.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Algebra.GCDMonoid.Nat
#align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
namespace Int
theorem gcd_eq_one_iff_coprime {a b : β€} : Int.gcd a b = 1 β IsCoprime a b := by
constructor
Β· intro hg
obtain β¨ua, -, haβ© := exists_unit_of_abs a
obtain β¨ub, -, hbβ© := exists_unit_of_abs b
use Nat.gcdA (Int.natAbs a) (Int.natAbs b) * ua, Nat.gcdB (Int.natAbs a) (Int.natAbs b) * ub
rw [mul_assoc, β ha, mul_assoc, β hb, mul_comm, mul_comm _ (Int.natAbs b : β€), β
Nat.gcd_eq_gcd_ab, β gcd_eq_natAbs, hg, Int.ofNat_one]
Β· rintro β¨r, s, hβ©
by_contra hg
obtain β¨p, β¨hp, ha, hbβ©β© := Nat.Prime.not_coprime_iff_dvd.mp hg
apply Nat.Prime.not_dvd_one hp
rw [β natCast_dvd_natCast, Int.ofNat_one, β h]
exact dvd_add ((natCast_dvd.mpr ha).mul_left _) ((natCast_dvd.mpr hb).mul_left _)
#align int.gcd_eq_one_iff_coprime Int.gcd_eq_one_iff_coprime
| Mathlib/RingTheory/Int/Basic.lean | 49 | 50 | theorem coprime_iff_nat_coprime {a b : β€} : IsCoprime a b β Nat.Coprime a.natAbs b.natAbs := by |
rw [β gcd_eq_one_iff_coprime, Nat.coprime_iff_gcd_eq_one, gcd_eq_natAbs]
|
import Mathlib.Tactic.Ring
#align_import algebra.group_power.identities from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
variable {R : Type*} [CommRing R] {a b xβ xβ xβ xβ xβ
xβ xβ xβ yβ yβ yβ yβ yβ
yβ yβ yβ n : R}
theorem sq_add_sq_mul_sq_add_sq :
(xβ ^ 2 + xβ ^ 2) * (yβ ^ 2 + yβ ^ 2) = (xβ * yβ - xβ * yβ) ^ 2 + (xβ * yβ + xβ * yβ) ^ 2 := by
ring
#align sq_add_sq_mul_sq_add_sq sq_add_sq_mul_sq_add_sq
theorem sq_add_mul_sq_mul_sq_add_mul_sq :
(xβ ^ 2 + n * xβ ^ 2) * (yβ ^ 2 + n * yβ ^ 2) =
(xβ * yβ - n * xβ * yβ) ^ 2 + n * (xβ * yβ + xβ * yβ) ^ 2 := by
ring
#align sq_add_mul_sq_mul_sq_add_mul_sq sq_add_mul_sq_mul_sq_add_mul_sq
theorem pow_four_add_four_mul_pow_four :
a ^ 4 + 4 * b ^ 4 = ((a - b) ^ 2 + b ^ 2) * ((a + b) ^ 2 + b ^ 2) := by
ring
#align pow_four_add_four_mul_pow_four pow_four_add_four_mul_pow_four
theorem pow_four_add_four_mul_pow_four' :
a ^ 4 + 4 * b ^ 4 = (a ^ 2 - 2 * a * b + 2 * b ^ 2) * (a ^ 2 + 2 * a * b + 2 * b ^ 2) := by
ring
#align pow_four_add_four_mul_pow_four' pow_four_add_four_mul_pow_four'
| Mathlib/Algebra/Ring/Identities.lean | 55 | 60 | theorem sum_four_sq_mul_sum_four_sq :
(xβ ^ 2 + xβ ^ 2 + xβ ^ 2 + xβ ^ 2) * (yβ ^ 2 + yβ ^ 2 + yβ ^ 2 + yβ ^ 2) =
(xβ * yβ - xβ * yβ - xβ * yβ - xβ * yβ) ^ 2 + (xβ * yβ + xβ * yβ + xβ * yβ - xβ * yβ) ^ 2 +
(xβ * yβ - xβ * yβ + xβ * yβ + xβ * yβ) ^ 2 +
(xβ * yβ + xβ * yβ - xβ * yβ + xβ * yβ) ^ 2 := by |
ring
|
import Mathlib.RingTheory.Ideal.Basic
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.RingTheory.GradedAlgebra.Basic
#align_import ring_theory.graded_algebra.homogeneous_ideal from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441"
open SetLike DirectSum Set
open Pointwise DirectSum
variable {ΞΉ Ο R A : Type*}
section HomogeneousDef
variable [Semiring A]
variable [SetLike Ο A] [AddSubmonoidClass Ο A] (π : ΞΉ β Ο)
variable [DecidableEq ΞΉ] [AddMonoid ΞΉ] [GradedRing π]
variable (I : Ideal A)
def Ideal.IsHomogeneous : Prop :=
β (i : ΞΉ) β¦r : Aβ¦, r β I β (DirectSum.decompose π r i : A) β I
#align ideal.is_homogeneous Ideal.IsHomogeneous
theorem Ideal.IsHomogeneous.mem_iff {I} (hI : Ideal.IsHomogeneous π I) {x} :
x β I β β i, (decompose π x i : A) β I := by
classical
refine β¨fun hx i β¦ hI i hx, fun hx β¦ ?_β©
rw [β DirectSum.sum_support_decompose π x]
exact Ideal.sum_mem _ (fun i _ β¦ hx i)
structure HomogeneousIdeal extends Submodule A A where
is_homogeneous' : Ideal.IsHomogeneous π toSubmodule
#align homogeneous_ideal HomogeneousIdeal
variable {π}
def HomogeneousIdeal.toIdeal (I : HomogeneousIdeal π) : Ideal A :=
I.toSubmodule
#align homogeneous_ideal.to_ideal HomogeneousIdeal.toIdeal
theorem HomogeneousIdeal.isHomogeneous (I : HomogeneousIdeal π) : I.toIdeal.IsHomogeneous π :=
I.is_homogeneous'
#align homogeneous_ideal.is_homogeneous HomogeneousIdeal.isHomogeneous
theorem HomogeneousIdeal.toIdeal_injective :
Function.Injective (HomogeneousIdeal.toIdeal : HomogeneousIdeal π β Ideal A) :=
fun β¨x, hxβ© β¨y, hyβ© => fun (h : x = y) => by simp [h]
#align homogeneous_ideal.to_ideal_injective HomogeneousIdeal.toIdeal_injective
instance HomogeneousIdeal.setLike : SetLike (HomogeneousIdeal π) A where
coe I := I.toIdeal
coe_injective' _ _ h := HomogeneousIdeal.toIdeal_injective <| SetLike.coe_injective h
#align homogeneous_ideal.set_like HomogeneousIdeal.setLike
@[ext]
theorem HomogeneousIdeal.ext {I J : HomogeneousIdeal π} (h : I.toIdeal = J.toIdeal) : I = J :=
HomogeneousIdeal.toIdeal_injective h
#align homogeneous_ideal.ext HomogeneousIdeal.ext
| Mathlib/RingTheory/GradedAlgebra/HomogeneousIdeal.lean | 102 | 107 | theorem HomogeneousIdeal.ext' {I J : HomogeneousIdeal π} (h : β i, β x β π i, x β I β x β J) :
I = J := by |
ext
rw [I.isHomogeneous.mem_iff, J.isHomogeneous.mem_iff]
apply forall_congr'
exact fun i β¦ h i _ (decompose π _ i).2
|
import Mathlib.Algebra.Group.Pi.Basic
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Images
import Mathlib.CategoryTheory.IsomorphismClasses
import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects
#align_import category_theory.limits.shapes.zero_morphisms from "leanprover-community/mathlib"@"f7707875544ef1f81b32cb68c79e0e24e45a0e76"
noncomputable section
universe v u
universe v' u'
open CategoryTheory
open CategoryTheory.Category
open scoped Classical
namespace CategoryTheory.Limits
variable (C : Type u) [Category.{v} C]
variable (D : Type u') [Category.{v'} D]
class HasZeroMorphisms where
[zero : β X Y : C, Zero (X βΆ Y)]
comp_zero : β {X Y : C} (f : X βΆ Y) (Z : C), f β« (0 : Y βΆ Z) = (0 : X βΆ Z) := by aesop_cat
zero_comp : β (X : C) {Y Z : C} (f : Y βΆ Z), (0 : X βΆ Y) β« f = (0 : X βΆ Z) := by aesop_cat
#align category_theory.limits.has_zero_morphisms CategoryTheory.Limits.HasZeroMorphisms
#align category_theory.limits.has_zero_morphisms.comp_zero' CategoryTheory.Limits.HasZeroMorphisms.comp_zero
#align category_theory.limits.has_zero_morphisms.zero_comp' CategoryTheory.Limits.HasZeroMorphisms.zero_comp
attribute [instance] HasZeroMorphisms.zero
variable {C}
@[simp]
theorem comp_zero [HasZeroMorphisms C] {X Y : C} {f : X βΆ Y} {Z : C} :
f β« (0 : Y βΆ Z) = (0 : X βΆ Z) :=
HasZeroMorphisms.comp_zero f Z
#align category_theory.limits.comp_zero CategoryTheory.Limits.comp_zero
@[simp]
theorem zero_comp [HasZeroMorphisms C] {X : C} {Y Z : C} {f : Y βΆ Z} :
(0 : X βΆ Y) β« f = (0 : X βΆ Z) :=
HasZeroMorphisms.zero_comp X f
#align category_theory.limits.zero_comp CategoryTheory.Limits.zero_comp
instance hasZeroMorphismsPEmpty : HasZeroMorphisms (Discrete PEmpty) where
zero := by aesop_cat
#align category_theory.limits.has_zero_morphisms_pempty CategoryTheory.Limits.hasZeroMorphismsPEmpty
instance hasZeroMorphismsPUnit : HasZeroMorphisms (Discrete PUnit) where
zero X Y := by repeat (constructor)
#align category_theory.limits.has_zero_morphisms_punit CategoryTheory.Limits.hasZeroMorphismsPUnit
open Opposite HasZeroMorphisms
instance hasZeroMorphismsOpposite [HasZeroMorphisms C] : HasZeroMorphisms Cα΅α΅ where
zero X Y := β¨(0 : unop Y βΆ unop X).opβ©
comp_zero f Z := congr_arg Quiver.Hom.op (HasZeroMorphisms.zero_comp (unop Z) f.unop)
zero_comp X {Y Z} (f : Y βΆ Z) :=
congrArg Quiver.Hom.op (HasZeroMorphisms.comp_zero f.unop (unop X))
#align category_theory.limits.has_zero_morphisms_opposite CategoryTheory.Limits.hasZeroMorphismsOpposite
section
variable [HasZeroMorphisms C]
@[simp] lemma op_zero (X Y : C) : (0 : X βΆ Y).op = 0 := rfl
#align category_theory.op_zero CategoryTheory.Limits.op_zero
@[simp] lemma unop_zero (X Y : Cα΅α΅) : (0 : X βΆ Y).unop = 0 := rfl
#align category_theory.unop_zero CategoryTheory.Limits.unop_zero
theorem zero_of_comp_mono {X Y Z : C} {f : X βΆ Y} (g : Y βΆ Z) [Mono g] (h : f β« g = 0) : f = 0 := by
rw [β zero_comp, cancel_mono] at h
exact h
#align category_theory.limits.zero_of_comp_mono CategoryTheory.Limits.zero_of_comp_mono
theorem zero_of_epi_comp {X Y Z : C} (f : X βΆ Y) {g : Y βΆ Z} [Epi f] (h : f β« g = 0) : g = 0 := by
rw [β comp_zero, cancel_epi] at h
exact h
#align category_theory.limits.zero_of_epi_comp CategoryTheory.Limits.zero_of_epi_comp
theorem eq_zero_of_image_eq_zero {X Y : C} {f : X βΆ Y} [HasImage f] (w : image.ΞΉ f = 0) :
f = 0 := by rw [β image.fac f, w, HasZeroMorphisms.comp_zero]
#align category_theory.limits.eq_zero_of_image_eq_zero CategoryTheory.Limits.eq_zero_of_image_eq_zero
theorem nonzero_image_of_nonzero {X Y : C} {f : X βΆ Y} [HasImage f] (w : f β 0) : image.ΞΉ f β 0 :=
fun h => w (eq_zero_of_image_eq_zero h)
#align category_theory.limits.nonzero_image_of_nonzero CategoryTheory.Limits.nonzero_image_of_nonzero
end
section
variable [HasZeroMorphisms D]
instance : HasZeroMorphisms (C β₯€ D) where
zero F G := β¨{ app := fun X => 0 }β©
comp_zero := fun Ξ· H => by
ext X; dsimp; apply comp_zero
zero_comp := fun F {G H} Ξ· => by
ext X; dsimp; apply zero_comp
@[simp]
theorem zero_app (F G : C β₯€ D) (j : C) : (0 : F βΆ G).app j = 0 := rfl
#align category_theory.limits.zero_app CategoryTheory.Limits.zero_app
end
namespace IsZero
variable [HasZeroMorphisms C]
theorem eq_zero_of_src {X Y : C} (o : IsZero X) (f : X βΆ Y) : f = 0 :=
o.eq_of_src _ _
#align category_theory.limits.is_zero.eq_zero_of_src CategoryTheory.Limits.IsZero.eq_zero_of_src
theorem eq_zero_of_tgt {X Y : C} (o : IsZero Y) (f : X βΆ Y) : f = 0 :=
o.eq_of_tgt _ _
#align category_theory.limits.is_zero.eq_zero_of_tgt CategoryTheory.Limits.IsZero.eq_zero_of_tgt
theorem iff_id_eq_zero (X : C) : IsZero X β π X = 0 :=
β¨fun h => h.eq_of_src _ _, fun h =>
β¨fun Y => β¨β¨β¨0β©, fun f => by
rw [β id_comp f, β id_comp (0: X βΆ Y), h, zero_comp, zero_comp]; simp onlyβ©β©,
fun Y => β¨β¨β¨0β©, fun f => by
rw [β comp_id f, β comp_id (0 : Y βΆ X), h, comp_zero, comp_zero]; simp only β©β©β©β©
#align category_theory.limits.is_zero.iff_id_eq_zero CategoryTheory.Limits.IsZero.iff_id_eq_zero
theorem of_mono_zero (X Y : C) [Mono (0 : X βΆ Y)] : IsZero X :=
(iff_id_eq_zero X).mpr ((cancel_mono (0 : X βΆ Y)).1 (by simp))
#align category_theory.limits.is_zero.of_mono_zero CategoryTheory.Limits.IsZero.of_mono_zero
theorem of_epi_zero (X Y : C) [Epi (0 : X βΆ Y)] : IsZero Y :=
(iff_id_eq_zero Y).mpr ((cancel_epi (0 : X βΆ Y)).1 (by simp))
#align category_theory.limits.is_zero.of_epi_zero CategoryTheory.Limits.IsZero.of_epi_zero
theorem of_mono_eq_zero {X Y : C} (f : X βΆ Y) [Mono f] (h : f = 0) : IsZero X := by
subst h
apply of_mono_zero X Y
#align category_theory.limits.is_zero.of_mono_eq_zero CategoryTheory.Limits.IsZero.of_mono_eq_zero
theorem of_epi_eq_zero {X Y : C} (f : X βΆ Y) [Epi f] (h : f = 0) : IsZero Y := by
subst h
apply of_epi_zero X Y
#align category_theory.limits.is_zero.of_epi_eq_zero CategoryTheory.Limits.IsZero.of_epi_eq_zero
theorem iff_isSplitMono_eq_zero {X Y : C} (f : X βΆ Y) [IsSplitMono f] : IsZero X β f = 0 := by
rw [iff_id_eq_zero]
constructor
Β· intro h
rw [β Category.id_comp f, h, zero_comp]
Β· intro h
rw [β IsSplitMono.id f]
simp only [h, zero_comp]
#align category_theory.limits.is_zero.iff_is_split_mono_eq_zero CategoryTheory.Limits.IsZero.iff_isSplitMono_eq_zero
theorem iff_isSplitEpi_eq_zero {X Y : C} (f : X βΆ Y) [IsSplitEpi f] : IsZero Y β f = 0 := by
rw [iff_id_eq_zero]
constructor
Β· intro h
rw [β Category.comp_id f, h, comp_zero]
Β· intro h
rw [β IsSplitEpi.id f]
simp [h]
#align category_theory.limits.is_zero.iff_is_split_epi_eq_zero CategoryTheory.Limits.IsZero.iff_isSplitEpi_eq_zero
theorem of_mono {X Y : C} (f : X βΆ Y) [Mono f] (i : IsZero Y) : IsZero X := by
have hf := i.eq_zero_of_tgt f
subst hf
exact IsZero.of_mono_zero X Y
#align category_theory.limits.is_zero.of_mono CategoryTheory.Limits.IsZero.of_mono
| Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean | 241 | 244 | theorem of_epi {X Y : C} (f : X βΆ Y) [Epi f] (i : IsZero X) : IsZero Y := by |
have hf := i.eq_zero_of_src f
subst hf
exact IsZero.of_epi_zero X Y
|
import Mathlib.CategoryTheory.Abelian.Basic
#align_import category_theory.idempotents.basic from "leanprover-community/mathlib"@"3a061790136d13594ec10c7c90d202335ac5d854"
open CategoryTheory
open CategoryTheory.Category
open CategoryTheory.Limits
open CategoryTheory.Preadditive
open Opposite
namespace CategoryTheory
variable (C : Type*) [Category C]
class IsIdempotentComplete : Prop where
idempotents_split :
β (X : C) (p : X βΆ X), p β« p = p β β (Y : C) (i : Y βΆ X) (e : X βΆ Y), i β« e = π Y β§ e β« i = p
#align category_theory.is_idempotent_complete CategoryTheory.IsIdempotentComplete
namespace Idempotents
| Mathlib/CategoryTheory/Idempotents/Basic.lean | 63 | 92 | theorem isIdempotentComplete_iff_hasEqualizer_of_id_and_idempotent :
IsIdempotentComplete C β β (X : C) (p : X βΆ X), p β« p = p β HasEqualizer (π X) p := by |
constructor
Β· intro
intro X p hp
rcases IsIdempotentComplete.idempotents_split X p hp with β¨Y, i, e, β¨hβ, hββ©β©
exact
β¨Nonempty.intro
{ cone := Fork.ofΞΉ i (show i β« π X = i β« p by rw [comp_id, β hβ, β assoc, hβ, id_comp])
isLimit := by
apply Fork.IsLimit.mk'
intro s
refine β¨s.ΞΉ β« e, ?_β©
constructor
Β· erw [assoc, hβ, β Limits.Fork.condition s, comp_id]
Β· intro m hm
rw [Fork.ΞΉ_ofΞΉ] at hm
rw [β hm]
simp only [β hm, assoc, hβ]
exact (comp_id m).symm }β©
Β· intro h
refine β¨?_β©
intro X p hp
haveI : HasEqualizer (π X) p := h X p hp
refine β¨equalizer (π X) p, equalizer.ΞΉ (π X) p,
equalizer.lift p (show p β« π X = p β« p by rw [hp, comp_id]), ?_, equalizer.lift_ΞΉ _ _β©
ext
simp only [assoc, limit.lift_Ο, Eq.ndrec, id_eq, eq_mpr_eq_cast, Fork.ofΞΉ_pt,
Fork.ofΞΉ_Ο_app, id_comp]
rw [β equalizer.condition, comp_id]
|
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
#align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
set_option linter.uppercaseLean3 false
noncomputable section
open Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v w y
variable {R : Type u} {S : Type v} {T : Type w} {ΞΉ : Type y} {a b : R} {m n : β}
section Semiring
variable [Semiring R] {p q r : R[X]}
section
variable [Semiring S]
variable (f : R β+* S) (x : S)
irreducible_def evalβ (p : R[X]) : S :=
p.sum fun e a => f a * x ^ e
#align polynomial.evalβ Polynomial.evalβ
theorem evalβ_eq_sum {f : R β+* S} {x : S} : p.evalβ f x = p.sum fun e a => f a * x ^ e := by
rw [evalβ_def]
#align polynomial.evalβ_eq_sum Polynomial.evalβ_eq_sum
theorem evalβ_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R β+* S} {s t : S}
{Ο Ο : R[X]} : f = g β s = t β Ο = Ο β evalβ f s Ο = evalβ g t Ο := by
rintro rfl rfl rfl; rfl
#align polynomial.evalβ_congr Polynomial.evalβ_congr
@[simp]
theorem evalβ_at_zero : p.evalβ f 0 = f (coeff p 0) := by
simp (config := { contextual := true }) only [evalβ_eq_sum, zero_pow_eq, mul_ite, mul_zero,
mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff,
RingHom.map_zero, imp_true_iff, eq_self_iff_true]
#align polynomial.evalβ_at_zero Polynomial.evalβ_at_zero
@[simp]
theorem evalβ_zero : (0 : R[X]).evalβ f x = 0 := by simp [evalβ_eq_sum]
#align polynomial.evalβ_zero Polynomial.evalβ_zero
@[simp]
theorem evalβ_C : (C a).evalβ f x = f a := by simp [evalβ_eq_sum]
#align polynomial.evalβ_C Polynomial.evalβ_C
@[simp]
theorem evalβ_X : X.evalβ f x = x := by simp [evalβ_eq_sum]
#align polynomial.evalβ_X Polynomial.evalβ_X
@[simp]
| Mathlib/Algebra/Polynomial/Eval.lean | 77 | 78 | theorem evalβ_monomial {n : β} {r : R} : (monomial n r).evalβ f x = f r * x ^ n := by |
simp [evalβ_eq_sum]
|
import Mathlib.NumberTheory.BernoulliPolynomials
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.Fourier.AddCircle
import Mathlib.Analysis.PSeries
#align_import number_theory.zeta_values from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
noncomputable section
open scoped Nat Real Interval
open Complex MeasureTheory Set intervalIntegral
local notation "π" => UnitAddCircle
section BernoulliFunProps
def bernoulliFun (k : β) (x : β) : β :=
(Polynomial.map (algebraMap β β) (Polynomial.bernoulli k)).eval x
#align bernoulli_fun bernoulliFun
| Mathlib/NumberTheory/ZetaValues.lean | 49 | 50 | theorem bernoulliFun_eval_zero (k : β) : bernoulliFun k 0 = bernoulli k := by |
rw [bernoulliFun, Polynomial.eval_zero_map, Polynomial.bernoulli_eval_zero, eq_ratCast]
|
import Mathlib.Topology.MetricSpace.HausdorffDistance
#align_import topology.metric_space.pi_nat from "leanprover-community/mathlib"@"49b7f94aab3a3bdca1f9f34c5d818afb253b3993"
noncomputable section
open scoped Classical
open Topology Filter
open TopologicalSpace Set Metric Filter Function
attribute [local simp] pow_le_pow_iff_right one_lt_two inv_le_inv zero_le_two zero_lt_two
variable {E : β β Type*}
namespace PiNat
irreducible_def firstDiff (x y : β n, E n) : β :=
if h : x β y then Nat.find (ne_iff.1 h) else 0
#align pi_nat.first_diff PiNat.firstDiff
theorem apply_firstDiff_ne {x y : β n, E n} (h : x β y) :
x (firstDiff x y) β y (firstDiff x y) := by
rw [firstDiff_def, dif_pos h]
exact Nat.find_spec (ne_iff.1 h)
#align pi_nat.apply_first_diff_ne PiNat.apply_firstDiff_ne
theorem apply_eq_of_lt_firstDiff {x y : β n, E n} {n : β} (hn : n < firstDiff x y) : x n = y n := by
rw [firstDiff_def] at hn
split_ifs at hn with h
Β· convert Nat.find_min (ne_iff.1 h) hn
simp
Β· exact (not_lt_zero' hn).elim
#align pi_nat.apply_eq_of_lt_first_diff PiNat.apply_eq_of_lt_firstDiff
theorem firstDiff_comm (x y : β n, E n) : firstDiff x y = firstDiff y x := by
simp only [firstDiff_def, ne_comm]
#align pi_nat.first_diff_comm PiNat.firstDiff_comm
theorem min_firstDiff_le (x y z : β n, E n) (h : x β z) :
min (firstDiff x y) (firstDiff y z) β€ firstDiff x z := by
by_contra! H
rw [lt_min_iff] at H
refine apply_firstDiff_ne h ?_
calc
x (firstDiff x z) = y (firstDiff x z) := apply_eq_of_lt_firstDiff H.1
_ = z (firstDiff x z) := apply_eq_of_lt_firstDiff H.2
#align pi_nat.min_first_diff_le PiNat.min_firstDiff_le
def cylinder (x : β n, E n) (n : β) : Set (β n, E n) :=
{ y | β i, i < n β y i = x i }
#align pi_nat.cylinder PiNat.cylinder
theorem cylinder_eq_pi (x : β n, E n) (n : β) :
cylinder x n = Set.pi (Finset.range n : Set β) fun i : β => {x i} := by
ext y
simp [cylinder]
#align pi_nat.cylinder_eq_pi PiNat.cylinder_eq_pi
@[simp]
theorem cylinder_zero (x : β n, E n) : cylinder x 0 = univ := by simp [cylinder_eq_pi]
#align pi_nat.cylinder_zero PiNat.cylinder_zero
theorem cylinder_anti (x : β n, E n) {m n : β} (h : m β€ n) : cylinder x n β cylinder x m :=
fun _y hy i hi => hy i (hi.trans_le h)
#align pi_nat.cylinder_anti PiNat.cylinder_anti
@[simp]
theorem mem_cylinder_iff {x y : β n, E n} {n : β} : y β cylinder x n β β i < n, y i = x i :=
Iff.rfl
#align pi_nat.mem_cylinder_iff PiNat.mem_cylinder_iff
theorem self_mem_cylinder (x : β n, E n) (n : β) : x β cylinder x n := by simp
#align pi_nat.self_mem_cylinder PiNat.self_mem_cylinder
theorem mem_cylinder_iff_eq {x y : β n, E n} {n : β} :
y β cylinder x n β cylinder y n = cylinder x n := by
constructor
Β· intro hy
apply Subset.antisymm
Β· intro z hz i hi
rw [β hy i hi]
exact hz i hi
Β· intro z hz i hi
rw [hy i hi]
exact hz i hi
Β· intro h
rw [β h]
exact self_mem_cylinder _ _
#align pi_nat.mem_cylinder_iff_eq PiNat.mem_cylinder_iff_eq
theorem mem_cylinder_comm (x y : β n, E n) (n : β) : y β cylinder x n β x β cylinder y n := by
simp [mem_cylinder_iff_eq, eq_comm]
#align pi_nat.mem_cylinder_comm PiNat.mem_cylinder_comm
theorem mem_cylinder_iff_le_firstDiff {x y : β n, E n} (hne : x β y) (i : β) :
x β cylinder y i β i β€ firstDiff x y := by
constructor
Β· intro h
by_contra!
exact apply_firstDiff_ne hne (h _ this)
Β· intro hi j hj
exact apply_eq_of_lt_firstDiff (hj.trans_le hi)
#align pi_nat.mem_cylinder_iff_le_first_diff PiNat.mem_cylinder_iff_le_firstDiff
theorem mem_cylinder_firstDiff (x y : β n, E n) : x β cylinder y (firstDiff x y) := fun _i hi =>
apply_eq_of_lt_firstDiff hi
#align pi_nat.mem_cylinder_first_diff PiNat.mem_cylinder_firstDiff
theorem cylinder_eq_cylinder_of_le_firstDiff (x y : β n, E n) {n : β} (hn : n β€ firstDiff x y) :
cylinder x n = cylinder y n := by
rw [β mem_cylinder_iff_eq]
intro i hi
exact apply_eq_of_lt_firstDiff (hi.trans_le hn)
#align pi_nat.cylinder_eq_cylinder_of_le_first_diff PiNat.cylinder_eq_cylinder_of_le_firstDiff
theorem iUnion_cylinder_update (x : β n, E n) (n : β) :
β k, cylinder (update x n k) (n + 1) = cylinder x n := by
ext y
simp only [mem_cylinder_iff, mem_iUnion]
constructor
Β· rintro β¨k, hkβ© i hi
simpa [hi.ne] using hk i (Nat.lt_succ_of_lt hi)
Β· intro H
refine β¨y n, fun i hi => ?_β©
rcases Nat.lt_succ_iff_lt_or_eq.1 hi with (h'i | rfl)
Β· simp [H i h'i, h'i.ne]
Β· simp
#align pi_nat.Union_cylinder_update PiNat.iUnion_cylinder_update
theorem update_mem_cylinder (x : β n, E n) (n : β) (y : E n) : update x n y β cylinder x n :=
mem_cylinder_iff.2 fun i hi => by simp [hi.ne]
#align pi_nat.update_mem_cylinder PiNat.update_mem_cylinder
section Res
variable {Ξ± : Type*}
open List
def res (x : β β Ξ±) : β β List Ξ±
| 0 => nil
| Nat.succ n => x n :: res x n
#align pi_nat.res PiNat.res
@[simp]
theorem res_zero (x : β β Ξ±) : res x 0 = @nil Ξ± :=
rfl
#align pi_nat.res_zero PiNat.res_zero
@[simp]
theorem res_succ (x : β β Ξ±) (n : β) : res x n.succ = x n :: res x n :=
rfl
#align pi_nat.res_succ PiNat.res_succ
@[simp]
| Mathlib/Topology/MetricSpace/PiNat.lean | 219 | 219 | theorem res_length (x : β β Ξ±) (n : β) : (res x n).length = n := by | induction n <;> simp [*]
|
import Mathlib.Algebra.Field.Basic
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.RingTheory.Int.Basic
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.Int.NatPrime
import Mathlib.Data.ZMod.Basic
#align_import number_theory.pythagorean_triples from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
theorem sq_ne_two_fin_zmod_four (z : ZMod 4) : z * z β 2 := by
change Fin 4 at z
fin_cases z <;> decide
#align sq_ne_two_fin_zmod_four sq_ne_two_fin_zmod_four
theorem Int.sq_ne_two_mod_four (z : β€) : z * z % 4 β 2 := by
suffices Β¬z * z % (4 : β) = 2 % (4 : β) by exact this
rw [β ZMod.intCast_eq_intCast_iff']
simpa using sq_ne_two_fin_zmod_four _
#align int.sq_ne_two_mod_four Int.sq_ne_two_mod_four
noncomputable section
open scoped Classical
def PythagoreanTriple (x y z : β€) : Prop :=
x * x + y * y = z * z
#align pythagorean_triple PythagoreanTriple
theorem pythagoreanTriple_comm {x y z : β€} : PythagoreanTriple x y z β PythagoreanTriple y x z := by
delta PythagoreanTriple
rw [add_comm]
#align pythagorean_triple_comm pythagoreanTriple_comm
theorem PythagoreanTriple.zero : PythagoreanTriple 0 0 0 := by
simp only [PythagoreanTriple, zero_mul, zero_add]
#align pythagorean_triple.zero PythagoreanTriple.zero
namespace PythagoreanTriple
variable {x y z : β€} (h : PythagoreanTriple x y z)
theorem eq : x * x + y * y = z * z :=
h
#align pythagorean_triple.eq PythagoreanTriple.eq
@[symm]
theorem symm : PythagoreanTriple y x z := by rwa [pythagoreanTriple_comm]
#align pythagorean_triple.symm PythagoreanTriple.symm
theorem mul (k : β€) : PythagoreanTriple (k * x) (k * y) (k * z) :=
calc
k * x * (k * x) + k * y * (k * y) = k ^ 2 * (x * x + y * y) := by ring
_ = k ^ 2 * (z * z) := by rw [h.eq]
_ = k * z * (k * z) := by ring
#align pythagorean_triple.mul PythagoreanTriple.mul
theorem mul_iff (k : β€) (hk : k β 0) :
PythagoreanTriple (k * x) (k * y) (k * z) β PythagoreanTriple x y z := by
refine β¨?_, fun h => h.mul kβ©
simp only [PythagoreanTriple]
intro h
rw [β mul_left_inj' (mul_ne_zero hk hk)]
convert h using 1 <;> ring
#align pythagorean_triple.mul_iff PythagoreanTriple.mul_iff
@[nolint unusedArguments]
def IsClassified (_ : PythagoreanTriple x y z) :=
β k m n : β€,
(x = k * (m ^ 2 - n ^ 2) β§ y = k * (2 * m * n) β¨
x = k * (2 * m * n) β§ y = k * (m ^ 2 - n ^ 2)) β§
Int.gcd m n = 1
#align pythagorean_triple.is_classified PythagoreanTriple.IsClassified
@[nolint unusedArguments]
def IsPrimitiveClassified (_ : PythagoreanTriple x y z) :=
β m n : β€,
(x = m ^ 2 - n ^ 2 β§ y = 2 * m * n β¨ x = 2 * m * n β§ y = m ^ 2 - n ^ 2) β§
Int.gcd m n = 1 β§ (m % 2 = 0 β§ n % 2 = 1 β¨ m % 2 = 1 β§ n % 2 = 0)
#align pythagorean_triple.is_primitive_classified PythagoreanTriple.IsPrimitiveClassified
theorem mul_isClassified (k : β€) (hc : h.IsClassified) : (h.mul k).IsClassified := by
obtain β¨l, m, n, β¨β¨rfl, rflβ© | β¨rfl, rflβ©, coβ©β© := hc
Β· use k * l, m, n
apply And.intro _ co
left
constructor <;> ring
Β· use k * l, m, n
apply And.intro _ co
right
constructor <;> ring
#align pythagorean_triple.mul_is_classified PythagoreanTriple.mul_isClassified
| Mathlib/NumberTheory/PythagoreanTriples.lean | 132 | 161 | theorem even_odd_of_coprime (hc : Int.gcd x y = 1) :
x % 2 = 0 β§ y % 2 = 1 β¨ x % 2 = 1 β§ y % 2 = 0 := by |
cases' Int.emod_two_eq_zero_or_one x with hx hx <;>
cases' Int.emod_two_eq_zero_or_one y with hy hy
-- x even, y even
Β· exfalso
apply Nat.not_coprime_of_dvd_of_dvd (by decide : 1 < 2) _ _ hc
Β· apply Int.natCast_dvd.1
apply Int.dvd_of_emod_eq_zero hx
Β· apply Int.natCast_dvd.1
apply Int.dvd_of_emod_eq_zero hy
-- x even, y odd
Β· left
exact β¨hx, hyβ©
-- x odd, y even
Β· right
exact β¨hx, hyβ©
-- x odd, y odd
Β· exfalso
obtain β¨x0, y0, rfl, rflβ© : β x0 y0, x = x0 * 2 + 1 β§ y = y0 * 2 + 1 := by
cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hx) with x0 hx2
cases' exists_eq_mul_left_of_dvd (Int.dvd_sub_of_emod_eq hy) with y0 hy2
rw [sub_eq_iff_eq_add] at hx2 hy2
exact β¨x0, y0, hx2, hy2β©
apply Int.sq_ne_two_mod_four z
rw [show z * z = 4 * (x0 * x0 + x0 + y0 * y0 + y0) + 2 by
rw [β h.eq]
ring]
simp only [Int.add_emod, Int.mul_emod_right, zero_add]
decide
|
import Mathlib.Analysis.Convex.Between
import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
import Mathlib.Topology.MetricSpace.Holder
import Mathlib.Topology.MetricSpace.MetricSeparated
#align_import measure_theory.measure.hausdorff from "leanprover-community/mathlib"@"3d5c4a7a5fb0d982f97ed953161264f1dbd90ead"
open scoped NNReal ENNReal Topology
open EMetric Set Function Filter Encodable FiniteDimensional TopologicalSpace
noncomputable section
variable {ΞΉ X Y : Type*} [EMetricSpace X] [EMetricSpace Y]
namespace MeasureTheory
namespace OuterMeasure
def IsMetric (ΞΌ : OuterMeasure X) : Prop :=
β s t : Set X, IsMetricSeparated s t β ΞΌ (s βͺ t) = ΞΌ s + ΞΌ t
#align measure_theory.outer_measure.is_metric MeasureTheory.OuterMeasure.IsMetric
namespace IsMetric
variable {ΞΌ : OuterMeasure X}
theorem finset_iUnion_of_pairwise_separated (hm : IsMetric ΞΌ) {I : Finset ΞΉ} {s : ΞΉ β Set X}
(hI : β i β I, β j β I, i β j β IsMetricSeparated (s i) (s j)) :
ΞΌ (β i β I, s i) = β i β I, ΞΌ (s i) := by
classical
induction' I using Finset.induction_on with i I hiI ihI hI
Β· simp
simp only [Finset.mem_insert] at hI
rw [Finset.set_biUnion_insert, hm, ihI, Finset.sum_insert hiI]
exacts [fun i hi j hj hij => hI i (Or.inr hi) j (Or.inr hj) hij,
IsMetricSeparated.finset_iUnion_right fun j hj =>
hI i (Or.inl rfl) j (Or.inr hj) (ne_of_mem_of_not_mem hj hiI).symm]
#align measure_theory.outer_measure.is_metric.finset_Union_of_pairwise_separated MeasureTheory.OuterMeasure.IsMetric.finset_iUnion_of_pairwise_separated
| Mathlib/MeasureTheory/Measure/Hausdorff.lean | 159 | 226 | theorem borel_le_caratheodory (hm : IsMetric ΞΌ) : borel X β€ ΞΌ.caratheodory := by |
rw [borel_eq_generateFrom_isClosed]
refine MeasurableSpace.generateFrom_le fun t ht => ΞΌ.isCaratheodory_iff_le.2 fun s => ?_
set S : β β Set X := fun n => {x β s | (βn)β»ΒΉ β€ infEdist x t}
have Ssep (n) : IsMetricSeparated (S n) t :=
β¨nβ»ΒΉ, ENNReal.inv_ne_zero.2 (ENNReal.natCast_ne_top _),
fun x hx y hy β¦ hx.2.trans <| infEdist_le_edist_of_mem hyβ©
have Ssep' : β n, IsMetricSeparated (S n) (s β© t) := fun n =>
(Ssep n).mono Subset.rfl inter_subset_right
have S_sub : β n, S n β s \ t := fun n =>
subset_inter inter_subset_left (Ssep n).subset_compl_right
have hSs : β n, ΞΌ (s β© t) + ΞΌ (S n) β€ ΞΌ s := fun n =>
calc
ΞΌ (s β© t) + ΞΌ (S n) = ΞΌ (s β© t βͺ S n) := Eq.symm <| hm _ _ <| (Ssep' n).symm
_ β€ ΞΌ (s β© t βͺ s \ t) := ΞΌ.mono <| union_subset_union_right _ <| S_sub n
_ = ΞΌ s := by rw [inter_union_diff]
have iUnion_S : β n, S n = s \ t := by
refine Subset.antisymm (iUnion_subset S_sub) ?_
rintro x β¨hxs, hxtβ©
rw [mem_iff_infEdist_zero_of_closed ht] at hxt
rcases ENNReal.exists_inv_nat_lt hxt with β¨n, hnβ©
exact mem_iUnion.2 β¨n, hxs, hn.leβ©
/- Now we have `β n, ΞΌ (s β© t) + ΞΌ (S n) β€ ΞΌ s` and we need to prove
`ΞΌ (s β© t) + ΞΌ (β n, S n) β€ ΞΌ s`. We can't pass to the limit because
`ΞΌ` is only an outer measure. -/
by_cases htop : ΞΌ (s \ t) = β
Β· rw [htop, add_top, β htop]
exact ΞΌ.mono diff_subset
suffices ΞΌ (β n, S n) β€ β¨ n, ΞΌ (S n) by calc
ΞΌ (s β© t) + ΞΌ (s \ t) = ΞΌ (s β© t) + ΞΌ (β n, S n) := by rw [iUnion_S]
_ β€ ΞΌ (s β© t) + β¨ n, ΞΌ (S n) := by gcongr
_ = β¨ n, ΞΌ (s β© t) + ΞΌ (S n) := ENNReal.add_iSup
_ β€ ΞΌ s := iSup_le hSs
/- It suffices to show that `β' k, ΞΌ (S (k + 1) \ S k) β β`. Indeed, if we have this,
then for all `N` we have `ΞΌ (β n, S n) β€ ΞΌ (S N) + β' k, m (S (N + k + 1) \ S (N + k))`
and the second term tends to zero, see `OuterMeasure.iUnion_nat_of_monotone_of_tsum_ne_top`
for details. -/
have : β n, S n β S (n + 1) := fun n x hx =>
β¨hx.1, le_trans (ENNReal.inv_le_inv.2 <| Nat.cast_le.2 n.le_succ) hx.2β©
classical -- Porting note: Added this to get the next tactic to work
refine (ΞΌ.iUnion_nat_of_monotone_of_tsum_ne_top this ?_).le; clear this
/- While the sets `S (k + 1) \ S k` are not pairwise metric separated, the sets in each
subsequence `S (2 * k + 1) \ S (2 * k)` and `S (2 * k + 2) \ S (2 * k)` are metric separated,
so `m` is additive on each of those sequences. -/
rw [β tsum_even_add_odd ENNReal.summable ENNReal.summable, ENNReal.add_ne_top]
suffices β a, (β' k : β, ΞΌ (S (2 * k + 1 + a) \ S (2 * k + a))) β β from
β¨by simpa using this 0, by simpa using this 1β©
refine fun r => ne_top_of_le_ne_top htop ?_
rw [β iUnion_S, ENNReal.tsum_eq_iSup_nat, iSup_le_iff]
intro n
rw [β hm.finset_iUnion_of_pairwise_separated]
Β· exact ΞΌ.mono (iUnion_subset fun i => iUnion_subset fun _ x hx => mem_iUnion.2 β¨_, hx.1β©)
suffices β i j, i < j β IsMetricSeparated (S (2 * i + 1 + r)) (s \ S (2 * j + r)) from
fun i _ j _ hij => hij.lt_or_lt.elim
(fun h => (this i j h).mono inter_subset_left fun x hx => by exact β¨hx.1.1, hx.2β©)
fun h => (this j i h).symm.mono (fun x hx => by exact β¨hx.1.1, hx.2β©) inter_subset_left
intro i j hj
have A : ((β(2 * j + r))β»ΒΉ : ββ₯0β) < (β(2 * i + 1 + r))β»ΒΉ := by
rw [ENNReal.inv_lt_inv, Nat.cast_lt]; omega
refine β¨(β(2 * i + 1 + r))β»ΒΉ - (β(2 * j + r))β»ΒΉ, by simpa [tsub_eq_zero_iff_le] using A,
fun x hx y hy => ?_β©
have : infEdist y t < (β(2 * j + r))β»ΒΉ := not_le.1 fun hle => hy.2 β¨hy.1, hleβ©
rcases infEdist_lt_iff.mp this with β¨z, hzt, hyzβ©
have hxz : (β(2 * i + 1 + r))β»ΒΉ β€ edist x z := le_infEdist.1 hx.2 _ hzt
apply ENNReal.le_of_add_le_add_right hyz.ne_top
refine le_trans ?_ (edist_triangle _ _ _)
refine (add_le_add le_rfl hyz.le).trans (Eq.trans_le ?_ hxz)
rw [tsub_add_cancel_of_le A.le]
|
import Mathlib.Data.Matrix.Basic
import Mathlib.LinearAlgebra.Matrix.Trace
#align_import data.matrix.basis from "leanprover-community/mathlib"@"320df450e9abeb5fc6417971e75acb6ae8bc3794"
variable {l m n : Type*}
variable {R Ξ± : Type*}
namespace Matrix
open Matrix
variable [DecidableEq l] [DecidableEq m] [DecidableEq n]
variable [Semiring Ξ±]
def stdBasisMatrix (i : m) (j : n) (a : Ξ±) : Matrix m n Ξ± := fun i' j' =>
if i = i' β§ j = j' then a else 0
#align matrix.std_basis_matrix Matrix.stdBasisMatrix
@[simp]
theorem smul_stdBasisMatrix [SMulZeroClass R Ξ±] (r : R) (i : m) (j : n) (a : Ξ±) :
r β’ stdBasisMatrix i j a = stdBasisMatrix i j (r β’ a) := by
unfold stdBasisMatrix
ext
simp [smul_ite]
#align matrix.smul_std_basis_matrix Matrix.smul_stdBasisMatrix
@[simp]
theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : Ξ±) = 0 := by
unfold stdBasisMatrix
ext
simp
#align matrix.std_basis_matrix_zero Matrix.stdBasisMatrix_zero
| Mathlib/Data/Matrix/Basis.lean | 51 | 54 | theorem stdBasisMatrix_add (i : m) (j : n) (a b : Ξ±) :
stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by |
unfold stdBasisMatrix; ext
split_ifs with h <;> simp [h]
|
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
| Mathlib/Topology/ContinuousOn.lean | 491 | 493 | 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]
|
import Mathlib.Order.BooleanAlgebra
import Mathlib.Tactic.Common
#align_import order.heyting.boundary from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
variable {Ξ± : Type*}
namespace Coheyting
variable [CoheytingAlgebra Ξ±] {a b : Ξ±}
def boundary (a : Ξ±) : Ξ± :=
a β οΏ’a
#align coheyting.boundary Coheyting.boundary
scoped[Heyting] prefix:120 "β " => Coheyting.boundary
-- Porting note: Should the notation be automatically included in the current scope?
open Heyting
-- Porting note: Should hnot be named hNot?
theorem inf_hnot_self (a : Ξ±) : a β οΏ’a = β a :=
rfl
#align coheyting.inf_hnot_self Coheyting.inf_hnot_self
theorem boundary_le : β a β€ a :=
inf_le_left
#align coheyting.boundary_le Coheyting.boundary_le
theorem boundary_le_hnot : β a β€ οΏ’a :=
inf_le_right
#align coheyting.boundary_le_hnot Coheyting.boundary_le_hnot
@[simp]
theorem boundary_bot : β (β₯ : Ξ±) = β₯ := bot_inf_eq _
#align coheyting.boundary_bot Coheyting.boundary_bot
@[simp]
theorem boundary_top : β (β€ : Ξ±) = β₯ := by rw [boundary, hnot_top, inf_bot_eq]
#align coheyting.boundary_top Coheyting.boundary_top
theorem boundary_hnot_le (a : Ξ±) : β (οΏ’a) β€ β a :=
(inf_comm _ _).trans_le <| inf_le_inf_right _ hnot_hnot_le
#align coheyting.boundary_hnot_le Coheyting.boundary_hnot_le
@[simp]
theorem boundary_hnot_hnot (a : Ξ±) : β (οΏ’οΏ’a) = β (οΏ’a) := by
simp_rw [boundary, hnot_hnot_hnot, inf_comm]
#align coheyting.boundary_hnot_hnot Coheyting.boundary_hnot_hnot
@[simp]
theorem hnot_boundary (a : Ξ±) : οΏ’β a = β€ := by rw [boundary, hnot_inf_distrib, sup_hnot_self]
#align coheyting.hnot_boundary Coheyting.hnot_boundary
| Mathlib/Order/Heyting/Boundary.lean | 80 | 82 | theorem boundary_inf (a b : Ξ±) : β (a β b) = β a β b β a β β b := by |
unfold boundary
rw [hnot_inf_distrib, inf_sup_left, inf_right_comm, β inf_assoc]
|
import Mathlib.Algebra.BigOperators.Finsupp
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.Data.Fintype.BigOperators
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.SetTheory.Cardinal.Cofinality
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
noncomputable section
universe u
open Function Set Submodule
variable {ΞΉ : Type*} {ΞΉ' : Type*} {R : Type*} {Rβ : Type*} {K : Type*}
variable {M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}
section Module
variable [Semiring R]
variable [AddCommMonoid M] [Module R M] [AddCommMonoid M'] [Module R M']
section
variable (ΞΉ R M)
structure Basis where
ofRepr ::
repr : M ββ[R] ΞΉ ββ R
#align basis Basis
#align basis.repr Basis.repr
#align basis.of_repr Basis.ofRepr
end
instance uniqueBasis [Subsingleton R] : Unique (Basis ΞΉ R M) :=
β¨β¨β¨defaultβ©β©, fun β¨bβ© => by rw [Subsingleton.elim b]β©
#align unique_basis uniqueBasis
namespace Basis
instance : Inhabited (Basis ΞΉ R (ΞΉ ββ R)) :=
β¨.ofRepr (LinearEquiv.refl _ _)β©
variable (b bβ : Basis ΞΉ R M) (i : ΞΉ) (c : R) (x : M)
section repr
theorem repr_injective : Injective (repr : Basis ΞΉ R M β M ββ[R] ΞΉ ββ R) := fun f g h => by
cases f; cases g; congr
#align basis.repr_injective Basis.repr_injective
instance instFunLike : FunLike (Basis ΞΉ R M) ΞΉ M where
coe b i := b.repr.symm (Finsupp.single i 1)
coe_injective' f g h := repr_injective <| LinearEquiv.symm_bijective.injective <|
LinearEquiv.toLinearMap_injective <| by ext; exact congr_fun h _
#align basis.fun_like Basis.instFunLike
@[simp]
theorem coe_ofRepr (e : M ββ[R] ΞΉ ββ R) : β(ofRepr e) = fun i => e.symm (Finsupp.single i 1) :=
rfl
#align basis.coe_of_repr Basis.coe_ofRepr
protected theorem injective [Nontrivial R] : Injective b :=
b.repr.symm.injective.comp fun _ _ => (Finsupp.single_left_inj (one_ne_zero : (1 : R) β 0)).mp
#align basis.injective Basis.injective
theorem repr_symm_single_one : b.repr.symm (Finsupp.single i 1) = b i :=
rfl
#align basis.repr_symm_single_one Basis.repr_symm_single_one
theorem repr_symm_single : b.repr.symm (Finsupp.single i c) = c β’ b i :=
calc
b.repr.symm (Finsupp.single i c) = b.repr.symm (c β’ Finsupp.single i (1 : R)) := by
{ rw [Finsupp.smul_single', mul_one] }
_ = c β’ b i := by rw [LinearEquiv.map_smul, repr_symm_single_one]
#align basis.repr_symm_single Basis.repr_symm_single
@[simp]
theorem repr_self : b.repr (b i) = Finsupp.single i 1 :=
LinearEquiv.apply_symm_apply _ _
#align basis.repr_self Basis.repr_self
theorem repr_self_apply (j) [Decidable (i = j)] : b.repr (b i) j = if i = j then 1 else 0 := by
rw [repr_self, Finsupp.single_apply]
#align basis.repr_self_apply Basis.repr_self_apply
@[simp]
theorem repr_symm_apply (v) : b.repr.symm v = Finsupp.total ΞΉ M R b v :=
calc
b.repr.symm v = b.repr.symm (v.sum Finsupp.single) := by simp
_ = v.sum fun i vi => b.repr.symm (Finsupp.single i vi) := map_finsupp_sum ..
_ = Finsupp.total ΞΉ M R b v := by simp only [repr_symm_single, Finsupp.total_apply]
#align basis.repr_symm_apply Basis.repr_symm_apply
@[simp]
theorem coe_repr_symm : βb.repr.symm = Finsupp.total ΞΉ M R b :=
LinearMap.ext fun v => b.repr_symm_apply v
#align basis.coe_repr_symm Basis.coe_repr_symm
@[simp]
| Mathlib/LinearAlgebra/Basis.lean | 167 | 169 | theorem repr_total (v) : b.repr (Finsupp.total _ _ _ b v) = v := by |
rw [β b.coe_repr_symm]
exact b.repr.apply_symm_apply v
|
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.RingTheory.Localization.FractionRing
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β}
section CommRing
variable [CommRing R] [IsDomain R] {p q : R[X]}
section Roots
open Multiset Finset
noncomputable def roots (p : R[X]) : Multiset R :=
haveI := Classical.decEq R
haveI := Classical.dec (p = 0)
if h : p = 0 then β
else Classical.choose (exists_multiset_roots h)
#align polynomial.roots Polynomial.roots
theorem roots_def [DecidableEq R] (p : R[X]) [Decidable (p = 0)] :
p.roots = if h : p = 0 then β
else Classical.choose (exists_multiset_roots h) := by
-- porting noteL `βΉ_βΊ` doesn't work for instance arguments
rename_i iR ip0
obtain rfl := Subsingleton.elim iR (Classical.decEq R)
obtain rfl := Subsingleton.elim ip0 (Classical.dec (p = 0))
rfl
#align polynomial.roots_def Polynomial.roots_def
@[simp]
theorem roots_zero : (0 : R[X]).roots = 0 :=
dif_pos rfl
#align polynomial.roots_zero Polynomial.roots_zero
theorem card_roots (hp0 : p β 0) : (Multiset.card (roots p) : WithBot β) β€ degree p := by
classical
unfold roots
rw [dif_neg hp0]
exact (Classical.choose_spec (exists_multiset_roots hp0)).1
#align polynomial.card_roots Polynomial.card_roots
theorem card_roots' (p : R[X]) : Multiset.card p.roots β€ natDegree p := by
by_cases hp0 : p = 0
Β· simp [hp0]
exact WithBot.coe_le_coe.1 (le_trans (card_roots hp0) (le_of_eq <| degree_eq_natDegree hp0))
#align polynomial.card_roots' Polynomial.card_roots'
theorem card_roots_sub_C {p : R[X]} {a : R} (hp0 : 0 < degree p) :
(Multiset.card (p - C a).roots : WithBot β) β€ degree p :=
calc
(Multiset.card (p - C a).roots : WithBot β) β€ degree (p - C a) :=
card_roots <| mt sub_eq_zero.1 fun h => not_le_of_gt hp0 <| h.symm βΈ degree_C_le
_ = degree p := by rw [sub_eq_add_neg, β C_neg]; exact degree_add_C hp0
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C Polynomial.card_roots_sub_C
theorem card_roots_sub_C' {p : R[X]} {a : R} (hp0 : 0 < degree p) :
Multiset.card (p - C a).roots β€ natDegree p :=
WithBot.coe_le_coe.1
(le_trans (card_roots_sub_C hp0)
(le_of_eq <| degree_eq_natDegree fun h => by simp_all [lt_irrefl]))
set_option linter.uppercaseLean3 false in
#align polynomial.card_roots_sub_C' Polynomial.card_roots_sub_C'
@[simp]
theorem count_roots [DecidableEq R] (p : R[X]) : p.roots.count a = rootMultiplicity a p := by
classical
by_cases hp : p = 0
Β· simp [hp]
rw [roots_def, dif_neg hp]
exact (Classical.choose_spec (exists_multiset_roots hp)).2 a
#align polynomial.count_roots Polynomial.count_roots
@[simp]
theorem mem_roots' : a β p.roots β p β 0 β§ IsRoot p a := by
classical
rw [β count_pos, count_roots p, rootMultiplicity_pos']
#align polynomial.mem_roots' Polynomial.mem_roots'
theorem mem_roots (hp : p β 0) : a β p.roots β IsRoot p a :=
mem_roots'.trans <| and_iff_right hp
#align polynomial.mem_roots Polynomial.mem_roots
theorem ne_zero_of_mem_roots (h : a β p.roots) : p β 0 :=
(mem_roots'.1 h).1
#align polynomial.ne_zero_of_mem_roots Polynomial.ne_zero_of_mem_roots
theorem isRoot_of_mem_roots (h : a β p.roots) : IsRoot p a :=
(mem_roots'.1 h).2
#align polynomial.is_root_of_mem_roots Polynomial.isRoot_of_mem_roots
-- Porting note: added during port.
lemma mem_roots_iff_aeval_eq_zero {x : R} (w : p β 0) : x β roots p β aeval x p = 0 := by
rw [mem_roots w, IsRoot.def, aeval_def, evalβ_eq_eval_map]
simp
theorem card_le_degree_of_subset_roots {p : R[X]} {Z : Finset R} (h : Z.val β p.roots) :
Z.card β€ p.natDegree :=
(Multiset.card_le_card (Finset.val_le_iff_val_subset.2 h)).trans (Polynomial.card_roots' p)
#align polynomial.card_le_degree_of_subset_roots Polynomial.card_le_degree_of_subset_roots
theorem finite_setOf_isRoot {p : R[X]} (hp : p β 0) : Set.Finite { x | IsRoot p x } := by
classical
simpa only [β Finset.setOf_mem, Multiset.mem_toFinset, mem_roots hp]
using p.roots.toFinset.finite_toSet
#align polynomial.finite_set_of_is_root Polynomial.finite_setOf_isRoot
theorem eq_zero_of_infinite_isRoot (p : R[X]) (h : Set.Infinite { x | IsRoot p x }) : p = 0 :=
not_imp_comm.mp finite_setOf_isRoot h
#align polynomial.eq_zero_of_infinite_is_root Polynomial.eq_zero_of_infinite_isRoot
theorem exists_max_root [LinearOrder R] (p : R[X]) (hp : p β 0) : β xβ, β x, p.IsRoot x β x β€ xβ :=
Set.exists_upper_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_max_root Polynomial.exists_max_root
theorem exists_min_root [LinearOrder R] (p : R[X]) (hp : p β 0) : β xβ, β x, p.IsRoot x β xβ β€ x :=
Set.exists_lower_bound_image _ _ <| finite_setOf_isRoot hp
#align polynomial.exists_min_root Polynomial.exists_min_root
theorem eq_of_infinite_eval_eq (p q : R[X]) (h : Set.Infinite { x | eval x p = eval x q }) :
p = q := by
rw [β sub_eq_zero]
apply eq_zero_of_infinite_isRoot
simpa only [IsRoot, eval_sub, sub_eq_zero]
#align polynomial.eq_of_infinite_eval_eq Polynomial.eq_of_infinite_eval_eq
| Mathlib/Algebra/Polynomial/Roots.lean | 161 | 164 | theorem roots_mul {p q : R[X]} (hpq : p * q β 0) : (p * q).roots = p.roots + q.roots := by |
classical
exact Multiset.ext.mpr fun r => by
rw [count_add, count_roots, count_roots, count_roots, rootMultiplicity_mul hpq]
|
import Mathlib.Algebra.BigOperators.Group.List
import Mathlib.Algebra.Group.Prod
import Mathlib.Data.Multiset.Basic
#align_import algebra.big_operators.multiset.basic from "leanprover-community/mathlib"@"6c5f73fd6f6cc83122788a80a27cdd54663609f4"
assert_not_exists MonoidWithZero
variable {F ΞΉ Ξ± Ξ² Ξ³ : Type*}
namespace Multiset
section CommMonoid
variable [CommMonoid Ξ±] [CommMonoid Ξ²] {s t : Multiset Ξ±} {a : Ξ±} {m : Multiset ΞΉ} {f g : ΞΉ β Ξ±}
@[to_additive
"Sum of a multiset given a commutative additive monoid structure on `Ξ±`.
`sum {a, b, c} = a + b + c`"]
def prod : Multiset Ξ± β Ξ± :=
foldr (Β· * Β·) (fun x y z => by simp [mul_left_comm]) 1
#align multiset.prod Multiset.prod
#align multiset.sum Multiset.sum
@[to_additive]
theorem prod_eq_foldr (s : Multiset Ξ±) :
prod s = foldr (Β· * Β·) (fun x y z => by simp [mul_left_comm]) 1 s :=
rfl
#align multiset.prod_eq_foldr Multiset.prod_eq_foldr
#align multiset.sum_eq_foldr Multiset.sum_eq_foldr
@[to_additive]
theorem prod_eq_foldl (s : Multiset Ξ±) :
prod s = foldl (Β· * Β·) (fun x y z => by simp [mul_right_comm]) 1 s :=
(foldr_swap _ _ _ _).trans (by simp [mul_comm])
#align multiset.prod_eq_foldl Multiset.prod_eq_foldl
#align multiset.sum_eq_foldl Multiset.sum_eq_foldl
@[to_additive (attr := simp, norm_cast)]
theorem prod_coe (l : List Ξ±) : prod βl = l.prod :=
prod_eq_foldl _
#align multiset.coe_prod Multiset.prod_coe
#align multiset.coe_sum Multiset.sum_coe
@[to_additive (attr := simp)]
theorem prod_toList (s : Multiset Ξ±) : s.toList.prod = s.prod := by
conv_rhs => rw [β coe_toList s]
rw [prod_coe]
#align multiset.prod_to_list Multiset.prod_toList
#align multiset.sum_to_list Multiset.sum_toList
@[to_additive (attr := simp)]
theorem prod_zero : @prod Ξ± _ 0 = 1 :=
rfl
#align multiset.prod_zero Multiset.prod_zero
#align multiset.sum_zero Multiset.sum_zero
@[to_additive (attr := simp)]
theorem prod_cons (a : Ξ±) (s) : prod (a ::β s) = a * prod s :=
foldr_cons _ _ _ _ _
#align multiset.prod_cons Multiset.prod_cons
#align multiset.sum_cons Multiset.sum_cons
@[to_additive (attr := simp)]
theorem prod_erase [DecidableEq Ξ±] (h : a β s) : a * (s.erase a).prod = s.prod := by
rw [β s.coe_toList, coe_erase, prod_coe, prod_coe, List.prod_erase (mem_toList.2 h)]
#align multiset.prod_erase Multiset.prod_erase
#align multiset.sum_erase Multiset.sum_erase
@[to_additive (attr := simp)]
theorem prod_map_erase [DecidableEq ΞΉ] {a : ΞΉ} (h : a β m) :
f a * ((m.erase a).map f).prod = (m.map f).prod := by
rw [β m.coe_toList, coe_erase, map_coe, map_coe, prod_coe, prod_coe,
List.prod_map_erase f (mem_toList.2 h)]
#align multiset.prod_map_erase Multiset.prod_map_erase
#align multiset.sum_map_erase Multiset.sum_map_erase
@[to_additive (attr := simp)]
theorem prod_singleton (a : Ξ±) : prod {a} = a := by
simp only [mul_one, prod_cons, β cons_zero, eq_self_iff_true, prod_zero]
#align multiset.prod_singleton Multiset.prod_singleton
#align multiset.sum_singleton Multiset.sum_singleton
@[to_additive]
theorem prod_pair (a b : Ξ±) : ({a, b} : Multiset Ξ±).prod = a * b := by
rw [insert_eq_cons, prod_cons, prod_singleton]
#align multiset.prod_pair Multiset.prod_pair
#align multiset.sum_pair Multiset.sum_pair
@[to_additive (attr := simp)]
theorem prod_add (s t : Multiset Ξ±) : prod (s + t) = prod s * prod t :=
Quotient.inductionOnβ s t fun lβ lβ => by simp
#align multiset.prod_add Multiset.prod_add
#align multiset.sum_add Multiset.sum_add
@[to_additive]
theorem prod_nsmul (m : Multiset Ξ±) : β n : β, (n β’ m).prod = m.prod ^ n
| 0 => by
rw [zero_nsmul, pow_zero]
rfl
| n + 1 => by rw [add_nsmul, one_nsmul, pow_add, pow_one, prod_add, prod_nsmul m n]
#align multiset.prod_nsmul Multiset.prod_nsmul
@[to_additive]
| Mathlib/Algebra/BigOperators/Group/Multiset.lean | 125 | 127 | theorem prod_filter_mul_prod_filter_not (p) [DecidablePred p] :
(s.filter p).prod * (s.filter (fun a β¦ Β¬ p a)).prod = s.prod := by |
rw [β prod_add, filter_add_not]
|
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
import Mathlib.Analysis.Normed.Group.AddCircle
import Mathlib.Algebra.CharZero.Quotient
import Mathlib.Topology.Instances.Sign
#align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
open Real
noncomputable section
namespace Real
-- Porting note: can't derive `NormedAddCommGroup, Inhabited`
def Angle : Type :=
AddCircle (2 * Ο)
#align real.angle Real.Angle
namespace Angle
-- Porting note (#10754): added due to missing instances due to no deriving
instance : NormedAddCommGroup Angle :=
inferInstanceAs (NormedAddCommGroup (AddCircle (2 * Ο)))
-- Porting note (#10754): added due to missing instances due to no deriving
instance : Inhabited Angle :=
inferInstanceAs (Inhabited (AddCircle (2 * Ο)))
-- Porting note (#10754): added due to missing instances due to no deriving
-- also, without this, a plain `QuotientAddGroup.mk`
-- causes coerced terms to be of type `β β§Έ AddSubgroup.zmultiples (2 * Ο)`
@[coe]
protected def coe (r : β) : Angle := QuotientAddGroup.mk r
instance : Coe β Angle := β¨Angle.coeβ©
instance : CircularOrder Real.Angle :=
QuotientAddGroup.circularOrder (hp' := β¨by norm_num [pi_pos]β©)
@[continuity]
theorem continuous_coe : Continuous ((β) : β β Angle) :=
continuous_quotient_mk'
#align real.angle.continuous_coe Real.Angle.continuous_coe
def coeHom : β β+ Angle :=
QuotientAddGroup.mk' _
#align real.angle.coe_hom Real.Angle.coeHom
@[simp]
theorem coe_coeHom : (coeHom : β β Angle) = ((β) : β β Angle) :=
rfl
#align real.angle.coe_coe_hom Real.Angle.coe_coeHom
@[elab_as_elim]
protected theorem induction_on {p : Angle β Prop} (ΞΈ : Angle) (h : β x : β, p x) : p ΞΈ :=
Quotient.inductionOn' ΞΈ h
#align real.angle.induction_on Real.Angle.induction_on
@[simp]
theorem coe_zero : β(0 : β) = (0 : Angle) :=
rfl
#align real.angle.coe_zero Real.Angle.coe_zero
@[simp]
theorem coe_add (x y : β) : β(x + y : β) = (βx + βy : Angle) :=
rfl
#align real.angle.coe_add Real.Angle.coe_add
@[simp]
theorem coe_neg (x : β) : β(-x : β) = -(βx : Angle) :=
rfl
#align real.angle.coe_neg Real.Angle.coe_neg
@[simp]
theorem coe_sub (x y : β) : β(x - y : β) = (βx - βy : Angle) :=
rfl
#align real.angle.coe_sub Real.Angle.coe_sub
theorem coe_nsmul (n : β) (x : β) : β(n β’ x : β) = n β’ (βx : Angle) :=
rfl
#align real.angle.coe_nsmul Real.Angle.coe_nsmul
theorem coe_zsmul (z : β€) (x : β) : β(z β’ x : β) = z β’ (βx : Angle) :=
rfl
#align real.angle.coe_zsmul Real.Angle.coe_zsmul
@[simp, norm_cast]
theorem natCast_mul_eq_nsmul (x : β) (n : β) : β((n : β) * x) = n β’ (βx : Angle) := by
simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n
#align real.angle.coe_nat_mul_eq_nsmul Real.Angle.natCast_mul_eq_nsmul
@[simp, norm_cast]
theorem intCast_mul_eq_zsmul (x : β) (n : β€) : β((n : β) * x : β) = n β’ (βx : Angle) := by
simpa only [zsmul_eq_mul] using coeHom.map_zsmul x n
#align real.angle.coe_int_mul_eq_zsmul Real.Angle.intCast_mul_eq_zsmul
@[deprecated (since := "2024-05-25")] alias coe_nat_mul_eq_nsmul := natCast_mul_eq_nsmul
@[deprecated (since := "2024-05-25")] alias coe_int_mul_eq_zsmul := intCast_mul_eq_zsmul
theorem angle_eq_iff_two_pi_dvd_sub {Ο ΞΈ : β} : (ΞΈ : Angle) = Ο β β k : β€, ΞΈ - Ο = 2 * Ο * k := by
simp only [QuotientAddGroup.eq, AddSubgroup.zmultiples_eq_closure,
AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm]
-- Porting note: added `rw`, `simp [Angle.coe, QuotientAddGroup.eq]` doesn't fire otherwise
rw [Angle.coe, Angle.coe, QuotientAddGroup.eq]
simp only [AddSubgroup.zmultiples_eq_closure,
AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm]
#align real.angle.angle_eq_iff_two_pi_dvd_sub Real.Angle.angle_eq_iff_two_pi_dvd_sub
@[simp]
theorem coe_two_pi : β(2 * Ο : β) = (0 : Angle) :=
angle_eq_iff_two_pi_dvd_sub.2 β¨1, by rw [sub_zero, Int.cast_one, mul_one]β©
#align real.angle.coe_two_pi Real.Angle.coe_two_pi
@[simp]
theorem neg_coe_pi : -(Ο : Angle) = Ο := by
rw [β coe_neg, angle_eq_iff_two_pi_dvd_sub]
use -1
simp [two_mul, sub_eq_add_neg]
#align real.angle.neg_coe_pi Real.Angle.neg_coe_pi
@[simp]
theorem two_nsmul_coe_div_two (ΞΈ : β) : (2 : β) β’ (β(ΞΈ / 2) : Angle) = ΞΈ := by
rw [β coe_nsmul, two_nsmul, add_halves]
#align real.angle.two_nsmul_coe_div_two Real.Angle.two_nsmul_coe_div_two
@[simp]
theorem two_zsmul_coe_div_two (ΞΈ : β) : (2 : β€) β’ (β(ΞΈ / 2) : Angle) = ΞΈ := by
rw [β coe_zsmul, two_zsmul, add_halves]
#align real.angle.two_zsmul_coe_div_two Real.Angle.two_zsmul_coe_div_two
-- Porting note (#10618): @[simp] can prove it
theorem two_nsmul_neg_pi_div_two : (2 : β) β’ (β(-Ο / 2) : Angle) = Ο := by
rw [two_nsmul_coe_div_two, coe_neg, neg_coe_pi]
#align real.angle.two_nsmul_neg_pi_div_two Real.Angle.two_nsmul_neg_pi_div_two
-- Porting note (#10618): @[simp] can prove it
theorem two_zsmul_neg_pi_div_two : (2 : β€) β’ (β(-Ο / 2) : Angle) = Ο := by
rw [two_zsmul, β two_nsmul, two_nsmul_neg_pi_div_two]
#align real.angle.two_zsmul_neg_pi_div_two Real.Angle.two_zsmul_neg_pi_div_two
theorem sub_coe_pi_eq_add_coe_pi (ΞΈ : Angle) : ΞΈ - Ο = ΞΈ + Ο := by
rw [sub_eq_add_neg, neg_coe_pi]
#align real.angle.sub_coe_pi_eq_add_coe_pi Real.Angle.sub_coe_pi_eq_add_coe_pi
@[simp]
theorem two_nsmul_coe_pi : (2 : β) β’ (Ο : Angle) = 0 := by simp [β natCast_mul_eq_nsmul]
#align real.angle.two_nsmul_coe_pi Real.Angle.two_nsmul_coe_pi
@[simp]
theorem two_zsmul_coe_pi : (2 : β€) β’ (Ο : Angle) = 0 := by simp [β intCast_mul_eq_zsmul]
#align real.angle.two_zsmul_coe_pi Real.Angle.two_zsmul_coe_pi
@[simp]
theorem coe_pi_add_coe_pi : (Ο : Real.Angle) + Ο = 0 := by rw [β two_nsmul, two_nsmul_coe_pi]
#align real.angle.coe_pi_add_coe_pi Real.Angle.coe_pi_add_coe_pi
theorem zsmul_eq_iff {Ο ΞΈ : Angle} {z : β€} (hz : z β 0) :
z β’ Ο = z β’ ΞΈ β β k : Fin z.natAbs, Ο = ΞΈ + (k : β) β’ (2 * Ο / z : β) :=
QuotientAddGroup.zmultiples_zsmul_eq_zsmul_iff hz
#align real.angle.zsmul_eq_iff Real.Angle.zsmul_eq_iff
theorem nsmul_eq_iff {Ο ΞΈ : Angle} {n : β} (hz : n β 0) :
n β’ Ο = n β’ ΞΈ β β k : Fin n, Ο = ΞΈ + (k : β) β’ (2 * Ο / n : β) :=
QuotientAddGroup.zmultiples_nsmul_eq_nsmul_iff hz
#align real.angle.nsmul_eq_iff Real.Angle.nsmul_eq_iff
theorem two_zsmul_eq_iff {Ο ΞΈ : Angle} : (2 : β€) β’ Ο = (2 : β€) β’ ΞΈ β Ο = ΞΈ β¨ Ο = ΞΈ + βΟ := by
-- Porting note: no `Int.natAbs_bit0` anymore
have : Int.natAbs 2 = 2 := rfl
rw [zsmul_eq_iff two_ne_zero, this, Fin.exists_fin_two, Fin.val_zero,
Fin.val_one, zero_smul, add_zero, one_smul, Int.cast_two,
mul_div_cancel_leftβ (_ : β) two_ne_zero]
#align real.angle.two_zsmul_eq_iff Real.Angle.two_zsmul_eq_iff
theorem two_nsmul_eq_iff {Ο ΞΈ : Angle} : (2 : β) β’ Ο = (2 : β) β’ ΞΈ β Ο = ΞΈ β¨ Ο = ΞΈ + βΟ := by
simp_rw [β natCast_zsmul, Nat.cast_ofNat, two_zsmul_eq_iff]
#align real.angle.two_nsmul_eq_iff Real.Angle.two_nsmul_eq_iff
theorem two_nsmul_eq_zero_iff {ΞΈ : Angle} : (2 : β) β’ ΞΈ = 0 β ΞΈ = 0 β¨ ΞΈ = Ο := by
convert two_nsmul_eq_iff <;> simp
#align real.angle.two_nsmul_eq_zero_iff Real.Angle.two_nsmul_eq_zero_iff
theorem two_nsmul_ne_zero_iff {ΞΈ : Angle} : (2 : β) β’ ΞΈ β 0 β ΞΈ β 0 β§ ΞΈ β Ο := by
rw [β not_or, β two_nsmul_eq_zero_iff]
#align real.angle.two_nsmul_ne_zero_iff Real.Angle.two_nsmul_ne_zero_iff
theorem two_zsmul_eq_zero_iff {ΞΈ : Angle} : (2 : β€) β’ ΞΈ = 0 β ΞΈ = 0 β¨ ΞΈ = Ο := by
simp_rw [two_zsmul, β two_nsmul, two_nsmul_eq_zero_iff]
#align real.angle.two_zsmul_eq_zero_iff Real.Angle.two_zsmul_eq_zero_iff
theorem two_zsmul_ne_zero_iff {ΞΈ : Angle} : (2 : β€) β’ ΞΈ β 0 β ΞΈ β 0 β§ ΞΈ β Ο := by
rw [β not_or, β two_zsmul_eq_zero_iff]
#align real.angle.two_zsmul_ne_zero_iff Real.Angle.two_zsmul_ne_zero_iff
theorem eq_neg_self_iff {ΞΈ : Angle} : ΞΈ = -ΞΈ β ΞΈ = 0 β¨ ΞΈ = Ο := by
rw [β add_eq_zero_iff_eq_neg, β two_nsmul, two_nsmul_eq_zero_iff]
#align real.angle.eq_neg_self_iff Real.Angle.eq_neg_self_iff
theorem ne_neg_self_iff {ΞΈ : Angle} : ΞΈ β -ΞΈ β ΞΈ β 0 β§ ΞΈ β Ο := by
rw [β not_or, β eq_neg_self_iff.not]
#align real.angle.ne_neg_self_iff Real.Angle.ne_neg_self_iff
theorem neg_eq_self_iff {ΞΈ : Angle} : -ΞΈ = ΞΈ β ΞΈ = 0 β¨ ΞΈ = Ο := by rw [eq_comm, eq_neg_self_iff]
#align real.angle.neg_eq_self_iff Real.Angle.neg_eq_self_iff
theorem neg_ne_self_iff {ΞΈ : Angle} : -ΞΈ β ΞΈ β ΞΈ β 0 β§ ΞΈ β Ο := by
rw [β not_or, β neg_eq_self_iff.not]
#align real.angle.neg_ne_self_iff Real.Angle.neg_ne_self_iff
theorem two_nsmul_eq_pi_iff {ΞΈ : Angle} : (2 : β) β’ ΞΈ = Ο β ΞΈ = (Ο / 2 : β) β¨ ΞΈ = (-Ο / 2 : β) := by
have h : (Ο : Angle) = ((2 : β) β’ (Ο / 2 : β) :) := by rw [two_nsmul, add_halves]
nth_rw 1 [h]
rw [coe_nsmul, two_nsmul_eq_iff]
-- Porting note: `congr` didn't simplify the goal of iff of `Or`s
convert Iff.rfl
rw [add_comm, β coe_add, β sub_eq_zero, β coe_sub, neg_div, β neg_sub, sub_neg_eq_add, add_assoc,
add_halves, β two_mul, coe_neg, coe_two_pi, neg_zero]
#align real.angle.two_nsmul_eq_pi_iff Real.Angle.two_nsmul_eq_pi_iff
theorem two_zsmul_eq_pi_iff {ΞΈ : Angle} : (2 : β€) β’ ΞΈ = Ο β ΞΈ = (Ο / 2 : β) β¨ ΞΈ = (-Ο / 2 : β) := by
rw [two_zsmul, β two_nsmul, two_nsmul_eq_pi_iff]
#align real.angle.two_zsmul_eq_pi_iff Real.Angle.two_zsmul_eq_pi_iff
theorem cos_eq_iff_coe_eq_or_eq_neg {ΞΈ Ο : β} :
cos ΞΈ = cos Ο β (ΞΈ : Angle) = Ο β¨ (ΞΈ : Angle) = -Ο := by
constructor
Β· intro Hcos
rw [β sub_eq_zero, cos_sub_cos, mul_eq_zero, mul_eq_zero, neg_eq_zero,
eq_false (two_ne_zero' β), false_or_iff, sin_eq_zero_iff, sin_eq_zero_iff] at Hcos
rcases Hcos with (β¨n, hnβ© | β¨n, hnβ©)
Β· right
rw [eq_div_iff_mul_eq (two_ne_zero' β), β sub_eq_iff_eq_add] at hn
rw [β hn, coe_sub, eq_neg_iff_add_eq_zero, sub_add_cancel, mul_assoc, intCast_mul_eq_zsmul,
mul_comm, coe_two_pi, zsmul_zero]
Β· left
rw [eq_div_iff_mul_eq (two_ne_zero' β), eq_sub_iff_add_eq] at hn
rw [β hn, coe_add, mul_assoc, intCast_mul_eq_zsmul, mul_comm, coe_two_pi, zsmul_zero,
zero_add]
Β· rw [angle_eq_iff_two_pi_dvd_sub, β coe_neg, angle_eq_iff_two_pi_dvd_sub]
rintro (β¨k, Hβ© | β¨k, Hβ©)
Β· rw [β sub_eq_zero, cos_sub_cos, H, mul_assoc 2 Ο k, mul_div_cancel_leftβ _ (two_ne_zero' β),
mul_comm Ο _, sin_int_mul_pi, mul_zero]
rw [β sub_eq_zero, cos_sub_cos, β sub_neg_eq_add, H, mul_assoc 2 Ο k,
mul_div_cancel_leftβ _ (two_ne_zero' β), mul_comm Ο _, sin_int_mul_pi, mul_zero,
zero_mul]
#align real.angle.cos_eq_iff_coe_eq_or_eq_neg Real.Angle.cos_eq_iff_coe_eq_or_eq_neg
theorem sin_eq_iff_coe_eq_or_add_eq_pi {ΞΈ Ο : β} :
sin ΞΈ = sin Ο β (ΞΈ : Angle) = Ο β¨ (ΞΈ : Angle) + Ο = Ο := by
constructor
Β· intro Hsin
rw [β cos_pi_div_two_sub, β cos_pi_div_two_sub] at Hsin
cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hsin with h h
Β· left
rw [coe_sub, coe_sub] at h
exact sub_right_inj.1 h
right
rw [coe_sub, coe_sub, eq_neg_iff_add_eq_zero, add_sub, sub_add_eq_add_sub, β coe_add,
add_halves, sub_sub, sub_eq_zero] at h
exact h.symm
Β· rw [angle_eq_iff_two_pi_dvd_sub, β eq_sub_iff_add_eq, β coe_sub, angle_eq_iff_two_pi_dvd_sub]
rintro (β¨k, Hβ© | β¨k, Hβ©)
Β· rw [β sub_eq_zero, sin_sub_sin, H, mul_assoc 2 Ο k, mul_div_cancel_leftβ _ (two_ne_zero' β),
mul_comm Ο _, sin_int_mul_pi, mul_zero, zero_mul]
have H' : ΞΈ + Ο = 2 * k * Ο + Ο := by
rwa [β sub_add, sub_add_eq_add_sub, sub_eq_iff_eq_add, mul_assoc, mul_comm Ο _, β
mul_assoc] at H
rw [β sub_eq_zero, sin_sub_sin, H', add_div, mul_assoc 2 _ Ο,
mul_div_cancel_leftβ _ (two_ne_zero' β), cos_add_pi_div_two, sin_int_mul_pi, neg_zero,
mul_zero]
#align real.angle.sin_eq_iff_coe_eq_or_add_eq_pi Real.Angle.sin_eq_iff_coe_eq_or_add_eq_pi
theorem cos_sin_inj {ΞΈ Ο : β} (Hcos : cos ΞΈ = cos Ο) (Hsin : sin ΞΈ = sin Ο) : (ΞΈ : Angle) = Ο := by
cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hcos with hc hc; Β· exact hc
cases' sin_eq_iff_coe_eq_or_add_eq_pi.mp Hsin with hs hs; Β· exact hs
rw [eq_neg_iff_add_eq_zero, hs] at hc
obtain β¨n, hnβ© : β n, n β’ _ = _ := QuotientAddGroup.leftRel_apply.mp (Quotient.exact' hc)
rw [β neg_one_mul, add_zero, β sub_eq_zero, zsmul_eq_mul, β mul_assoc, β sub_mul, mul_eq_zero,
eq_false (ne_of_gt pi_pos), or_false_iff, sub_neg_eq_add, β Int.cast_zero, β Int.cast_one,
β Int.cast_ofNat, β Int.cast_mul, β Int.cast_add, Int.cast_inj] at hn
have : (n * 2 + 1) % (2 : β€) = 0 % (2 : β€) := congr_arg (Β· % (2 : β€)) hn
rw [add_comm, Int.add_mul_emod_self] at this
exact absurd this one_ne_zero
#align real.angle.cos_sin_inj Real.Angle.cos_sin_inj
def sin (ΞΈ : Angle) : β :=
sin_periodic.lift ΞΈ
#align real.angle.sin Real.Angle.sin
@[simp]
theorem sin_coe (x : β) : sin (x : Angle) = Real.sin x :=
rfl
#align real.angle.sin_coe Real.Angle.sin_coe
@[continuity]
theorem continuous_sin : Continuous sin :=
Real.continuous_sin.quotient_liftOn' _
#align real.angle.continuous_sin Real.Angle.continuous_sin
def cos (ΞΈ : Angle) : β :=
cos_periodic.lift ΞΈ
#align real.angle.cos Real.Angle.cos
@[simp]
theorem cos_coe (x : β) : cos (x : Angle) = Real.cos x :=
rfl
#align real.angle.cos_coe Real.Angle.cos_coe
@[continuity]
theorem continuous_cos : Continuous cos :=
Real.continuous_cos.quotient_liftOn' _
#align real.angle.continuous_cos Real.Angle.continuous_cos
theorem cos_eq_real_cos_iff_eq_or_eq_neg {ΞΈ : Angle} {Ο : β} :
cos ΞΈ = Real.cos Ο β ΞΈ = Ο β¨ ΞΈ = -Ο := by
induction ΞΈ using Real.Angle.induction_on
exact cos_eq_iff_coe_eq_or_eq_neg
#align real.angle.cos_eq_real_cos_iff_eq_or_eq_neg Real.Angle.cos_eq_real_cos_iff_eq_or_eq_neg
theorem cos_eq_iff_eq_or_eq_neg {ΞΈ Ο : Angle} : cos ΞΈ = cos Ο β ΞΈ = Ο β¨ ΞΈ = -Ο := by
induction Ο using Real.Angle.induction_on
exact cos_eq_real_cos_iff_eq_or_eq_neg
#align real.angle.cos_eq_iff_eq_or_eq_neg Real.Angle.cos_eq_iff_eq_or_eq_neg
theorem sin_eq_real_sin_iff_eq_or_add_eq_pi {ΞΈ : Angle} {Ο : β} :
sin ΞΈ = Real.sin Ο β ΞΈ = Ο β¨ ΞΈ + Ο = Ο := by
induction ΞΈ using Real.Angle.induction_on
exact sin_eq_iff_coe_eq_or_add_eq_pi
#align real.angle.sin_eq_real_sin_iff_eq_or_add_eq_pi Real.Angle.sin_eq_real_sin_iff_eq_or_add_eq_pi
theorem sin_eq_iff_eq_or_add_eq_pi {ΞΈ Ο : Angle} : sin ΞΈ = sin Ο β ΞΈ = Ο β¨ ΞΈ + Ο = Ο := by
induction Ο using Real.Angle.induction_on
exact sin_eq_real_sin_iff_eq_or_add_eq_pi
#align real.angle.sin_eq_iff_eq_or_add_eq_pi Real.Angle.sin_eq_iff_eq_or_add_eq_pi
@[simp]
theorem sin_zero : sin (0 : Angle) = 0 := by rw [β coe_zero, sin_coe, Real.sin_zero]
#align real.angle.sin_zero Real.Angle.sin_zero
-- Porting note (#10618): @[simp] can prove it
theorem sin_coe_pi : sin (Ο : Angle) = 0 := by rw [sin_coe, Real.sin_pi]
#align real.angle.sin_coe_pi Real.Angle.sin_coe_pi
theorem sin_eq_zero_iff {ΞΈ : Angle} : sin ΞΈ = 0 β ΞΈ = 0 β¨ ΞΈ = Ο := by
nth_rw 1 [β sin_zero]
rw [sin_eq_iff_eq_or_add_eq_pi]
simp
#align real.angle.sin_eq_zero_iff Real.Angle.sin_eq_zero_iff
theorem sin_ne_zero_iff {ΞΈ : Angle} : sin ΞΈ β 0 β ΞΈ β 0 β§ ΞΈ β Ο := by
rw [β not_or, β sin_eq_zero_iff]
#align real.angle.sin_ne_zero_iff Real.Angle.sin_ne_zero_iff
@[simp]
theorem sin_neg (ΞΈ : Angle) : sin (-ΞΈ) = -sin ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.sin_neg _
#align real.angle.sin_neg Real.Angle.sin_neg
theorem sin_antiperiodic : Function.Antiperiodic sin (Ο : Angle) := by
intro ΞΈ
induction ΞΈ using Real.Angle.induction_on
exact Real.sin_antiperiodic _
#align real.angle.sin_antiperiodic Real.Angle.sin_antiperiodic
@[simp]
theorem sin_add_pi (ΞΈ : Angle) : sin (ΞΈ + Ο) = -sin ΞΈ :=
sin_antiperiodic ΞΈ
#align real.angle.sin_add_pi Real.Angle.sin_add_pi
@[simp]
theorem sin_sub_pi (ΞΈ : Angle) : sin (ΞΈ - Ο) = -sin ΞΈ :=
sin_antiperiodic.sub_eq ΞΈ
#align real.angle.sin_sub_pi Real.Angle.sin_sub_pi
@[simp]
theorem cos_zero : cos (0 : Angle) = 1 := by rw [β coe_zero, cos_coe, Real.cos_zero]
#align real.angle.cos_zero Real.Angle.cos_zero
-- Porting note (#10618): @[simp] can prove it
theorem cos_coe_pi : cos (Ο : Angle) = -1 := by rw [cos_coe, Real.cos_pi]
#align real.angle.cos_coe_pi Real.Angle.cos_coe_pi
@[simp]
theorem cos_neg (ΞΈ : Angle) : cos (-ΞΈ) = cos ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_neg _
#align real.angle.cos_neg Real.Angle.cos_neg
theorem cos_antiperiodic : Function.Antiperiodic cos (Ο : Angle) := by
intro ΞΈ
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_antiperiodic _
#align real.angle.cos_antiperiodic Real.Angle.cos_antiperiodic
@[simp]
theorem cos_add_pi (ΞΈ : Angle) : cos (ΞΈ + Ο) = -cos ΞΈ :=
cos_antiperiodic ΞΈ
#align real.angle.cos_add_pi Real.Angle.cos_add_pi
@[simp]
theorem cos_sub_pi (ΞΈ : Angle) : cos (ΞΈ - Ο) = -cos ΞΈ :=
cos_antiperiodic.sub_eq ΞΈ
#align real.angle.cos_sub_pi Real.Angle.cos_sub_pi
theorem cos_eq_zero_iff {ΞΈ : Angle} : cos ΞΈ = 0 β ΞΈ = (Ο / 2 : β) β¨ ΞΈ = (-Ο / 2 : β) := by
rw [β cos_pi_div_two, β cos_coe, cos_eq_iff_eq_or_eq_neg, β coe_neg, β neg_div]
#align real.angle.cos_eq_zero_iff Real.Angle.cos_eq_zero_iff
theorem sin_add (ΞΈβ ΞΈβ : Real.Angle) : sin (ΞΈβ + ΞΈβ) = sin ΞΈβ * cos ΞΈβ + cos ΞΈβ * sin ΞΈβ := by
induction ΞΈβ using Real.Angle.induction_on
induction ΞΈβ using Real.Angle.induction_on
exact Real.sin_add _ _
#align real.angle.sin_add Real.Angle.sin_add
theorem cos_add (ΞΈβ ΞΈβ : Real.Angle) : cos (ΞΈβ + ΞΈβ) = cos ΞΈβ * cos ΞΈβ - sin ΞΈβ * sin ΞΈβ := by
induction ΞΈβ using Real.Angle.induction_on
induction ΞΈβ using Real.Angle.induction_on
exact Real.cos_add _ _
#align real.angle.cos_add Real.Angle.cos_add
@[simp]
theorem cos_sq_add_sin_sq (ΞΈ : Real.Angle) : cos ΞΈ ^ 2 + sin ΞΈ ^ 2 = 1 := by
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_sq_add_sin_sq _
#align real.angle.cos_sq_add_sin_sq Real.Angle.cos_sq_add_sin_sq
theorem sin_add_pi_div_two (ΞΈ : Angle) : sin (ΞΈ + β(Ο / 2)) = cos ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.sin_add_pi_div_two _
#align real.angle.sin_add_pi_div_two Real.Angle.sin_add_pi_div_two
theorem sin_sub_pi_div_two (ΞΈ : Angle) : sin (ΞΈ - β(Ο / 2)) = -cos ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.sin_sub_pi_div_two _
#align real.angle.sin_sub_pi_div_two Real.Angle.sin_sub_pi_div_two
theorem sin_pi_div_two_sub (ΞΈ : Angle) : sin (β(Ο / 2) - ΞΈ) = cos ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.sin_pi_div_two_sub _
#align real.angle.sin_pi_div_two_sub Real.Angle.sin_pi_div_two_sub
theorem cos_add_pi_div_two (ΞΈ : Angle) : cos (ΞΈ + β(Ο / 2)) = -sin ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_add_pi_div_two _
#align real.angle.cos_add_pi_div_two Real.Angle.cos_add_pi_div_two
theorem cos_sub_pi_div_two (ΞΈ : Angle) : cos (ΞΈ - β(Ο / 2)) = sin ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_sub_pi_div_two _
#align real.angle.cos_sub_pi_div_two Real.Angle.cos_sub_pi_div_two
theorem cos_pi_div_two_sub (ΞΈ : Angle) : cos (β(Ο / 2) - ΞΈ) = sin ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact Real.cos_pi_div_two_sub _
#align real.angle.cos_pi_div_two_sub Real.Angle.cos_pi_div_two_sub
theorem abs_sin_eq_of_two_nsmul_eq {ΞΈ Ο : Angle} (h : (2 : β) β’ ΞΈ = (2 : β) β’ Ο) :
|sin ΞΈ| = |sin Ο| := by
rw [two_nsmul_eq_iff] at h
rcases h with (rfl | rfl)
Β· rfl
Β· rw [sin_add_pi, abs_neg]
#align real.angle.abs_sin_eq_of_two_nsmul_eq Real.Angle.abs_sin_eq_of_two_nsmul_eq
theorem abs_sin_eq_of_two_zsmul_eq {ΞΈ Ο : Angle} (h : (2 : β€) β’ ΞΈ = (2 : β€) β’ Ο) :
|sin ΞΈ| = |sin Ο| := by
simp_rw [two_zsmul, β two_nsmul] at h
exact abs_sin_eq_of_two_nsmul_eq h
#align real.angle.abs_sin_eq_of_two_zsmul_eq Real.Angle.abs_sin_eq_of_two_zsmul_eq
theorem abs_cos_eq_of_two_nsmul_eq {ΞΈ Ο : Angle} (h : (2 : β) β’ ΞΈ = (2 : β) β’ Ο) :
|cos ΞΈ| = |cos Ο| := by
rw [two_nsmul_eq_iff] at h
rcases h with (rfl | rfl)
Β· rfl
Β· rw [cos_add_pi, abs_neg]
#align real.angle.abs_cos_eq_of_two_nsmul_eq Real.Angle.abs_cos_eq_of_two_nsmul_eq
theorem abs_cos_eq_of_two_zsmul_eq {ΞΈ Ο : Angle} (h : (2 : β€) β’ ΞΈ = (2 : β€) β’ Ο) :
|cos ΞΈ| = |cos Ο| := by
simp_rw [two_zsmul, β two_nsmul] at h
exact abs_cos_eq_of_two_nsmul_eq h
#align real.angle.abs_cos_eq_of_two_zsmul_eq Real.Angle.abs_cos_eq_of_two_zsmul_eq
@[simp]
theorem coe_toIcoMod (ΞΈ Ο : β) : β(toIcoMod two_pi_pos Ο ΞΈ) = (ΞΈ : Angle) := by
rw [angle_eq_iff_two_pi_dvd_sub]
refine β¨-toIcoDiv two_pi_pos Ο ΞΈ, ?_β©
rw [toIcoMod_sub_self, zsmul_eq_mul, mul_comm]
#align real.angle.coe_to_Ico_mod Real.Angle.coe_toIcoMod
@[simp]
theorem coe_toIocMod (ΞΈ Ο : β) : β(toIocMod two_pi_pos Ο ΞΈ) = (ΞΈ : Angle) := by
rw [angle_eq_iff_two_pi_dvd_sub]
refine β¨-toIocDiv two_pi_pos Ο ΞΈ, ?_β©
rw [toIocMod_sub_self, zsmul_eq_mul, mul_comm]
#align real.angle.coe_to_Ioc_mod Real.Angle.coe_toIocMod
def toReal (ΞΈ : Angle) : β :=
(toIocMod_periodic two_pi_pos (-Ο)).lift ΞΈ
#align real.angle.to_real Real.Angle.toReal
theorem toReal_coe (ΞΈ : β) : (ΞΈ : Angle).toReal = toIocMod two_pi_pos (-Ο) ΞΈ :=
rfl
#align real.angle.to_real_coe Real.Angle.toReal_coe
theorem toReal_coe_eq_self_iff {ΞΈ : β} : (ΞΈ : Angle).toReal = ΞΈ β -Ο < ΞΈ β§ ΞΈ β€ Ο := by
rw [toReal_coe, toIocMod_eq_self two_pi_pos]
ring_nf
rfl
#align real.angle.to_real_coe_eq_self_iff Real.Angle.toReal_coe_eq_self_iff
theorem toReal_coe_eq_self_iff_mem_Ioc {ΞΈ : β} : (ΞΈ : Angle).toReal = ΞΈ β ΞΈ β Set.Ioc (-Ο) Ο := by
rw [toReal_coe_eq_self_iff, β Set.mem_Ioc]
#align real.angle.to_real_coe_eq_self_iff_mem_Ioc Real.Angle.toReal_coe_eq_self_iff_mem_Ioc
theorem toReal_injective : Function.Injective toReal := by
intro ΞΈ Ο h
induction ΞΈ using Real.Angle.induction_on
induction Ο using Real.Angle.induction_on
simpa [toReal_coe, toIocMod_eq_toIocMod, zsmul_eq_mul, mul_comm _ (2 * Ο), β
angle_eq_iff_two_pi_dvd_sub, eq_comm] using h
#align real.angle.to_real_injective Real.Angle.toReal_injective
@[simp]
theorem toReal_inj {ΞΈ Ο : Angle} : ΞΈ.toReal = Ο.toReal β ΞΈ = Ο :=
toReal_injective.eq_iff
#align real.angle.to_real_inj Real.Angle.toReal_inj
@[simp]
theorem coe_toReal (ΞΈ : Angle) : (ΞΈ.toReal : Angle) = ΞΈ := by
induction ΞΈ using Real.Angle.induction_on
exact coe_toIocMod _ _
#align real.angle.coe_to_real Real.Angle.coe_toReal
theorem neg_pi_lt_toReal (ΞΈ : Angle) : -Ο < ΞΈ.toReal := by
induction ΞΈ using Real.Angle.induction_on
exact left_lt_toIocMod _ _ _
#align real.angle.neg_pi_lt_to_real Real.Angle.neg_pi_lt_toReal
theorem toReal_le_pi (ΞΈ : Angle) : ΞΈ.toReal β€ Ο := by
induction ΞΈ using Real.Angle.induction_on
convert toIocMod_le_right two_pi_pos _ _
ring
#align real.angle.to_real_le_pi Real.Angle.toReal_le_pi
theorem abs_toReal_le_pi (ΞΈ : Angle) : |ΞΈ.toReal| β€ Ο :=
abs_le.2 β¨(neg_pi_lt_toReal _).le, toReal_le_pi _β©
#align real.angle.abs_to_real_le_pi Real.Angle.abs_toReal_le_pi
theorem toReal_mem_Ioc (ΞΈ : Angle) : ΞΈ.toReal β Set.Ioc (-Ο) Ο :=
β¨neg_pi_lt_toReal _, toReal_le_pi _β©
#align real.angle.to_real_mem_Ioc Real.Angle.toReal_mem_Ioc
@[simp]
theorem toIocMod_toReal (ΞΈ : Angle) : toIocMod two_pi_pos (-Ο) ΞΈ.toReal = ΞΈ.toReal := by
induction ΞΈ using Real.Angle.induction_on
rw [toReal_coe]
exact toIocMod_toIocMod _ _ _ _
#align real.angle.to_Ioc_mod_to_real Real.Angle.toIocMod_toReal
@[simp]
theorem toReal_zero : (0 : Angle).toReal = 0 := by
rw [β coe_zero, toReal_coe_eq_self_iff]
exact β¨Left.neg_neg_iff.2 Real.pi_pos, Real.pi_pos.leβ©
#align real.angle.to_real_zero Real.Angle.toReal_zero
@[simp]
theorem toReal_eq_zero_iff {ΞΈ : Angle} : ΞΈ.toReal = 0 β ΞΈ = 0 := by
nth_rw 1 [β toReal_zero]
exact toReal_inj
#align real.angle.to_real_eq_zero_iff Real.Angle.toReal_eq_zero_iff
@[simp]
theorem toReal_pi : (Ο : Angle).toReal = Ο := by
rw [toReal_coe_eq_self_iff]
exact β¨Left.neg_lt_self Real.pi_pos, le_refl _β©
#align real.angle.to_real_pi Real.Angle.toReal_pi
@[simp]
theorem toReal_eq_pi_iff {ΞΈ : Angle} : ΞΈ.toReal = Ο β ΞΈ = Ο := by rw [β toReal_inj, toReal_pi]
#align real.angle.to_real_eq_pi_iff Real.Angle.toReal_eq_pi_iff
theorem pi_ne_zero : (Ο : Angle) β 0 := by
rw [β toReal_injective.ne_iff, toReal_pi, toReal_zero]
exact Real.pi_ne_zero
#align real.angle.pi_ne_zero Real.Angle.pi_ne_zero
@[simp]
theorem toReal_pi_div_two : ((Ο / 2 : β) : Angle).toReal = Ο / 2 :=
toReal_coe_eq_self_iff.2 <| by constructor <;> linarith [pi_pos]
#align real.angle.to_real_pi_div_two Real.Angle.toReal_pi_div_two
@[simp]
theorem toReal_eq_pi_div_two_iff {ΞΈ : Angle} : ΞΈ.toReal = Ο / 2 β ΞΈ = (Ο / 2 : β) := by
rw [β toReal_inj, toReal_pi_div_two]
#align real.angle.to_real_eq_pi_div_two_iff Real.Angle.toReal_eq_pi_div_two_iff
@[simp]
theorem toReal_neg_pi_div_two : ((-Ο / 2 : β) : Angle).toReal = -Ο / 2 :=
toReal_coe_eq_self_iff.2 <| by constructor <;> linarith [pi_pos]
#align real.angle.to_real_neg_pi_div_two Real.Angle.toReal_neg_pi_div_two
@[simp]
theorem toReal_eq_neg_pi_div_two_iff {ΞΈ : Angle} : ΞΈ.toReal = -Ο / 2 β ΞΈ = (-Ο / 2 : β) := by
rw [β toReal_inj, toReal_neg_pi_div_two]
#align real.angle.to_real_eq_neg_pi_div_two_iff Real.Angle.toReal_eq_neg_pi_div_two_iff
theorem pi_div_two_ne_zero : ((Ο / 2 : β) : Angle) β 0 := by
rw [β toReal_injective.ne_iff, toReal_pi_div_two, toReal_zero]
exact div_ne_zero Real.pi_ne_zero two_ne_zero
#align real.angle.pi_div_two_ne_zero Real.Angle.pi_div_two_ne_zero
theorem neg_pi_div_two_ne_zero : ((-Ο / 2 : β) : Angle) β 0 := by
rw [β toReal_injective.ne_iff, toReal_neg_pi_div_two, toReal_zero]
exact div_ne_zero (neg_ne_zero.2 Real.pi_ne_zero) two_ne_zero
#align real.angle.neg_pi_div_two_ne_zero Real.Angle.neg_pi_div_two_ne_zero
theorem abs_toReal_coe_eq_self_iff {ΞΈ : β} : |(ΞΈ : Angle).toReal| = ΞΈ β 0 β€ ΞΈ β§ ΞΈ β€ Ο :=
β¨fun h => h βΈ β¨abs_nonneg _, abs_toReal_le_pi _β©, fun h =>
(toReal_coe_eq_self_iff.2 β¨(Left.neg_neg_iff.2 Real.pi_pos).trans_le h.1, h.2β©).symm βΈ
abs_eq_self.2 h.1β©
#align real.angle.abs_to_real_coe_eq_self_iff Real.Angle.abs_toReal_coe_eq_self_iff
theorem abs_toReal_neg_coe_eq_self_iff {ΞΈ : β} : |(-ΞΈ : Angle).toReal| = ΞΈ β 0 β€ ΞΈ β§ ΞΈ β€ Ο := by
refine β¨fun h => h βΈ β¨abs_nonneg _, abs_toReal_le_pi _β©, fun h => ?_β©
by_cases hnegpi : ΞΈ = Ο; Β· simp [hnegpi, Real.pi_pos.le]
rw [β coe_neg,
toReal_coe_eq_self_iff.2
β¨neg_lt_neg (lt_of_le_of_ne h.2 hnegpi), (neg_nonpos.2 h.1).trans Real.pi_pos.leβ©,
abs_neg, abs_eq_self.2 h.1]
#align real.angle.abs_to_real_neg_coe_eq_self_iff Real.Angle.abs_toReal_neg_coe_eq_self_iff
theorem abs_toReal_eq_pi_div_two_iff {ΞΈ : Angle} :
|ΞΈ.toReal| = Ο / 2 β ΞΈ = (Ο / 2 : β) β¨ ΞΈ = (-Ο / 2 : β) := by
rw [abs_eq (div_nonneg Real.pi_pos.le two_pos.le), β neg_div, toReal_eq_pi_div_two_iff,
toReal_eq_neg_pi_div_two_iff]
#align real.angle.abs_to_real_eq_pi_div_two_iff Real.Angle.abs_toReal_eq_pi_div_two_iff
theorem nsmul_toReal_eq_mul {n : β} (h : n β 0) {ΞΈ : Angle} :
(n β’ ΞΈ).toReal = n * ΞΈ.toReal β ΞΈ.toReal β Set.Ioc (-Ο / n) (Ο / n) := by
nth_rw 1 [β coe_toReal ΞΈ]
have h' : 0 < (n : β) := mod_cast Nat.pos_of_ne_zero h
rw [β coe_nsmul, nsmul_eq_mul, toReal_coe_eq_self_iff, Set.mem_Ioc, div_lt_iff' h',
le_div_iff' h']
#align real.angle.nsmul_to_real_eq_mul Real.Angle.nsmul_toReal_eq_mul
theorem two_nsmul_toReal_eq_two_mul {ΞΈ : Angle} :
((2 : β) β’ ΞΈ).toReal = 2 * ΞΈ.toReal β ΞΈ.toReal β Set.Ioc (-Ο / 2) (Ο / 2) :=
mod_cast nsmul_toReal_eq_mul two_ne_zero
#align real.angle.two_nsmul_to_real_eq_two_mul Real.Angle.two_nsmul_toReal_eq_two_mul
theorem two_zsmul_toReal_eq_two_mul {ΞΈ : Angle} :
((2 : β€) β’ ΞΈ).toReal = 2 * ΞΈ.toReal β ΞΈ.toReal β Set.Ioc (-Ο / 2) (Ο / 2) := by
rw [two_zsmul, β two_nsmul, two_nsmul_toReal_eq_two_mul]
#align real.angle.two_zsmul_to_real_eq_two_mul Real.Angle.two_zsmul_toReal_eq_two_mul
theorem toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff {ΞΈ : β} {k : β€} :
(ΞΈ : Angle).toReal = ΞΈ - 2 * k * Ο β ΞΈ β Set.Ioc ((2 * k - 1 : β) * Ο) ((2 * k + 1) * Ο) := by
rw [β sub_zero (ΞΈ : Angle), β zsmul_zero k, β coe_two_pi, β coe_zsmul, β coe_sub, zsmul_eq_mul, β
mul_assoc, mul_comm (k : β), toReal_coe_eq_self_iff, Set.mem_Ioc]
exact β¨fun h => β¨by linarith, by linarithβ©, fun h => β¨by linarith, by linarithβ©β©
#align real.angle.to_real_coe_eq_self_sub_two_mul_int_mul_pi_iff Real.Angle.toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff
theorem toReal_coe_eq_self_sub_two_pi_iff {ΞΈ : β} :
(ΞΈ : Angle).toReal = ΞΈ - 2 * Ο β ΞΈ β Set.Ioc Ο (3 * Ο) := by
convert @toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff ΞΈ 1 <;> norm_num
#align real.angle.to_real_coe_eq_self_sub_two_pi_iff Real.Angle.toReal_coe_eq_self_sub_two_pi_iff
theorem toReal_coe_eq_self_add_two_pi_iff {ΞΈ : β} :
(ΞΈ : Angle).toReal = ΞΈ + 2 * Ο β ΞΈ β Set.Ioc (-3 * Ο) (-Ο) := by
convert @toReal_coe_eq_self_sub_two_mul_int_mul_pi_iff ΞΈ (-1) using 2 <;>
set_option tactic.skipAssignedInstances false in norm_num
#align real.angle.to_real_coe_eq_self_add_two_pi_iff Real.Angle.toReal_coe_eq_self_add_two_pi_iff
theorem two_nsmul_toReal_eq_two_mul_sub_two_pi {ΞΈ : Angle} :
((2 : β) β’ ΞΈ).toReal = 2 * ΞΈ.toReal - 2 * Ο β Ο / 2 < ΞΈ.toReal := by
nth_rw 1 [β coe_toReal ΞΈ]
rw [β coe_nsmul, two_nsmul, β two_mul, toReal_coe_eq_self_sub_two_pi_iff, Set.mem_Ioc]
exact
β¨fun h => by linarith, fun h =>
β¨(div_lt_iff' (zero_lt_two' β)).1 h, by linarith [pi_pos, toReal_le_pi ΞΈ]β©β©
#align real.angle.two_nsmul_to_real_eq_two_mul_sub_two_pi Real.Angle.two_nsmul_toReal_eq_two_mul_sub_two_pi
theorem two_zsmul_toReal_eq_two_mul_sub_two_pi {ΞΈ : Angle} :
((2 : β€) β’ ΞΈ).toReal = 2 * ΞΈ.toReal - 2 * Ο β Ο / 2 < ΞΈ.toReal := by
rw [two_zsmul, β two_nsmul, two_nsmul_toReal_eq_two_mul_sub_two_pi]
#align real.angle.two_zsmul_to_real_eq_two_mul_sub_two_pi Real.Angle.two_zsmul_toReal_eq_two_mul_sub_two_pi
theorem two_nsmul_toReal_eq_two_mul_add_two_pi {ΞΈ : Angle} :
((2 : β) β’ ΞΈ).toReal = 2 * ΞΈ.toReal + 2 * Ο β ΞΈ.toReal β€ -Ο / 2 := by
nth_rw 1 [β coe_toReal ΞΈ]
rw [β coe_nsmul, two_nsmul, β two_mul, toReal_coe_eq_self_add_two_pi_iff, Set.mem_Ioc]
refine
β¨fun h => by linarith, fun h =>
β¨by linarith [pi_pos, neg_pi_lt_toReal ΞΈ], (le_div_iff' (zero_lt_two' β)).1 hβ©β©
#align real.angle.two_nsmul_to_real_eq_two_mul_add_two_pi Real.Angle.two_nsmul_toReal_eq_two_mul_add_two_pi
theorem two_zsmul_toReal_eq_two_mul_add_two_pi {ΞΈ : Angle} :
((2 : β€) β’ ΞΈ).toReal = 2 * ΞΈ.toReal + 2 * Ο β ΞΈ.toReal β€ -Ο / 2 := by
rw [two_zsmul, β two_nsmul, two_nsmul_toReal_eq_two_mul_add_two_pi]
#align real.angle.two_zsmul_to_real_eq_two_mul_add_two_pi Real.Angle.two_zsmul_toReal_eq_two_mul_add_two_pi
@[simp]
theorem sin_toReal (ΞΈ : Angle) : Real.sin ΞΈ.toReal = sin ΞΈ := by
conv_rhs => rw [β coe_toReal ΞΈ, sin_coe]
#align real.angle.sin_to_real Real.Angle.sin_toReal
@[simp]
theorem cos_toReal (ΞΈ : Angle) : Real.cos ΞΈ.toReal = cos ΞΈ := by
conv_rhs => rw [β coe_toReal ΞΈ, cos_coe]
#align real.angle.cos_to_real Real.Angle.cos_toReal
theorem cos_nonneg_iff_abs_toReal_le_pi_div_two {ΞΈ : Angle} : 0 β€ cos ΞΈ β |ΞΈ.toReal| β€ Ο / 2 := by
nth_rw 1 [β coe_toReal ΞΈ]
rw [abs_le, cos_coe]
refine β¨fun h => ?_, cos_nonneg_of_mem_Iccβ©
by_contra hn
rw [not_and_or, not_le, not_le] at hn
refine (not_lt.2 h) ?_
rcases hn with (hn | hn)
Β· rw [β Real.cos_neg]
refine cos_neg_of_pi_div_two_lt_of_lt (by linarith) ?_
linarith [neg_pi_lt_toReal ΞΈ]
Β· refine cos_neg_of_pi_div_two_lt_of_lt hn ?_
linarith [toReal_le_pi ΞΈ]
#align real.angle.cos_nonneg_iff_abs_to_real_le_pi_div_two Real.Angle.cos_nonneg_iff_abs_toReal_le_pi_div_two
theorem cos_pos_iff_abs_toReal_lt_pi_div_two {ΞΈ : Angle} : 0 < cos ΞΈ β |ΞΈ.toReal| < Ο / 2 := by
rw [lt_iff_le_and_ne, lt_iff_le_and_ne, cos_nonneg_iff_abs_toReal_le_pi_div_two, β
and_congr_right]
rintro -
rw [Ne, Ne, not_iff_not, @eq_comm β 0, abs_toReal_eq_pi_div_two_iff, cos_eq_zero_iff]
#align real.angle.cos_pos_iff_abs_to_real_lt_pi_div_two Real.Angle.cos_pos_iff_abs_toReal_lt_pi_div_two
theorem cos_neg_iff_pi_div_two_lt_abs_toReal {ΞΈ : Angle} : cos ΞΈ < 0 β Ο / 2 < |ΞΈ.toReal| := by
rw [β not_le, β not_le, not_iff_not, cos_nonneg_iff_abs_toReal_le_pi_div_two]
#align real.angle.cos_neg_iff_pi_div_two_lt_abs_to_real Real.Angle.cos_neg_iff_pi_div_two_lt_abs_toReal
theorem abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi {ΞΈ Ο : Angle}
(h : (2 : β) β’ ΞΈ + (2 : β) β’ Ο = Ο) : |cos ΞΈ| = |sin Ο| := by
rw [β eq_sub_iff_add_eq, β two_nsmul_coe_div_two, β nsmul_sub, two_nsmul_eq_iff] at h
rcases h with (rfl | rfl) <;> simp [cos_pi_div_two_sub]
#align real.angle.abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi Real.Angle.abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi
theorem abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi {ΞΈ Ο : Angle}
(h : (2 : β€) β’ ΞΈ + (2 : β€) β’ Ο = Ο) : |cos ΞΈ| = |sin Ο| := by
simp_rw [two_zsmul, β two_nsmul] at h
exact abs_cos_eq_abs_sin_of_two_nsmul_add_two_nsmul_eq_pi h
#align real.angle.abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi Real.Angle.abs_cos_eq_abs_sin_of_two_zsmul_add_two_zsmul_eq_pi
def tan (ΞΈ : Angle) : β :=
sin ΞΈ / cos ΞΈ
#align real.angle.tan Real.Angle.tan
theorem tan_eq_sin_div_cos (ΞΈ : Angle) : tan ΞΈ = sin ΞΈ / cos ΞΈ :=
rfl
#align real.angle.tan_eq_sin_div_cos Real.Angle.tan_eq_sin_div_cos
@[simp]
theorem tan_coe (x : β) : tan (x : Angle) = Real.tan x := by
rw [tan, sin_coe, cos_coe, Real.tan_eq_sin_div_cos]
#align real.angle.tan_coe Real.Angle.tan_coe
@[simp]
theorem tan_zero : tan (0 : Angle) = 0 := by rw [β coe_zero, tan_coe, Real.tan_zero]
#align real.angle.tan_zero Real.Angle.tan_zero
-- Porting note (#10618): @[simp] can now prove it
theorem tan_coe_pi : tan (Ο : Angle) = 0 := by rw [tan_coe, Real.tan_pi]
#align real.angle.tan_coe_pi Real.Angle.tan_coe_pi
theorem tan_periodic : Function.Periodic tan (Ο : Angle) := by
intro ΞΈ
induction ΞΈ using Real.Angle.induction_on
rw [β coe_add, tan_coe, tan_coe]
exact Real.tan_periodic _
#align real.angle.tan_periodic Real.Angle.tan_periodic
@[simp]
theorem tan_add_pi (ΞΈ : Angle) : tan (ΞΈ + Ο) = tan ΞΈ :=
tan_periodic ΞΈ
#align real.angle.tan_add_pi Real.Angle.tan_add_pi
@[simp]
theorem tan_sub_pi (ΞΈ : Angle) : tan (ΞΈ - Ο) = tan ΞΈ :=
tan_periodic.sub_eq ΞΈ
#align real.angle.tan_sub_pi Real.Angle.tan_sub_pi
@[simp]
theorem tan_toReal (ΞΈ : Angle) : Real.tan ΞΈ.toReal = tan ΞΈ := by
conv_rhs => rw [β coe_toReal ΞΈ, tan_coe]
#align real.angle.tan_to_real Real.Angle.tan_toReal
theorem tan_eq_of_two_nsmul_eq {ΞΈ Ο : Angle} (h : (2 : β) β’ ΞΈ = (2 : β) β’ Ο) : tan ΞΈ = tan Ο := by
rw [two_nsmul_eq_iff] at h
rcases h with (rfl | rfl)
Β· rfl
Β· exact tan_add_pi _
#align real.angle.tan_eq_of_two_nsmul_eq Real.Angle.tan_eq_of_two_nsmul_eq
theorem tan_eq_of_two_zsmul_eq {ΞΈ Ο : Angle} (h : (2 : β€) β’ ΞΈ = (2 : β€) β’ Ο) : tan ΞΈ = tan Ο := by
simp_rw [two_zsmul, β two_nsmul] at h
exact tan_eq_of_two_nsmul_eq h
#align real.angle.tan_eq_of_two_zsmul_eq Real.Angle.tan_eq_of_two_zsmul_eq
theorem tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi {ΞΈ Ο : Angle}
(h : (2 : β) β’ ΞΈ + (2 : β) β’ Ο = Ο) : tan Ο = (tan ΞΈ)β»ΒΉ := by
induction ΞΈ using Real.Angle.induction_on
induction Ο using Real.Angle.induction_on
rw [β smul_add, β coe_add, β coe_nsmul, two_nsmul, β two_mul, angle_eq_iff_two_pi_dvd_sub] at h
rcases h with β¨k, hβ©
rw [sub_eq_iff_eq_add, β mul_inv_cancel_leftβ two_ne_zero Ο, mul_assoc, β mul_add,
mul_right_inj' (two_ne_zero' β), β eq_sub_iff_add_eq', mul_inv_cancel_leftβ two_ne_zero Ο,
inv_mul_eq_div, mul_comm] at h
rw [tan_coe, tan_coe, β tan_pi_div_two_sub, h, add_sub_assoc, add_comm]
exact Real.tan_periodic.int_mul _ _
#align real.angle.tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi Real.Angle.tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi
theorem tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi {ΞΈ Ο : Angle}
(h : (2 : β€) β’ ΞΈ + (2 : β€) β’ Ο = Ο) : tan Ο = (tan ΞΈ)β»ΒΉ := by
simp_rw [two_zsmul, β two_nsmul] at h
exact tan_eq_inv_of_two_nsmul_add_two_nsmul_eq_pi h
#align real.angle.tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi Real.Angle.tan_eq_inv_of_two_zsmul_add_two_zsmul_eq_pi
def sign (ΞΈ : Angle) : SignType :=
SignType.sign (sin ΞΈ)
#align real.angle.sign Real.Angle.sign
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean | 858 | 859 | theorem sign_zero : (0 : Angle).sign = 0 := by |
rw [sign, sin_zero, _root_.sign_zero]
|
import Mathlib.Data.List.Sigma
#align_import data.list.alist from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb"
universe u v w
open List
variable {Ξ± : Type u} {Ξ² : Ξ± β Type v}
structure AList (Ξ² : Ξ± β Type v) : Type max u v where
entries : List (Sigma Ξ²)
nodupKeys : entries.NodupKeys
#align alist AList
def List.toAList [DecidableEq Ξ±] {Ξ² : Ξ± β Type v} (l : List (Sigma Ξ²)) : AList Ξ² where
entries := _
nodupKeys := nodupKeys_dedupKeys l
#align list.to_alist List.toAList
namespace AList
@[ext]
theorem ext : β {s t : AList Ξ²}, s.entries = t.entries β s = t
| β¨lβ, hββ©, β¨lβ, _β©, H => by congr
#align alist.ext AList.ext
theorem ext_iff {s t : AList Ξ²} : s = t β s.entries = t.entries :=
β¨congr_arg _, extβ©
#align alist.ext_iff AList.ext_iff
instance [DecidableEq Ξ±] [β a, DecidableEq (Ξ² a)] : DecidableEq (AList Ξ²) := fun xs ys => by
rw [ext_iff]; infer_instance
def keys (s : AList Ξ²) : List Ξ± :=
s.entries.keys
#align alist.keys AList.keys
theorem keys_nodup (s : AList Ξ²) : s.keys.Nodup :=
s.nodupKeys
#align alist.keys_nodup AList.keys_nodup
instance : Membership Ξ± (AList Ξ²) :=
β¨fun a s => a β s.keysβ©
theorem mem_keys {a : Ξ±} {s : AList Ξ²} : a β s β a β s.keys :=
Iff.rfl
#align alist.mem_keys AList.mem_keys
theorem mem_of_perm {a : Ξ±} {sβ sβ : AList Ξ²} (p : sβ.entries ~ sβ.entries) : a β sβ β a β sβ :=
(p.map Sigma.fst).mem_iff
#align alist.mem_of_perm AList.mem_of_perm
instance : EmptyCollection (AList Ξ²) :=
β¨β¨[], nodupKeys_nilβ©β©
instance : Inhabited (AList Ξ²) :=
β¨β
β©
@[simp]
theorem not_mem_empty (a : Ξ±) : a β (β
: AList Ξ²) :=
not_mem_nil a
#align alist.not_mem_empty AList.not_mem_empty
@[simp]
theorem empty_entries : (β
: AList Ξ²).entries = [] :=
rfl
#align alist.empty_entries AList.empty_entries
@[simp]
theorem keys_empty : (β
: AList Ξ²).keys = [] :=
rfl
#align alist.keys_empty AList.keys_empty
def singleton (a : Ξ±) (b : Ξ² a) : AList Ξ² :=
β¨[β¨a, bβ©], nodupKeys_singleton _β©
#align alist.singleton AList.singleton
@[simp]
theorem singleton_entries (a : Ξ±) (b : Ξ² a) : (singleton a b).entries = [Sigma.mk a b] :=
rfl
#align alist.singleton_entries AList.singleton_entries
@[simp]
theorem keys_singleton (a : Ξ±) (b : Ξ² a) : (singleton a b).keys = [a] :=
rfl
#align alist.keys_singleton AList.keys_singleton
section
variable [DecidableEq Ξ±]
def lookup (a : Ξ±) (s : AList Ξ²) : Option (Ξ² a) :=
s.entries.dlookup a
#align alist.lookup AList.lookup
@[simp]
theorem lookup_empty (a) : lookup a (β
: AList Ξ²) = none :=
rfl
#align alist.lookup_empty AList.lookup_empty
theorem lookup_isSome {a : Ξ±} {s : AList Ξ²} : (s.lookup a).isSome β a β s :=
dlookup_isSome
#align alist.lookup_is_some AList.lookup_isSome
theorem lookup_eq_none {a : Ξ±} {s : AList Ξ²} : lookup a s = none β a β s :=
dlookup_eq_none
#align alist.lookup_eq_none AList.lookup_eq_none
theorem mem_lookup_iff {a : Ξ±} {b : Ξ² a} {s : AList Ξ²} :
b β lookup a s β Sigma.mk a b β s.entries :=
mem_dlookup_iff s.nodupKeys
#align alist.mem_lookup_iff AList.mem_lookup_iff
theorem perm_lookup {a : Ξ±} {sβ sβ : AList Ξ²} (p : sβ.entries ~ sβ.entries) :
sβ.lookup a = sβ.lookup a :=
perm_dlookup _ sβ.nodupKeys sβ.nodupKeys p
#align alist.perm_lookup AList.perm_lookup
instance (a : Ξ±) (s : AList Ξ²) : Decidable (a β s) :=
decidable_of_iff _ lookup_isSome
theorem keys_subset_keys_of_entries_subset_entries
{sβ sβ : AList Ξ²} (h : sβ.entries β sβ.entries) : sβ.keys β sβ.keys := by
intro k hk
letI : DecidableEq Ξ± := Classical.decEq Ξ±
have := h (mem_lookup_iff.1 (Option.get_mem (lookup_isSome.2 hk)))
rw [β mem_lookup_iff, Option.mem_def] at this
rw [β mem_keys, β lookup_isSome, this]
exact Option.isSome_some
def replace (a : Ξ±) (b : Ξ² a) (s : AList Ξ²) : AList Ξ² :=
β¨kreplace a b s.entries, (kreplace_nodupKeys a b).2 s.nodupKeysβ©
#align alist.replace AList.replace
@[simp]
theorem keys_replace (a : Ξ±) (b : Ξ² a) (s : AList Ξ²) : (replace a b s).keys = s.keys :=
keys_kreplace _ _ _
#align alist.keys_replace AList.keys_replace
@[simp]
theorem mem_replace {a a' : Ξ±} {b : Ξ² a} {s : AList Ξ²} : a' β replace a b s β a' β s := by
rw [mem_keys, keys_replace, β mem_keys]
#align alist.mem_replace AList.mem_replace
theorem perm_replace {a : Ξ±} {b : Ξ² a} {sβ sβ : AList Ξ²} :
sβ.entries ~ sβ.entries β (replace a b sβ).entries ~ (replace a b sβ).entries :=
Perm.kreplace sβ.nodupKeys
#align alist.perm_replace AList.perm_replace
end
def foldl {Ξ΄ : Type w} (f : Ξ΄ β β a, Ξ² a β Ξ΄) (d : Ξ΄) (m : AList Ξ²) : Ξ΄ :=
m.entries.foldl (fun r a => f r a.1 a.2) d
#align alist.foldl AList.foldl
section
variable [DecidableEq Ξ±]
def erase (a : Ξ±) (s : AList Ξ²) : AList Ξ² :=
β¨s.entries.kerase a, s.nodupKeys.kerase aβ©
#align alist.erase AList.erase
@[simp]
theorem keys_erase (a : Ξ±) (s : AList Ξ²) : (erase a s).keys = s.keys.erase a :=
keys_kerase
#align alist.keys_erase AList.keys_erase
@[simp]
theorem mem_erase {a a' : Ξ±} {s : AList Ξ²} : a' β erase a s β a' β a β§ a' β s := by
rw [mem_keys, keys_erase, s.keys_nodup.mem_erase_iff, β mem_keys]
#align alist.mem_erase AList.mem_erase
theorem perm_erase {a : Ξ±} {sβ sβ : AList Ξ²} :
sβ.entries ~ sβ.entries β (erase a sβ).entries ~ (erase a sβ).entries :=
Perm.kerase sβ.nodupKeys
#align alist.perm_erase AList.perm_erase
@[simp]
theorem lookup_erase (a) (s : AList Ξ²) : lookup a (erase a s) = none :=
dlookup_kerase a s.nodupKeys
#align alist.lookup_erase AList.lookup_erase
@[simp]
theorem lookup_erase_ne {a a'} {s : AList Ξ²} (h : a β a') : lookup a (erase a' s) = lookup a s :=
dlookup_kerase_ne h
#align alist.lookup_erase_ne AList.lookup_erase_ne
theorem erase_erase (a a' : Ξ±) (s : AList Ξ²) : (s.erase a).erase a' = (s.erase a').erase a :=
ext <| kerase_kerase
#align alist.erase_erase AList.erase_erase
def insert (a : Ξ±) (b : Ξ² a) (s : AList Ξ²) : AList Ξ² :=
β¨kinsert a b s.entries, kinsert_nodupKeys a b s.nodupKeysβ©
#align alist.insert AList.insert
@[simp]
theorem insert_entries {a} {b : Ξ² a} {s : AList Ξ²} :
(insert a b s).entries = Sigma.mk a b :: kerase a s.entries :=
rfl
#align alist.insert_entries AList.insert_entries
theorem insert_entries_of_neg {a} {b : Ξ² a} {s : AList Ξ²} (h : a β s) :
(insert a b s).entries = β¨a, bβ© :: s.entries := by rw [insert_entries, kerase_of_not_mem_keys h]
#align alist.insert_entries_of_neg AList.insert_entries_of_neg
-- Todo: rename to `insert_of_not_mem`.
theorem insert_of_neg {a} {b : Ξ² a} {s : AList Ξ²} (h : a β s) :
insert a b s = β¨β¨a, bβ© :: s.entries, nodupKeys_cons.2 β¨h, s.2β©β© :=
ext <| insert_entries_of_neg h
#align alist.insert_of_neg AList.insert_of_neg
@[simp]
theorem insert_empty (a) (b : Ξ² a) : insert a b β
= singleton a b :=
rfl
#align alist.insert_empty AList.insert_empty
@[simp]
theorem mem_insert {a a'} {b' : Ξ² a'} (s : AList Ξ²) : a β insert a' b' s β a = a' β¨ a β s :=
mem_keys_kinsert
#align alist.mem_insert AList.mem_insert
@[simp]
theorem keys_insert {a} {b : Ξ² a} (s : AList Ξ²) : (insert a b s).keys = a :: s.keys.erase a := by
simp [insert, keys, keys_kerase]
#align alist.keys_insert AList.keys_insert
theorem perm_insert {a} {b : Ξ² a} {sβ sβ : AList Ξ²} (p : sβ.entries ~ sβ.entries) :
(insert a b sβ).entries ~ (insert a b sβ).entries := by
simp only [insert_entries]; exact p.kinsert sβ.nodupKeys
#align alist.perm_insert AList.perm_insert
@[simp]
theorem lookup_insert {a} {b : Ξ² a} (s : AList Ξ²) : lookup a (insert a b s) = some b := by
simp only [lookup, insert, dlookup_kinsert]
#align alist.lookup_insert AList.lookup_insert
@[simp]
theorem lookup_insert_ne {a a'} {b' : Ξ² a'} {s : AList Ξ²} (h : a β a') :
lookup a (insert a' b' s) = lookup a s :=
dlookup_kinsert_ne h
#align alist.lookup_insert_ne AList.lookup_insert_ne
@[simp] theorem lookup_insert_eq_none {l : AList Ξ²} {k k' : Ξ±} {v : Ξ² k} :
(l.insert k v).lookup k' = none β (k' β k) β§ l.lookup k' = none := by
by_cases h : k' = k
Β· subst h; simp
Β· simp_all [lookup_insert_ne h]
@[simp]
theorem lookup_to_alist {a} (s : List (Sigma Ξ²)) : lookup a s.toAList = s.dlookup a := by
rw [List.toAList, lookup, dlookup_dedupKeys]
#align alist.lookup_to_alist AList.lookup_to_alist
@[simp]
| Mathlib/Data/List/AList.lean | 332 | 334 | theorem insert_insert {a} {b b' : Ξ² a} (s : AList Ξ²) :
(s.insert a b).insert a b' = s.insert a b' := by |
ext : 1; simp only [AList.insert_entries, List.kerase_cons_eq]
|
import Mathlib.Probability.Variance
#align_import probability.moments from "leanprover-community/mathlib"@"85453a2a14be8da64caf15ca50930cf4c6e5d8de"
open MeasureTheory Filter Finset Real
noncomputable section
open scoped MeasureTheory ProbabilityTheory ENNReal NNReal
namespace ProbabilityTheory
variable {Ξ© ΞΉ : Type*} {m : MeasurableSpace Ξ©} {X : Ξ© β β} {p : β} {ΞΌ : Measure Ξ©}
def moment (X : Ξ© β β) (p : β) (ΞΌ : Measure Ξ©) : β :=
ΞΌ[X ^ p]
#align probability_theory.moment ProbabilityTheory.moment
def centralMoment (X : Ξ© β β) (p : β) (ΞΌ : Measure Ξ©) : β := by
have m := fun (x : Ξ©) => ΞΌ[X] -- Porting note: Lean deems `ΞΌ[(X - fun x => ΞΌ[X]) ^ p]` ambiguous
exact ΞΌ[(X - m) ^ p]
#align probability_theory.central_moment ProbabilityTheory.centralMoment
@[simp]
theorem moment_zero (hp : p β 0) : moment 0 p ΞΌ = 0 := by
simp only [moment, hp, zero_pow, Ne, not_false_iff, Pi.zero_apply, integral_const,
smul_eq_mul, mul_zero, integral_zero]
#align probability_theory.moment_zero ProbabilityTheory.moment_zero
@[simp]
theorem centralMoment_zero (hp : p β 0) : centralMoment 0 p ΞΌ = 0 := by
simp only [centralMoment, hp, Pi.zero_apply, integral_const, smul_eq_mul,
mul_zero, zero_sub, Pi.pow_apply, Pi.neg_apply, neg_zero, zero_pow, Ne, not_false_iff]
#align probability_theory.central_moment_zero ProbabilityTheory.centralMoment_zero
theorem centralMoment_one' [IsFiniteMeasure ΞΌ] (h_int : Integrable X ΞΌ) :
centralMoment X 1 ΞΌ = (1 - (ΞΌ Set.univ).toReal) * ΞΌ[X] := by
simp only [centralMoment, Pi.sub_apply, pow_one]
rw [integral_sub h_int (integrable_const _)]
simp only [sub_mul, integral_const, smul_eq_mul, one_mul]
#align probability_theory.central_moment_one' ProbabilityTheory.centralMoment_one'
@[simp]
theorem centralMoment_one [IsProbabilityMeasure ΞΌ] : centralMoment X 1 ΞΌ = 0 := by
by_cases h_int : Integrable X ΞΌ
Β· rw [centralMoment_one' h_int]
simp only [measure_univ, ENNReal.one_toReal, sub_self, zero_mul]
Β· simp only [centralMoment, Pi.sub_apply, pow_one]
have : Β¬Integrable (fun x => X x - integral ΞΌ X) ΞΌ := by
refine fun h_sub => h_int ?_
have h_add : X = (fun x => X x - integral ΞΌ X) + fun _ => integral ΞΌ X := by ext1 x; simp
rw [h_add]
exact h_sub.add (integrable_const _)
rw [integral_undef this]
#align probability_theory.central_moment_one ProbabilityTheory.centralMoment_one
theorem centralMoment_two_eq_variance [IsFiniteMeasure ΞΌ] (hX : Memβp X 2 ΞΌ) :
centralMoment X 2 ΞΌ = variance X ΞΌ := by rw [hX.variance_eq]; rfl
#align probability_theory.central_moment_two_eq_variance ProbabilityTheory.centralMoment_two_eq_variance
section MomentGeneratingFunction
variable {t : β}
def mgf (X : Ξ© β β) (ΞΌ : Measure Ξ©) (t : β) : β :=
ΞΌ[fun Ο => exp (t * X Ο)]
#align probability_theory.mgf ProbabilityTheory.mgf
def cgf (X : Ξ© β β) (ΞΌ : Measure Ξ©) (t : β) : β :=
log (mgf X ΞΌ t)
#align probability_theory.cgf ProbabilityTheory.cgf
@[simp]
theorem mgf_zero_fun : mgf 0 ΞΌ t = (ΞΌ Set.univ).toReal := by
simp only [mgf, Pi.zero_apply, mul_zero, exp_zero, integral_const, smul_eq_mul, mul_one]
#align probability_theory.mgf_zero_fun ProbabilityTheory.mgf_zero_fun
@[simp]
theorem cgf_zero_fun : cgf 0 ΞΌ t = log (ΞΌ Set.univ).toReal := by simp only [cgf, mgf_zero_fun]
#align probability_theory.cgf_zero_fun ProbabilityTheory.cgf_zero_fun
@[simp]
theorem mgf_zero_measure : mgf X (0 : Measure Ξ©) t = 0 := by simp only [mgf, integral_zero_measure]
#align probability_theory.mgf_zero_measure ProbabilityTheory.mgf_zero_measure
@[simp]
theorem cgf_zero_measure : cgf X (0 : Measure Ξ©) t = 0 := by
simp only [cgf, log_zero, mgf_zero_measure]
#align probability_theory.cgf_zero_measure ProbabilityTheory.cgf_zero_measure
@[simp]
theorem mgf_const' (c : β) : mgf (fun _ => c) ΞΌ t = (ΞΌ Set.univ).toReal * exp (t * c) := by
simp only [mgf, integral_const, smul_eq_mul]
#align probability_theory.mgf_const' ProbabilityTheory.mgf_const'
-- @[simp] -- Porting note: `simp only` already proves this
theorem mgf_const (c : β) [IsProbabilityMeasure ΞΌ] : mgf (fun _ => c) ΞΌ t = exp (t * c) := by
simp only [mgf_const', measure_univ, ENNReal.one_toReal, one_mul]
#align probability_theory.mgf_const ProbabilityTheory.mgf_const
@[simp]
theorem cgf_const' [IsFiniteMeasure ΞΌ] (hΞΌ : ΞΌ β 0) (c : β) :
cgf (fun _ => c) ΞΌ t = log (ΞΌ Set.univ).toReal + t * c := by
simp only [cgf, mgf_const']
rw [log_mul _ (exp_pos _).ne']
Β· rw [log_exp _]
Β· rw [Ne, ENNReal.toReal_eq_zero_iff, Measure.measure_univ_eq_zero]
simp only [hΞΌ, measure_ne_top ΞΌ Set.univ, or_self_iff, not_false_iff]
#align probability_theory.cgf_const' ProbabilityTheory.cgf_const'
@[simp]
theorem cgf_const [IsProbabilityMeasure ΞΌ] (c : β) : cgf (fun _ => c) ΞΌ t = t * c := by
simp only [cgf, mgf_const, log_exp]
#align probability_theory.cgf_const ProbabilityTheory.cgf_const
@[simp]
theorem mgf_zero' : mgf X ΞΌ 0 = (ΞΌ Set.univ).toReal := by
simp only [mgf, zero_mul, exp_zero, integral_const, smul_eq_mul, mul_one]
#align probability_theory.mgf_zero' ProbabilityTheory.mgf_zero'
-- @[simp] -- Porting note: `simp only` already proves this
theorem mgf_zero [IsProbabilityMeasure ΞΌ] : mgf X ΞΌ 0 = 1 := by
simp only [mgf_zero', measure_univ, ENNReal.one_toReal]
#align probability_theory.mgf_zero ProbabilityTheory.mgf_zero
@[simp]
theorem cgf_zero' : cgf X ΞΌ 0 = log (ΞΌ Set.univ).toReal := by simp only [cgf, mgf_zero']
#align probability_theory.cgf_zero' ProbabilityTheory.cgf_zero'
-- @[simp] -- Porting note: `simp only` already proves this
theorem cgf_zero [IsProbabilityMeasure ΞΌ] : cgf X ΞΌ 0 = 0 := by
simp only [cgf_zero', measure_univ, ENNReal.one_toReal, log_one]
#align probability_theory.cgf_zero ProbabilityTheory.cgf_zero
| Mathlib/Probability/Moments.lean | 174 | 175 | theorem mgf_undef (hX : Β¬Integrable (fun Ο => exp (t * X Ο)) ΞΌ) : mgf X ΞΌ t = 0 := by |
simp only [mgf, integral_undef hX]
|
import Mathlib.Data.List.Chain
import Mathlib.Data.List.Enum
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Pairwise
import Mathlib.Data.List.Zip
#align_import data.list.range from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
set_option autoImplicit true
universe u
open Nat
namespace List
variable {Ξ± : Type u}
@[simp] theorem range'_one {step} : range' s 1 step = [s] := rfl
#align list.length_range' List.length_range'
#align list.range'_eq_nil List.range'_eq_nil
#align list.mem_range' List.mem_range'_1
#align list.map_add_range' List.map_add_range'
#align list.map_sub_range' List.map_sub_range'
#align list.chain_succ_range' List.chain_succ_range'
#align list.chain_lt_range' List.chain_lt_range'
theorem pairwise_lt_range' : β s n (step := 1) (_ : 0 < step := by simp),
Pairwise (Β· < Β·) (range' s n step)
| _, 0, _, _ => Pairwise.nil
| s, n + 1, _, h => chain_iff_pairwise.1 (chain_lt_range' s n h)
#align list.pairwise_lt_range' List.pairwise_lt_range'
theorem nodup_range' (s n : β) (step := 1) (h : 0 < step := by simp) : Nodup (range' s n step) :=
(pairwise_lt_range' s n step h).imp _root_.ne_of_lt
#align list.nodup_range' List.nodup_range'
#align list.range'_append List.range'_append
#align list.range'_sublist_right List.range'_sublist_right
#align list.range'_subset_right List.range'_subset_right
#align list.nth_range' List.get?_range'
set_option linter.deprecated false in
@[simp]
theorem nthLe_range' {n m step} (i) (H : i < (range' n m step).length) :
nthLe (range' n m step) i H = n + step * i := get_range' i H
set_option linter.deprecated false in
theorem nthLe_range'_1 {n m} (i) (H : i < (range' n m).length) :
nthLe (range' n m) i H = n + i := by simp
#align list.nth_le_range' List.nthLe_range'_1
#align list.range'_concat List.range'_concat
#align list.range_core List.range.loop
#align list.range_core_range' List.range_loop_range'
#align list.range_eq_range' List.range_eq_range'
#align list.range_succ_eq_map List.range_succ_eq_map
#align list.range'_eq_map_range List.range'_eq_map_range
#align list.length_range List.length_range
#align list.range_eq_nil List.range_eq_nil
theorem pairwise_lt_range (n : β) : Pairwise (Β· < Β·) (range n) := by
simp (config := {decide := true}) only [range_eq_range', pairwise_lt_range']
#align list.pairwise_lt_range List.pairwise_lt_range
theorem pairwise_le_range (n : β) : Pairwise (Β· β€ Β·) (range n) :=
Pairwise.imp (@le_of_lt β _) (pairwise_lt_range _)
#align list.pairwise_le_range List.pairwise_le_range
theorem take_range (m n : β) : take m (range n) = range (min m n) := by
apply List.ext_get
Β· simp
Β· simp (config := { contextual := true }) [β get_take, Nat.lt_min]
theorem nodup_range (n : β) : Nodup (range n) := by
simp (config := {decide := true}) only [range_eq_range', nodup_range']
#align list.nodup_range List.nodup_range
#align list.range_sublist List.range_sublist
#align list.range_subset List.range_subset
#align list.mem_range List.mem_range
#align list.not_mem_range_self List.not_mem_range_self
#align list.self_mem_range_succ List.self_mem_range_succ
#align list.nth_range List.get?_range
#align list.range_succ List.range_succ
#align list.range_zero List.range_zero
theorem chain'_range_succ (r : β β β β Prop) (n : β) :
Chain' r (range n.succ) β β m < n, r m m.succ := by
rw [range_succ]
induction' n with n hn
Β· simp
Β· rw [range_succ]
simp only [append_assoc, singleton_append, chain'_append_cons_cons, chain'_singleton,
and_true_iff]
rw [hn, forall_lt_succ]
#align list.chain'_range_succ List.chain'_range_succ
theorem chain_range_succ (r : β β β β Prop) (n a : β) :
Chain r a (range n.succ) β r a 0 β§ β m < n, r m m.succ := by
rw [range_succ_eq_map, chain_cons, and_congr_right_iff, β chain'_range_succ, range_succ_eq_map]
exact fun _ => Iff.rfl
#align list.chain_range_succ List.chain_range_succ
#align list.range_add List.range_add
#align list.iota_eq_reverse_range' List.iota_eq_reverse_range'
#align list.length_iota List.length_iota
theorem pairwise_gt_iota (n : β) : Pairwise (Β· > Β·) (iota n) := by
simpa only [iota_eq_reverse_range', pairwise_reverse] using pairwise_lt_range' 1 n
#align list.pairwise_gt_iota List.pairwise_gt_iota
theorem nodup_iota (n : β) : Nodup (iota n) :=
(pairwise_gt_iota n).imp _root_.ne_of_gt
#align list.nodup_iota List.nodup_iota
#align list.mem_iota List.mem_iota
#align list.reverse_range' List.reverse_range'
def finRange (n : β) : List (Fin n) :=
(range n).pmap Fin.mk fun _ => List.mem_range.1
#align list.fin_range List.finRange
@[simp]
theorem finRange_zero : finRange 0 = [] :=
rfl
#align list.fin_range_zero List.finRange_zero
@[simp]
theorem mem_finRange {n : β} (a : Fin n) : a β finRange n :=
mem_pmap.2
β¨a.1, mem_range.2 a.2, by
cases a
rflβ©
#align list.mem_fin_range List.mem_finRange
theorem nodup_finRange (n : β) : (finRange n).Nodup :=
(Pairwise.pmap (nodup_range n) _) fun _ _ _ _ => @Fin.ne_of_vne _ β¨_, _β© β¨_, _β©
#align list.nodup_fin_range List.nodup_finRange
@[simp]
theorem length_finRange (n : β) : (finRange n).length = n := by
rw [finRange, length_pmap, length_range]
#align list.length_fin_range List.length_finRange
@[simp]
theorem finRange_eq_nil {n : β} : finRange n = [] β n = 0 := by
rw [β length_eq_zero, length_finRange]
#align list.fin_range_eq_nil List.finRange_eq_nil
theorem pairwise_lt_finRange (n : β) : Pairwise (Β· < Β·) (finRange n) :=
(List.pairwise_lt_range n).pmap (by simp) (by simp)
theorem pairwise_le_finRange (n : β) : Pairwise (Β· β€ Β·) (finRange n) :=
(List.pairwise_le_range n).pmap (by simp) (by simp)
#align list.enum_from_map_fst List.enumFrom_map_fst
#align list.enum_map_fst List.enum_map_fst
theorem enum_eq_zip_range (l : List Ξ±) : l.enum = (range l.length).zip l :=
zip_of_prod (enum_map_fst _) (enum_map_snd _)
#align list.enum_eq_zip_range List.enum_eq_zip_range
@[simp]
theorem unzip_enum_eq_prod (l : List Ξ±) : l.enum.unzip = (range l.length, l) := by
simp only [enum_eq_zip_range, unzip_zip, length_range]
#align list.unzip_enum_eq_prod List.unzip_enum_eq_prod
theorem enumFrom_eq_zip_range' (l : List Ξ±) {n : β} : l.enumFrom n = (range' n l.length).zip l :=
zip_of_prod (enumFrom_map_fst _ _) (enumFrom_map_snd _ _)
#align list.enum_from_eq_zip_range' List.enumFrom_eq_zip_range'
@[simp]
theorem unzip_enumFrom_eq_prod (l : List Ξ±) {n : β} :
(l.enumFrom n).unzip = (range' n l.length, l) := by
simp only [enumFrom_eq_zip_range', unzip_zip, length_range']
#align list.unzip_enum_from_eq_prod List.unzip_enumFrom_eq_prod
set_option linter.deprecated false in
@[simp]
theorem nthLe_range {n} (i) (H : i < (range n).length) : nthLe (range n) i H = i :=
get_range i H
#align list.nth_le_range List.nthLe_range
-- Porting note (#10756): new theorem
@[simp]
| Mathlib/Data/List/Range.lean | 204 | 206 | theorem get_finRange {n : β} {i : β} (h) :
(finRange n).get β¨i, hβ© = β¨i, length_finRange n βΈ hβ© := by |
simp only [finRange, get_range, get_pmap]
|
import Mathlib.Order.Heyting.Basic
#align_import order.boolean_algebra from "leanprover-community/mathlib"@"9ac7c0c8c4d7a535ec3e5b34b8859aab9233b2f4"
open Function OrderDual
universe u v
variable {Ξ± : Type u} {Ξ² : Type*} {w x y z : Ξ±}
class GeneralizedBooleanAlgebra (Ξ± : Type u) extends DistribLattice Ξ±, SDiff Ξ±, Bot Ξ± where
sup_inf_sdiff : β a b : Ξ±, a β b β a \ b = a
inf_inf_sdiff : β a b : Ξ±, a β b β a \ b = β₯
#align generalized_boolean_algebra GeneralizedBooleanAlgebra
-- We might want an `IsCompl_of` predicate (for relative complements) generalizing `IsCompl`,
-- however we'd need another type class for lattices with bot, and all the API for that.
section GeneralizedBooleanAlgebra
variable [GeneralizedBooleanAlgebra Ξ±]
@[simp]
theorem sup_inf_sdiff (x y : Ξ±) : x β y β x \ y = x :=
GeneralizedBooleanAlgebra.sup_inf_sdiff _ _
#align sup_inf_sdiff sup_inf_sdiff
@[simp]
theorem inf_inf_sdiff (x y : Ξ±) : x β y β x \ y = β₯ :=
GeneralizedBooleanAlgebra.inf_inf_sdiff _ _
#align inf_inf_sdiff inf_inf_sdiff
@[simp]
theorem sup_sdiff_inf (x y : Ξ±) : x \ y β x β y = x := by rw [sup_comm, sup_inf_sdiff]
#align sup_sdiff_inf sup_sdiff_inf
@[simp]
theorem inf_sdiff_inf (x y : Ξ±) : x \ y β (x β y) = β₯ := by rw [inf_comm, inf_inf_sdiff]
#align inf_sdiff_inf inf_sdiff_inf
-- see Note [lower instance priority]
instance (priority := 100) GeneralizedBooleanAlgebra.toOrderBot : OrderBot Ξ± where
__ := GeneralizedBooleanAlgebra.toBot
bot_le a := by
rw [β inf_inf_sdiff a a, inf_assoc]
exact inf_le_left
#align generalized_boolean_algebra.to_order_bot GeneralizedBooleanAlgebra.toOrderBot
theorem disjoint_inf_sdiff : Disjoint (x β y) (x \ y) :=
disjoint_iff_inf_le.mpr (inf_inf_sdiff x y).le
#align disjoint_inf_sdiff disjoint_inf_sdiff
-- TODO: in distributive lattices, relative complements are unique when they exist
theorem sdiff_unique (s : x β y β z = x) (i : x β y β z = β₯) : x \ y = z := by
conv_rhs at s => rw [β sup_inf_sdiff x y, sup_comm]
rw [sup_comm] at s
conv_rhs at i => rw [β inf_inf_sdiff x y, inf_comm]
rw [inf_comm] at i
exact (eq_of_inf_eq_sup_eq i s).symm
#align sdiff_unique sdiff_unique
-- Use `sdiff_le`
private theorem sdiff_le' : x \ y β€ x :=
calc
x \ y β€ x β y β x \ y := le_sup_right
_ = x := sup_inf_sdiff x y
-- Use `sdiff_sup_self`
private theorem sdiff_sup_self' : y \ x β x = y β x :=
calc
y \ x β x = y \ x β (x β x β y) := by rw [sup_inf_self]
_ = y β x β y \ x β x := by ac_rfl
_ = y β x := by rw [sup_inf_sdiff]
@[simp]
theorem sdiff_inf_sdiff : x \ y β y \ x = β₯ :=
Eq.symm <|
calc
β₯ = x β y β x \ y := by rw [inf_inf_sdiff]
_ = x β (y β x β y \ x) β x \ y := by rw [sup_inf_sdiff]
_ = (x β (y β x) β x β y \ x) β x \ y := by rw [inf_sup_left]
_ = (y β (x β x) β x β y \ x) β x \ y := by ac_rfl
_ = (y β x β x β y \ x) β x \ y := by rw [inf_idem]
_ = x β y β x \ y β x β y \ x β x \ y := by rw [inf_sup_right, inf_comm x y]
_ = x β y \ x β x \ y := by rw [inf_inf_sdiff, bot_sup_eq]
_ = x β x \ y β y \ x := by ac_rfl
_ = x \ y β y \ x := by rw [inf_of_le_right sdiff_le']
#align sdiff_inf_sdiff sdiff_inf_sdiff
theorem disjoint_sdiff_sdiff : Disjoint (x \ y) (y \ x) :=
disjoint_iff_inf_le.mpr sdiff_inf_sdiff.le
#align disjoint_sdiff_sdiff disjoint_sdiff_sdiff
@[simp]
theorem inf_sdiff_self_right : x β y \ x = β₯ :=
calc
x β y \ x = (x β y β x \ y) β y \ x := by rw [sup_inf_sdiff]
_ = x β y β y \ x β x \ y β y \ x := by rw [inf_sup_right]
_ = β₯ := by rw [inf_comm x y, inf_inf_sdiff, sdiff_inf_sdiff, bot_sup_eq]
#align inf_sdiff_self_right inf_sdiff_self_right
@[simp]
theorem inf_sdiff_self_left : y \ x β x = β₯ := by rw [inf_comm, inf_sdiff_self_right]
#align inf_sdiff_self_left inf_sdiff_self_left
-- see Note [lower instance priority]
instance (priority := 100) GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra :
GeneralizedCoheytingAlgebra Ξ± where
__ := βΉGeneralizedBooleanAlgebra Ξ±βΊ
__ := GeneralizedBooleanAlgebra.toOrderBot
sdiff := (Β· \ Β·)
sdiff_le_iff y x z :=
β¨fun h =>
le_of_inf_le_sup_le
(le_of_eq
(calc
y β y \ x = y \ x := inf_of_le_right sdiff_le'
_ = x β y \ x β z β y \ x := by
rw [inf_eq_right.2 h, inf_sdiff_self_right, bot_sup_eq]
_ = (x β z) β y \ x := by rw [β inf_sup_right]))
(calc
y β y \ x = y := sup_of_le_left sdiff_le'
_ β€ y β (x β z) := le_sup_left
_ = y \ x β x β z := by rw [β sup_assoc, β @sdiff_sup_self' _ x y]
_ = x β z β y \ x := by ac_rfl),
fun h =>
le_of_inf_le_sup_le
(calc
y \ x β x = β₯ := inf_sdiff_self_left
_ β€ z β x := bot_le)
(calc
y \ x β x = y β x := sdiff_sup_self'
_ β€ x β z β x := sup_le_sup_right h x
_ β€ z β x := by rw [sup_assoc, sup_comm, sup_assoc, sup_idem])β©
#align generalized_boolean_algebra.to_generalized_coheyting_algebra GeneralizedBooleanAlgebra.toGeneralizedCoheytingAlgebra
theorem disjoint_sdiff_self_left : Disjoint (y \ x) x :=
disjoint_iff_inf_le.mpr inf_sdiff_self_left.le
#align disjoint_sdiff_self_left disjoint_sdiff_self_left
theorem disjoint_sdiff_self_right : Disjoint x (y \ x) :=
disjoint_iff_inf_le.mpr inf_sdiff_self_right.le
#align disjoint_sdiff_self_right disjoint_sdiff_self_right
lemma le_sdiff : x β€ y \ z β x β€ y β§ Disjoint x z :=
β¨fun h β¦ β¨h.trans sdiff_le, disjoint_sdiff_self_left.mono_left hβ©, fun h β¦
by rw [β h.2.sdiff_eq_left]; exact sdiff_le_sdiff_right h.1β©
#align le_sdiff le_sdiff
@[simp] lemma sdiff_eq_left : x \ y = x β Disjoint x y :=
β¨fun h β¦ disjoint_sdiff_self_left.mono_left h.ge, Disjoint.sdiff_eq_leftβ©
#align sdiff_eq_left sdiff_eq_left
theorem Disjoint.sdiff_eq_of_sup_eq (hi : Disjoint x z) (hs : x β z = y) : y \ x = z :=
have h : y β x = x := inf_eq_right.2 <| le_sup_left.trans hs.le
sdiff_unique (by rw [h, hs]) (by rw [h, hi.eq_bot])
#align disjoint.sdiff_eq_of_sup_eq Disjoint.sdiff_eq_of_sup_eq
protected theorem Disjoint.sdiff_unique (hd : Disjoint x z) (hz : z β€ y) (hs : y β€ x β z) :
y \ x = z :=
sdiff_unique
(by
rw [β inf_eq_right] at hs
rwa [sup_inf_right, inf_sup_right, sup_comm x, inf_sup_self, inf_comm, sup_comm z,
hs, sup_eq_left])
(by rw [inf_assoc, hd.eq_bot, inf_bot_eq])
#align disjoint.sdiff_unique Disjoint.sdiff_unique
-- cf. `IsCompl.disjoint_left_iff` and `IsCompl.disjoint_right_iff`
theorem disjoint_sdiff_iff_le (hz : z β€ y) (hx : x β€ y) : Disjoint z (y \ x) β z β€ x :=
β¨fun H =>
le_of_inf_le_sup_le (le_trans H.le_bot bot_le)
(by
rw [sup_sdiff_cancel_right hx]
refine le_trans (sup_le_sup_left sdiff_le z) ?_
rw [sup_eq_right.2 hz]),
fun H => disjoint_sdiff_self_right.mono_left Hβ©
#align disjoint_sdiff_iff_le disjoint_sdiff_iff_le
-- cf. `IsCompl.le_left_iff` and `IsCompl.le_right_iff`
theorem le_iff_disjoint_sdiff (hz : z β€ y) (hx : x β€ y) : z β€ x β Disjoint z (y \ x) :=
(disjoint_sdiff_iff_le hz hx).symm
#align le_iff_disjoint_sdiff le_iff_disjoint_sdiff
-- cf. `IsCompl.inf_left_eq_bot_iff` and `IsCompl.inf_right_eq_bot_iff`
theorem inf_sdiff_eq_bot_iff (hz : z β€ y) (hx : x β€ y) : z β y \ x = β₯ β z β€ x := by
rw [β disjoint_iff]
exact disjoint_sdiff_iff_le hz hx
#align inf_sdiff_eq_bot_iff inf_sdiff_eq_bot_iff
-- cf. `IsCompl.left_le_iff` and `IsCompl.right_le_iff`
theorem le_iff_eq_sup_sdiff (hz : z β€ y) (hx : x β€ y) : x β€ z β y = z β y \ x :=
β¨fun H => by
apply le_antisymm
Β· conv_lhs => rw [β sup_inf_sdiff y x]
apply sup_le_sup_right
rwa [inf_eq_right.2 hx]
Β· apply le_trans
Β· apply sup_le_sup_right hz
Β· rw [sup_sdiff_left],
fun H => by
conv_lhs at H => rw [β sup_sdiff_cancel_right hx]
refine le_of_inf_le_sup_le ?_ H.le
rw [inf_sdiff_self_right]
exact bot_leβ©
#align le_iff_eq_sup_sdiff le_iff_eq_sup_sdiff
-- cf. `IsCompl.sup_inf`
theorem sdiff_sup : y \ (x β z) = y \ x β y \ z :=
sdiff_unique
(calc
y β (x β z) β y \ x β y \ z = (y β (x β z) β y \ x) β (y β (x β z) β y \ z) := by
rw [sup_inf_left]
_ = (y β x β y β z β y \ x) β (y β x β y β z β y \ z) := by rw [@inf_sup_left _ _ y]
_ = (y β z β (y β x β y \ x)) β (y β x β (y β z β y \ z)) := by ac_rfl
_ = (y β z β y) β (y β x β y) := by rw [sup_inf_sdiff, sup_inf_sdiff]
_ = (y β y β z) β (y β y β x) := by ac_rfl
_ = y := by rw [sup_inf_self, sup_inf_self, inf_idem])
(calc
y β (x β z) β (y \ x β y \ z) = (y β x β y β z) β (y \ x β y \ z) := by rw [inf_sup_left]
_ = y β x β (y \ x β y \ z) β y β z β (y \ x β y \ z) := by rw [inf_sup_right]
_ = y β x β y \ x β y \ z β y \ x β (y \ z β (y β z)) := by ac_rfl
_ = β₯ := by rw [inf_inf_sdiff, bot_inf_eq, bot_sup_eq, inf_comm (y \ z),
inf_inf_sdiff, inf_bot_eq])
#align sdiff_sup sdiff_sup
theorem sdiff_eq_sdiff_iff_inf_eq_inf : y \ x = y \ z β y β x = y β z :=
β¨fun h => eq_of_inf_eq_sup_eq (by rw [inf_inf_sdiff, h, inf_inf_sdiff])
(by rw [sup_inf_sdiff, h, sup_inf_sdiff]),
fun h => by rw [β sdiff_inf_self_right, β sdiff_inf_self_right z y, inf_comm, h, inf_comm]β©
#align sdiff_eq_sdiff_iff_inf_eq_inf sdiff_eq_sdiff_iff_inf_eq_inf
theorem sdiff_eq_self_iff_disjoint : x \ y = x β Disjoint y x :=
calc
x \ y = x β x \ y = x \ β₯ := by rw [sdiff_bot]
_ β x β y = x β β₯ := sdiff_eq_sdiff_iff_inf_eq_inf
_ β Disjoint y x := by rw [inf_bot_eq, inf_comm, disjoint_iff]
#align sdiff_eq_self_iff_disjoint sdiff_eq_self_iff_disjoint
theorem sdiff_eq_self_iff_disjoint' : x \ y = x β Disjoint x y := by
rw [sdiff_eq_self_iff_disjoint, disjoint_comm]
#align sdiff_eq_self_iff_disjoint' sdiff_eq_self_iff_disjoint'
theorem sdiff_lt (hx : y β€ x) (hy : y β β₯) : x \ y < x := by
refine sdiff_le.lt_of_ne fun h => hy ?_
rw [sdiff_eq_self_iff_disjoint', disjoint_iff] at h
rw [β h, inf_eq_right.mpr hx]
#align sdiff_lt sdiff_lt
@[simp]
theorem le_sdiff_iff : x β€ y \ x β x = β₯ :=
β¨fun h => disjoint_self.1 (disjoint_sdiff_self_right.mono_right h), fun h => h.le.trans bot_leβ©
#align le_sdiff_iff le_sdiff_iff
@[simp] lemma sdiff_eq_right : x \ y = y β x = β₯ β§ y = β₯ := by
rw [disjoint_sdiff_self_left.eq_iff]; aesop
lemma sdiff_ne_right : x \ y β y β x β β₯ β¨ y β β₯ := sdiff_eq_right.not.trans not_and_or
theorem sdiff_lt_sdiff_right (h : x < y) (hz : z β€ x) : x \ z < y \ z :=
(sdiff_le_sdiff_right h.le).lt_of_not_le
fun h' => h.not_le <| le_sdiff_sup.trans <| sup_le_of_le_sdiff_right h' hz
#align sdiff_lt_sdiff_right sdiff_lt_sdiff_right
theorem sup_inf_inf_sdiff : x β y β z β y \ z = x β y β y \ z :=
calc
x β y β z β y \ z = x β (y β z) β y \ z := by rw [inf_assoc]
_ = (x β y \ z) β y := by rw [sup_inf_right, sup_inf_sdiff]
_ = x β y β y \ z := by rw [inf_sup_right, inf_sdiff_left]
#align sup_inf_inf_sdiff sup_inf_inf_sdiff
theorem sdiff_sdiff_right : x \ (y \ z) = x \ y β x β y β z := by
rw [sup_comm, inf_comm, β inf_assoc, sup_inf_inf_sdiff]
apply sdiff_unique
Β· calc
x β y \ z β (z β x β x \ y) = (x β (z β x β x \ y)) β (y \ z β (z β x β x \ y)) := by
rw [sup_inf_right]
_ = (x β x β z β x \ y) β (y \ z β (x β z β x \ y)) := by ac_rfl
_ = x β (y \ z β x β z β x \ y) := by rw [sup_inf_self, sup_sdiff_left, β sup_assoc]
_ = x β (y \ z β (z β y) β x β (z β y) β x \ y) := by
rw [sup_inf_left, sdiff_sup_self', inf_sup_right, sup_comm y]
_ = x β (y \ z β (x β z β x β y) β x \ y) := by
rw [inf_sdiff_sup_right, @inf_sup_left _ _ x z y]
_ = x β (y \ z β (x β z β (x β y β x \ y))) := by ac_rfl
_ = x β (y \ z β (x β x β z)) := by rw [sup_inf_sdiff, sup_comm (x β z)]
_ = x := by rw [sup_inf_self, sup_comm, inf_sup_self]
Β· calc
x β y \ z β (z β x β x \ y) = x β y \ z β (z β x) β x β y \ z β x \ y := by rw [inf_sup_left]
_ = x β (y \ z β z β x) β x β y \ z β x \ y := by ac_rfl
_ = x β y \ z β x \ y := by rw [inf_sdiff_self_left, bot_inf_eq, inf_bot_eq, bot_sup_eq]
_ = x β (y \ z β y) β x \ y := by conv_lhs => rw [β inf_sdiff_left]
_ = x β (y \ z β (y β x \ y)) := by ac_rfl
_ = β₯ := by rw [inf_sdiff_self_right, inf_bot_eq, inf_bot_eq]
#align sdiff_sdiff_right sdiff_sdiff_right
theorem sdiff_sdiff_right' : x \ (y \ z) = x \ y β x β z :=
calc
x \ (y \ z) = x \ y β x β y β z := sdiff_sdiff_right
_ = z β x β y β x \ y := by ac_rfl
_ = x \ y β x β z := by rw [sup_inf_inf_sdiff, sup_comm, inf_comm]
#align sdiff_sdiff_right' sdiff_sdiff_right'
theorem sdiff_sdiff_eq_sdiff_sup (h : z β€ x) : x \ (y \ z) = x \ y β z := by
rw [sdiff_sdiff_right', inf_eq_right.2 h]
#align sdiff_sdiff_eq_sdiff_sup sdiff_sdiff_eq_sdiff_sup
@[simp]
theorem sdiff_sdiff_right_self : x \ (x \ y) = x β y := by
rw [sdiff_sdiff_right, inf_idem, sdiff_self, bot_sup_eq]
#align sdiff_sdiff_right_self sdiff_sdiff_right_self
theorem sdiff_sdiff_eq_self (h : y β€ x) : x \ (x \ y) = y := by
rw [sdiff_sdiff_right_self, inf_of_le_right h]
#align sdiff_sdiff_eq_self sdiff_sdiff_eq_self
theorem sdiff_eq_symm (hy : y β€ x) (h : x \ y = z) : x \ z = y := by
rw [β h, sdiff_sdiff_eq_self hy]
#align sdiff_eq_symm sdiff_eq_symm
theorem sdiff_eq_comm (hy : y β€ x) (hz : z β€ x) : x \ y = z β x \ z = y :=
β¨sdiff_eq_symm hy, sdiff_eq_symm hzβ©
#align sdiff_eq_comm sdiff_eq_comm
theorem eq_of_sdiff_eq_sdiff (hxz : x β€ z) (hyz : y β€ z) (h : z \ x = z \ y) : x = y := by
rw [β sdiff_sdiff_eq_self hxz, h, sdiff_sdiff_eq_self hyz]
#align eq_of_sdiff_eq_sdiff eq_of_sdiff_eq_sdiff
theorem sdiff_sdiff_left' : (x \ y) \ z = x \ y β x \ z := by rw [sdiff_sdiff_left, sdiff_sup]
#align sdiff_sdiff_left' sdiff_sdiff_left'
theorem sdiff_sdiff_sup_sdiff : z \ (x \ y β y \ x) = z β (z \ x β y) β (z \ y β x) :=
calc
z \ (x \ y β y \ x) = (z \ x β z β x β y) β (z \ y β z β y β x) := by
rw [sdiff_sup, sdiff_sdiff_right, sdiff_sdiff_right]
_ = z β (z \ x β y) β (z \ y β z β y β x) := by rw [sup_inf_left, sup_comm, sup_inf_sdiff]
_ = z β (z \ x β y) β (z β (z \ y β x)) := by
rw [sup_inf_left, sup_comm (z \ y), sup_inf_sdiff]
_ = z β z β (z \ x β y) β (z \ y β x) := by ac_rfl
_ = z β (z \ x β y) β (z \ y β x) := by rw [inf_idem]
#align sdiff_sdiff_sup_sdiff sdiff_sdiff_sup_sdiff
theorem sdiff_sdiff_sup_sdiff' : z \ (x \ y β y \ x) = z β x β y β z \ x β z \ y :=
calc
z \ (x \ y β y \ x) = z \ (x \ y) β z \ (y \ x) := sdiff_sup
_ = (z \ x β z β x β y) β (z \ y β z β y β x) := by rw [sdiff_sdiff_right, sdiff_sdiff_right]
_ = (z \ x β z β y β x) β (z \ y β z β y β x) := by ac_rfl
_ = z \ x β z \ y β z β y β x := by rw [β sup_inf_right]
_ = z β x β y β z \ x β z \ y := by ac_rfl
#align sdiff_sdiff_sup_sdiff' sdiff_sdiff_sup_sdiff'
lemma sdiff_sdiff_sdiff_cancel_left (hca : z β€ x) : (x \ y) \ (x \ z) = z \ y :=
sdiff_sdiff_sdiff_le_sdiff.antisymm <|
(disjoint_sdiff_self_right.mono_left sdiff_le).le_sdiff_of_le_left <| sdiff_le_sdiff_right hca
lemma sdiff_sdiff_sdiff_cancel_right (hcb : z β€ y) : (x \ z) \ (y \ z) = x \ y := by
rw [le_antisymm_iff, sdiff_le_comm]
exact β¨sdiff_sdiff_sdiff_le_sdiff,
(disjoint_sdiff_self_left.mono_right sdiff_le).le_sdiff_of_le_left <| sdiff_le_sdiff_left hcbβ©
theorem inf_sdiff : (x β y) \ z = x \ z β y \ z :=
sdiff_unique
(calc
x β y β z β x \ z β y \ z = (x β y β z β x \ z) β (x β y β z β y \ z) := by rw [sup_inf_left]
_ = (x β y β (z β x) β x \ z) β (x β y β z β y \ z) := by
rw [sup_inf_right, sup_sdiff_self_right, inf_sup_right, inf_sdiff_sup_right]
_ = (y β (x β (x β z)) β x \ z) β (x β y β z β y \ z) := by ac_rfl
_ = (y β x β x \ z) β (x β y β y \ z) := by rw [inf_sup_self, sup_inf_inf_sdiff]
_ = x β y β x \ z β y \ z := by rw [inf_comm y, sup_inf_left]
_ = x β y := sup_eq_left.2 (inf_le_inf sdiff_le sdiff_le))
(calc
x β y β z β (x \ z β y \ z) = x β y β (z β x \ z) β y \ z := by ac_rfl
_ = β₯ := by rw [inf_sdiff_self_right, inf_bot_eq, bot_inf_eq])
#align inf_sdiff inf_sdiff
theorem inf_sdiff_assoc : (x β y) \ z = x β y \ z :=
sdiff_unique
(calc
x β y β z β x β y \ z = x β (y β z) β x β y \ z := by rw [inf_assoc]
_ = x β (y β z β y \ z) := by rw [β inf_sup_left]
_ = x β y := by rw [sup_inf_sdiff])
(calc
x β y β z β (x β y \ z) = x β x β (y β z β y \ z) := by ac_rfl
_ = β₯ := by rw [inf_inf_sdiff, inf_bot_eq])
#align inf_sdiff_assoc inf_sdiff_assoc
theorem inf_sdiff_right_comm : x \ z β y = (x β y) \ z := by
rw [inf_comm x, inf_comm, inf_sdiff_assoc]
#align inf_sdiff_right_comm inf_sdiff_right_comm
theorem inf_sdiff_distrib_left (a b c : Ξ±) : a β b \ c = (a β b) \ (a β c) := by
rw [sdiff_inf, sdiff_eq_bot_iff.2 inf_le_left, bot_sup_eq, inf_sdiff_assoc]
#align inf_sdiff_distrib_left inf_sdiff_distrib_left
theorem inf_sdiff_distrib_right (a b c : Ξ±) : a \ b β c = (a β c) \ (b β c) := by
simp_rw [inf_comm _ c, inf_sdiff_distrib_left]
#align inf_sdiff_distrib_right inf_sdiff_distrib_right
theorem disjoint_sdiff_comm : Disjoint (x \ z) y β Disjoint x (y \ z) := by
simp_rw [disjoint_iff, inf_sdiff_right_comm, inf_sdiff_assoc]
#align disjoint_sdiff_comm disjoint_sdiff_comm
| Mathlib/Order/BooleanAlgebra.lean | 477 | 483 | theorem sup_eq_sdiff_sup_sdiff_sup_inf : x β y = x \ y β y \ x β x β y :=
Eq.symm <|
calc
x \ y β y \ x β x β y = (x \ y β y \ x β x) β (x \ y β y \ x β y) := by | rw [sup_inf_left]
_ = (x \ y β x β y \ x) β (x \ y β (y \ x β y)) := by ac_rfl
_ = (x β y \ x) β (x \ y β y) := by rw [sup_sdiff_right, sup_sdiff_right]
_ = x β y := by rw [sup_sdiff_self_right, sup_sdiff_self_left, inf_idem]
|
import Mathlib.Data.Set.Subsingleton
import Mathlib.Order.WithBot
#align_import data.set.image from "leanprover-community/mathlib"@"001ffdc42920050657fd45bd2b8bfbec8eaaeb29"
universe u v
open Function Set
namespace Set
variable {Ξ± Ξ² Ξ³ : Type*} {ΞΉ ΞΉ' : Sort*}
section Image
variable {f : Ξ± β Ξ²} {s t : Set Ξ±}
-- Porting note: `Set.image` is already defined in `Init.Set`
#align set.image Set.image
@[deprecated mem_image (since := "2024-03-23")]
theorem mem_image_iff_bex {f : Ξ± β Ξ²} {s : Set Ξ±} {y : Ξ²} :
y β f '' s β β (x : _) (_ : x β s), f x = y :=
bex_def.symm
#align set.mem_image_iff_bex Set.mem_image_iff_bex
theorem image_eta (f : Ξ± β Ξ²) : f '' s = (fun x => f x) '' s :=
rfl
#align set.image_eta Set.image_eta
theorem _root_.Function.Injective.mem_set_image {f : Ξ± β Ξ²} (hf : Injective f) {s : Set Ξ±} {a : Ξ±} :
f a β f '' s β a β s :=
β¨fun β¨_, hb, Eqβ© => hf Eq βΈ hb, mem_image_of_mem fβ©
#align function.injective.mem_set_image Function.Injective.mem_set_image
theorem forall_mem_image {f : Ξ± β Ξ²} {s : Set Ξ±} {p : Ξ² β Prop} :
(β y β f '' s, p y) β β β¦xβ¦, x β s β p (f x) := by simp
#align set.ball_image_iff Set.forall_mem_image
theorem exists_mem_image {f : Ξ± β Ξ²} {s : Set Ξ±} {p : Ξ² β Prop} :
(β y β f '' s, p y) β β x β s, p (f x) := by simp
#align set.bex_image_iff Set.exists_mem_image
@[deprecated (since := "2024-02-21")] alias ball_image_iff := forall_mem_image
@[deprecated (since := "2024-02-21")] alias bex_image_iff := exists_mem_image
@[deprecated (since := "2024-02-21")] alias β¨_, ball_image_of_ballβ© := forall_mem_image
#align set.ball_image_of_ball Set.ball_image_of_ball
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim {f : Ξ± β Ξ²} {s : Set Ξ±} {C : Ξ² β Prop} (h : β x : Ξ±, x β s β C (f x)) :
β {y : Ξ²}, y β f '' s β C y := forall_mem_image.2 h _
#align set.mem_image_elim Set.mem_image_elim
@[deprecated forall_mem_image (since := "2024-02-21")]
theorem mem_image_elim_on {f : Ξ± β Ξ²} {s : Set Ξ±} {C : Ξ² β Prop} {y : Ξ²} (h_y : y β f '' s)
(h : β x : Ξ±, x β s β C (f x)) : C y := forall_mem_image.2 h _ h_y
#align set.mem_image_elim_on Set.mem_image_elim_on
-- Porting note: used to be `safe`
@[congr]
theorem image_congr {f g : Ξ± β Ξ²} {s : Set Ξ±} (h : β a β s, f a = g a) : f '' s = g '' s := by
ext x
exact exists_congr fun a β¦ and_congr_right fun ha β¦ by rw [h a ha]
#align set.image_congr Set.image_congr
theorem image_congr' {f g : Ξ± β Ξ²} {s : Set Ξ±} (h : β x : Ξ±, f x = g x) : f '' s = g '' s :=
image_congr fun x _ => h x
#align set.image_congr' Set.image_congr'
@[gcongr]
lemma image_mono (h : s β t) : f '' s β f '' t := by
rintro - β¨a, ha, rflβ©; exact mem_image_of_mem f (h ha)
| Mathlib/Data/Set/Image.lean | 263 | 263 | theorem image_comp (f : Ξ² β Ξ³) (g : Ξ± β Ξ²) (a : Set Ξ±) : f β g '' a = f '' (g '' a) := by | aesop
|
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.Types
import Mathlib.Topology.Category.TopCat.Limits.Products
universe w w' v u
open CategoryTheory Opposite Limits
variable {C : Type u} [Category.{v} C] (F : C β₯€ TopCat.{w}) (Y : Type w') [TopologicalSpace Y]
namespace ContinuousMap
@[simps]
def yonedaPresheaf : Cα΅α΅ β₯€ Type (max w w') where
obj X := C(F.obj (unop X), Y)
map f g := ContinuousMap.comp g (F.map f.unop)
@[simps]
def yonedaPresheaf' : TopCat.{w}α΅α΅ β₯€ Type (max w w') where
obj X := C((unop X).1, Y)
map f g := ContinuousMap.comp g f.unop
theorem comp_yonedaPresheaf' : yonedaPresheaf F Y = F.op β yonedaPresheaf' Y := rfl
| Mathlib/Topology/Category/TopCat/Yoneda.lean | 48 | 58 | theorem piComparison_fac {Ξ± : Type} (X : Ξ± β TopCat) :
piComparison (yonedaPresheaf'.{w, w'} Y) (fun x β¦ op (X x)) =
(yonedaPresheaf' Y).map ((opCoproductIsoProduct X).inv β« (TopCat.sigmaIsoSigma X).inv.op) β«
(equivEquivIso (sigmaEquiv Y (fun x β¦ (X x).1))).inv β« (Types.productIso _).inv := by |
rw [β Category.assoc, Iso.eq_comp_inv]
ext
simp only [yonedaPresheaf', unop_op, piComparison, types_comp_apply,
Types.productIso_hom_comp_eval_apply, Types.pi_lift_Ο_apply, comp_apply, TopCat.coe_of,
unop_comp, Quiver.Hom.unop_op, sigmaEquiv, equivEquivIso_hom, Equiv.toIso_inv,
Equiv.coe_fn_symm_mk, comp_assoc, sigmaMk_apply, β opCoproductIsoProduct_inv_comp_ΞΉ]
rfl
|
import Mathlib.Dynamics.Newton
import Mathlib.LinearAlgebra.Semisimple
open Algebra Polynomial
namespace Module.End
variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] [FiniteDimensional K V] {f : End K V}
theorem exists_isNilpotent_isSemisimple_of_separable_of_dvd_pow {P : K[X]} {k : β}
(sep : P.Separable) (nil : minpoly K f β£ P ^ k) :
βα΅ (n β adjoin K {f}) (s β adjoin K {f}), IsNilpotent n β§ IsSemisimple s β§ f = n + s := by
set ff : adjoin K {f} := β¨f, self_mem_adjoin_singleton K fβ©
set P' := derivative P
have nil' : IsNilpotent (aeval ff P) := by
use k
obtain β¨q, hqβ© := nil
rw [β AlgHom.map_pow, Subtype.ext_iff]
simp [ff, hq]
have sep' : IsUnit (aeval ff P') := by
obtain β¨a, b, hβ© : IsCoprime (P ^ k) P' := sep.pow_left
replace h : (aeval f b) * (aeval f P') = 1 := by
simpa only [map_add, map_mul, map_one, minpoly.dvd_iff.mp nil, mul_zero, zero_add]
using (aeval f).congr_arg h
refine isUnit_of_mul_eq_one_right (aeval ff b) _ (Subtype.ext_iff.mpr ?_)
simpa [ff, coe_aeval_mk_apply] using h
obtain β¨β¨s, memβ©, β¨β¨k, hkβ©, hssβ©, -β© := exists_unique_nilpotent_sub_and_aeval_eq_zero nil' sep'
refine β¨f - s, ?_, s, mem, β¨k, ?_β©, ?_, (sub_add_cancel f s).symmβ©
Β· exact sub_mem (self_mem_adjoin_singleton K f) mem
Β· rw [Subtype.ext_iff] at hk
simpa using hk
Β· replace hss : aeval s P = 0 := by rwa [Subtype.ext_iff, coe_aeval_mk_apply] at hss
exact isSemisimple_of_squarefree_aeval_eq_zero sep.squarefree hss
| Mathlib/LinearAlgebra/JordanChevalley.lean | 71 | 75 | theorem exists_isNilpotent_isSemisimple [PerfectField K] :
βα΅ (n β adjoin K {f}) (s β adjoin K {f}), IsNilpotent n β§ IsSemisimple s β§ f = n + s := by |
obtain β¨g, k, sep, -, nilβ© := exists_squarefree_dvd_pow_of_ne_zero (minpoly.ne_zero_of_finite K f)
rw [β PerfectField.separable_iff_squarefree] at sep
exact exists_isNilpotent_isSemisimple_of_separable_of_dvd_pow sep nil
|
import Mathlib.CategoryTheory.Balanced
import Mathlib.CategoryTheory.Limits.EssentiallySmall
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.Data.Set.Opposite
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.generator from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
universe w vβ vβ uβ uβ
open CategoryTheory.Limits Opposite
namespace CategoryTheory
variable {C : Type uβ} [Category.{vβ} C] {D : Type uβ} [Category.{vβ} D]
def IsSeparating (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f g : X βΆ Y), (β G β π’, β (h : G βΆ X), h β« f = h β« g) β f = g
#align category_theory.is_separating CategoryTheory.IsSeparating
def IsCoseparating (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f g : X βΆ Y), (β G β π’, β (h : Y βΆ G), f β« h = g β« h) β f = g
#align category_theory.is_coseparating CategoryTheory.IsCoseparating
def IsDetecting (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f : X βΆ Y), (β G β π’, β (h : G βΆ Y), β! h' : G βΆ X, h' β« f = h) β IsIso f
#align category_theory.is_detecting CategoryTheory.IsDetecting
def IsCodetecting (π’ : Set C) : Prop :=
β β¦X Y : Cβ¦ (f : X βΆ Y), (β G β π’, β (h : X βΆ G), β! h' : Y βΆ G, f β« h' = h) β IsIso f
#align category_theory.is_codetecting CategoryTheory.IsCodetecting
section Dual
theorem isSeparating_op_iff (π’ : Set C) : IsSeparating π’.op β IsCoseparating π’ := by
refine β¨fun hπ’ X Y f g hfg => ?_, fun hπ’ X Y f g hfg => ?_β©
Β· refine Quiver.Hom.op_inj (hπ’ _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
Β· refine Quiver.Hom.unop_inj (hπ’ _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_separating_op_iff CategoryTheory.isSeparating_op_iff
theorem isCoseparating_op_iff (π’ : Set C) : IsCoseparating π’.op β IsSeparating π’ := by
refine β¨fun hπ’ X Y f g hfg => ?_, fun hπ’ X Y f g hfg => ?_β©
Β· refine Quiver.Hom.op_inj (hπ’ _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
Β· refine Quiver.Hom.unop_inj (hπ’ _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_coseparating_op_iff CategoryTheory.isCoseparating_op_iff
| Mathlib/CategoryTheory/Generator.lean | 109 | 110 | theorem isCoseparating_unop_iff (π’ : Set Cα΅α΅) : IsCoseparating π’.unop β IsSeparating π’ := by |
rw [β isSeparating_op_iff, Set.unop_op]
|
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.extreme from "leanprover-community/mathlib"@"c5773405394e073885e2a144c9ca14637e8eb963"
open Function Set
open scoped Classical
open Affine
variable {π E F ΞΉ : Type*} {Ο : ΞΉ β Type*}
section SMul
variable (π) [OrderedSemiring π] [AddCommMonoid E] [SMul π E]
def IsExtreme (A B : Set E) : Prop :=
B β A β§ β β¦xββ¦, xβ β A β β β¦xββ¦, xβ β A β β β¦xβ¦, x β B β x β openSegment π xβ xβ β xβ β B β§ xβ β B
#align is_extreme IsExtreme
def Set.extremePoints (A : Set E) : Set E :=
{ x β A | β β¦xββ¦, xβ β A β β β¦xββ¦, xβ β A β x β openSegment π xβ xβ β xβ = x β§ xβ = x }
#align set.extreme_points Set.extremePoints
@[refl]
protected theorem IsExtreme.refl (A : Set E) : IsExtreme π A A :=
β¨Subset.rfl, fun _ hxβA _ hxβA _ _ _ β¦ β¨hxβA, hxβAβ©β©
#align is_extreme.refl IsExtreme.refl
variable {π} {A B C : Set E} {x : E}
protected theorem IsExtreme.rfl : IsExtreme π A A :=
IsExtreme.refl π A
#align is_extreme.rfl IsExtreme.rfl
@[trans]
protected theorem IsExtreme.trans (hAB : IsExtreme π A B) (hBC : IsExtreme π B C) :
IsExtreme π A C := by
refine β¨Subset.trans hBC.1 hAB.1, fun xβ hxβA xβ hxβA x hxC hx β¦ ?_β©
obtain β¨hxβB, hxβBβ© := hAB.2 hxβA hxβA (hBC.1 hxC) hx
exact hBC.2 hxβB hxβB hxC hx
#align is_extreme.trans IsExtreme.trans
protected theorem IsExtreme.antisymm : AntiSymmetric (IsExtreme π : Set E β Set E β Prop) :=
fun _ _ hAB hBA β¦ Subset.antisymm hBA.1 hAB.1
#align is_extreme.antisymm IsExtreme.antisymm
instance : IsPartialOrder (Set E) (IsExtreme π) where
refl := IsExtreme.refl π
trans _ _ _ := IsExtreme.trans
antisymm := IsExtreme.antisymm
theorem IsExtreme.inter (hAB : IsExtreme π A B) (hAC : IsExtreme π A C) :
IsExtreme π A (B β© C) := by
use Subset.trans inter_subset_left hAB.1
rintro xβ hxβA xβ hxβA x β¨hxB, hxCβ© hx
obtain β¨hxβB, hxβBβ© := hAB.2 hxβA hxβA hxB hx
obtain β¨hxβC, hxβCβ© := hAC.2 hxβA hxβA hxC hx
exact β¨β¨hxβB, hxβCβ©, hxβB, hxβCβ©
#align is_extreme.inter IsExtreme.inter
protected theorem IsExtreme.mono (hAC : IsExtreme π A C) (hBA : B β A) (hCB : C β B) :
IsExtreme π B C :=
β¨hCB, fun _ hxβB _ hxβB _ hxC hx β¦ hAC.2 (hBA hxβB) (hBA hxβB) hxC hxβ©
#align is_extreme.mono IsExtreme.mono
| Mathlib/Analysis/Convex/Extreme.lean | 111 | 117 | theorem isExtreme_iInter {ΞΉ : Sort*} [Nonempty ΞΉ] {F : ΞΉ β Set E}
(hAF : β i : ΞΉ, IsExtreme π A (F i)) : IsExtreme π A (β i : ΞΉ, F i) := by |
obtain i := Classical.arbitrary ΞΉ
refine β¨iInter_subset_of_subset i (hAF i).1, fun xβ hxβA xβ hxβA x hxF hx β¦ ?_β©
simp_rw [mem_iInter] at hxF β’
have h := fun i β¦ (hAF i).2 hxβA hxβA (hxF i) hx
exact β¨fun i β¦ (h i).1, fun i β¦ (h i).2β©
|
import Mathlib.CategoryTheory.Adjunction.Unique
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
import Mathlib.CategoryTheory.Sites.Sheaf
import Mathlib.CategoryTheory.Limits.Preserves.Finite
universe vβ vβ uβ uβ
namespace CategoryTheory
open Limits
variable {C : Type uβ} [Category.{vβ} C] (J : GrothendieckTopology C)
variable (A : Type uβ) [Category.{vβ} A]
abbrev HasWeakSheafify : Prop := (sheafToPresheaf J A).IsRightAdjoint
class HasSheafify : Prop where
isRightAdjoint : HasWeakSheafify J A
isLeftExact : Nonempty (PreservesFiniteLimits ((sheafToPresheaf J A).leftAdjoint))
instance [HasSheafify J A] : HasWeakSheafify J A := HasSheafify.isRightAdjoint
noncomputable section
instance [HasSheafify J A] : PreservesFiniteLimits ((sheafToPresheaf J A).leftAdjoint) :=
HasSheafify.isLeftExact.some
theorem HasSheafify.mk' {F : (Cα΅α΅ β₯€ A) β₯€ Sheaf J A} (adj : F β£ sheafToPresheaf J A)
[PreservesFiniteLimits F] : HasSheafify J A where
isRightAdjoint := β¨F, β¨adjβ©β©
isLeftExact := β¨by
have : (sheafToPresheaf J A).IsRightAdjoint := β¨_, β¨adjβ©β©
exact β¨fun _ _ _ β¦ preservesLimitsOfShapeOfNatIso
(adj.leftAdjointUniq (Adjunction.ofIsRightAdjoint (sheafToPresheaf J A)))β©β©
def presheafToSheaf [HasWeakSheafify J A] : (Cα΅α΅ β₯€ A) β₯€ Sheaf J A :=
(sheafToPresheaf J A).leftAdjoint
instance [HasSheafify J A] : PreservesFiniteLimits (presheafToSheaf J A) :=
HasSheafify.isLeftExact.some
def sheafificationAdjunction [HasWeakSheafify J A] :
presheafToSheaf J A β£ sheafToPresheaf J A := Adjunction.ofIsRightAdjoint _
instance [HasWeakSheafify J A] : (presheafToSheaf J A).IsLeftAdjoint :=
β¨_, β¨sheafificationAdjunction J Aβ©β©
end
variable {D : Type*} [Category D] [HasWeakSheafify J D]
noncomputable abbrev sheafify (P : Cα΅α΅ β₯€ D) : Cα΅α΅ β₯€ D :=
presheafToSheaf J D |>.obj P |>.val
noncomputable abbrev toSheafify (P : Cα΅α΅ β₯€ D) : P βΆ sheafify J P :=
sheafificationAdjunction J D |>.unit.app P
@[simp]
theorem sheafificationAdjunction_unit_app (P : Cα΅α΅ β₯€ D) :
(sheafificationAdjunction J D).unit.app P = toSheafify J P := rfl
noncomputable abbrev sheafifyMap {P Q : Cα΅α΅ β₯€ D} (Ξ· : P βΆ Q) : sheafify J P βΆ sheafify J Q :=
presheafToSheaf J D |>.map Ξ· |>.val
@[simp]
theorem sheafifyMap_id (P : Cα΅α΅ β₯€ D) : sheafifyMap J (π P) = π (sheafify J P) := by
simp [sheafifyMap, sheafify]
@[simp]
theorem sheafifyMap_comp {P Q R : Cα΅α΅ β₯€ D} (Ξ· : P βΆ Q) (Ξ³ : Q βΆ R) :
sheafifyMap J (Ξ· β« Ξ³) = sheafifyMap J Ξ· β« sheafifyMap J Ξ³ := by
simp [sheafifyMap, sheafify]
@[reassoc (attr := simp)]
theorem toSheafify_naturality {P Q : Cα΅α΅ β₯€ D} (Ξ· : P βΆ Q) :
Ξ· β« toSheafify J _ = toSheafify J _ β« sheafifyMap J Ξ· :=
sheafificationAdjunction J D |>.unit.naturality Ξ·
variable (D)
noncomputable abbrev sheafification : (Cα΅α΅ β₯€ D) β₯€ Cα΅α΅ β₯€ D :=
presheafToSheaf J D β sheafToPresheaf J D
theorem sheafification_obj (P : Cα΅α΅ β₯€ D) : (sheafification J D).obj P = sheafify J P :=
rfl
theorem sheafification_map {P Q : Cα΅α΅ β₯€ D} (Ξ· : P βΆ Q) :
(sheafification J D).map Ξ· = sheafifyMap J Ξ· :=
rfl
noncomputable abbrev toSheafification : π _ βΆ sheafification J D :=
sheafificationAdjunction J D |>.unit
theorem toSheafification_app (P : Cα΅α΅ β₯€ D) : (toSheafification J D).app P = toSheafify J P :=
rfl
variable {D}
| Mathlib/CategoryTheory/Sites/Sheafification.lean | 131 | 138 | theorem isIso_toSheafify {P : Cα΅α΅ β₯€ D} (hP : Presheaf.IsSheaf J P) : IsIso (toSheafify J P) := by |
refine β¨(sheafificationAdjunction J D |>.counit.app β¨P, hPβ©).val, ?_, ?_β©
Β· change _ = (π (sheafToPresheaf J D β π (Cα΅α΅ β₯€ D)) : _).app β¨P, hPβ©
rw [β sheafificationAdjunction J D |>.right_triangle]
rfl
Β· change (sheafToPresheaf _ _).map _ β« _ = _
change _ β« (sheafificationAdjunction J D).unit.app ((sheafToPresheaf J D).obj β¨P, hPβ©) = _
erw [β (sheafificationAdjunction J D).inv_counit_map (X := β¨P, hPβ©), comp_inv_eq_id]
|
import Mathlib.Algebra.DirectSum.Finsupp
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.DirectSum.TensorProduct
#align_import linear_algebra.direct_sum.finsupp from "leanprover-community/mathlib"@"9b9d125b7be0930f564a68f1d73ace10cf46064d"
noncomputable section
open DirectSum TensorProduct
open Set LinearMap Submodule
section TensorProduct
variable (R : Type*) [CommSemiring R]
(M : Type*) [AddCommMonoid M] [Module R M]
(N : Type*) [AddCommMonoid N] [Module R N]
namespace TensorProduct
variable (ΞΉ : Type*) [DecidableEq ΞΉ]
noncomputable def finsuppLeft :
(ΞΉ ββ M) β[R] N ββ[R] ΞΉ ββ M β[R] N :=
congr (finsuppLEquivDirectSum R M ΞΉ) (.refl R N) βͺβ«β
directSumLeft R (fun _ β¦ M) N βͺβ«β (finsuppLEquivDirectSum R _ ΞΉ).symm
variable {R M N ΞΉ}
lemma finsuppLeft_apply_tmul (p : ΞΉ ββ M) (n : N) :
finsuppLeft R M N ΞΉ (p ββ[R] n) = p.sum fun i m β¦ Finsupp.single i (m ββ[R] n) := by
apply p.induction_linear
Β· simp
Β· intros f g hf hg; simp [add_tmul, map_add, hf, hg, Finsupp.sum_add_index]
Β· simp [finsuppLeft]
@[simp]
lemma finsuppLeft_apply_tmul_apply (p : ΞΉ ββ M) (n : N) (i : ΞΉ) :
finsuppLeft R M N ΞΉ (p ββ[R] n) i = p i ββ[R] n := by
rw [finsuppLeft_apply_tmul, Finsupp.sum_apply,
Finsupp.sum_eq_single i (fun _ _ β¦ Finsupp.single_eq_of_ne) (by simp), Finsupp.single_eq_same]
theorem finsuppLeft_apply (t : (ΞΉ ββ M) β[R] N) (i : ΞΉ) :
finsuppLeft R M N ΞΉ t i = rTensor N (Finsupp.lapply i) t := by
induction t using TensorProduct.induction_on with
| zero => simp
| tmul f n => simp only [finsuppLeft_apply_tmul_apply, rTensor_tmul, Finsupp.lapply_apply]
| add x y hx hy => simp [map_add, hx, hy]
@[simp]
lemma finsuppLeft_symm_apply_single (i : ΞΉ) (m : M) (n : N) :
(finsuppLeft R M N ΞΉ).symm (Finsupp.single i (m ββ[R] n)) =
Finsupp.single i m ββ[R] n := by
simp [finsuppLeft, Finsupp.lsum]
variable (R M N ΞΉ)
noncomputable def finsuppRight :
M β[R] (ΞΉ ββ N) ββ[R] ΞΉ ββ M β[R] N :=
congr (.refl R M) (finsuppLEquivDirectSum R N ΞΉ) βͺβ«β
directSumRight R M (fun _ : ΞΉ β¦ N) βͺβ«β (finsuppLEquivDirectSum R _ ΞΉ).symm
variable {R M N ΞΉ}
lemma finsuppRight_apply_tmul (m : M) (p : ΞΉ ββ N) :
finsuppRight R M N ΞΉ (m ββ[R] p) = p.sum fun i n β¦ Finsupp.single i (m ββ[R] n) := by
apply p.induction_linear
Β· simp
Β· intros f g hf hg; simp [tmul_add, map_add, hf, hg, Finsupp.sum_add_index]
Β· simp [finsuppRight]
@[simp]
lemma finsuppRight_apply_tmul_apply (m : M) (p : ΞΉ ββ N) (i : ΞΉ) :
finsuppRight R M N ΞΉ (m ββ[R] p) i = m ββ[R] p i := by
rw [finsuppRight_apply_tmul, Finsupp.sum_apply,
Finsupp.sum_eq_single i (fun _ _ β¦ Finsupp.single_eq_of_ne) (by simp), Finsupp.single_eq_same]
| Mathlib/LinearAlgebra/DirectSum/Finsupp.lean | 137 | 142 | theorem finsuppRight_apply (t : M β[R] (ΞΉ ββ N)) (i : ΞΉ) :
finsuppRight R M N ΞΉ t i = lTensor M (Finsupp.lapply i) t := by |
induction t using TensorProduct.induction_on with
| zero => simp
| tmul m f => simp [finsuppRight_apply_tmul_apply]
| add x y hx hy => simp [map_add, hx, hy]
|
import Mathlib.GroupTheory.Coprod.Basic
import Mathlib.GroupTheory.Complement
open Monoid Coprod Multiplicative Subgroup Function
def HNNExtension.con (G : Type*) [Group G] (A B : Subgroup G) (Ο : A β* B) :
Con (G β Multiplicative β€) :=
conGen (fun x y => β (a : A),
x = inr (ofAdd 1) * inl (a : G) β§
y = inl (Ο a : G) * inr (ofAdd 1))
def HNNExtension (G : Type*) [Group G] (A B : Subgroup G) (Ο : A β* B) : Type _ :=
(HNNExtension.con G A B Ο).Quotient
variable {G : Type*} [Group G] {A B : Subgroup G} {Ο : A β* B} {H : Type*}
[Group H] {M : Type*} [Monoid M]
instance : Group (HNNExtension G A B Ο) := by
delta HNNExtension; infer_instance
namespace HNNExtension
def of : G β* HNNExtension G A B Ο :=
(HNNExtension.con G A B Ο).mk'.comp inl
def t : HNNExtension G A B Ο :=
(HNNExtension.con G A B Ο).mk'.comp inr (ofAdd 1)
theorem t_mul_of (a : A) :
t * (of (a : G) : HNNExtension G A B Ο) = of (Ο a : G) * t :=
(Con.eq _).2 <| ConGen.Rel.of _ _ <| β¨a, by simpβ©
theorem of_mul_t (b : B) :
(of (b : G) : HNNExtension G A B Ο) * t = t * of (Ο.symm b : G) := by
rw [t_mul_of]; simp
theorem equiv_eq_conj (a : A) :
(of (Ο a : G) : HNNExtension G A B Ο) = t * of (a : G) * tβ»ΒΉ := by
rw [t_mul_of]; simp
theorem equiv_symm_eq_conj (b : B) :
(of (Ο.symm b : G) : HNNExtension G A B Ο) = tβ»ΒΉ * of (b : G) * t := by
rw [mul_assoc, of_mul_t]; simp
theorem inv_t_mul_of (b : B) :
tβ»ΒΉ * (of (b : G) : HNNExtension G A B Ο) = of (Ο.symm b : G) * tβ»ΒΉ := by
rw [equiv_symm_eq_conj]; simp
theorem of_mul_inv_t (a : A) :
(of (a : G) : HNNExtension G A B Ο) * tβ»ΒΉ = tβ»ΒΉ * of (Ο a : G) := by
rw [equiv_eq_conj]; simp [mul_assoc]
def lift (f : G β* H) (x : H) (hx : β a : A, x * f βa = f (Ο a : G) * x) :
HNNExtension G A B Ο β* H :=
Con.lift _ (Coprod.lift f (zpowersHom H x)) (Con.conGen_le <| by
rintro _ _ β¨a, rfl, rflβ©
simp [hx])
@[simp]
theorem lift_t (f : G β* H) (x : H) (hx : β a : A, x * f βa = f (Ο a : G) * x) :
lift f x hx t = x := by
delta HNNExtension; simp [lift, t]
@[simp]
theorem lift_of (f : G β* H) (x : H) (hx : β a : A, x * f βa = f (Ο a : G) * x) (g : G) :
lift f x hx (of g) = f g := by
delta HNNExtension; simp [lift, of]
@[ext high]
theorem hom_ext {f g : HNNExtension G A B Ο β* M}
(hg : f.comp of = g.comp of) (ht : f t = g t) : f = g :=
(MonoidHom.cancel_right Con.mk'_surjective).mp <|
Coprod.hom_ext hg (MonoidHom.ext_mint ht)
@[elab_as_elim]
theorem induction_on {motive : HNNExtension G A B Ο β Prop}
(x : HNNExtension G A B Ο) (of : β g, motive (of g))
(t : motive t) (mul : β x y, motive x β motive y β motive (x * y))
(inv : β x, motive x β motive xβ»ΒΉ) : motive x := by
let S : Subgroup (HNNExtension G A B Ο) :=
{ carrier := setOf motive
one_mem' := by simpa using of 1
mul_mem' := mul _ _
inv_mem' := inv _ }
let f : HNNExtension G A B Ο β* S :=
lift (HNNExtension.of.codRestrict S of)
β¨HNNExtension.t, tβ© (by intro a; ext; simp [equiv_eq_conj, mul_assoc])
have hf : S.subtype.comp f = MonoidHom.id _ :=
hom_ext (by ext; simp [f]) (by simp [f])
show motive (MonoidHom.id _ x)
rw [β hf]
exact (f x).2
variable (A B Ο)
def toSubgroup (u : β€Λ£) : Subgroup G :=
if u = 1 then A else B
@[simp]
theorem toSubgroup_one : toSubgroup A B 1 = A := rfl
@[simp]
theorem toSubgroup_neg_one : toSubgroup A B (-1) = B := rfl
variable {A B}
def toSubgroupEquiv (u : β€Λ£) : toSubgroup A B u β* toSubgroup A B (-u) :=
if hu : u = 1 then hu βΈ Ο else by
convert Ο.symm <;>
cases Int.units_eq_one_or u <;> simp_all
@[simp]
theorem toSubgroupEquiv_one : toSubgroupEquiv Ο 1 = Ο := rfl
@[simp]
theorem toSubgroupEquiv_neg_one : toSubgroupEquiv Ο (-1) = Ο.symm := rfl
@[simp]
theorem toSubgroupEquiv_neg_apply (u : β€Λ£) (a : toSubgroup A B u) :
(toSubgroupEquiv Ο (-u) (toSubgroupEquiv Ο u a) : G) = a := by
rcases Int.units_eq_one_or u with rfl | rfl
Β· -- This used to be `simp` before leanprover/lean4#2644
simp; erw [MulEquiv.symm_apply_apply]
Β· simp only [toSubgroup_neg_one, toSubgroupEquiv_neg_one, SetLike.coe_eq_coe]
exact Ο.apply_symm_apply a
namespace NormalWord
variable (G A B)
structure TransversalPair : Type _ :=
set : β€Λ£ β Set G
compl : β u, IsComplement (toSubgroup A B u : Subgroup G) (set u)
instance TransversalPair.nonempty : Nonempty (TransversalPair G A B) := by
choose t ht using fun u β¦ (toSubgroup A B u).exists_right_transversal 1
exact β¨β¨t, fun i β¦ (ht i).1β©β©
structure ReducedWord : Type _ :=
head : G
toList : List (β€Λ£ Γ G)
chain : toList.Chain' (fun a b => a.2 β toSubgroup A B a.1 β a.1 = b.1)
@[simps]
def ReducedWord.empty : ReducedWord G A B :=
{ head := 1
toList := []
chain := List.chain'_nil }
variable {G A B}
def ReducedWord.prod : ReducedWord G A B β HNNExtension G A B Ο :=
fun w => of w.head * (w.toList.map (fun x => t ^ (x.1 : β€) * of x.2)).prod
structure _root_.HNNExtension.NormalWord (d : TransversalPair G A B)
extends ReducedWord G A B : Type _ :=
mem_set : β (u : β€Λ£) (g : G), (u, g) β toList β g β d.set u
variable {d : TransversalPair G A B}
@[ext]
theorem ext {w w' : NormalWord d}
(h1 : w.head = w'.head) (h2 : w.toList = w'.toList): w = w' := by
rcases w with β¨β¨β©, _β©; cases w'; simp_all
@[simps]
def empty : NormalWord d :=
{ head := 1
toList := []
mem_set := by simp
chain := List.chain'_nil }
@[simps]
def ofGroup (g : G) : NormalWord d :=
{ head := g
toList := []
mem_set := by simp
chain := List.chain'_nil }
instance : Inhabited (NormalWord d) := β¨emptyβ©
instance : MulAction G (NormalWord d) :=
{ smul := fun g w => { w with head := g * w.head }
one_smul := by simp [instHSMul]
mul_smul := by simp [instHSMul, mul_assoc] }
theorem group_smul_def (g : G) (w : NormalWord d) :
g β’ w = { w with head := g * w.head } := rfl
@[simp]
theorem group_smul_head (g : G) (w : NormalWord d) : (g β’ w).head = g * w.head := rfl
@[simp]
theorem group_smul_toList (g : G) (w : NormalWord d) : (g β’ w).toList = w.toList := rfl
instance : FaithfulSMul G (NormalWord d) := β¨by simp [group_smul_def]β©
@[simps]
def cons (g : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?, w.head β toSubgroup A B u β u = u') :
NormalWord d :=
{ head := g,
toList := (u, w.head) :: w.toList,
mem_set := by
intro u' g' h'
simp only [List.mem_cons, Prod.mk.injEq] at h'
rcases h' with β¨rfl, rflβ© | h'
Β· exact h1
Β· exact w.mem_set _ _ h'
chain := by
refine List.chain'_cons'.2 β¨?_, w.chainβ©
rintro β¨u', g'β© hu' hw1
exact h2 _ (by simp_all) hw1 }
@[elab_as_elim]
def consRecOn {motive : NormalWord d β Sort*} (w : NormalWord d)
(ofGroup : βg, motive (ofGroup g))
(cons : β (g : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?,
w.head β toSubgroup A B u β u = u'),
motive w β motive (cons g u w h1 h2)) : motive w := by
rcases w with β¨β¨g, l, chainβ©, mem_setβ©
induction l generalizing g with
| nil => exact ofGroup _
| cons a l ih =>
exact cons g a.1
{ head := a.2
toList := l
mem_set := fun _ _ h => mem_set _ _ (List.mem_cons_of_mem _ h),
chain := (List.chain'_cons'.1 chain).2 }
(mem_set a.1 a.2 (List.mem_cons_self _ _))
(by simpa using (List.chain'_cons'.1 chain).1)
(ih _ _ _)
@[simp]
theorem consRecOn_ofGroup {motive : NormalWord d β Sort*}
(g : G) (ofGroup : βg, motive (ofGroup g))
(cons : β (g : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?, w.head
β toSubgroup A B u β u = u'),
motive w β motive (cons g u w h1 h2)) :
consRecOn (.ofGroup g) ofGroup cons = ofGroup g := rfl
@[simp]
theorem consRecOn_cons {motive : NormalWord d β Sort*}
(g : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?, w.head β toSubgroup A B u β u = u')
(ofGroup : βg, motive (ofGroup g))
(cons : β (g : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?,
w.head β toSubgroup A B u β u = u'),
motive w β motive (cons g u w h1 h2)) :
consRecOn (.cons g u w h1 h2) ofGroup cons = cons g u w h1 h2
(consRecOn w ofGroup cons) := rfl
@[simp]
theorem smul_cons (gβ gβ : G) (u : β€Λ£) (w : NormalWord d) (h1 : w.head β d.set u)
(h2 : β u' β Option.map Prod.fst w.toList.head?, w.head β toSubgroup A B u β u = u') :
gβ β’ cons gβ u w h1 h2 = cons (gβ * gβ) u w h1 h2 :=
rfl
@[simp]
theorem smul_ofGroup (gβ gβ : G) :
gβ β’ (ofGroup gβ : NormalWord d) = ofGroup (gβ * gβ) := rfl
variable (d)
noncomputable def unitsSMulGroup (u : β€Λ£) (g : G) :
(toSubgroup A B (-u)) Γ d.set u :=
let g' := (d.compl u).equiv g
(toSubgroupEquiv Ο u g'.1, g'.2)
| Mathlib/GroupTheory/HNNExtension.lean | 344 | 346 | theorem unitsSMulGroup_snd (u : β€Λ£) (g : G) :
(unitsSMulGroup Ο d u g).2 = ((d.compl u).equiv g).2 := by |
rcases Int.units_eq_one_or u with rfl | rfl <;> rfl
|
import Mathlib.Geometry.Manifold.SmoothManifoldWithCorners
import Mathlib.Geometry.Manifold.LocalInvariantProperties
#align_import geometry.manifold.cont_mdiff from "leanprover-community/mathlib"@"e5ab837fc252451f3eb9124ae6e7b6f57455e7b9"
open Set Function Filter ChartedSpace SmoothManifoldWithCorners
open scoped Topology Manifold
variable {π : Type*} [NontriviallyNormedField π]
-- declare a smooth manifold `M` over the pair `(E, H)`.
{E : Type*}
[NormedAddCommGroup E] [NormedSpace π E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners π E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
[SmoothManifoldWithCorners I M]
-- declare a smooth manifold `M'` over the pair `(E', H')`.
{E' : Type*}
[NormedAddCommGroup E'] [NormedSpace π E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners π E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
[SmoothManifoldWithCorners I' M']
-- declare a manifold `M''` over the pair `(E'', H'')`.
{E'' : Type*}
[NormedAddCommGroup E''] [NormedSpace π E''] {H'' : Type*} [TopologicalSpace H'']
{I'' : ModelWithCorners π E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
-- declare a smooth manifold `N` over the pair `(F, G)`.
{F : Type*}
[NormedAddCommGroup F] [NormedSpace π F] {G : Type*} [TopologicalSpace G]
{J : ModelWithCorners π F G} {N : Type*} [TopologicalSpace N] [ChartedSpace G N]
[SmoothManifoldWithCorners J N]
-- declare a smooth manifold `N'` over the pair `(F', G')`.
{F' : Type*}
[NormedAddCommGroup F'] [NormedSpace π F'] {G' : Type*} [TopologicalSpace G']
{J' : ModelWithCorners π F' G'} {N' : Type*} [TopologicalSpace N'] [ChartedSpace G' N']
[SmoothManifoldWithCorners J' N']
-- Fβ, Fβ, Fβ, Fβ are normed spaces
{Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ]
[NormedSpace π Fβ] {Fβ : Type*} [NormedAddCommGroup Fβ] [NormedSpace π Fβ] {Fβ : Type*}
[NormedAddCommGroup Fβ] [NormedSpace π Fβ]
-- declare functions, sets, points and smoothness indices
{e : PartialHomeomorph M H}
{e' : PartialHomeomorph M' H'} {f fβ : M β M'} {s sβ t : Set M} {x : M} {m n : ββ}
def ContDiffWithinAtProp (n : ββ) (f : H β H') (s : Set H) (x : H) : Prop :=
ContDiffWithinAt π n (I' β f β I.symm) (I.symm β»ΒΉ' s β© range I) (I x)
#align cont_diff_within_at_prop ContDiffWithinAtProp
theorem contDiffWithinAtProp_self_source {f : E β H'} {s : Set E} {x : E} :
ContDiffWithinAtProp π(π, E) I' n f s x β ContDiffWithinAt π n (I' β f) s x := by
simp_rw [ContDiffWithinAtProp, modelWithCornersSelf_coe, range_id, inter_univ,
modelWithCornersSelf_coe_symm, CompTriple.comp_eq, preimage_id_eq, id_eq]
#align cont_diff_within_at_prop_self_source contDiffWithinAtProp_self_source
theorem contDiffWithinAtProp_self {f : E β E'} {s : Set E} {x : E} :
ContDiffWithinAtProp π(π, E) π(π, E') n f s x β ContDiffWithinAt π n f s x :=
contDiffWithinAtProp_self_source π(π, E')
#align cont_diff_within_at_prop_self contDiffWithinAtProp_self
theorem contDiffWithinAtProp_self_target {f : H β E'} {s : Set H} {x : H} :
ContDiffWithinAtProp I π(π, E') n f s x β
ContDiffWithinAt π n (f β I.symm) (I.symm β»ΒΉ' s β© range I) (I x) :=
Iff.rfl
#align cont_diff_within_at_prop_self_target contDiffWithinAtProp_self_target
theorem contDiffWithinAt_localInvariantProp (n : ββ) :
(contDiffGroupoid β I).LocalInvariantProp (contDiffGroupoid β I')
(ContDiffWithinAtProp I I' n) where
is_local {s x u f} u_open xu := by
have : I.symm β»ΒΉ' (s β© u) β© range I = I.symm β»ΒΉ' s β© range I β© I.symm β»ΒΉ' u := by
simp only [inter_right_comm, preimage_inter]
rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]
symm
apply contDiffWithinAt_inter
have : u β π (I.symm (I x)) := by
rw [ModelWithCorners.left_inv]
exact u_open.mem_nhds xu
apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this
right_invariance' {s x f e} he hx h := by
rw [ContDiffWithinAtProp] at h β’
have : I x = (I β e.symm β I.symm) (I (e x)) := by simp only [hx, mfld_simps]
rw [this] at h
have : I (e x) β I.symm β»ΒΉ' e.target β© range I := by simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this
convert (h.comp' _ (this.of_le le_top)).mono_of_mem _ using 1
Β· ext y; simp only [mfld_simps]
refine mem_nhdsWithin.mpr
β¨I.symm β»ΒΉ' e.target, e.open_target.preimage I.continuous_symm, by
simp_rw [mem_preimage, I.left_inv, e.mapsTo hx], ?_β©
mfld_set_tac
congr_of_forall {s x f g} h hx hf := by
apply hf.congr
Β· intro y hy
simp only [mfld_simps] at hy
simp only [h, hy, mfld_simps]
Β· simp only [hx, mfld_simps]
left_invariance' {s x f e'} he' hs hx h := by
rw [ContDiffWithinAtProp] at h β’
have A : (I' β f β I.symm) (I x) β I'.symm β»ΒΉ' e'.source β© range I' := by
simp only [hx, mfld_simps]
have := (mem_groupoid_of_pregroupoid.2 he').1.contDiffWithinAt A
convert (this.of_le le_top).comp _ h _
Β· ext y; simp only [mfld_simps]
Β· intro y hy; simp only [mfld_simps] at hy; simpa only [hy, mfld_simps] using hs hy.1
#align cont_diff_within_at_local_invariant_prop contDiffWithinAt_localInvariantProp
theorem contDiffWithinAtProp_mono_of_mem (n : ββ) β¦s x tβ¦ β¦f : H β H'β¦ (hts : s β π[t] x)
(h : ContDiffWithinAtProp I I' n f s x) : ContDiffWithinAtProp I I' n f t x := by
refine h.mono_of_mem ?_
refine inter_mem ?_ (mem_of_superset self_mem_nhdsWithin inter_subset_right)
rwa [β Filter.mem_map, β I.image_eq, I.symm_map_nhdsWithin_image]
#align cont_diff_within_at_prop_mono_of_mem contDiffWithinAtProp_mono_of_mem
theorem contDiffWithinAtProp_id (x : H) : ContDiffWithinAtProp I I n id univ x := by
simp only [ContDiffWithinAtProp, id_comp, preimage_univ, univ_inter]
have : ContDiffWithinAt π n id (range I) (I x) := contDiff_id.contDiffAt.contDiffWithinAt
refine this.congr (fun y hy => ?_) ?_
Β· simp only [ModelWithCorners.right_inv I hy, mfld_simps]
Β· simp only [mfld_simps]
#align cont_diff_within_at_prop_id contDiffWithinAtProp_id
def ContMDiffWithinAt (n : ββ) (f : M β M') (s : Set M) (x : M) :=
LiftPropWithinAt (ContDiffWithinAtProp I I' n) f s x
#align cont_mdiff_within_at ContMDiffWithinAt
abbrev SmoothWithinAt (f : M β M') (s : Set M) (x : M) :=
ContMDiffWithinAt I I' β€ f s x
#align smooth_within_at SmoothWithinAt
def ContMDiffAt (n : ββ) (f : M β M') (x : M) :=
ContMDiffWithinAt I I' n f univ x
#align cont_mdiff_at ContMDiffAt
theorem contMDiffAt_iff {n : ββ} {f : M β M'} {x : M} :
ContMDiffAt I I' n f x β
ContinuousAt f x β§
ContDiffWithinAt π n (extChartAt I' (f x) β f β (extChartAt I x).symm) (range I)
(extChartAt I x x) :=
liftPropAt_iff.trans <| by rw [ContDiffWithinAtProp, preimage_univ, univ_inter]; rfl
#align cont_mdiff_at_iff contMDiffAt_iff
abbrev SmoothAt (f : M β M') (x : M) :=
ContMDiffAt I I' β€ f x
#align smooth_at SmoothAt
def ContMDiffOn (n : ββ) (f : M β M') (s : Set M) :=
β x β s, ContMDiffWithinAt I I' n f s x
#align cont_mdiff_on ContMDiffOn
abbrev SmoothOn (f : M β M') (s : Set M) :=
ContMDiffOn I I' β€ f s
#align smooth_on SmoothOn
def ContMDiff (n : ββ) (f : M β M') :=
β x, ContMDiffAt I I' n f x
#align cont_mdiff ContMDiff
abbrev Smooth (f : M β M') :=
ContMDiff I I' β€ f
#align smooth Smooth
variable {I I'}
theorem ContMDiffWithinAt.of_le (hf : ContMDiffWithinAt I I' n f s x) (le : m β€ n) :
ContMDiffWithinAt I I' m f s x := by
simp only [ContMDiffWithinAt, LiftPropWithinAt] at hf β’
exact β¨hf.1, hf.2.of_le leβ©
#align cont_mdiff_within_at.of_le ContMDiffWithinAt.of_le
theorem ContMDiffAt.of_le (hf : ContMDiffAt I I' n f x) (le : m β€ n) : ContMDiffAt I I' m f x :=
ContMDiffWithinAt.of_le hf le
#align cont_mdiff_at.of_le ContMDiffAt.of_le
theorem ContMDiffOn.of_le (hf : ContMDiffOn I I' n f s) (le : m β€ n) : ContMDiffOn I I' m f s :=
fun x hx => (hf x hx).of_le le
#align cont_mdiff_on.of_le ContMDiffOn.of_le
theorem ContMDiff.of_le (hf : ContMDiff I I' n f) (le : m β€ n) : ContMDiff I I' m f := fun x =>
(hf x).of_le le
#align cont_mdiff.of_le ContMDiff.of_le
theorem ContMDiff.smooth (h : ContMDiff I I' β€ f) : Smooth I I' f :=
h
#align cont_mdiff.smooth ContMDiff.smooth
theorem Smooth.contMDiff (h : Smooth I I' f) : ContMDiff I I' n f :=
h.of_le le_top
#align smooth.cont_mdiff Smooth.contMDiff
theorem ContMDiffOn.smoothOn (h : ContMDiffOn I I' β€ f s) : SmoothOn I I' f s :=
h
#align cont_mdiff_on.smooth_on ContMDiffOn.smoothOn
theorem SmoothOn.contMDiffOn (h : SmoothOn I I' f s) : ContMDiffOn I I' n f s :=
h.of_le le_top
#align smooth_on.cont_mdiff_on SmoothOn.contMDiffOn
theorem ContMDiffAt.smoothAt (h : ContMDiffAt I I' β€ f x) : SmoothAt I I' f x :=
h
#align cont_mdiff_at.smooth_at ContMDiffAt.smoothAt
theorem SmoothAt.contMDiffAt (h : SmoothAt I I' f x) : ContMDiffAt I I' n f x :=
h.of_le le_top
#align smooth_at.cont_mdiff_at SmoothAt.contMDiffAt
theorem ContMDiffWithinAt.smoothWithinAt (h : ContMDiffWithinAt I I' β€ f s x) :
SmoothWithinAt I I' f s x :=
h
#align cont_mdiff_within_at.smooth_within_at ContMDiffWithinAt.smoothWithinAt
theorem SmoothWithinAt.contMDiffWithinAt (h : SmoothWithinAt I I' f s x) :
ContMDiffWithinAt I I' n f s x :=
h.of_le le_top
#align smooth_within_at.cont_mdiff_within_at SmoothWithinAt.contMDiffWithinAt
theorem ContMDiff.contMDiffAt (h : ContMDiff I I' n f) : ContMDiffAt I I' n f x :=
h x
#align cont_mdiff.cont_mdiff_at ContMDiff.contMDiffAt
theorem Smooth.smoothAt (h : Smooth I I' f) : SmoothAt I I' f x :=
ContMDiff.contMDiffAt h
#align smooth.smooth_at Smooth.smoothAt
theorem contMDiffWithinAt_univ : ContMDiffWithinAt I I' n f univ x β ContMDiffAt I I' n f x :=
Iff.rfl
#align cont_mdiff_within_at_univ contMDiffWithinAt_univ
theorem smoothWithinAt_univ : SmoothWithinAt I I' f univ x β SmoothAt I I' f x :=
contMDiffWithinAt_univ
#align smooth_within_at_univ smoothWithinAt_univ
theorem contMDiffOn_univ : ContMDiffOn I I' n f univ β ContMDiff I I' n f := by
simp only [ContMDiffOn, ContMDiff, contMDiffWithinAt_univ, forall_prop_of_true, mem_univ]
#align cont_mdiff_on_univ contMDiffOn_univ
theorem smoothOn_univ : SmoothOn I I' f univ β Smooth I I' f :=
contMDiffOn_univ
#align smooth_on_univ smoothOn_univ
theorem contMDiffWithinAt_iff :
ContMDiffWithinAt I I' n f s x β
ContinuousWithinAt f s x β§
ContDiffWithinAt π n (extChartAt I' (f x) β f β (extChartAt I x).symm)
((extChartAt I x).symm β»ΒΉ' s β© range I) (extChartAt I x x) := by
simp_rw [ContMDiffWithinAt, liftPropWithinAt_iff']; rfl
#align cont_mdiff_within_at_iff contMDiffWithinAt_iff
theorem contMDiffWithinAt_iff' :
ContMDiffWithinAt I I' n f s x β
ContinuousWithinAt f s x β§
ContDiffWithinAt π n (extChartAt I' (f x) β f β (extChartAt I x).symm)
((extChartAt I x).target β©
(extChartAt I x).symm β»ΒΉ' (s β© f β»ΒΉ' (extChartAt I' (f x)).source))
(extChartAt I x x) := by
simp only [ContMDiffWithinAt, liftPropWithinAt_iff']
exact and_congr_right fun hc => contDiffWithinAt_congr_nhds <|
hc.nhdsWithin_extChartAt_symm_preimage_inter_range I I'
#align cont_mdiff_within_at_iff' contMDiffWithinAt_iff'
theorem contMDiffWithinAt_iff_target :
ContMDiffWithinAt I I' n f s x β
ContinuousWithinAt f s x β§ ContMDiffWithinAt I π(π, E') n (extChartAt I' (f x) β f) s x := by
simp_rw [ContMDiffWithinAt, liftPropWithinAt_iff', β and_assoc]
have cont :
ContinuousWithinAt f s x β§ ContinuousWithinAt (extChartAt I' (f x) β f) s x β
ContinuousWithinAt f s x :=
and_iff_left_of_imp <| (continuousAt_extChartAt _ _).comp_continuousWithinAt
simp_rw [cont, ContDiffWithinAtProp, extChartAt, PartialHomeomorph.extend, PartialEquiv.coe_trans,
ModelWithCorners.toPartialEquiv_coe, PartialHomeomorph.coe_coe, modelWithCornersSelf_coe,
chartAt_self_eq, PartialHomeomorph.refl_apply, id_comp]
rfl
#align cont_mdiff_within_at_iff_target contMDiffWithinAt_iff_target
theorem smoothWithinAt_iff :
SmoothWithinAt I I' f s x β
ContinuousWithinAt f s x β§
ContDiffWithinAt π β (extChartAt I' (f x) β f β (extChartAt I x).symm)
((extChartAt I x).symm β»ΒΉ' s β© range I) (extChartAt I x x) :=
contMDiffWithinAt_iff
#align smooth_within_at_iff smoothWithinAt_iff
theorem smoothWithinAt_iff_target :
SmoothWithinAt I I' f s x β
ContinuousWithinAt f s x β§ SmoothWithinAt I π(π, E') (extChartAt I' (f x) β f) s x :=
contMDiffWithinAt_iff_target
#align smooth_within_at_iff_target smoothWithinAt_iff_target
theorem contMDiffAt_iff_target {x : M} :
ContMDiffAt I I' n f x β
ContinuousAt f x β§ ContMDiffAt I π(π, E') n (extChartAt I' (f x) β f) x := by
rw [ContMDiffAt, ContMDiffAt, contMDiffWithinAt_iff_target, continuousWithinAt_univ]
#align cont_mdiff_at_iff_target contMDiffAt_iff_target
theorem smoothAt_iff_target {x : M} :
SmoothAt I I' f x β ContinuousAt f x β§ SmoothAt I π(π, E') (extChartAt I' (f x) β f) x :=
contMDiffAt_iff_target
#align smooth_at_iff_target smoothAt_iff_target
theorem contMDiffWithinAt_iff_of_mem_maximalAtlas {x : M} (he : e β maximalAtlas I M)
(he' : e' β maximalAtlas I' M') (hx : x β e.source) (hy : f x β e'.source) :
ContMDiffWithinAt I I' n f s x β
ContinuousWithinAt f s x β§
ContDiffWithinAt π n (e'.extend I' β f β (e.extend I).symm)
((e.extend I).symm β»ΒΉ' s β© range I) (e.extend I x) :=
(contDiffWithinAt_localInvariantProp I I' n).liftPropWithinAt_indep_chart he hx he' hy
#align cont_mdiff_within_at_iff_of_mem_maximal_atlas contMDiffWithinAt_iff_of_mem_maximalAtlas
| Mathlib/Geometry/Manifold/ContMDiff/Defs.lean | 399 | 407 | theorem contMDiffWithinAt_iff_image {x : M} (he : e β maximalAtlas I M)
(he' : e' β maximalAtlas I' M') (hs : s β e.source) (hx : x β e.source) (hy : f x β e'.source) :
ContMDiffWithinAt I I' n f s x β
ContinuousWithinAt f s x β§
ContDiffWithinAt π n (e'.extend I' β f β (e.extend I).symm) (e.extend I '' s)
(e.extend I x) := by |
rw [contMDiffWithinAt_iff_of_mem_maximalAtlas he he' hx hy, and_congr_right_iff]
refine fun _ => contDiffWithinAt_congr_nhds ?_
simp_rw [nhdsWithin_eq_iff_eventuallyEq, e.extend_symm_preimage_inter_range_eventuallyEq I hs hx]
|
import Mathlib.Analysis.BoxIntegral.Partition.Basic
#align_import analysis.box_integral.partition.split from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
noncomputable section
open scoped Classical
open Filter
open Function Set Filter
namespace BoxIntegral
variable {ΞΉ M : Type*} {n : β}
namespace Box
variable {I : Box ΞΉ} {i : ΞΉ} {x : β} {y : ΞΉ β β}
def splitLower (I : Box ΞΉ) (i : ΞΉ) (x : β) : WithBot (Box ΞΉ) :=
mk' I.lower (update I.upper i (min x (I.upper i)))
#align box_integral.box.split_lower BoxIntegral.Box.splitLower
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ΞΉ β β)) = βI β© { y | y i β€ x } := by
rw [splitLower, coe_mk']
ext y
simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, β Pi.le_def,
le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j β€ upper I j) i, mem_def]
rw [and_comm (a := y i β€ x)]
#align box_integral.box.coe_split_lower BoxIntegral.Box.coe_splitLower
theorem splitLower_le : I.splitLower i x β€ I :=
withBotCoe_subset_iff.1 <| by simp
#align box_integral.box.split_lower_le BoxIntegral.Box.splitLower_le
@[simp]
theorem splitLower_eq_bot {i x} : I.splitLower i x = β₯ β x β€ I.lower i := by
rw [splitLower, mk'_eq_bot, exists_update_iff I.upper fun j y => y β€ I.lower j]
simp [(I.lower_lt_upper _).not_le]
#align box_integral.box.split_lower_eq_bot BoxIntegral.Box.splitLower_eq_bot
@[simp]
theorem splitLower_eq_self : I.splitLower i x = I β I.upper i β€ x := by
simp [splitLower, update_eq_iff]
#align box_integral.box.split_lower_eq_self BoxIntegral.Box.splitLower_eq_self
theorem splitLower_def [DecidableEq ΞΉ] {i x} (h : x β Ioo (I.lower i) (I.upper i))
(h' : β j, I.lower j < update I.upper i x j :=
(forall_update_iff I.upper fun j y => I.lower j < y).2
β¨h.1, fun j _ => I.lower_lt_upper _β©) :
I.splitLower i x = (β¨I.lower, update I.upper i x, h'β© : Box ΞΉ) := by
simp (config := { unfoldPartialApp := true }) only [splitLower, mk'_eq_coe, min_eq_left h.2.le,
update, and_self]
#align box_integral.box.split_lower_def BoxIntegral.Box.splitLower_def
def splitUpper (I : Box ΞΉ) (i : ΞΉ) (x : β) : WithBot (Box ΞΉ) :=
mk' (update I.lower i (max x (I.lower i))) I.upper
#align box_integral.box.split_upper BoxIntegral.Box.splitUpper
@[simp]
theorem coe_splitUpper : (splitUpper I i x : Set (ΞΉ β β)) = βI β© { y | x < y i } := by
rw [splitUpper, coe_mk']
ext y
simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and,
forall_update_iff I.lower fun j z => z < y j, max_lt_iff, and_assoc (a := x < y i),
and_forall_ne (p := fun j => lower I j < y j) i, mem_def]
exact and_comm
#align box_integral.box.coe_split_upper BoxIntegral.Box.coe_splitUpper
theorem splitUpper_le : I.splitUpper i x β€ I :=
withBotCoe_subset_iff.1 <| by simp
#align box_integral.box.split_upper_le BoxIntegral.Box.splitUpper_le
@[simp]
theorem splitUpper_eq_bot {i x} : I.splitUpper i x = β₯ β I.upper i β€ x := by
rw [splitUpper, mk'_eq_bot, exists_update_iff I.lower fun j y => I.upper j β€ y]
simp [(I.lower_lt_upper _).not_le]
#align box_integral.box.split_upper_eq_bot BoxIntegral.Box.splitUpper_eq_bot
@[simp]
theorem splitUpper_eq_self : I.splitUpper i x = I β x β€ I.lower i := by
simp [splitUpper, update_eq_iff]
#align box_integral.box.split_upper_eq_self BoxIntegral.Box.splitUpper_eq_self
theorem splitUpper_def [DecidableEq ΞΉ] {i x} (h : x β Ioo (I.lower i) (I.upper i))
(h' : β j, update I.lower i x j < I.upper j :=
(forall_update_iff I.lower fun j y => y < I.upper j).2
β¨h.2, fun j _ => I.lower_lt_upper _β©) :
I.splitUpper i x = (β¨update I.lower i x, I.upper, h'β© : Box ΞΉ) := by
simp (config := { unfoldPartialApp := true }) only [splitUpper, mk'_eq_coe, max_eq_left h.1.le,
update, and_self]
#align box_integral.box.split_upper_def BoxIntegral.Box.splitUpper_def
theorem disjoint_splitLower_splitUpper (I : Box ΞΉ) (i : ΞΉ) (x : β) :
Disjoint (I.splitLower i x) (I.splitUpper i x) := by
rw [β disjoint_withBotCoe, coe_splitLower, coe_splitUpper]
refine (Disjoint.inf_left' _ ?_).inf_right' _
rw [Set.disjoint_left]
exact fun y (hle : y i β€ x) hlt => not_lt_of_le hle hlt
#align box_integral.box.disjoint_split_lower_split_upper BoxIntegral.Box.disjoint_splitLower_splitUpper
| Mathlib/Analysis/BoxIntegral/Partition/Split.lean | 147 | 153 | theorem splitLower_ne_splitUpper (I : Box ΞΉ) (i : ΞΉ) (x : β) :
I.splitLower i x β I.splitUpper i x := by |
cases' le_or_lt x (I.lower i) with h
Β· rw [splitUpper_eq_self.2 h, splitLower_eq_bot.2 h]
exact WithBot.bot_ne_coe
Β· refine (disjoint_splitLower_splitUpper I i x).ne ?_
rwa [Ne, splitLower_eq_bot, not_le]
|
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
| Mathlib/Analysis/RCLike/Basic.lean | 532 | 537 | 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
|
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]
| Mathlib/Analysis/Calculus/ContDiff/Basic.lean | 117 | 118 | theorem contDiffWithinAt_of_subsingleton [Subsingleton F] : ContDiffWithinAt π n f s x := by |
rw [Subsingleton.elim f fun _ => 0]; exact contDiffWithinAt_const
|
import Mathlib.Topology.Algebra.UniformConvergence
#align_import topology.algebra.module.strong_topology from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95"
open scoped Topology UniformConvergence
section General
variable {πβ πβ : Type*} [NormedField πβ] [NormedField πβ] (Ο : πβ β+* πβ) {E E' F F' : Type*}
[AddCommGroup E] [Module πβ E] [AddCommGroup E'] [Module β E'] [AddCommGroup F] [Module πβ F]
[AddCommGroup F'] [Module β F'] [TopologicalSpace E] [TopologicalSpace E'] (F)
@[nolint unusedArguments]
def UniformConvergenceCLM [TopologicalSpace F] [TopologicalAddGroup F] (_ : Set (Set E)) :=
E βSL[Ο] F
namespace UniformConvergenceCLM
instance instFunLike [TopologicalSpace F] [TopologicalAddGroup F]
(π : Set (Set E)) : FunLike (UniformConvergenceCLM Ο F π) E F :=
ContinuousLinearMap.funLike
instance instContinuousSemilinearMapClass [TopologicalSpace F] [TopologicalAddGroup F]
(π : Set (Set E)) : ContinuousSemilinearMapClass (UniformConvergenceCLM Ο F π) Ο E F :=
ContinuousLinearMap.continuousSemilinearMapClass
instance instTopologicalSpace [TopologicalSpace F] [TopologicalAddGroup F] (π : Set (Set E)) :
TopologicalSpace (UniformConvergenceCLM Ο F π) :=
(@UniformOnFun.topologicalSpace E F (TopologicalAddGroup.toUniformSpace F) π).induced
(DFunLike.coe : (UniformConvergenceCLM Ο F π) β (E βα΅€[π] F))
#align continuous_linear_map.strong_topology UniformConvergenceCLM.instTopologicalSpace
theorem topologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
instTopologicalSpace Ο F π = TopologicalSpace.induced DFunLike.coe
(UniformOnFun.topologicalSpace E F π) := by
rw [instTopologicalSpace]
congr
exact UniformAddGroup.toUniformSpace_eq
instance instUniformSpace [UniformSpace F] [UniformAddGroup F]
(π : Set (Set E)) : UniformSpace (UniformConvergenceCLM Ο F π) :=
UniformSpace.replaceTopology
((UniformOnFun.uniformSpace E F π).comap
(DFunLike.coe : (UniformConvergenceCLM Ο F π) β (E βα΅€[π] F)))
(by rw [UniformConvergenceCLM.instTopologicalSpace, UniformAddGroup.toUniformSpace_eq]; rfl)
#align continuous_linear_map.strong_uniformity UniformConvergenceCLM.instUniformSpace
theorem uniformSpace_eq [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
instUniformSpace Ο F π = UniformSpace.comap DFunLike.coe (UniformOnFun.uniformSpace E F π) := by
rw [instUniformSpace, UniformSpace.replaceTopology_eq]
@[simp]
theorem uniformity_toTopologicalSpace_eq [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
(UniformConvergenceCLM.instUniformSpace Ο F π).toTopologicalSpace =
UniformConvergenceCLM.instTopologicalSpace Ο F π :=
rfl
#align continuous_linear_map.strong_uniformity_topology_eq UniformConvergenceCLM.uniformity_toTopologicalSpace_eq
theorem uniformEmbedding_coeFn [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
UniformEmbedding (Ξ± := UniformConvergenceCLM Ο F π) (Ξ² := E βα΅€[π] F) DFunLike.coe :=
β¨β¨rflβ©, DFunLike.coe_injectiveβ©
#align continuous_linear_map.strong_uniformity.uniform_embedding_coe_fn UniformConvergenceCLM.uniformEmbedding_coeFn
theorem embedding_coeFn [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
Embedding (X := UniformConvergenceCLM Ο F π) (Y := E βα΅€[π] F)
(UniformOnFun.ofFun π β DFunLike.coe) :=
UniformEmbedding.embedding (uniformEmbedding_coeFn _ _ _)
#align continuous_linear_map.strong_topology.embedding_coe_fn UniformConvergenceCLM.embedding_coeFn
instance instAddCommGroup [TopologicalSpace F] [TopologicalAddGroup F] (π : Set (Set E)) :
AddCommGroup (UniformConvergenceCLM Ο F π) := ContinuousLinearMap.addCommGroup
instance instUniformAddGroup [UniformSpace F] [UniformAddGroup F] (π : Set (Set E)) :
UniformAddGroup (UniformConvergenceCLM Ο F π) := by
let Ο : (UniformConvergenceCLM Ο F π) β+ E βα΅€[π] F :=
β¨β¨(DFunLike.coe : (UniformConvergenceCLM Ο F π) β E βα΅€[π] F), rflβ©, fun _ _ => rflβ©
exact (uniformEmbedding_coeFn _ _ _).uniformAddGroup Ο
#align continuous_linear_map.strong_uniformity.uniform_add_group UniformConvergenceCLM.instUniformAddGroup
instance instTopologicalAddGroup [TopologicalSpace F] [TopologicalAddGroup F]
(π : Set (Set E)) : TopologicalAddGroup (UniformConvergenceCLM Ο F π) := by
letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F
haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform
infer_instance
#align continuous_linear_map.strong_topology.topological_add_group UniformConvergenceCLM.instTopologicalAddGroup
theorem t2Space [TopologicalSpace F] [TopologicalAddGroup F] [T2Space F]
(π : Set (Set E)) (hπ : ββ π = Set.univ) : T2Space (UniformConvergenceCLM Ο F π) := by
letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F
haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform
haveI : T2Space (E βα΅€[π] F) := UniformOnFun.t2Space_of_covering hπ
exact (embedding_coeFn Ο F π).t2Space
#align continuous_linear_map.strong_topology.t2_space UniformConvergenceCLM.t2Space
instance instDistribMulAction (M : Type*) [Monoid M] [DistribMulAction M F] [SMulCommClass πβ M F]
[TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul M F] (π : Set (Set E)) :
DistribMulAction M (UniformConvergenceCLM Ο F π) := ContinuousLinearMap.distribMulAction
instance instModule (R : Type*) [Semiring R] [Module R F] [SMulCommClass πβ R F]
[TopologicalSpace F] [ContinuousConstSMul R F] [TopologicalAddGroup F] (π : Set (Set E)) :
Module R (UniformConvergenceCLM Ο F π) := ContinuousLinearMap.module
| Mathlib/Topology/Algebra/Module/StrongTopology.lean | 168 | 177 | theorem continuousSMul [RingHomSurjective Ο] [RingHomIsometric Ο]
[TopologicalSpace F] [TopologicalAddGroup F] [ContinuousSMul πβ F] (π : Set (Set E))
(hπβ : β S β π, Bornology.IsVonNBounded πβ S) :
ContinuousSMul πβ (UniformConvergenceCLM Ο F π) := by |
letI : UniformSpace F := TopologicalAddGroup.toUniformSpace F
haveI : UniformAddGroup F := comm_topologicalAddGroup_is_uniform
let Ο : (UniformConvergenceCLM Ο F π) ββ[πβ] E β F :=
β¨β¨DFunLike.coe, fun _ _ => rflβ©, fun _ _ => rflβ©
exact UniformOnFun.continuousSMul_induced_of_image_bounded πβ E F (UniformConvergenceCLM Ο F π) Ο
β¨rflβ© fun u s hs => (hπβ s hs).image u
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.