Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure import Mathlib.FieldTheory.Galois universe u v w open scoped Classical Polynomial open Polynomial variable (k : Type u) [Field k] (K : Type v) [Field K] class IsSepClosed : Prop where splits_of_separable : ∀ p : k[X], p.Separable → (p.Splits <| RingHom.id k) instance IsSepClosed.of_isAlgClosed [IsAlgClosed k] : IsSepClosed k := ⟨fun p _ ↦ IsAlgClosed.splits p⟩ variable {k} {K} theorem IsSepClosed.splits_codomain [IsSepClosed K] {f : k →+* K} (p : k[X]) (h : p.Separable) : p.Splits f := by convert IsSepClosed.splits_of_separable (p.map f) (Separable.map h); simp [splits_map_iff] theorem IsSepClosed.splits_domain [IsSepClosed k] {f : k →+* K} (p : k[X]) (h : p.Separable) : p.Splits f := Polynomial.splits_of_splits_id _ <| IsSepClosed.splits_of_separable _ h namespace IsSepClosed theorem exists_root [IsSepClosed k] (p : k[X]) (hp : p.degree ≠ 0) (hsep : p.Separable) : ∃ x, IsRoot p x := exists_root_of_splits _ (IsSepClosed.splits_of_separable p hsep) hp variable (k) in instance (priority := 100) isAlgClosed_of_perfectField [IsSepClosed k] [PerfectField k] : IsAlgClosed k := IsAlgClosed.of_exists_root k fun p _ h ↦ exists_root p ((degree_pos_of_irreducible h).ne') (PerfectField.separable_of_irreducible h)
Mathlib/FieldTheory/IsSepClosed.lean
104
116
theorem exists_pow_nat_eq [IsSepClosed k] (x : k) (n : ℕ) [hn : NeZero (n : k)] : ∃ z, z ^ n = x := by
have hn' : 0 < n := Nat.pos_of_ne_zero fun h => by rw [h, Nat.cast_zero] at hn exact hn.out rfl have : degree (X ^ n - C x) ≠ 0 := by rw [degree_X_pow_sub_C hn' x] exact (WithBot.coe_lt_coe.2 hn').ne' by_cases hx : x = 0 · exact ⟨0, by rw [hx, pow_eq_zero_iff hn'.ne']⟩ · obtain ⟨z, hz⟩ := exists_root _ this <| separable_X_pow_sub_C x hn.out hx use z simpa [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def, sub_eq_zero] using hz
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle #align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped EuclideanGeometry open scoped Real open scoped RealInnerProductSpace namespace Orientation open FiniteDimensional variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] variable [hd2 : Fact (finrank ℝ V = 2)] (o : Orientation ℝ V (Fin 2)) theorem oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle (x + y) y = Real.arccos (‖y‖ / ‖x + y‖) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢ rw [add_comm] exact (-o).oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two theorem oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))] #align orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle (x + y) y = Real.arcsin (‖x‖ / ‖x + y‖) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢ rw [add_comm] exact (-o).oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two theorem oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle x (x + y) = Real.arctan (‖y‖ / ‖x‖) := by have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, InnerProductGeometry.angle_add_eq_arctan_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h) (o.left_ne_zero_of_oangle_eq_pi_div_two h)] #align orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two theorem oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : o.oangle (x + y) y = Real.arctan (‖x‖ / ‖y‖) := by rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢ rw [add_comm] exact (-o).oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two h #align orientation.oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two
Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean
91
96
theorem cos_oangle_add_right_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) : Real.Angle.cos (o.oangle x (x + y)) = ‖x‖ / ‖x + y‖ := by
have hs : (o.oangle x (x + y)).sign = 1 := by rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two] rw [o.oangle_eq_angle_of_sign_eq_one hs, Real.Angle.cos_coe, InnerProductGeometry.cos_angle_add_of_inner_eq_zero (o.inner_eq_zero_of_oangle_eq_pi_div_two h)]
import Mathlib.MeasureTheory.Covering.DensityTheorem import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar #align_import measure_theory.covering.one_dim from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" open Set MeasureTheory IsUnifLocDoublingMeasure Filter open scoped Topology namespace Real theorem Icc_mem_vitaliFamily_at_right {x y : ℝ} (hxy : x < y) : Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt x := by rw [Icc_eq_closedBall] refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith) rw [dist_comm, Real.dist_eq, abs_of_nonneg] <;> linarith #align real.Icc_mem_vitali_family_at_right Real.Icc_mem_vitaliFamily_at_right theorem tendsto_Icc_vitaliFamily_right (x : ℝ) : Tendsto (fun y => Icc x y) (𝓝[>] x) ((vitaliFamily (volume : Measure ℝ) 1).filterAt x) := by refine (VitaliFamily.tendsto_filterAt_iff _).2 ⟨?_, ?_⟩ · filter_upwards [self_mem_nhdsWithin] with y hy using Icc_mem_vitaliFamily_at_right hy · intro ε εpos have : x ∈ Ico x (x + ε) := ⟨le_refl _, by linarith⟩ filter_upwards [Icc_mem_nhdsWithin_Ioi this] with y hy rw [closedBall_eq_Icc] exact Icc_subset_Icc (by linarith) hy.2 #align real.tendsto_Icc_vitali_family_right Real.tendsto_Icc_vitaliFamily_right
Mathlib/MeasureTheory/Covering/OneDim.lean
44
48
theorem Icc_mem_vitaliFamily_at_left {x y : ℝ} (hxy : x < y) : Icc x y ∈ (vitaliFamily (volume : Measure ℝ) 1).setsAt y := by
rw [Icc_eq_closedBall] refine closedBall_mem_vitaliFamily_of_dist_le_mul _ ?_ (by linarith) rw [Real.dist_eq, abs_of_nonneg] <;> linarith
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.Factorial.Cast #align_import data.nat.choose.cast from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Nat variable (K : Type*) [DivisionRing K] [CharZero K] namespace Nat theorem cast_choose {a b : ℕ} (h : a ≤ b) : (b.choose a : K) = b ! / (a ! * (b - a)!) := by have : ∀ {n : ℕ}, (n ! : K) ≠ 0 := Nat.cast_ne_zero.2 (factorial_ne_zero _) rw [eq_div_iff_mul_eq (mul_ne_zero this this)] rw_mod_cast [← mul_assoc, choose_mul_factorial_mul_factorial h] #align nat.cast_choose Nat.cast_choose theorem cast_add_choose {a b : ℕ} : ((a + b).choose a : K) = (a + b)! / (a ! * b !) := by rw [cast_choose K (_root_.le_add_right le_rfl), add_tsub_cancel_left] #align nat.cast_add_choose Nat.cast_add_choose theorem cast_choose_eq_ascPochhammer_div (a b : ℕ) : (a.choose b : K) = (ascPochhammer K b).eval ↑(a - (b - 1)) / b ! := by rw [eq_div_iff_mul_eq (cast_ne_zero.2 b.factorial_ne_zero : (b ! : K) ≠ 0), ← cast_mul, mul_comm, ← descFactorial_eq_factorial_mul_choose, ← cast_descFactorial] #align nat.cast_choose_eq_pochhammer_div Nat.cast_choose_eq_ascPochhammer_div
Mathlib/Data/Nat/Choose/Cast.lean
41
43
theorem cast_choose_two (a : ℕ) : (a.choose 2 : K) = a * (a - 1) / 2 := by
rw [← cast_descFactorial_two, descFactorial_eq_factorial_mul_choose, factorial_two, mul_comm, cast_mul, cast_two, eq_div_iff_mul_eq (two_ne_zero : (2 : K) ≠ 0)]
import Mathlib.Algebra.Category.MonCat.Limits import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.ConcreteCategory.Elementwise import Mathlib.CategoryTheory.Limits.TypesFiltered #align_import algebra.category.Mon.filtered_colimits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false universe v u noncomputable section open scoped Classical open CategoryTheory open CategoryTheory.Limits open CategoryTheory.IsFiltered renaming max → max' -- avoid name collision with `_root_.max`. namespace MonCat.FilteredColimits section -- Porting note: mathlib 3 used `parameters` here, mainly so we can have the abbreviations `M` and -- `M.mk` below, without passing around `F` all the time. variable {J : Type v} [SmallCategory J] (F : J ⥤ MonCatMax.{v, u}) @[to_additive "The colimit of `F ⋙ forget AddMon` in the category of types. In the following, we will construct an additive monoid structure on `M`."] abbrev M := Types.Quot (F ⋙ forget MonCat) #align Mon.filtered_colimits.M MonCat.FilteredColimits.M #align AddMon.filtered_colimits.M AddMonCat.FilteredColimits.M @[to_additive "The canonical projection into the colimit, as a quotient type."] noncomputable abbrev M.mk : (Σ j, F.obj j) → M.{v, u} F := Quot.mk _ #align Mon.filtered_colimits.M.mk MonCat.FilteredColimits.M.mk #align AddMon.filtered_colimits.M.mk AddMonCat.FilteredColimits.M.mk @[to_additive] theorem M.mk_eq (x y : Σ j, F.obj j) (h : ∃ (k : J) (f : x.1 ⟶ k) (g : y.1 ⟶ k), F.map f x.2 = F.map g y.2) : M.mk.{v, u} F x = M.mk F y := Quot.EqvGen_sound (Types.FilteredColimit.eqvGen_quot_rel_of_rel (F ⋙ forget MonCat) x y h) #align Mon.filtered_colimits.M.mk_eq MonCat.FilteredColimits.M.mk_eq #align AddMon.filtered_colimits.M.mk_eq AddMonCat.FilteredColimits.M.mk_eq variable [IsFiltered J] @[to_additive "As `J` is nonempty, we can pick an arbitrary object `j₀ : J`. We use this object to define the \"zero\" in the colimit as the equivalence class of `⟨j₀, 0 : F.obj j₀⟩`."] noncomputable instance colimitOne : One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.nonempty.some,1⟩ #align Mon.filtered_colimits.colimit_has_one MonCat.FilteredColimits.colimitOne #align AddMon.filtered_colimits.colimit_has_zero AddMonCat.FilteredColimits.colimitZero @[to_additive "The definition of the \"zero\" in the colimit is independent of the chosen object of `J`. In particular, this lemma allows us to \"unfold\" the definition of `colimit_zero` at a custom chosen object `j`."] theorem colimit_one_eq (j : J) : (1 : M.{v, u} F) = M.mk F ⟨j, 1⟩ := by apply M.mk_eq refine ⟨max' _ j, IsFiltered.leftToMax _ j, IsFiltered.rightToMax _ j, ?_⟩ simp #align Mon.filtered_colimits.colimit_one_eq MonCat.FilteredColimits.colimit_one_eq #align AddMon.filtered_colimits.colimit_zero_eq AddMonCat.FilteredColimits.colimit_zero_eq @[to_additive "The \"unlifted\" version of addition in the colimit. To add two dependent pairs `⟨j₁, x⟩` and `⟨j₂, y⟩`, we pass to a common successor of `j₁` and `j₂` (given by `IsFiltered.max`) and add them there."] noncomputable def colimitMulAux (x y : Σ j, F.obj j) : M.{v, u} F := M.mk F ⟨IsFiltered.max x.fst y.fst, F.map (IsFiltered.leftToMax x.1 y.1) x.2 * F.map (IsFiltered.rightToMax x.1 y.1) y.2⟩ #align Mon.filtered_colimits.colimit_mul_aux MonCat.FilteredColimits.colimitMulAux #align AddMon.filtered_colimits.colimit_add_aux AddMonCat.FilteredColimits.colimitAddAux @[to_additive "Addition in the colimit is well-defined in the left argument."] theorem colimitMulAux_eq_of_rel_left {x x' y : Σ j, F.obj j} (hxx' : Types.FilteredColimit.Rel (F ⋙ forget MonCat) x x') : colimitMulAux.{v, u} F x y = colimitMulAux.{v, u} F x' y := by cases' x with j₁ x; cases' y with j₂ y; cases' x' with j₃ x' obtain ⟨l, f, g, hfg⟩ := hxx' simp? at hfg says simp only [Functor.comp_obj, Functor.comp_map, forget_map] at hfg obtain ⟨s, α, β, γ, h₁, h₂, h₃⟩ := IsFiltered.tulip (IsFiltered.leftToMax j₁ j₂) (IsFiltered.rightToMax j₁ j₂) (IsFiltered.rightToMax j₃ j₂) (IsFiltered.leftToMax j₃ j₂) f g apply M.mk_eq use s, α, γ dsimp simp_rw [MonoidHom.map_mul] -- Porting note: Lean cannot seem to use lemmas from concrete categories directly change (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ = (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ simp_rw [← F.map_comp, h₁, h₂, h₃, F.map_comp] congr 1 change F.map _ (F.map _ _) = F.map _ (F.map _ _) rw [hfg] #align Mon.filtered_colimits.colimit_mul_aux_eq_of_rel_left MonCat.FilteredColimits.colimitMulAux_eq_of_rel_left #align AddMon.filtered_colimits.colimit_add_aux_eq_of_rel_left AddMonCat.FilteredColimits.colimitAddAux_eq_of_rel_left @[to_additive "Addition in the colimit is well-defined in the right argument."]
Mathlib/Algebra/Category/MonCat/FilteredColimits.lean
143
162
theorem colimitMulAux_eq_of_rel_right {x y y' : Σ j, F.obj j} (hyy' : Types.FilteredColimit.Rel (F ⋙ forget MonCat) y y') : colimitMulAux.{v, u} F x y = colimitMulAux.{v, u} F x y' := by
cases' y with j₁ y; cases' x with j₂ x; cases' y' with j₃ y' obtain ⟨l, f, g, hfg⟩ := hyy' simp only [Functor.comp_obj, Functor.comp_map, forget_map] at hfg obtain ⟨s, α, β, γ, h₁, h₂, h₃⟩ := IsFiltered.tulip (IsFiltered.rightToMax j₂ j₁) (IsFiltered.leftToMax j₂ j₁) (IsFiltered.leftToMax j₂ j₃) (IsFiltered.rightToMax j₂ j₃) f g apply M.mk_eq use s, α, γ dsimp simp_rw [MonoidHom.map_mul] -- Porting note: Lean cannot seem to use lemmas from concrete categories directly change (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ = (F.map _ ≫ F.map _) _ * (F.map _ ≫ F.map _) _ simp_rw [← F.map_comp, h₁, h₂, h₃, F.map_comp] congr 1 change F.map _ (F.map _ _) = F.map _ (F.map _ _) rw [hfg]
import Mathlib.Algebra.Algebra.Subalgebra.Basic import Mathlib.Topology.Algebra.Module.Basic import Mathlib.RingTheory.Adjoin.Basic #align_import topology.algebra.algebra from "leanprover-community/mathlib"@"43afc5ad87891456c57b5a183e3e617d67c2b1db" open scoped Classical open Set TopologicalSpace Algebra open scoped Classical universe u v w section TopologicalAlgebra variable {R : Type*} [CommSemiring R] variable {A : Type u} [TopologicalSpace A] variable [Semiring A] [Algebra R A] #align subalgebra.has_continuous_smul SMulMemClass.continuousSMul variable [TopologicalSemiring A] def Subalgebra.topologicalClosure (s : Subalgebra R A) : Subalgebra R A := { s.toSubsemiring.topologicalClosure with carrier := closure (s : Set A) algebraMap_mem' := fun r => s.toSubsemiring.le_topologicalClosure (s.algebraMap_mem r) } #align subalgebra.topological_closure Subalgebra.topologicalClosure @[simp] theorem Subalgebra.topologicalClosure_coe (s : Subalgebra R A) : (s.topologicalClosure : Set A) = closure (s : Set A) := rfl #align subalgebra.topological_closure_coe Subalgebra.topologicalClosure_coe instance Subalgebra.topologicalSemiring (s : Subalgebra R A) : TopologicalSemiring s := s.toSubsemiring.topologicalSemiring #align subalgebra.topological_semiring Subalgebra.topologicalSemiring theorem Subalgebra.le_topologicalClosure (s : Subalgebra R A) : s ≤ s.topologicalClosure := subset_closure #align subalgebra.le_topological_closure Subalgebra.le_topologicalClosure theorem Subalgebra.isClosed_topologicalClosure (s : Subalgebra R A) : IsClosed (s.topologicalClosure : Set A) := by convert @isClosed_closure A s _ #align subalgebra.is_closed_topological_closure Subalgebra.isClosed_topologicalClosure theorem Subalgebra.topologicalClosure_minimal (s : Subalgebra R A) {t : Subalgebra R A} (h : s ≤ t) (ht : IsClosed (t : Set A)) : s.topologicalClosure ≤ t := closure_minimal h ht #align subalgebra.topological_closure_minimal Subalgebra.topologicalClosure_minimal def Subalgebra.commSemiringTopologicalClosure [T2Space A] (s : Subalgebra R A) (hs : ∀ x y : s, x * y = y * x) : CommSemiring s.topologicalClosure := { s.topologicalClosure.toSemiring, s.toSubmonoid.commMonoidTopologicalClosure hs with } #align subalgebra.comm_semiring_topological_closure Subalgebra.commSemiringTopologicalClosure
Mathlib/Topology/Algebra/Algebra.lean
130
137
theorem Subalgebra.topologicalClosure_comap_homeomorph (s : Subalgebra R A) {B : Type*} [TopologicalSpace B] [Ring B] [TopologicalRing B] [Algebra R B] (f : B →ₐ[R] A) (f' : B ≃ₜ A) (w : (f : B → A) = f') : s.topologicalClosure.comap f = (s.comap f).topologicalClosure := by
apply SetLike.ext' simp only [Subalgebra.topologicalClosure_coe] simp only [Subalgebra.coe_comap, Subsemiring.coe_comap, AlgHom.coe_toRingHom] rw [w] exact f'.preimage_closure _
import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.Bicategory.Coherence namespace CategoryTheory namespace Bicategory open Category open scoped Bicategory open Mathlib.Tactic.BicategoryCoherence (bicategoricalComp bicategoricalIsoComp) universe w v u variable {B : Type u} [Bicategory.{w, v} B] {a b c : B} {f : a ⟶ b} {g : b ⟶ a} def leftZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := η ▷ f ⊗≫ f ◁ ε def rightZigzag (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) := g ◁ η ⊗≫ ε ▷ g theorem rightZigzag_idempotent_of_left_triangle (η : 𝟙 a ⟶ f ≫ g) (ε : g ≫ f ⟶ 𝟙 b) (h : leftZigzag η ε = (λ_ _).hom ≫ (ρ_ _).inv) : rightZigzag η ε ⊗≫ rightZigzag η ε = rightZigzag η ε := by dsimp only [rightZigzag] calc _ = g ◁ η ⊗≫ ((ε ▷ g ▷ 𝟙 a) ≫ (𝟙 b ≫ g) ◁ η) ⊗≫ ε ▷ g := by simp [bicategoricalComp]; coherence _ = 𝟙 _ ⊗≫ g ◁ (η ▷ 𝟙 a ≫ (f ≫ g) ◁ η) ⊗≫ (ε ▷ (g ≫ f) ≫ 𝟙 b ◁ ε) ▷ g ⊗≫ 𝟙 _ := by rw [← whisker_exchange]; simp [bicategoricalComp]; coherence _ = g ◁ η ⊗≫ g ◁ leftZigzag η ε ▷ g ⊗≫ ε ▷ g := by rw [← whisker_exchange, ← whisker_exchange]; simp [leftZigzag, bicategoricalComp]; coherence _ = g ◁ η ⊗≫ ε ▷ g := by rw [h]; simp [bicategoricalComp]; coherence structure Adjunction (f : a ⟶ b) (g : b ⟶ a) where unit : 𝟙 a ⟶ f ≫ g counit : g ≫ f ⟶ 𝟙 b left_triangle : leftZigzag unit counit = (λ_ _).hom ≫ (ρ_ _).inv := by aesop_cat right_triangle : rightZigzag unit counit = (ρ_ _).hom ≫ (λ_ _).inv := by aesop_cat @[inherit_doc] scoped infixr:15 " ⊣ " => Bicategory.Adjunction namespace Adjunction attribute [simp] left_triangle right_triangle attribute [local simp] leftZigzag rightZigzag def id (a : B) : 𝟙 a ⊣ 𝟙 a where unit := (ρ_ _).inv counit := (ρ_ _).hom left_triangle := by dsimp; coherence right_triangle := by dsimp; coherence instance : Inhabited (Adjunction (𝟙 a) (𝟙 a)) := ⟨id a⟩ noncomputable section variable (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) def leftZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerRightIso η f ≪⊗≫ whiskerLeftIso f ε def rightZigzagIso (η : 𝟙 a ≅ f ≫ g) (ε : g ≫ f ≅ 𝟙 b) := whiskerLeftIso g η ≪⊗≫ whiskerRightIso ε g attribute [local simp] leftZigzagIso rightZigzagIso leftZigzag rightZigzag @[simp] theorem leftZigzagIso_hom : (leftZigzagIso η ε).hom = leftZigzag η.hom ε.hom := rfl @[simp] theorem rightZigzagIso_hom : (rightZigzagIso η ε).hom = rightZigzag η.hom ε.hom := rfl @[simp] theorem leftZigzagIso_inv : (leftZigzagIso η ε).inv = rightZigzag ε.inv η.inv := by simp [bicategoricalComp, bicategoricalIsoComp] @[simp] theorem rightZigzagIso_inv : (rightZigzagIso η ε).inv = leftZigzag ε.inv η.inv := by simp [bicategoricalComp, bicategoricalIsoComp] @[simp] theorem leftZigzagIso_symm : (leftZigzagIso η ε).symm = rightZigzagIso ε.symm η.symm := Iso.ext (leftZigzagIso_inv η ε) @[simp] theorem rightZigzagIso_symm : (rightZigzagIso η ε).symm = leftZigzagIso ε.symm η.symm := Iso.ext (rightZigzagIso_inv η ε) instance : IsIso (leftZigzag η.hom ε.hom) := inferInstanceAs <| IsIso (leftZigzagIso η ε).hom instance : IsIso (rightZigzag η.hom ε.hom) := inferInstanceAs <| IsIso (rightZigzagIso η ε).hom
Mathlib/CategoryTheory/Bicategory/Adjunction.lean
220
226
theorem right_triangle_of_left_triangle (h : leftZigzag η.hom ε.hom = (λ_ f).hom ≫ (ρ_ f).inv) : rightZigzag η.hom ε.hom = (ρ_ g).hom ≫ (λ_ g).inv := by
rw [← cancel_epi (rightZigzag η.hom ε.hom ≫ (λ_ g).hom ≫ (ρ_ g).inv)] calc _ = rightZigzag η.hom ε.hom ⊗≫ rightZigzag η.hom ε.hom := by coherence _ = rightZigzag η.hom ε.hom := rightZigzag_idempotent_of_left_triangle _ _ h _ = _ := by simp
import Mathlib.RingTheory.WittVector.Truncated import Mathlib.RingTheory.WittVector.Identities import Mathlib.NumberTheory.Padics.RingHoms #align_import ring_theory.witt_vector.compare from "leanprover-community/mathlib"@"168ad7fc5d8173ad38be9767a22d50b8ecf1cd00" noncomputable section variable {p : ℕ} [hp : Fact p.Prime] local notation "𝕎" => WittVector p namespace TruncatedWittVector variable (p) (n : ℕ) (R : Type*) [CommRing R] theorem eq_of_le_of_cast_pow_eq_zero [CharP R p] (i : ℕ) (hin : i ≤ n) (hpi : (p : TruncatedWittVector p n R) ^ i = 0) : i = n := by contrapose! hpi replace hin := lt_of_le_of_ne hin hpi; clear hpi have : (p : TruncatedWittVector p n R) ^ i = WittVector.truncate n ((p : 𝕎 R) ^ i) := by rw [RingHom.map_pow, map_natCast] rw [this, ne_eq, ext_iff, not_forall]; clear this use ⟨i, hin⟩ rw [WittVector.coeff_truncate, coeff_zero, Fin.val_mk, WittVector.coeff_p_pow] haveI : Nontrivial R := CharP.nontrivial_of_char_ne_one hp.1.ne_one exact one_ne_zero #align truncated_witt_vector.eq_of_le_of_cast_pow_eq_zero TruncatedWittVector.eq_of_le_of_cast_pow_eq_zero section Iso variable {R} theorem card_zmod : Fintype.card (TruncatedWittVector p n (ZMod p)) = p ^ n := by rw [card, ZMod.card] #align truncated_witt_vector.card_zmod TruncatedWittVector.card_zmod theorem charP_zmod : CharP (TruncatedWittVector p n (ZMod p)) (p ^ n) := charP_of_prime_pow_injective _ _ _ (card_zmod _ _) (eq_of_le_of_cast_pow_eq_zero p n (ZMod p)) #align truncated_witt_vector.char_p_zmod TruncatedWittVector.charP_zmod attribute [local instance] charP_zmod def zmodEquivTrunc : ZMod (p ^ n) ≃+* TruncatedWittVector p n (ZMod p) := ZMod.ringEquiv (TruncatedWittVector p n (ZMod p)) (card_zmod _ _) #align truncated_witt_vector.zmod_equiv_trunc TruncatedWittVector.zmodEquivTrunc theorem zmodEquivTrunc_apply {x : ZMod (p ^ n)} : zmodEquivTrunc p n x = ZMod.castHom (by rfl) (TruncatedWittVector p n (ZMod p)) x := rfl #align truncated_witt_vector.zmod_equiv_trunc_apply TruncatedWittVector.zmodEquivTrunc_apply theorem commutes {m : ℕ} (hm : n ≤ m) : (truncate hm).comp (zmodEquivTrunc p m).toRingHom = (zmodEquivTrunc p n).toRingHom.comp (ZMod.castHom (pow_dvd_pow p hm) _) := RingHom.ext_zmod _ _ #align truncated_witt_vector.commutes TruncatedWittVector.commutes theorem commutes' {m : ℕ} (hm : n ≤ m) (x : ZMod (p ^ m)) : truncate hm (zmodEquivTrunc p m x) = zmodEquivTrunc p n (ZMod.castHom (pow_dvd_pow p hm) _ x) := show (truncate hm).comp (zmodEquivTrunc p m).toRingHom x = _ by rw [commutes _ _ hm]; rfl #align truncated_witt_vector.commutes' TruncatedWittVector.commutes' theorem commutes_symm' {m : ℕ} (hm : n ≤ m) (x : TruncatedWittVector p m (ZMod p)) : (zmodEquivTrunc p n).symm (truncate hm x) = ZMod.castHom (pow_dvd_pow p hm) _ ((zmodEquivTrunc p m).symm x) := by apply (zmodEquivTrunc p n).injective rw [← commutes' _ _ hm] simp #align truncated_witt_vector.commutes_symm' TruncatedWittVector.commutes_symm'
Mathlib/RingTheory/WittVector/Compare.lean
127
130
theorem commutes_symm {m : ℕ} (hm : n ≤ m) : (zmodEquivTrunc p n).symm.toRingHom.comp (truncate hm) = (ZMod.castHom (pow_dvd_pow p hm) _).comp (zmodEquivTrunc p m).symm.toRingHom := by
ext; apply commutes_symm'
import Batteries.Data.List.Basic namespace Batteries inductive AssocList (α : Type u) (β : Type v) where | nil | cons (key : α) (value : β) (tail : AssocList α β) deriving Inhabited namespace AssocList @[simp] def toList : AssocList α β → List (α × β) | nil => [] | cons a b es => (a, b) :: es.toList instance : EmptyCollection (AssocList α β) := ⟨nil⟩ @[simp] theorem empty_eq : (∅ : AssocList α β) = nil := rfl def isEmpty : AssocList α β → Bool | nil => true | _ => false @[simp] theorem isEmpty_eq (l : AssocList α β) : isEmpty l = l.toList.isEmpty := by cases l <;> simp [*, isEmpty, List.isEmpty] def length (L : AssocList α β) : Nat := match L with | .nil => 0 | .cons _ _ t => t.length + 1 @[simp] theorem length_nil : length (nil : AssocList α β) = 0 := rfl @[simp] theorem length_cons : length (cons a b t) = length t + 1 := rfl theorem length_toList (l : AssocList α β) : l.toList.length = l.length := by induction l <;> simp_all @[specialize] def foldlM [Monad m] (f : δ → α → β → m δ) : (init : δ) → AssocList α β → m δ | d, nil => pure d | d, cons a b es => do foldlM f (← f d a b) es @[simp] theorem foldlM_eq [Monad m] (f : δ → α → β → m δ) (init l) : foldlM f init l = l.toList.foldlM (fun d (a, b) => f d a b) init := by induction l generalizing init <;> simp [*, foldlM] @[inline] def foldl (f : δ → α → β → δ) (init : δ) (as : AssocList α β) : δ := Id.run (foldlM f init as) @[simp] theorem foldl_eq (f : δ → α → β → δ) (init l) : foldl f init l = l.toList.foldl (fun d (a, b) => f d a b) init := by simp [List.foldl_eq_foldlM, foldl, Id.run] def toListTR (as : AssocList α β) : List (α × β) := as.foldl (init := #[]) (fun r a b => r.push (a, b)) |>.toList @[csimp] theorem toList_eq_toListTR : @toList = @toListTR := by funext α β as; simp [toListTR] exact .symm <| (Array.foldl_data_eq_map (toList as) _ id).trans (List.map_id _) @[specialize] def forM [Monad m] (f : α → β → m PUnit) : AssocList α β → m PUnit | nil => pure ⟨⟩ | cons a b es => do f a b; forM f es @[simp] theorem forM_eq [Monad m] (f : α → β → m PUnit) (l) : forM f l = l.toList.forM (fun (a, b) => f a b) := by induction l <;> simp [*, forM] @[simp] def mapKey (f : α → δ) : AssocList α β → AssocList δ β | nil => nil | cons k v t => cons (f k) v (mapKey f t) @[simp] theorem toList_mapKey (f : α → δ) (l : AssocList α β) : (mapKey f l).toList = l.toList.map (fun (a, b) => (f a, b)) := by induction l <;> simp [*] @[simp] theorem length_mapKey : (mapKey f l).length = l.length := by induction l <;> simp_all @[simp] def mapVal (f : α → β → δ) : AssocList α β → AssocList α δ | nil => nil | cons k v t => cons k (f k v) (mapVal f t) @[simp] theorem toList_mapVal (f : α → β → δ) (l : AssocList α β) : (mapVal f l).toList = l.toList.map (fun (a, b) => (a, f a b)) := by induction l <;> simp [*] @[simp] theorem length_mapVal : (mapVal f l).length = l.length := by induction l <;> simp_all @[specialize] def findEntryP? (p : α → β → Bool) : AssocList α β → Option (α × β) | nil => none | cons k v es => bif p k v then some (k, v) else findEntryP? p es @[simp] theorem findEntryP?_eq (p : α → β → Bool) (l : AssocList α β) : findEntryP? p l = l.toList.find? fun (a, b) => p a b := by induction l <;> simp [findEntryP?, List.find?_cons]; split <;> simp [*] @[inline] def findEntry? [BEq α] (a : α) (l : AssocList α β) : Option (α × β) := findEntryP? (fun k _ => k == a) l @[simp] theorem findEntry?_eq [BEq α] (a : α) (l : AssocList α β) : findEntry? a l = l.toList.find? (·.1 == a) := findEntryP?_eq .. def find? [BEq α] (a : α) : AssocList α β → Option β | nil => none | cons k v es => match k == a with | true => some v | false => find? a es
.lake/packages/batteries/Batteries/Data/AssocList.lean
139
141
theorem find?_eq_findEntry? [BEq α] (a : α) (l : AssocList α β) : find? a l = (l.findEntry? a).map (·.2) := by
induction l <;> simp [find?, List.find?_cons]; split <;> simp [*]
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]
Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean
52
53
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
coherence
import Mathlib.Algebra.Module.Equiv import Mathlib.Data.DFinsupp.Basic import Mathlib.Data.Finsupp.Basic #align_import data.finsupp.to_dfinsupp from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" variable {ι : Type*} {R : Type*} {M : Type*} section Defs def Finsupp.toDFinsupp [Zero M] (f : ι →₀ M) : Π₀ _ : ι, M where toFun := f support' := Trunc.mk ⟨f.support.1, fun i => (Classical.em (f i = 0)).symm.imp_left Finsupp.mem_support_iff.mpr⟩ #align finsupp.to_dfinsupp Finsupp.toDFinsupp @[simp] theorem Finsupp.toDFinsupp_coe [Zero M] (f : ι →₀ M) : ⇑f.toDFinsupp = f := rfl #align finsupp.to_dfinsupp_coe Finsupp.toDFinsupp_coe section variable [DecidableEq ι] [Zero M] @[simp] theorem Finsupp.toDFinsupp_single (i : ι) (m : M) : (Finsupp.single i m).toDFinsupp = DFinsupp.single i m := by ext simp [Finsupp.single_apply, DFinsupp.single_apply] #align finsupp.to_dfinsupp_single Finsupp.toDFinsupp_single variable [∀ m : M, Decidable (m ≠ 0)] @[simp] theorem toDFinsupp_support (f : ι →₀ M) : f.toDFinsupp.support = f.support := by ext simp #align to_dfinsupp_support toDFinsupp_support def DFinsupp.toFinsupp (f : Π₀ _ : ι, M) : ι →₀ M := ⟨f.support, f, fun i => by simp only [DFinsupp.mem_support_iff]⟩ #align dfinsupp.to_finsupp DFinsupp.toFinsupp @[simp] theorem DFinsupp.toFinsupp_coe (f : Π₀ _ : ι, M) : ⇑f.toFinsupp = f := rfl #align dfinsupp.to_finsupp_coe DFinsupp.toFinsupp_coe @[simp] theorem DFinsupp.toFinsupp_support (f : Π₀ _ : ι, M) : f.toFinsupp.support = f.support := by ext simp #align dfinsupp.to_finsupp_support DFinsupp.toFinsupp_support @[simp]
Mathlib/Data/Finsupp/ToDFinsupp.lean
123
126
theorem DFinsupp.toFinsupp_single (i : ι) (m : M) : (DFinsupp.single i m : Π₀ _ : ι, M).toFinsupp = Finsupp.single i m := by
ext simp [Finsupp.single_apply, DFinsupp.single_apply]
import Mathlib.Data.Fin.Tuple.Basic import Mathlib.Data.List.Join #align_import data.list.of_fn from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" universe u variable {α : Type u} open Nat namespace List #noalign list.length_of_fn_aux @[simp] theorem length_ofFn_go {n} (f : Fin n → α) (i j h) : length (ofFn.go f i j h) = i := by induction i generalizing j <;> simp_all [ofFn.go] @[simp] theorem length_ofFn {n} (f : Fin n → α) : length (ofFn f) = n := by simp [ofFn, length_ofFn_go] #align list.length_of_fn List.length_ofFn #noalign list.nth_of_fn_aux theorem get_ofFn_go {n} (f : Fin n → α) (i j h) (k) (hk) : get (ofFn.go f i j h) ⟨k, hk⟩ = f ⟨j + k, by simp at hk; omega⟩ := by let i+1 := i cases k <;> simp [ofFn.go, get_ofFn_go (i := i)] congr 2; omega -- Porting note (#10756): new theorem @[simp] theorem get_ofFn {n} (f : Fin n → α) (i) : get (ofFn f) i = f (Fin.cast (by simp) i) := by cases i; simp [ofFn, get_ofFn_go] @[simp] theorem get?_ofFn {n} (f : Fin n → α) (i) : get? (ofFn f) i = ofFnNthVal f i := if h : i < (ofFn f).length then by rw [get?_eq_get h, get_ofFn] · simp only [length_ofFn] at h; simp [ofFnNthVal, h] else by rw [ofFnNthVal, dif_neg] <;> simpa using h #align list.nth_of_fn List.get?_ofFn set_option linter.deprecated false in @[deprecated get_ofFn (since := "2023-01-17")] theorem nthLe_ofFn {n} (f : Fin n → α) (i : Fin n) : nthLe (ofFn f) i ((length_ofFn f).symm ▸ i.2) = f i := by simp [nthLe] #align list.nth_le_of_fn List.nthLe_ofFn set_option linter.deprecated false in @[simp, deprecated get_ofFn (since := "2023-01-17")] theorem nthLe_ofFn' {n} (f : Fin n → α) {i : ℕ} (h : i < (ofFn f).length) : nthLe (ofFn f) i h = f ⟨i, length_ofFn f ▸ h⟩ := nthLe_ofFn f ⟨i, length_ofFn f ▸ h⟩ #align list.nth_le_of_fn' List.nthLe_ofFn' @[simp] theorem map_ofFn {β : Type*} {n : ℕ} (f : Fin n → α) (g : α → β) : map g (ofFn f) = ofFn (g ∘ f) := ext_get (by simp) fun i h h' => by simp #align list.map_of_fn List.map_ofFn -- Porting note: we don't have Array' in mathlib4 -- -- theorem array_eq_of_fn {n} (a : Array' n α) : a.toList = ofFn a.read := -- by -- suffices ∀ {m h l}, DArray.revIterateAux a (fun i => cons) m h l = -- ofFnAux (DArray.read a) m h l -- from this -- intros; induction' m with m IH generalizing l; · rfl -- simp only [DArray.revIterateAux, of_fn_aux, IH] -- #align list.array_eq_of_fn List.array_eq_of_fn @[congr] theorem ofFn_congr {m n : ℕ} (h : m = n) (f : Fin m → α) : ofFn f = ofFn fun i : Fin n => f (Fin.cast h.symm i) := by subst h simp_rw [Fin.cast_refl, id] #align list.of_fn_congr List.ofFn_congr @[simp] theorem ofFn_zero (f : Fin 0 → α) : ofFn f = [] := ext_get (by simp) (fun i hi₁ hi₂ => by contradiction) #align list.of_fn_zero List.ofFn_zero @[simp] theorem ofFn_succ {n} (f : Fin (succ n) → α) : ofFn f = f 0 :: ofFn fun i => f i.succ := ext_get (by simp) (fun i hi₁ hi₂ => by cases i · simp; rfl · simp) #align list.of_fn_succ List.ofFn_succ
Mathlib/Data/List/OfFn.lean
125
131
theorem ofFn_succ' {n} (f : Fin (succ n) → α) : ofFn f = (ofFn fun i => f (Fin.castSucc i)).concat (f (Fin.last _)) := by
induction' n with n IH · rw [ofFn_zero, concat_nil, ofFn_succ, ofFn_zero] rfl · rw [ofFn_succ, IH, ofFn_succ, concat_cons, Fin.castSucc_zero] congr
import Mathlib.Data.Matrix.PEquiv import Mathlib.Data.Set.Card import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Trace open BigOperators Matrix Equiv variable {n R : Type*} [DecidableEq n] [Fintype n] (σ : Perm n) variable (R) in abbrev Equiv.Perm.permMatrix [Zero R] [One R] : Matrix n n R := σ.toPEquiv.toMatrix namespace Matrix @[simp] theorem det_permutation [CommRing R] : det (σ.permMatrix R) = Perm.sign σ := by rw [← Matrix.mul_one (σ.permMatrix R), PEquiv.toPEquiv_mul_matrix, det_permute, det_one, mul_one] #align matrix.det_permutation Matrix.det_permutation
Mathlib/LinearAlgebra/Matrix/Permutation.lean
47
50
theorem trace_permutation [AddCommMonoidWithOne R] : trace (σ.permMatrix R) = (Function.fixedPoints σ).ncard := by
delta trace simp [toPEquiv_apply, ← Set.ncard_coe_Finset, Function.fixedPoints, Function.IsFixedPt]
import Mathlib.Data.Finset.Fold import Mathlib.Algebra.GCDMonoid.Multiset #align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" #align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d" variable {ι α β γ : Type*} namespace Finset open Multiset variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] section gcd def gcd (s : Finset β) (f : β → α) : α := s.fold GCDMonoid.gcd 0 f #align finset.gcd Finset.gcd variable {s s₁ s₂ : Finset β} {f : β → α} theorem gcd_def : s.gcd f = (s.1.map f).gcd := rfl #align finset.gcd_def Finset.gcd_def @[simp] theorem gcd_empty : (∅ : Finset β).gcd f = 0 := fold_empty #align finset.gcd_empty Finset.gcd_empty theorem dvd_gcd_iff {a : α} : a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b := by apply Iff.trans Multiset.dvd_gcd 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.dvd_gcd_iff Finset.dvd_gcd_iff theorem gcd_dvd {b : β} (hb : b ∈ s) : s.gcd f ∣ f b := dvd_gcd_iff.1 dvd_rfl _ hb #align finset.gcd_dvd Finset.gcd_dvd theorem dvd_gcd {a : α} : (∀ b ∈ s, a ∣ f b) → a ∣ s.gcd f := dvd_gcd_iff.2 #align finset.dvd_gcd Finset.dvd_gcd @[simp] theorem gcd_insert [DecidableEq β] {b : β} : (insert b s : Finset β).gcd f = GCDMonoid.gcd (f b) (s.gcd f) := by by_cases h : b ∈ s · rw [insert_eq_of_mem h, (gcd_eq_right_iff (f b) (s.gcd f) (Multiset.normalize_gcd (s.1.map f))).2 (gcd_dvd h)] apply fold_insert h #align finset.gcd_insert Finset.gcd_insert @[simp] theorem gcd_singleton {b : β} : ({b} : Finset β).gcd f = normalize (f b) := Multiset.gcd_singleton #align finset.gcd_singleton Finset.gcd_singleton -- Porting note: Priority changed for `simpNF` @[simp 1100] theorem normalize_gcd : normalize (s.gcd f) = s.gcd f := by simp [gcd_def] #align finset.normalize_gcd Finset.normalize_gcd theorem gcd_union [DecidableEq β] : (s₁ ∪ s₂).gcd f = GCDMonoid.gcd (s₁.gcd f) (s₂.gcd f) := Finset.induction_on s₁ (by rw [empty_union, gcd_empty, gcd_zero_left, normalize_gcd]) fun a s _ ih ↦ by rw [insert_union, gcd_insert, gcd_insert, ih, gcd_assoc] #align finset.gcd_union Finset.gcd_union theorem gcd_congr {f g : β → α} (hs : s₁ = s₂) (hfg : ∀ a ∈ s₂, f a = g a) : s₁.gcd f = s₂.gcd g := by subst hs exact Finset.fold_congr hfg #align finset.gcd_congr Finset.gcd_congr theorem gcd_mono_fun {g : β → α} (h : ∀ b ∈ s, f b ∣ g b) : s.gcd f ∣ s.gcd g := dvd_gcd fun b hb ↦ (gcd_dvd hb).trans (h b hb) #align finset.gcd_mono_fun Finset.gcd_mono_fun theorem gcd_mono (h : s₁ ⊆ s₂) : s₂.gcd f ∣ s₁.gcd f := dvd_gcd fun _ hb ↦ gcd_dvd (h hb) #align finset.gcd_mono Finset.gcd_mono theorem gcd_image [DecidableEq β] {g : γ → β} (s : Finset γ) : (s.image g).gcd f = s.gcd (f ∘ g) := by classical induction' s using Finset.induction with c s _ ih <;> simp [*] #align finset.gcd_image Finset.gcd_image theorem gcd_eq_gcd_image [DecidableEq α] : s.gcd f = (s.image f).gcd id := Eq.symm <| gcd_image _ #align finset.gcd_eq_gcd_image Finset.gcd_eq_gcd_image
Mathlib/Algebra/GCDMonoid/Finset.lean
212
223
theorem gcd_eq_zero_iff : s.gcd f = 0 ↔ ∀ x : β, x ∈ s → f x = 0 := by
rw [gcd_def, Multiset.gcd_eq_zero_iff] constructor <;> intro h · intro b bs apply h (f b) simp only [Multiset.mem_map, mem_def.1 bs] use b simp only [mem_def.1 bs, eq_self_iff_true, and_self] · intro a as rw [Multiset.mem_map] at as rcases as with ⟨b, ⟨bs, rfl⟩⟩ apply h b (mem_def.1 bs)
import Mathlib.Analysis.Complex.Basic import Mathlib.Topology.FiberBundle.IsHomeomorphicTrivialBundle #align_import analysis.complex.re_im_topology from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" open Set noncomputable section namespace Complex theorem isHomeomorphicTrivialFiberBundle_re : IsHomeomorphicTrivialFiberBundle ℝ re := ⟨equivRealProdCLM.toHomeomorph, fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_re Complex.isHomeomorphicTrivialFiberBundle_re theorem isHomeomorphicTrivialFiberBundle_im : IsHomeomorphicTrivialFiberBundle ℝ im := ⟨equivRealProdCLM.toHomeomorph.trans (Homeomorph.prodComm ℝ ℝ), fun _ => rfl⟩ #align complex.is_homeomorphic_trivial_fiber_bundle_im Complex.isHomeomorphicTrivialFiberBundle_im theorem isOpenMap_re : IsOpenMap re := isHomeomorphicTrivialFiberBundle_re.isOpenMap_proj #align complex.is_open_map_re Complex.isOpenMap_re theorem isOpenMap_im : IsOpenMap im := isHomeomorphicTrivialFiberBundle_im.isOpenMap_proj #align complex.is_open_map_im Complex.isOpenMap_im theorem quotientMap_re : QuotientMap re := isHomeomorphicTrivialFiberBundle_re.quotientMap_proj #align complex.quotient_map_re Complex.quotientMap_re theorem quotientMap_im : QuotientMap im := isHomeomorphicTrivialFiberBundle_im.quotientMap_proj #align complex.quotient_map_im Complex.quotientMap_im theorem interior_preimage_re (s : Set ℝ) : interior (re ⁻¹' s) = re ⁻¹' interior s := (isOpenMap_re.preimage_interior_eq_interior_preimage continuous_re _).symm #align complex.interior_preimage_re Complex.interior_preimage_re theorem interior_preimage_im (s : Set ℝ) : interior (im ⁻¹' s) = im ⁻¹' interior s := (isOpenMap_im.preimage_interior_eq_interior_preimage continuous_im _).symm #align complex.interior_preimage_im Complex.interior_preimage_im theorem closure_preimage_re (s : Set ℝ) : closure (re ⁻¹' s) = re ⁻¹' closure s := (isOpenMap_re.preimage_closure_eq_closure_preimage continuous_re _).symm #align complex.closure_preimage_re Complex.closure_preimage_re theorem closure_preimage_im (s : Set ℝ) : closure (im ⁻¹' s) = im ⁻¹' closure s := (isOpenMap_im.preimage_closure_eq_closure_preimage continuous_im _).symm #align complex.closure_preimage_im Complex.closure_preimage_im theorem frontier_preimage_re (s : Set ℝ) : frontier (re ⁻¹' s) = re ⁻¹' frontier s := (isOpenMap_re.preimage_frontier_eq_frontier_preimage continuous_re _).symm #align complex.frontier_preimage_re Complex.frontier_preimage_re theorem frontier_preimage_im (s : Set ℝ) : frontier (im ⁻¹' s) = im ⁻¹' frontier s := (isOpenMap_im.preimage_frontier_eq_frontier_preimage continuous_im _).symm #align complex.frontier_preimage_im Complex.frontier_preimage_im @[simp] theorem interior_setOf_re_le (a : ℝ) : interior { z : ℂ | z.re ≤ a } = { z | z.re < a } := by simpa only [interior_Iic] using interior_preimage_re (Iic a) #align complex.interior_set_of_re_le Complex.interior_setOf_re_le @[simp] theorem interior_setOf_im_le (a : ℝ) : interior { z : ℂ | z.im ≤ a } = { z | z.im < a } := by simpa only [interior_Iic] using interior_preimage_im (Iic a) #align complex.interior_set_of_im_le Complex.interior_setOf_im_le @[simp] theorem interior_setOf_le_re (a : ℝ) : interior { z : ℂ | a ≤ z.re } = { z | a < z.re } := by simpa only [interior_Ici] using interior_preimage_re (Ici a) #align complex.interior_set_of_le_re Complex.interior_setOf_le_re @[simp] theorem interior_setOf_le_im (a : ℝ) : interior { z : ℂ | a ≤ z.im } = { z | a < z.im } := by simpa only [interior_Ici] using interior_preimage_im (Ici a) #align complex.interior_set_of_le_im Complex.interior_setOf_le_im @[simp] theorem closure_setOf_re_lt (a : ℝ) : closure { z : ℂ | z.re < a } = { z | z.re ≤ a } := by simpa only [closure_Iio] using closure_preimage_re (Iio a) #align complex.closure_set_of_re_lt Complex.closure_setOf_re_lt @[simp] theorem closure_setOf_im_lt (a : ℝ) : closure { z : ℂ | z.im < a } = { z | z.im ≤ a } := by simpa only [closure_Iio] using closure_preimage_im (Iio a) #align complex.closure_set_of_im_lt Complex.closure_setOf_im_lt @[simp] theorem closure_setOf_lt_re (a : ℝ) : closure { z : ℂ | a < z.re } = { z | a ≤ z.re } := by simpa only [closure_Ioi] using closure_preimage_re (Ioi a) #align complex.closure_set_of_lt_re Complex.closure_setOf_lt_re @[simp] theorem closure_setOf_lt_im (a : ℝ) : closure { z : ℂ | a < z.im } = { z | a ≤ z.im } := by simpa only [closure_Ioi] using closure_preimage_im (Ioi a) #align complex.closure_set_of_lt_im Complex.closure_setOf_lt_im @[simp] theorem frontier_setOf_re_le (a : ℝ) : frontier { z : ℂ | z.re ≤ a } = { z | z.re = a } := by simpa only [frontier_Iic] using frontier_preimage_re (Iic a) #align complex.frontier_set_of_re_le Complex.frontier_setOf_re_le @[simp]
Mathlib/Analysis/Complex/ReImTopology.lean
139
140
theorem frontier_setOf_im_le (a : ℝ) : frontier { z : ℂ | z.im ≤ a } = { z | z.im = a } := by
simpa only [frontier_Iic] using frontier_preimage_im (Iic a)
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique
Mathlib/FieldTheory/Minpoly/Field.lean
68
76
theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by
by_cases hp0 : p = 0 · simp only [hp0, dvd_zero] have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩ rw [← modByMonic_eq_zero_iff_dvd (monic hx)] by_contra hnz apply degree_le_of_ne_zero A x hnz ((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt exact degree_modByMonic_lt _ (monic hx)
import Mathlib.Probability.ProbabilityMassFunction.Monad #align_import probability.probability_mass_function.constructions from "leanprover-community/mathlib"@"4ac69b290818724c159de091daa3acd31da0ee6d" universe u namespace PMF noncomputable section variable {α β γ : Type*} open scoped Classical open NNReal ENNReal section Map def map (f : α → β) (p : PMF α) : PMF β := bind p (pure ∘ f) #align pmf.map PMF.map variable (f : α → β) (p : PMF α) (b : β) theorem monad_map_eq_map {α β : Type u} (f : α → β) (p : PMF α) : f <$> p = p.map f := rfl #align pmf.monad_map_eq_map PMF.monad_map_eq_map @[simp] theorem map_apply : (map f p) b = ∑' a, if b = f a then p a else 0 := by simp [map] #align pmf.map_apply PMF.map_apply @[simp] theorem support_map : (map f p).support = f '' p.support := Set.ext fun b => by simp [map, @eq_comm β b] #align pmf.support_map PMF.support_map theorem mem_support_map_iff : b ∈ (map f p).support ↔ ∃ a ∈ p.support, f a = b := by simp #align pmf.mem_support_map_iff PMF.mem_support_map_iff theorem bind_pure_comp : bind p (pure ∘ f) = map f p := rfl #align pmf.bind_pure_comp PMF.bind_pure_comp theorem map_id : map id p = p := bind_pure _ #align pmf.map_id PMF.map_id theorem map_comp (g : β → γ) : (p.map f).map g = p.map (g ∘ f) := by simp [map, Function.comp] #align pmf.map_comp PMF.map_comp theorem pure_map (a : α) : (pure a).map f = pure (f a) := pure_bind _ _ #align pmf.pure_map PMF.pure_map theorem map_bind (q : α → PMF β) (f : β → γ) : (p.bind q).map f = p.bind fun a => (q a).map f := bind_bind _ _ _ #align pmf.map_bind PMF.map_bind @[simp] theorem bind_map (p : PMF α) (f : α → β) (q : β → PMF γ) : (p.map f).bind q = p.bind (q ∘ f) := (bind_bind _ _ _).trans (congr_arg _ (funext fun _ => pure_bind _ _)) #align pmf.bind_map PMF.bind_map @[simp] theorem map_const : p.map (Function.const α b) = pure b := by simp only [map, Function.comp, bind_const, Function.const] #align pmf.map_const PMF.map_const section Measure variable (s : Set β) @[simp] theorem toOuterMeasure_map_apply : (p.map f).toOuterMeasure s = p.toOuterMeasure (f ⁻¹' s) := by simp [map, Set.indicator, toOuterMeasure_apply p (f ⁻¹' s)] #align pmf.to_outer_measure_map_apply PMF.toOuterMeasure_map_apply @[simp]
Mathlib/Probability/ProbabilityMassFunction/Constructions.lean
101
105
theorem toMeasure_map_apply [MeasurableSpace α] [MeasurableSpace β] (hf : Measurable f) (hs : MeasurableSet s) : (p.map f).toMeasure s = p.toMeasure (f ⁻¹' s) := by
rw [toMeasure_apply_eq_toOuterMeasure_apply _ s hs, toMeasure_apply_eq_toOuterMeasure_apply _ (f ⁻¹' s) (measurableSet_preimage hf hs)] exact toOuterMeasure_map_apply f p s
import Mathlib.RingTheory.WittVector.Domain import Mathlib.RingTheory.WittVector.MulCoeff import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.Tactic.LinearCombination #align_import ring_theory.witt_vector.discrete_valuation_ring from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" noncomputable section namespace WittVector variable {p : ℕ} [hp : Fact p.Prime] local notation "𝕎" => WittVector p section PerfectRing variable {k : Type*} [CommRing k] [CharP k p] [PerfectRing k p]
Mathlib/RingTheory/WittVector/DiscreteValuationRing.lean
121
135
theorem exists_eq_pow_p_mul (a : 𝕎 k) (ha : a ≠ 0) : ∃ (m : ℕ) (b : 𝕎 k), b.coeff 0 ≠ 0 ∧ a = (p : 𝕎 k) ^ m * b := by
obtain ⟨m, c, hc, hcm⟩ := WittVector.verschiebung_nonzero ha obtain ⟨b, rfl⟩ := (frobenius_bijective p k).surjective.iterate m c rw [WittVector.iterate_frobenius_coeff] at hc have := congr_fun (WittVector.verschiebung_frobenius_comm.comp_iterate m) b simp only [Function.comp_apply] at this rw [← this] at hcm refine ⟨m, b, ?_, ?_⟩ · contrapose! hc simp [hc, zero_pow $ pow_ne_zero _ hp.out.ne_zero] · simp_rw [← mul_left_iterate (p : 𝕎 k) m] convert hcm using 2 ext1 x rw [mul_comm, ← WittVector.verschiebung_frobenius x]; rfl
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp] #align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} : (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m = (∏ i, m i) • iteratedDerivWithin n f s x := by rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ] simp #align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin : ‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map] #align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin @[simp] theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by ext x simp [iteratedDerivWithin] #align iterated_deriv_within_zero iteratedDerivWithin_zero @[simp]
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
119
121
theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) : iteratedDerivWithin 1 f s x = derivWithin f s x := by
simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl
import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.LinearAlgebra.Dimension.StrongRankCondition import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.mv_polynomial from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" noncomputable section open scoped Classical open Set LinearMap Submodule namespace MvPolynomial universe u variable {σ : Type u} {K : Type u} [Field K] open scoped Classical
Mathlib/FieldTheory/MvPolynomial.lean
54
55
theorem rank_mvPolynomial : Module.rank K (MvPolynomial σ K) = Cardinal.mk (σ →₀ ℕ) := by
rw [← Cardinal.lift_inj, ← (basisMonomials σ K).mk_eq_rank]
import Mathlib.Combinatorics.SimpleGraph.Finite import Mathlib.Data.Finset.Sym import Mathlib.Data.Matrix.Basic #align_import combinatorics.simple_graph.inc_matrix from "leanprover-community/mathlib"@"bb168510ef455e9280a152e7f31673cabd3d7496" open Finset Matrix SimpleGraph Sym2 open Matrix namespace SimpleGraph variable (R : Type*) {α : Type*} (G : SimpleGraph α) noncomputable def incMatrix [Zero R] [One R] : Matrix α (Sym2 α) R := fun a => (G.incidenceSet a).indicator 1 #align simple_graph.inc_matrix SimpleGraph.incMatrix variable {R} theorem incMatrix_apply [Zero R] [One R] {a : α} {e : Sym2 α} : G.incMatrix R a e = (G.incidenceSet a).indicator 1 e := rfl #align simple_graph.inc_matrix_apply SimpleGraph.incMatrix_apply theorem incMatrix_apply' [Zero R] [One R] [DecidableEq α] [DecidableRel G.Adj] {a : α} {e : Sym2 α} : G.incMatrix R a e = if e ∈ G.incidenceSet a then 1 else 0 := by unfold incMatrix Set.indicator convert rfl #align simple_graph.inc_matrix_apply' SimpleGraph.incMatrix_apply' section MulZeroOneClass variable [MulZeroOneClass R] {a b : α} {e : Sym2 α} theorem incMatrix_apply_mul_incMatrix_apply : G.incMatrix R a e * G.incMatrix R b e = (G.incidenceSet a ∩ G.incidenceSet b).indicator 1 e := by classical simp only [incMatrix, Set.indicator_apply, ite_zero_mul_ite_zero, Pi.one_apply, mul_one, Set.mem_inter_iff] #align simple_graph.inc_matrix_apply_mul_inc_matrix_apply SimpleGraph.incMatrix_apply_mul_incMatrix_apply theorem incMatrix_apply_mul_incMatrix_apply_of_not_adj (hab : a ≠ b) (h : ¬G.Adj a b) : G.incMatrix R a e * G.incMatrix R b e = 0 := by rw [incMatrix_apply_mul_incMatrix_apply, Set.indicator_of_not_mem] rw [G.incidenceSet_inter_incidenceSet_of_not_adj h hab] exact Set.not_mem_empty e #align simple_graph.inc_matrix_apply_mul_inc_matrix_apply_of_not_adj SimpleGraph.incMatrix_apply_mul_incMatrix_apply_of_not_adj theorem incMatrix_of_not_mem_incidenceSet (h : e ∉ G.incidenceSet a) : G.incMatrix R a e = 0 := by rw [incMatrix_apply, Set.indicator_of_not_mem h] #align simple_graph.inc_matrix_of_not_mem_incidence_set SimpleGraph.incMatrix_of_not_mem_incidenceSet theorem incMatrix_of_mem_incidenceSet (h : e ∈ G.incidenceSet a) : G.incMatrix R a e = 1 := by rw [incMatrix_apply, Set.indicator_of_mem h, Pi.one_apply] #align simple_graph.inc_matrix_of_mem_incidence_set SimpleGraph.incMatrix_of_mem_incidenceSet variable [Nontrivial R]
Mathlib/Combinatorics/SimpleGraph/IncMatrix.lean
102
103
theorem incMatrix_apply_eq_zero_iff : G.incMatrix R a e = 0 ↔ e ∉ G.incidenceSet a := by
simp only [incMatrix_apply, Set.indicator_apply_eq_zero, Pi.one_apply, one_ne_zero]
import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.RingTheory.AdjoinRoot import Mathlib.FieldTheory.Galois import Mathlib.LinearAlgebra.Eigenspace.Minpoly import Mathlib.RingTheory.Norm universe u variable {K : Type u} [Field K] open Polynomial IntermediateField AdjoinRoot section Splits lemma root_X_pow_sub_C_pow (n : ℕ) (a : K) : (AdjoinRoot.root (X ^ n - C a)) ^ n = AdjoinRoot.of _ a := by rw [← sub_eq_zero, ← AdjoinRoot.eval₂_root, eval₂_sub, eval₂_C, eval₂_pow, eval₂_X] lemma root_X_pow_sub_C_ne_zero {n : ℕ} (hn : 1 < n) (a : K) : (AdjoinRoot.root (X ^ n - C a)) ≠ 0 := mk_ne_zero_of_natDegree_lt (monic_X_pow_sub_C _ (Nat.not_eq_zero_of_lt hn)) X_ne_zero <| by rwa [natDegree_X_pow_sub_C, natDegree_X] lemma root_X_pow_sub_C_ne_zero' {n : ℕ} {a : K} (hn : 0 < n) (ha : a ≠ 0) : (AdjoinRoot.root (X ^ n - C a)) ≠ 0 := by obtain (rfl|hn) := (Nat.succ_le_iff.mpr hn).eq_or_lt · rw [← Nat.one_eq_succ_zero, pow_one] intro e refine mk_ne_zero_of_natDegree_lt (monic_X_sub_C a) (C_ne_zero.mpr ha) (by simp) ?_ trans AdjoinRoot.mk (X - C a) (X - (X - C a)) · rw [sub_sub_cancel] · rw [map_sub, mk_self, sub_zero, mk_X, e] · exact root_X_pow_sub_C_ne_zero hn a theorem X_pow_sub_C_splits_of_isPrimitiveRoot {n : ℕ} {ζ : K} (hζ : IsPrimitiveRoot ζ n) {α a : K} (e : α ^ n = a) : (X ^ n - C a).Splits (RingHom.id _) := by cases n.eq_zero_or_pos with | inl hn => rw [hn, pow_zero, ← C.map_one, ← map_sub] exact splits_C _ _ | inr hn => rw [splits_iff_card_roots, ← nthRoots, hζ.card_nthRoots, natDegree_X_pow_sub_C, if_pos ⟨α, e⟩] open BigOperators -- make this private, as we only use it to prove a strictly more general version private
Mathlib/FieldTheory/KummerExtension.lean
88
93
theorem X_pow_sub_C_eq_prod' {n : ℕ} {ζ : K} (hζ : IsPrimitiveRoot ζ n) {α a : K} (hn : 0 < n) (e : α ^ n = a) : (X ^ n - C a) = ∏ i ∈ Finset.range n, (X - C (ζ ^ i * α)) := by
rw [eq_prod_roots_of_monic_of_splits_id (monic_X_pow_sub_C _ (Nat.pos_iff_ne_zero.mp hn)) (X_pow_sub_C_splits_of_isPrimitiveRoot hζ e), ← nthRoots, hζ.nthRoots_eq e, Multiset.map_map] rfl
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]
Mathlib/Order/Interval/Finset/Basic.lean
139
139
theorem left_mem_Ico : a ∈ Ico a b ↔ a < b := by
simp only [mem_Ico, true_and_iff, le_refl]
import Mathlib.Analysis.NormedSpace.Banach import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Topology.PartialHomeomorph #align_import analysis.calculus.inverse from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Function Set Filter Metric open scoped Topology Classical NNReal noncomputable section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {ε : ℝ} open Filter Metric Set open ContinuousLinearMap (id) def ApproximatesLinearOn (f : E → F) (f' : E →L[𝕜] F) (s : Set E) (c : ℝ≥0) : Prop := ∀ x ∈ s, ∀ y ∈ s, ‖f x - f y - f' (x - y)‖ ≤ c * ‖x - y‖ #align approximates_linear_on ApproximatesLinearOn @[simp] theorem approximatesLinearOn_empty (f : E → F) (f' : E →L[𝕜] F) (c : ℝ≥0) : ApproximatesLinearOn f f' ∅ c := by simp [ApproximatesLinearOn] #align approximates_linear_on_empty approximatesLinearOn_empty namespace ApproximatesLinearOn variable [CompleteSpace E] {f : E → F} section variable {f' : E →L[𝕜] F} {s t : Set E} {c c' : ℝ≥0} theorem mono_num (hc : c ≤ c') (hf : ApproximatesLinearOn f f' s c) : ApproximatesLinearOn f f' s c' := fun x hx y hy => le_trans (hf x hx y hy) (mul_le_mul_of_nonneg_right hc <| norm_nonneg _) #align approximates_linear_on.mono_num ApproximatesLinearOn.mono_num theorem mono_set (hst : s ⊆ t) (hf : ApproximatesLinearOn f f' t c) : ApproximatesLinearOn f f' s c := fun x hx y hy => hf x (hst hx) y (hst hy) #align approximates_linear_on.mono_set ApproximatesLinearOn.mono_set theorem approximatesLinearOn_iff_lipschitzOnWith {f : E → F} {f' : E →L[𝕜] F} {s : Set E} {c : ℝ≥0} : ApproximatesLinearOn f f' s c ↔ LipschitzOnWith c (f - ⇑f') s := by have : ∀ x y, f x - f y - f' (x - y) = (f - f') x - (f - f') y := fun x y ↦ by simp only [map_sub, Pi.sub_apply]; abel simp only [this, lipschitzOnWith_iff_norm_sub_le, ApproximatesLinearOn] #align approximates_linear_on.approximates_linear_on_iff_lipschitz_on_with ApproximatesLinearOn.approximatesLinearOn_iff_lipschitzOnWith alias ⟨lipschitzOnWith, _root_.LipschitzOnWith.approximatesLinearOn⟩ := approximatesLinearOn_iff_lipschitzOnWith #align approximates_linear_on.lipschitz_on_with ApproximatesLinearOn.lipschitzOnWith #align lipschitz_on_with.approximates_linear_on LipschitzOnWith.approximatesLinearOn theorem lipschitz_sub (hf : ApproximatesLinearOn f f' s c) : LipschitzWith c fun x : s => f x - f' x := hf.lipschitzOnWith.to_restrict #align approximates_linear_on.lipschitz_sub ApproximatesLinearOn.lipschitz_sub protected theorem lipschitz (hf : ApproximatesLinearOn f f' s c) : LipschitzWith (‖f'‖₊ + c) (s.restrict f) := by simpa only [restrict_apply, add_sub_cancel] using (f'.lipschitz.restrict s).add hf.lipschitz_sub #align approximates_linear_on.lipschitz ApproximatesLinearOn.lipschitz protected theorem continuous (hf : ApproximatesLinearOn f f' s c) : Continuous (s.restrict f) := hf.lipschitz.continuous #align approximates_linear_on.continuous ApproximatesLinearOn.continuous protected theorem continuousOn (hf : ApproximatesLinearOn f f' s c) : ContinuousOn f s := continuousOn_iff_continuous_restrict.2 hf.continuous #align approximates_linear_on.continuous_on ApproximatesLinearOn.continuousOn end section LocallyOnto variable {s : Set E} {c : ℝ≥0} {f' : E →L[𝕜] F}
Mathlib/Analysis/Calculus/InverseFunctionTheorem/ApproximatesLinearOn.lean
148
280
theorem surjOn_closedBall_of_nonlinearRightInverse (hf : ApproximatesLinearOn f f' s c) (f'symm : f'.NonlinearRightInverse) {ε : ℝ} {b : E} (ε0 : 0 ≤ ε) (hε : closedBall b ε ⊆ s) : SurjOn f (closedBall b ε) (closedBall (f b) (((f'symm.nnnorm : ℝ)⁻¹ - c) * ε)) := by
intro y hy rcases le_or_lt (f'symm.nnnorm : ℝ)⁻¹ c with hc | hc · refine ⟨b, by simp [ε0], ?_⟩ have : dist y (f b) ≤ 0 := (mem_closedBall.1 hy).trans (mul_nonpos_of_nonpos_of_nonneg (by linarith) ε0) simp only [dist_le_zero] at this rw [this] have If' : (0 : ℝ) < f'symm.nnnorm := by rw [← inv_pos]; exact (NNReal.coe_nonneg _).trans_lt hc have Icf' : (c : ℝ) * f'symm.nnnorm < 1 := by rwa [inv_eq_one_div, lt_div_iff If'] at hc have Jf' : (f'symm.nnnorm : ℝ) ≠ 0 := ne_of_gt If' have Jcf' : (1 : ℝ) - c * f'symm.nnnorm ≠ 0 := by apply ne_of_gt; linarith /- We have to show that `y` can be written as `f x` for some `x ∈ closedBall b ε`. The idea of the proof is to apply the Banach contraction principle to the map `g : x ↦ x + f'symm (y - f x)`, as a fixed point of this map satisfies `f x = y`. When `f'symm` is a genuine linear inverse, `g` is a contracting map. In our case, since `f'symm` is nonlinear, this map is not contracting (it is not even continuous), but still the proof of the contraction theorem holds: `uₙ = gⁿ b` is a Cauchy sequence, converging exponentially fast to the desired point `x`. Instead of appealing to general results, we check this by hand. The main point is that `f (u n)` becomes exponentially close to `y`, and therefore `dist (u (n+1)) (u n)` becomes exponentally small, making it possible to get an inductive bound on `dist (u n) b`, from which one checks that `u n` stays in the ball on which one has a control. Therefore, the bound can be checked at the next step, and so on inductively. -/ set g := fun x => x + f'symm (y - f x) with hg set u := fun n : ℕ => g^[n] b with hu have usucc : ∀ n, u (n + 1) = g (u n) := by simp [hu, ← iterate_succ_apply' g _ b] -- First bound: if `f z` is close to `y`, then `g z` is close to `z` (i.e., almost a fixed point). have A : ∀ z, dist (g z) z ≤ f'symm.nnnorm * dist (f z) y := by intro z rw [dist_eq_norm, hg, add_sub_cancel_left, dist_eq_norm'] exact f'symm.bound _ -- Second bound: if `z` and `g z` are in the set with good control, then `f (g z)` becomes closer -- to `y` than `f z` was (this uses the linear approximation property, and is the reason for the -- choice of the formula for `g`). have B : ∀ z ∈ closedBall b ε, g z ∈ closedBall b ε → dist (f (g z)) y ≤ c * f'symm.nnnorm * dist (f z) y := by intro z hz hgz set v := f'symm (y - f z) calc dist (f (g z)) y = ‖f (z + v) - y‖ := by rw [dist_eq_norm] _ = ‖f (z + v) - f z - f' v + f' v - (y - f z)‖ := by congr 1; abel _ = ‖f (z + v) - f z - f' (z + v - z)‖ := by simp only [v, ContinuousLinearMap.NonlinearRightInverse.right_inv, add_sub_cancel_left, sub_add_cancel] _ ≤ c * ‖z + v - z‖ := hf _ (hε hgz) _ (hε hz) _ ≤ c * (f'symm.nnnorm * dist (f z) y) := by gcongr simpa [dist_eq_norm'] using f'symm.bound (y - f z) _ = c * f'symm.nnnorm * dist (f z) y := by ring -- Third bound: a complicated bound on `dist w b` (that will show up in the induction) is enough -- to check that `w` is in the ball on which one has controls. Will be used to check that `u n` -- belongs to this ball for all `n`. have C : ∀ (n : ℕ) (w : E), dist w b ≤ f'symm.nnnorm * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n) / (1 - c * f'symm.nnnorm) * dist (f b) y → w ∈ closedBall b ε := fun n w hw ↦ by apply hw.trans rw [div_mul_eq_mul_div, div_le_iff]; swap; · linarith calc (f'symm.nnnorm : ℝ) * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n) * dist (f b) y = f'symm.nnnorm * dist (f b) y * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n) := by ring _ ≤ f'symm.nnnorm * dist (f b) y * 1 := by gcongr rw [sub_le_self_iff] positivity _ ≤ f'symm.nnnorm * (((f'symm.nnnorm : ℝ)⁻¹ - c) * ε) := by rw [mul_one] gcongr exact mem_closedBall'.1 hy _ = ε * (1 - c * f'symm.nnnorm) := by field_simp; ring /- Main inductive control: `f (u n)` becomes exponentially close to `y`, and therefore `dist (u (n+1)) (u n)` becomes exponentally small, making it possible to get an inductive bound on `dist (u n) b`, from which one checks that `u n` remains in the ball on which we have estimates. -/ have D : ∀ n : ℕ, dist (f (u n)) y ≤ ((c : ℝ) * f'symm.nnnorm) ^ n * dist (f b) y ∧ dist (u n) b ≤ f'symm.nnnorm * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n) / (1 - (c : ℝ) * f'symm.nnnorm) * dist (f b) y := fun n ↦ by induction' n with n IH; · simp [hu, le_refl] rw [usucc] have Ign : dist (g (u n)) b ≤ f'symm.nnnorm * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n.succ) / (1 - c * f'symm.nnnorm) * dist (f b) y := calc dist (g (u n)) b ≤ dist (g (u n)) (u n) + dist (u n) b := dist_triangle _ _ _ _ ≤ f'symm.nnnorm * dist (f (u n)) y + dist (u n) b := add_le_add (A _) le_rfl _ ≤ f'symm.nnnorm * (((c : ℝ) * f'symm.nnnorm) ^ n * dist (f b) y) + f'symm.nnnorm * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n) / (1 - c * f'symm.nnnorm) * dist (f b) y := by gcongr · exact IH.1 · exact IH.2 _ = f'symm.nnnorm * (1 - ((c : ℝ) * f'symm.nnnorm) ^ n.succ) / (1 - (c : ℝ) * f'symm.nnnorm) * dist (f b) y := by field_simp [Jcf', pow_succ]; ring refine ⟨?_, Ign⟩ calc dist (f (g (u n))) y ≤ c * f'symm.nnnorm * dist (f (u n)) y := B _ (C n _ IH.2) (C n.succ _ Ign) _ ≤ (c : ℝ) * f'symm.nnnorm * (((c : ℝ) * f'symm.nnnorm) ^ n * dist (f b) y) := by gcongr apply IH.1 _ = ((c : ℝ) * f'symm.nnnorm) ^ n.succ * dist (f b) y := by simp only [pow_succ']; ring -- Deduce from the inductive bound that `uₙ` is a Cauchy sequence, therefore converging. have : CauchySeq u := by refine cauchySeq_of_le_geometric _ (↑f'symm.nnnorm * dist (f b) y) Icf' fun n ↦ ?_ calc dist (u n) (u (n + 1)) = dist (g (u n)) (u n) := by rw [usucc, dist_comm] _ ≤ f'symm.nnnorm * dist (f (u n)) y := A _ _ ≤ f'symm.nnnorm * (((c : ℝ) * f'symm.nnnorm) ^ n * dist (f b) y) := by gcongr exact (D n).1 _ = f'symm.nnnorm * dist (f b) y * ((c : ℝ) * f'symm.nnnorm) ^ n := by ring obtain ⟨x, hx⟩ : ∃ x, Tendsto u atTop (𝓝 x) := cauchySeq_tendsto_of_complete this -- As all the `uₙ` belong to the ball `closedBall b ε`, so does their limit `x`. have xmem : x ∈ closedBall b ε := isClosed_ball.mem_of_tendsto hx (eventually_of_forall fun n => C n _ (D n).2) refine ⟨x, xmem, ?_⟩ -- It remains to check that `f x = y`. This follows from continuity of `f` on `closedBall b ε` -- and from the fact that `f uₙ` is converging to `y` by construction. have hx' : Tendsto u atTop (𝓝[closedBall b ε] x) := by simp only [nhdsWithin, tendsto_inf, hx, true_and_iff, ge_iff_le, tendsto_principal] exact eventually_of_forall fun n => C n _ (D n).2 have T1 : Tendsto (f ∘ u) atTop (𝓝 (f x)) := (hf.continuousOn.mono hε x xmem).tendsto.comp hx' have T2 : Tendsto (f ∘ u) atTop (𝓝 y) := by rw [tendsto_iff_dist_tendsto_zero] refine squeeze_zero (fun _ => dist_nonneg) (fun n => (D n).1) ?_ simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one (by positivity) Icf').mul tendsto_const_nhds exact tendsto_nhds_unique T1 T2
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff' theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl #align matrix.represents.mul Matrix.Represents.mul theorem Matrix.Represents.one : (1 : Matrix ι ι R).Represents b 1 := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_one] ext rfl #align matrix.represents.one Matrix.Represents.one theorem Matrix.Represents.add {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A + A').Represents b (f + f') := by delta Matrix.Represents at h h' ⊢; rw [map_add, map_add, h, h'] #align matrix.represents.add Matrix.Represents.add
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
136
138
theorem Matrix.Represents.zero : (0 : Matrix ι ι R).Represents b 0 := by
delta Matrix.Represents rw [map_zero, map_zero]
import Mathlib.MeasureTheory.Integral.IntervalIntegral #align_import measure_theory.integral.layercake from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b" noncomputable section open scoped ENNReal MeasureTheory Topology open Set MeasureTheory Filter Measure namespace MeasureTheory section variable {α R : Type*} [MeasurableSpace α] (μ : Measure α) [LinearOrder R] theorem countable_meas_le_ne_meas_lt (g : α → R) : {t : R | μ {a : α | t ≤ g a} ≠ μ {a : α | t < g a}}.Countable := by -- the target set is contained in the set of points where the function `t ↦ μ {a : α | t ≤ g a}` -- jumps down on the right of `t`. This jump set is countable for any function. let F : R → ℝ≥0∞ := fun t ↦ μ {a : α | t ≤ g a} apply (countable_image_gt_image_Ioi F).mono intro t ht have : μ {a | t < g a} < μ {a | t ≤ g a} := lt_of_le_of_ne (measure_mono (fun a ha ↦ le_of_lt ha)) (Ne.symm ht) exact ⟨μ {a | t < g a}, this, fun s hs ↦ measure_mono (fun a ha ↦ hs.trans_le ha)⟩ theorem meas_le_ae_eq_meas_lt {R : Type*} [LinearOrder R] [MeasurableSpace R] (ν : Measure R) [NoAtoms ν] (g : α → R) : (fun t => μ {a : α | t ≤ g a}) =ᵐ[ν] fun t => μ {a : α | t < g a} := Set.Countable.measure_zero (countable_meas_le_ne_meas_lt μ g) _ end section Layercake variable {α : Type*} [MeasurableSpace α] {f : α → ℝ} {g : ℝ → ℝ} {s : Set α}
Mathlib/MeasureTheory/Integral/Layercake.lean
105
183
theorem lintegral_comp_eq_lintegral_meas_le_mul_of_measurable_of_sigmaFinite (μ : Measure α) [SigmaFinite μ] (f_nn : 0 ≤ f) (f_mble : Measurable f) (g_intble : ∀ t > 0, IntervalIntegrable g volume 0 t) (g_mble : Measurable g) (g_nn : ∀ t > 0, 0 ≤ g t) : ∫⁻ ω, ENNReal.ofReal (∫ t in (0)..f ω, g t) ∂μ = ∫⁻ t in Ioi 0, μ {a : α | t ≤ f a} * ENNReal.ofReal (g t) := by
have g_intble' : ∀ t : ℝ, 0 ≤ t → IntervalIntegrable g volume 0 t := by intro t ht cases' eq_or_lt_of_le ht with h h · simp [← h] · exact g_intble t h have integrand_eq : ∀ ω, ENNReal.ofReal (∫ t in (0)..f ω, g t) = ∫⁻ t in Ioc 0 (f ω), ENNReal.ofReal (g t) := by intro ω have g_ae_nn : 0 ≤ᵐ[volume.restrict (Ioc 0 (f ω))] g := by filter_upwards [self_mem_ae_restrict (measurableSet_Ioc : MeasurableSet (Ioc 0 (f ω)))] with x hx using g_nn x hx.1 rw [← ofReal_integral_eq_lintegral_ofReal (g_intble' (f ω) (f_nn ω)).1 g_ae_nn] congr exact intervalIntegral.integral_of_le (f_nn ω) rw [lintegral_congr integrand_eq] simp_rw [← lintegral_indicator (fun t => ENNReal.ofReal (g t)) measurableSet_Ioc] -- Porting note: was part of `simp_rw` on the previous line, but didn't trigger. rw [← lintegral_indicator _ measurableSet_Ioi, lintegral_lintegral_swap] · apply congr_arg funext s have aux₁ : (fun x => (Ioc 0 (f x)).indicator (fun t : ℝ => ENNReal.ofReal (g t)) s) = fun x => ENNReal.ofReal (g s) * (Ioi (0 : ℝ)).indicator (fun _ => 1) s * (Ici s).indicator (fun _ : ℝ => (1 : ℝ≥0∞)) (f x) := by funext a by_cases h : s ∈ Ioc (0 : ℝ) (f a) · simp only [h, show s ∈ Ioi (0 : ℝ) from h.1, show f a ∈ Ici s from h.2, indicator_of_mem, mul_one] · have h_copy := h simp only [mem_Ioc, not_and, not_le] at h by_cases h' : 0 < s · simp only [h_copy, h h', indicator_of_not_mem, not_false_iff, mem_Ici, not_le, mul_zero] · have : s ∉ Ioi (0 : ℝ) := h' simp only [this, h', indicator_of_not_mem, not_false_iff, mul_zero, zero_mul, mem_Ioc, false_and_iff] simp_rw [aux₁] rw [lintegral_const_mul'] swap; · apply ENNReal.mul_ne_top ENNReal.ofReal_ne_top by_cases h : (0 : ℝ) < s <;> · simp [h] simp_rw [show (fun a => (Ici s).indicator (fun _ : ℝ => (1 : ℝ≥0∞)) (f a)) = fun a => {a : α | s ≤ f a}.indicator (fun _ => 1) a by funext a; by_cases h : s ≤ f a <;> simp [h]] rw [lintegral_indicator₀] swap; · exact f_mble.nullMeasurable measurableSet_Ici rw [lintegral_one, Measure.restrict_apply MeasurableSet.univ, univ_inter, indicator_mul_left, mul_assoc, show (Ioi 0).indicator (fun _x : ℝ => (1 : ℝ≥0∞)) s * μ {a : α | s ≤ f a} = (Ioi 0).indicator (fun _x : ℝ => 1 * μ {a : α | s ≤ f a}) s by by_cases h : 0 < s <;> simp [h]] simp_rw [mul_comm _ (ENNReal.ofReal _), one_mul] rfl have aux₂ : (Function.uncurry fun (x : α) (y : ℝ) => (Ioc 0 (f x)).indicator (fun t : ℝ => ENNReal.ofReal (g t)) y) = {p : α × ℝ | p.2 ∈ Ioc 0 (f p.1)}.indicator fun p => ENNReal.ofReal (g p.2) := by funext p cases p with | mk p_fst p_snd => ?_ rw [Function.uncurry_apply_pair] by_cases h : p_snd ∈ Ioc 0 (f p_fst) · have h' : (p_fst, p_snd) ∈ {p : α × ℝ | p.snd ∈ Ioc 0 (f p.fst)} := h rw [Set.indicator_of_mem h', Set.indicator_of_mem h] · have h' : (p_fst, p_snd) ∉ {p : α × ℝ | p.snd ∈ Ioc 0 (f p.fst)} := h rw [Set.indicator_of_not_mem h', Set.indicator_of_not_mem h] rw [aux₂] have mble₀ : MeasurableSet {p : α × ℝ | p.snd ∈ Ioc 0 (f p.fst)} := by simpa only [mem_univ, Pi.zero_apply, gt_iff_lt, not_lt, ge_iff_le, true_and] using measurableSet_region_between_oc measurable_zero f_mble MeasurableSet.univ exact (ENNReal.measurable_ofReal.comp (g_mble.comp measurable_snd)).aemeasurable.indicator₀ mble₀.nullMeasurableSet
import Mathlib.Data.Finset.Lattice import Mathlib.Data.Fintype.Vector import Mathlib.Data.Multiset.Sym #align_import data.finset.sym from "leanprover-community/mathlib"@"02ba8949f486ebecf93fe7460f1ed0564b5e442c" namespace Finset variable {α : Type*} @[simps] protected def sym2 (s : Finset α) : Finset (Sym2 α) := ⟨s.1.sym2, s.2.sym2⟩ #align finset.sym2 Finset.sym2 section variable {s t : Finset α} {a b : α} theorem mk_mem_sym2_iff : s(a, b) ∈ s.sym2 ↔ a ∈ s ∧ b ∈ s := by rw [mem_mk, sym2_val, Multiset.mk_mem_sym2_iff, mem_mk, mem_mk] #align finset.mk_mem_sym2_iff Finset.mk_mem_sym2_iff @[simp] theorem mem_sym2_iff {m : Sym2 α} : m ∈ s.sym2 ↔ ∀ a ∈ m, a ∈ s := by rw [mem_mk, sym2_val, Multiset.mem_sym2_iff] simp only [mem_val] #align finset.mem_sym2_iff Finset.mem_sym2_iff instance _root_.Sym2.instFintype [Fintype α] : Fintype (Sym2 α) where elems := Finset.univ.sym2 complete := fun x ↦ by rw [mem_sym2_iff]; exact (fun a _ ↦ mem_univ a) -- Note(kmill): Using a default argument to make this simp lemma more general. @[simp] theorem sym2_univ [Fintype α] (inst : Fintype (Sym2 α) := Sym2.instFintype) : (univ : Finset α).sym2 = univ := by ext simp only [mem_sym2_iff, mem_univ, implies_true] #align finset.sym2_univ Finset.sym2_univ @[simp, mono]
Mathlib/Data/Finset/Sym.lean
69
72
theorem sym2_mono (h : s ⊆ t) : s.sym2 ⊆ t.sym2 := by
rw [← val_le_iff, sym2_val, sym2_val] apply Multiset.sym2_mono rwa [val_le_iff]
import Mathlib.Data.Nat.Squarefree import Mathlib.NumberTheory.Zsqrtd.QuadraticReciprocity import Mathlib.Tactic.LinearCombination #align_import number_theory.sum_two_squares from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section NegOneSquare -- This could be formulated for a general integer `a` in place of `-1`, -- but it would not directly specialize to `-1`, -- because `((-1 : ℤ) : ZMod n)` is not the same as `(-1 : ZMod n)`. theorem ZMod.isSquare_neg_one_of_dvd {m n : ℕ} (hd : m ∣ n) (hs : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod m) := by let f : ZMod n →+* ZMod m := ZMod.castHom hd _ rw [← RingHom.map_one f, ← RingHom.map_neg] exact hs.map f #align zmod.is_square_neg_one_of_dvd ZMod.isSquare_neg_one_of_dvd theorem ZMod.isSquare_neg_one_mul {m n : ℕ} (hc : m.Coprime n) (hm : IsSquare (-1 : ZMod m)) (hn : IsSquare (-1 : ZMod n)) : IsSquare (-1 : ZMod (m * n)) := by have : IsSquare (-1 : ZMod m × ZMod n) := by rw [show (-1 : ZMod m × ZMod n) = ((-1 : ZMod m), (-1 : ZMod n)) from rfl] obtain ⟨x, hx⟩ := hm obtain ⟨y, hy⟩ := hn rw [hx, hy] exact ⟨(x, y), rfl⟩ simpa only [RingEquiv.map_neg_one] using this.map (ZMod.chineseRemainder hc).symm #align zmod.is_square_neg_one_mul ZMod.isSquare_neg_one_mul theorem Nat.Prime.mod_four_ne_three_of_dvd_isSquare_neg_one {p n : ℕ} (hpp : p.Prime) (hp : p ∣ n) (hs : IsSquare (-1 : ZMod n)) : p % 4 ≠ 3 := by obtain ⟨y, h⟩ := ZMod.isSquare_neg_one_of_dvd hp hs rw [← sq, eq_comm, show (-1 : ZMod p) = -1 ^ 2 by ring] at h haveI : Fact p.Prime := ⟨hpp⟩ exact ZMod.mod_four_ne_three_of_sq_eq_neg_sq' one_ne_zero h #align nat.prime.mod_four_ne_three_of_dvd_is_square_neg_one Nat.Prime.mod_four_ne_three_of_dvd_isSquare_neg_one theorem ZMod.isSquare_neg_one_iff {n : ℕ} (hn : Squarefree n) : IsSquare (-1 : ZMod n) ↔ ∀ {q : ℕ}, q.Prime → q ∣ n → q % 4 ≠ 3 := by refine ⟨fun H q hqp hqd => hqp.mod_four_ne_three_of_dvd_isSquare_neg_one hqd H, fun H => ?_⟩ induction' n using induction_on_primes with p n hpp ih · exact False.elim (hn.ne_zero rfl) · exact ⟨0, by simp only [mul_zero, eq_iff_true_of_subsingleton]⟩ · haveI : Fact p.Prime := ⟨hpp⟩ have hcp : p.Coprime n := by by_contra hc exact hpp.not_unit (hn p <| mul_dvd_mul_left p <| hpp.dvd_iff_not_coprime.mpr hc) have hp₁ := ZMod.exists_sq_eq_neg_one_iff.mpr (H hpp (dvd_mul_right p n)) exact ZMod.isSquare_neg_one_mul hcp hp₁ (ih hn.of_mul_right fun hqp hqd => H hqp <| dvd_mul_of_dvd_right hqd _) #align zmod.is_square_neg_one_iff ZMod.isSquare_neg_one_iff
Mathlib/NumberTheory/SumTwoSquares.lean
125
138
theorem ZMod.isSquare_neg_one_iff' {n : ℕ} (hn : Squarefree n) : IsSquare (-1 : ZMod n) ↔ ∀ {q : ℕ}, q ∣ n → q % 4 ≠ 3 := by
have help : ∀ a b : ZMod 4, a ≠ 3 → b ≠ 3 → a * b ≠ 3 := by decide rw [ZMod.isSquare_neg_one_iff hn] refine ⟨?_, fun H q _ => H⟩ intro H refine @induction_on_primes _ ?_ ?_ (fun p q hp hq hpq => ?_) · exact fun _ => by norm_num · exact fun _ => by norm_num · replace hp := H hp (dvd_of_mul_right_dvd hpq) replace hq := hq (dvd_of_mul_left_dvd hpq) rw [show 3 = 3 % 4 by norm_num, Ne, ← ZMod.natCast_eq_natCast_iff'] at hp hq ⊢ rw [Nat.cast_mul] exact help p q hp hq
import Mathlib.Algebra.Order.Monoid.Unbundled.Pow import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Ring.Parity #align_import algebra.group_power.order from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" -- We should need only a minimal development of sets in order to get here. assert_not_exists Set.Subsingleton open Function Int variable {α M R : Type*} section OrderedSemiring variable [OrderedSemiring R] {a b x y : R} {n m : ℕ} theorem zero_pow_le_one : ∀ n : ℕ, (0 : R) ^ n ≤ 1 | 0 => (pow_zero _).le | n + 1 => by rw [zero_pow n.succ_ne_zero]; exact zero_le_one #align zero_pow_le_one zero_pow_le_one theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩ induction' k with k ih; · have eqn : Nat.succ Nat.zero = 1 := rfl rw [eqn] simp only [pow_one, le_refl] · let n := k.succ have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n)) have h2 := add_nonneg hx hy calc x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by rw [pow_succ' _ n, pow_succ' _ n] exact le_add_of_nonneg_right h1 _ = (x + y) * (x ^ n + y ^ n) := by rw [add_mul, mul_add, mul_add, add_comm (y * x ^ n), ← add_assoc, ← add_assoc, add_assoc (x * x ^ n) (x * y ^ n), add_comm (x * y ^ n) (y * y ^ n), ← add_assoc] _ ≤ (x + y) ^ n.succ := by rw [pow_succ' _ n] exact mul_le_mul_of_nonneg_left (ih (Nat.succ_ne_zero k)) h2 #align pow_add_pow_le pow_add_pow_le theorem pow_le_one : ∀ n : ℕ, 0 ≤ a → a ≤ 1 → a ^ n ≤ 1 | 0, _, _ => (pow_zero a).le | n + 1, h₀, h₁ => (pow_succ a n).le.trans (mul_le_one (pow_le_one n h₀ h₁) h₀ h₁) #align pow_le_one pow_le_one theorem pow_lt_one (h₀ : 0 ≤ a) (h₁ : a < 1) : ∀ {n : ℕ}, n ≠ 0 → a ^ n < 1 | 0, h => (h rfl).elim | n + 1, _ => by rw [pow_succ'] exact mul_lt_one_of_nonneg_of_lt_one_left h₀ h₁ (pow_le_one _ h₀ h₁.le) #align pow_lt_one pow_lt_one theorem one_le_pow_of_one_le (H : 1 ≤ a) : ∀ n : ℕ, 1 ≤ a ^ n | 0 => by rw [pow_zero] | n + 1 => by rw [pow_succ'] simpa only [mul_one] using mul_le_mul H (one_le_pow_of_one_le H n) zero_le_one (le_trans zero_le_one H) #align one_le_pow_of_one_le one_le_pow_of_one_le theorem pow_right_mono (h : 1 ≤ a) : Monotone (a ^ ·) := monotone_nat_of_le_succ fun n => by rw [pow_succ'] exact le_mul_of_one_le_left (pow_nonneg (zero_le_one.trans h) _) h #align pow_mono pow_right_mono @[gcongr] theorem pow_le_pow_right (ha : 1 ≤ a) (h : n ≤ m) : a ^ n ≤ a ^ m := pow_right_mono ha h #align pow_le_pow pow_le_pow_right
Mathlib/Algebra/Order/Ring/Basic.lean
100
101
theorem le_self_pow (ha : 1 ≤ a) (h : m ≠ 0) : a ≤ a ^ m := by
simpa only [pow_one] using pow_le_pow_right ha <| Nat.pos_iff_ne_zero.2 h
import Batteries.Tactic.Alias import Batteries.Data.Nat.Basic namespace Nat @[simp] theorem recAux_zero {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive n → motive (n+1)) : Nat.recAux zero succ 0 = zero := rfl theorem recAux_succ {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive n → motive (n+1)) (n) : Nat.recAux zero succ (n+1) = succ n (Nat.recAux zero succ n) := rfl @[simp] theorem recAuxOn_zero {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive n → motive (n+1)) : Nat.recAuxOn 0 zero succ = zero := rfl theorem recAuxOn_succ {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive n → motive (n+1)) (n) : Nat.recAuxOn (n+1) zero succ = succ n (Nat.recAuxOn n zero succ) := rfl @[simp] theorem casesAuxOn_zero {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive (n+1)) : Nat.casesAuxOn 0 zero succ = zero := rfl theorem casesAuxOn_succ {motive : Nat → Sort _} (zero : motive 0) (succ : ∀ n, motive (n+1)) (n) : Nat.casesAuxOn (n+1) zero succ = succ n := rfl theorem strongRec_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n) (t : Nat) : Nat.strongRec ind t = ind t fun m _ => Nat.strongRec ind m := by conv => lhs; unfold Nat.strongRec theorem strongRecOn_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n) (t : Nat) : Nat.strongRecOn t ind = ind t fun m _ => Nat.strongRecOn m ind := Nat.strongRec_eq .. @[simp] theorem recDiagAux_zero_left {motive : Nat → Nat → Sort _} (zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) : Nat.recDiagAux zero_left zero_right succ_succ 0 n = zero_left n := by cases n <;> rfl @[simp] theorem recDiagAux_zero_right {motive : Nat → Nat → Sort _} (zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m) (h : zero_left 0 = zero_right 0 := by first | assumption | trivial) : Nat.recDiagAux zero_left zero_right succ_succ m 0 = zero_right m := by cases m; exact h; rfl theorem recDiagAux_succ_succ {motive : Nat → Nat → Sort _} (zero_left : ∀ n, motive 0 n) (zero_right : ∀ m, motive m 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m n) : Nat.recDiagAux zero_left zero_right succ_succ (m+1) (n+1) = succ_succ m n (Nat.recDiagAux zero_left zero_right succ_succ m n) := rfl @[simp] theorem recDiag_zero_zero {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0) (zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) : Nat.recDiag (motive:=motive) zero_zero zero_succ succ_zero succ_succ 0 0 = zero_zero := rfl theorem recDiag_zero_succ {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0) (zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (n) : Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 (n+1) = zero_succ n (Nat.recDiag zero_zero zero_succ succ_zero succ_succ 0 n) := by simp [Nat.recDiag]; rfl
.lake/packages/batteries/Batteries/Data/Nat/Lemmas.lean
81
86
theorem recDiag_succ_zero {motive : Nat → Nat → Sort _} (zero_zero : motive 0 0) (zero_succ : ∀ n, motive 0 n → motive 0 (n+1)) (succ_zero : ∀ m, motive m 0 → motive (m+1) 0) (succ_succ : ∀ m n, motive m n → motive (m+1) (n+1)) (m) : Nat.recDiag zero_zero zero_succ succ_zero succ_succ (m+1) 0 = succ_zero m (Nat.recDiag zero_zero zero_succ succ_zero succ_succ m 0) := by
simp [Nat.recDiag]; cases m <;> rfl
import Mathlib.Data.Nat.Lattice import Mathlib.Logic.Denumerable import Mathlib.Logic.Function.Iterate import Mathlib.Order.Hom.Basic import Mathlib.Data.Set.Subsingleton #align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90" variable {α : Type*} namespace RelEmbedding variable {r : α → α → Prop} [IsStrictOrder α r] def natLT (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) : ((· < ·) : ℕ → ℕ → Prop) ↪r r := ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H #align rel_embedding.nat_lt RelEmbedding.natLT @[simp] theorem coe_natLT {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} : ⇑(natLT f H) = f := rfl #align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT def natGT (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((· > ·) : ℕ → ℕ → Prop) ↪r r := haveI := IsStrictOrder.swap r RelEmbedding.swap (natLT f H) #align rel_embedding.nat_gt RelEmbedding.natGT @[simp] theorem coe_natGT {f : ℕ → α} {H : ∀ n : ℕ, r (f (n + 1)) (f n)} : ⇑(natGT f H) = f := rfl #align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT theorem exists_not_acc_lt_of_not_acc {a : α} {r} (h : ¬Acc r a) : ∃ b, ¬Acc r b ∧ r b a := by contrapose! h refine ⟨_, fun b hr => ?_⟩ by_contra hb exact h b hb hr #align rel_embedding.exists_not_acc_lt_of_not_acc RelEmbedding.exists_not_acc_lt_of_not_acc theorem acc_iff_no_decreasing_seq {x} : Acc r x ↔ IsEmpty { f : ((· > ·) : ℕ → ℕ → Prop) ↪r r // x ∈ Set.range f } := by constructor · refine fun h => h.recOn fun x _ IH => ?_ constructor rintro ⟨f, k, hf⟩ exact IsEmpty.elim' (IH (f (k + 1)) (hf ▸ f.map_rel_iff.2 (lt_add_one k))) ⟨f, _, rfl⟩ · have : ∀ x : { a // ¬Acc r a }, ∃ y : { a // ¬Acc r a }, r y.1 x.1 := by rintro ⟨x, hx⟩ cases exists_not_acc_lt_of_not_acc hx with | intro w h => exact ⟨⟨w, h.1⟩, h.2⟩ choose f h using this refine fun E => by_contradiction fun hx => E.elim' ⟨natGT (fun n => (f^[n] ⟨x, hx⟩).1) fun n => ?_, 0, rfl⟩ simp only [Function.iterate_succ'] apply h #align rel_embedding.acc_iff_no_decreasing_seq RelEmbedding.acc_iff_no_decreasing_seq
Mathlib/Order/OrderIsoNat.lean
84
86
theorem not_acc_of_decreasing_seq (f : ((· > ·) : ℕ → ℕ → Prop) ↪r r) (k : ℕ) : ¬Acc r (f k) := by
rw [acc_iff_no_decreasing_seq, not_isEmpty_iff] exact ⟨⟨f, k, rfl⟩⟩
import Mathlib.Algebra.Order.Group.TypeTags import Mathlib.FieldTheory.RatFunc.Degree import Mathlib.RingTheory.DedekindDomain.IntegralClosure import Mathlib.RingTheory.IntegrallyClosed import Mathlib.Topology.Algebra.ValuedField #align_import number_theory.function_field from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open scoped nonZeroDivisors Polynomial DiscreteValuation variable (Fq F : Type) [Field Fq] [Field F] abbrev FunctionField [Algebra (RatFunc Fq) F] : Prop := FiniteDimensional (RatFunc Fq) F #align function_field FunctionField -- Porting note: Removed `protected`
Mathlib/NumberTheory/FunctionField.lean
62
80
theorem functionField_iff (Fqt : Type*) [Field Fqt] [Algebra Fq[X] Fqt] [IsFractionRing Fq[X] Fqt] [Algebra (RatFunc Fq) F] [Algebra Fqt F] [Algebra Fq[X] F] [IsScalarTower Fq[X] Fqt F] [IsScalarTower Fq[X] (RatFunc Fq) F] : FunctionField Fq F ↔ FiniteDimensional Fqt F := by
let e := IsLocalization.algEquiv Fq[X]⁰ (RatFunc Fq) Fqt have : ∀ (c) (x : F), e c • x = c • x := by intro c x rw [Algebra.smul_def, Algebra.smul_def] congr refine congr_fun (f := fun c => algebraMap Fqt F (e c)) ?_ c -- Porting note: Added `(f := _)` refine IsLocalization.ext (nonZeroDivisors Fq[X]) _ _ ?_ ?_ ?_ ?_ ?_ <;> intros <;> simp only [AlgEquiv.map_one, RingHom.map_one, AlgEquiv.map_mul, RingHom.map_mul, AlgEquiv.commutes, ← IsScalarTower.algebraMap_apply] constructor <;> intro h · let b := FiniteDimensional.finBasis (RatFunc Fq) F exact FiniteDimensional.of_fintype_basis (b.mapCoeffs e this) · let b := FiniteDimensional.finBasis Fqt F refine FiniteDimensional.of_fintype_basis (b.mapCoeffs e.symm ?_) intro c x; convert (this (e.symm c) x).symm; simp only [e.apply_symm_apply]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed import Mathlib.RingTheory.PowerBasis #align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" open scoped Polynomial open Polynomial noncomputable section universe u v -- Porting note: this looks like something that should not be here -- -- This class doesn't really make sense on a predicate -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) : Type max u v where map : R[X] →+* S map_surjective : Function.Surjective map ker_map : RingHom.ker map = Ideal.span {f} algebraMap_eq : algebraMap R S = map.comp Polynomial.C #align is_adjoin_root IsAdjoinRoot -- This class doesn't really make sense on a predicate -- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet. structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S] (f : R[X]) extends IsAdjoinRoot S f where Monic : Monic f #align is_adjoin_root_monic IsAdjoinRootMonic section Ring variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S] namespace IsAdjoinRoot def root (h : IsAdjoinRoot S f) : S := h.map X #align is_adjoin_root.root IsAdjoinRoot.root theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S := h.map_surjective.subsingleton #align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) : algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply] #align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply @[simp]
Mathlib/RingTheory/IsAdjoinRoot.lean
132
133
theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by
rw [h.ker_map, Ideal.mem_span_singleton]
import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.Ideal.LocalRing import Mathlib.RingTheory.Valuation.PrimeMultiplicity import Mathlib.RingTheory.AdicCompletion.Basic #align_import ring_theory.discrete_valuation_ring.basic from "leanprover-community/mathlib"@"c163ec99dfc664628ca15d215fce0a5b9c265b68" open scoped Classical universe u open Ideal LocalRing class DiscreteValuationRing (R : Type u) [CommRing R] [IsDomain R] extends IsPrincipalIdealRing R, LocalRing R : Prop where not_a_field' : maximalIdeal R ≠ ⊥ #align discrete_valuation_ring DiscreteValuationRing namespace DiscreteValuationRing variable (R : Type u) [CommRing R] [IsDomain R] [DiscreteValuationRing R] theorem not_a_field : maximalIdeal R ≠ ⊥ := not_a_field' #align discrete_valuation_ring.not_a_field DiscreteValuationRing.not_a_field theorem not_isField : ¬IsField R := LocalRing.isField_iff_maximalIdeal_eq.not.mpr (not_a_field R) #align discrete_valuation_ring.not_is_field DiscreteValuationRing.not_isField variable {R} open PrincipalIdealRing theorem irreducible_of_span_eq_maximalIdeal {R : Type*} [CommRing R] [LocalRing R] [IsDomain R] (ϖ : R) (hϖ : ϖ ≠ 0) (h : maximalIdeal R = Ideal.span {ϖ}) : Irreducible ϖ := by have h2 : ¬IsUnit ϖ := show ϖ ∈ maximalIdeal R from h.symm ▸ Submodule.mem_span_singleton_self ϖ refine ⟨h2, ?_⟩ intro a b hab by_contra! h obtain ⟨ha : a ∈ maximalIdeal R, hb : b ∈ maximalIdeal R⟩ := h rw [h, mem_span_singleton'] at ha hb rcases ha with ⟨a, rfl⟩ rcases hb with ⟨b, rfl⟩ rw [show a * ϖ * (b * ϖ) = ϖ * (ϖ * (a * b)) by ring] at hab apply hϖ apply eq_zero_of_mul_eq_self_right _ hab.symm exact fun hh => h2 (isUnit_of_dvd_one ⟨_, hh.symm⟩) #align discrete_valuation_ring.irreducible_of_span_eq_maximal_ideal DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal theorem irreducible_iff_uniformizer (ϖ : R) : Irreducible ϖ ↔ maximalIdeal R = Ideal.span {ϖ} := ⟨fun hϖ => (eq_maximalIdeal (isMaximal_of_irreducible hϖ)).symm, fun h => irreducible_of_span_eq_maximalIdeal ϖ (fun e => not_a_field R <| by rwa [h, span_singleton_eq_bot]) h⟩ #align discrete_valuation_ring.irreducible_iff_uniformizer DiscreteValuationRing.irreducible_iff_uniformizer theorem _root_.Irreducible.maximalIdeal_eq {ϖ : R} (h : Irreducible ϖ) : maximalIdeal R = Ideal.span {ϖ} := (irreducible_iff_uniformizer _).mp h #align irreducible.maximal_ideal_eq Irreducible.maximalIdeal_eq variable (R) theorem exists_irreducible : ∃ ϖ : R, Irreducible ϖ := by simp_rw [irreducible_iff_uniformizer] exact (IsPrincipalIdealRing.principal <| maximalIdeal R).principal #align discrete_valuation_ring.exists_irreducible DiscreteValuationRing.exists_irreducible theorem exists_prime : ∃ ϖ : R, Prime ϖ := (exists_irreducible R).imp fun _ => irreducible_iff_prime.1 #align discrete_valuation_ring.exists_prime DiscreteValuationRing.exists_prime theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] : DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by constructor · intro RDVR rcases id RDVR with ⟨Rlocal⟩ constructor · assumption use LocalRing.maximalIdeal R constructor · exact ⟨Rlocal, inferInstance⟩ · rintro Q ⟨hQ1, hQ2⟩ obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1 have hq : q ≠ 0 := by rintro rfl apply hQ1 simp erw [span_singleton_prime hq] at hQ2 replace hQ2 := hQ2.irreducible rw [irreducible_iff_uniformizer] at hQ2 exact hQ2.symm · rintro ⟨RPID, Punique⟩ haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique refine { not_a_field' := ?_ } rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩ have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1 intro h rw [h, le_bot_iff] at hPM exact hP1 hPM #align discrete_valuation_ring.iff_pid_with_one_nonzero_prime DiscreteValuationRing.iff_pid_with_one_nonzero_prime
Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
148
151
theorem associated_of_irreducible {a b : R} (ha : Irreducible a) (hb : Irreducible b) : Associated a b := by
rw [irreducible_iff_uniformizer] at ha hb rw [← span_singleton_eq_span_singleton, ← ha, hb]
import Mathlib.Init.Algebra.Classes import Mathlib.Init.Data.Ordering.Basic #align_import init.data.ordering.lemmas from "leanprover-community/lean"@"4bd314f7bd5e0c9e813fc201f1279a23f13f9f1d" universe u namespace Ordering @[simp] theorem ite_eq_lt_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.lt) = if c then a = Ordering.lt else b = Ordering.lt := by by_cases c <;> simp [*] #align ordering.ite_eq_lt_distrib Ordering.ite_eq_lt_distrib @[simp]
Mathlib/Init/Data/Ordering/Lemmas.lean
26
28
theorem ite_eq_eq_distrib (c : Prop) [Decidable c] (a b : Ordering) : ((if c then a else b) = Ordering.eq) = if c then a = Ordering.eq else b = Ordering.eq := by
by_cases c <;> simp [*]
import Mathlib.Analysis.InnerProductSpace.Projection import Mathlib.Analysis.NormedSpace.Dual import Mathlib.Analysis.NormedSpace.Star.Basic #align_import analysis.inner_product_space.dual from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped Classical open ComplexConjugate universe u v namespace InnerProductSpace open RCLike ContinuousLinearMap variable (𝕜 : Type*) variable (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y local postfix:90 "†" => starRingEnd _ def toDualMap : E →ₗᵢ⋆[𝕜] NormedSpace.Dual 𝕜 E := { innerSL 𝕜 with norm_map' := innerSL_apply_norm _ } #align inner_product_space.to_dual_map InnerProductSpace.toDualMap variable {E} @[simp] theorem toDualMap_apply {x y : E} : toDualMap 𝕜 E x y = ⟪x, y⟫ := rfl #align inner_product_space.to_dual_map_apply InnerProductSpace.toDualMap_apply theorem innerSL_norm [Nontrivial E] : ‖(innerSL 𝕜 : E →L⋆[𝕜] E →L[𝕜] 𝕜)‖ = 1 := show ‖(toDualMap 𝕜 E).toContinuousLinearMap‖ = 1 from LinearIsometry.norm_toContinuousLinearMap _ set_option linter.uppercaseLean3 false in #align inner_product_space.innerSL_norm InnerProductSpace.innerSL_norm variable {𝕜} theorem ext_inner_left_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E) (h : ∀ i : ι, ⟪b i, x⟫ = ⟪b i, y⟫) : x = y := by apply (toDualMap 𝕜 E).map_eq_iff.mp refine (Function.Injective.eq_iff ContinuousLinearMap.coe_injective).mp (Basis.ext b ?_) intro i simp only [ContinuousLinearMap.coe_coe] rw [toDualMap_apply, toDualMap_apply] rw [← inner_conj_symm] conv_rhs => rw [← inner_conj_symm] exact congr_arg conj (h i) #align inner_product_space.ext_inner_left_basis InnerProductSpace.ext_inner_left_basis
Mathlib/Analysis/InnerProductSpace/Dual.lean
94
99
theorem ext_inner_right_basis {ι : Type*} {x y : E} (b : Basis ι 𝕜 E) (h : ∀ i : ι, ⟪x, b i⟫ = ⟪y, b i⟫) : x = y := by
refine ext_inner_left_basis b fun i => ?_ rw [← inner_conj_symm] conv_rhs => rw [← inner_conj_symm] exact congr_arg conj (h i)
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.PUnitInstances import Mathlib.GroupTheory.Congruence.Basic open FreeMonoid Function List Set namespace Monoid @[to_additive "The minimal additive congruence relation `c` on `FreeAddMonoid (M ⊕ N)` such that `FreeAddMonoid.of ∘ Sum.inl` and `FreeAddMonoid.of ∘ Sum.inr` are additive monoid homomorphisms to the quotient by `c`."] def coprodCon (M N : Type*) [MulOneClass M] [MulOneClass N] : Con (FreeMonoid (M ⊕ N)) := sInf {c | (∀ x y : M, c (of (Sum.inl (x * y))) (of (Sum.inl x) * of (Sum.inl y))) ∧ (∀ x y : N, c (of (Sum.inr (x * y))) (of (Sum.inr x) * of (Sum.inr y))) ∧ c (of <| Sum.inl 1) 1 ∧ c (of <| Sum.inr 1) 1} @[to_additive "Coproduct of two additive monoids or groups."] def Coprod (M N : Type*) [MulOneClass M] [MulOneClass N] := (coprodCon M N).Quotient namespace Coprod @[inherit_doc] scoped infix:30 " ∗ " => Coprod section MulOneClass variable {M N M' N' P : Type*} [MulOneClass M] [MulOneClass N] [MulOneClass M'] [MulOneClass N'] [MulOneClass P] @[to_additive] protected instance : MulOneClass (M ∗ N) := Con.mulOneClass _ @[to_additive "The natural projection `FreeAddMonoid (M ⊕ N) →+ AddMonoid.Coprod M N`."] def mk : FreeMonoid (M ⊕ N) →* M ∗ N := Con.mk' _ @[to_additive (attr := simp)] theorem con_ker_mk : Con.ker mk = coprodCon M N := Con.mk'_ker _ @[to_additive] theorem mk_surjective : Surjective (@mk M N _ _) := surjective_quot_mk _ @[to_additive (attr := simp)] theorem mrange_mk : MonoidHom.mrange (@mk M N _ _) = ⊤ := Con.mrange_mk' @[to_additive] theorem mk_eq_mk {w₁ w₂ : FreeMonoid (M ⊕ N)} : mk w₁ = mk w₂ ↔ coprodCon M N w₁ w₂ := Con.eq _ @[to_additive "The natural embedding `M →+ AddMonoid.Coprod M N`."] def inl : M →* M ∗ N where toFun := fun x => mk (of (.inl x)) map_one' := mk_eq_mk.2 fun _c hc => hc.2.2.1 map_mul' := fun x y => mk_eq_mk.2 fun _c hc => hc.1 x y @[to_additive "The natural embedding `N →+ AddMonoid.Coprod M N`."] def inr : N →* M ∗ N where toFun := fun x => mk (of (.inr x)) map_one' := mk_eq_mk.2 fun _c hc => hc.2.2.2 map_mul' := fun x y => mk_eq_mk.2 fun _c hc => hc.2.1 x y @[to_additive (attr := simp)] theorem mk_of_inl (x : M) : (mk (of (.inl x)) : M ∗ N) = inl x := rfl @[to_additive (attr := simp)] theorem mk_of_inr (x : N) : (mk (of (.inr x)) : M ∗ N) = inr x := rfl @[to_additive (attr := elab_as_elim)]
Mathlib/GroupTheory/Coprod/Basic.lean
189
199
theorem induction_on' {C : M ∗ N → Prop} (m : M ∗ N) (one : C 1) (inl_mul : ∀ m x, C x → C (inl m * x)) (inr_mul : ∀ n x, C x → C (inr n * x)) : C m := by
rcases mk_surjective m with ⟨x, rfl⟩ induction x using FreeMonoid.recOn with | h0 => exact one | ih x xs ih => cases x with | inl m => simpa using inl_mul m _ ih | inr n => simpa using inr_mul n _ ih
import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.RingTheory.PolynomialAlgebra #align_import linear_algebra.matrix.charpoly.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section universe u v w namespace Matrix open Finset Matrix Polynomial variable {R S : Type*} [CommRing R] [CommRing S] variable {m n : Type*} [DecidableEq m] [DecidableEq n] [Fintype m] [Fintype n] variable (M₁₁ : Matrix m m R) (M₁₂ : Matrix m n R) (M₂₁ : Matrix n m R) (M₂₂ M : Matrix n n R) variable (i j : n) def charmatrix (M : Matrix n n R) : Matrix n n R[X] := Matrix.scalar n (X : R[X]) - (C : R →+* R[X]).mapMatrix M #align charmatrix Matrix.charmatrix theorem charmatrix_apply : charmatrix M i j = (Matrix.diagonal fun _ : n => X) i j - C (M i j) := rfl #align charmatrix_apply Matrix.charmatrix_apply @[simp] theorem charmatrix_apply_eq : charmatrix M i i = (X : R[X]) - C (M i i) := by simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, map_apply, diagonal_apply_eq] #align charmatrix_apply_eq Matrix.charmatrix_apply_eq @[simp] theorem charmatrix_apply_ne (h : i ≠ j) : charmatrix M i j = -C (M i j) := by simp only [charmatrix, RingHom.mapMatrix_apply, sub_apply, scalar_apply, diagonal_apply_ne _ h, map_apply, sub_eq_neg_self] #align charmatrix_apply_ne Matrix.charmatrix_apply_ne theorem matPolyEquiv_charmatrix : matPolyEquiv (charmatrix M) = X - C M := by ext k i j simp only [matPolyEquiv_coeff_apply, coeff_sub, Pi.sub_apply] by_cases h : i = j · subst h rw [charmatrix_apply_eq, coeff_sub] simp only [coeff_X, coeff_C] split_ifs <;> simp · rw [charmatrix_apply_ne _ _ _ h, coeff_X, coeff_neg, coeff_C, coeff_C] split_ifs <;> simp [h] #align mat_poly_equiv_charmatrix Matrix.matPolyEquiv_charmatrix theorem charmatrix_reindex (e : n ≃ m) : charmatrix (reindex e e M) = reindex e e (charmatrix M) := by ext i j x by_cases h : i = j all_goals simp [h] #align charmatrix_reindex Matrix.charmatrix_reindex lemma charmatrix_map (M : Matrix n n R) (f : R →+* S) : charmatrix (M.map f) = (charmatrix M).map (Polynomial.map f) := by ext i j by_cases h : i = j <;> simp [h, charmatrix, diagonal] lemma charmatrix_fromBlocks : charmatrix (fromBlocks M₁₁ M₁₂ M₂₁ M₂₂) = fromBlocks (charmatrix M₁₁) (- M₁₂.map C) (- M₂₁.map C) (charmatrix M₂₂) := by simp only [charmatrix] ext (i|i) (j|j) : 2 <;> simp [diagonal] def charpoly (M : Matrix n n R) : R[X] := (charmatrix M).det #align matrix.charpoly Matrix.charpoly
Mathlib/LinearAlgebra/Matrix/Charpoly/Basic.lean
103
106
theorem charpoly_reindex (e : n ≃ m) (M : Matrix n n R) : (reindex e e M).charpoly = M.charpoly := by
unfold Matrix.charpoly rw [charmatrix_reindex, Matrix.det_reindex_self]
import Mathlib.Init.Data.Sigma.Lex import Mathlib.Data.Prod.Lex import Mathlib.Data.Sigma.Lex import Mathlib.Order.Antichain import Mathlib.Order.OrderIsoNat import Mathlib.Order.WellFounded import Mathlib.Tactic.TFAE #align_import order.well_founded_set from "leanprover-community/mathlib"@"2c84c2c5496117349007d97104e7bbb471381592" variable {ι α β γ : Type*} {π : ι → Type*} namespace Set def WellFoundedOn (s : Set α) (r : α → α → Prop) : Prop := WellFounded fun a b : s => r a b #align set.well_founded_on Set.WellFoundedOn @[simp] theorem wellFoundedOn_empty (r : α → α → Prop) : WellFoundedOn ∅ r := wellFounded_of_isEmpty _ #align set.well_founded_on_empty Set.wellFoundedOn_empty def PartiallyWellOrderedOn (s : Set α) (r : α → α → Prop) : Prop := ∀ f : ℕ → α, (∀ n, f n ∈ s) → ∃ m n : ℕ, m < n ∧ r (f m) (f n) #align set.partially_well_ordered_on Set.PartiallyWellOrderedOn section PartiallyWellOrderedOn variable {r : α → α → Prop} {r' : β → β → Prop} {f : α → β} {s : Set α} {t : Set α} {a : α} theorem PartiallyWellOrderedOn.mono (ht : t.PartiallyWellOrderedOn r) (h : s ⊆ t) : s.PartiallyWellOrderedOn r := fun f hf => ht f fun n => h <| hf n #align set.partially_well_ordered_on.mono Set.PartiallyWellOrderedOn.mono @[simp] theorem partiallyWellOrderedOn_empty (r : α → α → Prop) : PartiallyWellOrderedOn ∅ r := fun _ h => (h 0).elim #align set.partially_well_ordered_on_empty Set.partiallyWellOrderedOn_empty theorem PartiallyWellOrderedOn.union (hs : s.PartiallyWellOrderedOn r) (ht : t.PartiallyWellOrderedOn r) : (s ∪ t).PartiallyWellOrderedOn r := by rintro f hf rcases Nat.exists_subseq_of_forall_mem_union f hf with ⟨g, hgs | hgt⟩ · rcases hs _ hgs with ⟨m, n, hlt, hr⟩ exact ⟨g m, g n, g.strictMono hlt, hr⟩ · rcases ht _ hgt with ⟨m, n, hlt, hr⟩ exact ⟨g m, g n, g.strictMono hlt, hr⟩ #align set.partially_well_ordered_on.union Set.PartiallyWellOrderedOn.union @[simp] theorem partiallyWellOrderedOn_union : (s ∪ t).PartiallyWellOrderedOn r ↔ s.PartiallyWellOrderedOn r ∧ t.PartiallyWellOrderedOn r := ⟨fun h => ⟨h.mono subset_union_left, h.mono subset_union_right⟩, fun h => h.1.union h.2⟩ #align set.partially_well_ordered_on_union Set.partiallyWellOrderedOn_union theorem PartiallyWellOrderedOn.image_of_monotone_on (hs : s.PartiallyWellOrderedOn r) (hf : ∀ a₁ ∈ s, ∀ a₂ ∈ s, r a₁ a₂ → r' (f a₁) (f a₂)) : (f '' s).PartiallyWellOrderedOn r' := by intro g' hg' choose g hgs heq using hg' obtain rfl : f ∘ g = g' := funext heq obtain ⟨m, n, hlt, hmn⟩ := hs g hgs exact ⟨m, n, hlt, hf _ (hgs m) _ (hgs n) hmn⟩ #align set.partially_well_ordered_on.image_of_monotone_on Set.PartiallyWellOrderedOn.image_of_monotone_on theorem _root_.IsAntichain.finite_of_partiallyWellOrderedOn (ha : IsAntichain r s) (hp : s.PartiallyWellOrderedOn r) : s.Finite := by refine not_infinite.1 fun hi => ?_ obtain ⟨m, n, hmn, h⟩ := hp (fun n => hi.natEmbedding _ n) fun n => (hi.natEmbedding _ n).2 exact hmn.ne ((hi.natEmbedding _).injective <| Subtype.val_injective <| ha.eq (hi.natEmbedding _ m).2 (hi.natEmbedding _ n).2 h) #align is_antichain.finite_of_partially_well_ordered_on IsAntichain.finite_of_partiallyWellOrderedOn section IsRefl variable [IsRefl α r] protected theorem Finite.partiallyWellOrderedOn (hs : s.Finite) : s.PartiallyWellOrderedOn r := by intro f hf obtain ⟨m, n, hmn, h⟩ := hs.exists_lt_map_eq_of_forall_mem hf exact ⟨m, n, hmn, h.subst <| refl (f m)⟩ #align set.finite.partially_well_ordered_on Set.Finite.partiallyWellOrderedOn theorem _root_.IsAntichain.partiallyWellOrderedOn_iff (hs : IsAntichain r s) : s.PartiallyWellOrderedOn r ↔ s.Finite := ⟨hs.finite_of_partiallyWellOrderedOn, Finite.partiallyWellOrderedOn⟩ #align is_antichain.partially_well_ordered_on_iff IsAntichain.partiallyWellOrderedOn_iff @[simp] theorem partiallyWellOrderedOn_singleton (a : α) : PartiallyWellOrderedOn {a} r := (finite_singleton a).partiallyWellOrderedOn #align set.partially_well_ordered_on_singleton Set.partiallyWellOrderedOn_singleton @[nontriviality] theorem Subsingleton.partiallyWellOrderedOn (hs : s.Subsingleton) : PartiallyWellOrderedOn s r := hs.finite.partiallyWellOrderedOn @[simp]
Mathlib/Order/WellFoundedSet.lean
345
348
theorem partiallyWellOrderedOn_insert : PartiallyWellOrderedOn (insert a s) r ↔ PartiallyWellOrderedOn s r := by
simp only [← singleton_union, partiallyWellOrderedOn_union, partiallyWellOrderedOn_singleton, true_and_iff]
import Mathlib.Algebra.Algebra.Tower #align_import algebra.algebra.restrict_scalars from "leanprover-community/mathlib"@"c310cfdc40da4d99a10a58c33a95360ef9e6e0bf" variable (R S M A : Type*) @[nolint unusedArguments] def RestrictScalars (_R _S M : Type*) : Type _ := M #align restrict_scalars RestrictScalars instance [I : Inhabited M] : Inhabited (RestrictScalars R S M) := I instance [I : AddCommMonoid M] : AddCommMonoid (RestrictScalars R S M) := I instance [I : AddCommGroup M] : AddCommGroup (RestrictScalars R S M) := I section Module section variable [Semiring S] [AddCommMonoid M] def RestrictScalars.moduleOrig [I : Module S M] : Module S (RestrictScalars R S M) := I #align restrict_scalars.module_orig RestrictScalars.moduleOrig variable [CommSemiring R] [Algebra R S] section attribute [local instance] RestrictScalars.moduleOrig instance RestrictScalars.module [Module S M] : Module R (RestrictScalars R S M) := Module.compHom M (algebraMap R S) instance RestrictScalars.isScalarTower [Module S M] : IsScalarTower R S (RestrictScalars R S M) := ⟨fun r S M ↦ by rw [Algebra.smul_def, mul_smul] rfl⟩ #align restrict_scalars.is_scalar_tower RestrictScalars.isScalarTower end instance RestrictScalars.opModule [Module Sᵐᵒᵖ M] : Module Rᵐᵒᵖ (RestrictScalars R S M) := letI : Module Sᵐᵒᵖ (RestrictScalars R S M) := ‹Module Sᵐᵒᵖ M› Module.compHom M (RingHom.op <| algebraMap R S) #align restrict_scalars.op_module RestrictScalars.opModule instance RestrictScalars.isCentralScalar [Module S M] [Module Sᵐᵒᵖ M] [IsCentralScalar S M] : IsCentralScalar R (RestrictScalars R S M) where op_smul_eq_smul r _x := (op_smul_eq_smul (algebraMap R S r) (_ : M) : _) #align restrict_scalars.is_central_scalar RestrictScalars.isCentralScalar def RestrictScalars.lsmul [Module S M] : S →ₐ[R] Module.End R (RestrictScalars R S M) := -- We use `RestrictScalars.moduleOrig` in the implementation, -- but not in the type. letI : Module S (RestrictScalars R S M) := RestrictScalars.moduleOrig R S M Algebra.lsmul R R (RestrictScalars R S M) #align restrict_scalars.lsmul RestrictScalars.lsmul end variable [AddCommMonoid M] def RestrictScalars.addEquiv : RestrictScalars R S M ≃+ M := AddEquiv.refl M #align restrict_scalars.add_equiv RestrictScalars.addEquiv variable [CommSemiring R] [Semiring S] [Algebra R S] [Module S M] theorem RestrictScalars.smul_def (c : R) (x : RestrictScalars R S M) : c • x = (RestrictScalars.addEquiv R S M).symm (algebraMap R S c • RestrictScalars.addEquiv R S M x) := rfl #align restrict_scalars.smul_def RestrictScalars.smul_def @[simp] theorem RestrictScalars.addEquiv_map_smul (c : R) (x : RestrictScalars R S M) : RestrictScalars.addEquiv R S M (c • x) = algebraMap R S c • RestrictScalars.addEquiv R S M x := rfl #align restrict_scalars.add_equiv_map_smul RestrictScalars.addEquiv_map_smul theorem RestrictScalars.addEquiv_symm_map_algebraMap_smul (r : R) (x : M) : (RestrictScalars.addEquiv R S M).symm (algebraMap R S r • x) = r • (RestrictScalars.addEquiv R S M).symm x := rfl #align restrict_scalars.add_equiv_symm_map_algebra_map_smul RestrictScalars.addEquiv_symm_map_algebraMap_smul
Mathlib/Algebra/Algebra/RestrictScalars.lean
175
179
theorem RestrictScalars.addEquiv_symm_map_smul_smul (r : R) (s : S) (x : M) : (RestrictScalars.addEquiv R S M).symm ((r • s) • x) = r • (RestrictScalars.addEquiv R S M).symm (s • x) := by
rw [Algebra.smul_def, mul_smul] rfl
import Mathlib.Algebra.Order.Field.Basic import Mathlib.Data.Nat.Cast.Order import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.Nat.Cast.Order #align_import data.nat.choose.bounds from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11" open Nat variable {α : Type*} [LinearOrderedSemifield α] namespace Nat theorem choose_le_pow (r n : ℕ) : (n.choose r : α) ≤ (n ^ r : α) / r ! := by rw [le_div_iff'] · norm_cast rw [← Nat.descFactorial_eq_factorial_mul_choose] exact n.descFactorial_le_pow r exact mod_cast r.factorial_pos #align nat.choose_le_pow Nat.choose_le_pow -- horrific casting is due to ℕ-subtraction
Mathlib/Data/Nat/Choose/Bounds.lean
41
46
theorem pow_le_choose (r n : ℕ) : ((n + 1 - r : ℕ) ^ r : α) / r ! ≤ n.choose r := by
rw [div_le_iff'] · norm_cast rw [← Nat.descFactorial_eq_factorial_mul_choose] exact n.pow_sub_le_descFactorial r exact mod_cast r.factorial_pos
import Mathlib.Algebra.Group.Defs #align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered universe u variable {α : Type u} class Invertible [Mul α] [One α] (a : α) : Type u where invOf : α invOf_mul_self : invOf * a = 1 mul_invOf_self : a * invOf = 1 #align invertible Invertible prefix:max "⅟" =>-- This notation has the same precedence as `Inv.inv`. Invertible.invOf @[simp] theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 := Invertible.invOf_mul_self theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 := Invertible.invOf_mul_self #align inv_of_mul_self invOf_mul_self @[simp] theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 := Invertible.mul_invOf_self theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 := Invertible.mul_invOf_self #align mul_inv_of_self mul_invOf_self @[simp] theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] #align inv_of_mul_self_assoc invOf_mul_self_assoc @[simp] theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by rw [← mul_assoc, mul_invOf_self, one_mul] theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by rw [← mul_assoc, mul_invOf_self, one_mul] #align mul_inv_of_self_assoc mul_invOf_self_assoc @[simp] theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by simp [mul_assoc]
Mathlib/Algebra/Group/Invertible/Defs.lean
136
137
theorem mul_invOf_mul_self_cancel [Monoid α] (a b : α) [Invertible b] : a * ⅟ b * b = a := by
simp [mul_assoc]
import Mathlib.Analysis.NormedSpace.PiLp import Mathlib.Analysis.InnerProductSpace.PiL2 #align_import analysis.matrix from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" noncomputable section open scoped NNReal Matrix namespace Matrix variable {R l m n α β : Type*} [Fintype l] [Fintype m] [Fintype n] section LinfLinf section SeminormedAddCommGroup variable [SeminormedAddCommGroup α] [SeminormedAddCommGroup β] protected def seminormedAddCommGroup : SeminormedAddCommGroup (Matrix m n α) := Pi.seminormedAddCommGroup #align matrix.seminormed_add_comm_group Matrix.seminormedAddCommGroup attribute [local instance] Matrix.seminormedAddCommGroup -- Porting note (#10756): new theorem (along with all the uses of this lemma below) theorem norm_def (A : Matrix m n α) : ‖A‖ = ‖fun i j => A i j‖ := rfl lemma norm_eq_sup_sup_nnnorm (A : Matrix m n α) : ‖A‖ = Finset.sup Finset.univ fun i ↦ Finset.sup Finset.univ fun j ↦ ‖A i j‖₊ := by simp_rw [Matrix.norm_def, Pi.norm_def, Pi.nnnorm_def] -- Porting note (#10756): new theorem (along with all the uses of this lemma below) theorem nnnorm_def (A : Matrix m n α) : ‖A‖₊ = ‖fun i j => A i j‖₊ := rfl theorem norm_le_iff {r : ℝ} (hr : 0 ≤ r) {A : Matrix m n α} : ‖A‖ ≤ r ↔ ∀ i j, ‖A i j‖ ≤ r := by simp_rw [norm_def, pi_norm_le_iff_of_nonneg hr] #align matrix.norm_le_iff Matrix.norm_le_iff
Mathlib/Analysis/Matrix.lean
94
95
theorem nnnorm_le_iff {r : ℝ≥0} {A : Matrix m n α} : ‖A‖₊ ≤ r ↔ ∀ i j, ‖A i j‖₊ ≤ r := by
simp_rw [nnnorm_def, pi_nnnorm_le_iff]
import Mathlib.Order.Filter.AtTopBot import Mathlib.Order.Filter.Subsingleton open Set variable {α β γ δ : Type*} {l : Filter α} {f : α → β} namespace Filter def EventuallyConst (f : α → β) (l : Filter α) : Prop := (map f l).Subsingleton theorem HasBasis.eventuallyConst_iff {ι : Sort*} {p : ι → Prop} {s : ι → Set α} (h : l.HasBasis p s) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ x ∈ s i, ∀ y ∈ s i, f x = f y := (h.map f).subsingleton_iff.trans <| by simp only [Set.Subsingleton, forall_mem_image] theorem HasBasis.eventuallyConst_iff' {ι : Sort*} {p : ι → Prop} {s : ι → Set α} {x : ι → α} (h : l.HasBasis p s) (hx : ∀ i, p i → x i ∈ s i) : EventuallyConst f l ↔ ∃ i, p i ∧ ∀ y ∈ s i, f y = f (x i) := h.eventuallyConst_iff.trans <| exists_congr fun i ↦ and_congr_right fun hi ↦ ⟨fun h ↦ (h · · (x i) (hx i hi)), fun h a ha b hb ↦ h a ha ▸ (h b hb).symm⟩ lemma eventuallyConst_iff_tendsto [Nonempty β] : EventuallyConst f l ↔ ∃ x, Tendsto f l (pure x) := subsingleton_iff_exists_le_pure alias ⟨EventuallyConst.exists_tendsto, _⟩ := eventuallyConst_iff_tendsto theorem EventuallyConst.of_tendsto {x : β} (h : Tendsto f l (pure x)) : EventuallyConst f l := have : Nonempty β := ⟨x⟩; eventuallyConst_iff_tendsto.2 ⟨x, h⟩ theorem eventuallyConst_iff_exists_eventuallyEq [Nonempty β] : EventuallyConst f l ↔ ∃ c, f =ᶠ[l] fun _ ↦ c := subsingleton_iff_exists_singleton_mem alias ⟨EventuallyConst.eventuallyEq_const, _⟩ := eventuallyConst_iff_exists_eventuallyEq theorem eventuallyConst_pred' {p : α → Prop} : EventuallyConst p l ↔ (p =ᶠ[l] fun _ ↦ False) ∨ (p =ᶠ[l] fun _ ↦ True) := by simp only [eventuallyConst_iff_exists_eventuallyEq, Prop.exists_iff]
Mathlib/Order/Filter/EventuallyConst.lean
61
63
theorem eventuallyConst_pred {p : α → Prop} : EventuallyConst p l ↔ (∀ᶠ x in l, p x) ∨ (∀ᶠ x in l, ¬p x) := by
simp [eventuallyConst_pred', or_comm, EventuallyEq]
import Mathlib.Combinatorics.SimpleGraph.Subgraph import Mathlib.Data.List.Rotate #align_import combinatorics.simple_graph.connectivity from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4" open Function universe u v w namespace SimpleGraph variable {V : Type u} {V' : Type v} {V'' : Type w} variable (G : SimpleGraph V) (G' : SimpleGraph V') (G'' : SimpleGraph V'') inductive Walk : V → V → Type u | nil {u : V} : Walk u u | cons {u v w : V} (h : G.Adj u v) (p : Walk v w) : Walk u w deriving DecidableEq #align simple_graph.walk SimpleGraph.Walk attribute [refl] Walk.nil @[simps] instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v) := ⟨Walk.nil⟩ #align simple_graph.walk.inhabited SimpleGraph.Walk.instInhabited @[match_pattern, reducible] def Adj.toWalk {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Walk u v := Walk.cons h Walk.nil #align simple_graph.adj.to_walk SimpleGraph.Adj.toWalk namespace Walk variable {G} @[match_pattern] abbrev nil' (u : V) : G.Walk u u := Walk.nil #align simple_graph.walk.nil' SimpleGraph.Walk.nil' @[match_pattern] abbrev cons' (u v w : V) (h : G.Adj u v) (p : G.Walk v w) : G.Walk u w := Walk.cons h p #align simple_graph.walk.cons' SimpleGraph.Walk.cons' protected def copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : G.Walk u' v' := hu ▸ hv ▸ p #align simple_graph.walk.copy SimpleGraph.Walk.copy @[simp] theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl #align simple_graph.walk.copy_rfl_rfl SimpleGraph.Walk.copy_rfl_rfl @[simp] theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align simple_graph.walk.copy_copy SimpleGraph.Walk.copy_copy @[simp] theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = Walk.nil := by subst_vars rfl #align simple_graph.walk.copy_nil SimpleGraph.Walk.copy_nil theorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') : (Walk.cons h p).copy hu hw = Walk.cons (hu ▸ h) (p.copy rfl hw) := by subst_vars rfl #align simple_graph.walk.copy_cons SimpleGraph.Walk.copy_cons @[simp]
Mathlib/Combinatorics/SimpleGraph/Connectivity.lean
153
156
theorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) : Walk.cons h (p.copy hv hw) = (Walk.cons (hv ▸ h) p).copy rfl hw := by
subst_vars rfl
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff'
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
114
121
theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by
delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl
import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Data.Complex.Determinant #align_import analysis.complex.operator_norm from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6" open ContinuousLinearMap namespace Complex @[simp] theorem det_conjLIE : LinearMap.det (conjLIE.toLinearEquiv : ℂ →ₗ[ℝ] ℂ) = -1 := det_conjAe #align complex.det_conj_lie Complex.det_conjLIE @[simp] theorem linearEquiv_det_conjLIE : LinearEquiv.det conjLIE.toLinearEquiv = -1 := linearEquiv_det_conjAe #align complex.linear_equiv_det_conj_lie Complex.linearEquiv_det_conjLIE @[simp] theorem reCLM_norm : ‖reCLM‖ = 1 := le_antisymm (LinearMap.mkContinuous_norm_le _ zero_le_one _) <| calc 1 = ‖reCLM 1‖ := by simp _ ≤ ‖reCLM‖ := unit_le_opNorm _ _ (by simp) #align complex.re_clm_norm Complex.reCLM_norm @[simp] theorem reCLM_nnnorm : ‖reCLM‖₊ = 1 := Subtype.ext reCLM_norm #align complex.re_clm_nnnorm Complex.reCLM_nnnorm @[simp]
Mathlib/Analysis/Complex/OperatorNorm.lean
50
54
theorem imCLM_norm : ‖imCLM‖ = 1 := le_antisymm (LinearMap.mkContinuous_norm_le _ zero_le_one _) <| calc 1 = ‖imCLM I‖ := by
simp _ ≤ ‖imCLM‖ := unit_le_opNorm _ _ (by simp)
import Mathlib.Algebra.Polynomial.Degree.Lemmas open Polynomial namespace Mathlib.Tactic.ComputeDegree section recursion_lemmas variable {R : Type*} section semiring variable [Semiring R] theorem natDegree_C_le (a : R) : natDegree (C a) ≤ 0 := (natDegree_C a).le theorem natDegree_natCast_le (n : ℕ) : natDegree (n : R[X]) ≤ 0 := (natDegree_natCast _).le theorem natDegree_zero_le : natDegree (0 : R[X]) ≤ 0 := natDegree_zero.le theorem natDegree_one_le : natDegree (1 : R[X]) ≤ 0 := natDegree_one.le @[deprecated (since := "2024-04-17")] alias natDegree_nat_cast_le := natDegree_natCast_le theorem coeff_add_of_eq {n : ℕ} {a b : R} {f g : R[X]} (h_add_left : f.coeff n = a) (h_add_right : g.coeff n = b) : (f + g).coeff n = a + b := by subst ‹_› ‹_›; apply coeff_add theorem coeff_mul_add_of_le_natDegree_of_eq_ite {d df dg : ℕ} {a b : R} {f g : R[X]} (h_mul_left : natDegree f ≤ df) (h_mul_right : natDegree g ≤ dg) (h_mul_left : f.coeff df = a) (h_mul_right : g.coeff dg = b) (ddf : df + dg ≤ d) : (f * g).coeff d = if d = df + dg then a * b else 0 := by split_ifs with h · subst h_mul_left h_mul_right h exact coeff_mul_of_natDegree_le ‹_› ‹_› · apply coeff_eq_zero_of_natDegree_lt apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ddf ?_) · exact natDegree_mul_le_of_le ‹_› ‹_› · exact ne_comm.mp h theorem coeff_pow_of_natDegree_le_of_eq_ite' {m n o : ℕ} {a : R} {p : R[X]} (h_pow : natDegree p ≤ n) (h_exp : m * n ≤ o) (h_pow_bas : coeff p n = a) : coeff (p ^ m) o = if o = m * n then a ^ m else 0 := by split_ifs with h · subst h h_pow_bas exact coeff_pow_of_natDegree_le ‹_› · apply coeff_eq_zero_of_natDegree_lt apply lt_of_le_of_lt ?_ (lt_of_le_of_ne ‹_› ?_) · exact natDegree_pow_le_of_le m ‹_› · exact Iff.mp ne_comm h theorem natDegree_smul_le_of_le {n : ℕ} {a : R} {f : R[X]} (hf : natDegree f ≤ n) : natDegree (a • f) ≤ n := (natDegree_smul_le a f).trans hf theorem degree_smul_le_of_le {n : ℕ} {a : R} {f : R[X]} (hf : degree f ≤ n) : degree (a • f) ≤ n := (degree_smul_le a f).trans hf theorem coeff_smul {n : ℕ} {a : R} {f : R[X]} : (a • f).coeff n = a * f.coeff n := rfl section congr_lemmas theorem natDegree_eq_of_le_of_coeff_ne_zero' {deg m o : ℕ} {c : R} {p : R[X]} (h_natDeg_le : natDegree p ≤ m) (coeff_eq : coeff p o = c) (coeff_ne_zero : c ≠ 0) (deg_eq_deg : m = deg) (coeff_eq_deg : o = deg) : natDegree p = deg := by subst coeff_eq deg_eq_deg coeff_eq_deg exact natDegree_eq_of_le_of_coeff_ne_zero ‹_› ‹_›
Mathlib/Tactic/ComputeDegree.lean
157
165
theorem degree_eq_of_le_of_coeff_ne_zero' {deg m o : WithBot ℕ} {c : R} {p : R[X]} (h_deg_le : degree p ≤ m) (coeff_eq : coeff p (WithBot.unbot' 0 deg) = c) (coeff_ne_zero : c ≠ 0) (deg_eq_deg : m = deg) (coeff_eq_deg : o = deg) : degree p = deg := by
subst coeff_eq coeff_eq_deg deg_eq_deg rcases eq_or_ne m ⊥ with rfl|hh · exact bot_unique h_deg_le · obtain ⟨m, rfl⟩ := WithBot.ne_bot_iff_exists.mp hh exact degree_eq_of_le_of_coeff_ne_zero ‹_› ‹_›
import Mathlib.Data.Int.Order.Units import Mathlib.Data.ZMod.IntUnitsPower import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.LinearAlgebra.DirectSum.TensorProduct import Mathlib.Algebra.DirectSum.Algebra suppress_compilation open scoped TensorProduct DirectSum variable {R ι A B : Type*} namespace TensorProduct variable [CommSemiring ι] [Module ι (Additive ℤˣ)] [DecidableEq ι] variable (𝒜 : ι → Type*) (ℬ : ι → Type*) variable [CommRing R] variable [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (ℬ i)] variable [∀ i, Module R (𝒜 i)] [∀ i, Module R (ℬ i)] variable [DirectSum.GRing 𝒜] [DirectSum.GRing ℬ] variable [DirectSum.GAlgebra R 𝒜] [DirectSum.GAlgebra R ℬ] -- this helps with performance instance (i : ι × ι) : Module R (𝒜 (Prod.fst i) ⊗[R] ℬ (Prod.snd i)) := TensorProduct.leftModule open DirectSum (lof) variable (R) section gradedComm local notation "𝒜ℬ" => (fun i : ι × ι => 𝒜 (Prod.fst i) ⊗[R] ℬ (Prod.snd i)) local notation "ℬ𝒜" => (fun i : ι × ι => ℬ (Prod.fst i) ⊗[R] 𝒜 (Prod.snd i)) def gradedCommAux : DirectSum _ 𝒜ℬ →ₗ[R] DirectSum _ ℬ𝒜 := by refine DirectSum.toModule R _ _ fun i => ?_ have o := DirectSum.lof R _ ℬ𝒜 i.swap have s : ℤˣ := ((-1 : ℤˣ)^(i.1* i.2 : ι) : ℤˣ) exact (s • o) ∘ₗ (TensorProduct.comm R _ _).toLinearMap @[simp] theorem gradedCommAux_lof_tmul (i j : ι) (a : 𝒜 i) (b : ℬ j) : gradedCommAux R 𝒜 ℬ (lof R _ 𝒜ℬ (i, j) (a ⊗ₜ b)) = (-1 : ℤˣ)^(j * i) • lof R _ ℬ𝒜 (j, i) (b ⊗ₜ a) := by rw [gradedCommAux] dsimp simp [mul_comm i j] @[simp] theorem gradedCommAux_comp_gradedCommAux : gradedCommAux R 𝒜 ℬ ∘ₗ gradedCommAux R ℬ 𝒜 = LinearMap.id := by ext i a b dsimp rw [gradedCommAux_lof_tmul, LinearMap.map_smul_of_tower, gradedCommAux_lof_tmul, smul_smul, mul_comm i.2 i.1, Int.units_mul_self, one_smul] def gradedComm : (⨁ i, 𝒜 i) ⊗[R] (⨁ i, ℬ i) ≃ₗ[R] (⨁ i, ℬ i) ⊗[R] (⨁ i, 𝒜 i) := by refine TensorProduct.directSum R R 𝒜 ℬ ≪≫ₗ ?_ ≪≫ₗ (TensorProduct.directSum R R ℬ 𝒜).symm exact LinearEquiv.ofLinear (gradedCommAux _ _ _) (gradedCommAux _ _ _) (gradedCommAux_comp_gradedCommAux _ _ _) (gradedCommAux_comp_gradedCommAux _ _ _) @[simp]
Mathlib/LinearAlgebra/TensorProduct/Graded/External.lean
111
114
theorem gradedComm_symm : (gradedComm R 𝒜 ℬ).symm = gradedComm R ℬ 𝒜 := by
rw [gradedComm, gradedComm, LinearEquiv.trans_symm, LinearEquiv.symm_symm] ext rfl
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section variable [LinearOrderedField α] {a b c d : α} {n : ℤ} theorem div_pos_iff : 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 := by simp only [division_def, mul_pos_iff, inv_pos, inv_lt_zero] #align div_pos_iff div_pos_iff theorem div_neg_iff : a / b < 0 ↔ 0 < a ∧ b < 0 ∨ a < 0 ∧ 0 < b := by simp [division_def, mul_neg_iff] #align div_neg_iff div_neg_iff theorem div_nonneg_iff : 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 := by simp [division_def, mul_nonneg_iff] #align div_nonneg_iff div_nonneg_iff theorem div_nonpos_iff : a / b ≤ 0 ↔ 0 ≤ a ∧ b ≤ 0 ∨ a ≤ 0 ∧ 0 ≤ b := by simp [division_def, mul_nonpos_iff] #align div_nonpos_iff div_nonpos_iff theorem div_nonneg_of_nonpos (ha : a ≤ 0) (hb : b ≤ 0) : 0 ≤ a / b := div_nonneg_iff.2 <| Or.inr ⟨ha, hb⟩ #align div_nonneg_of_nonpos div_nonneg_of_nonpos theorem div_pos_of_neg_of_neg (ha : a < 0) (hb : b < 0) : 0 < a / b := div_pos_iff.2 <| Or.inr ⟨ha, hb⟩ #align div_pos_of_neg_of_neg div_pos_of_neg_of_neg theorem div_neg_of_neg_of_pos (ha : a < 0) (hb : 0 < b) : a / b < 0 := div_neg_iff.2 <| Or.inr ⟨ha, hb⟩ #align div_neg_of_neg_of_pos div_neg_of_neg_of_pos theorem div_neg_of_pos_of_neg (ha : 0 < a) (hb : b < 0) : a / b < 0 := div_neg_iff.2 <| Or.inl ⟨ha, hb⟩ #align div_neg_of_pos_of_neg div_neg_of_pos_of_neg theorem div_le_iff_of_neg (hc : c < 0) : b / c ≤ a ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc) ▸ mul_le_mul_of_nonpos_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc) _ ≥ b * (1 / c) := mul_le_mul_of_nonpos_right h (one_div_neg.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align div_le_iff_of_neg div_le_iff_of_neg
Mathlib/Algebra/Order/Field/Basic.lean
674
675
theorem div_le_iff_of_neg' (hc : c < 0) : b / c ≤ a ↔ c * a ≤ b := by
rw [mul_comm, div_le_iff_of_neg hc]
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
Mathlib/SetTheory/Game/Nim.lean
70
70
theorem rightMoves_nim (o : Ordinal) : (nim o).RightMoves = o.out.α := by
rw [nim_def]; rfl
import Mathlib.Analysis.InnerProductSpace.PiL2 import Mathlib.LinearAlgebra.Matrix.Block #align_import analysis.inner_product_space.gram_schmidt_ortho from "leanprover-community/mathlib"@"1a4df69ca1a9a0e5e26bfe12e2b92814216016d0" open Finset Submodule FiniteDimensional variable (𝕜 : Type*) {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable {ι : Type*} [LinearOrder ι] [LocallyFiniteOrderBot ι] [IsWellOrder ι (· < ·)] attribute [local instance] IsWellOrder.toHasWellFounded local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y noncomputable def gramSchmidt [IsWellOrder ι (· < ·)] (f : ι → E) (n : ι) : E := f n - ∑ i : Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt f i) (f n) termination_by n decreasing_by exact mem_Iio.1 i.2 #align gram_schmidt gramSchmidt theorem gramSchmidt_def (f : ι → E) (n : ι) : gramSchmidt 𝕜 f n = f n - ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [← sum_attach, attach_eq_univ, gramSchmidt] #align gram_schmidt_def gramSchmidt_def theorem gramSchmidt_def' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, orthogonalProjection (𝕜 ∙ gramSchmidt 𝕜 f i) (f n) := by rw [gramSchmidt_def, sub_add_cancel] #align gram_schmidt_def' gramSchmidt_def'
Mathlib/Analysis/InnerProductSpace/GramSchmidtOrtho.lean
68
72
theorem gramSchmidt_def'' (f : ι → E) (n : ι) : f n = gramSchmidt 𝕜 f n + ∑ i ∈ Iio n, (⟪gramSchmidt 𝕜 f i, f n⟫ / (‖gramSchmidt 𝕜 f i‖ : 𝕜) ^ 2) • gramSchmidt 𝕜 f i := by
convert gramSchmidt_def' 𝕜 f n rw [orthogonalProjection_singleton, RCLike.ofReal_pow]
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.Set.Basic import Mathlib.Data.Setoid.Basic import Mathlib.GroupTheory.Coset #align_import group_theory.double_coset from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" -- Porting note: removed import -- import Mathlib.Tactic.Group variable {G : Type*} [Group G] {α : Type*} [Mul α] (J : Subgroup G) (g : G) open MulOpposite open scoped Pointwise namespace Doset def doset (a : α) (s t : Set α) : Set α := s * {a} * t #align doset Doset.doset lemma doset_eq_image2 (a : α) (s t : Set α) : doset a s t = Set.image2 (· * a * ·) s t := by simp_rw [doset, Set.mul_singleton, ← Set.image2_mul, Set.image2_image_left] theorem mem_doset {s t : Set α} {a b : α} : b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y := by simp only [doset_eq_image2, Set.mem_image2, eq_comm] #align doset.mem_doset Doset.mem_doset theorem mem_doset_self (H K : Subgroup G) (a : G) : a ∈ doset a H K := mem_doset.mpr ⟨1, H.one_mem, 1, K.one_mem, (one_mul a).symm.trans (mul_one (1 * a)).symm⟩ #align doset.mem_doset_self Doset.mem_doset_self
Mathlib/GroupTheory/DoubleCoset.lean
52
57
theorem doset_eq_of_mem {H K : Subgroup G} {a b : G} (hb : b ∈ doset a H K) : doset b H K = doset a H K := by
obtain ⟨h, hh, k, hk, rfl⟩ := mem_doset.1 hb rw [doset, doset, ← Set.singleton_mul_singleton, ← Set.singleton_mul_singleton, mul_assoc, mul_assoc, Subgroup.singleton_mul_subgroup hk, ← mul_assoc, ← mul_assoc, Subgroup.subgroup_mul_singleton hh]
import Mathlib.Probability.Kernel.Disintegration.Integral open MeasureTheory Set Filter MeasurableSpace open scoped ENNReal MeasureTheory Topology ProbabilityTheory namespace ProbabilityTheory variable {α β Ω : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} [MeasurableSpace Ω] [StandardBorelSpace Ω] [Nonempty Ω] section Measure variable {ρ : Measure (α × Ω)} [IsFiniteMeasure ρ] theorem eq_condKernel_of_measure_eq_compProd' (κ : kernel α Ω) [IsSFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) {s : Set Ω} (hs : MeasurableSet s) : ∀ᵐ x ∂ρ.fst, κ x s = ρ.condKernel x s := by refine ae_eq_of_forall_set_lintegral_eq_of_sigmaFinite (kernel.measurable_coe κ hs) (kernel.measurable_coe ρ.condKernel hs) (fun t ht _ ↦ ?_) conv_rhs => rw [Measure.set_lintegral_condKernel_eq_measure_prod ht hs, hκ] simp only [Measure.compProd_apply (ht.prod hs), Set.mem_prod, ← lintegral_indicator _ ht] congr with x by_cases hx : x ∈ t all_goals simp [hx] lemma eq_condKernel_of_measure_eq_compProd_real {ρ : Measure (α × ℝ)} [IsFiniteMeasure ρ] (κ : kernel α ℝ) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by have huniv : ∀ᵐ x ∂ρ.fst, κ x Set.univ = ρ.condKernel x Set.univ := eq_condKernel_of_measure_eq_compProd' κ hκ MeasurableSet.univ suffices ∀ᵐ x ∂ρ.fst, ∀ ⦃t⦄, MeasurableSet t → κ x t = ρ.condKernel x t by filter_upwards [this] with x hx ext t ht; exact hx ht apply MeasurableSpace.ae_induction_on_inter Real.borel_eq_generateFrom_Iic_rat Real.isPiSystem_Iic_rat · simp · simp only [iUnion_singleton_eq_range, mem_range, forall_exists_index, forall_apply_eq_imp_iff] exact ae_all_iff.2 fun q ↦ eq_condKernel_of_measure_eq_compProd' κ hκ measurableSet_Iic · filter_upwards [huniv] with x hxuniv t ht heq rw [measure_compl ht <| measure_ne_top _ _, heq, hxuniv, measure_compl ht <| measure_ne_top _ _] · refine ae_of_all _ (fun x f hdisj hf heq ↦ ?_) rw [measure_iUnion hdisj hf, measure_iUnion hdisj hf] exact tsum_congr heq
Mathlib/Probability/Kernel/Disintegration/Unique.lean
81
124
theorem eq_condKernel_of_measure_eq_compProd (κ : kernel α Ω) [IsFiniteKernel κ] (hκ : ρ = ρ.fst ⊗ₘ κ) : ∀ᵐ x ∂ρ.fst, κ x = ρ.condKernel x := by
-- The idea is to transport the question to `ℝ` from `Ω` using `embeddingReal` -- and then construct a measure on `α × ℝ` let f := embeddingReal Ω have hf := measurableEmbedding_embeddingReal Ω set ρ' : Measure (α × ℝ) := ρ.map (Prod.map id f) with hρ'def have hρ' : ρ'.fst = ρ.fst := by ext s hs rw [hρ'def, Measure.fst_apply, Measure.fst_apply, Measure.map_apply] exacts [rfl, Measurable.prod measurable_fst <| hf.measurable.comp measurable_snd, measurable_fst hs, hs, hs] have hρ'' : ∀ᵐ x ∂ρ.fst, kernel.map κ f hf.measurable x = ρ'.condKernel x := by rw [← hρ'] refine eq_condKernel_of_measure_eq_compProd_real (kernel.map κ f hf.measurable) ?_ ext s hs conv_lhs => rw [hρ'def, hκ] rw [Measure.map_apply (measurable_id.prod_map hf.measurable) hs, hρ', Measure.compProd_apply hs, Measure.compProd_apply (measurable_id.prod_map hf.measurable hs)] congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] suffices ∀ᵐ x ∂ρ.fst, ∀ s, MeasurableSet s → ρ'.condKernel x s = ρ.condKernel x (f ⁻¹' s) by filter_upwards [hρ'', this] with x hx h rw [kernel.map_apply] at hx ext s hs rw [← Set.preimage_image_eq s hf.injective, ← Measure.map_apply hf.measurable <| hf.measurableSet_image.2 hs, hx, h _ <| hf.measurableSet_image.2 hs] suffices ρ.map (Prod.map id f) = (ρ.fst ⊗ₘ (kernel.map ρ.condKernel f hf.measurable)) by rw [← hρ'] at this have heq := eq_condKernel_of_measure_eq_compProd_real _ this rw [hρ'] at heq filter_upwards [heq] with x hx s hs rw [← hx, kernel.map_apply, Measure.map_apply hf.measurable hs] ext s hs conv_lhs => rw [← ρ.compProd_fst_condKernel] rw [Measure.compProd_apply hs, Measure.map_apply (measurable_id.prod_map hf.measurable) hs, Measure.compProd_apply] · congr with a rw [kernel.map_apply'] exacts [rfl, measurable_prod_mk_left hs] · exact measurable_id.prod_map hf.measurable hs
import Mathlib.Data.List.Cycle import Mathlib.GroupTheory.Perm.Cycle.Type import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a" open Equiv Equiv.Perm List variable {α : Type*} namespace List variable [DecidableEq α] {l l' : List α} theorem formPerm_disjoint_iff (hl : Nodup l) (hl' : Nodup l') (hn : 2 ≤ l.length) (hn' : 2 ≤ l'.length) : Perm.Disjoint (formPerm l) (formPerm l') ↔ l.Disjoint l' := by rw [disjoint_iff_eq_or_eq, List.Disjoint] constructor · rintro h x hx hx' specialize h x rw [formPerm_apply_mem_eq_self_iff _ hl _ hx, formPerm_apply_mem_eq_self_iff _ hl' _ hx'] at h omega · intro h x by_cases hx : x ∈ l on_goal 1 => by_cases hx' : x ∈ l' · exact (h hx hx').elim all_goals have := formPerm_eq_self_of_not_mem _ _ ‹_›; tauto #align list.form_perm_disjoint_iff List.formPerm_disjoint_iff theorem isCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : IsCycle (formPerm l) := by cases' l with x l · set_option tactic.skipAssignedInstances false in norm_num at hn induction' l with y l generalizing x · set_option tactic.skipAssignedInstances false in norm_num at hn · use x constructor · rwa [formPerm_apply_mem_ne_self_iff _ hl _ (mem_cons_self _ _)] · intro w hw have : w ∈ x::y::l := mem_of_formPerm_ne_self _ _ hw obtain ⟨k, hk⟩ := get_of_mem this use k rw [← hk] simp only [zpow_natCast, formPerm_pow_apply_head _ _ hl k, Nat.mod_eq_of_lt k.isLt] #align list.is_cycle_form_perm List.isCycle_formPerm theorem pairwise_sameCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : Pairwise l.formPerm.SameCycle l := Pairwise.imp_mem.mpr (pairwise_of_forall fun _ _ hx hy => (isCycle_formPerm hl hn).sameCycle ((formPerm_apply_mem_ne_self_iff _ hl _ hx).mpr hn) ((formPerm_apply_mem_ne_self_iff _ hl _ hy).mpr hn)) #align list.pairwise_same_cycle_form_perm List.pairwise_sameCycle_formPerm theorem cycleOf_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) (x) : cycleOf l.attach.formPerm x = l.attach.formPerm := have hn : 2 ≤ l.attach.length := by rwa [← length_attach] at hn have hl : l.attach.Nodup := by rwa [← nodup_attach] at hl (isCycle_formPerm hl hn).cycleOf_eq ((formPerm_apply_mem_ne_self_iff _ hl _ (mem_attach _ _)).mpr hn) #align list.cycle_of_form_perm List.cycleOf_formPerm
Mathlib/GroupTheory/Perm/Cycle/Concrete.lean
105
117
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : cycleType l.attach.formPerm = {l.length} := by
rw [← length_attach] at hn rw [← nodup_attach] at hl rw [cycleType_eq [l.attach.formPerm]] · simp only [map, Function.comp_apply] rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl] · simp · intro x h simp [h, Nat.succ_le_succ_iff] at hn · simp · simpa using isCycle_formPerm hl hn · simp
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] theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by classical rw [vars_def, degrees_C, Multiset.toFinset_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_C MvPolynomial.vars_C @[simp] theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)] set_option linter.uppercaseLean3 false in #align mv_polynomial.vars_X MvPolynomial.vars_X theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop] #align mv_polynomial.mem_vars MvPolynomial.mem_vars
Mathlib/Algebra/MvPolynomial/Variables.lean
102
105
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support) {v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.Topology.ContinuousFunction.Basic import Mathlib.Topology.Algebra.Module.Basic #align_import topology.algebra.continuous_affine_map from "leanprover-community/mathlib"@"bd1fc183335ea95a9519a1630bcf901fe9326d83" structure ContinuousAffineMap (R : Type*) {V W : Type*} (P Q : Type*) [Ring R] [AddCommGroup V] [Module R V] [TopologicalSpace P] [AddTorsor V P] [AddCommGroup W] [Module R W] [TopologicalSpace Q] [AddTorsor W Q] extends P →ᵃ[R] Q where cont : Continuous toFun #align continuous_affine_map ContinuousAffineMap notation:25 P " →ᴬ[" R "] " Q => ContinuousAffineMap R P Q namespace ContinuousAffineMap variable {R V W P Q : Type*} [Ring R] variable [AddCommGroup V] [Module R V] [TopologicalSpace P] [AddTorsor V P] variable [AddCommGroup W] [Module R W] [TopologicalSpace Q] [AddTorsor W Q] instance : Coe (P →ᴬ[R] Q) (P →ᵃ[R] Q) := ⟨toAffineMap⟩ theorem to_affineMap_injective {f g : P →ᴬ[R] Q} (h : (f : P →ᵃ[R] Q) = (g : P →ᵃ[R] Q)) : f = g := by cases f cases g congr #align continuous_affine_map.to_affine_map_injective ContinuousAffineMap.to_affineMap_injective instance : FunLike (P →ᴬ[R] Q) P Q where coe f := f.toAffineMap coe_injective' _ _ h := to_affineMap_injective <| DFunLike.coe_injective h instance : ContinuousMapClass (P →ᴬ[R] Q) P Q where map_continuous := cont theorem toFun_eq_coe (f : P →ᴬ[R] Q) : f.toFun = ⇑f := rfl #align continuous_affine_map.to_fun_eq_coe ContinuousAffineMap.toFun_eq_coe theorem coe_injective : @Function.Injective (P →ᴬ[R] Q) (P → Q) (⇑) := DFunLike.coe_injective #align continuous_affine_map.coe_injective ContinuousAffineMap.coe_injective @[ext] theorem ext {f g : P →ᴬ[R] Q} (h : ∀ x, f x = g x) : f = g := DFunLike.ext _ _ h #align continuous_affine_map.ext ContinuousAffineMap.ext theorem ext_iff {f g : P →ᴬ[R] Q} : f = g ↔ ∀ x, f x = g x := DFunLike.ext_iff #align continuous_affine_map.ext_iff ContinuousAffineMap.ext_iff theorem congr_fun {f g : P →ᴬ[R] Q} (h : f = g) (x : P) : f x = g x := DFunLike.congr_fun h _ #align continuous_affine_map.congr_fun ContinuousAffineMap.congr_fun def toContinuousMap (f : P →ᴬ[R] Q) : C(P, Q) := ⟨f, f.cont⟩ #align continuous_affine_map.to_continuous_map ContinuousAffineMap.toContinuousMap -- Porting note: changed to CoeHead due to difficulty with synthesization order instance : CoeHead (P →ᴬ[R] Q) C(P, Q) := ⟨toContinuousMap⟩ @[simp] theorem toContinuousMap_coe (f : P →ᴬ[R] Q) : f.toContinuousMap = ↑f := rfl #align continuous_affine_map.to_continuous_map_coe ContinuousAffineMap.toContinuousMap_coe @[simp] -- Porting note: removed `norm_cast` theorem coe_to_affineMap (f : P →ᴬ[R] Q) : ((f : P →ᵃ[R] Q) : P → Q) = f := rfl #align continuous_affine_map.coe_to_affine_map ContinuousAffineMap.coe_to_affineMap -- Porting note: removed `norm_cast` and `simp` since proof is `simp only [ContinuousMap.coe_mk]` theorem coe_to_continuousMap (f : P →ᴬ[R] Q) : ((f : C(P, Q)) : P → Q) = f := rfl #align continuous_affine_map.coe_to_continuous_map ContinuousAffineMap.coe_to_continuousMap theorem to_continuousMap_injective {f g : P →ᴬ[R] Q} (h : (f : C(P, Q)) = (g : C(P, Q))) : f = g := by ext a exact ContinuousMap.congr_fun h a #align continuous_affine_map.to_continuous_map_injective ContinuousAffineMap.to_continuousMap_injective -- Porting note: removed `norm_cast` theorem coe_affineMap_mk (f : P →ᵃ[R] Q) (h) : ((⟨f, h⟩ : P →ᴬ[R] Q) : P →ᵃ[R] Q) = f := rfl #align continuous_affine_map.coe_affine_map_mk ContinuousAffineMap.coe_affineMap_mk @[norm_cast] theorem coe_continuousMap_mk (f : P →ᵃ[R] Q) (h) : ((⟨f, h⟩ : P →ᴬ[R] Q) : C(P, Q)) = ⟨f, h⟩ := rfl #align continuous_affine_map.coe_continuous_map_mk ContinuousAffineMap.coe_continuousMap_mk @[simp] theorem coe_mk (f : P →ᵃ[R] Q) (h) : ((⟨f, h⟩ : P →ᴬ[R] Q) : P → Q) = f := rfl #align continuous_affine_map.coe_mk ContinuousAffineMap.coe_mk @[simp]
Mathlib/Topology/Algebra/ContinuousAffineMap.lean
127
129
theorem mk_coe (f : P →ᴬ[R] Q) (h) : (⟨(f : P →ᵃ[R] Q), h⟩ : P →ᴬ[R] Q) = f := by
ext rfl
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]
Mathlib/Topology/Compactness/Lindelof.lean
69
75
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]
import Mathlib.Topology.Sheaves.PUnit import Mathlib.Topology.Sheaves.Stalks import Mathlib.Topology.Sheaves.Functors #align_import topology.sheaves.skyscraper from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open TopologicalSpace TopCat CategoryTheory CategoryTheory.Limits Opposite universe u v w variable {X : TopCat.{u}} (p₀ : X) [∀ U : Opens X, Decidable (p₀ ∈ U)] section variable {C : Type v} [Category.{w} C] [HasTerminal C] (A : C) @[simps] def skyscraperPresheaf : Presheaf C X where obj U := if p₀ ∈ unop U then A else terminal C map {U V} i := if h : p₀ ∈ unop V then eqToHom <| by dsimp; erw [if_pos h, if_pos (leOfHom i.unop h)] else ((if_neg h).symm.ndrec terminalIsTerminal).from _ map_id U := (em (p₀ ∈ U.unop)).elim (fun h => dif_pos h) fun h => ((if_neg h).symm.ndrec terminalIsTerminal).hom_ext _ _ map_comp {U V W} iVU iWV := by by_cases hW : p₀ ∈ unop W · have hV : p₀ ∈ unop V := leOfHom iWV.unop hW simp only [dif_pos hW, dif_pos hV, eqToHom_trans] · dsimp; rw [dif_neg hW]; apply ((if_neg hW).symm.ndrec terminalIsTerminal).hom_ext #align skyscraper_presheaf skyscraperPresheaf theorem skyscraperPresheaf_eq_pushforward [hd : ∀ U : Opens (TopCat.of PUnit.{u + 1}), Decidable (PUnit.unit ∈ U)] : skyscraperPresheaf p₀ A = ContinuousMap.const (TopCat.of PUnit) p₀ _* skyscraperPresheaf (X := TopCat.of PUnit) PUnit.unit A := by convert_to @skyscraperPresheaf X p₀ (fun U => hd <| (Opens.map <| ContinuousMap.const _ p₀).obj U) C _ _ A = _ <;> congr #align skyscraper_presheaf_eq_pushforward skyscraperPresheaf_eq_pushforward @[simps] def SkyscraperPresheafFunctor.map' {a b : C} (f : a ⟶ b) : skyscraperPresheaf p₀ a ⟶ skyscraperPresheaf p₀ b where app U := if h : p₀ ∈ U.unop then eqToHom (if_pos h) ≫ f ≫ eqToHom (if_pos h).symm else ((if_neg h).symm.ndrec terminalIsTerminal).from _ naturality U V i := by simp only [skyscraperPresheaf_map]; by_cases hV : p₀ ∈ V.unop · have hU : p₀ ∈ U.unop := leOfHom i.unop hV; split_ifs <;> simp only [eqToHom_trans_assoc, Category.assoc, eqToHom_trans] · apply ((if_neg hV).symm.ndrec terminalIsTerminal).hom_ext #align skyscraper_presheaf_functor.map' SkyscraperPresheafFunctor.map' theorem SkyscraperPresheafFunctor.map'_id {a : C} : SkyscraperPresheafFunctor.map' p₀ (𝟙 a) = 𝟙 _ := by ext U simp only [SkyscraperPresheafFunctor.map'_app, NatTrans.id_app]; split_ifs <;> aesop_cat #align skyscraper_presheaf_functor.map'_id SkyscraperPresheafFunctor.map'_id
Mathlib/Topology/Sheaves/Skyscraper.lean
100
107
theorem SkyscraperPresheafFunctor.map'_comp {a b c : C} (f : a ⟶ b) (g : b ⟶ c) : SkyscraperPresheafFunctor.map' p₀ (f ≫ g) = SkyscraperPresheafFunctor.map' p₀ f ≫ SkyscraperPresheafFunctor.map' p₀ g := by
ext U -- Porting note: change `simp` to `rw` rw [NatTrans.comp_app] simp only [SkyscraperPresheafFunctor.map'_app] split_ifs with h <;> aesop_cat
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.NormedSpace.Banach import Mathlib.LinearAlgebra.SesquilinearForm #align_import analysis.inner_product_space.symmetric from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open RCLike open ComplexConjugate variable {𝕜 E E' F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] variable [NormedAddCommGroup G] [InnerProductSpace 𝕜 G] variable [NormedAddCommGroup E'] [InnerProductSpace ℝ E'] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearMap def IsSymmetric (T : E →ₗ[𝕜] E) : Prop := ∀ x y, ⟪T x, y⟫ = ⟪x, T y⟫ #align linear_map.is_symmetric LinearMap.IsSymmetric theorem IsSymmetric.conj_inner_sym {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) (x y : E) : conj ⟪T x, y⟫ = ⟪T y, x⟫ := by rw [hT x y, inner_conj_symm] #align linear_map.is_symmetric.conj_inner_sym LinearMap.IsSymmetric.conj_inner_sym @[simp] theorem IsSymmetric.apply_clm {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x y : E) : ⟪T x, y⟫ = ⟪x, T y⟫ := hT x y #align linear_map.is_symmetric.apply_clm LinearMap.IsSymmetric.apply_clm theorem isSymmetric_zero : (0 : E →ₗ[𝕜] E).IsSymmetric := fun x y => (inner_zero_right x : ⟪x, 0⟫ = 0).symm ▸ (inner_zero_left y : ⟪0, y⟫ = 0) #align linear_map.is_symmetric_zero LinearMap.isSymmetric_zero theorem isSymmetric_id : (LinearMap.id : E →ₗ[𝕜] E).IsSymmetric := fun _ _ => rfl #align linear_map.is_symmetric_id LinearMap.isSymmetric_id theorem IsSymmetric.add {T S : E →ₗ[𝕜] E} (hT : T.IsSymmetric) (hS : S.IsSymmetric) : (T + S).IsSymmetric := by intro x y rw [LinearMap.add_apply, inner_add_left, hT x y, hS x y, ← inner_add_right] rfl #align linear_map.is_symmetric.add LinearMap.IsSymmetric.add theorem IsSymmetric.continuous [CompleteSpace E] {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) : Continuous T := by -- We prove it by using the closed graph theorem refine T.continuous_of_seq_closed_graph fun u x y hu hTu => ?_ rw [← sub_eq_zero, ← @inner_self_eq_zero 𝕜] have hlhs : ∀ k : ℕ, ⟪T (u k) - T x, y - T x⟫ = ⟪u k - x, T (y - T x)⟫ := by intro k rw [← T.map_sub, hT] refine tendsto_nhds_unique ((hTu.sub_const _).inner tendsto_const_nhds) ?_ simp_rw [Function.comp_apply, hlhs] rw [← inner_zero_left (T (y - T x))] refine Filter.Tendsto.inner ?_ tendsto_const_nhds rw [← sub_self x] exact hu.sub_const _ #align linear_map.is_symmetric.continuous LinearMap.IsSymmetric.continuous @[simp] theorem IsSymmetric.coe_reApplyInnerSelf_apply {T : E →L[𝕜] E} (hT : IsSymmetric (T : E →ₗ[𝕜] E)) (x : E) : (T.reApplyInnerSelf x : 𝕜) = ⟪T x, x⟫ := by rsuffices ⟨r, hr⟩ : ∃ r : ℝ, ⟪T x, x⟫ = r · simp [hr, T.reApplyInnerSelf_apply] rw [← conj_eq_iff_real] exact hT.conj_inner_sym x x #align linear_map.is_symmetric.coe_re_apply_inner_self_apply LinearMap.IsSymmetric.coe_reApplyInnerSelf_apply theorem IsSymmetric.restrict_invariant {T : E →ₗ[𝕜] E} (hT : IsSymmetric T) {V : Submodule 𝕜 E} (hV : ∀ v ∈ V, T v ∈ V) : IsSymmetric (T.restrict hV) := fun v w => hT v w #align linear_map.is_symmetric.restrict_invariant LinearMap.IsSymmetric.restrict_invariant theorem IsSymmetric.restrictScalars {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric) : @LinearMap.IsSymmetric ℝ E _ _ (InnerProductSpace.rclikeToReal 𝕜 E) (@LinearMap.restrictScalars ℝ 𝕜 _ _ _ _ _ _ (InnerProductSpace.rclikeToReal 𝕜 E).toModule (InnerProductSpace.rclikeToReal 𝕜 E).toModule _ _ _ T) := fun x y => by simp [hT x y, real_inner_eq_re_inner, LinearMap.coe_restrictScalars ℝ] #align linear_map.is_symmetric.restrict_scalars LinearMap.IsSymmetric.restrictScalars section Complex variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V]
Mathlib/Analysis/InnerProductSpace/Symmetric.lean
142
156
theorem isSymmetric_iff_inner_map_self_real (T : V →ₗ[ℂ] V) : IsSymmetric T ↔ ∀ v : V, conj ⟪T v, v⟫_ℂ = ⟪T v, v⟫_ℂ := by
constructor · intro hT v apply IsSymmetric.conj_inner_sym hT · intro h x y rw [← inner_conj_symm x (T y)] rw [inner_map_polarization T x y] simp only [starRingEnd_apply, star_div', star_sub, star_add, star_mul] simp only [← starRingEnd_apply] rw [h (x + y), h (x - y), h (x + Complex.I • y), h (x - Complex.I • y)] simp only [Complex.conj_I] rw [inner_map_polarization'] norm_num ring
import Batteries.Tactic.SeqFocus namespace Ordering @[simp] theorem swap_swap {o : Ordering} : o.swap.swap = o := by cases o <;> rfl @[simp] theorem swap_inj {o₁ o₂ : Ordering} : o₁.swap = o₂.swap ↔ o₁ = o₂ := ⟨fun h => by simpa using congrArg swap h, congrArg _⟩ theorem swap_then (o₁ o₂ : Ordering) : (o₁.then o₂).swap = o₁.swap.then o₂.swap := by cases o₁ <;> rfl theorem then_eq_lt {o₁ o₂ : Ordering} : o₁.then o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by cases o₁ <;> cases o₂ <;> decide theorem then_eq_eq {o₁ o₂ : Ordering} : o₁.then o₂ = eq ↔ o₁ = eq ∧ o₂ = eq := by cases o₁ <;> simp [«then»]
.lake/packages/batteries/Batteries/Classes/Order.lean
26
27
theorem then_eq_gt {o₁ o₂ : Ordering} : o₁.then o₂ = gt ↔ o₁ = gt ∨ o₁ = eq ∧ o₂ = gt := by
cases o₁ <;> cases o₂ <;> decide
import Mathlib.Computability.Encoding import Mathlib.Logic.Small.List import Mathlib.ModelTheory.Syntax import Mathlib.SetTheory.Cardinal.Ordinal #align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u v w u' v' namespace FirstOrder namespace Language variable {L : Language.{u, v}} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} open FirstOrder Cardinal open Computability List Structure Cardinal Fin namespace Term def listEncode : L.Term α → List (Sum α (Σi, L.Functions i)) | var i => [Sum.inl i] | func f ts => Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α)) | [] => [] | Sum.inl a::l => some (var a)::listDecode l | Sum.inr ⟨n, f⟩::l => if h : ∀ i : Fin n, ((listDecode l).get? i).join.isSome then (func f fun i => Option.get _ (h i))::(listDecode l).drop n else [none] #align first_order.language.term.list_decode FirstOrder.Language.Term.listDecode
Mathlib/ModelTheory/Encoding.lean
67
98
theorem listDecode_encode_list (l : List (L.Term α)) : listDecode (l.bind listEncode) = l.map Option.some := by
suffices h : ∀ (t : L.Term α) (l : List (Sum α (Σi, L.Functions i))), listDecode (t.listEncode ++ l) = some t::listDecode l by induction' l with t l lih · rfl · rw [cons_bind, h t (l.bind listEncode), lih, List.map] intro t induction' t with a n f ts ih <;> intro l · rw [listEncode, singleton_append, listDecode] · rw [listEncode, cons_append, listDecode] have h : listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l) = (finRange n).map (Option.some ∘ ts) ++ listDecode l := by induction' finRange n with i l' l'ih · rfl · rw [cons_bind, List.append_assoc, ih, map_cons, l'ih, cons_append, Function.comp] have h' : ∀ i : Fin n, (listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l)).get? ↑i = some (some (ts i)) := by intro i rw [h, get?_append, get?_map] · simp only [Option.map_eq_some', Function.comp_apply, get?_eq_some] refine ⟨i, ⟨lt_of_lt_of_le i.2 (ge_of_eq (length_finRange _)), ?_⟩, rfl⟩ rw [get_finRange, Fin.eta] · refine lt_of_lt_of_le i.2 ?_ simp refine (dif_pos fun i => Option.isSome_iff_exists.2 ⟨ts i, ?_⟩).trans ?_ · rw [Option.join_eq_some, h'] refine congr (congr rfl (congr rfl (congr rfl (funext fun i => Option.get_of_mem _ ?_)))) ?_ · simp [h'] · rw [h, drop_left'] rw [length_map, length_finRange]
import Mathlib.Data.Multiset.Nodup import Mathlib.Data.List.NatAntidiagonal #align_import data.multiset.nat_antidiagonal from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Multiset namespace Nat def antidiagonal (n : ℕ) : Multiset (ℕ × ℕ) := List.Nat.antidiagonal n #align multiset.nat.antidiagonal Multiset.Nat.antidiagonal @[simp] theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by rw [antidiagonal, mem_coe, List.Nat.mem_antidiagonal] #align multiset.nat.mem_antidiagonal Multiset.Nat.mem_antidiagonal @[simp] theorem card_antidiagonal (n : ℕ) : card (antidiagonal n) = n + 1 := by rw [antidiagonal, coe_card, List.Nat.length_antidiagonal] #align multiset.nat.card_antidiagonal Multiset.Nat.card_antidiagonal @[simp] theorem antidiagonal_zero : antidiagonal 0 = {(0, 0)} := rfl #align multiset.nat.antidiagonal_zero Multiset.Nat.antidiagonal_zero @[simp] theorem nodup_antidiagonal (n : ℕ) : Nodup (antidiagonal n) := coe_nodup.2 <| List.Nat.nodup_antidiagonal n #align multiset.nat.nodup_antidiagonal Multiset.Nat.nodup_antidiagonal @[simp]
Mathlib/Data/Multiset/NatAntidiagonal.lean
59
61
theorem antidiagonal_succ {n : ℕ} : antidiagonal (n + 1) = (0, n + 1) ::ₘ (antidiagonal n).map (Prod.map Nat.succ id) := by
simp only [antidiagonal, List.Nat.antidiagonal_succ, map_coe, cons_coe]
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
67
94
theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring
import Mathlib.LinearAlgebra.Dimension.Basic import Mathlib.SetTheory.Cardinal.ToNat #align_import linear_algebra.finrank from "leanprover-community/mathlib"@"347636a7a80595d55bedf6e6fbd996a3c39da69a" universe u v w open Cardinal Submodule Module Function variable {R : Type u} {M : Type v} {N : Type w} variable [Ring R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] namespace FiniteDimensional section Ring noncomputable def finrank (R M : Type*) [Semiring R] [AddCommGroup M] [Module R M] : ℕ := Cardinal.toNat (Module.rank R M) #align finite_dimensional.finrank FiniteDimensional.finrank
Mathlib/LinearAlgebra/Dimension/Finrank.lean
58
61
theorem finrank_eq_of_rank_eq {n : ℕ} (h : Module.rank R M = ↑n) : finrank R M = n := by
apply_fun toNat at h rw [toNat_natCast] at h exact mod_cast h
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.Derivation.Basic #align_import data.mv_polynomial.derivation from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3" namespace MvPolynomial noncomputable section variable {σ R A : Type*} [CommSemiring R] [AddCommMonoid A] [Module R A] [Module (MvPolynomial σ R) A] section variable (R) def mkDerivationₗ (f : σ → A) : MvPolynomial σ R →ₗ[R] A := Finsupp.lsum R fun xs : σ →₀ ℕ => (LinearMap.ringLmapEquivSelf R R A).symm <| xs.sum fun i k => monomial (xs - Finsupp.single i 1) (k : R) • f i #align mv_polynomial.mk_derivationₗ MvPolynomial.mkDerivationₗ end theorem mkDerivationₗ_monomial (f : σ → A) (s : σ →₀ ℕ) (r : R) : mkDerivationₗ R f (monomial s r) = r • s.sum fun i k => monomial (s - Finsupp.single i 1) (k : R) • f i := sum_monomial_eq <| LinearMap.map_zero _ #align mv_polynomial.mk_derivationₗ_monomial MvPolynomial.mkDerivationₗ_monomial theorem mkDerivationₗ_C (f : σ → A) (r : R) : mkDerivationₗ R f (C r) = 0 := (mkDerivationₗ_monomial f _ _).trans (smul_zero _) set_option linter.uppercaseLean3 false in #align mv_polynomial.mk_derivationₗ_C MvPolynomial.mkDerivationₗ_C theorem mkDerivationₗ_X (f : σ → A) (i : σ) : mkDerivationₗ R f (X i) = f i := (mkDerivationₗ_monomial f _ _).trans <| by simp set_option linter.uppercaseLean3 false in #align mv_polynomial.mk_derivationₗ_X MvPolynomial.mkDerivationₗ_X @[simp] theorem derivation_C (D : Derivation R (MvPolynomial σ R) A) (a : R) : D (C a) = 0 := D.map_algebraMap a set_option linter.uppercaseLean3 false in #align mv_polynomial.derivation_C MvPolynomial.derivation_C @[simp] theorem derivation_C_mul (D : Derivation R (MvPolynomial σ R) A) (a : R) (f : MvPolynomial σ R) : C (σ := σ) a • D f = a • D f := by have : C (σ := σ) a • D f = D (C a * f) := by simp rw [this, C_mul', D.map_smul] theorem derivation_eqOn_supported {D₁ D₂ : Derivation R (MvPolynomial σ R) A} {s : Set σ} (h : Set.EqOn (D₁ ∘ X) (D₂ ∘ X) s) {f : MvPolynomial σ R} (hf : f ∈ supported R s) : D₁ f = D₂ f := Derivation.eqOn_adjoin (Set.forall_mem_image.2 h) hf #align mv_polynomial.derivation_eq_on_supported MvPolynomial.derivation_eqOn_supported theorem derivation_eq_of_forall_mem_vars {D₁ D₂ : Derivation R (MvPolynomial σ R) A} {f : MvPolynomial σ R} (h : ∀ i ∈ f.vars, D₁ (X i) = D₂ (X i)) : D₁ f = D₂ f := derivation_eqOn_supported h f.mem_supported_vars #align mv_polynomial.derivation_eq_of_forall_mem_vars MvPolynomial.derivation_eq_of_forall_mem_vars theorem derivation_eq_zero_of_forall_mem_vars {D : Derivation R (MvPolynomial σ R) A} {f : MvPolynomial σ R} (h : ∀ i ∈ f.vars, D (X i) = 0) : D f = 0 := show D f = (0 : Derivation R (MvPolynomial σ R) A) f from derivation_eq_of_forall_mem_vars h #align mv_polynomial.derivation_eq_zero_of_forall_mem_vars MvPolynomial.derivation_eq_zero_of_forall_mem_vars @[ext] theorem derivation_ext {D₁ D₂ : Derivation R (MvPolynomial σ R) A} (h : ∀ i, D₁ (X i) = D₂ (X i)) : D₁ = D₂ := Derivation.ext fun _ => derivation_eq_of_forall_mem_vars fun i _ => h i #align mv_polynomial.derivation_ext MvPolynomial.derivation_ext variable [IsScalarTower R (MvPolynomial σ R) A]
Mathlib/Algebra/MvPolynomial/Derivation.lean
96
114
theorem leibniz_iff_X (D : MvPolynomial σ R →ₗ[R] A) (h₁ : D 1 = 0) : (∀ p q, D (p * q) = p • D q + q • D p) ↔ ∀ s i, D (monomial s 1 * X i) = (monomial s 1 : MvPolynomial σ R) • D (X i) + (X i : MvPolynomial σ R) • D (monomial s 1) := by
refine ⟨fun H p i => H _ _, fun H => ?_⟩ have hC : ∀ r, D (C r) = 0 := by intro r; rw [C_eq_smul_one, D.map_smul, h₁, smul_zero] have : ∀ p i, D (p * X i) = p • D (X i) + (X i : MvPolynomial σ R) • D p := by intro p i induction' p using MvPolynomial.induction_on' with s r p q hp hq · rw [← mul_one r, ← C_mul_monomial, mul_assoc, C_mul', D.map_smul, H, C_mul', smul_assoc, smul_add, D.map_smul, smul_comm r (X i)] · rw [add_mul, map_add, map_add, hp, hq, add_smul, smul_add, add_add_add_comm] intro p q induction q using MvPolynomial.induction_on with | h_C c => rw [mul_comm, C_mul', hC, smul_zero, zero_add, D.map_smul, C_eq_smul_one, smul_one_smul] | h_add q₁ q₂ h₁ h₂ => simp only [mul_add, map_add, h₁, h₂, smul_add, add_smul]; abel | h_X q i hq => simp only [this, ← mul_assoc, hq, mul_smul, smul_add, add_assoc] rw [smul_comm (X i), smul_comm (X i)]
import Mathlib.Algebra.GCDMonoid.Finset import Mathlib.Algebra.Polynomial.CancelLeads import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.FieldDivision #align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3" namespace Polynomial open Polynomial section Primitive variable {R : Type*} [CommSemiring R] def IsPrimitive (p : R[X]) : Prop := ∀ r : R, C r ∣ p → IsUnit r #align polynomial.is_primitive Polynomial.IsPrimitive theorem isPrimitive_iff_isUnit_of_C_dvd {p : R[X]} : p.IsPrimitive ↔ ∀ r : R, C r ∣ p → IsUnit r := Iff.rfl set_option linter.uppercaseLean3 false in #align polynomial.is_primitive_iff_is_unit_of_C_dvd Polynomial.isPrimitive_iff_isUnit_of_C_dvd @[simp] theorem isPrimitive_one : IsPrimitive (1 : R[X]) := fun _ h => isUnit_C.mp (isUnit_of_dvd_one h) #align polynomial.is_primitive_one Polynomial.isPrimitive_one theorem Monic.isPrimitive {p : R[X]} (hp : p.Monic) : p.IsPrimitive := by rintro r ⟨q, h⟩ exact isUnit_of_mul_eq_one r (q.coeff p.natDegree) (by rwa [← coeff_C_mul, ← h]) #align polynomial.monic.is_primitive Polynomial.Monic.isPrimitive
Mathlib/RingTheory/Polynomial/Content.lean
61
63
theorem IsPrimitive.ne_zero [Nontrivial R] {p : R[X]} (hp : p.IsPrimitive) : p ≠ 0 := by
rintro rfl exact (hp 0 (dvd_zero (C 0))).ne_zero rfl
import Mathlib.CategoryTheory.Functor.Flat import Mathlib.CategoryTheory.Sites.Sheaf import Mathlib.Tactic.ApplyFun #align_import category_theory.sites.cover_preserving from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" universe w v₁ v₂ v₃ u₁ u₂ u₃ noncomputable section open CategoryTheory Opposite CategoryTheory.Presieve.FamilyOfElements CategoryTheory.Presieve CategoryTheory.Limits namespace CategoryTheory variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (F : C ⥤ D) variable {A : Type u₃} [Category.{v₃} A] variable (J : GrothendieckTopology C) (K : GrothendieckTopology D) variable {L : GrothendieckTopology A} -- Porting note(#5171): removed `@[nolint has_nonempty_instance]` structure CoverPreserving (G : C ⥤ D) : Prop where cover_preserve : ∀ {U : C} {S : Sieve U} (_ : S ∈ J U), S.functorPushforward G ∈ K (G.obj U) #align category_theory.cover_preserving CategoryTheory.CoverPreserving theorem idCoverPreserving : CoverPreserving J J (𝟭 _) := ⟨fun hS => by simpa using hS⟩ #align category_theory.id_cover_preserving CategoryTheory.idCoverPreserving theorem CoverPreserving.comp {F} (hF : CoverPreserving J K F) {G} (hG : CoverPreserving K L G) : CoverPreserving J L (F ⋙ G) := ⟨fun hS => by rw [Sieve.functorPushforward_comp] exact hG.cover_preserve (hF.cover_preserve hS)⟩ #align category_theory.cover_preserving.comp CategoryTheory.CoverPreserving.comp -- Porting note(#5171): linter not ported yet @[nolint has_nonempty_instance] structure CompatiblePreserving (K : GrothendieckTopology D) (G : C ⥤ D) : Prop where compatible : ∀ (ℱ : SheafOfTypes.{w} K) {Z} {T : Presieve Z} {x : FamilyOfElements (G.op ⋙ ℱ.val) T} (_ : x.Compatible) {Y₁ Y₂} {X} (f₁ : X ⟶ G.obj Y₁) (f₂ : X ⟶ G.obj Y₂) {g₁ : Y₁ ⟶ Z} {g₂ : Y₂ ⟶ Z} (hg₁ : T g₁) (hg₂ : T g₂) (_ : f₁ ≫ G.map g₁ = f₂ ≫ G.map g₂), ℱ.val.map f₁.op (x g₁ hg₁) = ℱ.val.map f₂.op (x g₂ hg₂) #align category_theory.compatible_preserving CategoryTheory.CompatiblePreserving variable {J K} {G : C ⥤ D} (hG : CompatiblePreserving.{w} K G) (ℱ : SheafOfTypes.{w} K) {Z : C} variable {T : Presieve Z} {x : FamilyOfElements (G.op ⋙ ℱ.val) T} (h : x.Compatible)
Mathlib/CategoryTheory/Sites/CoverPreserving.lean
103
112
theorem Presieve.FamilyOfElements.Compatible.functorPushforward : (x.functorPushforward G).Compatible := by
rintro Z₁ Z₂ W g₁ g₂ f₁' f₂' H₁ H₂ eq unfold FamilyOfElements.functorPushforward rcases getFunctorPushforwardStructure H₁ with ⟨X₁, f₁, h₁, hf₁, rfl⟩ rcases getFunctorPushforwardStructure H₂ with ⟨X₂, f₂, h₂, hf₂, rfl⟩ suffices ℱ.val.map (g₁ ≫ h₁).op (x f₁ hf₁) = ℱ.val.map (g₂ ≫ h₂).op (x f₂ hf₂) by simpa using this apply hG.compatible ℱ h _ _ hf₁ hf₂ simpa using eq
import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.Calculus.Deriv.Inv #align_import analysis.calculus.dslope from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" open scoped Classical Topology Filter open Function Set Filter variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] noncomputable def dslope (f : 𝕜 → E) (a : 𝕜) : 𝕜 → E := update (slope f a) a (deriv f a) #align dslope dslope @[simp] theorem dslope_same (f : 𝕜 → E) (a : 𝕜) : dslope f a a = deriv f a := update_same _ _ _ #align dslope_same dslope_same variable {f : 𝕜 → E} {a b : 𝕜} {s : Set 𝕜} theorem dslope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a b = slope f a b := update_noteq h _ _ #align dslope_of_ne dslope_of_ne theorem ContinuousLinearMap.dslope_comp {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E →L[𝕜] F) (g : 𝕜 → E) (a b : 𝕜) (H : a = b → DifferentiableAt 𝕜 g a) : dslope (f ∘ g) a b = f (dslope g a b) := by rcases eq_or_ne b a with (rfl | hne) · simp only [dslope_same] exact (f.hasFDerivAt.comp_hasDerivAt b (H rfl).hasDerivAt).deriv · simpa only [dslope_of_ne _ hne] using f.toLinearMap.slope_comp g a b #align continuous_linear_map.dslope_comp ContinuousLinearMap.dslope_comp theorem eqOn_dslope_slope (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope f a) (slope f a) {a}ᶜ := fun _ => dslope_of_ne f #align eq_on_dslope_slope eqOn_dslope_slope theorem dslope_eventuallyEq_slope_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope f a =ᶠ[𝓝 b] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem (isOpen_ne.mem_nhds h) #align dslope_eventually_eq_slope_of_ne dslope_eventuallyEq_slope_of_ne theorem dslope_eventuallyEq_slope_punctured_nhds (f : 𝕜 → E) : dslope f a =ᶠ[𝓝[≠] a] slope f a := (eqOn_dslope_slope f a).eventuallyEq_of_mem self_mem_nhdsWithin #align dslope_eventually_eq_slope_punctured_nhds dslope_eventuallyEq_slope_punctured_nhds @[simp] theorem sub_smul_dslope (f : 𝕜 → E) (a b : 𝕜) : (b - a) • dslope f a b = f b - f a := by rcases eq_or_ne b a with (rfl | hne) <;> simp [dslope_of_ne, *] #align sub_smul_dslope sub_smul_dslope theorem dslope_sub_smul_of_ne (f : 𝕜 → E) (h : b ≠ a) : dslope (fun x => (x - a) • f x) a b = f b := by rw [dslope_of_ne _ h, slope_sub_smul _ h.symm] #align dslope_sub_smul_of_ne dslope_sub_smul_of_ne theorem eqOn_dslope_sub_smul (f : 𝕜 → E) (a : 𝕜) : EqOn (dslope (fun x => (x - a) • f x) a) f {a}ᶜ := fun _ => dslope_sub_smul_of_ne f #align eq_on_dslope_sub_smul eqOn_dslope_sub_smul theorem dslope_sub_smul [DecidableEq 𝕜] (f : 𝕜 → E) (a : 𝕜) : dslope (fun x => (x - a) • f x) a = update f a (deriv (fun x => (x - a) • f x) a) := eq_update_iff.2 ⟨dslope_same _ _, eqOn_dslope_sub_smul f a⟩ #align dslope_sub_smul dslope_sub_smul @[simp] theorem continuousAt_dslope_same : ContinuousAt (dslope f a) a ↔ DifferentiableAt 𝕜 f a := by simp only [dslope, continuousAt_update_same, ← hasDerivAt_deriv_iff, hasDerivAt_iff_tendsto_slope] #align continuous_at_dslope_same continuousAt_dslope_same theorem ContinuousWithinAt.of_dslope (h : ContinuousWithinAt (dslope f a) s b) : ContinuousWithinAt f s b := by have : ContinuousWithinAt (fun x => (x - a) • dslope f a x + f a) s b := ((continuousWithinAt_id.sub continuousWithinAt_const).smul h).add continuousWithinAt_const simpa only [sub_smul_dslope, sub_add_cancel] using this #align continuous_within_at.of_dslope ContinuousWithinAt.of_dslope theorem ContinuousAt.of_dslope (h : ContinuousAt (dslope f a) b) : ContinuousAt f b := (continuousWithinAt_univ _ _).1 h.continuousWithinAt.of_dslope #align continuous_at.of_dslope ContinuousAt.of_dslope theorem ContinuousOn.of_dslope (h : ContinuousOn (dslope f a) s) : ContinuousOn f s := fun x hx => (h x hx).of_dslope #align continuous_on.of_dslope ContinuousOn.of_dslope theorem continuousWithinAt_dslope_of_ne (h : b ≠ a) : ContinuousWithinAt (dslope f a) s b ↔ ContinuousWithinAt f s b := by refine ⟨ContinuousWithinAt.of_dslope, fun hc => ?_⟩ simp only [dslope, continuousWithinAt_update_of_ne h] exact ((continuousWithinAt_id.sub continuousWithinAt_const).inv₀ (sub_ne_zero.2 h)).smul (hc.sub continuousWithinAt_const) #align continuous_within_at_dslope_of_ne continuousWithinAt_dslope_of_ne
Mathlib/Analysis/Calculus/Dslope.lean
114
115
theorem continuousAt_dslope_of_ne (h : b ≠ a) : ContinuousAt (dslope f a) b ↔ ContinuousAt f b := by
simp only [← continuousWithinAt_univ, continuousWithinAt_dslope_of_ne h]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.HasseDeriv #align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section namespace Polynomial open Polynomial variable {R : Type*} [Semiring R] (r : R) (f : R[X]) def taylor (r : R) : R[X] →ₗ[R] R[X] where toFun f := f.comp (X + C r) map_add' f g := add_comp map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply] #align polynomial.taylor Polynomial.taylor theorem taylor_apply : taylor r f = f.comp (X + C r) := rfl #align polynomial.taylor_apply Polynomial.taylor_apply @[simp] theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_X Polynomial.taylor_X @[simp] theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp] set_option linter.uppercaseLean3 false in #align polynomial.taylor_C Polynomial.taylor_C @[simp] theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by ext simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp, Function.comp_apply, LinearMap.coe_comp] #align polynomial.taylor_zero' Polynomial.taylor_zero' theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply] #align polynomial.taylor_zero Polynomial.taylor_zero @[simp] theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C] #align polynomial.taylor_one Polynomial.taylor_one @[simp]
Mathlib/Algebra/Polynomial/Taylor.lean
70
71
theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
import Mathlib.Data.Finset.Lattice #align_import data.finset.pairwise from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Finset variable {α ι ι' : Type*} instance [DecidableEq α] {r : α → α → Prop} [DecidableRel r] {s : Finset α} : Decidable ((s : Set α).Pairwise r) := decidable_of_iff' (∀ a ∈ s, ∀ b ∈ s, a ≠ b → r a b) Iff.rfl theorem Finset.pairwiseDisjoint_range_singleton : (Set.range (singleton : α → Finset α)).PairwiseDisjoint id := by rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ h exact disjoint_singleton.2 (ne_of_apply_ne _ h) #align finset.pairwise_disjoint_range_singleton Finset.pairwiseDisjoint_range_singleton namespace Set theorem PairwiseDisjoint.elim_finset {s : Set ι} {f : ι → Finset α} (hs : s.PairwiseDisjoint f) {i j : ι} (hi : i ∈ s) (hj : j ∈ s) (a : α) (hai : a ∈ f i) (haj : a ∈ f j) : i = j := hs.elim hi hj (Finset.not_disjoint_iff.2 ⟨a, hai, haj⟩) #align set.pairwise_disjoint.elim_finset Set.PairwiseDisjoint.elim_finset section SemilatticeInf variable [SemilatticeInf α] [OrderBot α] {s : Finset ι} {f : ι → α}
Mathlib/Data/Finset/Pairwise.lean
44
48
theorem PairwiseDisjoint.image_finset_of_le [DecidableEq ι] {s : Finset ι} {f : ι → α} (hs : (s : Set ι).PairwiseDisjoint f) {g : ι → ι} (hf : ∀ a, f (g a) ≤ f a) : (s.image g : Set ι).PairwiseDisjoint f := by
rw [coe_image] exact hs.image_of_le hf
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace WittVector private def ghostFun : 𝕎 R → ℕ → R := fun x n => aeval x.coeff (W_ ℤ n) section GhostFun variable (x y : WittVector p R) -- The following lemmas are not `@[simp]` because they will be bundled in `ghostMap` later on. @[local simp]
Mathlib/RingTheory/WittVector/Basic.lean
183
185
theorem matrix_vecEmpty_coeff {R} (i j) : @coeff p R (Matrix.vecEmpty i) j = (Matrix.vecEmpty i : ℕ → R) j := by
rcases i with ⟨_ | _ | _ | _ | i_val, ⟨⟩⟩
import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.basis from "leanprover-community/mathlib"@"6c263e4bfc2e6714de30f22178b4d0ca4d149a76" noncomputable section open LinearMap Matrix Set Submodule open Matrix section BasisToMatrix variable {ι ι' κ κ' : Type*} variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M] variable {R₂ M₂ : Type*} [CommRing R₂] [AddCommGroup M₂] [Module R₂ M₂] open Function Matrix def Basis.toMatrix (e : Basis ι R M) (v : ι' → M) : Matrix ι ι' R := fun i j => e.repr (v j) i #align basis.to_matrix Basis.toMatrix variable (e : Basis ι R M) (v : ι' → M) (i : ι) (j : ι') namespace Basis theorem toMatrix_apply : e.toMatrix v i j = e.repr (v j) i := rfl #align basis.to_matrix_apply Basis.toMatrix_apply theorem toMatrix_transpose_apply : (e.toMatrix v)ᵀ j = e.repr (v j) := funext fun _ => rfl #align basis.to_matrix_transpose_apply Basis.toMatrix_transpose_apply theorem toMatrix_eq_toMatrix_constr [Fintype ι] [DecidableEq ι] (v : ι → M) : e.toMatrix v = LinearMap.toMatrix e e (e.constr ℕ v) := by ext rw [Basis.toMatrix_apply, LinearMap.toMatrix_apply, Basis.constr_basis] #align basis.to_matrix_eq_to_matrix_constr Basis.toMatrix_eq_toMatrix_constr -- TODO (maybe) Adjust the definition of `Basis.toMatrix` to eliminate the transpose. theorem coePiBasisFun.toMatrix_eq_transpose [Finite ι] : ((Pi.basisFun R ι).toMatrix : Matrix ι ι R → Matrix ι ι R) = Matrix.transpose := by ext M i j rfl #align basis.coe_pi_basis_fun.to_matrix_eq_transpose Basis.coePiBasisFun.toMatrix_eq_transpose @[simp] theorem toMatrix_self [DecidableEq ι] : e.toMatrix e = 1 := by unfold Basis.toMatrix ext i j simp [Basis.equivFun, Matrix.one_apply, Finsupp.single_apply, eq_comm] #align basis.to_matrix_self Basis.toMatrix_self theorem toMatrix_update [DecidableEq ι'] (x : M) : e.toMatrix (Function.update v j x) = Matrix.updateColumn (e.toMatrix v) j (e.repr x) := by ext i' k rw [Basis.toMatrix, Matrix.updateColumn_apply, e.toMatrix_apply] split_ifs with h · rw [h, update_same j x v] · rw [update_noteq h] #align basis.to_matrix_update Basis.toMatrix_update @[simp] theorem toMatrix_unitsSMul [DecidableEq ι] (e : Basis ι R₂ M₂) (w : ι → R₂ˣ) : e.toMatrix (e.unitsSMul w) = diagonal ((↑) ∘ w) := by ext i j by_cases h : i = j · simp [h, toMatrix_apply, unitsSMul_apply, Units.smul_def] · simp [h, toMatrix_apply, unitsSMul_apply, Units.smul_def, Ne.symm h] #align basis.to_matrix_units_smul Basis.toMatrix_unitsSMul @[simp] theorem toMatrix_isUnitSMul [DecidableEq ι] (e : Basis ι R₂ M₂) {w : ι → R₂} (hw : ∀ i, IsUnit (w i)) : e.toMatrix (e.isUnitSMul hw) = diagonal w := e.toMatrix_unitsSMul _ #align basis.to_matrix_is_unit_smul Basis.toMatrix_isUnitSMul @[simp] theorem sum_toMatrix_smul_self [Fintype ι] : ∑ i : ι, e.toMatrix v i j • e i = v j := by simp_rw [e.toMatrix_apply, e.sum_repr] #align basis.sum_to_matrix_smul_self Basis.sum_toMatrix_smul_self
Mathlib/LinearAlgebra/Matrix/Basis.lean
117
122
theorem toMatrix_smul {R₁ S : Type*} [CommRing R₁] [Ring S] [Algebra R₁ S] [Fintype ι] [DecidableEq ι] (x : S) (b : Basis ι R₁ S) (w : ι → S) : (b.toMatrix (x • w)) = (Algebra.leftMulMatrix b x) * (b.toMatrix w) := by
ext rw [Basis.toMatrix_apply, Pi.smul_apply, smul_eq_mul, ← Algebra.leftMulMatrix_mulVec_repr] rfl
import Mathlib.Analysis.NormedSpace.HahnBanach.Extension import Mathlib.Analysis.NormedSpace.HahnBanach.Separation import Mathlib.LinearAlgebra.Dual import Mathlib.Analysis.NormedSpace.BoundedLinearMaps @[mk_iff separatingDual_def] class SeparatingDual (R V : Type*) [Ring R] [AddCommGroup V] [TopologicalSpace V] [TopologicalSpace R] [Module R V] : Prop := exists_ne_zero' : ∀ (x : V), x ≠ 0 → ∃ f : V →L[R] R, f x ≠ 0 instance {E : Type*} [TopologicalSpace E] [AddCommGroup E] [TopologicalAddGroup E] [Module ℝ E] [ContinuousSMul ℝ E] [LocallyConvexSpace ℝ E] [T1Space E] : SeparatingDual ℝ E := ⟨fun x hx ↦ by rcases geometric_hahn_banach_point_point hx.symm with ⟨f, hf⟩ simp only [map_zero] at hf exact ⟨f, hf.ne'⟩⟩ instance {E 𝕜 : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] : SeparatingDual 𝕜 E := ⟨fun x hx ↦ by rcases exists_dual_vector 𝕜 x hx with ⟨f, -, hf⟩ refine ⟨f, ?_⟩ simpa [hf] using hx⟩ namespace SeparatingDual section Field variable {R V : Type*} [Field R] [AddCommGroup V] [TopologicalSpace R] [TopologicalSpace V] [TopologicalRing R] [TopologicalAddGroup V] [Module R V] [SeparatingDual R V] -- TODO (@alreadydone): this could generalize to CommRing R if we were to add a section theorem _root_.separatingDual_iff_injective : SeparatingDual R V ↔ Function.Injective (ContinuousLinearMap.coeLM (R := R) R (M := V) (N₃ := R)).flip := by simp_rw [separatingDual_def, Ne, injective_iff_map_eq_zero] congrm ∀ v, ?_ rw [not_imp_comm, LinearMap.ext_iff] push_neg; rfl open Function in
Mathlib/Analysis/NormedSpace/HahnBanach/SeparatingDual.lean
91
97
theorem dualMap_surjective_iff {W} [AddCommGroup W] [Module R W] [FiniteDimensional R W] {f : W →ₗ[R] V} : Surjective (f.dualMap ∘ ContinuousLinearMap.toLinearMap) ↔ Injective f := by
constructor <;> intro hf · exact LinearMap.dualMap_surjective_iff.mp hf.of_comp have := (separatingDual_iff_injective.mp ‹_›).comp hf rw [← LinearMap.coe_comp] at this exact LinearMap.flip_surjective_iff₁.mpr this
import Mathlib.Topology.Algebra.Module.StrongTopology import Mathlib.Topology.Algebra.Module.LocallyConvex #align_import analysis.locally_convex.strong_topology from "leanprover-community/mathlib"@"47b12e7f2502f14001f891ca87fbae2b4acaed3f" open Topology UniformConvergence variable {R 𝕜₁ 𝕜₂ E F : Type*} variable [AddCommGroup E] [TopologicalSpace E] [AddCommGroup F] [TopologicalSpace F] [TopologicalAddGroup F] section General namespace UniformConvergenceCLM variable (R) variable [OrderedSemiring R] variable [NormedField 𝕜₁] [NormedField 𝕜₂] [Module 𝕜₁ E] [Module 𝕜₂ F] {σ : 𝕜₁ →+* 𝕜₂} variable [Module R F] [ContinuousConstSMul R F] [LocallyConvexSpace R F] [SMulCommClass 𝕜₂ R F]
Mathlib/Analysis/LocallyConvex/StrongTopology.lean
47
54
theorem locallyConvexSpace (𝔖 : Set (Set E)) (h𝔖₁ : 𝔖.Nonempty) (h𝔖₂ : DirectedOn (· ⊆ ·) 𝔖) : LocallyConvexSpace R (UniformConvergenceCLM σ F 𝔖) := by
apply LocallyConvexSpace.ofBasisZero _ _ _ _ (UniformConvergenceCLM.hasBasis_nhds_zero_of_basis _ _ _ h𝔖₁ h𝔖₂ (LocallyConvexSpace.convex_basis_zero R F)) _ rintro ⟨S, V⟩ ⟨_, _, hVconvex⟩ f hf g hg a b ha hb hab x hx exact hVconvex (hf x hx) (hg x hx) ha hb hab
import Mathlib.Analysis.BoxIntegral.Box.Basic import Mathlib.Analysis.SpecificLimits.Basic #align_import analysis.box_integral.box.subbox_induction from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Set Finset Function Filter Metric Classical Topology Filter ENNReal noncomputable section namespace BoxIntegral namespace Box variable {ι : Type*} {I J : Box ι} def splitCenterBox (I : Box ι) (s : Set ι) : Box ι where lower := s.piecewise (fun i ↦ (I.lower i + I.upper i) / 2) I.lower upper := s.piecewise I.upper fun i ↦ (I.lower i + I.upper i) / 2 lower_lt_upper i := by dsimp only [Set.piecewise] split_ifs <;> simp only [left_lt_add_div_two, add_div_two_lt_right, I.lower_lt_upper] #align box_integral.box.split_center_box BoxIntegral.Box.splitCenterBox theorem mem_splitCenterBox {s : Set ι} {y : ι → ℝ} : y ∈ I.splitCenterBox s ↔ y ∈ I ∧ ∀ i, (I.lower i + I.upper i) / 2 < y i ↔ i ∈ s := by simp only [splitCenterBox, mem_def, ← forall_and] refine forall_congr' fun i ↦ ?_ dsimp only [Set.piecewise] split_ifs with hs <;> simp only [hs, iff_true_iff, iff_false_iff, not_lt] exacts [⟨fun H ↦ ⟨⟨(left_lt_add_div_two.2 (I.lower_lt_upper i)).trans H.1, H.2⟩, H.1⟩, fun H ↦ ⟨H.2, H.1.2⟩⟩, ⟨fun H ↦ ⟨⟨H.1, H.2.trans (add_div_two_lt_right.2 (I.lower_lt_upper i)).le⟩, H.2⟩, fun H ↦ ⟨H.1.1, H.2⟩⟩] #align box_integral.box.mem_split_center_box BoxIntegral.Box.mem_splitCenterBox theorem splitCenterBox_le (I : Box ι) (s : Set ι) : I.splitCenterBox s ≤ I := fun _ hx ↦ (mem_splitCenterBox.1 hx).1 #align box_integral.box.split_center_box_le BoxIntegral.Box.splitCenterBox_le theorem disjoint_splitCenterBox (I : Box ι) {s t : Set ι} (h : s ≠ t) : Disjoint (I.splitCenterBox s : Set (ι → ℝ)) (I.splitCenterBox t) := by rw [disjoint_iff_inf_le] rintro y ⟨hs, ht⟩; apply h ext i rw [mem_coe, mem_splitCenterBox] at hs ht rw [← hs.2, ← ht.2] #align box_integral.box.disjoint_split_center_box BoxIntegral.Box.disjoint_splitCenterBox theorem injective_splitCenterBox (I : Box ι) : Injective I.splitCenterBox := fun _ _ H ↦ by_contra fun Hne ↦ (I.disjoint_splitCenterBox Hne).ne (nonempty_coe _).ne_empty (H ▸ rfl) #align box_integral.box.injective_split_center_box BoxIntegral.Box.injective_splitCenterBox @[simp] theorem exists_mem_splitCenterBox {I : Box ι} {x : ι → ℝ} : (∃ s, x ∈ I.splitCenterBox s) ↔ x ∈ I := ⟨fun ⟨s, hs⟩ ↦ I.splitCenterBox_le s hs, fun hx ↦ ⟨{ i | (I.lower i + I.upper i) / 2 < x i }, mem_splitCenterBox.2 ⟨hx, fun _ ↦ Iff.rfl⟩⟩⟩ #align box_integral.box.exists_mem_split_center_box BoxIntegral.Box.exists_mem_splitCenterBox @[simps] def splitCenterBoxEmb (I : Box ι) : Set ι ↪ Box ι := ⟨splitCenterBox I, injective_splitCenterBox I⟩ #align box_integral.box.split_center_box_emb BoxIntegral.Box.splitCenterBoxEmb @[simp] theorem iUnion_coe_splitCenterBox (I : Box ι) : ⋃ s, (I.splitCenterBox s : Set (ι → ℝ)) = I := by ext x simp #align box_integral.box.Union_coe_split_center_box BoxIntegral.Box.iUnion_coe_splitCenterBox @[simp]
Mathlib/Analysis/BoxIntegral/Box/SubboxInduction.lean
101
103
theorem upper_sub_lower_splitCenterBox (I : Box ι) (s : Set ι) (i : ι) : (I.splitCenterBox s).upper i - (I.splitCenterBox s).lower i = (I.upper i - I.lower i) / 2 := by
by_cases i ∈ s <;> field_simp [splitCenterBox] <;> field_simp [mul_two, two_mul]
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*} theorem powerset_insert (s : Set α) (a : α) : 𝒫 insert a s = 𝒫 s ∪ insert a '' 𝒫 s := by ext t simp_rw [mem_union, mem_image, mem_powerset_iff] constructor · intro h by_cases hs : a ∈ t · right refine ⟨t \ {a}, ?_, ?_⟩ · rw [diff_singleton_subset_iff] assumption · rw [insert_diff_singleton, insert_eq_of_mem hs] · left exact (subset_insert_iff_of_not_mem hs).mp h · rintro (h | ⟨s', h₁, rfl⟩) · exact subset_trans h (subset_insert a s) · exact insert_subset_insert h₁ #align set.powerset_insert Set.powerset_insert section Range variable {f : ι → α} {s t : Set α} theorem forall_mem_range {p : α → Prop} : (∀ a ∈ range f, p a) ↔ ∀ i, p (f i) := by simp #align set.forall_range_iff Set.forall_mem_range @[deprecated (since := "2024-02-21")] alias forall_range_iff := forall_mem_range theorem forall_subtype_range_iff {p : range f → Prop} : (∀ a : range f, p a) ↔ ∀ i, p ⟨f i, mem_range_self _⟩ := ⟨fun H i => H _, fun H ⟨y, i, hi⟩ => by subst hi apply H⟩ #align set.forall_subtype_range_iff Set.forall_subtype_range_iff
Mathlib/Data/Set/Image.lean
666
666
theorem exists_range_iff {p : α → Prop} : (∃ a ∈ range f, p a) ↔ ∃ i, p (f i) := by
simp
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {α : Type u} class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le #align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (swap (· * ·)) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le #align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le section Group variable [Group α] section TypeclassesRightLE variable [LE α] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] {a b c : α} @[to_additive (attr := simp) "Uses `right` co(ntra)variant."] theorem Right.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by rw [← mul_le_mul_iff_right a] simp #align right.inv_le_one_iff Right.inv_le_one_iff #align right.neg_nonpos_iff Right.neg_nonpos_iff @[to_additive (attr := simp) "Uses `right` co(ntra)variant."]
Mathlib/Algebra/Order/Group/Defs.lean
223
225
theorem Right.one_le_inv_iff : 1 ≤ a⁻¹ ↔ a ≤ 1 := by
rw [← mul_le_mul_iff_right a] simp
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Algebra.Regular.Basic #align_import algebra.regular.pow from "leanprover-community/mathlib"@"46a64b5b4268c594af770c44d9e502afc6a515cb" variable {R : Type*} {a b : R} section Monoid variable [Monoid R]
Mathlib/Algebra/Regular/Pow.lean
31
32
theorem IsLeftRegular.pow (n : ℕ) (rla : IsLeftRegular a) : IsLeftRegular (a ^ n) := by
simp only [IsLeftRegular, ← mul_left_iterate, rla.iterate n]
import Mathlib.Algebra.Group.Defs #align_import algebra.invertible from "leanprover-community/mathlib"@"722b3b152ddd5e0cf21c0a29787c76596cb6b422" assert_not_exists MonoidWithZero assert_not_exists DenselyOrdered universe u variable {α : Type u} class Invertible [Mul α] [One α] (a : α) : Type u where invOf : α invOf_mul_self : invOf * a = 1 mul_invOf_self : a * invOf = 1 #align invertible Invertible prefix:max "⅟" =>-- This notation has the same precedence as `Inv.inv`. Invertible.invOf @[simp] theorem invOf_mul_self' [Mul α] [One α] (a : α) {_ : Invertible a} : ⅟ a * a = 1 := Invertible.invOf_mul_self theorem invOf_mul_self [Mul α] [One α] (a : α) [Invertible a] : ⅟ a * a = 1 := Invertible.invOf_mul_self #align inv_of_mul_self invOf_mul_self @[simp] theorem mul_invOf_self' [Mul α] [One α] (a : α) {_ : Invertible a} : a * ⅟ a = 1 := Invertible.mul_invOf_self theorem mul_invOf_self [Mul α] [One α] (a : α) [Invertible a] : a * ⅟ a = 1 := Invertible.mul_invOf_self #align mul_inv_of_self mul_invOf_self @[simp] theorem invOf_mul_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] theorem invOf_mul_self_assoc [Monoid α] (a b : α) [Invertible a] : ⅟ a * (a * b) = b := by rw [← mul_assoc, invOf_mul_self, one_mul] #align inv_of_mul_self_assoc invOf_mul_self_assoc @[simp] theorem mul_invOf_self_assoc' [Monoid α] (a b : α) {_ : Invertible a} : a * (⅟ a * b) = b := by rw [← mul_assoc, mul_invOf_self, one_mul]
Mathlib/Algebra/Group/Invertible/Defs.lean
128
129
theorem mul_invOf_self_assoc [Monoid α] (a b : α) [Invertible a] : a * (⅟ a * b) = b := by
rw [← mul_assoc, mul_invOf_self, one_mul]
import Mathlib.Algebra.Group.Prod import Mathlib.Algebra.Group.Units.Equiv import Mathlib.Algebra.GroupPower.IterateHom import Mathlib.Logic.Equiv.Set import Mathlib.Tactic.Common #align_import group_theory.perm.basic from "leanprover-community/mathlib"@"b86832321b586c6ac23ef8cdef6a7a27e42b13bd" universe u v namespace Equiv variable {α : Type u} {β : Type v} namespace Perm instance instOne : One (Perm α) where one := Equiv.refl _ instance instMul : Mul (Perm α) where mul f g := Equiv.trans g f instance instInv : Inv (Perm α) where inv := Equiv.symm instance instPowNat : Pow (Perm α) ℕ where pow f n := ⟨f^[n], f.symm^[n], f.left_inv.iterate _, f.right_inv.iterate _⟩ instance permGroup : Group (Perm α) where mul_assoc f g h := (trans_assoc _ _ _).symm one_mul := trans_refl mul_one := refl_trans mul_left_inv := self_trans_symm npow n f := f ^ n npow_succ n f := coe_fn_injective $ Function.iterate_succ _ _ zpow := zpowRec fun n f ↦ f ^ n zpow_succ' n f := coe_fn_injective $ Function.iterate_succ _ _ #align equiv.perm.perm_group Equiv.Perm.permGroup @[simp] theorem default_eq : (default : Perm α) = 1 := rfl #align equiv.perm.default_eq Equiv.Perm.default_eq @[simps] def equivUnitsEnd : Perm α ≃* Units (Function.End α) where -- Porting note: needed to add `.toFun`. toFun e := ⟨e.toFun, e.symm.toFun, e.self_comp_symm, e.symm_comp_self⟩ invFun u := ⟨(u : Function.End α), (↑u⁻¹ : Function.End α), congr_fun u.inv_val, congr_fun u.val_inv⟩ left_inv _ := ext fun _ => rfl right_inv _ := Units.ext rfl map_mul' _ _ := rfl #align equiv.perm.equiv_units_End Equiv.Perm.equivUnitsEnd #align equiv.perm.equiv_units_End_symm_apply_apply Equiv.Perm.equivUnitsEnd_symm_apply_apply #align equiv.perm.equiv_units_End_symm_apply_symm_apply Equiv.Perm.equivUnitsEnd_symm_apply_symm_apply @[simps!] def _root_.MonoidHom.toHomPerm {G : Type*} [Group G] (f : G →* Function.End α) : G →* Perm α := equivUnitsEnd.symm.toMonoidHom.comp f.toHomUnits #align monoid_hom.to_hom_perm MonoidHom.toHomPerm #align monoid_hom.to_hom_perm_apply_symm_apply MonoidHom.toHomPerm_apply_symm_apply #align monoid_hom.to_hom_perm_apply_apply MonoidHom.toHomPerm_apply_apply theorem mul_apply (f g : Perm α) (x) : (f * g) x = f (g x) := Equiv.trans_apply _ _ _ #align equiv.perm.mul_apply Equiv.Perm.mul_apply theorem one_apply (x) : (1 : Perm α) x = x := rfl #align equiv.perm.one_apply Equiv.Perm.one_apply @[simp] theorem inv_apply_self (f : Perm α) (x) : f⁻¹ (f x) = x := f.symm_apply_apply x #align equiv.perm.inv_apply_self Equiv.Perm.inv_apply_self @[simp] theorem apply_inv_self (f : Perm α) (x) : f (f⁻¹ x) = x := f.apply_symm_apply x #align equiv.perm.apply_inv_self Equiv.Perm.apply_inv_self theorem one_def : (1 : Perm α) = Equiv.refl α := rfl #align equiv.perm.one_def Equiv.Perm.one_def theorem mul_def (f g : Perm α) : f * g = g.trans f := rfl #align equiv.perm.mul_def Equiv.Perm.mul_def theorem inv_def (f : Perm α) : f⁻¹ = f.symm := rfl #align equiv.perm.inv_def Equiv.Perm.inv_def @[simp, norm_cast] lemma coe_one : ⇑(1 : Perm α) = id := rfl #align equiv.perm.coe_one Equiv.Perm.coe_one @[simp, norm_cast] lemma coe_mul (f g : Perm α) : ⇑(f * g) = f ∘ g := rfl #align equiv.perm.coe_mul Equiv.Perm.coe_mul @[norm_cast] lemma coe_pow (f : Perm α) (n : ℕ) : ⇑(f ^ n) = f^[n] := rfl #align equiv.perm.coe_pow Equiv.Perm.coe_pow @[simp] lemma iterate_eq_pow (f : Perm α) (n : ℕ) : f^[n] = ⇑(f ^ n) := rfl #align equiv.perm.iterate_eq_pow Equiv.Perm.iterate_eq_pow theorem eq_inv_iff_eq {f : Perm α} {x y : α} : x = f⁻¹ y ↔ f x = y := f.eq_symm_apply #align equiv.perm.eq_inv_iff_eq Equiv.Perm.eq_inv_iff_eq theorem inv_eq_iff_eq {f : Perm α} {x y : α} : f⁻¹ x = y ↔ x = f y := f.symm_apply_eq #align equiv.perm.inv_eq_iff_eq Equiv.Perm.inv_eq_iff_eq
Mathlib/GroupTheory/Perm/Basic.lean
125
127
theorem zpow_apply_comm {α : Type*} (σ : Perm α) (m n : ℤ) {x : α} : (σ ^ m) ((σ ^ n) x) = (σ ^ n) ((σ ^ m) x) := by
rw [← Equiv.Perm.mul_apply, ← Equiv.Perm.mul_apply, zpow_mul_comm]
import Mathlib.CategoryTheory.Sites.Spaces import Mathlib.Topology.Sheaves.Sheaf import Mathlib.CategoryTheory.Sites.DenseSubsite #align_import topology.sheaves.sheaf_condition.sites from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc" noncomputable section set_option linter.uppercaseLean3 false -- Porting note: Added because of too many false positives universe w v u open CategoryTheory TopologicalSpace namespace TopCat.Presheaf variable {X : TopCat.{w}} def coveringOfPresieve (U : Opens X) (R : Presieve U) : (ΣV, { f : V ⟶ U // R f }) → Opens X := fun f => f.1 #align Top.presheaf.covering_of_presieve TopCat.Presheaf.coveringOfPresieve @[simp] theorem coveringOfPresieve_apply (U : Opens X) (R : Presieve U) (f : ΣV, { f : V ⟶ U // R f }) : coveringOfPresieve U R f = f.1 := rfl #align Top.presheaf.covering_of_presieve_apply TopCat.Presheaf.coveringOfPresieve_apply def presieveOfCoveringAux {ι : Type v} (U : ι → Opens X) (Y : Opens X) : Presieve Y := fun V _ => ∃ i, V = U i #align Top.presheaf.presieve_of_covering_aux TopCat.Presheaf.presieveOfCoveringAux def presieveOfCovering {ι : Type v} (U : ι → Opens X) : Presieve (iSup U) := presieveOfCoveringAux U (iSup U) #align Top.presheaf.presieve_of_covering TopCat.Presheaf.presieveOfCovering @[simp] theorem covering_presieve_eq_self {Y : Opens X} (R : Presieve Y) : presieveOfCoveringAux (coveringOfPresieve Y R) Y = R := by funext Z ext f exact ⟨fun ⟨⟨_, f', h⟩, rfl⟩ => by rwa [Subsingleton.elim f f'], fun h => ⟨⟨Z, f, h⟩, rfl⟩⟩ #align Top.presheaf.covering_presieve_eq_self TopCat.Presheaf.covering_presieve_eq_self section OpenEmbedding open TopCat.Presheaf Opposite variable {C : Type u} [Category.{v} C] variable {X Y : TopCat.{w}} {f : X ⟶ Y} {F : Y.Presheaf C}
Mathlib/Topology/Sheaves/SheafCondition/Sites.lean
161
168
theorem OpenEmbedding.compatiblePreserving (hf : OpenEmbedding f) : CompatiblePreserving (Opens.grothendieckTopology Y) hf.isOpenMap.functor := by
haveI : Mono f := (TopCat.mono_iff_injective f).mpr hf.inj apply compatiblePreservingOfDownwardsClosed intro U V i refine ⟨(Opens.map f).obj V, eqToIso <| Opens.ext <| Set.image_preimage_eq_of_subset fun x h ↦ ?_⟩ obtain ⟨_, _, rfl⟩ := i.le h exact ⟨_, rfl⟩
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by ring
Mathlib/NumberTheory/SumFourSquares.lean
34
42
theorem Nat.euler_four_squares (a b c d x y z w : ℕ) : ((a : ℤ) * x - b * y - c * z - d * w).natAbs ^ 2 + ((a : ℤ) * y + b * x + c * w - d * z).natAbs ^ 2 + ((a : ℤ) * z - b * w + c * x + d * y).natAbs ^ 2 + ((a : ℤ) * w + b * z - c * y + d * x).natAbs ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by
rw [← Int.natCast_inj] push_cast simp only [sq_abs, _root_.euler_four_squares]
import Mathlib.Data.Nat.Bits import Mathlib.Order.Lattice #align_import data.nat.size from "leanprover-community/mathlib"@"18a5306c091183ac90884daa9373fa3b178e8607" namespace Nat section set_option linter.deprecated false theorem shiftLeft_eq_mul_pow (m) : ∀ n, m <<< n = m * 2 ^ n := shiftLeft_eq _ #align nat.shiftl_eq_mul_pow Nat.shiftLeft_eq_mul_pow theorem shiftLeft'_tt_eq_mul_pow (m) : ∀ n, shiftLeft' true m n + 1 = (m + 1) * 2 ^ n | 0 => by simp [shiftLeft', pow_zero, Nat.one_mul] | k + 1 => by change bit1 (shiftLeft' true m k) + 1 = (m + 1) * (2 ^ k * 2) rw [bit1_val] change 2 * (shiftLeft' true m k + 1) = _ rw [shiftLeft'_tt_eq_mul_pow m k, mul_left_comm, mul_comm 2] #align nat.shiftl'_tt_eq_mul_pow Nat.shiftLeft'_tt_eq_mul_pow end #align nat.one_shiftl Nat.one_shiftLeft #align nat.zero_shiftl Nat.zero_shiftLeft #align nat.shiftr_eq_div_pow Nat.shiftRight_eq_div_pow theorem shiftLeft'_ne_zero_left (b) {m} (h : m ≠ 0) (n) : shiftLeft' b m n ≠ 0 := by induction n <;> simp [bit_ne_zero, shiftLeft', *] #align nat.shiftl'_ne_zero_left Nat.shiftLeft'_ne_zero_left theorem shiftLeft'_tt_ne_zero (m) : ∀ {n}, (n ≠ 0) → shiftLeft' true m n ≠ 0 | 0, h => absurd rfl h | succ _, _ => Nat.bit1_ne_zero _ #align nat.shiftl'_tt_ne_zero Nat.shiftLeft'_tt_ne_zero @[simp] theorem size_zero : size 0 = 0 := by simp [size] #align nat.size_zero Nat.size_zero @[simp] theorem size_bit {b n} (h : bit b n ≠ 0) : size (bit b n) = succ (size n) := by rw [size] conv => lhs rw [binaryRec] simp [h] rw [div2_bit] #align nat.size_bit Nat.size_bit section set_option linter.deprecated false @[simp] theorem size_bit0 {n} (h : n ≠ 0) : size (bit0 n) = succ (size n) := @size_bit false n (Nat.bit0_ne_zero h) #align nat.size_bit0 Nat.size_bit0 @[simp] theorem size_bit1 (n) : size (bit1 n) = succ (size n) := @size_bit true n (Nat.bit1_ne_zero n) #align nat.size_bit1 Nat.size_bit1 @[simp] theorem size_one : size 1 = 1 := show size (bit1 0) = 1 by rw [size_bit1, size_zero] #align nat.size_one Nat.size_one end @[simp] theorem size_shiftLeft' {b m n} (h : shiftLeft' b m n ≠ 0) : size (shiftLeft' b m n) = size m + n := by induction' n with n IH <;> simp [shiftLeft'] at h ⊢ rw [size_bit h, Nat.add_succ] by_cases s0 : shiftLeft' b m n = 0 <;> [skip; rw [IH s0]] rw [s0] at h ⊢ cases b; · exact absurd rfl h have : shiftLeft' true m n + 1 = 1 := congr_arg (· + 1) s0 rw [shiftLeft'_tt_eq_mul_pow] at this obtain rfl := succ.inj (eq_one_of_dvd_one ⟨_, this.symm⟩) simp only [zero_add, one_mul] at this obtain rfl : n = 0 := not_ne_iff.1 fun hn ↦ ne_of_gt (Nat.one_lt_pow hn (by decide)) this rfl #align nat.size_shiftl' Nat.size_shiftLeft' -- TODO: decide whether `Nat.shiftLeft_eq` (which rewrites the LHS into a power) should be a simp -- lemma; it was not in mathlib3. Until then, tell the simpNF linter to ignore the issue. @[simp, nolint simpNF]
Mathlib/Data/Nat/Size.lean
103
104
theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n := by
simp only [size_shiftLeft' (shiftLeft'_ne_zero_left _ h _), ← shiftLeft'_false]
import Mathlib.Data.Opposite import Mathlib.Data.Set.Defs #align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e" variable {α : Type*} open Opposite namespace Set protected def op (s : Set α) : Set αᵒᵖ := unop ⁻¹' s #align set.op Set.op protected def unop (s : Set αᵒᵖ) : Set α := op ⁻¹' s #align set.unop Set.unop @[simp] theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s := Iff.rfl #align set.mem_op Set.mem_op @[simp 1100] theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl #align set.op_mem_op Set.op_mem_op @[simp] theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s := Iff.rfl #align set.mem_unop Set.mem_unop @[simp 1100] theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl #align set.unop_mem_unop Set.unop_mem_unop @[simp] theorem op_unop (s : Set α) : s.op.unop = s := rfl #align set.op_unop Set.op_unop @[simp] theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl #align set.unop_op Set.unop_op @[simps] def opEquiv_self (s : Set α) : s.op ≃ s := ⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩ #align set.op_equiv_self Set.opEquiv_self #align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe #align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe @[simps] def opEquiv : Set α ≃ Set αᵒᵖ := ⟨Set.op, Set.unop, op_unop, unop_op⟩ #align set.op_equiv Set.opEquiv #align set.op_equiv_symm_apply Set.opEquiv_symm_apply #align set.op_equiv_apply Set.opEquiv_apply @[simp] theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by ext constructor · apply unop_injective · apply op_injective #align set.singleton_op Set.singleton_op @[simp]
Mathlib/Data/Set/Opposite.lean
84
88
theorem singleton_unop (x : αᵒᵖ) : ({x} : Set αᵒᵖ).unop = {unop x} := by
ext constructor · apply op_injective · apply unop_injective
import Mathlib.Data.Rat.Encodable import Mathlib.Data.Real.EReal import Mathlib.Topology.Instances.ENNReal import Mathlib.Topology.Order.MonotoneContinuity #align_import topology.instances.ereal from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Set Filter Metric TopologicalSpace Topology open scoped ENNReal NNReal Filter variable {α : Type*} [TopologicalSpace α] namespace EReal instance : TopologicalSpace EReal := Preorder.topology EReal instance : OrderTopology EReal := ⟨rfl⟩ instance : T5Space EReal := inferInstance instance : T2Space EReal := inferInstance lemma denseRange_ratCast : DenseRange (fun r : ℚ ↦ ((r : ℝ) : EReal)) := dense_of_exists_between fun _ _ h => exists_range_iff.2 <| exists_rat_btwn_of_lt h instance : SecondCountableTopology EReal := have : SeparableSpace EReal := ⟨⟨_, countable_range _, denseRange_ratCast⟩⟩ .of_separableSpace_orderTopology _ theorem embedding_coe : Embedding ((↑) : ℝ → EReal) := coe_strictMono.embedding_of_ordConnected <| by rw [range_coe_eq_Ioo]; exact ordConnected_Ioo #align ereal.embedding_coe EReal.embedding_coe theorem openEmbedding_coe : OpenEmbedding ((↑) : ℝ → EReal) := ⟨embedding_coe, by simp only [range_coe_eq_Ioo, isOpen_Ioo]⟩ #align ereal.open_embedding_coe EReal.openEmbedding_coe @[norm_cast] theorem tendsto_coe {α : Type*} {f : Filter α} {m : α → ℝ} {a : ℝ} : Tendsto (fun a => (m a : EReal)) f (𝓝 ↑a) ↔ Tendsto m f (𝓝 a) := embedding_coe.tendsto_nhds_iff.symm #align ereal.tendsto_coe EReal.tendsto_coe theorem _root_.continuous_coe_real_ereal : Continuous ((↑) : ℝ → EReal) := embedding_coe.continuous #align continuous_coe_real_ereal continuous_coe_real_ereal theorem continuous_coe_iff {f : α → ℝ} : (Continuous fun a => (f a : EReal)) ↔ Continuous f := embedding_coe.continuous_iff.symm #align ereal.continuous_coe_iff EReal.continuous_coe_iff theorem nhds_coe {r : ℝ} : 𝓝 (r : EReal) = (𝓝 r).map (↑) := (openEmbedding_coe.map_nhds_eq r).symm #align ereal.nhds_coe EReal.nhds_coe theorem nhds_coe_coe {r p : ℝ} : 𝓝 ((r : EReal), (p : EReal)) = (𝓝 (r, p)).map fun p : ℝ × ℝ => (↑p.1, ↑p.2) := ((openEmbedding_coe.prod openEmbedding_coe).map_nhds_eq (r, p)).symm #align ereal.nhds_coe_coe EReal.nhds_coe_coe
Mathlib/Topology/Instances/EReal.lean
86
90
theorem tendsto_toReal {a : EReal} (ha : a ≠ ⊤) (h'a : a ≠ ⊥) : Tendsto EReal.toReal (𝓝 a) (𝓝 a.toReal) := by
lift a to ℝ using ⟨ha, h'a⟩ rw [nhds_coe, tendsto_map'_iff] exact tendsto_id
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop} (h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ.restrict (s ∩ Ioo a b), p x) : ∀ᵐ x ∂μ.restrict s, p x := by let T : s × s → Set ℝ := fun p => Ioo p.1 p.2 let u := ⋃ i : ↥s × ↥s, T i have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo' obtain ⟨A, A_count, hA⟩ : ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i := isOpen_iUnion_countable _ fun p => isOpen_Ioo have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by intro x hx by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i · rw [← hA] at h'x obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using h'x right exact mem_biUnion pA ⟨hx, xp⟩ · exact Or.inl ⟨hx, h'x⟩ apply ae_restrict_of_ae_restrict_of_subset this rw [ae_restrict_union_iff, ae_restrict_biUnion_iff _ A_count] constructor · have : μ.restrict (s \ u) = 0 := by simp only [restrict_eq_zero, hfinite.measure_zero] simp only [this, ae_zero, eventually_bot] · rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ - dsimp [T] rcases le_or_lt b a with (hba | hab) · simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero, eventually_bot] · exact h a b as bs hab #align ae_restrict_of_ae_restrict_inter_Ioo ae_restrict_of_ae_restrict_inter_Ioo
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
659
686
theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Set ℝ} {p : ℝ → Prop} (h : ∀ a b, a ∈ s → b ∈ s → a < b → ∀ᵐ x ∂μ, x ∈ s ∩ Ioo a b → p x) : ∀ᵐ x ∂μ, x ∈ s → p x := by
/- By second-countability, we cover `s` by countably many intervals `(a, b)` (except maybe for two endpoints, which don't matter since `μ` does not have any atom). -/ let T : s × s → Set ℝ := fun p => Ioo p.1 p.2 let u := ⋃ i : ↥s × ↥s, T i have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo' obtain ⟨A, A_count, hA⟩ : ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i := isOpen_iUnion_countable _ fun p => isOpen_Ioo have M : ∀ᵐ x ∂μ, x ∉ s \ u := hfinite.countable.ae_not_mem _ have M' : ∀ᵐ x ∂μ, ∀ (i : ↥s × ↥s), i ∈ A → x ∈ s ∩ T i → p x := by rw [ae_ball_iff A_count] rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ - change ∀ᵐ x : ℝ ∂μ, x ∈ s ∩ Ioo a b → p x rcases le_or_lt b a with (hba | hab) · simp only [Ioo_eq_empty_of_le hba, inter_empty, IsEmpty.forall_iff, eventually_true, mem_empty_iff_false] · exact h a b as bs hab filter_upwards [M, M'] with x hx h'x intro xs by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i · rw [← hA] at Hx obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using Hx apply h'x p pA ⟨xs, xp⟩ · exact False.elim (hx ⟨xs, Hx⟩)
import Mathlib.Algebra.MonoidAlgebra.Degree import Mathlib.Algebra.MvPolynomial.Rename import Mathlib.Algebra.Order.BigOperators.Ring.Finset #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 Degrees def degrees (p : MvPolynomial σ R) : Multiset σ := letI := Classical.decEq σ p.support.sup fun s : σ →₀ ℕ => toMultiset s #align mv_polynomial.degrees MvPolynomial.degrees theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) : p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl #align mv_polynomial.degrees_def MvPolynomial.degrees_def theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by classical refine (supDegree_single s a).trans_le ?_ split_ifs exacts [bot_le, le_rfl] #align mv_polynomial.degrees_monomial MvPolynomial.degrees_monomial theorem degrees_monomial_eq (s : σ →₀ ℕ) (a : R) (ha : a ≠ 0) : degrees (monomial s a) = toMultiset s := by classical exact (supDegree_single s a).trans (if_neg ha) #align mv_polynomial.degrees_monomial_eq MvPolynomial.degrees_monomial_eq theorem degrees_C (a : R) : degrees (C a : MvPolynomial σ R) = 0 := Multiset.le_zero.1 <| degrees_monomial _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_C MvPolynomial.degrees_C theorem degrees_X' (n : σ) : degrees (X n : MvPolynomial σ R) ≤ {n} := le_trans (degrees_monomial _ _) <| le_of_eq <| toMultiset_single _ _ set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X' MvPolynomial.degrees_X' @[simp] theorem degrees_X [Nontrivial R] (n : σ) : degrees (X n : MvPolynomial σ R) = {n} := (degrees_monomial_eq _ (1 : R) one_ne_zero).trans (toMultiset_single _ _) set_option linter.uppercaseLean3 false in #align mv_polynomial.degrees_X MvPolynomial.degrees_X @[simp] theorem degrees_zero : degrees (0 : MvPolynomial σ R) = 0 := by rw [← C_0] exact degrees_C 0 #align mv_polynomial.degrees_zero MvPolynomial.degrees_zero @[simp] theorem degrees_one : degrees (1 : MvPolynomial σ R) = 0 := degrees_C 1 #align mv_polynomial.degrees_one MvPolynomial.degrees_one
Mathlib/Algebra/MvPolynomial/Degrees.lean
128
130
theorem degrees_add [DecidableEq σ] (p q : MvPolynomial σ R) : (p + q).degrees ≤ p.degrees ⊔ q.degrees := by
simp_rw [degrees_def]; exact supDegree_add_le
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Measure.MeasureSpace namespace MeasureTheory namespace Measure variable {M : Type*} [Monoid M] [MeasurableSpace M] @[to_additive conv "Additive convolution of measures."] noncomputable def mconv (μ : Measure M) (ν : Measure M) : Measure M := Measure.map (fun x : M × M ↦ x.1 * x.2) (μ.prod ν) scoped[MeasureTheory] infix:80 " ∗ " => MeasureTheory.Measure.mconv scoped[MeasureTheory] infix:80 " ∗ " => MeasureTheory.Measure.conv @[to_additive (attr := simp)] theorem dirac_one_mconv [MeasurableMul₂ M] (μ : Measure M) [SFinite μ] : (Measure.dirac 1) ∗ μ = μ := by unfold mconv rw [MeasureTheory.Measure.dirac_prod, map_map] · simp only [Function.comp_def, one_mul, map_id'] all_goals { measurability } @[to_additive (attr := simp)] theorem mconv_dirac_one [MeasurableMul₂ M] (μ : Measure M) [SFinite μ] : μ ∗ (Measure.dirac 1) = μ := by unfold mconv rw [MeasureTheory.Measure.prod_dirac, map_map] · simp only [Function.comp_def, mul_one, map_id'] all_goals { measurability } @[to_additive (attr := simp) conv_zero] theorem mconv_zero (μ : Measure M) : (0 : Measure M) ∗ μ = (0 : Measure M) := by unfold mconv simp @[to_additive (attr := simp) zero_conv] theorem zero_mconv (μ : Measure M) : μ ∗ (0 : Measure M) = (0 : Measure M) := by unfold mconv simp @[to_additive conv_add] theorem mconv_add [MeasurableMul₂ M] (μ : Measure M) (ν : Measure M) (ρ : Measure M) [SFinite μ] [SFinite ν] [SFinite ρ] : μ ∗ (ν + ρ) = μ ∗ ν + μ ∗ ρ := by unfold mconv rw [prod_add, map_add] measurability @[to_additive add_conv] theorem add_mconv [MeasurableMul₂ M] (μ : Measure M) (ν : Measure M) (ρ : Measure M) [SFinite μ] [SFinite ν] [SFinite ρ] : (μ + ν) ∗ ρ = μ ∗ ρ + ν ∗ ρ := by unfold mconv rw [add_prod, map_add] measurability @[to_additive conv_comm]
Mathlib/MeasureTheory/Group/Convolution.lean
85
90
theorem mconv_comm {M : Type*} [CommMonoid M] [MeasurableSpace M] [MeasurableMul₂ M] (μ : Measure M) (ν : Measure M) [SFinite μ] [SFinite ν] : μ ∗ ν = ν ∗ μ := by
unfold mconv rw [← prod_swap, map_map] · simp [Function.comp_def, mul_comm] all_goals { measurability }
import Mathlib.LinearAlgebra.Matrix.DotProduct import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal #align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7" open Matrix namespace Matrix open FiniteDimensional variable {l m n o R : Type*} [Fintype n] [Fintype o] section CommRing variable [CommRing R] noncomputable def rank (A : Matrix m n R) : ℕ := finrank R <| LinearMap.range A.mulVecLin #align matrix.rank Matrix.rank @[simp] theorem rank_one [StrongRankCondition R] [DecidableEq n] : rank (1 : Matrix n n R) = Fintype.card n := by rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi] #align matrix.rank_one Matrix.rank_one @[simp] theorem rank_zero [Nontrivial R] : rank (0 : Matrix m n R) = 0 := by rw [rank, mulVecLin_zero, LinearMap.range_zero, finrank_bot] #align matrix.rank_zero Matrix.rank_zero theorem rank_le_card_width [StrongRankCondition R] (A : Matrix m n R) : A.rank ≤ Fintype.card n := by haveI : Module.Finite R (n → R) := Module.Finite.pi haveI : Module.Free R (n → R) := Module.Free.pi _ _ exact A.mulVecLin.finrank_range_le.trans_eq (finrank_pi _) #align matrix.rank_le_card_width Matrix.rank_le_card_width theorem rank_le_width [StrongRankCondition R] {m n : ℕ} (A : Matrix (Fin m) (Fin n) R) : A.rank ≤ n := A.rank_le_card_width.trans <| (Fintype.card_fin n).le #align matrix.rank_le_width Matrix.rank_le_width theorem rank_mul_le_left [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) : (A * B).rank ≤ A.rank := by rw [rank, rank, mulVecLin_mul] exact Cardinal.toNat_le_toNat (LinearMap.rank_comp_le_left _ _) (rank_lt_aleph0 _ _) #align matrix.rank_mul_le_left Matrix.rank_mul_le_left theorem rank_mul_le_right [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) : (A * B).rank ≤ B.rank := by rw [rank, rank, mulVecLin_mul] exact finrank_le_finrank_of_rank_le_rank (LinearMap.lift_rank_comp_le_right _ _) (rank_lt_aleph0 _ _) #align matrix.rank_mul_le_right Matrix.rank_mul_le_right theorem rank_mul_le [StrongRankCondition R] (A : Matrix m n R) (B : Matrix n o R) : (A * B).rank ≤ min A.rank B.rank := le_min (rank_mul_le_left _ _) (rank_mul_le_right _ _) #align matrix.rank_mul_le Matrix.rank_mul_le theorem rank_unit [StrongRankCondition R] [DecidableEq n] (A : (Matrix n n R)ˣ) : (A : Matrix n n R).rank = Fintype.card n := by apply le_antisymm (rank_le_card_width (A : Matrix n n R)) _ have := rank_mul_le_left (A : Matrix n n R) (↑A⁻¹ : Matrix n n R) rwa [← Units.val_mul, mul_inv_self, Units.val_one, rank_one] at this #align matrix.rank_unit Matrix.rank_unit
Mathlib/Data/Matrix/Rank.lean
96
99
theorem rank_of_isUnit [StrongRankCondition R] [DecidableEq n] (A : Matrix n n R) (h : IsUnit A) : A.rank = Fintype.card n := by
obtain ⟨A, rfl⟩ := h exact rank_unit A
import Mathlib.Topology.Order import Mathlib.Topology.Sets.Opens import Mathlib.Topology.ContinuousFunction.Basic #align_import topology.continuous_function.t0_sierpinski from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" noncomputable section namespace TopologicalSpace
Mathlib/Topology/ContinuousFunction/T0Sierpinski.lean
28
37
theorem eq_induced_by_maps_to_sierpinski (X : Type*) [t : TopologicalSpace X] : t = ⨅ u : Opens X, sierpinskiSpace.induced (· ∈ u) := by
apply le_antisymm · rw [le_iInf_iff] exact fun u => Continuous.le_induced (isOpen_iff_continuous_mem.mp u.2) · intro u h rw [← generateFrom_iUnion_isOpen] apply isOpen_generateFrom_of_mem simp only [Set.mem_iUnion, Set.mem_setOf_eq, isOpen_induced_iff] exact ⟨⟨u, h⟩, {True}, isOpen_singleton_true, by simp [Set.preimage]⟩
import Mathlib.Topology.Category.LightProfinite.Basic import Mathlib.Topology.Category.Profinite.Limits namespace LightProfinite universe u w attribute [local instance] CategoryTheory.ConcreteCategory.instFunLike open CategoryTheory Limits section Pullbacks variable {X Y B : LightProfinite.{u}} (f : X ⟶ B) (g : Y ⟶ B) def pullback : LightProfinite.{u} := letI set := { xy : X × Y | f xy.fst = g xy.snd } haveI : CompactSpace set := isCompact_iff_compactSpace.mp (isClosed_eq (f.continuous.comp continuous_fst) (g.continuous.comp continuous_snd)).isCompact LightProfinite.of set def pullback.fst : pullback f g ⟶ X where toFun := fun ⟨⟨x, _⟩, _⟩ ↦ x continuous_toFun := Continuous.comp continuous_fst continuous_subtype_val def pullback.snd : pullback f g ⟶ Y where toFun := fun ⟨⟨_, y⟩, _⟩ ↦ y continuous_toFun := Continuous.comp continuous_snd continuous_subtype_val @[reassoc] lemma pullback.condition : pullback.fst f g ≫ f = pullback.snd f g ≫ g := by ext ⟨_, h⟩ exact h def pullback.lift {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : Z ⟶ pullback f g where toFun := fun z ↦ ⟨⟨a z, b z⟩, by apply_fun (· z) at w; exact w⟩ continuous_toFun := by apply Continuous.subtype_mk rw [continuous_prod_mk] exact ⟨a.continuous, b.continuous⟩ @[reassoc (attr := simp)] lemma pullback.lift_fst {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.fst f g = a := rfl @[reassoc (attr := simp)] lemma pullback.lift_snd {Z : LightProfinite.{u}} (a : Z ⟶ X) (b : Z ⟶ Y) (w : a ≫ f = b ≫ g) : pullback.lift f g a b w ≫ pullback.snd f g = b := rfl lemma pullback.hom_ext {Z : LightProfinite.{u}} (a b : Z ⟶ pullback f g) (hfst : a ≫ pullback.fst f g = b ≫ pullback.fst f g) (hsnd : a ≫ pullback.snd f g = b ≫ pullback.snd f g) : a = b := by ext z apply_fun (· z) at hfst hsnd apply Subtype.ext apply Prod.ext · exact hfst · exact hsnd @[simps! pt π] def pullback.cone : Limits.PullbackCone f g := Limits.PullbackCone.mk (pullback.fst f g) (pullback.snd f g) (pullback.condition f g) @[simps! lift] def pullback.isLimit : Limits.IsLimit (pullback.cone f g) := Limits.PullbackCone.isLimitAux _ (fun s ↦ pullback.lift f g s.fst s.snd s.condition) (fun _ ↦ pullback.lift_fst _ _ _ _ _) (fun _ ↦ pullback.lift_snd _ _ _ _ _) (fun _ _ hm ↦ pullback.hom_ext _ _ _ _ (hm .left) (hm .right)) section FiniteCoproducts variable {α : Type w} [Finite α] (X : α → LightProfinite.{max u w}) def finiteCoproduct : LightProfinite := LightProfinite.of <| Σ (a : α), X a def finiteCoproduct.ι (a : α) : X a ⟶ finiteCoproduct X where toFun := (⟨a, ·⟩) continuous_toFun := continuous_sigmaMk (σ := fun a ↦ X a) def finiteCoproduct.desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) : finiteCoproduct X ⟶ B where toFun := fun ⟨a, x⟩ ↦ e a x continuous_toFun := by apply continuous_sigma intro a exact (e a).continuous @[reassoc (attr := simp)] lemma finiteCoproduct.ι_desc {B : LightProfinite.{max u w}} (e : (a : α) → (X a ⟶ B)) (a : α) : finiteCoproduct.ι X a ≫ finiteCoproduct.desc X e = e a := rfl lemma finiteCoproduct.hom_ext {B : LightProfinite.{max u w}} (f g : finiteCoproduct X ⟶ B) (h : ∀ a : α, finiteCoproduct.ι X a ≫ f = finiteCoproduct.ι X a ≫ g) : f = g := by ext ⟨a, x⟩ specialize h a apply_fun (· x) at h exact h abbrev finiteCoproduct.cofan : Limits.Cofan X := Cofan.mk (finiteCoproduct X) (finiteCoproduct.ι X) def finiteCoproduct.isColimit : Limits.IsColimit (finiteCoproduct.cofan X) := mkCofanColimit _ (fun s ↦ desc _ fun a ↦ s.inj a) (fun s a ↦ ι_desc _ _ _) fun s m hm ↦ finiteCoproduct.hom_ext _ _ _ fun a ↦ (by ext t; exact congrFun (congrArg DFunLike.coe (hm a)) t) instance (n : ℕ) (F : Discrete (Fin n) ⥤ LightProfinite) : HasColimit (Discrete.functor (F.obj ∘ Discrete.mk) : Discrete (Fin n) ⥤ LightProfinite) where exists_colimit := ⟨⟨finiteCoproduct.cofan _, finiteCoproduct.isColimit _⟩⟩ instance : HasFiniteCoproducts LightProfinite where out _ := { has_colimit := fun _ ↦ hasColimitOfIso Discrete.natIsoFunctor } section Iso noncomputable def coproductIsoCoproduct : finiteCoproduct X ≅ ∐ X := Limits.IsColimit.coconePointUniqueUpToIso (finiteCoproduct.isColimit X) (Limits.colimit.isColimit _)
Mathlib/Topology/Category/LightProfinite/Limits.lean
202
204
theorem Sigma.ι_comp_toFiniteCoproduct (a : α) : (Limits.Sigma.ι X a) ≫ (coproductIsoCoproduct X).inv = finiteCoproduct.ι X a := by
simp [coproductIsoCoproduct]
import Mathlib.RingTheory.FiniteType import Mathlib.RingTheory.Localization.AtPrime import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Integer import Mathlib.RingTheory.Localization.Submodule import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.RingTheory.RingHomProperties import Mathlib.Data.Set.Subsingleton #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0" open scoped Pointwise Classical universe u variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R) variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S) variable [Algebra R R'] [Algebra S S'] section Properties section Ideal open scoped nonZeroDivisors
Mathlib/RingTheory/LocalProperties.lean
236
255
theorem Ideal.le_of_localization_maximal {I J : Ideal R} (h : ∀ (P : Ideal R) (hP : P.IsMaximal), Ideal.map (algebraMap R (Localization.AtPrime P)) I ≤ Ideal.map (algebraMap R (Localization.AtPrime P)) J) : I ≤ J := by
intro x hx suffices J.colon (Ideal.span {x}) = ⊤ by simpa using Submodule.mem_colon.mp (show (1 : R) ∈ J.colon (Ideal.span {x}) from this.symm ▸ Submodule.mem_top) x (Ideal.mem_span_singleton_self x) refine Not.imp_symm (J.colon (Ideal.span {x})).exists_le_maximal ?_ push_neg intro P hP le obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ := (IsLocalization.mem_map_algebraMap_iff P.primeCompl _).mp (h P hP (Ideal.mem_map_of_mem _ hx)) rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.primeCompl _ _).mp eq refine hs ((hP.isPrime.mem_or_mem (le (Ideal.mem_colon_singleton.mpr ?_))).resolve_right hm) simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq simpa only [mul_assoc, eq] using J.mul_mem_left m ha
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp] #align iterated_fderiv_within_eq_equiv_comp iteratedFDerivWithin_eq_equiv_comp theorem iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod {m : Fin n → 𝕜} : (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) m = (∏ i, m i) • iteratedDerivWithin n f s x := by rw [iteratedDerivWithin_eq_iteratedFDerivWithin, ← ContinuousMultilinearMap.map_smul_univ] simp #align iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod iteratedFDerivWithin_apply_eq_iteratedDerivWithin_mul_prod theorem norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin : ‖iteratedFDerivWithin 𝕜 n f s x‖ = ‖iteratedDerivWithin n f s x‖ := by rw [iteratedDerivWithin_eq_equiv_comp, Function.comp_apply, LinearIsometryEquiv.norm_map] #align norm_iterated_fderiv_within_eq_norm_iterated_deriv_within norm_iteratedFDerivWithin_eq_norm_iteratedDerivWithin @[simp] theorem iteratedDerivWithin_zero : iteratedDerivWithin 0 f s = f := by ext x simp [iteratedDerivWithin] #align iterated_deriv_within_zero iteratedDerivWithin_zero @[simp] theorem iteratedDerivWithin_one {x : 𝕜} (h : UniqueDiffWithinAt 𝕜 s x) : iteratedDerivWithin 1 f s x = derivWithin f s x := by simp only [iteratedDerivWithin, iteratedFDerivWithin_one_apply h]; rfl #align iterated_deriv_within_one iteratedDerivWithin_one
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
128
134
theorem contDiffOn_of_continuousOn_differentiableOn_deriv {n : ℕ∞} (Hcont : ∀ m : ℕ, (m : ℕ∞) ≤ n → ContinuousOn (fun x => iteratedDerivWithin m f s x) s) (Hdiff : ∀ m : ℕ, (m : ℕ∞) < n → DifferentiableOn 𝕜 (fun x => iteratedDerivWithin m f s x) s) : ContDiffOn 𝕜 n f s := by
apply contDiffOn_of_continuousOn_differentiableOn · simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_continuousOn_iff] · simpa only [iteratedFDerivWithin_eq_equiv_comp, LinearIsometryEquiv.comp_differentiableOn_iff]
import Mathlib.Logic.Function.Conjugate #align_import logic.function.iterate from "leanprover-community/mathlib"@"792a2a264169d64986541c6f8f7e3bbb6acb6295" universe u v variable {α : Type u} {β : Type v} def Nat.iterate {α : Sort u} (op : α → α) : ℕ → α → α | 0, a => a | succ k, a => iterate op k (op a) #align nat.iterate Nat.iterate @[inherit_doc Nat.iterate] notation:max f "^["n"]" => Nat.iterate f n namespace Function open Function (Commute) variable (f : α → α) @[simp] theorem iterate_zero : f^[0] = id := rfl #align function.iterate_zero Function.iterate_zero theorem iterate_zero_apply (x : α) : f^[0] x = x := rfl #align function.iterate_zero_apply Function.iterate_zero_apply @[simp] theorem iterate_succ (n : ℕ) : f^[n.succ] = f^[n] ∘ f := rfl #align function.iterate_succ Function.iterate_succ theorem iterate_succ_apply (n : ℕ) (x : α) : f^[n.succ] x = f^[n] (f x) := rfl #align function.iterate_succ_apply Function.iterate_succ_apply @[simp] theorem iterate_id (n : ℕ) : (id : α → α)^[n] = id := Nat.recOn n rfl fun n ihn ↦ by rw [iterate_succ, ihn, id_comp] #align function.iterate_id Function.iterate_id theorem iterate_add (m : ℕ) : ∀ n : ℕ, f^[m + n] = f^[m] ∘ f^[n] | 0 => rfl | Nat.succ n => by rw [Nat.add_succ, iterate_succ, iterate_succ, iterate_add m n]; rfl #align function.iterate_add Function.iterate_add theorem iterate_add_apply (m n : ℕ) (x : α) : f^[m + n] x = f^[m] (f^[n] x) := by rw [iterate_add f m n] rfl #align function.iterate_add_apply Function.iterate_add_apply -- can be proved by simp but this is shorter and more natural @[simp high] theorem iterate_one : f^[1] = f := funext fun _ ↦ rfl #align function.iterate_one Function.iterate_one theorem iterate_mul (m : ℕ) : ∀ n, f^[m * n] = f^[m]^[n] | 0 => by simp only [Nat.mul_zero, iterate_zero] | n + 1 => by simp only [Nat.mul_succ, Nat.mul_one, iterate_one, iterate_add, iterate_mul m n] #align function.iterate_mul Function.iterate_mul variable {f} theorem iterate_fixed {x} (h : f x = x) (n : ℕ) : f^[n] x = x := Nat.recOn n rfl fun n ihn ↦ by rw [iterate_succ_apply, h, ihn] #align function.iterate_fixed Function.iterate_fixed theorem Injective.iterate (Hinj : Injective f) (n : ℕ) : Injective f^[n] := Nat.recOn n injective_id fun _ ihn ↦ ihn.comp Hinj #align function.injective.iterate Function.Injective.iterate theorem Surjective.iterate (Hsurj : Surjective f) (n : ℕ) : Surjective f^[n] := Nat.recOn n surjective_id fun _ ihn ↦ ihn.comp Hsurj #align function.surjective.iterate Function.Surjective.iterate theorem Bijective.iterate (Hbij : Bijective f) (n : ℕ) : Bijective f^[n] := ⟨Hbij.1.iterate n, Hbij.2.iterate n⟩ #align function.bijective.iterate Function.Bijective.iterate namespace Semiconj theorem iterate_right {f : α → β} {ga : α → α} {gb : β → β} (h : Semiconj f ga gb) (n : ℕ) : Semiconj f ga^[n] gb^[n] := Nat.recOn n id_right fun _ ihn ↦ ihn.comp_right h #align function.semiconj.iterate_right Function.Semiconj.iterate_right
Mathlib/Logic/Function/Iterate.lean
121
129
theorem iterate_left {g : ℕ → α → α} (H : ∀ n, Semiconj f (g n) (g <| n + 1)) (n k : ℕ) : Semiconj f^[n] (g k) (g <| n + k) := by
induction n generalizing k with | zero => rw [Nat.zero_add] exact id_left | succ n ihn => rw [Nat.add_right_comm, Nat.add_assoc] exact (H k).trans (ihn (k + 1))
import Mathlib.MeasureTheory.Measure.Typeclasses open scoped ENNReal namespace MeasureTheory variable {α : Type*} noncomputable def Measure.trim {m m0 : MeasurableSpace α} (μ : @Measure α m0) (hm : m ≤ m0) : @Measure α m := @OuterMeasure.toMeasure α m μ.toOuterMeasure (hm.trans (le_toOuterMeasure_caratheodory μ)) #align measure_theory.measure.trim MeasureTheory.Measure.trim @[simp] theorem trim_eq_self [MeasurableSpace α] {μ : Measure α} : μ.trim le_rfl = μ := by simp [Measure.trim] #align measure_theory.trim_eq_self MeasureTheory.trim_eq_self variable {m m0 : MeasurableSpace α} {μ : Measure α} {s : Set α} theorem toOuterMeasure_trim_eq_trim_toOuterMeasure (μ : Measure α) (hm : m ≤ m0) : @Measure.toOuterMeasure _ m (μ.trim hm) = @OuterMeasure.trim _ m μ.toOuterMeasure := by rw [Measure.trim, toMeasure_toOuterMeasure (ms := m)] #align measure_theory.to_outer_measure_trim_eq_trim_to_outer_measure MeasureTheory.toOuterMeasure_trim_eq_trim_toOuterMeasure @[simp] theorem zero_trim (hm : m ≤ m0) : (0 : Measure α).trim hm = (0 : @Measure α m) := by simp [Measure.trim, @OuterMeasure.toMeasure_zero _ m] #align measure_theory.zero_trim MeasureTheory.zero_trim theorem trim_measurableSet_eq (hm : m ≤ m0) (hs : @MeasurableSet α m s) : μ.trim hm s = μ s := by rw [Measure.trim, toMeasure_apply (ms := m) _ _ hs, Measure.coe_toOuterMeasure] #align measure_theory.trim_measurable_set_eq MeasureTheory.trim_measurableSet_eq theorem le_trim (hm : m ≤ m0) : μ s ≤ μ.trim hm s := by simp_rw [Measure.trim] exact @le_toMeasure_apply _ m _ _ _ #align measure_theory.le_trim MeasureTheory.le_trim theorem measure_eq_zero_of_trim_eq_zero (hm : m ≤ m0) (h : μ.trim hm s = 0) : μ s = 0 := le_antisymm ((le_trim hm).trans (le_of_eq h)) (zero_le _) #align measure_theory.measure_eq_zero_of_trim_eq_zero MeasureTheory.measure_eq_zero_of_trim_eq_zero theorem measure_trim_toMeasurable_eq_zero {hm : m ≤ m0} (hs : μ.trim hm s = 0) : μ (@toMeasurable α m (μ.trim hm) s) = 0 := measure_eq_zero_of_trim_eq_zero hm (by rwa [@measure_toMeasurable _ m]) #align measure_theory.measure_trim_to_measurable_eq_zero MeasureTheory.measure_trim_toMeasurable_eq_zero theorem ae_of_ae_trim (hm : m ≤ m0) {μ : Measure α} {P : α → Prop} (h : ∀ᵐ x ∂μ.trim hm, P x) : ∀ᵐ x ∂μ, P x := measure_eq_zero_of_trim_eq_zero hm h #align measure_theory.ae_of_ae_trim MeasureTheory.ae_of_ae_trim theorem ae_eq_of_ae_eq_trim {E} {hm : m ≤ m0} {f₁ f₂ : α → E} (h12 : f₁ =ᵐ[μ.trim hm] f₂) : f₁ =ᵐ[μ] f₂ := measure_eq_zero_of_trim_eq_zero hm h12 #align measure_theory.ae_eq_of_ae_eq_trim MeasureTheory.ae_eq_of_ae_eq_trim theorem ae_le_of_ae_le_trim {E} [LE E] {hm : m ≤ m0} {f₁ f₂ : α → E} (h12 : f₁ ≤ᵐ[μ.trim hm] f₂) : f₁ ≤ᵐ[μ] f₂ := measure_eq_zero_of_trim_eq_zero hm h12 #align measure_theory.ae_le_of_ae_le_trim MeasureTheory.ae_le_of_ae_le_trim theorem trim_trim {m₁ m₂ : MeasurableSpace α} {hm₁₂ : m₁ ≤ m₂} {hm₂ : m₂ ≤ m0} : (μ.trim hm₂).trim hm₁₂ = μ.trim (hm₁₂.trans hm₂) := by refine @Measure.ext _ m₁ _ _ (fun t ht => ?_) rw [trim_measurableSet_eq hm₁₂ ht, trim_measurableSet_eq (hm₁₂.trans hm₂) ht, trim_measurableSet_eq hm₂ (hm₁₂ t ht)] #align measure_theory.trim_trim MeasureTheory.trim_trim theorem restrict_trim (hm : m ≤ m0) (μ : Measure α) (hs : @MeasurableSet α m s) : @Measure.restrict α m (μ.trim hm) s = (μ.restrict s).trim hm := by refine @Measure.ext _ m _ _ (fun t ht => ?_) rw [@Measure.restrict_apply α m _ _ _ ht, trim_measurableSet_eq hm ht, Measure.restrict_apply (hm t ht), trim_measurableSet_eq hm (@MeasurableSet.inter α m t s ht hs)] #align measure_theory.restrict_trim MeasureTheory.restrict_trim instance isFiniteMeasure_trim (hm : m ≤ m0) [IsFiniteMeasure μ] : IsFiniteMeasure (μ.trim hm) where measure_univ_lt_top := by rw [trim_measurableSet_eq hm (@MeasurableSet.univ _ m)] exact measure_lt_top _ _ #align measure_theory.is_finite_measure_trim MeasureTheory.isFiniteMeasure_trim
Mathlib/MeasureTheory/Measure/Trim.lean
107
121
theorem sigmaFiniteTrim_mono {m m₂ m0 : MeasurableSpace α} {μ : Measure α} (hm : m ≤ m0) (hm₂ : m₂ ≤ m) [SigmaFinite (μ.trim (hm₂.trans hm))] : SigmaFinite (μ.trim hm) := by
refine ⟨⟨?_⟩⟩ refine { set := spanningSets (μ.trim (hm₂.trans hm)) set_mem := fun _ => Set.mem_univ _ finite := fun i => ?_ spanning := iUnion_spanningSets _ } calc (μ.trim hm) (spanningSets (μ.trim (hm₂.trans hm)) i) = ((μ.trim hm).trim hm₂) (spanningSets (μ.trim (hm₂.trans hm)) i) := by rw [@trim_measurableSet_eq α m₂ m (μ.trim hm) _ hm₂ (measurable_spanningSets _ _)] _ = (μ.trim (hm₂.trans hm)) (spanningSets (μ.trim (hm₂.trans hm)) i) := by rw [@trim_trim _ _ μ _ _ hm₂ hm] _ < ∞ := measure_spanningSets_lt_top _ _
import Mathlib.Algebra.Order.Field.Pi import Mathlib.Algebra.Order.UpperLower import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Data.Real.Sqrt import Mathlib.Topology.Algebra.Order.UpperLower import Mathlib.Topology.MetricSpace.Sequences #align_import analysis.normed.order.upper_lower from "leanprover-community/mathlib"@"b1abe23ae96fef89ad30d9f4362c307f72a55010" open Bornology Function Metric Set open scoped Pointwise variable {α ι : Type*} section Finite variable [Finite ι] {s : Set (ι → ℝ)} {x y : ι → ℝ} theorem IsUpperSet.mem_interior_of_forall_lt (hs : IsUpperSet s) (hx : x ∈ closure s) (h : ∀ i, x i < y i) : y ∈ interior s := by cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, z i < y i := by refine fun i => (hxy _).trans_le' (sub_le_iff_le_add'.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm'] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((lt_sub_iff_add_lt.2 <| hyz _).trans (hw _ <| mem_univ _).1).le #align is_upper_set.mem_interior_of_forall_lt IsUpperSet.mem_interior_of_forall_lt
Mathlib/Analysis/Normed/Order/UpperLower.lean
112
128
theorem IsLowerSet.mem_interior_of_forall_lt (hs : IsLowerSet s) (hx : x ∈ closure s) (h : ∀ i, y i < x i) : y ∈ interior s := by
cases nonempty_fintype ι obtain ⟨ε, hε, hxy⟩ := Pi.exists_forall_pos_add_lt h obtain ⟨z, hz, hxz⟩ := Metric.mem_closure_iff.1 hx _ hε rw [dist_pi_lt_iff hε] at hxz have hyz : ∀ i, y i < z i := by refine fun i => (lt_sub_iff_add_lt.2 <| hxy _).trans_le (sub_le_comm.1 <| (le_abs_self _).trans ?_) rw [← Real.norm_eq_abs, ← dist_eq_norm] exact (hxz _).le obtain ⟨δ, hδ, hyz⟩ := Pi.exists_forall_pos_add_lt hyz refine mem_interior.2 ⟨ball y δ, ?_, isOpen_ball, mem_ball_self hδ⟩ rintro w hw refine hs (fun i => ?_) hz simp_rw [ball_pi _ hδ, Real.ball_eq_Ioo] at hw exact ((hw _ <| mem_univ _).2.trans <| hyz _).le
import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.Hom.Set #align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" open Set namespace OrderIso section Preorder variable {α β : Type*} [Preorder α] [Preorder β] @[simp] theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by ext x simp [← e.le_iff_le] #align order_iso.preimage_Iic OrderIso.preimage_Iic @[simp] theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by ext x simp [← e.le_iff_le] #align order_iso.preimage_Ici OrderIso.preimage_Ici @[simp] theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by ext x simp [← e.lt_iff_lt] #align order_iso.preimage_Iio OrderIso.preimage_Iio @[simp] theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by ext x simp [← e.lt_iff_lt] #align order_iso.preimage_Ioi OrderIso.preimage_Ioi @[simp] theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by simp [← Ici_inter_Iic] #align order_iso.preimage_Icc OrderIso.preimage_Icc @[simp] theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by simp [← Ici_inter_Iio] #align order_iso.preimage_Ico OrderIso.preimage_Ico @[simp] theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by simp [← Ioi_inter_Iic] #align order_iso.preimage_Ioc OrderIso.preimage_Ioc @[simp] theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by simp [← Ioi_inter_Iio] #align order_iso.preimage_Ioo OrderIso.preimage_Ioo @[simp] theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm] #align order_iso.image_Iic OrderIso.image_Iic @[simp] theorem image_Ici (e : α ≃o β) (a : α) : e '' Ici a = Ici (e a) := e.dual.image_Iic a #align order_iso.image_Ici OrderIso.image_Ici @[simp] theorem image_Iio (e : α ≃o β) (a : α) : e '' Iio a = Iio (e a) := by rw [e.image_eq_preimage, e.symm.preimage_Iio, e.symm_symm] #align order_iso.image_Iio OrderIso.image_Iio @[simp] theorem image_Ioi (e : α ≃o β) (a : α) : e '' Ioi a = Ioi (e a) := e.dual.image_Iio a #align order_iso.image_Ioi OrderIso.image_Ioi @[simp] theorem image_Ioo (e : α ≃o β) (a b : α) : e '' Ioo a b = Ioo (e a) (e b) := by rw [e.image_eq_preimage, e.symm.preimage_Ioo, e.symm_symm] #align order_iso.image_Ioo OrderIso.image_Ioo @[simp]
Mathlib/Order/Interval/Set/OrderIso.lean
93
94
theorem image_Ioc (e : α ≃o β) (a b : α) : e '' Ioc a b = Ioc (e a) (e b) := by
rw [e.image_eq_preimage, e.symm.preimage_Ioc, e.symm_symm]
import Mathlib.Data.Set.Pointwise.SMul #align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P, VSub G P where [nonempty : Nonempty P] vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁ vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g #align add_torsor AddTorsor -- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet attribute [instance 100] AddTorsor.nonempty -- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet --attribute [nolint dangerous_instance] AddTorsor.toVSub -- Porting note(#12096): linter not ported yet --@[nolint instance_priority] instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where vsub := Sub.sub vsub_vadd' := sub_add_cancel vadd_vsub' := add_sub_cancel_right #align add_group_is_add_torsor addGroupIsAddTorsor @[simp] theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ := rfl #align vsub_eq_sub vsub_eq_sub section General variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P] @[simp] theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ := AddTorsor.vsub_vadd' p₁ p₂ #align vsub_vadd vsub_vadd @[simp] theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g := AddTorsor.vadd_vsub' g p #align vadd_vsub vadd_vsub theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by -- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p rw [← vadd_vsub g₁ p, h, vadd_vsub] #align vadd_right_cancel vadd_right_cancel @[simp] theorem vadd_right_cancel_iff {g₁ g₂ : G} (p : P) : g₁ +ᵥ p = g₂ +ᵥ p ↔ g₁ = g₂ := ⟨vadd_right_cancel p, fun h => h ▸ rfl⟩ #align vadd_right_cancel_iff vadd_right_cancel_iff theorem vadd_right_injective (p : P) : Function.Injective ((· +ᵥ p) : G → P) := fun _ _ => vadd_right_cancel p #align vadd_right_injective vadd_right_injective theorem vadd_vsub_assoc (g : G) (p₁ p₂ : P) : g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂) := by apply vadd_right_cancel p₂ rw [vsub_vadd, add_vadd, vsub_vadd] #align vadd_vsub_assoc vadd_vsub_assoc @[simp] theorem vsub_self (p : P) : p -ᵥ p = (0 : G) := by rw [← zero_add (p -ᵥ p), ← vadd_vsub_assoc, vadd_vsub] #align vsub_self vsub_self theorem eq_of_vsub_eq_zero {p₁ p₂ : P} (h : p₁ -ᵥ p₂ = (0 : G)) : p₁ = p₂ := by rw [← vsub_vadd p₁ p₂, h, zero_vadd] #align eq_of_vsub_eq_zero eq_of_vsub_eq_zero @[simp] theorem vsub_eq_zero_iff_eq {p₁ p₂ : P} : p₁ -ᵥ p₂ = (0 : G) ↔ p₁ = p₂ := Iff.intro eq_of_vsub_eq_zero fun h => h ▸ vsub_self _ #align vsub_eq_zero_iff_eq vsub_eq_zero_iff_eq theorem vsub_ne_zero {p q : P} : p -ᵥ q ≠ (0 : G) ↔ p ≠ q := not_congr vsub_eq_zero_iff_eq #align vsub_ne_zero vsub_ne_zero @[simp] theorem vsub_add_vsub_cancel (p₁ p₂ p₃ : P) : p₁ -ᵥ p₂ + (p₂ -ᵥ p₃) = p₁ -ᵥ p₃ := by apply vadd_right_cancel p₃ rw [add_vadd, vsub_vadd, vsub_vadd, vsub_vadd] #align vsub_add_vsub_cancel vsub_add_vsub_cancel @[simp] theorem neg_vsub_eq_vsub_rev (p₁ p₂ : P) : -(p₁ -ᵥ p₂) = p₂ -ᵥ p₁ := by refine neg_eq_of_add_eq_zero_right (vadd_right_cancel p₁ ?_) rw [vsub_add_vsub_cancel, vsub_self] #align neg_vsub_eq_vsub_rev neg_vsub_eq_vsub_rev
Mathlib/Algebra/AddTorsor.lean
159
160
theorem vadd_vsub_eq_sub_vsub (g : G) (p q : P) : g +ᵥ p -ᵥ q = g - (q -ᵥ p) := by
rw [vadd_vsub_assoc, sub_eq_add_neg, neg_vsub_eq_vsub_rev]
import Mathlib.Data.List.OfFn import Mathlib.Data.List.Range #align_import data.list.fin_range from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" universe u namespace List variable {α : Type u} @[simp] theorem map_coe_finRange (n : ℕ) : ((finRange n) : List (Fin n)).map (Fin.val) = List.range n := by simp_rw [finRange, map_pmap, pmap_eq_map] exact List.map_id _ #align list.map_coe_fin_range List.map_coe_finRange theorem finRange_succ_eq_map (n : ℕ) : finRange n.succ = 0 :: (finRange n).map Fin.succ := by apply map_injective_iff.mpr Fin.val_injective rw [map_cons, map_coe_finRange, range_succ_eq_map, Fin.val_zero, ← map_coe_finRange, map_map, map_map] simp only [Function.comp, Fin.val_succ] #align list.fin_range_succ_eq_map List.finRange_succ_eq_map
Mathlib/Data/List/FinRange.lean
37
40
theorem finRange_succ (n : ℕ) : finRange n.succ = (finRange n |>.map Fin.castSucc |>.concat (.last _)) := by
apply map_injective_iff.mpr Fin.val_injective simp [range_succ, Function.comp_def]