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.SetTheory.Ordinal.Arithmetic import Mathlib.Tactic.Abel #align_import set_theory.ordinal.natural_ops from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7" set_option autoImplicit true universe u v open Function Order noncomputable section def NatOrdinal : Type _ := -- Porting note: used to derive LinearOrder & SuccOrder but need to manually define Ordinal deriving Zero, Inhabited, One, WellFoundedRelation #align nat_ordinal NatOrdinal instance NatOrdinal.linearOrder : LinearOrder NatOrdinal := {Ordinal.linearOrder with} instance NatOrdinal.succOrder : SuccOrder NatOrdinal := {Ordinal.succOrder with} @[match_pattern] def Ordinal.toNatOrdinal : Ordinal ≃o NatOrdinal := OrderIso.refl _ #align ordinal.to_nat_ordinal Ordinal.toNatOrdinal @[match_pattern] def NatOrdinal.toOrdinal : NatOrdinal ≃o Ordinal := OrderIso.refl _ #align nat_ordinal.to_ordinal NatOrdinal.toOrdinal namespace Ordinal variable {a b c : Ordinal.{u}} @[simp] theorem toNatOrdinal_symm_eq : toNatOrdinal.symm = NatOrdinal.toOrdinal := rfl #align ordinal.to_nat_ordinal_symm_eq Ordinal.toNatOrdinal_symm_eq @[simp] theorem toNatOrdinal_toOrdinal (a : Ordinal) : NatOrdinal.toOrdinal (toNatOrdinal a) = a := rfl #align ordinal.to_nat_ordinal_to_ordinal Ordinal.toNatOrdinal_toOrdinal @[simp] theorem toNatOrdinal_zero : toNatOrdinal 0 = 0 := rfl #align ordinal.to_nat_ordinal_zero Ordinal.toNatOrdinal_zero @[simp] theorem toNatOrdinal_one : toNatOrdinal 1 = 1 := rfl #align ordinal.to_nat_ordinal_one Ordinal.toNatOrdinal_one @[simp] theorem toNatOrdinal_eq_zero (a) : toNatOrdinal a = 0 ↔ a = 0 := Iff.rfl #align ordinal.to_nat_ordinal_eq_zero Ordinal.toNatOrdinal_eq_zero @[simp] theorem toNatOrdinal_eq_one (a) : toNatOrdinal a = 1 ↔ a = 1 := Iff.rfl #align ordinal.to_nat_ordinal_eq_one Ordinal.toNatOrdinal_eq_one @[simp] theorem toNatOrdinal_max (a b : Ordinal) : toNatOrdinal (max a b) = max (toNatOrdinal a) (toNatOrdinal b) := rfl #align ordinal.to_nat_ordinal_max Ordinal.toNatOrdinal_max @[simp] theorem toNatOrdinal_min (a b : Ordinal) : toNatOrdinal (linearOrder.min a b) = linearOrder.min (toNatOrdinal a) (toNatOrdinal b) := rfl #align ordinal.to_nat_ordinal_min Ordinal.toNatOrdinal_min noncomputable def nadd : Ordinal → Ordinal → Ordinal | a, b => max (blsub.{u, u} a fun a' _ => nadd a' b) (blsub.{u, u} b fun b' _ => nadd a b') termination_by o₁ o₂ => (o₁, o₂) #align ordinal.nadd Ordinal.nadd @[inherit_doc] scoped[NaturalOps] infixl:65 " ♯ " => Ordinal.nadd open NaturalOps noncomputable def nmul : Ordinal.{u} → Ordinal.{u} → Ordinal.{u} | a, b => sInf {c | ∀ a' < a, ∀ b' < b, nmul a' b ♯ nmul a b' < c ♯ nmul a' b'} termination_by a b => (a, b) #align ordinal.nmul Ordinal.nmul @[inherit_doc] scoped[NaturalOps] infixl:70 " ⨳ " => Ordinal.nmul theorem nadd_def (a b : Ordinal) : a ♯ b = max (blsub.{u, u} a fun a' _ => a' ♯ b) (blsub.{u, u} b fun b' _ => a ♯ b') := by rw [nadd] #align ordinal.nadd_def Ordinal.nadd_def theorem lt_nadd_iff : a < b ♯ c ↔ (∃ b' < b, a ≤ b' ♯ c) ∨ ∃ c' < c, a ≤ b ♯ c' := by rw [nadd_def] simp [lt_blsub_iff] #align ordinal.lt_nadd_iff Ordinal.lt_nadd_iff theorem nadd_le_iff : b ♯ c ≤ a ↔ (∀ b' < b, b' ♯ c < a) ∧ ∀ c' < c, b ♯ c' < a := by rw [nadd_def] simp [blsub_le_iff] #align ordinal.nadd_le_iff Ordinal.nadd_le_iff theorem nadd_lt_nadd_left (h : b < c) (a) : a ♯ b < a ♯ c := lt_nadd_iff.2 (Or.inr ⟨b, h, le_rfl⟩) #align ordinal.nadd_lt_nadd_left Ordinal.nadd_lt_nadd_left theorem nadd_lt_nadd_right (h : b < c) (a) : b ♯ a < c ♯ a := lt_nadd_iff.2 (Or.inl ⟨b, h, le_rfl⟩) #align ordinal.nadd_lt_nadd_right Ordinal.nadd_lt_nadd_right theorem nadd_le_nadd_left (h : b ≤ c) (a) : a ♯ b ≤ a ♯ c := by rcases lt_or_eq_of_le h with (h | rfl) · exact (nadd_lt_nadd_left h a).le · exact le_rfl #align ordinal.nadd_le_nadd_left Ordinal.nadd_le_nadd_left
Mathlib/SetTheory/Ordinal/NaturalOps.lean
261
264
theorem nadd_le_nadd_right (h : b ≤ c) (a) : b ♯ a ≤ c ♯ a := by
rcases lt_or_eq_of_le h with (h | rfl) · exact (nadd_lt_nadd_right h a).le · exact le_rfl
import Mathlib.Data.Matrix.Basic import Mathlib.Data.PEquiv #align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1" namespace PEquiv open Matrix universe u v variable {k l m n : Type*} variable {α : Type v} open Matrix def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α := of fun i j => if j ∈ f i then (1 : α) else 0 #align pequiv.to_matrix PEquiv.toMatrix -- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024 @[simp] theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) : toMatrix f i j = if j ∈ f i then (1 : α) else 0 := rfl #align pequiv.to_matrix_apply PEquiv.toMatrix_apply theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α) (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by dsimp [toMatrix, Matrix.mul_apply] cases' h : f i with fi · simp [h] · rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm] #align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by ext simp only [transpose, mem_iff_mem f, toMatrix_apply] congr #align pequiv.to_matrix_symm PEquiv.toMatrix_symm @[simp]
Mathlib/Data/Matrix/PEquiv.lean
78
81
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] : ((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by
ext simp [toMatrix_apply, one_apply]
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho import Mathlib.LinearAlgebra.Orientation #align_import analysis.inner_product_space.orientation from "leanprover-community/mathlib"@"bd65478311e4dfd41f48bf38c7e3b02fb75d0163" noncomputable section variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] open FiniteDimensional open scoped RealInnerProductSpace namespace OrthonormalBasis variable {ι : Type*} [Fintype ι] [DecidableEq ι] [ne : Nonempty ι] (e f : OrthonormalBasis ι ℝ E) (x : Orientation ℝ E ι) theorem det_to_matrix_orthonormalBasis_of_same_orientation (h : e.toBasis.orientation = f.toBasis.orientation) : e.toBasis.det f = 1 := by apply (e.det_to_matrix_orthonormalBasis_real f).resolve_right have : 0 < e.toBasis.det f := by rw [e.toBasis.orientation_eq_iff_det_pos] at h simpa using h linarith #align orthonormal_basis.det_to_matrix_orthonormal_basis_of_same_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_same_orientation theorem det_to_matrix_orthonormalBasis_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det f = -1 := by contrapose! h simp [e.toBasis.orientation_eq_iff_det_pos, (e.det_to_matrix_orthonormalBasis_real f).resolve_right h] #align orthonormal_basis.det_to_matrix_orthonormal_basis_of_opposite_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_opposite_orientation variable {e f} theorem same_orientation_iff_det_eq_det : e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by constructor · intro h dsimp [Basis.orientation] congr · intro h rw [e.toBasis.det.eq_smul_basis_det f.toBasis] simp [e.det_to_matrix_orthonormalBasis_of_same_orientation f h] #align orthonormal_basis.same_orientation_iff_det_eq_det OrthonormalBasis.same_orientation_iff_det_eq_det variable (e f) theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det = -f.toBasis.det := by rw [e.toBasis.det.eq_smul_basis_det f.toBasis] -- Porting note: added `neg_one_smul` with explicit type simp [e.det_to_matrix_orthonormalBasis_of_opposite_orientation f h, neg_one_smul ℝ (M := E [⋀^ι]→ₗ[ℝ] ℝ)] #align orthonormal_basis.det_eq_neg_det_of_opposite_orientation OrthonormalBasis.det_eq_neg_det_of_opposite_orientation section AdjustToOrientation theorem orthonormal_adjustToOrientation : Orthonormal ℝ (e.toBasis.adjustToOrientation x) := by apply e.orthonormal.orthonormal_of_forall_eq_or_eq_neg simpa using e.toBasis.adjustToOrientation_apply_eq_or_eq_neg x #align orthonormal_basis.orthonormal_adjust_to_orientation OrthonormalBasis.orthonormal_adjustToOrientation def adjustToOrientation : OrthonormalBasis ι ℝ E := (e.toBasis.adjustToOrientation x).toOrthonormalBasis (e.orthonormal_adjustToOrientation x) #align orthonormal_basis.adjust_to_orientation OrthonormalBasis.adjustToOrientation theorem toBasis_adjustToOrientation : (e.adjustToOrientation x).toBasis = e.toBasis.adjustToOrientation x := (e.toBasis.adjustToOrientation x).toBasis_toOrthonormalBasis _ #align orthonormal_basis.to_basis_adjust_to_orientation OrthonormalBasis.toBasis_adjustToOrientation @[simp]
Mathlib/Analysis/InnerProductSpace/Orientation.lean
122
124
theorem orientation_adjustToOrientation : (e.adjustToOrientation x).toBasis.orientation = x := by
rw [e.toBasis_adjustToOrientation] exact e.toBasis.orientation_adjustToOrientation x
import Mathlib.Algebra.CharP.Invertible import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.AddTorsor import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.normed_space.add_torsor from "leanprover-community/mathlib"@"837f72de63ad6cd96519cde5f1ffd5ed8d280ad0" noncomputable section open NNReal Topology open Filter variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P] [NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q] section NormedSpace variable {𝕜 : Type*} [NormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W] open AffineMap theorem AffineSubspace.isClosed_direction_iff (s : AffineSubspace 𝕜 Q) : IsClosed (s.direction : Set W) ↔ IsClosed (s : Set Q) := by rcases s.eq_bot_or_nonempty with (rfl | ⟨x, hx⟩); · simp [isClosed_singleton] rw [← (IsometryEquiv.vaddConst x).toHomeomorph.symm.isClosed_image, AffineSubspace.coe_direction_eq_vsub_set_right hx] rfl #align affine_subspace.is_closed_direction_iff AffineSubspace.isClosed_direction_iff @[simp]
Mathlib/Analysis/NormedSpace/AddTorsor.lean
45
47
theorem dist_center_homothety (p₁ p₂ : P) (c : 𝕜) : dist p₁ (homothety p₁ c p₂) = ‖c‖ * dist p₁ p₂ := by
simp [homothety_def, norm_smul, ← dist_eq_norm_vsub, dist_comm]
import Mathlib.Data.List.Basic #align_import data.list.forall2 from "leanprover-community/mathlib"@"5a3e819569b0f12cbec59d740a2613018e7b8eec" open Nat Function namespace List variable {α β γ δ : Type*} {R S : α → β → Prop} {P : γ → δ → Prop} {Rₐ : α → α → Prop} open Relator mk_iff_of_inductive_prop List.Forall₂ List.forall₂_iff #align list.forall₂_iff List.forall₂_iff #align list.forall₂.nil List.Forall₂.nil #align list.forall₂.cons List.Forall₂.cons #align list.forall₂_cons List.forall₂_cons
Mathlib/Data/List/Forall2.lean
34
35
theorem Forall₂.imp (H : ∀ a b, R a b → S a b) {l₁ l₂} (h : Forall₂ R l₁ l₂) : Forall₂ S l₁ l₂ := by
induction h <;> constructor <;> solve_by_elim
import Mathlib.NumberTheory.NumberField.Embeddings #align_import number_theory.number_field.units from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField noncomputable section open NumberField Units variable (K : Type*) [Field K] namespace NumberField.Units section coe instance : CoeHTC (𝓞 K)ˣ K := ⟨fun x => algebraMap _ K (Units.val x)⟩ theorem coe_injective : Function.Injective ((↑) : (𝓞 K)ˣ → K) := RingOfIntegers.coe_injective.comp Units.ext variable {K} theorem coe_coe (u : (𝓞 K)ˣ) : ((u : 𝓞 K) : K) = (u : K) := rfl theorem coe_mul (x y : (𝓞 K)ˣ) : ((x * y : (𝓞 K)ˣ) : K) = (x : K) * (y : K) := rfl theorem coe_pow (x : (𝓞 K)ˣ) (n : ℕ) : ((x ^ n : (𝓞 K)ˣ) : K) = (x : K) ^ n := by rw [← map_pow, ← val_pow_eq_pow_val]
Mathlib/NumberTheory/NumberField/Units/Basic.lean
81
83
theorem coe_zpow (x : (𝓞 K)ˣ) (n : ℤ) : (↑(x ^ n) : K) = (x : K) ^ n := by
change ((Units.coeHom K).comp (map (algebraMap (𝓞 K) K))) (x ^ n) = _ exact map_zpow _ x n
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import geometry.euclidean.angle.unoriented.basic from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" assert_not_exists HasFDerivAt assert_not_exists ConformalAt noncomputable section open Real Set open Real open RealInnerProductSpace namespace InnerProductGeometry variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] {x y : V} def angle (x y : V) : ℝ := Real.arccos (⟪x, y⟫ / (‖x‖ * ‖y‖)) #align inner_product_geometry.angle InnerProductGeometry.angle theorem continuousAt_angle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) : ContinuousAt (fun y : V × V => angle y.1 y.2) x := Real.continuous_arccos.continuousAt.comp <| continuous_inner.continuousAt.div ((continuous_norm.comp continuous_fst).mul (continuous_norm.comp continuous_snd)).continuousAt (by simp [hx1, hx2]) #align inner_product_geometry.continuous_at_angle InnerProductGeometry.continuousAt_angle theorem angle_smul_smul {c : ℝ} (hc : c ≠ 0) (x y : V) : angle (c • x) (c • y) = angle x y := by have : c * c ≠ 0 := mul_ne_zero hc hc rw [angle, angle, real_inner_smul_left, inner_smul_right, norm_smul, norm_smul, Real.norm_eq_abs, mul_mul_mul_comm _ ‖x‖, abs_mul_abs_self, ← mul_assoc c c, mul_div_mul_left _ _ this] #align inner_product_geometry.angle_smul_smul InnerProductGeometry.angle_smul_smul @[simp] theorem _root_.LinearIsometry.angle_map {E F : Type*} [NormedAddCommGroup E] [NormedAddCommGroup F] [InnerProductSpace ℝ E] [InnerProductSpace ℝ F] (f : E →ₗᵢ[ℝ] F) (u v : E) : angle (f u) (f v) = angle u v := by rw [angle, angle, f.inner_map_map, f.norm_map, f.norm_map] #align linear_isometry.angle_map LinearIsometry.angle_map @[simp, norm_cast] theorem _root_.Submodule.angle_coe {s : Submodule ℝ V} (x y : s) : angle (x : V) (y : V) = angle x y := s.subtypeₗᵢ.angle_map x y #align submodule.angle_coe Submodule.angle_coe theorem cos_angle (x y : V) : Real.cos (angle x y) = ⟪x, y⟫ / (‖x‖ * ‖y‖) := Real.cos_arccos (abs_le.mp (abs_real_inner_div_norm_mul_norm_le_one x y)).1 (abs_le.mp (abs_real_inner_div_norm_mul_norm_le_one x y)).2 #align inner_product_geometry.cos_angle InnerProductGeometry.cos_angle theorem angle_comm (x y : V) : angle x y = angle y x := by unfold angle rw [real_inner_comm, mul_comm] #align inner_product_geometry.angle_comm InnerProductGeometry.angle_comm @[simp] theorem angle_neg_neg (x y : V) : angle (-x) (-y) = angle x y := by unfold angle rw [inner_neg_neg, norm_neg, norm_neg] #align inner_product_geometry.angle_neg_neg InnerProductGeometry.angle_neg_neg theorem angle_nonneg (x y : V) : 0 ≤ angle x y := Real.arccos_nonneg _ #align inner_product_geometry.angle_nonneg InnerProductGeometry.angle_nonneg theorem angle_le_pi (x y : V) : angle x y ≤ π := Real.arccos_le_pi _ #align inner_product_geometry.angle_le_pi InnerProductGeometry.angle_le_pi theorem angle_neg_right (x y : V) : angle x (-y) = π - angle x y := by unfold angle rw [← Real.arccos_neg, norm_neg, inner_neg_right, neg_div] #align inner_product_geometry.angle_neg_right InnerProductGeometry.angle_neg_right theorem angle_neg_left (x y : V) : angle (-x) y = π - angle x y := by rw [← angle_neg_neg, neg_neg, angle_neg_right] #align inner_product_geometry.angle_neg_left InnerProductGeometry.angle_neg_left proof_wanted angle_triangle (x y z : V) : angle x z ≤ angle x y + angle y z @[simp]
Mathlib/Geometry/Euclidean/Angle/Unoriented/Basic.lean
120
122
theorem angle_zero_left (x : V) : angle 0 x = π / 2 := by
unfold angle rw [inner_zero_left, zero_div, Real.arccos_zero]
import Mathlib.Algebra.Group.Units.Equiv import Mathlib.CategoryTheory.Endomorphism #align_import category_theory.conj from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" universe v u namespace CategoryTheory namespace Iso variable {C : Type u} [Category.{v} C] def homCongr {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) : (X ⟶ Y) ≃ (X₁ ⟶ Y₁) where toFun f := α.inv ≫ f ≫ β.hom invFun f := α.hom ≫ f ≫ β.inv left_inv f := show α.hom ≫ (α.inv ≫ f ≫ β.hom) ≫ β.inv = f by rw [Category.assoc, Category.assoc, β.hom_inv_id, α.hom_inv_id_assoc, Category.comp_id] right_inv f := show α.inv ≫ (α.hom ≫ f ≫ β.inv) ≫ β.hom = f by rw [Category.assoc, Category.assoc, β.inv_hom_id, α.inv_hom_id_assoc, Category.comp_id] #align category_theory.iso.hom_congr CategoryTheory.Iso.homCongr -- @[simp, nolint simpNF] Porting note (#10675): dsimp can not prove this @[simp] theorem homCongr_apply {X Y X₁ Y₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (f : X ⟶ Y) : α.homCongr β f = α.inv ≫ f ≫ β.hom := by rfl #align category_theory.iso.hom_congr_apply CategoryTheory.Iso.homCongr_apply theorem homCongr_comp {X Y Z X₁ Y₁ Z₁ : C} (α : X ≅ X₁) (β : Y ≅ Y₁) (γ : Z ≅ Z₁) (f : X ⟶ Y) (g : Y ⟶ Z) : α.homCongr γ (f ≫ g) = α.homCongr β f ≫ β.homCongr γ g := by simp #align category_theory.iso.hom_congr_comp CategoryTheory.Iso.homCongr_comp theorem homCongr_refl {X Y : C} (f : X ⟶ Y) : (Iso.refl X).homCongr (Iso.refl Y) f = f := by simp #align category_theory.iso.hom_congr_refl CategoryTheory.Iso.homCongr_refl
Mathlib/CategoryTheory/Conj.lean
64
66
theorem homCongr_trans {X₁ Y₁ X₂ Y₂ X₃ Y₃ : C} (α₁ : X₁ ≅ X₂) (β₁ : Y₁ ≅ Y₂) (α₂ : X₂ ≅ X₃) (β₂ : Y₂ ≅ Y₃) (f : X₁ ⟶ Y₁) : (α₁ ≪≫ α₂).homCongr (β₁ ≪≫ β₂) f = (α₁.homCongr β₁).trans (α₂.homCongr β₂) f := by
simp
import Mathlib.CategoryTheory.Monad.Types import Mathlib.CategoryTheory.Monad.Limits import Mathlib.CategoryTheory.Equivalence import Mathlib.Topology.Category.CompHaus.Basic import Mathlib.Topology.Category.Profinite.Basic import Mathlib.Data.Set.Constructions #align_import topology.category.Compactum from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" -- Porting note: "Compactum" is already upper case set_option linter.uppercaseLean3 false universe u open CategoryTheory Filter Ultrafilter TopologicalSpace CategoryTheory.Limits FiniteInter open scoped Classical open Topology local notation "β" => ofTypeMonad Ultrafilter def Compactum := Monad.Algebra β deriving Category, Inhabited #align Compactum Compactum namespace Compactum def forget : Compactum ⥤ Type* := Monad.forget _ --deriving CreatesLimits, Faithful -- Porting note: deriving fails, adding manually. Note `CreatesLimits` now noncomputable #align Compactum.forget Compactum.forget instance : forget.Faithful := show (Monad.forget _).Faithful from inferInstance noncomputable instance : CreatesLimits forget := show CreatesLimits <| Monad.forget _ from inferInstance def free : Type* ⥤ Compactum := Monad.free _ #align Compactum.free Compactum.free def adj : free ⊣ forget := Monad.adj _ #align Compactum.adj Compactum.adj -- Basic instances instance : ConcreteCategory Compactum where forget := forget -- Porting note: changed from forget to X.A instance : CoeSort Compactum Type* := ⟨fun X => X.A⟩ instance {X Y : Compactum} : CoeFun (X ⟶ Y) fun _ => X → Y := ⟨fun f => f.f⟩ instance : HasLimits Compactum := hasLimits_of_hasLimits_createsLimits forget def str (X : Compactum) : Ultrafilter X → X := X.a #align Compactum.str Compactum.str def join (X : Compactum) : Ultrafilter (Ultrafilter X) → Ultrafilter X := (β ).μ.app _ #align Compactum.join Compactum.join def incl (X : Compactum) : X → Ultrafilter X := (β ).η.app _ #align Compactum.incl Compactum.incl @[simp]
Mathlib/Topology/Category/Compactum.lean
143
146
theorem str_incl (X : Compactum) (x : X) : X.str (X.incl x) = x := by
change ((β ).η.app _ ≫ X.a) _ = _ rw [Monad.Algebra.unit] rfl
import Mathlib.GroupTheory.Solvable import Mathlib.FieldTheory.PolynomialGaloisGroup import Mathlib.RingTheory.RootsOfUnity.Basic #align_import field_theory.abel_ruffini from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a" noncomputable section open scoped Classical Polynomial IntermediateField open Polynomial IntermediateField section AbelRuffini variable {F : Type*} [Field F] {E : Type*} [Field E] [Algebra F E] theorem gal_zero_isSolvable : IsSolvable (0 : F[X]).Gal := by infer_instance #align gal_zero_is_solvable gal_zero_isSolvable theorem gal_one_isSolvable : IsSolvable (1 : F[X]).Gal := by infer_instance #align gal_one_is_solvable gal_one_isSolvable theorem gal_C_isSolvable (x : F) : IsSolvable (C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_C_is_solvable gal_C_isSolvable theorem gal_X_isSolvable : IsSolvable (X : F[X]).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_is_solvable gal_X_isSolvable theorem gal_X_sub_C_isSolvable (x : F) : IsSolvable (X - C x).Gal := by infer_instance set_option linter.uppercaseLean3 false in #align gal_X_sub_C_is_solvable gal_X_sub_C_isSolvable
Mathlib/FieldTheory/AbelRuffini.lean
57
57
theorem gal_X_pow_isSolvable (n : ℕ) : IsSolvable (X ^ n : F[X]).Gal := by
infer_instance
import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import geometry.euclidean.angle.unoriented.basic from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5" assert_not_exists HasFDerivAt assert_not_exists ConformalAt noncomputable section open Real Set open Real open RealInnerProductSpace namespace InnerProductGeometry variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] {x y : V} def angle (x y : V) : ℝ := Real.arccos (⟪x, y⟫ / (‖x‖ * ‖y‖)) #align inner_product_geometry.angle InnerProductGeometry.angle theorem continuousAt_angle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) : ContinuousAt (fun y : V × V => angle y.1 y.2) x := Real.continuous_arccos.continuousAt.comp <| continuous_inner.continuousAt.div ((continuous_norm.comp continuous_fst).mul (continuous_norm.comp continuous_snd)).continuousAt (by simp [hx1, hx2]) #align inner_product_geometry.continuous_at_angle InnerProductGeometry.continuousAt_angle
Mathlib/Geometry/Euclidean/Angle/Unoriented/Basic.lean
57
60
theorem angle_smul_smul {c : ℝ} (hc : c ≠ 0) (x y : V) : angle (c • x) (c • y) = angle x y := by
have : c * c ≠ 0 := mul_ne_zero hc hc rw [angle, angle, real_inner_smul_left, inner_smul_right, norm_smul, norm_smul, Real.norm_eq_abs, mul_mul_mul_comm _ ‖x‖, abs_mul_abs_self, ← mul_assoc c c, mul_div_mul_left _ _ this]
import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Algebra.Order.BigOperators.Group.List import Mathlib.Data.Set.Pointwise.SMul import Mathlib.Order.WellFoundedSet #align_import group_theory.submonoid.pointwise from "leanprover-community/mathlib"@"2bbc7e3884ba234309d2a43b19144105a753292e" open Set Pointwise variable {α : Type*} {G : Type*} {M : Type*} {R : Type*} {A : Type*} variable [Monoid M] [AddMonoid A] namespace Submonoid variable {s t u : Set M} @[to_additive] theorem mul_subset {S : Submonoid M} (hs : s ⊆ S) (ht : t ⊆ S) : s * t ⊆ S := mul_subset_iff.2 fun _x hx _y hy ↦ mul_mem (hs hx) (ht hy) #align submonoid.mul_subset Submonoid.mul_subset #align add_submonoid.add_subset AddSubmonoid.add_subset @[to_additive] theorem mul_subset_closure (hs : s ⊆ u) (ht : t ⊆ u) : s * t ⊆ Submonoid.closure u := mul_subset (Subset.trans hs Submonoid.subset_closure) (Subset.trans ht Submonoid.subset_closure) #align submonoid.mul_subset_closure Submonoid.mul_subset_closure #align add_submonoid.add_subset_closure AddSubmonoid.add_subset_closure @[to_additive]
Mathlib/Algebra/Group/Submonoid/Pointwise.lean
72
76
theorem coe_mul_self_eq (s : Submonoid M) : (s : Set M) * s = s := by
ext x refine ⟨?_, fun h => ⟨x, h, 1, s.one_mem, mul_one x⟩⟩ rintro ⟨a, ha, b, hb, rfl⟩ exact s.mul_mem ha hb
import Mathlib.Data.PFunctor.Multivariate.Basic #align_import data.qpf.multivariate.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" universe u open MvFunctor class MvQPF {n : ℕ} (F : TypeVec.{u} n → Type*) [MvFunctor F] where P : MvPFunctor.{u} n abs : ∀ {α}, P α → F α repr : ∀ {α}, F α → P α abs_repr : ∀ {α} (x : F α), abs (repr x) = x abs_map : ∀ {α β} (f : α ⟹ β) (p : P α), abs (f <$$> p) = f <$$> abs p #align mvqpf MvQPF namespace MvQPF variable {n : ℕ} {F : TypeVec.{u} n → Type*} [MvFunctor F] [q : MvQPF F] open MvFunctor (LiftP LiftR) protected theorem id_map {α : TypeVec n} (x : F α) : TypeVec.id <$$> x = x := by rw [← abs_repr x] cases' repr x with a f rw [← abs_map] rfl #align mvqpf.id_map MvQPF.id_map @[simp]
Mathlib/Data/QPF/Multivariate/Basic.lean
112
117
theorem comp_map {α β γ : TypeVec n} (f : α ⟹ β) (g : β ⟹ γ) (x : F α) : (g ⊚ f) <$$> x = g <$$> f <$$> x := by
rw [← abs_repr x] cases' repr x with a f rw [← abs_map, ← abs_map, ← abs_map] rfl
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating import Mathlib.Data.Rat.Floor #align_import algebra.continued_fractions.computation.terminates_iff_rat from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace GeneralizedContinuedFraction open GeneralizedContinuedFraction (of) variable {K : Type*} [LinearOrderedField K] [FloorRing K] attribute [local simp] Pair.map IntFractPair.mapFr section RatOfTerminates variable (v : K) (n : ℕ) nonrec theorem exists_gcf_pair_rat_eq_of_nth_conts_aux : ∃ conts : Pair ℚ, (of v).continuantsAux n = (conts.map (↑) : Pair K) := Nat.strong_induction_on n (by clear n let g := of v intro n IH rcases n with (_ | _ | n) -- n = 0 · suffices ∃ gp : Pair ℚ, Pair.mk (1 : K) 0 = gp.map (↑) by simpa [continuantsAux] use Pair.mk 1 0 simp -- n = 1 · suffices ∃ conts : Pair ℚ, Pair.mk g.h 1 = conts.map (↑) by simpa [continuantsAux] use Pair.mk ⌊v⌋ 1 simp [g] -- 2 ≤ n · cases' IH (n + 1) <| lt_add_one (n + 1) with pred_conts pred_conts_eq -- invoke the IH cases' s_ppred_nth_eq : g.s.get? n with gp_n -- option.none · use pred_conts have : g.continuantsAux (n + 2) = g.continuantsAux (n + 1) := continuantsAux_stable_of_terminated (n + 1).le_succ s_ppred_nth_eq simp only [this, pred_conts_eq] -- option.some · -- invoke the IH a second time cases' IH n <| lt_of_le_of_lt n.le_succ <| lt_add_one <| n + 1 with ppred_conts ppred_conts_eq obtain ⟨a_eq_one, z, b_eq_z⟩ : gp_n.a = 1 ∧ ∃ z : ℤ, gp_n.b = (z : K) := of_part_num_eq_one_and_exists_int_part_denom_eq s_ppred_nth_eq -- finally, unfold the recurrence to obtain the required rational value. simp only [a_eq_one, b_eq_z, continuantsAux_recurrence s_ppred_nth_eq ppred_conts_eq pred_conts_eq] use nextContinuants 1 (z : ℚ) ppred_conts pred_conts cases ppred_conts; cases pred_conts simp [nextContinuants, nextNumerator, nextDenominator]) #align generalized_continued_fraction.exists_gcf_pair_rat_eq_of_nth_conts_aux GeneralizedContinuedFraction.exists_gcf_pair_rat_eq_of_nth_conts_aux
Mathlib/Algebra/ContinuedFractions/Computation/TerminatesIffRat.lean
101
103
theorem exists_gcf_pair_rat_eq_nth_conts : ∃ conts : Pair ℚ, (of v).continuants n = (conts.map (↑) : Pair K) := by
rw [nth_cont_eq_succ_nth_cont_aux]; exact exists_gcf_pair_rat_eq_of_nth_conts_aux v <| n + 1
import Mathlib.Analysis.InnerProductSpace.Adjoint import Mathlib.Topology.Algebra.Module.Basic #align_import analysis.inner_product_space.linear_pmap from "leanprover-community/mathlib"@"8b981918a93bc45a8600de608cde7944a80d92b9" noncomputable section open RCLike open scoped ComplexConjugate Classical variable {𝕜 E F G : Type*} [RCLike 𝕜] variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y namespace LinearPMap def IsFormalAdjoint (T : E →ₗ.[𝕜] F) (S : F →ₗ.[𝕜] E) : Prop := ∀ (x : T.domain) (y : S.domain), ⟪T x, y⟫ = ⟪(x : E), S y⟫ #align linear_pmap.is_formal_adjoint LinearPMap.IsFormalAdjoint variable {T : E →ₗ.[𝕜] F} {S : F →ₗ.[𝕜] E} @[symm] protected theorem IsFormalAdjoint.symm (h : T.IsFormalAdjoint S) : S.IsFormalAdjoint T := fun y _ => by rw [← inner_conj_symm, ← inner_conj_symm (y : F), h] #align linear_pmap.is_formal_adjoint.symm LinearPMap.IsFormalAdjoint.symm variable (T) def adjointDomain : Submodule 𝕜 F where carrier := {y | Continuous ((innerₛₗ 𝕜 y).comp T.toFun)} zero_mem' := by rw [Set.mem_setOf_eq, LinearMap.map_zero, LinearMap.zero_comp] exact continuous_zero add_mem' hx hy := by rw [Set.mem_setOf_eq, LinearMap.map_add] at *; exact hx.add hy smul_mem' a x hx := by rw [Set.mem_setOf_eq, LinearMap.map_smulₛₗ] at * exact hx.const_smul (conj a) #align linear_pmap.adjoint_domain LinearPMap.adjointDomain def adjointDomainMkCLM (y : T.adjointDomain) : T.domain →L[𝕜] 𝕜 := ⟨(innerₛₗ 𝕜 (y : F)).comp T.toFun, y.prop⟩ #align linear_pmap.adjoint_domain_mk_clm LinearPMap.adjointDomainMkCLM theorem adjointDomainMkCLM_apply (y : T.adjointDomain) (x : T.domain) : adjointDomainMkCLM T y x = ⟪(y : F), T x⟫ := rfl #align linear_pmap.adjoint_domain_mk_clm_apply LinearPMap.adjointDomainMkCLM_apply variable {T} variable (hT : Dense (T.domain : Set E)) def adjointDomainMkCLMExtend (y : T.adjointDomain) : E →L[𝕜] 𝕜 := (T.adjointDomainMkCLM y).extend (Submodule.subtypeL T.domain) hT.denseRange_val uniformEmbedding_subtype_val.toUniformInducing #align linear_pmap.adjoint_domain_mk_clm_extend LinearPMap.adjointDomainMkCLMExtend @[simp] theorem adjointDomainMkCLMExtend_apply (y : T.adjointDomain) (x : T.domain) : adjointDomainMkCLMExtend hT y (x : E) = ⟪(y : F), T x⟫ := ContinuousLinearMap.extend_eq _ _ _ _ _ #align linear_pmap.adjoint_domain_mk_clm_extend_apply LinearPMap.adjointDomainMkCLMExtend_apply variable [CompleteSpace E] def adjointAux : T.adjointDomain →ₗ[𝕜] E where toFun y := (InnerProductSpace.toDual 𝕜 E).symm (adjointDomainMkCLMExtend hT y) map_add' x y := hT.eq_of_inner_left fun _ => by simp only [inner_add_left, Submodule.coe_add, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] map_smul' _ _ := hT.eq_of_inner_left fun _ => by simp only [inner_smul_left, Submodule.coe_smul_of_tower, RingHom.id_apply, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] #align linear_pmap.adjoint_aux LinearPMap.adjointAux theorem adjointAux_inner (y : T.adjointDomain) (x : T.domain) : ⟪adjointAux hT y, x⟫ = ⟪(y : F), T x⟫ := by simp only [adjointAux, LinearMap.coe_mk, InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply] -- Porting note(https://github.com/leanprover-community/mathlib4/issues/5026): -- mathlib3 was finished here simp only [AddHom.coe_mk, InnerProductSpace.toDual_symm_apply] rw [adjointDomainMkCLMExtend_apply] #align linear_pmap.adjoint_aux_inner LinearPMap.adjointAux_inner theorem adjointAux_unique (y : T.adjointDomain) {x₀ : E} (hx₀ : ∀ x : T.domain, ⟪x₀, x⟫ = ⟪(y : F), T x⟫) : adjointAux hT y = x₀ := hT.eq_of_inner_left fun v => (adjointAux_inner hT _ _).trans (hx₀ v).symm #align linear_pmap.adjoint_aux_unique LinearPMap.adjointAux_unique variable (T) def adjoint : F →ₗ.[𝕜] E where domain := T.adjointDomain toFun := if hT : Dense (T.domain : Set E) then adjointAux hT else 0 #align linear_pmap.adjoint LinearPMap.adjoint scoped postfix:1024 "†" => LinearPMap.adjoint theorem mem_adjoint_domain_iff (y : F) : y ∈ T†.domain ↔ Continuous ((innerₛₗ 𝕜 y).comp T.toFun) := Iff.rfl #align linear_pmap.mem_adjoint_domain_iff LinearPMap.mem_adjoint_domain_iff variable {T}
Mathlib/Analysis/InnerProductSpace/LinearPMap.lean
171
178
theorem mem_adjoint_domain_of_exists (y : F) (h : ∃ w : E, ∀ x : T.domain, ⟪w, x⟫ = ⟪y, T x⟫) : y ∈ T†.domain := by
cases' h with w hw rw [T.mem_adjoint_domain_iff] -- Porting note: was `by continuity` have : Continuous ((innerSL 𝕜 w).comp T.domain.subtypeL) := ContinuousLinearMap.continuous _ convert this using 1 exact funext fun x => (hw x).symm
import Mathlib.Topology.Perfect import Mathlib.Topology.MetricSpace.Polish import Mathlib.Topology.MetricSpace.CantorScheme #align_import topology.perfect from "leanprover-community/mathlib"@"3905fa80e62c0898131285baab35559fbc4e5cda" open Set Filter section CantorInjMetric open Function ENNReal variable {α : Type*} [MetricSpace α] {C : Set α} (hC : Perfect C) {ε : ℝ≥0∞} private theorem Perfect.small_diam_aux (ε_pos : 0 < ε) {x : α} (xC : x ∈ C) : let D := closure (EMetric.ball x (ε / 2) ∩ C) Perfect D ∧ D.Nonempty ∧ D ⊆ C ∧ EMetric.diam D ≤ ε := by have : x ∈ EMetric.ball x (ε / 2) := by apply EMetric.mem_ball_self rw [ENNReal.div_pos_iff] exact ⟨ne_of_gt ε_pos, by norm_num⟩ have := hC.closure_nhds_inter x xC this EMetric.isOpen_ball refine ⟨this.1, this.2, ?_, ?_⟩ · rw [IsClosed.closure_subset_iff hC.closed] apply inter_subset_right rw [EMetric.diam_closure] apply le_trans (EMetric.diam_mono inter_subset_left) convert EMetric.diam_ball (x := x) rw [mul_comm, ENNReal.div_mul_cancel] <;> norm_num variable (hnonempty : C.Nonempty)
Mathlib/Topology/MetricSpace/Perfect.lean
62
73
theorem Perfect.small_diam_splitting (ε_pos : 0 < ε) : ∃ C₀ C₁ : Set α, (Perfect C₀ ∧ C₀.Nonempty ∧ C₀ ⊆ C ∧ EMetric.diam C₀ ≤ ε) ∧ (Perfect C₁ ∧ C₁.Nonempty ∧ C₁ ⊆ C ∧ EMetric.diam C₁ ≤ ε) ∧ Disjoint C₀ C₁ := by
rcases hC.splitting hnonempty with ⟨D₀, D₁, ⟨perf0, non0, sub0⟩, ⟨perf1, non1, sub1⟩, hdisj⟩ cases' non0 with x₀ hx₀ cases' non1 with x₁ hx₁ rcases perf0.small_diam_aux ε_pos hx₀ with ⟨perf0', non0', sub0', diam0⟩ rcases perf1.small_diam_aux ε_pos hx₁ with ⟨perf1', non1', sub1', diam1⟩ refine ⟨closure (EMetric.ball x₀ (ε / 2) ∩ D₀), closure (EMetric.ball x₁ (ε / 2) ∩ D₁), ⟨perf0', non0', sub0'.trans sub0, diam0⟩, ⟨perf1', non1', sub1'.trans sub1, diam1⟩, ?_⟩ apply Disjoint.mono _ _ hdisj <;> assumption
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic import Mathlib.MeasureTheory.Integral.MeanInequalities #align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9" open Filter open scoped ENNReal Topology namespace MeasureTheory variable {α E : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] {p : ℝ≥0∞} {q : ℝ} {μ : Measure α} {f g : α → E} theorem snorm'_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hq1 : 1 ≤ q) : snorm' (f + g) q μ ≤ snorm' f q μ + snorm' g q μ := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ snorm' f q μ + snorm' g q μ := ENNReal.lintegral_Lp_add_le hf.ennnorm hg.ennnorm hq1 #align measure_theory.snorm'_add_le MeasureTheory.snorm'_add_le theorem snorm'_add_le_of_le_one {f g : α → E} (hf : AEStronglyMeasurable f μ) (hq0 : 0 ≤ q) (hq1 : q ≤ 1) : snorm' (f + g) q μ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := calc (∫⁻ a, (‖(f + g) a‖₊ : ℝ≥0∞) ^ q ∂μ) ^ (1 / q) ≤ (∫⁻ a, ((fun a => (‖f a‖₊ : ℝ≥0∞)) + fun a => (‖g a‖₊ : ℝ≥0∞)) a ^ q ∂μ) ^ (1 / q) := by gcongr with a simp only [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe, nnnorm_add_le] _ ≤ (2 : ℝ≥0∞) ^ (1 / q - 1) * (snorm' f q μ + snorm' g q μ) := ENNReal.lintegral_Lp_add_le_of_le_one hf.ennnorm hq0 hq1 #align measure_theory.snorm'_add_le_of_le_one MeasureTheory.snorm'_add_le_of_le_one theorem snormEssSup_add_le {f g : α → E} : snormEssSup (f + g) μ ≤ snormEssSup f μ + snormEssSup g μ := by refine le_trans (essSup_mono_ae (eventually_of_forall fun x => ?_)) (ENNReal.essSup_add_le _ _) simp_rw [Pi.add_apply, ← ENNReal.coe_add, ENNReal.coe_le_coe] exact nnnorm_add_le _ _ #align measure_theory.snorm_ess_sup_add_le MeasureTheory.snormEssSup_add_le theorem snorm_add_le {f g : α → E} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hp1 : 1 ≤ p) : snorm (f + g) p μ ≤ snorm f p μ + snorm g p μ := by by_cases hp0 : p = 0 · simp [hp0] by_cases hp_top : p = ∞ · simp [hp_top, snormEssSup_add_le] have hp1_real : 1 ≤ p.toReal := by rwa [← ENNReal.one_toReal, ENNReal.toReal_le_toReal ENNReal.one_ne_top hp_top] repeat rw [snorm_eq_snorm' hp0 hp_top] exact snorm'_add_le hf hg hp1_real #align measure_theory.snorm_add_le MeasureTheory.snorm_add_le noncomputable def LpAddConst (p : ℝ≥0∞) : ℝ≥0∞ := if p ∈ Set.Ioo (0 : ℝ≥0∞) 1 then (2 : ℝ≥0∞) ^ (1 / p.toReal - 1) else 1 set_option linter.uppercaseLean3 false in #align measure_theory.Lp_add_const MeasureTheory.LpAddConst
Mathlib/MeasureTheory/Function/LpSeminorm/TriangleInequality.lean
73
76
theorem LpAddConst_of_one_le {p : ℝ≥0∞} (hp : 1 ≤ p) : LpAddConst p = 1 := by
rw [LpAddConst, if_neg] intro h exact lt_irrefl _ (h.2.trans_le hp)
import Mathlib.Data.Real.Basic #align_import data.real.sign from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace Real noncomputable def sign (r : ℝ) : ℝ := if r < 0 then -1 else if 0 < r then 1 else 0 #align real.sign Real.sign theorem sign_of_neg {r : ℝ} (hr : r < 0) : sign r = -1 := by rw [sign, if_pos hr] #align real.sign_of_neg Real.sign_of_neg theorem sign_of_pos {r : ℝ} (hr : 0 < r) : sign r = 1 := by rw [sign, if_pos hr, if_neg hr.not_lt] #align real.sign_of_pos Real.sign_of_pos @[simp] theorem sign_zero : sign 0 = 0 := by rw [sign, if_neg (lt_irrefl _), if_neg (lt_irrefl _)] #align real.sign_zero Real.sign_zero @[simp] theorem sign_one : sign 1 = 1 := sign_of_pos <| by norm_num #align real.sign_one Real.sign_one
Mathlib/Data/Real/Sign.lean
51
55
theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 := by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ) · exact Or.inl <| sign_of_neg hn · exact Or.inr <| Or.inl <| sign_zero · exact Or.inr <| Or.inr <| sign_of_pos hp
import Mathlib.Topology.ExtendFrom import Mathlib.Topology.Order.DenselyOrdered #align_import topology.algebra.order.extend_from from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977" set_option autoImplicit true open Filter Set TopologicalSpace open scoped Classical open Topology theorem continuousOn_Icc_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α] [OrderTopology α] [TopologicalSpace β] [RegularSpace β] {f : α → β} {a b : α} {la lb : β} (hab : a ≠ b) (hf : ContinuousOn f (Ioo a b)) (ha : Tendsto f (𝓝[>] a) (𝓝 la)) (hb : Tendsto f (𝓝[<] b) (𝓝 lb)) : ContinuousOn (extendFrom (Ioo a b) f) (Icc a b) := by apply continuousOn_extendFrom · rw [closure_Ioo hab] · intro x x_in rcases eq_endpoints_or_mem_Ioo_of_mem_Icc x_in with (rfl | rfl | h) · exact ⟨la, ha.mono_left <| nhdsWithin_mono _ Ioo_subset_Ioi_self⟩ · exact ⟨lb, hb.mono_left <| nhdsWithin_mono _ Ioo_subset_Iio_self⟩ · exact ⟨f x, hf x h⟩ #align continuous_on_Icc_extend_from_Ioo continuousOn_Icc_extendFrom_Ioo
Mathlib/Topology/Order/ExtendFrom.lean
36
42
theorem eq_lim_at_left_extendFrom_Ioo [TopologicalSpace α] [LinearOrder α] [DenselyOrdered α] [OrderTopology α] [TopologicalSpace β] [T2Space β] {f : α → β} {a b : α} {la : β} (hab : a < b) (ha : Tendsto f (𝓝[>] a) (𝓝 la)) : extendFrom (Ioo a b) f a = la := by
apply extendFrom_eq · rw [closure_Ioo hab.ne] simp only [le_of_lt hab, left_mem_Icc, right_mem_Icc] · simpa [hab]
import Mathlib.Algebra.BigOperators.WithTop import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Data.ENNReal.Basic #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} section OperationsAndInfty variable {α : Type*} @[simp] theorem add_eq_top : a + b = ∞ ↔ a = ∞ ∨ b = ∞ := WithTop.add_eq_top #align ennreal.add_eq_top ENNReal.add_eq_top @[simp] theorem add_lt_top : a + b < ∞ ↔ a < ∞ ∧ b < ∞ := WithTop.add_lt_top #align ennreal.add_lt_top ENNReal.add_lt_top theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) : (r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by lift r₁ to ℝ≥0 using h₁ lift r₂ to ℝ≥0 using h₂ rfl #align ennreal.to_nnreal_add ENNReal.toNNReal_add theorem not_lt_top {x : ℝ≥0∞} : ¬x < ∞ ↔ x = ∞ := by rw [lt_top_iff_ne_top, Classical.not_not] #align ennreal.not_lt_top ENNReal.not_lt_top
Mathlib/Data/ENNReal/Operations.lean
203
203
theorem add_ne_top : a + b ≠ ∞ ↔ a ≠ ∞ ∧ b ≠ ∞ := by
simpa only [lt_top_iff_ne_top] using add_lt_top
import Mathlib.Analysis.SpecialFunctions.Complex.Arg import Mathlib.Analysis.SpecialFunctions.Log.Basic #align_import analysis.special_functions.complex.log from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section namespace Complex open Set Filter Bornology open scoped Real Topology ComplexConjugate -- Porting note: @[pp_nodot] does not exist in mathlib4 noncomputable def log (x : ℂ) : ℂ := x.abs.log + arg x * I #align complex.log Complex.log theorem log_re (x : ℂ) : x.log.re = x.abs.log := by simp [log] #align complex.log_re Complex.log_re theorem log_im (x : ℂ) : x.log.im = x.arg := by simp [log] #align complex.log_im Complex.log_im
Mathlib/Analysis/SpecialFunctions/Complex/Log.lean
39
39
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by
simp only [log_im, neg_pi_lt_arg]
import Mathlib.Algebra.Polynomial.Derivative import Mathlib.Algebra.Polynomial.Roots import Mathlib.RingTheory.EuclideanDomain #align_import data.polynomial.field_division from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821" noncomputable section open Polynomial namespace Polynomial universe u v w y z variable {R : Type u} {S : Type v} {k : Type y} {A : Type z} {a b : R} {n : ℕ} section CommRing variable [CommRing R] theorem rootMultiplicity_sub_one_le_derivative_rootMultiplicity_of_ne_zero (p : R[X]) (t : R) (hnezero : derivative p ≠ 0) : p.rootMultiplicity t - 1 ≤ p.derivative.rootMultiplicity t := (le_rootMultiplicity_iff hnezero).2 <| pow_sub_one_dvd_derivative_of_pow_dvd (p.pow_rootMultiplicity_dvd t) theorem derivative_rootMultiplicity_of_root_of_mem_nonZeroDivisors {p : R[X]} {t : R} (hpt : Polynomial.IsRoot p t) (hnzd : (p.rootMultiplicity t : R) ∈ nonZeroDivisors R) : (derivative p).rootMultiplicity t = p.rootMultiplicity t - 1 := by by_cases h : p = 0 · simp only [h, map_zero, rootMultiplicity_zero] obtain ⟨g, hp, hndvd⟩ := p.exists_eq_pow_rootMultiplicity_mul_and_not_dvd h t set m := p.rootMultiplicity t have hm : m - 1 + 1 = m := Nat.sub_add_cancel <| (rootMultiplicity_pos h).2 hpt have hndvd : ¬(X - C t) ^ m ∣ derivative p := by rw [hp, derivative_mul, dvd_add_left (dvd_mul_right _ _), derivative_X_sub_C_pow, ← hm, pow_succ, hm, mul_comm (C _), mul_assoc, dvd_cancel_left_mem_nonZeroDivisors (monic_X_sub_C t |>.pow _ |>.mem_nonZeroDivisors)] rw [dvd_iff_isRoot, IsRoot] at hndvd ⊢ rwa [eval_mul, eval_C, mul_left_mem_nonZeroDivisors_eq_zero_iff hnzd] have hnezero : derivative p ≠ 0 := fun h ↦ hndvd (by rw [h]; exact dvd_zero _) exact le_antisymm (by rwa [rootMultiplicity_le_iff hnezero, hm]) (rootMultiplicity_sub_one_le_derivative_rootMultiplicity_of_ne_zero _ t hnezero) theorem isRoot_iterate_derivative_of_lt_rootMultiplicity {p : R[X]} {t : R} {n : ℕ} (hn : n < p.rootMultiplicity t) : (derivative^[n] p).IsRoot t := dvd_iff_isRoot.mp <| (dvd_pow_self _ <| Nat.sub_ne_zero_of_lt hn).trans (pow_sub_dvd_iterate_derivative_of_pow_dvd _ <| p.pow_rootMultiplicity_dvd t) open Finset in theorem eval_iterate_derivative_rootMultiplicity {p : R[X]} {t : R} : (derivative^[p.rootMultiplicity t] p).eval t = (p.rootMultiplicity t).factorial • (p /ₘ (X - C t) ^ p.rootMultiplicity t).eval t := by set m := p.rootMultiplicity t with hm conv_lhs => rw [← p.pow_mul_divByMonic_rootMultiplicity_eq t, ← hm] rw [iterate_derivative_mul, eval_finset_sum, sum_eq_single_of_mem _ (mem_range.mpr m.succ_pos)] · rw [m.choose_zero_right, one_smul, eval_mul, m.sub_zero, iterate_derivative_X_sub_pow_self, eval_natCast, nsmul_eq_mul]; rfl · intro b hb hb0 rw [iterate_derivative_X_sub_pow, eval_smul, eval_mul, eval_smul, eval_pow, Nat.sub_sub_self (mem_range_succ_iff.mp hb), eval_sub, eval_X, eval_C, sub_self, zero_pow hb0, smul_zero, zero_mul, smul_zero]
Mathlib/Algebra/Polynomial/FieldDivision.lean
78
89
theorem lt_rootMultiplicity_of_isRoot_iterate_derivative_of_mem_nonZeroDivisors {p : R[X]} {t : R} {n : ℕ} (h : p ≠ 0) (hroot : ∀ m ≤ n, (derivative^[m] p).IsRoot t) (hnzd : (n.factorial : R) ∈ nonZeroDivisors R) : n < p.rootMultiplicity t := by
by_contra! h' replace hroot := hroot _ h' simp only [IsRoot, eval_iterate_derivative_rootMultiplicity] at hroot obtain ⟨q, hq⟩ := Nat.cast_dvd_cast (α := R) <| Nat.factorial_dvd_factorial h' rw [hq, mul_mem_nonZeroDivisors] at hnzd rw [nsmul_eq_mul, mul_left_mem_nonZeroDivisors_eq_zero_iff hnzd.1] at hroot exact eval_divByMonic_pow_rootMultiplicity_ne_zero t h hroot
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Mul import Mathlib.Analysis.Calculus.Deriv.Shift import Mathlib.Analysis.Calculus.IteratedDeriv.Defs variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {R : Type*} [Semiring R] [Module R F] [SMulCommClass 𝕜 R F] [ContinuousConstSMul R F] {n : ℕ} {x : 𝕜} {s : Set 𝕜} (hx : x ∈ s) (h : UniqueDiffOn 𝕜 s) {f g : 𝕜 → F} theorem iteratedDerivWithin_add (hf : ContDiffOn 𝕜 n f s) (hg : ContDiffOn 𝕜 n g s) : iteratedDerivWithin n (f + g) s x = iteratedDerivWithin n f s x + iteratedDerivWithin n g s x := by simp_rw [iteratedDerivWithin, iteratedFDerivWithin_add_apply hf hg h hx, ContinuousMultilinearMap.add_apply] theorem iteratedDerivWithin_congr (hfg : Set.EqOn f g s) : Set.EqOn (iteratedDerivWithin n f s) (iteratedDerivWithin n g s) s := by induction n generalizing f g with | zero => rwa [iteratedDerivWithin_zero] | succ n IH => intro y hy have : UniqueDiffWithinAt 𝕜 s y := h.uniqueDiffWithinAt hy rw [iteratedDerivWithin_succ this, iteratedDerivWithin_succ this] exact derivWithin_congr (IH hfg) (IH hfg hy) theorem iteratedDerivWithin_const_add (hn : 0 < n) (c : F) : iteratedDerivWithin n (fun z => c + f z) s x = iteratedDerivWithin n f s x := by obtain ⟨n, rfl⟩ := n.exists_eq_succ_of_ne_zero hn.ne' rw [iteratedDerivWithin_succ' h hx, iteratedDerivWithin_succ' h hx] refine iteratedDerivWithin_congr h ?_ hx intro y hy exact derivWithin_const_add (h.uniqueDiffWithinAt hy) _ theorem iteratedDerivWithin_const_neg (hn : 0 < n) (c : F) : iteratedDerivWithin n (fun z => c - f z) s x = iteratedDerivWithin n (fun z => -f z) s x := by obtain ⟨n, rfl⟩ := n.exists_eq_succ_of_ne_zero hn.ne' rw [iteratedDerivWithin_succ' h hx, iteratedDerivWithin_succ' h hx] refine iteratedDerivWithin_congr h ?_ hx intro y hy have : UniqueDiffWithinAt 𝕜 s y := h.uniqueDiffWithinAt hy rw [derivWithin.neg this] exact derivWithin_const_sub this _ theorem iteratedDerivWithin_const_smul (c : R) (hf : ContDiffOn 𝕜 n f s) : iteratedDerivWithin n (c • f) s x = c • iteratedDerivWithin n f s x := by simp_rw [iteratedDerivWithin] rw [iteratedFDerivWithin_const_smul_apply hf h hx] simp only [ContinuousMultilinearMap.smul_apply]
Mathlib/Analysis/Calculus/IteratedDeriv/Lemmas.lean
64
66
theorem iteratedDerivWithin_const_mul (c : 𝕜) {f : 𝕜 → 𝕜} (hf : ContDiffOn 𝕜 n f s) : iteratedDerivWithin n (fun z => c * f z) s x = c * iteratedDerivWithin n f s x := by
simpa using iteratedDerivWithin_const_smul (F := 𝕜) hx h c hf
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α} {s t : Set α} namespace MeasureTheory section ENNReal variable (μ) {f g : α → ℝ≥0∞} noncomputable def laverage (f : α → ℝ≥0∞) := ∫⁻ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.laverage MeasureTheory.laverage notation3 "⨍⁻ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => laverage μ r notation3 "⨍⁻ "(...)", "r:60:(scoped f => laverage volume f) => r notation3 "⨍⁻ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => laverage (Measure.restrict μ s) r notation3 (prettyPrint := false) "⨍⁻ "(...)" in "s", "r:60:(scoped f => laverage Measure.restrict volume s f) => r @[simp] theorem laverage_zero : ⨍⁻ _x, (0 : ℝ≥0∞) ∂μ = 0 := by rw [laverage, lintegral_zero] #align measure_theory.laverage_zero MeasureTheory.laverage_zero @[simp] theorem laverage_zero_measure (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂(0 : Measure α) = 0 := by simp [laverage] #align measure_theory.laverage_zero_measure MeasureTheory.laverage_zero_measure theorem laverage_eq' (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂(μ univ)⁻¹ • μ := rfl #align measure_theory.laverage_eq' MeasureTheory.laverage_eq' theorem laverage_eq (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = (∫⁻ x, f x ∂μ) / μ univ := by rw [laverage_eq', lintegral_smul_measure, ENNReal.div_eq_inv_mul] #align measure_theory.laverage_eq MeasureTheory.laverage_eq theorem laverage_eq_lintegral [IsProbabilityMeasure μ] (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rw [laverage, measure_univ, inv_one, one_smul] #align measure_theory.laverage_eq_lintegral MeasureTheory.laverage_eq_lintegral @[simp] theorem measure_mul_laverage [IsFiniteMeasure μ] (f : α → ℝ≥0∞) : μ univ * ⨍⁻ x, f x ∂μ = ∫⁻ x, f x ∂μ := by rcases eq_or_ne μ 0 with hμ | hμ · rw [hμ, lintegral_zero_measure, laverage_zero_measure, mul_zero] · rw [laverage_eq, ENNReal.mul_div_cancel' (measure_univ_ne_zero.2 hμ) (measure_ne_top _ _)] #align measure_theory.measure_mul_laverage MeasureTheory.measure_mul_laverage
Mathlib/MeasureTheory/Integral/Average.lean
134
135
theorem setLaverage_eq (f : α → ℝ≥0∞) (s : Set α) : ⨍⁻ x in s, f x ∂μ = (∫⁻ x in s, f x ∂μ) / μ s := by
rw [laverage_eq, restrict_apply_univ]
import Mathlib.Geometry.Manifold.MFDeriv.Atlas noncomputable section open scoped Manifold open Set section UniqueMDiff variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] [SmoothManifoldWithCorners I' M'] {s : Set M} {x : M} theorem UniqueMDiffWithinAt.image_denseRange (hs : UniqueMDiffWithinAt I s x) {f : M → M'} {f' : E →L[𝕜] E'} (hf : HasMFDerivWithinAt I I' f s x f') (hd : DenseRange f') : UniqueMDiffWithinAt I' (f '' s) (f x) := by have := hs.inter' <| hf.1 (extChartAt_source_mem_nhds I' (f x)) refine (((hf.2.mono ?sub1).uniqueDiffWithinAt this hd).mono ?sub2).congr_pt ?pt case pt => simp only [mfld_simps] case sub1 => mfld_set_tac case sub2 => rintro _ ⟨y, ⟨⟨hys, hfy⟩, -⟩, rfl⟩ exact ⟨⟨_, hys, ((extChartAt I' (f x)).left_inv hfy).symm⟩, mem_range_self _⟩ theorem UniqueMDiffOn.image_denseRange' (hs : UniqueMDiffOn I s) {f : M → M'} {f' : M → E →L[𝕜] E'} (hf : ∀ x ∈ s, HasMFDerivWithinAt I I' f s x (f' x)) (hd : ∀ x ∈ s, DenseRange (f' x)) : UniqueMDiffOn I' (f '' s) := forall_mem_image.2 fun x hx ↦ (hs x hx).image_denseRange (hf x hx) (hd x hx) theorem UniqueMDiffOn.image_denseRange (hs : UniqueMDiffOn I s) {f : M → M'} (hf : MDifferentiableOn I I' f s) (hd : ∀ x ∈ s, DenseRange (mfderivWithin I I' f s x)) : UniqueMDiffOn I' (f '' s) := hs.image_denseRange' (fun x hx ↦ (hf x hx).hasMFDerivWithinAt) hd protected theorem UniqueMDiffWithinAt.preimage_partialHomeomorph (hs : UniqueMDiffWithinAt I s x) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') (hx : x ∈ e.source) : UniqueMDiffWithinAt I' (e.target ∩ e.symm ⁻¹' s) (e x) := by rw [← e.image_source_inter_eq', inter_comm] exact (hs.inter (e.open_source.mem_nhds hx)).image_denseRange (he.mdifferentiableAt hx).hasMFDerivAt.hasMFDerivWithinAt (he.mfderiv_surjective hx).denseRange theorem UniqueMDiffOn.uniqueMDiffOn_preimage (hs : UniqueMDiffOn I s) {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') : UniqueMDiffOn I' (e.target ∩ e.symm ⁻¹' s) := fun _x hx ↦ e.right_inv hx.1 ▸ (hs _ hx.2).preimage_partialHomeomorph he (e.map_target hx.1) #align unique_mdiff_on.unique_mdiff_on_preimage UniqueMDiffOn.uniqueMDiffOn_preimage theorem UniqueMDiffOn.uniqueDiffOn_target_inter (hs : UniqueMDiffOn I s) (x : M) : UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) := by -- this is just a reformulation of `UniqueMDiffOn.uniqueMDiffOn_preimage`, using as `e` -- the local chart at `x`. apply UniqueMDiffOn.uniqueDiffOn rw [← PartialEquiv.image_source_inter_eq', inter_comm, extChartAt_source] exact (hs.inter (chartAt H x).open_source).image_denseRange' (fun y hy ↦ hasMFDerivWithinAt_extChartAt I hy.2) fun y hy ↦ ((mdifferentiable_chart _ _).mfderiv_surjective hy.2).denseRange #align unique_mdiff_on.unique_diff_on_target_inter UniqueMDiffOn.uniqueDiffOn_target_inter theorem UniqueMDiffOn.uniqueDiffOn_inter_preimage (hs : UniqueMDiffOn I s) (x : M) (y : M') {f : M → M'} (hf : ContinuousOn f s) : UniqueDiffOn 𝕜 ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' (s ∩ f ⁻¹' (extChartAt I' y).source)) := haveI : UniqueMDiffOn I (s ∩ f ⁻¹' (extChartAt I' y).source) := by intro z hz apply (hs z hz.1).inter' apply (hf z hz.1).preimage_mem_nhdsWithin exact (isOpen_extChartAt_source I' y).mem_nhds hz.2 this.uniqueDiffOn_target_inter _ #align unique_mdiff_on.unique_diff_on_inter_preimage UniqueMDiffOn.uniqueDiffOn_inter_preimage open Bundle variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {Z : M → Type*} [TopologicalSpace (TotalSpace F Z)] [∀ b, TopologicalSpace (Z b)] [∀ b, AddCommMonoid (Z b)] [∀ b, Module 𝕜 (Z b)] [FiberBundle F Z] [VectorBundle 𝕜 F Z] [SmoothVectorBundle F Z I] theorem Trivialization.mdifferentiable (e : Trivialization F (π F Z)) [MemTrivializationAtlas e] : e.toPartialHomeomorph.MDifferentiable (I.prod 𝓘(𝕜, F)) (I.prod 𝓘(𝕜, F)) := ⟨(e.smoothOn I).mdifferentiableOn, (e.smoothOn_symm I).mdifferentiableOn⟩
Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean
120
131
theorem UniqueMDiffWithinAt.smooth_bundle_preimage {p : TotalSpace F Z} (hs : UniqueMDiffWithinAt I s p.proj) : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (π F Z ⁻¹' s) p := by
set e := trivializationAt F Z p.proj have hp : p ∈ e.source := FiberBundle.mem_trivializationAt_proj_source have : UniqueMDiffWithinAt (I.prod 𝓘(𝕜, F)) (s ×ˢ univ) (e p) := by rw [← Prod.mk.eta (p := e p), FiberBundle.trivializationAt_proj_fst] exact hs.prod (uniqueMDiffWithinAt_univ _) rw [← e.left_inv hp] refine (this.preimage_partialHomeomorph e.mdifferentiable.symm (e.map_source hp)).mono ?_ rintro y ⟨hy, hys, -⟩ rwa [PartialHomeomorph.symm_symm, e.coe_coe, e.coe_fst hy] at hys
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.Deriv.Slope import Mathlib.Analysis.NormedSpace.FiniteDimension import Mathlib.MeasureTheory.Constructions.BorelSpace.ContinuousLinearMap import Mathlib.MeasureTheory.Function.StronglyMeasurable.Basic #align_import analysis.calculus.fderiv_measurable from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" set_option linter.uppercaseLean3 false -- A B D noncomputable section open Set Metric Asymptotics Filter ContinuousLinearMap MeasureTheory TopologicalSpace open scoped Topology section fderiv variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {f : E → F} (K : Set (E →L[𝕜] F)) section RightDeriv variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] variable {f : ℝ → F} (K : Set F) namespace RightDerivMeasurableAux def A (f : ℝ → F) (L : F) (r ε : ℝ) : Set ℝ := { x | ∃ r' ∈ Ioc (r / 2) r, ∀ᵉ (y ∈ Icc x (x + r')) (z ∈ Icc x (x + r')), ‖f z - f y - (z - y) • L‖ ≤ ε * r } #align right_deriv_measurable_aux.A RightDerivMeasurableAux.A def B (f : ℝ → F) (K : Set F) (r s ε : ℝ) : Set ℝ := ⋃ L ∈ K, A f L r ε ∩ A f L s ε #align right_deriv_measurable_aux.B RightDerivMeasurableAux.B def D (f : ℝ → F) (K : Set F) : Set ℝ := ⋂ e : ℕ, ⋃ n : ℕ, ⋂ (p ≥ n) (q ≥ n), B f K ((1 / 2) ^ p) ((1 / 2) ^ q) ((1 / 2) ^ e) #align right_deriv_measurable_aux.D RightDerivMeasurableAux.D theorem A_mem_nhdsWithin_Ioi {L : F} {r ε x : ℝ} (hx : x ∈ A f L r ε) : A f L r ε ∈ 𝓝[>] x := by rcases hx with ⟨r', rr', hr'⟩ rw [mem_nhdsWithin_Ioi_iff_exists_Ioo_subset] obtain ⟨s, s_gt, s_lt⟩ : ∃ s : ℝ, r / 2 < s ∧ s < r' := exists_between rr'.1 have : s ∈ Ioc (r / 2) r := ⟨s_gt, le_of_lt (s_lt.trans_le rr'.2)⟩ refine ⟨x + r' - s, by simp only [mem_Ioi]; linarith, fun x' hx' => ⟨s, this, ?_⟩⟩ have A : Icc x' (x' + s) ⊆ Icc x (x + r') := by apply Icc_subset_Icc hx'.1.le linarith [hx'.2] intro y hy z hz exact hr' y (A hy) z (A hz) #align right_deriv_measurable_aux.A_mem_nhds_within_Ioi RightDerivMeasurableAux.A_mem_nhdsWithin_Ioi theorem B_mem_nhdsWithin_Ioi {K : Set F} {r s ε x : ℝ} (hx : x ∈ B f K r s ε) : B f K r s ε ∈ 𝓝[>] x := by obtain ⟨L, LK, hL₁, hL₂⟩ : ∃ L : F, L ∈ K ∧ x ∈ A f L r ε ∧ x ∈ A f L s ε := by simpa only [B, mem_iUnion, mem_inter_iff, exists_prop] using hx filter_upwards [A_mem_nhdsWithin_Ioi hL₁, A_mem_nhdsWithin_Ioi hL₂] with y hy₁ hy₂ simp only [B, mem_iUnion, mem_inter_iff, exists_prop] exact ⟨L, LK, hy₁, hy₂⟩ #align right_deriv_measurable_aux.B_mem_nhds_within_Ioi RightDerivMeasurableAux.B_mem_nhdsWithin_Ioi theorem measurableSet_B {K : Set F} {r s ε : ℝ} : MeasurableSet (B f K r s ε) := measurableSet_of_mem_nhdsWithin_Ioi fun _ hx => B_mem_nhdsWithin_Ioi hx #align right_deriv_measurable_aux.measurable_set_B RightDerivMeasurableAux.measurableSet_B
Mathlib/Analysis/Calculus/FDeriv/Measurable.lean
499
502
theorem A_mono (L : F) (r : ℝ) {ε δ : ℝ} (h : ε ≤ δ) : A f L r ε ⊆ A f L r δ := by
rintro x ⟨r', r'r, hr'⟩ refine ⟨r', r'r, fun y hy z hz => (hr' y hy z hz).trans (mul_le_mul_of_nonneg_right h ?_)⟩ linarith [hy.1, hy.2, r'r.2]
import Mathlib.Analysis.Calculus.FDeriv.Basic import Mathlib.Analysis.NormedSpace.BoundedLinearMaps #align_import analysis.calculus.fderiv.linear from "leanprover-community/mathlib"@"e3fb84046afd187b710170887195d50bada934ee" open Filter Asymptotics ContinuousLinearMap Set Metric open scoped Classical open Topology NNReal Filter Asymptotics ENNReal noncomputable section section variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G'] variable {f f₀ f₁ g : E → F} variable {f' f₀' f₁' g' : E →L[𝕜] F} variable (e : E →L[𝕜] F) variable {x : E} variable {s t : Set E} variable {L L₁ L₂ : Filter E} section ContinuousLinearMap @[fun_prop] protected theorem ContinuousLinearMap.hasStrictFDerivAt {x : E} : HasStrictFDerivAt e e x := (isLittleO_zero _ _).congr_left fun x => by simp only [e.map_sub, sub_self] #align continuous_linear_map.has_strict_fderiv_at ContinuousLinearMap.hasStrictFDerivAt protected theorem ContinuousLinearMap.hasFDerivAtFilter : HasFDerivAtFilter e e x L := .of_isLittleO <| (isLittleO_zero _ _).congr_left fun x => by simp only [e.map_sub, sub_self] #align continuous_linear_map.has_fderiv_at_filter ContinuousLinearMap.hasFDerivAtFilter @[fun_prop] protected theorem ContinuousLinearMap.hasFDerivWithinAt : HasFDerivWithinAt e e s x := e.hasFDerivAtFilter #align continuous_linear_map.has_fderiv_within_at ContinuousLinearMap.hasFDerivWithinAt @[fun_prop] protected theorem ContinuousLinearMap.hasFDerivAt : HasFDerivAt e e x := e.hasFDerivAtFilter #align continuous_linear_map.has_fderiv_at ContinuousLinearMap.hasFDerivAt @[simp, fun_prop] protected theorem ContinuousLinearMap.differentiableAt : DifferentiableAt 𝕜 e x := e.hasFDerivAt.differentiableAt #align continuous_linear_map.differentiable_at ContinuousLinearMap.differentiableAt @[fun_prop] protected theorem ContinuousLinearMap.differentiableWithinAt : DifferentiableWithinAt 𝕜 e s x := e.differentiableAt.differentiableWithinAt #align continuous_linear_map.differentiable_within_at ContinuousLinearMap.differentiableWithinAt @[simp] protected theorem ContinuousLinearMap.fderiv : fderiv 𝕜 e x = e := e.hasFDerivAt.fderiv #align continuous_linear_map.fderiv ContinuousLinearMap.fderiv protected theorem ContinuousLinearMap.fderivWithin (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 e s x = e := by rw [DifferentiableAt.fderivWithin e.differentiableAt hxs] exact e.fderiv #align continuous_linear_map.fderiv_within ContinuousLinearMap.fderivWithin @[simp, fun_prop] protected theorem ContinuousLinearMap.differentiable : Differentiable 𝕜 e := fun _ => e.differentiableAt #align continuous_linear_map.differentiable ContinuousLinearMap.differentiable @[fun_prop] protected theorem ContinuousLinearMap.differentiableOn : DifferentiableOn 𝕜 e s := e.differentiable.differentiableOn #align continuous_linear_map.differentiable_on ContinuousLinearMap.differentiableOn theorem IsBoundedLinearMap.hasFDerivAtFilter (h : IsBoundedLinearMap 𝕜 f) : HasFDerivAtFilter f h.toContinuousLinearMap x L := h.toContinuousLinearMap.hasFDerivAtFilter #align is_bounded_linear_map.has_fderiv_at_filter IsBoundedLinearMap.hasFDerivAtFilter @[fun_prop] theorem IsBoundedLinearMap.hasFDerivWithinAt (h : IsBoundedLinearMap 𝕜 f) : HasFDerivWithinAt f h.toContinuousLinearMap s x := h.hasFDerivAtFilter #align is_bounded_linear_map.has_fderiv_within_at IsBoundedLinearMap.hasFDerivWithinAt @[fun_prop] theorem IsBoundedLinearMap.hasFDerivAt (h : IsBoundedLinearMap 𝕜 f) : HasFDerivAt f h.toContinuousLinearMap x := h.hasFDerivAtFilter #align is_bounded_linear_map.has_fderiv_at IsBoundedLinearMap.hasFDerivAt @[fun_prop] theorem IsBoundedLinearMap.differentiableAt (h : IsBoundedLinearMap 𝕜 f) : DifferentiableAt 𝕜 f x := h.hasFDerivAt.differentiableAt #align is_bounded_linear_map.differentiable_at IsBoundedLinearMap.differentiableAt @[fun_prop] theorem IsBoundedLinearMap.differentiableWithinAt (h : IsBoundedLinearMap 𝕜 f) : DifferentiableWithinAt 𝕜 f s x := h.differentiableAt.differentiableWithinAt #align is_bounded_linear_map.differentiable_within_at IsBoundedLinearMap.differentiableWithinAt theorem IsBoundedLinearMap.fderiv (h : IsBoundedLinearMap 𝕜 f) : fderiv 𝕜 f x = h.toContinuousLinearMap := HasFDerivAt.fderiv h.hasFDerivAt #align is_bounded_linear_map.fderiv IsBoundedLinearMap.fderiv
Mathlib/Analysis/Calculus/FDeriv/Linear.lean
136
139
theorem IsBoundedLinearMap.fderivWithin (h : IsBoundedLinearMap 𝕜 f) (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 f s x = h.toContinuousLinearMap := by
rw [DifferentiableAt.fderivWithin h.differentiableAt hxs] exact h.fderiv
import Mathlib.RingTheory.Polynomial.Hermite.Basic import Mathlib.Analysis.Calculus.Deriv.Add import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.SpecialFunctions.Exp import Mathlib.Analysis.SpecialFunctions.ExpDeriv #align_import ring_theory.polynomial.hermite.gaussian from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open Polynomial namespace Polynomial theorem deriv_gaussian_eq_hermite_mul_gaussian (n : ℕ) (x : ℝ) : deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x = (-1 : ℝ) ^ n * aeval x (hermite n) * Real.exp (-(x ^ 2 / 2)) := by rw [mul_assoc] induction' n with n ih generalizing x · rw [Function.iterate_zero_apply, pow_zero, one_mul, hermite_zero, C_1, map_one, one_mul] · replace ih : deriv^[n] _ = _ := _root_.funext ih have deriv_gaussian : deriv (fun y => Real.exp (-(y ^ 2 / 2))) x = -x * Real.exp (-(x ^ 2 / 2)) := by -- porting note (#10745): was `simp [mul_comm, ← neg_mul]` rw [deriv_exp (by simp)]; simp; ring rw [Function.iterate_succ_apply', ih, deriv_const_mul_field, deriv_mul, pow_succ (-1 : ℝ), deriv_gaussian, hermite_succ, map_sub, map_mul, aeval_X, Polynomial.deriv_aeval] · ring · apply Polynomial.differentiable_aeval · apply DifferentiableAt.exp; simp -- Porting note: was just `simp` #align polynomial.deriv_gaussian_eq_hermite_mul_gaussian Polynomial.deriv_gaussian_eq_hermite_mul_gaussian
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
58
64
theorem hermite_eq_deriv_gaussian (n : ℕ) (x : ℝ) : aeval x (hermite n) = (-1 : ℝ) ^ n * deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x / Real.exp (-(x ^ 2 / 2)) := by
rw [deriv_gaussian_eq_hermite_mul_gaussian] field_simp [Real.exp_ne_zero] rw [← @smul_eq_mul ℝ _ ((-1) ^ n), ← inv_smul_eq_iff₀, mul_assoc, smul_eq_mul, ← inv_pow, ← neg_inv, inv_one] exact pow_ne_zero _ (by norm_num)
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal #align_import analysis.special_functions.pow.asymptotics from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" set_option linter.uppercaseLean3 false noncomputable section open scoped Classical open Real Topology NNReal ENNReal Filter ComplexConjugate Finset Set namespace Complex section variable {α : Type*} {l : Filter α} {f g : α → ℂ} open Asymptotics theorem isTheta_exp_arg_mul_im (hl : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) : (fun x => Real.exp (arg (f x) * im (g x))) =Θ[l] fun _ => (1 : ℝ) := by rcases hl with ⟨b, hb⟩ refine Real.isTheta_exp_comp_one.2 ⟨π * b, ?_⟩ rw [eventually_map] at hb ⊢ refine hb.mono fun x hx => ?_ erw [abs_mul] exact mul_le_mul (abs_arg_le_pi _) hx (abs_nonneg _) Real.pi_pos.le #align complex.is_Theta_exp_arg_mul_im Complex.isTheta_exp_arg_mul_im theorem isBigO_cpow_rpow (hl : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) : (fun x => f x ^ g x) =O[l] fun x => abs (f x) ^ (g x).re := calc (fun x => f x ^ g x) =O[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / Real.exp (arg (f x) * im (g x))) := isBigO_of_le _ fun x => (abs_cpow_le _ _).trans (le_abs_self _) _ =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / (1 : ℝ)) := ((isTheta_refl _ _).div (isTheta_exp_arg_mul_im hl)) _ =ᶠ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re) := by simp only [ofReal_one, div_one] rfl #align complex.is_O_cpow_rpow Complex.isBigO_cpow_rpow
Mathlib/Analysis/SpecialFunctions/Pow/Asymptotics.lean
223
234
theorem isTheta_cpow_rpow (hl_im : IsBoundedUnder (· ≤ ·) l fun x => |(g x).im|) (hl : ∀ᶠ x in l, f x = 0 → re (g x) = 0 → g x = 0) : (fun x => f x ^ g x) =Θ[l] fun x => abs (f x) ^ (g x).re := calc (fun x => f x ^ g x) =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / Real.exp (arg (f x) * im (g x))) := isTheta_of_norm_eventuallyEq' <| hl.mono fun x => abs_cpow_of_imp _ =Θ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re / (1 : ℝ)) := ((isTheta_refl _ _).div (isTheta_exp_arg_mul_im hl_im)) _ =ᶠ[l] (show α → ℝ from fun x => abs (f x) ^ (g x).re) := by
simp only [ofReal_one, div_one] rfl
import Mathlib.Algebra.CharP.Pi import Mathlib.Algebra.CharP.Quotient import Mathlib.Algebra.CharP.Subring import Mathlib.Algebra.Ring.Pi import Mathlib.Analysis.SpecialFunctions.Pow.NNReal import Mathlib.FieldTheory.Perfect import Mathlib.RingTheory.Localization.FractionRing import Mathlib.Algebra.Ring.Subring.Basic import Mathlib.RingTheory.Valuation.Integers #align_import ring_theory.perfection from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" universe u₁ u₂ u₃ u₄ open scoped NNReal def Monoid.perfection (M : Type u₁) [CommMonoid M] (p : ℕ) : Submonoid (ℕ → M) where carrier := { f | ∀ n, f (n + 1) ^ p = f n } one_mem' _ := one_pow _ mul_mem' hf hg n := (mul_pow _ _ _).trans <| congr_arg₂ _ (hf n) (hg n) #align monoid.perfection Monoid.perfection def Ring.perfectionSubsemiring (R : Type u₁) [CommSemiring R] (p : ℕ) [hp : Fact p.Prime] [CharP R p] : Subsemiring (ℕ → R) := { Monoid.perfection R p with zero_mem' := fun _ ↦ zero_pow hp.1.ne_zero add_mem' := fun hf hg n => (frobenius_add R p _ _).trans <| congr_arg₂ _ (hf n) (hg n) } #align ring.perfection_subsemiring Ring.perfectionSubsemiring def Ring.perfectionSubring (R : Type u₁) [CommRing R] (p : ℕ) [hp : Fact p.Prime] [CharP R p] : Subring (ℕ → R) := (Ring.perfectionSubsemiring R p).toSubring fun n => by simp_rw [← frobenius_def, Pi.neg_apply, Pi.one_apply, RingHom.map_neg, RingHom.map_one] #align ring.perfection_subring Ring.perfectionSubring def Ring.Perfection (R : Type u₁) [CommSemiring R] (p : ℕ) : Type u₁ := { f // ∀ n : ℕ, (f : ℕ → R) (n + 1) ^ p = f n } #align ring.perfection Ring.Perfection namespace Perfection variable (R : Type u₁) [CommSemiring R] (p : ℕ) [hp : Fact p.Prime] [CharP R p] instance commSemiring : CommSemiring (Ring.Perfection R p) := (Ring.perfectionSubsemiring R p).toCommSemiring #align perfection.ring.perfection.comm_semiring Perfection.commSemiring instance charP : CharP (Ring.Perfection R p) p := CharP.subsemiring (ℕ → R) p (Ring.perfectionSubsemiring R p) #align perfection.char_p Perfection.charP instance ring (R : Type u₁) [CommRing R] [CharP R p] : Ring (Ring.Perfection R p) := (Ring.perfectionSubring R p).toRing #align perfection.ring Perfection.ring instance commRing (R : Type u₁) [CommRing R] [CharP R p] : CommRing (Ring.Perfection R p) := (Ring.perfectionSubring R p).toCommRing #align perfection.comm_ring Perfection.commRing instance : Inhabited (Ring.Perfection R p) := ⟨0⟩ def coeff (n : ℕ) : Ring.Perfection R p →+* R where toFun f := f.1 n map_one' := rfl map_mul' _ _ := rfl map_zero' := rfl map_add' _ _ := rfl #align perfection.coeff Perfection.coeff variable {R p} @[ext] theorem ext {f g : Ring.Perfection R p} (h : ∀ n, coeff R p n f = coeff R p n g) : f = g := Subtype.eq <| funext h #align perfection.ext Perfection.ext variable (R p) def pthRoot : Ring.Perfection R p →+* Ring.Perfection R p where toFun f := ⟨fun n => coeff R p (n + 1) f, fun _ => f.2 _⟩ map_one' := rfl map_mul' _ _ := rfl map_zero' := rfl map_add' _ _ := rfl #align perfection.pth_root Perfection.pthRoot variable {R p} @[simp] theorem coeff_mk (f : ℕ → R) (hf) (n : ℕ) : coeff R p n ⟨f, hf⟩ = f n := rfl #align perfection.coeff_mk Perfection.coeff_mk theorem coeff_pthRoot (f : Ring.Perfection R p) (n : ℕ) : coeff R p n (pthRoot R p f) = coeff R p (n + 1) f := rfl #align perfection.coeff_pth_root Perfection.coeff_pthRoot
Mathlib/RingTheory/Perfection.lean
129
130
theorem coeff_pow_p (f : Ring.Perfection R p) (n : ℕ) : coeff R p (n + 1) (f ^ p) = coeff R p n f := by
rw [RingHom.map_pow]; exact f.2 n
import Mathlib.AlgebraicGeometry.Morphisms.QuasiCompact import Mathlib.Topology.QuasiSeparated #align_import algebraic_geometry.morphisms.quasi_separated from "leanprover-community/mathlib"@"1a51edf13debfcbe223fa06b1cb353b9ed9751cc" noncomputable section open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace universe u open scoped AlgebraicGeometry namespace AlgebraicGeometry variable {X Y : Scheme.{u}} (f : X ⟶ Y) @[mk_iff] class QuasiSeparated (f : X ⟶ Y) : Prop where diagonalQuasiCompact : QuasiCompact (pullback.diagonal f) := by infer_instance #align algebraic_geometry.quasi_separated AlgebraicGeometry.QuasiSeparated def QuasiSeparated.affineProperty : AffineTargetMorphismProperty := fun X _ _ _ => QuasiSeparatedSpace X.carrier #align algebraic_geometry.quasi_separated.affine_property AlgebraicGeometry.QuasiSeparated.affineProperty theorem quasiSeparatedSpace_iff_affine (X : Scheme) : QuasiSeparatedSpace X.carrier ↔ ∀ U V : X.affineOpens, IsCompact (U ∩ V : Set X.carrier) := by rw [quasiSeparatedSpace_iff] constructor · intro H U V; exact H U V U.1.2 U.2.isCompact V.1.2 V.2.isCompact · intro H suffices ∀ (U : Opens X.carrier) (_ : IsCompact U.1) (V : Opens X.carrier) (_ : IsCompact V.1), IsCompact (U ⊓ V).1 by intro U V hU hU' hV hV'; exact this ⟨U, hU⟩ hU' ⟨V, hV⟩ hV' intro U hU V hV -- Porting note: it complains "unable to find motive", but telling Lean that motive is -- underscore is actually sufficient, weird apply compact_open_induction_on (P := _) V hV · simp · intro S _ V hV change IsCompact (U.1 ∩ (S.1 ∪ V.1)) rw [Set.inter_union_distrib_left] apply hV.union clear hV apply compact_open_induction_on (P := _) U hU · simp · intro S _ W hW change IsCompact ((S.1 ∪ W.1) ∩ V.1) rw [Set.union_inter_distrib_right] apply hW.union apply H #align algebraic_geometry.quasi_separated_space_iff_affine AlgebraicGeometry.quasiSeparatedSpace_iff_affine theorem quasi_compact_affineProperty_iff_quasiSeparatedSpace {X Y : Scheme} [IsAffine Y] (f : X ⟶ Y) : QuasiCompact.affineProperty.diagonal f ↔ QuasiSeparatedSpace X.carrier := by delta AffineTargetMorphismProperty.diagonal rw [quasiSeparatedSpace_iff_affine] constructor · intro H U V haveI : IsAffine _ := U.2 haveI : IsAffine _ := V.2 let g : pullback (X.ofRestrict U.1.openEmbedding) (X.ofRestrict V.1.openEmbedding) ⟶ X := pullback.fst ≫ X.ofRestrict _ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e erw [Subtype.range_coe, Subtype.range_coe] at e rw [isCompact_iff_compactSpace] exact @Homeomorph.compactSpace _ _ _ _ (H _ _) e · introv H h₁ h₂ let g : pullback f₁ f₂ ⟶ X := pullback.fst ≫ f₁ -- Porting note: `inferInstance` does not work here have : IsOpenImmersion g := PresheafedSpace.IsOpenImmersion.comp _ _ have e := Homeomorph.ofEmbedding _ this.base_open.toEmbedding rw [IsOpenImmersion.range_pullback_to_base_of_left] at e simp_rw [isCompact_iff_compactSpace] at H exact @Homeomorph.compactSpace _ _ _ _ (H ⟨⟨_, h₁.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩ ⟨⟨_, h₂.base_open.isOpen_range⟩, rangeIsAffineOpenOfOpenImmersion _⟩) e.symm #align algebraic_geometry.quasi_compact_affine_property_iff_quasi_separated_space AlgebraicGeometry.quasi_compact_affineProperty_iff_quasiSeparatedSpace theorem quasiSeparated_eq_diagonal_is_quasiCompact : @QuasiSeparated = MorphismProperty.diagonal @QuasiCompact := by ext; exact quasiSeparated_iff _ #align algebraic_geometry.quasi_separated_eq_diagonal_is_quasi_compact AlgebraicGeometry.quasiSeparated_eq_diagonal_is_quasiCompact
Mathlib/AlgebraicGeometry/Morphisms/QuasiSeparated.lean
121
123
theorem quasi_compact_affineProperty_diagonal_eq : QuasiCompact.affineProperty.diagonal = QuasiSeparated.affineProperty := by
funext; rw [quasi_compact_affineProperty_iff_quasiSeparatedSpace]; rfl
import Mathlib.LinearAlgebra.Dimension.DivisionRing import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition noncomputable section universe u v v' v'' variable {K : Type u} {V V₁ : Type v} {V' V'₁ : Type v'} {V'' : Type v''} open Cardinal Basis Submodule Function Set namespace LinearMap section Ring variable [Ring K] [AddCommGroup V] [Module K V] [AddCommGroup V₁] [Module K V₁] variable [AddCommGroup V'] [Module K V'] abbrev rank (f : V →ₗ[K] V') : Cardinal := Module.rank K (LinearMap.range f) #align linear_map.rank LinearMap.rank theorem rank_le_range (f : V →ₗ[K] V') : rank f ≤ Module.rank K V' := rank_submodule_le _ #align linear_map.rank_le_range LinearMap.rank_le_range theorem rank_le_domain (f : V →ₗ[K] V₁) : rank f ≤ Module.rank K V := rank_range_le _ #align linear_map.rank_le_domain LinearMap.rank_le_domain @[simp]
Mathlib/LinearAlgebra/Dimension/LinearMap.lean
46
47
theorem rank_zero [Nontrivial K] : rank (0 : V →ₗ[K] V') = 0 := by
rw [rank, LinearMap.range_zero, rank_bot]
import Mathlib.Analysis.InnerProductSpace.Orthogonal import Mathlib.Analysis.Normed.Group.AddTorsor #align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" open Set open scoped RealInnerProductSpace variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] variable [NormedAddTorsor V P] noncomputable section namespace AffineSubspace variable {c c₁ c₂ p₁ p₂ : P} def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P := .comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <| (LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace theorem mem_perpBisector_iff_inner_eq_zero' : c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 := Iff.rfl theorem mem_perpBisector_iff_inner_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 := inner_eq_zero_symm theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero : c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc] simp theorem mem_perpBisector_pointReflection_iff_inner_eq_zero : c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right, Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero, ← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev] theorem midpoint_mem_perpBisector (p₁ p₂ : P) : midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by simp [mem_perpBisector_iff_inner_eq_zero] theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty := ⟨_, midpoint_mem_perpBisector _ _⟩ @[simp] theorem direction_perpBisector (p₁ p₂ : P) : (perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by erw [perpBisector, comap_symm, map_direction, Submodule.map_id, Submodule.toAffineSubspace_direction] ext x exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm theorem mem_perpBisector_iff_inner_eq_inner : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left]; simp theorem mem_perpBisector_iff_inner_eq : c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left, sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq, dist_eq_norm_vsub' V, div_eq_inv_mul] theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff, vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right, neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
Mathlib/Geometry/Euclidean/PerpBisector.lean
97
98
theorem mem_perpBisector_iff_dist_eq' : c ∈ perpBisector p₁ p₂ ↔ dist p₁ c = dist p₂ c := by
simp only [mem_perpBisector_iff_dist_eq, dist_comm]
import Mathlib.Analysis.Convex.Function import Mathlib.Topology.Algebra.Affine import Mathlib.Topology.MetricSpace.PseudoMetric import Mathlib.Topology.Order.LocalExtr #align_import analysis.convex.extrema from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" variable {E β : Type*} [AddCommGroup E] [TopologicalSpace E] [Module ℝ E] [TopologicalAddGroup E] [ContinuousSMul ℝ E] [OrderedAddCommGroup β] [Module ℝ β] [OrderedSMul ℝ β] {s : Set E} open Set Filter Function open scoped Classical open Topology theorem IsMinOn.of_isLocalMinOn_of_convexOn_Icc {f : ℝ → β} {a b : ℝ} (a_lt_b : a < b) (h_local_min : IsLocalMinOn f (Icc a b) a) (h_conv : ConvexOn ℝ (Icc a b) f) : IsMinOn f (Icc a b) a := by rintro c hc dsimp only [mem_setOf_eq] rw [IsLocalMinOn, nhdsWithin_Icc_eq_nhdsWithin_Ici a_lt_b] at h_local_min rcases hc.1.eq_or_lt with (rfl | a_lt_c) · exact le_rfl have H₁ : ∀ᶠ y in 𝓝[>] a, f a ≤ f y := h_local_min.filter_mono (nhdsWithin_mono _ Ioi_subset_Ici_self) have H₂ : ∀ᶠ y in 𝓝[>] a, y ∈ Ioc a c := Ioc_mem_nhdsWithin_Ioi (left_mem_Ico.2 a_lt_c) rcases (H₁.and H₂).exists with ⟨y, hfy, hy_ac⟩ rcases (Convex.mem_Ioc a_lt_c).mp hy_ac with ⟨ya, yc, ya₀, yc₀, yac, rfl⟩ suffices ya • f a + yc • f a ≤ ya • f a + yc • f c from (smul_le_smul_iff_of_pos_left yc₀).1 (le_of_add_le_add_left this) calc ya • f a + yc • f a = f a := by rw [← add_smul, yac, one_smul] _ ≤ f (ya * a + yc * c) := hfy _ ≤ ya • f a + yc • f c := h_conv.2 (left_mem_Icc.2 a_lt_b.le) hc ya₀ yc₀.le yac #align is_min_on.of_is_local_min_on_of_convex_on_Icc IsMinOn.of_isLocalMinOn_of_convexOn_Icc
Mathlib/Analysis/Convex/Extrema.lean
54
69
theorem IsMinOn.of_isLocalMinOn_of_convexOn {f : E → β} {a : E} (a_in_s : a ∈ s) (h_localmin : IsLocalMinOn f s a) (h_conv : ConvexOn ℝ s f) : IsMinOn f s a := by
intro x x_in_s let g : ℝ →ᵃ[ℝ] E := AffineMap.lineMap a x have hg0 : g 0 = a := AffineMap.lineMap_apply_zero a x have hg1 : g 1 = x := AffineMap.lineMap_apply_one a x have hgc : Continuous g := AffineMap.lineMap_continuous have h_maps : MapsTo g (Icc 0 1) s := by simpa only [g, mapsTo', ← segment_eq_image_lineMap] using h_conv.1.segment_subset a_in_s x_in_s have fg_local_min_on : IsLocalMinOn (f ∘ g) (Icc 0 1) 0 := by rw [← hg0] at h_localmin exact h_localmin.comp_continuousOn h_maps hgc.continuousOn (left_mem_Icc.2 zero_le_one) have fg_min_on : IsMinOn (f ∘ g) (Icc 0 1 : Set ℝ) 0 := by refine IsMinOn.of_isLocalMinOn_of_convexOn_Icc one_pos fg_local_min_on ?_ exact (h_conv.comp_affineMap g).subset h_maps (convex_Icc 0 1) simpa only [hg0, hg1, comp_apply, mem_setOf_eq] using fg_min_on (right_mem_Icc.2 zero_le_one)
import Mathlib.Data.Matrix.Basis import Mathlib.Data.Matrix.DMatrix import Mathlib.LinearAlgebra.Matrix.Determinant.Basic import Mathlib.LinearAlgebra.Matrix.Reindex import Mathlib.Tactic.FieldSimp #align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6" universe u₁ u₂ namespace Matrix open Matrix variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜] variable [DecidableEq n] [DecidableEq p] variable [CommRing R] section Transvection variable {R n} (i j : n) def transvection (c : R) : Matrix n n R := 1 + Matrix.stdBasisMatrix i j c #align matrix.transvection Matrix.transvection @[simp] theorem transvection_zero : transvection i j (0 : R) = 1 := by simp [transvection] #align matrix.transvection_zero Matrix.transvection_zero section theorem updateRow_eq_transvection [Finite n] (c : R) : updateRow (1 : Matrix n n R) i ((1 : Matrix n n R) i + c • (1 : Matrix n n R) j) = transvection i j c := by cases nonempty_fintype n ext a b by_cases ha : i = a · by_cases hb : j = b · simp only [updateRow_self, transvection, ha, hb, Pi.add_apply, StdBasisMatrix.apply_same, one_apply_eq, Pi.smul_apply, mul_one, Algebra.id.smul_eq_mul, add_apply] · simp only [updateRow_self, transvection, ha, hb, StdBasisMatrix.apply_of_ne, Pi.add_apply, Ne, not_false_iff, Pi.smul_apply, and_false_iff, one_apply_ne, Algebra.id.smul_eq_mul, mul_zero, add_apply] · simp only [updateRow_ne, transvection, ha, Ne.symm ha, StdBasisMatrix.apply_of_ne, add_zero, Algebra.id.smul_eq_mul, Ne, not_false_iff, DMatrix.add_apply, Pi.smul_apply, mul_zero, false_and_iff, add_apply] #align matrix.update_row_eq_transvection Matrix.updateRow_eq_transvection variable [Fintype n]
Mathlib/LinearAlgebra/Matrix/Transvection.lean
113
116
theorem transvection_mul_transvection_same (h : i ≠ j) (c d : R) : transvection i j c * transvection i j d = transvection i j (c + d) := by
simp [transvection, Matrix.add_mul, Matrix.mul_add, h, h.symm, add_smul, add_assoc, stdBasisMatrix_add]
import Mathlib.Analysis.NormedSpace.Basic #align_import analysis.normed_space.enorm from "leanprover-community/mathlib"@"57ac39bd365c2f80589a700f9fbb664d3a1a30c2" noncomputable section attribute [local instance] Classical.propDecidable open ENNReal structure ENorm (𝕜 : Type*) (V : Type*) [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] where toFun : V → ℝ≥0∞ eq_zero' : ∀ x, toFun x = 0 → x = 0 map_add_le' : ∀ x y : V, toFun (x + y) ≤ toFun x + toFun y map_smul_le' : ∀ (c : 𝕜) (x : V), toFun (c • x) ≤ ‖c‖₊ * toFun x #align enorm ENorm namespace ENorm variable {𝕜 : Type*} {V : Type*} [NormedField 𝕜] [AddCommGroup V] [Module 𝕜 V] (e : ENorm 𝕜 V) -- Porting note: added to appease norm_cast complaints attribute [coe] ENorm.toFun instance : CoeFun (ENorm 𝕜 V) fun _ => V → ℝ≥0∞ := ⟨ENorm.toFun⟩ theorem coeFn_injective : Function.Injective ((↑) : ENorm 𝕜 V → V → ℝ≥0∞) := fun e₁ e₂ h => by cases e₁ cases e₂ congr #align enorm.coe_fn_injective ENorm.coeFn_injective @[ext] theorem ext {e₁ e₂ : ENorm 𝕜 V} (h : ∀ x, e₁ x = e₂ x) : e₁ = e₂ := coeFn_injective <| funext h #align enorm.ext ENorm.ext theorem ext_iff {e₁ e₂ : ENorm 𝕜 V} : e₁ = e₂ ↔ ∀ x, e₁ x = e₂ x := ⟨fun h _ => h ▸ rfl, ext⟩ #align enorm.ext_iff ENorm.ext_iff @[simp, norm_cast] theorem coe_inj {e₁ e₂ : ENorm 𝕜 V} : (e₁ : V → ℝ≥0∞) = e₂ ↔ e₁ = e₂ := coeFn_injective.eq_iff #align enorm.coe_inj ENorm.coe_inj @[simp] theorem map_smul (c : 𝕜) (x : V) : e (c • x) = ‖c‖₊ * e x := by apply le_antisymm (e.map_smul_le' c x) by_cases hc : c = 0 · simp [hc] calc (‖c‖₊ : ℝ≥0∞) * e x = ‖c‖₊ * e (c⁻¹ • c • x) := by rw [inv_smul_smul₀ hc] _ ≤ ‖c‖₊ * (‖c⁻¹‖₊ * e (c • x)) := mul_le_mul_left' (e.map_smul_le' _ _) _ _ = e (c • x) := by rw [← mul_assoc, nnnorm_inv, ENNReal.coe_inv, ENNReal.mul_inv_cancel _ ENNReal.coe_ne_top, one_mul] <;> simp [hc] #align enorm.map_smul ENorm.map_smul @[simp] theorem map_zero : e 0 = 0 := by rw [← zero_smul 𝕜 (0 : V), e.map_smul] norm_num #align enorm.map_zero ENorm.map_zero @[simp] theorem eq_zero_iff {x : V} : e x = 0 ↔ x = 0 := ⟨e.eq_zero' x, fun h => h.symm ▸ e.map_zero⟩ #align enorm.eq_zero_iff ENorm.eq_zero_iff @[simp]
Mathlib/Analysis/NormedSpace/ENorm.lean
107
110
theorem map_neg (x : V) : e (-x) = e x := calc e (-x) = ‖(-1 : 𝕜)‖₊ * e x := by
rw [← map_smul, neg_one_smul] _ = e x := by simp
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] 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] #align finset.sym2_mono Finset.sym2_mono theorem monotone_sym2 : Monotone (Finset.sym2 : Finset α → _) := fun _ _ => sym2_mono theorem injective_sym2 : Function.Injective (Finset.sym2 : Finset α → _) := by intro s t h ext x simpa using congr(s(x, x) ∈ $h) theorem strictMono_sym2 : StrictMono (Finset.sym2 : Finset α → _) := monotone_sym2.strictMono_of_injective injective_sym2 theorem sym2_toFinset [DecidableEq α] (m : Multiset α) : m.toFinset.sym2 = m.sym2.toFinset := by ext z refine z.ind fun x y ↦ ?_ simp only [mk_mem_sym2_iff, Multiset.mem_toFinset, Multiset.mk_mem_sym2_iff] @[simp] theorem sym2_empty : (∅ : Finset α).sym2 = ∅ := rfl #align finset.sym2_empty Finset.sym2_empty @[simp] theorem sym2_eq_empty : s.sym2 = ∅ ↔ s = ∅ := by rw [← val_eq_zero, sym2_val, Multiset.sym2_eq_zero_iff, val_eq_zero] #align finset.sym2_eq_empty Finset.sym2_eq_empty @[simp, aesop safe apply (rule_sets := [finsetNonempty])] theorem sym2_nonempty : s.sym2.Nonempty ↔ s.Nonempty := by rw [← not_iff_not] simp_rw [not_nonempty_iff_eq_empty, sym2_eq_empty] #align finset.sym2_nonempty Finset.sym2_nonempty protected alias ⟨_, Nonempty.sym2⟩ := sym2_nonempty #align finset.nonempty.sym2 Finset.Nonempty.sym2 @[simp] theorem sym2_singleton (a : α) : ({a} : Finset α).sym2 = {Sym2.diag a} := rfl #align finset.sym2_singleton Finset.sym2_singleton theorem card_sym2 (s : Finset α) : s.sym2.card = Nat.choose (s.card + 1) 2 := by rw [card_def, sym2_val, Multiset.card_sym2, ← card_def] #align finset.card_sym2 Finset.card_sym2 end variable [DecidableEq α] {s t : Finset α} {a b : α} theorem sym2_eq_image : s.sym2 = (s ×ˢ s).image Sym2.mk := by ext z refine z.ind fun x y ↦ ?_ rw [mk_mem_sym2_iff, mem_image] constructor · intro h use (x, y) simp only [mem_product, h, and_self, true_and] · rintro ⟨⟨a, b⟩, h⟩ simp only [mem_product, Sym2.eq_iff] at h obtain ⟨h, (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩)⟩ := h <;> simp [h] theorem isDiag_mk_of_mem_diag {a : α × α} (h : a ∈ s.diag) : (Sym2.mk a).IsDiag := (Sym2.isDiag_iff_proj_eq _).2 (mem_diag.1 h).2 #align finset.is_diag_mk_of_mem_diag Finset.isDiag_mk_of_mem_diag theorem not_isDiag_mk_of_mem_offDiag {a : α × α} (h : a ∈ s.offDiag) : ¬ (Sym2.mk a).IsDiag := by rw [Sym2.isDiag_iff_proj_eq] exact (mem_offDiag.1 h).2.2 #align finset.not_is_diag_mk_of_mem_off_diag Finset.not_isDiag_mk_of_mem_offDiag section Sym2 variable {m : Sym2 α} -- Porting note: add this lemma and remove simp in the next lemma since simpNF lint -- warns that its LHS is not in normal form @[simp] theorem diag_mem_sym2_mem_iff : (∀ b, b ∈ Sym2.diag a → b ∈ s) ↔ a ∈ s := by rw [← mem_sym2_iff] exact mk_mem_sym2_iff.trans <| and_self_iff
Mathlib/Data/Finset/Sym.lean
156
156
theorem diag_mem_sym2_iff : Sym2.diag a ∈ s.sym2 ↔ a ∈ s := by
simp [diag_mem_sym2_mem_iff]
import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.AdjoinRoot #align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" noncomputable section open Polynomial variable {R K L M : Type*} [CommRing R] [Field K] [Field L] [CommRing M] [Algebra R K] [Algebra R L] [Algebra R M] {x : L} (int : IsIntegral R x) (h : Splits (algebraMap R K) (minpoly R x)) theorem IsIntegral.mem_range_algHom_of_minpoly_splits (f : K →ₐ[R] L) : x ∈ f.range := show x ∈ Set.range f from Set.image_subset_range _ _ <| by rw [image_rootSet h f, mem_rootSet'] exact ⟨((minpoly.monic int).map _).ne_zero, minpoly.aeval R x⟩ theorem IsIntegral.mem_range_algebraMap_of_minpoly_splits [Algebra K L] [IsScalarTower R K L] : x ∈ (algebraMap K L).range := int.mem_range_algHom_of_minpoly_splits h (IsScalarTower.toAlgHom R K L) variable [Algebra K M] [IsScalarTower R K M] {x : M} (int : IsIntegral R x) theorem IsIntegral.minpoly_splits_tower_top' {f : K →+* L} (h : Splits (f.comp <| algebraMap R K) (minpoly R x)) : Splits f (minpoly K x) := splits_of_splits_of_dvd _ ((minpoly.monic int).map _).ne_zero ((splits_map_iff _ _).mpr h) (minpoly.dvd_map_of_isScalarTower R _ x)
Mathlib/RingTheory/Adjoin/Field.lean
106
110
theorem IsIntegral.minpoly_splits_tower_top [Algebra K L] [IsScalarTower R K L] (h : Splits (algebraMap R L) (minpoly R x)) : Splits (algebraMap K L) (minpoly K x) := by
rw [IsScalarTower.algebraMap_eq R K L] at h exact int.minpoly_splits_tower_top' h
import Mathlib.Data.List.Sigma #align_import data.list.alist from "leanprover-community/mathlib"@"f808feb6c18afddb25e66a71d317643cf7fb5fbb" universe u v w open List variable {α : Type u} {β : α → Type v} structure AList (β : α → Type v) : Type max u v where entries : List (Sigma β) nodupKeys : entries.NodupKeys #align alist AList def List.toAList [DecidableEq α] {β : α → Type v} (l : List (Sigma β)) : AList β where entries := _ nodupKeys := nodupKeys_dedupKeys l #align list.to_alist List.toAList namespace AList @[ext] theorem ext : ∀ {s t : AList β}, s.entries = t.entries → s = t | ⟨l₁, h₁⟩, ⟨l₂, _⟩, H => by congr #align alist.ext AList.ext theorem ext_iff {s t : AList β} : s = t ↔ s.entries = t.entries := ⟨congr_arg _, ext⟩ #align alist.ext_iff AList.ext_iff instance [DecidableEq α] [∀ a, DecidableEq (β a)] : DecidableEq (AList β) := fun xs ys => by rw [ext_iff]; infer_instance def keys (s : AList β) : List α := s.entries.keys #align alist.keys AList.keys theorem keys_nodup (s : AList β) : s.keys.Nodup := s.nodupKeys #align alist.keys_nodup AList.keys_nodup instance : Membership α (AList β) := ⟨fun a s => a ∈ s.keys⟩ theorem mem_keys {a : α} {s : AList β} : a ∈ s ↔ a ∈ s.keys := Iff.rfl #align alist.mem_keys AList.mem_keys theorem mem_of_perm {a : α} {s₁ s₂ : AList β} (p : s₁.entries ~ s₂.entries) : a ∈ s₁ ↔ a ∈ s₂ := (p.map Sigma.fst).mem_iff #align alist.mem_of_perm AList.mem_of_perm instance : EmptyCollection (AList β) := ⟨⟨[], nodupKeys_nil⟩⟩ instance : Inhabited (AList β) := ⟨∅⟩ @[simp] theorem not_mem_empty (a : α) : a ∉ (∅ : AList β) := not_mem_nil a #align alist.not_mem_empty AList.not_mem_empty @[simp] theorem empty_entries : (∅ : AList β).entries = [] := rfl #align alist.empty_entries AList.empty_entries @[simp] theorem keys_empty : (∅ : AList β).keys = [] := rfl #align alist.keys_empty AList.keys_empty def singleton (a : α) (b : β a) : AList β := ⟨[⟨a, b⟩], nodupKeys_singleton _⟩ #align alist.singleton AList.singleton @[simp] theorem singleton_entries (a : α) (b : β a) : (singleton a b).entries = [Sigma.mk a b] := rfl #align alist.singleton_entries AList.singleton_entries @[simp] theorem keys_singleton (a : α) (b : β a) : (singleton a b).keys = [a] := rfl #align alist.keys_singleton AList.keys_singleton section variable [DecidableEq α] def lookup (a : α) (s : AList β) : Option (β a) := s.entries.dlookup a #align alist.lookup AList.lookup @[simp] theorem lookup_empty (a) : lookup a (∅ : AList β) = none := rfl #align alist.lookup_empty AList.lookup_empty theorem lookup_isSome {a : α} {s : AList β} : (s.lookup a).isSome ↔ a ∈ s := dlookup_isSome #align alist.lookup_is_some AList.lookup_isSome theorem lookup_eq_none {a : α} {s : AList β} : lookup a s = none ↔ a ∉ s := dlookup_eq_none #align alist.lookup_eq_none AList.lookup_eq_none theorem mem_lookup_iff {a : α} {b : β a} {s : AList β} : b ∈ lookup a s ↔ Sigma.mk a b ∈ s.entries := mem_dlookup_iff s.nodupKeys #align alist.mem_lookup_iff AList.mem_lookup_iff theorem perm_lookup {a : α} {s₁ s₂ : AList β} (p : s₁.entries ~ s₂.entries) : s₁.lookup a = s₂.lookup a := perm_dlookup _ s₁.nodupKeys s₂.nodupKeys p #align alist.perm_lookup AList.perm_lookup instance (a : α) (s : AList β) : Decidable (a ∈ s) := decidable_of_iff _ lookup_isSome theorem keys_subset_keys_of_entries_subset_entries {s₁ s₂ : AList β} (h : s₁.entries ⊆ s₂.entries) : s₁.keys ⊆ s₂.keys := by intro k hk letI : DecidableEq α := Classical.decEq α have := h (mem_lookup_iff.1 (Option.get_mem (lookup_isSome.2 hk))) rw [← mem_lookup_iff, Option.mem_def] at this rw [← mem_keys, ← lookup_isSome, this] exact Option.isSome_some def replace (a : α) (b : β a) (s : AList β) : AList β := ⟨kreplace a b s.entries, (kreplace_nodupKeys a b).2 s.nodupKeys⟩ #align alist.replace AList.replace @[simp] theorem keys_replace (a : α) (b : β a) (s : AList β) : (replace a b s).keys = s.keys := keys_kreplace _ _ _ #align alist.keys_replace AList.keys_replace @[simp]
Mathlib/Data/List/AList.lean
207
208
theorem mem_replace {a a' : α} {b : β a} {s : AList β} : a' ∈ replace a b s ↔ a' ∈ s := by
rw [mem_keys, keys_replace, ← mem_keys]
import Mathlib.Analysis.Convex.Between import Mathlib.Analysis.Convex.Jensen import Mathlib.Analysis.Convex.Topology import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.AddTorsor #align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" variable {ι : Type*} {E P : Type*} open Metric Set open scoped Convex variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P] variable {s t : Set E} theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm := ⟨hs, fun x _ y _ a b ha hb _ => calc ‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _ _ = a * ‖x‖ + b * ‖y‖ := by rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩ #align convex_on_norm convexOn_norm theorem convexOn_univ_norm : ConvexOn ℝ univ (norm : E → ℝ) := convexOn_norm convex_univ #align convex_on_univ_norm convexOn_univ_norm theorem convexOn_dist (z : E) (hs : Convex ℝ s) : ConvexOn ℝ s fun z' => dist z' z := by simpa [dist_eq_norm, preimage_preimage] using (convexOn_norm (hs.translate (-z))).comp_affineMap (AffineMap.id ℝ E - AffineMap.const ℝ E z) #align convex_on_dist convexOn_dist theorem convexOn_univ_dist (z : E) : ConvexOn ℝ univ fun z' => dist z' z := convexOn_dist z convex_univ #align convex_on_univ_dist convexOn_univ_dist theorem convex_ball (a : E) (r : ℝ) : Convex ℝ (Metric.ball a r) := by simpa only [Metric.ball, sep_univ] using (convexOn_univ_dist a).convex_lt r #align convex_ball convex_ball theorem convex_closedBall (a : E) (r : ℝ) : Convex ℝ (Metric.closedBall a r) := by simpa only [Metric.closedBall, sep_univ] using (convexOn_univ_dist a).convex_le r #align convex_closed_ball convex_closedBall theorem Convex.thickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (thickening δ s) := by rw [← add_ball_zero] exact hs.add (convex_ball 0 _) #align convex.thickening Convex.thickening theorem Convex.cthickening (hs : Convex ℝ s) (δ : ℝ) : Convex ℝ (cthickening δ s) := by obtain hδ | hδ := le_total 0 δ · rw [cthickening_eq_iInter_thickening hδ] exact convex_iInter₂ fun _ _ => hs.thickening _ · rw [cthickening_of_nonpos hδ] exact hs.closure #align convex.cthickening Convex.cthickening theorem convexHull_exists_dist_ge {s : Set E} {x : E} (hx : x ∈ convexHull ℝ s) (y : E) : ∃ x' ∈ s, dist x y ≤ dist x' y := (convexOn_dist y (convex_convexHull ℝ _)).exists_ge_of_mem_convexHull hx #align convex_hull_exists_dist_ge convexHull_exists_dist_ge theorem convexHull_exists_dist_ge2 {s t : Set E} {x y : E} (hx : x ∈ convexHull ℝ s) (hy : y ∈ convexHull ℝ t) : ∃ x' ∈ s, ∃ y' ∈ t, dist x y ≤ dist x' y' := by rcases convexHull_exists_dist_ge hx y with ⟨x', hx', Hx'⟩ rcases convexHull_exists_dist_ge hy x' with ⟨y', hy', Hy'⟩ use x', hx', y', hy' exact le_trans Hx' (dist_comm y x' ▸ dist_comm y' x' ▸ Hy') #align convex_hull_exists_dist_ge2 convexHull_exists_dist_ge2 @[simp] theorem convexHull_ediam (s : Set E) : EMetric.diam (convexHull ℝ s) = EMetric.diam s := by refine (EMetric.diam_le fun x hx y hy => ?_).antisymm (EMetric.diam_mono <| subset_convexHull ℝ s) rcases convexHull_exists_dist_ge2 hx hy with ⟨x', hx', y', hy', H⟩ rw [edist_dist] apply le_trans (ENNReal.ofReal_le_ofReal H) rw [← edist_dist] exact EMetric.edist_le_diam_of_mem hx' hy' #align convex_hull_ediam convexHull_ediam @[simp] theorem convexHull_diam (s : Set E) : Metric.diam (convexHull ℝ s) = Metric.diam s := by simp only [Metric.diam, convexHull_ediam] #align convex_hull_diam convexHull_diam @[simp] theorem isBounded_convexHull {s : Set E} : Bornology.IsBounded (convexHull ℝ s) ↔ Bornology.IsBounded s := by simp only [Metric.isBounded_iff_ediam_ne_top, convexHull_ediam] #align bounded_convex_hull isBounded_convexHull instance (priority := 100) NormedSpace.instPathConnectedSpace : PathConnectedSpace E := TopologicalAddGroup.pathConnectedSpace #align normed_space.path_connected NormedSpace.instPathConnectedSpace instance (priority := 100) NormedSpace.instLocPathConnectedSpace : LocPathConnectedSpace E := locPathConnected_of_bases (fun x => Metric.nhds_basis_ball) fun x r r_pos => (convex_ball x r).isPathConnected <| by simp [r_pos] #align normed_space.loc_path_connected NormedSpace.instLocPathConnectedSpace
Mathlib/Analysis/Convex/Normed.lean
133
136
theorem Wbtw.dist_add_dist {x y z : P} (h : Wbtw ℝ x y z) : dist x y + dist y z = dist x z := by
obtain ⟨a, ⟨ha₀, ha₁⟩, rfl⟩ := h simp [abs_of_nonneg, ha₀, ha₁, sub_mul]
import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform import Mathlib.Analysis.Fourier.PoissonSummation open Real Set MeasureTheory Filter Asymptotics intervalIntegral open scoped Real Topology FourierTransform RealInnerProductSpace open Complex hiding exp continuous_exp abs_of_nonneg sq_abs noncomputable section section GaussianPoisson variable {E : Type*} [NormedAddCommGroup E] lemma rexp_neg_quadratic_isLittleO_rpow_atTop {a : ℝ} (ha : a < 0) (b s : ℝ) : (fun x ↦ rexp (a * x ^ 2 + b * x)) =o[atTop] (· ^ s) := by suffices (fun x ↦ rexp (a * x ^ 2 + b * x)) =o[atTop] (fun x ↦ rexp (-x)) by refine this.trans ?_ simpa only [neg_one_mul] using isLittleO_exp_neg_mul_rpow_atTop zero_lt_one s rw [isLittleO_exp_comp_exp_comp] have : (fun x ↦ -x - (a * x ^ 2 + b * x)) = fun x ↦ x * (-a * x - (b + 1)) := by ext1 x; ring_nf rw [this] exact tendsto_id.atTop_mul_atTop <| Filter.tendsto_atTop_add_const_right _ _ <| tendsto_id.const_mul_atTop (neg_pos.mpr ha) lemma cexp_neg_quadratic_isLittleO_rpow_atTop {a : ℂ} (ha : a.re < 0) (b : ℂ) (s : ℝ) : (fun x : ℝ ↦ cexp (a * x ^ 2 + b * x)) =o[atTop] (· ^ s) := by apply Asymptotics.IsLittleO.of_norm_left convert rexp_neg_quadratic_isLittleO_rpow_atTop ha b.re s with x simp_rw [Complex.norm_eq_abs, Complex.abs_exp, add_re, ← ofReal_pow, mul_comm (_ : ℂ) ↑(_ : ℝ), re_ofReal_mul, mul_comm _ (re _)] lemma cexp_neg_quadratic_isLittleO_abs_rpow_cocompact {a : ℂ} (ha : a.re < 0) (b : ℂ) (s : ℝ) : (fun x : ℝ ↦ cexp (a * x ^ 2 + b * x)) =o[cocompact ℝ] (|·| ^ s) := by rw [cocompact_eq_atBot_atTop, isLittleO_sup] constructor · refine ((cexp_neg_quadratic_isLittleO_rpow_atTop ha (-b) s).comp_tendsto Filter.tendsto_neg_atBot_atTop).congr' (eventually_of_forall fun x ↦ ?_) ?_ · simp only [neg_mul, Function.comp_apply, ofReal_neg, neg_sq, mul_neg, neg_neg] · refine (eventually_lt_atBot 0).mp (eventually_of_forall fun x hx ↦ ?_) simp only [Function.comp_apply, abs_of_neg hx] · refine (cexp_neg_quadratic_isLittleO_rpow_atTop ha b s).congr' EventuallyEq.rfl ?_ refine (eventually_gt_atTop 0).mp (eventually_of_forall fun x hx ↦ ?_) simp_rw [abs_of_pos hx] theorem tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact {a : ℝ} (ha : 0 < a) (s : ℝ) : Tendsto (fun x : ℝ => |x| ^ s * rexp (-a * x ^ 2)) (cocompact ℝ) (𝓝 0) := by conv in rexp _ => rw [← sq_abs] erw [cocompact_eq_atBot_atTop, ← comap_abs_atTop, @tendsto_comap'_iff _ _ _ (fun y => y ^ s * rexp (-a * y ^ 2)) _ _ _ (mem_atTop_sets.mpr ⟨0, fun b hb => ⟨b, abs_of_nonneg hb⟩⟩)] exact (rpow_mul_exp_neg_mul_sq_isLittleO_exp_neg ha s).tendsto_zero_of_tendsto (tendsto_exp_atBot.comp <| tendsto_id.const_mul_atTop_of_neg (neg_lt_zero.mpr one_half_pos)) #align tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact tendsto_rpow_abs_mul_exp_neg_mul_sq_cocompact
Mathlib/Analysis/SpecialFunctions/Gaussian/PoissonSummation.lean
79
83
theorem isLittleO_exp_neg_mul_sq_cocompact {a : ℂ} (ha : 0 < a.re) (s : ℝ) : (fun x : ℝ => Complex.exp (-a * x ^ 2)) =o[cocompact ℝ] fun x : ℝ => |x| ^ s := by
convert cexp_neg_quadratic_isLittleO_abs_rpow_cocompact (?_ : (-a).re < 0) 0 s using 1 · simp_rw [zero_mul, add_zero] · rwa [neg_re, neg_lt_zero]
import Mathlib.CategoryTheory.Sites.SheafOfTypes import Mathlib.Order.Closure #align_import category_theory.sites.closed from "leanprover-community/mathlib"@"4cfc30e317caad46858393f1a7a33f609296cc30" universe v u namespace CategoryTheory variable {C : Type u} [Category.{v} C] variable (J₁ J₂ : GrothendieckTopology C) namespace GrothendieckTopology @[simps] def close {X : C} (S : Sieve X) : Sieve X where arrows _ f := J₁.Covers S f downward_closed hS := J₁.arrow_stable _ _ hS #align category_theory.grothendieck_topology.close CategoryTheory.GrothendieckTopology.close theorem le_close {X : C} (S : Sieve X) : S ≤ J₁.close S := fun _ _ hg => J₁.covering_of_eq_top (S.pullback_eq_top_of_mem hg) #align category_theory.grothendieck_topology.le_close CategoryTheory.GrothendieckTopology.le_close def IsClosed {X : C} (S : Sieve X) : Prop := ∀ ⦃Y : C⦄ (f : Y ⟶ X), J₁.Covers S f → S f #align category_theory.grothendieck_topology.is_closed CategoryTheory.GrothendieckTopology.IsClosed theorem covers_iff_mem_of_isClosed {X : C} {S : Sieve X} (h : J₁.IsClosed S) {Y : C} (f : Y ⟶ X) : J₁.Covers S f ↔ S f := ⟨h _, J₁.arrow_max _ _⟩ #align category_theory.grothendieck_topology.covers_iff_mem_of_closed CategoryTheory.GrothendieckTopology.covers_iff_mem_of_isClosed theorem isClosed_pullback {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.IsClosed S → J₁.IsClosed (S.pullback f) := fun hS Z g hg => hS (g ≫ f) (by rwa [J₁.covers_iff, Sieve.pullback_comp]) #align category_theory.grothendieck_topology.is_closed_pullback CategoryTheory.GrothendieckTopology.isClosed_pullback theorem le_close_of_isClosed {X : C} {S T : Sieve X} (h : S ≤ T) (hT : J₁.IsClosed T) : J₁.close S ≤ T := fun _ f hf => hT _ (J₁.superset_covering (Sieve.pullback_monotone f h) hf) #align category_theory.grothendieck_topology.le_close_of_is_closed CategoryTheory.GrothendieckTopology.le_close_of_isClosed theorem close_isClosed {X : C} (S : Sieve X) : J₁.IsClosed (J₁.close S) := fun _ g hg => J₁.arrow_trans g _ S hg fun _ hS => hS #align category_theory.grothendieck_topology.close_is_closed CategoryTheory.GrothendieckTopology.close_isClosed @[simps! isClosed] def closureOperator (X : C) : ClosureOperator (Sieve X) := .ofPred J₁.close J₁.IsClosed J₁.le_close J₁.close_isClosed fun _ _ ↦ J₁.le_close_of_isClosed #align category_theory.grothendieck_topology.closure_operator CategoryTheory.GrothendieckTopology.closureOperator #align category_theory.grothendieck_topology.closed_iff_closed CategoryTheory.GrothendieckTopology.closureOperator_isClosed theorem isClosed_iff_close_eq_self {X : C} (S : Sieve X) : J₁.IsClosed S ↔ J₁.close S = S := (J₁.closureOperator _).isClosed_iff #align category_theory.grothendieck_topology.is_closed_iff_close_eq_self CategoryTheory.GrothendieckTopology.isClosed_iff_close_eq_self theorem close_eq_self_of_isClosed {X : C} {S : Sieve X} (hS : J₁.IsClosed S) : J₁.close S = S := (J₁.isClosed_iff_close_eq_self S).1 hS #align category_theory.grothendieck_topology.close_eq_self_of_is_closed CategoryTheory.GrothendieckTopology.close_eq_self_of_isClosed
Mathlib/CategoryTheory/Sites/Closed.lean
124
132
theorem pullback_close {X Y : C} (f : Y ⟶ X) (S : Sieve X) : J₁.close (S.pullback f) = (J₁.close S).pullback f := by
apply le_antisymm · refine J₁.le_close_of_isClosed (Sieve.pullback_monotone _ (J₁.le_close S)) ?_ apply J₁.isClosed_pullback _ _ (J₁.close_isClosed _) · intro Z g hg change _ ∈ J₁ _ rw [← Sieve.pullback_comp] apply hg
import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Data.Int.Log #align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690" open Set Filter Function open Topology noncomputable section namespace Real variable {b x y : ℝ} -- @[pp_nodot] -- Porting note: removed noncomputable def logb (b x : ℝ) : ℝ := log x / log b #align real.logb Real.logb theorem log_div_log : log x / log b = logb b x := rfl #align real.log_div_log Real.log_div_log @[simp] theorem logb_zero : logb b 0 = 0 := by simp [logb] #align real.logb_zero Real.logb_zero @[simp] theorem logb_one : logb b 1 = 0 := by simp [logb] #align real.logb_one Real.logb_one @[simp] lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 := div_self (log_pos hb).ne' lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 := Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero @[simp] theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs] #align real.logb_abs Real.logb_abs @[simp] theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by rw [← logb_abs x, ← logb_abs (-x), abs_neg] #align real.logb_neg_eq_logb Real.logb_neg_eq_logb theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by simp_rw [logb, log_mul hx hy, add_div] #align real.logb_mul Real.logb_mul theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by simp_rw [logb, log_div hx hy, sub_div] #align real.logb_div Real.logb_div @[simp] theorem logb_inv (x : ℝ) : logb b x⁻¹ = -logb b x := by simp [logb, neg_div] #align real.logb_inv Real.logb_inv theorem inv_logb (a b : ℝ) : (logb a b)⁻¹ = logb b a := by simp_rw [logb, inv_div] #align real.inv_logb Real.inv_logb theorem inv_logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a * b) c)⁻¹ = (logb a c)⁻¹ + (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_mul h₁ h₂ #align real.inv_logb_mul_base Real.inv_logb_mul_base theorem inv_logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : (logb (a / b) c)⁻¹ = (logb a c)⁻¹ - (logb b c)⁻¹ := by simp_rw [inv_logb]; exact logb_div h₁ h₂ #align real.inv_logb_div_base Real.inv_logb_div_base theorem logb_mul_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a * b) c = ((logb a c)⁻¹ + (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_mul_base h₁ h₂ c, inv_inv] #align real.logb_mul_base Real.logb_mul_base theorem logb_div_base {a b : ℝ} (h₁ : a ≠ 0) (h₂ : b ≠ 0) (c : ℝ) : logb (a / b) c = ((logb a c)⁻¹ - (logb b c)⁻¹)⁻¹ := by rw [← inv_logb_div_base h₁ h₂ c, inv_inv] #align real.logb_div_base Real.logb_div_base theorem mul_logb {a b c : ℝ} (h₁ : b ≠ 0) (h₂ : b ≠ 1) (h₃ : b ≠ -1) : logb a b * logb b c = logb a c := by unfold logb rw [mul_comm, div_mul_div_cancel _ (log_ne_zero.mpr ⟨h₁, h₂, h₃⟩)] #align real.mul_logb Real.mul_logb theorem div_logb {a b c : ℝ} (h₁ : c ≠ 0) (h₂ : c ≠ 1) (h₃ : c ≠ -1) : logb a c / logb b c = logb a b := div_div_div_cancel_left' _ _ <| log_ne_zero.mpr ⟨h₁, h₂, h₃⟩ #align real.div_logb Real.div_logb theorem logb_rpow_eq_mul_logb_of_pos (hx : 0 < x) : logb b (x ^ y) = y * logb b x := by rw [logb, log_rpow hx, logb, mul_div_assoc] theorem logb_pow {k : ℕ} (hx : 0 < x) : logb b (x ^ k) = k * logb b x := by rw [← rpow_natCast, logb_rpow_eq_mul_logb_of_pos hx] section BPosAndBLtOne variable (b_pos : 0 < b) (b_lt_one : b < 1) private theorem b_ne_one : b ≠ 1 := by linarith @[simp] theorem logb_le_logb_of_base_lt_one (h : 0 < x) (h₁ : 0 < y) : logb b x ≤ logb b y ↔ y ≤ x := by rw [logb, logb, div_le_div_right_of_neg (log_neg b_pos b_lt_one), log_le_log_iff h₁ h] #align real.logb_le_logb_of_base_lt_one Real.logb_le_logb_of_base_lt_one
Mathlib/Analysis/SpecialFunctions/Log/Base.lean
312
314
theorem logb_lt_logb_of_base_lt_one (hx : 0 < x) (hxy : x < y) : logb b y < logb b x := by
rw [logb, logb, div_lt_div_right_of_neg (log_neg b_pos b_lt_one)] exact log_lt_log hx hxy
import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.Asymptotics.Asymptotics import Mathlib.Analysis.NormedSpace.Basic #align_import analysis.asymptotics.specific_asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Asymptotics open Topology section LinearOrderedField variable {𝕜 : Type*} [LinearOrderedField 𝕜] theorem pow_div_pow_eventuallyEq_atTop {p q : ℕ} : (fun x : 𝕜 => x ^ p / x ^ q) =ᶠ[atTop] fun x => x ^ ((p : ℤ) - q) := by apply (eventually_gt_atTop (0 : 𝕜)).mono fun x hx => _ intro x hx simp [zpow_sub₀ hx.ne'] #align pow_div_pow_eventually_eq_at_top pow_div_pow_eventuallyEq_atTop theorem pow_div_pow_eventuallyEq_atBot {p q : ℕ} : (fun x : 𝕜 => x ^ p / x ^ q) =ᶠ[atBot] fun x => x ^ ((p : ℤ) - q) := by apply (eventually_lt_atBot (0 : 𝕜)).mono fun x hx => _ intro x hx simp [zpow_sub₀ hx.ne] #align pow_div_pow_eventually_eq_at_bot pow_div_pow_eventuallyEq_atBot
Mathlib/Analysis/Asymptotics/SpecificAsymptotics.lean
56
60
theorem tendsto_pow_div_pow_atTop_atTop {p q : ℕ} (hpq : q < p) : Tendsto (fun x : 𝕜 => x ^ p / x ^ q) atTop atTop := by
rw [tendsto_congr' pow_div_pow_eventuallyEq_atTop] apply tendsto_zpow_atTop_atTop omega
import Mathlib.Combinatorics.SimpleGraph.DegreeSum import Mathlib.Combinatorics.SimpleGraph.Subgraph #align_import combinatorics.simple_graph.matching from "leanprover-community/mathlib"@"138448ae98f529ef34eeb61114191975ee2ca508" universe u namespace SimpleGraph variable {V : Type u} {G : SimpleGraph V} (M : Subgraph G) namespace Subgraph def IsMatching : Prop := ∀ ⦃v⦄, v ∈ M.verts → ∃! w, M.Adj v w #align simple_graph.subgraph.is_matching SimpleGraph.Subgraph.IsMatching noncomputable def IsMatching.toEdge {M : Subgraph G} (h : M.IsMatching) (v : M.verts) : M.edgeSet := ⟨s(v, (h v.property).choose), (h v.property).choose_spec.1⟩ #align simple_graph.subgraph.is_matching.to_edge SimpleGraph.Subgraph.IsMatching.toEdge theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V} (hv : v ∈ M.verts) (hvw : M.Adj v w) : h.toEdge ⟨v, hv⟩ = ⟨s(v, w), hvw⟩ := by simp only [IsMatching.toEdge, Subtype.mk_eq_mk] congr exact ((h (M.edge_vert hvw)).choose_spec.2 w hvw).symm #align simple_graph.subgraph.is_matching.to_edge_eq_of_adj SimpleGraph.Subgraph.IsMatching.toEdge_eq_of_adj
Mathlib/Combinatorics/SimpleGraph/Matching.lean
70
74
theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) : Function.Surjective h.toEdge := by
rintro ⟨e, he⟩ refine Sym2.ind (fun x y he => ?_) e he exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩
import Mathlib.Computability.DFA import Mathlib.Data.Fintype.Powerset #align_import computability.NFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" open Set open Computability universe u v -- Porting note: Required as `NFA` is used in mathlib3 set_option linter.uppercaseLean3 false structure NFA (α : Type u) (σ : Type v) where step : σ → α → Set σ start : Set σ accept : Set σ #align NFA NFA variable {α : Type u} {σ σ' : Type v} (M : NFA α σ) namespace NFA instance : Inhabited (NFA α σ) := ⟨NFA.mk (fun _ _ => ∅) ∅ ∅⟩ def stepSet (S : Set σ) (a : α) : Set σ := ⋃ s ∈ S, M.step s a #align NFA.step_set NFA.stepSet theorem mem_stepSet (s : σ) (S : Set σ) (a : α) : s ∈ M.stepSet S a ↔ ∃ t ∈ S, s ∈ M.step t a := by simp [stepSet] #align NFA.mem_step_set NFA.mem_stepSet @[simp] theorem stepSet_empty (a : α) : M.stepSet ∅ a = ∅ := by simp [stepSet] #align NFA.step_set_empty NFA.stepSet_empty def evalFrom (start : Set σ) : List α → Set σ := List.foldl M.stepSet start #align NFA.eval_from NFA.evalFrom @[simp] theorem evalFrom_nil (S : Set σ) : M.evalFrom S [] = S := rfl #align NFA.eval_from_nil NFA.evalFrom_nil @[simp] theorem evalFrom_singleton (S : Set σ) (a : α) : M.evalFrom S [a] = M.stepSet S a := rfl #align NFA.eval_from_singleton NFA.evalFrom_singleton @[simp]
Mathlib/Computability/NFA.lean
78
80
theorem evalFrom_append_singleton (S : Set σ) (x : List α) (a : α) : M.evalFrom S (x ++ [a]) = M.stepSet (M.evalFrom S x) a := by
simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.FieldTheory.Finite.Trace import Mathlib.Algebra.Group.AddChar import Mathlib.Data.ZMod.Units import Mathlib.Analysis.Complex.Polynomial #align_import number_theory.legendre_symbol.add_character from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472" universe u v namespace AddChar section Additive -- The domain and target of our additive characters. Now we restrict to a ring in the domain. variable {R : Type u} [CommRing R] {R' : Type v} [CommMonoid R'] lemma val_mem_rootsOfUnity (φ : AddChar R R') (a : R) (h : 0 < ringChar R) : (φ.val_isUnit a).unit ∈ rootsOfUnity (ringChar R).toPNat' R' := by simp only [mem_rootsOfUnity', IsUnit.unit_spec, Nat.toPNat'_coe, h, ↓reduceIte, ← map_nsmul_eq_pow, nsmul_eq_mul, CharP.cast_eq_zero, zero_mul, map_zero_eq_one] def IsPrimitive (ψ : AddChar R R') : Prop := ∀ a : R, a ≠ 0 → IsNontrivial (mulShift ψ a) #align add_char.is_primitive AddChar.IsPrimitive lemma IsPrimitive.compMulHom_of_isPrimitive {R'' : Type*} [CommMonoid R''] {φ : AddChar R R'} {f : R' →* R''} (hφ : φ.IsPrimitive) (hf : Function.Injective f) : (f.compAddChar φ).IsPrimitive := by intro a a_ne_zero obtain ⟨r, ne_one⟩ := hφ a a_ne_zero rw [mulShift_apply] at ne_one simp only [IsNontrivial, mulShift_apply, f.coe_compAddChar, Function.comp_apply] exact ⟨r, fun H ↦ ne_one <| hf <| f.map_one ▸ H⟩ theorem to_mulShift_inj_of_isPrimitive {ψ : AddChar R R'} (hψ : IsPrimitive ψ) : Function.Injective ψ.mulShift := by intro a b h apply_fun fun x => x * mulShift ψ (-b) at h simp only [mulShift_mul, mulShift_zero, add_right_neg] at h have h₂ := hψ (a + -b) rw [h, isNontrivial_iff_ne_trivial, ← sub_eq_add_neg, sub_ne_zero] at h₂ exact not_not.mp fun h => h₂ h rfl #align add_char.to_mul_shift_inj_of_is_primitive AddChar.to_mulShift_inj_of_isPrimitive -- `AddCommGroup.equiv_direct_sum_zmod_of_fintype` -- gives the structure theorem for finite abelian groups. -- This could be used to show that the map above is a bijection. -- We leave this for a later occasion. theorem IsNontrivial.isPrimitive {F : Type u} [Field F] {ψ : AddChar F R'} (hψ : IsNontrivial ψ) : IsPrimitive ψ := by intro a ha cases' hψ with x h use a⁻¹ * x rwa [mulShift_apply, mul_inv_cancel_left₀ ha] #align add_char.is_nontrivial.is_primitive AddChar.IsNontrivial.isPrimitive lemma not_isPrimitive_mulShift [Finite R] (e : AddChar R R') {r : R} (hr : ¬ IsUnit r) : ¬ IsPrimitive (e.mulShift r) := by simp only [IsPrimitive, not_forall] simp only [isUnit_iff_mem_nonZeroDivisors_of_finite, mem_nonZeroDivisors_iff, not_forall] at hr rcases hr with ⟨x, h, h'⟩ exact ⟨x, h', by simp only [mulShift_mulShift, mul_comm r, h, mulShift_zero, not_ne_iff, isNontrivial_iff_ne_trivial]⟩ -- Porting note(#5171): this linter isn't ported yet. -- can't prove that they always exist (referring to providing an `Inhabited` instance) -- @[nolint has_nonempty_instance] structure PrimitiveAddChar (R : Type u) [CommRing R] (R' : Type v) [Field R'] where n : ℕ+ char : AddChar R (CyclotomicField n R') prim : IsPrimitive char #align add_char.primitive_add_char AddChar.PrimitiveAddChar #align add_char.primitive_add_char.n AddChar.PrimitiveAddChar.n #align add_char.primitive_add_char.char AddChar.PrimitiveAddChar.char #align add_char.primitive_add_char.prim AddChar.PrimitiveAddChar.prim section ZModChar variable {C : Type v} [CommMonoid C] theorem zmod_char_isNontrivial_iff (n : ℕ+) (ψ : AddChar (ZMod n) C) : IsNontrivial ψ ↔ ψ 1 ≠ 1 := by refine ⟨?_, fun h => ⟨1, h⟩⟩ contrapose! rintro h₁ ⟨a, ha⟩ have ha₁ : a = a.val • (1 : ZMod ↑n) := by rw [nsmul_eq_mul, mul_one]; exact (ZMod.natCast_zmod_val a).symm rw [ha₁, map_nsmul_eq_pow, h₁, one_pow] at ha exact ha rfl #align add_char.zmod_char_is_nontrivial_iff AddChar.zmod_char_isNontrivial_iff theorem IsPrimitive.zmod_char_eq_one_iff (n : ℕ+) {ψ : AddChar (ZMod n) C} (hψ : IsPrimitive ψ) (a : ZMod n) : ψ a = 1 ↔ a = 0 := by refine ⟨fun h => not_imp_comm.mp (hψ a) ?_, fun ha => by rw [ha, map_zero_eq_one]⟩ rw [zmod_char_isNontrivial_iff n (mulShift ψ a), mulShift_apply, mul_one, h, Classical.not_not] #align add_char.is_primitive.zmod_char_eq_one_iff AddChar.IsPrimitive.zmod_char_eq_one_iff
Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean
197
203
theorem zmod_char_primitive_of_eq_one_only_at_zero (n : ℕ) (ψ : AddChar (ZMod n) C) (hψ : ∀ a, ψ a = 1 → a = 0) : IsPrimitive ψ := by
refine fun a ha => (isNontrivial_iff_ne_trivial _).mpr fun hf => ?_ have h : mulShift ψ a 1 = (1 : AddChar (ZMod n) C) (1 : ZMod n) := congr_fun (congr_arg (↑) hf) 1 rw [mulShift_apply, mul_one] at h; norm_cast at h exact ha (hψ a h)
import Mathlib.Algebra.Lie.BaseChange import Mathlib.Algebra.Lie.Solvable import Mathlib.Algebra.Lie.Quotient import Mathlib.Algebra.Lie.Normalizer import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.Order.Filter.AtTopBot import Mathlib.RingTheory.Artinian import Mathlib.RingTheory.Nilpotent.Lemmas import Mathlib.Tactic.Monotonicity #align_import algebra.lie.nilpotent from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1" universe u v w w₁ w₂ section NilpotentModules variable {R : Type u} {L : Type v} {M : Type w} variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M] variable [LieRingModule L M] [LieModule R L M] variable (k : ℕ) (N : LieSubmodule R L M) namespace LieSubmodule variable {N₁ N₂ : LieSubmodule R L M} def ucs (k : ℕ) : LieSubmodule R L M → LieSubmodule R L M := normalizer^[k] #align lie_submodule.ucs LieSubmodule.ucs @[simp] theorem ucs_zero : N.ucs 0 = N := rfl #align lie_submodule.ucs_zero LieSubmodule.ucs_zero @[simp] theorem ucs_succ (k : ℕ) : N.ucs (k + 1) = (N.ucs k).normalizer := Function.iterate_succ_apply' normalizer k N #align lie_submodule.ucs_succ LieSubmodule.ucs_succ theorem ucs_add (k l : ℕ) : N.ucs (k + l) = (N.ucs l).ucs k := Function.iterate_add_apply normalizer k l N #align lie_submodule.ucs_add LieSubmodule.ucs_add @[mono]
Mathlib/Algebra/Lie/Nilpotent.lean
485
490
theorem ucs_mono (k : ℕ) (h : N₁ ≤ N₂) : N₁.ucs k ≤ N₂.ucs k := by
induction' k with k ih · simpa simp only [ucs_succ] -- Porting note: `mono` makes no progress apply monotone_normalizer ih
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast
Mathlib/RingTheory/Polynomial/Pochhammer.lean
110
113
theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by
cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left]
import Mathlib.Algebra.Polynomial.Degree.Definitions #align_import ring_theory.polynomial.opposites from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial open Polynomial MulOpposite variable {R : Type*} [Semiring R] noncomputable section namespace Polynomial def opRingEquiv (R : Type*) [Semiring R] : R[X]ᵐᵒᵖ ≃+* Rᵐᵒᵖ[X] := ((toFinsuppIso R).op.trans AddMonoidAlgebra.opRingEquiv).trans (toFinsuppIso _).symm #align polynomial.op_ring_equiv Polynomial.opRingEquiv @[simp]
Mathlib/RingTheory/Polynomial/Opposites.lean
38
42
theorem opRingEquiv_op_monomial (n : ℕ) (r : R) : opRingEquiv R (op (monomial n r : R[X])) = monomial n (op r) := by
simp only [opRingEquiv, RingEquiv.coe_trans, Function.comp_apply, AddMonoidAlgebra.opRingEquiv_apply, RingEquiv.op_apply_apply, toFinsuppIso_apply, unop_op, toFinsupp_monomial, Finsupp.mapRange_single, toFinsuppIso_symm_apply, ofFinsupp_single]
import Mathlib.ModelTheory.Ultraproducts import Mathlib.ModelTheory.Bundled import Mathlib.ModelTheory.Skolem #align_import model_theory.satisfiability from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" set_option linter.uppercaseLean3 false universe u v w w' open Cardinal CategoryTheory open Cardinal FirstOrder namespace FirstOrder namespace Language variable {L : Language.{u, v}} {T : L.Theory} {α : Type w} {n : ℕ} namespace Theory variable (T) def IsSatisfiable : Prop := Nonempty (ModelType.{u, v, max u v} T) #align first_order.language.Theory.is_satisfiable FirstOrder.Language.Theory.IsSatisfiable def IsFinitelySatisfiable : Prop := ∀ T0 : Finset L.Sentence, (T0 : L.Theory) ⊆ T → IsSatisfiable (T0 : L.Theory) #align first_order.language.Theory.is_finitely_satisfiable FirstOrder.Language.Theory.IsFinitelySatisfiable variable {T} {T' : L.Theory} theorem Model.isSatisfiable (M : Type w) [Nonempty M] [L.Structure M] [M ⊨ T] : T.IsSatisfiable := ⟨((⊥ : Substructure _ (ModelType.of T M)).elementarySkolem₁Reduct.toModel T).shrink⟩ #align first_order.language.Theory.model.is_satisfiable FirstOrder.Language.Theory.Model.isSatisfiable theorem IsSatisfiable.mono (h : T'.IsSatisfiable) (hs : T ⊆ T') : T.IsSatisfiable := ⟨(Theory.Model.mono (ModelType.is_model h.some) hs).bundled⟩ #align first_order.language.Theory.is_satisfiable.mono FirstOrder.Language.Theory.IsSatisfiable.mono theorem isSatisfiable_empty (L : Language.{u, v}) : IsSatisfiable (∅ : L.Theory) := ⟨default⟩ #align first_order.language.Theory.is_satisfiable_empty FirstOrder.Language.Theory.isSatisfiable_empty theorem isSatisfiable_of_isSatisfiable_onTheory {L' : Language.{w, w'}} (φ : L →ᴸ L') (h : (φ.onTheory T).IsSatisfiable) : T.IsSatisfiable := Model.isSatisfiable (h.some.reduct φ) #align first_order.language.Theory.is_satisfiable_of_is_satisfiable_on_Theory FirstOrder.Language.Theory.isSatisfiable_of_isSatisfiable_onTheory theorem isSatisfiable_onTheory_iff {L' : Language.{w, w'}} {φ : L →ᴸ L'} (h : φ.Injective) : (φ.onTheory T).IsSatisfiable ↔ T.IsSatisfiable := by classical refine ⟨isSatisfiable_of_isSatisfiable_onTheory φ, fun h' => ?_⟩ haveI : Inhabited h'.some := Classical.inhabited_of_nonempty' exact Model.isSatisfiable (h'.some.defaultExpansion h) #align first_order.language.Theory.is_satisfiable_on_Theory_iff FirstOrder.Language.Theory.isSatisfiable_onTheory_iff theorem IsSatisfiable.isFinitelySatisfiable (h : T.IsSatisfiable) : T.IsFinitelySatisfiable := fun _ => h.mono #align first_order.language.Theory.is_satisfiable.is_finitely_satisfiable FirstOrder.Language.Theory.IsSatisfiable.isFinitelySatisfiable
Mathlib/ModelTheory/Satisfiability.lean
107
126
theorem isSatisfiable_iff_isFinitelySatisfiable {T : L.Theory} : T.IsSatisfiable ↔ T.IsFinitelySatisfiable := ⟨Theory.IsSatisfiable.isFinitelySatisfiable, fun h => by classical set M : Finset T → Type max u v := fun T0 : Finset T => (h (T0.map (Function.Embedding.subtype fun x => x ∈ T)) T0.map_subtype_subset).some.Carrier let M' := Filter.Product (Ultrafilter.of (Filter.atTop : Filter (Finset T))) M have h' : M' ⊨ T := by
refine ⟨fun φ hφ => ?_⟩ rw [Ultraproduct.sentence_realize] refine Filter.Eventually.filter_mono (Ultrafilter.of_le _) (Filter.eventually_atTop.2 ⟨{⟨φ, hφ⟩}, fun s h' => Theory.realize_sentence_of_mem (s.map (Function.Embedding.subtype fun x => x ∈ T)) ?_⟩) simp only [Finset.coe_map, Function.Embedding.coe_subtype, Set.mem_image, Finset.mem_coe, Subtype.exists, Subtype.coe_mk, exists_and_right, exists_eq_right] exact ⟨hφ, h' (Finset.mem_singleton_self _)⟩ exact ⟨ModelType.of T M'⟩⟩
import Mathlib.CategoryTheory.Sites.CompatiblePlus import Mathlib.CategoryTheory.Sites.ConcreteSheafification #align_import category_theory.sites.compatible_sheafification from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" namespace CategoryTheory.GrothendieckTopology open CategoryTheory open CategoryTheory.Limits open Opposite universe w₁ w₂ v u variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C) variable {D : Type w₁} [Category.{max v u} D] variable {E : Type w₂} [Category.{max v u} E] variable (F : D ⥤ E) -- Porting note: Removed this and made whatever necessary noncomputable -- noncomputable section variable [∀ (α β : Type max v u) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) D] variable [∀ (α β : Type max v u) (fst snd : β → α), HasLimitsOfShape (WalkingMulticospan fst snd) E] variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ D] variable [∀ X : C, HasColimitsOfShape (J.Cover X)ᵒᵖ E] variable [∀ X : C, PreservesColimitsOfShape (J.Cover X)ᵒᵖ F] variable [∀ (X : C) (W : J.Cover X) (P : Cᵒᵖ ⥤ D), PreservesLimit (W.index P).multicospan F] variable (P : Cᵒᵖ ⥤ D) noncomputable def sheafifyCompIso : J.sheafify P ⋙ F ≅ J.sheafify (P ⋙ F) := J.plusCompIso _ _ ≪≫ (J.plusFunctor _).mapIso (J.plusCompIso _ _) #align category_theory.grothendieck_topology.sheafify_comp_iso CategoryTheory.GrothendieckTopology.sheafifyCompIso noncomputable def sheafificationWhiskerLeftIso (P : Cᵒᵖ ⥤ D) [∀ (F : D ⥤ E) (X : C), PreservesColimitsOfShape (J.Cover X)ᵒᵖ F] [∀ (F : D ⥤ E) (X : C) (W : J.Cover X) (P : Cᵒᵖ ⥤ D), PreservesLimit (W.index P).multicospan F] : (whiskeringLeft _ _ E).obj (J.sheafify P) ≅ (whiskeringLeft _ _ _).obj P ⋙ J.sheafification E := by refine J.plusFunctorWhiskerLeftIso _ ≪≫ ?_ ≪≫ Functor.associator _ _ _ refine isoWhiskerRight ?_ _ exact J.plusFunctorWhiskerLeftIso _ #align category_theory.grothendieck_topology.sheafification_whisker_left_iso CategoryTheory.GrothendieckTopology.sheafificationWhiskerLeftIso @[simp] theorem sheafificationWhiskerLeftIso_hom_app (P : Cᵒᵖ ⥤ D) (F : D ⥤ E) [∀ (F : D ⥤ E) (X : C), PreservesColimitsOfShape (J.Cover X)ᵒᵖ F] [∀ (F : D ⥤ E) (X : C) (W : J.Cover X) (P : Cᵒᵖ ⥤ D), PreservesLimit (W.index P).multicospan F] : (sheafificationWhiskerLeftIso J P).hom.app F = (J.sheafifyCompIso F P).hom := by dsimp [sheafificationWhiskerLeftIso, sheafifyCompIso] rw [Category.comp_id] #align category_theory.grothendieck_topology.sheafification_whisker_left_iso_hom_app CategoryTheory.GrothendieckTopology.sheafificationWhiskerLeftIso_hom_app @[simp] theorem sheafificationWhiskerLeftIso_inv_app (P : Cᵒᵖ ⥤ D) (F : D ⥤ E) [∀ (F : D ⥤ E) (X : C), PreservesColimitsOfShape (J.Cover X)ᵒᵖ F] [∀ (F : D ⥤ E) (X : C) (W : J.Cover X) (P : Cᵒᵖ ⥤ D), PreservesLimit (W.index P).multicospan F] : (sheafificationWhiskerLeftIso J P).inv.app F = (J.sheafifyCompIso F P).inv := by dsimp [sheafificationWhiskerLeftIso, sheafifyCompIso] erw [Category.id_comp] #align category_theory.grothendieck_topology.sheafification_whisker_left_iso_inv_app CategoryTheory.GrothendieckTopology.sheafificationWhiskerLeftIso_inv_app noncomputable def sheafificationWhiskerRightIso : J.sheafification D ⋙ (whiskeringRight _ _ _).obj F ≅ (whiskeringRight _ _ _).obj F ⋙ J.sheafification E := by refine Functor.associator _ _ _ ≪≫ ?_ refine isoWhiskerLeft (J.plusFunctor D) (J.plusFunctorWhiskerRightIso _) ≪≫ ?_ refine ?_ ≪≫ Functor.associator _ _ _ refine (Functor.associator _ _ _).symm ≪≫ ?_ exact isoWhiskerRight (J.plusFunctorWhiskerRightIso _) (J.plusFunctor E) #align category_theory.grothendieck_topology.sheafification_whisker_right_iso CategoryTheory.GrothendieckTopology.sheafificationWhiskerRightIso @[simp] theorem sheafificationWhiskerRightIso_hom_app : (J.sheafificationWhiskerRightIso F).hom.app P = (J.sheafifyCompIso F P).hom := by dsimp [sheafificationWhiskerRightIso, sheafifyCompIso] simp only [Category.id_comp, Category.comp_id] erw [Category.id_comp] #align category_theory.grothendieck_topology.sheafification_whisker_right_iso_hom_app CategoryTheory.GrothendieckTopology.sheafificationWhiskerRightIso_hom_app @[simp]
Mathlib/CategoryTheory/Sites/CompatibleSheafification.lean
110
114
theorem sheafificationWhiskerRightIso_inv_app : (J.sheafificationWhiskerRightIso F).inv.app P = (J.sheafifyCompIso F P).inv := by
dsimp [sheafificationWhiskerRightIso, sheafifyCompIso] simp only [Category.id_comp, Category.comp_id] erw [Category.id_comp]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Data.Complex.Exponential import Mathlib.Data.Complex.Module import Mathlib.RingTheory.Polynomial.Chebyshev #align_import analysis.special_functions.trigonometric.chebyshev from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" set_option linter.uppercaseLean3 false namespace Polynomial.Chebyshev open Polynomial variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Chebyshev.lean
29
30
theorem aeval_T (x : A) (n : ℤ) : aeval x (T R n) = (T A n).eval x := by
rw [aeval_def, eval₂_eq_eval_map, map_T]
import Mathlib.Algebra.Polynomial.Identities import Mathlib.Analysis.SpecificLimits.Basic import Mathlib.NumberTheory.Padics.PadicIntegers import Mathlib.Topology.Algebra.Polynomial import Mathlib.Topology.MetricSpace.CauSeqFilter #align_import number_theory.padics.hensel from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" noncomputable section open scoped Classical open Topology -- We begin with some general lemmas that are used below in the computation.
Mathlib/NumberTheory/Padics/Hensel.lean
43
49
theorem padic_polynomial_dist {p : ℕ} [Fact p.Prime] (F : Polynomial ℤ_[p]) (x y : ℤ_[p]) : ‖F.eval x - F.eval y‖ ≤ ‖x - y‖ := let ⟨z, hz⟩ := F.evalSubFactor x y calc ‖F.eval x - F.eval y‖ = ‖z‖ * ‖x - y‖ := by
simp [hz] _ ≤ 1 * ‖x - y‖ := by gcongr; apply PadicInt.norm_le_one _ = ‖x - y‖ := by simp
import Mathlib.MeasureTheory.Integral.SetIntegral #align_import measure_theory.integral.average from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open ENNReal MeasureTheory MeasureTheory.Measure Metric Set Filter TopologicalSpace Function open scoped Topology ENNReal Convex variable {α E F : Type*} {m0 : MeasurableSpace α} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {μ ν : Measure α} {s t : Set α} namespace MeasureTheory section NormedAddCommGroup variable (μ) variable {f g : α → E} noncomputable def average (f : α → E) := ∫ x, f x ∂(μ univ)⁻¹ • μ #align measure_theory.average MeasureTheory.average notation3 "⨍ "(...)", "r:60:(scoped f => f)" ∂"μ:70 => average μ r notation3 "⨍ "(...)", "r:60:(scoped f => average volume f) => r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => f)" ∂"μ:70 => average (Measure.restrict μ s) r notation3 "⨍ "(...)" in "s", "r:60:(scoped f => average (Measure.restrict volume s) f) => r @[simp] theorem average_zero : ⨍ _, (0 : E) ∂μ = 0 := by rw [average, integral_zero] #align measure_theory.average_zero MeasureTheory.average_zero @[simp] theorem average_zero_measure (f : α → E) : ⨍ x, f x ∂(0 : Measure α) = 0 := by rw [average, smul_zero, integral_zero_measure] #align measure_theory.average_zero_measure MeasureTheory.average_zero_measure @[simp] theorem average_neg (f : α → E) : ⨍ x, -f x ∂μ = -⨍ x, f x ∂μ := integral_neg f #align measure_theory.average_neg MeasureTheory.average_neg theorem average_eq' (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂(μ univ)⁻¹ • μ := rfl #align measure_theory.average_eq' MeasureTheory.average_eq' theorem average_eq (f : α → E) : ⨍ x, f x ∂μ = (μ univ).toReal⁻¹ • ∫ x, f x ∂μ := by rw [average_eq', integral_smul_measure, ENNReal.toReal_inv] #align measure_theory.average_eq MeasureTheory.average_eq theorem average_eq_integral [IsProbabilityMeasure μ] (f : α → E) : ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by rw [average, measure_univ, inv_one, one_smul] #align measure_theory.average_eq_integral MeasureTheory.average_eq_integral @[simp] theorem measure_smul_average [IsFiniteMeasure μ] (f : α → E) : (μ univ).toReal • ⨍ x, f x ∂μ = ∫ x, f x ∂μ := by rcases eq_or_ne μ 0 with hμ | hμ · rw [hμ, integral_zero_measure, average_zero_measure, smul_zero] · rw [average_eq, smul_inv_smul₀] refine (ENNReal.toReal_pos ?_ <| measure_ne_top _ _).ne' rwa [Ne, measure_univ_eq_zero] #align measure_theory.measure_smul_average MeasureTheory.measure_smul_average
Mathlib/MeasureTheory/Integral/Average.lean
350
351
theorem setAverage_eq (f : α → E) (s : Set α) : ⨍ x in s, f x ∂μ = (μ s).toReal⁻¹ • ∫ x in s, f x ∂μ := by
rw [average_eq, restrict_apply_univ]
import Mathlib.Data.Multiset.Bind #align_import data.multiset.pi from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9" namespace Multiset section Pi variable {α : Type*} open Function def Pi.empty (δ : α → Sort*) : ∀ a ∈ (0 : Multiset α), δ a := nofun #align multiset.pi.empty Multiset.Pi.empty universe u v variable [DecidableEq α] {β : α → Type u} {δ : α → Sort v} def Pi.cons (m : Multiset α) (a : α) (b : δ a) (f : ∀ a ∈ m, δ a) : ∀ a' ∈ a ::ₘ m, δ a' := fun a' ha' => if h : a' = a then Eq.ndrec b h.symm else f a' <| (mem_cons.1 ha').resolve_left h #align multiset.pi.cons Multiset.Pi.cons theorem Pi.cons_same {m : Multiset α} {a : α} {b : δ a} {f : ∀ a ∈ m, δ a} (h : a ∈ a ::ₘ m) : Pi.cons m a b f a h = b := dif_pos rfl #align multiset.pi.cons_same Multiset.Pi.cons_same theorem Pi.cons_ne {m : Multiset α} {a a' : α} {b : δ a} {f : ∀ a ∈ m, δ a} (h' : a' ∈ a ::ₘ m) (h : a' ≠ a) : Pi.cons m a b f a' h' = f a' ((mem_cons.1 h').resolve_left h) := dif_neg h #align multiset.pi.cons_ne Multiset.Pi.cons_ne theorem Pi.cons_swap {a a' : α} {b : δ a} {b' : δ a'} {m : Multiset α} {f : ∀ a ∈ m, δ a} (h : a ≠ a') : HEq (Pi.cons (a' ::ₘ m) a b (Pi.cons m a' b' f)) (Pi.cons (a ::ₘ m) a' b' (Pi.cons m a b f)) := by apply hfunext rfl simp only [heq_iff_eq] rintro a'' _ rfl refine hfunext (by rw [Multiset.cons_swap]) fun ha₁ ha₂ _ => ?_ rcases ne_or_eq a'' a with (h₁ | rfl) on_goal 1 => rcases eq_or_ne a'' a' with (rfl | h₂) all_goals simp [*, Pi.cons_same, Pi.cons_ne] #align multiset.pi.cons_swap Multiset.Pi.cons_swap @[simp, nolint simpNF] -- Porting note: false positive, this lemma can prove itself theorem pi.cons_eta {m : Multiset α} {a : α} (f : ∀ a' ∈ a ::ₘ m, δ a') : (Pi.cons m a (f _ (mem_cons_self _ _)) fun a' ha' => f a' (mem_cons_of_mem ha')) = f := by ext a' h' by_cases h : a' = a · subst h rw [Pi.cons_same] · rw [Pi.cons_ne _ h] #align multiset.pi.cons_eta Multiset.pi.cons_eta
Mathlib/Data/Multiset/Pi.lean
71
80
theorem Pi.cons_injective {a : α} {b : δ a} {s : Multiset α} (hs : a ∉ s) : Function.Injective (Pi.cons s a b) := fun f₁ f₂ eq => funext fun a' => funext fun h' => have ne : a ≠ a' := fun h => hs <| h.symm ▸ h' have : a' ∈ a ::ₘ s := mem_cons_of_mem h' calc f₁ a' h' = Pi.cons s a b f₁ a' this := by
rw [Pi.cons_ne this ne.symm] _ = Pi.cons s a b f₂ a' this := by rw [eq] _ = f₂ a' h' := by rw [Pi.cons_ne this ne.symm]
import Mathlib.Order.Bounds.Basic import Mathlib.Order.WellFounded import Mathlib.Data.Set.Image import Mathlib.Order.Interval.Set.Basic import Mathlib.Data.Set.Lattice #align_import order.conditionally_complete_lattice.basic from "leanprover-community/mathlib"@"29cb56a7b35f72758b05a30490e1f10bd62c35c1" open Function OrderDual Set variable {α β γ : Type*} {ι : Sort*} section variable [Preorder α] open scoped Classical noncomputable instance WithTop.instSupSet [SupSet α] : SupSet (WithTop α) := ⟨fun S => if ⊤ ∈ S then ⊤ else if BddAbove ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α) then ↑(sSup ((fun (a : α) ↦ (a : WithTop α)) ⁻¹' S : Set α)) else ⊤⟩ noncomputable instance WithTop.instInfSet [InfSet α] : InfSet (WithTop α) := ⟨fun S => if S ⊆ {⊤} ∨ ¬BddBelow S then ⊤ else ↑(sInf ((fun (a : α) ↦ ↑a) ⁻¹' S : Set α))⟩ noncomputable instance WithBot.instSupSet [SupSet α] : SupSet (WithBot α) := ⟨(WithTop.instInfSet (α := αᵒᵈ)).sInf⟩ noncomputable instance WithBot.instInfSet [InfSet α] : InfSet (WithBot α) := ⟨(WithTop.instSupSet (α := αᵒᵈ)).sSup⟩ theorem WithTop.sSup_eq [SupSet α] {s : Set (WithTop α)} (hs : ⊤ ∉ s) (hs' : BddAbove ((↑) ⁻¹' s : Set α)) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) := (if_neg hs).trans <| if_pos hs' #align with_top.Sup_eq WithTop.sSup_eq theorem WithTop.sInf_eq [InfSet α] {s : Set (WithTop α)} (hs : ¬s ⊆ {⊤}) (h's : BddBelow s) : sInf s = ↑(sInf ((↑) ⁻¹' s) : α) := if_neg <| by simp [hs, h's] #align with_top.Inf_eq WithTop.sInf_eq theorem WithBot.sInf_eq [InfSet α] {s : Set (WithBot α)} (hs : ⊥ ∉ s) (hs' : BddBelow ((↑) ⁻¹' s : Set α)) : sInf s = ↑(sInf ((↑) ⁻¹' s) : α) := (if_neg hs).trans <| if_pos hs' #align with_bot.Inf_eq WithBot.sInf_eq theorem WithBot.sSup_eq [SupSet α] {s : Set (WithBot α)} (hs : ¬s ⊆ {⊥}) (h's : BddAbove s) : sSup s = ↑(sSup ((↑) ⁻¹' s) : α) := WithTop.sInf_eq (α := αᵒᵈ) hs h's #align with_bot.Sup_eq WithBot.sSup_eq @[simp] theorem WithTop.sInf_empty [InfSet α] : sInf (∅ : Set (WithTop α)) = ⊤ := if_pos <| by simp #align with_top.cInf_empty WithTop.sInf_empty @[simp]
Mathlib/Order/ConditionallyCompleteLattice/Basic.lean
91
92
theorem WithTop.iInf_empty [IsEmpty ι] [InfSet α] (f : ι → WithTop α) : ⨅ i, f i = ⊤ := by
rw [iInf, range_eq_empty, WithTop.sInf_empty]
import Mathlib.Init.Function import Mathlib.Logic.Function.Basic #align_import data.sigma.basic from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" open Function section Sigma variable {α α₁ α₂ : Type*} {β : α → Type*} {β₁ : α₁ → Type*} {β₂ : α₂ → Type*} namespace Sigma instance instInhabitedSigma [Inhabited α] [Inhabited (β default)] : Inhabited (Sigma β) := ⟨⟨default, default⟩⟩ instance instDecidableEqSigma [h₁ : DecidableEq α] [h₂ : ∀ a, DecidableEq (β a)] : DecidableEq (Sigma β) | ⟨a₁, b₁⟩, ⟨a₂, b₂⟩ => match a₁, b₁, a₂, b₂, h₁ a₁ a₂ with | _, b₁, _, b₂, isTrue (Eq.refl _) => match b₁, b₂, h₂ _ b₁ b₂ with | _, _, isTrue (Eq.refl _) => isTrue rfl | _, _, isFalse n => isFalse fun h ↦ Sigma.noConfusion h fun _ e₂ ↦ n <| eq_of_heq e₂ | _, _, _, _, isFalse n => isFalse fun h ↦ Sigma.noConfusion h fun e₁ _ ↦ n e₁ -- sometimes the built-in injectivity support does not work @[simp] -- @[nolint simpNF] theorem mk.inj_iff {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} : Sigma.mk a₁ b₁ = ⟨a₂, b₂⟩ ↔ a₁ = a₂ ∧ HEq b₁ b₂ := ⟨fun h ↦ by cases h; simp, fun ⟨h₁, h₂⟩ ↦ by subst h₁; rw [eq_of_heq h₂]⟩ #align sigma.mk.inj_iff Sigma.mk.inj_iff @[simp] theorem eta : ∀ x : Σa, β a, Sigma.mk x.1 x.2 = x | ⟨_, _⟩ => rfl #align sigma.eta Sigma.eta #align sigma.ext Sigma.ext theorem ext_iff {x₀ x₁ : Sigma β} : x₀ = x₁ ↔ x₀.1 = x₁.1 ∧ HEq x₀.2 x₁.2 := by cases x₀; cases x₁; exact Sigma.mk.inj_iff #align sigma.ext_iff Sigma.ext_iff
Mathlib/Data/Sigma/Basic.lean
75
80
theorem _root_.Function.eq_of_sigmaMk_comp {γ : Type*} [Nonempty γ] {a b : α} {f : γ → β a} {g : γ → β b} (h : Sigma.mk a ∘ f = Sigma.mk b ∘ g) : a = b ∧ HEq f g := by
rcases ‹Nonempty γ› with ⟨i⟩ obtain rfl : a = b := congr_arg Sigma.fst (congr_fun h i) simpa [funext_iff] using h
import Mathlib.Analysis.Calculus.Deriv.Comp import Mathlib.Analysis.Calculus.FDeriv.Equiv #align_import analysis.calculus.deriv.inverse from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" universe u v w open scoped Classical open Topology Filter ENNReal open Filter Asymptotics Set variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E] variable {f f₀ f₁ g : 𝕜 → F} variable {f' f₀' f₁' g' : F} variable {x : 𝕜} variable {s t : Set 𝕜} variable {L L₁ L₂ : Filter 𝕜} theorem HasStrictDerivAt.hasStrictFDerivAt_equiv {f : 𝕜 → 𝕜} {f' x : 𝕜} (hf : HasStrictDerivAt f f' x) (hf' : f' ≠ 0) : HasStrictFDerivAt f (ContinuousLinearEquiv.unitsEquivAut 𝕜 (Units.mk0 f' hf') : 𝕜 →L[𝕜] 𝕜) x := hf #align has_strict_deriv_at.has_strict_fderiv_at_equiv HasStrictDerivAt.hasStrictFDerivAt_equiv theorem HasDerivAt.hasFDerivAt_equiv {f : 𝕜 → 𝕜} {f' x : 𝕜} (hf : HasDerivAt f f' x) (hf' : f' ≠ 0) : HasFDerivAt f (ContinuousLinearEquiv.unitsEquivAut 𝕜 (Units.mk0 f' hf') : 𝕜 →L[𝕜] 𝕜) x := hf #align has_deriv_at.has_fderiv_at_equiv HasDerivAt.hasFDerivAt_equiv theorem HasStrictDerivAt.of_local_left_inverse {f g : 𝕜 → 𝕜} {f' a : 𝕜} (hg : ContinuousAt g a) (hf : HasStrictDerivAt f f' (g a)) (hf' : f' ≠ 0) (hfg : ∀ᶠ y in 𝓝 a, f (g y) = y) : HasStrictDerivAt g f'⁻¹ a := (hf.hasStrictFDerivAt_equiv hf').of_local_left_inverse hg hfg #align has_strict_deriv_at.of_local_left_inverse HasStrictDerivAt.of_local_left_inverse theorem PartialHomeomorph.hasStrictDerivAt_symm (f : PartialHomeomorph 𝕜 𝕜) {a f' : 𝕜} (ha : a ∈ f.target) (hf' : f' ≠ 0) (htff' : HasStrictDerivAt f f' (f.symm a)) : HasStrictDerivAt f.symm f'⁻¹ a := htff'.of_local_left_inverse (f.symm.continuousAt ha) hf' (f.eventually_right_inverse ha) #align local_homeomorph.has_strict_deriv_at_symm PartialHomeomorph.hasStrictDerivAt_symm theorem HasDerivAt.of_local_left_inverse {f g : 𝕜 → 𝕜} {f' a : 𝕜} (hg : ContinuousAt g a) (hf : HasDerivAt f f' (g a)) (hf' : f' ≠ 0) (hfg : ∀ᶠ y in 𝓝 a, f (g y) = y) : HasDerivAt g f'⁻¹ a := (hf.hasFDerivAt_equiv hf').of_local_left_inverse hg hfg #align has_deriv_at.of_local_left_inverse HasDerivAt.of_local_left_inverse theorem PartialHomeomorph.hasDerivAt_symm (f : PartialHomeomorph 𝕜 𝕜) {a f' : 𝕜} (ha : a ∈ f.target) (hf' : f' ≠ 0) (htff' : HasDerivAt f f' (f.symm a)) : HasDerivAt f.symm f'⁻¹ a := htff'.of_local_left_inverse (f.symm.continuousAt ha) hf' (f.eventually_right_inverse ha) #align local_homeomorph.has_deriv_at_symm PartialHomeomorph.hasDerivAt_symm theorem HasDerivAt.eventually_ne (h : HasDerivAt f f' x) (hf' : f' ≠ 0) : ∀ᶠ z in 𝓝[≠] x, f z ≠ f x := (hasDerivAt_iff_hasFDerivAt.1 h).eventually_ne ⟨‖f'‖⁻¹, fun z => by field_simp [norm_smul, mt norm_eq_zero.1 hf']⟩ #align has_deriv_at.eventually_ne HasDerivAt.eventually_ne theorem HasDerivAt.tendsto_punctured_nhds (h : HasDerivAt f f' x) (hf' : f' ≠ 0) : Tendsto f (𝓝[≠] x) (𝓝[≠] f x) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ h.continuousAt.continuousWithinAt (h.eventually_ne hf') #align has_deriv_at.tendsto_punctured_nhds HasDerivAt.tendsto_punctured_nhds
Mathlib/Analysis/Calculus/Deriv/Inverse.lean
112
117
theorem not_differentiableWithinAt_of_local_left_inverse_hasDerivWithinAt_zero {f g : 𝕜 → 𝕜} {a : 𝕜} {s t : Set 𝕜} (ha : a ∈ s) (hsu : UniqueDiffWithinAt 𝕜 s a) (hf : HasDerivWithinAt f 0 t (g a)) (hst : MapsTo g s t) (hfg : f ∘ g =ᶠ[𝓝[s] a] id) : ¬DifferentiableWithinAt 𝕜 g s a := by
intro hg have := (hf.comp a hg.hasDerivWithinAt hst).congr_of_eventuallyEq_of_mem hfg.symm ha simpa using hsu.eq_deriv _ this (hasDerivWithinAt_id _ _)
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions noncomputable section open scoped Manifold open Bundle Set Topology variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] (I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] (I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] namespace PartialHomeomorph.MDifferentiable variable {I I' I''} variable {e : PartialHomeomorph M M'} (he : e.MDifferentiable I I') {e' : PartialHomeomorph M' M''} nonrec theorem symm : e.symm.MDifferentiable I' I := he.symm #align local_homeomorph.mdifferentiable.symm PartialHomeomorph.MDifferentiable.symm protected theorem mdifferentiableAt {x : M} (hx : x ∈ e.source) : MDifferentiableAt I I' e x := (he.1 x hx).mdifferentiableAt (e.open_source.mem_nhds hx) #align local_homeomorph.mdifferentiable.mdifferentiable_at PartialHomeomorph.MDifferentiable.mdifferentiableAt theorem mdifferentiableAt_symm {x : M'} (hx : x ∈ e.target) : MDifferentiableAt I' I e.symm x := (he.2 x hx).mdifferentiableAt (e.open_target.mem_nhds hx) #align local_homeomorph.mdifferentiable.mdifferentiable_at_symm PartialHomeomorph.MDifferentiable.mdifferentiableAt_symm variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M'] [SmoothManifoldWithCorners I'' M'']
Mathlib/Geometry/Manifold/MFDeriv/Atlas.lean
200
210
theorem symm_comp_deriv {x : M} (hx : x ∈ e.source) : (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) = ContinuousLinearMap.id 𝕜 (TangentSpace I x) := by
have : mfderiv I I (e.symm ∘ e) x = (mfderiv I' I e.symm (e x)).comp (mfderiv I I' e x) := mfderiv_comp x (he.mdifferentiableAt_symm (e.map_source hx)) (he.mdifferentiableAt hx) rw [← this] have : mfderiv I I (_root_.id : M → M) x = ContinuousLinearMap.id _ _ := mfderiv_id I rw [← this] apply Filter.EventuallyEq.mfderiv_eq have : e.source ∈ 𝓝 x := e.open_source.mem_nhds hx exact Filter.mem_of_superset this (by mfld_set_tac)
import Mathlib.NumberTheory.LegendreSymbol.JacobiSymbol #align_import number_theory.legendre_symbol.norm_num from "leanprover-community/mathlib"@"e2621d935895abe70071ab828a4ee6e26a52afe4" section Lemmas namespace Mathlib.Meta.NormNum def jacobiSymNat (a b : ℕ) : ℤ := jacobiSym a b #align norm_num.jacobi_sym_nat Mathlib.Meta.NormNum.jacobiSymNat
Mathlib/Tactic/NormNum/LegendreSymbol.lean
68
69
theorem jacobiSymNat.zero_right (a : ℕ) : jacobiSymNat a 0 = 1 := by
rw [jacobiSymNat, jacobiSym.zero_right]
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]
Mathlib/Algebra/Group/Invertible/Defs.lean
133
134
theorem mul_invOf_mul_self_cancel' [Monoid α] (a b : α) {_ : Invertible b} : a * ⅟ b * b = a := by
simp [mul_assoc]
import Mathlib.Logic.Small.Defs import Mathlib.Logic.Equiv.Set #align_import logic.small.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" universe u w v v' section open scoped Classical instance small_subtype (α : Type v) [Small.{w} α] (P : α → Prop) : Small.{w} { x // P x } := small_map (equivShrink α).subtypeEquivOfSubtype' #align small_subtype small_subtype theorem small_of_injective {α : Type v} {β : Type w} [Small.{u} β] {f : α → β} (hf : Function.Injective f) : Small.{u} α := small_map (Equiv.ofInjective f hf) #align small_of_injective small_of_injective theorem small_of_surjective {α : Type v} {β : Type w} [Small.{u} α] {f : α → β} (hf : Function.Surjective f) : Small.{u} β := small_of_injective (Function.injective_surjInv hf) #align small_of_surjective small_of_surjective instance (priority := 100) small_subsingleton (α : Type v) [Subsingleton α] : Small.{w} α := by rcases isEmpty_or_nonempty α with ⟨⟩ · apply small_map (Equiv.equivPEmpty α) · apply small_map Equiv.punitOfNonemptyOfSubsingleton #align small_subsingleton small_subsingleton
Mathlib/Logic/Small/Basic.lean
46
54
theorem small_of_injective_of_exists {α : Type v} {β : Type w} {γ : Type v'} [Small.{u} α] (f : α → γ) {g : β → γ} (hg : Function.Injective g) (h : ∀ b : β, ∃ a : α, f a = g b) : Small.{u} β := by
by_cases hβ : Nonempty β · refine small_of_surjective (f := Function.invFun g ∘ f) (fun b => ?_) obtain ⟨a, ha⟩ := h b exact ⟨a, by rw [Function.comp_apply, ha, Function.leftInverse_invFun hg]⟩ · simp only [not_nonempty_iff] at hβ infer_instance
import Mathlib.Init.Logic import Mathlib.Init.Function import Mathlib.Init.Algebra.Classes import Batteries.Util.LibraryNote import Batteries.Tactic.Lint.Basic #align_import logic.basic from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" #align_import init.ite_simp from "leanprover-community/lean"@"4a03bdeb31b3688c31d02d7ff8e0ff2e5d6174db" open Function attribute [local instance 10] Classical.propDecidable open Function alias Membership.mem.ne_of_not_mem := ne_of_mem_of_not_mem alias Membership.mem.ne_of_not_mem' := ne_of_mem_of_not_mem' #align has_mem.mem.ne_of_not_mem Membership.mem.ne_of_not_mem #align has_mem.mem.ne_of_not_mem' Membership.mem.ne_of_not_mem' section Equality -- todo: change name theorem forall_cond_comm {α} {s : α → Prop} {p : α → α → Prop} : (∀ a, s a → ∀ b, s b → p a b) ↔ ∀ a b, s a → s b → p a b := ⟨fun h a b ha hb ↦ h a ha b hb, fun h a ha b hb ↦ h a b ha hb⟩ #align ball_cond_comm forall_cond_comm theorem forall_mem_comm {α β} [Membership α β] {s : β} {p : α → α → Prop} : (∀ a (_ : a ∈ s) b (_ : b ∈ s), p a b) ↔ ∀ a b, a ∈ s → b ∈ s → p a b := forall_cond_comm #align ball_mem_comm forall_mem_comm @[deprecated (since := "2024-03-23")] alias ball_cond_comm := forall_cond_comm @[deprecated (since := "2024-03-23")] alias ball_mem_comm := forall_mem_comm #align ne_of_apply_ne ne_of_apply_ne lemma ne_of_eq_of_ne {α : Sort*} {a b c : α} (h₁ : a = b) (h₂ : b ≠ c) : a ≠ c := h₁.symm ▸ h₂ lemma ne_of_ne_of_eq {α : Sort*} {a b c : α} (h₁ : a ≠ b) (h₂ : b = c) : a ≠ c := h₂ ▸ h₁ alias Eq.trans_ne := ne_of_eq_of_ne alias Ne.trans_eq := ne_of_ne_of_eq #align eq.trans_ne Eq.trans_ne #align ne.trans_eq Ne.trans_eq theorem eq_equivalence {α : Sort*} : Equivalence (@Eq α) := ⟨Eq.refl, @Eq.symm _, @Eq.trans _⟩ #align eq_equivalence eq_equivalence -- These were migrated to Batteries but the `@[simp]` attributes were (mysteriously?) removed. attribute [simp] eq_mp_eq_cast eq_mpr_eq_cast #align eq_mp_eq_cast eq_mp_eq_cast #align eq_mpr_eq_cast eq_mpr_eq_cast #align cast_cast cast_cast -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_refl_left {α β : Sort*} (f : α → β) {a b : α} (h : a = b) : congr (Eq.refl f) h = congr_arg f h := rfl #align congr_refl_left congr_refl_left -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_refl_right {α β : Sort*} {f g : α → β} (h : f = g) (a : α) : congr h (Eq.refl a) = congr_fun h a := rfl #align congr_refl_right congr_refl_right -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_arg_refl {α β : Sort*} (f : α → β) (a : α) : congr_arg f (Eq.refl a) = Eq.refl (f a) := rfl #align congr_arg_refl congr_arg_refl -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_fun_rfl {α β : Sort*} (f : α → β) (a : α) : congr_fun (Eq.refl f) a = Eq.refl (f a) := rfl #align congr_fun_rfl congr_fun_rfl -- @[simp] -- FIXME simp ignores proof rewrites theorem congr_fun_congr_arg {α β γ : Sort*} (f : α → β → γ) {a a' : α} (p : a = a') (b : β) : congr_fun (congr_arg f p) b = congr_arg (fun a ↦ f a b) p := rfl #align congr_fun_congr_arg congr_fun_congr_arg #align heq_of_cast_eq heq_of_cast_eq #align cast_eq_iff_heq cast_eq_iff_heq
Mathlib/Logic/Basic.lean
591
592
theorem Eq.rec_eq_cast {α : Sort _} {P : α → Sort _} {x y : α} (h : x = y) (z : P x) : h ▸ z = cast (congr_arg P h) z := by
induction h; rfl
import Mathlib.Data.ENNReal.Real #align_import data.real.conjugate_exponents from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open scoped ENNReal namespace Real @[mk_iff] structure IsConjExponent (p q : ℝ) : Prop where one_lt : 1 < p inv_add_inv_conj : p⁻¹ + q⁻¹ = 1 #align real.is_conjugate_exponent Real.IsConjExponent def conjExponent (p : ℝ) : ℝ := p / (p - 1) #align real.conjugate_exponent Real.conjExponent variable {a b p q : ℝ} (h : p.IsConjExponent q) namespace IsConjExponent theorem pos : 0 < p := lt_trans zero_lt_one h.one_lt #align real.is_conjugate_exponent.pos Real.IsConjExponent.pos theorem nonneg : 0 ≤ p := le_of_lt h.pos #align real.is_conjugate_exponent.nonneg Real.IsConjExponent.nonneg theorem ne_zero : p ≠ 0 := ne_of_gt h.pos #align real.is_conjugate_exponent.ne_zero Real.IsConjExponent.ne_zero theorem sub_one_pos : 0 < p - 1 := sub_pos.2 h.one_lt #align real.is_conjugate_exponent.sub_one_pos Real.IsConjExponent.sub_one_pos theorem sub_one_ne_zero : p - 1 ≠ 0 := ne_of_gt h.sub_one_pos #align real.is_conjugate_exponent.sub_one_ne_zero Real.IsConjExponent.sub_one_ne_zero protected lemma inv_pos : 0 < p⁻¹ := inv_pos.2 h.pos protected lemma inv_nonneg : 0 ≤ p⁻¹ := h.inv_pos.le protected lemma inv_ne_zero : p⁻¹ ≠ 0 := h.inv_pos.ne' theorem one_div_pos : 0 < 1 / p := _root_.one_div_pos.2 h.pos #align real.is_conjugate_exponent.one_div_pos Real.IsConjExponent.one_div_pos theorem one_div_nonneg : 0 ≤ 1 / p := le_of_lt h.one_div_pos #align real.is_conjugate_exponent.one_div_nonneg Real.IsConjExponent.one_div_nonneg theorem one_div_ne_zero : 1 / p ≠ 0 := ne_of_gt h.one_div_pos #align real.is_conjugate_exponent.one_div_ne_zero Real.IsConjExponent.one_div_ne_zero theorem conj_eq : q = p / (p - 1) := by have := h.inv_add_inv_conj rw [← eq_sub_iff_add_eq', inv_eq_iff_eq_inv] at this field_simp [this, h.ne_zero] #align real.is_conjugate_exponent.conj_eq Real.IsConjExponent.conj_eq lemma conjExponent_eq : conjExponent p = q := h.conj_eq.symm #align real.is_conjugate_exponent.conjugate_eq Real.IsConjExponent.conjExponent_eq lemma one_sub_inv : 1 - p⁻¹ = q⁻¹ := sub_eq_of_eq_add' h.inv_add_inv_conj.symm lemma inv_sub_one : p⁻¹ - 1 = -q⁻¹ := by rw [← h.inv_add_inv_conj, sub_add_cancel_left] theorem sub_one_mul_conj : (p - 1) * q = p := mul_comm q (p - 1) ▸ (eq_div_iff h.sub_one_ne_zero).1 h.conj_eq #align real.is_conjugate_exponent.sub_one_mul_conj Real.IsConjExponent.sub_one_mul_conj theorem mul_eq_add : p * q = p + q := by simpa only [sub_mul, sub_eq_iff_eq_add, one_mul] using h.sub_one_mul_conj #align real.is_conjugate_exponent.mul_eq_add Real.IsConjExponent.mul_eq_add @[symm] protected lemma symm : q.IsConjExponent p where one_lt := by simpa only [h.conj_eq] using (one_lt_div h.sub_one_pos).mpr (sub_one_lt p) inv_add_inv_conj := by simpa [add_comm] using h.inv_add_inv_conj #align real.is_conjugate_exponent.symm Real.IsConjExponent.symm theorem div_conj_eq_sub_one : p / q = p - 1 := by field_simp [h.symm.ne_zero] rw [h.sub_one_mul_conj] #align real.is_conjugate_exponent.div_conj_eq_sub_one Real.IsConjExponent.div_conj_eq_sub_one
Mathlib/Data/Real/ConjExponents.lean
115
118
theorem inv_add_inv_conj_ennreal : (ENNReal.ofReal p)⁻¹ + (ENNReal.ofReal q)⁻¹ = 1 := by
rw [← ENNReal.ofReal_one, ← ENNReal.ofReal_inv_of_pos h.pos, ← ENNReal.ofReal_inv_of_pos h.symm.pos, ← ENNReal.ofReal_add h.inv_nonneg h.symm.inv_nonneg, h.inv_add_inv_conj]
import Mathlib.Algebra.CharP.ExpChar import Mathlib.Algebra.GeomSum import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.UniqueFactorizationDomain #align_import ring_theory.polynomial.basic from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" noncomputable section open Polynomial open Finset universe u v w variable {R : Type u} {S : Type*} namespace Polynomial section Semiring variable [Semiring R] instance instCharP (p : ℕ) [h : CharP R p] : CharP R[X] p := let ⟨h⟩ := h ⟨fun n => by rw [← map_natCast C, ← C_0, C_inj, h]⟩ instance instExpChar (p : ℕ) [h : ExpChar R p] : ExpChar R[X] p := by cases h; exacts [ExpChar.zero, ExpChar.prime ‹_›] variable (R) def degreeLE (n : WithBot ℕ) : Submodule R R[X] := ⨅ k : ℕ, ⨅ _ : ↑k > n, LinearMap.ker (lcoeff R k) #align polynomial.degree_le Polynomial.degreeLE def degreeLT (n : ℕ) : Submodule R R[X] := ⨅ k : ℕ, ⨅ (_ : k ≥ n), LinearMap.ker (lcoeff R k) #align polynomial.degree_lt Polynomial.degreeLT variable {R} theorem mem_degreeLE {n : WithBot ℕ} {f : R[X]} : f ∈ degreeLE R n ↔ degree f ≤ n := by simp only [degreeLE, Submodule.mem_iInf, degree_le_iff_coeff_zero, LinearMap.mem_ker]; rfl #align polynomial.mem_degree_le Polynomial.mem_degreeLE @[mono] theorem degreeLE_mono {m n : WithBot ℕ} (H : m ≤ n) : degreeLE R m ≤ degreeLE R n := fun _ hf => mem_degreeLE.2 (le_trans (mem_degreeLE.1 hf) H) #align polynomial.degree_le_mono Polynomial.degreeLE_mono theorem degreeLE_eq_span_X_pow [DecidableEq R] {n : ℕ} : degreeLE R n = Submodule.span R ↑((Finset.range (n + 1)).image fun n => (X : R[X]) ^ n) := by apply le_antisymm · intro p hp replace hp := mem_degreeLE.1 hp rw [← Polynomial.sum_monomial_eq p, Polynomial.sum] refine Submodule.sum_mem _ fun k hk => ?_ have := WithBot.coe_le_coe.1 (Finset.sup_le_iff.1 hp k hk) rw [← C_mul_X_pow_eq_monomial, C_mul'] refine Submodule.smul_mem _ _ (Submodule.subset_span <| Finset.mem_coe.2 <| Finset.mem_image.2 ⟨_, Finset.mem_range.2 (Nat.lt_succ_of_le this), rfl⟩) rw [Submodule.span_le, Finset.coe_image, Set.image_subset_iff] intro k hk apply mem_degreeLE.2 exact (degree_X_pow_le _).trans (WithBot.coe_le_coe.2 <| Nat.le_of_lt_succ <| Finset.mem_range.1 hk) set_option linter.uppercaseLean3 false in #align polynomial.degree_le_eq_span_X_pow Polynomial.degreeLE_eq_span_X_pow
Mathlib/RingTheory/Polynomial/Basic.lean
98
109
theorem mem_degreeLT {n : ℕ} {f : R[X]} : f ∈ degreeLT R n ↔ degree f < n := by
rw [degreeLT, Submodule.mem_iInf] conv_lhs => intro i; rw [Submodule.mem_iInf] rw [degree, Finset.max_eq_sup_coe] rw [Finset.sup_lt_iff ?_] rotate_left · apply WithBot.bot_lt_coe conv_rhs => simp only [mem_support_iff] intro b rw [Nat.cast_withBot, WithBot.coe_lt_coe, lt_iff_not_le, Ne, not_imp_not] rfl
import Mathlib.Algebra.ContinuedFractions.Computation.Approximations import Mathlib.Algebra.ContinuedFractions.ConvergentsEquiv import Mathlib.Algebra.Order.Archimedean import Mathlib.Tactic.GCongr import Mathlib.Topology.Order.LeftRightNhds #align_import algebra.continued_fractions.computation.approximation_corollaries from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {K : Type*} (v : K) [LinearOrderedField K] [FloorRing K] open GeneralizedContinuedFraction (of) open GeneralizedContinuedFraction open scoped Topology theorem GeneralizedContinuedFraction.of_isSimpleContinuedFraction : (of v).IsSimpleContinuedFraction := fun _ _ nth_part_num_eq => of_part_num_eq_one nth_part_num_eq #align generalized_continued_fraction.of_is_simple_continued_fraction GeneralizedContinuedFraction.of_isSimpleContinuedFraction nonrec def SimpleContinuedFraction.of : SimpleContinuedFraction K := ⟨of v, GeneralizedContinuedFraction.of_isSimpleContinuedFraction v⟩ #align simple_continued_fraction.of SimpleContinuedFraction.of theorem SimpleContinuedFraction.of_isContinuedFraction : (SimpleContinuedFraction.of v).IsContinuedFraction := fun _ _ nth_part_denom_eq => lt_of_lt_of_le zero_lt_one (of_one_le_get?_part_denom nth_part_denom_eq) #align simple_continued_fraction.of_is_continued_fraction SimpleContinuedFraction.of_isContinuedFraction def ContinuedFraction.of : ContinuedFraction K := ⟨SimpleContinuedFraction.of v, SimpleContinuedFraction.of_isContinuedFraction v⟩ #align continued_fraction.of ContinuedFraction.of namespace GeneralizedContinuedFraction theorem of_convergents_eq_convergents' : (of v).convergents = (of v).convergents' := @ContinuedFraction.convergents_eq_convergents' _ _ (ContinuedFraction.of v) #align generalized_continued_fraction.of_convergents_eq_convergents' GeneralizedContinuedFraction.of_convergents_eq_convergents'
Mathlib/Algebra/ContinuedFractions/Computation/ApproximationCorollaries.lean
80
82
theorem convergents_succ (n : ℕ) : (of v).convergents (n + 1) = ⌊v⌋ + 1 / (of (Int.fract v)⁻¹).convergents n := by
rw [of_convergents_eq_convergents', convergents'_succ, of_convergents_eq_convergents']
import Mathlib.Order.ConditionallyCompleteLattice.Finset import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.lattice from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54" assert_not_exists MonoidWithZero open Set namespace Nat open scoped Classical noncomputable instance : InfSet ℕ := ⟨fun s ↦ if h : ∃ n, n ∈ s then @Nat.find (fun n ↦ n ∈ s) _ h else 0⟩ noncomputable instance : SupSet ℕ := ⟨fun s ↦ if h : ∃ n, ∀ a ∈ s, a ≤ n then @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h else 0⟩ theorem sInf_def {s : Set ℕ} (h : s.Nonempty) : sInf s = @Nat.find (fun n ↦ n ∈ s) _ h := dif_pos _ #align nat.Inf_def Nat.sInf_def theorem sSup_def {s : Set ℕ} (h : ∃ n, ∀ a ∈ s, a ≤ n) : sSup s = @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h := dif_pos _ #align nat.Sup_def Nat.sSup_def theorem _root_.Set.Infinite.Nat.sSup_eq_zero {s : Set ℕ} (h : s.Infinite) : sSup s = 0 := dif_neg fun ⟨n, hn⟩ ↦ let ⟨k, hks, hk⟩ := h.exists_gt n (hn k hks).not_lt hk #align set.infinite.nat.Sup_eq_zero Set.Infinite.Nat.sSup_eq_zero @[simp] theorem sInf_eq_zero {s : Set ℕ} : sInf s = 0 ↔ 0 ∈ s ∨ s = ∅ := by cases eq_empty_or_nonempty s with | inl h => subst h simp only [or_true_iff, eq_self_iff_true, iff_true_iff, iInf, InfSet.sInf, mem_empty_iff_false, exists_false, dif_neg, not_false_iff] | inr h => simp only [h.ne_empty, or_false_iff, Nat.sInf_def, h, Nat.find_eq_zero] #align nat.Inf_eq_zero Nat.sInf_eq_zero @[simp] theorem sInf_empty : sInf ∅ = 0 := by rw [sInf_eq_zero] right rfl #align nat.Inf_empty Nat.sInf_empty @[simp] theorem iInf_of_empty {ι : Sort*} [IsEmpty ι] (f : ι → ℕ) : iInf f = 0 := by rw [iInf_of_isEmpty, sInf_empty] #align nat.infi_of_empty Nat.iInf_of_empty @[simp] lemma iInf_const_zero {ι : Sort*} : ⨅ i : ι, 0 = 0 := (isEmpty_or_nonempty ι).elim (fun h ↦ by simp) fun h ↦ sInf_eq_zero.2 <| by simp theorem sInf_mem {s : Set ℕ} (h : s.Nonempty) : sInf s ∈ s := by rw [Nat.sInf_def h] exact Nat.find_spec h #align nat.Inf_mem Nat.sInf_mem
Mathlib/Data/Nat/Lattice.lean
80
83
theorem not_mem_of_lt_sInf {s : Set ℕ} {m : ℕ} (hm : m < sInf s) : m ∉ s := by
cases eq_empty_or_nonempty s with | inl h => subst h; apply not_mem_empty | inr h => rw [Nat.sInf_def h] at hm; exact Nat.find_min h hm
import Mathlib.Order.Antichain import Mathlib.Order.UpperLower.Basic import Mathlib.Order.Interval.Set.Basic import Mathlib.Order.RelIso.Set #align_import order.minimal from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf" open Function Set variable {α : Type*} (r r₁ r₂ : α → α → Prop) (s t : Set α) (a b : α) def maximals : Set α := { a ∈ s | ∀ ⦃b⦄, b ∈ s → r a b → r b a } #align maximals maximals def minimals : Set α := { a ∈ s | ∀ ⦃b⦄, b ∈ s → r b a → r a b } #align minimals minimals theorem maximals_subset : maximals r s ⊆ s := sep_subset _ _ #align maximals_subset maximals_subset theorem minimals_subset : minimals r s ⊆ s := sep_subset _ _ #align minimals_subset minimals_subset @[simp] theorem maximals_empty : maximals r ∅ = ∅ := sep_empty _ #align maximals_empty maximals_empty @[simp] theorem minimals_empty : minimals r ∅ = ∅ := sep_empty _ #align minimals_empty minimals_empty @[simp] theorem maximals_singleton : maximals r {a} = {a} := (maximals_subset _ _).antisymm <| singleton_subset_iff.2 <| ⟨rfl, by rintro b (rfl : b = a) exact id⟩ #align maximals_singleton maximals_singleton @[simp] theorem minimals_singleton : minimals r {a} = {a} := maximals_singleton _ _ #align minimals_singleton minimals_singleton theorem maximals_swap : maximals (swap r) s = minimals r s := rfl #align maximals_swap maximals_swap theorem minimals_swap : minimals (swap r) s = maximals r s := rfl #align minimals_swap minimals_swap section IsAntisymm variable {r s t a b} [IsAntisymm α r] theorem eq_of_mem_maximals (ha : a ∈ maximals r s) (hb : b ∈ s) (h : r a b) : a = b := antisymm h <| ha.2 hb h #align eq_of_mem_maximals eq_of_mem_maximals theorem eq_of_mem_minimals (ha : a ∈ minimals r s) (hb : b ∈ s) (h : r b a) : a = b := antisymm (ha.2 hb h) h #align eq_of_mem_minimals eq_of_mem_minimals set_option autoImplicit true
Mathlib/Order/Minimal.lean
96
99
theorem mem_maximals_iff : x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r x y → x = y := by
simp only [maximals, Set.mem_sep_iff, and_congr_right_iff] refine fun _ ↦ ⟨fun h y hys hxy ↦ antisymm hxy (h hys hxy), fun h y hys hxy ↦ ?_⟩ convert hxy <;> rw [h hys hxy]
import Mathlib.MeasureTheory.Constructions.Prod.Basic import Mathlib.MeasureTheory.Group.Measure import Mathlib.Topology.Constructions #align_import measure_theory.constructions.pi from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" noncomputable section open Function Set MeasureTheory.OuterMeasure Filter MeasurableSpace Encodable open scoped Classical Topology ENNReal universe u v variable {ι ι' : Type*} {α : ι → Type*} theorem IsPiSystem.pi {C : ∀ i, Set (Set (α i))} (hC : ∀ i, IsPiSystem (C i)) : IsPiSystem (pi univ '' pi univ C) := by rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hst rw [← pi_inter_distrib] at hst ⊢; rw [univ_pi_nonempty_iff] at hst exact mem_image_of_mem _ fun i _ => hC i _ (hs₁ i (mem_univ i)) _ (hs₂ i (mem_univ i)) (hst i) #align is_pi_system.pi IsPiSystem.pi theorem isPiSystem_pi [∀ i, MeasurableSpace (α i)] : IsPiSystem (pi univ '' pi univ fun i => { s : Set (α i) | MeasurableSet s }) := IsPiSystem.pi fun _ => isPiSystem_measurableSet #align is_pi_system_pi isPiSystem_pi namespace MeasureTheory variable [Fintype ι] {m : ∀ i, OuterMeasure (α i)} @[simp] def piPremeasure (m : ∀ i, OuterMeasure (α i)) (s : Set (∀ i, α i)) : ℝ≥0∞ := ∏ i, m i (eval i '' s) #align measure_theory.pi_premeasure MeasureTheory.piPremeasure theorem piPremeasure_pi {s : ∀ i, Set (α i)} (hs : (pi univ s).Nonempty) : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by simp [hs, piPremeasure] #align measure_theory.pi_premeasure_pi MeasureTheory.piPremeasure_pi theorem piPremeasure_pi' {s : ∀ i, Set (α i)} : piPremeasure m (pi univ s) = ∏ i, m i (s i) := by cases isEmpty_or_nonempty ι · simp [piPremeasure] rcases (pi univ s).eq_empty_or_nonempty with h | h · rcases univ_pi_eq_empty_iff.mp h with ⟨i, hi⟩ have : ∃ i, m i (s i) = 0 := ⟨i, by simp [hi]⟩ simpa [h, Finset.card_univ, zero_pow Fintype.card_ne_zero, @eq_comm _ (0 : ℝ≥0∞), Finset.prod_eq_zero_iff, piPremeasure] · simp [h, piPremeasure] #align measure_theory.pi_premeasure_pi' MeasureTheory.piPremeasure_pi' theorem piPremeasure_pi_mono {s t : Set (∀ i, α i)} (h : s ⊆ t) : piPremeasure m s ≤ piPremeasure m t := Finset.prod_le_prod' fun _ _ => measure_mono (image_subset _ h) #align measure_theory.pi_premeasure_pi_mono MeasureTheory.piPremeasure_pi_mono theorem piPremeasure_pi_eval {s : Set (∀ i, α i)} : piPremeasure m (pi univ fun i => eval i '' s) = piPremeasure m s := by simp only [eval, piPremeasure_pi']; rfl #align measure_theory.pi_premeasure_pi_eval MeasureTheory.piPremeasure_pi_eval namespace OuterMeasure protected def pi (m : ∀ i, OuterMeasure (α i)) : OuterMeasure (∀ i, α i) := boundedBy (piPremeasure m) #align measure_theory.outer_measure.pi MeasureTheory.OuterMeasure.pi theorem pi_pi_le (m : ∀ i, OuterMeasure (α i)) (s : ∀ i, Set (α i)) : OuterMeasure.pi m (pi univ s) ≤ ∏ i, m i (s i) := by rcases (pi univ s).eq_empty_or_nonempty with h | h · simp [h] exact (boundedBy_le _).trans_eq (piPremeasure_pi h) #align measure_theory.outer_measure.pi_pi_le MeasureTheory.OuterMeasure.pi_pi_le
Mathlib/MeasureTheory/Constructions/Pi.lean
204
210
theorem le_pi {m : ∀ i, OuterMeasure (α i)} {n : OuterMeasure (∀ i, α i)} : n ≤ OuterMeasure.pi m ↔ ∀ s : ∀ i, Set (α i), (pi univ s).Nonempty → n (pi univ s) ≤ ∏ i, m i (s i) := by
rw [OuterMeasure.pi, le_boundedBy']; constructor · intro h s hs; refine (h _ hs).trans_eq (piPremeasure_pi hs) · intro h s hs; refine le_trans (n.mono <| subset_pi_eval_image univ s) (h _ ?_) simp [univ_pi_nonempty_iff, hs]
import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.Localization.Integral #align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"d35b4ff446f1421bd551fafa4b8efd98ac3ac408" open scoped nonZeroDivisors Polynomial open Polynomial abbrev IsIntegrallyClosedIn (R A : Type*) [CommRing R] [CommRing A] [Algebra R A] := IsIntegralClosure R R A abbrev IsIntegrallyClosed (R : Type*) [CommRing R] := IsIntegrallyClosedIn R (FractionRing R) #align is_integrally_closed IsIntegrallyClosed section Iff variable {R : Type*} [CommRing R] variable {A B : Type*} [CommRing A] [CommRing B] [Algebra R A] [Algebra R B]
Mathlib/RingTheory/IntegrallyClosed.lean
80
90
theorem AlgHom.isIntegrallyClosedIn (f : A →ₐ[R] B) (hf : Function.Injective f) : IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A := by
rintro ⟨inj, cl⟩ refine ⟨Function.Injective.of_comp (f := f) ?_, fun hx => ?_, ?_⟩ · convert inj aesop · obtain ⟨y, fx_eq⟩ := cl.mp ((isIntegral_algHom_iff f hf).mpr hx) aesop · rintro ⟨y, rfl⟩ apply (isIntegral_algHom_iff f hf).mp aesop
import Mathlib.Algebra.Field.Subfield import Mathlib.Algebra.GroupWithZero.Divisibility import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Algebra.Ring.Basic import Mathlib.Topology.Order.LocalExtr #align_import topology.algebra.field from "leanprover-community/mathlib"@"c10e724be91096453ee3db13862b9fb9a992fef2" variable {K : Type*} [DivisionRing K] [TopologicalSpace K] theorem Filter.tendsto_cocompact_mul_left₀ [ContinuousMul K] {a : K} (ha : a ≠ 0) : Filter.Tendsto (fun x : K => a * x) (Filter.cocompact K) (Filter.cocompact K) := Filter.tendsto_cocompact_mul_left (inv_mul_cancel ha) #align filter.tendsto_cocompact_mul_left₀ Filter.tendsto_cocompact_mul_left₀ theorem Filter.tendsto_cocompact_mul_right₀ [ContinuousMul K] {a : K} (ha : a ≠ 0) : Filter.Tendsto (fun x : K => x * a) (Filter.cocompact K) (Filter.cocompact K) := Filter.tendsto_cocompact_mul_right (mul_inv_cancel ha) #align filter.tendsto_cocompact_mul_right₀ Filter.tendsto_cocompact_mul_right₀ variable (K) class TopologicalDivisionRing extends TopologicalRing K, HasContinuousInv₀ K : Prop #align topological_division_ring TopologicalDivisionRing section Preconnected open Set variable {α 𝕜 : Type*} {f g : α → 𝕜} {S : Set α} [TopologicalSpace α] [TopologicalSpace 𝕜] [T1Space 𝕜]
Mathlib/Topology/Algebra/Field.lean
130
136
theorem IsPreconnected.eq_one_or_eq_neg_one_of_sq_eq [Ring 𝕜] [NoZeroDivisors 𝕜] (hS : IsPreconnected S) (hf : ContinuousOn f S) (hsq : EqOn (f ^ 2) 1 S) : EqOn f 1 S ∨ EqOn f (-1) S := by
have : DiscreteTopology ({1, -1} : Set 𝕜) := discrete_of_t1_of_finite have hmaps : MapsTo f S {1, -1} := by simpa only [EqOn, Pi.one_apply, Pi.pow_apply, sq_eq_one_iff] using hsq simpa using hS.eqOn_const_of_mapsTo hf hmaps
import Batteries.Data.Rat.Basic import Batteries.Tactic.SeqFocus namespace Rat theorem ext : {p q : Rat} → p.num = q.num → p.den = q.den → p = q | ⟨_,_,_,_⟩, ⟨_,_,_,_⟩, rfl, rfl => rfl @[simp] theorem mk_den_one {r : Int} : ⟨r, 1, Nat.one_ne_zero, (Nat.coprime_one_right _)⟩ = (r : Rat) := rfl @[simp] theorem zero_num : (0 : Rat).num = 0 := rfl @[simp] theorem zero_den : (0 : Rat).den = 1 := rfl @[simp] theorem one_num : (1 : Rat).num = 1 := rfl @[simp] theorem one_den : (1 : Rat).den = 1 := rfl @[simp] theorem maybeNormalize_eq {num den g} (den_nz reduced) : maybeNormalize num den g den_nz reduced = { num := num.div g, den := den / g, den_nz, reduced } := by unfold maybeNormalize; split · subst g; simp · rfl theorem normalize.reduced' {num : Int} {den g : Nat} (den_nz : den ≠ 0) (e : g = num.natAbs.gcd den) : (num / g).natAbs.Coprime (den / g) := by rw [← Int.div_eq_ediv_of_dvd (e ▸ Int.ofNat_dvd_left.2 (Nat.gcd_dvd_left ..))] exact normalize.reduced den_nz e theorem normalize_eq {num den} (den_nz) : normalize num den den_nz = { num := num / num.natAbs.gcd den den := den / num.natAbs.gcd den den_nz := normalize.den_nz den_nz rfl reduced := normalize.reduced' den_nz rfl } := by simp only [normalize, maybeNormalize_eq, Int.div_eq_ediv_of_dvd (Int.ofNat_dvd_left.2 (Nat.gcd_dvd_left ..))] @[simp] theorem normalize_zero (nz) : normalize 0 d nz = 0 := by simp [normalize, Int.zero_div, Int.natAbs_zero, Nat.div_self (Nat.pos_of_ne_zero nz)]; rfl theorem mk_eq_normalize (num den nz c) : ⟨num, den, nz, c⟩ = normalize num den nz := by simp [normalize_eq, c.gcd_eq_one] theorem normalize_self (r : Rat) : normalize r.num r.den r.den_nz = r := (mk_eq_normalize ..).symm
.lake/packages/batteries/Batteries/Data/Rat/Lemmas.lean
52
56
theorem normalize_mul_left {a : Nat} (d0 : d ≠ 0) (a0 : a ≠ 0) : normalize (↑a * n) (a * d) (Nat.mul_ne_zero a0 d0) = normalize n d d0 := by
simp [normalize_eq, mk'.injEq, Int.natAbs_mul, Nat.gcd_mul_left, Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero a0), Int.ofNat_mul, Int.mul_ediv_mul_of_pos _ _ (Int.ofNat_pos.2 <| Nat.pos_of_ne_zero a0)]
import Mathlib.Order.Sublattice import Mathlib.Order.Hom.CompleteLattice open Function Set variable (α β : Type*) [CompleteLattice α] [CompleteLattice β] (f : CompleteLatticeHom α β) structure CompleteSublattice extends Sublattice α where sSupClosed' : ∀ ⦃s : Set α⦄, s ⊆ carrier → sSup s ∈ carrier sInfClosed' : ∀ ⦃s : Set α⦄, s ⊆ carrier → sInf s ∈ carrier variable {α β} namespace CompleteSublattice @[simps] def mk' (carrier : Set α) (sSupClosed' : ∀ ⦃s : Set α⦄, s ⊆ carrier → sSup s ∈ carrier) (sInfClosed' : ∀ ⦃s : Set α⦄, s ⊆ carrier → sInf s ∈ carrier) : CompleteSublattice α where carrier := carrier sSupClosed' := sSupClosed' sInfClosed' := sInfClosed' supClosed' := fun x hx y hy ↦ by suffices x ⊔ y = sSup {x, y} by exact this ▸ sSupClosed' (fun z hz ↦ by aesop) simp [sSup_singleton] infClosed' := fun x hx y hy ↦ by suffices x ⊓ y = sInf {x, y} by exact this ▸ sInfClosed' (fun z hz ↦ by aesop) simp [sInf_singleton] variable {L : CompleteSublattice α} instance instSetLike : SetLike (CompleteSublattice α) α where coe L := L.carrier coe_injective' L M h := by cases L; cases M; congr; exact SetLike.coe_injective' h instance instBot : Bot L where bot := ⟨⊥, by simpa using L.sSupClosed' <| empty_subset _⟩ instance instTop : Top L where top := ⟨⊤, by simpa using L.sInfClosed' <| empty_subset _⟩ instance instSupSet : SupSet L where sSup s := ⟨sSup s, L.sSupClosed' image_val_subset⟩ instance instInfSet : InfSet L where sInf s := ⟨sInf s, L.sInfClosed' image_val_subset⟩ theorem sSupClosed {s : Set α} (h : s ⊆ L) : sSup s ∈ L := L.sSupClosed' h theorem sInfClosed {s : Set α} (h : s ⊆ L) : sInf s ∈ L := L.sInfClosed' h @[simp] theorem coe_bot : (↑(⊥ : L) : α) = ⊥ := rfl @[simp] theorem coe_top : (↑(⊤ : L) : α) = ⊤ := rfl @[simp] theorem coe_sSup (S : Set L) : (↑(sSup S) : α) = sSup {(s : α) | s ∈ S} := rfl theorem coe_sSup' (S : Set L) : (↑(sSup S) : α) = ⨆ N ∈ S, (N : α) := by rw [coe_sSup, ← Set.image, sSup_image] @[simp] theorem coe_sInf (S : Set L) : (↑(sInf S) : α) = sInf {(s : α) | s ∈ S} := rfl
Mathlib/Order/CompleteSublattice.lean
89
90
theorem coe_sInf' (S : Set L) : (↑(sInf S) : α) = ⨅ N ∈ S, (N : α) := by
rw [coe_sInf, ← Set.image, sInf_image]
import Mathlib.Analysis.Normed.Group.Basic #align_import analysis.normed.group.hom from "leanprover-community/mathlib"@"3c4225288b55380a90df078ebae0991080b12393" noncomputable section open NNReal -- TODO: migrate to the new morphism / morphism_class style structure NormedAddGroupHom (V W : Type*) [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] where toFun : V → W map_add' : ∀ v₁ v₂, toFun (v₁ + v₂) = toFun v₁ + toFun v₂ bound' : ∃ C, ∀ v, ‖toFun v‖ ≤ C * ‖v‖ #align normed_add_group_hom NormedAddGroupHom
Mathlib/Analysis/Normed/Group/Hom.lean
67
74
theorem exists_pos_bound_of_bound {V W : Type*} [SeminormedAddCommGroup V] [SeminormedAddCommGroup W] {f : V → W} (M : ℝ) (h : ∀ x, ‖f x‖ ≤ M * ‖x‖) : ∃ N, 0 < N ∧ ∀ x, ‖f x‖ ≤ N * ‖x‖ := ⟨max M 1, lt_of_lt_of_le zero_lt_one (le_max_right _ _), fun x => calc ‖f x‖ ≤ M * ‖x‖ := h x _ ≤ max M 1 * ‖x‖ := by
gcongr; apply le_max_left ⟩
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Polynomial.Degree.Lemmas #align_import data.polynomial.erase_lead from "leanprover-community/mathlib"@"fa256f00ce018e7b40e1dc756e403c86680bf448" noncomputable section open Polynomial open Polynomial Finset namespace Polynomial variable {R : Type*} [Semiring R] {f : R[X]} def eraseLead (f : R[X]) : R[X] := Polynomial.erase f.natDegree f #align polynomial.erase_lead Polynomial.eraseLead section EraseLead theorem eraseLead_support (f : R[X]) : f.eraseLead.support = f.support.erase f.natDegree := by simp only [eraseLead, support_erase] #align polynomial.erase_lead_support Polynomial.eraseLead_support theorem eraseLead_coeff (i : ℕ) : f.eraseLead.coeff i = if i = f.natDegree then 0 else f.coeff i := by simp only [eraseLead, coeff_erase] #align polynomial.erase_lead_coeff Polynomial.eraseLead_coeff @[simp] theorem eraseLead_coeff_natDegree : f.eraseLead.coeff f.natDegree = 0 := by simp [eraseLead_coeff] #align polynomial.erase_lead_coeff_nat_degree Polynomial.eraseLead_coeff_natDegree theorem eraseLead_coeff_of_ne (i : ℕ) (hi : i ≠ f.natDegree) : f.eraseLead.coeff i = f.coeff i := by simp [eraseLead_coeff, hi] #align polynomial.erase_lead_coeff_of_ne Polynomial.eraseLead_coeff_of_ne @[simp] theorem eraseLead_zero : eraseLead (0 : R[X]) = 0 := by simp only [eraseLead, erase_zero] #align polynomial.erase_lead_zero Polynomial.eraseLead_zero @[simp] theorem eraseLead_add_monomial_natDegree_leadingCoeff (f : R[X]) : f.eraseLead + monomial f.natDegree f.leadingCoeff = f := (add_comm _ _).trans (f.monomial_add_erase _) #align polynomial.erase_lead_add_monomial_nat_degree_leading_coeff Polynomial.eraseLead_add_monomial_natDegree_leadingCoeff @[simp] theorem eraseLead_add_C_mul_X_pow (f : R[X]) : f.eraseLead + C f.leadingCoeff * X ^ f.natDegree = f := by rw [C_mul_X_pow_eq_monomial, eraseLead_add_monomial_natDegree_leadingCoeff] set_option linter.uppercaseLean3 false in #align polynomial.erase_lead_add_C_mul_X_pow Polynomial.eraseLead_add_C_mul_X_pow @[simp] theorem self_sub_monomial_natDegree_leadingCoeff {R : Type*} [Ring R] (f : R[X]) : f - monomial f.natDegree f.leadingCoeff = f.eraseLead := (eq_sub_iff_add_eq.mpr (eraseLead_add_monomial_natDegree_leadingCoeff f)).symm #align polynomial.self_sub_monomial_nat_degree_leading_coeff Polynomial.self_sub_monomial_natDegree_leadingCoeff @[simp] theorem self_sub_C_mul_X_pow {R : Type*} [Ring R] (f : R[X]) : f - C f.leadingCoeff * X ^ f.natDegree = f.eraseLead := by rw [C_mul_X_pow_eq_monomial, self_sub_monomial_natDegree_leadingCoeff] set_option linter.uppercaseLean3 false in #align polynomial.self_sub_C_mul_X_pow Polynomial.self_sub_C_mul_X_pow theorem eraseLead_ne_zero (f0 : 2 ≤ f.support.card) : eraseLead f ≠ 0 := by rw [Ne, ← card_support_eq_zero, eraseLead_support] exact (zero_lt_one.trans_le <| (tsub_le_tsub_right f0 1).trans Finset.pred_card_le_card_erase).ne.symm #align polynomial.erase_lead_ne_zero Polynomial.eraseLead_ne_zero theorem lt_natDegree_of_mem_eraseLead_support {a : ℕ} (h : a ∈ (eraseLead f).support) : a < f.natDegree := by rw [eraseLead_support, mem_erase] at h exact (le_natDegree_of_mem_supp a h.2).lt_of_ne h.1 #align polynomial.lt_nat_degree_of_mem_erase_lead_support Polynomial.lt_natDegree_of_mem_eraseLead_support theorem ne_natDegree_of_mem_eraseLead_support {a : ℕ} (h : a ∈ (eraseLead f).support) : a ≠ f.natDegree := (lt_natDegree_of_mem_eraseLead_support h).ne #align polynomial.ne_nat_degree_of_mem_erase_lead_support Polynomial.ne_natDegree_of_mem_eraseLead_support theorem natDegree_not_mem_eraseLead_support : f.natDegree ∉ (eraseLead f).support := fun h => ne_natDegree_of_mem_eraseLead_support h rfl #align polynomial.nat_degree_not_mem_erase_lead_support Polynomial.natDegree_not_mem_eraseLead_support theorem eraseLead_support_card_lt (h : f ≠ 0) : (eraseLead f).support.card < f.support.card := by rw [eraseLead_support] exact card_lt_card (erase_ssubset <| natDegree_mem_support_of_nonzero h) #align polynomial.erase_lead_support_card_lt Polynomial.eraseLead_support_card_lt theorem card_support_eraseLead_add_one (h : f ≠ 0) : f.eraseLead.support.card + 1 = f.support.card := by set c := f.support.card with hc cases h₁ : c case zero => by_contra exact h (card_support_eq_zero.mp h₁) case succ => rw [eraseLead_support, card_erase_of_mem (natDegree_mem_support_of_nonzero h), ← hc, h₁] rfl @[simp] theorem card_support_eraseLead : f.eraseLead.support.card = f.support.card - 1 := by by_cases hf : f = 0 · rw [hf, eraseLead_zero, support_zero, card_empty] · rw [← card_support_eraseLead_add_one hf, add_tsub_cancel_right] theorem card_support_eraseLead' {c : ℕ} (fc : f.support.card = c + 1) : f.eraseLead.support.card = c := by rw [card_support_eraseLead, fc, add_tsub_cancel_right] #align polynomial.erase_lead_card_support' Polynomial.card_support_eraseLead' theorem card_support_eq_one_of_eraseLead_eq_zero (h₀ : f ≠ 0) (h₁ : f.eraseLead = 0) : f.support.card = 1 := (card_support_eq_zero.mpr h₁ ▸ card_support_eraseLead_add_one h₀).symm
Mathlib/Algebra/Polynomial/EraseLead.lean
141
144
theorem card_support_le_one_of_eraseLead_eq_zero (h : f.eraseLead = 0) : f.support.card ≤ 1 := by
by_cases hpz : f = 0 case pos => simp [hpz] case neg => exact le_of_eq (card_support_eq_one_of_eraseLead_eq_zero hpz h)
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section LiftDeg
Mathlib/Algebra/Polynomial/Lifts.lean
141
162
theorem monomial_mem_lifts_and_degree_eq {s : S} {n : ℕ} (hl : monomial n s ∈ lifts f) : ∃ q : R[X], map f q = monomial n s ∧ q.degree = (monomial n s).degree := by
by_cases hzero : s = 0 · use 0 simp only [hzero, degree_zero, eq_self_iff_true, and_self_iff, monomial_zero_right, Polynomial.map_zero] rw [lifts_iff_set_range] at hl obtain ⟨q, hq⟩ := hl replace hq := (ext_iff.1 hq) n have hcoeff : f (q.coeff n) = s := by simp? [coeff_monomial] at hq says simp only [coeff_map, coeff_monomial, ↓reduceIte] at hq exact hq use monomial n (q.coeff n) constructor · simp only [hcoeff, map_monomial] have hqzero : q.coeff n ≠ 0 := by intro habs simp only [habs, RingHom.map_zero] at hcoeff exact hzero hcoeff.symm rw [← C_mul_X_pow_eq_monomial] rw [← C_mul_X_pow_eq_monomial] simp only [hzero, hqzero, Ne, not_false_iff, degree_C_mul_X_pow]
import Mathlib.Order.BoundedOrder import Mathlib.Order.MinMax import Mathlib.Algebra.NeZero import Mathlib.Algebra.Order.Monoid.Defs #align_import algebra.order.monoid.canonical.defs from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" universe u variable {α : Type u} class ExistsMulOfLE (α : Type u) [Mul α] [LE α] : Prop where exists_mul_of_le : ∀ {a b : α}, a ≤ b → ∃ c : α, b = a * c #align has_exists_mul_of_le ExistsMulOfLE class ExistsAddOfLE (α : Type u) [Add α] [LE α] : Prop where exists_add_of_le : ∀ {a b : α}, a ≤ b → ∃ c : α, b = a + c #align has_exists_add_of_le ExistsAddOfLE attribute [to_additive] ExistsMulOfLE export ExistsMulOfLE (exists_mul_of_le) export ExistsAddOfLE (exists_add_of_le) -- See note [lower instance priority] @[to_additive] instance (priority := 100) Group.existsMulOfLE (α : Type u) [Group α] [LE α] : ExistsMulOfLE α := ⟨fun {a b} _ => ⟨a⁻¹ * b, (mul_inv_cancel_left _ _).symm⟩⟩ #align group.has_exists_mul_of_le Group.existsMulOfLE #align add_group.has_exists_add_of_le AddGroup.existsAddOfLE section MulOneClass variable [MulOneClass α] [Preorder α] [ContravariantClass α α (· * ·) (· < ·)] [ExistsMulOfLE α] {a b : α} @[to_additive]
Mathlib/Algebra/Order/Monoid/Canonical/Defs.lean
56
58
theorem exists_one_lt_mul_of_lt' (h : a < b) : ∃ c, 1 < c ∧ a * c = b := by
obtain ⟨c, rfl⟩ := exists_mul_of_le h.le exact ⟨c, one_lt_of_lt_mul_right h, rfl⟩
import Mathlib.Data.PFunctor.Multivariate.Basic #align_import data.pfunctor.multivariate.W from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" universe u v namespace MvPFunctor open TypeVec open MvFunctor variable {n : ℕ} (P : MvPFunctor.{u} (n + 1)) inductive WPath : P.last.W → Fin2 n → Type u | root (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (c : P.drop.B a i) : WPath ⟨a, f⟩ i | child (a : P.A) (f : P.last.B a → P.last.W) (i : Fin2 n) (j : P.last.B a) (c : WPath (f j) i) : WPath ⟨a, f⟩ i set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path MvPFunctor.WPath instance WPath.inhabited (x : P.last.W) {i} [I : Inhabited (P.drop.B x.head i)] : Inhabited (WPath P x i) := ⟨match x, I with | ⟨a, f⟩, I => WPath.root a f i (@default _ I)⟩ set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path.inhabited MvPFunctor.WPath.inhabited def wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.WPath ⟨a, f⟩ ⟹ α := by intro i x; match x with | WPath.root _ _ i c => exact g' i c | WPath.child _ _ i j c => exact g j i c set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_cases_on MvPFunctor.wPathCasesOn def wPathDestLeft {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : P.drop.B a ⟹ α := fun i c => h i (WPath.root a f i c) set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_left MvPFunctor.wPathDestLeft def wPathDestRight {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : ∀ j : P.last.B a, P.WPath (f j) ⟹ α := fun j i c => h i (WPath.child a f i j c) set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_right MvPFunctor.wPathDestRight theorem wPathDestLeft_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.wPathDestLeft (P.wPathCasesOn g' g) = g' := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_left_W_path_cases_on MvPFunctor.wPathDestLeft_wPathCasesOn theorem wPathDestRight_wPathCasesOn {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (g' : P.drop.B a ⟹ α) (g : ∀ j : P.last.B a, P.WPath (f j) ⟹ α) : P.wPathDestRight (P.wPathCasesOn g' g) = g := rfl set_option linter.uppercaseLean3 false in #align mvpfunctor.W_path_dest_right_W_path_cases_on MvPFunctor.wPathDestRight_wPathCasesOn
Mathlib/Data/PFunctor/Multivariate/W.lean
109
111
theorem wPathCasesOn_eta {α : TypeVec n} {a : P.A} {f : P.last.B a → P.last.W} (h : P.WPath ⟨a, f⟩ ⟹ α) : P.wPathCasesOn (P.wPathDestLeft h) (P.wPathDestRight h) = h := by
ext i x; cases x <;> rfl
import Mathlib.Analysis.InnerProductSpace.TwoDim import Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic #align_import geometry.euclidean.angle.oriented.basic from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" noncomputable section open FiniteDimensional Complex open scoped Real RealInnerProductSpace ComplexConjugate namespace Orientation attribute [local instance] Complex.finrank_real_complex_fact variable {V V' : Type*} variable [NormedAddCommGroup V] [NormedAddCommGroup V'] variable [InnerProductSpace ℝ V] [InnerProductSpace ℝ V'] variable [Fact (finrank ℝ V = 2)] [Fact (finrank ℝ V' = 2)] (o : Orientation ℝ V (Fin 2)) local notation "ω" => o.areaForm def oangle (x y : V) : Real.Angle := Complex.arg (o.kahler x y) #align orientation.oangle Orientation.oangle theorem continuousAt_oangle {x : V × V} (hx1 : x.1 ≠ 0) (hx2 : x.2 ≠ 0) : ContinuousAt (fun y : V × V => o.oangle y.1 y.2) x := by refine (Complex.continuousAt_arg_coe_angle ?_).comp ?_ · exact o.kahler_ne_zero hx1 hx2 exact ((continuous_ofReal.comp continuous_inner).add ((continuous_ofReal.comp o.areaForm'.continuous₂).mul continuous_const)).continuousAt #align orientation.continuous_at_oangle Orientation.continuousAt_oangle @[simp] theorem oangle_zero_left (x : V) : o.oangle 0 x = 0 := by simp [oangle] #align orientation.oangle_zero_left Orientation.oangle_zero_left @[simp]
Mathlib/Geometry/Euclidean/Angle/Oriented/Basic.lean
73
73
theorem oangle_zero_right (x : V) : o.oangle x 0 = 0 := by
simp [oangle]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Algebra variable {R : Type u} [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] def mapAlg (R : Type u) [CommSemiring R] (S : Type v) [Semiring S] [Algebra R S] : R[X] →ₐ[R] S[X] := @aeval _ S[X] _ _ _ (X : S[X]) #align polynomial.map_alg Polynomial.mapAlg theorem mapAlg_eq_map (p : R[X]) : mapAlg R S p = map (algebraMap R S) p := by simp only [mapAlg, aeval_def, eval₂_eq_sum, map, algebraMap_apply, RingHom.coe_comp] ext; congr #align polynomial.map_alg_eq_map Polynomial.mapAlg_eq_map theorem mem_lifts_iff_mem_alg (R : Type u) [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] (p : S[X]) : p ∈ lifts (algebraMap R S) ↔ p ∈ AlgHom.range (@mapAlg R _ S _ _) := by simp only [coe_mapRingHom, lifts, mapAlg_eq_map, AlgHom.mem_range, RingHom.mem_rangeS] #align polynomial.mem_lifts_iff_mem_alg Polynomial.mem_lifts_iff_mem_alg
Mathlib/Algebra/Polynomial/Lifts.lean
286
289
theorem smul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts (algebraMap R S)) : r • p ∈ lifts (algebraMap R S) := by
rw [mem_lifts_iff_mem_alg] at hp ⊢ exact Subalgebra.smul_mem (mapAlg R S).range hp r
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]
Mathlib/Analysis/Complex/ReImTopology.lean
129
130
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)
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.GeomSum import Mathlib.Data.Fintype.BigOperators import Mathlib.RingTheory.PowerSeries.Inverse import Mathlib.RingTheory.PowerSeries.WellKnown import Mathlib.Tactic.FieldSimp #align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" open Nat Finset Finset.Nat PowerSeries variable (A : Type*) [CommRing A] [Algebra ℚ A] def bernoulli' : ℕ → ℚ := WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' => 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2 #align bernoulli' bernoulli' theorem bernoulli'_def' (n : ℕ) : bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k := WellFounded.fix_eq _ _ _ #align bernoulli'_def' bernoulli'_def' theorem bernoulli'_def (n : ℕ) : bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k := by rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range] #align bernoulli'_def bernoulli'_def theorem bernoulli'_spec (n : ℕ) : (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 := by rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul, sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero] exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]) #align bernoulli'_spec bernoulli'_spec theorem bernoulli'_spec' (n : ℕ) : (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 := by refine ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans ?_).trans (bernoulli'_spec n) refine sum_congr rfl fun x hx => ?_ simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub] #align bernoulli'_spec' bernoulli'_spec' section Examples @[simp] theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def] norm_num #align bernoulli'_zero bernoulli'_zero @[simp] theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def] norm_num #align bernoulli'_one bernoulli'_one @[simp] theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_two bernoulli'_two @[simp] theorem bernoulli'_three : bernoulli' 3 = 0 := by rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero] #align bernoulli'_three bernoulli'_three @[simp]
Mathlib/NumberTheory/Bernoulli.lean
128
131
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 := by
have : Nat.choose 4 2 = 6 := by decide -- shrug rw [bernoulli'_def] norm_num [sum_range_succ, sum_range_succ, sum_range_zero, this]
import Mathlib.Algebra.Order.BigOperators.Ring.Finset import Mathlib.Data.NNRat.Defs variable {ι α : Type*} namespace NNRat @[norm_cast] theorem coe_list_sum (l : List ℚ≥0) : (l.sum : ℚ) = (l.map (↑)).sum := map_list_sum coeHom _ #align nnrat.coe_list_sum NNRat.coe_list_sum @[norm_cast] theorem coe_list_prod (l : List ℚ≥0) : (l.prod : ℚ) = (l.map (↑)).prod := map_list_prod coeHom _ #align nnrat.coe_list_prod NNRat.coe_list_prod @[norm_cast] theorem coe_multiset_sum (s : Multiset ℚ≥0) : (s.sum : ℚ) = (s.map (↑)).sum := map_multiset_sum coeHom _ #align nnrat.coe_multiset_sum NNRat.coe_multiset_sum @[norm_cast] theorem coe_multiset_prod (s : Multiset ℚ≥0) : (s.prod : ℚ) = (s.map (↑)).prod := map_multiset_prod coeHom _ #align nnrat.coe_multiset_prod NNRat.coe_multiset_prod @[norm_cast] theorem coe_sum {s : Finset α} {f : α → ℚ≥0} : ↑(∑ a ∈ s, f a) = ∑ a ∈ s, (f a : ℚ) := map_sum coeHom _ _ #align nnrat.coe_sum NNRat.coe_sum
Mathlib/Data/NNRat/BigOperators.lean
41
44
theorem toNNRat_sum_of_nonneg {s : Finset α} {f : α → ℚ} (hf : ∀ a, a ∈ s → 0 ≤ f a) : (∑ a ∈ s, f a).toNNRat = ∑ a ∈ s, (f a).toNNRat := by
rw [← coe_inj, coe_sum, Rat.coe_toNNRat _ (Finset.sum_nonneg hf)] exact Finset.sum_congr rfl fun x hxs ↦ by rw [Rat.coe_toNNRat _ (hf x hxs)]
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] 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] #align finset.sym2_mono Finset.sym2_mono theorem monotone_sym2 : Monotone (Finset.sym2 : Finset α → _) := fun _ _ => sym2_mono theorem injective_sym2 : Function.Injective (Finset.sym2 : Finset α → _) := by intro s t h ext x simpa using congr(s(x, x) ∈ $h) theorem strictMono_sym2 : StrictMono (Finset.sym2 : Finset α → _) := monotone_sym2.strictMono_of_injective injective_sym2
Mathlib/Data/Finset/Sym.lean
85
89
theorem sym2_toFinset [DecidableEq α] (m : Multiset α) : m.toFinset.sym2 = m.sym2.toFinset := by
ext z refine z.ind fun x y ↦ ?_ simp only [mk_mem_sym2_iff, Multiset.mem_toFinset, Multiset.mk_mem_sym2_iff]
import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic import Mathlib.CategoryTheory.Preadditive.Injective import Mathlib.Algebra.Category.GroupCat.EpiMono import Mathlib.Algebra.Category.ModuleCat.EpiMono #align_import category_theory.preadditive.yoneda.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946" universe v u open Opposite namespace CategoryTheory variable {C : Type u} [Category.{v} C] section Preadditive variable [Preadditive C] namespace Injective
Mathlib/CategoryTheory/Preadditive/Yoneda/Injective.lean
32
40
theorem injective_iff_preservesEpimorphisms_preadditiveYoneda_obj (J : C) : Injective J ↔ (preadditiveYoneda.obj J).PreservesEpimorphisms := by
rw [injective_iff_preservesEpimorphisms_yoneda_obj] refine ⟨fun h : (preadditiveYoneda.obj J ⋙ (forget AddCommGroupCat)).PreservesEpimorphisms => ?_, ?_⟩ · exact Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveYoneda.obj J) (forget _) · intro exact (inferInstance : (preadditiveYoneda.obj J ⋙ forget _).PreservesEpimorphisms)
import Mathlib.Data.Finset.Sort import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Sign import Mathlib.LinearAlgebra.AffineSpace.Combination import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Finset Function open scoped Affine section AffineIndependent variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} def AffineIndependent (p : ι → P) : Prop := ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 #align affine_independent AffineIndependent theorem affineIndependent_def (p : ι → P) : AffineIndependent k p ↔ ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 := Iff.rfl #align affine_independent_def affineIndependent_def theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p := fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi #align affine_independent_of_subsingleton affineIndependent_of_subsingleton theorem affineIndependent_iff_of_fintype [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w : ι → k, ∑ i, w i = 0 → Finset.univ.weightedVSub p w = (0 : V) → ∀ i, w i = 0 := by constructor · exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _) · intro h s w hw hs i hi rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs rw [← Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw replace h := h ((↑s : Set ι).indicator w) hw hs i simpa [hi] using h #align affine_independent_iff_of_fintype affineIndependent_iff_of_fintype theorem affineIndependent_iff_linearIndependent_vsub (p : ι → P) (i1 : ι) : AffineIndependent k p ↔ LinearIndependent k fun i : { x // x ≠ i1 } => (p i -ᵥ p i1 : V) := by classical constructor · intro h rw [linearIndependent_iff'] intro s g hg i hi set f : ι → k := fun x => if hx : x = i1 then -∑ y ∈ s, g y else g ⟨x, hx⟩ with hfdef let s2 : Finset ι := insert i1 (s.map (Embedding.subtype _)) have hfg : ∀ x : { x // x ≠ i1 }, g x = f x := by intro x rw [hfdef] dsimp only erw [dif_neg x.property, Subtype.coe_eta] rw [hfg] have hf : ∑ ι ∈ s2, f ι = 0 := by rw [Finset.sum_insert (Finset.not_mem_map_subtype_of_not_property s (Classical.not_not.2 rfl)), Finset.sum_subtype_map_embedding fun x _ => (hfg x).symm] rw [hfdef] dsimp only rw [dif_pos rfl] exact neg_add_self _ have hs2 : s2.weightedVSub p f = (0 : V) := by set f2 : ι → V := fun x => f x • (p x -ᵥ p i1) with hf2def set g2 : { x // x ≠ i1 } → V := fun x => g x • (p x -ᵥ p i1) have hf2g2 : ∀ x : { x // x ≠ i1 }, f2 x = g2 x := by simp only [g2, hf2def] refine fun x => ?_ rw [hfg] rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s2 f p hf (p i1), Finset.weightedVSubOfPoint_insert, Finset.weightedVSubOfPoint_apply, Finset.sum_subtype_map_embedding fun x _ => hf2g2 x] exact hg exact h s2 f hf hs2 i (Finset.mem_insert_of_mem (Finset.mem_map.2 ⟨i, hi, rfl⟩)) · intro h rw [linearIndependent_iff'] at h intro s w hw hs i hi rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s w p hw (p i1), ← s.weightedVSubOfPoint_erase w p i1, Finset.weightedVSubOfPoint_apply] at hs let f : ι → V := fun i => w i • (p i -ᵥ p i1) have hs2 : (∑ i ∈ (s.erase i1).subtype fun i => i ≠ i1, f i) = 0 := by rw [← hs] convert Finset.sum_subtype_of_mem f fun x => Finset.ne_of_mem_erase have h2 := h ((s.erase i1).subtype fun i => i ≠ i1) (fun x => w x) hs2 simp_rw [Finset.mem_subtype] at h2 have h2b : ∀ i ∈ s, i ≠ i1 → w i = 0 := fun i his hi => h2 ⟨i, hi⟩ (Finset.mem_erase_of_ne_of_mem hi his) exact Finset.eq_zero_of_sum_eq_zero hw h2b i hi #align affine_independent_iff_linear_independent_vsub affineIndependent_iff_linearIndependent_vsub
Mathlib/LinearAlgebra/AffineSpace/Independent.lean
139
158
theorem affineIndependent_set_iff_linearIndependent_vsub {s : Set P} {p₁ : P} (hp₁ : p₁ ∈ s) : AffineIndependent k (fun p => p : s → P) ↔ LinearIndependent k (fun v => v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → V) := by
rw [affineIndependent_iff_linearIndependent_vsub k (fun p => p : s → P) ⟨p₁, hp₁⟩] constructor · intro h have hv : ∀ v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}), (v : V) +ᵥ p₁ ∈ s \ {p₁} := fun v => (vsub_left_injective p₁).mem_set_image.1 ((vadd_vsub (v : V) p₁).symm ▸ v.property) let f : (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → { x : s // x ≠ ⟨p₁, hp₁⟩ } := fun x => ⟨⟨(x : V) +ᵥ p₁, Set.mem_of_mem_diff (hv x)⟩, fun hx => Set.not_mem_of_mem_diff (hv x) (Subtype.ext_iff.1 hx)⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (vadd_right_cancel p₁ (Subtype.ext_iff.1 (Subtype.ext_iff.1 hx))) ext v exact (vadd_vsub (v : V) p₁).symm · intro h let f : { x : s // x ≠ ⟨p₁, hp₁⟩ } → (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) := fun x => ⟨((x : s) : P) -ᵥ p₁, ⟨x, ⟨⟨(x : s).property, fun hx => x.property (Subtype.ext hx)⟩, rfl⟩⟩⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (Subtype.ext (vsub_left_cancel (Subtype.ext_iff.1 hx)))
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.GroupTheory.GroupAction.Basic import Mathlib.Dynamics.PeriodicPts import Mathlib.Data.Set.Pointwise.SMul namespace MulAction open Pointwise variable {α : Type*} variable {G : Type*} [Group G] [MulAction G α] variable {M : Type*} [Monoid M] [MulAction M α] section FixedPoints variable (α) in @[to_additive (attr := simp) "In an additive group action, the points fixed by `g` are also fixed by `g⁻¹`"] theorem fixedBy_inv (g : G) : fixedBy α g⁻¹ = fixedBy α g := by ext rw [mem_fixedBy, mem_fixedBy, inv_smul_eq_iff, eq_comm] @[to_additive] theorem smul_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} : g • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by rw [mem_fixedBy, smul_left_cancel_iff] rfl @[to_additive] theorem smul_inv_mem_fixedBy_iff_mem_fixedBy {a : α} {g : G} : g⁻¹ • a ∈ fixedBy α g ↔ a ∈ fixedBy α g := by rw [← fixedBy_inv, smul_mem_fixedBy_iff_mem_fixedBy, fixedBy_inv] @[to_additive minimalPeriod_eq_one_iff_fixedBy] theorem minimalPeriod_eq_one_iff_fixedBy {a : α} {g : G} : Function.minimalPeriod (fun x => g • x) a = 1 ↔ a ∈ fixedBy α g := Function.minimalPeriod_eq_one_iff_isFixedPt variable (α) in @[to_additive] theorem fixedBy_subset_fixedBy_zpow (g : G) (j : ℤ) : fixedBy α g ⊆ fixedBy α (g ^ j) := by intro a a_in_fixedBy rw [mem_fixedBy, zpow_smul_eq_iff_minimalPeriod_dvd, minimalPeriod_eq_one_iff_fixedBy.mpr a_in_fixedBy, Nat.cast_one] exact one_dvd j variable (M α) in @[to_additive (attr := simp)] theorem fixedBy_one_eq_univ : fixedBy α (1 : M) = Set.univ := Set.eq_univ_iff_forall.mpr <| one_smul M variable (α) in @[to_additive]
Mathlib/GroupTheory/GroupAction/FixedPoints.lean
96
98
theorem fixedBy_mul (m₁ m₂ : M) : fixedBy α m₁ ∩ fixedBy α m₂ ⊆ fixedBy α (m₁ * m₂) := by
intro a ⟨h₁, h₂⟩ rw [mem_fixedBy, mul_smul, h₂, h₁]
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.Data.Fintype.Card import Mathlib.GroupTheory.Perm.Basic #align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Equiv Finset namespace Equiv.Perm variable {α : Type*} section support section Set variable (p q : Perm α)
Mathlib/GroupTheory/Perm/Support.lean
264
267
theorem set_support_inv_eq : { x | p⁻¹ x ≠ x } = { x | p x ≠ x } := by
ext x simp only [Set.mem_setOf_eq, Ne] rw [inv_def, symm_apply_eq, eq_comm]
import Mathlib.Data.Fintype.Basic import Mathlib.GroupTheory.Perm.Sign import Mathlib.Logic.Equiv.Defs #align_import logic.equiv.fintype from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f" namespace Equiv variable {α β : Type*} [Finite α] noncomputable def toCompl {p q : α → Prop} (e : { x // p x } ≃ { x // q x }) : { x // ¬p x } ≃ { x // ¬q x } := by apply Classical.choice cases nonempty_fintype α classical exact Fintype.card_eq.mp <| Fintype.card_compl_eq_card_compl _ _ <| Fintype.card_congr e #align equiv.to_compl Equiv.toCompl variable {p q : α → Prop} [DecidablePred p] [DecidablePred q] noncomputable abbrev extendSubtype (e : { x // p x } ≃ { x // q x }) : Perm α := subtypeCongr e e.toCompl #align equiv.extend_subtype Equiv.extendSubtype theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : e.extendSubtype x = e ⟨x, hx⟩ := by dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl] #align equiv.extend_subtype_apply_of_mem Equiv.extendSubtype_apply_of_mem theorem extendSubtype_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) : q (e.extendSubtype x) := by convert (e ⟨x, hx⟩).2 rw [e.extendSubtype_apply_of_mem _ hx] #align equiv.extend_subtype_mem Equiv.extendSubtype_mem
Mathlib/Logic/Equiv/Fintype.lean
138
142
theorem extendSubtype_apply_of_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : ¬p x) : e.extendSubtype x = e.toCompl ⟨x, hx⟩ := by
dsimp only [extendSubtype] simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply] rw [sumCompl_apply_symm_of_neg _ _ hx, Sum.map_inr, sumCompl_apply_inr]
import Mathlib.MeasureTheory.Integral.IntegrableOn #align_import measure_theory.function.locally_integrable from "leanprover-community/mathlib"@"08a4542bec7242a5c60f179e4e49de8c0d677b1b" open MeasureTheory MeasureTheory.Measure Set Function TopologicalSpace Bornology open scoped Topology Interval ENNReal variable {X Y E F R : Type*} [MeasurableSpace X] [TopologicalSpace X] variable [MeasurableSpace Y] [TopologicalSpace Y] variable [NormedAddCommGroup E] [NormedAddCommGroup F] {f g : X → E} {μ : Measure X} {s : Set X} namespace MeasureTheory section LocallyIntegrableOn def LocallyIntegrableOn (f : X → E) (s : Set X) (μ : Measure X := by volume_tac) : Prop := ∀ x : X, x ∈ s → IntegrableAtFilter f (𝓝[s] x) μ #align measure_theory.locally_integrable_on MeasureTheory.LocallyIntegrableOn theorem LocallyIntegrableOn.mono_set (hf : LocallyIntegrableOn f s μ) {t : Set X} (hst : t ⊆ s) : LocallyIntegrableOn f t μ := fun x hx => (hf x <| hst hx).filter_mono (nhdsWithin_mono x hst) #align measure_theory.locally_integrable_on.mono MeasureTheory.LocallyIntegrableOn.mono_set theorem LocallyIntegrableOn.norm (hf : LocallyIntegrableOn f s μ) : LocallyIntegrableOn (fun x => ‖f x‖) s μ := fun t ht => let ⟨U, hU_nhd, hU_int⟩ := hf t ht ⟨U, hU_nhd, hU_int.norm⟩ #align measure_theory.locally_integrable_on.norm MeasureTheory.LocallyIntegrableOn.norm theorem LocallyIntegrableOn.mono (hf : LocallyIntegrableOn f s μ) {g : X → F} (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ x ∂μ, ‖g x‖ ≤ ‖f x‖) : LocallyIntegrableOn g s μ := by intro x hx rcases hf x hx with ⟨t, t_mem, ht⟩ exact ⟨t, t_mem, Integrable.mono ht hg.restrict (ae_restrict_of_ae h)⟩ theorem IntegrableOn.locallyIntegrableOn (hf : IntegrableOn f s μ) : LocallyIntegrableOn f s μ := fun _ _ => ⟨s, self_mem_nhdsWithin, hf⟩ #align measure_theory.integrable_on.locally_integrable_on MeasureTheory.IntegrableOn.locallyIntegrableOn theorem LocallyIntegrableOn.integrableOn_isCompact (hf : LocallyIntegrableOn f s μ) (hs : IsCompact s) : IntegrableOn f s μ := IsCompact.induction_on hs integrableOn_empty (fun _u _v huv hv => hv.mono_set huv) (fun _u _v hu hv => integrableOn_union.mpr ⟨hu, hv⟩) hf #align measure_theory.locally_integrable_on.integrable_on_is_compact MeasureTheory.LocallyIntegrableOn.integrableOn_isCompact theorem LocallyIntegrableOn.integrableOn_compact_subset (hf : LocallyIntegrableOn f s μ) {t : Set X} (hst : t ⊆ s) (ht : IsCompact t) : IntegrableOn f t μ := (hf.mono_set hst).integrableOn_isCompact ht #align measure_theory.locally_integrable_on.integrable_on_compact_subset MeasureTheory.LocallyIntegrableOn.integrableOn_compact_subset theorem LocallyIntegrableOn.exists_countable_integrableOn [SecondCountableTopology X] (hf : LocallyIntegrableOn f s μ) : ∃ T : Set (Set X), T.Countable ∧ (∀ u ∈ T, IsOpen u) ∧ (s ⊆ ⋃ u ∈ T, u) ∧ (∀ u ∈ T, IntegrableOn f (u ∩ s) μ) := by have : ∀ x : s, ∃ u, IsOpen u ∧ x.1 ∈ u ∧ IntegrableOn f (u ∩ s) μ := by rintro ⟨x, hx⟩ rcases hf x hx with ⟨t, ht, h't⟩ rcases mem_nhdsWithin.1 ht with ⟨u, u_open, x_mem, u_sub⟩ exact ⟨u, u_open, x_mem, h't.mono_set u_sub⟩ choose u u_open xu hu using this obtain ⟨T, T_count, hT⟩ : ∃ T : Set s, T.Countable ∧ s ⊆ ⋃ i ∈ T, u i := by have : s ⊆ ⋃ x : s, u x := fun y hy => mem_iUnion_of_mem ⟨y, hy⟩ (xu ⟨y, hy⟩) obtain ⟨T, hT_count, hT_un⟩ := isOpen_iUnion_countable u u_open exact ⟨T, hT_count, by rwa [hT_un]⟩ refine ⟨u '' T, T_count.image _, ?_, by rwa [biUnion_image], ?_⟩ · rintro v ⟨w, -, rfl⟩ exact u_open _ · rintro v ⟨w, -, rfl⟩ exact hu _
Mathlib/MeasureTheory/Function/LocallyIntegrable.lean
105
129
theorem LocallyIntegrableOn.exists_nat_integrableOn [SecondCountableTopology X] (hf : LocallyIntegrableOn f s μ) : ∃ u : ℕ → Set X, (∀ n, IsOpen (u n)) ∧ (s ⊆ ⋃ n, u n) ∧ (∀ n, IntegrableOn f (u n ∩ s) μ) := by
rcases hf.exists_countable_integrableOn with ⟨T, T_count, T_open, sT, hT⟩ let T' : Set (Set X) := insert ∅ T have T'_count : T'.Countable := Countable.insert ∅ T_count have T'_ne : T'.Nonempty := by simp only [T', insert_nonempty] rcases T'_count.exists_eq_range T'_ne with ⟨u, hu⟩ refine ⟨u, ?_, ?_, ?_⟩ · intro n have : u n ∈ T' := by rw [hu]; exact mem_range_self n rcases mem_insert_iff.1 this with h|h · rw [h] exact isOpen_empty · exact T_open _ h · intro x hx obtain ⟨v, hv, h'v⟩ : ∃ v, v ∈ T ∧ x ∈ v := by simpa only [mem_iUnion, exists_prop] using sT hx have : v ∈ range u := by rw [← hu]; exact subset_insert ∅ T hv obtain ⟨n, rfl⟩ : ∃ n, u n = v := by simpa only [mem_range] using this exact mem_iUnion_of_mem _ h'v · intro n have : u n ∈ T' := by rw [hu]; exact mem_range_self n rcases mem_insert_iff.1 this with h|h · simp only [h, empty_inter, integrableOn_empty] · exact hT _ h
import Mathlib.RingTheory.DedekindDomain.Ideal #align_import number_theory.ramification_inertia from "leanprover-community/mathlib"@"039a089d2a4b93c761b234f3e5f5aeb752bac60f" namespace Ideal universe u v variable {R : Type u} [CommRing R] variable {S : Type v} [CommRing S] (f : R →+* S) variable (p : Ideal R) (P : Ideal S) open FiniteDimensional open UniqueFactorizationMonoid section DecEq open scoped Classical noncomputable def ramificationIdx : ℕ := sSup {n | map f p ≤ P ^ n} #align ideal.ramification_idx Ideal.ramificationIdx variable {f p P} theorem ramificationIdx_eq_find (h : ∃ n, ∀ k, map f p ≤ P ^ k → k ≤ n) : ramificationIdx f p P = Nat.find h := Nat.sSup_def h #align ideal.ramification_idx_eq_find Ideal.ramificationIdx_eq_find theorem ramificationIdx_eq_zero (h : ∀ n : ℕ, ∃ k, map f p ≤ P ^ k ∧ n < k) : ramificationIdx f p P = 0 := dif_neg (by push_neg; exact h) #align ideal.ramification_idx_eq_zero Ideal.ramificationIdx_eq_zero theorem ramificationIdx_spec {n : ℕ} (hle : map f p ≤ P ^ n) (hgt : ¬map f p ≤ P ^ (n + 1)) : ramificationIdx f p P = n := by let Q : ℕ → Prop := fun m => ∀ k : ℕ, map f p ≤ P ^ k → k ≤ m have : Q n := by intro k hk refine le_of_not_lt fun hnk => ?_ exact hgt (hk.trans (Ideal.pow_le_pow_right hnk)) rw [ramificationIdx_eq_find ⟨n, this⟩] refine le_antisymm (Nat.find_min' _ this) (le_of_not_gt fun h : Nat.find _ < n => ?_) obtain this' := Nat.find_spec ⟨n, this⟩ exact h.not_le (this' _ hle) #align ideal.ramification_idx_spec Ideal.ramificationIdx_spec theorem ramificationIdx_lt {n : ℕ} (hgt : ¬map f p ≤ P ^ n) : ramificationIdx f p P < n := by cases' n with n n · simp at hgt · rw [Nat.lt_succ_iff] have : ∀ k, map f p ≤ P ^ k → k ≤ n := by refine fun k hk => le_of_not_lt fun hnk => ?_ exact hgt (hk.trans (Ideal.pow_le_pow_right hnk)) rw [ramificationIdx_eq_find ⟨n, this⟩] exact Nat.find_min' ⟨n, this⟩ this #align ideal.ramification_idx_lt Ideal.ramificationIdx_lt @[simp] theorem ramificationIdx_bot : ramificationIdx f ⊥ P = 0 := dif_neg <| not_exists.mpr fun n hn => n.lt_succ_self.not_le (hn _ (by simp)) #align ideal.ramification_idx_bot Ideal.ramificationIdx_bot @[simp] theorem ramificationIdx_of_not_le (h : ¬map f p ≤ P) : ramificationIdx f p P = 0 := ramificationIdx_spec (by simp) (by simpa using h) #align ideal.ramification_idx_of_not_le Ideal.ramificationIdx_of_not_le theorem ramificationIdx_ne_zero {e : ℕ} (he : e ≠ 0) (hle : map f p ≤ P ^ e) (hnle : ¬map f p ≤ P ^ (e + 1)) : ramificationIdx f p P ≠ 0 := by rwa [ramificationIdx_spec hle hnle] #align ideal.ramification_idx_ne_zero Ideal.ramificationIdx_ne_zero theorem le_pow_of_le_ramificationIdx {n : ℕ} (hn : n ≤ ramificationIdx f p P) : map f p ≤ P ^ n := by contrapose! hn exact ramificationIdx_lt hn #align ideal.le_pow_of_le_ramification_idx Ideal.le_pow_of_le_ramificationIdx theorem le_pow_ramificationIdx : map f p ≤ P ^ ramificationIdx f p P := le_pow_of_le_ramificationIdx (le_refl _) #align ideal.le_pow_ramification_idx Ideal.le_pow_ramificationIdx theorem le_comap_pow_ramificationIdx : p ≤ comap f (P ^ ramificationIdx f p P) := map_le_iff_le_comap.mp le_pow_ramificationIdx #align ideal.le_comap_pow_ramification_idx Ideal.le_comap_pow_ramificationIdx theorem le_comap_of_ramificationIdx_ne_zero (h : ramificationIdx f p P ≠ 0) : p ≤ comap f P := Ideal.map_le_iff_le_comap.mp <| le_pow_ramificationIdx.trans <| Ideal.pow_le_self <| h #align ideal.le_comap_of_ramification_idx_ne_zero Ideal.le_comap_of_ramificationIdx_ne_zero variable (f p P) attribute [local instance] Ideal.Quotient.field noncomputable def inertiaDeg [p.IsMaximal] : ℕ := if hPp : comap f P = p then @finrank (R ⧸ p) (S ⧸ P) _ _ <| @Algebra.toModule _ _ _ _ <| RingHom.toAlgebra <| Ideal.Quotient.lift p ((Ideal.Quotient.mk P).comp f) fun _ ha => Quotient.eq_zero_iff_mem.mpr <| mem_comap.mp <| hPp.symm ▸ ha else 0 #align ideal.inertia_deg Ideal.inertiaDeg -- Useful for the `nontriviality` tactic using `comap_eq_of_scalar_tower_quotient`. @[simp]
Mathlib/NumberTheory/RamificationInertia.lean
198
202
theorem inertiaDeg_of_subsingleton [hp : p.IsMaximal] [hQ : Subsingleton (S ⧸ P)] : inertiaDeg f p P = 0 := by
have := Ideal.Quotient.subsingleton_iff.mp hQ subst this exact dif_neg fun h => hp.ne_top <| h.symm.trans comap_top
import Mathlib.Algebra.BigOperators.Ring import Mathlib.Combinatorics.Derangements.Basic import Mathlib.Data.Fintype.BigOperators import Mathlib.Tactic.Ring #align_import combinatorics.derangements.finite from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open derangements Equiv Fintype variable {α : Type*} [DecidableEq α] [Fintype α] instance : DecidablePred (derangements α) := fun _ => Fintype.decidableForallFintype -- Porting note: used to use the tactic delta_instance instance : Fintype (derangements α) := Subtype.fintype (fun (_ : Perm α) => ∀ (x_1 : α), ¬_ = x_1) theorem card_derangements_invariant {α β : Type*} [Fintype α] [DecidableEq α] [Fintype β] [DecidableEq β] (h : card α = card β) : card (derangements α) = card (derangements β) := Fintype.card_congr (Equiv.derangementsCongr <| equivOfCardEq h) #align card_derangements_invariant card_derangements_invariant theorem card_derangements_fin_add_two (n : ℕ) : card (derangements (Fin (n + 2))) = (n + 1) * card (derangements (Fin n)) + (n + 1) * card (derangements (Fin (n + 1))) := by -- get some basic results about the size of fin (n+1) plus or minus an element have h1 : ∀ a : Fin (n + 1), card ({a}ᶜ : Set (Fin (n + 1))) = card (Fin n) := by intro a simp only [Fintype.card_fin, Finset.card_fin, Fintype.card_ofFinset, Finset.filter_ne' _ a, Set.mem_compl_singleton_iff, Finset.card_erase_of_mem (Finset.mem_univ a), add_tsub_cancel_right] have h2 : card (Fin (n + 2)) = card (Option (Fin (n + 1))) := by simp only [card_fin, card_option] -- rewrite the LHS and substitute in our fintype-level equivalence simp only [card_derangements_invariant h2, card_congr (@derangementsRecursionEquiv (Fin (n + 1)) _),-- push the cardinality through the Σ and ⊕ so that we can use `card_n` card_sigma, card_sum, card_derangements_invariant (h1 _), Finset.sum_const, nsmul_eq_mul, Finset.card_fin, mul_add, Nat.cast_id] #align card_derangements_fin_add_two card_derangements_fin_add_two def numDerangements : ℕ → ℕ | 0 => 1 | 1 => 0 | n + 2 => (n + 1) * (numDerangements n + numDerangements (n + 1)) #align num_derangements numDerangements @[simp] theorem numDerangements_zero : numDerangements 0 = 1 := rfl #align num_derangements_zero numDerangements_zero @[simp] theorem numDerangements_one : numDerangements 1 = 0 := rfl #align num_derangements_one numDerangements_one theorem numDerangements_add_two (n : ℕ) : numDerangements (n + 2) = (n + 1) * (numDerangements n + numDerangements (n + 1)) := rfl #align num_derangements_add_two numDerangements_add_two theorem numDerangements_succ (n : ℕ) : (numDerangements (n + 1) : ℤ) = (n + 1) * (numDerangements n : ℤ) - (-1) ^ n := by induction' n with n hn · rfl · simp only [numDerangements_add_two, hn, pow_succ, Int.ofNat_mul, Int.ofNat_add, Int.ofNat_succ] ring #align num_derangements_succ numDerangements_succ theorem card_derangements_fin_eq_numDerangements {n : ℕ} : card (derangements (Fin n)) = numDerangements n := by induction' n using Nat.strong_induction_on with n hyp rcases n with _ | _ | n -- knock out cases 0 and 1 · rfl · rfl -- now we have n ≥ 2. rewrite everything in terms of card_derangements, so that we can use -- `card_derangements_fin_add_two` rw [numDerangements_add_two, card_derangements_fin_add_two, mul_add, hyp, hyp] <;> omega #align card_derangements_fin_eq_num_derangements card_derangements_fin_eq_numDerangements theorem card_derangements_eq_numDerangements (α : Type*) [Fintype α] [DecidableEq α] : card (derangements α) = numDerangements (card α) := by rw [← card_derangements_invariant (card_fin _)] exact card_derangements_fin_eq_numDerangements #align card_derangements_eq_num_derangements card_derangements_eq_numDerangements
Mathlib/Combinatorics/Derangements/Finite.lean
113
124
theorem numDerangements_sum (n : ℕ) : (numDerangements n : ℤ) = ∑ k ∈ Finset.range (n + 1), (-1 : ℤ) ^ k * Nat.ascFactorial (k + 1) (n - k) := by
induction' n with n hn; · rfl rw [Finset.sum_range_succ, numDerangements_succ, hn, Finset.mul_sum, tsub_self, Nat.ascFactorial_zero, Int.ofNat_one, mul_one, pow_succ', neg_one_mul, sub_eq_add_neg, add_left_inj, Finset.sum_congr rfl] -- show that (n + 1) * (-1)^x * asc_fac x (n - x) = (-1)^x * asc_fac x (n.succ - x) intro x hx have h_le : x ≤ n := Finset.mem_range_succ_iff.mp hx rw [Nat.succ_sub h_le, Nat.ascFactorial_succ, add_right_comm, add_tsub_cancel_of_le h_le, Int.ofNat_mul, Int.ofNat_add, mul_left_comm, Nat.cast_one]
import Mathlib.Algebra.DirectSum.Module import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.Convex.Uniform import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.BoundedLinearMaps #align_import analysis.inner_product_space.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" noncomputable section open RCLike Real Filter open Topology ComplexConjugate open LinearMap (BilinForm) variable {𝕜 E F : Type*} [RCLike 𝕜] class Inner (𝕜 E : Type*) where inner : E → E → 𝕜 #align has_inner Inner export Inner (inner) notation3:max "⟪" x ", " y "⟫_" 𝕜:max => @inner 𝕜 _ _ x y class InnerProductSpace (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] extends NormedSpace 𝕜 E, Inner 𝕜 E where norm_sq_eq_inner : ∀ x : E, ‖x‖ ^ 2 = re (inner x x) conj_symm : ∀ x y, conj (inner y x) = inner x y add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y #align inner_product_space InnerProductSpace -- @[nolint HasNonemptyInstance] porting note: I don't think we have this linter anymore structure InnerProductSpace.Core (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] [Module 𝕜 F] extends Inner 𝕜 F where conj_symm : ∀ x y, conj (inner y x) = inner x y nonneg_re : ∀ x, 0 ≤ re (inner x x) definite : ∀ x, inner x x = 0 → x = 0 add_left : ∀ x y z, inner (x + y) z = inner x z + inner y z smul_left : ∀ x y r, inner (r • x) y = conj r * inner x y #align inner_product_space.core InnerProductSpace.Core attribute [class] InnerProductSpace.Core def InnerProductSpace.toCore [NormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : InnerProductSpace.Core 𝕜 E := { c with nonneg_re := fun x => by rw [← InnerProductSpace.norm_sq_eq_inner] apply sq_nonneg definite := fun x hx => norm_eq_zero.1 <| pow_eq_zero (n := 2) <| by rw [InnerProductSpace.norm_sq_eq_inner (𝕜 := 𝕜) x, hx, map_zero] } #align inner_product_space.to_core InnerProductSpace.toCore namespace InnerProductSpace.Core variable [AddCommGroup F] [Module 𝕜 F] [c : InnerProductSpace.Core 𝕜 F] local notation "⟪" x ", " y "⟫" => @inner 𝕜 F _ x y local notation "normSqK" => @RCLike.normSq 𝕜 _ local notation "reK" => @RCLike.re 𝕜 _ local notation "ext_iff" => @RCLike.ext_iff 𝕜 _ local postfix:90 "†" => starRingEnd _ def toInner' : Inner 𝕜 F := c.toInner #align inner_product_space.core.to_has_inner' InnerProductSpace.Core.toInner' attribute [local instance] toInner' def normSq (x : F) := reK ⟪x, x⟫ #align inner_product_space.core.norm_sq InnerProductSpace.Core.normSq local notation "normSqF" => @normSq 𝕜 F _ _ _ _ theorem inner_conj_symm (x y : F) : ⟪y, x⟫† = ⟪x, y⟫ := c.conj_symm x y #align inner_product_space.core.inner_conj_symm InnerProductSpace.Core.inner_conj_symm theorem inner_self_nonneg {x : F} : 0 ≤ re ⟪x, x⟫ := c.nonneg_re _ #align inner_product_space.core.inner_self_nonneg InnerProductSpace.Core.inner_self_nonneg theorem inner_self_im (x : F) : im ⟪x, x⟫ = 0 := by rw [← @ofReal_inj 𝕜, im_eq_conj_sub] simp [inner_conj_symm] #align inner_product_space.core.inner_self_im InnerProductSpace.Core.inner_self_im theorem inner_add_left (x y z : F) : ⟪x + y, z⟫ = ⟪x, z⟫ + ⟪y, z⟫ := c.add_left _ _ _ #align inner_product_space.core.inner_add_left InnerProductSpace.Core.inner_add_left theorem inner_add_right (x y z : F) : ⟪x, y + z⟫ = ⟪x, y⟫ + ⟪x, z⟫ := by rw [← inner_conj_symm, inner_add_left, RingHom.map_add]; simp only [inner_conj_symm] #align inner_product_space.core.inner_add_right InnerProductSpace.Core.inner_add_right theorem ofReal_normSq_eq_inner_self (x : F) : (normSqF x : 𝕜) = ⟪x, x⟫ := by rw [ext_iff] exact ⟨by simp only [ofReal_re]; rfl, by simp only [inner_self_im, ofReal_im]⟩ #align inner_product_space.core.coe_norm_sq_eq_inner_self InnerProductSpace.Core.ofReal_normSq_eq_inner_self
Mathlib/Analysis/InnerProductSpace/Basic.lean
229
229
theorem inner_re_symm (x y : F) : re ⟪x, y⟫ = re ⟪y, x⟫ := by
rw [← inner_conj_symm, conj_re]
import Mathlib.Data.ENNReal.Basic import Mathlib.Topology.ContinuousFunction.Bounded import Mathlib.Topology.MetricSpace.Thickening #align_import topology.metric_space.thickened_indicator from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open scoped Classical open NNReal ENNReal Topology BoundedContinuousFunction open NNReal ENNReal Set Metric EMetric Filter noncomputable section thickenedIndicator variable {α : Type*} [PseudoEMetricSpace α] def thickenedIndicatorAux (δ : ℝ) (E : Set α) : α → ℝ≥0∞ := fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ #align thickened_indicator_aux thickenedIndicatorAux theorem continuous_thickenedIndicatorAux {δ : ℝ} (δ_pos : 0 < δ) (E : Set α) : Continuous (thickenedIndicatorAux δ E) := by unfold thickenedIndicatorAux let f := fun x : α => (⟨1, infEdist x E / ENNReal.ofReal δ⟩ : ℝ≥0 × ℝ≥0∞) let sub := fun p : ℝ≥0 × ℝ≥0∞ => (p.1 : ℝ≥0∞) - p.2 rw [show (fun x : α => (1 : ℝ≥0∞) - infEdist x E / ENNReal.ofReal δ) = sub ∘ f by rfl] apply (@ENNReal.continuous_nnreal_sub 1).comp apply (ENNReal.continuous_div_const (ENNReal.ofReal δ) _).comp continuous_infEdist set_option tactic.skipAssignedInstances false in norm_num [δ_pos] #align continuous_thickened_indicator_aux continuous_thickenedIndicatorAux theorem thickenedIndicatorAux_le_one (δ : ℝ) (E : Set α) (x : α) : thickenedIndicatorAux δ E x ≤ 1 := by apply @tsub_le_self _ _ _ _ (1 : ℝ≥0∞) #align thickened_indicator_aux_le_one thickenedIndicatorAux_le_one theorem thickenedIndicatorAux_lt_top {δ : ℝ} {E : Set α} {x : α} : thickenedIndicatorAux δ E x < ∞ := lt_of_le_of_lt (thickenedIndicatorAux_le_one _ _ _) one_lt_top #align thickened_indicator_aux_lt_top thickenedIndicatorAux_lt_top
Mathlib/Topology/MetricSpace/ThickenedIndicator.lean
79
81
theorem thickenedIndicatorAux_closure_eq (δ : ℝ) (E : Set α) : thickenedIndicatorAux δ (closure E) = thickenedIndicatorAux δ E := by
simp (config := { unfoldPartialApp := true }) only [thickenedIndicatorAux, infEdist_closure]
import Batteries.Data.List.Lemmas import Batteries.Data.Array.Basic import Batteries.Tactic.SeqFocus import Batteries.Util.ProofWanted namespace Array theorem forIn_eq_data_forIn [Monad m] (as : Array α) (b : β) (f : α → β → m (ForInStep β)) : forIn as b f = forIn as.data b f := by let rec loop : ∀ {i h b j}, j + i = as.size → Array.forIn.loop as f i h b = forIn (as.data.drop j) b f | 0, _, _, _, rfl => by rw [List.drop_length]; rfl | i+1, _, _, j, ij => by simp only [forIn.loop, Nat.add] have j_eq : j = size as - 1 - i := by simp [← ij, ← Nat.add_assoc] have : as.size - 1 - i < as.size := j_eq ▸ ij ▸ Nat.lt_succ_of_le (Nat.le_add_right ..) have : as[size as - 1 - i] :: as.data.drop (j + 1) = as.data.drop j := by rw [j_eq]; exact List.get_cons_drop _ ⟨_, this⟩ simp only [← this, List.forIn_cons]; congr; funext x; congr; funext b rw [loop (i := i)]; rw [← ij, Nat.succ_add]; rfl conv => lhs; simp only [forIn, Array.forIn] rw [loop (Nat.zero_add _)]; rfl theorem zipWith_eq_zipWith_data (f : α → β → γ) (as : Array α) (bs : Array β) : (as.zipWith bs f).data = as.data.zipWith f bs.data := by let rec loop : ∀ (i : Nat) cs, i ≤ as.size → i ≤ bs.size → (zipWithAux f as bs i cs).data = cs.data ++ (as.data.drop i).zipWith f (bs.data.drop i) := by intro i cs hia hib unfold zipWithAux by_cases h : i = as.size ∨ i = bs.size case pos => have : ¬(i < as.size) ∨ ¬(i < bs.size) := by cases h <;> simp_all only [Nat.not_lt, Nat.le_refl, true_or, or_true] -- Cleaned up aesop output below simp_all only [Nat.not_lt] cases h <;> [(cases this); (cases this)] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_left, List.append_nil] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] · simp_all only [Nat.le_refl, Nat.lt_irrefl, dite_false, List.drop_length, List.zipWith_nil_right, List.append_nil] split <;> simp_all only [Nat.not_lt] case neg => rw [not_or] at h have has : i < as.size := Nat.lt_of_le_of_ne hia h.1 have hbs : i < bs.size := Nat.lt_of_le_of_ne hib h.2 simp only [has, hbs, dite_true] rw [loop (i+1) _ has hbs, Array.push_data] have h₁ : [f as[i] bs[i]] = List.zipWith f [as[i]] [bs[i]] := rfl let i_as : Fin as.data.length := ⟨i, has⟩ let i_bs : Fin bs.data.length := ⟨i, hbs⟩ rw [h₁, List.append_assoc] congr rw [← List.zipWith_append (h := by simp), getElem_eq_data_get, getElem_eq_data_get] show List.zipWith f ((List.get as.data i_as) :: List.drop (i_as + 1) as.data) ((List.get bs.data i_bs) :: List.drop (i_bs + 1) bs.data) = List.zipWith f (List.drop i as.data) (List.drop i bs.data) simp only [List.get_cons_drop] termination_by as.size - i simp [zipWith, loop 0 #[] (by simp) (by simp)]
.lake/packages/batteries/Batteries/Data/Array/Lemmas.lean
75
77
theorem size_zipWith (as : Array α) (bs : Array β) (f : α → β → γ) : (as.zipWith bs f).size = min as.size bs.size := by
rw [size_eq_length_data, zipWith_eq_zipWith_data, List.length_zipWith]
import Mathlib.Probability.Kernel.MeasurableIntegral import Mathlib.MeasureTheory.Integral.SetIntegral #align_import probability.kernel.with_density from "leanprover-community/mathlib"@"c0d694db494dd4f9aa57f2714b6e4c82b4ebc113" open MeasureTheory ProbabilityTheory open scoped MeasureTheory ENNReal NNReal namespace ProbabilityTheory.kernel variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} variable {κ : kernel α β} {f : α → β → ℝ≥0∞} noncomputable def withDensity (κ : kernel α β) [IsSFiniteKernel κ] (f : α → β → ℝ≥0∞) : kernel α β := @dite _ (Measurable (Function.uncurry f)) (Classical.dec _) (fun hf => (⟨fun a => (κ a).withDensity (f a), by refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ simp_rw [withDensity_apply _ hs] exact hf.set_lintegral_kernel_prod_right hs⟩ : kernel α β)) fun _ => 0 #align probability_theory.kernel.with_density ProbabilityTheory.kernel.withDensity
Mathlib/Probability/Kernel/WithDensity.lean
56
57
theorem withDensity_of_not_measurable (κ : kernel α β) [IsSFiniteKernel κ] (hf : ¬Measurable (Function.uncurry f)) : withDensity κ f = 0 := by
classical exact dif_neg hf
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic import Mathlib.RingTheory.Polynomial.Basic #align_import algebraic_geometry.prime_spectrum.is_open_comap_C from "leanprover-community/mathlib"@"052f6013363326d50cb99c6939814a4b8eb7b301" open Ideal Polynomial PrimeSpectrum Set namespace AlgebraicGeometry namespace Polynomial variable {R : Type*} [CommRing R] {f : R[X]} set_option linter.uppercaseLean3 false def imageOfDf (f : R[X]) : Set (PrimeSpectrum R) := { p : PrimeSpectrum R | ∃ i : ℕ, coeff f i ∉ p.asIdeal } #align algebraic_geometry.polynomial.image_of_Df AlgebraicGeometry.Polynomial.imageOfDf theorem isOpen_imageOfDf : IsOpen (imageOfDf f) := by rw [imageOfDf, setOf_exists fun i (x : PrimeSpectrum R) => coeff f i ∉ x.asIdeal] exact isOpen_iUnion fun i => isOpen_basicOpen #align algebraic_geometry.polynomial.is_open_image_of_Df AlgebraicGeometry.Polynomial.isOpen_imageOfDf theorem comap_C_mem_imageOfDf {I : PrimeSpectrum R[X]} (H : I ∈ (zeroLocus {f} : Set (PrimeSpectrum R[X]))ᶜ) : PrimeSpectrum.comap (Polynomial.C : R →+* R[X]) I ∈ imageOfDf f := exists_C_coeff_not_mem (mem_compl_zeroLocus_iff_not_mem.mp H) #align algebraic_geometry.polynomial.comap_C_mem_image_of_Df AlgebraicGeometry.Polynomial.comap_C_mem_imageOfDf
Mathlib/AlgebraicGeometry/PrimeSpectrum/IsOpenComapC.lean
54
66
theorem imageOfDf_eq_comap_C_compl_zeroLocus : imageOfDf f = PrimeSpectrum.comap (C : R →+* R[X]) '' (zeroLocus {f})ᶜ := by
ext x refine ⟨fun hx => ⟨⟨map C x.asIdeal, isPrime_map_C_of_isPrime x.IsPrime⟩, ⟨?_, ?_⟩⟩, ?_⟩ · rw [mem_compl_iff, mem_zeroLocus, singleton_subset_iff] cases' hx with i hi exact fun a => hi (mem_map_C_iff.mp a i) · ext x refine ⟨fun h => ?_, fun h => subset_span (mem_image_of_mem C.1 h)⟩ rw [← @coeff_C_zero R x _] exact mem_map_C_iff.mp h 0 · rintro ⟨xli, complement, rfl⟩ exact comap_C_mem_imageOfDf complement
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⟩ section Composition variable {f₁ : a ⟶ b} {g₁ : b ⟶ a} {f₂ : b ⟶ c} {g₂ : c ⟶ b} @[simp] def compUnit (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) : 𝟙 a ⟶ (f₁ ≫ f₂) ≫ g₂ ≫ g₁ := adj₁.unit ⊗≫ f₁ ◁ adj₂.unit ▷ g₁ ⊗≫ 𝟙 _ @[simp] def compCounit (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) : (g₂ ≫ g₁) ≫ f₁ ≫ f₂ ⟶ 𝟙 c := 𝟙 _ ⊗≫ g₂ ◁ adj₁.counit ▷ f₂ ⊗≫ adj₂.counit
Mathlib/CategoryTheory/Bicategory/Adjunction.lean
136
149
theorem comp_left_triangle_aux (adj₁ : f₁ ⊣ g₁) (adj₂ : f₂ ⊣ g₂) : leftZigzag (compUnit adj₁ adj₂) (compCounit adj₁ adj₂) = (λ_ _).hom ≫ (ρ_ _).inv := by
calc _ = 𝟙 _ ⊗≫ adj₁.unit ▷ (f₁ ≫ f₂) ⊗≫ f₁ ◁ (adj₂.unit ▷ (g₁ ≫ f₁) ≫ (f₂ ≫ g₂) ◁ adj₁.counit) ▷ f₂ ⊗≫ (f₁ ≫ f₂) ◁ adj₂.counit ⊗≫ 𝟙 _ := by simp [bicategoricalComp]; coherence _ = 𝟙 _ ⊗≫ (leftZigzag adj₁.unit adj₁.counit) ▷ f₂ ⊗≫ f₁ ◁ (leftZigzag adj₂.unit adj₂.counit) ⊗≫ 𝟙 _ := by rw [← whisker_exchange]; simp [bicategoricalComp]; coherence _ = _ := by simp_rw [left_triangle]; simp [bicategoricalComp]
import Mathlib.Data.ENNReal.Inv #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Set NNReal ENNReal namespace ENNReal section Real variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} theorem toReal_add (ha : a ≠ ∞) (hb : b ≠ ∞) : (a + b).toReal = a.toReal + b.toReal := by lift a to ℝ≥0 using ha lift b to ℝ≥0 using hb rfl #align ennreal.to_real_add ENNReal.toReal_add theorem toReal_sub_of_le {a b : ℝ≥0∞} (h : b ≤ a) (ha : a ≠ ∞) : (a - b).toReal = a.toReal - b.toReal := by lift b to ℝ≥0 using ne_top_of_le_ne_top ha h lift a to ℝ≥0 using ha simp only [← ENNReal.coe_sub, ENNReal.coe_toReal, NNReal.coe_sub (ENNReal.coe_le_coe.mp h)] #align ennreal.to_real_sub_of_le ENNReal.toReal_sub_of_le theorem le_toReal_sub {a b : ℝ≥0∞} (hb : b ≠ ∞) : a.toReal - b.toReal ≤ (a - b).toReal := by lift b to ℝ≥0 using hb induction a · simp · simp only [← coe_sub, NNReal.sub_def, Real.coe_toNNReal', coe_toReal] exact le_max_left _ _ #align ennreal.le_to_real_sub ENNReal.le_toReal_sub theorem toReal_add_le : (a + b).toReal ≤ a.toReal + b.toReal := if ha : a = ∞ then by simp only [ha, top_add, top_toReal, zero_add, toReal_nonneg] else if hb : b = ∞ then by simp only [hb, add_top, top_toReal, add_zero, toReal_nonneg] else le_of_eq (toReal_add ha hb) #align ennreal.to_real_add_le ENNReal.toReal_add_le theorem ofReal_add {p q : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) : ENNReal.ofReal (p + q) = ENNReal.ofReal p + ENNReal.ofReal q := by rw [ENNReal.ofReal, ENNReal.ofReal, ENNReal.ofReal, ← coe_add, coe_inj, Real.toNNReal_add hp hq] #align ennreal.of_real_add ENNReal.ofReal_add theorem ofReal_add_le {p q : ℝ} : ENNReal.ofReal (p + q) ≤ ENNReal.ofReal p + ENNReal.ofReal q := coe_le_coe.2 Real.toNNReal_add_le #align ennreal.of_real_add_le ENNReal.ofReal_add_le @[simp] theorem toReal_le_toReal (ha : a ≠ ∞) (hb : b ≠ ∞) : a.toReal ≤ b.toReal ↔ a ≤ b := by lift a to ℝ≥0 using ha lift b to ℝ≥0 using hb norm_cast #align ennreal.to_real_le_to_real ENNReal.toReal_le_toReal @[gcongr] theorem toReal_mono (hb : b ≠ ∞) (h : a ≤ b) : a.toReal ≤ b.toReal := (toReal_le_toReal (ne_top_of_le_ne_top hb h) hb).2 h #align ennreal.to_real_mono ENNReal.toReal_mono -- Porting note (#10756): new lemma
Mathlib/Data/ENNReal/Real.lean
88
91
theorem toReal_mono' (h : a ≤ b) (ht : b = ∞ → a = ∞) : a.toReal ≤ b.toReal := by
rcases eq_or_ne a ∞ with rfl | ha · exact toReal_nonneg · exact toReal_mono (mt ht ha) h