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
goals
listlengths
0
224
goals_before
listlengths
0
220
import Mathlib.Algebra.Group.Aut import Mathlib.Algebra.Group.Subgroup.Basic import Mathlib.Logic.Function.Basic #align_import group_theory.semidirect_product from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c" variable (N : Type*) (G : Type*) {H : Type*} [Group N] [Group G] [Group H] @[ext] structure SemidirectProduct (φ : G →* MulAut N) where left : N right : G deriving DecidableEq #align semidirect_product SemidirectProduct -- Porting note: these lemmas are autogenerated by the inductive definition and are not -- in simple form due to the existence of mk_eq_inl_mul_inr attribute [nolint simpNF] SemidirectProduct.mk.injEq attribute [nolint simpNF] SemidirectProduct.mk.sizeOf_spec -- Porting note: unknown attribute -- attribute [pp_using_anonymous_constructor] SemidirectProduct @[inherit_doc] notation:35 N " ⋊[" φ:35 "] " G:35 => SemidirectProduct N G φ namespace SemidirectProduct variable {N G} variable {φ : G →* MulAut N} instance : Mul (SemidirectProduct N G φ) where mul a b := ⟨a.1 * φ a.2 b.1, a.2 * b.2⟩ lemma mul_def (a b : SemidirectProduct N G φ) : a * b = ⟨a.1 * φ a.2 b.1, a.2 * b.2⟩ := rfl @[simp] theorem mul_left (a b : N ⋊[φ] G) : (a * b).left = a.left * φ a.right b.left := rfl #align semidirect_product.mul_left SemidirectProduct.mul_left @[simp] theorem mul_right (a b : N ⋊[φ] G) : (a * b).right = a.right * b.right := rfl #align semidirect_product.mul_right SemidirectProduct.mul_right instance : One (SemidirectProduct N G φ) where one := ⟨1, 1⟩ @[simp] theorem one_left : (1 : N ⋊[φ] G).left = 1 := rfl #align semidirect_product.one_left SemidirectProduct.one_left @[simp] theorem one_right : (1 : N ⋊[φ] G).right = 1 := rfl #align semidirect_product.one_right SemidirectProduct.one_right instance : Inv (SemidirectProduct N G φ) where inv x := ⟨φ x.2⁻¹ x.1⁻¹, x.2⁻¹⟩ @[simp] theorem inv_left (a : N ⋊[φ] G) : a⁻¹.left = φ a.right⁻¹ a.left⁻¹ := rfl #align semidirect_product.inv_left SemidirectProduct.inv_left @[simp] theorem inv_right (a : N ⋊[φ] G) : a⁻¹.right = a.right⁻¹ := rfl #align semidirect_product.inv_right SemidirectProduct.inv_right instance : Group (N ⋊[φ] G) where mul_assoc a b c := SemidirectProduct.ext _ _ (by simp [mul_assoc]) (by simp [mul_assoc]) one_mul a := SemidirectProduct.ext _ _ (by simp) (one_mul a.2) mul_one a := SemidirectProduct.ext _ _ (by simp) (mul_one _) mul_left_inv a := SemidirectProduct.ext _ _ (by simp) (by simp) instance : Inhabited (N ⋊[φ] G) := ⟨1⟩ def inl : N →* N ⋊[φ] G where toFun n := ⟨n, 1⟩ map_one' := rfl map_mul' := by intros; ext <;> simp only [mul_left, map_one, MulAut.one_apply, mul_right, mul_one] #align semidirect_product.inl SemidirectProduct.inl @[simp] theorem left_inl (n : N) : (inl n : N ⋊[φ] G).left = n := rfl #align semidirect_product.left_inl SemidirectProduct.left_inl @[simp] theorem right_inl (n : N) : (inl n : N ⋊[φ] G).right = 1 := rfl #align semidirect_product.right_inl SemidirectProduct.right_inl theorem inl_injective : Function.Injective (inl : N → N ⋊[φ] G) := Function.injective_iff_hasLeftInverse.2 ⟨left, left_inl⟩ #align semidirect_product.inl_injective SemidirectProduct.inl_injective @[simp] theorem inl_inj {n₁ n₂ : N} : (inl n₁ : N ⋊[φ] G) = inl n₂ ↔ n₁ = n₂ := inl_injective.eq_iff #align semidirect_product.inl_inj SemidirectProduct.inl_inj def inr : G →* N ⋊[φ] G where toFun g := ⟨1, g⟩ map_one' := rfl map_mul' := by intros; ext <;> simp #align semidirect_product.inr SemidirectProduct.inr @[simp] theorem left_inr (g : G) : (inr g : N ⋊[φ] G).left = 1 := rfl #align semidirect_product.left_inr SemidirectProduct.left_inr @[simp] theorem right_inr (g : G) : (inr g : N ⋊[φ] G).right = g := rfl #align semidirect_product.right_inr SemidirectProduct.right_inr theorem inr_injective : Function.Injective (inr : G → N ⋊[φ] G) := Function.injective_iff_hasLeftInverse.2 ⟨right, right_inr⟩ #align semidirect_product.inr_injective SemidirectProduct.inr_injective @[simp] theorem inr_inj {g₁ g₂ : G} : (inr g₁ : N ⋊[φ] G) = inr g₂ ↔ g₁ = g₂ := inr_injective.eq_iff #align semidirect_product.inr_inj SemidirectProduct.inr_inj
Mathlib/GroupTheory/SemidirectProduct.lean
157
158
theorem inl_aut (g : G) (n : N) : (inl (φ g n) : N ⋊[φ] G) = inr g * inl n * inr g⁻¹ := by
ext <;> simp
[ " (a * b * c).left = (a * (b * c)).left", " (a * b * c).right = (a * (b * c)).right", " (1 * a).left = a.left", " (a * 1).left = a.left", " (a⁻¹ * a).left = left 1", " (a⁻¹ * a).right = right 1", " ∀ (x y : N),\n { toFun := fun n => { left := n, right := 1 }, map_one' := ⋯ }.toFun (x * y) =\n { ...
[ " (a * b * c).left = (a * (b * c)).left", " (a * b * c).right = (a * (b * c)).right", " (1 * a).left = a.left", " (a * 1).left = a.left", " (a⁻¹ * a).left = left 1", " (a⁻¹ * a).right = right 1", " ∀ (x y : N),\n { toFun := fun n => { left := n, right := 1 }, map_one' := ⋯ }.toFun (x * y) =\n { ...
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic #align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" open Nat section Euler namespace ZMod variable (p : ℕ) [Fact p.Prime]
Mathlib/NumberTheory/LegendreSymbol/Basic.lean
48
57
theorem euler_criterion_units (x : (ZMod p)ˣ) : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ x ^ (p / 2) = 1 := by
by_cases hc : p = 2 · subst hc simp only [eq_iff_true_of_subsingleton, exists_const] · have h₀ := FiniteField.unit_isSquare_iff (by rwa [ringChar_zmod_n]) x have hs : (∃ y : (ZMod p)ˣ, y ^ 2 = x) ↔ IsSquare x := by rw [isSquare_iff_exists_sq x] simp_rw [eq_comm] rw [hs] rwa [card p] at h₀
[ " (∃ y, y ^ 2 = x) ↔ x ^ (p / 2) = 1", " (∃ y, y ^ 2 = x) ↔ x ^ (2 / 2) = 1", " ringChar (ZMod p) ≠ 2", " (∃ y, y ^ 2 = x) ↔ IsSquare x", " (∃ y, y ^ 2 = x) ↔ ∃ c, x = c ^ 2", " IsSquare x ↔ x ^ (p / 2) = 1" ]
[]
import Mathlib.Data.Nat.Defs import Mathlib.Tactic.GCongr.Core import Mathlib.Tactic.Common import Mathlib.Tactic.Monotonicity.Attr #align_import data.nat.factorial.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105" namespace Nat def factorial : ℕ → ℕ | 0 => 1 | succ n => succ n * factorial n #align nat.factorial Nat.factorial scoped notation:10000 n "!" => Nat.factorial n section Factorial variable {m n : ℕ} @[simp] theorem factorial_zero : 0! = 1 := rfl #align nat.factorial_zero Nat.factorial_zero theorem factorial_succ (n : ℕ) : (n + 1)! = (n + 1) * n ! := rfl #align nat.factorial_succ Nat.factorial_succ @[simp] theorem factorial_one : 1! = 1 := rfl #align nat.factorial_one Nat.factorial_one @[simp] theorem factorial_two : 2! = 2 := rfl #align nat.factorial_two Nat.factorial_two theorem mul_factorial_pred (hn : 0 < n) : n * (n - 1)! = n ! := Nat.sub_add_cancel (Nat.succ_le_of_lt hn) ▸ rfl #align nat.mul_factorial_pred Nat.mul_factorial_pred theorem factorial_pos : ∀ n, 0 < n ! | 0 => Nat.zero_lt_one | succ n => Nat.mul_pos (succ_pos _) (factorial_pos n) #align nat.factorial_pos Nat.factorial_pos theorem factorial_ne_zero (n : ℕ) : n ! ≠ 0 := ne_of_gt (factorial_pos _) #align nat.factorial_ne_zero Nat.factorial_ne_zero theorem factorial_dvd_factorial {m n} (h : m ≤ n) : m ! ∣ n ! := by induction' h with n _ ih · exact Nat.dvd_refl _ · exact Nat.dvd_trans ih (Nat.dvd_mul_left _ _) #align nat.factorial_dvd_factorial Nat.factorial_dvd_factorial theorem dvd_factorial : ∀ {m n}, 0 < m → m ≤ n → m ∣ n ! | succ _, _, _, h => Nat.dvd_trans (Nat.dvd_mul_right _ _) (factorial_dvd_factorial h) #align nat.dvd_factorial Nat.dvd_factorial @[mono, gcongr] theorem factorial_le {m n} (h : m ≤ n) : m ! ≤ n ! := le_of_dvd (factorial_pos _) (factorial_dvd_factorial h) #align nat.factorial_le Nat.factorial_le theorem factorial_mul_pow_le_factorial : ∀ {m n : ℕ}, m ! * (m + 1) ^ n ≤ (m + n)! | m, 0 => by simp | m, n + 1 => by rw [← Nat.add_assoc, factorial_succ, Nat.mul_comm (_ + 1), Nat.pow_succ, ← Nat.mul_assoc] exact Nat.mul_le_mul factorial_mul_pow_le_factorial (succ_le_succ (le_add_right _ _)) #align nat.factorial_mul_pow_le_factorial Nat.factorial_mul_pow_le_factorial theorem factorial_lt (hn : 0 < n) : n ! < m ! ↔ n < m := by refine ⟨fun h => not_le.mp fun hmn => Nat.not_le_of_lt h (factorial_le hmn), fun h => ?_⟩ have : ∀ {n}, 0 < n → n ! < (n + 1)! := by intro k hk rw [factorial_succ, succ_mul, Nat.lt_add_left_iff_pos] exact Nat.mul_pos hk k.factorial_pos induction' h with k hnk ih generalizing hn · exact this hn · exact lt_trans (ih hn) $ this <| lt_trans hn <| lt_of_succ_le hnk #align nat.factorial_lt Nat.factorial_lt @[gcongr] lemma factorial_lt_of_lt {m n : ℕ} (hn : 0 < n) (h : n < m) : n ! < m ! := (factorial_lt hn).mpr h @[simp] lemma one_lt_factorial : 1 < n ! ↔ 1 < n := factorial_lt Nat.one_pos #align nat.one_lt_factorial Nat.one_lt_factorial @[simp] theorem factorial_eq_one : n ! = 1 ↔ n ≤ 1 := by constructor · intro h rw [← not_lt, ← one_lt_factorial, h] apply lt_irrefl · rintro (_|_|_) <;> rfl #align nat.factorial_eq_one Nat.factorial_eq_one theorem factorial_inj (hn : 1 < n) : n ! = m ! ↔ n = m := by refine ⟨fun h => ?_, congr_arg _⟩ obtain hnm | rfl | hnm := lt_trichotomy n m · rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm cases lt_irrefl _ hnm · rfl rw [← one_lt_factorial, h, one_lt_factorial] at hn rw [← factorial_lt <| lt_of_succ_lt hn, h] at hnm cases lt_irrefl _ hnm #align nat.factorial_inj Nat.factorial_inj theorem factorial_inj' (h : 1 < n ∨ 1 < m) : n ! = m ! ↔ n = m := by obtain hn|hm := h · exact factorial_inj hn · rw [eq_comm, factorial_inj hm, eq_comm] theorem self_le_factorial : ∀ n : ℕ, n ≤ n ! | 0 => Nat.zero_le _ | k + 1 => Nat.le_mul_of_pos_right _ (Nat.one_le_of_lt k.factorial_pos) #align nat.self_le_factorial Nat.self_le_factorial
Mathlib/Data/Nat/Factorial/Basic.lean
142
147
theorem lt_factorial_self {n : ℕ} (hi : 3 ≤ n) : n < n ! := by
have : 0 < n := by omega have hn : 1 < pred n := le_pred_of_lt (succ_le_iff.mp hi) rw [← succ_pred_eq_of_pos ‹0 < n›, factorial_succ] exact (Nat.lt_mul_iff_one_lt_right (pred n).succ_pos).2 ((Nat.lt_of_lt_of_le hn (self_le_factorial _)))
[ " m ! ∣ n !", " m ! ∣ m !", " m ! ∣ n.succ !", " m ! * (m + 1) ^ 0 ≤ (m + 0)!", " m ! * (m + 1) ^ (n + 1) ≤ (m + (n + 1))!", " m ! * (m + 1) ^ n * (m + 1) ≤ (m + n)! * (m + n + 1)", " n ! < m ! ↔ n < m", " n ! < m !", " ∀ {n : ℕ}, 0 < n → n ! < (n + 1)!", " k ! < (k + 1)!", " 0 < k * k !", " n...
[ " m ! ∣ n !", " m ! ∣ m !", " m ! ∣ n.succ !", " m ! * (m + 1) ^ 0 ≤ (m + 0)!", " m ! * (m + 1) ^ (n + 1) ≤ (m + (n + 1))!", " m ! * (m + 1) ^ n * (m + 1) ≤ (m + n)! * (m + n + 1)", " n ! < m ! ↔ n < m", " n ! < m !", " ∀ {n : ℕ}, 0 < n → n ! < (n + 1)!", " k ! < (k + 1)!", " 0 < k * k !", " n...
import Mathlib.NumberTheory.NumberField.ClassNumber import Mathlib.NumberTheory.Cyclotomic.Rat import Mathlib.NumberTheory.Cyclotomic.Embeddings universe u namespace IsCyclotomicExtension.Rat open NumberField Polynomial InfinitePlace Nat Real cyclotomic variable (K : Type u) [Field K] [NumberField K] theorem three_pid [IsCyclotomicExtension {3} ℚ K] : IsPrincipalIdealRing (𝓞 K) := by apply RingOfIntegers.isPrincipalIdealRing_of_abs_discr_lt rw [absdiscr_prime 3 K, IsCyclotomicExtension.finrank (n := 3) K (irreducible_rat (by norm_num)), nrComplexPlaces_eq_totient_div_two 3, totient_prime PNat.prime_three] simp only [Int.reduceNeg, PNat.val_ofNat, succ_sub_succ_eq_sub, tsub_zero, zero_lt_two, Nat.div_self, pow_one, cast_ofNat, neg_mul, one_mul, abs_neg, Int.cast_abs, Int.cast_ofNat, factorial_two, gt_iff_lt, abs_of_pos (show (0 : ℝ) < 3 by norm_num)] suffices (2 * (3 / 4) * (2 ^ 2 / 2)) ^ 2 < (2 * (π / 4) * (2 ^ 2 / 2)) ^ 2 from lt_trans (by norm_num) this gcongr exact pi_gt_three
Mathlib/NumberTheory/Cyclotomic/PID.lean
44
55
theorem five_pid [IsCyclotomicExtension {5} ℚ K] : IsPrincipalIdealRing (𝓞 K) := by
apply RingOfIntegers.isPrincipalIdealRing_of_abs_discr_lt rw [absdiscr_prime 5 K, IsCyclotomicExtension.finrank (n := 5) K (irreducible_rat (by norm_num)), nrComplexPlaces_eq_totient_div_two 5, totient_prime PNat.prime_five] simp only [Int.reduceNeg, PNat.val_ofNat, succ_sub_succ_eq_sub, tsub_zero, reduceDiv, even_two, Even.neg_pow, one_pow, cast_ofNat, Int.reducePow, one_mul, Int.cast_abs, Int.cast_ofNat, div_pow, gt_iff_lt, show 4! = 24 by rfl, abs_of_pos (show (0 : ℝ) < 125 by norm_num)] suffices (2 * (3 ^ 2 / 4 ^ 2) * (4 ^ 4 / 24)) ^ 2 < (2 * (π ^ 2 / 4 ^ 2) * (4 ^ 4 / 24)) ^ 2 from lt_trans (by norm_num) this gcongr exact pi_gt_three
[ " IsPrincipalIdealRing (𝓞 K)", " ↑|discr K| <\n (2 * (π / 4) ^ NrComplexPlaces K *\n (↑(FiniteDimensional.finrank ℚ K) ^ FiniteDimensional.finrank ℚ K / ↑(FiniteDimensional.finrank ℚ K)!)) ^\n 2", " 0 < ↑3", " ↑|(-1) ^ ((↑3 - 1) / 2) * ↑↑3 ^ (↑3 - 2)| < (2 * (π / 4) ^ ((↑3 - 1) / 2) * (↑(↑3 - ...
[ " IsPrincipalIdealRing (𝓞 K)", " ↑|discr K| <\n (2 * (π / 4) ^ NrComplexPlaces K *\n (↑(FiniteDimensional.finrank ℚ K) ^ FiniteDimensional.finrank ℚ K / ↑(FiniteDimensional.finrank ℚ K)!)) ^\n 2", " 0 < ↑3", " ↑|(-1) ^ ((↑3 - 1) / 2) * ↑↑3 ^ (↑3 - 2)| < (2 * (π / 4) ^ ((↑3 - 1) / 2) * (↑(↑3 - ...
import Mathlib.GroupTheory.Sylow import Mathlib.GroupTheory.Transfer #align_import group_theory.schur_zassenhaus from "leanprover-community/mathlib"@"d57133e49cf06508700ef69030cd099917e0f0de" namespace Subgroup section SchurZassenhausAbelian open MulOpposite MulAction Subgroup.leftTransversals MemLeftTransversals variable {G : Type*} [Group G] (H : Subgroup G) [IsCommutative H] [FiniteIndex H] (α β : leftTransversals (H : Set G)) def QuotientDiff := Quotient (Setoid.mk (fun α β => diff (MonoidHom.id H) α β = 1) ⟨fun α => diff_self (MonoidHom.id H) α, fun h => by rw [← diff_inv, h, inv_one], fun h h' => by rw [← diff_mul_diff, h, h', one_mul]⟩) #align subgroup.quotient_diff Subgroup.QuotientDiff instance : Inhabited H.QuotientDiff := by dsimp [QuotientDiff] -- Porting note: Added `dsimp` infer_instance theorem smul_diff_smul' [hH : Normal H] (g : Gᵐᵒᵖ) : diff (MonoidHom.id H) (g • α) (g • β) = ⟨g.unop⁻¹ * (diff (MonoidHom.id H) α β : H) * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ := by letI := H.fintypeQuotientOfFiniteIndex let ϕ : H →* H := { toFun := fun h => ⟨g.unop⁻¹ * h * g.unop, hH.mem_comm ((congr_arg (· ∈ H) (mul_inv_cancel_left _ _)).mpr (SetLike.coe_mem _))⟩ map_one' := by rw [Subtype.ext_iff, coe_mk, coe_one, mul_one, inv_mul_self] map_mul' := fun h₁ h₂ => by simp only [Subtype.ext_iff, coe_mk, coe_mul, mul_assoc, mul_inv_cancel_left] } refine (Fintype.prod_equiv (MulAction.toPerm g).symm _ _ fun x ↦ ?_).trans (map_prod ϕ _ _).symm simp only [ϕ, smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, mul_inv_rev, mul_assoc, MonoidHom.id_apply, toPerm_symm_apply, MonoidHom.coe_mk, OneHom.coe_mk] #align subgroup.smul_diff_smul' Subgroup.smul_diff_smul' variable {H} [Normal H] noncomputable instance : MulAction G H.QuotientDiff where smul g := Quotient.map' (fun α => op g⁻¹ • α) fun α β h => Subtype.ext (by rwa [smul_diff_smul', coe_mk, coe_one, mul_eq_one_iff_eq_inv, mul_right_eq_self, ← coe_one, ← Subtype.ext_iff]) mul_smul g₁ g₂ q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [mul_inv_rev]; exact mul_smul (op g₁⁻¹) (op g₂⁻¹) T) one_smul q := Quotient.inductionOn' q fun T => congr_arg Quotient.mk'' (by rw [inv_one]; apply one_smul Gᵐᵒᵖ T)
Mathlib/GroupTheory/SchurZassenhaus.lean
81
89
theorem smul_diff' (h : H) : diff (MonoidHom.id H) α (op (h : G) • β) = diff (MonoidHom.id H) α β * h ^ H.index := by
letI := H.fintypeQuotientOfFiniteIndex rw [diff, diff, index_eq_card, ← Finset.card_univ, ← Finset.prod_const, ← Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun q _ => ?_ simp_rw [Subtype.ext_iff, MonoidHom.id_apply, coe_mul, mul_assoc, mul_right_inj] rw [smul_apply_eq_smul_apply_inv_smul, smul_eq_mul_unop, MulOpposite.unop_op, mul_left_inj, ← Subtype.ext_iff, Equiv.apply_eq_iff_eq, inv_smul_eq_iff] exact self_eq_mul_right.mpr ((QuotientGroup.eq_one_iff _).mpr h.2)
[ " diff (MonoidHom.id ↥H) y✝ x✝ = 1", " diff (MonoidHom.id ↥H) x✝ z✝ = 1", " Inhabited H.QuotientDiff", " Inhabited (Quotient { r := fun α β => diff (MonoidHom.id ↥H) α β = 1, iseqv := ⋯ })", " diff (MonoidHom.id ↥H) (g • α) (g • β) = ⟨g.unop⁻¹ * ↑(diff (MonoidHom.id ↥H) α β) * g.unop, ⋯⟩", " (fun h => ⟨g....
[ " diff (MonoidHom.id ↥H) y✝ x✝ = 1", " diff (MonoidHom.id ↥H) x✝ z✝ = 1", " Inhabited H.QuotientDiff", " Inhabited (Quotient { r := fun α β => diff (MonoidHom.id ↥H) α β = 1, iseqv := ⋯ })", " diff (MonoidHom.id ↥H) (g • α) (g • β) = ⟨g.unop⁻¹ * ↑(diff (MonoidHom.id ↥H) α β) * g.unop, ⋯⟩", " (fun h => ⟨g....
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products import Mathlib.CategoryTheory.Limits.ConcreteCategory import Mathlib.CategoryTheory.Limits.Shapes.Types import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer import Mathlib.CategoryTheory.Limits.Shapes.Kernels universe w v u t r namespace CategoryTheory.Limits.Concrete attribute [local instance] ConcreteCategory.instFunLike ConcreteCategory.hasCoeToSort variable {C : Type u} [Category.{v} C] section Products section WidePullback variable [ConcreteCategory.{max w v} C] open WidePullback open WidePullbackShape theorem widePullback_ext {B : C} {ι : Type w} {X : ι → C} (f : ∀ j : ι, X j ⟶ B) [HasWidePullback B X f] [PreservesLimit (wideCospan B X f) (forget C)] (x y : ↑(widePullback B X f)) (h₀ : base f x = base f y) (h : ∀ j, π f j x = π f j y) : x = y := by apply Concrete.limit_ext rintro (_ | j) · exact h₀ · apply h #align category_theory.limits.concrete.wide_pullback_ext CategoryTheory.Limits.Concrete.widePullback_ext
Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean
237
243
theorem widePullback_ext' {B : C} {ι : Type w} [Nonempty ι] {X : ι → C} (f : ∀ j : ι, X j ⟶ B) [HasWidePullback.{w} B X f] [PreservesLimit (wideCospan B X f) (forget C)] (x y : ↑(widePullback B X f)) (h : ∀ j, π f j x = π f j y) : x = y := by
apply Concrete.widePullback_ext _ _ _ _ h inhabit ι simp only [← π_arrow f default, comp_apply, h]
[ " x = y", " ∀ (j : WidePullbackShape ι), (limit.π (wideCospan B X f) j) x = (limit.π (wideCospan B X f) j) y", " (limit.π (wideCospan B X f) none) x = (limit.π (wideCospan B X f) none) y", " (limit.π (wideCospan B X f) (some j)) x = (limit.π (wideCospan B X f) (some j)) y", " (base f) x = (base f) y" ]
[ " x = y", " ∀ (j : WidePullbackShape ι), (limit.π (wideCospan B X f) j) x = (limit.π (wideCospan B X f) j) y", " (limit.π (wideCospan B X f) none) x = (limit.π (wideCospan B X f) none) y", " (limit.π (wideCospan B X f) (some j)) x = (limit.π (wideCospan B X f) (some j)) y" ]
import Mathlib.LinearAlgebra.Dimension.Basic import Mathlib.SetTheory.Cardinal.ToNat #align_import linear_algebra.finrank from "leanprover-community/mathlib"@"347636a7a80595d55bedf6e6fbd996a3c39da69a" universe u v w open Cardinal Submodule Module Function variable {R : Type u} {M : Type v} {N : Type w} variable [Ring R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] namespace FiniteDimensional section Ring noncomputable def finrank (R M : Type*) [Semiring R] [AddCommGroup M] [Module R M] : ℕ := Cardinal.toNat (Module.rank R M) #align finite_dimensional.finrank FiniteDimensional.finrank theorem finrank_eq_of_rank_eq {n : ℕ} (h : Module.rank R M = ↑n) : finrank R M = n := by apply_fun toNat at h rw [toNat_natCast] at h exact mod_cast h #align finite_dimensional.finrank_eq_of_rank_eq FiniteDimensional.finrank_eq_of_rank_eq lemma rank_eq_one_iff_finrank_eq_one : Module.rank R M = 1 ↔ finrank R M = 1 := Cardinal.toNat_eq_one.symm lemma rank_eq_ofNat_iff_finrank_eq_ofNat (n : ℕ) [Nat.AtLeastTwo n] : Module.rank R M = OfNat.ofNat n ↔ finrank R M = OfNat.ofNat n := Cardinal.toNat_eq_ofNat.symm theorem finrank_le_of_rank_le {n : ℕ} (h : Module.rank R M ≤ ↑n) : finrank R M ≤ n := by rwa [← Cardinal.toNat_le_iff_le_of_lt_aleph0, toNat_natCast] at h · exact h.trans_lt (nat_lt_aleph0 n) · exact nat_lt_aleph0 n #align finite_dimensional.finrank_le_of_rank_le FiniteDimensional.finrank_le_of_rank_le theorem finrank_lt_of_rank_lt {n : ℕ} (h : Module.rank R M < ↑n) : finrank R M < n := by rwa [← Cardinal.toNat_lt_iff_lt_of_lt_aleph0, toNat_natCast] at h · exact h.trans (nat_lt_aleph0 n) · exact nat_lt_aleph0 n #align finite_dimensional.finrank_lt_of_rank_lt FiniteDimensional.finrank_lt_of_rank_lt
Mathlib/LinearAlgebra/Dimension/Finrank.lean
84
89
theorem lt_rank_of_lt_finrank {n : ℕ} (h : n < finrank R M) : ↑n < Module.rank R M := by
rwa [← Cardinal.toNat_lt_iff_lt_of_lt_aleph0, toNat_natCast] · exact nat_lt_aleph0 n · contrapose! h rw [finrank, Cardinal.toNat_apply_of_aleph0_le h] exact n.zero_le
[ " finrank R M = n", " finrank R M ≤ n", " Module.rank R M < ℵ₀", " ↑n < ℵ₀", " finrank R M < n", " ↑n < Module.rank R M", " 0 ≤ n" ]
[ " finrank R M = n", " finrank R M ≤ n", " Module.rank R M < ℵ₀", " ↑n < ℵ₀", " finrank R M < n" ]
import Mathlib.Algebra.Order.Group.Basic import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Algebra.Order.Ring.Basic import Mathlib.Algebra.Ring.Nat import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.OrderOfElement import Mathlib.RingTheory.Fintype import Mathlib.Tactic.IntervalCases #align_import number_theory.lucas_lehmer from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1" def mersenne (p : ℕ) : ℕ := 2 ^ p - 1 #align mersenne mersenne theorem strictMono_mersenne : StrictMono mersenne := fun m n h ↦ (Nat.sub_lt_sub_iff_right <| Nat.one_le_pow _ _ two_pos).2 <| by gcongr; norm_num1 @[simp] theorem mersenne_lt_mersenne {p q : ℕ} : mersenne p < mersenne q ↔ p < q := strictMono_mersenne.lt_iff_lt @[gcongr] protected alias ⟨_, GCongr.mersenne_lt_mersenne⟩ := mersenne_lt_mersenne @[simp] theorem mersenne_le_mersenne {p q : ℕ} : mersenne p ≤ mersenne q ↔ p ≤ q := strictMono_mersenne.le_iff_le @[gcongr] protected alias ⟨_, GCongr.mersenne_le_mersenne⟩ := mersenne_le_mersenne @[simp] theorem mersenne_zero : mersenne 0 = 0 := rfl @[simp] theorem mersenne_pos {p : ℕ} : 0 < mersenne p ↔ 0 < p := mersenne_lt_mersenne (p := 0) #align mersenne_pos mersenne_pos @[simp] theorem one_lt_mersenne {p : ℕ} : 1 < mersenne p ↔ 1 < p := mersenne_lt_mersenne (p := 1) @[simp] theorem succ_mersenne (k : ℕ) : mersenne k + 1 = 2 ^ k := by rw [mersenne, tsub_add_cancel_of_le] exact one_le_pow_of_one_le (by norm_num) k #align succ_mersenne succ_mersenne namespace LucasLehmer open Nat def s : ℕ → ℤ | 0 => 4 | i + 1 => s i ^ 2 - 2 #align lucas_lehmer.s LucasLehmer.s def sZMod (p : ℕ) : ℕ → ZMod (2 ^ p - 1) | 0 => 4 | i + 1 => sZMod p i ^ 2 - 2 #align lucas_lehmer.s_zmod LucasLehmer.sZMod def sMod (p : ℕ) : ℕ → ℤ | 0 => 4 % (2 ^ p - 1) | i + 1 => (sMod p i ^ 2 - 2) % (2 ^ p - 1) #align lucas_lehmer.s_mod LucasLehmer.sMod theorem mersenne_int_pos {p : ℕ} (hp : p ≠ 0) : (0 : ℤ) < 2 ^ p - 1 := sub_pos.2 <| mod_cast Nat.one_lt_two_pow hp theorem mersenne_int_ne_zero (p : ℕ) (hp : p ≠ 0) : (2 ^ p - 1 : ℤ) ≠ 0 := (mersenne_int_pos hp).ne' #align lucas_lehmer.mersenne_int_ne_zero LucasLehmer.mersenne_int_ne_zero theorem sMod_nonneg (p : ℕ) (hp : p ≠ 0) (i : ℕ) : 0 ≤ sMod p i := by cases i <;> dsimp [sMod] · exact sup_eq_right.mp rfl · apply Int.emod_nonneg exact mersenne_int_ne_zero p hp #align lucas_lehmer.s_mod_nonneg LucasLehmer.sMod_nonneg theorem sMod_mod (p i : ℕ) : sMod p i % (2 ^ p - 1) = sMod p i := by cases i <;> simp [sMod] #align lucas_lehmer.s_mod_mod LucasLehmer.sMod_mod theorem sMod_lt (p : ℕ) (hp : p ≠ 0) (i : ℕ) : sMod p i < 2 ^ p - 1 := by rw [← sMod_mod] refine (Int.emod_lt _ (mersenne_int_ne_zero p hp)).trans_eq ?_ exact abs_of_nonneg (mersenne_int_pos hp).le #align lucas_lehmer.s_mod_lt LucasLehmer.sMod_lt theorem sZMod_eq_s (p' : ℕ) (i : ℕ) : sZMod (p' + 2) i = (s i : ZMod (2 ^ (p' + 2) - 1)) := by induction' i with i ih · dsimp [s, sZMod] norm_num · push_cast [s, sZMod, ih]; rfl #align lucas_lehmer.s_zmod_eq_s LucasLehmer.sZMod_eq_s -- These next two don't make good `norm_cast` lemmas.
Mathlib/NumberTheory/LucasLehmer.lean
162
164
theorem Int.natCast_pow_pred (b p : ℕ) (w : 0 < b) : ((b ^ p - 1 : ℕ) : ℤ) = (b : ℤ) ^ p - 1 := by
have : 1 ≤ b ^ p := Nat.one_le_pow p b w norm_cast
[ " 2 ^ m < 2 ^ n", " 1 < 2", " mersenne k + 1 = 2 ^ k", " 1 ≤ 2 ^ k", " 1 ≤ 2", " 0 ≤ sMod p i", " 0 ≤ sMod p 0", " 0 ≤ sMod p (n✝ + 1)", " 0 ≤ 4 % (2 ^ p - 1)", " 0 ≤ (sMod p n✝ ^ 2 - 2) % (2 ^ p - 1)", " 2 ^ p - 1 ≠ 0", " sMod p i % (2 ^ p - 1) = sMod p i", " sMod p 0 % (2 ^ p - 1) = sMod p...
[ " 2 ^ m < 2 ^ n", " 1 < 2", " mersenne k + 1 = 2 ^ k", " 1 ≤ 2 ^ k", " 1 ≤ 2", " 0 ≤ sMod p i", " 0 ≤ sMod p 0", " 0 ≤ sMod p (n✝ + 1)", " 0 ≤ 4 % (2 ^ p - 1)", " 0 ≤ (sMod p n✝ ^ 2 - 2) % (2 ^ p - 1)", " 2 ^ p - 1 ≠ 0", " sMod p i % (2 ^ p - 1) = sMod p i", " sMod p 0 % (2 ^ p - 1) = sMod p...
import Mathlib.Algebra.Group.Commute.Basic import Mathlib.Data.Fintype.Card import Mathlib.GroupTheory.Perm.Basic #align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Equiv Finset namespace Equiv.Perm variable {α : Type*} section support variable [DecidableEq α] [Fintype α] {f g : Perm α} def support (f : Perm α) : Finset α := univ.filter fun x => f x ≠ x #align equiv.perm.support Equiv.Perm.support @[simp] theorem mem_support {x : α} : x ∈ f.support ↔ f x ≠ x := by rw [support, mem_filter, and_iff_right (mem_univ x)] #align equiv.perm.mem_support Equiv.Perm.mem_support
Mathlib/GroupTheory/Perm/Support.lean
301
301
theorem not_mem_support {x : α} : x ∉ f.support ↔ f x = x := by
simp
[ " x ∈ f.support ↔ f x ≠ x", " x ∉ f.support ↔ f x = x" ]
[ " x ∈ f.support ↔ f x ≠ x" ]
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp] theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop] #align list.rdrop_nil List.rdrop_nil @[simp] theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop] #align list.rdrop_zero List.rdrop_zero theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by rw [rdrop] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · simp [take_append] · simp [take_append_eq_append_take, IH] #align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse @[simp] theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by simp [rdrop_eq_reverse_drop_reverse] #align list.rdrop_concat_succ List.rdrop_concat_succ def rtake : List α := l.drop (l.length - n) #align list.rtake List.rtake @[simp] theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake] #align list.rtake_nil List.rtake_nil @[simp] theorem rtake_zero : rtake l 0 = [] := by simp [rtake] #align list.rtake_zero List.rtake_zero theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by rw [rtake] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · exact drop_length _ · simp [drop_append_eq_append_drop, IH] #align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse @[simp] theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by simp [rtake_eq_reverse_take_reverse] #align list.rtake_concat_succ List.rtake_concat_succ def rdropWhile : List α := reverse (l.reverse.dropWhile p) #align list.rdrop_while List.rdropWhile @[simp]
Mathlib/Data/List/DropRight.lean
102
102
theorem rdropWhile_nil : rdropWhile p ([] : List α) = [] := by
simp [rdropWhile, dropWhile]
[ " [].rdrop n = []", " l.rdrop 0 = l", " l.rdrop n = (drop n l.reverse).reverse", " take (l.length - n) l = (drop n l.reverse).reverse", " take ([].length - n) [] = (drop n [].reverse).reverse", " take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse", " take ((xs ++ [x]).lengt...
[ " [].rdrop n = []", " l.rdrop 0 = l", " l.rdrop n = (drop n l.reverse).reverse", " take (l.length - n) l = (drop n l.reverse).reverse", " take ([].length - n) [] = (drop n [].reverse).reverse", " take ((xs ++ [x]).length - n) (xs ++ [x]) = (drop n (xs ++ [x]).reverse).reverse", " take ((xs ++ [x]).lengt...
import Mathlib.Init.Function import Mathlib.Init.Order.Defs #align_import data.bool.basic from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" namespace Bool @[deprecated (since := "2024-06-07")] alias decide_True := decide_true_eq_true #align bool.to_bool_true decide_true_eq_true @[deprecated (since := "2024-06-07")] alias decide_False := decide_false_eq_false #align bool.to_bool_false decide_false_eq_false #align bool.to_bool_coe Bool.decide_coe @[deprecated (since := "2024-06-07")] alias coe_decide := decide_eq_true_iff #align bool.coe_to_bool decide_eq_true_iff @[deprecated decide_eq_true_iff (since := "2024-06-07")] alias of_decide_iff := decide_eq_true_iff #align bool.of_to_bool_iff decide_eq_true_iff #align bool.tt_eq_to_bool_iff true_eq_decide_iff #align bool.ff_eq_to_bool_iff false_eq_decide_iff @[deprecated (since := "2024-06-07")] alias decide_not := decide_not #align bool.to_bool_not decide_not #align bool.to_bool_and Bool.decide_and #align bool.to_bool_or Bool.decide_or #align bool.to_bool_eq decide_eq_decide @[deprecated (since := "2024-06-07")] alias not_false' := false_ne_true #align bool.not_ff Bool.false_ne_true @[deprecated (since := "2024-06-07")] alias eq_iff_eq_true_iff := eq_iff_iff #align bool.default_bool Bool.default_bool theorem dichotomy (b : Bool) : b = false ∨ b = true := by cases b <;> simp #align bool.dichotomy Bool.dichotomy theorem forall_bool' {p : Bool → Prop} (b : Bool) : (∀ x, p x) ↔ p b ∧ p !b := ⟨fun h ↦ ⟨h _, h _⟩, fun ⟨h₁, h₂⟩ x ↦ by cases b <;> cases x <;> assumption⟩ @[simp] theorem forall_bool {p : Bool → Prop} : (∀ b, p b) ↔ p false ∧ p true := forall_bool' false #align bool.forall_bool Bool.forall_bool theorem exists_bool' {p : Bool → Prop} (b : Bool) : (∃ x, p x) ↔ p b ∨ p !b := ⟨fun ⟨x, hx⟩ ↦ by cases x <;> cases b <;> first | exact .inl ‹_› | exact .inr ‹_›, fun h ↦ by cases h <;> exact ⟨_, ‹_›⟩⟩ @[simp] theorem exists_bool {p : Bool → Prop} : (∃ b, p b) ↔ p false ∨ p true := exists_bool' false #align bool.exists_bool Bool.exists_bool #align bool.decidable_forall_bool Bool.instDecidableForallOfDecidablePred #align bool.decidable_exists_bool Bool.instDecidableExistsOfDecidablePred #align bool.cond_eq_ite Bool.cond_eq_ite #align bool.cond_to_bool Bool.cond_decide #align bool.cond_bnot Bool.cond_not theorem not_ne_id : not ≠ id := fun h ↦ false_ne_true <| congrFun h true #align bool.bnot_ne_id Bool.not_ne_id #align bool.coe_bool_iff Bool.coe_iff_coe @[deprecated (since := "2024-06-07")] alias eq_true_of_ne_false := eq_true_of_ne_false #align bool.eq_tt_of_ne_ff eq_true_of_ne_false @[deprecated (since := "2024-06-07")] alias eq_false_of_ne_true := eq_false_of_ne_true #align bool.eq_ff_of_ne_tt eq_true_of_ne_false #align bool.bor_comm Bool.or_comm #align bool.bor_assoc Bool.or_assoc #align bool.bor_left_comm Bool.or_left_comm
Mathlib/Data/Bool/Basic.lean
99
99
theorem or_inl {a b : Bool} (H : a) : a || b := by
simp [H]
[ " b = false ∨ b = true", " false = false ∨ false = true", " true = false ∨ true = true", " p x", " p false", " p true", " p b ∨ p !b", " p false ∨ p !false", " p true ∨ p !true", " ∃ x, p x", " (a || b) = true" ]
[ " b = false ∨ b = true", " false = false ∨ false = true", " true = false ∨ true = true", " p x", " p false", " p true", " p b ∨ p !b", " p false ∨ p !false", " p true ∨ p !true", " ∃ x, p x" ]
import Mathlib.Data.List.Nodup #align_import data.list.duplicate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" variable {α : Type*} namespace List inductive Duplicate (x : α) : List α → Prop | cons_mem {l : List α} : x ∈ l → Duplicate x (x :: l) | cons_duplicate {y : α} {l : List α} : Duplicate x l → Duplicate x (y :: l) #align list.duplicate List.Duplicate local infixl:50 " ∈+ " => List.Duplicate variable {l : List α} {x : α} theorem Mem.duplicate_cons_self (h : x ∈ l) : x ∈+ x :: l := Duplicate.cons_mem h #align list.mem.duplicate_cons_self List.Mem.duplicate_cons_self theorem Duplicate.duplicate_cons (h : x ∈+ l) (y : α) : x ∈+ y :: l := Duplicate.cons_duplicate h #align list.duplicate.duplicate_cons List.Duplicate.duplicate_cons theorem Duplicate.mem (h : x ∈+ l) : x ∈ l := by induction' h with l' _ y l' _ hm · exact mem_cons_self _ _ · exact mem_cons_of_mem _ hm #align list.duplicate.mem List.Duplicate.mem theorem Duplicate.mem_cons_self (h : x ∈+ x :: l) : x ∈ l := by cases' h with _ h _ _ h · exact h · exact h.mem #align list.duplicate.mem_cons_self List.Duplicate.mem_cons_self @[simp] theorem duplicate_cons_self_iff : x ∈+ x :: l ↔ x ∈ l := ⟨Duplicate.mem_cons_self, Mem.duplicate_cons_self⟩ #align list.duplicate_cons_self_iff List.duplicate_cons_self_iff theorem Duplicate.ne_nil (h : x ∈+ l) : l ≠ [] := fun H => (mem_nil_iff x).mp (H ▸ h.mem) #align list.duplicate.ne_nil List.Duplicate.ne_nil @[simp] theorem not_duplicate_nil (x : α) : ¬x ∈+ [] := fun H => H.ne_nil rfl #align list.not_duplicate_nil List.not_duplicate_nil theorem Duplicate.ne_singleton (h : x ∈+ l) (y : α) : l ≠ [y] := by induction' h with l' h z l' h _ · simp [ne_nil_of_mem h] · simp [ne_nil_of_mem h.mem] #align list.duplicate.ne_singleton List.Duplicate.ne_singleton @[simp] theorem not_duplicate_singleton (x y : α) : ¬x ∈+ [y] := fun H => H.ne_singleton _ rfl #align list.not_duplicate_singleton List.not_duplicate_singleton theorem Duplicate.elim_nil (h : x ∈+ []) : False := not_duplicate_nil x h #align list.duplicate.elim_nil List.Duplicate.elim_nil theorem Duplicate.elim_singleton {y : α} (h : x ∈+ [y]) : False := not_duplicate_singleton x y h #align list.duplicate.elim_singleton List.Duplicate.elim_singleton theorem duplicate_cons_iff {y : α} : x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l := by refine ⟨fun h => ?_, fun h => ?_⟩ · cases' h with _ hm _ _ hm · exact Or.inl ⟨rfl, hm⟩ · exact Or.inr hm · rcases h with (⟨rfl | h⟩ | h) · simpa · exact h.cons_duplicate #align list.duplicate_cons_iff List.duplicate_cons_iff theorem Duplicate.of_duplicate_cons {y : α} (h : x ∈+ y :: l) (hx : x ≠ y) : x ∈+ l := by simpa [duplicate_cons_iff, hx.symm] using h #align list.duplicate.of_duplicate_cons List.Duplicate.of_duplicate_cons
Mathlib/Data/List/Duplicate.lean
102
103
theorem duplicate_cons_iff_of_ne {y : α} (hne : x ≠ y) : x ∈+ y :: l ↔ x ∈+ l := by
simp [duplicate_cons_iff, hne.symm]
[ " x ∈ l", " x ∈ x :: l'", " x ∈ y :: l'", " l ≠ [y]", " x :: l' ≠ [y]", " z :: l' ≠ [y]", " x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l", " y = x ∧ x ∈ l ∨ x ∈+ l", " x = x ∧ x ∈ l ∨ x ∈+ l", " x ∈+ y :: l", " x ∈+ x :: l", " x ∈+ l", " x ∈+ y :: l ↔ x ∈+ l" ]
[ " x ∈ l", " x ∈ x :: l'", " x ∈ y :: l'", " l ≠ [y]", " x :: l' ≠ [y]", " z :: l' ≠ [y]", " x ∈+ y :: l ↔ y = x ∧ x ∈ l ∨ x ∈+ l", " y = x ∧ x ∈ l ∨ x ∈+ l", " x = x ∧ x ∈ l ∨ x ∈+ l", " x ∈+ y :: l", " x ∈+ x :: l", " x ∈+ l" ]
import Mathlib.MeasureTheory.Integral.SetIntegral import Mathlib.Probability.Independence.Basic #align_import probability.integration from "leanprover-community/mathlib"@"2f8347015b12b0864dfaf366ec4909eb70c78740" noncomputable section open Set MeasureTheory open scoped ENNReal MeasureTheory variable {Ω : Type*} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} {f g : Ω → ℝ≥0∞} {X Y : Ω → ℝ} namespace ProbabilityTheory theorem lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator {Mf mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (c : ℝ≥0∞) {T : Set Ω} (h_meas_T : MeasurableSet T) (h_ind : IndepSets {s | MeasurableSet[Mf] s} {T} μ) (h_meas_f : Measurable[Mf] f) : (∫⁻ ω, f ω * T.indicator (fun _ => c) ω ∂μ) = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, T.indicator (fun _ => c) ω ∂μ := by revert f have h_mul_indicator : ∀ g, Measurable g → Measurable fun a => g a * T.indicator (fun _ => c) a := fun g h_mg => h_mg.mul (measurable_const.indicator h_meas_T) apply @Measurable.ennreal_induction _ Mf · intro c' s' h_meas_s' simp_rw [← inter_indicator_mul] rw [lintegral_indicator _ (MeasurableSet.inter (hMf _ h_meas_s') h_meas_T), lintegral_indicator _ (hMf _ h_meas_s'), lintegral_indicator _ h_meas_T] simp only [measurable_const, lintegral_const, univ_inter, lintegral_const_mul, MeasurableSet.univ, Measure.restrict_apply] rw [IndepSets_iff] at h_ind rw [mul_mul_mul_comm, h_ind s' T h_meas_s' (Set.mem_singleton _)] · intro f' g _ h_meas_f' _ h_ind_f' h_ind_g have h_measM_f' : Measurable f' := h_meas_f'.mono hMf le_rfl simp_rw [Pi.add_apply, right_distrib] rw [lintegral_add_left (h_mul_indicator _ h_measM_f'), lintegral_add_left h_measM_f', right_distrib, h_ind_f', h_ind_g] · intro f h_meas_f h_mono_f h_ind_f have h_measM_f : ∀ n, Measurable (f n) := fun n => (h_meas_f n).mono hMf le_rfl simp_rw [ENNReal.iSup_mul] rw [lintegral_iSup h_measM_f h_mono_f, lintegral_iSup, ENNReal.iSup_mul] · simp_rw [← h_ind_f] · exact fun n => h_mul_indicator _ (h_measM_f n) · exact fun m n h_le a => mul_le_mul_right' (h_mono_f h_le a) _ #align probability_theory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator ProbabilityTheory.lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator
Mathlib/Probability/Integration.lean
82
104
theorem lintegral_mul_eq_lintegral_mul_lintegral_of_independent_measurableSpace {Mf Mg mΩ : MeasurableSpace Ω} {μ : Measure Ω} (hMf : Mf ≤ mΩ) (hMg : Mg ≤ mΩ) (h_ind : Indep Mf Mg μ) (h_meas_f : Measurable[Mf] f) (h_meas_g : Measurable[Mg] g) : ∫⁻ ω, f ω * g ω ∂μ = (∫⁻ ω, f ω ∂μ) * ∫⁻ ω, g ω ∂μ := by
revert g have h_measM_f : Measurable f := h_meas_f.mono hMf le_rfl apply @Measurable.ennreal_induction _ Mg · intro c s h_s apply lintegral_mul_indicator_eq_lintegral_mul_lintegral_indicator hMf _ (hMg _ h_s) _ h_meas_f apply indepSets_of_indepSets_of_le_right h_ind rwa [singleton_subset_iff] · intro f' g _ h_measMg_f' _ h_ind_f' h_ind_g' have h_measM_f' : Measurable f' := h_measMg_f'.mono hMg le_rfl simp_rw [Pi.add_apply, left_distrib] rw [lintegral_add_left h_measM_f', lintegral_add_left (h_measM_f.mul h_measM_f'), left_distrib, h_ind_f', h_ind_g'] · intro f' h_meas_f' h_mono_f' h_ind_f' have h_measM_f' : ∀ n, Measurable (f' n) := fun n => (h_meas_f' n).mono hMg le_rfl simp_rw [ENNReal.mul_iSup] rw [lintegral_iSup, lintegral_iSup h_measM_f' h_mono_f', ENNReal.mul_iSup] · simp_rw [← h_ind_f'] · exact fun n => h_measM_f.mul (h_measM_f' n) · exact fun n m (h_le : n ≤ m) a => mul_le_mul_left' (h_mono_f' h_le a) _
[ " ∫⁻ (ω : Ω), f ω * T.indicator (fun x => c) ω ∂μ = (∫⁻ (ω : Ω), f ω ∂μ) * ∫⁻ (ω : Ω), T.indicator (fun x => c) ω ∂μ", " ∀ {f : Ω → ℝ≥0∞},\n Measurable f →\n ∫⁻ (ω : Ω), f ω * T.indicator (fun x => c) ω ∂μ = (∫⁻ (ω : Ω), f ω ∂μ) * ∫⁻ (ω : Ω), T.indicator (fun x => c) ω ∂μ", " ∀ (c_1 : ℝ≥0∞) ⦃s : Set Ω⦄,...
[ " ∫⁻ (ω : Ω), f ω * T.indicator (fun x => c) ω ∂μ = (∫⁻ (ω : Ω), f ω ∂μ) * ∫⁻ (ω : Ω), T.indicator (fun x => c) ω ∂μ", " ∀ {f : Ω → ℝ≥0∞},\n Measurable f →\n ∫⁻ (ω : Ω), f ω * T.indicator (fun x => c) ω ∂μ = (∫⁻ (ω : Ω), f ω ∂μ) * ∫⁻ (ω : Ω), T.indicator (fun x => c) ω ∂μ", " ∀ (c_1 : ℝ≥0∞) ⦃s : Set Ω⦄,...
import Mathlib.Data.List.Sort import Mathlib.Data.Multiset.Basic #align_import data.multiset.sort from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace Multiset open List variable {α : Type*} section sort variable (r : α → α → Prop) [DecidableRel r] [IsTrans α r] [IsAntisymm α r] [IsTotal α r] def sort (s : Multiset α) : List α := Quot.liftOn s (mergeSort r) fun _ _ h => eq_of_perm_of_sorted ((perm_mergeSort _ _).trans <| h.trans (perm_mergeSort _ _).symm) (sorted_mergeSort r _) (sorted_mergeSort r _) #align multiset.sort Multiset.sort @[simp] theorem coe_sort (l : List α) : sort r l = mergeSort r l := rfl #align multiset.coe_sort Multiset.coe_sort @[simp] theorem sort_sorted (s : Multiset α) : Sorted r (sort r s) := Quot.inductionOn s fun _l => sorted_mergeSort r _ #align multiset.sort_sorted Multiset.sort_sorted @[simp] theorem sort_eq (s : Multiset α) : ↑(sort r s) = s := Quot.inductionOn s fun _ => Quot.sound <| perm_mergeSort _ _ #align multiset.sort_eq Multiset.sort_eq @[simp]
Mathlib/Data/Multiset/Sort.lean
50
50
theorem mem_sort {s : Multiset α} {a : α} : a ∈ sort r s ↔ a ∈ s := by
rw [← mem_coe, sort_eq]
[ " a ∈ sort r s ↔ a ∈ s" ]
[]
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Data.List.MinMax import Mathlib.Algebra.Tropical.Basic import Mathlib.Order.ConditionallyCompleteLattice.Finset #align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" variable {R S : Type*} open Tropical Finset theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by induction' l with hd tl IH · simp · simp [← IH] #align list.trop_sum List.trop_sum theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) : trop s.sum = Multiset.prod (s.map trop) := Quotient.inductionOn s (by simpa using List.trop_sum) #align multiset.trop_sum Multiset.trop_sum theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S → R) : trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by convert Multiset.trop_sum (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align trop_sum trop_sum theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) : untrop l.prod = List.sum (l.map untrop) := by induction' l with hd tl IH · simp · simp [← IH] #align list.untrop_prod List.untrop_prod theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) : untrop s.prod = Multiset.sum (s.map untrop) := Quotient.inductionOn s (by simpa using List.untrop_prod) #align multiset.untrop_prod Multiset.untrop_prod theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S → Tropical R) : untrop (∏ i ∈ s, f i) = ∑ i ∈ s, untrop (f i) := by convert Multiset.untrop_prod (s.val.map f) simp only [Multiset.map_map, Function.comp_apply] rfl #align untrop_prod untrop_prod -- Porting note: replaced `coe` with `WithTop.some` in statement theorem List.trop_minimum [LinearOrder R] (l : List R) : trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by induction' l with hd tl IH · simp · simp [List.minimum_cons, ← IH] #align list.trop_minimum List.trop_minimum
Mathlib/Algebra/Tropical/BigOperators.lean
85
89
theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) : trop s.inf = Multiset.sum (s.map trop) := by
induction' s using Multiset.induction with s x IH · simp · simp [← IH]
[ " trop l.sum = (map trop l).prod", " trop [].sum = (map trop []).prod", " trop (hd :: tl).sum = (map trop (hd :: tl)).prod", " ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod", " trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)", " ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod", " ...
[ " trop l.sum = (map trop l).prod", " trop [].sum = (map trop []).prod", " trop (hd :: tl).sum = (map trop (hd :: tl)).prod", " ∀ (a : List R), trop (sum ⟦a⟧) = (map trop ⟦a⟧).prod", " trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i)", " ∏ i ∈ s, trop (f i) = (Multiset.map trop (Multiset.map f s.val)).prod", " ...
import Mathlib.Probability.Notation import Mathlib.Probability.Process.Stopping #align_import probability.martingale.basic from "leanprover-community/mathlib"@"ba074af83b6cf54c3104e59402b39410ddbd6dca" open TopologicalSpace Filter open scoped NNReal ENNReal MeasureTheory ProbabilityTheory namespace MeasureTheory variable {Ω E ι : Type*} [Preorder ι] {m0 : MeasurableSpace Ω} {μ : Measure Ω} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {f g : ι → Ω → E} {ℱ : Filtration ι m0} def Martingale (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop := Adapted ℱ f ∧ ∀ i j, i ≤ j → μ[f j|ℱ i] =ᵐ[μ] f i #align measure_theory.martingale MeasureTheory.Martingale def Supermartingale [LE E] (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop := Adapted ℱ f ∧ (∀ i j, i ≤ j → μ[f j|ℱ i] ≤ᵐ[μ] f i) ∧ ∀ i, Integrable (f i) μ #align measure_theory.supermartingale MeasureTheory.Supermartingale def Submartingale [LE E] (f : ι → Ω → E) (ℱ : Filtration ι m0) (μ : Measure Ω) : Prop := Adapted ℱ f ∧ (∀ i j, i ≤ j → f i ≤ᵐ[μ] μ[f j|ℱ i]) ∧ ∀ i, Integrable (f i) μ #align measure_theory.submartingale MeasureTheory.Submartingale theorem martingale_const (ℱ : Filtration ι m0) (μ : Measure Ω) [IsFiniteMeasure μ] (x : E) : Martingale (fun _ _ => x) ℱ μ := ⟨adapted_const ℱ _, fun i j _ => by rw [condexp_const (ℱ.le _)]⟩ #align measure_theory.martingale_const MeasureTheory.martingale_const theorem martingale_const_fun [OrderBot ι] (ℱ : Filtration ι m0) (μ : Measure Ω) [IsFiniteMeasure μ] {f : Ω → E} (hf : StronglyMeasurable[ℱ ⊥] f) (hfint : Integrable f μ) : Martingale (fun _ => f) ℱ μ := by refine ⟨fun i => hf.mono <| ℱ.mono bot_le, fun i j _ => ?_⟩ rw [condexp_of_stronglyMeasurable (ℱ.le _) (hf.mono <| ℱ.mono bot_le) hfint] #align measure_theory.martingale_const_fun MeasureTheory.martingale_const_fun variable (E) theorem martingale_zero (ℱ : Filtration ι m0) (μ : Measure Ω) : Martingale (0 : ι → Ω → E) ℱ μ := ⟨adapted_zero E ℱ, fun i j _ => by rw [Pi.zero_apply, condexp_zero]; simp⟩ #align measure_theory.martingale_zero MeasureTheory.martingale_zero variable {E} namespace Martingale protected theorem adapted (hf : Martingale f ℱ μ) : Adapted ℱ f := hf.1 #align measure_theory.martingale.adapted MeasureTheory.Martingale.adapted protected theorem stronglyMeasurable (hf : Martingale f ℱ μ) (i : ι) : StronglyMeasurable[ℱ i] (f i) := hf.adapted i #align measure_theory.martingale.strongly_measurable MeasureTheory.Martingale.stronglyMeasurable theorem condexp_ae_eq (hf : Martingale f ℱ μ) {i j : ι} (hij : i ≤ j) : μ[f j|ℱ i] =ᵐ[μ] f i := hf.2 i j hij #align measure_theory.martingale.condexp_ae_eq MeasureTheory.Martingale.condexp_ae_eq protected theorem integrable (hf : Martingale f ℱ μ) (i : ι) : Integrable (f i) μ := integrable_condexp.congr (hf.condexp_ae_eq (le_refl i)) #align measure_theory.martingale.integrable MeasureTheory.Martingale.integrable theorem setIntegral_eq [SigmaFiniteFiltration μ ℱ] (hf : Martingale f ℱ μ) {i j : ι} (hij : i ≤ j) {s : Set Ω} (hs : MeasurableSet[ℱ i] s) : ∫ ω in s, f i ω ∂μ = ∫ ω in s, f j ω ∂μ := by rw [← @setIntegral_condexp _ _ _ _ _ (ℱ i) m0 _ _ _ (ℱ.le i) _ (hf.integrable j) hs] refine setIntegral_congr_ae (ℱ.le i s hs) ?_ filter_upwards [hf.2 i j hij] with _ heq _ using heq.symm #align measure_theory.martingale.set_integral_eq MeasureTheory.Martingale.setIntegral_eq @[deprecated (since := "2024-04-17")] alias set_integral_eq := setIntegral_eq theorem add (hf : Martingale f ℱ μ) (hg : Martingale g ℱ μ) : Martingale (f + g) ℱ μ := by refine ⟨hf.adapted.add hg.adapted, fun i j hij => ?_⟩ exact (condexp_add (hf.integrable j) (hg.integrable j)).trans ((hf.2 i j hij).add (hg.2 i j hij)) #align measure_theory.martingale.add MeasureTheory.Martingale.add theorem neg (hf : Martingale f ℱ μ) : Martingale (-f) ℱ μ := ⟨hf.adapted.neg, fun i j hij => (condexp_neg (f j)).trans (hf.2 i j hij).neg⟩ #align measure_theory.martingale.neg MeasureTheory.Martingale.neg
Mathlib/Probability/Martingale/Basic.lean
128
129
theorem sub (hf : Martingale f ℱ μ) (hg : Martingale g ℱ μ) : Martingale (f - g) ℱ μ := by
rw [sub_eq_add_neg]; exact hf.add hg.neg
[ " μ[(fun x_1 x_2 => x) j|↑ℱ i] =ᶠ[ae μ] (fun x_1 x_2 => x) i", " Martingale (fun x => f) ℱ μ", " μ[(fun x => f) j|↑ℱ i] =ᶠ[ae μ] (fun x => f) i", " μ[0 j|↑ℱ i] =ᶠ[ae μ] 0 i", " 0 =ᶠ[ae μ] 0 i", " ∫ (ω : Ω) in s, f i ω ∂μ = ∫ (ω : Ω) in s, f j ω ∂μ", " ∫ (ω : Ω) in s, f i ω ∂μ = ∫ (x : Ω) in s, (μ[f j|↑ℱ...
[ " μ[(fun x_1 x_2 => x) j|↑ℱ i] =ᶠ[ae μ] (fun x_1 x_2 => x) i", " Martingale (fun x => f) ℱ μ", " μ[(fun x => f) j|↑ℱ i] =ᶠ[ae μ] (fun x => f) i", " μ[0 j|↑ℱ i] =ᶠ[ae μ] 0 i", " 0 =ᶠ[ae μ] 0 i", " ∫ (ω : Ω) in s, f i ω ∂μ = ∫ (ω : Ω) in s, f j ω ∂μ", " ∫ (ω : Ω) in s, f i ω ∂μ = ∫ (x : Ω) in s, (μ[f j|↑ℱ...
import Mathlib.Analysis.SpecialFunctions.Complex.Log import Mathlib.RingTheory.RootsOfUnity.Basic #align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" namespace Complex open Polynomial Real open scoped Nat Real theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) : IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by rw [IsPrimitiveRoot.iff_def] simp only [← exp_nat_mul, exp_eq_one_iff] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 constructor · use i field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)] · simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff, mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps] norm_cast rintro l k hk conv_rhs at hk => rw [mul_comm, ← mul_assoc] have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero] field_simp [hz] at hk norm_cast at hk have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left exact hi.symm.dvd_of_dvd_mul_left this #align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by simpa only [Nat.cast_one, one_div] using isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left #align complex.is_primitive_root_exp Complex.isPrimitiveRoot_exp theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) : IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ := by have hn0 : (n : ℂ) ≠ 0 := mod_cast hn constructor; swap · rintro ⟨i, -, hi, rfl⟩; exact isPrimitiveRoot_exp_of_coprime i n hn hi intro h obtain ⟨i, hi, rfl⟩ := (isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one (Nat.pos_of_ne_zero hn) refine ⟨i, hi, ((isPrimitiveRoot_exp n hn).pow_iff_coprime (Nat.pos_of_ne_zero hn) i).mp h, ?_⟩ rw [← exp_nat_mul] congr 1 field_simp [hn0, mul_comm (i : ℂ)] #align complex.is_primitive_root_iff Complex.isPrimitiveRoot_iff nonrec theorem mem_rootsOfUnity (n : ℕ+) (x : Units ℂ) : x ∈ rootsOfUnity n ℂ ↔ ∃ i < (n : ℕ), exp (2 * π * I * (i / n)) = x := by rw [mem_rootsOfUnity, Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one] have hn0 : (n : ℂ) ≠ 0 := mod_cast n.ne_zero constructor · intro h obtain ⟨i, hi, H⟩ : ∃ i < (n : ℕ), exp (2 * π * I / n) ^ i = x := by simpa only using (isPrimitiveRoot_exp n n.ne_zero).eq_pow_of_pow_eq_one h n.pos refine ⟨i, hi, ?_⟩ rw [← H, ← exp_nat_mul] congr 1 field_simp [hn0, mul_comm (i : ℂ)] · rintro ⟨i, _, H⟩ rw [← H, ← exp_nat_mul, exp_eq_one_iff] use i field_simp [hn0, mul_comm ((n : ℕ) : ℂ), mul_comm (i : ℂ)] #align complex.mem_roots_of_unity Complex.mem_rootsOfUnity theorem card_rootsOfUnity (n : ℕ+) : Fintype.card (rootsOfUnity n ℂ) = n := (isPrimitiveRoot_exp n n.ne_zero).card_rootsOfUnity #align complex.card_roots_of_unity Complex.card_rootsOfUnity
Mathlib/RingTheory/RootsOfUnity/Complex.lean
96
99
theorem card_primitiveRoots (k : ℕ) : (primitiveRoots k ℂ).card = φ k := by
by_cases h : k = 0 · simp [h] exact (isPrimitiveRoot_exp k h).card_primitiveRoots
[ " IsPrimitiveRoot (cexp (2 * ↑π * I * (↑i / ↑n))) n", " cexp (2 * ↑π * I * (↑i / ↑n)) ^ n = 1 ∧ ∀ (l : ℕ), cexp (2 * ↑π * I * (↑i / ↑n)) ^ l = 1 → n ∣ l", " (∃ n_1, ↑n * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) ∧\n ∀ (l : ℕ), (∃ n_1, ↑l * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) → n ∣ l", " ∃...
[ " IsPrimitiveRoot (cexp (2 * ↑π * I * (↑i / ↑n))) n", " cexp (2 * ↑π * I * (↑i / ↑n)) ^ n = 1 ∧ ∀ (l : ℕ), cexp (2 * ↑π * I * (↑i / ↑n)) ^ l = 1 → n ∣ l", " (∃ n_1, ↑n * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) ∧\n ∀ (l : ℕ), (∃ n_1, ↑l * (2 * ↑π * I * (↑i / ↑n)) = ↑n_1 * (2 * ↑π * I)) → n ∣ l", " ∃...
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic import Mathlib.NumberTheory.GaussSum #align_import number_theory.legendre_symbol.quadratic_char.gauss_sum from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9" section SpecialValues open ZMod MulChar variable {F : Type*} [Field F] [Fintype F] theorem quadraticChar_two [DecidableEq F] (hF : ringChar F ≠ 2) : quadraticChar F 2 = χ₈ (Fintype.card F) := IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F) isQuadratic_χ₈ hF ((quadraticChar_eq_pow_of_char_ne_two' hF 2).trans (FiniteField.two_pow_card hF)) #align quadratic_char_two quadraticChar_two theorem FiniteField.isSquare_two_iff : IsSquare (2 : F) ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (Ring.two_ne_zero hF), quadraticChar_two hF, χ₈_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_two_iff FiniteField.isSquare_two_iff theorem quadraticChar_neg_two [DecidableEq F] (hF : ringChar F ≠ 2) : quadraticChar F (-2) = χ₈' (Fintype.card F) := by rw [(by norm_num : (-2 : F) = -1 * 2), map_mul, χ₈'_eq_χ₄_mul_χ₈, quadraticChar_neg_one hF, quadraticChar_two hF, @cast_natCast _ (ZMod 4) _ _ _ (by decide : 4 ∣ 8)] #align quadratic_char_neg_two quadraticChar_neg_two theorem FiniteField.isSquare_neg_two_iff : IsSquare (-2 : F) ↔ Fintype.card F % 8 ≠ 5 ∧ Fintype.card F % 8 ≠ 7 := by classical by_cases hF : ringChar F = 2 focus have h := FiniteField.even_card_of_char_two hF simp only [FiniteField.isSquare_of_char_two hF, true_iff_iff] rotate_left focus have h := FiniteField.odd_card_of_char_ne_two hF rw [← quadraticChar_one_iff_isSquare (neg_ne_zero.mpr (Ring.two_ne_zero hF)), quadraticChar_neg_two hF, χ₈'_nat_eq_if_mod_eight] simp only [h, Nat.one_ne_zero, if_false, ite_eq_left_iff, Ne, (by decide : (-1 : ℤ) ≠ 1), imp_false, Classical.not_not] all_goals rw [← Nat.mod_mod_of_dvd _ (by decide : 2 ∣ 8)] at h have h₁ := Nat.mod_lt (Fintype.card F) (by decide : 0 < 8) revert h₁ h generalize Fintype.card F % 8 = n intros; interval_cases n <;> simp_all -- Porting note (#11043): was `decide!` #align finite_field.is_square_neg_two_iff FiniteField.isSquare_neg_two_iff
Mathlib/NumberTheory/LegendreSymbol/QuadraticChar/GaussSum.lean
97
115
theorem quadraticChar_card_card [DecidableEq F] (hF : ringChar F ≠ 2) {F' : Type*} [Field F'] [Fintype F'] [DecidableEq F'] (hF' : ringChar F' ≠ 2) (h : ringChar F' ≠ ringChar F) : quadraticChar F (Fintype.card F') = quadraticChar F' (quadraticChar F (-1) * Fintype.card F) := by
let χ := (quadraticChar F).ringHomComp (algebraMap ℤ F') have hχ₁ : χ.IsNontrivial := by obtain ⟨a, ha⟩ := quadraticChar_exists_neg_one hF have hu : IsUnit a := by contrapose ha exact ne_of_eq_of_ne (map_nonunit (quadraticChar F) ha) (mt zero_eq_neg.mp one_ne_zero) use hu.unit simp only [χ, IsUnit.unit_spec, ringHomComp_apply, eq_intCast, Ne, ha] rw [Int.cast_neg, Int.cast_one] exact Ring.neg_one_ne_one_of_char_ne_two hF' have hχ₂ : χ.IsQuadratic := IsQuadratic.comp (quadraticChar_isQuadratic F) _ have h := Char.card_pow_card hχ₁ hχ₂ h hF' rw [← quadraticChar_eq_pow_of_char_ne_two' hF'] at h exact (IsQuadratic.eq_of_eq_coe (quadraticChar_isQuadratic F') (quadraticChar_isQuadratic F) hF' h).symm
[ " IsSquare 2 ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " (if Fintype.card F % 2 = 0 then 0 else if Fintype.card F % 8 = 1 ∨ Fintype.card F % 8 = 7 then 1 else -1) = 1 ↔\n Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " -1 ≠ 1", " Fintype.c...
[ " IsSquare 2 ↔ Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " (if Fintype.card F % 2 = 0 then 0 else if Fintype.card F % 8 = 1 ∨ Fintype.card F % 8 = 7 then 1 else -1) = 1 ↔\n Fintype.card F % 8 ≠ 3 ∧ Fintype.card F % 8 ≠ 5", " -1 ≠ 1", " Fintype.c...
import Mathlib.MeasureTheory.MeasurableSpace.Basic import Mathlib.MeasureTheory.Measure.MeasureSpaceDef #align_import measure_theory.function.ae_measurable_sequence from "leanprover-community/mathlib"@"d003c55042c3cd08aefd1ae9a42ef89441cdaaf3" open MeasureTheory open scoped Classical variable {ι : Sort*} {α β γ : Type*} [MeasurableSpace α] [MeasurableSpace β] {f : ι → α → β} {μ : Measure α} {p : α → (ι → β) → Prop} def aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : Set α := (toMeasurable μ { x | (∀ i, f i x = (hf i).mk (f i) x) ∧ p x fun n => f n x }ᶜ)ᶜ #align ae_seq_set aeSeqSet noncomputable def aeSeq (hf : ∀ i, AEMeasurable (f i) μ) (p : α → (ι → β) → Prop) : ι → α → β := fun i x => ite (x ∈ aeSeqSet hf p) ((hf i).mk (f i) x) (⟨f i x⟩ : Nonempty β).some #align ae_seq aeSeq namespace aeSeq section MemAESeqSet theorem mk_eq_fun_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α} (hx : x ∈ aeSeqSet hf p) (i : ι) : (hf i).mk (f i) x = f i x := haveI h_ss : aeSeqSet hf p ⊆ { x | ∀ i, f i x = (hf i).mk (f i) x } := by rw [aeSeqSet, ← compl_compl { x | ∀ i, f i x = (hf i).mk (f i) x }, Set.compl_subset_compl] refine Set.Subset.trans (Set.compl_subset_compl.mpr fun x h => ?_) (subset_toMeasurable _ _) exact h.1 (h_ss hx i).symm #align ae_seq.mk_eq_fun_of_mem_ae_seq_set aeSeq.mk_eq_fun_of_mem_aeSeqSet
Mathlib/MeasureTheory/Function/AEMeasurableSequence.lean
59
61
theorem aeSeq_eq_mk_of_mem_aeSeqSet (hf : ∀ i, AEMeasurable (f i) μ) {x : α} (hx : x ∈ aeSeqSet hf p) (i : ι) : aeSeq hf p i x = (hf i).mk (f i) x := by
simp only [aeSeq, hx, if_true]
[ " aeSeqSet hf p ⊆ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}", " {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}ᶜ ⊆\n toMeasurable μ {x | (∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x) ∧ p x fun n => f n x}ᶜ", " x ∈ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}", " aeSeq hf p i x = AEMeasur...
[ " aeSeqSet hf p ⊆ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}", " {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}ᶜ ⊆\n toMeasurable μ {x | (∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x) ∧ p x fun n => f n x}ᶜ", " x ∈ {x | ∀ (i : ι), f i x = AEMeasurable.mk (f i) ⋯ x}" ]
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]
[ " v.get i ∈ v.toList", " v.toList.get (Fin.cast ⋯ i) ∈ v.toList", " a ∈ v.toList ↔ ∃ i, v.get i = a", " (∃ i, ∃ (h : i < v.toList.length), v.toList.get ⟨i, h⟩ = a) ↔ ∃ i, ∃ (h : i < n), v.toList.get (Fin.cast ⋯ ⟨i, h⟩) = a", " i < n", " i < v.toList.length", " a ∉ nil.toList", " a ∉ toList ⟨[], ⋯⟩", ...
[ " v.get i ∈ v.toList", " v.toList.get (Fin.cast ⋯ i) ∈ v.toList", " a ∈ v.toList ↔ ∃ i, v.get i = a", " (∃ i, ∃ (h : i < v.toList.length), v.toList.get ⟨i, h⟩ = a) ↔ ∃ i, ∃ (h : i < n), v.toList.get (Fin.cast ⋯ ⟨i, h⟩) = a", " i < n", " i < v.toList.length", " a ∉ nil.toList", " a ∉ toList ⟨[], ⋯⟩", ...
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
[ " ContinuousAt (fun y => o.oangle y.1 y.2) x", " (o.kahler x.1) x.2 ≠ 0", " ContinuousAt (fun y => (o.kahler y.1) y.2) x" ]
[]
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
[ " R (mapAccumr f₁ xs s₁).1 (mapAccumr f₂ xs s₂).1 ∧ (mapAccumr f₁ xs s₁).2 = (mapAccumr f₂ xs s₂).2", " R (mapAccumr f₁ (xs✝.snoc x✝) s₁).1 (mapAccumr f₂ (xs✝.snoc x✝) s₂).1 ∧\n (mapAccumr f₁ (xs✝.snoc x✝) s₁).2 = (mapAccumr f₂ (xs✝.snoc x✝) s₂).2", " R (mapAccumr f₁ nil s₁).1 (mapAccumr f₂ nil s₂).1 ∧ (mapA...
[]
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'
[ " n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p", " (∀ m < n, ¬¬(X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p", " (∀ m < n, (X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p", " (X - C a) ^ n ∣ p", " (X - C a) ^ 0 ∣ p", " 1 ∣ p", " (X - C a) ^ (n + 1) ∣ p", " rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣...
[ " n ≤ rootMultiplicity a p ↔ (X - C a) ^ n ∣ p", " (∀ m < n, ¬¬(X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p", " (∀ m < n, (X - C a) ^ (m + 1) ∣ p) ↔ (X - C a) ^ n ∣ p", " (X - C a) ^ n ∣ p", " (X - C a) ^ 0 ∣ p", " 1 ∣ p", " (X - C a) ^ (n + 1) ∣ p", " rootMultiplicity a p ≤ n ↔ ¬(X - C a) ^ (n + 1) ∣...
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]
[ " Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)", " (enumFrom n l)...
[ " Option.map (fun a => (n + 1 + m, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " Option.map (fun a => (n + m + 1, a)) (l.get? m) = Option.map (fun a => (n + (m + 1), a)) ((a :: l).get? (m + 1))", " l.enum.get? n = Option.map (fun a => (n, a)) (l.get? n)", " (enumFrom n l)...
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
[ " 1 = M.mk F ⟨j, 1⟩", " ∃ k f g, (F.map f) ⟨⋯.some, 1⟩.snd = (F.map g) ⟨j, 1⟩.snd", " (F.map (IsFiltered.leftToMax ⟨⋯.some, 1⟩.fst j)) ⟨⋯.some, 1⟩.snd =\n (F.map (IsFiltered.rightToMax ⟨⋯.some, 1⟩.fst j)) ⟨j, 1⟩.snd" ]
[]
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]
[ " fixedBy α g⁻¹ = fixedBy α g", " x✝ ∈ fixedBy α g⁻¹ ↔ x✝ ∈ fixedBy α g" ]
[]
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]
[ " wittPolynomial p R n = ∑ i ∈ range (n + 1), C (↑p ^ i) * X i ^ p ^ (n - i)", " ∀ x ∈ range (n + 1), (monomial (single x (p ^ (n - x)))) (↑p ^ x) = C (↑p ^ x) * X x ^ p ^ (n - x)", " (monomial (single i (p ^ (n - i)))) (↑p ^ i) = C (↑p ^ i) * X i ^ p ^ (n - i)", " X i ^ 0 = 1", " (map f) (W_ R n) = W_ S n"...
[ " wittPolynomial p R n = ∑ i ∈ range (n + 1), C (↑p ^ i) * X i ^ p ^ (n - i)", " ∀ x ∈ range (n + 1), (monomial (single x (p ^ (n - x)))) (↑p ^ x) = C (↑p ^ x) * X x ^ p ^ (n - x)", " (monomial (single i (p ^ (n - i)))) (↑p ^ i) = C (↑p ^ i) * X i ^ p ^ (n - i)", " X i ^ 0 = 1", " (map f) (W_ R n) = W_ S n"...
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
[ " ∑ a : Fin (n + 1), (fun i => p ^ ↑i * (1 - p) ^ (↑(Fin.last n) - ↑i) * ↑(n.choose ↑i)) a = 1", " ∑ a : Fin (n + 1), (fun i => p ^ ↑i * (1 - p) ^ (↑(Fin.last n) - ↑i) * ↑(n.choose ↑i)) a =\n ∑ m ∈ Finset.range (n + 1), p ^ m * (1 - p) ^ (n - m) * ↑(n.choose m)", " (∑ i ∈ Finset.range (n + 1),\n if h : ...
[ " ∑ a : Fin (n + 1), (fun i => p ^ ↑i * (1 - p) ^ (↑(Fin.last n) - ↑i) * ↑(n.choose ↑i)) a = 1", " ∑ a : Fin (n + 1), (fun i => p ^ ↑i * (1 - p) ^ (↑(Fin.last n) - ↑i) * ↑(n.choose ↑i)) a =\n ∑ m ∈ Finset.range (n + 1), p ^ m * (1 - p) ^ (n - m) * ↑(n.choose m)", " (∑ i ∈ Finset.range (n + 1),\n if h : ...
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]
[ " List.indexOf x xs < xs.length", " x ∈ xs", " xs.get ((fun x => ⟨List.indexOf x xs, ⋯⟩) x) = x", " (fun x => ⟨List.indexOf x xs, ⋯⟩) (xs.get i) = i", " ↑((fun x => ⟨List.indexOf x xs, ⋯⟩) (xs.get i)) = ↑i", " ∀ (x : α), x ∈ xs.dedup", " x ∈ toList α", " ∃ a, equiv.symm a = x", " equiv.symm (equiv x...
[ " List.indexOf x xs < xs.length", " x ∈ xs", " xs.get ((fun x => ⟨List.indexOf x xs, ⋯⟩) x) = x", " (fun x => ⟨List.indexOf x xs, ⋯⟩) (xs.get i) = i", " ↑((fun x => ⟨List.indexOf x xs, ⋯⟩) (xs.get i)) = ↑i", " ∀ (x : α), x ∈ xs.dedup", " x ∈ toList α", " ∃ a, equiv.symm a = x", " equiv.symm (equiv x...
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]
[ " { start := start, stop := stop, step := step }.numElems = 0", " (if step = 0 then if stop ≤ start then 0 else stop else (stop - start + step - 1) / step) = 0", " 0 = 0", " (stop - start + step - 1) / step = 0", " stop - start + step - 1 < step", " step - 1 < step", " { start := start, stop := stop, st...
[ " { start := start, stop := stop, step := step }.numElems = 0", " (if step = 0 then if stop ≤ start then 0 else stop else (stop - start + step - 1) / step) = 0", " 0 = 0", " (stop - start + step - 1) / step = 0", " stop - start + step - 1 < step", " step - 1 < step" ]
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 ℝ
[ " HasStrictDerivAt (fun x => (e ↑x).re) e'.re z", " e'.re = (reCLM.comp ((ContinuousLinearMap.restrictScalars ℝ (ContinuousLinearMap.smulRight 1 e')).comp ofRealCLM)) 1", " e'.re = reCLM ((ContinuousLinearMap.restrictScalars ℝ (ContinuousLinearMap.smulRight 1 e')) (ofRealCLM 1))", " HasDerivAt (fun x => (e ↑x...
[ " HasStrictDerivAt (fun x => (e ↑x).re) e'.re z", " e'.re = (reCLM.comp ((ContinuousLinearMap.restrictScalars ℝ (ContinuousLinearMap.smulRight 1 e')).comp ofRealCLM)) 1", " e'.re = reCLM ((ContinuousLinearMap.restrictScalars ℝ (ContinuousLinearMap.smulRight 1 e')) (ofRealCLM 1))", " HasDerivAt (fun x => (e ↑x...
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
[ " ¬Separable 0", " False", " f.Separable", " (X + C a).Separable", " IsCoprime (X + C a) 1" ]
[ " ¬Separable 0", " False", " f.Separable" ]
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 _)
[ " Integrable (fun x => ∏ i : Fin n, f i (x i)) volume", " Integrable (fun x => ∏ i : Fin 0, f i (x i)) volume", " Integrable (fun x => ∏ i : Fin (n + 1), f i (x i)) volume", " Integrable ((fun x => ∏ i : Fin (n + 1), f i (x i)) ∘ ⇑(MeasurableEquiv.piFinSuccAbove (fun i => E i) 0).symm)\n (volume.prod (Meas...
[ " Integrable (fun x => ∏ i : Fin n, f i (x i)) volume", " Integrable (fun x => ∏ i : Fin 0, f i (x i)) volume", " Integrable (fun x => ∏ i : Fin (n + 1), f i (x i)) volume", " Integrable ((fun x => ∏ i : Fin (n + 1), f i (x i)) ∘ ⇑(MeasurableEquiv.piFinSuccAbove (fun i => E i) 0).symm)\n (volume.prod (Meas...
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open TopologicalSpace variable {μ ν : Measure α} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E := if hf : Integrable f μ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hs₂ => by dsimp only convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n · rw [if_pos (hs₁ n)] · rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ open Measure variable {f g : α → E} theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) : μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply @[simp] theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp #align measure_theory.with_densityᵥ_zero MeasureTheory.withDensityᵥ_zero @[simp] theorem withDensityᵥ_neg : μ.withDensityᵥ (-f) = -μ.withDensityᵥ f := by by_cases hf : Integrable f μ · ext1 i hi rw [VectorMeasure.neg_apply, withDensityᵥ_apply hf hi, ← integral_neg, withDensityᵥ_apply hf.neg hi] rfl · rw [withDensityᵥ, withDensityᵥ, dif_neg hf, dif_neg, neg_zero] rwa [integrable_neg_iff] #align measure_theory.with_densityᵥ_neg MeasureTheory.withDensityᵥ_neg theorem withDensityᵥ_neg' : (μ.withDensityᵥ fun x => -f x) = -μ.withDensityᵥ f := withDensityᵥ_neg #align measure_theory.with_densityᵥ_neg' MeasureTheory.withDensityᵥ_neg' @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
84
92
theorem withDensityᵥ_add (hf : Integrable f μ) (hg : Integrable g μ) : μ.withDensityᵥ (f + g) = μ.withDensityᵥ f + μ.withDensityᵥ g := by
ext1 i hi rw [withDensityᵥ_apply (hf.add hg) hi, VectorMeasure.add_apply, withDensityᵥ_apply hf hi, withDensityᵥ_apply hg hi] simp_rw [Pi.add_apply] rw [integral_add] <;> rw [← integrableOn_univ] · exact hf.integrableOn.restrict MeasurableSet.univ · exact hg.integrableOn.restrict MeasurableSet.univ
[ " (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) ∅ = 0", " HasSum (fun i => (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (s i))\n ((fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (⋃ i, s i))", " HasSum (fun i => if MeasurableSet (s i) then ∫ (x : α) in s...
[ " (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) ∅ = 0", " HasSum (fun i => (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (s i))\n ((fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (⋃ i, s i))", " HasSum (fun i => if MeasurableSet (s i) then ∫ (x : α) in s...
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.function.ae_measurable_order from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf" open MeasureTheory Set TopologicalSpace open scoped Classical open ENNReal NNReal theorem MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets {α : Type*} {m : MeasurableSpace α} (μ : Measure α) {β : Type*} [CompleteLinearOrder β] [DenselyOrdered β] [TopologicalSpace β] [OrderTopology β] [SecondCountableTopology β] [MeasurableSpace β] [BorelSpace β] (s : Set β) (s_count : s.Countable) (s_dense : Dense s) (f : α → β) (h : ∀ p ∈ s, ∀ q ∈ s, p < q → ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | q < f x } ⊆ v ∧ μ (u ∩ v) = 0) : AEMeasurable f μ := by haveI : Encodable s := s_count.toEncodable have h' : ∀ p q, ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | q < f x } ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0) := by intro p q by_cases H : p ∈ s ∧ q ∈ s ∧ p < q · rcases h p H.1 q H.2.1 H.2.2 with ⟨u, v, hu, hv, h'u, h'v, hμ⟩ exact ⟨u, v, hu, hv, h'u, h'v, fun _ _ _ => hμ⟩ · refine ⟨univ, univ, MeasurableSet.univ, MeasurableSet.univ, subset_univ _, subset_univ _, fun ps qs pq => ?_⟩ simp only [not_and] at H exact (H ps qs pq).elim choose! u v huv using h' let u' : β → Set α := fun p => ⋂ q ∈ s ∩ Ioi p, u p q have u'_meas : ∀ i, MeasurableSet (u' i) := by intro i exact MeasurableSet.biInter (s_count.mono inter_subset_left) fun b _ => (huv i b).1 let f' : α → β := fun x => ⨅ i : s, piecewise (u' i) (fun _ => (i : β)) (fun _ => (⊤ : β)) x have f'_meas : Measurable f' := by apply measurable_iInf exact fun i => Measurable.piecewise (u'_meas i) measurable_const measurable_const let t := ⋃ (p : s) (q : ↥(s ∩ Ioi p)), u' p ∩ v p q have μt : μ t ≤ 0 := calc μ t ≤ ∑' (p : s) (q : ↥(s ∩ Ioi p)), μ (u' p ∩ v p q) := by refine (measure_iUnion_le _).trans ?_ refine ENNReal.tsum_le_tsum fun p => ?_ haveI := (s_count.mono (s.inter_subset_left (t := Ioi ↑p))).to_subtype apply measure_iUnion_le _ ≤ ∑' (p : s) (q : ↥(s ∩ Ioi p)), μ (u p q ∩ v p q) := by gcongr with p q exact biInter_subset_of_mem q.2 _ = ∑' (p : s) (_ : ↥(s ∩ Ioi p)), (0 : ℝ≥0∞) := by congr ext1 p congr ext1 q exact (huv p q).2.2.2.2 p.2 q.2.1 q.2.2 _ = 0 := by simp only [tsum_zero] have ff' : ∀ᵐ x ∂μ, f x = f' x := by have : ∀ᵐ x ∂μ, x ∉ t := by have : μ t = 0 := le_antisymm μt bot_le change μ _ = 0 convert this ext y simp only [not_exists, exists_prop, mem_setOf_eq, mem_compl_iff, not_not_mem] filter_upwards [this] with x hx apply (iInf_eq_of_forall_ge_of_forall_gt_exists_lt _ _).symm · intro i by_cases H : x ∈ u' i swap · simp only [H, le_top, not_false_iff, piecewise_eq_of_not_mem] simp only [H, piecewise_eq_of_mem] contrapose! hx obtain ⟨r, ⟨xr, rq⟩, rs⟩ : ∃ r, r ∈ Ioo (i : β) (f x) ∩ s := dense_iff_inter_open.1 s_dense (Ioo i (f x)) isOpen_Ioo (nonempty_Ioo.2 hx) have A : x ∈ v i r := (huv i r).2.2.2.1 rq refine mem_iUnion.2 ⟨i, ?_⟩ refine mem_iUnion.2 ⟨⟨r, ⟨rs, xr⟩⟩, ?_⟩ exact ⟨H, A⟩ · intro q hq obtain ⟨r, ⟨xr, rq⟩, rs⟩ : ∃ r, r ∈ Ioo (f x) q ∩ s := dense_iff_inter_open.1 s_dense (Ioo (f x) q) isOpen_Ioo (nonempty_Ioo.2 hq) refine ⟨⟨r, rs⟩, ?_⟩ have A : x ∈ u' r := mem_biInter fun i _ => (huv r i).2.2.1 xr simp only [A, rq, piecewise_eq_of_mem, Subtype.coe_mk] exact ⟨f', f'_meas, ff'⟩ #align measure_theory.ae_measurable_of_exist_almost_disjoint_supersets MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets
Mathlib/MeasureTheory/Function/AEMeasurableOrder.lean
113
127
theorem ENNReal.aemeasurable_of_exist_almost_disjoint_supersets {α : Type*} {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) (h : ∀ (p : ℝ≥0) (q : ℝ≥0), p < q → ∃ u v, MeasurableSet u ∧ MeasurableSet v ∧ { x | f x < p } ⊆ u ∧ { x | (q : ℝ≥0∞) < f x } ⊆ v ∧ μ (u ∩ v) = 0) : AEMeasurable f μ := by
obtain ⟨s, s_count, s_dense, _, s_top⟩ : ∃ s : Set ℝ≥0∞, s.Countable ∧ Dense s ∧ 0 ∉ s ∧ ∞ ∉ s := ENNReal.exists_countable_dense_no_zero_top have I : ∀ x ∈ s, x ≠ ∞ := fun x xs hx => s_top (hx ▸ xs) apply MeasureTheory.aemeasurable_of_exist_almost_disjoint_supersets μ s s_count s_dense _ rintro p hp q hq hpq lift p to ℝ≥0 using I p hp lift q to ℝ≥0 using I q hq exact h p q (ENNReal.coe_lt_coe.1 hpq)
[ " AEMeasurable f μ", " ∀ (p q : β),\n ∃ u v,\n MeasurableSet u ∧\n MeasurableSet v ∧ {x | f x < p} ⊆ u ∧ {x | q < f x} ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0)", " ∃ u v,\n MeasurableSet u ∧ MeasurableSet v ∧ {x | f x < p} ⊆ u ∧ {x | q < f x} ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0)"...
[ " AEMeasurable f μ", " ∀ (p q : β),\n ∃ u v,\n MeasurableSet u ∧\n MeasurableSet v ∧ {x | f x < p} ⊆ u ∧ {x | q < f x} ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0)", " ∃ u v,\n MeasurableSet u ∧ MeasurableSet v ∧ {x | f x < p} ⊆ u ∧ {x | q < f x} ⊆ v ∧ (p ∈ s → q ∈ s → p < q → μ (u ∩ v) = 0)"...
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]
[ " c ∈ perpBisector p₁ p₂ ↔ ⟪(Equiv.pointReflection c) p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫_ℝ = 0", " 2⁻¹ * ⟪c -ᵥ p₁ + (c -ᵥ p₂), p₂ -ᵥ p₁⟫_ℝ = 0 ↔ ⟪c -ᵥ p₁ + (c -ᵥ p₂), p₂ -ᵥ p₁⟫_ℝ = 0", " c ∈ perpBisector p₁ ((Equiv.pointReflection p₂) p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫_ℝ = 0", " midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂", " (perpBisec...
[ " c ∈ perpBisector p₁ p₂ ↔ ⟪(Equiv.pointReflection c) p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫_ℝ = 0", " 2⁻¹ * ⟪c -ᵥ p₁ + (c -ᵥ p₂), p₂ -ᵥ p₁⟫_ℝ = 0 ↔ ⟪c -ᵥ p₁ + (c -ᵥ p₂), p₂ -ᵥ p₁⟫_ℝ = 0", " c ∈ perpBisector p₁ ((Equiv.pointReflection p₂) p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫_ℝ = 0", " midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂", " (perpBisec...
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)
[ " IsSheaf (Pretopology.toGrothendieck C K) P ↔ ∀ {X : C}, ∀ R ∈ K.coverings X, IsSheafFor P R", " IsSheaf (Pretopology.toGrothendieck C K) P → ∀ {X : C}, ∀ R ∈ K.coverings X, IsSheafFor P R", " IsSheafFor P R", " IsSheafFor P (generate R).arrows", " (∀ {X : C}, ∀ R ∈ K.coverings X, IsSheafFor P R) → IsSheaf...
[]
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]
[ " univ = {0, 1}", " x ∈ univ ↔ x ∈ {0, 1}", " ⟨0, ⋯⟩ ∈ univ ↔ ⟨0, ⋯⟩ ∈ {0, 1}", " ⟨1, ⋯⟩ ∈ univ ↔ ⟨1, ⋯⟩ ∈ {0, 1}", " (s.weightedVSubOfPoint p b) w = ∑ i ∈ s, w i • (p i -ᵥ b)" ]
[ " univ = {0, 1}", " x ∈ univ ↔ x ∈ {0, 1}", " ⟨0, ⋯⟩ ∈ univ ↔ ⟨0, ⋯⟩ ∈ {0, 1}", " ⟨1, ⋯⟩ ∈ univ ↔ ⟨1, ⋯⟩ ∈ {0, 1}" ]
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]
[ " ‖cexp (↑t * I)‖ = 1", " r₁ < ‖↑x‖ ∧ ‖↑x‖ < r₂", " ‖r • x‖ ≤ ‖r‖ * ‖x‖", " dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)", " dist z w = √((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))", " dist z w = dist z.im w.im", " edist z w = edist z.im w.im", " dist z w = dist z.re w.re", ...
[ " ‖cexp (↑t * I)‖ = 1", " r₁ < ‖↑x‖ ∧ ‖↑x‖ < r₂", " ‖r • x‖ ≤ ‖r‖ * ‖x‖", " dist z w = √((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2)", " dist z w = √((z.re - w.re) * (z.re - w.re) + (z.im - w.im) * (z.im - w.im))", " dist z w = dist z.im w.im", " edist z w = edist z.im w.im", " dist z w = dist z.re w.re" ]
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
[ " ‖f w‖ = ‖f z‖", " ¬(norm ∘ f) w < (norm ∘ f) z", " False", " ‖∮ (ζ : ℂ) in C(z, r), (ζ - z)⁻¹ • f ζ‖ = 2 * π * ‖f z‖", " ‖∮ (ζ : ℂ) in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * ‖f z‖", " ‖∮ (ζ : ℂ) in C(z, r), (ζ - z)⁻¹ • f ζ‖ < 2 * π * r * (‖f z‖ / r)", " ContinuousOn (fun ζ => (ζ - z)⁻¹ • f ζ) (sphere z r...
[]
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
[ " Pi.π f b (Pi.lift s x) = s b x", " Pi.π g b (Pi.map α x) = α b (Pi.π f b x)" ]
[ " Pi.π f b (Pi.lift s x) = s b x" ]
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
[ " updateFinset x {i} y = update x i (y ⟨i, ⋯⟩)", " updateFinset x {i} y j = update x i (y ⟨i, ⋯⟩) j", " updateFinset x {i} y i = update x i (y ⟨i, ⋯⟩) i", " update x i y = updateFinset x {i} (uniqueElim y)", " update x i y j = updateFinset x {i} (uniqueElim y) j", " update x i y i = updateFinset x {i} (un...
[ " updateFinset x {i} y = update x i (y ⟨i, ⋯⟩)", " updateFinset x {i} y j = update x i (y ⟨i, ⋯⟩) j", " updateFinset x {i} y i = update x i (y ⟨i, ⋯⟩) i", " update x i y = updateFinset x {i} (uniqueElim y)", " update x i y j = updateFinset x {i} (uniqueElim y) j", " update x i y i = updateFinset x {i} (un...
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
[ " (starRingEnd ℂ) (x φ) = x (ComplexEmbedding.conjugate φ)", " ∀ x ∈ Set.range ⇑(canonicalEmbedding K), (starRingEnd ℂ) (x φ) = x (ComplexEmbedding.conjugate φ)", " (starRingEnd ℂ) ((canonicalEmbedding K) x φ) = (canonicalEmbedding K) x (ComplexEmbedding.conjugate φ)", " (starRingEnd ℂ) (0 φ) = 0 (ComplexEmbe...
[]
import Mathlib.NumberTheory.Cyclotomic.PrimitiveRoots import Mathlib.NumberTheory.NumberField.Embeddings universe u namespace IsCyclotomicExtension.Rat open NumberField InfinitePlace FiniteDimensional Complex Nat Polynomial variable {n : ℕ+} (K : Type u) [Field K] [CharZero K]
Mathlib/NumberTheory/Cyclotomic/Embeddings.lean
30
35
theorem nrRealPlaces_eq_zero [IsCyclotomicExtension {n} ℚ K] (hn : 2 < n) : haveI := IsCyclotomicExtension.numberField {n} ℚ K NrRealPlaces K = 0 := by
have := IsCyclotomicExtension.numberField {n} ℚ K apply (IsCyclotomicExtension.zeta_spec n ℚ K).nrRealPlaces_eq_zero_of_two_lt hn
[ " NrRealPlaces K = 0" ]
[]
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]
[ " map valEmbedding (Icc a b) = Icc ↑a ↑b", " map valEmbedding (Ico a b) = Ico ↑a ↑b", " map valEmbedding (Ioc a b) = Ioc ↑a ↑b", " map valEmbedding (Ioo a b) = Ioo ↑a ↑b", " (Icc a b).card = ↑b + 1 - ↑a", " (Ico a b).card = ↑b - ↑a" ]
[ " map valEmbedding (Icc a b) = Icc ↑a ↑b", " map valEmbedding (Ico a b) = Ico ↑a ↑b", " map valEmbedding (Ioc a b) = Ioc ↑a ↑b", " map valEmbedding (Ioo a b) = Ioo ↑a ↑b", " (Icc a b).card = ↑b + 1 - ↑a" ]
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]
[ " ∀ (p q : Bool), p ∆ q = xor p q", " a ⇔ b = b ⇔ a", " a ⇔ a = ⊤" ]
[ " ∀ (p q : Bool), p ∆ q = xor p q", " a ⇔ b = b ⇔ a" ]
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]
[ " InjOn f (f ⁻¹' ↑∅)", " ↑(∅.preimage f ⋯) = ↑∅", " ↑(univ.preimage f hf) = ↑univ", " ↑((s ∩ t).preimage f ⋯) = ↑(s.preimage f hs ∩ t.preimage f ht)", " ↑((s ∪ t).preimage f hst) = ↑(s.preimage f ⋯ ∪ t.preimage f ⋯)", " ↑(sᶜ.preimage f ⋯) = ↑(s.preimage f ⋯)ᶜ", " ↑((map f s).preimage ⇑f ⋯) = ↑s", " (∀...
[ " InjOn f (f ⁻¹' ↑∅)", " ↑(∅.preimage f ⋯) = ↑∅", " ↑(univ.preimage f hf) = ↑univ", " ↑((s ∩ t).preimage f ⋯) = ↑(s.preimage f hs ∩ t.preimage f ht)", " ↑((s ∪ t).preimage f hst) = ↑(s.preimage f ⋯ ∪ t.preimage f ⋯)", " ↑(sᶜ.preimage f ⋯) = ↑(s.preimage f ⋯)ᶜ", " ↑((map f s).preimage ⇑f ⋯) = ↑s", " (∀...
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'
[ " (∀ᶠ (x : M) in ↑(U * V * W), p x) ↔ ∀ᶠ (x : M) in ↑(U * (V * W)), p x", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), m * m' ∈ FP a", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), a.head * m' ∈ FP a", " ∀ m' ∈ FP (Stream'.drop (n + 1) a), m * m' ∈ FP a", " m * m' ∈ FP a", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), a.head * m *...
[ " (∀ᶠ (x : M) in ↑(U * V * W), p x) ↔ ∀ᶠ (x : M) in ↑(U * (V * W)), p x", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), m * m' ∈ FP a", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), a.head * m' ∈ FP a", " ∀ m' ∈ FP (Stream'.drop (n + 1) a), m * m' ∈ FP a", " m * m' ∈ FP a", " ∃ n, ∀ m' ∈ FP (Stream'.drop n a), a.head * m *...
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
[ " p ∣ m.natAbs ∨ p ∣ n.natAbs", " ↑p ∣ m ∨ ↑p ∣ n", " p ∣ n.natAbs", " ↑p ∣ n" ]
[ " p ∣ m.natAbs ∨ p ∣ n.natAbs", " ↑p ∣ m ∨ ↑p ∣ n", " p ∣ n.natAbs" ]
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]
[ " volume = StieltjesFunction.id.measure", " StieltjesFunction.id.measure (Ioo ↑p ↑q) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo ↑p ↑q)", " StieltjesFunction.id.measure ↑(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1", " StieltjesFunction.id.measure (parallelepiped ⇑(stdOrthonorma...
[]
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
[ " ∀ {α : Type ?u.133} (x : Multiset α), id <$> x = x", " ∀ {α β γ : Type ?u.133} (g : α → β) (h : β → γ) (x : Multiset α), (h ∘ g) <$> x = h <$> g <$> x", " Multiset α' → F (Multiset β')", " ∀ (a b : List α'),\n a ≈ b → (Functor.map Coe.coe ∘ Traversable.traverse f) a = (Functor.map Coe.coe ∘ Traversable.t...
[ " ∀ {α : Type ?u.133} (x : Multiset α), id <$> x = x", " ∀ {α β γ : Type ?u.133} (g : α → β) (h : β → γ) (x : Multiset α), (h ∘ g) <$> x = h <$> g <$> x", " Multiset α' → F (Multiset β')", " ∀ (a b : List α'),\n a ≈ b → (Functor.map Coe.coe ∘ Traversable.traverse f) a = (Functor.map Coe.coe ∘ Traversable.t...
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
[ " (LHom.id L).onTerm = id", " (LHom.id L).onTerm t = id t", " (LHom.id L).onTerm (var a✝) = id (var a✝)", " (LHom.id L).onTerm (func _f✝ _ts✝) = id (func _f✝ _ts✝)", " (func ((LHom.id L).onFunction _f✝) fun i => id (_ts✝ i)) = id (func _f✝ _ts✝)" ]
[]
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]
[ " IsAssociatedPrime I M'", " IsAssociatedPrime (Submodule.span R {x}).annihilator M'", " (Submodule.span R {x}).annihilator = (Submodule.span R {f x}).annihilator", " r ∈ (Submodule.span R {x}).annihilator ↔ r ∈ (Submodule.span R {f x}).annihilator" ]
[]
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₁
[ " μ ≤ 0 + ν", " (μ - ν) s = μ s - ν s", " (fun t x => μ t - ν t) ∅ ⋯ = 0", " (fun t x => μ t - ν t) (⋃ i, g i) ⋯ = ∑' (i : ℕ), (fun t x => μ t - ν t) (g i) ⋯", " ∑' (i : ℕ), μ (g i) - ∑' (i : ℕ), ν (g i) = ∑' (i : ℕ), (μ (g i) - ν (g i))", " ∑' (i : ℕ), ν (g i) ≠ ⊤", " ν (⋃ i, g i) ≠ ⊤", " ν + measure...
[ " μ ≤ 0 + ν" ]
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
[ " ∫ (x : Ω), stoppedValue f τ x ∂μ ≤ ∫ (x : Ω), stoppedValue f π x ∂μ", " 0 ≤ ∫ (a : Ω), (fun ω => (∑ i ∈ Finset.range (N + 1), {ω | τ ω ≤ i ∧ i < π ω}.indicator (f (i + 1) - f i)) ω) a ∂μ", " 0 ≤ ∫ (a : Ω), ∑ c ∈ Finset.range (N + 1), {ω | τ ω ≤ c ∧ c < π ω}.indicator (f (c + 1) - f c) a ∂μ", " ∀ (i : ℕ), Me...
[ " ∫ (x : Ω), stoppedValue f τ x ∂μ ≤ ∫ (x : Ω), stoppedValue f π x ∂μ", " 0 ≤ ∫ (a : Ω), (fun ω => (∑ i ∈ Finset.range (N + 1), {ω | τ ω ≤ i ∧ i < π ω}.indicator (f (i + 1) - f i)) ω) a ∂μ", " 0 ≤ ∫ (a : Ω), ∑ c ∈ Finset.range (N + 1), {ω | τ ω ≤ c ∧ c < π ω}.indicator (f (c + 1) - f c) a ∂μ", " ∀ (i : ℕ), Me...
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 α β _ _
[ " HasProd (fun x => 1) 1", " HasProd f 1" ]
[ " HasProd (fun x => 1) 1" ]
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 _)]
[ " n.choose 0 = 1", " choose 0 0 = 1", " (n✝ + 1).choose 0 = 1", " (n + 1).choose (k + 1) = 0", " n.choose n = 1", " (n✝ + 1).choose (n✝ + 1) = 1" ]
[ " n.choose 0 = 1", " choose 0 0 = 1", " (n✝ + 1).choose 0 = 1", " (n + 1).choose (k + 1) = 0" ]
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
[ " θ.cos = 0 ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2", " (cexp (θ * I) + cexp (-θ * I)) / 2 = 0 ↔ cexp (2 * θ * I) = -1", " cexp (θ * I - -θ * I) = -1 ↔ cexp (2 * θ * I) = -1", " (∃ n, 2 * I * θ = ↑π * I + ↑n * (2 * ↑π * I)) ↔ ∃ k, θ = (2 * ↑k + 1) * ↑π / 2", " 2 * I * θ = ↑π * I + ↑x * (2 * ↑π * I) ↔ θ = (2 * ↑x +...
[]
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]
[ " (p * C a).degree = p.degree", " (C a * p).degree = p.degree", " (p * C a).natDegree = p.natDegree", " (C a * p).natDegree = p.natDegree" ]
[ " (p * C a).degree = p.degree", " (C a * p).degree = p.degree", " (p * C a).natDegree = p.natDegree" ]
import Mathlib.ModelTheory.Basic #align_import model_theory.language_map from "leanprover-community/mathlib"@"b3951c65c6e797ff162ae8b69eab0063bcfb3d73" universe u v u' v' w w' namespace FirstOrder set_option linter.uppercaseLean3 false namespace Language open Structure Cardinal open Cardinal variable (L : Language.{u, v}) (L' : Language.{u', v'}) {M : Type w} [L.Structure M] structure LHom where onFunction : ∀ ⦃n⦄, L.Functions n → L'.Functions n onRelation : ∀ ⦃n⦄, L.Relations n → L'.Relations n #align first_order.language.Lhom FirstOrder.Language.LHom @[inherit_doc FirstOrder.Language.LHom] infixl:10 " →ᴸ " => LHom -- \^L variable {L L'} namespace LHom protected def mk₂ {c f₁ f₂ : Type u} {r₁ r₂ : Type v} (φ₀ : c → L'.Constants) (φ₁ : f₁ → L'.Functions 1) (φ₂ : f₂ → L'.Functions 2) (φ₁' : r₁ → L'.Relations 1) (φ₂' : r₂ → L'.Relations 2) : Language.mk₂ c f₁ f₂ r₁ r₂ →ᴸ L' := ⟨fun n => Nat.casesOn n φ₀ fun n => Nat.casesOn n φ₁ fun n => Nat.casesOn n φ₂ fun _ => PEmpty.elim, fun n => Nat.casesOn n PEmpty.elim fun n => Nat.casesOn n φ₁' fun n => Nat.casesOn n φ₂' fun _ => PEmpty.elim⟩ #align first_order.language.Lhom.mk₂ FirstOrder.Language.LHom.mk₂ variable (ϕ : L →ᴸ L') def reduct (M : Type*) [L'.Structure M] : L.Structure M where funMap f xs := funMap (ϕ.onFunction f) xs RelMap r xs := RelMap (ϕ.onRelation r) xs #align first_order.language.Lhom.reduct FirstOrder.Language.LHom.reduct @[simps] protected def id (L : Language) : L →ᴸ L := ⟨fun _n => id, fun _n => id⟩ #align first_order.language.Lhom.id FirstOrder.Language.LHom.id instance : Inhabited (L →ᴸ L) := ⟨LHom.id L⟩ @[simps] protected def sumInl : L →ᴸ L.sum L' := ⟨fun _n => Sum.inl, fun _n => Sum.inl⟩ #align first_order.language.Lhom.sum_inl FirstOrder.Language.LHom.sumInl @[simps] protected def sumInr : L' →ᴸ L.sum L' := ⟨fun _n => Sum.inr, fun _n => Sum.inr⟩ #align first_order.language.Lhom.sum_inr FirstOrder.Language.LHom.sumInr variable (L L') @[simps] protected def ofIsEmpty [L.IsAlgebraic] [L.IsRelational] : L →ᴸ L' := ⟨fun n => (IsRelational.empty_functions n).elim, fun n => (IsAlgebraic.empty_relations n).elim⟩ #align first_order.language.Lhom.of_is_empty FirstOrder.Language.LHom.ofIsEmpty variable {L L'} {L'' : Language} @[ext] protected theorem funext {F G : L →ᴸ L'} (h_fun : F.onFunction = G.onFunction) (h_rel : F.onRelation = G.onRelation) : F = G := by cases' F with Ff Fr cases' G with Gf Gr simp only [mk.injEq] exact And.intro h_fun h_rel #align first_order.language.Lhom.funext FirstOrder.Language.LHom.funext instance [L.IsAlgebraic] [L.IsRelational] : Unique (L →ᴸ L') := ⟨⟨LHom.ofIsEmpty L L'⟩, fun _ => LHom.funext (Subsingleton.elim _ _) (Subsingleton.elim _ _)⟩ theorem mk₂_funext {c f₁ f₂ : Type u} {r₁ r₂ : Type v} {F G : Language.mk₂ c f₁ f₂ r₁ r₂ →ᴸ L'} (h0 : ∀ c : (Language.mk₂ c f₁ f₂ r₁ r₂).Constants, F.onFunction c = G.onFunction c) (h1 : ∀ f : (Language.mk₂ c f₁ f₂ r₁ r₂).Functions 1, F.onFunction f = G.onFunction f) (h2 : ∀ f : (Language.mk₂ c f₁ f₂ r₁ r₂).Functions 2, F.onFunction f = G.onFunction f) (h1' : ∀ r : (Language.mk₂ c f₁ f₂ r₁ r₂).Relations 1, F.onRelation r = G.onRelation r) (h2' : ∀ r : (Language.mk₂ c f₁ f₂ r₁ r₂).Relations 2, F.onRelation r = G.onRelation r) : F = G := LHom.funext (funext fun n => Nat.casesOn n (funext h0) fun n => Nat.casesOn n (funext h1) fun n => Nat.casesOn n (funext h2) fun _n => funext fun f => PEmpty.elim f) (funext fun n => Nat.casesOn n (funext fun r => PEmpty.elim r) fun n => Nat.casesOn n (funext h1') fun n => Nat.casesOn n (funext h2') fun _n => funext fun r => PEmpty.elim r) #align first_order.language.Lhom.mk₂_funext FirstOrder.Language.LHom.mk₂_funext @[simps] def comp (g : L' →ᴸ L'') (f : L →ᴸ L') : L →ᴸ L'' := ⟨fun _n F => g.1 (f.1 F), fun _ R => g.2 (f.2 R)⟩ #align first_order.language.Lhom.comp FirstOrder.Language.LHom.comp -- Porting note: added ᴸ to avoid clash with function composition @[inherit_doc] local infixl:60 " ∘ᴸ " => LHom.comp @[simp]
Mathlib/ModelTheory/LanguageMap.lean
153
155
theorem id_comp (F : L →ᴸ L') : LHom.id L' ∘ᴸ F = F := by
cases F rfl
[ " F = G", " { onFunction := Ff, onRelation := Fr } = G", " { onFunction := Ff, onRelation := Fr } = { onFunction := Gf, onRelation := Gr }", " Ff = Gf ∧ Fr = Gr", " LHom.id L' ∘ᴸ F = F", " LHom.id L' ∘ᴸ { onFunction := onFunction✝, onRelation := onRelation✝ } =\n { onFunction := onFunction✝, onRelation...
[ " F = G", " { onFunction := Ff, onRelation := Fr } = G", " { onFunction := Ff, onRelation := Fr } = { onFunction := Gf, onRelation := Gr }", " Ff = Gf ∧ Fr = Gr" ]
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
[ " (x₁ ^ 2 + x₂ ^ 2) * (y₁ ^ 2 + y₂ ^ 2) = (x₁ * y₁ - x₂ * y₂) ^ 2 + (x₁ * y₂ + x₂ * y₁) ^ 2", " (x₁ ^ 2 + n * x₂ ^ 2) * (y₁ ^ 2 + n * y₂ ^ 2) = (x₁ * y₁ - n * x₂ * y₂) ^ 2 + n * (x₁ * y₂ + x₂ * y₁) ^ 2", " a ^ 4 + 4 * b ^ 4 = ((a - b) ^ 2 + b ^ 2) * ((a + b) ^ 2 + b ^ 2)", " a ^ 4 + 4 * b ^ 4 = (a ^ 2 - 2 * a...
[ " (x₁ ^ 2 + x₂ ^ 2) * (y₁ ^ 2 + y₂ ^ 2) = (x₁ * y₁ - x₂ * y₂) ^ 2 + (x₁ * y₂ + x₂ * y₁) ^ 2", " (x₁ ^ 2 + n * x₂ ^ 2) * (y₁ ^ 2 + n * y₂ ^ 2) = (x₁ * y₁ - n * x₂ * y₂) ^ 2 + n * (x₁ * y₂ + x₂ * y₁) ^ 2", " a ^ 4 + 4 * b ^ 4 = ((a - b) ^ 2 + b ^ 2) * ((a + b) ^ 2 + b ^ 2)", " a ^ 4 + 4 * b ^ 4 = (a ^ 2 - 2 * a...
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]
[ " IsPiSystem (univ.pi '' univ.pi C)", " univ.pi s₁ ∩ univ.pi s₂ ∈ univ.pi '' univ.pi C", " (univ.pi fun i => s₁ i ∩ s₂ i) ∈ univ.pi '' univ.pi C", " piPremeasure m (univ.pi s) = ∏ i : ι, (m i) (s i)", " (m i) (s i) = 0", " piPremeasure m (univ.pi fun i => eval i '' s) = piPremeasure m s", " ∏ i : ι, (m ...
[ " IsPiSystem (univ.pi '' univ.pi C)", " univ.pi s₁ ∩ univ.pi s₂ ∈ univ.pi '' univ.pi C", " (univ.pi fun i => s₁ i ∩ s₂ i) ∈ univ.pi '' univ.pi C", " piPremeasure m (univ.pi s) = ∏ i : ι, (m i) (s i)", " (m i) (s i) = 0", " piPremeasure m (univ.pi fun i => eval i '' s) = piPremeasure m s", " ∏ i : ι, (m ...
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
[ " N = J • N", " N ≤ J • N", " n ∈ J • N", " n = -(s * r - 1) • n", " -(s * r - 1) • n ∈ J • N" ]
[]
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite
Mathlib/RingTheory/PowerBasis.lean
84
86
theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by
rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin]
[ " FiniteDimensional.finrank R S = pb.dim" ]
[]
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
[ " Injective fun f => φ.map f", " f = g", " φ.star u (Star.mk f) = φ.star u (Star.mk g)" ]
[]
import Batteries.Data.UnionFind.Basic namespace Batteries.UnionFind @[simp] theorem arr_empty : empty.arr = #[] := rfl @[simp] theorem parent_empty : empty.parent a = a := rfl @[simp] theorem rank_empty : empty.rank a = 0 := rfl @[simp] theorem rootD_empty : empty.rootD a = a := rfl @[simp] theorem arr_push {m : UnionFind} : m.push.arr = m.arr.push ⟨m.arr.size, 0⟩ := rfl @[simp] theorem parentD_push {arr : Array UFNode} : parentD (arr.push ⟨arr.size, 0⟩) a = parentD arr a := by simp [parentD]; split <;> split <;> try simp [Array.get_push, *] · next h1 h2 => simp [Nat.lt_succ] at h1 h2 exact Nat.le_antisymm h2 h1 · next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2) @[simp] theorem parent_push {m : UnionFind} : m.push.parent a = m.parent a := by simp [parent] @[simp] theorem rankD_push {arr : Array UFNode} : rankD (arr.push ⟨arr.size, 0⟩) a = rankD arr a := by simp [rankD]; split <;> split <;> try simp [Array.get_push, *] next h1 h2 => cases h1 (Nat.lt_succ_of_lt h2) @[simp] theorem rank_push {m : UnionFind} : m.push.rank a = m.rank a := by simp [rank] @[simp] theorem rankMax_push {m : UnionFind} : m.push.rankMax = m.rankMax := by simp [rankMax] @[simp] theorem root_push {self : UnionFind} : self.push.rootD x = self.rootD x := rootD_ext fun _ => parent_push @[simp] theorem arr_link : (link self x y yroot).arr = linkAux self.arr x y := rfl
.lake/packages/batteries/Batteries/Data/UnionFind/Lemmas.lean
41
51
theorem parentD_linkAux {self} {x y : Fin self.size} : parentD (linkAux self x y) i = if x.1 = y then parentD self i else if (self.get y).rank < (self.get x).rank then if y = i then x else parentD self i else if x = i then y else parentD self i := by
dsimp only [linkAux]; split <;> [rfl; split] <;> [rw [parentD_set]; split] <;> rw [parentD_set] split <;> [(subst i; rwa [if_neg, parentD_eq]); rw [parentD_set]]
[ " parentD (arr.push { parent := arr.size, rank := 0 }) a = parentD arr a", " (if h : a < arr.size + 1 then (arr.push { parent := arr.size, rank := 0 })[a].parent else a) =\n if h : a < arr.size then arr[a].parent else a", " (arr.push { parent := arr.size, rank := 0 })[a].parent = if h : a < arr.size then arr...
[ " parentD (arr.push { parent := arr.size, rank := 0 }) a = parentD arr a", " (if h : a < arr.size + 1 then (arr.push { parent := arr.size, rank := 0 })[a].parent else a) =\n if h : a < arr.size then arr[a].parent else a", " (arr.push { parent := arr.size, rank := 0 })[a].parent = if h : a < arr.size then arr...
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
[ " x ≤ y ∨ y ≤ x", " s.toFun i ≤ y ∨ y ≤ s.toFun i", " s.toFun i ≤ s.toFun j ∨ s.toFun j ≤ s.toFun i", " i ≤ j ∨ j ≤ i" ]
[]
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]
[ " f (r • x) = g (r • x)", " eqLocus f g = ⊤ ↔ f = g" ]
[ " f (r • x) = g (r • x)" ]
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
[ " ((expSeries ℝ ℍ (2 * n)) fun x => q) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)", " (↑(2 * n)!)⁻¹ • q ^ (2 * n) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)", " k⁻¹ • q ^ (2 * n) = k⁻¹ • (-↑(normSq q)) ^ n", " k⁻¹ • (-↑(normSq q)) ^ n = k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n))", " (-↑(normSq q)) ^ n = ↑((-1) ^ n * ‖...
[]
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]
[ " ‖↑‖z‖‖ = ‖z‖", " ‖(↑‖x‖)⁻¹ • x‖ = 1", " ‖x‖ ≠ 0" ]
[ " ‖↑‖z‖‖ = ‖z‖" ]
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)]
[ " 𝟙 ↑(F.obj j) = (F.map (𝟙 j)).base", " (F.map (𝟙 j)).c.app { unop := U } =\n (Pushforward.id (F.obj j).presheaf).inv.app { unop := U } ≫\n (pushforwardEq ⋯ (F.obj j).presheaf).hom.app { unop := U }", " (F.map (𝟙 j)).c.app { unop := { carrier := carrier✝, is_open' := is_open'✝ } } =\n (Pushforwar...
[]
import Mathlib.Algebra.Group.Prod import Mathlib.Data.Set.Lattice #align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432" assert_not_exists MonoidWithZero open Prod Decidable Function namespace Nat -- Porting note: no pp_nodot --@[pp_nodot] def pair (a b : ℕ) : ℕ := if a < b then b * b + a else a * a + a + b #align nat.mkpair Nat.pair -- Porting note: no pp_nodot --@[pp_nodot] def unpair (n : ℕ) : ℕ × ℕ := let s := sqrt n if n - s * s < s then (n - s * s, s) else (s, n - s * s - s) #align nat.unpair Nat.unpair @[simp] theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by dsimp only [unpair]; let s := sqrt n have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _) split_ifs with h · simp [pair, h, sm] · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2 (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add) simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm] #align nat.mkpair_unpair Nat.pair_unpair theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by simpa [H] using pair_unpair n #align nat.mkpair_unpair' Nat.pair_unpair' @[simp] theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by dsimp only [pair]; split_ifs with h · show unpair (b * b + a) = (a, b) have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _)) simp [unpair, be, Nat.add_sub_cancel_left, h] · show unpair (a * a + a + b) = (a, b) have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq] exact Nat.add_le_add_left (le_of_not_gt h) _ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left] #align nat.unpair_mkpair Nat.unpair_pair @[simps (config := .asFn)] def pairEquiv : ℕ × ℕ ≃ ℕ := ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩ #align nat.mkpair_equiv Nat.pairEquiv #align nat.mkpair_equiv_apply Nat.pairEquiv_apply #align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply theorem surjective_unpair : Surjective unpair := pairEquiv.symm.surjective #align nat.surjective_unpair Nat.surjective_unpair @[simp] theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d := pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d)) #align nat.mkpair_eq_mkpair Nat.pair_eq_pair theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by let s := sqrt n simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add] by_cases h : n - s * s < s <;> simp [h] · exact lt_of_lt_of_le h (sqrt_le_self _) · simp at h have s0 : 0 < s := sqrt_pos.2 n1 exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0)) #align nat.unpair_lt Nat.unpair_lt @[simp] theorem unpair_zero : unpair 0 = 0 := by rw [unpair] simp #align nat.unpair_zero Nat.unpair_zero theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n | 0 => by simp | n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _)) #align nat.unpair_left_le Nat.unpair_left_le theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b) #align nat.left_le_mkpair Nat.left_le_pair
Mathlib/Data/Nat/Pairing.lean
117
119
theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by
by_cases h : a < b <;> simp [pair, h] exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
[ " n.unpair.1.pair n.unpair.2 = n", " (if n - n.sqrt * n.sqrt < n.sqrt then (n - n.sqrt * n.sqrt, n.sqrt)\n else (n.sqrt, n - n.sqrt * n.sqrt - n.sqrt)).1.pair\n (if n - n.sqrt * n.sqrt < n.sqrt then (n - n.sqrt * n.sqrt, n.sqrt)\n else (n.sqrt, n - n.sqrt * n.sqrt - n.sqrt)).2 =\n n", " ...
[ " n.unpair.1.pair n.unpair.2 = n", " (if n - n.sqrt * n.sqrt < n.sqrt then (n - n.sqrt * n.sqrt, n.sqrt)\n else (n.sqrt, n - n.sqrt * n.sqrt - n.sqrt)).1.pair\n (if n - n.sqrt * n.sqrt < n.sqrt then (n - n.sqrt * n.sqrt, n.sqrt)\n else (n.sqrt, n - n.sqrt * n.sqrt - n.sqrt)).2 =\n n", " ...
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
[ " ∀ ⦃a : γ⦄ {s : Finset γ},\n a ∉ s →\n (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) →\n (∏ x ∈ insert a s, f x, ∏ x ∈ insert a s, g x) = ∏ x ∈ insert a s, (f x, g x)", " x = ∑ i : ι, x i • fun j => if i = j then 1 else 0", " x x✝ = (∑ i : ι, x i • fun j => if i = j then 1 else 0) x✝", " ...
[ " ∀ ⦃a : γ⦄ {s : Finset γ},\n a ∉ s →\n (∏ x ∈ s, f x, ∏ x ∈ s, g x) = ∏ x ∈ s, (f x, g x) →\n (∏ x ∈ insert a s, f x, ∏ x ∈ insert a s, g x) = ∏ x ∈ insert a s, (f x, g x)", " x = ∑ i : ι, x i • fun j => if i = j then 1 else 0", " x x✝ = (∑ i : ι, x i • fun j => if i = j then 1 else 0) x✝" ]
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]
[ " volume = StieltjesFunction.id.measure", " StieltjesFunction.id.measure (Ioo ↑p ↑q) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo ↑p ↑q)", " StieltjesFunction.id.measure ↑(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1", " StieltjesFunction.id.measure (parallelepiped ⇑(stdOrthonorma...
[ " volume = StieltjesFunction.id.measure", " StieltjesFunction.id.measure (Ioo ↑p ↑q) = (Measure.map (fun x => a + x) StieltjesFunction.id.measure) (Ioo ↑p ↑q)", " StieltjesFunction.id.measure ↑(stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1", " StieltjesFunction.id.measure (parallelepiped ⇑(stdOrthonorma...
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
[ " IntegrableAtFilter f l μ", " ∀ᵐ (a : α) ∂μ.restrict s, ‖f a‖ ≤ ‖C * ‖g a‖‖", " ‖f x‖ ≤ ‖C * ‖g x‖‖", " Integrable f μ", " IntegrableAtFilter f ⊤ μ", " StronglyMeasurableAtFilter f (cocompact α) μ", " StronglyMeasurableAtFilter f atTop μ", " StronglyMeasurableAtFilter f atBot μ", " IntegrableOn f (...
[ " IntegrableAtFilter f l μ", " ∀ᵐ (a : α) ∂μ.restrict s, ‖f a‖ ≤ ‖C * ‖g a‖‖", " ‖f x‖ ≤ ‖C * ‖g x‖‖", " Integrable f μ", " IntegrableAtFilter f ⊤ μ", " StronglyMeasurableAtFilter f (cocompact α) μ", " StronglyMeasurableAtFilter f atTop μ", " StronglyMeasurableAtFilter f atBot μ", " IntegrableOn f (...
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
[ " n ≤ sSup s", " n ≤ ↑((Classical.choose ⋯).greatestOfBdd ⋯ ⋯)", " sSup s ≤ n", " ↑((Classical.choose ⋯).greatestOfBdd ⋯ ⋯) ≤ n", " sInf s ≤ n", " ↑((Classical.choose ⋯).leastOfBdd ⋯ ⋯) ≤ n", " n ≤ sInf s", " n ≤ ↑((Classical.choose ⋯).leastOfBdd ⋯ ⋯)", " sSup s = sSup ∅", " sInf s = sInf ∅", " ...
[ " n ≤ sSup s", " n ≤ ↑((Classical.choose ⋯).greatestOfBdd ⋯ ⋯)", " sSup s ≤ n", " ↑((Classical.choose ⋯).greatestOfBdd ⋯ ⋯) ≤ n", " sInf s ≤ n", " ↑((Classical.choose ⋯).leastOfBdd ⋯ ⋯) ≤ n", " n ≤ sInf s", " n ≤ ↑((Classical.choose ⋯).leastOfBdd ⋯ ⋯)", " sSup s = sSup ∅", " sInf s = sInf ∅", " ...
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
[ " StrictConvexOn ℝ univ rexp", " ∀ {x y z : ℝ}, x ∈ univ → z ∈ univ → x < y → y < z → (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)", " (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)", " (rexp y - rexp x) / (y - x) < rexp y", " 0 < y - x", " x - y < 0", " rexp y - rexp x < rexp y ...
[ " StrictConvexOn ℝ univ rexp", " ∀ {x y z : ℝ}, x ∈ univ → z ∈ univ → x < y → y < z → (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)", " (rexp y - rexp x) / (y - x) < (rexp z - rexp y) / (z - y)", " (rexp y - rexp x) / (y - x) < rexp y", " 0 < y - x", " x - y < 0", " rexp y - rexp x < rexp y ...
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)
[ " Pairwise (r on fun c => bif c then a else b) ↔ r a b", " s.Pairwise (r on f) ↔ ∃ z, ∀ x ∈ s, r (f x) z", " s.Pairwise (r on f) → ∃ z, ∀ x ∈ s, r (f x) z", " r (f x) (f y)", " r (f x) (f x)", " (∃ z, ∀ x ∈ s, r (f x) z) → s.Pairwise (r on f)", " (r on f) x y" ]
[ " Pairwise (r on fun c => bif c then a else b) ↔ r a b" ]
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
[ " (pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s = s.ι.app j", " ((pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s) PUnit.unit = s.ι.app j PUnit.unit", " ∀ (j₁ j₂ : C), (j₁ ⟶ j₂) → s.ι.app j₁ PUnit.unit = s.ι.app j₂ PUnit.unit", " s.ι.app X PUnit.unit = s.ι.app Y PUnit....
[ " (pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s = s.ι.app j", " ((pUnitCocone C).ι.app j ≫ (fun s => s.ι.app Classical.ofNonempty) s) PUnit.unit = s.ι.app j PUnit.unit", " ∀ (j₁ j₂ : C), (j₁ ⟶ j₂) → s.ι.app j₁ PUnit.unit = s.ι.app j₂ PUnit.unit", " s.ι.app X PUnit.unit = s.ι.app Y PUnit....
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
[ " exp 𝕂 (-A) = (exp 𝕂 A)⁻¹", " exp 𝕂 (-A) = Ring.inverse (exp 𝕂 A)" ]
[]
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]
[ " IsIdempotentElem I ↔ ∃ e, IsIdempotentElem e ∧ I = Submodule.span R {e}", " IsIdempotentElem I → ∃ e, IsIdempotentElem e ∧ I = Submodule.span R {e}", " ∃ e, IsIdempotentElem e ∧ I = Submodule.span R {e}", " I ≤ I • I", " I ≤ I * I", " I ≤ Submodule.span R {r}", " x ∈ Submodule.span R {r}", " r * x ∈...
[]
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]
[ " c.ord.IsLimit", " ℵ₀ = 0", " c.ord ≤ a", " c ≤ a.card", " ℵ₀ ≤ a.card", " ℵ₀ ≤ (succ a).card", " ℵ₀.ord.IsLimit", " ω.IsLimit", " a.alephIdx ≤ b.alephIdx ↔ a ≤ b" ]
[ " c.ord.IsLimit", " ℵ₀ = 0", " c.ord ≤ a", " c ≤ a.card", " ℵ₀ ≤ a.card", " ℵ₀ ≤ (succ a).card", " ℵ₀.ord.IsLimit", " ω.IsLimit" ]
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
[ " b ≤ c", " a⁻¹ ≤ 1 ↔ 1 ≤ a", " a⁻¹ * a ≤ 1 * a ↔ 1 ≤ a" ]
[ " b ≤ c" ]
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
[ " HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x", " ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2", " HasStrictFDerivAt ...
[ " HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x", " ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2", " HasStrictFDerivAt ...
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]
[ " ascPochhammer S 1 = X", " ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)", " (ascPochhammer S n).Monic", " (ascPochhammer S 0).Monic", " (ascPochhammer S (n + 1)).Monic", " map f (ascPochhammer S n) = ascPochhammer T n", " map f (ascPochhammer S 0) = ascPochhammer T 0", " map f (ascP...
[ " ascPochhammer S 1 = X", " ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1)", " (ascPochhammer S n).Monic", " (ascPochhammer S 0).Monic", " (ascPochhammer S (n + 1)).Monic" ]
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]
[ " f a b ∈ image2 f s t → a ∈ s ∧ b ∈ t", " a ∈ s ∧ b ∈ t", " a' ∈ s ∧ b' ∈ t", " image2 f s t ⊆ image2 f s' t'", " f a b ∈ image2 f s' t'", " image2 f s t ⊆ u ↔ ∀ a ∈ s, (fun b => f a b) '' t ⊆ u", " image2 f s t ⊆ u ↔ ∀ b ∈ t, (fun a => f a b) '' s ⊆ u", " x✝ ∈ (fun x => f x.1 x.2) '' s ×ˢ t ↔ x✝ ∈ i...
[ " f a b ∈ image2 f s t → a ∈ s ∧ b ∈ t", " a ∈ s ∧ b ∈ t", " a' ∈ s ∧ b' ∈ t", " image2 f s t ⊆ image2 f s' t'", " f a b ∈ image2 f s' t'", " image2 f s t ⊆ u ↔ ∀ a ∈ s, (fun b => f a b) '' t ⊆ u", " image2 f s t ⊆ u ↔ ∀ b ∈ t, (fun a => f a b) '' s ⊆ u", " x✝ ∈ (fun x => f x.1 x.2) '' s ×ˢ t ↔ x✝ ∈ i...
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]
[ " x ◃ y = x ◃ y' ↔ y = y'", " x ◃ y = x ◃ y' → y = y'", " y = y' → x ◃ y = x ◃ y'", " x ◃ y = x ◃ y", " x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'", " x ◃⁻¹ y = x ◃⁻¹ y' → y = y'", " y = y' → x ◃⁻¹ y = x ◃⁻¹ y'", " x ◃⁻¹ y = x ◃⁻¹ y", " x ◃⁻¹ y ◃⁻¹ z = (x ◃⁻¹ y) ◃⁻¹ x ◃⁻¹ z", " (x ◃ x ◃⁻¹ y) ◃ x ◃ x ◃⁻¹ y ◃⁻¹ z ...
[ " x ◃ y = x ◃ y' ↔ y = y'", " x ◃ y = x ◃ y' → y = y'", " y = y' → x ◃ y = x ◃ y'", " x ◃ y = x ◃ y", " x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y'", " x ◃⁻¹ y = x ◃⁻¹ y' → y = y'", " y = y' → x ◃⁻¹ y = x ◃⁻¹ y'", " x ◃⁻¹ y = x ◃⁻¹ y" ]
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open TopologicalSpace variable {μ ν : Measure α} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E := if hf : Integrable f μ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hs₂ => by dsimp only convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n · rw [if_pos (hs₁ n)] · rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ open Measure variable {f g : α → E} theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) : μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply @[simp] theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp #align measure_theory.with_densityᵥ_zero MeasureTheory.withDensityᵥ_zero @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
69
76
theorem withDensityᵥ_neg : μ.withDensityᵥ (-f) = -μ.withDensityᵥ f := by
by_cases hf : Integrable f μ · ext1 i hi rw [VectorMeasure.neg_apply, withDensityᵥ_apply hf hi, ← integral_neg, withDensityᵥ_apply hf.neg hi] rfl · rw [withDensityᵥ, withDensityᵥ, dif_neg hf, dif_neg, neg_zero] rwa [integrable_neg_iff]
[ " (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) ∅ = 0", " HasSum (fun i => (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (s i))\n ((fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (⋃ i, s i))", " HasSum (fun i => if MeasurableSet (s i) then ∫ (x : α) in s...
[ " (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) ∅ = 0", " HasSum (fun i => (fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (s i))\n ((fun s => if MeasurableSet s then ∫ (x : α) in s, f x ∂μ else 0) (⋃ i, s i))", " HasSum (fun i => if MeasurableSet (s i) then ∫ (x : α) in s...
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]
[ " (norm K) ((algebraMap (𝓞 K) (𝓞 L)) x) = x ^ finrank K L", " IsUnit ((norm K) x) ↔ IsUnit x", " IsUnit x", " IsUnit (⟨∏ σ ∈ univ \\ {AlgEquiv.refl}, σ ↑x, ⋯⟩ * x)", " ⟨∏ σ ∈ univ \\ {AlgEquiv.refl}, σ ↑x, ⋯⟩ * x = (algebraMap (𝓞 K) (𝓞 L)) ((norm K) x)", " ↑(⟨∏ σ ∈ univ \\ {AlgEquiv.refl}, σ ↑x, ⋯⟩ * ...
[ " (norm K) ((algebraMap (𝓞 K) (𝓞 L)) x) = x ^ finrank K L" ]
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]
[ " limsup s atTop = {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, (s (k + 1)).indicator 1 ω) atTop atTop}", " ω ∈ limsup s atTop ↔ ω ∈ {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, (s (k + 1)).indicator 1 ω) atTop atTop}", " (∀ (i : ℕ), ∃ i_1, i ≤ i_1 ∧ ω ∈ s i_1) ↔\n ω ∈ {ω | Tendsto (fun n => ∑ k ∈ Finset.ran...
[ " limsup s atTop = {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, (s (k + 1)).indicator 1 ω) atTop atTop}", " ω ∈ limsup s atTop ↔ ω ∈ {ω | Tendsto (fun n => ∑ k ∈ Finset.range n, (s (k + 1)).indicator 1 ω) atTop atTop}", " (∀ (i : ℕ), ∃ i_1, i ≤ i_1 ∧ ω ∈ s i_1) ↔\n ω ∈ {ω | Tendsto (fun n => ∑ k ∈ Finset.ran...
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
[ " (interior { carrier := Icc 0 1, isCompact' := ⋯ }.carrier).Nonempty", " (interior { carrier := univ.pi fun x => Icc 0 1, isCompact' := ⋯ }.carrier).Nonempty", " ↑(Pi.basisFun ℝ ι).parallelepiped = ↑(PositiveCompacts.piIcc01 ι)", " ↑(Pi.basisFun ℝ ι).parallelepiped = uIcc (fun i => 0) fun i => 1", " (fun i...
[ " (interior { carrier := Icc 0 1, isCompact' := ⋯ }.carrier).Nonempty", " (interior { carrier := univ.pi fun x => Icc 0 1, isCompact' := ⋯ }.carrier).Nonempty", " ↑(Pi.basisFun ℝ ι).parallelepiped = ↑(PositiveCompacts.piIcc01 ι)", " ↑(Pi.basisFun ℝ ι).parallelepiped = uIcc (fun i => 0) fun i => 1", " (fun i...
import Mathlib.Analysis.Calculus.Deriv.ZPow import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Deriv import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv import Mathlib.Analysis.Convex.Deriv #align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39" open Real Set open scoped NNReal theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _) rw [deriv_pow', interior_Ici] exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left (pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity) #align strict_convex_on_pow strictConvexOn_pow theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) : StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n) rw [deriv_pow'] replace h := Nat.pos_of_ne_zero h exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl) (Nat.cast_pos.2 h) #align even.strict_convex_on_pow Even.strictConvexOn_pow theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β} [DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) : 0 ≤ ∏ x ∈ s, f x := calc 0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x := Finset.prod_nonneg fun x _ => by split_ifs with hx · simp [hx] simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢ exact le_of_lt hx _ = _ := by rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one, Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul] #align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) : 0 ≤ ∏ k ∈ Finset.range n, (m - k) := by rcases hn with ⟨n, rfl⟩ induction' n with n ihn · simp rw [← two_mul] at ihn rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc, Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc] refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k rcases le_or_lt m k with hmk | hmk · have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _ convert sub_nonpos_of_le this · exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk) #align int_prod_range_nonneg int_prod_range_nonneg theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) : 0 < ∏ k ∈ Finset.range n, (m - k) := by refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_ rw [eq_comm, Finset.prod_eq_zero_iff] at h obtain ⟨a, ha, h⟩ := h rw [sub_eq_zero.1 h] exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩ #align int_prod_range_pos int_prod_range_pos theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) : StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0) · exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx intro x hx rw [mem_Ioi] at hx rw [iter_deriv_zpow] refine mul_pos ?_ (zpow_pos_of_pos hx _) norm_cast refine int_prod_range_pos (by decide) fun hm => ?_ rw [← Finset.coe_Ico] at hm norm_cast at hm fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc` #align strict_convex_on_zpow strictConvexOn_zpow section SqrtMulLog
Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean
115
119
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) : HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1 rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm, one_div, one_div, ← div_eq_inv_mul]
[ " StrictConvexOn ℝ (Ici 0) fun x => x ^ n", " StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))", " StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)", " 0 < ↑n", " StrictConvexOn ℝ univ fun x => x ^ n", " StrictMono (deriv fun a => a ^ n)", " StrictMono fun x => ↑n * x ^ (n - 1)", " 0 ≤ (if f x ≤...
[ " StrictConvexOn ℝ (Ici 0) fun x => x ^ n", " StrictMonoOn (deriv fun x => x ^ n) (interior (Ici 0))", " StrictMonoOn (fun x => ↑n * x ^ (n - 1)) (Ioi 0)", " 0 < ↑n", " StrictConvexOn ℝ univ fun x => x ^ n", " StrictMono (deriv fun a => a ^ n)", " StrictMono fun x => ↑n * x ^ (n - 1)", " 0 ≤ (if f x ≤...
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]
[ " (mk a).out = a", " Classical.choose h = a", " mk (out ⟨s, h⟩) = ⟨s, h⟩", " ⟨fun b => out ⟨s, h⟩ = b, ⋯⟩ = ⟨s, h⟩", " (fun b => out ⟨s, h⟩ = b) = s", " a = b", " (map f a).out = f a.out" ]
[ " (mk a).out = a", " Classical.choose h = a", " mk (out ⟨s, h⟩) = ⟨s, h⟩", " ⟨fun b => out ⟨s, h⟩ = b, ⋯⟩ = ⟨s, h⟩", " (fun b => out ⟨s, h⟩ = b) = s", " a = b" ]
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]
[ " x = y", " { decompose' := x, left_inv := xl, right_inv := xr } = y", " { decompose' := x, left_inv := xl, right_inv := xr } = { decompose' := y, left_inv := yl, right_inv := yr }", " ∀ (m : M), p m", " (decompose ℳ) ↑x = (of (fun i => ↥(ℳ i)) i) x" ]
[ " x = y", " { decompose' := x, left_inv := xl, right_inv := xr } = y", " { decompose' := x, left_inv := xl, right_inv := xr } = { decompose' := y, left_inv := yl, right_inv := yr }", " ∀ (m : M), p m" ]
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]
[ " 𝓝 = update pure 0 (⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ))", " pure 0 ≤ ⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)", " 𝓝 0 = ⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)", " (𝓝 0).HasBasis (fun γ => γ ≠ 0) Iio", " (⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)).HasBasis (fun γ => γ ≠ 0) Iio", " DirectedOn ((fun γ => Iio γ) ⁻¹'o fun x x_1 => x ≥ x_1...
[ " 𝓝 = update pure 0 (⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ))", " pure 0 ≤ ⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)", " 𝓝 0 = ⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)", " (𝓝 0).HasBasis (fun γ => γ ≠ 0) Iio", " (⨅ γ, ⨅ (_ : γ ≠ 0), 𝓟 (Iio γ)).HasBasis (fun γ => γ ≠ 0) Iio", " DirectedOn ((fun γ => Iio γ) ⁻¹'o fun x x_1 => x ≥ x_1...
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]
[ " IsLocalization (algebraMapSubmonoid C A⁰) L", " ∀ (y : ↥(algebraMapSubmonoid C A⁰)), IsUnit ((algebraMap C L) ↑y)", " IsUnit ((algebraMap C L) ↑⟨(algebraMap A C) x, ⋯⟩)", " x ≠ 0", " ∃ x, z * (algebraMap C L) ↑x.2 = (algebraMap C L) x.1", " z * (algebraMap C L) ↑(x, ⟨(algebraMap A C) ↑m, ⋯⟩).2 = (algebr...
[]
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
[ " ‖x‖ = infDist 0 {m | ↑m = x}", " ‖↑x‖ = infDist x ↑S", " infDist x (⇑(IsometryEquiv.subLeft x).symm ⁻¹' {m | ↑m = ↑x}) = infDist x ↑S", " y ∈ ⇑(IsometryEquiv.subLeft x).symm ⁻¹' {m | ↑m = ↑x} ↔ y ∈ ↑S", " ‖-x‖ = ‖x‖", " sInf (norm '' {m | ↑m = -x}) = sInf (norm '' {m | ↑m = x})", " r ∈ norm '' {m | ↑m...
[ " ‖x‖ = infDist 0 {m | ↑m = x}", " ‖↑x‖ = infDist x ↑S", " infDist x (⇑(IsometryEquiv.subLeft x).symm ⁻¹' {m | ↑m = ↑x}) = infDist x ↑S", " y ∈ ⇑(IsometryEquiv.subLeft x).symm ⁻¹' {m | ↑m = ↑x} ↔ y ∈ ↑S", " ‖-x‖ = ‖x‖", " sInf (norm '' {m | ↑m = -x}) = sInf (norm '' {m | ↑m = x})", " r ∈ norm '' {m | ↑m...
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
[ " h ▸ y = y", " ⋯ ▸ y = y", " f x y = f x' y'", " f x y = f x y", " x₁ = x₂ ↔ y₁ = y₂", " x₁ = x₂ ↔ x₁ = y₂", " x₁ = x₂ ↔ x₁ = x₂", " x = z ↔ y = z", " z = x ↔ z = y", " cast e a = a'", " cast e a = a", " e ▸ x = cast ⋯ x", " ⋯ ▸ x = cast ⋯ x", " HEq (e ▸ x) x", " HEq (⋯ ▸ x) x", " HEq...
[ " h ▸ y = y", " ⋯ ▸ y = y", " f x y = f x' y'", " f x y = f x y", " x₁ = x₂ ↔ y₁ = y₂", " x₁ = x₂ ↔ x₁ = y₂", " x₁ = x₂ ↔ x₁ = x₂", " x = z ↔ y = z", " z = x ↔ z = y", " cast e a = a'", " cast e a = a", " e ▸ x = cast ⋯ x", " ⋯ ▸ x = cast ⋯ x", " HEq (e ▸ x) x", " HEq (⋯ ▸ x) x", " HEq...
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;
[ " (zipWith swap [] x✝¹).prod x✝ ≠ x✝ → x✝ ∈ [] ∨ x✝ ∈ x✝¹", " (zipWith swap x✝¹ []).prod x✝ ≠ x✝ → x✝ ∈ x✝¹ ∨ x✝ ∈ []", " (swap (?m.1920 a l b l' x hx h) (?m.1921 a l b l' x hx h)) (?m.1919 a l b l' x hx h) ≠ ?m.1919 a l b l' x hx h", " x = a → x ∈ a :: l", " x ∈ x :: l", " x = b → x ∈ b :: l'", " x ∈ x...
[ " (zipWith swap [] x✝¹).prod x✝ ≠ x✝ → x✝ ∈ [] ∨ x✝ ∈ x✝¹", " (zipWith swap x✝¹ []).prod x✝ ≠ x✝ → x✝ ∈ x✝¹ ∨ x✝ ∈ []", " (swap (?m.1920 a l b l' x hx h) (?m.1921 a l b l' x hx h)) (?m.1919 a l b l' x hx h) ≠ ?m.1919 a l b l' x hx h", " x = a → x ∈ a :: l", " x ∈ x :: l", " x = b → x ∈ b :: l'", " x ∈ x...