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.Data.Vector.Basic #align_import data.vector.mem from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226" namespace Vector variable {α β : Type*} {n : ℕ} (a a' : α) @[simp] theorem get_mem (i : Fin n) (v : Vector α n) : v.get i ∈ v.toList := by rw [get_eq_get] exact List.get_mem _ _ _ #align vector.nth_mem Vector.get_mem theorem mem_iff_get (v : Vector α n) : a ∈ v.toList ↔ ∃ i, v.get i = a := by simp only [List.mem_iff_get, Fin.exists_iff, Vector.get_eq_get] exact ⟨fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length] at hi, h⟩, fun ⟨i, hi, h⟩ => ⟨i, by rwa [toList_length], h⟩⟩ #align vector.mem_iff_nth Vector.mem_iff_get theorem not_mem_nil : a ∉ (Vector.nil : Vector α 0).toList := by unfold Vector.nil dsimp simp #align vector.not_mem_nil Vector.not_mem_nil theorem not_mem_zero (v : Vector α 0) : a ∉ v.toList := (Vector.eq_nil v).symm ▸ not_mem_nil a #align vector.not_mem_zero Vector.not_mem_zero theorem mem_cons_iff (v : Vector α n) : a' ∈ (a ::ᵥ v).toList ↔ a' = a ∨ a' ∈ v.toList := by rw [Vector.toList_cons, List.mem_cons] #align vector.mem_cons_iff Vector.mem_cons_iff theorem mem_succ_iff (v : Vector α (n + 1)) : a ∈ v.toList ↔ a = v.head ∨ a ∈ v.tail.toList := by obtain ⟨a', v', h⟩ := exists_eq_cons v simp_rw [h, Vector.mem_cons_iff, Vector.head_cons, Vector.tail_cons] #align vector.mem_succ_iff Vector.mem_succ_iff theorem mem_cons_self (v : Vector α n) : a ∈ (a ::ᵥ v).toList := (Vector.mem_iff_get a (a ::ᵥ v)).2 ⟨0, Vector.get_cons_zero a v⟩ #align vector.mem_cons_self Vector.mem_cons_self @[simp] theorem head_mem (v : Vector α (n + 1)) : v.head ∈ v.toList := (Vector.mem_iff_get v.head v).2 ⟨0, Vector.get_zero v⟩ #align vector.head_mem Vector.head_mem theorem mem_cons_of_mem (v : Vector α n) (ha' : a' ∈ v.toList) : a' ∈ (a ::ᵥ v).toList := (Vector.mem_cons_iff a a' v).2 (Or.inr ha') #align vector.mem_cons_of_mem Vector.mem_cons_of_mem theorem mem_of_mem_tail (v : Vector α n) (ha : a ∈ v.tail.toList) : a ∈ v.toList := by induction' n with n _ · exact False.elim (Vector.not_mem_zero a v.tail ha) · exact (mem_succ_iff a v).2 (Or.inr ha) #align vector.mem_of_mem_tail Vector.mem_of_mem_tail
Mathlib/Data/Vector/Mem.lean
76
78
theorem mem_map_iff (b : β) (v : Vector α n) (f : α → β) : b ∈ (v.map f).toList ↔ ∃ a : α, a ∈ v.toList ∧ f a = b := by
rw [Vector.toList_map, List.mem_map]
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
Mathlib/Geometry/Euclidean/Angle/Oriented/Basic.lean
58
63
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
import Mathlib.Data.Vector.Basic import Mathlib.Data.Vector.Snoc set_option autoImplicit true namespace Vector section Fold section Bisim variable {xs : Vector α n}
Mathlib/Data/Vector/MapLemmas.lean
173
183
theorem mapAccumr_bisim {f₁ : α → σ₁ → σ₁ × β} {f₂ : α → σ₂ → σ₂ × β} {s₁ : σ₁} {s₂ : σ₂} (R : σ₁ → σ₂ → Prop) (h₀ : R s₁ s₂) (hR : ∀ {s q} a, R s q → R (f₁ a s).1 (f₂ a q).1 ∧ (f₁ a s).2 = (f₂ a q).2) : R (mapAccumr f₁ xs s₁).fst (mapAccumr f₂ xs s₂).fst ∧ (mapAccumr f₁ xs s₁).snd = (mapAccumr f₂ xs s₂).snd := by
induction xs using Vector.revInductionOn generalizing s₁ s₂ next => exact ⟨h₀, rfl⟩ next xs x ih => rcases (hR x h₀) with ⟨hR, _⟩ simp only [mapAccumr_snoc, ih hR, true_and] congr 1
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section CommRing variable [CommRing R] theorem le_rootMultiplicity_iff {p : R[X]} (p0 : p ≠ 0) {a : R} {n : ℕ} : n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p := by classical rw [rootMultiplicity_eq_nat_find_of_nonzero p0, @Nat.le_find_iff _ (_)] simp_rw [Classical.not_not] refine ⟨fun h => ?_, fun h m hm => (pow_dvd_pow _ hm).trans h⟩ cases' n with n; · rw [pow_zero] apply one_dvd; · exact h n n.lt_succ_self #align polynomial.le_root_multiplicity_iff Polynomial.le_rootMultiplicity_iff theorem rootMultiplicity_le_iff {p : R[X]} (p0 : p ≠ 0) (a : R) (n : ℕ) : rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣ p := by rw [← (le_rootMultiplicity_iff p0).not, not_le, Nat.lt_add_one_iff] #align polynomial.root_multiplicity_le_iff Polynomial.rootMultiplicity_le_iff theorem pow_rootMultiplicity_not_dvd {p : R[X]} (p0 : p ≠ 0) (a : R) : ¬(X - C a) ^ (rootMultiplicity a p + 1) ∣ p := by rw [← rootMultiplicity_le_iff p0] #align polynomial.pow_root_multiplicity_not_dvd Polynomial.pow_rootMultiplicity_not_dvd theorem X_sub_C_pow_dvd_iff {p : R[X]} {t : R} {n : ℕ} : (X - C t) ^ n ∣ p ↔ X ^ n ∣ p.comp (X + C t) := by convert (map_dvd_iff <| algEquivAevalXAddC t).symm using 2 simp [C_eq_algebraMap] theorem comp_X_add_C_eq_zero_iff {p : R[X]} (t : R) : p.comp (X + C t) = 0 ↔ p = 0 := AddEquivClass.map_eq_zero_iff (algEquivAevalXAddC t) theorem comp_X_add_C_ne_zero_iff {p : R[X]} (t : R) : p.comp (X + C t) ≠ 0 ↔ p ≠ 0 := Iff.not <| comp_X_add_C_eq_zero_iff t theorem rootMultiplicity_eq_rootMultiplicity {p : R[X]} {t : R} : p.rootMultiplicity t = (p.comp (X + C t)).rootMultiplicity 0 := by classical simp_rw [rootMultiplicity_eq_multiplicity, comp_X_add_C_eq_zero_iff] congr; ext; congr 1 rw [C_0, sub_zero] convert (multiplicity.multiplicity_map_eq <| algEquivAevalXAddC t).symm using 2 simp [C_eq_algebraMap] theorem rootMultiplicity_eq_natTrailingDegree' {p : R[X]} : p.rootMultiplicity 0 = p.natTrailingDegree := by by_cases h : p = 0 · simp only [h, rootMultiplicity_zero, natTrailingDegree_zero] refine le_antisymm ?_ ?_ · rw [rootMultiplicity_le_iff h, map_zero, sub_zero, X_pow_dvd_iff, not_forall] exact ⟨p.natTrailingDegree, fun h' ↦ trailingCoeff_nonzero_iff_nonzero.2 h <| h' <| Nat.lt.base _⟩ · rw [le_rootMultiplicity_iff h, map_zero, sub_zero, X_pow_dvd_iff] exact fun _ ↦ coeff_eq_zero_of_lt_natTrailingDegree theorem rootMultiplicity_eq_natTrailingDegree {p : R[X]} {t : R} : p.rootMultiplicity t = (p.comp (X + C t)).natTrailingDegree := rootMultiplicity_eq_rootMultiplicity.trans rootMultiplicity_eq_natTrailingDegree' theorem eval_divByMonic_eq_trailingCoeff_comp {p : R[X]} {t : R} : (p /ₘ (X - C t) ^ p.rootMultiplicity t).eval t = (p.comp (X + C t)).trailingCoeff := by obtain rfl | hp := eq_or_ne p 0 · rw [zero_divByMonic, eval_zero, zero_comp, trailingCoeff_zero] have mul_eq := p.pow_mul_divByMonic_rootMultiplicity_eq t set m := p.rootMultiplicity t set g := p /ₘ (X - C t) ^ m have : (g.comp (X + C t)).coeff 0 = g.eval t := by rw [coeff_zero_eq_eval_zero, eval_comp, eval_add, eval_X, eval_C, zero_add] rw [← congr_arg (comp · <| X + C t) mul_eq, mul_comp, pow_comp, sub_comp, X_comp, C_comp, add_sub_cancel_right, ← reverse_leadingCoeff, reverse_X_pow_mul, reverse_leadingCoeff, trailingCoeff, Nat.le_zero.1 (natTrailingDegree_le_of_ne_zero <| this ▸ eval_divByMonic_pow_rootMultiplicity_ne_zero t hp), this] section nonZeroDivisors open scoped nonZeroDivisors theorem Monic.mem_nonZeroDivisors {p : R[X]} (h : p.Monic) : p ∈ R[X]⁰ := mem_nonZeroDivisors_iff.2 fun _ hx ↦ (mul_left_eq_zero_iff h).1 hx
Mathlib/Algebra/Polynomial/RingDivision.lean
504
508
theorem mem_nonZeroDivisors_of_leadingCoeff {p : R[X]} (h : p.leadingCoeff ∈ R⁰) : p ∈ R[X]⁰ := by
refine mem_nonZeroDivisors_iff.2 fun x hx ↦ leadingCoeff_eq_zero.1 ?_ by_contra hx' rw [← mul_right_mem_nonZeroDivisors_eq_zero_iff h] at hx' simp only [← leadingCoeff_mul' hx', hx, leadingCoeff_zero, not_true] at hx'
import Mathlib.Data.List.Basic namespace List variable {α β : Type*} #align list.length_enum_from List.enumFrom_length #align list.length_enum List.enum_length @[simp] theorem get?_enumFrom : ∀ n (l : List α) m, get? (enumFrom n l) m = (get? l m).map fun a => (n + m, a) | n, [], m => rfl | n, a :: l, 0 => rfl | n, a :: l, m + 1 => (get?_enumFrom (n + 1) l m).trans <| by rw [Nat.add_right_comm]; rfl #align list.enum_from_nth List.get?_enumFrom @[deprecated (since := "2024-04-06")] alias enumFrom_get? := get?_enumFrom @[simp] theorem get?_enum (l : List α) (n) : get? (enum l) n = (get? l n).map fun a => (n, a) := by rw [enum, get?_enumFrom, Nat.zero_add] #align list.enum_nth List.get?_enum @[deprecated (since := "2024-04-06")] alias enum_get? := get?_enum @[simp] theorem enumFrom_map_snd : ∀ (n) (l : List α), map Prod.snd (enumFrom n l) = l | _, [] => rfl | _, _ :: _ => congr_arg (cons _) (enumFrom_map_snd _ _) #align list.enum_from_map_snd List.enumFrom_map_snd @[simp] theorem enum_map_snd (l : List α) : map Prod.snd (enum l) = l := enumFrom_map_snd _ _ #align list.enum_map_snd List.enum_map_snd @[simp] theorem get_enumFrom (l : List α) (n) (i : Fin (l.enumFrom n).length) : (l.enumFrom n).get i = (n + i, l.get (i.cast enumFrom_length)) := by simp [get_eq_get?] #align list.nth_le_enum_from List.get_enumFrom @[simp] theorem get_enum (l : List α) (i : Fin l.enum.length) : l.enum.get i = (i.1, l.get (i.cast enum_length)) := by simp [enum] #align list.nth_le_enum List.get_enum theorem mk_add_mem_enumFrom_iff_get? {n i : ℕ} {x : α} {l : List α} : (n + i, x) ∈ enumFrom n l ↔ l.get? i = x := by simp [mem_iff_get?] theorem mk_mem_enumFrom_iff_le_and_get?_sub {n i : ℕ} {x : α} {l : List α} : (i, x) ∈ enumFrom n l ↔ n ≤ i ∧ l.get? (i - n) = x := by if h : n ≤ i then rcases Nat.exists_eq_add_of_le h with ⟨i, rfl⟩ simp [mk_add_mem_enumFrom_iff_get?, Nat.add_sub_cancel_left] else have : ∀ k, n + k ≠ i := by rintro k rfl; simp at h simp [h, mem_iff_get?, this]
Mathlib/Data/List/Enum.lean
72
73
theorem mk_mem_enum_iff_get? {i : ℕ} {x : α} {l : List α} : (i, x) ∈ enum l ↔ l.get? i = x := by
simp [enum, mk_mem_enumFrom_iff_le_and_get?_sub]
import Mathlib.Algebra.Category.MonCat.Limits import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.ConcreteCategory.Elementwise import Mathlib.CategoryTheory.Limits.TypesFiltered #align_import algebra.category.Mon.filtered_colimits from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" set_option linter.uppercaseLean3 false universe v u noncomputable section open scoped Classical open CategoryTheory open CategoryTheory.Limits open CategoryTheory.IsFiltered renaming max → max' -- avoid name collision with `_root_.max`. namespace MonCat.FilteredColimits section -- Porting note: mathlib 3 used `parameters` here, mainly so we can have the abbreviations `M` and -- `M.mk` below, without passing around `F` all the time. variable {J : Type v} [SmallCategory J] (F : J ⥤ MonCatMax.{v, u}) @[to_additive "The colimit of `F ⋙ forget AddMon` in the category of types. In the following, we will construct an additive monoid structure on `M`."] abbrev M := Types.Quot (F ⋙ forget MonCat) #align Mon.filtered_colimits.M MonCat.FilteredColimits.M #align AddMon.filtered_colimits.M AddMonCat.FilteredColimits.M @[to_additive "The canonical projection into the colimit, as a quotient type."] noncomputable abbrev M.mk : (Σ j, F.obj j) → M.{v, u} F := Quot.mk _ #align Mon.filtered_colimits.M.mk MonCat.FilteredColimits.M.mk #align AddMon.filtered_colimits.M.mk AddMonCat.FilteredColimits.M.mk @[to_additive] theorem M.mk_eq (x y : Σ j, F.obj j) (h : ∃ (k : J) (f : x.1 ⟶ k) (g : y.1 ⟶ k), F.map f x.2 = F.map g y.2) : M.mk.{v, u} F x = M.mk F y := Quot.EqvGen_sound (Types.FilteredColimit.eqvGen_quot_rel_of_rel (F ⋙ forget MonCat) x y h) #align Mon.filtered_colimits.M.mk_eq MonCat.FilteredColimits.M.mk_eq #align AddMon.filtered_colimits.M.mk_eq AddMonCat.FilteredColimits.M.mk_eq variable [IsFiltered J] @[to_additive "As `J` is nonempty, we can pick an arbitrary object `j₀ : J`. We use this object to define the \"zero\" in the colimit as the equivalence class of `⟨j₀, 0 : F.obj j₀⟩`."] noncomputable instance colimitOne : One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.nonempty.some,1⟩ #align Mon.filtered_colimits.colimit_has_one MonCat.FilteredColimits.colimitOne #align AddMon.filtered_colimits.colimit_has_zero AddMonCat.FilteredColimits.colimitZero @[to_additive "The definition of the \"zero\" in the colimit is independent of the chosen object of `J`. In particular, this lemma allows us to \"unfold\" the definition of `colimit_zero` at a custom chosen object `j`."]
Mathlib/Algebra/Category/MonCat/FilteredColimits.lean
95
98
theorem colimit_one_eq (j : J) : (1 : M.{v, u} F) = M.mk F ⟨j, 1⟩ := by
apply M.mk_eq refine ⟨max' _ j, IsFiltered.leftToMax _ j, IsFiltered.rightToMax _ j, ?_⟩ simp
import Mathlib.Algebra.Ring.Pi import Mathlib.Algebra.Ring.Prod import Mathlib.Algebra.Ring.InjSurj import Mathlib.Tactic.Monotonicity.Attr #align_import algebra.order.kleene from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90" open Function universe u variable {α β ι : Type*} {π : ι → Type*} class IdemSemiring (α : Type u) extends Semiring α, SemilatticeSup α where protected sup := (· + ·) protected add_eq_sup : ∀ a b : α, a + b = a ⊔ b := by intros rfl protected bot : α := 0 protected bot_le : ∀ a, bot ≤ a #align idem_semiring IdemSemiring class IdemCommSemiring (α : Type u) extends CommSemiring α, IdemSemiring α #align idem_comm_semiring IdemCommSemiring class KStar (α : Type*) where protected kstar : α → α #align has_kstar KStar @[inherit_doc] scoped[Computability] postfix:1024 "∗" => KStar.kstar open Computability class KleeneAlgebra (α : Type*) extends IdemSemiring α, KStar α where protected one_le_kstar : ∀ a : α, 1 ≤ a∗ protected mul_kstar_le_kstar : ∀ a : α, a * a∗ ≤ a∗ protected kstar_mul_le_kstar : ∀ a : α, a∗ * a ≤ a∗ protected mul_kstar_le_self : ∀ a b : α, b * a ≤ b → b * a∗ ≤ b protected kstar_mul_le_self : ∀ a b : α, a * b ≤ b → a∗ * b ≤ b #align kleene_algebra KleeneAlgebra -- See note [lower instance priority] instance (priority := 100) IdemSemiring.toOrderBot [IdemSemiring α] : OrderBot α := { ‹IdemSemiring α› with } #align idem_semiring.to_order_bot IdemSemiring.toOrderBot -- See note [reducible non-instances] abbrev IdemSemiring.ofSemiring [Semiring α] (h : ∀ a : α, a + a = a) : IdemSemiring α := { ‹Semiring α› with le := fun a b ↦ a + b = b le_refl := h le_trans := fun a b c hab hbc ↦ by simp only rw [← hbc, ← add_assoc, hab] le_antisymm := fun a b hab hba ↦ by rwa [← hba, add_comm] sup := (· + ·) le_sup_left := fun a b ↦ by simp only rw [← add_assoc, h] le_sup_right := fun a b ↦ by simp only rw [add_comm, add_assoc, h] sup_le := fun a b c hab hbc ↦ by simp only rwa [add_assoc, hbc] bot := 0 bot_le := zero_add } #align idem_semiring.of_semiring IdemSemiring.ofSemiring section IdemSemiring variable [IdemSemiring α] {a b c : α} theorem add_eq_sup (a b : α) : a + b = a ⊔ b := IdemSemiring.add_eq_sup _ _ #align add_eq_sup add_eq_sup -- Porting note: This simp theorem often leads to timeout when `α` has rich structure. -- So, this theorem should be scoped. scoped[Computability] attribute [simp] add_eq_sup theorem add_idem (a : α) : a + a = a := by simp #align add_idem add_idem theorem nsmul_eq_self : ∀ {n : ℕ} (_ : n ≠ 0) (a : α), n • a = a | 0, h => (h rfl).elim | 1, _ => one_nsmul | n + 2, _ => fun a ↦ by rw [succ_nsmul, nsmul_eq_self n.succ_ne_zero, add_idem] #align nsmul_eq_self nsmul_eq_self theorem add_eq_left_iff_le : a + b = a ↔ b ≤ a := by simp #align add_eq_left_iff_le add_eq_left_iff_le theorem add_eq_right_iff_le : a + b = b ↔ a ≤ b := by simp #align add_eq_right_iff_le add_eq_right_iff_le alias ⟨_, LE.le.add_eq_left⟩ := add_eq_left_iff_le #align has_le.le.add_eq_left LE.le.add_eq_left alias ⟨_, LE.le.add_eq_right⟩ := add_eq_right_iff_le #align has_le.le.add_eq_right LE.le.add_eq_right
Mathlib/Algebra/Order/Kleene.lean
163
163
theorem add_le_iff : a + b ≤ c ↔ a ≤ c ∧ b ≤ c := by
simp
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⁻¹`"]
Mathlib/GroupTheory/GroupAction/FixedPoints.lean
60
62
theorem fixedBy_inv (g : G) : fixedBy α g⁻¹ = fixedBy α g := by
ext rw [mem_fixedBy, mem_fixedBy, inv_smul_eq_iff, eq_comm]
import Mathlib.Algebra.CharP.Invertible import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.ZMod.Basic #align_import ring_theory.witt_vector.witt_polynomial from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395" open MvPolynomial open Finset hiding map open Finsupp (single) --attribute [-simp] coe_eval₂_hom variable (p : ℕ) variable (R : Type*) [CommRing R] [DecidableEq R] noncomputable def wittPolynomial (n : ℕ) : MvPolynomial ℕ R := ∑ i ∈ range (n + 1), monomial (single i (p ^ (n - i))) ((p : R) ^ i) #align witt_polynomial wittPolynomial theorem wittPolynomial_eq_sum_C_mul_X_pow (n : ℕ) : wittPolynomial p R n = ∑ i ∈ range (n + 1), C ((p : R) ^ i) * X i ^ p ^ (n - i) := by apply sum_congr rfl rintro i - rw [monomial_eq, Finsupp.prod_single_index] rw [pow_zero] set_option linter.uppercaseLean3 false in #align witt_polynomial_eq_sum_C_mul_X_pow wittPolynomial_eq_sum_C_mul_X_pow -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ open Witt open MvPolynomial section variable {R} {S : Type*} [CommRing S] @[simp] theorem map_wittPolynomial (f : R →+* S) (n : ℕ) : map f (W n) = W n := by rw [wittPolynomial, map_sum, wittPolynomial] refine sum_congr rfl fun i _ => ?_ rw [map_monomial, RingHom.map_pow, map_natCast] #align map_witt_polynomial map_wittPolynomial variable (R) @[simp] theorem constantCoeff_wittPolynomial [hp : Fact p.Prime] (n : ℕ) : constantCoeff (wittPolynomial p R n) = 0 := by simp only [wittPolynomial, map_sum, constantCoeff_monomial] rw [sum_eq_zero] rintro i _ rw [if_neg] rw [Finsupp.single_eq_zero] exact ne_of_gt (pow_pos hp.1.pos _) #align constant_coeff_witt_polynomial constantCoeff_wittPolynomial @[simp] theorem wittPolynomial_zero : wittPolynomial p R 0 = X 0 := by simp only [wittPolynomial, X, sum_singleton, range_one, pow_zero, zero_add, tsub_self] #align witt_polynomial_zero wittPolynomial_zero @[simp]
Mathlib/RingTheory/WittVector/WittPolynomial.lean
141
143
theorem wittPolynomial_one : wittPolynomial p R 1 = C (p : R) * X 1 + X 0 ^ p := by
simp only [wittPolynomial_eq_sum_C_mul_X_pow, sum_range_succ_comm, range_one, sum_singleton, one_mul, pow_one, C_1, pow_zero, tsub_self, tsub_zero]
import Mathlib.Probability.ProbabilityMassFunction.Constructions import Mathlib.Tactic.FinCases namespace PMF open ENNReal noncomputable def binomial (p : ℝ≥0∞) (h : p ≤ 1) (n : ℕ) : PMF (Fin (n + 1)) := .ofFintype (fun i => p^(i : ℕ) * (1-p)^((Fin.last n - i) : ℕ) * (n.choose i : ℕ)) (by convert (add_pow p (1-p) n).symm · rw [Finset.sum_fin_eq_sum_range] apply Finset.sum_congr rfl intro i hi rw [Finset.mem_range] at hi rw [dif_pos hi, Fin.last] · simp [h]) theorem binomial_apply (p : ℝ≥0∞) (h : p ≤ 1) (n : ℕ) (i : Fin (n + 1)) : binomial p h n i = p^(i : ℕ) * (1-p)^((Fin.last n - i) : ℕ) * (n.choose i : ℕ) := rfl @[simp] theorem binomial_apply_zero (p : ℝ≥0∞) (h : p ≤ 1) (n : ℕ) : binomial p h n 0 = (1-p)^n := by simp [binomial_apply] @[simp] theorem binomial_apply_last (p : ℝ≥0∞) (h : p ≤ 1) (n : ℕ) : binomial p h n (.last n) = p^n := by simp [binomial_apply]
Mathlib/Probability/ProbabilityMassFunction/Binomial.lean
49
50
theorem binomial_apply_self (p : ℝ≥0∞) (h : p ≤ 1) (n : ℕ) : binomial p h n n = p^n := by
simp
import Mathlib.Control.Monad.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.List.ProdSigma #align_import data.fin_enum from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" universe u v open Finset class FinEnum (α : Sort*) where card : ℕ equiv : α ≃ Fin card [decEq : DecidableEq α] #align fin_enum FinEnum attribute [instance 100] FinEnum.decEq namespace FinEnum variable {α : Type u} {β : α → Type v} def ofEquiv (α) {β} [FinEnum α] (h : β ≃ α) : FinEnum β where card := card α equiv := h.trans (equiv) decEq := (h.trans (equiv)).decidableEq #align fin_enum.of_equiv FinEnum.ofEquiv def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α where card := xs.length equiv := ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, xs.get, fun x => by simp, fun i => by ext; simp [List.get_indexOf h']⟩ #align fin_enum.of_nodup_list FinEnum.ofNodupList def ofList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) : FinEnum α := ofNodupList xs.dedup (by simp [*]) (List.nodup_dedup _) #align fin_enum.of_list FinEnum.ofList def toList (α) [FinEnum α] : List α := (List.finRange (card α)).map (equiv).symm #align fin_enum.to_list FinEnum.toList open Function @[simp] theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by simp [toList]; exists equiv x; simp #align fin_enum.mem_to_list FinEnum.mem_toList @[simp]
Mathlib/Data/FinEnum.lean
74
75
theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by
simp [toList]; apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange]
import Batteries.Tactic.SeqFocus import Batteries.Data.List.Lemmas import Batteries.Data.List.Init.Attach namespace Std.Range def numElems (r : Range) : Nat := if r.step = 0 then -- This is a very weird choice, but it is chosen to coincide with the `forIn` impl if r.stop ≤ r.start then 0 else r.stop else (r.stop - r.start + r.step - 1) / r.step theorem numElems_stop_le_start : ∀ r : Range, r.stop ≤ r.start → r.numElems = 0 | ⟨start, stop, step⟩, h => by simp [numElems]; split <;> simp_all apply Nat.div_eq_of_lt; simp [Nat.sub_eq_zero_of_le h] exact Nat.pred_lt ‹_›
.lake/packages/batteries/Batteries/Data/Range/Lemmas.lean
26
27
theorem numElems_step_1 (start stop) : numElems ⟨start, stop, 1⟩ = stop - start := by
simp [numElems]
import Mathlib.MeasureTheory.Measure.GiryMonad import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.MeasureTheory.Integral.Lebesgue import Mathlib.MeasureTheory.Measure.OpenPos #align_import measure_theory.constructions.prod.basic from "leanprover-community/mathlib"@"00abe0695d8767201e6d008afa22393978bb324d" noncomputable section open scoped Classical open Topology ENNReal MeasureTheory open Set Function Real ENNReal open MeasureTheory MeasurableSpace MeasureTheory.Measure open TopologicalSpace hiding generateFrom open Filter hiding prod_eq map variable {α α' β β' γ E : Type*} theorem IsPiSystem.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsPiSystem C) (hD : IsPiSystem D) : IsPiSystem (image2 (· ×ˢ ·) C D) := by rintro _ ⟨s₁, hs₁, t₁, ht₁, rfl⟩ _ ⟨s₂, hs₂, t₂, ht₂, rfl⟩ hst rw [prod_inter_prod] at hst ⊢; rw [prod_nonempty_iff] at hst exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2) #align is_pi_system.prod IsPiSystem.prod theorem IsCountablySpanning.prod {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C) (hD : IsCountablySpanning D) : IsCountablySpanning (image2 (· ×ˢ ·) C D) := by rcases hC, hD with ⟨⟨s, h1s, h2s⟩, t, h1t, h2t⟩ refine ⟨fun n => s n.unpair.1 ×ˢ t n.unpair.2, fun n => mem_image2_of_mem (h1s _) (h1t _), ?_⟩ rw [iUnion_unpair_prod, h2s, h2t, univ_prod_univ] #align is_countably_spanning.prod IsCountablySpanning.prod variable [MeasurableSpace α] [MeasurableSpace α'] [MeasurableSpace β] [MeasurableSpace β'] variable [MeasurableSpace γ] variable {μ μ' : Measure α} {ν ν' : Measure β} {τ : Measure γ} variable [NormedAddCommGroup E] theorem generateFrom_prod_eq {α β} {C : Set (Set α)} {D : Set (Set β)} (hC : IsCountablySpanning C) (hD : IsCountablySpanning D) : @Prod.instMeasurableSpace _ _ (generateFrom C) (generateFrom D) = generateFrom (image2 (· ×ˢ ·) C D) := by apply le_antisymm · refine sup_le ?_ ?_ <;> rw [comap_generateFrom] <;> apply generateFrom_le <;> rintro _ ⟨s, hs, rfl⟩ · rcases hD with ⟨t, h1t, h2t⟩ rw [← prod_univ, ← h2t, prod_iUnion] apply MeasurableSet.iUnion intro n apply measurableSet_generateFrom exact ⟨s, hs, t n, h1t n, rfl⟩ · rcases hC with ⟨t, h1t, h2t⟩ rw [← univ_prod, ← h2t, iUnion_prod_const] apply MeasurableSet.iUnion rintro n apply measurableSet_generateFrom exact mem_image2_of_mem (h1t n) hs · apply generateFrom_le rintro _ ⟨s, hs, t, ht, rfl⟩ dsimp only rw [prod_eq] apply (measurable_fst _).inter (measurable_snd _) · exact measurableSet_generateFrom hs · exact measurableSet_generateFrom ht #align generate_from_prod_eq generateFrom_prod_eq theorem generateFrom_eq_prod {C : Set (Set α)} {D : Set (Set β)} (hC : generateFrom C = ‹_›) (hD : generateFrom D = ‹_›) (h2C : IsCountablySpanning C) (h2D : IsCountablySpanning D) : generateFrom (image2 (· ×ˢ ·) C D) = Prod.instMeasurableSpace := by rw [← hC, ← hD, generateFrom_prod_eq h2C h2D] #align generate_from_eq_prod generateFrom_eq_prod theorem generateFrom_prod : generateFrom (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) = Prod.instMeasurableSpace := generateFrom_eq_prod generateFrom_measurableSet generateFrom_measurableSet isCountablySpanning_measurableSet isCountablySpanning_measurableSet #align generate_from_prod generateFrom_prod theorem isPiSystem_prod : IsPiSystem (image2 (· ×ˢ ·) { s : Set α | MeasurableSet s } { t : Set β | MeasurableSet t }) := isPiSystem_measurableSet.prod isPiSystem_measurableSet #align is_pi_system_prod isPiSystem_prod
Mathlib/MeasureTheory/Constructions/Prod/Basic.lean
155
172
theorem measurable_measure_prod_mk_left_finite [IsFiniteMeasure ν] {s : Set (α × β)} (hs : MeasurableSet s) : Measurable fun x => ν (Prod.mk x ⁻¹' s) := by
refine induction_on_inter (C := fun s => Measurable fun x => ν (Prod.mk x ⁻¹' s)) generateFrom_prod.symm isPiSystem_prod ?_ ?_ ?_ ?_ hs · simp · rintro _ ⟨s, hs, t, _, rfl⟩ simp only [mk_preimage_prod_right_eq_if, measure_if] exact measurable_const.indicator hs · intro t ht h2t simp_rw [preimage_compl, measure_compl (measurable_prod_mk_left ht) (measure_ne_top ν _)] exact h2t.const_sub _ · intro f h1f h2f h3f simp_rw [preimage_iUnion] have : ∀ b, ν (⋃ i, Prod.mk b ⁻¹' f i) = ∑' i, ν (Prod.mk b ⁻¹' f i) := fun b => measure_iUnion (fun i j hij => Disjoint.preimage _ (h1f hij)) fun i => measurable_prod_mk_left (h2f i) simp_rw [this] apply Measurable.ennreal_tsum h3f
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.Deriv.Linear import Mathlib.Analysis.Complex.Conformal import Mathlib.Analysis.Calculus.Conformal.NormedSpace #align_import analysis.complex.real_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" section RealDerivOfComplex open Complex variable {e : ℂ → ℂ} {e' : ℂ} {z : ℝ} theorem HasStrictDerivAt.real_of_complex (h : HasStrictDerivAt e e' z) : HasStrictDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasStrictFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasStrictFDerivAt have B : HasStrictFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasStrictFDerivAt.restrictScalars ℝ have C : HasStrictFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasStrictFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasStrictDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_strict_deriv_at.real_of_complex HasStrictDerivAt.real_of_complex theorem HasDerivAt.real_of_complex (h : HasDerivAt e e' z) : HasDerivAt (fun x : ℝ => (e x).re) e'.re z := by have A : HasFDerivAt ((↑) : ℝ → ℂ) ofRealCLM z := ofRealCLM.hasFDerivAt have B : HasFDerivAt e ((ContinuousLinearMap.smulRight 1 e' : ℂ →L[ℂ] ℂ).restrictScalars ℝ) (ofRealCLM z) := h.hasFDerivAt.restrictScalars ℝ have C : HasFDerivAt re reCLM (e (ofRealCLM z)) := reCLM.hasFDerivAt -- Porting note: this should be by: -- simpa using (C.comp z (B.comp z A)).hasStrictDerivAt -- but for some reason simp can not use `ContinuousLinearMap.comp_apply` convert (C.comp z (B.comp z A)).hasDerivAt rw [ContinuousLinearMap.comp_apply, ContinuousLinearMap.comp_apply] simp #align has_deriv_at.real_of_complex HasDerivAt.real_of_complex theorem ContDiffAt.real_of_complex {n : ℕ∞} (h : ContDiffAt ℂ n e z) : ContDiffAt ℝ n (fun x : ℝ => (e x).re) z := by have A : ContDiffAt ℝ n ((↑) : ℝ → ℂ) z := ofRealCLM.contDiff.contDiffAt have B : ContDiffAt ℝ n e z := h.restrict_scalars ℝ have C : ContDiffAt ℝ n re (e z) := reCLM.contDiff.contDiffAt exact C.comp z (B.comp z A) #align cont_diff_at.real_of_complex ContDiffAt.real_of_complex theorem ContDiff.real_of_complex {n : ℕ∞} (h : ContDiff ℂ n e) : ContDiff ℝ n fun x : ℝ => (e x).re := contDiff_iff_contDiffAt.2 fun _ => h.contDiffAt.real_of_complex #align cont_diff.real_of_complex ContDiff.real_of_complex variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] theorem HasStrictDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv' HasStrictDerivAt.complexToReal_fderiv' theorem HasDerivAt.complexToReal_fderiv' {f : ℂ → E} {x : ℂ} {f' : E} (h : HasDerivAt f f' x) : HasFDerivAt f (reCLM.smulRight f' + I • imCLM.smulRight f') x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivAt.restrictScalars ℝ #align has_deriv_at.complex_to_real_fderiv' HasDerivAt.complexToReal_fderiv' theorem HasDerivWithinAt.complexToReal_fderiv' {f : ℂ → E} {s : Set ℂ} {x : ℂ} {f' : E} (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (reCLM.smulRight f' + I • imCLM.smulRight f') s x := by simpa only [Complex.restrictScalars_one_smulRight'] using h.hasFDerivWithinAt.restrictScalars ℝ #align has_deriv_within_at.complex_to_real_fderiv' HasDerivWithinAt.complexToReal_fderiv' theorem HasStrictDerivAt.complexToReal_fderiv {f : ℂ → ℂ} {f' x : ℂ} (h : HasStrictDerivAt f f' x) : HasStrictFDerivAt f (f' • (1 : ℂ →L[ℝ] ℂ)) x := by simpa only [Complex.restrictScalars_one_smulRight] using h.hasStrictFDerivAt.restrictScalars ℝ #align has_strict_deriv_at.complex_to_real_fderiv HasStrictDerivAt.complexToReal_fderiv theorem HasDerivAt.complexToReal_fderiv {f : ℂ → ℂ} {f' x : ℂ} (h : HasDerivAt f f' x) : HasFDerivAt f (f' • (1 : ℂ →L[ℝ] ℂ)) x := by simpa only [Complex.restrictScalars_one_smulRight] using h.hasFDerivAt.restrictScalars ℝ #align has_deriv_at.complex_to_real_fderiv HasDerivAt.complexToReal_fderiv
Mathlib/Analysis/Complex/RealDeriv.lean
128
130
theorem HasDerivWithinAt.complexToReal_fderiv {f : ℂ → ℂ} {s : Set ℂ} {f' x : ℂ} (h : HasDerivWithinAt f f' s x) : HasFDerivWithinAt f (f' • (1 : ℂ →L[ℝ] ℂ)) s x := by
simpa only [Complex.restrictScalars_one_smulRight] using h.hasFDerivWithinAt.restrictScalars ℝ
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton
Mathlib/FieldTheory/Separable.lean
70
72
theorem separable_X_add_C (a : R) : (X + C a).Separable := by
rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right
import Mathlib.MeasureTheory.Constructions.Pi import Mathlib.MeasureTheory.Constructions.Prod.Integral open Fintype MeasureTheory MeasureTheory.Measure variable {𝕜 : Type*} [RCLike 𝕜] namespace MeasureTheory theorem Integrable.fin_nat_prod {n : ℕ} {E : Fin n → Type*} [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] {f : (i : Fin n) → E i → 𝕜} (hf : ∀ i, Integrable (f i)) : Integrable (fun (x : (i : Fin n) → E i) ↦ ∏ i, f i (x i)) := by induction n with | zero => simp only [Nat.zero_eq, Finset.univ_eq_empty, Finset.prod_empty, volume_pi, integrable_const_iff, one_ne_zero, pi_empty_univ, ENNReal.one_lt_top, or_true] | succ n n_ih => have := ((measurePreserving_piFinSuccAbove (fun i => (volume : Measure (E i))) 0).symm) rw [volume_pi, ← this.integrable_comp_emb (MeasurableEquiv.measurableEmbedding _)] simp_rw [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.prod_univ_succ, Fin.insertNth_zero] simp only [Fin.zero_succAbove, cast_eq, Function.comp_def, Fin.cons_zero, Fin.cons_succ] have : Integrable (fun (x : (j : Fin n) → E (Fin.succ j)) ↦ ∏ j, f (Fin.succ j) (x j)) := n_ih (fun i ↦ hf _) exact Integrable.prod_mul (hf 0) this
Mathlib/MeasureTheory/Integral/Pi.lean
45
54
theorem Integrable.fintype_prod_dep {ι : Type*} [Fintype ι] {E : ι → Type*} {f : (i : ι) → E i → 𝕜} [∀ i, MeasureSpace (E i)] [∀ i, SigmaFinite (volume : Measure (E i))] (hf : ∀ i, Integrable (f i)) : Integrable (fun (x : (i : ι) → E i) ↦ ∏ i, f i (x i)) := by
let e := (equivFin ι).symm simp_rw [← (volume_measurePreserving_piCongrLeft _ e).integrable_comp_emb (MeasurableEquiv.measurableEmbedding _), ← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, Function.comp_def, Equiv.piCongrLeft_apply_apply] exact .fin_nat_prod (fun i ↦ hf _)
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
Mathlib/Geometry/Euclidean/PerpBisector.lean
86
90
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]
import Mathlib.CategoryTheory.Sites.Pretopology import Mathlib.CategoryTheory.Sites.IsSheafFor #align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe w v u namespace CategoryTheory open Opposite CategoryTheory Category Limits Sieve namespace Presieve variable {C : Type u} [Category.{v} C] variable {P : Cᵒᵖ ⥤ Type w} variable {X : C} variable (J J₂ : GrothendieckTopology C) def IsSeparated (P : Cᵒᵖ ⥤ Type w) : Prop := ∀ {X} (S : Sieve X), S ∈ J X → IsSeparatedFor P (S : Presieve X) #align category_theory.presieve.is_separated CategoryTheory.Presieve.IsSeparated def IsSheaf (P : Cᵒᵖ ⥤ Type w) : Prop := ∀ ⦃X⦄ (S : Sieve X), S ∈ J X → IsSheafFor P (S : Presieve X) #align category_theory.presieve.is_sheaf CategoryTheory.Presieve.IsSheaf theorem IsSheaf.isSheafFor {P : Cᵒᵖ ⥤ Type w} (hp : IsSheaf J P) (R : Presieve X) (hr : generate R ∈ J X) : IsSheafFor P R := (isSheafFor_iff_generate R).2 <| hp _ hr #align category_theory.presieve.is_sheaf.is_sheaf_for CategoryTheory.Presieve.IsSheaf.isSheafFor theorem isSheaf_of_le (P : Cᵒᵖ ⥤ Type w) {J₁ J₂ : GrothendieckTopology C} : J₁ ≤ J₂ → IsSheaf J₂ P → IsSheaf J₁ P := fun h t _ S hS => t S (h _ hS) #align category_theory.presieve.is_sheaf_of_le CategoryTheory.Presieve.isSheaf_of_le theorem isSeparated_of_isSheaf (P : Cᵒᵖ ⥤ Type w) (h : IsSheaf J P) : IsSeparated J P := fun S hS => (h S hS).isSeparatedFor #align category_theory.presieve.is_separated_of_is_sheaf CategoryTheory.Presieve.isSeparated_of_isSheaf theorem isSheaf_iso {P' : Cᵒᵖ ⥤ Type w} (i : P ≅ P') (h : IsSheaf J P) : IsSheaf J P' := fun _ S hS => isSheafFor_iso i (h S hS) #align category_theory.presieve.is_sheaf_iso CategoryTheory.Presieve.isSheaf_iso theorem isSheaf_of_yoneda {P : Cᵒᵖ ⥤ Type v} (h : ∀ {X} (S : Sieve X), S ∈ J X → YonedaSheafCondition P S) : IsSheaf J P := fun _ _ hS => isSheafFor_iff_yonedaSheafCondition.2 (h _ hS) #align category_theory.presieve.is_sheaf_of_yoneda CategoryTheory.Presieve.isSheaf_of_yoneda
Mathlib/CategoryTheory/Sites/SheafOfTypes.lean
105
118
theorem isSheaf_pretopology [HasPullbacks C] (K : Pretopology C) : IsSheaf (K.toGrothendieck C) P ↔ ∀ {X : C} (R : Presieve X), R ∈ K X → IsSheafFor P R := by
constructor · intro PJ X R hR rw [isSheafFor_iff_generate] apply PJ (Sieve.generate R) ⟨_, hR, le_generate R⟩ · rintro PK X S ⟨R, hR, RS⟩ have gRS : ⇑(generate R) ≤ S := by apply giGenerate.gc.monotone_u rwa [sets_iff_generate] apply isSheafFor_subsieve P gRS _ intro Y f rw [← pullbackArrows_comm, ← isSheafFor_iff_generate] exact PK (pullbackArrows f R) (K.pullbacks f R hR)
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.Finsupp import Mathlib.Tactic.FinCases #align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Affine namespace Finset theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by ext x fin_cases x <;> simp #align finset.univ_fin2 Finset.univ_fin2 variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [S : AffineSpace V P] variable {ι : Type*} (s : Finset ι) variable {ι₂ : Type*} (s₂ : Finset ι₂) def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V := ∑ i ∈ s, (LinearMap.proj i : (ι → k) →ₗ[k] k).smulRight (p i -ᵥ b) #align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint @[simp]
Mathlib/LinearAlgebra/AffineSpace/Combination.lean
72
74
theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) : s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b) := by
simp [weightedVSubOfPoint, LinearMap.sum_apply]
import Mathlib.Data.Complex.Module import Mathlib.Data.Complex.Order import Mathlib.Data.Complex.Exponential import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.RealVectorSpace #align_import analysis.complex.basic from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" assert_not_exists Absorbs noncomputable section namespace Complex variable {z : ℂ} open ComplexConjugate Topology Filter instance : Norm ℂ := ⟨abs⟩ @[simp] theorem norm_eq_abs (z : ℂ) : ‖z‖ = abs z := rfl #align complex.norm_eq_abs Complex.norm_eq_abs lemma norm_I : ‖I‖ = 1 := abs_I theorem norm_exp_ofReal_mul_I (t : ℝ) : ‖exp (t * I)‖ = 1 := by simp only [norm_eq_abs, abs_exp_ofReal_mul_I] set_option linter.uppercaseLean3 false in #align complex.norm_exp_of_real_mul_I Complex.norm_exp_ofReal_mul_I instance instNormedAddCommGroup : NormedAddCommGroup ℂ := AddGroupNorm.toNormedAddCommGroup { abs with map_zero' := map_zero abs neg' := abs.map_neg eq_zero_of_map_eq_zero' := fun _ => abs.eq_zero.1 } instance : NormedField ℂ where dist_eq _ _ := rfl norm_mul' := map_mul abs instance : DenselyNormedField ℂ where lt_norm_lt r₁ r₂ h₀ hr := let ⟨x, h⟩ := exists_between hr ⟨x, by rwa [norm_eq_abs, abs_ofReal, abs_of_pos (h₀.trans_lt h.1)]⟩ instance {R : Type*} [NormedField R] [NormedAlgebra R ℝ] : NormedAlgebra R ℂ where norm_smul_le r x := by rw [← algebraMap_smul ℝ r x, real_smul, norm_mul, norm_eq_abs, abs_ofReal, ← Real.norm_eq_abs, norm_algebraMap'] variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℂ E] -- see Note [lower instance priority] instance (priority := 900) _root_.NormedSpace.complexToReal : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ ℂ E #align normed_space.complex_to_real NormedSpace.complexToReal -- see Note [lower instance priority] instance (priority := 900) _root_.NormedAlgebra.complexToReal {A : Type*} [SeminormedRing A] [NormedAlgebra ℂ A] : NormedAlgebra ℝ A := NormedAlgebra.restrictScalars ℝ ℂ A theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) := rfl #align complex.dist_eq Complex.dist_eq theorem dist_eq_re_im (z w : ℂ) : dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by rw [sq, sq] rfl #align complex.dist_eq_re_im Complex.dist_eq_re_im @[simp] theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) : dist (mk x₁ y₁) (mk x₂ y₂) = √((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) := dist_eq_re_im _ _ #align complex.dist_mk Complex.dist_mk theorem dist_of_re_eq {z w : ℂ} (h : z.re = w.re) : dist z w = dist z.im w.im := by rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, zero_add, Real.sqrt_sq_eq_abs, Real.dist_eq] #align complex.dist_of_re_eq Complex.dist_of_re_eq theorem nndist_of_re_eq {z w : ℂ} (h : z.re = w.re) : nndist z w = nndist z.im w.im := NNReal.eq <| dist_of_re_eq h #align complex.nndist_of_re_eq Complex.nndist_of_re_eq theorem edist_of_re_eq {z w : ℂ} (h : z.re = w.re) : edist z w = edist z.im w.im := by rw [edist_nndist, edist_nndist, nndist_of_re_eq h] #align complex.edist_of_re_eq Complex.edist_of_re_eq theorem dist_of_im_eq {z w : ℂ} (h : z.im = w.im) : dist z w = dist z.re w.re := by rw [dist_eq_re_im, h, sub_self, zero_pow two_ne_zero, add_zero, Real.sqrt_sq_eq_abs, Real.dist_eq] #align complex.dist_of_im_eq Complex.dist_of_im_eq theorem nndist_of_im_eq {z w : ℂ} (h : z.im = w.im) : nndist z w = nndist z.re w.re := NNReal.eq <| dist_of_im_eq h #align complex.nndist_of_im_eq Complex.nndist_of_im_eq
Mathlib/Analysis/Complex/Basic.lean
133
134
theorem edist_of_im_eq {z w : ℂ} (h : z.im = w.im) : edist z w = edist z.re w.re := by
rw [edist_nndist, edist_nndist, nndist_of_im_eq h]
import Mathlib.Analysis.Complex.CauchyIntegral import Mathlib.Analysis.NormedSpace.Completion import Mathlib.Analysis.NormedSpace.Extr import Mathlib.Topology.Order.ExtrClosure #align_import analysis.complex.abs_max from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open TopologicalSpace Metric Set Filter Asymptotics Function MeasureTheory AffineMap Bornology open scoped Topology Filter NNReal Real universe u v w variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] {F : Type v} [NormedAddCommGroup F] [NormedSpace ℂ F] local postfix:100 "̂" => UniformSpace.Completion namespace Complex
Mathlib/Analysis/Complex/AbsMax.lean
106
137
theorem norm_max_aux₁ [CompleteSpace F] {f : ℂ → F} {z w : ℂ} (hd : DiffContOnCl ℂ f (ball z (dist w z))) (hz : IsMaxOn (norm ∘ f) (closedBall z (dist w z)) z) : ‖f w‖ = ‖f z‖ := by
-- Consider a circle of radius `r = dist w z`. set r : ℝ := dist w z have hw : w ∈ closedBall z r := mem_closedBall.2 le_rfl -- Assume the converse. Since `‖f w‖ ≤ ‖f z‖`, we have `‖f w‖ < ‖f z‖`. refine (isMaxOn_iff.1 hz _ hw).antisymm (not_lt.1 ?_) rintro hw_lt : ‖f w‖ < ‖f z‖ have hr : 0 < r := dist_pos.2 (ne_of_apply_ne (norm ∘ f) hw_lt.ne) -- Due to Cauchy integral formula, it suffices to prove the following inequality. suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖ by refine this.ne ?_ have A : (∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ) = (2 * π * I : ℂ) • f z := hd.circleIntegral_sub_inv_smul (mem_ball_self hr) simp [A, norm_smul, Real.pi_pos.le] suffices ‖∮ ζ in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r) by rwa [mul_assoc, mul_div_cancel₀ _ hr.ne'] at this /- This inequality is true because `‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r` for all `ζ` on the circle and this inequality is strict at `ζ = w`. -/ have hsub : sphere z r ⊆ closedBall z r := sphere_subset_closedBall refine circleIntegral.norm_integral_lt_of_norm_le_const_of_lt hr ?_ ?_ ⟨w, rfl, ?_⟩ · show ContinuousOn (fun ζ : ℂ => (ζ - z)⁻¹ • f ζ) (sphere z r) refine ((continuousOn_id.sub continuousOn_const).inv₀ ?_).smul (hd.continuousOn_ball.mono hsub) exact fun ζ hζ => sub_ne_zero.2 (ne_of_mem_sphere hζ hr.ne') · show ∀ ζ ∈ sphere z r, ‖(ζ - z)⁻¹ • f ζ‖ ≤ ‖f z‖ / r rintro ζ (hζ : abs (ζ - z) = r) rw [le_div_iff hr, norm_smul, norm_inv, norm_eq_abs, hζ, mul_comm, mul_inv_cancel_left₀ hr.ne'] exact hz (hsub hζ) show ‖(w - z)⁻¹ • f w‖ < ‖f z‖ / r rw [norm_smul, norm_inv, norm_eq_abs, ← div_eq_inv_mul] exact (div_lt_div_right hr).2 hw_lt
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.Limits.Shapes.Products import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts import Mathlib.CategoryTheory.Limits.Shapes.Terminal import Mathlib.CategoryTheory.ConcreteCategory.Basic import Mathlib.Tactic.CategoryTheory.Elementwise import Mathlib.Data.Set.Subsingleton #align_import category_theory.limits.shapes.types from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" universe v u open CategoryTheory Limits namespace CategoryTheory.Limits.Types example : HasProducts.{v} (Type v) := inferInstance example [UnivLE.{v, u}] : HasProducts.{v} (Type u) := inferInstance -- This shortcut instance is required in `Mathlib.CategoryTheory.Closed.Types`, -- although I don't understand why, and wish it wasn't. instance : HasProducts.{v} (Type v) := inferInstance @[simp 1001] theorem pi_lift_π_apply {β : Type v} [Small.{u} β] (f : β → Type u) {P : Type u} (s : ∀ b, P ⟶ f b) (b : β) (x : P) : (Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x := congr_fun (limit.lift_π (Fan.mk P s) ⟨b⟩) x #align category_theory.limits.types.pi_lift_π_apply CategoryTheory.Limits.Types.pi_lift_π_apply theorem pi_lift_π_apply' {β : Type v} (f : β → Type v) {P : Type v} (s : ∀ b, P ⟶ f b) (b : β) (x : P) : (Pi.π f b : (piObj f) → f b) (@Pi.lift β _ _ f _ P s x) = s b x := by simp #align category_theory.limits.types.pi_lift_π_apply' CategoryTheory.Limits.Types.pi_lift_π_apply' @[simp 1001] theorem pi_map_π_apply {β : Type v} [Small.{u} β] {f g : β → Type u} (α : ∀ j, f j ⟶ g j) (b : β) (x) : (Pi.π g b : ∏ᶜ g → g b) (Pi.map α x) = α b ((Pi.π f b : ∏ᶜ f → f b) x) := Limit.map_π_apply.{v, u} _ _ _ #align category_theory.limits.types.pi_map_π_apply CategoryTheory.Limits.Types.pi_map_π_apply
Mathlib/CategoryTheory/Limits/Shapes/Types.lean
82
84
theorem pi_map_π_apply' {β : Type v} {f g : β → Type v} (α : ∀ j, f j ⟶ g j) (b : β) (x) : (Pi.π g b : ∏ᶜ g → g b) (Pi.map α x) = α b ((Pi.π f b : ∏ᶜ f → f b) x) := by
simp
import Mathlib.Data.Finset.Basic variable {ι : Sort _} {π : ι → Sort _} {x : ∀ i, π i} [DecidableEq ι] namespace Function def updateFinset (x : ∀ i, π i) (s : Finset ι) (y : ∀ i : ↥s, π i) (i : ι) : π i := if hi : i ∈ s then y ⟨i, hi⟩ else x i open Finset Equiv theorem updateFinset_def {s : Finset ι} {y} : updateFinset x s y = fun i ↦ if hi : i ∈ s then y ⟨i, hi⟩ else x i := rfl @[simp] theorem updateFinset_empty {y} : updateFinset x ∅ y = x := rfl theorem updateFinset_singleton {i y} : updateFinset x {i} y = Function.update x i (y ⟨i, mem_singleton_self i⟩) := by congr with j by_cases hj : j = i · cases hj simp only [dif_pos, Finset.mem_singleton, update_same, updateFinset] · simp [hj, updateFinset] theorem update_eq_updateFinset {i y} : Function.update x i y = updateFinset x {i} (uniqueElim y) := by congr with j by_cases hj : j = i · cases hj simp only [dif_pos, Finset.mem_singleton, update_same, updateFinset] exact uniqueElim_default (α := fun j : ({i} : Finset ι) => π j) y · simp [hj, updateFinset]
Mathlib/Data/Finset/Update.lean
52
63
theorem updateFinset_updateFinset {s t : Finset ι} (hst : Disjoint s t) {y : ∀ i : ↥s, π i} {z : ∀ i : ↥t, π i} : updateFinset (updateFinset x s y) t z = updateFinset x (s ∪ t) (Equiv.piFinsetUnion π hst ⟨y, z⟩) := by
set e := Equiv.Finset.union s t hst congr with i by_cases his : i ∈ s <;> by_cases hit : i ∈ t <;> simp only [updateFinset, his, hit, dif_pos, dif_neg, Finset.mem_union, true_or_iff, false_or_iff, not_false_iff] · exfalso; exact Finset.disjoint_left.mp hst his hit · exact piCongrLeft_sum_inl (fun b : ↥(s ∪ t) => π b) e y z ⟨i, his⟩ |>.symm · exact piCongrLeft_sum_inr (fun b : ↥(s ∪ t) => π b) e y z ⟨i, hit⟩ |>.symm
import Mathlib.Algebra.Module.Zlattice.Basic import Mathlib.NumberTheory.NumberField.Embeddings import Mathlib.NumberTheory.NumberField.FractionalIdeal #align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30" variable (K : Type*) [Field K] namespace NumberField.canonicalEmbedding open NumberField def _root_.NumberField.canonicalEmbedding : K →+* ((K →+* ℂ) → ℂ) := Pi.ringHom fun φ => φ theorem _root_.NumberField.canonicalEmbedding_injective [NumberField K] : Function.Injective (NumberField.canonicalEmbedding K) := RingHom.injective _ variable {K} @[simp] theorem apply_at (φ : K →+* ℂ) (x : K) : (NumberField.canonicalEmbedding K x) φ = φ x := rfl open scoped ComplexConjugate
Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
61
70
theorem conj_apply {x : ((K →+* ℂ) → ℂ)} (φ : K →+* ℂ) (hx : x ∈ Submodule.span ℝ (Set.range (canonicalEmbedding K))) : conj (x φ) = x (ComplexEmbedding.conjugate φ) := by
refine Submodule.span_induction hx ?_ ?_ (fun _ _ hx hy => ?_) (fun a _ hx => ?_) · rintro _ ⟨x, rfl⟩ rw [apply_at, apply_at, ComplexEmbedding.conjugate_coe_eq] · rw [Pi.zero_apply, Pi.zero_apply, map_zero] · rw [Pi.add_apply, Pi.add_apply, map_add, hx, hy] · rw [Pi.smul_apply, Complex.real_smul, map_mul, Complex.conj_ofReal] exact congrArg ((a : ℂ) * ·) hx
import Mathlib.Order.Interval.Finset.Nat #align_import data.fin.interval from "leanprover-community/mathlib"@"1d29de43a5ba4662dd33b5cfeecfc2a27a5a8a29" assert_not_exists MonoidWithZero open Finset Fin Function namespace Fin variable (n : ℕ) instance instLocallyFiniteOrder : LocallyFiniteOrder (Fin n) := OrderIso.locallyFiniteOrder Fin.orderIsoSubtype instance instLocallyFiniteOrderBot : LocallyFiniteOrderBot (Fin n) := OrderIso.locallyFiniteOrderBot Fin.orderIsoSubtype instance instLocallyFiniteOrderTop : ∀ n, LocallyFiniteOrderTop (Fin n) | 0 => IsEmpty.toLocallyFiniteOrderTop | _ + 1 => inferInstance variable {n} (a b : Fin n) theorem Icc_eq_finset_subtype : Icc a b = (Icc (a : ℕ) b).fin n := rfl #align fin.Icc_eq_finset_subtype Fin.Icc_eq_finset_subtype theorem Ico_eq_finset_subtype : Ico a b = (Ico (a : ℕ) b).fin n := rfl #align fin.Ico_eq_finset_subtype Fin.Ico_eq_finset_subtype theorem Ioc_eq_finset_subtype : Ioc a b = (Ioc (a : ℕ) b).fin n := rfl #align fin.Ioc_eq_finset_subtype Fin.Ioc_eq_finset_subtype theorem Ioo_eq_finset_subtype : Ioo a b = (Ioo (a : ℕ) b).fin n := rfl #align fin.Ioo_eq_finset_subtype Fin.Ioo_eq_finset_subtype theorem uIcc_eq_finset_subtype : uIcc a b = (uIcc (a : ℕ) b).fin n := rfl #align fin.uIcc_eq_finset_subtype Fin.uIcc_eq_finset_subtype @[simp] theorem map_valEmbedding_Icc : (Icc a b).map Fin.valEmbedding = Icc ↑a ↑b := by simp [Icc_eq_finset_subtype, Finset.fin, Finset.map_map, Icc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Icc Fin.map_valEmbedding_Icc @[simp] theorem map_valEmbedding_Ico : (Ico a b).map Fin.valEmbedding = Ico ↑a ↑b := by simp [Ico_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ico Fin.map_valEmbedding_Ico @[simp] theorem map_valEmbedding_Ioc : (Ioc a b).map Fin.valEmbedding = Ioc ↑a ↑b := by simp [Ioc_eq_finset_subtype, Finset.fin, Finset.map_map, Ioc_filter_lt_of_lt_right] #align fin.map_subtype_embedding_Ioc Fin.map_valEmbedding_Ioc @[simp] theorem map_valEmbedding_Ioo : (Ioo a b).map Fin.valEmbedding = Ioo ↑a ↑b := by simp [Ioo_eq_finset_subtype, Finset.fin, Finset.map_map] #align fin.map_subtype_embedding_Ioo Fin.map_valEmbedding_Ioo @[simp] theorem map_subtype_embedding_uIcc : (uIcc a b).map valEmbedding = uIcc ↑a ↑b := map_valEmbedding_Icc _ _ #align fin.map_subtype_embedding_uIcc Fin.map_subtype_embedding_uIcc @[simp] theorem card_Icc : (Icc a b).card = b + 1 - a := by rw [← Nat.card_Icc, ← map_valEmbedding_Icc, card_map] #align fin.card_Icc Fin.card_Icc @[simp]
Mathlib/Order/Interval/Finset/Fin.lean
109
110
theorem card_Ico : (Ico a b).card = b - a := by
rw [← Nat.card_Ico, ← map_valEmbedding_Ico, card_map]
import Mathlib.Order.BooleanAlgebra import Mathlib.Logic.Equiv.Basic #align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904" open Function OrderDual variable {ι α β : Type*} {π : ι → Type*} def symmDiff [Sup α] [SDiff α] (a b : α) : α := a \ b ⊔ b \ a #align symm_diff symmDiff def bihimp [Inf α] [HImp α] (a b : α) : α := (b ⇨ a) ⊓ (a ⇨ b) #align bihimp bihimp scoped[symmDiff] infixl:100 " ∆ " => symmDiff scoped[symmDiff] infixl:100 " ⇔ " => bihimp open scoped symmDiff theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a := rfl #align symm_diff_def symmDiff_def theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) := rfl #align bihimp_def bihimp_def theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q := rfl #align symm_diff_eq_xor symmDiff_eq_Xor' @[simp] theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) := (iff_iff_implies_and_implies _ _).symm.trans Iff.comm #align bihimp_iff_iff bihimp_iff_iff @[simp] theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide #align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor section GeneralizedHeytingAlgebra variable [GeneralizedHeytingAlgebra α] (a b c d : α) @[simp] theorem toDual_bihimp : toDual (a ⇔ b) = toDual a ∆ toDual b := rfl #align to_dual_bihimp toDual_bihimp @[simp] theorem ofDual_symmDiff (a b : αᵒᵈ) : ofDual (a ∆ b) = ofDual a ⇔ ofDual b := rfl #align of_dual_symm_diff ofDual_symmDiff theorem bihimp_comm : a ⇔ b = b ⇔ a := by simp only [(· ⇔ ·), inf_comm] #align bihimp_comm bihimp_comm instance bihimp_isCommutative : Std.Commutative (α := α) (· ⇔ ·) := ⟨bihimp_comm⟩ #align bihimp_is_comm bihimp_isCommutative @[simp]
Mathlib/Order/SymmDiff.lean
248
248
theorem bihimp_self : a ⇔ a = ⊤ := by
rw [bihimp, inf_idem, himp_self]
import Mathlib.Data.Set.Finite #align_import data.finset.preimage from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe" assert_not_exists Finset.sum open Set Function universe u v w x variable {α : Type u} {β : Type v} {ι : Sort w} {γ : Type x} namespace Finset section Preimage noncomputable def preimage (s : Finset β) (f : α → β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : Finset α := (s.finite_toSet.preimage hf).toFinset #align finset.preimage Finset.preimage @[simp] theorem mem_preimage {f : α → β} {s : Finset β} {hf : Set.InjOn f (f ⁻¹' ↑s)} {x : α} : x ∈ preimage s f hf ↔ f x ∈ s := Set.Finite.mem_toFinset _ #align finset.mem_preimage Finset.mem_preimage @[simp, norm_cast] theorem coe_preimage {f : α → β} (s : Finset β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : (↑(preimage s f hf) : Set α) = f ⁻¹' ↑s := Set.Finite.coe_toFinset _ #align finset.coe_preimage Finset.coe_preimage @[simp] theorem preimage_empty {f : α → β} : preimage ∅ f (by simp [InjOn]) = ∅ := Finset.coe_injective (by simp) #align finset.preimage_empty Finset.preimage_empty @[simp] theorem preimage_univ {f : α → β} [Fintype α] [Fintype β] (hf) : preimage univ f hf = univ := Finset.coe_injective (by simp) #align finset.preimage_univ Finset.preimage_univ @[simp] theorem preimage_inter [DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hs : Set.InjOn f (f ⁻¹' ↑s)) (ht : Set.InjOn f (f ⁻¹' ↑t)) : (preimage (s ∩ t) f fun x₁ hx₁ x₂ hx₂ => hs (mem_of_mem_inter_left hx₁) (mem_of_mem_inter_left hx₂)) = preimage s f hs ∩ preimage t f ht := Finset.coe_injective (by simp) #align finset.preimage_inter Finset.preimage_inter @[simp] theorem preimage_union [DecidableEq α] [DecidableEq β] {f : α → β} {s t : Finset β} (hst) : preimage (s ∪ t) f hst = (preimage s f fun x₁ hx₁ x₂ hx₂ => hst (mem_union_left _ hx₁) (mem_union_left _ hx₂)) ∪ preimage t f fun x₁ hx₁ x₂ hx₂ => hst (mem_union_right _ hx₁) (mem_union_right _ hx₂) := Finset.coe_injective (by simp) #align finset.preimage_union Finset.preimage_union @[simp, nolint simpNF] -- Porting note: linter complains that LHS doesn't simplify theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β} (s : Finset β) (hf : Function.Injective f) : preimage sᶜ f hf.injOn = (preimage s f hf.injOn)ᶜ := Finset.coe_injective (by simp) #align finset.preimage_compl Finset.preimage_compl @[simp] lemma preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).preimage f f.injective.injOn = s := coe_injective <| by simp only [coe_preimage, coe_map, Set.preimage_image_eq _ f.injective] #align finset.preimage_map Finset.preimage_map theorem monotone_preimage {f : α → β} (h : Injective f) : Monotone fun s => preimage s f h.injOn := fun _ _ H _ hx => mem_preimage.2 (H <| mem_preimage.1 hx) #align finset.monotone_preimage Finset.monotone_preimage theorem image_subset_iff_subset_preimage [DecidableEq β] {f : α → β} {s : Finset α} {t : Finset β} (hf : Set.InjOn f (f ⁻¹' ↑t)) : s.image f ⊆ t ↔ s ⊆ t.preimage f hf := image_subset_iff.trans <| by simp only [subset_iff, mem_preimage] #align finset.image_subset_iff_subset_preimage Finset.image_subset_iff_subset_preimage
Mathlib/Data/Finset/Preimage.lean
92
94
theorem map_subset_iff_subset_preimage {f : α ↪ β} {s : Finset α} {t : Finset β} : s.map f ⊆ t ↔ s ⊆ t.preimage f f.injective.injOn := by
classical rw [map_eq_image, image_subset_iff_subset_preimage]
import Mathlib.Topology.StoneCech import Mathlib.Topology.Algebra.Semigroup import Mathlib.Data.Stream.Init #align_import combinatorics.hindman from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988" open Filter @[to_additive "Addition of ultrafilters given by `∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m')`."] def Ultrafilter.mul {M} [Mul M] : Mul (Ultrafilter M) where mul U V := (· * ·) <$> U <*> V #align ultrafilter.has_mul Ultrafilter.mul #align ultrafilter.has_add Ultrafilter.add attribute [local instance] Ultrafilter.mul Ultrafilter.add @[to_additive] theorem Ultrafilter.eventually_mul {M} [Mul M] (U V : Ultrafilter M) (p : M → Prop) : (∀ᶠ m in ↑(U * V), p m) ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m * m') := Iff.rfl #align ultrafilter.eventually_mul Ultrafilter.eventually_mul #align ultrafilter.eventually_add Ultrafilter.eventually_add @[to_additive "Additive semigroup structure on `Ultrafilter M` induced by an additive semigroup structure on `M`."] def Ultrafilter.semigroup {M} [Semigroup M] : Semigroup (Ultrafilter M) := { Ultrafilter.mul with mul_assoc := fun U V W => Ultrafilter.coe_inj.mp <| -- porting note (#11083): `simp` was slow to typecheck, replaced by `simp_rw` Filter.ext' fun p => by simp_rw [Ultrafilter.eventually_mul, mul_assoc] } #align ultrafilter.semigroup Ultrafilter.semigroup #align ultrafilter.add_semigroup Ultrafilter.addSemigroup attribute [local instance] Ultrafilter.semigroup Ultrafilter.addSemigroup -- We don't prove `continuous_mul_right`, because in general it is false! @[to_additive] theorem Ultrafilter.continuous_mul_left {M} [Semigroup M] (V : Ultrafilter M) : Continuous (· * V) := ultrafilterBasis_is_basis.continuous_iff.2 <| Set.forall_mem_range.mpr fun s ↦ ultrafilter_isOpen_basic { m : M | ∀ᶠ m' in V, m * m' ∈ s } #align ultrafilter.continuous_mul_left Ultrafilter.continuous_mul_left #align ultrafilter.continuous_add_left Ultrafilter.continuous_add_left namespace Hindman -- Porting note: mathport wants these names to be `fS`, `fP`, etc, but this does violence to -- mathematical naming conventions, as does `fs`, `fp`, so we just followed `mathlib` 3 here inductive FS {M} [AddSemigroup M] : Stream' M → Set M | head (a : Stream' M) : FS a a.head | tail (a : Stream' M) (m : M) (h : FS a.tail m) : FS a m | cons (a : Stream' M) (m : M) (h : FS a.tail m) : FS a (a.head + m) set_option linter.uppercaseLean3 false in #align hindman.FS Hindman.FS @[to_additive FS] inductive FP {M} [Semigroup M] : Stream' M → Set M | head (a : Stream' M) : FP a a.head | tail (a : Stream' M) (m : M) (h : FP a.tail m) : FP a m | cons (a : Stream' M) (m : M) (h : FP a.tail m) : FP a (a.head * m) set_option linter.uppercaseLean3 false in #align hindman.FP Hindman.FP @[to_additive "If `m` and `m'` are finite sums in `M`, then so is `m + m'`, provided that `m'` is obtained from a subsequence of `M` starting sufficiently late."] theorem FP.mul {M} [Semigroup M] {a : Stream' M} {m : M} (hm : m ∈ FP a) : ∃ n, ∀ m' ∈ FP (a.drop n), m * m' ∈ FP a := by induction' hm with a a m hm ih a m hm ih · exact ⟨1, fun m hm => FP.cons a m hm⟩ · cases' ih with n hn use n + 1 intro m' hm' exact FP.tail _ _ (hn _ hm') · cases' ih with n hn use n + 1 intro m' hm' rw [mul_assoc] exact FP.cons _ _ (hn _ hm') set_option linter.uppercaseLean3 false in #align hindman.FP.mul Hindman.FP.mul set_option linter.uppercaseLean3 false in #align hindman.FS.add Hindman.FS.add @[to_additive exists_idempotent_ultrafilter_le_FS]
Mathlib/Combinatorics/Hindman.lean
138
165
theorem exists_idempotent_ultrafilter_le_FP {M} [Semigroup M] (a : Stream' M) : ∃ U : Ultrafilter M, U * U = U ∧ ∀ᶠ m in U, m ∈ FP a := by
let S : Set (Ultrafilter M) := ⋂ n, { U | ∀ᶠ m in U, m ∈ FP (a.drop n) } have h := exists_idempotent_in_compact_subsemigroup ?_ S ?_ ?_ ?_ · rcases h with ⟨U, hU, U_idem⟩ refine ⟨U, U_idem, ?_⟩ convert Set.mem_iInter.mp hU 0 · exact Ultrafilter.continuous_mul_left · apply IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed · intro n U hU filter_upwards [hU] rw [add_comm, ← Stream'.drop_drop, ← Stream'.tail_eq_drop] exact FP.tail _ · intro n exact ⟨pure _, mem_pure.mpr <| FP.head _⟩ · exact (ultrafilter_isClosed_basic _).isCompact · intro n apply ultrafilter_isClosed_basic · exact IsClosed.isCompact (isClosed_iInter fun i => ultrafilter_isClosed_basic _) · intro U hU V hV rw [Set.mem_iInter] at * intro n rw [Set.mem_setOf_eq, Ultrafilter.eventually_mul] filter_upwards [hU n] with m hm obtain ⟨n', hn⟩ := FP.mul hm filter_upwards [hV (n' + n)] with m' hm' apply hn simpa only [Stream'.drop_drop] using hm'
import Mathlib.Algebra.EuclideanDomain.Basic import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.Algebra.GCDMonoid.Nat #align_import ring_theory.int.basic from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802" theorem Int.Prime.dvd_mul {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) : p ∣ m.natAbs ∨ p ∣ n.natAbs := by rwa [← hp.dvd_mul, ← Int.natAbs_mul, ← Int.natCast_dvd] #align int.prime.dvd_mul Int.Prime.dvd_mul theorem Int.Prime.dvd_mul' {m n : ℤ} {p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ m * n) : (p : ℤ) ∣ m ∨ (p : ℤ) ∣ n := by rw [Int.natCast_dvd, Int.natCast_dvd] exact Int.Prime.dvd_mul hp h #align int.prime.dvd_mul' Int.Prime.dvd_mul' theorem Int.Prime.dvd_pow {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) : p ∣ n.natAbs := by rw [Int.natCast_dvd, Int.natAbs_pow] at h exact hp.dvd_of_dvd_pow h #align int.prime.dvd_pow Int.Prime.dvd_pow
Mathlib/RingTheory/Int/Basic.lean
105
108
theorem Int.Prime.dvd_pow' {n : ℤ} {k p : ℕ} (hp : Nat.Prime p) (h : (p : ℤ) ∣ n ^ k) : (p : ℤ) ∣ n := by
rw [Int.natCast_dvd] exact Int.Prime.dvd_pow hp h
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
56
72
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul]
import Mathlib.Data.Multiset.Bind import Mathlib.Control.Traversable.Lemmas import Mathlib.Control.Traversable.Instances #align_import data.multiset.functor from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58" universe u namespace Multiset open List instance functor : Functor Multiset where map := @map @[simp] theorem fmap_def {α' β'} {s : Multiset α'} (f : α' → β') : f <$> s = s.map f := rfl #align multiset.fmap_def Multiset.fmap_def instance : LawfulFunctor Multiset where id_map := by simp comp_map := by simp map_const {_ _} := rfl open LawfulTraversable CommApplicative variable {F : Type u → Type u} [Applicative F] [CommApplicative F] variable {α' β' : Type u} (f : α' → F β') def traverse : Multiset α' → F (Multiset β') := by refine Quotient.lift (Functor.map Coe.coe ∘ Traversable.traverse f) ?_ introv p; unfold Function.comp induction p with | nil => rfl | @cons x l₁ l₂ _ h => have : Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₁ = Multiset.cons <$> f x <*> Coe.coe <$> Traversable.traverse f l₂ := by rw [h] simpa [functor_norm] using this | swap x y l => have : (fun a b (l : List β') ↦ (↑(a :: b :: l) : Multiset β')) <$> f y <*> f x = (fun a b l ↦ ↑(a :: b :: l)) <$> f x <*> f y := by rw [CommApplicative.commutative_map] congr funext a b l simpa [flip] using Perm.swap a b l simp [(· ∘ ·), this, functor_norm, Coe.coe] | trans => simp [*] #align multiset.traverse Multiset.traverse instance : Monad Multiset := { Multiset.functor with pure := fun x ↦ {x} bind := @bind } @[simp] theorem pure_def {α} : (pure : α → Multiset α) = singleton := rfl #align multiset.pure_def Multiset.pure_def @[simp] theorem bind_def {α β} : (· >>= ·) = @bind α β := rfl #align multiset.bind_def Multiset.bind_def instance : LawfulMonad Multiset := LawfulMonad.mk' (bind_pure_comp := fun _ _ ↦ by simp only [pure_def, bind_def, bind_singleton, fmap_def]) (id_map := fun _ ↦ by simp only [fmap_def, id_eq, map_id']) (pure_bind := fun _ _ ↦ by simp only [pure_def, bind_def, singleton_bind]) (bind_assoc := @bind_assoc) open Functor open Traversable LawfulTraversable @[simp] theorem lift_coe {α β : Type*} (x : List α) (f : List α → β) (h : ∀ a b : List α, a ≈ b → f a = f b) : Quotient.lift f h (x : Multiset α) = f x := Quotient.lift_mk _ _ _ #align multiset.lift_coe Multiset.lift_coe @[simp] theorem map_comp_coe {α β} (h : α → β) : Functor.map h ∘ Coe.coe = (Coe.coe ∘ Functor.map h : List α → Multiset β) := by funext; simp only [Function.comp_apply, Coe.coe, fmap_def, map_coe, List.map_eq_map] #align multiset.map_comp_coe Multiset.map_comp_coe theorem id_traverse {α : Type*} (x : Multiset α) : traverse (pure : α → Id α) x = x := by refine Quotient.inductionOn x ?_ intro simp [traverse, Coe.coe] #align multiset.id_traverse Multiset.id_traverse theorem comp_traverse {G H : Type _ → Type _} [Applicative G] [Applicative H] [CommApplicative G] [CommApplicative H] {α β γ : Type _} (g : α → G β) (h : β → H γ) (x : Multiset α) : traverse (Comp.mk ∘ Functor.map h ∘ g) x = Comp.mk (Functor.map (traverse h) (traverse g x)) := by refine Quotient.inductionOn x ?_ intro simp only [traverse, quot_mk_to_coe, lift_coe, Coe.coe, Function.comp_apply, Functor.map_map, functor_norm] simp only [Function.comp, lift_coe] #align multiset.comp_traverse Multiset.comp_traverse
Mathlib/Data/Multiset/Functor.lean
119
126
theorem map_traverse {G : Type* → Type _} [Applicative G] [CommApplicative G] {α β γ : Type _} (g : α → G β) (h : β → γ) (x : Multiset α) : Functor.map (Functor.map h) (traverse g x) = traverse (Functor.map h ∘ g) x := by
refine Quotient.inductionOn x ?_ intro simp only [traverse, quot_mk_to_coe, lift_coe, Function.comp_apply, Functor.map_map, map_comp_coe] rw [LawfulFunctor.comp_map, Traversable.map_traverse'] rfl
import Mathlib.Data.Set.Prod import Mathlib.Logic.Equiv.Fin import Mathlib.ModelTheory.LanguageMap #align_import model_theory.syntax from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728" universe u v w u' v' namespace FirstOrder namespace Language variable (L : Language.{u, v}) {L' : Language} variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P] variable {α : Type u'} {β : Type v'} {γ : Type*} open FirstOrder open Structure Fin inductive Term (α : Type u') : Type max u u' | var : α → Term α | func : ∀ {l : ℕ} (_f : L.Functions l) (_ts : Fin l → Term α), Term α #align first_order.language.term FirstOrder.Language.Term export Term (var func) variable {L} scoped[FirstOrder] prefix:arg "&" => FirstOrder.Language.Term.var ∘ Sum.inr namespace LHom open Term -- Porting note: universes in different order @[simp] def onTerm (φ : L →ᴸ L') : L.Term α → L'.Term α | var i => var i | func f ts => func (φ.onFunction f) fun i => onTerm φ (ts i) set_option linter.uppercaseLean3 false in #align first_order.language.LHom.on_term FirstOrder.Language.LHom.onTerm @[simp]
Mathlib/ModelTheory/Syntax.lean
274
279
theorem id_onTerm : ((LHom.id L).onTerm : L.Term α → L.Term α) = id := by
ext t induction' t with _ _ _ _ ih · rfl · simp_rw [onTerm, ih] rfl
import Mathlib.LinearAlgebra.Span import Mathlib.RingTheory.Ideal.IsPrimary import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Noetherian #align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M] def IsAssociatedPrime : Prop := I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator #align is_associated_prime IsAssociatedPrime variable (R) def associatedPrimes : Set (Ideal R) := { I | IsAssociatedPrime I M } #align associated_primes associatedPrimes variable {I J M R} variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M') theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl #align associate_primes.mem_iff AssociatePrimes.mem_iff theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1 #align is_associated_prime.is_prime IsAssociatedPrime.isPrime
Mathlib/RingTheory/Ideal/AssociatedPrime.lean
59
65
theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) : IsAssociatedPrime I M' := by
obtain ⟨x, rfl⟩ := h.2 refine ⟨h.1, ⟨f x, ?_⟩⟩ ext r rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ← map_smul, ← f.map_zero, hf.eq_iff]
import Mathlib.MeasureTheory.Measure.Typeclasses #align_import measure_theory.measure.sub from "leanprover-community/mathlib"@"562bbf524c595c153470e53d36c57b6f891cc480" open Set namespace MeasureTheory namespace Measure noncomputable instance instSub {α : Type*} [MeasurableSpace α] : Sub (Measure α) := ⟨fun μ ν => sInf { τ | μ ≤ τ + ν }⟩ #align measure_theory.measure.has_sub MeasureTheory.Measure.instSub variable {α : Type*} {m : MeasurableSpace α} {μ ν : Measure α} {s : Set α} theorem sub_def : μ - ν = sInf { d | μ ≤ d + ν } := rfl #align measure_theory.measure.sub_def MeasureTheory.Measure.sub_def theorem sub_le_of_le_add {d} (h : μ ≤ d + ν) : μ - ν ≤ d := sInf_le h #align measure_theory.measure.sub_le_of_le_add MeasureTheory.Measure.sub_le_of_le_add theorem sub_eq_zero_of_le (h : μ ≤ ν) : μ - ν = 0 := nonpos_iff_eq_zero'.1 <| sub_le_of_le_add <| by rwa [zero_add] #align measure_theory.measure.sub_eq_zero_of_le MeasureTheory.Measure.sub_eq_zero_of_le theorem sub_le : μ - ν ≤ μ := sub_le_of_le_add <| Measure.le_add_right le_rfl #align measure_theory.measure.sub_le MeasureTheory.Measure.sub_le @[simp] theorem sub_top : μ - ⊤ = 0 := sub_eq_zero_of_le le_top #align measure_theory.measure.sub_top MeasureTheory.Measure.sub_top @[simp] theorem zero_sub : 0 - μ = 0 := sub_eq_zero_of_le μ.zero_le #align measure_theory.measure.zero_sub MeasureTheory.Measure.zero_sub @[simp] theorem sub_self : μ - μ = 0 := sub_eq_zero_of_le le_rfl #align measure_theory.measure.sub_self MeasureTheory.Measure.sub_self
Mathlib/MeasureTheory/Measure/Sub.lean
71
97
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) : (μ - ν) s = μ s - ν s := by
-- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`. let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp) (fun g h_meas h_disj ↦ by simp only [measure_iUnion h_disj h_meas] rw [ENNReal.tsum_sub _ (h₂ <| g ·)] rw [← measure_iUnion h_disj h_meas] apply measure_ne_top) -- Now, we demonstrate `μ - ν = measure_sub`, and apply it. have h_measure_sub_add : ν + measure_sub = μ := by ext1 t h_t_measurable_set simp only [Pi.add_apply, coe_add] rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm, tsub_add_cancel_of_le (h₂ t)] have h_measure_sub_eq : μ - ν = measure_sub := by rw [MeasureTheory.Measure.sub_def] apply le_antisymm · apply sInf_le simp [le_refl, add_comm, h_measure_sub_add] apply le_sInf intro d h_d rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d apply Measure.le_of_add_le_add_left h_d rw [h_measure_sub_eq] apply Measure.ofMeasurable_apply _ h₁
import Mathlib.Probability.Process.HittingTime import Mathlib.Probability.Martingale.Basic #align_import probability.martingale.optional_stopping from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {𝒢 : Filtration ℕ m0} {f : ℕ → Ω → ℝ} {τ π : Ω → ℕ} -- We may generalize the below lemma to functions taking value in a `NormedLatticeAddCommGroup`. -- Similarly, generalize `(Super/Sub)martingale.setIntegral_le`. theorem Submartingale.expected_stoppedValue_mono [SigmaFiniteFiltration μ 𝒢] (hf : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) (hπ : IsStoppingTime 𝒢 π) (hle : τ ≤ π) {N : ℕ} (hbdd : ∀ ω, π ω ≤ N) : μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := by rw [← sub_nonneg, ← integral_sub', stoppedValue_sub_eq_sum' hle hbdd] · simp only [Finset.sum_apply] have : ∀ i, MeasurableSet[𝒢 i] {ω : Ω | τ ω ≤ i ∧ i < π ω} := by intro i refine (hτ i).inter ?_ convert (hπ i).compl using 1 ext x simp; rfl rw [integral_finset_sum] · refine Finset.sum_nonneg fun i _ => ?_ rw [integral_indicator (𝒢.le _ _ (this _)), integral_sub', sub_nonneg] · exact hf.setIntegral_le (Nat.le_succ i) (this _) · exact (hf.integrable _).integrableOn · exact (hf.integrable _).integrableOn intro i _ exact Integrable.indicator (Integrable.sub (hf.integrable _) (hf.integrable _)) (𝒢.le _ _ (this _)) · exact hf.integrable_stoppedValue hπ hbdd · exact hf.integrable_stoppedValue hτ fun ω => le_trans (hle ω) (hbdd ω) #align measure_theory.submartingale.expected_stopped_value_mono MeasureTheory.Submartingale.expected_stoppedValue_mono theorem submartingale_of_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f) (hint : ∀ i, Integrable (f i) μ) (hf : ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π → τ ≤ π → (∃ N, ∀ ω, π ω ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π]) : Submartingale f 𝒢 μ := by refine submartingale_of_setIntegral_le hadp hint fun i j hij s hs => ?_ classical specialize hf (s.piecewise (fun _ => i) fun _ => j) _ (isStoppingTime_piecewise_const hij hs) (isStoppingTime_const 𝒢 j) (fun x => (ite_le_sup _ _ (x ∈ s)).trans (max_eq_right hij).le) ⟨j, fun _ => le_rfl⟩ rwa [stoppedValue_const, stoppedValue_piecewise_const, integral_piecewise (𝒢.le _ _ hs) (hint _).integrableOn (hint _).integrableOn, ← integral_add_compl (𝒢.le _ _ hs) (hint j), add_le_add_iff_right] at hf #align measure_theory.submartingale_of_expected_stopped_value_mono MeasureTheory.submartingale_of_expected_stoppedValue_mono theorem submartingale_iff_expected_stoppedValue_mono [IsFiniteMeasure μ] (hadp : Adapted 𝒢 f) (hint : ∀ i, Integrable (f i) μ) : Submartingale f 𝒢 μ ↔ ∀ τ π : Ω → ℕ, IsStoppingTime 𝒢 τ → IsStoppingTime 𝒢 π → τ ≤ π → (∃ N, ∀ x, π x ≤ N) → μ[stoppedValue f τ] ≤ μ[stoppedValue f π] := ⟨fun hf _ _ hτ hπ hle ⟨_, hN⟩ => hf.expected_stoppedValue_mono hτ hπ hle hN, submartingale_of_expected_stoppedValue_mono hadp hint⟩ #align measure_theory.submartingale_iff_expected_stopped_value_mono MeasureTheory.submartingale_iff_expected_stoppedValue_mono protected theorem Submartingale.stoppedProcess [IsFiniteMeasure μ] (h : Submartingale f 𝒢 μ) (hτ : IsStoppingTime 𝒢 τ) : Submartingale (stoppedProcess f τ) 𝒢 μ := by rw [submartingale_iff_expected_stoppedValue_mono] · intro σ π hσ hπ hσ_le_π hπ_bdd simp_rw [stoppedValue_stoppedProcess] obtain ⟨n, hπ_le_n⟩ := hπ_bdd exact h.expected_stoppedValue_mono (hσ.min hτ) (hπ.min hτ) (fun ω => min_le_min (hσ_le_π ω) le_rfl) fun ω => (min_le_left _ _).trans (hπ_le_n ω) · exact Adapted.stoppedProcess_of_discrete h.adapted hτ · exact fun i => h.integrable_stoppedValue ((isStoppingTime_const _ i).min hτ) fun ω => min_le_left _ _ #align measure_theory.submartingale.stopped_process MeasureTheory.Submartingale.stoppedProcess section Maximal open Finset
Mathlib/Probability/Martingale/OptionalStopping.lean
112
133
theorem smul_le_stoppedValue_hitting [IsFiniteMeasure μ] (hsub : Submartingale f 𝒢 μ) {ε : ℝ≥0} (n : ℕ) : ε • μ {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω} ≤ ENNReal.ofReal (∫ ω in {ω | (ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω}, stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω ∂μ) := by
have hn : Set.Icc 0 n = {k | k ≤ n} := by ext x; simp have : ∀ ω, ((ε : ℝ) ≤ (range (n + 1)).sup' nonempty_range_succ fun k => f k ω) → (ε : ℝ) ≤ stoppedValue f (hitting f {y : ℝ | ↑ε ≤ y} 0 n) ω := by intro x hx simp_rw [le_sup'_iff, mem_range, Nat.lt_succ_iff] at hx refine stoppedValue_hitting_mem ?_ simp only [Set.mem_setOf_eq, exists_prop, hn] exact let ⟨j, hj₁, hj₂⟩ := hx ⟨j, hj₁, hj₂⟩ have h := setIntegral_ge_of_const_le (measurableSet_le measurable_const (Finset.measurable_range_sup'' fun n _ => (hsub.stronglyMeasurable n).measurable.le (𝒢.le n))) (measure_ne_top _ _) this (Integrable.integrableOn (hsub.integrable_stoppedValue (hitting_isStoppingTime hsub.adapted measurableSet_Ici) hitting_le)) rw [ENNReal.le_ofReal_iff_toReal_le, ENNReal.toReal_smul] · exact h · exact ENNReal.mul_ne_top (by simp) (measure_ne_top _ _) · exact le_trans (mul_nonneg ε.coe_nonneg ENNReal.toReal_nonneg) h
import Mathlib.Topology.Algebra.InfiniteSum.Defs import Mathlib.Data.Fintype.BigOperators import Mathlib.Topology.Algebra.Monoid noncomputable section open Filter Finset Function open scoped Topology variable {α β γ δ : Type*} section HasProd variable [CommMonoid α] [TopologicalSpace α] variable {f g : β → α} {a b : α} {s : Finset β} @[to_additive "Constant zero function has sum `0`"] theorem hasProd_one : HasProd (fun _ ↦ 1 : β → α) 1 := by simp [HasProd, tendsto_const_nhds] #align has_sum_zero hasSum_zero @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Basic.lean
39
40
theorem hasProd_empty [IsEmpty β] : HasProd f 1 := by
convert @hasProd_one α β _ _
import Mathlib.Data.Nat.Factorial.Basic import Mathlib.Order.Monotone.Basic #align_import data.nat.choose.basic from "leanprover-community/mathlib"@"2f3994e1b117b1e1da49bcfb67334f33460c3ce4" open Nat namespace Nat def choose : ℕ → ℕ → ℕ | _, 0 => 1 | 0, _ + 1 => 0 | n + 1, k + 1 => choose n k + choose n (k + 1) #align nat.choose Nat.choose @[simp] theorem choose_zero_right (n : ℕ) : choose n 0 = 1 := by cases n <;> rfl #align nat.choose_zero_right Nat.choose_zero_right @[simp] theorem choose_zero_succ (k : ℕ) : choose 0 (succ k) = 0 := rfl #align nat.choose_zero_succ Nat.choose_zero_succ theorem choose_succ_succ (n k : ℕ) : choose (succ n) (succ k) = choose n k + choose n (succ k) := rfl #align nat.choose_succ_succ Nat.choose_succ_succ theorem choose_succ_succ' (n k : ℕ) : choose (n + 1) (k + 1) = choose n k + choose n (k + 1) := rfl theorem choose_eq_zero_of_lt : ∀ {n k}, n < k → choose n k = 0 | _, 0, hk => absurd hk (Nat.not_lt_zero _) | 0, k + 1, _ => choose_zero_succ _ | n + 1, k + 1, hk => by have hnk : n < k := lt_of_succ_lt_succ hk have hnk1 : n < k + 1 := lt_of_succ_lt hk rw [choose_succ_succ, choose_eq_zero_of_lt hnk, choose_eq_zero_of_lt hnk1] #align nat.choose_eq_zero_of_lt Nat.choose_eq_zero_of_lt @[simp]
Mathlib/Data/Nat/Choose/Basic.lean
79
80
theorem choose_self (n : ℕ) : choose n n = 1 := by
induction n <;> simp [*, choose, choose_eq_zero_of_lt (lt_succ_self _)]
import Mathlib.Algebra.Order.Archimedean import Mathlib.Topology.Algebra.InfiniteSum.NatInt import Mathlib.Topology.Algebra.Order.Field import Mathlib.Topology.Order.MonotoneConvergence #align_import topology.algebra.infinite_sum.order from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514" open Finset Filter Function open scoped Classical variable {ι κ α : Type*} section OrderedCommMonoid variable [OrderedCommMonoid α] [TopologicalSpace α] [OrderClosedTopology α] {f g : ι → α} {a a₁ a₂ : α} @[to_additive] theorem hasProd_le (h : ∀ i, f i ≤ g i) (hf : HasProd f a₁) (hg : HasProd g a₂) : a₁ ≤ a₂ := le_of_tendsto_of_tendsto' hf hg fun _ ↦ prod_le_prod' fun i _ ↦ h i #align has_sum_le hasSum_le @[to_additive (attr := mono)] theorem hasProd_mono (hf : HasProd f a₁) (hg : HasProd g a₂) (h : f ≤ g) : a₁ ≤ a₂ := hasProd_le h hf hg #align has_sum_mono hasSum_mono @[to_additive] theorem hasProd_le_of_prod_le (hf : HasProd f a) (h : ∀ s, ∏ i ∈ s, f i ≤ a₂) : a ≤ a₂ := le_of_tendsto' hf h #align has_sum_le_of_sum_le hasSum_le_of_sum_le @[to_additive] theorem le_hasProd_of_le_prod (hf : HasProd f a) (h : ∀ s, a₂ ≤ ∏ i ∈ s, f i) : a₂ ≤ a := ge_of_tendsto' hf h #align le_has_sum_of_le_sum le_hasSum_of_le_sum @[to_additive]
Mathlib/Topology/Algebra/InfiniteSum/Order.lean
65
74
theorem hasProd_le_inj {g : κ → α} (e : ι → κ) (he : Injective e) (hs : ∀ c, c ∉ Set.range e → 1 ≤ g c) (h : ∀ i, f i ≤ g (e i)) (hf : HasProd f a₁) (hg : HasProd g a₂) : a₁ ≤ a₂ := by
rw [← hasProd_extend_one he] at hf refine hasProd_le (fun c ↦ ?_) hf hg obtain ⟨i, rfl⟩ | h := em (c ∈ Set.range e) · rw [he.extend_apply] exact h _ · rw [extend_apply' _ _ _ h] exact hs _ h
import Mathlib.Algebra.QuadraticDiscriminant import Mathlib.Analysis.Convex.SpecificFunctions.Deriv import Mathlib.Analysis.SpecialFunctions.Pow.Complex #align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section namespace Complex open Set Filter open scoped Real
Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean
32
40
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul, add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub] ring_nf rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm] refine exists_congr fun x => ?_ refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero) field_simp; ring
import Mathlib.CategoryTheory.Limits.KanExtension import Mathlib.Topology.Category.TopCat.Opens import Mathlib.CategoryTheory.Adjunction.Unique import Mathlib.Topology.Sheaves.Init import Mathlib.Data.Set.Subsingleton #align_import topology.sheaves.presheaf from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" set_option autoImplicit true universe w v u open CategoryTheory TopologicalSpace Opposite variable (C : Type u) [Category.{v} C] namespace TopCat -- Porting note(#5171): was @[nolint has_nonempty_instance] def Presheaf (X : TopCat.{w}) : Type max u v w := (Opens X)ᵒᵖ ⥤ C set_option linter.uppercaseLean3 false in #align Top.presheaf TopCat.Presheaf instance (X : TopCat.{w}) : Category (Presheaf.{w, v, u} C X) := inferInstanceAs (Category ((Opens X)ᵒᵖ ⥤ C : Type max u v w)) variable {C} namespace Presheaf @[simp] theorem comp_app {P Q R : Presheaf C X} (f : P ⟶ Q) (g : Q ⟶ R) : (f ≫ g).app U = f.app U ≫ g.app U := rfl -- Porting note (#10756): added an `ext` lemma, -- since `NatTrans.ext` can not see through the definition of `Presheaf`. -- See https://github.com/leanprover-community/mathlib4/issues/5229 @[ext] lemma ext {P Q : Presheaf C X} {f g : P ⟶ Q} (w : ∀ U : Opens X, f.app (op U) = g.app (op U)) : f = g := by apply NatTrans.ext ext U induction U with | _ U => ?_ apply w attribute [local instance] CategoryTheory.ConcreteCategory.hasCoeToSort CategoryTheory.ConcreteCategory.instFunLike macro "sheaf_restrict" : attr => `(attr|aesop safe 50 apply (rule_sets := [$(Lean.mkIdent `Restrict):ident])) attribute [sheaf_restrict] bot_le le_top le_refl inf_le_left inf_le_right le_sup_left le_sup_right macro (name := restrict_tac) "restrict_tac" c:Aesop.tactic_clause* : tactic => `(tactic| first | assumption | aesop $c* (config := { terminal := true assumptionTransparency := .reducible enableSimp := false }) (rule_sets := [-default, -builtin, $(Lean.mkIdent `Restrict):ident])) macro (name := restrict_tac?) "restrict_tac?" c:Aesop.tactic_clause* : tactic => `(tactic| aesop? $c* (config := { terminal := true assumptionTransparency := .reducible enableSimp := false maxRuleApplications := 300 }) (rule_sets := [-default, -builtin, $(Lean.mkIdent `Restrict):ident])) attribute[aesop 10% (rule_sets := [Restrict])] le_trans attribute[aesop safe destruct (rule_sets := [Restrict])] Eq.trans_le attribute[aesop safe -50 (rule_sets := [Restrict])] Aesop.BuiltinRules.assumption example {X} [CompleteLattice X] (v : Nat → X) (w x y z : X) (e : v 0 = v 1) (_ : v 1 = v 2) (h₀ : v 1 ≤ x) (_ : x ≤ z ⊓ w) (h₂ : x ≤ y ⊓ z) : v 0 ≤ y := by restrict_tac def restrict {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {V : Opens X} (x : F.obj (op V)) {U : Opens X} (h : U ⟶ V) : F.obj (op U) := F.map h.op x set_option linter.uppercaseLean3 false in #align Top.presheaf.restrict TopCat.Presheaf.restrict scoped[AlgebraicGeometry] infixl:80 " |_ₕ " => TopCat.Presheaf.restrict scoped[AlgebraicGeometry] notation:80 x " |_ₗ " U " ⟪" e "⟫ " => @TopCat.Presheaf.restrict _ _ _ _ _ _ x U (@homOfLE (Opens _) _ U _ e) open AlgebraicGeometry abbrev restrictOpen {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {V : Opens X} (x : F.obj (op V)) (U : Opens X) (e : U ≤ V := by restrict_tac) : F.obj (op U) := x |_ₗ U ⟪e⟫ set_option linter.uppercaseLean3 false in #align Top.presheaf.restrict_open TopCat.Presheaf.restrictOpen scoped[AlgebraicGeometry] infixl:80 " |_ " => TopCat.Presheaf.restrictOpen -- Porting note: linter tells this lemma is no going to be picked up by the simplifier, hence -- `@[simp]` is removed
Mathlib/Topology/Sheaves/Presheaf.lean
143
148
theorem restrict_restrict {X : TopCat} {C : Type*} [Category C] [ConcreteCategory C] {F : X.Presheaf C} {U V W : Opens X} (e₁ : U ≤ V) (e₂ : V ≤ W) (x : F.obj (op W)) : x |_ V |_ U = x |_ U := by
delta restrictOpen restrict rw [← comp_apply, ← Functor.map_comp] rfl
import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.degree.lemmas from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f" noncomputable section open Polynomial open Finsupp Finset namespace Polynomial universe u v w variable {R : Type u} {S : Type v} {ι : Type w} {a b : R} {m n : ℕ} section Semiring variable [Semiring R] {p q r : R[X]} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} {a : R} theorem degree_mul_C (a0 : a ≠ 0) : (p * C a).degree = p.degree := by rw [degree_mul, degree_C a0, add_zero] set_option linter.uppercaseLean3 false in #align polynomial.degree_mul_C Polynomial.degree_mul_C theorem degree_C_mul (a0 : a ≠ 0) : (C a * p).degree = p.degree := by rw [degree_mul, degree_C a0, zero_add] set_option linter.uppercaseLean3 false in #align polynomial.degree_C_mul Polynomial.degree_C_mul theorem natDegree_mul_C (a0 : a ≠ 0) : (p * C a).natDegree = p.natDegree := by simp only [natDegree, degree_mul_C a0] set_option linter.uppercaseLean3 false in #align polynomial.natDegree_mul_C Polynomial.natDegree_mul_C
Mathlib/Algebra/Polynomial/Degree/Lemmas.lean
371
372
theorem natDegree_C_mul (a0 : a ≠ 0) : (C a * p).natDegree = p.natDegree := by
simp only [natDegree, degree_C_mul a0]
import Mathlib.Tactic.Ring #align_import algebra.group_power.identities from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" variable {R : Type*} [CommRing R] {a b x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ y₁ y₂ y₃ y₄ y₅ y₆ y₇ y₈ n : R} theorem sq_add_sq_mul_sq_add_sq : (x₁ ^ 2 + x₂ ^ 2) * (y₁ ^ 2 + y₂ ^ 2) = (x₁ * y₁ - x₂ * y₂) ^ 2 + (x₁ * y₂ + x₂ * y₁) ^ 2 := by ring #align sq_add_sq_mul_sq_add_sq sq_add_sq_mul_sq_add_sq theorem sq_add_mul_sq_mul_sq_add_mul_sq : (x₁ ^ 2 + n * x₂ ^ 2) * (y₁ ^ 2 + n * y₂ ^ 2) = (x₁ * y₁ - n * x₂ * y₂) ^ 2 + n * (x₁ * y₂ + x₂ * y₁) ^ 2 := by ring #align sq_add_mul_sq_mul_sq_add_mul_sq sq_add_mul_sq_mul_sq_add_mul_sq theorem pow_four_add_four_mul_pow_four : a ^ 4 + 4 * b ^ 4 = ((a - b) ^ 2 + b ^ 2) * ((a + b) ^ 2 + b ^ 2) := by ring #align pow_four_add_four_mul_pow_four pow_four_add_four_mul_pow_four theorem pow_four_add_four_mul_pow_four' : a ^ 4 + 4 * b ^ 4 = (a ^ 2 - 2 * a * b + 2 * b ^ 2) * (a ^ 2 + 2 * a * b + 2 * b ^ 2) := by ring #align pow_four_add_four_mul_pow_four' pow_four_add_four_mul_pow_four' theorem sum_four_sq_mul_sum_four_sq : (x₁ ^ 2 + x₂ ^ 2 + x₃ ^ 2 + x₄ ^ 2) * (y₁ ^ 2 + y₂ ^ 2 + y₃ ^ 2 + y₄ ^ 2) = (x₁ * y₁ - x₂ * y₂ - x₃ * y₃ - x₄ * y₄) ^ 2 + (x₁ * y₂ + x₂ * y₁ + x₃ * y₄ - x₄ * y₃) ^ 2 + (x₁ * y₃ - x₂ * y₄ + x₃ * y₁ + x₄ * y₂) ^ 2 + (x₁ * y₄ + x₂ * y₃ - x₃ * y₂ + x₄ * y₁) ^ 2 := by ring #align sum_four_sq_mul_sum_four_sq sum_four_sq_mul_sum_four_sq
Mathlib/Algebra/Ring/Identities.lean
67
78
theorem sum_eight_sq_mul_sum_eight_sq : (x₁ ^ 2 + x₂ ^ 2 + x₃ ^ 2 + x₄ ^ 2 + x₅ ^ 2 + x₆ ^ 2 + x₇ ^ 2 + x₈ ^ 2) * (y₁ ^ 2 + y₂ ^ 2 + y₃ ^ 2 + y₄ ^ 2 + y₅ ^ 2 + y₆ ^ 2 + y₇ ^ 2 + y₈ ^ 2) = (x₁ * y₁ - x₂ * y₂ - x₃ * y₃ - x₄ * y₄ - x₅ * y₅ - x₆ * y₆ - x₇ * y₇ - x₈ * y₈) ^ 2 + (x₁ * y₂ + x₂ * y₁ + x₃ * y₄ - x₄ * y₃ + x₅ * y₆ - x₆ * y₅ - x₇ * y₈ + x₈ * y₇) ^ 2 + (x₁ * y₃ - x₂ * y₄ + x₃ * y₁ + x₄ * y₂ + x₅ * y₇ + x₆ * y₈ - x₇ * y₅ - x₈ * y₆) ^ 2 + (x₁ * y₄ + x₂ * y₃ - x₃ * y₂ + x₄ * y₁ + x₅ * y₈ - x₆ * y₇ + x₇ * y₆ - x₈ * y₅) ^ 2 + (x₁ * y₅ - x₂ * y₆ - x₃ * y₇ - x₄ * y₈ + x₅ * y₁ + x₆ * y₂ + x₇ * y₃ + x₈ * y₄) ^ 2 + (x₁ * y₆ + x₂ * y₅ - x₃ * y₈ + x₄ * y₇ - x₅ * y₂ + x₆ * y₁ - x₇ * y₄ + x₈ * y₃) ^ 2 + (x₁ * y₇ + x₂ * y₈ + x₃ * y₅ - x₄ * y₆ - x₅ * y₃ + x₆ * y₄ + x₇ * y₁ - x₈ * y₂) ^ 2 + (x₁ * y₈ - x₂ * y₇ + x₃ * y₆ + x₄ * y₅ - x₅ * y₄ - x₆ * y₃ + x₇ * y₂ + x₈ * y₁) ^ 2 := by
ring
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 Measure variable [∀ i, MeasurableSpace (α i)] (μ : ∀ i, Measure (α i)) section Tprod open List variable {δ : Type*} {π : δ → Type*} [∀ x, MeasurableSpace (π x)] -- for some reason the equation compiler doesn't like this definition protected def tprod (l : List δ) (μ : ∀ i, Measure (π i)) : Measure (TProd π l) := by induction' l with i l ih · exact dirac PUnit.unit · have := (μ i).prod (α := π i) ih exact this #align measure_theory.measure.tprod MeasureTheory.Measure.tprod @[simp] theorem tprod_nil (μ : ∀ i, Measure (π i)) : Measure.tprod [] μ = dirac PUnit.unit := rfl #align measure_theory.measure.tprod_nil MeasureTheory.Measure.tprod_nil @[simp] theorem tprod_cons (i : δ) (l : List δ) (μ : ∀ i, Measure (π i)) : Measure.tprod (i :: l) μ = (μ i).prod (Measure.tprod l μ) := rfl #align measure_theory.measure.tprod_cons MeasureTheory.Measure.tprod_cons instance sigmaFinite_tprod (l : List δ) (μ : ∀ i, Measure (π i)) [∀ i, SigmaFinite (μ i)] : SigmaFinite (Measure.tprod l μ) := by induction l with | nil => rw [tprod_nil]; infer_instance | cons i l ih => rw [tprod_cons]; exact @prod.instSigmaFinite _ _ _ _ _ _ _ ih #align measure_theory.measure.sigma_finite_tprod MeasureTheory.Measure.sigmaFinite_tprod
Mathlib/MeasureTheory/Constructions/Pi.lean
252
260
theorem tprod_tprod (l : List δ) (μ : ∀ i, Measure (π i)) [∀ i, SigmaFinite (μ i)] (s : ∀ i, Set (π i)) : Measure.tprod l μ (Set.tprod l s) = (l.map fun i => (μ i) (s i)).prod := by
induction l with | nil => simp | cons a l ih => rw [tprod_cons, Set.tprod] erw [prod_prod] -- TODO: why `rw` fails? rw [map_cons, prod_cons, ih]
import Mathlib.RingTheory.JacobsonIdeal #align_import ring_theory.nakayama from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] open Ideal namespace Submodule
Mathlib/RingTheory/Nakayama.lean
52
61
theorem eq_smul_of_le_smul_of_le_jacobson {I J : Ideal R} {N : Submodule R M} (hN : N.FG) (hIN : N ≤ I • N) (hIjac : I ≤ jacobson J) : N = J • N := by
refine le_antisymm ?_ (Submodule.smul_le.2 fun _ _ _ => Submodule.smul_mem _ _) intro n hn cases' Submodule.exists_sub_one_mem_and_smul_eq_zero_of_fg_of_le_smul I N hN hIN with r hr cases' exists_mul_sub_mem_of_sub_one_mem_jacobson r (hIjac hr.1) with s hs have : n = -(s * r - 1) • n := by rw [neg_sub, sub_smul, mul_smul, hr.2 n hn, one_smul, smul_zero, sub_zero] rw [this] exact Submodule.smul_mem_smul (Submodule.neg_mem _ hs) hn
import Mathlib.Combinatorics.Quiver.Cast import Mathlib.Combinatorics.Quiver.Symmetric import Mathlib.Data.Sigma.Basic import Mathlib.Logic.Equiv.Basic import Mathlib.Tactic.Common #align_import combinatorics.quiver.covering from "leanprover-community/mathlib"@"188a411e916e1119e502dbe35b8b475716362401" open Function Quiver universe u v w variable {U : Type _} [Quiver.{u + 1} U] {V : Type _} [Quiver.{v + 1} V] (φ : U ⥤q V) {W : Type _} [Quiver.{w + 1} W] (ψ : V ⥤q W) abbrev Quiver.Star (u : U) := Σ v : U, u ⟶ v #align quiver.star Quiver.Star protected abbrev Quiver.Star.mk {u v : U} (f : u ⟶ v) : Quiver.Star u := ⟨_, f⟩ #align quiver.star.mk Quiver.Star.mk abbrev Quiver.Costar (v : U) := Σ u : U, u ⟶ v #align quiver.costar Quiver.Costar protected abbrev Quiver.Costar.mk {u v : U} (f : u ⟶ v) : Quiver.Costar v := ⟨_, f⟩ #align quiver.costar.mk Quiver.Costar.mk @[simps] def Prefunctor.star (u : U) : Quiver.Star u → Quiver.Star (φ.obj u) := fun F => Quiver.Star.mk (φ.map F.2) #align prefunctor.star Prefunctor.star @[simps] def Prefunctor.costar (u : U) : Quiver.Costar u → Quiver.Costar (φ.obj u) := fun F => Quiver.Costar.mk (φ.map F.2) #align prefunctor.costar Prefunctor.costar @[simp] theorem Prefunctor.star_apply {u v : U} (e : u ⟶ v) : φ.star u (Quiver.Star.mk e) = Quiver.Star.mk (φ.map e) := rfl #align prefunctor.star_apply Prefunctor.star_apply @[simp] theorem Prefunctor.costar_apply {u v : U} (e : u ⟶ v) : φ.costar v (Quiver.Costar.mk e) = Quiver.Costar.mk (φ.map e) := rfl #align prefunctor.costar_apply Prefunctor.costar_apply theorem Prefunctor.star_comp (u : U) : (φ ⋙q ψ).star u = ψ.star (φ.obj u) ∘ φ.star u := rfl #align prefunctor.star_comp Prefunctor.star_comp theorem Prefunctor.costar_comp (u : U) : (φ ⋙q ψ).costar u = ψ.costar (φ.obj u) ∘ φ.costar u := rfl #align prefunctor.costar_comp Prefunctor.costar_comp protected structure Prefunctor.IsCovering : Prop where star_bijective : ∀ u, Bijective (φ.star u) costar_bijective : ∀ u, Bijective (φ.costar u) #align prefunctor.is_covering Prefunctor.IsCovering @[simp]
Mathlib/Combinatorics/Quiver/Covering.lean
114
118
theorem Prefunctor.IsCovering.map_injective (hφ : φ.IsCovering) {u v : U} : Injective fun f : u ⟶ v => φ.map f := by
rintro f g he have : φ.star u (Quiver.Star.mk f) = φ.star u (Quiver.Star.mk g) := by simpa using he simpa using (hφ.star_bijective u).left this
import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Star.Pi #align_import algebra.star.self_adjoint from "leanprover-community/mathlib"@"a6ece35404f60597c651689c1b46ead86de5ac1b" open Function variable {R A : Type*} def IsSelfAdjoint [Star R] (x : R) : Prop := star x = x #align is_self_adjoint IsSelfAdjoint @[mk_iff] class IsStarNormal [Mul R] [Star R] (x : R) : Prop where star_comm_self : Commute (star x) x #align is_star_normal IsStarNormal export IsStarNormal (star_comm_self) theorem star_comm_self' [Mul R] [Star R] (x : R) [IsStarNormal x] : star x * x = x * star x := IsStarNormal.star_comm_self #align star_comm_self' star_comm_self' namespace IsSelfAdjoint -- named to match `Commute.allₓ` theorem all [Star R] [TrivialStar R] (r : R) : IsSelfAdjoint r := star_trivial _ #align is_self_adjoint.all IsSelfAdjoint.all theorem star_eq [Star R] {x : R} (hx : IsSelfAdjoint x) : star x = x := hx #align is_self_adjoint.star_eq IsSelfAdjoint.star_eq theorem _root_.isSelfAdjoint_iff [Star R] {x : R} : IsSelfAdjoint x ↔ star x = x := Iff.rfl #align is_self_adjoint_iff isSelfAdjoint_iff @[simp] theorem star_iff [InvolutiveStar R] {x : R} : IsSelfAdjoint (star x) ↔ IsSelfAdjoint x := by simpa only [IsSelfAdjoint, star_star] using eq_comm #align is_self_adjoint.star_iff IsSelfAdjoint.star_iff @[simp] theorem star_mul_self [Mul R] [StarMul R] (x : R) : IsSelfAdjoint (star x * x) := by simp only [IsSelfAdjoint, star_mul, star_star] #align is_self_adjoint.star_mul_self IsSelfAdjoint.star_mul_self @[simp] theorem mul_star_self [Mul R] [StarMul R] (x : R) : IsSelfAdjoint (x * star x) := by simpa only [star_star] using star_mul_self (star x) #align is_self_adjoint.mul_star_self IsSelfAdjoint.mul_star_self lemma commute_iff {R : Type*} [Mul R] [StarMul R] {x y : R} (hx : IsSelfAdjoint x) (hy : IsSelfAdjoint y) : Commute x y ↔ IsSelfAdjoint (x * y) := by refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ · rw [isSelfAdjoint_iff, star_mul, hx.star_eq, hy.star_eq, h.eq] · simpa only [star_mul, hx.star_eq, hy.star_eq] using h.symm theorem starHom_apply {F R S : Type*} [Star R] [Star S] [FunLike F R S] [StarHomClass F R S] {x : R} (hx : IsSelfAdjoint x) (f : F) : IsSelfAdjoint (f x) := show star (f x) = f x from map_star f x ▸ congr_arg f hx #align is_self_adjoint.star_hom_apply IsSelfAdjoint.starHom_apply theorem _root_.isSelfAdjoint_starHom_apply {F R S : Type*} [Star R] [Star S] [FunLike F R S] [StarHomClass F R S] [TrivialStar R] (f : F) (x : R) : IsSelfAdjoint (f x) := (IsSelfAdjoint.all x).starHom_apply f section SMul variable [Star R] [AddMonoid A] [StarAddMonoid A] [SMul R A] [StarModule R A]
Mathlib/Algebra/Star/SelfAdjoint.lean
290
291
theorem smul {r : R} (hr : IsSelfAdjoint r) {x : A} (hx : IsSelfAdjoint x) : IsSelfAdjoint (r • x) := by
simp only [isSelfAdjoint_iff, star_smul, hr.star_eq, hx.star_eq]
import Mathlib.Order.Lattice import Mathlib.Data.List.Sort import Mathlib.Logic.Equiv.Fin import Mathlib.Logic.Equiv.Functor import Mathlib.Data.Fintype.Card import Mathlib.Order.RelSeries #align_import order.jordan_holder from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada" universe u open Set RelSeries class JordanHolderLattice (X : Type u) [Lattice X] where IsMaximal : X → X → Prop lt_of_isMaximal : ∀ {x y}, IsMaximal x y → x < y sup_eq_of_isMaximal : ∀ {x y z}, IsMaximal x z → IsMaximal y z → x ≠ y → x ⊔ y = z isMaximal_inf_left_of_isMaximal_sup : ∀ {x y}, IsMaximal x (x ⊔ y) → IsMaximal y (x ⊔ y) → IsMaximal (x ⊓ y) x Iso : X × X → X × X → Prop iso_symm : ∀ {x y}, Iso x y → Iso y x iso_trans : ∀ {x y z}, Iso x y → Iso y z → Iso x z second_iso : ∀ {x y}, IsMaximal x (x ⊔ y) → Iso (x, x ⊔ y) (x ⊓ y, y) #align jordan_holder_lattice JordanHolderLattice open JordanHolderLattice attribute [symm] iso_symm attribute [trans] iso_trans abbrev CompositionSeries (X : Type u) [Lattice X] [JordanHolderLattice X] : Type u := RelSeries (IsMaximal (X := X)) #align composition_series CompositionSeries namespace CompositionSeries variable {X : Type u} [Lattice X] [JordanHolderLattice X] #noalign composition_series.has_coe_to_fun #align composition_series.has_inhabited RelSeries.instInhabited #align composition_series.step RelSeries.membership theorem lt_succ (s : CompositionSeries X) (i : Fin s.length) : s (Fin.castSucc i) < s (Fin.succ i) := lt_of_isMaximal (s.step _) #align composition_series.lt_succ CompositionSeries.lt_succ protected theorem strictMono (s : CompositionSeries X) : StrictMono s := Fin.strictMono_iff_lt_succ.2 s.lt_succ #align composition_series.strict_mono CompositionSeries.strictMono protected theorem injective (s : CompositionSeries X) : Function.Injective s := s.strictMono.injective #align composition_series.injective CompositionSeries.injective @[simp] protected theorem inj (s : CompositionSeries X) {i j : Fin s.length.succ} : s i = s j ↔ i = j := s.injective.eq_iff #align composition_series.inj CompositionSeries.inj #align composition_series.has_mem RelSeries.membership #align composition_series.mem_def RelSeries.mem_def
Mathlib/Order/JordanHolder.lean
173
177
theorem total {s : CompositionSeries X} {x y : X} (hx : x ∈ s) (hy : y ∈ s) : x ≤ y ∨ y ≤ x := by
rcases Set.mem_range.1 hx with ⟨i, rfl⟩ rcases Set.mem_range.1 hy with ⟨j, rfl⟩ rw [s.strictMono.le_iff_le, s.strictMono.le_iff_le] exact le_total i j
import Mathlib.Algebra.Module.Submodule.Ker #align_import linear_algebra.basic from "leanprover-community/mathlib"@"9d684a893c52e1d6692a504a118bfccbae04feeb" variable {R : Type*} {R₂ : Type*} variable {M : Type*} {M₂ : Type*} namespace LinearMap section AddCommMonoid variable [Semiring R] [Semiring R₂] variable [AddCommMonoid M] [AddCommMonoid M₂] variable [Module R M] [Module R₂ M₂] open Submodule variable {τ₁₂ : R →+* R₂} section variable {F : Type*} [FunLike F M M₂] [SemilinearMapClass F τ₁₂ M M₂] def eqLocus (f g : F) : Submodule R M := { (f : M →+ M₂).eqLocusM g with carrier := { x | f x = g x } smul_mem' := fun {r} {x} (hx : _ = _) => show _ = _ by -- Note: #8386 changed `map_smulₛₗ` into `map_smulₛₗ _` simpa only [map_smulₛₗ _] using congr_arg (τ₁₂ r • ·) hx } #align linear_map.eq_locus LinearMap.eqLocus @[simp] theorem mem_eqLocus {x : M} {f g : F} : x ∈ eqLocus f g ↔ f x = g x := Iff.rfl #align linear_map.mem_eq_locus LinearMap.mem_eqLocus theorem eqLocus_toAddSubmonoid (f g : F) : (eqLocus f g).toAddSubmonoid = (f : M →+ M₂).eqLocusM g := rfl #align linear_map.eq_locus_to_add_submonoid LinearMap.eqLocus_toAddSubmonoid @[simp]
Mathlib/Algebra/Module/Submodule/EqLocus.lean
64
65
theorem eqLocus_eq_top {f g : F} : eqLocus f g = ⊤ ↔ f = g := by
simp [SetLike.ext_iff, DFunLike.ext_iff]
import Mathlib.Analysis.Quaternion import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series #align_import analysis.normed_space.quaternion_exponential from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" open scoped Quaternion Nat open NormedSpace namespace Quaternion @[simp, norm_cast] theorem exp_coe (r : ℝ) : exp ℝ (r : ℍ[ℝ]) = ↑(exp ℝ r) := (map_exp ℝ (algebraMap ℝ ℍ[ℝ]) (continuous_algebraMap _ _) _).symm #align quaternion.exp_coe Quaternion.exp_coe
Mathlib/Analysis/NormedSpace/QuaternionExponential.lean
39
55
theorem expSeries_even_of_imaginary {q : Quaternion ℝ} (hq : q.re = 0) (n : ℕ) : expSeries ℝ (Quaternion ℝ) (2 * n) (fun _ => q) = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / (2 * n)!) := by
rw [expSeries_apply_eq] have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq letI k : ℝ := ↑(2 * n)! calc k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2] _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_ _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_ · congr 1 rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq] push_cast rfl · rw [← coe_mul_eq_smul, div_eq_mul_inv] norm_cast ring_nf
import Mathlib.Analysis.RCLike.Basic import Mathlib.Analysis.NormedSpace.OperatorNorm.Basic import Mathlib.Analysis.NormedSpace.Pointwise #align_import analysis.normed_space.is_R_or_C from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b" open Metric variable {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] theorem RCLike.norm_coe_norm {z : E} : ‖(‖z‖ : 𝕜)‖ = ‖z‖ := by simp #align is_R_or_C.norm_coe_norm RCLike.norm_coe_norm variable [NormedSpace 𝕜 E] @[simp]
Mathlib/Analysis/NormedSpace/RCLike.lean
43
45
theorem norm_smul_inv_norm {x : E} (hx : x ≠ 0) : ‖(‖x‖⁻¹ : 𝕜) • x‖ = 1 := by
have : ‖x‖ ≠ 0 := by simp [hx] field_simp [norm_smul]
import Mathlib.Geometry.RingedSpace.PresheafedSpace import Mathlib.Topology.Category.TopCat.Limits.Basic import Mathlib.Topology.Sheaves.Limits import Mathlib.CategoryTheory.ConcreteCategory.Elementwise #align_import algebraic_geometry.presheafed_space.has_colimits from "leanprover-community/mathlib"@"178a32653e369dce2da68dc6b2694e385d484ef1" noncomputable section universe v' u' v u open CategoryTheory Opposite CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits TopCat TopCat.Presheaf TopologicalSpace variable {J : Type u'} [Category.{v'} J] {C : Type u} [Category.{v} C] namespace AlgebraicGeometry namespace PresheafedSpace attribute [local simp] eqToHom_map -- Porting note: we used to have: -- local attribute [tidy] tactic.auto_cases_opens -- We would replace this by: -- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens -- although it doesn't appear to help in this file, in any case. @[simp]
Mathlib/Geometry/RingedSpace/PresheafedSpace/HasColimits.lean
59
65
theorem map_id_c_app (F : J ⥤ PresheafedSpace.{_, _, v} C) (j) (U) : (F.map (𝟙 j)).c.app (op U) = (Pushforward.id (F.obj j).presheaf).inv.app (op U) ≫ (pushforwardEq (by simp) (F.obj j).presheaf).hom.app (op U) := by
cases U simp [PresheafedSpace.congr_app (F.map_id j)]
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Ring.Pi import Mathlib.GroupTheory.GroupAction.Pi #align_import algebra.big_operators.pi from "leanprover-community/mathlib"@"fa2309577c7009ea243cffdf990cd6c84f0ad497" @[to_additive (attr := simp)] theorem Finset.prod_apply {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (a : α) (s : Finset γ) (g : γ → ∀ a, β a) : (∏ c ∈ s, g c) a = ∏ c ∈ s, g c a := map_prod (Pi.evalMonoidHom β a) _ _ #align finset.prod_apply Finset.prod_apply #align finset.sum_apply Finset.sum_apply @[to_additive "An 'unapplied' analogue of `Finset.sum_apply`."] theorem Finset.prod_fn {α : Type*} {β : α → Type*} {γ} [∀ a, CommMonoid (β a)] (s : Finset γ) (g : γ → ∀ a, β a) : ∏ c ∈ s, g c = fun a ↦ ∏ c ∈ s, g c a := funext fun _ ↦ Finset.prod_apply _ _ _ #align finset.prod_fn Finset.prod_fn #align finset.sum_fn Finset.sum_fn @[to_additive] theorem Fintype.prod_apply {α : Type*} {β : α → Type*} {γ : Type*} [Fintype γ] [∀ a, CommMonoid (β a)] (a : α) (g : γ → ∀ a, β a) : (∏ c, g c) a = ∏ c, g c a := Finset.prod_apply a Finset.univ g #align fintype.prod_apply Fintype.prod_apply #align fintype.sum_apply Fintype.sum_apply @[to_additive prod_mk_sum] theorem prod_mk_prod {α β γ : Type*} [CommMonoid α] [CommMonoid β] (s : Finset γ) (f : γ → α) (g : γ → β) : (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) := haveI := Classical.decEq γ Finset.induction_on s rfl (by simp (config := { contextual := true }) [Prod.ext_iff]) #align prod_mk_prod prod_mk_prod #align prod_mk_sum prod_mk_sum theorem pi_eq_sum_univ {ι : Type*} [Fintype ι] [DecidableEq ι] {R : Type*} [Semiring R] (x : ι → R) : x = ∑ i, (x i) • fun j => if i = j then (1 : R) else 0 := by ext simp #align pi_eq_sum_univ pi_eq_sum_univ section MulSingle variable {I : Type*} [DecidableEq I] {Z : I → Type*} variable [∀ i, CommMonoid (Z i)] @[to_additive]
Mathlib/Algebra/BigOperators/Pi.lean
81
84
theorem Finset.univ_prod_mulSingle [Fintype I] (f : ∀ i, Z i) : (∏ i, Pi.mulSingle i (f i)) = f := by
ext a simp
import Mathlib.Dynamics.Ergodic.MeasurePreserving import Mathlib.LinearAlgebra.Determinant import Mathlib.LinearAlgebra.Matrix.Diagonal import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.MeasureTheory.Group.LIntegral import Mathlib.MeasureTheory.Integral.Marginal import Mathlib.MeasureTheory.Measure.Stieltjes import Mathlib.MeasureTheory.Measure.Haar.OfBasis #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral noncomputable section open scoped Classical open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ENNReal (ofReal) open scoped ENNReal NNReal Topology namespace Real variable {ι : Type*} [Fintype ι] theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by haveI : IsAddLeftInvariant StieltjesFunction.id.measure := ⟨fun a => Eq.symm <| Real.measure_ext_Ioo_rat fun p q => by simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo, sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim, StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩ have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1 rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;> simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero, StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one] conv_rhs => rw [addHaarMeasure_unique StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A] simp only [volume, Basis.addHaar, one_smul] #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by simp [volume_eq_stieltjes_id] #align real.volume_val Real.volume_val @[simp] theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ico Real.volume_Ico @[simp] theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Icc Real.volume_Icc @[simp] theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioo Real.volume_Ioo @[simp] theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val] #align real.volume_Ioc Real.volume_Ioc -- @[simp] -- Porting note (#10618): simp can prove this theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val] #align real.volume_singleton Real.volume_singleton -- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628 theorem volume_univ : volume (univ : Set ℝ) = ∞ := ENNReal.eq_top_of_forall_nnreal_le fun r => calc (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp _ ≤ volume univ := measure_mono (subset_univ _) #align real.volume_univ Real.volume_univ @[simp] theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul] #align real.volume_ball Real.volume_ball @[simp]
Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
113
114
theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul]
import Mathlib.MeasureTheory.Group.Measure import Mathlib.MeasureTheory.Integral.IntegrableOn import Mathlib.MeasureTheory.Function.LocallyIntegrable open Asymptotics MeasureTheory Set Filter variable {α E F : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : α → F} {a b : α} {μ : Measure α} {l : Filter α} theorem _root_.Asymptotics.IsBigO.integrableAtFilter [IsMeasurablyGenerated l] (hf : f =O[l] g) (hfm : StronglyMeasurableAtFilter f l μ) (hg : IntegrableAtFilter g l μ) : IntegrableAtFilter f l μ := by obtain ⟨C, hC⟩ := hf.bound obtain ⟨s, hsl, hsm, hfg, hf, hg⟩ := (hC.smallSets.and <| hfm.eventually.and hg.eventually).exists_measurable_mem_of_smallSets refine ⟨s, hsl, (hg.norm.const_mul C).mono hf ?_⟩ refine (ae_restrict_mem hsm).mono fun x hx ↦ ?_ exact (hfg x hx).trans (le_abs_self _) theorem _root_.Asymptotics.IsBigO.integrable (hfm : AEStronglyMeasurable f μ) (hf : f =O[⊤] g) (hg : Integrable g μ) : Integrable f μ := by rewrite [← integrableAtFilter_top] at * exact hf.integrableAtFilter ⟨univ, univ_mem, hfm.restrict⟩ hg variable [TopologicalSpace α] [SecondCountableTopology α] namespace MeasureTheory theorem LocallyIntegrable.integrable_of_isBigO_cocompact [IsMeasurablyGenerated (cocompact α)] (hf : LocallyIntegrable f μ) (ho : f =O[cocompact α] g) (hg : IntegrableAtFilter g (cocompact α) μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_cocompact.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter section LinearOrder variable [LinearOrder α] [CompactIccSpace α] {g' : α → F} theorem LocallyIntegrable.integrable_of_isBigO_atBot_atTop [IsMeasurablyGenerated (atBot (α := α))] [IsMeasurablyGenerated (atTop (α := α))] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) (ho' : f =O[atTop] g') (hg' : IntegrableAtFilter g' atTop μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_atBot_atTop.mpr ⟨⟨ho.integrableAtFilter ?_ hg, ho'.integrableAtFilter ?_ hg'⟩, hf⟩ all_goals exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter theorem LocallyIntegrableOn.integrableOn_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))] (hf : LocallyIntegrableOn f (Iic a) μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) : IntegrableOn f (Iic a) μ := by refine integrableOn_Iic_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact ⟨Iic a, Iic_mem_atBot a, hf.aestronglyMeasurable⟩ theorem LocallyIntegrableOn.integrableOn_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))] (hf : LocallyIntegrableOn f (Ici a) μ) (ho : f =O[atTop] g) (hg : IntegrableAtFilter g atTop μ) : IntegrableOn f (Ici a) μ := by refine integrableOn_Ici_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact ⟨Ici a, Ici_mem_atTop a, hf.aestronglyMeasurable⟩ theorem LocallyIntegrable.integrable_of_isBigO_atBot [IsMeasurablyGenerated (atBot (α := α))] [OrderTop α] (hf : LocallyIntegrable f μ) (ho : f =O[atBot] g) (hg : IntegrableAtFilter g atBot μ) : Integrable f μ := by refine integrable_iff_integrableAtFilter_atBot.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
Mathlib/MeasureTheory/Integral/Asymptotics.lean
105
109
theorem LocallyIntegrable.integrable_of_isBigO_atTop [IsMeasurablyGenerated (atTop (α := α))] [OrderBot α] (hf : LocallyIntegrable f μ) (ho : f =O[atTop] g) (hg : IntegrableAtFilter g atTop μ) : Integrable f μ := by
refine integrable_iff_integrableAtFilter_atTop.mpr ⟨ho.integrableAtFilter ?_ hg, hf⟩ exact hf.aestronglyMeasurable.stronglyMeasurableAtFilter
import Mathlib.Order.ConditionallyCompleteLattice.Basic import Mathlib.Data.Int.LeastGreatest #align_import data.int.conditionally_complete_order from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae" open Int noncomputable section open scoped Classical instance instConditionallyCompleteLinearOrder : ConditionallyCompleteLinearOrder ℤ where __ := instLinearOrder __ := LinearOrder.toLattice sSup s := if h : s.Nonempty ∧ BddAbove s then greatestOfBdd (Classical.choose h.2) (Classical.choose_spec h.2) h.1 else 0 sInf s := if h : s.Nonempty ∧ BddBelow s then leastOfBdd (Classical.choose h.2) (Classical.choose_spec h.2) h.1 else 0 le_csSup s n hs hns := by have : s.Nonempty ∧ BddAbove s := ⟨⟨n, hns⟩, hs⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact (greatestOfBdd _ _ _).2.2 n hns csSup_le s n hs hns := by have : s.Nonempty ∧ BddAbove s := ⟨hs, ⟨n, hns⟩⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact hns (greatestOfBdd _ (Classical.choose_spec this.2) _).2.1 csInf_le s n hs hns := by have : s.Nonempty ∧ BddBelow s := ⟨⟨n, hns⟩, hs⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact (leastOfBdd _ _ _).2.2 n hns le_csInf s n hs hns := by have : s.Nonempty ∧ BddBelow s := ⟨hs, ⟨n, hns⟩⟩ -- Porting note: this was `rw [dif_pos this]` simp only [this, and_self, dite_true, ge_iff_le] exact hns (leastOfBdd _ (Classical.choose_spec this.2) _).2.1 csSup_of_not_bddAbove := fun s hs ↦ by simp [hs] csInf_of_not_bddBelow := fun s hs ↦ by simp [hs] namespace Int -- Porting note: mathlib3 proof uses `convert dif_pos _ using 1` theorem csSup_eq_greatest_of_bdd {s : Set ℤ} [DecidablePred (· ∈ s)] (b : ℤ) (Hb : ∀ z ∈ s, z ≤ b) (Hinh : ∃ z : ℤ, z ∈ s) : sSup s = greatestOfBdd b Hb Hinh := by have : s.Nonempty ∧ BddAbove s := ⟨Hinh, b, Hb⟩ simp only [sSup, this, and_self, dite_true] convert (coe_greatestOfBdd_eq Hb (Classical.choose_spec (⟨b, Hb⟩ : BddAbove s)) Hinh).symm #align int.cSup_eq_greatest_of_bdd Int.csSup_eq_greatest_of_bdd @[simp] theorem csSup_empty : sSup (∅ : Set ℤ) = 0 := dif_neg (by simp) #align int.cSup_empty Int.csSup_empty theorem csSup_of_not_bdd_above {s : Set ℤ} (h : ¬BddAbove s) : sSup s = 0 := dif_neg (by simp [h]) #align int.cSup_of_not_bdd_above Int.csSup_of_not_bdd_above -- Porting note: mathlib3 proof uses `convert dif_pos _ using 1`
Mathlib/Data/Int/ConditionallyCompleteOrder.lean
78
82
theorem csInf_eq_least_of_bdd {s : Set ℤ} [DecidablePred (· ∈ s)] (b : ℤ) (Hb : ∀ z ∈ s, b ≤ z) (Hinh : ∃ z : ℤ, z ∈ s) : sInf s = leastOfBdd b Hb Hinh := by
have : s.Nonempty ∧ BddBelow s := ⟨Hinh, b, Hb⟩ simp only [sInf, this, and_self, dite_true] convert (coe_leastOfBdd_eq Hb (Classical.choose_spec (⟨b, Hb⟩ : BddBelow s)) Hinh).symm
import Mathlib.Analysis.Convex.Slope import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic.LinearCombination #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" open Real Set NNReal theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ rintro x y z - - hxy hyz trans exp y · have h1 : 0 < y - x := by linarith have h2 : x - y < 0 := by linarith rw [div_lt_iff h1] calc exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf _ = exp y * (1 - exp (x - y)) := by ring _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne] _ = exp y * (y - x) := by ring · have h1 : 0 < z - y := by linarith rw [lt_div_iff h1] calc exp y * (z - y) < exp y * (exp (z - y) - 1) := by gcongr _ * ?_ linarith [add_one_lt_exp h1.ne'] _ = exp (z - y) * exp y - exp y := by ring _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl #align strict_convex_on_exp strictConvexOn_exp theorem convexOn_exp : ConvexOn ℝ univ exp := strictConvexOn_exp.convexOn #align convex_on_exp convexOn_exp theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ)) intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz have hy : 0 < y := hx.trans hxy trans y⁻¹ · have h : 0 < z - y := by linarith rw [div_lt_iff h] have hyz' : 0 < z / y := by positivity have hyz'' : z / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne'] _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz'' _ = y⁻¹ * (z - y) := by field_simp · have h : 0 < y - x := by linarith rw [lt_div_iff h] have hxy' : 0 < x / y := by positivity have hxy'' : x / y ≠ 1 := by contrapose! h rw [div_eq_one_iff_eq hy.ne'] at h simp [h] calc y⁻¹ * (y - x) = 1 - x / y := by field_simp _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy''] _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne'] _ = log y - log x := by ring #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) : 1 + p * s < (1 + s) ^ p := by have hp' : 0 < p := zero_lt_one.trans hp rcases eq_or_lt_of_le hs with rfl | hs · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add] have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs rcases le_or_lt (1 + p * s) 0 with hs2 | hs2 · exact hs2.trans_lt (rpow_pos_of_pos hs1 _) have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs' rw [rpow_def_of_pos hs1, ← exp_log hs2] apply exp_strictMono cases' lt_or_gt_of_ne hs' with hs' hs' · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1 · rw [add_sub_cancel_left, log_one, sub_zero] · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp) · rw [← div_lt_iff hp', ← div_lt_div_right hs'] convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1 · rw [add_sub_cancel_left, div_div, log_one, sub_zero] · rw [add_sub_cancel_left, log_one, sub_zero] · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp) #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
Mathlib/Analysis/Convex/SpecificFunctions/Basic.lean
127
133
theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) : 1 + p * s ≤ (1 + s) ^ p := by
rcases eq_or_lt_of_le hp with (rfl | hp) · simp by_cases hs' : s = 0 · simp [hs'] exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
import Mathlib.Data.Set.Function import Mathlib.Logic.Relation import Mathlib.Logic.Pairwise #align_import data.set.pairwise.basic from "leanprover-community/mathlib"@"c4c2ed622f43768eff32608d4a0f8a6cec1c047d" open Function Order Set variable {α β γ ι ι' : Type*} {r p q : α → α → Prop} section Pairwise variable {f g : ι → α} {s t u : Set α} {a b : α} theorem pairwise_on_bool (hr : Symmetric r) {a b : α} : Pairwise (r on fun c => cond c a b) ↔ r a b := by simpa [Pairwise, Function.onFun] using @hr a b #align pairwise_on_bool pairwise_on_bool theorem pairwise_disjoint_on_bool [SemilatticeInf α] [OrderBot α] {a b : α} : Pairwise (Disjoint on fun c => cond c a b) ↔ Disjoint a b := pairwise_on_bool Disjoint.symm #align pairwise_disjoint_on_bool pairwise_disjoint_on_bool theorem Symmetric.pairwise_on [LinearOrder ι] (hr : Symmetric r) (f : ι → α) : Pairwise (r on f) ↔ ∀ ⦃m n⦄, m < n → r (f m) (f n) := ⟨fun h _m _n hmn => h hmn.ne, fun h _m _n hmn => hmn.lt_or_lt.elim (@h _ _) fun h' => hr (h h')⟩ #align symmetric.pairwise_on Symmetric.pairwise_on theorem pairwise_disjoint_on [SemilatticeInf α] [OrderBot α] [LinearOrder ι] (f : ι → α) : Pairwise (Disjoint on f) ↔ ∀ ⦃m n⦄, m < n → Disjoint (f m) (f n) := Symmetric.pairwise_on Disjoint.symm f #align pairwise_disjoint_on pairwise_disjoint_on theorem pairwise_disjoint_mono [SemilatticeInf α] [OrderBot α] (hs : Pairwise (Disjoint on f)) (h : g ≤ f) : Pairwise (Disjoint on g) := hs.mono fun i j hij => Disjoint.mono (h i) (h j) hij #align pairwise_disjoint.mono pairwise_disjoint_mono namespace Set theorem Pairwise.mono (h : t ⊆ s) (hs : s.Pairwise r) : t.Pairwise r := fun _x xt _y yt => hs (h xt) (h yt) #align set.pairwise.mono Set.Pairwise.mono theorem Pairwise.mono' (H : r ≤ p) (hr : s.Pairwise r) : s.Pairwise p := hr.imp H #align set.pairwise.mono' Set.Pairwise.mono' theorem pairwise_top (s : Set α) : s.Pairwise ⊤ := pairwise_of_forall s _ fun _ _ => trivial #align set.pairwise_top Set.pairwise_top protected theorem Subsingleton.pairwise (h : s.Subsingleton) (r : α → α → Prop) : s.Pairwise r := fun _x hx _y hy hne => (hne (h hx hy)).elim #align set.subsingleton.pairwise Set.Subsingleton.pairwise @[simp] theorem pairwise_empty (r : α → α → Prop) : (∅ : Set α).Pairwise r := subsingleton_empty.pairwise r #align set.pairwise_empty Set.pairwise_empty @[simp] theorem pairwise_singleton (a : α) (r : α → α → Prop) : Set.Pairwise {a} r := subsingleton_singleton.pairwise r #align set.pairwise_singleton Set.pairwise_singleton theorem pairwise_iff_of_refl [IsRefl α r] : s.Pairwise r ↔ ∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → r a b := forall₄_congr fun _ _ _ _ => or_iff_not_imp_left.symm.trans <| or_iff_right_of_imp of_eq #align set.pairwise_iff_of_refl Set.pairwise_iff_of_refl alias ⟨Pairwise.of_refl, _⟩ := pairwise_iff_of_refl #align set.pairwise.of_refl Set.Pairwise.of_refl
Mathlib/Data/Set/Pairwise/Basic.lean
100
109
theorem Nonempty.pairwise_iff_exists_forall [IsEquiv α r] {s : Set ι} (hs : s.Nonempty) : s.Pairwise (r on f) ↔ ∃ z, ∀ x ∈ s, r (f x) z := by
constructor · rcases hs with ⟨y, hy⟩ refine fun H => ⟨f y, fun x hx => ?_⟩ rcases eq_or_ne x y with (rfl | hne) · apply IsRefl.refl · exact H hx hy hne · rintro ⟨z, hz⟩ x hx y hy _ exact @IsTrans.trans α r _ (f x) z (f y) (hz _ hx) (IsSymm.symm _ _ <| hz _ hy)
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.IsConnected import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Conj universe w v u namespace CategoryTheory.Limits.Types variable (C : Type u) [Category.{v} C] def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1} @[simps] def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where pt := PUnit ι := { app := fun X => id } noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where desc s := s.ι.app Classical.ofNonempty fac s j := by ext ⟨⟩ apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit) intros X Y f exact congrFun (s.ι.naturality f).symm PUnit.unit uniq s m h := by ext ⟨⟩ simp [← h Classical.ofNonempty] instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) := ⟨_, isColimitPUnitCocone _⟩ instance instSubsingletonColimitPUnit [IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] : Subsingleton (colimit (constPUnitFunctor.{w} C)) where allEq a b := by obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit) exact fun c d f => colimit_sound f rfl noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] : colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} := IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C) theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j) (h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by induction h with | rel _ _ h => exact Zigzag.of_hom <| Exists.choose h | refl _ => exact Zigzag.refl _ | symm _ _ _ ih => exact zigzag_symmetric ih | trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
Mathlib/CategoryTheory/Limits/IsConnected.lean
97
104
theorem isConnected_iff_colimit_constPUnitFunctor_iso_pUnit [HasColimit (constPUnitFunctor.{w} C)] : IsConnected C ↔ Nonempty (colimit (constPUnitFunctor.{w} C) ≅ PUnit) := by
refine ⟨fun _ => ⟨colimitConstPUnitIsoPUnit.{w} C⟩, fun ⟨h⟩ => ?_⟩ have : Nonempty C := nonempty_of_nonempty_colimit <| Nonempty.map h.inv inferInstance refine zigzag_isConnected <| fun c d => ?_ refine zigzag_of_eqvGen_quot_rel _ (constPUnitFunctor C) ⟨c, PUnit.unit⟩ ⟨d, PUnit.unit⟩ ?_ exact colimit_eq <| h.toEquiv.injective rfl
import Mathlib.Analysis.NormedSpace.Exponential import Mathlib.Analysis.Matrix import Mathlib.LinearAlgebra.Matrix.ZPow import Mathlib.LinearAlgebra.Matrix.Hermitian import Mathlib.LinearAlgebra.Matrix.Symmetric import Mathlib.Topology.UniformSpace.Matrix #align_import analysis.normed_space.matrix_exponential from "leanprover-community/mathlib"@"1e3201306d4d9eb1fd54c60d7c4510ad5126f6f9" open scoped Matrix open NormedSpace -- For `exp`. variable (𝕂 : Type*) {m n p : Type*} {n' : m → Type*} {𝔸 : Type*} namespace Matrix section Topological section NormedComm variable [RCLike 𝕂] [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [∀ i, Fintype (n' i)] [∀ i, DecidableEq (n' i)] [NormedCommRing 𝔸] [NormedAlgebra 𝕂 𝔸] [CompleteSpace 𝔸]
Mathlib/Analysis/NormedSpace/MatrixExponential.lean
182
187
theorem exp_neg (A : Matrix m m 𝔸) : exp 𝕂 (-A) = (exp 𝕂 A)⁻¹ := by
rw [nonsing_inv_eq_ring_inverse] letI : SeminormedRing (Matrix m m 𝔸) := Matrix.linftyOpSemiNormedRing letI : NormedRing (Matrix m m 𝔸) := Matrix.linftyOpNormedRing letI : NormedAlgebra 𝕂 (Matrix m m 𝔸) := Matrix.linftyOpNormedAlgebra exact (Ring.inverse_exp _ A).symm
import Mathlib.Algebra.BigOperators.Group.List import Mathlib.Data.Vector.Defs import Mathlib.Data.List.Nodup import Mathlib.Data.List.OfFn import Mathlib.Data.List.InsertNth import Mathlib.Control.Applicative import Mathlib.Control.Traversable.Basic #align_import data.vector.basic from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" set_option autoImplicit true universe u variable {n : ℕ} namespace Vector variable {α : Type*} @[inherit_doc] infixr:67 " ::ᵥ " => Vector.cons attribute [simp] head_cons tail_cons instance [Inhabited α] : Inhabited (Vector α n) := ⟨ofFn default⟩ theorem toList_injective : Function.Injective (@toList α n) := Subtype.val_injective #align vector.to_list_injective Vector.toList_injective @[ext] theorem ext : ∀ {v w : Vector α n} (_ : ∀ m : Fin n, Vector.get v m = Vector.get w m), v = w | ⟨v, hv⟩, ⟨w, hw⟩, h => Subtype.eq (List.ext_get (by rw [hv, hw]) fun m hm _ => h ⟨m, hv ▸ hm⟩) #align vector.ext Vector.ext instance zero_subsingleton : Subsingleton (Vector α 0) := ⟨fun _ _ => Vector.ext fun m => Fin.elim0 m⟩ #align vector.zero_subsingleton Vector.zero_subsingleton @[simp] theorem cons_val (a : α) : ∀ v : Vector α n, (a ::ᵥ v).val = a :: v.val | ⟨_, _⟩ => rfl #align vector.cons_val Vector.cons_val #align vector.cons_head Vector.head_cons #align vector.cons_tail Vector.tail_cons theorem eq_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) : v = a ::ᵥ v' ↔ v.head = a ∧ v.tail = v' := ⟨fun h => h.symm ▸ ⟨head_cons a v', tail_cons a v'⟩, fun h => _root_.trans (cons_head_tail v).symm (by rw [h.1, h.2])⟩ #align vector.eq_cons_iff Vector.eq_cons_iff theorem ne_cons_iff (a : α) (v : Vector α n.succ) (v' : Vector α n) : v ≠ a ::ᵥ v' ↔ v.head ≠ a ∨ v.tail ≠ v' := by rw [Ne, eq_cons_iff a v v', not_and_or] #align vector.ne_cons_iff Vector.ne_cons_iff theorem exists_eq_cons (v : Vector α n.succ) : ∃ (a : α) (as : Vector α n), v = a ::ᵥ as := ⟨v.head, v.tail, (eq_cons_iff v.head v v.tail).2 ⟨rfl, rfl⟩⟩ #align vector.exists_eq_cons Vector.exists_eq_cons @[simp] theorem toList_ofFn : ∀ {n} (f : Fin n → α), toList (ofFn f) = List.ofFn f | 0, f => by rw [ofFn, List.ofFn_zero, toList, nil] | n + 1, f => by rw [ofFn, List.ofFn_succ, toList_cons, toList_ofFn] #align vector.to_list_of_fn Vector.toList_ofFn @[simp] theorem mk_toList : ∀ (v : Vector α n) (h), (⟨toList v, h⟩ : Vector α n) = v | ⟨_, _⟩, _ => rfl #align vector.mk_to_list Vector.mk_toList @[simp] theorem length_val (v : Vector α n) : v.val.length = n := v.2 -- Porting note: not used in mathlib and coercions done differently in Lean 4 -- @[simp] -- theorem length_coe (v : Vector α n) : -- ((coe : { l : List α // l.length = n } → List α) v).length = n := -- v.2 #noalign vector.length_coe @[simp] theorem toList_map {β : Type*} (v : Vector α n) (f : α → β) : (v.map f).toList = v.toList.map f := by cases v; rfl #align vector.to_list_map Vector.toList_map @[simp]
Mathlib/Data/Vector/Basic.lean
106
108
theorem head_map {β : Type*} (v : Vector α (n + 1)) (f : α → β) : (v.map f).head = f v.head := by
obtain ⟨a, v', h⟩ := Vector.exists_eq_cons v rw [h, map_cons, head_cons, head_cons]
import Mathlib.Algebra.Ring.Idempotents import Mathlib.RingTheory.Finiteness import Mathlib.Order.Basic #align_import ring_theory.ideal.idempotent_fg from "leanprover-community/mathlib"@"25cf7631da8ddc2d5f957c388bf5e4b25a77d8dc" namespace Ideal
Mathlib/RingTheory/Ideal/IdempotentFG.lean
20
35
theorem isIdempotentElem_iff_of_fg {R : Type*} [CommRing R] (I : Ideal R) (h : I.FG) : IsIdempotentElem I ↔ ∃ e : R, IsIdempotentElem e ∧ I = R ∙ e := by
constructor · intro e obtain ⟨r, hr, hr'⟩ := Submodule.exists_mem_and_smul_eq_self_of_fg_of_le_smul I I h (by rw [smul_eq_mul] exact e.ge) simp_rw [smul_eq_mul] at hr' refine ⟨r, hr' r hr, antisymm ?_ ((Submodule.span_singleton_le_iff_mem _ _).mpr hr)⟩ intro x hx rw [← hr' x hx] exact Ideal.mem_span_singleton'.mpr ⟨_, mul_comm _ _⟩ · rintro ⟨e, he, rfl⟩ simp [IsIdempotentElem, Ideal.span_singleton_mul_span_singleton, he.eq]
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section aleph def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) := @RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding #align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg def alephIdx : Cardinal → Ordinal := alephIdx.initialSeg #align cardinal.aleph_idx Cardinal.alephIdx @[simp] theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe @[simp] theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b := alephIdx.initialSeg.toRelEmbedding.map_rel_iff #align cardinal.aleph_idx_lt Cardinal.alephIdx_lt @[simp]
Mathlib/SetTheory/Cardinal/Ordinal.lean
111
112
theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by
rw [← not_lt, ← not_lt, alephIdx_lt]
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {α : Type u} class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le #align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`. @[to_additive "A choice-free shortcut instance."] theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (swap (· * ·)) (· ≤ ·) where elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹ #align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le #align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le section Group variable [Group α] section TypeclassesRightLE variable [LE α] [CovariantClass α α (swap (· * ·)) (· ≤ ·)] {a b c : α} @[to_additive (attr := simp) "Uses `right` co(ntra)variant."]
Mathlib/Algebra/Order/Group/Defs.lean
215
217
theorem Right.inv_le_one_iff : a⁻¹ ≤ 1 ↔ 1 ≤ a := by
rw [← mul_le_mul_iff_right a] simp
import Mathlib.Analysis.Calculus.FDeriv.Linear import Mathlib.Analysis.Calculus.FDeriv.Comp #align_import analysis.calculus.fderiv.prod from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40" 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 CartesianProduct section Pi variable {ι : Type*} [Fintype ι] {F' : ι → Type*} [∀ i, NormedAddCommGroup (F' i)] [∀ i, NormedSpace 𝕜 (F' i)] {φ : ∀ i, E → F' i} {φ' : ∀ i, E →L[𝕜] F' i} {Φ : E → ∀ i, F' i} {Φ' : E →L[𝕜] ∀ i, F' i} @[simp] theorem hasStrictFDerivAt_pi' : HasStrictFDerivAt Φ Φ' x ↔ ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x := by simp only [HasStrictFDerivAt, ContinuousLinearMap.coe_pi] exact isLittleO_pi #align has_strict_fderiv_at_pi' hasStrictFDerivAt_pi' @[fun_prop] theorem hasStrictFDerivAt_pi'' (hφ : ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x) : HasStrictFDerivAt Φ Φ' x := hasStrictFDerivAt_pi'.2 hφ @[fun_prop] theorem hasStrictFDerivAt_apply (i : ι) (f : ∀ i, F' i) : HasStrictFDerivAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) f := by let id' := ContinuousLinearMap.id 𝕜 (∀ i, F' i) have h := ((hasStrictFDerivAt_pi' (Φ := fun (f : ∀ i, F' i) (i' : ι) => f i') (Φ':=id') (x:=f))).1 have h' : comp (proj i) id' = proj i := by rfl rw [← h']; apply h; apply hasStrictFDerivAt_id @[simp 1100] -- Porting note: increased priority to make lint happy theorem hasStrictFDerivAt_pi : HasStrictFDerivAt (fun x i => φ i x) (ContinuousLinearMap.pi φ') x ↔ ∀ i, HasStrictFDerivAt (φ i) (φ' i) x := hasStrictFDerivAt_pi' #align has_strict_fderiv_at_pi hasStrictFDerivAt_pi @[simp]
Mathlib/Analysis/Calculus/FDeriv/Prod.lean
427
431
theorem hasFDerivAtFilter_pi' : HasFDerivAtFilter Φ Φ' x L ↔ ∀ i, HasFDerivAtFilter (fun x => Φ x i) ((proj i).comp Φ') x L := by
simp only [hasFDerivAtFilter_iff_isLittleO, ContinuousLinearMap.coe_pi] exact isLittleO_pi
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]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
83
87
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]
import Mathlib.Data.Set.Prod #align_import data.set.n_ary from "leanprover-community/mathlib"@"5e526d18cea33550268dcbbddcb822d5cde40654" open Function namespace Set variable {α α' β β' γ γ' δ δ' ε ε' ζ ζ' ν : Type*} {f f' : α → β → γ} {g g' : α → β → γ → δ} variable {s s' : Set α} {t t' : Set β} {u u' : Set γ} {v : Set δ} {a a' : α} {b b' : β} {c c' : γ} {d d' : δ} theorem mem_image2_iff (hf : Injective2 f) : f a b ∈ image2 f s t ↔ a ∈ s ∧ b ∈ t := ⟨by rintro ⟨a', ha', b', hb', h⟩ rcases hf h with ⟨rfl, rfl⟩ exact ⟨ha', hb'⟩, fun ⟨ha, hb⟩ => mem_image2_of_mem ha hb⟩ #align set.mem_image2_iff Set.mem_image2_iff theorem image2_subset (hs : s ⊆ s') (ht : t ⊆ t') : image2 f s t ⊆ image2 f s' t' := by rintro _ ⟨a, ha, b, hb, rfl⟩ exact mem_image2_of_mem (hs ha) (ht hb) #align set.image2_subset Set.image2_subset theorem image2_subset_left (ht : t ⊆ t') : image2 f s t ⊆ image2 f s t' := image2_subset Subset.rfl ht #align set.image2_subset_left Set.image2_subset_left theorem image2_subset_right (hs : s ⊆ s') : image2 f s t ⊆ image2 f s' t := image2_subset hs Subset.rfl #align set.image2_subset_right Set.image2_subset_right theorem image_subset_image2_left (hb : b ∈ t) : (fun a => f a b) '' s ⊆ image2 f s t := forall_mem_image.2 fun _ ha => mem_image2_of_mem ha hb #align set.image_subset_image2_left Set.image_subset_image2_left theorem image_subset_image2_right (ha : a ∈ s) : f a '' t ⊆ image2 f s t := forall_mem_image.2 fun _ => mem_image2_of_mem ha #align set.image_subset_image2_right Set.image_subset_image2_right theorem forall_image2_iff {p : γ → Prop} : (∀ z ∈ image2 f s t, p z) ↔ ∀ x ∈ s, ∀ y ∈ t, p (f x y) := ⟨fun h x hx y hy => h _ ⟨x, hx, y, hy, rfl⟩, fun h _ ⟨x, hx, y, hy, hz⟩ => hz ▸ h x hx y hy⟩ #align set.forall_image2_iff Set.forall_image2_iff @[simp] theorem image2_subset_iff {u : Set γ} : image2 f s t ⊆ u ↔ ∀ x ∈ s, ∀ y ∈ t, f x y ∈ u := forall_image2_iff #align set.image2_subset_iff Set.image2_subset_iff theorem image2_subset_iff_left : image2 f s t ⊆ u ↔ ∀ a ∈ s, (fun b => f a b) '' t ⊆ u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage] #align set.image2_subset_iff_left Set.image2_subset_iff_left theorem image2_subset_iff_right : image2 f s t ⊆ u ↔ ∀ b ∈ t, (fun a => f a b) '' s ⊆ u := by simp_rw [image2_subset_iff, image_subset_iff, subset_def, mem_preimage, @forall₂_swap α] #align set.image2_subset_iff_right Set.image2_subset_iff_right variable (f) -- Porting note: Removing `simp` - LHS does not simplify lemma image_prod : (fun x : α × β ↦ f x.1 x.2) '' s ×ˢ t = image2 f s t := ext fun _ ↦ by simp [and_assoc] #align set.image_prod Set.image_prod @[simp] lemma image_uncurry_prod (s : Set α) (t : Set β) : uncurry f '' s ×ˢ t = image2 f s t := image_prod _ #align set.image_uncurry_prod Set.image_uncurry_prod @[simp] lemma image2_mk_eq_prod : image2 Prod.mk s t = s ×ˢ t := ext <| by simp #align set.image2_mk_eq_prod Set.image2_mk_eq_prod -- Porting note: Removing `simp` - LHS does not simplify lemma image2_curry (f : α × β → γ) (s : Set α) (t : Set β) : image2 (fun a b ↦ f (a, b)) s t = f '' s ×ˢ t := by simp [← image_uncurry_prod, uncurry] #align set.image2_curry Set.image2_curry theorem image2_swap (s : Set α) (t : Set β) : image2 f s t = image2 (fun a b => f b a) t s := by ext constructor <;> rintro ⟨a, ha, b, hb, rfl⟩ <;> exact ⟨b, hb, a, ha, rfl⟩ #align set.image2_swap Set.image2_swap variable {f}
Mathlib/Data/Set/NAry.lean
103
104
theorem image2_union_left : image2 f (s ∪ s') t = image2 f s t ∪ image2 f s' t := by
simp_rw [← image_prod, union_prod, image_union]
import Mathlib.Algebra.Group.Equiv.Basic import Mathlib.Algebra.Group.Aut import Mathlib.Data.ZMod.Defs import Mathlib.Tactic.Ring #align_import algebra.quandle from "leanprover-community/mathlib"@"28aa996fc6fb4317f0083c4e6daf79878d81be33" open MulOpposite universe u v class Shelf (α : Type u) where act : α → α → α self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z) #align shelf Shelf class UnitalShelf (α : Type u) extends Shelf α, One α := (one_act : ∀ a : α, act 1 a = a) (act_one : ∀ a : α, act a 1 = a) #align unital_shelf UnitalShelf @[ext] structure ShelfHom (S₁ : Type*) (S₂ : Type*) [Shelf S₁] [Shelf S₂] where toFun : S₁ → S₂ map_act' : ∀ {x y : S₁}, toFun (Shelf.act x y) = Shelf.act (toFun x) (toFun y) #align shelf_hom ShelfHom #align shelf_hom.ext_iff ShelfHom.ext_iff #align shelf_hom.ext ShelfHom.ext class Rack (α : Type u) extends Shelf α where invAct : α → α → α left_inv : ∀ x, Function.LeftInverse (invAct x) (act x) right_inv : ∀ x, Function.RightInverse (invAct x) (act x) #align rack Rack scoped[Quandles] infixr:65 " ◃ " => Shelf.act scoped[Quandles] infixr:65 " ◃⁻¹ " => Rack.invAct scoped[Quandles] infixr:25 " →◃ " => ShelfHom open Quandles namespace Rack variable {R : Type*} [Rack R] -- Porting note: No longer a need for `Rack.self_distrib` export Shelf (self_distrib) -- porting note, changed name to `act'` to not conflict with `Shelf.act` def act' (x : R) : R ≃ R where toFun := Shelf.act x invFun := invAct x left_inv := left_inv x right_inv := right_inv x #align rack.act Rack.act' @[simp] theorem act'_apply (x y : R) : act' x y = x ◃ y := rfl #align rack.act_apply Rack.act'_apply @[simp] theorem act'_symm_apply (x y : R) : (act' x).symm y = x ◃⁻¹ y := rfl #align rack.act_symm_apply Rack.act'_symm_apply @[simp] theorem invAct_apply (x y : R) : (act' x)⁻¹ y = x ◃⁻¹ y := rfl #align rack.inv_act_apply Rack.invAct_apply @[simp] theorem invAct_act_eq (x y : R) : x ◃⁻¹ x ◃ y = y := left_inv x y #align rack.inv_act_act_eq Rack.invAct_act_eq @[simp] theorem act_invAct_eq (x y : R) : x ◃ x ◃⁻¹ y = y := right_inv x y #align rack.act_inv_act_eq Rack.act_invAct_eq theorem left_cancel (x : R) {y y' : R} : x ◃ y = x ◃ y' ↔ y = y' := by constructor · apply (act' x).injective rintro rfl rfl #align rack.left_cancel Rack.left_cancel theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by constructor · apply (act' x).symm.injective rintro rfl rfl #align rack.left_cancel_inv Rack.left_cancel_inv
Mathlib/Algebra/Quandle.lean
239
241
theorem self_distrib_inv {x y z : R} : x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z := by
rw [← left_cancel (x ◃⁻¹ y), right_inv, ← left_cancel x, right_inv, self_distrib] repeat' rw [right_inv]
import Mathlib.NumberTheory.NumberField.Basic import Mathlib.RingTheory.Localization.NormTrace #align_import number_theory.number_field.norm from "leanprover-community/mathlib"@"00f91228655eecdcd3ac97a7fd8dbcb139fe990a" open scoped NumberField open Finset NumberField Algebra FiniteDimensional namespace RingOfIntegers variable {L : Type*} (K : Type*) [Field K] [Field L] [Algebra K L] [FiniteDimensional K L] noncomputable def norm [IsSeparable K L] : 𝓞 L →* 𝓞 K := RingOfIntegers.restrict_monoidHom ((Algebra.norm K).comp (algebraMap (𝓞 L) L : (𝓞 L) →* L)) fun x => isIntegral_norm K x.2 #align ring_of_integers.norm RingOfIntegers.norm @[simp] lemma coe_norm [IsSeparable K L] (x : 𝓞 L) : norm K x = Algebra.norm K (x : L) := rfl theorem coe_algebraMap_norm [IsSeparable K L] (x : 𝓞 L) : (algebraMap (𝓞 K) (𝓞 L) (norm K x) : L) = algebraMap K L (Algebra.norm K (x : L)) := rfl #align ring_of_integers.coe_algebra_map_norm RingOfIntegers.coe_algebraMap_norm theorem algebraMap_norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : algebraMap _ K (norm K (algebraMap (𝓞 K) (𝓞 L) x)) = Algebra.norm K (algebraMap K L (algebraMap _ _ x)) := rfl #align ring_of_integers.coe_norm_algebra_map RingOfIntegers.algebraMap_norm_algebraMap theorem norm_algebraMap [IsSeparable K L] (x : 𝓞 K) : norm K (algebraMap (𝓞 K) (𝓞 L) x) = x ^ finrank K L := by rw [RingOfIntegers.ext_iff, RingOfIntegers.coe_eq_algebraMap, RingOfIntegers.algebraMap_norm_algebraMap, Algebra.norm_algebraMap, RingOfIntegers.coe_eq_algebraMap, map_pow] #align ring_of_integers.norm_algebra_map RingOfIntegers.norm_algebraMap
Mathlib/NumberTheory/NumberField/Norm.lean
72
85
theorem isUnit_norm_of_isGalois [IsGalois K L] {x : 𝓞 L} : IsUnit (norm K x) ↔ IsUnit x := by
classical refine ⟨fun hx => ?_, IsUnit.map _⟩ replace hx : IsUnit (algebraMap (𝓞 K) (𝓞 L) <| norm K x) := hx.map (algebraMap (𝓞 K) <| 𝓞 L) refine @isUnit_of_mul_isUnit_right (𝓞 L) _ ⟨(univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x, prod_mem fun σ _ => x.2.map (σ : L →+* L).toIntAlgHom⟩ _ ?_ convert hx using 1 ext convert_to ((univ \ {AlgEquiv.refl}).prod fun σ : L ≃ₐ[K] L => σ x) * ∏ σ ∈ {(AlgEquiv.refl : L ≃ₐ[K] L)}, σ x = _ · rw [prod_singleton, AlgEquiv.coe_refl, _root_.id, RingOfIntegers.coe_eq_algebraMap, map_mul, RingOfIntegers.map_mk] · rw [prod_sdiff <| subset_univ _, ← norm_eq_prod_automorphisms, coe_algebraMap_norm]
import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring import Mathlib.Algebra.Order.Group.Indicator import Mathlib.Order.LiminfLimsup import Mathlib.Order.Filter.Archimedean import Mathlib.Order.Filter.CountableInter import Mathlib.Topology.Algebra.Group.Basic import Mathlib.Data.Set.Lattice import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.liminf_limsup from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Filter TopologicalSpace open scoped Topology Classical universe u v variable {ι α β R S : Type*} {π : ι → Type*} class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) #align bounded_le_nhds_class BoundedLENhdsClass class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) #align bounded_ge_nhds_class BoundedGENhdsClass section Preorder variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β] section LiminfLimsup section Indicator theorem limsup_eq_tendsto_sum_indicator_nat_atTop (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω) atTop atTop } := by ext ω simp only [limsup_eq_iInf_iSup_of_nat, ge_iff_le, Set.iSup_eq_iUnion, Set.iInf_eq_iInter, Set.mem_iInter, Set.mem_iUnion, exists_prop] constructor · intro hω refine tendsto_atTop_atTop_of_monotone' (fun n m hnm ↦ Finset.sum_mono_set_of_nonneg (fun i ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) (Finset.range_mono hnm)) ?_ rintro ⟨i, h⟩ simp only [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at h induction' i with k hk · obtain ⟨j, hj₁, hj₂⟩ := hω 1 refine not_lt.2 (h <| j + 1) (lt_of_le_of_lt (Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.range (j + 1), 0).le ?_) refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_range.2 (lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self), ?_⟩ rw [Nat.sub_add_cancel hj₁, Set.indicator_of_mem hj₂] exact zero_lt_one · rw [imp_false] at hk push_neg at hk obtain ⟨i, hi⟩ := hk obtain ⟨j, hj₁, hj₂⟩ := hω (i + 1) replace hi : (∑ k ∈ Finset.range i, (s (k + 1)).indicator 1 ω) = k + 1 := le_antisymm (h i) hi refine not_lt.2 (h <| j + 1) ?_ rw [← Finset.sum_range_add_sum_Ico _ (i.le_succ.trans (hj₁.trans j.le_succ)), hi] refine lt_add_of_pos_right _ ?_ rw [(Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.Ico i (j + 1), 0)] refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) ⟨j - 1, Finset.mem_Ico.2 ⟨(Nat.le_sub_iff_add_le (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁)).2 hj₁, lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self⟩, ?_⟩ rw [Nat.sub_add_cancel (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁), Set.indicator_of_mem hj₂] exact zero_lt_one · rintro hω i rw [Set.mem_setOf_eq, tendsto_atTop_atTop] at hω by_contra! hcon obtain ⟨j, h⟩ := hω (i + 1) have : (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by have hle : ∀ j ≤ i, (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by refine fun j hij ↦ (Finset.sum_le_card_nsmul _ _ _ ?_ : _ ≤ (Finset.range j).card • 1).trans ?_ · exact fun m _ ↦ Set.indicator_apply_le' (fun _ ↦ le_rfl) fun _ ↦ zero_le_one · simpa only [Finset.card_range, smul_eq_mul, mul_one] by_cases hij : j < i · exact hle _ hij.le · rw [← Finset.sum_range_add_sum_Ico _ (not_lt.1 hij)] suffices (∑ k ∈ Finset.Ico i j, (s (k + 1)).indicator 1 ω) = 0 by rw [this, add_zero] exact hle _ le_rfl refine Finset.sum_eq_zero fun m hm ↦ ?_ exact Set.indicator_of_not_mem (hcon _ <| (Finset.mem_Ico.1 hm).1.trans m.le_succ) _ exact not_le.2 (lt_of_lt_of_le i.lt_succ_self <| h _ le_rfl) this #align limsup_eq_tendsto_sum_indicator_nat_at_top limsup_eq_tendsto_sum_indicator_nat_atTop
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean
568
578
theorem limsup_eq_tendsto_sum_indicator_atTop (R : Type*) [StrictOrderedSemiring R] [Archimedean R] (s : ℕ → Set α) : limsup s atTop = { ω | Tendsto (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) atTop atTop } := by
rw [limsup_eq_tendsto_sum_indicator_nat_atTop s] ext ω simp only [Set.mem_setOf_eq] rw [(_ : (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) = fun n ↦ ↑(∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω))] · exact tendsto_natCast_atTop_iff.symm · ext n simp only [Set.indicator, Pi.one_apply, Finset.sum_boole, Nat.cast_id]
import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.MeasureTheory.Group.Pointwise import Mathlib.MeasureTheory.Measure.Lebesgue.Basic import Mathlib.MeasureTheory.Measure.Haar.Basic import Mathlib.MeasureTheory.Measure.Doubling import Mathlib.MeasureTheory.Constructions.BorelSpace.Metric #align_import measure_theory.measure.lebesgue.eq_haar from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844" assert_not_exists MeasureTheory.integral open TopologicalSpace Set Filter Metric Bornology open scoped ENNReal Pointwise Topology NNReal def TopologicalSpace.PositiveCompacts.Icc01 : PositiveCompacts ℝ where carrier := Icc 0 1 isCompact' := isCompact_Icc interior_nonempty' := by simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one] #align topological_space.positive_compacts.Icc01 TopologicalSpace.PositiveCompacts.Icc01 universe u def TopologicalSpace.PositiveCompacts.piIcc01 (ι : Type*) [Finite ι] : PositiveCompacts (ι → ℝ) where carrier := pi univ fun _ => Icc 0 1 isCompact' := isCompact_univ_pi fun _ => isCompact_Icc interior_nonempty' := by simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one] #align topological_space.positive_compacts.pi_Icc01 TopologicalSpace.PositiveCompacts.piIcc01 theorem Basis.parallelepiped_basisFun (ι : Type*) [Fintype ι] : (Pi.basisFun ℝ ι).parallelepiped = TopologicalSpace.PositiveCompacts.piIcc01 ι := SetLike.coe_injective <| by refine Eq.trans ?_ ((uIcc_of_le ?_).trans (Set.pi_univ_Icc _ _).symm) · classical convert parallelepiped_single (ι := ι) 1 · exact zero_le_one #align basis.parallelepiped_basis_fun Basis.parallelepiped_basisFun theorem Basis.parallelepiped_eq_map {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] (b : Basis ι ℝ E) : b.parallelepiped = (PositiveCompacts.piIcc01 ι).map b.equivFun.symm b.equivFunL.symm.continuous b.equivFunL.symm.isOpenMap := by classical rw [← Basis.parallelepiped_basisFun, ← Basis.parallelepiped_map] congr with x simp open MeasureTheory MeasureTheory.Measure theorem Basis.map_addHaar {ι E F : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedSpace ℝ E] [NormedSpace ℝ F] [MeasurableSpace E] [MeasurableSpace F] [BorelSpace E] [BorelSpace F] [SecondCountableTopology F] [SigmaCompactSpace F] (b : Basis ι ℝ E) (f : E ≃L[ℝ] F) : map f b.addHaar = (b.map f.toLinearEquiv).addHaar := by have : IsAddHaarMeasure (map f b.addHaar) := AddEquiv.isAddHaarMeasure_map b.addHaar f.toAddEquiv f.continuous f.symm.continuous rw [eq_comm, Basis.addHaar_eq_iff, Measure.map_apply f.continuous.measurable (PositiveCompacts.isCompact _).measurableSet, Basis.coe_parallelepiped, Basis.coe_map] erw [← image_parallelepiped, f.toEquiv.preimage_image, addHaar_self] namespace MeasureTheory open Measure TopologicalSpace.PositiveCompacts FiniteDimensional theorem addHaarMeasure_eq_volume : addHaarMeasure Icc01 = volume := by convert (addHaarMeasure_unique volume Icc01).symm; simp [Icc01] #align measure_theory.add_haar_measure_eq_volume MeasureTheory.addHaarMeasure_eq_volume theorem addHaarMeasure_eq_volume_pi (ι : Type*) [Fintype ι] : addHaarMeasure (piIcc01 ι) = volume := by convert (addHaarMeasure_unique volume (piIcc01 ι)).symm simp only [piIcc01, volume_pi_pi fun _ => Icc (0 : ℝ) 1, PositiveCompacts.coe_mk, Compacts.coe_mk, Finset.prod_const_one, ENNReal.ofReal_one, Real.volume_Icc, one_smul, sub_zero] #align measure_theory.add_haar_measure_eq_volume_pi MeasureTheory.addHaarMeasure_eq_volume_pi -- Porting note (#11215): TODO: remove this instance? instance isAddHaarMeasure_volume_pi (ι : Type*) [Fintype ι] : IsAddHaarMeasure (volume : Measure (ι → ℝ)) := inferInstance #align measure_theory.is_add_haar_measure_volume_pi MeasureTheory.isAddHaarMeasure_volume_pi namespace Measure
Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean
142
155
theorem addHaar_eq_zero_of_disjoint_translates_aux {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ] {s : Set E} (u : ℕ → E) (sb : IsBounded s) (hu : IsBounded (range u)) (hs : Pairwise (Disjoint on fun n => {u n} + s)) (h's : MeasurableSet s) : μ s = 0 := by
by_contra h apply lt_irrefl ∞ calc ∞ = ∑' _ : ℕ, μ s := (ENNReal.tsum_const_eq_top_of_ne_zero h).symm _ = ∑' n : ℕ, μ ({u n} + s) := by congr 1; ext1 n; simp only [image_add_left, measure_preimage_add, singleton_add] _ = μ (⋃ n, {u n} + s) := Eq.symm <| measure_iUnion hs fun n => by simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's _ = μ (range u + s) := by rw [← iUnion_add, iUnion_singleton_eq_range] _ < ∞ := (hu.add sb).measure_lt_top
import Mathlib.Logic.Equiv.Defs #align_import data.erased from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" universe u def Erased (α : Sort u) : Sort max 1 u := Σ's : α → Prop, ∃ a, (fun b => a = b) = s #align erased Erased namespace Erased @[inline] def mk {α} (a : α) : Erased α := ⟨fun b => a = b, a, rfl⟩ #align erased.mk Erased.mk noncomputable def out {α} : Erased α → α | ⟨_, h⟩ => Classical.choose h #align erased.out Erased.out abbrev OutType (a : Erased (Sort u)) : Sort u := out a #align erased.out_type Erased.OutType theorem out_proof {p : Prop} (a : Erased p) : p := out a #align erased.out_proof Erased.out_proof @[simp] theorem out_mk {α} (a : α) : (mk a).out = a := by let h := (mk a).2; show Classical.choose h = a have := Classical.choose_spec h exact cast (congr_fun this a).symm rfl #align erased.out_mk Erased.out_mk @[simp] theorem mk_out {α} : ∀ a : Erased α, mk (out a) = a | ⟨s, h⟩ => by simp only [mk]; congr; exact Classical.choose_spec h #align erased.mk_out Erased.mk_out @[ext] theorem out_inj {α} (a b : Erased α) (h : a.out = b.out) : a = b := by simpa using congr_arg mk h #align erased.out_inj Erased.out_inj noncomputable def equiv (α) : Erased α ≃ α := ⟨out, mk, mk_out, out_mk⟩ #align erased.equiv Erased.equiv instance (α : Type u) : Repr (Erased α) := ⟨fun _ _ => "Erased"⟩ instance (α : Type u) : ToString (Erased α) := ⟨fun _ => "Erased"⟩ -- Porting note: Deleted `has_to_format` def choice {α} (h : Nonempty α) : Erased α := mk (Classical.choice h) #align erased.choice Erased.choice @[simp] theorem nonempty_iff {α} : Nonempty (Erased α) ↔ Nonempty α := ⟨fun ⟨a⟩ => ⟨a.out⟩, fun ⟨a⟩ => ⟨mk a⟩⟩ #align erased.nonempty_iff Erased.nonempty_iff instance {α} [h : Nonempty α] : Inhabited (Erased α) := ⟨choice h⟩ def bind {α β} (a : Erased α) (f : α → Erased β) : Erased β := ⟨fun b => (f a.out).1 b, (f a.out).2⟩ #align erased.bind Erased.bind @[simp] theorem bind_eq_out {α β} (a f) : @bind α β a f = f a.out := rfl #align erased.bind_eq_out Erased.bind_eq_out def join {α} (a : Erased (Erased α)) : Erased α := bind a id #align erased.join Erased.join @[simp] theorem join_eq_out {α} (a) : @join α a = a.out := bind_eq_out _ _ #align erased.join_eq_out Erased.join_eq_out def map {α β} (f : α → β) (a : Erased α) : Erased β := bind a (mk ∘ f) #align erased.map Erased.map @[simp]
Mathlib/Data/Erased.lean
131
131
theorem map_out {α β} {f : α → β} (a : Erased α) : (a.map f).out = f a.out := by
simp [map]
import Mathlib.Algebra.DirectSum.Module import Mathlib.Algebra.Module.Submodule.Basic #align_import algebra.direct_sum.decomposition from "leanprover-community/mathlib"@"4e861f25ba5ceef42ba0712d8ffeb32f38ad6441" variable {ι R M σ : Type*} open DirectSum namespace DirectSum section AddCommMonoid variable [DecidableEq ι] [AddCommMonoid M] variable [SetLike σ M] [AddSubmonoidClass σ M] (ℳ : ι → σ) class Decomposition where decompose' : M → ⨁ i, ℳ i left_inv : Function.LeftInverse (DirectSum.coeAddMonoidHom ℳ) decompose' right_inv : Function.RightInverse (DirectSum.coeAddMonoidHom ℳ) decompose' #align direct_sum.decomposition DirectSum.Decomposition instance : Subsingleton (Decomposition ℳ) := ⟨fun x y ↦ by cases' x with x xl xr cases' y with y yl yr congr exact Function.LeftInverse.eq_rightInverse xr yl⟩ abbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i) (h_left_inv : (DirectSum.coeAddMonoidHom ℳ).comp decompose = .id _) (h_right_inv : decompose.comp (DirectSum.coeAddMonoidHom ℳ) = .id _) : Decomposition ℳ where decompose' := decompose left_inv := DFunLike.congr_fun h_left_inv right_inv := DFunLike.congr_fun h_right_inv noncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) : DirectSum.Decomposition ℳ where decompose' := (Equiv.ofBijective _ h).symm left_inv := (Equiv.ofBijective _ h).right_inv right_inv := (Equiv.ofBijective _ h).left_inv variable [Decomposition ℳ] protected theorem Decomposition.isInternal : DirectSum.IsInternal ℳ := ⟨Decomposition.right_inv.injective, Decomposition.left_inv.surjective⟩ #align direct_sum.decomposition.is_internal DirectSum.Decomposition.isInternal def decompose : M ≃ ⨁ i, ℳ i where toFun := Decomposition.decompose' invFun := DirectSum.coeAddMonoidHom ℳ left_inv := Decomposition.left_inv right_inv := Decomposition.right_inv #align direct_sum.decompose DirectSum.decompose protected theorem Decomposition.inductionOn {p : M → Prop} (h_zero : p 0) (h_homogeneous : ∀ {i} (m : ℳ i), p (m : M)) (h_add : ∀ m m' : M, p m → p m' → p (m + m')) : ∀ m, p m := by let ℳ' : ι → AddSubmonoid M := fun i ↦ (⟨⟨ℳ i, fun x y ↦ AddMemClass.add_mem x y⟩, (ZeroMemClass.zero_mem _)⟩ : AddSubmonoid M) haveI t : DirectSum.Decomposition ℳ' := { decompose' := DirectSum.decompose ℳ left_inv := fun _ ↦ (decompose ℳ).left_inv _ right_inv := fun _ ↦ (decompose ℳ).right_inv _ } have mem : ∀ m, m ∈ iSup ℳ' := fun _m ↦ (DirectSum.IsInternal.addSubmonoid_iSup_eq_top ℳ' (Decomposition.isInternal ℳ')).symm ▸ trivial -- Porting note: needs to use @ even though no implicit argument is provided exact fun m ↦ @AddSubmonoid.iSup_induction _ _ _ ℳ' _ _ (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add -- exact fun m ↦ -- AddSubmonoid.iSup_induction ℳ' (mem m) (fun i m h ↦ h_homogeneous ⟨m, h⟩) h_zero h_add #align direct_sum.decomposition.induction_on DirectSum.Decomposition.inductionOn @[simp] theorem Decomposition.decompose'_eq : Decomposition.decompose' = decompose ℳ := rfl #align direct_sum.decomposition.decompose'_eq DirectSum.Decomposition.decompose'_eq @[simp] theorem decompose_symm_of {i : ι} (x : ℳ i) : (decompose ℳ).symm (DirectSum.of _ i x) = x := DirectSum.coeAddMonoidHom_of ℳ _ _ #align direct_sum.decompose_symm_of DirectSum.decompose_symm_of @[simp]
Mathlib/Algebra/DirectSum/Decomposition.lean
127
128
theorem decompose_coe {i : ι} (x : ℳ i) : decompose ℳ (x : M) = DirectSum.of _ i x := by
rw [← decompose_symm_of _, Equiv.apply_symm_apply]
import Mathlib.Topology.Algebra.GroupWithZero import Mathlib.Topology.Order.OrderClosed #align_import topology.algebra.with_zero_topology from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064" open Topology Filter TopologicalSpace Filter Set Function namespace WithZeroTopology variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α} {f : α → Γ₀} scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ := nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ) #align with_zero_topology.topological_space WithZeroTopology.topologicalSpace theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by rw [nhds_nhdsAdjoint, sup_of_le_right] exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ #align with_zero_topology.nhds_eq_update WithZeroTopology.nhds_eq_update theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by rw [nhds_eq_update, update_same] #align with_zero_topology.nhds_zero WithZeroTopology.nhds_zero theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by rw [nhds_zero] refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩ exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab) #align with_zero_topology.has_basis_nhds_zero WithZeroTopology.hasBasis_nhds_zero theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) := hasBasis_nhds_zero.mem_of_mem hγ #align with_zero_topology.Iio_mem_nhds_zero WithZeroTopology.Iio_mem_nhds_zero theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) := Iio_mem_nhds_zero γ.ne_zero #align with_zero_topology.nhds_zero_of_units WithZeroTopology.nhds_zero_of_units theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by simp [nhds_zero] #align with_zero_topology.tendsto_zero WithZeroTopology.tendsto_zero @[simp] theorem nhds_of_ne_zero {γ : Γ₀} (h₀ : γ ≠ 0) : 𝓝 γ = pure γ := nhds_nhdsAdjoint_of_ne _ h₀ #align with_zero_topology.nhds_of_ne_zero WithZeroTopology.nhds_of_ne_zero theorem nhds_coe_units (γ : Γ₀ˣ) : 𝓝 (γ : Γ₀) = pure (γ : Γ₀) := nhds_of_ne_zero γ.ne_zero #align with_zero_topology.nhds_coe_units WithZeroTopology.nhds_coe_units theorem singleton_mem_nhds_of_units (γ : Γ₀ˣ) : ({↑γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp #align with_zero_topology.singleton_mem_nhds_of_units WithZeroTopology.singleton_mem_nhds_of_units theorem singleton_mem_nhds_of_ne_zero (h : γ ≠ 0) : ({γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp [h] #align with_zero_topology.singleton_mem_nhds_of_ne_zero WithZeroTopology.singleton_mem_nhds_of_ne_zero theorem hasBasis_nhds_of_ne_zero {x : Γ₀} (h : x ≠ 0) : HasBasis (𝓝 x) (fun _ : Unit => True) fun _ => {x} := by rw [nhds_of_ne_zero h] exact hasBasis_pure _ #align with_zero_topology.has_basis_nhds_of_ne_zero WithZeroTopology.hasBasis_nhds_of_ne_zero theorem hasBasis_nhds_units (γ : Γ₀ˣ) : HasBasis (𝓝 (γ : Γ₀)) (fun _ : Unit => True) fun _ => {↑γ} := hasBasis_nhds_of_ne_zero γ.ne_zero #align with_zero_topology.has_basis_nhds_units WithZeroTopology.hasBasis_nhds_units theorem tendsto_of_ne_zero {γ : Γ₀} (h : γ ≠ 0) : Tendsto f l (𝓝 γ) ↔ ∀ᶠ x in l, f x = γ := by rw [nhds_of_ne_zero h, tendsto_pure] #align with_zero_topology.tendsto_of_ne_zero WithZeroTopology.tendsto_of_ne_zero theorem tendsto_units {γ₀ : Γ₀ˣ} : Tendsto f l (𝓝 (γ₀ : Γ₀)) ↔ ∀ᶠ x in l, f x = γ₀ := tendsto_of_ne_zero γ₀.ne_zero #align with_zero_topology.tendsto_units WithZeroTopology.tendsto_units theorem Iio_mem_nhds (h : γ₁ < γ₂) : Iio γ₂ ∈ 𝓝 γ₁ := by rcases eq_or_ne γ₁ 0 with (rfl | h₀) <;> simp [*, h.ne', Iio_mem_nhds_zero] #align with_zero_topology.Iio_mem_nhds WithZeroTopology.Iio_mem_nhds theorem isOpen_iff {s : Set Γ₀} : IsOpen s ↔ (0 : Γ₀) ∉ s ∨ ∃ γ, γ ≠ 0 ∧ Iio γ ⊆ s := by rw [isOpen_iff_mem_nhds, ← and_forall_ne (0 : Γ₀)] simp (config := { contextual := true }) [nhds_of_ne_zero, imp_iff_not_or, hasBasis_nhds_zero.mem_iff] #align with_zero_topology.is_open_iff WithZeroTopology.isOpen_iff
Mathlib/Topology/Algebra/WithZeroTopology.lean
142
144
theorem isClosed_iff {s : Set Γ₀} : IsClosed s ↔ (0 : Γ₀) ∈ s ∨ ∃ γ, γ ≠ 0 ∧ s ⊆ Ici γ := by
simp only [← isOpen_compl_iff, isOpen_iff, mem_compl_iff, not_not, ← compl_Ici, compl_subset_compl]
import Mathlib.LinearAlgebra.FreeModule.PID import Mathlib.LinearAlgebra.FreeModule.Finite.Basic import Mathlib.LinearAlgebra.BilinearForm.DualLattice import Mathlib.RingTheory.DedekindDomain.Basic import Mathlib.RingTheory.Localization.Module import Mathlib.RingTheory.Trace #align_import ring_theory.dedekind_domain.integral_closure from "leanprover-community/mathlib"@"4cf7ca0e69e048b006674cf4499e5c7d296a89e0" variable (R A K : Type*) [CommRing R] [CommRing A] [Field K] open scoped nonZeroDivisors Polynomial variable [IsDomain A] section IsIntegralClosure open Algebra variable [Algebra A K] [IsFractionRing A K] variable (L : Type*) [Field L] (C : Type*) [CommRing C] variable [Algebra K L] [Algebra A L] [IsScalarTower A K L] variable [Algebra C L] [IsIntegralClosure C A L] [Algebra A C] [IsScalarTower A C L]
Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean
65
83
theorem IsIntegralClosure.isLocalization [Algebra.IsAlgebraic K L] : IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
haveI : IsDomain C := (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L) haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L refine ⟨?_, fun z => ?_, fun {x y} h => ⟨1, ?_⟩⟩ · rintro ⟨_, x, hx, rfl⟩ rw [isUnit_iff_ne_zero, map_ne_zero_iff _ (IsIntegralClosure.algebraMap_injective C A L), Subtype.coe_mk, map_ne_zero_iff _ (NoZeroSMulDivisors.algebraMap_injective A C)] exact mem_nonZeroDivisors_iff_ne_zero.mp hx · obtain ⟨m, hm⟩ := IsIntegral.exists_multiple_integral_of_isLocalization A⁰ z (Algebra.IsIntegral.isIntegral (R := K) z) obtain ⟨x, hx⟩ : ∃ x, algebraMap C L x = m • z := IsIntegralClosure.isIntegral_iff.mp hm refine ⟨⟨x, algebraMap A C m, m, SetLike.coe_mem m, rfl⟩, ?_⟩ rw [Subtype.coe_mk, ← IsScalarTower.algebraMap_apply, hx, mul_comm, Submonoid.smul_def, smul_def] · simp only [IsIntegralClosure.algebraMap_injective C A L h]
import Mathlib.Analysis.NormedSpace.Basic import Mathlib.Analysis.Normed.Group.Hom import Mathlib.Data.Real.Sqrt import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.Topology.MetricSpace.HausdorffDistance #align_import analysis.normed.group.quotient from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open QuotientAddGroup Metric Set Topology NNReal variable {M N : Type*} [SeminormedAddCommGroup M] [SeminormedAddCommGroup N] noncomputable instance normOnQuotient (S : AddSubgroup M) : Norm (M ⧸ S) where norm x := sInf (norm '' { m | mk' S m = x }) #align norm_on_quotient normOnQuotient theorem AddSubgroup.quotient_norm_eq {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = sInf (norm '' { m : M | (m : M ⧸ S) = x }) := rfl #align add_subgroup.quotient_norm_eq AddSubgroup.quotient_norm_eq theorem QuotientAddGroup.norm_eq_infDist {S : AddSubgroup M} (x : M ⧸ S) : ‖x‖ = infDist 0 { m : M | (m : M ⧸ S) = x } := by simp only [AddSubgroup.quotient_norm_eq, infDist_eq_iInf, sInf_image', dist_zero_left] theorem QuotientAddGroup.norm_mk {S : AddSubgroup M} (x : M) : ‖(x : M ⧸ S)‖ = infDist x S := by rw [norm_eq_infDist, ← infDist_image (IsometryEquiv.subLeft x).isometry, IsometryEquiv.subLeft_apply, sub_zero, ← IsometryEquiv.preimage_symm] congr 1 with y simp only [mem_preimage, IsometryEquiv.subLeft_symm_apply, mem_setOf_eq, QuotientAddGroup.eq, neg_add, neg_neg, neg_add_cancel_right, SetLike.mem_coe] theorem image_norm_nonempty {S : AddSubgroup M} (x : M ⧸ S) : (norm '' { m | mk' S m = x }).Nonempty := .image _ <| Quot.exists_rep x #align image_norm_nonempty image_norm_nonempty theorem bddBelow_image_norm (s : Set M) : BddBelow (norm '' s) := ⟨0, forall_mem_image.2 fun _ _ ↦ norm_nonneg _⟩ #align bdd_below_image_norm bddBelow_image_norm theorem isGLB_quotient_norm {S : AddSubgroup M} (x : M ⧸ S) : IsGLB (norm '' { m | mk' S m = x }) (‖x‖) := isGLB_csInf (image_norm_nonempty x) (bddBelow_image_norm _) theorem quotient_norm_neg {S : AddSubgroup M} (x : M ⧸ S) : ‖-x‖ = ‖x‖ := by simp only [AddSubgroup.quotient_norm_eq] congr 1 with r constructor <;> { rintro ⟨m, hm, rfl⟩; use -m; simpa [neg_eq_iff_eq_neg] using hm } #align quotient_norm_neg quotient_norm_neg theorem quotient_norm_sub_rev {S : AddSubgroup M} (x y : M ⧸ S) : ‖x - y‖ = ‖y - x‖ := by rw [← neg_sub, quotient_norm_neg] #align quotient_norm_sub_rev quotient_norm_sub_rev theorem quotient_norm_mk_le (S : AddSubgroup M) (m : M) : ‖mk' S m‖ ≤ ‖m‖ := csInf_le (bddBelow_image_norm _) <| Set.mem_image_of_mem _ rfl #align quotient_norm_mk_le quotient_norm_mk_le theorem quotient_norm_mk_le' (S : AddSubgroup M) (m : M) : ‖(m : M ⧸ S)‖ ≤ ‖m‖ := quotient_norm_mk_le S m #align quotient_norm_mk_le' quotient_norm_mk_le' theorem quotient_norm_mk_eq (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = sInf ((‖m + ·‖) '' S) := by rw [mk'_apply, norm_mk, sInf_image', ← infDist_image isometry_neg, image_neg, neg_coe_set (H := S), infDist_eq_iInf] simp only [dist_eq_norm', sub_neg_eq_add, add_comm] #align quotient_norm_mk_eq quotient_norm_mk_eq theorem quotient_norm_nonneg (S : AddSubgroup M) (x : M ⧸ S) : 0 ≤ ‖x‖ := Real.sInf_nonneg _ <| forall_mem_image.2 fun _ _ ↦ norm_nonneg _ #align quotient_norm_nonneg quotient_norm_nonneg theorem norm_mk_nonneg (S : AddSubgroup M) (m : M) : 0 ≤ ‖mk' S m‖ := quotient_norm_nonneg S _ #align norm_mk_nonneg norm_mk_nonneg theorem quotient_norm_eq_zero_iff (S : AddSubgroup M) (m : M) : ‖mk' S m‖ = 0 ↔ m ∈ closure (S : Set M) := by rw [mk'_apply, norm_mk, ← mem_closure_iff_infDist_zero] exact ⟨0, S.zero_mem⟩ #align quotient_norm_eq_zero_iff quotient_norm_eq_zero_iff
Mathlib/Analysis/Normed/Group/Quotient.lean
187
190
theorem QuotientAddGroup.norm_lt_iff {S : AddSubgroup M} {x : M ⧸ S} {r : ℝ} : ‖x‖ < r ↔ ∃ m : M, ↑m = x ∧ ‖m‖ < r := by
rw [isGLB_lt_iff (isGLB_quotient_norm _), exists_mem_image] rfl
import Batteries.Tactic.Init import Batteries.Tactic.Alias import Batteries.Tactic.Lint.Misc instance {f : α → β} [DecidablePred p] : DecidablePred (p ∘ f) := inferInstanceAs <| DecidablePred fun x => p (f x) @[deprecated] alias proofIrrel := proof_irrel theorem Function.id_def : @id α = fun x => x := rfl alias ⟨forall_not_of_not_exists, not_exists_of_forall_not⟩ := not_exists protected alias ⟨Decidable.exists_not_of_not_forall, _⟩ := Decidable.not_forall theorem heq_iff_eq : HEq a b ↔ a = b := ⟨eq_of_heq, heq_of_eq⟩ @[simp] theorem eq_rec_constant {α : Sort _} {a a' : α} {β : Sort _} (y : β) (h : a = a') : (@Eq.rec α a (fun α _ => β) y a' h) = y := by cases h; rfl theorem congrArg₂ (f : α → β → γ) {x x' : α} {y y' : β} (hx : x = x') (hy : y = y') : f x y = f x' y' := by subst hx hy; rfl theorem congrFun₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : f = g) (a : α) (b : β a) : f a b = g a b := congrFun (congrFun h _) _ theorem congrFun₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : f = g) (a : α) (b : β a) (c : γ a b) : f a b c = g a b c := congrFun₂ (congrFun h _) _ _ theorem funext₂ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {f g : ∀ a b, γ a b} (h : ∀ a b, f a b = g a b) : f = g := funext fun _ => funext <| h _ theorem funext₃ {β : α → Sort _} {γ : ∀ a, β a → Sort _} {δ : ∀ a b, γ a b → Sort _} {f g : ∀ a b c, δ a b c} (h : ∀ a b c, f a b c = g a b c) : f = g := funext fun _ => funext₂ <| h _ theorem Function.funext_iff {β : α → Sort u} {f₁ f₂ : ∀ x : α, β x} : f₁ = f₂ ↔ ∀ a, f₁ a = f₂ a := ⟨congrFun, funext⟩ theorem ne_of_apply_ne {α β : Sort _} (f : α → β) {x y : α} : f x ≠ f y → x ≠ y := mt <| congrArg _ protected theorem Eq.congr (h₁ : x₁ = y₁) (h₂ : x₂ = y₂) : x₁ = x₂ ↔ y₁ = y₂ := by subst h₁; subst h₂; rfl theorem Eq.congr_left {x y z : α} (h : x = y) : x = z ↔ y = z := by rw [h] theorem Eq.congr_right {x y z : α} (h : x = y) : z = x ↔ z = y := by rw [h] alias congr_arg := congrArg alias congr_arg₂ := congrArg₂ alias congr_fun := congrFun alias congr_fun₂ := congrFun₂ alias congr_fun₃ := congrFun₃ theorem heq_of_cast_eq : ∀ (e : α = β) (_ : cast e a = a'), HEq a a' | rfl, rfl => .rfl theorem cast_eq_iff_heq : cast e a = a' ↔ HEq a a' := ⟨heq_of_cast_eq _, fun h => by cases h; rfl⟩ theorem eqRec_eq_cast {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') : @Eq.rec α a motive x a' e = cast (e ▸ rfl) x := by subst e; rfl --Porting note: new theorem. More general version of `eqRec_heq` theorem eqRec_heq_self {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') : HEq (@Eq.rec α a motive x a' e) x := by subst e; rfl @[simp] theorem eqRec_heq_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) : HEq (@Eq.rec α a motive x a' e) y ↔ HEq x y := by subst e; rfl @[simp] theorem heq_eqRec_iff_heq {α : Sort _} {a : α} {motive : (a' : α) → a = a' → Sort _} (x : motive a (rfl : a = a)) {a' : α} (e : a = a') {β : Sort _} (y : β) : HEq y (@Eq.rec α a motive x a' e) ↔ HEq y x := by subst e; rfl @[simp] theorem not_nonempty_empty : ¬Nonempty Empty := fun ⟨h⟩ => h.elim @[simp] theorem not_nonempty_pempty : ¬Nonempty PEmpty := fun ⟨h⟩ => h.elim -- TODO(Mario): profile first, this is a dangerous instance -- instance (priority := 10) {α} [Subsingleton α] : DecidableEq α -- | a, b => isTrue (Subsingleton.elim a b) -- @[simp] -- TODO(Mario): profile theorem eq_iff_true_of_subsingleton [Subsingleton α] (x y : α) : x = y ↔ True := iff_true_intro (Subsingleton.elim ..) theorem subsingleton_of_forall_eq (x : α) (h : ∀ y, y = x) : Subsingleton α := ⟨fun a b => h a ▸ h b ▸ rfl⟩ theorem subsingleton_iff_forall_eq (x : α) : Subsingleton α ↔ ∀ y, y = x := ⟨fun _ y => Subsingleton.elim y x, subsingleton_of_forall_eq x⟩
.lake/packages/batteries/Batteries/Logic.lean
142
143
theorem congr_eqRec {β : α → Sort _} (f : (x : α) → β x → γ) (h : x = x') (y : β x) : f x' (Eq.rec y h) = f x y := by
cases h; rfl
import Mathlib.Algebra.Order.Group.Nat import Mathlib.Data.List.Rotate import Mathlib.GroupTheory.Perm.Support #align_import group_theory.perm.list from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" namespace List variable {α β : Type*} section FormPerm variable [DecidableEq α] (l : List α) open Equiv Equiv.Perm def formPerm : Equiv.Perm α := (zipWith Equiv.swap l l.tail).prod #align list.form_perm List.formPerm @[simp] theorem formPerm_nil : formPerm ([] : List α) = 1 := rfl #align list.form_perm_nil List.formPerm_nil @[simp] theorem formPerm_singleton (x : α) : formPerm [x] = 1 := rfl #align list.form_perm_singleton List.formPerm_singleton @[simp] theorem formPerm_cons_cons (x y : α) (l : List α) : formPerm (x :: y :: l) = swap x y * formPerm (y :: l) := prod_cons #align list.form_perm_cons_cons List.formPerm_cons_cons theorem formPerm_pair (x y : α) : formPerm [x, y] = swap x y := rfl #align list.form_perm_pair List.formPerm_pair theorem mem_or_mem_of_zipWith_swap_prod_ne : ∀ {l l' : List α} {x : α}, (zipWith swap l l').prod x ≠ x → x ∈ l ∨ x ∈ l' | [], _, _ => by simp | _, [], _ => by simp | a::l, b::l', x => fun hx ↦ if h : (zipWith swap l l').prod x = x then (eq_or_eq_of_swap_apply_ne_self (by simpa [h] using hx)).imp (by rintro rfl; exact .head _) (by rintro rfl; exact .head _) else (mem_or_mem_of_zipWith_swap_prod_ne h).imp (.tail _) (.tail _) theorem zipWith_swap_prod_support' (l l' : List α) : { x | (zipWith swap l l').prod x ≠ x } ≤ l.toFinset ⊔ l'.toFinset := fun _ h ↦ by simpa using mem_or_mem_of_zipWith_swap_prod_ne h #align list.zip_with_swap_prod_support' List.zipWith_swap_prod_support' theorem zipWith_swap_prod_support [Fintype α] (l l' : List α) : (zipWith swap l l').prod.support ≤ l.toFinset ⊔ l'.toFinset := by intro x hx have hx' : x ∈ { x | (zipWith swap l l').prod x ≠ x } := by simpa using hx simpa using zipWith_swap_prod_support' _ _ hx' #align list.zip_with_swap_prod_support List.zipWith_swap_prod_support theorem support_formPerm_le' : { x | formPerm l x ≠ x } ≤ l.toFinset := by refine (zipWith_swap_prod_support' l l.tail).trans ?_ simpa [Finset.subset_iff] using tail_subset l #align list.support_form_perm_le' List.support_formPerm_le' theorem support_formPerm_le [Fintype α] : support (formPerm l) ≤ l.toFinset := by intro x hx have hx' : x ∈ { x | formPerm l x ≠ x } := by simpa using hx simpa using support_formPerm_le' _ hx' #align list.support_form_perm_le List.support_formPerm_le variable {l} {x : α} theorem mem_of_formPerm_apply_ne (h : l.formPerm x ≠ x) : x ∈ l := by simpa [or_iff_left_of_imp mem_of_mem_tail] using mem_or_mem_of_zipWith_swap_prod_ne h #align list.mem_of_form_perm_apply_ne List.mem_of_formPerm_apply_ne theorem formPerm_apply_of_not_mem (h : x ∉ l) : formPerm l x = x := not_imp_comm.1 mem_of_formPerm_apply_ne h #align list.form_perm_apply_of_not_mem List.formPerm_apply_of_not_mem theorem formPerm_apply_mem_of_mem (h : x ∈ l) : formPerm l x ∈ l := by cases' l with y l · simp at h induction' l with z l IH generalizing x y · simpa using h · by_cases hx : x ∈ z :: l · rw [formPerm_cons_cons, mul_apply, swap_apply_def] split_ifs · simp [IH _ hx] · simp · simp [*] · replace h : x = y := Or.resolve_right (mem_cons.1 h) hx simp [formPerm_apply_of_not_mem hx, ← h] #align list.form_perm_apply_mem_of_mem List.formPerm_apply_mem_of_mem theorem mem_of_formPerm_apply_mem (h : l.formPerm x ∈ l) : x ∈ l := by contrapose h rwa [formPerm_apply_of_not_mem h] #align list.mem_of_form_perm_apply_mem List.mem_of_formPerm_apply_mem @[simp] theorem formPerm_mem_iff_mem : l.formPerm x ∈ l ↔ x ∈ l := ⟨l.mem_of_formPerm_apply_mem, l.formPerm_apply_mem_of_mem⟩ #align list.form_perm_mem_iff_mem List.formPerm_mem_iff_mem @[simp] theorem formPerm_cons_concat_apply_last (x y : α) (xs : List α) : formPerm (x :: (xs ++ [y])) y = x := by induction' xs with z xs IH generalizing x y · simp · simp [IH] #align list.form_perm_cons_concat_apply_last List.formPerm_cons_concat_apply_last @[simp] theorem formPerm_apply_getLast (x : α) (xs : List α) : formPerm (x :: xs) ((x :: xs).getLast (cons_ne_nil x xs)) = x := by induction' xs using List.reverseRecOn with xs y _ generalizing x <;> simp #align list.form_perm_apply_last List.formPerm_apply_getLast @[simp]
Mathlib/GroupTheory/Perm/List.lean
156
158
theorem formPerm_apply_get_length (x : α) (xs : List α) : formPerm (x :: xs) ((x :: xs).get (Fin.mk xs.length (by simp))) = x := by
rw [get_cons_length, formPerm_apply_getLast]; rfl;
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] -- Porting note: `Ideal.neg_mem_iff` was `neg_mem_iff` on line 142 but Lean was not able to find -- NegMemClass
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
128
138
theorem pow_natDegree_le_of_root_of_monic_mem {x : R} (hroot : IsRoot f x) (hmo : f.Monic) : ∀ i, f.natDegree ≤ i → x ^ i ∈ 𝓟 := by
intro i hi obtain ⟨k, hk⟩ := exists_add_of_le hi rw [hk, pow_add] suffices x ^ f.natDegree ∈ 𝓟 by exact mul_mem_right (x ^ k) 𝓟 this rw [IsRoot.def, eval_eq_sum_range, Finset.range_add_one, Finset.sum_insert Finset.not_mem_range_self, Finset.sum_range, hmo.coeff_natDegree, one_mul] at * rw [eq_neg_of_add_eq_zero_left hroot, Ideal.neg_mem_iff] exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
import Mathlib.Analysis.Calculus.MeanValue import Mathlib.MeasureTheory.Integral.DominatedConvergence import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Analysis.NormedSpace.HahnBanach.SeparatingDual #align_import analysis.calculus.parametric_integral from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section open TopologicalSpace MeasureTheory Filter Metric open scoped Topology Filter variable {α : Type*} [MeasurableSpace α] {μ : Measure α} {𝕜 : Type*} [RCLike 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace 𝕜 E] {H : Type*} [NormedAddCommGroup H] [NormedSpace 𝕜 H] variable {F : H → α → E} {x₀ : H} {bound : α → ℝ} {ε : ℝ}
Mathlib/Analysis/Calculus/ParametricIntegral.lean
75
155
theorem hasFDerivAt_integral_of_dominated_loc_of_lip' {F' : α → H →L[𝕜] E} (ε_pos : 0 < ε) (hF_meas : ∀ x ∈ ball x₀ ε, AEStronglyMeasurable (F x) μ) (hF_int : Integrable (F x₀) μ) (hF'_meas : AEStronglyMeasurable F' μ) (h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ bound a * ‖x - x₀‖) (bound_integrable : Integrable (bound : α → ℝ) μ) (h_diff : ∀ᵐ a ∂μ, HasFDerivAt (F · a) (F' a) x₀) : Integrable F' μ ∧ HasFDerivAt (fun x ↦ ∫ a, F x a ∂μ) (∫ a, F' a ∂μ) x₀ := by
have x₀_in : x₀ ∈ ball x₀ ε := mem_ball_self ε_pos have nneg : ∀ x, 0 ≤ ‖x - x₀‖⁻¹ := fun x ↦ inv_nonneg.mpr (norm_nonneg _) set b : α → ℝ := fun a ↦ |bound a| have b_int : Integrable b μ := bound_integrable.norm have b_nonneg : ∀ a, 0 ≤ b a := fun a ↦ abs_nonneg _ replace h_lipsch : ∀ᵐ a ∂μ, ∀ x ∈ ball x₀ ε, ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := h_lipsch.mono fun a ha x hx ↦ (ha x hx).trans <| mul_le_mul_of_nonneg_right (le_abs_self _) (norm_nonneg _) have hF_int' : ∀ x ∈ ball x₀ ε, Integrable (F x) μ := fun x x_in ↦ by have : ∀ᵐ a ∂μ, ‖F x₀ a - F x a‖ ≤ ε * b a := by simp only [norm_sub_rev (F x₀ _)] refine h_lipsch.mono fun a ha ↦ (ha x x_in).trans ?_ rw [mul_comm ε] rw [mem_ball, dist_eq_norm] at x_in exact mul_le_mul_of_nonneg_left x_in.le (b_nonneg _) exact integrable_of_norm_sub_le (hF_meas x x_in) hF_int (bound_integrable.norm.const_mul ε) this have hF'_int : Integrable F' μ := have : ∀ᵐ a ∂μ, ‖F' a‖ ≤ b a := by apply (h_diff.and h_lipsch).mono rintro a ⟨ha_diff, ha_lip⟩ exact ha_diff.le_of_lip' (b_nonneg a) (mem_of_superset (ball_mem_nhds _ ε_pos) <| ha_lip) b_int.mono' hF'_meas this refine ⟨hF'_int, ?_⟩ /- Discard the trivial case where `E` is not complete, as all integrals vanish. -/ by_cases hE : CompleteSpace E; swap · rcases subsingleton_or_nontrivial H with hH|hH · have : Subsingleton (H →L[𝕜] E) := inferInstance convert hasFDerivAt_of_subsingleton _ x₀ · have : ¬(CompleteSpace (H →L[𝕜] E)) := by simpa [SeparatingDual.completeSpace_continuousLinearMap_iff] using hE simp only [integral, hE, ↓reduceDite, this] exact hasFDerivAt_const 0 x₀ have h_ball : ball x₀ ε ∈ 𝓝 x₀ := ball_mem_nhds x₀ ε_pos have : ∀ᶠ x in 𝓝 x₀, ‖x - x₀‖⁻¹ * ‖((∫ a, F x a ∂μ) - ∫ a, F x₀ a ∂μ) - (∫ a, F' a ∂μ) (x - x₀)‖ = ‖∫ a, ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀)) ∂μ‖ := by apply mem_of_superset (ball_mem_nhds _ ε_pos) intro x x_in; simp only rw [Set.mem_setOf_eq, ← norm_smul_of_nonneg (nneg _), integral_smul, integral_sub, integral_sub, ← ContinuousLinearMap.integral_apply hF'_int] exacts [hF_int' x x_in, hF_int, (hF_int' x x_in).sub hF_int, hF'_int.apply_continuousLinearMap _] rw [hasFDerivAt_iff_tendsto, tendsto_congr' this, ← tendsto_zero_iff_norm_tendsto_zero, ← show (∫ a : α, ‖x₀ - x₀‖⁻¹ • (F x₀ a - F x₀ a - (F' a) (x₀ - x₀)) ∂μ) = 0 by simp] apply tendsto_integral_filter_of_dominated_convergence · filter_upwards [h_ball] with _ x_in apply AEStronglyMeasurable.const_smul exact ((hF_meas _ x_in).sub (hF_meas _ x₀_in)).sub (hF'_meas.apply_continuousLinearMap _) · refine mem_of_superset h_ball fun x hx ↦ ?_ apply (h_diff.and h_lipsch).mono on_goal 1 => rintro a ⟨-, ha_bound⟩ show ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ ≤ b a + ‖F' a‖ replace ha_bound : ‖F x a - F x₀ a‖ ≤ b a * ‖x - x₀‖ := ha_bound x hx calc ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ = ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a) - ‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := by rw [smul_sub] _ ≤ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a)‖ + ‖‖x - x₀‖⁻¹ • F' a (x - x₀)‖ := norm_sub_le _ _ _ = ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a‖ + ‖x - x₀‖⁻¹ * ‖F' a (x - x₀)‖ := by rw [norm_smul_of_nonneg, norm_smul_of_nonneg] <;> exact nneg _ _ ≤ ‖x - x₀‖⁻¹ * (b a * ‖x - x₀‖) + ‖x - x₀‖⁻¹ * (‖F' a‖ * ‖x - x₀‖) := by gcongr; exact (F' a).le_opNorm _ _ ≤ b a + ‖F' a‖ := ?_ simp only [← div_eq_inv_mul] apply_rules [add_le_add, div_le_of_nonneg_of_le_mul] <;> first | rfl | positivity · exact b_int.add hF'_int.norm · apply h_diff.mono intro a ha suffices Tendsto (fun x ↦ ‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))) (𝓝 x₀) (𝓝 0) by simpa rw [tendsto_zero_iff_norm_tendsto_zero] have : (fun x ↦ ‖x - x₀‖⁻¹ * ‖F x a - F x₀ a - F' a (x - x₀)‖) = fun x ↦ ‖‖x - x₀‖⁻¹ • (F x a - F x₀ a - F' a (x - x₀))‖ := by ext x rw [norm_smul_of_nonneg (nneg _)] rwa [hasFDerivAt_iff_tendsto, this] at ha
import Mathlib.LinearAlgebra.Span import Mathlib.RingTheory.Ideal.IsPrimary import Mathlib.RingTheory.Ideal.QuotientOperations import Mathlib.RingTheory.Noetherian #align_import ring_theory.ideal.associated_prime from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9" variable {R : Type*} [CommRing R] (I J : Ideal R) (M : Type*) [AddCommGroup M] [Module R M] def IsAssociatedPrime : Prop := I.IsPrime ∧ ∃ x : M, I = (R ∙ x).annihilator #align is_associated_prime IsAssociatedPrime variable (R) def associatedPrimes : Set (Ideal R) := { I | IsAssociatedPrime I M } #align associated_primes associatedPrimes variable {I J M R} variable {M' : Type*} [AddCommGroup M'] [Module R M'] (f : M →ₗ[R] M') theorem AssociatePrimes.mem_iff : I ∈ associatedPrimes R M ↔ IsAssociatedPrime I M := Iff.rfl #align associate_primes.mem_iff AssociatePrimes.mem_iff theorem IsAssociatedPrime.isPrime (h : IsAssociatedPrime I M) : I.IsPrime := h.1 #align is_associated_prime.is_prime IsAssociatedPrime.isPrime theorem IsAssociatedPrime.map_of_injective (h : IsAssociatedPrime I M) (hf : Function.Injective f) : IsAssociatedPrime I M' := by obtain ⟨x, rfl⟩ := h.2 refine ⟨h.1, ⟨f x, ?_⟩⟩ ext r rw [Submodule.mem_annihilator_span_singleton, Submodule.mem_annihilator_span_singleton, ← map_smul, ← f.map_zero, hf.eq_iff] #align is_associated_prime.map_of_injective IsAssociatedPrime.map_of_injective theorem LinearEquiv.isAssociatedPrime_iff (l : M ≃ₗ[R] M') : IsAssociatedPrime I M ↔ IsAssociatedPrime I M' := ⟨fun h => h.map_of_injective l l.injective, fun h => h.map_of_injective l.symm l.symm.injective⟩ #align linear_equiv.is_associated_prime_iff LinearEquiv.isAssociatedPrime_iff
Mathlib/RingTheory/Ideal/AssociatedPrime.lean
74
78
theorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : ¬IsAssociatedPrime I M := by
rintro ⟨hI, x, hx⟩ apply hI.ne_top rwa [Subsingleton.elim x 0, Submodule.span_singleton_eq_bot.mpr rfl, Submodule.annihilator_bot] at hx
import Mathlib.MeasureTheory.Measure.Typeclasses import Mathlib.MeasureTheory.Measure.MutuallySingular import Mathlib.MeasureTheory.MeasurableSpace.CountablyGenerated open Function Set open scoped ENNReal Classical noncomputable section variable {α β δ : Type*} [MeasurableSpace α] [MeasurableSpace β] {s : Set α} {a : α} namespace MeasureTheory namespace Measure def dirac (a : α) : Measure α := (OuterMeasure.dirac a).toMeasure (by simp) #align measure_theory.measure.dirac MeasureTheory.Measure.dirac instance : MeasureSpace PUnit := ⟨dirac PUnit.unit⟩ theorem le_dirac_apply {a} : s.indicator 1 a ≤ dirac a s := OuterMeasure.dirac_apply a s ▸ le_toMeasure_apply _ _ _ #align measure_theory.measure.le_dirac_apply MeasureTheory.Measure.le_dirac_apply @[simp] theorem dirac_apply' (a : α) (hs : MeasurableSet s) : dirac a s = s.indicator 1 a := toMeasure_apply _ _ hs #align measure_theory.measure.dirac_apply' MeasureTheory.Measure.dirac_apply' @[simp]
Mathlib/MeasureTheory/Measure/Dirac.lean
45
49
theorem dirac_apply_of_mem {a : α} (h : a ∈ s) : dirac a s = 1 := by
have : ∀ t : Set α, a ∈ t → t.indicator (1 : α → ℝ≥0∞) a = 1 := fun t ht => indicator_of_mem ht 1 refine le_antisymm (this univ trivial ▸ ?_) (this s h ▸ le_dirac_apply) rw [← dirac_apply' a MeasurableSet.univ] exact measure_mono (subset_univ s)
import Mathlib.SetTheory.Ordinal.Arithmetic namespace OrdinalApprox universe u variable {α : Type u} variable [CompleteLattice α] (f : α →o α) (x : α) open Function fixedPoints Cardinal Order OrderHom set_option linter.unusedVariables false in def lfpApprox (a : Ordinal.{u}) : α := sSup ({ f (lfpApprox b) | (b : Ordinal) (h : b < a) } ∪ {x}) termination_by a decreasing_by exact h
Mathlib/SetTheory/Ordinal/FixedPointApproximants.lean
77
85
theorem lfpApprox_monotone : Monotone (lfpApprox f x) := by
unfold Monotone; intros a b h; unfold lfpApprox refine sSup_le_sSup ?h apply sup_le_sup_right simp only [exists_prop, Set.le_eq_subset, Set.setOf_subset_setOf, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] intros a' h' use a' exact ⟨lt_of_lt_of_le h' h, rfl⟩
import Mathlib.CategoryTheory.Category.Basic import Mathlib.CategoryTheory.Functor.Basic import Mathlib.CategoryTheory.Groupoid import Mathlib.Tactic.NthRewrite import Mathlib.CategoryTheory.PathCategory import Mathlib.CategoryTheory.Quotient import Mathlib.Combinatorics.Quiver.Symmetric #align_import category_theory.groupoid.free_groupoid from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2" open Set Classical Function attribute [local instance] propDecidable namespace CategoryTheory namespace Groupoid namespace Free universe u v u' v' u'' v'' variable {V : Type u} [Quiver.{v + 1} V] abbrev _root_.Quiver.Hom.toPosPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom X Y := f.toPos.toPath #align category_theory.groupoid.free.quiver.hom.to_pos_path Quiver.Hom.toPosPath abbrev _root_.Quiver.Hom.toNegPath {X Y : V} (f : X ⟶ Y) : (CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom Y X := f.toNeg.toPath #align category_theory.groupoid.free.quiver.hom.to_neg_path Quiver.Hom.toNegPath inductive redStep : HomRel (Paths (Quiver.Symmetrify V)) | step (X Z : Quiver.Symmetrify V) (f : X ⟶ Z) : redStep (𝟙 (Paths.of.obj X)) (f.toPath ≫ (Quiver.reverse f).toPath) #align category_theory.groupoid.free.red_step CategoryTheory.Groupoid.Free.redStep def _root_.CategoryTheory.FreeGroupoid (V) [Q : Quiver V] := Quotient (@redStep V Q) #align category_theory.free_groupoid CategoryTheory.FreeGroupoid instance {V} [Quiver V] [Nonempty V] : Nonempty (FreeGroupoid V) := by inhabit V; exact ⟨⟨@default V _⟩⟩ theorem congr_reverse {X Y : Paths <| Quiver.Symmetrify V} (p q : X ⟶ Y) : Quotient.CompClosure redStep p q → Quotient.CompClosure redStep p.reverse q.reverse := by rintro ⟨XW, pp, qq, WY, _, Z, f⟩ have : Quotient.CompClosure redStep (WY.reverse ≫ 𝟙 _ ≫ XW.reverse) (WY.reverse ≫ (f.toPath ≫ (Quiver.reverse f).toPath) ≫ XW.reverse) := by constructor constructor simpa only [CategoryStruct.comp, CategoryStruct.id, Quiver.Path.reverse, Quiver.Path.nil_comp, Quiver.Path.reverse_comp, Quiver.reverse_reverse, Quiver.Path.reverse_toPath, Quiver.Path.comp_assoc] using this #align category_theory.groupoid.free.congr_reverse CategoryTheory.Groupoid.Free.congr_reverse theorem congr_comp_reverse {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) : Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p ≫ p.reverse) = Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 X) := by apply Quot.EqvGen_sound induction' p with a b q f ih · apply EqvGen.refl · simp only [Quiver.Path.reverse] fapply EqvGen.trans -- Porting note: `Quiver.Path.*` and `Quiver.Hom.*` notation not working · exact q ≫ Quiver.Path.reverse q · apply EqvGen.symm apply EqvGen.rel have : Quotient.CompClosure redStep (q ≫ 𝟙 _ ≫ Quiver.Path.reverse q) (q ≫ (Quiver.Hom.toPath f ≫ Quiver.Hom.toPath (Quiver.reverse f)) ≫ Quiver.Path.reverse q) := by apply Quotient.CompClosure.intro apply redStep.step simp only [Category.assoc, Category.id_comp] at this ⊢ -- Porting note: `simp` cannot see how `Quiver.Path.comp_assoc` is relevant, so change to -- category notation change Quotient.CompClosure redStep (q ≫ Quiver.Path.reverse q) (Quiver.Path.cons q f ≫ (Quiver.Hom.toPath (Quiver.reverse f)) ≫ (Quiver.Path.reverse q)) simp only [← Category.assoc] at this ⊢ exact this · exact ih #align category_theory.groupoid.free.congr_comp_reverse CategoryTheory.Groupoid.Free.congr_comp_reverse
Mathlib/CategoryTheory/Groupoid/FreeGroupoid.lean
120
124
theorem congr_reverse_comp {X Y : Paths <| Quiver.Symmetrify V} (p : X ⟶ Y) : Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (p.reverse ≫ p) = Quot.mk (@Quotient.CompClosure _ _ redStep _ _) (𝟙 Y) := by
nth_rw 2 [← Quiver.Path.reverse_reverse p] apply congr_comp_reverse
import Mathlib.Order.BooleanAlgebra import Mathlib.Logic.Equiv.Basic #align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904" open Function OrderDual variable {ι α β : Type*} {π : ι → Type*} def symmDiff [Sup α] [SDiff α] (a b : α) : α := a \ b ⊔ b \ a #align symm_diff symmDiff def bihimp [Inf α] [HImp α] (a b : α) : α := (b ⇨ a) ⊓ (a ⇨ b) #align bihimp bihimp scoped[symmDiff] infixl:100 " ∆ " => symmDiff scoped[symmDiff] infixl:100 " ⇔ " => bihimp open scoped symmDiff theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a := rfl #align symm_diff_def symmDiff_def theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) := rfl #align bihimp_def bihimp_def theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q := rfl #align symm_diff_eq_xor symmDiff_eq_Xor' @[simp] theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) := (iff_iff_implies_and_implies _ _).symm.trans Iff.comm #align bihimp_iff_iff bihimp_iff_iff @[simp] theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide #align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor section GeneralizedCoheytingAlgebra variable [GeneralizedCoheytingAlgebra α] (a b c d : α) @[simp] theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b := rfl #align to_dual_symm_diff toDual_symmDiff @[simp] theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b := rfl #align of_dual_bihimp ofDual_bihimp theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm] #align symm_diff_comm symmDiff_comm instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) := ⟨symmDiff_comm⟩ #align symm_diff_is_comm symmDiff_isCommutative @[simp] theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self] #align symm_diff_self symmDiff_self @[simp] theorem symmDiff_bot : a ∆ ⊥ = a := by rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq] #align symm_diff_bot symmDiff_bot @[simp] theorem bot_symmDiff : ⊥ ∆ a = a := by rw [symmDiff_comm, symmDiff_bot] #align bot_symm_diff bot_symmDiff @[simp] theorem symmDiff_eq_bot {a b : α} : a ∆ b = ⊥ ↔ a = b := by simp_rw [symmDiff, sup_eq_bot_iff, sdiff_eq_bot_iff, le_antisymm_iff] #align symm_diff_eq_bot symmDiff_eq_bot
Mathlib/Order/SymmDiff.lean
137
138
theorem symmDiff_of_le {a b : α} (h : a ≤ b) : a ∆ b = b \ a := by
rw [symmDiff, sdiff_eq_bot_iff.2 h, bot_sup_eq]
import Mathlib.LinearAlgebra.Dimension.Finrank import Mathlib.LinearAlgebra.InvariantBasisNumber #align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5" noncomputable section universe u v w w' variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M] variable {ι : Type w} {ι' : Type w'} open Cardinal Basis Submodule Function Set attribute [local instance] nontrivial_of_invariantBasisNumber section RankCondition variable [RankCondition R]
Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean
109
118
theorem Basis.le_span'' {ι : Type*} [Fintype ι] (b : Basis ι R M) {w : Set M} [Fintype w] (s : span R w = ⊤) : Fintype.card ι ≤ Fintype.card w := by
-- We construct a surjective linear map `(w → R) →ₗ[R] (ι → R)`, -- by expressing a linear combination in `w` as a linear combination in `ι`. fapply card_le_of_surjective' R · exact b.repr.toLinearMap.comp (Finsupp.total w M R (↑)) · apply Surjective.comp (g := b.repr.toLinearMap) · apply LinearEquiv.surjective rw [← LinearMap.range_eq_top, Finsupp.range_total] simpa using s
import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Nat.Cast.Order import Mathlib.Order.UpperLower.Basic open Set namespace Nat @[simp] theorem range_cast_int : range ((↑) : ℕ → ℤ) = Ici 0 := Subset.antisymm (range_subset_iff.2 Int.ofNat_nonneg) CanLift.prf theorem image_cast_int_Icc (a b : ℕ) : (↑) '' Icc a b = Icc (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Icc (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ico (a b : ℕ) : (↑) '' Ico a b = Ico (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ico (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ioc (a b : ℕ) : (↑) '' Ioc a b = Ioc (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ioc (by simp [ordConnected_Ici]) a b theorem image_cast_int_Ioo (a b : ℕ) : (↑) '' Ioo a b = Ioo (a : ℤ) b := (castOrderEmbedding (α := ℤ)).image_Ioo (by simp [ordConnected_Ici]) a b theorem image_cast_int_Iic (a : ℕ) : (↑) '' Iic a = Icc (0 : ℤ) a := by rw [← Icc_bot, image_cast_int_Icc]; rfl
Mathlib/Data/Nat/Cast/SetInterval.lean
40
41
theorem image_cast_int_Iio (a : ℕ) : (↑) '' Iio a = Ico (0 : ℤ) a := by
rw [← Ico_bot, image_cast_int_Ico]; rfl
import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Normed.Group.Lemmas import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.AffineIsometry import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace import Mathlib.Analysis.NormedSpace.RieszLemma import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Topology.Algebra.Module.FiniteDimension import Mathlib.Topology.Algebra.InfiniteSum.Module import Mathlib.Topology.Instances.Matrix #align_import analysis.normed_space.finite_dimension from "leanprover-community/mathlib"@"9425b6f8220e53b059f5a4904786c3c4b50fc057" universe u v w x noncomputable section open Set FiniteDimensional TopologicalSpace Filter Asymptotics Classical Topology NNReal Metric section CompleteField variable {𝕜 : Type u} [NontriviallyNormedField 𝕜] {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type w} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {F' : Type x} [AddCommGroup F'] [Module 𝕜 F'] [TopologicalSpace F'] [TopologicalAddGroup F'] [ContinuousSMul 𝕜 F'] [CompleteSpace 𝕜] theorem ContinuousLinearMap.continuous_det : Continuous fun f : E →L[𝕜] E => f.det := by change Continuous fun f : E →L[𝕜] E => LinearMap.det (f : E →ₗ[𝕜] E) -- Porting note: this could be easier with `det_cases` by_cases h : ∃ s : Finset E, Nonempty (Basis (↥s) 𝕜 E) · rcases h with ⟨s, ⟨b⟩⟩ haveI : FiniteDimensional 𝕜 E := FiniteDimensional.of_fintype_basis b simp_rw [LinearMap.det_eq_det_toMatrix_of_finset b] refine Continuous.matrix_det ?_ exact ((LinearMap.toMatrix b b).toLinearMap.comp (ContinuousLinearMap.coeLM 𝕜)).continuous_of_finiteDimensional · -- Porting note: was `unfold LinearMap.det` rw [LinearMap.det_def] simpa only [h, MonoidHom.one_apply, dif_neg, not_false_iff] using continuous_const #align continuous_linear_map.continuous_det ContinuousLinearMap.continuous_det irreducible_def lipschitzExtensionConstant (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : ℝ≥0 := let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv max (‖A.symm.toContinuousLinearMap‖₊ * ‖A.toContinuousLinearMap‖₊) 1 #align lipschitz_extension_constant lipschitzExtensionConstant theorem lipschitzExtensionConstant_pos (E' : Type*) [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] : 0 < lipschitzExtensionConstant E' := by rw [lipschitzExtensionConstant] exact zero_lt_one.trans_le (le_max_right _ _) #align lipschitz_extension_constant_pos lipschitzExtensionConstant_pos theorem LipschitzOnWith.extend_finite_dimension {α : Type*} [PseudoMetricSpace α] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace ℝ E'] [FiniteDimensional ℝ E'] {s : Set α} {f : α → E'} {K : ℝ≥0} (hf : LipschitzOnWith K f s) : ∃ g : α → E', LipschitzWith (lipschitzExtensionConstant E' * K) g ∧ EqOn f g s := by let ι : Type _ := Basis.ofVectorSpaceIndex ℝ E' let A := (Basis.ofVectorSpace ℝ E').equivFun.toContinuousLinearEquiv have LA : LipschitzWith ‖A.toContinuousLinearMap‖₊ A := by apply A.lipschitz have L : LipschitzOnWith (‖A.toContinuousLinearMap‖₊ * K) (A ∘ f) s := LA.comp_lipschitzOnWith hf obtain ⟨g, hg, gs⟩ : ∃ g : α → ι → ℝ, LipschitzWith (‖A.toContinuousLinearMap‖₊ * K) g ∧ EqOn (A ∘ f) g s := L.extend_pi refine ⟨A.symm ∘ g, ?_, ?_⟩ · have LAsymm : LipschitzWith ‖A.symm.toContinuousLinearMap‖₊ A.symm := by apply A.symm.lipschitz apply (LAsymm.comp hg).weaken rw [lipschitzExtensionConstant, ← mul_assoc] exact mul_le_mul' (le_max_left _ _) le_rfl · intro x hx have : A (f x) = g x := gs hx simp only [(· ∘ ·), ← this, A.symm_apply_apply] #align lipschitz_on_with.extend_finite_dimension LipschitzOnWith.extend_finite_dimension
Mathlib/Analysis/NormedSpace/FiniteDimension.lean
223
229
theorem LinearMap.exists_antilipschitzWith [FiniteDimensional 𝕜 E] (f : E →ₗ[𝕜] F) (hf : LinearMap.ker f = ⊥) : ∃ K > 0, AntilipschitzWith K f := by
cases subsingleton_or_nontrivial E · exact ⟨1, zero_lt_one, AntilipschitzWith.of_subsingleton⟩ · rw [LinearMap.ker_eq_bot] at hf let e : E ≃L[𝕜] LinearMap.range f := (LinearEquiv.ofInjective f hf).toContinuousLinearEquiv exact ⟨_, e.nnnorm_symm_pos, e.antilipschitz⟩
import Mathlib.Topology.MetricSpace.PseudoMetric #align_import topology.metric_space.basic from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328" open Set Filter Bornology open scoped NNReal Uniformity universe u v w variable {α : Type u} {β : Type v} {X ι : Type*} variable [PseudoMetricSpace α] class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y #align metric_space MetricSpace @[ext] theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) : m = m' := by cases m; cases m'; congr; ext1; assumption #align metric_space.ext MetricSpace.ext def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s) (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α := { PseudoMetricSpace.ofDistTopology dist dist_self dist_comm dist_triangle H with eq_of_dist_eq_zero := eq_of_dist_eq_zero _ _ } #align metric_space.of_dist_topology MetricSpace.ofDistTopology variable {γ : Type w} [MetricSpace γ] theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y := MetricSpace.eq_of_dist_eq_zero #align eq_of_dist_eq_zero eq_of_dist_eq_zero @[simp] theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y := Iff.intro eq_of_dist_eq_zero fun this => this ▸ dist_self _ #align dist_eq_zero dist_eq_zero @[simp] theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y := by rw [eq_comm, dist_eq_zero] #align zero_eq_dist zero_eq_dist
Mathlib/Topology/MetricSpace/Basic.lean
77
78
theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y := by
simpa only [not_iff_not] using dist_eq_zero
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
Mathlib/FieldTheory/Finite/Basic.lean
115
139
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one]
import Mathlib.Order.Filter.Lift import Mathlib.Topology.Separation import Mathlib.Order.Interval.Set.Monotone #align_import topology.filter from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Set Filter TopologicalSpace open Filter Topology variable {ι : Sort*} {α β X Y : Type*} namespace Filter instance : TopologicalSpace (Filter α) := generateFrom <| range <| Iic ∘ 𝓟 theorem isOpen_Iic_principal {s : Set α} : IsOpen (Iic (𝓟 s)) := GenerateOpen.basic _ (mem_range_self _) #align filter.is_open_Iic_principal Filter.isOpen_Iic_principal theorem isOpen_setOf_mem {s : Set α} : IsOpen { l : Filter α | s ∈ l } := by simpa only [Iic_principal] using isOpen_Iic_principal #align filter.is_open_set_of_mem Filter.isOpen_setOf_mem theorem isTopologicalBasis_Iic_principal : IsTopologicalBasis (range (Iic ∘ 𝓟 : Set α → Set (Filter α))) := { exists_subset_inter := by rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩ l hl exact ⟨Iic (𝓟 s) ∩ Iic (𝓟 t), ⟨s ∩ t, by simp⟩, hl, Subset.rfl⟩ sUnion_eq := sUnion_eq_univ_iff.2 fun l => ⟨Iic ⊤, ⟨univ, congr_arg Iic principal_univ⟩, mem_Iic.2 le_top⟩ eq_generateFrom := rfl } #align filter.is_topological_basis_Iic_principal Filter.isTopologicalBasis_Iic_principal theorem isOpen_iff {s : Set (Filter α)} : IsOpen s ↔ ∃ T : Set (Set α), s = ⋃ t ∈ T, Iic (𝓟 t) := isTopologicalBasis_Iic_principal.open_iff_eq_sUnion.trans <| by simp only [exists_subset_range_and_iff, sUnion_image, (· ∘ ·)] #align filter.is_open_iff Filter.isOpen_iff theorem nhds_eq (l : Filter α) : 𝓝 l = l.lift' (Iic ∘ 𝓟) := nhds_generateFrom.trans <| by simp only [mem_setOf_eq, @and_comm (l ∈ _), iInf_and, iInf_range, Filter.lift', Filter.lift, (· ∘ ·), mem_Iic, le_principal_iff] #align filter.nhds_eq Filter.nhds_eq theorem nhds_eq' (l : Filter α) : 𝓝 l = l.lift' fun s => { l' | s ∈ l' } := by simpa only [(· ∘ ·), Iic_principal] using nhds_eq l #align filter.nhds_eq' Filter.nhds_eq' protected theorem tendsto_nhds {la : Filter α} {lb : Filter β} {f : α → Filter β} : Tendsto f la (𝓝 lb) ↔ ∀ s ∈ lb, ∀ᶠ a in la, s ∈ f a := by simp only [nhds_eq', tendsto_lift', mem_setOf_eq] #align filter.tendsto_nhds Filter.tendsto_nhds protected theorem HasBasis.nhds {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => Iic (𝓟 (s i)) := by rw [nhds_eq] exact h.lift' monotone_principal.Iic #align filter.has_basis.nhds Filter.HasBasis.nhds protected theorem tendsto_pure_self (l : Filter X) : Tendsto (pure : X → Filter X) l (𝓝 l) := by rw [Filter.tendsto_nhds] exact fun s hs ↦ Eventually.mono hs fun x ↦ id instance {l : Filter α} [IsCountablyGenerated l] : IsCountablyGenerated (𝓝 l) := let ⟨_b, hb⟩ := l.exists_antitone_basis HasCountableBasis.isCountablyGenerated <| ⟨hb.nhds, Set.to_countable _⟩
Mathlib/Topology/Filter.lean
105
106
theorem HasBasis.nhds' {l : Filter α} {p : ι → Prop} {s : ι → Set α} (h : HasBasis l p s) : HasBasis (𝓝 l) p fun i => { l' | s i ∈ l' } := by
simpa only [Iic_principal] using h.nhds
import Mathlib.Analysis.Normed.Group.Pointwise import Mathlib.Analysis.NormedSpace.Real #align_import analysis.normed_space.pointwise from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156" open Metric Set open Pointwise Topology variable {𝕜 E : Type*} variable [NormedField 𝕜] section SeminormedAddCommGroup variable [SeminormedAddCommGroup E] [NormedSpace 𝕜 E] theorem smul_ball {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • ball x r = ball (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp [← div_eq_inv_mul, div_lt_iff (norm_pos_iff.2 hc), mul_comm _ r, dist_smul₀] #align smul_ball smul_ball theorem smul_unitBall {c : 𝕜} (hc : c ≠ 0) : c • ball (0 : E) (1 : ℝ) = ball (0 : E) ‖c‖ := by rw [_root_.smul_ball hc, smul_zero, mul_one] #align smul_unit_ball smul_unitBall theorem smul_sphere' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • sphere x r = sphere (c • x) (‖c‖ * r) := by ext y rw [mem_smul_set_iff_inv_smul_mem₀ hc] conv_lhs => rw [← inv_smul_smul₀ hc x] simp only [mem_sphere, dist_smul₀, norm_inv, ← div_eq_inv_mul, div_eq_iff (norm_pos_iff.2 hc).ne', mul_comm r] #align smul_sphere' smul_sphere' theorem smul_closedBall' {c : 𝕜} (hc : c ≠ 0) (x : E) (r : ℝ) : c • closedBall x r = closedBall (c • x) (‖c‖ * r) := by simp only [← ball_union_sphere, Set.smul_set_union, _root_.smul_ball hc, smul_sphere' hc] #align smul_closed_ball' smul_closedBall' theorem set_smul_sphere_zero {s : Set 𝕜} (hs : 0 ∉ s) (r : ℝ) : s • sphere (0 : E) r = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := calc s • sphere (0 : E) r = ⋃ c ∈ s, c • sphere (0 : E) r := iUnion_smul_left_image.symm _ = ⋃ c ∈ s, sphere (0 : E) (‖c‖ * r) := iUnion₂_congr fun c hc ↦ by rw [smul_sphere' (ne_of_mem_of_not_mem hc hs), smul_zero] _ = (‖·‖) ⁻¹' ((‖·‖ * r) '' s) := by ext; simp [eq_comm] theorem Bornology.IsBounded.smul₀ {s : Set E} (hs : IsBounded s) (c : 𝕜) : IsBounded (c • s) := (lipschitzWith_smul c).isBounded_image hs #align metric.bounded.smul Bornology.IsBounded.smul₀ theorem eventually_singleton_add_smul_subset {x : E} {s : Set E} (hs : Bornology.IsBounded s) {u : Set E} (hu : u ∈ 𝓝 x) : ∀ᶠ r in 𝓝 (0 : 𝕜), {x} + r • s ⊆ u := by obtain ⟨ε, εpos, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ closedBall x ε ⊆ u := nhds_basis_closedBall.mem_iff.1 hu obtain ⟨R, Rpos, hR⟩ : ∃ R : ℝ, 0 < R ∧ s ⊆ closedBall 0 R := hs.subset_closedBall_lt 0 0 have : Metric.closedBall (0 : 𝕜) (ε / R) ∈ 𝓝 (0 : 𝕜) := closedBall_mem_nhds _ (div_pos εpos Rpos) filter_upwards [this] with r hr simp only [image_add_left, singleton_add] intro y hy obtain ⟨z, zs, hz⟩ : ∃ z : E, z ∈ s ∧ r • z = -x + y := by simpa [mem_smul_set] using hy have I : ‖r • z‖ ≤ ε := calc ‖r • z‖ = ‖r‖ * ‖z‖ := norm_smul _ _ _ ≤ ε / R * R := (mul_le_mul (mem_closedBall_zero_iff.1 hr) (mem_closedBall_zero_iff.1 (hR zs)) (norm_nonneg _) (div_pos εpos Rpos).le) _ = ε := by field_simp have : y = x + r • z := by simp only [hz, add_neg_cancel_left] apply hε simpa only [this, dist_eq_norm, add_sub_cancel_left, mem_closedBall] using I #align eventually_singleton_add_smul_subset eventually_singleton_add_smul_subset variable [NormedSpace ℝ E] {x y z : E} {δ ε : ℝ}
Mathlib/Analysis/NormedSpace/Pointwise.lean
150
151
theorem smul_unitBall_of_pos {r : ℝ} (hr : 0 < r) : r • ball (0 : E) 1 = ball (0 : E) r := by
rw [smul_unitBall hr.ne', Real.norm_of_nonneg hr.le]
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
Mathlib/Geometry/Manifold/MFDeriv/UniqueDifferential.lean
84
92
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
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Combinatorics.Enumerative.DoubleCounting import Mathlib.Data.Finset.Pointwise import Mathlib.Tactic.GCongr #align_import combinatorics.additive.pluennecke_ruzsa from "leanprover-community/mathlib"@"4aab2abced69a9e579b1e6dc2856ed3db48e2cbd" open Nat open NNRat Pointwise namespace Finset variable {α : Type*} [CommGroup α] [DecidableEq α] {A B C : Finset α} @[to_additive card_sub_mul_le_card_sub_mul_card_sub "**Ruzsa's triangle inequality**. Subtraction version."] theorem card_div_mul_le_card_div_mul_card_div (A B C : Finset α) : (A / C).card * B.card ≤ (A / B).card * (B / C).card := by rw [← card_product (A / B), ← mul_one ((A / B) ×ˢ (B / C)).card] refine card_mul_le_card_mul (fun b ac ↦ ac.1 * ac.2 = b) (fun x hx ↦ ?_) fun x _ ↦ card_le_one_iff.2 fun hu hv ↦ ((mem_bipartiteBelow _).1 hu).2.symm.trans ?_ obtain ⟨a, ha, c, hc, rfl⟩ := mem_div.1 hx refine card_le_card_of_inj_on (fun b ↦ (a / b, b / c)) (fun b hb ↦ ?_) fun b₁ _ b₂ _ h ↦ ?_ · rw [mem_bipartiteAbove] exact ⟨mk_mem_product (div_mem_div ha hb) (div_mem_div hb hc), div_mul_div_cancel' _ _ _⟩ · exact div_right_injective (Prod.ext_iff.1 h).1 · exact ((mem_bipartiteBelow _).1 hv).2 #align finset.card_div_mul_le_card_div_mul_card_div Finset.card_div_mul_le_card_div_mul_card_div #align finset.card_sub_mul_le_card_sub_mul_card_sub Finset.card_sub_mul_le_card_sub_mul_card_sub @[to_additive card_sub_mul_le_card_add_mul_card_add "**Ruzsa's triangle inequality**. Sub-add-add version."] theorem card_div_mul_le_card_mul_mul_card_mul (A B C : Finset α) : (A / C).card * B.card ≤ (A * B).card * (B * C).card := by rw [← div_inv_eq_mul, ← card_inv B, ← card_inv (B * C), mul_inv, ← div_eq_mul_inv] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_div_mul_le_card_mul_mul_card_mul Finset.card_div_mul_le_card_mul_mul_card_mul #align finset.card_sub_mul_le_card_add_mul_card_add Finset.card_sub_mul_le_card_add_mul_card_add @[to_additive card_add_mul_le_card_sub_mul_card_add "**Ruzsa's triangle inequality**. Add-sub-sub version."] theorem card_mul_mul_le_card_div_mul_card_mul (A B C : Finset α) : (A * C).card * B.card ≤ (A / B).card * (B * C).card := by rw [← div_inv_eq_mul, ← div_inv_eq_mul B] exact card_div_mul_le_card_div_mul_card_div _ _ _ #align finset.card_mul_mul_le_card_div_mul_card_mul Finset.card_mul_mul_le_card_div_mul_card_mul #align finset.card_add_mul_le_card_sub_mul_card_add Finset.card_add_mul_le_card_sub_mul_card_add @[to_additive card_add_mul_le_card_add_mul_card_sub "**Ruzsa's triangle inequality**. Add-add-sub version."] theorem card_mul_mul_le_card_mul_mul_card_div (A B C : Finset α) : (A * C).card * B.card ≤ (A * B).card * (B / C).card := by rw [← div_inv_eq_mul, div_eq_mul_inv B] exact card_div_mul_le_card_mul_mul_card_mul _ _ _ #align finset.card_mul_mul_le_card_mul_mul_card_div Finset.card_mul_mul_le_card_mul_mul_card_div #align finset.card_add_mul_le_card_add_mul_card_sub Finset.card_add_mul_le_card_add_mul_card_sub set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 @[to_additive]
Mathlib/Combinatorics/Additive/PluenneckeRuzsa.lean
92
118
theorem mul_pluennecke_petridis (C : Finset α) (hA : ∀ A' ⊆ A, (A * B).card * A'.card ≤ (A' * B).card * A.card) : (A * B * C).card * A.card ≤ (A * B).card * (A * C).card := by
induction' C using Finset.induction_on with x C _ ih · simp set A' := A ∩ (A * C / {x}) with hA' set C' := insert x C with hC' have h₀ : A' * {x} = A * {x} ∩ (A * C) := by rw [hA', inter_mul_singleton, (isUnit_singleton x).div_mul_cancel] have h₁ : A * B * C' = A * B * C ∪ (A * B * {x}) \ (A' * B * {x}) := by rw [hC', insert_eq, union_comm, mul_union] refine (sup_sdiff_eq_sup ?_).symm rw [mul_right_comm, mul_right_comm A, h₀] exact mul_subset_mul_right inter_subset_right have h₂ : A' * B * {x} ⊆ A * B * {x} := mul_subset_mul_right (mul_subset_mul_right inter_subset_left) have h₃ : (A * B * C').card ≤ (A * B * C).card + (A * B).card - (A' * B).card := by rw [h₁] refine (card_union_le _ _).trans_eq ?_ rw [card_sdiff h₂, ← add_tsub_assoc_of_le (card_le_card h₂), card_mul_singleton, card_mul_singleton] refine (mul_le_mul_right' h₃ _).trans ?_ rw [tsub_mul, add_mul] refine (tsub_le_tsub (add_le_add_right ih _) <| hA _ inter_subset_left).trans_eq ?_ rw [← mul_add, ← mul_tsub, ← hA', hC', insert_eq, mul_union, ← card_mul_singleton A x, ← card_mul_singleton A' x, add_comm (card _), h₀, eq_tsub_of_add_eq (card_union_add_card_inter _ _)]
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
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
40
55
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`
import Mathlib.Algebra.QuadraticDiscriminant import Mathlib.Analysis.Convex.SpecificFunctions.Deriv import Mathlib.Analysis.SpecialFunctions.Pow.Complex #align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92" noncomputable section namespace Complex open Set Filter open scoped Real theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul, add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub] ring_nf rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm] refine exists_congr fun x => ?_ refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero) field_simp; ring #align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by rw [← not_exists, not_iff_not, cos_eq_zero_iff] #align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff] constructor · rintro ⟨k, hk⟩ use k + 1 field_simp [eq_add_of_sub_eq hk] ring · rintro ⟨k, rfl⟩ use k - 1 field_simp ring #align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by rw [← not_exists, not_iff_not, sin_eq_zero_iff] #align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero, ← mul_assoc, ← sin_two_mul, sin_eq_zero_iff] field_simp [mul_comm, eq_comm] #align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by rw [← not_exists, not_iff_not, tan_eq_zero_iff] #align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 := tan_eq_zero_iff.mpr (by use n) #align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm] theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := calc cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm _ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos] _ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)] _ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm _ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by apply or_congr <;> field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq', sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)] constructor <;> · rintro ⟨k, rfl⟩; use -k; simp _ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm #align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff theorem sin_eq_sin_iff {x y : ℂ} : sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add] refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring #align complex.sin_eq_sin_iff Complex.sin_eq_sin_iff
Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean
110
112
theorem cos_eq_one_iff {x : ℂ} : cos x = 1 ↔ ∃ k : ℤ, k * (2 * π) = x := by
rw [← cos_zero, eq_comm, cos_eq_cos_iff] simp [mul_assoc, mul_left_comm, eq_comm]
import Mathlib.Topology.Algebra.Polynomial import Mathlib.Topology.ContinuousFunction.Algebra import Mathlib.Topology.UnitInterval import Mathlib.Algebra.Star.Subalgebra #align_import topology.continuous_function.polynomial from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64" variable {R : Type*} open Polynomial namespace Polynomial section variable [Semiring R] [TopologicalSpace R] [TopologicalSemiring R] @[simps] def toContinuousMap (p : R[X]) : C(R, R) := ⟨fun x : R => p.eval x, by fun_prop⟩ #align polynomial.to_continuous_map Polynomial.toContinuousMap open ContinuousMap in lemma toContinuousMap_X_eq_id : X.toContinuousMap = .id R := by ext; simp @[simps] def toContinuousMapOn (p : R[X]) (X : Set R) : C(X, R) := -- Porting note: Old proof was `⟨fun x : X => p.toContinuousMap x, by continuity⟩` ⟨fun x : X => p.toContinuousMap x, Continuous.comp (by continuity) (by continuity)⟩ #align polynomial.to_continuous_map_on Polynomial.toContinuousMapOn open ContinuousMap in lemma toContinuousMapOn_X_eq_restrict_id (s : Set R) : X.toContinuousMapOn s = restrict s (.id R) := by ext; simp -- TODO some lemmas about when `toContinuousMapOn` is injective? end section variable {α : Type*} [TopologicalSpace α] [CommSemiring R] [TopologicalSpace R] [TopologicalSemiring R] @[simp]
Mathlib/Topology/ContinuousFunction/Polynomial.lean
76
82
theorem aeval_continuousMap_apply (g : R[X]) (f : C(α, R)) (x : α) : ((Polynomial.aeval f) g) x = g.eval (f x) := by
refine Polynomial.induction_on' g ?_ ?_ · intro p q hp hq simp [hp, hq] · intro n a simp [Pi.pow_apply]
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]
Mathlib/Computability/NFA.lean
58
58
theorem stepSet_empty (a : α) : M.stepSet ∅ a = ∅ := by
simp [stepSet]
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.Set.Basic import Mathlib.Data.Setoid.Basic import Mathlib.GroupTheory.Coset #align_import group_theory.double_coset from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" -- Porting note: removed import -- import Mathlib.Tactic.Group variable {G : Type*} [Group G] {α : Type*} [Mul α] (J : Subgroup G) (g : G) open MulOpposite open scoped Pointwise namespace Doset def doset (a : α) (s t : Set α) : Set α := s * {a} * t #align doset Doset.doset lemma doset_eq_image2 (a : α) (s t : Set α) : doset a s t = Set.image2 (· * a * ·) s t := by simp_rw [doset, Set.mul_singleton, ← Set.image2_mul, Set.image2_image_left] theorem mem_doset {s t : Set α} {a b : α} : b ∈ doset a s t ↔ ∃ x ∈ s, ∃ y ∈ t, b = x * a * y := by simp only [doset_eq_image2, Set.mem_image2, eq_comm] #align doset.mem_doset Doset.mem_doset theorem mem_doset_self (H K : Subgroup G) (a : G) : a ∈ doset a H K := mem_doset.mpr ⟨1, H.one_mem, 1, K.one_mem, (one_mul a).symm.trans (mul_one (1 * a)).symm⟩ #align doset.mem_doset_self Doset.mem_doset_self theorem doset_eq_of_mem {H K : Subgroup G} {a b : G} (hb : b ∈ doset a H K) : doset b H K = doset a H K := by obtain ⟨h, hh, k, hk, rfl⟩ := mem_doset.1 hb rw [doset, doset, ← Set.singleton_mul_singleton, ← Set.singleton_mul_singleton, mul_assoc, mul_assoc, Subgroup.singleton_mul_subgroup hk, ← mul_assoc, ← mul_assoc, Subgroup.subgroup_mul_singleton hh] #align doset.doset_eq_of_mem Doset.doset_eq_of_mem theorem mem_doset_of_not_disjoint {H K : Subgroup G} {a b : G} (h : ¬Disjoint (doset a H K) (doset b H K)) : b ∈ doset a H K := by rw [Set.not_disjoint_iff] at h simp only [mem_doset] at * obtain ⟨x, ⟨l, hl, r, hr, hrx⟩, y, hy, ⟨r', hr', rfl⟩⟩ := h refine ⟨y⁻¹ * l, H.mul_mem (H.inv_mem hy) hl, r * r'⁻¹, K.mul_mem hr (K.inv_mem hr'), ?_⟩ rwa [mul_assoc, mul_assoc, eq_inv_mul_iff_mul_eq, ← mul_assoc, ← mul_assoc, eq_mul_inv_iff_mul_eq] #align doset.mem_doset_of_not_disjoint Doset.mem_doset_of_not_disjoint theorem eq_of_not_disjoint {H K : Subgroup G} {a b : G} (h : ¬Disjoint (doset a H K) (doset b H K)) : doset a H K = doset b H K := by rw [disjoint_comm] at h have ha : a ∈ doset b H K := mem_doset_of_not_disjoint h apply doset_eq_of_mem ha #align doset.eq_of_not_disjoint Doset.eq_of_not_disjoint def setoid (H K : Set G) : Setoid G := Setoid.ker fun x => doset x H K #align doset.setoid Doset.setoid def Quotient (H K : Set G) : Type _ := _root_.Quotient (setoid H K) #align doset.quotient Doset.Quotient theorem rel_iff {H K : Subgroup G} {x y : G} : (setoid ↑H ↑K).Rel x y ↔ ∃ a ∈ H, ∃ b ∈ K, y = a * x * b := Iff.trans ⟨fun hxy => (congr_arg _ hxy).mpr (mem_doset_self H K y), fun hxy => (doset_eq_of_mem hxy).symm⟩ mem_doset #align doset.rel_iff Doset.rel_iff theorem bot_rel_eq_leftRel (H : Subgroup G) : (setoid ↑(⊥ : Subgroup G) ↑H).Rel = (QuotientGroup.leftRel H).Rel := by ext a b rw [rel_iff, Setoid.Rel, QuotientGroup.leftRel_apply] constructor · rintro ⟨a, rfl : a = 1, b, hb, rfl⟩ change a⁻¹ * (1 * a * b) ∈ H rwa [one_mul, inv_mul_cancel_left] · rintro (h : a⁻¹ * b ∈ H) exact ⟨1, rfl, a⁻¹ * b, h, by rw [one_mul, mul_inv_cancel_left]⟩ #align doset.bot_rel_eq_left_rel Doset.bot_rel_eq_leftRel theorem rel_bot_eq_right_group_rel (H : Subgroup G) : (setoid ↑H ↑(⊥ : Subgroup G)).Rel = (QuotientGroup.rightRel H).Rel := by ext a b rw [rel_iff, Setoid.Rel, QuotientGroup.rightRel_apply] constructor · rintro ⟨b, hb, a, rfl : a = 1, rfl⟩ change b * a * 1 * a⁻¹ ∈ H rwa [mul_one, mul_inv_cancel_right] · rintro (h : b * a⁻¹ ∈ H) exact ⟨b * a⁻¹, h, 1, rfl, by rw [mul_one, inv_mul_cancel_right]⟩ #align doset.rel_bot_eq_right_group_rel Doset.rel_bot_eq_right_group_rel def quotToDoset (H K : Subgroup G) (q : Quotient (H : Set G) K) : Set G := doset q.out' H K #align doset.quot_to_doset Doset.quotToDoset abbrev mk (H K : Subgroup G) (a : G) : Quotient (H : Set G) K := Quotient.mk'' a #align doset.mk Doset.mk instance (H K : Subgroup G) : Inhabited (Quotient (H : Set G) K) := ⟨mk H K (1 : G)⟩
Mathlib/GroupTheory/DoubleCoset.lean
130
133
theorem eq (H K : Subgroup G) (a b : G) : mk H K a = mk H K b ↔ ∃ h ∈ H, ∃ k ∈ K, b = h * a * k := by
rw [Quotient.eq''] apply rel_iff
import Mathlib.Algebra.DualNumber import Mathlib.Algebra.QuaternionBasis import Mathlib.Data.Complex.Module import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation import Mathlib.LinearAlgebra.CliffordAlgebra.Star import Mathlib.LinearAlgebra.QuadraticForm.Prod #align_import linear_algebra.clifford_algebra.equivs from "leanprover-community/mathlib"@"cf7a7252c1989efe5800e0b3cdfeb4228ac6b40e" open CliffordAlgebra namespace CliffordAlgebraComplex open scoped ComplexConjugate def Q : QuadraticForm ℝ ℝ := -QuadraticForm.sq (R := ℝ) -- Porting note: Added `(R := ℝ)` set_option linter.uppercaseLean3 false in #align clifford_algebra_complex.Q CliffordAlgebraComplex.Q @[simp] theorem Q_apply (r : ℝ) : Q r = -(r * r) := rfl set_option linter.uppercaseLean3 false in #align clifford_algebra_complex.Q_apply CliffordAlgebraComplex.Q_apply def toComplex : CliffordAlgebra Q →ₐ[ℝ] ℂ := CliffordAlgebra.lift Q ⟨LinearMap.toSpanSingleton _ _ Complex.I, fun r => by dsimp [LinearMap.toSpanSingleton, LinearMap.id] rw [mul_mul_mul_comm] simp⟩ #align clifford_algebra_complex.to_complex CliffordAlgebraComplex.toComplex @[simp] theorem toComplex_ι (r : ℝ) : toComplex (ι Q r) = r • Complex.I := CliffordAlgebra.lift_ι_apply _ _ r #align clifford_algebra_complex.to_complex_ι CliffordAlgebraComplex.toComplex_ι @[simp]
Mathlib/LinearAlgebra/CliffordAlgebra/Equivs.lean
157
164
theorem toComplex_involute (c : CliffordAlgebra Q) : toComplex (involute c) = conj (toComplex c) := by
have : toComplex (involute (ι Q 1)) = conj (toComplex (ι Q 1)) := by simp only [involute_ι, toComplex_ι, AlgHom.map_neg, one_smul, Complex.conj_I] suffices toComplex.comp involute = Complex.conjAe.toAlgHom.comp toComplex by exact AlgHom.congr_fun this c ext : 2 exact this
import Mathlib.Analysis.SpecialFunctions.Pow.NNReal import Mathlib.Analysis.SpecialFunctions.Pow.Continuity import Mathlib.Analysis.SumOverResidueClass #align_import analysis.p_series from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8" def SuccDiffBounded (C : ℕ) (u : ℕ → ℕ) : Prop := ∀ n : ℕ, u (n + 2) - u (n + 1) ≤ C • (u (n + 1) - u n) namespace Finset variable {M : Type*} [OrderedAddCommMonoid M] {f : ℕ → M} {u : ℕ → ℕ}
Mathlib/Analysis/PSeries.lean
50
62
theorem le_sum_schlomilch' (hf : ∀ ⦃m n⦄, 0 < m → m ≤ n → f n ≤ f m) (h_pos : ∀ n, 0 < u n) (hu : Monotone u) (n : ℕ) : (∑ k ∈ Ico (u 0) (u n), f k) ≤ ∑ k ∈ range n, (u (k + 1) - u k) • f (u k) := by
induction' n with n ihn · simp suffices (∑ k ∈ Ico (u n) (u (n + 1)), f k) ≤ (u (n + 1) - u n) • f (u n) by rw [sum_range_succ, ← sum_Ico_consecutive] · exact add_le_add ihn this exacts [hu n.zero_le, hu n.le_succ] have : ∀ k ∈ Ico (u n) (u (n + 1)), f k ≤ f (u n) := fun k hk => hf (Nat.succ_le_of_lt (h_pos n)) (mem_Ico.mp hk).1 convert sum_le_sum this simp [pow_succ, mul_two]