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